@rubytech/create-sitedesk-code 0.1.608 → 0.1.609

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 (241) hide show
  1. package/package.json +1 -1
  2. package/payload/platform/lib/graph-write/dist/__tests__/account-id-gate.test.js +86 -0
  3. package/payload/platform/lib/graph-write/dist/__tests__/account-id-gate.test.js.map +1 -1
  4. package/payload/platform/lib/graph-write/dist/index.d.ts +30 -9
  5. package/payload/platform/lib/graph-write/dist/index.d.ts.map +1 -1
  6. package/payload/platform/lib/graph-write/dist/index.js +22 -2
  7. package/payload/platform/lib/graph-write/dist/index.js.map +1 -1
  8. package/payload/platform/lib/graph-write/src/__tests__/account-id-gate.test.ts +99 -1
  9. package/payload/platform/lib/graph-write/src/index.ts +47 -12
  10. package/payload/platform/plugins/admin/skills/platform-architecture/SKILL.md +45 -1
  11. package/payload/platform/plugins/admin/skills/whats-new/SKILL.md +8 -0
  12. package/payload/platform/plugins/docs/references/telegram-guide.md +44 -0
  13. package/payload/platform/plugins/memory/mcp/dist/index.js +65 -0
  14. package/payload/platform/plugins/memory/mcp/dist/index.js.map +1 -1
  15. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/xacct-counters.test.d.ts +2 -0
  16. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/xacct-counters.test.d.ts.map +1 -0
  17. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/xacct-counters.test.js +169 -0
  18. package/payload/platform/plugins/memory/mcp/dist/lib/__tests__/xacct-counters.test.js.map +1 -0
  19. package/payload/platform/plugins/memory/mcp/dist/lib/xacct-counters.d.ts +63 -0
  20. package/payload/platform/plugins/memory/mcp/dist/lib/xacct-counters.d.ts.map +1 -0
  21. package/payload/platform/plugins/memory/mcp/dist/lib/xacct-counters.js +114 -0
  22. package/payload/platform/plugins/memory/mcp/dist/lib/xacct-counters.js.map +1 -0
  23. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-cross-account.test.d.ts +2 -0
  24. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-cross-account.test.d.ts.map +1 -0
  25. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-cross-account.test.js +123 -0
  26. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/memory-write-cross-account.test.js.map +1 -0
  27. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/xacct-write-gate.test.d.ts +2 -0
  28. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/xacct-write-gate.test.d.ts.map +1 -0
  29. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/xacct-write-gate.test.js +110 -0
  30. package/payload/platform/plugins/memory/mcp/dist/tools/__tests__/xacct-write-gate.test.js.map +1 -0
  31. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.d.ts.map +1 -1
  32. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js +7 -0
  33. package/payload/platform/plugins/memory/mcp/dist/tools/memory-write.js.map +1 -1
  34. package/payload/platform/plugins/memory/mcp/vitest.config.ts +2 -0
  35. package/payload/platform/services/claude-session-manager/dist/claude-trust-preflight.d.ts +43 -0
  36. package/payload/platform/services/claude-session-manager/dist/claude-trust-preflight.d.ts.map +1 -0
  37. package/payload/platform/services/claude-session-manager/dist/claude-trust-preflight.js +88 -0
  38. package/payload/platform/services/claude-session-manager/dist/claude-trust-preflight.js.map +1 -0
  39. package/payload/platform/services/claude-session-manager/dist/http-server.d.ts.map +1 -1
  40. package/payload/platform/services/claude-session-manager/dist/http-server.js +125 -4
  41. package/payload/platform/services/claude-session-manager/dist/http-server.js.map +1 -1
  42. package/payload/platform/services/claude-session-manager/dist/index.js +26 -1
  43. package/payload/platform/services/claude-session-manager/dist/index.js.map +1 -1
  44. package/payload/platform/services/claude-session-manager/dist/jsonl-path.d.ts +1 -1
  45. package/payload/platform/services/claude-session-manager/dist/jsonl-path.d.ts.map +1 -1
  46. package/payload/platform/services/claude-session-manager/dist/jsonl-path.js +26 -0
  47. package/payload/platform/services/claude-session-manager/dist/jsonl-path.js.map +1 -1
  48. package/payload/platform/services/claude-session-manager/dist/recover-account.d.ts +54 -0
  49. package/payload/platform/services/claude-session-manager/dist/recover-account.d.ts.map +1 -0
  50. package/payload/platform/services/claude-session-manager/dist/recover-account.js +141 -0
  51. package/payload/platform/services/claude-session-manager/dist/recover-account.js.map +1 -0
  52. package/payload/platform/services/claude-session-manager/dist/session-account-census.d.ts +30 -0
  53. package/payload/platform/services/claude-session-manager/dist/session-account-census.d.ts.map +1 -0
  54. package/payload/platform/services/claude-session-manager/dist/session-account-census.js +96 -0
  55. package/payload/platform/services/claude-session-manager/dist/session-account-census.js.map +1 -0
  56. package/payload/platform/services/telegram-channel/dist/instructions.d.ts +9 -0
  57. package/payload/platform/services/telegram-channel/dist/instructions.d.ts.map +1 -1
  58. package/payload/platform/services/telegram-channel/dist/instructions.js +15 -0
  59. package/payload/platform/services/telegram-channel/dist/instructions.js.map +1 -1
  60. package/payload/platform/services/telegram-channel/dist/notification.d.ts +6 -4
  61. package/payload/platform/services/telegram-channel/dist/notification.d.ts.map +1 -1
  62. package/payload/platform/services/telegram-channel/dist/notification.js +15 -1
  63. package/payload/platform/services/telegram-channel/dist/notification.js.map +1 -1
  64. package/payload/server/{chunk-GI5AVCRG.js → chunk-DRDU74ZM.js} +1 -1
  65. package/payload/server/{chunk-MNN2RWJR.js → chunk-IOPUA7QV.js} +1 -1
  66. package/payload/server/{chunk-6AQYMT6C.js → chunk-T6NXRWMG.js} +43 -8
  67. package/payload/server/{manager-VDHT3YYI.js → manager-O5L2SKW7.js} +2 -2
  68. package/payload/server/maxy-edge.js +2 -2
  69. package/payload/server/public/activity.html +6 -6
  70. package/payload/server/public/agents.html +5 -5
  71. package/payload/server/public/assets/{AdminLoginScreens-DuQ3ax5U.js → AdminLoginScreens-BBKEIEjY.js} +1 -1
  72. package/payload/server/public/assets/AdminLoginScreens-BBKEIEjY.js.br +0 -0
  73. package/payload/server/public/assets/AdminLoginScreens-BBKEIEjY.js.gz +0 -0
  74. package/payload/server/public/assets/{AdminShell-1HyATV_t.js → AdminShell-CrCdEMNW.js} +1 -1
  75. package/payload/server/public/assets/AdminShell-CrCdEMNW.js.br +0 -0
  76. package/payload/server/public/assets/AdminShell-CrCdEMNW.js.gz +0 -0
  77. package/payload/server/public/assets/{activity-C2qWlcJ5.js → activity-CbR3vaq1.js} +1 -1
  78. package/payload/server/public/assets/activity-CbR3vaq1.js.br +0 -0
  79. package/payload/server/public/assets/activity-CbR3vaq1.js.gz +0 -0
  80. package/payload/server/public/assets/{admin-DqpfY8-t.js → admin-D8qKnmhE.js} +1 -1
  81. package/payload/server/public/assets/admin-D8qKnmhE.js.br +0 -0
  82. package/payload/server/public/assets/admin-D8qKnmhE.js.gz +0 -0
  83. package/payload/server/public/assets/{agents-DoGVAjIT.js → agents-8gAQjRqI.js} +1 -1
  84. package/payload/server/public/assets/agents-8gAQjRqI.js.br +0 -0
  85. package/payload/server/public/assets/agents-8gAQjRqI.js.gz +0 -0
  86. package/payload/server/public/assets/{browser-DjqS897k.js → browser-jAje5ILy.js} +1 -1
  87. package/payload/server/public/assets/browser-jAje5ILy.js.br +0 -0
  88. package/payload/server/public/assets/browser-jAje5ILy.js.gz +0 -0
  89. package/payload/server/public/assets/{calendar-DJeOm0WS.js → calendar-xEmCJif9.js} +1 -1
  90. package/payload/server/public/assets/calendar-xEmCJif9.js.br +0 -0
  91. package/payload/server/public/assets/calendar-xEmCJif9.js.gz +0 -0
  92. package/payload/server/public/assets/chat-Ct5RDmv6.js +1 -0
  93. package/payload/server/public/assets/chat-Ct5RDmv6.js.br +0 -0
  94. package/payload/server/public/assets/chat-Ct5RDmv6.js.gz +0 -0
  95. package/payload/server/public/assets/{chevron-left-D9z1aK3p.js → chevron-left-DV8gIVC9.js} +1 -1
  96. package/payload/server/public/assets/chevron-left-DV8gIVC9.js.br +0 -0
  97. package/payload/server/public/assets/clock-PnR4Tlg9.js +1 -0
  98. package/payload/server/public/assets/clock-PnR4Tlg9.js.br +0 -0
  99. package/payload/server/public/assets/{copy-p9ZM9fnn.js → copy-b6MpzRz9.js} +1 -1
  100. package/payload/server/public/assets/copy-b6MpzRz9.js.br +0 -0
  101. package/payload/server/public/assets/copy-b6MpzRz9.js.gz +0 -0
  102. package/payload/server/public/assets/data-BxFc9wPl.js +1 -0
  103. package/payload/server/public/assets/data-BxFc9wPl.js.br +2 -0
  104. package/payload/server/public/assets/data-BxFc9wPl.js.gz +0 -0
  105. package/payload/server/public/assets/{field-WRk67lvr.js → field-CiIsn-47.js} +1 -1
  106. package/payload/server/public/assets/field-CiIsn-47.js.br +0 -0
  107. package/payload/server/public/assets/field-CiIsn-47.js.gz +0 -0
  108. package/payload/server/public/assets/{file-text-BJDCb334.js → file-text-Cy-IjCf8.js} +1 -1
  109. package/payload/server/public/assets/file-text-Cy-IjCf8.js.br +0 -0
  110. package/payload/server/public/assets/file-text-Cy-IjCf8.js.gz +0 -0
  111. package/payload/server/public/assets/{graph-CAU2xh2Z.js → graph-BdC2IGOT.js} +1 -1
  112. package/payload/server/public/assets/graph-BdC2IGOT.js.br +0 -0
  113. package/payload/server/public/assets/graph-BdC2IGOT.js.gz +0 -0
  114. package/payload/server/public/assets/{graph-labels-CEDmX7qW.js → graph-labels-3bstML8n.js} +1 -1
  115. package/payload/server/public/assets/graph-labels-3bstML8n.js.br +0 -0
  116. package/payload/server/public/assets/graph-labels-3bstML8n.js.gz +0 -0
  117. package/payload/server/public/assets/{jsx-runtime-hPFGo4rC.css → jsx-runtime-JxxB_2S6.css} +1 -1
  118. package/payload/server/public/assets/jsx-runtime-JxxB_2S6.css.br +0 -0
  119. package/payload/server/public/assets/{jsx-runtime-hPFGo4rC.css.gz → jsx-runtime-JxxB_2S6.css.gz} +0 -0
  120. package/payload/server/public/assets/{operator-1WFztEQA.js → operator-D7L2SA16.js} +1 -1
  121. package/payload/server/public/assets/operator-D7L2SA16.js.br +0 -0
  122. package/payload/server/public/assets/operator-D7L2SA16.js.gz +0 -0
  123. package/payload/server/public/assets/{page-B72XigcU.js → page-DspGbDgK.js} +1 -1
  124. package/payload/server/public/assets/page-DspGbDgK.js.br +0 -0
  125. package/payload/server/public/assets/page-DspGbDgK.js.gz +0 -0
  126. package/payload/server/public/assets/{page-nT8l_cX1.js → page-ObXxk8ol.js} +1 -1
  127. package/payload/server/public/assets/page-ObXxk8ol.js.br +0 -0
  128. package/payload/server/public/assets/page-ObXxk8ol.js.gz +0 -0
  129. package/payload/server/public/assets/play-BL4ztD3m.js +1 -0
  130. package/payload/server/public/assets/play-BL4ztD3m.js.br +0 -0
  131. package/payload/server/public/assets/play-BL4ztD3m.js.gz +0 -0
  132. package/payload/server/public/assets/{public-DAea6w7w.js → public-CEXKl8wg.js} +1 -1
  133. package/payload/server/public/assets/public-CEXKl8wg.js.br +0 -0
  134. package/payload/server/public/assets/public-CEXKl8wg.js.gz +0 -0
  135. package/payload/server/public/assets/{rotate-ccw-CqlRlGsY.js → rotate-ccw-ckXDebK2.js} +1 -1
  136. package/payload/server/public/assets/rotate-ccw-ckXDebK2.js.br +0 -0
  137. package/payload/server/public/assets/rotate-ccw-ckXDebK2.js.gz +0 -0
  138. package/payload/server/public/assets/{routines-vy5xsyqx.js → routines-Dwc2meN2.js} +1 -1
  139. package/payload/server/public/assets/routines-Dwc2meN2.js.br +0 -0
  140. package/payload/server/public/assets/routines-Dwc2meN2.js.gz +0 -0
  141. package/payload/server/public/assets/{skills-X7FTilVy.js → skills-DdHKHl4Z.js} +1 -1
  142. package/payload/server/public/assets/skills-DdHKHl4Z.js.br +0 -0
  143. package/payload/server/public/assets/skills-DdHKHl4Z.js.gz +0 -0
  144. package/payload/server/public/assets/{tasks-BXx_jk_p.js → tasks-C_yWRvOG.js} +1 -1
  145. package/payload/server/public/assets/tasks-C_yWRvOG.js.br +0 -0
  146. package/payload/server/public/assets/tasks-C_yWRvOG.js.gz +0 -0
  147. package/payload/server/public/assets/{triangle-alert-CuWcGaRo.js → triangle-alert-C-7A00P0.js} +1 -1
  148. package/payload/server/public/assets/triangle-alert-C-7A00P0.js.br +0 -0
  149. package/payload/server/public/assets/triangle-alert-C-7A00P0.js.gz +0 -0
  150. package/payload/server/public/assets/{useCopyFeedback-DLSKs6r2.js → useCopyFeedback-CWvSi-Qe.js} +1 -1
  151. package/payload/server/public/assets/useCopyFeedback-CWvSi-Qe.js.br +2 -0
  152. package/payload/server/public/assets/useCopyFeedback-CWvSi-Qe.js.gz +0 -0
  153. package/payload/server/public/assets/{useMediaQuery-C_1CV_iW.js → useMediaQuery-CLVRXJMp.js} +1 -1
  154. package/payload/server/public/assets/useMediaQuery-CLVRXJMp.js.br +0 -0
  155. package/payload/server/public/assets/useMediaQuery-CLVRXJMp.js.gz +0 -0
  156. package/payload/server/public/assets/{useVoiceRecorder-DBzM_HIx.js → useVoiceRecorder-BbJad9CQ.js} +1 -1
  157. package/payload/server/public/assets/useVoiceRecorder-BbJad9CQ.js.br +0 -0
  158. package/payload/server/public/assets/useVoiceRecorder-BbJad9CQ.js.gz +0 -0
  159. package/payload/server/public/assets/{wrench-nDMQ6x-6.js → wrench-Cl6TUm2T.js} +1 -1
  160. package/payload/server/public/assets/wrench-Cl6TUm2T.js.br +0 -0
  161. package/payload/server/public/assets/wrench-Cl6TUm2T.js.gz +0 -0
  162. package/payload/server/public/browser.html +5 -5
  163. package/payload/server/public/calendar.html +8 -8
  164. package/payload/server/public/chat.html +14 -14
  165. package/payload/server/public/data.html +12 -12
  166. package/payload/server/public/field.html +3 -3
  167. package/payload/server/public/graph.html +10 -10
  168. package/payload/server/public/index.html +14 -14
  169. package/payload/server/public/operator.html +16 -16
  170. package/payload/server/public/public.html +14 -14
  171. package/payload/server/public/routines.html +8 -8
  172. package/payload/server/public/skills.html +6 -6
  173. package/payload/server/public/tasks.html +7 -7
  174. package/payload/server/server.js +511 -283
  175. package/payload/server/public/assets/AdminLoginScreens-DuQ3ax5U.js.br +0 -0
  176. package/payload/server/public/assets/AdminLoginScreens-DuQ3ax5U.js.gz +0 -0
  177. package/payload/server/public/assets/AdminShell-1HyATV_t.js.br +0 -0
  178. package/payload/server/public/assets/AdminShell-1HyATV_t.js.gz +0 -0
  179. package/payload/server/public/assets/activity-C2qWlcJ5.js.br +0 -0
  180. package/payload/server/public/assets/activity-C2qWlcJ5.js.gz +0 -0
  181. package/payload/server/public/assets/admin-DqpfY8-t.js.br +0 -0
  182. package/payload/server/public/assets/admin-DqpfY8-t.js.gz +0 -0
  183. package/payload/server/public/assets/agents-DoGVAjIT.js.br +0 -0
  184. package/payload/server/public/assets/agents-DoGVAjIT.js.gz +0 -0
  185. package/payload/server/public/assets/browser-DjqS897k.js.br +0 -0
  186. package/payload/server/public/assets/browser-DjqS897k.js.gz +0 -0
  187. package/payload/server/public/assets/calendar-DJeOm0WS.js.br +0 -0
  188. package/payload/server/public/assets/calendar-DJeOm0WS.js.gz +0 -0
  189. package/payload/server/public/assets/chat-BrRE0Dck.js +0 -1
  190. package/payload/server/public/assets/chat-BrRE0Dck.js.br +0 -0
  191. package/payload/server/public/assets/chat-BrRE0Dck.js.gz +0 -0
  192. package/payload/server/public/assets/chevron-left-D9z1aK3p.js.br +0 -0
  193. package/payload/server/public/assets/clock-BqHWMICF.js +0 -1
  194. package/payload/server/public/assets/clock-BqHWMICF.js.br +0 -0
  195. package/payload/server/public/assets/clock-BqHWMICF.js.gz +0 -0
  196. package/payload/server/public/assets/copy-p9ZM9fnn.js.br +0 -0
  197. package/payload/server/public/assets/copy-p9ZM9fnn.js.gz +0 -0
  198. package/payload/server/public/assets/data-CPsqW0qW.js +0 -1
  199. package/payload/server/public/assets/data-CPsqW0qW.js.br +0 -0
  200. package/payload/server/public/assets/data-CPsqW0qW.js.gz +0 -0
  201. package/payload/server/public/assets/field-WRk67lvr.js.br +0 -0
  202. package/payload/server/public/assets/field-WRk67lvr.js.gz +0 -0
  203. package/payload/server/public/assets/file-text-BJDCb334.js.br +0 -0
  204. package/payload/server/public/assets/file-text-BJDCb334.js.gz +0 -0
  205. package/payload/server/public/assets/graph-CAU2xh2Z.js.br +0 -0
  206. package/payload/server/public/assets/graph-CAU2xh2Z.js.gz +0 -0
  207. package/payload/server/public/assets/graph-labels-CEDmX7qW.js.br +0 -0
  208. package/payload/server/public/assets/graph-labels-CEDmX7qW.js.gz +0 -0
  209. package/payload/server/public/assets/jsx-runtime-hPFGo4rC.css.br +0 -0
  210. package/payload/server/public/assets/operator-1WFztEQA.js.br +0 -0
  211. package/payload/server/public/assets/operator-1WFztEQA.js.gz +0 -0
  212. package/payload/server/public/assets/page-B72XigcU.js.br +0 -0
  213. package/payload/server/public/assets/page-B72XigcU.js.gz +0 -0
  214. package/payload/server/public/assets/page-nT8l_cX1.js.br +0 -0
  215. package/payload/server/public/assets/page-nT8l_cX1.js.gz +0 -0
  216. package/payload/server/public/assets/play-CYqOCqm6.js +0 -1
  217. package/payload/server/public/assets/play-CYqOCqm6.js.br +0 -0
  218. package/payload/server/public/assets/play-CYqOCqm6.js.gz +0 -0
  219. package/payload/server/public/assets/public-DAea6w7w.js.br +0 -0
  220. package/payload/server/public/assets/public-DAea6w7w.js.gz +0 -0
  221. package/payload/server/public/assets/rotate-ccw-CqlRlGsY.js.br +0 -0
  222. package/payload/server/public/assets/rotate-ccw-CqlRlGsY.js.gz +0 -0
  223. package/payload/server/public/assets/routines-vy5xsyqx.js.br +0 -0
  224. package/payload/server/public/assets/routines-vy5xsyqx.js.gz +0 -0
  225. package/payload/server/public/assets/skills-X7FTilVy.js.br +0 -0
  226. package/payload/server/public/assets/skills-X7FTilVy.js.gz +0 -0
  227. package/payload/server/public/assets/tasks-BXx_jk_p.js.br +0 -0
  228. package/payload/server/public/assets/tasks-BXx_jk_p.js.gz +0 -0
  229. package/payload/server/public/assets/triangle-alert-CuWcGaRo.js.br +0 -0
  230. package/payload/server/public/assets/triangle-alert-CuWcGaRo.js.gz +0 -0
  231. package/payload/server/public/assets/useCopyFeedback-DLSKs6r2.js.br +0 -0
  232. package/payload/server/public/assets/useCopyFeedback-DLSKs6r2.js.gz +0 -0
  233. package/payload/server/public/assets/useMediaQuery-C_1CV_iW.js.br +0 -0
  234. package/payload/server/public/assets/useMediaQuery-C_1CV_iW.js.gz +0 -0
  235. package/payload/server/public/assets/useVoiceRecorder-DBzM_HIx.js.br +0 -0
  236. package/payload/server/public/assets/useVoiceRecorder-DBzM_HIx.js.gz +0 -0
  237. package/payload/server/public/assets/wrench-nDMQ6x-6.js.br +0 -0
  238. package/payload/server/public/assets/wrench-nDMQ6x-6.js.gz +0 -0
  239. /package/payload/server/public/assets/{jsx-runtime-CvVXOszc.js → jsx-runtime-BCAZhYqz.js} +0 -0
  240. /package/payload/server/public/assets/{jsx-runtime-CvVXOszc.js.br → jsx-runtime-BCAZhYqz.js.br} +0 -0
  241. /package/payload/server/public/assets/{jsx-runtime-CvVXOszc.js.gz → jsx-runtime-BCAZhYqz.js.gz} +0 -0
