@meetquinn/animactl 0.1.2 → 0.1.3
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.
- package/README.md +11 -6
- package/dist/server/{runtime/activity-payload.d.ts → activities/format.d.ts} +4 -1
- package/dist/server/activities/format.d.ts.map +1 -0
- package/dist/server/{runtime/activity-payload.js → activities/format.js} +16 -1
- package/dist/server/agents/agent-skills.d.ts +7 -3
- package/dist/server/agents/agent-skills.d.ts.map +1 -1
- package/dist/server/agents/agent-skills.js +243 -38
- package/dist/server/agents/agent-slack.service.d.ts +15 -0
- package/dist/server/agents/agent-slack.service.d.ts.map +1 -1
- package/dist/server/agents/agent-slack.service.js +43 -6
- package/dist/server/agents/default-skills.d.ts +9 -0
- package/dist/server/agents/default-skills.d.ts.map +1 -0
- package/dist/server/agents/default-skills.js +52 -0
- package/dist/server/cli/runtime-cli.d.ts +7 -1
- package/dist/server/cli/runtime-cli.d.ts.map +1 -1
- package/dist/server/cli/runtime-cli.js +107 -3
- package/dist/server/cli/services-cli.d.ts.map +1 -1
- package/dist/server/cli/services-cli.js +39 -0
- package/dist/server/inbox/slack-subscriber.d.ts +2 -0
- package/dist/server/inbox/slack-subscriber.d.ts.map +1 -1
- package/dist/server/inbox/slack-subscriber.js +28 -2
- package/dist/server/inbox/slack-subscription.service.d.ts.map +1 -1
- package/dist/server/inbox/slack-subscription.service.js +13 -1
- package/dist/server/inbox/wake-queue.service.d.ts +3 -1
- package/dist/server/inbox/wake-queue.service.d.ts.map +1 -1
- package/dist/server/inbox/wake-queue.service.js +5 -3
- package/dist/server/provider-usage/http.d.ts +1 -0
- package/dist/server/provider-usage/http.d.ts.map +1 -1
- package/dist/server/provider-usage/http.js +23 -1
- package/dist/server/provider-usage/provider-usage.service.d.ts +1 -4
- package/dist/server/provider-usage/provider-usage.service.d.ts.map +1 -1
- package/dist/server/provider-usage/provider-usage.service.js +1 -18
- package/dist/server/provider-usage/providers/claude.d.ts +1 -1
- package/dist/server/provider-usage/providers/claude.d.ts.map +1 -1
- package/dist/server/provider-usage/providers/claude.js +1 -1
- package/dist/server/provider-usage/providers/codex.d.ts +1 -1
- package/dist/server/provider-usage/providers/codex.d.ts.map +1 -1
- package/dist/server/provider-usage/providers/codex.js +1 -1
- package/dist/server/provider-usage/providers/kimi.d.ts +1 -1
- package/dist/server/provider-usage/providers/kimi.d.ts.map +1 -1
- package/dist/server/provider-usage/providers/kimi.js +4 -4
- package/dist/server/provider-usage/result.d.ts +5 -0
- package/dist/server/provider-usage/result.d.ts.map +1 -0
- package/dist/server/provider-usage/result.js +18 -0
- package/dist/server/providers/active-runtime.d.ts +1 -1
- package/dist/server/providers/active-runtime.d.ts.map +1 -1
- package/dist/server/providers/claude-events.d.ts +1 -1
- package/dist/server/providers/claude-events.d.ts.map +1 -1
- package/dist/server/providers/claude-events.js +2 -2
- package/dist/server/providers/claude.d.ts +1 -1
- package/dist/server/providers/claude.d.ts.map +1 -1
- package/dist/server/providers/claude.js +2 -2
- package/dist/server/providers/codex-app-server.d.ts +1 -1
- package/dist/server/providers/codex-app-server.d.ts.map +1 -1
- package/dist/server/providers/codex-app-server.js +1 -1
- package/dist/server/providers/codex-events.js +1 -1
- package/dist/server/providers/codex.d.ts +1 -1
- package/dist/server/providers/codex.d.ts.map +1 -1
- package/dist/server/providers/codex.js +2 -2
- package/dist/server/{runtime/provider-contract.d.ts → providers/contract.d.ts} +1 -1
- package/dist/server/providers/contract.d.ts.map +1 -0
- package/dist/server/providers/factory.d.ts +1 -1
- package/dist/server/providers/factory.d.ts.map +1 -1
- package/dist/server/providers/kimi-events.d.ts +1 -1
- package/dist/server/providers/kimi-events.d.ts.map +1 -1
- package/dist/server/providers/kimi-events.js +1 -1
- package/dist/server/providers/kimi.d.ts +1 -1
- package/dist/server/providers/kimi.d.ts.map +1 -1
- package/dist/server/providers/kimi.js +3 -2
- package/dist/server/providers/reasoning-events.js +1 -1
- package/dist/server/runtime/active-run-control.d.ts +19 -0
- package/dist/server/runtime/active-run-control.d.ts.map +1 -0
- package/dist/server/runtime/active-run-control.js +89 -0
- package/dist/server/runtime/activity.js +1 -1
- package/dist/server/runtime/agent-runner.d.ts +1 -1
- package/dist/server/runtime/agent-runner.d.ts.map +1 -1
- package/dist/server/runtime/delivery-prompt.d.ts +6 -0
- package/dist/server/runtime/delivery-prompt.d.ts.map +1 -1
- package/dist/server/runtime/delivery-prompt.js +53 -34
- package/dist/server/runtime/followup-appender.d.ts +20 -0
- package/dist/server/runtime/followup-appender.d.ts.map +1 -0
- package/dist/server/runtime/followup-appender.js +128 -0
- package/dist/server/runtime/host.d.ts +2 -0
- package/dist/server/runtime/host.d.ts.map +1 -1
- package/dist/server/runtime/host.js +8 -0
- package/dist/server/runtime/provider-runner.d.ts +16 -0
- package/dist/server/runtime/provider-runner.d.ts.map +1 -0
- package/dist/server/runtime/provider-runner.js +86 -0
- package/dist/server/runtime/runtime-bridge.d.ts +1 -1
- package/dist/server/runtime/runtime-bridge.d.ts.map +1 -1
- package/dist/server/runtime/runtime-session.service.d.ts +1 -1
- package/dist/server/runtime/runtime-session.service.d.ts.map +1 -1
- package/dist/server/runtime/runtime-session.service.js +1 -1
- package/dist/server/runtime/runtime-worker.d.ts +2 -10
- package/dist/server/runtime/runtime-worker.d.ts.map +1 -1
- package/dist/server/runtime/runtime-worker.js +60 -286
- package/dist/server/runtime-management/managed-runtime.d.ts.map +1 -0
- package/dist/server/runtime-management/runtime-release.d.ts.map +1 -0
- package/dist/server/{runtime → runtime-management}/runtime-upgrade.d.ts +1 -0
- package/dist/server/runtime-management/runtime-upgrade.d.ts.map +1 -0
- package/dist/server/{runtime → runtime-management}/runtime-upgrade.js +14 -0
- package/dist/server/services/system.service.d.ts +41 -0
- package/dist/server/services/system.service.d.ts.map +1 -0
- package/dist/server/services/system.service.js +154 -0
- package/dist/server/settings/settings.service.d.ts +2 -1
- package/dist/server/settings/settings.service.d.ts.map +1 -1
- package/dist/server/settings/settings.service.js +9 -1
- package/dist/server/slack/shortcuts.d.ts +0 -3
- package/dist/server/slack/shortcuts.d.ts.map +1 -1
- package/dist/server/slack/shortcuts.js +0 -3
- package/dist/server/slack-interactions/shortcut-ids.d.ts +4 -0
- package/dist/server/slack-interactions/shortcut-ids.d.ts.map +1 -0
- package/dist/server/slack-interactions/shortcut-ids.js +3 -0
- package/dist/server/slack-interactions/shortcut-views.d.ts +65 -0
- package/dist/server/slack-interactions/shortcut-views.d.ts.map +1 -0
- package/dist/server/slack-interactions/shortcut-views.js +211 -0
- package/dist/server/{slack → slack-interactions}/shortcut.service.d.ts +2 -47
- package/dist/server/slack-interactions/shortcut.service.d.ts.map +1 -0
- package/dist/server/slack-interactions/shortcut.service.js +227 -0
- package/dist/server/storage/jsonl-log.d.ts +9 -0
- package/dist/server/storage/jsonl-log.d.ts.map +1 -1
- package/dist/server/storage/jsonl-log.js +36 -1
- package/dist/server/storage/schema/server.store.d.ts +5 -0
- package/dist/server/storage/schema/server.store.d.ts.map +1 -1
- package/dist/server/storage/schema/server.store.js +2 -1
- package/dist/server/storage/schema/wake-queue.store.d.ts +15 -1
- package/dist/server/storage/schema/wake-queue.store.d.ts.map +1 -1
- package/dist/server/storage/schema/wake-queue.store.js +5 -3
- package/dist/server/tests/agent-config.test.d.ts +2 -0
- package/dist/server/tests/agent-config.test.d.ts.map +1 -0
- package/dist/server/tests/agent-config.test.js +229 -0
- package/dist/server/tests/agent-runtime.test.d.ts +2 -0
- package/dist/server/tests/agent-runtime.test.d.ts.map +1 -0
- package/dist/server/tests/agent-runtime.test.js +1110 -0
- package/dist/server/tests/agent-seed-memory.test.d.ts +2 -0
- package/dist/server/tests/agent-seed-memory.test.d.ts.map +1 -0
- package/dist/server/tests/agent-seed-memory.test.js +16 -0
- package/dist/server/tests/agent-skills.test.d.ts +2 -0
- package/dist/server/tests/agent-skills.test.d.ts.map +1 -0
- package/dist/server/tests/agent-skills.test.js +140 -0
- package/dist/server/tests/anima-home.d.ts +2 -0
- package/dist/server/tests/anima-home.d.ts.map +1 -0
- package/dist/server/tests/anima-home.js +4 -0
- package/dist/server/tests/cli-file.test.d.ts +2 -0
- package/dist/server/tests/cli-file.test.d.ts.map +1 -0
- package/dist/server/tests/cli-file.test.js +596 -0
- package/dist/server/tests/cli-message.test.d.ts +2 -0
- package/dist/server/tests/cli-message.test.d.ts.map +1 -0
- package/dist/server/tests/cli-message.test.js +1196 -0
- package/dist/server/tests/client-error-routes.test.d.ts +2 -0
- package/dist/server/tests/client-error-routes.test.d.ts.map +1 -0
- package/dist/server/tests/client-error-routes.test.js +163 -0
- package/dist/server/tests/config.test.d.ts +2 -0
- package/dist/server/tests/config.test.d.ts.map +1 -0
- package/dist/server/tests/config.test.js +497 -0
- package/dist/server/tests/default-skills.test.d.ts +2 -0
- package/dist/server/tests/default-skills.test.d.ts.map +1 -0
- package/dist/server/tests/default-skills.test.js +57 -0
- package/dist/server/tests/helpers/inbox.d.ts +10 -0
- package/dist/server/tests/helpers/inbox.d.ts.map +1 -0
- package/dist/server/tests/helpers/inbox.js +21 -0
- package/dist/server/tests/helpers/slack.d.ts +11 -0
- package/dist/server/tests/helpers/slack.d.ts.map +1 -0
- package/dist/server/tests/helpers/slack.js +17 -0
- package/dist/server/tests/helpers/state.d.ts +19 -0
- package/dist/server/tests/helpers/state.d.ts.map +1 -0
- package/dist/server/tests/helpers/state.js +69 -0
- package/dist/server/tests/inbox-slack-events.test.d.ts +2 -0
- package/dist/server/tests/inbox-slack-events.test.d.ts.map +1 -0
- package/dist/server/tests/inbox-slack-events.test.js +271 -0
- package/dist/server/tests/inbox.test.d.ts +2 -0
- package/dist/server/tests/inbox.test.d.ts.map +1 -0
- package/dist/server/tests/inbox.test.js +144 -0
- package/dist/server/tests/interactive-ask.test.d.ts +2 -0
- package/dist/server/tests/interactive-ask.test.d.ts.map +1 -0
- package/dist/server/tests/interactive-ask.test.js +387 -0
- package/dist/server/tests/kb.test.d.ts +2 -0
- package/dist/server/tests/kb.test.d.ts.map +1 -0
- package/dist/server/tests/kb.test.js +371 -0
- package/dist/server/tests/message.service.test.d.ts +2 -0
- package/dist/server/tests/message.service.test.d.ts.map +1 -0
- package/dist/server/tests/message.service.test.js +151 -0
- package/dist/server/tests/messages.test.d.ts +2 -0
- package/dist/server/tests/messages.test.d.ts.map +1 -0
- package/dist/server/tests/messages.test.js +12 -0
- package/dist/server/tests/prompt-attachments.test.d.ts +2 -0
- package/dist/server/tests/prompt-attachments.test.d.ts.map +1 -0
- package/dist/server/tests/prompt-attachments.test.js +274 -0
- package/dist/server/tests/provider-usage.test.d.ts +2 -0
- package/dist/server/tests/provider-usage.test.d.ts.map +1 -0
- package/dist/server/tests/provider-usage.test.js +97 -0
- package/dist/server/tests/reminders.test.d.ts +2 -0
- package/dist/server/tests/reminders.test.d.ts.map +1 -0
- package/dist/server/tests/reminders.test.js +383 -0
- package/dist/server/tests/runtime-cli.test.d.ts +2 -0
- package/dist/server/tests/runtime-cli.test.d.ts.map +1 -0
- package/dist/server/tests/runtime-cli.test.js +21 -0
- package/dist/server/tests/runtime-upgrade.test.d.ts +2 -0
- package/dist/server/tests/runtime-upgrade.test.d.ts.map +1 -0
- package/dist/server/tests/runtime-upgrade.test.js +307 -0
- package/dist/server/tests/runtime-worker.test.d.ts +2 -0
- package/dist/server/tests/runtime-worker.test.d.ts.map +1 -0
- package/dist/server/tests/runtime-worker.test.js +1021 -0
- package/dist/server/tests/runtime.test.d.ts +2 -0
- package/dist/server/tests/runtime.test.d.ts.map +1 -0
- package/dist/server/tests/runtime.test.js +354 -0
- package/dist/server/tests/services.test.d.ts +2 -0
- package/dist/server/tests/services.test.d.ts.map +1 -0
- package/dist/server/tests/services.test.js +636 -0
- package/dist/server/tests/slack-files.test.d.ts +2 -0
- package/dist/server/tests/slack-files.test.d.ts.map +1 -0
- package/dist/server/tests/slack-files.test.js +118 -0
- package/dist/server/tests/slack-shortcuts.test.d.ts +2 -0
- package/dist/server/tests/slack-shortcuts.test.d.ts.map +1 -0
- package/dist/server/tests/slack-shortcuts.test.js +310 -0
- package/dist/server/tests/slack.test.d.ts +2 -0
- package/dist/server/tests/slack.test.d.ts.map +1 -0
- package/dist/server/tests/slack.test.js +213 -0
- package/dist/server/tests/state-cache.test.d.ts +2 -0
- package/dist/server/tests/state-cache.test.d.ts.map +1 -0
- package/dist/server/tests/state-cache.test.js +184 -0
- package/dist/server/tests/subscriptions.test.d.ts +2 -0
- package/dist/server/tests/subscriptions.test.d.ts.map +1 -0
- package/dist/server/tests/subscriptions.test.js +292 -0
- package/dist/server/tests/system-service.test.d.ts +2 -0
- package/dist/server/tests/system-service.test.d.ts.map +1 -0
- package/dist/server/tests/system-service.test.js +20 -0
- package/dist/server/tests/url-routes.test.d.ts +2 -0
- package/dist/server/tests/url-routes.test.d.ts.map +1 -0
- package/dist/server/tests/url-routes.test.js +217 -0
- package/dist/server/tests/web-api.test.d.ts +2 -0
- package/dist/server/tests/web-api.test.d.ts.map +1 -0
- package/dist/server/tests/web-api.test.js +1759 -0
- package/dist/server/web/app.d.ts.map +1 -1
- package/dist/server/web/app.js +2 -0
- package/dist/server/web/client-error-routes.d.ts +3 -0
- package/dist/server/web/client-error-routes.d.ts.map +1 -0
- package/dist/server/web/client-error-routes.js +101 -0
- package/dist/server/web/system-routes.d.ts.map +1 -1
- package/dist/server/web/system-routes.js +21 -131
- package/dist/shared/agent-config.d.ts +8 -18
- package/dist/shared/agent-config.d.ts.map +1 -1
- package/dist/shared/agent-config.js +3 -4
- package/dist/shared/inbox.d.ts +27 -0
- package/dist/shared/inbox.d.ts.map +1 -1
- package/dist/shared/inbox.js +1 -0
- package/dist/shared/server-info.d.ts +6 -5
- package/dist/shared/server-info.d.ts.map +1 -1
- package/dist/shared/server-info.js +3 -1
- package/dist/shared/server-settings.d.ts +6 -0
- package/dist/shared/server-settings.d.ts.map +1 -1
- package/dist/shared/server-settings.js +1 -0
- package/dist/shared/skills.d.ts +24 -3
- package/dist/shared/skills.d.ts.map +1 -1
- package/dist/web/assets/activity-DHjip8tY.js +7 -0
- package/dist/web/assets/clipboard-D2NSC52v.js +1 -0
- package/dist/web/assets/{external-link-Dt0qTpmV.js → external-link-Bhr1WdRS.js} +1 -1
- package/dist/web/assets/{file-text-Dd9ys6py.js → file-text-CYMA_SMA.js} +1 -1
- package/dist/web/assets/{index-CzAQnbuO.js → index-CVpew409.js} +5 -5
- package/dist/web/assets/index-mh0uJTkY.css +2 -0
- package/dist/web/assets/kb-DDVpYkT9.js +35 -0
- package/dist/web/assets/profile-CBy6GNzp.js +1 -0
- package/dist/web/assets/reminders-Bbwb9QNT.js +1 -0
- package/dist/web/favicon.svg +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/templates/runtime-standing-prompt.md +16 -2
- package/templates/skills/find-skills/SKILL.md +133 -0
- package/dist/server/runtime/activity-payload.d.ts.map +0 -1
- package/dist/server/runtime/activity-text.d.ts +0 -4
- package/dist/server/runtime/activity-text.d.ts.map +0 -1
- package/dist/server/runtime/activity-text.js +0 -16
- package/dist/server/runtime/managed-runtime.d.ts.map +0 -1
- package/dist/server/runtime/provider-contract.d.ts.map +0 -1
- package/dist/server/runtime/runtime-release.d.ts.map +0 -1
- package/dist/server/runtime/runtime-upgrade.d.ts.map +0 -1
- package/dist/server/slack/shortcut.service.d.ts.map +0 -1
- package/dist/server/slack/shortcut.service.js +0 -493
- package/dist/web/assets/activity-BP0C81IV.js +0 -7
- package/dist/web/assets/globe-DmDZSgDP.js +0 -1
- package/dist/web/assets/index-DKecrvN0.css +0 -2
- package/dist/web/assets/kb-3wFeP2Jt.js +0 -32
- package/dist/web/assets/profile-D7wPZXW_.js +0 -1
- package/dist/web/assets/reminders-DOhroVwo.js +0 -1
- /package/dist/server/{runtime/provider-contract.js → providers/contract.js} +0 -0
- /package/dist/server/{runtime → runtime-management}/managed-runtime.d.ts +0 -0
- /package/dist/server/{runtime → runtime-management}/managed-runtime.js +0 -0
- /package/dist/server/{runtime → runtime-management}/runtime-release.d.ts +0 -0
- /package/dist/server/{runtime → runtime-management}/runtime-release.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/activity-DHjip8tY.js","assets/external-link-Bhr1WdRS.js","assets/file-text-CYMA_SMA.js","assets/profile-CBy6GNzp.js","assets/clipboard-D2NSC52v.js","assets/kb-DDVpYkT9.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.6`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var s=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=s.T,n=i.p;try{if(s.T=null,i.p=2,e)return e()}finally{s.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=c(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=c(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=c(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return s.H.useFormState(e,t,n)},e.useFormStatus=function(){return s.H.useHostTransitionStatus()},e.version=`19.2.6`})),h=o(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=p(),n=d(),r=h();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),w=Symbol.for(`react.forward_ref`),T=Symbol.for(`react.suspense`),E=Symbol.for(`react.suspense_list`),D=Symbol.for(`react.memo`),O=Symbol.for(`react.lazy`),k=Symbol.for(`react.activity`),A=Symbol.for(`react.memo_cache_sentinel`),j=Symbol.iterator;function M(e){return typeof e!=`object`||!e?null:(e=j&&e[j]||e[`@@iterator`],typeof e==`function`?e:null)}var N=Symbol.for(`react.client.reference`);function P(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===N?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case T:return`Suspense`;case E:return`SuspenseList`;case k:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case w:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case D:return t=e.displayName||null,t===null?P(e.type)||`Memo`:t;case O:t=e._payload,e=e._init;try{return P(e(t))}catch{}}return null}var F=Array.isArray,I=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R={pending:!1,data:null,method:null,action:null},z=[],B=-1;function V(e){return{current:e}}function H(e){0>B||(e.current=z[B],z[B]=null,B--)}function U(e,t){B++,z[B]=e.current,e.current=t}var W=V(null),G=V(null),ee=V(null),te=V(null);function ne(e,t){switch(U(ee,t),U(G,e),U(W,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jd(t),e=Yd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}H(W),U(W,e)}function re(){H(W),H(G),H(ee)}function ie(e){e.memoizedState!==null&&U(te,e);var t=W.current,n=Yd(t,e.type);t!==n&&(U(G,e),U(W,n))}function ae(e){G.current===e&&(H(W),H(G)),te.current===e&&(H(te),ap._currentValue=R)}var oe,se;function ce(e){if(oe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);oe=t&&t[1]||``,se=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+oe+e+se}var le=!1;function ue(e,t){if(!e||le)return``;le=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -14,9 +14,9 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
14
14
|
To pick up a draggable item, press the space bar.
|
|
15
15
|
While dragging, use the arrow keys to move the item.
|
|
16
16
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
17
|
-
`},zc={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Bc(e){let{announcements:t=zc,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Rc}=e,{announce:a,announcement:o}=Pc(),s=bc(`DndLiveRegion`),[c,l]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{l(!0)},[]),Ic((0,v.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=v.createElement(v.Fragment,null,v.createElement(Mc,{id:r,value:i.draggable}),v.createElement(Nc,{id:s,announcement:o}));return n?(0,y.createPortal)(u,n):u}var Vc;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(Vc||={});function Hc(){}function Uc(e,t){return(0,v.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Wc(){var e=[...arguments];return(0,v.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Gc=Object.freeze({x:0,y:0});function Kc(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function qc(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Jc(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Yc(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Xc(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Zc=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Xc(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Kc(Xc(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(qc)};function Qc(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var $c=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Qc(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Jc)};function el(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function tl(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Gc}function nl(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var rl=nl(1);function il(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function al(e,t,n){let r=il(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var ol={ignoreTransform:!1};function sl(e,t){t===void 0&&(t=ol);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=sc(e).getComputedStyle(e);t&&(n=al(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function cl(e){return sl(e,{ignoreTransform:!0})}function ll(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ul(e,t){return t===void 0&&(t=sc(e).getComputedStyle(e)),t.position===`fixed`}function dl(e,t){t===void 0&&(t=sc(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function fl(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(cc(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!lc(i)||uc(i)||n.includes(i))return n;let a=sc(e).getComputedStyle(i);return i!==e&&dl(i,a)&&n.push(i),ul(i,a)?n:r(i.parentNode)}return e?r(e):n}function pl(e){let[t]=fl(e,1);return t??null}function ml(e){return!ic||!e?null:ac(e)?e:oc(e)?cc(e)||e===dc(e).scrollingElement?window:lc(e)?e:null:null}function hl(e){return ac(e)?e.scrollX:e.scrollLeft}function gl(e){return ac(e)?e.scrollY:e.scrollTop}function _l(e){return{x:hl(e),y:gl(e)}}var vl;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(vl||={});function yl(e){return!ic||!e?!1:e===document.scrollingElement}function bl(e){let t={x:0,y:0},n=yl(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var xl={x:.2,y:.2};function Sl(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=xl);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=bl(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=vl.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=vl.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=vl.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=vl.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Cl(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function wl(e){return e.reduce((e,t)=>Sc(e,_l(t)),Gc)}function Tl(e){return e.reduce((e,t)=>e+hl(t),0)}function El(e){return e.reduce((e,t)=>e+gl(t),0)}function Dl(e,t){if(t===void 0&&(t=sl),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);pl(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ol=[[`x`,[`left`,`right`],Tl],[`y`,[`top`,`bottom`],El]],kl=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=fl(t),r=wl(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ol)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Al=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function jl(e){let{EventTarget:t}=sc(e);return e instanceof t?e:dc(e)}function Ml(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Nl;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Nl||={});function Pl(e){e.preventDefault()}function Fl(e){e.stopPropagation()}var Il;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Il||={});var Ll={start:[Il.Space,Il.Enter],cancel:[Il.Esc],end:[Il.Space,Il.Enter,Il.Tab]},Rl=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Il.Right:return{...n,x:n.x+25};case Il.Left:return{...n,x:n.x-25};case Il.Down:return{...n,y:n.y+25};case Il.Up:return{...n,y:n.y-25}}},zl=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Al(dc(t)),this.windowListeners=new Al(sc(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Nl.Resize,this.handleCancel),this.windowListeners.add(Nl.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Nl.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Dl(n),t(Gc)}handleKeyDown(e){if(Tc(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Ll,coordinateGetter:a=Rl,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Gc;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Cc(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=bl(n),p=Cl(n),m={x:Math.min(i===Il.Right?p.right-p.width/2:p.right,Math.max(i===Il.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Il.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Il.Down?p.top:p.top+p.height/2,u.y))},h=i===Il.Right&&!s||i===Il.Left&&!c,g=i===Il.Down&&!l||i===Il.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Il.Right&&e<=d.x||i===Il.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Il.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Il.Down&&e<=d.y||i===Il.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Il.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Sc(Cc(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};zl.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Ll,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Bl(e){return!!(e&&`distance`in e)}function Vl(e){return!!(e&&`delay`in e)}var Hl=class{constructor(e,t,n){n===void 0&&(n=jl(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=dc(i),this.documentListeners=new Al(this.document),this.listeners=new Al(n),this.windowListeners=new Al(sc(i)),this.initialCoordinates=Dc(r)??Gc,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Nl.Resize,this.handleCancel),this.windowListeners.add(Nl.DragStart,Pl),this.windowListeners.add(Nl.VisibilityChange,this.handleCancel),this.windowListeners.add(Nl.ContextMenu,Pl),this.documentListeners.add(Nl.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Vl(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Bl(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Nl.Click,Fl,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Nl.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Dc(e)??Gc,s=Cc(n,o);if(!t&&a){if(Bl(a)){if(a.tolerance!=null&&Ml(s,a.tolerance))return this.handleCancel();if(Ml(s,a.distance))return this.handleStart()}if(Vl(a)&&Ml(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Il.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Ul={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Wl=class extends Hl{constructor(e){let{event:t}=e,n=dc(t.target);super(e,Ul,n)}};Wl.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Gl={move:{name:`mousemove`},end:{name:`mouseup`}},Kl;(function(e){e[e.RightClick=2]=`RightClick`})(Kl||={});var ql=class extends Hl{constructor(e){super(e,Gl,dc(e.event.target))}};ql.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Kl.RightClick?!1:(r?.({event:n}),!0)}}];var Jl={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Yl=class extends Hl{constructor(e){super(e,Jl)}static setup(){return window.addEventListener(Jl.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Jl.move.name,e)};function e(){}}};Yl.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Xl;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Xl||={});var Zl;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Zl||={});function Ql(e){let{acceleration:t,activator:n=Xl.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Zl.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=eu({delta:d,disabled:!a}),[m,h]=mc(),g=(0,v.useRef)({x:0,y:0}),_=(0,v.useRef)({x:0,y:0}),y=(0,v.useMemo)(()=>{switch(n){case Xl.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Xl.DraggableRect:return i}},[n,i,c]),b=(0,v.useRef)(null),x=(0,v.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,v.useMemo)(()=>s===Zl.TreeOrder?[...l].reverse():l,[s,l]);(0,v.useEffect)(()=>{if(!a||!l.length||!y){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Sl(e,n,y,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var $l={x:{[vl.Backward]:!1,[vl.Forward]:!1},y:{[vl.Backward]:!1,[vl.Forward]:!1}};function eu(e){let{delta:t,disabled:n}=e,r=vc(t);return gc(e=>{if(n||!r||!e)return $l;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[vl.Backward]:e.x[vl.Backward]||i.x===-1,[vl.Forward]:e.x[vl.Forward]||i.x===1},y:{[vl.Backward]:e.y[vl.Backward]||i.y===-1,[vl.Forward]:e.y[vl.Forward]||i.y===1}}},[n,t,r])}function tu(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return gc(e=>t==null?null:r??e??null,[r,t])}function nu(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var ru;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(ru||={});var iu;(function(e){e.Optimized=`optimized`})(iu||={});var au=new Map;function ou(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,v.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,v.useRef)(e),d=g(),f=hc(d),p=(0,v.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,v.useRef)(null),h=gc(t=>{if(d&&!n)return au;if(!t||t===au||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new kl(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,v.useEffect)(()=>{u.current=e},[e]),(0,v.useEffect)(()=>{d||p()},[n,d]),(0,v.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,v.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case ru.Always:return!1;case ru.BeforeDragging:return n;default:return!n}}}function su(e,t){return gc(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function cu(e,t){return su(e,t)}function lu(e){let{callback:t,disabled:n}=e,r=pc(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function uu(e){let{callback:t,disabled:n}=e,r=pc(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function du(e){return new kl(sl(e),e)}function fu(e,t,n){t===void 0&&(t=du);let[r,i]=(0,v.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=lu({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=uu({callback:a});return fc(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function pu(e){return tl(e,su(e))}var mu=[];function hu(e){let t=(0,v.useRef)(e),n=gc(n=>e?n&&n!==mu&&e&&t.current&&e.parentNode===t.current.parentNode?n:fl(e):mu,[e]);return(0,v.useEffect)(()=>{t.current=e},[e]),n}function gu(e){let[t,n]=(0,v.useState)(null),r=(0,v.useRef)(e),i=(0,v.useCallback)(e=>{let t=ml(e.target);t&&n(e=>e?(e.set(t,_l(t)),new Map(e)):null)},[]);return(0,v.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ml(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,_l(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{ml(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,v.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Sc(e,t),Gc):wl(e):Gc,[e,t])}function _u(e,t){t===void 0&&(t=[]);let n=(0,v.useRef)(null);return(0,v.useEffect)(()=>{n.current=null},t),(0,v.useEffect)(()=>{let t=e!==Gc;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Cc(e,n.current):Gc}function vu(e){(0,v.useEffect)(()=>{if(!ic)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function yu(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function bu(e){return(0,v.useMemo)(()=>e?ll(e):null,[e])}var xu=[];function Su(e,t){t===void 0&&(t=sl);let[n]=e,r=bu(n?sc(n):null),[i,a]=(0,v.useState)(xu);function o(){a(()=>e.length?e.map(e=>yl(e)?r:new kl(t(e),e)):xu)}let s=uu({callback:o});return fc(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Cu(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return lc(t)?t:e}function wu(e){let{measure:t}=e,[n,r]=(0,v.useState)(null),i=uu({callback:(0,v.useCallback)(e=>{for(let{target:n}of e)if(lc(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=_c((0,v.useCallback)(e=>{let n=Cu(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,v.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Tu=[{sensor:Wl,options:{}},{sensor:zl,options:{}}],Eu={current:{}},Du={draggable:{measure:cl},droppable:{measure:cl,strategy:ru.WhileDragging,frequency:iu.Optimized},dragOverlay:{measure:sl}},Ou=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},ku={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ou,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Hc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Du,measureDroppableContainers:Hc,windowRect:null,measuringScheduled:!1},Au={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Hc,draggableNodes:new Map,over:null,measureDroppableContainers:Hc},ju=(0,v.createContext)(Au),Mu=(0,v.createContext)(ku);function Nu(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ou}}}function Pu(e,t){switch(t.type){case Vc.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vc.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Vc.DragEnd:case Vc.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vc.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Ou(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Vc.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Ou(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Vc.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Ou(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Fu(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,v.useContext)(ju),a=vc(r),o=vc(n?.id);return(0,v.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Tc(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Ac(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Iu(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Lu(e){return(0,v.useMemo)(()=>({draggable:{...Du.draggable,...e?.draggable},droppable:{...Du.droppable,...e?.droppable},dragOverlay:{...Du.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ru(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,v.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;fc(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=tl(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=pl(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var zu=(0,v.createContext)({...Gc,scaleX:1,scaleY:1}),Bu;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Bu||={});var Vu=(0,v.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Tu,collisionDetection:o=$c,measuring:s,modifiers:c,...l}=e,[u,d]=(0,v.useReducer)(Pu,void 0,Nu),[f,p]=Lc(),[m,h]=(0,v.useState)(Bu.Uninitialized),g=m===Bu.Initialized,{draggable:{active:_,nodes:b,translate:x},droppable:{containers:S}}=u,C=_==null?null:b.get(_),w=(0,v.useRef)({initial:null,translated:null}),T=(0,v.useMemo)(()=>_==null?null:{id:_,data:C?.data??Eu,rect:w},[_,C]),E=(0,v.useRef)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),j=hc(l,Object.values(l)),M=bc(`DndDescribedBy`,t),N=(0,v.useMemo)(()=>S.getEnabled(),[S]),P=Lu(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=ou(N,{dragging:g,dependencies:[x.x,x.y],config:P.droppable}),R=tu(b,_),z=(0,v.useMemo)(()=>k?Dc(k):null,[k]),B=Te(),V=cu(R,P.draggable.measure);Ru({activeNode:_==null?null:b.get(_),config:B.layoutShiftCompensation,initialRect:V,measure:P.draggable.measure});let H=fu(R,P.draggable.measure,V),U=fu(R?R.parentElement:null),W=(0,v.useRef)({activatorEvent:null,active:null,activeNode:R,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),G=S.getNodeFor(W.current.over?.id),ee=wu({measure:P.dragOverlay.measure}),te=ee.nodeRef.current??R,ne=g?ee.rect??H:null,re=!!(ee.nodeRef.current&&ee.rect),ie=pu(re?null:H),ae=bu(te?sc(te):null),oe=hu(g?G??R:null),se=Su(oe),ce=Iu(c,{transform:{x:x.x-ie.x,y:x.y-ie.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:H,containerNodeRect:U,draggingNodeRect:ne,over:W.current.over,overlayNodeRect:ee.rect,scrollableAncestors:oe,scrollableAncestorRects:se,windowRect:ae}),le=z?Sc(z,x):null,ue=gu(oe),de=_u(ue),fe=_u(ue,[H]),pe=Sc(ce,de),me=ne?rl(ne,ce):null,he=T&&me?o({active:T,collisionRect:me,droppableRects:F,droppableContainers:N,pointerCoordinates:le}):null,ge=Yc(he,`id`),[_e,ve]=(0,v.useState)(null),ye=el(re?ce:Sc(ce,fe),_e?.rect??null,H),be=(0,v.useRef)(null),xe=(0,v.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(E.current==null)return;let i=b.get(E.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:E.current,activeNode:i,event:a,options:r,context:W,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let n=b.get(t);if(!n)return;let{onDragStart:r}=j.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,y.unstable_batchedUpdates)(()=>{r?.(i),h(Bu.Initializing),d({type:Vc.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),O(be.current),A(a)})},onMove(e){d({type:Vc.DragMove,coordinates:e})},onEnd:o(Vc.DragEnd),onCancel:o(Vc.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=W.current,o=null;if(t&&i){let{cancelDrop:s}=j.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Vc.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Vc.DragCancel)}E.current=null,(0,y.unstable_batchedUpdates)(()=>{d({type:e}),h(Bu.Uninitialized),ve(null),O(null),A(null),be.current=null;let t=e===Vc.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=j.current[t];e?.(o),f({type:t,event:o})}})}}},[b]),Se=nu(a,(0,v.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,xe(n,t))},[b,xe]));vu(a),fc(()=>{H&&m===Bu.Initializing&&h(Bu.Initialized)},[H,m]),(0,v.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:n,collisions:r,over:i}=W.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:pe.x,y:pe.y},over:i};(0,y.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[pe.x,pe.y]),(0,v.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=W.current;if(!e||E.current==null||!t||!i)return;let{onDragOver:a}=j.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,y.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),fc(()=>{W.current={activatorEvent:k,active:T,activeNode:R,collisionRect:me,collisions:he,droppableRects:F,draggableNodes:b,draggingNode:te,draggingNodeRect:ne,droppableContainers:S,over:_e,scrollableAncestors:oe,scrollAdjustedTranslate:pe},w.current={initial:ne,translated:me}},[T,R,he,me,b,te,ne,F,S,_e,oe,pe]),Ql({...B,delta:x,draggingRect:me,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:se});let Ce=(0,v.useMemo)(()=>({active:T,activeNode:R,activeNodeRect:H,activatorEvent:k,collisions:he,containerNodeRect:U,dragOverlay:ee,draggableNodes:b,droppableContainers:S,droppableRects:F,over:_e,measureDroppableContainers:I,scrollableAncestors:oe,scrollableAncestorRects:se,measuringConfiguration:P,measuringScheduled:L,windowRect:ae}),[T,R,H,k,he,U,ee,b,S,F,_e,I,oe,se,P,L,ae]),we=(0,v.useMemo)(()=>({activatorEvent:k,activators:Se,active:T,activeNodeRect:H,ariaDescribedById:{draggable:M},dispatch:d,draggableNodes:b,over:_e,measureDroppableContainers:I}),[k,Se,T,H,d,M,b,_e,I]);return v.createElement(Fc.Provider,{value:p},v.createElement(ju.Provider,{value:we},v.createElement(Mu.Provider,{value:Ce},v.createElement(zu.Provider,{value:ye},i)),v.createElement(Fu,{disabled:n?.restoreFocus===!1})),v.createElement(Bc,{...n,hiddenTextDescribedById:M}));function Te(){let e=D?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Hu=(0,v.createContext)(null),Uu=`button`,Wu=`Draggable`;function Gu(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=bc(Wu),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,v.useContext)(ju),{role:p=Uu,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,v.useContext)(g?zu:Hu),[y,b]=_c(),[x,S]=_c(),C=yu(o,t),w=hc(n);return fc(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,v.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Uu?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:_}}function Ku(){return(0,v.useContext)(Mu)}var qu=`Droppable`,Ju={timeout:25};function Yu(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=bc(qu),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,v.useContext)(ju),u=(0,v.useRef)({disabled:n}),d=(0,v.useRef)(!1),f=(0,v.useRef)(null),p=(0,v.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Ju,...i},_=hc(h??r),y=uu({callback:(0,v.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=_c((0,v.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=hc(t);return(0,v.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,v.useEffect)(()=>(s({type:Vc.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:Vc.UnregisterDroppable,key:a,id:r})),[r]),(0,v.useEffect)(()=>{n!==u.current.disabled&&(s({type:Vc.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function Xu(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Zu(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Qu(e){return e!==null&&e>=0}function $u(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ed(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var td=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Xu(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},nd={scaleX:1,scaleY:1},rd=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...nd}:null}let s=id(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...nd}:r<t&&r>=a?{x:0,y:o.height+s,...nd}:{x:0,y:0,...nd}};function id(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var ad=`Sortable`,od=v.createContext({activeIndex:-1,containerId:ad,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:td,disabled:{draggable:!1,droppable:!1}});function sd(e){let{children:t,id:n,items:r,strategy:i=td,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Ku(),d=bc(ad,n),f=s.rect!==null,p=(0,v.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,v.useRef)(p),y=!$u(p,_.current),b=g!==-1&&h===-1||y,x=ed(a);fc(()=>{y&&m&&u(p)},[y,p,m,u]),(0,v.useEffect)(()=>{_.current=p},[p]);let S=(0,v.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:Zu(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return v.createElement(od.Provider,{value:S},t)}var cd=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Xu(n,r,i).indexOf(t)},ld=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},ud={duration:200,easing:`ease`},dd=`transform`,fd=Oc.Transition.toString({property:dd,duration:0,easing:`linear`}),pd={roleDescription:`sortable`};function md(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,v.useState)(null),s=(0,v.useRef)(n);return fc(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=sl(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,v.useEffect)(()=>{a&&o(null)},[a]),a}function hd(e){let{animateLayoutChanges:t=ld,attributes:n,disabled:r,data:i,getNewIndex:a=cd,id:o,strategy:s,resizeObserverConfig:c,transition:l=ud}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:y}=(0,v.useContext)(od),b=gd(r,p),x=u.indexOf(o),S=(0,v.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,v.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=Yu({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=Gu({id:o,data:S,attributes:{...pd,...n},disabled:b.draggable}),R=rc(D,M),z=!!O,B=z&&!m&&Qu(f)&&Qu(g),V=!_&&P,H=B?(V&&B?L:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,U=Qu(f)&&Qu(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,W=O?.id,G=(0,v.useRef)({activeId:W,items:u,newIndex:U,containerId:d}),ee=u!==G.current.items,te=t({active:O,containerId:d,isDragging:P,isSorting:z,id:o,index:x,items:u,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:l,wasDragging:G.current.activeId!=null}),ne=md({disabled:!te,index:x,node:T,rect:w});return(0,v.useEffect)(()=>{z&&G.current.newIndex!==U&&(G.current.newIndex=U),d!==G.current.containerId&&(G.current.containerId=d),u!==G.current.items&&(G.current.items=u)},[z,U,d,u]),(0,v.useEffect)(()=>{if(W===G.current.activeId)return;if(W!=null&&G.current.activeId==null){G.current.activeId=W;return}let e=setTimeout(()=>{G.current.activeId=W},50);return()=>clearTimeout(e)},[W]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:U,items:u,isOver:E,isSorting:z,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:ne??H,transition:re()};function re(){if(ne||ee&&G.current.newIndex===x)return fd;if(!(V&&!Tc(k)||!l)&&(z||te))return Oc.Transition.toString({...l,property:dd})}}function gd(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}Il.Down,Il.Right,Il.Up,Il.Left;function _d({className:e}){return(0,K.jsx)(`svg`,{viewBox:`0 0 48 46`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:(0,K.jsx)(`path`,{d:`M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z`})})}async function vd(){return(await Io(`/api/sidebar-order`)).sidebarOrder}async function yd(e){return(await Io(`/api/sidebar-order`,Lo(`PUT`,e))).sidebarOrder}async function bd(){return(await Io(`/api/provider-availability`)).providers}async function xd(){return Io(`/api/provider-usage`)}async function Sd(){return Io(`/api/server-info`)}async function Cd(){return Io(`/api/services/restart`,Lo(`POST`))}async function wd(){try{return(await fetch(`/api/health`,{cache:`no-store`})).ok}catch{return!1}}async function Td(){return Io(`/api/system-update`)}var Ed=class extends Error{status;constructor(e,t){super(e),this.name=`RuntimeUpgradeApplyError`,this.status=t}};async function Dd(){let e=await fetch(`/api/system-update/apply`,{cache:`no-store`,...Lo(`POST`)});if(!e.ok){let t=await e.json().catch(()=>({}));throw new Ed(typeof t==`object`&&t&&`error`in t&&typeof t.error==`string`?t.error:`HTTP ${e.status}`,e.status)}return e.json()}var Od=365.2425,kd=6048e5,Ad=864e5,jd=43200,Md=1440,Nd=3600*24;Nd*7,Nd*Od/12*3;var Pd=Symbol.for(`constructDateFrom`);function Fd(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Pd in e?e[Pd](t):e instanceof Date?new e.constructor(t):new Date(t)}function Id(e,t){return Fd(t||e,e)}function Ld(e,t,n){let r=Id(e,n?.in);return isNaN(t)?Fd(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}var Rd={};function zd(){return Rd}function Bd(e,t){let n=zd(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Id(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Vd(e,t){return Bd(e,{...t,weekStartsOn:1})}function Hd(e,t){let n=Id(e,t?.in),r=n.getFullYear(),i=Fd(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Vd(i),o=Fd(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Vd(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Ud(e){let t=Id(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Wd(e,...t){let n=Fd.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Gd(e,t){let n=Id(e,t?.in);return n.setHours(0,0,0,0),n}function Kd(e,t,n){let[r,i]=Wd(n?.in,e,t),a=Gd(r),o=Gd(i),s=+a-Ud(a),c=+o-Ud(o);return Math.round((s-c)/Ad)}function qd(e,t){let n=Hd(e,t),r=Fd(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Vd(r)}function Jd(e,t){let n=Id(e)-+Id(t);return n<0?-1:n>0?1:n}function Yd(e){return Fd(e,Date.now())}function Xd(e,t,n){let[r,i]=Wd(n?.in,e,t);return+Gd(r)==+Gd(i)}function Zd(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function Qd(e){return!(!Zd(e)&&typeof e!=`number`||isNaN(+Id(e)))}function $d(e,t,n){let[r,i]=Wd(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function ef(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function tf(e,t){return Id(e)-+Id(t)}function nf(e,t){let n=Id(e,t?.in);return n.setHours(23,59,59,999),n}function rf(e,t){let n=Id(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function af(e,t){let n=Id(e,t?.in);return+nf(n,t)==+rf(n,t)}function of(e,t,n){let[r,i,a]=Wd(n?.in,e,e,t),o=Jd(i,a),s=Math.abs($d(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=Jd(i,a)===-o;af(r)&&s===1&&Jd(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function sf(e,t,n){let r=tf(e,t)/1e3;return ef(n?.roundingMethod)(r)}function cf(e,t){let n=Id(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var lf={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},uf=(e,t,n)=>{let r,i=lf[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function df(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var ff={date:df({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:df({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:df({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},pf={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},mf=(e,t,n,r)=>pf[e];function hf(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var gf={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:hf({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:hf({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:hf({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:hf({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:hf({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function _f(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?yf(s,e=>e.test(o)):vf(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function vf(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function yf(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function bf(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var xf={code:`en-US`,formatDistance:uf,formatLong:ff,formatRelative:mf,localize:gf,match:{ordinalNumber:bf({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:_f({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:_f({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:_f({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:_f({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:_f({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Sf(e,t){let n=Id(e,t?.in);return Kd(n,cf(n))+1}function Cf(e,t){let n=Id(e,t?.in),r=Vd(n)-+qd(n);return Math.round(r/kd)+1}function wf(e,t){let n=Id(e,t?.in),r=n.getFullYear(),i=zd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Fd(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Bd(o,t),c=Fd(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Bd(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Tf(e,t){let n=zd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=wf(e,t),a=Fd(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Bd(a,t)}function Ef(e,t){let n=Id(e,t?.in),r=Bd(n,t)-+Tf(n,t);return Math.round(r/kd)+1}function Df(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var Of={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Df(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Df(n+1,2)},d(e,t){return Df(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Df(e.getHours()%12||12,t.length)},H(e,t){return Df(e.getHours(),t.length)},m(e,t){return Df(e.getMinutes(),t.length)},s(e,t){return Df(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Df(Math.trunc(r*10**(n-3)),t.length)}},kf={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},Af={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return Of.y(e,t)},Y:function(e,t,n,r){let i=wf(e,r),a=i>0?i:1-i;return t===`YY`?Df(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Df(a,t.length)},R:function(e,t){return Df(Hd(e),t.length)},u:function(e,t){return Df(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Df(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Df(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return Of.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Df(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Ef(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Df(i,t.length)},I:function(e,t,n){let r=Cf(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Df(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):Of.d(e,t)},D:function(e,t,n){let r=Sf(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Df(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Df(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Df(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Df(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?kf.noon:r===0?kf.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?kf.evening:r>=12?kf.afternoon:r>=4?kf.morning:kf.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return Of.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):Of.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Df(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Df(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):Of.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):Of.s(e,t)},S:function(e,t){return Of.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Mf(r);case`XXXX`:case`XX`:return Nf(r);default:return Nf(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Mf(r);case`xxxx`:case`xx`:return Nf(r);default:return Nf(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+jf(r,`:`);default:return`GMT`+Nf(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+jf(r,`:`);default:return`GMT`+Nf(r,`:`)}},t:function(e,t,n){return Df(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Df(+e,t.length)}};function jf(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Df(a,2)}function Mf(e,t){return e%60==0?(e>0?`-`:`+`)+Df(Math.abs(e)/60,2):Nf(e,t)}function Nf(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Df(Math.trunc(r/60),2),a=Df(r%60,2);return n+i+t+a}var Pf=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},Ff=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},If={p:Ff,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Pf(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,Pf(r,t)).replace(`{{time}}`,Ff(i,t))}},Lf=/^D+$/,Rf=/^Y+$/,zf=[`D`,`DD`,`YY`,`YYYY`];function Bf(e){return Lf.test(e)}function Vf(e){return Rf.test(e)}function Hf(e,t,n){let r=Uf(e,t,n);if(console.warn(r),zf.includes(e))throw RangeError(r)}function Uf(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Wf=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Gf=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Kf=/^'([^]*?)'?$/,qf=/''/g,Jf=/[a-zA-Z]/;function Yf(e,t,n){let r=zd(),i=n?.locale??r.locale??xf,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Id(e,n?.in);if(!Qd(s))throw RangeError(`Invalid time value`);let c=t.match(Gf).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=If[t];return n(e,i.formatLong)}return e}).join(``).match(Wf).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Xf(e)};if(Af[t])return{isToken:!0,value:e};if(t.match(Jf))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&Vf(a)||!n?.useAdditionalDayOfYearTokens&&Bf(a))&&Hf(a,t,String(e));let o=Af[a[0]];return o(s,a,i.localize,l)}).join(``)}function Xf(e){let t=e.match(Kf);return t?t[1].replace(qf,`'`):e}function Zf(e,t,n){let r=zd(),i=n?.locale??r.locale??xf,a=Jd(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Wd(n?.in,...a>0?[t,e]:[e,t]),l=sf(c,s),u=(Ud(c)-Ud(s))/1e3,d=Math.round((l-u)/60),f;if(d<2)return n?.includeSeconds?l<5?i.formatDistance(`lessThanXSeconds`,5,o):l<10?i.formatDistance(`lessThanXSeconds`,10,o):l<20?i.formatDistance(`lessThanXSeconds`,20,o):l<40?i.formatDistance(`halfAMinute`,0,o):l<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):d===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,d,o);if(d<45)return i.formatDistance(`xMinutes`,d,o);if(d<90)return i.formatDistance(`aboutXHours`,1,o);if(d<1440){let e=Math.round(d/60);return i.formatDistance(`aboutXHours`,e,o)}else if(d<2520)return i.formatDistance(`xDays`,1,o);else if(d<43200){let e=Math.round(d/Md);return i.formatDistance(`xDays`,e,o)}else if(d<43200*2)return f=Math.round(d/jd),i.formatDistance(`aboutXMonths`,f,o);if(f=of(c,s),f<12){let e=Math.round(d/jd);return i.formatDistance(`xMonths`,e,o)}else{let e=f%12,t=Math.trunc(f/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function Qf(e,t){return Xd(Fd(t?.in||e,e),Yd(t?.in||e))}function $f(e,t,n){return Ld(e,-t,n)}function ep(e,t){return Xd(Fd(t?.in||e,e),$f(Yd(t?.in||e),1))}function tp(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function np(e){return e<1e3?String(e):e<999500?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}function rp(e){return Yf(new Date(e),`HH:mm`)}function ip(e){return Yf(new Date(e),`yyyy-MM-dd`)}function ap(e){let t=new Date(e);return Qf(t)?`Today`:ep(t)?`Yesterday`:Yf(t,`EEEE, MMMM d`)}function op(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=Yf(t,`HH:mm`);if(Qf(t))return n;let r=new Date;return r.setDate(r.getDate()+1),t.toDateString()===r.toDateString()?`tomorrow ${n}`:`${Yf(t,`MMM d`)} ${n}`}function sp(e,t){let n=t.getTime()-new Date(e).getTime();if(!Number.isFinite(n)||n<0)return`—`;let r=Math.floor(n/6e4);if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h ${r%60}m`:`${Math.floor(i/24)}d ${i%24}h`}function cp(e,t){let n=new Date(e);return!Number.isFinite(n.getTime())||n>t?`—`:Zf(n,t,{addSuffix:!0})}function lp(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`—`}function up(e,t){if(!e)return`—`;let n=new Date(e).getTime()-t.getTime(),r=Math.abs(n)/6e4,i=n>=0;if(r<1)return i?`soon`:`just now`;if(r<60){let e=Math.round(r);return i?`in ${e} min`:`${e} min ago`}let a=r/60;if(a<24){let e=Math.round(a);return i?`in ${e} hr`:`${e} hr ago`}let o=a/24,s=Math.round(o);return s<14?i?`in ${s} d`:`${s} d ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function dp(e){return e.length===1?e[0]??`An agent`:`${e.length} agents`}function fp({kind:e,runningNames:t,target:n,onCancel:r,onConfirm:i}){(0,v.useEffect)(()=>{function e(e){e.key===`Escape`&&r()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=t.length,o=dp(t);return(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-page/70 p-4 backdrop-blur-sm`,onClick:r,role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`busy-confirm-title`,className:`relative w-full max-w-xl rounded-sm border border-accent/40 bg-surface p-7 pl-8 shadow-deep`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-4 bottom-4 w-px bg-accent`}),(0,K.jsx)(`div`,{id:`busy-confirm-title`,className:`font-serif text-[17px] font-semibold text-text`,children:e===`upgrade`?`Update & restart now?`:`Restart now?`}),(0,K.jsxs)(`div`,{className:`font-serif mt-2 text-[15px] leading-relaxed text-text-muted`,children:[o,` `,a===1?`is`:`are`,` working. Their work is saved — after the `,e===`upgrade`?`update`:`restart`,` they'll continue right where they left off. Nothing is lost.`]}),e===`upgrade`&&n&&(0,K.jsxs)(`div`,{className:`mt-2.5 font-sans text-[12px] text-text-muted`,children:[`Installs `,(0,K.jsx)(`span`,{className:`font-mono text-[12px] text-text`,children:n}),` and restarts.`]}),(0,K.jsxs)(`div`,{className:`mt-5 flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-1.5 rounded-sm bg-accent px-3.5 py-2 text-[13px] font-medium text-white transition-colors hover:bg-accent/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface`,children:[(0,K.jsx)(e===`upgrade`?zs:Xs,{"aria-hidden":!0,className:`h-3.5 w-3.5`}),e===`upgrade`?`Update & restart`:`Restart now`]}),(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-sm border border-border-soft px-3.5 py-2 text-[13px] text-text-muted transition-colors hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:`Cancel`})]})]})}),document.body)}var pp=6e4;function mp(e){if(!e?.completedAt||e.status===`blocked`)return null;let t=Date.parse(e.completedAt);return!Number.isFinite(t)||Date.now()-t>6e4?null:e.mode===`drain-active`&&!e.fallbackToIdle&&(e.resumedCount??0)>0?{kind:`resumed`,count:e.resumedCount??0}:{kind:`restarted`}}function hp(e){return`${e} agent${e===1?``:`s`} resumed`}var gp=6e3,_p=`restart-echo-ack`;function vp(){let{data:e}=jo({queryKey:Po.serverInfo(),queryFn:Sd,staleTime:6e4}),t=e?.lastRestart?.completedAt,n=(0,v.useMemo)(()=>mp(e?.lastRestart),[t]),[r,i]=(0,v.useState)(!1),a=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!n||!t||a.current===t)return;a.current=t;try{if(sessionStorage.getItem(_p)===t)return}catch{}setTimeout(()=>i(!0),0);let e=pp-(Date.now()-Date.parse(t)),r=setTimeout(()=>{i(!1);try{sessionStorage.setItem(_p,t)}catch{}},Math.max(1500,Math.min(gp,e)));return()=>clearTimeout(r)},[n,t]);function o(){if(i(!1),t)try{sessionStorage.setItem(_p,t)}catch{}}if(!r||!n)return null;let s=n.kind===`resumed`?hp(n.count):`Services restarted`;return(0,y.createPortal)((0,K.jsx)(`div`,{className:`pointer-events-none fixed bottom-4 left-4 z-[70]`,style:{paddingBottom:`env(safe-area-inset-bottom)`},children:(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-auto flex items-center gap-2 rounded-sm border border-border-soft bg-surface px-3.5 py-2.5 shadow-deep`,children:[(0,K.jsx)(Ns,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-health-ok`}),(0,K.jsx)(`span`,{className:`font-serif text-[13px] text-text`,children:s}),(0,K.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Dismiss`,className:`ml-1 flex h-5 w-5 items-center justify-center rounded-sm text-text-muted transition-colors hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:(0,K.jsx)(nc,{"aria-hidden":!0,className:`h-3 w-3`})})]})}),document.body)}var yp=3e4,bp=1e3;function xp({compact:e=!1}){let[t,n]=(0,v.useState)(`idle`),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),s=(0,v.useRef)(0),{data:c=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:l=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o}),u=Sp(c,l);function d(){t===`idle`&&(u.length>0?i(!0):f())}async function f(){i(!1),o(null);try{await Cd(),s.current=Date.now(),n(`restarting`)}catch(e){o(e instanceof Error?e.message:String(e)),n(`failed`)}}return(0,v.useEffect)(()=>{if(t!==`restarting`)return;let e=!1,r=null;async function i(){if(Date.now()-s.current>yp){o(`Restart timed out after 30s. Check logs.`),n(`failed`);return}if(!await wd())e=!0;else if(e){n(`recovered`),window.location.reload();return}r=setTimeout(i,bp)}return r=setTimeout(i,bp),()=>{r&&clearTimeout(r)}},[t]),(0,K.jsxs)(K.Fragment,{children:[e?(0,K.jsxs)(`button`,{onClick:d,disabled:t===`restarting`,className:[`flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[11px] transition-colors`,t===`restarting`?`cursor-wait text-text-subtle`:`cursor-pointer border border-border-soft/60 text-text-muted hover:border-border-soft hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`].join(` `),title:t===`failed`&&a?a:`Restart Anima services`,children:[(0,K.jsx)(Xs,{className:`h-2.5 w-2.5 ${t===`restarting`?`animate-spin`:``}`}),(0,K.jsx)(`span`,{children:t===`restarting`?`Restarting…`:`Restart`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{onClick:d,disabled:t===`restarting`,className:[`chrome flex w-full items-center gap-2 rounded-sm px-2.5 py-1.5 text-left text-[11px] uppercase tracking-[0.1em] transition-colors`,t===`restarting`?`cursor-wait text-text-on-spine-subtle`:`cursor-pointer text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`].join(` `),title:`Restart Anima services`,children:[(0,K.jsx)(Xs,{className:`h-3.5 w-3.5 ${t===`restarting`?`animate-spin`:``}`}),(0,K.jsx)(`span`,{children:t===`restarting`?`Restarting…`:`Restart services`})]}),t===`failed`&&a&&(0,K.jsx)(`div`,{className:`mt-1 px-2 text-[11px] text-health-error`,children:a})]}),r&&(0,K.jsx)(fp,{kind:`restart`,runningNames:u,onCancel:()=>i(!1),onConfirm:()=>void f()}),t===`restarting`&&(0,K.jsx)(Cp,{})]})}function Sp(e,t){let n=new Map(e.map(e=>[e.id,e.profile?.displayName??e.id])),r=[];for(let e of t)e.currentItemId&&r.push(n.get(e.agentId)??e.agentId);return r}function Cp(){return(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 rounded-sm border border-border-soft bg-surface px-10 py-7 text-center shadow-deep`,children:[(0,K.jsx)(Xs,{className:`h-6 w-6 animate-spin text-accent`}),(0,K.jsx)(`div`,{className:`font-serif text-[16px] font-medium text-text`,children:`Restarting Anima services…`}),(0,K.jsx)(`div`,{className:`font-sans text-[12px] leading-relaxed text-text-muted`,children:`Any working agents pause at a safe point and resume right where they left off. The web app reloads automatically when services are back.`})]})}),document.body)}var wp=5*6e4,Tp=3e3;function Ep(){return jo({queryKey:Po.runtimeUpgrade(),queryFn:Td,staleTime:6e4,refetchInterval:e=>{let t=e.state.data?.operation.status;return t===`scheduled`||t===`running`?Tp:wp}})}function Dp(){let{data:e}=Ep();return e?.state===`available`}var Op=3e5,kp=1500,Ap=60*6e4;function jp(){let{data:e,isLoading:t}=Ep(),{data:n=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),[r,i]=(0,v.useState)(`idle`),[a,o]=(0,v.useState)(null);async function s(){o(null);try{await Dd(),i(`applying`)}catch(e){i(`idle`),e instanceof Ed&&e.status===409?o(`An agent started working — try again once idle.`):e instanceof Ed&&e.status===503?o(`Update is unavailable right now.`):o(e instanceof Error?e.message:`Upgrade failed to start.`)}}if((0,v.useEffect)(()=>{if(r!==`applying`)return;let e=!1,t=!1,n=Date.now(),a=null;async function o(){if(!t){if(Date.now()-n>Op){window.location.reload();return}try{let n=await Td();if(t)return;if(e){window.location.reload();return}if(n.operation.status===`failed`){i(`idle`),No.invalidateQueries({queryKey:Po.runtimeUpgrade()});return}}catch{e=!0}a=setTimeout(o,kp)}}return a=setTimeout(o,kp),()=>{t=!0,a&&clearTimeout(a)}},[r]),t&&!e)return(0,K.jsxs)(Fp,{children:[(0,K.jsx)(Xs,{"aria-hidden":!0,className:`h-3 w-3 animate-spin text-text-subtle`}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text-muted`,children:`Checking for updates…`})]});if(!e)return null;let c=e.operation.status,l=e.operation.targetVersion??e.latestOnTrack,u=r===`applying`||c===`scheduled`||c===`running`,d=e.operation.completedAt,f=c===`failed`&&Bp(d),p=Rp(e.gate.blockers,n),m=mp(zp(e.operation)),h=m?.kind===`resumed`?m.count:null;function g(){p.length>0?i(`confirming`):s()}let _;return _=u?(0,K.jsxs)(Fp,{children:[(0,K.jsx)(Xs,{"aria-hidden":!0,className:`h-3 w-3 animate-spin text-accent`}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:l?`Updating to ${l}…`:`Updating…`})]}):f?(0,K.jsx)(Np,{currentVersion:e.currentVersion,error:e.operation.error,rollback:e.operation.rollback,logPath:e.operation.logPath,onRetry:g}):e.state===`error`?(0,K.jsx)(Fp,{children:(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text-muted`,title:e.checkError?.message,children:`Update check unavailable`})}):e.state===`available`&&l?(0,K.jsx)(Mp,{currentVersion:e.currentVersion,target:l,error:a,onUpgrade:g}):(0,K.jsxs)(Fp,{children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-health-ok`}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:`Up to date`}),h!==null&&(0,K.jsxs)(`span`,{className:`font-sans text-[11px] text-text-subtle`,children:[`· `,hp(h)]})]}),(0,K.jsxs)(K.Fragment,{children:[_,r===`confirming`&&l&&(0,K.jsx)(fp,{kind:`upgrade`,runningNames:p,target:l,onCancel:()=>i(`idle`),onConfirm:()=>void s()}),r===`applying`&&(0,K.jsx)(Ip,{target:l})]})}function Mp({currentVersion:e,target:t,error:n,onUpgrade:r}){let i=Lp(e,t);return(0,K.jsxs)(`div`,{className:`rounded-sm border border-accent/30 bg-accent/[0.06] p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-accent`}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] font-medium text-text`,children:`Update available`})]}),!i&&(0,K.jsx)(Pp,{from:e,to:t})]}),i&&(0,K.jsx)(`div`,{className:`mt-1.5`,children:(0,K.jsx)(Pp,{from:e,to:t,stacked:!0})}),(0,K.jsxs)(`div`,{className:`mt-2.5`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-center gap-1.5 rounded-sm bg-accent px-3 py-1.5 text-[12px] font-medium text-white transition-colors hover:bg-accent/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-offset-1 focus-visible:ring-offset-page`,children:[(0,K.jsx)(zs,{"aria-hidden":!0,className:`h-3 w-3`}),`Upgrade & restart`]}),n&&(0,K.jsx)(`p`,{className:`mt-1.5 font-sans text-[11px] text-health-error`,children:n})]})]})}function Np({currentVersion:e,error:t,rollback:n,logPath:r,onRetry:i}){return(0,K.jsxs)(`div`,{className:`rounded-sm border border-health-error/40 bg-health-error/[0.06] p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(ec,{"aria-hidden":!0,className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-health-error`}),n===`failed`?(0,K.jsx)(`span`,{className:`font-serif text-[14px] font-medium text-text`,children:`Update failed and rollback didn't complete — the runtime may need attention.`}):(0,K.jsxs)(`span`,{className:`font-serif text-[14px] font-medium text-text`,children:[`Update failed — still on`,` `,(0,K.jsx)(`span`,{className:`font-mono text-[12px] text-text-muted`,children:e}),(0,K.jsxs)(`span`,{className:`font-sans text-[12px] font-normal text-text-subtle`,children:[` `,`· nothing else changed`]})]})]}),t&&(0,K.jsx)(`p`,{className:`mt-1.5 break-words font-mono text-[10px] leading-relaxed text-text-subtle`,children:t}),r&&(0,K.jsxs)(`p`,{className:`mt-1 break-all font-mono text-[10px] leading-relaxed text-text-subtle opacity-70`,children:[`log: `,r]}),(0,K.jsx)(`div`,{className:`mt-2.5`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-1.5 rounded-sm border border-border-soft px-2.5 py-1 text-[12px] text-text-muted transition-colors hover:border-border-soft hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[(0,K.jsx)(Xs,{"aria-hidden":!0,className:`h-3 w-3`}),`Try again`]})})]})}function Pp({from:e,to:t,stacked:n=!1}){return n?(0,K.jsxs)(`div`,{className:`font-mono text-[11px] leading-snug`,children:[(0,K.jsx)(`div`,{className:`break-all text-text-subtle`,children:e}),(0,K.jsxs)(`div`,{className:`break-all text-text`,children:[(0,K.jsx)(`span`,{className:`text-text-subtle`,children:`→`}),` `,t]})]}):(0,K.jsxs)(`span`,{className:`shrink-0 whitespace-nowrap font-mono text-[12px] text-text-muted`,children:[e,` `,(0,K.jsx)(`span`,{className:`text-text-subtle`,children:`→`}),` `,t]})}function Fp({children:e}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`w-14 shrink-0 font-sans text-[11px] text-text-subtle`,children:`Update`}),(0,K.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5`,children:e})]})}function Ip({target:e}){return(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-page/70 p-4 backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 rounded-sm border border-border-soft bg-surface px-10 py-7 text-center shadow-deep`,children:[(0,K.jsx)(Xs,{className:`h-6 w-6 animate-spin text-accent`}),(0,K.jsx)(`div`,{className:`font-serif text-[16px] font-medium text-text`,children:e?`Installing ${e}…`:`Installing update…`}),(0,K.jsx)(`div`,{className:`font-sans text-[12px] leading-relaxed text-text-muted`,children:`Your current version keeps running while Anima installs and verifies the new one, then restarts at a safe point so any working agents resume right where they left off. The dashboard reloads automatically when it's back.`})]})}),document.body)}function Lp(e,t){return e.length>12||t.length>12||e.length+t.length>22}function Rp(e,t){let n=new Map(t.map(e=>[e.id,e.profile?.displayName??e.id]));return e.filter(e=>e.status===`running`).map(e=>n.get(e.agentId)??e.agentId)}function zp(e){return{completedAt:e.completedAt,fallbackToIdle:e.restart?.fallbackToIdle,mode:e.restart?.mode,resumedCount:e.restart?.resumedCount}}function Bp(e){return!e||Date.now()-Date.parse(e)<Ap}function Vp(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return`now`;let n=Math.round(t/6e4),r=Math.floor(n/1440),i=Math.floor(n%1440/60),a=n%60;return r>0?i>0?`${r}d ${i}h`:`${r}d`:i>0?a>0?`${i}h ${a}m`:`${i}h`:`${a}m`}function Hp(e,t){let n=Math.round((t.getTime()-new Date(e).getTime())/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function Up(e){return e>=50?`bg-health-ok`:e>=20?`bg-health-warn`:`bg-health-error`}function Wp(e){return e.unlimited?`∞`:e.balance===void 0?e.limit!==void 0&&e.used!==void 0?String(e.limit-e.used):e.limit===void 0?`—`:String(e.limit):e.currency?`${e.balance} ${e.currency}`:String(e.balance)}function Gp({w:e}){let t=Math.round(e.remainingPercent);return(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[11px] text-text-subtle`,children:e.label}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,K.jsxs)(`span`,{className:`font-mono text-[11px] ${t<20?`text-health-error`:t<50?`text-health-warn`:`text-text-muted`}`,children:[t,`%`]}),e.resetsAt&&(0,K.jsx)(`span`,{className:`font-sans text-[10px] text-text-subtle`,children:Vp(e.resetsAt)})]})]}),(0,K.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-surface-elevated`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-300 ${Up(t)}`,style:{width:`${t}%`}})})]})}function Kp({row:e}){let t=e.status===`available`;return(0,K.jsxs)(`div`,{className:t?``:`opacity-50`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[12px] font-medium text-text`,children:e.label}),e.source===`private-api`&&(0,K.jsx)(`span`,{className:`rounded border border-text-subtle/20 px-1 font-mono text-[9px] text-text-subtle`,title:`Data scraped from private API — best-effort`,children:`≈`})]}),t?(0,K.jsxs)(`div`,{className:`space-y-2.5`,children:[e.windows.map((e,t)=>(0,K.jsx)(Gp,{w:e},t)),e.extras.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-0.5`,children:e.extras.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-baseline gap-1`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[10px] text-text-subtle`,children:e.label}),(0,K.jsx)(`span`,{className:`font-serif text-[12px] text-text-muted`,children:Wp(e)})]},t))})]}):(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[12px] text-text-muted`,children:e.error?.type===`not_configured`?`Not configured`:e.error?.type===`unauthorized`?`Auth expired`:e.error?.type===`network_error`?`Unreachable`:`Unavailable`}),e.error?.message&&e.error.type!==`network_error`&&e.error.type!==`unknown`&&(0,K.jsx)(`p`,{className:`font-mono text-[10px] text-text-subtle leading-relaxed`,children:e.error.message})]})]})}function qp(){return(0,K.jsxs)(`div`,{className:`animate-pulse space-y-2`,children:[(0,K.jsx)(`div`,{className:`h-3 w-20 rounded bg-surface-elevated`}),(0,K.jsx)(`div`,{className:`h-1 w-full rounded-full bg-surface-elevated`}),(0,K.jsx)(`div`,{className:`h-1 w-2/3 rounded-full bg-surface-elevated`})]})}function Jp({onClose:e}){let{data:t}=jo({queryKey:Po.health(),queryFn:wd,staleTime:5e3}),{data:n}=jo({queryKey:Po.serverInfo(),queryFn:Sd,staleTime:6e4}),r=t===void 0?`loading`:t?`ok`:`error`,{data:i,isLoading:a,isFetching:o,refetch:s}=jo({queryKey:Po.providerUsage(),queryFn:xd,staleTime:6e4}),[c,l]=(0,v.useState)(()=>new Date);(0,v.useEffect)(()=>{let e=setInterval(()=>l(new Date),6e4);return()=>clearInterval(e)},[]),(0,v.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let u=(0,v.useRef)(null),d=r===`loading`?`var(--color-health-idle)`:r===`ok`?`var(--color-health-ok)`:`var(--color-health-error)`,f=r===`loading`?`Checking…`:r===`ok`?`Healthy`:`Unreachable`,p=t!==void 0&&!!n,m=i?.providers[0]?.checkedAt;return(0,y.createPortal)((0,K.jsxs)(`div`,{className:`fixed inset-0 z-50`,children:[(0,K.jsx)(`div`,{className:`hidden md:block fixed inset-0 bg-page/70 backdrop-blur-sm`,onClick:e}),(0,K.jsxs)(`div`,{ref:u,role:`dialog`,"aria-modal":`true`,"aria-label":`Server`,className:[`relative flex h-full w-full flex-col bg-surface`,`md:absolute md:top-1/2 md:left-1/2 md:-translate-x-1/2 md:-translate-y-1/2`,`md:h-auto md:max-h-[calc(100dvh-4rem)] md:max-w-xl md:rounded-sm md:border md:border-border-soft md:shadow-deep`,`transition-[opacity,transform] duration-150 ease-out`,p?`opacity-100 scale-100`:`opacity-0 md:scale-95`].join(` `),style:{paddingBottom:`env(safe-area-inset-bottom)`},children:[(0,K.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center justify-between border-b border-border-soft px-3`,children:[(0,K.jsx)(`span`,{className:`caps text-text`,children:`Server`}),(0,K.jsx)(`button`,{onClick:e,className:`flex h-7 w-7 items-center justify-center rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,"aria-label":`Close server panel`,children:(0,K.jsx)(nc,{className:`h-3.5 w-3.5`})})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto divide-y divide-border-soft`,children:[(0,K.jsx)(Yp,{title:`System`,action:(0,K.jsx)(xp,{compact:!0}),children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsx)(Xp,{label:`Health`,children:(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full`,style:{background:d}}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:f})]})}),n&&(0,K.jsx)(Xp,{label:`Home`,children:(0,K.jsx)(`span`,{className:`min-w-0 break-all font-mono text-[12px] text-text`,title:n.animaHome,children:n.animaHome})}),n&&(0,K.jsx)(Xp,{label:`Port`,children:(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:n.dashboardPort})}),n?.startedAt&&(0,K.jsxs)(Xp,{label:`Started`,children:[(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:lp(n.startedAt)}),(0,K.jsxs)(`span`,{className:`font-sans text-[11px] tracking-wide text-text-subtle`,children:[`up `,sp(n.startedAt,c)]})]}),n?.commit&&(0,K.jsx)(Xp,{label:`Commit`,children:(0,K.jsx)(`span`,{className:`font-mono text-[12px] text-text`,children:n.commit})}),n?.version&&n.version!==`0.0.0`&&(0,K.jsx)(Xp,{label:`Version`,children:(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:n.version})}),(0,K.jsx)(jp,{})]})}),(0,K.jsx)(Yp,{title:`Provider Usage`,action:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[m&&(0,K.jsx)(`span`,{className:`font-sans text-[10px] text-text-subtle`,children:Hp(m,c)}),(0,K.jsx)(`button`,{onClick:()=>s(),disabled:o,className:`flex h-5 w-5 items-center justify-center rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent disabled:opacity-40`,"aria-label":`Refresh provider usage`,title:`Refresh`,children:(0,K.jsx)(Xs,{className:`h-3 w-3 ${o?`animate-spin`:``}`})})]}),children:a?(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(qp,{}),(0,K.jsx)(qp,{}),(0,K.jsx)(qp,{})]}):(()=>{let e=i?.providers.filter(e=>e.error?.type!==`not_configured`)??[];return e.length>0?(0,K.jsxs)(`div`,{className:`space-y-5`,children:[e.map(e=>(0,K.jsx)(Kp,{row:e},e.provider)),e.some(e=>e.source===`private-api`)&&(0,K.jsx)(`p`,{className:`font-mono text-[9px] text-text-subtle opacity-50`,children:`≈ best-effort (private API)`})]}):(0,K.jsx)(`p`,{className:`font-serif italic text-[13px] text-text-subtle`,children:`No providers configured.`})})()})]})]})]}),document.body)}function Yp({title:e,action:t,children:n}){return(0,K.jsxs)(`div`,{className:`px-4 py-4 md:px-6 md:py-5`,children:[(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-text-subtle`,children:e}),t&&(0,K.jsx)(`div`,{className:`shrink-0`,children:t})]}),n]})}function Xp({label:e,children:t,action:n}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`w-14 shrink-0 font-sans text-[11px] text-text-subtle`,children:e}),(0,K.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5`,children:t}),n&&(0,K.jsx)(`div`,{className:`shrink-0`,children:n})]})}async function Zp(){return(await Io(`/api/kbs`)).kbs}async function Qp(e){return Io(e?`/api/filesystem/browse?path=${encodeURIComponent(e)}`:`/api/filesystem/browse`)}async function $p(e){return(await Io(`/api/kbs`,Lo(`POST`,e))).kbs}async function em(e){return Io(`/api/kbs/${encodeURIComponent(e)}`)}async function tm(e,t){let n={label:t};return(await Io(`/api/kbs/${encodeURIComponent(e)}/rename`,Lo(`POST`,n))).kbs}async function nm(e){return(await Io(`/api/kbs/${encodeURIComponent(e)}`,{method:`DELETE`})).kbs}async function rm(e){return Io(`/api/kbs/${encodeURIComponent(e)}/tree`)}async function im(e,t){return Io(`/api/kbs/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`)}function am(e,t){return`/api/kbs/${encodeURIComponent(e)}/download?path=${encodeURIComponent(t)}`}function om(e,t,n){if(!t?.length)return e;let r=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(r.get(n(e))??1/0)-(r.get(n(t))??1/0))}function sm(){let{data:e=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:t=[]}=jo({queryKey:Po.kbs(),queryFn:Zp}),{data:n}=jo({queryKey:Po.sidebarOrder(),queryFn:vd,staleTime:1/0}),r=Mo({mutationFn:yd,onMutate:async e=>{await No.cancelQueries({queryKey:Po.sidebarOrder()}),No.setQueryData(Po.sidebarOrder(),e)},onError:()=>{No.invalidateQueries({queryKey:Po.sidebarOrder()})}}),i=om(e,n?.agents,e=>e.id),a=om(t,n?.kbs,e=>e.id),o=new Map(e.map((e,t)=>[e.id,t])),s=new Map(t.map((e,t)=>[e.id,t])),c=Wc(Uc(Wl,{activationConstraint:{distance:4}}));function l(e){let{active:t,over:a}=e;if(!a||t.id===a.id)return;let o=i.findIndex(e=>e.id===String(t.id)),s=i.findIndex(e=>e.id===String(a.id));if(o===-1||s===-1)return;let c=Xu(i,o,s);r.mutate({...n,agents:c.map(e=>e.id)})}function u(e){let{active:t,over:i}=e;if(!i||t.id===i.id)return;let o=a.findIndex(e=>e.id===String(t.id)),s=a.findIndex(e=>e.id===String(i.id));if(o===-1||s===-1)return;let c=Xu(a,o,s);r.mutate({...n,kbs:c.map(e=>e.id)})}return{orderedAgents:i,orderedKbs:a,agentIndexMap:o,kbIndexMap:s,sensors:c,reorderAgents:l,reorderKbs:u}}var cm=[`var(--color-agent-1)`,`var(--color-agent-2)`,`var(--color-agent-3)`,`var(--color-agent-4)`];function lm(e){return cm[e%cm.length]}function um(e){let t=e.trim();return t?t[0].toUpperCase():`?`}function dm({agent:e,index:t,active:n,isRunning:r,enabled:i,onClick:a}){let o=lm(t),s=e.profile?.displayName??e.id,c=um(s),l=i&&e.slack?.connected!==!0;return(0,K.jsxs)(`div`,{className:[`group relative flex w-full items-center rounded-sm transition-colors`,n?`bg-spine-elevated`:`hover:bg-spine-elevated/30`].join(` `),children:[n&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-1.5 bottom-1.5 w-0.5 bg-accent`}),(0,K.jsxs)(`button`,{onClick:a,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 px-3 py-2.5 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-inset`,children:[e.slack?.avatarUrl?(0,K.jsx)(`img`,{src:e.slack.avatarUrl,alt:``,className:[`h-8 w-8 shrink-0 rounded-sm object-cover`,i?l?`opacity-40 grayscale`:``:`opacity-40 grayscale`].join(` `)}):(0,K.jsx)(`span`,{className:[`font-sans flex h-8 w-8 shrink-0 items-center justify-center rounded-sm text-[11px] font-bold text-white`,!i||l?`opacity-40`:``].join(` `),style:{background:o},children:c}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:[`truncate font-serif text-[14px] leading-tight`,n?`font-semibold`:`font-medium`,!i||l?`text-text-on-spine-subtle`:`text-text-on-spine`].join(` `),children:s}),i?l?null:(0,K.jsx)(`span`,{className:`ml-auto inline-block h-2 w-2 shrink-0 rounded-full`,style:{background:r?`var(--color-health-warn)`:`var(--color-health-ok)`},title:r?`working`:`idle`}):(0,K.jsx)(`span`,{className:`font-sans ml-auto shrink-0 rounded-sm border border-text-on-spine-subtle/40 bg-text-on-spine-subtle/10 px-1 py-0.5 text-[9px] uppercase tracking-[0.08em] text-text-on-spine-subtle`,title:`disabled by user`,children:`Off`})]}),l&&(0,K.jsx)(`div`,{className:`font-sans mt-0.5 text-[10px] leading-tight text-health-warn/80`,children:`Not connected`})]})]})]})}var fm;function q(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var pm=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},mm=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(fm=globalThis).__zod_globalConfig??(fm.__zod_globalConfig={});var hm=globalThis.__zod_globalConfig;function gm(e){return e&&Object.assign(hm,e),hm}function _m(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function vm(e,t){return typeof t==`bigint`?t.toString():t}function ym(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function bm(e){return e==null}function xm(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Sm(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Cm=Symbol(`evaluating`);function wm(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Cm)return r===void 0&&(r=Cm,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Tm(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Em(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Dm(e){return JSON.stringify(e)}function Om(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var km=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Am(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var jm=ym(()=>{if(hm.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Mm(e){if(Am(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Am(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Nm(e){return Mm(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Pm=new Set([`string`,`number`,`symbol`]);function Fm(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Im(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function J(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Lm(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Rm={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function zm(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Im(e,Em(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Tm(this,`shape`,e),e},checks:[]}))}function Bm(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Im(e,Em(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Tm(this,`shape`,r),r},checks:[]}))}function Vm(e,t){if(!Mm(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Im(e,Em(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Tm(this,`shape`,n),n}}))}function Hm(e,t){if(!Mm(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Im(e,Em(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Tm(this,`shape`,n),n}}))}function Um(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Im(e,Em(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Tm(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Wm(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Im(t,Em(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Tm(this,`shape`,i),i},checks:[]}))}function Gm(e,t,n){return Im(t,Em(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Tm(this,`shape`,i),i}}))}function Km(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function qm(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Jm(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Ym(e){return typeof e==`string`?e:e?.message}function Xm(e,t,n){let r=e.message?e.message:Ym(e.inst?._zod.def?.error?.(e))??Ym(t?.error?.(e))??Ym(n.customError?.(e))??Ym(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Zm(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Qm(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var $m=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,vm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},eh=q(`$ZodError`,$m),th=q(`$ZodError`,$m,{Parent:Error});function nh(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function rh(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var ih=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new pm;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Xm(e,a,gm())));throw km(t,i?.callee),t}return o.value},ah=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>Xm(e,a,gm())));throw km(t,i?.callee),t}return o.value},oh=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new pm;return a.issues.length?{success:!1,error:new(e??eh)(a.issues.map(e=>Xm(e,i,gm())))}:{success:!0,data:a.value}},sh=oh(th),ch=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>Xm(e,i,gm())))}:{success:!0,data:a.value}},lh=ch(th),uh=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ih(e)(t,n,i)},dh=e=>(t,n,r)=>ih(e)(t,n,r),fh=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ah(e)(t,n,i)},ph=e=>async(t,n,r)=>ah(e)(t,n,r),mh=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return oh(e)(t,n,i)},hh=e=>(t,n,r)=>oh(e)(t,n,r),gh=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ch(e)(t,n,i)},_h=e=>async(t,n,r)=>ch(e)(t,n,r),vh=/^[cC][0-9a-z]{6,}$/,yh=/^[0-9a-z]+$/,bh=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xh=/^[0-9a-vA-V]{20}$/,Sh=/^[A-Za-z0-9]{27}$/,Ch=/^[a-zA-Z0-9_-]{21}$/,wh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Th=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Eh=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Dh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Oh=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function kh(){return new RegExp(Oh,`u`)}var Ah=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Mh=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Nh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ph=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Fh=/^[A-Za-z0-9_-]*$/,Ih=/^https?$/,Lh=/^\+[1-9]\d{6,14}$/,Rh=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,zh=RegExp(`^${Rh}$`);function Bh(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Vh(e){return RegExp(`^${Bh(e)}$`)}function Hh(e){let t=Bh({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Rh}T(?:${r})$`)}var Uh=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Wh=/^-?\d+$/,Gh=/^-?\d+(?:\.\d+)?$/,Kh=/^(?:true|false)$/i,qh=/^[^A-Z]*$/,Jh=/^[^a-z]*$/,Yh=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Xh={number:`number`,bigint:`bigint`,object:`date`},Zh=q(`$ZodCheckLessThan`,(e,t)=>{Yh.init(e,t);let n=Xh[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Qh=q(`$ZodCheckGreaterThan`,(e,t)=>{Yh.init(e,t);let n=Xh[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),$h=q(`$ZodCheckMultipleOf`,(e,t)=>{Yh.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Sm(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),eg=q(`$ZodCheckNumberFormat`,(e,t)=>{Yh.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Rm[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Wh)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),tg=q(`$ZodCheckMaxLength`,(e,t)=>{var n;Yh.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!bm(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Zm(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),ng=q(`$ZodCheckMinLength`,(e,t)=>{var n;Yh.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!bm(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Zm(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),rg=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;Yh.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!bm(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Zm(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),ig=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Yh.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ag=q(`$ZodCheckRegex`,(e,t)=>{ig.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),og=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=qh,ig.init(e,t)}),sg=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Jh,ig.init(e,t)}),cg=q(`$ZodCheckIncludes`,(e,t)=>{Yh.init(e,t);let n=Fm(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),lg=q(`$ZodCheckStartsWith`,(e,t)=>{Yh.init(e,t);let n=RegExp(`^${Fm(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ug=q(`$ZodCheckEndsWith`,(e,t)=>{Yh.init(e,t);let n=RegExp(`.*${Fm(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),dg=q(`$ZodCheckOverwrite`,(e,t)=>{Yh.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),fg=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
17
|
+
`},zc={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Bc(e){let{announcements:t=zc,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Rc}=e,{announce:a,announcement:o}=Pc(),s=bc(`DndLiveRegion`),[c,l]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{l(!0)},[]),Ic((0,v.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=v.createElement(v.Fragment,null,v.createElement(Mc,{id:r,value:i.draggable}),v.createElement(Nc,{id:s,announcement:o}));return n?(0,y.createPortal)(u,n):u}var Vc;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(Vc||={});function Hc(){}function Uc(e,t){return(0,v.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Wc(){var e=[...arguments];return(0,v.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var Gc=Object.freeze({x:0,y:0});function Kc(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function qc(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Jc(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Yc(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Xc(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Zc=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Xc(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=Kc(Xc(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(qc)};function Qc(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var $c=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=Qc(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Jc)};function el(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function tl(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Gc}function nl(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var rl=nl(1);function il(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function al(e,t,n){let r=il(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var ol={ignoreTransform:!1};function sl(e,t){t===void 0&&(t=ol);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=sc(e).getComputedStyle(e);t&&(n=al(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function cl(e){return sl(e,{ignoreTransform:!0})}function ll(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function ul(e,t){return t===void 0&&(t=sc(e).getComputedStyle(e)),t.position===`fixed`}function dl(e,t){t===void 0&&(t=sc(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`?n.test(r):!1})}function fl(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(cc(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!lc(i)||uc(i)||n.includes(i))return n;let a=sc(e).getComputedStyle(i);return i!==e&&dl(i,a)&&n.push(i),ul(i,a)?n:r(i.parentNode)}return e?r(e):n}function pl(e){let[t]=fl(e,1);return t??null}function ml(e){return!ic||!e?null:ac(e)?e:oc(e)?cc(e)||e===dc(e).scrollingElement?window:lc(e)?e:null:null}function hl(e){return ac(e)?e.scrollX:e.scrollLeft}function gl(e){return ac(e)?e.scrollY:e.scrollTop}function _l(e){return{x:hl(e),y:gl(e)}}var vl;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(vl||={});function yl(e){return!ic||!e?!1:e===document.scrollingElement}function bl(e){let t={x:0,y:0},n=yl(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var xl={x:.2,y:.2};function Sl(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=xl);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=bl(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=vl.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=vl.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=vl.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=vl.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Cl(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function wl(e){return e.reduce((e,t)=>Sc(e,_l(t)),Gc)}function Tl(e){return e.reduce((e,t)=>e+hl(t),0)}function El(e){return e.reduce((e,t)=>e+gl(t),0)}function Dl(e,t){if(t===void 0&&(t=sl),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);pl(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Ol=[[`x`,[`left`,`right`],Tl],[`y`,[`top`,`bottom`],El]],kl=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=fl(t),r=wl(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Ol)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Al=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function jl(e){let{EventTarget:t}=sc(e);return e instanceof t?e:dc(e)}function Ml(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t?r>t.y:!1}var Nl;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Nl||={});function Pl(e){e.preventDefault()}function Fl(e){e.stopPropagation()}var Il;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Il||={});var Ll={start:[Il.Space,Il.Enter],cancel:[Il.Esc],end:[Il.Space,Il.Enter,Il.Tab]},Rl=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Il.Right:return{...n,x:n.x+25};case Il.Left:return{...n,x:n.x-25};case Il.Down:return{...n,y:n.y+25};case Il.Up:return{...n,y:n.y-25}}},zl=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Al(dc(t)),this.windowListeners=new Al(sc(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Nl.Resize,this.handleCancel),this.windowListeners.add(Nl.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Nl.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&Dl(n),t(Gc)}handleKeyDown(e){if(Tc(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=Ll,coordinateGetter:a=Rl,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:Gc;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Cc(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=bl(n),p=Cl(n),m={x:Math.min(i===Il.Right?p.right-p.width/2:p.right,Math.max(i===Il.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Il.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Il.Down?p.top:p.top+p.height/2,u.y))},h=i===Il.Right&&!s||i===Il.Left&&!c,g=i===Il.Down&&!l||i===Il.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Il.Right&&e<=d.x||i===Il.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Il.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Il.Down&&e<=d.y||i===Il.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Il.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,Sc(Cc(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};zl.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=Ll,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Bl(e){return!!(e&&`distance`in e)}function Vl(e){return!!(e&&`delay`in e)}var Hl=class{constructor(e,t,n){n===void 0&&(n=jl(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=dc(i),this.documentListeners=new Al(this.document),this.listeners=new Al(n),this.windowListeners=new Al(sc(i)),this.initialCoordinates=Dc(r)??Gc,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Nl.Resize,this.handleCancel),this.windowListeners.add(Nl.DragStart,Pl),this.windowListeners.add(Nl.VisibilityChange,this.handleCancel),this.windowListeners.add(Nl.ContextMenu,Pl),this.documentListeners.add(Nl.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Vl(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Bl(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Nl.Click,Fl,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Nl.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Dc(e)??Gc,s=Cc(n,o);if(!t&&a){if(Bl(a)){if(a.tolerance!=null&&Ml(s,a.tolerance))return this.handleCancel();if(Ml(s,a.distance))return this.handleStart()}if(Vl(a)&&Ml(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Il.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Ul={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Wl=class extends Hl{constructor(e){let{event:t}=e,n=dc(t.target);super(e,Ul,n)}};Wl.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var Gl={move:{name:`mousemove`},end:{name:`mouseup`}},Kl;(function(e){e[e.RightClick=2]=`RightClick`})(Kl||={});var ql=class extends Hl{constructor(e){super(e,Gl,dc(e.event.target))}};ql.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===Kl.RightClick?!1:(r?.({event:n}),!0)}}];var Jl={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},Yl=class extends Hl{constructor(e){super(e,Jl)}static setup(){return window.addEventListener(Jl.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Jl.move.name,e)};function e(){}}};Yl.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var Xl;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Xl||={});var Zl;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Zl||={});function Ql(e){let{acceleration:t,activator:n=Xl.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Zl.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=eu({delta:d,disabled:!a}),[m,h]=mc(),g=(0,v.useRef)({x:0,y:0}),_=(0,v.useRef)({x:0,y:0}),y=(0,v.useMemo)(()=>{switch(n){case Xl.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Xl.DraggableRect:return i}},[n,i,c]),b=(0,v.useRef)(null),x=(0,v.useCallback)(()=>{let e=b.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),S=(0,v.useMemo)(()=>s===Zl.TreeOrder?[...l].reverse():l,[s,l]);(0,v.useEffect)(()=>{if(!a||!l.length||!y){h();return}for(let e of S){if(r?.(e)===!1)continue;let n=u[l.indexOf(e)];if(!n)continue;let{direction:i,speed:a}=Sl(e,n,y,t,f);for(let e of[`x`,`y`])p[e][i[e]]||(a[e]=0,i[e]=0);if(a.x>0||a.y>0){h(),b.current=e,m(x,o),g.current=a,_.current=i;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,x,r,h,a,o,JSON.stringify(y),JSON.stringify(p),m,l,S,u,JSON.stringify(f)])}var $l={x:{[vl.Backward]:!1,[vl.Forward]:!1},y:{[vl.Backward]:!1,[vl.Forward]:!1}};function eu(e){let{delta:t,disabled:n}=e,r=vc(t);return gc(e=>{if(n||!r||!e)return $l;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[vl.Backward]:e.x[vl.Backward]||i.x===-1,[vl.Forward]:e.x[vl.Forward]||i.x===1},y:{[vl.Backward]:e.y[vl.Backward]||i.y===-1,[vl.Forward]:e.y[vl.Forward]||i.y===1}}},[n,t,r])}function tu(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return gc(e=>t==null?null:r??e??null,[r,t])}function nu(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var ru;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(ru||={});var iu;(function(e){e.Optimized=`optimized`})(iu||={});var au=new Map;function ou(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,v.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,v.useRef)(e),d=g(),f=hc(d),p=(0,v.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,v.useRef)(null),h=gc(t=>{if(d&&!n)return au;if(!t||t===au||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new kl(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,v.useEffect)(()=>{u.current=e},[e]),(0,v.useEffect)(()=>{d||p()},[n,d]),(0,v.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,v.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case ru.Always:return!1;case ru.BeforeDragging:return n;default:return!n}}}function su(e,t){return gc(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function cu(e,t){return su(e,t)}function lu(e){let{callback:t,disabled:n}=e,r=pc(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function uu(e){let{callback:t,disabled:n}=e,r=pc(t),i=(0,v.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,v.useEffect)(()=>()=>i?.disconnect(),[i]),i}function du(e){return new kl(sl(e),e)}function fu(e,t,n){t===void 0&&(t=du);let[r,i]=(0,v.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=lu({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=uu({callback:a});return fc(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function pu(e){return tl(e,su(e))}var mu=[];function hu(e){let t=(0,v.useRef)(e),n=gc(n=>e?n&&n!==mu&&e&&t.current&&e.parentNode===t.current.parentNode?n:fl(e):mu,[e]);return(0,v.useEffect)(()=>{t.current=e},[e]),n}function gu(e){let[t,n]=(0,v.useState)(null),r=(0,v.useRef)(e),i=(0,v.useCallback)(e=>{let t=ml(e.target);t&&n(e=>e?(e.set(t,_l(t)),new Map(e)):null)},[]);return(0,v.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=ml(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,_l(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{ml(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,v.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>Sc(e,t),Gc):wl(e):Gc,[e,t])}function _u(e,t){t===void 0&&(t=[]);let n=(0,v.useRef)(null);return(0,v.useEffect)(()=>{n.current=null},t),(0,v.useEffect)(()=>{let t=e!==Gc;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Cc(e,n.current):Gc}function vu(e){(0,v.useEffect)(()=>{if(!ic)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function yu(e,t){return(0,v.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function bu(e){return(0,v.useMemo)(()=>e?ll(e):null,[e])}var xu=[];function Su(e,t){t===void 0&&(t=sl);let[n]=e,r=bu(n?sc(n):null),[i,a]=(0,v.useState)(xu);function o(){a(()=>e.length?e.map(e=>yl(e)?r:new kl(t(e),e)):xu)}let s=uu({callback:o});return fc(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Cu(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return lc(t)?t:e}function wu(e){let{measure:t}=e,[n,r]=(0,v.useState)(null),i=uu({callback:(0,v.useCallback)(e=>{for(let{target:n}of e)if(lc(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=_c((0,v.useCallback)(e=>{let n=Cu(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,v.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Tu=[{sensor:Wl,options:{}},{sensor:zl,options:{}}],Eu={current:{}},Du={draggable:{measure:cl},droppable:{measure:cl,strategy:ru.WhileDragging,frequency:iu.Optimized},dragOverlay:{measure:sl}},Ou=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},ku={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ou,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Hc},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Du,measureDroppableContainers:Hc,windowRect:null,measuringScheduled:!1},Au={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Hc,draggableNodes:new Map,over:null,measureDroppableContainers:Hc},ju=(0,v.createContext)(Au),Mu=(0,v.createContext)(ku);function Nu(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ou}}}function Pu(e,t){switch(t.type){case Vc.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vc.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Vc.DragEnd:case Vc.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vc.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new Ou(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Vc.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new Ou(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case Vc.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new Ou(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Fu(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,v.useContext)(ju),a=vc(r),o=vc(n?.id);return(0,v.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Tc(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Ac(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function Iu(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Lu(e){return(0,v.useMemo)(()=>({draggable:{...Du.draggable,...e?.draggable},droppable:{...Du.droppable,...e?.droppable},dragOverlay:{...Du.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Ru(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,v.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;fc(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=tl(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=pl(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var zu=(0,v.createContext)({...Gc,scaleX:1,scaleY:1}),Bu;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Bu||={});var Vu=(0,v.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Tu,collisionDetection:o=$c,measuring:s,modifiers:c,...l}=e,[u,d]=(0,v.useReducer)(Pu,void 0,Nu),[f,p]=Lc(),[m,h]=(0,v.useState)(Bu.Uninitialized),g=m===Bu.Initialized,{draggable:{active:_,nodes:b,translate:x},droppable:{containers:S}}=u,C=_==null?null:b.get(_),w=(0,v.useRef)({initial:null,translated:null}),T=(0,v.useMemo)(()=>_==null?null:{id:_,data:C?.data??Eu,rect:w},[_,C]),E=(0,v.useRef)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(null),j=hc(l,Object.values(l)),M=bc(`DndDescribedBy`,t),N=(0,v.useMemo)(()=>S.getEnabled(),[S]),P=Lu(s),{droppableRects:F,measureDroppableContainers:I,measuringScheduled:L}=ou(N,{dragging:g,dependencies:[x.x,x.y],config:P.droppable}),R=tu(b,_),z=(0,v.useMemo)(()=>k?Dc(k):null,[k]),B=Te(),V=cu(R,P.draggable.measure);Ru({activeNode:_==null?null:b.get(_),config:B.layoutShiftCompensation,initialRect:V,measure:P.draggable.measure});let H=fu(R,P.draggable.measure,V),U=fu(R?R.parentElement:null),W=(0,v.useRef)({activatorEvent:null,active:null,activeNode:R,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:b,draggingNode:null,draggingNodeRect:null,droppableContainers:S,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),G=S.getNodeFor(W.current.over?.id),ee=wu({measure:P.dragOverlay.measure}),te=ee.nodeRef.current??R,ne=g?ee.rect??H:null,re=!!(ee.nodeRef.current&&ee.rect),ie=pu(re?null:H),ae=bu(te?sc(te):null),oe=hu(g?G??R:null),se=Su(oe),ce=Iu(c,{transform:{x:x.x-ie.x,y:x.y-ie.y,scaleX:1,scaleY:1},activatorEvent:k,active:T,activeNodeRect:H,containerNodeRect:U,draggingNodeRect:ne,over:W.current.over,overlayNodeRect:ee.rect,scrollableAncestors:oe,scrollableAncestorRects:se,windowRect:ae}),le=z?Sc(z,x):null,ue=gu(oe),de=_u(ue),fe=_u(ue,[H]),pe=Sc(ce,de),me=ne?rl(ne,ce):null,he=T&&me?o({active:T,collisionRect:me,droppableRects:F,droppableContainers:N,pointerCoordinates:le}):null,ge=Yc(he,`id`),[_e,ve]=(0,v.useState)(null),ye=el(re?ce:Sc(ce,fe),_e?.rect??null,H),be=(0,v.useRef)(null),xe=(0,v.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(E.current==null)return;let i=b.get(E.current);if(!i)return;let a=e.nativeEvent;be.current=new n({active:E.current,activeNode:i,event:a,options:r,context:W,onAbort(e){if(!b.get(e))return;let{onDragAbort:t}=j.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!b.get(e))return;let{onDragPending:i}=j.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=E.current;if(t==null)return;let n=b.get(t);if(!n)return;let{onDragStart:r}=j.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:w}};(0,y.unstable_batchedUpdates)(()=>{r?.(i),h(Bu.Initializing),d({type:Vc.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),O(be.current),A(a)})},onMove(e){d({type:Vc.DragMove,coordinates:e})},onEnd:o(Vc.DragEnd),onCancel:o(Vc.DragCancel)});function o(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=W.current,o=null;if(t&&i){let{cancelDrop:s}=j.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===Vc.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=Vc.DragCancel)}E.current=null,(0,y.unstable_batchedUpdates)(()=>{d({type:e}),h(Bu.Uninitialized),ve(null),O(null),A(null),be.current=null;let t=e===Vc.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=j.current[t];e?.(o),f({type:t,event:o})}})}}},[b]),Se=nu(a,(0,v.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=b.get(r);if(E.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},E.current=r,xe(n,t))},[b,xe]));vu(a),fc(()=>{H&&m===Bu.Initializing&&h(Bu.Initialized)},[H,m]),(0,v.useEffect)(()=>{let{onDragMove:e}=j.current,{active:t,activatorEvent:n,collisions:r,over:i}=W.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:pe.x,y:pe.y},over:i};(0,y.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[pe.x,pe.y]),(0,v.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=W.current;if(!e||E.current==null||!t||!i)return;let{onDragOver:a}=j.current,o=r.get(ge),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,y.unstable_batchedUpdates)(()=>{ve(s),a?.(c),f({type:`onDragOver`,event:c})})},[ge]),fc(()=>{W.current={activatorEvent:k,active:T,activeNode:R,collisionRect:me,collisions:he,droppableRects:F,draggableNodes:b,draggingNode:te,draggingNodeRect:ne,droppableContainers:S,over:_e,scrollableAncestors:oe,scrollAdjustedTranslate:pe},w.current={initial:ne,translated:me}},[T,R,he,me,b,te,ne,F,S,_e,oe,pe]),Ql({...B,delta:x,draggingRect:me,pointerCoordinates:le,scrollableAncestors:oe,scrollableAncestorRects:se});let Ce=(0,v.useMemo)(()=>({active:T,activeNode:R,activeNodeRect:H,activatorEvent:k,collisions:he,containerNodeRect:U,dragOverlay:ee,draggableNodes:b,droppableContainers:S,droppableRects:F,over:_e,measureDroppableContainers:I,scrollableAncestors:oe,scrollableAncestorRects:se,measuringConfiguration:P,measuringScheduled:L,windowRect:ae}),[T,R,H,k,he,U,ee,b,S,F,_e,I,oe,se,P,L,ae]),we=(0,v.useMemo)(()=>({activatorEvent:k,activators:Se,active:T,activeNodeRect:H,ariaDescribedById:{draggable:M},dispatch:d,draggableNodes:b,over:_e,measureDroppableContainers:I}),[k,Se,T,H,d,M,b,_e,I]);return v.createElement(Fc.Provider,{value:p},v.createElement(ju.Provider,{value:we},v.createElement(Mu.Provider,{value:Ce},v.createElement(zu.Provider,{value:ye},i)),v.createElement(Fu,{disabled:n?.restoreFocus===!1})),v.createElement(Bc,{...n,hiddenTextDescribedById:M}));function Te(){let e=D?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Hu=(0,v.createContext)(null),Uu=`button`,Wu=`Draggable`;function Gu(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=bc(Wu),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,v.useContext)(ju),{role:p=Uu,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,v.useContext)(g?zu:Hu),[y,b]=_c(),[x,S]=_c(),C=yu(o,t),w=hc(n);return fc(()=>(d.set(t,{id:t,key:a,node:y,activatorNode:x,data:w}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,v.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===Uu?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:C,node:y,over:f,setNodeRef:b,setActivatorNodeRef:S,transform:_}}function Ku(){return(0,v.useContext)(Mu)}var qu=`Droppable`,Ju={timeout:25};function Yu(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=bc(qu),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,v.useContext)(ju),u=(0,v.useRef)({disabled:n}),d=(0,v.useRef)(!1),f=(0,v.useRef)(null),p=(0,v.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...Ju,...i},_=hc(h??r),y=uu({callback:(0,v.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[b,x]=_c((0,v.useCallback)((e,t)=>{y&&(t&&(y.unobserve(t),d.current=!1),e&&y.observe(e))},[y])),S=hc(t);return(0,v.useEffect)(()=>{!y||!b.current||(y.disconnect(),d.current=!1,y.observe(b.current))},[b,y]),(0,v.useEffect)(()=>(s({type:Vc.RegisterDroppable,element:{id:r,key:a,disabled:n,node:b,rect:f,data:S}}),()=>s({type:Vc.UnregisterDroppable,key:a,id:r})),[r]),(0,v.useEffect)(()=>{n!==u.current.disabled&&(s({type:Vc.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:b,over:c,setNodeRef:x}}function Xu(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Zu(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function Qu(e){return e!==null&&e>=0}function $u(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function ed(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var td=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=Xu(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},nd={scaleX:1,scaleY:1},rd=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...nd}:null}let s=id(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...nd}:r<t&&r>=a?{x:0,y:o.height+s,...nd}:{x:0,y:0,...nd}};function id(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var ad=`Sortable`,od=v.createContext({activeIndex:-1,containerId:ad,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:td,disabled:{draggable:!1,droppable:!1}});function sd(e){let{children:t,id:n,items:r,strategy:i=td,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=Ku(),d=bc(ad,n),f=s.rect!==null,p=(0,v.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,v.useRef)(p),y=!$u(p,_.current),b=g!==-1&&h===-1||y,x=ed(a);fc(()=>{y&&m&&u(p)},[y,p,m,u]),(0,v.useEffect)(()=>{_.current=p},[p]);let S=(0,v.useMemo)(()=>({activeIndex:h,containerId:d,disabled:x,disableTransforms:b,items:p,overIndex:g,useDragOverlay:f,sortedRects:Zu(p,c),strategy:i}),[h,d,x.draggable,x.droppable,b,p,g,c,f,i]);return v.createElement(od.Provider,{value:S},t)}var cd=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return Xu(n,r,i).indexOf(t)},ld=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},ud={duration:200,easing:`ease`},dd=`transform`,fd=Oc.Transition.toString({property:dd,duration:0,easing:`linear`}),pd={roleDescription:`sortable`};function md(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,v.useState)(null),s=(0,v.useRef)(n);return fc(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=sl(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,v.useEffect)(()=>{a&&o(null)},[a]),a}function hd(e){let{animateLayoutChanges:t=ld,attributes:n,disabled:r,data:i,getNewIndex:a=cd,id:o,strategy:s,resizeObserverConfig:c,transition:l=ud}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:y}=(0,v.useContext)(od),b=gd(r,p),x=u.indexOf(o),S=(0,v.useMemo)(()=>({sortable:{containerId:d,index:x,items:u},...i}),[d,i,x,u]),C=(0,v.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:w,node:T,isOver:E,setNodeRef:D}=Yu({id:o,data:S,disabled:b.droppable,resizeObserverConfig:{updateMeasurementsFor:C,...c}}),{active:O,activatorEvent:k,activeNodeRect:A,attributes:j,setNodeRef:M,listeners:N,isDragging:P,over:F,setActivatorNodeRef:I,transform:L}=Gu({id:o,data:S,attributes:{...pd,...n},disabled:b.draggable}),R=rc(D,M),z=!!O,B=z&&!m&&Qu(f)&&Qu(g),V=!_&&P,H=B?(V&&B?L:null)??(s??y)({rects:h,activeNodeRect:A,activeIndex:f,overIndex:g,index:x}):null,U=Qu(f)&&Qu(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):x,W=O?.id,G=(0,v.useRef)({activeId:W,items:u,newIndex:U,containerId:d}),ee=u!==G.current.items,te=t({active:O,containerId:d,isDragging:P,isSorting:z,id:o,index:x,items:u,newIndex:G.current.newIndex,previousItems:G.current.items,previousContainerId:G.current.containerId,transition:l,wasDragging:G.current.activeId!=null}),ne=md({disabled:!te,index:x,node:T,rect:w});return(0,v.useEffect)(()=>{z&&G.current.newIndex!==U&&(G.current.newIndex=U),d!==G.current.containerId&&(G.current.containerId=d),u!==G.current.items&&(G.current.items=u)},[z,U,d,u]),(0,v.useEffect)(()=>{if(W===G.current.activeId)return;if(W!=null&&G.current.activeId==null){G.current.activeId=W;return}let e=setTimeout(()=>{G.current.activeId=W},50);return()=>clearTimeout(e)},[W]),{active:O,activeIndex:f,attributes:j,data:S,rect:w,index:x,newIndex:U,items:u,isOver:E,isSorting:z,isDragging:P,listeners:N,node:T,overIndex:g,over:F,setNodeRef:R,setActivatorNodeRef:I,setDroppableNodeRef:D,setDraggableNodeRef:M,transform:ne??H,transition:re()};function re(){if(ne||ee&&G.current.newIndex===x)return fd;if(!(V&&!Tc(k)||!l)&&(z||te))return Oc.Transition.toString({...l,property:dd})}}function gd(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}Il.Down,Il.Right,Il.Up,Il.Left;function _d({className:e}){return(0,K.jsxs)(`svg`,{viewBox:`0 0 64 64`,fill:`currentColor`,className:e,"aria-hidden":`true`,children:[(0,K.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`5.5`,d:`M48.11 22.93a19 19 0 1 1-32.22 0`}),(0,K.jsx)(`circle`,{cx:`32`,cy:`33`,r:`9`})]})}async function vd(){return(await Io(`/api/sidebar-order`)).sidebarOrder}async function yd(e){return(await Io(`/api/sidebar-order`,Lo(`PUT`,e))).sidebarOrder}async function bd(){return(await Io(`/api/provider-availability`)).providers}async function xd(){return Io(`/api/provider-usage`)}async function Sd(){return Io(`/api/server-info`)}async function Cd(){return Io(`/api/services/restart`,Lo(`POST`))}async function wd(){try{return(await fetch(`/api/health`,{cache:`no-store`})).ok}catch{return!1}}async function Td(){return Io(`/api/system-update`)}async function Ed(){return Io(`/api/system-update/check`,Lo(`POST`))}var Dd=class extends Error{status;constructor(e,t){super(e),this.name=`RuntimeUpgradeApplyError`,this.status=t}};async function Od(){let e=await fetch(`/api/system-update/apply`,{cache:`no-store`,...Lo(`POST`)});if(!e.ok){let t=await e.json().catch(()=>({}));throw new Dd(typeof t==`object`&&t&&`error`in t&&typeof t.error==`string`?t.error:`HTTP ${e.status}`,e.status)}return e.json()}var kd=365.2425,Ad=6048e5,jd=864e5,Md=43200,Nd=1440,Pd=3600*24;Pd*7,Pd*kd/12*3;var Fd=Symbol.for(`constructDateFrom`);function Id(e,t){return typeof e==`function`?e(t):e&&typeof e==`object`&&Fd in e?e[Fd](t):e instanceof Date?new e.constructor(t):new Date(t)}function Ld(e,t){return Id(t||e,e)}function Rd(e,t,n){let r=Ld(e,n?.in);return isNaN(t)?Id(n?.in||e,NaN):(t&&r.setDate(r.getDate()+t),r)}var zd={};function Bd(){return zd}function Vd(e,t){let n=Bd(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Ld(e,t?.in),a=i.getDay(),o=(a<r?7:0)+a-r;return i.setDate(i.getDate()-o),i.setHours(0,0,0,0),i}function Hd(e,t){return Vd(e,{...t,weekStartsOn:1})}function Ud(e,t){let n=Ld(e,t?.in),r=n.getFullYear(),i=Id(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);let a=Hd(i),o=Id(n,0);o.setFullYear(r,0,4),o.setHours(0,0,0,0);let s=Hd(o);return n.getTime()>=a.getTime()?r+1:n.getTime()>=s.getTime()?r:r-1}function Wd(e){let t=Ld(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),e-+n}function Gd(e,...t){let n=Id.bind(null,e||t.find(e=>typeof e==`object`));return t.map(n)}function Kd(e,t){let n=Ld(e,t?.in);return n.setHours(0,0,0,0),n}function qd(e,t,n){let[r,i]=Gd(n?.in,e,t),a=Kd(r),o=Kd(i),s=+a-Wd(a),c=+o-Wd(o);return Math.round((s-c)/jd)}function Jd(e,t){let n=Ud(e,t),r=Id(t?.in||e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Hd(r)}function Yd(e,t){let n=Ld(e)-+Ld(t);return n<0?-1:n>0?1:n}function Xd(e){return Id(e,Date.now())}function Zd(e,t,n){let[r,i]=Gd(n?.in,e,t);return+Kd(r)==+Kd(i)}function Qd(e){return e instanceof Date||typeof e==`object`&&Object.prototype.toString.call(e)===`[object Date]`}function $d(e){return!(!Qd(e)&&typeof e!=`number`||isNaN(+Ld(e)))}function ef(e,t,n){let[r,i]=Gd(n?.in,e,t),a=r.getFullYear()-i.getFullYear(),o=r.getMonth()-i.getMonth();return a*12+o}function tf(e){return t=>{let n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function nf(e,t){return Ld(e)-+Ld(t)}function rf(e,t){let n=Ld(e,t?.in);return n.setHours(23,59,59,999),n}function af(e,t){let n=Ld(e,t?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function of(e,t){let n=Ld(e,t?.in);return+rf(n,t)==+af(n,t)}function sf(e,t,n){let[r,i,a]=Gd(n?.in,e,e,t),o=Yd(i,a),s=Math.abs(ef(i,a));if(s<1)return 0;i.getMonth()===1&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-o*s);let c=Yd(i,a)===-o;of(r)&&s===1&&Yd(r,a)===1&&(c=!1);let l=o*(s-+c);return l===0?0:l}function cf(e,t,n){let r=nf(e,t)/1e3;return tf(n?.roundingMethod)(r)}function lf(e,t){let n=Ld(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}var uf={lessThanXSeconds:{one:`less than a second`,other:`less than {{count}} seconds`},xSeconds:{one:`1 second`,other:`{{count}} seconds`},halfAMinute:`half a minute`,lessThanXMinutes:{one:`less than a minute`,other:`less than {{count}} minutes`},xMinutes:{one:`1 minute`,other:`{{count}} minutes`},aboutXHours:{one:`about 1 hour`,other:`about {{count}} hours`},xHours:{one:`1 hour`,other:`{{count}} hours`},xDays:{one:`1 day`,other:`{{count}} days`},aboutXWeeks:{one:`about 1 week`,other:`about {{count}} weeks`},xWeeks:{one:`1 week`,other:`{{count}} weeks`},aboutXMonths:{one:`about 1 month`,other:`about {{count}} months`},xMonths:{one:`1 month`,other:`{{count}} months`},aboutXYears:{one:`about 1 year`,other:`about {{count}} years`},xYears:{one:`1 year`,other:`{{count}} years`},overXYears:{one:`over 1 year`,other:`over {{count}} years`},almostXYears:{one:`almost 1 year`,other:`almost {{count}} years`}},df=(e,t,n)=>{let r,i=uf[e];return r=typeof i==`string`?i:t===1?i.one:i.other.replace(`{{count}}`,t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?`in `+r:r+` ago`:r};function ff(e){return(t={})=>{let n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}var pf={date:ff({formats:{full:`EEEE, MMMM do, y`,long:`MMMM do, y`,medium:`MMM d, y`,short:`MM/dd/yyyy`},defaultWidth:`full`}),time:ff({formats:{full:`h:mm:ss a zzzz`,long:`h:mm:ss a z`,medium:`h:mm:ss a`,short:`h:mm a`},defaultWidth:`full`}),dateTime:ff({formats:{full:`{{date}} 'at' {{time}}`,long:`{{date}} 'at' {{time}}`,medium:`{{date}}, {{time}}`,short:`{{date}}, {{time}}`},defaultWidth:`full`})},mf={lastWeek:`'last' eeee 'at' p`,yesterday:`'yesterday at' p`,today:`'today at' p`,tomorrow:`'tomorrow at' p`,nextWeek:`eeee 'at' p`,other:`P`},hf=(e,t,n,r)=>mf[e];function gf(e){return(t,n)=>{let r=n?.context?String(n.context):`standalone`,i;if(r===`formatting`&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,r=n?.width?String(n.width):t;i=e.formattingValues[r]||e.formattingValues[t]}else{let t=e.defaultWidth,r=n?.width?String(n.width):e.defaultWidth;i=e.values[r]||e.values[t]}let a=e.argumentCallback?e.argumentCallback(t):t;return i[a]}}var _f={ordinalNumber:(e,t)=>{let n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+`st`;case 2:return n+`nd`;case 3:return n+`rd`}return n+`th`},era:gf({values:{narrow:[`B`,`A`],abbreviated:[`BC`,`AD`],wide:[`Before Christ`,`Anno Domini`]},defaultWidth:`wide`}),quarter:gf({values:{narrow:[`1`,`2`,`3`,`4`],abbreviated:[`Q1`,`Q2`,`Q3`,`Q4`],wide:[`1st quarter`,`2nd quarter`,`3rd quarter`,`4th quarter`]},defaultWidth:`wide`,argumentCallback:e=>e-1}),month:gf({values:{narrow:[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],abbreviated:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],wide:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`]},defaultWidth:`wide`}),day:gf({values:{narrow:[`S`,`M`,`T`,`W`,`T`,`F`,`S`],short:[`Su`,`Mo`,`Tu`,`We`,`Th`,`Fr`,`Sa`],abbreviated:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],wide:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]},defaultWidth:`wide`}),dayPeriod:gf({values:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`}},defaultWidth:`wide`,formattingValues:{narrow:{am:`a`,pm:`p`,midnight:`mi`,noon:`n`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},abbreviated:{am:`AM`,pm:`PM`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`},wide:{am:`a.m.`,pm:`p.m.`,midnight:`midnight`,noon:`noon`,morning:`in the morning`,afternoon:`in the afternoon`,evening:`in the evening`,night:`at night`}},defaultFormattingWidth:`wide`})};function vf(e){return(t,n={})=>{let r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;let o=a[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(s)?bf(s,e=>e.test(o)):yf(s,e=>e.test(o)),l;l=e.valueCallback?e.valueCallback(c):c,l=n.valueCallback?n.valueCallback(l):l;let u=t.slice(o.length);return{value:l,rest:u}}}function yf(e,t){for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function bf(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function xf(e){return(t,n={})=>{let r=t.match(e.matchPattern);if(!r)return null;let i=r[0],a=t.match(e.parsePattern);if(!a)return null;let o=e.valueCallback?e.valueCallback(a[0]):a[0];o=n.valueCallback?n.valueCallback(o):o;let s=t.slice(i.length);return{value:o,rest:s}}}var Sf={code:`en-US`,formatDistance:df,formatLong:pf,formatRelative:hf,localize:_f,match:{ordinalNumber:xf({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:vf({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:`any`}),quarter:vf({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:`wide`,parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:`any`,valueCallback:e=>e+1}),month:vf({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:`any`}),day:vf({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:`wide`,parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:`any`}),dayPeriod:vf({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:`any`,parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:`any`})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function Cf(e,t){let n=Ld(e,t?.in);return qd(n,lf(n))+1}function wf(e,t){let n=Ld(e,t?.in),r=Hd(n)-+Jd(n);return Math.round(r/Ad)+1}function Tf(e,t){let n=Ld(e,t?.in),r=n.getFullYear(),i=Bd(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,o=Id(t?.in||e,0);o.setFullYear(r+1,0,a),o.setHours(0,0,0,0);let s=Vd(o,t),c=Id(t?.in||e,0);c.setFullYear(r,0,a),c.setHours(0,0,0,0);let l=Vd(c,t);return+n>=+s?r+1:+n>=+l?r:r-1}function Ef(e,t){let n=Bd(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Tf(e,t),a=Id(t?.in||e,0);return a.setFullYear(i,0,r),a.setHours(0,0,0,0),Vd(a,t)}function Df(e,t){let n=Ld(e,t?.in),r=Vd(n,t)-+Ef(n,t);return Math.round(r/Ad)+1}function Of(e,t){return(e<0?`-`:``)+Math.abs(e).toString().padStart(t,`0`)}var kf={y(e,t){let n=e.getFullYear(),r=n>0?n:1-n;return Of(t===`yy`?r%100:r,t.length)},M(e,t){let n=e.getMonth();return t===`M`?String(n+1):Of(n+1,2)},d(e,t){return Of(e.getDate(),t.length)},a(e,t){let n=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.toUpperCase();case`aaa`:return n;case`aaaaa`:return n[0];default:return n===`am`?`a.m.`:`p.m.`}},h(e,t){return Of(e.getHours()%12||12,t.length)},H(e,t){return Of(e.getHours(),t.length)},m(e,t){return Of(e.getMinutes(),t.length)},s(e,t){return Of(e.getSeconds(),t.length)},S(e,t){let n=t.length,r=e.getMilliseconds();return Of(Math.trunc(r*10**(n-3)),t.length)}},Af={am:`am`,pm:`pm`,midnight:`midnight`,noon:`noon`,morning:`morning`,afternoon:`afternoon`,evening:`evening`,night:`night`},jf={G:function(e,t,n){let r=+(e.getFullYear()>0);switch(t){case`G`:case`GG`:case`GGG`:return n.era(r,{width:`abbreviated`});case`GGGGG`:return n.era(r,{width:`narrow`});default:return n.era(r,{width:`wide`})}},y:function(e,t,n){if(t===`yo`){let t=e.getFullYear(),r=t>0?t:1-t;return n.ordinalNumber(r,{unit:`year`})}return kf.y(e,t)},Y:function(e,t,n,r){let i=Tf(e,r),a=i>0?i:1-i;return t===`YY`?Of(a%100,2):t===`Yo`?n.ordinalNumber(a,{unit:`year`}):Of(a,t.length)},R:function(e,t){return Of(Ud(e),t.length)},u:function(e,t){return Of(e.getFullYear(),t.length)},Q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`Q`:return String(r);case`QQ`:return Of(r,2);case`Qo`:return n.ordinalNumber(r,{unit:`quarter`});case`QQQ`:return n.quarter(r,{width:`abbreviated`,context:`formatting`});case`QQQQQ`:return n.quarter(r,{width:`narrow`,context:`formatting`});default:return n.quarter(r,{width:`wide`,context:`formatting`})}},q:function(e,t,n){let r=Math.ceil((e.getMonth()+1)/3);switch(t){case`q`:return String(r);case`qq`:return Of(r,2);case`qo`:return n.ordinalNumber(r,{unit:`quarter`});case`qqq`:return n.quarter(r,{width:`abbreviated`,context:`standalone`});case`qqqqq`:return n.quarter(r,{width:`narrow`,context:`standalone`});default:return n.quarter(r,{width:`wide`,context:`standalone`})}},M:function(e,t,n){let r=e.getMonth();switch(t){case`M`:case`MM`:return kf.M(e,t);case`Mo`:return n.ordinalNumber(r+1,{unit:`month`});case`MMM`:return n.month(r,{width:`abbreviated`,context:`formatting`});case`MMMMM`:return n.month(r,{width:`narrow`,context:`formatting`});default:return n.month(r,{width:`wide`,context:`formatting`})}},L:function(e,t,n){let r=e.getMonth();switch(t){case`L`:return String(r+1);case`LL`:return Of(r+1,2);case`Lo`:return n.ordinalNumber(r+1,{unit:`month`});case`LLL`:return n.month(r,{width:`abbreviated`,context:`standalone`});case`LLLLL`:return n.month(r,{width:`narrow`,context:`standalone`});default:return n.month(r,{width:`wide`,context:`standalone`})}},w:function(e,t,n,r){let i=Df(e,r);return t===`wo`?n.ordinalNumber(i,{unit:`week`}):Of(i,t.length)},I:function(e,t,n){let r=wf(e);return t===`Io`?n.ordinalNumber(r,{unit:`week`}):Of(r,t.length)},d:function(e,t,n){return t===`do`?n.ordinalNumber(e.getDate(),{unit:`date`}):kf.d(e,t)},D:function(e,t,n){let r=Cf(e);return t===`Do`?n.ordinalNumber(r,{unit:`dayOfYear`}):Of(r,t.length)},E:function(e,t,n){let r=e.getDay();switch(t){case`E`:case`EE`:case`EEE`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`EEEEE`:return n.day(r,{width:`narrow`,context:`formatting`});case`EEEEEE`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},e:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`e`:return String(a);case`ee`:return Of(a,2);case`eo`:return n.ordinalNumber(a,{unit:`day`});case`eee`:return n.day(i,{width:`abbreviated`,context:`formatting`});case`eeeee`:return n.day(i,{width:`narrow`,context:`formatting`});case`eeeeee`:return n.day(i,{width:`short`,context:`formatting`});default:return n.day(i,{width:`wide`,context:`formatting`})}},c:function(e,t,n,r){let i=e.getDay(),a=(i-r.weekStartsOn+8)%7||7;switch(t){case`c`:return String(a);case`cc`:return Of(a,t.length);case`co`:return n.ordinalNumber(a,{unit:`day`});case`ccc`:return n.day(i,{width:`abbreviated`,context:`standalone`});case`ccccc`:return n.day(i,{width:`narrow`,context:`standalone`});case`cccccc`:return n.day(i,{width:`short`,context:`standalone`});default:return n.day(i,{width:`wide`,context:`standalone`})}},i:function(e,t,n){let r=e.getDay(),i=r===0?7:r;switch(t){case`i`:return String(i);case`ii`:return Of(i,t.length);case`io`:return n.ordinalNumber(i,{unit:`day`});case`iii`:return n.day(r,{width:`abbreviated`,context:`formatting`});case`iiiii`:return n.day(r,{width:`narrow`,context:`formatting`});case`iiiiii`:return n.day(r,{width:`short`,context:`formatting`});default:return n.day(r,{width:`wide`,context:`formatting`})}},a:function(e,t,n){let r=e.getHours()/12>=1?`pm`:`am`;switch(t){case`a`:case`aa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`});case`aaa`:return n.dayPeriod(r,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`aaaaa`:return n.dayPeriod(r,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(r,{width:`wide`,context:`formatting`})}},b:function(e,t,n){let r=e.getHours(),i;switch(i=r===12?Af.noon:r===0?Af.midnight:r/12>=1?`pm`:`am`,t){case`b`:case`bb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`bbb`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`}).toLowerCase();case`bbbbb`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},B:function(e,t,n){let r=e.getHours(),i;switch(i=r>=17?Af.evening:r>=12?Af.afternoon:r>=4?Af.morning:Af.night,t){case`B`:case`BB`:case`BBB`:return n.dayPeriod(i,{width:`abbreviated`,context:`formatting`});case`BBBBB`:return n.dayPeriod(i,{width:`narrow`,context:`formatting`});default:return n.dayPeriod(i,{width:`wide`,context:`formatting`})}},h:function(e,t,n){if(t===`ho`){let t=e.getHours()%12;return t===0&&(t=12),n.ordinalNumber(t,{unit:`hour`})}return kf.h(e,t)},H:function(e,t,n){return t===`Ho`?n.ordinalNumber(e.getHours(),{unit:`hour`}):kf.H(e,t)},K:function(e,t,n){let r=e.getHours()%12;return t===`Ko`?n.ordinalNumber(r,{unit:`hour`}):Of(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t===`ko`?n.ordinalNumber(r,{unit:`hour`}):Of(r,t.length)},m:function(e,t,n){return t===`mo`?n.ordinalNumber(e.getMinutes(),{unit:`minute`}):kf.m(e,t)},s:function(e,t,n){return t===`so`?n.ordinalNumber(e.getSeconds(),{unit:`second`}):kf.s(e,t)},S:function(e,t){return kf.S(e,t)},X:function(e,t,n){let r=e.getTimezoneOffset();if(r===0)return`Z`;switch(t){case`X`:return Nf(r);case`XXXX`:case`XX`:return Pf(r);default:return Pf(r,`:`)}},x:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`x`:return Nf(r);case`xxxx`:case`xx`:return Pf(r);default:return Pf(r,`:`)}},O:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`O`:case`OO`:case`OOO`:return`GMT`+Mf(r,`:`);default:return`GMT`+Pf(r,`:`)}},z:function(e,t,n){let r=e.getTimezoneOffset();switch(t){case`z`:case`zz`:case`zzz`:return`GMT`+Mf(r,`:`);default:return`GMT`+Pf(r,`:`)}},t:function(e,t,n){return Of(Math.trunc(e/1e3),t.length)},T:function(e,t,n){return Of(+e,t.length)}};function Mf(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Math.trunc(r/60),a=r%60;return a===0?n+String(i):n+String(i)+t+Of(a,2)}function Nf(e,t){return e%60==0?(e>0?`-`:`+`)+Of(Math.abs(e)/60,2):Pf(e,t)}function Pf(e,t=``){let n=e>0?`-`:`+`,r=Math.abs(e),i=Of(Math.trunc(r/60),2),a=Of(r%60,2);return n+i+t+a}var Ff=(e,t)=>{switch(e){case`P`:return t.date({width:`short`});case`PP`:return t.date({width:`medium`});case`PPP`:return t.date({width:`long`});default:return t.date({width:`full`})}},If=(e,t)=>{switch(e){case`p`:return t.time({width:`short`});case`pp`:return t.time({width:`medium`});case`ppp`:return t.time({width:`long`});default:return t.time({width:`full`})}},Lf={p:If,P:(e,t)=>{let n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return Ff(e,t);let a;switch(r){case`P`:a=t.dateTime({width:`short`});break;case`PP`:a=t.dateTime({width:`medium`});break;case`PPP`:a=t.dateTime({width:`long`});break;default:a=t.dateTime({width:`full`});break}return a.replace(`{{date}}`,Ff(r,t)).replace(`{{time}}`,If(i,t))}},Rf=/^D+$/,zf=/^Y+$/,Bf=[`D`,`DD`,`YY`,`YYYY`];function Vf(e){return Rf.test(e)}function Hf(e){return zf.test(e)}function Uf(e,t,n){let r=Wf(e,t,n);if(console.warn(r),Bf.includes(e))throw RangeError(r)}function Wf(e,t,n){let r=e[0]===`Y`?`years`:`days of the month`;return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}var Gf=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Kf=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,qf=/^'([^]*?)'?$/,Jf=/''/g,Yf=/[a-zA-Z]/;function Xf(e,t,n){let r=Bd(),i=n?.locale??r.locale??Sf,a=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,o=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,s=Ld(e,n?.in);if(!$d(s))throw RangeError(`Invalid time value`);let c=t.match(Kf).map(e=>{let t=e[0];if(t===`p`||t===`P`){let n=Lf[t];return n(e,i.formatLong)}return e}).join(``).match(Gf).map(e=>{if(e===`''`)return{isToken:!1,value:`'`};let t=e[0];if(t===`'`)return{isToken:!1,value:Zf(e)};if(jf[t])return{isToken:!0,value:e};if(t.match(Yf))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(c=i.localize.preprocessor(s,c));let l={firstWeekContainsDate:a,weekStartsOn:o,locale:i};return c.map(r=>{if(!r.isToken)return r.value;let a=r.value;(!n?.useAdditionalWeekYearTokens&&Hf(a)||!n?.useAdditionalDayOfYearTokens&&Vf(a))&&Uf(a,t,String(e));let o=jf[a[0]];return o(s,a,i.localize,l)}).join(``)}function Zf(e){let t=e.match(qf);return t?t[1].replace(Jf,`'`):e}function Qf(e,t,n){let r=Bd(),i=n?.locale??r.locale??Sf,a=Yd(e,t);if(isNaN(a))throw RangeError(`Invalid time value`);let o=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:a}),[s,c]=Gd(n?.in,...a>0?[t,e]:[e,t]),l=cf(c,s),u=(Wd(c)-Wd(s))/1e3,d=Math.round((l-u)/60),f;if(d<2)return n?.includeSeconds?l<5?i.formatDistance(`lessThanXSeconds`,5,o):l<10?i.formatDistance(`lessThanXSeconds`,10,o):l<20?i.formatDistance(`lessThanXSeconds`,20,o):l<40?i.formatDistance(`halfAMinute`,0,o):l<60?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,1,o):d===0?i.formatDistance(`lessThanXMinutes`,1,o):i.formatDistance(`xMinutes`,d,o);if(d<45)return i.formatDistance(`xMinutes`,d,o);if(d<90)return i.formatDistance(`aboutXHours`,1,o);if(d<1440){let e=Math.round(d/60);return i.formatDistance(`aboutXHours`,e,o)}else if(d<2520)return i.formatDistance(`xDays`,1,o);else if(d<43200){let e=Math.round(d/Nd);return i.formatDistance(`xDays`,e,o)}else if(d<43200*2)return f=Math.round(d/Md),i.formatDistance(`aboutXMonths`,f,o);if(f=sf(c,s),f<12){let e=Math.round(d/Md);return i.formatDistance(`xMonths`,e,o)}else{let e=f%12,t=Math.trunc(f/12);return e<3?i.formatDistance(`aboutXYears`,t,o):e<9?i.formatDistance(`overXYears`,t,o):i.formatDistance(`almostXYears`,t+1,o)}}function $f(e,t){return Zd(Id(t?.in||e,e),Xd(t?.in||e))}function ep(e,t,n){return Rd(e,-t,n)}function tp(e,t){return Zd(Id(t?.in||e,e),ep(Xd(t?.in||e),1))}function np(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function rp(e){return e<1e3?String(e):e<999500?`${Math.round(e/1e3)}k`:`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`}function ip(e){return Xf(new Date(e),`HH:mm`)}function ap(e){return Xf(new Date(e),`yyyy-MM-dd`)}function op(e){let t=new Date(e);return $f(t)?`Today`:tp(t)?`Yesterday`:Xf(t,`EEEE, MMMM d`)}function sp(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=Xf(t,`HH:mm`);if($f(t))return n;let r=new Date;return r.setDate(r.getDate()+1),t.toDateString()===r.toDateString()?`tomorrow ${n}`:`${Xf(t,`MMM d`)} ${n}`}function cp(e,t){let n=t.getTime()-new Date(e).getTime();if(!Number.isFinite(n)||n<0)return`—`;let r=Math.floor(n/6e4);if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h ${r%60}m`:`${Math.floor(i/24)}d ${i%24}h`}function lp(e,t){let n=new Date(e);return!Number.isFinite(n.getTime())||n>t?`—`:Qf(n,t,{addSuffix:!0})}function up(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}):`—`}function dp(e,t){if(!e)return`—`;let n=new Date(e).getTime()-t.getTime(),r=Math.abs(n)/6e4,i=n>=0;if(r<1)return i?`soon`:`just now`;if(r<60){let e=Math.round(r);return i?`in ${e} min`:`${e} min ago`}let a=r/60;if(a<24){let e=Math.round(a);return i?`in ${e} hr`:`${e} hr ago`}let o=a/24,s=Math.round(o);return s<14?i?`in ${s} d`:`${s} d ago`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function fp(e=6e4){let[t,n]=(0,v.useState)(()=>new Date);return(0,v.useEffect)(()=>{let t=setInterval(()=>n(new Date),e);return()=>clearInterval(t)},[e]),t}function pp(e){return e.length===1?e[0]??`An agent`:`${e.length} agents`}function mp({kind:e,runningNames:t,target:n,onCancel:r,onConfirm:i}){(0,v.useEffect)(()=>{function e(e){e.key===`Escape`&&r()}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r]);let a=t.length,o=pp(t);return(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-page/70 p-4 backdrop-blur-sm`,onClick:r,role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":`busy-confirm-title`,className:`relative w-full max-w-xl rounded-sm border border-accent/40 bg-surface p-7 pl-8 shadow-deep`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-4 bottom-4 w-px bg-accent`}),(0,K.jsx)(`div`,{id:`busy-confirm-title`,className:`font-serif text-[17px] font-semibold text-text`,children:e===`upgrade`?`Update & restart now?`:`Restart now?`}),(0,K.jsxs)(`div`,{className:`font-serif mt-2 text-[15px] leading-relaxed text-text-muted`,children:[o,` `,a===1?`is`:`are`,` working. Their work is saved — after the `,e===`upgrade`?`update`:`restart`,` they'll continue right where they left off. Nothing is lost.`]}),e===`upgrade`&&n&&(0,K.jsxs)(`div`,{className:`mt-2.5 font-sans text-[12px] text-text-muted`,children:[`Installs `,(0,K.jsx)(`span`,{className:`font-mono text-[12px] text-text`,children:n}),` and restarts.`]}),(0,K.jsxs)(`div`,{className:`mt-5 flex gap-2`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-1.5 rounded-sm bg-accent px-3.5 py-2 text-[13px] font-medium text-white transition-colors hover:bg-accent/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface`,children:[(0,K.jsx)(e===`upgrade`?zs:Xs,{"aria-hidden":!0,className:`h-3.5 w-3.5`}),e===`upgrade`?`Update & restart`:`Restart now`]}),(0,K.jsx)(`button`,{type:`button`,onClick:r,className:`rounded-sm border border-border-soft px-3.5 py-2 text-[13px] text-text-muted transition-colors hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:`Cancel`})]})]})}),document.body)}var hp=6e4;function gp(e){if(!e?.completedAt||e.status===`blocked`)return null;let t=Date.parse(e.completedAt);return!Number.isFinite(t)||Date.now()-t>6e4?null:e.mode===`drain-active`&&!e.fallbackToIdle&&(e.resumedCount??0)>0?{kind:`resumed`,count:e.resumedCount??0}:{kind:`restarted`}}function _p(e){return`${e} agent${e===1?``:`s`} resumed`}var vp=6e3,yp=`restart-echo-ack`;function bp(){let{data:e}=jo({queryKey:Po.serverInfo(),queryFn:Sd,staleTime:6e4}),t=e?.lastRestart?.completedAt,n=(0,v.useMemo)(()=>gp(e?.lastRestart),[t]),[r,i]=(0,v.useState)(!1),a=(0,v.useRef)(null);(0,v.useEffect)(()=>{if(!n||!t||a.current===t)return;a.current=t;try{if(sessionStorage.getItem(yp)===t)return}catch{}setTimeout(()=>i(!0),0);let e=hp-(Date.now()-Date.parse(t)),r=setTimeout(()=>{i(!1);try{sessionStorage.setItem(yp,t)}catch{}},Math.max(1500,Math.min(vp,e)));return()=>clearTimeout(r)},[n,t]);function o(){if(i(!1),t)try{sessionStorage.setItem(yp,t)}catch{}}if(!r||!n)return null;let s=n.kind===`resumed`?_p(n.count):`Services restarted`;return(0,y.createPortal)((0,K.jsx)(`div`,{className:`pointer-events-none fixed bottom-4 left-4 z-[70]`,style:{paddingBottom:`env(safe-area-inset-bottom)`},children:(0,K.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-auto flex items-center gap-2 rounded-sm border border-border-soft bg-surface px-3.5 py-2.5 shadow-deep`,children:[(0,K.jsx)(Ns,{"aria-hidden":!0,className:`h-3.5 w-3.5 shrink-0 text-health-ok`}),(0,K.jsx)(`span`,{className:`font-serif text-[13px] text-text`,children:s}),(0,K.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Dismiss`,className:`ml-1 flex h-5 w-5 items-center justify-center rounded-sm text-text-muted transition-colors hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:(0,K.jsx)(nc,{"aria-hidden":!0,className:`h-3 w-3`})})]})}),document.body)}var xp=3e4,Sp=1e3;function Cp({compact:e=!1}){let[t,n]=(0,v.useState)(`idle`),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),s=(0,v.useRef)(0),{data:c=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:l=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o}),u=wp(c,l);function d(){t===`idle`&&(u.length>0?i(!0):f())}async function f(){i(!1),o(null);try{await Cd(),s.current=Date.now(),n(`restarting`)}catch(e){o(e instanceof Error?e.message:String(e)),n(`failed`)}}return(0,v.useEffect)(()=>{if(t!==`restarting`)return;let e=!1,r=null;async function i(){if(Date.now()-s.current>xp){o(`Restart timed out after 30s. Check logs.`),n(`failed`);return}if(!await wd())e=!0;else if(e){n(`recovered`),window.location.reload();return}r=setTimeout(i,Sp)}return r=setTimeout(i,Sp),()=>{r&&clearTimeout(r)}},[t]),(0,K.jsxs)(K.Fragment,{children:[e?(0,K.jsxs)(`button`,{onClick:d,disabled:t===`restarting`,className:[`flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-[11px] transition-colors`,t===`restarting`?`cursor-wait text-text-subtle`:`cursor-pointer border border-border-soft/60 text-text-muted hover:border-border-soft hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`].join(` `),title:t===`failed`&&a?a:`Restart Anima services`,children:[(0,K.jsx)(Xs,{className:`h-2.5 w-2.5 ${t===`restarting`?`animate-spin`:``}`}),(0,K.jsx)(`span`,{children:t===`restarting`?`Restarting…`:`Restart`})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`button`,{onClick:d,disabled:t===`restarting`,className:[`chrome flex w-full items-center gap-2 rounded-sm px-2.5 py-1.5 text-left text-[11px] uppercase tracking-[0.1em] transition-colors`,t===`restarting`?`cursor-wait text-text-on-spine-subtle`:`cursor-pointer text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`].join(` `),title:`Restart Anima services`,children:[(0,K.jsx)(Xs,{className:`h-3.5 w-3.5 ${t===`restarting`?`animate-spin`:``}`}),(0,K.jsx)(`span`,{children:t===`restarting`?`Restarting…`:`Restart services`})]}),t===`failed`&&a&&(0,K.jsx)(`div`,{className:`mt-1 px-2 text-[11px] text-health-error`,children:a})]}),r&&(0,K.jsx)(mp,{kind:`restart`,runningNames:u,onCancel:()=>i(!1),onConfirm:()=>void f()}),t===`restarting`&&(0,K.jsx)(Tp,{})]})}function wp(e,t){let n=new Map(e.map(e=>[e.id,e.profile?.displayName??e.id])),r=[];for(let e of t)e.currentItemId&&r.push(n.get(e.agentId)??e.agentId);return r}function Tp(){return(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 rounded-sm border border-border-soft bg-surface px-10 py-7 text-center shadow-deep`,children:[(0,K.jsx)(Xs,{className:`h-6 w-6 animate-spin text-accent`}),(0,K.jsx)(`div`,{className:`font-serif text-[16px] font-medium text-text`,children:`Restarting Anima services…`}),(0,K.jsx)(`div`,{className:`font-sans text-[12px] leading-relaxed text-text-muted`,children:`Any working agents pause at a safe point and resume right where they left off. The web app reloads automatically when services are back.`})]})}),document.body)}var Ep=5*6e4,Dp=3e3;function Op(){return jo({queryKey:Po.runtimeUpgrade(),queryFn:Td,staleTime:6e4,refetchInterval:e=>{let t=e.state.data?.operation.status;return t===`scheduled`||t===`running`?Dp:Ep}})}function kp(){let{data:e}=Op();return e?.state===`available`}var Ap=3e5,jp=1500,Mp=60*6e4;function Np(){let{data:e,isLoading:t}=Op(),{data:n=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),[r,i]=(0,v.useState)(`idle`),[a,o]=(0,v.useState)(null),s=Mo({mutationFn:Ed,onSuccess:e=>{No.setQueryData(Po.runtimeUpgrade(),e)}});async function c(){o(null);try{await Od(),i(`applying`)}catch(e){i(`idle`),e instanceof Dd&&e.status===409?o(`An agent started working — try again once idle.`):e instanceof Dd&&e.status===503?o(`Update is unavailable right now.`):o(e instanceof Error?e.message:`Upgrade failed to start.`)}}if((0,v.useEffect)(()=>{if(r!==`applying`)return;let e=!1,t=!1,n=Date.now(),a=null;async function o(){if(!t){if(Date.now()-n>Ap){window.location.reload();return}try{let n=await Td();if(t)return;if(e){window.location.reload();return}if(n.operation.status===`failed`){i(`idle`),No.invalidateQueries({queryKey:Po.runtimeUpgrade()});return}}catch{e=!0}a=setTimeout(o,jp)}}return a=setTimeout(o,jp),()=>{t=!0,a&&clearTimeout(a)}},[r]),t&&!e)return(0,K.jsxs)(Lp,{children:[(0,K.jsx)(Xs,{"aria-hidden":!0,className:`h-3 w-3 animate-spin text-text-subtle`}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text-muted`,children:`Checking for updates…`})]});if(!e)return null;let l=e.operation.status,u=e.operation.targetVersion??e.latestOnTrack,d=r===`applying`||l===`scheduled`||l===`running`,f=e.operation.completedAt,p=l===`failed`&&Wp(f),m=s.isError,h=d?void 0:(0,K.jsx)(Rp,{checking:s.isPending,onCheck:()=>s.mutate()}),g=Hp(e.gate.blockers,n),_=gp(Up(e.operation)),y=_?.kind===`resumed`?_.count:null;function b(){g.length>0?i(`confirming`):c()}let x;return x=d?(0,K.jsxs)(Lp,{children:[(0,K.jsx)(Xs,{"aria-hidden":!0,className:`h-3 w-3 animate-spin text-accent`}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:u?`Updating to ${u}…`:`Updating…`})]}):p?(0,K.jsx)(Fp,{currentVersion:e.currentVersion,error:e.operation.error,rollback:e.operation.rollback,logPath:e.operation.logPath,onRetry:b}):e.state===`error`?(0,K.jsxs)(Lp,{action:h,children:[(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text-muted`,title:e.checkError?.message,children:`Update check unavailable`}),m&&(0,K.jsx)(zp,{})]}):e.state===`available`&&u?(0,K.jsx)(Pp,{currentVersion:e.currentVersion,target:u,error:a,onUpgrade:b,action:h,checkFailed:m}):(0,K.jsxs)(Lp,{action:h,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-health-ok`}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:`Up to date`}),y!==null&&(0,K.jsxs)(`span`,{className:`font-sans text-[11px] text-text-subtle`,children:[`· `,_p(y)]}),m&&(0,K.jsx)(zp,{})]}),(0,K.jsxs)(K.Fragment,{children:[x,r===`confirming`&&u&&(0,K.jsx)(mp,{kind:`upgrade`,runningNames:g,target:u,onCancel:()=>i(`idle`),onConfirm:()=>void c()}),r===`applying`&&(0,K.jsx)(Bp,{target:u})]})}function Pp({currentVersion:e,target:t,error:n,onUpgrade:r,action:i,checkFailed:a}){let o=Vp(e,t);return(0,K.jsxs)(`div`,{className:`rounded-sm border border-accent/30 bg-accent/[0.06] p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 shrink-0 rounded-full bg-accent`}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] font-medium text-text`,children:`Update available`})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[!o&&(0,K.jsx)(Ip,{from:e,to:t}),i]})]}),o&&(0,K.jsx)(`div`,{className:`mt-1.5`,children:(0,K.jsx)(Ip,{from:e,to:t,stacked:!0})}),(0,K.jsxs)(`div`,{className:`mt-2.5`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-center gap-1.5 rounded-sm bg-accent px-3 py-1.5 text-[12px] font-medium text-white transition-colors hover:bg-accent/90 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-offset-1 focus-visible:ring-offset-page`,children:[(0,K.jsx)(zs,{"aria-hidden":!0,className:`h-3 w-3`}),`Upgrade & restart`]}),n&&(0,K.jsx)(`p`,{className:`mt-1.5 font-sans text-[11px] text-health-error`,children:n}),a&&(0,K.jsx)(`p`,{className:`mt-1.5 font-sans text-[11px] text-text-subtle`,children:`Check failed — showing last known.`})]})]})}function Fp({currentVersion:e,error:t,rollback:n,logPath:r,onRetry:i}){return(0,K.jsxs)(`div`,{className:`rounded-sm border border-health-error/40 bg-health-error/[0.06] p-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(ec,{"aria-hidden":!0,className:`mt-0.5 h-3.5 w-3.5 shrink-0 text-health-error`}),n===`failed`?(0,K.jsx)(`span`,{className:`font-serif text-[14px] font-medium text-text`,children:`Update failed and rollback didn't complete — the runtime may need attention.`}):(0,K.jsxs)(`span`,{className:`font-serif text-[14px] font-medium text-text`,children:[`Update failed — still on`,` `,(0,K.jsx)(`span`,{className:`font-mono text-[12px] text-text-muted`,children:e}),(0,K.jsxs)(`span`,{className:`font-sans text-[12px] font-normal text-text-subtle`,children:[` `,`· nothing else changed`]})]})]}),t&&(0,K.jsx)(`p`,{className:`mt-1.5 break-words font-mono text-[10px] leading-relaxed text-text-subtle`,children:t}),r&&(0,K.jsxs)(`p`,{className:`mt-1 break-all font-mono text-[10px] leading-relaxed text-text-subtle opacity-70`,children:[`log: `,r]}),(0,K.jsx)(`div`,{className:`mt-2.5`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-1.5 rounded-sm border border-border-soft px-2.5 py-1 text-[12px] text-text-muted transition-colors hover:border-border-soft hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[(0,K.jsx)(Xs,{"aria-hidden":!0,className:`h-3 w-3`}),`Try again`]})})]})}function Ip({from:e,to:t,stacked:n=!1}){return n?(0,K.jsxs)(`div`,{className:`font-mono text-[11px] leading-snug`,children:[(0,K.jsx)(`div`,{className:`break-all text-text-subtle`,children:e}),(0,K.jsxs)(`div`,{className:`break-all text-text`,children:[(0,K.jsx)(`span`,{className:`text-text-subtle`,children:`→`}),` `,t]})]}):(0,K.jsxs)(`span`,{className:`shrink-0 whitespace-nowrap font-mono text-[12px] text-text-muted`,children:[e,` `,(0,K.jsx)(`span`,{className:`text-text-subtle`,children:`→`}),` `,t]})}function Lp({children:e,action:t}){return(0,K.jsxs)(`div`,{className:`group/update-row flex items-center gap-3`,children:[(0,K.jsx)(`span`,{className:`w-14 shrink-0 font-sans text-[11px] text-text-subtle`,children:`Update`}),(0,K.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-2 gap-y-0.5`,children:e}),t]})}function Rp({checking:e,onCheck:t}){return(0,K.jsx)(`button`,{type:`button`,onClick:t,disabled:e,"aria-label":e?`Checking for updates`:`Check for updates`,title:e?`Checking for updates…`:`Check for updates`,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-text-subtle opacity-40 transition hover:bg-surface-elevated hover:text-text hover:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent disabled:cursor-default disabled:opacity-70 group-hover/update-row:opacity-100`,children:(0,K.jsx)(Xs,{"aria-hidden":!0,className:`h-3.5 w-3.5 ${e?`animate-spin`:``}`})})}function zp(){return(0,K.jsx)(`span`,{className:`font-sans text-[11px] text-text-subtle`,children:`Check failed — showing last known.`})}function Bp({target:e}){return(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-[60] flex items-center justify-center bg-page/70 p-4 backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`flex max-w-sm flex-col items-center gap-3 rounded-sm border border-border-soft bg-surface px-10 py-7 text-center shadow-deep`,children:[(0,K.jsx)(Xs,{className:`h-6 w-6 animate-spin text-accent`}),(0,K.jsx)(`div`,{className:`font-serif text-[16px] font-medium text-text`,children:e?`Installing ${e}…`:`Installing update…`}),(0,K.jsx)(`div`,{className:`font-sans text-[12px] leading-relaxed text-text-muted`,children:`Your current version keeps running while Anima installs and verifies the new one, then restarts at a safe point so any working agents resume right where they left off. The dashboard reloads automatically when it's back.`})]})}),document.body)}function Vp(e,t){return e.length>12||t.length>12||e.length+t.length>22}function Hp(e,t){let n=new Map(t.map(e=>[e.id,e.profile?.displayName??e.id]));return e.filter(e=>e.status===`running`).map(e=>n.get(e.agentId)??e.agentId)}function Up(e){return{completedAt:e.completedAt,fallbackToIdle:e.restart?.fallbackToIdle,mode:e.restart?.mode,resumedCount:e.restart?.resumedCount}}function Wp(e){return!e||Date.now()-Date.parse(e)<Mp}function Gp(e,t){let n=new Date(e).getTime()-t.getTime();if(n<=0)return`now`;let r=Math.round(n/6e4),i=Math.floor(r/1440),a=Math.floor(r%1440/60),o=r%60;return i>0?a>0?`${i}d ${a}h`:`${i}d`:a>0?o>0?`${a}h ${o}m`:`${a}h`:`${o}m`}function Kp(e,t){let n=Math.round((t.getTime()-new Date(e).getTime())/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}function qp(e){return e>=50?`bg-health-ok`:e>=20?`bg-health-warn`:`bg-health-error`}function Jp(e){if(e.unlimited)return`∞`;if(e.balance!==void 0)return e.label.toLowerCase()===`plan`?Yp(e.balance):e.currency?`${e.balance} ${e.currency}`:String(e.balance);if(e.limit!==void 0&&e.used!==void 0){let t=e.limit-e.used;return e.currency?`${t} ${e.currency}`:String(t)}return e.limit===void 0?`—`:e.currency?`${e.limit} ${e.currency}`:String(e.limit)}function Yp(e){let t={TYPE_FREE:`Free`,TYPE_PURCHASE:`Paid`,TYPE_SUBSCRIPTION:`Subscription`,TYPE_TRIAL:`Trial`};return t[e]?t[e]:e.startsWith(`TYPE_`)?e.replace(/^TYPE_/,``).split(`_`).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):e}function Xp(e){return!e.error||e.error.type===`unknown`?null:e.error.type===`network_error`?`Usage check could not reach ${e.label}. Refresh to try again.`:e.error.message}function Zp({w:e,now:t}){let n=Math.round(e.remainingPercent);return(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[11px] text-text-subtle`,children:e.label}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,K.jsxs)(`span`,{className:`font-mono text-[11px] ${n<20?`text-health-error`:n<50?`text-health-warn`:`text-text-muted`}`,children:[n,`%`]}),e.resetsAt&&(0,K.jsx)(`span`,{className:`font-sans text-[10px] text-text-subtle`,children:Gp(e.resetsAt,t)})]})]}),(0,K.jsx)(`div`,{className:`h-1 w-full overflow-hidden rounded-full bg-surface-elevated`,children:(0,K.jsx)(`div`,{className:`h-full rounded-full transition-[width] duration-300 ${qp(n)}`,style:{width:`${n}%`}})})]})}function Qp({row:e,now:t}){let n=e.status===`available`,r=Xp(e);return(0,K.jsxs)(`div`,{className:n?``:`opacity-50`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[12px] font-medium text-text`,children:e.label}),e.source===`private-api`&&(0,K.jsx)(`span`,{className:`rounded border border-text-subtle/20 px-1 font-mono text-[9px] text-text-subtle`,title:`Data scraped from private API — best-effort`,children:`≈`})]}),n?(0,K.jsxs)(`div`,{className:`space-y-2.5`,children:[e.windows.map((e,n)=>(0,K.jsx)(Zp,{w:e,now:t},n)),e.extras.length>0&&(0,K.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-0.5`,children:e.extras.map((e,t)=>(0,K.jsxs)(`div`,{className:`flex items-baseline gap-1`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[10px] text-text-subtle`,children:e.label}),(0,K.jsx)(`span`,{className:`font-serif text-[12px] text-text-muted`,children:Jp(e)})]},t))})]}):(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(`span`,{className:`font-sans text-[12px] text-text-muted`,children:e.error?.type===`not_configured`?`Not configured`:e.error?.type===`unauthorized`?`Auth expired`:e.error?.type===`network_error`?`Unreachable`:`Unavailable`}),r&&(0,K.jsx)(`p`,{className:`font-mono text-[10px] text-text-subtle leading-relaxed`,children:r})]})]})}function $p(){return(0,K.jsxs)(`div`,{className:`animate-pulse space-y-2`,children:[(0,K.jsx)(`div`,{className:`h-3 w-20 rounded bg-surface-elevated`}),(0,K.jsx)(`div`,{className:`h-1 w-full rounded-full bg-surface-elevated`}),(0,K.jsx)(`div`,{className:`h-1 w-2/3 rounded-full bg-surface-elevated`})]})}function em({onClose:e}){let[t,n]=(0,v.useState)(!1),{data:r}=jo({queryKey:Po.health(),queryFn:wd,staleTime:5e3}),{data:i}=jo({queryKey:Po.serverInfo(),queryFn:Sd,staleTime:6e4}),a=r===void 0?`loading`:r?`ok`:`error`,{data:o,isLoading:s,isFetching:c,refetch:l}=jo({queryKey:Po.providerUsage(),queryFn:xd,enabled:t,staleTime:6e4}),u=fp();(0,v.useEffect)(()=>{let t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e]);let d=(0,v.useRef)(null),f=a===`loading`?`var(--color-health-idle)`:a===`ok`?`var(--color-health-ok)`:`var(--color-health-error)`,p=a===`loading`?`Checking…`:a===`ok`?`Healthy`:`Unreachable`,m=i?.version&&i.version!==`0.0.0`?i.version:null,h=m?i?.track?`${i.track} · ${m}`:m:i?.track??null,g=r!==void 0&&!!i,_=o?.providers[0]?.checkedAt;return(0,y.createPortal)((0,K.jsxs)(`div`,{className:`fixed inset-0 z-50`,children:[(0,K.jsx)(`div`,{className:`hidden md:block fixed inset-0 bg-page/70 backdrop-blur-sm`,onClick:e}),(0,K.jsxs)(`div`,{ref:d,role:`dialog`,"aria-modal":`true`,"aria-label":`Server`,className:[`relative flex h-full w-full flex-col bg-surface`,`md:absolute md:top-1/2 md:left-1/2 md:-translate-x-1/2 md:-translate-y-1/2`,`md:h-auto md:max-h-[calc(100dvh-4rem)] md:max-w-xl md:rounded-sm md:border md:border-border-soft md:shadow-deep`,`transition-[opacity,transform] duration-150 ease-out`,g?`opacity-100 scale-100`:`opacity-0 md:scale-95`].join(` `),style:{paddingBottom:`env(safe-area-inset-bottom)`},children:[(0,K.jsxs)(`div`,{className:`flex h-10 shrink-0 items-center justify-between border-b border-border-soft px-3`,children:[(0,K.jsx)(`span`,{className:`caps text-text`,children:`Server`}),(0,K.jsx)(`button`,{onClick:e,className:`flex h-7 w-7 items-center justify-center rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,"aria-label":`Close server panel`,children:(0,K.jsx)(nc,{className:`h-3.5 w-3.5`})})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto divide-y divide-border-soft`,children:[(0,K.jsx)(tm,{title:`Status`,action:(0,K.jsx)(Cp,{compact:!0}),children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,K.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full`,style:{background:f}}),(0,K.jsx)(`span`,{className:`font-serif text-[14px] text-text`,children:p})]}),i?.startedAt&&(0,K.jsxs)(`span`,{className:`font-sans text-[11px] tracking-wide text-text-subtle`,title:up(i.startedAt),children:[`· up `,cp(i.startedAt,u)]})]})}),(0,K.jsx)(tm,{title:`Provider Usage`,open:t,onOpenChange:n,action:t?(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[_&&(0,K.jsx)(`span`,{className:`font-sans text-[10px] text-text-subtle`,children:Kp(_,u)}),(0,K.jsx)(`button`,{onClick:()=>l(),disabled:c,className:`flex h-5 w-5 items-center justify-center rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent disabled:opacity-40`,"aria-label":`Refresh provider usage`,title:`Refresh`,children:(0,K.jsx)(Xs,{className:`h-3 w-3 ${c?`animate-spin`:``}`})})]}):void 0,children:s?(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)($p,{}),(0,K.jsx)($p,{}),(0,K.jsx)($p,{})]}):(()=>{let e=o?.providers.filter(e=>e.error?.type!==`not_configured`)??[];return e.length>0?(0,K.jsxs)(`div`,{className:`space-y-5`,children:[e.map(e=>(0,K.jsx)(Qp,{row:e,now:u},e.provider)),e.some(e=>e.source===`private-api`)&&(0,K.jsx)(`p`,{className:`font-mono text-[9px] text-text-subtle opacity-50`,children:`≈ best-effort (private API)`})]}):(0,K.jsx)(`p`,{className:`font-serif italic text-[13px] text-text-subtle`,children:`No providers configured.`})})()}),(0,K.jsx)(tm,{title:`Version`,children:(0,K.jsxs)(`div`,{className:`space-y-4`,children:[h&&(0,K.jsx)(`div`,{className:`min-w-0 break-all font-mono text-[12px] text-text`,children:h}),(0,K.jsx)(Np,{})]})}),i&&(0,K.jsx)(tm,{title:`Home`,children:(0,K.jsx)(`div`,{className:`min-w-0 break-all font-mono text-[12px] text-text`,title:i.animaHome,children:i.animaHome})})]})]})]}),document.body)}function tm({title:e,action:t,children:n,open:r,onOpenChange:i}){let a=r!==void 0&&!!i;return(0,K.jsxs)(`div`,{className:`px-4 py-4 md:px-6 md:py-5`,children:[(0,K.jsxs)(`div`,{className:`${!a||r?`mb-3`:``} flex items-center justify-between gap-2`,children:[a?(0,K.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),"aria-expanded":r,className:`-ml-1 flex min-h-[24px] items-center gap-1 rounded-sm px-1 font-sans text-[10px] font-medium uppercase tracking-widest text-text-subtle hover:bg-surface-elevated hover:text-text-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[r?(0,K.jsx)(Ps,{className:`h-3 w-3`}):(0,K.jsx)(Is,{className:`h-3 w-3`}),(0,K.jsx)(`span`,{children:e})]}):(0,K.jsx)(`span`,{className:`font-sans text-[10px] font-medium uppercase tracking-widest text-text-subtle`,children:e}),t&&(0,K.jsx)(`div`,{className:`shrink-0`,children:t})]}),(!a||r)&&n]})}async function nm(){return(await Io(`/api/kbs`)).kbs}async function rm(e){return Io(e?`/api/filesystem/browse?path=${encodeURIComponent(e)}`:`/api/filesystem/browse`)}async function im(e){return(await Io(`/api/kbs`,Lo(`POST`,e))).kbs}async function am(e){return Io(`/api/kbs/${encodeURIComponent(e)}`)}async function om(e,t){let n={label:t};return(await Io(`/api/kbs/${encodeURIComponent(e)}/rename`,Lo(`POST`,n))).kbs}async function sm(e){return(await Io(`/api/kbs/${encodeURIComponent(e)}`,{method:`DELETE`})).kbs}async function cm(e){return Io(`/api/kbs/${encodeURIComponent(e)}/tree`)}async function lm(e,t){return Io(`/api/kbs/${encodeURIComponent(e)}/file?path=${encodeURIComponent(t)}`)}function um(e,t){return`/api/kbs/${encodeURIComponent(e)}/download?path=${encodeURIComponent(t)}`}function dm(e,t,n){if(!t?.length)return e;let r=new Map(t.map((e,t)=>[e,t]));return[...e].sort((e,t)=>(r.get(n(e))??1/0)-(r.get(n(t))??1/0))}function fm(){let{data:e=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:t=[]}=jo({queryKey:Po.kbs(),queryFn:nm}),{data:n}=jo({queryKey:Po.sidebarOrder(),queryFn:vd,staleTime:1/0}),r=Mo({mutationFn:yd,onMutate:async e=>{await No.cancelQueries({queryKey:Po.sidebarOrder()}),No.setQueryData(Po.sidebarOrder(),e)},onError:()=>{No.invalidateQueries({queryKey:Po.sidebarOrder()})}}),i=dm(e,n?.agents,e=>e.id),a=dm(t,n?.kbs,e=>e.id),o=new Map(e.map((e,t)=>[e.id,t])),s=new Map(t.map((e,t)=>[e.id,t])),c=Wc(Uc(Wl,{activationConstraint:{distance:4}}));function l(e){let{active:t,over:a}=e;if(!a||t.id===a.id)return;let o=i.findIndex(e=>e.id===String(t.id)),s=i.findIndex(e=>e.id===String(a.id));if(o===-1||s===-1)return;let c=Xu(i,o,s);r.mutate({...n,agents:c.map(e=>e.id)})}function u(e){let{active:t,over:i}=e;if(!i||t.id===i.id)return;let o=a.findIndex(e=>e.id===String(t.id)),s=a.findIndex(e=>e.id===String(i.id));if(o===-1||s===-1)return;let c=Xu(a,o,s);r.mutate({...n,kbs:c.map(e=>e.id)})}return{orderedAgents:i,orderedKbs:a,agentIndexMap:o,kbIndexMap:s,sensors:c,reorderAgents:l,reorderKbs:u}}var pm=[`var(--color-agent-1)`,`var(--color-agent-2)`,`var(--color-agent-3)`,`var(--color-agent-4)`];function mm(e){return pm[e%pm.length]}function hm(e){let t=e.trim();return t?t[0].toUpperCase():`?`}function gm({agent:e,index:t,active:n,isRunning:r,enabled:i,onClick:a}){let o=mm(t),s=e.profile?.displayName??e.id,c=hm(s),l=i&&e.slack?.connected!==!0;return(0,K.jsxs)(`div`,{className:[`group relative flex w-full items-center rounded-sm transition-colors`,n?`bg-spine-elevated`:`hover:bg-spine-elevated/30`].join(` `),children:[n&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-1.5 bottom-1.5 w-0.5 bg-accent`}),(0,K.jsxs)(`button`,{onClick:a,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 px-3 py-2.5 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-inset`,children:[e.slack?.avatarUrl?(0,K.jsx)(`img`,{src:e.slack.avatarUrl,alt:``,className:[`h-8 w-8 shrink-0 rounded-lg object-cover ring-1 ring-avatar-ring-spine`,i?l?`opacity-40 grayscale`:``:`opacity-40 grayscale`].join(` `)}):(0,K.jsx)(`span`,{className:[`font-sans flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-[11px] font-bold text-white ring-1 ring-avatar-ring-spine`,!i||l?`opacity-40`:``].join(` `),style:{background:o},children:c}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:[`truncate font-serif text-[14px] leading-tight`,n?`font-semibold`:`font-medium`,!i||l?`text-text-on-spine-subtle`:`text-text-on-spine`].join(` `),children:s}),i?l?null:(0,K.jsx)(`span`,{className:`ml-auto inline-block h-2 w-2 shrink-0 rounded-full`,style:{background:r?`var(--color-health-warn)`:`var(--color-health-ok)`},title:r?`working`:`idle`}):(0,K.jsx)(`span`,{className:`font-sans ml-auto shrink-0 rounded-sm border border-text-on-spine-subtle/40 bg-text-on-spine-subtle/10 px-1 py-0.5 text-[9px] uppercase tracking-[0.08em] text-text-on-spine-subtle`,title:`disabled by user`,children:`Off`})]}),l&&(0,K.jsx)(`div`,{className:`font-sans mt-0.5 text-[10px] leading-tight text-health-warn/80`,children:`Not connected`})]})]})]})}var _m;function q(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var vm=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},ym=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(_m=globalThis).__zod_globalConfig??(_m.__zod_globalConfig={});var bm=globalThis.__zod_globalConfig;function xm(e){return e&&Object.assign(bm,e),bm}function Sm(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Cm(e,t){return typeof t==`bigint`?t.toString():t}function wm(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function Tm(e){return e==null}function Em(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Dm(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Om=Symbol(`evaluating`);function km(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Om)return r===void 0&&(r=Om,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Am(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function jm(...e){let t={};for(let n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}function Mm(e){return JSON.stringify(e)}function Nm(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Pm=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Fm(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Im=wm(()=>{if(bm.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Lm(e){if(Fm(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Fm(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Rm(e){return Lm(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var zm=new Set([`string`,`number`,`symbol`]);function Bm(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Vm(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function J(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Hm(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var Um={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Wm(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return Vm(e,jm(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Am(this,`shape`,e),e},checks:[]}))}function Gm(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return Vm(e,jm(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Am(this,`shape`,r),r},checks:[]}))}function Km(e,t){if(!Lm(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Vm(e,jm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Am(this,`shape`,n),n}}))}function qm(e,t){if(!Lm(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Vm(e,jm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Am(this,`shape`,n),n}}))}function Jm(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return Vm(e,jm(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Am(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ym(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return Vm(t,jm(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Am(this,`shape`,i),i},checks:[]}))}function Xm(e,t,n){return Vm(t,jm(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Am(this,`shape`,i),i}}))}function Zm(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Qm(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function $m(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function eh(e){return typeof e==`string`?e:e?.message}function th(e,t,n){let r=e.message?e.message:eh(e.inst?._zod.def?.error?.(e))??eh(t?.error?.(e))??eh(n.customError?.(e))??eh(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function nh(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function rh(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var ih=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Cm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ah=q(`$ZodError`,ih),oh=q(`$ZodError`,ih,{Parent:Error});function sh(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function ch(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var lh=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new vm;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>th(e,a,xm())));throw Pm(t,i?.callee),t}return o.value},uh=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>th(e,a,xm())));throw Pm(t,i?.callee),t}return o.value},dh=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new vm;return a.issues.length?{success:!1,error:new(e??ah)(a.issues.map(e=>th(e,i,xm())))}:{success:!0,data:a.value}},fh=dh(oh),ph=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>th(e,i,xm())))}:{success:!0,data:a.value}},mh=ph(oh),hh=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return lh(e)(t,n,i)},gh=e=>(t,n,r)=>lh(e)(t,n,r),_h=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return uh(e)(t,n,i)},vh=e=>async(t,n,r)=>uh(e)(t,n,r),yh=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return dh(e)(t,n,i)},bh=e=>(t,n,r)=>dh(e)(t,n,r),xh=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ph(e)(t,n,i)},Sh=e=>async(t,n,r)=>ph(e)(t,n,r),Ch=/^[cC][0-9a-z]{6,}$/,wh=/^[0-9a-z]+$/,Th=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Eh=/^[0-9a-vA-V]{20}$/,Dh=/^[A-Za-z0-9]{27}$/,Oh=/^[a-zA-Z0-9_-]{21}$/,kh=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ah=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,jh=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Mh=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Nh=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Ph(){return new RegExp(Nh,`u`)}var Fh=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ih=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Lh=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Rh=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,zh=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Bh=/^[A-Za-z0-9_-]*$/,Vh=/^https?$/,Hh=/^\+[1-9]\d{6,14}$/,Uh=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,Wh=RegExp(`^${Uh}$`);function Gh(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Kh(e){return RegExp(`^${Gh(e)}$`)}function qh(e){let t=Gh({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${Uh}T(?:${r})$`)}var Jh=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Yh=/^-?\d+$/,Xh=/^-?\d+(?:\.\d+)?$/,Zh=/^(?:true|false)$/i,Qh=/^[^A-Z]*$/,$h=/^[^a-z]*$/,eg=q(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),tg={number:`number`,bigint:`bigint`,object:`date`},ng=q(`$ZodCheckLessThan`,(e,t)=>{eg.init(e,t);let n=tg[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),rg=q(`$ZodCheckGreaterThan`,(e,t)=>{eg.init(e,t);let n=tg[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),ig=q(`$ZodCheckMultipleOf`,(e,t)=>{eg.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Dm(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),ag=q(`$ZodCheckNumberFormat`,(e,t)=>{eg.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Um[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=Yh)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),og=q(`$ZodCheckMaxLength`,(e,t)=>{var n;eg.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Tm(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=nh(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),sg=q(`$ZodCheckMinLength`,(e,t)=>{var n;eg.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Tm(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=nh(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),cg=q(`$ZodCheckLengthEquals`,(e,t)=>{var n;eg.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!Tm(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=nh(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),lg=q(`$ZodCheckStringFormat`,(e,t)=>{var n,r;eg.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),ug=q(`$ZodCheckRegex`,(e,t)=>{lg.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),dg=q(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Qh,lg.init(e,t)}),fg=q(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=$h,lg.init(e,t)}),pg=q(`$ZodCheckIncludes`,(e,t)=>{eg.init(e,t);let n=Bm(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),mg=q(`$ZodCheckStartsWith`,(e,t)=>{eg.init(e,t);let n=RegExp(`^${Bm(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),hg=q(`$ZodCheckEndsWith`,(e,t)=>{eg.init(e,t);let n=RegExp(`.*${Bm(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),gg=q(`$ZodCheckOverwrite`,(e,t)=>{eg.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),_g=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
18
18
|
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
19
|
-
`))}},
|
|
19
|
+
`))}},vg={major:4,minor:4,patch:3},yg=q(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=vg;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=Zm(e),i;for(let a of t){if(a._zod.def.when){if(Qm(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new vm;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=Zm(e,t))});else{if(e.issues.length===t)continue;r||=Zm(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(Zm(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new vm;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new vm;return o.then(e=>t(e,r,a))}return t(o,r,a)}}km(e,`~standard`,()=>({validate:t=>{try{let n=fh(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return mh(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),bg=q(`$ZodString`,(e,t)=>{yg.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Jh(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),xg=q(`$ZodStringFormat`,(e,t)=>{lg.init(e,t),bg.init(e,t)}),Sg=q(`$ZodGUID`,(e,t)=>{t.pattern??=Ah,xg.init(e,t)}),Cg=q(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=jh(e)}else t.pattern??=jh();xg.init(e,t)}),wg=q(`$ZodEmail`,(e,t)=>{t.pattern??=Mh,xg.init(e,t)}),Tg=q(`$ZodURL`,(e,t)=>{xg.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===Vh.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Eg=q(`$ZodEmoji`,(e,t)=>{t.pattern??=Ph(),xg.init(e,t)}),Dg=q(`$ZodNanoID`,(e,t)=>{t.pattern??=Oh,xg.init(e,t)}),Og=q(`$ZodCUID`,(e,t)=>{t.pattern??=Ch,xg.init(e,t)}),kg=q(`$ZodCUID2`,(e,t)=>{t.pattern??=wh,xg.init(e,t)}),Ag=q(`$ZodULID`,(e,t)=>{t.pattern??=Th,xg.init(e,t)}),jg=q(`$ZodXID`,(e,t)=>{t.pattern??=Eh,xg.init(e,t)}),Mg=q(`$ZodKSUID`,(e,t)=>{t.pattern??=Dh,xg.init(e,t)}),Ng=q(`$ZodISODateTime`,(e,t)=>{t.pattern??=qh(t),xg.init(e,t)}),Pg=q(`$ZodISODate`,(e,t)=>{t.pattern??=Wh,xg.init(e,t)}),Fg=q(`$ZodISOTime`,(e,t)=>{t.pattern??=Kh(t),xg.init(e,t)}),Ig=q(`$ZodISODuration`,(e,t)=>{t.pattern??=kh,xg.init(e,t)}),Lg=q(`$ZodIPv4`,(e,t)=>{t.pattern??=Fh,xg.init(e,t),e._zod.bag.format=`ipv4`}),Rg=q(`$ZodIPv6`,(e,t)=>{t.pattern??=Ih,xg.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),zg=q(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Lh,xg.init(e,t)}),Bg=q(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Rh,xg.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function Vg(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Hg=q(`$ZodBase64`,(e,t)=>{t.pattern??=zh,xg.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{Vg(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function Ug(e){if(!Bh.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Vg(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Wg=q(`$ZodBase64URL`,(e,t)=>{t.pattern??=Bh,xg.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{Ug(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Gg=q(`$ZodE164`,(e,t)=>{t.pattern??=Hh,xg.init(e,t)});function Kg(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var qg=q(`$ZodJWT`,(e,t)=>{xg.init(e,t),e._zod.check=n=>{Kg(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Jg=q(`$ZodNumber`,(e,t)=>{yg.init(e,t),e._zod.pattern=e._zod.bag.pattern??Xh,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Yg=q(`$ZodNumberFormat`,(e,t)=>{ag.init(e,t),Jg.init(e,t)}),Xg=q(`$ZodBoolean`,(e,t)=>{yg.init(e,t),e._zod.pattern=Zh,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Zg=q(`$ZodUnknown`,(e,t)=>{yg.init(e,t),e._zod.parse=e=>e}),Qg=q(`$ZodNever`,(e,t)=>{yg.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function $g(e,t,n){e.issues.length&&t.issues.push(...$m(n,e.issues)),t.value[n]=e.value}var e_=q(`$ZodArray`,(e,t)=>{yg.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>$g(t,n,e))):$g(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function t_(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...$m(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function n_(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=Hm(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function r_(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>t_(e,n,i,t,u,d))):t_(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var i_=q(`$ZodObject`,(e,t)=>{if(yg.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=wm(()=>n_(t));km(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=Fm,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>t_(n,t,e,s,r,i))):t_(a,t,e,s,r,i)}return i?r_(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),a_=q(`$ZodObjectJIT`,(e,t)=>{i_.init(e,t);let n=e._zod.parse,r=wm(()=>n_(t)),i=e=>{let t=new _g([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=Mm(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=Mm(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
20
20
|
if (${n}.issues.length) {
|
|
21
21
|
if (${o} in input) {
|
|
22
22
|
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
@@ -75,6 +75,6 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Am,s=!hm.jitless,c=s&&jm.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Qg([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function t_(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Km(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Xm(e,r,gm())))}),t)}var n_=q(`$ZodUnion`,(e,t)=>{mg.init(e,t),wm(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),wm(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),wm(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),wm(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>xm(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>t_(t,r,e,i)):t_(o,r,e,i)}}),r_=q(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,n_.init(e,t);let n=e._zod.parse;wm(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=ym(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Am(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),i_=q(`$ZodIntersection`,(e,t)=>{mg.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>o_(e,t,n)):o_(e,i,a)}});function a_(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Mm(e)&&Mm(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=a_(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=a_(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function o_(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Km(e))return e;let o=a_(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var s_=q(`$ZodRecord`,(e,t)=>{mg.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Mm(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>Xm(e,r,gm())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...Jm(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...Jm(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Gh.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Xm(e,r,gm())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Jm(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Jm(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),c_=q(`$ZodEnum`,(e,t)=>{mg.init(e,t);let n=_m(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Pm.has(typeof e)).map(e=>typeof e==`string`?Fm(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),l_=q(`$ZodLiteral`,(e,t)=>{if(mg.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Fm(e):e?Fm(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),u_=q(`$ZodTransform`,(e,t)=>{mg.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new mm(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new pm;return n.value=i,n.fallback=!0,n}});function d_(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var f_=q(`$ZodOptional`,(e,t)=>{mg.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,wm(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),wm(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${xm(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>d_(e,r)):d_(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),p_=q(`$ZodExactOptional`,(e,t)=>{f_.init(e,t),wm(e._zod,`values`,()=>t.innerType._zod.values),wm(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),m_=q(`$ZodNullable`,(e,t)=>{mg.init(e,t),wm(e._zod,`optin`,()=>t.innerType._zod.optin),wm(e._zod,`optout`,()=>t.innerType._zod.optout),wm(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${xm(e.source)}|null)$`):void 0}),wm(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),h_=q(`$ZodDefault`,(e,t)=>{mg.init(e,t),e._zod.optin=`optional`,wm(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>g_(e,t)):g_(r,t)}});function g_(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var __=q(`$ZodPrefault`,(e,t)=>{mg.init(e,t),e._zod.optin=`optional`,wm(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),v_=q(`$ZodNonOptional`,(e,t)=>{mg.init(e,t),wm(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>y_(t,e)):y_(i,e)}});function y_(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var b_=q(`$ZodCatch`,(e,t)=>{mg.init(e,t),e._zod.optin=`optional`,wm(e._zod,`optout`,()=>t.innerType._zod.optout),wm(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Xm(e,n,gm()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Xm(e,n,gm()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),x_=q(`$ZodPipe`,(e,t)=>{mg.init(e,t),wm(e._zod,`values`,()=>t.in._zod.values),wm(e._zod,`optin`,()=>t.in._zod.optin),wm(e._zod,`optout`,()=>t.out._zod.optout),wm(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>S_(e,t.in,n)):S_(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>S_(e,t.out,n)):S_(r,t.out,n)}});function S_(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var C_=q(`$ZodPreprocess`,(e,t)=>{x_.init(e,t)}),w_=q(`$ZodReadonly`,(e,t)=>{mg.init(e,t),wm(e._zod,`propValues`,()=>t.innerType._zod.propValues),wm(e._zod,`values`,()=>t.innerType._zod.values),wm(e._zod,`optin`,()=>t.innerType?._zod?.optin),wm(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(T_):T_(r)}});function T_(e){return e.value=Object.freeze(e.value),e}var E_=q(`$ZodCustom`,(e,t)=>{Yh.init(e,t),mg.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>D_(t,n,r,e));D_(i,n,r,e)}});function D_(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Qm(e))}}var O_,k_=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function A_(){return new k_}(O_=globalThis).__zod_globalRegistry??(O_.__zod_globalRegistry=A_());var j_=globalThis.__zod_globalRegistry;function M_(e,t){return new e({type:`string`,...J(t)})}function N_(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...J(t)})}function P_(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...J(t)})}function F_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...J(t)})}function I_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...J(t)})}function L_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...J(t)})}function R_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...J(t)})}function z_(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...J(t)})}function B_(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...J(t)})}function V_(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...J(t)})}function H_(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...J(t)})}function U_(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...J(t)})}function W_(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...J(t)})}function G_(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...J(t)})}function K_(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...J(t)})}function q_(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...J(t)})}function J_(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...J(t)})}function Y_(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...J(t)})}function X_(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...J(t)})}function Z_(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...J(t)})}function Q_(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...J(t)})}function $_(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...J(t)})}function ev(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...J(t)})}function tv(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...J(t)})}function nv(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...J(t)})}function rv(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...J(t)})}function iv(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...J(t)})}function av(e,t){return new e({type:`number`,checks:[],...J(t)})}function ov(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...J(t)})}function sv(e,t){return new e({type:`boolean`,...J(t)})}function cv(e){return new e({type:`unknown`})}function lv(e,t){return new e({type:`never`,...J(t)})}function uv(e,t){return new Zh({check:`less_than`,...J(t),value:e,inclusive:!1})}function dv(e,t){return new Zh({check:`less_than`,...J(t),value:e,inclusive:!0})}function fv(e,t){return new Qh({check:`greater_than`,...J(t),value:e,inclusive:!1})}function pv(e,t){return new Qh({check:`greater_than`,...J(t),value:e,inclusive:!0})}function mv(e,t){return new $h({check:`multiple_of`,...J(t),value:e})}function hv(e,t){return new tg({check:`max_length`,...J(t),maximum:e})}function gv(e,t){return new ng({check:`min_length`,...J(t),minimum:e})}function _v(e,t){return new rg({check:`length_equals`,...J(t),length:e})}function vv(e,t){return new ag({check:`string_format`,format:`regex`,...J(t),pattern:e})}function yv(e){return new og({check:`string_format`,format:`lowercase`,...J(e)})}function bv(e){return new sg({check:`string_format`,format:`uppercase`,...J(e)})}function xv(e,t){return new cg({check:`string_format`,format:`includes`,...J(t),includes:e})}function Sv(e,t){return new lg({check:`string_format`,format:`starts_with`,...J(t),prefix:e})}function Cv(e,t){return new ug({check:`string_format`,format:`ends_with`,...J(t),suffix:e})}function wv(e){return new dg({check:`overwrite`,tx:e})}function Tv(e){return wv(t=>t.normalize(e))}function Ev(){return wv(e=>e.trim())}function Dv(){return wv(e=>e.toLowerCase())}function Ov(){return wv(e=>e.toUpperCase())}function kv(){return wv(e=>Om(e))}function Av(e,t,n){return new e({type:`array`,element:t,...J(n)})}function jv(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...J(n)})}function Mv(e,t){let n=Nv(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Qm(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Qm(r))}},e(t.value,t)),t);return n}function Nv(e,t){let n=new Yh({check:`custom`,...J(t)});return n._zod.check=e,n}function Pv(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??j_,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Fv(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Fv(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Rv(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Iv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
78
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=Fm,s=!bm.jitless,c=s&&Im.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?r_([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function o_(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Zm(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>th(e,r,xm())))}),t)}var s_=q(`$ZodUnion`,(e,t)=>{yg.init(e,t),km(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),km(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),km(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),km(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Em(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>o_(t,r,e,i)):o_(o,r,e,i)}}),c_=q(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,s_.init(e,t);let n=e._zod.parse;km(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=wm(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!Fm(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),l_=q(`$ZodIntersection`,(e,t)=>{yg.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>d_(e,t,n)):d_(e,i,a)}});function u_(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Lm(e)&&Lm(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=u_(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=u_(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function d_(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Zm(e))return e;let o=u_(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var f_=q(`$ZodRecord`,(e,t)=>{yg.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Lm(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>th(e,r,xm())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...$m(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...$m(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Xh.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>th(e,r,xm())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...$m(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...$m(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),p_=q(`$ZodEnum`,(e,t)=>{yg.init(e,t);let n=Sm(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>zm.has(typeof e)).map(e=>typeof e==`string`?Bm(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),m_=q(`$ZodLiteral`,(e,t)=>{if(yg.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?Bm(e):e?Bm(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),h_=q(`$ZodTransform`,(e,t)=>{yg.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ym(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new vm;return n.value=i,n.fallback=!0,n}});function g_(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var __=q(`$ZodOptional`,(e,t)=>{yg.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,km(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),km(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Em(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>g_(e,r)):g_(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),v_=q(`$ZodExactOptional`,(e,t)=>{__.init(e,t),km(e._zod,`values`,()=>t.innerType._zod.values),km(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),y_=q(`$ZodNullable`,(e,t)=>{yg.init(e,t),km(e._zod,`optin`,()=>t.innerType._zod.optin),km(e._zod,`optout`,()=>t.innerType._zod.optout),km(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Em(e.source)}|null)$`):void 0}),km(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),b_=q(`$ZodDefault`,(e,t)=>{yg.init(e,t),e._zod.optin=`optional`,km(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>x_(e,t)):x_(r,t)}});function x_(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var S_=q(`$ZodPrefault`,(e,t)=>{yg.init(e,t),e._zod.optin=`optional`,km(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),C_=q(`$ZodNonOptional`,(e,t)=>{yg.init(e,t),km(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>w_(t,e)):w_(i,e)}});function w_(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var T_=q(`$ZodCatch`,(e,t)=>{yg.init(e,t),e._zod.optin=`optional`,km(e._zod,`optout`,()=>t.innerType._zod.optout),km(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>th(e,n,xm()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>th(e,n,xm()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),E_=q(`$ZodPipe`,(e,t)=>{yg.init(e,t),km(e._zod,`values`,()=>t.in._zod.values),km(e._zod,`optin`,()=>t.in._zod.optin),km(e._zod,`optout`,()=>t.out._zod.optout),km(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>D_(e,t.in,n)):D_(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>D_(e,t.out,n)):D_(r,t.out,n)}});function D_(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var O_=q(`$ZodPreprocess`,(e,t)=>{E_.init(e,t)}),k_=q(`$ZodReadonly`,(e,t)=>{yg.init(e,t),km(e._zod,`propValues`,()=>t.innerType._zod.propValues),km(e._zod,`values`,()=>t.innerType._zod.values),km(e._zod,`optin`,()=>t.innerType?._zod?.optin),km(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(A_):A_(r)}});function A_(e){return e.value=Object.freeze(e.value),e}var j_=q(`$ZodCustom`,(e,t)=>{eg.init(e,t),yg.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>M_(t,n,r,e));M_(i,n,r,e)}});function M_(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(rh(e))}}var N_,P_=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function F_(){return new P_}(N_=globalThis).__zod_globalRegistry??(N_.__zod_globalRegistry=F_());var I_=globalThis.__zod_globalRegistry;function L_(e,t){return new e({type:`string`,...J(t)})}function R_(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...J(t)})}function z_(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...J(t)})}function B_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...J(t)})}function V_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...J(t)})}function H_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...J(t)})}function U_(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...J(t)})}function W_(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...J(t)})}function G_(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...J(t)})}function K_(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...J(t)})}function q_(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...J(t)})}function J_(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...J(t)})}function Y_(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...J(t)})}function X_(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...J(t)})}function Z_(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...J(t)})}function Q_(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...J(t)})}function $_(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...J(t)})}function ev(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...J(t)})}function tv(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...J(t)})}function nv(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...J(t)})}function rv(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...J(t)})}function iv(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...J(t)})}function av(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...J(t)})}function ov(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...J(t)})}function sv(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...J(t)})}function cv(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...J(t)})}function lv(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...J(t)})}function uv(e,t){return new e({type:`number`,checks:[],...J(t)})}function dv(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...J(t)})}function fv(e,t){return new e({type:`boolean`,...J(t)})}function pv(e){return new e({type:`unknown`})}function mv(e,t){return new e({type:`never`,...J(t)})}function hv(e,t){return new ng({check:`less_than`,...J(t),value:e,inclusive:!1})}function gv(e,t){return new ng({check:`less_than`,...J(t),value:e,inclusive:!0})}function _v(e,t){return new rg({check:`greater_than`,...J(t),value:e,inclusive:!1})}function vv(e,t){return new rg({check:`greater_than`,...J(t),value:e,inclusive:!0})}function yv(e,t){return new ig({check:`multiple_of`,...J(t),value:e})}function bv(e,t){return new og({check:`max_length`,...J(t),maximum:e})}function xv(e,t){return new sg({check:`min_length`,...J(t),minimum:e})}function Sv(e,t){return new cg({check:`length_equals`,...J(t),length:e})}function Cv(e,t){return new ug({check:`string_format`,format:`regex`,...J(t),pattern:e})}function wv(e){return new dg({check:`string_format`,format:`lowercase`,...J(e)})}function Tv(e){return new fg({check:`string_format`,format:`uppercase`,...J(e)})}function Ev(e,t){return new pg({check:`string_format`,format:`includes`,...J(t),includes:e})}function Dv(e,t){return new mg({check:`string_format`,format:`starts_with`,...J(t),prefix:e})}function Ov(e,t){return new hg({check:`string_format`,format:`ends_with`,...J(t),suffix:e})}function kv(e){return new gg({check:`overwrite`,tx:e})}function Av(e){return kv(t=>t.normalize(e))}function jv(){return kv(e=>e.trim())}function Mv(){return kv(e=>e.toLowerCase())}function Nv(){return kv(e=>e.toUpperCase())}function Pv(){return kv(e=>Nm(e))}function Fv(e,t,n){return new e({type:`array`,element:t,...J(n)})}function Iv(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...J(n)})}function Lv(e,t){let n=Rv(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(rh(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(rh(r))}},e(t.value,t)),t);return n}function Rv(e,t){let n=new eg({check:`custom`,...J(t)});return n._zod.check=e,n}function zv(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??I_,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Bv(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Bv(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Uv(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Vv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
79
79
|
|
|
80
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Lv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Bv(t,`input`,e.processors),output:Bv(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Rv(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Rv(r.element,n);if(r.type===`set`)return Rv(r.valueType,n);if(r.type===`lazy`)return Rv(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Rv(r.innerType,n);if(r.type===`intersection`)return Rv(r.left,n)||Rv(r.right,n);if(r.type===`record`||r.type===`map`)return Rv(r.keyType,n)||Rv(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Rv(r.in,n)||Rv(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Rv(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Rv(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Rv(e,n))return!0;return!!(r.rest&&Rv(r.rest,n))}return!1}var zv=(e,t={})=>n=>{let r=Pv({...n,processors:t});return Fv(e,r),Iv(r,e),Lv(r,e)},Bv=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Pv({...i??{},target:a,io:t,processors:n});return Fv(e,o),Iv(o,e),Lv(o,e)},Vv={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Hv=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Vv[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Uv=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Wv=(e,t,n,r)=>{n.type=`boolean`},Gv=(e,t,n,r)=>{n.not={}},Kv=(e,t,n,r)=>{let i=e._zod.def,a=_m(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},qv=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Jv=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Yv=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Xv=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Fv(a.element,t,{...r,path:[...r.path,`items`]})},Zv=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Fv(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Fv(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Qv=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Fv(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},$v=(e,t,n,r)=>{let i=e._zod.def,a=Fv(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Fv(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ey=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Fv(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Fv(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Fv(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},ty=(e,t,n,r)=>{let i=e._zod.def,a=Fv(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},ny=(e,t,n,r)=>{let i=e._zod.def;Fv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ry=(e,t,n,r)=>{let i=e._zod.def;Fv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},iy=(e,t,n,r)=>{let i=e._zod.def;Fv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ay=(e,t,n,r)=>{let i=e._zod.def;Fv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},oy=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Fv(o,t,r);let s=t.seen.get(e);s.ref=o},sy=(e,t,n,r)=>{let i=e._zod.def;Fv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},cy=(e,t,n,r)=>{let i=e._zod.def;Fv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ly=q(`ZodISODateTime`,(e,t)=>{Og.init(e,t),Iy.init(e,t)});function uy(e){return tv(ly,e)}var dy=q(`ZodISODate`,(e,t)=>{kg.init(e,t),Iy.init(e,t)});function fy(e){return nv(dy,e)}var py=q(`ZodISOTime`,(e,t)=>{Ag.init(e,t),Iy.init(e,t)});function my(e){return rv(py,e)}var hy=q(`ZodISODuration`,(e,t)=>{jg.init(e,t),Iy.init(e,t)});function gy(e){return iv(hy,e)}var _y=q(`ZodError`,(e,t)=>{eh.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>rh(e,t)},flatten:{value:t=>nh(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,vm,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,vm,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),vy=ih(_y),yy=ah(_y),by=oh(_y),xy=ch(_y),Sy=uh(_y),Cy=dh(_y),wy=fh(_y),Ty=ph(_y),Ey=mh(_y),Dy=hh(_y),Oy=gh(_y),ky=_h(_y),Ay=new WeakMap;function jy(e,t,n){let r=Object.getPrototypeOf(e),i=Ay.get(r);if(i||(i=new Set,Ay.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var My=q(`ZodType`,(e,t)=>(mg.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Bv(e,`input`),output:Bv(e,`output`)}}),e.toJSONSchema=zv(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>vy(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>by(e,t,n),e.parseAsync=async(t,n)=>yy(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>xy(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Sy(e,t,n),e.decode=(t,n)=>Cy(e,t,n),e.encodeAsync=async(t,n)=>wy(e,t,n),e.decodeAsync=async(t,n)=>Ty(e,t,n),e.safeEncode=(t,n)=>Ey(e,t,n),e.safeDecode=(t,n)=>Dy(e,t,n),e.safeEncodeAsync=async(t,n)=>Oy(e,t,n),e.safeDecodeAsync=async(t,n)=>ky(e,t,n),jy(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Em(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Im(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Xb(e,t))},superRefine(e,t){return this.check(Zb(e,t))},overwrite(e){return this.check(wv(e))},optional(){return jb(this)},exactOptional(){return Nb(this)},nullable(){return Fb(this)},nullish(){return jb(Fb(this))},nonoptional(e){return Vb(this,e)},array(){return pb(this)},or(e){return _b([this,e])},and(e){return xb(this,e)},transform(e){return Gb(this,kb(e))},default(e){return Lb(this,e)},prefault(e){return zb(this,e)},catch(e){return Ub(this,e)},pipe(e){return Gb(this,e)},readonly(){return Jb(this)},describe(e){let t=this.clone();return j_.add(t,{description:e}),t},meta(...e){if(e.length===0)return j_.get(this);let t=this.clone();return j_.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return j_.get(e)?.description},configurable:!0}),e)),Ny=q(`_ZodString`,(e,t)=>{hg.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hv(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,jy(e,`_ZodString`,{regex(...e){return this.check(vv(...e))},includes(...e){return this.check(xv(...e))},startsWith(...e){return this.check(Sv(...e))},endsWith(...e){return this.check(Cv(...e))},min(...e){return this.check(gv(...e))},max(...e){return this.check(hv(...e))},length(...e){return this.check(_v(...e))},nonempty(...e){return this.check(gv(1,...e))},lowercase(e){return this.check(yv(e))},uppercase(e){return this.check(bv(e))},trim(){return this.check(Ev())},normalize(...e){return this.check(Tv(...e))},toLowerCase(){return this.check(Dv())},toUpperCase(){return this.check(Ov())},slugify(){return this.check(kv())}})}),Py=q(`ZodString`,(e,t)=>{hg.init(e,t),Ny.init(e,t),e.email=t=>e.check(N_(Ly,t)),e.url=t=>e.check(z_(By,t)),e.jwt=t=>e.check(ev(tb,t)),e.emoji=t=>e.check(B_(Vy,t)),e.guid=t=>e.check(P_(Ry,t)),e.uuid=t=>e.check(F_(zy,t)),e.uuidv4=t=>e.check(I_(zy,t)),e.uuidv6=t=>e.check(L_(zy,t)),e.uuidv7=t=>e.check(R_(zy,t)),e.nanoid=t=>e.check(V_(Hy,t)),e.guid=t=>e.check(P_(Ry,t)),e.cuid=t=>e.check(H_(Uy,t)),e.cuid2=t=>e.check(U_(Wy,t)),e.ulid=t=>e.check(W_(Gy,t)),e.base64=t=>e.check(Z_(Qy,t)),e.base64url=t=>e.check(Q_($y,t)),e.xid=t=>e.check(G_(Ky,t)),e.ksuid=t=>e.check(K_(qy,t)),e.ipv4=t=>e.check(q_(Jy,t)),e.ipv6=t=>e.check(J_(Yy,t)),e.cidrv4=t=>e.check(Y_(Xy,t)),e.cidrv6=t=>e.check(X_(Zy,t)),e.e164=t=>e.check($_(eb,t)),e.datetime=t=>e.check(uy(t)),e.date=t=>e.check(fy(t)),e.time=t=>e.check(my(t)),e.duration=t=>e.check(gy(t))});function Fy(e){return M_(Py,e)}var Iy=q(`ZodStringFormat`,(e,t)=>{gg.init(e,t),Ny.init(e,t)}),Ly=q(`ZodEmail`,(e,t)=>{yg.init(e,t),Iy.init(e,t)}),Ry=q(`ZodGUID`,(e,t)=>{_g.init(e,t),Iy.init(e,t)}),zy=q(`ZodUUID`,(e,t)=>{vg.init(e,t),Iy.init(e,t)}),By=q(`ZodURL`,(e,t)=>{bg.init(e,t),Iy.init(e,t)}),Vy=q(`ZodEmoji`,(e,t)=>{xg.init(e,t),Iy.init(e,t)}),Hy=q(`ZodNanoID`,(e,t)=>{Sg.init(e,t),Iy.init(e,t)}),Uy=q(`ZodCUID`,(e,t)=>{Cg.init(e,t),Iy.init(e,t)}),Wy=q(`ZodCUID2`,(e,t)=>{wg.init(e,t),Iy.init(e,t)}),Gy=q(`ZodULID`,(e,t)=>{Tg.init(e,t),Iy.init(e,t)}),Ky=q(`ZodXID`,(e,t)=>{Eg.init(e,t),Iy.init(e,t)}),qy=q(`ZodKSUID`,(e,t)=>{Dg.init(e,t),Iy.init(e,t)}),Jy=q(`ZodIPv4`,(e,t)=>{Mg.init(e,t),Iy.init(e,t)}),Yy=q(`ZodIPv6`,(e,t)=>{Ng.init(e,t),Iy.init(e,t)}),Xy=q(`ZodCIDRv4`,(e,t)=>{Pg.init(e,t),Iy.init(e,t)}),Zy=q(`ZodCIDRv6`,(e,t)=>{Fg.init(e,t),Iy.init(e,t)}),Qy=q(`ZodBase64`,(e,t)=>{Lg.init(e,t),Iy.init(e,t)}),$y=q(`ZodBase64URL`,(e,t)=>{zg.init(e,t),Iy.init(e,t)}),eb=q(`ZodE164`,(e,t)=>{Bg.init(e,t),Iy.init(e,t)}),tb=q(`ZodJWT`,(e,t)=>{Hg.init(e,t),Iy.init(e,t)}),nb=q(`ZodNumber`,(e,t)=>{Ug.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uv(e,t,n,r),jy(e,`ZodNumber`,{gt(e,t){return this.check(fv(e,t))},gte(e,t){return this.check(pv(e,t))},min(e,t){return this.check(pv(e,t))},lt(e,t){return this.check(uv(e,t))},lte(e,t){return this.check(dv(e,t))},max(e,t){return this.check(dv(e,t))},int(e){return this.check(ab(e))},safe(e){return this.check(ab(e))},positive(e){return this.check(fv(0,e))},nonnegative(e){return this.check(pv(0,e))},negative(e){return this.check(uv(0,e))},nonpositive(e){return this.check(dv(0,e))},multipleOf(e,t){return this.check(mv(e,t))},step(e,t){return this.check(mv(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function rb(e){return av(nb,e)}var ib=q(`ZodNumberFormat`,(e,t)=>{Wg.init(e,t),nb.init(e,t)});function ab(e){return ov(ib,e)}var ob=q(`ZodBoolean`,(e,t)=>{Gg.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wv(e,t,n,r)});function sb(e){return sv(ob,e)}var cb=q(`ZodUnknown`,(e,t)=>{Kg.init(e,t),My.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function lb(){return cv(cb)}var ub=q(`ZodNever`,(e,t)=>{qg.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gv(e,t,n,r)});function db(e){return lv(ub,e)}var fb=q(`ZodArray`,(e,t)=>{Yg.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xv(e,t,n,r),e.element=t.element,jy(e,`ZodArray`,{min(e,t){return this.check(gv(e,t))},nonempty(e){return this.check(gv(1,e))},max(e,t){return this.check(hv(e,t))},length(e,t){return this.check(_v(e,t))},unwrap(){return this.element}})});function pb(e,t){return Av(fb,e,t)}var mb=q(`ZodObject`,(e,t)=>{e_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zv(e,t,n,r),wm(e,`shape`,()=>t.shape),jy(e,`ZodObject`,{keyof(){return Tb(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:lb()})},loose(){return this.clone({...this._zod.def,catchall:lb()})},strict(){return this.clone({...this._zod.def,catchall:db()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Vm(this,e)},safeExtend(e){return Hm(this,e)},merge(e){return Um(this,e)},pick(e){return zm(this,e)},omit(e){return Bm(this,e)},partial(...e){return Wm(Ab,this,e[0])},required(...e){return Gm(Bb,this,e[0])}})});function hb(e,t){return new mb({type:`object`,shape:e??{},...J(t)})}var gb=q(`ZodUnion`,(e,t)=>{n_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qv(e,t,n,r),e.options=t.options});function _b(e,t){return new gb({type:`union`,options:e,...J(t)})}var vb=q(`ZodDiscriminatedUnion`,(e,t)=>{gb.init(e,t),r_.init(e,t)});function yb(e,t,n){return new vb({type:`union`,options:t,discriminator:e,...J(n)})}var bb=q(`ZodIntersection`,(e,t)=>{i_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$v(e,t,n,r)});function xb(e,t){return new bb({type:`intersection`,left:e,right:t})}var Sb=q(`ZodRecord`,(e,t)=>{s_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ey(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Cb(e,t,n){return!t||!t._zod?new Sb({type:`record`,keyType:Fy(),valueType:e,...J(t)}):new Sb({type:`record`,keyType:e,valueType:t,...J(n)})}var wb=q(`ZodEnum`,(e,t)=>{c_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kv(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new wb({...t,checks:[],...J(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new wb({...t,checks:[],...J(r),entries:i})}});function Tb(e,t){return new wb({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...J(t)})}var Eb=q(`ZodLiteral`,(e,t)=>{l_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qv(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Db(e,t){return new Eb({type:`literal`,values:Array.isArray(e)?e:[e],...J(t)})}var Ob=q(`ZodTransform`,(e,t)=>{u_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yv(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new mm(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Qm(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Qm(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function kb(e){return new Ob({type:`transform`,transform:e})}var Ab=q(`ZodOptional`,(e,t)=>{f_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jb(e){return new Ab({type:`optional`,innerType:e})}var Mb=q(`ZodExactOptional`,(e,t)=>{p_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nb(e){return new Mb({type:`optional`,innerType:e})}var Pb=q(`ZodNullable`,(e,t)=>{m_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ty(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fb(e){return new Pb({type:`nullable`,innerType:e})}var Ib=q(`ZodDefault`,(e,t)=>{h_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ry(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Lb(e,t){return new Ib({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Nm(t)}})}var Rb=q(`ZodPrefault`,(e,t)=>{__.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zb(e,t){return new Rb({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Nm(t)}})}var Bb=q(`ZodNonOptional`,(e,t)=>{v_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ny(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vb(e,t){return new Bb({type:`nonoptional`,innerType:e,...J(t)})}var Hb=q(`ZodCatch`,(e,t)=>{b_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ay(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ub(e,t){return new Hb({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Wb=q(`ZodPipe`,(e,t)=>{x_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oy(e,t,n,r),e.in=t.in,e.out=t.out});function Gb(e,t){return new Wb({type:`pipe`,in:e,out:t})}var Kb=q(`ZodPreprocess`,(e,t)=>{Wb.init(e,t),C_.init(e,t)}),qb=q(`ZodReadonly`,(e,t)=>{w_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jb(e){return new qb({type:`readonly`,innerType:e})}var Yb=q(`ZodCustom`,(e,t)=>{E_.init(e,t),My.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jv(e,t,n,r)});function Xb(e,t={}){return jv(Yb,e,t)}function Zb(e,t){return Mv(e,t)}function Qb(e,t){return new Kb({type:`pipe`,in:kb(e),out:t})}var $b={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},ex;(function(e){})(ex||={}),hb({kind:Tb([`claude-code`,`codex-cli`,`kimi-cli`]),present:sb()});var tx=`claude-code`,nx=`xhigh`,rx=[`low`,`medium`,`high`,`xhigh`],ix=[{kind:`claude-code`,label:`Claude Code`,command:`claude`,installHint:"Install Claude Code so `claude --version` works.",models:[`opus`,`sonnet`,`haiku`],defaultModel:`opus`,reasoningEfforts:rx},{kind:`codex-cli`,label:`Codex CLI`,command:`codex`,installHint:"Install Codex CLI so `codex --version` works.",models:[`gpt-5.5`,`gpt-5.4`,`gpt-5.4-mini`,`gpt-5.3-codex`,`gpt-5.3-codex-spark`,`gpt-5.2`,`gpt-5.2-codex`],defaultModel:`gpt-5.5`,reasoningEfforts:rx},{kind:`kimi-cli`,label:`Kimi CLI`,command:`kimi`,installHint:"Install Kimi CLI so `kimi --version` works.",models:[`kimi-code/kimi-for-coding`],defaultModel:`kimi-code/kimi-for-coding`,reasoningEfforts:[]}];function ax(){return ix.map(e=>({...e,models:[...e.models],reasoningEfforts:[...e.reasoningEfforts]}))}function ox(e){return ix.find(t=>t.kind===e)}function sx(e){return ox(e)?.defaultModel}function cx(e){return ox(e)!==void 0}function lx(e,t){return ox(e)?.models.includes(t)??!1}function ux(e,t){return ox(e)?.reasoningEfforts.includes(t)??!1}var dx=`~/anima-team/agents`;function fx(e,t=dx){return`${t.replace(/\/+$/,``)}/${e}`}var px=1800*1e3,mx=[`ANIMA_AGENT_ID`,`ANIMA_HOME`,`ANIMA_INBOX_ITEM_ID`,`ANIMA_RUNTIME_HOME`,`ANIMA_SLACK_BOT_TOKEN`,`NO_COLOR`,`SLACK_BOT_TOKEN`];function hx(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}var gx=hb({kind:Fy().trim().min(1),model:Fy().trim().min(1),reasoningEffort:Fy().trim().min(1).optional()}).strict().superRefine((e,t)=>{if(!cx(e.kind)){t.addIssue({code:$b.custom,message:`unsupported provider kind ${e.kind}`,path:[`kind`]});return}lx(e.kind,e.model)||t.addIssue({code:$b.custom,message:`unsupported model for ${e.kind}: ${e.model}`,path:[`model`]}),e.reasoningEffort&&!ux(e.kind,e.reasoningEffort)&&t.addIssue({code:$b.custom,message:`unsupported reasoningEffort ${e.reasoningEffort}`,path:[`reasoningEffort`]})});hb({env:Cb(Fy(),Fy().nullable()).optional(),kind:Fy().trim().min(1).optional(),model:Fy().trim().min(1).optional(),reasoningEffort:Fy().trim().min(1).optional()}).strict(),hb({name:Fy().trim().min(1).refine(e=>!!hx(e),{message:`name must include at least one URL-safe letter or number`}),homePath:Fy().trim().min(1),role:Fy().trim().min(1),provider:gx}).strict(),hb({homePath:Fy().trim().min(1)}).strict(),hb({displayName:Fy().trim().min(1).optional(),role:Fy().trim().optional()}).strict().refine(e=>e.displayName!==void 0||e.role!==void 0,{message:`profile update requires displayName or role`}),hb({appToken:Fy().trim().min(1).refine(e=>e.startsWith(`xapp-`),{message:`appToken must start with xapp-`}),botToken:Fy().trim().min(1).refine(e=>e.startsWith(`xoxb-`),{message:`botToken must start with xoxb-`})}).strict(),hb({appToken:Fy().trim().optional(),botToken:Fy().trim().optional()}).strict(),hb({slackUserId:Fy().trim().min(1),openerNote:Fy().optional(),introduce:sb().optional()}).strict();var _x=hb({slackUserId:Fy(),displayName:Fy(),handle:Fy().optional(),avatarUrl:Fy().optional()}).strict();Qb(e=>{let t=vx(e)?e:{},n=typeof t.kind==`string`?t.kind:void 0,r=n&&cx(n)?n:tx;return{...t,...typeof t.idleTimeoutMs==`number`?{}:{idleTimeoutMs:px},kind:r,model:typeof t.model==`string`?t.model:sx(r)}},yb(`kind`,[hb({env:Cb(Fy(),Fy()).optional(),idleTimeoutMs:rb().optional(),kind:Db(`codex-cli`),model:Fy().optional(),reasoningEffort:Fy().optional(),reasoningSummary:Tb([`auto`,`concise`,`detailed`,`none`]).optional()}),hb({env:Cb(Fy(),Fy()).optional(),idleTimeoutMs:rb().optional(),kind:Db(`claude-code`),model:Fy().optional(),reasoningEffort:Fy().optional()}),hb({env:Cb(Fy(),Fy()).optional(),idleTimeoutMs:rb().optional(),kind:Db(`kimi-cli`),model:Fy().optional()})])),hb({appId:Fy().optional(),appToken:Fy().default(``),avatarUrl:Fy().optional(),botToken:Fy().default(``),connected:sb().optional(),manifestVersion:rb().int().nonnegative().default(0),teamId:Fy().default(``),workspaceIconUrl:Fy().default(``),workspaceName:Fy().default(``)}).transform(({appToken:e,botToken:t,connected:n,...r})=>({...r,appToken:e,botToken:t,connected:!!(e&&t)})),_x.extend({onboardingPromptedAt:Fy().optional()}).strict(),Qb(e=>{if(!vx(e))return e;let t={...e};return typeof t.role!=`string`&&typeof t.description==`string`&&(t.role=t.description),delete t.description,t},hb({displayName:Fy().optional(),role:Fy().optional()}).strict().optional()),hb({displayName:Fy(),role:Fy()});function vx(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function yx(e,t){return t?.find(t=>t.kind===e.kind)}function bx(e,t){return!e||!t?!1:yx(e,t)?.present===!0}function xx(e,t){return e.find(e=>bx(e,t))}function Sx(e,t){if(!t)return`checking...`;if(!yx(e,t)?.present)return`not installed`}function Cx(e,t){if(!(!e||!t)&&!yx(e,t)?.present)return e.installHint}function wx(e,t){return t?e.flatMap(e=>{let n=Sx(e,t),r=Cx(e,t);return n&&r?[{kind:e.kind,label:e.label,status:n,hint:r}]:[]}):[]}function Tx(){return typeof window<`u`}function Ex(e){return kx(e)?(e.nodeName||``).toLowerCase():`#document`}function Dx(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ox(e){return((kx(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function kx(e){return Tx()?e instanceof Node||e instanceof Dx(e).Node:!1}function Ax(e){return Tx()?e instanceof Element||e instanceof Dx(e).Element:!1}function jx(e){return Tx()?e instanceof HTMLElement||e instanceof Dx(e).HTMLElement:!1}function Mx(e){return!Tx()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Dx(e).ShadowRoot}function Nx(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Wx(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Px(e){return/^(table|td|th)$/.test(Ex(e))}function Fx(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ix=/transform|translate|scale|rotate|perspective|filter/,Lx=/paint|layout|strict|content/,Rx=e=>!!e&&e!==`none`,zx;function Bx(e){let t=Ax(e)?Wx(e):e;return Rx(t.transform)||Rx(t.translate)||Rx(t.scale)||Rx(t.rotate)||Rx(t.perspective)||!Hx()&&(Rx(t.backdropFilter)||Rx(t.filter))||Ix.test(t.willChange||``)||Lx.test(t.contain||``)}function Vx(e){let t=Kx(e);for(;jx(t)&&!Ux(t);){if(Bx(t))return t;if(Fx(t))return null;t=Kx(t)}return null}function Hx(){return zx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),zx}function Ux(e){return/^(html|body|#document)$/.test(Ex(e))}function Wx(e){return Dx(e).getComputedStyle(e)}function Gx(e){return Ax(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Kx(e){if(Ex(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Mx(e)&&e.host||Ox(e);return Mx(t)?t.host:t}function qx(e){let t=Kx(e);return Ux(t)?e.ownerDocument?e.ownerDocument.body:e.body:jx(t)&&Nx(t)?t:qx(t)}function Jx(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=qx(e),i=r===e.ownerDocument?.body,a=Dx(r);if(i){let e=Yx(a);return t.concat(a,a.visualViewport||[],Nx(r)?r:[],e&&n?Jx(e):[])}else return t.concat(r,Jx(r,[],n))}function Yx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Xx={...v},Zx={};function Qx(e,t){let n=v.useRef(Zx);return n.current===Zx&&(n.current=e(t)),n}var $x=Xx.useInsertionEffect,eS=$x&&$x!==Xx.useLayoutEffect?$x:e=>e();function tS(e){let t=Qx(nS).current;return t.next=e,eS(t.effect),t.trampoline}function nS(){let e={next:void 0,callback:rS,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function rS(){}var Y=typeof document<`u`?v.useLayoutEffect:()=>{};function iS(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var aS={};function oS(e,t,n,r,i){if(!n&&!r&&!i&&!e)return cS(t);let a=cS(e);return t&&(a=lS(a,t)),n&&(a=lS(a,n)),r&&(a=lS(a,r)),i&&(a=lS(a,i)),a}function sS(e){if(e.length===0)return aS;if(e.length===1)return cS(e[0]);let t=cS(e[0]);for(let n=1;n<e.length;n+=1)t=lS(t,e[n]);return t}function cS(e){return pS(e)?{...mS(e,aS)}:uS(e)}function lS(e,t){return pS(t)?mS(t,e):dS(e,t)}function uS(e){let t={...e};for(let e in t){let n=t[e];fS(e,n)&&(t[e]=gS(n))}return t}function dS(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=iS(e.style,r);break;case`className`:e[n]=vS(e.className,r);break;default:fS(n,r)?e[n]=hS(e[n],r):e[n]=r}}return e}function fS(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function pS(e){return typeof e==`function`}function mS(e,t){return pS(e)?e(t):e??aS}function hS(e,t){return t?e?(...n)=>{let r=n[0];if(yS(r)){let i=r;_S(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:gS(t):e}function gS(e){return e&&((...t)=>{let n=t[0];return yS(n)&&_S(n),e(...t)})}function _S(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function vS(e,t){return t?e?t+` `+e:t:e}function yS(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function bS(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var xS=bS(`https://base-ui.com/production-error`,`Base UI`),SS=v.createContext(void 0);function CS(e=!1){let t=v.useContext(SS);if(t===void 0&&!e)throw Error(xS(16));return t}function wS(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:v.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function TS(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=v.useRef(null),s=CS(!0),c=a??s!==void 0,{props:l}=wS({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=v.useCallback(()=>{let e=o.current;ES(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Y(u,[u]),{getButtonProps:v.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return oS({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(_S(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=ES(a),l=!i&&DS(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(_S(e),a?.(e),e.target===e.currentTarget&&i&&c&&ES(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:tS(e=>{o.current=e,u()})}}function ES(e){return jx(e)&&e.tagName===`BUTTON`}function DS(e){return!!(e?.tagName===`A`&&e?.href)}function OS(e,t,n,r){let i=Qx(AS).current;return jS(i,e,t,n,r)&&NS(i,[e,t,n,r]),i.callback}function kS(e){let t=Qx(AS).current;return MS(t,e)&&NS(t,e),t.callback}function AS(){return{callback:null,cleanup:null,refs:[]}}function jS(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function MS(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function NS(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var PS=19;function FS(e){return PS>=e}function IS(e){if(!v.isValidElement(e))return null;let t=e,n=t.props;return(FS(19)?n?.ref:t.ref)??null}function LS(){}var RS=Object.freeze([]),zS=Object.freeze({});function BS(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function VS(e,t){return typeof e==`function`?e(t):e}function HS(e,t){return typeof e==`function`?e(t):e}function US(e,t,n={}){let r=t.render,i=WS(t,n);return n.enabled===!1?null:qS(e,r,i,n.state??zS)}function WS(e,t={}){let{className:n,style:r,render:i}=e,{state:a=zS,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?VS(n,a):void 0,d=l?HS(r,a):void 0,f=l?BS(a,c):zS,p=l&&s?GS(s):void 0,m=l?iS(f,p)??{}:zS;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=kS([m.ref,IS(i),...o]):m.ref=OS(m.ref,IS(i),o):OS(null,null)),l?(u!==void 0&&(m.className=vS(m.className,u)),d!==void 0&&(m.style=iS(m.style,d)),m):zS}function GS(e){return Array.isArray(e)?sS(e):oS(void 0,e)}var KS=Symbol.for(`react.lazy`);function qS(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=oS(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===KS&&(i=v.Children.toArray(t)[0]),v.cloneElement(i,e)}if(e&&typeof e==`string`)return JS(e,n);throw Error(xS(8))}function JS(e,t){return e===`button`?(0,v.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,v.createElement)(`img`,{alt:``,...t,key:t.key}):v.createElement(e,t)}var YS=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=TS({disabled:i,focusableWhenDisabled:a,native:o});return US(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function XS(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=XS(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function ZS(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=XS(e))&&(r&&(r+=` `),r+=t);return r}var QS=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,$S=ZS,eC=(e,t)=>n=>{if(t?.variants==null)return $S(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=QS(t)||QS(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return $S(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},tC=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},nC=(e,t)=>({classGroupId:e,validator:t}),rC=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),iC=`-`,aC=[],oC=`arbitrary..`,sC=e=>{let t=uC(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return lC(e);let n=e.split(iC);return cC(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?tC(i,t):t:i||aC}return n[e]||aC}}},cC=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=cC(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(iC):e.slice(t).join(iC),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},lC=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?oC+r:void 0})(),uC=e=>{let{theme:t,classGroups:n}=e;return dC(n,t)},dC=(e,t)=>{let n=rC();for(let r in e){let i=e[r];fC(i,n,r,t)}return n},fC=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];pC(i,t,n,r)}},pC=(e,t,n,r)=>{if(typeof e==`string`){mC(e,t,n);return}if(typeof e==`function`){hC(e,t,n,r);return}gC(e,t,n,r)},mC=(e,t,n)=>{let r=e===``?t:_C(t,e);r.classGroupId=n},hC=(e,t,n,r)=>{if(vC(e)){fC(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(nC(n,e))},gC=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];fC(o,_C(t,a),n,r)}},_C=(e,t)=>{let n=e,r=t.split(iC),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=rC(),n.nextPart.set(t,i)),n=i}return n},vC=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,yC=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},bC=`!`,xC=`:`,SC=[],CC=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),wC=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===xC){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(bC)?(c=s.slice(0,-1),l=!0):s.startsWith(bC)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return CC(t,l,c,u)};if(t){let e=t+xC,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):CC(SC,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},TC=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},EC=e=>({cache:yC(e.cacheSize),parseClassName:wC(e),sortModifiers:TC(e),postfixLookupClassGroupIds:DC(e),...sC(e)}),DC=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},OC=/\s+/,kC=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(OC),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+bC:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},AC=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=jC(n))&&(i&&(i+=` `),i+=r);return i},jC=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=jC(e[r]))&&(n&&(n+=` `),n+=t);return n},MC=(e,...t)=>{let n,r,i,a,o=o=>(n=EC(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=kC(e,n);return i(e,a),a};return a=o,(...e)=>a(AC(...e))},NC=[],PC=e=>{let t=t=>t[e]||NC;return t.isThemeGetter=!0,t},FC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,IC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,LC=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,RC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,BC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,HC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,UC=e=>LC.test(e),WC=e=>!!e&&!Number.isNaN(Number(e)),GC=e=>!!e&&Number.isInteger(Number(e)),KC=e=>e.endsWith(`%`)&&WC(e.slice(0,-1)),qC=e=>RC.test(e),JC=()=>!0,YC=e=>zC.test(e)&&!BC.test(e),XC=()=>!1,ZC=e=>VC.test(e),QC=e=>HC.test(e),$C=e=>!X(e)&&!Z(e),ew=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),tw=e=>gw(e,bw,XC),X=e=>FC.test(e),nw=e=>gw(e,xw,YC),rw=e=>gw(e,Sw,WC),iw=e=>gw(e,ww,JC),aw=e=>gw(e,Cw,XC),ow=e=>gw(e,vw,XC),sw=e=>gw(e,yw,QC),cw=e=>gw(e,Tw,ZC),Z=e=>IC.test(e),lw=e=>_w(e,xw),uw=e=>_w(e,Cw),dw=e=>_w(e,vw),fw=e=>_w(e,bw),pw=e=>_w(e,yw),mw=e=>_w(e,Tw,!0),hw=e=>_w(e,ww,!0),gw=(e,t,n)=>{let r=FC.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},_w=(e,t,n=!1)=>{let r=IC.exec(e);return r?r[1]?t(r[1]):n:!1},vw=e=>e===`position`||e===`percentage`,yw=e=>e===`image`||e===`url`,bw=e=>e===`length`||e===`size`||e===`bg-size`,xw=e=>e===`length`,Sw=e=>e===`number`,Cw=e=>e===`family-name`,ww=e=>e===`number`||e===`weight`,Tw=e=>e===`shadow`,Ew=MC(()=>{let e=PC(`color`),t=PC(`font`),n=PC(`text`),r=PC(`font-weight`),i=PC(`tracking`),a=PC(`leading`),o=PC(`breakpoint`),s=PC(`container`),c=PC(`spacing`),l=PC(`radius`),u=PC(`shadow`),d=PC(`inset-shadow`),f=PC(`text-shadow`),p=PC(`drop-shadow`),m=PC(`blur`),h=PC(`perspective`),g=PC(`aspect`),_=PC(`ease`),v=PC(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[UC,`full`,`auto`,...w()],E=()=>[GC,`none`,`subgrid`,Z,X],D=()=>[`auto`,{span:[`full`,GC,Z,X]},GC,Z,X],O=()=>[GC,`auto`,Z,X],k=()=>[`auto`,`min`,`max`,`fr`,Z,X],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[UC,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[UC,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[UC,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Z,X],L=()=>[...b(),dw,ow,{position:[Z,X]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,fw,tw,{size:[Z,X]}],B=()=>[KC,lw,nw],V=()=>[``,`none`,`full`,l,Z,X],H=()=>[``,WC,lw,nw],U=()=>[`solid`,`dashed`,`dotted`,`double`],W=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],G=()=>[WC,KC,dw,ow],ee=()=>[``,`none`,m,Z,X],te=()=>[`none`,WC,Z,X],ne=()=>[`none`,WC,Z,X],re=()=>[WC,Z,X],ie=()=>[UC,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[qC],breakpoint:[qC],color:[JC],container:[qC],"drop-shadow":[qC],ease:[`in`,`out`,`in-out`],font:[$C],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[qC],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[qC],shadow:[qC],spacing:[`px`,WC],text:[qC],"text-shadow":[qC],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,UC,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[ew],columns:[{columns:[WC,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[GC,`auto`,Z,X]}],basis:[{basis:[UC,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[WC,UC,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,WC,Z,X]}],shrink:[{shrink:[``,WC,Z,X]}],order:[{order:[GC,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,lw,nw]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,hw,iw]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,KC,X]}],"font-family":[{font:[uw,aw,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[WC,`none`,Z,rw]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...U(),`wavy`]}],"text-decoration-thickness":[{decoration:[WC,`from-font`,`auto`,Z,nw]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[WC,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[GC,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:z()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},GC,Z,X],radial:[``,Z,X],conic:[GC,Z,X]},pw,sw]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":H()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...U(),`hidden`,`none`]}],"divide-style":[{divide:[...U(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...U(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[WC,Z,X]}],"outline-w":[{outline:[``,WC,lw,nw]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,mw,cw]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,mw,cw]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:H()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[WC,nw]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,mw,cw]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[WC,Z,X]}],"mix-blend":[{"mix-blend":[...W(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":W()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[WC]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[WC]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ee()}],brightness:[{brightness:[WC,Z,X]}],contrast:[{contrast:[WC,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,mw,cw]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,WC,Z,X]}],"hue-rotate":[{"hue-rotate":[WC,Z,X]}],invert:[{invert:[``,WC,Z,X]}],saturate:[{saturate:[WC,Z,X]}],sepia:[{sepia:[``,WC,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ee()}],"backdrop-brightness":[{"backdrop-brightness":[WC,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[WC,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,WC,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[WC,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,WC,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[WC,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[WC,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,WC,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[WC,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[WC,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:te()}],"rotate-x":[{"rotate-x":te()}],"rotate-y":[{"rotate-y":te()}],"rotate-z":[{"rotate-z":te()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":[`scale-3d`],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],zoom:[{zoom:[GC,Z,X]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[WC,lw,nw,rw]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Dw(...e){return Ew(ZS(e))}var Ow=eC(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-base font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-11 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-9 gap-1 rounded-[min(var(--radius-md),12px)] px-3 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-12 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-11`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-9 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-12`}},defaultVariants:{variant:`default`,size:`default`}});function kw({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,K.jsx)(YS,{"data-slot":`button`,className:Dw(Ow({variant:t,size:n,className:e})),...r})}var Aw={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},jw={...Aw,position:`fixed`,top:0,left:0},Mw={...Aw,position:`absolute`};function Nw(e){let t=v.useRef(!0);t.current&&(t.current=!1,e())}function Pw(e){let[t,n]=v.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Fw({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=v.useRef(e!==void 0),[a,o]=v.useState(t);return[i?e:a,v.useCallback(e=>{i||o(e)},[])]}function Iw(e){let t=Qx(Lw,e).current;return t.next=e,Y(t.effect),t}function Lw(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Rw=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(xS(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},zw=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Bw=o(((e,t)=>{t.exports=zw()})),Vw=o((e=>{var t=d(),n=Bw();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Hw=o(((e,t)=>{t.exports=Vw()})),Uw=[],Ww=void 0;function Gw(){return Ww}function Kw(e){Uw.push(e)}var qw=Bw(),Jw=Hw(),Yw=FS(19)?Zw:Qw;function Q(e,t,n,r,i){return Yw(e,t,n,r,i)}function Xw(e,t,n,r,i){let a=v.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,qw.useSyncExternalStore)(e.subscribe,a,a)}Kw({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,qw.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Zw(e,t,n,r,i){let a=Gw();if(!a)return Xw(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function Qw(e,t,n,r,i){return(0,Jw.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var $w=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Q(this,e,t,n,r)}},eT=class extends $w{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){v.useDebugValue(e);let n=this;Y(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Y(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Y(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){v.useDebugValue(e);let n=this,r=t!==void 0;Y(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return v.useDebugValue(e),Q(this,this.selectors[e],t,n,r)}useContextCallback(e,t){v.useDebugValue(e);let n=tS(t??LS);this.context[e]=n}useStateSetter(e){let t=v.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function tT(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function nT(e){return e?.ownerDocument||document}function rT(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var iT=[];function aT(e){v.useEffect(e,iT)}var oT=null;globalThis.requestAnimationFrame;var sT=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},cT=class e{static create(){return new e}static request(e){return sT.request(e)}static cancel(e){return sT.cancel(e)}currentId=oT;request(e){this.cancel(),this.currentId=sT.request(()=>{this.currentId=oT,e()})}cancel=()=>{this.currentId!==oT&&(sT.cancel(this.currentId),this.currentId=oT)};disposeEffect=()=>this.cancel};function lT(){let e=Qx(cT.create).current;return aT(e.disposeEffect),e}var uT=0,dT=class e{static create(){return new e}currentId=uT;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=uT,t()},e)}isStarted(){return this.currentId!==uT}clear=()=>{this.currentId!==uT&&(clearTimeout(this.currentId),this.currentId=uT)};disposeEffect=()=>this.clear};function fT(){let e=Qx(dT.create).current;return aT(e.disposeEffect),e}var pT=typeof navigator<`u`,mT=ST(),hT=wT(),gT=CT(),_T=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),vT=mT.platform===`MacIntel`&&mT.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(mT.platform);pT&&/firefox/i.test(gT);var yT=pT&&/apple/i.test(navigator.vendor);pT&&/Edg/i.test(gT);var bT=pT&&/android/i.test(hT)||/android/i.test(gT);pT&&hT.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var xT=gT.includes(`jsdom/`);function ST(){if(!pT)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function CT(){if(!pT)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function wT(){if(!pT)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function TT(e){e.preventDefault(),e.stopPropagation()}function ET(e){return`nativeEvent`in e}function DT(e){return e.pointerType===``&&e.isTrusted?!0:bT&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function OT(e){return xT?!1:!bT&&e.width===0&&e.height===0||bT&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function kT(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function AT(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var jT=`data-base-ui-focusable`,MT=`ArrowLeft`,NT=`ArrowRight`,PT=`ArrowUp`,FT=`ArrowDown`;function IT(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function LT(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Mx(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function RT(e){return`composedPath`in e?e.composedPath()[0]:e.target}function zT(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function BT(e){return e.matches(`html,body`)}function VT(e){return jx(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function HT(e){return e?e.getAttribute(`role`)===`combobox`&&VT(e):!1}function UT(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}var WT=`none`,GT=`trigger-press`,KT=`outside-press`,qT=`item-press`,JT=`focus-out`,YT=`escape-key`,XT=`list-navigation`,ZT=`cancel-open`,QT=`window-resize`;function $T(e,t,n,r){let i=!1,a=!1,o=r??zS;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var eE=v.forwardRef(function(e,t){let[n,r]=v.useState();Y(()=>{yT&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,K.jsx)(`span`,{...e,ref:t,style:jw,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),tE=[`top`,`right`,`bottom`,`left`],nE=Math.min,rE=Math.max,iE=Math.round,aE=Math.floor,oE=e=>({x:e,y:e}),sE={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function cE(e,t,n){return rE(e,nE(t,n))}function lE(e,t){return typeof e==`function`?e(t):e}function uE(e){return e.split(`-`)[0]}function dE(e){return e.split(`-`)[1]}function fE(e){return e===`x`?`y`:`x`}function pE(e){return e===`y`?`height`:`width`}function mE(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function hE(e){return fE(mE(e))}function gE(e,t,n){n===void 0&&(n=!1);let r=dE(e),i=hE(e),a=pE(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=TE(o)),[o,TE(o)]}function _E(e){let t=TE(e);return[vE(e),t,vE(t)]}function vE(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var yE=[`left`,`right`],bE=[`right`,`left`],xE=[`top`,`bottom`],SE=[`bottom`,`top`];function CE(e,t,n){switch(e){case`top`:case`bottom`:return n?t?bE:yE:t?yE:bE;case`left`:case`right`:return t?xE:SE;default:return[]}}function wE(e,t,n,r){let i=dE(e),a=CE(uE(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(vE)))),a}function TE(e){let t=uE(e);return sE[t]+e.slice(t.length)}function EE(e){return{top:0,right:0,bottom:0,left:0,...e}}function DE(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:EE(e)}function OE(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function kE(e,t,n){return Math.floor(e/t)!==n}function AE(e,t){return t<0||t>=e.length}function jE(e,t){return NE(e.current,{disabledIndices:t})}function ME(e,t){return NE(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function NE(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&RE(e,a,r));return a}function PE(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!RE(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=aE(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!RE(e,r,s))return r}};d&&TT(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=NE(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=NE(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}AE(e,f)&&(f=u)}if(n===`both`){let n=aE(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&TT(t),u%o===o-1?r&&(f=NE(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=NE(e,{startingIndex:u,disabledIndices:s}),r&&kE(f,o,n)&&(f=NE(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),kE(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&TT(t),u%o===0?r&&(f=NE(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=NE(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&kE(f,o,n)&&(f=NE(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),kE(f,o,n)&&(f=u));let c=aE(l/o)===n;AE(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:NE(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function FE(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function IE(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function LE(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function RE(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?BE(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function zE(e){return e.visibility===`hidden`||e.visibility===`collapse`}function BE(e,t=e?Wx(e):null){return!e||!e.isConnected||!t||zE(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var VE=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function HE(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return Mx(n)?n.host:null}function UE(e){for(let t of Array.from(e.children))if(Ex(t)===`summary`)return t;return null}function WE(e,t){let n=UE(t);return!!n&&(e===n||LT(n,e))}function GE(e){let t=e?Ex(e):``;return e!=null&&e.matches(VE)&&(t!==`summary`||e.parentElement!=null&&Ex(e.parentElement)===`details`&&UE(e.parentElement)===e)&&(t!==`details`||UE(e)==null)&&(t!==`input`||e.type!==`hidden`)}function KE(e){if(!GE(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=HE(t)){let n=t!==e,r=Ex(t)===`slot`;if(t.hasAttribute(`inert`)||n&&Ex(t)===`details`&&!t.open&&!WE(e,t)||t.hasAttribute(`hidden`)||!r&&!qE(t,n))return!1}return!0}function qE(e,t){let n=Wx(e);return t?n.display!==`none`:BE(e,n)}function JE(e){let t=e.tabIndex;if(t<0){let t=Ex(e);if(t===`details`||t===`audio`||t===`video`||jx(e)&&e.isContentEditable)return 0}return t}function YE(e){if(Ex(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function XE(e,t){let n=YE(e);if(!n)return!0;let r=t.find(e=>{let t=YE(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=YE(e);return t?.name===n.name&&t.form===n.form})===n}function ZE(e){if(jx(e)&&Ex(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return jx(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function QE(e,t){ZE(e).forEach(e=>{GE(e)&&t.push(e),QE(e,t)})}function $E(e,t,n){ZE(e).forEach(e=>{jx(e)&&e.matches(t)&&n.push(e),$E(e,t,n)})}function eD(e){return KE(e)&&JE(e)>=0}function tD(e){let t=[];return QE(e,t),t.filter(KE)}function nD(e){let t=tD(e);return t.filter(e=>JE(e)>=0&&XE(e,t))}function rD(e,t){let n=nD(e),r=n.length;if(r===0)return;let i=IT(nT(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function iD(e){return rD(nT(e).body,1)||e}function aD(e){return rD(nT(e).body,-1)||e}function oD(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!LT(n,r)}function sD(e){nD(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function cD(e){let t=[];$E(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function lD(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...lD(e,t.id,n)])}function uD(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function dD(e){return`data-base-ui-${e}`}var fD=0;function pD(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(fD);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),LS;let o=requestAnimationFrame(a);return fD=o,()=>{fD===o&&(cancelAnimationFrame(o),fD=0)}}var mD={inert:new WeakMap,"aria-hidden":new WeakMap},hD=`data-base-ui-inert`,gD={inert:new WeakSet,"aria-hidden":new WeakSet},_D=new WeakMap,vD=0;function yD(e){return gD[e]}function bD(e){return e?Mx(e)?e.host:bD(e.parentNode):null}var xD=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=bD(t);return e.contains(n)?n:null}).filter(e=>e!=null),SD=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},CD=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{Ex(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function wD(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=xD(t,e),u=i?xD(t,a):[],d=new Set(u),f=i?CD(t,SD(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=mD[o],n=yD(o);c=n,s=e;let r=xD(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);CD(t,SD(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(_D.get(e)||0)+1;_D.set(e,t),m.push(e),t===1&&e.setAttribute(hD,``)}),vD+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(_D.get(e)||0)-1;_D.set(e,t),t||e.removeAttribute(hD)}),--vD,vD||(mD.inert=new WeakMap,mD[`aria-hidden`]=new WeakMap,gD.inert=new WeakSet,gD[`aria-hidden`]=new WeakSet,_D=new WeakMap)}}function TD(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=nT(e[0]).body;return wD(e,o,n,r,{mark:i,markerIgnoreElements:a})}var ED=0;function DD(e,t=`mui`){let[n,r]=v.useState(e),i=e||n;return v.useEffect(()=>{n??(ED+=1,r(`${t}-${ED}`))},[n,t]),i}var OD=Xx.useId;function kD(e,t){if(OD!==void 0){let n=OD();return e??(t?`${t}-${n}`:n)}return DD(e,t)}var AD={style:{transition:`none`}},jD={fallbackAxisSide:`none`},MD={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},ND=v.createContext(null),PD=()=>v.useContext(ND),FD=dD(`portal`);function ID(e={}){let{ref:t,container:n,componentProps:r=zS,elementProps:i}=e,a=kD(),o=PD()?.portalNode,[s,c]=v.useState(null),[l,u]=v.useState(null),d=tS(e=>{e!==null&&u(e)}),f=v.useRef(null);Y(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(kx(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=US(`div`,r,{ref:[t,d],props:[{id:a,[FD]:``},i]});return{portalNode:l,portalSubtree:s&&p?y.createPortal(p,s):null}}var LD=v.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=ID({container:o,ref:t,componentProps:e,elementProps:c}),d=v.useRef(null),f=v.useRef(null),p=v.useRef(null),m=v.useRef(null),[h,g]=v.useState(null),_=v.useRef(!1),b=h?.modal,x=h?.open,S=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;v.useEffect(()=>{if(!l||b)return;function e(e){l&&e.relatedTarget&&oD(e)&&(e.type===`focusin`?_.current&&=(cD(l),!1):(sD(l),_.current=!0))}return tT(rT(l,`focusin`,e,!0),rT(l,`focusout`,e,!0))},[l,b]),v.useEffect(()=>{!l||x!==!1||(cD(l),_.current=!1)},[x,l]);let C=v.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,K.jsxs)(v.Fragment,{children:[u,(0,K.jsxs)(ND.Provider,{value:C,children:[S&&l&&(0,K.jsx)(eE,{"data-type":`outside`,ref:d,onFocus:e=>{oD(e,l)?p.current?.focus():aD(h?h.domReference:null)?.focus()}}),S&&l&&(0,K.jsx)(`span`,{"aria-owns":l.id,style:MD}),l&&y.createPortal(a,l),S&&l&&(0,K.jsx)(eE,{"data-type":`outside`,ref:f,onFocus:e=>{oD(e,l)?m.current?.focus():(iD(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,$T(`focus-out`,e.nativeEvent)))}})]})]})});function RD(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var zD=v.createContext(null),BD=v.createContext(null),VD=()=>v.useContext(zD)?.id||null,HD=e=>{let t=v.useContext(BD);return e??t};function UD(e){return e==null?e:`current`in e?e.current:e}function WD(e,t){let n=Dx(RT(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var GD=20,KD=[];function qD(){KD=KD.filter(e=>e.deref()?.isConnected)}function JD(e){qD(),e&&Ex(e)!==`body`&&(KD.push(new WeakRef(e)),KD.length>GD&&(KD=KD.slice(-20)))}function YD(){return qD(),KD[KD.length-1]?.deref()}function XD(e){return e?eD(e)?e:nD(e)[0]||e:null}function ZD(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=tD(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return eD(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function QD(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),y=h.useState(`floatingElement`),{events:b,dataRef:x}=h.context,S=tS(()=>x.current.floatingContext?.nodeId),C=i===!1,w=HT(_)&&C,T=v.useRef([`content`]),E=Iw(i),D=Iw(a),O=Iw(l),k=HD(p),A=PD(),j=v.useRef(!1),M=v.useRef(!1),N=v.useRef(!1),P=v.useRef(null),F=v.useRef(``),I=v.useRef(``),L=v.useRef(null),R=v.useRef(null),z=OS(L,f,A?.beforeInsideRef),B=OS(R,A?.afterInsideRef),V=fT(),H=fT(),U=lT(),W=A!=null,G=UT(y),ee=tS((e=G)=>e?nD(e):[]),te=tS(()=>m?.().filter(e=>e!=null)??[]);v.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&<(G,IT(nT(G)))&&ee().length===0&&!w&&TT(e)}return rT(nT(G),`keydown`,e)},[r,G,s,w,ee]),v.useEffect(()=>{if(r||!g)return;let e=nT(G);function t(){N.current=!1}function n(e){let t=RT(e),n=te();N.current=!(LT(y,t)||LT(_,t)||LT(A?.portalNode,t)||n.some(e=>e===t||LT(e,t))),I.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(M.current=!0)}function i(){I.current=`keyboard`}return tT(rT(e,`pointerdown`,n,!0),rT(e,`pointerup`,t,!0),rT(e,`pointercancel`,t,!0),rT(e,`keydown`,i,!0))},[r,y,_,G,g,A,te]),v.useEffect(()=>{if(r||!c)return;let e=nT(G);function t(){M.current=!0,H.start(0,()=>{M.current=!1})}function n(e){let t=RT(e);eD(t)&&(P.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=RT(t);queueMicrotask(()=>{let a=S(),c=h.context.triggerElements,l=te(),f=n?.hasAttribute(dD(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,UD(d),UD(u)].includes(n),p=!(LT(_,n)||LT(y,n)||LT(n,y)||LT(A?.portalNode,n)||l.some(e=>e===n||LT(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>LT(e,n))||f||k&&(lD(k.nodesRef.current,a).find(e=>LT(e.context?.elements.floating,n)||LT(e.context?.elements.domReference,n))||uD(k.nodesRef.current,a).find(e=>[e.context?.elements.floating,UT(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&G&&ZD(G,T),o&&r!==_&&!BE(i)&&IT(e)===e.body){if(jx(G)&&(G.focus(),o===`popup`)){U.request(()=>{G.focus()});return}let e=ee(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||G;jx(n)&&n.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(w||!s)&&n&&p&&!M.current&&(w||n!==YD())&&(j.current=!0,h.setOpen(!1,$T(JT,t)))})}function a(){N.current||(x.current.insideReactTree=!0,V.start(0,()=>{x.current.insideReactTree=!1}))}let l=jx(_)?_:null;if(!(!y&&!l))return tT(l&&rT(l,`focusout`,i),l&&rT(l,`pointerdown`,t),y&&rT(y,`focusin`,n),y&&rT(y,`focusout`,i),y&&A&&rT(y,`focusout`,a,!0))},[r,_,y,G,s,k,A,h,c,o,ee,w,S,T,x,V,H,U,u,d,te]),v.useEffect(()=>{if(r||!y||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${dD(`portal`)}]`)||[]),t=(k?uD(k.nodesRef.current,S()):[]).find(e=>HT(e.context?.elements.domReference||null))?.context?.elements.domReference,n=TD([y,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...te(),t,UD(d),UD(u),w?_:null].filter(e=>e!=null),{ariaHidden:s||w,mark:!1}),i=TD([y,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,y,s,A,w,k,S,u,d,te]),Y(()=>{if(!g||r||!jx(G))return;let e=nT(G),t=IT(e);queueMicrotask(()=>{let n=E.current,r=typeof n==`function`?n(O.current||``):n;if(r===void 0||r===!1||LT(G,t))return;let i=null,a=()=>(i??=ee(G),i[0]||G),o;o=r===!0||r===null?a():UD(r),o||=a();let s=LT(G,IT(e));pD(o,{preventScroll:o===G,shouldFocus(){if(s)return!0;let t=IT(e);return!(t!==o&<(G,t))}})})},[r,g,G,ee,E,O]),Y(()=>{if(r||!G)return;let e=nT(G);JD(IT(e));function t(e){if(e.open||(F.current=WD(e.nativeEvent,I.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(j.current=!0),e.reason===`outside-press`)if(e.nested)j.current=!1;else if(DT(e.nativeEvent)||OT(e.nativeEvent))j.current=!1;else{let e=!1;nT(G).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}b.on(`openchange`,t);function n(){let e=D.current,t=typeof e==`function`?e(F.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`)return _?.isConnected?_:YD()||null;let n=_?.isConnected?_:YD();return UD(t)||n||null}return()=>{b.off(`openchange`,t);let r=IT(e),i=te(),a=LT(y,r)||i.some(e=>e===r||LT(e,r))||k&&lD(k.nodesRef.current,S(),!1).some(e=>LT(e.context?.elements.floating,r)),o=D.current,s=n();queueMicrotask(()=>{let t=XD(s),n=typeof o!=`boolean`;o&&!j.current&&jx(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),j.current=!1})}},[r,y,G,D,b,k,_,S,te]),Y(()=>{if(!_T||g||!y)return;let e=IT(nT(y));!jx(e)||!VT(e)||LT(y,e)&&e.blur()},[g,y]),Y(()=>{if(!(r||!A))return A.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,s,g,h,c,_]),Y(()=>{if(!(r||!G))return ZD(G,T),()=>{queueMicrotask(qD)}},[r,G,T]);let ne=!r&&(s?!w:!0)&&(W||s);return(0,K.jsxs)(v.Fragment,{children:[ne&&(0,K.jsx)(eE,{"data-type":`inside`,ref:z,onFocus:e=>{if(s){let e=ee();pD(e[e.length-1])}else A?.portalNode&&(j.current=!1,oD(e,A.portalNode)?iD(_)?.focus():UD(d??A.beforeOutsideRef)?.focus())}}),n,ne&&(0,K.jsx)(eE,{"data-type":`inside`,ref:B,onFocus:e=>{s?pD(ee()[0]):A?.portalNode&&(c&&(j.current=!0),oD(e,A.portalNode)?aD(_)?.focus():UD(u??A.afterOutsideRef)?.focus())}})]})}function $D(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=GT}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=v.useRef(void 0),f=lT(),p=fT(),m=v.useMemo(()=>{function e(e,t,n,r){let i=$T(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||kT(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=RT(o);if(VT(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}kT(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return v.useMemo(()=>n?{reference:m}:zS,[n,m])}var eO={intentional:`onClick`,sloppy:`onPointerDown`};function tO(){return!1}function nO(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function rO(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=tO,referencePressEvent:s=`sloppy`,bubbles:c,externalTree:l}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=u.useState(`floatingElement`),{dataRef:p}=u.context,m=HD(l),h=tS(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,y=tS(()=>a),{escapeKey:b,outsidePress:x}=nO(c),S=v.useRef(!1),C=v.useRef(!1),w=v.useRef(!1),T=v.useRef(!1),E=v.useRef(``),D=v.useRef(null),O=fT(),k=fT(),A=tS(()=>{k.clear(),p.current.insideReactTree=!1}),j=tS(e=>{let t=p.current.floatingContext?.nodeId;return(m?lD(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=tS(e=>zT(e,u.select(`floatingElement`))||zT(e,u.select(`domReferenceElement`))),N=tS(e=>{o()&&u.setOpen(!1,$T(GT,e.nativeEvent))}),P=tS(e=>{if(!d||!n||!r||e.key!==`Escape`||T.current||!b&&j(`__escapeKeyBubbles`))return;let t=$T(YT,ET(e)?e.nativeEvent:e);u.setOpen(!1,t),t.isCanceled||e.preventDefault(),!b&&!t.isPropagationAllowed&&e.stopPropagation()}),F=tS(()=>{p.current.insideReactTree=!0,k.start(0,A)}),I=tS(e=>{if(!d||!n||e.button!==0)return;let t=RT(e.nativeEvent);LT(u.select(`floatingElement`),t)&&(S.current||(S.current=!0,C.current=!1))}),L=tS(e=>{!d||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&S.current&&(C.current=!0)});v.useEffect(()=>{if(!d||!n)return;p.current.__escapeKeyBubbles=b,p.current.__outsidePressBubbles=x;let e=new dT,t=new dT;function i(){e.clear(),T.current=!0}function a(){e.start(Hx()?5:0,()=>{T.current=!1})}function o(){w.current=!0,t.start(0,()=>{w.current=!1})}function s(){S.current=!1,C.current=!1}function c(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=y(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function l(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=p.current.floatingContext?.nodeId,n=m&&lD(m.nodesRef.current,t).some(t=>zT(e,t.context?.elements.floating));return M(e)||n}function v(e){if(l(e)){e.type!==`click`&&!M(e)&&(t.clear(),w.current=!1),A();return}if(p.current.insideReactTree){A();return}let n=RT(e),r=`[${dD(`inert`)}]`,i=Ax(n)?n.getRootNode():null,a=Array.from((Mx(i)?i:nT(u.select(`floatingElement`))).querySelectorAll(r)),o=u.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>LT(e,n))))return;let s=Ax(n)?n:null;for(;s&&!Ux(s);){let e=Kx(s);if(Ux(e)||!Ax(e))break;s=e}if(!(a.length&&Ax(n)&&!BT(n)&&!LT(n,u.select(`floatingElement`))&&a.every(e=>!LT(s,e)))){if(jx(n)&&!(`touches`in e)){let t=Ux(n),r=Wx(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!h(e)){if(c()===`intentional`&&w.current){t.clear(),w.current=!1;return}typeof g==`function`&&!g(e)||j(`__outsidePressBubbles`)||(u.setOpen(!1,$T(KT,e)),A())}}}function k(e){c()!==`sloppy`||e.pointerType===`touch`||!u.select(`open`)||!n||M(e)||v(e)}function N(e){if(c()!==`sloppy`||!u.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=RT(e);if(!n)return;let r=rT(n,e.type,()=>{t(e),r()})}function I(e){E.current=`touch`,F(e,N)}function L(e){O.clear(),e.type===`pointerdown`&&(E.current=e.pointerType),!(e.type===`mousedown`&&D.current&&!D.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?k(e):v(e)})}function R(e){if(!S.current)return;let n=C.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!h(e)){if(n){o();return}typeof g==`function`&&!g(e)||(t.clear(),w.current=!0,A())}}}function z(e){if(c()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(v(e),O.clear(),D.current=null)}function B(e){F(e,z)}function V(e){c()!==`sloppy`||!D.current||M(e)||(D.current.dismissOnTouchEnd&&v(e),O.clear(),D.current=null)}function H(e){F(e,V)}let U=nT(f),W=tT(r&&tT(rT(U,`keydown`,P),rT(U,`compositionstart`,i),rT(U,`compositionend`,a)),_&&tT(rT(U,`click`,L,!0),rT(U,`pointerdown`,L,!0),rT(U,`pointerup`,R,!0),rT(U,`pointercancel`,R,!0),rT(U,`mousedown`,L,!0),rT(U,`mouseup`,R,!0),rT(U,`touchstart`,I,!0),rT(U,`touchmove`,B,!0),rT(U,`touchend`,H,!0)));return()=>{W(),e.clear(),t.clear(),s(),w.current=!1}},[p,f,r,_,g,d,n,b,x,P,A,y,j,M,m,u,O]),v.useEffect(A,[g,A]);let R=v.useMemo(()=>({onKeyDown:P,[eO[s]]:N,...s!==`intentional`&&{onClick:N}}),[P,N,s]),z=v.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return v.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}function iO(e,t,n){let{reference:r,floating:i}=e,a=mE(t),o=hE(t),s=pE(o),c=uE(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(dE(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function aO(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=lE(t,e),p=DE(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=OE(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=OE(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var oO=50,sO=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:aO},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iO(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<oO&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=iO(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cO=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=lE(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=uE(r),_=mE(o),v=uE(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[TE(o)]:_E(o)),x=p!==`none`;!d&&x&&b.push(...wE(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=gE(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==mE(t))||T.every(e=>mE(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=mE(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function lO(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uO(e){return tE.some(t=>e[t]>=0)}var dO=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=lE(e,t);switch(i){case`referenceHidden`:{let e=lO(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uO(e)}}}case`escaped`:{let e=lO(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uO(e)}}}default:return{}}}}},fO=new Set([`left`,`top`]);async function pO(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=uE(n),s=dE(n),c=mE(n)===`y`,l=fO.has(o)?-1:1,u=a&&c?-1:1,d=lE(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var mO=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await pO(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},hO=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=lE(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=mE(uE(i)),p=fE(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=cE(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=cE(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},gO=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=lE(e,t),u={x:n,y:r},d=mE(i),f=fE(d),p=u[f],m=u[d],h=lE(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=fO.has(uE(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},_O=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=lE(e,t),u=await o.detectOverflow(t,l),d=uE(i),f=dE(i),p=mE(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=nE(h-u[g],v),x=nE(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=rE(u.left,0),t=rE(u.right,0),n=rE(u.top,0),r=rE(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:rE(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:rE(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function vO(e){let t=Wx(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=jx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=iE(n)!==a||iE(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function yO(e){return Ax(e)?e:e.contextElement}function bO(e){let t=yO(e);if(!jx(t))return oE(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vO(t),o=(a?iE(n.width):n.width)/r,s=(a?iE(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var xO=oE(0);function SO(e){let t=Dx(e);return!Hx()||!t.visualViewport?xO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function CO(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Dx(e)?!1:t}function wO(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=yO(e),o=oE(1);t&&(r?Ax(r)&&(o=bO(r)):o=bO(e));let s=CO(a,n,r)?SO(a):oE(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Dx(a),t=r&&Ax(r)?Dx(r):r,n=e,i=Yx(n);for(;i&&r&&t!==n;){let e=bO(i),t=i.getBoundingClientRect(),r=Wx(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Dx(i),i=Yx(n)}}return OE({width:u,height:d,x:c,y:l})}function TO(e,t){let n=Gx(e).scrollLeft;return t?t.left+n:wO(Ox(e)).left+n}function EO(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-TO(e,n),y:n.top+t.scrollTop}}function DO(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ox(r),s=t?Fx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=oE(1),u=oE(0),d=jx(r);if((d||!d&&!a)&&((Ex(r)!==`body`||Nx(o))&&(c=Gx(r)),d)){let e=wO(r);l=bO(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?EO(o,c):oE(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function OO(e){return Array.from(e.getClientRects())}function kO(e){let t=Ox(e),n=Gx(e),r=e.ownerDocument.body,i=rE(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=rE(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+TO(e),s=-n.scrollTop;return Wx(r).direction===`rtl`&&(o+=rE(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var AO=25;function jO(e,t){let n=Dx(e),r=Ox(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Hx();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=TO(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=AO&&(a-=o)}else l<=AO&&(a+=l);return{width:a,height:o,x:s,y:c}}function MO(e,t){let n=wO(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=jx(e)?bO(e):oE(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function NO(e,t,n){let r;if(t===`viewport`)r=jO(e,n);else if(t===`document`)r=kO(Ox(e));else if(Ax(t))r=MO(t,n);else{let n=SO(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return OE(r)}function PO(e,t){let n=Kx(e);return n===t||!Ax(n)||Ux(n)?!1:Wx(n).position===`fixed`||PO(n,t)}function FO(e,t){let n=t.get(e);if(n)return n;let r=Jx(e,[],!1).filter(e=>Ax(e)&&Ex(e)!==`body`),i=null,a=Wx(e).position===`fixed`,o=a?Kx(e):e;for(;Ax(o)&&!Ux(o);){let t=Wx(o),n=Bx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Nx(o)&&!n&&PO(e,o))?r=r.filter(e=>e!==o):i=t,o=Kx(o)}return t.set(e,r),r}function IO(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Fx(t)?[]:FO(t,this._c):[].concat(n),r],o=NO(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=NO(t,a[e],i);s=rE(n.top,s),c=nE(n.right,c),l=nE(n.bottom,l),u=rE(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function LO(e){let{width:t,height:n}=vO(e);return{width:t,height:n}}function RO(e,t,n){let r=jx(t),i=Ox(t),a=n===`fixed`,o=wO(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=oE(0);function l(){c.x=TO(i)}if(r||!r&&!a)if((Ex(t)!==`body`||Nx(i))&&(s=Gx(t)),r){let e=wO(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?EO(i,s):oE(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function zO(e){return Wx(e).position===`static`}function BO(e,t){if(!jx(e)||Wx(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ox(e)===n&&(n=n.ownerDocument.body),n}function VO(e,t){let n=Dx(e);if(Fx(e))return n;if(!jx(e)){let t=Kx(e);for(;t&&!Ux(t);){if(Ax(t)&&!zO(t))return t;t=Kx(t)}return n}let r=BO(e,t);for(;r&&Px(r)&&zO(r);)r=BO(r,t);return r&&Ux(r)&&zO(r)&&!Bx(r)?n:r||Vx(e)||n}var HO=async function(e){let t=this.getOffsetParent||VO,n=this.getDimensions,r=await n(e.floating);return{reference:RO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function UO(e){return Wx(e).direction===`rtl`}var WO={convertOffsetParentRelativeRectToViewportRelativeRect:DO,getDocumentElement:Ox,getClippingRect:IO,getOffsetParent:VO,getElementRects:HO,getClientRects:OO,getDimensions:LO,getScale:bO,isElement:Ax,isRTL:UO};function GO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function KO(e,t){let n=null,r,i=Ox(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=aE(d),h=aE(i.clientWidth-(u+f)),g=aE(i.clientHeight-(d+p)),_=aE(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:rE(0,nE(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!GO(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function qO(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=yO(e),u=i||a?[...l?Jx(l):[],...t?Jx(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?KO(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?wO(e):null;c&&g();function g(){let t=wO(e);h&&!GO(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var JO=mO,YO=hO,XO=cO,ZO=_O,QO=dO,$O=gO,ek=(e,t,n)=>{let r=new Map,i={platform:WO,...n},a={...i.platform,_c:r};return sO(e,t,{...i,platform:a})},tk=typeof document<`u`?v.useLayoutEffect:function(){};function nk(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!nk(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!nk(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function rk(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ik(e,t){let n=rk(e);return Math.round(t*n)/n}function ak(e){let t=v.useRef(e);return tk(()=>{t.current=e}),t}function ok(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);nk(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),b=v.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=v.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),S=a||m,C=o||g,w=v.useRef(null),T=v.useRef(null),E=v.useRef(u),D=c!=null,O=ak(c),k=ak(i),A=ak(l),j=v.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),ek(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!nk(E.current,t)&&(E.current=t,y.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);tk(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=v.useRef(!1);tk(()=>(M.current=!0,()=>{M.current=!1}),[]),tk(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=v.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=v.useMemo(()=>({reference:S,floating:C}),[S,C]),F=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=ik(P.floating,u.x),r=ik(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...rk(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var sk=(e,t)=>{let n=JO(e);return{name:n.name,fn:n.fn,options:[e,t]}},ck=(e,t)=>{let n=YO(e);return{name:n.name,fn:n.fn,options:[e,t]}},lk=(e,t)=>({fn:$O(e).fn,options:[e,t]}),uk=(e,t)=>{let n=XO(e);return{name:n.name,fn:n.fn,options:[e,t]}},dk=(e,t)=>{let n=ZO(e);return{name:n.name,fn:n.fn,options:[e,t]}},fk=(e,t)=>{let n=QO(e);return{name:n.name,fn:n.fn,options:[e,t]}},pk={open:Rw(e=>e.open),transitionStatus:Rw(e=>e.transitionStatus),domReferenceElement:Rw(e=>e.domReferenceElement),referenceElement:Rw(e=>e.positionReference??e.referenceElement),floatingElement:Rw(e=>e.floatingElement),floatingId:Rw(e=>e.floatingId)},mk=class extends eT{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:RD(),nested:n,triggerElements:i},pk),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&AT(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function hk(e,t=!1,n=!1){let[r,i]=v.useState(e&&t?`idle`:void 0),[a,o]=v.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Y(()=>{if(!e&&a&&r!==`ending`&&n){let e=cT.request(()=>{i(`ending`)});return()=>{cT.cancel(e)}}},[e,a,r,n]),Y(()=>{if(!e||t)return;let n=cT.request(()=>{i(void 0)});return()=>{cT.cancel(n)}},[t,e]),Y(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=cT.request(()=>{i(`idle`)});return()=>{cT.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var gk=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),_k={[gk.startingStyle]:``},vk={[gk.endingStyle]:``},yk={transitionStatus(e){return e===`starting`?_k:e===`ending`?vk:null}};function bk(e,t=!1,n=!0){let r=lT();return tS((i,a=null)=>{r.cancel();let o=UD(e);if(o==null)return;let s=o,c=()=>{y.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=gk.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function xk(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=tS(i),o=bk(r,n,!1);v.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var Sk={tabIndex:-1,[jT]:``},Ck=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function wk(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=kD(),a=VD()!=null,o=Qx(()=>new mk({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ck,floatingId:i,syncOnly:!1,nested:a})).current;return Y(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=Ax(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Tk(e={}){let{nodeId:t,externalTree:n}=e,r=wk(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=v.useState(null),[f,p]=v.useState(void 0),[m,h]=v.useState(void 0),g=v.useRef(null),_=HD(n),y=v.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),b=ok({...e,elements:{...y,...u&&{reference:u}}}),x=Ax(f)?f:null,S=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:x),i.useSyncedValue(`floatingElement`,S);let C=v.useCallback(e=>{let t=Ax(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),b.refs.setReference(t)},[b.refs]),w=v.useCallback(e=>{(Ax(e)||e===null)&&(g.current=e,p(e)),(Ax(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!Ax(e))&&b.refs.setReference(e)},[b.refs,p]),T=v.useCallback(e=>{h(e),b.refs.setFloating(e)},[b.refs]),E=v.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:g}),[b.refs,w,T,C]),D=v.useMemo(()=>({...b.elements,domReference:s}),[b.elements,s]),O=v.useMemo(()=>({...b,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,c,l]);return Y(()=>{s&&(g.current=s)},[s]),Y(()=>{i.context.dataRef.current.floatingContext=O;let e=_?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),v.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var Ek=`Escape`;function Dk(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Ok(e,t){return Dk(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function kk(e,t,n){return Dk(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Ak(e,t,n){return Dk(t,n?e===MT:e===NT,e===FT)}function jk(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===Ek:Dk(t,n?e===NT:e===MT,e===PT)}function Mk(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,cols:y=1,id:b,resetOnPointerLeave:x=!0,externalTree:S}=t,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=UT(T),k=HT(E),A=Iw(O),j=VD(),M=HD(S),N=v.useRef(f),P=v.useRef(o??-1),F=v.useRef(null),I=v.useRef(!0),L=tS(e=>{i(P.current===-1?null:P.current,e)}),R=v.useRef(L),z=v.useRef(!!T),B=v.useRef(w),V=v.useRef(!1),H=v.useRef(!1),U=v.useRef(null),W=Iw(h),G=Iw(w),ee=Iw(o),te=Iw(x),ne=lT(),re=lT(),ie=tS(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):U.current=pD(e,{sync:V.current,preventScroll:!0})}let t=n.current[P.current],r=H.current;t&&e(t),(V.current?e=>e():e=>ne.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),ue&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Y(()=>{D.current.orientation=g},[D,g]),Y(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(H.current=!0,L())):z.current&&(P.current=-1,R.current()))},[a,w,T,o,L]),Y(()=>{if(a){if(!w){V.current=!1;return}if(T)if(r==null){if(V.current=!1,ee.current!=null)return;if(z.current&&(P.current=-1,ie()),(!B.current||!z.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>re.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||kk(F.current,g,u)||l?jE(n):ME(n),F.current=null,L())};t()}}else AE(n.current,r)||(P.current=r,ie(),H.current=!1)}},[a,w,T,r,ee,l,n,g,u,L,ie,re]),Y(()=>{if(!a||T||!M||d||!z.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=IT(nT(T)),r=e.some(e=>e.context&<(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,M,j,d]),Y(()=>{R.current=L,B.current=w,z.current=!!T}),Y(()=>{w||(F.current=null,N.current=f)},[w,f]);let ae=r!=null,oe=tS(e=>{if(!G.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),se=tS(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),ce=tS(()=>jE(n,W.current)),le=tS(e=>{if(I.current=!1,V.current=!0,e.which===229||!G.current&&e.currentTarget===A.current)return;if(l&&jk(e.key,g,u,y)){Ok(e.key,se())||TT(e),C.setOpen(!1,$T(XT,e.nativeEvent)),jx(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=jE(n,h),i=ME(n,h);if(k||(e.key===`Home`&&(TT(e),P.current=r,L(e)),e.key===`End`&&(TT(e),P.current=i,L(e))),y>1){let t=Array.from({length:n.current.length},()=>({width:1,height:1})),a=FE(t,y,!1),o=a.findIndex(e=>e!=null&&!RE(n.current,e,h)),s=a.reduce((e,t,r)=>t!=null&&!RE(n.current,t,h)?r:e,-1),l=a[PE(a.map(e=>e==null?null:n.current[e]),{event:e,orientation:g,loopFocus:c,rtl:u,cols:y,disabledIndices:LE([...(typeof h==`function`?null:h)||n.current.map((e,t)=>RE(n.current,t,h)?t:void 0),void 0],a),minIndex:o,maxIndex:s,prevIndex:IE(P.current>i?r:P.current,t,a,y,e.key===`ArrowDown`?`bl`:e.key===(u?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(l!=null&&(P.current=l,L(e)),g===`both`)return}if(Ok(e.key,g)){if(TT(e),w&&!d&&IT(e.currentTarget.ownerDocument)===e.currentTarget){P.current=kk(e.key,g,u)?r:i,L(e);return}kk(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(V.current=!1,P.current=r):P.current=NE(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,NE(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(V.current=!1,P.current=i):P.current=NE(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,NE(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),AE(n.current,P.current)&&(P.current=-1),L(e)}}),ue=v.useMemo(()=>({onFocus(e){V.current=!0,oe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){V.current=!0,H.current=!1,p&&oe(e)},onPointerLeave(e){if(!G.current||!I.current||e.pointerType===`touch`)return;V.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&te.current&&(U.current?.(),U.current=null,P.current=-1,L(e),!d)){let e=A.current,t=IT(nT(e));e&<(e,t)&&e.focus({preventScroll:!0})}}}),[oe,G,A,p,n,L,te,d]),de=v.useMemo(()=>d&&w&&ae&&{"aria-activedescendant":`${b}-${r}`},[d,w,ae,b,r]),fe=v.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...k?{}:de,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=RT(e.nativeEvent);if(t&&!LT(A.current,t))return;TT(e),C.setOpen(!1,$T(JT,e.nativeEvent)),jx(E)&&E.focus();return}le(e)},onPointerMove(){I.current=!0}}),[de,le,A,g,k,C,w,d,E]),pe=v.useMemo(()=>{function e(e){C.setOpen(!0,$T(XT,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&DT(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&OT(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=Ak(t.key,se(),u),a=Ok(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return le(t);if(!(!n&&!m&&r)){if(o){let e=Ok(t.key,se());F.current=l&&e?null:t.key}if(l){i&&(TT(t),n?(P.current=ce(),L(t)):e(t));return}a&&(ee.current!=null&&(P.current=ee.current),TT(t),!n&&m?e(t):le(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[le,f,ce,l,L,C,m,g,se,u,ee,d]),me=v.useMemo(()=>({...de,...pe}),[de,pe]);return v.useMemo(()=>a?{reference:me,floating:fe,item:ue,trigger:pe}:{},[a,me,fe,pe,ue])}function Nk(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,onTyping:o,enabled:s=!0,resetMs:c=750,selectedIndex:l=null}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=fT(),p=v.useRef(``),m=v.useRef(l??i??-1),h=v.useRef(null),g=tS(e=>{function t(e){let t=r?.current[e];return!t||BE(t)}function s(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let u=n.current;if(p.current.length>0&&e.key===` `&&(TT(e),o?.(!0)),p.current.length>0&&p.current[0]!==` `&&s(u,p.current)===-1&&e.key!==` `&&o?.(!1),u==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;d&&e.key!==` `&&(TT(e),o?.(!0));let g=p.current===``;g&&(m.current=l??i??-1),u.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&p.current===e.key&&(p.current=``,m.current=h.current),p.current+=e.key,f.start(c,()=>{p.current=``,m.current=h.current,o?.(!1)});let _=((g?l??i??-1:m.current)??0)+1,v=s(u,p.current,_);v===-1?e.key!==` `&&(p.current=``,o?.(!1)):(a?.(v),h.current=v)}),_=tS(e=>{let t=e.relatedTarget,n=u.select(`domReferenceElement`),r=u.select(`floatingElement`);LT(n,t)||LT(r,t)||(f.clear(),p.current=``,m.current=h.current,o?.(!1))});Y(()=>{!d&&l!==null||(f.clear(),h.current=null,p.current!==``&&(p.current=``))},[d,l,f]),Y(()=>{d&&p.current===``&&(m.current=l??i??-1)},[d,l,i]);let y=v.useMemo(()=>({onKeyDown:g,onBlur:_}),[g,_]);return v.useMemo(()=>s?{reference:y,floating:y}:{},[s,y])}var Pk=v.createContext(null),Fk=v.createContext(null);function Ik(){let e=v.useContext(Pk);if(e===null)throw Error(xS(60));return e}function Lk(){let e=v.useContext(Fk);if(e===null)throw Error(xS(61));return e}var Rk=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),zk={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Bk={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Vk={disabled:!1,...Bk},Hk={valid(e){return e===null?null:e?{[Rk.valid]:``}:{[Rk.invalid]:``}}},Uk={invalid:void 0,name:void 0,validityData:{state:zk,errors:[],error:``,value:``,initialValue:null},setValidityData:LS,disabled:void 0,touched:Bk.touched,setTouched:LS,dirty:Bk.dirty,setDirty:LS,filled:Bk.filled,setFilled:LS,focused:Bk.focused,setFocused:LS,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Vk,markedDirtyRef:{current:!1},registerFieldControl:LS,validation:{getValidationProps:(e=zS)=>e,getInputValidationProps:(e=zS)=>e,inputRef:{current:null},commit:async()=>{}}},Wk=v.createContext(Uk);function Gk(e=!0){let t=v.useContext(Wk);if(t.setValidityData===LS&&!e)throw Error(xS(28));return t}function Kk(e,t,n,r,i=!0){let{registerFieldControl:a}=Gk(),o=v.useRef(null);o.current||=Symbol(),Y(()=>{let s=o.current;if(!(!s||!i))return a(s,{controlRef:e,getValue:r,id:t,value:n}),()=>{a(s,void 0)}},[e,i,r,t,a,n])}function qk(e){return kD(e,`base-ui`)}var Jk=v.createContext({controlId:void 0,registerControlId:LS,labelId:void 0,setLabelId:LS,messageIds:[],setMessageIds:LS,getDescriptionProps:e=>e});function Yk(){return v.useContext(Jk)}function Xk(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=Yk(),o=qk(t),s=n?i:void 0,c=Qx(()=>Symbol(`labelable-control`)),l=v.useRef(!1),u=v.useRef(t!=null),d=tS(()=>{!l.current||a===LS||(l.current=!1,a(c.current,void 0))});return Y(()=>{if(a===LS)return;let e;if(n){let n=r?.current;e=Ax(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),v.useEffect(()=>d,[d]),i??o}var Zk=(e,t)=>Object.is(e,t);function Qk(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function $k(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Qk(t,e,n))}function eA(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Qk(e,t,n))}function tA(e,t,n){return e.filter(e=>!Qk(t,e,n))}function nA(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function rA(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function iA(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(rA(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function aA(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return nA(e)}function oA(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?nA(e.value):nA(e)}function sA(e,t,n){function r(){return aA(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=rA(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function cA(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,K.jsx)(v.Fragment,{children:sA(r,t,n)},i)),e),[])}var $={id:Rw(e=>e.id),labelId:Rw(e=>e.labelId),modal:Rw(e=>e.modal),multiple:Rw(e=>e.multiple),items:Rw(e=>e.items),itemToStringLabel:Rw(e=>e.itemToStringLabel),itemToStringValue:Rw(e=>e.itemToStringValue),isItemEqualToValue:Rw(e=>e.isItemEqualToValue),value:Rw(e=>e.value),hasSelectedValue:Rw(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:oA(t,r)!==``}),hasNullItemLabel:Rw((e,t)=>t?iA(e.items):!1),open:Rw(e=>e.open),mounted:Rw(e=>e.mounted),forceMount:Rw(e=>e.forceMount),transitionStatus:Rw(e=>e.transitionStatus),openMethod:Rw(e=>e.openMethod),activeIndex:Rw(e=>e.activeIndex),selectedIndex:Rw(e=>e.selectedIndex),isActive:Rw((e,t)=>e.activeIndex===t),isSelected:Rw((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Qk(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Qk(n,i,r)}),isSelectedByFocus:Rw((e,t)=>e.selectedIndex===t),popupProps:Rw(e=>e.popupProps),triggerProps:Rw(e=>e.triggerProps),triggerElement:Rw(e=>e.triggerElement),positionerElement:Rw(e=>e.positionerElement),listElement:Rw(e=>e.listElement),popupSide:Rw(e=>e.popupSide),scrollUpArrowVisible:Rw(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Rw(e=>e.scrollDownArrowVisible),hasScrollArrows:Rw(e=>e.hasScrollArrows)},lA=v.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:LS,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function uA(){return v.useContext(lA)}function dA(e,t){let n=v.useRef(e),r=tS(t);Y(()=>{n.current!==e&&r(n.current)},[e,r]),Y(()=>{n.current=e},[e])}function fA(e){let t=v.useRef(``),n=v.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:v.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function pA(e,t){let{onClick:n,onPointerDown:r}=fA(tS((n,r)=>{(typeof e==`function`?e():e)||t(r||(vT?`touch`:``))}));return v.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function mA(e){let[t,n]=v.useState(null),r=pA(e,n);return dA(e,t=>{t&&!e&&n(null)}),v.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function hA(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function gA(e,t){return Math.max(0,e-t)}function _A(e,t){if(t<=0)return 0;let n=hA(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function vA(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:y,multiple:b=!1,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:C=Zk,highlightItemOnHover:w=!0,children:T}=e,{clearErrors:E}=uA(),{setDirty:D,setTouched:O,setFocused:k,shouldValidateOnChange:A,validityData:j,setFilled:M,name:N,disabled:P,validation:F,validationMode:I}=Gk(),L=Xk({id:t}),R=P||d,z=N??c,[B,V]=Fw({controlled:n,default:b?r??RS:r,name:`Select`,state:`value`}),[H,U]=Fw({controlled:a,default:o,name:`Select`,state:`open`}),W=v.useRef([]),G=v.useRef([]),ee=v.useRef(null),te=v.useRef(null),ne=v.useRef(0),re=v.useRef(null),ie=v.useRef([]),ae=v.useRef(!1),oe=v.useRef(!1),se=v.useRef(null),ce=v.useRef(null),le=v.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ue=v.useRef(!1),{mounted:de,setMounted:fe,transitionStatus:pe}=hk(H),{openMethod:me,triggerProps:he}=mA(H),ge=Qx(()=>new $w({id:L,labelId:void 0,modal:m,multiple:b,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:C,value:B,open:H,mounted:de,transitionStatus:pe,items:y,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,_e=Q(ge,$.activeIndex),ve=Q(ge,$.selectedIndex),ye=Q(ge,$.triggerElement),be=Q(ge,$.positionerElement),xe=Pw(me),Se=me??xe,Ce=v.useMemo(()=>b&&Array.isArray(B)&&B.length===0?``:oA(B,S),[b,B,S]),we=v.useMemo(()=>b&&Array.isArray(B)?B.map(e=>oA(e,S)):oA(B,S),[b,B,S]);Kk(Iw(ge.state.triggerElement),L,B,tS(()=>we));let Te=v.useRef(B),Ee=b?Array.isArray(B)&&B.length>0:B!=null;Y(()=>{B!==Te.current&&ge.set(`forceMount`,!0)},[ge,B]),Y(()=>{M(Ee)},[Ee,M]),Y(function(){let e=ie.current,t;if(b){let n=Array.isArray(B)?B:[];if(n.length===0)t=null;else{let r=n[n.length-1],i=eA(e,r,C);t=i===-1?null:i}}else{let n=eA(e,B,C);t=n===-1?null:n}t===null&&(ce.current=null),!H&&ge.set(`selectedIndex`,t)},[Ee,b,H,B,ie,C,ge,ce]),dA(B,()=>{E(z),D(B!==j.initialValue),A()?F.commit(B):F.commit(B,!0)});let De=tS((e,t)=>{if(s?.(e,t),!t.isCanceled&&(U(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(O(!0),k(!1),I===`onBlur`&&F.commit(B)),!e&&ge.state.activeIndex!==null)){let e=W.current[ge.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Oe=tS(()=>{fe(!1),ge.update({activeIndex:null,openMethod:null}),_?.(!1)});xk({enabled:!h,open:H,ref:ee,onComplete(){H||Oe()}}),v.useImperativeHandle(h,()=>({unmount:Oe}),[Oe]);let ke=tS((e,t)=>{i?.(e,t),!t.isCanceled&&V(e)}),Ae=tS(()=>{let e=ge.state.listElement||ee.current;if(!e)return;let t=gA(e.scrollHeight,e.clientHeight),n=_A(e.scrollTop,t),r=n>0,i=n<t;ge.state.scrollUpArrowVisible!==r&&ge.set(`scrollUpArrowVisible`,r),ge.state.scrollDownArrowVisible!==i&&ge.set(`scrollDownArrowVisible`,i)}),je=wk({open:H,onOpenChange:De,elements:{reference:ye,floating:be}}),Me=$D(je,{enabled:!f&&!R,event:`mousedown`}),Ne=rO(je),Pe=Mk(je,{enabled:!f&&!R,listRef:W,activeIndex:_e,selectedIndex:ve,disabledIndices:RS,onNavigate(e){e===null&&!H||ge.set(`activeIndex`,e)},focusItemOnHover:w}),Fe=Nk(je,{enabled:!f&&!R&&(H||!b),listRef:G,activeIndex:_e,selectedIndex:ve,onMatch(e){H?ge.set(`activeIndex`,e):ke(ie.current[e],$T(`none`))},onTyping(e){ae.current=e}}),Ie=v.useMemo(()=>{let e=oS(Fe.reference,Pe.reference,Ne.reference,Me.reference,he);return L&&(e.id=L),e},[Me.reference,Fe.reference,Pe.reference,Ne.reference,he,L]),Le=v.useMemo(()=>oS(Sk,Fe.floating,Pe.floating,Ne.floating),[Fe.floating,Pe.floating,Ne.floating]),Re=Pe.item??zS;Nw(()=>{ge.update({popupProps:Le,triggerProps:Ie})}),Y(()=>{ge.update({id:L,modal:m,multiple:b,value:B,open:H,mounted:de,transitionStatus:pe,popupProps:Le,triggerProps:Ie,items:y,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:C,openMethod:Se})},[ge,L,m,b,B,H,de,pe,Le,Ie,y,x,S,C,Se]);let ze=v.useMemo(()=>({store:ge,name:z,required:p,disabled:R,readOnly:f,multiple:b,highlightItemOnHover:w,setValue:ke,setOpen:De,listRef:W,popupRef:ee,scrollHandlerRef:te,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ne,itemProps:Re,events:je.context.events,valueRef:re,valuesRef:ie,labelsRef:G,typingRef:ae,selectionRef:le,firstItemTextRef:se,selectedItemTextRef:ce,validation:F,onOpenChangeComplete:_,keyboardActiveRef:oe,alignItemWithTriggerActiveRef:ue,initialValueRef:Te}),[ge,z,p,R,f,b,w,ke,De,Re,je.context.events,F,_,Ae]),Be=OS(g,F.inputRef),Ve=b&&Array.isArray(B)&&B.length>0,He=b?void 0:z,Ue=v.useMemo(()=>!b||!Array.isArray(B)||!z?null:B.map(e=>{let t=oA(e,S);return(0,K.jsx)(`input`,{type:`hidden`,form:l,name:z,value:t},t)}),[b,B,l,z,S]);return(0,K.jsx)(Pk.Provider,{value:ze,children:(0,K.jsxs)(Fk.Provider,{value:je,children:[T,(0,K.jsx)(`input`,{...F.getInputValidationProps({onFocus(){ge.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||R||f){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=$T(WT,e.nativeEvent);function r(){if(b)return;let e=ie.current.find(e=>oA(e,S).toLowerCase()===t.toLowerCase()||aA(e,x).toLowerCase()===t.toLowerCase());e!=null&&(D(e!==j.initialValue),ke(e,n),A()&&F.commit(e))}ge.set(`forceMount`,!0),queueMicrotask(r)}}),id:L&&He==null?`${L}-hidden-input`:void 0,form:l,name:He,autoComplete:u,value:Ce,disabled:R,required:p&&!Ve,readOnly:f,ref:Be,style:z?Mw:jw,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ue]})})}function yA(e,t){return e??t}var bA=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=gk.startingStyle]=`startingStyle`,e[e.endingStyle=gk.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),xA=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),SA={[xA.popupOpen]:``},CA={[xA.popupOpen]:``,[xA.pressed]:``},wA={[bA.open]:``},TA={[bA.closed]:``},EA={[bA.anchorHidden]:``},DA={open(e){return e?SA:null}},OA={open(e){return e?CA:null}},kA={open(e){return e?wA:TA},anchorHidden(e){return e?EA:null}};function AA(e){let t=e.getBoundingClientRect(),n=Dx(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var jA=2,MA=400,NA={...OA,...Hk,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},PA=v.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=Gk(),{labelId:m}=Yk(),{store:h,setOpen:g,selectionRef:_,validation:y,readOnly:b,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=Ik(),T=p||C||a,E=Q(h,$.open),D=Q(h,$.mounted),O=Q(h,$.value),k=Q(h,$.triggerProps),A=Q(h,$.positionerElement),j=Q(h,$.listElement),M=Q(h,$.popupSide),N=Q(h,$.id),P=Q(h,$.labelId),F=Q(h,$.hasSelectedValue),I=D&&A?M:null,L=i??N,R=yA(m,P);Xk({id:L});let z=Iw(A),B=v.useRef(null),{getButtonProps:V,buttonRef:H}=TS({disabled:T,native:o}),U=OS(t,B,H,tS(e=>{h.set(`triggerElement`,e)})),W=fT(),G=fT(),ee=fT();v.useEffect(()=>{if(E)return ee.start(MA,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},G.clear()},[E,_,G,ee]);let te=oS(k,{id:L,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?j?.id??UT(A)?.id:void 0,"aria-labelledby":R,"aria-readonly":b||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:U,onFocus(e){u(!0),E&&S.current&&g(!1,$T(WT,e.nativeEvent)),W.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){LT(A,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&y.commit(O))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=nT(e.currentTarget);function n(e){if(!B.current)return;let t=e.target;if(LT(B.current,t)||LT(z.current,t)||t===B.current)return;let n=AA(B.current);e.clientX>=n.left-jA&&e.clientX<=n.right+jA&&e.clientY>=n.top-jA&&e.clientY<=n.bottom+jA||g(!1,$T(ZT,e))}G.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},y.getValidationProps,c,V);te.role=`combobox`;let ne={...f,open:E,disabled:T,value:O,readOnly:b,popupSide:I,placeholder:!F};return US(`button`,e,{ref:[t,B],state:ne,stateAttributesMapping:NA,props:te})}),FA={value:()=>null},IA=v.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Ik(),u=Q(c,$.value),d=Q(c,$.items),f=Q(c,$.itemToStringLabel),p=Q(c,$.hasSelectedValue),m=!p&&a!=null&&i==null,h=Q(c,$.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?cA(u,d,f):sA(u,d,f)),US(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:FA})}),LA=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Ik();return US(`span`,e,{state:{open:Q(o,$.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:DA})}),RA=v.createContext(void 0),zA=v.forwardRef(function(e,t){let{store:n}=Ik(),r=Q(n,$.mounted),i=Q(n,$.forceMount);return r||i?(0,K.jsx)(RA.Provider,{value:!0,children:(0,K.jsx)(LD,{ref:t,...e})}):null});function BA(e){return FS(19)?e:e?`true`:void 0}var VA=v.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function HA(){return v.useContext(VA)}function UA(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=tS(i),o=v.useRef(0),s=Qx(GA).current,c=Qx(WA).current,[l,u]=v.useState(0),d=v.useRef(l),f=tS((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=tS(e=>{c.delete(e),d.current+=1,u(d.current)}),m=v.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(KA).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Y(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Y(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Y(()=>()=>{n.current=[]},[n]),Y(()=>()=>{r&&(r.current=[])},[r]);let h=tS(e=>(s.add(e),()=>{s.delete(e)}));Y(()=>{s.forEach(e=>e(m))},[s,m]);let g=v.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,K.jsx)(VA.Provider,{value:g,children:t})}function WA(){return new Map}function GA(){return new Set}function KA(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var qA=v.createContext(void 0);function JA(){return v.useContext(qA)?.direction??`ltr`}var YA=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=lE(e,t)||{};if(l==null)return{};let f=DE(u),p={x:n,y:r},m=hE(i),h=pE(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=cE(k,j,A),N=!c.arrow&&dE(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),XA=(e,t)=>({...YA(e),options:[e,t]}),ZA={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await fk().fn(e)).data?.referenceHidden||a}}}},QA={sideX:`left`,sideY:`top`};function $A(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function ej(e,t,n){let{rects:r,placement:i}=e;return{side:$A(t,uE(i),n),align:dE(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function tj(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:f,keepMounted:p=!1,floatingRootContext:m,mounted:h,collisionAvoidance:g,shiftCrossAxis:_=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=v.useState(null);!h&&C!==null&&w(null);let T=g.side||`flip`,E=g.align||`flip`,D=g.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=tS(O),A=O?k:t,j=Iw(t),M=Iw(h),N=JA()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),R=+(r===`top`),z=+(r===`right`),B=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+B,bottom:I+R,left:I+z}:I&&={top:(I.top||0)+L,right:(I.right||0)+B,bottom:(I.bottom||0)+R,left:(I.left||0)+z};let V={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},H=v.useRef(null),U=Iw(i),W=Iw(o),G=typeof i==`function`?0:i,ee=typeof o==`function`?0:o,te=[];f&&te.push(f),te.push(sk(e=>{let t=ej(e,r,N),n=typeof U.current==`function`?U.current(t):U.current,i=typeof W.current==`function`?W.current(t):W.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[G,ee,N,r]));let ne=E===`none`&&T!==`shift`,re=!ne&&(l||_||T===`shift`),ie=T===`none`?null:uk({...V,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!_&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),ae=ne?null:ck(e=>{let t=nT(e.elements.floating).documentElement;return{...V,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:re,limiter:l||_?void 0:lk(e=>{if(!H.current)return{};let{width:t,height:n}=H.current.getBoundingClientRect(),r=mE(uE(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[V,l,_,I,E]);T===`shift`||E===`shift`||a===`center`?te.push(ae,ie):te.push(ie,ae),te.push(dk({...V,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=Dx(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),XA(e=>({element:H.current||nT(e.elements.floating).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=uE(a),l=mE(c),u=H.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(ej(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,re&&l===`y`&&b?S:x),{}}},ZA,b),Y(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,m]);let oe=v.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:se,elements:ce,x:le,y:ue,middlewareData:de,update:fe,placement:pe,context:me,isPositioned:he,floatingStyles:ge}=Tk({rootContext:m,open:p?h:void 0,placement:F,middleware:te,strategy:n,whileElementsMounted:p?void 0:(...e)=>qO(...e,oe),nodeId:y,externalTree:S}),{sideX:_e,sideY:ve}=de.adaptiveOrigin||QA,ye=he?n:`fixed`,be=v.useMemo(()=>{let e=b?{position:ye,[_e]:le,[ve]:ue}:{position:ye,...ge};return he||(e.opacity=0),e},[b,ye,_e,le,ve,ue,ge,he]),xe=v.useRef(null);Y(()=>{if(!h)return;let e=j.current,t=typeof e==`function`?e():e,n=(nj(t)?t.current:t)||null;n!==xe.current&&(se.setPositionReference(n),xe.current=n)},[h,se,A,j]),v.useEffect(()=>{if(!h)return;let e=j.current;typeof e!=`function`&&nj(e)&&e.current!==xe.current&&(se.setPositionReference(e.current),xe.current=e.current)},[h,se,A,j]),v.useEffect(()=>{if(p&&h&&ce.domReference&&ce.floating)return qO(ce.domReference,ce.floating,fe,oe)},[p,h,ce,fe,oe]);let Se=uE(pe),Ce=$A(r,Se,N),we=dE(pe)||`center`,Te=!!de.hide?.referenceHidden;Y(()=>{x&&h&&he&&w(Se)},[x,h,he,Se]);let Ee=v.useMemo(()=>({position:`absolute`,top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),De=de.arrow?.centerOffset!==0;return v.useMemo(()=>({positionerStyles:be,arrowStyles:Ee,arrowRef:H,arrowUncentered:De,side:Ce,align:we,physicalSide:Se,anchorHidden:Te,refs:se,context:me,isPositioned:he,update:fe}),[be,Ee,H,De,Ce,we,Se,Te,se,me,he,fe])}function nj(e){return e!=null&&`current`in e}var rj=v.createContext(void 0);function ij(){let e=v.useContext(rj);if(!e)throw Error(xS(59));return e}var aj=v.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,K.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function oj(e,t){e&&Object.assign(e.style,t)}var sj={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function cj(e){return e===`starting`?AD:zS}function lj(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),US(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},cj(r),i],stateAttributesMapping:kA})}var uj={},dj={},fj=``;function pj(e){if(typeof document>`u`)return!1;let t=nT(e);return Dx(t).innerWidth-t.documentElement.clientWidth>0}function mj(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=nT(e),n=t.documentElement,r=t.body,i=Nx(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function hj(e){let t=nT(e),n=t.documentElement,r=t.body,i=Nx(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function gj(e){let t=nT(e),n=t.documentElement,r=t.body,i=Dx(n),a=0,o=0,s=!1,c=cT.create();if(_T&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,uj={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},fj=n.style.scrollBehavior,dj={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Nx(n)?n:r;if(s=mj(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,uj),Object.assign(r.style,dj),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=fj)}function d(){u(),c.request(l)}l();let f=rT(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var _j=new class{lockCount=0;restore=null;timeoutLock=dT.create();timeoutUnlock=dT.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=nT(e).documentElement,n=Dx(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=LS;return}let r=vT||!pj(e);this.restore=r?hj(e):gj(e)}};function vj(e=!0,t=null){Y(()=>{if(e)return _j.acquire(t)},[e,t])}var yj=20;function bj(e,t,n,r){let[i,a]=v.useState(!1);Y(()=>{if(!e||!t||n==null){a(!1);return}let r=nT(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-yj)},[e,t,n]),vj(e&&(!t||i),r)}var xj={position:`fixed`},Sj=v.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=jD,style:_,...y}=e,{store:b,listRef:x,labelsRef:S,alignItemWithTriggerActiveRef:C,selectedItemTextRef:w,valuesRef:T,initialValueRef:E,popupRef:D,setValue:O}=Ik(),k=Lk(),A=Q(b,$.open),j=Q(b,$.mounted),M=Q(b,$.modal),N=Q(b,$.value),P=Q(b,$.openMethod),F=Q(b,$.positionerElement),I=Q(b,$.triggerElement),L=Q(b,$.isItemEqualToValue),R=Q(b,$.transitionStatus),z=v.useRef(null),B=v.useRef(null),[V,H]=v.useState(h),U=j&&V&&P!==`touch`;!j&&V!==h&&H(h),Y(()=>{j||($.scrollUpArrowVisible(b.state)&&b.set(`scrollUpArrowVisible`,!1),$.scrollDownArrowVisible(b.state)&&b.set(`scrollDownArrowVisible`,!1))},[b,j]),v.useImperativeHandle(C,()=>U),bj((U||M)&&A,P===`touch`,F,I);let W=tj({anchor:n,floatingRootContext:k,positionMethod:r,mounted:j,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??U,collisionAvoidance:g,keepMounted:!0}),G=U?`none`:W.side,ee=U?xj:W.positionerStyles,te={open:A,side:G,align:W.align,anchorHidden:W.anchorHidden};Y(()=>{b.set(`popupSide`,W.side)},[b,W.side]);let ne=lj(e,te,{styles:ee,transitionStatus:R,props:y,refs:[t,tS(e=>{b.set(`positionerElement`,e)})],hidden:!j,inert:!A}),re=v.useRef(0),ie=tS(e=>{if(e.size===0&&re.current===0||T.current.length===0)return;let t=re.current;if(re.current=e.size,e.size===t)return;let n=$T(WT);if(t!==0&&!b.state.multiple&&N!==null&&eA(T.current,N,L)===-1){let e=E.current,t=e!=null&&eA(T.current,e,L)!==-1?e:null;O(t,n),t===null&&(b.set(`selectedIndex`,null),w.current=null)}if(t!==0&&b.state.multiple&&Array.isArray(N)){let e=e=>eA(T.current,e,L)!==-1,t=N.filter(t=>e(t));(t.length!==N.length||t.some(e=>!$k(N,e,L)))&&(O(t,n),t.length===0&&(b.set(`selectedIndex`,null),w.current=null))}if(A&&U){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};oj(F,e),oj(D.current,e)}}),ae=v.useMemo(()=>({...W,side:G,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:H,scrollUpArrowRef:z,scrollDownArrowRef:B}),[W,G,U,H]);return(0,K.jsx)(UA,{elementsRef:x,labelsRef:S,onMapChange:ie,children:(0,K.jsxs)(rj.Provider,{value:ae,children:[j&&M&&(0,K.jsx)(aj,{inert:BA(!A),cutout:I}),ne]})})}),Cj=`base-ui-disable-scrollbar`,wj={className:Cj,getElement(e){return(0,K.jsx)(`style`,{nonce:e,href:Cj,precedence:`base-ui:low`,children:`.${Cj}{scrollbar-width:none}.${Cj}::-webkit-scrollbar{display:none}`})}},Tj=v.createContext(void 0);function Ej(e){let t=v.useContext(Tj);if(t===void 0&&!e)throw Error(xS(69));return t}var Dj=`ArrowUp`,Oj=`ArrowDown`,kj=`ArrowLeft`,Aj=`ArrowRight`,jj=`Home`,Mj=new Set([kj,Aj]),Nj=new Set([Dj,Oj]),Pj=new Set([...Mj,...Nj]),Fj=new Set([...Pj,jj,`End`]),Ij=v.createContext(void 0),Lj={disableStyleElements:!1};function Rj(){return v.useContext(Ij)??Lj}var zj={...kA,...yk},Bj=v.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,keyboardActiveRef:m,multiple:h,handleScrollArrowVisibility:g,scrollHandlerRef:_,listRef:y,highlightItemOnHover:b}=Ik(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=ij(),O=Ej(!0)!=null,k=Lk(),A=JA(),{nonce:j,disableStyleElements:M}=Rj(),N=Q(s,$.id),P=Q(s,$.open),F=Q(s,$.mounted),I=Q(s,$.popupProps),L=Q(s,$.transitionStatus),R=Q(s,$.triggerElement),z=Q(s,$.positionerElement),B=Q(s,$.listElement),V=v.useRef(!1),H=v.useRef(!1),U=v.useRef({}),W=lT(),G=tS(e=>{if(!z||!c.current||!H.current)return;if(V.current||!C){g();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(!t&&!n){g();return}let r=Uj(z),i=Wj(z.getBoundingClientRect().height,`y`,r),a=nT(z),o=getComputedStyle(z),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=Vj(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=Hj(e),m=0,h=null,_=!1,v=!1,y=e=>{z.style.height=`${e}px`},b=(t,n)=>{let r=hA(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(V.current=!0),g()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:h=0:(_=!0,n&&f<p&&(h=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||h!=null){let t=Hj(e),n=v?t:hA(h,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(V.current=!0),g()});v.useImperativeHandle(_,()=>G,[G]),xk({open:P,ref:c,onComplete(){P&&l?.(!0)}});let ee={open:P,transitionStatus:L,side:x,align:S};Y(()=>{!z||!c.current||Object.keys(U.current).length||(U.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),Y(()=>{P||C||(H.current=!1,V.current=!1,oj(z,U.current))},[P,C,z,c]),Y(()=>{let e=c.current;if(!P||!R||!z||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){H.current=!0,W.request(g),e.style.removeProperty(`--transform-origin`);return}let t=qj(e);e.style.removeProperty(`--transform-origin`);try{let t=p.current;t?.isConnected||(t=!$.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=getComputedStyle(z),i=getComputedStyle(e),a=nT(R),o=Dx(z),c=Uj(R),l=Gj(R.getBoundingClientRect(),c),u=Gj(z.getBoundingClientRect(),c),m=l.height,h=B||e,_=h.scrollHeight,v=parseFloat(i.borderBottomWidth),x=parseFloat(r.marginTop)||10,S=parseFloat(r.marginBottom)||10,C=parseFloat(r.minHeight)||100,w=Vj(i),E=a.documentElement.clientHeight-x-S,D=a.documentElement.clientWidth,O=E-l.bottom+m,k,j=A===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=Gj(n.getBoundingClientRect(),c);k=Gj(t.getBoundingClientRect(),c),j=u.left+(A===`rtl`?e.right-k.right:e.left-k.left);let r=e.top-l.top+e.height/2;M=k.top-u.top+k.height/2-r}let N=O+M+S+v,P=Math.min(E,N),F=E-x-S,I=N-P,L=D-5;z.style.left=`${hA(j,5,L-u.width)}px`,z.style.height=`${P}px`,z.style.maxHeight=`auto`,z.style.marginTop=`${x}px`,z.style.marginBottom=`${S}px`,e.style.height=`100%`;let W=Hj(h),G=I>=W-1;G&&(P=Math.min(E,u.height)-(I-W));let ee=l.top<20||l.bottom>E-20||Math.ceil(P)+1<Math.min(_,C),te=(o.visualViewport?.scale??1)!==1&&_T;if(ee||te){H.current=!0,oj(z,U.current),T(!1);return}let ne=Math.max(C,P);if(G){let e=Math.max(0,E-N);z.style.top=u.height>=F?`0`:`${e}px`,z.style.height=`${P}px`,h.scrollTop=Hj(h)}else z.style.bottom=`0`,h.scrollTop=I;if(k){let t=u.top,n=u.height,r=k.top+k.height/2,i=hA(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ne===E||P>=w)&&(V.current=!0),g(),b&&s.state.selectedIndex===null&&s.state.activeIndex===null&&y.current[0]!=null&&s.set(`activeIndex`,0),H.current=!0}finally{t()}},[s,P,z,R,d,f,p,c,g,C,T,W,E,D,B,y,b,A,w]),v.useEffect(()=>{if(!C||!z||!P)return;let e=Dx(z);function t(e){u(!1,$T(QT,e))}return rT(e,`resize`,t)},[u,C,z,P]);let te={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${N}-list`},onKeyDown(e){m.current=!0,O&&Fj.has(e.key)&&e.stopPropagation()},onMouseMove(){m.current=!1},onScroll(e){B||G(e.currentTarget)},...C&&{style:B?{height:`100%`}:sj}},ne=US(`div`,e,{ref:[t,c],state:ee,stateAttributesMapping:zj,props:[I,te,cj(L),{className:!B&&C?wj.className:void 0},o]});return(0,K.jsxs)(v.Fragment,{children:[!M&&wj.getElement(j),(0,K.jsx)(QD,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ne})]})});function Vj(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Hj(e){return gA(e.scrollHeight,e.clientHeight)}function Uj(e){return WO.getScale(e)}function Wj(e,t,n){return e/n[t]}function Gj(e,t){return OE({x:Wj(e.x,`x`,t),y:Wj(e.y,`y`,t),width:Wj(e.width,`x`,t),height:Wj(e.height,`y`,t)})}var Kj=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function qj(e){let{style:t}=e,n={};for(let[e,r]of Kj)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Kj){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Jj=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=Ik(),{alignItemWithTriggerActive:c}=ij(),l=Q(o,$.hasScrollArrows),u=Q(o,$.openMethod),d=Q(o,$.multiple),f={id:`${Q(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:sj},className:l&&u!==`touch`?wj.className:void 0};return US(`div`,e,{ref:[t,tS(e=>{o.set(`listElement`,e)})],props:[f,a]})}),Yj=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Xj(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=HA(),f=v.useRef(-1),[p,m]=v.useState(a??(i===Yj.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=v.useRef(null),g=v.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Y(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Y(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),v.useMemo(()=>({ref:g,index:p}),[p,g])}var Zj=v.createContext(void 0);function Qj(){let e=v.useContext(Zj);if(!e)throw Error(xS(57));return e}var $j=v.memo(v.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=v.useRef(null),d=Xj({label:o,textRef:u,indexGuessBehavior:Yj.GuessFromOrder}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:y,multiple:b,selectedItemTextRef:x}=Ik(),S=Q(f,$.isActive,d.index),C=Q(f,$.isSelected,d.index,a),w=Q(f,$.isSelectedByFocus,d.index),T=Q(f,$.isItemEqualToValue),E=d.index,D=E!==-1,O=v.useRef(null);Y(()=>{if(!D)return;let e=y.current;return e[E]=a,()=>{delete e[E]}},[D,E,a,y]),Y(()=>{if(!D)return;let e=f.state.value,t=e;b&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Qk(a,t,T)&&(f.set(`selectedIndex`,E),u.current&&(x.current=u.current))},[D,E,b,T,f,a,x]);let k=v.useRef(null),A=v.useRef(`mouse`),j=v.useRef(!1),{getButtonProps:M,buttonRef:N}=TS({disabled:s,focusableWhenDisabled:!0,native:c,composite:!0}),P={disabled:s,selected:C,highlighted:S};function F(e){let t=f.state.value;if(b){let n=Array.isArray(t)?t:[];h(C?tA(n,a,T):[...n,a],$T(qT,e))}else h(a,$T(qT,e)),m(!1,$T(qT,e))}function I(){g.current.dragY=0}let L={role:`option`,"aria-selected":C,tabIndex:S?0:-1,onKeyDown(e){k.current=e.key,f.set(`activeIndex`,E),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=e.type===`click`&&A.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&DT(e.nativeEvent)&&(n!==void 0||S),i=t&&!r&&!j.current;j.current=!1,!(e.type===`keydown`&&k.current===null)&&(s||e.type===`keydown`&&k.current===` `&&_.current||i||(k.current=null,F(e.nativeEvent)))},onPointerEnter(e){A.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){A.current=e.pointerType,j.current=!0,I()},onMouseUp(){if(I(),s||A.current===`touch`||j.current)return;let e=!g.current.allowSelectedMouseUp&&C,t=!g.current.allowUnselectedMouseUp&&!C;e||t||(j.current=!0,O.current?.click(),j.current=!1)}},R=US(`div`,e,{ref:[N,t,d.ref,O],state:P,props:[p,L,l,M]}),z=v.useMemo(()=>({selected:C,index:E,textRef:u,selectedByFocus:w,hasRegistered:D}),[C,E,u,w,D]);return(0,K.jsx)(Zj.Provider,{value:z,children:R})})),eM=v.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=Qj();return n||r?(0,K.jsx)(tM,{...e,ref:t}):null}),tM=v.memo(v.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Qj(),c=v.useRef(null),{transitionStatus:l,setMounted:u}=hk(s),d=US(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:yk});return xk({open:s,ref:c,onComplete(){s||u(!1)}}),d})),nM=v.memo(v.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i,hasRegistered:a}=Qj(),{firstItemTextRef:o,selectedItemTextRef:s}=Ik(),{render:c,className:l,style:u,...d}=e;return US(`div`,e,{ref:[v.useCallback(e=>{e&&(a&&n===0&&(o.current=e),a&&i&&(s.current=e))},[o,s,n,i,a]),t,r],props:d})})),rM=v.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=Ik(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=ij(),_=Q(l,c?$.scrollUpArrowVisible:$.scrollDownArrowVisible),v=Q(l,$.openMethod),y=_&&v!==`touch`,b=fT(),x=c?g:h,{transitionStatus:S,setMounted:C}=hk(y);Y(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),xk({open:y,ref:x,onComplete(){y||C(!1)}});let w=US(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=gA(e.scrollHeight,e.clientHeight),r=_A(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=iM(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function iM(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?_A(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?_A(l.offsetTop+l.offsetHeight-r+i,a):a}var aM=v.forwardRef(function(e,t){return(0,K.jsx)(rM,{...e,ref:t,direction:`down`})}),oM=v.forwardRef(function(e,t){return(0,K.jsx)(rM,{...e,ref:t,direction:`up`})}),sM=vA;function cM({className:e,...t}){return(0,K.jsx)(IA,{"data-slot":`select-value`,className:Dw(`flex flex-1 text-left`,e),...t})}function lM({className:e,size:t=`default`,children:n,...r}){return(0,K.jsxs)(PA,{"data-slot":`select-trigger`,"data-size":t,className:Dw(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,K.jsx)(LA,{render:(0,K.jsx)(Ps,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function uM({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,K.jsx)(zA,{children:(0,K.jsx)(Sj,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,K.jsxs)(Bj,{"data-slot":`select-content`,"data-align-trigger":o,className:Dw(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:[(0,K.jsx)(fM,{}),(0,K.jsx)(Jj,{children:t}),(0,K.jsx)(pM,{})]})})})}function dM({className:e,children:t,...n}){return(0,K.jsxs)($j,{"data-slot":`select-item`,className:Dw(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,K.jsx)(nM,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,K.jsx)(eM,{render:(0,K.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,K.jsx)(Ns,{className:`pointer-events-none`})})]})}function fM({className:e,...t}){return(0,K.jsx)(oM,{"data-slot":`select-scroll-up-button`,className:Dw(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,K.jsx)(Ls,{})})}function pM({className:e,...t}){return(0,K.jsx)(aM,{"data-slot":`select-scroll-down-button`,className:Dw(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,K.jsx)(Ps,{})})}function mM({path:e,name:t,depth:n,expandedPaths:r,selectedPath:i,onToggle:a,onSelect:o}){let s=r.has(e),c=i===e,l=(0,v.useRef)(null);(0,v.useEffect)(()=>{c&&l.current?.scrollIntoView({block:`nearest`})},[]);let{data:u,isLoading:d}=jo({queryKey:Po.kbBrowse(e),queryFn:()=>Qp(e),enabled:s,staleTime:1e4}),f=u?.entries??[],p=8+n*16;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:[`flex w-full items-center`,c?`bg-accent/10`:`hover:bg-surface-elevated/60`].join(` `),style:{paddingLeft:p},children:[(0,K.jsx)(`button`,{type:`button`,tabIndex:-1,onClick:()=>a(e),"aria-expanded":s,"aria-label":s?`Collapse`:`Expand`,className:`flex w-6 shrink-0 items-center justify-center py-1.5 text-text-subtle hover:text-text focus-visible:outline-none`,children:s?(0,K.jsx)(Ps,{className:`h-3 w-3 opacity-60`}):(0,K.jsx)(Is,{className:`h-3 w-3 opacity-50`})}),(0,K.jsxs)(`button`,{ref:l,type:`button`,"data-dir-tree-row":!0,"data-path":e,onClick:()=>o(e),className:[`flex min-w-0 flex-1 items-center gap-1.5 py-1.5 pr-3 text-left font-sans text-[13px] transition-colors`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-accent/50`,c?`text-accent`:`text-text`].join(` `),children:[s?(0,K.jsx)(Hs,{className:`h-3.5 w-3.5 shrink-0 ${c?`text-accent/70`:`text-text-muted`}`}):(0,K.jsx)(Vs,{className:`h-3.5 w-3.5 shrink-0 ${c?`text-accent/70`:`text-text-subtle`}`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),d&&(0,K.jsx)(Gs,{className:`h-3 w-3 shrink-0 animate-spin text-text-subtle`})]})]}),s&&!d&&f.length===0&&u&&(0,K.jsx)(`div`,{className:`py-1 font-serif italic text-[12px] text-text-subtle`,style:{paddingLeft:p+36},children:`No subdirectories`}),s&&f.map(e=>(0,K.jsx)(mM,{path:e.path,name:e.name,depth:n+1,expandedPaths:r,selectedPath:i,onToggle:a,onSelect:o},e.path))]})}function hM({startPath:e,onChoose:t,onCancel:n,confirmLabel:r=`Choose`,confirmDisabled:i}){let[a,o]=(0,v.useState)(new Set),[s,c]=(0,v.useState)(e??``),l=(0,v.useRef)(null),{data:u,isLoading:d,error:f}=jo({queryKey:Po.kbBrowse(``),queryFn:()=>Qp(void 0),staleTime:1e4}),p=u?.path??``,m=u?.entries??[],h=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(h.current||!p||!e||(h.current=!0,!e.startsWith(p)))return;let t=e.slice(p.length).split(`/`).filter(Boolean);if(t.length<=1)return;let n=new Set;for(let e=0;e<t.length-1;e++)n.add(p+`/`+t.slice(0,e+1).join(`/`));setTimeout(()=>o(n),0)},[p,e]);function g(e){o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let _=(p&&s.startsWith(p)?s.slice(p.length):s).split(`/`).filter(Boolean).map((e,t,n)=>({label:e,path:p+`/`+n.slice(0,t+1).join(`/`)})),y=(0,v.useCallback)(e=>{if(!l.current)return;let t=Array.from(l.current.querySelectorAll(`[data-dir-tree-row]`));if(!t.length)return;let n=l.current.querySelector(`[data-dir-tree-row]:focus`),r=n?t.indexOf(n):-1;if(e.key===`ArrowDown`)e.preventDefault(),t[r<0?0:Math.min(t.length-1,r+1)]?.focus();else if(e.key===`ArrowUp`)e.preventDefault(),t[Math.max(0,r<=0?0:r-1)]?.focus();else if(e.key===`ArrowRight`&&n){e.preventDefault();let t=n.dataset.path;t&&!a.has(t)&&o(e=>new Set([...e,t]))}else if(e.key===`ArrowLeft`&&n){e.preventDefault();let t=n.dataset.path;t&&a.has(t)&&o(e=>{let n=new Set(e);return n.delete(t),n})}else if(e.key===`Enter`&&n){e.preventDefault();let t=n.dataset.path;t&&c(t)}},[a]);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex min-h-[24px] items-center gap-0.5 overflow-x-auto pb-0.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>{o(new Set),c(``)},className:`shrink-0 font-mono text-[11px] text-text-muted hover:text-text`,title:`Home`,children:`~`}),_.map((e,t)=>(0,K.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,K.jsx)(Is,{className:`h-2.5 w-2.5 text-text-subtle`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>c(e.path),className:[`font-mono text-[11px] hover:text-text`,t===_.length-1?`font-semibold text-text`:`text-text-muted`].join(` `),children:e.label})]},e.path))]}),(0,K.jsxs)(`div`,{ref:l,onKeyDown:y,className:`h-[360px] overflow-y-auto rounded-sm border border-border bg-surface py-1`,children:[d&&(0,K.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,K.jsx)(Gs,{className:`h-4 w-4 animate-spin text-text-subtle`})}),f&&(0,K.jsx)(`div`,{className:`px-4 py-3 font-sans text-[12px] text-health-error`,children:f instanceof Error?f.message:`Error loading directory`}),!d&&!f&&m.length===0&&(0,K.jsx)(`div`,{className:`px-4 py-8 text-center font-serif italic text-[13px] text-text-subtle`,children:`No subdirectories`}),m.map(e=>(0,K.jsx)(mM,{path:e.path,name:e.name,depth:0,expandedPaths:a,selectedPath:s,onToggle:g,onSelect:c},e.path))]}),(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-2 border-t border-border-soft pt-3`,children:[(0,K.jsx)(kw,{type:`button`,variant:`ghost`,onClick:n,children:`Cancel`}),(0,K.jsx)(kw,{type:`button`,onClick:()=>t(s),disabled:!s||i,children:r})]})]})}var gM={missing_token:``,wrong_token_type:``,unknown_token_type:"This doesn't look like a Slack token. Bot tokens start with `xoxb-`, app-level tokens with `xapp-`.",invalid_token:`Slack didn't recognize this token. Check you copied the whole thing and the app is still installed.`,missing_connections_write:"This App-Level Token is missing the `connections:write` scope. Regenerate it with that scope checked (Basic Information → App-Level Tokens).",not_bot_token:"This isn't a Bot User token. Copy the one labeled Bot User OAuth Token under OAuth & Permissions — it starts with `xoxb-`.",slack_api_error:`Couldn't reach Slack to check this token. Try again in a moment.`},_M=`These two tokens are from different Slack apps. Make sure both came from the same app you just created.`;function vM(e){return e.valid?{status:`verified`,result:e}:{status:`failed`,result:e}}function yM(e,t){return!e.reason||e.reason===`missing_token`?``:e.reason===`wrong_token_type`?t===`app`?"That’s a Bot token (`xoxb-…`). The App-Level Token goes here — it starts with `xapp-`.":"That’s an App-Level Token (`xapp-…`). The Bot User OAuth Token goes here — it starts with `xoxb-`.":gM[e.reason]||`Validation failed.`}function bM({n:e,done:t,active:n,onClick:r}){return(0,K.jsx)(`span`,{onClick:r,title:r?`Go back to this step`:void 0,className:[`font-sans mt-px flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[11px] font-semibold transition-opacity`,t?`border-health-ok bg-health-ok-soft text-health-ok`:n?`border-health-warn/50 text-health-warn`:`border-border text-text-subtle`,r?`cursor-pointer hover:opacity-60`:``].join(` `),children:t?(0,K.jsx)(Ns,{className:`h-3.5 w-3.5`}):e})}function xM({state:e,field:t}){if(e.status===`idle`)return null;if(e.status===`pending`)return(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 font-sans text-[12px] text-text-muted`,children:[(0,K.jsx)(Gs,{className:`h-3.5 w-3.5 animate-spin`}),(0,K.jsx)(`span`,{children:`Checking with Slack…`})]});if(e.status===`verified`){let n=t===`bot`&&e.result.botName?`@${e.result.botName}${e.result.workspaceName?` · ${e.result.workspaceName}`:``}`:e.result.workspaceName??`Verified`;return(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 font-sans text-[12px] text-health-ok`,children:[(0,K.jsx)(Ns,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:n})]})}return(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-1.5 font-sans text-[12px] text-health-error`,children:[(0,K.jsx)(nc,{className:`mt-px h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:yM(e.result,t)})]})}function SM({conn:e}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 rounded-sm border border-health-ok/30 bg-health-ok-soft px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:[e.workspaceIconUrl&&(0,K.jsx)(`img`,{src:e.workspaceIconUrl,alt:``,className:`h-5 w-5 shrink-0 rounded-sm object-cover`}),(0,K.jsxs)(`span`,{className:`font-serif text-[13px] text-text`,children:[`Connected to `,(0,K.jsx)(`strong`,{children:e.workspaceName??`your workspace`}),e.botName?(0,K.jsxs)(K.Fragment,{children:[` `,`as`,` `,e.botAvatarUrl&&(0,K.jsx)(`img`,{src:e.botAvatarUrl,alt:``,className:`mx-0.5 inline h-4 w-4 rounded-full object-cover align-middle`}),(0,K.jsxs)(`strong`,{children:[`@`,e.botName]})]}):null]})]}),(0,K.jsx)(Ns,{className:`h-4 w-4 shrink-0 text-health-ok`})]})}function CM({agentId:e,onConnect:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)({status:`idle`}),[u,d]=(0,v.useState)({status:`idle`}),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(),[y,b]=(0,v.useState)(!1),x=(0,v.useRef)(null),S=c.status===`verified`,C=u.status===`verified`,w=n,T=S,E=n&&T,D=C,O=(0,v.useCallback)(async t=>{if(t.trim()){l({status:`pending`}),p(null);try{let n=await Wo(e,{appToken:t.trim()});n.app&&l(vM(n.app))}catch{l({status:`failed`,result:{valid:!1,expected:`app`,reason:`slack_api_error`}})}}},[e]),k=(0,v.useCallback)(async t=>{if(t.trim()){d({status:`pending`}),p(null);try{let n=await Wo(e,{botToken:t.trim()});n.bot&&d(vM(n.bot))}catch{d({status:`failed`,result:{valid:!1,expected:`bot`,reason:`slack_api_error`}})}}},[e]);async function A(){if(!(m||y)){h(!0),_(void 0);try{await Go(e,{appToken:i.trim(),botToken:o.trim()}),b(!0),es(),t?.()}catch(e){_(e instanceof Error?e.message:`Connection failed`),p(null)}finally{h(!1)}}}async function j(){try{let t=await Wo(e,{appToken:i.trim(),botToken:o.trim()});t.connection.valid?(p(t.connection),A()):t.connection.reason===`app_mismatch`?(_(_M),l({status:`idle`}),d({status:`idle`}),p(null)):t.connection.reason===`incomplete`||_(`Could not connect — try again.`)}catch{_(`Could not reach Slack to validate the token pair.`)}}(0,v.useEffect)(()=>{S&&C&&!m&&!y&&setTimeout(()=>void j(),0)},[S,C]);function M(e){x.current&&clearTimeout(x.current);let t=e.trim();if(t.length<=20)return;let n=t.startsWith(`xoxb-`)?300:600;x.current=setTimeout(()=>void O(t),n)}function N(e){x.current&&clearTimeout(x.current);let t=e.trim();if(t.length<=20)return;let n=t.startsWith(`xapp-`)?300:600;x.current=setTimeout(()=>void k(t),n)}function P(e){a(e),l({status:`idle`}),p(null),_(void 0),M(e)}function F(e){s(e),d({status:`idle`}),p(null),_(void 0),N(e)}function I(){window.open(`/api/agents/${encodeURIComponent(e)}/slack/install`,`_blank`,`noopener,noreferrer`),r(!0)}return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(bM,{n:1,done:n,active:!0,onClick:n?()=>{r(!1),a(``),s(``),l({status:`idle`}),d({status:`idle`}),b(!1),_(void 0),p(null)}:void 0}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Create & install the Slack app`}),(0,K.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[(0,K.jsx)(`button`,{onClick:I,className:`font-serif text-[13px] text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`,children:`Create app`}),` `,`→ pick your Slack workspace → click `,(0,K.jsx)(`strong`,{children:`Install`}),`.`,` `,`The manifest turns on Interactivity; if you reuse an older app, enable Interactivity in Slack.`]}),!n&&(0,K.jsx)(`button`,{onClick:()=>r(!0),className:`mt-1.5 font-sans text-[11px] text-text-subtle underline decoration-text-subtle/40 underline-offset-2 hover:text-text-muted hover:decoration-text-muted/40`,children:`Already have an app`})]})]}),(0,K.jsxs)(`div`,{className:[`flex gap-3`,w?``:`pointer-events-none opacity-40`].join(` `),children:[(0,K.jsx)(bM,{n:2,done:T,active:w,onClick:T?()=>{a(``),l({status:`idle`}),b(!1),_(void 0),p(null)}:void 0}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Copy App-Level Token`}),(0,K.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[`Basic Information → App-Level Tokens → Generate → Add scope:`,` `,(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:`connections:write`}),` → copy`,` `,`(`,(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:`xapp-…`}),`)`]}),w&&(0,K.jsxs)(`div`,{className:`mt-2`,children:[(0,K.jsx)(`input`,{type:`text`,value:i,onChange:e=>P(e.target.value),onBlur:()=>{let e=i.trim();e.length>20&&c.status===`idle`&&O(e)},placeholder:`xapp-…`,disabled:S||m,className:[`w-full rounded-sm border bg-muted/30 px-3 py-1.5 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-ring`,c.status===`verified`?`border-health-ok/50`:c.status===`failed`?`border-health-error/50`:`border-border`].join(` `)}),(0,K.jsx)(xM,{state:c,field:`app`})]})]})]}),(0,K.jsxs)(`div`,{className:[`flex gap-3`,E?``:`pointer-events-none opacity-40`].join(` `),children:[(0,K.jsx)(bM,{n:3,done:D,active:E,onClick:D?()=>{s(``),d({status:`idle`}),b(!1),_(void 0),p(null)}:void 0}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Copy Bot Token`}),(0,K.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[`OAuth & Permissions → Install to Workspace → copy`,` `,(0,K.jsx)(`strong`,{children:`Bot User OAuth Token`}),` `,`(`,(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:`xoxb-…`}),`)`]}),E&&(0,K.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`input`,{type:`text`,value:o,onChange:e=>F(e.target.value),onBlur:()=>{let e=o.trim();e.length>20&&u.status===`idle`&&k(e)},placeholder:`xoxb-…`,disabled:C||m,className:[`w-full rounded-sm border bg-muted/30 px-3 py-1.5 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-ring`,u.status===`verified`?`border-health-ok/50`:u.status===`failed`?`border-health-error/50`:`border-border`].join(` `)}),(0,K.jsx)(xM,{state:u,field:`bot`})]}),m&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 font-sans text-[12px] text-text-muted`,children:[(0,K.jsx)(Gs,{className:`h-3.5 w-3.5 animate-spin`}),(0,K.jsx)(`span`,{children:`Connecting…`})]}),g&&(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(nc,{className:`mt-px h-3.5 w-3.5 shrink-0 text-health-error`}),(0,K.jsx)(`span`,{className:`font-sans text-[12px] text-health-error`,children:g})]})]})]})]}),f?.valid&&(0,K.jsx)(SM,{conn:f})]})}function wM(){return(0,K.jsx)(`p`,{className:`font-sans text-[13px] leading-relaxed text-text-muted`,children:`The owner is the person this agent answers to. The agent introduces itself to them and checks in — it's how it knows who it's working for.`})}function TM({agentId:e,onConfirm:t,onSkip:n,submitLabel:r=`Assign owner →`,autoFocus:i=!0,showRationale:a=!1}){let o=(0,v.useId)(),s=`${o}-listbox`,c=e=>`${o}-option-${e}`,[l,u]=(0,v.useState)([]),[d,f]=(0,v.useState)(!0),[p,m]=(0,v.useState)(),[h,g]=(0,v.useState)(``),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(-1),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(!0),[E,D]=(0,v.useState)(``),[O,k]=(0,v.useState)(!1),[A,j]=(0,v.useState)(),M=(0,v.useRef)(null),N=(0,v.useRef)(null),P=(0,v.useRef)(null);(0,v.useEffect)(()=>{let t=!1;return Jo(e).then(e=>{t||(u(e),f(!1))}).catch(e=>{t||(m(e instanceof Error?e.message:`Could not load Slack members`),f(!1))}),()=>{t=!0}},[e]),(0,v.useEffect)(()=>{function e(e){M.current&&!M.current.contains(e.target)&&y(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,v.useEffect)(()=>{i&&!d&&setTimeout(()=>N.current?.focus(),50)},[i,d]);let F=l.find(e=>e.slackUserId===S),I=h.trim()?l.filter(e=>{let t=h.trim().toLowerCase();return e.displayName.toLowerCase().includes(t)||e.handle&&e.handle.toLowerCase().includes(t)}):l,L=_&&b>=0&&I[b]?c(I[b].slackUserId):void 0;(0,v.useEffect)(()=>{!_||b<0||document.getElementById(c(I[b]?.slackUserId??``))?.scrollIntoView({block:`nearest`})},[b,_]);function R(e){let t=e.target.value;g(t),y(!0),x(-1),S&&t!==(F?.displayName??``)&&(C(``),j(void 0))}function z(){y(!0),S&&g(``)}function B(){F&&!_&&g(F.displayName)}function V(e){C(e.slackUserId),g(e.displayName),y(!1),x(-1),j(void 0)}function H(e){if(!_){e.key===`ArrowDown`&&(y(!0),x(0),e.preventDefault());return}if(e.key===`Escape`)y(!1),x(-1),F&&g(F.displayName),e.preventDefault();else if(e.key===`ArrowDown`)x(e=>Math.min(e+1,I.length-1)),e.preventDefault();else if(e.key===`ArrowUp`)x(e=>Math.max(e-1,0)),e.preventDefault();else if(e.key===`Enter`){e.preventDefault();let t=b>=0?I[b]:I[0];t&&V(t)}}async function U(){if(!(!S||O)){k(!0),j(void 0);try{await Yo(e,{slackUserId:S,introduce:w,...w&&E.trim()?{openerNote:E.trim()}:{}}),es(),t()}catch(e){j(e instanceof Error?e.message:`Could not assign owner`)}finally{k(!1)}}}return d?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[a&&(0,K.jsx)(wM,{}),(0,K.jsx)(`div`,{className:`font-sans text-[12px] text-text-muted`,children:`Loading Slack members…`})]}):p?(0,K.jsxs)(`div`,{className:`space-y-2`,children:[a&&(0,K.jsx)(wM,{}),(0,K.jsx)(`div`,{className:`font-sans text-[12px] text-health-error`,children:p}),(0,K.jsx)(kw,{variant:`ghost`,size:`sm`,onClick:()=>{f(!0),m(void 0),Jo(e).then(e=>{u(e),f(!1)}).catch(e=>{m(e instanceof Error?e.message:`Could not load Slack members`),f(!1)})},children:`Retry`})]}):(0,K.jsxs)(`div`,{className:`space-y-3`,children:[a&&(0,K.jsx)(wM,{}),(0,K.jsxs)(`div`,{ref:M,className:`relative`,children:[(0,K.jsx)(`input`,{ref:N,role:`combobox`,"aria-expanded":_,"aria-controls":s,"aria-activedescendant":L,"aria-autocomplete":`list`,type:`text`,value:h,onChange:R,onFocus:z,onBlur:B,onKeyDown:H,placeholder:F?F.displayName:`Search by name or handle…`,disabled:O,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-sans text-[13px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none disabled:opacity-50`}),F&&!_&&(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-2 flex items-center`,children:(0,K.jsx)(Ns,{className:`h-3.5 w-3.5 text-accent`})}),_&&(0,K.jsx)(`div`,{ref:P,id:s,role:`listbox`,className:`absolute left-0 right-0 top-full z-50 mt-1 max-h-52 overflow-y-auto rounded-sm border border-border-soft bg-surface shadow-deep`,children:I.length===0?(0,K.jsx)(`div`,{className:`px-3 py-2 font-sans text-[12px] text-text-muted`,children:l.length===0?`No workspace members found.`:`No members match.`}):I.map((e,t)=>{let n=e.slackUserId===S,r=t===b;return(0,K.jsxs)(`button`,{id:c(e.slackUserId),role:`option`,"aria-selected":n,type:`button`,onMouseDown:t=>{t.preventDefault(),V(e)},className:[`flex w-full items-center gap-3 px-3 py-2 text-left transition-colors`,r?`bg-accent/10`:n?`bg-accent/5`:`hover:bg-surface-elevated`].join(` `),children:[e.avatarUrl?(0,K.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`h-6 w-6 shrink-0 rounded-sm object-cover`}):(0,K.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm bg-muted font-sans text-[10px] font-bold text-text-muted`,children:e.displayName.charAt(0).toUpperCase()}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate font-serif text-[14px] text-text`,children:e.displayName}),e.handle&&(0,K.jsxs)(`span`,{className:`font-sans text-[11px] text-text-muted`,children:[`@`,e.handle]})]}),n&&(0,K.jsx)(Ns,{className:`h-3.5 w-3.5 shrink-0 text-accent`})]},e.slackUserId)})})]}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:w,onChange:e=>T(e.target.checked),disabled:O,className:`h-4 w-4 accent-accent`}),(0,K.jsx)(`span`,{className:`font-sans text-[13px] text-text`,children:F?(0,K.jsxs)(K.Fragment,{children:[`Notify `,(0,K.jsx)(`span`,{className:`font-medium`,children:F.displayName}),` now`]}):`Notify the new owner now`})]}),(0,K.jsx)(`p`,{className:`font-sans pl-[26px] text-[11px] text-text-subtle`,children:`The agent will DM them to introduce itself.`})]}),w&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium text-text-muted`,children:[`What should the agent know before it reaches out to`,` `,F?F.displayName:`its owner`,`?`,` `,(0,K.jsx)(`span`,{className:`font-normal`,children:`(optional)`})]}),(0,K.jsx)(`textarea`,{value:E,onChange:e=>D(e.target.value),placeholder:F?`e.g. I set this agent up to help ${F.displayName} with code review and deploys.`:`e.g. I set this agent up to help them with code review and deploys.`,rows:3,className:`w-full resize-none rounded-sm border border-border-soft bg-surface px-3 py-2 font-sans text-[13px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none`}),(0,K.jsxs)(`p`,{className:`font-sans mt-1 text-[11px] text-text-subtle`,children:[`Used as context for the agent's first message —`,` `,F?`so ${F.displayName} knows who set it up and why.`:`so the owner knows who set it up and why.`]})]}),A&&(0,K.jsx)(`div`,{className:`font-sans text-[12px] text-health-error`,children:A}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(kw,{className:`w-full`,onClick:()=>void U(),disabled:O||!S,children:O?`Assigning…`:r}),n&&(0,K.jsx)(`div`,{className:`text-center`,children:(0,K.jsx)(`button`,{type:`button`,onClick:n,disabled:O,className:`font-sans text-[12px] text-text-muted underline decoration-text-muted/40 underline-offset-2 hover:text-text hover:decoration-text/40 transition-colors`,children:`Skip for now →`})})]})]})}var EM=s({AgentCreateFlow:()=>OM,AgentCreateModal:()=>AM,OnboardingPage:()=>kM});function DM({n:e,current:t,done:n,onClick:r}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{onClick:r,title:r?`Go back to this step`:void 0,className:[`font-sans flex h-6 w-6 items-center justify-center rounded-full border text-[11px] font-semibold transition-colors`,n?`border-health-ok bg-health-ok-soft text-health-ok`:e===t?`border-accent bg-accent/10 text-accent`:`border-border-soft text-text-subtle`,r?`cursor-pointer hover:opacity-60`:``].join(` `),children:e}),e<3&&(0,K.jsx)(`span`,{className:[`h-px w-8 transition-colors`,e<t?`bg-health-ok/40`:`bg-border-soft`].join(` `)})]})}function OM({firstRun:e,onClose:t,onComplete:n}){let r=typeof window<`u`?Number(new URLSearchParams(window.location.search).get(`_previewStep`)??0):0,[i,a]=(0,v.useState)((r===2?2:r===3?3:void 0)??1),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(tx),[m,h]=(0,v.useState)(ax().find(e=>e.kind===`claude-code`)?.defaultModel??``),[g,_]=(0,v.useState)(nx),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(!1),j=(0,v.useRef)(null),{data:M,error:N}=jo({queryKey:Po.providerAvailability(),queryFn:bd}),P=(0,v.useMemo)(()=>ax(),[]),F=hx(o.trim()),I=e=>P.find(t=>t.kind===e)?.label??e,L=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),R=e=>e===`xhigh`?`Extra High`:e&&e.charAt(0).toUpperCase()+e.slice(1),z=P.find(e=>e.kind===f),B=bx(z,M),V=Cx(z,M),H=wx(P,M),U=!M&&!N,W=F?fx(F,x??`~/anima-team/agents`):`${x??`~/anima-team/agents`}/<name>`;(0,v.useEffect)(()=>{if(!M||bx(P.find(e=>e.kind===f),M))return;let e=xx(P,M);e&&setTimeout(()=>{p(e.kind),h(e.defaultModel)},0)},[M,f,P]),(0,v.useEffect)(()=>{setTimeout(()=>j.current?.focus(),50)},[]);let G=(0,v.useCallback)(()=>{T&&es(),t()},[T,t]);(0,v.useEffect)(()=>{function e(e){if(!(e.key!==`Escape`||k)){if(C){w(!1);return}G()}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[G,k,C]);function ee(e){p(e),h(P.find(t=>t.kind===e)?.defaultModel??``),_(nx)}async function te(){if(l(!0),!F||!u.trim()||!B)return;if(A(!0),O(null),T){try{await Bo(T,{displayName:o.trim(),role:u.trim()}),es(),a(2)}catch(e){O(e instanceof Error?e.message:`Failed to update agent`)}finally{A(!1)}return}let e={kind:f,model:m,...(z?.reasoningEfforts??[]).length>0?{reasoningEffort:g}:{}};try{E((await Ro({name:o.trim(),role:u.trim(),homePath:W,provider:e})).id),a(2)}catch(e){O(e instanceof Error?e.message:`Failed to create agent`)}finally{A(!1)}}async function ne(){await ns(),a(3)}function re(){T&&n?.(T)}let ie=i===1?`Create your agent`:i===2?`Connect to Slack`:`Assign owner`,ae=(()=>{if(!k){if(!F)return`Enter a name`;if(!u.trim())return`Enter a role`;if(N)return`Provider check failed`;if(U)return`Checking providers...`;if(!B)return`Install a provider first`}})();if(C)return(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`relative w-full max-w-2xl rounded-sm border border-border-soft bg-surface shadow-deep`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-soft px-5 py-4`,children:[(0,K.jsx)(`span`,{className:`font-serif text-[15px] font-semibold text-text`,children:`Choose home folder`}),(0,K.jsx)(`button`,{onClick:()=>w(!1),className:`flex h-8 w-8 items-center justify-center rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text`,children:(0,K.jsx)(nc,{className:`h-4 w-4`})})]}),(0,K.jsx)(`div`,{className:`p-5`,children:(0,K.jsx)(hM,{onChoose:e=>{S(e),w(!1)},onCancel:()=>w(!1)})})]})});let oe=(0,K.jsxs)(`div`,{className:`relative w-full max-w-xl rounded-sm border border-border-soft bg-white shadow-deep`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-soft px-6 py-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(DM,{n:1,current:i,done:i>1,onClick:i>1?()=>a(1):void 0}),(0,K.jsx)(DM,{n:2,current:i,done:i>2}),(0,K.jsx)(DM,{n:3,current:i,done:!1})]}),(0,K.jsx)(`span`,{className:`font-serif text-[15px] font-semibold text-text`,children:ie})]}),(!e||T)&&(0,K.jsx)(`button`,{onClick:G,className:`flex h-8 w-8 items-center justify-center rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text`,title:`Close`,children:(0,K.jsx)(nc,{className:`h-4 w-4`})})]}),i===1&&(0,K.jsxs)(`div`,{className:`px-6 py-6`,children:[(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium uppercase tracking-[0.08em] text-text-muted`,children:`Name`}),(0,K.jsx)(`input`,{ref:j,type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&te()},placeholder:`e.g. Aria`,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-serif text-[15px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none`}),c&&!F&&(0,K.jsx)(`p`,{className:`font-sans mt-1 text-[11px] text-health-error`,children:`Name must include at least one letter or number.`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium uppercase tracking-[0.08em] text-text-muted`,children:`Role`}),(0,K.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&te()},placeholder:`e.g. Full-stack developer`,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-serif text-[15px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium uppercase tracking-[0.08em] text-text-muted`,children:`Provider`}),M&&H.length===P.length?(0,K.jsx)(`p`,{className:`font-sans text-[12px] text-health-warn`,children:`No providers detected. Install Claude Code, Codex CLI, or Kimi CLI first.`}):(0,K.jsxs)(`div`,{className:[`grid gap-2`,(z?.reasoningEfforts??[]).length>0?`grid-cols-3`:`grid-cols-2`].join(` `),children:[(0,K.jsxs)(sM,{value:f,onValueChange:e=>ee(e),children:[(0,K.jsx)(lM,{className:`!h-auto w-full py-2 font-serif text-[15px]`,children:(0,K.jsx)(cM,{children:e=>I(e)})}),(0,K.jsx)(uM,{children:P.map(e=>{let t=Cx(e,M);return(0,K.jsxs)(dM,{value:e.kind,disabled:!!t,children:[e.label,t?` — ${t}`:``]},e.kind)})})]}),(0,K.jsxs)(sM,{value:m,onValueChange:e=>{e&&h(e)},children:[(0,K.jsx)(lM,{className:`!h-auto w-full py-2 font-serif text-[15px]`,children:(0,K.jsx)(cM,{children:e=>L(e)})}),(0,K.jsx)(uM,{children:(z?.models??[]).map(e=>(0,K.jsx)(dM,{value:e,children:L(e)},e))})]}),(z?.reasoningEfforts??[]).length>0&&(0,K.jsxs)(sM,{value:g,onValueChange:e=>{e&&_(e)},children:[(0,K.jsx)(lM,{className:`!h-auto w-full py-2 font-serif text-[15px]`,children:(0,K.jsx)(cM,{children:e=>R(e)})}),(0,K.jsx)(uM,{children:(z?.reasoningEfforts??[]).map(e=>(0,K.jsx)(dM,{value:e,children:R(e)},e))})]})]}),V&&(0,K.jsx)(`p`,{className:`font-sans mt-1 text-[11px] text-health-warn`,children:V}),U&&(0,K.jsx)(`p`,{className:`font-sans mt-1 text-[11px] text-text-subtle`,children:`Checking installed provider CLIs...`}),N&&(0,K.jsxs)(`p`,{className:`font-sans mt-1 text-[11px] text-health-error`,children:[`Provider check failed: `,N instanceof Error?N.message:String(N)]})]}),!T&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>b(e=>!e),className:`font-sans flex items-center gap-1 text-[12px] text-text-muted hover:text-text transition-colors`,children:[y?(0,K.jsx)(Ps,{className:`h-3.5 w-3.5`}):(0,K.jsx)(Is,{className:`h-3.5 w-3.5`}),`Where it lives`]}),y&&(0,K.jsxs)(`div`,{className:`mt-2 rounded-sm border border-border-soft bg-surface-elevated p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`font-mono text-[13px] text-text break-all`,children:W}),(0,K.jsx)(`div`,{className:`font-sans mt-0.5 text-[11px] text-text-subtle`,children:`Will be created automatically`}),(0,K.jsxs)(`p`,{className:`font-sans mt-2 text-[12px] text-text-muted`,children:[`Your agent's memory lives here, inside your team's `,(0,K.jsx)(`strong`,{className:`font-semibold text-text`,children:`Knowledge Base`}),`.`]})]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>w(!0),className:`font-sans shrink-0 text-[12px] text-text-muted underline decoration-text-muted/40 underline-offset-2 hover:text-text hover:decoration-text/40 transition-colors`,children:`Change…`})]}),x&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>S(null),className:`font-sans mt-2 text-[11px] text-text-subtle underline underline-offset-2 hover:text-text transition-colors`,children:`Reset to default`})]})]})]}),D&&(0,K.jsx)(`p`,{className:`font-sans mt-3 text-[12px] text-health-error`,children:D}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(kw,{className:`w-full`,onClick:()=>void te(),disabled:k||!!ae,children:k?T?`Saving…`:`Creating…`:ae??(T?`Save & continue →`:`Create agent →`)})})]}),i===2&&T&&(0,K.jsx)(`div`,{className:`px-6 py-6`,children:(0,K.jsx)(CM,{agentId:T,onConnect:ne})}),i===3&&T&&(0,K.jsx)(`div`,{className:`px-6 py-6`,children:(0,K.jsx)(TM,{agentId:T,onConfirm:re,onSkip:re,submitLabel:`Start onboarding →`,showRationale:!0})})]});return e?(0,K.jsx)(`div`,{className:`fixed inset-0 overflow-y-auto bg-surface`,children:(0,K.jsxs)(`div`,{className:`flex min-h-full w-full flex-col items-center justify-center gap-6 px-4 pt-8 pb-[20vh]`,children:[(0,K.jsxs)(`div`,{className:`text-center`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,K.jsx)(_d,{className:`h-6 w-6 text-accent`}),(0,K.jsx)(`span`,{className:`font-serif text-[26px] font-semibold text-text`,children:`Anima`})]}),(0,K.jsx)(`p`,{className:`font-sans mt-2 max-w-sm text-balance text-[13px] leading-relaxed text-text-muted`,children:`An AI agent team that works alongside your human team in Slack, building up shared knowledge over time.`})]}),oe]})}):oe}function kM(){let e=nr();return(0,K.jsx)(OM,{firstRun:!0,onClose:()=>e(`/`),onComplete:t=>e(`/agents/${t}/activity`)})}function AM({onClose:e}){let t=nr();return(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,children:(0,K.jsx)(OM,{firstRun:!1,onClose:e,onComplete:n=>{e(),t(`/agents/${n}/activity`)}})})}function jM(e){return hx(e)}function MM(e){return e.split(`/`).filter(Boolean).pop()??e}function NM({onClose:e,onAdded:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(null);(0,v.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!n&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n]);async function o(n){let i=MM(n),o=jM(i);r(!0),a(null);try{await $p({id:o,label:i,path:n}),t(o),e()}catch(e){a(e instanceof Error?e.message:`Unknown error`),r(!1)}}return(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,onClick:()=>{n||e()},role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:`relative w-full max-w-2xl rounded-sm border border-border-soft bg-surface p-5 shadow-deep`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`div`,{className:`mb-3 font-serif text-[17px] font-semibold text-text`,children:`Add Knowledge Base`}),(0,K.jsx)(hM,{onChoose:o,onCancel:e,confirmLabel:n?`Adding…`:`Add Knowledge Base`,confirmDisabled:n}),i&&(0,K.jsx)(`div`,{className:`mt-2 font-sans text-[12px] leading-snug text-health-error`,children:i})]})}),document.body)}function PM({kb:e,busy:t,error:n,onConfirm:r,onCancel:i}){let[a,o]=(0,v.useState)(e.label),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>{setTimeout(()=>s.current?.focus(),0)},[]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!t&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,t]),(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,onClick:()=>{t||i()},role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:`relative w-full max-w-sm rounded-sm border border-border-soft bg-surface p-6 shadow-deep`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`div`,{className:`font-serif text-[17px] font-semibold text-text`,children:`Rename Knowledge Base`}),(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),a.trim()&&r(a.trim())},className:`mt-3 space-y-3`,children:[(0,K.jsx)(`input`,{ref:s,type:`text`,value:a,onChange:e=>o(e.target.value),disabled:t,className:`w-full rounded-sm border border-border bg-muted/30 px-3 py-1.5 font-sans text-[14px] text-text placeholder:text-text-subtle focus:outline-none focus:ring-1 focus:ring-ring`}),n&&(0,K.jsx)(`div`,{className:`font-sans text-[12px] leading-snug text-health-error`,children:n}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(kw,{type:`submit`,disabled:t||!a.trim()||a.trim()===e.label,children:t?`Saving…`:`Save`}),(0,K.jsx)(kw,{type:`button`,onClick:i,variant:`outline`,disabled:t,children:`Cancel`})]})]})]})}),document.body)}function FM({kb:e,busy:t,onConfirm:n,onCancel:r}){return(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!t&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,t]),(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,onClick:()=>{t||r()},role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:`relative w-full max-w-sm rounded-sm border border-health-error/30 bg-surface p-6 pl-8 shadow-deep`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-4 bottom-4 w-px bg-health-error/50`}),(0,K.jsx)(`div`,{className:`font-serif text-[17px] font-semibold text-text`,children:`Remove Knowledge Base?`}),(0,K.jsxs)(`div`,{className:`font-serif mt-2 text-[14px] leading-relaxed text-text-muted`,children:[(0,K.jsx)(`span`,{className:`font-semibold text-text`,children:e.label}),` will be removed from the sidebar. Files on disk are not affected.`]}),(0,K.jsxs)(`div`,{className:`mt-5 flex gap-2`,children:[(0,K.jsx)(kw,{onClick:n,variant:`destructive`,disabled:t,children:t?`Removing…`:`Remove`}),(0,K.jsx)(kw,{onClick:r,variant:`outline`,disabled:t,children:`Cancel`})]})]})}),document.body)}function IM({anchorRect:e,onRename:t,onDelete:n,onClose:r}){return(0,v.useEffect)(()=>{let e=()=>r();return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[r]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),(0,y.createPortal)((0,K.jsxs)(`div`,{className:`fixed z-40 min-w-[128px] rounded-sm border border-border bg-surface py-0.5 shadow-md`,style:{top:e.bottom+4,right:window.innerWidth-e.right},onPointerDown:e=>e.stopPropagation(),children:[(0,K.jsx)(`button`,{onClick:t,className:`flex w-full items-center px-3 py-1.5 font-sans text-[13px] text-text hover:bg-muted`,children:`Rename`}),(0,K.jsx)(`button`,{onClick:n,className:`flex w-full items-center px-3 py-1.5 font-sans text-[13px] text-health-error hover:bg-muted`,children:`Delete`})]}),document.body)}function LM({id:e,children:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=hd({id:e});return(0,K.jsxs)(`div`,{ref:i,style:{transform:Oc.Transform.toString(a),transition:o??void 0},...n,...r,className:[`group/drag relative select-none`,s?`z-50 opacity-40`:``].join(` `),children:[(0,K.jsx)(Ws,{"aria-hidden":!0,className:`pointer-events-none absolute left-0.5 top-1/2 h-3 w-3 -translate-y-1/2 text-text-on-spine-subtle opacity-0 transition-opacity group-hover/drag:opacity-50`}),t]})}function RM({collapsed:e,onToggle:t}){let{data:n=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o,refetchInterval:Fo.agentStatuses}),{pathname:r}=$n(),i=nr(),{agentId:a}=ms(r),o=e=>i(e?`/agents/${e}`:`/`),s=new Set(n.filter(e=>e.currentItemId||e.queueDepth>0).map(e=>e.agentId)),{orderedAgents:c,orderedKbs:l,agentIndexMap:u,kbIndexMap:d,sensors:f,reorderAgents:p,reorderKbs:m}=sm(),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(null),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(!1),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(!1),I=Dp();function L(e,t){e.stopPropagation();let n=e.currentTarget.getBoundingClientRect();x(t),C(n)}function R(){x(null),C(null)}async function z(e){D(!0),T(null);try{let t=await nm(e);No.invalidateQueries({queryKey:Po.kbs()}),r.startsWith(`/kb/${e}`)&&i(t.length>0?`/kb/${t[0].id}`:`/`)}catch{}finally{D(!1)}}async function B(e,t){j(!0),N(null);try{await tm(e,t),No.invalidateQueries({queryKey:Po.kbs()}),k(null)}catch(e){N(e instanceof Error?e.message:`Rename failed`)}finally{j(!1)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`aside`,{className:[`relative hidden md:flex h-dvh shrink-0 flex-col overflow-hidden border-r border-spine-border bg-page`,`transition-[width] duration-200 ease-out`,e?`w-[68px]`:`w-64`].join(` `),children:[(0,K.jsxs)(`div`,{"aria-hidden":!e,className:[`absolute inset-0 flex flex-col transition-opacity duration-150 ease-out`,e?`opacity-100`:`opacity-0 pointer-events-none`].join(` `),children:[(0,K.jsx)(`button`,{onClick:t,title:`Expand sidebar`,className:`flex h-14 shrink-0 w-full items-center justify-center border-b border-spine-border hover:bg-spine-elevated/60 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-accent transition-colors`,children:(0,K.jsx)(_d,{className:`h-4 w-4 text-accent`})}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col items-center overflow-y-auto py-2 gap-2`,children:[l.map(e=>{let t=r.startsWith(`/kb/${e.id}`),n=lm((d.get(e.id)??0)+6),a=um(e.label);return(0,K.jsxs)(`div`,{className:`relative w-full flex justify-center`,children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-2 bottom-2 w-0.5 bg-accent`}),(0,K.jsx)(`button`,{onClick:()=>i(`/kb/${e.id}`),title:e.label,className:[`flex h-11 w-11 items-center justify-center rounded-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,t?`bg-spine-elevated`:`hover:bg-spine-elevated/30`].join(` `),children:(0,K.jsx)(`span`,{className:`font-sans flex h-9 w-9 items-center justify-center rounded-sm text-[13px] font-bold text-white`,style:{background:n},children:a})})]},e.id)}),l.length>0&&c.length>0&&(0,K.jsx)(`div`,{className:`w-full shrink-0 border-t border-spine-border my-1`}),c.map(e=>{let t=a===e.id,n=s.has(e.id),r=e.enabled!==!1,i=r&&e.slack?.connected!==!0,c=lm(u.get(e.id)??0),l=e.profile?.displayName??e.id,d=um(l);return(0,K.jsxs)(`div`,{className:`relative w-full flex justify-center`,children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-2 bottom-2 w-0.5 bg-accent`}),(0,K.jsxs)(`button`,{onClick:()=>o(e.id),title:l,className:[`flex h-11 w-11 items-center justify-center rounded-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,t?`bg-spine-elevated`:`hover:bg-spine-elevated/30`].join(` `),children:[e.slack?.avatarUrl?(0,K.jsx)(`img`,{src:e.slack.avatarUrl,alt:``,className:[`h-9 w-9 rounded-sm object-cover`,!r||i?`opacity-40 grayscale`:``].join(` `)}):(0,K.jsx)(`span`,{className:[`font-sans flex h-9 w-9 items-center justify-center rounded-sm text-[13px] font-bold text-white`,!r||i?`opacity-40`:``].join(` `),style:{background:c},children:d}),r&&!i&&n&&(0,K.jsx)(`span`,{className:`absolute right-0.5 bottom-0.5 h-2 w-2 shrink-0 rounded-full border border-page`,style:{background:`var(--color-health-warn)`},title:`working`})]})]},e.id)})]}),(0,K.jsx)(`div`,{className:`shrink-0 border-t border-spine-border py-1.5 flex justify-center`,children:(0,K.jsxs)(`button`,{"data-server-panel-trigger":!0,onClick:()=>F(e=>!e),title:I?`Server — update available`:`Server status & restart`,className:`relative flex h-8 w-8 items-center justify-center rounded-sm text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[(0,K.jsx)(Qs,{className:`h-3.5 w-3.5`}),I&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-accent ring-1 ring-spine-border`})]})})]}),!e&&(0,K.jsx)(`button`,{onClick:t,className:`absolute right-3 top-3.5 z-10 flex h-6 w-6 items-center justify-center rounded-sm text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,title:`Collapse sidebar`,children:(0,K.jsx)(Fs,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{"aria-hidden":e,className:[`flex h-full w-64 shrink-0 flex-col transition-opacity duration-150 ease-out`,e?`pointer-events-none opacity-0`:`opacity-100`].join(` `),children:[(0,K.jsxs)(`div`,{className:`flex h-14 items-center gap-2.5 border-b border-spine-border px-5`,children:[(0,K.jsx)(_d,{className:`h-4 w-4 text-accent`}),(0,K.jsx)(`span`,{className:`display text-[18px] font-semibold tracking-tight text-text-on-spine`,children:`Anima`}),(0,K.jsx)(`span`,{className:`ml-auto h-6 w-6`,"aria-hidden":!0})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center justify-between pl-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`caps text-text-on-spine-subtle`,children:`Knowledge Base`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-text-on-spine-subtle`,children:l.length})]}),(0,K.jsx)(`button`,{onClick:()=>g(!0),className:`flex h-7 w-7 items-center justify-center rounded-sm text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,title:`Add Knowledge Base`,"aria-label":`Add Knowledge Base`,children:(0,K.jsx)(qs,{className:`h-3 w-3`})})]}),(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(Vu,{sensors:f,collisionDetection:Zc,onDragEnd:m,children:(0,K.jsx)(sd,{items:l.map(e=>e.id),strategy:rd,children:l.map(e=>{let t=r.startsWith(`/kb/${e.id}`);return(0,K.jsx)(LM,{id:e.id,children:(0,K.jsxs)(`div`,{className:[`group relative flex min-h-[44px] w-full items-center rounded-sm transition-colors`,t?`bg-spine-elevated`:`hover:bg-spine-elevated/60`].join(` `),children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-1.5 bottom-1.5 w-px bg-accent`}),(0,K.jsxs)(`button`,{onClick:()=>i(`/kb/${e.id}`),className:`flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-inset`,children:[(0,K.jsx)(Us,{className:`h-4 w-4 shrink-0 text-text-on-spine-muted`}),(0,K.jsx)(`span`,{className:[`truncate font-serif text-[14px] leading-tight text-text-on-spine`,t?`font-semibold`:`font-medium`].join(` `),children:e.label})]}),(0,K.jsx)(`button`,{onClick:t=>L(t,e.id),className:`mr-1 flex min-h-[44px] w-8 shrink-0 items-center justify-center rounded-sm text-text-on-spine-subtle opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100 hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:opacity-100 focus-visible:ring-1 focus-visible:ring-accent`,title:`Knowledge Base options`,"aria-label":`Knowledge Base options`,children:(0,K.jsx)(Bs,{className:`h-3.5 w-3.5`})})]})},e.id)})})}),l.length===0&&(0,K.jsxs)(`button`,{onClick:()=>g(!0),className:`flex items-center gap-1.5 px-2 font-sans text-[11px] text-text-on-spine-subtle hover:text-text-on-spine`,children:[(0,K.jsx)(qs,{className:`h-3 w-3`}),`Add Knowledge Base`]})]})]}),(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between pl-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`caps text-text-on-spine-subtle`,children:`Agents`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-text-on-spine-subtle`,children:c.length})]}),(0,K.jsx)(`button`,{onClick:()=>y(!0),className:`flex h-7 w-7 items-center justify-center rounded-sm text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,title:`Add agent`,"aria-label":`Add agent`,children:(0,K.jsx)(qs,{className:`h-3 w-3`})})]}),(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(Vu,{sensors:f,collisionDetection:Zc,onDragEnd:p,children:(0,K.jsx)(sd,{items:c.map(e=>e.id),strategy:rd,children:c.map(e=>(0,K.jsx)(LM,{id:e.id,children:(0,K.jsx)(dm,{agent:e,index:u.get(e.id)??0,active:a===e.id,isRunning:s.has(e.id),enabled:e.enabled!==!1,onClick:()=>o(e.id)})},e.id))})}),c.length===0&&(0,K.jsx)(`div`,{className:`px-2 py-4 text-center font-serif italic text-[12px] text-text-on-spine-subtle`,children:`No agents configured`})]})]}),(0,K.jsx)(`div`,{className:`border-t border-spine-border p-2`,children:(0,K.jsxs)(`button`,{"data-server-panel-trigger":!0,onClick:()=>F(e=>!e),className:`chrome flex w-full cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2.5 text-left text-[11px] uppercase tracking-[0.1em] text-text-on-spine-muted transition-colors hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,title:`Server status & restart`,children:[(0,K.jsx)(Qs,{className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{children:`Server`}),I&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`ml-auto h-1.5 w-1.5 rounded-full bg-accent`,title:`Update available`})]})})]})]}),h&&(0,K.jsx)(NM,{onClose:()=>g(!1),onAdded:e=>{No.invalidateQueries({queryKey:Po.kbs()}),i(`/kb/${e}`)}}),b!==null&&S!==null&&(0,K.jsx)(IM,{anchorRect:S,onRename:()=>{let e=l.find(e=>e.id===b);R(),e&&k(e)},onDelete:()=>{let e=l.find(e=>e.id===b);R(),e&&T(e)},onClose:R}),O!==null&&(0,K.jsx)(PM,{kb:O,busy:A,error:M,onConfirm:e=>void B(O.id,e),onCancel:()=>{k(null),N(null)}}),w!==null&&(0,K.jsx)(FM,{kb:w,busy:E,onConfirm:()=>void z(w.id),onCancel:()=>T(null)}),_&&(0,K.jsx)(AM,{onClose:()=>y(!1)}),P&&(0,K.jsx)(Jp,{onClose:()=>F(!1)})]})}var zM=class extends v.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary]`,e,t.componentStack)}reset=()=>this.setState({error:null});render(){let{error:e}=this.state,{children:t,fallback:n}=this.props;return e?n?n(e,this.reset):(0,K.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 p-8 text-center`,children:[(0,K.jsx)(Rs,{className:`h-8 w-8 text-health-error`,"aria-hidden":!0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-serif text-[16px] font-semibold text-text`,children:`Something went wrong`}),(0,K.jsx)(`div`,{className:`mt-1 font-mono text-[12px] text-text-muted`,children:e.message})]}),(0,K.jsx)(`button`,{onClick:this.reset,className:`rounded-sm border border-border-soft bg-surface px-4 py-2 font-sans text-[13px] text-text hover:bg-surface-elevated`,children:`Try again`})]}):t}};function BM({open:e,title:t,description:n,variant:r=`error`,size:i=`default`,busy:a=!1,error:o,confirmLabel:s=`Confirm`,busyLabel:c=`Saving…`,confirmVariant:l=`destructive`,onConfirm:u,onCancel:d}){if((0,v.useEffect)(()=>{if(!e)return;function t(e){e.key===`Escape`&&!a&&d()}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,a,d]),!e)return null;let f=r===`error`?{border:`border-health-error/40`,bg:`bg-health-error-soft`,rule:`bg-health-error`}:{border:`border-health-warn/40`,bg:`bg-health-warn-soft`,rule:`bg-health-warn`},p=i===`large`;return(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,onClick:()=>{a||d()},role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:[`relative w-full rounded-sm border shadow-deep`,f.border,f.bg,p?`max-w-xl p-7 pl-8`:`mx-4 max-w-md p-6 pl-7`].join(` `),onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-4 bottom-4 w-px ${f.rule}`}),(0,K.jsx)(`div`,{className:[`font-serif font-semibold text-text`,p?`text-[17px]`:`text-[16px]`].join(` `),children:t}),(0,K.jsx)(`div`,{className:[`font-serif mt-2 leading-relaxed text-text-muted`,p?`text-[15px]`:`text-[14px]`].join(` `),children:n}),o&&(0,K.jsx)(`div`,{className:`mt-2 font-sans text-[11px] tracking-wide text-health-error`,children:o}),(0,K.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,K.jsx)(kw,{disabled:a,onClick:u,variant:l,className:p?void 0:`min-h-[44px]`,size:p?void 0:`sm`,children:a?c:s}),(0,K.jsx)(kw,{disabled:a,onClick:d,variant:`outline`,className:p?void 0:`min-h-[44px]`,size:p?void 0:`sm`,children:`Cancel`})]})]})})}function VM({buttonClassName:e}){let{data:t=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{agentId:n}=or(),r=nr(),i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(),[b,x]=(0,v.useState)(!1),[S,C]=(0,v.useState)(!1),[w,T]=(0,v.useState)();if((0,v.useEffect)(()=>{if(!a)return;function e(e){i.current&&!i.current.contains(e.target)&&o(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[a]),!n)return null;let E=t.find(e=>e.id===n);if(!E)return null;let D=E.enabled!==!1;async function O(e){if(!(!n||l)){u(!0),f(void 0);try{await(e?Ho(n):Uo(n)),c(!1),es()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function k(){if(!(!n||h)){g(!0),y(void 0);try{await Xo(n),r(`/`)}catch(e){y(e instanceof Error?e.message:String(e)),g(!1)}}}async function A(){if(!(!n||S)){C(!0),T(void 0);try{await rs(n),x(!1),es()}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,K.jsx)(kw,{size:`xs`,variant:`ghost`,"aria-label":`More actions`,onClick:()=>o(e=>!e),className:e??`min-h-[44px] min-w-[44px]`,children:(0,K.jsx)(Bs,{className:`h-4 w-4`})}),a&&(0,K.jsxs)(`div`,{className:`absolute right-0 top-full z-10 mt-1 min-w-[180px] rounded-sm border border-border-soft bg-surface py-1 shadow-deep`,children:[D?(0,K.jsxs)(`button`,{className:`flex min-h-[44px] w-full items-center gap-2.5 px-3 text-left font-sans text-[13px] text-text-muted hover:bg-surface-elevated hover:text-text`,onClick:()=>{o(!1),c(!0)},children:[(0,K.jsx)(Js,{className:`h-3.5 w-3.5 shrink-0`}),`Disable when idle`]}):(0,K.jsxs)(`button`,{disabled:l,className:`flex min-h-[44px] w-full items-center gap-2.5 px-3 text-left font-sans text-[13px] text-text-muted hover:bg-surface-elevated hover:text-text disabled:opacity-50`,onClick:()=>{o(!1),O(!0)},children:[(0,K.jsx)(Ys,{className:`h-3.5 w-3.5 shrink-0`}),l?`Saving...`:`Enable`]}),(0,K.jsxs)(`button`,{className:`flex min-h-[44px] w-full items-center gap-2.5 px-3 text-left font-sans text-[13px] text-text-muted hover:bg-surface-elevated hover:text-text`,onClick:()=>{o(!1),x(!0)},children:[(0,K.jsx)(Zs,{className:`h-3.5 w-3.5 shrink-0`}),`Rotate session`]}),(0,K.jsx)(`div`,{className:`my-1 h-px bg-border-soft`}),(0,K.jsxs)(`button`,{className:`flex min-h-[44px] w-full items-center gap-2.5 px-3 text-left font-sans text-[13px] text-health-error hover:bg-health-error-soft`,onClick:()=>{o(!1),m(!0)},children:[(0,K.jsx)($s,{className:`h-4 w-4 shrink-0`}),`Remove agent`]})]})]}),(0,K.jsx)(BM,{open:s&&D,title:`Disable this agent?`,description:`If it is running now, it will stop after the current item finishes. Memory and session are preserved.`,variant:`error`,busy:l,error:d,confirmLabel:`Disable`,busyLabel:`Saving...`,onConfirm:()=>void O(!1),onCancel:()=>{c(!1),f(void 0)}}),(0,K.jsx)(BM,{open:p,title:`Remove this agent?`,description:`The agent will stop running and its local Anima config will be deleted. Home files are not affected.`,variant:`error`,busy:h,error:_,confirmLabel:`Remove`,busyLabel:`Removing…`,onConfirm:()=>void k(),onCancel:()=>{m(!1),y(void 0)}}),(0,K.jsx)(BM,{open:b,title:`Rotate primary session?`,description:`The current item keeps running. The next item starts fresh, and the current provider session is archived.`,variant:`warn`,busy:S,error:w,confirmLabel:`Confirm`,busyLabel:`Rotating…`,onConfirm:()=>void A(),onCancel:()=>{x(!1),T(void 0)}})]})}function HM(){let{data:e=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:t=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o,refetchInterval:Fo.agentStatuses}),{pathname:n}=$n(),r=nr(),{agentId:i}=ms(n),a=e=>r(e?`/agents/${e}/activity`:`/`),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null);if(!i)return null;let u=e.findIndex(e=>e.id===i),d=u>=0?e[u]:void 0,f=t.find(e=>e.agentId===i)?.currentItemId,p=!!f,m=d?.profile?.displayName??d?.id??i,h=d?um(m):`?`,g=u>=0?lm(u):`var(--color-health-idle)`,_=d?.enabled!==!1,y=d?.slack?.connected===!0,b=async()=>{if(!(!f||o||!i)){s(!0),l(null);try{await us(i),es()}catch(e){l(e instanceof Error?e.message:`Stop failed`)}finally{s(!1)}}};return(0,K.jsx)(`div`,{className:`relative md:hidden`,style:{position:`fixed`,top:0,left:0,right:0,zIndex:40},children:(0,K.jsxs)(`div`,{className:`flex h-14 items-center gap-1.5 border-b border-border-soft bg-surface px-2`,children:[(0,K.jsx)(`button`,{onClick:()=>a(null),className:`flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center rounded-sm text-text-muted transition-colors hover:bg-surface-elevated hover:text-text`,"aria-label":`Back to agent list`,children:(0,K.jsx)(Fs,{className:`h-5 w-5`})}),d?.slack?.avatarUrl?(0,K.jsx)(`img`,{src:d.slack.avatarUrl,alt:``,className:[`h-6 w-6 shrink-0 rounded-sm object-cover`,y?``:`opacity-40 grayscale`].join(` `)}):(0,K.jsx)(`span`,{className:[`font-sans flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-[10px] font-bold text-white`,y?``:`opacity-40`].join(` `),style:{background:g},children:h}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`display truncate text-[15px] font-semibold text-text`,children:m}),_&&!y&&(0,K.jsx)(`span`,{className:`font-sans shrink-0 rounded-sm border border-health-warn/40 px-1 py-0.5 text-[9px] uppercase tracking-[0.08em] text-health-warn`,children:`Not connected`}),(0,K.jsx)(`span`,{className:`inline-block h-2 w-2 shrink-0 rounded-full`,style:{background:p||!_?`var(--color-health-warn)`:y?`var(--color-health-ok)`:`var(--color-health-idle)`}})]}),f&&(0,K.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,K.jsx)(`button`,{onClick:()=>void b(),disabled:o,className:`chrome rounded-sm border border-border-soft px-2 py-1 text-[10px] font-medium uppercase tracking-[0.1em] text-text-muted hover:border-border-strong hover:text-text disabled:opacity-50`,children:o?`Stopping…`:`Stop`}),c&&(0,K.jsx)(`span`,{className:`font-sans text-[10px] text-health-error`,children:c})]}),(0,K.jsx)(VM,{buttonClassName:`flex min-h-[44px] min-w-[44px] items-center justify-center rounded-sm text-text-muted transition-colors hover:bg-surface-elevated hover:text-text`})]})})}var UM=[{id:`activity`,label:`Activity`,Icon:Ks},{id:`reminders`,label:`Reminders`,Icon:Ms},{id:`profile`,label:`Profile`,Icon:tc}];function WM(){let{pathname:e}=$n(),t=nr(),{agentId:n,tab:r}=ms(e),i=r&&fs.includes(r)?r:ps,a=e=>{n&&t(`/agents/${n}/${e}`)};return n?(0,K.jsx)(`nav`,{className:`flex border-t border-border-soft bg-surface pb-[env(safe-area-inset-bottom)] md:hidden`,style:{position:`fixed`,bottom:0,left:0,right:0,zIndex:40},children:UM.map(e=>{let t=i===e.id;return(0,K.jsxs)(`button`,{onClick:()=>a(e.id),className:[`chrome relative flex flex-1 flex-col items-center gap-0.5 px-2 py-2.5 text-[10px] font-medium uppercase tracking-[0.1em] transition-colors`,t?`text-text`:`text-text-muted`].join(` `),children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-0 left-3 right-3 h-[3px] rounded-b-[2px] bg-accent`}),(0,K.jsx)(e.Icon,{className:`h-5 w-5`}),(0,K.jsx)(`span`,{children:e.label})]},e.id)})}):null}var GM=`mobile-nav-scroll`;function KM({id:e,children:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=hd({id:e});return(0,K.jsx)(`div`,{ref:i,style:{transform:Oc.Transform.toString(a),transition:o??void 0},...n,...r,className:[`relative select-none`,s?`z-50 opacity-40`:``].join(` `),children:t})}function qM({onSelectAgent:e,lastSelectedId:t}){let{orderedAgents:n,orderedKbs:r,agentIndexMap:i,sensors:a,reorderAgents:o,reorderKbs:s}=sm(),c=$n(),l=nr(),u=(0,v.useRef)(null),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),_=Dp();(0,v.useEffect)(()=>{let e=sessionStorage.getItem(GM);e&&u.current&&(u.current.scrollTop=Number(e))},[]);let y=t=>{u.current&&sessionStorage.setItem(GM,String(u.current.scrollTop)),e(t)},b=e=>{u.current&&sessionStorage.setItem(GM,String(u.current.scrollTop)),l(`/kb/${e}`)},{data:x=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o,refetchInterval:Fo.agentStatuses}),S=new Set(x.filter(e=>e.currentItemId||e.queueDepth>0).map(e=>e.agentId));return(0,K.jsxs)(`div`,{className:`flex h-dvh flex-col bg-surface md:hidden`,children:[(0,K.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center gap-2.5 border-b border-border-soft bg-surface px-5`,style:{position:`sticky`,top:0,zIndex:10},children:[(0,K.jsx)(_d,{className:`h-4 w-4 text-accent`}),(0,K.jsx)(`span`,{className:`display text-[18px] font-semibold tracking-tight text-text`,children:`Anima`})]}),(0,K.jsxs)(`div`,{ref:u,className:`flex-1 overflow-y-auto p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-3`,children:[(0,K.jsx)(`span`,{className:`caps text-text-muted`,children:`Knowledge Base`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-text-muted`,children:r.length}),(0,K.jsx)(`button`,{onClick:()=>m(!0),className:`ml-auto flex min-h-[44px] min-w-[44px] items-center justify-end rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text`,"aria-label":`Add Knowledge Base`,title:`Add Knowledge Base`,children:(0,K.jsx)(qs,{className:`h-3.5 w-3.5`})})]}),(0,K.jsx)(Vu,{sensors:a,collisionDetection:Zc,onDragEnd:s,children:(0,K.jsx)(sd,{items:r.map(e=>e.id),strategy:rd,children:(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[r.map(e=>{let t=c.pathname.startsWith(`/kb/${e.id}`);return(0,K.jsx)(KM,{id:e.id,children:(0,K.jsxs)(`button`,{onClick:()=>b(e.id),className:[`relative flex min-h-[44px] w-full items-center gap-2.5 rounded-sm px-3 py-3 text-left transition-colors`,t?`bg-surface-elevated`:`hover:bg-surface-elevated/60`].join(` `),children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-2 bottom-2 w-px bg-accent`}),(0,K.jsx)(Us,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,K.jsx)(`span`,{className:[`truncate font-serif text-[15px] leading-tight text-text`,t?`font-semibold`:`font-medium`].join(` `),children:e.label})]})},e.id)}),r.length===0&&(0,K.jsxs)(`button`,{onClick:()=>m(!0),className:`flex items-center gap-1.5 px-2 font-sans text-[11px] text-text-muted hover:text-text`,children:[(0,K.jsx)(qs,{className:`h-3 w-3`}),`Add Knowledge Base`]})]})})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-3`,children:[(0,K.jsx)(`span`,{className:`caps text-text-muted`,children:`Agents`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-text-muted`,children:n.length}),(0,K.jsx)(`button`,{onClick:()=>f(!0),className:`ml-auto flex min-h-[44px] min-w-[44px] items-center justify-end rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text`,"aria-label":`Add agent`,title:`Add agent`,children:(0,K.jsx)(qs,{className:`h-3.5 w-3.5`})})]}),(0,K.jsx)(Vu,{sensors:a,collisionDetection:Zc,onDragEnd:o,children:(0,K.jsx)(sd,{items:n.map(e=>e.id),strategy:rd,children:(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[n.map(e=>{let n=lm(i.get(e.id)??0),r=e.profile?.displayName??e.id,a=um(r),o=S.has(e.id),s=e.enabled!==!1,c=s&&e.slack?.connected!==!0,l=e.id===t;return(0,K.jsx)(KM,{id:e.id,children:(0,K.jsxs)(`button`,{onClick:()=>y(e.id),className:[`relative flex min-h-[44px] w-full items-center gap-2.5 rounded-sm px-3 py-3 text-left transition-colors`,l?`bg-surface-elevated`:`hover:bg-surface-elevated/60`].join(` `),children:[l&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-2 bottom-2 w-0.5 bg-accent`}),e.slack?.avatarUrl?(0,K.jsx)(`img`,{src:e.slack.avatarUrl,alt:``,className:`h-6 w-6 shrink-0 rounded-sm object-cover`,style:{opacity:s?1:.45}}):(0,K.jsx)(`span`,{className:`font-sans flex h-6 w-6 shrink-0 items-center justify-center rounded-sm text-[10px] font-bold text-white`,style:{background:n,opacity:s?1:.45},children:a}),(0,K.jsx)(`span`,{className:[`flex-1 truncate font-serif text-[15px] font-medium leading-tight`,s?`text-text`:`text-text-muted`].join(` `),children:r}),s?c?(0,K.jsx)(`span`,{className:`font-sans ml-auto shrink-0 rounded-sm border border-health-warn/40 px-1 py-0.5 text-[9px] uppercase tracking-[0.08em] text-health-warn`,title:`not connected to Slack`,children:`No Slack`}):(0,K.jsx)(`span`,{className:`inline-block h-2 w-2 shrink-0 rounded-full`,style:{background:o?`var(--color-health-warn)`:`var(--color-health-ok)`}}):(0,K.jsx)(`span`,{className:`font-sans ml-auto shrink-0 rounded-sm border border-text-muted/30 px-1 py-0.5 text-[9px] uppercase tracking-[0.08em] text-text-muted`,children:`Off`})]})},e.id)}),n.length===0&&(0,K.jsx)(`div`,{className:`px-2 py-6 text-center font-serif italic text-[13px] text-text-muted`,children:`No agents configured`})]})})})]})]}),(0,K.jsx)(`div`,{className:`shrink-0 border-t border-border-soft px-2 pb-2 pt-1`,style:{paddingBottom:`calc(env(safe-area-inset-bottom) + 0.5rem)`},children:(0,K.jsxs)(`button`,{onClick:()=>g(!0),title:_?`Server — update available`:`Server status & restart`,className:`flex min-h-[44px] w-full items-center gap-2.5 rounded-sm px-3 py-2 text-left transition-colors hover:bg-surface-elevated/60`,children:[(0,K.jsx)(Qs,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,K.jsx)(`span`,{className:`font-serif text-[15px] font-medium leading-tight text-text-muted`,children:`Server`}),_&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`ml-auto h-1.5 w-1.5 rounded-full bg-accent`,title:`Update available`})]})}),d&&(0,K.jsx)(AM,{onClose:()=>f(!1)}),p&&(0,K.jsx)(NM,{onClose:()=>m(!1),onAdded:()=>{m(!1),No.invalidateQueries({queryKey:Po.kbs()})}}),h&&(0,K.jsx)(Jp,{onClose:()=>g(!1)})]})}var JM=768;function YM(){let[e,t]=(0,v.useState)(()=>typeof window<`u`?window.innerWidth<JM:!1);return(0,v.useEffect)(()=>{let e=window.matchMedia(`(max-width: ${JM-1}px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function XM(){try{return localStorage.getItem(`sidebar-collapsed`)===`true`}catch{return!1}}function ZM({disabled:e}){let{data:t}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:n}=jo({queryKey:Po.agentStatuses(),queryFn:$o}),r=$n(),i=nr();return(0,v.useEffect)(()=>{if(e||!t||!n||vs(r.pathname))return;let a=ms(r.pathname),o=xs({agents:t,agentStatuses:n,selectedAgentId:t[0]?.id},a);o&&i(hs(o),{replace:!0})},[e,t,n,r.pathname,i]),null}function QM(){let e=$n(),t=nr(),[n,r]=(0,v.useState)(XM),i=YM(),a=vs(e.pathname),{agentId:o}=ms(e.pathname),s=()=>{let e=!n;r(e);try{localStorage.setItem(`sidebar-collapsed`,String(e))}catch{}},c=(0,v.useCallback)(e=>{t(e?`/agents/${e}`:`/`)},[t]),[l,u]=(0,v.useState)(null),{data:d}=jo({queryKey:Po.agents(),queryFn:Zo});return d!==void 0&&d.length===0?(0,K.jsx)(Br,{to:`/onboarding`,replace:!0}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(vp,{}),!a&&(0,K.jsx)(ZM,{disabled:i&&!o&&!a}),i&&!o&&!a?(0,K.jsx)(qM,{onSelectAgent:e=>{c(e),u(e)},lastSelectedId:l}):(0,K.jsxs)(`div`,{className:`flex h-dvh w-screen overflow-hidden bg-page text-text`,children:[(0,K.jsx)(RM,{collapsed:n,onToggle:s}),(0,K.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden bg-surface`,children:[(0,K.jsx)(HM,{}),o&&(0,K.jsx)(`div`,{className:`h-14 shrink-0 md:hidden`}),(0,K.jsx)(zM,{children:(0,K.jsx)(Vr,{})},e.pathname),o&&(0,K.jsx)(`div`,{className:`h-[calc(3.5rem+env(safe-area-inset-bottom))] shrink-0 md:hidden`}),(0,K.jsx)(WM,{})]})]})]})}var $M=`anima-activity-lens`,eN=`anima-activity-show-all-steps`,tN=new Set;function nN(){try{let e=localStorage.getItem($M);if(e===`messages`)return`messages`;if(e===`activity`||e===`full`)return`activity`}catch{}return`activity`}var rN=nN();function iN(){return rN}function aN(e){rN=e;try{localStorage.setItem($M,e)}catch{}tN.forEach(e=>e())}function oN(e){return tN.add(e),()=>tN.delete(e)}var sN=new Set;function cN(){try{return localStorage.getItem(eN)===`1`}catch{return!1}}var lN=cN();function uN(){return lN}function dN(e){lN=e;try{localStorage.setItem(eN,e?`1`:`0`)}catch{}sN.forEach(e=>e())}function fN(e){return sN.add(e),()=>sN.delete(e)}function pN(){let[e,t]=Ui(),n=(0,v.useSyncExternalStore)(oN,iN,nN),r=(0,v.useSyncExternalStore)(fN,uN,cN),i=e.get(`dir`),a=i===`in`?`in`:i===`out`?`out`:`all`;function o(e){t(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`dir`):n.set(`dir`,e),n},{replace:!0})}let s=e.get(`failed`)===`1`;function c(e){t(t=>{let n=new URLSearchParams(t);return e?n.set(`failed`,`1`):n.delete(`failed`),n},{replace:!0})}return{lens:n,dir:a,failedOnly:s,showAllSteps:r,setLens:aN,setDir:o,setFailedOnly:c,setShowAllSteps:dN}}var mN=[{id:`activity`,label:`Activity`},{id:`profile`,label:`Profile`},{id:`reminders`,label:`Reminders`}];function hN({label:e,checked:t,onChange:n}){return(0,K.jsxs)(`label`,{className:`chrome inline-flex cursor-pointer items-center gap-1.5 text-[11px] tracking-wide text-text-muted hover:text-text`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked),className:`h-3 w-3 accent-[color:var(--color-accent)]`}),e]})}function gN({dir:e,onChange:t}){return(0,K.jsx)(`div`,{className:`flex items-center rounded-sm border border-border-soft p-0.5`,children:[`all`,`in`,`out`].map(n=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:[`chrome px-2.5 py-1 text-[11px] tracking-wide rounded-sm transition-colors`,e===n?`bg-accent/10 text-accent font-medium`:`text-text-muted hover:text-text`].join(` `),children:n===`all`?`All`:n===`in`?`Inbox`:`Outbox`},n))})}function _N({lens:e,onChange:t}){let n=`chrome px-2.5 py-1 text-[11px] tracking-wide rounded-sm transition-colors`,r=`bg-accent/10 text-accent font-medium`,i=`text-text-muted hover:text-text`;return(0,K.jsxs)(`div`,{className:`flex items-center rounded-sm border border-border-soft p-0.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(`messages`),className:[n,e===`messages`?r:i].join(` `),children:`Conversation`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(`activity`),className:[n,e===`activity`?r:i].join(` `),children:`Activity`})]})}function vN(){let{data:e=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:t=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o}),{agentId:n}=or(),{pathname:r}=$n(),i=nr(),{tab:a}=ms(r),o=a&&fs.includes(a)?a:ps,s=e=>{n&&i(`/agents/${n}/${e}`)},{failedOnly:c,lens:l,dir:u,showAllSteps:d,setFailedOnly:f,setLens:p,setDir:m,setShowAllSteps:h}=pN(),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(null);if(!n)return null;let x=e.findIndex(e=>e.id===n),S=x>=0?e[x]:void 0;if(!S)return null;let C=lm(x),w=S.profile?.displayName??S.id,T=S.profile?.role,E=um(w),D=t.find(e=>e.agentId===S.id)?.currentItemId;return(0,K.jsxs)(`header`,{className:`bg-surface`,children:[(0,K.jsxs)(`div`,{className:`hidden h-14 items-center gap-3 border-b border-border-soft px-8 md:flex`,children:[S.slack?.avatarUrl?(0,K.jsx)(`img`,{src:S.slack.avatarUrl,alt:``,className:`h-7 w-7 shrink-0 rounded-sm object-cover`}):(0,K.jsx)(`span`,{className:`font-sans flex h-7 w-7 shrink-0 items-center justify-center rounded-sm text-[11px] font-bold text-white`,style:{background:C},children:E}),(0,K.jsx)(`span`,{className:`display truncate text-[20px] font-semibold leading-tight text-text`,children:w}),T&&(0,K.jsx)(`span`,{className:`font-sans truncate text-[12px] tracking-wide text-text-muted`,title:T,children:T}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[D&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(kw,{variant:`outline`,size:`xs`,onClick:async()=>{if(!(!D||g)){_(!0),b(null);try{await us(S.id),es()}catch(e){b(e instanceof Error?e.message:`Stop failed`)}finally{_(!1)}}},disabled:g,title:`Stop item ${D}`,children:g?`Stopping…`:`Stop`}),y&&(0,K.jsx)(`span`,{className:`font-sans text-[11px] text-health-error`,children:y})]}),(0,K.jsx)(VM,{})]})]}),(0,K.jsxs)(`nav`,{className:`hidden items-center border-b border-border-soft px-8 md:flex`,children:[(0,K.jsx)(`div`,{className:`flex flex-1 items-center gap-1`,children:mN.map(e=>(0,K.jsx)(`button`,{onClick:()=>s(e.id),className:[`chrome relative -mb-px border-b-2 px-3 py-2.5 text-[11px] font-medium uppercase tracking-[0.12em] transition-colors`,o===e.id?`border-accent text-text`:`border-transparent text-text-muted hover:text-text`].join(` `),children:e.label},e.id))}),o===`activity`&&(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[l===`activity`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(hN,{label:`Failed only`,checked:c,onChange:f}),(0,K.jsx)(hN,{label:`Show all steps`,checked:d,onChange:h})]}),l===`messages`&&(0,K.jsx)(gN,{dir:u,onChange:m}),(0,K.jsx)(_N,{lens:l,onChange:p})]})]})]})}function yN(){let{agentId:e}=or();return e?(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(vN,{}),(0,K.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:(0,K.jsx)(Vr,{})})]}):(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-text-subtle`,children:`Select an agent from the sidebar.`})}var bN=Ai([{path:`onboarding`,lazy:()=>w(()=>Promise.resolve().then(()=>EM).then(e=>({Component:e.OnboardingPage})),void 0)},{path:`/`,element:(0,K.jsx)(QM,{}),children:[{path:`agents/:agentId`,element:(0,K.jsx)(yN,{}),children:[{path:`activity`,lazy:()=>w(()=>import(`./activity-BP0C81IV.js`).then(e=>({Component:e.default})),__vite__mapDeps([0,1,2]))},{path:`profile`,lazy:()=>w(()=>import(`./profile-D7wPZXW_.js`).then(e=>({Component:e.default})),__vite__mapDeps([3,1,4]))},{path:`reminders`,lazy:()=>w(()=>import(`./reminders-DOhroVwo.js`).then(e=>({Component:e.default})),[])}]},{path:`kb/:id/*`,lazy:()=>w(()=>import(`./kb-3wFeP2Jt.js`).then(e=>({Component:e.default})),__vite__mapDeps([5,1,2,4]))}]}]);window.addEventListener(`error`,e=>{let t=document.getElementById(`root`);t&&(t.innerHTML=`<div style="padding:24px;font-family:ui-monospace,Menlo,monospace;color:#ef4444;background:#1a0e0e;border:1px solid #2c1414;border-radius:6px;margin:24px;font-size:13px;"><strong>Runtime Error</strong><br/><pre style="white-space:pre-wrap;margin-top:12px;font-size:12px">${e.message}\n${e.error?.stack||``}</pre></div>`)}),(0,b.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(v.StrictMode,{children:(0,K.jsx)(_o,{client:No,children:(0,K.jsx)(ea,{router:bN})})}));export{Ns as $,im as A,o as At,np as B,US as C,mo as Ct,nx as D,nr as Dt,mx as E,qa as Et,ap as F,Gs as G,lp as H,tp as I,zs as J,Hs as K,cp as L,am as M,l as Mt,rp as N,ax as O,or as Ot,ip as P,Ps as Q,up as R,ZS as S,Ao as St,tS as T,Ka as Tt,nc as U,sp as V,Zs as W,Is as X,Rs as Y,Fs as Z,IT as _,qo as _t,hM as a,is as at,kw as b,No as bt,dM as c,ss as ct,Yk as d,$o as dt,Ms as et,Kk as f,ts as ft,WT as g,Vo as gt,$T as h,Bo as ht,CM as i,Qo as it,rm as j,s as jt,em as k,d as kt,lM as l,ds as lt,Hk as m,zo as mt,BM as n,ys as nt,sM as o,as as ot,Gk as p,ls as pt,Vs as q,TM as r,bs as rt,uM as s,cs as st,pN as t,js as tt,Xk as u,Ko as ut,nT as v,Po as vt,Y as w,Qa as wt,Dw as x,jo as xt,Fw as y,Fo as yt,op as z};
|
|
80
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Hv(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Gv(t,`input`,e.processors),output:Gv(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Uv(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Uv(r.element,n);if(r.type===`set`)return Uv(r.valueType,n);if(r.type===`lazy`)return Uv(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Uv(r.innerType,n);if(r.type===`intersection`)return Uv(r.left,n)||Uv(r.right,n);if(r.type===`record`||r.type===`map`)return Uv(r.keyType,n)||Uv(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:Uv(r.in,n)||Uv(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Uv(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Uv(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Uv(e,n))return!0;return!!(r.rest&&Uv(r.rest,n))}return!1}var Wv=(e,t={})=>n=>{let r=zv({...n,processors:t});return Bv(e,r),Vv(r,e),Hv(r,e)},Gv=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=zv({...i??{},target:a,io:t,processors:n});return Bv(e,o),Vv(o,e),Hv(o,e)},Kv={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},qv=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Kv[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Jv=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Yv=(e,t,n,r)=>{n.type=`boolean`},Xv=(e,t,n,r)=>{n.not={}},Zv=(e,t,n,r)=>{let i=e._zod.def,a=Sm(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Qv=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},$v=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ey=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ty=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Bv(a.element,t,{...r,path:[...r.path,`items`]})},ny=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Bv(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Bv(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},ry=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Bv(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},iy=(e,t,n,r)=>{let i=e._zod.def,a=Bv(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Bv(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},ay=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Bv(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Bv(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Bv(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},oy=(e,t,n,r)=>{let i=e._zod.def,a=Bv(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},sy=(e,t,n,r)=>{let i=e._zod.def;Bv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},cy=(e,t,n,r)=>{let i=e._zod.def;Bv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},ly=(e,t,n,r)=>{let i=e._zod.def;Bv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},uy=(e,t,n,r)=>{let i=e._zod.def;Bv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},dy=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;Bv(o,t,r);let s=t.seen.get(e);s.ref=o},fy=(e,t,n,r)=>{let i=e._zod.def;Bv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},py=(e,t,n,r)=>{let i=e._zod.def;Bv(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},my=q(`ZodISODateTime`,(e,t)=>{Ng.init(e,t),Vy.init(e,t)});function hy(e){return ov(my,e)}var gy=q(`ZodISODate`,(e,t)=>{Pg.init(e,t),Vy.init(e,t)});function _y(e){return sv(gy,e)}var vy=q(`ZodISOTime`,(e,t)=>{Fg.init(e,t),Vy.init(e,t)});function yy(e){return cv(vy,e)}var by=q(`ZodISODuration`,(e,t)=>{Ig.init(e,t),Vy.init(e,t)});function xy(e){return lv(by,e)}var Sy=q(`ZodError`,(e,t)=>{ah.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ch(e,t)},flatten:{value:t=>sh(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Cm,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Cm,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Cy=lh(Sy),wy=uh(Sy),Ty=dh(Sy),Ey=ph(Sy),Dy=hh(Sy),Oy=gh(Sy),ky=_h(Sy),Ay=vh(Sy),jy=yh(Sy),My=bh(Sy),Ny=xh(Sy),Py=Sh(Sy),Fy=new WeakMap;function Iy(e,t,n){let r=Object.getPrototypeOf(e),i=Fy.get(r);if(i||(i=new Set,Fy.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var Ly=q(`ZodType`,(e,t)=>(yg.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:Gv(e,`input`),output:Gv(e,`output`)}}),e.toJSONSchema=Wv(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>Cy(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ty(e,t,n),e.parseAsync=async(t,n)=>wy(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ey(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Dy(e,t,n),e.decode=(t,n)=>Oy(e,t,n),e.encodeAsync=async(t,n)=>ky(e,t,n),e.decodeAsync=async(t,n)=>Ay(e,t,n),e.safeEncode=(t,n)=>jy(e,t,n),e.safeDecode=(t,n)=>My(e,t,n),e.safeEncodeAsync=async(t,n)=>Ny(e,t,n),e.safeDecodeAsync=async(t,n)=>Py(e,t,n),Iy(e,`ZodType`,{check(...e){let t=this.def;return this.clone(jm(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Vm(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(tx(e,t))},superRefine(e,t){return this.check(nx(e,t))},overwrite(e){return this.check(kv(e))},optional(){return Ib(this)},exactOptional(){return Rb(this)},nullable(){return Bb(this)},nullish(){return Ib(Bb(this))},nonoptional(e){return Kb(this,e)},array(){return vb(this)},or(e){return Sb([this,e])},and(e){return Eb(this,e)},transform(e){return Xb(this,Pb(e))},default(e){return Hb(this,e)},prefault(e){return Wb(this,e)},catch(e){return Jb(this,e)},pipe(e){return Xb(this,e)},readonly(){return $b(this)},describe(e){let t=this.clone();return I_.add(t,{description:e}),t},meta(...e){if(e.length===0)return I_.get(this);let t=this.clone();return I_.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return I_.get(e)?.description},configurable:!0}),e)),Ry=q(`_ZodString`,(e,t)=>{bg.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qv(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Iy(e,`_ZodString`,{regex(...e){return this.check(Cv(...e))},includes(...e){return this.check(Ev(...e))},startsWith(...e){return this.check(Dv(...e))},endsWith(...e){return this.check(Ov(...e))},min(...e){return this.check(xv(...e))},max(...e){return this.check(bv(...e))},length(...e){return this.check(Sv(...e))},nonempty(...e){return this.check(xv(1,...e))},lowercase(e){return this.check(wv(e))},uppercase(e){return this.check(Tv(e))},trim(){return this.check(jv())},normalize(...e){return this.check(Av(...e))},toLowerCase(){return this.check(Mv())},toUpperCase(){return this.check(Nv())},slugify(){return this.check(Pv())}})}),zy=q(`ZodString`,(e,t)=>{bg.init(e,t),Ry.init(e,t),e.email=t=>e.check(R_(Hy,t)),e.url=t=>e.check(W_(Gy,t)),e.jwt=t=>e.check(av(ob,t)),e.emoji=t=>e.check(G_(Ky,t)),e.guid=t=>e.check(z_(Uy,t)),e.uuid=t=>e.check(B_(Wy,t)),e.uuidv4=t=>e.check(V_(Wy,t)),e.uuidv6=t=>e.check(H_(Wy,t)),e.uuidv7=t=>e.check(U_(Wy,t)),e.nanoid=t=>e.check(K_(qy,t)),e.guid=t=>e.check(z_(Uy,t)),e.cuid=t=>e.check(q_(Jy,t)),e.cuid2=t=>e.check(J_(Yy,t)),e.ulid=t=>e.check(Y_(Xy,t)),e.base64=t=>e.check(nv(rb,t)),e.base64url=t=>e.check(rv(ib,t)),e.xid=t=>e.check(X_(Zy,t)),e.ksuid=t=>e.check(Z_(Qy,t)),e.ipv4=t=>e.check(Q_($y,t)),e.ipv6=t=>e.check($_(eb,t)),e.cidrv4=t=>e.check(ev(tb,t)),e.cidrv6=t=>e.check(tv(nb,t)),e.e164=t=>e.check(iv(ab,t)),e.datetime=t=>e.check(hy(t)),e.date=t=>e.check(_y(t)),e.time=t=>e.check(yy(t)),e.duration=t=>e.check(xy(t))});function By(e){return L_(zy,e)}var Vy=q(`ZodStringFormat`,(e,t)=>{xg.init(e,t),Ry.init(e,t)}),Hy=q(`ZodEmail`,(e,t)=>{wg.init(e,t),Vy.init(e,t)}),Uy=q(`ZodGUID`,(e,t)=>{Sg.init(e,t),Vy.init(e,t)}),Wy=q(`ZodUUID`,(e,t)=>{Cg.init(e,t),Vy.init(e,t)}),Gy=q(`ZodURL`,(e,t)=>{Tg.init(e,t),Vy.init(e,t)}),Ky=q(`ZodEmoji`,(e,t)=>{Eg.init(e,t),Vy.init(e,t)}),qy=q(`ZodNanoID`,(e,t)=>{Dg.init(e,t),Vy.init(e,t)}),Jy=q(`ZodCUID`,(e,t)=>{Og.init(e,t),Vy.init(e,t)}),Yy=q(`ZodCUID2`,(e,t)=>{kg.init(e,t),Vy.init(e,t)}),Xy=q(`ZodULID`,(e,t)=>{Ag.init(e,t),Vy.init(e,t)}),Zy=q(`ZodXID`,(e,t)=>{jg.init(e,t),Vy.init(e,t)}),Qy=q(`ZodKSUID`,(e,t)=>{Mg.init(e,t),Vy.init(e,t)}),$y=q(`ZodIPv4`,(e,t)=>{Lg.init(e,t),Vy.init(e,t)}),eb=q(`ZodIPv6`,(e,t)=>{Rg.init(e,t),Vy.init(e,t)}),tb=q(`ZodCIDRv4`,(e,t)=>{zg.init(e,t),Vy.init(e,t)}),nb=q(`ZodCIDRv6`,(e,t)=>{Bg.init(e,t),Vy.init(e,t)}),rb=q(`ZodBase64`,(e,t)=>{Hg.init(e,t),Vy.init(e,t)}),ib=q(`ZodBase64URL`,(e,t)=>{Wg.init(e,t),Vy.init(e,t)}),ab=q(`ZodE164`,(e,t)=>{Gg.init(e,t),Vy.init(e,t)}),ob=q(`ZodJWT`,(e,t)=>{qg.init(e,t),Vy.init(e,t)}),sb=q(`ZodNumber`,(e,t)=>{Jg.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jv(e,t,n,r),Iy(e,`ZodNumber`,{gt(e,t){return this.check(_v(e,t))},gte(e,t){return this.check(vv(e,t))},min(e,t){return this.check(vv(e,t))},lt(e,t){return this.check(hv(e,t))},lte(e,t){return this.check(gv(e,t))},max(e,t){return this.check(gv(e,t))},int(e){return this.check(ub(e))},safe(e){return this.check(ub(e))},positive(e){return this.check(_v(0,e))},nonnegative(e){return this.check(vv(0,e))},negative(e){return this.check(hv(0,e))},nonpositive(e){return this.check(gv(0,e))},multipleOf(e,t){return this.check(yv(e,t))},step(e,t){return this.check(yv(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function cb(e){return uv(sb,e)}var lb=q(`ZodNumberFormat`,(e,t)=>{Yg.init(e,t),sb.init(e,t)});function ub(e){return dv(lb,e)}var db=q(`ZodBoolean`,(e,t)=>{Xg.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yv(e,t,n,r)});function fb(e){return fv(db,e)}var pb=q(`ZodUnknown`,(e,t)=>{Zg.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function mb(){return pv(pb)}var hb=q(`ZodNever`,(e,t)=>{Qg.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xv(e,t,n,r)});function gb(e){return mv(hb,e)}var _b=q(`ZodArray`,(e,t)=>{e_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ty(e,t,n,r),e.element=t.element,Iy(e,`ZodArray`,{min(e,t){return this.check(xv(e,t))},nonempty(e){return this.check(xv(1,e))},max(e,t){return this.check(bv(e,t))},length(e,t){return this.check(Sv(e,t))},unwrap(){return this.element}})});function vb(e,t){return Fv(_b,e,t)}var yb=q(`ZodObject`,(e,t)=>{a_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ny(e,t,n,r),km(e,`shape`,()=>t.shape),Iy(e,`ZodObject`,{keyof(){return Ab(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:mb()})},loose(){return this.clone({...this._zod.def,catchall:mb()})},strict(){return this.clone({...this._zod.def,catchall:gb()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return Km(this,e)},safeExtend(e){return qm(this,e)},merge(e){return Jm(this,e)},pick(e){return Wm(this,e)},omit(e){return Gm(this,e)},partial(...e){return Ym(Fb,this,e[0])},required(...e){return Xm(Gb,this,e[0])}})});function bb(e,t){return new yb({type:`object`,shape:e??{},...J(t)})}var xb=q(`ZodUnion`,(e,t)=>{s_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ry(e,t,n,r),e.options=t.options});function Sb(e,t){return new xb({type:`union`,options:e,...J(t)})}var Cb=q(`ZodDiscriminatedUnion`,(e,t)=>{xb.init(e,t),c_.init(e,t)});function wb(e,t,n){return new Cb({type:`union`,options:t,discriminator:e,...J(n)})}var Tb=q(`ZodIntersection`,(e,t)=>{l_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iy(e,t,n,r)});function Eb(e,t){return new Tb({type:`intersection`,left:e,right:t})}var Db=q(`ZodRecord`,(e,t)=>{f_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ay(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Ob(e,t,n){return!t||!t._zod?new Db({type:`record`,keyType:By(),valueType:e,...J(t)}):new Db({type:`record`,keyType:e,valueType:t,...J(n)})}var kb=q(`ZodEnum`,(e,t)=>{p_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zv(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new kb({...t,checks:[],...J(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new kb({...t,checks:[],...J(r),entries:i})}});function Ab(e,t){return new kb({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...J(t)})}var jb=q(`ZodLiteral`,(e,t)=>{m_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qv(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Mb(e,t){return new jb({type:`literal`,values:Array.isArray(e)?e:[e],...J(t)})}var Nb=q(`ZodTransform`,(e,t)=>{h_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ey(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new ym(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(rh(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(rh(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Pb(e){return new Nb({type:`transform`,transform:e})}var Fb=q(`ZodOptional`,(e,t)=>{__.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>py(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ib(e){return new Fb({type:`optional`,innerType:e})}var Lb=q(`ZodExactOptional`,(e,t)=>{v_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>py(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Rb(e){return new Lb({type:`optional`,innerType:e})}var zb=q(`ZodNullable`,(e,t)=>{y_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bb(e){return new zb({type:`nullable`,innerType:e})}var Vb=q(`ZodDefault`,(e,t)=>{b_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Hb(e,t){return new Vb({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rm(t)}})}var Ub=q(`ZodPrefault`,(e,t)=>{S_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ly(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Wb(e,t){return new Ub({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rm(t)}})}var Gb=q(`ZodNonOptional`,(e,t)=>{C_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Kb(e,t){return new Gb({type:`nonoptional`,innerType:e,...J(t)})}var qb=q(`ZodCatch`,(e,t)=>{T_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Jb(e,t){return new qb({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Yb=q(`ZodPipe`,(e,t)=>{E_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dy(e,t,n,r),e.in=t.in,e.out=t.out});function Xb(e,t){return new Yb({type:`pipe`,in:e,out:t})}var Zb=q(`ZodPreprocess`,(e,t)=>{Yb.init(e,t),O_.init(e,t)}),Qb=q(`ZodReadonly`,(e,t)=>{k_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fy(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $b(e){return new Qb({type:`readonly`,innerType:e})}var ex=q(`ZodCustom`,(e,t)=>{j_.init(e,t),Ly.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$v(e,t,n,r)});function tx(e,t={}){return Iv(ex,e,t)}function nx(e,t){return Lv(e,t)}function rx(e,t){return new Zb({type:`pipe`,in:Pb(e),out:t})}var ix={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`},ax;(function(e){})(ax||={}),bb({kind:Ab([`claude-code`,`codex-cli`,`kimi-cli`]),present:fb()});var ox=`claude-code`,sx=`xhigh`,cx=[`low`,`medium`,`high`,`xhigh`],lx=[{kind:`claude-code`,label:`Claude Code`,command:`claude`,installHint:"Install Claude Code so `claude --version` works.",models:[`opus`,`sonnet`,`haiku`],defaultModel:`opus`,reasoningEfforts:cx},{kind:`codex-cli`,label:`Codex CLI`,command:`codex`,installHint:"Install Codex CLI so `codex --version` works.",models:[`gpt-5.5`,`gpt-5.4`,`gpt-5.4-mini`,`gpt-5.3-codex`,`gpt-5.3-codex-spark`,`gpt-5.2`,`gpt-5.2-codex`],defaultModel:`gpt-5.5`,reasoningEfforts:cx},{kind:`kimi-cli`,label:`Kimi CLI`,command:`kimi`,installHint:"Install Kimi CLI so `kimi --version` works.",models:[`kimi-code/kimi-for-coding`],defaultModel:`kimi-code/kimi-for-coding`,reasoningEfforts:[]}];function ux(){return lx.map(e=>({...e,models:[...e.models],reasoningEfforts:[...e.reasoningEfforts]}))}function dx(e){return lx.find(t=>t.kind===e)}function fx(e){return dx(e)?.defaultModel}function px(e){return dx(e)!==void 0}function mx(e,t){return dx(e)?.models.includes(t)??!1}function hx(e,t){return dx(e)?.reasoningEfforts.includes(t)??!1}var gx=`~/anima-team/agents`;function _x(e,t=gx){return`${t.replace(/\/+$/,``)}/${e}`}var vx=1800*1e3,yx=[`ANIMA_AGENT_ID`,`ANIMA_HOME`,`ANIMA_INBOX_ITEM_ID`,`ANIMA_RUNTIME_HOME`,`ANIMA_SLACK_BOT_TOKEN`,`NO_COLOR`,`SLACK_BOT_TOKEN`];function bx(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}var xx=bb({kind:By().trim().min(1),model:By().trim().min(1),reasoningEffort:By().trim().min(1).optional()}).strict().superRefine((e,t)=>{if(!px(e.kind)){t.addIssue({code:ix.custom,message:`unsupported provider kind ${e.kind}`,path:[`kind`]});return}mx(e.kind,e.model)||t.addIssue({code:ix.custom,message:`unsupported model for ${e.kind}: ${e.model}`,path:[`model`]}),e.reasoningEffort&&!hx(e.kind,e.reasoningEffort)&&t.addIssue({code:ix.custom,message:`unsupported reasoningEffort ${e.reasoningEffort}`,path:[`reasoningEffort`]})});bb({env:Ob(By(),By().nullable()).optional(),kind:By().trim().min(1).optional(),model:By().trim().min(1).optional(),reasoningEffort:By().trim().min(1).optional()}).strict(),bb({name:By().trim().min(1).refine(e=>!!bx(e),{message:`name must include at least one URL-safe letter or number`}),homePath:By().trim().min(1),role:By().trim().min(1),provider:xx}).strict(),bb({homePath:By().trim().min(1)}).strict(),bb({displayName:By().trim().min(1).optional(),role:By().trim().optional()}).strict().refine(e=>e.displayName!==void 0||e.role!==void 0,{message:`profile update requires displayName or role`}),bb({appToken:By().trim().min(1).refine(e=>e.startsWith(`xapp-`),{message:`appToken must start with xapp-`}),botToken:By().trim().min(1).refine(e=>e.startsWith(`xoxb-`),{message:`botToken must start with xoxb-`})}).strict(),bb({appToken:By().trim().optional(),botToken:By().trim().optional()}).strict(),bb({slackUserId:By().trim().min(1),openerNote:By().optional(),introduce:fb().optional()}).strict();var Sx=bb({slackUserId:By(),displayName:By(),handle:By().optional(),avatarUrl:By().optional()}).strict();rx(e=>{let t=Cx(e)?e:{},n=typeof t.kind==`string`?t.kind:void 0,r=n&&px(n)?n:ox;return{...t,...typeof t.idleTimeoutMs==`number`?{}:{idleTimeoutMs:vx},kind:r,model:typeof t.model==`string`?t.model:fx(r)}},wb(`kind`,[bb({env:Ob(By(),By()).optional(),idleTimeoutMs:cb().optional(),kind:Mb(`codex-cli`),model:By().optional(),reasoningEffort:By().optional(),reasoningSummary:Ab([`auto`,`concise`,`detailed`,`none`]).optional()}),bb({env:Ob(By(),By()).optional(),idleTimeoutMs:cb().optional(),kind:Mb(`claude-code`),model:By().optional(),reasoningEffort:By().optional()}),bb({env:Ob(By(),By()).optional(),idleTimeoutMs:cb().optional(),kind:Mb(`kimi-cli`),model:By().optional()})])),bb({appId:By().optional(),appToken:By().default(``),avatarUrl:By().optional(),botProfileSyncedAt:By().optional(),botToken:By().default(``),connected:fb().optional(),manifestVersion:cb().int().nonnegative().default(0),teamId:By().default(``),workspaceIconUrl:By().default(``),workspaceName:By().default(``)}).transform(({appToken:e,botToken:t,connected:n,...r})=>({...r,appToken:e,botToken:t,connected:!!(e&&t)})),Sx.extend({onboardingPromptedAt:By().optional()}).strict(),rx(e=>{if(!Cx(e))return e;let t={...e};return typeof t.role!=`string`&&typeof t.description==`string`&&(t.role=t.description),delete t.description,t},bb({displayName:By().optional(),role:By().optional()}).strict().optional()),bb({displayName:By(),role:By()});function Cx(e){return!!e&&typeof e==`object`&&!Array.isArray(e)}function wx(e,t){return t?.find(t=>t.kind===e.kind)}function Tx(e,t){return!e||!t?!1:wx(e,t)?.present===!0}function Ex(e,t){return e.find(e=>Tx(e,t))}function Dx(e,t){if(!t)return`checking...`;if(!wx(e,t)?.present)return`not installed`}function Ox(e,t){if(!(!e||!t)&&!wx(e,t)?.present)return e.installHint}function kx(e,t){return t?e.flatMap(e=>{let n=Dx(e,t),r=Ox(e,t);return n&&r?[{kind:e.kind,label:e.label,status:n,hint:r}]:[]}):[]}function Ax(){return typeof window<`u`}function jx(e){return Px(e)?(e.nodeName||``).toLowerCase():`#document`}function Mx(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nx(e){return((Px(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Px(e){return Ax()?e instanceof Node||e instanceof Mx(e).Node:!1}function Fx(e){return Ax()?e instanceof Element||e instanceof Mx(e).Element:!1}function Ix(e){return Ax()?e instanceof HTMLElement||e instanceof Mx(e).HTMLElement:!1}function Lx(e){return!Ax()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof Mx(e).ShadowRoot}function Rx(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Yx(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function zx(e){return/^(table|td|th)$/.test(jx(e))}function Bx(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Vx=/transform|translate|scale|rotate|perspective|filter/,Hx=/paint|layout|strict|content/,Ux=e=>!!e&&e!==`none`,Wx;function Gx(e){let t=Fx(e)?Yx(e):e;return Ux(t.transform)||Ux(t.translate)||Ux(t.scale)||Ux(t.rotate)||Ux(t.perspective)||!qx()&&(Ux(t.backdropFilter)||Ux(t.filter))||Vx.test(t.willChange||``)||Hx.test(t.contain||``)}function Kx(e){let t=Zx(e);for(;Ix(t)&&!Jx(t);){if(Gx(t))return t;if(Bx(t))return null;t=Zx(t)}return null}function qx(){return Wx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Wx}function Jx(e){return/^(html|body|#document)$/.test(jx(e))}function Yx(e){return Mx(e).getComputedStyle(e)}function Xx(e){return Fx(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zx(e){if(jx(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Lx(e)&&e.host||Nx(e);return Lx(t)?t.host:t}function Qx(e){let t=Zx(e);return Jx(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ix(t)&&Rx(t)?t:Qx(t)}function $x(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Qx(e),i=r===e.ownerDocument?.body,a=Mx(r);if(i){let e=eS(a);return t.concat(a,a.visualViewport||[],Rx(r)?r:[],e&&n?$x(e):[])}else return t.concat(r,$x(r,[],n))}function eS(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var tS={...v},nS={};function rS(e,t){let n=v.useRef(nS);return n.current===nS&&(n.current=e(t)),n}var iS=tS.useInsertionEffect,aS=iS&&iS!==tS.useLayoutEffect?iS:e=>e();function oS(e){let t=rS(sS).current;return t.next=e,aS(t.effect),t.trampoline}function sS(){let e={next:void 0,callback:cS,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function cS(){}var Y=typeof document<`u`?v.useLayoutEffect:()=>{};function lS(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var uS={};function dS(e,t,n,r,i){if(!n&&!r&&!i&&!e)return pS(t);let a=pS(e);return t&&(a=mS(a,t)),n&&(a=mS(a,n)),r&&(a=mS(a,r)),i&&(a=mS(a,i)),a}function fS(e){if(e.length===0)return uS;if(e.length===1)return pS(e[0]);let t=pS(e[0]);for(let n=1;n<e.length;n+=1)t=mS(t,e[n]);return t}function pS(e){return vS(e)?{...yS(e,uS)}:hS(e)}function mS(e,t){return vS(t)?yS(t,e):gS(e,t)}function hS(e){let t={...e};for(let e in t){let n=t[e];_S(e,n)&&(t[e]=xS(n))}return t}function gS(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=lS(e.style,r);break;case`className`:e[n]=CS(e.className,r);break;default:_S(n,r)?e[n]=bS(e[n],r):e[n]=r}}return e}function _S(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function vS(e){return typeof e==`function`}function yS(e,t){return vS(e)?e(t):e??uS}function bS(e,t){return t?e?(...n)=>{let r=n[0];if(wS(r)){let i=r;SS(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:xS(t):e}function xS(e){return e&&((...t)=>{let n=t[0];return wS(n)&&SS(n),e(...t)})}function SS(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function CS(e,t){return t?e?t+` `+e:t:e}function wS(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function TS(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var ES=TS(`https://base-ui.com/production-error`,`Base UI`),DS=v.createContext(void 0);function OS(e=!1){let t=v.useContext(DS);if(t===void 0&&!e)throw Error(ES(16));return t}function kS(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:v.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function AS(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=v.useRef(null),s=OS(!0),c=a??s!==void 0,{props:l}=kS({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=v.useCallback(()=>{let e=o.current;jS(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Y(u,[u]),{getButtonProps:v.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return dS({onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(SS(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=jS(a),l=!i&&MS(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(SS(e),a?.(e),e.target===e.currentTarget&&i&&c&&jS(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?{type:`button`}:{role:`button`},l,u)},[t,l,c,i]),buttonRef:oS(e=>{o.current=e,u()})}}function jS(e){return Ix(e)&&e.tagName===`BUTTON`}function MS(e){return!!(e?.tagName===`A`&&e?.href)}function NS(e,t,n,r){let i=rS(FS).current;return IS(i,e,t,n,r)&&RS(i,[e,t,n,r]),i.callback}function PS(e){let t=rS(FS).current;return LS(t,e)&&RS(t,e),t.callback}function FS(){return{callback:null,cleanup:null,refs:[]}}function IS(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function LS(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function RS(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var zS=19;function BS(e){return zS>=e}function VS(e){if(!v.isValidElement(e))return null;let t=e,n=t.props;return(BS(19)?n?.ref:t.ref)??null}function HS(){}var US=Object.freeze([]),WS=Object.freeze({});function GS(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function KS(e,t){return typeof e==`function`?e(t):e}function qS(e,t){return typeof e==`function`?e(t):e}function JS(e,t,n={}){let r=t.render,i=YS(t,n);return n.enabled===!1?null:QS(e,r,i,n.state??WS)}function YS(e,t={}){let{className:n,style:r,render:i}=e,{state:a=WS,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?KS(n,a):void 0,d=l?qS(r,a):void 0,f=l?GS(a,c):WS,p=l&&s?XS(s):void 0,m=l?lS(f,p)??{}:WS;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=PS([m.ref,VS(i),...o]):m.ref=NS(m.ref,VS(i),o):NS(null,null)),l?(u!==void 0&&(m.className=CS(m.className,u)),d!==void 0&&(m.style=lS(m.style,d)),m):WS}function XS(e){return Array.isArray(e)?fS(e):dS(void 0,e)}var ZS=Symbol.for(`react.lazy`);function QS(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=dS(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===ZS&&(i=v.Children.toArray(t)[0]),v.cloneElement(i,e)}if(e&&typeof e==`string`)return $S(e,n);throw Error(ES(8))}function $S(e,t){return e===`button`?(0,v.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,v.createElement)(`img`,{alt:``,...t,key:t.key}):v.createElement(e,t)}var eC=v.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=AS({disabled:i,focusableWhenDisabled:a,native:o});return JS(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})});function tC(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=tC(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function nC(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=tC(e))&&(r&&(r+=` `),r+=t);return r}var rC=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,iC=nC,aC=(e,t)=>n=>{if(t?.variants==null)return iC(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=rC(t)||rC(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return iC(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},oC=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},sC=(e,t)=>({classGroupId:e,validator:t}),cC=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),lC=`-`,uC=[],dC=`arbitrary..`,fC=e=>{let t=hC(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return mC(e);let n=e.split(lC);return pC(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?oC(i,t):t:i||uC}return n[e]||uC}}},pC=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=pC(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(lC):e.slice(t).join(lC),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},mC=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?dC+r:void 0})(),hC=e=>{let{theme:t,classGroups:n}=e;return gC(n,t)},gC=(e,t)=>{let n=cC();for(let r in e){let i=e[r];_C(i,n,r,t)}return n},_C=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];vC(i,t,n,r)}},vC=(e,t,n,r)=>{if(typeof e==`string`){yC(e,t,n);return}if(typeof e==`function`){bC(e,t,n,r);return}xC(e,t,n,r)},yC=(e,t,n)=>{let r=e===``?t:SC(t,e);r.classGroupId=n},bC=(e,t,n,r)=>{if(CC(e)){_C(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(sC(n,e))},xC=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];_C(o,SC(t,a),n,r)}},SC=(e,t)=>{let n=e,r=t.split(lC),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=cC(),n.nextPart.set(t,i)),n=i}return n},CC=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,wC=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},TC=`!`,EC=`:`,DC=[],OC=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),kC=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===EC){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(TC)?(c=s.slice(0,-1),l=!0):s.startsWith(TC)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return OC(t,l,c,u)};if(t){let e=t+EC,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):OC(DC,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},AC=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},jC=e=>({cache:wC(e.cacheSize),parseClassName:kC(e),sortModifiers:AC(e),postfixLookupClassGroupIds:MC(e),...fC(e)}),MC=e=>{let t=Object.create(null),n=e.postfixLookupClassGroups;if(n)for(let e=0;e<n.length;e++)t[n[e]]=!0;return t},NC=/\s+/,PC=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a,postfixLookupClassGroupIds:o}=t,s=[],c=e.trim().split(NC),l=``;for(let e=c.length-1;e>=0;--e){let t=c[e],{isExternal:u,modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=n(t);if(u){l=t+(l.length>0?` `+l:l);continue}let h=!!m,g;if(h){g=r(p.substring(0,m));let e=g&&o[g]?r(p):void 0;e&&e!==g&&(g=e,h=!1)}else g=r(p);if(!g){if(!h){l=t+(l.length>0?` `+l:l);continue}if(g=r(p),!g){l=t+(l.length>0?` `+l:l);continue}h=!1}let _=d.length===0?``:d.length===1?d[0]:a(d).join(`:`),v=f?_+TC:_,y=v+g;if(s.indexOf(y)>-1)continue;s.push(y);let b=i(g,h);for(let e=0;e<b.length;++e){let t=b[e];s.push(v+t)}l=t+(l.length>0?` `+l:l)}return l},FC=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=IC(n))&&(i&&(i+=` `),i+=r);return i},IC=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=IC(e[r]))&&(n&&(n+=` `),n+=t);return n},LC=(e,...t)=>{let n,r,i,a,o=o=>(n=jC(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=PC(e,n);return i(e,a),a};return a=o,(...e)=>a(FC(...e))},RC=[],zC=e=>{let t=t=>t[e]||RC;return t.isThemeGetter=!0,t},BC=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,VC=/^\((?:(\w[\w-]*):)?(.+)\)$/i,HC=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,UC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,WC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,GC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,KC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,JC=e=>HC.test(e),YC=e=>!!e&&!Number.isNaN(Number(e)),XC=e=>!!e&&Number.isInteger(Number(e)),ZC=e=>e.endsWith(`%`)&&YC(e.slice(0,-1)),QC=e=>UC.test(e),$C=()=>!0,ew=e=>WC.test(e)&&!GC.test(e),tw=()=>!1,nw=e=>KC.test(e),rw=e=>qC.test(e),iw=e=>!X(e)&&!Z(e),aw=e=>e.startsWith(`@container`)&&(e[10]===`/`&&e[11]!==void 0||e[11]===`s`&&e[16]!==void 0&&e.startsWith(`-size/`,10)||e[11]===`n`&&e[18]!==void 0&&e.startsWith(`-normal/`,10)),ow=e=>xw(e,Tw,tw),X=e=>BC.test(e),sw=e=>xw(e,Ew,ew),cw=e=>xw(e,Dw,YC),lw=e=>xw(e,kw,$C),uw=e=>xw(e,Ow,tw),dw=e=>xw(e,Cw,tw),fw=e=>xw(e,ww,rw),pw=e=>xw(e,Aw,nw),Z=e=>VC.test(e),mw=e=>Sw(e,Ew),hw=e=>Sw(e,Ow),gw=e=>Sw(e,Cw),_w=e=>Sw(e,Tw),vw=e=>Sw(e,ww),yw=e=>Sw(e,Aw,!0),bw=e=>Sw(e,kw,!0),xw=(e,t,n)=>{let r=BC.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Sw=(e,t,n=!1)=>{let r=VC.exec(e);return r?r[1]?t(r[1]):n:!1},Cw=e=>e===`position`||e===`percentage`,ww=e=>e===`image`||e===`url`,Tw=e=>e===`length`||e===`size`||e===`bg-size`,Ew=e=>e===`length`,Dw=e=>e===`number`,Ow=e=>e===`family-name`,kw=e=>e===`number`||e===`weight`,Aw=e=>e===`shadow`,jw=LC(()=>{let e=zC(`color`),t=zC(`font`),n=zC(`text`),r=zC(`font-weight`),i=zC(`tracking`),a=zC(`leading`),o=zC(`breakpoint`),s=zC(`container`),c=zC(`spacing`),l=zC(`radius`),u=zC(`shadow`),d=zC(`inset-shadow`),f=zC(`text-shadow`),p=zC(`drop-shadow`),m=zC(`blur`),h=zC(`perspective`),g=zC(`aspect`),_=zC(`ease`),v=zC(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),Z,X],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[Z,X,c],T=()=>[JC,`full`,`auto`,...w()],E=()=>[XC,`none`,`subgrid`,Z,X],D=()=>[`auto`,{span:[`full`,XC,Z,X]},XC,Z,X],O=()=>[XC,`auto`,Z,X],k=()=>[`auto`,`min`,`max`,`fr`,Z,X],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[JC,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[JC,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[JC,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,Z,X],L=()=>[...b(),gw,dw,{position:[Z,X]}],R=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],z=()=>[`auto`,`cover`,`contain`,_w,ow,{size:[Z,X]}],B=()=>[ZC,mw,sw],V=()=>[``,`none`,`full`,l,Z,X],H=()=>[``,YC,mw,sw],U=()=>[`solid`,`dashed`,`dotted`,`double`],W=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],G=()=>[YC,ZC,gw,dw],ee=()=>[``,`none`,m,Z,X],te=()=>[`none`,YC,Z,X],ne=()=>[`none`,YC,Z,X],re=()=>[YC,Z,X],ie=()=>[JC,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[QC],breakpoint:[QC],color:[$C],container:[QC],"drop-shadow":[QC],ease:[`in`,`out`,`in-out`],font:[iw],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[QC],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[QC],shadow:[QC],spacing:[`px`,YC],text:[QC],"text-shadow":[QC],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,JC,X,Z,g]}],container:[`container`],"container-type":[{"@container":[``,`normal`,`size`,Z,X]}],"container-named":[aw],columns:[{columns:[YC,X,Z,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[XC,`auto`,Z,X]}],basis:[{basis:[JC,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[YC,JC,`auto`,`initial`,`none`,X]}],grow:[{grow:[``,YC,Z,X]}],shrink:[{shrink:[``,YC,Z,X]}],order:[{order:[XC,`first`,`last`,`none`,Z,X]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,mw,sw]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,bw,lw]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,ZC,X]}],"font-family":[{font:[hw,uw,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,Z,X]}],"line-clamp":[{"line-clamp":[YC,`none`,Z,cw]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,Z,X]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,Z,X]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...U(),`wavy`]}],"text-decoration-thickness":[{decoration:[YC,`from-font`,`auto`,Z,sw]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[YC,`auto`,Z,X]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"tab-size":[{tab:[XC,Z,X]}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Z,X]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Z,X]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:R()}],"bg-size":[{bg:z()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},XC,Z,X],radial:[``,Z,X],conic:[XC,Z,X]},vw,fw]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:B()}],"gradient-via-pos":[{via:B()}],"gradient-to-pos":[{to:B()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:V()}],"rounded-s":[{"rounded-s":V()}],"rounded-e":[{"rounded-e":V()}],"rounded-t":[{"rounded-t":V()}],"rounded-r":[{"rounded-r":V()}],"rounded-b":[{"rounded-b":V()}],"rounded-l":[{"rounded-l":V()}],"rounded-ss":[{"rounded-ss":V()}],"rounded-se":[{"rounded-se":V()}],"rounded-ee":[{"rounded-ee":V()}],"rounded-es":[{"rounded-es":V()}],"rounded-tl":[{"rounded-tl":V()}],"rounded-tr":[{"rounded-tr":V()}],"rounded-br":[{"rounded-br":V()}],"rounded-bl":[{"rounded-bl":V()}],"border-w":[{border:H()}],"border-w-x":[{"border-x":H()}],"border-w-y":[{"border-y":H()}],"border-w-s":[{"border-s":H()}],"border-w-e":[{"border-e":H()}],"border-w-bs":[{"border-bs":H()}],"border-w-be":[{"border-be":H()}],"border-w-t":[{"border-t":H()}],"border-w-r":[{"border-r":H()}],"border-w-b":[{"border-b":H()}],"border-w-l":[{"border-l":H()}],"divide-x":[{"divide-x":H()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":H()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...U(),`hidden`,`none`]}],"divide-style":[{divide:[...U(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...U(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[YC,Z,X]}],"outline-w":[{outline:[``,YC,mw,sw]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,yw,pw]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,yw,pw]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:H()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[YC,sw]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":H()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,yw,pw]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[YC,Z,X]}],"mix-blend":[{"mix-blend":[...W(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":W()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[YC]}],"mask-image-linear-from-pos":[{"mask-linear-from":G()}],"mask-image-linear-to-pos":[{"mask-linear-to":G()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":G()}],"mask-image-t-to-pos":[{"mask-t-to":G()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":G()}],"mask-image-r-to-pos":[{"mask-r-to":G()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":G()}],"mask-image-b-to-pos":[{"mask-b-to":G()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":G()}],"mask-image-l-to-pos":[{"mask-l-to":G()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":G()}],"mask-image-x-to-pos":[{"mask-x-to":G()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":G()}],"mask-image-y-to-pos":[{"mask-y-to":G()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Z,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":G()}],"mask-image-radial-to-pos":[{"mask-radial-to":G()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[YC]}],"mask-image-conic-from-pos":[{"mask-conic-from":G()}],"mask-image-conic-to-pos":[{"mask-conic-to":G()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:R()}],"mask-size":[{mask:z()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,Z,X]}],filter:[{filter:[``,`none`,Z,X]}],blur:[{blur:ee()}],brightness:[{brightness:[YC,Z,X]}],contrast:[{contrast:[YC,Z,X]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,yw,pw]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,YC,Z,X]}],"hue-rotate":[{"hue-rotate":[YC,Z,X]}],invert:[{invert:[``,YC,Z,X]}],saturate:[{saturate:[YC,Z,X]}],sepia:[{sepia:[``,YC,Z,X]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,Z,X]}],"backdrop-blur":[{"backdrop-blur":ee()}],"backdrop-brightness":[{"backdrop-brightness":[YC,Z,X]}],"backdrop-contrast":[{"backdrop-contrast":[YC,Z,X]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,YC,Z,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[YC,Z,X]}],"backdrop-invert":[{"backdrop-invert":[``,YC,Z,X]}],"backdrop-opacity":[{"backdrop-opacity":[YC,Z,X]}],"backdrop-saturate":[{"backdrop-saturate":[YC,Z,X]}],"backdrop-sepia":[{"backdrop-sepia":[``,YC,Z,X]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,Z,X]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[YC,`initial`,Z,X]}],ease:[{ease:[`linear`,`initial`,_,Z,X]}],delay:[{delay:[YC,Z,X]}],animate:[{animate:[`none`,v,Z,X]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,Z,X]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:te()}],"rotate-x":[{"rotate-x":te()}],"rotate-y":[{"rotate-y":te()}],"rotate-z":[{"rotate-z":te()}],scale:[{scale:ne()}],"scale-x":[{"scale-x":ne()}],"scale-y":[{"scale-y":ne()}],"scale-z":[{"scale-z":ne()}],"scale-3d":[`scale-3d`],skew:[{skew:re()}],"skew-x":[{"skew-x":re()}],"skew-y":[{"skew-y":re()}],transform:[{transform:[Z,X,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ie()}],"translate-x":[{"translate-x":ie()}],"translate-y":[{"translate-y":ie()}],"translate-z":[{"translate-z":ie()}],"translate-none":[`translate-none`],zoom:[{zoom:[XC,Z,X]}],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Z,X]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scrollbar-thumb-color":[{"scrollbar-thumb":I()}],"scrollbar-track-color":[{"scrollbar-track":I()}],"scrollbar-gutter":[{"scrollbar-gutter":[`auto`,`stable`,`both`]}],"scrollbar-w":[{scrollbar:[`auto`,`thin`,`none`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Z,X]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[YC,mw,sw,cw]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{"container-named":[`container-type`],overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},postfixLookupClassGroups:[`container-type`],orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function Mw(...e){return jw(nC(e))}var Nw=aC(`group/button inline-flex shrink-0 items-center justify-center rounded-lg border border-transparent bg-clip-padding text-base font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,outline:`border-border bg-background hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-11 gap-1.5 px-3 has-data-[icon=inline-end]:pr-2.5 has-data-[icon=inline-start]:pl-2.5`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-9 gap-1 rounded-[min(var(--radius-md),12px)] px-3 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-12 gap-1.5 px-4 has-data-[icon=inline-end]:pr-3 has-data-[icon=inline-start]:pl-3`,icon:`size-11`,"icon-xs":`size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-9 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg`,"icon-lg":`size-12`}},defaultVariants:{variant:`default`,size:`default`}});function Pw({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,K.jsx)(eC,{"data-slot":`button`,className:Mw(Nw({variant:t,size:n,className:e})),...r})}var Fw={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},Iw={...Fw,position:`fixed`,top:0,left:0},Lw={...Fw,position:`absolute`};function Rw(e){let t=v.useRef(!0);t.current&&(t.current=!1,e())}function zw(e){let[t,n]=v.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Bw({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=v.useRef(e!==void 0),[a,o]=v.useState(t);return[i?e:a,v.useCallback(e=>{i||o(e)},[])]}function Vw(e){let t=rS(Hw,e).current;return t.next=e,Y(t.effect),t}function Hw(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Uw=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(ES(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},Ww=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Gw=o(((e,t)=>{t.exports=Ww()})),Kw=o((e=>{var t=d(),n=Gw();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),qw=o(((e,t)=>{t.exports=Kw()})),Jw=[],Yw=void 0;function Xw(){return Yw}function Zw(e){Jw.push(e)}var Qw=Gw(),$w=qw(),eT=BS(19)?nT:rT;function Q(e,t,n,r,i){return eT(e,t,n,r,i)}function tT(e,t,n,r,i){let a=v.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,Qw.useSyncExternalStore)(e.subscribe,a,a)}Zw({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,Qw.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function nT(e,t,n,r,i){let a=Xw();if(!a)return tT(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function rT(e,t,n,r,i){return(0,$w.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var iT=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Q(this,e,t,n,r)}},aT=class extends iT{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){v.useDebugValue(e);let n=this;Y(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;Y(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Y(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){v.useDebugValue(e);let n=this,r=t!==void 0;Y(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return v.useDebugValue(e),Q(this,this.selectors[e],t,n,r)}useContextCallback(e,t){v.useDebugValue(e);let n=oS(t??HS);this.context[e]=n}useStateSetter(e){let t=v.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function oT(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function sT(e){return e?.ownerDocument||document}function cT(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var lT=[];function uT(e){v.useEffect(e,lT)}var dT=null;globalThis.requestAnimationFrame;var fT=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},pT=class e{static create(){return new e}static request(e){return fT.request(e)}static cancel(e){return fT.cancel(e)}currentId=dT;request(e){this.cancel(),this.currentId=fT.request(()=>{this.currentId=dT,e()})}cancel=()=>{this.currentId!==dT&&(fT.cancel(this.currentId),this.currentId=dT)};disposeEffect=()=>this.cancel};function mT(){let e=rS(pT.create).current;return uT(e.disposeEffect),e}var hT=0,gT=class e{static create(){return new e}currentId=hT;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=hT,t()},e)}isStarted(){return this.currentId!==hT}clear=()=>{this.currentId!==hT&&(clearTimeout(this.currentId),this.currentId=hT)};disposeEffect=()=>this.clear};function _T(){let e=rS(gT.create).current;return uT(e.disposeEffect),e}var vT=typeof navigator<`u`,yT=DT(),bT=kT(),xT=OT(),ST=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),CT=yT.platform===`MacIntel`&&yT.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(yT.platform);vT&&/firefox/i.test(xT);var wT=vT&&/apple/i.test(navigator.vendor);vT&&/Edg/i.test(xT);var TT=vT&&/android/i.test(bT)||/android/i.test(xT);vT&&bT.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var ET=xT.includes(`jsdom/`);function DT(){if(!vT)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function OT(){if(!vT)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function kT(){if(!vT)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}function AT(e){e.preventDefault(),e.stopPropagation()}function jT(e){return`nativeEvent`in e}function MT(e){return e.pointerType===``&&e.isTrusted?!0:TT&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function NT(e){return ET?!1:!TT&&e.width===0&&e.height===0||TT&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function PT(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function FT(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var IT=`data-base-ui-focusable`,LT=`ArrowLeft`,RT=`ArrowRight`,zT=`ArrowUp`,BT=`ArrowDown`;function VT(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function HT(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&Lx(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function UT(e){return`composedPath`in e?e.composedPath()[0]:e.target}function WT(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function GT(e){return e.matches(`html,body`)}function KT(e){return Ix(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function qT(e){return e?e.getAttribute(`role`)===`combobox`&&KT(e):!1}function JT(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}var YT=`none`,XT=`trigger-press`,ZT=`outside-press`,QT=`item-press`,$T=`focus-out`,eE=`escape-key`,tE=`list-navigation`,nE=`cancel-open`,rE=`window-resize`;function iE(e,t,n,r){let i=!1,a=!1,o=r??WS;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var aE=v.forwardRef(function(e,t){let[n,r]=v.useState();Y(()=>{wT&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,K.jsx)(`span`,{...e,ref:t,style:Iw,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})}),oE=[`top`,`right`,`bottom`,`left`],sE=Math.min,cE=Math.max,lE=Math.round,uE=Math.floor,dE=e=>({x:e,y:e}),fE={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function pE(e,t,n){return cE(e,sE(t,n))}function mE(e,t){return typeof e==`function`?e(t):e}function hE(e){return e.split(`-`)[0]}function gE(e){return e.split(`-`)[1]}function _E(e){return e===`x`?`y`:`x`}function vE(e){return e===`y`?`height`:`width`}function yE(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function bE(e){return _E(yE(e))}function xE(e,t,n){n===void 0&&(n=!1);let r=gE(e),i=bE(e),a=vE(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=AE(o)),[o,AE(o)]}function SE(e){let t=AE(e);return[CE(e),t,CE(t)]}function CE(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var wE=[`left`,`right`],TE=[`right`,`left`],EE=[`top`,`bottom`],DE=[`bottom`,`top`];function OE(e,t,n){switch(e){case`top`:case`bottom`:return n?t?TE:wE:t?wE:TE;case`left`:case`right`:return t?EE:DE;default:return[]}}function kE(e,t,n,r){let i=gE(e),a=OE(hE(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(CE)))),a}function AE(e){let t=hE(e);return fE[t]+e.slice(t.length)}function jE(e){return{top:0,right:0,bottom:0,left:0,...e}}function ME(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:jE(e)}function NE(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function PE(e,t,n){return Math.floor(e/t)!==n}function FE(e,t){return t<0||t>=e.length}function IE(e,t){return RE(e.current,{disabledIndices:t})}function LE(e,t){return RE(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function RE(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&UE(e,a,r));return a}function zE(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!UE(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=uE(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!UE(e,r,s))return r}};d&&AT(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=RE(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=RE(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}FE(e,f)&&(f=u)}if(n===`both`){let n=uE(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&AT(t),u%o===o-1?r&&(f=RE(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=RE(e,{startingIndex:u,disabledIndices:s}),r&&PE(f,o,n)&&(f=RE(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),PE(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&AT(t),u%o===0?r&&(f=RE(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=RE(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&PE(f,o,n)&&(f=RE(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),PE(f,o,n)&&(f=u));let c=uE(l/o)===n;FE(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:RE(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function BE(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function VE(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function HE(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function UE(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?GE(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function WE(e){return e.visibility===`hidden`||e.visibility===`collapse`}function GE(e,t=e?Yx(e):null){return!e||!e.isConnected||!t||WE(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var KE=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function qE(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return Lx(n)?n.host:null}function JE(e){for(let t of Array.from(e.children))if(jx(t)===`summary`)return t;return null}function YE(e,t){let n=JE(t);return!!n&&(e===n||HT(n,e))}function XE(e){let t=e?jx(e):``;return e!=null&&e.matches(KE)&&(t!==`summary`||e.parentElement!=null&&jx(e.parentElement)===`details`&&JE(e.parentElement)===e)&&(t!==`details`||JE(e)==null)&&(t!==`input`||e.type!==`hidden`)}function ZE(e){if(!XE(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=qE(t)){let n=t!==e,r=jx(t)===`slot`;if(t.hasAttribute(`inert`)||n&&jx(t)===`details`&&!t.open&&!YE(e,t)||t.hasAttribute(`hidden`)||!r&&!QE(t,n))return!1}return!0}function QE(e,t){let n=Yx(e);return t?n.display!==`none`:GE(e,n)}function $E(e){let t=e.tabIndex;if(t<0){let t=jx(e);if(t===`details`||t===`audio`||t===`video`||Ix(e)&&e.isContentEditable)return 0}return t}function eD(e){if(jx(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function tD(e,t){let n=eD(e);if(!n)return!0;let r=t.find(e=>{let t=eD(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=eD(e);return t?.name===n.name&&t.form===n.form})===n}function nD(e){if(Ix(e)&&jx(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Ix(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function rD(e,t){nD(e).forEach(e=>{XE(e)&&t.push(e),rD(e,t)})}function iD(e,t,n){nD(e).forEach(e=>{Ix(e)&&e.matches(t)&&n.push(e),iD(e,t,n)})}function aD(e){return ZE(e)&&$E(e)>=0}function oD(e){let t=[];return rD(e,t),t.filter(ZE)}function sD(e){let t=oD(e);return t.filter(e=>$E(e)>=0&&tD(e,t))}function cD(e,t){let n=sD(e),r=n.length;if(r===0)return;let i=VT(sT(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function lD(e){return cD(sT(e).body,1)||e}function uD(e){return cD(sT(e).body,-1)||e}function dD(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!HT(n,r)}function fD(e){sD(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function pD(e){let t=[];iD(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}function mD(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...mD(e,t.id,n)])}function hD(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function gD(e){return`data-base-ui-${e}`}var _D=0;function vD(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(_D);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),HS;let o=requestAnimationFrame(a);return _D=o,()=>{_D===o&&(cancelAnimationFrame(o),_D=0)}}var yD={inert:new WeakMap,"aria-hidden":new WeakMap},bD=`data-base-ui-inert`,xD={inert:new WeakSet,"aria-hidden":new WeakSet},SD=new WeakMap,CD=0;function wD(e){return xD[e]}function TD(e){return e?Lx(e)?e.host:TD(e.parentNode):null}var ED=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=TD(t);return e.contains(n)?n:null}).filter(e=>e!=null),DD=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},OD=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{jx(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function kD(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=ED(t,e),u=i?ED(t,a):[],d=new Set(u),f=i?OD(t,DD(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=yD[o],n=wD(o);c=n,s=e;let r=ED(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);OD(t,DD(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(SD.get(e)||0)+1;SD.set(e,t),m.push(e),t===1&&e.setAttribute(bD,``)}),CD+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(SD.get(e)||0)-1;SD.set(e,t),t||e.removeAttribute(bD)}),--CD,CD||(yD.inert=new WeakMap,yD[`aria-hidden`]=new WeakMap,xD.inert=new WeakSet,xD[`aria-hidden`]=new WeakSet,SD=new WeakMap)}}function AD(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=sT(e[0]).body;return kD(e,o,n,r,{mark:i,markerIgnoreElements:a})}var jD=0;function MD(e,t=`mui`){let[n,r]=v.useState(e),i=e||n;return v.useEffect(()=>{n??(jD+=1,r(`${t}-${jD}`))},[n,t]),i}var ND=tS.useId;function PD(e,t){if(ND!==void 0){let n=ND();return e??(t?`${t}-${n}`:n)}return MD(e,t)}var FD={style:{transition:`none`}},ID={fallbackAxisSide:`none`},LD={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},RD=v.createContext(null),zD=()=>v.useContext(RD),BD=gD(`portal`);function VD(e={}){let{ref:t,container:n,componentProps:r=WS,elementProps:i}=e,a=PD(),o=zD()?.portalNode,[s,c]=v.useState(null),[l,u]=v.useState(null),d=oS(e=>{e!==null&&u(e)}),f=v.useRef(null);Y(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(Px(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=JS(`div`,r,{ref:[t,d],props:[{id:a,[BD]:``},i]});return{portalNode:l,portalSubtree:s&&p?y.createPortal(p,s):null}}var HD=v.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=VD({container:o,ref:t,componentProps:e,elementProps:c}),d=v.useRef(null),f=v.useRef(null),p=v.useRef(null),m=v.useRef(null),[h,g]=v.useState(null),_=v.useRef(!1),b=h?.modal,x=h?.open,S=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;v.useEffect(()=>{if(!l||b)return;function e(e){l&&e.relatedTarget&&dD(e)&&(e.type===`focusin`?_.current&&=(pD(l),!1):(fD(l),_.current=!0))}return oT(cT(l,`focusin`,e,!0),cT(l,`focusout`,e,!0))},[l,b]),v.useEffect(()=>{!l||x!==!1||(pD(l),_.current=!1)},[x,l]);let C=v.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,K.jsxs)(v.Fragment,{children:[u,(0,K.jsxs)(RD.Provider,{value:C,children:[S&&l&&(0,K.jsx)(aE,{"data-type":`outside`,ref:d,onFocus:e=>{dD(e,l)?p.current?.focus():uD(h?h.domReference:null)?.focus()}}),S&&l&&(0,K.jsx)(`span`,{"aria-owns":l.id,style:LD}),l&&y.createPortal(a,l),S&&l&&(0,K.jsx)(aE,{"data-type":`outside`,ref:f,onFocus:e=>{dD(e,l)?m.current?.focus():(lD(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,iE(`focus-out`,e.nativeEvent)))}})]})]})});function UD(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var WD=v.createContext(null),GD=v.createContext(null),KD=()=>v.useContext(WD)?.id||null,qD=e=>{let t=v.useContext(GD);return e??t};function JD(e){return e==null?e:`current`in e?e.current:e}function YD(e,t){let n=Mx(UT(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var XD=20,ZD=[];function QD(){ZD=ZD.filter(e=>e.deref()?.isConnected)}function $D(e){QD(),e&&jx(e)!==`body`&&(ZD.push(new WeakRef(e)),ZD.length>XD&&(ZD=ZD.slice(-20)))}function eO(){return QD(),ZD[ZD.length-1]?.deref()}function tO(e){return e?aD(e)?e:sD(e)[0]||e:null}function nO(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=oD(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return aD(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function rO(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),y=h.useState(`floatingElement`),{events:b,dataRef:x}=h.context,S=oS(()=>x.current.floatingContext?.nodeId),C=i===!1,w=qT(_)&&C,T=v.useRef([`content`]),E=Vw(i),D=Vw(a),O=Vw(l),k=qD(p),A=zD(),j=v.useRef(!1),M=v.useRef(!1),N=v.useRef(!1),P=v.useRef(null),F=v.useRef(``),I=v.useRef(``),L=v.useRef(null),R=v.useRef(null),z=NS(L,f,A?.beforeInsideRef),B=NS(R,A?.afterInsideRef),V=_T(),H=_T(),U=mT(),W=A!=null,G=JT(y),ee=oS((e=G)=>e?sD(e):[]),te=oS(()=>m?.().filter(e=>e!=null)??[]);v.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&HT(G,VT(sT(G)))&&ee().length===0&&!w&&AT(e)}return cT(sT(G),`keydown`,e)},[r,G,s,w,ee]),v.useEffect(()=>{if(r||!g)return;let e=sT(G);function t(){N.current=!1}function n(e){let t=UT(e),n=te();N.current=!(HT(y,t)||HT(_,t)||HT(A?.portalNode,t)||n.some(e=>e===t||HT(e,t))),I.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(M.current=!0)}function i(){I.current=`keyboard`}return oT(cT(e,`pointerdown`,n,!0),cT(e,`pointerup`,t,!0),cT(e,`pointercancel`,t,!0),cT(e,`keydown`,i,!0))},[r,y,_,G,g,A,te]),v.useEffect(()=>{if(r||!c)return;let e=sT(G);function t(){M.current=!0,H.start(0,()=>{M.current=!1})}function n(e){let t=UT(e);aD(t)&&(P.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=UT(t);queueMicrotask(()=>{let a=S(),c=h.context.triggerElements,l=te(),f=n?.hasAttribute(gD(`focus-guard`))&&[L.current,R.current,A?.beforeInsideRef.current,A?.afterInsideRef.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,JD(d),JD(u)].includes(n),p=!(HT(_,n)||HT(y,n)||HT(n,y)||HT(A?.portalNode,n)||l.some(e=>e===n||HT(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>HT(e,n))||f||k&&(mD(k.nodesRef.current,a).find(e=>HT(e.context?.elements.floating,n)||HT(e.context?.elements.domReference,n))||hD(k.nodesRef.current,a).find(e=>[e.context?.elements.floating,JT(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&G&&nO(G,T),o&&r!==_&&!GE(i)&&VT(e)===e.body){if(Ix(G)&&(G.focus(),o===`popup`)){U.request(()=>{G.focus()});return}let e=ee(),t=P.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||G;Ix(n)&&n.focus()}if(x.current.insideReactTree){x.current.insideReactTree=!1;return}(w||!s)&&n&&p&&!M.current&&(w||n!==eO())&&(j.current=!0,h.setOpen(!1,iE($T,t)))})}function a(){N.current||(x.current.insideReactTree=!0,V.start(0,()=>{x.current.insideReactTree=!1}))}let l=Ix(_)?_:null;if(!(!y&&!l))return oT(l&&cT(l,`focusout`,i),l&&cT(l,`pointerdown`,t),y&&cT(y,`focusin`,n),y&&cT(y,`focusout`,i),y&&A&&cT(y,`focusout`,a,!0))},[r,_,y,G,s,k,A,h,c,o,ee,w,S,T,x,V,H,U,u,d,te]),v.useEffect(()=>{if(r||!y||!g)return;let e=Array.from(A?.portalNode?.querySelectorAll(`[${gD(`portal`)}]`)||[]),t=(k?hD(k.nodesRef.current,S()):[]).find(e=>qT(e.context?.elements.domReference||null))?.context?.elements.domReference,n=AD([y,...e,L.current,R.current,A?.beforeOutsideRef.current,A?.afterOutsideRef.current,...te(),t,JD(d),JD(u),w?_:null].filter(e=>e!=null),{ariaHidden:s||w,mark:!1}),i=AD([y,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,y,s,A,w,k,S,u,d,te]),Y(()=>{if(!g||r||!Ix(G))return;let e=sT(G),t=VT(e);queueMicrotask(()=>{let n=E.current,r=typeof n==`function`?n(O.current||``):n;if(r===void 0||r===!1||HT(G,t))return;let i=null,a=()=>(i??=ee(G),i[0]||G),o;o=r===!0||r===null?a():JD(r),o||=a();let s=HT(G,VT(e));vD(o,{preventScroll:o===G,shouldFocus(){if(s)return!0;let t=VT(e);return!(t!==o&&HT(G,t))}})})},[r,g,G,ee,E,O]),Y(()=>{if(r||!G)return;let e=sT(G);$D(VT(e));function t(e){if(e.open||(F.current=YD(e.nativeEvent,I.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(j.current=!0),e.reason===`outside-press`)if(e.nested)j.current=!1;else if(MT(e.nativeEvent)||NT(e.nativeEvent))j.current=!1;else{let e=!1;sT(G).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?j.current=!1:j.current=!0}}b.on(`openchange`,t);function n(){let e=D.current,t=typeof e==`function`?e(F.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`)return _?.isConnected?_:eO()||null;let n=_?.isConnected?_:eO();return JD(t)||n||null}return()=>{b.off(`openchange`,t);let r=VT(e),i=te(),a=HT(y,r)||i.some(e=>e===r||HT(e,r))||k&&mD(k.nodesRef.current,S(),!1).some(e=>HT(e.context?.elements.floating,r)),o=D.current,s=n();queueMicrotask(()=>{let t=tO(s),n=typeof o!=`boolean`;o&&!j.current&&Ix(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),j.current=!1})}},[r,y,G,D,b,k,_,S,te]),Y(()=>{if(!ST||g||!y)return;let e=VT(sT(y));!Ix(e)||!KT(e)||HT(y,e)&&e.blur()},[g,y]),Y(()=>{if(!(r||!A))return A.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{A.setFocusManagerState(null)}},[r,A,s,g,h,c,_]),Y(()=>{if(!(r||!G))return nO(G,T),()=>{queueMicrotask(QD)}},[r,G,T]);let ne=!r&&(s?!w:!0)&&(W||s);return(0,K.jsxs)(v.Fragment,{children:[ne&&(0,K.jsx)(aE,{"data-type":`inside`,ref:z,onFocus:e=>{if(s){let e=ee();vD(e[e.length-1])}else A?.portalNode&&(j.current=!1,dD(e,A.portalNode)?lD(_)?.focus():JD(d??A.beforeOutsideRef)?.focus())}}),n,ne&&(0,K.jsx)(aE,{"data-type":`inside`,ref:B,onFocus:e=>{s?vD(ee()[0]):A?.portalNode&&(c&&(j.current=!0),dD(e,A.portalNode)?uD(_)?.focus():JD(u??A.afterOutsideRef)?.focus())}})]})}function iO(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=XT}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=v.useRef(void 0),f=mT(),p=_T(),m=v.useMemo(()=>{function e(e,t,n,r){let i=iE(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||PT(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=UT(o);if(KT(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}PT(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return v.useMemo(()=>n?{reference:m}:WS,[n,m])}var aO={intentional:`onClick`,sloppy:`onPointerDown`};function oO(){return!1}function sO(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function cO(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=oO,referencePressEvent:s=`sloppy`,bubbles:c,externalTree:l}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=u.useState(`floatingElement`),{dataRef:p}=u.context,m=qD(l),h=oS(typeof i==`function`?i:()=>!1),g=typeof i==`function`?h:i,_=g!==!1,y=oS(()=>a),{escapeKey:b,outsidePress:x}=sO(c),S=v.useRef(!1),C=v.useRef(!1),w=v.useRef(!1),T=v.useRef(!1),E=v.useRef(``),D=v.useRef(null),O=_T(),k=_T(),A=oS(()=>{k.clear(),p.current.insideReactTree=!1}),j=oS(e=>{let t=p.current.floatingContext?.nodeId;return(m?mD(m.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),M=oS(e=>WT(e,u.select(`floatingElement`))||WT(e,u.select(`domReferenceElement`))),N=oS(e=>{o()&&u.setOpen(!1,iE(XT,e.nativeEvent))}),P=oS(e=>{if(!d||!n||!r||e.key!==`Escape`||T.current||!b&&j(`__escapeKeyBubbles`))return;let t=iE(eE,jT(e)?e.nativeEvent:e);u.setOpen(!1,t),t.isCanceled||e.preventDefault(),!b&&!t.isPropagationAllowed&&e.stopPropagation()}),F=oS(()=>{p.current.insideReactTree=!0,k.start(0,A)}),I=oS(e=>{if(!d||!n||e.button!==0)return;let t=UT(e.nativeEvent);HT(u.select(`floatingElement`),t)&&(S.current||(S.current=!0,C.current=!1))}),L=oS(e=>{!d||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&S.current&&(C.current=!0)});v.useEffect(()=>{if(!d||!n)return;p.current.__escapeKeyBubbles=b,p.current.__outsidePressBubbles=x;let e=new gT,t=new gT;function i(){e.clear(),T.current=!0}function a(){e.start(qx()?5:0,()=>{T.current=!1})}function o(){w.current=!0,t.start(0,()=>{w.current=!1})}function s(){S.current=!1,C.current=!1}function c(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=y(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function l(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=p.current.floatingContext?.nodeId,n=m&&mD(m.nodesRef.current,t).some(t=>WT(e,t.context?.elements.floating));return M(e)||n}function v(e){if(l(e)){e.type!==`click`&&!M(e)&&(t.clear(),w.current=!1),A();return}if(p.current.insideReactTree){A();return}let n=UT(e),r=`[${gD(`inert`)}]`,i=Fx(n)?n.getRootNode():null,a=Array.from((Lx(i)?i:sT(u.select(`floatingElement`))).querySelectorAll(r)),o=u.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>HT(e,n))))return;let s=Fx(n)?n:null;for(;s&&!Jx(s);){let e=Zx(s);if(Jx(e)||!Fx(e))break;s=e}if(!(a.length&&Fx(n)&&!GT(n)&&!HT(n,u.select(`floatingElement`))&&a.every(e=>!HT(s,e)))){if(Ix(n)&&!(`touches`in e)){let t=Jx(n),r=Yx(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!h(e)){if(c()===`intentional`&&w.current){t.clear(),w.current=!1;return}typeof g==`function`&&!g(e)||j(`__outsidePressBubbles`)||(u.setOpen(!1,iE(ZT,e)),A())}}}function k(e){c()!==`sloppy`||e.pointerType===`touch`||!u.select(`open`)||!n||M(e)||v(e)}function N(e){if(c()!==`sloppy`||!u.select(`open`)||!n||M(e))return;let t=e.touches[0];t&&(D.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},O.start(1e3,()=>{D.current&&(D.current.dismissOnTouchEnd=!1,D.current.dismissOnMouseDown=!1)}))}function F(e,t){let n=UT(e);if(!n)return;let r=cT(n,e.type,()=>{t(e),r()})}function I(e){E.current=`touch`,F(e,N)}function L(e){O.clear(),e.type===`pointerdown`&&(E.current=e.pointerType),!(e.type===`mousedown`&&D.current&&!D.current.dismissOnMouseDown)&&F(e,e=>{e.type===`pointerdown`?k(e):v(e)})}function R(e){if(!S.current)return;let n=C.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!h(e)){if(n){o();return}typeof g==`function`&&!g(e)||(t.clear(),w.current=!0,A())}}}function z(e){if(c()!==`sloppy`||!D.current||M(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-D.current.startX),r=Math.abs(t.clientY-D.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(D.current.dismissOnTouchEnd=!0),i>10&&(v(e),O.clear(),D.current=null)}function B(e){F(e,z)}function V(e){c()!==`sloppy`||!D.current||M(e)||(D.current.dismissOnTouchEnd&&v(e),O.clear(),D.current=null)}function H(e){F(e,V)}let U=sT(f),W=oT(r&&oT(cT(U,`keydown`,P),cT(U,`compositionstart`,i),cT(U,`compositionend`,a)),_&&oT(cT(U,`click`,L,!0),cT(U,`pointerdown`,L,!0),cT(U,`pointerup`,R,!0),cT(U,`pointercancel`,R,!0),cT(U,`mousedown`,L,!0),cT(U,`mouseup`,R,!0),cT(U,`touchstart`,I,!0),cT(U,`touchmove`,B,!0),cT(U,`touchend`,H,!0)));return()=>{W(),e.clear(),t.clear(),s(),w.current=!1}},[p,f,r,_,g,d,n,b,x,P,A,y,j,M,m,u,O]),v.useEffect(A,[g,A]);let R=v.useMemo(()=>({onKeyDown:P,[aO[s]]:N,...s!==`intentional`&&{onClick:N}}),[P,N,s]),z=v.useMemo(()=>({onKeyDown:P,onPointerDown:L,onMouseDown:L,onClickCapture:F,onMouseDownCapture(e){F(),I(e)},onPointerDownCapture(e){F(),I(e)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[P,F,I,L]);return v.useMemo(()=>n?{reference:R,floating:z,trigger:R}:{},[n,R,z])}function lO(e,t,n){let{reference:r,floating:i}=e,a=yE(t),o=bE(t),s=vE(o),c=hE(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(gE(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function uO(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=mE(t,e),p=ME(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=NE(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=NE(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var dO=50,fO=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:uO},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=lO(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<dO&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=lO(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},pO=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=mE(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=hE(r),_=yE(o),v=hE(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[AE(o)]:SE(o)),x=p!==`none`;!d&&x&&b.push(...kE(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=xE(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==yE(t))||T.every(e=>yE(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=yE(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function mO(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function hO(e){return oE.some(t=>e[t]>=0)}var gO=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=mE(e,t);switch(i){case`referenceHidden`:{let e=mO(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:hO(e)}}}case`escaped`:{let e=mO(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:hO(e)}}}default:return{}}}}},_O=new Set([`left`,`top`]);async function vO(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=hE(n),s=gE(n),c=yE(n)===`y`,l=_O.has(o)?-1:1,u=a&&c?-1:1,d=mE(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var yO=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await vO(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},bO=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=mE(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=yE(hE(i)),p=_E(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=pE(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=pE(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},xO=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=mE(e,t),u={x:n,y:r},d=yE(i),f=_E(d),p=u[f],m=u[d],h=mE(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=_O.has(hE(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},SO=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=mE(e,t),u=await o.detectOverflow(t,l),d=hE(i),f=gE(i),p=yE(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=sE(h-u[g],v),x=sE(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=cE(u.left,0),t=cE(u.right,0),n=cE(u.top,0),r=cE(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:cE(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:cE(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function CO(e){let t=Yx(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ix(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=lE(n)!==a||lE(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function wO(e){return Fx(e)?e:e.contextElement}function TO(e){let t=wO(e);if(!Ix(t))return dE(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=CO(t),o=(a?lE(n.width):n.width)/r,s=(a?lE(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var EO=dE(0);function DO(e){let t=Mx(e);return!qx()||!t.visualViewport?EO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function OO(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Mx(e)?!1:t}function kO(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=wO(e),o=dE(1);t&&(r?Fx(r)&&(o=TO(r)):o=TO(e));let s=OO(a,n,r)?DO(a):dE(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=Mx(a),t=r&&Fx(r)?Mx(r):r,n=e,i=eS(n);for(;i&&r&&t!==n;){let e=TO(i),t=i.getBoundingClientRect(),r=Yx(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=Mx(i),i=eS(n)}}return NE({width:u,height:d,x:c,y:l})}function AO(e,t){let n=Xx(e).scrollLeft;return t?t.left+n:kO(Nx(e)).left+n}function jO(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-AO(e,n),y:n.top+t.scrollTop}}function MO(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Nx(r),s=t?Bx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=dE(1),u=dE(0),d=Ix(r);if((d||!d&&!a)&&((jx(r)!==`body`||Rx(o))&&(c=Xx(r)),d)){let e=kO(r);l=TO(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?jO(o,c):dE(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function NO(e){return Array.from(e.getClientRects())}function PO(e){let t=Nx(e),n=Xx(e),r=e.ownerDocument.body,i=cE(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=cE(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+AO(e),s=-n.scrollTop;return Yx(r).direction===`rtl`&&(o+=cE(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var FO=25;function IO(e,t){let n=Mx(e),r=Nx(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=qx();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=AO(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=FO&&(a-=o)}else l<=FO&&(a+=l);return{width:a,height:o,x:s,y:c}}function LO(e,t){let n=kO(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ix(e)?TO(e):dE(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function RO(e,t,n){let r;if(t===`viewport`)r=IO(e,n);else if(t===`document`)r=PO(Nx(e));else if(Fx(t))r=LO(t,n);else{let n=DO(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return NE(r)}function zO(e,t){let n=Zx(e);return n===t||!Fx(n)||Jx(n)?!1:Yx(n).position===`fixed`||zO(n,t)}function BO(e,t){let n=t.get(e);if(n)return n;let r=$x(e,[],!1).filter(e=>Fx(e)&&jx(e)!==`body`),i=null,a=Yx(e).position===`fixed`,o=a?Zx(e):e;for(;Fx(o)&&!Jx(o);){let t=Yx(o),n=Gx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Rx(o)&&!n&&zO(e,o))?r=r.filter(e=>e!==o):i=t,o=Zx(o)}return t.set(e,r),r}function VO(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Bx(t)?[]:BO(t,this._c):[].concat(n),r],o=RO(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=RO(t,a[e],i);s=cE(n.top,s),c=sE(n.right,c),l=sE(n.bottom,l),u=cE(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function HO(e){let{width:t,height:n}=CO(e);return{width:t,height:n}}function UO(e,t,n){let r=Ix(t),i=Nx(t),a=n===`fixed`,o=kO(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=dE(0);function l(){c.x=AO(i)}if(r||!r&&!a)if((jx(t)!==`body`||Rx(i))&&(s=Xx(t)),r){let e=kO(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?jO(i,s):dE(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function WO(e){return Yx(e).position===`static`}function GO(e,t){if(!Ix(e)||Yx(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Nx(e)===n&&(n=n.ownerDocument.body),n}function KO(e,t){let n=Mx(e);if(Bx(e))return n;if(!Ix(e)){let t=Zx(e);for(;t&&!Jx(t);){if(Fx(t)&&!WO(t))return t;t=Zx(t)}return n}let r=GO(e,t);for(;r&&zx(r)&&WO(r);)r=GO(r,t);return r&&Jx(r)&&WO(r)&&!Gx(r)?n:r||Kx(e)||n}var qO=async function(e){let t=this.getOffsetParent||KO,n=this.getDimensions,r=await n(e.floating);return{reference:UO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function JO(e){return Yx(e).direction===`rtl`}var YO={convertOffsetParentRelativeRectToViewportRelativeRect:MO,getDocumentElement:Nx,getClippingRect:VO,getOffsetParent:KO,getElementRects:qO,getClientRects:NO,getDimensions:HO,getScale:TO,isElement:Fx,isRTL:JO};function XO(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ZO(e,t){let n=null,r,i=Nx(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=uE(d),h=uE(i.clientWidth-(u+f)),g=uE(i.clientHeight-(d+p)),_=uE(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:cE(0,sE(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!XO(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function QO(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=wO(e),u=i||a?[...l?$x(l):[],...t?$x(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ZO(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?kO(e):null;c&&g();function g(){let t=kO(e);h&&!XO(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var $O=yO,ek=bO,tk=pO,nk=SO,rk=gO,ik=xO,ak=(e,t,n)=>{let r=new Map,i={platform:YO,...n},a={...i.platform,_c:r};return fO(e,t,{...i,platform:a})},ok=typeof document<`u`?v.useLayoutEffect:function(){};function sk(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!sk(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!sk(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ck(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lk(e,t){let n=ck(e);return Math.round(t*n)/n}function uk(e){let t=v.useRef(e);return ok(()=>{t.current=e}),t}function dk(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);sk(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),b=v.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=v.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),S=a||m,C=o||g,w=v.useRef(null),T=v.useRef(null),E=v.useRef(u),D=c!=null,O=uk(c),k=uk(i),A=uk(l),j=v.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),ak(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!sk(E.current,t)&&(E.current=t,y.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);ok(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=v.useRef(!1);ok(()=>(M.current=!0,()=>{M.current=!1}),[]),ok(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=v.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=v.useMemo(()=>({reference:S,floating:C}),[S,C]),F=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=lk(P.floating,u.x),r=lk(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ck(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var fk=(e,t)=>{let n=$O(e);return{name:n.name,fn:n.fn,options:[e,t]}},pk=(e,t)=>{let n=ek(e);return{name:n.name,fn:n.fn,options:[e,t]}},mk=(e,t)=>({fn:ik(e).fn,options:[e,t]}),hk=(e,t)=>{let n=tk(e);return{name:n.name,fn:n.fn,options:[e,t]}},gk=(e,t)=>{let n=nk(e);return{name:n.name,fn:n.fn,options:[e,t]}},_k=(e,t)=>{let n=rk(e);return{name:n.name,fn:n.fn,options:[e,t]}},vk={open:Uw(e=>e.open),transitionStatus:Uw(e=>e.transitionStatus),domReferenceElement:Uw(e=>e.domReferenceElement),referenceElement:Uw(e=>e.positionReference??e.referenceElement),floatingElement:Uw(e=>e.floatingElement),floatingId:Uw(e=>e.floatingId)},yk=class extends aT{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:UD(),nested:n,triggerElements:i},vk),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&FT(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function bk(e,t=!1,n=!1){let[r,i]=v.useState(e&&t?`idle`:void 0),[a,o]=v.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Y(()=>{if(!e&&a&&r!==`ending`&&n){let e=pT.request(()=>{i(`ending`)});return()=>{pT.cancel(e)}}},[e,a,r,n]),Y(()=>{if(!e||t)return;let n=pT.request(()=>{i(void 0)});return()=>{pT.cancel(n)}},[t,e]),Y(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=pT.request(()=>{i(`idle`)});return()=>{pT.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}var xk=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Sk={[xk.startingStyle]:``},Ck={[xk.endingStyle]:``},wk={transitionStatus(e){return e===`starting`?Sk:e===`ending`?Ck:null}};function Tk(e,t=!1,n=!0){let r=mT();return oS((i,a=null)=>{r.cancel();let o=JD(e);if(o==null)return;let s=o,c=()=>{y.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=xk.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Ek(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=oS(i),o=Tk(r,n,!1);v.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}var Dk={tabIndex:-1,[IT]:``},Ok=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function kk(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=PD(),a=KD()!=null,o=rS(()=>new yk({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Ok,floatingId:i,syncOnly:!1,nested:a})).current;return Y(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=Fx(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function Ak(e={}){let{nodeId:t,externalTree:n}=e,r=kk(e),i=e.rootContext||r,a=i.useState(`referenceElement`),o=i.useState(`floatingElement`),s=i.useState(`domReferenceElement`),c=i.useState(`open`),l=i.useState(`floatingId`),[u,d]=v.useState(null),[f,p]=v.useState(void 0),[m,h]=v.useState(void 0),g=v.useRef(null),_=qD(n),y=v.useMemo(()=>({reference:a,floating:o,domReference:s}),[a,o,s]),b=dk({...e,elements:{...y,...u&&{reference:u}}}),x=Fx(f)?f:null,S=m===void 0?i.state.floatingElement:m;i.useSyncedValue(`referenceElement`,f??null),i.useSyncedValue(`domReferenceElement`,f===void 0?s:x),i.useSyncedValue(`floatingElement`,S);let C=v.useCallback(e=>{let t=Fx(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),b.refs.setReference(t)},[b.refs]),w=v.useCallback(e=>{(Fx(e)||e===null)&&(g.current=e,p(e)),(Fx(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!Fx(e))&&b.refs.setReference(e)},[b.refs,p]),T=v.useCallback(e=>{h(e),b.refs.setFloating(e)},[b.refs]),E=v.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:g}),[b.refs,w,T,C]),D=v.useMemo(()=>({...b.elements,domReference:s}),[b.elements,s]),O=v.useMemo(()=>({...b,dataRef:i.context.dataRef,open:c,onOpenChange:i.setOpen,events:i.context.events,floatingId:l,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,c,l]);return Y(()=>{s&&(g.current=s)},[s]),Y(()=>{i.context.dataRef.current.floatingContext=O;let e=_?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),v.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var jk=`Escape`;function Mk(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Nk(e,t){return Mk(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Pk(e,t,n){return Mk(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Fk(e,t,n){return Mk(t,n?e===LT:e===RT,e===BT)}function Ik(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===jk:Mk(t,n?e===RT:e===LT,e===zT)}function Lk(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:a=!0,selectedIndex:o=null,allowEscape:s=!1,loopFocus:c=!1,nested:l=!1,rtl:u=!1,virtual:d=!1,focusItemOnOpen:f=`auto`,focusItemOnHover:p=!0,openOnArrowKeyDown:m=!0,disabledIndices:h=void 0,orientation:g=`vertical`,parentOrientation:_,cols:y=1,id:b,resetOnPointerLeave:x=!0,externalTree:S}=t,C=`rootStore`in e?e.rootStore:e,w=C.useState(`open`),T=C.useState(`floatingElement`),E=C.useState(`domReferenceElement`),D=C.context.dataRef,O=JT(T),k=qT(E),A=Vw(O),j=KD(),M=qD(S),N=v.useRef(f),P=v.useRef(o??-1),F=v.useRef(null),I=v.useRef(!0),L=oS(e=>{i(P.current===-1?null:P.current,e)}),R=v.useRef(L),z=v.useRef(!!T),B=v.useRef(w),V=v.useRef(!1),H=v.useRef(!1),U=v.useRef(null),W=Vw(h),G=Vw(w),ee=Vw(o),te=Vw(x),ne=mT(),re=mT(),ie=oS(()=>{function e(e){d?M?.events.emit(`virtualfocus`,e):U.current=vD(e,{sync:V.current,preventScroll:!0})}let t=n.current[P.current],r=H.current;t&&e(t),(V.current?e=>e():e=>ne.request(e))(()=>{let i=n.current[P.current]||t;i&&(t||e(i),ue&&(r||!I.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Y(()=>{D.current.orientation=g},[D,g]),Y(()=>{a&&(w&&T?(P.current=o??-1,N.current&&o!=null&&(H.current=!0,L())):z.current&&(P.current=-1,R.current()))},[a,w,T,o,L]),Y(()=>{if(a){if(!w){V.current=!1;return}if(T)if(r==null){if(V.current=!1,ee.current!=null)return;if(z.current&&(P.current=-1,ie()),(!B.current||!z.current)&&N.current&&(F.current!=null||N.current===!0&&F.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>re.request(e):queueMicrotask)(t),e+=1):(P.current=F.current==null||Pk(F.current,g,u)||l?IE(n):LE(n),F.current=null,L())};t()}}else FE(n.current,r)||(P.current=r,ie(),H.current=!1)}},[a,w,T,r,ee,l,n,g,u,L,ie,re]),Y(()=>{if(!a||T||!M||d||!z.current)return;let e=M.nodesRef.current,t=e.find(e=>e.id===j)?.context?.elements.floating,n=VT(sT(T)),r=e.some(e=>e.context&&HT(e.context.elements.floating,n));t&&!r&&I.current&&t.focus({preventScroll:!0})},[a,T,M,j,d]),Y(()=>{R.current=L,B.current=w,z.current=!!T}),Y(()=>{w||(F.current=null,N.current=f)},[w,f]);let ae=r!=null,oe=oS(e=>{if(!G.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(P.current!==t||r!==t)&&(P.current=t,L(e))}),se=oS(()=>_??M?.nodesRef.current.find(e=>e.id===j)?.context?.dataRef?.current.orientation),ce=oS(()=>IE(n,W.current)),le=oS(e=>{if(I.current=!1,V.current=!0,e.which===229||!G.current&&e.currentTarget===A.current)return;if(l&&Ik(e.key,g,u,y)){Nk(e.key,se())||AT(e),C.setOpen(!1,iE(tE,e.nativeEvent)),Ix(E)&&(d?M?.events.emit(`virtualfocus`,E):E.focus());return}let t=P.current,r=IE(n,h),i=LE(n,h);if(k||(e.key===`Home`&&(AT(e),P.current=r,L(e)),e.key===`End`&&(AT(e),P.current=i,L(e))),y>1){let t=Array.from({length:n.current.length},()=>({width:1,height:1})),a=BE(t,y,!1),o=a.findIndex(e=>e!=null&&!UE(n.current,e,h)),s=a.reduce((e,t,r)=>t!=null&&!UE(n.current,t,h)?r:e,-1),l=a[zE(a.map(e=>e==null?null:n.current[e]),{event:e,orientation:g,loopFocus:c,rtl:u,cols:y,disabledIndices:HE([...(typeof h==`function`?null:h)||n.current.map((e,t)=>UE(n.current,t,h)?t:void 0),void 0],a),minIndex:o,maxIndex:s,prevIndex:VE(P.current>i?r:P.current,t,a,y,e.key===`ArrowDown`?`bl`:e.key===(u?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(l!=null&&(P.current=l,L(e)),g===`both`)return}if(Nk(e.key,g)){if(AT(e),w&&!d&&VT(e.currentTarget.ownerDocument)===e.currentTarget){P.current=Pk(e.key,g,u)?r:i,L(e);return}Pk(e.key,g,u)?c?t>=i?s&&t!==n.current.length?P.current=-1:(V.current=!1,P.current=r):P.current=RE(n.current,{startingIndex:t,disabledIndices:h}):P.current=Math.min(i,RE(n.current,{startingIndex:t,disabledIndices:h})):c?t<=r?s&&t!==-1?P.current=n.current.length:(V.current=!1,P.current=i):P.current=RE(n.current,{startingIndex:t,decrement:!0,disabledIndices:h}):P.current=Math.max(r,RE(n.current,{startingIndex:t,decrement:!0,disabledIndices:h})),FE(n.current,P.current)&&(P.current=-1),L(e)}}),ue=v.useMemo(()=>({onFocus(e){V.current=!0,oe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){V.current=!0,H.current=!1,p&&oe(e)},onPointerLeave(e){if(!G.current||!I.current||e.pointerType===`touch`)return;V.current=!0;let t=e.relatedTarget;if(!(!p||n.current.includes(t))&&te.current&&(U.current?.(),U.current=null,P.current=-1,L(e),!d)){let e=A.current,t=VT(sT(e));e&&HT(e,t)&&e.focus({preventScroll:!0})}}}),[oe,G,A,p,n,L,te,d]),de=v.useMemo(()=>d&&w&&ae&&{"aria-activedescendant":`${b}-${r}`},[d,w,ae,b,r]),fe=v.useMemo(()=>({"aria-orientation":g===`both`?void 0:g,...k?{}:de,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&w&&!d){let t=UT(e.nativeEvent);if(t&&!HT(A.current,t))return;AT(e),C.setOpen(!1,iE($T,e.nativeEvent)),Ix(E)&&E.focus();return}le(e)},onPointerMove(){I.current=!0}}),[de,le,A,g,k,C,w,d,E]),pe=v.useMemo(()=>{function e(e){C.setOpen(!0,iE(tE,e.nativeEvent,e.currentTarget))}function t(e){f===`auto`&&MT(e.nativeEvent)&&(N.current=!d)}function n(e){N.current=f,f===`auto`&&NT(e.nativeEvent)&&(N.current=!0)}return{onKeyDown(t){let n=C.select(`open`);I.current=!1;let r=t.key.startsWith(`Arrow`),i=Fk(t.key,se(),u),a=Nk(t.key,g),o=(l?i:a)||t.key===`Enter`||t.key.trim()===``;if(d&&n)return le(t);if(!(!n&&!m&&r)){if(o){let e=Nk(t.key,se());F.current=l&&e?null:t.key}if(l){i&&(AT(t),n?(P.current=ce(),L(t)):e(t));return}a&&(ee.current!=null&&(P.current=ee.current),AT(t),!n&&m?e(t):le(t),n&&L(t))}},onFocus(e){C.select(`open`)&&!d&&(P.current=-1,L(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[le,f,ce,l,L,C,m,g,se,u,ee,d]),me=v.useMemo(()=>({...de,...pe}),[de,pe]);return v.useMemo(()=>a?{reference:me,floating:fe,item:ue,trigger:pe}:{},[a,me,fe,pe,ue])}function Rk(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:a,onTyping:o,enabled:s=!0,resetMs:c=750,selectedIndex:l=null}=t,u=`rootStore`in e?e.rootStore:e,d=u.useState(`open`),f=_T(),p=v.useRef(``),m=v.useRef(l??i??-1),h=v.useRef(null),g=oS(e=>{function t(e){let t=r?.current[e];return!t||GE(t)}function s(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let u=n.current;if(p.current.length>0&&e.key===` `&&(AT(e),o?.(!0)),p.current.length>0&&p.current[0]!==` `&&s(u,p.current)===-1&&e.key!==` `&&o?.(!1),u==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;d&&e.key!==` `&&(AT(e),o?.(!0));let g=p.current===``;g&&(m.current=l??i??-1),u.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&p.current===e.key&&(p.current=``,m.current=h.current),p.current+=e.key,f.start(c,()=>{p.current=``,m.current=h.current,o?.(!1)});let _=((g?l??i??-1:m.current)??0)+1,v=s(u,p.current,_);v===-1?e.key!==` `&&(p.current=``,o?.(!1)):(a?.(v),h.current=v)}),_=oS(e=>{let t=e.relatedTarget,n=u.select(`domReferenceElement`),r=u.select(`floatingElement`);HT(n,t)||HT(r,t)||(f.clear(),p.current=``,m.current=h.current,o?.(!1))});Y(()=>{!d&&l!==null||(f.clear(),h.current=null,p.current!==``&&(p.current=``))},[d,l,f]),Y(()=>{d&&p.current===``&&(m.current=l??i??-1)},[d,l,i]);let y=v.useMemo(()=>({onKeyDown:g,onBlur:_}),[g,_]);return v.useMemo(()=>s?{reference:y,floating:y}:{},[s,y])}var zk=v.createContext(null),Bk=v.createContext(null);function Vk(){let e=v.useContext(zk);if(e===null)throw Error(ES(60));return e}function Hk(){let e=v.useContext(Bk);if(e===null)throw Error(ES(61));return e}var Uk=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Wk={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Gk={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},Kk={disabled:!1,...Gk},qk={valid(e){return e===null?null:e?{[Uk.valid]:``}:{[Uk.invalid]:``}}},Jk={invalid:void 0,name:void 0,validityData:{state:Wk,errors:[],error:``,value:``,initialValue:null},setValidityData:HS,disabled:void 0,touched:Gk.touched,setTouched:HS,dirty:Gk.dirty,setDirty:HS,filled:Gk.filled,setFilled:HS,focused:Gk.focused,setFocused:HS,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:Kk,markedDirtyRef:{current:!1},registerFieldControl:HS,validation:{getValidationProps:(e=WS)=>e,getInputValidationProps:(e=WS)=>e,inputRef:{current:null},commit:async()=>{}}},Yk=v.createContext(Jk);function Xk(e=!0){let t=v.useContext(Yk);if(t.setValidityData===HS&&!e)throw Error(ES(28));return t}function Zk(e,t,n,r,i=!0){let{registerFieldControl:a}=Xk(),o=v.useRef(null);o.current||=Symbol(),Y(()=>{let s=o.current;if(!(!s||!i))return a(s,{controlRef:e,getValue:r,id:t,value:n}),()=>{a(s,void 0)}},[e,i,r,t,a,n])}function Qk(e){return PD(e,`base-ui`)}var $k=v.createContext({controlId:void 0,registerControlId:HS,labelId:void 0,setLabelId:HS,messageIds:[],setMessageIds:HS,getDescriptionProps:e=>e});function eA(){return v.useContext($k)}function tA(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=eA(),o=Qk(t),s=n?i:void 0,c=rS(()=>Symbol(`labelable-control`)),l=v.useRef(!1),u=v.useRef(t!=null),d=oS(()=>{!l.current||a===HS||(l.current=!1,a(c.current,void 0))});return Y(()=>{if(a===HS)return;let e;if(n){let n=r?.current;e=Fx(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),v.useEffect(()=>d,[d]),i??o}var nA=(e,t)=>Object.is(e,t);function rA(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function iA(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:rA(t,e,n))}function aA(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:rA(e,t,n))}function oA(e,t,n){return e.filter(e=>!rA(t,e,n))}function sA(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function cA(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function lA(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(cA(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function uA(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return sA(e)}function dA(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?sA(e.value):sA(e)}function fA(e,t,n){function r(){return uA(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=cA(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function pA(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,K.jsx)(v.Fragment,{children:fA(r,t,n)},i)),e),[])}var $={id:Uw(e=>e.id),labelId:Uw(e=>e.labelId),modal:Uw(e=>e.modal),multiple:Uw(e=>e.multiple),items:Uw(e=>e.items),itemToStringLabel:Uw(e=>e.itemToStringLabel),itemToStringValue:Uw(e=>e.itemToStringValue),isItemEqualToValue:Uw(e=>e.isItemEqualToValue),value:Uw(e=>e.value),hasSelectedValue:Uw(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:dA(t,r)!==``}),hasNullItemLabel:Uw((e,t)=>t?lA(e.items):!1),open:Uw(e=>e.open),mounted:Uw(e=>e.mounted),forceMount:Uw(e=>e.forceMount),transitionStatus:Uw(e=>e.transitionStatus),openMethod:Uw(e=>e.openMethod),activeIndex:Uw(e=>e.activeIndex),selectedIndex:Uw(e=>e.selectedIndex),isActive:Uw((e,t)=>e.activeIndex===t),isSelected:Uw((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>rA(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:rA(n,i,r)}),isSelectedByFocus:Uw((e,t)=>e.selectedIndex===t),popupProps:Uw(e=>e.popupProps),triggerProps:Uw(e=>e.triggerProps),triggerElement:Uw(e=>e.triggerElement),positionerElement:Uw(e=>e.positionerElement),listElement:Uw(e=>e.listElement),popupSide:Uw(e=>e.popupSide),scrollUpArrowVisible:Uw(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Uw(e=>e.scrollDownArrowVisible),hasScrollArrows:Uw(e=>e.hasScrollArrows)},mA=v.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:HS,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function hA(){return v.useContext(mA)}function gA(e,t){let n=v.useRef(e),r=oS(t);Y(()=>{n.current!==e&&r(n.current)},[e,r]),Y(()=>{n.current=e},[e])}function _A(e){let t=v.useRef(``),n=v.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:v.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function vA(e,t){let{onClick:n,onPointerDown:r}=_A(oS((n,r)=>{(typeof e==`function`?e():e)||t(r||(CT?`touch`:``))}));return v.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function yA(e){let[t,n]=v.useState(null),r=vA(e,n);return gA(e,t=>{t&&!e&&n(null)}),v.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function bA(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function xA(e,t){return Math.max(0,e-t)}function SA(e,t){if(t<=0)return 0;let n=bA(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function CA(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:y,multiple:b=!1,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:C=nA,highlightItemOnHover:w=!0,children:T}=e,{clearErrors:E}=hA(),{setDirty:D,setTouched:O,setFocused:k,shouldValidateOnChange:A,validityData:j,setFilled:M,name:N,disabled:P,validation:F,validationMode:I}=Xk(),L=tA({id:t}),R=P||d,z=N??c,[B,V]=Bw({controlled:n,default:b?r??US:r,name:`Select`,state:`value`}),[H,U]=Bw({controlled:a,default:o,name:`Select`,state:`open`}),W=v.useRef([]),G=v.useRef([]),ee=v.useRef(null),te=v.useRef(null),ne=v.useRef(0),re=v.useRef(null),ie=v.useRef([]),ae=v.useRef(!1),oe=v.useRef(!1),se=v.useRef(null),ce=v.useRef(null),le=v.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ue=v.useRef(!1),{mounted:de,setMounted:fe,transitionStatus:pe}=bk(H),{openMethod:me,triggerProps:he}=yA(H),ge=rS(()=>new iT({id:L,labelId:void 0,modal:m,multiple:b,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:C,value:B,open:H,mounted:de,transitionStatus:pe,items:y,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,_e=Q(ge,$.activeIndex),ve=Q(ge,$.selectedIndex),ye=Q(ge,$.triggerElement),be=Q(ge,$.positionerElement),xe=zw(me),Se=me??xe,Ce=v.useMemo(()=>b&&Array.isArray(B)&&B.length===0?``:dA(B,S),[b,B,S]),we=v.useMemo(()=>b&&Array.isArray(B)?B.map(e=>dA(e,S)):dA(B,S),[b,B,S]);Zk(Vw(ge.state.triggerElement),L,B,oS(()=>we));let Te=v.useRef(B),Ee=b?Array.isArray(B)&&B.length>0:B!=null;Y(()=>{B!==Te.current&&ge.set(`forceMount`,!0)},[ge,B]),Y(()=>{M(Ee)},[Ee,M]),Y(function(){let e=ie.current,t;if(b){let n=Array.isArray(B)?B:[];if(n.length===0)t=null;else{let r=n[n.length-1],i=aA(e,r,C);t=i===-1?null:i}}else{let n=aA(e,B,C);t=n===-1?null:n}t===null&&(ce.current=null),!H&&ge.set(`selectedIndex`,t)},[Ee,b,H,B,ie,C,ge,ce]),gA(B,()=>{E(z),D(B!==j.initialValue),A()?F.commit(B):F.commit(B,!0)});let De=oS((e,t)=>{if(s?.(e,t),!t.isCanceled&&(U(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(O(!0),k(!1),I===`onBlur`&&F.commit(B)),!e&&ge.state.activeIndex!==null)){let e=W.current[ge.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Oe=oS(()=>{fe(!1),ge.update({activeIndex:null,openMethod:null}),_?.(!1)});Ek({enabled:!h,open:H,ref:ee,onComplete(){H||Oe()}}),v.useImperativeHandle(h,()=>({unmount:Oe}),[Oe]);let ke=oS((e,t)=>{i?.(e,t),!t.isCanceled&&V(e)}),Ae=oS(()=>{let e=ge.state.listElement||ee.current;if(!e)return;let t=xA(e.scrollHeight,e.clientHeight),n=SA(e.scrollTop,t),r=n>0,i=n<t;ge.state.scrollUpArrowVisible!==r&&ge.set(`scrollUpArrowVisible`,r),ge.state.scrollDownArrowVisible!==i&&ge.set(`scrollDownArrowVisible`,i)}),je=kk({open:H,onOpenChange:De,elements:{reference:ye,floating:be}}),Me=iO(je,{enabled:!f&&!R,event:`mousedown`}),Ne=cO(je),Pe=Lk(je,{enabled:!f&&!R,listRef:W,activeIndex:_e,selectedIndex:ve,disabledIndices:US,onNavigate(e){e===null&&!H||ge.set(`activeIndex`,e)},focusItemOnHover:w}),Fe=Rk(je,{enabled:!f&&!R&&(H||!b),listRef:G,activeIndex:_e,selectedIndex:ve,onMatch(e){H?ge.set(`activeIndex`,e):ke(ie.current[e],iE(`none`))},onTyping(e){ae.current=e}}),Ie=v.useMemo(()=>{let e=dS(Fe.reference,Pe.reference,Ne.reference,Me.reference,he);return L&&(e.id=L),e},[Me.reference,Fe.reference,Pe.reference,Ne.reference,he,L]),Le=v.useMemo(()=>dS(Dk,Fe.floating,Pe.floating,Ne.floating),[Fe.floating,Pe.floating,Ne.floating]),Re=Pe.item??WS;Rw(()=>{ge.update({popupProps:Le,triggerProps:Ie})}),Y(()=>{ge.update({id:L,modal:m,multiple:b,value:B,open:H,mounted:de,transitionStatus:pe,popupProps:Le,triggerProps:Ie,items:y,itemToStringLabel:x,itemToStringValue:S,isItemEqualToValue:C,openMethod:Se})},[ge,L,m,b,B,H,de,pe,Le,Ie,y,x,S,C,Se]);let ze=v.useMemo(()=>({store:ge,name:z,required:p,disabled:R,readOnly:f,multiple:b,highlightItemOnHover:w,setValue:ke,setOpen:De,listRef:W,popupRef:ee,scrollHandlerRef:te,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ne,itemProps:Re,events:je.context.events,valueRef:re,valuesRef:ie,labelsRef:G,typingRef:ae,selectionRef:le,firstItemTextRef:se,selectedItemTextRef:ce,validation:F,onOpenChangeComplete:_,keyboardActiveRef:oe,alignItemWithTriggerActiveRef:ue,initialValueRef:Te}),[ge,z,p,R,f,b,w,ke,De,Re,je.context.events,F,_,Ae]),Be=NS(g,F.inputRef),Ve=b&&Array.isArray(B)&&B.length>0,He=b?void 0:z,Ue=v.useMemo(()=>!b||!Array.isArray(B)||!z?null:B.map(e=>{let t=dA(e,S);return(0,K.jsx)(`input`,{type:`hidden`,form:l,name:z,value:t},t)}),[b,B,l,z,S]);return(0,K.jsx)(zk.Provider,{value:ze,children:(0,K.jsxs)(Bk.Provider,{value:je,children:[T,(0,K.jsx)(`input`,{...F.getInputValidationProps({onFocus(){ge.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||R||f){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=iE(YT,e.nativeEvent);function r(){if(b)return;let e=ie.current.find(e=>dA(e,S).toLowerCase()===t.toLowerCase()||uA(e,x).toLowerCase()===t.toLowerCase());e!=null&&(D(e!==j.initialValue),ke(e,n),A()&&F.commit(e))}ge.set(`forceMount`,!0),queueMicrotask(r)}}),id:L&&He==null?`${L}-hidden-input`:void 0,form:l,name:He,autoComplete:u,value:Ce,disabled:R,required:p&&!Ve,readOnly:f,ref:Be,style:z?Lw:Iw,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Ue]})})}function wA(e,t){return e??t}var TA=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=xk.startingStyle]=`startingStyle`,e[e.endingStyle=xk.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),EA=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),DA={[EA.popupOpen]:``},OA={[EA.popupOpen]:``,[EA.pressed]:``},kA={[TA.open]:``},AA={[TA.closed]:``},jA={[TA.anchorHidden]:``},MA={open(e){return e?DA:null}},NA={open(e){return e?OA:null}},PA={open(e){return e?kA:AA},anchorHidden(e){return e?jA:null}};function FA(e){let t=e.getBoundingClientRect(),n=Mx(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var IA=2,LA=400,RA={...NA,...qk,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},zA=v.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=Xk(),{labelId:m}=eA(),{store:h,setOpen:g,selectionRef:_,validation:y,readOnly:b,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=Vk(),T=p||C||a,E=Q(h,$.open),D=Q(h,$.mounted),O=Q(h,$.value),k=Q(h,$.triggerProps),A=Q(h,$.positionerElement),j=Q(h,$.listElement),M=Q(h,$.popupSide),N=Q(h,$.id),P=Q(h,$.labelId),F=Q(h,$.hasSelectedValue),I=D&&A?M:null,L=i??N,R=wA(m,P);tA({id:L});let z=Vw(A),B=v.useRef(null),{getButtonProps:V,buttonRef:H}=AS({disabled:T,native:o}),U=NS(t,B,H,oS(e=>{h.set(`triggerElement`,e)})),W=_T(),G=_T(),ee=_T();v.useEffect(()=>{if(E)return ee.start(LA,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ee.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},G.clear()},[E,_,G,ee]);let te=dS(k,{id:L,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?j?.id??JT(A)?.id:void 0,"aria-labelledby":R,"aria-readonly":b||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:U,onFocus(e){u(!0),E&&S.current&&g(!1,iE(YT,e.nativeEvent)),W.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){HT(A,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&y.commit(O))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=sT(e.currentTarget);function n(e){if(!B.current)return;let t=e.target;if(HT(B.current,t)||HT(z.current,t)||t===B.current)return;let n=FA(B.current);e.clientX>=n.left-IA&&e.clientX<=n.right+IA&&e.clientY>=n.top-IA&&e.clientY<=n.bottom+IA||g(!1,iE(nE,e))}G.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},y.getValidationProps,c,V);te.role=`combobox`;let ne={...f,open:E,disabled:T,value:O,readOnly:b,popupSide:I,placeholder:!F};return JS(`button`,e,{ref:[t,B],state:ne,stateAttributesMapping:RA,props:te})}),BA={value:()=>null},VA=v.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Vk(),u=Q(c,$.value),d=Q(c,$.items),f=Q(c,$.itemToStringLabel),p=Q(c,$.hasSelectedValue),m=!p&&a!=null&&i==null,h=Q(c,$.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?pA(u,d,f):fA(u,d,f)),JS(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:BA})}),HA=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Vk();return JS(`span`,e,{state:{open:Q(o,$.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:MA})}),UA=v.createContext(void 0),WA=v.forwardRef(function(e,t){let{store:n}=Vk(),r=Q(n,$.mounted),i=Q(n,$.forceMount);return r||i?(0,K.jsx)(UA.Provider,{value:!0,children:(0,K.jsx)(HD,{ref:t,...e})}):null});function GA(e){return BS(19)?e:e?`true`:void 0}var KA=v.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function qA(){return v.useContext(KA)}function JA(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=oS(i),o=v.useRef(0),s=rS(XA).current,c=rS(YA).current,[l,u]=v.useState(0),d=v.useRef(l),f=oS((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=oS(e=>{c.delete(e),d.current+=1,u(d.current)}),m=v.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(ZA).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Y(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Y(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Y(()=>()=>{n.current=[]},[n]),Y(()=>()=>{r&&(r.current=[])},[r]);let h=oS(e=>(s.add(e),()=>{s.delete(e)}));Y(()=>{s.forEach(e=>e(m))},[s,m]);let g=v.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,K.jsx)(KA.Provider,{value:g,children:t})}function YA(){return new Map}function XA(){return new Set}function ZA(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var QA=v.createContext(void 0);function $A(){return v.useContext(QA)?.direction??`ltr`}var ej=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=mE(e,t)||{};if(l==null)return{};let f=ME(u),p={x:n,y:r},m=bE(i),h=vE(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=pE(k,j,A),N=!c.arrow&&gE(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),tj=(e,t)=>({...ej(e),options:[e,t]}),nj={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await _k().fn(e)).data?.referenceHidden||a}}}},rj={sideX:`left`,sideY:`top`};function ij(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function aj(e,t,n){let{rects:r,placement:i}=e;return{side:ij(t,hE(i),n),align:gE(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function oj(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,inline:f,keepMounted:p=!1,floatingRootContext:m,mounted:h,collisionAvoidance:g,shiftCrossAxis:_=!1,nodeId:y,adaptiveOrigin:b,lazyFlip:x=!1,externalTree:S}=e,[C,w]=v.useState(null);!h&&C!==null&&w(null);let T=g.side||`flip`,E=g.align||`flip`,D=g.fallbackAxisSide||`end`,O=typeof t==`function`?t:void 0,k=oS(O),A=O?k:t,j=Vw(t),M=Vw(h),N=$A()===`rtl`,P=C||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":N?`left`:`right`,"inline-start":N?`right`:`left`}[r],F=a===`center`?P:`${P}-${a}`,I=c,L=+(r===`bottom`),R=+(r===`top`),z=+(r===`right`),B=+(r===`left`);typeof I==`number`?I={top:I+L,right:I+B,bottom:I+R,left:I+z}:I&&={top:(I.top||0)+L,right:(I.right||0)+B,bottom:(I.bottom||0)+R,left:(I.left||0)+z};let V={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:I},H=v.useRef(null),U=Vw(i),W=Vw(o),G=typeof i==`function`?0:i,ee=typeof o==`function`?0:o,te=[];f&&te.push(f),te.push(fk(e=>{let t=aj(e,r,N),n=typeof U.current==`function`?U.current(t):U.current,i=typeof W.current==`function`?W.current(t):W.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[G,ee,N,r]));let ne=E===`none`&&T!==`shift`,re=!ne&&(l||_||T===`shift`),ie=T===`none`?null:hk({...V,padding:{top:I.top+1,right:I.right+1,bottom:I.bottom+1,left:I.left+1},mainAxis:!_&&T===`flip`,crossAxis:E===`flip`?`alignment`:!1,fallbackAxisSideDirection:D}),ae=ne?null:pk(e=>{let t=sT(e.elements.floating).documentElement;return{...V,rootBoundary:_?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:E!==`none`,crossAxis:re,limiter:l||_?void 0:mk(e=>{if(!H.current)return{};let{width:t,height:n}=H.current.getBoundingClientRect(),r=yE(hE(e.placement)),i=r===`y`?t:n,a=r===`y`?I.left+I.right:I.top+I.bottom;return{offset:i/2+a/2}})}},[V,l,_,I,E]);T===`shift`||E===`shift`||a===`center`?te.push(ae,ie):te.push(ie,ae),te.push(gk({...V,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!M.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=Mx(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),tj(e=>({element:H.current||sT(e.elements.floating).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=hE(a),l=yE(c),u=H.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(aj(e,r,N)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,re&&l===`y`&&b?S:x),{}}},nj,b),Y(()=>{!h&&m&&m.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[h,m]);let oe=v.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:se,elements:ce,x:le,y:ue,middlewareData:de,update:fe,placement:pe,context:me,isPositioned:he,floatingStyles:ge}=Ak({rootContext:m,open:p?h:void 0,placement:F,middleware:te,strategy:n,whileElementsMounted:p?void 0:(...e)=>QO(...e,oe),nodeId:y,externalTree:S}),{sideX:_e,sideY:ve}=de.adaptiveOrigin||rj,ye=he?n:`fixed`,be=v.useMemo(()=>{let e=b?{position:ye,[_e]:le,[ve]:ue}:{position:ye,...ge};return he||(e.opacity=0),e},[b,ye,_e,le,ve,ue,ge,he]),xe=v.useRef(null);Y(()=>{if(!h)return;let e=j.current,t=typeof e==`function`?e():e,n=(sj(t)?t.current:t)||null;n!==xe.current&&(se.setPositionReference(n),xe.current=n)},[h,se,A,j]),v.useEffect(()=>{if(!h)return;let e=j.current;typeof e!=`function`&&sj(e)&&e.current!==xe.current&&(se.setPositionReference(e.current),xe.current=e.current)},[h,se,A,j]),v.useEffect(()=>{if(p&&h&&ce.domReference&&ce.floating)return QO(ce.domReference,ce.floating,fe,oe)},[p,h,ce,fe,oe]);let Se=hE(pe),Ce=ij(r,Se,N),we=gE(pe)||`center`,Te=!!de.hide?.referenceHidden;Y(()=>{x&&h&&he&&w(Se)},[x,h,he,Se]);let Ee=v.useMemo(()=>({position:`absolute`,top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),De=de.arrow?.centerOffset!==0;return v.useMemo(()=>({positionerStyles:be,arrowStyles:Ee,arrowRef:H,arrowUncentered:De,side:Ce,align:we,physicalSide:Se,anchorHidden:Te,refs:se,context:me,isPositioned:he,update:fe}),[be,Ee,H,De,Ce,we,Se,Te,se,me,he,fe])}function sj(e){return e!=null&&`current`in e}var cj=v.createContext(void 0);function lj(){let e=v.useContext(cj);if(!e)throw Error(ES(59));return e}var uj=v.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,K.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function dj(e,t){e&&Object.assign(e.style,t)}var fj={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function pj(e){return e===`starting`?FD:WS}function mj(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),JS(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},pj(r),i],stateAttributesMapping:PA})}var hj={},gj={},_j=``;function vj(e){if(typeof document>`u`)return!1;let t=sT(e);return Mx(t).innerWidth-t.documentElement.clientWidth>0}function yj(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=sT(e),n=t.documentElement,r=t.body,i=Rx(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function bj(e){let t=sT(e),n=t.documentElement,r=t.body,i=Rx(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function xj(e){let t=sT(e),n=t.documentElement,r=t.body,i=Mx(n),a=0,o=0,s=!1,c=pT.create();if(ST&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,hj={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},_j=n.style.scrollBehavior,gj={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=Rx(n)?n:r;if(s=yj(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,hj),Object.assign(r.style,gj),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=_j)}function d(){u(),c.request(l)}l();let f=cT(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var Sj=new class{lockCount=0;restore=null;timeoutLock=gT.create();timeoutUnlock=gT.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=sT(e).documentElement,n=Mx(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=HS;return}let r=CT||!vj(e);this.restore=r?bj(e):xj(e)}};function Cj(e=!0,t=null){Y(()=>{if(e)return Sj.acquire(t)},[e,t])}var wj=20;function Tj(e,t,n,r){let[i,a]=v.useState(!1);Y(()=>{if(!e||!t||n==null){a(!1);return}let r=sT(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-wj)},[e,t,n]),Cj(e&&(!t||i),r)}var Ej={position:`fixed`},Dj=v.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=ID,style:_,...y}=e,{store:b,listRef:x,labelsRef:S,alignItemWithTriggerActiveRef:C,selectedItemTextRef:w,valuesRef:T,initialValueRef:E,popupRef:D,setValue:O}=Vk(),k=Hk(),A=Q(b,$.open),j=Q(b,$.mounted),M=Q(b,$.modal),N=Q(b,$.value),P=Q(b,$.openMethod),F=Q(b,$.positionerElement),I=Q(b,$.triggerElement),L=Q(b,$.isItemEqualToValue),R=Q(b,$.transitionStatus),z=v.useRef(null),B=v.useRef(null),[V,H]=v.useState(h),U=j&&V&&P!==`touch`;!j&&V!==h&&H(h),Y(()=>{j||($.scrollUpArrowVisible(b.state)&&b.set(`scrollUpArrowVisible`,!1),$.scrollDownArrowVisible(b.state)&&b.set(`scrollDownArrowVisible`,!1))},[b,j]),v.useImperativeHandle(C,()=>U),Tj((U||M)&&A,P===`touch`,F,I);let W=oj({anchor:n,floatingRootContext:k,positionMethod:r,mounted:j,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??U,collisionAvoidance:g,keepMounted:!0}),G=U?`none`:W.side,ee=U?Ej:W.positionerStyles,te={open:A,side:G,align:W.align,anchorHidden:W.anchorHidden};Y(()=>{b.set(`popupSide`,W.side)},[b,W.side]);let ne=mj(e,te,{styles:ee,transitionStatus:R,props:y,refs:[t,oS(e=>{b.set(`positionerElement`,e)})],hidden:!j,inert:!A}),re=v.useRef(0),ie=oS(e=>{if(e.size===0&&re.current===0||T.current.length===0)return;let t=re.current;if(re.current=e.size,e.size===t)return;let n=iE(YT);if(t!==0&&!b.state.multiple&&N!==null&&aA(T.current,N,L)===-1){let e=E.current,t=e!=null&&aA(T.current,e,L)!==-1?e:null;O(t,n),t===null&&(b.set(`selectedIndex`,null),w.current=null)}if(t!==0&&b.state.multiple&&Array.isArray(N)){let e=e=>aA(T.current,e,L)!==-1,t=N.filter(t=>e(t));(t.length!==N.length||t.some(e=>!iA(N,e,L)))&&(O(t,n),t.length===0&&(b.set(`selectedIndex`,null),w.current=null))}if(A&&U){b.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};dj(F,e),dj(D.current,e)}}),ae=v.useMemo(()=>({...W,side:G,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:H,scrollUpArrowRef:z,scrollDownArrowRef:B}),[W,G,U,H]);return(0,K.jsx)(JA,{elementsRef:x,labelsRef:S,onMapChange:ie,children:(0,K.jsxs)(cj.Provider,{value:ae,children:[j&&M&&(0,K.jsx)(uj,{inert:GA(!A),cutout:I}),ne]})})}),Oj=`base-ui-disable-scrollbar`,kj={className:Oj,getElement(e){return(0,K.jsx)(`style`,{nonce:e,href:Oj,precedence:`base-ui:low`,children:`.${Oj}{scrollbar-width:none}.${Oj}::-webkit-scrollbar{display:none}`})}},Aj=v.createContext(void 0);function jj(e){let t=v.useContext(Aj);if(t===void 0&&!e)throw Error(ES(69));return t}var Mj=`ArrowUp`,Nj=`ArrowDown`,Pj=`ArrowLeft`,Fj=`ArrowRight`,Ij=`Home`,Lj=new Set([Pj,Fj]),Rj=new Set([Mj,Nj]),zj=new Set([...Lj,...Rj]),Bj=new Set([...zj,Ij,`End`]),Vj=v.createContext(void 0),Hj={disableStyleElements:!1};function Uj(){return v.useContext(Vj)??Hj}var Wj={...PA,...wk},Gj=v.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,firstItemTextRef:f,selectedItemTextRef:p,keyboardActiveRef:m,multiple:h,handleScrollArrowVisibility:g,scrollHandlerRef:_,listRef:y,highlightItemOnHover:b}=Vk(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=lj(),O=jj(!0)!=null,k=Hk(),A=$A(),{nonce:j,disableStyleElements:M}=Uj(),N=Q(s,$.id),P=Q(s,$.open),F=Q(s,$.mounted),I=Q(s,$.popupProps),L=Q(s,$.transitionStatus),R=Q(s,$.triggerElement),z=Q(s,$.positionerElement),B=Q(s,$.listElement),V=v.useRef(!1),H=v.useRef(!1),U=v.useRef({}),W=mT(),G=oS(e=>{if(!z||!c.current||!H.current)return;if(V.current||!C){g();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(!t&&!n){g();return}let r=Jj(z),i=Yj(z.getBoundingClientRect().height,`y`,r),a=sT(z),o=getComputedStyle(z),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=Kj(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=qj(e),m=0,h=null,_=!1,v=!1,y=e=>{z.style.height=`${e}px`},b=(t,n)=>{let r=bA(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(V.current=!0),g()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:h=0:(_=!0,n&&f<p&&(h=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||h!=null){let t=qj(e),n=v?t:bA(h,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(V.current=!0),g()});v.useImperativeHandle(_,()=>G,[G]),Ek({open:P,ref:c,onComplete(){P&&l?.(!0)}});let ee={open:P,transitionStatus:L,side:x,align:S};Y(()=>{!z||!c.current||Object.keys(U.current).length||(U.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),Y(()=>{P||C||(H.current=!1,V.current=!1,dj(z,U.current))},[P,C,z,c]),Y(()=>{let e=c.current;if(!P||!R||!z||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){H.current=!0,W.request(g),e.style.removeProperty(`--transform-origin`);return}let t=Qj(e);e.style.removeProperty(`--transform-origin`);try{let t=p.current;t?.isConnected||(t=!$.hasSelectedValue(s.state)&&f.current?.isConnected?f.current:null);let n=d.current,r=getComputedStyle(z),i=getComputedStyle(e),a=sT(R),o=Mx(z),c=Jj(R),l=Xj(R.getBoundingClientRect(),c),u=Xj(z.getBoundingClientRect(),c),m=l.height,h=B||e,_=h.scrollHeight,v=parseFloat(i.borderBottomWidth),x=parseFloat(r.marginTop)||10,S=parseFloat(r.marginBottom)||10,C=parseFloat(r.minHeight)||100,w=Kj(i),E=a.documentElement.clientHeight-x-S,D=a.documentElement.clientWidth,O=E-l.bottom+m,k,j=A===`rtl`?l.right-u.width:l.left,M=0;if(t&&n){let e=Xj(n.getBoundingClientRect(),c);k=Xj(t.getBoundingClientRect(),c),j=u.left+(A===`rtl`?e.right-k.right:e.left-k.left);let r=e.top-l.top+e.height/2;M=k.top-u.top+k.height/2-r}let N=O+M+S+v,P=Math.min(E,N),F=E-x-S,I=N-P,L=D-5;z.style.left=`${bA(j,5,L-u.width)}px`,z.style.height=`${P}px`,z.style.maxHeight=`auto`,z.style.marginTop=`${x}px`,z.style.marginBottom=`${S}px`,e.style.height=`100%`;let W=qj(h),G=I>=W-1;G&&(P=Math.min(E,u.height)-(I-W));let ee=l.top<20||l.bottom>E-20||Math.ceil(P)+1<Math.min(_,C),te=(o.visualViewport?.scale??1)!==1&&ST;if(ee||te){H.current=!0,dj(z,U.current),T(!1);return}let ne=Math.max(C,P);if(G){let e=Math.max(0,E-N);z.style.top=u.height>=F?`0`:`${e}px`,z.style.height=`${P}px`,h.scrollTop=qj(h)}else z.style.bottom=`0`,h.scrollTop=I;if(k){let t=u.top,n=u.height,r=k.top+k.height/2,i=bA(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ne===E||P>=w)&&(V.current=!0),g(),b&&s.state.selectedIndex===null&&s.state.activeIndex===null&&y.current[0]!=null&&s.set(`activeIndex`,0),H.current=!0}finally{t()}},[s,P,z,R,d,f,p,c,g,C,T,W,E,D,B,y,b,A,w]),v.useEffect(()=>{if(!C||!z||!P)return;let e=Mx(z);function t(e){u(!1,iE(rE,e))}return cT(e,`resize`,t)},[u,C,z,P]);let te={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":h||void 0,id:`${N}-list`},onKeyDown(e){m.current=!0,O&&Bj.has(e.key)&&e.stopPropagation()},onMouseMove(){m.current=!1},onScroll(e){B||G(e.currentTarget)},...C&&{style:B?{height:`100%`}:fj}},ne=JS(`div`,e,{ref:[t,c],state:ee,stateAttributesMapping:Wj,props:[I,te,pj(L),{className:!B&&C?kj.className:void 0},o]});return(0,K.jsxs)(v.Fragment,{children:[!M&&kj.getElement(j),(0,K.jsx)(rO,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ne})]})});function Kj(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function qj(e){return xA(e.scrollHeight,e.clientHeight)}function Jj(e){return YO.getScale(e)}function Yj(e,t,n){return e/n[t]}function Xj(e,t){return NE({x:Yj(e.x,`x`,t),y:Yj(e.y,`y`,t),width:Yj(e.width,`x`,t),height:Yj(e.height,`y`,t)})}var Zj=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Qj(e){let{style:t}=e,n={};for(let[e,r]of Zj)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Zj){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var $j=v.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=Vk(),{alignItemWithTriggerActive:c}=lj(),l=Q(o,$.hasScrollArrows),u=Q(o,$.openMethod),d=Q(o,$.multiple),f={id:`${Q(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:fj},className:l&&u!==`touch`?kj.className:void 0};return JS(`div`,e,{ref:[t,oS(e=>{o.set(`listElement`,e)})],props:[f,a]})}),eM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function tM(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=qA(),f=v.useRef(-1),[p,m]=v.useState(a??(i===eM.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=v.useRef(null),g=v.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Y(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Y(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),v.useMemo(()=>({ref:g,index:p}),[p,g])}var nM=v.createContext(void 0);function rM(){let e=v.useContext(nM);if(!e)throw Error(ES(57));return e}var iM=v.memo(v.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,label:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=v.useRef(null),d=tM({label:o,textRef:u,indexGuessBehavior:eM.GuessFromOrder}),{store:f,itemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:y,multiple:b,selectedItemTextRef:x}=Vk(),S=Q(f,$.isActive,d.index),C=Q(f,$.isSelected,d.index,a),w=Q(f,$.isSelectedByFocus,d.index),T=Q(f,$.isItemEqualToValue),E=d.index,D=E!==-1,O=v.useRef(null);Y(()=>{if(!D)return;let e=y.current;return e[E]=a,()=>{delete e[E]}},[D,E,a,y]),Y(()=>{if(!D)return;let e=f.state.value,t=e;b&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&rA(a,t,T)&&(f.set(`selectedIndex`,E),u.current&&(x.current=u.current))},[D,E,b,T,f,a,x]);let k=v.useRef(null),A=v.useRef(`mouse`),j=v.useRef(!1),{getButtonProps:M,buttonRef:N}=AS({disabled:s,focusableWhenDisabled:!0,native:c,composite:!0}),P={disabled:s,selected:C,highlighted:S};function F(e){let t=f.state.value;if(b){let n=Array.isArray(t)?t:[];h(C?oA(n,a,T):[...n,a],iE(QT,e))}else h(a,iE(QT,e)),m(!1,iE(QT,e))}function I(){g.current.dragY=0}let L={role:`option`,"aria-selected":C,tabIndex:S?0:-1,onKeyDown(e){k.current=e.key,f.set(`activeIndex`,E),e.key===` `&&_.current&&e.preventDefault()},onClick(e){let t=e.type===`click`&&A.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&MT(e.nativeEvent)&&(n!==void 0||S),i=t&&!r&&!j.current;j.current=!1,!(e.type===`keydown`&&k.current===null)&&(s||e.type===`keydown`&&k.current===` `&&_.current||i||(k.current=null,F(e.nativeEvent)))},onPointerEnter(e){A.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=g.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){A.current=e.pointerType,j.current=!0,I()},onMouseUp(){if(I(),s||A.current===`touch`||j.current)return;let e=!g.current.allowSelectedMouseUp&&C,t=!g.current.allowUnselectedMouseUp&&!C;e||t||(j.current=!0,O.current?.click(),j.current=!1)}},R=JS(`div`,e,{ref:[N,t,d.ref,O],state:P,props:[p,L,l,M]}),z=v.useMemo(()=>({selected:C,index:E,textRef:u,selectedByFocus:w,hasRegistered:D}),[C,E,u,w,D]);return(0,K.jsx)(nM.Provider,{value:z,children:R})})),aM=v.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=rM();return n||r?(0,K.jsx)(oM,{...e,ref:t}):null}),oM=v.memo(v.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=rM(),c=v.useRef(null),{transitionStatus:l,setMounted:u}=bk(s),d=JS(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:wk});return Ek({open:s,ref:c,onComplete(){s||u(!1)}}),d})),sM=v.memo(v.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i,hasRegistered:a}=rM(),{firstItemTextRef:o,selectedItemTextRef:s}=Vk(),{render:c,className:l,style:u,...d}=e;return JS(`div`,e,{ref:[v.useCallback(e=>{e&&(a&&n===0&&(o.current=e),a&&i&&(s.current=e))},[o,s,n,i,a]),t,r],props:d})})),cM=v.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=Vk(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=lj(),_=Q(l,c?$.scrollUpArrowVisible:$.scrollDownArrowVisible),v=Q(l,$.openMethod),y=_&&v!==`touch`,b=_T(),x=c?g:h,{transitionStatus:S,setMounted:C}=bk(y);Y(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),Ek({open:y,ref:x,onComplete(){y||C(!1)}});let w=JS(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=xA(e.scrollHeight,e.clientHeight),r=SA(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=lM(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function lM(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?SA(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?SA(l.offsetTop+l.offsetHeight-r+i,a):a}var uM=v.forwardRef(function(e,t){return(0,K.jsx)(cM,{...e,ref:t,direction:`down`})}),dM=v.forwardRef(function(e,t){return(0,K.jsx)(cM,{...e,ref:t,direction:`up`})}),fM=CA;function pM({className:e,...t}){return(0,K.jsx)(VA,{"data-slot":`select-value`,className:Mw(`flex flex-1 text-left`,e),...t})}function mM({className:e,size:t=`default`,children:n,...r}){return(0,K.jsxs)(zA,{"data-slot":`select-trigger`,"data-size":t,className:Mw(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,K.jsx)(HA,{render:(0,K.jsx)(Ps,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function hM({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`center`,alignOffset:a=0,alignItemWithTrigger:o=!0,...s}){return(0,K.jsx)(WA,{children:(0,K.jsx)(Dj,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,K.jsxs)(Gj,{"data-slot":`select-content`,"data-align-trigger":o,className:Mw(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...s,children:[(0,K.jsx)(_M,{}),(0,K.jsx)($j,{children:t}),(0,K.jsx)(vM,{})]})})})}function gM({className:e,children:t,...n}){return(0,K.jsxs)(iM,{"data-slot":`select-item`,className:Mw(`relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,K.jsx)(sM,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,K.jsx)(aM,{render:(0,K.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,K.jsx)(Ns,{className:`pointer-events-none`})})]})}function _M({className:e,...t}){return(0,K.jsx)(dM,{"data-slot":`select-scroll-up-button`,className:Mw(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,K.jsx)(Ls,{})})}function vM({className:e,...t}){return(0,K.jsx)(uM,{"data-slot":`select-scroll-down-button`,className:Mw(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,K.jsx)(Ps,{})})}function yM({path:e,name:t,depth:n,expandedPaths:r,selectedPath:i,onToggle:a,onSelect:o}){let s=r.has(e),c=i===e,l=(0,v.useRef)(null);(0,v.useEffect)(()=>{c&&l.current?.scrollIntoView({block:`nearest`})},[]);let{data:u,isLoading:d}=jo({queryKey:Po.kbBrowse(e),queryFn:()=>rm(e),enabled:s,staleTime:1e4}),f=u?.entries??[],p=8+n*16;return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:[`flex w-full items-center`,c?`bg-accent/10`:`hover:bg-surface-elevated/60`].join(` `),style:{paddingLeft:p},children:[(0,K.jsx)(`button`,{type:`button`,tabIndex:-1,onClick:()=>a(e),"aria-expanded":s,"aria-label":s?`Collapse`:`Expand`,className:`flex w-6 shrink-0 items-center justify-center py-1.5 text-text-subtle hover:text-text focus-visible:outline-none`,children:s?(0,K.jsx)(Ps,{className:`h-3 w-3 opacity-60`}):(0,K.jsx)(Is,{className:`h-3 w-3 opacity-50`})}),(0,K.jsxs)(`button`,{ref:l,type:`button`,"data-dir-tree-row":!0,"data-path":e,onClick:()=>o(e),className:[`flex min-w-0 flex-1 items-center gap-1.5 py-1.5 pr-3 text-left font-sans text-[13px] transition-colors`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-accent/50`,c?`text-accent`:`text-text`].join(` `),children:[s?(0,K.jsx)(Hs,{className:`h-3.5 w-3.5 shrink-0 ${c?`text-accent/70`:`text-text-muted`}`}):(0,K.jsx)(Vs,{className:`h-3.5 w-3.5 shrink-0 ${c?`text-accent/70`:`text-text-subtle`}`}),(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),d&&(0,K.jsx)(Gs,{className:`h-3 w-3 shrink-0 animate-spin text-text-subtle`})]})]}),s&&!d&&f.length===0&&u&&(0,K.jsx)(`div`,{className:`py-1 font-serif italic text-[12px] text-text-subtle`,style:{paddingLeft:p+36},children:`No subdirectories`}),s&&f.map(e=>(0,K.jsx)(yM,{path:e.path,name:e.name,depth:n+1,expandedPaths:r,selectedPath:i,onToggle:a,onSelect:o},e.path))]})}function bM({startPath:e,onChoose:t,onCancel:n,confirmLabel:r=`Choose`,confirmDisabled:i}){let[a,o]=(0,v.useState)(new Set),[s,c]=(0,v.useState)(e??``),l=(0,v.useRef)(null),{data:u,isLoading:d,error:f}=jo({queryKey:Po.kbBrowse(``),queryFn:()=>rm(void 0),staleTime:1e4}),p=u?.path??``,m=u?.entries??[],h=(0,v.useRef)(!1);(0,v.useEffect)(()=>{if(h.current||!p||!e||(h.current=!0,!e.startsWith(p)))return;let t=e.slice(p.length).split(`/`).filter(Boolean);if(t.length<=1)return;let n=new Set;for(let e=0;e<t.length-1;e++)n.add(p+`/`+t.slice(0,e+1).join(`/`));setTimeout(()=>o(n),0)},[p,e]);function g(e){o(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}let _=(p&&s.startsWith(p)?s.slice(p.length):s).split(`/`).filter(Boolean).map((e,t,n)=>({label:e,path:p+`/`+n.slice(0,t+1).join(`/`)})),y=(0,v.useCallback)(e=>{if(!l.current)return;let t=Array.from(l.current.querySelectorAll(`[data-dir-tree-row]`));if(!t.length)return;let n=l.current.querySelector(`[data-dir-tree-row]:focus`),r=n?t.indexOf(n):-1;if(e.key===`ArrowDown`)e.preventDefault(),t[r<0?0:Math.min(t.length-1,r+1)]?.focus();else if(e.key===`ArrowUp`)e.preventDefault(),t[Math.max(0,r<=0?0:r-1)]?.focus();else if(e.key===`ArrowRight`&&n){e.preventDefault();let t=n.dataset.path;t&&!a.has(t)&&o(e=>new Set([...e,t]))}else if(e.key===`ArrowLeft`&&n){e.preventDefault();let t=n.dataset.path;t&&a.has(t)&&o(e=>{let n=new Set(e);return n.delete(t),n})}else if(e.key===`Enter`&&n){e.preventDefault();let t=n.dataset.path;t&&c(t)}},[a]);return(0,K.jsxs)(`div`,{className:`flex flex-col`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex min-h-[24px] items-center gap-0.5 overflow-x-auto pb-0.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>{o(new Set),c(``)},className:`shrink-0 font-mono text-[11px] text-text-muted hover:text-text`,title:`Home`,children:`~`}),_.map((e,t)=>(0,K.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,K.jsx)(Is,{className:`h-2.5 w-2.5 text-text-subtle`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>c(e.path),className:[`font-mono text-[11px] hover:text-text`,t===_.length-1?`font-semibold text-text`:`text-text-muted`].join(` `),children:e.label})]},e.path))]}),(0,K.jsxs)(`div`,{ref:l,onKeyDown:y,className:`h-[360px] overflow-y-auto rounded-sm border border-border bg-surface py-1`,children:[d&&(0,K.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,K.jsx)(Gs,{className:`h-4 w-4 animate-spin text-text-subtle`})}),f&&(0,K.jsx)(`div`,{className:`px-4 py-3 font-sans text-[12px] text-health-error`,children:f instanceof Error?f.message:`Error loading directory`}),!d&&!f&&m.length===0&&(0,K.jsx)(`div`,{className:`px-4 py-8 text-center font-serif italic text-[13px] text-text-subtle`,children:`No subdirectories`}),m.map(e=>(0,K.jsx)(yM,{path:e.path,name:e.name,depth:0,expandedPaths:a,selectedPath:s,onToggle:g,onSelect:c},e.path))]}),(0,K.jsxs)(`div`,{className:`mt-3 flex items-center justify-end gap-2 border-t border-border-soft pt-3`,children:[(0,K.jsx)(Pw,{type:`button`,variant:`ghost`,onClick:n,children:`Cancel`}),(0,K.jsx)(Pw,{type:`button`,onClick:()=>t(s),disabled:!s||i,children:r})]})]})}var xM={missing_token:``,wrong_token_type:``,unknown_token_type:"This doesn't look like a Slack token. Bot tokens start with `xoxb-`, app-level tokens with `xapp-`.",invalid_token:`Slack didn't recognize this token. Check you copied the whole thing and the app is still installed.`,missing_connections_write:"Slack says this App-Level Token is missing `connections:write`. In App-Level Tokens, regenerate it with that scope checked.",not_bot_token:"Slack says this is not the Bot User OAuth Token. Copy Bot User OAuth Token from OAuth & Permissions — it starts with `xoxb-`.",slack_api_error:`Couldn't reach Slack to check this token. Try again in a moment.`},SM=`These two tokens are from different Slack apps. Make sure both came from the same app you just created.`;function CM(e){return e.valid?{status:`verified`,result:e}:{status:`failed`,result:e}}function wM(e,t){return!e.reason||e.reason===`missing_token`?``:e.reason===`wrong_token_type`?t===`app`?"That’s a Bot token (`xoxb-…`). The App-Level Token goes here — it starts with `xapp-`.":"That’s an App-Level Token (`xapp-…`). The Bot User OAuth Token goes here — it starts with `xoxb-`.":xM[e.reason]||`Validation failed.`}function TM({n:e,done:t,active:n,onClick:r}){return(0,K.jsx)(`span`,{onClick:r,title:r?`Go back to this step`:void 0,className:[`font-sans mt-px flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[11px] font-semibold transition-opacity`,t?`border-health-ok bg-health-ok-soft text-health-ok`:n?`border-health-warn/50 text-health-warn`:`border-border text-text-subtle`,r?`cursor-pointer hover:opacity-60`:``].join(` `),children:t?(0,K.jsx)(Ns,{className:`h-3.5 w-3.5`}):e})}function EM({state:e,field:t}){if(e.status===`idle`)return null;if(e.status===`pending`)return(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 font-sans text-[12px] text-text-muted`,children:[(0,K.jsx)(Gs,{className:`h-3.5 w-3.5 animate-spin`}),(0,K.jsx)(`span`,{children:`Checking with Slack…`})]});if(e.status===`verified`){let n=t===`bot`&&e.result.botName?`@${e.result.botName}${e.result.workspaceName?` · ${e.result.workspaceName}`:``}`:e.result.workspaceName??`Verified`;return(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 font-sans text-[12px] text-health-ok`,children:[(0,K.jsx)(Ns,{className:`h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:n})]})}return(0,K.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-1.5 font-sans text-[12px] text-health-error`,children:[(0,K.jsx)(nc,{className:`mt-px h-3.5 w-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:wM(e.result,t)})]})}function DM({conn:e}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 rounded-sm border border-health-ok/30 bg-health-ok-soft px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:[e.workspaceIconUrl&&(0,K.jsx)(`img`,{src:e.workspaceIconUrl,alt:``,className:`h-5 w-5 shrink-0 rounded-sm object-cover`}),(0,K.jsxs)(`span`,{className:`font-serif text-[13px] text-text`,children:[`Connected to `,(0,K.jsx)(`strong`,{children:e.workspaceName??`your workspace`}),e.botName?(0,K.jsxs)(K.Fragment,{children:[` `,`as`,` `,e.botAvatarUrl&&(0,K.jsx)(`img`,{src:e.botAvatarUrl,alt:``,className:`mx-0.5 inline h-4 w-4 rounded-full object-cover align-middle`}),(0,K.jsxs)(`strong`,{children:[`@`,e.botName]})]}):null]})]}),(0,K.jsx)(Ns,{className:`h-4 w-4 shrink-0 text-health-ok`})]})}function OM({agentId:e,onConnect:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(``),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)({status:`idle`}),[u,d]=(0,v.useState)({status:`idle`}),[f,p]=(0,v.useState)(null),[m,h]=(0,v.useState)(!1),[g,_]=(0,v.useState)(),[y,b]=(0,v.useState)(!1),x=(0,v.useRef)(null),S=c.status===`verified`,C=u.status===`verified`,w=n,T=S,E=n&&T,D=C,O=(0,v.useCallback)(async t=>{if(t.trim()){l({status:`pending`}),p(null);try{let n=await Wo(e,{appToken:t.trim()});n.app&&l(CM(n.app))}catch{l({status:`failed`,result:{valid:!1,expected:`app`,reason:`slack_api_error`}})}}},[e]),k=(0,v.useCallback)(async t=>{if(t.trim()){d({status:`pending`}),p(null);try{let n=await Wo(e,{botToken:t.trim()});n.bot&&d(CM(n.bot))}catch{d({status:`failed`,result:{valid:!1,expected:`bot`,reason:`slack_api_error`}})}}},[e]);async function A(){if(!(m||y)){h(!0),_(void 0);try{await Go(e,{appToken:i.trim(),botToken:o.trim()}),b(!0),es(),t?.()}catch(e){_(e instanceof Error?e.message:`Connection failed`),p(null)}finally{h(!1)}}}async function j(){try{let t=await Wo(e,{appToken:i.trim(),botToken:o.trim()});t.connection.valid?(p(t.connection),A()):t.connection.reason===`app_mismatch`?(_(SM),l({status:`idle`}),d({status:`idle`}),p(null)):t.connection.reason===`incomplete`||_(`Could not connect — try again.`)}catch{_(`Could not reach Slack to validate the token pair.`)}}(0,v.useEffect)(()=>{S&&C&&!m&&!y&&setTimeout(()=>void j(),0)},[S,C]);function M(e){x.current&&clearTimeout(x.current);let t=e.trim();if(t.length<=20)return;let n=t.startsWith(`xoxb-`)?300:600;x.current=setTimeout(()=>void O(t),n)}function N(e){x.current&&clearTimeout(x.current);let t=e.trim();if(t.length<=20)return;let n=t.startsWith(`xapp-`)?300:600;x.current=setTimeout(()=>void k(t),n)}function P(e){a(e),l({status:`idle`}),p(null),_(void 0),M(e)}function F(e){s(e),d({status:`idle`}),p(null),_(void 0),N(e)}function I(){window.open(`/api/agents/${encodeURIComponent(e)}/slack/install`,`_blank`,`noopener,noreferrer`),r(!0)}return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(TM,{n:1,done:n,active:!0,onClick:n?()=>{r(!1),a(``),s(``),l({status:`idle`}),d({status:`idle`}),b(!1),_(void 0),p(null)}:void 0}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Create & install the Slack app`}),(0,K.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[(0,K.jsx)(`button`,{onClick:I,className:`font-serif text-[13px] text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`,children:`Create app in Slack`}),` `,`→ pick your workspace → click `,(0,K.jsx)(`strong`,{children:`Install`}),`.`,` `,`Anima fills in the manifest; reusing an older app only works if Interactivity is enabled.`]}),!n&&(0,K.jsx)(`button`,{onClick:()=>r(!0),className:`mt-1.5 font-sans text-[11px] text-text-subtle underline decoration-text-subtle/40 underline-offset-2 hover:text-text-muted hover:decoration-text-muted/40`,children:`I already created the app`})]})]}),(0,K.jsxs)(`div`,{className:[`flex gap-3`,w?``:`pointer-events-none opacity-40`].join(` `),children:[(0,K.jsx)(TM,{n:2,done:T,active:w,onClick:T?()=>{a(``),l({status:`idle`}),b(!1),_(void 0),p(null)}:void 0}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Paste App-Level Token`}),(0,K.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[`In Slack: Basic Information → App-Level Tokens → Generate. Add scope`,` `,(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:`connections:write`}),`, then paste the`,` `,(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:`xapp-…`}),` token here.`]}),w&&(0,K.jsxs)(`div`,{className:`mt-2`,children:[(0,K.jsx)(`input`,{"aria-label":`App-Level Token`,autoComplete:`off`,type:`text`,value:i,onChange:e=>P(e.target.value),onBlur:()=>{let e=i.trim();e.length>20&&c.status===`idle`&&O(e)},placeholder:`xapp-…`,disabled:S||m,spellCheck:!1,className:[`w-full rounded-sm border bg-muted/30 px-3 py-1.5 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-ring`,c.status===`verified`?`border-health-ok/50`:c.status===`failed`?`border-health-error/50`:`border-border`].join(` `)}),(0,K.jsx)(EM,{state:c,field:`app`})]})]})]}),(0,K.jsxs)(`div`,{className:[`flex gap-3`,E?``:`pointer-events-none opacity-40`].join(` `),children:[(0,K.jsx)(TM,{n:3,done:D,active:E,onClick:D?()=>{s(``),d({status:`idle`}),b(!1),_(void 0),p(null)}:void 0}),(0,K.jsxs)(`div`,{className:`flex-1`,children:[(0,K.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Paste Bot User OAuth Token`}),(0,K.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[`In Slack: OAuth & Permissions → Install to Workspace. Copy`,` `,(0,K.jsx)(`strong`,{children:`Bot User OAuth Token`}),` and paste the`,` `,(0,K.jsx)(`span`,{className:`font-mono text-[11px]`,children:`xoxb-…`}),` token here.`]}),E&&(0,K.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`input`,{"aria-label":`Bot User OAuth Token`,autoComplete:`off`,type:`text`,value:o,onChange:e=>F(e.target.value),onBlur:()=>{let e=o.trim();e.length>20&&u.status===`idle`&&k(e)},placeholder:`xoxb-…`,disabled:C||m,spellCheck:!1,className:[`w-full rounded-sm border bg-muted/30 px-3 py-1.5 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-ring`,u.status===`verified`?`border-health-ok/50`:u.status===`failed`?`border-health-error/50`:`border-border`].join(` `)}),(0,K.jsx)(EM,{state:u,field:`bot`})]}),m&&(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 font-sans text-[12px] text-text-muted`,children:[(0,K.jsx)(Gs,{className:`h-3.5 w-3.5 animate-spin`}),(0,K.jsx)(`span`,{children:`Connecting…`})]}),g&&(0,K.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,K.jsx)(nc,{className:`mt-px h-3.5 w-3.5 shrink-0 text-health-error`}),(0,K.jsx)(`span`,{className:`font-sans text-[12px] text-health-error`,children:g})]})]})]})]}),f?.valid&&(0,K.jsx)(DM,{conn:f})]})}function kM(){return(0,K.jsx)(`p`,{className:`font-sans text-[13px] leading-relaxed text-text-muted`,children:`The owner is the person this agent answers to. The agent introduces itself to them and checks in — it's how it knows who it's working for.`})}function AM({agentId:e,onConfirm:t,onSkip:n,submitLabel:r=`Assign owner →`,skipLabel:i=`Skip for now →`,autoFocus:a=!0,showRationale:o=!1}){let s=(0,v.useId)(),c=`${s}-listbox`,l=e=>`${s}-option-${e}`,[u,d]=(0,v.useState)([]),[f,p]=(0,v.useState)(!0),[m,h]=(0,v.useState)(),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(-1),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(!0),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(!1),[j,M]=(0,v.useState)(),N=(0,v.useRef)(null),P=(0,v.useRef)(null),F=(0,v.useRef)(null);(0,v.useEffect)(()=>{let t=!1;return Jo(e).then(e=>{t||(d(e),p(!1))}).catch(e=>{t||(h(e instanceof Error?e.message:`Could not load Slack members`),p(!1))}),()=>{t=!0}},[e]),(0,v.useEffect)(()=>{function e(e){N.current&&!N.current.contains(e.target)&&b(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,v.useEffect)(()=>{a&&!f&&setTimeout(()=>P.current?.focus(),50)},[a,f]);let I=u.find(e=>e.slackUserId===C),L=g.trim()?u.filter(e=>{let t=g.trim().toLowerCase();return e.displayName.toLowerCase().includes(t)||e.handle&&e.handle.toLowerCase().includes(t)}):u,R=y&&x>=0&&L[x]?l(L[x].slackUserId):void 0;(0,v.useEffect)(()=>{!y||x<0||document.getElementById(l(L[x]?.slackUserId??``))?.scrollIntoView({block:`nearest`})},[x,y]);function z(e){let t=e.target.value;_(t),b(!0),S(0),C&&t!==(I?.displayName??``)&&(w(``),M(void 0))}function B(){b(!0),C&&_(``)}function V(){I&&!y&&_(I.displayName)}function H(e){w(e.slackUserId),_(e.displayName),b(!1),S(-1),M(void 0)}function U(e){if(!y){e.key===`ArrowDown`&&(b(!0),S(0),e.preventDefault());return}if(e.key===`Escape`)b(!1),S(-1),I&&_(I.displayName),e.preventDefault();else if(e.key===`ArrowDown`)S(e=>Math.min(e+1,L.length-1)),e.preventDefault();else if(e.key===`ArrowUp`)S(e=>Math.max(e-1,0)),e.preventDefault();else if(e.key===`Home`)S(0),e.preventDefault();else if(e.key===`End`)S(Math.max(L.length-1,0)),e.preventDefault();else if(e.key===`Enter`){e.preventDefault();let t=x>=0?L[x]:L[0];t&&H(t)}}async function W(){if(!(!C||k)){A(!0),M(void 0);try{await Yo(e,{slackUserId:C,introduce:T,...T&&D.trim()?{openerNote:D.trim()}:{}}),es(),t()}catch(e){M(e instanceof Error?e.message:`Could not assign owner`)}finally{A(!1)}}}return f?(0,K.jsxs)(`div`,{className:`space-y-3`,children:[o&&(0,K.jsx)(kM,{}),(0,K.jsx)(`div`,{className:`font-sans text-[12px] text-text-muted`,children:`Loading Slack members…`})]}):m?(0,K.jsxs)(`div`,{className:`space-y-2`,children:[o&&(0,K.jsx)(kM,{}),(0,K.jsx)(`div`,{className:`font-sans text-[12px] text-health-error`,children:m}),(0,K.jsx)(Pw,{variant:`ghost`,size:`sm`,onClick:()=>{p(!0),h(void 0),Jo(e).then(e=>{d(e),p(!1)}).catch(e=>{h(e instanceof Error?e.message:`Could not load Slack members`),p(!1)})},children:`Retry`})]}):(0,K.jsxs)(`div`,{className:`space-y-3`,children:[o&&(0,K.jsx)(kM,{}),(0,K.jsxs)(`div`,{ref:N,className:`relative`,children:[(0,K.jsx)(`input`,{ref:P,role:`combobox`,"aria-expanded":y,"aria-controls":y?c:void 0,"aria-activedescendant":R,"aria-autocomplete":`list`,"aria-haspopup":`listbox`,type:`text`,value:g,onChange:z,onFocus:B,onBlur:V,onKeyDown:U,placeholder:I?I.displayName:`Search by name or handle…`,disabled:k,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-sans text-[13px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none disabled:opacity-50`}),I&&!y&&(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-2 flex items-center`,children:(0,K.jsx)(Ns,{className:`h-3.5 w-3.5 text-accent`})}),y&&(0,K.jsx)(`div`,{ref:F,id:c,role:`listbox`,"aria-label":`Slack members`,className:`absolute left-0 right-0 top-full z-50 mt-1 max-h-52 overflow-y-auto rounded-sm border border-border-soft bg-surface shadow-deep`,children:L.length===0?(0,K.jsx)(`div`,{role:`status`,className:`px-3 py-2 font-sans text-[12px] text-text-muted`,children:u.length===0?`No workspace members found.`:`No members match.`}):L.map((e,t)=>{let n=e.slackUserId===C,r=t===x;return(0,K.jsxs)(`div`,{id:l(e.slackUserId),role:`option`,"aria-selected":n,onMouseDown:t=>{t.preventDefault(),H(e)},onClick:()=>H(e),className:[`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors`,r?`bg-accent/10`:n?`bg-accent/5`:`hover:bg-surface-elevated`].join(` `),children:[e.avatarUrl?(0,K.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`h-6 w-6 shrink-0 rounded-sm object-cover`}):(0,K.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm bg-muted font-sans text-[10px] font-bold text-text-muted`,children:e.displayName.charAt(0).toUpperCase()}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate font-serif text-[14px] text-text`,children:e.displayName}),e.handle&&(0,K.jsxs)(`span`,{className:`font-sans text-[11px] text-text-muted`,children:[`@`,e.handle]})]}),n&&(0,K.jsx)(Ns,{className:`h-3.5 w-3.5 shrink-0 text-accent`})]},e.slackUserId)})})]}),(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:T,onChange:e=>E(e.target.checked),disabled:k,className:`h-4 w-4 accent-accent`}),(0,K.jsx)(`span`,{className:`font-sans text-[13px] text-text`,children:I?(0,K.jsxs)(K.Fragment,{children:[`Notify `,(0,K.jsx)(`span`,{className:`font-medium`,children:I.displayName}),` now`]}):`Notify the new owner now`})]}),(0,K.jsx)(`p`,{className:`font-sans pl-[26px] text-[11px] text-text-subtle`,children:`The agent will DM them to introduce itself.`})]}),T&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium text-text-muted`,children:[`What should the agent know before it reaches out to`,` `,I?I.displayName:`its owner`,`?`,` `,(0,K.jsx)(`span`,{className:`font-normal`,children:`(optional)`})]}),(0,K.jsx)(`textarea`,{value:D,onChange:e=>O(e.target.value),placeholder:I?`e.g. I set this agent up to help ${I.displayName} with code review and deploys.`:`e.g. I set this agent up to help them with code review and deploys.`,rows:3,className:`w-full resize-none rounded-sm border border-border-soft bg-surface px-3 py-2 font-sans text-[13px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none`}),(0,K.jsxs)(`p`,{className:`font-sans mt-1 text-[11px] text-text-subtle`,children:[`Used as context for the agent's first message —`,` `,I?`so ${I.displayName} knows who set it up and why.`:`so the owner knows who set it up and why.`]})]}),j&&(0,K.jsx)(`div`,{className:`font-sans text-[12px] text-health-error`,children:j}),(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(Pw,{className:`w-full`,onClick:()=>void W(),disabled:k||!C,children:k?`Assigning…`:r}),n&&(0,K.jsx)(`div`,{className:`text-center`,children:(0,K.jsx)(`button`,{type:`button`,onClick:n,disabled:k,className:`font-sans text-[12px] text-text-muted underline decoration-text-muted/40 underline-offset-2 hover:text-text hover:decoration-text/40 transition-colors`,children:i})})]})]})}var jM=s({AgentCreateFlow:()=>NM,AgentCreateModal:()=>FM,OnboardingPage:()=>PM});function MM({n:e,current:t,done:n,onClick:r}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{onClick:r,title:r?`Go back to this step`:void 0,className:[`font-sans flex h-6 w-6 items-center justify-center rounded-full border text-[11px] font-semibold transition-colors`,n?`border-health-ok bg-health-ok-soft text-health-ok`:e===t?`border-accent bg-accent/10 text-accent`:`border-border-soft text-text-subtle`,r?`cursor-pointer hover:opacity-60`:``].join(` `),children:e}),e<3&&(0,K.jsx)(`span`,{className:[`h-px w-8 transition-colors`,e<t?`bg-health-ok/40`:`bg-border-soft`].join(` `)})]})}function NM({firstRun:e,onClose:t,onComplete:n}){let r=typeof window<`u`?Number(new URLSearchParams(window.location.search).get(`_previewStep`)??0):0,[i,a]=(0,v.useState)((r===2?2:r===3?3:void 0)??1),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(ox),[m,h]=(0,v.useState)(ux().find(e=>e.kind===`claude-code`)?.defaultModel??``),[g,_]=(0,v.useState)(sx),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(null),[C,w]=(0,v.useState)(!1),[T,E]=(0,v.useState)(null),[D,O]=(0,v.useState)(null),[k,A]=(0,v.useState)(!1),j=(0,v.useRef)(null),{data:M,error:N}=jo({queryKey:Po.providerAvailability(),queryFn:bd}),P=(0,v.useMemo)(()=>ux(),[]),F=bx(o.trim()),I=e=>P.find(t=>t.kind===e)?.label??e,L=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),R=e=>e===`xhigh`?`Extra High`:e&&e.charAt(0).toUpperCase()+e.slice(1),z=P.find(e=>e.kind===f),B=Tx(z,M),V=Ox(z,M),H=kx(P,M),U=!M&&!N,W=F?_x(F,x??`~/anima-team/agents`):`${x??`~/anima-team/agents`}/<name>`;(0,v.useEffect)(()=>{if(!M||Tx(P.find(e=>e.kind===f),M))return;let e=Ex(P,M);e&&setTimeout(()=>{p(e.kind),h(e.defaultModel)},0)},[M,f,P]),(0,v.useEffect)(()=>{setTimeout(()=>j.current?.focus(),50)},[]);let G=(0,v.useCallback)(async()=>{T&&(es(),await ns().catch(()=>void 0)),t(T??void 0)},[T,t]);(0,v.useEffect)(()=>{function e(e){if(!(e.key!==`Escape`||k)){if(C){w(!1);return}G()}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[G,k,C]);function ee(e){p(e),h(P.find(t=>t.kind===e)?.defaultModel??``),_(sx)}async function te(){if(l(!0),!F||!u.trim()||!B)return;if(A(!0),O(null),T){try{await Bo(T,{displayName:o.trim(),role:u.trim()}),es(),a(2)}catch(e){O(e instanceof Error?e.message:`Failed to update agent`)}finally{A(!1)}return}let e={kind:f,model:m,...(z?.reasoningEfforts??[]).length>0?{reasoningEffort:g}:{}};try{E((await Ro({name:o.trim(),role:u.trim(),homePath:W,provider:e})).id),a(2)}catch(e){O(e instanceof Error?e.message:`Failed to create agent`)}finally{A(!1)}}async function ne(){await ns(),a(3)}function re(){T&&n?.(T)}let ie=i===1?`Create your agent`:i===2?`Connect to Slack`:`Pick an owner`,ae=(()=>{if(!k){if(!F)return`Enter a name`;if(!u.trim())return`Enter a role`;if(N)return`Provider check failed`;if(U)return`Checking providers...`;if(!B)return`Install a provider first`}})();if(C)return(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,children:(0,K.jsxs)(`div`,{className:`relative w-full max-w-2xl rounded-sm border border-border-soft bg-surface shadow-deep`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-soft px-5 py-4`,children:[(0,K.jsx)(`span`,{className:`font-serif text-[15px] font-semibold text-text`,children:`Choose home folder`}),(0,K.jsx)(`button`,{onClick:()=>w(!1),className:`flex h-8 w-8 items-center justify-center rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text`,children:(0,K.jsx)(nc,{className:`h-4 w-4`})})]}),(0,K.jsx)(`div`,{className:`p-5`,children:(0,K.jsx)(bM,{onChoose:e=>{S(e),w(!1)},onCancel:()=>w(!1)})})]})});let oe=(0,K.jsxs)(`div`,{className:`relative w-full max-w-xl rounded-sm border border-border-soft bg-white shadow-deep`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border-soft px-6 py-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(MM,{n:1,current:i,done:i>1,onClick:i>1?()=>a(1):void 0}),(0,K.jsx)(MM,{n:2,current:i,done:i>2}),(0,K.jsx)(MM,{n:3,current:i,done:!1})]}),(0,K.jsx)(`span`,{className:`font-serif text-[15px] font-semibold text-text`,children:ie})]}),(!e||T)&&(0,K.jsx)(`button`,{onClick:()=>void G(),className:`flex h-8 w-8 items-center justify-center rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text`,title:`Close`,children:(0,K.jsx)(nc,{className:`h-4 w-4`})})]}),i===1&&(0,K.jsxs)(`div`,{className:`px-6 py-6`,children:[(0,K.jsxs)(`div`,{className:`space-y-4`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium uppercase tracking-[0.08em] text-text-muted`,children:`Name`}),(0,K.jsx)(`input`,{ref:j,type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&te()},placeholder:`e.g. Aria`,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-serif text-[15px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none`}),c&&!F&&(0,K.jsx)(`p`,{className:`font-sans mt-1 text-[11px] text-health-error`,children:`Name must include at least one letter or number.`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium uppercase tracking-[0.08em] text-text-muted`,children:`Role`}),(0,K.jsx)(`input`,{type:`text`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&te()},placeholder:`e.g. Full-stack developer`,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-serif text-[15px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none`})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium uppercase tracking-[0.08em] text-text-muted`,children:`Provider`}),M&&H.length===P.length?(0,K.jsx)(`p`,{className:`font-sans text-[12px] text-health-warn`,children:`No providers detected. Install Claude Code, Codex CLI, or Kimi CLI first.`}):(0,K.jsxs)(`div`,{className:[`grid gap-2`,(z?.reasoningEfforts??[]).length>0?`grid-cols-3`:`grid-cols-2`].join(` `),children:[(0,K.jsxs)(fM,{value:f,onValueChange:e=>ee(e),children:[(0,K.jsx)(mM,{className:`!h-auto w-full py-2 font-serif text-[15px]`,children:(0,K.jsx)(pM,{children:e=>I(e)})}),(0,K.jsx)(hM,{children:P.map(e=>{let t=Ox(e,M);return(0,K.jsxs)(gM,{value:e.kind,disabled:!!t,children:[e.label,t?` — ${t}`:``]},e.kind)})})]}),(0,K.jsxs)(fM,{value:m,onValueChange:e=>{e&&h(e)},children:[(0,K.jsx)(mM,{className:`!h-auto w-full py-2 font-serif text-[15px]`,children:(0,K.jsx)(pM,{children:e=>L(e)})}),(0,K.jsx)(hM,{children:(z?.models??[]).map(e=>(0,K.jsx)(gM,{value:e,children:L(e)},e))})]}),(z?.reasoningEfforts??[]).length>0&&(0,K.jsxs)(fM,{value:g,onValueChange:e=>{e&&_(e)},children:[(0,K.jsx)(mM,{className:`!h-auto w-full py-2 font-serif text-[15px]`,children:(0,K.jsx)(pM,{children:e=>R(e)})}),(0,K.jsx)(hM,{children:(z?.reasoningEfforts??[]).map(e=>(0,K.jsx)(gM,{value:e,children:R(e)},e))})]})]}),V&&(0,K.jsx)(`p`,{className:`font-sans mt-1 text-[11px] text-health-warn`,children:V}),U&&(0,K.jsx)(`p`,{className:`font-sans mt-1 text-[11px] text-text-subtle`,children:`Checking installed provider CLIs...`}),N&&(0,K.jsxs)(`p`,{className:`font-sans mt-1 text-[11px] text-health-error`,children:[`Provider check failed: `,N instanceof Error?N.message:String(N)]})]}),!T&&(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>b(e=>!e),className:`font-sans flex items-center gap-1 text-[12px] text-text-muted hover:text-text transition-colors`,children:[y?(0,K.jsx)(Ps,{className:`h-3.5 w-3.5`}):(0,K.jsx)(Is,{className:`h-3.5 w-3.5`}),`Where it lives`]}),y&&(0,K.jsxs)(`div`,{className:`mt-2 rounded-sm border border-border-soft bg-surface-elevated p-4`,children:[(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`font-mono text-[13px] text-text break-all`,children:W}),(0,K.jsx)(`div`,{className:`font-sans mt-0.5 text-[11px] text-text-subtle`,children:`Will be created automatically`}),(0,K.jsxs)(`p`,{className:`font-sans mt-2 text-[12px] text-text-muted`,children:[`Your agent's memory lives here, inside your team's `,(0,K.jsx)(`strong`,{className:`font-semibold text-text`,children:`Knowledge Base`}),`.`]})]}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>w(!0),className:`font-sans shrink-0 text-[12px] text-text-muted underline decoration-text-muted/40 underline-offset-2 hover:text-text hover:decoration-text/40 transition-colors`,children:`Change…`})]}),x&&(0,K.jsx)(`button`,{type:`button`,onClick:()=>S(null),className:`font-sans mt-2 text-[11px] text-text-subtle underline underline-offset-2 hover:text-text transition-colors`,children:`Reset to default`})]})]})]}),D&&(0,K.jsx)(`p`,{className:`font-sans mt-3 text-[12px] text-health-error`,children:D}),(0,K.jsx)(`div`,{className:`mt-6`,children:(0,K.jsx)(Pw,{className:`w-full`,onClick:()=>void te(),disabled:k||!!ae,children:k?T?`Saving…`:`Creating…`:ae??(T?`Save & continue →`:`Create agent →`)})})]}),i===2&&T&&(0,K.jsx)(`div`,{className:`px-6 py-6`,children:(0,K.jsx)(OM,{agentId:T,onConnect:ne})}),i===3&&T&&(0,K.jsx)(`div`,{className:`px-6 py-6`,children:(0,K.jsx)(AM,{agentId:T,onConfirm:re,onSkip:re,submitLabel:`Start onboarding →`,skipLabel:`Start without owner →`,showRationale:!0})})]});return e?(0,K.jsx)(`div`,{className:`fixed inset-0 overflow-y-auto bg-surface`,children:(0,K.jsxs)(`div`,{className:`flex min-h-full w-full flex-col items-center justify-center gap-6 px-4 pt-8 pb-[20vh]`,children:[(0,K.jsxs)(`div`,{className:`text-center`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-center gap-2`,children:[(0,K.jsx)(_d,{className:`h-6 w-6 text-accent`}),(0,K.jsx)(`span`,{className:`font-serif text-[26px] font-semibold text-text`,children:`Anima`})]}),(0,K.jsx)(`p`,{className:`font-sans mt-2 max-w-sm text-balance text-[13px] leading-relaxed text-text-muted`,children:`An AI agent team that works alongside your human team in Slack, building up shared knowledge over time.`})]}),oe]})}):oe}function PM(){let e=nr();return(0,K.jsx)(NM,{firstRun:!0,onClose:t=>e(t?`/agents/${t}/profile`:`/`),onComplete:t=>e(`/agents/${t}/activity`)})}function FM({onClose:e}){let t=nr();return(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,children:(0,K.jsx)(NM,{firstRun:!1,onClose:n=>{e(),n&&t(`/agents/${n}/profile`)},onComplete:n=>{e(),t(`/agents/${n}/activity`)}})})}function IM(e){return bx(e)}function LM(e){return e.split(`/`).filter(Boolean).pop()??e}function RM({onClose:e,onAdded:t}){let[n,r]=(0,v.useState)(!1),[i,a]=(0,v.useState)(null);(0,v.useEffect)(()=>{let t=t=>{t.key===`Escape`&&!n&&e()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,n]);async function o(n){let i=LM(n),o=IM(i);r(!0),a(null);try{await im({id:o,label:i,path:n}),t(o),e()}catch(e){a(e instanceof Error?e.message:`Unknown error`),r(!1)}}return(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,onClick:()=>{n||e()},role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:`relative w-full max-w-2xl rounded-sm border border-border-soft bg-surface p-5 shadow-deep`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`div`,{className:`mb-3 font-serif text-[17px] font-semibold text-text`,children:`Add Knowledge Base`}),(0,K.jsx)(bM,{onChoose:o,onCancel:e,confirmLabel:n?`Adding…`:`Add Knowledge Base`,confirmDisabled:n}),i&&(0,K.jsx)(`div`,{className:`mt-2 font-sans text-[12px] leading-snug text-health-error`,children:i})]})}),document.body)}function zM({kb:e,busy:t,error:n,onConfirm:r,onCancel:i}){let[a,o]=(0,v.useState)(e.label),s=(0,v.useRef)(null);return(0,v.useEffect)(()=>{setTimeout(()=>s.current?.focus(),0)},[]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!t&&i()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[i,t]),(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,onClick:()=>{t||i()},role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:`relative w-full max-w-sm rounded-sm border border-border-soft bg-surface p-6 shadow-deep`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`div`,{className:`font-serif text-[17px] font-semibold text-text`,children:`Rename Knowledge Base`}),(0,K.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),a.trim()&&r(a.trim())},className:`mt-3 space-y-3`,children:[(0,K.jsx)(`input`,{ref:s,type:`text`,value:a,onChange:e=>o(e.target.value),disabled:t,className:`w-full rounded-sm border border-border bg-muted/30 px-3 py-1.5 font-sans text-[14px] text-text placeholder:text-text-subtle focus:outline-none focus:ring-1 focus:ring-ring`}),n&&(0,K.jsx)(`div`,{className:`font-sans text-[12px] leading-snug text-health-error`,children:n}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(Pw,{type:`submit`,disabled:t||!a.trim()||a.trim()===e.label,children:t?`Saving…`:`Save`}),(0,K.jsx)(Pw,{type:`button`,onClick:i,variant:`outline`,disabled:t,children:`Cancel`})]})]})]})}),document.body)}function BM({kb:e,busy:t,onConfirm:n,onCancel:r}){return(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&!t&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[r,t]),(0,y.createPortal)((0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,onClick:()=>{t||r()},role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:`relative w-full max-w-sm rounded-sm border border-health-error/30 bg-surface p-6 pl-8 shadow-deep`,onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-4 bottom-4 w-px bg-health-error/50`}),(0,K.jsx)(`div`,{className:`font-serif text-[17px] font-semibold text-text`,children:`Remove Knowledge Base?`}),(0,K.jsxs)(`div`,{className:`font-serif mt-2 text-[14px] leading-relaxed text-text-muted`,children:[(0,K.jsx)(`span`,{className:`font-semibold text-text`,children:e.label}),` will be removed from the sidebar. Files on disk are not affected.`]}),(0,K.jsxs)(`div`,{className:`mt-5 flex gap-2`,children:[(0,K.jsx)(Pw,{onClick:n,variant:`destructive`,disabled:t,children:t?`Removing…`:`Remove`}),(0,K.jsx)(Pw,{onClick:r,variant:`outline`,disabled:t,children:`Cancel`})]})]})}),document.body)}function VM({anchorRect:e,onRename:t,onDelete:n,onClose:r}){return(0,v.useEffect)(()=>{let e=()=>r();return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[r]),(0,v.useEffect)(()=>{let e=e=>{e.key===`Escape`&&r()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),(0,y.createPortal)((0,K.jsxs)(`div`,{className:`fixed z-40 min-w-[128px] rounded-sm border border-border bg-surface py-0.5 shadow-md`,style:{top:e.bottom+4,right:window.innerWidth-e.right},onPointerDown:e=>e.stopPropagation(),children:[(0,K.jsx)(`button`,{onClick:t,className:`flex w-full items-center px-3 py-1.5 font-sans text-[13px] text-text hover:bg-muted`,children:`Rename`}),(0,K.jsx)(`button`,{onClick:n,className:`flex w-full items-center px-3 py-1.5 font-sans text-[13px] text-health-error hover:bg-muted`,children:`Delete`})]}),document.body)}function HM({id:e,children:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=hd({id:e});return(0,K.jsxs)(`div`,{ref:i,style:{transform:Oc.Transform.toString(a),transition:o??void 0},...n,...r,className:[`group/drag relative select-none`,s?`z-50 opacity-40`:``].join(` `),children:[(0,K.jsx)(Ws,{"aria-hidden":!0,className:`pointer-events-none absolute left-0.5 top-1/2 h-3 w-3 -translate-y-1/2 text-text-on-spine-subtle opacity-0 transition-opacity group-hover/drag:opacity-50`}),t]})}function UM(e,t){let n=`/kb/${t}`;return e===n||e.startsWith(`${n}/`)}function WM({collapsed:e,onToggle:t}){let{data:n=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o,refetchInterval:Fo.agentStatuses}),{pathname:r}=$n(),i=nr(),{agentId:a}=ms(r),o=e=>i(e?`/agents/${e}`:`/`),s=new Set(n.filter(e=>e.currentItemId||e.queueDepth>0).map(e=>e.agentId)),{orderedAgents:c,orderedKbs:l,agentIndexMap:u,kbIndexMap:d,sensors:f,reorderAgents:p,reorderKbs:m}=fm(),[h,g]=(0,v.useState)(!1),[_,y]=(0,v.useState)(!1),[b,x]=(0,v.useState)(null),[S,C]=(0,v.useState)(null),[w,T]=(0,v.useState)(null),[E,D]=(0,v.useState)(!1),[O,k]=(0,v.useState)(null),[A,j]=(0,v.useState)(!1),[M,N]=(0,v.useState)(null),[P,F]=(0,v.useState)(!1),I=kp();function L(e,t){e.stopPropagation();let n=e.currentTarget.getBoundingClientRect();x(t),C(n)}function R(){x(null),C(null)}async function z(e){D(!0),T(null);try{let t=await sm(e);No.invalidateQueries({queryKey:Po.kbs()}),UM(r,e)&&i(t.length>0?`/kb/${t[0].id}`:`/`)}catch{}finally{D(!1)}}async function B(e,t){j(!0),N(null);try{await om(e,t),No.invalidateQueries({queryKey:Po.kbs()}),k(null)}catch(e){N(e instanceof Error?e.message:`Rename failed`)}finally{j(!1)}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`aside`,{className:[`relative hidden md:flex h-dvh shrink-0 flex-col overflow-hidden border-r border-spine-border bg-page`,`transition-[width] duration-200 ease-out`,e?`w-[68px]`:`w-64`].join(` `),children:[(0,K.jsxs)(`div`,{"aria-hidden":!e,className:[`absolute inset-0 flex flex-col transition-opacity duration-150 ease-out`,e?`opacity-100`:`opacity-0 pointer-events-none`].join(` `),children:[(0,K.jsx)(`button`,{onClick:t,title:`Expand sidebar`,className:`flex h-14 shrink-0 w-full items-center justify-center border-b border-spine-border hover:bg-spine-elevated/60 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-accent transition-colors`,children:(0,K.jsx)(_d,{className:`h-4 w-4 text-accent`})}),(0,K.jsxs)(`div`,{className:`flex flex-1 flex-col items-center overflow-y-auto py-2 gap-2`,children:[l.map(e=>{let t=UM(r,e.id),n=mm((d.get(e.id)??0)+6),a=hm(e.label);return(0,K.jsxs)(`div`,{className:`relative w-full flex justify-center`,children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-2 bottom-2 w-0.5 bg-accent`}),(0,K.jsx)(`button`,{onClick:()=>i(`/kb/${e.id}`),title:e.label,className:[`flex h-11 w-11 items-center justify-center rounded-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,t?`bg-spine-elevated`:`hover:bg-spine-elevated/30`].join(` `),children:(0,K.jsx)(`span`,{className:`font-sans flex h-9 w-9 items-center justify-center rounded-lg text-[13px] font-bold text-white ring-1 ring-avatar-ring-spine`,style:{background:n},children:a})})]},e.id)}),l.length>0&&c.length>0&&(0,K.jsx)(`div`,{className:`w-full shrink-0 border-t border-spine-border my-1`}),c.map(e=>{let t=a===e.id,n=s.has(e.id),r=e.enabled!==!1,i=r&&e.slack?.connected!==!0,c=mm(u.get(e.id)??0),l=e.profile?.displayName??e.id,d=hm(l);return(0,K.jsxs)(`div`,{className:`relative w-full flex justify-center`,children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-2 bottom-2 w-0.5 bg-accent`}),(0,K.jsxs)(`button`,{onClick:()=>o(e.id),title:l,className:[`flex h-11 w-11 items-center justify-center rounded-sm transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,t?`bg-spine-elevated`:`hover:bg-spine-elevated/30`].join(` `),children:[e.slack?.avatarUrl?(0,K.jsx)(`img`,{src:e.slack.avatarUrl,alt:``,className:[`h-9 w-9 rounded-lg object-cover ring-1 ring-avatar-ring-spine`,!r||i?`opacity-40 grayscale`:``].join(` `)}):(0,K.jsx)(`span`,{className:[`font-sans flex h-9 w-9 items-center justify-center rounded-lg text-[13px] font-bold text-white ring-1 ring-avatar-ring-spine`,!r||i?`opacity-40`:``].join(` `),style:{background:c},children:d}),r&&!i&&n&&(0,K.jsx)(`span`,{className:`absolute right-0.5 bottom-0.5 h-2 w-2 shrink-0 rounded-full border border-page`,style:{background:`var(--color-health-warn)`},title:`working`})]})]},e.id)})]}),(0,K.jsx)(`div`,{className:`shrink-0 border-t border-spine-border py-1.5 flex justify-center`,children:(0,K.jsxs)(`button`,{"data-server-panel-trigger":!0,onClick:()=>F(e=>!e),title:I?`Server — update available`:`Server status & restart`,className:`relative flex h-8 w-8 items-center justify-center rounded-sm text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,children:[(0,K.jsx)(Qs,{className:`h-3.5 w-3.5`}),I&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute right-1.5 top-1.5 h-1.5 w-1.5 rounded-full bg-accent ring-1 ring-spine-border`})]})})]}),!e&&(0,K.jsx)(`button`,{onClick:t,className:`absolute right-3 top-3.5 z-10 flex h-6 w-6 items-center justify-center rounded-sm text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,title:`Collapse sidebar`,children:(0,K.jsx)(Fs,{className:`h-4 w-4`})}),(0,K.jsxs)(`div`,{"aria-hidden":e,className:[`flex h-full w-64 shrink-0 flex-col transition-opacity duration-150 ease-out`,e?`pointer-events-none opacity-0`:`opacity-100`].join(` `),children:[(0,K.jsxs)(`div`,{className:`flex h-14 items-center gap-2.5 border-b border-spine-border px-5`,children:[(0,K.jsx)(_d,{className:`h-4 w-4 text-accent`}),(0,K.jsx)(`span`,{className:`display text-[18px] font-semibold tracking-tight text-text-on-spine`,children:`Anima`}),(0,K.jsx)(`span`,{className:`ml-auto h-6 w-6`,"aria-hidden":!0})]}),(0,K.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center justify-between pl-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`caps text-text-on-spine-subtle`,children:`Knowledge Base`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-text-on-spine-subtle`,children:l.length})]}),(0,K.jsx)(`button`,{onClick:()=>g(!0),className:`flex h-7 w-7 items-center justify-center rounded-sm text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,title:`Add Knowledge Base`,"aria-label":`Add Knowledge Base`,children:(0,K.jsx)(qs,{className:`h-3 w-3`})})]}),(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(Vu,{sensors:f,collisionDetection:Zc,onDragEnd:m,children:(0,K.jsx)(sd,{items:l.map(e=>e.id),strategy:rd,children:l.map(e=>{let t=UM(r,e.id);return(0,K.jsx)(HM,{id:e.id,children:(0,K.jsxs)(`div`,{className:[`group relative flex min-h-[44px] w-full items-center rounded-sm transition-colors`,t?`bg-spine-elevated`:`hover:bg-spine-elevated/60`].join(` `),children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-1.5 bottom-1.5 w-px bg-accent`}),(0,K.jsxs)(`button`,{onClick:()=>i(`/kb/${e.id}`),className:`flex min-w-0 flex-1 cursor-pointer items-center gap-2.5 px-3 py-2 text-left focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent focus-visible:ring-inset`,children:[(0,K.jsx)(Us,{className:`h-4 w-4 shrink-0 text-text-on-spine-muted`}),(0,K.jsx)(`span`,{className:[`truncate font-serif text-[14px] leading-tight text-text-on-spine`,t?`font-semibold`:`font-medium`].join(` `),children:e.label})]}),(0,K.jsx)(`button`,{onClick:t=>L(t,e.id),className:`mr-1 flex min-h-[44px] w-8 shrink-0 items-center justify-center rounded-sm text-text-on-spine-subtle opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 [@media(hover:none)]:opacity-100 hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:opacity-100 focus-visible:ring-1 focus-visible:ring-accent`,title:`Knowledge Base options`,"aria-label":`Knowledge Base options`,children:(0,K.jsx)(Bs,{className:`h-3.5 w-3.5`})})]})},e.id)})})}),l.length===0&&(0,K.jsxs)(`button`,{onClick:()=>g(!0),className:`flex items-center gap-1.5 px-2 font-sans text-[11px] text-text-on-spine-subtle hover:text-text-on-spine`,children:[(0,K.jsx)(qs,{className:`h-3 w-3`}),`Add Knowledge Base`]})]})]}),(0,K.jsxs)(`div`,{className:`mb-3 flex items-center justify-between pl-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`caps text-text-on-spine-subtle`,children:`Agents`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-text-on-spine-subtle`,children:c.length})]}),(0,K.jsx)(`button`,{onClick:()=>y(!0),className:`flex h-7 w-7 items-center justify-center rounded-sm text-text-on-spine-muted hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,title:`Add agent`,"aria-label":`Add agent`,children:(0,K.jsx)(qs,{className:`h-3 w-3`})})]}),(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsx)(Vu,{sensors:f,collisionDetection:Zc,onDragEnd:p,children:(0,K.jsx)(sd,{items:c.map(e=>e.id),strategy:rd,children:c.map(e=>(0,K.jsx)(HM,{id:e.id,children:(0,K.jsx)(gm,{agent:e,index:u.get(e.id)??0,active:a===e.id,isRunning:s.has(e.id),enabled:e.enabled!==!1,onClick:()=>o(e.id)})},e.id))})}),c.length===0&&(0,K.jsx)(`div`,{className:`px-2 py-4 text-center font-serif italic text-[12px] text-text-on-spine-subtle`,children:`No agents configured`})]})]}),(0,K.jsx)(`div`,{className:`border-t border-spine-border p-2`,children:(0,K.jsxs)(`button`,{"data-server-panel-trigger":!0,onClick:()=>F(e=>!e),className:`chrome flex w-full cursor-pointer items-center gap-2 rounded-sm px-2.5 py-2.5 text-left text-[11px] uppercase tracking-[0.1em] text-text-on-spine-muted transition-colors hover:bg-spine-elevated hover:text-text-on-spine focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-accent`,title:`Server status & restart`,children:[(0,K.jsx)(Qs,{className:`h-3.5 w-3.5`}),(0,K.jsx)(`span`,{children:`Server`}),I&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`ml-auto h-1.5 w-1.5 rounded-full bg-accent`,title:`Update available`})]})})]})]}),h&&(0,K.jsx)(RM,{onClose:()=>g(!1),onAdded:e=>{No.invalidateQueries({queryKey:Po.kbs()}),i(`/kb/${e}`)}}),b!==null&&S!==null&&(0,K.jsx)(VM,{anchorRect:S,onRename:()=>{let e=l.find(e=>e.id===b);R(),e&&k(e)},onDelete:()=>{let e=l.find(e=>e.id===b);R(),e&&T(e)},onClose:R}),O!==null&&(0,K.jsx)(zM,{kb:O,busy:A,error:M,onConfirm:e=>void B(O.id,e),onCancel:()=>{k(null),N(null)}}),w!==null&&(0,K.jsx)(BM,{kb:w,busy:E,onConfirm:()=>void z(w.id),onCancel:()=>T(null)}),_&&(0,K.jsx)(FM,{onClose:()=>y(!1)}),P&&(0,K.jsx)(em,{onClose:()=>F(!1)})]})}var GM=4e3,KM=2e4,qM=15e3,JM=6e4,YM=25,XM=new Map,ZM=0,QM=0;function $M(){return Date.now()}function eN(e,t){return e.length>t?`${e.slice(0,t)}…[truncated]`:e}function tN(e){let t=$M(),n=XM.get(e);if(n!==void 0&&t-n<qM||(t-ZM>JM&&(ZM=t,QM=0),QM>=YM))return!1;if(QM+=1,XM.set(e,t),XM.size>200)for(let[e,n]of XM)t-n>qM&&XM.delete(e);return!0}function nN(e){try{let t=eN(e.message||`Unknown error`,GM),n=e.stack?eN(e.stack,KM):void 0,r=e.componentStack?eN(e.componentStack,KM):void 0;if(!tN(`${e.kind}|${t}|${n??``}`))return;let i={kind:e.kind,message:t,...n?{stack:n}:{},...r?{componentStack:r}:{},path:window.location.pathname,userAgent:navigator.userAgent,createdAt:new Date().toISOString()};fetch(`/api/client-errors`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(i),keepalive:!0}).catch(()=>{})}catch{}}var rN=!1;function iN(){rN||typeof window>`u`||(rN=!0,window.addEventListener(`error`,e=>{nN({kind:`error`,message:e.message||(e.error instanceof Error?e.error.message:`Unknown error`),stack:e.error instanceof Error?e.error.stack:void 0})}),window.addEventListener(`unhandledrejection`,e=>{let t=e.reason;nN({kind:`unhandledrejection`,message:t instanceof Error?t.message:typeof t==`string`?t:String(t),stack:t instanceof Error?t.stack:void 0})}))}var aN=class extends v.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[ErrorBoundary]`,e,t.componentStack),nN({kind:`render`,message:e.message,stack:e.stack,componentStack:t.componentStack??void 0})}reset=()=>this.setState({error:null});render(){let{error:e}=this.state,{children:t,fallback:n}=this.props;return e?n?n(e,this.reset):(0,K.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 p-8 text-center`,children:[(0,K.jsx)(Rs,{className:`h-8 w-8 text-health-error`,"aria-hidden":!0}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`font-serif text-[16px] font-semibold text-text`,children:`Something went wrong`}),(0,K.jsx)(`div`,{className:`mt-1 font-mono text-[12px] text-text-muted`,children:e.message})]}),(0,K.jsx)(`button`,{onClick:this.reset,className:`rounded-sm border border-border-soft bg-surface px-4 py-2 font-sans text-[13px] text-text hover:bg-surface-elevated`,children:`Try again`})]}):t}};function oN({open:e,title:t,description:n,variant:r=`error`,size:i=`default`,busy:a=!1,error:o,confirmLabel:s=`Confirm`,busyLabel:c=`Saving…`,confirmVariant:l=`destructive`,onConfirm:u,onCancel:d}){if((0,v.useEffect)(()=>{if(!e)return;function t(e){e.key===`Escape`&&!a&&d()}return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,a,d]),!e)return null;let f=r===`error`?{border:`border-health-error/40`,bg:`bg-health-error-soft`,rule:`bg-health-error`}:{border:`border-health-warn/40`,bg:`bg-health-warn-soft`,rule:`bg-health-warn`},p=i===`large`;return(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-page/70 backdrop-blur-sm`,onClick:()=>{a||d()},role:`presentation`,children:(0,K.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:[`relative w-full rounded-sm border shadow-deep`,f.border,f.bg,p?`max-w-xl p-7 pl-8`:`mx-4 max-w-md p-6 pl-7`].join(` `),onClick:e=>e.stopPropagation(),children:[(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-4 bottom-4 w-px ${f.rule}`}),(0,K.jsx)(`div`,{className:[`font-serif font-semibold text-text`,p?`text-[17px]`:`text-[16px]`].join(` `),children:t}),(0,K.jsx)(`div`,{className:[`font-serif mt-2 leading-relaxed text-text-muted`,p?`text-[15px]`:`text-[14px]`].join(` `),children:n}),o&&(0,K.jsx)(`div`,{className:`mt-2 font-sans text-[11px] tracking-wide text-health-error`,children:o}),(0,K.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,K.jsx)(Pw,{disabled:a,onClick:u,variant:l,className:p?void 0:`min-h-[44px]`,size:p?void 0:`sm`,children:a?c:s}),(0,K.jsx)(Pw,{disabled:a,onClick:d,variant:`outline`,className:p?void 0:`min-h-[44px]`,size:p?void 0:`sm`,children:`Cancel`})]})]})})}function sN(){let[e,t]=(0,v.useState)(null),n=(0,v.useCallback)(e=>{t({...e,open:!0,busy:!1,error:null,onConfirm:e.onConfirm})},[]),r=(0,v.useCallback)(()=>{t(null)},[]),i=(0,v.useCallback)(async()=>{if(e){t(e=>e?{...e,busy:!0,error:null}:null);try{await e.onConfirm(),t(null)}catch(e){t(t=>t?{...t,busy:!1,error:e instanceof Error?e.message:String(e)}:null)}}},[e]);return{confirm:n,close:r,modal:e?(0,K.jsx)(oN,{open:e.open,title:e.title,description:e.description,variant:e.variant,size:e.size,busy:e.busy,error:e.error,confirmLabel:e.confirmLabel,busyLabel:e.busyLabel,confirmVariant:e.confirmVariant,onConfirm:i,onCancel:r}):null}}function cN({buttonClassName:e}){let{data:t=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{agentId:n}=or(),r=nr(),i=(0,v.useRef)(null),{confirm:a,modal:o}=sN(),[s,c]=(0,v.useState)(!1),[l,u]=(0,v.useState)(!1);if((0,v.useEffect)(()=>{if(!s)return;function e(e){i.current&&!i.current.contains(e.target)&&c(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[s]),!n)return null;let d=t.find(e=>e.id===n);if(!d)return null;let f=d.enabled!==!1;async function p(e){if(!(!n||l)){u(!0);try{await(e?Ho(n):Uo(n)),es()}catch{}finally{u(!1)}}}return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`relative`,ref:i,children:[(0,K.jsx)(Pw,{size:`xs`,variant:`ghost`,"aria-label":`More actions`,onClick:()=>c(e=>!e),className:e??`min-h-[44px] min-w-[44px]`,children:(0,K.jsx)(Bs,{className:`h-4 w-4`})}),s&&(0,K.jsxs)(`div`,{className:`absolute right-0 top-full z-10 mt-1 min-w-[180px] rounded-sm border border-border-soft bg-surface py-1 shadow-deep`,children:[f?(0,K.jsxs)(`button`,{className:`flex min-h-[44px] w-full items-center gap-2.5 px-3 text-left font-sans text-[13px] text-text-muted hover:bg-surface-elevated hover:text-text`,onClick:()=>{c(!1),a({title:`Disable this agent?`,description:`If it is running now, it will stop after the current item finishes. Memory and session are preserved.`,variant:`error`,confirmLabel:`Disable`,busyLabel:`Saving...`,onConfirm:async()=>{await Uo(n),es()}})},children:[(0,K.jsx)(Js,{className:`h-3.5 w-3.5 shrink-0`}),`Disable when idle`]}):(0,K.jsxs)(`button`,{disabled:l,className:`flex min-h-[44px] w-full items-center gap-2.5 px-3 text-left font-sans text-[13px] text-text-muted hover:bg-surface-elevated hover:text-text disabled:opacity-50`,onClick:()=>{c(!1),p(!0)},children:[(0,K.jsx)(Ys,{className:`h-3.5 w-3.5 shrink-0`}),l?`Saving...`:`Enable`]}),(0,K.jsxs)(`button`,{className:`flex min-h-[44px] w-full items-center gap-2.5 px-3 text-left font-sans text-[13px] text-text-muted hover:bg-surface-elevated hover:text-text`,onClick:()=>{c(!1),a({title:`Rotate primary session?`,description:`The current item keeps running. The next item starts fresh, and the current provider session is archived.`,variant:`warn`,confirmLabel:`Confirm`,busyLabel:`Rotating…`,onConfirm:async()=>{await rs(n),es()}})},children:[(0,K.jsx)(Zs,{className:`h-3.5 w-3.5 shrink-0`}),`Rotate session`]}),(0,K.jsx)(`div`,{className:`my-1 h-px bg-border-soft`}),(0,K.jsxs)(`button`,{className:`flex min-h-[44px] w-full items-center gap-2.5 px-3 text-left font-sans text-[13px] text-health-error hover:bg-health-error-soft`,onClick:()=>{c(!1),a({title:`Remove this agent?`,description:`The agent will stop running and its local Anima config will be deleted. Home files are not affected.`,variant:`error`,confirmLabel:`Remove`,busyLabel:`Removing…`,confirmVariant:`destructive`,onConfirm:async()=>{await Xo(n),r(`/`)}})},children:[(0,K.jsx)($s,{className:`h-4 w-4 shrink-0`}),`Remove agent`]})]})]}),o]})}function lN(){let{data:e=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:t=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o,refetchInterval:Fo.agentStatuses}),{pathname:n}=$n(),r=nr(),{agentId:i}=ms(n),a=e=>r(e?`/agents/${e}/activity`:`/`),[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null);if(!i)return null;let u=e.findIndex(e=>e.id===i),d=u>=0?e[u]:void 0,f=t.find(e=>e.agentId===i)?.currentItemId,p=!!f,m=d?.profile?.displayName?.trim()||i,h=d?hm(m):`?`,g=u>=0?mm(u):`var(--color-health-idle)`,_=d?.enabled!==!1,y=d?.slack?.connected===!0,b=async()=>{if(!(!f||o||!i)){s(!0),l(null);try{await us(i),es()}catch(e){l(e instanceof Error?e.message:`Stop failed`)}finally{s(!1)}}};return(0,K.jsx)(`div`,{className:`relative md:hidden`,style:{position:`fixed`,top:0,left:0,right:0,zIndex:40},children:(0,K.jsxs)(`div`,{className:`flex h-14 items-center gap-1.5 border-b border-border-soft bg-surface px-2`,children:[(0,K.jsx)(`button`,{onClick:()=>a(null),className:`flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center rounded-sm text-text-muted transition-colors hover:bg-surface-elevated hover:text-text`,"aria-label":`Back to agent list`,children:(0,K.jsx)(Fs,{className:`h-5 w-5`})}),d?.slack?.avatarUrl?(0,K.jsx)(`img`,{src:d.slack.avatarUrl,alt:``,className:[`h-6 w-6 shrink-0 rounded-lg object-cover ring-1 ring-border-soft`,y?``:`opacity-40 grayscale`].join(` `)}):(0,K.jsx)(`span`,{className:[`font-sans flex h-6 w-6 shrink-0 items-center justify-center rounded-lg text-[10px] font-bold text-white ring-1 ring-border-soft`,y?``:`opacity-40`].join(` `),style:{background:g},children:h}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`display truncate text-[15px] font-semibold text-text`,children:m}),_&&!y&&(0,K.jsx)(`span`,{className:`font-sans shrink-0 rounded-sm border border-health-warn/40 px-1 py-0.5 text-[9px] uppercase tracking-[0.08em] text-health-warn`,children:`Not connected`}),(0,K.jsx)(`span`,{className:`inline-block h-2 w-2 shrink-0 rounded-full`,style:{background:p||!_?`var(--color-health-warn)`:y?`var(--color-health-ok)`:`var(--color-health-idle)`}})]}),f&&(0,K.jsxs)(`div`,{className:`flex flex-col items-end gap-0.5`,children:[(0,K.jsx)(`button`,{onClick:()=>void b(),disabled:o,className:`chrome rounded-sm border border-border-soft px-2 py-1 text-[10px] font-medium uppercase tracking-[0.1em] text-text-muted hover:border-border-strong hover:text-text disabled:opacity-50`,children:o?`Stopping…`:`Stop`}),c&&(0,K.jsx)(`span`,{className:`font-sans text-[10px] text-health-error`,children:c})]}),(0,K.jsx)(cN,{buttonClassName:`flex min-h-[44px] min-w-[44px] items-center justify-center rounded-sm text-text-muted transition-colors hover:bg-surface-elevated hover:text-text`})]})})}var uN=[{id:`activity`,label:`Activity`,Icon:Ks},{id:`reminders`,label:`Reminders`,Icon:Ms},{id:`profile`,label:`Profile`,Icon:tc}];function dN(){let{pathname:e}=$n(),t=nr(),{agentId:n,tab:r}=ms(e),i=r&&fs.includes(r)?r:ps,a=e=>{n&&t(`/agents/${n}/${e}`)};return n?(0,K.jsx)(`nav`,{className:`flex border-t border-border-soft bg-surface pb-[env(safe-area-inset-bottom)] md:hidden`,style:{position:`fixed`,bottom:0,left:0,right:0,zIndex:40},children:uN.map(e=>{let t=i===e.id;return(0,K.jsxs)(`button`,{onClick:()=>a(e.id),className:[`chrome relative flex flex-1 flex-col items-center gap-0.5 px-2 py-2.5 text-[10px] font-medium uppercase tracking-[0.1em] transition-colors`,t?`text-text`:`text-text-muted`].join(` `),children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute top-0 left-3 right-3 h-[3px] rounded-b-[2px] bg-accent`}),(0,K.jsx)(e.Icon,{className:`h-5 w-5`}),(0,K.jsx)(`span`,{children:e.label})]},e.id)})}):null}var fN=`mobile-nav-scroll`;function pN({id:e,children:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=hd({id:e});return(0,K.jsxs)(`div`,{ref:i,style:{transform:Oc.Transform.toString(a),transition:o??void 0},...n,...r,className:[`group/drag relative select-none`,s?`z-50 opacity-40`:``].join(` `),children:[(0,K.jsx)(Ws,{"aria-hidden":!0,className:`pointer-events-none absolute left-1.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-text-subtle opacity-35`}),t]})}function mN({onSelectAgent:e,lastSelectedId:t}){let{orderedAgents:n,orderedKbs:r,agentIndexMap:i,sensors:a,reorderAgents:o,reorderKbs:s}=fm(),c=$n(),l=nr(),u=(0,v.useRef)(null),[d,f]=(0,v.useState)(!1),[p,m]=(0,v.useState)(!1),[h,g]=(0,v.useState)(!1),_=kp();(0,v.useEffect)(()=>{let e=sessionStorage.getItem(fN);e&&u.current&&(u.current.scrollTop=Number(e))},[]);let y=t=>{u.current&&sessionStorage.setItem(fN,String(u.current.scrollTop)),e(t)},b=e=>{u.current&&sessionStorage.setItem(fN,String(u.current.scrollTop)),l(`/kb/${e}`)},{data:x=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o,refetchInterval:Fo.agentStatuses}),S=new Set(x.filter(e=>e.currentItemId||e.queueDepth>0).map(e=>e.agentId));return(0,K.jsxs)(`div`,{className:`flex h-dvh flex-col bg-surface md:hidden`,children:[(0,K.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center gap-2.5 border-b border-border-soft bg-surface px-5`,style:{position:`sticky`,top:0,zIndex:10},children:[(0,K.jsx)(_d,{className:`h-4 w-4 text-accent`}),(0,K.jsx)(`span`,{className:`display text-[18px] font-semibold tracking-tight text-text`,children:`Anima`})]}),(0,K.jsxs)(`div`,{ref:u,className:`flex-1 overflow-y-auto p-3`,children:[(0,K.jsxs)(`div`,{className:`mb-4`,children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-3`,children:[(0,K.jsx)(`span`,{className:`caps text-text-muted`,children:`Knowledge Base`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-text-muted`,children:r.length}),(0,K.jsx)(`button`,{onClick:()=>m(!0),className:`ml-auto flex min-h-[44px] min-w-[44px] items-center justify-end rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text`,"aria-label":`Add Knowledge Base`,title:`Add Knowledge Base`,children:(0,K.jsx)(qs,{className:`h-3.5 w-3.5`})})]}),(0,K.jsx)(Vu,{sensors:a,collisionDetection:Zc,onDragEnd:s,children:(0,K.jsx)(sd,{items:r.map(e=>e.id),strategy:rd,children:(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[r.map(e=>{let t=c.pathname.startsWith(`/kb/${e.id}`);return(0,K.jsx)(pN,{id:e.id,children:(0,K.jsxs)(`button`,{onClick:()=>b(e.id),className:[`relative flex min-h-[44px] w-full items-center gap-2.5 rounded-sm py-3 pl-6 pr-3 text-left transition-colors`,t?`bg-surface-elevated`:`hover:bg-surface-elevated/60`].join(` `),children:[t&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-2 bottom-2 w-px bg-accent`}),(0,K.jsx)(Us,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,K.jsx)(`span`,{className:[`truncate font-serif text-[15px] leading-tight text-text`,t?`font-semibold`:`font-medium`].join(` `),children:e.label})]})},e.id)}),r.length===0&&(0,K.jsxs)(`button`,{onClick:()=>m(!0),className:`flex items-center gap-1.5 px-2 font-sans text-[11px] text-text-muted hover:text-text`,children:[(0,K.jsx)(qs,{className:`h-3 w-3`}),`Add Knowledge Base`]})]})})})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-3`,children:[(0,K.jsx)(`span`,{className:`caps text-text-muted`,children:`Agents`}),(0,K.jsx)(`span`,{className:`font-mono text-[10px] text-text-muted`,children:n.length}),(0,K.jsx)(`button`,{onClick:()=>f(!0),className:`ml-auto flex min-h-[44px] min-w-[44px] items-center justify-end rounded-sm text-text-muted hover:bg-surface-elevated hover:text-text`,"aria-label":`Add agent`,title:`Add agent`,children:(0,K.jsx)(qs,{className:`h-3.5 w-3.5`})})]}),(0,K.jsx)(Vu,{sensors:a,collisionDetection:Zc,onDragEnd:o,children:(0,K.jsx)(sd,{items:n.map(e=>e.id),strategy:rd,children:(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[n.map(e=>{let n=mm(i.get(e.id)??0),r=e.profile?.displayName??e.id,a=hm(r),o=S.has(e.id),s=e.enabled!==!1,c=s&&e.slack?.connected!==!0,l=e.id===t;return(0,K.jsx)(pN,{id:e.id,children:(0,K.jsxs)(`button`,{onClick:()=>y(e.id),className:[`relative flex min-h-[44px] w-full items-center gap-2.5 rounded-sm py-3 pl-6 pr-3 text-left transition-colors`,l?`bg-surface-elevated`:`hover:bg-surface-elevated/60`].join(` `),children:[l&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`absolute left-0 top-2 bottom-2 w-0.5 bg-accent`}),e.slack?.avatarUrl?(0,K.jsx)(`img`,{src:e.slack.avatarUrl,alt:``,className:`h-6 w-6 shrink-0 rounded-lg object-cover ring-1 ring-border-soft`,style:{opacity:s?1:.45}}):(0,K.jsx)(`span`,{className:`font-sans flex h-6 w-6 shrink-0 items-center justify-center rounded-lg text-[10px] font-bold text-white ring-1 ring-border-soft`,style:{background:n,opacity:s?1:.45},children:a}),(0,K.jsx)(`span`,{className:[`flex-1 truncate font-serif text-[15px] font-medium leading-tight`,s?`text-text`:`text-text-muted`].join(` `),children:r}),s?c?(0,K.jsx)(`span`,{className:`font-sans ml-auto shrink-0 rounded-sm border border-health-warn/40 px-1 py-0.5 text-[9px] uppercase tracking-[0.08em] text-health-warn`,title:`not connected to Slack`,children:`No Slack`}):(0,K.jsx)(`span`,{className:`inline-block h-2 w-2 shrink-0 rounded-full`,style:{background:o?`var(--color-health-warn)`:`var(--color-health-ok)`}}):(0,K.jsx)(`span`,{className:`font-sans ml-auto shrink-0 rounded-sm border border-text-muted/30 px-1 py-0.5 text-[9px] uppercase tracking-[0.08em] text-text-muted`,children:`Off`})]})},e.id)}),n.length===0&&(0,K.jsx)(`div`,{className:`px-2 py-6 text-center font-serif italic text-[13px] text-text-muted`,children:`No agents configured`})]})})})]})]}),(0,K.jsx)(`div`,{className:`shrink-0 border-t border-border-soft px-2 pb-2 pt-1`,style:{paddingBottom:`calc(env(safe-area-inset-bottom) + 0.5rem)`},children:(0,K.jsxs)(`button`,{onClick:()=>g(!0),title:_?`Server — update available`:`Server status & restart`,className:`flex min-h-[44px] w-full items-center gap-2.5 rounded-sm px-3 py-2 text-left transition-colors hover:bg-surface-elevated/60`,children:[(0,K.jsx)(Qs,{className:`h-4 w-4 shrink-0 text-text-muted`}),(0,K.jsx)(`span`,{className:`font-serif text-[15px] font-medium leading-tight text-text-muted`,children:`Server`}),_&&(0,K.jsx)(`span`,{"aria-hidden":!0,className:`ml-auto h-1.5 w-1.5 rounded-full bg-accent`,title:`Update available`})]})}),d&&(0,K.jsx)(FM,{onClose:()=>f(!1)}),p&&(0,K.jsx)(RM,{onClose:()=>m(!1),onAdded:()=>{m(!1),No.invalidateQueries({queryKey:Po.kbs()})}}),h&&(0,K.jsx)(em,{onClose:()=>g(!1)})]})}var hN=768;function gN(){let[e,t]=(0,v.useState)(()=>typeof window<`u`?window.innerWidth<hN:!1);return(0,v.useEffect)(()=>{let e=window.matchMedia(`(max-width: ${hN-1}px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function _N(){try{return localStorage.getItem(`sidebar-collapsed`)===`true`}catch{return!1}}function vN({disabled:e}){let{data:t}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:n}=jo({queryKey:Po.agentStatuses(),queryFn:$o}),r=$n(),i=nr();return(0,v.useEffect)(()=>{if(e||!t||!n||vs(r.pathname))return;let a=ms(r.pathname),o=xs({agents:t,agentStatuses:n,selectedAgentId:t[0]?.id},a);o&&i(hs(o),{replace:!0})},[e,t,n,r.pathname,i]),null}function yN(){let e=$n(),t=nr(),[n,r]=(0,v.useState)(_N),i=gN(),a=vs(e.pathname),{agentId:o}=ms(e.pathname),s=()=>{let e=!n;r(e);try{localStorage.setItem(`sidebar-collapsed`,String(e))}catch{}},c=(0,v.useCallback)(e=>{t(e?`/agents/${e}`:`/`)},[t]),[l,u]=(0,v.useState)(null),{data:d}=jo({queryKey:Po.agents(),queryFn:Zo});return d!==void 0&&d.length===0?(0,K.jsx)(Br,{to:`/onboarding`,replace:!0}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(bp,{}),!a&&(0,K.jsx)(vN,{disabled:i&&!o&&!a}),i&&!o&&!a?(0,K.jsx)(mN,{onSelectAgent:e=>{c(e),u(e)},lastSelectedId:l}):(0,K.jsxs)(`div`,{className:`flex h-dvh w-screen overflow-hidden bg-page text-text`,children:[(0,K.jsx)(WM,{collapsed:n,onToggle:s}),(0,K.jsxs)(`main`,{className:`flex min-w-0 flex-1 flex-col overflow-hidden bg-surface`,children:[(0,K.jsx)(lN,{}),o&&(0,K.jsx)(`div`,{className:`h-14 shrink-0 md:hidden`}),(0,K.jsx)(aN,{children:(0,K.jsx)(Vr,{})},e.pathname),o&&(0,K.jsx)(`div`,{className:`h-[calc(3.5rem+env(safe-area-inset-bottom))] shrink-0 md:hidden`}),(0,K.jsx)(dN,{})]})]})]})}var bN=`anima-activity-lens`,xN=`anima-activity-show-all-steps`,SN=new Set;function CN(){try{let e=localStorage.getItem(bN);if(e===`messages`)return`messages`;if(e===`activity`||e===`full`)return`activity`}catch{}return`activity`}var wN=CN();function TN(){return wN}function EN(e){wN=e;try{localStorage.setItem(bN,e)}catch{}SN.forEach(e=>e())}function DN(e){return SN.add(e),()=>SN.delete(e)}var ON=new Set;function kN(){try{return localStorage.getItem(xN)===`1`}catch{return!1}}var AN=kN();function jN(){return AN}function MN(e){AN=e;try{localStorage.setItem(xN,e?`1`:`0`)}catch{}ON.forEach(e=>e())}function NN(e){return ON.add(e),()=>ON.delete(e)}function PN(){let[e,t]=Ui(),n=(0,v.useSyncExternalStore)(DN,TN,CN),r=(0,v.useSyncExternalStore)(NN,jN,kN),i=e.get(`dir`),a=i===`in`?`in`:i===`out`?`out`:`all`;function o(e){t(t=>{let n=new URLSearchParams(t);return e===`all`?n.delete(`dir`):n.set(`dir`,e),n},{replace:!0})}let s=e.get(`failed`)===`1`;function c(e){t(t=>{let n=new URLSearchParams(t);return e?n.set(`failed`,`1`):n.delete(`failed`),n},{replace:!0})}return{lens:n,dir:a,failedOnly:s,showAllSteps:r,setLens:EN,setDir:o,setFailedOnly:c,setShowAllSteps:MN}}var FN=[{id:`activity`,label:`Activity`},{id:`profile`,label:`Profile`},{id:`reminders`,label:`Reminders`}];function IN({label:e,checked:t,onChange:n}){return(0,K.jsxs)(`label`,{className:`chrome inline-flex cursor-pointer items-center gap-1.5 whitespace-nowrap text-[11px] tracking-wide text-text-muted hover:text-text`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:t,onChange:e=>n(e.target.checked),className:`h-3 w-3 accent-[color:var(--color-accent)]`}),e]})}function LN({dir:e,onChange:t}){return(0,K.jsx)(`div`,{className:`flex items-center rounded-sm border border-border-soft p-0.5`,children:[`all`,`in`,`out`].map(n=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(n),className:[`chrome px-2.5 py-1 text-[11px] tracking-wide rounded-sm transition-colors`,e===n?`bg-accent/10 text-accent font-medium`:`text-text-muted hover:text-text`].join(` `),children:n===`all`?`All`:n===`in`?`Inbox`:`Outbox`},n))})}function RN({lens:e,onChange:t}){let n=`chrome px-2.5 py-1 text-[11px] tracking-wide rounded-sm transition-colors`,r=`bg-accent/10 text-accent font-medium`,i=`text-text-muted hover:text-text`;return(0,K.jsxs)(`div`,{className:`flex items-center rounded-sm border border-border-soft p-0.5`,children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(`messages`),className:[n,e===`messages`?r:i].join(` `),children:`Conversation`}),(0,K.jsx)(`button`,{type:`button`,onClick:()=>t(`activity`),className:[n,e===`activity`?r:i].join(` `),children:`Activity`})]})}function zN(){let{data:e=[]}=jo({queryKey:Po.agents(),queryFn:Zo}),{data:t=[]}=jo({queryKey:Po.agentStatuses(),queryFn:$o}),{agentId:n}=or(),{pathname:r}=$n(),i=nr(),{tab:a}=ms(r),o=a&&fs.includes(a)?a:ps,s=e=>{n&&i(`/agents/${n}/${e}`)},{failedOnly:c,lens:l,dir:u,showAllSteps:d,setFailedOnly:f,setLens:p,setDir:m,setShowAllSteps:h}=PN(),[g,_]=(0,v.useState)(!1),[y,b]=(0,v.useState)(null);if(!n)return null;let x=e.findIndex(e=>e.id===n),S=x>=0?e[x]:void 0;if(!S)return null;let C=mm(x),w=S.profile?.displayName??S.id,T=S.profile?.role,E=hm(w),D=t.find(e=>e.agentId===S.id)?.currentItemId;return(0,K.jsxs)(`header`,{className:`bg-surface`,children:[(0,K.jsxs)(`div`,{className:`hidden h-14 items-center gap-3 border-b border-border-soft px-8 md:flex`,children:[S.slack?.avatarUrl?(0,K.jsx)(`img`,{src:S.slack.avatarUrl,alt:``,className:`h-7 w-7 shrink-0 rounded-lg object-cover ring-1 ring-border-soft`}):(0,K.jsx)(`span`,{className:`font-sans flex h-7 w-7 shrink-0 items-center justify-center rounded-lg text-[11px] font-bold text-white ring-1 ring-border-soft`,style:{background:C},children:E}),(0,K.jsx)(`span`,{className:`display truncate text-[20px] font-semibold leading-tight text-text`,children:w}),T&&(0,K.jsx)(`span`,{className:`font-sans truncate text-[12px] tracking-wide text-text-muted`,title:T,children:T}),(0,K.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[D&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Pw,{variant:`outline`,size:`xs`,onClick:async()=>{if(!(!D||g)){_(!0),b(null);try{await us(S.id),es()}catch(e){b(e instanceof Error?e.message:`Stop failed`)}finally{_(!1)}}},disabled:g,title:`Stop item ${D}`,children:g?`Stopping…`:`Stop`}),y&&(0,K.jsx)(`span`,{className:`font-sans text-[11px] text-health-error`,children:y})]}),(0,K.jsx)(cN,{})]})]}),(0,K.jsxs)(`nav`,{className:`hidden flex-wrap items-center gap-y-1 border-b border-border-soft px-8 md:flex`,children:[(0,K.jsx)(`div`,{className:`flex flex-1 items-center gap-1`,children:FN.map(e=>(0,K.jsx)(`button`,{onClick:()=>s(e.id),className:[`chrome relative -mb-px border-b-2 px-3 py-2.5 text-[11px] font-medium uppercase tracking-[0.12em] transition-colors`,o===e.id?`border-accent text-text`:`border-transparent text-text-muted hover:text-text`].join(` `),children:e.label},e.id))}),o===`activity`&&(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[l===`activity`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(IN,{label:`Failed only`,checked:c,onChange:f}),(0,K.jsx)(IN,{label:`Show all steps`,checked:d,onChange:h})]}),l===`messages`&&(0,K.jsx)(LN,{dir:u,onChange:m}),(0,K.jsx)(RN,{lens:l,onChange:p})]})]})]})}function BN(){let{agentId:e}=or();return e?(0,K.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,K.jsx)(zN,{}),(0,K.jsx)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:(0,K.jsx)(Vr,{})})]}):(0,K.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-text-subtle`,children:`Select an agent from the sidebar.`})}var VN=Ai([{path:`onboarding`,lazy:()=>w(()=>Promise.resolve().then(()=>jM).then(e=>({Component:e.OnboardingPage})),void 0)},{path:`/`,element:(0,K.jsx)(yN,{}),children:[{path:`agents/:agentId`,element:(0,K.jsx)(BN,{}),children:[{path:`activity`,lazy:()=>w(()=>import(`./activity-DHjip8tY.js`).then(e=>({Component:e.default})),__vite__mapDeps([0,1,2]))},{path:`profile`,lazy:()=>w(()=>import(`./profile-CBy6GNzp.js`).then(e=>({Component:e.default})),__vite__mapDeps([3,1,4]))},{path:`reminders`,lazy:()=>w(()=>import(`./reminders-Bbwb9QNT.js`).then(e=>({Component:e.default})),[])}]},{path:`kb/:id/*`,lazy:()=>w(()=>import(`./kb-DDVpYkT9.js`).then(e=>({Component:e.default})),__vite__mapDeps([5,1,2,4]))}]}]);iN(),window.addEventListener(`error`,e=>{let t=document.getElementById(`root`);t&&(t.innerHTML=`<div style="padding:24px;font-family:ui-monospace,Menlo,monospace;color:#ef4444;background:#1a0e0e;border:1px solid #2c1414;border-radius:6px;margin:24px;font-size:13px;"><strong>Runtime Error</strong><br/><pre style="white-space:pre-wrap;margin-top:12px;font-size:12px">${e.message}\n${e.error?.stack||``}</pre></div>`)}),(0,b.createRoot)(document.getElementById(`root`)).render((0,K.jsx)(v.StrictMode,{children:(0,K.jsx)(_o,{client:No,children:(0,K.jsx)(ea,{router:VN})})}));export{Ps as $,lm as A,d as At,sp as B,JS as C,Ao as Ct,sx as D,qa as Dt,yx as E,Ka as Et,ap as F,Zs as G,cp as H,op as I,Vs as J,Gs as K,np as L,um as M,s as Mt,fp as N,l as Nt,ux as O,nr as Ot,ip as P,Fs as Q,lp as R,nC as S,jo as St,oS as T,Qa as Tt,up as U,rp as V,nc as W,Rs as X,zs as Y,Is as Z,VT as _,Vo as _t,bM as a,Qo as at,Pw as b,Fo as bt,gM as c,cs as ct,eA as d,Ko as dt,Ns as et,Zk as f,$o as ft,YT as g,Bo as gt,iE as h,zo as ht,OM as i,bs as it,cm as j,o as jt,am as k,or as kt,mM as l,ss as lt,qk as m,ls as mt,oN as n,js as nt,fM as o,is as ot,Xk as p,ts as pt,Hs as q,AM as r,ys as rt,hM as s,as as st,PN as t,Ms as tt,tA as u,ds as ut,sT as v,qo as vt,Y as w,mo as wt,Mw as x,No as xt,Bw as y,Po as yt,dp as z};
|