@xopcai/xopc 0.0.188 → 0.0.190

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 (490) hide show
  1. package/README.md +1 -4
  2. package/README.zh-CN.md +0 -3
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store--QoUGhiS.js → activity-store-DstnJCS5.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0yweLNQ.js → agent-avatar-dicebear-9vAbkroX.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-D1t4SfMQ.js +68 -0
  8. package/dist/gateway/static/root/assets/{api-5laWqfiE.js → api-BTL9kayv.js} +1 -1
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-BXJ8Jiv_.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-DG9n9D1M.js → appearance-settings-Bxs8Fpaj.js} +1 -1
  11. package/dist/gateway/static/root/assets/apps-page-Cgrgu5OW.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-Ceh5qrZf.js → archive-plugin-Ch2RmLCC.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-jFW7uYf7.js → attachment-load-BhMQM_Ky.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-page-CtJxstKh.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-XDlkI1r4.js → binary-plugins-D6CqlymH.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-kyKc2IhE.js → block-editor-ClL6HEg9.js} +56 -56
  17. package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-BJa5Iz_v.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-CTQQOsn5.js → browser-workflows-page-zgLibuMH.js} +2 -2
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-CHUrT9EB.js +7 -0
  21. package/dist/gateway/static/root/assets/capability-presets-api-BB8t4Ja7.js +1 -0
  22. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Cycrv0YV.js +1 -0
  23. package/dist/gateway/static/root/assets/{channel-recipient-api-BgIkWq01.js → channel-recipient-api-BThDGiO3.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-settings-V96gPUAU.js +1 -0
  25. package/dist/gateway/static/root/assets/channels-status-swr-Cz7SAAkm.js +1 -0
  26. package/dist/gateway/static/root/assets/connectors-api-DS9ED-EL.js +1 -0
  27. package/dist/gateway/static/root/assets/connectors-page-BhlyQoQI.js +2 -0
  28. package/dist/gateway/static/root/assets/cron-expression-CkgsvhtW.js +2 -0
  29. package/dist/gateway/static/root/assets/{desktop-pet-CSwd00CV.js → desktop-pet-Cv8rGhYW.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CuNQvHGu.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-ct0n5Rje.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-BeRBuMUU.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-DbK-Cwao.js → extension-page-CV36ILRG.js} +1 -1
  34. package/dist/gateway/static/root/assets/extension-settings-page-IyQrSILY.js +1 -0
  35. package/dist/gateway/static/root/assets/{gateway-config-api-CC7EvEFp.js → gateway-config-api-D4_r5iJM.js} +1 -1
  36. package/dist/gateway/static/root/assets/gateway-settings-CYlntpBH.js +1 -0
  37. package/dist/gateway/static/root/assets/{gateway-startup-retry-B2DmdlwO.js → gateway-startup-retry-EO9mKvzE.js} +1 -1
  38. package/dist/gateway/static/root/assets/heartbeat-settings-D4SyWob8.js +1 -0
  39. package/dist/gateway/static/root/assets/home-page-B2Kagoh8.js +3 -0
  40. package/dist/gateway/static/root/assets/{image-generation-api-GMTaS6eI.js → image-generation-api-Bu7PyVSh.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-CYT5DOzr.js +150 -0
  42. package/dist/gateway/static/root/assets/index-D6e3tPL-.css +1 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DhGYddbI.js → keyboard-shortcuts-settings-BMhCuVBZ.js} +1 -1
  44. package/dist/gateway/static/root/assets/local-app-workbench-page-BHYbFjqy.js +2 -0
  45. package/dist/gateway/static/root/assets/{local-apps-page-CmnrBmWi.js → local-apps-page-ijIe7_y2.js} +1 -1
  46. package/dist/gateway/static/root/assets/locale-store-deR2zRaE.js +1 -0
  47. package/dist/gateway/static/root/assets/logs-page-IIn8Tess.js +2 -0
  48. package/dist/gateway/static/root/assets/management-settings--V_fovKD.js +1 -0
  49. package/dist/gateway/static/root/assets/{markdown-split-CZaBPOVn.js → markdown-split-Dt9-in6W.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-CiKvSgCv.js → media-plugins-B3pj_iO0.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-B4XqB8I6.js +3 -0
  52. package/dist/gateway/static/root/assets/{notes-page-Bisbzqlz.js → notes-page-DZ366lIT.js} +1 -1
  53. package/dist/gateway/static/root/assets/notes-workbench-S2sBVOLw.js +4 -0
  54. package/dist/gateway/static/root/assets/{page-tabs-BxlwhAbH.js → page-tabs-C5ge434C.js} +1 -1
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-RM8wXxfT.js → preview-open-alternatives-BFa9DgSV.js} +1 -1
  56. package/dist/gateway/static/root/assets/product-delivery-tRr-7IxY.js +1 -0
  57. package/dist/gateway/static/root/assets/{product-open-page-DdBlibek.js → product-open-page-Dc9CcWdu.js} +1 -1
  58. package/dist/gateway/static/root/assets/project-detail-page-BilzoCJ7.js +1 -0
  59. package/dist/gateway/static/root/assets/projects-page-BoQUyacP.js +1 -0
  60. package/dist/gateway/static/root/assets/remote-access-hub-DUyUaCRF.js +1 -0
  61. package/dist/gateway/static/root/assets/{schema-form-BDKbpmXv.js → schema-form-B84DckWe.js} +1 -1
  62. package/dist/gateway/static/root/assets/{schemas-C6onAggk.js → schemas-zIBW3wiV.js} +1 -1
  63. package/dist/gateway/static/root/assets/sessions-page-Dzxlq1F0.js +1 -0
  64. package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.js +1 -0
  65. package/dist/gateway/static/root/assets/settings-form-section-Dp9itvdy.js +1 -0
  66. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DgIp8_S6.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
  67. package/dist/gateway/static/root/assets/settings-page-DQmMKf8r.js +1 -0
  68. package/dist/gateway/static/root/assets/{settings-page-layout-97LmwrzC.js → settings-page-layout-EQIOJa_L.js} +1 -1
  69. package/dist/gateway/static/root/assets/setup-status-panel-Cwi-SPja.js +1 -0
  70. package/dist/gateway/static/root/assets/{share-preview-page-BH7i3g1S.js → share-preview-page-C4_B2jvf.js} +1 -1
  71. package/dist/gateway/static/root/assets/shares-settings-CkyuGlZK.js +1 -0
  72. package/dist/gateway/static/root/assets/skill-reload-api-BJCePQK5.js +1 -0
  73. package/dist/gateway/static/root/assets/skills-page-BYWLfmJi.js +2 -0
  74. package/dist/gateway/static/root/assets/{skills-page.utils-s-a5WV9j.js → skills-page.utils-Jhm24i4h.js} +1 -1
  75. package/dist/gateway/static/root/assets/{system-settings-panel-BxjeMT5k.js → system-settings-panel-Dpx2ags2.js} +1 -1
  76. package/dist/gateway/static/root/assets/{task-detail-page-BahycnfW.js → task-detail-page-DLAdxI6e.js} +1 -1
  77. package/dist/gateway/static/root/assets/{theme-store-BRxdsmic.js → theme-store-DnBOcGXi.js} +1 -1
  78. package/dist/gateway/static/root/assets/{typed-models-lib-39MjwPSq.js → typed-models-lib-DULmTHUB.js} +1 -1
  79. package/dist/gateway/static/root/assets/use-autosave-BrjVk5VH.js +1 -0
  80. package/dist/gateway/static/root/assets/user-context-page-9AAFpGAL.js +1 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-XU-7sBSg.js → voice-api-key-field-BISTPfq_.js} +1 -1
  82. package/dist/gateway/static/root/assets/{work-discovery-overlay-CJqu8UHq.js → work-discovery-overlay-Wr-uF7VA.js} +1 -1
  83. package/dist/gateway/static/root/assets/work-discovery-page-BWds95sL.js +1 -0
  84. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DXtg8Qxl.js → workflow-run-setup-panel-DHqHP8_6.js} +2 -2
  85. package/dist/gateway/static/root/assets/workflows-page-0b4_DFHr.js +11 -0
  86. package/dist/gateway/static/root/index.html +9 -9
  87. package/dist/package.js +1 -1
  88. package/dist/packages/endpoint-tools-protocol/src/index.js +184 -0
  89. package/dist/packages/gateway-contract/src/tool-activity.js +0 -36
  90. package/dist/packages/realtime-client/src/index.js +256 -0
  91. package/dist/packages/realtime-protocol/src/index.js +88 -0
  92. package/dist/src/agent/agent-manager.d.ts +1 -1
  93. package/dist/src/agent/agent-manager.js +7 -13
  94. package/dist/src/agent/background-review/coordinator.js +1 -1
  95. package/dist/src/agent/background-review/prompts.d.ts +1 -1
  96. package/dist/src/agent/background-review/prompts.js +3 -1
  97. package/dist/src/agent/background-review/run-background-review.d.ts +2 -0
  98. package/dist/src/agent/background-review/run-background-review.js +10 -9
  99. package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +0 -1
  100. package/dist/src/agent/bootstrap/bootstrap-cache.js +3 -4
  101. package/dist/src/agent/bootstrap/bootstrap-files.d.ts +0 -4
  102. package/dist/src/agent/bootstrap/bootstrap-files.js +3 -4
  103. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -4
  104. package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +0 -1
  105. package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -14
  106. package/dist/src/agent/bootstrap/types.d.ts +1 -1
  107. package/dist/src/agent/client-error-format.d.ts +1 -1
  108. package/dist/src/agent/client-error-format.js +1 -1
  109. package/dist/src/agent/context/workspace-templates/SOUL.md +1 -1
  110. package/dist/src/agent/external-tools/endpoint-provider.d.ts +17 -0
  111. package/dist/src/agent/external-tools/endpoint-provider.js +93 -0
  112. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  113. package/dist/src/agent/external-tools/index.d.ts +4 -5
  114. package/dist/src/agent/external-tools/index.js +8 -2
  115. package/dist/src/agent/external-tools/types.d.ts +8 -1
  116. package/dist/src/agent/external-tools/types.js +2 -1
  117. package/dist/src/agent/inbound/inbound-loop.js +4 -0
  118. package/dist/src/agent/inbound/turn-dispatcher.d.ts +9 -8
  119. package/dist/src/agent/inbound/turn-dispatcher.js +13 -11
  120. package/dist/src/agent/memory/builtin-provider.d.ts +2 -4
  121. package/dist/src/agent/memory/builtin-provider.js +35 -15
  122. package/dist/src/agent/memory/context/types.d.ts +3 -1
  123. package/dist/src/agent/memory/create-memory-manager.js +2 -0
  124. package/dist/src/agent/memory/index.d.ts +1 -1
  125. package/dist/src/agent/memory/index.js +1 -1
  126. package/dist/src/agent/memory/manager.d.ts +9 -1
  127. package/dist/src/agent/memory/manager.js +39 -9
  128. package/dist/src/agent/memory/memory-config.d.ts +1 -1
  129. package/dist/src/agent/memory/memory-config.js +1 -1
  130. package/dist/src/agent/memory/source-origin.js +0 -2
  131. package/dist/src/agent/memory/types.d.ts +5 -1
  132. package/dist/src/agent/memory/understanding/service.d.ts +10 -10
  133. package/dist/src/agent/memory/understanding/service.js +108 -176
  134. package/dist/src/agent/memory/understanding/types.d.ts +7 -8
  135. package/dist/src/agent/memory/user-context-coordinator.d.ts +2 -1
  136. package/dist/src/agent/memory/user-context-coordinator.js +27 -41
  137. package/dist/src/agent/messaging/command-handler.d.ts +2 -2
  138. package/dist/src/agent/messaging/command-handler.js +3 -3
  139. package/dist/src/agent/orchestration/agent-orchestrator.js +4 -7
  140. package/dist/src/agent/prompt/sections/memory-skills.js +4 -4
  141. package/dist/src/agent/prompt/sections/tooling.js +0 -10
  142. package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
  143. package/dist/src/agent/prompt/service-prompt-builder.js +4 -33
  144. package/dist/src/agent/prompt/system-prompt.js +1 -2
  145. package/dist/src/agent/service/async-queue.d.ts +1 -1
  146. package/dist/src/agent/service/async-queue.js +1 -1
  147. package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -1
  148. package/dist/src/agent/service/direct-turn-helpers.js +2 -2
  149. package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -1
  150. package/dist/src/agent/service/process-direct-one-shot.js +1 -1
  151. package/dist/src/agent/service/process-direct-streaming.d.ts +7 -5
  152. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  153. package/dist/src/agent/service.d.ts +2 -3
  154. package/dist/src/agent/service.js +10 -21
  155. package/dist/src/agent/service.types.d.ts +2 -0
  156. package/dist/src/agent/session/index.d.ts +1 -1
  157. package/dist/src/agent/session/session-context.d.ts +2 -0
  158. package/dist/src/agent/session/session-context.js +4 -0
  159. package/dist/src/agent/session/session-state-bag.d.ts +4 -4
  160. package/dist/src/agent/session/session-state-bag.js +1 -1
  161. package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +1 -1
  162. package/dist/src/agent/streaming/reasoning-visibility.d.ts +6 -0
  163. package/dist/src/agent/streaming/{reasoning-visibility-sse.js → reasoning-visibility.js} +3 -6
  164. package/dist/src/agent/tools/dreaming-tool.d.ts +0 -2
  165. package/dist/src/agent/tools/dreaming-tool.js +13 -38
  166. package/dist/src/agent/tools/factory.d.ts +4 -3
  167. package/dist/src/agent/tools/factory.js +2 -10
  168. package/dist/src/agent/tools/index.d.ts +0 -1
  169. package/dist/src/agent/tools/index.js +1 -2
  170. package/dist/src/agent/tools/memory-tool.js +1 -1
  171. package/dist/src/agent/workspace-runtime/registry.d.ts +3 -5
  172. package/dist/src/agent/workspace-runtime/registry.js +2 -15
  173. package/dist/src/agent-manifest/schema.d.ts +17 -17
  174. package/dist/src/agent-runtime/index.js +1 -1
  175. package/dist/src/agent-runtime/memory-runtime.d.ts +2 -2
  176. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  177. package/dist/src/automations/domain/types.d.ts +2 -1
  178. package/dist/src/automations/domain/validation.d.ts +29 -29
  179. package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
  180. package/dist/src/automations/service/action-executor.js +4 -1
  181. package/dist/src/channels/pairing/pairing-challenge.d.ts +1 -1
  182. package/dist/src/channels/pairing/pairing-challenge.js +1 -1
  183. package/dist/src/chat-commands/builtins/understanding.js +2 -5
  184. package/dist/src/cli/commands/agent/stream-renderer.js +4 -1
  185. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  186. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  187. package/dist/src/cli/commands/init.js +3 -22
  188. package/dist/src/cli/templates.js +1 -1
  189. package/dist/src/config/index.js +3 -3
  190. package/dist/src/config/paths.d.ts +0 -5
  191. package/dist/src/config/paths.js +2 -11
  192. package/dist/src/config/rules.js +0 -5
  193. package/dist/src/config/schema.d.ts +27 -122
  194. package/dist/src/config/schema.js +9 -42
  195. package/dist/src/config/web-patch.js +0 -1
  196. package/dist/src/connectors/learning-coordinator.js +75 -3
  197. package/dist/src/endpoint-tools/auth.d.ts +20 -0
  198. package/dist/src/endpoint-tools/auth.js +51 -0
  199. package/dist/src/endpoint-tools/index.d.ts +5 -0
  200. package/dist/src/endpoint-tools/index.js +6 -0
  201. package/dist/src/endpoint-tools/invocation-service.d.ts +68 -0
  202. package/dist/src/endpoint-tools/invocation-service.js +190 -0
  203. package/dist/src/endpoint-tools/policy.d.ts +10 -0
  204. package/dist/src/endpoint-tools/policy.js +18 -0
  205. package/dist/src/endpoint-tools/registry.d.ts +45 -0
  206. package/dist/src/endpoint-tools/registry.js +121 -0
  207. package/dist/src/endpoint-tools/runtime.d.ts +23 -0
  208. package/dist/src/endpoint-tools/runtime.js +86 -0
  209. package/dist/src/endpoint-tools/upload-service.d.ts +41 -0
  210. package/dist/src/endpoint-tools/upload-service.js +103 -0
  211. package/dist/src/extensions/types/hooks.d.ts +1 -1
  212. package/dist/src/extensions/update.js +1 -1
  213. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  214. package/dist/src/gateway/agent-builtin-tools.js +0 -5
  215. package/dist/src/gateway/agents-admin.d.ts +0 -7
  216. package/dist/src/gateway/agents-admin.js +3 -32
  217. package/dist/src/gateway/chat-stream/protocol.d.ts +0 -1
  218. package/dist/src/gateway/clarify-bridge.d.ts +5 -4
  219. package/dist/src/gateway/clarify-bridge.js +3 -4
  220. package/dist/src/gateway/dreaming-automation-reconciler.d.ts +3 -3
  221. package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
  222. package/dist/src/gateway/heartbeat/service.js +4 -1
  223. package/dist/src/gateway/hono/app.js +1 -5
  224. package/dist/src/gateway/hono/index.d.ts +0 -1
  225. package/dist/src/gateway/hono/index.js +1 -2
  226. package/dist/src/gateway/hono/lib/config-payload.d.ts +20 -9
  227. package/dist/src/gateway/hono/lib/config-payload.js +3 -2
  228. package/dist/src/gateway/hono/middleware/auth.js +3 -5
  229. package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
  230. package/dist/src/gateway/hono/oauth-async.js +17 -2
  231. package/dist/src/gateway/hono/routes/agent-stream.js +49 -6
  232. package/dist/src/gateway/hono/routes/agents.js +1 -33
  233. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  234. package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
  235. package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -19
  236. package/dist/src/gateway/hono/routes/config-patch/misc.js +17 -1
  237. package/dist/src/gateway/hono/routes/connectors.js +13 -12
  238. package/dist/src/gateway/hono/routes/deps.d.ts +0 -2
  239. package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +3 -0
  240. package/dist/src/gateway/hono/routes/endpoint-tools.js +196 -0
  241. package/dist/src/gateway/hono/routes/index.js +6 -2
  242. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
  243. package/dist/src/gateway/hono/routes/logs.js +0 -4
  244. package/dist/src/gateway/hono/routes/public-gateway.js +2 -2
  245. package/dist/src/gateway/hono/routes/realtime.d.ts +3 -0
  246. package/dist/src/gateway/hono/routes/realtime.js +35 -0
  247. package/dist/src/gateway/hono/routes/status.js +0 -7
  248. package/dist/src/gateway/hono/routes/understanding-sources.d.ts +3 -0
  249. package/dist/src/gateway/hono/routes/understanding-sources.js +203 -0
  250. package/dist/src/gateway/hono/routes/work-discovery.d.ts +2 -0
  251. package/dist/src/gateway/hono/routes/work-discovery.js +3 -134
  252. package/dist/src/gateway/hono/routes/workflows.js +1 -1
  253. package/dist/src/gateway/hono/routes/you.d.ts +0 -31
  254. package/dist/src/gateway/hono/routes/you.js +230 -1161
  255. package/dist/src/gateway/index.d.ts +1 -1
  256. package/dist/src/gateway/index.js +1 -2
  257. package/dist/src/gateway/protocol.d.ts +1 -7
  258. package/dist/src/gateway/security/index.js +1 -1
  259. package/dist/src/gateway/security/operator-scopes.js +1 -1
  260. package/dist/src/gateway/server.js +4 -4
  261. package/dist/src/gateway/service/agent-runner.d.ts +11 -9
  262. package/dist/src/gateway/service/agent-runner.js +18 -18
  263. package/dist/src/gateway/service/config-coordinator.d.ts +3 -3
  264. package/dist/src/gateway/service/run-gateway-agent.d.ts +4 -3
  265. package/dist/src/gateway/service/run-gateway-agent.js +15 -17
  266. package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
  267. package/dist/src/gateway/service/session-input-coordinator.js +4 -2
  268. package/dist/src/gateway/service/types.d.ts +0 -5
  269. package/dist/src/gateway/service.d.ts +7 -6
  270. package/dist/src/gateway/service.js +43 -26
  271. package/dist/src/infra/update-runner.js +1 -1
  272. package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
  273. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +2 -4
  274. package/dist/src/knowledge/connected-understanding-pipeline.js +31 -81
  275. package/dist/src/knowledge/index.js +2 -2
  276. package/dist/src/knowledge/people-graph.d.ts +22 -25
  277. package/dist/src/knowledge/people-graph.js +76 -43
  278. package/dist/src/mcp/channel-bridge.d.ts +6 -9
  279. package/dist/src/mcp/channel-bridge.js +48 -76
  280. package/dist/src/mcp/channel-server.js +2 -6
  281. package/dist/src/proactive/execution/context.js +8 -13
  282. package/dist/src/realtime/broker.d.ts +31 -0
  283. package/dist/src/realtime/broker.js +114 -0
  284. package/dist/src/realtime/runtime.d.ts +20 -0
  285. package/dist/src/realtime/runtime.js +263 -0
  286. package/dist/src/realtime/tickets.d.ts +15 -0
  287. package/dist/src/realtime/tickets.js +38 -0
  288. package/dist/src/realtime/writer.d.ts +15 -0
  289. package/dist/src/realtime/writer.js +78 -0
  290. package/dist/src/share/share-config.js +0 -1
  291. package/dist/src/share/site-share-config.js +0 -1
  292. package/dist/src/storage/sqlite/connector-account-repository.js +0 -1
  293. package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +37 -0
  294. package/dist/src/storage/sqlite/context-consolidation-repository.js +64 -0
  295. package/dist/src/storage/sqlite/endpoint-principal-repository.d.ts +17 -0
  296. package/dist/src/storage/sqlite/endpoint-principal-repository.js +54 -0
  297. package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +25 -0
  298. package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +42 -0
  299. package/dist/src/storage/sqlite/fts.d.ts +2 -0
  300. package/dist/src/storage/sqlite/fts.js +29 -1
  301. package/dist/src/storage/sqlite/index.d.ts +6 -6
  302. package/dist/src/storage/sqlite/index.js +7 -7
  303. package/dist/src/storage/sqlite/knowledge-repository.d.ts +9 -2
  304. package/dist/src/storage/sqlite/knowledge-repository.js +58 -10
  305. package/dist/src/storage/sqlite/memory-records-repository.d.ts +7 -56
  306. package/dist/src/storage/sqlite/memory-records-repository.js +68 -218
  307. package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +14 -0
  308. package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +43 -0
  309. package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +18 -0
  310. package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +8 -0
  311. package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +54 -0
  312. package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +193 -0
  313. package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +6 -0
  314. package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +38 -0
  315. package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +110 -0
  316. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  317. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  318. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  319. package/dist/src/storage/sqlite/schema.js +1 -1
  320. package/dist/src/storage/sqlite/schema.sql +0 -20
  321. package/dist/src/storage/sqlite/session-input-repository.d.ts +3 -0
  322. package/dist/src/storage/sqlite/session-input-repository.js +5 -3
  323. package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +34 -0
  324. package/dist/src/storage/sqlite/user-context-quality-repository.js +74 -0
  325. package/dist/src/storage/sqlite/user-context-repository.d.ts +64 -0
  326. package/dist/src/storage/sqlite/user-context-repository.js +383 -0
  327. package/dist/src/tasks/home-query-service.d.ts +1 -1
  328. package/dist/src/tui/backends/embedded-backend.js +5 -2
  329. package/dist/src/tui/backends/{gateway-sse-backend.d.ts → gateway-realtime-backend.d.ts} +13 -10
  330. package/dist/src/tui/backends/{gateway-sse-backend.js → gateway-realtime-backend.js} +114 -151
  331. package/dist/src/tui/tool-summary.js +1 -7
  332. package/dist/src/tui/tui-agent-events.d.ts +0 -1
  333. package/dist/src/tui/tui-agent-events.js +2 -15
  334. package/dist/src/tui/tui-backend.d.ts +4 -4
  335. package/dist/src/tui/tui-run-state.js +0 -4
  336. package/dist/src/tui/tui-startup-resources.js +1 -2
  337. package/dist/src/tui/tui-types.d.ts +2 -9
  338. package/dist/src/tui/tui-types.js +0 -1
  339. package/dist/src/tui/tui.js +5 -5
  340. package/dist/src/tunnel/gateway-lifecycle.d.ts +1 -1
  341. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  342. package/dist/src/user-context/config.d.ts +17 -210
  343. package/dist/src/user-context/config.js +19 -85
  344. package/dist/src/user-context/consolidation.d.ts +26 -0
  345. package/dist/src/user-context/consolidation.js +115 -0
  346. package/dist/src/user-context/domain.d.ts +75 -0
  347. package/dist/src/user-context/domain.js +4 -0
  348. package/dist/src/user-context/manual-understanding.d.ts +7 -14
  349. package/dist/src/user-context/manual-understanding.js +19 -49
  350. package/dist/src/{agent/memory/context → user-context}/planner.d.ts +5 -6
  351. package/dist/src/user-context/planner.js +311 -0
  352. package/dist/src/user-context/relationship-continuity.d.ts +3 -6
  353. package/dist/src/user-context/relationship-continuity.js +39 -32
  354. package/dist/src/user-context/sources/catalog.d.ts +2 -0
  355. package/dist/src/user-context/sources/catalog.js +149 -0
  356. package/dist/src/user-context/sources/index.d.ts +3 -0
  357. package/dist/src/user-context/sources/index.js +3 -0
  358. package/dist/src/user-context/sources/repository.d.ts +40 -0
  359. package/dist/src/user-context/sources/repository.js +164 -0
  360. package/dist/src/user-context/sources/types.d.ts +83 -0
  361. package/dist/src/user-context/understandingQuality.d.ts +5 -0
  362. package/dist/src/user-context/understandingQuality.js +44 -0
  363. package/dist/src/utils/logger/log-stream.d.ts +3 -10
  364. package/dist/src/utils/logger/log-stream.js +2 -73
  365. package/dist/src/utils/logger/pino-record.d.ts +1 -1
  366. package/dist/src/utils/logger/streams.js +1 -1
  367. package/dist/src/work-discovery/analyzer.d.ts +4 -3
  368. package/dist/src/work-discovery/analyzer.js +21 -16
  369. package/dist/src/work-discovery/incremental-repository.js +42 -40
  370. package/dist/src/work-discovery/index.js +3 -3
  371. package/dist/src/work-discovery/service.d.ts +7 -7
  372. package/dist/src/work-discovery/service.js +241 -190
  373. package/dist/src/work-discovery/source-repository.js +42 -53
  374. package/dist/src/work-discovery/types.d.ts +2 -14
  375. package/package.json +5 -7
  376. package/dist/gateway/static/root/assets/agents-C6OV-gMm.js +0 -2
  377. package/dist/gateway/static/root/assets/apps-page-Ci14lDeO.js +0 -1
  378. package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +0 -6
  379. package/dist/gateway/static/root/assets/browser-settings-page-DbowrHXD.js +0 -8
  380. package/dist/gateway/static/root/assets/capabilities-settings-panel-DoZPFdKF.js +0 -7
  381. package/dist/gateway/static/root/assets/capability-presets-api-Dn-7MMEo.js +0 -1
  382. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Bt8Hnx0h.js +0 -1
  383. package/dist/gateway/static/root/assets/channels-settings-Bpsebsru.js +0 -1
  384. package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +0 -1
  385. package/dist/gateway/static/root/assets/connector-logo-TRr9ybf6.js +0 -1
  386. package/dist/gateway/static/root/assets/connectors-page-Tg5kl22i.js +0 -2
  387. package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
  388. package/dist/gateway/static/root/assets/extension-settings-page-C9ag5tb5.js +0 -1
  389. package/dist/gateway/static/root/assets/gateway-settings-9g8uIry9.js +0 -1
  390. package/dist/gateway/static/root/assets/heartbeat-settings-fl1oC_-5.js +0 -1
  391. package/dist/gateway/static/root/assets/home-page-Bao9jq_z.js +0 -3
  392. package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +0 -1
  393. package/dist/gateway/static/root/assets/index-OJgiMh07.js +0 -223
  394. package/dist/gateway/static/root/assets/local-app-workbench-page-B69NvtvH.js +0 -2
  395. package/dist/gateway/static/root/assets/locale-store-D6hs74o5.js +0 -1
  396. package/dist/gateway/static/root/assets/logs-page-Cq3cABqg.js +0 -7
  397. package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +0 -3
  398. package/dist/gateway/static/root/assets/notes-workbench-BOZfJFhE.js +0 -4
  399. package/dist/gateway/static/root/assets/product-delivery-C8JbSj5Y.js +0 -1
  400. package/dist/gateway/static/root/assets/project-detail-page-TSKFb2tN.js +0 -1
  401. package/dist/gateway/static/root/assets/projects-page-BokeBrTT.js +0 -1
  402. package/dist/gateway/static/root/assets/remote-access-hub-C56anxCX.js +0 -1
  403. package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +0 -1
  404. package/dist/gateway/static/root/assets/sessions-page-C7TQADrD.js +0 -1
  405. package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +0 -1
  406. package/dist/gateway/static/root/assets/settings-form-section-zxo5ZGOu.js +0 -1
  407. package/dist/gateway/static/root/assets/settings-page-BUPSIa9P.js +0 -1
  408. package/dist/gateway/static/root/assets/setup-status-panel-BRg766eW.js +0 -1
  409. package/dist/gateway/static/root/assets/shares-settings-DhEAviQ_.js +0 -1
  410. package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +0 -1
  411. package/dist/gateway/static/root/assets/skills-page-DoVuprZm.js +0 -2
  412. package/dist/gateway/static/root/assets/time-picker-BGk_Tbsj.js +0 -1
  413. package/dist/gateway/static/root/assets/use-save-bar-registration-5aVSjTjO.js +0 -1
  414. package/dist/gateway/static/root/assets/user-context-page-B9K41qmy.js +0 -1
  415. package/dist/gateway/static/root/assets/work-discovery-page-BBVnRHju.js +0 -1
  416. package/dist/gateway/static/root/assets/workflows-page-Bs_tYfst.js +0 -11
  417. package/dist/src/agent/code-intelligence/binary.d.ts +0 -15
  418. package/dist/src/agent/code-intelligence/binary.js +0 -372
  419. package/dist/src/agent/code-intelligence/index.d.ts +0 -4
  420. package/dist/src/agent/code-intelligence/index.js +0 -4
  421. package/dist/src/agent/code-intelligence/runtime.d.ts +0 -34
  422. package/dist/src/agent/code-intelligence/runtime.js +0 -280
  423. package/dist/src/agent/code-intelligence/tool-gating.d.ts +0 -5
  424. package/dist/src/agent/code-intelligence/tool-gating.js +0 -6
  425. package/dist/src/agent/code-intelligence/tools.d.ts +0 -6
  426. package/dist/src/agent/code-intelligence/tools.js +0 -266
  427. package/dist/src/agent/code-intelligence/types.d.ts +0 -22
  428. package/dist/src/agent/memory/context/planner.js +0 -286
  429. package/dist/src/agent/memory/dreaming/config.d.ts +0 -48
  430. package/dist/src/agent/memory/dreaming/config.js +0 -98
  431. package/dist/src/agent/memory/dreaming/constants.d.ts +0 -12
  432. package/dist/src/agent/memory/dreaming/constants.js +0 -18
  433. package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +0 -19
  434. package/dist/src/agent/memory/dreaming/deep-promotion.js +0 -152
  435. package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -16
  436. package/dist/src/agent/memory/dreaming/light-sweep.js +0 -115
  437. package/dist/src/agent/memory/dreaming/preview.d.ts +0 -23
  438. package/dist/src/agent/memory/dreaming/preview.js +0 -52
  439. package/dist/src/agent/memory/dreaming/promotion-lifecycle.d.ts +0 -16
  440. package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +0 -44
  441. package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +0 -19
  442. package/dist/src/agent/memory/dreaming/rem-patterns.js +0 -150
  443. package/dist/src/agent/memory/dreaming/runner.d.ts +0 -10
  444. package/dist/src/agent/memory/dreaming/runner.js +0 -78
  445. package/dist/src/agent/memory/dreaming/schedule.d.ts +0 -23
  446. package/dist/src/agent/memory/dreaming/schedule.js +0 -38
  447. package/dist/src/agent/memory/dreaming/scope.d.ts +0 -11
  448. package/dist/src/agent/memory/dreaming/scope.js +0 -33
  449. package/dist/src/agent/memory/dreaming/utils.d.ts +0 -3
  450. package/dist/src/agent/memory/dreaming/utils.js +0 -31
  451. package/dist/src/agent/streaming/reasoning-visibility-sse.d.ts +0 -15
  452. package/dist/src/gateway/agent-run-relay.d.ts +0 -19
  453. package/dist/src/gateway/agent-run-relay.js +0 -169
  454. package/dist/src/gateway/hono/routes/memory.d.ts +0 -3
  455. package/dist/src/gateway/hono/routes/memory.js +0 -460
  456. package/dist/src/gateway/hono/sse.d.ts +0 -53
  457. package/dist/src/gateway/hono/sse.js +0 -207
  458. package/dist/src/gateway/service/sse-hub.d.ts +0 -10
  459. package/dist/src/gateway/service/sse-hub.js +0 -53
  460. package/dist/src/storage/sqlite/dreaming-repository.d.ts +0 -61
  461. package/dist/src/storage/sqlite/dreaming-repository.js +0 -88
  462. package/dist/src/storage/sqlite/memory-readiness-repository.d.ts +0 -7
  463. package/dist/src/storage/sqlite/memory-readiness-repository.js +0 -30
  464. package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +0 -27
  465. package/dist/src/storage/sqlite/memory-reference-consent-repository.js +0 -107
  466. package/dist/src/storage/sqlite/user-claims-repository.d.ts +0 -101
  467. package/dist/src/storage/sqlite/user-claims-repository.js +0 -241
  468. package/dist/src/storage/sqlite/user-profile-setup-repository.d.ts +0 -3
  469. package/dist/src/storage/sqlite/user-profile-setup-repository.js +0 -32
  470. package/dist/src/tui/sse-consumer.d.ts +0 -15
  471. package/dist/src/tui/sse-consumer.js +0 -73
  472. package/dist/src/user-context/context-compiler.d.ts +0 -27
  473. package/dist/src/user-context/context-compiler.js +0 -48
  474. package/dist/src/user-context/import.d.ts +0 -12
  475. package/dist/src/user-context/import.js +0 -51
  476. package/dist/src/user-context/memory-episode-evaluator.d.ts +0 -32
  477. package/dist/src/user-context/memory-episode-evaluator.js +0 -35
  478. package/dist/src/user-context/memory-readiness.d.ts +0 -33
  479. package/dist/src/user-context/memory-readiness.js +0 -41
  480. package/dist/src/user-context/memory-use-audit.d.ts +0 -10
  481. package/dist/src/user-context/memory-use-audit.js +0 -26
  482. package/dist/src/user-context/personal-playbook.d.ts +0 -11
  483. package/dist/src/user-context/personal-playbook.js +0 -41
  484. package/dist/src/user-context/profile.d.ts +0 -37
  485. package/dist/src/user-context/profile.js +0 -163
  486. package/dist/src/user-context/projection.d.ts +0 -120
  487. package/dist/src/user-context/projection.js +0 -262
  488. package/dist/src/user-context/source-recommendations.d.ts +0 -13
  489. package/dist/src/user-context/source-recommendations.js +0 -85
  490. /package/dist/src/{agent/code-intelligence → user-context/sources}/types.js +0 -0