@@ -1 +1 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-CvVXOszc.js";import"./useMediaQuery-C_1CV_iW.js";import{n as i,t as a}from"./AdminLoginScreens-DuQ3ax5U.js";import"./useVoiceRecorder-DBzM_HIx.js";import"./AdminShell-1HyATV_t.js";import{t as o}from"./page-B72XigcU.js";import"./useCopyFeedback-DLSKs6r2.js";var s=n(),c=e(t(),1),l=r();function u(){let e=i(`operator`),t=(0,c.useRef)(null);return(0,c.useEffect)(()=>{e.appState!==`chat`&&t.current!==e.appState&&(t.current=e.appState)},[e.appState]),e.appState===`chat`?(0,l.jsx)(o,{variant:`operator`,forceCanonicalSession:window.location.pathname!==`/chat`}):(0,l.jsx)(a,{auth:e})}(0,s.createRoot)(document.getElementById(`root`)).render((0,l.jsx)(u,{}));
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-BCAZhYqz.js";import"./useMediaQuery-CLVRXJMp.js";import{n as i,t as a}from"./AdminLoginScreens-BBKEIEjY.js";import"./useVoiceRecorder-BbJad9CQ.js";import"./AdminShell-CrCdEMNW.js";import{t as o}from"./page-DspGbDgK.js";import"./useCopyFeedback-CWvSi-Qe.js";var s=n(),c=e(t(),1),l=r();function u(){let e=i(`operator`),t=(0,c.useRef)(null);return(0,c.useEffect)(()=>{e.appState!==`chat`&&t.current!==e.appState&&(t.current=e.appState)},[e.appState]),e.appState===`chat`?(0,l.jsx)(o,{variant:`operator`,forceCanonicalSession:window.location.pathname!==`/chat`}):(0,l.jsx)(a,{auth:e})}(0,s.createRoot)(document.getElementById(`root`)).render((0,l.jsx)(u,{}));
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-DA-Gezeo.js","assets/preload-helper-eAV8hweq.js","assets/dist-DjYA4E4S.js","assets/chunk-BycB0eMI.js","assets/chunk-U2HBQHQK-DcqGPXEy.js","assets/src-BvINb2fL.js","assets/chunk-5PVQY5BW-C0bRnMKQ.js","assets/chunk-ICPOFSXX-BP8A8zb1.js","assets/_baseFor-BApe6Tla.js","assets/isEmpty-DY_Xp9Na.js","assets/chunk-336JU56O-ChGDYu_S.js","assets/chunk-5FUZZQ4R-B3s1YuQa.js","assets/chunk-X2U36JSP-DtRi7n5Z.js","assets/chunk-ZZ45TVLE-teET41Yh.js","assets/rough.esm-ec8xsRC7.js","assets/chunk-ENJZ2VHE-BdPfdZYB.js","assets/line-K8229GLG.js","assets/path-DY2qBuPM.js","assets/array-eiH4WfvY.js","assets/chunk-BSJP7CBP-0xBlnKJN.js","assets/chunk-426QAEUC-DLLi1nAr.js","assets/chunk-XPW4576I-DmuDCcY3.js"])))=>i.map(i=>d[i]);
2
- import{o as e,r as t,t as n}from"./chunk-BycB0eMI.js";import{i as r,t as i}from"./jsx-runtime-CvVXOszc.js";import{C as a,F as o,H as s,I as c,K as l,L as u,N as d,P as f,Q as p,R as m,S as h,V as g,a as _,it as v,nt as y,st as b,u as x,w as S}from"./useMediaQuery-C_1CV_iW.js";import{A as C,D as w,E as T,O as E,S as D,T as O,_ as k,a as ee,b as te,c as ne,d as A,f as re,g as ie,h as ae,i as oe,j as se,k as ce,l as le,m as j,n as ue,o as de,r as fe,s as pe,t as me,u as he,v as ge,w as _e,x as ve,y as ye}from"./useVoiceRecorder-DBzM_HIx.js";import{A as be,D as xe,E as Se,O as M,S as Ce,T as we,b as Te,c as Ee,d as De,l as Oe,n as ke,o as Ae,r as je,s as Me,t as Ne,u as Pe,w as Fe,y as Ie}from"./AdminShell-1HyATV_t.js";import{t as Le}from"./chevron-left-D9z1aK3p.js";import{t as Re}from"./copy-p9ZM9fnn.js";import{t as ze}from"./file-text-BJDCb334.js";import{t as Be}from"./play-CYqOCqm6.js";import{t as Ve}from"./rotate-ccw-CqlRlGsY.js";import{t as He}from"./wrench-nDMQ6x-6.js";import{t as Ue}from"./preload-helper-eAV8hweq.js";import{t as We}from"./useCopyFeedback-DLSKs6r2.js";var Ge=y(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ke=y(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),qe=y(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Je=y(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),Ye=y(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Xe=y(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ze=y(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]);function Qe(e,t,n){if(t!==n)return null;let r=t,i=e.lastIndexOf(`
2
+ import{o as e,r as t,t as n}from"./chunk-BycB0eMI.js";import{i as r,t as i}from"./jsx-runtime-BCAZhYqz.js";import{C as a,F as o,H as s,I as c,K as l,L as u,N as d,P as f,Q as p,R as m,S as h,V as g,a as _,it as v,nt as y,st as b,u as x,w as S}from"./useMediaQuery-CLVRXJMp.js";import{A as C,D as w,E as T,O as E,S as D,T as O,_ as k,a as ee,b as te,c as ne,d as A,f as re,g as ie,h as ae,i as oe,j as se,k as ce,l as le,m as j,n as ue,o as de,r as fe,s as pe,t as me,u as he,v as ge,w as _e,x as ve,y as ye}from"./useVoiceRecorder-BbJad9CQ.js";import{A as be,D as xe,E as Se,O as M,S as Ce,T as we,b as Te,c as Ee,d as De,l as Oe,n as ke,o as Ae,r as je,s as Me,t as Ne,u as Pe,w as Fe,y as Ie}from"./AdminShell-CrCdEMNW.js";import{t as Le}from"./chevron-left-DV8gIVC9.js";import{t as Re}from"./copy-b6MpzRz9.js";import{t as ze}from"./file-text-Cy-IjCf8.js";import{t as Be}from"./play-BL4ztD3m.js";import{t as Ve}from"./rotate-ccw-ckXDebK2.js";import{t as He}from"./wrench-Cl6TUm2T.js";import{t as Ue}from"./preload-helper-eAV8hweq.js";import{t as We}from"./useCopyFeedback-CWvSi-Qe.js";var Ge=y(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Ke=y(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),qe=y(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),Je=y(`graduation-cap`,[[`path`,{d:`M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z`,key:`j76jl0`}],[`path`,{d:`M22 10v6`,key:`1lu8f3`}],[`path`,{d:`M6 12.5V16a6 3 0 0 0 12 0v-3.5`,key:`1r8lef`}]]),Ye=y(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),Xe=y(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ze=y(`shield`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}]]);function Qe(e,t,n){if(t!==n)return null;let r=t,i=e.lastIndexOf(`
3
3
  `,r-1)+1,a=e.indexOf(`
4
4
  `,r),o=a===-1?e.length:a;if(r!==o)return null;let s=e.slice(i,o),c=s.match(/^(\s*)(\d+)\.[ \t]*$/);if(c){let t=c[1];return{value:e.slice(0,i)+t+e.slice(o),caret:i+t.length}}let l=s.match(/^(\s*)(\d+)\.[ \t]/);if(l){let t=`\n${l[1]}${parseInt(l[2],10)+1}. `;return{value:e.slice(0,r)+t+e.slice(r),caret:r+t.length}}return null}function $e(e,t){let n=[];for(let r of e){if(r.kind!==`file`)continue;let e=r.getAsFile();if(e)if(e.name===``||e.name===`image.png`){let r=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`;n.push(new File([e],`pasted-image-${t}.${r}`,{type:e.type}))}else n.push(e)}return n}function et(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}var tt=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,N=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nt={};function rt(e,t){return((t||nt).jsx?N:tt).test(e)}var it=/[ \t\n\f\r]/g;function P(e){return typeof e==`object`?e.type===`text`?at(e.value):!1:at(e)}function at(e){return e.replace(it,``)===``}var ot=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};ot.prototype.normal={},ot.prototype.property={},ot.prototype.space=void 0;function st(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ot(n,r,t)}function ct(e){return e.toLowerCase()}var F=class{constructor(e,t){this.attribute=t,this.property=e}};F.prototype.attribute=``,F.prototype.booleanish=!1,F.prototype.boolean=!1,F.prototype.commaOrSpaceSeparated=!1,F.prototype.commaSeparated=!1,F.prototype.defined=!1,F.prototype.mustUseProperty=!1,F.prototype.number=!1,F.prototype.overloadedBoolean=!1,F.prototype.property=``,F.prototype.spaceSeparated=!1,F.prototype.space=void 0;var lt=t({boolean:()=>I,booleanish:()=>L,commaOrSpaceSeparated:()=>V,commaSeparated:()=>B,number:()=>R,overloadedBoolean:()=>dt,spaceSeparated:()=>z}),ut=0,I=ft(),L=ft(),dt=ft(),R=ft(),z=ft(),B=ft(),V=ft();function ft(){return 2**++ut}var pt=Object.keys(lt),mt=class extends F{constructor(e,t,n,r){let i=-1;if(super(e,t),ht(this,`space`,r),typeof n==`number`)for(;++i<pt.length;){let e=pt[i];ht(this,pt[i],(n&lt[e])===lt[e])}}};mt.prototype.defined=!0;function ht(e,t,n){n&&(e[t]=n)}function gt(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new mt(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[ct(r)]=r,n[ct(a.attribute)]=r}return new ot(t,n,e.space)}var _t=gt({properties:{ariaActiveDescendant:null,ariaAtomic:L,ariaAutoComplete:null,ariaBusy:L,ariaChecked:L,ariaColCount:R,ariaColIndex:R,ariaColSpan:R,ariaControls:z,ariaCurrent:null,ariaDescribedBy:z,ariaDetails:null,ariaDisabled:L,ariaDropEffect:z,ariaErrorMessage:null,ariaExpanded:L,ariaFlowTo:z,ariaGrabbed:L,ariaHasPopup:null,ariaHidden:L,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:z,ariaLevel:R,ariaLive:null,ariaModal:L,ariaMultiLine:L,ariaMultiSelectable:L,ariaOrientation:null,ariaOwns:z,ariaPlaceholder:null,ariaPosInSet:R,ariaPressed:L,ariaReadOnly:L,ariaRelevant:null,ariaRequired:L,ariaRoleDescription:z,ariaRowCount:R,ariaRowIndex:R,ariaRowSpan:R,ariaSelected:L,ariaSetSize:R,ariaSort:null,ariaValueMax:R,ariaValueMin:R,ariaValueNow:R,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function vt(e,t){return t in e?e[t]:t}function yt(e,t){return vt(e,t.toLowerCase())}var bt=gt({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:B,acceptCharset:z,accessKey:z,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:z,autoFocus:I,autoPlay:I,blocking:z,capture:null,charSet:null,checked:I,cite:null,className:z,cols:R,colSpan:null,content:null,contentEditable:L,controls:I,controlsList:z,coords:R|B,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:dt,draggable:L,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:z,height:R,hidden:dt,high:R,href:null,hrefLang:null,htmlFor:z,httpEquiv:z,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:z,itemRef:z,itemScope:I,itemType:z,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:R,manifest:null,max:null,maxLength:R,media:null,method:null,min:null,minLength:R,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:I,optimum:R,pattern:null,ping:z,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:z,required:I,reversed:I,rows:R,rowSpan:R,sandbox:z,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shape:null,size:R,sizes:null,slot:null,span:R,spellCheck:L,src:null,srcDoc:null,srcLang:null,srcSet:null,start:R,step:null,style:null,tabIndex:R,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:L,width:R,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:z,axis:null,background:null,bgColor:null,border:R,borderColor:null,bottomMargin:R,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:R,leftMargin:R,link:null,longDesc:null,lowSrc:null,marginHeight:R,marginWidth:R,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:R,rules:null,scheme:null,scrolling:L,standby:null,summary:null,text:null,topMargin:R,valueType:null,version:null,vAlign:null,vLink:null,vSpace:R,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:I,disableRemotePlayback:I,prefix:null,property:null,results:R,security:null,unselectable:null},space:`html`,transform:yt}),xt=gt({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:V,accentHeight:R,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:R,amplitude:R,arabicForm:null,ascent:R,attributeName:null,attributeType:null,azimuth:R,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:R,by:null,calcMode:null,capHeight:R,className:z,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:R,diffuseConstant:R,direction:null,display:null,dur:null,divisor:R,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:R,enableBackground:null,end:null,event:null,exponent:R,externalResourcesRequired:null,fill:null,fillOpacity:R,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:B,g2:B,glyphName:B,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:R,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:R,horizOriginX:R,horizOriginY:R,id:null,ideographic:R,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:R,k:R,k1:R,k2:R,k3:R,k4:R,kernelMatrix:V,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:R,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:R,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:R,overlineThickness:R,paintOrder:null,panose1:null,path:null,pathLength:R,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:z,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:R,pointsAtY:R,pointsAtZ:R,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:V,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:V,rev:V,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:V,requiredFeatures:V,requiredFonts:V,requiredFormats:V,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:R,specularExponent:R,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:R,strikethroughThickness:R,string:null,stroke:null,strokeDashArray:V,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:R,strokeOpacity:R,strokeWidth:null,style:null,surfaceScale:R,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:V,tabIndex:R,tableValues:null,target:null,targetX:R,targetY:R,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:V,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:R,underlineThickness:R,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:R,values:null,vAlphabetic:R,vMathematical:R,vectorEffect:null,vHanging:R,vIdeographic:R,version:null,vertAdvY:R,vertOriginX:R,vertOriginY:R,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:R,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:vt}),St=gt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Ct=gt({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:yt}),wt=gt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Tt={classId:`classID`,dataType:`datatype`,itemId:`itemID`,strokeDashArray:`strokeDasharray`,strokeDashOffset:`strokeDashoffset`,strokeLineCap:`strokeLinecap`,strokeLineJoin:`strokeLinejoin`,strokeMiterLimit:`strokeMiterlimit`,typeOf:`typeof`,xLinkActuate:`xlinkActuate`,xLinkArcRole:`xlinkArcrole`,xLinkHref:`xlinkHref`,xLinkRole:`xlinkRole`,xLinkShow:`xlinkShow`,xLinkTitle:`xlinkTitle`,xLinkType:`xlinkType`,xmlnsXLink:`xmlnsXlink`},Et=/[A-Z]/g,Dt=/-[a-z]/g,Ot=/^data[-\w.:]+$/i;function kt(e,t){let n=ct(t),r=t,i=F;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Ot.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Dt,jt);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Dt.test(e)){let n=e.replace(Et,At);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=mt}return new i(r,t)}function At(e){return`-`+e.toLowerCase()}function jt(e){return e.charAt(1).toUpperCase()}var Mt=st([_t,bt,St,Ct,wt],`html`),Nt=st([_t,xt,St,Ct,wt],`svg`);function Pt(e){return e.join(` `).trim()}var Ft=n(((e,t)=>{var n=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,r=/\n/g,i=/^\s*/,a=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,s=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g,u=`
5
5
  `,d=`/`,f=`*`,p=``,m=`comment`,h=`declaration`;function g(e,t){if(typeof e!=`string`)throw TypeError(`First argument must be a string`);if(!e)return[];t||={};var l=1,g=1;function v(e){var t=e.match(r);t&&(l+=t.length);var n=e.lastIndexOf(u);g=~n?e.length-n:g+e.length}function y(){var e={line:l,column:g};return function(t){return t.position=new b(e),C(),t}}function b(e){this.start=e,this.end={line:l,column:g},this.source=t.source}b.prototype.content=e;function x(n){var r=Error(t.source+`:`+l+`:`+g+`: `+n);if(r.reason=n,r.filename=t.source,r.line=l,r.column=g,r.source=e,!t.silent)throw r}function S(t){var n=t.exec(e);if(n){var r=n[0];return v(r),e=e.slice(r.length),n}}function C(){S(i)}function w(e){var t;for(e||=[];t=T();)t!==!1&&e.push(t);return e}function T(){var t=y();if(!(d!=e.charAt(0)||f!=e.charAt(1))){for(var n=2;p!=e.charAt(n)&&(f!=e.charAt(n)||d!=e.charAt(n+1));)++n;if(n+=2,p===e.charAt(n-1))return x(`End of comment missing`);var r=e.slice(2,n-2);return g+=2,v(r),e=e.slice(n),g+=2,t({type:m,comment:r})}}function E(){var e=y(),t=S(a);if(t){if(T(),!S(o))return x(`property missing ':'`);var r=S(s),i=e({type:h,property:_(t[0].replace(n,p)),value:r?_(r[0].replace(n,p)):p});return S(c),i}}function D(){var e=[];w(e);for(var t;t=E();)t!==!1&&(e.push(t),w(e));return e}return C(),D()}function _(e){return e?e.replace(l,p):p}t.exports=g})),H=n((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.default=r;var n=t(Ft());function r(e,t){let r=null;if(!e||typeof e!=`string`)return r;let i=(0,n.default)(e),a=typeof t==`function`;return i.forEach(e=>{if(e.type!==`declaration`)return;let{property:n,value:i}=e;a?t(n,i,e):i&&(r||={},r[n]=i)}),r}})),It=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,n=/-([a-z])/g,r=/^[^-]+$/,i=/^-(webkit|moz|ms|o|khtml)-/,a=/^-(ms)-/,o=function(e){return!e||r.test(e)||t.test(e)},s=function(e,t){return t.toUpperCase()},c=function(e,t){return`${t}-`};e.camelCase=function(e,t){return t===void 0&&(t={}),o(e)?e:(e=e.toLowerCase(),e=t.reactCompat?e.replace(a,c):e.replace(i,c),e.replace(n,s))}})),Lt=n(((e,t)=>{var n=(e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}})(H()),r=It();function i(e,t){var i={};return!e||typeof e!=`string`||(0,n.default)(e,function(e,n){e&&n&&(i[(0,r.camelCase)(e,t)]=n)}),i}i.default=i,t.exports=i})),Rt=Bt(`end`),zt=Bt(`start`);function Bt(e){return t;function t(t){let n=t&&t.position&&t.position[e]||{};if(typeof n.line==`number`&&n.line>0&&typeof n.column==`number`&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset==`number`&&n.offset>-1?n.offset:void 0}}}function Vt(e){let t=zt(e),n=Rt(e);if(t&&n)return{start:t,end:n}}function Ht(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Wt(e.position):`start`in e||`end`in e?Wt(e):`line`in e||`column`in e?Ut(e):``}function Ut(e){return Gt(e&&e.line)+`:`+Gt(e&&e.column)}function Wt(e){return Ut(e&&e.start)+`-`+Ut(e&&e.end)}function Gt(e){return e&&typeof e==`number`?e:1}var U=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Ht(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};U.prototype.file=``,U.prototype.name=``,U.prototype.reason=``,U.prototype.message=``,U.prototype.stack=``,U.prototype.column=void 0,U.prototype.line=void 0,U.prototype.ancestors=void 0,U.prototype.cause=void 0,U.prototype.fatal=void 0,U.prototype.place=void 0,U.prototype.ruleId=void 0,U.prototype.source=void 0;var Kt=e(Lt(),1),qt={}.hasOwnProperty,Jt=new Map,Yt=/[A-Z]/g,Xt=new Set([`table`,`tbody`,`thead`,`tfoot`,`tr`]),Zt=new Set([`td`,`th`]),Qt=`https://github.com/syntax-tree/hast-util-to-jsx-runtime`;function $t(e,t){if(!t||t.Fragment===void 0)throw TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!=`function`)throw TypeError("Expected `jsxDEV` in options when `development: true`");r=dn(n,t.jsxDEV)}else{if(typeof t.jsx!=`function`)throw TypeError("Expected `jsx` in production options");if(typeof t.jsxs!=`function`)throw TypeError("Expected `jsxs` in production options");r=un(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||`react`,evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space===`svg`?Nt:Mt,stylePropertyNameCase:t.stylePropertyNameCase||`dom`,tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=en(i,e,void 0);return a&&typeof a!=`string`?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function en(e,t,n){if(t.type===`element`)return tn(e,t,n);if(t.type===`mdxFlowExpression`||t.type===`mdxTextExpression`)return nn(e,t);if(t.type===`mdxJsxFlowElement`||t.type===`mdxJsxTextElement`)return an(e,t,n);if(t.type===`mdxjsEsm`)return rn(e,t);if(t.type===`root`)return on(e,t,n);if(t.type===`text`)return sn(e,t)}function tn(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()===`svg`&&r.space===`html`&&(i=Nt,e.schema=i),e.ancestors.push(t);let a=_n(e,t.tagName,!1),o=fn(e,t),s=mn(e,t);return Xt.has(t.tagName)&&(s=s.filter(function(e){return typeof e==`string`?!P(e):!0})),cn(e,o,a,t),ln(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function nn(e,t){if(t.data&&t.data.estree&&e.evaluater){let n=t.data.estree.body[0];return n.type,e.evaluater.evaluateExpression(n.expression)}vn(e,t.position)}function rn(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);vn(e,t.position)}function an(e,t,n){let r=e.schema,i=r;t.name===`svg`&&r.space===`html`&&(i=Nt,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:_n(e,t.name,!0),o=pn(e,t),s=mn(e,t);return cn(e,o,a,t),ln(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function on(e,t,n){let r={};return ln(r,mn(e,t)),e.create(t,e.Fragment,r,n)}function sn(e,t){return t.value}function cn(e,t,n,r){typeof n!=`string`&&n!==e.Fragment&&e.passNode&&(t.node=r)}function ln(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function un(e,t,n){return r;function r(e,r,i,a){let o=Array.isArray(i.children)?n:t;return a?o(r,i,a):o(r,i)}}function dn(e,t){return n;function n(n,r,i,a){let o=Array.isArray(i.children),s=zt(n);return t(r,i,a,o,{columnNumber:s?s.column-1:void 0,fileName:e,lineNumber:s?s.line:void 0},void 0)}}function fn(e,t){let n={},r,i;for(i in t.properties)if(i!==`children`&&qt.call(t.properties,i)){let a=hn(e,i,t.properties[i]);if(a){let[i,o]=a;e.tableCellAlignToStyle&&i===`align`&&typeof o==`string`&&Zt.has(t.tagName)?r=o:n[i]=o}}if(r){let t=n.style||={};t[e.stylePropertyNameCase===`css`?`text-align`:`textAlign`]=r}return n}function pn(e,t){let n={};for(let r of t.attributes)if(r.type===`mdxJsxExpressionAttribute`)if(r.data&&r.data.estree&&e.evaluater){let t=r.data.estree.body[0];t.type;let i=t.expression;i.type;let a=i.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else vn(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value==`object`)if(r.value.data&&r.value.data.estree&&e.evaluater){let t=r.value.data.estree.body[0];t.type,a=e.evaluater.evaluateExpression(t.expression)}else vn(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function mn(e,t){let n=[],r=-1,i=e.passKeys?new Map:Jt;for(;++r<t.children.length;){let a=t.children[r],o;if(e.passKeys){let e=a.type===`element`?a.tagName:a.type===`mdxJsxFlowElement`||a.type===`mdxJsxTextElement`?a.name:void 0;if(e){let t=i.get(e)||0;o=e+`-`+t,i.set(e,t+1)}}let s=en(e,a,o);s!==void 0&&n.push(s)}return n}function hn(e,t,n){let r=kt(e.schema,t);if(!(n==null||typeof n==`number`&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?et(n):Pt(n)),r.property===`style`){let t=typeof n==`object`?n:gn(e,String(n));return e.stylePropertyNameCase===`css`&&(t=yn(t)),[`style`,t]}return[e.elementAttributeNameCase===`react`&&r.space?Tt[r.property]||r.property:r.attribute,n]}}function gn(e,t){try{return(0,Kt.default)(t,{reactCompat:!0})}catch(t){if(e.ignoreInvalidStyle)return{};let n=t,r=new U("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:n,ruleId:`style`,source:`hast-util-to-jsx-runtime`});throw r.file=e.filePath||void 0,r.url=Qt+`#cannot-parse-style-attribute`,r}}function _n(e,t,n){let r;if(!n)r={type:`Literal`,value:t};else if(t.includes(`.`)){let e=t.split(`.`),n=-1,i;for(;++n<e.length;){let t=rt(e[n])?{type:`Identifier`,name:e[n]}:{type:`Literal`,value:e[n]};i=i?{type:`MemberExpression`,object:i,property:t,computed:!!(n&&t.type===`Literal`),optional:!1}:t}r=i}else r=rt(t)&&!/^[a-z]/.test(t)?{type:`Identifier`,name:t}:{type:`Literal`,value:t};if(r.type===`Literal`){let t=r.value;return qt.call(e.components,t)?e.components[t]:t}if(e.evaluater)return e.evaluater.evaluateExpression(r);vn(e)}function vn(e,t){let n=new U("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:`mdx-estree`,source:`hast-util-to-jsx-runtime`});throw n.file=e.filePath||void 0,n.url=Qt+`#cannot-handle-mdx-estrees-without-createevaluater`,n}function yn(e){let t={},n;for(n in e)qt.call(e,n)&&(t[bn(n)]=e[n]);return t}function bn(e){let t=e.replace(Yt,xn);return t.slice(0,3)===`ms-`&&(t=`-`+t),t}function xn(e){return`-`+e.toLowerCase()}var Sn={action:[`form`],cite:[`blockquote`,`del`,`ins`,`q`],data:[`object`],formAction:[`button`,`input`],href:[`a`,`area`,`base`,`link`],icon:[`menuitem`],itemId:null,manifest:[`html`],ping:[`a`,`area`],poster:[`video`],src:[`audio`,`embed`,`iframe`,`img`,`input`,`script`,`source`,`track`,`video`]},Cn={};function wn(e,t){let n=t||Cn;return Tn(e,typeof n.includeImageAlt==`boolean`?n.includeImageAlt:!0,typeof n.includeHtml==`boolean`?n.includeHtml:!0)}function Tn(e,t,n){if(Dn(e)){if(`value`in e)return e.type===`html`&&!n?``:e.value;if(t&&`alt`in e&&e.alt)return e.alt;if(`children`in e)return En(e.children,t,n)}return Array.isArray(e)?En(e,t,n):``}function En(e,t,n){let r=[],i=-1;for(;++i<e.length;)r[i]=Tn(e[i],t,n);return r.join(``)}function Dn(e){return!!(e&&typeof e==`object`)}var On=document.createElement(`i`);function kn(e){let t=`&`+e+`;`;On.innerHTML=t;let n=On.textContent;return n.charCodeAt(n.length-1)===59&&e!==`semi`||n===t?!1:n}function W(e,t,n,r){let i=e.length,a=0,o;if(t=t<0?-t>i?0:i+t:t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a<r.length;)o=r.slice(a,a+1e4),o.unshift(t,0),e.splice(...o),a+=1e4,t+=1e4}function An(e,t){return e.length>0?(W(e,e.length,0,t),e):t}var jn={}.hasOwnProperty;function Mn(e){let t={},n=-1;for(;++n<e.length;)Nn(t,e[n]);return t}function Nn(e,t){let n;for(n in t){let r=(jn.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],a;if(i)for(a in i){jn.call(r,a)||(r[a]=[]);let e=i[a];Pn(r[a],Array.isArray(e)?e:e?[e]:[])}}}function Pn(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add===`after`?e:r).push(t[n]);W(e,0,0,r)}function Fn(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)==65535||(n&65535)==65534||n>1114111?`�`:String.fromCodePoint(n)}function In(e){return e.replace(/[\t\n\r ]+/g,` `).replace(/^ | $/g,``).toLowerCase().toUpperCase()}var G=Wn(/[A-Za-z]/),K=Wn(/[\dA-Za-z]/),Ln=Wn(/[#-'*+\--9=?A-Z^-~]/);function Rn(e){return e!==null&&(e<32||e===127)}var zn=Wn(/\d/),Bn=Wn(/[\dA-Fa-f]/),Vn=Wn(/[!-/:-@[-`{-~]/);function q(e){return e!==null&&e<-2}function J(e){return e!==null&&(e<0||e===32)}function Y(e){return e===-2||e===-1||e===32}var Hn=Wn(/\p{P}|\p{S}/u),Un=Wn(/\s/);function Wn(e){return t;function t(t){return t!==null&&t>-1&&e.test(String.fromCharCode(t))}}function Gn(e){let t=[],n=-1,r=0,i=0;for(;++n<e.length;){let a=e.charCodeAt(n),o=``;if(a===37&&K(e.charCodeAt(n+1))&&K(e.charCodeAt(n+2)))i=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(o=String.fromCharCode(a));else if(a>55295&&a<57344){let t=e.charCodeAt(n+1);a<56320&&t>56319&&t<57344?(o=String.fromCharCode(a,t),i=1):o=`�`}else o=String.fromCharCode(a);o&&=(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,``),i&&=(n+=i,0)}return t.join(``)+e.slice(r)}function X(e,t,n,r){let i=r?r-1:1/0,a=0;return o;function o(r){return Y(r)?(e.enter(n),s(r)):t(r)}function s(r){return Y(r)&&a++<i?(e.consume(r),s):(e.exit(n),t(r))}}var Kn={tokenize:qn};function qn(e){let t=e.attempt(this.parser.constructs.contentInitial,r,i),n;return t;function r(n){if(n===null){e.consume(n);return}return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}function i(t){return e.enter(`paragraph`),a(t)}function a(t){let r=e.enter(`chunkText`,{contentType:`text`,previous:n});return n&&(n.next=r),n=r,o(t)}function o(t){if(t===null){e.exit(`chunkText`),e.exit(`paragraph`),e.consume(t);return}return q(t)?(e.consume(t),e.exit(`chunkText`),a):(e.consume(t),o)}}var Jn={tokenize:Xn},Yn={tokenize:Zn};function Xn(e){let t=this,n=[],r=0,i,a,o;return s;function s(i){if(r<n.length){let a=n[r];return t.containerState=a[1],e.attempt(a[0].continuation,c,l)(i)}return l(i)}function c(e){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();let n=t.events.length,a=n,o;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){o=t.events[a][1].end;break}_(r);let s=n;for(;s<t.events.length;)t.events[s][1].end={...o},s++;return W(t.events,a+1,0,t.events.slice(n)),t.events.length=s,l(e)}return s(e)}function l(a){if(r===n.length){if(!i)return f(a);if(i.currentConstruct&&i.currentConstruct.concrete)return m(a);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Yn,u,d)(a)}function u(e){return i&&v(),_(r),f(e)}function d(e){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(e)}function f(n){return t.containerState={},e.attempt(Yn,p,m)(n)}function p(e){return r++,n.push([t.currentConstruct,t.containerState]),f(e)}function m(n){if(n===null){i&&v(),_(0),e.consume(n);return}return i||=t.parser.flow(t.now()),e.enter(`chunkFlow`,{_tokenizer:i,contentType:`flow`,previous:a}),h(n)}function h(n){if(n===null){g(e.exit(`chunkFlow`),!0),_(0),e.consume(n);return}return q(n)?(e.consume(n),g(e.exit(`chunkFlow`)),r=0,t.interrupt=void 0,s):(e.consume(n),h)}function g(e,n){let s=t.sliceStream(e);if(n&&s.push(null),e.previous=a,a&&(a.next=e),a=e,i.defineSkip(e.start),i.write(s),t.parser.lazy[e.start.line]){let e=i.events.length;for(;e--;)if(i.events[e][1].start.offset<o&&(!i.events[e][1].end||i.events[e][1].end.offset>o))return;let n=t.events.length,a=n,s,c;for(;a--;)if(t.events[a][0]===`exit`&&t.events[a][1].type===`chunkFlow`){if(s){c=t.events[a][1].end;break}s=!0}for(_(r),e=n;e<t.events.length;)t.events[e][1].end={...c},e++;W(t.events,a+1,0,t.events.slice(n)),t.events.length=e}}function _(r){let i=n.length;for(;i-- >r;){let r=n[i];t.containerState=r[1],r[0].exit.call(t,e)}n.length=r}function v(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function Zn(e,t,n){return X(e,e.attempt(this.parser.constructs.document,t,n),`linePrefix`,this.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)}function Qn(e){if(e===null||J(e)||Un(e))return 1;if(Hn(e))return 2}function $n(e,t,n){let r=[],i=-1;for(;++i<e.length;){let a=e[i].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}var er={name:`attention`,resolveAll:tr,tokenize:nr};function tr(e,t){let n=-1,r,i,a,o,s,c,l,u;for(;++n<e.length;)if(e[n][0]===`enter`&&e[n][1].type===`attentionSequence`&&e[n][1]._close){for(r=n;r--;)if(e[r][0]===`exit`&&e[r][1].type===`attentionSequence`&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[r][1].end},f={...e[n][1].start};rr(d,-c),rr(f,c),o={type:c>1?`strongSequence`:`emphasisSequence`,start:d,end:{...e[r][1].end}},s={type:c>1?`strongSequence`:`emphasisSequence`,start:{...e[n][1].start},end:f},a={type:c>1?`strongText`:`emphasisText`,start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?`strong`:`emphasis`,start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},l=[],e[r][1].end.offset-e[r][1].start.offset&&(l=An(l,[[`enter`,e[r][1],t],[`exit`,e[r][1],t]])),l=An(l,[[`enter`,i,t],[`enter`,o,t],[`exit`,o,t],[`enter`,a,t]]),l=An(l,$n(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),l=An(l,[[`exit`,a,t],[`enter`,s,t],[`exit`,s,t],[`exit`,i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,l=An(l,[[`enter`,e[n][1],t],[`exit`,e[n][1],t]])):u=0,W(e,r-1,n-r+3,l),n=r+l.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type===`attentionSequence`&&(e[n][1].type=`data`);return e}function nr(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Qn(r),a;return o;function o(t){return a=t,e.enter(`attentionSequence`),s(t)}function s(o){if(o===a)return e.consume(o),s;let c=e.exit(`attentionSequence`),l=Qn(o),u=!l||l===2&&i||n.includes(o),d=!i||i===2&&l||n.includes(r);return c._open=!!(a===42?u:u&&(i||!d)),c._close=!!(a===42?d:d&&(l||!u)),t(o)}}function rr(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var ir={name:`autolink`,tokenize:ar};function ar(e,t,n){let r=0;return i;function i(t){return e.enter(`autolink`),e.enter(`autolinkMarker`),e.consume(t),e.exit(`autolinkMarker`),e.enter(`autolinkProtocol`),a}function a(t){return G(t)?(e.consume(t),o):t===64?n(t):l(t)}function o(e){return e===43||e===45||e===46||K(e)?(r=1,s(e)):l(e)}function s(t){return t===58?(e.consume(t),r=0,c):(t===43||t===45||t===46||K(t))&&r++<32?(e.consume(t),s):(r=0,l(t))}function c(r){return r===62?(e.exit(`autolinkProtocol`),e.enter(`autolinkMarker`),e.consume(r),e.exit(`autolinkMarker`),e.exit(`autolink`),t):r===null||r===32||r===60||Rn(r)?n(r):(e.consume(r),c)}function l(t){return t===64?(e.consume(t),u):Ln(t)?(e.consume(t),l):n(t)}function u(e){return K(e)?d(e):n(e)}function d(n){return n===46?(e.consume(n),r=0,u):n===62?(e.exit(`autolinkProtocol`).type=`autolinkEmail`,e.enter(`autolinkMarker`),e.consume(n),e.exit(`autolinkMarker`),e.exit(`autolink`),t):f(n)}function f(t){if((t===45||K(t))&&r++<63){let n=t===45?f:d;return e.consume(t),n}return n(t)}}var or={partial:!0,tokenize:sr};function sr(e,t,n){return r;function r(t){return Y(t)?X(e,i,`linePrefix`)(t):i(t)}function i(e){return e===null||q(e)?t(e):n(e)}}var cr={continuation:{tokenize:ur},exit:dr,name:`blockQuote`,tokenize:lr};function lr(e,t,n){let r=this;return i;function i(t){if(t===62){let n=r.containerState;return n.open||=(e.enter(`blockQuote`,{_container:!0}),!0),e.enter(`blockQuotePrefix`),e.enter(`blockQuoteMarker`),e.consume(t),e.exit(`blockQuoteMarker`),a}return n(t)}function a(n){return Y(n)?(e.enter(`blockQuotePrefixWhitespace`),e.consume(n),e.exit(`blockQuotePrefixWhitespace`),e.exit(`blockQuotePrefix`),t):(e.exit(`blockQuotePrefix`),t(n))}}function ur(e,t,n){let r=this;return i;function i(t){return Y(t)?X(e,a,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):a(t)}function a(r){return e.attempt(cr,t,n)(r)}}function dr(e){e.exit(`blockQuote`)}var fr={name:`characterEscape`,tokenize:pr};function pr(e,t,n){return r;function r(t){return e.enter(`characterEscape`),e.enter(`escapeMarker`),e.consume(t),e.exit(`escapeMarker`),i}function i(r){return Vn(r)?(e.enter(`characterEscapeValue`),e.consume(r),e.exit(`characterEscapeValue`),e.exit(`characterEscape`),t):n(r)}}var mr={name:`characterReference`,tokenize:hr};function hr(e,t,n){let r=this,i=0,a,o;return s;function s(t){return e.enter(`characterReference`),e.enter(`characterReferenceMarker`),e.consume(t),e.exit(`characterReferenceMarker`),c}function c(t){return t===35?(e.enter(`characterReferenceMarkerNumeric`),e.consume(t),e.exit(`characterReferenceMarkerNumeric`),l):(e.enter(`characterReferenceValue`),a=31,o=K,u(t))}function l(t){return t===88||t===120?(e.enter(`characterReferenceMarkerHexadecimal`),e.consume(t),e.exit(`characterReferenceMarkerHexadecimal`),e.enter(`characterReferenceValue`),a=6,o=Bn,u):(e.enter(`characterReferenceValue`),a=7,o=zn,u(t))}function u(s){if(s===59&&i){let i=e.exit(`characterReferenceValue`);return o===K&&!kn(r.sliceSerialize(i))?n(s):(e.enter(`characterReferenceMarker`),e.consume(s),e.exit(`characterReferenceMarker`),e.exit(`characterReference`),t)}return o(s)&&i++<a?(e.consume(s),u):n(s)}}var gr={partial:!0,tokenize:yr},_r={concrete:!0,name:`codeFenced`,tokenize:vr};function vr(e,t,n){let r=this,i={partial:!0,tokenize:x},a=0,o=0,s;return c;function c(e){return l(e)}function l(t){let n=r.events[r.events.length-1];return a=n&&n[1].type===`linePrefix`?n[2].sliceSerialize(n[1],!0).length:0,s=t,e.enter(`codeFenced`),e.enter(`codeFencedFence`),e.enter(`codeFencedFenceSequence`),u(t)}function u(t){return t===s?(o++,e.consume(t),u):o<3?n(t):(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t))}function d(n){return n===null||q(n)?(e.exit(`codeFencedFence`),r.interrupt?t(n):e.check(gr,h,b)(n)):(e.enter(`codeFencedFenceInfo`),e.enter(`chunkString`,{contentType:`string`}),f(n))}function f(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),d(t)):Y(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceInfo`),X(e,p,`whitespace`)(t)):t===96&&t===s?n(t):(e.consume(t),f)}function p(t){return t===null||q(t)?d(t):(e.enter(`codeFencedFenceMeta`),e.enter(`chunkString`,{contentType:`string`}),m(t))}function m(t){return t===null||q(t)?(e.exit(`chunkString`),e.exit(`codeFencedFenceMeta`),d(t)):t===96&&t===s?n(t):(e.consume(t),m)}function h(t){return e.attempt(i,b,g)(t)}function g(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),_}function _(t){return a>0&&Y(t)?X(e,v,`linePrefix`,a+1)(t):v(t)}function v(t){return t===null||q(t)?e.check(gr,h,b)(t):(e.enter(`codeFlowValue`),y(t))}function y(t){return t===null||q(t)?(e.exit(`codeFlowValue`),v(t)):(e.consume(t),y)}function b(n){return e.exit(`codeFenced`),t(n)}function x(e,t,n){let i=0;return a;function a(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c}function c(t){return e.enter(`codeFencedFence`),Y(t)?X(e,l,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):l(t)}function l(t){return t===s?(e.enter(`codeFencedFenceSequence`),u(t)):n(t)}function u(t){return t===s?(i++,e.consume(t),u):i>=o?(e.exit(`codeFencedFenceSequence`),Y(t)?X(e,d,`whitespace`)(t):d(t)):n(t)}function d(r){return r===null||q(r)?(e.exit(`codeFencedFence`),t(r)):n(r)}}}function yr(e,t,n){let r=this;return i;function i(t){return t===null?n(t):(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}var br={name:`codeIndented`,tokenize:Sr},xr={partial:!0,tokenize:Cr};function Sr(e,t,n){let r=this;return i;function i(t){return e.enter(`codeIndented`),X(e,a,`linePrefix`,5)(t)}function a(e){let t=r.events[r.events.length-1];return t&&t[1].type===`linePrefix`&&t[2].sliceSerialize(t[1],!0).length>=4?o(e):n(e)}function o(t){return t===null?c(t):q(t)?e.attempt(xr,o,c)(t):(e.enter(`codeFlowValue`),s(t))}function s(t){return t===null||q(t)?(e.exit(`codeFlowValue`),o(t)):(e.consume(t),s)}function c(n){return e.exit(`codeIndented`),t(n)}}function Cr(e,t,n){let r=this;return i;function i(t){return r.parser.lazy[r.now().line]?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),i):X(e,a,`linePrefix`,5)(t)}function a(e){let a=r.events[r.events.length-1];return a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(e):q(e)?i(e):n(e)}}var wr={name:`codeText`,previous:Er,resolve:Tr,tokenize:Dr};function Tr(e){let t=e.length-4,n=3,r,i;if((e[n][1].type===`lineEnding`||e[n][1].type===`space`)&&(e[t][1].type===`lineEnding`||e[t][1].type===`space`)){for(r=n;++r<t;)if(e[r][1].type===`codeTextData`){e[n][1].type=`codeTextPadding`,e[t][1].type=`codeTextPadding`,n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!==`lineEnding`&&(i=r):(r===t||e[r][1].type===`lineEnding`)&&(e[i][1].type=`codeTextData`,r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function Er(e){return e!==96||this.events[this.events.length-1][1].type===`characterEscape`}function Dr(e,t,n){let r=0,i,a;return o;function o(t){return e.enter(`codeText`),e.enter(`codeTextSequence`),s(t)}function s(t){return t===96?(e.consume(t),r++,s):(e.exit(`codeTextSequence`),c(t))}function c(t){return t===null?n(t):t===32?(e.enter(`space`),e.consume(t),e.exit(`space`),c):t===96?(a=e.enter(`codeTextSequence`),i=0,u(t)):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),c):(e.enter(`codeTextData`),l(t))}function l(t){return t===null||t===32||t===96||q(t)?(e.exit(`codeTextData`),c(t)):(e.consume(t),l)}function u(n){return n===96?(e.consume(n),i++,u):i===r?(e.exit(`codeTextSequence`),e.exit(`codeText`),t(n)):(a.type=`codeTextData`,l(n))}}var Or=class{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t??1/0;return n<this.left.length?this.left.slice(e,n):e>this.left.length?this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let r=t||0;this.setCursor(Math.trunc(e));let i=this.right.splice(this.right.length-r,1/0);return n&&kr(this.left,n),i.reverse()}pop(){return this.setCursor(1/0),this.left.pop()}push(e){this.setCursor(1/0),this.left.push(e)}pushMany(e){this.setCursor(1/0),kr(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),kr(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){let t=this.left.splice(e,1/0);kr(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,1/0);kr(this.left,t.reverse())}}};function kr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function Ar(e){let t={},n=-1,r,i,a,o,s,c,l,u=new Or(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type===`chunkFlow`&&u.get(n-1)[1].type===`listItemPrefix`&&(c=r[1]._tokenizer.events,a=0,a<c.length&&c[a][1].type===`lineEndingBlank`&&(a+=2),a<c.length&&c[a][1].type===`content`))for(;++a<c.length&&c[a][1].type!==`content`;)c[a][1].type===`chunkText`&&(c[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]===`enter`)r[1].contentType&&(Object.assign(t,jr(u,n)),n=t[n],l=!0);else if(r[1]._container){for(a=n,i=void 0;a--;)if(o=u.get(a),o[1].type===`lineEnding`||o[1].type===`lineEndingBlank`)o[0]===`enter`&&(i&&(u.get(i)[1].type=`lineEndingBlank`),o[1].type=`lineEnding`,i=a);else if(!(o[1].type===`linePrefix`||o[1].type===`listItemIndent`))break;i&&(r[1].end={...u.get(i)[1].start},s=u.slice(i,n),s.unshift(r),u.splice(i,n-i+1,s))}}return W(e,0,1/0,u.slice(0)),!l}function jr(e,t){let n=e.get(t)[1],r=e.get(t)[2],i=t-1,a=[],o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));let s=o.events,c=[],l={},u,d,f=-1,p=n,m=0,h=0,g=[h];for(;p;){for(;e.get(++i)[1]!==p;);a.push(i),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<s.length;)s[f][0]===`exit`&&s[f-1][0]===`enter`&&s[f][1].type===s[f-1][1].type&&s[f][1].start.line!==s[f][1].end.line&&(h=f+1,g.push(h),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):g.pop(),f=g.length;f--;){let t=s.slice(g[f],g[f+1]),n=a.pop();c.push([n,n+t.length-1]),e.splice(n,2,t)}for(c.reverse(),f=-1;++f<c.length;)l[m+c[f][0]]=m+c[f][1],m+=c[f][1]-c[f][0]-1;return l}var Mr={resolve:Pr,tokenize:Fr},Nr={partial:!0,tokenize:Ir};function Pr(e){return Ar(e),e}function Fr(e,t){let n;return r;function r(t){return e.enter(`content`),n=e.enter(`chunkContent`,{contentType:`content`}),i(t)}function i(t){return t===null?a(t):q(t)?e.check(Nr,o,a)(t):(e.consume(t),i)}function a(n){return e.exit(`chunkContent`),e.exit(`content`),t(n)}function o(t){return e.consume(t),e.exit(`chunkContent`),n.next=e.enter(`chunkContent`,{contentType:`content`,previous:n}),n=n.next,i}}function Ir(e,t,n){let r=this;return i;function i(t){return e.exit(`chunkContent`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,a,`linePrefix`)}function a(i){if(i===null||q(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes(`codeIndented`)&&a&&a[1].type===`linePrefix`&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function Lr(e,t,n,r,i,a,o,s,c){let l=c||1/0,u=0;return d;function d(t){return t===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(t),e.exit(a),f):t===null||t===32||t===41||Rn(t)?n(t):(e.enter(r),e.enter(o),e.enter(s),e.enter(`chunkString`,{contentType:`string`}),h(t))}function f(n){return n===62?(e.enter(a),e.consume(n),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter(`chunkString`,{contentType:`string`}),p(n))}function p(t){return t===62?(e.exit(`chunkString`),e.exit(s),f(t)):t===null||t===60||q(t)?n(t):(e.consume(t),t===92?m:p)}function m(t){return t===60||t===62||t===92?(e.consume(t),p):p(t)}function h(i){return!u&&(i===null||i===41||J(i))?(e.exit(`chunkString`),e.exit(s),e.exit(o),e.exit(r),t(i)):u<l&&i===40?(e.consume(i),u++,h):i===41?(e.consume(i),u--,h):i===null||i===32||i===40||Rn(i)?n(i):(e.consume(i),i===92?g:h)}function g(t){return t===40||t===41||t===92?(e.consume(t),h):h(t)}}function Rr(e,t,n,r,i,a){let o=this,s=0,c;return l;function l(t){return e.enter(r),e.enter(i),e.consume(t),e.exit(i),e.enter(a),u}function u(l){return s>999||l===null||l===91||l===93&&!c||l===94&&!s&&`_hiddenFootnoteSupport`in o.parser.constructs?n(l):l===93?(e.exit(a),e.enter(i),e.consume(l),e.exit(i),e.exit(r),t):q(l)?(e.enter(`lineEnding`),e.consume(l),e.exit(`lineEnding`),u):(e.enter(`chunkString`,{contentType:`string`}),d(l))}function d(t){return t===null||t===91||t===93||q(t)||s++>999?(e.exit(`chunkString`),u(t)):(e.consume(t),c||=!Y(t),t===92?f:d)}function f(t){return t===91||t===92||t===93?(e.consume(t),s++,d):d(t)}}function zr(e,t,n,r,i,a){let o;return s;function s(t){return t===34||t===39||t===40?(e.enter(r),e.enter(i),e.consume(t),e.exit(i),o=t===40?41:t,c):n(t)}function c(n){return n===o?(e.enter(i),e.consume(n),e.exit(i),e.exit(r),t):(e.enter(a),l(n))}function l(t){return t===o?(e.exit(a),c(o)):t===null?n(t):q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),X(e,l,`linePrefix`)):(e.enter(`chunkString`,{contentType:`string`}),u(t))}function u(t){return t===o||t===null||q(t)?(e.exit(`chunkString`),l(t)):(e.consume(t),t===92?d:u)}function d(t){return t===o||t===92?(e.consume(t),u):u(t)}}function Br(e,t){let n;return r;function r(i){return q(i)?(e.enter(`lineEnding`),e.consume(i),e.exit(`lineEnding`),n=!0,r):Y(i)?X(e,r,n?`linePrefix`:`lineSuffix`)(i):t(i)}}var Vr={name:`definition`,tokenize:Ur},Hr={partial:!0,tokenize:Wr};function Ur(e,t,n){let r=this,i;return a;function a(t){return e.enter(`definition`),o(t)}function o(t){return Rr.call(r,e,s,n,`definitionLabel`,`definitionLabelMarker`,`definitionLabelString`)(t)}function s(t){return i=In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),t===58?(e.enter(`definitionMarker`),e.consume(t),e.exit(`definitionMarker`),c):n(t)}function c(t){return J(t)?Br(e,l)(t):l(t)}function l(t){return Lr(e,u,n,`definitionDestination`,`definitionDestinationLiteral`,`definitionDestinationLiteralMarker`,`definitionDestinationRaw`,`definitionDestinationString`)(t)}function u(t){return e.attempt(Hr,d,d)(t)}function d(t){return Y(t)?X(e,f,`whitespace`)(t):f(t)}function f(a){return a===null||q(a)?(e.exit(`definition`),r.parser.defined.push(i),t(a)):n(a)}}function Wr(e,t,n){return r;function r(t){return J(t)?Br(e,i)(t):n(t)}function i(t){return zr(e,a,n,`definitionTitle`,`definitionTitleMarker`,`definitionTitleString`)(t)}function a(t){return Y(t)?X(e,o,`whitespace`)(t):o(t)}function o(e){return e===null||q(e)?t(e):n(e)}}var Gr={name:`hardBreakEscape`,tokenize:Kr};function Kr(e,t,n){return r;function r(t){return e.enter(`hardBreakEscape`),e.consume(t),i}function i(r){return q(r)?(e.exit(`hardBreakEscape`),t(r)):n(r)}}var qr={name:`headingAtx`,resolve:Jr,tokenize:Yr};function Jr(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type===`whitespace`&&(r+=2),n-2>r&&e[n][1].type===`whitespace`&&(n-=2),e[n][1].type===`atxHeadingSequence`&&(r===n-1||n-4>r&&e[n-2][1].type===`whitespace`)&&(n-=r+1===n?2:4),n>r&&(i={type:`atxHeadingText`,start:e[r][1].start,end:e[n][1].end},a={type:`chunkText`,start:e[r][1].start,end:e[n][1].end,contentType:`text`},W(e,r,n-r+1,[[`enter`,i,t],[`enter`,a,t],[`exit`,a,t],[`exit`,i,t]])),e}function Yr(e,t,n){let r=0;return i;function i(t){return e.enter(`atxHeading`),a(t)}function a(t){return e.enter(`atxHeadingSequence`),o(t)}function o(t){return t===35&&r++<6?(e.consume(t),o):t===null||J(t)?(e.exit(`atxHeadingSequence`),s(t)):n(t)}function s(n){return n===35?(e.enter(`atxHeadingSequence`),c(n)):n===null||q(n)?(e.exit(`atxHeading`),t(n)):Y(n)?X(e,s,`whitespace`)(n):(e.enter(`atxHeadingText`),l(n))}function c(t){return t===35?(e.consume(t),c):(e.exit(`atxHeadingSequence`),s(t))}function l(t){return t===null||t===35||J(t)?(e.exit(`atxHeadingText`),s(t)):(e.consume(t),l)}}var Xr=`address.article.aside.base.basefont.blockquote.body.caption.center.col.colgroup.dd.details.dialog.dir.div.dl.dt.fieldset.figcaption.figure.footer.form.frame.frameset.h1.h2.h3.h4.h5.h6.head.header.hr.html.iframe.legend.li.link.main.menu.menuitem.nav.noframes.ol.optgroup.option.p.param.search.section.summary.table.tbody.td.tfoot.th.thead.title.tr.track.ul`.split(`.`),Zr=[`pre`,`script`,`style`,`textarea`],Qr={concrete:!0,name:`htmlFlow`,resolveTo:ti,tokenize:ni},$r={partial:!0,tokenize:ii},ei={partial:!0,tokenize:ri};function ti(e){let t=e.length;for(;t--&&!(e[t][0]===`enter`&&e[t][1].type===`htmlFlow`););return t>1&&e[t-2][1].type===`linePrefix`&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function ni(e,t,n){let r=this,i,a,o,s,c;return l;function l(e){return u(e)}function u(t){return e.enter(`htmlFlow`),e.enter(`htmlFlowData`),e.consume(t),d}function d(s){return s===33?(e.consume(s),f):s===47?(e.consume(s),a=!0,h):s===63?(e.consume(s),i=3,r.interrupt?t:ae):G(s)?(e.consume(s),o=String.fromCharCode(s),g):n(s)}function f(a){return a===45?(e.consume(a),i=2,p):a===91?(e.consume(a),i=5,s=0,m):G(a)?(e.consume(a),i=4,r.interrupt?t:ae):n(a)}function p(i){return i===45?(e.consume(i),r.interrupt?t:ae):n(i)}function m(i){return i===`CDATA[`.charCodeAt(s++)?(e.consume(i),s===6?r.interrupt?t:O:m):n(i)}function h(t){return G(t)?(e.consume(t),o=String.fromCharCode(t),g):n(t)}function g(s){if(s===null||s===47||s===62||J(s)){let c=s===47,l=o.toLowerCase();return!c&&!a&&Zr.includes(l)?(i=1,r.interrupt?t(s):O(s)):Xr.includes(o.toLowerCase())?(i=6,c?(e.consume(s),_):r.interrupt?t(s):O(s)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(s):a?v(s):y(s))}return s===45||K(s)?(e.consume(s),o+=String.fromCharCode(s),g):n(s)}function _(i){return i===62?(e.consume(i),r.interrupt?t:O):n(i)}function v(t){return Y(t)?(e.consume(t),v):E(t)}function y(t){return t===47?(e.consume(t),E):t===58||t===95||G(t)?(e.consume(t),b):Y(t)?(e.consume(t),y):E(t)}function b(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),b):x(t)}function x(t){return t===61?(e.consume(t),S):Y(t)?(e.consume(t),x):y(t)}function S(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),c=t,C):Y(t)?(e.consume(t),S):w(t)}function C(t){return t===c?(e.consume(t),c=null,T):t===null||q(t)?n(t):(e.consume(t),C)}function w(t){return t===null||t===34||t===39||t===47||t===60||t===61||t===62||t===96||J(t)?x(t):(e.consume(t),w)}function T(e){return e===47||e===62||Y(e)?y(e):n(e)}function E(t){return t===62?(e.consume(t),D):n(t)}function D(t){return t===null||q(t)?O(t):Y(t)?(e.consume(t),D):n(t)}function O(t){return t===45&&i===2?(e.consume(t),ne):t===60&&i===1?(e.consume(t),A):t===62&&i===4?(e.consume(t),oe):t===63&&i===3?(e.consume(t),ae):t===93&&i===5?(e.consume(t),ie):q(t)&&(i===6||i===7)?(e.exit(`htmlFlowData`),e.check($r,se,k)(t)):t===null||q(t)?(e.exit(`htmlFlowData`),k(t)):(e.consume(t),O)}function k(t){return e.check(ei,ee,se)(t)}function ee(t){return e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),te}function te(t){return t===null||q(t)?k(t):(e.enter(`htmlFlowData`),O(t))}function ne(t){return t===45?(e.consume(t),ae):O(t)}function A(t){return t===47?(e.consume(t),o=``,re):O(t)}function re(t){if(t===62){let n=o.toLowerCase();return Zr.includes(n)?(e.consume(t),oe):O(t)}return G(t)&&o.length<8?(e.consume(t),o+=String.fromCharCode(t),re):O(t)}function ie(t){return t===93?(e.consume(t),ae):O(t)}function ae(t){return t===62?(e.consume(t),oe):t===45&&i===2?(e.consume(t),ae):O(t)}function oe(t){return t===null||q(t)?(e.exit(`htmlFlowData`),se(t)):(e.consume(t),oe)}function se(n){return e.exit(`htmlFlow`),t(n)}}function ri(e,t,n){let r=this;return i;function i(t){return q(t)?(e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),a):n(t)}function a(e){return r.parser.lazy[r.now().line]?n(e):t(e)}}function ii(e,t,n){return r;function r(r){return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),e.attempt(or,t,n)}}var ai={name:`htmlText`,tokenize:oi};function oi(e,t,n){let r=this,i,a,o;return s;function s(t){return e.enter(`htmlText`),e.enter(`htmlTextData`),e.consume(t),c}function c(t){return t===33?(e.consume(t),l):t===47?(e.consume(t),x):t===63?(e.consume(t),y):G(t)?(e.consume(t),w):n(t)}function l(t){return t===45?(e.consume(t),u):t===91?(e.consume(t),a=0,m):G(t)?(e.consume(t),v):n(t)}function u(t){return t===45?(e.consume(t),p):n(t)}function d(t){return t===null?n(t):t===45?(e.consume(t),f):q(t)?(o=d,A(t)):(e.consume(t),d)}function f(t){return t===45?(e.consume(t),p):d(t)}function p(e){return e===62?ne(e):e===45?f(e):d(e)}function m(t){return t===`CDATA[`.charCodeAt(a++)?(e.consume(t),a===6?h:m):n(t)}function h(t){return t===null?n(t):t===93?(e.consume(t),g):q(t)?(o=h,A(t)):(e.consume(t),h)}function g(t){return t===93?(e.consume(t),_):h(t)}function _(t){return t===62?ne(t):t===93?(e.consume(t),_):h(t)}function v(t){return t===null||t===62?ne(t):q(t)?(o=v,A(t)):(e.consume(t),v)}function y(t){return t===null?n(t):t===63?(e.consume(t),b):q(t)?(o=y,A(t)):(e.consume(t),y)}function b(e){return e===62?ne(e):y(e)}function x(t){return G(t)?(e.consume(t),S):n(t)}function S(t){return t===45||K(t)?(e.consume(t),S):C(t)}function C(t){return q(t)?(o=C,A(t)):Y(t)?(e.consume(t),C):ne(t)}function w(t){return t===45||K(t)?(e.consume(t),w):t===47||t===62||J(t)?T(t):n(t)}function T(t){return t===47?(e.consume(t),ne):t===58||t===95||G(t)?(e.consume(t),E):q(t)?(o=T,A(t)):Y(t)?(e.consume(t),T):ne(t)}function E(t){return t===45||t===46||t===58||t===95||K(t)?(e.consume(t),E):D(t)}function D(t){return t===61?(e.consume(t),O):q(t)?(o=D,A(t)):Y(t)?(e.consume(t),D):T(t)}function O(t){return t===null||t===60||t===61||t===62||t===96?n(t):t===34||t===39?(e.consume(t),i=t,k):q(t)?(o=O,A(t)):Y(t)?(e.consume(t),O):(e.consume(t),ee)}function k(t){return t===i?(e.consume(t),i=void 0,te):t===null?n(t):q(t)?(o=k,A(t)):(e.consume(t),k)}function ee(t){return t===null||t===34||t===39||t===60||t===61||t===96?n(t):t===47||t===62||J(t)?T(t):(e.consume(t),ee)}function te(e){return e===47||e===62||J(e)?T(e):n(e)}function ne(r){return r===62?(e.consume(r),e.exit(`htmlTextData`),e.exit(`htmlText`),t):n(r)}function A(t){return e.exit(`htmlTextData`),e.enter(`lineEnding`),e.consume(t),e.exit(`lineEnding`),re}function re(t){return Y(t)?X(e,ie,`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(t):ie(t)}function ie(t){return e.enter(`htmlTextData`),o(t)}}var si={name:`labelEnd`,resolveAll:di,resolveTo:fi,tokenize:pi},ci={tokenize:mi},li={tokenize:hi},ui={tokenize:gi};function di(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type===`labelImage`||r.type===`labelLink`||r.type===`labelEnd`){let e=r.type===`labelImage`?4:2;r.type=`data`,t+=e}}return e.length!==n.length&&W(e,0,e.length,n),e}function fi(e,t){let n=e.length,r=0,i,a,o,s;for(;n--;)if(i=e[n][1],a){if(i.type===`link`||i.type===`labelLink`&&i._inactive)break;e[n][0]===`enter`&&i.type===`labelLink`&&(i._inactive=!0)}else if(o){if(e[n][0]===`enter`&&(i.type===`labelImage`||i.type===`labelLink`)&&!i._balanced&&(a=n,i.type!==`labelLink`)){r=2;break}}else i.type===`labelEnd`&&(o=n);let c={type:e[a][1].type===`labelLink`?`link`:`image`,start:{...e[a][1].start},end:{...e[e.length-1][1].end}},l={type:`label`,start:{...e[a][1].start},end:{...e[o][1].end}},u={type:`labelText`,start:{...e[a+r+2][1].end},end:{...e[o-2][1].start}};return s=[[`enter`,c,t],[`enter`,l,t]],s=An(s,e.slice(a+1,a+r+3)),s=An(s,[[`enter`,u,t]]),s=An(s,$n(t.parser.constructs.insideSpan.null,e.slice(a+r+4,o-3),t)),s=An(s,[[`exit`,u,t],e[o-2],e[o-1],[`exit`,l,t]]),s=An(s,e.slice(o+1)),s=An(s,[[`exit`,c,t]]),W(e,a,e.length,s),e}function pi(e,t,n){let r=this,i=r.events.length,a,o;for(;i--;)if((r.events[i][1].type===`labelImage`||r.events[i][1].type===`labelLink`)&&!r.events[i][1]._balanced){a=r.events[i][1];break}return s;function s(t){return a?a._inactive?d(t):(o=r.parser.defined.includes(In(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter(`labelEnd`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelEnd`),c):n(t)}function c(t){return t===40?e.attempt(ci,u,o?u:d)(t):t===91?e.attempt(li,u,o?l:d)(t):o?u(t):d(t)}function l(t){return e.attempt(ui,u,d)(t)}function u(e){return t(e)}function d(e){return a._balanced=!0,n(e)}}function mi(e,t,n){return r;function r(t){return e.enter(`resource`),e.enter(`resourceMarker`),e.consume(t),e.exit(`resourceMarker`),i}function i(t){return J(t)?Br(e,a)(t):a(t)}function a(t){return t===41?u(t):Lr(e,o,s,`resourceDestination`,`resourceDestinationLiteral`,`resourceDestinationLiteralMarker`,`resourceDestinationRaw`,`resourceDestinationString`,32)(t)}function o(t){return J(t)?Br(e,c)(t):u(t)}function s(e){return n(e)}function c(t){return t===34||t===39||t===40?zr(e,l,n,`resourceTitle`,`resourceTitleMarker`,`resourceTitleString`)(t):u(t)}function l(t){return J(t)?Br(e,u)(t):u(t)}function u(r){return r===41?(e.enter(`resourceMarker`),e.consume(r),e.exit(`resourceMarker`),e.exit(`resource`),t):n(r)}}function hi(e,t,n){let r=this;return i;function i(t){return Rr.call(r,e,a,o,`reference`,`referenceMarker`,`referenceString`)(t)}function a(e){return r.parser.defined.includes(In(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(e):n(e)}function o(e){return n(e)}}function gi(e,t,n){return r;function r(t){return e.enter(`reference`),e.enter(`referenceMarker`),e.consume(t),e.exit(`referenceMarker`),i}function i(r){return r===93?(e.enter(`referenceMarker`),e.consume(r),e.exit(`referenceMarker`),e.exit(`reference`),t):n(r)}}var _i={name:`labelStartImage`,resolveAll:si.resolveAll,tokenize:vi};function vi(e,t,n){let r=this;return i;function i(t){return e.enter(`labelImage`),e.enter(`labelImageMarker`),e.consume(t),e.exit(`labelImageMarker`),a}function a(t){return t===91?(e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelImage`),o):n(t)}function o(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var yi={name:`labelStartLink`,resolveAll:si.resolveAll,tokenize:bi};function bi(e,t,n){let r=this;return i;function i(t){return e.enter(`labelLink`),e.enter(`labelMarker`),e.consume(t),e.exit(`labelMarker`),e.exit(`labelLink`),a}function a(e){return e===94&&`_hiddenFootnoteSupport`in r.parser.constructs?n(e):t(e)}}var xi={name:`lineEnding`,tokenize:Si};function Si(e,t){return n;function n(n){return e.enter(`lineEnding`),e.consume(n),e.exit(`lineEnding`),X(e,t,`linePrefix`)}}var Ci={name:`thematicBreak`,tokenize:wi};function wi(e,t,n){let r=0,i;return a;function a(t){return e.enter(`thematicBreak`),o(t)}function o(e){return i=e,s(e)}function s(a){return a===i?(e.enter(`thematicBreakSequence`),c(a)):r>=3&&(a===null||q(a))?(e.exit(`thematicBreak`),t(a)):n(a)}function c(t){return t===i?(e.consume(t),r++,c):(e.exit(`thematicBreakSequence`),Y(t)?X(e,s,`whitespace`)(t):s(t))}}var Z={continuation:{tokenize:Oi},exit:Ai,name:`list`,tokenize:Di},Ti={partial:!0,tokenize:ji},Ei={partial:!0,tokenize:ki};function Di(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type===`linePrefix`?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(t){let i=r.containerState.type||(t===42||t===43||t===45?`listUnordered`:`listOrdered`);if(i===`listUnordered`?!r.containerState.marker||t===r.containerState.marker:zn(t)){if(r.containerState.type||(r.containerState.type=i,e.enter(i,{_container:!0})),i===`listUnordered`)return e.enter(`listItemPrefix`),t===42||t===45?e.check(Ci,n,l)(t):l(t);if(!r.interrupt||t===49)return e.enter(`listItemPrefix`),e.enter(`listItemValue`),c(t)}return n(t)}function c(t){return zn(t)&&++o<10?(e.consume(t),c):(!r.interrupt||o<2)&&(r.containerState.marker?t===r.containerState.marker:t===41||t===46)?(e.exit(`listItemValue`),l(t)):n(t)}function l(t){return e.enter(`listItemMarker`),e.consume(t),e.exit(`listItemMarker`),r.containerState.marker=r.containerState.marker||t,e.check(or,r.interrupt?n:u,e.attempt(Ti,f,d))}function u(e){return r.containerState.initialBlankLine=!0,a++,f(e)}function d(t){return Y(t)?(e.enter(`listItemPrefixWhitespace`),e.consume(t),e.exit(`listItemPrefixWhitespace`),f):n(t)}function f(n){return r.containerState.size=a+r.sliceSerialize(e.exit(`listItemPrefix`),!0).length,t(n)}}function Oi(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(or,i,a);function i(n){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,X(e,t,`listItemIndent`,r.containerState.size+1)(n)}function a(n){return r.containerState.furtherBlankLines||!Y(n)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(n)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(Ei,t,o)(n))}function o(i){return r.containerState._closeFlow=!0,r.interrupt=void 0,X(e,e.attempt(Z,t,n),`linePrefix`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:4)(i)}}function ki(e,t,n){let r=this;return X(e,i,`listItemIndent`,r.containerState.size+1);function i(e){let i=r.events[r.events.length-1];return i&&i[1].type===`listItemIndent`&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(e):n(e)}}function Ai(e){e.exit(this.containerState.type)}function ji(e,t,n){let r=this;return X(e,i,`listItemPrefixWhitespace`,r.parser.constructs.disable.null.includes(`codeIndented`)?void 0:5);function i(e){let i=r.events[r.events.length-1];return!Y(e)&&i&&i[1].type===`listItemPrefixWhitespace`?t(e):n(e)}}var Mi={name:`setextUnderline`,resolveTo:Ni,tokenize:Pi};function Ni(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]===`enter`){if(e[n][1].type===`content`){r=n;break}e[n][1].type===`paragraph`&&(i=n)}else e[n][1].type===`content`&&e.splice(n,1),!a&&e[n][1].type===`definition`&&(a=n);let o={type:`setextHeading`,start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type=`setextHeadingText`,a?(e.splice(i,0,[`enter`,o,t]),e.splice(a+1,0,[`exit`,e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push([`exit`,o,t]),e}function Pi(e,t,n){let r=this,i;return a;function a(t){let a=r.events.length,s;for(;a--;)if(r.events[a][1].type!==`lineEnding`&&r.events[a][1].type!==`linePrefix`&&r.events[a][1].type!==`content`){s=r.events[a][1].type===`paragraph`;break}return!r.parser.lazy[r.now().line]&&(r.interrupt||s)?(e.enter(`setextHeadingLine`),i=t,o(t)):n(t)}function o(t){return e.enter(`setextHeadingLineSequence`),s(t)}function s(t){return t===i?(e.consume(t),s):(e.exit(`setextHeadingLineSequence`),Y(t)?X(e,c,`lineSuffix`)(t):c(t))}function c(r){return r===null||q(r)?(e.exit(`setextHeadingLine`),t(r)):n(r)}}var Fi={tokenize:Ii};function Ii(e){let t=this,n=e.attempt(or,r,e.attempt(this.parser.constructs.flowInitial,i,X(e,e.attempt(this.parser.constructs.flow,i,e.attempt(Mr,i)),`linePrefix`)));return n;function r(r){if(r===null){e.consume(r);return}return e.enter(`lineEndingBlank`),e.consume(r),e.exit(`lineEndingBlank`),t.currentConstruct=void 0,n}function i(r){if(r===null){e.consume(r);return}return e.enter(`lineEnding`),e.consume(r),e.exit(`lineEnding`),t.currentConstruct=void 0,n}}var Li={resolveAll:Vi()},Ri=Bi(`string`),zi=Bi(`text`);function Bi(e){return{resolveAll:Vi(e===`text`?Hi:void 0),tokenize:t};function t(t){let n=this,r=this.parser.constructs[e],i=t.attempt(r,a,o);return a;function a(e){return c(e)?i(e):o(e)}function o(e){if(e===null){t.consume(e);return}return t.enter(`data`),t.consume(e),s}function s(e){return c(e)?(t.exit(`data`),i(e)):(t.consume(e),s)}function c(e){if(e===null)return!0;let t=r[e],i=-1;if(t)for(;++i<t.length;){let e=t[i];if(!e.previous||e.previous.call(n,n.previous))return!0}return!1}}}function Vi(e){return t;function t(t,n){let r=-1,i;for(;++r<=t.length;)i===void 0?t[r]&&t[r][1].type===`data`&&(i=r,r++):(!t[r]||t[r][1].type!==`data`)&&(r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),r=i+2),i=void 0);return e?e(t,n):t}}function Hi(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type===`lineEnding`)&&e[n-1][1].type===`data`){let r=e[n-1][1],i=t.sliceStream(r),a=i.length,o=-1,s=0,c;for(;a--;){let e=i[a];if(typeof e==`string`){for(o=e.length;e.charCodeAt(o-1)===32;)s++,o--;if(o)break;o=-1}else if(e===-2)c=!0,s++;else if(e!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(s=0),s){let i={type:n===e.length||c||s<2?`lineSuffix`:`hardBreakTrailing`,start:{_bufferIndex:a?o:r.start._bufferIndex+o,_index:r.start._index+a,line:r.end.line,column:r.end.column-s,offset:r.end.offset-s},end:{...r.end}};r.end={...i.start},r.start.offset===r.end.offset?Object.assign(r,i):(e.splice(n,0,[`enter`,i,t],[`exit`,i,t]),n+=2)}n++}return e}var Ui=t({attentionMarkers:()=>Zi,contentInitial:()=>Gi,disable:()=>Qi,document:()=>Wi,flow:()=>qi,flowInitial:()=>Ki,insideSpan:()=>Xi,string:()=>Ji,text:()=>Yi}),Wi={42:Z,43:Z,45:Z,48:Z,49:Z,50:Z,51:Z,52:Z,53:Z,54:Z,55:Z,56:Z,57:Z,62:cr},Gi={91:Vr},Ki={[-2]:br,[-1]:br,32:br},qi={35:qr,42:Ci,45:[Mi,Ci],60:Qr,61:Mi,95:Ci,96:_r,126:_r},Ji={38:mr,92:fr},Yi={[-5]:xi,[-4]:xi,[-3]:xi,33:_i,38:mr,42:er,60:[ir,ai],91:yi,92:[Gr,fr],93:si,95:er,96:wr},Xi={null:[er,Li]},Zi={null:[42,95]},Qi={null:[]};function $i(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],c={attempt:C(x),check:C(S),consume:v,enter:y,exit:b,interrupt:C(S,{interrupt:!0})},l={code:null,containerState:{},defineSkip:h,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d},u=t.tokenize.call(l,c);return t.resolveAll&&a.push(t),l;function d(e){return o=An(o,e),g(),o[o.length-1]===null?(w(t,0),l.events=$n(a,l.events,l),l.events):[]}function f(e,t){return ta(p(e),t)}function p(e){return ea(o,e)}function m(){let{_bufferIndex:e,_index:t,line:n,column:i,offset:a}=r;return{_bufferIndex:e,_index:t,line:n,column:i,offset:a}}function h(e){i[e.line]=e.column,E()}function g(){let e;for(;r._index<o.length;){let t=o[r._index];if(typeof t==`string`)for(e=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===e&&r._bufferIndex<t.length;)_(t.charCodeAt(r._bufferIndex));else _(t)}}function _(e){u=u(e)}function v(e){q(e)?(r.line++,r.column=1,r.offset+=e===-3?2:1,E()):e!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),l.previous=e}function y(e,t){let n=t||{};return n.type=e,n.start=m(),l.events.push([`enter`,n,l]),s.push(n),n}function b(e){let t=s.pop();return t.end=m(),l.events.push([`exit`,t,l]),t}function x(e,t){w(e,t.from)}function S(e,t){t.restore()}function C(e,t){return n;function n(n,r,i){let a,o,s,u;return Array.isArray(n)?f(n):`tokenize`in n?f([n]):d(n);function d(e){return t;function t(t){let n=t!==null&&e[t],r=t!==null&&e.null;return f([...Array.isArray(n)?n:n?[n]:[],...Array.isArray(r)?r:r?[r]:[]])(t)}}function f(e){return a=e,o=0,e.length===0?i:p(e[o])}function p(e){return n;function n(n){return u=T(),s=e,e.partial||(l.currentConstruct=e),e.name&&l.parser.constructs.disable.null.includes(e.name)?h(n):e.tokenize.call(t?Object.assign(Object.create(l),t):l,c,m,h)(n)}}function m(t){return e(s,u),r}function h(e){return u.restore(),++o<a.length?p(a[o]):i}}}function w(e,t){e.resolveAll&&!a.includes(e)&&a.push(e),e.resolve&&W(l.events,t,l.events.length-t,e.resolve(l.events.slice(t),l)),e.resolveTo&&(l.events=e.resolveTo(l.events,l))}function T(){let e=m(),t=l.previous,n=l.currentConstruct,i=l.events.length,a=Array.from(s);return{from:i,restore:o};function o(){r=e,l.previous=t,l.currentConstruct=n,l.events.length=i,s=a,E()}}function E(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function ea(e,t){let n=t.start._index,r=t.start._bufferIndex,i=t.end._index,a=t.end._bufferIndex,o;if(n===i)o=[e[n].slice(r,a)];else{if(o=e.slice(n,i),r>-1){let e=o[0];typeof e==`string`?o[0]=e.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function ta(e,t){let n=-1,r=[],i;for(;++n<e.length;){let a=e[n],o;if(typeof a==`string`)o=a;else switch(a){case-5:o=`\r`;break;case-4:o=`
@@ -1 +1 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,r as n,t as r}from"./jsx-runtime-CvVXOszc.js";import{A as i,B as a,C as o,H as s,I as c,K as l,L as u,N as d,P as f,R as p,S as m,V as h,X as g,Y as _,et as ee,f as v,g as te,h as y,lt as b,n as x,nt as S,p as C,t as ne,x as w,y as T,z as E}from"./useMediaQuery-C_1CV_iW.js";import{A as re,C as ie,D as ae,O as oe,c as D,j as se,n as O,p as ce,r as k}from"./useVoiceRecorder-DBzM_HIx.js";import{t as A}from"./chevron-left-D9z1aK3p.js";import{t as le}from"./file-text-BJDCb334.js";import{i as ue,t as j}from"./graph-labels-CEDmX7qW.js";import{t as de}from"./triangle-alert-CuWcGaRo.js";import{i as fe,n as pe,t as me}from"./file-download-B7zwa78w.js";var he=S(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ge=S(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),M=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),_e=S(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ve=S(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ye=S(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),N=S(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),be=S(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),P=e(t(),1);function xe(){let[e,t]=(0,P.useState)([]),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(null),o=(0,P.useRef)(null),s=(0,P.useCallback)(e=>{a(null);let n=e.find(e=>!k(e.type,se));if(n){a(`Unsupported file type: "${n.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, zip, voice notes.`);return}let r=e.find(e=>e.size>re);if(r){a(`"${r.name}" exceeds the 50 MB limit.`);return}t(t=>[...t,...e].slice(0,5))},[]);return{pendingFiles:e,setPendingFiles:t,isDragOver:n,attachError:i,setAttachError:a,fileInputRef:o,addFiles:s,clearFiles:(0,P.useCallback)(()=>{t([]),a(null)},[]),removeFile:(0,P.useCallback)(e=>{t(t=>t.filter((t,n)=>n!==e))},[]),onDragOver:(0,P.useCallback)(e=>{e.preventDefault(),r(!0)},[]),onDragLeave:(0,P.useCallback)(()=>{r(!1)},[]),onDrop:(0,P.useCallback)(e=>{e.preventDefault(),r(!1),s([...e.dataTransfer.files])},[s])}}var F=[[128512],[128515],[128516],[128513],[128518],[128517],[128514],[129315],[128578],[128579],[128521],[128522],[128519],[128525],[128536],[128535],[128540],[128541],[129303],[129300],[128528],[128566],[128564],[128526],[129395],[128546],[128557],[128548],[128544],[128533],[128556],[129393],[128077],[128078],[128076],[128591],[128079],[128588],[128170],[128075],[129309],[10084,65039],[128293],[11088],[127881],[10024],[128175],[128064]].map(e=>String.fromCodePoint(...e));function Se(e,t,n,r){let i=e.length,a=Math.max(0,Math.min(n??i,i)),o=Math.max(a,Math.min(r??a,i));return{value:e.slice(0,a)+t+e.slice(o),caret:a+t.length}}var I=r();function Ce({onSelect:e}){return(0,I.jsx)(`div`,{className:`wa-emoji-popover`,role:`menu`,"aria-label":`Emoji picker`,children:F.map((t,n)=>(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,className:`wa-emoji-item`,onClick:()=>e(t),children:t},n))})}function we({sessionKey:e,onPick:t,onClose:n}){let[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),f=(0,P.useCallback)(t=>{d(!0),l(null),fetch(`/api/admin/files?path=${encodeURIComponent(t)}&session_key=${encodeURIComponent(e)}`).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error??`Could not list files`);return t}).then(e=>{o(e),i(e.path===`.`?``:e.path)}).catch(e=>l(e instanceof Error?e.message:String(e))).finally(()=>d(!1))},[e]);(0,P.useEffect)(()=>{f(``)},[f]);let p=e=>f(r?`${r}/${e}`:e),m=()=>{let e=r.split(`/`).filter(Boolean);e.pop(),f(e.join(`/`))},h=e=>{let n=e.entryPath??e.name;t({path:r?`${r}/${n}`:n,name:e.displayName??e.name})};return(0,I.jsx)(`div`,{className:`wa-picker-backdrop`,role:`dialog`,"aria-label":`Choose a device file`,onClick:n,children:(0,I.jsxs)(`div`,{className:`wa-picker`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`div`,{className:`wa-picker-head`,children:[r&&(0,I.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:m,"aria-label":`Up one folder`,children:(0,I.jsx)(A,{size:18})}),(0,I.jsx)(`span`,{className:`wa-picker-title`,children:r||`Device storage`}),(0,I.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:n,"aria-label":`Close file picker`,children:(0,I.jsx)(c,{size:18})})]}),s&&(0,I.jsx)(`p`,{className:`wa-picker-error`,role:`alert`,children:s}),u&&(0,I.jsx)(`p`,{className:`wa-picker-empty`,children:`Loading…`}),a&&!u&&(0,I.jsxs)(`ul`,{className:`wa-picker-list`,children:[a.entries.length===0&&(0,I.jsx)(`li`,{className:`wa-picker-empty`,children:`This folder is empty.`}),a.entries.map(e=>(0,I.jsx)(`li`,{children:e.kind===`directory`?(0,I.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>p(e.name),children:[(0,I.jsx)(_,{size:16,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):e.kind===`file`?(0,I.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>h(e),children:[(0,I.jsx)(le,{size:16,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):null},e.name))]})]})})}var Te=n();function Ee(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function L({transport:e,sessionKey:t,replyTo:n,onClearReply:r,features:i}){let a=i?.attachments!==!1,o=i?.voice!==!1,s=i?.deviceFiles!==!1,l=i?.quote!==!1,[d,f]=(0,P.useState)(``),[m,g]=(0,P.useState)(!1),[_,ee]=(0,P.useState)(null),[v,te]=(0,P.useState)(!1),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)([]),T=(0,P.useRef)(null),{pendingFiles:E,attachError:re,setAttachError:ie,addFiles:D,removeFile:se,clearFiles:ce}=xe(),{state:k,elapsedSeconds:A,errorMessage:ue,start:j,send:de,discard:fe}=O(),pe=k===`recording`||k===`paused`,me=(0,P.useCallback)(()=>{j()},[j]),he=(0,P.useCallback)(async()=>{let e=await de();if(e){let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`;D([new File([e],`voice-note${t}`,{type:e.type})])}},[A,de,D]),ge=(0,P.useCallback)(()=>{fe()},[A,fe]),_e=(0,P.useRef)(!1),ve=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[be,F]=(0,P.useState)(null),[L,R]=(0,P.useState)(null),z=(0,P.useRef)(null),De=(0,P.useCallback)(e=>{let t=z.current;t&&F(Math.min(ve(),Math.max(44,t.startH+(t.startY-e.clientY))))},[]),B=(0,P.useCallback)(()=>{z.current=null,window.removeEventListener(`pointermove`,De),window.removeEventListener(`pointerup`,B)},[De]),Oe=(0,P.useCallback)(e=>{z.current={startY:e.clientY,startH:T.current?.offsetHeight??44},window.addEventListener(`pointermove`,De),window.addEventListener(`pointerup`,B),e.preventDefault()},[De,B]),ke=(0,P.useCallback)(e=>{let t=be??T.current?.offsetHeight??44,n=null;e.key===`ArrowUp`?(e.preventDefault(),n=Math.min(ve(),t+24)):e.key===`ArrowDown`&&(e.preventDefault(),n=Math.max(44,t-24)),n!==null&&F(n)},[be]),Ae=(0,P.useRef)(``);(0,P.useEffect)(()=>{let e=T.current;if(!e)return;let t=Ae.current!==``&&d===``;if(Ae.current=d,be!==null){t&&F(null);return}let n=e.style.height;e.style.height=`auto`;let r=Math.min(ve(),Math.max(44,e.scrollHeight));e.style.height=n,R(r)},[d,be]);let V=(d.trim().length>0||E.length>0||C.length>0)&&!m,je=(0,P.useCallback)(async()=>{if(!_e.current&&!(d.trim().length===0&&E.length===0&&C.length===0)){_e.current=!0,g(!0),ee(null);try{let i=`${e.endpoint}?session_key=${encodeURIComponent(t)}`,a;if(E.length>0||C.length>0){let t=new FormData;for(let[n,r]of Object.entries(e.fields))t.append(n,r);d.trim()&&t.append(`text`,d);for(let e of E)t.append(`files`,e);for(let e of C)t.append(`fileRefs`,e.path);n&&t.append(`quotedId`,n.msgKeyId),a=await fetch(i,{method:`POST`,body:t})}else a=await fetch(i,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e.fields,text:d,...n?{quotedId:n.msgKeyId}:{}})});let o=await a.json().catch(()=>({}));if(!a.ok){ee(o.error??`Send failed.`),console.warn(`[operator-ui] op=reply-fail endpoint=${e.endpoint} error=${o.error??`unknown`}`);return}f(``),ce(),w([]),r?.()}catch(t){ee(`Could not reach the server. Try again.`),console.warn(`[operator-ui] op=reply-fail endpoint=${e.endpoint} error=${String(t)}`)}finally{_e.current=!1,g(!1)}}},[d,E,C,n,r,e,t,ce]),Me=(0,P.useCallback)(e=>{let t=T.current,{value:n,caret:r}=Se(d,e,t?t.selectionStart:null,t?t.selectionEnd:null);f(n),te(!1),requestAnimationFrame(()=>{let e=T.current;e&&(e.focus(),e.setSelectionRange(r,r))})},[d]),Ne=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),V&&je())},Pe=e=>e.dataTransfer.types.includes(`Files`),Fe=(0,P.useCallback)(e=>{Pe(e)&&(e.preventDefault(),a&&S(!0))},[a]),Ie=(0,P.useCallback)(()=>S(!1),[]),Le=(0,P.useCallback)(e=>{if(!Pe(e))return;e.preventDefault(),S(!1);let t=[...e.dataTransfer.files];if(t.length!==0){if(!a){ie(`This conversation takes text only. Attachments cannot be sent here.`);return}Math.max(0,E.length+t.length-5),D(t)}},[E.length,D,a,ie]),Re=e=>e.startsWith(`image/`)?(0,I.jsx)(M,{size:14}):e===`application/pdf`?(0,I.jsx)(le,{size:14}):(0,I.jsx)(oe,{size:14}),ze=ne(`(max-width: 720px)`),[H,Be]=(0,P.useState)(null);(0,P.useEffect)(()=>{Be(ze?document.querySelector(`.admin-footer`):null)},[ze]);let Ve=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-emoji`,onClick:()=>te(e=>!e),disabled:m,"aria-label":`Emoji`,"aria-expanded":v,children:(0,I.jsx)(N,{size:22})}),(a||s)&&(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:()=>b(!0),disabled:m,"aria-label":`Attach files`,children:(0,I.jsx)(h,{size:22})})]});return(0,I.jsxs)(`div`,{className:`wa-reply${x?` wa-reply-drag-over`:``}`,onDragOver:Fe,onDragLeave:Ie,onDrop:Le,children:[y&&(0,I.jsx)(we,{sessionKey:t,onPick:e=>{w(t=>[...t,e].slice(0,5)),b(!1)},onClose:()=>b(!1)}),v&&(0,I.jsx)(Ce,{onSelect:Me}),_&&(0,I.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:_}),re&&(0,I.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:re}),k===`error`&&ue&&(0,I.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:ue}),(E.length>0||C.length>0)&&(0,I.jsxs)(`div`,{className:`wa-reply-attachments`,children:[E.map((e,t)=>(0,I.jsxs)(`div`,{className:`wa-reply-chip`,children:[Re(e.type),(0,I.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>se(t),"aria-label":`Remove ${e.name}`,children:(0,I.jsx)(c,{size:12})})]},`f-${t}`)),C.map((e,t)=>(0,I.jsxs)(`div`,{className:`wa-reply-chip wa-reply-chip-ref`,children:[(0,I.jsx)(le,{size:14}),(0,I.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>w(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:(0,I.jsx)(c,{size:12})})]},`r-${t}`))]}),l&&n&&(0,I.jsxs)(`div`,{className:`wa-reply-quote`,children:[(0,I.jsxs)(`div`,{className:`wa-reply-quote-body`,children:[(0,I.jsx)(`span`,{className:`wa-reply-quote-who`,children:n.fromMe?`You`:n.senderName??`Contact`}),(0,I.jsx)(`span`,{className:`wa-reply-quote-text`,children:n.body||`Message`})]}),(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-quote-cancel`,onClick:()=>r?.(),"aria-label":`Cancel reply`,children:(0,I.jsx)(c,{size:14})})]}),!pe&&(0,I.jsx)(`div`,{className:`wa-reply-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:Oe,onKeyDown:ke}),(0,I.jsx)(`div`,{className:`wa-reply-row`,children:pe?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:ge,"aria-label":`Cancel recording`,children:(0,I.jsx)(u,{size:20})}),(0,I.jsxs)(`span`,{className:`wa-rec-live`,role:`status`,children:[(0,I.jsx)(`span`,{className:`wa-rec-dot`,"aria-hidden":!0}),Ee(A)]}),(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void he(),"aria-label":`Stop recording`,children:(0,I.jsx)(p,{size:20})})]}):(0,I.jsxs)(I.Fragment,{children:[H?(0,Te.createPortal)((0,I.jsx)(`div`,{className:`wa-reply-footer-actions`,children:Ve}),H):Ve,(0,I.jsxs)(`div`,{className:`wa-reply-inputwrap`,children:[(0,I.jsx)(`textarea`,{ref:T,className:`wa-reply-input`,value:d,rows:1,style:{height:`${be??L??44}px`},placeholder:`Type a message`,disabled:m,onChange:e=>f(e.target.value),onKeyDown:Ne}),o&&d.length===0&&(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-mic`,onClick:()=>void me(),disabled:m,"aria-label":`Record voice note`,children:(0,I.jsx)(ae,{size:22})})]}),(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void je(),disabled:!V,"aria-label":`Send`,children:(0,I.jsx)(ye,{size:20})})]})})]})}function R({accountId:e,channelKey:t,contactName:n,sessionKey:r,sendable:i=!0,onBack:a}){let o=t.slice(t.indexOf(`:`)+1),s=n===o?void 0:o;return(0,I.jsxs)(`div`,{className:`wa-web tg-web`,children:[(0,I.jsxs)(`header`,{className:`wa-web-header`,children:[a&&(0,I.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:a,"aria-label":`Back`,children:(0,I.jsx)(A,{size:20})}),(0,I.jsx)(`span`,{className:`wa-web-avatar`,"aria-hidden":!0,children:(0,I.jsx)(ie,{size:20})}),(0,I.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,I.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,I.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]})]}),(0,I.jsx)(`div`,{className:`wa-web-body`,"data-testid":`telegram-web-conversation`,children:(0,I.jsx)(D,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{channel:`telegram`,accountId:e,channelKey:t}})}),i&&(0,I.jsx)(L,{transport:{endpoint:`/api/telegram-reader/send`,fields:{accountId:e,channelKey:t}},sessionKey:r,features:{attachments:!1,voice:!1,deviceFiles:!1,quote:!1}})]})}function z({accountId:e,remoteJid:t,contactName:n,sessionKey:r,onBack:i}){let a=te(t),o=t.split(`@`)[0],s=a?`Group`:n===`+${o}`?void 0:`+${o}`,[l,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(``),p=()=>{u(!1),f(``)},[m,h]=(0,P.useState)(null);return(0,I.jsxs)(`div`,{className:`wa-web`,children:[(0,I.jsxs)(`header`,{className:`wa-web-header`,children:[i&&(0,I.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:i,"aria-label":`Back`,children:(0,I.jsx)(A,{size:20})}),(0,I.jsx)(ce,{accountId:e,jid:t,sessionKey:r}),l?(0,I.jsxs)(`div`,{className:`wa-web-search`,children:[(0,I.jsx)(ue,{size:18,"aria-hidden":!0}),(0,I.jsx)(`input`,{className:`wa-web-search-input`,type:`text`,autoFocus:!0,placeholder:`Search messages`,"aria-label":`Search messages`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`&&p()}}),(0,I.jsx)(`button`,{type:`button`,className:`wa-web-search-close`,onClick:p,"aria-label":`Close search`,children:(0,I.jsx)(c,{size:18})})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,I.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,I.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]}),(0,I.jsx)(`button`,{type:`button`,className:`wa-web-search-toggle`,onClick:()=>u(!0),"aria-label":`Search messages`,children:(0,I.jsx)(ue,{size:20})})]})]}),(0,I.jsx)(`div`,{className:`wa-web-body`,children:(0,I.jsx)(D,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{channel:`whatsapp`,accountId:e,remoteJid:t},search:l?d:void 0,onReplyTo:h,groupThread:a})}),(0,I.jsx)(L,{transport:{endpoint:`/api/whatsapp-reader/reply`,fields:{accountId:e,remoteJid:t}},sessionKey:r,replyTo:m,onClearReply:()=>h(null)})]})}function De(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||j.has(e)&&(t.add(e),n.push(e)));return n}function B(e,t){return m(e,t)}function Oe({conversations:e,sessionKey:t,onBack:n}){let{zone:r}=o(),[i,a]=(0,P.useState)(null),s=v(e);return i?i.source===`store`&&i.channel===`telegram`&&i.accountId&&i.channelKey?(0,I.jsx)(R,{accountId:i.accountId,channelKey:i.channelKey,contactName:C(i),sessionKey:t,onBack:()=>a(null)},y(i)):i.source===`store`&&i.accountId&&i.remoteJid?(0,I.jsx)(z,{accountId:i.accountId,remoteJid:i.remoteJid,contactName:C(i),sessionKey:t,onBack:()=>a(null)},y(i)):(0,I.jsxs)(`div`,{className:`op-conv op-conv-reader`,children:[(0,I.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:()=>a(null),"aria-label":`Back to conversations`,children:[(0,I.jsx)(A,{size:16}),` Back`]}),(0,I.jsx)(`span`,{className:`op-conv-title`,children:C(i)})]}),(0,I.jsx)(D,{sessionId:i.sessionId,projectDir:i.projectDir,sessionKey:t,forceDeliveredOnly:!0,suppressDirectives:i.source===`store`,store:i.source===`store`?{channel:`whatsapp`,accountId:i.accountId,remoteJid:i.remoteJid}:void 0},y(i))]}):(0,I.jsxs)(`div`,{className:`op-conv op-conv-list`,children:[(0,I.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:n,"aria-label":`Back to chat`,children:[(0,I.jsx)(A,{size:16}),` Chat`]}),(0,I.jsx)(`span`,{className:`op-conv-title`,children:`Conversations`})]}),s.map(e=>(0,I.jsxs)(`div`,{className:`op-conv-group`,children:[(0,I.jsxs)(`div`,{className:`op-conv-group-head`,children:[(0,I.jsx)(T,{channel:e.channel,size:14}),e.label]}),e.rows.map(e=>(0,I.jsxs)(`button`,{type:`button`,className:`op-conv-row`,onClick:()=>{a(e)},children:[e.source===`store`&&e.accountId&&e.remoteJid&&(0,I.jsx)(ce,{accountId:e.accountId,jid:e.remoteJid,sessionKey:t,className:`op-conv-avatar`,size:16}),(0,I.jsx)(`span`,{className:`op-conv-name`,children:C(e)}),e.modelGated&&(0,I.jsx)(`span`,{className:`op-conv-gated`,role:`img`,"aria-label":`Model unavailable`,children:(0,I.jsx)(de,{size:13})}),(0,I.jsx)(`span`,{className:`op-conv-when`,children:B(e.lastMessageAt,r)})]},y(e)))]},e.channel))]})}var ke=/\.(png|jpe?g|gif|webp|svg)$/i;function Ae(e){return ke.test(e)}function V(e){return e.entryPath??e.name}var je=`maxy-data-view`,Me=95*1024*1024,Ne=48*1024*1024;function Pe(){return typeof window>`u`?`list`:window.localStorage.getItem(je)===`grid`?`grid`:`list`}function Fe(){let[e,t]=(0,P.useState)(null),[n,r]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]),n?e?(0,I.jsx)(f,{cacheKey:e,surface:`data`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=data`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,I.jsx)(w,{cacheKey:e,children:(0,I.jsx)(`div`,{className:`data-page data-page-full`,children:(0,I.jsx)(Ie,{cacheKey:e})})})}):(0,I.jsx)(`div`,{className:`data-page`,children:(0,I.jsxs)(`div`,{className:`data-empty`,children:[(0,I.jsx)(`p`,{children:`You are not signed in.`}),(0,I.jsxs)(`p`,{children:[`Open the `,(0,I.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,I.jsx)(d,{surface:`gate`})}function Ie({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=b({initialCacheKey:e,surface:`data`});return(0,I.jsx)(W,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})}function Le(){if(typeof window>`u`)return`@home`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`@home`}function Re(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=e===`.`||e===`@home`?``:`path=${encodeURIComponent(e)}`,window.history.replaceState(window.history.state,``,t.toString())}function ze(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function H(e){return new Promise((t,n)=>e.file(t,n))}async function Be(e,t=``){let n=[];for(let r of e){if(!r)continue;let e=t?`${t}/${r.name}`:r.name;if(r.isFile)n.push({file:await H(r),relpath:e});else if(r.isDirectory){let t=await ze(r.createReader());n.push(...await Be(t,e))}}return n}function Ve(e,t){if(e===422&&typeof t==`string`){if(/exceeds the .* limit/i.test(t))return`size`;if(/unsupported file type/i.test(t))return`mime`}return`http=${e}`}function U({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let{zone:r}=o(),[i,f]=(0,P.useState)(``),p=(0,P.useRef)(null),[m,h]=(0,P.useState)(``),[v,te]=(0,P.useState)(null),[y,b]=(0,P.useState)(`hybrid`),[x,S]=(0,P.useState)(!1),[C,ne]=(0,P.useState)(null),[w,T]=(0,P.useState)(null),[re,ie]=(0,P.useState)(0),[ae,oe]=(0,P.useState)(!1),[D,se]=(0,P.useState)(()=>Le()),[O,ce]=(0,P.useState)(null),[k,A]=(0,P.useState)(()=>Pe()),[j,de]=(0,P.useState)(null),[M,ye]=(0,P.useState)([]),[N,xe]=(0,P.useState)(null),[F,Se]=(0,P.useState)(0),[Ce,we]=(0,P.useState)(null),Te=(0,P.useRef)(null),Ee=M.slice(0,-1).map(e=>e.name).join(`/`),L=(()=>{let e=M.map(e=>e.name);return e.length>=2&&e[0]===`accounts`?`${e[0]}/${e[1]}`:null})(),R=N?Ee:D,z=(0,P.useCallback)(e=>R===`.`||R===``?e:`${R}/${e}`,[R]),[B,Oe]=(0,P.useState)(!1),[ke,Fe]=(0,P.useState)(!1),[Ie,ze]=(0,P.useState)(null),[H,U]=(0,P.useState)(!1),[W,G]=(0,P.useState)(null),[We,Ge]=(0,P.useState)(null),[Ke,Ye]=(0,P.useState)(null),[Xe,Ze]=(0,P.useState)(!1),[Qe,$e]=(0,P.useState)(null),et=(0,P.useRef)(null),[tt,nt]=(0,P.useState)(0),[rt,it]=(0,P.useState)(!1),[at,ot]=(0,P.useState)(``),[st,ct]=(0,P.useState)(null),[lt,ut]=(0,P.useState)(``),[dt,ft]=(0,P.useState)(null),K=(()=>{let e=D===`.`?[]:D.split(`/`).filter(Boolean);return e.some(e=>e.startsWith(`@`))?!1:e.length>=2&&e[0]===`accounts`})(),[pt,mt]=(0,P.useState)(!1),ht=(0,P.useRef)(null),[gt,q]=(0,P.useState)(!1),_t=(0,P.useRef)(null);(0,P.useEffect)(()=>{let e=i.trim();if(!e){h(``),te(null),ne(null);return}oe(!1);let t=setTimeout(()=>h(e),300);return()=>clearTimeout(t)},[i]),(0,P.useEffect)(()=>{if(!m){S(!1);return}let t=!1;return S(!0),ne(null),e(`/api/admin/graph-search?q=${encodeURIComponent(m)}&labels=FileArtifact&limit=20${ae?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(te(e.results),b(e.mode??`hybrid`),ie(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||ne(e instanceof Error?e.message:String(e))}).finally(()=>{t||S(!1)}),()=>{t=!0}},[m,e,n,ae]);let vt=(0,P.useMemo)(()=>v?De(v):[],[v]),yt=w&&vt.includes(w)?w:null,bt=(0,P.useMemo)(()=>v?yt?v.filter(e=>e.labels.includes(yt)):v:null,[v,yt]),xt=(0,P.useCallback)(e=>{let n=e.properties.relativePath;if(typeof n!=`string`||n.length===0)return;let r=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()},[t]);(0,P.useEffect)(()=>{if(!v)return;let e=v.filter(e=>{let t=e.properties.relativePath;return typeof t!=`string`||t.length===0});e.length>0&&console.warn(`[data-search] op=locate-link-missing nodeId=${e.map(e=>e.nodeId).join(`,`)}`)},[v]),(0,P.useEffect)(()=>{let t=!1;return Oe(!0),ze(null),e(`/api/admin/files?path=${encodeURIComponent(D===`.`?``:D)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ce(e.entries),ye(e.displayPath??[]),xe(e.view??null),Se(typeof e.systemCount==`number`?e.systemCount:0))}).catch(e=>{t||(ce([]),ye([]),xe(null),Se(0),ze(e instanceof Error?e.message:String(e)))}).finally(()=>{t||(Oe(!1),Fe(!0))}),()=>{t=!0}},[e,D,tt,n]),(0,P.useEffect)(()=>{if(N!==null||!L||Te.current===L)return;Te.current=L;let t=!1;return e(`/api/admin/files?path=${encodeURIComponent(`${L}/@home`)}`).then(e=>e.ok?e.json():null).then(e=>{t||!e||we((e.entries??[]).map(e=>e.name))}).catch(e=>{console.warn(`[data-ui] op=rail-buckets status=error reason="${e instanceof Error?e.message:String(e)}"`)}),()=>{t=!0}},[e,N,L]),(0,P.useEffect)(()=>{Re(D)},[D]);let St=(0,P.useCallback)(()=>{nt(e=>e+1)},[]),J=(0,P.useCallback)(e=>{mt(!1),se(e)},[]),Ct=(0,P.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let n=t.lastIndexOf(`/`),r=n===-1?`.`:t.slice(0,n);f(``),ne(null),T(null),J(r)},[J]),wt=(0,P.useCallback)(()=>{if(!D.split(`/`).some(e=>e.startsWith(`@`))){if(D===`.`||D===``)return;let e=D.split(`/`).filter(Boolean);e.pop(),se(e.length===0?`.`:e.join(`/`));return}M.length!==0&&se(M.length>=2?M.slice(0,M.length-1).map(e=>e.name).join(`/`):`.`)},[D,M]),Tt=(0,P.useCallback)(e=>{pe(t,z(V(e)))},[z,t]),[Y,Et]=(0,P.useState)(!1),[X,Dt]=(0,P.useState)(new Set),Ot=(0,P.useRef)(null),Z=(0,P.useRef)(!1),kt=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,At=(0,P.useCallback)(e=>{Et(!0),Dt(new Set([e]))},[]),Q=(0,P.useCallback)(e=>{Et(!1),Dt(new Set)},[]),jt=(0,P.useCallback)(e=>{Dt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Mt=(0,P.useCallback)(e=>{Z.current=!1,Ot.current=setTimeout(()=>{Z.current=!0,At(e)},500)},[At]),$=(0,P.useCallback)(()=>{Ot.current&&=(clearTimeout(Ot.current),null)},[]),Nt=(0,P.useCallback)(e=>{if(Z.current){Z.current=!1;return}if(Y){jt(e.name);return}Tt(e)},[Y,jt,Tt]),Pt=(0,P.useCallback)(e=>{A(e),typeof window<`u`&&window.localStorage.setItem(je,e)},[]),Ft=(0,P.useCallback)(e=>{if(Z.current){Z.current=!1;return}if(Y){jt(e.name);return}de({src:me(t,z(V(e))),alt:e.displayName??e.name})},[Y,jt,z,t]),It=(0,P.useCallback)(()=>(O??[]).filter(e=>e.kind===`file`&&X.has(e.name)),[O,X]),Lt=(0,P.useCallback)(()=>{if(X.size!==1)return null;let e=(O??[]).find(e=>X.has(e.name));return e&&!e.entryPath?e:null},[O,X]),Rt=(0,P.useCallback)(()=>(O??[]).filter(e=>(e.kind===`file`||e.kind===`directory`)&&X.has(e.name)),[O,X]),zt=(0,P.useCallback)(()=>{let e=Rt(),n=e.some(e=>e.kind===`directory`);e.length===1&&!n?Tt(e[0]):e.length>=1&&fe(t,e.map(e=>z(V(e)))),Q(`action`)},[Rt,Tt,z,t,Q]),Bt=(0,P.useCallback)(async()=>{let t=It(),n=t.filter(e=>!e.protected),r=t.length-n.length;$e(r>0?`${r} protected file(s) kept`:null);for(let t of n){let n=z(V(t));try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`)}catch(e){$e(e instanceof Error?e.message:String(e))}}nt(e=>e+1),Q(`action`)},[It,z,e,Q]),Vt=(0,P.useCallback)(async()=>{let e=It();if(kt)try{let n=await Promise.all(e.map(async e=>{let n=z(V(e)),r=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,i=await(await fetch(r)).blob();return new File([i],e.displayName??e.name,{type:i.type||`application/octet-stream`})}));navigator.canShare({files:n})&&await navigator.share({files:n})}catch(e){console.warn(`[data-ui] op=share-failed err=${e instanceof Error?e.message:String(e)}`)}},[It,kt,z,t]),Ht=(0,P.useCallback)(()=>{et.current?.click()},[]),Ut=(0,P.useCallback)((e,n={})=>{let r=(r,i,a)=>{let o=new URLSearchParams({session_key:t,path:D===`.`?``:D,filename:e.name});n.relpath&&o.set(`relpath`,n.relpath),n.token&&o.set(`token`,n.token);for(let[e,t]of Object.entries(i))o.set(e,t);return new Promise(t=>{let n=new XMLHttpRequest;n.open(`POST`,`/api/admin/files/upload?${o.toString()}`),n.setRequestHeader(`Content-Type`,e.type||`application/octet-stream`),a&&(n.upload.onprogress=e=>{e.lengthComputable&&a(e.loaded)}),n.onload=()=>{let e={};try{e=JSON.parse(n.responseText)}catch{}t({status:n.status,data:e})},n.onerror=()=>t({status:0,data:{}}),n.onabort=()=>t({status:0,data:{error:`aborted`}}),n.send(r)})};if(e.size<=Me)return r(e,{},t=>n.onProgress?.(t,e.size));let i=`${Date.now().toString(36)}-${Math.random().toString(16).slice(2,10)}`,a=Math.ceil(e.size/Ne);return(async()=>{let t={status:0,data:{}};for(let o=0;o<a;o++){let s=o*Ne;if(t=await r(e.slice(s,Math.min(s+Ne,e.size)),{uploadId:i,seq:String(o),total:String(a)},t=>n.onProgress?.(s+t,e.size)),!(t.status>=200&&t.status<300))return t}return t})()},[t,D]),Wt=(0,P.useCallback)(async e=>{Ge(null),U(!0),G({loaded:0,total:e.size});try{let{status:t,data:n}=await Ut(e,{onProgress:(e,t)=>G({loaded:e,total:t})});t>=200&&t<300&&n.path?(se(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),nt(e=>e+1)):Ge(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{U(!1),G(null),et.current&&(et.current.value=``)}},[Ut]),Gt=(0,P.useCallback)(e=>{K&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Ze(!0))},[K]),Kt=(0,P.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Ze(!1)},[]),qt=(0,P.useCallback)(async e=>{e.preventDefault(),Ze(!1);let t=Math.random().toString(16).slice(2,10),n=Array.from(e.dataTransfer.items);if(n.length===0)return;if(!K){Ge(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);U(!0),Ge(null),Ye(null);try{let e=await Be(r),n=0,i=[];for(let r=0;r<e.length;r++){let{file:a,relpath:o}=e[r];G({loaded:0,total:a.size});let{status:s,data:c}=await Ut(a,{relpath:o,token:t,onProgress:(e,t)=>G({loaded:e,total:t})});if(s>=200&&s<300)n++;else{let e=s===0?`http=0`:Ve(s,c.error);i.push(`${o} (${e})`)}}Ye(`Uploaded ${n}, skipped ${i.length}${i.length?`: ${i.join(`, `)}`:``}`),nt(e=>e+1)}catch(e){Ge(e instanceof Error?e.message:String(e))}finally{U(!1),G(null)}},[K,Ut]),Jt=(0,P.useCallback)(async()=>{let t=at.trim();if(t){ft(null);try{let n=await e(`/api/admin/files/folder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:D===`.`?``:D,name:t})}),r=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(r.error??`HTTP ${n.status}`);it(!1),ot(``),nt(e=>e+1)}catch(e){ft(e instanceof Error?e.message:String(e))}}},[e,at,D]),Yt=(0,P.useCallback)(async()=>{if(!st)return;let t=lt.trim();if(!t)return;ft(null);let n=z(st);try{let r=await e(`/api/admin/files/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,newName:t})}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);ct(null),ut(``),Q(`action`),nt(e=>e+1)}catch(e){ft(e instanceof Error?e.message:String(e))}},[e,lt,st,z,Q]);(0,P.useEffect)(()=>{if(!pt)return;let e=e=>{ht.current&&!ht.current.contains(e.target)&&mt(!1)},t=e=>{e.key===`Escape`&&mt(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[pt]),(0,P.useEffect)(()=>{if(!gt)return;let e=e=>{_t.current&&!_t.current.contains(e.target)&&q(!1)},t=e=>{e.key===`Escape`&&q(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[gt]);let Xt=(0,P.useCallback)(e=>M.slice(0,e+1).map(e=>e.name).join(`/`),[M]),Zt=M.length>=2,Qt=Zt?[{name:`.`,label:`data`},...M.slice(0,M.length-2).map((e,t)=>({name:Xt(t),label:e.displayName??e.name}))]:[];return ke?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`data-toolbar`,children:[Y?(0,I.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>Q(`cancel`),"aria-label":`Cancel selection`,children:[(0,I.jsx)(c,{size:14}),` Cancel`]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`data-search-input`,children:[i===``&&(0,I.jsx)(ue,{size:14}),(0,I.jsx)(`input`,{ref:p,type:`text`,value:i,onChange:e=>f(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),x&&(0,I.jsx)(l,{size:14,className:`spin`}),i!==``&&(0,I.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{f(``),p.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,I.jsx)(c,{size:14})})]}),(0,I.jsxs)(`div`,{className:`data-toolbar-actions`,ref:_t,children:[(0,I.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>q(e=>!e),"aria-haspopup":`menu`,"aria-expanded":gt,"aria-label":`File actions`,title:`File actions`,children:(0,I.jsx)(he,{size:16})}),(0,I.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":gt?`true`:void 0,children:[(0,I.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{St(),q(!1)},disabled:B,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[B?(0,I.jsx)(l,{size:16,className:`spin`}):(0,I.jsx)(a,{size:16}),(0,I.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-action-btn admin-btn-cta`,onClick:()=>{Ht(),q(!1)},disabled:H||!K,title:K?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[H?W&&W.total>0?(0,I.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(W.loaded/W.total*100),`%`]}):(0,I.jsx)(l,{size:16,className:`spin`}):(0,I.jsx)(be,{size:16}),(0,I.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{it(e=>!e),ot(``),ft(null),q(!1)},disabled:H||!K,title:K?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,I.jsx)(ge,{size:16}),(0,I.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Pt(k===`grid`?`list`:`grid`),q(!1)},title:k===`grid`?`List view`:`Grid view`,"aria-label":k===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":k===`grid`,children:[k===`grid`?(0,I.jsx)(ve,{size:16}):(0,I.jsx)(_e,{size:16}),(0,I.jsx)(`span`,{className:`data-action-label`,children:k===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,I.jsxs)(`div`,{className:`data-breadcrumbs`,children:[D!==`.`&&(0,I.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:wt,title:`Up one level`,"aria-label":`Up one level`,children:(0,I.jsx)(ee,{size:14})}),Zt?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{className:`data-crumb-wrap`,ref:ht,children:[(0,I.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>mt(e=>!e),"aria-haspopup":`menu`,"aria-expanded":pt,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),pt&&(0,I.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Qt.map(e=>(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>J(e.name),title:e.label,children:e.label},e.name))})]}),[M.length-2,M.length-1].map(e=>{let t=M[e];return(0,I.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,I.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,I.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>J(Xt(e)),title:t.name,children:t.displayName??t.name})]},Xt(e))})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>J(`.`),children:`data`}),M.map((e,t)=>(0,I.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,I.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,I.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>J(Xt(t)),title:e.name,children:e.displayName??e.name})]},Xt(t)))]})]}),rt&&(0,I.jsxs)(`div`,{className:`data-inline-form`,children:[(0,I.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:at,autoFocus:!0,onChange:e=>ot(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Jt(),e.key===`Escape`&&it(!1)}}),(0,I.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Jt,children:`Create`}),(0,I.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>it(!1),children:`Cancel`})]}),st&&(0,I.jsxs)(`div`,{className:`data-inline-form`,children:[(0,I.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:lt,autoFocus:!0,onChange:e=>ut(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Yt(),e.key===`Escape`&&ct(null)}}),(0,I.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Yt,children:`Rename`}),(0,I.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>ct(null),children:`Cancel`})]}),dt&&(0,I.jsx)(`div`,{className:`data-error`,children:dt}),(0,I.jsx)(`input`,{type:`file`,ref:et,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&Wt(t)}})]}),(0,I.jsxs)(`div`,{className:`data-body`,"data-drag-active":Xe?`true`:void 0,onDragEnter:Gt,onDragOver:Gt,onDragLeave:Kt,onDrop:qt,children:[N===null&&L&&Ce&&Ce.length>0&&(0,I.jsxs)(`aside`,{className:`data-rail`,"aria-label":`Folders`,children:[(0,I.jsx)(`span`,{className:`data-rail-label`,children:`Folders`}),(0,I.jsx)(`ul`,{className:`data-rail-list`,children:Ce.map(e=>{let t=`${L}/${e}`,n=D===t||D.startsWith(`${t}/`);return(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,className:`data-rail-item`,"aria-current":n?`true`:void 0,onClick:()=>J(t),children:[(0,I.jsx)(_,{size:13}),(0,I.jsx)(`span`,{className:`data-rail-item-name`,children:e})]})},e)})})]}),(0,I.jsxs)(`div`,{className:`data-content`,children:[(C!==null||v!==null)&&(0,I.jsxs)(`section`,{className:`data-panel admin-card`,children:[C&&(0,I.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,C]}),vt.length>0&&(0,I.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:vt.map(e=>{let t=e===yt;return(0,I.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>T(t?null:e),children:Ue([e])??e},e)})}),v&&!x&&(0,I.jsxs)(`div`,{className:`data-results-meta`,children:[bt.length,` of `,v.length,` result`,v.length===1?``:`s`]}),v&&!x&&!yt&&re>0&&!ae&&(0,I.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!0),children:[re,` low-confidence result`,re===1?``:`s`,` hidden — show all`]}),v&&!x&&!yt&&ae&&(0,I.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!1),children:`Showing all results — hide low-confidence`}),v&&v.length===0&&!x&&(0,I.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),bt&&bt.length>0&&(0,I.jsx)(`ul`,{className:`data-results`,children:bt.map(e=>(0,I.jsx)(He,{hit:e,mode:y,onDownload:xt,onLocate:Ct},e.nodeId))})]}),(0,I.jsxs)(`section`,{className:N===`home`?`data-panel data-panel--wide`:`data-panel data-panel--wide admin-card`,children:[W&&(0,I.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":W.total>0?Math.round(W.loaded/W.total*100):void 0,children:[(0,I.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,I.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${W.total>0?Math.round(W.loaded/W.total*100):0}%`}})}),(0,I.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,W.total>0?`${Math.round(W.loaded/W.total*100)}%`:``]})]}),We&&(0,I.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,We]}),Ke&&(0,I.jsx)(`div`,{className:`data-status`,children:Ke}),Qe&&(0,I.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,Qe]}),Ie&&(0,I.jsx)(`div`,{className:`data-error`,children:Ie}),B&&(0,I.jsxs)(`div`,{className:`data-loading`,children:[(0,I.jsx)(l,{size:14,className:`spin`}),` Loading…`]}),!B&&N!==`home`&&O&&O.length===0&&!Ie&&(0,I.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!B&&N===`home`&&O&&(0,I.jsxs)(`ul`,{className:`routine-list data-home-list`,children:[O.map(e=>(0,I.jsxs)(`li`,{className:`data-home-card`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`data-home-card-head`,onClick:()=>J(z(e.name)),children:[(0,I.jsx)(`span`,{className:`data-home-card-title`,children:e.name}),(0,I.jsx)(`span`,{className:`data-home-card-count`,children:e.childCount===null||e.childCount===void 0?`—`:`${e.childCount} ${e.childCount===1?`item`:`items`}`})]}),(0,I.jsxs)(`ul`,{className:`data-home-card-children`,children:[e.childCount===null&&(0,I.jsx)(`li`,{className:`data-home-card-error`,children:`Could not read this folder.`}),e.childCount===0&&(0,I.jsx)(`li`,{className:`data-home-card-empty`,children:`Empty.`}),(e.children??[]).map(e=>(0,I.jsxs)(`li`,{className:`data-home-card-child`,children:[e.kind===`directory`?(0,I.jsx)(_,{size:12}):(0,I.jsx)(le,{size:12}),(0,I.jsx)(`span`,{className:`data-home-card-child-name`,children:e.name})]},e.name)),typeof e.childCount==`number`&&e.childCount>(e.children?.length??0)&&(0,I.jsxs)(`li`,{className:`data-home-card-more`,children:[`+`,e.childCount-(e.children?.length??0),` more`]})]})]},e.name)),(0,I.jsxs)(`li`,{className:`data-home-card`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`data-home-card-head`,onClick:()=>J(z(`@system`)),children:[(0,I.jsx)(`span`,{className:`data-home-card-title`,children:`system`}),(0,I.jsxs)(`span`,{className:`data-home-card-count`,children:[F,` `,F===1?`item`:`items`]})]}),(0,I.jsx)(`ul`,{className:`data-home-card-children`,children:(0,I.jsx)(`li`,{className:`data-home-card-empty`,children:`Platform and plugin folders.`})})]})]}),!B&&N!==`home`&&O&&O.length>0&&k===`grid`&&(0,I.jsx)(`ul`,{className:`data-grid`,children:O.map(e=>{let n=e.displayName??e.name,r=Y&&X.has(e.name);if(e.kind===`directory`)return(0,I.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(Z.current){Z.current=!1;return}if(Y){jt(e.name);return}J(z(e.name))},children:[Y&&(0,I.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,I.jsx)(_,{size:28,className:`data-grid-glyph`}),(0,I.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:n})]})},e.name);if(e.kind===`file`){let i=Ae(V(e)),a=z(V(e));return(0,I.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`data-grid-tile${i?` data-grid-tile-image`:``}`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>i?Ft(e):Nt(e),title:Y?void 0:i?`Preview ${n}`:`Download ${n}`,children:[Y&&(0,I.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),i?(0,I.jsx)(`img`,{className:`data-grid-thumb`,src:me(t,a),alt:n,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${a}`)}):(0,I.jsx)(le,{size:28,className:`data-grid-glyph`}),(0,I.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:n}),!i&&(0,I.jsx)(`span`,{className:`data-grid-sub`,children:qe(e.sizeBytes)})]})},e.name)}return(0,I.jsx)(`li`,{className:`data-grid-cell`,children:(0,I.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,I.jsx)(le,{size:28,className:`data-grid-glyph`}),(0,I.jsx)(`span`,{className:`data-grid-label`,children:n}),(0,I.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!B&&N!==`home`&&O&&O.length>0&&k===`list`&&(0,I.jsx)(`ul`,{className:`data-entries`,children:O.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=Y&&X.has(e.name);return(0,I.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(Z.current){Z.current=!1;return}if(Y){jt(e.name);return}J(z(e.name))},children:[Y&&(0,I.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,I.jsx)(_,{size:14}),(0,I.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=Y&&X.has(e.name);return(0,I.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>Nt(e),title:Y?void 0:`Download ${t}`,children:[Y&&(0,I.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{className:`data-entry-text`,children:[(0,I.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,I.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${Je(e.modifiedAt,r)}`,children:[qe(e.sizeBytes),` · `,Je(e.modifiedAt,r)]})]})]})},e.name)}return(0,I.jsx)(`li`,{className:`data-entry`,children:(0,I.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,I.jsxs)(`span`,{className:`data-entry-text`,children:[(0,I.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,I.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]})]}),Y&&(0,I.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,I.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Vt,disabled:!kt||X.size===0,title:kt?`Share selected files`:`Sharing is not supported on this device`,children:[(0,I.jsx)(E,{size:16}),` Share`]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:zt,disabled:X.size===0,children:[(0,I.jsx)(g,{size:16}),` Download`]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=Lt();e&&(ct(e.name),ut(e.name))},disabled:!Lt(),children:[(0,I.jsx)(s,{size:16}),` Rename`]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:Bt,disabled:X.size===0,children:[(0,I.jsx)(u,{size:16}),` Delete`]})]})}),j&&(0,I.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":j.alt,onClick:()=>de(null),children:(0,I.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:j.src,alt:j.alt})})]}):(0,I.jsx)(d,{surface:`gate`})}function W({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let r=(0,P.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),a=(0,P.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[o,s]=(0,P.useState)([]),[c,l]=(0,P.useState)(`files`),{subAccounts:u,activeAccountId:d,switching:f,switchAccount:p}=x(t);return(0,P.useEffect)(()=>{if(!t)return;let e=!1;return fetch(`/api/operator-conversations/conversations?session_key=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||s(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[t]),(0,I.jsxs)(`main`,{className:`data-main`,children:[(0,I.jsx)(i,{variant:`operator`,onNavigate:a,onOpenConversations:o.length>0?()=>l(`conversations`):void 0,onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:r,onDisconnect:async()=>!0,disconnecting:!1,subAccounts:u,activeAccountId:d,switchingAccount:f,onSwitchAccount:p}),c===`conversations`?(0,I.jsx)(Oe,{conversations:o,sessionKey:t,onBack:()=>l(`files`)}):(0,I.jsx)(U,{adminFetch:e,cacheKey:t,sessionRefetchNonce:n})]})}function G({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=b({initialCacheKey:e,surface:`data`});return(0,I.jsx)(`div`,{className:`data-page`,children:(0,I.jsx)(`main`,{className:`data-main`,children:(0,I.jsx)(U,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})})})}function He({hit:e,mode:t,onDownload:n,onLocate:r}){let{zone:i}=o(),a=We(e.properties),s=Ge(e.properties),c=Ue(e.labels),l=Ke(e.properties),[u,d]=(0,P.useState)(!1),f=s&&s.length>280,p=u||!f?s:s?.slice(0,280)+`…`,m=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,h=e.properties.relativePath,g=typeof h==`string`&&h.length>0,ee=g?h.lastIndexOf(`/`):-1,v=g?ee===-1?`data`:h.slice(0,ee):null;return(0,I.jsxs)(`li`,{className:`data-result`,children:[(0,I.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Download ${a??c??`file`}`,children:[c&&(0,I.jsx)(`div`,{className:`data-result-header`,children:(0,I.jsx)(`span`,{className:`data-result-labels`,children:c})}),a&&(0,I.jsx)(`div`,{className:`data-result-title`,children:a}),s&&(0,I.jsx)(`pre`,{className:`data-result-body`,children:p}),(0,I.jsxs)(`div`,{className:`data-result-scores`,children:[l&&(0,I.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,Je(l,i),` · `]}),m]})]}),g&&(0,I.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${v}`,"aria-label":`Locate in ${v}`,children:[(0,I.jsx)(_,{size:12}),v]}),f&&(0,I.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>d(e=>!e),children:u?`Show less`:`Show more`})]})}function Ue(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function We(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function Ge(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Ke(e){for(let t of[`updatedAt`,`modifiedAt`,`fetchedAt`,`createdAt`,`lastModified`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function qe(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function Je(e,t){return m(e,t)||`—`}export{R as i,G as n,z as r,Fe as t};
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,r as n,t as r}from"./jsx-runtime-BCAZhYqz.js";import{A as i,B as a,C as o,H as s,I as c,K as l,L as u,N as d,P as f,R as p,S as m,V as h,X as g,Y as _,et as ee,f as v,g as te,h as y,lt as b,n as x,nt as S,p as C,t as ne,x as w,y as T,z as E}from"./useMediaQuery-CLVRXJMp.js";import{A as re,C as ie,D as ae,O as oe,c as D,j as se,n as O,p as ce,r as k}from"./useVoiceRecorder-BbJad9CQ.js";import{t as A}from"./chevron-left-DV8gIVC9.js";import{t as le}from"./file-text-Cy-IjCf8.js";import{i as ue,t as j}from"./graph-labels-3bstML8n.js";import{t as de}from"./triangle-alert-C-7A00P0.js";import{i as fe,n as pe,t as me}from"./file-download-B7zwa78w.js";var he=S(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ge=S(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),M=S(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),_e=S(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),ve=S(`list`,[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]),ye=S(`send-horizontal`,[[`path`,{d:`M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z`,key:`117uat`}],[`path`,{d:`M6 12h16`,key:`s4cdu5`}]]),N=S(`smile`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M8 14s1.5 2 4 2 4-2 4-2`,key:`1y1vjs`}],[`line`,{x1:`9`,x2:`9.01`,y1:`9`,y2:`9`,key:`yxxnd0`}],[`line`,{x1:`15`,x2:`15.01`,y1:`9`,y2:`9`,key:`1p4y9e`}]]),be=S(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),P=e(t(),1);function xe(){let[e,t]=(0,P.useState)([]),[n,r]=(0,P.useState)(!1),[i,a]=(0,P.useState)(null),o=(0,P.useRef)(null),s=(0,P.useCallback)(e=>{a(null);let n=e.find(e=>!k(e.type,se));if(n){a(`Unsupported file type: "${n.type}". Supported: images, PDF, plain text, markdown, CSV, calendar, zip, voice notes.`);return}let r=e.find(e=>e.size>re);if(r){a(`"${r.name}" exceeds the 50 MB limit.`);return}t(t=>[...t,...e].slice(0,5))},[]);return{pendingFiles:e,setPendingFiles:t,isDragOver:n,attachError:i,setAttachError:a,fileInputRef:o,addFiles:s,clearFiles:(0,P.useCallback)(()=>{t([]),a(null)},[]),removeFile:(0,P.useCallback)(e=>{t(t=>t.filter((t,n)=>n!==e))},[]),onDragOver:(0,P.useCallback)(e=>{e.preventDefault(),r(!0)},[]),onDragLeave:(0,P.useCallback)(()=>{r(!1)},[]),onDrop:(0,P.useCallback)(e=>{e.preventDefault(),r(!1),s([...e.dataTransfer.files])},[s])}}var F=[[128512],[128515],[128516],[128513],[128518],[128517],[128514],[129315],[128578],[128579],[128521],[128522],[128519],[128525],[128536],[128535],[128540],[128541],[129303],[129300],[128528],[128566],[128564],[128526],[129395],[128546],[128557],[128548],[128544],[128533],[128556],[129393],[128077],[128078],[128076],[128591],[128079],[128588],[128170],[128075],[129309],[10084,65039],[128293],[11088],[127881],[10024],[128175],[128064]].map(e=>String.fromCodePoint(...e));function Se(e,t,n,r){let i=e.length,a=Math.max(0,Math.min(n??i,i)),o=Math.max(a,Math.min(r??a,i));return{value:e.slice(0,a)+t+e.slice(o),caret:a+t.length}}var I=r();function Ce({onSelect:e}){return(0,I.jsx)(`div`,{className:`wa-emoji-popover`,role:`menu`,"aria-label":`Emoji picker`,children:F.map((t,n)=>(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,className:`wa-emoji-item`,onClick:()=>e(t),children:t},n))})}function we({sessionKey:e,onPick:t,onClose:n}){let[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[s,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1),f=(0,P.useCallback)(t=>{d(!0),l(null),fetch(`/api/admin/files?path=${encodeURIComponent(t)}&session_key=${encodeURIComponent(e)}`).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.error??`Could not list files`);return t}).then(e=>{o(e),i(e.path===`.`?``:e.path)}).catch(e=>l(e instanceof Error?e.message:String(e))).finally(()=>d(!1))},[e]);(0,P.useEffect)(()=>{f(``)},[f]);let p=e=>f(r?`${r}/${e}`:e),m=()=>{let e=r.split(`/`).filter(Boolean);e.pop(),f(e.join(`/`))},h=e=>{let n=e.entryPath??e.name;t({path:r?`${r}/${n}`:n,name:e.displayName??e.name})};return(0,I.jsx)(`div`,{className:`wa-picker-backdrop`,role:`dialog`,"aria-label":`Choose a device file`,onClick:n,children:(0,I.jsxs)(`div`,{className:`wa-picker`,onClick:e=>e.stopPropagation(),children:[(0,I.jsxs)(`div`,{className:`wa-picker-head`,children:[r&&(0,I.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:m,"aria-label":`Up one folder`,children:(0,I.jsx)(A,{size:18})}),(0,I.jsx)(`span`,{className:`wa-picker-title`,children:r||`Device storage`}),(0,I.jsx)(`button`,{type:`button`,className:`wa-picker-icon-btn`,onClick:n,"aria-label":`Close file picker`,children:(0,I.jsx)(c,{size:18})})]}),s&&(0,I.jsx)(`p`,{className:`wa-picker-error`,role:`alert`,children:s}),u&&(0,I.jsx)(`p`,{className:`wa-picker-empty`,children:`Loading…`}),a&&!u&&(0,I.jsxs)(`ul`,{className:`wa-picker-list`,children:[a.entries.length===0&&(0,I.jsx)(`li`,{className:`wa-picker-empty`,children:`This folder is empty.`}),a.entries.map(e=>(0,I.jsx)(`li`,{children:e.kind===`directory`?(0,I.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>p(e.name),children:[(0,I.jsx)(_,{size:16,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):e.kind===`file`?(0,I.jsxs)(`button`,{type:`button`,className:`wa-picker-row`,onClick:()=>h(e),children:[(0,I.jsx)(le,{size:16,"aria-hidden":!0}),(0,I.jsx)(`span`,{className:`wa-picker-name`,children:e.displayName??e.name})]}):null},e.name))]})]})})}var Te=n();function Ee(e){return`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`}function L({transport:e,sessionKey:t,replyTo:n,onClearReply:r,features:i}){let a=i?.attachments!==!1,o=i?.voice!==!1,s=i?.deviceFiles!==!1,l=i?.quote!==!1,[d,f]=(0,P.useState)(``),[m,g]=(0,P.useState)(!1),[_,ee]=(0,P.useState)(null),[v,te]=(0,P.useState)(!1),[y,b]=(0,P.useState)(!1),[x,S]=(0,P.useState)(!1),[C,w]=(0,P.useState)([]),T=(0,P.useRef)(null),{pendingFiles:E,attachError:re,setAttachError:ie,addFiles:D,removeFile:se,clearFiles:ce}=xe(),{state:k,elapsedSeconds:A,errorMessage:ue,start:j,send:de,discard:fe}=O(),pe=k===`recording`||k===`paused`,me=(0,P.useCallback)(()=>{j()},[j]),he=(0,P.useCallback)(async()=>{let e=await de();if(e){let t=e.type===`audio/ogg`?`.ogg`:e.type===`audio/mp4`?`.m4a`:`.webm`;D([new File([e],`voice-note${t}`,{type:e.type})])}},[A,de,D]),ge=(0,P.useCallback)(()=>{fe()},[A,fe]),_e=(0,P.useRef)(!1),ve=()=>Math.round((typeof window>`u`?900:window.innerHeight)/3),[be,F]=(0,P.useState)(null),[L,R]=(0,P.useState)(null),z=(0,P.useRef)(null),De=(0,P.useCallback)(e=>{let t=z.current;t&&F(Math.min(ve(),Math.max(44,t.startH+(t.startY-e.clientY))))},[]),B=(0,P.useCallback)(()=>{z.current=null,window.removeEventListener(`pointermove`,De),window.removeEventListener(`pointerup`,B)},[De]),Oe=(0,P.useCallback)(e=>{z.current={startY:e.clientY,startH:T.current?.offsetHeight??44},window.addEventListener(`pointermove`,De),window.addEventListener(`pointerup`,B),e.preventDefault()},[De,B]),ke=(0,P.useCallback)(e=>{let t=be??T.current?.offsetHeight??44,n=null;e.key===`ArrowUp`?(e.preventDefault(),n=Math.min(ve(),t+24)):e.key===`ArrowDown`&&(e.preventDefault(),n=Math.max(44,t-24)),n!==null&&F(n)},[be]),Ae=(0,P.useRef)(``);(0,P.useEffect)(()=>{let e=T.current;if(!e)return;let t=Ae.current!==``&&d===``;if(Ae.current=d,be!==null){t&&F(null);return}let n=e.style.height;e.style.height=`auto`;let r=Math.min(ve(),Math.max(44,e.scrollHeight));e.style.height=n,R(r)},[d,be]);let V=(d.trim().length>0||E.length>0||C.length>0)&&!m,je=(0,P.useCallback)(async()=>{if(!_e.current&&!(d.trim().length===0&&E.length===0&&C.length===0)){_e.current=!0,g(!0),ee(null);try{let i=`${e.endpoint}?session_key=${encodeURIComponent(t)}`,a;if(E.length>0||C.length>0){let t=new FormData;for(let[n,r]of Object.entries(e.fields))t.append(n,r);d.trim()&&t.append(`text`,d);for(let e of E)t.append(`files`,e);for(let e of C)t.append(`fileRefs`,e.path);n&&t.append(`quotedId`,n.msgKeyId),a=await fetch(i,{method:`POST`,body:t})}else a=await fetch(i,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...e.fields,text:d,...n?{quotedId:n.msgKeyId}:{}})});let o=await a.json().catch(()=>({}));if(!a.ok){ee(o.error??`Send failed.`),console.warn(`[operator-ui] op=reply-fail endpoint=${e.endpoint} error=${o.error??`unknown`}`);return}f(``),ce(),w([]),r?.()}catch(t){ee(`Could not reach the server. Try again.`),console.warn(`[operator-ui] op=reply-fail endpoint=${e.endpoint} error=${String(t)}`)}finally{_e.current=!1,g(!1)}}},[d,E,C,n,r,e,t,ce]),Me=(0,P.useCallback)(e=>{let t=T.current,{value:n,caret:r}=Se(d,e,t?t.selectionStart:null,t?t.selectionEnd:null);f(n),te(!1),requestAnimationFrame(()=>{let e=T.current;e&&(e.focus(),e.setSelectionRange(r,r))})},[d]),Ne=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),V&&je())},Pe=e=>e.dataTransfer.types.includes(`Files`),Fe=(0,P.useCallback)(e=>{Pe(e)&&(e.preventDefault(),a&&S(!0))},[a]),Ie=(0,P.useCallback)(()=>S(!1),[]),Le=(0,P.useCallback)(e=>{if(!Pe(e))return;e.preventDefault(),S(!1);let t=[...e.dataTransfer.files];if(t.length!==0){if(!a){ie(`This conversation takes text only. Attachments cannot be sent here.`);return}Math.max(0,E.length+t.length-5),D(t)}},[E.length,D,a,ie]),Re=e=>e.startsWith(`image/`)?(0,I.jsx)(M,{size:14}):e===`application/pdf`?(0,I.jsx)(le,{size:14}):(0,I.jsx)(oe,{size:14}),ze=ne(`(max-width: 720px)`),[H,Be]=(0,P.useState)(null);(0,P.useEffect)(()=>{Be(ze?document.querySelector(`.admin-footer`):null)},[ze]);let Ve=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-emoji`,onClick:()=>te(e=>!e),disabled:m,"aria-label":`Emoji`,"aria-expanded":v,children:(0,I.jsx)(N,{size:22})}),(a||s)&&(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:()=>b(!0),disabled:m,"aria-label":`Attach files`,children:(0,I.jsx)(h,{size:22})})]});return(0,I.jsxs)(`div`,{className:`wa-reply${x?` wa-reply-drag-over`:``}`,onDragOver:Fe,onDragLeave:Ie,onDrop:Le,children:[y&&(0,I.jsx)(we,{sessionKey:t,onPick:e=>{w(t=>[...t,e].slice(0,5)),b(!1)},onClose:()=>b(!1)}),v&&(0,I.jsx)(Ce,{onSelect:Me}),_&&(0,I.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:_}),re&&(0,I.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:re}),k===`error`&&ue&&(0,I.jsx)(`p`,{className:`wa-reply-error`,role:`alert`,children:ue}),(E.length>0||C.length>0)&&(0,I.jsxs)(`div`,{className:`wa-reply-attachments`,children:[E.map((e,t)=>(0,I.jsxs)(`div`,{className:`wa-reply-chip`,children:[Re(e.type),(0,I.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>se(t),"aria-label":`Remove ${e.name}`,children:(0,I.jsx)(c,{size:12})})]},`f-${t}`)),C.map((e,t)=>(0,I.jsxs)(`div`,{className:`wa-reply-chip wa-reply-chip-ref`,children:[(0,I.jsx)(le,{size:14}),(0,I.jsx)(`span`,{className:`wa-reply-chip-name`,children:e.name}),(0,I.jsx)(`button`,{type:`button`,onClick:()=>w(e=>e.filter((e,n)=>n!==t)),"aria-label":`Remove ${e.name}`,children:(0,I.jsx)(c,{size:12})})]},`r-${t}`))]}),l&&n&&(0,I.jsxs)(`div`,{className:`wa-reply-quote`,children:[(0,I.jsxs)(`div`,{className:`wa-reply-quote-body`,children:[(0,I.jsx)(`span`,{className:`wa-reply-quote-who`,children:n.fromMe?`You`:n.senderName??`Contact`}),(0,I.jsx)(`span`,{className:`wa-reply-quote-text`,children:n.body||`Message`})]}),(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-quote-cancel`,onClick:()=>r?.(),"aria-label":`Cancel reply`,children:(0,I.jsx)(c,{size:14})})]}),!pe&&(0,I.jsx)(`div`,{className:`wa-reply-resize-handle`,role:`separator`,"aria-orientation":`horizontal`,"aria-label":`Resize input — drag up to enlarge`,tabIndex:0,onPointerDown:Oe,onKeyDown:ke}),(0,I.jsx)(`div`,{className:`wa-reply-row`,children:pe?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-attach`,onClick:ge,"aria-label":`Cancel recording`,children:(0,I.jsx)(u,{size:20})}),(0,I.jsxs)(`span`,{className:`wa-rec-live`,role:`status`,children:[(0,I.jsx)(`span`,{className:`wa-rec-dot`,"aria-hidden":!0}),Ee(A)]}),(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void he(),"aria-label":`Stop recording`,children:(0,I.jsx)(p,{size:20})})]}):(0,I.jsxs)(I.Fragment,{children:[H?(0,Te.createPortal)((0,I.jsx)(`div`,{className:`wa-reply-footer-actions`,children:Ve}),H):Ve,(0,I.jsxs)(`div`,{className:`wa-reply-inputwrap`,children:[(0,I.jsx)(`textarea`,{ref:T,className:`wa-reply-input`,value:d,rows:1,style:{height:`${be??L??44}px`},placeholder:`Type a message`,disabled:m,onChange:e=>f(e.target.value),onKeyDown:Ne}),o&&d.length===0&&(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-mic`,onClick:()=>void me(),disabled:m,"aria-label":`Record voice note`,children:(0,I.jsx)(ae,{size:22})})]}),(0,I.jsx)(`button`,{type:`button`,className:`wa-reply-send`,onClick:()=>void je(),disabled:!V,"aria-label":`Send`,children:(0,I.jsx)(ye,{size:20})})]})})]})}function R({accountId:e,channelKey:t,contactName:n,sessionKey:r,sendable:i=!0,onBack:a}){let o=t.slice(t.indexOf(`:`)+1),s=n===o?void 0:o;return(0,I.jsxs)(`div`,{className:`wa-web tg-web`,children:[(0,I.jsxs)(`header`,{className:`wa-web-header`,children:[a&&(0,I.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:a,"aria-label":`Back`,children:(0,I.jsx)(A,{size:20})}),(0,I.jsx)(`span`,{className:`wa-web-avatar`,"aria-hidden":!0,children:(0,I.jsx)(ie,{size:20})}),(0,I.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,I.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,I.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]})]}),(0,I.jsx)(`div`,{className:`wa-web-body`,"data-testid":`telegram-web-conversation`,children:(0,I.jsx)(D,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{channel:`telegram`,accountId:e,channelKey:t}})}),i&&(0,I.jsx)(L,{transport:{endpoint:`/api/telegram-reader/send`,fields:{accountId:e,channelKey:t}},sessionKey:r,features:{attachments:!1,voice:!1,deviceFiles:!1,quote:!1}})]})}function z({accountId:e,remoteJid:t,contactName:n,sessionKey:r,onBack:i}){let a=te(t),o=t.split(`@`)[0],s=a?`Group`:n===`+${o}`?void 0:`+${o}`,[l,u]=(0,P.useState)(!1),[d,f]=(0,P.useState)(``),p=()=>{u(!1),f(``)},[m,h]=(0,P.useState)(null);return(0,I.jsxs)(`div`,{className:`wa-web`,children:[(0,I.jsxs)(`header`,{className:`wa-web-header`,children:[i&&(0,I.jsx)(`button`,{type:`button`,className:`wa-web-back`,onClick:i,"aria-label":`Back`,children:(0,I.jsx)(A,{size:20})}),(0,I.jsx)(ce,{accountId:e,jid:t,sessionKey:r}),l?(0,I.jsxs)(`div`,{className:`wa-web-search`,children:[(0,I.jsx)(ue,{size:18,"aria-hidden":!0}),(0,I.jsx)(`input`,{className:`wa-web-search-input`,type:`text`,autoFocus:!0,placeholder:`Search messages`,"aria-label":`Search messages`,value:d,onChange:e=>f(e.target.value),onKeyDown:e=>{e.key===`Escape`&&p()}}),(0,I.jsx)(`button`,{type:`button`,className:`wa-web-search-close`,onClick:p,"aria-label":`Close search`,children:(0,I.jsx)(c,{size:18})})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`wa-web-titles`,children:[(0,I.jsx)(`span`,{className:`wa-web-name`,children:n}),s&&(0,I.jsx)(`span`,{className:`wa-web-subtitle`,children:s})]}),(0,I.jsx)(`button`,{type:`button`,className:`wa-web-search-toggle`,onClick:()=>u(!0),"aria-label":`Search messages`,children:(0,I.jsx)(ue,{size:20})})]})]}),(0,I.jsx)(`div`,{className:`wa-web-body`,children:(0,I.jsx)(D,{sessionId:``,projectDir:``,sessionKey:r,forceDeliveredOnly:!0,suppressDirectives:!0,store:{channel:`whatsapp`,accountId:e,remoteJid:t},search:l?d:void 0,onReplyTo:h,groupThread:a})}),(0,I.jsx)(L,{transport:{endpoint:`/api/whatsapp-reader/reply`,fields:{accountId:e,remoteJid:t}},sessionKey:r,replyTo:m,onClearReply:()=>h(null)})]})}function De(e){let t=new Set,n=[];for(let r of e)for(let e of r.labels)e&&(t.has(e)||j.has(e)&&(t.add(e),n.push(e)));return n}function B(e,t){return m(e,t)}function Oe({conversations:e,sessionKey:t,onBack:n}){let{zone:r}=o(),[i,a]=(0,P.useState)(null),s=v(e);return i?i.source===`store`&&i.channel===`telegram`&&i.accountId&&i.channelKey?(0,I.jsx)(R,{accountId:i.accountId,channelKey:i.channelKey,contactName:C(i),sessionKey:t,onBack:()=>a(null)},y(i)):i.source===`store`&&i.accountId&&i.remoteJid?(0,I.jsx)(z,{accountId:i.accountId,remoteJid:i.remoteJid,contactName:C(i),sessionKey:t,onBack:()=>a(null)},y(i)):(0,I.jsxs)(`div`,{className:`op-conv op-conv-reader`,children:[(0,I.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:()=>a(null),"aria-label":`Back to conversations`,children:[(0,I.jsx)(A,{size:16}),` Back`]}),(0,I.jsx)(`span`,{className:`op-conv-title`,children:C(i)})]}),(0,I.jsx)(D,{sessionId:i.sessionId,projectDir:i.projectDir,sessionKey:t,forceDeliveredOnly:!0,suppressDirectives:i.source===`store`,store:i.source===`store`?{channel:`whatsapp`,accountId:i.accountId,remoteJid:i.remoteJid}:void 0},y(i))]}):(0,I.jsxs)(`div`,{className:`op-conv op-conv-list`,children:[(0,I.jsxs)(`div`,{className:`op-conv-bar`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`op-conv-back`,onClick:n,"aria-label":`Back to chat`,children:[(0,I.jsx)(A,{size:16}),` Chat`]}),(0,I.jsx)(`span`,{className:`op-conv-title`,children:`Conversations`})]}),s.map(e=>(0,I.jsxs)(`div`,{className:`op-conv-group`,children:[(0,I.jsxs)(`div`,{className:`op-conv-group-head`,children:[(0,I.jsx)(T,{channel:e.channel,size:14}),e.label]}),e.rows.map(e=>(0,I.jsxs)(`button`,{type:`button`,className:`op-conv-row`,onClick:()=>{a(e)},children:[e.source===`store`&&e.accountId&&e.remoteJid&&(0,I.jsx)(ce,{accountId:e.accountId,jid:e.remoteJid,sessionKey:t,className:`op-conv-avatar`,size:16}),(0,I.jsx)(`span`,{className:`op-conv-name`,children:C(e)}),e.modelGated&&(0,I.jsx)(`span`,{className:`op-conv-gated`,role:`img`,"aria-label":`Model unavailable`,children:(0,I.jsx)(de,{size:13})}),(0,I.jsx)(`span`,{className:`op-conv-when`,children:B(e.lastMessageAt,r)})]},y(e)))]},e.channel))]})}var ke=/\.(png|jpe?g|gif|webp|svg)$/i;function Ae(e){return ke.test(e)}function V(e){return e.entryPath??e.name}var je=`maxy-data-view`,Me=95*1024*1024,Ne=48*1024*1024;function Pe(){return typeof window>`u`?`list`:window.localStorage.getItem(je)===`grid`?`grid`:`list`}function Fe(){let[e,t]=(0,P.useState)(null),[n,r]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{let e=!1,n=null;try{n=sessionStorage.getItem(`maxy-admin-session-key`)}catch{}if(!n){t(null),r(!0);return}return fetch(`/api/admin/session?session_key=${encodeURIComponent(n)}`).then(i=>{if(!e){if(i.status===401){try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`;return}t(n),r(!0)}}).catch(()=>{e||(t(n),r(!0))}),()=>{e=!0}},[]),n?e?(0,I.jsx)(f,{cacheKey:e,surface:`data`,onSessionExpired:({code:e,path:t})=>{console.warn(`[admin-auth] outcome=session-expired-redirect code=${e} path=${t} surface=data`);try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},children:(0,I.jsx)(w,{cacheKey:e,children:(0,I.jsx)(`div`,{className:`data-page data-page-full`,children:(0,I.jsx)(Ie,{cacheKey:e})})})}):(0,I.jsx)(`div`,{className:`data-page`,children:(0,I.jsxs)(`div`,{className:`data-empty`,children:[(0,I.jsx)(`p`,{children:`You are not signed in.`}),(0,I.jsxs)(`p`,{children:[`Open the `,(0,I.jsx)(`a`,{href:`/`,className:`data-link`,children:`main admin page`}),` and log in, then return here.`]})]})}):(0,I.jsx)(d,{surface:`gate`})}function Ie({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=b({initialCacheKey:e,surface:`data`});return(0,I.jsx)(W,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})}function Le(){if(typeof window>`u`)return`@home`;let e=new URLSearchParams(window.location.hash.replace(/^#/,``)).get(`path`);return e&&e.length>0?e:`@home`}function Re(e){if(typeof window>`u`)return;let t=new URL(window.location.href);t.hash=e===`.`||e===`@home`?``:`path=${encodeURIComponent(e)}`,window.history.replaceState(window.history.state,``,t.toString())}function ze(e){return new Promise((t,n)=>{let r=[],i=()=>e.readEntries(e=>{e.length===0?t(r):(r.push(...e),i())},n);i()})}function H(e){return new Promise((t,n)=>e.file(t,n))}async function Be(e,t=``){let n=[];for(let r of e){if(!r)continue;let e=t?`${t}/${r.name}`:r.name;if(r.isFile)n.push({file:await H(r),relpath:e});else if(r.isDirectory){let t=await ze(r.createReader());n.push(...await Be(t,e))}}return n}function Ve(e,t){if(e===422&&typeof t==`string`){if(/exceeds the .* limit/i.test(t))return`size`;if(/unsupported file type/i.test(t))return`mime`}return`http=${e}`}function U({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let{zone:r}=o(),[i,f]=(0,P.useState)(``),p=(0,P.useRef)(null),[m,h]=(0,P.useState)(``),[v,te]=(0,P.useState)(null),[y,b]=(0,P.useState)(`hybrid`),[x,S]=(0,P.useState)(!1),[C,ne]=(0,P.useState)(null),[w,T]=(0,P.useState)(null),[re,ie]=(0,P.useState)(0),[ae,oe]=(0,P.useState)(!1),[D,se]=(0,P.useState)(()=>Le()),[O,ce]=(0,P.useState)(null),[k,A]=(0,P.useState)(()=>Pe()),[j,de]=(0,P.useState)(null),[M,ye]=(0,P.useState)([]),[N,xe]=(0,P.useState)(null),[F,Se]=(0,P.useState)(0),[Ce,we]=(0,P.useState)(null),Te=(0,P.useRef)(null),Ee=M.slice(0,-1).map(e=>e.name).join(`/`),L=(()=>{let e=M.map(e=>e.name);return e.length>=2&&e[0]===`accounts`?`${e[0]}/${e[1]}`:null})(),R=N?Ee:D,z=(0,P.useCallback)(e=>R===`.`||R===``?e:`${R}/${e}`,[R]),[B,Oe]=(0,P.useState)(!1),[ke,Fe]=(0,P.useState)(!1),[Ie,ze]=(0,P.useState)(null),[H,U]=(0,P.useState)(!1),[W,G]=(0,P.useState)(null),[We,Ge]=(0,P.useState)(null),[Ke,Ye]=(0,P.useState)(null),[Xe,Ze]=(0,P.useState)(!1),[Qe,$e]=(0,P.useState)(null),et=(0,P.useRef)(null),[tt,nt]=(0,P.useState)(0),[rt,it]=(0,P.useState)(!1),[at,ot]=(0,P.useState)(``),[st,ct]=(0,P.useState)(null),[lt,ut]=(0,P.useState)(``),[dt,ft]=(0,P.useState)(null),K=(()=>{let e=D===`.`?[]:D.split(`/`).filter(Boolean);return e.some(e=>e.startsWith(`@`))?!1:e.length>=2&&e[0]===`accounts`})(),[pt,mt]=(0,P.useState)(!1),ht=(0,P.useRef)(null),[gt,q]=(0,P.useState)(!1),_t=(0,P.useRef)(null);(0,P.useEffect)(()=>{let e=i.trim();if(!e){h(``),te(null),ne(null);return}oe(!1);let t=setTimeout(()=>h(e),300);return()=>clearTimeout(t)},[i]),(0,P.useEffect)(()=>{if(!m){S(!1);return}let t=!1;return S(!0),ne(null),e(`/api/admin/graph-search?q=${encodeURIComponent(m)}&labels=FileArtifact&limit=20${ae?`&threshold=0`:``}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(te(e.results),b(e.mode??`hybrid`),ie(typeof e.suppressed==`number`?e.suppressed:0))}).catch(e=>{t||ne(e instanceof Error?e.message:String(e))}).finally(()=>{t||S(!1)}),()=>{t=!0}},[m,e,n,ae]);let vt=(0,P.useMemo)(()=>v?De(v):[],[v]),yt=w&&vt.includes(w)?w:null,bt=(0,P.useMemo)(()=>v?yt?v.filter(e=>e.labels.includes(yt)):v:null,[v,yt]),xt=(0,P.useCallback)(e=>{let n=e.properties.relativePath;if(typeof n!=`string`||n.length===0)return;let r=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,i=document.createElement(`a`);i.href=r,i.rel=`noopener noreferrer`,document.body.appendChild(i),i.click(),i.remove()},[t]);(0,P.useEffect)(()=>{if(!v)return;let e=v.filter(e=>{let t=e.properties.relativePath;return typeof t!=`string`||t.length===0});e.length>0&&console.warn(`[data-search] op=locate-link-missing nodeId=${e.map(e=>e.nodeId).join(`,`)}`)},[v]),(0,P.useEffect)(()=>{let t=!1;return Oe(!0),ze(null),e(`/api/admin/files?path=${encodeURIComponent(D===`.`?``:D)}`).then(async e=>{let t=await e.json().catch(()=>({error:`HTTP ${e.status}`}));if(!e.ok)throw Error(t.error??`HTTP ${e.status}`);return t}).then(e=>{t||(ce(e.entries),ye(e.displayPath??[]),xe(e.view??null),Se(typeof e.systemCount==`number`?e.systemCount:0))}).catch(e=>{t||(ce([]),ye([]),xe(null),Se(0),ze(e instanceof Error?e.message:String(e)))}).finally(()=>{t||(Oe(!1),Fe(!0))}),()=>{t=!0}},[e,D,tt,n]),(0,P.useEffect)(()=>{if(N!==null||!L||Te.current===L)return;Te.current=L;let t=!1;return e(`/api/admin/files?path=${encodeURIComponent(`${L}/@home`)}`).then(e=>e.ok?e.json():null).then(e=>{t||!e||we((e.entries??[]).map(e=>e.name))}).catch(e=>{console.warn(`[data-ui] op=rail-buckets status=error reason="${e instanceof Error?e.message:String(e)}"`)}),()=>{t=!0}},[e,N,L]),(0,P.useEffect)(()=>{Re(D)},[D]);let St=(0,P.useCallback)(()=>{nt(e=>e+1)},[]),J=(0,P.useCallback)(e=>{mt(!1),se(e)},[]),Ct=(0,P.useCallback)(e=>{let t=e.properties.relativePath;if(typeof t!=`string`||t.length===0)return;let n=t.lastIndexOf(`/`),r=n===-1?`.`:t.slice(0,n);f(``),ne(null),T(null),J(r)},[J]),wt=(0,P.useCallback)(()=>{if(!D.split(`/`).some(e=>e.startsWith(`@`))){if(D===`.`||D===``)return;let e=D.split(`/`).filter(Boolean);e.pop(),se(e.length===0?`.`:e.join(`/`));return}M.length!==0&&se(M.length>=2?M.slice(0,M.length-1).map(e=>e.name).join(`/`):`.`)},[D,M]),Tt=(0,P.useCallback)(e=>{pe(t,z(V(e)))},[z,t]),[Y,Et]=(0,P.useState)(!1),[X,Dt]=(0,P.useState)(new Set),Ot=(0,P.useRef)(null),Z=(0,P.useRef)(!1),kt=typeof navigator<`u`&&typeof navigator.share==`function`&&typeof navigator.canShare==`function`,At=(0,P.useCallback)(e=>{Et(!0),Dt(new Set([e]))},[]),Q=(0,P.useCallback)(e=>{Et(!1),Dt(new Set)},[]),jt=(0,P.useCallback)(e=>{Dt(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),Mt=(0,P.useCallback)(e=>{Z.current=!1,Ot.current=setTimeout(()=>{Z.current=!0,At(e)},500)},[At]),$=(0,P.useCallback)(()=>{Ot.current&&=(clearTimeout(Ot.current),null)},[]),Nt=(0,P.useCallback)(e=>{if(Z.current){Z.current=!1;return}if(Y){jt(e.name);return}Tt(e)},[Y,jt,Tt]),Pt=(0,P.useCallback)(e=>{A(e),typeof window<`u`&&window.localStorage.setItem(je,e)},[]),Ft=(0,P.useCallback)(e=>{if(Z.current){Z.current=!1;return}if(Y){jt(e.name);return}de({src:me(t,z(V(e))),alt:e.displayName??e.name})},[Y,jt,z,t]),It=(0,P.useCallback)(()=>(O??[]).filter(e=>e.kind===`file`&&X.has(e.name)),[O,X]),Lt=(0,P.useCallback)(()=>{if(X.size!==1)return null;let e=(O??[]).find(e=>X.has(e.name));return e&&!e.entryPath?e:null},[O,X]),Rt=(0,P.useCallback)(()=>(O??[]).filter(e=>(e.kind===`file`||e.kind===`directory`)&&X.has(e.name)),[O,X]),zt=(0,P.useCallback)(()=>{let e=Rt(),n=e.some(e=>e.kind===`directory`);e.length===1&&!n?Tt(e[0]):e.length>=1&&fe(t,e.map(e=>z(V(e)))),Q(`action`)},[Rt,Tt,z,t,Q]),Bt=(0,P.useCallback)(async()=>{let t=It(),n=t.filter(e=>!e.protected),r=t.length-n.length;$e(r>0?`${r} protected file(s) kept`:null);for(let t of n){let n=z(V(t));try{let t=await e(`/api/admin/files?path=${encodeURIComponent(n)}`,{method:`DELETE`}),r=await t.json().catch(()=>({error:`HTTP ${t.status}`}));if(!t.ok)throw Error(r.error??`HTTP ${t.status}`)}catch(e){$e(e instanceof Error?e.message:String(e))}}nt(e=>e+1),Q(`action`)},[It,z,e,Q]),Vt=(0,P.useCallback)(async()=>{let e=It();if(kt)try{let n=await Promise.all(e.map(async e=>{let n=z(V(e)),r=`/api/admin/files/download?session_key=${encodeURIComponent(t)}&path=${encodeURIComponent(n)}`,i=await(await fetch(r)).blob();return new File([i],e.displayName??e.name,{type:i.type||`application/octet-stream`})}));navigator.canShare({files:n})&&await navigator.share({files:n})}catch(e){console.warn(`[data-ui] op=share-failed err=${e instanceof Error?e.message:String(e)}`)}},[It,kt,z,t]),Ht=(0,P.useCallback)(()=>{et.current?.click()},[]),Ut=(0,P.useCallback)((e,n={})=>{let r=(r,i,a)=>{let o=new URLSearchParams({session_key:t,path:D===`.`?``:D,filename:e.name});n.relpath&&o.set(`relpath`,n.relpath),n.token&&o.set(`token`,n.token);for(let[e,t]of Object.entries(i))o.set(e,t);return new Promise(t=>{let n=new XMLHttpRequest;n.open(`POST`,`/api/admin/files/upload?${o.toString()}`),n.setRequestHeader(`Content-Type`,e.type||`application/octet-stream`),a&&(n.upload.onprogress=e=>{e.lengthComputable&&a(e.loaded)}),n.onload=()=>{let e={};try{e=JSON.parse(n.responseText)}catch{}t({status:n.status,data:e})},n.onerror=()=>t({status:0,data:{}}),n.onabort=()=>t({status:0,data:{error:`aborted`}}),n.send(r)})};if(e.size<=Me)return r(e,{},t=>n.onProgress?.(t,e.size));let i=`${Date.now().toString(36)}-${Math.random().toString(16).slice(2,10)}`,a=Math.ceil(e.size/Ne);return(async()=>{let t={status:0,data:{}};for(let o=0;o<a;o++){let s=o*Ne;if(t=await r(e.slice(s,Math.min(s+Ne,e.size)),{uploadId:i,seq:String(o),total:String(a)},t=>n.onProgress?.(s+t,e.size)),!(t.status>=200&&t.status<300))return t}return t})()},[t,D]),Wt=(0,P.useCallback)(async e=>{Ge(null),U(!0),G({loaded:0,total:e.size});try{let{status:t,data:n}=await Ut(e,{onProgress:(e,t)=>G({loaded:e,total:t})});t>=200&&t<300&&n.path?(se(n.path.split(`/`).slice(0,-1).join(`/`)||`.`),nt(e=>e+1)):Ge(t===0?`Network error during upload — the connection failed before the server responded.`:n.error??`Upload failed (HTTP ${t}).`)}finally{U(!1),G(null),et.current&&(et.current.value=``)}},[Ut]),Gt=(0,P.useCallback)(e=>{K&&Array.from(e.dataTransfer.types).includes(`Files`)&&(e.preventDefault(),Ze(!0))},[K]),Kt=(0,P.useCallback)(e=>{e.currentTarget.contains(e.relatedTarget)||Ze(!1)},[]),qt=(0,P.useCallback)(async e=>{e.preventDefault(),Ze(!1);let t=Math.random().toString(16).slice(2,10),n=Array.from(e.dataTransfer.items);if(n.length===0)return;if(!K){Ge(`Open a folder inside your account to upload`);return}let r=n.map(e=>e.webkitGetAsEntry?.()).filter(e=>!!e);U(!0),Ge(null),Ye(null);try{let e=await Be(r),n=0,i=[];for(let r=0;r<e.length;r++){let{file:a,relpath:o}=e[r];G({loaded:0,total:a.size});let{status:s,data:c}=await Ut(a,{relpath:o,token:t,onProgress:(e,t)=>G({loaded:e,total:t})});if(s>=200&&s<300)n++;else{let e=s===0?`http=0`:Ve(s,c.error);i.push(`${o} (${e})`)}}Ye(`Uploaded ${n}, skipped ${i.length}${i.length?`: ${i.join(`, `)}`:``}`),nt(e=>e+1)}catch(e){Ge(e instanceof Error?e.message:String(e))}finally{U(!1),G(null)}},[K,Ut]),Jt=(0,P.useCallback)(async()=>{let t=at.trim();if(t){ft(null);try{let n=await e(`/api/admin/files/folder`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:D===`.`?``:D,name:t})}),r=await n.json().catch(()=>({error:`HTTP ${n.status}`}));if(!n.ok)throw Error(r.error??`HTTP ${n.status}`);it(!1),ot(``),nt(e=>e+1)}catch(e){ft(e instanceof Error?e.message:String(e))}}},[e,at,D]),Yt=(0,P.useCallback)(async()=>{if(!st)return;let t=lt.trim();if(!t)return;ft(null);let n=z(st);try{let r=await e(`/api/admin/files/rename`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({path:n,newName:t})}),i=await r.json().catch(()=>({error:`HTTP ${r.status}`}));if(!r.ok)throw Error(i.error??`HTTP ${r.status}`);ct(null),ut(``),Q(`action`),nt(e=>e+1)}catch(e){ft(e instanceof Error?e.message:String(e))}},[e,lt,st,z,Q]);(0,P.useEffect)(()=>{if(!pt)return;let e=e=>{ht.current&&!ht.current.contains(e.target)&&mt(!1)},t=e=>{e.key===`Escape`&&mt(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[pt]),(0,P.useEffect)(()=>{if(!gt)return;let e=e=>{_t.current&&!_t.current.contains(e.target)&&q(!1)},t=e=>{e.key===`Escape`&&q(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[gt]);let Xt=(0,P.useCallback)(e=>M.slice(0,e+1).map(e=>e.name).join(`/`),[M]),Zt=M.length>=2,Qt=Zt?[{name:`.`,label:`data`},...M.slice(0,M.length-2).map((e,t)=>({name:Xt(t),label:e.displayName??e.name}))]:[];return ke?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`data-toolbar`,children:[Y?(0,I.jsxs)(`button`,{type:`button`,className:`data-select-cancel`,onClick:()=>Q(`cancel`),"aria-label":`Cancel selection`,children:[(0,I.jsx)(c,{size:14}),` Cancel`]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`div`,{className:`data-search-input`,children:[i===``&&(0,I.jsx)(ue,{size:14}),(0,I.jsx)(`input`,{ref:p,type:`text`,value:i,onChange:e=>f(e.target.value),autoFocus:!0,autoComplete:`off`,spellCheck:!1}),x&&(0,I.jsx)(l,{size:14,className:`spin`}),i!==``&&(0,I.jsx)(`button`,{type:`button`,className:`data-search-inline-btn`,onClick:()=>{f(``),p.current?.focus()},title:`Clear search`,"aria-label":`Clear search`,children:(0,I.jsx)(c,{size:14})})]}),(0,I.jsxs)(`div`,{className:`data-toolbar-actions`,ref:_t,children:[(0,I.jsx)(`button`,{type:`button`,className:`data-action-overflow`,onClick:()=>q(e=>!e),"aria-haspopup":`menu`,"aria-expanded":gt,"aria-label":`File actions`,title:`File actions`,children:(0,I.jsx)(he,{size:16})}),(0,I.jsxs)(`div`,{className:`data-action-group`,role:`group`,"aria-label":`File actions`,"data-open":gt?`true`:void 0,children:[(0,I.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{St(),q(!1)},disabled:B,title:`Refresh this folder`,"aria-label":`Refresh this folder`,children:[B?(0,I.jsx)(l,{size:16,className:`spin`}):(0,I.jsx)(a,{size:16}),(0,I.jsx)(`span`,{className:`data-action-label`,children:`Refresh`})]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-action-btn admin-btn-cta`,onClick:()=>{Ht(),q(!1)},disabled:H||!K,title:K?`Upload a file`:`Open a folder inside your account to upload`,"aria-label":`Upload a file`,children:[H?W&&W.total>0?(0,I.jsxs)(`span`,{className:`data-upload-pct`,children:[Math.round(W.loaded/W.total*100),`%`]}):(0,I.jsx)(l,{size:16,className:`spin`}):(0,I.jsx)(be,{size:16}),(0,I.jsx)(`span`,{className:`data-action-label`,children:`Upload`})]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{it(e=>!e),ot(``),ft(null),q(!1)},disabled:H||!K,title:K?`New folder`:`Open a folder inside your account to create one`,"aria-label":`New folder`,children:[(0,I.jsx)(ge,{size:16}),(0,I.jsx)(`span`,{className:`data-action-label`,children:`New folder`})]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-action-btn`,onClick:()=>{Pt(k===`grid`?`list`:`grid`),q(!1)},title:k===`grid`?`List view`:`Grid view`,"aria-label":k===`grid`?`Switch to list view`:`Switch to grid view`,"aria-pressed":k===`grid`,children:[k===`grid`?(0,I.jsx)(ve,{size:16}):(0,I.jsx)(_e,{size:16}),(0,I.jsx)(`span`,{className:`data-action-label`,children:k===`grid`?`List view`:`Grid view`})]})]})]})]}),(0,I.jsxs)(`div`,{className:`data-breadcrumbs`,children:[D!==`.`&&(0,I.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost data-back-btn`,onClick:wt,title:`Up one level`,"aria-label":`Up one level`,children:(0,I.jsx)(ee,{size:14})}),Zt?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`span`,{className:`data-crumb-wrap`,ref:ht,children:[(0,I.jsx)(`button`,{type:`button`,className:`data-crumb data-crumb-ellipsis`,onClick:()=>mt(e=>!e),"aria-haspopup":`menu`,"aria-expanded":pt,"aria-label":`Show parent folders`,title:`Show parent folders`,children:`…`}),pt&&(0,I.jsx)(`div`,{className:`data-crumb-menu`,role:`menu`,children:Qt.map(e=>(0,I.jsx)(`button`,{type:`button`,role:`menuitem`,className:`data-crumb-menu-item`,onClick:()=>J(e.name),title:e.label,children:e.label},e.name))})]}),[M.length-2,M.length-1].map(e=>{let t=M[e];return(0,I.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,I.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,I.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>J(Xt(e)),title:t.name,children:t.displayName??t.name})]},Xt(e))})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>J(`.`),children:`data`}),M.map((e,t)=>(0,I.jsxs)(`span`,{className:`data-crumb-wrap`,children:[(0,I.jsx)(`span`,{className:`data-crumb-sep`,children:`›`}),(0,I.jsx)(`button`,{type:`button`,className:`data-crumb`,onClick:()=>J(Xt(t)),title:e.name,children:e.displayName??e.name})]},Xt(t)))]})]}),rt&&(0,I.jsxs)(`div`,{className:`data-inline-form`,children:[(0,I.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`Folder name`,value:at,autoFocus:!0,onChange:e=>ot(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Jt(),e.key===`Escape`&&it(!1)}}),(0,I.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Jt,children:`Create`}),(0,I.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>it(!1),children:`Cancel`})]}),st&&(0,I.jsxs)(`div`,{className:`data-inline-form`,children:[(0,I.jsx)(`input`,{type:`text`,className:`data-inline-input`,placeholder:`New name`,value:lt,autoFocus:!0,onChange:e=>ut(e.target.value),onKeyDown:e=>{e.key===`Enter`&&Yt(),e.key===`Escape`&&ct(null)}}),(0,I.jsx)(`button`,{type:`button`,className:`data-btn`,onClick:Yt,children:`Rename`}),(0,I.jsx)(`button`,{type:`button`,className:`data-btn data-btn-ghost`,onClick:()=>ct(null),children:`Cancel`})]}),dt&&(0,I.jsx)(`div`,{className:`data-error`,children:dt}),(0,I.jsx)(`input`,{type:`file`,ref:et,hidden:!0,onChange:e=>{let t=e.target.files?.[0];t&&Wt(t)}})]}),(0,I.jsxs)(`div`,{className:`data-body`,"data-drag-active":Xe?`true`:void 0,onDragEnter:Gt,onDragOver:Gt,onDragLeave:Kt,onDrop:qt,children:[N===null&&L&&Ce&&Ce.length>0&&(0,I.jsxs)(`aside`,{className:`data-rail`,"aria-label":`Folders`,children:[(0,I.jsx)(`span`,{className:`data-rail-label`,children:`Folders`}),(0,I.jsx)(`ul`,{className:`data-rail-list`,children:Ce.map(e=>{let t=`${L}/${e}`,n=D===t||D.startsWith(`${t}/`);return(0,I.jsx)(`li`,{children:(0,I.jsxs)(`button`,{type:`button`,className:`data-rail-item`,"aria-current":n?`true`:void 0,onClick:()=>J(t),children:[(0,I.jsx)(_,{size:13}),(0,I.jsx)(`span`,{className:`data-rail-item-name`,children:e})]})},e)})})]}),(0,I.jsxs)(`div`,{className:`data-content`,children:[(C!==null||v!==null)&&(0,I.jsxs)(`section`,{className:`data-panel admin-card`,children:[C&&(0,I.jsxs)(`div`,{className:`data-error`,children:[`Search failed: `,C]}),vt.length>0&&(0,I.jsx)(`div`,{className:`data-chip-row`,role:`group`,"aria-label":`Filter by type`,children:vt.map(e=>{let t=e===yt;return(0,I.jsx)(`button`,{type:`button`,className:`data-chip`,"data-active":t,onClick:()=>T(t?null:e),children:Ue([e])??e},e)})}),v&&!x&&(0,I.jsxs)(`div`,{className:`data-results-meta`,children:[bt.length,` of `,v.length,` result`,v.length===1?``:`s`]}),v&&!x&&!yt&&re>0&&!ae&&(0,I.jsxs)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!0),children:[re,` low-confidence result`,re===1?``:`s`,` hidden — show all`]}),v&&!x&&!yt&&ae&&(0,I.jsx)(`button`,{type:`button`,className:`data-suppressed-banner`,onClick:()=>oe(!1),children:`Showing all results — hide low-confidence`}),v&&v.length===0&&!x&&(0,I.jsx)(`div`,{className:`data-empty-results`,children:`No matches. Try a different keyword.`}),bt&&bt.length>0&&(0,I.jsx)(`ul`,{className:`data-results`,children:bt.map(e=>(0,I.jsx)(He,{hit:e,mode:y,onDownload:xt,onLocate:Ct},e.nodeId))})]}),(0,I.jsxs)(`section`,{className:N===`home`?`data-panel data-panel--wide`:`data-panel data-panel--wide admin-card`,children:[W&&(0,I.jsxs)(`div`,{className:`data-upload-progress`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":W.total>0?Math.round(W.loaded/W.total*100):void 0,children:[(0,I.jsx)(`div`,{className:`data-upload-progress-track`,children:(0,I.jsx)(`div`,{className:`data-upload-progress-fill`,style:{width:`${W.total>0?Math.round(W.loaded/W.total*100):0}%`}})}),(0,I.jsxs)(`span`,{className:`data-upload-progress-label`,children:[`Uploading… `,W.total>0?`${Math.round(W.loaded/W.total*100)}%`:``]})]}),We&&(0,I.jsxs)(`div`,{className:`data-error`,children:[`Upload failed: `,We]}),Ke&&(0,I.jsx)(`div`,{className:`data-status`,children:Ke}),Qe&&(0,I.jsxs)(`div`,{className:`data-error`,children:[`Delete failed: `,Qe]}),Ie&&(0,I.jsx)(`div`,{className:`data-error`,children:Ie}),B&&(0,I.jsxs)(`div`,{className:`data-loading`,children:[(0,I.jsx)(l,{size:14,className:`spin`}),` Loading…`]}),!B&&N!==`home`&&O&&O.length===0&&!Ie&&(0,I.jsx)(`div`,{className:`data-empty-results`,children:`Empty directory.`}),!B&&N===`home`&&O&&(0,I.jsxs)(`ul`,{className:`routine-list data-home-list`,children:[O.map(e=>(0,I.jsxs)(`li`,{className:`data-home-card`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`data-home-card-head`,onClick:()=>J(z(e.name)),children:[(0,I.jsx)(`span`,{className:`data-home-card-title`,children:e.name}),(0,I.jsx)(`span`,{className:`data-home-card-count`,children:e.childCount===null||e.childCount===void 0?`—`:`${e.childCount} ${e.childCount===1?`item`:`items`}`})]}),(0,I.jsxs)(`ul`,{className:`data-home-card-children`,children:[e.childCount===null&&(0,I.jsx)(`li`,{className:`data-home-card-error`,children:`Could not read this folder.`}),e.childCount===0&&(0,I.jsx)(`li`,{className:`data-home-card-empty`,children:`Empty.`}),(e.children??[]).map(e=>(0,I.jsxs)(`li`,{className:`data-home-card-child`,children:[e.kind===`directory`?(0,I.jsx)(_,{size:12}):(0,I.jsx)(le,{size:12}),(0,I.jsx)(`span`,{className:`data-home-card-child-name`,children:e.name})]},e.name)),typeof e.childCount==`number`&&e.childCount>(e.children?.length??0)&&(0,I.jsxs)(`li`,{className:`data-home-card-more`,children:[`+`,e.childCount-(e.children?.length??0),` more`]})]})]},e.name)),(0,I.jsxs)(`li`,{className:`data-home-card`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`data-home-card-head`,onClick:()=>J(z(`@system`)),children:[(0,I.jsx)(`span`,{className:`data-home-card-title`,children:`system`}),(0,I.jsxs)(`span`,{className:`data-home-card-count`,children:[F,` `,F===1?`item`:`items`]})]}),(0,I.jsx)(`ul`,{className:`data-home-card-children`,children:(0,I.jsx)(`li`,{className:`data-home-card-empty`,children:`Platform and plugin folders.`})})]})]}),!B&&N!==`home`&&O&&O.length>0&&k===`grid`&&(0,I.jsx)(`ul`,{className:`data-grid`,children:O.map(e=>{let n=e.displayName??e.name,r=Y&&X.has(e.name);if(e.kind===`directory`)return(0,I.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`data-grid-tile`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(Z.current){Z.current=!1;return}if(Y){jt(e.name);return}J(z(e.name))},children:[Y&&(0,I.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,I.jsx)(_,{size:28,className:`data-grid-glyph`}),(0,I.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:n})]})},e.name);if(e.kind===`file`){let i=Ae(V(e)),a=z(V(e));return(0,I.jsx)(`li`,{className:`data-grid-cell`,"data-selected":r?`true`:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`data-grid-tile${i?` data-grid-tile-image`:``}`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>i?Ft(e):Nt(e),title:Y?void 0:i?`Preview ${n}`:`Download ${n}`,children:[Y&&(0,I.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),i?(0,I.jsx)(`img`,{className:`data-grid-thumb`,src:me(t,a),alt:n,loading:`lazy`,onError:()=>console.warn(`[data] op=thumb-error path=${a}`)}):(0,I.jsx)(le,{size:28,className:`data-grid-glyph`}),(0,I.jsx)(`span`,{className:`data-grid-label`,title:e.name,children:n}),!i&&(0,I.jsx)(`span`,{className:`data-grid-sub`,children:qe(e.sizeBytes)})]})},e.name)}return(0,I.jsx)(`li`,{className:`data-grid-cell`,children:(0,I.jsxs)(`div`,{className:`data-grid-tile data-entry-disabled`,children:[(0,I.jsx)(le,{size:28,className:`data-grid-glyph`}),(0,I.jsx)(`span`,{className:`data-grid-label`,children:n}),(0,I.jsx)(`span`,{className:`data-grid-sub`,children:`special`})]})},e.name)})}),!B&&N!==`home`&&O&&O.length>0&&k===`list`&&(0,I.jsx)(`ul`,{className:`data-entries`,children:O.map(e=>{let t=e.displayName??e.name;if(e.kind===`directory`){let n=Y&&X.has(e.name);return(0,I.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`data-entry-btn`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>{if(Z.current){Z.current=!1;return}if(Y){jt(e.name);return}J(z(e.name))},children:[Y&&(0,I.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,I.jsx)(_,{size:14}),(0,I.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t})]})},e.name)}if(e.kind===`file`){let n=Y&&X.has(e.name);return(0,I.jsx)(`li`,{className:`data-entry`,"data-selected":n?`true`:void 0,children:(0,I.jsxs)(`button`,{type:`button`,className:`data-entry-btn data-entry-file`,onPointerDown:()=>Mt(e.name),onPointerUp:$,onPointerMove:$,onPointerLeave:$,onPointerCancel:$,onClick:()=>Nt(e),title:Y?void 0:`Download ${t}`,children:[Y&&(0,I.jsx)(`span`,{className:`data-entry-select-indicator`,"aria-hidden":`true`}),(0,I.jsxs)(`span`,{className:`data-entry-text`,children:[(0,I.jsx)(`span`,{className:`data-entry-name`,title:e.name,children:t}),(0,I.jsxs)(`span`,{className:`data-entry-meta`,title:`Modified ${Je(e.modifiedAt,r)}`,children:[qe(e.sizeBytes),` · `,Je(e.modifiedAt,r)]})]})]})},e.name)}return(0,I.jsx)(`li`,{className:`data-entry`,children:(0,I.jsx)(`div`,{className:`data-entry-btn data-entry-file data-entry-disabled`,children:(0,I.jsxs)(`span`,{className:`data-entry-text`,children:[(0,I.jsx)(`span`,{className:`data-entry-name`,children:t}),(0,I.jsx)(`span`,{className:`data-entry-meta`,children:`special`})]})})},e.name)})})]})]})]}),Y&&(0,I.jsx)(`div`,{className:`data-select-bar`,role:`toolbar`,"aria-label":`Selection actions`,children:(0,I.jsxs)(`div`,{className:`data-select-bar-inner`,children:[(0,I.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:Vt,disabled:!kt||X.size===0,title:kt?`Share selected files`:`Sharing is not supported on this device`,children:[(0,I.jsx)(E,{size:16}),` Share`]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:zt,disabled:X.size===0,children:[(0,I.jsx)(g,{size:16}),` Download`]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-select-action`,onClick:()=>{let e=Lt();e&&(ct(e.name),ut(e.name))},disabled:!Lt(),children:[(0,I.jsx)(s,{size:16}),` Rename`]}),(0,I.jsxs)(`button`,{type:`button`,className:`data-select-action data-select-delete`,onClick:Bt,disabled:X.size===0,children:[(0,I.jsx)(u,{size:16}),` Delete`]})]})}),j&&(0,I.jsx)(`div`,{className:`chat-attachment-overlay`,role:`dialog`,"aria-label":j.alt,onClick:()=>de(null),children:(0,I.jsx)(`img`,{className:`chat-attachment-overlay-image`,src:j.src,alt:j.alt})})]}):(0,I.jsx)(d,{surface:`gate`})}function W({adminFetch:e,cacheKey:t,sessionRefetchNonce:n}){let r=(0,P.useCallback)(()=>{try{sessionStorage.removeItem(`maxy-admin-session-key`)}catch{}window.location.href=`/`},[]),a=(0,P.useCallback)(e=>{e===`chat`&&(window.location.href=`/`)},[]),[o,s]=(0,P.useState)([]),[c,l]=(0,P.useState)(`files`),{subAccounts:u,activeAccountId:d,switching:f,switchAccount:p}=x(t);return(0,P.useEffect)(()=>{if(!t)return;let e=!1;return fetch(`/api/operator-conversations/conversations?session_key=${encodeURIComponent(t)}`).then(e=>e.ok?e.json():{conversations:[]}).then(t=>{e||s(t.conversations??[])}).catch(()=>{}),()=>{e=!0}},[t]),(0,I.jsxs)(`main`,{className:`data-main`,children:[(0,I.jsx)(i,{variant:`operator`,onNavigate:a,onOpenConversations:o.length>0?()=>l(`conversations`):void 0,onToggleSidebar:()=>{},sidebarOpen:!1,onLogout:r,onDisconnect:async()=>!0,disconnecting:!1,subAccounts:u,activeAccountId:d,switchingAccount:f,onSwitchAccount:p}),c===`conversations`?(0,I.jsx)(Oe,{conversations:o,sessionKey:t,onBack:()=>l(`files`)}):(0,I.jsx)(U,{adminFetch:e,cacheKey:t,sessionRefetchNonce:n})]})}function G({cacheKey:e}){let{adminFetch:t,cacheKey:n,sessionRefetchNonce:r}=b({initialCacheKey:e,surface:`data`});return(0,I.jsx)(`div`,{className:`data-page`,children:(0,I.jsx)(`main`,{className:`data-main`,children:(0,I.jsx)(U,{adminFetch:t,cacheKey:n,sessionRefetchNonce:r})})})}function He({hit:e,mode:t,onDownload:n,onLocate:r}){let{zone:i}=o(),a=We(e.properties),s=Ge(e.properties),c=Ue(e.labels),l=Ke(e.properties),[u,d]=(0,P.useState)(!1),f=s&&s.length>280,p=u||!f?s:s?.slice(0,280)+`…`,m=t===`bm25`?`bm25 ${e.bm25Score.toFixed(2)}`:`vector ${e.vectorScore.toFixed(2)} · bm25 ${e.bm25Score.toFixed(2)} · combined ${e.score.toFixed(2)}`,h=e.properties.relativePath,g=typeof h==`string`&&h.length>0,ee=g?h.lastIndexOf(`/`):-1,v=g?ee===-1?`data`:h.slice(0,ee):null;return(0,I.jsxs)(`li`,{className:`data-result`,children:[(0,I.jsxs)(`div`,{role:`button`,tabIndex:0,className:`data-result-open`,onClick:()=>n(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e))},"aria-label":`Download ${a??c??`file`}`,children:[c&&(0,I.jsx)(`div`,{className:`data-result-header`,children:(0,I.jsx)(`span`,{className:`data-result-labels`,children:c})}),a&&(0,I.jsx)(`div`,{className:`data-result-title`,children:a}),s&&(0,I.jsx)(`pre`,{className:`data-result-body`,children:p}),(0,I.jsxs)(`div`,{className:`data-result-scores`,children:[l&&(0,I.jsxs)(`span`,{className:`data-result-updated`,children:[`Updated `,Je(l,i),` · `]}),m]})]}),g&&(0,I.jsxs)(`button`,{type:`button`,className:`data-result-locate`,onClick:()=>r(e),title:`Locate in ${v}`,"aria-label":`Locate in ${v}`,children:[(0,I.jsx)(_,{size:12}),v]}),f&&(0,I.jsx)(`button`,{type:`button`,className:`data-result-toggle`,onClick:()=>d(e=>!e),children:u?`Show less`:`Show more`})]})}function Ue(e){if(e.length===0)return null;let t=e[0].replace(/([a-z])([A-Z])/g,`$1 $2`);return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}function We(e){for(let t of[`title`,`name`,`summary`,`headline`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n.length>140?n.slice(0,140)+`…`:n}return null}function Ge(e){for(let t of[`content`,`summary`,`body`,`description`,`text`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function Ke(e){for(let t of[`updatedAt`,`modifiedAt`,`fetchedAt`,`createdAt`,`lastModified`]){let n=e[t];if(typeof n==`string`&&n.length>0)return n}return null}function qe(e){return e==null?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/1024/1024).toFixed(1)} MB`:`${(e/1024/1024/1024).toFixed(1)} GB`}function Je(e,t){return m(e,t)||`—`}export{R as i,G as n,z as r,Fe as t};
@@ -0,0 +1 @@
1
+ import{nt as e}from"./useMediaQuery-CLVRXJMp.js";var t=e(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]);export{t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-CvVXOszc.js";import{c as i}from"./useMediaQuery-C_1CV_iW.js";import"./useVoiceRecorder-DBzM_HIx.js";import{O as a}from"./AdminShell-1HyATV_t.js";import{a as o,c as s,i as c,o as l,r as u,s as d}from"./page-B72XigcU.js";import"./useCopyFeedback-DLSKs6r2.js";var f=n(),p=e(t(),1),m=r();function h({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[i,o]=(0,p.useState)(``),[s,c]=(0,p.useState)(!1),[l,u]=(0,p.useState)(null);async function d(e){e.preventDefault();let n=i.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,m.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,m.jsxs)(`div`,{className:`access-gate-message`,children:[(0,m.jsx)(`h2`,{children:`Verifying your link…`}),(0,m.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,m.jsxs)(`div`,{className:`access-gate-message`,children:[(0,m.jsx)(`h2`,{children:`That link did not work`}),(0,m.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,m.jsx)(a,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,m.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,m.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,m.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,m.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,m.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:i,onChange:e=>o(e.target.value),disabled:s}),l&&(0,m.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,m.jsx)(a,{type:`submit`,disabled:s||!i.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,m.jsxs)(`div`,{className:`access-gate-message`,children:[(0,m.jsx)(`h2`,{children:`Check your email`}),(0,m.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,m.jsx)(a,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function g(){let[e,t]=(0,p.useState)(null),[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(`loading`),[u,f]=(0,p.useState)(``),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),S=(0,p.useMemo)(()=>o(),[]),C=(0,p.useRef)(S||``),w=(0,p.useRef)(null),T=(0,p.useRef)(null),E=(0,p.useRef)(!1),D=(0,p.useRef)(null),[O,k]=(0,p.useState)(`request-link`),[A,j]=(0,p.useState)(null),M=(0,p.useRef)(null),N=(0,p.useRef)(null);(0,p.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,p.useEffect)(()=>{try{let e=l();e&&sessionStorage.setItem(c,e)}catch{}},[]);let P=(0,p.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}a(`chat`)},[]),F=(0,p.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),a(`auth-required`),k(`request-link`)},[]),I=(0,p.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,p.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:d(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return s&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),f(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),a(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&f(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),a(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return s&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:a,agentDisplayName:u,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,p.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function _(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:a,resolvedSlugRef:o}=g();return(0,p.useEffect)(()=>{e()},[e]),(0,p.useEffect)(()=>{if(!(typeof window>`u`))return i(document,window)},[]),t===`loading`?(0,m.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,m.jsx)(h,{gateState:n,setGateState:r,grantInfo:a,resolvedSlugRef:o}):(0,m.jsx)(`div`,{className:`public-shell`,children:(0,m.jsx)(u,{cacheKey:``,variant:`public`})})}(0,f.createRoot)(document.getElementById(`root`)).render((0,m.jsx)(_,{}));
1
+ import{o as e}from"./chunk-BycB0eMI.js";import{i as t,n,t as r}from"./jsx-runtime-BCAZhYqz.js";import{c as i}from"./useMediaQuery-CLVRXJMp.js";import"./useVoiceRecorder-BbJad9CQ.js";import{O as a}from"./AdminShell-CrCdEMNW.js";import{a as o,c as s,i as c,o as l,r as u,s as d}from"./page-DspGbDgK.js";import"./useCopyFeedback-CWvSi-Qe.js";var f=n(),p=e(t(),1),m=r();function h({gateState:e,setGateState:t,grantInfo:n,resolvedSlugRef:r}){let[i,o]=(0,p.useState)(``),[s,c]=(0,p.useState)(!1),[l,u]=(0,p.useState)(null);async function d(e){e.preventDefault();let n=i.trim().toLowerCase();if(!n){u(`Enter the email you were invited on.`);return}c(!0),u(null);try{let e=await fetch(`/api/access/request-magic-link`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({contactValue:n,agentSlug:r.current})});if(e.status===429){u((await e.json().catch(()=>({})))?.error||`Too many requests. Try again later.`);return}t(`request-sent`)}catch{u(`Could not reach the server. Check your connection and try again.`)}finally{c(!1)}}return(0,m.jsxs)(`div`,{className:`access-gate`,children:[e===`verifying`&&(0,m.jsxs)(`div`,{className:`access-gate-message`,children:[(0,m.jsx)(`h2`,{children:`Verifying your link…`}),(0,m.jsx)(`p`,{children:`This takes a moment.`})]}),e===`verify-failed`&&(0,m.jsxs)(`div`,{className:`access-gate-message`,children:[(0,m.jsx)(`h2`,{children:`That link did not work`}),(0,m.jsx)(`p`,{children:`It may have expired, already been used, or been for a different agent. You can request a fresh one below.`}),(0,m.jsx)(a,{onClick:()=>{t(`request-link`),u(null)},children:`Request a new link`})]}),e===`request-link`&&(0,m.jsxs)(`form`,{className:`access-gate-form`,onSubmit:d,children:[(0,m.jsx)(`h2`,{children:n?.displayName?`Welcome back, ${n.displayName}`:`Sign in`}),(0,m.jsx)(`p`,{children:`Enter the email you were invited on and we will send you a fresh link.`}),(0,m.jsx)(`label`,{htmlFor:`access-email`,children:`Email`}),(0,m.jsx)(`input`,{id:`access-email`,type:`email`,inputMode:`email`,autoComplete:`email`,value:i,onChange:e=>o(e.target.value),disabled:s}),l&&(0,m.jsx)(`p`,{className:`access-gate-error`,children:l}),(0,m.jsx)(a,{type:`submit`,disabled:s||!i.trim(),children:s?`Sending…`:`Send me a link`})]}),e===`request-sent`&&(0,m.jsxs)(`div`,{className:`access-gate-message`,children:[(0,m.jsx)(`h2`,{children:`Check your email`}),(0,m.jsx)(`p`,{children:`If that address is on the invite list, a fresh link is on the way. It expires in 15 minutes.`}),(0,m.jsx)(a,{onClick:()=>{t(`request-link`),o(``),u(null)},children:`Try a different email`})]})]})}function g(){let[e,t]=(0,p.useState)(null),[n,r]=(0,p.useState)(null),[i,a]=(0,p.useState)(`loading`),[u,f]=(0,p.useState)(``),[m,h]=(0,p.useState)(null),[g,_]=(0,p.useState)(null),[v,y]=(0,p.useState)(!1),[b,x]=(0,p.useState)(null),S=(0,p.useMemo)(()=>o(),[]),C=(0,p.useRef)(S||``),w=(0,p.useRef)(null),T=(0,p.useRef)(null),E=(0,p.useRef)(!1),D=(0,p.useRef)(null),[O,k]=(0,p.useState)(`request-link`),[A,j]=(0,p.useState)(null),M=(0,p.useRef)(null),N=(0,p.useRef)(null);(0,p.useEffect)(()=>{try{let e=sessionStorage.getItem(`maxy_session`);e&&(N.current=e)}catch{}},[]),(0,p.useEffect)(()=>{try{let e=l();e&&sessionStorage.setItem(c,e)}catch{}},[]);let P=(0,p.useCallback)(e=>{w.current=e,t(e);try{sessionStorage.setItem(`maxy_session`,e)}catch{}a(`chat`)},[]),F=(0,p.useCallback)(()=>{w.current=null;try{sessionStorage.removeItem(`maxy_session`)}catch{}t(null),a(`auth-required`),k(`request-link`)},[]),I=(0,p.useCallback)(async e=>{k(`verifying`);try{let t=C.current,n=await fetch(`/api/access/verify-token`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e,agentSlug:t})});if(window.history.replaceState({},``,window.location.pathname),n.ok){let e=await n.json().catch(()=>({}));return e?.displayName&&j({displayName:e.displayName,contactValue:``,expiresAt:null,status:`active`}),!0}return k(`verify-failed`),!1}catch{return k(`verify-failed`),!1}},[]),L=(0,p.useCallback)(async()=>{if(w.current)return w.current;if(T.current)return T.current;let e=(async()=>{try{let e=N.current,n=await fetch(`/api/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({session_id:d(),...S?{agent:S}:{},...e?{session_key:e}:{}})});if(!n.ok){let e=await n.json().catch(()=>({error:``}));return s&&console.error(`[session] POST /api/session failed: ${n.status} ${n.statusText}`,e),n.status===404?r(e.error||`Agent not found`):n.status===503&&r(e.error||`Service unavailable`),null}let i=await n.json();if(i.auth_required){i.agent_id&&(C.current=i.agent_id),f(i.displayName||``),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),a(`auth-required`);let e=new URLSearchParams(window.location.search).get(`token`);return e?await I(e)&&window.location.reload():k(`request-link`),null}w.current=i.session_key,t(i.session_key),i.displayName&&f(i.displayName),i.agentImage&&h(i.agentImage),i.agentImageShape&&_(i.agentImageShape),i.showAgentName&&y(i.showAgentName),i.branding&&x(i.branding),a(`chat`),i.resumed&&i.messages&&(E.current=!0,D.current=i.messages);try{sessionStorage.setItem(`maxy_session`,i.session_key)}catch{}return i.session_key}catch(e){return s&&console.error(`[session] fetch /api/session threw:`,e),r(`Unable to connect. Please check your connection and try again.`),null}finally{T.current=null}})();return T.current=e,e},[S,I]);return{sessionId:e,cacheKeyRef:w,sessionError:n,pageState:i,setPageState:a,agentDisplayName:u,agentImage:m,agentImageShape:g,showAgentName:v,agentSlug:S,branding:b,resolvedSlugRef:C,ensureSession:L,startNewSession:(0,p.useCallback)(async()=>{w.current=null,T.current=null,N.current=null,E.current=!1,D.current=null,t(null),r(null);try{sessionStorage.removeItem(`maxy_session`)}catch{}await L()},[L]),enterChat:P,enterGate:F,resumedRef:E,resumeMessagesRef:D,gateState:O,setGateState:k,grantInfo:A,setGrantInfo:j,gateCacheKeyRef:M}}function _(){let{ensureSession:e,pageState:t,gateState:n,setGateState:r,grantInfo:a,resolvedSlugRef:o}=g();return(0,p.useEffect)(()=>{e()},[e]),(0,p.useEffect)(()=>{if(!(typeof window>`u`))return i(document,window)},[]),t===`loading`?(0,m.jsx)(`div`,{className:`public-loading`,children:`Loading…`}):t===`auth-required`?(0,m.jsx)(h,{gateState:n,setGateState:r,grantInfo:a,resolvedSlugRef:o}):(0,m.jsx)(`div`,{className:`public-shell`,children:(0,m.jsx)(u,{cacheKey:``,variant:`public`})})}(0,f.createRoot)(document.getElementById(`root`)).render((0,m.jsx)(_,{}));
@@ -1 +1 @@
1
- import{nt as e}from"./useMediaQuery-C_1CV_iW.js";var t=e(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]);export{t};
1
+ import{nt as e}from"./useMediaQuery-CLVRXJMp.js";var t=e(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]);export{t};