@bendyline/gezel-service 1.0.7 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/dist/bin/gezeld.js +6253 -3616
  2. package/dist/handboek-content/whats-new/1.26224.md +1 -0
  3. package/dist/handboek-content/whats-new/1.26226.md +1 -0
  4. package/dist/handboek-content/whats-new/1.26231.md +1 -0
  5. package/dist/handboek-content/whats-new/1.26234.md +1 -0
  6. package/dist/handboek-content/whats-new/1.26237.md +1 -0
  7. package/dist/handboek-content/whats-new/1.26244.md +2 -1
  8. package/dist/handboek-content/whats-new/1.26247.md +88 -0
  9. package/dist/handboek-content/whats-new/whats-new-index.md +1 -0
  10. package/dist/index-store/static-index-worker.js +17 -1
  11. package/dist/index.d.ts +473 -209
  12. package/dist/index.js +6251 -3614
  13. package/dist/memory/embed-worker.js +58 -2
  14. package/dist/memory/image-embed-worker.js +8 -0
  15. package/dist/providers/llama-cpp/gguf-metadata-worker.js +2 -0
  16. package/dist/providers/mlx/python/gezel_mlx_server.py +18 -18
  17. package/dist/ui/assets/AmbientDashboardCard-Cf5fi_fY.js +1 -0
  18. package/dist/ui/assets/{AudioEngineSettings-BDrNIGGm.js → AudioEngineSettings-D3L7HOHe.js} +1 -1
  19. package/dist/ui/assets/{BenchmarksView-CHyujjs8.js → BenchmarksView-B68hrLCl.js} +1 -1
  20. package/dist/ui/assets/CatalogBrowser-DEM9t7Es.js +1 -0
  21. package/dist/ui/assets/{ChannelsSettings-Be_W1mr8.js → ChannelsSettings-DtK_k0Ul.js} +1 -1
  22. package/dist/ui/assets/ChatTimelineView-CQ4Sf4Ip.js +7 -0
  23. package/dist/ui/assets/ConfirmDialog-Dt1ed4Fh.js +1 -0
  24. package/dist/ui/assets/ConnectedAppsPanel-Cl8LEkrt.js +1 -0
  25. package/dist/ui/assets/CraftbookEditor-DEQRlQ2p.js +1 -0
  26. package/dist/ui/assets/{CraftbookScriptEditorView-DXIZYZT3.js → CraftbookScriptEditorView-DhXkkIdK.js} +1 -1
  27. package/dist/ui/assets/{CraftbookTabContent-Bm7t_b37.js → CraftbookTabContent-_oIdpQTG.js} +1 -1
  28. package/dist/ui/assets/{CraftbookToolsetSetup-DTEA-3K3.js → CraftbookToolsetSetup-BKg136L1.js} +1 -1
  29. package/dist/ui/assets/{CraftbooksView-C4X99TTe.js → CraftbooksView-Dm2zH-nW.js} +2 -2
  30. package/dist/ui/assets/{DiffpackReviewView-ClcNxtmF.js → DiffpackReviewView-EFLGJnwr.js} +1 -1
  31. package/dist/ui/assets/DocumentDetail-ClDRj2N-.js +1 -0
  32. package/dist/ui/assets/DocumentsView-ny9oieg2.js +1 -0
  33. package/dist/ui/assets/DropdownMenu-S4d9-3j3.js +1 -0
  34. package/dist/ui/assets/Ds4Settings-CeWlm5Vf.js +1 -0
  35. package/dist/ui/assets/EmbeddedChat-Hjrrgpao.js +1 -0
  36. package/dist/ui/assets/{FaceRecognitionCard-D3hdc7uU.js → FaceRecognitionCard-D7ufKqjI.js} +1 -1
  37. package/dist/ui/assets/FileMapView-DRjf59RH.js +1 -0
  38. package/dist/ui/assets/{FoldersSettings-BcNzl4vT.js → FoldersSettings-DDUhaFio.js} +1 -1
  39. package/dist/ui/assets/GezelDetail-Cph6pVGb.js +1 -0
  40. package/dist/ui/assets/{GezelJsonEditor-fOvYclu9.js → GezelJsonEditor-7vDGyBib.js} +1 -1
  41. package/dist/ui/assets/{GezellenView-BTzhHrxi.js → GezellenView-DQhcO1CP.js} +1 -1
  42. package/dist/ui/assets/{GildeUpdatesCard-Bq6XEpLP.js → GildeUpdatesCard-UKKNm_U8.js} +1 -1
  43. package/dist/ui/assets/{GithubSignInChip-CnlTCG8G.js → GithubSignInChip-DjM3qZsL.js} +1 -1
  44. package/dist/ui/assets/{HandboekMediaProvider-BfQW8_Nr.js → HandboekMediaProvider-DixaXTAH.js} +1 -1
  45. package/dist/ui/assets/HandboekView-BeNQqho9.js +1 -0
  46. package/dist/ui/assets/HistoryView-E2szGNGS.js +1 -0
  47. package/dist/ui/assets/{HomeView-CB_5TJIp.css → HomeView-CNeqCFPc.css} +1 -1
  48. package/dist/ui/assets/HomeView-CkiS3DXy.js +1 -0
  49. package/dist/ui/assets/{ImageEngineSettings-BpMfQy4f.js → ImageEngineSettings-BCKT7Gvi.js} +1 -1
  50. package/dist/ui/assets/{ImageRecognitionSettings-Ct-7-Oas.js → ImageRecognitionSettings-DD6syFez.js} +1 -1
  51. package/dist/ui/assets/IncompleteDownloads-BiPaaahS.js +1 -0
  52. package/dist/ui/assets/InstallProgressRow-DyKOI4MU.js +1 -0
  53. package/dist/ui/assets/KnowledgeCatalogsCard-B132vzRa.js +1 -0
  54. package/dist/ui/assets/KnowledgeView-CtPuIlN4.js +1 -0
  55. package/dist/ui/assets/LlamaCppSettings-D6zHcu4W.js +1 -0
  56. package/dist/ui/assets/{MarkdownField-D-0Zw7gM.js → MarkdownField-CK8K3fzj.js} +1 -1
  57. package/dist/ui/assets/MemoriesTree-DzjXzIrM.js +1 -0
  58. package/dist/ui/assets/{MicrophoneSettings-BIaFxyY_.js → MicrophoneSettings-1FH83SCq.js} +1 -1
  59. package/dist/ui/assets/MlxSettings-BYxUqFnJ.js +1 -0
  60. package/dist/ui/assets/ModelPicker-DoXPfQkQ.js +1 -0
  61. package/dist/ui/assets/{NewScriptDialog-D-gkY8TS.js → NewScriptDialog-C5X-7PMt.js} +1 -1
  62. package/dist/ui/assets/NewTaskDialog-Cyqtmigv.js +2 -0
  63. package/dist/ui/assets/{OllamaSettings-oIE2Mech.js → OllamaSettings-DkjmA-sB.js} +1 -1
  64. package/dist/ui/assets/ProjectChat-YEqUME6k.js +5 -0
  65. package/dist/ui/assets/{ProjectConnectionsTab-BZqp-oKI.js → ProjectConnectionsTab-dFCJpW93.js} +1 -1
  66. package/dist/ui/assets/ProjectGitStatusBar-CjZxG54t.js +1 -0
  67. package/dist/ui/assets/{ProjectGithubView-w8suLCsA.js → ProjectGithubView-CQ4-tmPx.js} +1 -1
  68. package/dist/ui/assets/{ProjectMailTab-DGo7eyB8.js → ProjectMailTab-NaScsZJf.js} +1 -1
  69. package/dist/ui/assets/ProjectOverviewView-ChjxbQas.js +1 -0
  70. package/dist/ui/assets/{ProjectTimeline-DRe3D9qY.js → ProjectTimeline-BZpdCisR.js} +1 -1
  71. package/dist/ui/assets/ProjectsView-J77ECk6V.js +7 -0
  72. package/dist/ui/assets/{RecommendedBadge-BKiDixnB.js → RecommendedBadge-D0m68PAu.js} +1 -1
  73. package/dist/ui/assets/{RemoteServersPanel-DGyl6-Rg.js → RemoteServersPanel-BdLOoORu.js} +1 -1
  74. package/dist/ui/assets/ScriptEditorTabs-BFvIiDFZ.js +2 -0
  75. package/dist/ui/assets/ScriptEditorView-B09rm1vz.js +5 -0
  76. package/dist/ui/assets/{ScriptsView-WQc28TmQ.js → ScriptsView-BvNAJXpo.js} +1 -1
  77. package/dist/ui/assets/{SecurityComplianceSettings-DsMEA4J3.js → SecurityComplianceSettings-DzGOnptO.js} +1 -1
  78. package/dist/ui/assets/SessionSwitcher-6okzcxT7.js +1 -0
  79. package/dist/ui/assets/SettingsView-Dur4dLhW.js +3 -0
  80. package/dist/ui/assets/SquisqIntegration-6v3yNOIP.js +2 -0
  81. package/dist/ui/assets/{StorageCleanupDialog-DHqwyMZZ.js → StorageCleanupDialog-OQlomMJD.js} +1 -1
  82. package/dist/ui/assets/{StorageUsageCard-CdT6SU51.js → StorageUsageCard-f6c6qTbM.js} +1 -1
  83. package/dist/ui/assets/Tabs-jE0Z5Tzd.js +1 -0
  84. package/dist/ui/assets/TaskTabContent-0w3kAUWR.js +1 -0
  85. package/dist/ui/assets/TasksView-BVMT4BAY.js +1 -0
  86. package/dist/ui/assets/{TerminalCodeEditor-77pBm6f3.js → TerminalCodeEditor-DO7zLKy-.js} +2 -2
  87. package/dist/ui/assets/ToolsetsEditor-Bb1wD5mV.js +8 -0
  88. package/dist/ui/assets/TransformToolbarButton-BWYkEB0d.js +5 -0
  89. package/dist/ui/assets/UnrecognizedModels-HtdMZUqK.js +1 -0
  90. package/dist/ui/assets/{VideoEngineSettings-DzMeINuv.js → VideoEngineSettings-Dq8Nw_tK.js} +1 -1
  91. package/dist/ui/assets/{WorkspaceIndexPane-DU4yd4Ai.js → WorkspaceIndexPane-fpDz4MwZ.js} +1 -1
  92. package/dist/ui/assets/{api-BX5xXiFs.js → api-BPraLwsh.js} +1 -1
  93. package/dist/ui/assets/chat-thread-memory-Be48zsyG.js +1 -0
  94. package/dist/ui/assets/chunk-6ECMNUIP-DDVjPyfK.js +15 -0
  95. package/dist/ui/assets/{chunk-6N2J7C2B-B5QIrD9m.js → chunk-6N2J7C2B-CsppiLVr.js} +1 -1
  96. package/dist/ui/assets/{chunk-A6N6IN3I-DXok09eC.js → chunk-A6N6IN3I-ofeM4l8g.js} +1 -1
  97. package/dist/ui/assets/chunk-B7GEAZBI-Divd2h1k.js +1 -0
  98. package/dist/ui/assets/chunk-DXYWKZ52-BXcAlClu.js +1 -0
  99. package/dist/ui/assets/chunk-FLR2ARKC-D7wrvQgT.js +2 -0
  100. package/dist/ui/assets/chunk-IIQYS2YH-DKZhWMpn.js +1 -0
  101. package/dist/ui/assets/{chunk-ILCJ3WFD-WRukZ7R1.js → chunk-ILCJ3WFD-CLZxw4Ge.js} +3 -3
  102. package/dist/ui/assets/chunk-OBADJV7C-CDVOcmYt.js +1 -0
  103. package/dist/ui/assets/chunk-Q77KNJIN-BIDRf0aP.js +6 -0
  104. package/dist/ui/assets/chunk-S5PCVMKU-Df5XzhSE.js +6 -0
  105. package/dist/ui/assets/chunk-UBFT2CDQ-FexGDigd.js +31 -0
  106. package/dist/ui/assets/{chunk-USU6HTKB-D5FmDzJU.js → chunk-USU6HTKB-B_p-YcDp.js} +1 -1
  107. package/dist/ui/assets/chunk-VKXOZTYP-BoVvWSBR.js +5 -0
  108. package/dist/ui/assets/{chunk-6RQOV3B3-CwvKotJw.js → chunk-VPWPEMZJ-DRKoa_j0.js} +1 -1
  109. package/dist/ui/assets/{chunk-WATAOG4Y-DXg2lov5.js → chunk-WATAOG4Y-C1EXVPmG.js} +1 -1
  110. package/dist/ui/assets/{container-B7jJtK5V.js → container-Ce94efbg.js} +1 -1
  111. package/dist/ui/assets/csv-62UGQMzZ.js +1 -0
  112. package/dist/ui/assets/data-B2kHjlc5.js +1 -0
  113. package/dist/ui/assets/dist-B9-VrAP8.js +2 -0
  114. package/dist/ui/assets/dist-BaHut5iX.js +2 -0
  115. package/dist/ui/assets/dist-BqGwkOe5.js +225 -0
  116. package/dist/ui/assets/dist-ZnIgkoEi.js +4 -0
  117. package/dist/ui/assets/{dist-BHl1ZAVG.js → dist-l6uUFZMV.js} +2 -2
  118. package/dist/ui/assets/dist-pLLFUPO-.js +1 -0
  119. package/dist/ui/assets/{doc-s6H7T0IO.js → doc-Dr5K49bx.js} +28 -28
  120. package/dist/ui/assets/document-companion-BQk2kS0F.js +1 -0
  121. package/dist/ui/assets/document-import-QoM9UxJr.js +1 -0
  122. package/dist/ui/assets/docx-sXa1Rf41.js +2 -0
  123. package/dist/ui/assets/{epub-B98SgHBz.js → epub-RopMP0ec.js} +4 -4
  124. package/dist/ui/assets/{export-options-Bu-tI6og.js → export-options-f7PKjEBb.js} +1 -1
  125. package/dist/ui/assets/extract-UTAOG7LV-4WDRw1o4.js +1 -0
  126. package/dist/ui/assets/file-browser-c2tf4MIb.js +5 -0
  127. package/dist/ui/assets/html-BGVOMhkv.js +253 -0
  128. package/dist/ui/assets/icons-DWaUNQbT.js +1 -0
  129. package/dist/ui/assets/images-JLBFCDD4-6JitW0hD.js +1 -0
  130. package/dist/ui/assets/index-B8NcxqcR.css +1 -0
  131. package/dist/ui/assets/index-C0DYtvfg.js +34 -0
  132. package/dist/ui/assets/index-J8TOMdvV.js +2 -0
  133. package/dist/ui/assets/{infer-kCLH1C8z.js → infer-LEGOsu64.js} +2 -2
  134. package/dist/ui/assets/ironcalc-BAi5gOlE.js +3 -0
  135. package/dist/ui/assets/layouts-2A7QNF6Y-CVwP7noP.js +1 -0
  136. package/dist/ui/assets/{mail-link-CI6YD6k2.js → mail-link-DXkmCd5b.js} +1 -1
  137. package/dist/ui/assets/markdown-baseline-9B52XlX2.js +1 -0
  138. package/dist/ui/assets/{markdown-Bi9b5f5Y.js → markdown-ryKA_OmY.js} +1 -1
  139. package/dist/ui/assets/materialize-A34OZGEU-xNNKzytx.js +1 -0
  140. package/dist/ui/assets/model-inventory-ykSm_IT5.js +1 -0
  141. package/dist/ui/assets/{model-quantization-BDzrELN_.js → model-quantization-CLO7XLoF.js} +1 -1
  142. package/dist/ui/assets/{monaco-base-BiVSa1J-.js → monaco-base-B1H1U1Sw.js} +1 -1
  143. package/dist/ui/assets/{monaco-setup-UeltVkg_.js → monaco-setup-DjhrGQui.js} +1 -1
  144. package/dist/ui/assets/{new-project-meta-0xhggGA_.js → new-project-meta-_f9sfcRX.js} +1 -1
  145. package/dist/ui/assets/outside-in-D73N1g_b.js +3 -0
  146. package/dist/ui/assets/{pdf-DgTjy3rN.js → pdf-BOjVDlCK.js} +3 -3
  147. package/dist/ui/assets/{pending-drafts-YVW6X55O.js → pending-drafts-B11MKQ9R.js} +1 -1
  148. package/dist/ui/assets/{poppetje-Ce-02Aqi.js → poppetje-DLB8uevw.js} +2 -2
  149. package/dist/ui/assets/pptx-BuxyNxQh.js +6 -0
  150. package/dist/ui/assets/primitives-CWrGZpPI.js +41 -0
  151. package/dist/ui/assets/run-export-ChaMXrKS.js +23 -0
  152. package/dist/ui/assets/squisq-formats-aAdypXoy.js +1 -0
  153. package/dist/ui/assets/standalone-source-q_Zzd1bd.js +11 -0
  154. package/dist/ui/assets/storage-D8pE2zg0.js +1 -0
  155. package/dist/ui/assets/styles-BhnF3s2q.css +1 -0
  156. package/dist/ui/assets/styles-CKVKwqoQ.js +550 -0
  157. package/dist/ui/assets/table-fcouR4db.js +1 -0
  158. package/dist/ui/assets/{terminal-monaco-setup-DNoK2tN4.js → terminal-monaco-setup-BAzrVzeR.js} +1 -1
  159. package/dist/ui/assets/{useCompactLayout-BarJPYcv.js → useCompactLayout-Dtolvzye.js} +0 -0
  160. package/dist/ui/assets/{useCopilotAvailability-BH1nLXQI.js → useCopilotAvailability-3xZvKgTF.js} +1 -1
  161. package/dist/ui/assets/{useDiffpacks-CK8W_OD_.js → useDiffpacks-Dsnr0wtX.js} +1 -1
  162. package/dist/ui/assets/{useGitSync-DWxX5-7K.js → useGitSync-BCTptQsp.js} +1 -1
  163. package/dist/ui/assets/{useShowWorkInProgressFeatures-DwwviLRO.js → useShowWorkInProgressFeatures-BhDNuQiU.js} +1 -1
  164. package/dist/ui/assets/{useTotalRamBytes-WoN_mi-V.js → useTotalRamBytes-DIx-_pf8.js} +1 -1
  165. package/dist/ui/assets/wasm-DdxEDD2H.js +1 -0
  166. package/dist/ui/assets/wasm_bg-DW9Xt_vt.wasm +0 -0
  167. package/dist/ui/assets/xlsx-DyBGuAO1.js +4 -0
  168. package/dist/ui/index.html +19 -18
  169. package/package.json +11 -11
  170. package/dist/ui/assets/AmbientDashboardCard-C1Ee-FKZ.js +0 -1
  171. package/dist/ui/assets/CatalogBrowser-Bz8ZtxPn.js +0 -1
  172. package/dist/ui/assets/ChatTimelineView-Do9EryEH.js +0 -7
  173. package/dist/ui/assets/ConfirmDialog-BHFs6vmJ.js +0 -1
  174. package/dist/ui/assets/ConnectedAppsPanel-BtMayq0R.js +0 -1
  175. package/dist/ui/assets/CraftbookEditor-D5jTzWwF.js +0 -1
  176. package/dist/ui/assets/DocumentDetail-CPU51d04.js +0 -1
  177. package/dist/ui/assets/DocumentsView-B6OyjvJ0.js +0 -1
  178. package/dist/ui/assets/DropdownMenu-D5fCzIrh.js +0 -1
  179. package/dist/ui/assets/Ds4Settings-CrUM_KGP.js +0 -1
  180. package/dist/ui/assets/EmbeddedChat-ue9ia-WY.js +0 -1
  181. package/dist/ui/assets/FileMapView-CxvfDLGA.js +0 -1
  182. package/dist/ui/assets/GezelDetail-DHuqBK55.js +0 -1
  183. package/dist/ui/assets/HandboekView-CPnnyj29.js +0 -1
  184. package/dist/ui/assets/HistoryView-B4VAfEMe.js +0 -1
  185. package/dist/ui/assets/HomeView-ccH60J6f.js +0 -1
  186. package/dist/ui/assets/KnowledgeCatalogsCard-Bi5Rx9Iz.js +0 -1
  187. package/dist/ui/assets/KnowledgeView-DAwjwLZo.js +0 -1
  188. package/dist/ui/assets/LlamaCppSettings-Ceyk9pDP.js +0 -1
  189. package/dist/ui/assets/MemoriesTree-BKZEPJpm.js +0 -1
  190. package/dist/ui/assets/MlxSettings-CG3wfuc3.js +0 -1
  191. package/dist/ui/assets/ModelPicker-CCBVjLMS.js +0 -1
  192. package/dist/ui/assets/NewPathDialog-D4jnNBfP.js +0 -1
  193. package/dist/ui/assets/NewTaskDialog-Ox9D612Z.js +0 -2
  194. package/dist/ui/assets/ProjectChat-DMwKnkW-.js +0 -5
  195. package/dist/ui/assets/ProjectGitStatusBar-C6bkCSby.js +0 -1
  196. package/dist/ui/assets/ProjectOverviewView-NNwXd_QQ.js +0 -1
  197. package/dist/ui/assets/ProjectsView-SBPgYOq8.js +0 -7
  198. package/dist/ui/assets/ScriptEditorTabs-paocQ6dj.js +0 -2
  199. package/dist/ui/assets/ScriptEditorView-N9zSLqqi.js +0 -5
  200. package/dist/ui/assets/SessionSwitcher-C8te7YSe.js +0 -1
  201. package/dist/ui/assets/SettingsView-Brl4JQkW.js +0 -3
  202. package/dist/ui/assets/Tabs-BAY1Q79B.js +0 -1
  203. package/dist/ui/assets/TaskTabContent-CNPJ4DQj.js +0 -1
  204. package/dist/ui/assets/TasksView-DuMjFS8S.js +0 -1
  205. package/dist/ui/assets/ToolsetsEditor-BdxHnIBj.js +0 -8
  206. package/dist/ui/assets/TransformToolbarButton-CVg5nz36.js +0 -5
  207. package/dist/ui/assets/UnrecognizedModels-Cw9Ku_bW.js +0 -1
  208. package/dist/ui/assets/chat-thread-memory-CZGcwgGo.js +0 -1
  209. package/dist/ui/assets/chunk-6ECMNUIP-C1kohb1U.js +0 -15
  210. package/dist/ui/assets/chunk-AONELFLA-Cv2nS9ga.js +0 -1
  211. package/dist/ui/assets/chunk-IIQYS2YH-Dxg6MAfT.js +0 -1
  212. package/dist/ui/assets/chunk-MIKKUKOD-XIkmalSN.js +0 -31
  213. package/dist/ui/assets/chunk-NNJLSQPW-DJA6camf.js +0 -5
  214. package/dist/ui/assets/chunk-S5PCVMKU-DbCZ5AUH.js +0 -6
  215. package/dist/ui/assets/csv-xmd1_Aqd.js +0 -4
  216. package/dist/ui/assets/dist-BPx-FyRH.js +0 -222
  217. package/dist/ui/assets/dist-Bvo52IGx.js +0 -1
  218. package/dist/ui/assets/dist-D5aoNQwk.js +0 -2
  219. package/dist/ui/assets/docx-Cj4A9MhC.js +0 -2
  220. package/dist/ui/assets/extract-UTAOG7LV-C4b7ycaL.js +0 -1
  221. package/dist/ui/assets/file-browser-80qWoVju.js +0 -5
  222. package/dist/ui/assets/html-C9TlzI57.js +0 -253
  223. package/dist/ui/assets/icons-C9dD-bDi.js +0 -1
  224. package/dist/ui/assets/images-ESPQKVTW-D7SgdVJ_.js +0 -1
  225. package/dist/ui/assets/index-D1m4Wx8V.css +0 -1
  226. package/dist/ui/assets/index-DXWR4qW1.js +0 -34
  227. package/dist/ui/assets/layouts-2A7QNF6Y-De2t-YXl.js +0 -1
  228. package/dist/ui/assets/markdown-baseline-HMqF2ChK.js +0 -1
  229. package/dist/ui/assets/outside-in-BFVUUcLa.js +0 -3
  230. package/dist/ui/assets/pptx-6ChgUEf4.js +0 -6
  231. package/dist/ui/assets/primitives-DEsn1shf.js +0 -41
  232. package/dist/ui/assets/run-export-BrYhHj1O.js +0 -23
  233. package/dist/ui/assets/standalone-source-D6mbpa3h.js +0 -11
  234. package/dist/ui/assets/storage-fn4FCEVK.js +0 -1
  235. package/dist/ui/assets/styles-C0EoNJbk.css +0 -1
  236. package/dist/ui/assets/styles-CKr_yrbn.js +0 -541
  237. package/dist/ui/assets/xlsx-DH7sTb3W.js +0 -4