@@ -0,0 +1,2 @@
1
+ import{i as e,t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-JdwAhgNB.js";import{Fl as s,Ho as c,Qo as l,Uo as u,Vo as d,Zo as f,ms as p}from"./index-CYT5DOzr.js";var m=r(),h=e(n(),1),g=i(),_=Array.from({length:24},(e,t)=>t);function v(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function y(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function ee(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function te(e){let t=(0,m.c)(80),{value:n,onChange:r,disabled:i,allowEmpty:te,clearLabel:b,ariaLabel:x,ariaLabelledBy:ie,className:ae,triggerClassName:oe,id:se,name:ce,minuteStep:le}=e,ue=te===void 0?!1:te,de=le===void 0?1:le,S=v(n),fe=S??y(),[pe,me]=(0,h.useState)(!1),[C,he]=(0,h.useState)(fe.hour),[w,ge]=(0,h.useState)(fe.minute),_e=(0,h.useRef)([]),T=(0,h.useRef)([]),E=d(),ve=c(),ye=u(E,ve!==null),be=Math.max(1,Math.min(60,Math.round(de))),xe=Array.from({length:Math.ceil(60/be)},(e,t)=>t*be).filter(re),Se;t[0]===r?Se=t[1]:(Se=(e,t,n)=>{let i=n===void 0?!1:n;he(e),ge(t),r(ee(e,t)),i&&me(!1)},t[0]=r,t[1]=Se);let Ce=Se,we=ne,D;t[2]===ae?D=t[3]:(D=o(`relative min-w-0`,ae),t[2]=ae,t[3]=D);let Te=l,O;t[4]===n?O=t[5]:(O=e=>{if(e){let e=v(n)??y();he(e.hour),ge(e.minute)}me(e)},t[4]=n,t[5]=O);let Ee=ue&&n&&`pr-9`,De=i&&`cursor-not-allowed opacity-50 hover:border-edge`,Oe;t[6]!==Ee||t[7]!==De||t[8]!==oe?(Oe=o(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,Ee,De,oe),t[6]=Ee,t[7]=De,t[8]=oe,t[9]=Oe):Oe=t[9];let ke;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,g.jsx)(s,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=ke):ke=t[10];let Ae=!S&&`text-fg-subtle`,je;t[11]===Ae?je=t[12]:(je=o(`tabular-nums`,Ae),t[11]=Ae,t[12]=je);let Me=S?ee(S.hour,S.minute):`--:--`,k;t[13]!==je||t[14]!==Me?(k=(0,g.jsx)(`span`,{className:je,children:Me}),t[13]=je,t[14]=Me,t[15]=k):k=t[15];let Ne;t[16]!==x||t[17]!==ie||t[18]!==i||t[19]!==se||t[20]!==k||t[21]!==Oe?(Ne=(0,g.jsx)(f,{asChild:!0,children:(0,g.jsxs)(`button`,{id:se,type:`button`,disabled:i,"aria-label":x,"aria-labelledby":ie,"aria-haspopup":`listbox`,className:Oe,children:[ke,k]})}),t[16]=x,t[17]=ie,t[18]=i,t[19]=se,t[20]=k,t[21]=Oe,t[22]=Ne):Ne=t[22];let Pe=l,Fe=ve??void 0,Ie=l,Le=o(ye,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),A=e=>{e.preventDefault(),requestAnimationFrame(()=>_e.current[C]?.focus())},Re;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(Re=(0,g.jsx)(s,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=Re):Re=t[23];let j=x??`HH:mm`,M;t[24]===j?M=t[25]:(M=(0,g.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[Re,j]}),t[24]=j,t[25]=M);let N;t[26]!==C||t[27]!==w?(N=ee(C,w),t[26]=C,t[27]=w,t[28]=N):N=t[28];let P;t[29]===N?P=t[30]:(P=(0,g.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:N}),t[29]=N,t[30]=P);let F;t[31]!==M||t[32]!==P?(F=(0,g.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[M,P]}),t[31]=M,t[32]=P,t[33]=F):F=t[33];let ze;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(ze=(0,g.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=ze):ze=t[34];let Be=`${x??`HH:mm`} HH`,Ve=_.map((e,t)=>(0,g.jsx)(`button`,{ref:e=>{_e.current[t]=e},type:`button`,role:`option`,"aria-selected":C===e,tabIndex:C===e?0:-1,className:o(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,C===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>Ce(e,w),onKeyDown:e=>we(e,_,C,e=>Ce(e,w),_e),children:String(e).padStart(2,`0`)},e)),He;t[35]!==Be||t[36]!==Ve?(He=(0,g.jsxs)(`div`,{className:`pr-2`,children:[ze,(0,g.jsx)(`div`,{role:`listbox`,"aria-label":Be,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Ve})]}),t[35]=Be,t[36]=Ve,t[37]=He):He=t[37];let I;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,g.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=I):I=t[38];let Ue=`${x??`HH:mm`} MM`,We=xe.map((e,t)=>(0,g.jsxs)(`button`,{ref:e=>{T.current[t]=e},type:`button`,role:`option`,"aria-selected":w===e,tabIndex:w===e?0:-1,className:o(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,w===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>Ce(C,e,!0),onKeyDown:e=>we(e,xe,w,e=>Ce(C,e),T),children:[(0,g.jsx)(a,{className:o(`absolute left-0.5 size-3`,w!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),L;t[39]!==Ue||t[40]!==We?(L=(0,g.jsx)(`div`,{role:`listbox`,"aria-label":Ue,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:We}),t[39]=Ue,t[40]=We,t[41]=L):L=t[41];let R;t[42]!==I||t[43]!==L?(R=(0,g.jsxs)(`div`,{className:`pl-2`,children:[I,L]}),t[42]=I,t[43]=L,t[44]=R):R=t[44];let z;t[45]!==He||t[46]!==R?(z=(0,g.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[He,R]}),t[45]=He,t[46]=R,t[47]=z):z=t[47];let B;t[48]!==Ie.Content||t[49]!==Le||t[50]!==A||t[51]!==F||t[52]!==z?(B=(0,g.jsxs)(Ie.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:Le,onOpenAutoFocus:A,children:[F,z]}),t[48]=Ie.Content,t[49]=Le,t[50]=A,t[51]=F,t[52]=z,t[53]=B):B=t[53];let Ge;t[54]!==Pe.Portal||t[55]!==Fe||t[56]!==B?(Ge=(0,g.jsx)(Pe.Portal,{container:Fe,children:B}),t[54]=Pe.Portal,t[55]=Fe,t[56]=B,t[57]=Ge):Ge=t[57];let Ke;t[58]!==pe||t[59]!==Ne||t[60]!==Ge||t[61]!==Te.Root||t[62]!==O?(Ke=(0,g.jsxs)(Te.Root,{open:pe,onOpenChange:O,children:[Ne,Ge]}),t[58]=pe,t[59]=Ne,t[60]=Ge,t[61]=Te.Root,t[62]=O,t[63]=Ke):Ke=t[63];let V;t[64]!==ue||t[65]!==x||t[66]!==b||t[67]!==i||t[68]!==r||t[69]!==n?(V=ue&&n?(0,g.jsx)(`button`,{type:`button`,disabled:i,"aria-label":b??x,title:b,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,g.jsx)(p,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=ue,t[65]=x,t[66]=b,t[67]=i,t[68]=r,t[69]=n,t[70]=V):V=t[70];let H;t[71]!==i||t[72]!==ce||t[73]!==n?(H=ce?(0,g.jsx)(`input`,{type:`hidden`,name:ce,value:n,disabled:i}):null,t[71]=i,t[72]=ce,t[73]=n,t[74]=H):H=t[74];let qe;return t[75]!==D||t[76]!==Ke||t[77]!==V||t[78]!==H?(qe=(0,g.jsxs)(`div`,{className:D,children:[Ke,V,H]}),t[75]=D,t[76]=Ke,t[77]=V,t[78]=H,t[79]=qe):qe=t[79],qe}function ne(e,t,n,r,i){let a=null,o=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(a=(o+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(a=(o-1+t.length)%t.length),e.key===`Home`&&(a=0),e.key===`End`&&(a=t.length-1),a===null)return;e.preventDefault();let s=t[a];r(s),i.current?.[a]?.focus()}function re(e){return e<60}var b=t((e=>{Object.defineProperty(e,"__esModule",{value:!0})})),x=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronField=void 0,e.CronField=class e{#e=!1;#t=!1;#n=!1;#r=[];options={rawValue:``};static get min(){throw Error(`min must be overridden`)}static get max(){throw Error(`max must be overridden`)}static get chars(){return Object.freeze([])}static get validChars(){return/^[?,*\dH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}static get constraints(){return{min:this.min,max:this.max,chars:this.chars,validChars:this.validChars}}constructor(t,n={rawValue:``}){if(!Array.isArray(t))throw Error(`${this.constructor.name} Validation error, values is not an array`);if(!(t.length>0))throw Error(`${this.constructor.name} Validation error, values contains no values`);this.options={...n,rawValue:n.rawValue??``},this.#r=t.sort(e.sorter),this.#n=this.options.wildcard===void 0?this.#i():this.options.wildcard,this.#e=this.options.rawValue.includes(`L`)||t.includes(`L`),this.#t=this.options.rawValue.includes(`?`)||t.includes(`?`)}get min(){return this.constructor.min}get max(){return this.constructor.max}get chars(){return this.constructor.chars}get hasLastChar(){return this.#e}get hasQuestionMarkChar(){return this.#t}get isWildcard(){return this.#n}get values(){return this.#r}static sorter(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?e-t:!n&&!r?e.localeCompare(t):n?-1:1}static findNearestValueInList(e,t,n=!1){if(n){for(let n=e.length-1;n>=0;n--)if(e[n]<t)return e[n];return null}for(let n=0;n<e.length;n++)if(e[n]>t)return e[n];return null}findNearestValue(e,t=!1){return this.constructor.findNearestValueInList(this.values,e,t)}serialize(){return{wildcard:this.#n,values:this.#r}}validate(){let e,t=this.chars.length>0?` or chars ${this.chars.join(``)}`:``,n=e=>t=>RegExp(`^\\d{0,2}${t}$`).test(e);if(!this.#r.every(t=>(e=t,typeof t==`number`?t>=this.min&&t<=this.max:this.chars.some(n(t)))))throw Error(`${this.constructor.name} Validation error, got value ${e} expected range ${this.min}-${this.max}${t}`);let r=this.#r.find((e,t)=>this.#r.indexOf(e)!==t);if(r)throw Error(`${this.constructor.name} Validation error, duplicate values found: ${r}`)}#i(){return this.options.rawValue.length>0?[`*`,`?`].includes(this.options.rawValue):Array.from({length:this.max-this.min+1},(e,t)=>t+this.min).every(e=>this.#r.includes(e))}}})),ie=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDayOfMonth=void 0;var t=x(),n=1,r=31,i=Object.freeze([`L`]);e.CronDayOfMonth=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}static get validChars(){return/^[?,*\dLH/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),ae=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDayOfWeek=void 0;var t=x(),n=0,r=7,i=Object.freeze([`L`]);e.CronDayOfWeek=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}static get validChars(){return/^[?,*\dLH#/-]+$|^.*H\(\d+-\d+\)\/\d+.*$|^.*H\(\d+-\d+\).*$|^.*H\/\d+.*$/}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}get nthDay(){return this.options.nthDayOfWeek??0}}})),oe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronHour=void 0;var t=x(),n=0,r=23,i=Object.freeze([]);e.CronHour=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),se=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronMinute=void 0;var t=x(),n=0,r=59,i=Object.freeze([]);e.CronMinute=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),ce=t((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=class extends Error{},n=class extends t{constructor(e){super(`Invalid DateTime: ${e.toMessage()}`)}},r=class extends t{constructor(e){super(`Invalid Interval: ${e.toMessage()}`)}},i=class extends t{constructor(e){super(`Invalid Duration: ${e.toMessage()}`)}},a=class extends t{},o=class extends t{constructor(e){super(`Invalid unit ${e}`)}},s=class extends t{},c=class extends t{constructor(){super(`Zone is an abstract class`)}},l=`numeric`,u=`short`,d=`long`,f={year:l,month:l,day:l},p={year:l,month:u,day:l},m={year:l,month:u,day:l,weekday:u},h={year:l,month:d,day:l},g={year:l,month:d,day:l,weekday:d},_={hour:l,minute:l},v={hour:l,minute:l,second:l},y={hour:l,minute:l,second:l,timeZoneName:u},ee={hour:l,minute:l,second:l,timeZoneName:d},te={hour:l,minute:l,hourCycle:`h23`},ne={hour:l,minute:l,second:l,hourCycle:`h23`},re={hour:l,minute:l,second:l,hourCycle:`h23`,timeZoneName:u},b={hour:l,minute:l,second:l,hourCycle:`h23`,timeZoneName:d},x={year:l,month:l,day:l,hour:l,minute:l},ie={year:l,month:l,day:l,hour:l,minute:l,second:l},ae={year:l,month:u,day:l,hour:l,minute:l},oe={year:l,month:u,day:l,hour:l,minute:l,second:l},se={year:l,month:u,day:l,weekday:u,hour:l,minute:l},ce={year:l,month:d,day:l,hour:l,minute:l,timeZoneName:u},le={year:l,month:d,day:l,hour:l,minute:l,second:l,timeZoneName:u},ue={year:l,month:d,day:l,weekday:d,hour:l,minute:l,timeZoneName:d},de={year:l,month:d,day:l,weekday:d,hour:l,minute:l,second:l,timeZoneName:d},S=class{get type(){throw new c}get name(){throw new c}get ianaName(){return this.name}get isUniversal(){throw new c}offsetName(e,t){throw new c}formatOffset(e,t){throw new c}offset(e){throw new c}equals(e){throw new c}get isValid(){throw new c}},fe=null,pe=class e extends S{static get instance(){return fe===null&&(fe=new e),fe}get type(){return`system`}get name(){return new Intl.DateTimeFormat().resolvedOptions().timeZone}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jt(e,t,n)}formatOffset(e,t){return Ft(this.offset(e),t)}offset(e){return-new Date(e).getTimezoneOffset()}equals(e){return e.type===`system`}get isValid(){return!0}},me=new Map;function C(e){let t=me.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(`en-US`,{hour12:!1,timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,era:`short`}),me.set(e,t)),t}var he={year:0,month:1,day:2,era:3,hour:4,minute:5,second:6};function w(e,t){let n=e.format(t).replace(/\u200E/g,``),[,r,i,a,o,s,c,l]=/(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(n);return[a,r,i,o,s,c,l]}function ge(e,t){let n=e.formatToParts(t),r=[];for(let e=0;e<n.length;e++){let{type:t,value:i}=n[e],a=he[t];t===`era`?r[a]=i:W(a)||(r[a]=parseInt(i,10))}return r}var _e=new Map,T=class e extends S{static create(t){let n=_e.get(t);return n===void 0&&_e.set(t,n=new e(t)),n}static resetCache(){_e.clear(),me.clear()}static isValidSpecifier(e){return this.isValidZone(e)}static isValidZone(e){if(!e)return!1;try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e}).format(),!0}catch{return!1}}constructor(t){super(),this.zoneName=t,this.valid=e.isValidZone(t)}get type(){return`iana`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(e,{format:t,locale:n}){return jt(e,t,n,this.name)}formatOffset(e,t){return Ft(this.offset(e),t)}offset(e){if(!this.valid)return NaN;let t=new Date(e);if(isNaN(t))return NaN;let n=C(this.name),[r,i,a,o,s,c,l]=n.formatToParts?ge(n,t):w(n,t);o===`BC`&&(r=-Math.abs(r)+1);let u=Dt({year:r,month:i,day:a,hour:s===24?0:s,minute:c,second:l,millisecond:0}),d=+t,f=d%1e3;return d-=f>=0?f:1e3+f,(u-d)/(60*1e3)}equals(e){return e.type===`iana`&&e.name===this.name}get isValid(){return this.valid}},E={};function ve(e,t={}){let n=JSON.stringify([e,t]),r=E[n];return r||(r=new Intl.ListFormat(e,t),E[n]=r),r}var ye=new Map;function be(e,t={}){let n=JSON.stringify([e,t]),r=ye.get(n);return r===void 0&&(r=new Intl.DateTimeFormat(e,t),ye.set(n,r)),r}var xe=new Map;function Se(e,t={}){let n=JSON.stringify([e,t]),r=xe.get(n);return r===void 0&&(r=new Intl.NumberFormat(e,t),xe.set(n,r)),r}var Ce=new Map;function we(e,t={}){let{base:n,...r}=t,i=JSON.stringify([e,r]),a=Ce.get(i);return a===void 0&&(a=new Intl.RelativeTimeFormat(e,t),Ce.set(i,a)),a}var D=null;function Te(){return D||(D=new Intl.DateTimeFormat().resolvedOptions().locale,D)}var O=new Map;function Ee(e){let t=O.get(e);return t===void 0&&(t=new Intl.DateTimeFormat(e).resolvedOptions(),O.set(e,t)),t}var De=new Map;function Oe(e){let t=De.get(e);if(!t){let n=new Intl.Locale(e);t=`getWeekInfo`in n?n.getWeekInfo():n.weekInfo,`minimalDays`in t||(t={...Le,...t}),De.set(e,t)}return t}function ke(e){let t=e.indexOf(`-x-`);t!==-1&&(e=e.substring(0,t));let n=e.indexOf(`-u-`);if(n===-1)return[e];{let t,r;try{t=be(e).resolvedOptions(),r=e}catch{let i=e.substring(0,n);t=be(i).resolvedOptions(),r=i}let{numberingSystem:i,calendar:a}=t;return[r,i,a]}}function Ae(e,t,n){return n||t?(e.includes(`-u-`)||(e+=`-u`),n&&(e+=`-ca-${n}`),t&&(e+=`-nu-${t}`),e):e}function je(e){let t=[];for(let n=1;n<=12;n++){let r=$.utc(2009,n,1);t.push(e(r))}return t}function Me(e){let t=[];for(let n=1;n<=7;n++){let r=$.utc(2016,11,13+n);t.push(e(r))}return t}function k(e,t,n,r){let i=e.listingMode();return i===`error`?null:i===`en`?n(t):r(t)}function Ne(e){return e.numberingSystem&&e.numberingSystem!==`latn`?!1:e.numberingSystem===`latn`||!e.locale||e.locale.startsWith(`en`)||Ee(e.locale).numberingSystem===`latn`}var Pe=class{constructor(e,t,n){this.padTo=n.padTo||0,this.floor=n.floor||!1;let{padTo:r,floor:i,...a}=n;if(!t||Object.keys(a).length>0){let t={useGrouping:!1,...n};n.padTo>0&&(t.minimumIntegerDigits=n.padTo),this.inf=Se(e,t)}}format(e){if(this.inf){let t=this.floor?Math.floor(e):e;return this.inf.format(t)}else return K(this.floor?Math.floor(e):Ct(e,3),this.padTo)}},Fe=class{constructor(e,t,n){this.opts=n,this.originalZone=void 0;let r;if(this.opts.timeZone)this.dt=e;else if(e.zone.type===`fixed`){let t=-1*(e.offset/60),n=t>=0?`Etc/GMT+${t}`:`Etc/GMT${t}`;e.offset!==0&&T.create(n).valid?(r=n,this.dt=e):(r=`UTC`,this.dt=e.offset===0?e:e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone)}else e.zone.type===`system`?this.dt=e:e.zone.type===`iana`?(this.dt=e,r=e.zone.name):(r=`UTC`,this.dt=e.setZone(`UTC`).plus({minutes:e.offset}),this.originalZone=e.zone);let i={...this.opts};i.timeZone=i.timeZone||r,this.dtf=be(t,i)}format(){return this.originalZone?this.formatToParts().map(({value:e})=>e).join(``):this.dtf.format(this.dt.toJSDate())}formatToParts(){let e=this.dtf.formatToParts(this.dt.toJSDate());return this.originalZone?e.map(e=>{if(e.type===`timeZoneName`){let t=this.originalZone.offsetName(this.dt.ts,{locale:this.dt.locale,format:this.opts.timeZoneName});return{...e,value:t}}else return e}):e}resolvedOptions(){return this.dtf.resolvedOptions()}},Ie=class{constructor(e,t,n){this.opts={style:`long`,...n},!t&&ft()&&(this.rtf=we(e,n))}format(e,t){return this.rtf?this.rtf.format(e,t):en(t,e,this.opts.numeric,this.opts.style!==`long`)}formatToParts(e,t){return this.rtf?this.rtf.formatToParts(e,t):[]}},Le={firstDay:1,minimalDays:4,weekend:[6,7]},A=class e{static fromOpts(t){return e.create(t.locale,t.numberingSystem,t.outputCalendar,t.weekSettings,t.defaultToEN)}static create(t,n,r,i,a=!1){let o=t||V.defaultLocale;return new e(o||(a?`en-US`:Te()),n||V.defaultNumberingSystem,r||V.defaultOutputCalendar,vt(i)||V.defaultWeekSettings,o)}static resetCache(){D=null,ye.clear(),xe.clear(),Ce.clear(),O.clear(),De.clear()}static fromObject({locale:t,numberingSystem:n,outputCalendar:r,weekSettings:i}={}){return e.create(t,n,r,i)}constructor(e,t,n,r,i){let[a,o,s]=ke(e);this.locale=a,this.numberingSystem=t||o||null,this.outputCalendar=n||s||null,this.weekSettings=r,this.intl=Ae(this.locale,this.numberingSystem,this.outputCalendar),this.weekdaysCache={format:{},standalone:{}},this.monthsCache={format:{},standalone:{}},this.meridiemCache=null,this.eraCache={},this.specifiedLocale=i,this.fastNumbersCached=null}get fastNumbers(){return this.fastNumbersCached??=Ne(this),this.fastNumbersCached}listingMode(){let e=this.isEnglish(),t=(this.numberingSystem===null||this.numberingSystem===`latn`)&&(this.outputCalendar===null||this.outputCalendar===`gregory`);return e&&t?`en`:`intl`}clone(t){return!t||Object.getOwnPropertyNames(t).length===0?this:e.create(t.locale||this.specifiedLocale,t.numberingSystem||this.numberingSystem,t.outputCalendar||this.outputCalendar,vt(t.weekSettings)||this.weekSettings,t.defaultToEN||!1)}redefaultToEN(e={}){return this.clone({...e,defaultToEN:!0})}redefaultToSystem(e={}){return this.clone({...e,defaultToEN:!1})}months(e,t=!1){return k(this,e,Bt,()=>{let n=this.intl===`ja`||this.intl.startsWith(`ja-`);t&=!n;let r=t?{month:e,day:`numeric`}:{month:e},i=t?`format`:`standalone`;if(!this.monthsCache[i][e]){let t=n?e=>this.dtFormatter(e,r).format():e=>this.extract(e,r,`month`);this.monthsCache[i][e]=je(t)}return this.monthsCache[i][e]})}weekdays(e,t=!1){return k(this,e,Wt,()=>{let n=t?{weekday:e,year:`numeric`,month:`long`,day:`numeric`}:{weekday:e},r=t?`format`:`standalone`;return this.weekdaysCache[r][e]||(this.weekdaysCache[r][e]=Me(e=>this.extract(e,n,`weekday`))),this.weekdaysCache[r][e]})}meridiems(){return k(this,void 0,()=>Gt,()=>{if(!this.meridiemCache){let e={hour:`numeric`,hourCycle:`h12`};this.meridiemCache=[$.utc(2016,11,13,9),$.utc(2016,11,13,19)].map(t=>this.extract(t,e,`dayperiod`))}return this.meridiemCache})}eras(e){return k(this,e,Yt,()=>{let t={era:e};return this.eraCache[e]||(this.eraCache[e]=[$.utc(-40,1,1),$.utc(2017,1,1)].map(e=>this.extract(e,t,`era`))),this.eraCache[e]})}extract(e,t,n){let r=this.dtFormatter(e,t).formatToParts().find(e=>e.type.toLowerCase()===n);return r?r.value:null}numberFormatter(e={}){return new Pe(this.intl,e.forceSimple||this.fastNumbers,e)}dtFormatter(e,t={}){return new Fe(e,this.intl,t)}relFormatter(e={}){return new Ie(this.intl,this.isEnglish(),e)}listFormatter(e={}){return ve(this.intl,e)}isEnglish(){return this.locale===`en`||this.locale.toLowerCase()===`en-us`||Ee(this.intl).locale.startsWith(`en-us`)}getWeekSettings(){return this.weekSettings?this.weekSettings:pt()?Oe(this.locale):Le}getStartOfWeek(){return this.getWeekSettings().firstDay}getMinDaysInFirstWeek(){return this.getWeekSettings().minimalDays}getWeekendDays(){return this.getWeekSettings().weekend}equals(e){return this.locale===e.locale&&this.numberingSystem===e.numberingSystem&&this.outputCalendar===e.outputCalendar}toString(){return`Locale(${this.locale}, ${this.numberingSystem}, ${this.outputCalendar})`}},Re=null,j=class e extends S{static get utcInstance(){return Re===null&&(Re=new e(0)),Re}static instance(t){return t===0?e.utcInstance:new e(t)}static parseSpecifier(t){if(t){let n=t.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);if(n)return new e(Mt(n[1],n[2]))}return null}constructor(e){super(),this.fixed=e}get type(){return`fixed`}get name(){return this.fixed===0?`UTC`:`UTC${Ft(this.fixed,`narrow`)}`}get ianaName(){return this.fixed===0?`Etc/UTC`:`Etc/GMT${Ft(-this.fixed,`narrow`)}`}offsetName(){return this.name}formatOffset(e,t){return Ft(this.fixed,t)}get isUniversal(){return!0}offset(){return this.fixed}equals(e){return e.type===`fixed`&&e.fixed===this.fixed}get isValid(){return!0}},M=class extends S{constructor(e){super(),this.zoneName=e}get type(){return`invalid`}get name(){return this.zoneName}get isUniversal(){return!1}offsetName(){return null}formatOffset(){return``}offset(){return NaN}equals(){return!1}get isValid(){return!1}};function N(e,t){if(W(e)||e===null)return t;if(e instanceof S)return e;if(ut(e)){let n=e.toLowerCase();return n==="default"?t:n===`local`||n===`system`?pe.instance:n===`utc`||n===`gmt`?j.utcInstance:j.parseSpecifier(n)||T.create(e)}else if(ct(e))return j.instance(e);else if(typeof e==`object`&&`offset`in e&&typeof e.offset==`function`)return e;else return new M(e)}var P={arab:`[٠-٩]`,arabext:`[۰-۹]`,bali:`[᭐-᭙]`,beng:`[০-৯]`,deva:`[०-९]`,fullwide:`[0-9]`,gujr:`[૦-૯]`,hanidec:`[〇|一|二|三|四|五|六|七|八|九]`,khmr:`[០-៩]`,knda:`[೦-೯]`,laoo:`[໐-໙]`,limb:`[᥆-᥏]`,mlym:`[൦-൯]`,mong:`[᠐-᠙]`,mymr:`[၀-၉]`,orya:`[୦-୯]`,tamldec:`[௦-௯]`,telu:`[౦-౯]`,thai:`[๐-๙]`,tibt:`[༠-༩]`,latn:`\\d`},F={arab:[1632,1641],arabext:[1776,1785],bali:[6992,7001],beng:[2534,2543],deva:[2406,2415],fullwide:[65296,65303],gujr:[2790,2799],khmr:[6112,6121],knda:[3302,3311],laoo:[3792,3801],limb:[6470,6479],mlym:[3430,3439],mong:[6160,6169],mymr:[4160,4169],orya:[2918,2927],tamldec:[3046,3055],telu:[3174,3183],thai:[3664,3673],tibt:[3872,3881]},ze=P.hanidec.replace(/[\[|\]]/g,``).split(``);function Be(e){let t=parseInt(e,10);if(isNaN(t)){t=``;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(e[n].search(P.hanidec)!==-1)t+=ze.indexOf(e[n]);else for(let e in F){let[n,i]=F[e];r>=n&&r<=i&&(t+=r-n)}}return parseInt(t,10)}else return t}var Ve=new Map;function He(){Ve.clear()}function I({numberingSystem:e},t=``){let n=e||`latn`,r=Ve.get(n);r===void 0&&(r=new Map,Ve.set(n,r));let i=r.get(t);return i===void 0&&(i=RegExp(`${P[n]}${t}`),r.set(t,i)),i}var Ue=()=>Date.now(),We=`system`,L=null,R=null,z=null,B=60,Ge,Ke=null,V=class{static get now(){return Ue}static set now(e){Ue=e}static set defaultZone(e){We=e}static get defaultZone(){return N(We,pe.instance)}static get defaultLocale(){return L}static set defaultLocale(e){L=e}static get defaultNumberingSystem(){return R}static set defaultNumberingSystem(e){R=e}static get defaultOutputCalendar(){return z}static set defaultOutputCalendar(e){z=e}static get defaultWeekSettings(){return Ke}static set defaultWeekSettings(e){Ke=vt(e)}static get twoDigitCutoffYear(){return B}static set twoDigitCutoffYear(e){B=e%100}static get throwOnInvalid(){return Ge}static set throwOnInvalid(e){Ge=e}static resetCaches(){A.resetCache(),T.resetCache(),$.resetCache(),He()}},H=class{constructor(e,t){this.reason=e,this.explanation=t}toMessage(){return this.explanation?`${this.reason}: ${this.explanation}`:this.reason}},qe=[0,31,59,90,120,151,181,212,243,273,304,334],Je=[0,31,60,91,121,152,182,213,244,274,305,335];function U(e,t){return new H(`unit out of range`,`you specified ${t} (of type ${typeof t}) as a ${e}, which is invalid`)}function Ye(e,t,n){let r=new Date(Date.UTC(e,t-1,n));e<100&&e>=0&&r.setUTCFullYear(r.getUTCFullYear()-1900);let i=r.getUTCDay();return i===0?7:i}function Xe(e,t,n){return n+(wt(e)?Je:qe)[t-1]}function Ze(e,t){let n=wt(e)?Je:qe,r=n.findIndex(e=>e<t),i=t-n[r];return{month:r+1,day:i}}function Qe(e,t){return(e-t+7)%7+1}function $e(e,t=4,n=1){let{year:r,month:i,day:a}=e,o=Xe(r,i,a),s=Qe(Ye(r,i,a),n),c=Math.floor((o-s+14-t)/7),l;return c<1?(l=r-1,c=kt(l,t,n)):c>kt(r,t,n)?(l=r+1,c=1):l=r,{weekYear:l,weekNumber:c,weekday:s,...It(e)}}function et(e,t=4,n=1){let{weekYear:r,weekNumber:i,weekday:a}=e,o=Qe(Ye(r,1,t),n),s=Tt(r),c=i*7+a-o-7+t,l;c<1?(l=r-1,c+=Tt(l)):c>s?(l=r+1,c-=Tt(r)):l=r;let{month:u,day:d}=Ze(l,c);return{year:l,month:u,day:d,...It(e)}}function tt(e){let{year:t,month:n,day:r}=e;return{year:t,ordinal:Xe(t,n,r),...It(e)}}function nt(e){let{year:t,ordinal:n}=e,{month:r,day:i}=Ze(t,n);return{year:t,month:r,day:i,...It(e)}}function rt(e,t){if(!W(e.localWeekday)||!W(e.localWeekNumber)||!W(e.localWeekYear)){if(!W(e.weekday)||!W(e.weekNumber)||!W(e.weekYear))throw new a(`Cannot mix locale-based week fields with ISO-based week fields`);return W(e.localWeekday)||(e.weekday=e.localWeekday),W(e.localWeekNumber)||(e.weekNumber=e.localWeekNumber),W(e.localWeekYear)||(e.weekYear=e.localWeekYear),delete e.localWeekday,delete e.localWeekNumber,delete e.localWeekYear,{minDaysInFirstWeek:t.getMinDaysInFirstWeek(),startOfWeek:t.getStartOfWeek()}}else return{minDaysInFirstWeek:4,startOfWeek:1}}function it(e,t=4,n=1){let r=lt(e.weekYear),i=G(e.weekNumber,1,kt(e.weekYear,t,n)),a=G(e.weekday,1,7);return r?i?a?!1:U(`weekday`,e.weekday):U(`week`,e.weekNumber):U(`weekYear`,e.weekYear)}function at(e){let t=lt(e.year),n=G(e.ordinal,1,Tt(e.year));return t?n?!1:U(`ordinal`,e.ordinal):U(`year`,e.year)}function ot(e){let t=lt(e.year),n=G(e.month,1,12),r=G(e.day,1,Et(e.year,e.month));return t?n?r?!1:U(`day`,e.day):U(`month`,e.month):U(`year`,e.year)}function st(e){let{hour:t,minute:n,second:r,millisecond:i}=e,a=G(t,0,23)||t===24&&n===0&&r===0&&i===0,o=G(n,0,59),s=G(r,0,59),c=G(i,0,999);return a?o?s?c?!1:U(`millisecond`,i):U(`second`,r):U(`minute`,n):U(`hour`,t)}function W(e){return e===void 0}function ct(e){return typeof e==`number`}function lt(e){return typeof e==`number`&&e%1==0}function ut(e){return typeof e==`string`}function dt(e){return Object.prototype.toString.call(e)===`[object Date]`}function ft(){try{return typeof Intl<`u`&&!!Intl.RelativeTimeFormat}catch{return!1}}function pt(){try{return typeof Intl<`u`&&!!Intl.Locale&&(`weekInfo`in Intl.Locale.prototype||`getWeekInfo`in Intl.Locale.prototype)}catch{return!1}}function mt(e){return Array.isArray(e)?e:[e]}function ht(e,t,n){if(e.length!==0)return e.reduce((e,r)=>{let i=[t(r),r];return e&&n(e[0],i[0])===e[0]?e:i},null)[1]}function gt(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function _t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function vt(e){if(e==null)return null;if(typeof e!=`object`)throw new s(`Week settings must be an object`);if(!G(e.firstDay,1,7)||!G(e.minimalDays,1,7)||!Array.isArray(e.weekend)||e.weekend.some(e=>!G(e,1,7)))throw new s(`Invalid week settings`);return{firstDay:e.firstDay,minimalDays:e.minimalDays,weekend:Array.from(e.weekend)}}function G(e,t,n){return lt(e)&&e>=t&&e<=n}function yt(e,t){return e-t*Math.floor(e/t)}function K(e,t=2){let n=e<0,r;return r=n?`-`+(``+-e).padStart(t,`0`):(``+e).padStart(t,`0`),r}function bt(e){if(!(W(e)||e===null||e===``))return parseInt(e,10)}function xt(e){if(!(W(e)||e===null||e===``))return parseFloat(e)}function St(e){if(!(W(e)||e===null||e===``)){let t=parseFloat(`0.`+e)*1e3;return Math.floor(t)}}function Ct(e,t,n=`round`){let r=10**t;switch(n){case`expand`:return e>0?Math.ceil(e*r)/r:Math.floor(e*r)/r;case`trunc`:return Math.trunc(e*r)/r;case`round`:return Math.round(e*r)/r;case`floor`:return Math.floor(e*r)/r;case`ceil`:return Math.ceil(e*r)/r;default:throw RangeError(`Value rounding ${n} is out of range`)}}function wt(e){return e%4==0&&(e%100!=0||e%400==0)}function Tt(e){return wt(e)?366:365}function Et(e,t){let n=yt(t-1,12)+1,r=e+(t-n)/12;return n===2?wt(r)?29:28:[31,null,31,30,31,30,31,31,30,31,30,31][n-1]}function Dt(e){let t=Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second,e.millisecond);return e.year<100&&e.year>=0&&(t=new Date(t),t.setUTCFullYear(e.year,e.month-1,e.day)),+t}function Ot(e,t,n){return-Qe(Ye(e,1,t),n)+t-1}function kt(e,t=4,n=1){let r=Ot(e,t,n),i=Ot(e+1,t,n);return(Tt(e)-r+i)/7}function At(e){return e>99?e:e>V.twoDigitCutoffYear?1900+e:2e3+e}function jt(e,t,n,r=null){let i=new Date(e),a={hourCycle:`h23`,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`};r&&(a.timeZone=r);let o={timeZoneName:t,...a},s=new Intl.DateTimeFormat(n,o).formatToParts(i).find(e=>e.type.toLowerCase()===`timezonename`);return s?s.value:null}function Mt(e,t){let n=parseInt(e,10);Number.isNaN(n)&&(n=0);let r=parseInt(t,10)||0,i=n<0||Object.is(n,-0)?-r:r;return n*60+i}function Nt(e){let t=Number(e);if(typeof e==`boolean`||e===``||!Number.isFinite(t))throw new s(`Invalid unit value ${e}`);return t}function Pt(e,t){let n={};for(let r in e)if(_t(e,r)){let i=e[r];if(i==null)continue;n[t(r)]=Nt(i)}return n}function Ft(e,t){let n=Math.trunc(Math.abs(e/60)),r=Math.trunc(Math.abs(e%60)),i=e>=0?`+`:`-`;switch(t){case`short`:return`${i}${K(n,2)}:${K(r,2)}`;case`narrow`:return`${i}${n}${r>0?`:${r}`:``}`;case`techie`:return`${i}${K(n,2)}${K(r,2)}`;default:throw RangeError(`Value format ${t} is out of range for property format`)}}function It(e){return gt(e,[`hour`,`minute`,`second`,`millisecond`])}var Lt=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Rt=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],zt=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`];function Bt(e){switch(e){case`narrow`:return[...zt];case`short`:return[...Rt];case`long`:return[...Lt];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`10`,`11`,`12`];case`2-digit`:return[`01`,`02`,`03`,`04`,`05`,`06`,`07`,`08`,`09`,`10`,`11`,`12`];default:return null}}var Vt=[`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`,`Sunday`],Ht=[`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sun`],Ut=[`M`,`T`,`W`,`T`,`F`,`S`,`S`];function Wt(e){switch(e){case`narrow`:return[...Ut];case`short`:return[...Ht];case`long`:return[...Vt];case`numeric`:return[`1`,`2`,`3`,`4`,`5`,`6`,`7`];default:return null}}var Gt=[`AM`,`PM`],Kt=[`Before Christ`,`Anno Domini`],qt=[`BC`,`AD`],Jt=[`B`,`A`];function Yt(e){switch(e){case`narrow`:return[...Jt];case`short`:return[...qt];case`long`:return[...Kt];default:return null}}function Xt(e){return Gt[e.hour<12?0:1]}function Zt(e,t){return Wt(t)[e.weekday-1]}function Qt(e,t){return Bt(t)[e.month-1]}function $t(e,t){return Yt(t)[e.year<0?0:1]}function en(e,t,n=`always`,r=!1){let i={years:[`year`,`yr.`],quarters:[`quarter`,`qtr.`],months:[`month`,`mo.`],weeks:[`week`,`wk.`],days:[`day`,`day`,`days`],hours:[`hour`,`hr.`],minutes:[`minute`,`min.`],seconds:[`second`,`sec.`]},a=[`hours`,`minutes`,`seconds`].indexOf(e)===-1;if(n===`auto`&&a){let n=e===`days`;switch(t){case 1:return n?`tomorrow`:`next ${i[e][0]}`;case-1:return n?`yesterday`:`last ${i[e][0]}`;case 0:return n?`today`:`this ${i[e][0]}`}}let o=Object.is(t,-0)||t<0,s=Math.abs(t),c=s===1,l=i[e],u=r?c?l[1]:l[2]||l[1]:c?i[e][0]:e;return o?`${s} ${u} ago`:`in ${s} ${u}`}function tn(e,t){let n=``;for(let r of e)r.literal?n+=r.val:n+=t(r.val);return n}var nn={D:f,DD:p,DDD:h,DDDD:g,t:_,tt:v,ttt:y,tttt:ee,T:te,TT:ne,TTT:re,TTTT:b,f:x,ff:ae,fff:ce,ffff:ue,F:ie,FF:oe,FFF:le,FFFF:de},q=class e{static create(t,n={}){return new e(t,n)}static parseFormat(e){let t=null,n=``,r=!1,i=[];for(let a=0;a<e.length;a++){let o=e.charAt(a);o===`'`?((n.length>0||r)&&i.push({literal:r||/^\s+$/.test(n),val:n===``?`'`:n}),t=null,n=``,r=!r):r||o===t?n+=o:(n.length>0&&i.push({literal:/^\s+$/.test(n),val:n}),n=o,t=o)}return n.length>0&&i.push({literal:r||/^\s+$/.test(n),val:n}),i}static macroTokenToFormatOpts(e){return nn[e]}constructor(e,t){this.opts=t,this.loc=e,this.systemLoc=null}formatWithSystemDefault(e,t){return this.systemLoc===null&&(this.systemLoc=this.loc.redefaultToSystem()),this.systemLoc.dtFormatter(e,{...this.opts,...t}).format()}dtFormatter(e,t={}){return this.loc.dtFormatter(e,{...this.opts,...t})}formatDateTime(e,t){return this.dtFormatter(e,t).format()}formatDateTimeParts(e,t){return this.dtFormatter(e,t).formatToParts()}formatInterval(e,t){return this.dtFormatter(e.start,t).dtf.formatRange(e.start.toJSDate(),e.end.toJSDate())}resolvedOptions(e,t){return this.dtFormatter(e,t).resolvedOptions()}num(e,t=0,n=void 0){if(this.opts.forceSimple)return K(e,t);let r={...this.opts};return t>0&&(r.padTo=t),n&&(r.signDisplay=n),this.loc.numberFormatter(r).format(e)}formatDateTimeFromString(t,n){let r=this.loc.listingMode()===`en`,i=this.loc.outputCalendar&&this.loc.outputCalendar!==`gregory`,a=(e,n)=>this.loc.extract(t,e,n),o=e=>t.isOffsetFixed&&t.offset===0&&e.allowZ?`Z`:t.isValid?t.zone.formatOffset(t.ts,e.format):``,s=()=>r?Xt(t):a({hour:`numeric`,hourCycle:`h12`},`dayperiod`),c=(e,n)=>r?Qt(t,e):a(n?{month:e}:{month:e,day:`numeric`},`month`),l=(e,n)=>r?Zt(t,e):a(n?{weekday:e}:{weekday:e,month:`long`,day:`numeric`},`weekday`),u=n=>{let r=e.macroTokenToFormatOpts(n);return r?this.formatWithSystemDefault(t,r):n},d=e=>r?$t(t,e):a({era:e},`era`);return tn(e.parseFormat(n),e=>{switch(e){case`S`:return this.num(t.millisecond);case`u`:case`SSS`:return this.num(t.millisecond,3);case`s`:return this.num(t.second);case`ss`:return this.num(t.second,2);case`uu`:return this.num(Math.floor(t.millisecond/10),2);case`uuu`:return this.num(Math.floor(t.millisecond/100));case`m`:return this.num(t.minute);case`mm`:return this.num(t.minute,2);case`h`:return this.num(t.hour%12==0?12:t.hour%12);case`hh`:return this.num(t.hour%12==0?12:t.hour%12,2);case`H`:return this.num(t.hour);case`HH`:return this.num(t.hour,2);case`Z`:return o({format:`narrow`,allowZ:this.opts.allowZ});case`ZZ`:return o({format:`short`,allowZ:this.opts.allowZ});case`ZZZ`:return o({format:`techie`,allowZ:this.opts.allowZ});case`ZZZZ`:return t.zone.offsetName(t.ts,{format:`short`,locale:this.loc.locale});case`ZZZZZ`:return t.zone.offsetName(t.ts,{format:`long`,locale:this.loc.locale});case`z`:return t.zoneName;case`a`:return s();case`d`:return i?a({day:`numeric`},`day`):this.num(t.day);case`dd`:return i?a({day:`2-digit`},`day`):this.num(t.day,2);case`c`:return this.num(t.weekday);case`ccc`:return l(`short`,!0);case`cccc`:return l(`long`,!0);case`ccccc`:return l(`narrow`,!0);case`E`:return this.num(t.weekday);case`EEE`:return l(`short`,!1);case`EEEE`:return l(`long`,!1);case`EEEEE`:return l(`narrow`,!1);case`L`:return i?a({month:`numeric`,day:`numeric`},`month`):this.num(t.month);case`LL`:return i?a({month:`2-digit`,day:`numeric`},`month`):this.num(t.month,2);case`LLL`:return c(`short`,!0);case`LLLL`:return c(`long`,!0);case`LLLLL`:return c(`narrow`,!0);case`M`:return i?a({month:`numeric`},`month`):this.num(t.month);case`MM`:return i?a({month:`2-digit`},`month`):this.num(t.month,2);case`MMM`:return c(`short`,!1);case`MMMM`:return c(`long`,!1);case`MMMMM`:return c(`narrow`,!1);case`y`:return i?a({year:`numeric`},`year`):this.num(t.year);case`yy`:return i?a({year:`2-digit`},`year`):this.num(t.year.toString().slice(-2),2);case`yyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,4);case`yyyyyy`:return i?a({year:`numeric`},`year`):this.num(t.year,6);case`G`:return d(`short`);case`GG`:return d(`long`);case`GGGGG`:return d(`narrow`);case`kk`:return this.num(t.weekYear.toString().slice(-2),2);case`kkkk`:return this.num(t.weekYear,4);case`W`:return this.num(t.weekNumber);case`WW`:return this.num(t.weekNumber,2);case`n`:return this.num(t.localWeekNumber);case`nn`:return this.num(t.localWeekNumber,2);case`ii`:return this.num(t.localWeekYear.toString().slice(-2),2);case`iiii`:return this.num(t.localWeekYear,4);case`o`:return this.num(t.ordinal);case`ooo`:return this.num(t.ordinal,3);case`q`:return this.num(t.quarter);case`qq`:return this.num(t.quarter,2);case`X`:return this.num(Math.floor(t.ts/1e3));case`x`:return this.num(t.ts);default:return u(e)}})}formatDurationFromString(t,n){let r=this.opts.signMode===`negativeLargestOnly`?-1:1,i=e=>{switch(e[0]){case`S`:return`milliseconds`;case`s`:return`seconds`;case`m`:return`minutes`;case`h`:return`hours`;case`d`:return`days`;case`w`:return`weeks`;case`M`:return`months`;case`y`:return`years`;default:return null}},a=(e,t)=>n=>{let a=i(n);if(a){let i=t.isNegativeDuration&&a!==t.largestUnit?r:1,o;return o=this.opts.signMode===`negativeLargestOnly`&&a!==t.largestUnit?`never`:this.opts.signMode===`all`?`always`:`auto`,this.num(e.get(a)*i,n.length,o)}else return n},o=e.parseFormat(n),s=o.reduce((e,{literal:t,val:n})=>t?e:e.concat(n),[]),c=t.shiftTo(...s.map(i).filter(e=>e));return tn(o,a(c,{isNegativeDuration:c<0,largestUnit:Object.keys(c.values)[0]}))}},rn=/[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;function an(...e){let t=e.reduce((e,t)=>e+t.source,``);return RegExp(`^${t}$`)}function on(...e){return t=>e.reduce(([e,n,r],i)=>{let[a,o,s]=i(t,r);return[{...e,...a},o||n,s]},[{},null,1]).slice(0,2)}function sn(e,...t){if(e==null)return[null,null];for(let[n,r]of t){let t=n.exec(e);if(t)return r(t)}return[null,null]}function cn(...e){return(t,n)=>{let r={},i;for(i=0;i<e.length;i++)r[e[i]]=bt(t[n+i]);return[r,null,n+i]}}var ln=/(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/,un=`(?:${ln.source}?(?:\\[(${rn.source})\\])?)?`,dn=/(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/,fn=RegExp(`${dn.source}${un}`),pn=RegExp(`(?:[Tt]${fn.source})?`),mn=/([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/,hn=/(\d{4})-?W(\d\d)(?:-?(\d))?/,gn=/(\d{4})-?(\d{3})/,_n=cn(`weekYear`,`weekNumber`,`weekDay`),vn=cn(`year`,`ordinal`),yn=/(\d{4})-(\d\d)-(\d\d)/,bn=RegExp(`${dn.source} ?(?:${ln.source}|(${rn.source}))?`),xn=RegExp(`(?: ${bn.source})?`);function Sn(e,t,n){let r=e[t];return W(r)?n:bt(r)}function Cn(e,t){return[{year:Sn(e,t),month:Sn(e,t+1,1),day:Sn(e,t+2,1)},null,t+3]}function wn(e,t){return[{hours:Sn(e,t,0),minutes:Sn(e,t+1,0),seconds:Sn(e,t+2,0),milliseconds:St(e[t+3])},null,t+4]}function Tn(e,t){let n=!e[t]&&!e[t+1],r=Mt(e[t+1],e[t+2]);return[{},n?null:j.instance(r),t+3]}function En(e,t){return[{},e[t]?T.create(e[t]):null,t+1]}var Dn=RegExp(`^T?${dn.source}$`),On=/^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;function kn(e){let[t,n,r,i,a,o,s,c,l]=e,u=t[0]===`-`,d=c&&c[0]===`-`,f=(e,t=!1)=>e!==void 0&&(t||e&&u)?-e:e;return[{years:f(xt(n)),months:f(xt(r)),weeks:f(xt(i)),days:f(xt(a)),hours:f(xt(o)),minutes:f(xt(s)),seconds:f(xt(c),c===`-0`),milliseconds:f(St(l),d)}]}var An={GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function jn(e,t,n,r,i,a,o){let s={year:t.length===2?At(bt(t)):bt(t),month:Rt.indexOf(n)+1,day:bt(r),hour:bt(i),minute:bt(a)};return o&&(s.second=bt(o)),e&&(s.weekday=e.length>3?Vt.indexOf(e)+1:Ht.indexOf(e)+1),s}var Mn=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;function Nn(e){let[,t,n,r,i,a,o,s,c,l,u,d]=e,f=jn(t,i,r,n,a,o,s),p;return p=c?An[c]:l?0:Mt(u,d),[f,new j(p)]}function Pn(e){return e.replace(/\([^()]*\)|[\n\t]/g,` `).replace(/(\s\s+)/g,` `).trim()}var Fn=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/,In=/^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/,Ln=/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;function Rn(e){let[,t,n,r,i,a,o,s]=e;return[jn(t,i,r,n,a,o,s),j.utcInstance]}function zn(e){let[,t,n,r,i,a,o,s]=e;return[jn(t,s,n,r,i,a,o),j.utcInstance]}var Bn=an(mn,pn),Vn=an(hn,pn),Hn=an(gn,pn),Un=an(fn),Wn=on(Cn,wn,Tn,En),Gn=on(_n,wn,Tn,En),Kn=on(vn,wn,Tn,En),qn=on(wn,Tn,En);function Jn(e){return sn(e,[Bn,Wn],[Vn,Gn],[Hn,Kn],[Un,qn])}function Yn(e){return sn(Pn(e),[Mn,Nn])}function Xn(e){return sn(e,[Fn,Rn],[In,Rn],[Ln,zn])}function Zn(e){return sn(e,[On,kn])}var Qn=on(wn);function $n(e){return sn(e,[Dn,Qn])}var er=an(yn,xn),tr=an(bn),nr=on(wn,Tn,En);function rr(e){return sn(e,[er,Wn],[tr,nr])}var ir=`Invalid Duration`,ar={weeks:{days:7,hours:168,minutes:10080,seconds:10080*60,milliseconds:10080*60*1e3},days:{hours:24,minutes:1440,seconds:1440*60,milliseconds:1440*60*1e3},hours:{minutes:60,seconds:3600,milliseconds:3600*1e3},minutes:{seconds:60,milliseconds:60*1e3},seconds:{milliseconds:1e3}},or={years:{quarters:4,months:12,weeks:52,days:365,hours:365*24,minutes:365*24*60,seconds:365*24*60*60,milliseconds:365*24*60*60*1e3},quarters:{months:3,weeks:13,days:91,hours:2184,minutes:2184*60,seconds:2184*60*60,milliseconds:2184*60*60*1e3},months:{weeks:4,days:30,hours:720,minutes:720*60,seconds:720*60*60,milliseconds:720*60*60*1e3},...ar},J=146097/400,sr=146097/4800,cr={years:{quarters:4,months:12,weeks:J/7,days:J,hours:J*24,minutes:J*24*60,seconds:J*24*60*60,milliseconds:J*24*60*60*1e3},quarters:{months:3,weeks:J/28,days:J/4,hours:J*24/4,minutes:J*24*60/4,seconds:J*24*60*60/4,milliseconds:J*24*60*60*1e3/4},months:{weeks:sr/7,days:sr,hours:sr*24,minutes:sr*24*60,seconds:sr*24*60*60,milliseconds:sr*24*60*60*1e3},...ar},lr=[`years`,`quarters`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`],ur=lr.slice(0).reverse();function Y(e,t,n=!1){return new X({values:n?t.values:{...e.values,...t.values||{}},loc:e.loc.clone(t.loc),conversionAccuracy:t.conversionAccuracy||e.conversionAccuracy,matrix:t.matrix||e.matrix})}function dr(e,t){let n=t.milliseconds??0;for(let r of ur.slice(1))t[r]&&(n+=t[r]*e[r].milliseconds);return n}function fr(e,t){let n=dr(e,t)<0?-1:1;lr.reduceRight((r,i)=>{if(W(t[i]))return r;if(r){let a=t[r]*n,o=e[i][r],s=Math.floor(a/o);t[i]+=s*n,t[r]-=s*o*n}return i},null),lr.reduce((n,r)=>{if(W(t[r]))return n;if(n){let i=t[n]%1;t[n]-=i,t[r]+=i*e[n][r]}return r},null)}function pr(e){let t={};for(let[n,r]of Object.entries(e))r!==0&&(t[n]=r);return t}var X=class e{constructor(e){let t=e.conversionAccuracy===`longterm`||!1,n=t?cr:or;e.matrix&&(n=e.matrix),this.values=e.values,this.loc=e.loc||A.create(),this.conversionAccuracy=t?`longterm`:`casual`,this.invalid=e.invalid||null,this.matrix=n,this.isLuxonDuration=!0}static fromMillis(t,n){return e.fromObject({milliseconds:t},n)}static fromObject(t,n={}){if(typeof t!=`object`||!t)throw new s(`Duration.fromObject: argument expected to be an object, got ${t===null?`null`:typeof t}`);return new e({values:Pt(t,e.normalizeUnit),loc:A.fromObject(n),conversionAccuracy:n.conversionAccuracy,matrix:n.matrix})}static fromDurationLike(t){if(ct(t))return e.fromMillis(t);if(e.isDuration(t))return t;if(typeof t==`object`)return e.fromObject(t);throw new s(`Unknown duration argument ${t} of type ${typeof t}`)}static fromISO(t,n){let[r]=Zn(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static fromISOTime(t,n){let[r]=$n(t);return r?e.fromObject(r,n):e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static invalid(t,n=null){if(!t)throw new s(`need to specify a reason the Duration is invalid`);let r=t instanceof H?t:new H(t,n);if(V.throwOnInvalid)throw new i(r);return new e({invalid:r})}static normalizeUnit(e){let t={year:`years`,years:`years`,quarter:`quarters`,quarters:`quarters`,month:`months`,months:`months`,week:`weeks`,weeks:`weeks`,day:`days`,days:`days`,hour:`hours`,hours:`hours`,minute:`minutes`,minutes:`minutes`,second:`seconds`,seconds:`seconds`,millisecond:`milliseconds`,milliseconds:`milliseconds`}[e&&e.toLowerCase()];if(!t)throw new o(e);return t}static isDuration(e){return e&&e.isLuxonDuration||!1}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}toFormat(e,t={}){let n={...t,floor:t.round!==!1&&t.floor!==!1};return this.isValid?q.create(this.loc,n).formatDurationFromString(this,e):ir}toHuman(e={}){if(!this.isValid)return ir;let t=e.showZeros!==!1,n=lr.map(n=>{let r=this.values[n];return W(r)||r===0&&!t?null:this.loc.numberFormatter({style:`unit`,unitDisplay:`long`,...e,unit:n.slice(0,-1)}).format(r)}).filter(e=>e);return this.loc.listFormatter({type:`conjunction`,style:e.listStyle||`narrow`,...e}).format(n)}toObject(){return this.isValid?{...this.values}:{}}toISO(){if(!this.isValid)return null;let e=`P`;return this.years!==0&&(e+=this.years+`Y`),(this.months!==0||this.quarters!==0)&&(e+=this.months+this.quarters*3+`M`),this.weeks!==0&&(e+=this.weeks+`W`),this.days!==0&&(e+=this.days+`D`),(this.hours!==0||this.minutes!==0||this.seconds!==0||this.milliseconds!==0)&&(e+=`T`),this.hours!==0&&(e+=this.hours+`H`),this.minutes!==0&&(e+=this.minutes+`M`),(this.seconds!==0||this.milliseconds!==0)&&(e+=Ct(this.seconds+this.milliseconds/1e3,3)+`S`),e===`P`&&(e+=`T0S`),e}toISOTime(e={}){if(!this.isValid)return null;let t=this.toMillis();return t<0||t>=864e5?null:(e={suppressMilliseconds:!1,suppressSeconds:!1,includePrefix:!1,format:`extended`,...e,includeOffset:!1},$.fromMillis(t,{zone:`UTC`}).toISOTime(e))}toJSON(){return this.toISO()}toString(){return this.toISO()}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Duration { values: ${JSON.stringify(this.values)} }`:`Duration { Invalid, reason: ${this.invalidReason} }`}toMillis(){return this.isValid?dr(this.matrix,this.values):NaN}valueOf(){return this.toMillis()}plus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t),r={};for(let e of lr)(_t(n.values,e)||_t(this.values,e))&&(r[e]=n.get(e)+this.get(e));return Y(this,{values:r},!0)}minus(t){if(!this.isValid)return this;let n=e.fromDurationLike(t);return this.plus(n.negate())}mapUnits(e){if(!this.isValid)return this;let t={};for(let n of Object.keys(this.values))t[n]=Nt(e(this.values[n],n));return Y(this,{values:t},!0)}get(t){return this[e.normalizeUnit(t)]}set(t){if(!this.isValid)return this;let n={...this.values,...Pt(t,e.normalizeUnit)};return Y(this,{values:n})}reconfigure({locale:e,numberingSystem:t,conversionAccuracy:n,matrix:r}={}){let i={loc:this.loc.clone({locale:e,numberingSystem:t}),matrix:r,conversionAccuracy:n};return Y(this,i)}as(e){return this.isValid?this.shiftTo(e).get(e):NaN}normalize(){if(!this.isValid)return this;let e=this.toObject();return fr(this.matrix,e),Y(this,{values:e},!0)}rescale(){if(!this.isValid)return this;let e=pr(this.normalize().shiftToAll().toObject());return Y(this,{values:e},!0)}shiftTo(...t){if(!this.isValid||t.length===0)return this;t=t.map(t=>e.normalizeUnit(t));let n={},r={},i=this.toObject(),a;for(let e of lr)if(t.indexOf(e)>=0){a=e;let t=0;for(let n in r)t+=this.matrix[n][e]*r[n],r[n]=0;ct(i[e])&&(t+=i[e]);let o=Math.trunc(t);n[e]=o,r[e]=(t*1e3-o*1e3)/1e3}else ct(i[e])&&(r[e]=i[e]);for(let e in r)r[e]!==0&&(n[a]+=e===a?r[e]:r[e]/this.matrix[a][e]);return fr(this.matrix,n),Y(this,{values:n},!0)}shiftToAll(){return this.isValid?this.shiftTo(`years`,`months`,`weeks`,`days`,`hours`,`minutes`,`seconds`,`milliseconds`):this}negate(){if(!this.isValid)return this;let e={};for(let t of Object.keys(this.values))e[t]=this.values[t]===0?0:-this.values[t];return Y(this,{values:e},!0)}removeZeros(){if(!this.isValid)return this;let e=pr(this.values);return Y(this,{values:e},!0)}get years(){return this.isValid?this.values.years||0:NaN}get quarters(){return this.isValid?this.values.quarters||0:NaN}get months(){return this.isValid?this.values.months||0:NaN}get weeks(){return this.isValid?this.values.weeks||0:NaN}get days(){return this.isValid?this.values.days||0:NaN}get hours(){return this.isValid?this.values.hours||0:NaN}get minutes(){return this.isValid?this.values.minutes||0:NaN}get seconds(){return this.isValid?this.values.seconds||0:NaN}get milliseconds(){return this.isValid?this.values.milliseconds||0:NaN}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}equals(e){if(!this.isValid||!e.isValid||!this.loc.equals(e.loc))return!1;function t(e,t){return e===void 0||e===0?t===void 0||t===0:e===t}for(let n of lr)if(!t(this.values[n],e.values[n]))return!1;return!0}},mr=`Invalid Interval`;function hr(e,t){return!e||!e.isValid?gr.invalid(`missing or invalid start`):!t||!t.isValid?gr.invalid(`missing or invalid end`):t<e?gr.invalid(`end before start`,`The end of an interval must be after its start, but you had start=${e.toISO()} and end=${t.toISO()}`):null}var gr=class e{constructor(e){this.s=e.start,this.e=e.end,this.invalid=e.invalid||null,this.isLuxonInterval=!0}static invalid(t,n=null){if(!t)throw new s(`need to specify a reason the Interval is invalid`);let i=t instanceof H?t:new H(t,n);if(V.throwOnInvalid)throw new r(i);return new e({invalid:i})}static fromDateTimes(t,n){let r=_i(t),i=_i(n);return hr(r,i)??new e({start:r,end:i})}static after(t,n){let r=X.fromDurationLike(n),i=_i(t);return e.fromDateTimes(i,i.plus(r))}static before(t,n){let r=X.fromDurationLike(n),i=_i(t);return e.fromDateTimes(i.minus(r),i)}static fromISO(t,n){let[r,i]=(t||``).split(`/`,2);if(r&&i){let t,a;try{t=$.fromISO(r,n),a=t.isValid}catch{a=!1}let o,s;try{o=$.fromISO(i,n),s=o.isValid}catch{s=!1}if(a&&s)return e.fromDateTimes(t,o);if(a){let r=X.fromISO(i,n);if(r.isValid)return e.after(t,r)}else if(s){let t=X.fromISO(r,n);if(t.isValid)return e.before(o,t)}}return e.invalid(`unparsable`,`the input "${t}" can't be parsed as ISO 8601`)}static isInterval(e){return e&&e.isLuxonInterval||!1}get start(){return this.isValid?this.s:null}get end(){return this.isValid?this.e:null}get lastDateTime(){return this.isValid&&this.e?this.e.minus(1):null}get isValid(){return this.invalidReason===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}length(e=`milliseconds`){return this.isValid?this.toDuration(e).get(e):NaN}count(e=`milliseconds`,t){if(!this.isValid)return NaN;let n=this.start.startOf(e,t),r;return r=t!=null&&t.useLocaleWeeks?this.end.reconfigure({locale:n.locale}):this.end,r=r.startOf(e,t),Math.floor(r.diff(n,e).get(e))+(r.valueOf()!==this.end.valueOf())}hasSame(e){return this.isValid?this.isEmpty()||this.e.minus(1).hasSame(this.s,e):!1}isEmpty(){return this.s.valueOf()===this.e.valueOf()}isAfter(e){return this.isValid?this.s>e:!1}isBefore(e){return this.isValid?this.e<=e:!1}contains(e){return this.isValid?this.s<=e&&this.e>e:!1}set({start:t,end:n}={}){return this.isValid?e.fromDateTimes(t||this.s,n||this.e):this}splitAt(...t){if(!this.isValid)return[];let n=t.map(_i).filter(e=>this.contains(e)).sort((e,t)=>e.toMillis()-t.toMillis()),r=[],{s:i}=this,a=0;for(;i<this.e;){let t=n[a]||this.e,o=+t>+this.e?this.e:t;r.push(e.fromDateTimes(i,o)),i=o,a+=1}return r}splitBy(t){let n=X.fromDurationLike(t);if(!this.isValid||!n.isValid||n.as(`milliseconds`)===0)return[];let{s:r}=this,i=1,a,o=[];for(;r<this.e;){let t=this.start.plus(n.mapUnits(e=>e*i));a=+t>+this.e?this.e:t,o.push(e.fromDateTimes(r,a)),r=a,i+=1}return o}divideEqually(e){return this.isValid?this.splitBy(this.length()/e).slice(0,e):[]}overlaps(e){return this.e>e.s&&this.s<e.e}abutsStart(e){return this.isValid?+this.e==+e.s:!1}abutsEnd(e){return this.isValid?+e.e==+this.s:!1}engulfs(e){return this.isValid?this.s<=e.s&&this.e>=e.e:!1}equals(e){return!this.isValid||!e.isValid?!1:this.s.equals(e.s)&&this.e.equals(e.e)}intersection(t){if(!this.isValid)return this;let n=this.s>t.s?this.s:t.s,r=this.e<t.e?this.e:t.e;return n>=r?null:e.fromDateTimes(n,r)}union(t){if(!this.isValid)return this;let n=this.s<t.s?this.s:t.s,r=this.e>t.e?this.e:t.e;return e.fromDateTimes(n,r)}static merge(e){let[t,n]=e.sort((e,t)=>e.s-t.s).reduce(([e,t],n)=>t?t.overlaps(n)||t.abutsStart(n)?[e,t.union(n)]:[e.concat([t]),n]:[e,n],[[],null]);return n&&t.push(n),t}static xor(t){let n=null,r=0,i=[],a=t.map(e=>[{time:e.s,type:`s`},{time:e.e,type:`e`}]),o=Array.prototype.concat(...a).sort((e,t)=>e.time-t.time);for(let t of o)r+=t.type===`s`?1:-1,r===1?n=t.time:(n&&+n!=+t.time&&i.push(e.fromDateTimes(n,t.time)),n=null);return e.merge(i)}difference(...t){return e.xor([this].concat(t)).map(e=>this.intersection(e)).filter(e=>e&&!e.isEmpty())}toString(){return this.isValid?`[${this.s.toISO()} – ${this.e.toISO()})`:mr}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`Interval { start: ${this.s.toISO()}, end: ${this.e.toISO()} }`:`Interval { Invalid, reason: ${this.invalidReason} }`}toLocaleString(e=f,t={}){return this.isValid?q.create(this.s.loc.clone(t),e).formatInterval(this):mr}toISO(e){return this.isValid?`${this.s.toISO(e)}/${this.e.toISO(e)}`:mr}toISODate(){return this.isValid?`${this.s.toISODate()}/${this.e.toISODate()}`:mr}toISOTime(e){return this.isValid?`${this.s.toISOTime(e)}/${this.e.toISOTime(e)}`:mr}toFormat(e,{separator:t=` – `}={}){return this.isValid?`${this.s.toFormat(e)}${t}${this.e.toFormat(e)}`:mr}toDuration(e,t){return this.isValid?this.e.diff(this.s,e,t):X.invalid(this.invalidReason)}mapEndpoints(t){return e.fromDateTimes(t(this.s),t(this.e))}},_r=class{static hasDST(e=V.defaultZone){let t=$.now().setZone(e).set({month:12});return!e.isUniversal&&t.offset!==t.set({month:6}).offset}static isValidIANAZone(e){return T.isValidZone(e)}static normalizeZone(e){return N(e,V.defaultZone)}static getStartOfWeek({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getStartOfWeek()}static getMinimumDaysInFirstWeek({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getMinDaysInFirstWeek()}static getWeekendWeekdays({locale:e=null,locObj:t=null}={}){return(t||A.create(e)).getWeekendDays().slice()}static months(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||A.create(t,n,i)).months(e)}static monthsFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null,outputCalendar:i=`gregory`}={}){return(r||A.create(t,n,i)).months(e,!0)}static weekdays(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||A.create(t,n,null)).weekdays(e)}static weekdaysFormat(e=`long`,{locale:t=null,numberingSystem:n=null,locObj:r=null}={}){return(r||A.create(t,n,null)).weekdays(e,!0)}static meridiems({locale:e=null}={}){return A.create(e).meridiems()}static eras(e=`short`,{locale:t=null}={}){return A.create(t,null,`gregory`).eras(e)}static features(){return{relative:ft(),localeWeek:pt()}}};function vr(e,t){let n=e=>e.toUTC(0,{keepLocalTime:!0}).startOf(`day`).valueOf(),r=n(t)-n(e);return Math.floor(X.fromMillis(r).as(`days`))}function yr(e,t,n){let r=[[`years`,(e,t)=>t.year-e.year],[`quarters`,(e,t)=>t.quarter-e.quarter+(t.year-e.year)*4],[`months`,(e,t)=>t.month-e.month+(t.year-e.year)*12],[`weeks`,(e,t)=>{let n=vr(e,t);return(n-n%7)/7}],[`days`,vr]],i={},a=e,o,s;for(let[c,l]of r)n.indexOf(c)>=0&&(o=c,i[c]=l(e,t),s=a.plus(i),s>t?(i[c]--,e=a.plus(i),e>t&&(s=e,i[c]--,e=a.plus(i))):e=s);return[e,i,s,o]}function br(e,t,n,r){let[i,a,o,s]=yr(e,t,n),c=t-i,l=n.filter(e=>[`hours`,`minutes`,`seconds`,`milliseconds`].indexOf(e)>=0);l.length===0&&(o<t&&(o=i.plus({[s]:1})),o!==i&&(a[s]=(a[s]||0)+c/(o-i)));let u=X.fromObject(a,r);return l.length>0?X.fromMillis(c,r).shiftTo(...l).plus(u):u}var xr=`missing Intl.DateTimeFormat.formatToParts support`;function Z(e,t=e=>e){return{regex:e,deser:([e])=>t(Be(e))}}var Sr=`[ \xA0]`,Cr=new RegExp(Sr,`g`);function wr(e){return e.replace(/\./g,`\\.?`).replace(Cr,Sr)}function Tr(e){return e.replace(/\./g,``).replace(Cr,` `).toLowerCase()}function Q(e,t){return e===null?null:{regex:RegExp(e.map(wr).join(`|`)),deser:([n])=>e.findIndex(e=>Tr(n)===Tr(e))+t}}function Er(e,t){return{regex:e,deser:([,e,t])=>Mt(e,t),groups:t}}function Dr(e){return{regex:e,deser:([e])=>e}}function Or(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,`\\$&`)}function kr(e,t){let n=I(t),r=I(t,`{2}`),i=I(t,`{3}`),a=I(t,`{4}`),o=I(t,`{6}`),s=I(t,`{1,2}`),c=I(t,`{1,3}`),l=I(t,`{1,6}`),u=I(t,`{1,9}`),d=I(t,`{2,4}`),f=I(t,`{4,6}`),p=e=>({regex:RegExp(Or(e.val)),deser:([e])=>e,literal:!0}),m=(m=>{if(e.literal)return p(m);switch(m.val){case`G`:return Q(t.eras(`short`),0);case`GG`:return Q(t.eras(`long`),0);case`y`:return Z(l);case`yy`:return Z(d,At);case`yyyy`:return Z(a);case`yyyyy`:return Z(f);case`yyyyyy`:return Z(o);case`M`:return Z(s);case`MM`:return Z(r);case`MMM`:return Q(t.months(`short`,!0),1);case`MMMM`:return Q(t.months(`long`,!0),1);case`L`:return Z(s);case`LL`:return Z(r);case`LLL`:return Q(t.months(`short`,!1),1);case`LLLL`:return Q(t.months(`long`,!1),1);case`d`:return Z(s);case`dd`:return Z(r);case`o`:return Z(c);case`ooo`:return Z(i);case`HH`:return Z(r);case`H`:return Z(s);case`hh`:return Z(r);case`h`:return Z(s);case`mm`:return Z(r);case`m`:return Z(s);case`q`:return Z(s);case`qq`:return Z(r);case`s`:return Z(s);case`ss`:return Z(r);case`S`:return Z(c);case`SSS`:return Z(i);case`u`:return Dr(u);case`uu`:return Dr(s);case`uuu`:return Z(n);case`a`:return Q(t.meridiems(),0);case`kkkk`:return Z(a);case`kk`:return Z(d,At);case`W`:return Z(s);case`WW`:return Z(r);case`E`:case`c`:return Z(n);case`EEE`:return Q(t.weekdays(`short`,!1),1);case`EEEE`:return Q(t.weekdays(`long`,!1),1);case`ccc`:return Q(t.weekdays(`short`,!0),1);case`cccc`:return Q(t.weekdays(`long`,!0),1);case`Z`:case`ZZ`:return Er(RegExp(`([+-]${s.source})(?::(${r.source}))?`),2);case`ZZZ`:return Er(RegExp(`([+-]${s.source})(${r.source})?`),2);case`z`:return Dr(/[a-z_+-/]{1,256}?/i);case` `:return Dr(/[^\S\n\r]/);default:return p(m)}})(e)||{invalidReason:xr};return m.token=e,m}var Ar={year:{"2-digit":`yy`,numeric:`yyyyy`},month:{numeric:`M`,"2-digit":`MM`,short:`MMM`,long:`MMMM`},day:{numeric:`d`,"2-digit":`dd`},weekday:{short:`EEE`,long:`EEEE`},dayperiod:`a`,dayPeriod:`a`,hour12:{numeric:`h`,"2-digit":`hh`},hour24:{numeric:`H`,"2-digit":`HH`},minute:{numeric:`m`,"2-digit":`mm`},second:{numeric:`s`,"2-digit":`ss`},timeZoneName:{long:`ZZZZZ`,short:`ZZZ`}};function jr(e,t,n){let{type:r,value:i}=e;if(r===`literal`){let e=/^\s+$/.test(i);return{literal:!e,val:e?` `:i}}let a=t[r],o=r;r===`hour`&&(o=t.hour12==null?t.hourCycle==null?n.hour12?`hour12`:`hour24`:t.hourCycle===`h11`||t.hourCycle===`h12`?`hour12`:`hour24`:t.hour12?`hour12`:`hour24`);let s=Ar[o];if(typeof s==`object`&&(s=s[a]),s)return{literal:!1,val:s}}function Mr(e){return[`^${e.map(e=>e.regex).reduce((e,t)=>`${e}(${t.source})`,``)}$`,e]}function Nr(e,t,n){let r=e.match(t);if(r){let e={},t=1;for(let i in n)if(_t(n,i)){let a=n[i],o=a.groups?a.groups+1:1;!a.literal&&a.token&&(e[a.token.val[0]]=a.deser(r.slice(t,t+o))),t+=o}return[r,e]}else return[r,{}]}function Pr(e){let t=e=>{switch(e){case`S`:return`millisecond`;case`s`:return`second`;case`m`:return`minute`;case`h`:case`H`:return`hour`;case`d`:return`day`;case`o`:return`ordinal`;case`L`:case`M`:return`month`;case`y`:return`year`;case`E`:case`c`:return`weekday`;case`W`:return`weekNumber`;case`k`:return`weekYear`;case`q`:return`quarter`;default:return null}},n=null,r;return W(e.z)||(n=T.create(e.z)),W(e.Z)||(n||=new j(e.Z),r=e.Z),W(e.q)||(e.M=(e.q-1)*3+1),W(e.h)||(e.h<12&&e.a===1?e.h+=12:e.h===12&&e.a===0&&(e.h=0)),e.G===0&&e.y&&(e.y=-e.y),W(e.u)||(e.S=St(e.u)),[Object.keys(e).reduce((n,r)=>{let i=t(r);return i&&(n[i]=e[r]),n},{}),n,r]}var Fr=null;function Ir(){return Fr||=$.fromMillis(1555555555555),Fr}function Lr(e,t){if(e.literal)return e;let n=Hr(q.macroTokenToFormatOpts(e.val),t);return n==null||n.includes(void 0)?e:n}function Rr(e,t){return Array.prototype.concat(...e.map(e=>Lr(e,t)))}var zr=class{constructor(e,t){if(this.locale=e,this.format=t,this.tokens=Rr(q.parseFormat(t),e),this.units=this.tokens.map(t=>kr(t,e)),this.disqualifyingUnit=this.units.find(e=>e.invalidReason),!this.disqualifyingUnit){let[e,t]=Mr(this.units);this.regex=RegExp(e,`i`),this.handlers=t}}explainFromTokens(e){if(this.isValid){let[t,n]=Nr(e,this.regex,this.handlers),[r,i,o]=n?Pr(n):[null,null,void 0];if(_t(n,`a`)&&_t(n,`H`))throw new a(`Can't include meridiem when specifying 24-hour format`);return{input:e,tokens:this.tokens,regex:this.regex,rawMatches:t,matches:n,result:r,zone:i,specificOffset:o}}else return{input:e,tokens:this.tokens,invalidReason:this.invalidReason}}get isValid(){return!this.disqualifyingUnit}get invalidReason(){return this.disqualifyingUnit?this.disqualifyingUnit.invalidReason:null}};function Br(e,t,n){return new zr(e,n).explainFromTokens(t)}function Vr(e,t,n){let{result:r,zone:i,specificOffset:a,invalidReason:o}=Br(e,t,n);return[r,i,a,o]}function Hr(e,t){if(!e)return null;let n=q.create(t,e).dtFormatter(Ir()),r=n.formatToParts(),i=n.resolvedOptions();return r.map(t=>jr(t,e,i))}var Ur=`Invalid DateTime`,Wr=864e13;function Gr(e){return new H(`unsupported zone`,`the zone "${e.name}" is not supported`)}function Kr(e){return e.weekData===null&&(e.weekData=$e(e.c)),e.weekData}function qr(e){return e.localWeekData===null&&(e.localWeekData=$e(e.c,e.loc.getMinDaysInFirstWeek(),e.loc.getStartOfWeek())),e.localWeekData}function Jr(e,t){let n={ts:e.ts,zone:e.zone,c:e.c,o:e.o,loc:e.loc,invalid:e.invalid};return new $({...n,...t,old:n})}function Yr(e,t,n){let r=e-t*60*1e3,i=n.offset(r);if(t===i)return[r,t];r-=(i-t)*60*1e3;let a=n.offset(r);return i===a?[r,i]:[e-Math.min(i,a)*60*1e3,Math.max(i,a)]}function Xr(e,t){e+=t*60*1e3;let n=new Date(e);return{year:n.getUTCFullYear(),month:n.getUTCMonth()+1,day:n.getUTCDate(),hour:n.getUTCHours(),minute:n.getUTCMinutes(),second:n.getUTCSeconds(),millisecond:n.getUTCMilliseconds()}}function Zr(e,t,n){return Yr(Dt(e),t,n)}function Qr(e,t){let n=e.o,r=e.c.year+Math.trunc(t.years),i=e.c.month+Math.trunc(t.months)+Math.trunc(t.quarters)*3,a={...e.c,year:r,month:i,day:Math.min(e.c.day,Et(r,i))+Math.trunc(t.days)+Math.trunc(t.weeks)*7},o=X.fromObject({years:t.years-Math.trunc(t.years),quarters:t.quarters-Math.trunc(t.quarters),months:t.months-Math.trunc(t.months),weeks:t.weeks-Math.trunc(t.weeks),days:t.days-Math.trunc(t.days),hours:t.hours,minutes:t.minutes,seconds:t.seconds,milliseconds:t.milliseconds}).as(`milliseconds`),[s,c]=Yr(Dt(a),n,e.zone);return o!==0&&(s+=o,c=e.zone.offset(s)),{ts:s,o:c}}function $r(e,t,n,r,i,a){let{setZone:o,zone:s}=n;if(e&&Object.keys(e).length!==0||t){let r=t||s,i=$.fromObject(e,{...n,zone:r,specificOffset:a});return o?i:i.setZone(s)}else return $.invalid(new H(`unparsable`,`the input "${i}" can't be parsed as ${r}`))}function ei(e,t,n=!0){return e.isValid?q.create(A.create(`en-US`),{allowZ:n,forceSimple:!0}).formatDateTimeFromString(e,t):null}function ti(e,t,n){let r=e.c.year>9999||e.c.year<0,i=``;if(r&&e.c.year>=0&&(i+=`+`),i+=K(e.c.year,r?6:4),n===`year`)return i;if(t){if(i+=`-`,i+=K(e.c.month),n===`month`)return i;i+=`-`}else if(i+=K(e.c.month),n===`month`)return i;return i+=K(e.c.day),i}function ni(e,t,n,r,i,a,o){let s=!n||e.c.millisecond!==0||e.c.second!==0,c=``;switch(o){case`day`:case`month`:case`year`:break;default:if(c+=K(e.c.hour),o===`hour`)break;if(t){if(c+=`:`,c+=K(e.c.minute),o===`minute`)break;s&&(c+=`:`,c+=K(e.c.second))}else{if(c+=K(e.c.minute),o===`minute`)break;s&&(c+=K(e.c.second))}if(o===`second`)break;s&&(!r||e.c.millisecond!==0)&&(c+=`.`,c+=K(e.c.millisecond,3))}return i&&(e.isOffsetFixed&&e.offset===0&&!a?c+=`Z`:e.o<0?(c+=`-`,c+=K(Math.trunc(-e.o/60)),c+=`:`,c+=K(Math.trunc(-e.o%60))):(c+=`+`,c+=K(Math.trunc(e.o/60)),c+=`:`,c+=K(Math.trunc(e.o%60)))),a&&(c+=`[`+e.zone.ianaName+`]`),c}var ri={month:1,day:1,hour:0,minute:0,second:0,millisecond:0},ii={weekNumber:1,weekday:1,hour:0,minute:0,second:0,millisecond:0},ai={ordinal:1,hour:0,minute:0,second:0,millisecond:0},oi=[`year`,`month`,`day`,`hour`,`minute`,`second`,`millisecond`],si=[`weekYear`,`weekNumber`,`weekday`,`hour`,`minute`,`second`,`millisecond`],ci=[`year`,`ordinal`,`hour`,`minute`,`second`,`millisecond`];function li(e){let t={year:`year`,years:`year`,month:`month`,months:`month`,day:`day`,days:`day`,hour:`hour`,hours:`hour`,minute:`minute`,minutes:`minute`,quarter:`quarter`,quarters:`quarter`,second:`second`,seconds:`second`,millisecond:`millisecond`,milliseconds:`millisecond`,weekday:`weekday`,weekdays:`weekday`,weeknumber:`weekNumber`,weeksnumber:`weekNumber`,weeknumbers:`weekNumber`,weekyear:`weekYear`,weekyears:`weekYear`,ordinal:`ordinal`}[e.toLowerCase()];if(!t)throw new o(e);return t}function ui(e){switch(e.toLowerCase()){case`localweekday`:case`localweekdays`:return`localWeekday`;case`localweeknumber`:case`localweeknumbers`:return`localWeekNumber`;case`localweekyear`:case`localweekyears`:return`localWeekYear`;default:return li(e)}}function di(e){if(hi===void 0&&(hi=V.now()),e.type!==`iana`)return e.offset(hi);let t=e.name,n=gi.get(t);return n===void 0&&(n=e.offset(hi),gi.set(t,n)),n}function fi(e,t){let n=N(t.zone,V.defaultZone);if(!n.isValid)return $.invalid(Gr(n));let r=A.fromObject(t),i,a;if(W(e.year))i=V.now();else{for(let t of oi)W(e[t])&&(e[t]=ri[t]);let t=ot(e)||st(e);if(t)return $.invalid(t);let r=di(n);[i,a]=Zr(e,r,n)}return new $({ts:i,zone:n,loc:r,o:a})}function pi(e,t,n){let r=W(n.round)?!0:n.round,i=W(n.rounding)?`trunc`:n.rounding,a=(e,a)=>(e=Ct(e,r||n.calendary?0:2,n.calendary?`round`:i),t.loc.clone(n).relFormatter(n).format(e,a)),o=r=>n.calendary?t.hasSame(e,r)?0:t.startOf(r).diff(e.startOf(r),r).get(r):t.diff(e,r).get(r);if(n.unit)return a(o(n.unit),n.unit);for(let e of n.units){let t=o(e);if(Math.abs(t)>=1)return a(t,e)}return a(e>t?-0:0,n.units[n.units.length-1])}function mi(e){let t={},n;return e.length>0&&typeof e[e.length-1]==`object`?(t=e[e.length-1],n=Array.from(e).slice(0,e.length-1)):n=Array.from(e),[t,n]}var hi,gi=new Map,$=class e{constructor(e){let t=e.zone||V.defaultZone,n=e.invalid||(Number.isNaN(e.ts)?new H(`invalid input`):null)||(t.isValid?null:Gr(t));this.ts=W(e.ts)?V.now():e.ts;let r=null,i=null;if(!n)if(e.old&&e.old.ts===this.ts&&e.old.zone.equals(t))[r,i]=[e.old.c,e.old.o];else{let a=ct(e.o)&&!e.old?e.o:t.offset(this.ts);r=Xr(this.ts,a),n=Number.isNaN(r.year)?new H(`invalid input`):null,r=n?null:r,i=n?null:a}this._zone=t,this.loc=e.loc||A.create(),this.invalid=n,this.weekData=null,this.localWeekData=null,this.c=r,this.o=i,this.isLuxonDateTime=!0}static now(){return new e({})}static local(){let[e,t]=mi(arguments),[n,r,i,a,o,s,c]=t;return fi({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static utc(){let[e,t]=mi(arguments),[n,r,i,a,o,s,c]=t;return e.zone=j.utcInstance,fi({year:n,month:r,day:i,hour:a,minute:o,second:s,millisecond:c},e)}static fromJSDate(t,n={}){let r=dt(t)?t.valueOf():NaN;if(Number.isNaN(r))return e.invalid(`invalid input`);let i=N(n.zone,V.defaultZone);return i.isValid?new e({ts:r,zone:i,loc:A.fromObject(n)}):e.invalid(Gr(i))}static fromMillis(t,n={}){if(!ct(t))throw new s(`fromMillis requires a numerical input, but received a ${typeof t} with value ${t}`);return t<-864e13||t>Wr?e.invalid(`Timestamp out of range`):new e({ts:t,zone:N(n.zone,V.defaultZone),loc:A.fromObject(n)})}static fromSeconds(t,n={}){if(ct(t))return new e({ts:t*1e3,zone:N(n.zone,V.defaultZone),loc:A.fromObject(n)});throw new s(`fromSeconds requires a numerical input`)}static fromObject(t,n={}){t||={};let r=N(n.zone,V.defaultZone);if(!r.isValid)return e.invalid(Gr(r));let i=A.fromObject(n),o=Pt(t,ui),{minDaysInFirstWeek:s,startOfWeek:c}=rt(o,i),l=V.now(),u=W(n.specificOffset)?r.offset(l):n.specificOffset,d=!W(o.ordinal),f=!W(o.year),p=!W(o.month)||!W(o.day),m=f||p,h=o.weekYear||o.weekNumber;if((m||d)&&h)throw new a(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(p&&d)throw new a(`Can't mix ordinal dates with month/day`);let g=h||o.weekday&&!m,_,v,y=Xr(l,u);g?(_=si,v=ii,y=$e(y,s,c)):d?(_=ci,v=ai,y=tt(y)):(_=oi,v=ri);let ee=!1;for(let e of _){let t=o[e];W(t)?ee?o[e]=v[e]:o[e]=y[e]:ee=!0}let te=(g?it(o,s,c):d?at(o):ot(o))||st(o);if(te)return e.invalid(te);let[ne,re]=Zr(g?et(o,s,c):d?nt(o):o,u,r),b=new e({ts:ne,zone:r,o:re,loc:i});return o.weekday&&m&&t.weekday!==b.weekday?e.invalid(`mismatched weekday`,`you can't specify both a weekday of ${o.weekday} and a date of ${b.toISO()}`):b.isValid?b:e.invalid(b.invalid)}static fromISO(e,t={}){let[n,r]=Jn(e);return $r(n,r,t,`ISO 8601`,e)}static fromRFC2822(e,t={}){let[n,r]=Yn(e);return $r(n,r,t,`RFC 2822`,e)}static fromHTTP(e,t={}){let[n,r]=Xn(e);return $r(n,r,t,`HTTP`,t)}static fromFormat(t,n,r={}){if(W(t)||W(n))throw new s(`fromFormat requires an input string and a format`);let{locale:i=null,numberingSystem:a=null}=r,[o,c,l,u]=Vr(A.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0}),t,n);return u?e.invalid(u):$r(o,c,r,`format ${n}`,t,l)}static fromString(t,n,r={}){return e.fromFormat(t,n,r)}static fromSQL(e,t={}){let[n,r]=rr(e);return $r(n,r,t,`SQL`,e)}static invalid(t,r=null){if(!t)throw new s(`need to specify a reason the DateTime is invalid`);let i=t instanceof H?t:new H(t,r);if(V.throwOnInvalid)throw new n(i);return new e({invalid:i})}static isDateTime(e){return e&&e.isLuxonDateTime||!1}static parseFormatForOpts(e,t={}){let n=Hr(e,A.fromObject(t));return n?n.map(e=>e?e.val:null).join(``):null}static expandFormat(e,t={}){return Rr(q.parseFormat(e),A.fromObject(t)).map(e=>e.val).join(``)}static resetCache(){hi=void 0,gi.clear()}get(e){return this[e]}get isValid(){return this.invalid===null}get invalidReason(){return this.invalid?this.invalid.reason:null}get invalidExplanation(){return this.invalid?this.invalid.explanation:null}get locale(){return this.isValid?this.loc.locale:null}get numberingSystem(){return this.isValid?this.loc.numberingSystem:null}get outputCalendar(){return this.isValid?this.loc.outputCalendar:null}get zone(){return this._zone}get zoneName(){return this.isValid?this.zone.name:null}get year(){return this.isValid?this.c.year:NaN}get quarter(){return this.isValid?Math.ceil(this.c.month/3):NaN}get month(){return this.isValid?this.c.month:NaN}get day(){return this.isValid?this.c.day:NaN}get hour(){return this.isValid?this.c.hour:NaN}get minute(){return this.isValid?this.c.minute:NaN}get second(){return this.isValid?this.c.second:NaN}get millisecond(){return this.isValid?this.c.millisecond:NaN}get weekYear(){return this.isValid?Kr(this).weekYear:NaN}get weekNumber(){return this.isValid?Kr(this).weekNumber:NaN}get weekday(){return this.isValid?Kr(this).weekday:NaN}get isWeekend(){return this.isValid&&this.loc.getWeekendDays().includes(this.weekday)}get localWeekday(){return this.isValid?qr(this).weekday:NaN}get localWeekNumber(){return this.isValid?qr(this).weekNumber:NaN}get localWeekYear(){return this.isValid?qr(this).weekYear:NaN}get ordinal(){return this.isValid?tt(this.c).ordinal:NaN}get monthShort(){return this.isValid?_r.months(`short`,{locObj:this.loc})[this.month-1]:null}get monthLong(){return this.isValid?_r.months(`long`,{locObj:this.loc})[this.month-1]:null}get weekdayShort(){return this.isValid?_r.weekdays(`short`,{locObj:this.loc})[this.weekday-1]:null}get weekdayLong(){return this.isValid?_r.weekdays(`long`,{locObj:this.loc})[this.weekday-1]:null}get offset(){return this.isValid?+this.o:NaN}get offsetNameShort(){return this.isValid?this.zone.offsetName(this.ts,{format:`short`,locale:this.locale}):null}get offsetNameLong(){return this.isValid?this.zone.offsetName(this.ts,{format:`long`,locale:this.locale}):null}get isOffsetFixed(){return this.isValid?this.zone.isUniversal:null}get isInDST(){return this.isOffsetFixed?!1:this.offset>this.set({month:1,day:1}).offset||this.offset>this.set({month:5}).offset}getPossibleOffsets(){if(!this.isValid||this.isOffsetFixed)return[this];let e=864e5,t=6e4,n=Dt(this.c),r=this.zone.offset(n-e),i=this.zone.offset(n+e),a=this.zone.offset(n-r*t),o=this.zone.offset(n-i*t);if(a===o)return[this];let s=n-a*t,c=n-o*t,l=Xr(s,a),u=Xr(c,o);return l.hour===u.hour&&l.minute===u.minute&&l.second===u.second&&l.millisecond===u.millisecond?[Jr(this,{ts:s}),Jr(this,{ts:c})]:[this]}get isInLeapYear(){return wt(this.year)}get daysInMonth(){return Et(this.year,this.month)}get daysInYear(){return this.isValid?Tt(this.year):NaN}get weeksInWeekYear(){return this.isValid?kt(this.weekYear):NaN}get weeksInLocalWeekYear(){return this.isValid?kt(this.localWeekYear,this.loc.getMinDaysInFirstWeek(),this.loc.getStartOfWeek()):NaN}resolvedLocaleOptions(e={}){let{locale:t,numberingSystem:n,calendar:r}=q.create(this.loc.clone(e),e).resolvedOptions(this);return{locale:t,numberingSystem:n,outputCalendar:r}}toUTC(e=0,t={}){return this.setZone(j.instance(e),t)}toLocal(){return this.setZone(V.defaultZone)}setZone(t,{keepLocalTime:n=!1,keepCalendarTime:r=!1}={}){if(t=N(t,V.defaultZone),t.equals(this.zone))return this;if(t.isValid){let e=this.ts;if(n||r){let n=t.offset(this.ts),r=this.toObject();[e]=Zr(r,n,t)}return Jr(this,{ts:e,zone:t})}else return e.invalid(Gr(t))}reconfigure({locale:e,numberingSystem:t,outputCalendar:n}={}){let r=this.loc.clone({locale:e,numberingSystem:t,outputCalendar:n});return Jr(this,{loc:r})}setLocale(e){return this.reconfigure({locale:e})}set(e){if(!this.isValid)return this;let t=Pt(e,ui),{minDaysInFirstWeek:n,startOfWeek:r}=rt(t,this.loc),i=!W(t.weekYear)||!W(t.weekNumber)||!W(t.weekday),o=!W(t.ordinal),s=!W(t.year),c=!W(t.month)||!W(t.day),l=s||c,u=t.weekYear||t.weekNumber;if((l||o)&&u)throw new a(`Can't mix weekYear/weekNumber units with year/month/day or ordinals`);if(c&&o)throw new a(`Can't mix ordinal dates with month/day`);let d;i?d=et({...$e(this.c,n,r),...t},n,r):W(t.ordinal)?(d={...this.toObject(),...t},W(t.day)&&(d.day=Math.min(Et(d.year,d.month),d.day))):d=nt({...tt(this.c),...t});let[f,p]=Zr(d,this.o,this.zone);return Jr(this,{ts:f,o:p})}plus(e){if(!this.isValid)return this;let t=X.fromDurationLike(e);return Jr(this,Qr(this,t))}minus(e){if(!this.isValid)return this;let t=X.fromDurationLike(e).negate();return Jr(this,Qr(this,t))}startOf(e,{useLocaleWeeks:t=!1}={}){if(!this.isValid)return this;let n={},r=X.normalizeUnit(e);switch(r){case`years`:n.month=1;case`quarters`:case`months`:n.day=1;case`weeks`:case`days`:n.hour=0;case`hours`:n.minute=0;case`minutes`:n.second=0;case`seconds`:n.millisecond=0;break}if(r===`weeks`)if(t){let e=this.loc.getStartOfWeek(),{weekday:t}=this;t<e&&(n.weekNumber=this.weekNumber-1),n.weekday=e}else n.weekday=1;return r===`quarters`&&(n.month=(Math.ceil(this.month/3)-1)*3+1),this.set(n)}endOf(e,t){return this.isValid?this.plus({[e]:1}).startOf(e,t).minus(1):this}toFormat(e,t={}){return this.isValid?q.create(this.loc.redefaultToEN(t)).formatDateTimeFromString(this,e):Ur}toLocaleString(e=f,t={}){return this.isValid?q.create(this.loc.clone(t),e).formatDateTime(this):Ur}toLocaleParts(e={}){return this.isValid?q.create(this.loc.clone(e),e).formatDateTimeParts(this):[]}toISO({format:e=`extended`,suppressSeconds:t=!1,suppressMilliseconds:n=!1,includeOffset:r=!0,extendedZone:i=!1,precision:a=`milliseconds`}={}){if(!this.isValid)return null;a=li(a);let o=e===`extended`,s=ti(this,o,a);return oi.indexOf(a)>=3&&(s+=`T`),s+=ni(this,o,t,n,r,i,a),s}toISODate({format:e=`extended`,precision:t=`day`}={}){return this.isValid?ti(this,e===`extended`,li(t)):null}toISOWeekDate(){return ei(this,`kkkk-'W'WW-c`)}toISOTime({suppressMilliseconds:e=!1,suppressSeconds:t=!1,includeOffset:n=!0,includePrefix:r=!1,extendedZone:i=!1,format:a=`extended`,precision:o=`milliseconds`}={}){return this.isValid?(o=li(o),(r&&oi.indexOf(o)>=3?`T`:``)+ni(this,a===`extended`,t,e,n,i,o)):null}toRFC2822(){return ei(this,`EEE, dd LLL yyyy HH:mm:ss ZZZ`,!1)}toHTTP(){return ei(this.toUTC(),`EEE, dd LLL yyyy HH:mm:ss 'GMT'`)}toSQLDate(){return this.isValid?ti(this,!0):null}toSQLTime({includeOffset:e=!0,includeZone:t=!1,includeOffsetSpace:n=!0}={}){let r=`HH:mm:ss.SSS`;return(t||e)&&(n&&(r+=` `),t?r+=`z`:e&&(r+=`ZZ`)),ei(this,r,!0)}toSQL(e={}){return this.isValid?`${this.toSQLDate()} ${this.toSQLTime(e)}`:null}toString(){return this.isValid?this.toISO():Ur}[Symbol.for(`nodejs.util.inspect.custom`)](){return this.isValid?`DateTime { ts: ${this.toISO()}, zone: ${this.zone.name}, locale: ${this.locale} }`:`DateTime { Invalid, reason: ${this.invalidReason} }`}valueOf(){return this.toMillis()}toMillis(){return this.isValid?this.ts:NaN}toSeconds(){return this.isValid?this.ts/1e3:NaN}toUnixInteger(){return this.isValid?Math.floor(this.ts/1e3):NaN}toJSON(){return this.toISO()}toBSON(){return this.toJSDate()}toObject(e={}){if(!this.isValid)return{};let t={...this.c};return e.includeConfig&&(t.outputCalendar=this.outputCalendar,t.numberingSystem=this.loc.numberingSystem,t.locale=this.loc.locale),t}toJSDate(){return new Date(this.isValid?this.ts:NaN)}diff(e,t=`milliseconds`,n={}){if(!this.isValid||!e.isValid)return X.invalid(`created by diffing an invalid DateTime`);let r={locale:this.locale,numberingSystem:this.numberingSystem,...n},i=mt(t).map(X.normalizeUnit),a=e.valueOf()>this.valueOf(),o=br(a?this:e,a?e:this,i,r);return a?o.negate():o}diffNow(t=`milliseconds`,n={}){return this.diff(e.now(),t,n)}until(e){return this.isValid?gr.fromDateTimes(this,e):this}hasSame(e,t,n){if(!this.isValid)return!1;let r=e.valueOf(),i=this.setZone(e.zone,{keepLocalTime:!0});return i.startOf(t,n)<=r&&r<=i.endOf(t,n)}equals(e){return this.isValid&&e.isValid&&this.valueOf()===e.valueOf()&&this.zone.equals(e.zone)&&this.loc.equals(e.loc)}toRelative(t={}){if(!this.isValid)return null;let n=t.base||e.fromObject({},{zone:this.zone}),r=t.padding?this<n?-t.padding:t.padding:0,i=[`years`,`months`,`days`,`hours`,`minutes`,`seconds`],a=t.unit;return Array.isArray(t.unit)&&(i=t.unit,a=void 0),pi(n,this.plus(r),{...t,numeric:`always`,units:i,unit:a})}toRelativeCalendar(t={}){return this.isValid?pi(t.base||e.fromObject({},{zone:this.zone}),this,{...t,numeric:`auto`,units:[`years`,`months`,`days`],calendary:!0}):null}static min(...t){if(!t.every(e.isDateTime))throw new s(`min requires all arguments be DateTimes`);return ht(t,e=>e.valueOf(),Math.min)}static max(...t){if(!t.every(e.isDateTime))throw new s(`max requires all arguments be DateTimes`);return ht(t,e=>e.valueOf(),Math.max)}static fromFormatExplain(e,t,n={}){let{locale:r=null,numberingSystem:i=null}=n;return Br(A.fromOpts({locale:r,numberingSystem:i,defaultToEN:!0}),e,t)}static fromStringExplain(t,n,r={}){return e.fromFormatExplain(t,n,r)}static buildFormatParser(e,t={}){let{locale:n=null,numberingSystem:r=null}=t;return new zr(A.fromOpts({locale:n,numberingSystem:r,defaultToEN:!0}),e)}static fromFormatParser(t,n,r={}){if(W(t)||W(n))throw new s(`fromFormatParser requires an input string and a format parser`);let{locale:i=null,numberingSystem:a=null}=r,o=A.fromOpts({locale:i,numberingSystem:a,defaultToEN:!0});if(!o.equals(n.locale))throw new s(`fromFormatParser called with a locale of ${o}, but the format parser was created for ${n.locale}`);let{result:c,zone:l,specificOffset:u,invalidReason:d}=n.explainFromTokens(t);return d?e.invalid(d):$r(c,l,r,`format ${n.format}`,t,u)}static get DATE_SHORT(){return f}static get DATE_MED(){return p}static get DATE_MED_WITH_WEEKDAY(){return m}static get DATE_FULL(){return h}static get DATE_HUGE(){return g}static get TIME_SIMPLE(){return _}static get TIME_WITH_SECONDS(){return v}static get TIME_WITH_SHORT_OFFSET(){return y}static get TIME_WITH_LONG_OFFSET(){return ee}static get TIME_24_SIMPLE(){return te}static get TIME_24_WITH_SECONDS(){return ne}static get TIME_24_WITH_SHORT_OFFSET(){return re}static get TIME_24_WITH_LONG_OFFSET(){return b}static get DATETIME_SHORT(){return x}static get DATETIME_SHORT_WITH_SECONDS(){return ie}static get DATETIME_MED(){return ae}static get DATETIME_MED_WITH_SECONDS(){return oe}static get DATETIME_MED_WITH_WEEKDAY(){return se}static get DATETIME_FULL(){return ce}static get DATETIME_FULL_WITH_SECONDS(){return le}static get DATETIME_HUGE(){return ue}static get DATETIME_HUGE_WITH_SECONDS(){return de}};function _i(e){if($.isDateTime(e))return e;if(e&&e.valueOf&&ct(e.valueOf()))return $.fromJSDate(e);if(e&&typeof e==`object`)return $.fromObject(e);throw new s(`Unknown datetime argument: ${e}, of type ${typeof e}`)}e.DateTime=$,e.Duration=X,e.FixedOffsetZone=j,e.IANAZone=T,e.Info=_r,e.Interval=gr,e.InvalidZone=M,e.Settings=V,e.SystemZone=pe,e.VERSION=`3.7.2`,e.Zone=S})),le=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronDate=e.DAYS_IN_MONTH=e.DateMathOp=e.TimeUnit=void 0;var t=ce(),n;(function(e){e.Second=`Second`,e.Minute=`Minute`,e.Hour=`Hour`,e.Day=`Day`,e.Month=`Month`,e.Year=`Year`})(n||(e.TimeUnit=n={}));var r;(function(e){e.Add=`Add`,e.Subtract=`Subtract`})(r||(e.DateMathOp=r={})),e.DAYS_IN_MONTH=Object.freeze([31,29,31,30,31,30,31,31,30,31,30,31]);var i=class i{#e;#t=null;#n=null;#r={add:{[n.Year]:this.addYear.bind(this),[n.Month]:this.addMonth.bind(this),[n.Day]:this.addDay.bind(this),[n.Hour]:this.addHour.bind(this),[n.Minute]:this.addMinute.bind(this),[n.Second]:this.addSecond.bind(this)},subtract:{[n.Year]:this.subtractYear.bind(this),[n.Month]:this.subtractMonth.bind(this),[n.Day]:this.subtractDay.bind(this),[n.Hour]:this.subtractHour.bind(this),[n.Minute]:this.subtractMinute.bind(this),[n.Second]:this.subtractSecond.bind(this)}};constructor(e,n){let r={zone:n};if(e?e instanceof i?(this.#e=e.#e,this.#t=e.#t,this.#n=e.#n):e instanceof Date?this.#e=t.DateTime.fromJSDate(e,r):typeof e==`number`?this.#e=t.DateTime.fromMillis(e,r):(this.#e=t.DateTime.fromISO(e,r),this.#e.isValid||(this.#e=t.DateTime.fromRFC2822(e,r)),this.#e.isValid||(this.#e=t.DateTime.fromSQL(e,r)),this.#e.isValid||(this.#e=t.DateTime.fromFormat(e,`EEE, d MMM yyyy HH:mm:ss`,r))):this.#e=t.DateTime.local(),!this.#e.isValid)throw Error(`CronDate: unhandled timestamp: ${e}`);n&&n!==this.#e.zoneName&&(this.#e=this.#e.setZone(n))}static#i(e){return e%4==0&&e%100!=0||e%400==0}get dstStart(){return this.#t}set dstStart(e){this.#t=e}get dstEnd(){return this.#n}set dstEnd(e){this.#n=e}addYear(){this.#e=this.#e.plus({years:1})}addMonth(){this.#e=this.#e.plus({months:1}).startOf(`month`)}addDay(){this.#e=this.#e.plus({days:1}).startOf(`day`)}addHour(){this.#e=this.#e.plus({hours:1}).startOf(`hour`)}addMinute(){this.#e=this.#e.plus({minutes:1}).startOf(`minute`)}addSecond(){this.#e=this.#e.plus({seconds:1})}subtractYear(){this.#e=this.#e.minus({years:1})}subtractMonth(){this.#e=this.#e.minus({months:1}).endOf(`month`).startOf(`second`)}subtractDay(){this.#e=this.#e.minus({days:1}).endOf(`day`).startOf(`second`)}subtractHour(){this.#e=this.#e.minus({hours:1}).endOf(`hour`).startOf(`second`)}subtractMinute(){this.#e=this.#e.minus({minutes:1}).endOf(`minute`).startOf(`second`)}subtractSecond(){this.#e=this.#e.minus({seconds:1})}addUnit(e){this.#r.add[e]()}subtractUnit(e){this.#r.subtract[e]()}invokeDateOperation(e,t){if(e===r.Add){this.addUnit(t);return}if(e===r.Subtract){this.subtractUnit(t);return}throw Error(`Invalid verb: ${e}`)}getDate(){return this.#e.day}getFullYear(){return this.#e.year}getDay(){let e=this.#e.weekday;return e===7?0:e}getMonth(){return this.#e.month-1}getHours(){return this.#e.hour}getMinutes(){return this.#e.minute}getSeconds(){return this.#e.second}getMilliseconds(){return this.#e.millisecond}getUTCOffset(){return this.#e.offset}setStartOfDay(){this.#e=this.#e.startOf(`day`)}setEndOfDay(){this.#e=this.#e.endOf(`day`)}getTime(){return this.#e.valueOf()}getUTCDate(){return this.#a().day}getUTCFullYear(){return this.#a().year}getUTCDay(){let e=this.#a().weekday;return e===7?0:e}getUTCMonth(){return this.#a().month-1}getUTCHours(){return this.#a().hour}getUTCMinutes(){return this.#a().minute}getUTCSeconds(){return this.#a().second}toISOString(){return this.#e.toUTC().toISO()}toJSON(){return this.#e.toJSON()}setDate(e){this.#e=this.#e.set({day:e})}setFullYear(e){this.#e=this.#e.set({year:e})}setDay(e){this.#e=this.#e.set({weekday:e})}setMonth(e){this.#e=this.#e.set({month:e+1})}setHours(e){this.#e=this.#e.set({hour:e})}setMinutes(e){this.#e=this.#e.set({minute:e})}setSeconds(e){this.#e=this.#e.set({second:e})}setMilliseconds(e){this.#e=this.#e.set({millisecond:e})}toString(){return this.toDate().toString()}toDate(){return this.#e.toJSDate()}isLastDayOfMonth(){let{day:t,month:n}=this.#e;if(n===2){let r=i.#i(this.#e.year);return t===e.DAYS_IN_MONTH[n-1]-+!r}return t===e.DAYS_IN_MONTH[n-1]}isLastWeekdayOfMonth(){let{day:t,month:n}=this.#e,r;return r=n===2?e.DAYS_IN_MONTH[n-1]-+!i.#i(this.#e.year):e.DAYS_IN_MONTH[n-1],t>r-7}applyDateOperation(e,t,r){if(t===n.Month||t===n.Day){this.invokeDateOperation(e,t);return}let i=this.getHours();this.invokeDateOperation(e,t);let a=this.getHours(),o=a-i;o===2?r!==24&&(this.dstStart=a):o===0&&this.getMinutes()===0&&this.getSeconds()===0&&r!==24&&(this.dstEnd=a)}#a(){return this.#e.toUTC()}};e.CronDate=i,e.default=i})),ue=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronMonth=void 0;var t=le(),n=x(),r=1,i=12,a=Object.freeze([]);e.CronMonth=class extends n.CronField{static get min(){return r}static get max(){return i}static get chars(){return a}static get daysInMonth(){return t.DAYS_IN_MONTH}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),de=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronSecond=void 0;var t=x(),n=0,r=59,i=Object.freeze([]);e.CronSecond=class extends t.CronField{static get min(){return n}static get max(){return r}static get chars(){return i}constructor(e,t){super(e,t),this.validate()}get values(){return super.values}}})),S=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),n(b(),e),n(ie(),e),n(ae(),e),n(x(),e),n(oe(),e),n(se(),e),n(ue(),e),n(de(),e)})),fe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronFieldCollection=void 0;var t=S();e.CronFieldCollection=class e{#e;#t;#n;#r;#i;#a;static from(n,r){return new e({second:this.resolveField(t.CronSecond,n.second,r.second),minute:this.resolveField(t.CronMinute,n.minute,r.minute),hour:this.resolveField(t.CronHour,n.hour,r.hour),dayOfMonth:this.resolveField(t.CronDayOfMonth,n.dayOfMonth,r.dayOfMonth),month:this.resolveField(t.CronMonth,n.month,r.month),dayOfWeek:this.resolveField(t.CronDayOfWeek,n.dayOfWeek,r.dayOfWeek)})}static resolveField(e,n,r){return r?r instanceof t.CronField?r:new e(r):n}constructor({second:e,minute:n,hour:r,dayOfMonth:i,month:a,dayOfWeek:o}){if(!e)throw Error(`Validation error, Field second is missing`);if(!n)throw Error(`Validation error, Field minute is missing`);if(!r)throw Error(`Validation error, Field hour is missing`);if(!i)throw Error(`Validation error, Field dayOfMonth is missing`);if(!a)throw Error(`Validation error, Field month is missing`);if(!o)throw Error(`Validation error, Field dayOfWeek is missing`);if(a.values.length===1&&!i.hasLastChar&&!(parseInt(i.values[0],10)<=t.CronMonth.daysInMonth[a.values[0]-1]))throw Error(`Invalid explicit day of month definition`);this.#e=e,this.#t=n,this.#n=r,this.#i=a,this.#a=o,this.#r=i}get second(){return this.#e}get minute(){return this.#t}get hour(){return this.#n}get dayOfMonth(){return this.#r}get month(){return this.#i}get dayOfWeek(){return this.#a}static compactField(e){if(e.length===0)return[];let t=[],n;return e.forEach((e,r,i)=>{if(n===void 0){n={start:e,count:1};return}let a=i[r-1]||n.start,o=i[r+1];if(e===`L`||e===`W`){t.push(n),t.push({start:e,count:1}),n=void 0;return}if(n.step===void 0&&o!==void 0){let t=e-a;if(t<=o-e){n={...n,count:2,end:e,step:t};return}n.step=1}e-(n.end??0)===n.step?(n.count++,n.end=e):(n.count===1?t.push({start:n.start,count:1}):n.count===2?(t.push({start:n.start,count:1}),t.push({start:n.end??a,count:1})):t.push(n),n={start:e,count:1})}),n&&t.push(n),t}static#o(e,t,n){let r=t.step;return r?r===1&&t.start===e.min&&t.end&&t.end>=n?e.hasQuestionMarkChar?`?`:`*`:r!==1&&t.start===e.min&&t.end&&t.end>=n-r+1?`*/${r}`:null:null}static#s(e,t){let n=e.step;if(n===1)return`${e.start}-${e.end}`;let r=e.start===0?e.count-1:e.count;if(!n)throw Error(`Unexpected range step`);if(!e.end)throw Error(`Unexpected range end`);if(n*r>e.end){let t=(t,r)=>{if(typeof e.start!=`number`)throw Error(`Unexpected range start`);return r%n===0?e.start+r:null};if(typeof e.start!=`number`)throw Error(`Unexpected range start`);let r={length:e.end-e.start+1};return Array.from(r,t).filter(e=>e!==null).join(`,`)}return e.end===t-n+1?`${e.start}/${n}`:`${e.start}-${e.end}/${n}`}stringifyField(n){let r=n.max,i=n.values;if(n instanceof t.CronDayOfWeek){r=6;let e=this.#a.values;i=e[e.length-1]===7?e.slice(0,-1):e}n instanceof t.CronDayOfMonth&&(r=this.#i.values.length===1?t.CronMonth.daysInMonth[this.#i.values[0]-1]:n.max);let a=e.compactField(i);if(a.length===1){let t=e.#o(n,a[0],r);if(t)return t}return a.map(i=>{let a=i.count===1?i.start.toString():e.#s(i,r);return n instanceof t.CronDayOfWeek&&n.nthDay>0?`${a}#${n.nthDay}`:a}).join(`,`)}stringify(e=!1){let t=[];return e&&t.push(this.stringifyField(this.#e)),t.push(this.stringifyField(this.#t),this.stringifyField(this.#n),this.stringifyField(this.#r),this.stringifyField(this.#i),this.stringifyField(this.#a)),t.join(` `)}serialize(){return{second:this.#e.serialize(),minute:this.#t.serialize(),hour:this.#n.serialize(),dayOfMonth:this.#r.serialize(),month:this.#i.serialize(),dayOfWeek:this.#a.serialize()}}}})),pe=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpression=e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=void 0;var t=le();e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE=`Out of the time span range`,e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE=`Invalid expression, loop limit exceeded`;var n=1e4,r=class r{#e;#t;#n;#r;#i;#a;#o=null;#s=!1;constructor(e,n){this.#e=n,this.#t=n.tz,this.#r=n.startDate?new t.CronDate(n.startDate,this.#t):null,this.#i=n.endDate?new t.CronDate(n.endDate,this.#t):null;let r=n.currentDate??n.startDate;if(r){let e=new t.CronDate(r,this.#t);this.#r&&e.getTime()<this.#r.getTime()?r=this.#r:this.#i&&e.getTime()>this.#i.getTime()&&(r=this.#i)}this.#n=new t.CronDate(r,this.#t),this.#a=e}get fields(){return this.#a}static fieldsToExpression(e,t){return new r(e,t||{})}static#c(e,t){return t.some(t=>t===e)}#l(e,t){return e[t?e.length-1:0]}#u(e){let n=`${e.getFullYear()}-${e.getMonth()+1}-${e.getDate()}`;if(this.#o===n)return this.#s;let r=new t.CronDate(e);r.setStartOfDay();let i=new t.CronDate(e);return i.setEndOfDay(),this.#o=n,this.#s=r.getUTCOffset()!==i.getUTCOffset(),this.#s}#d(e,n,r){let i=this.#a.second.values,a=e.getSeconds(),o=this.#a.second.findNearestValue(a,r);if(o!==null){e.setSeconds(o);return}e.applyDateOperation(n,t.TimeUnit.Minute,this.#a.hour.values.length),e.setSeconds(this.#l(i,r))}#f(e,n,r){let i=this.#a.minute.values,a=this.#a.second.values,o=e.getMinutes(),s=this.#a.minute.findNearestValue(o,r);if(s!==null){e.setMinutes(s),e.setSeconds(this.#l(a,r));return}e.applyDateOperation(n,t.TimeUnit.Hour,this.#a.hour.values.length),e.setMinutes(this.#l(i,r)),e.setSeconds(this.#l(a,r))}static#p(e,t){let n=t.isLastWeekdayOfMonth();return e.some(e=>{let r=parseInt(e.toString().charAt(0),10)%7;if(Number.isNaN(r))throw Error(`Invalid last weekday of the month expression: ${e}`);return t.getDay()===r&&n})}next(){return this.#_()}prev(){return this.#_(!0)}hasNext(){let e=this.#n;try{return this.#_(),!0}catch{return!1}finally{this.#n=e}}hasPrev(){let e=this.#n;try{return this.#_(!0),!0}catch{return!1}finally{this.#n=e}}take(e){let t=[];if(e>=0)for(let n=0;n<e;n++)try{t.push(this.next())}catch{return t}else for(let n=0;n>e;n--)try{t.push(this.prev())}catch{return t}return t}reset(e){this.#n=new t.CronDate(e||this.#e.currentDate)}stringify(e=!1){return this.#a.stringify(e)}includesDate(e){let{second:n,minute:r,hour:i,month:a}=this.#a,o=new t.CronDate(e,this.#t);return!(!n.values.includes(o.getSeconds())||!r.values.includes(o.getMinutes())||!i.values.includes(o.getHours())||!a.values.includes(o.getMonth()+1)||!this.#m(o)||this.#a.dayOfWeek.nthDay>0&&Math.ceil(o.getDate()/7)!==this.#a.dayOfWeek.nthDay)}toString(){return this.#e.expression||this.stringify(!0)}#m(e){let t=this.#a.dayOfMonth.isWildcard,n=!t,i=this.#a.dayOfWeek.isWildcard,a=!i,o=r.#c(e.getDate(),this.#a.dayOfMonth.values)||this.#a.dayOfMonth.hasLastChar&&e.isLastDayOfMonth(),s=r.#c(e.getDay(),this.#a.dayOfWeek.values)||this.#a.dayOfWeek.hasLastChar&&r.#p(this.#a.dayOfWeek.values,e);return!!(n&&a&&(o||s)||o&&!a||t&&!i&&s)}#h(e,n,i){let a=this.#a.hour.values,o=a,s=e.getHours(),c=r.#c(s,a),l=e.dstStart===s,u=e.dstEnd===s;if(l)return r.#c(s-1,a)?!0:(e.invokeDateOperation(n,t.TimeUnit.Hour),!1);if(u&&!i)return e.dstEnd=null,e.applyDateOperation(t.DateMathOp.Add,t.TimeUnit.Hour,o.length),!1;if(c)return!0;e.dstStart=null;let d=this.#a.hour.findNearestValue(s,i);if(d===null)return e.applyDateOperation(n,t.TimeUnit.Day,o.length),!1;if(this.#u(e)){let r=i?s-d:d-s;for(let i=0;i<r;i++)e.applyDateOperation(n,t.TimeUnit.Hour,o.length)}else e.setHours(d);return e.setMinutes(this.#l(this.#a.minute.values,i)),e.setSeconds(this.#l(this.#a.second.values,i)),!1}#g(t){if(!this.#r&&!this.#i)return;let n=t.getTime();if(this.#r&&n<this.#r.getTime()||this.#i&&n>this.#i.getTime())throw Error(e.TIME_SPAN_OUT_OF_BOUNDS_ERROR_MESSAGE)}#_(i=!1){let a=i?t.DateMathOp.Subtract:t.DateMathOp.Add,o=new t.CronDate(this.#n),s=o.getTime(),c=0;for(;++c<n;){if(this.#g(o),!this.#m(o)){o.applyDateOperation(a,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!(this.#a.dayOfWeek.nthDay<=0||Math.ceil(o.getDate()/7)===this.#a.dayOfWeek.nthDay)){o.applyDateOperation(a,t.TimeUnit.Day,this.#a.hour.values.length);continue}if(!r.#c(o.getMonth()+1,this.#a.month.values)){o.applyDateOperation(a,t.TimeUnit.Month,this.#a.hour.values.length);continue}if(this.#h(o,a,i)){if(!r.#c(o.getMinutes(),this.#a.minute.values)){this.#f(o,a,i);continue}if(!r.#c(o.getSeconds(),this.#a.second.values)){this.#d(o,a,i);continue}if(s===o.getTime()){(a===`Add`||o.getMilliseconds()===0)&&o.applyDateOperation(a,t.TimeUnit.Second,this.#a.hour.values.length);continue}break}}if(c>n)throw Error(e.LOOPS_LIMIT_EXCEEDED_ERROR_MESSAGE);return o.getMilliseconds()!==0&&o.setMilliseconds(0),this.#n=o,o}[Symbol.iterator](){return{next:()=>({value:this.#_(),done:!this.hasNext()})}}};e.CronExpression=r,e.default=r})),me=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.seededRandom=r;function t(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return()=>t>>>0}function n(e){return()=>{let t=e+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}}function r(e){return n(e?t(e)():Math.floor(Math.random()*1e10))}})),C=t((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CronExpressionParser=e.DayOfWeek=e.Months=e.CronUnit=e.PredefinedExpressions=void 0;var t=fe(),n=pe(),r=me(),i=S(),a;(function(e){e[`@yearly`]=`0 0 0 1 1 *`,e[`@annually`]=`0 0 0 1 1 *`,e[`@monthly`]=`0 0 0 1 * *`,e[`@weekly`]=`0 0 0 * * 0`,e[`@daily`]=`0 0 0 * * *`,e[`@hourly`]=`0 0 * * * *`,e[`@minutely`]=`0 * * * * *`,e[`@secondly`]=`* * * * * *`,e[`@weekdays`]=`0 0 0 * * 1-5`,e[`@weekends`]=`0 0 0 * * 0,6`})(a||(e.PredefinedExpressions=a={}));var o;(function(e){e.Second=`Second`,e.Minute=`Minute`,e.Hour=`Hour`,e.DayOfMonth=`DayOfMonth`,e.Month=`Month`,e.DayOfWeek=`DayOfWeek`})(o||(e.CronUnit=o={}));var s;(function(e){e[e.jan=1]=`jan`,e[e.feb=2]=`feb`,e[e.mar=3]=`mar`,e[e.apr=4]=`apr`,e[e.may=5]=`may`,e[e.jun=6]=`jun`,e[e.jul=7]=`jul`,e[e.aug=8]=`aug`,e[e.sep=9]=`sep`,e[e.oct=10]=`oct`,e[e.nov=11]=`nov`,e[e.dec=12]=`dec`})(s||(e.Months=s={}));var c;(function(e){e[e.sun=0]=`sun`,e[e.mon=1]=`mon`,e[e.tue=2]=`tue`,e[e.wed=3]=`wed`,e[e.thu=4]=`thu`,e[e.fri=5]=`fri`,e[e.sat=6]=`sat`})(c||(e.DayOfWeek=c={})),e.CronExpressionParser=class e{static parse(s,c={}){let{strict:l=!1,hashSeed:u}=c,d=(0,r.seededRandom)(u);s=a[s]||s;let f=e.#e(s,l);if(!(f.dayOfMonth===`*`||f.dayOfWeek===`*`||!l))throw Error(`Cannot use both dayOfMonth and dayOfWeek together in strict mode!`);let p=e.#t(o.Second,f.second,i.CronSecond.constraints,d),m=e.#t(o.Minute,f.minute,i.CronMinute.constraints,d),h=e.#t(o.Hour,f.hour,i.CronHour.constraints,d),g=e.#t(o.Month,f.month,i.CronMonth.constraints,d),_=e.#t(o.DayOfMonth,f.dayOfMonth,i.CronDayOfMonth.constraints,d),{dayOfWeek:v,nthDayOfWeek:y}=e.#u(f.dayOfWeek),ee=e.#t(o.DayOfWeek,v,i.CronDayOfWeek.constraints,d),te=new t.CronFieldCollection({second:new i.CronSecond(p,{rawValue:f.second}),minute:new i.CronMinute(m,{rawValue:f.minute}),hour:new i.CronHour(h,{rawValue:f.hour}),dayOfMonth:new i.CronDayOfMonth(_,{rawValue:f.dayOfMonth}),month:new i.CronMonth(g,{rawValue:f.month}),dayOfWeek:new i.CronDayOfWeek(ee,{rawValue:f.dayOfWeek,nthDayOfWeek:y})});return new n.CronExpression(te,{...c,expression:s})}static#e(e,t){if(t&&!e.length)throw Error(`Invalid cron expression`);e||=`0 * * * * *`;let n=e.trim().split(/\s+/);if(t&&n.length<6)throw Error(`Invalid cron expression, expected 6 fields`);if(n.length>6)throw Error(`Invalid cron expression, too many fields`);let r=[`*`,`*`,`*`,`*`,`*`,`0`];n.length<r.length&&n.unshift(...r.slice(n.length));let[i,a,o,s,c,l]=n;return{second:i,minute:a,hour:o,dayOfMonth:s,month:c,dayOfWeek:l}}static#t(e,t,n,r){if((e===o.Month||e===o.DayOfWeek)&&(t=t.replace(/[a-z]{3}/gi,e=>{e=e.toLowerCase();let t=s[e]||c[e];if(t===void 0)throw Error(`Validation error, cannot resolve alias "${e}"`);return t.toString()})),!n.validChars.test(t))throw Error(`Invalid characters, got value: ${t}`);return t=this.#n(t,n),t=this.#r(t,n,r),this.#i(e,t,n)}static#n(e,t){return e.replace(/[*?]/g,t.min+`-`+t.max)}static#r(e,t,n){let r=n();return e.replace(/H(?:\((\d+)-(\d+)\))?(?:\/(\d+))?/g,(e,n,i,a)=>{if(n&&i&&a){let e=parseInt(n,10),o=parseInt(i,10),s=parseInt(a,10);if(e>o)throw Error(`Invalid range: ${e}-${o}, min > max`);if(s<=0)throw Error(`Invalid step: ${s}, must be positive`);let c=Math.max(e,t.min),l=Math.floor(r*s),u=[];for(let e=Math.floor(c/s)*s+l;e<=o;e+=s)e>=c&&u.push(e);return u.join(`,`)}else if(n&&i){let e=parseInt(n,10),t=parseInt(i,10);if(e>t)throw Error(`Invalid range: ${e}-${t}, min > max`);return String(Math.floor(r*(t-e+1))+e)}else if(a){let e=parseInt(a,10);if(e<=0)throw Error(`Invalid step: ${e}, must be positive`);let n=Math.floor(r*e),i=[];for(let r=Math.floor(t.min/e)*e+n;r<=t.max;r+=e)r>=t.min&&i.push(r);return i.join(`,`)}else return String(Math.floor(r*(t.max-t.min+1)+t.min))})}static#i(t,n,r){let i=[];function a(n,r){if(Array.isArray(n))i.push(...n);else if(e.#d(r,n))i.push(n);else{let e=parseInt(n.toString(),10);if(!(e>=r.min&&e<=r.max))throw Error(`Constraint error, got value ${n} expected range ${r.min}-${r.max}`);i.push(t===o.DayOfWeek?e%7:n)}}return n.split(`,`).forEach(n=>{if(!(n.length>0))throw Error(`Invalid list value format`);a(e.#a(t,n,r),r)}),i}static#a(t,n,r){let i=n.split(`/`);if(i.length>2)throw Error(`Invalid repeat: ${n}`);return i.length===2?(isNaN(parseInt(i[0],10))||(i[0]=`${i[0]}-${r.max}`),e.#l(t,i[0],parseInt(i[1],10),r)):e.#l(t,n,1,r)}static#o(e,t,n){if(!(!isNaN(e)&&!isNaN(t)&&e>=n.min&&t<=n.max))throw Error(`Constraint error, got range ${e}-${t} expected range ${n.min}-${n.max}`);if(e>t)throw Error(`Invalid range: ${e}-${t}, min(${e}) > max(${t})`)}static#s(e){if(!(!isNaN(e)&&e>0))throw Error(`Constraint error, cannot repeat at every ${e} time.`)}static#c(e,t,n,r){let i=[];e===o.DayOfWeek&&n%7==0&&i.push(0);for(let e=t;e<=n;e+=r)i.indexOf(e)===-1&&i.push(e);return i}static#l(e,t,n,r){let i=t.split(`-`);if(i.length<=1)return isNaN(+t)?t:+t;let[a,o]=i.map(e=>parseInt(e,10));return this.#o(a,o,r),this.#s(n),this.#c(e,a,o,n)}static#u(e){let t=e.split(`#`);if(t.length<=1)return{dayOfWeek:t[0]};let n=+t[t.length-1],r=e.match(/([,-/])/);if(r!==null)throw Error(`Constraint error, invalid dayOfWeek \`#\` and \`${r?.[0]}\` special characters are incompatible`);if(!(t.length<=2&&!isNaN(n)&&n>=1&&n<=5))throw Error(`Constraint error, invalid dayOfWeek occurrence number (#)`);return{dayOfWeek:t[0],nthDayOfWeek:n}}static#d(e,t){return e.chars.some(e=>t.toString().includes(e))}}})),he=t(((e,t)=>{t.exports={}})),w=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||(function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},e(t)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null)for(var a=e(r),o=0;o<a.length;o++)a[o]!=="default"&&t(i,r,a[o]);return n(i,r),i}})();Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=void 0;var i=C();e.CronFileParser=class e{static async parseFile(t){let{readFile:n}=await Promise.resolve().then(()=>r(he())),i=await n(t,`utf8`);return e.#e(i)}static parseFileSync(t){let{readFileSync:n}=he(),r=n(t,`utf8`);return e.#e(r)}static#e(t){let n=t.split(`
2
+ `),r={variables:{},expressions:[],errors:{}};for(let t of n){let n=t.trim();if(n.length===0||n.startsWith(`#`))continue;let i=n.match(/^(.*)=(.*)$/);if(i){let[,e,t]=i;r.variables[e]=t.replace(/["']/g,``);continue}try{let t=e.#t(n);r.expressions.push(t.interval)}catch(e){r.errors[n]=e}}return r}static#t(e){let t=e.split(` `);return{interval:i.CronExpressionParser.parse(t.slice(0,5).join(` `)),command:t.slice(5,t.length)}}}})),ge=t((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.CronFileParser=e.CronExpressionParser=e.CronExpression=e.CronFieldCollection=e.CronDate=void 0;var r=C(),i=le();Object.defineProperty(e,"CronDate",{enumerable:!0,get:function(){return i.CronDate}});var a=fe();Object.defineProperty(e,"CronFieldCollection",{enumerable:!0,get:function(){return a.CronFieldCollection}});var o=pe();Object.defineProperty(e,"CronExpression",{enumerable:!0,get:function(){return o.CronExpression}});var s=C();Object.defineProperty(e,"CronExpressionParser",{enumerable:!0,get:function(){return s.CronExpressionParser}});var c=w();Object.defineProperty(e,"CronFileParser",{enumerable:!0,get:function(){return c.CronFileParser}}),n(S(),e),e.default=r.CronExpressionParser})),_e=ge();function T(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function E(e){return Array.isArray(e)?e.filter(e=>typeof e==`number`).sort((e,t)=>e-t):[]}function ve(e){if(e.length<2)return null;let t=e[1]-e[0];if(t<=0)return null;for(let n=2;n<e.length;n++)if(e[n]-e[n-1]!==t)return null;return t}function ye(e){let t=[];for(let n=0;n<7;n++)e[n]&&t.push(n===6?0:n+1);return t.length===0?`1`:t.sort((e,t)=>e-t).join(`,`)}function be(e){let t=[!1,!1,!1,!1,!1,!1,!1];for(let n of e){let e=n===0||n===7?6:n-1;e>=0&&e<=6&&(t[e]=!0)}return t}function xe(e){let t=e.trim(),n={mode:`custom`,intervalKind:`minutes`,onceDate:T(),intervalMinutes:5,intervalHours:2,minute:0,hour:9,weekDays:[!0,!0,!0,!0,!0,!1,!1],dayOfMonth:1,rawCron:t};if(!t)return{...n,mode:`interval`,rawCron:`*/5 * * * *`};try{let e=_e.CronExpressionParser.parse(t).fields,r=E(e.minute.values),i=E(e.hour.values),a=E(e.dayOfMonth.values),o=E(e.month.values),s=E(e.dayOfWeek.values);if(r.length===60&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:1,rawCron:t};if(!e.minute.isWildcard&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&r.length>1){let e=ve(r);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`minutes`,intervalMinutes:e,rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&!e.hour.isWildcard&&i.length>1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=ve(i);if(e!=null&&e>0)return{...n,mode:`interval`,intervalKind:`hours`,intervalHours:e,minute:r[0],rawCron:t}}if(!e.minute.isWildcard&&r.length===1&&e.hour.isWildcard&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard&&i.length===24)return{...n,mode:`hourly`,minute:r[0],rawCron:t};if(r.length===1&&i.length===1&&a.length===1&&o.length===1&&!e.dayOfMonth.isWildcard&&!e.month.isWildcard&&e.dayOfWeek.isWildcard){let e=new Date().getFullYear(),s=o[0],c=a[0],l=`${e}-${String(s).padStart(2,`0`)}-${String(c).padStart(2,`0`)}`;return{...n,mode:`no_repeat`,minute:r[0],hour:i[0],onceDate:l,rawCron:t}}if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`daily`,minute:r[0],hour:i[0],rawCron:t};if(r.length===1&&i.length===1&&e.dayOfMonth.isWildcard&&e.month.isWildcard&&!e.dayOfWeek.isWildcard&&s.length>0)return{...n,mode:`weekly`,minute:r[0],hour:i[0],weekDays:be(s),rawCron:t};if(r.length===1&&i.length===1&&!e.dayOfMonth.isWildcard&&a.length===1&&e.month.isWildcard&&e.dayOfWeek.isWildcard)return{...n,mode:`monthly`,minute:r[0],hour:i[0],dayOfMonth:a[0],rawCron:t}}catch{}return n}function Se(e){let t=(e,t,n)=>Math.min(n,Math.max(t,e));switch(e.mode){case`custom`:return e.rawCron.trim()||`*/5 * * * *`;case`no_repeat`:{let n=e.onceDate.split(`-`);if(n.length===3){let r=t(parseInt(n[2],10),1,31),i=t(parseInt(n[1],10),1,12);return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${r} ${i} *`}return`0 9 1 1 *`}case`interval`:if(e.intervalKind===`hours`){let n=t(Math.round(e.intervalHours)||1,1,23);return`${t(e.minute,0,59)} */${n} * * *`}return`*/${t(Math.round(e.intervalMinutes)||5,1,59)} * * * *`;case`hourly`:return`${t(e.minute,0,59)} * * * *`;case`daily`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * *`;case`weekly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} * * ${ye(e.weekDays)}`;case`monthly`:return`${t(e.minute,0,59)} ${t(e.hour,0,23)} ${t(Math.round(e.dayOfMonth)||1,1,31)} * *`;default:return`*/5 * * * *`}}export{ge as a,ve as i,xe as n,te as o,E as r,Se as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-D02NNLCZ.js";import{n as a}from"./locale-store-D6hs74o5.js";import{du as o,ks as s,t as c}from"./index-OJgiMh07.js";import{t as l}from"./desktop-pet-sprite-DTqXSpqf.js";var u=e(t(),1),d=n(),f=9e4,p=3e4,m=20*6e4,h=45e3,g=45*6e4,_=58;function v(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=f}function y(e,t){return e.state===`running`&&t-e.timestamp>=p}function b(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function x(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>_?`${n.slice(0,_-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function S(e,t,n){if(y(e,t))return n.stale;if(v(e,t))return n.longRunning}function C(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function w(e){let t=e.now-e.lastActivityAt,n=t>=m?(t-m)%g:1/0;return e.bubbleEnabled&&e.behaviorMode!==`focus`&&e.proactiveTipsEnabled&&(!e.remindersPausedUntil||e.now>=e.remindersPausedUntil)&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=h&&e.now>=e.dismissedUntil}function T(e,t,n){return e.state===`waiting`||e.state===`error`?`action_required`:e.state===`success`?t===`focus`?`ambient`:`notice`:y(e,n)||t===`playful`||t===`companion`&&v(e,n)?`notice`:`ambient`}function E(e,t,n,r){let i=T(e,t,n);return i===`action_required`?!0:r&&n<r?!1:i===`notice`}var D=8e3;function O(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+D:void 0}}function k(e,t){let n={...e};for(let e of t){let t=n[e.sessionKey];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.sessionKey]=O(t,e))}return n}function A(e,t){return t?.runId===e.runId&&t.state===e.state}function j(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function M(e){return e?`/chat/${e.sessionKey}`:void 0}var N=r();function P(e){return e?e.state===`error`?`concern`:e.state===`success`?`success`:e.animation??c(e.phase):`idle`}function F(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.sessionKey}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function I(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return F(r?.success,t);if(t.state===`waiting`)return F(r?.waiting,t);if(t.state===`error`)return F(r?.error,t)}function L(e,t,n){return e?n?`${e} · ${t}`:e:t}function R(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function z(){let e=Date.now();return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`ember`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,behaviorMode:`companion`,proactiveTipsEnabled:!0,interactionEnabled:!0,reducedMotion:!1,sizePercent:100,collapsed:!1},relationship:{firstMetAt:e,lastSeenAt:e,completedTaskCount:0,unlockedReactions:[],recentCompletedRunIds:[]},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function B(){let e=i(a(e=>e.language)).desktopPet,[t,n]=(0,u.useState)(z),[r,c]=(0,u.useState)({}),[d,f]=(0,u.useState)({}),[p,m]=(0,u.useState)(Date.now()),[h,_]=(0,u.useState)(()=>Date.now()),[v,y]=(0,u.useState)(0),[T,D]=(0,u.useState)(null),O=(0,u.useRef)(null),B=(0,u.useRef)(!1),V=(0,u.useRef)(null),H=(0,u.useRef)(null),U=(0,u.useRef)(null),W=(0,u.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),G=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),K=(0,u.useMemo)(()=>j(Object.values(r),p),[r,p]),q=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?K.filter(e=>!A(e,d[e.sessionKey])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)):[],[K,d,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),ee=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?K.filter(e=>A(e,d[e.sessionKey])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)).length:0,[K,d,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),J=q[0]??K[0],te=p-h>20*6e4&&(new Date(p).getHours()>=23||new Date(p).getHours()<7)?`sleep`:`idle`,ne=T??(J?P(J):te),Y=e.personaPhrases[W?.persona?.tone??`calm`],X=w({bubbleEnabled:t.prefs.bubbleEnabled,behaviorMode:t.prefs.behaviorMode,proactiveTipsEnabled:t.prefs.proactiveTipsEnabled,remindersPausedUntil:t.prefs.remindersPausedUntil,collapsed:t.prefs.collapsed,queuedCount:q.length,activeCount:K.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,u.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),c(t=>k(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>c(t=>(_(Date.now()),k(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,u.useEffect)(()=>{if(!t.relationshipMoment)return;D(t.relationshipMoment===`first_meeting`?`wake`:`greet`);let e=window.setTimeout(()=>D(null),1400);return()=>window.clearTimeout(e)},[t.relationshipMoment]),(0,u.useLayoutEffect)(()=>{let e=V.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[H.current,U.current].filter(e=>e!==null).map(e=>e.getBoundingClientRect());if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom));t.setContentSize({width:Math.ceil(i-n),height:Math.ceil(a-r)})},r=new ResizeObserver(n);return r.observe(e),H.current&&r.observe(H.current),U.current&&r.observe(U.current),n(),()=>r.disconnect()},[X,q.length,t.prefs.collapsed,G]);let Z=(e=J)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.sessionKey,e.runId),c(t=>{let{[e.sessionKey]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(M(e))},re=async()=>{if(Object.keys(d).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},ie=(0,u.useCallback)(e=>{e.button===0&&(O.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ae=(0,u.useCallback)(e=>{let t=O.current;!t||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)>4&&(t.moved=!0,D(`pickedUp`),window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,u.useCallback)(e=>{let t=O.current;!t||t.pointerId!==e.pointerId||(O.current=null,window.electronAPI?.pet?.endDrag(),t.moved&&(D(`released`),window.setTimeout(()=>D(null),700),B.current=!0,window.setTimeout(()=>{B.current=!1},0)))},[]),oe=()=>{B.current||Z()};if(!W)return null;let se={"--desktop-pet-stage-size":`${Math.round(132*G)}px`,"--desktop-pet-menu-size":`${Math.round(28*G)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*G)}px`},$=t.prefs.collapsed?q.length:ee;return(0,N.jsxs)(`div`,{ref:V,className:`desktop-pet-window`,style:se,children:[!t.prefs.collapsed&&q.length>0?(0,N.jsx)(`div`,{ref:H,className:`desktop-pet-bubble desktop-pet-queue`,children:q.map(t=>{let n=S(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=x(t,e.tipCompleteSummary),i=C(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),a=r??n??i??t.action,o=L(I(W,t,Y),a,!!(r||n||i)),c=R(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:t.sessionLabel}),(0,N.jsxs)(`span`,{children:[o,r||n?``:b(t,p,e.tipTargetSuffix)]})]}),c?(0,N.jsx)(`span`,{className:`desktop-pet-session-cta`,children:c}):null]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.sessionKey,t.runId),f(e=>({...e,[t.sessionKey]:{runId:t.runId,state:t.state}}))},children:(0,N.jsx)(s,{size:12})})]},t.sessionKey)})}):null,X?(0,N.jsx)(`div`,{ref:H,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:e.idleTipTitle}),(0,N.jsx)(`span`,{children:F(W.persona?.phrases?.greeting??Y.greeting,{sessionKey:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+g),children:(0,N.jsx)(s,{size:12})})]})}):null,(0,N.jsxs)(`div`,{ref:U,className:`desktop-pet-stage`,children:[(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void re(),"aria-label":e.menu,children:$>0?(0,N.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,N.jsx)(o,{className:`desktop-pet-menu-chevron size-4`})}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:oe,onPointerEnter:()=>{!J&&t.prefs.interactionEnabled&&t.prefs.behaviorMode===`playful`&&D(`greet`)},onPointerLeave:()=>{O.current||D(null)},onPointerDown:ie,onPointerMove:ae,onPointerUp:Q,onPointerCancel:Q,title:e.openApp,children:(0,N.jsx)(l,{pet:W,action:ne,reducedMotion:t.prefs.reducedMotion,displayHeight:Math.round(112*G)})})]})]})}function V(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,N.jsx)(B,{}),e[0]=t):t=e[0],t}export{V as DesktopPetPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-B4XqB8I6.js";import{n as a}from"./locale-store-deR2zRaE.js";import{Zl as o,ms as s,t as c}from"./index-CYT5DOzr.js";import{t as l}from"./desktop-pet-sprite-DTqXSpqf.js";var u=e(t(),1),d=n(),f=9e4,p=3e4,m=20*6e4,h=45e3,g=45*6e4,_=58;function v(e,t){return e.state===`running`&&t-(e.startedAt??e.timestamp)>=f}function y(e,t){return e.state===`running`&&t-e.timestamp>=p}function b(e,t,n){if(e.progress){let t=`${e.progress.completed}/${e.progress.total}`;return e.action.includes(t)?``:` · ${t}`}return e.detail&&!e.action.includes(e.detail)?n.replace(/\{\{detail\}\}/g,e.detail):e.state===`running`?` · ${Math.max(1,Math.floor((t-e.timestamp)/1e3))}s`:``}function x(e,t){if(e.state!==`success`||!e.publicSummary)return;let n=e.publicSummary.replace(/\s+/g,` `).trim(),r=n.length>_?`${n.slice(0,_-1)}…`:n;return t.replace(/\{\{summary\}\}/g,r)}function S(e,t,n){if(y(e,t))return n.stale;if(v(e,t))return n.longRunning}function C(e,t){let n=e.feedback?.reassurance;return n?t[n]:void 0}function w(e){let t=e.now-e.lastActivityAt,n=t>=m?(t-m)%g:1/0;return e.bubbleEnabled&&e.behaviorMode!==`focus`&&e.proactiveTipsEnabled&&(!e.remindersPausedUntil||e.now>=e.remindersPausedUntil)&&!e.collapsed&&e.queuedCount===0&&e.activeCount===0&&n<=h&&e.now>=e.dismissedUntil}function T(e,t,n){return e.state===`waiting`||e.state===`error`?`action_required`:e.state===`success`?t===`focus`?`ambient`:`notice`:y(e,n)||t===`playful`||t===`companion`&&v(e,n)?`notice`:`ambient`}function E(e,t,n,r){let i=T(e,t,n);return i===`action_required`?!0:r&&n<r?!1:i===`notice`}var D=8e3;function O(e,t){let n=e?.runId===t.runId,r=t.feedback?.sensitivity===`private`;return{...n?e:void 0,...t,startedAt:n?e.startedAt??e.timestamp:t.timestamp,publicSummary:r?void 0:t.publicSummary??(n?e.publicSummary:void 0),feedback:t.feedback??(n?e.feedback:void 0),expiresAt:t.state===`success`?t.timestamp+D:void 0}}function k(e,t){let n={...e};for(let e of t){let t=n[e.sessionKey];t?.runId===e.runId&&e.sequence<=t.sequence||(n[e.sessionKey]=O(t,e))}return n}function A(e,t){return t?.runId===e.runId&&t.state===e.state}function j(e,t){let n={error:0,waiting:1,running:2,success:3};return e.filter(e=>!e.expiresAt||e.expiresAt>t).sort((e,t)=>n[e.state]-n[t.state]||t.timestamp-e.timestamp).slice(0,3)}function M(e){return e?`/chat/${e.sessionKey}`:void 0}var N=r();function P(e){return e?e.state===`error`?`concern`:e.state===`success`?`success`:e.animation??c(e.phase):`idle`}function F(e,t){if(!e?.length)return;let n=t.sequence;for(let e of`${t.sessionKey}:${t.runId}`)n=n*31+e.charCodeAt(0)>>>0;return e[n%e.length]}function I(e,t,n){let r=e.persona?.phrases??n;if(t.state===`success`)return F(r?.success,t);if(t.state===`waiting`)return F(r?.waiting,t);if(t.state===`error`)return F(r?.error,t)}function L(e,t,n){return e?n?`${e} · ${t}`:e:t}function R(e,t){let n=e.feedback?.nextAction?.type;if(n===`confirm`)return t.needsInput;if(n===`review_error`)return t.reviewIssue;if(n===`open_session`)return t.open;if(e.state===`waiting`)return t.needsInput;if(e.state===`error`)return t.reviewIssue;if(e.state===`success`)return t.open}function z(){let e=Date.now();return{prefs:{enabled:!0,showOnStartup:!1,selectedPetId:`ember`,alwaysOnTop:!0,bubbleEnabled:!0,clickThroughWhenIdle:!1,muted:!1,behaviorMode:`companion`,proactiveTipsEnabled:!0,interactionEnabled:!0,reducedMotion:!1,sizePercent:100,collapsed:!1},relationship:{firstMetAt:e,lastSeenAt:e,completedTaskCount:0,unlockedReactions:[],recentCompletedRunIds:[]},pets:[],visible:!0,customPetsDir:``,petIssues:[],activities:[]}}function B(){let e=i(a(e=>e.language)).desktopPet,[t,n]=(0,u.useState)(z),[r,c]=(0,u.useState)({}),[d,f]=(0,u.useState)({}),[p,m]=(0,u.useState)(Date.now()),[h,_]=(0,u.useState)(()=>Date.now()),[v,y]=(0,u.useState)(0),[T,D]=(0,u.useState)(null),O=(0,u.useRef)(null),B=(0,u.useRef)(!1),V=(0,u.useRef)(null),H=(0,u.useRef)(null),U=(0,u.useRef)(null),W=(0,u.useMemo)(()=>t.pets.find(e=>e.id===t.prefs.selectedPetId)??t.pets[0],[t]),G=Math.min(1.4,Math.max(.7,t.prefs.sizePercent/100)),K=(0,u.useMemo)(()=>j(Object.values(r),p),[r,p]),q=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?K.filter(e=>!A(e,d[e.sessionKey])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)):[],[K,d,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),ee=(0,u.useMemo)(()=>t.prefs.bubbleEnabled?K.filter(e=>A(e,d[e.sessionKey])&&E(e,t.prefs.behaviorMode,p,t.prefs.remindersPausedUntil)).length:0,[K,d,p,t.prefs.behaviorMode,t.prefs.bubbleEnabled,t.prefs.remindersPausedUntil]),J=q[0]??K[0],te=p-h>20*6e4&&(new Date(p).getHours()>=23||new Date(p).getHours()<7)?`sleep`:`idle`,ne=T??(J?P(J):te),Y=e.personaPhrases[W?.persona?.tone??`calm`],X=w({bubbleEnabled:t.prefs.bubbleEnabled,behaviorMode:t.prefs.behaviorMode,proactiveTipsEnabled:t.prefs.proactiveTipsEnabled,remindersPausedUntil:t.prefs.remindersPausedUntil,collapsed:t.prefs.collapsed,queuedCount:q.length,activeCount:K.length,now:p,lastActivityAt:h,dismissedUntil:v});(0,u.useEffect)(()=>{document.documentElement.dataset.desktopPet=`true`;let e=window.electronAPI?.pet;if(!e)return;let t=e=>{n(e),c(t=>k(t,e.activities))};e.getState().then(t).catch(()=>{});let r=e.onStateChanged(t),i=e.onEvent(e=>c(t=>(_(Date.now()),k(t,[e])))),a=window.setInterval(()=>m(Date.now()),1e3);return()=>{delete document.documentElement.dataset.desktopPet,r(),i(),window.clearInterval(a)}},[]),(0,u.useEffect)(()=>{if(!t.relationshipMoment)return;D(t.relationshipMoment===`first_meeting`?`wake`:`greet`);let e=window.setTimeout(()=>D(null),1400);return()=>window.clearTimeout(e)},[t.relationshipMoment]),(0,u.useLayoutEffect)(()=>{let e=V.current,t=window.electronAPI?.pet;if(!e||!t)return;let n=()=>{let e=[H.current,U.current].filter(e=>e!==null).map(e=>e.getBoundingClientRect());if(!e.length)return;let n=Math.min(...e.map(e=>e.left)),r=Math.min(...e.map(e=>e.top)),i=Math.max(...e.map(e=>e.right)),a=Math.max(...e.map(e=>e.bottom));t.setContentSize({width:Math.ceil(i-n),height:Math.ceil(a-r)})},r=new ResizeObserver(n);return r.observe(e),H.current&&r.observe(H.current),U.current&&r.observe(U.current),n(),()=>r.disconnect()},[X,q.length,t.prefs.collapsed,G]);let Z=(e=J)=>{e&&e.state!==`running`&&(window.electronAPI?.pet?.acknowledgeEvent(e.sessionKey,e.runId),c(t=>{let{[e.sessionKey]:n,...r}=t;return r})),window.electronAPI?.pet?.openMainWindow(M(e))},re=async()=>{if(Object.keys(d).length>0&&(f({}),!t.prefs.collapsed))return;let e=await window.electronAPI?.pet?.setPrefs({collapsed:!t.prefs.collapsed});e&&n(e)},ie=(0,u.useCallback)(e=>{e.button===0&&(O.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),window.electronAPI?.pet?.startDrag({screenX:e.screenX,screenY:e.screenY}))},[]),ae=(0,u.useCallback)(e=>{let t=O.current;!t||t.pointerId!==e.pointerId||Math.abs(e.clientX-t.x)+Math.abs(e.clientY-t.y)>4&&(t.moved=!0,D(`pickedUp`),window.electronAPI?.pet?.drag({screenX:e.screenX,screenY:e.screenY}))},[]),Q=(0,u.useCallback)(e=>{let t=O.current;!t||t.pointerId!==e.pointerId||(O.current=null,window.electronAPI?.pet?.endDrag(),t.moved&&(D(`released`),window.setTimeout(()=>D(null),700),B.current=!0,window.setTimeout(()=>{B.current=!1},0)))},[]),oe=()=>{B.current||Z()};if(!W)return null;let se={"--desktop-pet-stage-size":`${Math.round(132*G)}px`,"--desktop-pet-menu-size":`${Math.round(28*G)}px`,"--desktop-pet-menu-left":`0px`,"--desktop-pet-menu-bottom":`${Math.round(12*G)}px`},$=t.prefs.collapsed?q.length:ee;return(0,N.jsxs)(`div`,{ref:V,className:`desktop-pet-window`,style:se,children:[!t.prefs.collapsed&&q.length>0?(0,N.jsx)(`div`,{ref:H,className:`desktop-pet-bubble desktop-pet-queue`,children:q.map(t=>{let n=S(t,p,{longRunning:e.tipLongRunning,stale:e.tipStaleSignal}),r=x(t,e.tipCompleteSummary),i=C(t,{making_progress:e.petReassuranceMakingProgress,waiting_safely:e.petReassuranceWaitingSafely,completed:e.petReassuranceCompleted,work_preserved:e.petReassuranceWorkPreserved,details_available:e.petReassuranceDetailsAvailable}),a=r??n??i??t.action,o=L(I(W,t,Y),a,!!(r||n||i)),c=R(t,{open:e.viewSession,needsInput:e.petCtaNeedsInput,reviewIssue:e.petCtaReviewIssue});return(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--${t.state}${n?` desktop-pet-session--health`:``}`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(t),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:t.sessionLabel}),(0,N.jsxs)(`span`,{children:[o,r||n?``:b(t,p,e.tipTargetSuffix)]})]}),c?(0,N.jsx)(`span`,{className:`desktop-pet-session-cta`,children:c}):null]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>{window.electronAPI?.pet?.acknowledgeEvent(t.sessionKey,t.runId),f(e=>({...e,[t.sessionKey]:{runId:t.runId,state:t.state}}))},children:(0,N.jsx)(s,{size:12})})]},t.sessionKey)})}):null,X?(0,N.jsx)(`div`,{ref:H,className:`desktop-pet-bubble desktop-pet-queue desktop-pet-idle-tip`,children:(0,N.jsxs)(`div`,{className:`desktop-pet-session desktop-pet-session--idle`,children:[(0,N.jsxs)(`button`,{type:`button`,className:`desktop-pet-session-open`,onClick:()=>Z(),children:[(0,N.jsx)(`span`,{className:`desktop-pet-session-dot`}),(0,N.jsxs)(`span`,{className:`desktop-pet-session-main`,children:[(0,N.jsx)(`strong`,{children:e.idleTipTitle}),(0,N.jsx)(`span`,{children:F(W.persona?.phrases?.greeting??Y.greeting,{sessionKey:`idle`,runId:`idle`,sessionLabel:``,sequence:0,timestamp:h,state:`running`,phase:`waiting`,action:e.idleTipBody})??e.idleTipBody})]})]}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-session-close`,"aria-label":e.dismissSession,onClick:()=>y(p+g),children:(0,N.jsx)(s,{size:12})})]})}):null,(0,N.jsxs)(`div`,{ref:U,className:`desktop-pet-stage`,children:[(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-menu-button`,onClick:()=>void re(),"aria-label":e.menu,children:$>0?(0,N.jsx)(`span`,{className:`desktop-pet-tip-count`,children:Math.min(99,$)}):(0,N.jsx)(o,{className:`desktop-pet-menu-chevron size-4`})}),(0,N.jsx)(`button`,{type:`button`,className:`desktop-pet-hit-area`,onClick:oe,onPointerEnter:()=>{!J&&t.prefs.interactionEnabled&&t.prefs.behaviorMode===`playful`&&D(`greet`)},onPointerLeave:()=>{O.current||D(null)},onPointerDown:ie,onPointerMove:ae,onPointerUp:Q,onPointerCancel:Q,title:e.openApp,children:(0,N.jsx)(l,{pet:W,action:ne,reducedMotion:t.prefs.reducedMotion,displayHeight:Math.round(112*G)})})]})]})}function V(){let e=(0,d.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,N.jsx)(B,{}),e[0]=t):t=e[0],t}export{V as DesktopPetPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./messages-D02NNLCZ.js";import{n as s}from"./locale-store-D6hs74o5.js";import{$o as c,Ac as l,Fl as u,Ms as d,Uc as f,Uo as p,bs as m,cu as h,es as g,gc as _,hc as v,to as y}from"./index-OJgiMh07.js";import{t as b}from"./desktop-pet-sprite-DTqXSpqf.js";import{n as x,r as S}from"./settings-page-layout-97LmwrzC.js";var C=n(),w=e(t(),1),T=r();function E(e){let t=(0,C.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,T.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,T.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function D(){let e=o(s(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,w.useState)(null),[C,D]=(0,w.useState)(!1),[O,k]=(0,w.useState)(null),A=typeof window<`u`?window.electronAPI?.pet:void 0,j=(0,w.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),M=(0,w.useCallback)(async()=>{if(A){D(!0);try{r(await A.getState())}finally{D(!1)}}},[A]);if((0,w.useEffect)(()=>{if(A)return M(),A.onStateChanged(r)},[A,M]),!p()||!A)return null;if(!n)return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle}),(0,T.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsx)(y,{className:`h-14 rounded-xl`}),(0,T.jsx)(y,{className:`h-14 rounded-xl`}),(0,T.jsx)(y,{className:`h-24 rounded-xl`}),(0,T.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,T.jsx)(y,{className:`h-16 rounded-xl`},t))})]})})]});let N=async e=>{D(!0);try{r(await A.setPrefs(e))}finally{D(!1)}},P=async e=>{e?(await A.show(),r(await A.getState())):r(await A.setPrefs({enabled:!1}))},F=e=>{N({selectedPetId:e})},I=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},L=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},R=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=I(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),B=()=>{L(e.createChatDraft)},V=t=>{L(z(e.optimizeChatDraft,{id:t.id,name:I(t).name,description:I(t).description,sourcePrompt:R(t)}))},H=t=>{L(z(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails}))},U=O??n.prefs.sizePercent,W=Math.max(1,Math.floor((Date.now()-n.relationship.firstMetAt)/864e5)+1),G=async(e=U)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));k(null),t!==n.prefs.sizePercent&&await N({sizePercent:t})};return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle,actions:(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,m.press),disabled:C,onClick:()=>void M(),children:[(0,T.jsx)(_,{className:a(`size-3.5`,C&&`animate-spin`),strokeWidth:1.75}),e.refresh]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,m.press),onClick:()=>void A.openCustomPetsDir(),children:[(0,T.jsx)(u,{className:`size-3.5`,strokeWidth:1.75}),e.openFolder]})]})}),(0,T.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(E,{title:e.enable,desc:e.enableDesc,checked:n.prefs.enabled,disabled:C,onChange:e=>void P(e)}),(0,T.jsx)(E,{title:e.showOnStartup,desc:e.showOnStartupDesc,checked:n.prefs.showOnStartup,disabled:C,onChange:e=>void N({showOnStartup:e})})]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge-subtle bg-surface-panel p-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,T.jsx)(d,{className:`mt-0.5 size-4 text-accent-fg`,strokeWidth:1.8}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.createTitle}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.createDesc})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 text-xs font-semibold text-white hover:bg-accent/90`,m.press),onClick:B,children:[(0,T.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.createInChat]})]})}),(0,T.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel p-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.bondTitle}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.bondDesc})]}),(0,T.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:e.bondSummary.replace(`{days}`,String(W)).replace(`{tasks}`,String(n.relationship.completedTaskCount))})]}),(0,T.jsxs)(`div`,{className:`mt-5`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.petList}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.petListDesc})]}),j?(0,T.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:I(j).name}):null]}),(0,T.jsxs)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-base`,children:[n.pets.map(t=>{let r=t.id===n.prefs.selectedPetId,i=I(t);return(0,T.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,T.jsx)(b,{pet:t,action:`idle`,size:`tiny`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:i.name}),t.builtin?null:(0,T.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.customBadge})]}),(0,T.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:i.description})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t.builtin?null:(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,m.press),onClick:()=>V(t),children:[(0,T.jsx)(l,{className:`size-3.5`,strokeWidth:1.75}),e.optimizeInChat]}),(0,T.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,r?`bg-surface-hover text-fg-muted`:`bg-surface-panel text-fg hover:bg-surface-hover`,m.press),disabled:r||C,onClick:()=>F(t.id),children:r?e.selected:e.select})]})]},t.id)}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:e.customPets}),(0,T.jsx)(`p`,{className:`font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,T.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>void A.openCustomPetsDir(),children:[e.openFolder,(0,T.jsx)(u,{className:`size-3.5`,strokeWidth:1.75})]})]})]}),n.petIssues.length>0?(0,T.jsxs)(`div`,{className:`mt-2 rounded-xl border border-danger/30 bg-danger/5 p-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-danger`,children:[(0,T.jsx)(h,{className:`size-3.5`,strokeWidth:1.8}),e.invalidPets]}),(0,T.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.petIssues.map(t=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base/70 p-2 text-xs text-fg-muted sm:flex-row sm:items-start sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`truncate font-mono text-[11px] text-fg`,children:t.dir}),(0,T.jsx)(`p`,{children:t.reason}),t.details?.length?(0,T.jsx)(`p`,{className:`line-clamp-2`,children:t.details.join(`; `)}):null]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-danger/30 bg-surface-base px-2.5 text-xs font-medium text-danger hover:bg-danger/10`,m.press),onClick:()=>H(t),children:[(0,T.jsx)(f,{className:`size-3.5`,strokeWidth:1.75}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null]}),(0,T.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[(0,T.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.size}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.sizeDesc})]}),(0,T.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[U,`%`]})]}),(0,T.jsx)(`input`,{type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:U,onChange:e=>k(Number(e.target.value)),onBlur:()=>void G(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&G()},onPointerUp:()=>void G()})]}),(0,T.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,T.jsx)(E,{title:e.alwaysOnTop,desc:e.alwaysOnTopDesc,checked:n.prefs.alwaysOnTop,disabled:C,onChange:e=>void N({alwaysOnTop:e})}),(0,T.jsx)(E,{title:e.bubbles,desc:e.bubblesDesc,checked:n.prefs.bubbleEnabled,disabled:C,onChange:e=>void N({bubbleEnabled:e})}),(0,T.jsx)(E,{title:e.proactiveTips,desc:e.proactiveTipsDesc,checked:n.prefs.proactiveTipsEnabled,disabled:C,onChange:e=>void N({proactiveTipsEnabled:e})}),(0,T.jsx)(E,{title:e.interactions,desc:e.interactionsDesc,checked:n.prefs.interactionEnabled,disabled:C,onChange:e=>void N({interactionEnabled:e})}),(0,T.jsx)(E,{title:e.reducedMotion,desc:e.reducedMotionDesc,checked:n.prefs.reducedMotion,disabled:C,onChange:e=>void N({reducedMotion:e})}),(0,T.jsx)(E,{title:e.clickThrough,desc:e.clickThroughDesc,checked:n.prefs.clickThroughWhenIdle,disabled:C,onChange:e=>void N({clickThroughWhenIdle:e})})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.behaviorMode}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.behaviorModeDesc})]}),(0,T.jsxs)(c,{className:`w-full sm:w-40`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.behaviorMode,onChange:e=>void N({behaviorMode:e.target.value}),children:[(0,T.jsx)(g,{value:`focus`,children:e.behaviorFocus}),(0,T.jsx)(g,{value:`companion`,children:e.behaviorCompanion}),(0,T.jsx)(g,{value:`playful`,children:e.behaviorPlayful})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex w-fit items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,m.press),disabled:C,onClick:()=>void A.resetPosition().then(r),children:[(0,T.jsx)(v,{className:`size-3.5`,strokeWidth:1.75}),e.resetPosition]})]})]})]})}export{D as DesktopPetSettings};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./messages-B4XqB8I6.js";import{n as s}from"./locale-store-deR2zRaE.js";import{Ba as c,Jl as l,Ro as u,_s as d,as as f,gc as p,kc as m,ko as h,nc as g,tc as _,xl as v,zo as y}from"./index-CYT5DOzr.js";import{t as b}from"./desktop-pet-sprite-DTqXSpqf.js";import{n as x,r as S}from"./settings-page-layout-EQIOJa_L.js";var C=n(),w=e(t(),1),T=r();function E(e){let t=(0,C.c)(16),{title:n,desc:r,checked:i,disabled:a,onChange:o}=e,s;t[0]===n?s=t[1]:(s=(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,T.jsxs)(`div`,{className:`min-w-0`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=e=>o(e.target.checked),t[7]=o,t[8]=u);let d;t[9]!==i||t[10]!==a||t[11]!==u?(d=(0,T.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:a,checked:i,onChange:u}),t[9]=i,t[10]=a,t[11]=u,t[12]=d):d=t[12];let f;return t[13]!==l||t[14]!==d?(f=(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[l,d]}),t[13]=l,t[14]=d,t[15]=f):f=t[15],f}function D(){let e=o(s(e=>e.language)).desktopPetSettings,t=i(),[n,r]=(0,w.useState)(null),[C,D]=(0,w.useState)(!1),[O,k]=(0,w.useState)(null),A=typeof window<`u`?window.electronAPI?.pet:void 0,j=(0,w.useMemo)(()=>n?.pets.find(e=>e.id===n.prefs.selectedPetId)??n?.pets[0],[n]),M=(0,w.useCallback)(async()=>{if(A){D(!0);try{r(await A.getState())}finally{D(!1)}}},[A]);if((0,w.useEffect)(()=>{if(A)return M(),A.onStateChanged(r)},[A,M]),!h()||!A)return null;if(!n)return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle}),(0,T.jsx)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4`,"aria-busy":!0,"aria-label":e.loading,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsx)(c,{className:`h-14 rounded-xl`}),(0,T.jsx)(c,{className:`h-14 rounded-xl`}),(0,T.jsx)(c,{className:`h-24 rounded-xl`}),(0,T.jsx)(`div`,{className:`space-y-2 pt-2`,children:Array.from({length:3}).map((e,t)=>(0,T.jsx)(c,{className:`h-16 rounded-xl`},t))})]})})]});let N=async e=>{D(!0);try{r(await A.setPrefs(e))}finally{D(!1)}},P=async e=>{e?(await A.show(),r(await A.getState())):r(await A.setPrefs({enabled:!1}))},F=e=>{N({selectedPetId:e})},I=t=>{if(t.builtin&&t.i18nKey){let n=e.builtinPets[t.i18nKey];if(n)return n}return{name:t.name,description:t.description}},L=e=>{t({pathname:`/chat/new`,search:`?draft=${encodeURIComponent(e)}`})},R=e=>{if(e.sourcePrompt?.trim())return e.sourcePrompt.trim();let{description:t}=I(e);return t.replace(/^Custom pet generated from:\s*/i,``).trim()||t},z=(e,t)=>Object.entries(t).reduce((e,[t,n])=>e.split(`{${t}}`).join(n),e),B=()=>{L(e.createChatDraft)},V=t=>{L(z(e.optimizeChatDraft,{id:t.id,name:I(t).name,description:I(t).description,sourcePrompt:R(t)}))},H=t=>{L(z(e.fixChatDraft,{dir:t.dir,reason:t.reason,details:t.details?.join(`; `)||e.noIssueDetails}))},U=O??n.prefs.sizePercent,W=Math.max(1,Math.floor((Date.now()-n.relationship.firstMetAt)/864e5)+1),G=async(e=U)=>{let t=Math.min(140,Math.max(70,Math.round(e/5)*5));k(null),t!==n.prefs.sizePercent&&await N({sizePercent:t})};return(0,T.jsxs)(S,{gap:`gap-4`,children:[(0,T.jsx)(x,{title:e.title,subtitle:e.subtitle,actions:(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),disabled:C,onClick:()=>void M(),children:[(0,T.jsx)(g,{className:a(`size-3.5`,C&&`animate-spin`),strokeWidth:1.75}),e.refresh]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,f.press),onClick:()=>void A.openCustomPetsDir(),children:[(0,T.jsx)(v,{className:`size-3.5`,strokeWidth:1.75}),e.openFolder]})]})}),(0,T.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-base p-4 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`space-y-2`,children:[(0,T.jsx)(E,{title:e.enable,desc:e.enableDesc,checked:n.prefs.enabled,disabled:C,onChange:e=>void P(e)}),(0,T.jsx)(E,{title:e.showOnStartup,desc:e.showOnStartupDesc,checked:n.prefs.showOnStartup,disabled:C,onChange:e=>void N({showOnStartup:e})})]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge-subtle bg-surface-panel p-3`,children:(0,T.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[(0,T.jsx)(d,{className:`mt-0.5 size-4 text-accent-fg`,strokeWidth:1.8}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.createTitle}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.createDesc})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-9 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-accent px-3 text-xs font-semibold text-white hover:bg-accent/90`,f.press),onClick:B,children:[(0,T.jsx)(m,{className:`size-3.5`,strokeWidth:1.75}),e.createInChat]})]})}),(0,T.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel p-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.bondTitle}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.bondDesc})]}),(0,T.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:e.bondSummary.replace(`{days}`,String(W)).replace(`{tasks}`,String(n.relationship.completedTaskCount))})]}),(0,T.jsxs)(`div`,{className:`mt-5`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.petList}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.petListDesc})]}),j?(0,T.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:I(j).name}):null]}),(0,T.jsxs)(`div`,{className:`divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-base`,children:[n.pets.map(t=>{let r=t.id===n.prefs.selectedPetId,i=I(t);return(0,T.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,T.jsx)(b,{pet:t,action:`idle`,size:`tiny`}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:i.name}),t.builtin?null:(0,T.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:e.customBadge})]}),(0,T.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:i.description})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t.builtin?null:(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,f.press),onClick:()=>V(t),children:[(0,T.jsx)(p,{className:`size-3.5`,strokeWidth:1.75}),e.optimizeInChat]}),(0,T.jsx)(`button`,{type:`button`,className:a(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,r?`bg-surface-hover text-fg-muted`:`bg-surface-panel text-fg hover:bg-surface-hover`,f.press),disabled:r||C,onClick:()=>F(t.id),children:r?e.selected:e.select})]})]},t.id)}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-1 p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:e.customPets}),(0,T.jsx)(`p`,{className:`font-mono text-xs text-fg-muted`,children:n.customPetsDir})]}),(0,T.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg`,onClick:()=>void A.openCustomPetsDir(),children:[e.openFolder,(0,T.jsx)(v,{className:`size-3.5`,strokeWidth:1.75})]})]})]}),n.petIssues.length>0?(0,T.jsxs)(`div`,{className:`mt-2 rounded-xl border border-danger/30 bg-danger/5 p-3`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-danger`,children:[(0,T.jsx)(l,{className:`size-3.5`,strokeWidth:1.8}),e.invalidPets]}),(0,T.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.petIssues.map(t=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base/70 p-2 text-xs text-fg-muted sm:flex-row sm:items-start sm:justify-between`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsx)(`p`,{className:`truncate font-mono text-[11px] text-fg`,children:t.dir}),(0,T.jsx)(`p`,{children:t.reason}),t.details?.length?(0,T.jsx)(`p`,{className:`line-clamp-2`,children:t.details.join(`; `)}):null]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex h-8 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-danger/30 bg-surface-base px-2.5 text-xs font-medium text-danger hover:bg-danger/10`,f.press),onClick:()=>H(t),children:[(0,T.jsx)(m,{className:`size-3.5`,strokeWidth:1.75}),e.fixInChat]})]},`${t.dir}-${t.reason}`))})]}):null]}),(0,T.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[(0,T.jsxs)(`div`,{className:`rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.size}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.sizeDesc})]}),(0,T.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[U,`%`]})]}),(0,T.jsx)(`input`,{type:`range`,min:70,max:140,step:5,className:`mt-3 w-full accent-accent`,value:U,onChange:e=>k(Number(e.target.value)),onBlur:()=>void G(),onKeyUp:e=>{(e.key===`Enter`||e.key===` `||e.key.startsWith(`Arrow`))&&G()},onPointerUp:()=>void G()})]}),(0,T.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[(0,T.jsx)(E,{title:e.alwaysOnTop,desc:e.alwaysOnTopDesc,checked:n.prefs.alwaysOnTop,disabled:C,onChange:e=>void N({alwaysOnTop:e})}),(0,T.jsx)(E,{title:e.bubbles,desc:e.bubblesDesc,checked:n.prefs.bubbleEnabled,disabled:C,onChange:e=>void N({bubbleEnabled:e})}),(0,T.jsx)(E,{title:e.proactiveTips,desc:e.proactiveTipsDesc,checked:n.prefs.proactiveTipsEnabled,disabled:C,onChange:e=>void N({proactiveTipsEnabled:e})}),(0,T.jsx)(E,{title:e.interactions,desc:e.interactionsDesc,checked:n.prefs.interactionEnabled,disabled:C,onChange:e=>void N({interactionEnabled:e})}),(0,T.jsx)(E,{title:e.reducedMotion,desc:e.reducedMotionDesc,checked:n.prefs.reducedMotion,disabled:C,onChange:e=>void N({reducedMotion:e})}),(0,T.jsx)(E,{title:e.clickThrough,desc:e.clickThroughDesc,checked:n.prefs.clickThroughWhenIdle,disabled:C,onChange:e=>void N({clickThroughWhenIdle:e})})]}),(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-hover/50 p-3 dark:bg-surface-hover/35 sm:flex-row sm:items-center sm:justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.behaviorMode}),(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.behaviorModeDesc})]}),(0,T.jsxs)(u,{className:`w-full sm:w-40`,triggerClassName:`h-9 bg-surface-panel`,value:n.prefs.behaviorMode,onChange:e=>void N({behaviorMode:e.target.value}),children:[(0,T.jsx)(y,{value:`focus`,children:e.behaviorFocus}),(0,T.jsx)(y,{value:`companion`,children:e.behaviorCompanion}),(0,T.jsx)(y,{value:`playful`,children:e.behaviorPlayful})]})]}),(0,T.jsxs)(`button`,{type:`button`,className:a(`inline-flex w-fit items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,f.press),disabled:C,onClick:()=>void A.resetPosition().then(r),children:[(0,T.jsx)(_,{className:`size-3.5`,strokeWidth:1.75}),e.resetPosition]})]})]})]})}export{D as DesktopPetSettings};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{At as r,Et as i,jt as a}from"./index-OJgiMh07.js";var o=e(),s=t();function c(e){let t=(0,o.c)(38),{value:c,onChange:l,disabled:u,wd:d,placeholder:f,inputClassName:p,autoFocus:m,trailing:h}=e,g;t[0]!==l||t[1]!==c?(g={initialPath:c,onPicked:l},t[0]=l,t[1]=c,t[2]=g):g=t[2];let _=r(g),v;t[3]===c?v=t[4]:(v=c.trim(),t[3]=c,t[4]=v);let y=v,b=y?`${y}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,x;t[5]===p?x=t[6]:(x=n(`min-w-0 flex-1`,p),t[5]=p,t[6]=x);let S=u||_.picking,C;t[7]===l?C=t[8]:(C=e=>void l(e.target.value),t[7]=l,t[8]=C);let w=f??d.pathInputPlaceholder,T;t[9]!==m||t[10]!==x||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==c?(T=(0,s.jsx)(`input`,{type:`text`,className:x,value:c,disabled:S,onChange:C,placeholder:w,autoFocus:m,autoComplete:`off`,spellCheck:!1}),t[9]=m,t[10]=x,t[11]=S,t[12]=C,t[13]=w,t[14]=c,t[15]=T):T=t[15];let E=u||_.picking,D;t[16]!==b||t[17]!==_.pick||t[18]!==E||t[19]!==c||t[20]!==d.selectWorkingDirectory?(D=(0,s.jsx)(a,{compact:!0,value:c,onPick:_.pick,disabled:E,title:b,"aria-label":d.selectWorkingDirectory}),t[16]=b,t[17]=_.pick,t[18]=E,t[19]=c,t[20]=d.selectWorkingDirectory,t[21]=D):D=t[21];let O;t[22]!==D||t[23]!==h?(O=(0,s.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[D,h]}),t[22]=D,t[23]=h,t[24]=O):O=t[24];let k;t[25]!==O||t[26]!==T?(k=(0,s.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[T,O]}),t[25]=O,t[26]=T,t[27]=k):k=t[27];let A;t[28]!==_.confirmPick||t[29]!==_.hasNativePicker||t[30]!==_.modalOpen||t[31]!==_.setModalOpen||t[32]!==y||t[33]!==d?(A=_.hasNativePicker?null:(0,s.jsx)(i,{open:_.modalOpen,onOpenChange:_.setModalOpen,initialAbsolutePath:y||void 0,onConfirm:_.confirmPick,wd:d}),t[28]=_.confirmPick,t[29]=_.hasNativePicker,t[30]=_.modalOpen,t[31]=_.setModalOpen,t[32]=y,t[33]=d,t[34]=A):A=t[34];let j;return t[35]!==k||t[36]!==A?(j=(0,s.jsxs)(s.Fragment,{children:[k,A]}),t[35]=k,t[36]=A,t[37]=j):j=t[37],j}export{c as t};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{At as r,Et as i,jt as a}from"./index-CYT5DOzr.js";var o=e(),s=t();function c(e){let t=(0,o.c)(38),{value:c,onChange:l,disabled:u,wd:d,placeholder:f,inputClassName:p,autoFocus:m,trailing:h}=e,g;t[0]!==l||t[1]!==c?(g={initialPath:c,onPicked:l},t[0]=l,t[1]=c,t[2]=g):g=t[2];let _=r(g),v;t[3]===c?v=t[4]:(v=c.trim(),t[3]=c,t[4]=v);let y=v,b=y?`${y}\n${d.chooseFolder}`:`${f??d.notSet}\n${d.selectWorkingDirectory}`,x;t[5]===p?x=t[6]:(x=n(`min-w-0 flex-1`,p),t[5]=p,t[6]=x);let S=u||_.picking,C;t[7]===l?C=t[8]:(C=e=>void l(e.target.value),t[7]=l,t[8]=C);let w=f??d.pathInputPlaceholder,T;t[9]!==m||t[10]!==x||t[11]!==S||t[12]!==C||t[13]!==w||t[14]!==c?(T=(0,s.jsx)(`input`,{type:`text`,className:x,value:c,disabled:S,onChange:C,placeholder:w,autoFocus:m,autoComplete:`off`,spellCheck:!1}),t[9]=m,t[10]=x,t[11]=S,t[12]=C,t[13]=w,t[14]=c,t[15]=T):T=t[15];let E=u||_.picking,D;t[16]!==b||t[17]!==_.pick||t[18]!==E||t[19]!==c||t[20]!==d.selectWorkingDirectory?(D=(0,s.jsx)(a,{compact:!0,value:c,onPick:_.pick,disabled:E,title:b,"aria-label":d.selectWorkingDirectory}),t[16]=b,t[17]=_.pick,t[18]=E,t[19]=c,t[20]=d.selectWorkingDirectory,t[21]=D):D=t[21];let O;t[22]!==D||t[23]!==h?(O=(0,s.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[D,h]}),t[22]=D,t[23]=h,t[24]=O):O=t[24];let k;t[25]!==O||t[26]!==T?(k=(0,s.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[T,O]}),t[25]=O,t[26]=T,t[27]=k):k=t[27];let A;t[28]!==_.confirmPick||t[29]!==_.hasNativePicker||t[30]!==_.modalOpen||t[31]!==_.setModalOpen||t[32]!==y||t[33]!==d?(A=_.hasNativePicker?null:(0,s.jsx)(i,{open:_.modalOpen,onOpenChange:_.setModalOpen,initialAbsolutePath:y||void 0,onConfirm:_.confirmPick,wd:d}),t[28]=_.confirmPick,t[29]=_.hasNativePicker,t[30]=_.modalOpen,t[31]=_.setModalOpen,t[32]=y,t[33]=d,t[34]=A):A=t[34];let j;return t[35]!==k||t[36]!==A?(j=(0,s.jsxs)(s.Fragment,{children:[k,A]}),t[35]=k,t[36]=A,t[37]=j):j=t[37],j}export{c as t};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-D02NNLCZ.js";import{n as i}from"./locale-store-D6hs74o5.js";import{ao as a}from"./index-OJgiMh07.js";var o=t();e();var s=n();function c(){let e=(0,o.c)(44),t=i(d),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let c=n.extensionDebug,f=a(),p;e[2]===f?p=e[3]:(p=f.toSorted(u),e[2]=f,e[3]=p);let m=p,h;e[4]===c.title?h=e[5]:(h=(0,s.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:c.title}),e[4]=c.title,e[5]=h);let g;e[6]===c.subtitle?g=e[7]:(g=(0,s.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.subtitle}),e[6]=c.subtitle,e[7]=g);let _;e[8]!==h||e[9]!==g?(_=(0,s.jsxs)(`div`,{children:[h,g]}),e[8]=h,e[9]=g,e[10]=_):_=e[10];let v;e[11]===c.listHeading?v=e[12]:(v=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c.listHeading}),e[11]=c.listHeading,e[12]=v);let y;e[13]===c.colId?y=e[14]:(y=(0,s.jsx)(`th`,{className:`py-2 pr-2`,children:c.colId}),e[13]=c.colId,e[14]=y);let b;e[15]===c.colName?b=e[16]:(b=(0,s.jsx)(`th`,{className:`py-2 pr-2`,children:c.colName}),e[15]=c.colName,e[16]=b);let x;e[17]===c.colPermissions?x=e[18]:(x=(0,s.jsx)(`th`,{className:`py-2`,children:c.colPermissions}),e[17]=c.colPermissions,e[18]=x);let S;e[19]!==y||e[20]!==b||e[21]!==x?(S=(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{className:`border-b border-edge text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[19]=y,e[20]=b,e[21]=x,e[22]=S):S=e[22];let C;e[23]===m?C=e[24]:(C=m.map(l),e[23]=m,e[24]=C);let w;e[25]===C?w=e[26]:(w=(0,s.jsx)(`tbody`,{children:C}),e[25]=C,e[26]=w);let T;e[27]!==w||e[28]!==S?(T=(0,s.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`w-full min-w-[32rem] border-collapse text-left text-sm`,children:[S,w]})}),e[27]=w,e[28]=S,e[29]=T):T=e[29];let E;e[30]!==T||e[31]!==v?(E=(0,s.jsxs)(`section`,{className:`rounded-xl bg-surface-base p-4`,children:[v,T]}),e[30]=T,e[31]=v,e[32]=E):E=e[32];let D;e[33]===c.futureHeading?D=e[34]:(D=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c.futureHeading}),e[33]=c.futureHeading,e[34]=D);let O;e[35]===c.futureBody?O=e[36]:(O=(0,s.jsx)(`p`,{className:`mt-2`,children:c.futureBody}),e[35]=c.futureBody,e[36]=O);let k;e[37]!==D||e[38]!==O?(k=(0,s.jsxs)(`section`,{className:`rounded-xl bg-surface-muted/50 p-4 text-sm text-fg-muted shadow-surface`,children:[D,O]}),e[37]=D,e[38]=O,e[39]=k):k=e[39];let A;return e[40]!==E||e[41]!==k||e[42]!==_?(A=(0,s.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[_,E,k]}),e[40]=E,e[41]=k,e[42]=_,e[43]=A):A=e[43],A}function l(e){return(0,s.jsxs)(`tr`,{className:`border-b border-edge-subtle`,children:[(0,s.jsx)(`td`,{className:`py-2 pr-2 font-mono text-xs text-fg`,children:e.id}),(0,s.jsx)(`td`,{className:`py-2 pr-2 text-fg`,children:e.name}),(0,s.jsx)(`td`,{className:`py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function u(e,t){return e.id.localeCompare(t.id)}function d(e){return e.language}export{c as ExtensionDebugPage};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-B4XqB8I6.js";import{n as i}from"./locale-store-deR2zRaE.js";import{Wa as a}from"./index-CYT5DOzr.js";var o=t();e();var s=n();function c(){let e=(0,o.c)(44),t=i(d),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let c=n.extensionDebug,f=a(),p;e[2]===f?p=e[3]:(p=f.toSorted(u),e[2]=f,e[3]=p);let m=p,h;e[4]===c.title?h=e[5]:(h=(0,s.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:c.title}),e[4]=c.title,e[5]=h);let g;e[6]===c.subtitle?g=e[7]:(g=(0,s.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:c.subtitle}),e[6]=c.subtitle,e[7]=g);let _;e[8]!==h||e[9]!==g?(_=(0,s.jsxs)(`div`,{children:[h,g]}),e[8]=h,e[9]=g,e[10]=_):_=e[10];let v;e[11]===c.listHeading?v=e[12]:(v=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c.listHeading}),e[11]=c.listHeading,e[12]=v);let y;e[13]===c.colId?y=e[14]:(y=(0,s.jsx)(`th`,{className:`py-2 pr-2`,children:c.colId}),e[13]=c.colId,e[14]=y);let b;e[15]===c.colName?b=e[16]:(b=(0,s.jsx)(`th`,{className:`py-2 pr-2`,children:c.colName}),e[15]=c.colName,e[16]=b);let x;e[17]===c.colPermissions?x=e[18]:(x=(0,s.jsx)(`th`,{className:`py-2`,children:c.colPermissions}),e[17]=c.colPermissions,e[18]=x);let S;e[19]!==y||e[20]!==b||e[21]!==x?(S=(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{className:`border-b border-edge text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[19]=y,e[20]=b,e[21]=x,e[22]=S):S=e[22];let C;e[23]===m?C=e[24]:(C=m.map(l),e[23]=m,e[24]=C);let w;e[25]===C?w=e[26]:(w=(0,s.jsx)(`tbody`,{children:C}),e[25]=C,e[26]=w);let T;e[27]!==w||e[28]!==S?(T=(0,s.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`w-full min-w-[32rem] border-collapse text-left text-sm`,children:[S,w]})}),e[27]=w,e[28]=S,e[29]=T):T=e[29];let E;e[30]!==T||e[31]!==v?(E=(0,s.jsxs)(`section`,{className:`rounded-xl bg-surface-base p-4`,children:[v,T]}),e[30]=T,e[31]=v,e[32]=E):E=e[32];let D;e[33]===c.futureHeading?D=e[34]:(D=(0,s.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:c.futureHeading}),e[33]=c.futureHeading,e[34]=D);let O;e[35]===c.futureBody?O=e[36]:(O=(0,s.jsx)(`p`,{className:`mt-2`,children:c.futureBody}),e[35]=c.futureBody,e[36]=O);let k;e[37]!==D||e[38]!==O?(k=(0,s.jsxs)(`section`,{className:`rounded-xl bg-surface-muted/50 p-4 text-sm text-fg-muted shadow-surface`,children:[D,O]}),e[37]=D,e[38]=O,e[39]=k):k=e[39];let A;return e[40]!==E||e[41]!==k||e[42]!==_?(A=(0,s.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-8 sm:px-5 xl:px-6`,children:[_,E,k]}),e[40]=E,e[41]=k,e[42]=_,e[43]=A):A=e[43],A}function l(e){return(0,s.jsxs)(`tr`,{className:`border-b border-edge-subtle`,children:[(0,s.jsx)(`td`,{className:`py-2 pr-2 font-mono text-xs text-fg`,children:e.id}),(0,s.jsx)(`td`,{className:`py-2 pr-2 text-fg`,children:e.name}),(0,s.jsx)(`td`,{className:`py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function u(e,t){return e.id.localeCompare(t.id)}function d(e){return e.language}export{c as ExtensionDebugPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{ao as a,co as o,do as s,dt as c}from"./index-OJgiMh07.js";var l=n(),u=e(t(),1),d=r();function f(){let e=(0,l.c)(26),{extensionId:t,pageId:n}=i(),r=a(),f=s(m),g=s(p),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&o(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==f?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return f({startExtra:null,main:(0,d.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,d.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,f],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=f,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,u.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,d.jsx)(h,{message:`No extension ID provided.`}),e[13]=t):t=e[13],t}if(!_){let n=`Extension "${t}" not found or has no UI.`,r;return e[14]===n?r=e[15]:(r=(0,d.jsx)(h,{message:n}),e[14]=n,e[15]=r),r}if(!v?.length){let n=`Extension "${t}" has no page contributions.`,r;return e[16]===n?r=e[17]:(r=(0,d.jsx)(h,{message:n}),e[16]=n,e[17]=r),r}if(!b){let r=`Page "${n}" not found in extension "${t}".`,i;return e[18]===r?i=e[19]:(i=(0,d.jsx)(h,{message:r}),e[18]=r,e[19]=i),i}let C=_.ui?.permissions,w;return e[20]!==_.name||e[21]!==t||e[22]!==b.entrypoint||e[23]!==b.title||e[24]!==C?(w=(0,d.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,d.jsx)(c,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[20]=_.name,e[21]=t,e[22]=b.entrypoint,e[23]=b.title,e[24]=C,e[25]=w):w=e[25],w}function p(e){return e.clearPageHeader}function m(e){return e.setPageHeader}function h(e){let t=(0,l.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,d.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-1 items-center justify-center`,children:(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})})}),t[0]=n,t[1]=r),r}export{f as ExtensionPage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{Wa as a,Xa as o,dt as s,qa as c}from"./index-CYT5DOzr.js";var l=n(),u=e(t(),1),d=r();function f(){let e=(0,l.c)(26),{extensionId:t,pageId:n}=i(),r=a(),f=o(m),g=o(p),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&c(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==f?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return f({startExtra:null,main:(0,d.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,d.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,f],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=f,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,u.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,d.jsx)(h,{message:`No extension ID provided.`}),e[13]=t):t=e[13],t}if(!_){let n=`Extension "${t}" not found or has no UI.`,r;return e[14]===n?r=e[15]:(r=(0,d.jsx)(h,{message:n}),e[14]=n,e[15]=r),r}if(!v?.length){let n=`Extension "${t}" has no page contributions.`,r;return e[16]===n?r=e[17]:(r=(0,d.jsx)(h,{message:n}),e[16]=n,e[17]=r),r}if(!b){let r=`Page "${n}" not found in extension "${t}".`,i;return e[18]===r?i=e[19]:(i=(0,d.jsx)(h,{message:r}),e[18]=r,e[19]=i),i}let C=_.ui?.permissions,w;return e[20]!==_.name||e[21]!==t||e[22]!==b.entrypoint||e[23]!==b.title||e[24]!==C?(w=(0,d.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,d.jsx)(s,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[20]=_.name,e[21]=t,e[22]=b.entrypoint,e[23]=b.title,e[24]=C,e[25]=w):w=e[25],w}function p(e){return e.clearPageHeader}function m(e){return e.setPageHeader}function h(e){let t=(0,l.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,d.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-1 items-center justify-center`,children:(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})})}),t[0]=n,t[1]=r),r}export{f as ExtensionPage};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-B4XqB8I6.js";import{l as c,n as l,o as u,r as d,s as f}from"./locale-store-deR2zRaE.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{Ro as m,Wa as h,cs as g,ds as _,dt as v,ls as y,us as b,zo as x}from"./index-CYT5DOzr.js";import{t as S}from"./settings-loading-skeleton-CCtlhoy7.js";import{n as C,t as w}from"./use-autosave-BrjVk5VH.js";import{a as T,l as E,o as D,t as O}from"./voice-api-key-field-BISTPfq_.js";import{t as k}from"./schema-form-B84DckWe.js";var A=e(t(),1),j=n(),M=r();function N(e){let t=(0,j.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,M.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}var P=[{id:`whisper-large-v3-turbo`,name:`Whisper Large v3 Turbo`},{id:`whisper-large-v3`,name:`Whisper Large v3`}];function F(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function I(){return o(y,g)}function L(){return o(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function R(e,t){if(!e||!t)return{apiKey:``,model:P[0].id};if(t===`alibaba`)return{apiKey:e.stt.alibaba?.apiKey??``,model:e.stt.alibaba?.model??`paraformer-v2`};if(t===`openai`)return{apiKey:e.stt.openai?.apiKey??``,model:e.stt.openai?.model??`whisper-1`};let n=e.stt.providers?.[t];return{apiKey:typeof n?.apiKey==`string`?n.apiKey:``,model:typeof n?.model==`string`?n.model:P[0].id}}function z({providerId:e,voiceSettings:t,mutateVoice:n}){let r=s(l(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,c={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:u}=p(d(`/api/voice/stt-providers`),D,{revalidateOnFocus:!1}),f=(0,A.useMemo)(()=>u?.providers.some(t=>t.id===e&&t.configured)??!1,[e,u]),h=(0,A.useMemo)(()=>R(t,e),[e,t]),_=(0,A.useRef)(!1),[v,y]=(0,A.useState)(null),b=v??h,S=(0,A.useRef)(b);S.current=b;let T=h,k=w({value:b,dirty:b.apiKey!==T.apiKey||b.model!==T.model,onSave:(0,A.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,e===`alibaba`?(i.stt.provider=`alibaba`,i.stt.alibaba={...i.stt.alibaba,apiKey:r.apiKey,model:r.model}):e===`openai`?(i.stt.provider=`openai`,i.stt.openai={...i.stt.openai,apiKey:r.apiKey,model:r.model}):(i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},(!i.stt.provider||i.stt.provider===`alibaba`||i.stt.provider===`openai`)&&(i.stt.provider=e)),await E(i),await n(i,!1),_.current=JSON.stringify(S.current)!==JSON.stringify(r),y(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),j=e===`groq`?P:[{id:b.model,name:b.model}];return(0,M.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:k.onBlurCapture,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsxs)(`div`,{children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,M.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(C,{status:k.status,error:k.error}),(0,M.jsx)(`span`,{className:o(`rounded-full px-2 py-0.5 text-xs font-medium`,f?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:f?a.configured:a.notConfigured})]})]}),(0,M.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,M.jsxs)(`div`,{className:o(`flex flex-col gap-1.5`,g),children:[(0,M.jsx)(N,{children:i.stt.apiKey}),(0,M.jsx)(O,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:b.apiKey,onChange:e=>{_.current=!0,y(t=>({...t??h,apiKey:e}))},labels:c,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,M.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,M.jsxs)(`div`,{className:o(`flex flex-col gap-1.5`,g),children:[(0,M.jsx)(N,{children:i.stt.model}),e===`groq`?(0,M.jsx)(m,{className:I(),value:b.model,onChange:e=>{_.current=!0,y(t=>({...t??h,model:e.target.value})),k.saveNow({...b,model:e.target.value})},children:j.map(e=>(0,M.jsx)(x,{value:e.id,children:e.name},e.id))}):(0,M.jsx)(`input`,{className:L(),value:b.model,onChange:e=>{_.current=!0,y(t=>({...t??h,model:e.target.value}))}})]})]})]})}function B(e){let t=(0,j.c)(13),{extensionId:n}=e,r=l(H),i=c(V),a;t[0]===n?a=t[1]:(a=()=>f(d(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:s}=p(i&&n?`ext-stt-detail-${n}`:null,a),u;t[2]===o?u=t[3]:(u=F(o),t[2]=o,t[3]=u);let m=u,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1},t[4]=h):h=t[4];let{data:g,mutate:_,isLoading:v}=p(i?`voice-settings-ext-stt`:null,T,h);if(!i)return null;if(s||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,M.jsx)(S,{rows:2}),t[5]=e):e=t[5],e}if(!m){let e=r===`zh`?`该扩展未声明 mediaUnderstandingProviders。`:`This extension does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,M.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!g)return null;let y=`${n}:${m}`,b;return t[8]!==_||t[9]!==m||t[10]!==y||t[11]!==g?(b=(0,M.jsx)(z,{providerId:m,voiceSettings:g,mutateVoice:_},y),t[8]=_,t[9]=m,t[10]=y,t[11]=g,t[12]=b):b=t[12],b}function V(e){return!!e.token}function H(e){return e.language}function U(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e){let t={};if(e.type!==`object`||!U(e.properties))return t;for(let[n,r]of Object.entries(e.properties))U(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function G(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function K({extensionId:e}){let t=c(e=>!!e.token),{data:n,error:r}=p(t&&e?`ext-detail-${e}`:null,()=>f(d(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:o}=p(t&&e?`ext-cfg-${e}`:null,()=>f(d(`/api/extensions/${encodeURIComponent(e)}/config`))),s=n?.manifest?.configSchema,l=(0,A.useMemo)(()=>s&&s.type===`object`?W(s):{},[s]),m=(0,A.useMemo)(()=>({...l,...i??{}}),[l,i]),[h,g]=(0,A.useReducer)(G,{localValues:{},isDirty:!1}),v=(0,A.useRef)(!1),y=(0,A.useRef)(h.localValues);y.current=h.localValues;let b=(0,A.useRef)(m);!v.current&&b.current!==m&&(b.current=m,g({type:`sync`,value:m}));let x=(0,A.useCallback)(e=>{v.current=!0,g({type:`change`,value:e})},[]),S=(0,A.useCallback)(()=>{!s||s.type!==`object`||(v.current=!0,g({type:`reset-defaults`,value:{...W(s)}}))},[s]),T=(0,A.useCallback)(async t=>{if(!e)return;let n=await u(d(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),g({type:`saved`,value:t}),v.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),E=w({value:h.localValues,dirty:h.isDirty,onSave:T});if(!t)return null;if(r||o){let e=r??o;return(0,M.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!s||s.type!==`object`?null:(0,M.jsxs)(`div`,{className:`mb-6 flex flex-col gap-3 rounded-xl bg-surface-base p-4`,onBlurCapture:E.onBlurCapture,children:[(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,M.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,M.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,M.jsx)(C,{status:E.status,error:E.error}),(0,M.jsx)(_,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,M.jsx)(k,{schema:s,values:h.localValues,onChange:x})]})}function q(){let e=(0,j.c)(38),t=l(J),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:c}=i(),u=h();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,M.jsx)(Y,{message:`No extension ID provided.`}),e[2]=t):t=e[2],t}let d,f,p;if(e[3]!==o||e[4]!==u||e[5]!==c){p=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),d=u.find(t),!d){let t=`Extension "${o}" not found or is not available in this workspace.`,n;e[11]===t?n=e[12]:(n=(0,M.jsx)(Y,{message:t}),e[11]=t,e[12]=n),p=n;break bb0}let n=d.ui?.contributions?.settingsPanels;f=c?n?.find(e=>e.id===c||e.id===`${o}.${c}`):n?.[0]}e[3]=o,e[4]=u,e[5]=c,e[6]=d,e[7]=f,e[8]=p}else d=e[6],f=e[7],p=e[8];if(p!==Symbol.for(`react.early_return_sentinel`))return p;let m=f,g=!!(m&&d.ui),_=!!d.hasConfigSchema,y=d.kind===`media-provider`;if(!_&&!g&&!y){let t=`Extension "${o}" has no settings panels or config schema.`,n;return e[13]===t?n=e[14]:(n=(0,M.jsx)(Y,{message:t}),e[13]=t,e[14]=n),n}let b=m?.title??`${d.name} Settings`,x;e[15]===b?x=e[16]:(x=(0,M.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:b}),e[15]=b,e[16]=x);let S;e[17]!==y||e[18]!==r?(S=y?(0,M.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,M.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,M.jsx)(a,{to:`/settings/capabilities/voice`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[17]=y,e[18]=r,e[19]=S):S=e[19];let C;e[20]!==o||e[21]!==y?(C=y?(0,M.jsx)(B,{extensionId:o}):null,e[20]=o,e[21]=y,e[22]=C):C=e[22];let w;e[23]!==o||e[24]!==_?(w=_?(0,M.jsx)(K,{extensionId:o}):null,e[23]=o,e[24]=_,e[25]=w):w=e[25];let T;e[26]!==d.name||e[27]!==d.ui||e[28]!==o||e[29]!==g||e[30]!==m?(T=g&&m&&d.ui?(0,M.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,M.jsx)(v,{extensionId:o,extensionName:d.name,entrypoint:m.entrypoint,permissions:d.ui?.permissions,title:m.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[26]=d.name,e[27]=d.ui,e[28]=o,e[29]=g,e[30]=m,e[31]=T):T=e[31];let E;return e[32]!==x||e[33]!==S||e[34]!==C||e[35]!==w||e[36]!==T?(E=(0,M.jsxs)(`div`,{className:`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,children:[x,S,C,w,T]}),e[32]=x,e[33]=S,e[34]=C,e[35]=w,e[36]=T,e[37]=E):E=e[37],E}function J(e){return e.language}function Y(e){let t=(0,j.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,M.jsx)(`div`,{className:`flex w-full flex-col gap-3 px-3 py-8 sm:px-5 xl:px-6`,children:(0,M.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{q as ExtensionSettingsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{r,s as i}from"./locale-store-D6hs74o5.js";import{$a as a,ti as o,vs as s}from"./index-OJgiMh07.js";var c=e(t(),1),l=n(),u=new Set([`updates`,`security`,`advanced`]),d=new Set([`local`,`cdp`,`cloud`]);function f(e,t){return t===`advanced`?!0:!u.has(e)}function p(e,t){return e.filter(e=>f(e,t))}function m(e,t){return t===`advanced`?!0:!d.has(e)}function h(e,t){return e.filter(e=>m(e,t))}function g(){return`network`}function _(){return`overview`}function v(e,t){let n=(0,l.c)(5),r=o(y),i,a;n[0]!==e||n[1]!==r||n[2]!==t?(i=()=>{f(e,r)||t(g())},a=[e,r,t],n[0]=e,n[1]=r,n[2]=t,n[3]=i,n[4]=a):(i=n[3],a=n[4]),(0,c.useEffect)(i,a)}function y(e){return e.mode}function b(e,t){let n=(0,l.c)(5),r=o(x),i,a;n[0]!==e||n[1]!==r||n[2]!==t?(i=()=>{m(e,r)||t(_())},a=[e,r,t],n[0]=e,n[1]=r,n[2]=t,n[3]=i,n[4]=a):(i=n[3],a=n[4]),(0,c.useEffect)(i,a)}function x(e){return e.mode}var S=18790,C={enabled:!0,maxAttempts:5,windowMs:9e5,blockDurationMs:3e5,exemptLoopback:!0};function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(e){return s(e)}async function E(e){let t=await i(r(`/api/gateway/reveal-auth-secret/${encodeURIComponent(e)}`),{method:`POST`,body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}async function D(){let e=await i(r(`/api/agents/browser/reveal-cloud-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok||!e.payload)throw Error(e.error?.message??`Reveal failed`);return e.payload}function O(e){return T(e)?``:e.trim()}function k(e){return[...e].map(e=>e.trim()).sort()}function A(e){return JSON.stringify({bind:e.bind,customBindHost:e.customBindHost.trim(),port:e.port,auth:{mode:e.auth.mode,token:O(e.auth.token),password:O(e.auth.password),rateLimit:e.auth.rateLimit,trustedProxy:{userHeader:e.auth.trustedProxy.userHeader.trim(),requiredHeaders:k(e.auth.trustedProxy.requiredHeaders),allowUsers:k(e.auth.trustedProxy.allowUsers),allowLoopback:e.auth.trustedProxy.allowLoopback}},corsOrigins:k(e.corsOrigins),trustedProxies:k(e.trustedProxies),allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback})}function j(e,t){return A(e)!==A(t)}function M(e){return e===`none`||e===`token`||e===`password`||e===`trusted-proxy`?e:`token`}function N(e){let t=w(e)?e:{};return{enabled:t.enabled!==!1,maxAttempts:typeof t.maxAttempts==`number`&&Number.isFinite(t.maxAttempts)?Math.max(1,Math.floor(t.maxAttempts)):C.maxAttempts,windowMs:typeof t.windowMs==`number`&&Number.isFinite(t.windowMs)&&t.windowMs>0?Math.floor(t.windowMs):C.windowMs,blockDurationMs:typeof t.blockDurationMs==`number`&&Number.isFinite(t.blockDurationMs)&&t.blockDurationMs>0?Math.floor(t.blockDurationMs):typeof t.lockoutMs==`number`&&Number.isFinite(t.lockoutMs)&&t.lockoutMs>0?Math.floor(t.lockoutMs):C.blockDurationMs,exemptLoopback:t.exemptLoopback!==!1}}function P(e){let t=w(e)?e:{};return{userHeader:typeof t.userHeader==`string`?t.userHeader:``,requiredHeaders:I(t.requiredHeaders,32),allowUsers:I(t.allowUsers,128),allowLoopback:t.allowLoopback===!0}}function F(e){return e===`auto`||e===`off`||e===`explicit`?e:`auto`}function I(e,t=24){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function L(e){return e===`auto`||e===`loopback`||e===`lan`||e===`tailnet`||e===`custom`?e:`loopback`}function R(e){if(e.bind===`loopback`)return!1;if(e.bind===`lan`)return!0;if(e.bind===`custom`){let t=e.customBindHost.trim().toLowerCase();return t?t!==`127.0.0.1`&&t!==`localhost`&&t!==`::1`:!0}return!0}function z(e){let t=R(e);return t&&e.auth.mode===`none`?`Network-accessible gateway requires authentication (token, password, or trusted-proxy).`:t&&e.auth.mode===`trusted-proxy`&&e.trustedProxies.length===0?`Trusted-proxy auth on a network bind requires at least one gateway.trustedProxies entry.`:e.auth.mode===`trusted-proxy`&&!e.auth.trustedProxy.userHeader.trim()?`Trusted-proxy auth requires gateway.auth.trustedProxy.userHeader.`:t&&e.corsOrigins.includes(`*`)?`CORS wildcard "*" is not allowed on network-accessible binds.`:e.bind===`custom`&&!e.customBindHost.trim()?`Custom bind mode requires a bind address.`:null}function B(e){let t=w(e)?e:{},n=w(t.gateway)?t.gateway:{},r=w(n.auth)?n.auth:{},i=w(n.security)?n.security:{},a=w(t.update)?t.update:{},o=w(a.auto)?a.auto:{},s=a.channel,c=s===`beta`||s===`dev`||s===`stable`?s:`stable`,l=Array.isArray(n.corsOrigins)?n.corsOrigins.filter(e=>typeof e==`string`&&e.trim().length>0):[];return{bind:L(n.bind),customBindHost:typeof n.customBindHost==`string`&&n.customBindHost.trim()?n.customBindHost.trim():``,port:typeof n.port==`number`&&Number.isFinite(n.port)?Math.floor(n.port):S,auth:{mode:M(r.mode),token:typeof r.token==`string`?r.token:``,password:typeof r.password==`string`?r.password:``,rateLimit:N(r.rateLimit),trustedProxy:P(r.trustedProxy)},corsOrigins:l,trustedProxies:I(n.trustedProxies,64),allowRealIpFallback:n.allowRealIpFallback===!0,dangerouslyAllowHostHeaderOriginFallback:n.dangerouslyAllowHostHeaderOriginFallback===!0,securityStrict:i.strict===!0,maxSseConnections:typeof n.maxSseConnections==`number`&&Number.isFinite(n.maxSseConnections)?Math.max(1,Math.floor(n.maxSseConnections)):100,channelConnectDeferMode:F(n.channelConnectDeferMode),channelConnectDeferIds:I(n.channelConnectDeferIds),channelConnectDeferSkipIds:I(n.channelConnectDeferSkipIds),updateChannel:c,updateCheckOnStart:a.checkOnStart!==!1,updateAutoEnabled:o.enabled===!0,updateAutoStableDelayHours:typeof o.stableDelayHours==`number`&&Number.isFinite(o.stableDelayHours)?Math.max(0,Math.floor(o.stableDelayHours)):6,updateAutoStableJitterHours:typeof o.stableJitterHours==`number`&&Number.isFinite(o.stableJitterHours)?Math.max(0,Math.floor(o.stableJitterHours)):12,updateAutoBetaCheckIntervalHours:typeof o.betaCheckIntervalHours==`number`&&Number.isFinite(o.betaCheckIntervalHours)?Math.max(.25,o.betaCheckIntervalHours):1}}function V(e){let t={mode:e.auth.mode,rateLimit:e.auth.rateLimit};if(e.auth.mode===`token`){let n=e.auth.token.trim();n.length>0&&!T(n)&&(t.token=e.auth.token),t.password=null,t.trustedProxy=null}else if(e.auth.mode===`password`){let n=e.auth.password.trim();n.length>0&&!T(n)&&(t.password=e.auth.password),t.token=null,t.trustedProxy=null}else if(e.auth.mode===`trusted-proxy`){t.token=null,t.password=null;let n=e.auth.trustedProxy;t.trustedProxy={userHeader:n.userHeader.trim(),...n.requiredHeaders.length>0?{requiredHeaders:n.requiredHeaders}:{},...n.allowUsers.length>0?{allowUsers:n.allowUsers}:{},...n.allowLoopback?{allowLoopback:!0}:{}}}else t.token=null,t.password=null,t.trustedProxy=null;return t}async function H(e){let t=z(e);if(t)throw Error(t);await i(r(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{bind:e.bind,...e.bind===`custom`?{customBindHost:e.customBindHost.trim()}:{},port:e.port,auth:V(e),corsOrigins:e.corsOrigins,trustedProxies:e.trustedProxies,allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback,security:{strict:e.securityStrict},maxSseConnections:e.maxSseConnections,channelConnectDeferMode:e.channelConnectDeferMode,channelConnectDeferIds:e.channelConnectDeferIds,channelConnectDeferSkipIds:e.channelConnectDeferSkipIds},update:{channel:e.updateChannel,checkOnStart:e.updateCheckOnStart,auto:{enabled:e.updateAutoEnabled,stableDelayHours:e.updateAutoStableDelayHours,stableJitterHours:e.updateAutoStableJitterHours,betaCheckIntervalHours:e.updateAutoBetaCheckIntervalHours}}})}),a()}export{E as a,v as c,p as d,D as i,m as l,B as n,z as o,H as r,b as s,j as t,h as u};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{r,s as i}from"./locale-store-deR2zRaE.js";import{Lr as a,Ra as o,rs as s}from"./index-CYT5DOzr.js";var c=e(t(),1),l=n(),u=new Set([`updates`,`security`,`advanced`]),d=new Set([`local`,`cdp`,`cloud`]);function f(e,t){return t===`advanced`?!0:!u.has(e)}function p(e,t){return e.filter(e=>f(e,t))}function m(e,t){return t===`advanced`?!0:!d.has(e)}function h(e,t){return e.filter(e=>m(e,t))}function g(){return`network`}function _(){return`overview`}function v(e,t){let n=(0,l.c)(5),r=a(y),i,o;n[0]!==e||n[1]!==r||n[2]!==t?(i=()=>{f(e,r)||t(g())},o=[e,r,t],n[0]=e,n[1]=r,n[2]=t,n[3]=i,n[4]=o):(i=n[3],o=n[4]),(0,c.useEffect)(i,o)}function y(e){return e.mode}function b(e,t){let n=(0,l.c)(5),r=a(x),i,o;n[0]!==e||n[1]!==r||n[2]!==t?(i=()=>{m(e,r)||t(_())},o=[e,r,t],n[0]=e,n[1]=r,n[2]=t,n[3]=i,n[4]=o):(i=n[3],o=n[4]),(0,c.useEffect)(i,o)}function x(e){return e.mode}var S=18790,C={enabled:!0,maxAttempts:5,windowMs:9e5,blockDurationMs:3e5,exemptLoopback:!0};function w(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function T(e){return s(e)}async function E(e){let t=await i(r(`/api/gateway/reveal-auth-secret/${encodeURIComponent(e)}`),{method:`POST`,body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}async function D(){let e=await i(r(`/api/agents/browser/reveal-cloud-api-key`),{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok||!e.payload)throw Error(e.error?.message??`Reveal failed`);return e.payload}function O(e){return T(e)?``:e.trim()}function k(e){return[...e].map(e=>e.trim()).sort()}function A(e){return JSON.stringify({bind:e.bind,customBindHost:e.customBindHost.trim(),port:e.port,auth:{mode:e.auth.mode,token:O(e.auth.token),password:O(e.auth.password),rateLimit:e.auth.rateLimit,trustedProxy:{userHeader:e.auth.trustedProxy.userHeader.trim(),requiredHeaders:k(e.auth.trustedProxy.requiredHeaders),allowUsers:k(e.auth.trustedProxy.allowUsers),allowLoopback:e.auth.trustedProxy.allowLoopback}},corsOrigins:k(e.corsOrigins),trustedProxies:k(e.trustedProxies),allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback})}function j(e,t){return A(e)!==A(t)}function M(e){return e===`none`||e===`token`||e===`password`||e===`trusted-proxy`?e:`token`}function N(e){let t=w(e)?e:{};return{enabled:t.enabled!==!1,maxAttempts:typeof t.maxAttempts==`number`&&Number.isFinite(t.maxAttempts)?Math.max(1,Math.floor(t.maxAttempts)):C.maxAttempts,windowMs:typeof t.windowMs==`number`&&Number.isFinite(t.windowMs)&&t.windowMs>0?Math.floor(t.windowMs):C.windowMs,blockDurationMs:typeof t.blockDurationMs==`number`&&Number.isFinite(t.blockDurationMs)&&t.blockDurationMs>0?Math.floor(t.blockDurationMs):typeof t.lockoutMs==`number`&&Number.isFinite(t.lockoutMs)&&t.lockoutMs>0?Math.floor(t.lockoutMs):C.blockDurationMs,exemptLoopback:t.exemptLoopback!==!1}}function P(e){let t=w(e)?e:{};return{userHeader:typeof t.userHeader==`string`?t.userHeader:``,requiredHeaders:I(t.requiredHeaders,32),allowUsers:I(t.allowUsers,128),allowLoopback:t.allowLoopback===!0}}function F(e){return e===`auto`||e===`off`||e===`explicit`?e:`auto`}function I(e,t=24){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function L(e){return e===`auto`||e===`loopback`||e===`lan`||e===`tailnet`||e===`custom`?e:`loopback`}function R(e){if(e.bind===`loopback`)return!1;if(e.bind===`lan`)return!0;if(e.bind===`custom`){let t=e.customBindHost.trim().toLowerCase();return t?t!==`127.0.0.1`&&t!==`localhost`&&t!==`::1`:!0}return!0}function z(e){let t=R(e);return t&&e.auth.mode===`none`?`Network-accessible gateway requires authentication (token, password, or trusted-proxy).`:t&&e.auth.mode===`trusted-proxy`&&e.trustedProxies.length===0?`Trusted-proxy auth on a network bind requires at least one gateway.trustedProxies entry.`:e.auth.mode===`trusted-proxy`&&!e.auth.trustedProxy.userHeader.trim()?`Trusted-proxy auth requires gateway.auth.trustedProxy.userHeader.`:t&&e.corsOrigins.includes(`*`)?`CORS wildcard "*" is not allowed on network-accessible binds.`:e.bind===`custom`&&!e.customBindHost.trim()?`Custom bind mode requires a bind address.`:null}function B(e){let t=w(e)?e:{},n=w(t.gateway)?t.gateway:{},r=w(n.auth)?n.auth:{},i=w(n.security)?n.security:{},a=w(t.update)?t.update:{},o=w(a.auto)?a.auto:{},s=a.channel,c=s===`beta`||s===`dev`||s===`stable`?s:`stable`,l=Array.isArray(n.corsOrigins)?n.corsOrigins.filter(e=>typeof e==`string`&&e.trim().length>0):[];return{bind:L(n.bind),customBindHost:typeof n.customBindHost==`string`&&n.customBindHost.trim()?n.customBindHost.trim():``,port:typeof n.port==`number`&&Number.isFinite(n.port)?Math.floor(n.port):S,auth:{mode:M(r.mode),token:typeof r.token==`string`?r.token:``,password:typeof r.password==`string`?r.password:``,rateLimit:N(r.rateLimit),trustedProxy:P(r.trustedProxy)},corsOrigins:l,trustedProxies:I(n.trustedProxies,64),allowRealIpFallback:n.allowRealIpFallback===!0,dangerouslyAllowHostHeaderOriginFallback:n.dangerouslyAllowHostHeaderOriginFallback===!0,securityStrict:i.strict===!0,channelConnectDeferMode:F(n.channelConnectDeferMode),channelConnectDeferIds:I(n.channelConnectDeferIds),channelConnectDeferSkipIds:I(n.channelConnectDeferSkipIds),updateChannel:c,updateCheckOnStart:a.checkOnStart!==!1,updateAutoEnabled:o.enabled===!0,updateAutoStableDelayHours:typeof o.stableDelayHours==`number`&&Number.isFinite(o.stableDelayHours)?Math.max(0,Math.floor(o.stableDelayHours)):6,updateAutoStableJitterHours:typeof o.stableJitterHours==`number`&&Number.isFinite(o.stableJitterHours)?Math.max(0,Math.floor(o.stableJitterHours)):12,updateAutoBetaCheckIntervalHours:typeof o.betaCheckIntervalHours==`number`&&Number.isFinite(o.betaCheckIntervalHours)?Math.max(.25,o.betaCheckIntervalHours):1}}function V(e){let t={mode:e.auth.mode,rateLimit:e.auth.rateLimit};if(e.auth.mode===`token`){let n=e.auth.token.trim();n.length>0&&!T(n)&&(t.token=e.auth.token),t.password=null,t.trustedProxy=null}else if(e.auth.mode===`password`){let n=e.auth.password.trim();n.length>0&&!T(n)&&(t.password=e.auth.password),t.token=null,t.trustedProxy=null}else if(e.auth.mode===`trusted-proxy`){t.token=null,t.password=null;let n=e.auth.trustedProxy;t.trustedProxy={userHeader:n.userHeader.trim(),...n.requiredHeaders.length>0?{requiredHeaders:n.requiredHeaders}:{},...n.allowUsers.length>0?{allowUsers:n.allowUsers}:{},...n.allowLoopback?{allowLoopback:!0}:{}}}else t.token=null,t.password=null,t.trustedProxy=null;return t}async function H(e){let t=z(e);if(t)throw Error(t);await i(r(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{bind:e.bind,...e.bind===`custom`?{customBindHost:e.customBindHost.trim()}:{},port:e.port,auth:V(e),corsOrigins:e.corsOrigins,trustedProxies:e.trustedProxies,allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback,security:{strict:e.securityStrict},channelConnectDeferMode:e.channelConnectDeferMode,channelConnectDeferIds:e.channelConnectDeferIds,channelConnectDeferSkipIds:e.channelConnectDeferSkipIds},update:{channel:e.updateChannel,checkOnStart:e.updateCheckOnStart,auto:{enabled:e.updateAutoEnabled,stableDelayHours:e.updateAutoStableDelayHours,stableJitterHours:e.updateAutoStableJitterHours,betaCheckIntervalHours:e.updateAutoBetaCheckIntervalHours}}})}),o()}export{E as a,v as c,p as d,D as i,m as l,B as n,z as o,H as r,b as s,j as t,h as u};