@mecha.im/cli 0.3.4

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 (691) hide show
  1. package/Dockerfile +103 -0
  2. package/README.md +173 -0
  3. package/agent/activity.ts +31 -0
  4. package/agent/costs.ts +93 -0
  5. package/agent/dashboard/dist/assets/addon-fit-YJmn1quW.js +12 -0
  6. package/agent/dashboard/dist/assets/addon-web-links-BWjmmSgS.js +12 -0
  7. package/agent/dashboard/dist/assets/index-B4OKDQ7e.css +32 -0
  8. package/agent/dashboard/dist/assets/index-fZ_N6Wsi.js +193 -0
  9. package/agent/dashboard/dist/assets/xterm-BqvuqXEL.js +27 -0
  10. package/agent/dashboard/dist/index.html +19 -0
  11. package/agent/dashboard/dist/pixel-engine/characters/char_0.png +0 -0
  12. package/agent/dashboard/dist/pixel-engine/characters/char_1.png +0 -0
  13. package/agent/dashboard/dist/pixel-engine/characters/char_2.png +0 -0
  14. package/agent/dashboard/dist/pixel-engine/characters/char_3.png +0 -0
  15. package/agent/dashboard/dist/pixel-engine/characters/char_4.png +0 -0
  16. package/agent/dashboard/dist/pixel-engine/characters/char_5.png +0 -0
  17. package/agent/dashboard/dist/pixel-engine/default-layout.json +4320 -0
  18. package/agent/dashboard/dist/pixel-engine/floors/floor_0.png +0 -0
  19. package/agent/dashboard/dist/pixel-engine/floors/floor_1.png +0 -0
  20. package/agent/dashboard/dist/pixel-engine/floors/floor_2.png +0 -0
  21. package/agent/dashboard/dist/pixel-engine/floors/floor_3.png +0 -0
  22. package/agent/dashboard/dist/pixel-engine/floors/floor_4.png +0 -0
  23. package/agent/dashboard/dist/pixel-engine/floors/floor_5.png +0 -0
  24. package/agent/dashboard/dist/pixel-engine/floors/floor_6.png +0 -0
  25. package/agent/dashboard/dist/pixel-engine/floors/floor_7.png +0 -0
  26. package/agent/dashboard/dist/pixel-engine/floors/floor_8.png +0 -0
  27. package/agent/dashboard/dist/pixel-engine/fonts/FSPixelSansUnicode-Regular.ttf +0 -0
  28. package/agent/dashboard/dist/pixel-engine/furniture/BIN/BIN.png +0 -0
  29. package/agent/dashboard/dist/pixel-engine/furniture/BIN/manifest.json +13 -0
  30. package/agent/dashboard/dist/pixel-engine/furniture/BLACKBOARD/BLACKBOARD.png +0 -0
  31. package/agent/dashboard/dist/pixel-engine/furniture/BLACKBOARD/manifest.json +16 -0
  32. package/agent/dashboard/dist/pixel-engine/furniture/BOOKSHELF/BOOKSHELF.png +0 -0
  33. package/agent/dashboard/dist/pixel-engine/furniture/BOOKSHELF/manifest.json +16 -0
  34. package/agent/dashboard/dist/pixel-engine/furniture/CACTUS/CACTUS.png +0 -0
  35. package/agent/dashboard/dist/pixel-engine/furniture/CACTUS/manifest.json +13 -0
  36. package/agent/dashboard/dist/pixel-engine/furniture/CLOCK/CLOCK.png +0 -0
  37. package/agent/dashboard/dist/pixel-engine/furniture/CLOCK/manifest.json +13 -0
  38. package/agent/dashboard/dist/pixel-engine/furniture/COFFEE/COFFEE.png +0 -0
  39. package/agent/dashboard/dist/pixel-engine/furniture/COFFEE/manifest.json +13 -0
  40. package/agent/dashboard/dist/pixel-engine/furniture/COFFEE_TABLE/COFFEE_TABLE.png +0 -0
  41. package/agent/dashboard/dist/pixel-engine/furniture/COFFEE_TABLE/manifest.json +13 -0
  42. package/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_BENCH/CUSHIONED_BENCH.png +0 -0
  43. package/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_BENCH/manifest.json +13 -0
  44. package/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_BACK.png +0 -0
  45. package/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_FRONT.png +0 -0
  46. package/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_SIDE.png +0 -0
  47. package/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_CHAIR/manifest.json +44 -0
  48. package/agent/dashboard/dist/pixel-engine/furniture/DESK/DESK_FRONT.png +0 -0
  49. package/agent/dashboard/dist/pixel-engine/furniture/DESK/DESK_SIDE.png +0 -0
  50. package/agent/dashboard/dist/pixel-engine/furniture/DESK/manifest.json +33 -0
  51. package/agent/dashboard/dist/pixel-engine/furniture/DOUBLE_BOOKSHELF/DOUBLE_BOOKSHELF.png +0 -0
  52. package/agent/dashboard/dist/pixel-engine/furniture/DOUBLE_BOOKSHELF/manifest.json +16 -0
  53. package/agent/dashboard/dist/pixel-engine/furniture/FILE_BOXES_1/FILE_BOXES_1.png +0 -0
  54. package/agent/dashboard/dist/pixel-engine/furniture/FILE_BOXES_1/manifest.json +13 -0
  55. package/agent/dashboard/dist/pixel-engine/furniture/FILE_BOXES_2/FILE_BOXES_2.png +0 -0
  56. package/agent/dashboard/dist/pixel-engine/furniture/FILE_BOXES_2/manifest.json +13 -0
  57. package/agent/dashboard/dist/pixel-engine/furniture/HANGING_PLANT/HANGING_PLANT.png +0 -0
  58. package/agent/dashboard/dist/pixel-engine/furniture/HANGING_PLANT/manifest.json +13 -0
  59. package/agent/dashboard/dist/pixel-engine/furniture/LARGE_PAINTING/LARGE_PAINTING.png +0 -0
  60. package/agent/dashboard/dist/pixel-engine/furniture/LARGE_PAINTING/manifest.json +13 -0
  61. package/agent/dashboard/dist/pixel-engine/furniture/LARGE_PLANT/LARGE_PLANT.png +0 -0
  62. package/agent/dashboard/dist/pixel-engine/furniture/LARGE_PLANT/manifest.json +13 -0
  63. package/agent/dashboard/dist/pixel-engine/furniture/PC/PC_BACK.png +0 -0
  64. package/agent/dashboard/dist/pixel-engine/furniture/PC/PC_FRONT_OFF.png +0 -0
  65. package/agent/dashboard/dist/pixel-engine/furniture/PC/PC_FRONT_ON_1.png +0 -0
  66. package/agent/dashboard/dist/pixel-engine/furniture/PC/PC_FRONT_ON_2.png +0 -0
  67. package/agent/dashboard/dist/pixel-engine/furniture/PC/PC_FRONT_ON_3.png +0 -0
  68. package/agent/dashboard/dist/pixel-engine/furniture/PC/PC_SIDE.png +0 -0
  69. package/agent/dashboard/dist/pixel-engine/furniture/PC/manifest.json +88 -0
  70. package/agent/dashboard/dist/pixel-engine/furniture/PLANT/PLANT.png +0 -0
  71. package/agent/dashboard/dist/pixel-engine/furniture/PLANT/manifest.json +13 -0
  72. package/agent/dashboard/dist/pixel-engine/furniture/PLANT_2/PLANT_2.png +0 -0
  73. package/agent/dashboard/dist/pixel-engine/furniture/PLANT_2/manifest.json +13 -0
  74. package/agent/dashboard/dist/pixel-engine/furniture/POT/POT.png +0 -0
  75. package/agent/dashboard/dist/pixel-engine/furniture/POT/manifest.json +13 -0
  76. package/agent/dashboard/dist/pixel-engine/furniture/SMALL_PAINTING/SMALL_PAINTING.png +0 -0
  77. package/agent/dashboard/dist/pixel-engine/furniture/SMALL_PAINTING/manifest.json +13 -0
  78. package/agent/dashboard/dist/pixel-engine/furniture/SMALL_PAINTING_2/SMALL_PAINTING_2.png +0 -0
  79. package/agent/dashboard/dist/pixel-engine/furniture/SMALL_PAINTING_2/manifest.json +13 -0
  80. package/agent/dashboard/dist/pixel-engine/furniture/SMALL_TABLE/SMALL_TABLE_FRONT.png +0 -0
  81. package/agent/dashboard/dist/pixel-engine/furniture/SMALL_TABLE/SMALL_TABLE_SIDE.png +0 -0
  82. package/agent/dashboard/dist/pixel-engine/furniture/SMALL_TABLE/manifest.json +33 -0
  83. package/agent/dashboard/dist/pixel-engine/furniture/SOFA/SOFA_BACK.png +0 -0
  84. package/agent/dashboard/dist/pixel-engine/furniture/SOFA/SOFA_FRONT.png +0 -0
  85. package/agent/dashboard/dist/pixel-engine/furniture/SOFA/SOFA_SIDE.png +0 -0
  86. package/agent/dashboard/dist/pixel-engine/furniture/SOFA/manifest.json +44 -0
  87. package/agent/dashboard/dist/pixel-engine/furniture/TABLE_FRONT/TABLE_FRONT.png +0 -0
  88. package/agent/dashboard/dist/pixel-engine/furniture/TABLE_FRONT/manifest.json +13 -0
  89. package/agent/dashboard/dist/pixel-engine/furniture/VENDER_MACHINE/VENDER_MACHINE.png +0 -0
  90. package/agent/dashboard/dist/pixel-engine/furniture/VENDER_MACHINE/manifest.json +16 -0
  91. package/agent/dashboard/dist/pixel-engine/furniture/WATER_MACHINE/WATER_MACHINE.png +0 -0
  92. package/agent/dashboard/dist/pixel-engine/furniture/WATER_MACHINE/manifest.json +16 -0
  93. package/agent/dashboard/dist/pixel-engine/furniture/WHITEBOARD/WHITEBOARD.png +0 -0
  94. package/agent/dashboard/dist/pixel-engine/furniture/WHITEBOARD/manifest.json +16 -0
  95. package/agent/dashboard/dist/pixel-engine/furniture/WOODEN_BENCH/WOODEN_BENCH.png +0 -0
  96. package/agent/dashboard/dist/pixel-engine/furniture/WOODEN_BENCH/manifest.json +13 -0
  97. package/agent/dashboard/dist/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_BACK.png +0 -0
  98. package/agent/dashboard/dist/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_FRONT.png +0 -0
  99. package/agent/dashboard/dist/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_SIDE.png +0 -0
  100. package/agent/dashboard/dist/pixel-engine/furniture/WOODEN_CHAIR/manifest.json +44 -0
  101. package/agent/dashboard/dist/pixel-engine/furniture/index.json +32 -0
  102. package/agent/dashboard/dist/pixel-engine/walls/wall_0.png +0 -0
  103. package/agent/dashboard/index.html +18 -0
  104. package/agent/dashboard/package.json +41 -0
  105. package/agent/dashboard/public/pixel-engine/CREDITS.md +17 -0
  106. package/agent/dashboard/public/pixel-engine/characters/char_0.png +0 -0
  107. package/agent/dashboard/public/pixel-engine/characters/char_1.png +0 -0
  108. package/agent/dashboard/public/pixel-engine/characters/char_2.png +0 -0
  109. package/agent/dashboard/public/pixel-engine/characters/char_3.png +0 -0
  110. package/agent/dashboard/public/pixel-engine/characters/char_4.png +0 -0
  111. package/agent/dashboard/public/pixel-engine/characters/char_5.png +0 -0
  112. package/agent/dashboard/public/pixel-engine/default-layout.json +4320 -0
  113. package/agent/dashboard/public/pixel-engine/floors/floor_0.png +0 -0
  114. package/agent/dashboard/public/pixel-engine/floors/floor_1.png +0 -0
  115. package/agent/dashboard/public/pixel-engine/floors/floor_2.png +0 -0
  116. package/agent/dashboard/public/pixel-engine/floors/floor_3.png +0 -0
  117. package/agent/dashboard/public/pixel-engine/floors/floor_4.png +0 -0
  118. package/agent/dashboard/public/pixel-engine/floors/floor_5.png +0 -0
  119. package/agent/dashboard/public/pixel-engine/floors/floor_6.png +0 -0
  120. package/agent/dashboard/public/pixel-engine/floors/floor_7.png +0 -0
  121. package/agent/dashboard/public/pixel-engine/floors/floor_8.png +0 -0
  122. package/agent/dashboard/public/pixel-engine/fonts/FSPixelSansUnicode-Regular.ttf +0 -0
  123. package/agent/dashboard/public/pixel-engine/furniture/BIN/BIN.png +0 -0
  124. package/agent/dashboard/public/pixel-engine/furniture/BIN/manifest.json +13 -0
  125. package/agent/dashboard/public/pixel-engine/furniture/BLACKBOARD/BLACKBOARD.png +0 -0
  126. package/agent/dashboard/public/pixel-engine/furniture/BLACKBOARD/manifest.json +16 -0
  127. package/agent/dashboard/public/pixel-engine/furniture/BOOKSHELF/BOOKSHELF.png +0 -0
  128. package/agent/dashboard/public/pixel-engine/furniture/BOOKSHELF/manifest.json +16 -0
  129. package/agent/dashboard/public/pixel-engine/furniture/CACTUS/CACTUS.png +0 -0
  130. package/agent/dashboard/public/pixel-engine/furniture/CACTUS/manifest.json +13 -0
  131. package/agent/dashboard/public/pixel-engine/furniture/CLOCK/CLOCK.png +0 -0
  132. package/agent/dashboard/public/pixel-engine/furniture/CLOCK/manifest.json +13 -0
  133. package/agent/dashboard/public/pixel-engine/furniture/COFFEE/COFFEE.png +0 -0
  134. package/agent/dashboard/public/pixel-engine/furniture/COFFEE/manifest.json +13 -0
  135. package/agent/dashboard/public/pixel-engine/furniture/COFFEE_TABLE/COFFEE_TABLE.png +0 -0
  136. package/agent/dashboard/public/pixel-engine/furniture/COFFEE_TABLE/manifest.json +13 -0
  137. package/agent/dashboard/public/pixel-engine/furniture/CUSHIONED_BENCH/CUSHIONED_BENCH.png +0 -0
  138. package/agent/dashboard/public/pixel-engine/furniture/CUSHIONED_BENCH/manifest.json +13 -0
  139. package/agent/dashboard/public/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_BACK.png +0 -0
  140. package/agent/dashboard/public/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_FRONT.png +0 -0
  141. package/agent/dashboard/public/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_SIDE.png +0 -0
  142. package/agent/dashboard/public/pixel-engine/furniture/CUSHIONED_CHAIR/manifest.json +44 -0
  143. package/agent/dashboard/public/pixel-engine/furniture/DESK/DESK_FRONT.png +0 -0
  144. package/agent/dashboard/public/pixel-engine/furniture/DESK/DESK_SIDE.png +0 -0
  145. package/agent/dashboard/public/pixel-engine/furniture/DESK/manifest.json +33 -0
  146. package/agent/dashboard/public/pixel-engine/furniture/DOUBLE_BOOKSHELF/DOUBLE_BOOKSHELF.png +0 -0
  147. package/agent/dashboard/public/pixel-engine/furniture/DOUBLE_BOOKSHELF/manifest.json +16 -0
  148. package/agent/dashboard/public/pixel-engine/furniture/FILE_BOXES_1/FILE_BOXES_1.png +0 -0
  149. package/agent/dashboard/public/pixel-engine/furniture/FILE_BOXES_1/manifest.json +13 -0
  150. package/agent/dashboard/public/pixel-engine/furniture/FILE_BOXES_2/FILE_BOXES_2.png +0 -0
  151. package/agent/dashboard/public/pixel-engine/furniture/FILE_BOXES_2/manifest.json +13 -0
  152. package/agent/dashboard/public/pixel-engine/furniture/HANGING_PLANT/HANGING_PLANT.png +0 -0
  153. package/agent/dashboard/public/pixel-engine/furniture/HANGING_PLANT/manifest.json +13 -0
  154. package/agent/dashboard/public/pixel-engine/furniture/LARGE_PAINTING/LARGE_PAINTING.png +0 -0
  155. package/agent/dashboard/public/pixel-engine/furniture/LARGE_PAINTING/manifest.json +13 -0
  156. package/agent/dashboard/public/pixel-engine/furniture/LARGE_PLANT/LARGE_PLANT.png +0 -0
  157. package/agent/dashboard/public/pixel-engine/furniture/LARGE_PLANT/manifest.json +13 -0
  158. package/agent/dashboard/public/pixel-engine/furniture/PC/PC_BACK.png +0 -0
  159. package/agent/dashboard/public/pixel-engine/furniture/PC/PC_FRONT_OFF.png +0 -0
  160. package/agent/dashboard/public/pixel-engine/furniture/PC/PC_FRONT_ON_1.png +0 -0
  161. package/agent/dashboard/public/pixel-engine/furniture/PC/PC_FRONT_ON_2.png +0 -0
  162. package/agent/dashboard/public/pixel-engine/furniture/PC/PC_FRONT_ON_3.png +0 -0
  163. package/agent/dashboard/public/pixel-engine/furniture/PC/PC_SIDE.png +0 -0
  164. package/agent/dashboard/public/pixel-engine/furniture/PC/manifest.json +88 -0
  165. package/agent/dashboard/public/pixel-engine/furniture/PLANT/PLANT.png +0 -0
  166. package/agent/dashboard/public/pixel-engine/furniture/PLANT/manifest.json +13 -0
  167. package/agent/dashboard/public/pixel-engine/furniture/PLANT_2/PLANT_2.png +0 -0
  168. package/agent/dashboard/public/pixel-engine/furniture/PLANT_2/manifest.json +13 -0
  169. package/agent/dashboard/public/pixel-engine/furniture/POT/POT.png +0 -0
  170. package/agent/dashboard/public/pixel-engine/furniture/POT/manifest.json +13 -0
  171. package/agent/dashboard/public/pixel-engine/furniture/SMALL_PAINTING/SMALL_PAINTING.png +0 -0
  172. package/agent/dashboard/public/pixel-engine/furniture/SMALL_PAINTING/manifest.json +13 -0
  173. package/agent/dashboard/public/pixel-engine/furniture/SMALL_PAINTING_2/SMALL_PAINTING_2.png +0 -0
  174. package/agent/dashboard/public/pixel-engine/furniture/SMALL_PAINTING_2/manifest.json +13 -0
  175. package/agent/dashboard/public/pixel-engine/furniture/SMALL_TABLE/SMALL_TABLE_FRONT.png +0 -0
  176. package/agent/dashboard/public/pixel-engine/furniture/SMALL_TABLE/SMALL_TABLE_SIDE.png +0 -0
  177. package/agent/dashboard/public/pixel-engine/furniture/SMALL_TABLE/manifest.json +33 -0
  178. package/agent/dashboard/public/pixel-engine/furniture/SOFA/SOFA_BACK.png +0 -0
  179. package/agent/dashboard/public/pixel-engine/furniture/SOFA/SOFA_FRONT.png +0 -0
  180. package/agent/dashboard/public/pixel-engine/furniture/SOFA/SOFA_SIDE.png +0 -0
  181. package/agent/dashboard/public/pixel-engine/furniture/SOFA/manifest.json +44 -0
  182. package/agent/dashboard/public/pixel-engine/furniture/TABLE_FRONT/TABLE_FRONT.png +0 -0
  183. package/agent/dashboard/public/pixel-engine/furniture/TABLE_FRONT/manifest.json +13 -0
  184. package/agent/dashboard/public/pixel-engine/furniture/VENDER_MACHINE/VENDER_MACHINE.png +0 -0
  185. package/agent/dashboard/public/pixel-engine/furniture/VENDER_MACHINE/manifest.json +16 -0
  186. package/agent/dashboard/public/pixel-engine/furniture/WATER_MACHINE/WATER_MACHINE.png +0 -0
  187. package/agent/dashboard/public/pixel-engine/furniture/WATER_MACHINE/manifest.json +16 -0
  188. package/agent/dashboard/public/pixel-engine/furniture/WHITEBOARD/WHITEBOARD.png +0 -0
  189. package/agent/dashboard/public/pixel-engine/furniture/WHITEBOARD/manifest.json +16 -0
  190. package/agent/dashboard/public/pixel-engine/furniture/WOODEN_BENCH/WOODEN_BENCH.png +0 -0
  191. package/agent/dashboard/public/pixel-engine/furniture/WOODEN_BENCH/manifest.json +13 -0
  192. package/agent/dashboard/public/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_BACK.png +0 -0
  193. package/agent/dashboard/public/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_FRONT.png +0 -0
  194. package/agent/dashboard/public/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_SIDE.png +0 -0
  195. package/agent/dashboard/public/pixel-engine/furniture/WOODEN_CHAIR/manifest.json +44 -0
  196. package/agent/dashboard/public/pixel-engine/furniture/index.json +32 -0
  197. package/agent/dashboard/public/pixel-engine/walls/wall_0.png +0 -0
  198. package/agent/dashboard/src/app.tsx +223 -0
  199. package/agent/dashboard/src/components/alert.tsx +24 -0
  200. package/agent/dashboard/src/components/badge.tsx +41 -0
  201. package/agent/dashboard/src/components/button.tsx +44 -0
  202. package/agent/dashboard/src/components/card.tsx +21 -0
  203. package/agent/dashboard/src/components/dialog.tsx +28 -0
  204. package/agent/dashboard/src/components/index.ts +7 -0
  205. package/agent/dashboard/src/components/input.tsx +45 -0
  206. package/agent/dashboard/src/components/status-dot.tsx +31 -0
  207. package/agent/dashboard/src/index.css +126 -0
  208. package/agent/dashboard/src/lib/api.test.ts +41 -0
  209. package/agent/dashboard/src/lib/api.ts +53 -0
  210. package/agent/dashboard/src/lib/fleet-context.tsx +92 -0
  211. package/agent/dashboard/src/lib/format.test.ts +119 -0
  212. package/agent/dashboard/src/lib/format.ts +41 -0
  213. package/agent/dashboard/src/lib/login-gate.tsx +117 -0
  214. package/agent/dashboard/src/lib/sanitize.test.ts +86 -0
  215. package/agent/dashboard/src/lib/sanitize.ts +13 -0
  216. package/agent/dashboard/src/lib/snippet.test.ts +50 -0
  217. package/agent/dashboard/src/lib/snippet.ts +15 -0
  218. package/agent/dashboard/src/lib/ws-parse.test.ts +72 -0
  219. package/agent/dashboard/src/lib/ws-parse.ts +46 -0
  220. package/agent/dashboard/src/main.tsx +25 -0
  221. package/agent/dashboard/src/pixel-engine/colorize.ts +230 -0
  222. package/agent/dashboard/src/pixel-engine/components/BottomToolbar.tsx +83 -0
  223. package/agent/dashboard/src/pixel-engine/components/DebugView.tsx +175 -0
  224. package/agent/dashboard/src/pixel-engine/components/OfficeCanvas.tsx +838 -0
  225. package/agent/dashboard/src/pixel-engine/components/PixelOffice.tsx +646 -0
  226. package/agent/dashboard/src/pixel-engine/components/SettingsModal.tsx +213 -0
  227. package/agent/dashboard/src/pixel-engine/components/ToolOverlay.tsx +203 -0
  228. package/agent/dashboard/src/pixel-engine/components/ZoomControls.tsx +177 -0
  229. package/agent/dashboard/src/pixel-engine/constants.ts +132 -0
  230. package/agent/dashboard/src/pixel-engine/editor/EditorToolbar.tsx +737 -0
  231. package/agent/dashboard/src/pixel-engine/editor/editorActions.ts +291 -0
  232. package/agent/dashboard/src/pixel-engine/editor/editorState.ts +123 -0
  233. package/agent/dashboard/src/pixel-engine/engine/characters.ts +595 -0
  234. package/agent/dashboard/src/pixel-engine/engine/gameLoop.ts +50 -0
  235. package/agent/dashboard/src/pixel-engine/engine/interactionScheduler.ts +442 -0
  236. package/agent/dashboard/src/pixel-engine/engine/matrixEffect.ts +139 -0
  237. package/agent/dashboard/src/pixel-engine/engine/officeState.ts +748 -0
  238. package/agent/dashboard/src/pixel-engine/engine/renderer.ts +693 -0
  239. package/agent/dashboard/src/pixel-engine/floorTiles.ts +74 -0
  240. package/agent/dashboard/src/pixel-engine/hooks/useAssetLoader.ts +488 -0
  241. package/agent/dashboard/src/pixel-engine/hooks/useEditorActions.ts +661 -0
  242. package/agent/dashboard/src/pixel-engine/hooks/useEditorKeyboard.ts +83 -0
  243. package/agent/dashboard/src/pixel-engine/hooks/useLayoutPersistence.ts +162 -0
  244. package/agent/dashboard/src/pixel-engine/hooks/useOfficeStream.ts +353 -0
  245. package/agent/dashboard/src/pixel-engine/layout/furnitureCatalog.ts +417 -0
  246. package/agent/dashboard/src/pixel-engine/layout/layoutSerializer.ts +416 -0
  247. package/agent/dashboard/src/pixel-engine/layout/tileMap.ts +109 -0
  248. package/agent/dashboard/src/pixel-engine/notificationSound.ts +69 -0
  249. package/agent/dashboard/src/pixel-engine/pixel-office.css +55 -0
  250. package/agent/dashboard/src/pixel-engine/sprites/bubble-permission.json +27 -0
  251. package/agent/dashboard/src/pixel-engine/sprites/bubble-waiting.json +27 -0
  252. package/agent/dashboard/src/pixel-engine/sprites/spriteCache.ts +82 -0
  253. package/agent/dashboard/src/pixel-engine/sprites/spriteData.ts +176 -0
  254. package/agent/dashboard/src/pixel-engine/toolUtils.ts +28 -0
  255. package/agent/dashboard/src/pixel-engine/types.ts +232 -0
  256. package/agent/dashboard/src/pixel-engine/wallTiles.ts +203 -0
  257. package/agent/dashboard/src/views/auth.tsx +249 -0
  258. package/agent/dashboard/src/views/fleet.tsx +263 -0
  259. package/agent/dashboard/src/views/network.tsx +106 -0
  260. package/agent/dashboard/src/views/schedule-types.ts +12 -0
  261. package/agent/dashboard/src/views/schedule-utils.ts +49 -0
  262. package/agent/dashboard/src/views/schedule.tsx +326 -0
  263. package/agent/dashboard/src/views/sessions/conversation-viewer.tsx +279 -0
  264. package/agent/dashboard/src/views/sessions/session-detail.tsx +48 -0
  265. package/agent/dashboard/src/views/sessions/session-list.tsx +265 -0
  266. package/agent/dashboard/src/views/sessions/terminal-pane.tsx +270 -0
  267. package/agent/dashboard/src/views/sessions.tsx +55 -0
  268. package/agent/dashboard/src/views/settings-config.tsx +265 -0
  269. package/agent/dashboard/src/views/settings-logs.tsx +99 -0
  270. package/agent/dashboard/src/views/settings-status.tsx +215 -0
  271. package/agent/dashboard/src/views/settings.tsx +324 -0
  272. package/agent/dashboard/src/views/webhooks.tsx +230 -0
  273. package/agent/dashboard/src/vite-env.d.ts +3 -0
  274. package/agent/dashboard/tsconfig.json +13 -0
  275. package/agent/entry.ts +168 -0
  276. package/agent/event-log.ts +103 -0
  277. package/agent/node-pty-adapter.ts +39 -0
  278. package/agent/paths.ts +12 -0
  279. package/agent/pty-manager.ts +265 -0
  280. package/agent/pty-types.ts +25 -0
  281. package/agent/routes/api.ts +149 -0
  282. package/agent/routes/config.ts +116 -0
  283. package/agent/routes/dashboard.ts +101 -0
  284. package/agent/routes/schedule.ts +84 -0
  285. package/agent/routes/sessions.ts +43 -0
  286. package/agent/routes/webhooks.ts +113 -0
  287. package/agent/scheduler.ts +373 -0
  288. package/agent/server-schema.ts +25 -0
  289. package/agent/server-utils.ts +163 -0
  290. package/agent/server.ts +218 -0
  291. package/agent/server.types.ts +39 -0
  292. package/agent/session-history-types.ts +78 -0
  293. package/agent/session-history-utils.ts +96 -0
  294. package/agent/session-history.ts +318 -0
  295. package/agent/session.ts +152 -0
  296. package/agent/tools/mecha-call.ts +106 -0
  297. package/agent/tools/mecha-fleet.ts +176 -0
  298. package/agent/tools/mecha-list.ts +56 -0
  299. package/agent/tools/mecha-server.ts +70 -0
  300. package/agent/types.ts +35 -0
  301. package/agent/webhook.ts +127 -0
  302. package/agent/ws-terminal.ts +174 -0
  303. package/dist/agent/activity.d.ts +14 -0
  304. package/dist/agent/activity.d.ts.map +1 -0
  305. package/dist/agent/activity.js +25 -0
  306. package/dist/agent/activity.js.map +1 -0
  307. package/dist/agent/character-config.test.d.ts +2 -0
  308. package/dist/agent/character-config.test.d.ts.map +1 -0
  309. package/dist/agent/character-config.test.js +51 -0
  310. package/dist/agent/character-config.test.js.map +1 -0
  311. package/dist/agent/costs.d.ts +16 -0
  312. package/dist/agent/costs.d.ts.map +1 -0
  313. package/dist/agent/costs.js +82 -0
  314. package/dist/agent/costs.js.map +1 -0
  315. package/dist/agent/dashboard/dist/assets/addon-fit-YJmn1quW.js +12 -0
  316. package/dist/agent/dashboard/dist/assets/addon-web-links-BWjmmSgS.js +12 -0
  317. package/dist/agent/dashboard/dist/assets/index-B4OKDQ7e.css +32 -0
  318. package/dist/agent/dashboard/dist/assets/index-fZ_N6Wsi.js +193 -0
  319. package/dist/agent/dashboard/dist/assets/xterm-BqvuqXEL.js +27 -0
  320. package/dist/agent/dashboard/dist/index.html +19 -0
  321. package/dist/agent/dashboard/dist/pixel-engine/characters/char_0.png +0 -0
  322. package/dist/agent/dashboard/dist/pixel-engine/characters/char_1.png +0 -0
  323. package/dist/agent/dashboard/dist/pixel-engine/characters/char_2.png +0 -0
  324. package/dist/agent/dashboard/dist/pixel-engine/characters/char_3.png +0 -0
  325. package/dist/agent/dashboard/dist/pixel-engine/characters/char_4.png +0 -0
  326. package/dist/agent/dashboard/dist/pixel-engine/characters/char_5.png +0 -0
  327. package/dist/agent/dashboard/dist/pixel-engine/default-layout.json +4320 -0
  328. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_0.png +0 -0
  329. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_1.png +0 -0
  330. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_2.png +0 -0
  331. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_3.png +0 -0
  332. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_4.png +0 -0
  333. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_5.png +0 -0
  334. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_6.png +0 -0
  335. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_7.png +0 -0
  336. package/dist/agent/dashboard/dist/pixel-engine/floors/floor_8.png +0 -0
  337. package/dist/agent/dashboard/dist/pixel-engine/fonts/FSPixelSansUnicode-Regular.ttf +0 -0
  338. package/dist/agent/dashboard/dist/pixel-engine/furniture/BIN/BIN.png +0 -0
  339. package/dist/agent/dashboard/dist/pixel-engine/furniture/BIN/manifest.json +13 -0
  340. package/dist/agent/dashboard/dist/pixel-engine/furniture/BLACKBOARD/BLACKBOARD.png +0 -0
  341. package/dist/agent/dashboard/dist/pixel-engine/furniture/BLACKBOARD/manifest.json +16 -0
  342. package/dist/agent/dashboard/dist/pixel-engine/furniture/BOOKSHELF/BOOKSHELF.png +0 -0
  343. package/dist/agent/dashboard/dist/pixel-engine/furniture/BOOKSHELF/manifest.json +16 -0
  344. package/dist/agent/dashboard/dist/pixel-engine/furniture/CACTUS/CACTUS.png +0 -0
  345. package/dist/agent/dashboard/dist/pixel-engine/furniture/CACTUS/manifest.json +13 -0
  346. package/dist/agent/dashboard/dist/pixel-engine/furniture/CLOCK/CLOCK.png +0 -0
  347. package/dist/agent/dashboard/dist/pixel-engine/furniture/CLOCK/manifest.json +13 -0
  348. package/dist/agent/dashboard/dist/pixel-engine/furniture/COFFEE/COFFEE.png +0 -0
  349. package/dist/agent/dashboard/dist/pixel-engine/furniture/COFFEE/manifest.json +13 -0
  350. package/dist/agent/dashboard/dist/pixel-engine/furniture/COFFEE_TABLE/COFFEE_TABLE.png +0 -0
  351. package/dist/agent/dashboard/dist/pixel-engine/furniture/COFFEE_TABLE/manifest.json +13 -0
  352. package/dist/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_BENCH/CUSHIONED_BENCH.png +0 -0
  353. package/dist/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_BENCH/manifest.json +13 -0
  354. package/dist/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_BACK.png +0 -0
  355. package/dist/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_FRONT.png +0 -0
  356. package/dist/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_CHAIR/CUSHIONED_CHAIR_SIDE.png +0 -0
  357. package/dist/agent/dashboard/dist/pixel-engine/furniture/CUSHIONED_CHAIR/manifest.json +44 -0
  358. package/dist/agent/dashboard/dist/pixel-engine/furniture/DESK/DESK_FRONT.png +0 -0
  359. package/dist/agent/dashboard/dist/pixel-engine/furniture/DESK/DESK_SIDE.png +0 -0
  360. package/dist/agent/dashboard/dist/pixel-engine/furniture/DESK/manifest.json +33 -0
  361. package/dist/agent/dashboard/dist/pixel-engine/furniture/DOUBLE_BOOKSHELF/DOUBLE_BOOKSHELF.png +0 -0
  362. package/dist/agent/dashboard/dist/pixel-engine/furniture/DOUBLE_BOOKSHELF/manifest.json +16 -0
  363. package/dist/agent/dashboard/dist/pixel-engine/furniture/FILE_BOXES_1/FILE_BOXES_1.png +0 -0
  364. package/dist/agent/dashboard/dist/pixel-engine/furniture/FILE_BOXES_1/manifest.json +13 -0
  365. package/dist/agent/dashboard/dist/pixel-engine/furniture/FILE_BOXES_2/FILE_BOXES_2.png +0 -0
  366. package/dist/agent/dashboard/dist/pixel-engine/furniture/FILE_BOXES_2/manifest.json +13 -0
  367. package/dist/agent/dashboard/dist/pixel-engine/furniture/HANGING_PLANT/HANGING_PLANT.png +0 -0
  368. package/dist/agent/dashboard/dist/pixel-engine/furniture/HANGING_PLANT/manifest.json +13 -0
  369. package/dist/agent/dashboard/dist/pixel-engine/furniture/LARGE_PAINTING/LARGE_PAINTING.png +0 -0
  370. package/dist/agent/dashboard/dist/pixel-engine/furniture/LARGE_PAINTING/manifest.json +13 -0
  371. package/dist/agent/dashboard/dist/pixel-engine/furniture/LARGE_PLANT/LARGE_PLANT.png +0 -0
  372. package/dist/agent/dashboard/dist/pixel-engine/furniture/LARGE_PLANT/manifest.json +13 -0
  373. package/dist/agent/dashboard/dist/pixel-engine/furniture/PC/PC_BACK.png +0 -0
  374. package/dist/agent/dashboard/dist/pixel-engine/furniture/PC/PC_FRONT_OFF.png +0 -0
  375. package/dist/agent/dashboard/dist/pixel-engine/furniture/PC/PC_FRONT_ON_1.png +0 -0
  376. package/dist/agent/dashboard/dist/pixel-engine/furniture/PC/PC_FRONT_ON_2.png +0 -0
  377. package/dist/agent/dashboard/dist/pixel-engine/furniture/PC/PC_FRONT_ON_3.png +0 -0
  378. package/dist/agent/dashboard/dist/pixel-engine/furniture/PC/PC_SIDE.png +0 -0
  379. package/dist/agent/dashboard/dist/pixel-engine/furniture/PC/manifest.json +88 -0
  380. package/dist/agent/dashboard/dist/pixel-engine/furniture/PLANT/PLANT.png +0 -0
  381. package/dist/agent/dashboard/dist/pixel-engine/furniture/PLANT/manifest.json +13 -0
  382. package/dist/agent/dashboard/dist/pixel-engine/furniture/PLANT_2/PLANT_2.png +0 -0
  383. package/dist/agent/dashboard/dist/pixel-engine/furniture/PLANT_2/manifest.json +13 -0
  384. package/dist/agent/dashboard/dist/pixel-engine/furniture/POT/POT.png +0 -0
  385. package/dist/agent/dashboard/dist/pixel-engine/furniture/POT/manifest.json +13 -0
  386. package/dist/agent/dashboard/dist/pixel-engine/furniture/SMALL_PAINTING/SMALL_PAINTING.png +0 -0
  387. package/dist/agent/dashboard/dist/pixel-engine/furniture/SMALL_PAINTING/manifest.json +13 -0
  388. package/dist/agent/dashboard/dist/pixel-engine/furniture/SMALL_PAINTING_2/SMALL_PAINTING_2.png +0 -0
  389. package/dist/agent/dashboard/dist/pixel-engine/furniture/SMALL_PAINTING_2/manifest.json +13 -0
  390. package/dist/agent/dashboard/dist/pixel-engine/furniture/SMALL_TABLE/SMALL_TABLE_FRONT.png +0 -0
  391. package/dist/agent/dashboard/dist/pixel-engine/furniture/SMALL_TABLE/SMALL_TABLE_SIDE.png +0 -0
  392. package/dist/agent/dashboard/dist/pixel-engine/furniture/SMALL_TABLE/manifest.json +33 -0
  393. package/dist/agent/dashboard/dist/pixel-engine/furniture/SOFA/SOFA_BACK.png +0 -0
  394. package/dist/agent/dashboard/dist/pixel-engine/furniture/SOFA/SOFA_FRONT.png +0 -0
  395. package/dist/agent/dashboard/dist/pixel-engine/furniture/SOFA/SOFA_SIDE.png +0 -0
  396. package/dist/agent/dashboard/dist/pixel-engine/furniture/SOFA/manifest.json +44 -0
  397. package/dist/agent/dashboard/dist/pixel-engine/furniture/TABLE_FRONT/TABLE_FRONT.png +0 -0
  398. package/dist/agent/dashboard/dist/pixel-engine/furniture/TABLE_FRONT/manifest.json +13 -0
  399. package/dist/agent/dashboard/dist/pixel-engine/furniture/VENDER_MACHINE/VENDER_MACHINE.png +0 -0
  400. package/dist/agent/dashboard/dist/pixel-engine/furniture/VENDER_MACHINE/manifest.json +16 -0
  401. package/dist/agent/dashboard/dist/pixel-engine/furniture/WATER_MACHINE/WATER_MACHINE.png +0 -0
  402. package/dist/agent/dashboard/dist/pixel-engine/furniture/WATER_MACHINE/manifest.json +16 -0
  403. package/dist/agent/dashboard/dist/pixel-engine/furniture/WHITEBOARD/WHITEBOARD.png +0 -0
  404. package/dist/agent/dashboard/dist/pixel-engine/furniture/WHITEBOARD/manifest.json +16 -0
  405. package/dist/agent/dashboard/dist/pixel-engine/furniture/WOODEN_BENCH/WOODEN_BENCH.png +0 -0
  406. package/dist/agent/dashboard/dist/pixel-engine/furniture/WOODEN_BENCH/manifest.json +13 -0
  407. package/dist/agent/dashboard/dist/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_BACK.png +0 -0
  408. package/dist/agent/dashboard/dist/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_FRONT.png +0 -0
  409. package/dist/agent/dashboard/dist/pixel-engine/furniture/WOODEN_CHAIR/WOODEN_CHAIR_SIDE.png +0 -0
  410. package/dist/agent/dashboard/dist/pixel-engine/furniture/WOODEN_CHAIR/manifest.json +44 -0
  411. package/dist/agent/dashboard/dist/pixel-engine/furniture/index.json +32 -0
  412. package/dist/agent/dashboard/dist/pixel-engine/walls/wall_0.png +0 -0
  413. package/dist/agent/entry.d.ts +2 -0
  414. package/dist/agent/entry.d.ts.map +1 -0
  415. package/dist/agent/entry.js +157 -0
  416. package/dist/agent/entry.js.map +1 -0
  417. package/dist/agent/event-log.d.ts +11 -0
  418. package/dist/agent/event-log.d.ts.map +1 -0
  419. package/dist/agent/event-log.js +102 -0
  420. package/dist/agent/event-log.js.map +1 -0
  421. package/dist/agent/node-pty-adapter.d.ts +4 -0
  422. package/dist/agent/node-pty-adapter.d.ts.map +1 -0
  423. package/dist/agent/node-pty-adapter.js +35 -0
  424. package/dist/agent/node-pty-adapter.js.map +1 -0
  425. package/dist/agent/paths.d.ts +11 -0
  426. package/dist/agent/paths.d.ts.map +1 -0
  427. package/dist/agent/paths.js +12 -0
  428. package/dist/agent/paths.js.map +1 -0
  429. package/dist/agent/pty-manager.d.ts +34 -0
  430. package/dist/agent/pty-manager.d.ts.map +1 -0
  431. package/dist/agent/pty-manager.js +210 -0
  432. package/dist/agent/pty-manager.js.map +1 -0
  433. package/dist/agent/pty-types.d.ts +26 -0
  434. package/dist/agent/pty-types.d.ts.map +1 -0
  435. package/dist/agent/pty-types.js +2 -0
  436. package/dist/agent/pty-types.js.map +1 -0
  437. package/dist/agent/routes/api.d.ts +17 -0
  438. package/dist/agent/routes/api.d.ts.map +1 -0
  439. package/dist/agent/routes/api.js +125 -0
  440. package/dist/agent/routes/api.js.map +1 -0
  441. package/dist/agent/routes/config.d.ts +6 -0
  442. package/dist/agent/routes/config.d.ts.map +1 -0
  443. package/dist/agent/routes/config.js +116 -0
  444. package/dist/agent/routes/config.js.map +1 -0
  445. package/dist/agent/routes/dashboard.d.ts +4 -0
  446. package/dist/agent/routes/dashboard.d.ts.map +1 -0
  447. package/dist/agent/routes/dashboard.js +97 -0
  448. package/dist/agent/routes/dashboard.js.map +1 -0
  449. package/dist/agent/routes/schedule.d.ts +4 -0
  450. package/dist/agent/routes/schedule.d.ts.map +1 -0
  451. package/dist/agent/routes/schedule.js +98 -0
  452. package/dist/agent/routes/schedule.js.map +1 -0
  453. package/dist/agent/routes/sessions.d.ts +4 -0
  454. package/dist/agent/routes/sessions.d.ts.map +1 -0
  455. package/dist/agent/routes/sessions.js +43 -0
  456. package/dist/agent/routes/sessions.js.map +1 -0
  457. package/dist/agent/routes/webhooks.d.ts +5 -0
  458. package/dist/agent/routes/webhooks.d.ts.map +1 -0
  459. package/dist/agent/routes/webhooks.js +102 -0
  460. package/dist/agent/routes/webhooks.js.map +1 -0
  461. package/dist/agent/scheduler.d.ts +50 -0
  462. package/dist/agent/scheduler.d.ts.map +1 -0
  463. package/dist/agent/scheduler.js +332 -0
  464. package/dist/agent/scheduler.js.map +1 -0
  465. package/dist/agent/server-schema.d.ts +20 -0
  466. package/dist/agent/server-schema.d.ts.map +1 -0
  467. package/dist/agent/server-schema.js +20 -0
  468. package/dist/agent/server-schema.js.map +1 -0
  469. package/dist/agent/server-utils.d.ts +18 -0
  470. package/dist/agent/server-utils.d.ts.map +1 -0
  471. package/dist/agent/server-utils.js +132 -0
  472. package/dist/agent/server-utils.js.map +1 -0
  473. package/dist/agent/server.d.ts +17 -0
  474. package/dist/agent/server.d.ts.map +1 -0
  475. package/dist/agent/server.js +196 -0
  476. package/dist/agent/server.js.map +1 -0
  477. package/dist/agent/server.types.d.ts +38 -0
  478. package/dist/agent/server.types.d.ts.map +1 -0
  479. package/dist/agent/server.types.js +2 -0
  480. package/dist/agent/server.types.js.map +1 -0
  481. package/dist/agent/session-history-types.d.ts +74 -0
  482. package/dist/agent/session-history-types.d.ts.map +1 -0
  483. package/dist/agent/session-history-types.js +2 -0
  484. package/dist/agent/session-history-types.js.map +1 -0
  485. package/dist/agent/session-history-utils.d.ts +13 -0
  486. package/dist/agent/session-history-utils.d.ts.map +1 -0
  487. package/dist/agent/session-history-utils.js +102 -0
  488. package/dist/agent/session-history-utils.js.map +1 -0
  489. package/dist/agent/session-history.d.ts +20 -0
  490. package/dist/agent/session-history.d.ts.map +1 -0
  491. package/dist/agent/session-history.js +282 -0
  492. package/dist/agent/session-history.js.map +1 -0
  493. package/dist/agent/session.d.ts +51 -0
  494. package/dist/agent/session.d.ts.map +1 -0
  495. package/dist/agent/session.js +135 -0
  496. package/dist/agent/session.js.map +1 -0
  497. package/dist/agent/tools/mecha-call.d.ts +2 -0
  498. package/dist/agent/tools/mecha-call.d.ts.map +1 -0
  499. package/dist/agent/tools/mecha-call.js +101 -0
  500. package/dist/agent/tools/mecha-call.js.map +1 -0
  501. package/dist/agent/tools/mecha-fleet.d.ts +25 -0
  502. package/dist/agent/tools/mecha-fleet.d.ts.map +1 -0
  503. package/dist/agent/tools/mecha-fleet.js +144 -0
  504. package/dist/agent/tools/mecha-fleet.js.map +1 -0
  505. package/dist/agent/tools/mecha-list.d.ts +6 -0
  506. package/dist/agent/tools/mecha-list.d.ts.map +1 -0
  507. package/dist/agent/tools/mecha-list.js +46 -0
  508. package/dist/agent/tools/mecha-list.js.map +1 -0
  509. package/dist/agent/tools/mecha-server.d.ts +4 -0
  510. package/dist/agent/tools/mecha-server.d.ts.map +1 -0
  511. package/dist/agent/tools/mecha-server.js +49 -0
  512. package/dist/agent/tools/mecha-server.js.map +1 -0
  513. package/dist/agent/types.d.ts +38 -0
  514. package/dist/agent/types.d.ts.map +1 -0
  515. package/dist/agent/types.js +32 -0
  516. package/dist/agent/types.js.map +1 -0
  517. package/dist/agent/webhook.d.ts +12 -0
  518. package/dist/agent/webhook.d.ts.map +1 -0
  519. package/dist/agent/webhook.js +105 -0
  520. package/dist/agent/webhook.js.map +1 -0
  521. package/dist/agent/ws-terminal.d.ts +4 -0
  522. package/dist/agent/ws-terminal.d.ts.map +1 -0
  523. package/dist/agent/ws-terminal.js +160 -0
  524. package/dist/agent/ws-terminal.js.map +1 -0
  525. package/dist/shared/atomic-write.d.ts +5 -0
  526. package/dist/shared/atomic-write.d.ts.map +1 -0
  527. package/dist/shared/atomic-write.js +63 -0
  528. package/dist/shared/atomic-write.js.map +1 -0
  529. package/dist/shared/errors.d.ts +71 -0
  530. package/dist/shared/errors.d.ts.map +1 -0
  531. package/dist/shared/errors.js +52 -0
  532. package/dist/shared/errors.js.map +1 -0
  533. package/dist/shared/logger.d.ts +7 -0
  534. package/dist/shared/logger.d.ts.map +1 -0
  535. package/dist/shared/logger.js +52 -0
  536. package/dist/shared/logger.js.map +1 -0
  537. package/dist/shared/mutex.d.ts +12 -0
  538. package/dist/shared/mutex.d.ts.map +1 -0
  539. package/dist/shared/mutex.js +73 -0
  540. package/dist/shared/mutex.js.map +1 -0
  541. package/dist/shared/safe-read.d.ts +12 -0
  542. package/dist/shared/safe-read.d.ts.map +1 -0
  543. package/dist/shared/safe-read.js +33 -0
  544. package/dist/shared/safe-read.js.map +1 -0
  545. package/dist/shared/totp.d.ts +7 -0
  546. package/dist/shared/totp.d.ts.map +1 -0
  547. package/dist/shared/totp.js +75 -0
  548. package/dist/shared/totp.js.map +1 -0
  549. package/dist/shared/validation.d.ts +7 -0
  550. package/dist/shared/validation.d.ts.map +1 -0
  551. package/dist/shared/validation.js +30 -0
  552. package/dist/shared/validation.js.map +1 -0
  553. package/dist/src/auth.d.ts +48 -0
  554. package/dist/src/auth.d.ts.map +1 -0
  555. package/dist/src/auth.js +160 -0
  556. package/dist/src/auth.js.map +1 -0
  557. package/dist/src/cli-output.d.ts +14 -0
  558. package/dist/src/cli-output.d.ts.map +1 -0
  559. package/dist/src/cli-output.js +47 -0
  560. package/dist/src/cli-output.js.map +1 -0
  561. package/dist/src/cli-utils.d.ts +15 -0
  562. package/dist/src/cli-utils.d.ts.map +1 -0
  563. package/dist/src/cli-utils.js +241 -0
  564. package/dist/src/cli-utils.js.map +1 -0
  565. package/dist/src/cli.d.ts +3 -0
  566. package/dist/src/cli.d.ts.map +1 -0
  567. package/dist/src/cli.js +535 -0
  568. package/dist/src/cli.js.map +1 -0
  569. package/dist/src/cli.utils.d.ts +10 -0
  570. package/dist/src/cli.utils.d.ts.map +1 -0
  571. package/dist/src/cli.utils.js +127 -0
  572. package/dist/src/cli.utils.js.map +1 -0
  573. package/dist/src/commands/auth.d.ts +3 -0
  574. package/dist/src/commands/auth.d.ts.map +1 -0
  575. package/dist/src/commands/auth.js +139 -0
  576. package/dist/src/commands/auth.js.map +1 -0
  577. package/dist/src/commands/bot-api.d.ts +15 -0
  578. package/dist/src/commands/bot-api.d.ts.map +1 -0
  579. package/dist/src/commands/bot-api.js +40 -0
  580. package/dist/src/commands/bot-api.js.map +1 -0
  581. package/dist/src/commands/completion.d.ts +3 -0
  582. package/dist/src/commands/completion.d.ts.map +1 -0
  583. package/dist/src/commands/completion.js +108 -0
  584. package/dist/src/commands/completion.js.map +1 -0
  585. package/dist/src/commands/config.d.ts +3 -0
  586. package/dist/src/commands/config.d.ts.map +1 -0
  587. package/dist/src/commands/config.js +110 -0
  588. package/dist/src/commands/config.js.map +1 -0
  589. package/dist/src/commands/costs.d.ts +3 -0
  590. package/dist/src/commands/costs.d.ts.map +1 -0
  591. package/dist/src/commands/costs.js +88 -0
  592. package/dist/src/commands/costs.js.map +1 -0
  593. package/dist/src/commands/daemon.d.ts +3 -0
  594. package/dist/src/commands/daemon.d.ts.map +1 -0
  595. package/dist/src/commands/daemon.js +86 -0
  596. package/dist/src/commands/daemon.js.map +1 -0
  597. package/dist/src/commands/push-dashboard.d.ts +3 -0
  598. package/dist/src/commands/push-dashboard.d.ts.map +1 -0
  599. package/dist/src/commands/push-dashboard.js +48 -0
  600. package/dist/src/commands/push-dashboard.js.map +1 -0
  601. package/dist/src/commands/schedule.d.ts +3 -0
  602. package/dist/src/commands/schedule.d.ts.map +1 -0
  603. package/dist/src/commands/schedule.js +70 -0
  604. package/dist/src/commands/schedule.js.map +1 -0
  605. package/dist/src/commands/sessions.d.ts +3 -0
  606. package/dist/src/commands/sessions.d.ts.map +1 -0
  607. package/dist/src/commands/sessions.js +62 -0
  608. package/dist/src/commands/sessions.js.map +1 -0
  609. package/dist/src/commands/webhooks.d.ts +3 -0
  610. package/dist/src/commands/webhooks.d.ts.map +1 -0
  611. package/dist/src/commands/webhooks.js +44 -0
  612. package/dist/src/commands/webhooks.js.map +1 -0
  613. package/dist/src/config.d.ts +9 -0
  614. package/dist/src/config.d.ts.map +1 -0
  615. package/dist/src/config.js +56 -0
  616. package/dist/src/config.js.map +1 -0
  617. package/dist/src/daemon-audit.d.ts +13 -0
  618. package/dist/src/daemon-audit.d.ts.map +1 -0
  619. package/dist/src/daemon-audit.js +33 -0
  620. package/dist/src/daemon-audit.js.map +1 -0
  621. package/dist/src/daemon.d.ts +25 -0
  622. package/dist/src/daemon.d.ts.map +1 -0
  623. package/dist/src/daemon.js +344 -0
  624. package/dist/src/daemon.js.map +1 -0
  625. package/dist/src/dashboard-server-schema.d.ts +23 -0
  626. package/dist/src/dashboard-server-schema.d.ts.map +1 -0
  627. package/dist/src/dashboard-server-schema.js +45 -0
  628. package/dist/src/dashboard-server-schema.js.map +1 -0
  629. package/dist/src/dashboard-server-utils.d.ts +18 -0
  630. package/dist/src/dashboard-server-utils.d.ts.map +1 -0
  631. package/dist/src/dashboard-server-utils.js +107 -0
  632. package/dist/src/dashboard-server-utils.js.map +1 -0
  633. package/dist/src/dashboard-server.d.ts +2 -0
  634. package/dist/src/dashboard-server.d.ts.map +1 -0
  635. package/dist/src/dashboard-server.js +777 -0
  636. package/dist/src/dashboard-server.js.map +1 -0
  637. package/dist/src/docker.constants.d.ts +5 -0
  638. package/dist/src/docker.constants.d.ts.map +1 -0
  639. package/dist/src/docker.constants.js +7 -0
  640. package/dist/src/docker.constants.js.map +1 -0
  641. package/dist/src/docker.d.ts +16 -0
  642. package/dist/src/docker.d.ts.map +1 -0
  643. package/dist/src/docker.js +437 -0
  644. package/dist/src/docker.js.map +1 -0
  645. package/dist/src/docker.types.d.ts +13 -0
  646. package/dist/src/docker.types.d.ts.map +1 -0
  647. package/dist/src/docker.types.js +2 -0
  648. package/dist/src/docker.types.js.map +1 -0
  649. package/dist/src/docker.utils.d.ts +24 -0
  650. package/dist/src/docker.utils.d.ts.map +1 -0
  651. package/dist/src/docker.utils.js +239 -0
  652. package/dist/src/docker.utils.js.map +1 -0
  653. package/dist/src/doctor.d.ts +3 -0
  654. package/dist/src/doctor.d.ts.map +1 -0
  655. package/dist/src/doctor.js +80 -0
  656. package/dist/src/doctor.js.map +1 -0
  657. package/dist/src/doctor.utils.d.ts +30 -0
  658. package/dist/src/doctor.utils.d.ts.map +1 -0
  659. package/dist/src/doctor.utils.js +192 -0
  660. package/dist/src/doctor.utils.js.map +1 -0
  661. package/dist/src/mcp-proxy.d.ts +2 -0
  662. package/dist/src/mcp-proxy.d.ts.map +1 -0
  663. package/dist/src/mcp-proxy.js +177 -0
  664. package/dist/src/mcp-proxy.js.map +1 -0
  665. package/dist/src/resolve-endpoint.d.ts +13 -0
  666. package/dist/src/resolve-endpoint.d.ts.map +1 -0
  667. package/dist/src/resolve-endpoint.js +112 -0
  668. package/dist/src/resolve-endpoint.js.map +1 -0
  669. package/dist/src/store.d.ts +41 -0
  670. package/dist/src/store.d.ts.map +1 -0
  671. package/dist/src/store.js +263 -0
  672. package/dist/src/store.js.map +1 -0
  673. package/package.json +84 -0
  674. package/s6/mecha-agent/dependencies.d/tailscale-up +0 -0
  675. package/s6/mecha-agent/finish +4 -0
  676. package/s6/mecha-agent/run +39 -0
  677. package/s6/mecha-agent/type +1 -0
  678. package/s6/tailscale-up/dependencies.d/tailscaled +0 -0
  679. package/s6/tailscale-up/type +1 -0
  680. package/s6/tailscale-up/up +39 -0
  681. package/s6/tailscaled/run +14 -0
  682. package/s6/tailscaled/type +1 -0
  683. package/shared/atomic-write.ts +58 -0
  684. package/shared/errors.ts +137 -0
  685. package/shared/logger.ts +50 -0
  686. package/shared/mutex.ts +73 -0
  687. package/shared/safe-read.ts +52 -0
  688. package/shared/totp.ts +83 -0
  689. package/shared/validation.ts +29 -0
  690. package/tsconfig.agent.json +10 -0
  691. package/tsconfig.json +22 -0
@@ -0,0 +1,193 @@
1
+ var jb=Object.defineProperty;var Ob=(a,s,o)=>s in a?jb(a,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[s]=o;var ce=(a,s,o)=>Ob(a,typeof s!="symbol"?s+"":s,o);(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))i(c);new MutationObserver(c=>{for(const f of c)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function o(c){const f={};return c.integrity&&(f.integrity=c.integrity),c.referrerPolicy&&(f.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?f.credentials="include":c.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function i(c){if(c.ep)return;c.ep=!0;const f=o(c);fetch(c.href,f)}})();function _g(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var vc={exports:{}},ei={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ap;function Db(){if(ap)return ei;ap=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function o(i,c,f){var d=null;if(f!==void 0&&(d=""+f),c.key!==void 0&&(d=""+c.key),"key"in c){f={};for(var m in c)m!=="key"&&(f[m]=c[m])}else f=c;return c=f.ref,{$$typeof:a,type:i,key:d,ref:c!==void 0?c:null,props:f}}return ei.Fragment=s,ei.jsx=o,ei.jsxs=o,ei}var sp;function Mb(){return sp||(sp=1,vc.exports=Db()),vc.exports}var h=Mb(),Tc={exports:{}},ke={};/**
10
+ * @license React
11
+ * react.production.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var ip;function Lb(){if(ip)return ke;ip=1;var a=Symbol.for("react.transitional.element"),s=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),d=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),x=Symbol.iterator;function T(_){return _===null||typeof _!="object"?null:(_=x&&_[x]||_["@@iterator"],typeof _=="function"?_:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,L={};function H(_,q,$){this.props=_,this.context=q,this.refs=L,this.updater=$||w}H.prototype.isReactComponent={},H.prototype.setState=function(_,q){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,q,"setState")},H.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function Z(){}Z.prototype=H.prototype;function O(_,q,$){this.props=_,this.context=q,this.refs=L,this.updater=$||w}var C=O.prototype=new Z;C.constructor=O,A(C,H.prototype),C.isPureReactComponent=!0;var D=Array.isArray;function j(){}var Q={H:null,A:null,T:null,S:null},fe=Object.prototype.hasOwnProperty;function we(_,q,$){var Y=$.ref;return{$$typeof:a,type:_,key:q,ref:Y!==void 0?Y:null,props:$}}function ie(_,q){return we(_.type,q,_.props)}function ue(_){return typeof _=="object"&&_!==null&&_.$$typeof===a}function ge(_){var q={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function($){return q[$]})}var Ee=/\/+/g;function se(_,q){return typeof _=="object"&&_!==null&&_.key!=null?ge(""+_.key):q.toString(36)}function me(_){switch(_.status){case"fulfilled":return _.value;case"rejected":throw _.reason;default:switch(typeof _.status=="string"?_.then(j,j):(_.status="pending",_.then(function(q){_.status==="pending"&&(_.status="fulfilled",_.value=q)},function(q){_.status==="pending"&&(_.status="rejected",_.reason=q)})),_.status){case"fulfilled":return _.value;case"rejected":throw _.reason}}throw _}function G(_,q,$,Y,P){var M=typeof _;(M==="undefined"||M==="boolean")&&(_=null);var I=!1;if(_===null)I=!0;else switch(M){case"bigint":case"string":case"number":I=!0;break;case"object":switch(_.$$typeof){case a:case s:I=!0;break;case y:return I=_._init,G(I(_._payload),q,$,Y,P)}}if(I)return P=P(_),I=Y===""?"."+se(_,0):Y,D(P)?($="",I!=null&&($=I.replace(Ee,"$&/")+"/"),G(P,q,$,"",function(ee){return ee})):P!=null&&(ue(P)&&(P=ie(P,$+(P.key==null||_&&_.key===P.key?"":(""+P.key).replace(Ee,"$&/")+"/")+I)),q.push(P)),1;I=0;var ne=Y===""?".":Y+":";if(D(_))for(var K=0;K<_.length;K++)Y=_[K],M=ne+se(Y,K),I+=G(Y,q,$,M,P);else if(K=T(_),typeof K=="function")for(_=K.call(_),K=0;!(Y=_.next()).done;)Y=Y.value,M=ne+se(Y,K++),I+=G(Y,q,$,M,P);else if(M==="object"){if(typeof _.then=="function")return G(me(_),q,$,Y,P);throw q=String(_),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return I}function le(_,q,$){if(_==null)return _;var Y=[],P=0;return G(_,Y,"","",function(M){return q.call($,M,P++)}),Y}function he(_){if(_._status===-1){var q=_._result;q=q(),q.then(function($){(_._status===0||_._status===-1)&&(_._status=1,_._result=$)},function($){(_._status===0||_._status===-1)&&(_._status=2,_._result=$)}),_._status===-1&&(_._status=0,_._result=q)}if(_._status===1)return _._result.default;throw _._result}var re=typeof reportError=="function"?reportError:function(_){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof _=="object"&&_!==null&&typeof _.message=="string"?String(_.message):String(_),error:_});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",_);return}console.error(_)},W={map:le,forEach:function(_,q,$){le(_,function(){q.apply(this,arguments)},$)},count:function(_){var q=0;return le(_,function(){q++}),q},toArray:function(_){return le(_,function(q){return q})||[]},only:function(_){if(!ue(_))throw Error("React.Children.only expected to receive a single React element child.");return _}};return ke.Activity=v,ke.Children=W,ke.Component=H,ke.Fragment=o,ke.Profiler=c,ke.PureComponent=O,ke.StrictMode=i,ke.Suspense=b,ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Q,ke.__COMPILER_RUNTIME={__proto__:null,c:function(_){return Q.H.useMemoCache(_)}},ke.cache=function(_){return function(){return _.apply(null,arguments)}},ke.cacheSignal=function(){return null},ke.cloneElement=function(_,q,$){if(_==null)throw Error("The argument must be a React element, but you passed "+_+".");var Y=A({},_.props),P=_.key;if(q!=null)for(M in q.key!==void 0&&(P=""+q.key),q)!fe.call(q,M)||M==="key"||M==="__self"||M==="__source"||M==="ref"&&q.ref===void 0||(Y[M]=q[M]);var M=arguments.length-2;if(M===1)Y.children=$;else if(1<M){for(var I=Array(M),ne=0;ne<M;ne++)I[ne]=arguments[ne+2];Y.children=I}return we(_.type,P,Y)},ke.createContext=function(_){return _={$$typeof:d,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null},_.Provider=_,_.Consumer={$$typeof:f,_context:_},_},ke.createElement=function(_,q,$){var Y,P={},M=null;if(q!=null)for(Y in q.key!==void 0&&(M=""+q.key),q)fe.call(q,Y)&&Y!=="key"&&Y!=="__self"&&Y!=="__source"&&(P[Y]=q[Y]);var I=arguments.length-2;if(I===1)P.children=$;else if(1<I){for(var ne=Array(I),K=0;K<I;K++)ne[K]=arguments[K+2];P.children=ne}if(_&&_.defaultProps)for(Y in I=_.defaultProps,I)P[Y]===void 0&&(P[Y]=I[Y]);return we(_,M,P)},ke.createRef=function(){return{current:null}},ke.forwardRef=function(_){return{$$typeof:m,render:_}},ke.isValidElement=ue,ke.lazy=function(_){return{$$typeof:y,_payload:{_status:-1,_result:_},_init:he}},ke.memo=function(_,q){return{$$typeof:p,type:_,compare:q===void 0?null:q}},ke.startTransition=function(_){var q=Q.T,$={};Q.T=$;try{var Y=_(),P=Q.S;P!==null&&P($,Y),typeof Y=="object"&&Y!==null&&typeof Y.then=="function"&&Y.then(j,re)}catch(M){re(M)}finally{q!==null&&$.types!==null&&(q.types=$.types),Q.T=q}},ke.unstable_useCacheRefresh=function(){return Q.H.useCacheRefresh()},ke.use=function(_){return Q.H.use(_)},ke.useActionState=function(_,q,$){return Q.H.useActionState(_,q,$)},ke.useCallback=function(_,q){return Q.H.useCallback(_,q)},ke.useContext=function(_){return Q.H.useContext(_)},ke.useDebugValue=function(){},ke.useDeferredValue=function(_,q){return Q.H.useDeferredValue(_,q)},ke.useEffect=function(_,q){return Q.H.useEffect(_,q)},ke.useEffectEvent=function(_){return Q.H.useEffectEvent(_)},ke.useId=function(){return Q.H.useId()},ke.useImperativeHandle=function(_,q,$){return Q.H.useImperativeHandle(_,q,$)},ke.useInsertionEffect=function(_,q){return Q.H.useInsertionEffect(_,q)},ke.useLayoutEffect=function(_,q){return Q.H.useLayoutEffect(_,q)},ke.useMemo=function(_,q){return Q.H.useMemo(_,q)},ke.useOptimistic=function(_,q){return Q.H.useOptimistic(_,q)},ke.useReducer=function(_,q,$){return Q.H.useReducer(_,q,$)},ke.useRef=function(_){return Q.H.useRef(_)},ke.useState=function(_){return Q.H.useState(_)},ke.useSyncExternalStore=function(_,q,$){return Q.H.useSyncExternalStore(_,q,$)},ke.useTransition=function(){return Q.H.useTransition()},ke.version="19.2.4",ke}var rp;function tf(){return rp||(rp=1,Tc.exports=Lb()),Tc.exports}var E=tf();const zb=_g(E);var Sc={exports:{}},ti={},Ec={exports:{}},wc={};/**
18
+ * @license React
19
+ * scheduler.production.js
20
+ *
21
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */var op;function Ub(){return op||(op=1,(function(a){function s(G,le){var he=G.length;G.push(le);e:for(;0<he;){var re=he-1>>>1,W=G[re];if(0<c(W,le))G[re]=le,G[he]=W,he=re;else break e}}function o(G){return G.length===0?null:G[0]}function i(G){if(G.length===0)return null;var le=G[0],he=G.pop();if(he!==le){G[0]=he;e:for(var re=0,W=G.length,_=W>>>1;re<_;){var q=2*(re+1)-1,$=G[q],Y=q+1,P=G[Y];if(0>c($,he))Y<W&&0>c(P,$)?(G[re]=P,G[Y]=he,re=Y):(G[re]=$,G[q]=he,re=q);else if(Y<W&&0>c(P,he))G[re]=P,G[Y]=he,re=Y;else break e}}return le}function c(G,le){var he=G.sortIndex-le.sortIndex;return he!==0?he:G.id-le.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var d=Date,m=d.now();a.unstable_now=function(){return d.now()-m}}var b=[],p=[],y=1,v=null,x=3,T=!1,w=!1,A=!1,L=!1,H=typeof setTimeout=="function"?setTimeout:null,Z=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function C(G){for(var le=o(p);le!==null;){if(le.callback===null)i(p);else if(le.startTime<=G)i(p),le.sortIndex=le.expirationTime,s(b,le);else break;le=o(p)}}function D(G){if(A=!1,C(G),!w)if(o(b)!==null)w=!0,j||(j=!0,ge());else{var le=o(p);le!==null&&me(D,le.startTime-G)}}var j=!1,Q=-1,fe=5,we=-1;function ie(){return L?!0:!(a.unstable_now()-we<fe)}function ue(){if(L=!1,j){var G=a.unstable_now();we=G;var le=!0;try{e:{w=!1,A&&(A=!1,Z(Q),Q=-1),T=!0;var he=x;try{t:{for(C(G),v=o(b);v!==null&&!(v.expirationTime>G&&ie());){var re=v.callback;if(typeof re=="function"){v.callback=null,x=v.priorityLevel;var W=re(v.expirationTime<=G);if(G=a.unstable_now(),typeof W=="function"){v.callback=W,C(G),le=!0;break t}v===o(b)&&i(b),C(G)}else i(b);v=o(b)}if(v!==null)le=!0;else{var _=o(p);_!==null&&me(D,_.startTime-G),le=!1}}break e}finally{v=null,x=he,T=!1}le=void 0}}finally{le?ge():j=!1}}}var ge;if(typeof O=="function")ge=function(){O(ue)};else if(typeof MessageChannel<"u"){var Ee=new MessageChannel,se=Ee.port2;Ee.port1.onmessage=ue,ge=function(){se.postMessage(null)}}else ge=function(){H(ue,0)};function me(G,le){Q=H(function(){G(a.unstable_now())},le)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(G){G.callback=null},a.unstable_forceFrameRate=function(G){0>G||125<G?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):fe=0<G?Math.floor(1e3/G):5},a.unstable_getCurrentPriorityLevel=function(){return x},a.unstable_next=function(G){switch(x){case 1:case 2:case 3:var le=3;break;default:le=x}var he=x;x=le;try{return G()}finally{x=he}},a.unstable_requestPaint=function(){L=!0},a.unstable_runWithPriority=function(G,le){switch(G){case 1:case 2:case 3:case 4:case 5:break;default:G=3}var he=x;x=G;try{return le()}finally{x=he}},a.unstable_scheduleCallback=function(G,le,he){var re=a.unstable_now();switch(typeof he=="object"&&he!==null?(he=he.delay,he=typeof he=="number"&&0<he?re+he:re):he=re,G){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=he+W,G={id:y++,callback:le,priorityLevel:G,startTime:he,expirationTime:W,sortIndex:-1},he>re?(G.sortIndex=he,s(p,G),o(b)===null&&G===o(p)&&(A?(Z(Q),Q=-1):A=!0,me(D,he-re))):(G.sortIndex=W,s(b,G),w||T||(w=!0,j||(j=!0,ge()))),G},a.unstable_shouldYield=ie,a.unstable_wrapCallback=function(G){var le=x;return function(){var he=x;x=le;try{return G.apply(this,arguments)}finally{x=he}}}})(wc)),wc}var up;function Bb(){return up||(up=1,Ec.exports=Ub()),Ec.exports}var Ac={exports:{}},Ut={};/**
26
+ * @license React
27
+ * react-dom.production.js
28
+ *
29
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */var cp;function Hb(){if(cp)return Ut;cp=1;var a=tf();function s(b){var p="https://react.dev/errors/"+b;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+b+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(){}var i={d:{f:o,r:function(){throw Error(s(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(b,p,y){var v=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:v==null?null:""+v,children:b,containerInfo:p,implementation:y}}var d=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(b,p){if(b==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ut.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ut.createPortal=function(b,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(s(299));return f(b,p,null,y)},Ut.flushSync=function(b){var p=d.T,y=i.p;try{if(d.T=null,i.p=2,b)return b()}finally{d.T=p,i.p=y,i.d.f()}},Ut.preconnect=function(b,p){typeof b=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,i.d.C(b,p))},Ut.prefetchDNS=function(b){typeof b=="string"&&i.d.D(b)},Ut.preinit=function(b,p){if(typeof b=="string"&&p&&typeof p.as=="string"){var y=p.as,v=m(y,p.crossOrigin),x=typeof p.integrity=="string"?p.integrity:void 0,T=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?i.d.S(b,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:v,integrity:x,fetchPriority:T}):y==="script"&&i.d.X(b,{crossOrigin:v,integrity:x,fetchPriority:T,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ut.preinitModule=function(b,p){if(typeof b=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=m(p.as,p.crossOrigin);i.d.M(b,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&i.d.M(b)},Ut.preload=function(b,p){if(typeof b=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,v=m(y,p.crossOrigin);i.d.L(b,y,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ut.preloadModule=function(b,p){if(typeof b=="string")if(p){var y=m(p.as,p.crossOrigin);i.d.m(b,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else i.d.m(b)},Ut.requestFormReset=function(b){i.d.r(b)},Ut.unstable_batchedUpdates=function(b,p){return b(p)},Ut.useFormState=function(b,p,y){return d.H.useFormState(b,p,y)},Ut.useFormStatus=function(){return d.H.useHostTransitionStatus()},Ut.version="19.2.4",Ut}var fp;function Ib(){if(fp)return Ac.exports;fp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(s){console.error(s)}}return a(),Ac.exports=Hb(),Ac.exports}/**
34
+ * @license React
35
+ * react-dom-client.production.js
36
+ *
37
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
38
+ *
39
+ * This source code is licensed under the MIT license found in the
40
+ * LICENSE file in the root directory of this source tree.
41
+ */var dp;function Fb(){if(dp)return ti;dp=1;var a=Bb(),s=tf(),o=Ib();function i(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function d(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function m(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function b(e){if(f(e)!==e)throw Error(i(188))}function p(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(i(188));return t!==e?null:e}for(var n=e,l=t;;){var r=n.return;if(r===null)break;var u=r.alternate;if(u===null){if(l=r.return,l!==null){n=l;continue}break}if(r.child===u.child){for(u=r.child;u;){if(u===n)return b(r),e;if(u===l)return b(r),t;u=u.sibling}throw Error(i(188))}if(n.return!==l.return)n=r,l=u;else{for(var g=!1,S=r.child;S;){if(S===n){g=!0,n=r,l=u;break}if(S===l){g=!0,l=r,n=u;break}S=S.sibling}if(!g){for(S=u.child;S;){if(S===n){g=!0,n=u,l=r;break}if(S===l){g=!0,l=u,n=r;break}S=S.sibling}if(!g)throw Error(i(189))}}if(n.alternate!==l)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function y(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=y(e),t!==null)return t;e=e.sibling}return null}var v=Object.assign,x=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),H=Symbol.for("react.profiler"),Z=Symbol.for("react.consumer"),O=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),D=Symbol.for("react.suspense"),j=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),fe=Symbol.for("react.lazy"),we=Symbol.for("react.activity"),ie=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function ge(e){return e===null||typeof e!="object"?null:(e=ue&&e[ue]||e["@@iterator"],typeof e=="function"?e:null)}var Ee=Symbol.for("react.client.reference");function se(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ee?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case A:return"Fragment";case H:return"Profiler";case L:return"StrictMode";case D:return"Suspense";case j:return"SuspenseList";case we:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case w:return"Portal";case O:return e.displayName||"Context";case Z:return(e._context.displayName||"Context")+".Consumer";case C:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Q:return t=e.displayName||null,t!==null?t:se(e.type)||"Memo";case fe:t=e._payload,e=e._init;try{return se(e(t))}catch{}}return null}var me=Array.isArray,G=s.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,le=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},re=[],W=-1;function _(e){return{current:e}}function q(e){0>W||(e.current=re[W],re[W]=null,W--)}function $(e,t){W++,re[W]=e.current,e.current=t}var Y=_(null),P=_(null),M=_(null),I=_(null);function ne(e,t){switch($(M,t),$(P,e),$(Y,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Rm(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Rm(t),e=Cm(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}q(Y),$(Y,e)}function K(){q(Y),q(P),q(M)}function ee(e){e.memoizedState!==null&&$(I,e);var t=Y.current,n=Cm(t,e.type);t!==n&&($(P,e),$(Y,n))}function ve(e){P.current===e&&(q(Y),q(P)),I.current===e&&(q(I),Ws._currentValue=he)}var _e,Pe;function Ne(e){if(_e===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);_e=t&&t[1]||"",Pe=-1<n.stack.indexOf(`
42
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
43
+ `+_e+e+Pe}var Me=!1;function lt(e,t){if(!e||Me)return"";Me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(X){var F=X}Reflect.construct(e,[],te)}else{try{te.call()}catch(X){F=X}e.call(te.prototype)}}else{try{throw Error()}catch(X){F=X}(te=e())&&typeof te.catch=="function"&&te.catch(function(){})}}catch(X){if(X&&F&&typeof X.stack=="string")return[X.stack,F.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var r=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");r&&r.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),g=u[0],S=u[1];if(g&&S){var R=g.split(`
44
+ `),B=S.split(`
45
+ `);for(r=l=0;l<R.length&&!R[l].includes("DetermineComponentFrameRoot");)l++;for(;r<B.length&&!B[r].includes("DetermineComponentFrameRoot");)r++;if(l===R.length||r===B.length)for(l=R.length-1,r=B.length-1;1<=l&&0<=r&&R[l]!==B[r];)r--;for(;1<=l&&0<=r;l--,r--)if(R[l]!==B[r]){if(l!==1||r!==1)do if(l--,r--,0>r||R[l]!==B[r]){var V=`
46
+ `+R[l].replace(" at new "," at ");return e.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",e.displayName)),V}while(1<=l&&0<=r);break}}}finally{Me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?Ne(n):""}function Le(e,t){switch(e.tag){case 26:case 27:case 5:return Ne(e.type);case 16:return Ne("Lazy");case 13:return e.child!==t&&t!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return lt(e.type,!1);case 11:return lt(e.type.render,!1);case 1:return lt(e.type,!0);case 31:return Ne("Activity");default:return""}}function Ce(e){try{var t="",n=null;do t+=Le(e,n),n=e,e=e.return;while(e);return t}catch(l){return`
47
+ Error generating stack: `+l.message+`
48
+ `+l.stack}}var je=Object.prototype.hasOwnProperty,_t=a.unstable_scheduleCallback,cn=a.unstable_cancelCallback,xi=a.unstable_shouldYield,co=a.unstable_requestPaint,jt=a.unstable_now,Fl=a.unstable_getCurrentPriorityLevel,qn=a.unstable_ImmediatePriority,Jt=a.unstable_UserBlockingPriority,pl=a.unstable_NormalPriority,vi=a.unstable_LowPriority,ts=a.unstable_IdlePriority,ns=a.log,Ti=a.unstable_setDisableYieldValue,Dn=null,Rt=null;function Ct(e){if(typeof ns=="function"&&Ti(e),Rt&&typeof Rt.setStrictMode=="function")try{Rt.setStrictMode(Dn,e)}catch{}}var bt=Math.clz32?Math.clz32:fo,ls=Math.log,as=Math.LN2;function fo(e){return e>>>=0,e===0?32:31-(ls(e)/as|0)|0}var Xn=256,$n=262144,ca=4194304;function Pt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function fa(e,t,n){var l=e.pendingLanes;if(l===0)return 0;var r=0,u=e.suspendedLanes,g=e.pingedLanes;e=e.warmLanes;var S=l&134217727;return S!==0?(l=S&~u,l!==0?r=Pt(l):(g&=S,g!==0?r=Pt(g):n||(n=S&~e,n!==0&&(r=Pt(n))))):(S=l&~u,S!==0?r=Pt(S):g!==0?r=Pt(g):n||(n=l&~e,n!==0&&(r=Pt(n)))),r===0?0:t!==0&&t!==r&&(t&u)===0&&(u=r&-r,n=t&-t,u>=n||u===32&&(n&4194048)!==0)?t:r}function Gl(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function mt(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zn(){var e=ca;return ca<<=1,(ca&62914560)===0&&(ca=4194304),e}function ss(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function gl(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function is(e,t,n,l,r,u){var g=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var S=e.entanglements,R=e.expirationTimes,B=e.hiddenUpdates;for(n=g&~n;0<n;){var V=31-bt(n),te=1<<V;S[V]=0,R[V]=-1;var F=B[V];if(F!==null)for(B[V]=null,V=0;V<F.length;V++){var X=F[V];X!==null&&(X.lane&=-536870913)}n&=~te}l!==0&&rs(e,l,0),u!==0&&r===0&&e.tag!==0&&(e.suspendedLanes|=u&~(g&~t))}function rs(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-bt(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|n&261930}function os(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-bt(n),r=1<<l;r&t|e[l]&t&&(e[l]|=t),n&=~r}}function Si(e,t){var n=t&-t;return n=(n&42)!==0?1:Yt(n),(n&(e.suspendedLanes|t))!==0?0:n}function Yt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function An(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function us(){var e=le.p;return e!==0?e:(e=window.event,e===void 0?32:Km(e.type))}function cs(e,t){var n=le.p;try{return le.p=e,t()}finally{le.p=n}}var fn=Math.random().toString(36).slice(2),xt="__reactFiber$"+fn,ot="__reactProps$"+fn,Vn="__reactContainer$"+fn,da="__reactEvents$"+fn,Ei="__reactListeners$"+fn,wi="__reactHandles$"+fn,Ai="__reactResources$"+fn,ye="__reactMarker$"+fn;function k(e){delete e[xt],delete e[ot],delete e[da],delete e[Ei],delete e[wi]}function ae(e){var t=e[xt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Vn]||n[xt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Lm(e);e!==null;){if(n=e[xt])return n;e=Lm(e)}return t}e=n,n=e.parentNode}return null}function de(e){if(e=e[xt]||e[Vn]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Qe(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ft(e){var t=e[Ai];return t||(t=e[Ai]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ze(e){e[ye]=!0}var Ot=new Set,dn={};function qt(e,t){Mn(e,t),Mn(e+"Capture",t)}function Mn(e,t){for(dn[e]=t,e=0;e<t.length;e++)Ot.add(t[e])}var wt=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),fs={},ds={};function E0(e){return je.call(ds,e)?!0:je.call(fs,e)?!1:wt.test(e)?ds[e]=!0:(fs[e]=!0,!1)}function _i(e,t,n){if(E0(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+n)}}function Ri(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+n)}}function Qn(e,t,n,l){if(l===null)e.removeAttribute(n);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(n);return}e.setAttributeNS(t,n,""+l)}}function hn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function xf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function w0(e,t,n){var l=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var r=l.get,u=l.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return r.call(this)},set:function(g){n=""+g,u.call(this,g)}}),Object.defineProperty(e,t,{enumerable:l.enumerable}),{getValue:function(){return n},setValue:function(g){n=""+g},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ho(e){if(!e._valueTracker){var t=xf(e)?"checked":"value";e._valueTracker=w0(e,t,""+e[t])}}function vf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=xf(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Ci(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var A0=/[\n"\\]/g;function mn(e){return e.replace(A0,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function mo(e,t,n,l,r,u,g,S){e.name="",g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"?e.type=g:e.removeAttribute("type"),t!=null?g==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+hn(t)):e.value!==""+hn(t)&&(e.value=""+hn(t)):g!=="submit"&&g!=="reset"||e.removeAttribute("value"),t!=null?po(e,g,hn(t)):n!=null?po(e,g,hn(n)):l!=null&&e.removeAttribute("value"),r==null&&u!=null&&(e.defaultChecked=!!u),r!=null&&(e.checked=r&&typeof r!="function"&&typeof r!="symbol"),S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?e.name=""+hn(S):e.removeAttribute("name")}function Tf(e,t,n,l,r,u,g,S){if(u!=null&&typeof u!="function"&&typeof u!="symbol"&&typeof u!="boolean"&&(e.type=u),t!=null||n!=null){if(!(u!=="submit"&&u!=="reset"||t!=null)){ho(e);return}n=n!=null?""+hn(n):"",t=t!=null?""+hn(t):n,S||t===e.value||(e.value=t),e.defaultValue=t}l=l??r,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=S?e.checked:!!l,e.defaultChecked=!!l,g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.name=g),ho(e)}function po(e,t,n){t==="number"&&Ci(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function ha(e,t,n,l){if(e=e.options,t){t={};for(var r=0;r<n.length;r++)t["$"+n[r]]=!0;for(n=0;n<e.length;n++)r=t.hasOwnProperty("$"+e[n].value),e[n].selected!==r&&(e[n].selected=r),r&&l&&(e[n].defaultSelected=!0)}else{for(n=""+hn(n),t=null,r=0;r<e.length;r++){if(e[r].value===n){e[r].selected=!0,l&&(e[r].defaultSelected=!0);return}t!==null||e[r].disabled||(t=e[r])}t!==null&&(t.selected=!0)}}function Sf(e,t,n){if(t!=null&&(t=""+hn(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n!=null?""+hn(n):""}function Ef(e,t,n,l){if(t==null){if(l!=null){if(n!=null)throw Error(i(92));if(me(l)){if(1<l.length)throw Error(i(93));l=l[0]}n=l}n==null&&(n=""),t=n}n=hn(t),e.defaultValue=n,l=e.textContent,l===n&&l!==""&&l!==null&&(e.value=l),ho(e)}function ma(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var _0=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function wf(e,t,n){var l=t.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,n):typeof n!="number"||n===0||_0.has(t)?t==="float"?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function Af(e,t,n){if(t!=null&&typeof t!="object")throw Error(i(62));if(e=e.style,n!=null){for(var l in n)!n.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var r in t)l=t[r],t.hasOwnProperty(r)&&n[r]!==l&&wf(e,r,l)}else for(var u in t)t.hasOwnProperty(u)&&wf(e,u,t[u])}function go(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var R0=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),C0=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ki(e){return C0.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function Wn(){}var yo=null;function bo(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var pa=null,ga=null;function _f(e){var t=de(e);if(t&&(e=t.stateNode)){var n=e[ot]||null;e:switch(e=t.stateNode,t.type){case"input":if(mo(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+mn(""+t)+'"][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var r=l[ot]||null;if(!r)throw Error(i(90));mo(l,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name)}}for(t=0;t<n.length;t++)l=n[t],l.form===e.form&&vf(l)}break e;case"textarea":Sf(e,n.value,n.defaultValue);break e;case"select":t=n.value,t!=null&&ha(e,!!n.multiple,t,!1)}}}var xo=!1;function Rf(e,t,n){if(xo)return e(t,n);xo=!0;try{var l=e(t);return l}finally{if(xo=!1,(pa!==null||ga!==null)&&(gr(),pa&&(t=pa,e=ga,ga=pa=null,_f(t),e)))for(t=0;t<e.length;t++)_f(e[t])}}function hs(e,t){var n=e.stateNode;if(n===null)return null;var l=n[ot]||null;if(l===null)return null;n=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(i(231,t,typeof n));return n}var Kn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),vo=!1;if(Kn)try{var ms={};Object.defineProperty(ms,"passive",{get:function(){vo=!0}}),window.addEventListener("test",ms,ms),window.removeEventListener("test",ms,ms)}catch{vo=!1}var yl=null,To=null,Ni=null;function Cf(){if(Ni)return Ni;var e,t=To,n=t.length,l,r="value"in yl?yl.value:yl.textContent,u=r.length;for(e=0;e<n&&t[e]===r[e];e++);var g=n-e;for(l=1;l<=g&&t[n-l]===r[u-l];l++);return Ni=r.slice(e,1<l?1-l:void 0)}function ji(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Oi(){return!0}function kf(){return!1}function Xt(e){function t(n,l,r,u,g){this._reactName=n,this._targetInst=r,this.type=l,this.nativeEvent=u,this.target=g,this.currentTarget=null;for(var S in e)e.hasOwnProperty(S)&&(n=e[S],this[S]=n?n(u):u[S]);return this.isDefaultPrevented=(u.defaultPrevented!=null?u.defaultPrevented:u.returnValue===!1)?Oi:kf,this.isPropagationStopped=kf,this}return v(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Oi)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Oi)},persist:function(){},isPersistent:Oi}),t}var Yl={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Di=Xt(Yl),ps=v({},Yl,{view:0,detail:0}),k0=Xt(ps),So,Eo,gs,Mi=v({},ps,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ao,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==gs&&(gs&&e.type==="mousemove"?(So=e.screenX-gs.screenX,Eo=e.screenY-gs.screenY):Eo=So=0,gs=e),So)},movementY:function(e){return"movementY"in e?e.movementY:Eo}}),Nf=Xt(Mi),N0=v({},Mi,{dataTransfer:0}),j0=Xt(N0),O0=v({},ps,{relatedTarget:0}),wo=Xt(O0),D0=v({},Yl,{animationName:0,elapsedTime:0,pseudoElement:0}),M0=Xt(D0),L0=v({},Yl,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),z0=Xt(L0),U0=v({},Yl,{data:0}),jf=Xt(U0),B0={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},H0={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},I0={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function F0(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=I0[e])?!!t[e]:!1}function Ao(){return F0}var G0=v({},ps,{key:function(e){if(e.key){var t=B0[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=ji(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?H0[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ao,charCode:function(e){return e.type==="keypress"?ji(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?ji(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Y0=Xt(G0),q0=v({},Mi,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Of=Xt(q0),X0=v({},ps,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ao}),$0=Xt(X0),Z0=v({},Yl,{propertyName:0,elapsedTime:0,pseudoElement:0}),V0=Xt(Z0),Q0=v({},Mi,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),W0=Xt(Q0),K0=v({},Yl,{newState:0,oldState:0}),J0=Xt(K0),P0=[9,13,27,32],_o=Kn&&"CompositionEvent"in window,ys=null;Kn&&"documentMode"in document&&(ys=document.documentMode);var ey=Kn&&"TextEvent"in window&&!ys,Df=Kn&&(!_o||ys&&8<ys&&11>=ys),Mf=" ",Lf=!1;function zf(e,t){switch(e){case"keyup":return P0.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Uf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ya=!1;function ty(e,t){switch(e){case"compositionend":return Uf(t);case"keypress":return t.which!==32?null:(Lf=!0,Mf);case"textInput":return e=t.data,e===Mf&&Lf?null:e;default:return null}}function ny(e,t){if(ya)return e==="compositionend"||!_o&&zf(e,t)?(e=Cf(),Ni=To=yl=null,ya=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Df&&t.locale!=="ko"?null:t.data;default:return null}}var ly={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Bf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!ly[e.type]:t==="textarea"}function Hf(e,t,n,l){pa?ga?ga.push(l):ga=[l]:pa=l,t=Er(t,"onChange"),0<t.length&&(n=new Di("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var bs=null,xs=null;function ay(e){Tm(e,0)}function Li(e){var t=Qe(e);if(vf(t))return e}function If(e,t){if(e==="change")return t}var Ff=!1;if(Kn){var Ro;if(Kn){var Co="oninput"in document;if(!Co){var Gf=document.createElement("div");Gf.setAttribute("oninput","return;"),Co=typeof Gf.oninput=="function"}Ro=Co}else Ro=!1;Ff=Ro&&(!document.documentMode||9<document.documentMode)}function Yf(){bs&&(bs.detachEvent("onpropertychange",qf),xs=bs=null)}function qf(e){if(e.propertyName==="value"&&Li(xs)){var t=[];Hf(t,xs,e,bo(e)),Rf(ay,t)}}function sy(e,t,n){e==="focusin"?(Yf(),bs=t,xs=n,bs.attachEvent("onpropertychange",qf)):e==="focusout"&&Yf()}function iy(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Li(xs)}function ry(e,t){if(e==="click")return Li(t)}function oy(e,t){if(e==="input"||e==="change")return Li(t)}function uy(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var en=typeof Object.is=="function"?Object.is:uy;function vs(e,t){if(en(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var r=n[l];if(!je.call(t,r)||!en(e[r],t[r]))return!1}return!0}function Xf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function $f(e,t){var n=Xf(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Xf(n)}}function Zf(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Zf(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Vf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ci(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ci(e.document)}return t}function ko(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var cy=Kn&&"documentMode"in document&&11>=document.documentMode,ba=null,No=null,Ts=null,jo=!1;function Qf(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;jo||ba==null||ba!==Ci(l)||(l=ba,"selectionStart"in l&&ko(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Ts&&vs(Ts,l)||(Ts=l,l=Er(No,"onSelect"),0<l.length&&(t=new Di("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=ba)))}function ql(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var xa={animationend:ql("Animation","AnimationEnd"),animationiteration:ql("Animation","AnimationIteration"),animationstart:ql("Animation","AnimationStart"),transitionrun:ql("Transition","TransitionRun"),transitionstart:ql("Transition","TransitionStart"),transitioncancel:ql("Transition","TransitionCancel"),transitionend:ql("Transition","TransitionEnd")},Oo={},Wf={};Kn&&(Wf=document.createElement("div").style,"AnimationEvent"in window||(delete xa.animationend.animation,delete xa.animationiteration.animation,delete xa.animationstart.animation),"TransitionEvent"in window||delete xa.transitionend.transition);function Xl(e){if(Oo[e])return Oo[e];if(!xa[e])return e;var t=xa[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Wf)return Oo[e]=t[n];return e}var Kf=Xl("animationend"),Jf=Xl("animationiteration"),Pf=Xl("animationstart"),fy=Xl("transitionrun"),dy=Xl("transitionstart"),hy=Xl("transitioncancel"),ed=Xl("transitionend"),td=new Map,Do="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Do.push("scrollEnd");function _n(e,t){td.set(e,t),qt(t,[e])}var zi=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},pn=[],va=0,Mo=0;function Ui(){for(var e=va,t=Mo=va=0;t<e;){var n=pn[t];pn[t++]=null;var l=pn[t];pn[t++]=null;var r=pn[t];pn[t++]=null;var u=pn[t];if(pn[t++]=null,l!==null&&r!==null){var g=l.pending;g===null?r.next=r:(r.next=g.next,g.next=r),l.pending=r}u!==0&&nd(n,r,u)}}function Bi(e,t,n,l){pn[va++]=e,pn[va++]=t,pn[va++]=n,pn[va++]=l,Mo|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Lo(e,t,n,l){return Bi(e,t,n,l),Hi(e)}function $l(e,t){return Bi(e,null,null,t),Hi(e)}function nd(e,t,n){e.lanes|=n;var l=e.alternate;l!==null&&(l.lanes|=n);for(var r=!1,u=e.return;u!==null;)u.childLanes|=n,l=u.alternate,l!==null&&(l.childLanes|=n),u.tag===22&&(e=u.stateNode,e===null||e._visibility&1||(r=!0)),e=u,u=u.return;return e.tag===3?(u=e.stateNode,r&&t!==null&&(r=31-bt(n),e=u.hiddenUpdates,l=e[r],l===null?e[r]=[t]:l.push(t),t.lane=n|536870912),u):null}function Hi(e){if(50<Ys)throw Ys=0,qu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Ta={};function my(e,t,n,l){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tn(e,t,n,l){return new my(e,t,n,l)}function zo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Jn(e,t){var n=e.alternate;return n===null?(n=tn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ld(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Ii(e,t,n,l,r,u){var g=0;if(l=e,typeof e=="function")zo(e)&&(g=1);else if(typeof e=="string")g=xb(e,n,Y.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case we:return e=tn(31,n,t,r),e.elementType=we,e.lanes=u,e;case A:return Zl(n.children,r,u,t);case L:g=8,r|=24;break;case H:return e=tn(12,n,t,r|2),e.elementType=H,e.lanes=u,e;case D:return e=tn(13,n,t,r),e.elementType=D,e.lanes=u,e;case j:return e=tn(19,n,t,r),e.elementType=j,e.lanes=u,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O:g=10;break e;case Z:g=9;break e;case C:g=11;break e;case Q:g=14;break e;case fe:g=16,l=null;break e}g=29,n=Error(i(130,e===null?"null":typeof e,"")),l=null}return t=tn(g,n,t,r),t.elementType=e,t.type=l,t.lanes=u,t}function Zl(e,t,n,l){return e=tn(7,e,l,t),e.lanes=n,e}function Uo(e,t,n){return e=tn(6,e,null,t),e.lanes=n,e}function ad(e){var t=tn(18,null,null,0);return t.stateNode=e,t}function Bo(e,t,n){return t=tn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var sd=new WeakMap;function gn(e,t){if(typeof e=="object"&&e!==null){var n=sd.get(e);return n!==void 0?n:(t={value:e,source:t,stack:Ce(t)},sd.set(e,t),t)}return{value:e,source:t,stack:Ce(t)}}var Sa=[],Ea=0,Fi=null,Ss=0,yn=[],bn=0,bl=null,Ln=1,zn="";function Pn(e,t){Sa[Ea++]=Ss,Sa[Ea++]=Fi,Fi=e,Ss=t}function id(e,t,n){yn[bn++]=Ln,yn[bn++]=zn,yn[bn++]=bl,bl=e;var l=Ln;e=zn;var r=32-bt(l)-1;l&=~(1<<r),n+=1;var u=32-bt(t)+r;if(30<u){var g=r-r%5;u=(l&(1<<g)-1).toString(32),l>>=g,r-=g,Ln=1<<32-bt(t)+r|n<<r|l,zn=u+e}else Ln=1<<u|n<<r|l,zn=e}function Ho(e){e.return!==null&&(Pn(e,1),id(e,1,0))}function Io(e){for(;e===Fi;)Fi=Sa[--Ea],Sa[Ea]=null,Ss=Sa[--Ea],Sa[Ea]=null;for(;e===bl;)bl=yn[--bn],yn[bn]=null,zn=yn[--bn],yn[bn]=null,Ln=yn[--bn],yn[bn]=null}function rd(e,t){yn[bn++]=Ln,yn[bn++]=zn,yn[bn++]=bl,Ln=t.id,zn=t.overflow,bl=e}var Dt=null,st=null,Ge=!1,xl=null,xn=!1,Fo=Error(i(519));function vl(e){var t=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Es(gn(t,e)),Fo}function od(e){var t=e.stateNode,n=e.type,l=e.memoizedProps;switch(t[xt]=e,t[ot]=l,n){case"dialog":He("cancel",t),He("close",t);break;case"iframe":case"object":case"embed":He("load",t);break;case"video":case"audio":for(n=0;n<Xs.length;n++)He(Xs[n],t);break;case"source":He("error",t);break;case"img":case"image":case"link":He("error",t),He("load",t);break;case"details":He("toggle",t);break;case"input":He("invalid",t),Tf(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":He("invalid",t);break;case"textarea":He("invalid",t),Ef(t,l.value,l.defaultValue,l.children)}n=l.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||t.textContent===""+n||l.suppressHydrationWarning===!0||Am(t.textContent,n)?(l.popover!=null&&(He("beforetoggle",t),He("toggle",t)),l.onScroll!=null&&He("scroll",t),l.onScrollEnd!=null&&He("scrollend",t),l.onClick!=null&&(t.onclick=Wn),t=!0):t=!1,t||vl(e,!0)}function ud(e){for(Dt=e.return;Dt;)switch(Dt.tag){case 5:case 31:case 13:xn=!1;return;case 27:case 3:xn=!0;return;default:Dt=Dt.return}}function wa(e){if(e!==Dt)return!1;if(!Ge)return ud(e),Ge=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!=="form"&&n!=="button")||sc(e.type,e.memoizedProps)),n=!n),n&&st&&vl(e),ud(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));st=Mm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));st=Mm(e)}else t===27?(t=st,Ml(e.type)?(e=cc,cc=null,st=e):st=t):st=Dt?Tn(e.stateNode.nextSibling):null;return!0}function Vl(){st=Dt=null,Ge=!1}function Go(){var e=xl;return e!==null&&(Qt===null?Qt=e:Qt.push.apply(Qt,e),xl=null),e}function Es(e){xl===null?xl=[e]:xl.push(e)}var Yo=_(null),Ql=null,el=null;function Tl(e,t,n){$(Yo,t._currentValue),t._currentValue=n}function tl(e){e._currentValue=Yo.current,q(Yo)}function qo(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function Xo(e,t,n,l){var r=e.child;for(r!==null&&(r.return=e);r!==null;){var u=r.dependencies;if(u!==null){var g=r.child;u=u.firstContext;e:for(;u!==null;){var S=u;u=r;for(var R=0;R<t.length;R++)if(S.context===t[R]){u.lanes|=n,S=u.alternate,S!==null&&(S.lanes|=n),qo(u.return,n,e),l||(g=null);break e}u=S.next}}else if(r.tag===18){if(g=r.return,g===null)throw Error(i(341));g.lanes|=n,u=g.alternate,u!==null&&(u.lanes|=n),qo(g,n,e),g=null}else g=r.child;if(g!==null)g.return=r;else for(g=r;g!==null;){if(g===e){g=null;break}if(r=g.sibling,r!==null){r.return=g.return,g=r;break}g=g.return}r=g}}function Aa(e,t,n,l){e=null;for(var r=t,u=!1;r!==null;){if(!u){if((r.flags&524288)!==0)u=!0;else if((r.flags&262144)!==0)break}if(r.tag===10){var g=r.alternate;if(g===null)throw Error(i(387));if(g=g.memoizedProps,g!==null){var S=r.type;en(r.pendingProps.value,g.value)||(e!==null?e.push(S):e=[S])}}else if(r===I.current){if(g=r.alternate,g===null)throw Error(i(387));g.memoizedState.memoizedState!==r.memoizedState.memoizedState&&(e!==null?e.push(Ws):e=[Ws])}r=r.return}e!==null&&Xo(t,e,n,l),t.flags|=262144}function Gi(e){for(e=e.firstContext;e!==null;){if(!en(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Wl(e){Ql=e,el=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Mt(e){return cd(Ql,e)}function Yi(e,t){return Ql===null&&Wl(e),cd(e,t)}function cd(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},el===null){if(e===null)throw Error(i(308));el=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else el=el.next=t;return n}var py=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(n,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(n){return n()})}},gy=a.unstable_scheduleCallback,yy=a.unstable_NormalPriority,vt={$$typeof:O,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $o(){return{controller:new py,data:new Map,refCount:0}}function ws(e){e.refCount--,e.refCount===0&&gy(yy,function(){e.controller.abort()})}var As=null,Zo=0,_a=0,Ra=null;function by(e,t){if(As===null){var n=As=[];Zo=0,_a=Wu(),Ra={status:"pending",value:void 0,then:function(l){n.push(l)}}}return Zo++,t.then(fd,fd),t}function fd(){if(--Zo===0&&As!==null){Ra!==null&&(Ra.status="fulfilled");var e=As;As=null,_a=0,Ra=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function xy(e,t){var n=[],l={status:"pending",value:null,reason:null,then:function(r){n.push(r)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var r=0;r<n.length;r++)(0,n[r])(t)},function(r){for(l.status="rejected",l.reason=r,r=0;r<n.length;r++)(0,n[r])(void 0)}),l}var dd=G.S;G.S=function(e,t){Qh=jt(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&by(e,t),dd!==null&&dd(e,t)};var Kl=_(null);function Vo(){var e=Kl.current;return e!==null?e:at.pooledCache}function qi(e,t){t===null?$(Kl,Kl.current):$(Kl,t.pool)}function hd(){var e=Vo();return e===null?null:{parent:vt._currentValue,pool:e}}var Ca=Error(i(460)),Qo=Error(i(474)),Xi=Error(i(542)),$i={then:function(){}};function md(e){return e=e.status,e==="fulfilled"||e==="rejected"}function pd(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(Wn,Wn),t=n),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,yd(e),e;default:if(typeof t.status=="string")t.then(Wn,Wn);else{if(e=at,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var r=t;r.status="fulfilled",r.value=l}},function(l){if(t.status==="pending"){var r=t;r.status="rejected",r.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,yd(e),e}throw Pl=t,Ca}}function Jl(e){try{var t=e._init;return t(e._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Pl=n,Ca):n}}var Pl=null;function gd(){if(Pl===null)throw Error(i(459));var e=Pl;return Pl=null,e}function yd(e){if(e===Ca||e===Xi)throw Error(i(483))}var ka=null,_s=0;function Zi(e){var t=_s;return _s+=1,ka===null&&(ka=[]),pd(ka,e,t)}function Rs(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Vi(e,t){throw t.$$typeof===x?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function bd(e){function t(z,N){if(e){var U=z.deletions;U===null?(z.deletions=[N],z.flags|=16):U.push(N)}}function n(z,N){if(!e)return null;for(;N!==null;)t(z,N),N=N.sibling;return null}function l(z){for(var N=new Map;z!==null;)z.key!==null?N.set(z.key,z):N.set(z.index,z),z=z.sibling;return N}function r(z,N){return z=Jn(z,N),z.index=0,z.sibling=null,z}function u(z,N,U){return z.index=U,e?(U=z.alternate,U!==null?(U=U.index,U<N?(z.flags|=67108866,N):U):(z.flags|=67108866,N)):(z.flags|=1048576,N)}function g(z){return e&&z.alternate===null&&(z.flags|=67108866),z}function S(z,N,U,J){return N===null||N.tag!==6?(N=Uo(U,z.mode,J),N.return=z,N):(N=r(N,U),N.return=z,N)}function R(z,N,U,J){var Ae=U.type;return Ae===A?V(z,N,U.props.children,J,U.key):N!==null&&(N.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===fe&&Jl(Ae)===N.type)?(N=r(N,U.props),Rs(N,U),N.return=z,N):(N=Ii(U.type,U.key,U.props,null,z.mode,J),Rs(N,U),N.return=z,N)}function B(z,N,U,J){return N===null||N.tag!==4||N.stateNode.containerInfo!==U.containerInfo||N.stateNode.implementation!==U.implementation?(N=Bo(U,z.mode,J),N.return=z,N):(N=r(N,U.children||[]),N.return=z,N)}function V(z,N,U,J,Ae){return N===null||N.tag!==7?(N=Zl(U,z.mode,J,Ae),N.return=z,N):(N=r(N,U),N.return=z,N)}function te(z,N,U){if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return N=Uo(""+N,z.mode,U),N.return=z,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case T:return U=Ii(N.type,N.key,N.props,null,z.mode,U),Rs(U,N),U.return=z,U;case w:return N=Bo(N,z.mode,U),N.return=z,N;case fe:return N=Jl(N),te(z,N,U)}if(me(N)||ge(N))return N=Zl(N,z.mode,U,null),N.return=z,N;if(typeof N.then=="function")return te(z,Zi(N),U);if(N.$$typeof===O)return te(z,Yi(z,N),U);Vi(z,N)}return null}function F(z,N,U,J){var Ae=N!==null?N.key:null;if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return Ae!==null?null:S(z,N,""+U,J);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case T:return U.key===Ae?R(z,N,U,J):null;case w:return U.key===Ae?B(z,N,U,J):null;case fe:return U=Jl(U),F(z,N,U,J)}if(me(U)||ge(U))return Ae!==null?null:V(z,N,U,J,null);if(typeof U.then=="function")return F(z,N,Zi(U),J);if(U.$$typeof===O)return F(z,N,Yi(z,U),J);Vi(z,U)}return null}function X(z,N,U,J,Ae){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return z=z.get(U)||null,S(N,z,""+J,Ae);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case T:return z=z.get(J.key===null?U:J.key)||null,R(N,z,J,Ae);case w:return z=z.get(J.key===null?U:J.key)||null,B(N,z,J,Ae);case fe:return J=Jl(J),X(z,N,U,J,Ae)}if(me(J)||ge(J))return z=z.get(U)||null,V(N,z,J,Ae,null);if(typeof J.then=="function")return X(z,N,U,Zi(J),Ae);if(J.$$typeof===O)return X(z,N,U,Yi(N,J),Ae);Vi(N,J)}return null}function pe(z,N,U,J){for(var Ae=null,$e=null,be=N,De=N=0,Fe=null;be!==null&&De<U.length;De++){be.index>De?(Fe=be,be=null):Fe=be.sibling;var Ze=F(z,be,U[De],J);if(Ze===null){be===null&&(be=Fe);break}e&&be&&Ze.alternate===null&&t(z,be),N=u(Ze,N,De),$e===null?Ae=Ze:$e.sibling=Ze,$e=Ze,be=Fe}if(De===U.length)return n(z,be),Ge&&Pn(z,De),Ae;if(be===null){for(;De<U.length;De++)be=te(z,U[De],J),be!==null&&(N=u(be,N,De),$e===null?Ae=be:$e.sibling=be,$e=be);return Ge&&Pn(z,De),Ae}for(be=l(be);De<U.length;De++)Fe=X(be,z,De,U[De],J),Fe!==null&&(e&&Fe.alternate!==null&&be.delete(Fe.key===null?De:Fe.key),N=u(Fe,N,De),$e===null?Ae=Fe:$e.sibling=Fe,$e=Fe);return e&&be.forEach(function(Hl){return t(z,Hl)}),Ge&&Pn(z,De),Ae}function Re(z,N,U,J){if(U==null)throw Error(i(151));for(var Ae=null,$e=null,be=N,De=N=0,Fe=null,Ze=U.next();be!==null&&!Ze.done;De++,Ze=U.next()){be.index>De?(Fe=be,be=null):Fe=be.sibling;var Hl=F(z,be,Ze.value,J);if(Hl===null){be===null&&(be=Fe);break}e&&be&&Hl.alternate===null&&t(z,be),N=u(Hl,N,De),$e===null?Ae=Hl:$e.sibling=Hl,$e=Hl,be=Fe}if(Ze.done)return n(z,be),Ge&&Pn(z,De),Ae;if(be===null){for(;!Ze.done;De++,Ze=U.next())Ze=te(z,Ze.value,J),Ze!==null&&(N=u(Ze,N,De),$e===null?Ae=Ze:$e.sibling=Ze,$e=Ze);return Ge&&Pn(z,De),Ae}for(be=l(be);!Ze.done;De++,Ze=U.next())Ze=X(be,z,De,Ze.value,J),Ze!==null&&(e&&Ze.alternate!==null&&be.delete(Ze.key===null?De:Ze.key),N=u(Ze,N,De),$e===null?Ae=Ze:$e.sibling=Ze,$e=Ze);return e&&be.forEach(function(Nb){return t(z,Nb)}),Ge&&Pn(z,De),Ae}function nt(z,N,U,J){if(typeof U=="object"&&U!==null&&U.type===A&&U.key===null&&(U=U.props.children),typeof U=="object"&&U!==null){switch(U.$$typeof){case T:e:{for(var Ae=U.key;N!==null;){if(N.key===Ae){if(Ae=U.type,Ae===A){if(N.tag===7){n(z,N.sibling),J=r(N,U.props.children),J.return=z,z=J;break e}}else if(N.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===fe&&Jl(Ae)===N.type){n(z,N.sibling),J=r(N,U.props),Rs(J,U),J.return=z,z=J;break e}n(z,N);break}else t(z,N);N=N.sibling}U.type===A?(J=Zl(U.props.children,z.mode,J,U.key),J.return=z,z=J):(J=Ii(U.type,U.key,U.props,null,z.mode,J),Rs(J,U),J.return=z,z=J)}return g(z);case w:e:{for(Ae=U.key;N!==null;){if(N.key===Ae)if(N.tag===4&&N.stateNode.containerInfo===U.containerInfo&&N.stateNode.implementation===U.implementation){n(z,N.sibling),J=r(N,U.children||[]),J.return=z,z=J;break e}else{n(z,N);break}else t(z,N);N=N.sibling}J=Bo(U,z.mode,J),J.return=z,z=J}return g(z);case fe:return U=Jl(U),nt(z,N,U,J)}if(me(U))return pe(z,N,U,J);if(ge(U)){if(Ae=ge(U),typeof Ae!="function")throw Error(i(150));return U=Ae.call(U),Re(z,N,U,J)}if(typeof U.then=="function")return nt(z,N,Zi(U),J);if(U.$$typeof===O)return nt(z,N,Yi(z,U),J);Vi(z,U)}return typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint"?(U=""+U,N!==null&&N.tag===6?(n(z,N.sibling),J=r(N,U),J.return=z,z=J):(n(z,N),J=Uo(U,z.mode,J),J.return=z,z=J),g(z)):n(z,N)}return function(z,N,U,J){try{_s=0;var Ae=nt(z,N,U,J);return ka=null,Ae}catch(be){if(be===Ca||be===Xi)throw be;var $e=tn(29,be,null,z.mode);return $e.lanes=J,$e.return=z,$e}finally{}}}var ea=bd(!0),xd=bd(!1),Sl=!1;function Wo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ko(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function El(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function wl(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ve&2)!==0){var r=l.pending;return r===null?t.next=t:(t.next=r.next,r.next=t),l.pending=t,t=Hi(e),nd(e,null,n),t}return Bi(e,l,t,n),Hi(e)}function Cs(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,os(e,n)}}function Jo(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var r=null,u=null;if(n=n.firstBaseUpdate,n!==null){do{var g={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};u===null?r=u=g:u=u.next=g,n=n.next}while(n!==null);u===null?r=u=t:u=u.next=t}else r=u=t;n={baseState:l.baseState,firstBaseUpdate:r,lastBaseUpdate:u,shared:l.shared,callbacks:l.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Po=!1;function ks(){if(Po){var e=Ra;if(e!==null)throw e}}function Ns(e,t,n,l){Po=!1;var r=e.updateQueue;Sl=!1;var u=r.firstBaseUpdate,g=r.lastBaseUpdate,S=r.shared.pending;if(S!==null){r.shared.pending=null;var R=S,B=R.next;R.next=null,g===null?u=B:g.next=B,g=R;var V=e.alternate;V!==null&&(V=V.updateQueue,S=V.lastBaseUpdate,S!==g&&(S===null?V.firstBaseUpdate=B:S.next=B,V.lastBaseUpdate=R))}if(u!==null){var te=r.baseState;g=0,V=B=R=null,S=u;do{var F=S.lane&-536870913,X=F!==S.lane;if(X?(Ie&F)===F:(l&F)===F){F!==0&&F===_a&&(Po=!0),V!==null&&(V=V.next={lane:0,tag:S.tag,payload:S.payload,callback:null,next:null});e:{var pe=e,Re=S;F=t;var nt=n;switch(Re.tag){case 1:if(pe=Re.payload,typeof pe=="function"){te=pe.call(nt,te,F);break e}te=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=Re.payload,F=typeof pe=="function"?pe.call(nt,te,F):pe,F==null)break e;te=v({},te,F);break e;case 2:Sl=!0}}F=S.callback,F!==null&&(e.flags|=64,X&&(e.flags|=8192),X=r.callbacks,X===null?r.callbacks=[F]:X.push(F))}else X={lane:F,tag:S.tag,payload:S.payload,callback:S.callback,next:null},V===null?(B=V=X,R=te):V=V.next=X,g|=F;if(S=S.next,S===null){if(S=r.shared.pending,S===null)break;X=S,S=X.next,X.next=null,r.lastBaseUpdate=X,r.shared.pending=null}}while(!0);V===null&&(R=te),r.baseState=R,r.firstBaseUpdate=B,r.lastBaseUpdate=V,u===null&&(r.shared.lanes=0),kl|=g,e.lanes=g,e.memoizedState=te}}function vd(e,t){if(typeof e!="function")throw Error(i(191,e));e.call(t)}function Td(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)vd(n[e],t)}var Na=_(null),Qi=_(0);function Sd(e,t){e=cl,$(Qi,e),$(Na,t),cl=e|t.baseLanes}function eu(){$(Qi,cl),$(Na,Na.current)}function tu(){cl=Qi.current,q(Na),q(Qi)}var nn=_(null),vn=null;function Al(e){var t=e.alternate;$(pt,pt.current&1),$(nn,e),vn===null&&(t===null||Na.current!==null||t.memoizedState!==null)&&(vn=e)}function nu(e){$(pt,pt.current),$(nn,e),vn===null&&(vn=e)}function Ed(e){e.tag===22?($(pt,pt.current),$(nn,e),vn===null&&(vn=e)):_l()}function _l(){$(pt,pt.current),$(nn,nn.current)}function ln(e){q(nn),vn===e&&(vn=null),q(pt)}var pt=_(0);function Wi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||oc(n)||uc(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var nl=0,Oe=null,et=null,Tt=null,Ki=!1,ja=!1,ta=!1,Ji=0,js=0,Oa=null,vy=0;function dt(){throw Error(i(321))}function lu(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!en(e[n],t[n]))return!1;return!0}function au(e,t,n,l,r,u){return nl=u,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,G.H=e===null||e.memoizedState===null?ih:xu,ta=!1,u=n(l,r),ta=!1,ja&&(u=Ad(t,n,l,r)),wd(e),u}function wd(e){G.H=Ms;var t=et!==null&&et.next!==null;if(nl=0,Tt=et=Oe=null,Ki=!1,js=0,Oa=null,t)throw Error(i(300));e===null||St||(e=e.dependencies,e!==null&&Gi(e)&&(St=!0))}function Ad(e,t,n,l){Oe=e;var r=0;do{if(ja&&(Oa=null),js=0,ja=!1,25<=r)throw Error(i(301));if(r+=1,Tt=et=null,e.updateQueue!=null){var u=e.updateQueue;u.lastEffect=null,u.events=null,u.stores=null,u.memoCache!=null&&(u.memoCache.index=0)}G.H=rh,u=t(n,l)}while(ja);return u}function Ty(){var e=G.H,t=e.useState()[0];return t=typeof t.then=="function"?Os(t):t,e=e.useState()[0],(et!==null?et.memoizedState:null)!==e&&(Oe.flags|=1024),t}function su(){var e=Ji!==0;return Ji=0,e}function iu(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function ru(e){if(Ki){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Ki=!1}nl=0,Tt=et=Oe=null,ja=!1,js=Ji=0,Oa=null}function Bt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Tt===null?Oe.memoizedState=Tt=e:Tt=Tt.next=e,Tt}function gt(){if(et===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=et.next;var t=Tt===null?Oe.memoizedState:Tt.next;if(t!==null)Tt=t,et=e;else{if(e===null)throw Oe.alternate===null?Error(i(467)):Error(i(310));et=e,e={memoizedState:et.memoizedState,baseState:et.baseState,baseQueue:et.baseQueue,queue:et.queue,next:null},Tt===null?Oe.memoizedState=Tt=e:Tt=Tt.next=e}return Tt}function Pi(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Os(e){var t=js;return js+=1,Oa===null&&(Oa=[]),e=pd(Oa,e,t),t=Oe,(Tt===null?t.memoizedState:Tt.next)===null&&(t=t.alternate,G.H=t===null||t.memoizedState===null?ih:xu),e}function er(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Os(e);if(e.$$typeof===O)return Mt(e)}throw Error(i(438,String(e)))}function ou(e){var t=null,n=Oe.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var l=Oe.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(r){return r.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),n===null&&(n=Pi(),Oe.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),l=0;l<e;l++)n[l]=ie;return t.index++,n}function ll(e,t){return typeof t=="function"?t(e):t}function tr(e){var t=gt();return uu(t,et,e)}function uu(e,t,n){var l=e.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=n;var r=e.baseQueue,u=l.pending;if(u!==null){if(r!==null){var g=r.next;r.next=u.next,u.next=g}t.baseQueue=r=u,l.pending=null}if(u=e.baseState,r===null)e.memoizedState=u;else{t=r.next;var S=g=null,R=null,B=t,V=!1;do{var te=B.lane&-536870913;if(te!==B.lane?(Ie&te)===te:(nl&te)===te){var F=B.revertLane;if(F===0)R!==null&&(R=R.next={lane:0,revertLane:0,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null}),te===_a&&(V=!0);else if((nl&F)===F){B=B.next,F===_a&&(V=!0);continue}else te={lane:0,revertLane:B.revertLane,gesture:null,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},R===null?(S=R=te,g=u):R=R.next=te,Oe.lanes|=F,kl|=F;te=B.action,ta&&n(u,te),u=B.hasEagerState?B.eagerState:n(u,te)}else F={lane:te,revertLane:B.revertLane,gesture:B.gesture,action:B.action,hasEagerState:B.hasEagerState,eagerState:B.eagerState,next:null},R===null?(S=R=F,g=u):R=R.next=F,Oe.lanes|=te,kl|=te;B=B.next}while(B!==null&&B!==t);if(R===null?g=u:R.next=S,!en(u,e.memoizedState)&&(St=!0,V&&(n=Ra,n!==null)))throw n;e.memoizedState=u,e.baseState=g,e.baseQueue=R,l.lastRenderedState=u}return r===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function cu(e){var t=gt(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var l=n.dispatch,r=n.pending,u=t.memoizedState;if(r!==null){n.pending=null;var g=r=r.next;do u=e(u,g.action),g=g.next;while(g!==r);en(u,t.memoizedState)||(St=!0),t.memoizedState=u,t.baseQueue===null&&(t.baseState=u),n.lastRenderedState=u}return[u,l]}function _d(e,t,n){var l=Oe,r=gt(),u=Ge;if(u){if(n===void 0)throw Error(i(407));n=n()}else n=t();var g=!en((et||r).memoizedState,n);if(g&&(r.memoizedState=n,St=!0),r=r.queue,hu(kd.bind(null,l,r,e),[e]),r.getSnapshot!==t||g||Tt!==null&&Tt.memoizedState.tag&1){if(l.flags|=2048,Da(9,{destroy:void 0},Cd.bind(null,l,r,n,t),null),at===null)throw Error(i(349));u||(nl&127)!==0||Rd(l,t,n)}return n}function Rd(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Oe.updateQueue,t===null?(t=Pi(),Oe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Cd(e,t,n,l){t.value=n,t.getSnapshot=l,Nd(t)&&jd(e)}function kd(e,t,n){return n(function(){Nd(t)&&jd(e)})}function Nd(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!en(e,n)}catch{return!0}}function jd(e){var t=$l(e,2);t!==null&&Wt(t,e,2)}function fu(e){var t=Bt();if(typeof e=="function"){var n=e;if(e=n(),ta){Ct(!0);try{n()}finally{Ct(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:e},t}function Od(e,t,n,l){return e.baseState=n,uu(e,et,typeof l=="function"?l:ll)}function Sy(e,t,n,l,r){if(ar(e))throw Error(i(485));if(e=t.action,e!==null){var u={payload:r,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(g){u.listeners.push(g)}};G.T!==null?n(!0):u.isTransition=!1,l(u),n=t.pending,n===null?(u.next=t.pending=u,Dd(t,u)):(u.next=n.next,t.pending=n.next=u)}}function Dd(e,t){var n=t.action,l=t.payload,r=e.state;if(t.isTransition){var u=G.T,g={};G.T=g;try{var S=n(r,l),R=G.S;R!==null&&R(g,S),Md(e,t,S)}catch(B){du(e,t,B)}finally{u!==null&&g.types!==null&&(u.types=g.types),G.T=u}}else try{u=n(r,l),Md(e,t,u)}catch(B){du(e,t,B)}}function Md(e,t,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(l){Ld(e,t,l)},function(l){return du(e,t,l)}):Ld(e,t,n)}function Ld(e,t,n){t.status="fulfilled",t.value=n,zd(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Dd(e,n)))}function du(e,t,n){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=n,zd(t),t=t.next;while(t!==l)}e.action=null}function zd(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Ud(e,t){return t}function Bd(e,t){if(Ge){var n=at.formState;if(n!==null){e:{var l=Oe;if(Ge){if(st){t:{for(var r=st,u=xn;r.nodeType!==8;){if(!u){r=null;break t}if(r=Tn(r.nextSibling),r===null){r=null;break t}}u=r.data,r=u==="F!"||u==="F"?r:null}if(r){st=Tn(r.nextSibling),l=r.data==="F!";break e}}vl(l)}l=!1}l&&(t=n[0])}}return n=Bt(),n.memoizedState=n.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ud,lastRenderedState:t},n.queue=l,n=lh.bind(null,Oe,l),l.dispatch=n,l=fu(!1),u=bu.bind(null,Oe,!1,l.queue),l=Bt(),r={state:t,dispatch:null,action:e,pending:null},l.queue=r,n=Sy.bind(null,Oe,r,u,n),r.dispatch=n,l.memoizedState=e,[t,n,!1]}function Hd(e){var t=gt();return Id(t,et,e)}function Id(e,t,n){if(t=uu(e,t,Ud)[0],e=tr(ll)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Os(t)}catch(g){throw g===Ca?Xi:g}else l=t;t=gt();var r=t.queue,u=r.dispatch;return n!==t.memoizedState&&(Oe.flags|=2048,Da(9,{destroy:void 0},Ey.bind(null,r,n),null)),[l,u,e]}function Ey(e,t){e.action=t}function Fd(e){var t=gt(),n=et;if(n!==null)return Id(t,n,e);gt(),t=t.memoizedState,n=gt();var l=n.queue.dispatch;return n.memoizedState=e,[t,l,!1]}function Da(e,t,n,l){return e={tag:e,create:n,deps:l,inst:t,next:null},t=Oe.updateQueue,t===null&&(t=Pi(),Oe.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e),e}function Gd(){return gt().memoizedState}function nr(e,t,n,l){var r=Bt();Oe.flags|=e,r.memoizedState=Da(1|t,{destroy:void 0},n,l===void 0?null:l)}function lr(e,t,n,l){var r=gt();l=l===void 0?null:l;var u=r.memoizedState.inst;et!==null&&l!==null&&lu(l,et.memoizedState.deps)?r.memoizedState=Da(t,u,n,l):(Oe.flags|=e,r.memoizedState=Da(1|t,u,n,l))}function Yd(e,t){nr(8390656,8,e,t)}function hu(e,t){lr(2048,8,e,t)}function wy(e){Oe.flags|=4;var t=Oe.updateQueue;if(t===null)t=Pi(),Oe.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function qd(e){var t=gt().memoizedState;return wy({ref:t,nextImpl:e}),function(){if((Ve&2)!==0)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Xd(e,t){return lr(4,2,e,t)}function $d(e,t){return lr(4,4,e,t)}function Zd(e,t){if(typeof t=="function"){e=e();var n=t(e);return function(){typeof n=="function"?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Vd(e,t,n){n=n!=null?n.concat([e]):null,lr(4,4,Zd.bind(null,t,e),n)}function mu(){}function Qd(e,t){var n=gt();t=t===void 0?null:t;var l=n.memoizedState;return t!==null&&lu(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Wd(e,t){var n=gt();t=t===void 0?null:t;var l=n.memoizedState;if(t!==null&&lu(t,l[1]))return l[0];if(l=e(),ta){Ct(!0);try{e()}finally{Ct(!1)}}return n.memoizedState=[l,t],l}function pu(e,t,n){return n===void 0||(nl&1073741824)!==0&&(Ie&261930)===0?e.memoizedState=t:(e.memoizedState=n,e=Kh(),Oe.lanes|=e,kl|=e,n)}function Kd(e,t,n,l){return en(n,t)?n:Na.current!==null?(e=pu(e,n,l),en(e,t)||(St=!0),e):(nl&42)===0||(nl&1073741824)!==0&&(Ie&261930)===0?(St=!0,e.memoizedState=n):(e=Kh(),Oe.lanes|=e,kl|=e,t)}function Jd(e,t,n,l,r){var u=le.p;le.p=u!==0&&8>u?u:8;var g=G.T,S={};G.T=S,bu(e,!1,t,n);try{var R=r(),B=G.S;if(B!==null&&B(S,R),R!==null&&typeof R=="object"&&typeof R.then=="function"){var V=xy(R,l);Ds(e,t,V,rn(e))}else Ds(e,t,l,rn(e))}catch(te){Ds(e,t,{then:function(){},status:"rejected",reason:te},rn())}finally{le.p=u,g!==null&&S.types!==null&&(g.types=S.types),G.T=g}}function Ay(){}function gu(e,t,n,l){if(e.tag!==5)throw Error(i(476));var r=Pd(e).queue;Jd(e,r,t,he,n===null?Ay:function(){return eh(e),n(l)})}function Pd(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:he},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ll,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function eh(e){var t=Pd(e);t.next===null&&(t=e.alternate.memoizedState),Ds(e,t.next.queue,{},rn())}function yu(){return Mt(Ws)}function th(){return gt().memoizedState}function nh(){return gt().memoizedState}function _y(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=rn();e=El(n);var l=wl(t,e,n);l!==null&&(Wt(l,t,n),Cs(l,t,n)),t={cache:$o()},e.payload=t;return}t=t.return}}function Ry(e,t,n){var l=rn();n={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},ar(e)?ah(t,n):(n=Lo(e,t,n,l),n!==null&&(Wt(n,e,l),sh(n,t,l)))}function lh(e,t,n){var l=rn();Ds(e,t,n,l)}function Ds(e,t,n,l){var r={lane:l,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(ar(e))ah(t,r);else{var u=e.alternate;if(e.lanes===0&&(u===null||u.lanes===0)&&(u=t.lastRenderedReducer,u!==null))try{var g=t.lastRenderedState,S=u(g,n);if(r.hasEagerState=!0,r.eagerState=S,en(S,g))return Bi(e,t,r,0),at===null&&Ui(),!1}catch{}finally{}if(n=Lo(e,t,r,l),n!==null)return Wt(n,e,l),sh(n,t,l),!0}return!1}function bu(e,t,n,l){if(l={lane:2,revertLane:Wu(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},ar(e)){if(t)throw Error(i(479))}else t=Lo(e,n,l,2),t!==null&&Wt(t,e,2)}function ar(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function ah(e,t){ja=Ki=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function sh(e,t,n){if((n&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,os(e,n)}}var Ms={readContext:Mt,use:er,useCallback:dt,useContext:dt,useEffect:dt,useImperativeHandle:dt,useLayoutEffect:dt,useInsertionEffect:dt,useMemo:dt,useReducer:dt,useRef:dt,useState:dt,useDebugValue:dt,useDeferredValue:dt,useTransition:dt,useSyncExternalStore:dt,useId:dt,useHostTransitionStatus:dt,useFormState:dt,useActionState:dt,useOptimistic:dt,useMemoCache:dt,useCacheRefresh:dt};Ms.useEffectEvent=dt;var ih={readContext:Mt,use:er,useCallback:function(e,t){return Bt().memoizedState=[e,t===void 0?null:t],e},useContext:Mt,useEffect:Yd,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,nr(4194308,4,Zd.bind(null,t,e),n)},useLayoutEffect:function(e,t){return nr(4194308,4,e,t)},useInsertionEffect:function(e,t){nr(4,2,e,t)},useMemo:function(e,t){var n=Bt();t=t===void 0?null:t;var l=e();if(ta){Ct(!0);try{e()}finally{Ct(!1)}}return n.memoizedState=[l,t],l},useReducer:function(e,t,n){var l=Bt();if(n!==void 0){var r=n(t);if(ta){Ct(!0);try{n(t)}finally{Ct(!1)}}}else r=t;return l.memoizedState=l.baseState=r,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:r},l.queue=e,e=e.dispatch=Ry.bind(null,Oe,e),[l.memoizedState,e]},useRef:function(e){var t=Bt();return e={current:e},t.memoizedState=e},useState:function(e){e=fu(e);var t=e.queue,n=lh.bind(null,Oe,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:mu,useDeferredValue:function(e,t){var n=Bt();return pu(n,e,t)},useTransition:function(){var e=fu(!1);return e=Jd.bind(null,Oe,e.queue,!0,!1),Bt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var l=Oe,r=Bt();if(Ge){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),at===null)throw Error(i(349));(Ie&127)!==0||Rd(l,t,n)}r.memoizedState=n;var u={value:n,getSnapshot:t};return r.queue=u,Yd(kd.bind(null,l,u,e),[e]),l.flags|=2048,Da(9,{destroy:void 0},Cd.bind(null,l,u,n,t),null),n},useId:function(){var e=Bt(),t=at.identifierPrefix;if(Ge){var n=zn,l=Ln;n=(l&~(1<<32-bt(l)-1)).toString(32)+n,t="_"+t+"R_"+n,n=Ji++,0<n&&(t+="H"+n.toString(32)),t+="_"}else n=vy++,t="_"+t+"r_"+n.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:yu,useFormState:Bd,useActionState:Bd,useOptimistic:function(e){var t=Bt();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=bu.bind(null,Oe,!0,n),n.dispatch=t,[e,t]},useMemoCache:ou,useCacheRefresh:function(){return Bt().memoizedState=_y.bind(null,Oe)},useEffectEvent:function(e){var t=Bt(),n={impl:e};return t.memoizedState=n,function(){if((Ve&2)!==0)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},xu={readContext:Mt,use:er,useCallback:Qd,useContext:Mt,useEffect:hu,useImperativeHandle:Vd,useInsertionEffect:Xd,useLayoutEffect:$d,useMemo:Wd,useReducer:tr,useRef:Gd,useState:function(){return tr(ll)},useDebugValue:mu,useDeferredValue:function(e,t){var n=gt();return Kd(n,et.memoizedState,e,t)},useTransition:function(){var e=tr(ll)[0],t=gt().memoizedState;return[typeof e=="boolean"?e:Os(e),t]},useSyncExternalStore:_d,useId:th,useHostTransitionStatus:yu,useFormState:Hd,useActionState:Hd,useOptimistic:function(e,t){var n=gt();return Od(n,et,e,t)},useMemoCache:ou,useCacheRefresh:nh};xu.useEffectEvent=qd;var rh={readContext:Mt,use:er,useCallback:Qd,useContext:Mt,useEffect:hu,useImperativeHandle:Vd,useInsertionEffect:Xd,useLayoutEffect:$d,useMemo:Wd,useReducer:cu,useRef:Gd,useState:function(){return cu(ll)},useDebugValue:mu,useDeferredValue:function(e,t){var n=gt();return et===null?pu(n,e,t):Kd(n,et.memoizedState,e,t)},useTransition:function(){var e=cu(ll)[0],t=gt().memoizedState;return[typeof e=="boolean"?e:Os(e),t]},useSyncExternalStore:_d,useId:th,useHostTransitionStatus:yu,useFormState:Fd,useActionState:Fd,useOptimistic:function(e,t){var n=gt();return et!==null?Od(n,et,e,t):(n.baseState=e,[e,n.queue.dispatch])},useMemoCache:ou,useCacheRefresh:nh};rh.useEffectEvent=qd;function vu(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:v({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Tu={enqueueSetState:function(e,t,n){e=e._reactInternals;var l=rn(),r=El(l);r.payload=t,n!=null&&(r.callback=n),t=wl(e,r,l),t!==null&&(Wt(t,e,l),Cs(t,e,l))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=rn(),r=El(l);r.tag=1,r.payload=t,n!=null&&(r.callback=n),t=wl(e,r,l),t!==null&&(Wt(t,e,l),Cs(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=rn(),l=El(n);l.tag=2,t!=null&&(l.callback=t),t=wl(e,l,n),t!==null&&(Wt(t,e,n),Cs(t,e,n))}};function oh(e,t,n,l,r,u,g){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,u,g):t.prototype&&t.prototype.isPureReactComponent?!vs(n,l)||!vs(r,u):!0}function uh(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&Tu.enqueueReplaceState(t,t.state,null)}function na(e,t){var n=t;if("ref"in t){n={};for(var l in t)l!=="ref"&&(n[l]=t[l])}if(e=e.defaultProps){n===t&&(n=v({},n));for(var r in e)n[r]===void 0&&(n[r]=e[r])}return n}function ch(e){zi(e)}function fh(e){console.error(e)}function dh(e){zi(e)}function sr(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function hh(e,t,n){try{var l=e.onCaughtError;l(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(r){setTimeout(function(){throw r})}}function Su(e,t,n){return n=El(n),n.tag=3,n.payload={element:null},n.callback=function(){sr(e,t)},n}function mh(e){return e=El(e),e.tag=3,e}function ph(e,t,n,l){var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var u=l.value;e.payload=function(){return r(u)},e.callback=function(){hh(t,n,l)}}var g=n.stateNode;g!==null&&typeof g.componentDidCatch=="function"&&(e.callback=function(){hh(t,n,l),typeof r!="function"&&(Nl===null?Nl=new Set([this]):Nl.add(this));var S=l.stack;this.componentDidCatch(l.value,{componentStack:S!==null?S:""})})}function Cy(e,t,n,l,r){if(n.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=n.alternate,t!==null&&Aa(t,n,r,!0),n=nn.current,n!==null){switch(n.tag){case 31:case 13:return vn===null?yr():n.alternate===null&&ht===0&&(ht=3),n.flags&=-257,n.flags|=65536,n.lanes=r,l===$i?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([l]):t.add(l),Zu(e,l,r)),!1;case 22:return n.flags|=65536,l===$i?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([l]):n.add(l)),Zu(e,l,r)),!1}throw Error(i(435,n.tag))}return Zu(e,l,r),yr(),!1}if(Ge)return t=nn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=r,l!==Fo&&(e=Error(i(422),{cause:l}),Es(gn(e,n)))):(l!==Fo&&(t=Error(i(423),{cause:l}),Es(gn(t,n))),e=e.current.alternate,e.flags|=65536,r&=-r,e.lanes|=r,l=gn(l,n),r=Su(e.stateNode,l,r),Jo(e,r),ht!==4&&(ht=2)),!1;var u=Error(i(520),{cause:l});if(u=gn(u,n),Gs===null?Gs=[u]:Gs.push(u),ht!==4&&(ht=2),t===null)return!0;l=gn(l,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=r&-r,n.lanes|=e,e=Su(n.stateNode,l,e),Jo(n,e),!1;case 1:if(t=n.type,u=n.stateNode,(n.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||u!==null&&typeof u.componentDidCatch=="function"&&(Nl===null||!Nl.has(u))))return n.flags|=65536,r&=-r,n.lanes|=r,r=mh(r),ph(r,e,n,l),Jo(n,r),!1}n=n.return}while(n!==null);return!1}var Eu=Error(i(461)),St=!1;function Lt(e,t,n,l){t.child=e===null?xd(t,null,n,l):ea(t,e.child,n,l)}function gh(e,t,n,l,r){n=n.render;var u=t.ref;if("ref"in l){var g={};for(var S in l)S!=="ref"&&(g[S]=l[S])}else g=l;return Wl(t),l=au(e,t,n,g,u,r),S=su(),e!==null&&!St?(iu(e,t,r),al(e,t,r)):(Ge&&S&&Ho(t),t.flags|=1,Lt(e,t,l,r),t.child)}function yh(e,t,n,l,r){if(e===null){var u=n.type;return typeof u=="function"&&!zo(u)&&u.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=u,bh(e,t,u,l,r)):(e=Ii(n.type,null,l,t,t.mode,r),e.ref=t.ref,e.return=t,t.child=e)}if(u=e.child,!ju(e,r)){var g=u.memoizedProps;if(n=n.compare,n=n!==null?n:vs,n(g,l)&&e.ref===t.ref)return al(e,t,r)}return t.flags|=1,e=Jn(u,l),e.ref=t.ref,e.return=t,t.child=e}function bh(e,t,n,l,r){if(e!==null){var u=e.memoizedProps;if(vs(u,l)&&e.ref===t.ref)if(St=!1,t.pendingProps=l=u,ju(e,r))(e.flags&131072)!==0&&(St=!0);else return t.lanes=e.lanes,al(e,t,r)}return wu(e,t,n,l,r)}function xh(e,t,n,l){var r=l.children,u=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((t.flags&128)!==0){if(u=u!==null?u.baseLanes|n:n,e!==null){for(l=t.child=e.child,r=0;l!==null;)r=r|l.lanes|l.childLanes,l=l.sibling;l=r&~u}else l=0,t.child=null;return vh(e,t,u,n,l)}if((n&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&qi(t,u!==null?u.cachePool:null),u!==null?Sd(t,u):eu(),Ed(t);else return l=t.lanes=536870912,vh(e,t,u!==null?u.baseLanes|n:n,n,l)}else u!==null?(qi(t,u.cachePool),Sd(t,u),_l(),t.memoizedState=null):(e!==null&&qi(t,null),eu(),_l());return Lt(e,t,r,n),t.child}function Ls(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function vh(e,t,n,l,r){var u=Vo();return u=u===null?null:{parent:vt._currentValue,pool:u},t.memoizedState={baseLanes:n,cachePool:u},e!==null&&qi(t,null),eu(),Ed(t),e!==null&&Aa(e,t,l,!0),t.childLanes=r,null}function ir(e,t){return t=or({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Th(e,t,n){return ea(t,e.child,null,n),e=ir(t,t.pendingProps),e.flags|=2,ln(t),t.memoizedState=null,e}function ky(e,t,n){var l=t.pendingProps,r=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Ge){if(l.mode==="hidden")return e=ir(t,l),t.lanes=536870912,Ls(null,e);if(nu(t),(e=st)?(e=Dm(e,xn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bl!==null?{id:Ln,overflow:zn}:null,retryLane:536870912,hydrationErrors:null},n=ad(e),n.return=t,t.child=n,Dt=t,st=null)):e=null,e===null)throw vl(t);return t.lanes=536870912,null}return ir(t,l)}var u=e.memoizedState;if(u!==null){var g=u.dehydrated;if(nu(t),r)if(t.flags&256)t.flags&=-257,t=Th(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(St||Aa(e,t,n,!1),r=(n&e.childLanes)!==0,St||r){if(l=at,l!==null&&(g=Si(l,n),g!==0&&g!==u.retryLane))throw u.retryLane=g,$l(e,g),Wt(l,e,g),Eu;yr(),t=Th(e,t,n)}else e=u.treeContext,st=Tn(g.nextSibling),Dt=t,Ge=!0,xl=null,xn=!1,e!==null&&rd(t,e),t=ir(t,l),t.flags|=4096;return t}return e=Jn(e.child,{mode:l.mode,children:l.children}),e.ref=t.ref,t.child=e,e.return=t,e}function rr(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function wu(e,t,n,l,r){return Wl(t),n=au(e,t,n,l,void 0,r),l=su(),e!==null&&!St?(iu(e,t,r),al(e,t,r)):(Ge&&l&&Ho(t),t.flags|=1,Lt(e,t,n,r),t.child)}function Sh(e,t,n,l,r,u){return Wl(t),t.updateQueue=null,n=Ad(t,l,n,r),wd(e),l=su(),e!==null&&!St?(iu(e,t,u),al(e,t,u)):(Ge&&l&&Ho(t),t.flags|=1,Lt(e,t,n,u),t.child)}function Eh(e,t,n,l,r){if(Wl(t),t.stateNode===null){var u=Ta,g=n.contextType;typeof g=="object"&&g!==null&&(u=Mt(g)),u=new n(l,u),t.memoizedState=u.state!==null&&u.state!==void 0?u.state:null,u.updater=Tu,t.stateNode=u,u._reactInternals=t,u=t.stateNode,u.props=l,u.state=t.memoizedState,u.refs={},Wo(t),g=n.contextType,u.context=typeof g=="object"&&g!==null?Mt(g):Ta,u.state=t.memoizedState,g=n.getDerivedStateFromProps,typeof g=="function"&&(vu(t,n,g,l),u.state=t.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof u.getSnapshotBeforeUpdate=="function"||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(g=u.state,typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount(),g!==u.state&&Tu.enqueueReplaceState(u,u.state,null),Ns(t,l,u,r),ks(),u.state=t.memoizedState),typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){u=t.stateNode;var S=t.memoizedProps,R=na(n,S);u.props=R;var B=u.context,V=n.contextType;g=Ta,typeof V=="object"&&V!==null&&(g=Mt(V));var te=n.getDerivedStateFromProps;V=typeof te=="function"||typeof u.getSnapshotBeforeUpdate=="function",S=t.pendingProps!==S,V||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(S||B!==g)&&uh(t,u,l,g),Sl=!1;var F=t.memoizedState;u.state=F,Ns(t,l,u,r),ks(),B=t.memoizedState,S||F!==B||Sl?(typeof te=="function"&&(vu(t,n,te,l),B=t.memoizedState),(R=Sl||oh(t,n,R,l,F,B,g))?(V||typeof u.UNSAFE_componentWillMount!="function"&&typeof u.componentWillMount!="function"||(typeof u.componentWillMount=="function"&&u.componentWillMount(),typeof u.UNSAFE_componentWillMount=="function"&&u.UNSAFE_componentWillMount()),typeof u.componentDidMount=="function"&&(t.flags|=4194308)):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=B),u.props=l,u.state=B,u.context=g,l=R):(typeof u.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{u=t.stateNode,Ko(e,t),g=t.memoizedProps,V=na(n,g),u.props=V,te=t.pendingProps,F=u.context,B=n.contextType,R=Ta,typeof B=="object"&&B!==null&&(R=Mt(B)),S=n.getDerivedStateFromProps,(B=typeof S=="function"||typeof u.getSnapshotBeforeUpdate=="function")||typeof u.UNSAFE_componentWillReceiveProps!="function"&&typeof u.componentWillReceiveProps!="function"||(g!==te||F!==R)&&uh(t,u,l,R),Sl=!1,F=t.memoizedState,u.state=F,Ns(t,l,u,r),ks();var X=t.memoizedState;g!==te||F!==X||Sl||e!==null&&e.dependencies!==null&&Gi(e.dependencies)?(typeof S=="function"&&(vu(t,n,S,l),X=t.memoizedState),(V=Sl||oh(t,n,V,l,F,X,R)||e!==null&&e.dependencies!==null&&Gi(e.dependencies))?(B||typeof u.UNSAFE_componentWillUpdate!="function"&&typeof u.componentWillUpdate!="function"||(typeof u.componentWillUpdate=="function"&&u.componentWillUpdate(l,X,R),typeof u.UNSAFE_componentWillUpdate=="function"&&u.UNSAFE_componentWillUpdate(l,X,R)),typeof u.componentDidUpdate=="function"&&(t.flags|=4),typeof u.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&F===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&F===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=X),u.props=l,u.state=X,u.context=R,l=V):(typeof u.componentDidUpdate!="function"||g===e.memoizedProps&&F===e.memoizedState||(t.flags|=4),typeof u.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&F===e.memoizedState||(t.flags|=1024),l=!1)}return u=l,rr(e,t),l=(t.flags&128)!==0,u||l?(u=t.stateNode,n=l&&typeof n.getDerivedStateFromError!="function"?null:u.render(),t.flags|=1,e!==null&&l?(t.child=ea(t,e.child,null,r),t.child=ea(t,null,n,r)):Lt(e,t,n,r),t.memoizedState=u.state,e=t.child):e=al(e,t,r),e}function wh(e,t,n,l){return Vl(),t.flags|=256,Lt(e,t,n,l),t.child}var Au={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function _u(e){return{baseLanes:e,cachePool:hd()}}function Ru(e,t,n){return e=e!==null?e.childLanes&~n:0,t&&(e|=sn),e}function Ah(e,t,n){var l=t.pendingProps,r=!1,u=(t.flags&128)!==0,g;if((g=u)||(g=e!==null&&e.memoizedState===null?!1:(pt.current&2)!==0),g&&(r=!0,t.flags&=-129),g=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ge){if(r?Al(t):_l(),(e=st)?(e=Dm(e,xn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:bl!==null?{id:Ln,overflow:zn}:null,retryLane:536870912,hydrationErrors:null},n=ad(e),n.return=t,t.child=n,Dt=t,st=null)):e=null,e===null)throw vl(t);return uc(e)?t.lanes=32:t.lanes=536870912,null}var S=l.children;return l=l.fallback,r?(_l(),r=t.mode,S=or({mode:"hidden",children:S},r),l=Zl(l,r,n,null),S.return=t,l.return=t,S.sibling=l,t.child=S,l=t.child,l.memoizedState=_u(n),l.childLanes=Ru(e,g,n),t.memoizedState=Au,Ls(null,l)):(Al(t),Cu(t,S))}var R=e.memoizedState;if(R!==null&&(S=R.dehydrated,S!==null)){if(u)t.flags&256?(Al(t),t.flags&=-257,t=ku(e,t,n)):t.memoizedState!==null?(_l(),t.child=e.child,t.flags|=128,t=null):(_l(),S=l.fallback,r=t.mode,l=or({mode:"visible",children:l.children},r),S=Zl(S,r,n,null),S.flags|=2,l.return=t,S.return=t,l.sibling=S,t.child=l,ea(t,e.child,null,n),l=t.child,l.memoizedState=_u(n),l.childLanes=Ru(e,g,n),t.memoizedState=Au,t=Ls(null,l));else if(Al(t),uc(S)){if(g=S.nextSibling&&S.nextSibling.dataset,g)var B=g.dgst;g=B,l=Error(i(419)),l.stack="",l.digest=g,Es({value:l,source:null,stack:null}),t=ku(e,t,n)}else if(St||Aa(e,t,n,!1),g=(n&e.childLanes)!==0,St||g){if(g=at,g!==null&&(l=Si(g,n),l!==0&&l!==R.retryLane))throw R.retryLane=l,$l(e,l),Wt(g,e,l),Eu;oc(S)||yr(),t=ku(e,t,n)}else oc(S)?(t.flags|=192,t.child=e.child,t=null):(e=R.treeContext,st=Tn(S.nextSibling),Dt=t,Ge=!0,xl=null,xn=!1,e!==null&&rd(t,e),t=Cu(t,l.children),t.flags|=4096);return t}return r?(_l(),S=l.fallback,r=t.mode,R=e.child,B=R.sibling,l=Jn(R,{mode:"hidden",children:l.children}),l.subtreeFlags=R.subtreeFlags&65011712,B!==null?S=Jn(B,S):(S=Zl(S,r,n,null),S.flags|=2),S.return=t,l.return=t,l.sibling=S,t.child=l,Ls(null,l),l=t.child,S=e.child.memoizedState,S===null?S=_u(n):(r=S.cachePool,r!==null?(R=vt._currentValue,r=r.parent!==R?{parent:R,pool:R}:r):r=hd(),S={baseLanes:S.baseLanes|n,cachePool:r}),l.memoizedState=S,l.childLanes=Ru(e,g,n),t.memoizedState=Au,Ls(e.child,l)):(Al(t),n=e.child,e=n.sibling,n=Jn(n,{mode:"visible",children:l.children}),n.return=t,n.sibling=null,e!==null&&(g=t.deletions,g===null?(t.deletions=[e],t.flags|=16):g.push(e)),t.child=n,t.memoizedState=null,n)}function Cu(e,t){return t=or({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function or(e,t){return e=tn(22,e,null,t),e.lanes=0,e}function ku(e,t,n){return ea(t,e.child,null,n),e=Cu(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function _h(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),qo(e.return,t,n)}function Nu(e,t,n,l,r,u){var g=e.memoizedState;g===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:r,treeForkCount:u}:(g.isBackwards=t,g.rendering=null,g.renderingStartTime=0,g.last=l,g.tail=n,g.tailMode=r,g.treeForkCount=u)}function Rh(e,t,n){var l=t.pendingProps,r=l.revealOrder,u=l.tail;l=l.children;var g=pt.current,S=(g&2)!==0;if(S?(g=g&1|2,t.flags|=128):g&=1,$(pt,g),Lt(e,t,l,n),l=Ge?Ss:0,!S&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&_h(e,n,t);else if(e.tag===19)_h(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(r){case"forwards":for(n=t.child,r=null;n!==null;)e=n.alternate,e!==null&&Wi(e)===null&&(r=n),n=n.sibling;n=r,n===null?(r=t.child,t.child=null):(r=n.sibling,n.sibling=null),Nu(t,!1,r,n,u,l);break;case"backwards":case"unstable_legacy-backwards":for(n=null,r=t.child,t.child=null;r!==null;){if(e=r.alternate,e!==null&&Wi(e)===null){t.child=r;break}e=r.sibling,r.sibling=n,n=r,r=e}Nu(t,!0,n,null,u,l);break;case"together":Nu(t,!1,null,null,void 0,l);break;default:t.memoizedState=null}return t.child}function al(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),kl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Aa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Jn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Jn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ju(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Gi(e)))}function Ny(e,t,n){switch(t.tag){case 3:ne(t,t.stateNode.containerInfo),Tl(t,vt,e.memoizedState.cache),Vl();break;case 27:case 5:ee(t);break;case 4:ne(t,t.stateNode.containerInfo);break;case 10:Tl(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,nu(t),null;break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(Al(t),t.flags|=128,null):(n&t.child.childLanes)!==0?Ah(e,t,n):(Al(t),e=al(e,t,n),e!==null?e.sibling:null);Al(t);break;case 19:var r=(e.flags&128)!==0;if(l=(n&t.childLanes)!==0,l||(Aa(e,t,n,!1),l=(n&t.childLanes)!==0),r){if(l)return Rh(e,t,n);t.flags|=128}if(r=t.memoizedState,r!==null&&(r.rendering=null,r.tail=null,r.lastEffect=null),$(pt,pt.current),l)break;return null;case 22:return t.lanes=0,xh(e,t,n,t.pendingProps);case 24:Tl(t,vt,e.memoizedState.cache)}return al(e,t,n)}function Ch(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)St=!0;else{if(!ju(e,n)&&(t.flags&128)===0)return St=!1,Ny(e,t,n);St=(e.flags&131072)!==0}else St=!1,Ge&&(t.flags&1048576)!==0&&id(t,Ss,t.index);switch(t.lanes=0,t.tag){case 16:e:{var l=t.pendingProps;if(e=Jl(t.elementType),t.type=e,typeof e=="function")zo(e)?(l=na(e,l),t.tag=1,t=Eh(null,t,e,l,n)):(t.tag=0,t=wu(null,t,e,l,n));else{if(e!=null){var r=e.$$typeof;if(r===C){t.tag=11,t=gh(null,t,e,l,n);break e}else if(r===Q){t.tag=14,t=yh(null,t,e,l,n);break e}}throw t=se(e)||e,Error(i(306,t,""))}}return t;case 0:return wu(e,t,t.type,t.pendingProps,n);case 1:return l=t.type,r=na(l,t.pendingProps),Eh(e,t,l,r,n);case 3:e:{if(ne(t,t.stateNode.containerInfo),e===null)throw Error(i(387));l=t.pendingProps;var u=t.memoizedState;r=u.element,Ko(e,t),Ns(t,l,null,n);var g=t.memoizedState;if(l=g.cache,Tl(t,vt,l),l!==u.cache&&Xo(t,[vt],n,!0),ks(),l=g.element,u.isDehydrated)if(u={element:l,isDehydrated:!1,cache:g.cache},t.updateQueue.baseState=u,t.memoizedState=u,t.flags&256){t=wh(e,t,l,n);break e}else if(l!==r){r=gn(Error(i(424)),t),Es(r),t=wh(e,t,l,n);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(st=Tn(e.firstChild),Dt=t,Ge=!0,xl=null,xn=!0,n=xd(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Vl(),l===r){t=al(e,t,n);break e}Lt(e,t,l,n)}t=t.child}return t;case 26:return rr(e,t),e===null?(n=Hm(t.type,null,t.pendingProps,null))?t.memoizedState=n:Ge||(n=t.type,e=t.pendingProps,l=wr(M.current).createElement(n),l[xt]=t,l[ot]=e,zt(l,n,e),ze(l),t.stateNode=l):t.memoizedState=Hm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ee(t),e===null&&Ge&&(l=t.stateNode=zm(t.type,t.pendingProps,M.current),Dt=t,xn=!0,r=st,Ml(t.type)?(cc=r,st=Tn(l.firstChild)):st=r),Lt(e,t,t.pendingProps.children,n),rr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ge&&((r=l=st)&&(l=ib(l,t.type,t.pendingProps,xn),l!==null?(t.stateNode=l,Dt=t,st=Tn(l.firstChild),xn=!1,r=!0):r=!1),r||vl(t)),ee(t),r=t.type,u=t.pendingProps,g=e!==null?e.memoizedProps:null,l=u.children,sc(r,u)?l=null:g!==null&&sc(r,g)&&(t.flags|=32),t.memoizedState!==null&&(r=au(e,t,Ty,null,null,n),Ws._currentValue=r),rr(e,t),Lt(e,t,l,n),t.child;case 6:return e===null&&Ge&&((e=n=st)&&(n=rb(n,t.pendingProps,xn),n!==null?(t.stateNode=n,Dt=t,st=null,e=!0):e=!1),e||vl(t)),null;case 13:return Ah(e,t,n);case 4:return ne(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=ea(t,null,l,n):Lt(e,t,l,n),t.child;case 11:return gh(e,t,t.type,t.pendingProps,n);case 7:return Lt(e,t,t.pendingProps,n),t.child;case 8:return Lt(e,t,t.pendingProps.children,n),t.child;case 12:return Lt(e,t,t.pendingProps.children,n),t.child;case 10:return l=t.pendingProps,Tl(t,t.type,l.value),Lt(e,t,l.children,n),t.child;case 9:return r=t.type._context,l=t.pendingProps.children,Wl(t),r=Mt(r),l=l(r),t.flags|=1,Lt(e,t,l,n),t.child;case 14:return yh(e,t,t.type,t.pendingProps,n);case 15:return bh(e,t,t.type,t.pendingProps,n);case 19:return Rh(e,t,n);case 31:return ky(e,t,n);case 22:return xh(e,t,n,t.pendingProps);case 24:return Wl(t),l=Mt(vt),e===null?(r=Vo(),r===null&&(r=at,u=$o(),r.pooledCache=u,u.refCount++,u!==null&&(r.pooledCacheLanes|=n),r=u),t.memoizedState={parent:l,cache:r},Wo(t),Tl(t,vt,r)):((e.lanes&n)!==0&&(Ko(e,t),Ns(t,null,null,n),ks()),r=e.memoizedState,u=t.memoizedState,r.parent!==l?(r={parent:l,cache:l},t.memoizedState=r,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=r),Tl(t,vt,l)):(l=u.cache,Tl(t,vt,l),l!==r.cache&&Xo(t,[vt],n,!0))),Lt(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function sl(e){e.flags|=4}function Ou(e,t,n,l,r){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(r&335544128)===r)if(e.stateNode.complete)e.flags|=8192;else if(tm())e.flags|=8192;else throw Pl=$i,Qo}else e.flags&=-16777217}function kh(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!qm(t))if(tm())e.flags|=8192;else throw Pl=$i,Qo}function ur(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Zn():536870912,e.lanes|=t,Ua|=t)}function zs(e,t){if(!Ge)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function it(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var r=e.child;r!==null;)n|=r.lanes|r.childLanes,l|=r.subtreeFlags&65011712,l|=r.flags&65011712,r.return=e,r=r.sibling;else for(r=e.child;r!==null;)n|=r.lanes|r.childLanes,l|=r.subtreeFlags,l|=r.flags,r.return=e,r=r.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function jy(e,t,n){var l=t.pendingProps;switch(Io(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return it(t),null;case 1:return it(t),null;case 3:return n=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),tl(vt),K(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(wa(t)?sl(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Go())),it(t),null;case 26:var r=t.type,u=t.memoizedState;return e===null?(sl(t),u!==null?(it(t),kh(t,u)):(it(t),Ou(t,r,null,l,n))):u?u!==e.memoizedState?(sl(t),it(t),kh(t,u)):(it(t),t.flags&=-16777217):(e=e.memoizedProps,e!==l&&sl(t),it(t),Ou(t,r,e,l,n)),null;case 27:if(ve(t),n=M.current,r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&sl(t);else{if(!l){if(t.stateNode===null)throw Error(i(166));return it(t),null}e=Y.current,wa(t)?od(t):(e=zm(r,l,n),t.stateNode=e,sl(t))}return it(t),null;case 5:if(ve(t),r=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&sl(t);else{if(!l){if(t.stateNode===null)throw Error(i(166));return it(t),null}if(u=Y.current,wa(t))od(t);else{var g=wr(M.current);switch(u){case 1:u=g.createElementNS("http://www.w3.org/2000/svg",r);break;case 2:u=g.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;default:switch(r){case"svg":u=g.createElementNS("http://www.w3.org/2000/svg",r);break;case"math":u=g.createElementNS("http://www.w3.org/1998/Math/MathML",r);break;case"script":u=g.createElement("div"),u.innerHTML="<script><\/script>",u=u.removeChild(u.firstChild);break;case"select":u=typeof l.is=="string"?g.createElement("select",{is:l.is}):g.createElement("select"),l.multiple?u.multiple=!0:l.size&&(u.size=l.size);break;default:u=typeof l.is=="string"?g.createElement(r,{is:l.is}):g.createElement(r)}}u[xt]=t,u[ot]=l;e:for(g=t.child;g!==null;){if(g.tag===5||g.tag===6)u.appendChild(g.stateNode);else if(g.tag!==4&&g.tag!==27&&g.child!==null){g.child.return=g,g=g.child;continue}if(g===t)break e;for(;g.sibling===null;){if(g.return===null||g.return===t)break e;g=g.return}g.sibling.return=g.return,g=g.sibling}t.stateNode=u;e:switch(zt(u,r,l),r){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&sl(t)}}return it(t),Ou(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&sl(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(i(166));if(e=M.current,wa(t)){if(e=t.stateNode,n=t.memoizedProps,l=null,r=Dt,r!==null)switch(r.tag){case 27:case 5:l=r.memoizedProps}e[xt]=t,e=!!(e.nodeValue===n||l!==null&&l.suppressHydrationWarning===!0||Am(e.nodeValue,n)),e||vl(t,!0)}else e=wr(e).createTextNode(l),e[xt]=t,t.stateNode=e}return it(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(l=wa(t),n!==null){if(e===null){if(!l)throw Error(i(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(557));e[xt]=t}else Vl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;it(t),e=!1}else n=Go(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(ln(t),t):(ln(t),null);if((t.flags&128)!==0)throw Error(i(558))}return it(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(r=wa(t),l!==null&&l.dehydrated!==null){if(e===null){if(!r)throw Error(i(318));if(r=t.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(317));r[xt]=t}else Vl(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;it(t),r=!1}else r=Go(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),r=!0;if(!r)return t.flags&256?(ln(t),t):(ln(t),null)}return ln(t),(t.flags&128)!==0?(t.lanes=n,t):(n=l!==null,e=e!==null&&e.memoizedState!==null,n&&(l=t.child,r=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(r=l.alternate.memoizedState.cachePool.pool),u=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(u=l.memoizedState.cachePool.pool),u!==r&&(l.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ur(t,t.updateQueue),it(t),null);case 4:return K(),e===null&&ec(t.stateNode.containerInfo),it(t),null;case 10:return tl(t.type),it(t),null;case 19:if(q(pt),l=t.memoizedState,l===null)return it(t),null;if(r=(t.flags&128)!==0,u=l.rendering,u===null)if(r)zs(l,!1);else{if(ht!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(u=Wi(e),u!==null){for(t.flags|=128,zs(l,!1),e=u.updateQueue,t.updateQueue=e,ur(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ld(n,e),n=n.sibling;return $(pt,pt.current&1|2),Ge&&Pn(t,l.treeForkCount),t.child}e=e.sibling}l.tail!==null&&jt()>mr&&(t.flags|=128,r=!0,zs(l,!1),t.lanes=4194304)}else{if(!r)if(e=Wi(u),e!==null){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,ur(t,e),zs(l,!0),l.tail===null&&l.tailMode==="hidden"&&!u.alternate&&!Ge)return it(t),null}else 2*jt()-l.renderingStartTime>mr&&n!==536870912&&(t.flags|=128,r=!0,zs(l,!1),t.lanes=4194304);l.isBackwards?(u.sibling=t.child,t.child=u):(e=l.last,e!==null?e.sibling=u:t.child=u,l.last=u)}return l.tail!==null?(e=l.tail,l.rendering=e,l.tail=e.sibling,l.renderingStartTime=jt(),e.sibling=null,n=pt.current,$(pt,r?n&1|2:n&1),Ge&&Pn(t,l.treeForkCount),e):(it(t),null);case 22:case 23:return ln(t),tu(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(n&536870912)!==0&&(t.flags&128)===0&&(it(t),t.subtreeFlags&6&&(t.flags|=8192)):it(t),n=t.updateQueue,n!==null&&ur(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==n&&(t.flags|=2048),e!==null&&q(Kl),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),tl(vt),it(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function Oy(e,t){switch(Io(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return tl(vt),K(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return ve(t),null;case 31:if(t.memoizedState!==null){if(ln(t),t.alternate===null)throw Error(i(340));Vl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(ln(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Vl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return q(pt),null;case 4:return K(),null;case 10:return tl(t.type),null;case 22:case 23:return ln(t),tu(),e!==null&&q(Kl),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return tl(vt),null;case 25:return null;default:return null}}function Nh(e,t){switch(Io(t),t.tag){case 3:tl(vt),K();break;case 26:case 27:case 5:ve(t);break;case 4:K();break;case 31:t.memoizedState!==null&&ln(t);break;case 13:ln(t);break;case 19:q(pt);break;case 10:tl(t.type);break;case 22:case 23:ln(t),tu(),e!==null&&q(Kl);break;case 24:tl(vt)}}function Us(e,t){try{var n=t.updateQueue,l=n!==null?n.lastEffect:null;if(l!==null){var r=l.next;n=r;do{if((n.tag&e)===e){l=void 0;var u=n.create,g=n.inst;l=u(),g.destroy=l}n=n.next}while(n!==r)}}catch(S){Je(t,t.return,S)}}function Rl(e,t,n){try{var l=t.updateQueue,r=l!==null?l.lastEffect:null;if(r!==null){var u=r.next;l=u;do{if((l.tag&e)===e){var g=l.inst,S=g.destroy;if(S!==void 0){g.destroy=void 0,r=t;var R=n,B=S;try{B()}catch(V){Je(r,R,V)}}}l=l.next}while(l!==u)}}catch(V){Je(t,t.return,V)}}function jh(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Td(t,n)}catch(l){Je(e,e.return,l)}}}function Oh(e,t,n){n.props=na(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(l){Je(e,t,l)}}function Bs(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof n=="function"?e.refCleanup=n(l):n.current=l}}catch(r){Je(e,t,r)}}function Un(e,t){var n=e.ref,l=e.refCleanup;if(n!==null)if(typeof l=="function")try{l()}catch(r){Je(e,t,r)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(r){Je(e,t,r)}else n.current=null}function Dh(e){var t=e.type,n=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&l.focus();break e;case"img":n.src?l.src=n.src:n.srcSet&&(l.srcset=n.srcSet)}}catch(r){Je(e,e.return,r)}}function Du(e,t,n){try{var l=e.stateNode;eb(l,e.type,n,t),l[ot]=t}catch(r){Je(e,e.return,r)}}function Mh(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ml(e.type)||e.tag===4}function Mu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Mh(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ml(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Lu(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wn));else if(l!==4&&(l===27&&Ml(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Lu(e,t,n),e=e.sibling;e!==null;)Lu(e,t,n),e=e.sibling}function cr(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(l===27&&Ml(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(cr(e,t,n),e=e.sibling;e!==null;)cr(e,t,n),e=e.sibling}function Lh(e){var t=e.stateNode,n=e.memoizedProps;try{for(var l=e.type,r=t.attributes;r.length;)t.removeAttributeNode(r[0]);zt(t,l,n),t[xt]=e,t[ot]=n}catch(u){Je(e,e.return,u)}}var il=!1,Et=!1,zu=!1,zh=typeof WeakSet=="function"?WeakSet:Set,kt=null;function Dy(e,t){if(e=e.containerInfo,lc=jr,e=Vf(e),ko(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var r=l.anchorOffset,u=l.focusNode;l=l.focusOffset;try{n.nodeType,u.nodeType}catch{n=null;break e}var g=0,S=-1,R=-1,B=0,V=0,te=e,F=null;t:for(;;){for(var X;te!==n||r!==0&&te.nodeType!==3||(S=g+r),te!==u||l!==0&&te.nodeType!==3||(R=g+l),te.nodeType===3&&(g+=te.nodeValue.length),(X=te.firstChild)!==null;)F=te,te=X;for(;;){if(te===e)break t;if(F===n&&++B===r&&(S=g),F===u&&++V===l&&(R=g),(X=te.nextSibling)!==null)break;te=F,F=te.parentNode}te=X}n=S===-1||R===-1?null:{start:S,end:R}}else n=null}n=n||{start:0,end:0}}else n=null;for(ac={focusedElem:e,selectionRange:n},jr=!1,kt=t;kt!==null;)if(t=kt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,kt=e;else for(;kt!==null;){switch(t=kt,u=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n<e.length;n++)r=e[n],r.ref.impl=r.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&u!==null){e=void 0,n=t,r=u.memoizedProps,u=u.memoizedState,l=n.stateNode;try{var pe=na(n.type,r);e=l.getSnapshotBeforeUpdate(pe,u),l.__reactInternalSnapshotBeforeUpdate=e}catch(Re){Je(n,n.return,Re)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)rc(e);else if(n===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":rc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,kt=e;break}kt=t.return}}function Uh(e,t,n){var l=n.flags;switch(n.tag){case 0:case 11:case 15:ol(e,n),l&4&&Us(5,n);break;case 1:if(ol(e,n),l&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(g){Je(n,n.return,g)}else{var r=na(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(r,t,e.__reactInternalSnapshotBeforeUpdate)}catch(g){Je(n,n.return,g)}}l&64&&jh(n),l&512&&Bs(n,n.return);break;case 3:if(ol(e,n),l&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Td(e,t)}catch(g){Je(n,n.return,g)}}break;case 27:t===null&&l&4&&Lh(n);case 26:case 5:ol(e,n),t===null&&l&4&&Dh(n),l&512&&Bs(n,n.return);break;case 12:ol(e,n);break;case 31:ol(e,n),l&4&&Ih(e,n);break;case 13:ol(e,n),l&4&&Fh(e,n),l&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Gy.bind(null,n),ob(e,n))));break;case 22:if(l=n.memoizedState!==null||il,!l){t=t!==null&&t.memoizedState!==null||Et,r=il;var u=Et;il=l,(Et=t)&&!u?ul(e,n,(n.subtreeFlags&8772)!==0):ol(e,n),il=r,Et=u}break;case 30:break;default:ol(e,n)}}function Bh(e){var t=e.alternate;t!==null&&(e.alternate=null,Bh(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&k(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ut=null,$t=!1;function rl(e,t,n){for(n=n.child;n!==null;)Hh(e,t,n),n=n.sibling}function Hh(e,t,n){if(Rt&&typeof Rt.onCommitFiberUnmount=="function")try{Rt.onCommitFiberUnmount(Dn,n)}catch{}switch(n.tag){case 26:Et||Un(n,t),rl(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Et||Un(n,t);var l=ut,r=$t;Ml(n.type)&&(ut=n.stateNode,$t=!1),rl(e,t,n),Zs(n.stateNode),ut=l,$t=r;break;case 5:Et||Un(n,t);case 6:if(l=ut,r=$t,ut=null,rl(e,t,n),ut=l,$t=r,ut!==null)if($t)try{(ut.nodeType===9?ut.body:ut.nodeName==="HTML"?ut.ownerDocument.body:ut).removeChild(n.stateNode)}catch(u){Je(n,t,u)}else try{ut.removeChild(n.stateNode)}catch(u){Je(n,t,u)}break;case 18:ut!==null&&($t?(e=ut,jm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,n.stateNode),Xa(e)):jm(ut,n.stateNode));break;case 4:l=ut,r=$t,ut=n.stateNode.containerInfo,$t=!0,rl(e,t,n),ut=l,$t=r;break;case 0:case 11:case 14:case 15:Rl(2,n,t),Et||Rl(4,n,t),rl(e,t,n);break;case 1:Et||(Un(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"&&Oh(n,t,l)),rl(e,t,n);break;case 21:rl(e,t,n);break;case 22:Et=(l=Et)||n.memoizedState!==null,rl(e,t,n),Et=l;break;default:rl(e,t,n)}}function Ih(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Xa(e)}catch(n){Je(t,t.return,n)}}}function Fh(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Xa(e)}catch(n){Je(t,t.return,n)}}function My(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new zh),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new zh),t;default:throw Error(i(435,e.tag))}}function fr(e,t){var n=My(e);t.forEach(function(l){if(!n.has(l)){n.add(l);var r=Yy.bind(null,e,l);l.then(r,r)}})}function Zt(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var r=n[l],u=e,g=t,S=g;e:for(;S!==null;){switch(S.tag){case 27:if(Ml(S.type)){ut=S.stateNode,$t=!1;break e}break;case 5:ut=S.stateNode,$t=!1;break e;case 3:case 4:ut=S.stateNode.containerInfo,$t=!0;break e}S=S.return}if(ut===null)throw Error(i(160));Hh(u,g,r),ut=null,$t=!1,u=r.alternate,u!==null&&(u.return=null),r.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Gh(t,e),t=t.sibling}var Rn=null;function Gh(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Zt(t,e),Vt(e),l&4&&(Rl(3,e,e.return),Us(3,e),Rl(5,e,e.return));break;case 1:Zt(t,e),Vt(e),l&512&&(Et||n===null||Un(n,n.return)),l&64&&il&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?l:n.concat(l))));break;case 26:var r=Rn;if(Zt(t,e),Vt(e),l&512&&(Et||n===null||Un(n,n.return)),l&4){var u=n!==null?n.memoizedState:null;if(l=e.memoizedState,n===null)if(l===null)if(e.stateNode===null){e:{l=e.type,n=e.memoizedProps,r=r.ownerDocument||r;t:switch(l){case"title":u=r.getElementsByTagName("title")[0],(!u||u[ye]||u[xt]||u.namespaceURI==="http://www.w3.org/2000/svg"||u.hasAttribute("itemprop"))&&(u=r.createElement(l),r.head.insertBefore(u,r.querySelector("head > title"))),zt(u,l,n),u[xt]=e,ze(u),l=u;break e;case"link":var g=Gm("link","href",r).get(l+(n.href||""));if(g){for(var S=0;S<g.length;S++)if(u=g[S],u.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&u.getAttribute("rel")===(n.rel==null?null:n.rel)&&u.getAttribute("title")===(n.title==null?null:n.title)&&u.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){g.splice(S,1);break t}}u=r.createElement(l),zt(u,l,n),r.head.appendChild(u);break;case"meta":if(g=Gm("meta","content",r).get(l+(n.content||""))){for(S=0;S<g.length;S++)if(u=g[S],u.getAttribute("content")===(n.content==null?null:""+n.content)&&u.getAttribute("name")===(n.name==null?null:n.name)&&u.getAttribute("property")===(n.property==null?null:n.property)&&u.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&u.getAttribute("charset")===(n.charSet==null?null:n.charSet)){g.splice(S,1);break t}}u=r.createElement(l),zt(u,l,n),r.head.appendChild(u);break;default:throw Error(i(468,l))}u[xt]=e,ze(u),l=u}e.stateNode=l}else Ym(r,e.type,e.stateNode);else e.stateNode=Fm(r,l,e.memoizedProps);else u!==l?(u===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):u.count--,l===null?Ym(r,e.type,e.stateNode):Fm(r,l,e.memoizedProps)):l===null&&e.stateNode!==null&&Du(e,e.memoizedProps,n.memoizedProps)}break;case 27:Zt(t,e),Vt(e),l&512&&(Et||n===null||Un(n,n.return)),n!==null&&l&4&&Du(e,e.memoizedProps,n.memoizedProps);break;case 5:if(Zt(t,e),Vt(e),l&512&&(Et||n===null||Un(n,n.return)),e.flags&32){r=e.stateNode;try{ma(r,"")}catch(pe){Je(e,e.return,pe)}}l&4&&e.stateNode!=null&&(r=e.memoizedProps,Du(e,r,n!==null?n.memoizedProps:r)),l&1024&&(zu=!0);break;case 6:if(Zt(t,e),Vt(e),l&4){if(e.stateNode===null)throw Error(i(162));l=e.memoizedProps,n=e.stateNode;try{n.nodeValue=l}catch(pe){Je(e,e.return,pe)}}break;case 3:if(Rr=null,r=Rn,Rn=Ar(t.containerInfo),Zt(t,e),Rn=r,Vt(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Xa(t.containerInfo)}catch(pe){Je(e,e.return,pe)}zu&&(zu=!1,Yh(e));break;case 4:l=Rn,Rn=Ar(e.stateNode.containerInfo),Zt(t,e),Vt(e),Rn=l;break;case 12:Zt(t,e),Vt(e);break;case 31:Zt(t,e),Vt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,fr(e,l)));break;case 13:Zt(t,e),Vt(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(hr=jt()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,fr(e,l)));break;case 22:r=e.memoizedState!==null;var R=n!==null&&n.memoizedState!==null,B=il,V=Et;if(il=B||r,Et=V||R,Zt(t,e),Et=V,il=B,Vt(e),l&8192)e:for(t=e.stateNode,t._visibility=r?t._visibility&-2:t._visibility|1,r&&(n===null||R||il||Et||la(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){R=n=t;try{if(u=R.stateNode,r)g=u.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none";else{S=R.stateNode;var te=R.memoizedProps.style,F=te!=null&&te.hasOwnProperty("display")?te.display:null;S.style.display=F==null||typeof F=="boolean"?"":(""+F).trim()}}catch(pe){Je(R,R.return,pe)}}}else if(t.tag===6){if(n===null){R=t;try{R.stateNode.nodeValue=r?"":R.memoizedProps}catch(pe){Je(R,R.return,pe)}}}else if(t.tag===18){if(n===null){R=t;try{var X=R.stateNode;r?Om(X,!0):Om(R.stateNode,!1)}catch(pe){Je(R,R.return,pe)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(n=l.retryQueue,n!==null&&(l.retryQueue=null,fr(e,n))));break;case 19:Zt(t,e),Vt(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,fr(e,l)));break;case 30:break;case 21:break;default:Zt(t,e),Vt(e)}}function Vt(e){var t=e.flags;if(t&2){try{for(var n,l=e.return;l!==null;){if(Mh(l)){n=l;break}l=l.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var r=n.stateNode,u=Mu(e);cr(e,u,r);break;case 5:var g=n.stateNode;n.flags&32&&(ma(g,""),n.flags&=-33);var S=Mu(e);cr(e,S,g);break;case 3:case 4:var R=n.stateNode.containerInfo,B=Mu(e);Lu(e,B,R);break;default:throw Error(i(161))}}catch(V){Je(e,e.return,V)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Yh(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Yh(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ol(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Uh(e,t.alternate,t),t=t.sibling}function la(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rl(4,t,t.return),la(t);break;case 1:Un(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount=="function"&&Oh(t,t.return,n),la(t);break;case 27:Zs(t.stateNode);case 26:case 5:Un(t,t.return),la(t);break;case 22:t.memoizedState===null&&la(t);break;case 30:la(t);break;default:la(t)}e=e.sibling}}function ul(e,t,n){for(n=n&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,r=e,u=t,g=u.flags;switch(u.tag){case 0:case 11:case 15:ul(r,u,n),Us(4,u);break;case 1:if(ul(r,u,n),l=u,r=l.stateNode,typeof r.componentDidMount=="function")try{r.componentDidMount()}catch(B){Je(l,l.return,B)}if(l=u,r=l.updateQueue,r!==null){var S=l.stateNode;try{var R=r.shared.hiddenCallbacks;if(R!==null)for(r.shared.hiddenCallbacks=null,r=0;r<R.length;r++)vd(R[r],S)}catch(B){Je(l,l.return,B)}}n&&g&64&&jh(u),Bs(u,u.return);break;case 27:Lh(u);case 26:case 5:ul(r,u,n),n&&l===null&&g&4&&Dh(u),Bs(u,u.return);break;case 12:ul(r,u,n);break;case 31:ul(r,u,n),n&&g&4&&Ih(r,u);break;case 13:ul(r,u,n),n&&g&4&&Fh(r,u);break;case 22:u.memoizedState===null&&ul(r,u,n),Bs(u,u.return);break;case 30:break;default:ul(r,u,n)}t=t.sibling}}function Uu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&ws(n))}function Bu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ws(e))}function Cn(e,t,n,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)qh(e,t,n,l),t=t.sibling}function qh(e,t,n,l){var r=t.flags;switch(t.tag){case 0:case 11:case 15:Cn(e,t,n,l),r&2048&&Us(9,t);break;case 1:Cn(e,t,n,l);break;case 3:Cn(e,t,n,l),r&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ws(e)));break;case 12:if(r&2048){Cn(e,t,n,l),e=t.stateNode;try{var u=t.memoizedProps,g=u.id,S=u.onPostCommit;typeof S=="function"&&S(g,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(R){Je(t,t.return,R)}}else Cn(e,t,n,l);break;case 31:Cn(e,t,n,l);break;case 13:Cn(e,t,n,l);break;case 23:break;case 22:u=t.stateNode,g=t.alternate,t.memoizedState!==null?u._visibility&2?Cn(e,t,n,l):Hs(e,t):u._visibility&2?Cn(e,t,n,l):(u._visibility|=2,Ma(e,t,n,l,(t.subtreeFlags&10256)!==0||!1)),r&2048&&Uu(g,t);break;case 24:Cn(e,t,n,l),r&2048&&Bu(t.alternate,t);break;default:Cn(e,t,n,l)}}function Ma(e,t,n,l,r){for(r=r&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var u=e,g=t,S=n,R=l,B=g.flags;switch(g.tag){case 0:case 11:case 15:Ma(u,g,S,R,r),Us(8,g);break;case 23:break;case 22:var V=g.stateNode;g.memoizedState!==null?V._visibility&2?Ma(u,g,S,R,r):Hs(u,g):(V._visibility|=2,Ma(u,g,S,R,r)),r&&B&2048&&Uu(g.alternate,g);break;case 24:Ma(u,g,S,R,r),r&&B&2048&&Bu(g.alternate,g);break;default:Ma(u,g,S,R,r)}t=t.sibling}}function Hs(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,l=t,r=l.flags;switch(l.tag){case 22:Hs(n,l),r&2048&&Uu(l.alternate,l);break;case 24:Hs(n,l),r&2048&&Bu(l.alternate,l);break;default:Hs(n,l)}t=t.sibling}}var Is=8192;function La(e,t,n){if(e.subtreeFlags&Is)for(e=e.child;e!==null;)Xh(e,t,n),e=e.sibling}function Xh(e,t,n){switch(e.tag){case 26:La(e,t,n),e.flags&Is&&e.memoizedState!==null&&vb(n,Rn,e.memoizedState,e.memoizedProps);break;case 5:La(e,t,n);break;case 3:case 4:var l=Rn;Rn=Ar(e.stateNode.containerInfo),La(e,t,n),Rn=l;break;case 22:e.memoizedState===null&&(l=e.alternate,l!==null&&l.memoizedState!==null?(l=Is,Is=16777216,La(e,t,n),Is=l):La(e,t,n));break;default:La(e,t,n)}}function $h(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Fs(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];kt=l,Vh(l,e)}$h(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Zh(e),e=e.sibling}function Zh(e){switch(e.tag){case 0:case 11:case 15:Fs(e),e.flags&2048&&Rl(9,e,e.return);break;case 3:Fs(e);break;case 12:Fs(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,dr(e)):Fs(e);break;default:Fs(e)}}function dr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var n=0;n<t.length;n++){var l=t[n];kt=l,Vh(l,e)}$h(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rl(8,t,t.return),dr(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,dr(t));break;default:dr(t)}e=e.sibling}}function Vh(e,t){for(;kt!==null;){var n=kt;switch(n.tag){case 0:case 11:case 15:Rl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var l=n.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ws(n.memoizedState.cache)}if(l=n.child,l!==null)l.return=n,kt=l;else e:for(n=e;kt!==null;){l=kt;var r=l.sibling,u=l.return;if(Bh(l),l===n){kt=null;break e}if(r!==null){r.return=u,kt=r;break e}kt=u}}}var Ly={getCacheForType:function(e){var t=Mt(vt),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Mt(vt).controller.signal}},zy=typeof WeakMap=="function"?WeakMap:Map,Ve=0,at=null,Be=null,Ie=0,Ke=0,an=null,Cl=!1,za=!1,Hu=!1,cl=0,ht=0,kl=0,aa=0,Iu=0,sn=0,Ua=0,Gs=null,Qt=null,Fu=!1,hr=0,Qh=0,mr=1/0,pr=null,Nl=null,At=0,jl=null,Ba=null,fl=0,Gu=0,Yu=null,Wh=null,Ys=0,qu=null;function rn(){return(Ve&2)!==0&&Ie!==0?Ie&-Ie:G.T!==null?Wu():us()}function Kh(){if(sn===0)if((Ie&536870912)===0||Ge){var e=$n;$n<<=1,($n&3932160)===0&&($n=262144),sn=e}else sn=536870912;return e=nn.current,e!==null&&(e.flags|=32),sn}function Wt(e,t,n){(e===at&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(Ha(e,0),Ol(e,Ie,sn,!1)),gl(e,n),((Ve&2)===0||e!==at)&&(e===at&&((Ve&2)===0&&(aa|=n),ht===4&&Ol(e,Ie,sn,!1)),Bn(e))}function Jh(e,t,n){if((Ve&6)!==0)throw Error(i(327));var l=!n&&(t&127)===0&&(t&e.expiredLanes)===0||Gl(e,t),r=l?Hy(e,t):$u(e,t,!0),u=l;do{if(r===0){za&&!l&&Ol(e,t,0,!1);break}else{if(n=e.current.alternate,u&&!Uy(n)){r=$u(e,t,!1),u=!1;continue}if(r===2){if(u=t,e.errorRecoveryDisabledLanes&u)var g=0;else g=e.pendingLanes&-536870913,g=g!==0?g:g&536870912?536870912:0;if(g!==0){t=g;e:{var S=e;r=Gs;var R=S.current.memoizedState.isDehydrated;if(R&&(Ha(S,g).flags|=256),g=$u(S,g,!1),g!==2){if(Hu&&!R){S.errorRecoveryDisabledLanes|=u,aa|=u,r=4;break e}u=Qt,Qt=r,u!==null&&(Qt===null?Qt=u:Qt.push.apply(Qt,u))}r=g}if(u=!1,r!==2)continue}}if(r===1){Ha(e,0),Ol(e,t,0,!0);break}e:{switch(l=e,u=r,u){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:Ol(l,t,sn,!Cl);break e;case 2:Qt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(r=hr+300-jt(),10<r)){if(Ol(l,t,sn,!Cl),fa(l,0,!0)!==0)break e;fl=t,l.timeoutHandle=km(Ph.bind(null,l,n,Qt,pr,Fu,t,sn,aa,Ua,Cl,u,"Throttled",-0,0),r);break e}Ph(l,n,Qt,pr,Fu,t,sn,aa,Ua,Cl,u,null,-0,0)}}break}while(!0);Bn(e)}function Ph(e,t,n,l,r,u,g,S,R,B,V,te,F,X){if(e.timeoutHandle=-1,te=t.subtreeFlags,te&8192||(te&16785408)===16785408){te={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Wn},Xh(t,u,te);var pe=(u&62914560)===u?hr-jt():(u&4194048)===u?Qh-jt():0;if(pe=Tb(te,pe),pe!==null){fl=u,e.cancelPendingCommit=pe(rm.bind(null,e,t,u,n,l,r,g,S,R,V,te,null,F,X)),Ol(e,u,g,!B);return}}rm(e,t,u,n,l,r,g,S,R)}function Uy(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var l=0;l<n.length;l++){var r=n[l],u=r.getSnapshot;r=r.value;try{if(!en(u(),r))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Ol(e,t,n,l){t&=~Iu,t&=~aa,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var r=t;0<r;){var u=31-bt(r),g=1<<u;l[u]=-1,r&=~g}n!==0&&rs(e,n,t)}function gr(){return(Ve&6)===0?(qs(0),!1):!0}function Xu(){if(Be!==null){if(Ke===0)var e=Be.return;else e=Be,el=Ql=null,ru(e),ka=null,_s=0,e=Be;for(;e!==null;)Nh(e.alternate,e),e=e.return;Be=null}}function Ha(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,lb(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),fl=0,Xu(),at=e,Be=n=Jn(e.current,null),Ie=t,Ke=0,an=null,Cl=!1,za=Gl(e,t),Hu=!1,Ua=sn=Iu=aa=kl=ht=0,Qt=Gs=null,Fu=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var r=31-bt(l),u=1<<r;t|=e[r],l&=~u}return cl=t,Ui(),n}function em(e,t){Oe=null,G.H=Ms,t===Ca||t===Xi?(t=gd(),Ke=3):t===Qo?(t=gd(),Ke=4):Ke=t===Eu?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,an=t,Be===null&&(ht=1,sr(e,gn(t,e.current)))}function tm(){var e=nn.current;return e===null?!0:(Ie&4194048)===Ie?vn===null:(Ie&62914560)===Ie||(Ie&536870912)!==0?e===vn:!1}function nm(){var e=G.H;return G.H=Ms,e===null?Ms:e}function lm(){var e=G.A;return G.A=Ly,e}function yr(){ht=4,Cl||(Ie&4194048)!==Ie&&nn.current!==null||(za=!0),(kl&134217727)===0&&(aa&134217727)===0||at===null||Ol(at,Ie,sn,!1)}function $u(e,t,n){var l=Ve;Ve|=2;var r=nm(),u=lm();(at!==e||Ie!==t)&&(pr=null,Ha(e,t)),t=!1;var g=ht;e:do try{if(Ke!==0&&Be!==null){var S=Be,R=an;switch(Ke){case 8:Xu(),g=6;break e;case 3:case 2:case 9:case 6:nn.current===null&&(t=!0);var B=Ke;if(Ke=0,an=null,Ia(e,S,R,B),n&&za){g=0;break e}break;default:B=Ke,Ke=0,an=null,Ia(e,S,R,B)}}By(),g=ht;break}catch(V){em(e,V)}while(!0);return t&&e.shellSuspendCounter++,el=Ql=null,Ve=l,G.H=r,G.A=u,Be===null&&(at=null,Ie=0,Ui()),g}function By(){for(;Be!==null;)am(Be)}function Hy(e,t){var n=Ve;Ve|=2;var l=nm(),r=lm();at!==e||Ie!==t?(pr=null,mr=jt()+500,Ha(e,t)):za=Gl(e,t);e:do try{if(Ke!==0&&Be!==null){t=Be;var u=an;t:switch(Ke){case 1:Ke=0,an=null,Ia(e,t,u,1);break;case 2:case 9:if(md(u)){Ke=0,an=null,sm(t);break}t=function(){Ke!==2&&Ke!==9||at!==e||(Ke=7),Bn(e)},u.then(t,t);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:md(u)?(Ke=0,an=null,sm(t)):(Ke=0,an=null,Ia(e,t,u,7));break;case 5:var g=null;switch(Be.tag){case 26:g=Be.memoizedState;case 5:case 27:var S=Be;if(g?qm(g):S.stateNode.complete){Ke=0,an=null;var R=S.sibling;if(R!==null)Be=R;else{var B=S.return;B!==null?(Be=B,br(B)):Be=null}break t}}Ke=0,an=null,Ia(e,t,u,5);break;case 6:Ke=0,an=null,Ia(e,t,u,6);break;case 8:Xu(),ht=6;break e;default:throw Error(i(462))}}Iy();break}catch(V){em(e,V)}while(!0);return el=Ql=null,G.H=l,G.A=r,Ve=n,Be!==null?0:(at=null,Ie=0,Ui(),ht)}function Iy(){for(;Be!==null&&!xi();)am(Be)}function am(e){var t=Ch(e.alternate,e,cl);e.memoizedProps=e.pendingProps,t===null?br(e):Be=t}function sm(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Sh(n,t,t.pendingProps,t.type,void 0,Ie);break;case 11:t=Sh(n,t,t.pendingProps,t.type.render,t.ref,Ie);break;case 5:ru(t);default:Nh(n,t),t=Be=ld(t,cl),t=Ch(n,t,cl)}e.memoizedProps=e.pendingProps,t===null?br(e):Be=t}function Ia(e,t,n,l){el=Ql=null,ru(t),ka=null,_s=0;var r=t.return;try{if(Cy(e,r,t,n,Ie)){ht=1,sr(e,gn(n,e.current)),Be=null;return}}catch(u){if(r!==null)throw Be=r,u;ht=1,sr(e,gn(n,e.current)),Be=null;return}t.flags&32768?(Ge||l===1?e=!0:za||(Ie&536870912)!==0?e=!1:(Cl=e=!0,(l===2||l===9||l===3||l===6)&&(l=nn.current,l!==null&&l.tag===13&&(l.flags|=16384))),im(t,e)):br(t)}function br(e){var t=e;do{if((t.flags&32768)!==0){im(t,Cl);return}e=t.return;var n=jy(t.alternate,t,cl);if(n!==null){Be=n;return}if(t=t.sibling,t!==null){Be=t;return}Be=t=e}while(t!==null);ht===0&&(ht=5)}function im(e,t){do{var n=Oy(e.alternate,e);if(n!==null){n.flags&=32767,Be=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Be=e;return}Be=e=n}while(e!==null);ht=6,Be=null}function rm(e,t,n,l,r,u,g,S,R){e.cancelPendingCommit=null;do xr();while(At!==0);if((Ve&6)!==0)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(u=t.lanes|t.childLanes,u|=Mo,is(e,n,u,g,S,R),e===at&&(Be=at=null,Ie=0),Ba=t,jl=e,fl=n,Gu=u,Yu=r,Wh=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,qy(pl,function(){return dm(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=G.T,G.T=null,r=le.p,le.p=2,g=Ve,Ve|=4;try{Dy(e,t,n)}finally{Ve=g,le.p=r,G.T=l}}At=1,om(),um(),cm()}}function om(){if(At===1){At=0;var e=jl,t=Ba,n=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||n){n=G.T,G.T=null;var l=le.p;le.p=2;var r=Ve;Ve|=4;try{Gh(t,e);var u=ac,g=Vf(e.containerInfo),S=u.focusedElem,R=u.selectionRange;if(g!==S&&S&&S.ownerDocument&&Zf(S.ownerDocument.documentElement,S)){if(R!==null&&ko(S)){var B=R.start,V=R.end;if(V===void 0&&(V=B),"selectionStart"in S)S.selectionStart=B,S.selectionEnd=Math.min(V,S.value.length);else{var te=S.ownerDocument||document,F=te&&te.defaultView||window;if(F.getSelection){var X=F.getSelection(),pe=S.textContent.length,Re=Math.min(R.start,pe),nt=R.end===void 0?Re:Math.min(R.end,pe);!X.extend&&Re>nt&&(g=nt,nt=Re,Re=g);var z=$f(S,Re),N=$f(S,nt);if(z&&N&&(X.rangeCount!==1||X.anchorNode!==z.node||X.anchorOffset!==z.offset||X.focusNode!==N.node||X.focusOffset!==N.offset)){var U=te.createRange();U.setStart(z.node,z.offset),X.removeAllRanges(),Re>nt?(X.addRange(U),X.extend(N.node,N.offset)):(U.setEnd(N.node,N.offset),X.addRange(U))}}}}for(te=[],X=S;X=X.parentNode;)X.nodeType===1&&te.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof S.focus=="function"&&S.focus(),S=0;S<te.length;S++){var J=te[S];J.element.scrollLeft=J.left,J.element.scrollTop=J.top}}jr=!!lc,ac=lc=null}finally{Ve=r,le.p=l,G.T=n}}e.current=t,At=2}}function um(){if(At===2){At=0;var e=jl,t=Ba,n=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||n){n=G.T,G.T=null;var l=le.p;le.p=2;var r=Ve;Ve|=4;try{Uh(e,t.alternate,t)}finally{Ve=r,le.p=l,G.T=n}}At=3}}function cm(){if(At===4||At===3){At=0,co();var e=jl,t=Ba,n=fl,l=Wh;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?At=5:(At=0,Ba=jl=null,fm(e,e.pendingLanes));var r=e.pendingLanes;if(r===0&&(Nl=null),An(n),t=t.stateNode,Rt&&typeof Rt.onCommitFiberRoot=="function")try{Rt.onCommitFiberRoot(Dn,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=G.T,r=le.p,le.p=2,G.T=null;try{for(var u=e.onRecoverableError,g=0;g<l.length;g++){var S=l[g];u(S.value,{componentStack:S.stack})}}finally{G.T=t,le.p=r}}(fl&3)!==0&&xr(),Bn(e),r=e.pendingLanes,(n&261930)!==0&&(r&42)!==0?e===qu?Ys++:(Ys=0,qu=e):Ys=0,qs(0)}}function fm(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ws(t)))}function xr(){return om(),um(),cm(),dm()}function dm(){if(At!==5)return!1;var e=jl,t=Gu;Gu=0;var n=An(fl),l=G.T,r=le.p;try{le.p=32>n?32:n,G.T=null,n=Yu,Yu=null;var u=jl,g=fl;if(At=0,Ba=jl=null,fl=0,(Ve&6)!==0)throw Error(i(331));var S=Ve;if(Ve|=4,Zh(u.current),qh(u,u.current,g,n),Ve=S,qs(0,!1),Rt&&typeof Rt.onPostCommitFiberRoot=="function")try{Rt.onPostCommitFiberRoot(Dn,u)}catch{}return!0}finally{le.p=r,G.T=l,fm(e,t)}}function hm(e,t,n){t=gn(n,t),t=Su(e.stateNode,t,2),e=wl(e,t,2),e!==null&&(gl(e,2),Bn(e))}function Je(e,t,n){if(e.tag===3)hm(e,e,n);else for(;t!==null;){if(t.tag===3){hm(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Nl===null||!Nl.has(l))){e=gn(n,e),n=mh(2),l=wl(t,n,2),l!==null&&(ph(n,l,t,e),gl(l,2),Bn(l));break}}t=t.return}}function Zu(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new zy;var r=new Set;l.set(t,r)}else r=l.get(t),r===void 0&&(r=new Set,l.set(t,r));r.has(n)||(Hu=!0,r.add(n),e=Fy.bind(null,e,t,n),t.then(e,e))}function Fy(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,at===e&&(Ie&n)===n&&(ht===4||ht===3&&(Ie&62914560)===Ie&&300>jt()-hr?(Ve&2)===0&&Ha(e,0):Iu|=n,Ua===Ie&&(Ua=0)),Bn(e)}function mm(e,t){t===0&&(t=Zn()),e=$l(e,t),e!==null&&(gl(e,t),Bn(e))}function Gy(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),mm(e,n)}function Yy(e,t){var n=0;switch(e.tag){case 31:case 13:var l=e.stateNode,r=e.memoizedState;r!==null&&(n=r.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(t),mm(e,n)}function qy(e,t){return _t(e,t)}var vr=null,Fa=null,Vu=!1,Tr=!1,Qu=!1,Dl=0;function Bn(e){e!==Fa&&e.next===null&&(Fa===null?vr=Fa=e:Fa=Fa.next=e),Tr=!0,Vu||(Vu=!0,$y())}function qs(e,t){if(!Qu&&Tr){Qu=!0;do for(var n=!1,l=vr;l!==null;){if(e!==0){var r=l.pendingLanes;if(r===0)var u=0;else{var g=l.suspendedLanes,S=l.pingedLanes;u=(1<<31-bt(42|e)+1)-1,u&=r&~(g&~S),u=u&201326741?u&201326741|1:u?u|2:0}u!==0&&(n=!0,bm(l,u))}else u=Ie,u=fa(l,l===at?u:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(u&3)===0||Gl(l,u)||(n=!0,bm(l,u));l=l.next}while(n);Qu=!1}}function Xy(){pm()}function pm(){Tr=Vu=!1;var e=0;Dl!==0&&nb()&&(e=Dl);for(var t=jt(),n=null,l=vr;l!==null;){var r=l.next,u=gm(l,t);u===0?(l.next=null,n===null?vr=r:n.next=r,r===null&&(Fa=n)):(n=l,(e!==0||(u&3)!==0)&&(Tr=!0)),l=r}At!==0&&At!==5||qs(e),Dl!==0&&(Dl=0)}function gm(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,r=e.expirationTimes,u=e.pendingLanes&-62914561;0<u;){var g=31-bt(u),S=1<<g,R=r[g];R===-1?((S&n)===0||(S&l)!==0)&&(r[g]=mt(S,t)):R<=t&&(e.expiredLanes|=S),u&=~S}if(t=at,n=Ie,n=fa(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,n===0||e===t&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&cn(l),e.callbackNode=null,e.callbackPriority=0;if((n&3)===0||Gl(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(l!==null&&cn(l),An(n)){case 2:case 8:n=Jt;break;case 32:n=pl;break;case 268435456:n=ts;break;default:n=pl}return l=ym.bind(null,e),n=_t(n,l),e.callbackPriority=t,e.callbackNode=n,t}return l!==null&&l!==null&&cn(l),e.callbackPriority=2,e.callbackNode=null,2}function ym(e,t){if(At!==0&&At!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(xr()&&e.callbackNode!==n)return null;var l=Ie;return l=fa(e,e===at?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(Jh(e,l,t),gm(e,jt()),e.callbackNode!=null&&e.callbackNode===n?ym.bind(null,e):null)}function bm(e,t){if(xr())return null;Jh(e,t,!0)}function $y(){ab(function(){(Ve&6)!==0?_t(qn,Xy):pm()})}function Wu(){if(Dl===0){var e=_a;e===0&&(e=Xn,Xn<<=1,(Xn&261888)===0&&(Xn=256)),Dl=e}return Dl}function xm(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ki(""+e)}function vm(e,t){var n=t.ownerDocument.createElement("input");return n.name=t.name,n.value=t.value,e.id&&n.setAttribute("form",e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function Zy(e,t,n,l,r){if(t==="submit"&&n&&n.stateNode===r){var u=xm((r[ot]||null).action),g=l.submitter;g&&(t=(t=g[ot]||null)?xm(t.formAction):g.getAttribute("formAction"),t!==null&&(u=t,g=null));var S=new Di("action","action",null,l,r);e.push({event:S,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(Dl!==0){var R=g?vm(r,g):new FormData(r);gu(n,{pending:!0,data:R,method:r.method,action:u},null,R)}}else typeof u=="function"&&(S.preventDefault(),R=g?vm(r,g):new FormData(r),gu(n,{pending:!0,data:R,method:r.method,action:u},u,R))},currentTarget:r}]})}}for(var Ku=0;Ku<Do.length;Ku++){var Ju=Do[Ku],Vy=Ju.toLowerCase(),Qy=Ju[0].toUpperCase()+Ju.slice(1);_n(Vy,"on"+Qy)}_n(Kf,"onAnimationEnd"),_n(Jf,"onAnimationIteration"),_n(Pf,"onAnimationStart"),_n("dblclick","onDoubleClick"),_n("focusin","onFocus"),_n("focusout","onBlur"),_n(fy,"onTransitionRun"),_n(dy,"onTransitionStart"),_n(hy,"onTransitionCancel"),_n(ed,"onTransitionEnd"),Mn("onMouseEnter",["mouseout","mouseover"]),Mn("onMouseLeave",["mouseout","mouseover"]),Mn("onPointerEnter",["pointerout","pointerover"]),Mn("onPointerLeave",["pointerout","pointerover"]),qt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),qt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),qt("onBeforeInput",["compositionend","keypress","textInput","paste"]),qt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),qt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),qt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Wy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xs));function Tm(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],r=l.event;l=l.listeners;e:{var u=void 0;if(t)for(var g=l.length-1;0<=g;g--){var S=l[g],R=S.instance,B=S.currentTarget;if(S=S.listener,R!==u&&r.isPropagationStopped())break e;u=S,r.currentTarget=B;try{u(r)}catch(V){zi(V)}r.currentTarget=null,u=R}else for(g=0;g<l.length;g++){if(S=l[g],R=S.instance,B=S.currentTarget,S=S.listener,R!==u&&r.isPropagationStopped())break e;u=S,r.currentTarget=B;try{u(r)}catch(V){zi(V)}r.currentTarget=null,u=R}}}}function He(e,t){var n=t[da];n===void 0&&(n=t[da]=new Set);var l=e+"__bubble";n.has(l)||(Sm(t,e,2,!1),n.add(l))}function Pu(e,t,n){var l=0;t&&(l|=4),Sm(n,e,l,t)}var Sr="_reactListening"+Math.random().toString(36).slice(2);function ec(e){if(!e[Sr]){e[Sr]=!0,Ot.forEach(function(n){n!=="selectionchange"&&(Wy.has(n)||Pu(n,!1,e),Pu(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Sr]||(t[Sr]=!0,Pu("selectionchange",!1,t))}}function Sm(e,t,n,l){switch(Km(t)){case 2:var r=wb;break;case 8:r=Ab;break;default:r=pc}n=r.bind(null,t,n,e),r=void 0,!vo||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(r=!0),l?r!==void 0?e.addEventListener(t,n,{capture:!0,passive:r}):e.addEventListener(t,n,!0):r!==void 0?e.addEventListener(t,n,{passive:r}):e.addEventListener(t,n,!1)}function tc(e,t,n,l,r){var u=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var g=l.tag;if(g===3||g===4){var S=l.stateNode.containerInfo;if(S===r)break;if(g===4)for(g=l.return;g!==null;){var R=g.tag;if((R===3||R===4)&&g.stateNode.containerInfo===r)return;g=g.return}for(;S!==null;){if(g=ae(S),g===null)return;if(R=g.tag,R===5||R===6||R===26||R===27){l=u=g;continue e}S=S.parentNode}}l=l.return}Rf(function(){var B=u,V=bo(n),te=[];e:{var F=td.get(e);if(F!==void 0){var X=Di,pe=e;switch(e){case"keypress":if(ji(n)===0)break e;case"keydown":case"keyup":X=Y0;break;case"focusin":pe="focus",X=wo;break;case"focusout":pe="blur",X=wo;break;case"beforeblur":case"afterblur":X=wo;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=Nf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=j0;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=$0;break;case Kf:case Jf:case Pf:X=M0;break;case ed:X=V0;break;case"scroll":case"scrollend":X=k0;break;case"wheel":X=W0;break;case"copy":case"cut":case"paste":X=z0;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=Of;break;case"toggle":case"beforetoggle":X=J0}var Re=(t&4)!==0,nt=!Re&&(e==="scroll"||e==="scrollend"),z=Re?F!==null?F+"Capture":null:F;Re=[];for(var N=B,U;N!==null;){var J=N;if(U=J.stateNode,J=J.tag,J!==5&&J!==26&&J!==27||U===null||z===null||(J=hs(N,z),J!=null&&Re.push($s(N,J,U))),nt)break;N=N.return}0<Re.length&&(F=new X(F,pe,null,n,V),te.push({event:F,listeners:Re}))}}if((t&7)===0){e:{if(F=e==="mouseover"||e==="pointerover",X=e==="mouseout"||e==="pointerout",F&&n!==yo&&(pe=n.relatedTarget||n.fromElement)&&(ae(pe)||pe[Vn]))break e;if((X||F)&&(F=V.window===V?V:(F=V.ownerDocument)?F.defaultView||F.parentWindow:window,X?(pe=n.relatedTarget||n.toElement,X=B,pe=pe?ae(pe):null,pe!==null&&(nt=f(pe),Re=pe.tag,pe!==nt||Re!==5&&Re!==27&&Re!==6)&&(pe=null)):(X=null,pe=B),X!==pe)){if(Re=Nf,J="onMouseLeave",z="onMouseEnter",N="mouse",(e==="pointerout"||e==="pointerover")&&(Re=Of,J="onPointerLeave",z="onPointerEnter",N="pointer"),nt=X==null?F:Qe(X),U=pe==null?F:Qe(pe),F=new Re(J,N+"leave",X,n,V),F.target=nt,F.relatedTarget=U,J=null,ae(V)===B&&(Re=new Re(z,N+"enter",pe,n,V),Re.target=U,Re.relatedTarget=nt,J=Re),nt=J,X&&pe)t:{for(Re=Ky,z=X,N=pe,U=0,J=z;J;J=Re(J))U++;J=0;for(var Ae=N;Ae;Ae=Re(Ae))J++;for(;0<U-J;)z=Re(z),U--;for(;0<J-U;)N=Re(N),J--;for(;U--;){if(z===N||N!==null&&z===N.alternate){Re=z;break t}z=Re(z),N=Re(N)}Re=null}else Re=null;X!==null&&Em(te,F,X,Re,!1),pe!==null&&nt!==null&&Em(te,nt,pe,Re,!0)}}e:{if(F=B?Qe(B):window,X=F.nodeName&&F.nodeName.toLowerCase(),X==="select"||X==="input"&&F.type==="file")var $e=If;else if(Bf(F))if(Ff)$e=oy;else{$e=iy;var be=sy}else X=F.nodeName,!X||X.toLowerCase()!=="input"||F.type!=="checkbox"&&F.type!=="radio"?B&&go(B.elementType)&&($e=If):$e=ry;if($e&&($e=$e(e,B))){Hf(te,$e,n,V);break e}be&&be(e,F,B),e==="focusout"&&B&&F.type==="number"&&B.memoizedProps.value!=null&&po(F,"number",F.value)}switch(be=B?Qe(B):window,e){case"focusin":(Bf(be)||be.contentEditable==="true")&&(ba=be,No=B,Ts=null);break;case"focusout":Ts=No=ba=null;break;case"mousedown":jo=!0;break;case"contextmenu":case"mouseup":case"dragend":jo=!1,Qf(te,n,V);break;case"selectionchange":if(cy)break;case"keydown":case"keyup":Qf(te,n,V)}var De;if(_o)e:{switch(e){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else ya?zf(e,n)&&(Fe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(Fe="onCompositionStart");Fe&&(Df&&n.locale!=="ko"&&(ya||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&ya&&(De=Cf()):(yl=V,To="value"in yl?yl.value:yl.textContent,ya=!0)),be=Er(B,Fe),0<be.length&&(Fe=new jf(Fe,e,null,n,V),te.push({event:Fe,listeners:be}),De?Fe.data=De:(De=Uf(n),De!==null&&(Fe.data=De)))),(De=ey?ty(e,n):ny(e,n))&&(Fe=Er(B,"onBeforeInput"),0<Fe.length&&(be=new jf("onBeforeInput","beforeinput",null,n,V),te.push({event:be,listeners:Fe}),be.data=De)),Zy(te,e,B,n,V)}Tm(te,t)})}function $s(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Er(e,t){for(var n=t+"Capture",l=[];e!==null;){var r=e,u=r.stateNode;if(r=r.tag,r!==5&&r!==26&&r!==27||u===null||(r=hs(e,n),r!=null&&l.unshift($s(e,r,u)),r=hs(e,t),r!=null&&l.push($s(e,r,u))),e.tag===3)return l;e=e.return}return[]}function Ky(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Em(e,t,n,l,r){for(var u=t._reactName,g=[];n!==null&&n!==l;){var S=n,R=S.alternate,B=S.stateNode;if(S=S.tag,R!==null&&R===l)break;S!==5&&S!==26&&S!==27||B===null||(R=B,r?(B=hs(n,u),B!=null&&g.unshift($s(n,B,R))):r||(B=hs(n,u),B!=null&&g.push($s(n,B,R)))),n=n.return}g.length!==0&&e.push({event:t,listeners:g})}var Jy=/\r\n?/g,Py=/\u0000|\uFFFD/g;function wm(e){return(typeof e=="string"?e:""+e).replace(Jy,`
49
+ `).replace(Py,"")}function Am(e,t){return t=wm(t),wm(e)===t}function tt(e,t,n,l,r,u){switch(n){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||ma(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&ma(e,""+l);break;case"className":Ri(e,"class",l);break;case"tabIndex":Ri(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Ri(e,n,l);break;case"style":Af(e,l,u);break;case"data":if(t!=="object"){Ri(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||n!=="href")){e.removeAttribute(n);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=ki(""+l),e.setAttribute(n,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof u=="function"&&(n==="formAction"?(t!=="input"&&tt(e,t,"name",r.name,r,null),tt(e,t,"formEncType",r.formEncType,r,null),tt(e,t,"formMethod",r.formMethod,r,null),tt(e,t,"formTarget",r.formTarget,r,null)):(tt(e,t,"encType",r.encType,r,null),tt(e,t,"method",r.method,r,null),tt(e,t,"target",r.target,r,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(n);break}l=ki(""+l),e.setAttribute(n,l);break;case"onClick":l!=null&&(e.onclick=Wn);break;case"onScroll":l!=null&&He("scroll",e);break;case"onScrollEnd":l!=null&&He("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(n=l.__html,n!=null){if(r.children!=null)throw Error(i(60));e.innerHTML=n}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}n=ki(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""+l):e.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,""):e.removeAttribute(n);break;case"capture":case"download":l===!0?e.setAttribute(n,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(n,l):e.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(n,l):e.removeAttribute(n);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(n):e.setAttribute(n,l);break;case"popover":He("beforetoggle",e),He("toggle",e),_i(e,"popover",l);break;case"xlinkActuate":Qn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Qn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Qn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Qn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Qn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Qn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Qn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Qn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Qn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":_i(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=R0.get(n)||n,_i(e,n,l))}}function nc(e,t,n,l,r,u){switch(n){case"style":Af(e,l,u);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(n=l.__html,n!=null){if(r.children!=null)throw Error(i(60));e.innerHTML=n}}break;case"children":typeof l=="string"?ma(e,l):(typeof l=="number"||typeof l=="bigint")&&ma(e,""+l);break;case"onScroll":l!=null&&He("scroll",e);break;case"onScrollEnd":l!=null&&He("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Wn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!dn.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(r=n.endsWith("Capture"),t=n.slice(2,r?n.length-7:void 0),u=e[ot]||null,u=u!=null?u[n]:null,typeof u=="function"&&e.removeEventListener(t,u,r),typeof l=="function")){typeof u!="function"&&u!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,l,r);break e}n in e?e[n]=l:l===!0?e.setAttribute(n,""):_i(e,n,l)}}}function zt(e,t,n){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":He("error",e),He("load",e);var l=!1,r=!1,u;for(u in n)if(n.hasOwnProperty(u)){var g=n[u];if(g!=null)switch(u){case"src":l=!0;break;case"srcSet":r=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:tt(e,t,u,g,n,null)}}r&&tt(e,t,"srcSet",n.srcSet,n,null),l&&tt(e,t,"src",n.src,n,null);return;case"input":He("invalid",e);var S=u=g=r=null,R=null,B=null;for(l in n)if(n.hasOwnProperty(l)){var V=n[l];if(V!=null)switch(l){case"name":r=V;break;case"type":g=V;break;case"checked":R=V;break;case"defaultChecked":B=V;break;case"value":u=V;break;case"defaultValue":S=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(i(137,t));break;default:tt(e,t,l,V,n,null)}}Tf(e,u,S,R,B,g,r,!1);return;case"select":He("invalid",e),l=g=u=null;for(r in n)if(n.hasOwnProperty(r)&&(S=n[r],S!=null))switch(r){case"value":u=S;break;case"defaultValue":g=S;break;case"multiple":l=S;default:tt(e,t,r,S,n,null)}t=u,n=g,e.multiple=!!l,t!=null?ha(e,!!l,t,!1):n!=null&&ha(e,!!l,n,!0);return;case"textarea":He("invalid",e),u=r=l=null;for(g in n)if(n.hasOwnProperty(g)&&(S=n[g],S!=null))switch(g){case"value":l=S;break;case"defaultValue":r=S;break;case"children":u=S;break;case"dangerouslySetInnerHTML":if(S!=null)throw Error(i(91));break;default:tt(e,t,g,S,n,null)}Ef(e,l,r,u);return;case"option":for(R in n)if(n.hasOwnProperty(R)&&(l=n[R],l!=null))switch(R){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:tt(e,t,R,l,n,null)}return;case"dialog":He("beforetoggle",e),He("toggle",e),He("cancel",e),He("close",e);break;case"iframe":case"object":He("load",e);break;case"video":case"audio":for(l=0;l<Xs.length;l++)He(Xs[l],e);break;case"image":He("error",e),He("load",e);break;case"details":He("toggle",e);break;case"embed":case"source":case"link":He("error",e),He("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(B in n)if(n.hasOwnProperty(B)&&(l=n[B],l!=null))switch(B){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:tt(e,t,B,l,n,null)}return;default:if(go(t)){for(V in n)n.hasOwnProperty(V)&&(l=n[V],l!==void 0&&nc(e,t,V,l,n,void 0));return}}for(S in n)n.hasOwnProperty(S)&&(l=n[S],l!=null&&tt(e,t,S,l,n,null))}function eb(e,t,n,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var r=null,u=null,g=null,S=null,R=null,B=null,V=null;for(X in n){var te=n[X];if(n.hasOwnProperty(X)&&te!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":R=te;default:l.hasOwnProperty(X)||tt(e,t,X,null,l,te)}}for(var F in l){var X=l[F];if(te=n[F],l.hasOwnProperty(F)&&(X!=null||te!=null))switch(F){case"type":u=X;break;case"name":r=X;break;case"checked":B=X;break;case"defaultChecked":V=X;break;case"value":g=X;break;case"defaultValue":S=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(i(137,t));break;default:X!==te&&tt(e,t,F,X,l,te)}}mo(e,g,S,R,B,V,u,r);return;case"select":X=g=S=F=null;for(u in n)if(R=n[u],n.hasOwnProperty(u)&&R!=null)switch(u){case"value":break;case"multiple":X=R;default:l.hasOwnProperty(u)||tt(e,t,u,null,l,R)}for(r in l)if(u=l[r],R=n[r],l.hasOwnProperty(r)&&(u!=null||R!=null))switch(r){case"value":F=u;break;case"defaultValue":S=u;break;case"multiple":g=u;default:u!==R&&tt(e,t,r,u,l,R)}t=S,n=g,l=X,F!=null?ha(e,!!n,F,!1):!!l!=!!n&&(t!=null?ha(e,!!n,t,!0):ha(e,!!n,n?[]:"",!1));return;case"textarea":X=F=null;for(S in n)if(r=n[S],n.hasOwnProperty(S)&&r!=null&&!l.hasOwnProperty(S))switch(S){case"value":break;case"children":break;default:tt(e,t,S,null,l,r)}for(g in l)if(r=l[g],u=n[g],l.hasOwnProperty(g)&&(r!=null||u!=null))switch(g){case"value":F=r;break;case"defaultValue":X=r;break;case"children":break;case"dangerouslySetInnerHTML":if(r!=null)throw Error(i(91));break;default:r!==u&&tt(e,t,g,r,l,u)}Sf(e,F,X);return;case"option":for(var pe in n)if(F=n[pe],n.hasOwnProperty(pe)&&F!=null&&!l.hasOwnProperty(pe))switch(pe){case"selected":e.selected=!1;break;default:tt(e,t,pe,null,l,F)}for(R in l)if(F=l[R],X=n[R],l.hasOwnProperty(R)&&F!==X&&(F!=null||X!=null))switch(R){case"selected":e.selected=F&&typeof F!="function"&&typeof F!="symbol";break;default:tt(e,t,R,F,l,X)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Re in n)F=n[Re],n.hasOwnProperty(Re)&&F!=null&&!l.hasOwnProperty(Re)&&tt(e,t,Re,null,l,F);for(B in l)if(F=l[B],X=n[B],l.hasOwnProperty(B)&&F!==X&&(F!=null||X!=null))switch(B){case"children":case"dangerouslySetInnerHTML":if(F!=null)throw Error(i(137,t));break;default:tt(e,t,B,F,l,X)}return;default:if(go(t)){for(var nt in n)F=n[nt],n.hasOwnProperty(nt)&&F!==void 0&&!l.hasOwnProperty(nt)&&nc(e,t,nt,void 0,l,F);for(V in l)F=l[V],X=n[V],!l.hasOwnProperty(V)||F===X||F===void 0&&X===void 0||nc(e,t,V,F,l,X);return}}for(var z in n)F=n[z],n.hasOwnProperty(z)&&F!=null&&!l.hasOwnProperty(z)&&tt(e,t,z,null,l,F);for(te in l)F=l[te],X=n[te],!l.hasOwnProperty(te)||F===X||F==null&&X==null||tt(e,t,te,F,l,X)}function _m(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function tb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,n=performance.getEntriesByType("resource"),l=0;l<n.length;l++){var r=n[l],u=r.transferSize,g=r.initiatorType,S=r.duration;if(u&&S&&_m(g)){for(g=0,S=r.responseEnd,l+=1;l<n.length;l++){var R=n[l],B=R.startTime;if(B>S)break;var V=R.transferSize,te=R.initiatorType;V&&_m(te)&&(R=R.responseEnd,g+=V*(R<S?1:(S-B)/(R-B)))}if(--l,t+=8*(u+g)/(r.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var lc=null,ac=null;function wr(e){return e.nodeType===9?e:e.ownerDocument}function Rm(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Cm(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function sc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ic=null;function nb(){var e=window.event;return e&&e.type==="popstate"?e===ic?!1:(ic=e,!0):(ic=null,!1)}var km=typeof setTimeout=="function"?setTimeout:void 0,lb=typeof clearTimeout=="function"?clearTimeout:void 0,Nm=typeof Promise=="function"?Promise:void 0,ab=typeof queueMicrotask=="function"?queueMicrotask:typeof Nm<"u"?function(e){return Nm.resolve(null).then(e).catch(sb)}:km;function sb(e){setTimeout(function(){throw e})}function Ml(e){return e==="head"}function jm(e,t){var n=t,l=0;do{var r=n.nextSibling;if(e.removeChild(n),r&&r.nodeType===8)if(n=r.data,n==="/$"||n==="/&"){if(l===0){e.removeChild(r),Xa(t);return}l--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")l++;else if(n==="html")Zs(e.ownerDocument.documentElement);else if(n==="head"){n=e.ownerDocument.head,Zs(n);for(var u=n.firstChild;u;){var g=u.nextSibling,S=u.nodeName;u[ye]||S==="SCRIPT"||S==="STYLE"||S==="LINK"&&u.rel.toLowerCase()==="stylesheet"||n.removeChild(u),u=g}}else n==="body"&&Zs(e.ownerDocument.body);n=r}while(n);Xa(t)}function Om(e,t){var n=e;e=0;do{var l=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),l&&l.nodeType===8)if(n=l.data,n==="/$"){if(e===0)break;e--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||e++;n=l}while(n)}function rc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":rc(n),k(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}e.removeChild(n)}}function ib(e,t,n,l){for(;e.nodeType===1;){var r=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[ye])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(u=e.getAttribute("rel"),u==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(u!==r.rel||e.getAttribute("href")!==(r.href==null||r.href===""?null:r.href)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin)||e.getAttribute("title")!==(r.title==null?null:r.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(u=e.getAttribute("src"),(u!==(r.src==null?null:r.src)||e.getAttribute("type")!==(r.type==null?null:r.type)||e.getAttribute("crossorigin")!==(r.crossOrigin==null?null:r.crossOrigin))&&u&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var u=r.name==null?null:""+r.name;if(r.type==="hidden"&&e.getAttribute("name")===u)return e}else return e;if(e=Tn(e.nextSibling),e===null)break}return null}function rb(e,t,n){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!n||(e=Tn(e.nextSibling),e===null))return null;return e}function Dm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=Tn(e.nextSibling),e===null))return null;return e}function oc(e){return e.data==="$?"||e.data==="$~"}function uc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function ob(e,t){var n=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||n.readyState!=="loading")t();else{var l=function(){t(),n.removeEventListener("DOMContentLoaded",l)};n.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Tn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var cc=null;function Mm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"||n==="/&"){if(t===0)return Tn(e.nextSibling);t--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||t++}e=e.nextSibling}return null}function Lm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(t===0)return e;t--}else n!=="/$"&&n!=="/&"||t++}e=e.previousSibling}return null}function zm(e,t,n){switch(t=wr(n),e){case"html":if(e=t.documentElement,!e)throw Error(i(452));return e;case"head":if(e=t.head,!e)throw Error(i(453));return e;case"body":if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Zs(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);k(e)}var Sn=new Map,Um=new Set;function Ar(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var dl=le.d;le.d={f:ub,r:cb,D:fb,C:db,L:hb,m:mb,X:gb,S:pb,M:yb};function ub(){var e=dl.f(),t=gr();return e||t}function cb(e){var t=de(e);t!==null&&t.tag===5&&t.type==="form"?eh(t):dl.r(e)}var Ga=typeof document>"u"?null:document;function Bm(e,t,n){var l=Ga;if(l&&typeof t=="string"&&t){var r=mn(t);r='link[rel="'+e+'"][href="'+r+'"]',typeof n=="string"&&(r+='[crossorigin="'+n+'"]'),Um.has(r)||(Um.add(r),e={rel:e,crossOrigin:n,href:t},l.querySelector(r)===null&&(t=l.createElement("link"),zt(t,"link",e),ze(t),l.head.appendChild(t)))}}function fb(e){dl.D(e),Bm("dns-prefetch",e,null)}function db(e,t){dl.C(e,t),Bm("preconnect",e,t)}function hb(e,t,n){dl.L(e,t,n);var l=Ga;if(l&&e&&t){var r='link[rel="preload"][as="'+mn(t)+'"]';t==="image"&&n&&n.imageSrcSet?(r+='[imagesrcset="'+mn(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(r+='[imagesizes="'+mn(n.imageSizes)+'"]')):r+='[href="'+mn(e)+'"]';var u=r;switch(t){case"style":u=Ya(e);break;case"script":u=qa(e)}Sn.has(u)||(e=v({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Sn.set(u,e),l.querySelector(r)!==null||t==="style"&&l.querySelector(Vs(u))||t==="script"&&l.querySelector(Qs(u))||(t=l.createElement("link"),zt(t,"link",e),ze(t),l.head.appendChild(t)))}}function mb(e,t){dl.m(e,t);var n=Ga;if(n&&e){var l=t&&typeof t.as=="string"?t.as:"script",r='link[rel="modulepreload"][as="'+mn(l)+'"][href="'+mn(e)+'"]',u=r;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":u=qa(e)}if(!Sn.has(u)&&(e=v({rel:"modulepreload",href:e},t),Sn.set(u,e),n.querySelector(r)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Qs(u)))return}l=n.createElement("link"),zt(l,"link",e),ze(l),n.head.appendChild(l)}}}function pb(e,t,n){dl.S(e,t,n);var l=Ga;if(l&&e){var r=ft(l).hoistableStyles,u=Ya(e);t=t||"default";var g=r.get(u);if(!g){var S={loading:0,preload:null};if(g=l.querySelector(Vs(u)))S.loading=5;else{e=v({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Sn.get(u))&&fc(e,n);var R=g=l.createElement("link");ze(R),zt(R,"link",e),R._p=new Promise(function(B,V){R.onload=B,R.onerror=V}),R.addEventListener("load",function(){S.loading|=1}),R.addEventListener("error",function(){S.loading|=2}),S.loading|=4,_r(g,t,l)}g={type:"stylesheet",instance:g,count:1,state:S},r.set(u,g)}}}function gb(e,t){dl.X(e,t);var n=Ga;if(n&&e){var l=ft(n).hoistableScripts,r=qa(e),u=l.get(r);u||(u=n.querySelector(Qs(r)),u||(e=v({src:e,async:!0},t),(t=Sn.get(r))&&dc(e,t),u=n.createElement("script"),ze(u),zt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(r,u))}}function yb(e,t){dl.M(e,t);var n=Ga;if(n&&e){var l=ft(n).hoistableScripts,r=qa(e),u=l.get(r);u||(u=n.querySelector(Qs(r)),u||(e=v({src:e,async:!0,type:"module"},t),(t=Sn.get(r))&&dc(e,t),u=n.createElement("script"),ze(u),zt(u,"link",e),n.head.appendChild(u)),u={type:"script",instance:u,count:1,state:null},l.set(r,u))}}function Hm(e,t,n,l){var r=(r=M.current)?Ar(r):null;if(!r)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=Ya(n.href),n=ft(r).hoistableStyles,l=n.get(t),l||(l={type:"style",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=Ya(n.href);var u=ft(r).hoistableStyles,g=u.get(e);if(g||(r=r.ownerDocument||r,g={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},u.set(e,g),(u=r.querySelector(Vs(e)))&&!u._p&&(g.instance=u,g.state.loading=5),Sn.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Sn.set(e,n),u||bb(r,e,n,g.state))),t&&l===null)throw Error(i(528,""));return g}if(t&&l!==null)throw Error(i(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=qa(n),n=ft(r).hoistableScripts,l=n.get(t),l||(l={type:"script",instance:null,count:0,state:null},n.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Ya(e){return'href="'+mn(e)+'"'}function Vs(e){return'link[rel="stylesheet"]['+e+"]"}function Im(e){return v({},e,{"data-precedence":e.precedence,precedence:null})}function bb(e,t,n,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),zt(t,"link",n),ze(t),e.head.appendChild(t))}function qa(e){return'[src="'+mn(e)+'"]'}function Qs(e){return"script[async]"+e}function Fm(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+mn(n.href)+'"]');if(l)return t.instance=l,ze(l),l;var r=v({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),ze(l),zt(l,"style",r),_r(l,n.precedence,e),t.instance=l;case"stylesheet":r=Ya(n.href);var u=e.querySelector(Vs(r));if(u)return t.state.loading|=4,t.instance=u,ze(u),u;l=Im(n),(r=Sn.get(r))&&fc(l,r),u=(e.ownerDocument||e).createElement("link"),ze(u);var g=u;return g._p=new Promise(function(S,R){g.onload=S,g.onerror=R}),zt(u,"link",l),t.state.loading|=4,_r(u,n.precedence,e),t.instance=u;case"script":return u=qa(n.src),(r=e.querySelector(Qs(u)))?(t.instance=r,ze(r),r):(l=n,(r=Sn.get(u))&&(l=v({},n),dc(l,r)),e=e.ownerDocument||e,r=e.createElement("script"),ze(r),zt(r,"link",l),e.head.appendChild(r),t.instance=r);case"void":return null;default:throw Error(i(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,_r(l,n.precedence,e));return t.instance}function _r(e,t,n){for(var l=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),r=l.length?l[l.length-1]:null,u=r,g=0;g<l.length;g++){var S=l[g];if(S.dataset.precedence===t)u=S;else if(u!==r)break}u?u.parentNode.insertBefore(e,u.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function fc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function dc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var Rr=null;function Gm(e,t,n){if(Rr===null){var l=new Map,r=Rr=new Map;r.set(n,l)}else r=Rr,l=r.get(n),l||(l=new Map,r.set(n,l));if(l.has(e))return l;for(l.set(e,null),n=n.getElementsByTagName(e),r=0;r<n.length;r++){var u=n[r];if(!(u[ye]||u[xt]||e==="link"&&u.getAttribute("rel")==="stylesheet")&&u.namespaceURI!=="http://www.w3.org/2000/svg"){var g=u.getAttribute(t)||"";g=e+g;var S=l.get(g);S?S.push(u):l.set(g,[u])}}return l}function Ym(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t==="title"?e.querySelector("head > title"):null)}function xb(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function qm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function vb(e,t,n,l){if(n.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var r=Ya(l.href),u=t.querySelector(Vs(r));if(u){t=u._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Cr.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=u,ze(u);return}u=t.ownerDocument||t,l=Im(l),(r=Sn.get(r))&&fc(l,r),u=u.createElement("link"),ze(u);var g=u;g._p=new Promise(function(S,R){g.onload=S,g.onerror=R}),zt(u,"link",l),n.instance=u}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Cr.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var hc=0;function Tb(e,t){return e.stylesheets&&e.count===0&&Nr(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var l=setTimeout(function(){if(e.stylesheets&&Nr(e,e.stylesheets),e.unsuspend){var u=e.unsuspend;e.unsuspend=null,u()}},6e4+t);0<e.imgBytes&&hc===0&&(hc=62500*tb());var r=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Nr(e,e.stylesheets),e.unsuspend)){var u=e.unsuspend;e.unsuspend=null,u()}},(e.imgBytes>hc?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(l),clearTimeout(r)}}:null}function Cr(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Nr(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var kr=null;function Nr(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,kr=new Map,t.forEach(Sb,e),kr=null,Cr.call(e))}function Sb(e,t){if(!(t.state.loading&4)){var n=kr.get(e);if(n)var l=n.get(null);else{n=new Map,kr.set(e,n);for(var r=e.querySelectorAll("link[data-precedence],style[data-precedence]"),u=0;u<r.length;u++){var g=r[u];(g.nodeName==="LINK"||g.getAttribute("media")!=="not all")&&(n.set(g.dataset.precedence,g),l=g)}l&&n.set(null,l)}r=t.instance,g=r.getAttribute("data-precedence"),u=n.get(g)||l,u===l&&n.set(null,r),n.set(g,r),this.count++,l=Cr.bind(this),r.addEventListener("load",l),r.addEventListener("error",l),u?u.parentNode.insertBefore(r,u.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(r,e.firstChild)),t.state.loading|=4}}var Ws={$$typeof:O,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function Eb(e,t,n,l,r,u,g,S,R){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ss(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ss(0),this.hiddenUpdates=ss(null),this.identifierPrefix=l,this.onUncaughtError=r,this.onCaughtError=u,this.onRecoverableError=g,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=R,this.incompleteTransitions=new Map}function Xm(e,t,n,l,r,u,g,S,R,B,V,te){return e=new Eb(e,t,n,g,R,B,V,te,S),t=1,u===!0&&(t|=24),u=tn(3,null,null,t),e.current=u,u.stateNode=e,t=$o(),t.refCount++,e.pooledCache=t,t.refCount++,u.memoizedState={element:l,isDehydrated:n,cache:t},Wo(u),e}function $m(e){return e?(e=Ta,e):Ta}function Zm(e,t,n,l,r,u){r=$m(r),l.context===null?l.context=r:l.pendingContext=r,l=El(t),l.payload={element:n},u=u===void 0?null:u,u!==null&&(l.callback=u),n=wl(e,l,t),n!==null&&(Wt(n,e,t),Cs(n,e,t))}function Vm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function mc(e,t){Vm(e,t),(e=e.alternate)&&Vm(e,t)}function Qm(e){if(e.tag===13||e.tag===31){var t=$l(e,67108864);t!==null&&Wt(t,e,67108864),mc(e,67108864)}}function Wm(e){if(e.tag===13||e.tag===31){var t=rn();t=Yt(t);var n=$l(e,t);n!==null&&Wt(n,e,t),mc(e,t)}}var jr=!0;function wb(e,t,n,l){var r=G.T;G.T=null;var u=le.p;try{le.p=2,pc(e,t,n,l)}finally{le.p=u,G.T=r}}function Ab(e,t,n,l){var r=G.T;G.T=null;var u=le.p;try{le.p=8,pc(e,t,n,l)}finally{le.p=u,G.T=r}}function pc(e,t,n,l){if(jr){var r=gc(l);if(r===null)tc(e,t,l,Or,n),Jm(e,l);else if(Rb(r,e,t,n,l))l.stopPropagation();else if(Jm(e,l),t&4&&-1<_b.indexOf(e)){for(;r!==null;){var u=de(r);if(u!==null)switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var g=Pt(u.pendingLanes);if(g!==0){var S=u;for(S.pendingLanes|=2,S.entangledLanes|=2;g;){var R=1<<31-bt(g);S.entanglements[1]|=R,g&=~R}Bn(u),(Ve&6)===0&&(mr=jt()+500,qs(0))}}break;case 31:case 13:S=$l(u,2),S!==null&&Wt(S,u,2),gr(),mc(u,2)}if(u=gc(l),u===null&&tc(e,t,l,Or,n),u===r)break;r=u}r!==null&&l.stopPropagation()}else tc(e,t,l,null,n)}}function gc(e){return e=bo(e),yc(e)}var Or=null;function yc(e){if(Or=null,e=ae(e),e!==null){var t=f(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=d(t),e!==null)return e;e=null}else if(n===31){if(e=m(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Or=e,null}function Km(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Fl()){case qn:return 2;case Jt:return 8;case pl:case vi:return 32;case ts:return 268435456;default:return 32}default:return 32}}var bc=!1,Ll=null,zl=null,Ul=null,Ks=new Map,Js=new Map,Bl=[],_b="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Jm(e,t){switch(e){case"focusin":case"focusout":Ll=null;break;case"dragenter":case"dragleave":zl=null;break;case"mouseover":case"mouseout":Ul=null;break;case"pointerover":case"pointerout":Ks.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Js.delete(t.pointerId)}}function Ps(e,t,n,l,r,u){return e===null||e.nativeEvent!==u?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:u,targetContainers:[r]},t!==null&&(t=de(t),t!==null&&Qm(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,r!==null&&t.indexOf(r)===-1&&t.push(r),e)}function Rb(e,t,n,l,r){switch(t){case"focusin":return Ll=Ps(Ll,e,t,n,l,r),!0;case"dragenter":return zl=Ps(zl,e,t,n,l,r),!0;case"mouseover":return Ul=Ps(Ul,e,t,n,l,r),!0;case"pointerover":var u=r.pointerId;return Ks.set(u,Ps(Ks.get(u)||null,e,t,n,l,r)),!0;case"gotpointercapture":return u=r.pointerId,Js.set(u,Ps(Js.get(u)||null,e,t,n,l,r)),!0}return!1}function Pm(e){var t=ae(e.target);if(t!==null){var n=f(t);if(n!==null){if(t=n.tag,t===13){if(t=d(n),t!==null){e.blockedOn=t,cs(e.priority,function(){Wm(n)});return}}else if(t===31){if(t=m(n),t!==null){e.blockedOn=t,cs(e.priority,function(){Wm(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dr(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=gc(e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);yo=l,n.target.dispatchEvent(l),yo=null}else return t=de(n),t!==null&&Qm(t),e.blockedOn=n,!1;t.shift()}return!0}function ep(e,t,n){Dr(e)&&n.delete(t)}function Cb(){bc=!1,Ll!==null&&Dr(Ll)&&(Ll=null),zl!==null&&Dr(zl)&&(zl=null),Ul!==null&&Dr(Ul)&&(Ul=null),Ks.forEach(ep),Js.forEach(ep)}function Mr(e,t){e.blockedOn===t&&(e.blockedOn=null,bc||(bc=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Cb)))}var Lr=null;function tp(e){Lr!==e&&(Lr=e,a.unstable_scheduleCallback(a.unstable_NormalPriority,function(){Lr===e&&(Lr=null);for(var t=0;t<e.length;t+=3){var n=e[t],l=e[t+1],r=e[t+2];if(typeof l!="function"){if(yc(l||n)===null)continue;break}var u=de(n);u!==null&&(e.splice(t,3),t-=3,gu(u,{pending:!0,data:r,method:n.method,action:l},l,r))}}))}function Xa(e){function t(R){return Mr(R,e)}Ll!==null&&Mr(Ll,e),zl!==null&&Mr(zl,e),Ul!==null&&Mr(Ul,e),Ks.forEach(t),Js.forEach(t);for(var n=0;n<Bl.length;n++){var l=Bl[n];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Bl.length&&(n=Bl[0],n.blockedOn===null);)Pm(n),n.blockedOn===null&&Bl.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(l=0;l<n.length;l+=3){var r=n[l],u=n[l+1],g=r[ot]||null;if(typeof u=="function")g||tp(n);else if(g){var S=null;if(u&&u.hasAttribute("formAction")){if(r=u,g=u[ot]||null)S=g.formAction;else if(yc(r)!==null)continue}else S=g.action;typeof S=="function"?n[l+1]=S:(n.splice(l,3),l-=3),tp(n)}}}function np(){function e(u){u.canIntercept&&u.info==="react-transition"&&u.intercept({handler:function(){return new Promise(function(g){return r=g})},focusReset:"manual",scroll:"manual"})}function t(){r!==null&&(r(),r=null),l||setTimeout(n,20)}function n(){if(!l&&!navigation.transition){var u=navigation.currentEntry;u&&u.url!=null&&navigation.navigate(u.url,{state:u.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,r=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(n,100),function(){l=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),r!==null&&(r(),r=null)}}}function xc(e){this._internalRoot=e}zr.prototype.render=xc.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current,l=rn();Zm(n,l,e,t,null,null)},zr.prototype.unmount=xc.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zm(e.current,2,null,e,null,null),gr(),t[Vn]=null}};function zr(e){this._internalRoot=e}zr.prototype.unstable_scheduleHydration=function(e){if(e){var t=us();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Bl.length&&t!==0&&t<Bl[n].priority;n++);Bl.splice(n,0,e),n===0&&Pm(e)}};var lp=s.version;if(lp!=="19.2.4")throw Error(i(527,lp,"19.2.4"));le.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=p(t),e=e!==null?y(e):null,e=e===null?null:e.stateNode,e};var kb={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:G,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ur=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ur.isDisabled&&Ur.supportsFiber)try{Dn=Ur.inject(kb),Rt=Ur}catch{}}return ti.createRoot=function(e,t){if(!c(e))throw Error(i(299));var n=!1,l="",r=ch,u=fh,g=dh;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(r=t.onUncaughtError),t.onCaughtError!==void 0&&(u=t.onCaughtError),t.onRecoverableError!==void 0&&(g=t.onRecoverableError)),t=Xm(e,1,!1,null,null,n,l,null,r,u,g,np),e[Vn]=t.current,ec(e),new xc(t)},ti.hydrateRoot=function(e,t,n){if(!c(e))throw Error(i(299));var l=!1,r="",u=ch,g=fh,S=dh,R=null;return n!=null&&(n.unstable_strictMode===!0&&(l=!0),n.identifierPrefix!==void 0&&(r=n.identifierPrefix),n.onUncaughtError!==void 0&&(u=n.onUncaughtError),n.onCaughtError!==void 0&&(g=n.onCaughtError),n.onRecoverableError!==void 0&&(S=n.onRecoverableError),n.formState!==void 0&&(R=n.formState)),t=Xm(e,1,!0,t,n??null,l,r,R,u,g,S,np),t.context=$m(null),n=t.current,l=rn(),l=Yt(l),r=El(l),r.callback=null,wl(n,r,l),n=l,t.current.lanes=n,gl(t,n),Bn(t),e[Vn]=t.current,ec(e),new zr(t)},ti.version="19.2.4",ti}var hp;function Gb(){if(hp)return Sc.exports;hp=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(s){console.error(s)}}return a(),Sc.exports=Fb(),Sc.exports}var Yb=Gb();const qb=_g(Yb),Rg=E.createContext({isFleet:null,bots:[],selectedBot:null,selectBot:()=>{},refreshBots:()=>{}});function nf(){return E.useContext(Rg)}function un(a,s){return fetch(a,{...s,credentials:"same-origin"})}function Xb({children:a}){const[s,o]=E.useState(null),[i,c]=E.useState([]),[f,d]=E.useState(null),m=E.useRef(void 0),b=E.useRef(s);b.current=s;const p=E.useCallback(()=>{un("/api/bots").then(v=>{if(!v.ok)throw new Error("not fleet");return v.json()}).then(v=>{c(v),b.current===null&&o(!0)}).catch(()=>{b.current===null&&o(!1)})},[]);E.useEffect(()=>{p()},[p]),E.useEffect(()=>{if(s===!0)return m.current=setInterval(p,5e3),()=>clearInterval(m.current)},[s,p]);const y=E.useCallback(v=>{d(v)},[]);return h.jsx(Rg.Provider,{value:{isFleet:s,bots:i,selectedBot:f,selectBot:y,refreshBots:p},children:a})}const $b={primary:"bg-primary text-primary-foreground hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90","destructive-soft":"bg-destructive/10 text-destructive hover:bg-destructive/20",ghost:"border border-border text-muted-foreground hover:text-foreground hover:border-foreground/30","ghost-destructive":"border border-destructive/30 text-destructive/70 hover:text-destructive hover:border-destructive"},Zb={sm:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-sm",xs:"px-2 py-1 text-xs"};function Ye({variant:a="primary",size:s="sm",className:o="",disabled:i,...c}){return h.jsx("button",{type:"button",className:`${Zb[s]} ${$b[a]} rounded-md disabled:opacity-50 disabled:cursor-not-allowed transition-colors ${o}`,disabled:i,...c})}const lf="bg-background border border-border rounded-md text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-primary";function En({mono:a,className:s="",...o}){return h.jsx("input",{className:`${lf} px-3 py-1.5 ${a?"font-mono":""} ${s}`,...o})}function Ka({compact:a,className:s="",children:o,...i}){return h.jsx("select",{className:`${lf} ${a?"px-2 py-1":"px-3 py-1.5"} ${s}`,...i,children:o})}function af({mono:a,className:s="",...o}){return h.jsx("textarea",{className:`${lf} px-3 py-2 resize-y ${a?"font-mono":""} ${s}`,...o})}const Vb={2:"space-y-2",3:"space-y-3",4:"space-y-4"};function ct({compact:a,spacing:s,className:o="",children:i,...c}){const f=a?"p-3":"p-4",d=s?Vb[s]:"";return h.jsx("div",{className:`bg-card rounded-lg border border-border ${f} ${d} ${o}`,...c,children:i})}const Qb={success:"bg-green-500/10 text-green-600 dark:text-green-400",error:"bg-destructive/10 text-destructive"};function Yn({variant:a,children:s,className:o="",onDismiss:i}){return h.jsxs("div",{className:`text-sm px-3 py-2 rounded-md ${Qb[a]} ${o}`,children:[s,i&&h.jsx("button",{onClick:i,className:"ml-2 underline",children:"dismiss"})]})}function sf({open:a,size:s="sm",title:o,description:i,children:c}){return a?h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:h.jsxs("div",{className:`bg-card border border-border rounded-lg p-6 ${s==="md"?"max-w-md":"max-w-sm"} mx-4 shadow-xl`,children:[h.jsx("h3",{className:"text-lg font-semibold text-foreground mb-2",children:o}),i&&h.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:i}),c]})}):null}function rf({children:a}){return h.jsx("div",{className:"flex gap-3 justify-end",children:a})}const Wb={green:"bg-green-500",yellow:"bg-yellow-500",red:"bg-red-500",blue:"bg-blue-500",muted:"bg-muted-foreground","muted-light":"bg-muted-foreground/30","muted-lighter":"bg-muted-foreground/40",success:"bg-success"},Kb={sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"};function no({color:a="muted",size:s="md",pulse:o,className:i=""}){return h.jsx("span",{className:`${Kb[s]} rounded-full ${Wb[a]} ${o?"animate-pulse":""} shrink-0 ${i}`})}const Cg={success:"bg-green-500/10 text-green-600 dark:text-green-400",warning:"bg-yellow-500/10 text-yellow-600 dark:text-yellow-400",error:"bg-destructive/10 text-destructive",primary:"bg-primary/10 text-primary",blue:"bg-blue-500/10 text-blue-600 dark:text-blue-400",muted:"bg-muted text-muted-foreground"};function Jb({variant:a="primary",children:s,onRemove:o,className:i=""}){return h.jsxs("span",{className:`inline-flex items-center gap-1 px-2.5 py-1 rounded-full text-xs font-medium ${Cg[a]} ${i}`,children:[s,o&&h.jsx("button",{onClick:o,className:"hover:text-destructive transition-colors ml-0.5",children:"×"})]})}function Yc({variant:a="success",children:s,className:o=""}){return h.jsx("span",{className:`text-xs px-2 py-0.5 rounded-md font-medium ${Cg[a]} ${o}`,children:s})}function Pb({children:a}){const[s,o]=E.useState("checking"),[i,c]=E.useState(""),[f,d]=E.useState(null),[m,b]=E.useState(!1),p=E.useCallback(()=>{fetch("/api/totp/status",{credentials:"same-origin"}).then(v=>v.json()).then(v=>{if(!v.enabled){o("open");return}return fetch("/api/session",{credentials:"same-origin"}).then(x=>{o(x.ok?"authenticated":"locked")})}).catch(()=>o("open"))},[]);E.useEffect(()=>{p()},[p]);async function y(){if(i.length===6){b(!0),d(null);try{const v=await fetch("/api/totp/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({code:i})});if(v.ok)o("authenticated");else{const x=await v.json();d(x.error??"Invalid code"),c("")}}catch{d("Network error")}finally{b(!1)}}}return s==="checking"?h.jsx("div",{className:"h-screen flex items-center justify-center bg-background",children:h.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading..."})}):s==="open"||s==="authenticated"?h.jsx(h.Fragment,{children:a}):h.jsx("div",{className:"h-screen flex items-center justify-center bg-background",children:h.jsx("div",{className:"w-full max-w-sm px-4",children:h.jsxs(ct,{spacing:4,className:"text-center",children:[h.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary flex items-center justify-center text-primary-foreground font-bold text-xl mx-auto",children:"M"}),h.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Mecha Dashboard"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter the 6-digit code from your authenticator app."}),h.jsx(En,{mono:!0,value:i,onChange:v=>{const x=v.target.value.replace(/\D/g,"").slice(0,6);c(x)},onKeyDown:v=>{v.key==="Enter"&&y()},placeholder:"000000",className:"w-full text-center text-2xl tracking-[0.5em]",autoComplete:"one-time-code",inputMode:"numeric",autoFocus:!0}),f&&h.jsx(Yn,{variant:"error",children:f}),h.jsx(Ye,{variant:"primary",size:"lg",onClick:y,disabled:i.length!==6||m,className:"w-full",children:m?"Verifying...":"Verify"})]})})})}let qc=null;function ex(a){qc=a}function tx(){if(typeof window>"u")return"";if(qc)return`/bot/${qc}`;const a="/dashboard/",s=window.location.pathname,o=s.indexOf(a);return o===-1?"":s.slice(0,o)}function lo(a){const s=a.startsWith("/")?a:`/${a}`;return`${tx()}${s}`}function yt(a,s){return fetch(lo(a),{...s,credentials:"same-origin"})}/**
50
+ * @license lucide-react v0.577.0 - ISC
51
+ *
52
+ * This source code is licensed under the ISC license.
53
+ * See the LICENSE file in the root directory of this source tree.
54
+ */const kg=(...a)=>a.filter((s,o,i)=>!!s&&s.trim()!==""&&i.indexOf(s)===o).join(" ").trim();/**
55
+ * @license lucide-react v0.577.0 - ISC
56
+ *
57
+ * This source code is licensed under the ISC license.
58
+ * See the LICENSE file in the root directory of this source tree.
59
+ */const nx=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
60
+ * @license lucide-react v0.577.0 - ISC
61
+ *
62
+ * This source code is licensed under the ISC license.
63
+ * See the LICENSE file in the root directory of this source tree.
64
+ */const lx=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(s,o,i)=>i?i.toUpperCase():o.toLowerCase());/**
65
+ * @license lucide-react v0.577.0 - ISC
66
+ *
67
+ * This source code is licensed under the ISC license.
68
+ * See the LICENSE file in the root directory of this source tree.
69
+ */const mp=a=>{const s=lx(a);return s.charAt(0).toUpperCase()+s.slice(1)};/**
70
+ * @license lucide-react v0.577.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ */var ax={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
75
+ * @license lucide-react v0.577.0 - ISC
76
+ *
77
+ * This source code is licensed under the ISC license.
78
+ * See the LICENSE file in the root directory of this source tree.
79
+ */const sx=a=>{for(const s in a)if(s.startsWith("aria-")||s==="role"||s==="title")return!0;return!1};/**
80
+ * @license lucide-react v0.577.0 - ISC
81
+ *
82
+ * This source code is licensed under the ISC license.
83
+ * See the LICENSE file in the root directory of this source tree.
84
+ */const ix=E.forwardRef(({color:a="currentColor",size:s=24,strokeWidth:o=2,absoluteStrokeWidth:i,className:c="",children:f,iconNode:d,...m},b)=>E.createElement("svg",{ref:b,...ax,width:s,height:s,stroke:a,strokeWidth:i?Number(o)*24/Number(s):o,className:kg("lucide",c),...!f&&!sx(m)&&{"aria-hidden":"true"},...m},[...d.map(([p,y])=>E.createElement(p,y)),...Array.isArray(f)?f:[f]]));/**
85
+ * @license lucide-react v0.577.0 - ISC
86
+ *
87
+ * This source code is licensed under the ISC license.
88
+ * See the LICENSE file in the root directory of this source tree.
89
+ */const es=(a,s)=>{const o=E.forwardRef(({className:i,...c},f)=>E.createElement(ix,{ref:f,iconNode:s,className:kg(`lucide-${nx(mp(a))}`,`lucide-${a}`,i),...c}));return o.displayName=mp(a),o};/**
90
+ * @license lucide-react v0.577.0 - ISC
91
+ *
92
+ * This source code is licensed under the ISC license.
93
+ * See the LICENSE file in the root directory of this source tree.
94
+ */const rx=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],ox=es("bot",rx);/**
95
+ * @license lucide-react v0.577.0 - ISC
96
+ *
97
+ * This source code is licensed under the ISC license.
98
+ * See the LICENSE file in the root directory of this source tree.
99
+ */const ux=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],cx=es("check",ux);/**
100
+ * @license lucide-react v0.577.0 - ISC
101
+ *
102
+ * This source code is licensed under the ISC license.
103
+ * See the LICENSE file in the root directory of this source tree.
104
+ */const fx=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],dx=es("copy",fx);/**
105
+ * @license lucide-react v0.577.0 - ISC
106
+ *
107
+ * This source code is licensed under the ISC license.
108
+ * See the LICENSE file in the root directory of this source tree.
109
+ */const hx=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]],mx=es("file-terminal",hx);/**
110
+ * @license lucide-react v0.577.0 - ISC
111
+ *
112
+ * This source code is licensed under the ISC license.
113
+ * See the LICENSE file in the root directory of this source tree.
114
+ */const px=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],gx=es("file-type",px);/**
115
+ * @license lucide-react v0.577.0 - ISC
116
+ *
117
+ * This source code is licensed under the ISC license.
118
+ * See the LICENSE file in the root directory of this source tree.
119
+ */const yx=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],bx=es("message-circle-plus",yx);function pp(a){const s=new Date(a).getTime();if(!a||isNaN(s))return"unknown";const o=Date.now()-s,i=Math.floor(o/6e4);if(i<1)return"just now";if(i<60)return`${i}m ago`;const c=Math.floor(i/60);if(c<24)return`${c}h ago`;const f=Math.floor(c/24);return f===1?"yesterday":`${f}d ago`}function gp(a){return a?a.includes("opus")?"opus":a.includes("sonnet")?"sonnet":a.includes("haiku")?"haiku":a.split("-").pop()??a:"unknown"}function xx(a,s){if(!s||typeof s!="object")return"";const o=s;switch(a){case"Read":case"Edit":case"Write":return String(o.file_path??"");case"Bash":return String(o.command??"").slice(0,80);case"Grep":case"Glob":return String(o.pattern??"");case"WebSearch":return String(o.query??"");default:return Object.keys(o).slice(0,2).join(", ")}}function vx({id:a}){const[s,o]=E.useState(!1);return h.jsxs("button",{onClick:i=>{i.stopPropagation(),navigator.clipboard.writeText(a).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},className:"inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground transition-colors",title:"Copy session ID",children:[h.jsx("span",{children:"ID"}),s?h.jsx(cx,{className:"w-3 h-3 text-success"}):h.jsx(dx,{className:"w-3 h-3"})]})}function Tx({selectedId:a,onSelect:s,onNewSession:o}){const[i,c]=E.useState([]),[f,d]=E.useState(null),[m,b]=E.useState(""),[p,y]=E.useState(null),[v,x]=E.useState(!1),T=E.useRef(null),w=E.useRef(null);E.useEffect(()=>()=>{var O;T.current&&clearTimeout(T.current),(O=w.current)==null||O.abort()},[]),E.useEffect(()=>{let O=!0,C;const D=()=>{document.hidden||yt("/api/sessions").then(Q=>Q.json()).then(Q=>{O&&Array.isArray(Q)&&(c(Q),d(null))}).catch(Q=>{O&&d(Q instanceof Error?Q.message:"Failed to load sessions")})};D(),C=setInterval(D,15e3);const j=()=>{document.hidden||D()};return document.addEventListener("visibilitychange",j),()=>{O=!1,clearInterval(C),document.removeEventListener("visibilitychange",j)}},[]);const A=E.useCallback(O=>{var D;if((D=w.current)==null||D.abort(),!O.trim()){y(null),x(!1);return}x(!0);const C=new AbortController;w.current=C,yt(`/api/sessions/search?q=${encodeURIComponent(O)}`,{signal:C.signal}).then(j=>j.json()).then(j=>{C.signal.aborted||(Array.isArray(j)&&y(j),x(!1))}).catch(j=>{j instanceof DOMException&&j.name==="AbortError"||x(!1)})},[]),L=O=>{b(O),T.current&&clearTimeout(T.current),T.current=setTimeout(()=>A(O),300)},H=()=>{b(""),y(null),x(!1)},Z=m.trim().length>0;return h.jsxs("div",{className:"w-72 shrink-0 border-r border-border flex flex-col bg-card h-full overflow-hidden relative",children:[h.jsx("div",{className:"p-3",children:h.jsxs("div",{className:"relative",children:[h.jsx("svg",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})}),h.jsx("input",{type:"text",value:m,onChange:O=>L(O.target.value),placeholder:"Search sessions...",className:"w-full pl-8 pr-7 py-1.5 text-sm bg-background border border-input rounded-md placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),Z&&h.jsx("button",{onClick:H,className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:h.jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]})}),h.jsx("div",{className:"flex-1 overflow-y-auto scrollbar-thin",children:Z?h.jsxs(h.Fragment,{children:[v&&h.jsx("p",{className:"text-muted-foreground text-xs p-4 text-center",children:"Searching..."}),!v&&p&&p.length===0&&h.jsx("p",{className:"text-muted-foreground text-sm p-4 text-center",children:"No results"}),p==null?void 0:p.map(O=>h.jsxs("button",{onClick:()=>{s(O.id,O.hasPty),H()},className:`w-full text-left px-3 py-3 hover:bg-accent transition-colors ${a===O.id?"bg-accent border-l-2 border-l-primary":""}`,children:[h.jsx("p",{className:"text-sm text-foreground truncate",children:O.title}),h.jsxs("div",{className:"flex items-center gap-2 mt-0.5 text-xs text-muted-foreground",children:[h.jsx("span",{children:pp(O.lastActivity)}),h.jsx("span",{className:"opacity-30",children:"·"}),h.jsx("span",{children:gp(O.model)}),h.jsx("span",{className:"opacity-30",children:"·"}),h.jsxs("span",{children:[O.matches.length," hit",O.matches.length!==1?"s":""]})]}),O.matches[0]&&h.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5 line-clamp-2 leading-relaxed",children:[h.jsxs("span",{className:"text-muted-foreground/60",children:[O.matches[0].role,":"]})," ",O.matches[0].snippet]})]},O.id))]}):h.jsxs(h.Fragment,{children:[f&&h.jsx("p",{className:"text-destructive text-sm p-4 text-center",children:f}),!f&&i.length===0&&h.jsx("p",{className:"text-muted-foreground text-sm p-4 text-center",children:"No sessions yet"}),i.map(O=>h.jsx("button",{onClick:()=>s(O.id,O.hasPty),className:`group w-full text-left px-3 py-3 hover:bg-accent transition-colors ${a===O.id?"bg-accent border-l-2 border-l-primary":""}`,children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx("span",{className:`mt-1.5 w-2 h-2 rounded-full shrink-0 ${O.hasPty?"bg-success animate-pulse":"bg-muted-foreground/30"}`}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsx("p",{className:"text-sm text-foreground truncate",children:O.title}),h.jsxs("div",{className:"flex items-center gap-2 mt-1 text-xs text-muted-foreground",children:[h.jsx("span",{children:pp(O.lastActivity)}),h.jsx("span",{className:"opacity-30",children:"·"}),h.jsxs("span",{children:[O.messageCount," msgs"]}),h.jsx("span",{className:"opacity-30",children:"·"}),h.jsx("span",{children:gp(O.model)}),h.jsx("span",{className:"opacity-30",children:"·"}),h.jsx(vx,{id:O.id})]})]})]})},O.id))]})}),h.jsx("button",{onClick:o,className:"absolute bottom-4 right-4 p-2 text-muted-foreground hover:text-foreground transition-colors",title:"New Session",children:h.jsx(bx,{className:"w-5 h-5"})})]})}function of(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ua=of();function Ng(a){ua=a}var ia={exec:()=>null};function Xe(a,s=""){let o=typeof a=="string"?a:a.source,i={replace:(c,f)=>{let d=typeof f=="string"?f:f.source;return d=d.replace(It.caret,"$1"),o=o.replace(c,d),i},getRegex:()=>new RegExp(o,s)};return i}var Sx=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),It={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:a=>new RegExp(`^( {0,3}${a})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}#`),htmlBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:a=>new RegExp(`^ {0,${Math.min(3,a-1)}}>`)},Ex=/^(?:[ \t]*(?:\n|$))+/,wx=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ax=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,bi=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_x=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,uf=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,jg=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Og=Xe(jg).replace(/bull/g,uf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Rx=Xe(jg).replace(/bull/g,uf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),cf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Cx=/^[^\n]+/,ff=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,kx=Xe(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ff).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Nx=Xe(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,uf).getRegex(),ao="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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",df=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,jx=Xe("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",df).replace("tag",ao).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Dg=Xe(cf).replace("hr",bi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ao).getRegex(),Ox=Xe(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Dg).getRegex(),hf={blockquote:Ox,code:wx,def:kx,fences:Ax,heading:_x,hr:bi,html:jx,lheading:Og,list:Nx,newline:Ex,paragraph:Dg,table:ia,text:Cx},yp=Xe("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",bi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ao).getRegex(),Dx={...hf,lheading:Rx,table:yp,paragraph:Xe(cf).replace("hr",bi).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",yp).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ao).getRegex()},Mx={...hf,html:Xe(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",df).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:ia,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Xe(cf).replace("hr",bi).replace("heading",` *#{1,6} *[^
120
+ ]`).replace("lheading",Og).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Lx=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,zx=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Mg=/^( {2,}|\\)\n(?!\s*$)/,Ux=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,so=/[\p{P}\p{S}]/u,mf=/[\s\p{P}\p{S}]/u,Lg=/[^\s\p{P}\p{S}]/u,Bx=Xe(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,mf).getRegex(),zg=/(?!~)[\p{P}\p{S}]/u,Hx=/(?!~)[\s\p{P}\p{S}]/u,Ix=/(?:[^\s\p{P}\p{S}]|~)/u,Ug=/(?![*_])[\p{P}\p{S}]/u,Fx=/(?![*_])[\s\p{P}\p{S}]/u,Gx=/(?:[^\s\p{P}\p{S}]|[*_])/u,Yx=Xe(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Sx?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Bg=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,qx=Xe(Bg,"u").replace(/punct/g,so).getRegex(),Xx=Xe(Bg,"u").replace(/punct/g,zg).getRegex(),Hg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",$x=Xe(Hg,"gu").replace(/notPunctSpace/g,Lg).replace(/punctSpace/g,mf).replace(/punct/g,so).getRegex(),Zx=Xe(Hg,"gu").replace(/notPunctSpace/g,Ix).replace(/punctSpace/g,Hx).replace(/punct/g,zg).getRegex(),Vx=Xe("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Lg).replace(/punctSpace/g,mf).replace(/punct/g,so).getRegex(),Qx=Xe(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,Ug).getRegex(),Wx="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Kx=Xe(Wx,"gu").replace(/notPunctSpace/g,Gx).replace(/punctSpace/g,Fx).replace(/punct/g,Ug).getRegex(),Jx=Xe(/\\(punct)/,"gu").replace(/punct/g,so).getRegex(),Px=Xe(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ev=Xe(df).replace("(?:-->|$)","-->").getRegex(),tv=Xe("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",ev).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+[^`]*?`+(?!`)|[^\[\]\\`])*?/,nv=Xe(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Pr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ig=Xe(/^!?\[(label)\]\[(ref)\]/).replace("label",Pr).replace("ref",ff).getRegex(),Fg=Xe(/^!?\[(ref)\](?:\[\])?/).replace("ref",ff).getRegex(),lv=Xe("reflink|nolink(?!\\()","g").replace("reflink",Ig).replace("nolink",Fg).getRegex(),bp=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,pf={_backpedal:ia,anyPunctuation:Jx,autolink:Px,blockSkip:Yx,br:Mg,code:zx,del:ia,delLDelim:ia,delRDelim:ia,emStrongLDelim:qx,emStrongRDelimAst:$x,emStrongRDelimUnd:Vx,escape:Lx,link:nv,nolink:Fg,punctuation:Bx,reflink:Ig,reflinkSearch:lv,tag:tv,text:Ux,url:ia},av={...pf,link:Xe(/^!?\[(label)\]\((.*?)\)/).replace("label",Pr).getRegex(),reflink:Xe(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Pr).getRegex()},Xc={...pf,emStrongRDelimAst:Zx,emStrongLDelim:Xx,delLDelim:Qx,delRDelim:Kx,url:Xe(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",bp).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Xe(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",bp).getRegex()},sv={...Xc,br:Xe(Mg).replace("{2,}","*").getRegex(),text:Xe(Xc.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Br={normal:hf,gfm:Dx,pedantic:Mx},ni={normal:pf,gfm:Xc,breaks:sv,pedantic:av},iv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xp=a=>iv[a];function Hn(a,s){if(s){if(It.escapeTest.test(a))return a.replace(It.escapeReplace,xp)}else if(It.escapeTestNoEncode.test(a))return a.replace(It.escapeReplaceNoEncode,xp);return a}function vp(a){try{a=encodeURI(a).replace(It.percentDecode,"%")}catch{return null}return a}function Tp(a,s){var f;let o=a.replace(It.findPipe,(d,m,b)=>{let p=!1,y=m;for(;--y>=0&&b[y]==="\\";)p=!p;return p?"|":" |"}),i=o.split(It.splitPipe),c=0;if(i[0].trim()||i.shift(),i.length>0&&!((f=i.at(-1))!=null&&f.trim())&&i.pop(),s)if(i.length>s)i.splice(s);else for(;i.length<s;)i.push("");for(;c<i.length;c++)i[c]=i[c].trim().replace(It.slashPipe,"|");return i}function li(a,s,o){let i=a.length;if(i===0)return"";let c=0;for(;c<i&&a.charAt(i-c-1)===s;)c++;return a.slice(0,i-c)}function rv(a,s){if(a.indexOf(s[1])===-1)return-1;let o=0;for(let i=0;i<a.length;i++)if(a[i]==="\\")i++;else if(a[i]===s[0])o++;else if(a[i]===s[1]&&(o--,o<0))return i;return o>0?-2:-1}function ov(a,s=0){let o=s,i="";for(let c of a)if(c===" "){let f=4-o%4;i+=" ".repeat(f),o+=f}else i+=c,o++;return i}function Sp(a,s,o,i,c){let f=s.href,d=s.title||null,m=a[1].replace(c.other.outputLinkReplace,"$1");i.state.inLink=!0;let b={type:a[0].charAt(0)==="!"?"image":"link",raw:o,href:f,title:d,text:m,tokens:i.inlineTokens(m)};return i.state.inLink=!1,b}function uv(a,s,o){let i=a.match(o.other.indentCodeCompensation);if(i===null)return s;let c=i[1];return s.split(`
121
+ `).map(f=>{let d=f.match(o.other.beginningSpace);if(d===null)return f;let[m]=d;return m.length>=c.length?f.slice(c.length):f}).join(`
122
+ `)}var eo=class{constructor(a){ce(this,"options");ce(this,"rules");ce(this,"lexer");this.options=a||ua}space(a){let s=this.rules.block.newline.exec(a);if(s&&s[0].length>0)return{type:"space",raw:s[0]}}code(a){let s=this.rules.block.code.exec(a);if(s){let o=s[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:s[0],codeBlockStyle:"indented",text:this.options.pedantic?o:li(o,`
123
+ `)}}}fences(a){let s=this.rules.block.fences.exec(a);if(s){let o=s[0],i=uv(o,s[3]||"",this.rules);return{type:"code",raw:o,lang:s[2]?s[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):s[2],text:i}}}heading(a){let s=this.rules.block.heading.exec(a);if(s){let o=s[2].trim();if(this.rules.other.endingHash.test(o)){let i=li(o,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(o=i.trim())}return{type:"heading",raw:s[0],depth:s[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(a){let s=this.rules.block.hr.exec(a);if(s)return{type:"hr",raw:li(s[0],`
124
+ `)}}blockquote(a){let s=this.rules.block.blockquote.exec(a);if(s){let o=li(s[0],`
125
+ `).split(`
126
+ `),i="",c="",f=[];for(;o.length>0;){let d=!1,m=[],b;for(b=0;b<o.length;b++)if(this.rules.other.blockquoteStart.test(o[b]))m.push(o[b]),d=!0;else if(!d)m.push(o[b]);else break;o=o.slice(b);let p=m.join(`
127
+ `),y=p.replace(this.rules.other.blockquoteSetextReplace,`
128
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
129
+ ${p}`:p,c=c?`${c}
130
+ ${y}`:y;let v=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(y,f,!0),this.lexer.state.top=v,o.length===0)break;let x=f.at(-1);if((x==null?void 0:x.type)==="code")break;if((x==null?void 0:x.type)==="blockquote"){let T=x,w=T.raw+`
131
+ `+o.join(`
132
+ `),A=this.blockquote(w);f[f.length-1]=A,i=i.substring(0,i.length-T.raw.length)+A.raw,c=c.substring(0,c.length-T.text.length)+A.text;break}else if((x==null?void 0:x.type)==="list"){let T=x,w=T.raw+`
133
+ `+o.join(`
134
+ `),A=this.list(w);f[f.length-1]=A,i=i.substring(0,i.length-x.raw.length)+A.raw,c=c.substring(0,c.length-T.raw.length)+A.raw,o=w.substring(f.at(-1).raw.length).split(`
135
+ `);continue}}return{type:"blockquote",raw:i,tokens:f,text:c}}}list(a){var o,i;let s=this.rules.block.list.exec(a);if(s){let c=s[1].trim(),f=c.length>1,d={type:"list",raw:"",ordered:f,start:f?+c.slice(0,-1):"",loose:!1,items:[]};c=f?`\\d{1,9}\\${c.slice(-1)}`:`\\${c}`,this.options.pedantic&&(c=f?c:"[*+-]");let m=this.rules.other.listItemRegex(c),b=!1;for(;a;){let y=!1,v="",x="";if(!(s=m.exec(a))||this.rules.block.hr.test(a))break;v=s[0],a=a.substring(v.length);let T=ov(s[2].split(`
136
+ `,1)[0],s[1].length),w=a.split(`
137
+ `,1)[0],A=!T.trim(),L=0;if(this.options.pedantic?(L=2,x=T.trimStart()):A?L=s[1].length+1:(L=T.search(this.rules.other.nonSpaceChar),L=L>4?1:L,x=T.slice(L),L+=s[1].length),A&&this.rules.other.blankLine.test(w)&&(v+=w+`
138
+ `,a=a.substring(w.length+1),y=!0),!y){let H=this.rules.other.nextBulletRegex(L),Z=this.rules.other.hrRegex(L),O=this.rules.other.fencesBeginRegex(L),C=this.rules.other.headingBeginRegex(L),D=this.rules.other.htmlBeginRegex(L),j=this.rules.other.blockquoteBeginRegex(L);for(;a;){let Q=a.split(`
139
+ `,1)[0],fe;if(w=Q,this.options.pedantic?(w=w.replace(this.rules.other.listReplaceNesting," "),fe=w):fe=w.replace(this.rules.other.tabCharGlobal," "),O.test(w)||C.test(w)||D.test(w)||j.test(w)||H.test(w)||Z.test(w))break;if(fe.search(this.rules.other.nonSpaceChar)>=L||!w.trim())x+=`
140
+ `+fe.slice(L);else{if(A||T.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||O.test(T)||C.test(T)||Z.test(T))break;x+=`
141
+ `+w}A=!w.trim(),v+=Q+`
142
+ `,a=a.substring(Q.length+1),T=fe.slice(L)}}d.loose||(b?d.loose=!0:this.rules.other.doubleBlankLine.test(v)&&(b=!0)),d.items.push({type:"list_item",raw:v,task:!!this.options.gfm&&this.rules.other.listIsTask.test(x),loose:!1,text:x,tokens:[]}),d.raw+=v}let p=d.items.at(-1);if(p)p.raw=p.raw.trimEnd(),p.text=p.text.trimEnd();else return;d.raw=d.raw.trimEnd();for(let y of d.items){if(this.lexer.state.top=!1,y.tokens=this.lexer.blockTokens(y.text,[]),y.task){if(y.text=y.text.replace(this.rules.other.listReplaceTask,""),((o=y.tokens[0])==null?void 0:o.type)==="text"||((i=y.tokens[0])==null?void 0:i.type)==="paragraph"){y.tokens[0].raw=y.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),y.tokens[0].text=y.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let x=this.lexer.inlineQueue.length-1;x>=0;x--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[x].src)){this.lexer.inlineQueue[x].src=this.lexer.inlineQueue[x].src.replace(this.rules.other.listReplaceTask,"");break}}let v=this.rules.other.listTaskCheckbox.exec(y.raw);if(v){let x={type:"checkbox",raw:v[0]+" ",checked:v[0]!=="[ ]"};y.checked=x.checked,d.loose?y.tokens[0]&&["paragraph","text"].includes(y.tokens[0].type)&&"tokens"in y.tokens[0]&&y.tokens[0].tokens?(y.tokens[0].raw=x.raw+y.tokens[0].raw,y.tokens[0].text=x.raw+y.tokens[0].text,y.tokens[0].tokens.unshift(x)):y.tokens.unshift({type:"paragraph",raw:x.raw,text:x.raw,tokens:[x]}):y.tokens.unshift(x)}}if(!d.loose){let v=y.tokens.filter(T=>T.type==="space"),x=v.length>0&&v.some(T=>this.rules.other.anyLine.test(T.raw));d.loose=x}}if(d.loose)for(let y of d.items){y.loose=!0;for(let v of y.tokens)v.type==="text"&&(v.type="paragraph")}return d}}html(a){let s=this.rules.block.html.exec(a);if(s)return{type:"html",block:!0,raw:s[0],pre:s[1]==="pre"||s[1]==="script"||s[1]==="style",text:s[0]}}def(a){let s=this.rules.block.def.exec(a);if(s){let o=s[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=s[2]?s[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",c=s[3]?s[3].substring(1,s[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):s[3];return{type:"def",tag:o,raw:s[0],href:i,title:c}}}table(a){var d;let s=this.rules.block.table.exec(a);if(!s||!this.rules.other.tableDelimiter.test(s[2]))return;let o=Tp(s[1]),i=s[2].replace(this.rules.other.tableAlignChars,"").split("|"),c=(d=s[3])!=null&&d.trim()?s[3].replace(this.rules.other.tableRowBlankLine,"").split(`
143
+ `):[],f={type:"table",raw:s[0],header:[],align:[],rows:[]};if(o.length===i.length){for(let m of i)this.rules.other.tableAlignRight.test(m)?f.align.push("right"):this.rules.other.tableAlignCenter.test(m)?f.align.push("center"):this.rules.other.tableAlignLeft.test(m)?f.align.push("left"):f.align.push(null);for(let m=0;m<o.length;m++)f.header.push({text:o[m],tokens:this.lexer.inline(o[m]),header:!0,align:f.align[m]});for(let m of c)f.rows.push(Tp(m,f.header.length).map((b,p)=>({text:b,tokens:this.lexer.inline(b),header:!1,align:f.align[p]})));return f}}lheading(a){let s=this.rules.block.lheading.exec(a);if(s)return{type:"heading",raw:s[0],depth:s[2].charAt(0)==="="?1:2,text:s[1],tokens:this.lexer.inline(s[1])}}paragraph(a){let s=this.rules.block.paragraph.exec(a);if(s){let o=s[1].charAt(s[1].length-1)===`
144
+ `?s[1].slice(0,-1):s[1];return{type:"paragraph",raw:s[0],text:o,tokens:this.lexer.inline(o)}}}text(a){let s=this.rules.block.text.exec(a);if(s)return{type:"text",raw:s[0],text:s[0],tokens:this.lexer.inline(s[0])}}escape(a){let s=this.rules.inline.escape.exec(a);if(s)return{type:"escape",raw:s[0],text:s[1]}}tag(a){let s=this.rules.inline.tag.exec(a);if(s)return!this.lexer.state.inLink&&this.rules.other.startATag.test(s[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(s[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(s[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(s[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:s[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:s[0]}}link(a){let s=this.rules.inline.link.exec(a);if(s){let o=s[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(o)){if(!this.rules.other.endAngleBracket.test(o))return;let f=li(o.slice(0,-1),"\\");if((o.length-f.length)%2===0)return}else{let f=rv(s[2],"()");if(f===-2)return;if(f>-1){let d=(s[0].indexOf("!")===0?5:4)+s[1].length+f;s[2]=s[2].substring(0,f),s[0]=s[0].substring(0,d).trim(),s[3]=""}}let i=s[2],c="";if(this.options.pedantic){let f=this.rules.other.pedanticHrefTitle.exec(i);f&&(i=f[1],c=f[3])}else c=s[3]?s[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(o)?i=i.slice(1):i=i.slice(1,-1)),Sp(s,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:c&&c.replace(this.rules.inline.anyPunctuation,"$1")},s[0],this.lexer,this.rules)}}reflink(a,s){let o;if((o=this.rules.inline.reflink.exec(a))||(o=this.rules.inline.nolink.exec(a))){let i=(o[2]||o[1]).replace(this.rules.other.multipleSpaceGlobal," "),c=s[i.toLowerCase()];if(!c){let f=o[0].charAt(0);return{type:"text",raw:f,text:f}}return Sp(o,c,o[0],this.lexer,this.rules)}}emStrong(a,s,o=""){let i=this.rules.inline.emStrongLDelim.exec(a);if(!(!i||i[3]&&o.match(this.rules.other.unicodeAlphaNumeric))&&(!(i[1]||i[2])||!o||this.rules.inline.punctuation.exec(o))){let c=[...i[0]].length-1,f,d,m=c,b=0,p=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,s=s.slice(-1*a.length+c);(i=p.exec(s))!=null;){if(f=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!f)continue;if(d=[...f].length,i[3]||i[4]){m+=d;continue}else if((i[5]||i[6])&&c%3&&!((c+d)%3)){b+=d;continue}if(m-=d,m>0)continue;d=Math.min(d,d+m+b);let y=[...i[0]][0].length,v=a.slice(0,c+i.index+y+d);if(Math.min(c,d)%2){let T=v.slice(1,-1);return{type:"em",raw:v,text:T,tokens:this.lexer.inlineTokens(T)}}let x=v.slice(2,-2);return{type:"strong",raw:v,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(a){let s=this.rules.inline.code.exec(a);if(s){let o=s[2].replace(this.rules.other.newLineCharGlobal," "),i=this.rules.other.nonSpaceChar.test(o),c=this.rules.other.startingSpaceChar.test(o)&&this.rules.other.endingSpaceChar.test(o);return i&&c&&(o=o.substring(1,o.length-1)),{type:"codespan",raw:s[0],text:o}}}br(a){let s=this.rules.inline.br.exec(a);if(s)return{type:"br",raw:s[0]}}del(a,s,o=""){let i=this.rules.inline.delLDelim.exec(a);if(i&&(!i[1]||!o||this.rules.inline.punctuation.exec(o))){let c=[...i[0]].length-1,f,d,m=c,b=this.rules.inline.delRDelim;for(b.lastIndex=0,s=s.slice(-1*a.length+c);(i=b.exec(s))!=null;){if(f=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!f||(d=[...f].length,d!==c))continue;if(i[3]||i[4]){m+=d;continue}if(m-=d,m>0)continue;d=Math.min(d,d+m);let p=[...i[0]][0].length,y=a.slice(0,c+i.index+p+d),v=y.slice(c,-c);return{type:"del",raw:y,text:v,tokens:this.lexer.inlineTokens(v)}}}}autolink(a){let s=this.rules.inline.autolink.exec(a);if(s){let o,i;return s[2]==="@"?(o=s[1],i="mailto:"+o):(o=s[1],i=o),{type:"link",raw:s[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}url(a){var o;let s;if(s=this.rules.inline.url.exec(a)){let i,c;if(s[2]==="@")i=s[0],c="mailto:"+i;else{let f;do f=s[0],s[0]=((o=this.rules.inline._backpedal.exec(s[0]))==null?void 0:o[0])??"";while(f!==s[0]);i=s[0],s[1]==="www."?c="http://"+s[0]:c=s[0]}return{type:"link",raw:s[0],text:i,href:c,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(a){let s=this.rules.inline.text.exec(a);if(s){let o=this.lexer.state.inRawBlock;return{type:"text",raw:s[0],text:s[0],escaped:o}}}},Nn=class $c{constructor(s){ce(this,"tokens");ce(this,"options");ce(this,"state");ce(this,"inlineQueue");ce(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=s||ua,this.options.tokenizer=this.options.tokenizer||new eo,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let o={other:It,block:Br.normal,inline:ni.normal};this.options.pedantic?(o.block=Br.pedantic,o.inline=ni.pedantic):this.options.gfm&&(o.block=Br.gfm,this.options.breaks?o.inline=ni.breaks:o.inline=ni.gfm),this.tokenizer.rules=o}static get rules(){return{block:Br,inline:ni}}static lex(s,o){return new $c(o).lex(s)}static lexInline(s,o){return new $c(o).inlineTokens(s)}lex(s){s=s.replace(It.carriageReturn,`
145
+ `),this.blockTokens(s,this.tokens);for(let o=0;o<this.inlineQueue.length;o++){let i=this.inlineQueue[o];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(s,o=[],i=!1){var c,f,d;for(this.options.pedantic&&(s=s.replace(It.tabCharGlobal," ").replace(It.spaceLine,""));s;){let m;if((f=(c=this.options.extensions)==null?void 0:c.block)!=null&&f.some(p=>(m=p.call({lexer:this},s,o))?(s=s.substring(m.raw.length),o.push(m),!0):!1))continue;if(m=this.tokenizer.space(s)){s=s.substring(m.raw.length);let p=o.at(-1);m.raw.length===1&&p!==void 0?p.raw+=`
146
+ `:o.push(m);continue}if(m=this.tokenizer.code(s)){s=s.substring(m.raw.length);let p=o.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
147
+ `)?"":`
148
+ `)+m.raw,p.text+=`
149
+ `+m.text,this.inlineQueue.at(-1).src=p.text):o.push(m);continue}if(m=this.tokenizer.fences(s)){s=s.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.heading(s)){s=s.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.hr(s)){s=s.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.blockquote(s)){s=s.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.list(s)){s=s.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.html(s)){s=s.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.def(s)){s=s.substring(m.raw.length);let p=o.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
150
+ `)?"":`
151
+ `)+m.raw,p.text+=`
152
+ `+m.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[m.tag]||(this.tokens.links[m.tag]={href:m.href,title:m.title},o.push(m));continue}if(m=this.tokenizer.table(s)){s=s.substring(m.raw.length),o.push(m);continue}if(m=this.tokenizer.lheading(s)){s=s.substring(m.raw.length),o.push(m);continue}let b=s;if((d=this.options.extensions)!=null&&d.startBlock){let p=1/0,y=s.slice(1),v;this.options.extensions.startBlock.forEach(x=>{v=x.call({lexer:this},y),typeof v=="number"&&v>=0&&(p=Math.min(p,v))}),p<1/0&&p>=0&&(b=s.substring(0,p+1))}if(this.state.top&&(m=this.tokenizer.paragraph(b))){let p=o.at(-1);i&&(p==null?void 0:p.type)==="paragraph"?(p.raw+=(p.raw.endsWith(`
153
+ `)?"":`
154
+ `)+m.raw,p.text+=`
155
+ `+m.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):o.push(m),i=b.length!==s.length,s=s.substring(m.raw.length);continue}if(m=this.tokenizer.text(s)){s=s.substring(m.raw.length);let p=o.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=(p.raw.endsWith(`
156
+ `)?"":`
157
+ `)+m.raw,p.text+=`
158
+ `+m.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):o.push(m);continue}if(s){let p="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return this.state.top=!0,o}inline(s,o=[]){return this.inlineQueue.push({src:s,tokens:o}),o}inlineTokens(s,o=[]){var b,p,y,v,x;let i=s,c=null;if(this.tokens.links){let T=Object.keys(this.tokens.links);if(T.length>0)for(;(c=this.tokenizer.rules.inline.reflinkSearch.exec(i))!=null;)T.includes(c[0].slice(c[0].lastIndexOf("[")+1,-1))&&(i=i.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+i.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(c=this.tokenizer.rules.inline.anyPunctuation.exec(i))!=null;)i=i.slice(0,c.index)+"++"+i.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let f;for(;(c=this.tokenizer.rules.inline.blockSkip.exec(i))!=null;)f=c[2]?c[2].length:0,i=i.slice(0,c.index+f)+"["+"a".repeat(c[0].length-f-2)+"]"+i.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);i=((p=(b=this.options.hooks)==null?void 0:b.emStrongMask)==null?void 0:p.call({lexer:this},i))??i;let d=!1,m="";for(;s;){d||(m=""),d=!1;let T;if((v=(y=this.options.extensions)==null?void 0:y.inline)!=null&&v.some(A=>(T=A.call({lexer:this},s,o))?(s=s.substring(T.raw.length),o.push(T),!0):!1))continue;if(T=this.tokenizer.escape(s)){s=s.substring(T.raw.length),o.push(T);continue}if(T=this.tokenizer.tag(s)){s=s.substring(T.raw.length),o.push(T);continue}if(T=this.tokenizer.link(s)){s=s.substring(T.raw.length),o.push(T);continue}if(T=this.tokenizer.reflink(s,this.tokens.links)){s=s.substring(T.raw.length);let A=o.at(-1);T.type==="text"&&(A==null?void 0:A.type)==="text"?(A.raw+=T.raw,A.text+=T.text):o.push(T);continue}if(T=this.tokenizer.emStrong(s,i,m)){s=s.substring(T.raw.length),o.push(T);continue}if(T=this.tokenizer.codespan(s)){s=s.substring(T.raw.length),o.push(T);continue}if(T=this.tokenizer.br(s)){s=s.substring(T.raw.length),o.push(T);continue}if(T=this.tokenizer.del(s,i,m)){s=s.substring(T.raw.length),o.push(T);continue}if(T=this.tokenizer.autolink(s)){s=s.substring(T.raw.length),o.push(T);continue}if(!this.state.inLink&&(T=this.tokenizer.url(s))){s=s.substring(T.raw.length),o.push(T);continue}let w=s;if((x=this.options.extensions)!=null&&x.startInline){let A=1/0,L=s.slice(1),H;this.options.extensions.startInline.forEach(Z=>{H=Z.call({lexer:this},L),typeof H=="number"&&H>=0&&(A=Math.min(A,H))}),A<1/0&&A>=0&&(w=s.substring(0,A+1))}if(T=this.tokenizer.inlineText(w)){s=s.substring(T.raw.length),T.raw.slice(-1)!=="_"&&(m=T.raw.slice(-1)),d=!0;let A=o.at(-1);(A==null?void 0:A.type)==="text"?(A.raw+=T.raw,A.text+=T.text):o.push(T);continue}if(s){let A="Infinite loop on byte: "+s.charCodeAt(0);if(this.options.silent){console.error(A);break}else throw new Error(A)}}return o}},to=class{constructor(a){ce(this,"options");ce(this,"parser");this.options=a||ua}space(a){return""}code({text:a,lang:s,escaped:o}){var f;let i=(f=(s||"").match(It.notSpaceStart))==null?void 0:f[0],c=a.replace(It.endingNewline,"")+`
159
+ `;return i?'<pre><code class="language-'+Hn(i)+'">'+(o?c:Hn(c,!0))+`</code></pre>
160
+ `:"<pre><code>"+(o?c:Hn(c,!0))+`</code></pre>
161
+ `}blockquote({tokens:a}){return`<blockquote>
162
+ ${this.parser.parse(a)}</blockquote>
163
+ `}html({text:a}){return a}def(a){return""}heading({tokens:a,depth:s}){return`<h${s}>${this.parser.parseInline(a)}</h${s}>
164
+ `}hr(a){return`<hr>
165
+ `}list(a){let s=a.ordered,o=a.start,i="";for(let d=0;d<a.items.length;d++){let m=a.items[d];i+=this.listitem(m)}let c=s?"ol":"ul",f=s&&o!==1?' start="'+o+'"':"";return"<"+c+f+`>
166
+ `+i+"</"+c+`>
167
+ `}listitem(a){return`<li>${this.parser.parse(a.tokens)}</li>
168
+ `}checkbox({checked:a}){return"<input "+(a?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:a}){return`<p>${this.parser.parseInline(a)}</p>
169
+ `}table(a){let s="",o="";for(let c=0;c<a.header.length;c++)o+=this.tablecell(a.header[c]);s+=this.tablerow({text:o});let i="";for(let c=0;c<a.rows.length;c++){let f=a.rows[c];o="";for(let d=0;d<f.length;d++)o+=this.tablecell(f[d]);i+=this.tablerow({text:o})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
170
+ <thead>
171
+ `+s+`</thead>
172
+ `+i+`</table>
173
+ `}tablerow({text:a}){return`<tr>
174
+ ${a}</tr>
175
+ `}tablecell(a){let s=this.parser.parseInline(a.tokens),o=a.header?"th":"td";return(a.align?`<${o} align="${a.align}">`:`<${o}>`)+s+`</${o}>
176
+ `}strong({tokens:a}){return`<strong>${this.parser.parseInline(a)}</strong>`}em({tokens:a}){return`<em>${this.parser.parseInline(a)}</em>`}codespan({text:a}){return`<code>${Hn(a,!0)}</code>`}br(a){return"<br>"}del({tokens:a}){return`<del>${this.parser.parseInline(a)}</del>`}link({href:a,title:s,tokens:o}){let i=this.parser.parseInline(o),c=vp(a);if(c===null)return i;a=c;let f='<a href="'+a+'"';return s&&(f+=' title="'+Hn(s)+'"'),f+=">"+i+"</a>",f}image({href:a,title:s,text:o,tokens:i}){i&&(o=this.parser.parseInline(i,this.parser.textRenderer));let c=vp(a);if(c===null)return Hn(o);a=c;let f=`<img src="${a}" alt="${Hn(o)}"`;return s&&(f+=` title="${Hn(s)}"`),f+=">",f}text(a){return"tokens"in a&&a.tokens?this.parser.parseInline(a.tokens):"escaped"in a&&a.escaped?a.text:Hn(a.text)}},gf=class{strong({text:a}){return a}em({text:a}){return a}codespan({text:a}){return a}del({text:a}){return a}html({text:a}){return a}text({text:a}){return a}link({text:a}){return""+a}image({text:a}){return""+a}br(){return""}checkbox({raw:a}){return a}},jn=class Zc{constructor(s){ce(this,"options");ce(this,"renderer");ce(this,"textRenderer");this.options=s||ua,this.options.renderer=this.options.renderer||new to,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new gf}static parse(s,o){return new Zc(o).parse(s)}static parseInline(s,o){return new Zc(o).parseInline(s)}parse(s){var i,c;let o="";for(let f=0;f<s.length;f++){let d=s[f];if((c=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&c[d.type]){let b=d,p=this.options.extensions.renderers[b.type].call({parser:this},b);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(b.type)){o+=p||"";continue}}let m=d;switch(m.type){case"space":{o+=this.renderer.space(m);break}case"hr":{o+=this.renderer.hr(m);break}case"heading":{o+=this.renderer.heading(m);break}case"code":{o+=this.renderer.code(m);break}case"table":{o+=this.renderer.table(m);break}case"blockquote":{o+=this.renderer.blockquote(m);break}case"list":{o+=this.renderer.list(m);break}case"checkbox":{o+=this.renderer.checkbox(m);break}case"html":{o+=this.renderer.html(m);break}case"def":{o+=this.renderer.def(m);break}case"paragraph":{o+=this.renderer.paragraph(m);break}case"text":{o+=this.renderer.text(m);break}default:{let b='Token with "'+m.type+'" type was not found.';if(this.options.silent)return console.error(b),"";throw new Error(b)}}}return o}parseInline(s,o=this.renderer){var c,f;let i="";for(let d=0;d<s.length;d++){let m=s[d];if((f=(c=this.options.extensions)==null?void 0:c.renderers)!=null&&f[m.type]){let p=this.options.extensions.renderers[m.type].call({parser:this},m);if(p!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(m.type)){i+=p||"";continue}}let b=m;switch(b.type){case"escape":{i+=o.text(b);break}case"html":{i+=o.html(b);break}case"link":{i+=o.link(b);break}case"image":{i+=o.image(b);break}case"checkbox":{i+=o.checkbox(b);break}case"strong":{i+=o.strong(b);break}case"em":{i+=o.em(b);break}case"codespan":{i+=o.codespan(b);break}case"br":{i+=o.br(b);break}case"del":{i+=o.del(b);break}case"text":{i+=o.text(b);break}default:{let p='Token with "'+b.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return i}},$r,mi=($r=class{constructor(a){ce(this,"options");ce(this,"block");this.options=a||ua}preprocess(a){return a}postprocess(a){return a}processAllTokens(a){return a}emStrongMask(a){return a}provideLexer(){return this.block?Nn.lex:Nn.lexInline}provideParser(){return this.block?jn.parse:jn.parseInline}},ce($r,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),ce($r,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),$r),cv=class{constructor(...a){ce(this,"defaults",of());ce(this,"options",this.setOptions);ce(this,"parse",this.parseMarkdown(!0));ce(this,"parseInline",this.parseMarkdown(!1));ce(this,"Parser",jn);ce(this,"Renderer",to);ce(this,"TextRenderer",gf);ce(this,"Lexer",Nn);ce(this,"Tokenizer",eo);ce(this,"Hooks",mi);this.use(...a)}walkTokens(a,s){var i,c;let o=[];for(let f of a)switch(o=o.concat(s.call(this,f)),f.type){case"table":{let d=f;for(let m of d.header)o=o.concat(this.walkTokens(m.tokens,s));for(let m of d.rows)for(let b of m)o=o.concat(this.walkTokens(b.tokens,s));break}case"list":{let d=f;o=o.concat(this.walkTokens(d.items,s));break}default:{let d=f;(c=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&c[d.type]?this.defaults.extensions.childTokens[d.type].forEach(m=>{let b=d[m].flat(1/0);o=o.concat(this.walkTokens(b,s))}):d.tokens&&(o=o.concat(this.walkTokens(d.tokens,s)))}}return o}use(...a){let s=this.defaults.extensions||{renderers:{},childTokens:{}};return a.forEach(o=>{let i={...o};if(i.async=this.defaults.async||i.async||!1,o.extensions&&(o.extensions.forEach(c=>{if(!c.name)throw new Error("extension name required");if("renderer"in c){let f=s.renderers[c.name];f?s.renderers[c.name]=function(...d){let m=c.renderer.apply(this,d);return m===!1&&(m=f.apply(this,d)),m}:s.renderers[c.name]=c.renderer}if("tokenizer"in c){if(!c.level||c.level!=="block"&&c.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let f=s[c.level];f?f.unshift(c.tokenizer):s[c.level]=[c.tokenizer],c.start&&(c.level==="block"?s.startBlock?s.startBlock.push(c.start):s.startBlock=[c.start]:c.level==="inline"&&(s.startInline?s.startInline.push(c.start):s.startInline=[c.start]))}"childTokens"in c&&c.childTokens&&(s.childTokens[c.name]=c.childTokens)}),i.extensions=s),o.renderer){let c=this.defaults.renderer||new to(this.defaults);for(let f in o.renderer){if(!(f in c))throw new Error(`renderer '${f}' does not exist`);if(["options","parser"].includes(f))continue;let d=f,m=o.renderer[d],b=c[d];c[d]=(...p)=>{let y=m.apply(c,p);return y===!1&&(y=b.apply(c,p)),y||""}}i.renderer=c}if(o.tokenizer){let c=this.defaults.tokenizer||new eo(this.defaults);for(let f in o.tokenizer){if(!(f in c))throw new Error(`tokenizer '${f}' does not exist`);if(["options","rules","lexer"].includes(f))continue;let d=f,m=o.tokenizer[d],b=c[d];c[d]=(...p)=>{let y=m.apply(c,p);return y===!1&&(y=b.apply(c,p)),y}}i.tokenizer=c}if(o.hooks){let c=this.defaults.hooks||new mi;for(let f in o.hooks){if(!(f in c))throw new Error(`hook '${f}' does not exist`);if(["options","block"].includes(f))continue;let d=f,m=o.hooks[d],b=c[d];mi.passThroughHooks.has(f)?c[d]=p=>{if(this.defaults.async&&mi.passThroughHooksRespectAsync.has(f))return(async()=>{let v=await m.call(c,p);return b.call(c,v)})();let y=m.call(c,p);return b.call(c,y)}:c[d]=(...p)=>{if(this.defaults.async)return(async()=>{let v=await m.apply(c,p);return v===!1&&(v=await b.apply(c,p)),v})();let y=m.apply(c,p);return y===!1&&(y=b.apply(c,p)),y}}i.hooks=c}if(o.walkTokens){let c=this.defaults.walkTokens,f=o.walkTokens;i.walkTokens=function(d){let m=[];return m.push(f.call(this,d)),c&&(m=m.concat(c.call(this,d))),m}}this.defaults={...this.defaults,...i}}),this}setOptions(a){return this.defaults={...this.defaults,...a},this}lexer(a,s){return Nn.lex(a,s??this.defaults)}parser(a,s){return jn.parse(a,s??this.defaults)}parseMarkdown(a){return(s,o)=>{let i={...o},c={...this.defaults,...i},f=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&i.async===!1)return f(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof s>"u"||s===null)return f(new Error("marked(): input parameter is undefined or null"));if(typeof s!="string")return f(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected"));if(c.hooks&&(c.hooks.options=c,c.hooks.block=a),c.async)return(async()=>{let d=c.hooks?await c.hooks.preprocess(s):s,m=await(c.hooks?await c.hooks.provideLexer():a?Nn.lex:Nn.lexInline)(d,c),b=c.hooks?await c.hooks.processAllTokens(m):m;c.walkTokens&&await Promise.all(this.walkTokens(b,c.walkTokens));let p=await(c.hooks?await c.hooks.provideParser():a?jn.parse:jn.parseInline)(b,c);return c.hooks?await c.hooks.postprocess(p):p})().catch(f);try{c.hooks&&(s=c.hooks.preprocess(s));let d=(c.hooks?c.hooks.provideLexer():a?Nn.lex:Nn.lexInline)(s,c);c.hooks&&(d=c.hooks.processAllTokens(d)),c.walkTokens&&this.walkTokens(d,c.walkTokens);let m=(c.hooks?c.hooks.provideParser():a?jn.parse:jn.parseInline)(d,c);return c.hooks&&(m=c.hooks.postprocess(m)),m}catch(d){return f(d)}}}onError(a,s){return o=>{if(o.message+=`
177
+ Please report this to https://github.com/markedjs/marked.`,a){let i="<p>An error occurred:</p><pre>"+Hn(o.message+"",!0)+"</pre>";return s?Promise.resolve(i):i}if(s)return Promise.reject(o);throw o}}},oa=new cv;function We(a,s){return oa.parse(a,s)}We.options=We.setOptions=function(a){return oa.setOptions(a),We.defaults=oa.defaults,Ng(We.defaults),We};We.getDefaults=of;We.defaults=ua;We.use=function(...a){return oa.use(...a),We.defaults=oa.defaults,Ng(We.defaults),We};We.walkTokens=function(a,s){return oa.walkTokens(a,s)};We.parseInline=oa.parseInline;We.Parser=jn;We.parser=jn.parse;We.Renderer=to;We.TextRenderer=gf;We.Lexer=Nn;We.lexer=Nn.lex;We.Tokenizer=eo;We.Hooks=mi;We.parse=We;We.options;We.setOptions;We.use;We.walkTokens;We.parseInline;jn.parse;Nn.lex;/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:Gg,setPrototypeOf:Ep,isFrozen:fv,getPrototypeOf:dv,getOwnPropertyDescriptor:hv}=Object;let{freeze:Ft,seal:wn,create:Zr}=Object,{apply:Vc,construct:Qc}=typeof Reflect<"u"&&Reflect;Ft||(Ft=function(s){return s});wn||(wn=function(s){return s});Vc||(Vc=function(s,o){for(var i=arguments.length,c=new Array(i>2?i-2:0),f=2;f<i;f++)c[f-2]=arguments[f];return s.apply(o,c)});Qc||(Qc=function(s){for(var o=arguments.length,i=new Array(o>1?o-1:0),c=1;c<o;c++)i[c-1]=arguments[c];return new s(...i)});const Hr=Gt(Array.prototype.forEach),mv=Gt(Array.prototype.lastIndexOf),wp=Gt(Array.prototype.pop),ai=Gt(Array.prototype.push),pv=Gt(Array.prototype.splice),Vr=Gt(String.prototype.toLowerCase),_c=Gt(String.prototype.toString),Rc=Gt(String.prototype.match),si=Gt(String.prototype.replace),gv=Gt(String.prototype.indexOf),yv=Gt(String.prototype.trim),on=Gt(Object.prototype.hasOwnProperty),Ht=Gt(RegExp.prototype.test),ii=bv(TypeError);function Gt(a){return function(s){s instanceof RegExp&&(s.lastIndex=0);for(var o=arguments.length,i=new Array(o>1?o-1:0),c=1;c<o;c++)i[c-1]=arguments[c];return Vc(a,s,i)}}function bv(a){return function(){for(var s=arguments.length,o=new Array(s),i=0;i<s;i++)o[i]=arguments[i];return Qc(a,o)}}function Ue(a,s){let o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Vr;Ep&&Ep(a,null);let i=s.length;for(;i--;){let c=s[i];if(typeof c=="string"){const f=o(c);f!==c&&(fv(s)||(s[i]=f),c=f)}a[c]=!0}return a}function xv(a){for(let s=0;s<a.length;s++)on(a,s)||(a[s]=null);return a}function In(a){const s=Zr(null);for(const[o,i]of Gg(a))on(a,o)&&(Array.isArray(i)?s[o]=xv(i):i&&typeof i=="object"&&i.constructor===Object?s[o]=In(i):s[o]=i);return s}function ri(a,s){for(;a!==null;){const i=hv(a,s);if(i){if(i.get)return Gt(i.get);if(typeof i.value=="function")return Gt(i.value)}a=dv(a)}function o(){return null}return o}const Ap=Ft(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Cc=Ft(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),kc=Ft(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),vv=Ft(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Nc=Ft(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Tv=Ft(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_p=Ft(["#text"]),Rp=Ft(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),jc=Ft(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Cp=Ft(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Ir=Ft(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Sv=wn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ev=wn(/<%[\w\W]*|[\w\W]*%>/gm),wv=wn(/\$\{[\w\W]*/gm),Av=wn(/^data-[\-\w.\u00B7-\uFFFF]+$/),_v=wn(/^aria-[\-\w]+$/),Yg=wn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Rv=wn(/^(?:\w+script|data):/i),Cv=wn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),qg=wn(/^html$/i),kv=wn(/^[a-z][.\w]*(-[.\w]+)+$/i);var kp=Object.freeze({__proto__:null,ARIA_ATTR:_v,ATTR_WHITESPACE:Cv,CUSTOM_ELEMENT:kv,DATA_ATTR:Av,DOCTYPE_NAME:qg,ERB_EXPR:Ev,IS_ALLOWED_URI:Yg,IS_SCRIPT_OR_DATA:Rv,MUSTACHE_EXPR:Sv,TMPLIT_EXPR:wv});const oi={element:1,text:3,progressingInstruction:7,comment:8,document:9},Nv=function(){return typeof window>"u"?null:window},jv=function(s,o){if(typeof s!="object"||typeof s.createPolicy!="function")return null;let i=null;const c="data-tt-policy-suffix";o&&o.hasAttribute(c)&&(i=o.getAttribute(c));const f="dompurify"+(i?"#"+i:"");try{return s.createPolicy(f,{createHTML(d){return d},createScriptURL(d){return d}})}catch{return console.warn("TrustedTypes policy "+f+" could not be created."),null}},Np=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Xg(){let a=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Nv();const s=ye=>Xg(ye);if(s.version="3.3.3",s.removed=[],!a||!a.document||a.document.nodeType!==oi.document||!a.Element)return s.isSupported=!1,s;let{document:o}=a;const i=o,c=i.currentScript,{DocumentFragment:f,HTMLTemplateElement:d,Node:m,Element:b,NodeFilter:p,NamedNodeMap:y=a.NamedNodeMap||a.MozNamedAttrMap,HTMLFormElement:v,DOMParser:x,trustedTypes:T}=a,w=b.prototype,A=ri(w,"cloneNode"),L=ri(w,"remove"),H=ri(w,"nextSibling"),Z=ri(w,"childNodes"),O=ri(w,"parentNode");if(typeof d=="function"){const ye=o.createElement("template");ye.content&&ye.content.ownerDocument&&(o=ye.content.ownerDocument)}let C,D="";const{implementation:j,createNodeIterator:Q,createDocumentFragment:fe,getElementsByTagName:we}=o,{importNode:ie}=i;let ue=Np();s.isSupported=typeof Gg=="function"&&typeof O=="function"&&j&&j.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:ge,ERB_EXPR:Ee,TMPLIT_EXPR:se,DATA_ATTR:me,ARIA_ATTR:G,IS_SCRIPT_OR_DATA:le,ATTR_WHITESPACE:he,CUSTOM_ELEMENT:re}=kp;let{IS_ALLOWED_URI:W}=kp,_=null;const q=Ue({},[...Ap,...Cc,...kc,...Nc,..._p]);let $=null;const Y=Ue({},[...Rp,...jc,...Cp,...Ir]);let P=Object.seal(Zr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),M=null,I=null;const ne=Object.seal(Zr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let K=!0,ee=!0,ve=!1,_e=!0,Pe=!1,Ne=!0,Me=!1,lt=!1,Le=!1,Ce=!1,je=!1,_t=!1,cn=!0,xi=!1;const co="user-content-";let jt=!0,Fl=!1,qn={},Jt=null;const pl=Ue({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let vi=null;const ts=Ue({},["audio","video","img","source","image","track"]);let ns=null;const Ti=Ue({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Dn="http://www.w3.org/1998/Math/MathML",Rt="http://www.w3.org/2000/svg",Ct="http://www.w3.org/1999/xhtml";let bt=Ct,ls=!1,as=null;const fo=Ue({},[Dn,Rt,Ct],_c);let Xn=Ue({},["mi","mo","mn","ms","mtext"]),$n=Ue({},["annotation-xml"]);const ca=Ue({},["title","style","font","a","script"]);let Pt=null;const fa=["application/xhtml+xml","text/html"],Gl="text/html";let mt=null,Zn=null;const ss=o.createElement("form"),gl=function(k){return k instanceof RegExp||k instanceof Function},is=function(){let k=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Zn&&Zn===k)){if((!k||typeof k!="object")&&(k={}),k=In(k),Pt=fa.indexOf(k.PARSER_MEDIA_TYPE)===-1?Gl:k.PARSER_MEDIA_TYPE,mt=Pt==="application/xhtml+xml"?_c:Vr,_=on(k,"ALLOWED_TAGS")?Ue({},k.ALLOWED_TAGS,mt):q,$=on(k,"ALLOWED_ATTR")?Ue({},k.ALLOWED_ATTR,mt):Y,as=on(k,"ALLOWED_NAMESPACES")?Ue({},k.ALLOWED_NAMESPACES,_c):fo,ns=on(k,"ADD_URI_SAFE_ATTR")?Ue(In(Ti),k.ADD_URI_SAFE_ATTR,mt):Ti,vi=on(k,"ADD_DATA_URI_TAGS")?Ue(In(ts),k.ADD_DATA_URI_TAGS,mt):ts,Jt=on(k,"FORBID_CONTENTS")?Ue({},k.FORBID_CONTENTS,mt):pl,M=on(k,"FORBID_TAGS")?Ue({},k.FORBID_TAGS,mt):In({}),I=on(k,"FORBID_ATTR")?Ue({},k.FORBID_ATTR,mt):In({}),qn=on(k,"USE_PROFILES")?k.USE_PROFILES:!1,K=k.ALLOW_ARIA_ATTR!==!1,ee=k.ALLOW_DATA_ATTR!==!1,ve=k.ALLOW_UNKNOWN_PROTOCOLS||!1,_e=k.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Pe=k.SAFE_FOR_TEMPLATES||!1,Ne=k.SAFE_FOR_XML!==!1,Me=k.WHOLE_DOCUMENT||!1,Ce=k.RETURN_DOM||!1,je=k.RETURN_DOM_FRAGMENT||!1,_t=k.RETURN_TRUSTED_TYPE||!1,Le=k.FORCE_BODY||!1,cn=k.SANITIZE_DOM!==!1,xi=k.SANITIZE_NAMED_PROPS||!1,jt=k.KEEP_CONTENT!==!1,Fl=k.IN_PLACE||!1,W=k.ALLOWED_URI_REGEXP||Yg,bt=k.NAMESPACE||Ct,Xn=k.MATHML_TEXT_INTEGRATION_POINTS||Xn,$n=k.HTML_INTEGRATION_POINTS||$n,P=k.CUSTOM_ELEMENT_HANDLING||{},k.CUSTOM_ELEMENT_HANDLING&&gl(k.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(P.tagNameCheck=k.CUSTOM_ELEMENT_HANDLING.tagNameCheck),k.CUSTOM_ELEMENT_HANDLING&&gl(k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(P.attributeNameCheck=k.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),k.CUSTOM_ELEMENT_HANDLING&&typeof k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(P.allowCustomizedBuiltInElements=k.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Pe&&(ee=!1),je&&(Ce=!0),qn&&(_=Ue({},_p),$=Zr(null),qn.html===!0&&(Ue(_,Ap),Ue($,Rp)),qn.svg===!0&&(Ue(_,Cc),Ue($,jc),Ue($,Ir)),qn.svgFilters===!0&&(Ue(_,kc),Ue($,jc),Ue($,Ir)),qn.mathMl===!0&&(Ue(_,Nc),Ue($,Cp),Ue($,Ir))),on(k,"ADD_TAGS")||(ne.tagCheck=null),on(k,"ADD_ATTR")||(ne.attributeCheck=null),k.ADD_TAGS&&(typeof k.ADD_TAGS=="function"?ne.tagCheck=k.ADD_TAGS:(_===q&&(_=In(_)),Ue(_,k.ADD_TAGS,mt))),k.ADD_ATTR&&(typeof k.ADD_ATTR=="function"?ne.attributeCheck=k.ADD_ATTR:($===Y&&($=In($)),Ue($,k.ADD_ATTR,mt))),k.ADD_URI_SAFE_ATTR&&Ue(ns,k.ADD_URI_SAFE_ATTR,mt),k.FORBID_CONTENTS&&(Jt===pl&&(Jt=In(Jt)),Ue(Jt,k.FORBID_CONTENTS,mt)),k.ADD_FORBID_CONTENTS&&(Jt===pl&&(Jt=In(Jt)),Ue(Jt,k.ADD_FORBID_CONTENTS,mt)),jt&&(_["#text"]=!0),Me&&Ue(_,["html","head","body"]),_.table&&(Ue(_,["tbody"]),delete M.tbody),k.TRUSTED_TYPES_POLICY){if(typeof k.TRUSTED_TYPES_POLICY.createHTML!="function")throw ii('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof k.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw ii('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');C=k.TRUSTED_TYPES_POLICY,D=C.createHTML("")}else C===void 0&&(C=jv(T,c)),C!==null&&typeof D=="string"&&(D=C.createHTML(""));Ft&&Ft(k),Zn=k}},rs=Ue({},[...Cc,...kc,...vv]),os=Ue({},[...Nc,...Tv]),Si=function(k){let ae=O(k);(!ae||!ae.tagName)&&(ae={namespaceURI:bt,tagName:"template"});const de=Vr(k.tagName),Qe=Vr(ae.tagName);return as[k.namespaceURI]?k.namespaceURI===Rt?ae.namespaceURI===Ct?de==="svg":ae.namespaceURI===Dn?de==="svg"&&(Qe==="annotation-xml"||Xn[Qe]):!!rs[de]:k.namespaceURI===Dn?ae.namespaceURI===Ct?de==="math":ae.namespaceURI===Rt?de==="math"&&$n[Qe]:!!os[de]:k.namespaceURI===Ct?ae.namespaceURI===Rt&&!$n[Qe]||ae.namespaceURI===Dn&&!Xn[Qe]?!1:!os[de]&&(ca[de]||!rs[de]):!!(Pt==="application/xhtml+xml"&&as[k.namespaceURI]):!1},Yt=function(k){ai(s.removed,{element:k});try{O(k).removeChild(k)}catch{L(k)}},An=function(k,ae){try{ai(s.removed,{attribute:ae.getAttributeNode(k),from:ae})}catch{ai(s.removed,{attribute:null,from:ae})}if(ae.removeAttribute(k),k==="is")if(Ce||je)try{Yt(ae)}catch{}else try{ae.setAttribute(k,"")}catch{}},us=function(k){let ae=null,de=null;if(Le)k="<remove></remove>"+k;else{const ze=Rc(k,/^[\r\n\t ]+/);de=ze&&ze[0]}Pt==="application/xhtml+xml"&&bt===Ct&&(k='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+k+"</body></html>");const Qe=C?C.createHTML(k):k;if(bt===Ct)try{ae=new x().parseFromString(Qe,Pt)}catch{}if(!ae||!ae.documentElement){ae=j.createDocument(bt,"template",null);try{ae.documentElement.innerHTML=ls?D:Qe}catch{}}const ft=ae.body||ae.documentElement;return k&&de&&ft.insertBefore(o.createTextNode(de),ft.childNodes[0]||null),bt===Ct?we.call(ae,Me?"html":"body")[0]:Me?ae.documentElement:ft},cs=function(k){return Q.call(k.ownerDocument||k,k,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},fn=function(k){return k instanceof v&&(typeof k.nodeName!="string"||typeof k.textContent!="string"||typeof k.removeChild!="function"||!(k.attributes instanceof y)||typeof k.removeAttribute!="function"||typeof k.setAttribute!="function"||typeof k.namespaceURI!="string"||typeof k.insertBefore!="function"||typeof k.hasChildNodes!="function")},xt=function(k){return typeof m=="function"&&k instanceof m};function ot(ye,k,ae){Hr(ye,de=>{de.call(s,k,ae,Zn)})}const Vn=function(k){let ae=null;if(ot(ue.beforeSanitizeElements,k,null),fn(k))return Yt(k),!0;const de=mt(k.nodeName);if(ot(ue.uponSanitizeElement,k,{tagName:de,allowedTags:_}),Ne&&k.hasChildNodes()&&!xt(k.firstElementChild)&&Ht(/<[/\w!]/g,k.innerHTML)&&Ht(/<[/\w!]/g,k.textContent)||k.nodeType===oi.progressingInstruction||Ne&&k.nodeType===oi.comment&&Ht(/<[/\w]/g,k.data))return Yt(k),!0;if(!(ne.tagCheck instanceof Function&&ne.tagCheck(de))&&(!_[de]||M[de])){if(!M[de]&&Ei(de)&&(P.tagNameCheck instanceof RegExp&&Ht(P.tagNameCheck,de)||P.tagNameCheck instanceof Function&&P.tagNameCheck(de)))return!1;if(jt&&!Jt[de]){const Qe=O(k)||k.parentNode,ft=Z(k)||k.childNodes;if(ft&&Qe){const ze=ft.length;for(let Ot=ze-1;Ot>=0;--Ot){const dn=A(ft[Ot],!0);dn.__removalCount=(k.__removalCount||0)+1,Qe.insertBefore(dn,H(k))}}}return Yt(k),!0}return k instanceof b&&!Si(k)||(de==="noscript"||de==="noembed"||de==="noframes")&&Ht(/<\/no(script|embed|frames)/i,k.innerHTML)?(Yt(k),!0):(Pe&&k.nodeType===oi.text&&(ae=k.textContent,Hr([ge,Ee,se],Qe=>{ae=si(ae,Qe," ")}),k.textContent!==ae&&(ai(s.removed,{element:k.cloneNode()}),k.textContent=ae)),ot(ue.afterSanitizeElements,k,null),!1)},da=function(k,ae,de){if(I[ae]||cn&&(ae==="id"||ae==="name")&&(de in o||de in ss))return!1;if(!(ee&&!I[ae]&&Ht(me,ae))){if(!(K&&Ht(G,ae))){if(!(ne.attributeCheck instanceof Function&&ne.attributeCheck(ae,k))){if(!$[ae]||I[ae]){if(!(Ei(k)&&(P.tagNameCheck instanceof RegExp&&Ht(P.tagNameCheck,k)||P.tagNameCheck instanceof Function&&P.tagNameCheck(k))&&(P.attributeNameCheck instanceof RegExp&&Ht(P.attributeNameCheck,ae)||P.attributeNameCheck instanceof Function&&P.attributeNameCheck(ae,k))||ae==="is"&&P.allowCustomizedBuiltInElements&&(P.tagNameCheck instanceof RegExp&&Ht(P.tagNameCheck,de)||P.tagNameCheck instanceof Function&&P.tagNameCheck(de))))return!1}else if(!ns[ae]){if(!Ht(W,si(de,he,""))){if(!((ae==="src"||ae==="xlink:href"||ae==="href")&&k!=="script"&&gv(de,"data:")===0&&vi[k])){if(!(ve&&!Ht(le,si(de,he,"")))){if(de)return!1}}}}}}}return!0},Ei=function(k){return k!=="annotation-xml"&&Rc(k,re)},wi=function(k){ot(ue.beforeSanitizeAttributes,k,null);const{attributes:ae}=k;if(!ae||fn(k))return;const de={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$,forceKeepAttr:void 0};let Qe=ae.length;for(;Qe--;){const ft=ae[Qe],{name:ze,namespaceURI:Ot,value:dn}=ft,qt=mt(ze),Mn=dn;let wt=ze==="value"?Mn:yv(Mn);if(de.attrName=qt,de.attrValue=wt,de.keepAttr=!0,de.forceKeepAttr=void 0,ot(ue.uponSanitizeAttribute,k,de),wt=de.attrValue,xi&&(qt==="id"||qt==="name")&&(An(ze,k),wt=co+wt),Ne&&Ht(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,wt)){An(ze,k);continue}if(qt==="attributename"&&Rc(wt,"href")){An(ze,k);continue}if(de.forceKeepAttr)continue;if(!de.keepAttr){An(ze,k);continue}if(!_e&&Ht(/\/>/i,wt)){An(ze,k);continue}Pe&&Hr([ge,Ee,se],ds=>{wt=si(wt,ds," ")});const fs=mt(k.nodeName);if(!da(fs,qt,wt)){An(ze,k);continue}if(C&&typeof T=="object"&&typeof T.getAttributeType=="function"&&!Ot)switch(T.getAttributeType(fs,qt)){case"TrustedHTML":{wt=C.createHTML(wt);break}case"TrustedScriptURL":{wt=C.createScriptURL(wt);break}}if(wt!==Mn)try{Ot?k.setAttributeNS(Ot,ze,wt):k.setAttribute(ze,wt),fn(k)?Yt(k):wp(s.removed)}catch{An(ze,k)}}ot(ue.afterSanitizeAttributes,k,null)},Ai=function ye(k){let ae=null;const de=cs(k);for(ot(ue.beforeSanitizeShadowDOM,k,null);ae=de.nextNode();)ot(ue.uponSanitizeShadowNode,ae,null),Vn(ae),wi(ae),ae.content instanceof f&&ye(ae.content);ot(ue.afterSanitizeShadowDOM,k,null)};return s.sanitize=function(ye){let k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ae=null,de=null,Qe=null,ft=null;if(ls=!ye,ls&&(ye="<!-->"),typeof ye!="string"&&!xt(ye))if(typeof ye.toString=="function"){if(ye=ye.toString(),typeof ye!="string")throw ii("dirty is not a string, aborting")}else throw ii("toString is not a function");if(!s.isSupported)return ye;if(lt||is(k),s.removed=[],typeof ye=="string"&&(Fl=!1),Fl){if(ye.nodeName){const dn=mt(ye.nodeName);if(!_[dn]||M[dn])throw ii("root node is forbidden and cannot be sanitized in-place")}}else if(ye instanceof m)ae=us("<!---->"),de=ae.ownerDocument.importNode(ye,!0),de.nodeType===oi.element&&de.nodeName==="BODY"||de.nodeName==="HTML"?ae=de:ae.appendChild(de);else{if(!Ce&&!Pe&&!Me&&ye.indexOf("<")===-1)return C&&_t?C.createHTML(ye):ye;if(ae=us(ye),!ae)return Ce?null:_t?D:""}ae&&Le&&Yt(ae.firstChild);const ze=cs(Fl?ye:ae);for(;Qe=ze.nextNode();)Vn(Qe),wi(Qe),Qe.content instanceof f&&Ai(Qe.content);if(Fl)return ye;if(Ce){if(je)for(ft=fe.call(ae.ownerDocument);ae.firstChild;)ft.appendChild(ae.firstChild);else ft=ae;return($.shadowroot||$.shadowrootmode)&&(ft=ie.call(i,ft,!0)),ft}let Ot=Me?ae.outerHTML:ae.innerHTML;return Me&&_["!doctype"]&&ae.ownerDocument&&ae.ownerDocument.doctype&&ae.ownerDocument.doctype.name&&Ht(qg,ae.ownerDocument.doctype.name)&&(Ot="<!DOCTYPE "+ae.ownerDocument.doctype.name+`>
178
+ `+Ot),Pe&&Hr([ge,Ee,se],dn=>{Ot=si(Ot,dn," ")}),C&&_t?C.createHTML(Ot):Ot},s.setConfig=function(){let ye=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};is(ye),lt=!0},s.clearConfig=function(){Zn=null,lt=!1},s.isValidAttribute=function(ye,k,ae){Zn||is({});const de=mt(ye),Qe=mt(k);return da(de,Qe,ae)},s.addHook=function(ye,k){typeof k=="function"&&ai(ue[ye],k)},s.removeHook=function(ye,k){if(k!==void 0){const ae=mv(ue[ye],k);return ae===-1?void 0:pv(ue[ye],ae,1)[0]}return wp(ue[ye])},s.removeHooks=function(ye){ue[ye]=[]},s.removeAllHooks=function(){ue=Np()},s}var Ov=Xg();We.setOptions({breaks:!0,gfm:!0});function Dv(a){const s=We.parse(a);return Ov.sanitize(s,{FORBID_TAGS:["iframe","object","embed","form","img"],FORBID_ATTR:["srcset"],ALLOW_DATA_ATTR:!1})}function Wc({text:a}){const[s,o]=E.useState(!1),i=E.useCallback(()=>{navigator.clipboard.writeText(a).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},[a]);return h.jsx("button",{onClick:i,className:"opacity-0 group-hover:opacity-100 p-1 rounded transition-opacity text-muted-foreground hover:text-foreground",title:"Copy to clipboard",children:s?h.jsx("svg",{className:"w-4 h-4 text-success",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):h.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})})})}function jp({text:a,variant:s}){const o=E.useMemo(()=>Dv(a),[a]);return h.jsx("div",{className:`prose prose-sm max-w-none
179
+ ${s==="user"?"prose-headings:text-msg-user-foreground prose-p:text-msg-user-foreground prose-li:text-msg-user-foreground prose-strong:text-msg-user-foreground prose-a:text-msg-user-foreground":"dark:prose-invert prose-headings:text-foreground"}
180
+ prose-pre:bg-code-bg prose-pre:border prose-pre:border-code-border prose-pre:text-xs
181
+ prose-code:bg-code-bg prose-code:text-code-text prose-code:px-1 prose-code:py-0.5 prose-code:rounded prose-code:text-xs prose-code:before:content-none prose-code:after:content-none
182
+ prose-table:border-collapse prose-th:border prose-th:border-border prose-th:px-2 prose-th:py-1
183
+ prose-td:border prose-td:border-border prose-td:px-2 prose-td:py-1
184
+ prose-a:text-primary prose-blockquote:border-l-border prose-blockquote:text-muted-foreground
185
+ prose-hr:border-border`,dangerouslySetInnerHTML:{__html:o}})}function Mv({msg:a,result:s}){const[o,i]=E.useState(!1),c=xx(a.toolName??"tool",a.toolInput),f=typeof a.toolInput=="string"?a.toolInput:JSON.stringify(a.toolInput,null,2);return h.jsxs("div",{className:"my-1.5 border border-msg-tool-border rounded-md bg-msg-tool group",children:[h.jsxs("div",{className:"flex items-center",children:[h.jsxs("button",{onClick:()=>i(!o),className:"flex-1 text-left px-3 py-2 flex items-center gap-2 text-xs hover:bg-accent/50 transition-colors rounded-md",children:[h.jsx("span",{className:"text-muted-foreground",children:o?"▼":"▶"}),h.jsx("span",{className:"text-primary font-mono",children:a.toolName}),h.jsx("span",{className:"text-muted-foreground truncate flex-1",children:c})]}),h.jsx("div",{className:"pr-2",children:h.jsx(Wc,{text:f})})]}),o&&h.jsxs("div",{className:"px-3 pb-2 space-y-2",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Input:"}),h.jsx("pre",{className:"text-xs bg-code-bg text-code-text border border-code-border rounded-md p-2 overflow-x-auto max-h-60 overflow-y-auto",children:typeof a.toolInput=="string"?a.toolInput:JSON.stringify(a.toolInput,null,2)})]}),s&&s.content&&h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Output:"}),h.jsx("pre",{className:"text-xs bg-code-bg text-code-text border border-code-border rounded-md p-2 overflow-x-auto max-h-60 overflow-y-auto",children:s.content})]})]})]})}function Lv({content:a}){const[s,o]=E.useState(!1);return h.jsxs("div",{className:"my-1",children:[h.jsxs("button",{onClick:()=>o(!s),className:"text-xs text-muted-foreground hover:text-foreground flex items-center gap-1 transition-colors",children:[h.jsx("span",{children:s?"▼":"▶"}),h.jsx("span",{className:"italic",children:"thinking..."})]}),s&&h.jsx("pre",{className:"text-xs text-muted-foreground bg-muted rounded-md p-2 mt-1 whitespace-pre-wrap max-h-40 overflow-y-auto",children:a})]})}function zv({sessionId:a,className:s}){const[o,i]=E.useState(null),[c,f]=E.useState(!0),[d,m]=E.useState(null),b=E.useRef(null);if(E.useEffect(()=>{f(!0),m(null);const y=new AbortController;return yt(`/api/sessions/${a}`,{signal:y.signal}).then(v=>{if(!v.ok)throw new Error(`HTTP ${v.status}`);return v.json()}).then(v=>{if(!y.signal.aborted){if(!v||!Array.isArray(v.messages))throw new Error("Invalid session data");i(v),f(!1)}}).catch(v=>{y.signal.aborted||(m(v instanceof Error?v.message:"Failed to load"),f(!1))}),()=>y.abort()},[a]),E.useEffect(()=>{var y;c||(y=b.current)==null||y.scrollIntoView({behavior:"smooth"})},[o,c]),c)return h.jsx("div",{className:`flex items-center justify-center text-muted-foreground ${s??""}`,children:"Loading conversation..."});if(d)return h.jsxs("div",{className:`flex items-center justify-center text-destructive ${s??""}`,children:["Error: ",d]});if(!o||o.messages.length===0)return h.jsx("div",{className:`flex items-center justify-center text-muted-foreground ${s??""}`,children:"No messages in this session"});const p=new Map;for(const y of o.messages)y.role==="tool_result"&&y.toolUseId&&p.set(y.toolUseId,y);return h.jsx("div",{className:`overflow-y-auto overflow-x-hidden scrollbar-thin ${s??""}`,children:h.jsxs("div",{className:"p-4 space-y-3",children:[o.messages.map((y,v)=>{var T,w;if(y.role==="tool_result")return null;const x=y.toolUseId??`${y.role}-${y.timestamp}-${v}`;if(y.role==="user")return h.jsx("div",{className:"mr-12",children:h.jsxs("div",{className:"group relative bg-msg-user text-msg-user-foreground rounded-lg px-3 py-[1.2em] text-sm",children:[h.jsx(jp,{text:y.content,variant:"user"}),h.jsx("div",{className:"absolute bottom-1.5 right-1.5",children:h.jsx(Wc,{text:y.content})})]})},x);if(y.role==="tool_use"){const A=y.toolUseId?p.get(y.toolUseId):void 0;return h.jsx(Mv,{msg:y,result:A},x)}return y.role==="assistant"?h.jsxs("div",{className:"ml-12",children:[y.thinkingContent&&h.jsx(Lv,{content:y.thinkingContent}),h.jsxs("div",{className:"group relative bg-msg-assistant text-msg-assistant-foreground rounded-lg px-3 py-[1.2em] text-sm",children:[h.jsx(jp,{text:y.content,variant:"assistant"}),h.jsx("div",{className:"absolute bottom-1.5 right-1.5",children:h.jsx(Wc,{text:y.content})})]}),y.tokensIn!=null&&h.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:[(T=y.tokensIn)==null?void 0:T.toLocaleString()," in / ",(w=y.tokensOut)==null?void 0:w.toLocaleString()," out"]})]},x):null}),h.jsx("div",{ref:b})]})})}const Uv="modulepreload",Bv=function(a,s){return new URL(a,s).href},Op={},Oc=function(s,o,i){let c=Promise.resolve();if(o&&o.length>0){let d=function(y){return Promise.all(y.map(v=>Promise.resolve(v).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};const m=document.getElementsByTagName("link"),b=document.querySelector("meta[property=csp-nonce]"),p=(b==null?void 0:b.nonce)||(b==null?void 0:b.getAttribute("nonce"));c=d(o.map(y=>{if(y=Bv(y,i),y in Op)return;Op[y]=!0;const v=y.endsWith(".css"),x=v?'[rel="stylesheet"]':"";if(!!i)for(let A=m.length-1;A>=0;A--){const L=m[A];if(L.href===y&&(!v||L.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${y}"]${x}`))return;const w=document.createElement("link");if(w.rel=v?"stylesheet":Uv,v||(w.as="script"),w.crossOrigin="",w.href=y,p&&w.setAttribute("nonce",p),document.head.appendChild(w),v)return new Promise((A,L)=>{w.addEventListener("load",A),w.addEventListener("error",()=>L(new Error(`Unable to preload CSS for ${y}`)))})}))}function f(d){const m=new Event("vite:preloadError",{cancelable:!0});if(m.payload=d,window.dispatchEvent(m),!m.defaultPrevented)throw d}return c.then(d=>{for(const m of d||[])m.status==="rejected"&&f(m.reason);return s().catch(f)})};function Hv(a){if(a instanceof ArrayBuffer)return{kind:"binary",data:new Uint8Array(a)};const s=a;if(s.charAt(0)==="{")try{const o=JSON.parse(s);if(o.__mecha){if(o.type==="session"&&o.id)return{kind:"mecha-session",id:o.id};if(o.type==="exit")return{kind:"mecha-exit",code:typeof o.code=="number"?o.code:-1};if(o.type==="error")return{kind:"mecha-error",message:o.message??"Unknown error"}}}catch{}return{kind:"text",data:s}}const Iv=100;function Dp(){return document.documentElement.classList.contains("dark")?{background:"#0a0a0f",foreground:"#e0e0e0",cursor:"#e0e0e0",cursorAccent:"#0a0a0f",selectionBackground:"rgba(255,255,255,0.15)",black:"#1a1a2e",red:"#f87171",green:"#4ade80",yellow:"#facc15",blue:"#60a5fa",magenta:"#c084fc",cyan:"#22d3ee",white:"#e0e0e0",brightBlack:"#6b7280",brightRed:"#fca5a5",brightGreen:"#86efac",brightYellow:"#fde68a",brightBlue:"#93c5fd",brightMagenta:"#d8b4fe",brightCyan:"#67e8f9",brightWhite:"#ffffff"}:{background:"#fafafa",foreground:"#1a1a2e",cursor:"#1a1a2e",cursorAccent:"#fafafa",selectionBackground:"rgba(0,0,0,0.12)",black:"#1a1a2e",red:"#dc2626",green:"#16a34a",yellow:"#ca8a04",blue:"#2563eb",magenta:"#9333ea",cyan:"#0891b2",white:"#e5e7eb",brightBlack:"#6b7280",brightRed:"#b91c1c",brightGreen:"#15803d",brightYellow:"#a16207",brightBlue:"#1d4ed8",brightMagenta:"#7e22ce",brightCyan:"#0e7490",brightWhite:"#f9fafb"}}function $g({sessionId:a,className:s,onSessionId:o}){const i=E.useRef(null),c=E.useRef(null),f=E.useRef(null),d=E.useRef(null),m=E.useRef(null),b=E.useRef(null),[p,y]=E.useState("connecting"),[v,x]=E.useState(null),T=E.useCallback(()=>{const w=c.current,A=f.current;(w==null?void 0:w.readyState)===WebSocket.OPEN&&A&&w.send(JSON.stringify({type:"resize",cols:A.cols,rows:A.rows}))},[]);return E.useEffect(()=>{const w=new MutationObserver(()=>{const A=f.current;A&&(A.options.theme=Dp())});return w.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>w.disconnect()},[]),E.useEffect(()=>{if(!i.current)return;x(null),y("connecting");let w=!1,A=!1;return(async()=>{try{const{Terminal:L}=await Oc(async()=>{const{Terminal:ge}=await import("./xterm-BqvuqXEL.js");return{Terminal:ge}},[],import.meta.url),{FitAddon:H}=await Oc(async()=>{const{FitAddon:ge}=await import("./addon-fit-YJmn1quW.js");return{FitAddon:ge}},[],import.meta.url),{WebLinksAddon:Z}=await Oc(async()=>{const{WebLinksAddon:ge}=await import("./addon-web-links-BWjmmSgS.js");return{WebLinksAddon:ge}},[],import.meta.url);if(w)return;const O=new L({cursorBlink:!0,scrollback:1e4,theme:Dp(),fontFamily:"ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace",fontSize:14}),C=new H;O.loadAddon(C),O.loadAddon(new Z),O.open(i.current),C.fit(),f.current=O,d.current=C;const D=window.location.protocol==="https:"?"wss:":"ws:",j=new URLSearchParams;a&&j.set("session",a),j.set("cols",String(O.cols)),j.set("rows",String(O.rows));const Q=j.toString(),fe=lo(`/ws/terminal${Q?`?${Q}`:""}`),we=`${D}//${window.location.host}${fe}`,ie=new WebSocket(we);ie.binaryType="arraybuffer",c.current=ie,ie.onopen=()=>{w||(y("connected"),T())},ie.onmessage=ge=>{if(w)return;const Ee=Hv(ge.data);switch(Ee.kind){case"binary":O.write(Ee.data);break;case"text":O.write(Ee.data);break;case"mecha-session":o==null||o(Ee.id);break;case"mecha-exit":A=!0,x(Ee.code),y("disconnected");break;case"mecha-error":O.writeln(`\r
186
+ \x1B[31mError: ${Ee.message}\x1B[0m`);break}},ie.onclose=()=>{w||(y("disconnected"),A||O.writeln(`\r
187
+ \x1B[2m[Connection closed]\x1B[0m`))},ie.onerror=()=>{w||y("disconnected")},O.onData(ge=>{ie.readyState===WebSocket.OPEN&&ie.send(ge)});const ue=new ResizeObserver(()=>{b.current&&clearTimeout(b.current),b.current=setTimeout(()=>{w||(C.fit(),T())},Iv)});ue.observe(i.current),m.current=ue}catch{w||y("disconnected")}})(),()=>{var L,H,Z;w=!0,b.current&&clearTimeout(b.current),(L=m.current)==null||L.disconnect(),(H=c.current)==null||H.close(),(Z=f.current)==null||Z.dispose()}},[a,T,o]),h.jsxs("div",{className:`flex flex-col ${s??""}`,children:[h.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-card border-b border-border text-xs",children:[p==="connecting"&&h.jsx("span",{className:"text-warning",children:"Connecting..."}),p==="connected"&&h.jsxs("span",{className:"text-success flex items-center gap-1.5",children:[h.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-success animate-pulse"}),"Terminal connected"]}),p==="disconnected"&&h.jsx("span",{className:v===0?"text-success":"text-destructive",children:v!==null?`Exited (${v})`:"Disconnected"})]}),h.jsx("div",{ref:i,className:"flex-1 min-h-0 overflow-hidden bg-background",style:{padding:"4px"}})]})}function Fv({sessionId:a,hasPty:s,className:o}){const[i,c]=E.useState(!1);return h.jsxs("div",{className:`flex flex-col ${o??""}`,children:[h.jsxs("div",{className:"flex items-center justify-end gap-1 px-4 py-2 bg-card",children:[h.jsx("button",{onClick:()=>c(!1),className:`p-1.5 transition-colors ${i?"text-muted-foreground hover:text-foreground":"text-foreground"}`,title:"History",children:h.jsx(gx,{className:"w-4 h-4"})}),h.jsx("button",{onClick:()=>c(!0),className:`p-1.5 transition-colors ${i?"text-foreground":"text-muted-foreground hover:text-foreground"}`,title:"Terminal",children:h.jsx(mx,{className:"w-4 h-4"})})]}),i?h.jsx($g,{sessionId:a,className:"flex-1 min-h-0"}):h.jsx(zv,{sessionId:a,className:"flex-1 min-h-0"})]})}function Gv(){const[a,s]=E.useState(null),[o,i]=E.useState(!1),c=E.useCallback(f=>{s({id:f,hasPty:!0}),i(!1)},[]);return h.jsxs("div",{className:"flex h-full",children:[h.jsx(Tx,{selectedId:(a==null?void 0:a.id)??null,onSelect:(f,d)=>{s({id:f,hasPty:d}),i(!1)},onNewSession:()=>{s(null),i(!0)}}),h.jsxs("div",{className:"flex-1 min-w-0 min-h-0 flex flex-col",children:[o&&h.jsx($g,{className:"flex-1",onSessionId:c}),!o&&a&&h.jsx(Fv,{sessionId:a.id,hasPty:a.hasPty,className:"flex-1 min-h-0"}),!o&&!a&&h.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a session or start a new one"})]})]})}const Yv=[{label:"Every minute",cron:"* * * * *"},{label:"Every 5 minutes",cron:"*/5 * * * *"},{label:"Every 15 minutes",cron:"*/15 * * * *"},{label:"Every hour",cron:"0 * * * *"},{label:"Every 6 hours",cron:"0 */6 * * *"},{label:"Daily at midnight",cron:"0 0 * * *"},{label:"Daily at 9am",cron:"0 9 * * *"},{label:"Weekdays at 9am",cron:"0 9 * * 1-5"},{label:"Weekly (Monday)",cron:"0 0 * * 1"}];function Mp(a){const s=a.split(/\s+/);if(s.length!==5)return a;const[o,i,c,f,d]=s;return o==="*"&&i==="*"&&c==="*"&&f==="*"&&d==="*"?"Every minute":o.startsWith("*/")&&i==="*"&&c==="*"&&f==="*"&&d==="*"?`Every ${o.slice(2)} minutes`:o==="0"&&i.startsWith("*/")&&c==="*"&&f==="*"&&d==="*"?`Every ${i.slice(2)} hours`:o==="0"&&i==="*"&&c==="*"&&f==="*"&&d==="*"?"Every hour":o==="0"&&i==="0"&&c==="*"&&f==="*"&&d==="*"?"Daily at midnight":c==="*"&&f==="*"&&d==="*"&&/^\d+$/.test(o)&&/^\d+$/.test(i)?`Daily at ${i.padStart(2,"0")}:${o.padStart(2,"0")}`:c==="*"&&f==="*"&&d==="1-5"&&/^\d+$/.test(o)&&/^\d+$/.test(i)?`Weekdays at ${i.padStart(2,"0")}:${o.padStart(2,"0")}`:c==="*"&&f==="*"&&/^\d+$/.test(d)&&/^\d+$/.test(o)&&/^\d+$/.test(i)?`${["Sun","Mon","Tue","Wed","Thu","Fri","Sat"][parseInt(d)]??`Day ${d}`} at ${i.padStart(2,"0")}:${o.padStart(2,"0")}`:a}function qv(a){const s=new Date(a).getTime()-Date.now();if(s<0)return"now";if(s<6e4)return`${Math.floor(s/1e3)}s`;if(s<36e5)return`${Math.floor(s/6e4)}m`;if(s<864e5){const o=Math.floor(s/36e5),i=Math.floor(s%36e5/6e4);return i>0?`${o}h ${i}m`:`${o}h`}return`${Math.floor(s/864e5)}d`}function Xv(){const[a,s]=E.useState([]),[o,i]=E.useState(null),[c,f]=E.useState(!1),[d,m]=E.useState(null),[b,p]=E.useState(null),[,y]=E.useState(0),[v,x]=E.useState(""),[T,w]=E.useState(""),[A,L]=E.useState(!1),[H,Z]=E.useState(null),O=E.useRef(void 0),C=E.useCallback(()=>{yt("/api/schedule").then(se=>{if(!se.ok)throw new Error(`HTTP ${se.status}`);return se.json()}).then(se=>{s(se),i(null)}).catch(se=>i(se instanceof Error?se.message:"Failed to load schedule"))},[]);E.useEffect(()=>(C(),O.current=setInterval(C,1e4),()=>clearInterval(O.current)),[C]),E.useEffect(()=>{const se=setInterval(()=>y(me=>me+1),1e3);return()=>clearInterval(se)},[]);function D(){x(""),w(""),Z(null),f(!1),m(null)}async function j(){if(!v.trim()||!T.trim()){Z("Cron and prompt are required");return}L(!0),Z(null);try{const se=await yt("/api/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cron:v.trim(),prompt:T.trim()})}),me=await se.json();if(!se.ok){Z(String(me.error??"Failed to create"));return}D(),C()}catch{Z("Network error")}finally{L(!1)}}async function Q(se){if(!v.trim()||!T.trim()){Z("Cron and prompt are required");return}L(!0),Z(null);try{const me=await yt(`/api/schedule/${encodeURIComponent(se)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({cron:v.trim(),prompt:T.trim()})}),G=await me.json();if(!me.ok){Z(String(G.error??"Failed to update"));return}D(),C()}catch{Z("Network error")}finally{L(!1)}}async function fe(se){try{const me=await yt(`/api/schedule/${encodeURIComponent(se)}`,{method:"DELETE"});if(!me.ok){const G=await me.json();i(String(G.error??"Delete failed"));return}p(null),C()}catch{i("Network error")}}async function we(se){const me=se.status==="active"?"pause":"resume";try{const G=await yt(`/api/schedule/${encodeURIComponent(se.id)}/${me}`,{method:"POST"});if(!G.ok){const le=await G.json();i(String(le.error??`${me} failed`));return}C()}catch{i("Network error")}}async function ie(se){try{const me=await yt(`/api/schedule/trigger/${encodeURIComponent(se)}`,{method:"POST"});if(!me.ok){const G=await me.json();i(String(G.error??"Trigger failed"));return}C()}catch{i("Network error")}}function ue(se){m(se.id),x(se.cron),w(se.prompt),Z(null),f(!1)}function ge(){f(!0),m(null),x(""),w(""),Z(null)}const Ee=d!==null;return h.jsxs("div",{className:"p-6 space-y-4 max-w-4xl mx-auto h-full overflow-y-auto",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Schedule"}),h.jsx(Ye,{onClick:ge,disabled:c||Ee,children:"+ Add Task"})]}),o&&h.jsx(Yn,{variant:"error",onDismiss:()=>i(null),children:o}),(c||Ee)&&h.jsxs(ct,{spacing:3,children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:Ee?"Edit Schedule Entry":"New Schedule Entry"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:Yv.map(se=>h.jsx("button",{onClick:()=>x(se.cron),className:`text-xs px-2 py-1 rounded-md border transition-colors ${v===se.cron?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:border-primary/50"}`,children:se.label},se.cron))}),h.jsxs("div",{children:[h.jsx("label",{className:"text-xs text-muted-foreground block mb-1",children:"Cron Expression (5 fields)"}),h.jsx(En,{mono:!0,value:v,onChange:se=>x(se.target.value),placeholder:"*/15 * * * *",className:"w-full"}),v&&h.jsx("div",{className:"text-xs text-muted-foreground mt-1",children:Mp(v)})]}),h.jsxs("div",{children:[h.jsx("label",{className:"text-xs text-muted-foreground block mb-1",children:"Prompt"}),h.jsx(af,{value:T,onChange:se=>w(se.target.value),placeholder:"What should the bot do on this schedule?",rows:3,className:"w-full"})]}),H&&h.jsx(Yn,{variant:"error",children:H}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx(Ye,{variant:"secondary",onClick:D,children:"Cancel"}),h.jsx(Ye,{onClick:()=>Ee?Q(d):j(),disabled:A||!v.trim()||!T.trim(),children:A?"Saving...":Ee?"Update":"Create"})]})]}),a.length===0&&!c&&h.jsx("p",{className:"text-muted-foreground text-sm",children:'No scheduled tasks. Click "Add Task" to create one.'}),a.map(se=>h.jsxs(ct,{children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"text-primary text-sm",children:se.cron}),h.jsx("span",{className:"text-xs text-muted-foreground",children:Mp(se.cron)}),h.jsx(Yc,{variant:se.status==="active"?"success":"warning",children:se.status}),se.consecutiveErrors>=5&&h.jsx(Yc,{variant:"error",children:"auto-paused"})]}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx(Ye,{variant:"ghost",size:"xs",onClick:()=>we(se),title:se.status==="active"?"Pause":"Resume",children:se.status==="active"?"Pause":"Resume"}),h.jsx(Ye,{variant:"ghost",size:"xs",onClick:()=>ie(se.id),title:"Run now",children:"Trigger"}),h.jsx(Ye,{variant:"ghost",size:"xs",onClick:()=>ue(se),title:"Edit",children:"Edit"}),h.jsx(Ye,{variant:"ghost-destructive",size:"xs",onClick:()=>p(se.id),title:"Delete",children:"Delete"})]})]}),h.jsx("p",{className:"text-sm text-foreground mb-2 whitespace-pre-wrap break-words",children:se.prompt.length>200?se.prompt.slice(0,200)+"...":se.prompt}),h.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[se.nextRunAt&&se.status==="active"&&h.jsxs("span",{children:["Next: ",h.jsx("span",{className:"text-foreground",children:qv(se.nextRunAt)})]}),se.lastRunAt&&h.jsxs("span",{children:["Last: ",new Date(se.lastRunAt).toLocaleString()]}),h.jsxs("span",{children:["Runs: ",se.runCount," (today: ",se.runsToday,")"]}),se.lastResult&&h.jsxs("span",{className:se.lastResult==="error"?"text-destructive":se.lastResult==="success"?"text-green-600 dark:text-green-400":"",children:["Last result: ",se.lastResult]}),se.consecutiveErrors>0&&h.jsxs("span",{className:"text-destructive",children:["Consecutive errors: ",se.consecutiveErrors]})]})]},se.id)),h.jsx(sf,{open:b!==null,title:"Delete Schedule Entry",description:"This will permanently remove this scheduled task. Are you sure?",children:h.jsxs(rf,{children:[h.jsx(Ye,{variant:"secondary",size:"lg",onClick:()=>p(null),children:"Cancel"}),h.jsx(Ye,{variant:"destructive",size:"lg",onClick:()=>fe(b),children:"Delete"})]})})]})}const Za=new Map,$v=500;function io(a,s,o){const i=Za.get(a);if(i)return i;const c=o.colorize?Zv(s,o):Kg(s,o);if(Za.size>=$v){const f=Za.keys().next().value;f!==void 0&&Za.delete(f)}return Za.set(a,c),c}function Zg(){Za.clear()}function Zv(a,s){const{h:o,s:i,b:c,c:f}=s,d=[];for(const m of a){const b=[];for(const p of m){if(p===""){b.push("");continue}const y=parseInt(p.slice(1,3),16),v=parseInt(p.slice(3,5),16),x=parseInt(p.slice(5,7),16);let T=(.299*y+.587*v+.114*x)/255;if(f!==0){const H=(100+f)/100;T=.5+(T-.5)*H}c!==0&&(T=T+c/200),T=Math.max(0,Math.min(1,T));const w=Vg(p),A=i/100,L=Wg(o,A,T);b.push(Qg(L,w))}d.push(b)}return d}function Vg(a){return a.length>7?parseInt(a.slice(7,9),16):255}function Qg(a,s){return s>=255?a:`${a}${s.toString(16).padStart(2,"0").toUpperCase()}`}function Wg(a,s,o){const i=(1-Math.abs(2*o-1))*s,c=a/60,f=i*(1-Math.abs(c%2-1));let d=0,m=0,b=0;c<1?(d=i,m=f,b=0):c<2?(d=f,m=i,b=0):c<3?(d=0,m=i,b=f):c<4?(d=0,m=f,b=i):c<5?(d=f,m=0,b=i):(d=i,m=0,b=f);const p=o-i/2,y=Math.round((d+p)*255),v=Math.round((m+p)*255),x=Math.round((b+p)*255);return`#${Dc(y).toString(16).padStart(2,"0")}${Dc(v).toString(16).padStart(2,"0")}${Dc(x).toString(16).padStart(2,"0")}`.toUpperCase()}function Dc(a){return Math.max(0,Math.min(255,a))}function Vv(a,s,o){const i=a/255,c=s/255,f=o/255,d=Math.max(i,c,f),m=Math.min(i,c,f),b=(d+m)/2;if(d===m)return[0,0,b];const p=d-m,y=b>.5?p/(2-d-m):p/(d+m);let v=0;return d===i?v=((c-f)/p+(c<f?6:0))*60:d===c?v=((f-i)/p+2)*60:v=((i-c)/p+4)*60,[v,y,b]}function Kg(a,s){const{h:o,s:i,b:c,c:f}=s,d=[];for(const m of a){const b=[];for(const p of m){if(p===""){b.push("");continue}const y=parseInt(p.slice(1,3),16),v=parseInt(p.slice(3,5),16),x=parseInt(p.slice(5,7),16),T=Vg(p),[w,A,L]=Vv(y,v,x),H=((w+o)%360+360)%360,Z=Math.max(0,Math.min(1,A+i/100));let O=L;if(f!==0){const D=(100+f)/100;O=.5+(O-.5)*D}c!==0&&(O=O+c/200),O=Math.max(0,Math.min(1,O));const C=Wg(H,Z,O);b.push(Qg(C,T))}d.push(b)}return d}const xe=16,Mc=20,Lc=11,Qv=64,Wv=64,Kv=48,Lp=.15,zp=.3,ui=2,ci=20,Up=120,Bp=240,Jg=.3,fi=6,Pg=16,Hp=24,Jv=30,Pv=180,Ip=.3,Fp="#ccffcc",e1=.6,Gp=.5,Yp=.33,qp=.66,yf=6,t1=.5,n1=.001,l1=1,a1=.5,s1=.5,i1=.25,r1=[4,3],e0=6,t0=3,n0=.45,l0=1.5,a0=.5,Xp=.5,o1=10,u1=24,s0="#808080",c1="rgba(0, 127, 212, 0.35)",f1="rgba(0, 200, 80, 0.35)",d1="rgba(220, 50, 50, 0.35)",h1="rgba(255,255,255,0.12)",m1="rgba(255,255,255,0.08)",i0=[2,2],p1="rgba(60, 130, 220, 0.25)",g1="rgba(60, 130, 220, 0.5)",y1="rgba(255, 255, 255, 0.06)",b1="#00ff00",x1="#ff0000",v1="#007fd4",T1="rgba(200, 50, 50, 0.85)",S1="rgba(50, 120, 200, 0.85)",$p=.1,Zp=.5,ro=1,bf=10,E1=2,w1=1500,A1=2e3,_1=.5,R1=50,Vp=.25,Qp=50,r0=500,C1={h:35,s:30,b:15,c:0},k1={h:240,s:25,b:0,c:0},N1={h:0,s:0,b:0,c:0},Wp=5,j1=15,Fr=4,Kp=8,O1=10,D1=20,M1=10,Va=3,Qa=6,zc=40,Jp=35,L1=15,Uc=.2,z1=.1,U1=2,B1=.3,Pp=3,eg=2,tg=6,H1=45,I1=271,F1=3,G1=2,ng=8,Y1=24,q1=32,X1=1.5,qe={WALL:0,FLOOR_1:1,FLOOR_2:2,VOID:255},Te={IDLE:"idle",WALK:"walk",TYPE:"type",SIT:"sit",INTERACT:"interact"},oe={DOWN:0,LEFT:1,RIGHT:2,UP:3},Se={TILE_PAINT:"tile_paint",WALL_PAINT:"wall_paint",FURNITURE_PLACE:"furniture_place",FURNITURE_PICK:"furniture_pick",SELECT:"select",EYEDROPPER:"eyedropper",ERASE:"erase"},$1={_:"",B:"#555566",F:"#EEEEFF",A:"#CCA700"},Z1=[["B","B","B","B","B","B","B","B","B","B","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","A","F","A","F","A","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","B","B","B","B","B","B","B","B","B","B"],["_","_","_","_","B","B","B","_","_","_","_"],["_","_","_","_","_","B","_","_","_","_","_"],["_","_","_","_","_","_","_","_","_","_","_"]],V1={palette:$1,pixels:Z1},Q1={_:"",B:"#555566",F:"#EEEEFF",G:"#44BB66"},W1=[["_","B","B","B","B","B","B","B","B","B","_"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","F","F","F","F","F","G","F","B"],["B","F","F","F","F","F","F","G","F","F","B"],["B","F","F","G","F","F","G","F","F","F","B"],["B","F","F","F","G","G","F","F","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["B","F","F","F","F","F","F","F","F","F","B"],["_","B","B","B","B","B","B","B","B","B","_"],["_","_","_","_","B","B","B","_","_","_","_"],["_","_","_","_","_","B","_","_","_","_","_"],["_","_","_","_","_","_","_","_","_","_","_"]],K1={palette:Q1,pixels:W1};function o0(a){return a.pixels.map(s=>s.map(o=>a.palette[o]??o))}const J1=o0(V1),P1=o0(K1);let Qr=null;function eT(a){Qr=a,Kc.clear()}function tT(a){return a.map(s=>[...s].reverse())}const Kc=new Map;function nT(a,s){const o={h:s,s:0,b:0,c:0},i=d=>Kg(d,o),c=d=>[i(d[0]),i(d[1]),i(d[2]),i(d[3])],f=d=>[i(d[0]),i(d[1])];return{walk:{[oe.DOWN]:c(a.walk[oe.DOWN]),[oe.UP]:c(a.walk[oe.UP]),[oe.RIGHT]:c(a.walk[oe.RIGHT]),[oe.LEFT]:c(a.walk[oe.LEFT])},typing:{[oe.DOWN]:f(a.typing[oe.DOWN]),[oe.UP]:f(a.typing[oe.UP]),[oe.RIGHT]:f(a.typing[oe.RIGHT]),[oe.LEFT]:f(a.typing[oe.LEFT])},reading:{[oe.DOWN]:f(a.reading[oe.DOWN]),[oe.UP]:f(a.reading[oe.UP]),[oe.RIGHT]:f(a.reading[oe.RIGHT]),[oe.LEFT]:f(a.reading[oe.LEFT])}}}function lT(a,s){const o=[];for(let i=0;i<s;i++)o.push(new Array(a).fill(""));return o}function u0(a,s=0){const o=`${a}:${s}`,i=Kc.get(o);if(i)return i;let c;if(Qr){const f=Qr[a%Qr.length],d=f.down,m=f.up,b=f.right,p=tT;c={walk:{[oe.DOWN]:[d[0],d[1],d[2],d[1]],[oe.UP]:[m[0],m[1],m[2],m[1]],[oe.RIGHT]:[b[0],b[1],b[2],b[1]],[oe.LEFT]:[p(b[0]),p(b[1]),p(b[2]),p(b[1])]},typing:{[oe.DOWN]:[d[3],d[4]],[oe.UP]:[m[3],m[4]],[oe.RIGHT]:[b[3],b[4]],[oe.LEFT]:[p(b[3]),p(b[4])]},reading:{[oe.DOWN]:[d[5],d[6]],[oe.UP]:[m[5],m[6]],[oe.RIGHT]:[b[5],b[6]],[oe.LEFT]:[p(b[5]),p(b[6])]}}}else{const f=lT(16,32),d=[f,f,f,f],m=[f,f];c={walk:{[oe.DOWN]:d,[oe.UP]:d,[oe.RIGHT]:d,[oe.LEFT]:d},typing:{[oe.DOWN]:m,[oe.UP]:m,[oe.RIGHT]:m,[oe.LEFT]:m},reading:{[oe.DOWN]:m,[oe.UP]:m,[oe.RIGHT]:m,[oe.LEFT]:m}}}return s!==0&&(c=nT(c,s)),Kc.set(o,c),c}const aT={idle:"green",thinking:"yellow",calling:"yellow",scheduled:"yellow",webhook:"yellow",error:"red"};function sT(a){return aT[a]??"muted"}function iT(a){const s=Math.floor(a/3600),o=Math.floor(a%3600/60),i=Math.floor(a%60),c=[];return s>0&&c.push(`${s}h`),o>0&&c.push(`${o}m`),(i>0||c.length===0)&&c.push(`${i}s`),c.join(" ")}function rT(a){if(!a)return"never";const s=new Date(a).getTime();if(isNaN(s))return"never";const o=Math.floor((Date.now()-s)/1e3);return o<5?"just now":o<60?`${o}s ago`:o<3600?`${Math.floor(o/60)}m ago`:o<86400?`${Math.floor(o/3600)}h ago`:`${Math.floor(o/86400)}d ago`}function oT(){const[a,s]=E.useState(null),[o,i]=E.useState(null),[,c]=E.useState(0),f=E.useRef(null),d=E.useRef(null),m=E.useRef(null),b=E.useCallback(async()=>{try{const T=await yt("/api/status");if(!T.ok)throw new Error(`HTTP ${T.status}`);const w=await T.json();f.current={serverUptime:w.uptime,fetchedAt:Date.now()/1e3},s(w),i(null)}catch(T){i(T instanceof Error?T.message:"Fetch failed")}},[]),p=E.useCallback(()=>{d.current&&(clearInterval(d.current),d.current=null)},[]),y=E.useCallback(()=>{p(),d.current=setInterval(b,5e3)},[b,p]);if(E.useEffect(()=>{b();const T=new EventSource(lo("/api/status/stream")),w=A=>{try{const L=JSON.parse(A.data),H={};L.state?H.state=L.state:L.activity&&(H.state=L.activity),"talkingTo"in L&&(H.talking_to=L.talkingTo),"lastActive"in L&&(H.last_active=L.lastActive),"talking_to"in L&&(H.talking_to=L.talking_to),"last_active"in L&&(H.last_active=L.last_active),s(Z=>Z?{...Z,...H}:null),i(null),p()}catch{}};return T.addEventListener("state",w),T.addEventListener("snapshot",w),T.onopen=()=>p(),T.onerror=()=>{d.current||y()},m.current=setInterval(()=>c(A=>A+1),1e3),()=>{T.close(),p(),m.current&&clearInterval(m.current)}},[b,y,p]),o&&!a)return h.jsxs(ct,{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Status"}),h.jsx("p",{className:"text-sm text-destructive",children:o})]});if(!a)return h.jsxs(ct,{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Status"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."})]});const v=f.current?f.current.serverUptime+(Date.now()/1e3-f.current.fetchedAt):a.uptime,x=iT(v>0?v:0);return h.jsxs(ct,{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-3",children:"Status"}),h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(no,{color:sT(a.state)}),h.jsx("span",{className:"text-sm font-medium text-foreground capitalize",children:a.state})]}),h.jsxs("span",{className:"text-sm text-muted-foreground",children:["Uptime: ",h.jsx("span",{className:"text-foreground font-mono",children:x})]})]}),h.jsxs("div",{className:"flex items-center justify-between mb-3",children:[h.jsxs("span",{className:"text-sm text-muted-foreground",children:["Model: ",h.jsx("span",{className:"text-foreground font-mono",children:a.model||"unknown"})]}),h.jsxs("span",{className:"text-sm text-muted-foreground",children:["Last active: ",h.jsx("span",{className:"text-foreground font-mono",children:rT(a.last_active)})]})]}),h.jsx("div",{className:"pt-2 border-t border-border",children:a.current_task?h.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Task"}),h.jsx("span",{className:"font-mono text-foreground",children:a.current_task.slice(0,8)}),a.talking_to&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground",children:"with"}),h.jsx("span",{className:"font-mono text-foreground",children:a.talking_to})]})]}):h.jsx("p",{className:"text-sm text-muted-foreground",children:"No active task"})})]})}function uT(){const[a,s]=E.useState(null),[o,i]=E.useState({}),[c,f]=E.useState(!1),[d,m]=E.useState(null),[b,p]=E.useState(!0),[y,v]=E.useState(!1),[x,T]=E.useState([]);E.useEffect(()=>{(async()=>{try{const D=await yt("/api/config");if(!D.ok)throw new Error(`HTTP ${D.status}`);s(await D.json())}catch{m({text:"Failed to load config",type:"error"}),p(!1);return}try{const D=await yt("/api/auth/profiles");D.ok&&T((await D.json()).profiles)}catch{}p(!1)})()},[]);function w(C,D){a&&D===a[C]?i(j=>{const Q={...j};return delete Q[C],Q}):i(j=>({...j,[C]:D}))}function A(C){return C in o?o[C]:a==null?void 0:a[C]}const L=Object.keys(o).length>0;async function H(){if(L){f(!0),m(null);try{const C=await yt("/api/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!C.ok){const D=await C.json().catch(()=>({}));throw new Error(D.error||`HTTP ${C.status}`)}await C.json(),o.auth?s(D=>D&&{...D,...o,auth_profile:o.auth}):s(D=>D&&{...D,...o}),i({}),m({text:"Config updated — bot is restarting...",type:"success"})}catch(C){m({text:C instanceof Error?C.message:"Save failed",type:"error"})}finally{f(!1)}}}if(b)return h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-3",children:"Configuration"}),h.jsx(ct,{className:"text-sm text-muted-foreground",children:"Loading..."})]});if(!a)return h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-3",children:"Configuration"}),h.jsx(ct,{className:"text-sm text-destructive",children:(d==null?void 0:d.text)||"Failed to load configuration"})]});const Z=a.auth_type,O=Z==="oauth"?"OAuth":Z==="api_key"?"API Key":"Unknown";return h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-3",children:"Configuration"}),h.jsxs(ct,{spacing:4,children:[h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-sm text-muted-foreground",children:"Name"}),h.jsx("div",{className:"text-sm text-foreground font-mono",children:a.name??"—"})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-sm text-muted-foreground",children:"Model"}),h.jsxs(Ka,{value:A("model")??"sonnet",onChange:C=>w("model",C.target.value),className:"w-full",children:[h.jsx("option",{value:"sonnet",children:"sonnet"}),h.jsx("option",{value:"opus",children:"opus"}),h.jsx("option",{value:"haiku",children:"haiku"})]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-sm text-muted-foreground",children:"Max Turns"}),h.jsx(En,{type:"number",min:1,max:100,value:A("max_turns")??25,onChange:C=>{const D=Number(C.target.value);Number.isFinite(D)&&w("max_turns",Math.max(1,Math.min(100,D)))},className:"w-full"})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-sm text-muted-foreground",children:"Permission Mode"}),h.jsxs(Ka,{value:A("permission_mode")??"default",onChange:C=>w("permission_mode",C.target.value),className:"w-full",children:[h.jsx("option",{value:"default",children:"default"}),h.jsx("option",{value:"acceptEdits",children:"acceptEdits"}),h.jsx("option",{value:"bypassPermissions",children:"bypassPermissions"}),h.jsx("option",{value:"plan",children:"plan"}),h.jsx("option",{value:"dontAsk",children:"dontAsk"})]})]}),x.length>0&&h.jsxs("div",{className:"space-y-1",children:[h.jsxs("label",{className:"text-sm text-muted-foreground",children:["Auth Profile ",h.jsxs("span",{className:"text-xs text-muted-foreground/60",children:["(",O,")"]})]}),h.jsxs(Ka,{value:A("auth")??a.auth_profile??"",onChange:C=>{const D=C.target.value;D===(a.auth_profile??"")?i(j=>{const Q={...j};return delete Q.auth,Q}):w("auth",D)},className:"w-full",children:[!a.auth_profile&&h.jsx("option",{value:"",children:"Select profile..."}),x.map(C=>h.jsxs("option",{value:C.name,children:[C.name," (",C.type==="oauth_token"?"OAuth":"API Key",")"]},C.name))]})]}),x.length===0&&h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-sm text-muted-foreground",children:"Auth Profile"}),h.jsxs("div",{className:"text-sm text-foreground font-mono",children:[a.auth_profile??"—"," ",h.jsxs("span",{className:"text-muted-foreground font-sans text-xs",children:["(",O,")"]})]})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsxs("button",{type:"button",onClick:()=>v(!y),className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx("span",{className:"text-xs",children:y?"v":">"}),"System Prompt"]}),y&&h.jsx(af,{mono:!0,rows:6,value:A("system")??"",onChange:C=>w("system",C.target.value),className:"w-full"})]}),h.jsx("div",{className:"pt-2 border-t border-border",children:h.jsx(Ye,{size:"lg",onClick:H,disabled:!L||c,children:c?"Saving...":"Save & Restart"})}),d&&h.jsx(Yn,{variant:d.type,children:d.text})]})]})}function cT(){const[a,s]=E.useState([]),[o,i]=E.useState(""),[c,f]=E.useState(!0),[d,m]=E.useState(null),b=E.useRef(null),p=E.useCallback(async(x=!1)=>{x&&f(!0);try{const T=await yt("/api/logs?limit=100");if(!T.ok)throw new Error(`HTTP ${T.status}`);const w=await T.json();Array.isArray(w)&&s(w.reverse()),m(null)}catch(T){m(T instanceof Error?T.message:"Failed to load logs")}finally{f(!1)}},[]);E.useEffect(()=>(p(!0),b.current=setInterval(()=>p(),1e4),()=>{b.current&&clearInterval(b.current)}),[p]);const y=Array.from(new Set(a.map(x=>x.type))).sort(),v=o?a.filter(x=>x.type===o):a;return h.jsxs("section",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-3",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Event Log"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs(Ka,{compact:!0,value:o,onChange:x=>i(x.target.value),children:[h.jsx("option",{value:"",children:"All"}),y.map(x=>h.jsx("option",{value:x,children:x},x))]}),h.jsx(Ye,{variant:"secondary",size:"xs",onClick:()=>p(!0),children:"Refresh"})]})]}),h.jsxs("div",{className:"space-y-1 font-mono text-sm max-h-96 overflow-y-auto scrollbar-thin",children:[c&&h.jsx("p",{className:"text-muted-foreground",children:"Loading..."}),!c&&d&&h.jsx("p",{className:"text-destructive",children:d}),!c&&!d&&v.length===0&&h.jsx("p",{className:"text-muted-foreground",children:"No events"}),!c&&v.map((x,T)=>h.jsxs("div",{className:"flex gap-3 py-1 border-b border-border/50",children:[h.jsx("span",{className:"text-muted-foreground shrink-0",children:new Date(x.timestamp).toLocaleTimeString()}),h.jsx("span",{className:`shrink-0 ${x.type==="mecha_call"?"text-primary":x.type==="error"?"text-destructive":"text-muted-foreground"}`,children:x.type}),h.jsx("span",{className:"text-foreground truncate",children:Object.entries(x).filter(([w])=>w!=="type"&&w!=="timestamp").map(([w,A])=>`${w}=${JSON.stringify(A)}`).join(" ")})]},`${x.timestamp}-${x.type}-${T}`))]})]})}const fT={task:"Current Task",today:"Today",lifetime:"Lifetime"},dT=["#f4c89a","#8b6d4a","#e8a87c","#c67b5c","#5c4033","#2c1810"];function hT(){const[a,s]=E.useState(null),[o,i]=E.useState(!1),[c,f]=E.useState(null),[d,m]=E.useState(!1),[b,p]=E.useState(null),{isFleet:y,selectedBot:v}=nf(),[x,T]=E.useState(0),[w,A]=E.useState(0),[L,H]=E.useState(""),[Z,O]=E.useState(!1),[C,D]=E.useState(!1),j=E.useRef(null),Q=E.useRef(null);E.useEffect(()=>{yt("/api/costs").then(ie=>{if(!ie.ok)throw new Error(`HTTP ${ie.status}`);return ie.json()}).then(ie=>{const ue=ie;typeof ue.task=="number"&&typeof ue.today=="number"&&typeof ue.lifetime=="number"&&s(ue)}).catch(()=>i(!0))},[]),E.useEffect(()=>{if(!y||!v)return;j.current&&(clearTimeout(j.current),j.current=null),O(!1),T(0),A(0),H(v);let ie=!1;return un("/api/office/avatars").then(ue=>{if(!ue.ok)throw new Error(`HTTP ${ue.status}`);return ue.json()}).then(ue=>{if(ie)return;const Ee=ue[v];Ee&&(T(Ee.palette??0),A(Ee.hueShift??0),H(Ee.displayName??v)),O(!0)}).catch(()=>{ie||O(!0)}),()=>{ie=!0}},[y,v]);const fe=E.useCallback((ie,ue,ge)=>{v&&(D(!1),j.current&&clearTimeout(j.current),j.current=setTimeout(async()=>{try{(await un("/api/office/avatars",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:v,palette:ie,hueShift:ue,displayName:ge.trim()})})).ok||D(!0)}catch{D(!0)}},500))},[v]);E.useEffect(()=>{const ie=Q.current;if(!ie)return;const ge=u0(x,w).typing[oe.DOWN][0];if(!ge||ge.length===0)return;const Ee=ge.length,se=ge[0].length,me=4;ie.width=se*me,ie.height=Ee*me;const G=ie.getContext("2d");if(G){G.imageSmoothingEnabled=!1,G.clearRect(0,0,ie.width,ie.height);for(let le=0;le<Ee;le++)for(let he=0;he<se;he++){const re=ge[le][he];re&&re!==""&&(G.fillStyle=re,G.fillRect(he*me,le*me,me,me))}}},[x,w,Z]),E.useEffect(()=>()=>{j.current&&clearTimeout(j.current)},[]);const we=E.useCallback(async(ie,ue=!1)=>{m(!0),f(null);try{const ge=await yt(`/api/bot/${ie}${ue?"?force=true":""}`,{method:"POST"}),Ee=await ge.json();ge.status===409&&Ee.code==="BOT_BUSY"?p({action:ie,state:String(Ee.state??"busy")}):ge.ok?(f({text:ie==="stop"?"Bot is stopping...":"Bot is restarting...",type:"success"}),p(null)):f({text:String(Ee.error??"Action failed"),type:"error"})}catch{f({text:"Network error",type:"error"})}finally{m(!1)}},[]);return h.jsxs("div",{className:"p-6 space-y-6 max-w-4xl mx-auto h-full overflow-y-auto",children:[h.jsx(oT,{}),y&&Z&&h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-3",children:"Avatar"}),h.jsx(ct,{spacing:3,children:h.jsxs("div",{className:"flex items-start gap-4",children:[h.jsx("canvas",{ref:Q,style:{imageRendering:"pixelated",background:"var(--color-muted)",borderRadius:8},className:"shrink-0"}),h.jsxs("div",{className:"flex-1 space-y-3",children:[h.jsxs("div",{children:[h.jsx("label",{className:"text-xs text-muted-foreground block mb-1",children:"Display Name"}),h.jsx(En,{value:L,onChange:ie=>{const ue=ie.target.value;H(ue),fe(x,w,ue)},className:"w-full"})]}),h.jsxs("div",{children:[h.jsx("label",{className:"text-xs text-muted-foreground block mb-1",children:"Skin Tone"}),h.jsx("div",{className:"flex gap-2",children:dT.map((ie,ue)=>h.jsx("button",{onClick:()=>{T(ue),fe(ue,w,L)},style:{width:28,height:28,borderRadius:6,background:ie,border:ue===x?"2px solid var(--color-primary)":"2px solid transparent",cursor:"pointer"},"aria-label":`Palette ${ue+1}`},ue))})]}),h.jsxs("div",{children:[h.jsxs("label",{className:"text-xs text-muted-foreground block mb-1",children:["Hue Shift ",h.jsxs("span",{className:"font-mono",children:[w,"°"]})]}),h.jsx("input",{type:"range",min:0,max:359,value:w,onChange:ie=>{const ue=Number(ie.target.value);A(ue),fe(x,ue,L)},className:"w-full"})]})]})]})}),C&&h.jsx(Yn,{variant:"error",className:"mt-2",children:"Failed to save avatar"})]}),h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-3",children:"Costs"}),a?h.jsx("div",{className:"grid grid-cols-3 gap-4",children:["task","today","lifetime"].map(ie=>h.jsxs(ct,{className:"text-center",children:[h.jsxs("div",{className:"text-2xl font-bold text-foreground",children:["$",a[ie].toFixed(4)]}),h.jsx("div",{className:"text-muted-foreground text-sm mt-1",children:fT[ie]})]},ie))}):o?h.jsx(ct,{className:"text-sm text-destructive",children:"Failed to load costs"}):h.jsx(ct,{className:"text-sm text-muted-foreground",children:"Loading..."})]}),h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-3",children:"Controls"}),h.jsxs("div",{className:"flex gap-3",children:[h.jsx(Ye,{variant:"secondary",size:"lg",onClick:()=>we("restart"),disabled:d,children:d?"...":"Restart Bot"}),h.jsx(Ye,{variant:"destructive-soft",size:"lg",onClick:()=>we("stop"),disabled:d,children:d?"...":"Stop Bot"})]}),c&&h.jsx(Yn,{variant:c.type,className:"mt-3",children:c.text})]}),h.jsx(uT,{}),h.jsx(cT,{}),h.jsx(sf,{open:!!b,size:"md",title:"Bot is Busy",children:b&&h.jsxs(h.Fragment,{children:[h.jsxs("p",{className:"text-sm text-muted-foreground mb-1",children:["The bot is currently ",h.jsx("span",{className:"font-mono text-foreground",children:b.state}),"."]}),h.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:b.action==="stop"?"Stopping now will interrupt the current task. Are you sure?":"Restarting now will interrupt the current task. Are you sure?"}),h.jsxs(rf,{children:[h.jsx(Ye,{variant:"secondary",size:"lg",onClick:()=>p(null),children:"Cancel"}),h.jsxs(Ye,{variant:"destructive",size:"lg",onClick:()=>{const{action:ie}=b;p(null),we(ie,!0)},children:["Force ",b.action==="stop"?"Stop":"Restart"]})]})]})})]})}const mT=[{label:"Push",value:"push"},{label:"Pull Request Opened",value:"pull_request.opened"},{label:"Pull Request Closed",value:"pull_request.closed"},{label:"PR Review Requested",value:"pull_request.review_requested"},{label:"Issue Opened",value:"issues.opened"},{label:"Issue Commented",value:"issue_comment.created"},{label:"Release Published",value:"release.published"},{label:"Workflow Run Completed",value:"workflow_run.completed"},{label:"Star Created",value:"star.created"}];function pT(){const[a,s]=E.useState([]),[o,i]=E.useState(!1),[c,f]=E.useState(""),[d,m]=E.useState(""),[b,p]=E.useState(!1),[y,v]=E.useState(!0),[x,T]=E.useState(null),w=E.useRef(void 0),A=E.useCallback((j,Q)=>{w.current&&clearTimeout(w.current),T({text:j,type:Q}),w.current=setTimeout(()=>T(null),3e3)},[]),L=E.useCallback(()=>{yt("/api/webhooks").then(j=>{if(!j.ok)throw new Error(`HTTP ${j.status}`);return j.json()}).then(j=>{s(j.accept??[]),i(!!j.secret_set),v(!1)}).catch(j=>{A(j instanceof Error?j.message:"Failed to load","error"),v(!1)})},[A]);E.useEffect(()=>{L()},[L]);async function H(){const j=c.trim();if(j){if(a.includes(j)){A(`"${j}" already accepted`,"error");return}try{const Q=await yt("/api/webhooks/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({event:j})});if(!Q.ok){const fe=await Q.json();A(fe.error??"Failed to add","error");return}s(fe=>[...fe,j]),f(""),A(`Event "${j}" added`,"success")}catch{A("Network error","error")}}}async function Z(j){try{const Q=await yt(`/api/webhooks/accept/${encodeURIComponent(j)}`,{method:"DELETE"});if(!Q.ok){const fe=await Q.json();A(fe.error??"Failed to remove","error");return}s(fe=>fe.filter(we=>we!==j)),A(`Event "${j}" removed`,"success")}catch{A("Network error","error")}}async function O(){try{const j=await yt("/api/webhooks",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:d||null})});if(!j.ok){const Q=await j.json();A(Q.error??"Failed to save","error");return}i(!!d),m(""),p(!1),A(d?"Secret updated":"Secret removed","success")}catch{A("Network error","error")}}async function C(){const j=window.location.origin+lo("/webhook");try{await navigator.clipboard.writeText(j),A("Copied!","success")}catch{A("Failed to copy","error")}}const D=mT.filter(j=>!a.includes(j.value));return y?h.jsx("div",{className:"p-6 max-w-4xl mx-auto h-full flex items-center justify-center",children:h.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):h.jsxs("div",{className:"p-6 space-y-4 max-w-4xl mx-auto h-full overflow-y-auto",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Webhooks"}),x&&h.jsx(Yn,{variant:x.type,children:x.text}),h.jsxs(ct,{spacing:2,children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Endpoint"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"flex-1 text-sm font-mono text-primary bg-background border border-border rounded-md px-3 py-1.5",children:"POST /webhook"}),h.jsx(Ye,{onClick:C,className:"whitespace-nowrap",children:"Copy URL"})]})]}),h.jsxs(ct,{spacing:3,children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Accepted Events"}),a.length===0?h.jsx("p",{className:"text-sm text-muted-foreground",children:"No events configured -- add one to start"}):h.jsx("div",{className:"flex flex-wrap gap-2",children:a.map(j=>h.jsx(Jb,{variant:"primary",onRemove:()=>Z(j),children:j},j))}),h.jsxs("div",{className:"flex items-center gap-2",children:[D.length>0&&h.jsxs(Ka,{compact:!0,value:"",onChange:j=>{j.target.value&&f(j.target.value)},children:[h.jsx("option",{value:"",children:"GitHub Events"}),D.map(j=>h.jsx("option",{value:j.value,children:j.label},j.value))]}),h.jsx(En,{value:c,onChange:j=>f(j.target.value),onKeyDown:j=>{j.key==="Enter"&&H()},placeholder:"custom.event",className:"flex-1"}),h.jsx(Ye,{onClick:H,disabled:!c.trim(),children:"+ Add"})]})]}),h.jsxs(ct,{spacing:3,children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Secret"}),h.jsx(Ye,{variant:"ghost",size:"xs",onClick:()=>{p(!b),m("")},children:b?"Cancel":"Change"})]}),h.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[h.jsx(no,{color:o?"green":"muted-lighter"}),h.jsx("span",{className:"text-foreground",children:o?"Configured":"Not set"})]}),b&&h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(En,{type:"password",value:d,onChange:j=>m(j.target.value),placeholder:"Enter new secret",className:"flex-1"}),h.jsx(Ye,{onClick:O,disabled:!d.trim(),children:"Save"}),o&&h.jsx(Ye,{variant:"ghost-destructive",onClick:async()=>{try{if(!(await yt("/api/webhooks",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:null})})).ok){A("Failed to remove secret","error");return}i(!1),p(!1),A("Secret removed","success")}catch{A("Network error","error")}},children:"Remove"})]})]})]})}function gT(){const{bots:a,refreshBots:s,selectBot:o}=nf(),[i,c]=E.useState(!1),[f,d]=E.useState(""),[m,b]=E.useState(""),[p,y]=E.useState("sonnet"),[v,x]=E.useState(!1),[T,w]=E.useState(null),[A,L]=E.useState(null);async function H(){if(!(!f||!m)){x(!0),w(null);try{const D=await un("/api/bots",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:f,system:m,model:p})}),j=await D.json();if(!D.ok){w({text:String(j.error??"Spawn failed"),type:"error"});return}w({text:`Bot "${f}" spawned`,type:"success"}),c(!1),d(""),b(""),s()}catch{w({text:"Network error",type:"error"})}finally{x(!1)}}}async function Z(D,j=!1){x(!0),w(null);try{const Q=await un(`/api/bots/${D}/stop${j?"?force=true":""}`,{method:"POST"}),fe=await Q.json();Q.ok?(w({text:`Bot "${D}" stopping`,type:"success"}),L(null)):w({text:String(fe.error??"Stop failed"),type:"error"}),s()}catch{w({text:"Network error",type:"error"})}finally{x(!1)}}async function O(D,j=!1){x(!0),w(null);try{const Q=await un(`/api/bots/${D}/restart${j?"?force=true":""}`,{method:"POST"}),fe=await Q.json();Q.status===409&&!j?L({name:D,action:"restart"}):Q.ok?w({text:`Bot "${D}" restarting`,type:"success"}):w({text:String(fe.error??"Restart failed"),type:"error"}),s()}catch{w({text:"Network error",type:"error"})}finally{x(!1)}}async function C(D){x(!0),w(null);try{const j=await un(`/api/bots/${D}`,{method:"DELETE"}),Q=await j.json();j.ok?(w({text:`Bot "${D}" removed`,type:"success"}),L(null)):w({text:String(Q.error??"Remove failed"),type:"error"}),s()}catch{w({text:"Network error",type:"error"})}finally{x(!1)}}return h.jsxs("div",{className:"p-6 space-y-4 max-w-4xl mx-auto h-full overflow-y-auto",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("h2",{className:"text-lg font-semibold text-foreground",children:["Fleet (",a.length," bots)"]}),h.jsx(Ye,{onClick:()=>c(!i),children:"+ Spawn Bot"})]}),T&&h.jsx(Yn,{variant:T.type,onDismiss:()=>w(null),children:T.text}),i&&h.jsxs(ct,{spacing:3,children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:"New Bot"}),h.jsx(En,{value:f,onChange:D=>d(D.target.value),placeholder:"Bot name",className:"w-full"}),h.jsx(af,{value:m,onChange:D=>b(D.target.value),placeholder:"System prompt",rows:3,className:"w-full"}),h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs(Ka,{value:p,onChange:D=>y(D.target.value),children:[h.jsx("option",{value:"sonnet",children:"Sonnet"}),h.jsx("option",{value:"opus",children:"Opus"}),h.jsx("option",{value:"haiku",children:"Haiku"})]}),h.jsx("div",{className:"flex-1"}),h.jsx(Ye,{variant:"secondary",onClick:()=>c(!1),children:"Cancel"}),h.jsx(Ye,{onClick:H,disabled:!f||!m||v,children:v?"Creating...":"Create"})]})]}),a.length===0&&h.jsx("p",{className:"text-muted-foreground text-sm",children:"No bots. Spawn one to get started."}),h.jsx("div",{className:"space-y-2",children:a.map(D=>h.jsxs(ct,{compact:!0,className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[h.jsx(no,{color:D.status==="running"?"green":"muted",size:"lg"}),h.jsxs("div",{className:"min-w-0",children:[h.jsx("button",{onClick:()=>o(D.name),className:"font-medium text-foreground hover:text-primary transition-colors text-left",children:D.name}),h.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:[D.model," | ",D.containerId,D.ports?` | ${D.ports}`:""]})]})]}),h.jsxs("div",{className:"flex gap-1.5 shrink-0",children:[D.status==="running"?h.jsxs(h.Fragment,{children:[h.jsx(Ye,{variant:"ghost",size:"xs",onClick:()=>o(D.name),children:"Open"}),h.jsx(Ye,{variant:"ghost",size:"xs",onClick:()=>O(D.name),disabled:v,children:"Restart"}),h.jsx(Ye,{variant:"ghost",size:"xs",onClick:()=>L({name:D.name,action:"stop"}),disabled:v,children:"Stop"})]}):h.jsx(Ye,{variant:"ghost",size:"xs",onClick:()=>O(D.name),disabled:v,children:"Start"}),h.jsx(Ye,{variant:"ghost-destructive",size:"xs",onClick:()=>L({name:D.name,action:"remove"}),disabled:v,children:"Remove"})]})]},D.name))}),h.jsx(sf,{open:!!A,title:(A==null?void 0:A.action)==="remove"?"Remove Bot":(A==null?void 0:A.action)==="restart"?"Restart Bot":"Stop Bot",description:(A==null?void 0:A.action)==="remove"?`Remove "${A.name}"? This will delete the container and all its data.`:(A==null?void 0:A.action)==="restart"?`"${A.name}" is busy. Force restart will interrupt the current task.`:A?`Stop "${A.name}"? This will interrupt any running tasks.`:void 0,children:h.jsxs(rf,{children:[h.jsx(Ye,{variant:"secondary",size:"lg",onClick:()=>L(null),children:"Cancel"}),h.jsx(Ye,{variant:"destructive",size:"lg",onClick:()=>{(A==null?void 0:A.action)==="stop"?Z(A.name,!0):(A==null?void 0:A.action)==="restart"?O(A.name,!0):A&&C(A.name)},children:(A==null?void 0:A.action)==="remove"?"Remove":(A==null?void 0:A.action)==="restart"?"Force Restart":"Force Stop"})]})})]})}function yT(){const[a,s]=E.useState([]),[o,i]=E.useState(new Map),c=E.useRef(void 0),f=E.useCallback(()=>{un("/api/network").then(d=>{if(!d.ok)throw new Error(`HTTP ${d.status}`);return d.json()}).then(d=>{if(!Array.isArray(d))return;const m=d;s(m.sort((p,y)=>y.timestamp.localeCompare(p.timestamp)).slice(0,100));const b=new Map;for(const p of m)if(p.type==="mecha_call"&&p.target){const y=`${p.source_bot} → ${p.target}`,v=b.get(y);b.set(y,{count:((v==null?void 0:v.count)??0)+1,lastSeen:p.timestamp>((v==null?void 0:v.lastSeen)??"")?p.timestamp:(v==null?void 0:v.lastSeen)??""})}i(b)}).catch(()=>{})},[]);return E.useEffect(()=>(f(),c.current=setInterval(f,1e4),()=>clearInterval(c.current)),[f]),h.jsxs("div",{className:"p-6 space-y-6 max-w-4xl mx-auto h-full overflow-y-auto",children:[h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-4",children:"Communication Map"}),o.size===0?h.jsx("p",{className:"text-muted-foreground text-sm",children:"No bot-to-bot communication recorded"}):h.jsx("div",{className:"space-y-2",children:Array.from(o.entries()).map(([d,m])=>h.jsxs(ct,{compact:!0,className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-mono text-sm text-primary",children:d}),h.jsxs("div",{className:"flex gap-4 text-sm text-muted-foreground",children:[h.jsxs("span",{children:[m.count," calls"]}),h.jsxs("span",{children:["Last: ",new Date(m.lastSeen).toLocaleString()]})]})]},d))})]}),h.jsxs("section",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Recent Events"}),h.jsx(Ye,{variant:"secondary",size:"xs",onClick:f,children:"Refresh"})]}),h.jsxs("div",{className:"space-y-1 font-mono text-sm",children:[a.length===0&&h.jsx("p",{className:"text-muted-foreground",children:"No events"}),a.slice(0,50).map((d,m)=>h.jsxs("div",{className:"flex gap-3 py-1 border-b border-border/50",children:[h.jsx("span",{className:"text-muted-foreground shrink-0",children:new Date(d.timestamp).toLocaleTimeString()}),h.jsx("span",{className:"text-yellow-600 dark:text-yellow-400 shrink-0",children:d.source_bot}),h.jsx("span",{className:"text-muted-foreground",children:d.type}),d.target&&h.jsxs("span",{className:"text-primary",children:["→ ",d.target]}),d.success!==void 0&&h.jsx("span",{className:d.success?"text-green-600 dark:text-green-400":"text-destructive",children:d.success?"ok":"fail"}),d.duration!==void 0&&h.jsxs("span",{className:"text-muted-foreground",children:[d.duration,"ms"]})]},`${d.timestamp}-${m}`))]})]})]})}function bT(){const[a,s]=E.useState(null),[o,i]=E.useState(null),[c,f]=E.useState(null),[d,m]=E.useState(""),[b,p]=E.useState(!1),[y,v]=E.useState(null),x=E.useCallback(()=>{un("/api/totp/status").then(A=>A.json()).then(A=>s(!!A.enabled)).catch(()=>{})},[]);E.useEffect(()=>{x()},[x]);async function T(){p(!0),v(null);try{const A=await un("/api/totp/enable",{method:"POST"}),L=await A.json();if(!A.ok){v({text:String(L.error??"Failed"),type:"error"});return}i(L.secret??null),f(L.uri??null),s(!0),v({text:"TOTP enabled — save this secret in your authenticator app",type:"success"})}catch{v({text:"Network error",type:"error"})}finally{p(!1)}}async function w(){if(d.length===6){p(!0),v(null);try{const A=await un("/api/totp",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d})}),L=await A.json();if(!A.ok){v({text:String(L.error??"Failed"),type:"error"});return}s(!1),i(null),f(null),m(""),v({text:"TOTP disabled",type:"success"})}catch{v({text:"Network error",type:"error"})}finally{p(!1)}}}return a===null?null:h.jsxs("section",{children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Dashboard Authentication"}),h.jsx(Yc,{variant:a?"success":"muted",children:a?"TOTP enabled":"No authentication"})]}),y&&h.jsx(Yn,{variant:y.type,onDismiss:()=>v(null),className:"mb-3",children:y.text}),!a&&h.jsxs(ct,{spacing:3,children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"Enable TOTP to require a 6-digit code from an authenticator app when accessing the dashboard."}),h.jsx(Ye,{onClick:T,disabled:b,children:b?"Enabling...":"Enable TOTP"})]}),a&&o&&h.jsxs(ct,{spacing:3,children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"Scan this URI with your authenticator app, or copy the secret manually."}),h.jsxs("div",{children:[h.jsx("label",{className:"text-xs text-muted-foreground block mb-1",children:"Secret"}),h.jsx(En,{mono:!0,readOnly:!0,value:o,className:"w-full"})]}),c&&h.jsxs("div",{children:[h.jsx("label",{className:"text-xs text-muted-foreground block mb-1",children:"OTPAuth URI"}),h.jsx(En,{mono:!0,readOnly:!0,value:c,className:"w-full text-xs"})]})]}),a&&!o&&h.jsxs(ct,{spacing:3,children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"To disable TOTP, enter a valid code from your authenticator app."}),h.jsx(En,{mono:!0,value:d,onChange:A=>{const L=A.target.value.replace(/\D/g,"").slice(0,6);m(L)},placeholder:"6-digit code",className:"w-48",inputMode:"numeric"}),h.jsx(Ye,{variant:"destructive-soft",onClick:w,disabled:d.length!==6||b,children:b?"Disabling...":"Disable TOTP"})]})]})}function xT(){const[a,s]=E.useState([]),[o,i]=E.useState(""),[c,f]=E.useState(""),[d,m]=E.useState(!1),[b,p]=E.useState(null),y=E.useCallback(()=>{un("/api/auth").then(x=>{if(!x.ok)throw new Error(`HTTP ${x.status}`);return x.json()}).then(x=>{Array.isArray(x)&&(x.length===0||typeof x[0]=="string"?s(x.map(T=>({name:T,type:"unknown"}))):s(x))}).catch(()=>{})},[]);E.useEffect(()=>{y()},[y]);async function v(){if(!(!o||!c)){m(!0),p(null);try{const x=await un("/api/auth",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({profile:o,key:c})}),T=await x.json();if(!x.ok){p({text:String(T.error??"Failed to add"),type:"error"});return}p({text:`Profile "${o}" added`,type:"success"}),i(""),f(""),y()}catch{p({text:"Network error",type:"error"})}finally{m(!1)}}}return h.jsxs("div",{className:"p-6 space-y-6 max-w-4xl mx-auto h-full overflow-y-auto",children:[h.jsx(bT,{}),h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-4",children:"Auth Profiles"}),h.jsxs("div",{className:"space-y-2",children:[a.length===0&&h.jsx("p",{className:"text-muted-foreground text-sm",children:"No profiles configured"}),a.map(x=>h.jsxs(ct,{compact:!0,className:"flex items-center gap-3",children:[h.jsx(no,{color:"green"}),h.jsx("span",{className:"font-mono text-sm text-foreground",children:x.name}),x.type!=="unknown"&&h.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",x.type,")"]})]},x.name))]})]}),h.jsxs("section",{children:[h.jsx("h2",{className:"text-lg font-semibold text-foreground mb-4",children:"Add Profile"}),h.jsxs(ct,{spacing:3,children:[h.jsx(En,{value:o,onChange:x=>i(x.target.value),placeholder:"Profile name (e.g. anthropic-main)",className:"w-full"}),h.jsx(En,{value:c,onChange:x=>f(x.target.value),placeholder:"API key or OAuth token",type:"password",className:"w-full"}),b&&h.jsx(Yn,{variant:b.type,children:b.text}),h.jsx(Ye,{onClick:v,disabled:!o||!c||d,children:d?"Adding...":"Add Profile"})]})]})]})}const vT={position:"absolute",bottom:10,left:10,zIndex:"var(--pixel-controls-z)",display:"flex",alignItems:"center",gap:4,background:"var(--pixel-bg)",border:"2px solid var(--pixel-border)",borderRadius:0,padding:"4px 6px",boxShadow:"var(--pixel-shadow)"},pi={padding:"5px 10px",fontSize:"24px",color:"var(--pixel-text)",background:"var(--pixel-btn-bg)",border:"2px solid transparent",borderRadius:0,cursor:"pointer"},TT={...pi,background:"var(--pixel-active-bg)",border:"2px solid var(--pixel-accent)"};function ST({isEditMode:a,onToggleEditMode:s,isDebugMode:o,onToggleDebugMode:i,onOpenSettings:c}){const[f,d]=E.useState(null);return h.jsxs("div",{style:vT,children:[h.jsx("button",{onClick:s,onMouseEnter:()=>d("edit"),onMouseLeave:()=>d(null),style:a?{...TT}:{...pi,background:f==="edit"?"var(--pixel-btn-hover-bg)":pi.background},title:"Edit office layout",children:"Layout"}),h.jsx("button",{onClick:c,onMouseEnter:()=>d("settings"),onMouseLeave:()=>d(null),style:{...pi,background:f==="settings"?"var(--pixel-btn-hover-bg)":pi.background},title:"Settings",children:"Settings"})]})}const ET=40;function wT({tool:a}){return h.jsx("span",{className:a.done?void 0:"pixel-agents-pulse",style:{width:6,height:6,borderRadius:"50%",background:a.done?"#89d185":a.permissionWait?"#cca700":"#3794ff",display:"inline-block",flexShrink:0}})}function lg({tool:a}){return h.jsxs("span",{style:{fontSize:"22px",opacity:a.done?.5:.8,display:"flex",alignItems:"center",gap:5},children:[h.jsx(wT,{tool:a}),a.permissionWait&&!a.done?"Needs approval":a.status]})}function AT({agents:a,selectedAgent:s,agentTools:o,agentStatuses:i,subagentTools:c,onSelectAgent:f}){const d=m=>{const b=s===m,p=o[m]||[],y=c[m]||{},v=i[m],x=p.some(T=>!T.done);return h.jsxs("div",{style:{border:`2px solid ${b?"#5a8cff":"#4a4a6a"}`,borderRadius:0,padding:"6px 8px",background:b?"rgba(255,255,255,0.04)":void 0},children:[h.jsx("span",{style:{display:"inline-flex",alignItems:"center",gap:0},children:h.jsxs("button",{onClick:()=>f(m),style:{borderRadius:0,padding:"6px 10px",fontSize:"26px",background:b?"rgba(90, 140, 255, 0.25)":void 0,color:b?"#fff":void 0,fontWeight:b?"bold":void 0},children:["Agent #",m]})}),(p.length>0||v==="waiting")&&h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1,marginTop:4,paddingLeft:4},children:[p.map(T=>h.jsxs("div",{children:[h.jsx(lg,{tool:T}),y[T.toolId]&&y[T.toolId].length>0&&h.jsx("div",{style:{borderLeft:"2px solid rgba(255,255,255,0.12)",marginLeft:3,paddingLeft:8,marginTop:1,display:"flex",flexDirection:"column",gap:1},children:y[T.toolId].map(w=>h.jsx(lg,{tool:w},w.toolId))})]},T.toolId)),v==="waiting"&&!x&&h.jsxs("span",{style:{fontSize:"22px",opacity:.85,display:"flex",alignItems:"center",gap:5},children:[h.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"#cca700",display:"inline-block",flexShrink:0}}),"Might be waiting for input"]})]})]},m)};return h.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:"var(--pixel-bg)",zIndex:ET,overflow:"auto"},children:h.jsx("div",{style:{padding:"12px 12px 12px",fontSize:"28px"},children:h.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:a.map(d)})})})}let c0=!0,Gr=null;function _T(a){c0=a}function ag(){return c0}function RT(){try{Gr||(Gr=new AudioContext),Gr.state==="suspended"&&Gr.resume()}catch{}}const Gn=new Map,Fn=new Map,Wr=new Map,Bc=new Map,Kr=new Map;let Jc=null,gi=null,f0=null;function d0(a){if(!(a!=null&&a.catalog)||!(a!=null&&a.sprites))return!1;const s=a.catalog.map(x=>{const T=a.sprites[x.id];return T?{type:x.id,label:x.label,footprintW:x.footprintW,footprintH:x.footprintH,sprite:T,isDesk:x.isDesk,category:x.category,...x.orientation?{orientation:x.orientation}:{},...x.canPlaceOnSurfaces?{canPlaceOnSurfaces:!0}:{},...x.backgroundTiles?{backgroundTiles:x.backgroundTiles}:{},...x.canPlaceOnWalls?{canPlaceOnWalls:!0}:{},...x.mirrorSide?{mirrorSide:!0}:{},...x.interactable?{interactable:!0}:{},...x.interactAction?{interactAction:x.interactAction}:{},...x.interactSides?{interactSides:x.interactSides}:{}}:(console.warn(`No sprite data for asset ${x.id}`),null)}).filter(x=>x!==null);for(const x of a.catalog)if(x.mirrorSide&&x.orientation==="side"){const T=s.find(w=>w.type===x.id);T&&s.push({...T,type:`${x.id}:left`,orientation:"left",mirrorSide:!0})}if(s.length===0)return!1;Gn.clear(),Fn.clear(),Wr.clear(),Bc.clear(),Kr.clear();const o=new Map;for(const x of a.catalog)if(x.groupId&&x.orientation){if(x.state&&x.state!=="off")continue;let T=o.get(x.groupId);T||(T=new Map,o.set(x.groupId,T)),x.orientation==="side"?(T.set("right",x.id),x.mirrorSide&&T.set("left",`${x.id}:left`)):T.set(x.orientation,x.id)}const i=new Map;for(const x of a.catalog)x.groupId&&x.rotationScheme&&i.set(x.groupId,x.rotationScheme);const c=new Set,f=["front","right","back","left"];for(const[x,T]of o){if(T.size<2)continue;const w=i.get(x);let A=f;w==="2-way"&&(A=["front","right"]);const L=A.filter(C=>T.has(C));if(L.length<2)continue;const H={};for(const C of L)H[C]=T.get(C);const Z={orientations:L,members:H},O=new Set;for(const C of Object.values(H))O.has(C)||(Gn.set(C,Z),O.add(C));for(const[C,D]of Object.entries(H))C!=="front"&&c.add(D)}const d=new Map;for(const x of a.catalog)if(x.groupId&&x.state){const T=`${x.groupId}|${x.orientation||""}`;let w=d.get(T);if(w||(w=new Map,d.set(T,w)),x.animationGroup&&x.frame!==void 0&&x.frame>0)continue;w.set(x.state,x.id)}for(const x of d.values()){const T=x.get("on"),w=x.get("off");if(T&&w){Fn.set(T,w),Fn.set(w,T),Wr.set(w,T),Bc.set(T,w);const A=a.catalog.find(L=>L.id===w);if(A!=null&&A.mirrorSide){const L=`${w}:left`,H=`${T}:left`;Fn.set(H,L),Fn.set(L,H),Wr.set(L,H),Bc.set(H,L)}}}for(const x of a.catalog)if(x.groupId&&x.orientation&&x.state==="on"){if(x.animationGroup&&x.frame!==void 0&&x.frame>0)continue;const T=Fn.get(x.id);if(T){const w=Gn.get(T);if(w){const A={};for(const H of w.orientations){const Z=w.members[H],O=Fn.get(Z);A[H]=O??Z}const L={orientations:w.orientations,members:A};for(const H of Object.values(A))Gn.has(H)||Gn.set(H,L)}}}const m=new Map;for(const x of a.catalog)if(x.animationGroup&&x.frame!==void 0){let T=m.get(x.animationGroup);T||(T=[],m.set(x.animationGroup,T)),T.push({id:x.id,frame:x.frame})}for(const[x,T]of m)T.sort((w,A)=>w.frame-A.frame),Kr.set(x,T.map(w=>w.id));const b=new Set;for(const x of a.catalog)x.state==="on"&&b.add(x.id);Jc=s;const p=s.filter(x=>!c.has(x.type)&&!b.has(x.type));for(const x of p)(Gn.has(x.type)||Fn.has(x.type))&&(x.label=x.label.replace(/ - Front - Off$/,"").replace(/ - Front$/,"").replace(/ - Off$/,""));gi=p,f0=Array.from(new Set(p.map(x=>x.category))).filter(x=>!!x).sort();const y=new Set(Array.from(Gn.values())).size,v=Kr.size;return console.log(`✓ Built dynamic catalog with ${s.length} assets (${p.length} visible, ${y} rotation groups, ${Fn.size/2} state pairs, ${v} animation groups)`),!0}function rt(a){return Jc?Jc.find(s=>s.type===a):gi==null?void 0:gi.find(s=>s.type===a)}function CT(a){return(gi??[]).filter(o=>o.category===a)}function sg(){const a=f0??[];return kT.filter(s=>a.includes(s.id))}const kT=[{id:"desks",label:"Desks"},{id:"chairs",label:"Chairs"},{id:"storage",label:"Storage"},{id:"electronics",label:"Tech"},{id:"decor",label:"Decor"},{id:"wall",label:"Wall"},{id:"misc",label:"Misc"}];function h0(a,s){const o=Gn.get(a);if(!o)return null;const i=o.orientations.map(m=>o.members[m]),c=i.indexOf(a);if(c===-1)return null;const d=(c+1+i.length)%i.length;return i[d]}function m0(a){return Fn.get(a)??null}function NT(a){return Wr.get(a)??a}function Pc(a){return Gn.has(a)}function jT(a){for(const[,s]of Kr)if(s.includes(a))return s;return null}function OT(a){const s=Gn.get(a);if(s){for(const[o,i]of Object.entries(s.members))if(i===a)return o}}function ig(a){const s=[];for(let o=0;o<a.rows;o++){const i=[];for(let c=0;c<a.cols;c++)i.push(a.tiles[o*a.cols+c]);s.push(i)}return s}function Hc(a){const s=new Map;for(const i of a){const c=rt(i.type);if(!c||!c.isDesk)continue;const f=i.row*xe+c.sprite.length;for(let d=0;d<c.footprintH;d++)for(let m=0;m<c.footprintW;m++){const b=`${i.col+m},${i.row+d}`,p=s.get(b);(p===void 0||f>p)&&s.set(b,f)}}const o=[];for(const i of a){const c=rt(i.type);if(!c)continue;const f=i.col*xe,d=i.row*xe,m=c.sprite.length;let b=d+m;if(c.category==="chairs"&&(c.orientation==="back"?b=(i.row+1)*xe+1:b=(i.row+1)*xe),c.canPlaceOnSurfaces)for(let v=0;v<c.footprintH;v++)for(let x=0;x<c.footprintW;x++){const T=s.get(`${i.col+x},${i.row+v}`);T!==void 0&&T+.5>b&&(b=T+.5)}let p=c.sprite;if(i.color){const{h:v,s:x,b:T,c:w}=i.color;p=io(`furn-${i.type}-${v}-${x}-${T}-${w}-${i.color.colorize?1:0}`,c.sprite,i.color)}let y=!1;c.mirrorSide&&OT(i.type)==="left"&&(y=!0),o.push({sprite:p,x:f,y:d,zY:b,...y?{mirrored:!0}:{}})}return o}function rg(a,s){const o=new Set;for(const i of a){const c=rt(i.type);if(!c)continue;const f=c.backgroundTiles||0;for(let d=0;d<c.footprintH;d++)if(!(d<f))for(let m=0;m<c.footprintW;m++){const b=`${i.col+m},${i.row+d}`;o.add(b)}}return o}function DT(a,s){const o=new Set;for(const i of a){if(i.uid===s)continue;const c=rt(i.type);if(!c)continue;const f=c.backgroundTiles||0;for(let d=0;d<c.footprintH;d++)if(!(d<f))for(let m=0;m<c.footprintW;m++)o.add(`${i.col+m},${i.row+d}`)}return o}function MT(a){switch(a){case"front":return oe.DOWN;case"back":return oe.UP;case"left":return oe.LEFT;case"right":case"side":return oe.RIGHT;default:return oe.DOWN}}function og(a){const s=new Map,o=new Set;for(const c of a){const f=rt(c.type);if(!(!f||!f.isDesk))for(let d=0;d<f.footprintH;d++)for(let m=0;m<f.footprintW;m++)o.add(`${c.col+m},${c.row+d}`)}const i=[{dc:0,dr:-1,facing:oe.UP},{dc:0,dr:1,facing:oe.DOWN},{dc:-1,dr:0,facing:oe.LEFT},{dc:1,dr:0,facing:oe.RIGHT}];for(const c of a){const f=rt(c.type);if(!f||f.category!=="chairs")continue;let d=0;for(let m=0;m<f.footprintH;m++)for(let b=0;b<f.footprintW;b++){const p=c.col+b,y=c.row+m;let v=oe.DOWN;if(f.orientation)v=MT(f.orientation);else for(const Z of i)if(o.has(`${p+Z.dc},${y+Z.dr}`)){v=Z.facing;break}let x="lounge",T=!1,w=null;const A=v===oe.RIGHT?1:v===oe.LEFT?-1:0,L=v===oe.DOWN?1:v===oe.UP?-1:0;for(let Z=1;Z<=3;Z++){const O=p+A*Z,C=y+L*Z,D=a.find(j=>{const Q=rt(j.type);return Q!=null&&Q.isDesk?O>=j.col&&O<j.col+Q.footprintW&&C>=j.row&&C<j.row+Q.footprintH:!1});if(D){x="desk",w=D.uid;const j=rt(D.type),Q=(j==null?void 0:j.footprintW)??1,fe=(j==null?void 0:j.footprintH)??1;T=a.some(we=>{var ie;return we.type.startsWith("PC_")&&((ie=rt(we.type))==null?void 0:ie.canPlaceOnSurfaces)&&we.col>=D.col&&we.col<D.col+Q&&we.row>=D.row&&we.row<D.row+fe});break}}const H=d===0?c.uid:`${c.uid}:${d}`;s.set(H,{uid:H,seatCol:p,seatRow:y,facingDir:v,assigned:!1,kind:x,hasPc:T,deskUid:w}),d++}}return s}const p0={h:35,s:30,b:15,c:0},g0={h:25,s:45,b:5,c:10};function LT(){const a=qe.WALL,s=qe.FLOOR_1,o=qe.FLOOR_2,i=[],c=[];for(let f=0;f<Lc;f++)for(let d=0;d<Mc;d++)f===0||f===Lc-1||d===0||d===Mc-1?(i.push(a),c.push(null)):d<10?(i.push(s),c.push(p0)):(i.push(o),c.push(g0));return{version:1,cols:Mc,rows:Lc,tiles:i,tileColors:c,furniture:[],layoutRevision:2}}const zT={desk:"DESK_FRONT",chair:"WOODEN_CHAIR_FRONT",bookshelf:"BOOKSHELF",plant:"PLANT",cooler:null,whiteboard:"WHITEBOARD",pc:"PC_FRONT_OFF",lamp:null};function UT(a){const s=[];for(const o of a){const i=zT[o.type];i===void 0?s.push(o):i!==null&&s.push({...o,type:i})}return s}function ug(a){return BT(a)}function BT(a){a={...a,furniture:UT(a.furniture)};const s=8;if(!a.layoutRevision&&!a.tileColors&&a.tiles.includes(s)&&(a={...a,tiles:a.tiles.map(i=>i===s?qe.VOID:i)}),a.tileColors&&a.tileColors.length===a.tiles.length)return a;const o=[];for(const i of a.tiles)switch(i){case 0:o.push(null);break;case 1:o.push(p0);break;case 2:o.push(g0);break;case 3:o.push({h:280,s:40,b:-5,c:0});break;case 4:o.push({h:35,s:25,b:10,c:0});break;default:o.push(i>0&&i!==qe.VOID?{h:0,s:0,b:0,c:0}:null)}return{...a,tileColors:o}}function di(a,s,o,i,c){if(s<0||s>=a.cols||o<0||o>=a.rows)return a;const f=o*a.cols+s,d=a.tileColors||new Array(a.tiles.length).fill(null),m=c??(i===qe.WALL||i===qe.VOID?null:{...N1});if(a.tiles[f]===i){const y=d[f];if(m===null&&y===null||m&&y&&m.h===y.h&&m.s===y.s&&m.b===y.b&&m.c===y.c&&!!m.colorize==!!y.colorize)return a}const b=[...a.tiles];b[f]=i;const p=[...d];return p[f]=m,{...a,tiles:b,tileColors:p}}function HT(a,s){return ra(a,s.type,s.col,s.row)?{...a,furniture:[...a.furniture,s]}:a}function IT(a,s){const o=a.furniture.filter(i=>i.uid!==s);return o.length===a.furniture.length?a:{...a,furniture:o}}function FT(a,s,o,i){const c=a.furniture.find(f=>f.uid===s);return!c||!ra(a,c.type,o,i,s)?a:{...a,furniture:a.furniture.map(f=>f.uid===s?{...f,col:o,row:i}:f)}}function GT(a,s,o){const i=a.furniture.find(f=>f.uid===s);if(!i)return a;const c=h0(i.type);return!c||!ra(a,c,i.col,i.row,s)?a:{...a,furniture:a.furniture.map(f=>f.uid===s?{...f,type:c}:f)}}function YT(a,s){const o=a.furniture.find(c=>c.uid===s);if(!o)return a;const i=m0(o.type);return i?{...a,furniture:a.furniture.map(c=>c.uid===s?{...c,type:i}:c)}:a}function y0(a,s){const o=rt(a);return o!=null&&o.canPlaceOnWalls?s-(o.footprintH-1):s}function ra(a,s,o,i,c){const f=rt(s);if(!f)return!1;if(f.canPlaceOnWalls){const v=i+f.footprintH-1;if(o<0||o+f.footprintW>a.cols||v<0||v>=a.rows)return!1}else if(o<0||i<0||o+f.footprintW>a.cols||i+f.footprintH>a.rows)return!1;const d=f.backgroundTiles||0;for(let v=0;v<f.footprintH;v++)if(!(v<d)&&!(i+v<0)&&!(f.canPlaceOnWalls&&v<f.footprintH-1))for(let x=0;x<f.footprintW;x++){const T=(i+v)*a.cols+(o+x),w=a.tiles[T];if(f.canPlaceOnWalls){if(w!==qe.WALL)return!1}else if(w===qe.VOID||w===qe.WALL)return!1}const m=DT(a.furniture,c);let b=null;if(f.canPlaceOnSurfaces){b=new Set;for(const v of a.furniture){if(v.uid===c)continue;const x=rt(v.type);if(!(!x||!x.isDesk))for(let T=0;T<x.footprintH;T++)for(let w=0;w<x.footprintW;w++)b.add(`${v.col+w},${v.row+T}`)}}let p=null;if(f.canPlaceOnSurfaces){p=new Set;for(const v of a.furniture){if(v.uid===c)continue;const x=rt(v.type);if(!x||!x.canPlaceOnSurfaces)continue;const T=x.backgroundTiles||0;for(let w=0;w<x.footprintH;w++)if(!(w<T))for(let A=0;A<x.footprintW;A++)p.add(`${v.col+A},${v.row+w}`)}}const y=f.backgroundTiles||0;for(let v=0;v<f.footprintH;v++)if(!(v<y)&&!(i+v<0))for(let x=0;x<f.footprintW;x++){const T=`${o+x},${i+v}`;if(m.has(T)&&!(b!=null&&b.has(T))||p!=null&&p.has(T))return!1}return!0}function qT(a,s){const{cols:o,rows:i,tiles:c,furniture:f,tileColors:d}=a,m=d||new Array(c.length).fill(null);let b=o,p=i,y=0,v=0;if(s==="right"?b=o+1:s==="left"?(b=o+1,y=1):s==="down"?p=i+1:s==="up"&&(p=i+1,v=1),b>Qv||p>Wv)return null;const x=new Array(b*p).fill(qe.VOID),T=new Array(b*p).fill(null);for(let A=0;A<i;A++)for(let L=0;L<o;L++){const H=A*o+L,Z=(A+v)*b+(L+y);x[Z]=c[H],T[Z]=m[H]}const w=f.map(A=>({...A,col:A.col+y,row:A.row+v}));return{layout:{...a,cols:b,rows:p,tiles:x,tileColors:T,furniture:w},shift:{col:y,row:v}}}function XT(a,s){const o=a.getContext("2d");o.imageSmoothingEnabled=!1;let i=0,c=0,f=!0;const d=m=>{if(!f)return;const b=i===0?0:Math.min((m-i)/1e3,z1);i=m,s.update(b),o.imageSmoothingEnabled=!1,s.render(o),c=requestAnimationFrame(d)};return c=requestAnimationFrame(d),{stop(){f=!1,cancelAnimationFrame(c)},pause(){f=!1,cancelAnimationFrame(c)},resume(){f||(f=!0,i=0,c=requestAnimationFrame(d))}}}const $T=Array.from({length:xe},()=>Array(xe).fill(s0));let Ja=[];const ZT="#3A3A5C";function VT(a){Ja=a,Zg()}function QT(a){const s=a-1;return s<0?null:s<Ja.length?Ja[s]:Ja.length===0&&a>=1?$T:null}function WT(){return Ja.length>0?Ja.length:1}function b0(a,s){const o=`floor-${a}-${s.h}-${s.s}-${s.b}-${s.c}`,i=QT(a);return i?io(o,i,{...s,colorize:!0}):Array.from({length:16},()=>Array(16).fill("#FF00FF"))}const ef=new Map;function KT(){ef.clear()}const cg=new WeakMap;function JT(a){const s=cg.get(a);if(s)return s;const o=a.length,i=a[0].length,c=[];for(let f=0;f<o+2;f++)c.push(new Array(i+2).fill(""));for(let f=0;f<o;f++)for(let d=0;d<i;d++){if(a[f][d]==="")continue;const m=f+1,b=d+1;c[m-1][b]===""&&(c[m-1][b]="#FFFFFF"),c[m+1][b]===""&&(c[m+1][b]="#FFFFFF"),c[m][b-1]===""&&(c[m][b-1]="#FFFFFF"),c[m][b+1]===""&&(c[m][b+1]="#FFFFFF")}for(let f=0;f<o;f++)for(let d=0;d<i;d++)a[f][d]!==""&&(c[f+1][d+1]="");return cg.set(a,c),c}function ml(a,s){let o=ef.get(s);o||(o=new WeakMap,ef.set(s,o));const i=o.get(a);if(i)return i;const c=a.length,f=a[0].length,d=document.createElement("canvas");d.width=f*s,d.height=c*s;const m=d.getContext("2d");m.imageSmoothingEnabled=!1;for(let b=0;b<c;b++)for(let p=0;p<f;p++){const y=a[b][p];y!==""&&(m.fillStyle=y,m.fillRect(p*s,b*s,s,s))}return o.set(a,d),d}let On=[];function PT(a){On=a}function e2(){return On.length>0}function fg(){return On.length}function t2(a){const s=On[a];return s?s[0]??null:null}function x0(a,s,o){const i=o.length,c=i>0?o[0].length:0;let f=0;return s>0&&o[s-1][a]===qe.WALL&&(f|=1),a<c-1&&o[s][a+1]===qe.WALL&&(f|=2),s<i-1&&o[s+1][a]===qe.WALL&&(f|=4),a>0&&o[s][a-1]===qe.WALL&&(f|=8),f}function n2(a,s,o,i=0){if(On.length===0)return null;const c=On[i]??On[0],f=x0(a,s,o),d=c[f];return d?{sprite:d,offsetY:xe-d.length}:null}function l2(a,s,o,i,c=0){if(On.length===0)return null;const f=On[c]??On[0],d=x0(a,s,o),m=f[d];if(!m)return null;const b=`wall-${c}-${d}-${i.h}-${i.s}-${i.b}-${i.c}`;return{sprite:io(b,m,{...i,colorize:!0}),offsetY:xe-m.length}}function a2(a,s,o){if(On.length===0)return[];const i=a.length,c=i>0?a[0].length:0,f=o??c,d=[];for(let m=0;m<i;m++)for(let b=0;b<c;b++){if(a[m][b]!==qe.WALL)continue;const p=m*f+b,y=s==null?void 0:s[p],v=y?l2(b,m,a,y):n2(b,m,a);v&&d.push({sprite:v.sprite,x:b*xe,y:m*xe+v.offsetY,zY:(m+1)*xe})}return d}function s2(a){const{h:s,s:o,b:i,c}=a;let f=.5;if(c!==0){const A=(100+c)/100;f=.5+(f-.5)*A}i!==0&&(f=f+i/200),f=Math.max(0,Math.min(1,f));const d=o/100,m=(1-Math.abs(2*f-1))*d,b=s/60,p=m*(1-Math.abs(b%2-1));let y=0,v=0,x=0;b<1?(y=m,v=p,x=0):b<2?(y=p,v=m,x=0):b<3?(y=0,v=m,x=p):b<4?(y=0,v=p,x=m):b<5?(y=p,v=0,x=m):(y=m,v=0,x=p);const T=f-m/2,w=A=>Math.max(0,Math.min(255,Math.round((A+T)*255)));return`#${w(y).toString(16).padStart(2,"0")}${w(v).toString(16).padStart(2,"0")}${w(x).toString(16).padStart(2,"0")}`}function yi(a,s,o,i){const c=o.length,f=c>0?o[0].length:0;if(s<0||s>=c||a<0||a>=f)return!1;const d=o[s][a];return!(d===qe.WALL||d===qe.VOID||i.has(`${a},${s}`))}function dg(a,s){const o=a.length,i=o>0?a[0].length:0,c=[];for(let f=0;f<o;f++)for(let d=0;d<i;d++)yi(d,f,a,s)&&c.push({col:d,row:f});return c}function Nt(a,s,o,i,c,f){if(a===o&&s===i)return[];const d=(w,A)=>`${w},${A}`,m=d(a,s),b=d(o,i);if(!yi(o,i,c,f))return[];const y=new Set;y.add(m);const v=new Map,x=[{col:a,row:s}],T=[{dc:0,dr:-1},{dc:0,dr:1},{dc:-1,dr:0},{dc:1,dr:0}];for(;x.length>0;){const w=x.shift(),A=d(w.col,w.row);if(A===b){const L=[];let H=b;for(;H!==m;){const[Z,O]=H.split(",").map(Number);L.unshift({col:Z,row:O}),H=v.get(H)}return L}for(const L of T){const H=w.col+L.dc,Z=w.row+L.dr,O=d(H,Z);y.has(O)||yi(H,Z,c,f)&&(y.add(O),v.set(O,A),x.push({col:H,row:Z}))}}return[]}const i2=new Set(["Read","Grep","Glob","WebFetch","WebSearch"]);function r2(a){return a?i2.has(a):!1}function Jr(a,s){return{x:a*xe+xe/2,y:s*xe+xe/2}}function hg(a,s,o,i){const c=o-a,f=i-s;return c>0?oe.RIGHT:c<0?oe.LEFT:f>0?oe.DOWN:oe.UP}function Yr(a,s,o,i,c=0){const f=i?i.seatCol:1,d=i?i.seatRow:1,m=Jr(f,d);return{id:a,state:Te.TYPE,dir:i?i.facingDir:oe.DOWN,x:m.x,y:m.y,tileCol:f,tileRow:d,path:[],moveProgress:0,currentTool:null,palette:s,hueShift:c,frame:0,frameTimer:0,wanderTimer:0,wanderCount:0,wanderLimit:Wa(Va,Qa),isActive:!0,seatId:o,homeSeatId:o,workDeskId:null,chatPartner:null,chatTimer:0,interactTimer:0,interactTarget:null,sitTimer:0,idleActionCount:0,idleActionLimit:Wa(Va,Qa),bubbleType:null,bubbleTimer:0,seatTimer:0,isSubagent:!1,parentAgentId:null,matrixEffect:null,matrixEffectTimer:0,matrixEffectSeeds:[]}}function o2(a,s,o,i,c,f,d){switch(a.frameTimer+=s,a.state){case Te.TYPE:{if(a.frameTimer>=zp&&(a.frameTimer-=zp,a.frame=(a.frame+1)%2),!a.isActive){if(a.seatTimer>0){a.seatTimer-=s;break}a.seatTimer=0,a.workDeskId&&d&&(d.scheduler.releaseDeskClaim(a.workDeskId),a.workDeskId=null),a.state=Te.IDLE,a.frame=0,a.frameTimer=0,a.wanderTimer=Il(ui,ci),a.idleActionCount=0,a.idleActionLimit=Wa(Va,Qa)}break}case Te.SIT:{a.frame=0,a.sitTimer-=s,a.sitTimer<=0&&(a.idleActionCount++,a.state=Te.IDLE,a.frame=0,a.frameTimer=0,a.wanderTimer=Il(ui,ci)),a.isActive&&d&&Ic(a,d,c,f,i);break}case Te.INTERACT:{a.frame=0,a.interactTimer-=s,a.interactTimer<=0&&(a.interactTarget&&d&&(d.scheduler.releaseFurniture(a.interactTarget),a.interactTarget=null),a.chatPartner!==null&&d&&(d.scheduler.chatPairs.delete(a.id),d.scheduler.chatPairs.delete(a.chatPartner),a.chatPartner=null),a.chatTimer=0,a.idleActionCount++,a.state=Te.IDLE,a.frame=0,a.frameTimer=0,a.wanderTimer=Il(ui,ci)),a.isActive&&d&&Ic(a,d,c,f,i);break}case Te.IDLE:{if(a.frame=0,a.seatTimer<0&&(a.seatTimer=0),a.isActive){if(d)Ic(a,d,c,f,i);else{if(!a.seatId){a.state=Te.TYPE,a.frame=0,a.frameTimer=0;break}const m=i.get(a.seatId);if(m){const b=Nt(a.tileCol,a.tileRow,m.seatCol,m.seatRow,c,f);b.length>0?(a.path=b,a.moveProgress=0,a.state=Te.WALK,a.frame=0,a.frameTimer=0):a.tileCol===m.seatCol&&a.tileRow===m.seatRow&&(a.state=Te.TYPE,a.dir=m.facingDir,a.frame=0,a.frameTimer=0)}}break}if(a.wanderTimer-=s,a.wanderTimer<=0){if(d){const m=d.scheduler.selectIdleAction(a,d.characters,d.seats,d.layout.furniture,d.tileMap,d.blockedTiles);switch(m.type){case"wander":$a(a,o,c,f);break;case"interact":{a.interactTarget=m.furnitureUid,a.interactTimer=m.duration,a.dir=m.facingDir,a.tileCol===m.tileCol&&a.tileRow===m.tileRow?(a.state=Te.INTERACT,a.frame=0,a.frameTimer=0):(a.path=Nt(a.tileCol,a.tileRow,m.tileCol,m.tileRow,c,f),a.path.length>0?(a.moveProgress=0,a.state=Te.WALK,a.frame=0,a.frameTimer=0):(d.scheduler.releaseFurniture(m.furnitureUid),a.interactTarget=null,$a(a,o,c,f)));break}case"chat":{a.chatPartner=m.partnerId,a.chatTimer=m.duration,a.dir=m.facingDir,a.tileCol===m.tileCol&&a.tileRow===m.tileRow?(a.interactTimer=m.duration,a.state=Te.INTERACT,a.frame=0,a.frameTimer=0):(a.path=Nt(a.tileCol,a.tileRow,m.tileCol,m.tileRow,c,f),a.path.length>0?(a.moveProgress=0,a.state=Te.WALK,a.frame=0,a.frameTimer=0):(d.scheduler.chatPairs.delete(a.id),a.chatPartner!==null&&d.scheduler.chatPairs.delete(a.chatPartner),a.chatPartner=null,a.chatTimer=0,$a(a,o,c,f)));break}case"lounge":{const b=d.seats.get(m.seatUid);b?(a.path=Nt(a.tileCol,a.tileRow,b.seatCol,b.seatRow,c,f),a.path.length>0?(a.sitTimer=Il(O1,D1),a.moveProgress=0,a.state=Te.WALK,a.frame=0,a.frameTimer=0):$a(a,o,c,f)):$a(a,o,c,f);break}case"rest":{a.idleActionCount=0,a.idleActionLimit=Wa(Va,Qa);const b=a.homeSeatId?i.get(a.homeSeatId):null;b&&(a.path=Nt(a.tileCol,a.tileRow,b.seatCol,b.seatRow,c,f),a.path.length>0&&(a.moveProgress=0,a.state=Te.WALK,a.frame=0,a.frameTimer=0));break}}}else $a(a,o,c,f);a.wanderTimer=Il(ui,ci)}break}case Te.WALK:{if(a.frameTimer>=Lp&&(a.frameTimer-=Lp,a.frame=(a.frame+1)%4),a.path.length===0){const v=Jr(a.tileCol,a.tileRow);if(a.x=v.x,a.y=v.y,a.interactTarget){a.state=Te.INTERACT,a.frame=0,a.frameTimer=0;break}if(a.chatPartner!==null&&a.chatTimer>0){const x=d==null?void 0:d.characters.get(a.chatPartner);x&&(a.dir=hg(a.tileCol,a.tileRow,x.tileCol,x.tileRow)),a.interactTimer=a.chatTimer,a.state=Te.INTERACT,a.frame=0,a.frameTimer=0;break}if(a.sitTimer>0){a.state=Te.SIT;const x=[...i.values()].find(T=>T.seatCol===a.tileCol&&T.seatRow===a.tileRow);x&&(a.dir=x.facingDir),a.frame=0,a.frameTimer=0;break}if(a.isActive)if(!a.seatId&&!a.workDeskId)a.state=Te.TYPE;else{const x=a.workDeskId??a.seatId,T=x?i.get(x):null;T&&a.tileCol===T.seatCol&&a.tileRow===T.seatRow?(a.state=Te.TYPE,a.dir=T.facingDir):a.state=Te.IDLE}else{if(a.homeSeatId){const x=i.get(a.homeSeatId);if(x&&a.tileCol===x.seatCol&&a.tileRow===x.seatRow){a.state=Te.SIT,a.dir=x.facingDir,a.seatTimer<0?(a.seatTimer=0,a.sitTimer=.1):a.sitTimer=Il(Up,Bp),a.idleActionCount=0,a.idleActionLimit=Wa(Va,Qa),a.frame=0,a.frameTimer=0;break}}if(a.seatId&&a.seatId!==a.homeSeatId){const x=i.get(a.seatId);if(x&&a.tileCol===x.seatCol&&a.tileRow===x.seatRow){a.state=Te.SIT,a.dir=x.facingDir,a.seatTimer<0?(a.seatTimer=0,a.sitTimer=.1):a.sitTimer=Il(Up,Bp),a.idleActionCount=0,a.idleActionLimit=Wa(Va,Qa),a.frame=0,a.frameTimer=0;break}}a.state=Te.IDLE,a.wanderTimer=Il(ui,ci)}a.frame=0,a.frameTimer=0;break}const m=a.path[0];a.dir=hg(a.tileCol,a.tileRow,m.col,m.row),a.moveProgress+=Kv/xe*s;const b=Jr(a.tileCol,a.tileRow),p=Jr(m.col,m.row),y=Math.min(a.moveProgress,1);if(a.x=b.x+(p.x-b.x)*y,a.y=b.y+(p.y-b.y)*y,a.moveProgress>=1&&(a.tileCol=m.col,a.tileRow=m.row,a.x=p.x,a.y=p.y,a.path.shift(),a.moveProgress=0),a.isActive){const v=a.workDeskId??a.seatId;if(v){const x=i.get(v);if(x){const T=a.path[a.path.length-1];if(!T||T.col!==x.seatCol||T.row!==x.seatRow){const w=Nt(a.tileCol,a.tileRow,x.seatCol,x.seatRow,c,f);w.length>0&&(a.path=w,a.moveProgress=0)}}}}break}}}function Ic(a,s,o,i,c){s.scheduler.releaseAll(a.id,s.characters),a.interactTarget=null,a.chatPartner=null,a.interactTimer=0,a.sitTimer=0,a.chatTimer=0;const f=s.claimDeskForAgent(a.id);if(f){a.workDeskId=f.uid;const m=Nt(a.tileCol,a.tileRow,f.seatCol,f.seatRow,o,i);if(m.length>0){a.path=m,a.moveProgress=0,a.state=Te.WALK,a.frame=0,a.frameTimer=0;return}if(a.tileCol===f.seatCol&&a.tileRow===f.seatRow){a.state=Te.TYPE,a.dir=f.facingDir,a.frame=0,a.frameTimer=0;return}}const d=a.homeSeatId?c.get(a.homeSeatId):null;if(d){a.seatId=a.homeSeatId;const m=Nt(a.tileCol,a.tileRow,d.seatCol,d.seatRow,o,i);if(m.length>0){a.path=m,a.moveProgress=0,a.state=Te.WALK,a.frame=0,a.frameTimer=0;return}if(a.tileCol===d.seatCol&&a.tileRow===d.seatRow){a.state=Te.TYPE,a.dir=d.facingDir,a.frame=0,a.frameTimer=0;return}}a.state=Te.TYPE,a.frame=0,a.frameTimer=0}function $a(a,s,o,i){if(s.length===0)return;const c=s[Math.floor(Math.random()*s.length)],f=Nt(a.tileCol,a.tileRow,c.col,c.row,o,i);f.length>0&&(a.path=f,a.moveProgress=0,a.state=Te.WALK,a.frame=0,a.frameTimer=0,a.idleActionCount++)}function u2(a,s){switch(a.state){case Te.TYPE:return r2(a.currentTool)?s.reading[a.dir][a.frame%2]:s.typing[a.dir][a.frame%2];case Te.WALK:return s.walk[a.dir][a.frame%4];case Te.SIT:return s.walk[a.dir][1];case Te.INTERACT:return s.walk[a.dir][1];case Te.IDLE:default:return s.walk[a.dir][1]}}function Il(a,s){return a+Math.random()*(s-a)}function Wa(a,s){return a+Math.floor(Math.random()*(s-a+1))}function Fc(a,s,o){const i=Math.floor(o*Jv);return(a*7+s*13+i*31&255)<Pv}function hi(){const a=[];for(let s=0;s<Pg;s++)a.push(Math.random());return a}function c2(a,s,o,i,c,f){var y;const d=s.matrixEffectTimer/Jg,m=s.matrixEffect==="spawn",b=s.matrixEffectTimer,p=Hp+fi;for(let v=0;v<Pg;v++){const x=(s.matrixEffectSeeds[v]??0)*Ip,w=Math.max(0,Math.min(1,(d-x)/(1-Ip)))*p;for(let A=0;A<Hp;A++){const L=(y=o[A])==null?void 0:y[v],H=L&&L!=="",Z=w-A,O=i+v*f,C=c+A*f;if(m){if(Z<0)continue;if(Z<1)a.fillStyle=Fp,a.fillRect(O,C,f,f);else if(Z<fi){const D=Z/fi;if(H){a.fillStyle=L,a.fillRect(O,C,f,f);const j=(1-D)*e1;Fc(v,A,b)&&(a.fillStyle=`rgba(0, 255, 65, ${j})`,a.fillRect(O,C,f,f))}else if(Fc(v,A,b)){const j=(1-D)*Gp;a.fillStyle=D<Yp?`rgba(0, 255, 65, ${j})`:D<qp?`rgba(0, 170, 40, ${j})`:`rgba(0, 85, 20, ${j})`,a.fillRect(O,C,f,f)}}else H&&(a.fillStyle=L,a.fillRect(O,C,f,f))}else if(Z<0)H&&(a.fillStyle=L,a.fillRect(O,C,f,f));else if(Z<1)a.fillStyle=Fp,a.fillRect(O,C,f,f);else if(Z<fi&&Fc(v,A,b)){const D=Z/fi,j=(1-D)*Gp;a.fillStyle=D<Yp?`rgba(0, 255, 65, ${j})`:D<qp?`rgba(0, 170, 40, ${j})`:`rgba(0, 85, 20, ${j})`,a.fillRect(O,C,f,f)}}}}function f2(a,s,o,i,c,f,d){const m=xe*c,b=s.length,p=b>0?s[0].length:0,y=d??p;for(let v=0;v<b;v++)for(let x=0;x<p;x++){const T=s[v][x];if(T===qe.VOID)continue;if(T===qe.WALL){if(T===qe.WALL){const Z=v*y+x,O=f==null?void 0:f[Z];a.fillStyle=O?s2(O):ZT}else a.fillStyle=s0;a.fillRect(o+x*m,i+v*m,m,m);continue}const w=v*y+x,A=(f==null?void 0:f[w])??{h:0,s:0,b:0,c:0},L=b0(T,A),H=ml(L,c);a.drawImage(H,o+x*m,i+v*m)}}function d2(a,s,o,i,c,f,d,m){const b=[];for(const p of s){const y=ml(p.sprite,f),v=i+p.x*f,x=c+p.y*f;p.mirrored?b.push({zY:p.zY,draw:T=>{T.save(),T.translate(v+y.width,x),T.scale(-1,1),T.drawImage(y,0,0),T.restore()}}):b.push({zY:p.zY,draw:T=>{T.drawImage(y,v,x)}})}for(const p of o){const y=u0(p.palette,p.hueShift),v=u2(p,y),x=ml(v,f),T=p.state===Te.TYPE||p.state===Te.SIT?yf:0,w=Math.round(i+p.x*f-x.width/2),A=Math.round(c+(p.y+T)*f-x.height),L=p.y+xe/2+t1;if(p.matrixEffect){const O=w,C=A,D=v,j=p;b.push({zY:L,draw:Q=>{c2(Q,j,D,O,C,f)}});continue}const H=d!==null&&p.id===d,Z=m!==null&&p.id===m;if(H||Z){const O=H?l1:a1,C=JT(v),D=ml(C,f),j=w-f,Q=A-f;b.push({zY:L-n1,draw:fe=>{fe.save(),fe.globalAlpha=O,fe.drawImage(D,j,Q),fe.restore()}})}b.push({zY:L,draw:O=>{O.drawImage(x,w,A)}})}b.sort((p,y)=>p.zY-y.zY);for(const p of b)p.draw(a)}function h2(a,s,o,i,c,f,d,m){if(i===null||!c)return;const b=o.get(i);if(b)for(const[p,y]of s){if(y.seatCol!==c.col||y.seatRow!==c.row)continue;const v=xe*m,x=f+y.seatCol*v,T=d+y.seatRow*v;b.seatId===p?a.fillStyle=c1:y.assigned?a.fillStyle=d1:a.fillStyle=f1,a.fillRect(x,T,v,v);break}}function m2(a,s,o,i,c,f,d){var b;const m=xe*i;a.strokeStyle=h1,a.lineWidth=1,a.beginPath();for(let p=0;p<=c;p++){const y=s+p*m+.5;a.moveTo(y,o),a.lineTo(y,o+f*m)}for(let p=0;p<=f;p++){const y=o+p*m+.5;a.moveTo(s,y),a.lineTo(s+c*m,y)}if(a.stroke(),d){a.save(),a.strokeStyle=m1,a.lineWidth=1,a.setLineDash(i0);for(let p=0;p<f;p++)for(let y=0;y<c;y++)((b=d[p])==null?void 0:b[y])===qe.VOID&&a.strokeRect(s+y*m+.5,o+p*m+.5,m-1,m-1);a.restore()}}function p2(a,s,o,i,c,f,d,m){const b=xe*i;a.save();const p=[];for(let y=-1;y<=c;y++)p.push({c:y,r:-1}),p.push({c:y,r:f});for(let y=0;y<f;y++)p.push({c:-1,r:y}),p.push({c,r:y});for(const{c:y,r:v}of p){const x=s+y*b,T=o+v*b,w=y===d&&v===m;w&&(a.fillStyle=p1,a.fillRect(x,T,b,b)),a.strokeStyle=w?g1:y1,a.lineWidth=1,a.setLineDash(i0),a.strokeRect(x+.5,T+.5,b-1,b-1)}a.restore()}function g2(a,s,o,i,c,f,d,m,b=!1){const p=ml(s,m),y=f+o*xe*m,v=d+i*xe*m;a.save(),a.globalAlpha=s1,b?(a.translate(y+p.width,v),a.scale(-1,1),a.drawImage(p,0,0)):a.drawImage(p,y,v),a.restore(),a.save(),a.globalAlpha=i1,a.fillStyle=c?b1:x1,a.fillRect(y,v,p.width,p.height),a.restore()}function y2(a,s,o,i,c,f,d,m){const b=xe*m,p=f+s*b,y=d+o*b;a.save(),a.strokeStyle=v1,a.lineWidth=2,a.setLineDash(r1),a.strokeRect(p+1,y+1,i*b-2,c*b-2),a.restore()}function b2(a,s,o,i,c,f,d,m){const b=xe*m,p=f+(s+i)*b+1,y=d+o*b-1,v=Math.max(e0,m*t0);a.save(),a.beginPath(),a.arc(p,y,v,0,Math.PI*2),a.fillStyle=T1,a.fill(),a.strokeStyle="#fff",a.lineWidth=Math.max(l0,m*a0),a.lineCap="round";const x=v*n0;return a.beginPath(),a.moveTo(p-x,y-x),a.lineTo(p+x,y+x),a.moveTo(p+x,y-x),a.lineTo(p-x,y+x),a.stroke(),a.restore(),{cx:p,cy:y,radius:v}}function x2(a,s,o,i,c,f,d,m){const b=xe*m,p=Math.max(e0,m*t0),y=f+s*b-1,v=d+o*b-1;a.save(),a.beginPath(),a.arc(y,v,p,0,Math.PI*2),a.fillStyle=S1,a.fill(),a.strokeStyle="#fff",a.lineWidth=Math.max(l0,m*a0),a.lineCap="round";const x=p*n0;a.beginPath(),a.arc(y,v,x,-Math.PI*.8,Math.PI*.7),a.stroke();const T=Math.PI*.7,w=y+x*Math.cos(T),A=v+x*Math.sin(T),L=p*.35;return a.beginPath(),a.moveTo(w+L*.6,A-L*.3),a.lineTo(w,A),a.lineTo(w+L*.7,A+L*.5),a.stroke(),a.restore(),{cx:y,cy:v,radius:p}}function v2(a,s,o,i,c){for(const f of s){if(!f.bubbleType)continue;const d=f.bubbleType==="permission"?J1:P1;let m=1;f.bubbleType==="waiting"&&f.bubbleTimer<Xp&&(m=f.bubbleTimer/Xp);const b=ml(d,c),p=f.state===Te.TYPE||f.state===Te.SIT?o1:0,y=Math.round(o+f.x*c-b.width/2),v=Math.round(i+(f.y+p-u1)*c-b.height-1*c);a.save(),m<1&&(a.globalAlpha=m),a.drawImage(b,y,v),a.restore()}}function T2(a,s,o,i,c,f,d,m,b,p,y,v,x,T){a.clearRect(0,0,s,o);const w=x??(i.length>0?i[0].length:0),A=T??i.length,L=w*xe*d,H=A*xe*d,Z=Math.floor((s-L)/2)+Math.round(m),O=Math.floor((o-H)/2)+Math.round(b);f2(a,i,Z,O,d,v,x),p&&h2(a,p.seats,p.characters,p.selectedAgentId,p.hoveredTile,Z,O,d);const C=e2()?a2(i,v,x):[],D=C.length>0?[...C,...c]:c,j=(p==null?void 0:p.selectedAgentId)??null,Q=(p==null?void 0:p.hoveredAgentId)??null;return d2(a,D,f,Z,O,d,j,Q),v2(a,f,Z,O,d),y&&(y.showGrid&&m2(a,Z,O,d,w,A,i),y.showGhostBorder&&p2(a,Z,O,d,w,A,y.ghostBorderHoverCol,y.ghostBorderHoverRow),y.ghostSprite&&y.ghostCol>=0&&g2(a,y.ghostSprite,y.ghostCol,y.ghostRow,y.ghostValid,Z,O,d,y.ghostMirrored),y.hasSelection?(y2(a,y.selectedCol,y.selectedRow,y.selectedW,y.selectedH,Z,O,d),y.deleteButtonBounds=b2(a,y.selectedCol,y.selectedRow,y.selectedW,y.selectedH,Z,O,d),y.isRotatable?y.rotateButtonBounds=x2(a,y.selectedCol,y.selectedRow,y.selectedW,y.selectedH,Z,O,d):y.rotateButtonBounds=null):(y.deleteButtonBounds=null,y.rotateButtonBounds=null)),{offsetX:Z,offsetY:O}}function S2({officeState:a,onClick:s,isEditMode:o,editorState:i,onEditorTileAction:c,onEditorEraseAction:f,onEditorSelectionChange:d,onDeleteSelected:m,onRotateSelected:b,onDragMove:p,editorTick:y,zoom:v,onZoomChange:x,panRef:T,onSaveAgentSeats:w,isActive:A}){const L=E.useRef(null),H=E.useRef(null),Z=E.useRef({x:0,y:0}),O=E.useRef(!1),C=E.useRef({mouseX:0,mouseY:0,panX:0,panY:0}),D=E.useRef(null),j=E.useRef(null),Q=E.useRef(!1),fe=E.useRef(0),we=E.useRef(null),ie=E.useCallback((Y,P)=>{const M=L.current;if(!M)return{x:Y,y:P};const I=a.getLayout(),ne=I.cols*xe*v,K=I.rows*xe*v,ee=M.width*Vp,ve=M.height*Vp,_e=ne/2+M.width/2-ee,Pe=K/2+M.height/2-ve;return{x:Math.max(-_e,Math.min(_e,Y)),y:Math.max(-Pe,Math.min(Pe,P))}},[a,v]),ue=E.useCallback(()=>{const Y=L.current,P=H.current;if(!Y||!P)return;const M=P.getBoundingClientRect(),I=window.devicePixelRatio||1;Y.width=Math.round(M.width*I),Y.height=Math.round(M.height*I),Y.style.width=`${M.width}px`,Y.style.height=`${M.height}px`},[]);E.useEffect(()=>{const Y=L.current;if(!Y)return;ue();const P=new ResizeObserver(()=>ue());H.current&&P.observe(H.current);const M=XT(Y,{update:I=>{a.update(I)},render:I=>{const ne=Y.width,K=Y.height;let ee;if(o){const Ne=i.activeTool===Se.TILE_PAINT||i.activeTool===Se.WALL_PAINT||i.activeTool===Se.ERASE;if(ee={showGrid:!0,ghostSprite:null,ghostMirrored:!1,ghostCol:i.ghostCol,ghostRow:i.ghostRow,ghostValid:i.ghostValid,selectedCol:0,selectedRow:0,selectedW:0,selectedH:0,hasSelection:!1,isRotatable:!1,deleteButtonBounds:null,rotateButtonBounds:null,showGhostBorder:Ne,ghostBorderHoverCol:Ne?i.ghostCol:-999,ghostBorderHoverRow:Ne?i.ghostRow:-999},i.activeTool===Se.FURNITURE_PLACE&&i.ghostCol>=0){const Me=rt(i.selectedFurnitureType);if(Me){const lt=y0(i.selectedFurnitureType,i.ghostRow);ee.ghostSprite=Me.sprite,ee.ghostRow=lt,ee.ghostMirrored=!!Me.mirrorSide&&i.selectedFurnitureType.endsWith(":left"),ee.ghostValid=ra(a.getLayout(),i.selectedFurnitureType,i.ghostCol,lt)}}if(i.isDragMoving&&i.dragUid&&i.ghostCol>=0){const Me=a.getLayout().furniture.find(lt=>lt.uid===i.dragUid);if(Me){const lt=rt(Me.type);if(lt){const Le=i.ghostCol-i.dragOffsetCol,Ce=i.ghostRow-i.dragOffsetRow;ee.ghostSprite=lt.sprite,ee.ghostCol=Le,ee.ghostRow=Ce,ee.ghostMirrored=!!lt.mirrorSide&&Me.type.endsWith(":left"),ee.ghostValid=ra(a.getLayout(),Me.type,Le,Ce,i.dragUid)}}}if(i.selectedFurnitureUid&&!i.isDragMoving){const Me=a.getLayout().furniture.find(lt=>lt.uid===i.selectedFurnitureUid);if(Me){const lt=rt(Me.type);lt&&(ee.hasSelection=!0,ee.selectedCol=Me.col,ee.selectedRow=Me.row,ee.selectedW=lt.footprintW,ee.selectedH=lt.footprintH,ee.isRotatable=Pc(Me.type))}}}if(a.cameraFollowId!==null){const Ne=a.characters.get(a.cameraFollowId);if(Ne){const Me=a.getLayout(),lt=Me.cols*xe*v,Le=Me.rows*xe*v,Ce=lt/2-Ne.x*v,je=Le/2-Ne.y*v,_t=Ce-T.current.x,cn=je-T.current.y;Math.abs(_t)<Zp&&Math.abs(cn)<Zp?T.current={x:Ce,y:je}:T.current={x:T.current.x+_t*$p,y:T.current.y+cn*$p}}}const ve={selectedAgentId:a.selectedAgentId,hoveredAgentId:a.hoveredAgentId,hoveredTile:a.hoveredTile,seats:a.seats,characters:a.characters},{offsetX:_e,offsetY:Pe}=T2(I,ne,K,a.tileMap,a.furniture,a.getCharacters(),v,T.current.x,T.current.y,ve,ee,a.getLayout().tileColors,a.getLayout().cols,a.getLayout().rows);Z.current={x:_e,y:Pe},D.current=(ee==null?void 0:ee.deleteButtonBounds)??null,j.current=(ee==null?void 0:ee.rotateButtonBounds)??null}});return we.current=M,()=>{M.stop(),we.current=null,P.disconnect()}},[a,ue,o,i,y,v,T]),E.useEffect(()=>{const Y=we.current;Y&&(A?Y.resume():Y.pause())},[A]);const ge=E.useCallback((Y,P)=>{const M=L.current;if(!M)return null;const I=M.getBoundingClientRect(),ne=window.devicePixelRatio||1,K=Y-I.left,ee=P-I.top,ve=K*ne,_e=ee*ne,Pe=(ve-Z.current.x)/v,Ne=(_e-Z.current.y)/v;return{worldX:Pe,worldY:Ne,screenX:K,screenY:ee,deviceX:ve,deviceY:_e}},[v]),Ee=E.useCallback((Y,P)=>{const M=ge(Y,P);if(!M)return null;const I=Math.floor(M.worldX/xe),ne=Math.floor(M.worldY/xe),K=a.getLayout();return o&&(i.activeTool===Se.TILE_PAINT||i.activeTool===Se.WALL_PAINT||i.activeTool===Se.ERASE)?I<-1||I>K.cols||ne<-1||ne>K.rows?null:{col:I,row:ne}:I<0||I>=K.cols||ne<0||ne>=K.rows?null:{col:I,row:ne}},[ge,a,o,i]),se=E.useCallback((Y,P)=>{const M=D.current;if(!M)return!1;const I=Y-M.cx,ne=P-M.cy;return I*I+ne*ne<=(M.radius+2)*(M.radius+2)},[]),me=E.useCallback((Y,P)=>{const M=j.current;if(!M)return!1;const I=Y-M.cx,ne=P-M.cy;return I*I+ne*ne<=(M.radius+2)*(M.radius+2)},[]),G=E.useCallback(Y=>{if(O.current){const K=window.devicePixelRatio||1,ee=(Y.clientX-C.current.mouseX)*K,ve=(Y.clientY-C.current.mouseY)*K;T.current=ie(C.current.panX+ee,C.current.panY+ve);return}if(o){const K=Ee(Y.clientX,Y.clientY);if(K){if(i.ghostCol=K.col,i.ghostRow=K.row,i.dragUid&&!i.isDragMoving&&(K.col!==i.dragStartCol||K.row!==i.dragStartRow)&&(i.isDragMoving=!0),i.isDragging&&(i.activeTool===Se.TILE_PAINT||i.activeTool===Se.WALL_PAINT||i.activeTool===Se.ERASE)&&!i.dragUid&&c(K.col,K.row),Q.current&&(i.activeTool===Se.TILE_PAINT||i.activeTool===Se.WALL_PAINT||i.activeTool===Se.ERASE)){const ve=a.getLayout();K.col>=0&&K.col<ve.cols&&K.row>=0&&K.row<ve.rows&&f(K.col,K.row)}}else i.ghostCol=-1,i.ghostRow=-1;const ee=L.current;if(ee)if(i.isDragMoving)ee.style.cursor="grabbing";else{const ve=ge(Y.clientX,Y.clientY);if(ve&&(se(ve.deviceX,ve.deviceY)||me(ve.deviceX,ve.deviceY)))ee.style.cursor="pointer";else if(i.activeTool===Se.FURNITURE_PICK&&K){const Pe=a.getLayout().furniture.find(Ne=>{const Me=rt(Ne.type);return Me?K.col>=Ne.col&&K.col<Ne.col+Me.footprintW&&K.row>=Ne.row&&K.row<Ne.row+Me.footprintH:!1});ee.style.cursor=Pe?"pointer":"crosshair"}else if((i.activeTool===Se.SELECT||i.activeTool===Se.FURNITURE_PLACE&&i.selectedFurnitureType==="")&&K){const Pe=a.getLayout().furniture.find(Ne=>{const Me=rt(Ne.type);return Me?K.col>=Ne.col&&K.col<Ne.col+Me.footprintW&&K.row>=Ne.row&&K.row<Ne.row+Me.footprintH:!1});ee.style.cursor=Pe?"grab":"crosshair"}else ee.style.cursor="crosshair"}return}const P=ge(Y.clientX,Y.clientY);if(!P)return;const M=a.getCharacterAt(P.worldX,P.worldY),I=Ee(Y.clientX,Y.clientY);a.hoveredTile=I;const ne=L.current;if(ne){let K="default";if(M!==null)K="pointer";else if(a.selectedAgentId!==null&&I){const ee=a.getSeatAtTile(I.col,I.row);if(ee){const ve=a.seats.get(ee);if(ve){const _e=a.characters.get(a.selectedAgentId);(!ve.assigned||_e&&_e.seatId===ee)&&(K="pointer")}}}ne.style.cursor=K}a.hoveredAgentId=M},[a,ge,Ee,o,i,c,f,T,se,me,ie]),le=E.useCallback(Y=>{if(RT(),Y.button===1){Y.preventDefault(),a.cameraFollowId=null,O.current=!0,C.current={mouseX:Y.clientX,mouseY:Y.clientY,panX:T.current.x,panY:T.current.y};const ne=L.current;ne&&(ne.style.cursor="grabbing");return}if(Y.button===2&&o){const ne=Ee(Y.clientX,Y.clientY);if(ne&&(i.activeTool===Se.TILE_PAINT||i.activeTool===Se.WALL_PAINT||i.activeTool===Se.ERASE)){const K=a.getLayout();ne.col>=0&&ne.col<K.cols&&ne.row>=0&&ne.row<K.rows&&(Q.current=!0,f(ne.col,ne.row))}return}if(!o)return;const P=ge(Y.clientX,Y.clientY);if(P&&me(P.deviceX,P.deviceY)){b();return}if(P&&se(P.deviceX,P.deviceY)){m();return}const M=Ee(Y.clientX,Y.clientY);if((i.activeTool===Se.SELECT||i.activeTool===Se.FURNITURE_PLACE&&i.selectedFurnitureType==="")&&M){const ne=a.getLayout();let K=null;for(const ee of ne.furniture){const ve=rt(ee.type);ve&&M.col>=ee.col&&M.col<ee.col+ve.footprintW&&M.row>=ee.row&&M.row<ee.row+ve.footprintH&&(!K||ve.canPlaceOnSurfaces)&&(K=ee)}if(K){i.startDrag(K.uid,M.col,M.row,M.col-K.col,M.row-K.row);return}else i.clearSelection(),d()}i.isDragging=!0,M&&c(M.col,M.row)},[a,o,i,Ee,ge,c,f,d,m,b,se,me,T]),he=E.useCallback(Y=>{if(Y.button===1){O.current=!1;const P=L.current;P&&(P.style.cursor=o?"crosshair":"default");return}if(Y.button===2){Q.current=!1;return}if(i.dragUid){if(i.isDragMoving){const M=i.ghostCol-i.dragOffsetCol,I=i.ghostRow-i.dragOffsetRow,ne=a.getLayout().furniture.find(K=>K.uid===i.dragUid);ne&&ra(a.getLayout(),ne.type,M,I,i.dragUid)&&p(i.dragUid,M,I),i.clearSelection()}else i.selectedFurnitureUid===i.dragUid?i.clearSelection():i.selectedFurnitureUid=i.dragUid;i.clearDrag(),d();const P=L.current;P&&(P.style.cursor="crosshair");return}i.isDragging=!1,i.wallDragAdding=null},[i,o,a,p,d]),re=E.useCallback(Y=>{if(o)return;const P=ge(Y.clientX,Y.clientY);if(!P)return;const M=a.getCharacterAt(P.worldX,P.worldY);if(M!==null){a.dismissBubble(M),a.selectedAgentId===M?(a.selectedAgentId=null,a.cameraFollowId=null):(a.selectedAgentId=M,a.cameraFollowId=M),s(M);return}if(a.selectedAgentId!==null){const I=a.characters.get(a.selectedAgentId);if(I&&!I.isSubagent){const ne=Ee(Y.clientX,Y.clientY);if(ne){const K=a.getSeatAtTile(ne.col,ne.row);if(K){const ee=a.seats.get(K);if(ee&&I){if(I.seatId===K){a.sendToSeat(a.selectedAgentId),a.selectedAgentId=null,a.cameraFollowId=null;return}else if(!ee.assigned){a.reassignSeat(a.selectedAgentId,K),a.selectedAgentId=null,a.cameraFollowId=null;const ve={};for(const _e of a.characters.values())_e.isSubagent||(ve[_e.id]={palette:_e.palette,seatId:_e.seatId});w==null||w(ve);return}}}}}a.selectedAgentId=null,a.cameraFollowId=null}},[a,s,ge,Ee,o,w]),W=E.useCallback(()=>{O.current=!1,Q.current=!1,i.isDragging=!1,i.wallDragAdding=null,i.clearDrag(),i.ghostCol=-1,i.ghostRow=-1,a.hoveredAgentId=null,a.hoveredTile=null},[a,i]),_=E.useCallback(Y=>{if(Y.preventDefault(),!o&&a.selectedAgentId!==null){const P=Ee(Y.clientX,Y.clientY);P&&a.walkToTile(a.selectedAgentId,P.col,P.row)}},[o,a,Ee]),q=E.useCallback(Y=>{if(Y.preventDefault(),Y.ctrlKey||Y.metaKey){if(fe.current+=Y.deltaY,Math.abs(fe.current)>=R1){const P=fe.current<0?1:-1;fe.current=0;const M=Math.max(ro,Math.min(bf,v+P));M!==v&&x(M)}}else{const P=window.devicePixelRatio||1;a.cameraFollowId=null,T.current=ie(T.current.x-Y.deltaX*P,T.current.y-Y.deltaY*P)}},[v,x,a,T,ie]),$=E.useCallback(Y=>{Y.button===1&&Y.preventDefault()},[]);return h.jsx("div",{ref:H,style:{width:"100%",height:"100%",position:"relative",overflow:"hidden",background:"#1E1E2E"},children:h.jsx("canvas",{ref:L,onMouseMove:G,onMouseDown:le,onMouseUp:he,onClick:re,onAuxClick:$,onMouseLeave:W,onWheel:q,onContextMenu:_,style:{display:"block"}})})}const qr={display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",fontSize:"24px",color:"rgba(255, 255, 255, 0.8)",background:"transparent",border:"none",borderRadius:0,cursor:"pointer",textAlign:"left"};function E2({isOpen:a,onClose:s,isDebugMode:o,onToggleDebugMode:i,onExportLayout:c,onImportLayout:f}){const[d,m]=E.useState(null),[b,p]=E.useState(ag),y=E.useRef(null);return E.useEffect(()=>{var x;if(!a)return;const v=T=>{T.key==="Escape"&&(T.stopPropagation(),s())};return window.addEventListener("keydown",v),(x=y.current)==null||x.focus(),()=>window.removeEventListener("keydown",v)},[a,s]),a?h.jsxs(h.Fragment,{children:[h.jsx("div",{onClick:s,style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",background:"rgba(0, 0, 0, 0.5)",zIndex:49}}),h.jsxs("div",{ref:y,role:"dialog","aria-modal":"true","aria-label":"Settings",tabIndex:-1,style:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:50,background:"var(--pixel-bg)",border:"2px solid var(--pixel-border)",borderRadius:0,padding:"4px",boxShadow:"var(--pixel-shadow)",minWidth:200,outline:"none"},children:[h.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"4px 10px",borderBottom:"1px solid var(--pixel-border)",marginBottom:"4px"},children:[h.jsx("span",{style:{fontSize:"24px",color:"rgba(255, 255, 255, 0.9)"},children:"Settings"}),h.jsx("button",{onClick:s,onMouseEnter:()=>m("close"),onMouseLeave:()=>m(null),style:{background:d==="close"?"rgba(255, 255, 255, 0.08)":"transparent",border:"none",borderRadius:0,color:"rgba(255, 255, 255, 0.6)",fontSize:"24px",cursor:"pointer",padding:"0 4px",lineHeight:1},children:"X"})]}),h.jsx("button",{onClick:()=>{c==null||c(),s()},onMouseEnter:()=>m("export"),onMouseLeave:()=>m(null),style:{...qr,background:d==="export"?"rgba(255, 255, 255, 0.08)":"transparent"},children:"Export Layout"}),h.jsx("button",{onClick:()=>{f==null||f(),s()},onMouseEnter:()=>m("import"),onMouseLeave:()=>m(null),style:{...qr,background:d==="import"?"rgba(255, 255, 255, 0.08)":"transparent"},children:"Import Layout"}),h.jsxs("button",{onClick:()=>{const v=!ag();_T(v),p(v),localStorage.setItem("mecha-office-sound",String(v))},onMouseEnter:()=>m("sound"),onMouseLeave:()=>m(null),style:{...qr,background:d==="sound"?"rgba(255, 255, 255, 0.08)":"transparent"},children:[h.jsx("span",{children:"Sound Notifications"}),h.jsx("span",{style:{width:14,height:14,border:"2px solid rgba(255, 255, 255, 0.5)",borderRadius:0,background:b?"rgba(90, 140, 255, 0.8)":"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center",fontSize:"12px",lineHeight:1,color:"#fff"},children:b?"X":""})]}),h.jsxs("button",{onClick:i,onMouseEnter:()=>m("debug"),onMouseLeave:()=>m(null),style:{...qr,background:d==="debug"?"rgba(255, 255, 255, 0.08)":"transparent"},children:[h.jsx("span",{children:"Debug View"}),o&&h.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:"rgba(90, 140, 255, 0.8)",flexShrink:0}})]})]})]}):null}function w2(a,s,o){const i=s[a];if(i&&i.length>0){const c=[...i].reverse().find(f=>!f.done);if(c)return c.permissionWait?"Needs approval":c.status;if(o){const f=i[i.length-1];if(f)return f.status}}return"Idle"}function A2({officeState:a,agents:s,agentTools:o,subagentCharacters:i,containerRef:c,zoom:f,panRef:d}){const[,m]=E.useState(0);E.useEffect(()=>{let D=0;const j=()=>{m(Q=>Q+1),D=requestAnimationFrame(j)};return D=requestAnimationFrame(j),()=>cancelAnimationFrame(D)},[]);const b=c.current;if(!b)return null;const p=b.getBoundingClientRect(),y=window.devicePixelRatio||1,v=Math.round(p.width*y),x=Math.round(p.height*y),T=a.getLayout(),w=T.cols*xe*f,A=T.rows*xe*f,L=Math.floor((v-w)/2)+Math.round(d.current.x),H=Math.floor((x-A)/2)+Math.round(d.current.y),Z=a.selectedAgentId,O=a.hoveredAgentId,C=[...s,...i.map(D=>D.id)];return h.jsx(h.Fragment,{children:C.map(D=>{const j=a.characters.get(D);if(!j)return null;const Q=Z===D,fe=O===D,we=j.isSubagent;if(!Q&&!fe)return null;const ie=j.state===Te.TYPE?yf:0,ue=(L+j.x*f)/y,ge=(H+(j.y+ie-q1)*f)/y,Ee=we&&j.bubbleType==="permission";let se;if(we)if(Ee)se="Needs approval";else{const W=i.find(_=>_.id===D);se=W?W.label:"Subtask"}else se=w2(D,o,j.isActive);const me=o[D],G=Ee||(me==null?void 0:me.some(W=>W.permissionWait&&!W.done)),le=me==null?void 0:me.some(W=>!W.done),he=j.isActive;let re=null;return G?re="var(--pixel-status-permission)":he&&le&&(re="var(--pixel-status-active)"),h.jsx("div",{style:{position:"absolute",left:ue,top:ge-24,transform:"translateX(-50%)",display:"flex",flexDirection:"column",alignItems:"center",pointerEvents:Q?"auto":"none",zIndex:Q?"var(--pixel-overlay-selected-z)":"var(--pixel-overlay-z)"},children:h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,background:"var(--pixel-bg)",border:Q?"2px solid var(--pixel-border-light)":"2px solid var(--pixel-border)",borderRadius:0,padding:Q?"3px 6px 3px 8px":"3px 8px",boxShadow:"var(--pixel-shadow)",whiteSpace:"nowrap",maxWidth:220},children:[re&&h.jsx("span",{className:he&&!G?"pixel-agents-pulse":void 0,style:{width:6,height:6,borderRadius:"50%",background:re,flexShrink:0}}),h.jsxs("div",{style:{overflow:"hidden"},children:[h.jsx("span",{style:{fontSize:we?"20px":"22px",fontStyle:we?"italic":void 0,color:"var(--pixel-text)",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:se}),j.folderName&&h.jsx("span",{style:{fontSize:"16px",color:"var(--pixel-text-dim)",overflow:"hidden",textOverflow:"ellipsis",display:"block"},children:j.folderName})]})]})},D)})})}const Xr={width:40,height:40,padding:0,background:"var(--pixel-bg)",color:"var(--pixel-text)",border:"2px solid var(--pixel-border)",borderRadius:0,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"var(--pixel-shadow)"};function _2({zoom:a,onZoomChange:s}){const[o,i]=E.useState(null),[c,f]=E.useState(!1),[d,m]=E.useState(!1),b=E.useRef(null),p=E.useRef(null),y=E.useRef(a),v=a<=ro,x=a>=bf;return E.useEffect(()=>{if(a!==y.current)return y.current=a,b.current&&clearTimeout(b.current),p.current&&clearTimeout(p.current),f(!0),m(!1),p.current=setTimeout(()=>{m(!0)},w1),b.current=setTimeout(()=>{f(!1),m(!1)},A1),()=>{b.current&&clearTimeout(b.current),p.current&&clearTimeout(p.current)}},[a]),h.jsxs(h.Fragment,{children:[c&&h.jsxs("div",{style:{position:"absolute",top:10,left:"50%",transform:"translateX(-50%)",zIndex:"var(--pixel-controls-z)",background:"var(--pixel-bg)",border:"2px solid var(--pixel-border)",borderRadius:0,padding:"4px 12px",boxShadow:"var(--pixel-shadow)",fontSize:"26px",color:"var(--pixel-text)",userSelect:"none",opacity:d?0:1,transition:`opacity ${_1}s ease-out`,pointerEvents:"none"},children:[a,"x"]}),h.jsxs("div",{style:{position:"absolute",top:8,left:8,zIndex:"var(--pixel-controls-z)",display:"flex",flexDirection:"column",gap:4},children:[h.jsx("button",{onClick:()=>s(a+1),disabled:x,onMouseEnter:()=>i("plus"),onMouseLeave:()=>i(null),style:{...Xr,background:o==="plus"&&!x?"var(--pixel-btn-hover-bg)":Xr.background,cursor:x?"default":"pointer",opacity:x?"var(--pixel-btn-disabled-opacity)":1},title:"Zoom in (Ctrl+Scroll)",children:h.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[h.jsx("line",{x1:"9",y1:"3",x2:"9",y2:"15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"}),h.jsx("line",{x1:"3",y1:"9",x2:"15",y2:"9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}),h.jsx("button",{onClick:()=>s(a-1),disabled:v,onMouseEnter:()=>i("minus"),onMouseLeave:()=>i(null),style:{...Xr,background:o==="minus"&&!v?"var(--pixel-btn-hover-bg)":Xr.background,cursor:v?"default":"pointer",opacity:v?"var(--pixel-btn-disabled-opacity)":1},title:"Zoom out (Ctrl+Scroll)",children:h.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:h.jsx("line",{x1:"3",y1:"9",x2:"15",y2:"9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})})]})]})}class R2{constructor(){ce(this,"isEditMode",!1);ce(this,"activeTool",Se.SELECT);ce(this,"selectedTileType",qe.FLOOR_1);ce(this,"selectedFurnitureType","");ce(this,"floorColor",{...C1});ce(this,"wallColor",{...k1});ce(this,"selectedWallSet",0);ce(this,"wallDragAdding",null);ce(this,"pickedFurnitureColor",null);ce(this,"ghostCol",-1);ce(this,"ghostRow",-1);ce(this,"ghostValid",!1);ce(this,"selectedFurnitureUid",null);ce(this,"isDragging",!1);ce(this,"undoStack",[]);ce(this,"redoStack",[]);ce(this,"isDirty",!1);ce(this,"dragUid",null);ce(this,"dragStartCol",0);ce(this,"dragStartRow",0);ce(this,"dragOffsetCol",0);ce(this,"dragOffsetRow",0);ce(this,"isDragMoving",!1)}pushUndo(s){this.undoStack.push(s),this.undoStack.length>Qp&&this.undoStack.shift()}popUndo(){return this.undoStack.pop()||null}pushRedo(s){this.redoStack.push(s),this.redoStack.length>Qp&&this.redoStack.shift()}popRedo(){return this.redoStack.pop()||null}clearRedo(){this.redoStack=[]}clearSelection(){this.selectedFurnitureUid=null}clearGhost(){this.ghostCol=-1,this.ghostRow=-1,this.ghostValid=!1}startDrag(s,o,i,c,f){this.dragUid=s,this.dragStartCol=o,this.dragStartRow=i,this.dragOffsetCol=c,this.dragOffsetRow=f,this.isDragMoving=!1}clearDrag(){this.dragUid=null,this.isDragMoving=!1}reset(){this.activeTool=Se.SELECT,this.selectedFurnitureUid=null,this.ghostCol=-1,this.ghostRow=-1,this.ghostValid=!1,this.isDragging=!1,this.wallDragAdding=null,this.undoStack=[],this.redoStack=[],this.isDirty=!1,this.dragUid=null,this.isDragMoving=!1}}const kn={padding:"3px 8px",fontSize:"22px",background:"rgba(255, 255, 255, 0.08)",color:"rgba(255, 255, 255, 0.7)",border:"2px solid transparent",borderRadius:0,cursor:"pointer"},hl={...kn,background:"rgba(90, 140, 255, 0.25)",color:"rgba(255, 255, 255, 0.9)",border:"2px solid #5a8cff"},v0={padding:"2px 6px",fontSize:"20px",background:"transparent",color:"rgba(255, 255, 255, 0.5)",border:"2px solid transparent",borderRadius:0,cursor:"pointer"},C2={...v0,background:"rgba(255, 255, 255, 0.08)",color:"rgba(255, 255, 255, 0.8)",border:"2px solid #5a8cff"};function k2({patternIndex:a,color:s,selected:o,onClick:i}){const c=E.useRef(null),f=32,d=2;return E.useEffect(()=>{const m=c.current;if(!m)return;const b=m.getContext("2d");if(!b)return;m.width=f,m.height=f,b.imageSmoothingEnabled=!1;const p=b0(a,s),y=ml(p,d);b.drawImage(y,0,0)},[a,s]),h.jsx("button",{onClick:i,title:`Floor ${a}`,style:{width:f,height:f,padding:0,border:o?"2px solid #5a8cff":"2px solid #4a4a6a",borderRadius:0,cursor:"pointer",overflow:"hidden",flexShrink:0,background:"#2A2A3A"},children:h.jsx("canvas",{ref:c,style:{width:f,height:f,display:"block"}})})}function N2({setIndex:a,color:s,selected:o,onClick:i}){const c=E.useRef(null),f=32,d=64,m=2;return E.useEffect(()=>{const b=c.current;if(!b)return;const p=b.getContext("2d");if(!p)return;b.width=f,b.height=d,p.imageSmoothingEnabled=!1;const y=t2(a);if(!y){p.fillStyle="#444",p.fillRect(0,0,f,d);return}const v=`wall-preview-${a}-${s.h}-${s.s}-${s.b}-${s.c}`,x=io(v,y,{...s,colorize:!0}),T=ml(x,m);p.drawImage(T,0,0)},[a,s]),h.jsx("button",{onClick:i,title:`Wall ${a+1}`,style:{width:f,height:d,padding:0,border:o?"2px solid #5a8cff":"2px solid #4a4a6a",borderRadius:0,cursor:"pointer",overflow:"hidden",flexShrink:0,background:"#2A2A3A"},children:h.jsx("canvas",{ref:c,style:{width:f,height:d,display:"block"}})})}function Kt({label:a,value:s,min:o,max:i,onChange:c}){return h.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[h.jsx("span",{style:{fontSize:"20px",color:"#999",width:28,textAlign:"right",flexShrink:0},children:a}),h.jsx("input",{type:"range",min:o,max:i,value:s,onChange:f=>c(Number(f.target.value)),style:{flex:1,height:12,accentColor:"rgba(90, 140, 255, 0.8)"}}),h.jsx("span",{style:{fontSize:"20px",color:"#999",width:48,textAlign:"right",flexShrink:0},children:s})]})}const j2={h:0,s:0,b:0,c:0};function O2({activeTool:a,selectedTileType:s,selectedFurnitureType:o,selectedFurnitureUid:i,selectedFurnitureColor:c,floorColor:f,wallColor:d,selectedWallSet:m,onToolChange:b,onTileTypeChange:p,onFloorColorChange:y,onWallColorChange:v,onWallSetChange:x,onSelectedFurnitureColorChange:T,onFurnitureTypeChange:w,loadedAssets:A}){const[L,H]=E.useState("desks"),[Z,O]=E.useState(!1),[C,D]=E.useState(!1),[j,Q]=E.useState(!1);E.useEffect(()=>{var W;if(A)try{console.log(`[EditorToolbar] Building dynamic catalog with ${A.catalog.length} assets...`);const _=d0(A);console.log(`[EditorToolbar] Catalog build result: ${_}`);const q=sg();if(q.length>0){const $=(W=q[0])==null?void 0:W.id;$&&(console.log(`[EditorToolbar] Setting active category to: ${$}`),H($))}}catch(_){console.error("[EditorToolbar] Error building dynamic catalog:",_)}},[A]);const fe=E.useCallback((W,_)=>{y({...f,[W]:_})},[f,y]),we=E.useCallback((W,_)=>{v({...d,[W]:_})},[d,v]),ie=c??j2,ue=E.useCallback((W,_)=>{T({...ie,[W]:_})},[ie,T]),ge=CT(L),Ee=WT(),se=Array.from({length:Ee},(W,_)=>_+1),me=36,G=a===Se.TILE_PAINT||a===Se.EYEDROPPER,le=a===Se.WALL_PAINT,he=a===Se.ERASE,re=a===Se.FURNITURE_PLACE||a===Se.FURNITURE_PICK;return h.jsxs("div",{style:{position:"absolute",bottom:68,left:10,zIndex:50,background:"#1e1e2e",border:"2px solid #4a4a6a",borderRadius:0,padding:"6px 8px",display:"flex",flexDirection:"column-reverse",gap:6,boxShadow:"2px 2px 0px #0a0a14",maxWidth:"calc(100vw - 20px)"},children:[h.jsxs("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:[h.jsx("button",{style:G?hl:kn,onClick:()=>b(Se.TILE_PAINT),title:"Paint floor tiles",children:"Floor"}),h.jsx("button",{style:le?hl:kn,onClick:()=>b(Se.WALL_PAINT),title:"Paint walls (click to toggle)",children:"Wall"}),h.jsx("button",{style:he?hl:kn,onClick:()=>b(Se.ERASE),title:"Erase tiles to void",children:"Erase"}),h.jsx("button",{style:re?hl:kn,onClick:()=>b(Se.FURNITURE_PLACE),title:"Place furniture",children:"Furniture"})]}),G&&h.jsxs("div",{style:{display:"flex",flexDirection:"column-reverse",gap:6},children:[h.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[h.jsx("button",{style:Z?hl:kn,onClick:()=>O(W=>!W),title:"Adjust floor color",children:"Color"}),h.jsx("button",{style:a===Se.EYEDROPPER?hl:kn,onClick:()=>b(Se.EYEDROPPER),title:"Pick floor pattern + color from existing tile",children:"Pick"})]}),Z&&h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,padding:"4px 6px",background:"#181828",border:"2px solid #4a4a6a",borderRadius:0},children:[h.jsx(Kt,{label:"H",value:f.h,min:0,max:360,onChange:W=>fe("h",W)}),h.jsx(Kt,{label:"S",value:f.s,min:0,max:100,onChange:W=>fe("s",W)}),h.jsx(Kt,{label:"B",value:f.b,min:-100,max:100,onChange:W=>fe("b",W)}),h.jsx(Kt,{label:"C",value:f.c,min:-100,max:100,onChange:W=>fe("c",W)})]}),h.jsx("div",{style:{display:"flex",gap:4,overflowX:"auto",flexWrap:"nowrap",paddingBottom:2},children:se.map(W=>h.jsx(k2,{patternIndex:W,color:f,selected:s===W,onClick:()=>p(W)},W))})]}),le&&h.jsxs("div",{style:{display:"flex",flexDirection:"column-reverse",gap:6},children:[h.jsx("div",{style:{display:"flex",gap:4,alignItems:"center"},children:h.jsx("button",{style:C?hl:kn,onClick:()=>D(W=>!W),title:"Adjust wall color",children:"Color"})}),C&&h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,padding:"4px 6px",background:"#181828",border:"2px solid #4a4a6a",borderRadius:0},children:[h.jsx(Kt,{label:"H",value:d.h,min:0,max:360,onChange:W=>we("h",W)}),h.jsx(Kt,{label:"S",value:d.s,min:0,max:100,onChange:W=>we("s",W)}),h.jsx(Kt,{label:"B",value:d.b,min:-100,max:100,onChange:W=>we("b",W)}),h.jsx(Kt,{label:"C",value:d.c,min:-100,max:100,onChange:W=>we("c",W)})]}),fg()>0&&h.jsx("div",{style:{display:"flex",gap:4,overflowX:"auto",flexWrap:"nowrap",paddingBottom:2},children:Array.from({length:fg()},(W,_)=>h.jsx(N2,{setIndex:_,color:d,selected:m===_,onClick:()=>x(_)},_))})]}),re&&h.jsxs("div",{style:{display:"flex",flexDirection:"column-reverse",gap:4},children:[h.jsxs("div",{style:{display:"flex",gap:2,flexWrap:"wrap",alignItems:"center"},children:[sg().map(W=>h.jsx("button",{style:L===W.id?C2:v0,onClick:()=>H(W.id),children:W.label},W.id)),h.jsx("div",{style:{width:1,height:14,background:"rgba(255,255,255,0.15)",margin:"0 2px",flexShrink:0}}),h.jsx("button",{style:a===Se.FURNITURE_PICK?hl:kn,onClick:()=>b(Se.FURNITURE_PICK),title:"Pick furniture type from placed item",children:"Pick"})]}),h.jsx("div",{style:{display:"flex",gap:4,overflowX:"auto",flexWrap:"nowrap",paddingBottom:2},children:ge.map(W=>{const _=ml(W.sprite,2),q=o===W.type;return h.jsx("button",{onClick:()=>w(W.type),title:W.label,style:{width:me,height:me,background:"#2A2A3A",border:q?"2px solid #5a8cff":"2px solid #4a4a6a",borderRadius:0,cursor:"pointer",padding:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"hidden",flexShrink:0},children:h.jsx("canvas",{ref:$=>{if(!$)return;const Y=$.getContext("2d");if(!Y)return;const P=Math.min(me/_.width,me/_.height)*.85;$.width=me,$.height=me,Y.imageSmoothingEnabled=!1,Y.clearRect(0,0,me,me);const M=_.width*P,I=_.height*P;Y.drawImage(_,(me-M)/2,(me-I)/2,M,I)},style:{width:me,height:me}})},W.type)})})]}),i&&h.jsxs("div",{style:{display:"flex",flexDirection:"column-reverse",gap:3},children:[h.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[h.jsx("button",{style:j?hl:kn,onClick:()=>Q(W=>!W),title:"Adjust selected furniture color",children:"Color"}),c&&h.jsx("button",{style:{...kn,fontSize:"20px",padding:"2px 6px"},onClick:()=>T(null),title:"Remove color (restore original)",children:"Clear"})]}),j&&h.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:3,padding:"4px 6px",background:"#181828",border:"2px solid #4a4a6a",borderRadius:0},children:[ie.colorize?h.jsxs(h.Fragment,{children:[h.jsx(Kt,{label:"H",value:ie.h,min:0,max:360,onChange:W=>ue("h",W)}),h.jsx(Kt,{label:"S",value:ie.s,min:0,max:100,onChange:W=>ue("s",W)})]}):h.jsxs(h.Fragment,{children:[h.jsx(Kt,{label:"H",value:ie.h,min:-180,max:180,onChange:W=>ue("h",W)}),h.jsx(Kt,{label:"S",value:ie.s,min:-100,max:100,onChange:W=>ue("s",W)})]}),h.jsx(Kt,{label:"B",value:ie.b,min:-100,max:100,onChange:W=>ue("b",W)}),h.jsx(Kt,{label:"C",value:ie.c,min:-100,max:100,onChange:W=>ue("c",W)}),h.jsxs("label",{style:{display:"flex",alignItems:"center",gap:4,fontSize:"20px",color:"#999",cursor:"pointer"},children:[h.jsx("input",{type:"checkbox",checked:!!ie.colorize,onChange:W=>T({...ie,colorize:W.target.checked||void 0}),style:{accentColor:"rgba(90, 140, 255, 0.8)"}}),"Colorize"]})]})]})]})}class D2{constructor(){ce(this,"furnitureReservations",new Map);ce(this,"chatPairs",new Map);ce(this,"deskClaims",new Map);ce(this,"pendingRealChats",[])}releaseAll(s,o){for(const[c,f]of this.furnitureReservations)f===s&&this.furnitureReservations.delete(c);const i=this.chatPairs.get(s);if(i!==void 0&&(this.chatPairs.delete(s),this.chatPairs.delete(i),o)){const c=o.get(i);c&&c.chatPartner===s&&(c.chatPartner=null,c.chatTimer=0,c.interactTimer=0,(c.state===Te.INTERACT||c.state===Te.WALK)&&(c.state=Te.IDLE,c.path=[],c.moveProgress=0))}for(const[c,f]of this.deskClaims)f===s&&this.deskClaims.delete(c)}selectIdleAction(s,o,i,c,f,d){if(s.idleActionCount>=s.idleActionLimit)return{type:"rest"};const m=Math.random()*100,b=[zc,zc+Jp,zc+Jp+L1,100];if(m<b[0])return{type:"wander"};if(m<b[1]){const y=this.tryInteractAction(s,c,f,d);return y||{type:"wander"}}if(m<b[2]){const y=this.tryChatAction(s,o,f,d);return y||{type:"wander"}}const p=this.tryLoungeAction(s,i);return p||{type:"wander"}}tryInteractAction(s,o,i,c){const f=o.filter(m=>{const b=rt(m.type);return(b==null?void 0:b.interactable)&&!this.furnitureReservations.has(m.uid)});if(f.length===0)return null;const d=[...f].sort(()=>Math.random()-.5);for(const m of d){const b=rt(m.type),p=b.interactSides??["front"],y=this.findInteractionTile(m,b,p,i,c);if(!y||Nt(s.tileCol,s.tileRow,y.col,y.row,i,c).length===0&&(s.tileCol!==y.col||s.tileRow!==y.row))continue;this.furnitureReservations.set(m.uid,s.id);const x=Wp+Math.random()*(j1-Wp);return{type:"interact",furnitureUid:m.uid,tileCol:y.col,tileRow:y.row,facingDir:y.dir,duration:x}}return null}findInteractionTile(s,o,i,c,f){var x;const d=o.footprintW,m=o.footprintH,b=[];for(const T of i){if(T==="front"||T==="any")for(let w=s.col;w<s.col+d;w++)b.push({col:w,row:s.row+m,dir:oe.UP});if(T==="back"||T==="any")for(let w=s.col;w<s.col+d;w++)b.push({col:w,row:s.row-1,dir:oe.DOWN});if(T==="left"||T==="any")for(let w=s.row;w<s.row+m;w++)b.push({col:s.col-1,row:w,dir:oe.RIGHT});if(T==="right"||T==="any")for(let w=s.row;w<s.row+m;w++)b.push({col:s.col+d,row:w,dir:oe.LEFT})}const p=c.length,y=((x=c[0])==null?void 0:x.length)??0,v=b.filter(T=>T.col>=0&&T.col<y&&T.row>=0&&T.row<p&&c[T.row][T.col]>0&&c[T.row][T.col]<255&&!f.has(`${T.col},${T.row}`));return v.length===0?null:v[Math.floor(Math.random()*v.length)]}tryChatAction(s,o,i,c){const f=[];for(const A of o.values()){if(A.id===s.id||A.state!==Te.IDLE||A.isActive||this.chatPairs.has(A.id)||A.isSubagent)continue;Math.abs(A.tileCol-s.tileCol)+Math.abs(A.tileRow-s.tileRow)<=M1&&f.push(A)}if(f.length===0)return null;f.sort((A,L)=>{const H=Math.abs(A.tileCol-s.tileCol)+Math.abs(A.tileRow-s.tileRow),Z=Math.abs(L.tileCol-s.tileCol)+Math.abs(L.tileRow-s.tileRow);return H-Z});const d=f[0],m=Math.round((s.tileCol+d.tileCol)/2),b=Math.round((s.tileRow+d.tileRow)/2),p=this.findChatMeetingTiles(m,b,i,c);if(!p)return null;const y=Nt(s.tileCol,s.tileRow,p.a.col,p.a.row,i,c),v=Nt(d.tileCol,d.tileRow,p.b.col,p.b.row,i,c),x=s.tileCol===p.a.col&&s.tileRow===p.a.row,T=d.tileCol===p.b.col&&d.tileRow===p.b.row;if(y.length===0&&!x||v.length===0&&!T)return null;const w=Fr+Math.random()*(Kp-Fr);return this.chatPairs.set(s.id,d.id),this.chatPairs.set(d.id,s.id),d.chatPartner=s.id,d.path=v,d.state=Te.WALK,d.chatTimer=w,{type:"chat",partnerId:d.id,tileCol:p.a.col,tileRow:p.a.row,facingDir:p.a.dir,duration:w}}findChatMeetingTiles(s,o,i,c){var b;const f=i.length,d=((b=i[0])==null?void 0:b.length)??0,m=(p,y)=>p>=0&&p<d&&y>=0&&y<f&&i[y][p]>0&&i[y][p]<255&&!c.has(`${p},${y}`);for(let p=0;p<8;p++)for(let y=-p;y<=p;y++)for(let v=-p;v<=p;v++){if(Math.abs(y)!==p&&Math.abs(v)!==p)continue;const x=s+v,T=o+y;if(m(x,T)&&m(x+1,T))return{a:{col:x,row:T,dir:oe.RIGHT},b:{col:x+1,row:T,dir:oe.LEFT}};if(m(x,T)&&m(x,T+1))return{a:{col:x,row:T,dir:oe.DOWN},b:{col:x,row:T+1,dir:oe.UP}}}return null}tryLoungeAction(s,o){const i=[...o.values()].filter(f=>f.kind==="lounge"&&!f.assigned&&!this.deskClaims.has(f.uid));return i.length===0?null:{type:"lounge",seatUid:i[Math.floor(Math.random()*i.length)].uid}}claimDeskSeat(s,o,i,c){const f=[...o.values()].filter(d=>d.kind==="desk"&&d.hasPc&&!this.deskClaims.has(d.uid));if(f.length===0)return null;f.sort((d,m)=>{const b=Math.abs(d.seatCol-s.tileCol)+Math.abs(d.seatRow-s.tileRow),p=Math.abs(m.seatCol-s.tileCol)+Math.abs(m.seatRow-s.tileRow);return b-p});for(const d of f)if(Nt(s.tileCol,s.tileRow,d.seatCol,d.seatRow,i,c).length>0||s.tileCol===d.seatCol&&s.tileRow===d.seatRow)return this.deskClaims.set(d.uid,s.id),d;return null}releaseDeskClaim(s){this.deskClaims.delete(s)}releaseFurniture(s){this.furnitureReservations.delete(s)}requestRealChat(s,o){this.pendingRealChats.push({parentId:s,childId:o})}processPendingChats(s,o,i){for(;this.pendingRealChats.length>0;){const{parentId:c,childId:f}=this.pendingRealChats.shift(),d=s.get(c),m=s.get(f);if(!d||!m||d.isActive||m.isActive||this.chatPairs.has(c)||this.chatPairs.has(f))continue;const b=Math.round((d.tileCol+m.tileCol)/2),p=Math.round((d.tileRow+m.tileRow)/2),y=this.findChatMeetingTiles(b,p,o,i);if(!y)continue;const v=Nt(d.tileCol,d.tileRow,y.a.col,y.a.row,o,i),x=Nt(m.tileCol,m.tileRow,y.b.col,y.b.row,o,i),T=d.tileCol===y.a.col&&d.tileRow===y.a.row,w=m.tileCol===y.b.col&&m.tileRow===y.b.row;if(v.length===0&&!T||x.length===0&&!w)continue;const A=Fr+Math.random()*(Kp-Fr);this.chatPairs.set(c,f),this.chatPairs.set(f,c),d.chatPartner=f,d.chatTimer=A,d.path=v,d.state=T?Te.INTERACT:Te.WALK,T&&(d.interactTimer=A),m.chatPartner=c,m.chatTimer=A,m.path=x,m.state=w?Te.INTERACT:Te.WALK,w&&(m.interactTimer=A)}}}class mg{constructor(s){ce(this,"layout");ce(this,"tileMap");ce(this,"seats");ce(this,"blockedTiles");ce(this,"furniture");ce(this,"walkableTiles");ce(this,"characters",new Map);ce(this,"furnitureAnimTimer",0);ce(this,"selectedAgentId",null);ce(this,"cameraFollowId",null);ce(this,"hoveredAgentId",null);ce(this,"hoveredTile",null);ce(this,"scheduler",new D2);ce(this,"subagentIdMap",new Map);ce(this,"subagentMeta",new Map);ce(this,"nextSubagentId",-1);this.layout=s||LT(),this.tileMap=ig(this.layout),this.seats=og(this.layout.furniture),this.blockedTiles=rg(this.layout.furniture),this.furniture=Hc(this.layout.furniture),this.walkableTiles=dg(this.tileMap,this.blockedTiles)}rebuildFromLayout(s,o){this.layout=s,this.tileMap=ig(s),this.seats=og(s.furniture),this.blockedTiles=rg(s.furniture),this.rebuildFurnitureInstances(),this.walkableTiles=dg(this.tileMap,this.blockedTiles);for(const i of this.characters.values())o&&(o.col!==0||o.row!==0)&&(i.tileCol+=o.col,i.tileRow+=o.row,i.x+=o.col*xe,i.y+=o.row*xe),i.path=[],i.moveProgress=0;this.scheduler.furnitureReservations.clear(),this.scheduler.chatPairs.clear(),this.scheduler.deskClaims.clear(),this.scheduler.pendingRealChats=[];for(const i of this.characters.values())i.workDeskId=null,i.chatPartner=null,i.interactTarget=null;for(const i of this.seats.values())i.assigned=!1;for(const i of this.characters.values()){if(i.seatId&&this.seats.has(i.seatId)){const c=this.seats.get(i.seatId);if(!c.assigned){c.assigned=!0,i.tileCol=c.seatCol,i.tileRow=c.seatRow;const f=c.seatCol*xe+xe/2,d=c.seatRow*xe+xe/2;i.x=f,i.y=d,i.dir=c.facingDir;continue}}i.seatId=null}for(const i of this.characters.values()){if(i.seatId)continue;const c=this.findFreeSeat();if(c){this.seats.get(c).assigned=!0,i.seatId=c;const f=this.seats.get(c);i.tileCol=f.seatCol,i.tileRow=f.seatRow,i.x=f.seatCol*xe+xe/2,i.y=f.seatRow*xe+xe/2,i.dir=f.facingDir}}for(const i of this.characters.values())i.seatId||(i.tileCol<0||i.tileCol>=s.cols||i.tileRow<0||i.tileRow>=s.rows||this.blockedTiles.has(`${i.tileCol},${i.tileRow}`)||!yi(i.tileCol,i.tileRow,this.tileMap,this.blockedTiles))&&this.relocateCharacterToWalkable(i)}relocateCharacterToWalkable(s){if(this.walkableTiles.length===0)return;const o=this.walkableTiles[Math.floor(Math.random()*this.walkableTiles.length)];s.tileCol=o.col,s.tileRow=o.row,s.x=o.col*xe+xe/2,s.y=o.row*xe+xe/2,s.path=[],s.moveProgress=0}getLayout(){return this.layout}ownSeatKey(s){if(!s.seatId)return null;const o=this.seats.get(s.seatId);return o?`${o.seatCol},${o.seatRow}`:null}withOwnSeatUnblocked(s,o){const i=this.ownSeatKey(s);i&&this.blockedTiles.delete(i);const c=o();return i&&this.blockedTiles.add(i),c}findFreeSeat(){for(const[s,o]of this.seats)if(!o.assigned)return s;return null}pickDiversePalette(){const s=new Array(tg).fill(0);for(const d of this.characters.values())d.isSubagent||s[d.palette]++;const o=Math.min(...s),i=[];for(let d=0;d<tg;d++)s[d]===o&&i.push(d);const c=i[Math.floor(Math.random()*i.length)];let f=0;return o>0&&(f=H1+Math.floor(Math.random()*I1)),{palette:c,hueShift:f}}addAgent(s,o,i,c,f,d){if(this.characters.has(s))return;let m,b;if(o!==void 0)m=o,b=i??0;else{const v=this.pickDiversePalette();m=v.palette,b=v.hueShift}let p=null;c&&this.seats.has(c)&&(this.seats.get(c).assigned||(p=c)),p||(p=this.findFreeSeat());let y;if(p){const v=this.seats.get(p);v.assigned=!0,y=Yr(s,m,p,v,b)}else{const v=this.walkableTiles.length>0?this.walkableTiles[Math.floor(Math.random()*this.walkableTiles.length)]:{col:1,row:1};y=Yr(s,m,null,null,b),y.x=v.col*xe+xe/2,y.y=v.row*xe+xe/2,y.tileCol=v.col,y.tileRow=v.row}d&&(y.folderName=d),f||(y.matrixEffect="spawn",y.matrixEffectTimer=0,y.matrixEffectSeeds=hi()),this.characters.set(s,y)}removeAgent(s){const o=this.characters.get(s);if(o&&o.matrixEffect!=="despawn"){if(this.scheduler.releaseAll(s,this.characters),o.seatId){const i=this.seats.get(o.seatId);i&&(i.assigned=!1)}this.selectedAgentId===s&&(this.selectedAgentId=null),this.cameraFollowId===s&&(this.cameraFollowId=null),o.matrixEffect="despawn",o.matrixEffectTimer=0,o.matrixEffectSeeds=hi(),o.bubbleType=null}}getSeatAtTile(s,o){for(const[i,c]of this.seats)if(c.seatCol===s&&c.seatRow===o)return i;return null}reassignSeat(s,o){const i=this.characters.get(s);if(!i)return;const c=this.seats.get(o);if(!c||c.assigned)return;if(i.seatId){const d=this.seats.get(i.seatId);d&&(d.assigned=!1)}c.assigned=!0,i.seatId=o,i.homeSeatId=o;const f=this.withOwnSeatUnblocked(i,()=>Nt(i.tileCol,i.tileRow,c.seatCol,c.seatRow,this.tileMap,this.blockedTiles));f.length>0?(i.path=f,i.moveProgress=0,i.state=Te.WALK,i.frame=0,i.frameTimer=0):i.tileCol===c.seatCol&&i.tileRow===c.seatRow&&(i.state=Te.TYPE,i.dir=c.facingDir,i.frame=0,i.frameTimer=0,i.isActive||(i.seatTimer=Pp+Math.random()*eg))}sendToSeat(s){const o=this.characters.get(s);if(!o||!o.seatId)return;const i=this.seats.get(o.seatId);if(!i)return;const c=this.withOwnSeatUnblocked(o,()=>Nt(o.tileCol,o.tileRow,i.seatCol,i.seatRow,this.tileMap,this.blockedTiles));c.length>0?(o.path=c,o.moveProgress=0,o.state=Te.WALK,o.frame=0,o.frameTimer=0):o.tileCol===i.seatCol&&o.tileRow===i.seatRow&&(o.state=Te.TYPE,o.dir=i.facingDir,o.frame=0,o.frameTimer=0,o.isActive||(o.seatTimer=Pp+Math.random()*eg))}walkToTile(s,o,i){const c=this.characters.get(s);if(!c||c.isSubagent)return!1;if(!yi(o,i,this.tileMap,this.blockedTiles)){const d=this.ownSeatKey(c);if(!d||d!==`${o},${i}`)return!1}const f=this.withOwnSeatUnblocked(c,()=>Nt(c.tileCol,c.tileRow,o,i,this.tileMap,this.blockedTiles));return f.length===0?!1:(c.path=f,c.moveProgress=0,c.state=Te.WALK,c.frame=0,c.frameTimer=0,!0)}addSubagent(s,o){const i=`${s}:${o}`;if(this.subagentIdMap.has(i))return this.subagentIdMap.get(i);const c=this.nextSubagentId--,f=this.characters.get(s),d=f?f.palette:0,m=f?f.hueShift:0,b=f?f.tileCol:0,p=f?f.tileRow:0,y=(w,A)=>Math.abs(w-b)+Math.abs(A-p);let v=null,x=1/0;for(const[w,A]of this.seats)if(!A.assigned){const L=y(A.seatCol,A.seatRow);L<x&&(x=L,v=w)}let T;if(v){const w=this.seats.get(v);w.assigned=!0,T=Yr(c,d,v,w,m)}else{let w={col:1,row:1};if(this.walkableTiles.length>0){let A=this.walkableTiles[0],L=y(A.col,A.row);for(let H=1;H<this.walkableTiles.length;H++){const Z=y(this.walkableTiles[H].col,this.walkableTiles[H].row);Z<L&&(A=this.walkableTiles[H],L=Z)}w=A}T=Yr(c,d,null,null,m),T.x=w.col*xe+xe/2,T.y=w.row*xe+xe/2,T.tileCol=w.col,T.tileRow=w.row}return T.isSubagent=!0,T.parentAgentId=s,T.matrixEffect="spawn",T.matrixEffectTimer=0,T.matrixEffectSeeds=hi(),this.characters.set(c,T),this.subagentIdMap.set(i,c),this.subagentMeta.set(c,{parentAgentId:s,parentToolId:o}),c}removeSubagent(s,o){const i=`${s}:${o}`,c=this.subagentIdMap.get(i);if(c===void 0)return;const f=this.characters.get(c);if(f){if(f.matrixEffect==="despawn"){this.subagentIdMap.delete(i),this.subagentMeta.delete(c);return}if(f.seatId){const d=this.seats.get(f.seatId);d&&(d.assigned=!1)}f.matrixEffect="despawn",f.matrixEffectTimer=0,f.matrixEffectSeeds=hi(),f.bubbleType=null}this.subagentIdMap.delete(i),this.subagentMeta.delete(c),this.selectedAgentId===c&&(this.selectedAgentId=null),this.cameraFollowId===c&&(this.cameraFollowId=null)}removeAllSubagents(s){const o=[];for(const[i,c]of this.subagentIdMap){const f=this.subagentMeta.get(c);if(f&&f.parentAgentId===s){const d=this.characters.get(c);if(d){if(d.matrixEffect==="despawn"){this.subagentMeta.delete(c),o.push(i);continue}if(d.seatId){const m=this.seats.get(d.seatId);m&&(m.assigned=!1)}d.matrixEffect="despawn",d.matrixEffectTimer=0,d.matrixEffectSeeds=hi(),d.bubbleType=null}this.subagentMeta.delete(c),this.selectedAgentId===c&&(this.selectedAgentId=null),this.cameraFollowId===c&&(this.cameraFollowId=null),o.push(i)}}for(const i of o)this.subagentIdMap.delete(i)}getSubagentId(s,o){return this.subagentIdMap.get(`${s}:${o}`)??null}setAgentActive(s,o){const i=this.characters.get(s);i&&(i.isActive=o,o||(i.seatTimer=-1,i.path=[],i.moveProgress=0),this.rebuildFurnitureInstances())}rebuildFurnitureInstances(){const s=new Set;for(const c of this.characters.values()){if(!c.isActive)continue;const f=c.workDeskId??c.seatId;if(!f)continue;const d=this.seats.get(f);if(!d)continue;const m=d.facingDir===oe.RIGHT?1:d.facingDir===oe.LEFT?-1:0,b=d.facingDir===oe.DOWN?1:d.facingDir===oe.UP?-1:0;for(let p=1;p<=F1;p++){const y=d.seatCol+m*p,v=d.seatRow+b*p;s.add(`${y},${v}`)}for(let p=1;p<=G1;p++){const y=d.seatCol+m*p,v=d.seatRow+b*p;m!==0?(s.add(`${y},${v-1}`),s.add(`${y},${v+1}`)):(s.add(`${y-1},${v}`),s.add(`${y+1},${v}`))}}if(s.size===0){this.furniture=Hc(this.layout.furniture);return}const o=Math.floor(this.furnitureAnimTimer/Uc),i=this.layout.furniture.map(c=>{const f=rt(c.type);if(!f)return c;for(let d=0;d<f.footprintH;d++)for(let m=0;m<f.footprintW;m++)if(s.has(`${c.col+m},${c.row+d}`)){let b=NT(c.type);if(b!==c.type){const p=jT(b);if(p&&p.length>1){const y=o%p.length;b=p[y]}return{...c,type:b}}return c}return c});this.furniture=Hc(i)}setAgentTool(s,o){const i=this.characters.get(s);i&&(i.currentTool=o)}showPermissionBubble(s){const o=this.characters.get(s);o&&(o.bubbleType="permission",o.bubbleTimer=0)}clearPermissionBubble(s){const o=this.characters.get(s);o&&o.bubbleType==="permission"&&(o.bubbleType=null,o.bubbleTimer=0)}showWaitingBubble(s){const o=this.characters.get(s);o&&(o.bubbleType="waiting",o.bubbleTimer=U1)}dismissBubble(s){const o=this.characters.get(s);!o||!o.bubbleType||(o.bubbleType==="permission"?(o.bubbleType=null,o.bubbleTimer=0):o.bubbleType==="waiting"&&(o.bubbleTimer=Math.min(o.bubbleTimer,B1)))}claimDeskForAgent(s){const o=this.characters.get(s);return o?this.scheduler.claimDeskSeat(o,this.seats,this.tileMap,this.blockedTiles):null}update(s){this.scheduler.processPendingChats(this.characters,this.tileMap,this.blockedTiles);const o=Math.floor(this.furnitureAnimTimer/Uc);this.furnitureAnimTimer+=s,Math.floor(this.furnitureAnimTimer/Uc)!==o&&this.rebuildFurnitureInstances();const c=[];for(const f of this.characters.values()){if(f.matrixEffect){f.matrixEffectTimer+=s,f.matrixEffectTimer>=Jg&&(f.matrixEffect==="spawn"?(f.matrixEffect=null,f.matrixEffectTimer=0,f.matrixEffectSeeds=[]):c.push(f.id));continue}this.withOwnSeatUnblocked(f,()=>o2(f,s,this.walkableTiles,this.seats,this.tileMap,this.blockedTiles,this)),f.bubbleType==="waiting"&&(f.bubbleTimer-=s,f.bubbleTimer<=0&&(f.bubbleType=null,f.bubbleTimer=0))}for(const f of c)this.characters.delete(f)}getCharacters(){return Array.from(this.characters.values())}getCharacterAt(s,o){let i=null,c=-1/0;for(const f of this.characters.values()){if(f.matrixEffect==="despawn")continue;const d=f.state===Te.TYPE||f.state===Te.SIT?yf:0,m=f.y+d,b=f.x-ng,p=f.x+ng,y=m-Y1,v=m;s>=b&&s<=p&&o>=y&&o<=v&&f.y>c&&(i=f.id,c=f.y)}return i}}const Pa="/pixel-engine",M2=6,pg=16,gg=32,L2=7,yg=["down","up","right"],z2=2,U2=16,bg=4,xg=16,vg=32,Tg=16;function B2(a,s,o,i){if(i<z2)return"";const c=f=>f.toString(16).padStart(2,"0");return i>=255?`#${c(a)}${c(s)}${c(o)}`.toUpperCase():`#${c(a)}${c(s)}${c(o)}${c(i)}`.toUpperCase()}async function oo(a){const s=await fetch(a);if(!s.ok)throw new Error(`Failed to fetch ${a}: ${s.status}`);const o=await s.blob(),i=await createImageBitmap(o),f=new OffscreenCanvas(i.width,i.height).getContext("2d");return f.drawImage(i,0,0),{imageData:f.getImageData(0,0,i.width,i.height),width:i.width,height:i.height}}function uo(a,s,o,i,c,f){const d=[];for(let m=0;m<f;m++){const b=[];for(let p=0;p<c;p++){const y=((i+m)*s+(o+p))*4;b.push(B2(a[y],a[y+1],a[y+2],a[y+3]))}d.push(b)}return d}function H2(a){return uo(a.data,a.width,0,0,a.width,a.height)}function T0(a,s){if(a.type==="asset"){const c=a,f=c.orientation??s.orientation,d=c.state??s.state;return[{id:c.id,label:s.name,category:s.category,file:c.file,width:c.width,height:c.height,footprintW:c.footprintW,footprintH:c.footprintH,isDesk:s.category==="desks",canPlaceOnWalls:s.canPlaceOnWalls,canPlaceOnSurfaces:s.canPlaceOnSurfaces,backgroundTiles:s.backgroundTiles,groupId:s.groupId,...f?{orientation:f}:{},...d?{state:d}:{},...c.mirrorSide?{mirrorSide:!0}:{},...s.rotationScheme?{rotationScheme:s.rotationScheme}:{},...s.animationGroup?{animationGroup:s.animationGroup}:{},...c.frame!==void 0?{frame:c.frame}:{},...s.interactable?{interactable:!0}:{},...s.interactAction?{interactAction:s.interactAction}:{},...s.interactSides?{interactSides:s.interactSides}:{}}]}const o=a,i=[];for(const c of o.members){const f={...s};if(o.groupType==="rotation"&&o.rotationScheme&&(f.rotationScheme=o.rotationScheme),o.groupType==="state"&&(o.orientation&&(f.orientation=o.orientation),o.state&&(f.state=o.state)),o.groupType==="animation"){const d=o.orientation??s.orientation??"",m=o.state??s.state??"";f.animationGroup=`${s.groupId}_${d}_${m}`.toUpperCase(),o.state&&(f.state=o.state)}o.orientation&&!f.orientation&&(f.orientation=o.orientation),i.push(...T0(c,f))}return i}async function I2(){const a=[];for(let s=0;s<M2;s++){const o=`${Pa}/characters/char_${s}.png`,{imageData:i}=await oo(o),c={down:[],up:[],right:[]};for(let f=0;f<yg.length;f++){const d=yg[f],m=f*gg,b=[];for(let p=0;p<L2;p++){const y=p*pg;b.push(uo(i.data,i.width,y,m,pg,gg))}c[d]=b}a.push(c)}console.log(`[AssetLoader] Loaded ${a.length} character sprites`),eT(a)}async function F2(){const a=[];for(let s=0;;s++){const o=`${Pa}/floors/floor_${s}.png`;try{if(!(await fetch(o,{method:"HEAD"})).ok)break;const{imageData:c}=await oo(o);a.push(uo(c.data,c.width,0,0,Tg,Tg))}catch{break}}console.log(`[AssetLoader] Loaded ${a.length} floor tile patterns`),VT(a)}async function G2(){const a=[];for(let s=0;;s++){const o=`${Pa}/walls/wall_${s}.png`;try{if(!(await fetch(o,{method:"HEAD"})).ok)break;const{imageData:c}=await oo(o),f=[];for(let d=0;d<U2;d++){const m=d%bg*xg,b=Math.floor(d/bg)*vg;f.push(uo(c.data,c.width,m,b,xg,vg))}a.push(f)}catch{break}}console.log(`[AssetLoader] Loaded ${a.length} wall tile set(s)`),PT(a)}async function Y2(){const a=`${Pa}/furniture/index.json`;let s;try{const c=await fetch(a);if(c.ok)s=await c.json();else{console.warn("[AssetLoader] No furniture/index.json found, skipping furniture");return}}catch{console.warn("[AssetLoader] Failed to fetch furniture index");return}const o=[],i={};for(const c of s){const f=`${Pa}/furniture/${c}/manifest.json`;try{const d=await fetch(f);if(!d.ok)continue;const m=await d.json(),b={groupId:m.id,name:m.name,category:m.category,canPlaceOnWalls:m.canPlaceOnWalls,canPlaceOnSurfaces:m.canPlaceOnSurfaces,backgroundTiles:m.backgroundTiles,...m.interactable?{interactable:!0}:{},...m.interactAction?{interactAction:m.interactAction}:{},...m.interactSides?{interactSides:m.interactSides}:{}};let p;if(m.type==="asset")p=[{id:m.id,label:m.name,category:m.category,file:m.file??`${m.id}.png`,width:m.width,height:m.height,footprintW:m.footprintW,footprintH:m.footprintH,isDesk:m.category==="desks",canPlaceOnWalls:m.canPlaceOnWalls,canPlaceOnSurfaces:m.canPlaceOnSurfaces,backgroundTiles:m.backgroundTiles,groupId:m.id,...m.interactable?{interactable:!0}:{},...m.interactAction?{interactAction:m.interactAction}:{},...m.interactSides?{interactSides:m.interactSides}:{}}];else{m.rotationScheme&&(b.rotationScheme=m.rotationScheme);const y={type:"group",groupType:m.groupType,rotationScheme:m.rotationScheme,members:m.members};p=T0(y,b)}for(const y of p)try{const v=`${Pa}/furniture/${c}/${y.file}`,{imageData:x}=await oo(v);i[y.id]=H2(x)}catch(v){console.warn(`[AssetLoader] Failed to load ${y.id}: ${v instanceof Error?v.message:v}`)}o.push(...p)}catch(d){console.warn(`[AssetLoader] Error processing ${c}: ${d instanceof Error?d.message:d}`)}}console.log(`[AssetLoader] Loaded ${Object.keys(i).length}/${o.length} furniture assets`),d0({catalog:o,sprites:i})}function q2(){const[a,s]=E.useState(!1);return E.useEffect(()=>{let o=!1;async function i(){try{if(await I2(),o||(await F2(),o)||(await G2(),o))return;try{await Y2()}catch(c){console.error("[AssetLoader] Furniture loading failed (non-fatal):",c)}if(o)return;console.log("[AssetLoader] All assets loaded"),s(!0)}catch(c){console.error("[AssetLoader] Fatal error loading assets:",c)}}return i(),()=>{o=!0}},[]),{assetsReady:a}}const X2={Reading:"Read",Searching:"Grep",Globbing:"Glob",Fetching:"WebFetch","Searching web":"WebSearch",Writing:"Write",Editing:"Edit",Running:"Bash",Task:"Task"};function Gc(a){for(const[o,i]of Object.entries(X2))if(a.startsWith(o))return i;return a.split(/[\s:]/)[0]||null}function $2(){const a=window.devicePixelRatio||1;return Math.max(ro,Math.round(E1*a))}function Z2(a,s,o,i){const[c,f]=E.useState(!1),[d,m]=E.useState(0),[b,p]=E.useState(!1),[y,v]=E.useState($2),x=E.useRef(null),T=E.useRef({x:0,y:0}),w=E.useRef(null),A=E.useCallback(M=>{w.current=structuredClone(M)},[]),L=E.useCallback(M=>{x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{o(M)},r0)},[o]),H=E.useCallback((M,I)=>{const ne=a();s.pushUndo(I??ne.getLayout()),s.clearRedo(),s.isDirty=!0,p(!0),ne.rebuildFromLayout(M),L(M),m(K=>K+1)},[a,s,L]),Z=E.useCallback(()=>{f(M=>{const I=!M;if(s.isEditMode=I,I){const K=a().getLayout();if(K.tileColors){for(let ee=0;ee<K.tiles.length;ee++)if(K.tiles[ee]===qe.WALL&&K.tileColors[ee]){s.wallColor={...K.tileColors[ee]};break}}}else s.clearSelection(),s.clearGhost(),s.clearDrag(),j.current=!1;return I})},[s,a]),O=E.useCallback(M=>{s.activeTool===M?s.activeTool=Se.SELECT:s.activeTool=M,s.clearSelection(),s.clearGhost(),s.clearDrag(),we.current=null,j.current=!1,m(I=>I+1)},[s]),C=E.useCallback(M=>{s.selectedTileType=M,m(I=>I+1)},[s]),D=E.useCallback(M=>{s.floorColor=M,m(I=>I+1)},[s]),j=E.useRef(!1),Q=E.useCallback(M=>{s.wallColor=M;const I=a(),ne=I.getLayout(),ee=[...ne.tileColors||new Array(ne.tiles.length).fill(null)];let ve=!1;for(let _e=0;_e<ne.tiles.length;_e++)ne.tiles[_e]===qe.WALL&&(ee[_e]={...M},ve=!0);if(ve){j.current||(s.pushUndo(ne),s.clearRedo(),j.current=!0);const _e={...ne,tileColors:ee};s.isDirty=!0,p(!0),I.rebuildFromLayout(_e),L(_e)}m(_e=>_e+1)},[s,a,L]),fe=E.useCallback(M=>{s.selectedWallSet=M,m(I=>I+1)},[s]),we=E.useRef(null),ie=E.useCallback(M=>{const I=s.selectedFurnitureUid;if(!I)return;const ne=a(),K=ne.getLayout();we.current!==I&&(s.pushUndo(K),s.clearRedo(),we.current=I);const ee=K.furniture.map(_e=>_e.uid===I?{..._e,color:M??void 0}:_e),ve={...K,furniture:ee};s.isDirty=!0,p(!0),ne.rebuildFromLayout(ve),L(ve),m(_e=>_e+1)},[a,s,L]),ue=E.useCallback(M=>{s.selectedFurnitureType===M?(s.selectedFurnitureType="",s.clearGhost()):s.selectedFurnitureType=M,m(I=>I+1)},[s]),ge=E.useCallback(()=>{const M=s.selectedFurnitureUid;if(!M)return;const I=a(),ne=IT(I.getLayout(),M);ne!==I.getLayout()&&(H(ne),s.clearSelection(),we.current=null)},[a,s,H]),Ee=E.useCallback(()=>{if(s.activeTool===Se.FURNITURE_PLACE){const K=h0(s.selectedFurnitureType);K&&(s.selectedFurnitureType=K,m(ee=>ee+1));return}const M=s.selectedFurnitureUid;if(!M)return;const I=a(),ne=GT(I.getLayout(),M);ne!==I.getLayout()&&H(ne)},[a,s,H]),se=E.useCallback(()=>{if(s.activeTool===Se.FURNITURE_PLACE){const K=m0(s.selectedFurnitureType);K&&(s.selectedFurnitureType=K,m(ee=>ee+1));return}const M=s.selectedFurnitureUid;if(!M)return;const I=a(),ne=YT(I.getLayout(),M);ne!==I.getLayout()&&H(ne)},[a,s,H]),me=E.useCallback(()=>{const M=s.popUndo();if(!M)return;const I=a();s.pushRedo(I.getLayout()),I.rebuildFromLayout(M),L(M),s.isDirty=!0,p(!0),m(ne=>ne+1)},[a,s,L]),G=E.useCallback(()=>{const M=s.popRedo();if(!M)return;const I=a();s.pushUndo(I.getLayout()),I.rebuildFromLayout(M),L(M),s.isDirty=!0,p(!0),m(ne=>ne+1)},[a,s,L]),le=E.useCallback(()=>{if(!w.current)return;const M=structuredClone(w.current);H(M),s.reset(),p(!1)},[s,H]),he=E.useCallback(async()=>{x.current&&(clearTimeout(x.current),x.current=null);const I=a().getLayout();i?await i(I)&&(w.current=structuredClone(I),s.isDirty=!1,p(!1)):(o(I),w.current=structuredClone(I),s.isDirty=!1,p(!1))},[a,s,o,i]),re=E.useCallback(()=>{we.current=null,m(M=>M+1)},[]),W=E.useCallback(()=>{p(s.isDirty),m(M=>M+1)},[s]),_=E.useCallback(M=>{v(Math.max(ro,Math.min(bf,M)))},[]),q=E.useCallback((M,I,ne)=>{const ee=a().getLayout(),ve=FT(ee,M,I,ne);ve!==ee&&H(ve)},[a,H]),$=E.useCallback((M,I,ne)=>{if(I>=0&&I<M.cols&&ne>=0&&ne<M.rows)return null;const K=[];I<0&&K.push("left"),I>=M.cols&&K.push("right"),ne<0&&K.push("up"),ne>=M.rows&&K.push("down");let ee=M,ve=0,_e=0;for(const Pe of K){const Ne=qT(ee,Pe);if(!Ne)return null;ee=Ne.layout,ve+=Ne.shift.col,_e+=Ne.shift.row}return{layout:ee,col:I+ve,row:ne+_e,shift:{col:ve,row:_e}}},[]),Y=E.useCallback((M,I)=>{var Me,lt;const ne=a(),K=ne.getLayout();let ee=K,ve=M,_e=I,Pe=!1;if(s.activeTool===Se.TILE_PAINT||s.activeTool===Se.WALL_PAINT){const Le=$(ee,M,I);Le&&(ee=Le.layout,ve=Le.col,_e=Le.row,Pe=!0,ne.rebuildFromLayout(ee,Le.shift))}const Ne=Pe?K:void 0;if(s.activeTool===Se.TILE_PAINT){const Le=di(ee,ve,_e,s.selectedTileType,s.floorColor);Le!==ee&&H(Le,Ne)}else if(s.activeTool===Se.WALL_PAINT){const Le=_e*ee.cols+ve,Ce=ee.tiles[Le]===qe.WALL;if(s.wallDragAdding===null&&(s.wallDragAdding=!Ce),s.wallDragAdding){const je=di(ee,ve,_e,qe.WALL,s.wallColor);je!==ee&&H(je,Ne)}else if(Ce){const je=di(ee,ve,_e,s.selectedTileType,s.floorColor);je!==ee&&H(je,Ne)}}else if(s.activeTool===Se.ERASE){if(M<0||M>=ee.cols||I<0||I>=ee.rows)return;const Le=I*ee.cols+M;if(ee.tiles[Le]===qe.VOID)return;const Ce=di(ee,M,I,qe.VOID);Ce!==ee&&H(Ce)}else if(s.activeTool===Se.FURNITURE_PLACE){const Le=s.selectedFurnitureType;if(Le===""){const Ce=ee.furniture.find(je=>{const _t=rt(je.type);return _t?M>=je.col&&M<je.col+_t.footprintW&&I>=je.row&&I<je.row+_t.footprintH:!1});s.selectedFurnitureUid=Ce?Ce.uid:null,m(je=>je+1)}else{const Ce=y0(Le,I);if(!ra(ee,Le,M,Ce))return;const _t={uid:`f-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:Le,col:M,row:Ce};s.pickedFurnitureColor&&(_t.color={...s.pickedFurnitureColor});const cn=HT(ee,_t);cn!==ee&&H(cn)}}else if(s.activeTool===Se.FURNITURE_PICK){const Le=ee.furniture.find(Ce=>{const je=rt(Ce.type);return je?M>=Ce.col&&M<Ce.col+je.footprintW&&I>=Ce.row&&I<Ce.row+je.footprintH:!1});Le&&(s.selectedFurnitureType=Le.type,s.pickedFurnitureColor=Le.color?{...Le.color}:null,s.activeTool=Se.FURNITURE_PLACE),m(Ce=>Ce+1)}else if(s.activeTool===Se.EYEDROPPER){const Le=I*ee.cols+M,Ce=ee.tiles[Le];if(Ce!==void 0&&Ce!==qe.WALL&&Ce!==qe.VOID){s.selectedTileType=Ce;const je=(Me=ee.tileColors)==null?void 0:Me[Le];je&&(s.floorColor={...je}),s.activeTool=Se.TILE_PAINT}else if(Ce===qe.WALL){const je=(lt=ee.tileColors)==null?void 0:lt[Le];je&&(s.wallColor={...je}),s.activeTool=Se.WALL_PAINT}m(je=>je+1)}else if(s.activeTool===Se.SELECT){const Le=ee.furniture.find(Ce=>{const je=rt(Ce.type);return je?M>=Ce.col&&M<Ce.col+je.footprintW&&I>=Ce.row&&I<Ce.row+je.footprintH:!1});s.selectedFurnitureUid=Le?Le.uid:null,m(Ce=>Ce+1)}},[a,s,H,$]),P=E.useCallback((M,I)=>{const K=a().getLayout();if(M<0||M>=K.cols||I<0||I>=K.rows)return;const ee=I*K.cols+M;if(K.tiles[ee]===qe.VOID)return;const ve=di(K,M,I,qe.VOID);ve!==K&&H(ve)},[a,H]);return{isEditMode:c,editorTick:d,isDirty:b,zoom:y,panRef:T,saveTimerRef:x,setLastSavedLayout:A,handleToggleEditMode:Z,handleToolChange:O,handleTileTypeChange:C,handleFloorColorChange:D,handleWallColorChange:Q,handleWallSetChange:fe,handleSelectedFurnitureColorChange:ie,handleFurnitureTypeChange:ue,handleDeleteSelected:ge,handleRotateSelected:Ee,handleToggleState:se,handleUndo:me,handleRedo:G,handleReset:le,handleSave:he,handleZoomChange:_,handleEditorTileAction:Y,handleEditorEraseAction:P,handleEditorSelectionChange:re,handleDragMove:q,syncDirtyState:W}}function V2(a,s,o,i,c,f,d,m,b){E.useEffect(()=>{if(!a)return;const p=y=>{var x;const v=(x=y.target)==null?void 0:x.tagName;if(!((v==="INPUT"||v==="TEXTAREA"||v==="SELECT")&&y.key!=="Escape"))if(y.key==="Escape"){if(s.activeTool===Se.FURNITURE_PICK)s.activeTool=Se.FURNITURE_PLACE,s.clearGhost();else if(s.activeTool===Se.FURNITURE_PLACE&&s.selectedFurnitureType!=="")s.selectedFurnitureType="",s.clearGhost();else if(s.activeTool!==Se.SELECT)s.activeTool=Se.SELECT,s.clearGhost();else if(s.selectedFurnitureUid)s.clearSelection();else{b();return}s.clearDrag(),m()}else y.key==="Delete"||y.key==="Backspace"?s.selectedFurnitureUid&&(y.preventDefault(),o()):(y.key==="r"||y.key==="R")&&!y.ctrlKey&&!y.metaKey&&!y.altKey?(y.preventDefault(),i()):(y.key==="t"||y.key==="T")&&!y.ctrlKey&&!y.metaKey&&!y.altKey?(y.preventDefault(),c()):y.key==="z"&&(y.ctrlKey||y.metaKey)&&!y.shiftKey?(y.preventDefault(),f()):(y.key==="y"&&(y.ctrlKey||y.metaKey)||y.key==="z"&&(y.ctrlKey||y.metaKey)&&y.shiftKey)&&(y.preventDefault(),d())};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[a,s,o,i,c,f,d,m,b])}const Q2="/pixel-engine";function W2(){const[a,s]=E.useState(null),o=E.useRef(null),i=E.useRef(null),c=E.useRef(!0),f=E.useCallback(async()=>{try{const v=await fetch("/api/office/layout");if(v.ok){const x=v.headers.get("ETag");x&&(o.current=x);const T=await v.json();if((T==null?void 0:T.version)===1&&c.current){s(ug(T));return}await d();return}v.status===404?await d():console.warn(`[LayoutPersistence] Server error ${v.status}, not falling back to default`)}catch{console.warn("[LayoutPersistence] Network error loading layout")}},[]),d=E.useCallback(async()=>{try{const v=await fetch(`${Q2}/default-layout.json`);if(v.ok){const x=await v.json();(x==null?void 0:x.version)===1&&c.current&&s(ug(x))}}catch{console.warn("[LayoutPersistence] Failed to load default layout")}},[]),m=E.useCallback(async v=>{try{const x={"Content-Type":"application/json"};o.current&&(x["If-Match"]=o.current);const T=await fetch("/api/office/layout",{method:"POST",headers:x,body:JSON.stringify(v)});if(T.ok){const w=T.headers.get("ETag");return w&&(o.current=w),!0}else T.status===409&&(console.warn("[LayoutPersistence] Conflict detected, reloading server layout"),await f())}catch{console.warn("[LayoutPersistence] Failed to save layout")}return!1},[f]),b=E.useCallback(v=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,m(v)},r0)},[m]),p=E.useCallback(async v=>(i.current&&(clearTimeout(i.current),i.current=null),m(v)),[m]),y=E.useCallback(()=>{f()},[f]);return E.useEffect(()=>(c.current=!0,f(),()=>{c.current=!1,i.current&&clearTimeout(i.current)}),[f]),{layout:a,saveLayout:b,saveLayoutImmediate:p,reloadLayout:y}}const K2=1e3,J2=3e4;function P2(a,s){const o=E.useRef(new Map),i=E.useRef(new Map),c=E.useRef(new Map),f=E.useRef(1),d=E.useRef(0),m=E.useRef(null),b=E.useRef(0),p=E.useRef(null),y=E.useCallback((T,w)=>{const A=o.current.get(T);if(A)return A.numericId;const L=f.current++,H={numericId:L,name:w};return o.current.set(T,H),i.current.set(L,T),L},[]),v=E.useCallback(T=>{var A;const w=i.current.get(T);return w?((A=o.current.get(w))==null?void 0:A.name)??null:null},[]),x=E.useCallback(T=>c.current.get(T)??null,[]);return E.useEffect(()=>{if(!a||!s)return;const T=a;function w(){m.current&&(m.current.close(),m.current=null);const L="/api/office/stream",H=new EventSource(L);m.current=H,H.addEventListener("snapshot",Z=>{try{const O=JSON.parse(Z.data);d.current=O.seq+1,b.current=0;const C=new Set;for(const D of O.bots){C.add(D.bot_id);const j=y(D.bot_id,D.name);if(!T.characters.has(j))T.addAgent(j,D.palette,D.hueShift,void 0,!0);else if(D.palette!==void 0||D.hueShift!==void 0){const Q=T.characters.get(j);Q&&(D.palette!==void 0&&Q.palette!==D.palette&&(Q.palette=D.palette),D.hueShift!==void 0&&Q.hueShift!==D.hueShift&&(Q.hueShift=D.hueShift))}D.displayName&&c.current.set(j,D.displayName),D.status==="active"?(T.setAgentActive(j,!0),D.tool&&T.setAgentTool(j,Gc(D.tool))):D.status==="waiting"?(T.setAgentActive(j,!1),T.showWaitingBubble(j)):D.status==="permission"?(T.setAgentActive(j,!0),T.showPermissionBubble(j)):T.setAgentActive(j,!1)}for(const[D,j]of i.current)!C.has(j)&&T.characters.has(D)&&(T.removeAllSubagents(D),T.removeAgent(D),c.current.delete(D))}catch(O){console.error("[OfficeStream] Error processing snapshot:",O)}}),H.addEventListener("state",Z=>{try{const O=JSON.parse(Z.data);if(O.seq>d.current){console.warn(`[OfficeStream] Seq gap: expected ${d.current}, got ${O.seq}. Reconnecting.`),A();return}if(d.current=O.seq+1,O.type==="bot_join"){const C=y(O.bot_id,O.name??O.bot_id);T.addAgent(C,O.palette,O.hueShift),O.displayName&&c.current.set(C,O.displayName)}else if(O.type==="bot_leave"){const C=o.current.get(O.bot_id);C&&(T.removeAllSubagents(C.numericId),T.removeAgent(C.numericId),c.current.delete(C.numericId))}else if(O.type==="status"){const C=o.current.get(O.bot_id);if(C){const D=C.numericId,j=O.status;j==="active"?(T.setAgentActive(D,!0),T.clearPermissionBubble(D)):j==="waiting"?(T.setAgentActive(D,!1),T.showWaitingBubble(D)):j==="permission"?T.showPermissionBubble(D):(T.setAgentActive(D,!1),T.setAgentTool(D,null),T.clearPermissionBubble(D))}}}catch(O){console.error("[OfficeStream] Error processing state event:",O)}}),H.addEventListener("tool",Z=>{var O;try{const C=JSON.parse(Z.data);if(C.seq>d.current){console.warn("[OfficeStream] Seq gap in tool event. Reconnecting."),A();return}d.current=C.seq+1;const D=o.current.get(C.bot_id);if(!D)return;const j=D.numericId;if(C.type==="tool_start"){const Q=C.tool?Gc(C.tool):null;if(T.setAgentTool(j,Q),T.setAgentActive(j,!0),T.clearPermissionBubble(j),(O=C.tool)!=null&&O.startsWith("Subtask:")&&C.tool_id){const fe=T.addSubagent(j,C.tool_id),we=T.characters.get(j),ie=T.characters.get(fe);we&&ie&&!we.isActive&&!ie.isActive&&T.scheduler.requestRealChat(j,fe)}}else C.type==="tool_done"||C.type==="tools_clear"&&(T.setAgentTool(j,null),T.removeAllSubagents(j),T.clearPermissionBubble(j))}catch(C){console.error("[OfficeStream] Error processing tool event:",C)}}),H.addEventListener("subagent",Z=>{try{const O=JSON.parse(Z.data);if(O.seq>d.current){A();return}d.current=O.seq+1;const C=o.current.get(O.bot_id);if(!C)return;const D=C.numericId;if(O.type==="tool_start"){const j=T.getSubagentId(D,O.parent_tool_id);if(j!==null){const Q=O.tool?Gc(O.tool):null;T.setAgentTool(j,Q),T.setAgentActive(j,!0)}}else O.type==="clear"&&T.removeSubagent(D,O.parent_tool_id)}catch(O){console.error("[OfficeStream] Error processing subagent event:",O)}}),H.addEventListener("heartbeat",Z=>{try{const O=JSON.parse(Z.data);d.current=O.seq+1,b.current=0}catch{}}),H.onerror=()=>{console.warn("[OfficeStream] Connection error. Scheduling reconnect."),A()}}function A(){if(m.current&&(m.current.close(),m.current=null),p.current)return;const L=b.current++,H=Math.min(K2*Math.pow(2,L),J2);console.log(`[OfficeStream] Reconnecting in ${H}ms (attempt ${L+1})`),p.current=setTimeout(()=>{p.current=null,w()},H)}return w(),()=>{m.current&&(m.current.close(),m.current=null),p.current&&(clearTimeout(p.current),p.current=null)}},[a,s,y]),{getBotNameByNumericId:v,getDisplayName:x}}const sa={padding:"4px 10px",fontSize:"22px",background:"var(--pixel-btn-bg)",color:"var(--pixel-text-dim)",border:"2px solid transparent",borderRadius:0,cursor:"pointer"},Sg={...sa,opacity:"var(--pixel-btn-disabled-opacity)",cursor:"default"};function eS({editor:a,editorState:s}){const[o,i]=E.useState(!1),c=s.undoStack.length===0,f=s.redoStack.length===0;return h.jsxs("div",{style:{position:"absolute",top:8,left:"50%",transform:"translateX(-50%)",zIndex:"var(--pixel-controls-z)",display:"flex",gap:4,alignItems:"center",background:"var(--pixel-bg)",border:"2px solid var(--pixel-border)",borderRadius:0,padding:"4px 8px",boxShadow:"var(--pixel-shadow)"},children:[h.jsx("button",{style:c?Sg:sa,onClick:c?void 0:a.handleUndo,title:"Undo (Ctrl+Z)",children:"Undo"}),h.jsx("button",{style:f?Sg:sa,onClick:f?void 0:a.handleRedo,title:"Redo (Ctrl+Y)",children:"Redo"}),h.jsx("button",{style:sa,onClick:a.handleSave,title:"Save layout",children:"Save"}),o?h.jsxs("div",{style:{display:"flex",gap:4,alignItems:"center"},children:[h.jsx("span",{style:{fontSize:"22px",color:"var(--pixel-reset-text)"},children:"Reset?"}),h.jsx("button",{style:{...sa,background:"var(--pixel-danger-bg)",color:"#fff"},onClick:()=>{i(!1),a.handleReset()},children:"Yes"}),h.jsx("button",{style:sa,onClick:()=>i(!1),children:"No"})]}):h.jsx("button",{style:sa,onClick:()=>i(!0),title:"Reset to last saved layout",children:"Reset"})]})}function S0({isActive:a,onSelectBot:s,onEditAvatar:o,readOnly:i}){const c=E.useRef(null),f=E.useRef(new R2),d=E.useRef(null),[m,b]=E.useState(!1),[p,y]=E.useState(!1),[v,x]=E.useState(!1),[T,w]=E.useState(null),{assetsReady:A}=q2(),{layout:L,saveLayout:H,saveLayoutImmediate:Z}=W2(),O=E.useCallback(()=>(c.current||(c.current=new mg),c.current),[]),C=Z2(O,f.current,H,Z);E.useEffect(()=>{!A||!L||(c.current?c.current.rebuildFromLayout(L):c.current=new mg(L),C.setLastSavedLayout(L),b(!0))},[A,L,C.setLastSavedLayout]);const{getBotNameByNumericId:D,getDisplayName:j}=P2(m?c.current:null,A),[Q,fe]=E.useState(0);V2(C.isEditMode,f.current,C.handleDeleteSelected,C.handleRotateSelected,C.handleToggleState,C.handleUndo,C.handleRedo,E.useCallback(()=>fe(re=>re+1),[]),C.handleToggleEditMode),E.useEffect(()=>{a||(KT(),Zg())},[a]);const we=E.useCallback(re=>{const W=c.current;if(W){const q=W.subagentMeta.get(re);if(q){const $=D(q.parentAgentId);$&&s&&s($);return}}const _=D(re);_&&w(q=>q&&q.id===re?null:{id:re,name:_})},[D,s]),ie=E.useRef(null);E.useEffect(()=>{if(!T)return;const re=q=>{q.key==="Escape"&&w(null)},W=q=>{ie.current&&!ie.current.contains(q.target)&&w(null)};window.addEventListener("keydown",re);const _=setTimeout(()=>window.addEventListener("mousedown",W),0);return()=>{clearTimeout(_),window.removeEventListener("keydown",re),window.removeEventListener("mousedown",W)}},[T]);const ue=E.useRef(C.zoom);E.useEffect(()=>{ue.current!==C.zoom&&w(null),ue.current=C.zoom},[C.zoom]);const ge=E.useCallback(()=>x(re=>!re),[]),Ee=E.useCallback(()=>y(!0),[]),se=E.useCallback(()=>y(!1),[]),me=E.useCallback(()=>{const re=c.current;if(!re)return;const W=re.getLayout(),_=new Blob([JSON.stringify(W,null,2)],{type:"application/json"}),q=URL.createObjectURL(_),$=document.createElement("a");$.href=q,$.download="office-layout.json",document.body.appendChild($),$.click(),document.body.removeChild($),URL.revokeObjectURL(q)},[]),G=E.useCallback(()=>{const re=document.createElement("input");re.type="file",re.accept=".json",re.onchange=()=>{var q;const W=(q=re.files)==null?void 0:q[0];if(!W)return;const _=new FileReader;_.onload=()=>{try{const $=JSON.parse(_.result);if(($==null?void 0:$.version)===1&&Array.isArray($.tiles)&&typeof $.cols=="number"&&typeof $.rows=="number"&&$.tiles.length===$.cols*$.rows){H($);const Y=c.current;Y&&Y.rebuildFromLayout($),C.setLastSavedLayout($),f.current.reset(),C.syncDirtyState()}else console.warn("[PixelOffice] Invalid layout file: missing or mismatched fields")}catch($){console.warn("[PixelOffice] Failed to parse layout file:",$)}},_.readAsText(W)},re.click()},[H]),le=c.current,he=C.isEditMode&&le&&(()=>{if(f.current.selectedFurnitureUid){const re=le.getLayout().furniture.find(W=>W.uid===f.current.selectedFurnitureUid);if(re&&Pc(re.type))return!0}return!!(f.current.activeTool===Se.FURNITURE_PLACE&&Pc(f.current.selectedFurnitureType))})();return!m||!le?h.jsx("div",{className:"pixel-engine",style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"#1E1E2E",color:"rgba(255, 255, 255, 0.5)",fontSize:"20px"},children:"Loading pixel office..."}):h.jsxs("div",{ref:d,className:"pixel-engine",style:{width:"100%",height:"100%",position:"relative",overflow:"hidden"},children:[h.jsx("style",{children:`
188
+ @keyframes pixel-agents-pulse {
189
+ 0%, 100% { opacity: 1; }
190
+ 50% { opacity: 0.3; }
191
+ }
192
+ .pixel-agents-pulse { animation: pixel-agents-pulse ${X1}s ease-in-out infinite; }
193
+ `}),h.jsx(S2,{officeState:le,onClick:we,isEditMode:C.isEditMode,editorState:f.current,onEditorTileAction:C.handleEditorTileAction,onEditorEraseAction:C.handleEditorEraseAction,onEditorSelectionChange:C.handleEditorSelectionChange,onDeleteSelected:C.handleDeleteSelected,onRotateSelected:C.handleRotateSelected,onDragMove:C.handleDragMove,editorTick:C.editorTick,zoom:C.zoom,onZoomChange:C.handleZoomChange,panRef:C.panRef,isActive:a}),T&&(()=>{var Pe;const re=le.characters.get(T.id);if(!re)return null;const W=(Pe=d.current)==null?void 0:Pe.querySelector("canvas");if(!W)return null;const _=window.devicePixelRatio||1,q=Math.round(W.clientWidth*_),$=Math.round(W.clientHeight*_),Y=le.getLayout(),P=Y.cols*xe*C.zoom,M=Y.rows*xe*C.zoom,I=Math.floor((q-P)/2)+Math.round(C.panRef.current.x),ne=Math.floor(($-M)/2)+Math.round(C.panRef.current.y),K=-32,ee=(I+re.x*C.zoom)/_,ve=(ne+(re.y+K)*C.zoom)/_,_e=j(T.id)??T.name;return h.jsxs("div",{ref:ie,style:{position:"absolute",left:ee,top:ve,transform:"translate(-50%, -100%)",zIndex:"var(--pixel-overlay-selected-z)",background:"var(--pixel-bg)",border:"2px solid var(--pixel-border)",borderRadius:0,boxShadow:"var(--pixel-shadow)",padding:"6px 8px",display:"flex",flexDirection:"column",alignItems:"center",gap:6,pointerEvents:"auto",whiteSpace:"nowrap"},children:[h.jsx("span",{style:{fontSize:"22px",color:"var(--pixel-text-dim)"},children:_e}),h.jsxs("div",{style:{display:"flex",gap:4},children:[h.jsx("button",{style:{padding:"3px 8px",fontSize:"20px",background:"var(--pixel-btn-bg)",color:"var(--pixel-text-dim)",border:"2px solid transparent",borderRadius:0,cursor:"pointer"},onClick:()=>{w(null),s==null||s(T.name)},children:"Sessions"}),h.jsx("button",{style:{padding:"3px 8px",fontSize:"20px",background:"var(--pixel-btn-bg)",color:"var(--pixel-text-dim)",border:"2px solid transparent",borderRadius:0,cursor:"pointer"},onClick:()=>{w(null),o==null||o(T.name)},children:"Avatar"})]})]})})(),!v&&h.jsx(_2,{zoom:C.zoom,onZoomChange:C.handleZoomChange}),h.jsx("div",{style:{position:"absolute",inset:0,background:"var(--pixel-vignette)",pointerEvents:"none",zIndex:40}}),!i&&h.jsx(ST,{isEditMode:C.isEditMode,onToggleEditMode:C.handleToggleEditMode,isDebugMode:v,onToggleDebugMode:ge,onOpenSettings:Ee}),!i&&C.isEditMode&&C.isDirty&&h.jsx(eS,{editor:C,editorState:f.current}),he&&h.jsx("div",{style:{position:"absolute",top:C.isDirty?52:8,left:"50%",transform:"translateX(-50%)",zIndex:49,background:"var(--pixel-hint-bg)",color:"#fff",fontSize:"20px",padding:"3px 8px",borderRadius:0,border:"2px solid var(--pixel-accent)",boxShadow:"var(--pixel-shadow)",pointerEvents:"none",whiteSpace:"nowrap"},children:"Rotate (R)"}),!i&&C.isEditMode&&(()=>{var _;const re=f.current.selectedFurnitureUid,W=re?((_=le.getLayout().furniture.find(q=>q.uid===re))==null?void 0:_.color)??null:null;return h.jsx(O2,{activeTool:f.current.activeTool,selectedTileType:f.current.selectedTileType,selectedFurnitureType:f.current.selectedFurnitureType,selectedFurnitureUid:re,selectedFurnitureColor:W,floorColor:f.current.floorColor,wallColor:f.current.wallColor,selectedWallSet:f.current.selectedWallSet,onToolChange:C.handleToolChange,onTileTypeChange:C.handleTileTypeChange,onFloorColorChange:C.handleFloorColorChange,onWallColorChange:C.handleWallColorChange,onWallSetChange:C.handleWallSetChange,onSelectedFurnitureColorChange:C.handleSelectedFurnitureColorChange,onFurnitureTypeChange:C.handleFurnitureTypeChange})})(),!v&&h.jsx(A2,{officeState:le,agents:[...le.characters.keys()].filter(re=>re>0),agentTools:{},subagentCharacters:[],containerRef:d,zoom:C.zoom,panRef:C.panRef}),v&&h.jsx(AT,{agents:[...le.characters.keys()].filter(re=>re>0),selectedAgent:le.selectedAgentId,agentTools:{},agentStatuses:{},subagentTools:{},onSelectAgent:we}),!i&&h.jsx(E2,{isOpen:p,onClose:se,isDebugMode:v,onToggleDebugMode:ge,onExportLayout:me,onImportLayout:G})]})}const Eg=["Sessions","Schedule","Webhooks","Settings"],wg=["Office","Fleet","Network","Auth"],Ag={Sessions:"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z",Schedule:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z",Webhooks:"M13 10V3L4 14h7v7l9-11h-7z",Settings:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.066 2.573c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.573 1.066c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.066-2.573c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z M15 12a3 3 0 11-6 0 3 3 0 016 0z",Fleet:"M4 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2V6zM14 6a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2V6zM4 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2H6a2 2 0 01-2-2v-2zM14 16a2 2 0 012-2h2a2 2 0 012 2v2a2 2 0 01-2 2h-2a2 2 0 01-2-2v-2z",Office:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6",Network:"M13.828 10.172a4 4 0 00-5.656 0l-4 4a4 4 0 105.656 5.656l1.102-1.101m-.758-4.899a4 4 0 005.656 0l4-4a4 4 0 00-5.656-5.656l-1.1 1.1",Auth:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"};function tS(){const[a,s]=E.useState(()=>document.documentElement.classList.contains("dark"));return E.useEffect(()=>{a?(document.documentElement.classList.add("dark"),localStorage.setItem("theme","dark")):(document.documentElement.classList.remove("dark"),localStorage.setItem("theme","light"))},[a]),h.jsx("button",{onClick:()=>s(!a),className:"p-2 rounded-md text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-accent transition-colors",title:a?"Switch to light mode":"Switch to dark mode",children:a?h.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z"})}):h.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.752 15.002A9.718 9.718 0 0118 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 003 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 009.002-5.998z"})})})}function nS(){const{isFleet:a,selectedBot:s,selectBot:o,bots:i}=nf(),[c,f]=E.useState("Sessions");if(E.useEffect(()=>{a&&(s?wg.includes(c)&&f("Sessions"):Eg.includes(c)&&f("Office"))},[a,s]),E.useEffect(()=>{ex(a?s:null)},[a,s]),a===null)return h.jsx("div",{className:"h-screen flex items-center justify-center bg-background",children:h.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading..."})});const d=a?s:!0;function m(){o(null),f("Office")}const b=s?i.find(p=>p.name===s):null;return h.jsxs("div",{className:"h-screen flex overflow-hidden",children:[h.jsxs("aside",{className:"w-14 shrink-0 bg-sidebar border-r border-sidebar-border flex flex-col items-center py-3 gap-1",children:[a&&s?h.jsx("button",{onClick:m,className:"w-8 h-8 rounded-lg bg-secondary flex items-center justify-center text-secondary-foreground hover:bg-secondary/80 transition-colors mb-4",title:"Back to fleet",children:h.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19l-7-7 7-7"})})}):h.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary flex items-center justify-center text-primary-foreground mb-4",children:h.jsx(ox,{className:"w-4 h-4"})}),h.jsxs("nav",{className:"flex flex-col gap-1 flex-1",children:[a&&!s&&wg.map(p=>h.jsx("button",{onClick:()=>f(p),className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${c===p?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-accent"}`,title:p,children:h.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:Ag[p]})})},p)),d&&Eg.map(p=>h.jsx("button",{onClick:()=>f(p),className:`w-10 h-10 rounded-lg flex items-center justify-center transition-colors ${c===p?"bg-sidebar-accent text-sidebar-accent-foreground":"text-sidebar-muted hover:text-sidebar-foreground hover:bg-sidebar-accent"}`,title:p,children:h.jsx("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:h.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:Ag[p]})})},p))]}),h.jsx(tS,{}),h.jsxs("span",{className:"text-[10px] text-sidebar-muted select-none",title:"Mecha v0.3.1",children:["v","0.3.1"]})]}),h.jsxs("div",{className:"flex-1 min-w-0 min-h-0 flex flex-col overflow-hidden bg-background",children:[a&&s&&h.jsxs("div",{className:"shrink-0 px-4 py-2 border-b border-border bg-card flex items-center gap-3",children:[h.jsx("span",{className:`w-2 h-2 rounded-full ${(b==null?void 0:b.status)==="running"?"bg-green-500":"bg-muted-foreground"}`}),h.jsx("span",{className:"text-sm font-medium text-foreground",children:s}),b&&h.jsxs("span",{className:"text-xs text-muted-foreground",children:[b.model," | ",b.status]})]}),h.jsxs("main",{className:"flex-1 min-w-0 min-h-0 overflow-hidden",children:[c==="Fleet"&&h.jsx(gT,{}),c==="Network"&&h.jsx(yT,{}),c==="Auth"&&h.jsx(xT,{}),a&&!s&&h.jsx("div",{style:{display:c==="Office"?"block":"none",width:"100%",height:"100%"},children:h.jsx(S0,{isActive:c==="Office",onSelectBot:p=>{o(p),f("Sessions")},onEditAvatar:p=>{o(p),f("Settings")}})}),c==="Sessions"&&d&&h.jsx(Gv,{}),c==="Schedule"&&d&&h.jsx(Xv,{}),c==="Webhooks"&&d&&h.jsx(pT,{}),c==="Settings"&&d&&h.jsx(hT,{})]})]})]})}const lS=window.location.pathname==="/office"||window.location.pathname==="/office/";qb.createRoot(document.getElementById("root")).render(h.jsx(zb.StrictMode,{children:lS?h.jsx("div",{style:{width:"100vw",height:"100vh",overflow:"hidden",background:"#111"},children:h.jsx(S0,{isActive:!0,readOnly:!0})}):h.jsx(Pb,{children:h.jsx(Xb,{children:h.jsx(nS,{})})})}));