@@ -0,0 +1,4 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{t as r}from"./react-dom-OL4w_gzs.js";import{a as i,i as a,r as o}from"./table-fcouR4db.js";var s=e(t(),1),c=e(r(),1);function l(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function u(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function d(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var f=(e,t)=>Math.abs(e-t)<1.01,p=(e,t,n)=>{let r;return Object.assign(function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)},{cancel:()=>{e.clearTimeout(r)}})},m,h=()=>{if(m!==void 0)return m;if(typeof navigator>`u`)return m=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return m=!0;let e=navigator.maxTouchPoints;return m=navigator.platform===`MacIntel`&&e!==void 0&&e>0},g=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},_=e=>e,v=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},ee=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(g(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(g(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},y={passive:!0},te=typeof window>`u`||`onscrollend`in window,ne=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&te,o=0,s=a?null:p(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,y),a&&r.addEventListener(`scrollend`,u,y),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u),s?.cancel()}},re=(e,t)=>ne(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),ie=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},b=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},x=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.isIndexInRange(n)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:_,rangeExtractor:v,onChange:()=>{},measureElement:ie,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=Math.max(0,e.start+t);n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=u(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.isScrolling=!1,this.scrollDirection=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!h()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,y),e.addEventListener(`touchend`,n,y),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&(h()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;if(this._iosDeferredAdjustment<0&&e>=t-1){this._iosDeferredAdjustment=0;return}let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=u(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(e,t,n,r,i,a,o,s)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s}),{key:!1}),this.isIndexInRange=e=>e>=0&&e<this.options.count,this.getMeasurements=u(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o,gap:s},c)=>{let u=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let d=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=e*2,a=this._flatMeasurements;if(!a||a.length<i){let e=new Float64Array(i);a&&d>0&&e.set(a.subarray(0,d*2)),a=e,this._flatMeasurements=a}let o;if(d===0)o=t+n;else{let e=d-1;o=a[e*2]+a[e*2+1]+s}for(let t=d;t<e;t++){let e=r(t),n=u.get(e),i=typeof n==`number`?n:this.options.estimateSize(t);a[t*2]=o,a[t*2+1]=i,o+=i+s}let c=l(e,a,r);return this.measurementsCache=c,c}let f=this.measurementsCache.slice(0,d),p=Array(a).fill(void 0),m=new Float64Array(a),h=0;for(let e=0;e<d;e++){let t=f[e];t&&(p[t.lane]===void 0&&h++,p[t.lane]=e,m[t.lane]=t.end)}for(let i=d;i<e;i++){let e=r(i),c=this.laneAssignments.get(i),l,d,g=o===`estimate`||u.has(e);if(c!==void 0&&this.options.lanes>1){l=c;let e=p[l],r=e===void 0?void 0:f[e];d=r?r.end+s:t+n}else if(h===a){let e=0,t=m[0],n=p[0];for(let r=1;r<a;r++){let i=m[r];(i<t||i===t&&p[r]<n)&&(e=r,t=i,n=p[r])}l=e,d=t+s,g&&this.laneAssignments.set(i,l)}else l=i%this.options.lanes,d=t+n,g&&this.laneAssignments.set(i,l);let _=u.get(e),v=typeof _==`number`?_:this.options.estimateSize(i),ee=d+v;f[i]={index:i,start:d,size:v,end:ee,key:e,lane:l},p[l]===void 0&&h++,p[l]=i,m[l]=ee}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=u(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=w(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=u(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e);if(!this.isIndexInRange(t))return;let n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(!this.isIndexInRange(e))return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=this.itemSizeCache.get(i)??n,s=t-o;if(s!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,c=a?this.getTotalSize():0,l=this.getScrollOffset()+this.scrollAdjustments,u=this.itemSizeCache.has(i)?r+o<=l&&this.scrollDirection!==`backward`:r<l,d=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?u:this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},s,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++;let f=!1;a?f=this.applyScrollAdjustment(this.getTotalSize()-c):d&&(f=this.applyScrollAdjustment(s)),this.notify(f)}},this.getVirtualItems=u(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return d(t[S(0,t.length-1,r?e=>n[e*2]:e=>d(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0;let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{this._iosDeferredAdjustment=0,e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){return e===0?!1:h()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&f(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},S=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function C(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function w(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=C(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=S(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var T=typeof document<`u`?s.useLayoutEffect:s.useEffect;function ae({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=s.useReducer(e=>e+1,0)[1],a=s.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}},l=e=>{let t=a.current;if(!t.enabled||!t.container)return;o(e);let n=!!e.options.horizontal,r=t.mode===`transform`,i=n?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let a of c){let o=a.start-s,c=e.elementsCache.get(a.key);c&&t.lastPositions.get(c)!==o&&(t.lastPositions.set(c,o),r?c.style.transform=n?`translate3d(${o}px, 0, 0)`:`translate3d(0, ${o}px, 0)`:c.style[i]=`${o}px`)}},u={...r,onChange:(t,n)=>{var o;let s=a.current,u=!0;if(s.enabled){l(t);let e=t.range,n=s.prevRange;u=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,u&&(s.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}u&&(e&&n?(0,c.flushSync)(i):i()),(o=r.onChange)==null||o.call(r,t,n)}},[d]=s.useState(()=>{let e=new x(u);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return d.setOptions(u),T(()=>d._didMount(),[]),T(()=>(o(d),d._willUpdate())),T(()=>{l(d)}),d}function oe(e){return ae({observeElementRect:ee,observeElementOffset:re,scrollToFn:b,...e})}var E=n();function se(e,t){let n=!1,r=!1,i=!1;for(let a of e){let e=a[t];if(e==null||e===``)continue;if(i=!0,typeof e==`number`){n=!0;continue}if(typeof e==`boolean`){r=!0;continue}let s=String(e);if(o(s)){n=!0;continue}if(/^(?:true|false)$/i.test(s.trim())){r=!0;continue}return`string`}return i?n&&!r?`number`:r&&!n?`boolean`:`string`:`string`}function D(e){return e==null||typeof e==`string`&&e.trim()===``}function O(e){let t=e.cells.length;return{columns:e.headers.map((n,r)=>{let i=e.hints?.[r]?.kind??se(e.cells,r);if(i===`number`){let a=new Float64Array(t),o=new Uint8Array(t);for(let n=0;n<t;n++){let t=e.cells[n]?.[r];if(D(t))continue;let i=typeof t==`number`?t:Number(String(t).trim());Number.isFinite(i)&&(a[n]=i,o[n]=1)}return{kind:i,name:n,data:a,valid:o}}if(i===`boolean`){let a=new Uint8Array(t),o=new Uint8Array(t);for(let n=0;n<t;n++){let t=e.cells[n]?.[r];D(t)||(a[n]=(typeof t==`boolean`?t:/^true$/i.test(String(t).trim()))?1:0,o[n]=1)}return{kind:i,name:n,data:a,valid:o}}let a=new Int32Array(t),o=[],s=new Map;for(let n=0;n<t;n++){let t=e.cells[n]?.[r];if(D(t)){a[n]=-1;continue}let i=typeof t==`string`?t:String(t),c=s.get(i);c===void 0&&(c=o.length,o.push(i),s.set(i,c)),a[n]=c}return{kind:i,name:n,codes:a,dict:o}}),rowCount:t}}function k(e,t){if(e.kind===`number`)return e.valid[t]?e.data[t]:null;if(e.kind===`boolean`)return e.valid[t]?e.data[t]===1:null;let n=e.codes[t];return n<0?null:e.dict[n]}function A(e){let t=[],n=0,r=[],i=[],a=[],o=new Intl.Collator(void 0,{numeric:!0});function s(e){let t=e.trim();return t===``||/^0\d/.test(t)?!1:Number.isFinite(Number(t))}function c(e){if(!e.rank||e.rank.length!==(e.dict?.length??0)){let t=e.dict??[],n=t.map((e,t)=>t);n.sort((e,n)=>o.compare(t[e],t[n]));let r=new Int32Array(t.length);for(let e=0;e<n.length;e++)r[n[e]]=e;e.rank=r}return e.rank}function l(e){return(!e.lower||e.lower.length!==(e.dict?.length??0))&&(e.lower=(e.dict??[]).map(e=>e.toLowerCase())),e.lower}function u(e,t){return e.kind===`number`||e.kind===`boolean`?!e.valid||e.valid[t]===0:e.data[t]<0}function d(e,t){return u(e,t)?``:e.kind===`number`?String(e.data[t]):e.kind===`boolean`?e.data[t]===1?`true`:`false`:e.dict[e.data[t]]}function f(e,t){return u(e,t)?null:e.kind===`number`?e.data[t]:e.kind===`boolean`?e.data[t]===1:e.dict[e.data[t]]}function p(e,n){let r=t[n.col];if(!r)return!0;let i=n.value.trim(),a=u(r,e),c=e=>n.caseSensitive?e:e.toLowerCase(),f=()=>!n.caseSensitive&&(r.kind===`string`||r.kind===`date`)&&!a?l(r)[r.data[e]].trim():c(d(r,e).trim());switch(n.op){case`=`:return i===``?a:a?!1:r.kind===`number`&&s(i)?r.data[e]===Number(i):f()===c(i);case`!=`:return!p(e,{...n,op:`=`});case`~`:return!a&&f().includes(c(i));case`!~`:return!p(e,{...n,op:`~`});case`^~`:return!a&&f().startsWith(c(i));case`$~`:return!a&&f().endsWith(c(i));default:{if(a)return!1;let t;return t=r.kind===`number`&&s(i)?r.data[e]-Number(i):o.compare(d(r,e).trim(),i),n.op===`>`?t>0:n.op===`<`?t<0:n.op===`>=`?t>=0:t<=0}}}function m(){let e=[];for(let t=0;t<n;t++){let n=!0;for(let e of a)if(!p(t,e)){n=!1;break}n&&e.push(t)}if(i.length>0){for(let e of i){let n=t[e.col];n&&(n.kind===`string`||n.kind===`date`)&&c(n)}e.sort((e,n)=>{for(let r of i){let i=t[r.col];if(!i)continue;let a=u(i,e),o=u(i,n);if(a||o){if(a&&o)continue;return a?1:-1}let s;if(i.kind===`number`)s=i.data[e]-i.data[n];else if(i.kind===`boolean`)s=i.data[e]-i.data[n];else{let t=i.rank;s=t[i.data[e]]-t[i.data[n]]}if(s!==0)return r.dir===`desc`?-s:s}return e-n})}r=e}function h(e){let r=t[e.col];if(!r||e.rowId<0||e.rowId>=n)return;if(r.kind===`number`){let t=e.value===null||e.value===``;r.valid[e.rowId]=+!t,r.data[e.rowId]=t?0:Number(e.value);return}if(r.kind===`boolean`){let t=e.value===null||e.value===``;r.valid[e.rowId]=+!t,r.data[e.rowId]=+(e.value===!0);return}if(e.value===null||e.value===``){r.data[e.rowId]=-1;return}let i=String(e.value);r.codeByValue||(r.codeByValue=new Map,(r.dict??[]).forEach((e,t)=>r.codeByValue.set(e,t)));let a=r.codeByValue.get(i);a===void 0&&(a=r.dict.length,r.dict.push(i),r.codeByValue.set(i,a),r.rank=void 0,r.lower=void 0),r.data[e.rowId]=a}e.onmessage=o=>{let s=o.data;try{if(s.type===`init`){t=s.columns.map(e=>({...e})),n=s.rowCount,i=[],a=[],m(),e.postMessage({type:`ready`,seq:s.seq});return}if(s.type===`setView`){i=s.sort,a=s.filter,m(),e.postMessage({type:`viewResult`,seq:s.seq,viewRowCount:r.length});return}if(s.type===`rows`){let n=Math.max(0,s.start),i=Math.min(r.length,n+s.count),a=[],o=[];for(let e=n;e<i;e++){let n=r[e];a.push(n),o.push(t.map(e=>f(e,n)))}e.postMessage({type:`rowsResult`,seq:s.seq,start:n,rowIds:a,cells:o});return}if(s.type===`applyEdits`){let t=new Set;for(let e of s.edits)h(e),t.add(e.col);let n=i.some(e=>t.has(e.col))||a.some(e=>t.has(e.col));e.postMessage({type:`editResult`,seq:s.seq,staleView:n});return}if(s.type===`distinct`){let r=t[s.col],i=Math.max(1,s.limit),a=!1,o=[],l=0;if(r&&(r.kind===`string`||r.kind===`date`)){let e=r.dict??[],t=new Uint8Array(e.length),s=r.data;for(let e=0;e<n;e++){let n=s[e];n<0?a=!0:t[n]=1}let u=c(r),d=[];for(let e=0;e<t.length;e++)t[e]===1&&d.push(e);d.sort((e,t)=>u[e]-u[t]),l=d.length,o=d.slice(0,i).map(t=>e[t])}else if(r&&r.kind===`number`){let e=r.data,t=new Set;for(let i=0;i<n;i++)!r.valid||r.valid[i]===0?a=!0:t.add(e[i]);let s=[...t].sort((e,t)=>e-t);l=s.length,o=s.slice(0,i).map(e=>String(e))}else if(r){let e=!1,t=!1,s=r.data;for(let i=0;i<n;i++)!r.valid||r.valid[i]===0?a=!0:s[i]===1?e=!0:t=!0;t&&o.push(`false`),e&&o.push(`true`),l=o.length,o=o.slice(0,i)}e.postMessage({type:`distinctResult`,seq:s.seq,values:o,totalDistinct:l,hasBlank:a});return}s.type===`dispose`&&(t=[],r=[],n=0)}catch(t){let n=`seq`in s?s.seq:-1;e.postMessage({type:`error`,seq:n,message:t instanceof Error?t.message:String(t)})}}}function ce(){return`(${A.toString()})(self);`}var le=class{constructor(){this.onResponse=()=>{};let e={onmessage:null,postMessage:e=>this.onResponse(e)};A(e),this.scope=e}post(e){this.scope.onmessage?.({data:e})}terminate(){this.scope.onmessage=null}},ue=class{constructor(){this.onResponse=()=>{};let e=URL.createObjectURL(new Blob([ce()],{type:`text/javascript`}));try{this.worker=new Worker(e)}finally{URL.revokeObjectURL(e)}this.worker.onmessage=e=>{this.onResponse(e.data)}}post(e,t){this.worker.postMessage(e,t??[])}terminate(){this.worker.terminate()}};function j(e){return e.kind===`number`||e.kind===`boolean`?{payload:{name:e.name,kind:e.kind,data:e.data,valid:e.valid},transfer:[e.data.buffer,e.valid.buffer]}:{payload:{name:e.name,kind:e.kind,data:e.codes,dict:e.dict},transfer:[e.codes.buffer]}}var M=class{constructor(e,t={}){this.seq=0,this.pending=new Map;let n=O(e);this.schema={columns:n.columns.map(e=>({name:e.name,kind:e.kind})),rowCount:n.rowCount},this.viewRowCount=n.rowCount,this.host=t.forceLocal||typeof Worker>`u`?new le:new ue,this.host.onResponse=e=>{let t=this.pending.get(e.seq);t&&(this.pending.delete(e.seq),t(e))};let r=n.columns.map(j);this.ready=this.request(e=>({type:`init`,seq:e,columns:r.map(e=>e.payload),rowCount:n.rowCount}),r.flatMap(e=>e.transfer)).then(()=>void 0)}request(e,t){let n=++this.seq;return new Promise((r,i)=>{this.pending.set(n,e=>{e.type===`error`?i(Error(e.message)):r(e)}),this.host.post(e(n),t)})}async describe(){return await this.ready,this.schema}async setView(e){await this.ready;let t=i(e),n=this.schema.columns.map(e=>e.name),{view:r,issues:o}=a(t.sort,t.filter,n),s=new Map(n.map((e,t)=>[e,t])),c=await this.request(e=>({type:`setView`,seq:e,sort:r.sort.map(e=>({col:s.get(e.column),dir:e.dir})),filter:r.filter.map(e=>({col:s.get(e.column),op:e.op,value:e.value,...e.caseSensitive?{caseSensitive:!0}:{}}))}));if(c.type!==`viewResult`)throw Error(`unexpected kernel response`);return this.viewRowCount=c.viewRowCount,{viewRowCount:c.viewRowCount,issues:o}}async rows(e,t){await this.ready;let n=await this.request(n=>({type:`rows`,seq:n,start:e,count:t}));if(n.type!==`rowsResult`)throw Error(`unexpected kernel response`);return{start:n.start,rowIds:n.rowIds,cells:n.cells}}async applyEdits(e){await this.ready;let t=await this.request(t=>({type:`applyEdits`,seq:t,edits:e.map(e=>({rowId:e.rowId,col:e.col,value:e.value}))}));if(t.type!==`editResult`)throw Error(`unexpected kernel response`);return{staleView:t.staleView}}async distinct(e,t){await this.ready;let n=await this.request(n=>({type:`distinct`,seq:n,col:e,limit:t}));if(n.type!==`distinctResult`)throw Error(`unexpected kernel response`);return{values:n.values,totalDistinct:n.totalDistinct,hasBlank:n.hasBlank}}get currentViewRowCount(){return this.viewRowCount}dispose(){this.host.post({type:`dispose`}),this.host.terminate(),this.pending.clear()}},N=class{constructor(){this.latest=new Map,this.undoStack=[],this.redoStack=[]}get dirtyCount(){return this.latest.size}get canUndo(){return this.undoStack.length>0}get canRedo(){return this.redoStack.length>0}isDirty(e,t){return this.latest.has(`${e}:${t}`)}commit(e){if(e.length!==0){this.undoStack.push(e),this.redoStack.length=0;for(let t of e)this.applyLatest(t)}}undo(){let e=this.undoStack.pop();if(!e)return[];this.redoStack.push(e);let t=e.map(e=>({rowId:e.rowId,col:e.col,value:e.prev}));return this.rebuildLatest(),t}redo(){let e=this.redoStack.pop();return e?(this.undoStack.push(e),this.rebuildLatest(),e.map(e=>({rowId:e.rowId,col:e.col,value:e.next}))):[]}entries(){return[...this.latest.values()]}clear(){this.latest.clear(),this.undoStack.length=0,this.redoStack.length=0}applyLatest(e){let t=`${e.rowId}:${e.col}`,n=this.latest.get(t),r=n?{...e,prev:n.prev}:{...e};r.prev===r.next?this.latest.delete(t):this.latest.set(t,r)}rebuildLatest(){this.latest.clear();for(let e of this.undoStack)for(let t of e)this.applyLatest(t)}},P=new Map;function de(e,t){let n=`${t} ${e}`,r=P.get(n);if(!r){for(let t of P.keys())t.endsWith(` ${e}`)&&t!==n&&P.delete(t);r=new N,P.set(n,r)}return r}function F(e){for(let t of[...P.keys()])t.endsWith(` ${e}`)&&P.delete(t)}var fe=28,I=200,pe=12,me=420,he=5e4,ge=140;function _e(e){return e==null?``:typeof e==`boolean`?e?`true`:`false`:String(e)}function ve(e,t){let n=e.trim();if(n===``)return null;if(t===`number`){let e=Number(n);return Number.isFinite(e)?e:{error:`not a number`}}return t===`boolean`?/^(?:true|1)$/i.test(n)?!0:!/^(?:false|0)$/i.test(n)&&{error:`true or false`}:e}var ye=[{op:`~`,glyph:`~`,label:`Contains`},{op:`!~`,glyph:`!~`,label:`Doesn't contain`},{op:`=`,glyph:`=`,label:`Equals`},{op:`!=`,glyph:`≠`,label:`Not equal`},{op:`^~`,glyph:`^`,label:`Starts with`},{op:`$~`,glyph:`$`,label:`Ends with`}],L=[{op:`=`,glyph:`=`,label:`Equals`},{op:`!=`,glyph:`≠`,label:`Not equal`},{op:`<`,glyph:`<`,label:`Less than`},{op:`>`,glyph:`>`,label:`Greater than`},{op:`<=`,glyph:`≤`,label:`At most`},{op:`>=`,glyph:`≥`,label:`At least`}],be=[{op:`=`,glyph:`∅`,label:`Is empty`,unary:!0},{op:`!=`,glyph:`≠∅`,label:`Is not empty`,unary:!0}];function xe(e){return e===`number`||e===`boolean`?[...L,...be]:[...ye,...L.filter(e=>e.op!==`=`&&e.op!==`!=`),...be]}function Se(e){return e===`number`||e===`boolean`?`=`:`~`}function R(e,t){return e.op===t.op&&e.unary===!0==(t.unary===!0)}function Ce(e,t){return xe(e).find(e=>R(e,t))?.glyph??ye.find(e=>e.op===t.op)?.glyph??t.op}var we=100,Te=[`=`,`!=`,`~`,`!~`,`^~`,`$~`];function z(e){return{r0:Math.min(e.anchor.row,e.focus.row),r1:Math.max(e.anchor.row,e.focus.row),c0:Math.min(e.anchor.col,e.focus.col),c1:Math.max(e.anchor.col,e.focus.col)}}function B({provider:e,journal:t,view:n,onViewChange:r,viewPersisted:a=!0,onSave:o,saving:c=!1,height:l=me,readOnlyReason:u,isCellLocked:d,lockedReason:f,formulaSupport:p,onCellEdited:m,extraDirtyCount:h=0,onDiscardExtra:g,className:_}){let[v,ee]=(0,s.useState)(null),[y,te]=(0,s.useState)(0),[ne,re]=(0,s.useState)(null),[ie,b]=(0,s.useState)(!1),[x,S]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),[T,ae]=(0,s.useState)({}),[se,D]=(0,s.useState)({}),[O,k]=(0,s.useState)(null),[A,ce]=(0,s.useState)({left:0,top:0}),[le,ue]=(0,s.useState)({left:0,top:0}),[j,M]=(0,s.useState)(null),[N,P]=(0,s.useState)(null),[de,F]=(0,s.useState)(0),[ye,L]=(0,s.useState)(``),[be,B]=(0,s.useState)(0),De=(0,s.useRef)(null),Oe=(0,s.useRef)(null),ke=(0,s.useRef)(null),Ae=(0,s.useRef)(null),je=(0,s.useRef)(null),Me=(0,s.useRef)(!1);(0,s.useEffect)(()=>{Me.current&&!C&&je.current?.focus(),Me.current=C!==null},[C]);let V=(0,s.useRef)({version:0,pages:new Map}),H=(0,s.useRef)(new Set),Ne=(0,s.useRef)(new Map),U=(0,s.useRef)(n);U.current=n;let Pe=!!(t&&e.applyEdits&&!u),Fe=t?.dirtyCount??0;(0,s.useEffect)(()=>{let t=!1;return e.describe().then(e=>{t||ee(e)},()=>void 0),()=>{t=!0}},[e]);let Ie=(0,s.useCallback)(async t=>{let n=await e.setView(t);V.current={version:V.current.version+1,pages:new Map},H.current.clear(),te(n.viewRowCount),b(!1),re(n.issues.length>0?n.issues.map(e=>e.message).join(`; `):null),B(e=>e+1)},[e]);(0,s.useEffect)(()=>{Ie(n)},[Ie,JSON.stringify(i(n))]);let Le=oe({count:y,getScrollElement:()=>De.current,estimateSize:()=>fe,overscan:pe,initialRect:{width:800,height:l}}),W=Le.getVirtualItems();(0,s.useEffect)(()=>{if(y===0)return;let t=V.current.version,n=W[0]?.index??0,r=W[W.length-1]?.index??0,i=Math.floor(n/I),a=Math.floor(r/I);for(let n=i;n<=a;n++)V.current.pages.has(n)||H.current.has(n)||(H.current.add(n),e.rows(n*I,I).then(e=>{H.current.delete(n),V.current.version===t&&(V.current.pages.set(n,{rowIds:Array.from(e.rowIds),cells:e.cells}),B(e=>e+1))},()=>H.current.delete(n)))},[e,W,y,be]);let G=(0,s.useCallback)(e=>{let t=V.current.pages.get(Math.floor(e/I));if(!t)return null;let n=e%I,r=t.rowIds[n],i=t.cells[n];return r===void 0||!i?null:{rowId:r,cells:i}},[]);(0,s.useEffect)(()=>{if(!x||!v)return;let{r0:t,r1:n}=z(x);if((n-t+1)*v.columns.length>he)return;let r=!1;return(async()=>{let i=new Map;for(let a=t;a<=n;a+=I){let t=await e.rows(a,Math.min(I,n-a+1));if(r)return;t.cells.forEach((e,n)=>i.set(t.start+n,e))}Ne.current=i})(),()=>{r=!0}},[e,v,x]);let Re=(0,s.useCallback)(e=>{if(!x||!v||C)return;let t=e.target;if(t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)return;e.preventDefault();let{r0:n,r1:r,c0:i,c1:a}=z(x),o=Math.floor(he/Math.max(1,a-i+1)),s=Math.min(r,n+o-1),c=[],l=[];for(let e=n;e<=s;e++){let t=Ne.current.get(e)??G(e)?.cells,n=[];for(let e=i;e<=a;e++)n.push(_e(t?.[e]??null));c.push(n.join(` `)),l.push(`<tr>${n.map(e=>`<td>${Ee(e)}</td>`).join(``)}</tr>`)}e.clipboardData.setData(`text/plain`,c.join(`
2
+ `)),e.clipboardData.setData(`text/html`,`<table>${l.join(``)}</table>`),L(s<r?`Copy truncated to ${s-n+1} rows (${he} cell cap).`:`Copied ${s-n+1}\xD7${a-i+1} cells.`)},[G,C,v,x]),K=(0,s.useCallback)((e,t)=>{if(!Pe||!v)return;let n=G(e.row);if(n&&d?.(n.rowId,e.col)){L(f??`This cell is locked`);return}let r=n?p?.getFormula(n.rowId,e.col):void 0;w({...e,draft:t??(r===void 0?_e(n?.cells[e.col]??null):`=${r}`)})},[G,Pe,v,d,f,p]),q=(0,s.useCallback)(e=>{if(e.length===0)return;let t=new Map;for(let n of e){let e=t.get(n.rowId)??[];e.push(n),t.set(n.rowId,e)}for(let e of V.current.pages.values())for(let n=0;n<e.rowIds.length;n++){let r=t.get(e.rowIds[n]);if(r)for(let t of r)e.cells[n][t.col]=t.value}B(e=>e+1)},[]),J=(0,s.useCallback)(async()=>{if(!C||!v||!t||!e.applyEdits)return!0;if(p&&C.draft.trim().startsWith(`=`)){let t=G(C.row);if(!t)return w(null),!0;let n=await p.commitFormula(t.rowId,C.col,C.draft.trim().slice(1));return n.ok?(w(null),n.updates&&n.updates.length>0&&((await e.applyEdits(n.updates)).staleView&&b(!0),q(n.updates)),F(e=>e+1),!0):(w({...C,error:n.error??`formula rejected`}),!1)}let n=v.columns[C.col]?.kind??`string`,r=ve(C.draft,n);if(typeof r==`object`&&r&&`error`in r)return w({...C,error:r.error}),!1;let i=G(C.row);if(!i)return w(null),!0;let a=i.cells[C.col]??null,o=r;if(w(null),a===o)return!0;t.commit([{rowId:i.rowId,col:C.col,prev:a,next:o}]),i.cells[C.col]=o,(await e.applyEdits([{rowId:i.rowId,col:C.col,value:o}])).staleView&&b(!0);let s=await m?.({rowId:i.rowId,col:C.col,value:o});return s&&s.length>0&&((await e.applyEdits(s)).staleView&&b(!0),q(s)),F(e=>e+1),!0},[q,G,C,p,t,m,e,v]),ze=(0,s.useCallback)(n=>{if(!x||!v||!t||!e.applyEdits||C)return;let r=n.target;if(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)return;let i=n.clipboardData.getData(`text/plain`);if(!i)return;n.preventDefault();let a=i.replace(/\r\n?/g,`
3
+ `).split(`
4
+ `);a.length>1&&a[a.length-1]===``&&a.pop();let o=a.map(e=>e.split(` `)),{r0:s,c0:c}=z(x),l=[],u=0;for(let e=0;e<o.length;e++){let t=s+e;if(t>=y){u+=o[e].length;continue}let n=G(t);if(!n){u+=o[e].length;continue}for(let t=0;t<o[e].length;t++){let r=c+t,i=v.columns[r]?.kind;if(i===void 0||d?.(n.rowId,r)){u++;continue}let a=ve(o[e][t],i);if(typeof a==`object`&&a&&`error`in a){u++;continue}let s=n.cells[r]??null,f=a;s!==f&&(l.push({rowId:n.rowId,col:r,prev:s,next:f}),n.cells[r]=f)}}if(l.length===0){u>0&&L(`Nothing pasted (${u} cells skipped).`);return}t.commit(l),(async()=>{let t=l.map(({rowId:e,col:t,next:n})=>({rowId:e,col:t,value:n}));(await e.applyEdits(t)).staleView&&b(!0);let n=[];for(let e of t){let t=await m?.(e);t&&n.push(...t)}n.length>0&&((await e.applyEdits(n)).staleView&&b(!0),q(n)),F(e=>e+1),B(e=>e+1),L(`Pasted ${l.length} cell${l.length===1?``:`s`}`+(u>0?` (${u} skipped)`:``)+`.`)})()},[q,G,C,d,t,m,e,v,x,y]),Be=(0,s.useCallback)(async n=>{if(!t||!e.applyEdits)return;let r=n===`undo`?t.undo():t.redo();r.length!==0&&((await e.applyEdits(r)).staleView&&b(!0),V.current.pages.clear(),F(e=>e+1),B(e=>e+1))},[t,e]),Ve=(0,s.useCallback)((e,t)=>{let n=U.current,i=n.sort.find(t=>t.column===e),a=t?[...n.sort]:[];a=i?i.dir===`asc`?(t?n.sort:[i]).map(t=>t.column===e?{...t,dir:`desc`}:t):(t?n.sort:[]).filter(t=>t.column!==e):t?[...a,{column:e,dir:`asc`}]:[{column:e,dir:`asc`}],r?.({...n,sort:a})},[r]),Y=(0,s.useCallback)((e,t,n,i,a=!1)=>{let o=U.current,s=o.filter.filter(t=>t.column!==e);r?.({...o,filter:a?[...s,{column:e,op:n,value:``}]:t.trim()===``?s:[...s,{column:e,op:n,value:t,...i&&Te.includes(n)?{caseSensitive:!0}:{}}]})},[r]),X=(0,s.useCallback)((e,t)=>{let n=se[e];if(n)return n;let r=U.current.filter.find(e=>e.column===t);return r?{op:r.op,caseSensitive:r.caseSensitive===!0,...r.value===``&&(r.op===`=`||r.op===`!=`)?{unary:!0}:{}}:{op:Se(v?.columns[e]?.kind??`string`),caseSensitive:!1}},[se,v]),He=(0,s.useCallback)((e,t,n)=>{D(t=>({...t,[e]:n})),k(null);let r=U.current.filter.find(e=>e.column===t);n.unary?Y(t,``,n.op,!1,!0):r&&r.value.trim()!==``?Y(t,r.value,n.op,n.caseSensitive):r&&Y(t,``,n.op,n.caseSensitive)},[Y]),Ue=(0,s.useCallback)((e,t)=>{let n=X(e,t);D(t=>({...t,[e]:n.unary?{op:Se(v?.columns[e]?.kind??`string`),caseSensitive:!1}:{op:n.op,caseSensitive:n.caseSensitive}})),k(null),Y(t,``,n.op,n.caseSensitive)},[X,v,Y]),Z=(0,s.useCallback)(e=>{let t=Oe.current?.getBoundingClientRect(),n=e.getBoundingClientRect();return t?{left:n.left-t.left,top:n.bottom-t.top+2}:{left:0,top:0}},[]),We=(0,s.useCallback)((e,t)=>{M(null),ce(Z(t)),k(t=>t===e?null:e)},[Z]),Ge=(0,s.useCallback)((t,n)=>{if(k(null),j===t){M(null);return}ue(Z(n)),M(t),e.distinct?.(t,we).then(e=>{P({col:t,result:e})})},[Z,e,j]);(0,s.useLayoutEffect)(()=>{let e=Oe.current;if(e)for(let t of[ke.current,Ae.current]){if(!t)continue;let n=e.clientWidth-t.offsetWidth-4,r=e.clientHeight-t.offsetHeight-4;t.style.left=`${Math.max(4,Math.min(parseFloat(t.style.left)||0,n))}px`,t.style.top=`${Math.max(4,Math.min(parseFloat(t.style.top)||0,r))}px`}},[O,j,N]);let Ke=(0,s.useCallback)((e,t,n)=>{D(t=>({...t,[e]:{op:`=`,caseSensitive:!1}})),M(null),Y(t,n,`=`,!1)},[Y]),Q=(0,s.useCallback)((e,t,n,r)=>{v&&S(i=>{let a=i?.focus??{row:0,col:0},o={row:Math.max(0,Math.min(y-1,r?.row??a.row+e)),col:Math.max(0,Math.min(v.columns.length-1,r?.col??a.col+t))};return Le.scrollToIndex(o.row),n&&i?{anchor:i.anchor,focus:o}:{anchor:o,focus:o}})},[v,y,Le]),qe=(0,s.useCallback)(e=>{if(!v)return;let t=e.target;if((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t!==null&&t.isContentEditable)&&!C)return;let n=e.metaKey||e.ctrlKey;if(C){e.key===`Escape`?(w(null),e.preventDefault()):e.key===`Enter`?(J().then(e=>e&&Q(1,0,!1)),e.preventDefault()):e.key===`Tab`&&(J().then(t=>t&&Q(0,e.shiftKey?-1:1,!1)),e.preventDefault());return}let r=Math.max(1,Math.floor(l/fe)-1);switch(e.key){case`ArrowDown`:Q(n?1/0:1,0,e.shiftKey,n?{row:y-1}:void 0);break;case`ArrowUp`:Q(n?0:-1,0,e.shiftKey,n?{row:0}:void 0);break;case`ArrowRight`:Q(0,+!n,e.shiftKey,n?{col:v.columns.length-1}:void 0);break;case`ArrowLeft`:Q(0,n?0:-1,e.shiftKey,n?{col:0}:void 0);break;case`PageDown`:Q(r,0,e.shiftKey);break;case`PageUp`:Q(-r,0,e.shiftKey);break;case`Home`:Q(0,0,e.shiftKey,n?{row:0,col:0}:{col:0});break;case`End`:Q(0,0,e.shiftKey,n?{row:y-1,col:v.columns.length-1}:{col:v.columns.length-1});break;case`Enter`:case`F2`:x&&K(x.focus);break;case`a`:case`A`:if(n){S({anchor:{row:0,col:0},focus:{row:y-1,col:v.columns.length-1}});break}if(x&&!n)K(x.focus,e.key);else return;break;case`z`:case`Z`:if(n){Be(e.shiftKey?`redo`:`undo`);break}if(x)K(x.focus,e.key);else return;break;default:if(x&&e.key.length===1&&!n&&!e.altKey){K(x.focus,e.key);break}return}e.preventDefault()},[K,J,C,l,Q,Be,v,x,y]),Je=(0,s.useCallback)((e,t,n)=>{let r=r=>{ae(i=>({...i,[e]:Math.max(60,n+(r.clientX-t))}))},i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)},[]),Ye=(0,s.useMemo)(()=>{let e=v?.columns.length??0;return Array.from({length:e},(e,t)=>`${T[t]??ge}px`).join(` `)},[T,v]),$=x?z(x):null,Xe=e=>n.filter.find(t=>t.column===e)?.value??``;return(0,E.jsxs)(`div`,{ref:Oe,className:`squisq-grid${_?` ${_}`:``}`,role:`grid`,"aria-rowcount":y+1,"aria-colcount":v?.columns.length??0,"aria-multiselectable":`true`,onKeyDown:qe,onCopy:Re,onPaste:ze,onMouseDownCapture:e=>{let t=e.target;O!==null&&!t?.closest(`.squisq-grid-opmenu, .squisq-grid-opbutton`)&&k(null),j!==null&&!t?.closest(`.squisq-grid-valuemenu, .squisq-grid-valuebutton`)&&M(null)},onKeyDownCapture:e=>{e.key===`Escape`&&(O!==null&&k(null),j!==null&&M(null))},children:[(0,E.jsxs)(`div`,{className:`squisq-grid-scroller`,ref:De,style:{height:l},onScroll:()=>{O!==null&&k(null),j!==null&&M(null)},children:[(0,E.jsx)(`div`,{className:`squisq-grid-header`,role:`row`,style:{gridTemplateColumns:Ye},children:v?.columns.map((t,r)=>{let i=n.sort.find(e=>e.column===t.name);return(0,E.jsxs)(`div`,{role:`columnheader`,"aria-sort":i?i.dir===`asc`?`ascending`:`descending`:`none`,className:`squisq-grid-headercell`,children:[(0,E.jsxs)(`button`,{type:`button`,className:`squisq-grid-sortbutton`,onClick:e=>Ve(t.name,e.shiftKey),title:`Sort by ${t.name}`,children:[(0,E.jsx)(`span`,{className:`squisq-grid-colname`,children:t.name}),i&&(0,E.jsx)(`span`,{className:`squisq-grid-sortmark`,"aria-hidden":`true`,children:i.dir===`asc`?`▲`:`▼`})]}),(0,E.jsx)(`div`,{className:`squisq-grid-filterrow`,children:(()=>{let n=X(r,t.name);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`button`,{type:`button`,className:`squisq-grid-opbutton${n.caseSensitive?` squisq-grid-opbutton--cs`:``}`,"aria-label":`Filter operator for ${t.name}`,"aria-expanded":O===r,title:`${xe(t.kind).find(e=>R(e,n))?.label??n.op}${n.caseSensitive?` (case-sensitive)`:``}`,onClick:e=>We(r,e.currentTarget),children:[(0,E.jsx)(`span`,{className:`squisq-grid-opglyph`,children:Ce(t.kind,n)}),(0,E.jsx)(`span`,{className:`squisq-grid-opcaret`,"aria-hidden":`true`,children:`▾`})]}),(0,E.jsx)(`input`,{className:`squisq-grid-filterinput`,"aria-label":`Filter ${t.name}`,placeholder:n.unary?n.op===`=`?`(empty)`:`(not empty)`:`filter`,disabled:n.unary===!0,value:Xe(t.name),onChange:e=>Y(t.name,e.target.value,n.op,n.caseSensitive)}),e.distinct&&(0,E.jsx)(`button`,{type:`button`,className:`squisq-grid-valuebutton`,"aria-label":`Filter ${t.name} by value`,"aria-expanded":j===r,title:`Filter by value`,onClick:e=>Ge(r,e.currentTarget),children:`▾`})]})})()}),(0,E.jsx)(`div`,{className:`squisq-grid-resizer`,onPointerDown:e=>{e.preventDefault(),Je(r,e.clientX,T[r]??ge)}})]},r)})}),(0,E.jsx)(`div`,{className:`squisq-grid-body`,style:{height:Le.getTotalSize()},children:W.map(e=>{let n=G(e.index);return(0,E.jsx)(`div`,{role:`row`,"aria-rowindex":e.index+2,className:`squisq-grid-row`,style:{transform:`translateY(${e.start}px)`,gridTemplateColumns:Ye,height:fe},children:v?.columns.map((r,i)=>{let a=$&&e.index>=$.r0&&e.index<=$.r1&&i>=$.c0&&i<=$.c1,o=x&&x.focus.row===e.index&&x.focus.col===i,s=C&&C.row===e.index&&C.col===i,c=n&&t?t.isDirty(n.rowId,i):!1,l=Pe&&n?d?.(n.rowId,i)??!1:!1,u=n&&p?p.getFormula(n.rowId,i):void 0,m=[`squisq-grid-cell`,r.kind===`number`?`squisq-grid-cell--num`:``,a?`squisq-grid-cell--selected`:``,o?`squisq-grid-cell--focus`:``,c?`squisq-grid-cell--dirty`:``,l?`squisq-grid-cell--locked`:``,u===void 0?``:`squisq-grid-cell--formula`].filter(Boolean).join(` `);return(0,E.jsx)(`div`,{role:`gridcell`,"aria-colindex":i+1,"aria-selected":a?`true`:void 0,...c?{"aria-description":`edited, unsaved`}:{},...l&&f?{title:f}:u===void 0?{}:{title:`=${u}`},...l?{"aria-readonly":`true`}:{},className:m,tabIndex:o?0:-1,ref:o?je:void 0,onMouseDown:t=>{let n={row:e.index,col:i};S(e=>t.shiftKey&&e?{anchor:e.anchor,focus:n}:{anchor:n,focus:n})},onDoubleClick:()=>K({row:e.index,col:i}),children:s?(0,E.jsx)(`input`,{className:`squisq-grid-editor${C.error?` squisq-grid-editor--error`:``}`,autoFocus:!0,value:C.draft,title:C.error,onChange:e=>w({...C,draft:e.target.value,error:void 0}),onBlur:()=>void J()}):_e(n?.cells[i]??null)},i)})},e.key)})})]}),O!==null&&v?.columns[O]&&(()=>{let e=O,t=v.columns[e],r=X(e,t.name),i=t.kind!==`number`&&t.kind!==`boolean`,a=n.filter.some(e=>e.column===t.name);return(0,E.jsxs)(`div`,{ref:ke,className:`squisq-grid-opmenu`,role:`menu`,style:{left:A.left,top:A.top},children:[a&&(0,E.jsx)(`button`,{type:`button`,role:`menuitem`,className:`squisq-grid-opoption squisq-grid-opclear`,onClick:()=>Ue(e,t.name),children:`(Clear filter)`}),xe(t.kind).map(n=>(0,E.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":R(n,r),className:`squisq-grid-opoption${R(n,r)?` squisq-grid-opoption--active`:``}`,onClick:()=>He(e,t.name,{op:n.op,caseSensitive:r.caseSensitive,...n.unary?{unary:!0}:{}}),children:[(0,E.jsx)(`span`,{className:`squisq-grid-opglyph`,children:n.glyph}),n.label]},`${n.op}${n.unary?`0`:``}`)),i&&(0,E.jsxs)(`label`,{className:`squisq-grid-opcase`,children:[(0,E.jsx)(`input`,{type:`checkbox`,checked:r.caseSensitive,onChange:n=>He(e,t.name,{op:r.op,caseSensitive:n.target.checked,...r.unary?{unary:!0}:{}})}),`Case sensitive`]})]})})(),j!==null&&v?.columns[j]&&(()=>{let e=j,t=v.columns[e],r=X(e,t.name),i=n.filter.some(e=>e.column===t.name);return(0,E.jsx)(`div`,{ref:Ae,className:`squisq-grid-valuemenu`,role:`menu`,style:{left:le.left,top:le.top},children:N?.col===e?(0,E.jsxs)(E.Fragment,{children:[i&&(0,E.jsx)(`button`,{type:`button`,role:`menuitem`,className:`squisq-grid-opoption squisq-grid-opclear`,onClick:()=>{M(null),Ue(e,t.name)},children:`(All)`}),N.result.hasBlank&&(0,E.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":i&&r.unary===!0,className:`squisq-grid-opoption${i&&r.unary===!0?` squisq-grid-opoption--active`:``}`,onClick:()=>{M(null),He(e,t.name,{op:`=`,caseSensitive:!1,unary:!0})},children:`(Blanks)`}),N.result.values.map(n=>{let a=i&&!r.unary&&r.op===`=`&&Xe(t.name)===n;return(0,E.jsx)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":a,className:`squisq-grid-opoption squisq-grid-valueoption${a?` squisq-grid-opoption--active`:``}`,title:n,onClick:()=>Ke(e,t.name,n),children:n},n)}),N.result.totalDistinct>N.result.values.length&&(0,E.jsxs)(`div`,{className:`squisq-grid-valuemenu-note`,children:[`showing `,N.result.values.length,` of`,` `,N.result.totalDistinct.toLocaleString(),` values`]})]}):(0,E.jsx)(`div`,{className:`squisq-grid-valuemenu-note`,children:`loading…`})})})(),(0,E.jsxs)(`div`,{className:`squisq-grid-footer`,children:[(0,E.jsxs)(`span`,{className:`squisq-grid-status`,"aria-live":`polite`,children:[ye||`${y.toLocaleString()} row${y===1?``:`s`}${v&&y!==v.rowCount?` (of ${v.rowCount.toLocaleString()})`:``}${v?`, ${v.columns.length} column${v.columns.length===1?``:`s`}`:``}`,ne?` \xB7 ${ne}`:``,!a&&(n.sort.length>0||n.filter.length>0)?` · view not saved to document`:``]}),ie&&(0,E.jsx)(`button`,{type:`button`,className:`squisq-grid-refresh`,onClick:()=>void Ie(U.current),children:`order may be outdated — refresh`}),u&&(0,E.jsx)(`span`,{className:`squisq-grid-readonly`,children:u}),Pe&&Fe+h>0&&(0,E.jsxs)(`span`,{className:`squisq-grid-dirtybar`,children:[(Fe+h).toLocaleString(),` unsaved edit`,Fe+h===1?``:`s`,(0,E.jsx)(`button`,{type:`button`,className:`squisq-grid-save`,disabled:c,onClick:()=>void o?.(),children:c?`Saving…`:`Save`}),(0,E.jsx)(`button`,{type:`button`,className:`squisq-grid-discard`,disabled:c,onClick:()=>{(async()=>{for(;t?.canUndo;)await Be(`undo`);g&&(await g(),V.current.pages.clear(),B(e=>e+1),F(e=>e+1))})()},children:`Discard`})]})]})]})}function Ee(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}export{B as DataGrid,N as EditJournal,le as LocalKernelHost,M as TableStoreClient,O as buildColumnarTable,ce as buildKernelSource,k as columnCellValue,F as discardJournal,de as journalFor,A as tableKernel};
@@ -1,4 +1,4 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t}from"./jsx-runtime-CEpd2cAX.js";import{t as n}from"./react-dom-OL4w_gzs.js";import{O as r,R as i,k as a,y as o}from"./chunk-MIKKUKOD-XIkmalSN.js";import"./markdown-Bi9b5f5Y.js";import"./icons-C9dD-bDi.js";var s=/\*\*(?![\s*])(.+?)(?<![\s*])\*\*/g,c=/(?<![\p{L}\p{N}_])__(?![\s_])(.+?)(?<![\s_])__(?![\p{L}\p{N}_])/gu,l=/\*(?![\s*])(.+?)(?<![\s*])\*/g,u=/(?<![\p{L}\p{N}_])_(?![\s_])(.+?)(?<![\s_])_(?![\p{L}\p{N}_])/gu,d=/~~(.+?)~~/g,f=/\*\*(?![\s*])(.+?)(?<![\s*])([ \t]+)\*\*(?=$|[^\s*])/g,p=/(?<!\*)\*(?![\s*])(.+?)(?<![\s*])([ \t]+)\*(?=$|[^\s*])/g,m=[`*`,`_`,`~`,`\\`],h=/\\([*_~\\])/g,g=/`(.+?)`/g,ee=/!\[(.*?)\]\((.+?)\)/g,te=/@\[([^\]]+?)\]\(([a-z][a-z0-9+.-]*)\\?:([^)\s]+)\)/gi,_=/<span\b[^>]*?\bdata-mention\b[^>]*?>(?:<[^>]+>)*([^<]*)<\/span>/gi,v=/\{\[([a-zA-Z0-9_:-]+)\]\}/g,y=/<i\b[^>]*?\bdata-icon="([^"]*)"[^>]*?><\/i>/gi,ne=/<(strong|b|em|i|s|del|sup|sub)>(.*?)<\/\1>/gs,re=/<code>(.*?)<\/code>/g,ie=/<(sup|sub)>((?:(?!<\/?(?:sup|sub)>)[\s\S])*)<\/\1>/gi,ae=/<a\b([^>]*)>(.*?)<\/a>/g,oe=/<img\b([^>]*)>/g,se=/<[^>]+>/g;function ce(e){if(!e.trim())return`<p></p>`;let t=e.replace(/\r\n/g,`
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t}from"./jsx-runtime-CEpd2cAX.js";import{t as n}from"./react-dom-OL4w_gzs.js";import{O as r,k as i,y as a,z as o}from"./chunk-UBFT2CDQ-FexGDigd.js";import"./markdown-ryKA_OmY.js";import"./icons-DWaUNQbT.js";var s=/\*\*(?![\s*])(.+?)(?<![\s*])\*\*/g,c=/(?<![\p{L}\p{N}_])__(?![\s_])(.+?)(?<![\s_])__(?![\p{L}\p{N}_])/gu,l=/\*(?![\s*])(.+?)(?<![\s*])\*/g,u=/(?<![\p{L}\p{N}_])_(?![\s_])(.+?)(?<![\s_])_(?![\p{L}\p{N}_])/gu,d=/~~(.+?)~~/g,f=/\*\*(?![\s*])(.+?)(?<![\s*])([ \t]+)\*\*(?=$|[^\s*])/g,p=/(?<!\*)\*(?![\s*])(.+?)(?<![\s*])([ \t]+)\*(?=$|[^\s*])/g,m=[`*`,`_`,`~`,`\\`],h=/\\([*_~\\])/g,g=/`(.+?)`/g,ee=/!\[(.*?)\]\((.+?)\)/g,te=/@\[([^\]]+?)\]\(([a-z][a-z0-9+.-]*)\\?:([^)\s]+)\)/gi,_=/<span\b[^>]*?\bdata-mention\b[^>]*?>(?:<[^>]+>)*([^<]*)<\/span>/gi,v=/\{\[([a-zA-Z0-9_:-]+)\]\}/g,y=/<i\b[^>]*?\bdata-icon="([^"]*)"[^>]*?><\/i>/gi,ne=/<(strong|b|em|i|s|del|sup|sub)>(.*?)<\/\1>/gs,re=/<code>(.*?)<\/code>/g,ie=/<(sup|sub)>((?:(?!<\/?(?:sup|sub)>)[\s\S])*)<\/\1>/gi,ae=/<a\b([^>]*)>(.*?)<\/a>/g,oe=/<img\b([^>]*)>/g,se=/<[^>]+>/g;function ce(e){if(!e.trim())return`<p></p>`;let t=e.replace(/\r\n/g,`
2
2
  `).replace(/\r/g,`
3
3
  `).split(`
4
4
  `),n=ge(t),r=[],i=!1,a=``,o=[],s=[],c=!1,l=[],u=0,d=!1,f=()=>{if(u===0)return;let e=r.length===0?u:Math.max(0,u-1);for(let t=0;t<e;t++)r.push(`<p></p>`);u=0},p=e=>{f(),r.push(e),d=!1},m=e=>{e.openAttrs!==null&&(e.items.push(`<li${e.openAttrs}>${e.openContent}</li>`),e.openAttrs=null,e.openContent=``)},h=()=>{let e=s.pop();if(!e||(m(e),e.items.length===0))return;let t=e.type===`ol`?`ol`:`ul`,n=e.type===`task`?` data-type="taskList"`:``;e.type===`ol`&&e.start!=null&&e.start!==1&&(n+=` start="${e.start}"`);let r=`<${t}${n}>${e.items.join(``)}</${t}>`,i=s[s.length-1];if(!i){p(r),d=!0;return}i.openAttrs===null&&(i.openAttrs=i.type===`task`?` data-type="taskItem"`:``,i.openContent=`<p></p>`),i.openContent+=r},g=()=>{for(;s.length>0;)h()},ee=(e,t,n,r,i=null)=>{for(;s.length>0&&e<s[s.length-1].minIndent;)h();let a=s[s.length-1];if(!a){s.push({indent:e,minIndent:0,type:t,start:i,items:[],openAttrs:n,openContent:r});return}if(e>a.indent){s.push({indent:e,minIndent:a.indent+1,type:t,start:i,items:[],openAttrs:n,openContent:r});return}if(e<a.indent&&(a.indent=e),a.type!==t){let{indent:e,minIndent:o}=a;h(),s.push({indent:e,minIndent:o,type:t,start:i,items:[],openAttrs:n,openContent:r});return}m(a),a.openAttrs=n,a.openContent=r},te=()=>{if(!c||l.length===0){c=!1,l=[];return}let e=l.length>=2?Se(l[1]):[],t=e.length>0&&e.every(e=>/^:?-+:?$/.test(e.trim()));if(l.length<2||!t){for(let e of l)p(`<p>${De(e)}</p>`);c=!1,l=[];return}let n=Ce(l[1]),r=Se(l[0]).map((e,t)=>{let r=n[t];return`<th${r?` style="text-align: ${r}"`:``}>${De(e)}</th>`}).join(``),i=l.slice(2).map(e=>`<tr>${Se(e).map((e,t)=>{let r=n[t];return`<td${r?` style="text-align: ${r}"`:``}>${De(e)}</td>`}).join(``)}</tr>`).join(``);p(`<table><thead><tr>${r}</tr></thead><tbody>${i}</tbody></table>`),c=!1,l=[]};for(let e=0;e<t.length;e++){let m=t[e];if(m.startsWith("```"))if(i){p(`<pre><code${a?` class="language-${b(a)}"`:``}>${b(o.join(`
@@ -7,7 +7,7 @@ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t}from"./jsx-runt
7
7
  `))}</code></pre>`),g(),te(),f(),r.join(``)||`<p></p>`}function le(e){if(!e||e===`<p></p>`)return``;let t=[],n=e;for(;n.length>0;){let e=n.match(/^<h([1-6])([^>]*)>(.*?)<\/h\1>/s);if(e){let r=parseInt(e[1],10),i=e[2],a=e[3],o=a.search(/<span\b[^>]*\bclass="[^"]*\bsquisq-(?:template|props)-badge\b[^"]*"[^>]*>/i),s=Ve(o>=0?a.slice(0,o):a),c=i.match(/data-block-attrs="([^"]*)"/),l=i.match(/data-template="([^"]+)"/),u=i.match(/data-template-params="([^"]+)"/),d=/\sdata-template-empty(?:="[^"]*")?/.test(i);if(c){let e=Ee(c[1]);s+=` {${e}}`}if(l||u){let e=l?l[1]:``;u&&(e+=(e?` `:``)+Ee(u[1])),s+=` {[${e}]}`}else d&&(s+=` {[]}`);t.push(`#`.repeat(r)+` `+s),t.push(``),n=n.slice(e[0].length);continue}let r=n.match(/^<pre\b[^>]*><code\b([^>]*)>(.*?)<\/code><\/pre>/s);if(r){let e=/\bclass="language-([^"]*)"/.exec(r[1]??``)?.[1]??``,i=Ee(r[2]);t.push("```"+e),t.push(i),t.push("```"),t.push(``),n=n.slice(r[0].length);continue}let i=n.match(/^<blockquote>(.*?)<\/blockquote>/s);if(i){let e=i[1].split(/<\/p>\s*<p[^>]*>/i).map(e=>e.replace(/^<p[^>]*>/i,``).replace(/<\/p>\s*$/i,``));for(let n of e)for(let e of Ve(n).split(`
8
8
  `))t.push(`> `+e);let r=n.slice(i[0].length);/^\s*<blockquote>/.test(r)||t.push(``),n=r;continue}if(n.startsWith(`<hr>`)||n.startsWith(`<hr/>`)||n.startsWith(`<hr />`)){let e=n.match(/^<hr\s*\/?>/);t.push(`---`),t.push(``),n=n.slice(e[0].length);continue}let a=n.match(/^<div[^>]*class="[^"]*tableWrapper[^"]*"[^>]*><table[^>]*>(.*?)<\/table>\s*<\/div>/s)||n.match(/^<table[^>]*>(.*?)<\/table>/s);if(a){let e=a[1],r=[],i=/<tr[^>]*>(.*?)<\/tr>/gs,o;for(;(o=i.exec(e))!==null;){let e=o[1],t=[],n=/<(th|td)([^>]*)>(.*?)<\/\1>/gs,i;for(;(i=n.exec(e))!==null;){let e=i[1],n=i[2],r=Ve(i[3].replace(/<\/?p>/g,``)),a=n.match(/text-align:\s*(left|center|right)/);t.push({content:r,align:a?a[1]:null,isHeader:e===`th`})}t.length>0&&r.push(t)}if(r.length>0){let e=r.findIndex(e=>e.some(e=>e.isHeader)),n=e>=0?e:0,i=r[n],a=r.filter((e,t)=>t!==n),o=i.map(e=>e.align);t.push(`| `+i.map(e=>e.content||` `).join(` | `)+` |`),t.push(`| `+o.map(e=>e===`center`?`:---:`:e===`right`?`---:`:`---`).join(` | `)+` |`);for(let e of a)t.push(`| `+e.map(e=>e.content||` `).join(` | `)+` |`);t.push(``)}n=n.slice(a[0].length);continue}let o=n.match(/^<(ul|ol)\b([^>]*)>/i);if(o){let e=o[1].toLowerCase(),r=ue(n,0,e);if(r){let i=/data-type="taskList"/i.test(o[2]??``);t.push(...me(r.inner,e===`ol`,i,``,fe(o[2]))),t.push(``),n=n.slice(r.end);continue}}let s=n.match(/^<p>(.*?)<\/p>/s);if(s){let e=Ve(s[1]);e.trim()&&t.push(e),t.push(``),n=n.slice(s[0].length);continue}let c=n.match(/^<img\b([^>]*)>/);if(c){let e=c[1]??``,r=/\bsrc="([^"]*)"/i.exec(e)?.[1];if(r){let n=/\balt="([^"]*)"/i.exec(e)?.[1]??``;t.push(Te(r,n,e)),t.push(``)}n=n.slice(c[0].length);continue}let l=n.match(/^<(video|audio)\b([^>]*)>(?:[\s\S]*?<\/\1>)?/);if(l){let e=l[1]===`video`?`video`:`audio`;t.push(we(e,l[2]??``)),t.push(``),n=n.slice(l[0].length);continue}let u=n.match(/^(<[^>]+>|\s+)/);if(u){n=n.slice(u[0].length);continue}let d=n.match(/^([^<]+)/);if(d){t.push(Ee(d[1])),n=n.slice(d[0].length);continue}n=n.slice(1)}return t.join(`
9
9
  `)}function ue(e,t,n){let r=RegExp(`<${n}\\b[^>]*>|</${n}\\s*>`,`gi`);r.lastIndex=t;let i=0,a=-1,o;for(;(o=r.exec(e))!==null;)if(o[0][1]===`/`){if(i--,i===0)return{inner:e.slice(a,o.index),end:o.index+o[0].length};if(i<0)return null}else{if(i===0){if(o.index!==t)return null;a=o.index+o[0].length}i++}return null}function de(e){let t=[],n=/<li\b([^>]*)>|<\/li\s*>/gi,r=0,i=-1,a=``,o;for(;(o=n.exec(e))!==null;)o[0][1]===`/`?(r--,r===0&&i>=0&&t.push({attrs:a,inner:e.slice(i,o.index)}),r<0&&(r=0)):(r===0&&(i=o.index+o[0].length,a=o[1]??``),r++);return t}function fe(e){let t=parseInt(/\bstart="(\d+)"/i.exec(e??``)?.[1]??``,10);return Number.isFinite(t)?t:1}function pe(e){let t=[],n=``,r=0,i=/<(ul|ol)\b([^>]*)>/gi,a;for(;(a=i.exec(e))!==null;){let o=a[1].toLowerCase(),s=ue(e,a.index,o);if(!s)break;n+=e.slice(r,a.index),t.push({ordered:o===`ol`,task:/data-type="taskList"/i.test(a[2]??``),inner:s.inner,start:fe(a[2])}),r=s.end,i.lastIndex=s.end}return{content:n+e.slice(r),nested:t}}function me(e,t,n,r,i=1){let a=[];return de(e).forEach((e,o)=>{let{content:s,nested:c}=pe(e.inner),l=t?`${i+o}. `:`- `;if(n){let t=/data-checked="true"/.test(e.attrs),n=Ve(s.replace(/<label\b[^>]*>.*?<\/label>/s,``).replace(/<[^>]+>/g,``).trim());a.push(`${r}- [${t?`x`:` `}] ${n}`.trimEnd())}else a.push(...he(l,s,r));let u=r+` `.repeat(n?2:l.length);for(let e of c)a.push(...me(e.inner,e.ordered,e.task,u,e.start))}),a}function he(e,t,n=``){let r=n+` `.repeat(e.length),i=[],a=t.replace(/<(video|audio)\b([^>]*)>(?:[\s\S]*?<\/\1>)?/gi,(e,t,n)=>(i.push(we(t.toLowerCase()===`video`?`video`:`audio`,n??``)),``)).split(/<\/p>\s*<p[^>]*>/i).map(e=>e.replace(/^<p[^>]*>/i,``).replace(/<\/p>\s*$/i,``)),o=[];if(a.forEach((t,i)=>{let a=Ve(t).trim();a&&a.split(`
10
- `).forEach((t,a)=>{i===0&&a===0?o.push(n+e+t):(a===0&&o.push(``),o.push(r+t))})}),o.length===0&&i.length===0)return[n+e];let s=[];if(o.length>0){s.push(...o);for(let e of i)s.push(``),s.push(r+e)}else{s.push(n+e+i[0]);for(let e of i.slice(1))s.push(``),s.push(r+e)}return s}function ge(e){if(e[0]?.trim()!==`---`)return-1;for(let t=1;t<e.length;t++)if(e[t].trim()===`---`)return t;return-1}function _e(e){let t=/^ {0,3}(=+|-+)[ \t]*$/.exec(e);return t?t[1][0]===`=`?1:2:null}function ve(e){return/^(?: {4}|\t)/.test(e)&&e.trim()!==``}function ye(e){return e.startsWith(` `)?e.slice(1):e.slice(4)}function be(e,t){let n=t,o=``,s=null,c=null;for(let e=0;e<4;e++){let e=!1;if(s==null){let t=a(n);t&&(s=t.inner.trim(),n=n.slice(0,t.index).trimEnd(),e=!0)}if(c==null){let t=r(n);t&&(c=t.inner.trim(),n=n.slice(0,t.index).trimEnd(),e=!0)}if(!e)break}if(s!=null){let e=i(s);e.length===0&&(o+=` data-template-empty="true"`);let t=e.length>0&&e[0].indexOf(`=`)>0;!t&&e[0]&&(o+=` data-template="${b(e[0])}"`);let n=e.slice(+!t).filter(e=>e.includes(`=`));n.length>0&&(o+=` data-template-params="${b(n.join(` `))}"`)}return c!=null&&(o+=` data-block-attrs="${b(c)}"`),`<h${e}${o}>${De(n)}</h${e}>`}function xe(e){let t=0;for(let n of e)t+=n===` `?4:1;return t}function Se(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function Ce(e){return Se(e).map(e=>{let t=e.replace(/\s/g,``);return t.startsWith(`:`)&&t.endsWith(`:`)?`center`:t.endsWith(`:`)?`right`:t.startsWith(`:`)?`left`:null})}function we(e,t){let n=/\bsrc="([^"]*)"/i.exec(t)?.[1]??``,r=/\bcontrols\b/i.test(t),i=/\bwidth="([^"]*)"/i.exec(t)?.[1],a=/\bheight="([^"]*)"/i.exec(t)?.[1],o=e===`video`?/\bposter="([^"]*)"/i.exec(t)?.[1]:void 0,s=e===`video`?/\bdata-squisq-video-placement="([^"]*)"/i.exec(t)?.[1]:void 0,c=e===`video`?/\bdata-squisq-video-lock-to-block="([^"]*)"/i.exec(t)?.[1]:void 0,l=e===`video`?/\bdata-squisq-video-pip-size="([^"]*)"/i.exec(t)?.[1]:void 0,u=e===`video`?/\bdata-squisq-video-pip-shape="([^"]*)"/i.exec(t)?.[1]:void 0,d=e===`video`?/\bdata-squisq-video-pip-position="([^"]*)"/i.exec(t)?.[1]:void 0,f=`data-squisq-${e}`,p=RegExp(`\\b${f}-start-at="([^"]*)"`,`i`).exec(t)?.[1],m=RegExp(`\\b${f}-clip-start="([^"]*)"`,`i`).exec(t)?.[1],h=RegExp(`\\b${f}-clip-end="([^"]*)"`,`i`).exec(t)?.[1],g=[`<${e} src="${n}"`];return r&&g.push(` controls`),i&&g.push(` width="${i}"`),a&&g.push(` height="${a}"`),o&&g.push(` poster="${o}"`),(s===`picture-in-picture`||s===`overlay`)&&g.push(` data-squisq-video-placement="${s}"`),c===`false`&&g.push(` data-squisq-video-lock-to-block="false"`),(l===`small`||l===`large`)&&g.push(` data-squisq-video-pip-size="${l}"`),(u===`square`||u===`wide`)&&g.push(` data-squisq-video-pip-shape="${u}"`),(d===`top-left`||d===`top-right`||d===`bottom-left`||d===`bottom-right`)&&g.push(` data-squisq-video-pip-position="${d}"`),p!=null&&g.push(` ${f}-start-at="${p}"`),m!=null&&g.push(` ${f}-clip-start="${m}"`),h!=null&&g.push(` ${f}-clip-end="${h}"`),g.push(`></${e}>`),g.join(``)}function Te(e,t,n){let r=/\bwidth="([^"]*)"/i.exec(n)?.[1],i=/\bheight="([^"]*)"/i.exec(n)?.[1],a=/\btitle="([^"]*)"/i.exec(n)?.[1];if(!r&&!i)return`![${t}](${e})`;let o=[`<img alt="${t}" src="${e}"`];return r&&o.push(` width="${r}"`),i&&o.push(` height="${i}"`),a&&o.push(` title="${a}"`),o.push(`>`),o.join(``)}function b(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function Ee(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&nbsp;|&#160;|&#xA0;/gi,`\xA0`).replace(/&amp;/g,`&`)}function De(e){let t=[],n=e=>{let n=`\0PH${t.length}\0`;return t.push(e),n},r=e.replace(g,(e,t)=>n(`<code>${b(t)}</code>`));r=r.replace(ie,(e,t,r)=>{let i=t.toLowerCase();return n(`<${i}>${De(r)}</${i}>`)}),r=r.replace(ee,(e,t,r)=>n(`<img alt="${b(t)}" src="${b(r)}">`)),r=r.replace(te,(e,t,r,i)=>n(`<span data-mention="true" data-kind="${b(r)}" data-id="${b(i)}" data-label="${b(t)}" class="mention">@${b(t)}</span>`)),r=r.replace(v,(e,t)=>{let r=o(t);return r?n(`<i class="fa-${r.family} fa-${r.name}" data-icon="${b(t)}" data-family="${r.family}" data-name="${r.name}" contenteditable="false"></i>`):e}),r=Oe(r,(e,t)=>{let{url:r,title:i}=ke(t),a=i===null?``:` title="${b(i)}"`;return n(`<a href="${b(r)}"${a}>${De(e)}</a>`)});let i=b(r);i=i.replace(h,(e,t)=>`\0ESC${m.indexOf(t)}\0`),i=i.replace(f,`<strong>$1</strong>$2`),i=i.replace(s,`<strong>$1</strong>`),i=i.replace(c,`<strong>$1</strong>`),i=i.replace(p,`<em>$1</em>$2`),i=i.replace(l,`<em>$1</em>`),i=i.replace(u,`<em>$1</em>`),i=i.replace(d,`<s>$1</s>`);for(let e=0;e<m.length;e++)i=i.split(`\0ESC${e}\0`).join(m[e]);for(let e=t.length-1;e>=0;e--)i=i.split(`\0PH${e}\0`).join(t[e]??``);return He(i)}function Oe(e,t){let n=``,r=0,i=0;for(;i<e.length;){let a=e.indexOf(`[`,i);if(a<0)break;if(Me(e,a)){i=a+1;continue}let o=je(e,a,`[`,`]`),s=o+1;if(o<0||e[s]!==`(`){i=a+1;continue}let c=je(e,s,`(`,`)`);if(c<0){i=a+1;continue}let l=e.slice(a+1,o),u=e.slice(s+1,c);if(!l||!u){i=a+1;continue}n+=e.slice(r,a)+t(l,u),r=c+1,i=r}return n+e.slice(r)}function ke(e){let t={'"':`"`,"'":`'`,")":`(`},n=e.trimEnd(),r=t[n[n.length-1]??``];if(!r)return{url:e.trim(),title:null};for(let e=n.length-2;e>0;e--){if(n[e]!==r||Me(n,e)||!/\s/.test(n[e-1]))continue;let t=n.slice(0,e).trim();if(t)return{url:t,title:n.slice(e+1,-1).replace(/\\([\\"'()])/g,`$1`)}}return{url:e.trim(),title:null}}function Ae(e){return e.replace(/\\/g,`\\\\`).replace(/&quot;/g,`\\&quot;`)}function je(e,t,n,r){let i=0;for(let a=t;a<e.length;a++)if(!Me(e,a)&&(e[a]===n&&i++,e[a]===r&&(i--,i===0)))return a;return-1}function Me(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1}function Ne(e){return e!==void 0&&/[\p{L}\p{N}_]/u.test(e)}function Pe(e){return e===void 0||/\s/.test(e)}var Fe=/(?:https?:\/\/|ftp:\/\/|www\.)(?:\([^\s<>()]*\)|[^\s<>[\]()])+/gi;function Ie(e){let t=``,n=0;Fe.lastIndex=0;let r;for(;(r=Fe.exec(e))!==null;)t+=Le(e.slice(n,r.index)),t+=r[0],n=r.index+r[0].length;return t+Le(e.slice(n))}function Le(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n],i=e[n-1],a=e[n+1];if(r===`\\`){t+=m.includes(a??``)?`\\\\`:`\\`;continue}if(r===`~`){t+=i===`~`||a===`~`?`\\~`:`~`;continue}if(r===`*`){t+=!Pe(a)||!Pe(i)?`\\*`:`*`;continue}if(r===`_`){let e=!Ne(i)&&!Pe(a),n=!Ne(a)&&!Pe(i);t+=e||n?`\\_`:`_`;continue}t+=r}return t}function Re(e){let t=``,n=0,r=/<code\b[^>]*>[\s\S]*?<\/code>|<[^>]+>/gi,i;for(;(i=r.exec(e))!==null;)t+=Ie(e.slice(n,i.index)),t+=i[0],n=i.index+i[0].length;return t+Ie(e.slice(n))}function ze(e){return e.replace(ne,(e,t,n)=>{let r=ze(n),i=r.match(/^\s*/)?.[0]??``,a=r.match(/\s*$/)?.[0]??``,o=r.slice(i.length,r.length-a.length);if(!o)return r;if(t===`sup`||t===`sub`)return`${i}<${t}>${o}</${t}>${a}`;let s=t===`strong`||t===`b`?`**`:t===`em`||t===`i`?`*`:`~~`;return`${i}${s}${o}${s}${a}`})}var Be=class{constructor(){this.parts=[]}protect(e){return this.parts.push(e),`\0RAW${this.parts.length-1}\0`}restore(e){let t=e;for(let e=this.parts.length-1;e>=0;e--)t=t.split(`\0RAW${e}\0`).join(this.parts[e]);return t}};function Ve(e){let t=e,n=new Be;return t=t.replace(/<br\s*\/?>/gi,`
10
+ `).forEach((t,a)=>{i===0&&a===0?o.push(n+e+t):(a===0&&o.push(``),o.push(r+t))})}),o.length===0&&i.length===0)return[n+e];let s=[];if(o.length>0){s.push(...o);for(let e of i)s.push(``),s.push(r+e)}else{s.push(n+e+i[0]);for(let e of i.slice(1))s.push(``),s.push(r+e)}return s}function ge(e){if(e[0]?.trim()!==`---`)return-1;for(let t=1;t<e.length;t++)if(e[t].trim()===`---`)return t;return-1}function _e(e){let t=/^ {0,3}(=+|-+)[ \t]*$/.exec(e);return t?t[1][0]===`=`?1:2:null}function ve(e){return/^(?: {4}|\t)/.test(e)&&e.trim()!==``}function ye(e){return e.startsWith(` `)?e.slice(1):e.slice(4)}function be(e,t){let n=t,a=``,s=null,c=null;for(let e=0;e<4;e++){let e=!1;if(s==null){let t=i(n);t&&(s=t.inner.trim(),n=n.slice(0,t.index).trimEnd(),e=!0)}if(c==null){let t=r(n);t&&(c=t.inner.trim(),n=n.slice(0,t.index).trimEnd(),e=!0)}if(!e)break}if(s!=null){let e=o(s);e.length===0&&(a+=` data-template-empty="true"`);let t=e.length>0&&e[0].indexOf(`=`)>0;!t&&e[0]&&(a+=` data-template="${b(e[0])}"`);let n=e.slice(+!t).filter(e=>e.includes(`=`));n.length>0&&(a+=` data-template-params="${b(n.join(` `))}"`)}return c!=null&&(a+=` data-block-attrs="${b(c)}"`),`<h${e}${a}>${De(n)}</h${e}>`}function xe(e){let t=0;for(let n of e)t+=n===` `?4:1;return t}function Se(e){let t=e.trim();return t.startsWith(`|`)&&(t=t.slice(1)),t.endsWith(`|`)&&(t=t.slice(0,-1)),t.split(`|`).map(e=>e.trim())}function Ce(e){return Se(e).map(e=>{let t=e.replace(/\s/g,``);return t.startsWith(`:`)&&t.endsWith(`:`)?`center`:t.endsWith(`:`)?`right`:t.startsWith(`:`)?`left`:null})}function we(e,t){let n=/\bsrc="([^"]*)"/i.exec(t)?.[1]??``,r=/\bcontrols\b/i.test(t),i=/\bwidth="([^"]*)"/i.exec(t)?.[1],a=/\bheight="([^"]*)"/i.exec(t)?.[1],o=e===`video`?/\bposter="([^"]*)"/i.exec(t)?.[1]:void 0,s=e===`video`?/\bdata-squisq-video-placement="([^"]*)"/i.exec(t)?.[1]:void 0,c=e===`video`?/\bdata-squisq-video-lock-to-block="([^"]*)"/i.exec(t)?.[1]:void 0,l=e===`video`?/\bdata-squisq-video-pip-size="([^"]*)"/i.exec(t)?.[1]:void 0,u=e===`video`?/\bdata-squisq-video-pip-shape="([^"]*)"/i.exec(t)?.[1]:void 0,d=e===`video`?/\bdata-squisq-video-pip-position="([^"]*)"/i.exec(t)?.[1]:void 0,f=`data-squisq-${e}`,p=RegExp(`\\b${f}-start-at="([^"]*)"`,`i`).exec(t)?.[1],m=RegExp(`\\b${f}-clip-start="([^"]*)"`,`i`).exec(t)?.[1],h=RegExp(`\\b${f}-clip-end="([^"]*)"`,`i`).exec(t)?.[1],g=[`<${e} src="${n}"`];return r&&g.push(` controls`),i&&g.push(` width="${i}"`),a&&g.push(` height="${a}"`),o&&g.push(` poster="${o}"`),(s===`picture-in-picture`||s===`overlay`)&&g.push(` data-squisq-video-placement="${s}"`),c===`false`&&g.push(` data-squisq-video-lock-to-block="false"`),(l===`small`||l===`large`)&&g.push(` data-squisq-video-pip-size="${l}"`),(u===`square`||u===`wide`)&&g.push(` data-squisq-video-pip-shape="${u}"`),(d===`top-left`||d===`top-right`||d===`bottom-left`||d===`bottom-right`)&&g.push(` data-squisq-video-pip-position="${d}"`),p!=null&&g.push(` ${f}-start-at="${p}"`),m!=null&&g.push(` ${f}-clip-start="${m}"`),h!=null&&g.push(` ${f}-clip-end="${h}"`),g.push(`></${e}>`),g.join(``)}function Te(e,t,n){let r=/\bwidth="([^"]*)"/i.exec(n)?.[1],i=/\bheight="([^"]*)"/i.exec(n)?.[1],a=/\btitle="([^"]*)"/i.exec(n)?.[1];if(!r&&!i)return`![${t}](${e})`;let o=[`<img alt="${t}" src="${e}"`];return r&&o.push(` width="${r}"`),i&&o.push(` height="${i}"`),a&&o.push(` title="${a}"`),o.push(`>`),o.join(``)}function b(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`)}function Ee(e){return e.replace(/&lt;/g,`<`).replace(/&gt;/g,`>`).replace(/&quot;/g,`"`).replace(/&nbsp;|&#160;|&#xA0;/gi,`\xA0`).replace(/&amp;/g,`&`)}function De(e){let t=[],n=e=>{let n=`\0PH${t.length}\0`;return t.push(e),n},r=e.replace(g,(e,t)=>n(`<code>${b(t)}</code>`));r=r.replace(ie,(e,t,r)=>{let i=t.toLowerCase();return n(`<${i}>${De(r)}</${i}>`)}),r=r.replace(ee,(e,t,r)=>n(`<img alt="${b(t)}" src="${b(r)}">`)),r=r.replace(te,(e,t,r,i)=>n(`<span data-mention="true" data-kind="${b(r)}" data-id="${b(i)}" data-label="${b(t)}" class="mention">@${b(t)}</span>`)),r=r.replace(v,(e,t)=>{let r=a(t);return r?n(`<i class="fa-${r.family} fa-${r.name}" data-icon="${b(t)}" data-family="${r.family}" data-name="${r.name}" contenteditable="false"></i>`):e}),r=Oe(r,(e,t)=>{let{url:r,title:i}=ke(t),a=i===null?``:` title="${b(i)}"`;return n(`<a href="${b(r)}"${a}>${De(e)}</a>`)});let i=b(r);i=i.replace(h,(e,t)=>`\0ESC${m.indexOf(t)}\0`),i=i.replace(f,`<strong>$1</strong>$2`),i=i.replace(s,`<strong>$1</strong>`),i=i.replace(c,`<strong>$1</strong>`),i=i.replace(p,`<em>$1</em>$2`),i=i.replace(l,`<em>$1</em>`),i=i.replace(u,`<em>$1</em>`),i=i.replace(d,`<s>$1</s>`);for(let e=0;e<m.length;e++)i=i.split(`\0ESC${e}\0`).join(m[e]);for(let e=t.length-1;e>=0;e--)i=i.split(`\0PH${e}\0`).join(t[e]??``);return He(i)}function Oe(e,t){let n=``,r=0,i=0;for(;i<e.length;){let a=e.indexOf(`[`,i);if(a<0)break;if(Me(e,a)){i=a+1;continue}let o=je(e,a,`[`,`]`),s=o+1;if(o<0||e[s]!==`(`){i=a+1;continue}let c=je(e,s,`(`,`)`);if(c<0){i=a+1;continue}let l=e.slice(a+1,o),u=e.slice(s+1,c);if(!l||!u){i=a+1;continue}n+=e.slice(r,a)+t(l,u),r=c+1,i=r}return n+e.slice(r)}function ke(e){let t={'"':`"`,"'":`'`,")":`(`},n=e.trimEnd(),r=t[n[n.length-1]??``];if(!r)return{url:e.trim(),title:null};for(let e=n.length-2;e>0;e--){if(n[e]!==r||Me(n,e)||!/\s/.test(n[e-1]))continue;let t=n.slice(0,e).trim();if(t)return{url:t,title:n.slice(e+1,-1).replace(/\\([\\"'()])/g,`$1`)}}return{url:e.trim(),title:null}}function Ae(e){return e.replace(/\\/g,`\\\\`).replace(/&quot;/g,`\\&quot;`)}function je(e,t,n,r){let i=0;for(let a=t;a<e.length;a++)if(!Me(e,a)&&(e[a]===n&&i++,e[a]===r&&(i--,i===0)))return a;return-1}function Me(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n%2==1}function Ne(e){return e!==void 0&&/[\p{L}\p{N}_]/u.test(e)}function Pe(e){return e===void 0||/\s/.test(e)}var Fe=/(?:https?:\/\/|ftp:\/\/|www\.)(?:\([^\s<>()]*\)|[^\s<>[\]()])+/gi;function Ie(e){let t=``,n=0;Fe.lastIndex=0;let r;for(;(r=Fe.exec(e))!==null;)t+=Le(e.slice(n,r.index)),t+=r[0],n=r.index+r[0].length;return t+Le(e.slice(n))}function Le(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n],i=e[n-1],a=e[n+1];if(r===`\\`){t+=m.includes(a??``)?`\\\\`:`\\`;continue}if(r===`~`){t+=i===`~`||a===`~`?`\\~`:`~`;continue}if(r===`*`){t+=!Pe(a)||!Pe(i)?`\\*`:`*`;continue}if(r===`_`){let e=!Ne(i)&&!Pe(a),n=!Ne(a)&&!Pe(i);t+=e||n?`\\_`:`_`;continue}t+=r}return t}function Re(e){let t=``,n=0,r=/<code\b[^>]*>[\s\S]*?<\/code>|<[^>]+>/gi,i;for(;(i=r.exec(e))!==null;)t+=Ie(e.slice(n,i.index)),t+=i[0],n=i.index+i[0].length;return t+Ie(e.slice(n))}function ze(e){return e.replace(ne,(e,t,n)=>{let r=ze(n),i=r.match(/^\s*/)?.[0]??``,a=r.match(/\s*$/)?.[0]??``,o=r.slice(i.length,r.length-a.length);if(!o)return r;if(t===`sup`||t===`sub`)return`${i}<${t}>${o}</${t}>${a}`;let s=t===`strong`||t===`b`?`**`:t===`em`||t===`i`?`*`:`~~`;return`${i}${s}${o}${s}${a}`})}var Be=class{constructor(){this.parts=[]}protect(e){return this.parts.push(e),`\0RAW${this.parts.length-1}\0`}restore(e){let t=e;for(let e=this.parts.length-1;e>=0;e--)t=t.split(`\0RAW${e}\0`).join(this.parts[e]);return t}};function Ve(e){let t=e,n=new Be;return t=t.replace(/<br\s*\/?>/gi,`
11
11
  `),t=Re(t),t=t.replace(y,(e,t)=>`{[${t}]}`),t=ze(t),t=t.replace(/<\/?(?:sup|sub)>/gi,e=>n.protect(e)),t=t.replace(re,"`$1`"),t=t.replace(_,(e,t)=>{let n=/data-kind="([^"]*)"/i.exec(e)?.[1]??``,r=/data-id="([^"]*)"/i.exec(e)?.[1]??``,i=/data-label="([^"]*)"/i.exec(e)?.[1]??``;return!n||!r||!i?e:`@[${i}](${n}:${r})`}),t=t.replace(ae,(e,t,n)=>{let r=/\bhref="([^"]*)"/i.exec(t)?.[1];if(r===void 0)return e;let i=/\btitle="([^"]*)"/i.exec(t)?.[1];return`[${n}](${r}${i?` "${Ae(i)}"`:``})`}),t=t.replace(oe,(e,t)=>{let r=/\bsrc="([^"]*)"/i.exec(t)?.[1];if(!r)return e;let i=Te(r,/\balt="([^"]*)"/i.exec(t)?.[1]??``,t);return i.startsWith(`<`)?n.protect(i):i}),t=t.replace(se,``),t=n.restore(t),Ue(Ee(t))}function He(e){return e.replace(/^ +/,e=>`&nbsp;`.repeat(e.length))}function Ue(e){return e.replace(/(^|\n)(\u00a0+)/g,(e,t,n)=>t+` `.repeat(n.length))}function x(e){this.content=e}x.prototype={constructor:x,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),a=r.content.slice();return i==-1?a.push(n||e,t):(a[i+1]=t,n&&(a[i]=n)),new x(a)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new x(n)},addToStart:function(e,t){return new x([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new x(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),a=r.find(e);return i.splice(a==-1?i.length:a,0,t,n),new x(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=x.from(e),e.size?new x(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=x.from(e),e.size?new x(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=x.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},x.from=function(e){if(e instanceof x)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new x(t)};function We(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let e=i.text,t=a.text,r=0;for(;e[r]==t[r];r++)n++;return r&&r<e.length&&r<t.length&&qe(e.charCodeAt(r-1))&&Ke(e.charCodeAt(r))&&n--,n}if(i.content.size||a.content.size){let e=We(i.content,a.content,n+1);if(e!=null)return e}n+=i.nodeSize}}function Ge(e,t,n,r){for(let i=e.childCount,a=t.childCount;;){if(i==0||a==0)return i==a?null:{a:n,b:r};let o=e.child(--i),s=t.child(--a),c=o.nodeSize;if(o==s){n-=c,r-=c;continue}if(!o.sameMarkup(s))return{a:n,b:r};if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,i=e.length,a=t.length;for(;i>0&&a>0&&e[i-1]==t[a-1];)i--,a--,n--,r--;return i&&a&&i<e.length&&qe(e.charCodeAt(i-1))&&Ke(e.charCodeAt(i))&&(n++,r++),{a:n,b:r}}if(o.content.size||s.content.size){let e=Ge(o.content,s.content,n-1,r-1);if(e)return e}n-=c,r-=c}}function Ke(e){return e>=56320&&e<57344}function qe(e){return e>=55296&&e<56320}var S=class e{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let a=0,o=0;o<t;a++){let s=this.content[a],c=o+s.nodeSize;if(c>e&&n(s,r+o,i||null,a)!==!1&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,t-i),n,r+i)}o=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i=``,a=!0;return this.nodesBetween(e,t,(o,s)=>{let c=o.isText?o.text.slice(Math.max(e,s)-s,t-s):o.isLeaf?r?typeof r==`function`?r(o):r:o.type.spec.leafText?o.type.spec.leafText(o):``:``;o.isBlock&&(o.isLeaf&&c||o.isTextblock)&&n&&(a?a=!1:i+=n),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);a<t.content.length;a++)i.push(t.content[a]);return new e(i,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],i=0;if(n>t)for(let e=0,a=0;a<n;e++){let o=this.content[e],s=a+o.nodeSize;s>t&&((a<t||s>n)&&(o=o.isText?o.cut(Math.max(0,t-a),Math.min(o.text.length,n-a)):o.cut(Math.max(0,t-a-1),Math.min(o.content.size,n-a-1))),r.push(o),i+=o.nodeSize),a=s}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError(`Index `+e+` out of range for `+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return We(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ge(this,e,t,n)}findIndex(e){if(e==0)return Ye(0,e);if(e==this.size)return Ye(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=this.child(t),i=n+r.nodeSize;if(i>=e)return i==e?Ye(t+1,i):Ye(t,n);n=i}}toString(){return`<`+this.toStringInner()+`>`}toStringInner(){return this.content.join(`, `)}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw RangeError(`Invalid input for Fragment.fromJSON`);return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let e=0;e<t.length;e++){let i=t[e];r+=i.nodeSize,e&&i.isText&&t[e-1].sameMarkup(i)?(n||=t.slice(0,e),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}static from(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw RangeError(`Can not convert `+t+` to a Fragment`+(t.nodesBetween?` (looks like multiple versions of prosemirror-model were loaded)`:``))}};S.empty=new S([],0);var Je={index:0,offset:0};function Ye(e,t){return Je.index=e,Je.offset=t,Je}function Xe(e,t){if(e===t)return!0;if(!(e&&typeof e==`object`)||!(t&&typeof t==`object`))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!Xe(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!Xe(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}var C=class e{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||=e.slice(0,r);else if(i.type.excludes(this.type))return e;else!n&&i.type.rank>this.type.rank&&(t||=e.slice(0,r),t.push(this),n=!0),t&&t.push(i)}return t||=e.slice(),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Xe(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Mark.fromJSON`);let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return e.none;if(t instanceof e)return[t];let n=t.slice();return n.sort((e,t)=>e.type.rank-t.type.rank),n}};C.none=[];var Ze=class extends Error{},w=class e{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=$e(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(Qe(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+`(`+this.openStart+`,`+this.openEnd+`)`}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(t,n){if(!n)return e.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid input for Slice.fromJSON`);return new e(S.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let e=t.firstChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.firstChild)r++;for(let e=t.lastChild;e&&!e.isLeaf&&(n||!e.type.spec.isolating);e=e.lastChild)i++;return new e(t,r,i)}};w.empty=new w(S.empty,0,0);function Qe(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw RangeError(`Removing non-flat range`);return e.cut(0,t).append(e.cut(n))}if(r!=o)throw RangeError(`Removing non-flat range`);return e.replaceChild(r,a.copy(Qe(a.content,t-i-1,n-i-1)))}function $e(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),c=e.maybeChild(o);if(s==t||c.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let l=$e(c.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,c);return l&&e.replaceChild(o,c.copy(l))}function et(e,t,n){if(n.openStart>e.depth)throw new Ze(`Inserted content deeper than insertion position`);if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ze(`Inconsistent open depths`);return tt(e,t,n,0)}function tt(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r<e.depth-n.openStart){let o=tt(e,t,n,r+1);return a.copy(a.content.replaceChild(i,o))}else if(!n.content.size)return ot(a,ct(e,t,r));else if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let r=e.parent,i=r.content;return ot(r,i.cut(0,e.parentOffset).append(n.content).append(i.cut(t.parentOffset)))}else{let{start:i,end:o}=lt(n,e);return ot(a,st(e,i,o,t,r))}}function nt(e,t){if(!t.type.compatibleContent(e.type))throw new Ze(`Cannot join `+t.type.name+` onto `+e.type.name)}function rt(e,t,n){let r=e.node(n);return nt(r,t.node(n)),r}function it(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function at(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(it(e.nodeAfter,r),a++));for(let e=a;e<o;e++)it(i.child(e),r);t&&t.depth==n&&t.textOffset&&it(t.nodeBefore,r)}function ot(e,t){if(!e.type.validContent(t))throw new Ze(`Invalid content for node `+e.type.name);return e.copy(t)}function st(e,t,n,r,i){let a=e.depth>i&&rt(e,t,i+1),o=r.depth>i&&rt(n,r,i+1),s=[];return at(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(nt(a,o),it(ot(a,st(e,t,n,r,i+1)),s)):(a&&it(ot(a,ct(e,t,i+1)),s),at(t,n,i,s),o&&it(ot(o,ct(n,r,i+1)),s)),at(r,null,i,s),new S(s)}function ct(e,t,n){let r=[];return at(null,e,n,r),e.depth>n&&it(ot(rt(e,t,n+1),ct(e,t,n+1)),r),at(t,null,n,r),new S(r)}function lt(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(S.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}var ut=class e{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position before the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw RangeError(`There is no position after the top-level node`);return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return C.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var a=0;a<i.length;a++)i[a].type.spec.inclusive===!1&&(!r||!i[a].isInSet(r.marks))&&(i=i[a--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)n[i].type.spec.inclusive===!1&&(!r||!n[i].isInSet(r.marks))&&(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new mt(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e=``;for(let t=1;t<=this.depth;t++)e+=(e?`/`:``)+this.node(t).type.name+`_`+this.index(t-1);return e+`:`+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw RangeError(`Position `+n+` out of range`);let r=[],i=0,a=n;for(let e=t;;){let{index:t,offset:n}=e.content.findIndex(a),o=a-n;if(r.push(e,t,i+n),!o||(e=e.child(t),e.isText))break;a=o-1,i+=n+1}return new e(n,r,a)}static resolveCached(t,n){let r=pt.get(t);if(r)for(let e=0;e<r.elts.length;e++){let t=r.elts[e];if(t.pos==n)return t}else pt.set(t,r=new dt);let i=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%ft,i}},dt=class{constructor(){this.elts=[],this.i=0}},ft=12,pt=new WeakMap,mt=class{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}},ht=Object.create(null),gt=class e{constructor(e,t,n,r=C.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||S.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,``)}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&Xe(this.attrs,t||e.defaultAttrs||ht)&&C.sameSet(this.marks,n||C.none)}copy(t=null){return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return w.empty;let r=this.resolve(e),i=this.resolve(t),a=n?0:r.sharedDepth(t),o=r.start(a);return new w(r.node(a).content.cut(r.pos-o,i.pos-o),r.depth-a,i.depth-a)}replace(e,t,n){return et(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return ut.resolveCached(this,e)}resolveNoCache(e){return ut.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+=`(`+this.content.toStringInner()+`)`),vt(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error(`Called contentMatchAt on a node with invalid content`);return t}canReplace(e,t,n=S.empty,r=0,i=n.childCount){let a=this.contentMatchAt(e).matchFragment(n,r,i),o=a&&a.matchFragment(this.content,t);if(!o||!o.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),a=i&&i.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=C.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!C.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw RangeError(`Invalid input for Node.fromJSON`);let n;if(t.marks){if(!Array.isArray(t.marks))throw RangeError(`Invalid mark data for Node.fromJSON`);n=t.marks.map(e.markFromJSON)}if(t.type==`text`){if(typeof t.text!=`string`)throw RangeError(`Invalid text node in JSON`);return e.text(t.text,n)}let r=S.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}};gt.prototype.text=void 0;var _t=class e extends gt{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError(`Empty text nodes are not allowed`);this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):vt(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function vt(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+`(`+t+`)`;return t}var yt=class e{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new bt(t,n);if(r.next==null)return e.empty;let i=xt(r);r.next&&r.err(`Unexpected trailing text`);let a=jt(Ot(i));return Mt(a,r),a}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];function i(a,o){let s=a.matchFragment(e,n);if(s&&(!t||s.validEnd))return S.from(o.map(e=>e.createAndFill()));for(let e=0;e<a.next.length;e++){let{type:t,next:n}=a.next[e];if(!(t.isText||t.hasRequiredAttrs())&&r.indexOf(n)==-1){r.push(n);let e=i(n,o.concat(t));if(e)return e}}return null}return i(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:a,next:o}=i.next[e];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!r.type||o.validEnd)&&(n.push({match:a.contentMatch,type:a,via:r}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let r=0;r<n.next.length;r++)e.indexOf(n.next[r].next)==-1&&t(n.next[r].next)}return t(this),e.map((t,n)=>{let r=n+(t.validEnd?`*`:` `)+` `;for(let n=0;n<t.next.length;n++)r+=(n?`, `:``)+t.next[n].type.name+`->`+e.indexOf(t.next[n].next);return r}).join(`
12
12
  `)}};yt.empty=new yt(!0);var bt=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==``&&this.tokens.pop(),this.tokens[0]==``&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+` (in content expression '`+this.string+`')`)}};function xt(e){let t=[];do t.push(St(e));while(e.eat(`|`));return t.length==1?t[0]:{type:`choice`,exprs:t}}function St(e){let t=[];do t.push(Ct(e));while(e.next&&e.next!=`)`&&e.next!=`|`);return t.length==1?t[0]:{type:`seq`,exprs:t}}function Ct(e){let t=Dt(e);for(;;)if(e.eat(`+`))t={type:`plus`,expr:t};else if(e.eat(`*`))t={type:`star`,expr:t};else if(e.eat(`?`))t={type:`opt`,expr:t};else if(e.eat(`{`))t=Tt(e,t);else break;return t}function wt(e){/\D/.test(e.next)&&e.err(`Expected number, got '`+e.next+`'`);let t=Number(e.next);return e.pos++,t}function Tt(e,t){let n=wt(e),r=n;return e.eat(`,`)&&(r=e.next==`}`?-1:wt(e)),e.eat(`}`)||e.err(`Unclosed braced range`),{type:`range`,min:n,max:r,expr:t}}function Et(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return i.length==0&&e.err(`No node type or group '`+t+`' found`),i}function Dt(e){if(e.eat(`(`)){let t=xt(e);return e.eat(`)`)||e.err(`Missing closing paren`),t}else if(/\W/.test(e.next))e.err(`Unexpected token '`+e.next+`'`);else{let t=Et(e,e.next).map(t=>(e.inline==null?e.inline=t.isInline:e.inline!=t.isInline&&e.err(`Mixing inline and block content`),{type:`name`,value:t}));return e.pos++,t.length==1?t[0]:{type:`choice`,exprs:t}}}function Ot(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}function a(e,t){if(e.type==`choice`)return e.exprs.reduce((e,n)=>e.concat(a(n,t)),[]);if(e.type==`seq`)for(let r=0;;r++){let o=a(e.exprs[r],t);if(r==e.exprs.length-1)return o;i(o,t=n())}else if(e.type==`star`){let o=n();return r(t,o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`plus`){let o=n();return i(a(e.expr,t),o),i(a(e.expr,o),o),[r(o)]}else if(e.type==`opt`)return[r(t)].concat(a(e.expr,t));else if(e.type==`range`){let o=t;for(let t=0;t<e.min;t++){let t=n();i(a(e.expr,o),t),o=t}if(e.max==-1)i(a(e.expr,o),o);else for(let t=e.min;t<e.max;t++){let t=n();r(o,t),i(a(e.expr,o),t),o=t}return[r(o)]}else if(e.type==`name`)return[r(t,void 0,e.value)];else throw Error(`Unknown expr type`)}}function kt(e,t){return t-e}function At(e,t){let n=[];return r(t),n.sort(kt);function r(t){let i=e[t];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(t);for(let e=0;e<i.length;e++){let{term:t,to:a}=i[e];!t&&n.indexOf(a)==-1&&r(a)}}}function jt(e){let t=Object.create(null);return n(At(e,0));function n(r){let i=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<i.length;e++)i[e][0]==t&&(r=i[e][1]);At(e,n).forEach(e=>{r||i.push([t,r=[]]),r.indexOf(e)==-1&&r.push(e)})})});let a=t[r.join(`,`)]=new yt(r.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let r=i[e][1].sort(kt);a.next.push({type:i[e][0],next:t[r.join(`,`)]||n(r)})}return a}}function Mt(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,a=[];for(let t=0;t<e.next.length;t++){let{type:n,next:o}=e.next[t];a.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),r.indexOf(o)==-1&&r.push(o)}i&&t.err(`Only non-generatable nodes (`+a.join(`, `)+`) in a required position (see https://prosemirror.net/docs/guide/#generatable)`)}}function Nt(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function Pt(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(i===void 0){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError(`No value supplied for attribute `+r)}n[r]=i}return n}function Ft(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function It(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new zt(e,r,t[r]);return n}var Lt=class e{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(` `):[],this.attrs=It(e,n.attrs),this.defaultAttrs=Nt(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e==`text`),this.isText=e==`text`}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yt.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?`pre`:`normal`)}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Pt(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error(`NodeType.create can't construct text nodes`);return new gt(this,this.computeAttrs(e),S.from(t),C.setFrom(n))}createChecked(e=null,t,n){return t=S.from(t),this.checkContent(t),new gt(this,this.computeAttrs(e),t,C.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=S.from(t),t.size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(S.empty,!0);return i?new gt(this,e,t.append(i),C.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Ft(this.attrs,e,`node`,this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||=e.slice(0,n);return t?t.length?t:C.none:e}static compile(t,n){let r=Object.create(null);t.forEach((t,i)=>r[t]=new e(t,n,i));let i=n.spec.topNode||`doc`;if(!r[i])throw RangeError(`Schema is missing its top node type ('`+i+`')`);if(!r.text)throw RangeError(`Every schema needs a 'text' type`);for(let e in r.text.attrs)throw RangeError(`The text node type should not have attributes`);return r}};function Rt(e,t,n){let r=n.split(`|`);return n=>{let i=n===null?`null`:typeof n;if(r.indexOf(i)<0)throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}var zt=class{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,`default`),this.default=n.default,this.validate=typeof n.validate==`string`?Rt(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}},Bt=class e{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=It(e,r.attrs),this.excluded=null;let i=Nt(this.attrs);this.instance=i?new C(this,i):null}create(e=null){return!e&&this.instance?this.instance:new C(this,Pt(this.attrs,e))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((t,a)=>r[t]=new e(t,i++,n,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Ft(this.attrs,e,`mark`,this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},Vt=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=x.from(e.nodes),t.marks=x.from(e.marks||{}),this.nodes=Lt.compile(this.spec.nodes,this),this.marks=Bt.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+` can not be both a node and a mark`);let t=this.nodes[e],r=t.spec.content||``,i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=yt.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError(`Multiple linebreak nodes defined`);if(!t.isInline||!t.isLeaf)throw RangeError(`Linebreak replacement nodes must be inline leaf nodes`);this.linebreakReplacement=t}t.markSet=i==`_`?null:i?Ht(this,i.split(` `)):i==``||!t.inlineContent?[]:null}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=n==null?[t]:n==``?[]:Ht(this,n.split(` `))}this.nodeFromJSON=e=>gt.fromJSON(this,e),this.markFromJSON=e=>C.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||`doc`],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if(typeof e==`string`)e=this.nodeType(e);else if(!(e instanceof Lt))throw RangeError(`Invalid node type: `+e);else if(e.schema!=this)throw RangeError(`Node type from different schema used (`+e.name+`)`);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new _t(n,n.defaultAttrs,e,C.setFrom(t))}mark(e,t){return typeof e==`string`&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError(`Unknown node type: `+e);return t}};function Ht(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],a=e.marks[i],o=a;if(a)n.push(a);else for(let t in e.marks){let r=e.marks[t];(i==`_`||r.spec.group&&r.spec.group.split(` `).indexOf(i)>-1)&&n.push(o=r)}if(!o)throw SyntaxError(`Unknown mark type: '`+t[r]+`'`)}return n}function Ut(e){return e.tag!=null}function Wt(e){return e.style!=null}var Gt=class e{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(Ut(e))this.tags.push(e);else if(Wt(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new en(this,t,!1);return n.addAll(e,C.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new en(this,t,!0);return n.addAll(e,C.none,t.from,t.to),w.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(nn(e,n.tag)&&(n.namespace===void 0||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(t===!1)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],a=r.style;if(!(a.indexOf(e)!=0||r.context&&!n.matchesContext(r.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(e===!1)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=e.priority==null?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((e.priority==null?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=rn(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=rn(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},Kt={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},qt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Jt={ol:!0,ul:!0},Yt=1,Xt=2,Zt=4;function Qt(e,t,n){return t==null?e&&e.whitespace==`pre`?3:n&-5:(t?Yt:0)|(t===`full`?Xt:0)}var $t=class{constructor(e,t,n,r,i,a){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=a,this.content=[],this.activeMarks=C.none,this.match=i||(a&Zt?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(S.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Yt)){let e=this.content[this.content.length-1],t;if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let t=S.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(S.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Kt.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},en=class{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,a=Qt(null,t.preserveWhitespace,0)|(n?Zt:0);i=r?new $t(r.type,r.attrs,C.none,!0,t.topMatch||r.type.contentMatch,a):n?new $t(null,null,C.none,!0,null,a):new $t(e.schema.topNodeType,null,C.none,!0,null,a),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=r.options&Xt?`full`:this.localPreserveWS||(r.options&Yt)>0,{schema:a}=this.parser;if(i===`full`||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(!i){if(n=n.replace(/[ \t\r\n\u000c]+/g,` `),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&i.nodeName==`BR`||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}}else if(i===`full`)n=n.replace(/\r\n?/g,`
13
13
  `);else if(a.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(a.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(a.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(a.text(e[n]),t,!/\S/.test(e[n]));n=``}else n=n.replace(/\r?\n|\r/g,` `);n&&this.insertNode(a.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;(e.tagName==`PRE`||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),o;Jt.hasOwnProperty(a)&&this.parser.normalizeLists&&tn(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,n));out:if(s?s.ignore:qt.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let n,r=this.needsBlock;if(Kt.hasOwnProperty(a))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break out}let o=s&&s.skip?t:this.readStyles(e,t);o&&this.addAll(e,o),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,s,n,s.consuming===!1?o:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName==`BR`&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,t as n}from"./jsx-runtime-CEpd2cAX.js";import{_ as r,a as i,b as a,c as o,d as s,f as c,g as l,l as u,m as d,o as f,p,s as m,u as h,x as g,y as _}from"./Tabs-jE0Z5Tzd.js";import{$ as v,C as y,Q as ee,S as b,X as x,Z as te,b as S,et as ne,tt as re,x as ie}from"./primitives-CWrGZpPI.js";var C=e(t(),1),w=n(),T=Object.defineProperty,E=(e,t)=>T(e,`name`,{value:t,configurable:!0}),D=[`Enter`,` `],O=[`ArrowDown`,`PageUp`,`Home`],ae=[`ArrowUp`,`PageDown`,`End`],oe=[...O,...ae];[...D],[...D];var k=`Menu`,[A,se,j]=u(k),[M,N]=_(k,[j,y,m]),P=y(),ce=m(),[F,I]=M(k),[L,R]=M(k),z=E(e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:c=!0}=e,l=P(t),[u,d]=C.useState(null),f=C.useRef(!1),p=s(a),m=o(i);return C.useEffect(()=>{let e=E(()=>{f.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},`handleKeyDown`),t=E(()=>f.current=!1,`handlePointer`);return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),C.useEffect(()=>{if(!n)return;let e=E(()=>p(!1),`handleBlur`);return window.addEventListener(`blur`,e),()=>window.removeEventListener(`blur`,e)},[n,p]),(0,w.jsx)(b,{...l,children:(0,w.jsx)(F,{scope:t,open:n,onOpenChange:p,content:u,onContentChange:d,children:(0,w.jsx)(L,{scope:t,onClose:C.useCallback(()=>p(!1),[p]),isUsingKeyboardRef:f,dir:m,modal:c,children:r})})})},`Menu`),B=C.forwardRef(E(function(e,t){let{__scopeMenu:n,...r}=e,i=P(n);return(0,w.jsx)(S,{...i,...r,ref:t})},`MenuAnchor`)),V=`MenuPortal`,[H,U]=M(V,{forceMount:void 0}),le=E(e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=I(V,t);return(0,w.jsx)(H,{scope:t,forceMount:n,children:(0,w.jsx)(h,{present:n||a.open,children:(0,w.jsx)(v,{asChild:!0,container:i,children:r})})})},`MenuPortal`),W=`MenuContent`,[ue,G]=M(W),de=C.forwardRef(E(function(e,t){let n=U(W,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=I(W,e.__scopeMenu),o=R(W,e.__scopeMenu);return(0,w.jsx)(A.Provider,{scope:e.__scopeMenu,children:(0,w.jsx)(h,{present:r||a.open,children:(0,w.jsx)(A.Slot,{scope:e.__scopeMenu,children:o.modal?(0,w.jsx)(fe,{...i,ref:t}):(0,w.jsx)(pe,{...i,ref:t})})})})},`MenuContent`)),fe=C.forwardRef(E(function(e,t){let n=I(W,e.__scopeMenu),r=C.useRef(null),i=a(t,r);return C.useEffect(()=>{let e=r.current;if(e)return x(e)},[]),(0,w.jsx)(K,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:g(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentModal`)),pe=C.forwardRef(E(function(e,t){let n=I(W,e.__scopeMenu);return(0,w.jsx)(K,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})},`MenuRootContentNonModal`)),me=d(`MenuContent.ScrollLock`),K=C.forwardRef(E(function(e,t){let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:h,disableOutsideScroll:_,...v}=e,y=I(W,n),b=R(W,n),x=P(n),S=ce(n),T=se(n),[D,O]=C.useState(null),k=C.useRef(null),A=a(t,k,y.onContentChange),j=C.useRef(0),M=C.useRef(``),N=C.useRef(0),F=C.useRef(null),L=C.useRef(`right`),z=C.useRef(0),B=_?te:C.Fragment,V=_?{as:me,allowPinchZoom:!0}:void 0,H=E(e=>{let t=M.current+e,n=T().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=Ae(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;E((function e(t){M.current=t,window.clearTimeout(j.current),t!==``&&(j.current=window.setTimeout(()=>e(``),1e3))}),`updateSearch`)(t),o&&setTimeout(()=>o.focus())},`handleTypeaheadSearch`);C.useEffect(()=>()=>window.clearTimeout(j.current),[]),ee();let U=C.useCallback(e=>L.current===F.current?.side&&Me(e,F.current?.area),[]);return(0,w.jsx)(ue,{scope:n,searchRef:M,onItemEnter:C.useCallback(e=>{U(e)&&e.preventDefault()},[U]),onItemLeave:C.useCallback(e=>{U(e)||(k.current?.focus(),O(null))},[U]),onTriggerLeave:C.useCallback(e=>{U(e)&&e.preventDefault()},[U]),pointerGraceTimerRef:N,onPointerGraceIntentChange:C.useCallback(e=>{F.current=e},[]),children:(0,w.jsx)(B,{...V,children:(0,w.jsx)(ne,{asChild:!0,trapped:i,onMountAutoFocus:g(o,e=>{e.preventDefault(),k.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:(0,w.jsx)(re,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:m,onDismiss:h,children:(0,w.jsx)(f,{asChild:!0,...S,dir:b.dir,orientation:`vertical`,loop:r,currentTabStopId:D,onCurrentTabStopIdChange:O,onEntryFocus:g(l,e=>{b.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,w.jsx)(ie,{role:`menu`,"aria-orientation":`vertical`,"data-state":Te(y.open),"data-radix-menu-content":``,dir:b.dir,...x,...v,ref:A,style:{outline:`none`,...v.style},onKeyDown:g(v.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&H(e.key));let i=k.current;if(e.target!==i||!oe.includes(e.key))return;e.preventDefault();let a=T().filter(e=>!e.disabled).map(e=>e.ref.current);ae.includes(e.key)&&a.reverse(),Oe(a)}),onBlur:g(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(j.current),M.current=``)}),onPointerMove:g(e.onPointerMove,Y(e=>{let t=e.target,n=z.current!==e.clientX;if(e.currentTarget.contains(t)&&n){let t=e.clientX>z.current?`right`:`left`;L.current=t,z.current=e.clientX}}))})})})})})})},`MenuContentImpl`)),he=C.forwardRef(E(function(e,t){let{__scopeMenu:n,...r}=e;return(0,w.jsx)(c.div,{...r,ref:t})},`MenuLabel`)),q=`MenuItem`,J=`menu.itemSelect`,ge=C.forwardRef(E(function(e,t){let{disabled:n=!1,onSelect:r,...i}=e,o=C.useRef(null),s=R(q,e.__scopeMenu),c=G(q,e.__scopeMenu),l=a(t,o),u=C.useRef(!1),d=E(()=>{let e=o.current;if(!n&&e){let t=new CustomEvent(J,{bubbles:!0,cancelable:!0});e.addEventListener(J,e=>r?.(e),{once:!0}),p(e,t),t.defaultPrevented?u.current=!1:s.onClose()}},`handleSelect`);return(0,w.jsx)(_e,{...i,ref:l,disabled:n,onClick:g(e.onClick,d),onPointerDown:t=>{e.onPointerDown?.(t),u.current=!0},onPointerUp:g(e.onPointerUp,e=>{u.current||e.currentTarget?.click()}),onKeyDown:g(e.onKeyDown,e=>{n||e.target!==e.currentTarget||c.searchRef.current!==``&&e.key===` `||D.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})},`MenuItem`)),_e=C.forwardRef(E(function(e,t){let{__scopeMenu:n,disabled:r=!1,textValue:o,...s}=e,l=G(q,n),u=ce(n),d=C.useRef(null),f=a(t,d),[p,m]=C.useState(!1),[h,_]=C.useState(``);return C.useEffect(()=>{let e=d.current;e&&_((e.textContent??``).trim())},[s.children]),(0,w.jsx)(A.ItemSlot,{scope:n,disabled:r,textValue:o??h,children:(0,w.jsx)(i,{asChild:!0,...u,focusable:!r,children:(0,w.jsx)(c.div,{role:`menuitem`,"data-highlighted":p?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...s,ref:f,onPointerMove:g(e.onPointerMove,Y(e=>{r?l.onItemLeave(e):(l.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:g(e.onPointerLeave,Y(e=>l.onItemLeave(e))),onFocus:g(e.onFocus,()=>m(!0)),onBlur:g(e.onBlur,()=>m(!1))})})})},`MenuItemImpl`)),[ve,ye]=M(`MenuRadioGroup`,{value:void 0,onValueChange:E(()=>{},`onValueChange`)}),[be,xe]=M(`MenuItemIndicator`,{checked:!1}),Se=C.forwardRef(E(function(e,t){let{__scopeMenu:n,...r}=e;return(0,w.jsx)(c.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})},`MenuSeparator`)),[Ce,we]=M(`MenuSub`);function Te(e){return e?`open`:`closed`}E(Te,`getOpenState`);function Ee(e){return e===`indeterminate`}E(Ee,`isIndeterminate`);function De(e){return Ee(e)?`indeterminate`:e?`checked`:`unchecked`}E(De,`getCheckedState`);function Oe(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}E(Oe,`focusFirst`);function ke(e,t){return e.map((n,r)=>e[(t+r)%e.length])}E(ke,`wrapArray`);function Ae(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ke(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}E(Ae,`getNextMatch`);function je(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}E(je,`isPointInPolygon`);function Me(e,t){return t?je({x:e.clientX,y:e.clientY},t):!1}E(Me,`isPointerInGraceArea`);function Y(e){return t=>t.pointerType===`mouse`?e(t):void 0}E(Y,`whenMouse`);var Ne=z,Pe=B,Fe=le,Ie=de,Le=he,Re=ge,ze=Se,Be=Object.defineProperty,X=(e,t)=>Be(e,`name`,{value:t,configurable:!0}),Z=`DropdownMenu`,[Ve,He]=_(Z,[N]),Q=N(),[Ue,$]=Ve(Z),We=X(e=>{let{__scopeDropdownMenu:t,children:n,dir:i,open:a,defaultOpen:o,onOpenChange:s,modal:c=!0}=e,u=Q(t),d=C.useRef(null),[f,p]=l({prop:a,defaultProp:o??!1,onChange:s,caller:Z});return(0,w.jsx)(Ue,{scope:t,triggerId:r(),triggerRef:d,contentId:r(),open:f,onOpenChange:p,onOpenToggle:C.useCallback(()=>p(e=>!e),[p]),modal:c,children:(0,w.jsx)(Ne,{...u,open:f,onOpenChange:p,dir:i,modal:c,children:n})})},`DropdownMenu`),Ge=`DropdownMenuTrigger`,Ke=C.forwardRef(X(function(e,t){let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,o=$(Ge,n),s=Q(n),l=a(t,o.triggerRef);return(0,w.jsx)(Pe,{asChild:!0,...s,children:(0,w.jsx)(c.button,{type:`button`,id:o.triggerId,"aria-haspopup":`menu`,"aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:l,onPointerDown:g(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(o.onOpenToggle(),o.open||e.preventDefault())}),onKeyDown:g(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&o.onOpenToggle(),e.key===`ArrowDown`&&o.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})},`DropdownMenuTrigger`)),qe=X(e=>{let{__scopeDropdownMenu:t,...n}=e,r=Q(t);return(0,w.jsx)(Fe,{...r,...n})},`DropdownMenuPortal`),Je=`DropdownMenuContent`,Ye=C.forwardRef(X(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=$(Je,n),a=Q(n),o=C.useRef(!1);return(0,w.jsx)(Ie,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:g(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:g(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`DropdownMenuContent`)),Xe=C.forwardRef(X(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,w.jsx)(Le,{...i,...r,ref:t})},`DropdownMenuLabel`)),Ze=C.forwardRef(X(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,w.jsx)(Re,{...i,...r,ref:t})},`DropdownMenuItem`)),Qe=C.forwardRef(X(function(e,t){let{__scopeDropdownMenu:n,...r}=e,i=Q(n);return(0,w.jsx)(ze,{...i,...r,ref:t})},`DropdownMenuSeparator`)),$e=We,et=Ke,tt=qe,nt=Ye,rt=Xe,it=Ze,at=Qe;export{$e as a,tt as i,it as n,at as o,rt as r,et as s,nt as t};