@taico/taico 0.4.1 → 0.5.1
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 +1 -1
- package/dist/ai-providers/ai-model-selection.entity.d.ts +11 -0
- package/dist/ai-providers/ai-model-selection.entity.js +58 -0
- package/dist/ai-providers/ai-model-selection.entity.js.map +1 -0
- package/dist/ai-providers/ai-model-selections.controller.d.ts +12 -0
- package/dist/ai-providers/ai-model-selections.controller.js +102 -0
- package/dist/ai-providers/ai-model-selections.controller.js.map +1 -0
- package/dist/ai-providers/ai-model-selections.service.d.ts +19 -0
- package/dist/ai-providers/ai-model-selections.service.js +113 -0
- package/dist/ai-providers/ai-model-selections.service.js.map +1 -0
- package/dist/ai-providers/ai-provider-models.service.d.ts +14 -0
- package/dist/ai-providers/ai-provider-models.service.js +196 -0
- package/dist/ai-providers/ai-provider-models.service.js.map +1 -0
- package/dist/{chat-providers/chat-provider.entity.d.ts → ai-providers/ai-provider.entity.d.ts} +6 -4
- package/dist/{chat-providers/chat-provider.entity.js → ai-providers/ai-provider.entity.js} +31 -21
- package/dist/ai-providers/ai-provider.entity.js.map +1 -0
- package/dist/ai-providers/ai-providers.controller.d.ts +20 -0
- package/dist/ai-providers/ai-providers.controller.js +177 -0
- package/dist/ai-providers/ai-providers.controller.js.map +1 -0
- package/dist/ai-providers/ai-providers.module.d.ts +2 -0
- package/dist/ai-providers/ai-providers.module.js +36 -0
- package/dist/ai-providers/ai-providers.module.js.map +1 -0
- package/dist/ai-providers/ai-providers.scopes.d.ts +20 -0
- package/dist/ai-providers/ai-providers.scopes.js +23 -0
- package/dist/ai-providers/ai-providers.scopes.js.map +1 -0
- package/dist/ai-providers/ai-providers.service.d.ts +20 -0
- package/dist/ai-providers/ai-providers.service.js +200 -0
- package/dist/ai-providers/ai-providers.service.js.map +1 -0
- package/dist/ai-providers/dto/http/ai-model-selection-params.dto.d.ts +4 -0
- package/dist/{chat-providers/dto/http/set-active-chat-provider.dto.js → ai-providers/dto/http/ai-model-selection-params.dto.js} +11 -10
- package/dist/ai-providers/dto/http/ai-model-selection-params.dto.js.map +1 -0
- package/dist/ai-providers/dto/http/ai-model-selection-response.dto.d.ts +10 -0
- package/dist/ai-providers/dto/http/ai-model-selection-response.dto.js +83 -0
- package/dist/ai-providers/dto/http/ai-model-selection-response.dto.js.map +1 -0
- package/dist/ai-providers/dto/http/ai-provider-model-response.dto.d.ts +6 -0
- package/dist/ai-providers/dto/http/ai-provider-model-response.dto.js +45 -0
- package/dist/ai-providers/dto/http/ai-provider-model-response.dto.js.map +1 -0
- package/dist/ai-providers/dto/http/ai-provider-params.dto.d.ts +3 -0
- package/dist/{chat-providers/dto/http/chat-provider-params.dto.js → ai-providers/dto/http/ai-provider-params.dto.js} +6 -6
- package/dist/ai-providers/dto/http/ai-provider-params.dto.js.map +1 -0
- package/dist/ai-providers/dto/http/ai-provider-response.dto.d.ts +14 -0
- package/dist/{chat-providers/dto/http/chat-provider-response.dto.js → ai-providers/dto/http/ai-provider-response.dto.js} +45 -23
- package/dist/ai-providers/dto/http/ai-provider-response.dto.js.map +1 -0
- package/dist/ai-providers/dto/http/create-ai-provider.dto.d.ts +9 -0
- package/dist/ai-providers/dto/http/create-ai-provider.dto.js +90 -0
- package/dist/ai-providers/dto/http/create-ai-provider.dto.js.map +1 -0
- package/dist/ai-providers/dto/http/set-ai-model-selection.dto.d.ts +4 -0
- package/dist/{chat-providers/dto/http/create-chat-provider.dto.js → ai-providers/dto/http/set-ai-model-selection.dto.js} +15 -28
- package/dist/ai-providers/dto/http/set-ai-model-selection.dto.js.map +1 -0
- package/dist/ai-providers/dto/http/update-ai-provider.dto.d.ts +8 -0
- package/dist/ai-providers/dto/http/update-ai-provider.dto.js +88 -0
- package/dist/ai-providers/dto/http/update-ai-provider.dto.js.map +1 -0
- package/dist/ai-providers/dto/service/ai-providers.service.types.d.ts +62 -0
- package/dist/{threads/backends/chat-backend.interface.js → ai-providers/dto/service/ai-providers.service.types.js} +1 -1
- package/dist/ai-providers/dto/service/ai-providers.service.types.js.map +1 -0
- package/dist/ai-providers/enums/ai-model-job.enum.d.ts +7 -0
- package/dist/ai-providers/enums/ai-model-job.enum.js +15 -0
- package/dist/ai-providers/enums/ai-model-job.enum.js.map +1 -0
- package/dist/ai-providers/enums/ai-model-kind.enum.d.ts +4 -0
- package/dist/ai-providers/enums/ai-model-kind.enum.js +9 -0
- package/dist/ai-providers/enums/ai-model-kind.enum.js.map +1 -0
- package/dist/ai-providers/enums/ai-provider-type.enum.d.ts +8 -0
- package/dist/ai-providers/enums/ai-provider-type.enum.js +13 -0
- package/dist/ai-providers/enums/ai-provider-type.enum.js.map +1 -0
- package/dist/ai-providers/enums/index.d.ts +3 -0
- package/dist/{chat-providers → ai-providers}/enums/index.js +3 -1
- package/dist/ai-providers/enums/index.js.map +1 -0
- package/dist/ai-providers/errors/ai-providers.errors.d.ts +30 -0
- package/dist/ai-providers/errors/ai-providers.errors.js +57 -0
- package/dist/ai-providers/errors/ai-providers.errors.js.map +1 -0
- package/dist/ai-providers/google-environment.d.ts +3 -0
- package/dist/ai-providers/google-environment.js +18 -0
- package/dist/ai-providers/google-environment.js.map +1 -0
- package/dist/app-init/app-init.module.js +2 -2
- package/dist/app-init/app-init.module.js.map +1 -1
- package/dist/app-init/app-init.runner.d.ts +4 -4
- package/dist/app-init/app-init.runner.js +21 -21
- package/dist/app-init/app-init.runner.js.map +1 -1
- package/dist/app.module.js +15 -3
- package/dist/app.module.js.map +1 -1
- package/dist/auth/core/scopes/all-api.scopes.js +2 -2
- package/dist/auth/core/scopes/all-api.scopes.js.map +1 -1
- package/dist/common/postgres-io.adapter.d.ts +12 -0
- package/dist/common/postgres-io.adapter.js +62 -0
- package/dist/common/postgres-io.adapter.js.map +1 -0
- package/dist/config/env.config.d.ts +1 -0
- package/dist/config/env.config.js +9 -0
- package/dist/config/env.config.js.map +1 -1
- package/dist/errors/http/error-catalog.js +20 -14
- package/dist/errors/http/error-catalog.js.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/migrations/1760200000000-ThreadAgentMessages.d.ts +6 -0
- package/dist/migrations/1760200000000-ThreadAgentMessages.js +28 -0
- package/dist/migrations/1760200000000-ThreadAgentMessages.js.map +1 -0
- package/dist/migrations/1760300000000-ChatProviderModelConfig.d.ts +6 -0
- package/dist/migrations/1760300000000-ChatProviderModelConfig.js +14 -0
- package/dist/migrations/1760300000000-ChatProviderModelConfig.js.map +1 -0
- package/dist/migrations/1760400000000-ReplaceAdkChatProvider.d.ts +6 -0
- package/dist/migrations/1760400000000-ReplaceAdkChatProvider.js +16 -0
- package/dist/migrations/1760400000000-ReplaceAdkChatProvider.js.map +1 -0
- package/dist/migrations/1760500000000-AiProviderModelSelections.d.ts +6 -0
- package/dist/migrations/1760500000000-AiProviderModelSelections.js +56 -0
- package/dist/migrations/1760500000000-AiProviderModelSelections.js.map +1 -0
- package/dist/migrations/1760600000000-DropAdkSessionTables.d.ts +6 -0
- package/dist/migrations/1760600000000-DropAdkSessionTables.js +51 -0
- package/dist/migrations/1760600000000-DropAdkSessionTables.js.map +1 -0
- package/dist/public/assets/index-Bu8fSAx2.js +117 -0
- package/dist/public/assets/index-DOm5BmlC.css +1 -0
- package/dist/public/beta/assets/index-B9fCnAUe.js +94 -0
- package/dist/public/beta/assets/index-DIzh0pTC.css +1 -0
- package/dist/public/beta/index.html +2 -2
- package/dist/public/index.html +2 -2
- package/dist/public/package.json +4 -4
- package/dist/scripts/migrate-sqlite-to-postgres.js +0 -22
- package/dist/scripts/migrate-sqlite-to-postgres.js.map +1 -1
- package/dist/threads/agent/agent-context.utils.d.ts +14 -0
- package/dist/threads/agent/agent-context.utils.js +42 -0
- package/dist/threads/agent/agent-context.utils.js.map +1 -0
- package/dist/threads/agent/agent-context.utils.spec.d.ts +1 -0
- package/dist/threads/agent/agent-context.utils.spec.js +60 -0
- package/dist/threads/agent/agent-context.utils.spec.js.map +1 -0
- package/dist/threads/agent/chat-model.factory.d.ts +25 -0
- package/dist/threads/agent/chat-model.factory.js +106 -0
- package/dist/threads/agent/chat-model.factory.js.map +1 -0
- package/dist/threads/agent/chat-model.factory.spec.d.ts +1 -0
- package/dist/threads/agent/chat-model.factory.spec.js +83 -0
- package/dist/threads/agent/chat-model.factory.spec.js.map +1 -0
- package/dist/threads/agent/hooks/compaction.hook.d.ts +11 -0
- package/dist/threads/agent/hooks/compaction.hook.js +109 -0
- package/dist/threads/agent/hooks/compaction.hook.js.map +1 -0
- package/dist/threads/agent/hooks/easter-egg.hook.d.ts +5 -0
- package/dist/threads/agent/hooks/easter-egg.hook.js +30 -0
- package/dist/threads/agent/hooks/easter-egg.hook.js.map +1 -0
- package/dist/threads/agent/hooks/hooks.spec.d.ts +1 -0
- package/dist/threads/agent/hooks/hooks.spec.js +87 -0
- package/dist/threads/agent/hooks/hooks.spec.js.map +1 -0
- package/dist/threads/agent/hooks/thread-agent-hook.interface.d.ts +20 -0
- package/dist/threads/agent/hooks/thread-agent-hook.interface.js +5 -0
- package/dist/threads/agent/hooks/thread-agent-hook.interface.js.map +1 -0
- package/dist/threads/agent/hooks/thread-agent-hooks.runner.d.ts +11 -0
- package/dist/threads/agent/hooks/thread-agent-hooks.runner.js +98 -0
- package/dist/threads/agent/hooks/thread-agent-hooks.runner.js.map +1 -0
- package/dist/threads/agent/taico-mcp-tools.factory.d.ts +22 -0
- package/dist/threads/agent/taico-mcp-tools.factory.js +79 -0
- package/dist/threads/agent/taico-mcp-tools.factory.js.map +1 -0
- package/dist/threads/agent/thread-agent-log.service.d.ts +41 -0
- package/dist/threads/agent/thread-agent-log.service.js +157 -0
- package/dist/threads/agent/thread-agent-log.service.js.map +1 -0
- package/dist/threads/agent/thread-agent-message.entity.d.ts +19 -0
- package/dist/threads/agent/thread-agent-message.entity.js +109 -0
- package/dist/threads/agent/thread-agent-message.entity.js.map +1 -0
- package/dist/threads/agent/thread-agent.enums.d.ts +17 -0
- package/dist/threads/agent/thread-agent.enums.js +24 -0
- package/dist/threads/agent/thread-agent.enums.js.map +1 -0
- package/dist/threads/agent/thread-agent.prompts.d.ts +5 -0
- package/dist/threads/{backends/chat-backend.utils.js → agent/thread-agent.prompts.js} +5 -4
- package/dist/threads/agent/thread-agent.prompts.js.map +1 -0
- package/dist/threads/agent/thread-agent.service.d.ts +33 -0
- package/dist/threads/agent/thread-agent.service.js +286 -0
- package/dist/threads/agent/thread-agent.service.js.map +1 -0
- package/dist/threads/agent/thread-agent.service.spec.d.ts +1 -0
- package/dist/threads/agent/thread-agent.service.spec.js +184 -0
- package/dist/threads/agent/thread-agent.service.spec.js.map +1 -0
- package/dist/threads/agent/thread-turn.entity.d.ts +12 -0
- package/dist/threads/agent/thread-turn.entity.js +71 -0
- package/dist/threads/agent/thread-turn.entity.js.map +1 -0
- package/dist/threads/agent/thread-turns.service.d.ts +13 -0
- package/dist/threads/agent/thread-turns.service.js +52 -0
- package/dist/threads/agent/thread-turns.service.js.map +1 -0
- package/dist/threads/chat.service.d.ts +5 -30
- package/dist/threads/chat.service.js +44 -119
- package/dist/threads/chat.service.js.map +1 -1
- package/dist/threads/dto/service/threads.service.types.d.ts +0 -2
- package/dist/threads/dto/thread-list-item-response.dto.d.ts +0 -1
- package/dist/threads/dto/thread-list-item-response.dto.js +0 -10
- package/dist/threads/dto/thread-list-item-response.dto.js.map +1 -1
- package/dist/threads/dto/thread-response.dto.d.ts +0 -1
- package/dist/threads/dto/thread-response.dto.js +0 -11
- package/dist/threads/dto/thread-response.dto.js.map +1 -1
- package/dist/threads/thread-message.entity.d.ts +3 -0
- package/dist/threads/thread-message.entity.js +12 -0
- package/dist/threads/thread-message.entity.js.map +1 -1
- package/dist/threads/thread.entity.d.ts +3 -1
- package/dist/threads/thread.entity.js +23 -3
- package/dist/threads/thread.entity.js.map +1 -1
- package/dist/threads/threads-state.service.spec.js +3 -1
- package/dist/threads/threads-state.service.spec.js.map +1 -1
- package/dist/threads/threads.module.js +31 -8
- package/dist/threads/threads.module.js.map +1 -1
- package/dist/threads/threads.service.d.ts +3 -8
- package/dist/threads/threads.service.js +6 -143
- package/dist/threads/threads.service.js.map +1 -1
- package/dist/threads/threads.service.spec.js +3 -2
- package/dist/threads/threads.service.spec.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/walkthrough/dto/walkthrough-status-response.dto.d.ts +1 -0
- package/dist/walkthrough/dto/walkthrough-status-response.dto.js +8 -0
- package/dist/walkthrough/dto/walkthrough-status-response.dto.js.map +1 -1
- package/dist/walkthrough/walkthrough.controller.js +1 -0
- package/dist/walkthrough/walkthrough.controller.js.map +1 -1
- package/dist/walkthrough/walkthrough.module.js +2 -0
- package/dist/walkthrough/walkthrough.module.js.map +1 -1
- package/dist/walkthrough/walkthrough.service.d.ts +4 -1
- package/dist/walkthrough/walkthrough.service.js +14 -7
- package/dist/walkthrough/walkthrough.service.js.map +1 -1
- package/package.json +17 -9
- package/dist/chat-providers/chat-provider.entity.js.map +0 -1
- package/dist/chat-providers/chat-providers.controller.d.ts +0 -19
- package/dist/chat-providers/chat-providers.controller.js +0 -179
- package/dist/chat-providers/chat-providers.controller.js.map +0 -1
- package/dist/chat-providers/chat-providers.module.d.ts +0 -2
- package/dist/chat-providers/chat-providers.module.js +0 -32
- package/dist/chat-providers/chat-providers.module.js.map +0 -1
- package/dist/chat-providers/chat-providers.scopes.d.ts +0 -20
- package/dist/chat-providers/chat-providers.scopes.js +0 -23
- package/dist/chat-providers/chat-providers.scopes.js.map +0 -1
- package/dist/chat-providers/chat-providers.service.d.ts +0 -20
- package/dist/chat-providers/chat-providers.service.js +0 -193
- package/dist/chat-providers/chat-providers.service.js.map +0 -1
- package/dist/chat-providers/dto/http/chat-provider-params.dto.d.ts +0 -3
- package/dist/chat-providers/dto/http/chat-provider-params.dto.js.map +0 -1
- package/dist/chat-providers/dto/http/chat-provider-response.dto.d.ts +0 -12
- package/dist/chat-providers/dto/http/chat-provider-response.dto.js.map +0 -1
- package/dist/chat-providers/dto/http/create-chat-provider.dto.d.ts +0 -6
- package/dist/chat-providers/dto/http/create-chat-provider.dto.js.map +0 -1
- package/dist/chat-providers/dto/http/set-active-chat-provider.dto.d.ts +0 -3
- package/dist/chat-providers/dto/http/set-active-chat-provider.dto.js.map +0 -1
- package/dist/chat-providers/dto/http/update-chat-provider.dto.d.ts +0 -5
- package/dist/chat-providers/dto/http/update-chat-provider.dto.js +0 -49
- package/dist/chat-providers/dto/http/update-chat-provider.dto.js.map +0 -1
- package/dist/chat-providers/dto/service/chat-providers.service.types.d.ts +0 -30
- package/dist/chat-providers/dto/service/chat-providers.service.types.js +0 -3
- package/dist/chat-providers/dto/service/chat-providers.service.types.js.map +0 -1
- package/dist/chat-providers/enums/chat-provider-type.enum.d.ts +0 -4
- package/dist/chat-providers/enums/chat-provider-type.enum.js +0 -9
- package/dist/chat-providers/enums/chat-provider-type.enum.js.map +0 -1
- package/dist/chat-providers/enums/index.d.ts +0 -1
- package/dist/chat-providers/enums/index.js.map +0 -1
- package/dist/chat-providers/errors/chat-providers.errors.d.ts +0 -25
- package/dist/chat-providers/errors/chat-providers.errors.js +0 -48
- package/dist/chat-providers/errors/chat-providers.errors.js.map +0 -1
- package/dist/llm/llm.module.d.ts +0 -2
- package/dist/llm/llm.module.js +0 -23
- package/dist/llm/llm.module.js.map +0 -1
- package/dist/llm/openai-responses.service.d.ts +0 -12
- package/dist/llm/openai-responses.service.js +0 -69
- package/dist/llm/openai-responses.service.js.map +0 -1
- package/dist/public/assets/index-CPjOd3Sq.css +0 -1
- package/dist/public/assets/index-DVNE_5Yh.js +0 -73
- package/dist/public/beta/assets/index-BRla0F5r.js +0 -94
- package/dist/public/beta/assets/index-BaBvl20K.css +0 -1
- package/dist/threads/backends/adk.backend.d.ts +0 -18
- package/dist/threads/backends/adk.backend.js +0 -264
- package/dist/threads/backends/adk.backend.js.map +0 -1
- package/dist/threads/backends/chat-backend.interface.d.ts +0 -39
- package/dist/threads/backends/chat-backend.interface.js.map +0 -1
- package/dist/threads/backends/chat-backend.utils.d.ts +0 -5
- package/dist/threads/backends/chat-backend.utils.js.map +0 -1
- package/dist/threads/backends/openai.backend.d.ts +0 -19
- package/dist/threads/backends/openai.backend.js +0 -155
- package/dist/threads/backends/openai.backend.js.map +0 -1
- package/dist/threads/openai-mcp-server-factory.service.d.ts +0 -8
- package/dist/threads/openai-mcp-server-factory.service.js +0 -114
- package/dist/threads/openai-mcp-server-factory.service.js.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
function kT(n,t){for(var i=0;i<t.length;i++){const l=t[i];if(typeof l!="string"&&!Array.isArray(l)){for(const c in l)if(c!=="default"&&!(c in n)){const u=Object.getOwnPropertyDescriptor(l,c);u&&Object.defineProperty(n,c,u.get?u:{enumerable:!0,get:()=>l[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const u of c)if(u.type==="childList")for(const h of u.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&l(h)}).observe(document,{childList:!0,subtree:!0});function i(c){const u={};return c.integrity&&(u.integrity=c.integrity),c.referrerPolicy&&(u.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?u.credentials="include":c.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function l(c){if(c.ep)return;c.ep=!0;const u=i(c);fetch(c.href,u)}})();function Kh(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Fd={exports:{}},Ji={};var wy;function ET(){if(wy)return Ji;wy=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function i(l,c,u){var h=null;if(u!==void 0&&(h=""+u),c.key!==void 0&&(h=""+c.key),"key"in c){u={};for(var m in c)m!=="key"&&(u[m]=c[m])}else u=c;return c=u.ref,{$$typeof:n,type:l,key:h,ref:c!==void 0?c:null,props:u}}return Ji.Fragment=t,Ji.jsx=i,Ji.jsxs=i,Ji}var ky;function CT(){return ky||(ky=1,Fd.exports=ET()),Fd.exports}var a=CT(),Yd={exports:{}},Oe={};var Ey;function NT(){if(Ey)return Oe;Ey=1;var n=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),h=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),y=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),x=Symbol.iterator;function _(M){return M===null||typeof M!="object"?null:(M=x&&M[x]||M["@@iterator"],typeof M=="function"?M:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,w={};function E(M,H,de){this.props=M,this.context=H,this.refs=w,this.updater=de||k}E.prototype.isReactComponent={},E.prototype.setState=function(M,H){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,H,"setState")},E.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function R(){}R.prototype=E.prototype;function D(M,H,de){this.props=M,this.context=H,this.refs=w,this.updater=de||k}var O=D.prototype=new R;O.constructor=D,T(O,E.prototype),O.isPureReactComponent=!0;var z=Array.isArray;function A(){}var C={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function P(M,H,de){var fe=de.ref;return{$$typeof:n,type:M,key:H,ref:fe!==void 0?fe:null,props:de}}function Y(M,H){return P(M.type,H,M.props)}function U(M){return typeof M=="object"&&M!==null&&M.$$typeof===n}function re(M){var H={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(de){return H[de]})}var Q=/\/+/g;function J(M,H){return typeof M=="object"&&M!==null&&M.key!=null?re(""+M.key):H.toString(36)}function ye(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(A,A):(M.status="pending",M.then(function(H){M.status==="pending"&&(M.status="fulfilled",M.value=H)},function(H){M.status==="pending"&&(M.status="rejected",M.reason=H)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function B(M,H,de,fe,V){var ie=typeof M;(ie==="undefined"||ie==="boolean")&&(M=null);var te=!1;if(M===null)te=!0;else switch(ie){case"bigint":case"string":case"number":te=!0;break;case"object":switch(M.$$typeof){case n:case t:te=!0;break;case v:return te=M._init,B(te(M._payload),H,de,fe,V)}}if(te)return V=V(M),te=fe===""?"."+J(M,0):fe,z(V)?(de="",te!=null&&(de=te.replace(Q,"$&/")+"/"),B(V,H,de,"",function(Ze){return Ze})):V!=null&&(U(V)&&(V=Y(V,de+(V.key==null||M&&M.key===V.key?"":(""+V.key).replace(Q,"$&/")+"/")+te)),H.push(V)),1;te=0;var be=fe===""?".":fe+":";if(z(M))for(var Re=0;Re<M.length;Re++)fe=M[Re],ie=be+J(fe,Re),te+=B(fe,H,de,ie,V);else if(Re=_(M),typeof Re=="function")for(M=Re.call(M),Re=0;!(fe=M.next()).done;)fe=fe.value,ie=be+J(fe,Re++),te+=B(fe,H,de,ie,V);else if(ie==="object"){if(typeof M.then=="function")return B(ye(M),H,de,fe,V);throw H=String(M),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return te}function se(M,H,de){if(M==null)return M;var fe=[],V=0;return B(M,fe,"","",function(ie){return H.call(de,ie,V++)}),fe}function ge(M){if(M._status===-1){var H=M._result;H=H(),H.then(function(de){(M._status===0||M._status===-1)&&(M._status=1,M._result=de)},function(de){(M._status===0||M._status===-1)&&(M._status=2,M._result=de)}),M._status===-1&&(M._status=0,M._result=H)}if(M._status===1)return M._result.default;throw M._result}var Ee=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},Ce={map:se,forEach:function(M,H,de){se(M,function(){H.apply(this,arguments)},de)},count:function(M){var H=0;return se(M,function(){H++}),H},toArray:function(M){return se(M,function(H){return H})||[]},only:function(M){if(!U(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return Oe.Activity=b,Oe.Children=Ce,Oe.Component=E,Oe.Fragment=i,Oe.Profiler=c,Oe.PureComponent=D,Oe.StrictMode=l,Oe.Suspense=p,Oe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=C,Oe.__COMPILER_RUNTIME={__proto__:null,c:function(M){return C.H.useMemoCache(M)}},Oe.cache=function(M){return function(){return M.apply(null,arguments)}},Oe.cacheSignal=function(){return null},Oe.cloneElement=function(M,H,de){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var fe=T({},M.props),V=M.key;if(H!=null)for(ie in H.key!==void 0&&(V=""+H.key),H)!L.call(H,ie)||ie==="key"||ie==="__self"||ie==="__source"||ie==="ref"&&H.ref===void 0||(fe[ie]=H[ie]);var ie=arguments.length-2;if(ie===1)fe.children=de;else if(1<ie){for(var te=Array(ie),be=0;be<ie;be++)te[be]=arguments[be+2];fe.children=te}return P(M.type,V,fe)},Oe.createContext=function(M){return M={$$typeof:h,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:u,_context:M},M},Oe.createElement=function(M,H,de){var fe,V={},ie=null;if(H!=null)for(fe in H.key!==void 0&&(ie=""+H.key),H)L.call(H,fe)&&fe!=="key"&&fe!=="__self"&&fe!=="__source"&&(V[fe]=H[fe]);var te=arguments.length-2;if(te===1)V.children=de;else if(1<te){for(var be=Array(te),Re=0;Re<te;Re++)be[Re]=arguments[Re+2];V.children=be}if(M&&M.defaultProps)for(fe in te=M.defaultProps,te)V[fe]===void 0&&(V[fe]=te[fe]);return P(M,ie,V)},Oe.createRef=function(){return{current:null}},Oe.forwardRef=function(M){return{$$typeof:m,render:M}},Oe.isValidElement=U,Oe.lazy=function(M){return{$$typeof:v,_payload:{_status:-1,_result:M},_init:ge}},Oe.memo=function(M,H){return{$$typeof:y,type:M,compare:H===void 0?null:H}},Oe.startTransition=function(M){var H=C.T,de={};C.T=de;try{var fe=M(),V=C.S;V!==null&&V(de,fe),typeof fe=="object"&&fe!==null&&typeof fe.then=="function"&&fe.then(A,Ee)}catch(ie){Ee(ie)}finally{H!==null&&de.types!==null&&(H.types=de.types),C.T=H}},Oe.unstable_useCacheRefresh=function(){return C.H.useCacheRefresh()},Oe.use=function(M){return C.H.use(M)},Oe.useActionState=function(M,H,de){return C.H.useActionState(M,H,de)},Oe.useCallback=function(M,H){return C.H.useCallback(M,H)},Oe.useContext=function(M){return C.H.useContext(M)},Oe.useDebugValue=function(){},Oe.useDeferredValue=function(M,H){return C.H.useDeferredValue(M,H)},Oe.useEffect=function(M,H){return C.H.useEffect(M,H)},Oe.useEffectEvent=function(M){return C.H.useEffectEvent(M)},Oe.useId=function(){return C.H.useId()},Oe.useImperativeHandle=function(M,H,de){return C.H.useImperativeHandle(M,H,de)},Oe.useInsertionEffect=function(M,H){return C.H.useInsertionEffect(M,H)},Oe.useLayoutEffect=function(M,H){return C.H.useLayoutEffect(M,H)},Oe.useMemo=function(M,H){return C.H.useMemo(M,H)},Oe.useOptimistic=function(M,H){return C.H.useOptimistic(M,H)},Oe.useReducer=function(M,H,de){return C.H.useReducer(M,H,de)},Oe.useRef=function(M){return C.H.useRef(M)},Oe.useState=function(M){return C.H.useState(M)},Oe.useSyncExternalStore=function(M,H,de){return C.H.useSyncExternalStore(M,H,de)},Oe.useTransition=function(){return C.H.useTransition()},Oe.version="19.2.5",Oe}var Cy;function Xh(){return Cy||(Cy=1,Yd.exports=NT()),Yd.exports}var d=Xh();const Rx=Kh(d),Dx=kT({__proto__:null,default:Rx},[d]);var Kd={exports:{}},el={},Xd={exports:{}},Qd={};var Ny;function AT(){return Ny||(Ny=1,(function(n){function t(B,se){var ge=B.length;B.push(se);e:for(;0<ge;){var Ee=ge-1>>>1,Ce=B[Ee];if(0<c(Ce,se))B[Ee]=se,B[ge]=Ce,ge=Ee;else break e}}function i(B){return B.length===0?null:B[0]}function l(B){if(B.length===0)return null;var se=B[0],ge=B.pop();if(ge!==se){B[0]=ge;e:for(var Ee=0,Ce=B.length,M=Ce>>>1;Ee<M;){var H=2*(Ee+1)-1,de=B[H],fe=H+1,V=B[fe];if(0>c(de,ge))fe<Ce&&0>c(V,de)?(B[Ee]=V,B[fe]=ge,Ee=fe):(B[Ee]=de,B[H]=ge,Ee=H);else if(fe<Ce&&0>c(V,ge))B[Ee]=V,B[fe]=ge,Ee=fe;else break e}}return se}function c(B,se){var ge=B.sortIndex-se.sortIndex;return ge!==0?ge:B.id-se.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;n.unstable_now=function(){return u.now()}}else{var h=Date,m=h.now();n.unstable_now=function(){return h.now()-m}}var p=[],y=[],v=1,b=null,x=3,_=!1,k=!1,T=!1,w=!1,E=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function O(B){for(var se=i(y);se!==null;){if(se.callback===null)l(y);else if(se.startTime<=B)l(y),se.sortIndex=se.expirationTime,t(p,se);else break;se=i(y)}}function z(B){if(T=!1,O(B),!k)if(i(p)!==null)k=!0,A||(A=!0,re());else{var se=i(y);se!==null&&ye(z,se.startTime-B)}}var A=!1,C=-1,L=5,P=-1;function Y(){return w?!0:!(n.unstable_now()-P<L)}function U(){if(w=!1,A){var B=n.unstable_now();P=B;var se=!0;try{e:{k=!1,T&&(T=!1,R(C),C=-1),_=!0;var ge=x;try{t:{for(O(B),b=i(p);b!==null&&!(b.expirationTime>B&&Y());){var Ee=b.callback;if(typeof Ee=="function"){b.callback=null,x=b.priorityLevel;var Ce=Ee(b.expirationTime<=B);if(B=n.unstable_now(),typeof Ce=="function"){b.callback=Ce,O(B),se=!0;break t}b===i(p)&&l(p),O(B)}else l(p);b=i(p)}if(b!==null)se=!0;else{var M=i(y);M!==null&&ye(z,M.startTime-B),se=!1}}break e}finally{b=null,x=ge,_=!1}se=void 0}}finally{se?re():A=!1}}}var re;if(typeof D=="function")re=function(){D(U)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,J=Q.port2;Q.port1.onmessage=U,re=function(){J.postMessage(null)}}else re=function(){E(U,0)};function ye(B,se){C=E(function(){B(n.unstable_now())},se)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(B){B.callback=null},n.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<B?Math.floor(1e3/B):5},n.unstable_getCurrentPriorityLevel=function(){return x},n.unstable_next=function(B){switch(x){case 1:case 2:case 3:var se=3;break;default:se=x}var ge=x;x=se;try{return B()}finally{x=ge}},n.unstable_requestPaint=function(){w=!0},n.unstable_runWithPriority=function(B,se){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ge=x;x=B;try{return se()}finally{x=ge}},n.unstable_scheduleCallback=function(B,se,ge){var Ee=n.unstable_now();switch(typeof ge=="object"&&ge!==null?(ge=ge.delay,ge=typeof ge=="number"&&0<ge?Ee+ge:Ee):ge=Ee,B){case 1:var Ce=-1;break;case 2:Ce=250;break;case 5:Ce=1073741823;break;case 4:Ce=1e4;break;default:Ce=5e3}return Ce=ge+Ce,B={id:v++,callback:se,priorityLevel:B,startTime:ge,expirationTime:Ce,sortIndex:-1},ge>Ee?(B.sortIndex=ge,t(y,B),i(p)===null&&B===i(y)&&(T?(R(C),C=-1):T=!0,ye(z,ge-Ee))):(B.sortIndex=Ce,t(p,B),k||_||(k=!0,A||(A=!0,re()))),B},n.unstable_shouldYield=Y,n.unstable_wrapCallback=function(B){var se=x;return function(){var ge=x;x=se;try{return B.apply(this,arguments)}finally{x=ge}}}})(Qd)),Qd}var Ay;function RT(){return Ay||(Ay=1,Xd.exports=AT()),Xd.exports}var Zd={exports:{}},Wt={};var Ry;function DT(){if(Ry)return Wt;Ry=1;var n=Xh();function t(p){var y="https://react.dev/errors/"+p;if(1<arguments.length){y+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)y+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+p+"; visit "+y+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var l={d:{f:i,r:function(){throw Error(t(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},c=Symbol.for("react.portal");function u(p,y,v){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:b==null?null:""+b,children:p,containerInfo:y,implementation:v}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function m(p,y){if(p==="font")return"";if(typeof y=="string")return y==="use-credentials"?y:""}return Wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,Wt.createPortal=function(p,y){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!y||y.nodeType!==1&&y.nodeType!==9&&y.nodeType!==11)throw Error(t(299));return u(p,y,null,v)},Wt.flushSync=function(p){var y=h.T,v=l.p;try{if(h.T=null,l.p=2,p)return p()}finally{h.T=y,l.p=v,l.d.f()}},Wt.preconnect=function(p,y){typeof p=="string"&&(y?(y=y.crossOrigin,y=typeof y=="string"?y==="use-credentials"?y:"":void 0):y=null,l.d.C(p,y))},Wt.prefetchDNS=function(p){typeof p=="string"&&l.d.D(p)},Wt.preinit=function(p,y){if(typeof p=="string"&&y&&typeof y.as=="string"){var v=y.as,b=m(v,y.crossOrigin),x=typeof y.integrity=="string"?y.integrity:void 0,_=typeof y.fetchPriority=="string"?y.fetchPriority:void 0;v==="style"?l.d.S(p,typeof y.precedence=="string"?y.precedence:void 0,{crossOrigin:b,integrity:x,fetchPriority:_}):v==="script"&&l.d.X(p,{crossOrigin:b,integrity:x,fetchPriority:_,nonce:typeof y.nonce=="string"?y.nonce:void 0})}},Wt.preinitModule=function(p,y){if(typeof p=="string")if(typeof y=="object"&&y!==null){if(y.as==null||y.as==="script"){var v=m(y.as,y.crossOrigin);l.d.M(p,{crossOrigin:v,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0})}}else y==null&&l.d.M(p)},Wt.preload=function(p,y){if(typeof p=="string"&&typeof y=="object"&&y!==null&&typeof y.as=="string"){var v=y.as,b=m(v,y.crossOrigin);l.d.L(p,v,{crossOrigin:b,integrity:typeof y.integrity=="string"?y.integrity:void 0,nonce:typeof y.nonce=="string"?y.nonce:void 0,type:typeof y.type=="string"?y.type:void 0,fetchPriority:typeof y.fetchPriority=="string"?y.fetchPriority:void 0,referrerPolicy:typeof y.referrerPolicy=="string"?y.referrerPolicy:void 0,imageSrcSet:typeof y.imageSrcSet=="string"?y.imageSrcSet:void 0,imageSizes:typeof y.imageSizes=="string"?y.imageSizes:void 0,media:typeof y.media=="string"?y.media:void 0})}},Wt.preloadModule=function(p,y){if(typeof p=="string")if(y){var v=m(y.as,y.crossOrigin);l.d.m(p,{as:typeof y.as=="string"&&y.as!=="script"?y.as:void 0,crossOrigin:v,integrity:typeof y.integrity=="string"?y.integrity:void 0})}else l.d.m(p)},Wt.requestFormReset=function(p){l.d.r(p)},Wt.unstable_batchedUpdates=function(p,y){return p(y)},Wt.useFormState=function(p,y,v){return h.H.useFormState(p,y,v)},Wt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Wt.version="19.2.5",Wt}var Dy;function Ox(){if(Dy)return Zd.exports;Dy=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),Zd.exports=DT(),Zd.exports}var Oy;function OT(){if(Oy)return el;Oy=1;var n=RT(),t=Xh(),i=Ox();function l(e){var s="https://react.dev/errors/"+e;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var r=2;r<arguments.length;r++)s+="&args[]="+encodeURIComponent(arguments[r])}return"Minified React error #"+e+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function u(e){var s=e,r=e;if(e.alternate)for(;s.return;)s=s.return;else{e=s;do s=e,(s.flags&4098)!==0&&(r=s.return),e=s.return;while(e)}return s.tag===3?r:null}function h(e){if(e.tag===13){var s=e.memoizedState;if(s===null&&(e=e.alternate,e!==null&&(s=e.memoizedState)),s!==null)return s.dehydrated}return null}function m(e){if(e.tag===31){var s=e.memoizedState;if(s===null&&(e=e.alternate,e!==null&&(s=e.memoizedState)),s!==null)return s.dehydrated}return null}function p(e){if(u(e)!==e)throw Error(l(188))}function y(e){var s=e.alternate;if(!s){if(s=u(e),s===null)throw Error(l(188));return s!==e?null:e}for(var r=e,o=s;;){var f=r.return;if(f===null)break;var g=f.alternate;if(g===null){if(o=f.return,o!==null){r=o;continue}break}if(f.child===g.child){for(g=f.child;g;){if(g===r)return p(f),e;if(g===o)return p(f),s;g=g.sibling}throw Error(l(188))}if(r.return!==o.return)r=f,o=g;else{for(var j=!1,N=f.child;N;){if(N===r){j=!0,r=f,o=g;break}if(N===o){j=!0,o=f,r=g;break}N=N.sibling}if(!j){for(N=g.child;N;){if(N===r){j=!0,r=g,o=f;break}if(N===o){j=!0,o=g,r=f;break}N=N.sibling}if(!j)throw Error(l(189))}}if(r.alternate!==o)throw Error(l(190))}if(r.tag!==3)throw Error(l(188));return r.stateNode.current===r?e:s}function v(e){var s=e.tag;if(s===5||s===26||s===27||s===6)return e;for(e=e.child;e!==null;){if(s=v(e),s!==null)return s;e=e.sibling}return null}var b=Object.assign,x=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),D=Symbol.for("react.context"),O=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),C=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function re(e){return e===null||typeof e!="object"?null:(e=U&&e[U]||e["@@iterator"],typeof e=="function"?e:null)}var Q=Symbol.for("react.client.reference");function J(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Q?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case T:return"Fragment";case E:return"Profiler";case w:return"StrictMode";case z:return"Suspense";case A:return"SuspenseList";case P:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case D:return e.displayName||"Context";case R:return(e._context.displayName||"Context")+".Consumer";case O:var s=e.render;return e=e.displayName,e||(e=s.displayName||s.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case C:return s=e.displayName||null,s!==null?s:J(e.type)||"Memo";case L:s=e._payload,e=e._init;try{return J(e(s))}catch{}}return null}var ye=Array.isArray,B=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,se=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ge={pending:!1,data:null,method:null,action:null},Ee=[],Ce=-1;function M(e){return{current:e}}function H(e){0>Ce||(e.current=Ee[Ce],Ee[Ce]=null,Ce--)}function de(e,s){Ce++,Ee[Ce]=e.current,e.current=s}var fe=M(null),V=M(null),ie=M(null),te=M(null);function be(e,s){switch(de(ie,s),de(V,e),de(fe,null),s.nodeType){case 9:case 11:e=(e=s.documentElement)&&(e=e.namespaceURI)?Kg(e):0;break;default:if(e=s.tagName,s=s.namespaceURI)s=Kg(s),e=Xg(s,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}H(fe),de(fe,e)}function Re(){H(fe),H(V),H(ie)}function Ze(e){e.memoizedState!==null&&de(te,e);var s=fe.current,r=Xg(s,e.type);s!==r&&(de(V,e),de(fe,r))}function It(e){V.current===e&&(H(fe),H(V)),te.current===e&&(H(te),Xi._currentValue=ge)}var et,wt;function ue(e){if(et===void 0)try{throw Error()}catch(r){var s=r.stack.trim().match(/\n( *(at )?)/);et=s&&s[1]||"",wt=-1<r.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<r.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+et+e+wt}var X=!1;function pe(e,s){if(!e||X)return"";X=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var o={DetermineComponentFrameRoot:function(){try{if(s){var le=function(){throw Error()};if(Object.defineProperty(le.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(le,[])}catch(W){var K=W}Reflect.construct(e,[],le)}else{try{le.call()}catch(W){K=W}e.call(le.prototype)}}else{try{throw Error()}catch(W){K=W}(le=e())&&typeof le.catch=="function"&&le.catch(function(){})}}catch(W){if(W&&K&&typeof W.stack=="string")return[W.stack,K.stack]}return[null,null]}};o.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(o.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(o.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=o.DetermineComponentFrameRoot(),j=g[0],N=g[1];if(j&&N){var I=j.split(`
|
|
4
|
+
`),F=N.split(`
|
|
5
|
+
`);for(f=o=0;o<I.length&&!I[o].includes("DetermineComponentFrameRoot");)o++;for(;f<F.length&&!F[f].includes("DetermineComponentFrameRoot");)f++;if(o===I.length||f===F.length)for(o=I.length-1,f=F.length-1;1<=o&&0<=f&&I[o]!==F[f];)f--;for(;1<=o&&0<=f;o--,f--)if(I[o]!==F[f]){if(o!==1||f!==1)do if(o--,f--,0>f||I[o]!==F[f]){var ne=`
|
|
6
|
+
`+I[o].replace(" at new "," at ");return e.displayName&&ne.includes("<anonymous>")&&(ne=ne.replace("<anonymous>",e.displayName)),ne}while(1<=o&&0<=f);break}}}finally{X=!1,Error.prepareStackTrace=r}return(r=e?e.displayName||e.name:"")?ue(r):""}function Z(e,s){switch(e.tag){case 26:case 27:case 5:return ue(e.type);case 16:return ue("Lazy");case 13:return e.child!==s&&s!==null?ue("Suspense Fallback"):ue("Suspense");case 19:return ue("SuspenseList");case 0:case 15:return pe(e.type,!1);case 11:return pe(e.type.render,!1);case 1:return pe(e.type,!0);case 31:return ue("Activity");default:return""}}function Te(e){try{var s="",r=null;do s+=Z(e,r),r=e,e=e.return;while(e);return s}catch(o){return`
|
|
7
|
+
Error generating stack: `+o.message+`
|
|
8
|
+
`+o.stack}}var tt=Object.prototype.hasOwnProperty,ht=n.unstable_scheduleCallback,qt=n.unstable_cancelCallback,wn=n.unstable_shouldYield,kt=n.unstable_requestPaint,mt=n.unstable_now,ms=n.unstable_getCurrentPriorityLevel,gs=n.unstable_ImmediatePriority,xa=n.unstable_UserBlockingPriority,$s=n.unstable_NormalPriority,ri=n.unstable_LowPriority,Wa=n.unstable_IdlePriority,ii=n.log,li=n.unstable_setDisableYieldValue,ys=null,Pt=null;function kn(e){if(typeof ii=="function"&&li(e),Pt&&typeof Pt.setStrictMode=="function")try{Pt.setStrictMode(ys,e)}catch{}}var Ht=Math.clz32?Math.clz32:Gn,oi=Math.log,ci=Math.LN2;function Gn(e){return e>>>=0,e===0?32:31-(oi(e)/ci|0)|0}var Vn=256,hn=262144,ss=4194304;function Fn(e){var s=e&42;if(s!==0)return s;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Ps(e,s,r){var o=e.pendingLanes;if(o===0)return 0;var f=0,g=e.suspendedLanes,j=e.pingedLanes;e=e.warmLanes;var N=o&134217727;return N!==0?(o=N&~g,o!==0?f=Fn(o):(j&=N,j!==0?f=Fn(j):r||(r=N&~e,r!==0&&(f=Fn(r))))):(N=o&~g,N!==0?f=Fn(N):j!==0?f=Fn(j):r||(r=o&~e,r!==0&&(f=Fn(r)))),f===0?0:s!==0&&s!==f&&(s&g)===0&&(g=f&-f,r=s&-s,g>=r||g===32&&(r&4194048)!==0)?s:f}function En(e,s){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&s)===0}function Hs(e,s){switch(e){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function oe(){var e=ss;return ss<<=1,(ss&62914560)===0&&(ss=4194304),e}function ve(e){for(var s=[],r=0;31>r;r++)s.push(e);return s}function Fe(e,s){e.pendingLanes|=s,s!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function bt(e,s,r,o,f,g){var j=e.pendingLanes;e.pendingLanes=r,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=r,e.entangledLanes&=r,e.errorRecoveryDisabledLanes&=r,e.shellSuspendCounter=0;var N=e.entanglements,I=e.expirationTimes,F=e.hiddenUpdates;for(r=j&~r;0<r;){var ne=31-Ht(r),le=1<<ne;N[ne]=0,I[ne]=-1;var K=F[ne];if(K!==null)for(F[ne]=null,ne=0;ne<K.length;ne++){var W=K[ne];W!==null&&(W.lane&=-536870913)}r&=~le}o!==0&&Ot(e,o,0),g!==0&&f===0&&e.tag!==0&&(e.suspendedLanes|=g&~(j&~s))}function Ot(e,s,r){e.pendingLanes|=s,e.suspendedLanes&=~s;var o=31-Ht(s);e.entangledLanes|=s,e.entanglements[o]=e.entanglements[o]|1073741824|r&261930}function he(e,s){var r=e.entangledLanes|=s;for(e=e.entanglements;r;){var o=31-Ht(r),f=1<<o;f&s|e[o]&s&&(e[o]|=s),r&=~f}}function me(e,s){var r=s&-s;return r=(r&42)!==0?1:gt(r),(r&(e.suspendedLanes|s))!==0?0:r}function gt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function as(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function ba(){var e=se.p;return e!==0?e:(e=window.event,e===void 0?32:vy(e.type))}function _a(e,s){var r=se.p;try{return se.p=e,s()}finally{se.p=r}}var fn=Math.random().toString(36).slice(2),Je="__reactFiber$"+fn,Gt="__reactProps$"+fn,Gs="__reactContainer$"+fn,Ic="__reactEvents$"+fn,mS="__reactListeners$"+fn,gS="__reactHandles$"+fn,Lf="__reactResources$"+fn,ui="__reactMarker$"+fn;function qc(e){delete e[Je],delete e[Gt],delete e[Ic],delete e[mS],delete e[gS]}function Ja(e){var s=e[Je];if(s)return s;for(var r=e.parentNode;r;){if(s=r[Gs]||r[Je]){if(r=s.alternate,s.child!==null||r!==null&&r.child!==null)for(e=ny(e);e!==null;){if(r=e[Je])return r;e=ny(e)}return s}e=r,r=e.parentNode}return null}function er(e){if(e=e[Je]||e[Gs]){var s=e.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return e}return null}function di(e){var s=e.tag;if(s===5||s===26||s===27||s===6)return e.stateNode;throw Error(l(33))}function tr(e){var s=e[Lf];return s||(s=e[Lf]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ut(e){e[ui]=!0}var Mf=new Set,If={};function Sa(e,s){nr(e,s),nr(e+"Capture",s)}function nr(e,s){for(If[e]=s,e=0;e<s.length;e++)Mf.add(s[e])}var yS=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),qf={},Uf={};function vS(e){return tt.call(Uf,e)?!0:tt.call(qf,e)?!1:yS.test(e)?Uf[e]=!0:(qf[e]=!0,!1)}function Nl(e,s,r){if(vS(s))if(r===null)e.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":e.removeAttribute(s);return;case"boolean":var o=s.toLowerCase().slice(0,5);if(o!=="data-"&&o!=="aria-"){e.removeAttribute(s);return}}e.setAttribute(s,""+r)}}function Al(e,s,r){if(r===null)e.removeAttribute(s);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(s);return}e.setAttribute(s,""+r)}}function vs(e,s,r,o){if(o===null)e.removeAttribute(r);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(r);return}e.setAttributeNS(s,r,""+o)}}function Cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Bf(e){var s=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function xS(e,s,r){var o=Object.getOwnPropertyDescriptor(e.constructor.prototype,s);if(!e.hasOwnProperty(s)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var f=o.get,g=o.set;return Object.defineProperty(e,s,{configurable:!0,get:function(){return f.call(this)},set:function(j){r=""+j,g.call(this,j)}}),Object.defineProperty(e,s,{enumerable:o.enumerable}),{getValue:function(){return r},setValue:function(j){r=""+j},stopTracking:function(){e._valueTracker=null,delete e[s]}}}}function Uc(e){if(!e._valueTracker){var s=Bf(e)?"checked":"value";e._valueTracker=xS(e,s,""+e[s])}}function $f(e){if(!e)return!1;var s=e._valueTracker;if(!s)return!0;var r=s.getValue(),o="";return e&&(o=Bf(e)?e.checked?"true":"false":e.value),e=o,e!==r?(s.setValue(e),!0):!1}function Rl(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var bS=/[\n"\\]/g;function Nn(e){return e.replace(bS,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Bc(e,s,r,o,f,g,j,N){e.name="",j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?e.type=j:e.removeAttribute("type"),s!=null?j==="number"?(s===0&&e.value===""||e.value!=s)&&(e.value=""+Cn(s)):e.value!==""+Cn(s)&&(e.value=""+Cn(s)):j!=="submit"&&j!=="reset"||e.removeAttribute("value"),s!=null?$c(e,j,Cn(s)):r!=null?$c(e,j,Cn(r)):o!=null&&e.removeAttribute("value"),f==null&&g!=null&&(e.defaultChecked=!!g),f!=null&&(e.checked=f&&typeof f!="function"&&typeof f!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?e.name=""+Cn(N):e.removeAttribute("name")}function Pf(e,s,r,o,f,g,j,N){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(e.type=g),s!=null||r!=null){if(!(g!=="submit"&&g!=="reset"||s!=null)){Uc(e);return}r=r!=null?""+Cn(r):"",s=s!=null?""+Cn(s):r,N||s===e.value||(e.value=s),e.defaultValue=s}o=o??f,o=typeof o!="function"&&typeof o!="symbol"&&!!o,e.checked=N?e.checked:!!o,e.defaultChecked=!!o,j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(e.name=j),Uc(e)}function $c(e,s,r){s==="number"&&Rl(e.ownerDocument)===e||e.defaultValue===""+r||(e.defaultValue=""+r)}function sr(e,s,r,o){if(e=e.options,s){s={};for(var f=0;f<r.length;f++)s["$"+r[f]]=!0;for(r=0;r<e.length;r++)f=s.hasOwnProperty("$"+e[r].value),e[r].selected!==f&&(e[r].selected=f),f&&o&&(e[r].defaultSelected=!0)}else{for(r=""+Cn(r),s=null,f=0;f<e.length;f++){if(e[f].value===r){e[f].selected=!0,o&&(e[f].defaultSelected=!0);return}s!==null||e[f].disabled||(s=e[f])}s!==null&&(s.selected=!0)}}function Hf(e,s,r){if(s!=null&&(s=""+Cn(s),s!==e.value&&(e.value=s),r==null)){e.defaultValue!==s&&(e.defaultValue=s);return}e.defaultValue=r!=null?""+Cn(r):""}function Gf(e,s,r,o){if(s==null){if(o!=null){if(r!=null)throw Error(l(92));if(ye(o)){if(1<o.length)throw Error(l(93));o=o[0]}r=o}r==null&&(r=""),s=r}r=Cn(s),e.defaultValue=r,o=e.textContent,o===r&&o!==""&&o!==null&&(e.value=o),Uc(e)}function ar(e,s){if(s){var r=e.firstChild;if(r&&r===e.lastChild&&r.nodeType===3){r.nodeValue=s;return}}e.textContent=s}var _S=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Vf(e,s,r){var o=s.indexOf("--")===0;r==null||typeof r=="boolean"||r===""?o?e.setProperty(s,""):s==="float"?e.cssFloat="":e[s]="":o?e.setProperty(s,r):typeof r!="number"||r===0||_S.has(s)?s==="float"?e.cssFloat=r:e[s]=(""+r).trim():e[s]=r+"px"}function Ff(e,s,r){if(s!=null&&typeof s!="object")throw Error(l(62));if(e=e.style,r!=null){for(var o in r)!r.hasOwnProperty(o)||s!=null&&s.hasOwnProperty(o)||(o.indexOf("--")===0?e.setProperty(o,""):o==="float"?e.cssFloat="":e[o]="");for(var f in s)o=s[f],s.hasOwnProperty(f)&&r[f]!==o&&Vf(e,f,o)}else for(var g in s)s.hasOwnProperty(g)&&Vf(e,g,s[g])}function Pc(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var SS=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),jS=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Dl(e){return jS.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function xs(){}var Hc=null;function Gc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var rr=null,ir=null;function Yf(e){var s=er(e);if(s&&(e=s.stateNode)){var r=e[Gt]||null;e:switch(e=s.stateNode,s.type){case"input":if(Bc(e,r.value,r.defaultValue,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name),s=r.name,r.type==="radio"&&s!=null){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll('input[name="'+Nn(""+s)+'"][type="radio"]'),s=0;s<r.length;s++){var o=r[s];if(o!==e&&o.form===e.form){var f=o[Gt]||null;if(!f)throw Error(l(90));Bc(o,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(s=0;s<r.length;s++)o=r[s],o.form===e.form&&$f(o)}break e;case"textarea":Hf(e,r.value,r.defaultValue);break e;case"select":s=r.value,s!=null&&sr(e,!!r.multiple,s,!1)}}}var Vc=!1;function Kf(e,s,r){if(Vc)return e(s,r);Vc=!0;try{var o=e(s);return o}finally{if(Vc=!1,(rr!==null||ir!==null)&&(bo(),rr&&(s=rr,e=ir,ir=rr=null,Yf(s),e)))for(s=0;s<e.length;s++)Yf(e[s])}}function hi(e,s){var r=e.stateNode;if(r===null)return null;var o=r[Gt]||null;if(o===null)return null;r=o[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(o=!o.disabled)||(e=e.type,o=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!o;break e;default:e=!1}if(e)return null;if(r&&typeof r!="function")throw Error(l(231,s,typeof r));return r}var bs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Fc=!1;if(bs)try{var fi={};Object.defineProperty(fi,"passive",{get:function(){Fc=!0}}),window.addEventListener("test",fi,fi),window.removeEventListener("test",fi,fi)}catch{Fc=!1}var Vs=null,Yc=null,Ol=null;function Xf(){if(Ol)return Ol;var e,s=Yc,r=s.length,o,f="value"in Vs?Vs.value:Vs.textContent,g=f.length;for(e=0;e<r&&s[e]===f[e];e++);var j=r-e;for(o=1;o<=j&&s[r-o]===f[g-o];o++);return Ol=f.slice(e,1<o?1-o:void 0)}function zl(e){var s=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&s===13&&(e=13)):e=s,e===10&&(e=13),32<=e||e===13?e:0}function Ll(){return!0}function Qf(){return!1}function sn(e){function s(r,o,f,g,j){this._reactName=r,this._targetInst=f,this.type=o,this.nativeEvent=g,this.target=j,this.currentTarget=null;for(var N in e)e.hasOwnProperty(N)&&(r=e[N],this[N]=r?r(g):g[N]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Ll:Qf,this.isPropagationStopped=Qf,this}return b(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var r=this.nativeEvent;r&&(r.preventDefault?r.preventDefault():typeof r.returnValue!="unknown"&&(r.returnValue=!1),this.isDefaultPrevented=Ll)},stopPropagation:function(){var r=this.nativeEvent;r&&(r.stopPropagation?r.stopPropagation():typeof r.cancelBubble!="unknown"&&(r.cancelBubble=!0),this.isPropagationStopped=Ll)},persist:function(){},isPersistent:Ll}),s}var ja={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ml=sn(ja),pi=b({},ja,{view:0,detail:0}),TS=sn(pi),Kc,Xc,mi,Il=b({},pi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==mi&&(mi&&e.type==="mousemove"?(Kc=e.screenX-mi.screenX,Xc=e.screenY-mi.screenY):Xc=Kc=0,mi=e),Kc)},movementY:function(e){return"movementY"in e?e.movementY:Xc}}),Zf=sn(Il),wS=b({},Il,{dataTransfer:0}),kS=sn(wS),ES=b({},pi,{relatedTarget:0}),Qc=sn(ES),CS=b({},ja,{animationName:0,elapsedTime:0,pseudoElement:0}),NS=sn(CS),AS=b({},ja,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),RS=sn(AS),DS=b({},ja,{data:0}),Wf=sn(DS),OS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zS={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},LS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function MS(e){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(e):(e=LS[e])?!!s[e]:!1}function Zc(){return MS}var IS=b({},pi,{key:function(e){if(e.key){var s=OS[e.key]||e.key;if(s!=="Unidentified")return s}return e.type==="keypress"?(e=zl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?zS[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zc,charCode:function(e){return e.type==="keypress"?zl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?zl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),qS=sn(IS),US=b({},Il,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Jf=sn(US),BS=b({},pi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zc}),$S=sn(BS),PS=b({},ja,{propertyName:0,elapsedTime:0,pseudoElement:0}),HS=sn(PS),GS=b({},Il,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),VS=sn(GS),FS=b({},ja,{newState:0,oldState:0}),YS=sn(FS),KS=[9,13,27,32],Wc=bs&&"CompositionEvent"in window,gi=null;bs&&"documentMode"in document&&(gi=document.documentMode);var XS=bs&&"TextEvent"in window&&!gi,ep=bs&&(!Wc||gi&&8<gi&&11>=gi),tp=" ",np=!1;function sp(e,s){switch(e){case"keyup":return KS.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ap(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var lr=!1;function QS(e,s){switch(e){case"compositionend":return ap(s);case"keypress":return s.which!==32?null:(np=!0,tp);case"textInput":return e=s.data,e===tp&&np?null:e;default:return null}}function ZS(e,s){if(lr)return e==="compositionend"||!Wc&&sp(e,s)?(e=Xf(),Ol=Yc=Vs=null,lr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return ep&&s.locale!=="ko"?null:s.data;default:return null}}var WS={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rp(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s==="input"?!!WS[e.type]:s==="textarea"}function ip(e,s,r,o){rr?ir?ir.push(o):ir=[o]:rr=o,s=Eo(s,"onChange"),0<s.length&&(r=new Ml("onChange","change",null,r,o),e.push({event:r,listeners:s}))}var yi=null,vi=null;function JS(e){Pg(e,0)}function ql(e){var s=di(e);if($f(s))return e}function lp(e,s){if(e==="change")return s}var op=!1;if(bs){var Jc;if(bs){var eu="oninput"in document;if(!eu){var cp=document.createElement("div");cp.setAttribute("oninput","return;"),eu=typeof cp.oninput=="function"}Jc=eu}else Jc=!1;op=Jc&&(!document.documentMode||9<document.documentMode)}function up(){yi&&(yi.detachEvent("onpropertychange",dp),vi=yi=null)}function dp(e){if(e.propertyName==="value"&&ql(vi)){var s=[];ip(s,vi,e,Gc(e)),Kf(JS,s)}}function ej(e,s,r){e==="focusin"?(up(),yi=s,vi=r,yi.attachEvent("onpropertychange",dp)):e==="focusout"&&up()}function tj(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ql(vi)}function nj(e,s){if(e==="click")return ql(s)}function sj(e,s){if(e==="input"||e==="change")return ql(s)}function aj(e,s){return e===s&&(e!==0||1/e===1/s)||e!==e&&s!==s}var pn=typeof Object.is=="function"?Object.is:aj;function xi(e,s){if(pn(e,s))return!0;if(typeof e!="object"||e===null||typeof s!="object"||s===null)return!1;var r=Object.keys(e),o=Object.keys(s);if(r.length!==o.length)return!1;for(o=0;o<r.length;o++){var f=r[o];if(!tt.call(s,f)||!pn(e[f],s[f]))return!1}return!0}function hp(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function fp(e,s){var r=hp(e);e=0;for(var o;r;){if(r.nodeType===3){if(o=e+r.textContent.length,e<=s&&o>=s)return{node:r,offset:s-e};e=o}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=hp(r)}}function pp(e,s){return e&&s?e===s?!0:e&&e.nodeType===3?!1:s&&s.nodeType===3?pp(e,s.parentNode):"contains"in e?e.contains(s):e.compareDocumentPosition?!!(e.compareDocumentPosition(s)&16):!1:!1}function mp(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var s=Rl(e.document);s instanceof e.HTMLIFrameElement;){try{var r=typeof s.contentWindow.location.href=="string"}catch{r=!1}if(r)e=s.contentWindow;else break;s=Rl(e.document)}return s}function tu(e){var s=e&&e.nodeName&&e.nodeName.toLowerCase();return s&&(s==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||s==="textarea"||e.contentEditable==="true")}var rj=bs&&"documentMode"in document&&11>=document.documentMode,or=null,nu=null,bi=null,su=!1;function gp(e,s,r){var o=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;su||or==null||or!==Rl(o)||(o=or,"selectionStart"in o&&tu(o)?o={start:o.selectionStart,end:o.selectionEnd}:(o=(o.ownerDocument&&o.ownerDocument.defaultView||window).getSelection(),o={anchorNode:o.anchorNode,anchorOffset:o.anchorOffset,focusNode:o.focusNode,focusOffset:o.focusOffset}),bi&&xi(bi,o)||(bi=o,o=Eo(nu,"onSelect"),0<o.length&&(s=new Ml("onSelect","select",null,s,r),e.push({event:s,listeners:o}),s.target=or)))}function Ta(e,s){var r={};return r[e.toLowerCase()]=s.toLowerCase(),r["Webkit"+e]="webkit"+s,r["Moz"+e]="moz"+s,r}var cr={animationend:Ta("Animation","AnimationEnd"),animationiteration:Ta("Animation","AnimationIteration"),animationstart:Ta("Animation","AnimationStart"),transitionrun:Ta("Transition","TransitionRun"),transitionstart:Ta("Transition","TransitionStart"),transitioncancel:Ta("Transition","TransitionCancel"),transitionend:Ta("Transition","TransitionEnd")},au={},yp={};bs&&(yp=document.createElement("div").style,"AnimationEvent"in window||(delete cr.animationend.animation,delete cr.animationiteration.animation,delete cr.animationstart.animation),"TransitionEvent"in window||delete cr.transitionend.transition);function wa(e){if(au[e])return au[e];if(!cr[e])return e;var s=cr[e],r;for(r in s)if(s.hasOwnProperty(r)&&r in yp)return au[e]=s[r];return e}var vp=wa("animationend"),xp=wa("animationiteration"),bp=wa("animationstart"),ij=wa("transitionrun"),lj=wa("transitionstart"),oj=wa("transitioncancel"),_p=wa("transitionend"),Sp=new Map,ru="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ru.push("scrollEnd");function Yn(e,s){Sp.set(e,s),Sa(s,[e])}var Ul=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},An=[],ur=0,iu=0;function Bl(){for(var e=ur,s=iu=ur=0;s<e;){var r=An[s];An[s++]=null;var o=An[s];An[s++]=null;var f=An[s];An[s++]=null;var g=An[s];if(An[s++]=null,o!==null&&f!==null){var j=o.pending;j===null?f.next=f:(f.next=j.next,j.next=f),o.pending=f}g!==0&&jp(r,f,g)}}function $l(e,s,r,o){An[ur++]=e,An[ur++]=s,An[ur++]=r,An[ur++]=o,iu|=o,e.lanes|=o,e=e.alternate,e!==null&&(e.lanes|=o)}function lu(e,s,r,o){return $l(e,s,r,o),Pl(e)}function ka(e,s){return $l(e,null,null,s),Pl(e)}function jp(e,s,r){e.lanes|=r;var o=e.alternate;o!==null&&(o.lanes|=r);for(var f=!1,g=e.return;g!==null;)g.childLanes|=r,o=g.alternate,o!==null&&(o.childLanes|=r),g.tag===22&&(e=g.stateNode,e===null||e._visibility&1||(f=!0)),e=g,g=g.return;return e.tag===3?(g=e.stateNode,f&&s!==null&&(f=31-Ht(r),e=g.hiddenUpdates,o=e[f],o===null?e[f]=[s]:o.push(s),s.lane=r|536870912),g):null}function Pl(e){if(50<Pi)throw Pi=0,gd=null,Error(l(185));for(var s=e.return;s!==null;)e=s,s=e.return;return e.tag===3?e.stateNode:null}var dr={};function cj(e,s,r,o){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=o,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(e,s,r,o){return new cj(e,s,r,o)}function ou(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _s(e,s){var r=e.alternate;return r===null?(r=mn(e.tag,s,e.key,e.mode),r.elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=s,r.type=e.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=e.flags&65011712,r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,s=e.dependencies,r.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r.refCleanup=e.refCleanup,r}function Tp(e,s){e.flags&=65011714;var r=e.alternate;return r===null?(e.childLanes=0,e.lanes=s,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=r.childLanes,e.lanes=r.lanes,e.child=r.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=r.memoizedProps,e.memoizedState=r.memoizedState,e.updateQueue=r.updateQueue,e.type=r.type,s=r.dependencies,e.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),e}function Hl(e,s,r,o,f,g){var j=0;if(o=e,typeof e=="function")ou(e)&&(j=1);else if(typeof e=="string")j=pT(e,r,fe.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case P:return e=mn(31,r,s,f),e.elementType=P,e.lanes=g,e;case T:return Ea(r.children,f,g,s);case w:j=8,f|=24;break;case E:return e=mn(12,r,s,f|2),e.elementType=E,e.lanes=g,e;case z:return e=mn(13,r,s,f),e.elementType=z,e.lanes=g,e;case A:return e=mn(19,r,s,f),e.elementType=A,e.lanes=g,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case D:j=10;break e;case R:j=9;break e;case O:j=11;break e;case C:j=14;break e;case L:j=16,o=null;break e}j=29,r=Error(l(130,e===null?"null":typeof e,"")),o=null}return s=mn(j,r,s,f),s.elementType=e,s.type=o,s.lanes=g,s}function Ea(e,s,r,o){return e=mn(7,e,o,s),e.lanes=r,e}function cu(e,s,r){return e=mn(6,e,null,s),e.lanes=r,e}function wp(e){var s=mn(18,null,null,0);return s.stateNode=e,s}function uu(e,s,r){return s=mn(4,e.children!==null?e.children:[],e.key,s),s.lanes=r,s.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},s}var kp=new WeakMap;function Rn(e,s){if(typeof e=="object"&&e!==null){var r=kp.get(e);return r!==void 0?r:(s={value:e,source:s,stack:Te(s)},kp.set(e,s),s)}return{value:e,source:s,stack:Te(s)}}var hr=[],fr=0,Gl=null,_i=0,Dn=[],On=0,Fs=null,rs=1,is="";function Ss(e,s){hr[fr++]=_i,hr[fr++]=Gl,Gl=e,_i=s}function Ep(e,s,r){Dn[On++]=rs,Dn[On++]=is,Dn[On++]=Fs,Fs=e;var o=rs;e=is;var f=32-Ht(o)-1;o&=~(1<<f),r+=1;var g=32-Ht(s)+f;if(30<g){var j=f-f%5;g=(o&(1<<j)-1).toString(32),o>>=j,f-=j,rs=1<<32-Ht(s)+f|r<<f|o,is=g+e}else rs=1<<g|r<<f|o,is=e}function du(e){e.return!==null&&(Ss(e,1),Ep(e,1,0))}function hu(e){for(;e===Gl;)Gl=hr[--fr],hr[fr]=null,_i=hr[--fr],hr[fr]=null;for(;e===Fs;)Fs=Dn[--On],Dn[On]=null,is=Dn[--On],Dn[On]=null,rs=Dn[--On],Dn[On]=null}function Cp(e,s){Dn[On++]=rs,Dn[On++]=is,Dn[On++]=Fs,rs=s.id,is=s.overflow,Fs=e}var Vt=null,ut=null,Ge=!1,Ys=null,zn=!1,fu=Error(l(519));function Ks(e){var s=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Si(Rn(s,e)),fu}function Np(e){var s=e.stateNode,r=e.type,o=e.memoizedProps;switch(s[Je]=e,s[Gt]=o,r){case"dialog":Ue("cancel",s),Ue("close",s);break;case"iframe":case"object":case"embed":Ue("load",s);break;case"video":case"audio":for(r=0;r<Gi.length;r++)Ue(Gi[r],s);break;case"source":Ue("error",s);break;case"img":case"image":case"link":Ue("error",s),Ue("load",s);break;case"details":Ue("toggle",s);break;case"input":Ue("invalid",s),Pf(s,o.value,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name,!0);break;case"select":Ue("invalid",s);break;case"textarea":Ue("invalid",s),Gf(s,o.value,o.defaultValue,o.children)}r=o.children,typeof r!="string"&&typeof r!="number"&&typeof r!="bigint"||s.textContent===""+r||o.suppressHydrationWarning===!0||Fg(s.textContent,r)?(o.popover!=null&&(Ue("beforetoggle",s),Ue("toggle",s)),o.onScroll!=null&&Ue("scroll",s),o.onScrollEnd!=null&&Ue("scrollend",s),o.onClick!=null&&(s.onclick=xs),s=!0):s=!1,s||Ks(e,!0)}function Ap(e){for(Vt=e.return;Vt;)switch(Vt.tag){case 5:case 31:case 13:zn=!1;return;case 27:case 3:zn=!0;return;default:Vt=Vt.return}}function pr(e){if(e!==Vt)return!1;if(!Ge)return Ap(e),Ge=!0,!1;var s=e.tag,r;if((r=s!==3&&s!==27)&&((r=s===5)&&(r=e.type,r=!(r!=="form"&&r!=="button")||Rd(e.type,e.memoizedProps)),r=!r),r&&ut&&Ks(e),Ap(e),s===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));ut=ty(e)}else if(s===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));ut=ty(e)}else s===27?(s=ut,oa(e.type)?(e=Md,Md=null,ut=e):ut=s):ut=Vt?Mn(e.stateNode.nextSibling):null;return!0}function Ca(){ut=Vt=null,Ge=!1}function pu(){var e=Ys;return e!==null&&(on===null?on=e:on.push.apply(on,e),Ys=null),e}function Si(e){Ys===null?Ys=[e]:Ys.push(e)}var mu=M(null),Na=null,js=null;function Xs(e,s,r){de(mu,s._currentValue),s._currentValue=r}function Ts(e){e._currentValue=mu.current,H(mu)}function gu(e,s,r){for(;e!==null;){var o=e.alternate;if((e.childLanes&s)!==s?(e.childLanes|=s,o!==null&&(o.childLanes|=s)):o!==null&&(o.childLanes&s)!==s&&(o.childLanes|=s),e===r)break;e=e.return}}function yu(e,s,r,o){var f=e.child;for(f!==null&&(f.return=e);f!==null;){var g=f.dependencies;if(g!==null){var j=f.child;g=g.firstContext;e:for(;g!==null;){var N=g;g=f;for(var I=0;I<s.length;I++)if(N.context===s[I]){g.lanes|=r,N=g.alternate,N!==null&&(N.lanes|=r),gu(g.return,r,e),o||(j=null);break e}g=N.next}}else if(f.tag===18){if(j=f.return,j===null)throw Error(l(341));j.lanes|=r,g=j.alternate,g!==null&&(g.lanes|=r),gu(j,r,e),j=null}else j=f.child;if(j!==null)j.return=f;else for(j=f;j!==null;){if(j===e){j=null;break}if(f=j.sibling,f!==null){f.return=j.return,j=f;break}j=j.return}f=j}}function mr(e,s,r,o){e=null;for(var f=s,g=!1;f!==null;){if(!g){if((f.flags&524288)!==0)g=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var j=f.alternate;if(j===null)throw Error(l(387));if(j=j.memoizedProps,j!==null){var N=f.type;pn(f.pendingProps.value,j.value)||(e!==null?e.push(N):e=[N])}}else if(f===te.current){if(j=f.alternate,j===null)throw Error(l(387));j.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(e!==null?e.push(Xi):e=[Xi])}f=f.return}e!==null&&yu(s,e,r,o),s.flags|=262144}function Vl(e){for(e=e.firstContext;e!==null;){if(!pn(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Aa(e){Na=e,js=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ft(e){return Rp(Na,e)}function Fl(e,s){return Na===null&&Aa(e),Rp(e,s)}function Rp(e,s){var r=s._currentValue;if(s={context:s,memoizedValue:r,next:null},js===null){if(e===null)throw Error(l(308));js=s,e.dependencies={lanes:0,firstContext:s},e.flags|=524288}else js=js.next=s;return r}var uj=typeof AbortController<"u"?AbortController:function(){var e=[],s=this.signal={aborted:!1,addEventListener:function(r,o){e.push(o)}};this.abort=function(){s.aborted=!0,e.forEach(function(r){return r()})}},dj=n.unstable_scheduleCallback,hj=n.unstable_NormalPriority,Et={$$typeof:D,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function vu(){return{controller:new uj,data:new Map,refCount:0}}function ji(e){e.refCount--,e.refCount===0&&dj(hj,function(){e.controller.abort()})}var Ti=null,xu=0,gr=0,yr=null;function fj(e,s){if(Ti===null){var r=Ti=[];xu=0,gr=Sd(),yr={status:"pending",value:void 0,then:function(o){r.push(o)}}}return xu++,s.then(Dp,Dp),s}function Dp(){if(--xu===0&&Ti!==null){yr!==null&&(yr.status="fulfilled");var e=Ti;Ti=null,gr=0,yr=null;for(var s=0;s<e.length;s++)(0,e[s])()}}function pj(e,s){var r=[],o={status:"pending",value:null,reason:null,then:function(f){r.push(f)}};return e.then(function(){o.status="fulfilled",o.value=s;for(var f=0;f<r.length;f++)(0,r[f])(s)},function(f){for(o.status="rejected",o.reason=f,f=0;f<r.length;f++)(0,r[f])(void 0)}),o}var Op=B.S;B.S=function(e,s){gg=mt(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&fj(e,s),Op!==null&&Op(e,s)};var Ra=M(null);function bu(){var e=Ra.current;return e!==null?e:ot.pooledCache}function Yl(e,s){s===null?de(Ra,Ra.current):de(Ra,s.pool)}function zp(){var e=bu();return e===null?null:{parent:Et._currentValue,pool:e}}var vr=Error(l(460)),_u=Error(l(474)),Kl=Error(l(542)),Xl={then:function(){}};function Lp(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Mp(e,s,r){switch(r=e[r],r===void 0?e.push(s):r!==s&&(s.then(xs,xs),s=r),s.status){case"fulfilled":return s.value;case"rejected":throw e=s.reason,qp(e),e;default:if(typeof s.status=="string")s.then(xs,xs);else{if(e=ot,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=s,e.status="pending",e.then(function(o){if(s.status==="pending"){var f=s;f.status="fulfilled",f.value=o}},function(o){if(s.status==="pending"){var f=s;f.status="rejected",f.reason=o}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw e=s.reason,qp(e),e}throw Oa=s,vr}}function Da(e){try{var s=e._init;return s(e._payload)}catch(r){throw r!==null&&typeof r=="object"&&typeof r.then=="function"?(Oa=r,vr):r}}var Oa=null;function Ip(){if(Oa===null)throw Error(l(459));var e=Oa;return Oa=null,e}function qp(e){if(e===vr||e===Kl)throw Error(l(483))}var xr=null,wi=0;function Ql(e){var s=wi;return wi+=1,xr===null&&(xr=[]),Mp(xr,e,s)}function ki(e,s){s=s.props.ref,e.ref=s!==void 0?s:null}function Zl(e,s){throw s.$$typeof===x?Error(l(525)):(e=Object.prototype.toString.call(s),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":e)))}function Up(e){function s($,q){if(e){var G=$.deletions;G===null?($.deletions=[q],$.flags|=16):G.push(q)}}function r($,q){if(!e)return null;for(;q!==null;)s($,q),q=q.sibling;return null}function o($){for(var q=new Map;$!==null;)$.key!==null?q.set($.key,$):q.set($.index,$),$=$.sibling;return q}function f($,q){return $=_s($,q),$.index=0,$.sibling=null,$}function g($,q,G){return $.index=G,e?(G=$.alternate,G!==null?(G=G.index,G<q?($.flags|=67108866,q):G):($.flags|=67108866,q)):($.flags|=1048576,q)}function j($){return e&&$.alternate===null&&($.flags|=67108866),$}function N($,q,G,ae){return q===null||q.tag!==6?(q=cu(G,$.mode,ae),q.return=$,q):(q=f(q,G),q.return=$,q)}function I($,q,G,ae){var Ne=G.type;return Ne===T?ne($,q,G.props.children,ae,G.key):q!==null&&(q.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===L&&Da(Ne)===q.type)?(q=f(q,G.props),ki(q,G),q.return=$,q):(q=Hl(G.type,G.key,G.props,null,$.mode,ae),ki(q,G),q.return=$,q)}function F($,q,G,ae){return q===null||q.tag!==4||q.stateNode.containerInfo!==G.containerInfo||q.stateNode.implementation!==G.implementation?(q=uu(G,$.mode,ae),q.return=$,q):(q=f(q,G.children||[]),q.return=$,q)}function ne($,q,G,ae,Ne){return q===null||q.tag!==7?(q=Ea(G,$.mode,ae,Ne),q.return=$,q):(q=f(q,G),q.return=$,q)}function le($,q,G){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return q=cu(""+q,$.mode,G),q.return=$,q;if(typeof q=="object"&&q!==null){switch(q.$$typeof){case _:return G=Hl(q.type,q.key,q.props,null,$.mode,G),ki(G,q),G.return=$,G;case k:return q=uu(q,$.mode,G),q.return=$,q;case L:return q=Da(q),le($,q,G)}if(ye(q)||re(q))return q=Ea(q,$.mode,G,null),q.return=$,q;if(typeof q.then=="function")return le($,Ql(q),G);if(q.$$typeof===D)return le($,Fl($,q),G);Zl($,q)}return null}function K($,q,G,ae){var Ne=q!==null?q.key:null;if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return Ne!==null?null:N($,q,""+G,ae);if(typeof G=="object"&&G!==null){switch(G.$$typeof){case _:return G.key===Ne?I($,q,G,ae):null;case k:return G.key===Ne?F($,q,G,ae):null;case L:return G=Da(G),K($,q,G,ae)}if(ye(G)||re(G))return Ne!==null?null:ne($,q,G,ae,null);if(typeof G.then=="function")return K($,q,Ql(G),ae);if(G.$$typeof===D)return K($,q,Fl($,G),ae);Zl($,G)}return null}function W($,q,G,ae,Ne){if(typeof ae=="string"&&ae!==""||typeof ae=="number"||typeof ae=="bigint")return $=$.get(G)||null,N(q,$,""+ae,Ne);if(typeof ae=="object"&&ae!==null){switch(ae.$$typeof){case _:return $=$.get(ae.key===null?G:ae.key)||null,I(q,$,ae,Ne);case k:return $=$.get(ae.key===null?G:ae.key)||null,F(q,$,ae,Ne);case L:return ae=Da(ae),W($,q,G,ae,Ne)}if(ye(ae)||re(ae))return $=$.get(G)||null,ne(q,$,ae,Ne,null);if(typeof ae.then=="function")return W($,q,G,Ql(ae),Ne);if(ae.$$typeof===D)return W($,q,G,Fl(q,ae),Ne);Zl(q,ae)}return null}function we($,q,G,ae){for(var Ne=null,Xe=null,ke=q,Me=q=0,Pe=null;ke!==null&&Me<G.length;Me++){ke.index>Me?(Pe=ke,ke=null):Pe=ke.sibling;var Qe=K($,ke,G[Me],ae);if(Qe===null){ke===null&&(ke=Pe);break}e&&ke&&Qe.alternate===null&&s($,ke),q=g(Qe,q,Me),Xe===null?Ne=Qe:Xe.sibling=Qe,Xe=Qe,ke=Pe}if(Me===G.length)return r($,ke),Ge&&Ss($,Me),Ne;if(ke===null){for(;Me<G.length;Me++)ke=le($,G[Me],ae),ke!==null&&(q=g(ke,q,Me),Xe===null?Ne=ke:Xe.sibling=ke,Xe=ke);return Ge&&Ss($,Me),Ne}for(ke=o(ke);Me<G.length;Me++)Pe=W(ke,$,Me,G[Me],ae),Pe!==null&&(e&&Pe.alternate!==null&&ke.delete(Pe.key===null?Me:Pe.key),q=g(Pe,q,Me),Xe===null?Ne=Pe:Xe.sibling=Pe,Xe=Pe);return e&&ke.forEach(function(fa){return s($,fa)}),Ge&&Ss($,Me),Ne}function Ae($,q,G,ae){if(G==null)throw Error(l(151));for(var Ne=null,Xe=null,ke=q,Me=q=0,Pe=null,Qe=G.next();ke!==null&&!Qe.done;Me++,Qe=G.next()){ke.index>Me?(Pe=ke,ke=null):Pe=ke.sibling;var fa=K($,ke,Qe.value,ae);if(fa===null){ke===null&&(ke=Pe);break}e&&ke&&fa.alternate===null&&s($,ke),q=g(fa,q,Me),Xe===null?Ne=fa:Xe.sibling=fa,Xe=fa,ke=Pe}if(Qe.done)return r($,ke),Ge&&Ss($,Me),Ne;if(ke===null){for(;!Qe.done;Me++,Qe=G.next())Qe=le($,Qe.value,ae),Qe!==null&&(q=g(Qe,q,Me),Xe===null?Ne=Qe:Xe.sibling=Qe,Xe=Qe);return Ge&&Ss($,Me),Ne}for(ke=o(ke);!Qe.done;Me++,Qe=G.next())Qe=W(ke,$,Me,Qe.value,ae),Qe!==null&&(e&&Qe.alternate!==null&&ke.delete(Qe.key===null?Me:Qe.key),q=g(Qe,q,Me),Xe===null?Ne=Qe:Xe.sibling=Qe,Xe=Qe);return e&&ke.forEach(function(wT){return s($,wT)}),Ge&&Ss($,Me),Ne}function it($,q,G,ae){if(typeof G=="object"&&G!==null&&G.type===T&&G.key===null&&(G=G.props.children),typeof G=="object"&&G!==null){switch(G.$$typeof){case _:e:{for(var Ne=G.key;q!==null;){if(q.key===Ne){if(Ne=G.type,Ne===T){if(q.tag===7){r($,q.sibling),ae=f(q,G.props.children),ae.return=$,$=ae;break e}}else if(q.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===L&&Da(Ne)===q.type){r($,q.sibling),ae=f(q,G.props),ki(ae,G),ae.return=$,$=ae;break e}r($,q);break}else s($,q);q=q.sibling}G.type===T?(ae=Ea(G.props.children,$.mode,ae,G.key),ae.return=$,$=ae):(ae=Hl(G.type,G.key,G.props,null,$.mode,ae),ki(ae,G),ae.return=$,$=ae)}return j($);case k:e:{for(Ne=G.key;q!==null;){if(q.key===Ne)if(q.tag===4&&q.stateNode.containerInfo===G.containerInfo&&q.stateNode.implementation===G.implementation){r($,q.sibling),ae=f(q,G.children||[]),ae.return=$,$=ae;break e}else{r($,q);break}else s($,q);q=q.sibling}ae=uu(G,$.mode,ae),ae.return=$,$=ae}return j($);case L:return G=Da(G),it($,q,G,ae)}if(ye(G))return we($,q,G,ae);if(re(G)){if(Ne=re(G),typeof Ne!="function")throw Error(l(150));return G=Ne.call(G),Ae($,q,G,ae)}if(typeof G.then=="function")return it($,q,Ql(G),ae);if(G.$$typeof===D)return it($,q,Fl($,G),ae);Zl($,G)}return typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint"?(G=""+G,q!==null&&q.tag===6?(r($,q.sibling),ae=f(q,G),ae.return=$,$=ae):(r($,q),ae=cu(G,$.mode,ae),ae.return=$,$=ae),j($)):r($,q)}return function($,q,G,ae){try{wi=0;var Ne=it($,q,G,ae);return xr=null,Ne}catch(ke){if(ke===vr||ke===Kl)throw ke;var Xe=mn(29,ke,null,$.mode);return Xe.lanes=ae,Xe.return=$,Xe}}}var za=Up(!0),Bp=Up(!1),Qs=!1;function Su(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ju(e,s){e=e.updateQueue,s.updateQueue===e&&(s.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Zs(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ws(e,s,r){var o=e.updateQueue;if(o===null)return null;if(o=o.shared,(We&2)!==0){var f=o.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),o.pending=s,s=Pl(e),jp(e,null,r),s}return $l(e,o,s,r),Pl(e)}function Ei(e,s,r){if(s=s.updateQueue,s!==null&&(s=s.shared,(r&4194048)!==0)){var o=s.lanes;o&=e.pendingLanes,r|=o,s.lanes=r,he(e,r)}}function Tu(e,s){var r=e.updateQueue,o=e.alternate;if(o!==null&&(o=o.updateQueue,r===o)){var f=null,g=null;if(r=r.firstBaseUpdate,r!==null){do{var j={lane:r.lane,tag:r.tag,payload:r.payload,callback:null,next:null};g===null?f=g=j:g=g.next=j,r=r.next}while(r!==null);g===null?f=g=s:g=g.next=s}else f=g=s;r={baseState:o.baseState,firstBaseUpdate:f,lastBaseUpdate:g,shared:o.shared,callbacks:o.callbacks},e.updateQueue=r;return}e=r.lastBaseUpdate,e===null?r.firstBaseUpdate=s:e.next=s,r.lastBaseUpdate=s}var wu=!1;function Ci(){if(wu){var e=yr;if(e!==null)throw e}}function Ni(e,s,r,o){wu=!1;var f=e.updateQueue;Qs=!1;var g=f.firstBaseUpdate,j=f.lastBaseUpdate,N=f.shared.pending;if(N!==null){f.shared.pending=null;var I=N,F=I.next;I.next=null,j===null?g=F:j.next=F,j=I;var ne=e.alternate;ne!==null&&(ne=ne.updateQueue,N=ne.lastBaseUpdate,N!==j&&(N===null?ne.firstBaseUpdate=F:N.next=F,ne.lastBaseUpdate=I))}if(g!==null){var le=f.baseState;j=0,ne=F=I=null,N=g;do{var K=N.lane&-536870913,W=K!==N.lane;if(W?($e&K)===K:(o&K)===K){K!==0&&K===gr&&(wu=!0),ne!==null&&(ne=ne.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var we=e,Ae=N;K=s;var it=r;switch(Ae.tag){case 1:if(we=Ae.payload,typeof we=="function"){le=we.call(it,le,K);break e}le=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Ae.payload,K=typeof we=="function"?we.call(it,le,K):we,K==null)break e;le=b({},le,K);break e;case 2:Qs=!0}}K=N.callback,K!==null&&(e.flags|=64,W&&(e.flags|=8192),W=f.callbacks,W===null?f.callbacks=[K]:W.push(K))}else W={lane:K,tag:N.tag,payload:N.payload,callback:N.callback,next:null},ne===null?(F=ne=W,I=le):ne=ne.next=W,j|=K;if(N=N.next,N===null){if(N=f.shared.pending,N===null)break;W=N,N=W.next,W.next=null,f.lastBaseUpdate=W,f.shared.pending=null}}while(!0);ne===null&&(I=le),f.baseState=I,f.firstBaseUpdate=F,f.lastBaseUpdate=ne,g===null&&(f.shared.lanes=0),sa|=j,e.lanes=j,e.memoizedState=le}}function $p(e,s){if(typeof e!="function")throw Error(l(191,e));e.call(s)}function Pp(e,s){var r=e.callbacks;if(r!==null)for(e.callbacks=null,e=0;e<r.length;e++)$p(r[e],s)}var br=M(null),Wl=M(0);function Hp(e,s){e=Os,de(Wl,e),de(br,s),Os=e|s.baseLanes}function ku(){de(Wl,Os),de(br,br.current)}function Eu(){Os=Wl.current,H(br),H(Wl)}var gn=M(null),Ln=null;function Js(e){var s=e.alternate;de(jt,jt.current&1),de(gn,e),Ln===null&&(s===null||br.current!==null||s.memoizedState!==null)&&(Ln=e)}function Cu(e){de(jt,jt.current),de(gn,e),Ln===null&&(Ln=e)}function Gp(e){e.tag===22?(de(jt,jt.current),de(gn,e),Ln===null&&(Ln=e)):ea()}function ea(){de(jt,jt.current),de(gn,gn.current)}function yn(e){H(gn),Ln===e&&(Ln=null),H(jt)}var jt=M(0);function Jl(e){for(var s=e;s!==null;){if(s.tag===13){var r=s.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||zd(r)||Ld(r)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var ws=0,ze=null,at=null,Ct=null,eo=!1,_r=!1,La=!1,to=0,Ai=0,Sr=null,mj=0;function _t(){throw Error(l(321))}function Nu(e,s){if(s===null)return!1;for(var r=0;r<s.length&&r<e.length;r++)if(!pn(e[r],s[r]))return!1;return!0}function Au(e,s,r,o,f,g){return ws=g,ze=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,B.H=e===null||e.memoizedState===null?Em:Vu,La=!1,g=r(o,f),La=!1,_r&&(g=Fp(s,r,o,f)),Vp(e),g}function Vp(e){B.H=Oi;var s=at!==null&&at.next!==null;if(ws=0,Ct=at=ze=null,eo=!1,Ai=0,Sr=null,s)throw Error(l(300));e===null||Nt||(e=e.dependencies,e!==null&&Vl(e)&&(Nt=!0))}function Fp(e,s,r,o){ze=e;var f=0;do{if(_r&&(Sr=null),Ai=0,_r=!1,25<=f)throw Error(l(301));if(f+=1,Ct=at=null,e.updateQueue!=null){var g=e.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}B.H=Cm,g=s(r,o)}while(_r);return g}function gj(){var e=B.H,s=e.useState()[0];return s=typeof s.then=="function"?Ri(s):s,e=e.useState()[0],(at!==null?at.memoizedState:null)!==e&&(ze.flags|=1024),s}function Ru(){var e=to!==0;return to=0,e}function Du(e,s,r){s.updateQueue=e.updateQueue,s.flags&=-2053,e.lanes&=~r}function Ou(e){if(eo){for(e=e.memoizedState;e!==null;){var s=e.queue;s!==null&&(s.pending=null),e=e.next}eo=!1}ws=0,Ct=at=ze=null,_r=!1,Ai=to=0,Sr=null}function en(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ct===null?ze.memoizedState=Ct=e:Ct=Ct.next=e,Ct}function Tt(){if(at===null){var e=ze.alternate;e=e!==null?e.memoizedState:null}else e=at.next;var s=Ct===null?ze.memoizedState:Ct.next;if(s!==null)Ct=s,at=e;else{if(e===null)throw ze.alternate===null?Error(l(467)):Error(l(310));at=e,e={memoizedState:at.memoizedState,baseState:at.baseState,baseQueue:at.baseQueue,queue:at.queue,next:null},Ct===null?ze.memoizedState=Ct=e:Ct=Ct.next=e}return Ct}function no(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ri(e){var s=Ai;return Ai+=1,Sr===null&&(Sr=[]),e=Mp(Sr,e,s),s=ze,(Ct===null?s.memoizedState:Ct.next)===null&&(s=s.alternate,B.H=s===null||s.memoizedState===null?Em:Vu),e}function so(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Ri(e);if(e.$$typeof===D)return Ft(e)}throw Error(l(438,String(e)))}function zu(e){var s=null,r=ze.updateQueue;if(r!==null&&(s=r.memoCache),s==null){var o=ze.alternate;o!==null&&(o=o.updateQueue,o!==null&&(o=o.memoCache,o!=null&&(s={data:o.data.map(function(f){return f.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),r===null&&(r=no(),ze.updateQueue=r),r.memoCache=s,r=s.data[s.index],r===void 0)for(r=s.data[s.index]=Array(e),o=0;o<e;o++)r[o]=Y;return s.index++,r}function ks(e,s){return typeof s=="function"?s(e):s}function ao(e){var s=Tt();return Lu(s,at,e)}function Lu(e,s,r){var o=e.queue;if(o===null)throw Error(l(311));o.lastRenderedReducer=r;var f=e.baseQueue,g=o.pending;if(g!==null){if(f!==null){var j=f.next;f.next=g.next,g.next=j}s.baseQueue=f=g,o.pending=null}if(g=e.baseState,f===null)e.memoizedState=g;else{s=f.next;var N=j=null,I=null,F=s,ne=!1;do{var le=F.lane&-536870913;if(le!==F.lane?($e&le)===le:(ws&le)===le){var K=F.revertLane;if(K===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null}),le===gr&&(ne=!0);else if((ws&K)===K){F=F.next,K===gr&&(ne=!0);continue}else le={lane:0,revertLane:F.revertLane,gesture:null,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},I===null?(N=I=le,j=g):I=I.next=le,ze.lanes|=K,sa|=K;le=F.action,La&&r(g,le),g=F.hasEagerState?F.eagerState:r(g,le)}else K={lane:le,revertLane:F.revertLane,gesture:F.gesture,action:F.action,hasEagerState:F.hasEagerState,eagerState:F.eagerState,next:null},I===null?(N=I=K,j=g):I=I.next=K,ze.lanes|=le,sa|=le;F=F.next}while(F!==null&&F!==s);if(I===null?j=g:I.next=N,!pn(g,e.memoizedState)&&(Nt=!0,ne&&(r=yr,r!==null)))throw r;e.memoizedState=g,e.baseState=j,e.baseQueue=I,o.lastRenderedState=g}return f===null&&(o.lanes=0),[e.memoizedState,o.dispatch]}function Mu(e){var s=Tt(),r=s.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=e;var o=r.dispatch,f=r.pending,g=s.memoizedState;if(f!==null){r.pending=null;var j=f=f.next;do g=e(g,j.action),j=j.next;while(j!==f);pn(g,s.memoizedState)||(Nt=!0),s.memoizedState=g,s.baseQueue===null&&(s.baseState=g),r.lastRenderedState=g}return[g,o]}function Yp(e,s,r){var o=ze,f=Tt(),g=Ge;if(g){if(r===void 0)throw Error(l(407));r=r()}else r=s();var j=!pn((at||f).memoizedState,r);if(j&&(f.memoizedState=r,Nt=!0),f=f.queue,Uu(Qp.bind(null,o,f,e),[e]),f.getSnapshot!==s||j||Ct!==null&&Ct.memoizedState.tag&1){if(o.flags|=2048,jr(9,{destroy:void 0},Xp.bind(null,o,f,r,s),null),ot===null)throw Error(l(349));g||(ws&127)!==0||Kp(o,s,r)}return r}function Kp(e,s,r){e.flags|=16384,e={getSnapshot:s,value:r},s=ze.updateQueue,s===null?(s=no(),ze.updateQueue=s,s.stores=[e]):(r=s.stores,r===null?s.stores=[e]:r.push(e))}function Xp(e,s,r,o){s.value=r,s.getSnapshot=o,Zp(s)&&Wp(e)}function Qp(e,s,r){return r(function(){Zp(s)&&Wp(e)})}function Zp(e){var s=e.getSnapshot;e=e.value;try{var r=s();return!pn(e,r)}catch{return!0}}function Wp(e){var s=ka(e,2);s!==null&&cn(s,e,2)}function Iu(e){var s=en();if(typeof e=="function"){var r=e;if(e=r(),La){kn(!0);try{r()}finally{kn(!1)}}}return s.memoizedState=s.baseState=e,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ks,lastRenderedState:e},s}function Jp(e,s,r,o){return e.baseState=r,Lu(e,at,typeof o=="function"?o:ks)}function yj(e,s,r,o,f){if(lo(e))throw Error(l(485));if(e=s.action,e!==null){var g={payload:f,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(j){g.listeners.push(j)}};B.T!==null?r(!0):g.isTransition=!1,o(g),r=s.pending,r===null?(g.next=s.pending=g,em(s,g)):(g.next=r.next,s.pending=r.next=g)}}function em(e,s){var r=s.action,o=s.payload,f=e.state;if(s.isTransition){var g=B.T,j={};B.T=j;try{var N=r(f,o),I=B.S;I!==null&&I(j,N),tm(e,s,N)}catch(F){qu(e,s,F)}finally{g!==null&&j.types!==null&&(g.types=j.types),B.T=g}}else try{g=r(f,o),tm(e,s,g)}catch(F){qu(e,s,F)}}function tm(e,s,r){r!==null&&typeof r=="object"&&typeof r.then=="function"?r.then(function(o){nm(e,s,o)},function(o){return qu(e,s,o)}):nm(e,s,r)}function nm(e,s,r){s.status="fulfilled",s.value=r,sm(s),e.state=r,s=e.pending,s!==null&&(r=s.next,r===s?e.pending=null:(r=r.next,s.next=r,em(e,r)))}function qu(e,s,r){var o=e.pending;if(e.pending=null,o!==null){o=o.next;do s.status="rejected",s.reason=r,sm(s),s=s.next;while(s!==o)}e.action=null}function sm(e){e=e.listeners;for(var s=0;s<e.length;s++)(0,e[s])()}function am(e,s){return s}function rm(e,s){if(Ge){var r=ot.formState;if(r!==null){e:{var o=ze;if(Ge){if(ut){t:{for(var f=ut,g=zn;f.nodeType!==8;){if(!g){f=null;break t}if(f=Mn(f.nextSibling),f===null){f=null;break t}}g=f.data,f=g==="F!"||g==="F"?f:null}if(f){ut=Mn(f.nextSibling),o=f.data==="F!";break e}}Ks(o)}o=!1}o&&(s=r[0])}}return r=en(),r.memoizedState=r.baseState=s,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:am,lastRenderedState:s},r.queue=o,r=Tm.bind(null,ze,o),o.dispatch=r,o=Iu(!1),g=Gu.bind(null,ze,!1,o.queue),o=en(),f={state:s,dispatch:null,action:e,pending:null},o.queue=f,r=yj.bind(null,ze,f,g,r),f.dispatch=r,o.memoizedState=e,[s,r,!1]}function im(e){var s=Tt();return lm(s,at,e)}function lm(e,s,r){if(s=Lu(e,s,am)[0],e=ao(ks)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var o=Ri(s)}catch(j){throw j===vr?Kl:j}else o=s;s=Tt();var f=s.queue,g=f.dispatch;return r!==s.memoizedState&&(ze.flags|=2048,jr(9,{destroy:void 0},vj.bind(null,f,r),null)),[o,g,e]}function vj(e,s){e.action=s}function om(e){var s=Tt(),r=at;if(r!==null)return lm(s,r,e);Tt(),s=s.memoizedState,r=Tt();var o=r.queue.dispatch;return r.memoizedState=e,[s,o,!1]}function jr(e,s,r,o){return e={tag:e,create:r,deps:o,inst:s,next:null},s=ze.updateQueue,s===null&&(s=no(),ze.updateQueue=s),r=s.lastEffect,r===null?s.lastEffect=e.next=e:(o=r.next,r.next=e,e.next=o,s.lastEffect=e),e}function cm(){return Tt().memoizedState}function ro(e,s,r,o){var f=en();ze.flags|=e,f.memoizedState=jr(1|s,{destroy:void 0},r,o===void 0?null:o)}function io(e,s,r,o){var f=Tt();o=o===void 0?null:o;var g=f.memoizedState.inst;at!==null&&o!==null&&Nu(o,at.memoizedState.deps)?f.memoizedState=jr(s,g,r,o):(ze.flags|=e,f.memoizedState=jr(1|s,g,r,o))}function um(e,s){ro(8390656,8,e,s)}function Uu(e,s){io(2048,8,e,s)}function xj(e){ze.flags|=4;var s=ze.updateQueue;if(s===null)s=no(),ze.updateQueue=s,s.events=[e];else{var r=s.events;r===null?s.events=[e]:r.push(e)}}function dm(e){var s=Tt().memoizedState;return xj({ref:s,nextImpl:e}),function(){if((We&2)!==0)throw Error(l(440));return s.impl.apply(void 0,arguments)}}function hm(e,s){return io(4,2,e,s)}function fm(e,s){return io(4,4,e,s)}function pm(e,s){if(typeof s=="function"){e=e();var r=s(e);return function(){typeof r=="function"?r():s(null)}}if(s!=null)return e=e(),s.current=e,function(){s.current=null}}function mm(e,s,r){r=r!=null?r.concat([e]):null,io(4,4,pm.bind(null,s,e),r)}function Bu(){}function gm(e,s){var r=Tt();s=s===void 0?null:s;var o=r.memoizedState;return s!==null&&Nu(s,o[1])?o[0]:(r.memoizedState=[e,s],e)}function ym(e,s){var r=Tt();s=s===void 0?null:s;var o=r.memoizedState;if(s!==null&&Nu(s,o[1]))return o[0];if(o=e(),La){kn(!0);try{e()}finally{kn(!1)}}return r.memoizedState=[o,s],o}function $u(e,s,r){return r===void 0||(ws&1073741824)!==0&&($e&261930)===0?e.memoizedState=s:(e.memoizedState=r,e=vg(),ze.lanes|=e,sa|=e,r)}function vm(e,s,r,o){return pn(r,s)?r:br.current!==null?(e=$u(e,r,o),pn(e,s)||(Nt=!0),e):(ws&42)===0||(ws&1073741824)!==0&&($e&261930)===0?(Nt=!0,e.memoizedState=r):(e=vg(),ze.lanes|=e,sa|=e,s)}function xm(e,s,r,o,f){var g=se.p;se.p=g!==0&&8>g?g:8;var j=B.T,N={};B.T=N,Gu(e,!1,s,r);try{var I=f(),F=B.S;if(F!==null&&F(N,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var ne=pj(I,o);Di(e,s,ne,bn(e))}else Di(e,s,o,bn(e))}catch(le){Di(e,s,{then:function(){},status:"rejected",reason:le},bn())}finally{se.p=g,j!==null&&N.types!==null&&(j.types=N.types),B.T=j}}function bj(){}function Pu(e,s,r,o){if(e.tag!==5)throw Error(l(476));var f=bm(e).queue;xm(e,f,s,ge,r===null?bj:function(){return _m(e),r(o)})}function bm(e){var s=e.memoizedState;if(s!==null)return s;s={memoizedState:ge,baseState:ge,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ks,lastRenderedState:ge},next:null};var r={};return s.next={memoizedState:r,baseState:r,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ks,lastRenderedState:r},next:null},e.memoizedState=s,e=e.alternate,e!==null&&(e.memoizedState=s),s}function _m(e){var s=bm(e);s.next===null&&(s=e.alternate.memoizedState),Di(e,s.next.queue,{},bn())}function Hu(){return Ft(Xi)}function Sm(){return Tt().memoizedState}function jm(){return Tt().memoizedState}function _j(e){for(var s=e.return;s!==null;){switch(s.tag){case 24:case 3:var r=bn();e=Zs(r);var o=Ws(s,e,r);o!==null&&(cn(o,s,r),Ei(o,s,r)),s={cache:vu()},e.payload=s;return}s=s.return}}function Sj(e,s,r){var o=bn();r={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},lo(e)?wm(s,r):(r=lu(e,s,r,o),r!==null&&(cn(r,e,o),km(r,s,o)))}function Tm(e,s,r){var o=bn();Di(e,s,r,o)}function Di(e,s,r,o){var f={lane:o,revertLane:0,gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null};if(lo(e))wm(s,f);else{var g=e.alternate;if(e.lanes===0&&(g===null||g.lanes===0)&&(g=s.lastRenderedReducer,g!==null))try{var j=s.lastRenderedState,N=g(j,r);if(f.hasEagerState=!0,f.eagerState=N,pn(N,j))return $l(e,s,f,0),ot===null&&Bl(),!1}catch{}if(r=lu(e,s,f,o),r!==null)return cn(r,e,o),km(r,s,o),!0}return!1}function Gu(e,s,r,o){if(o={lane:2,revertLane:Sd(),gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},lo(e)){if(s)throw Error(l(479))}else s=lu(e,r,o,2),s!==null&&cn(s,e,2)}function lo(e){var s=e.alternate;return e===ze||s!==null&&s===ze}function wm(e,s){_r=eo=!0;var r=e.pending;r===null?s.next=s:(s.next=r.next,r.next=s),e.pending=s}function km(e,s,r){if((r&4194048)!==0){var o=s.lanes;o&=e.pendingLanes,r|=o,s.lanes=r,he(e,r)}}var Oi={readContext:Ft,use:so,useCallback:_t,useContext:_t,useEffect:_t,useImperativeHandle:_t,useLayoutEffect:_t,useInsertionEffect:_t,useMemo:_t,useReducer:_t,useRef:_t,useState:_t,useDebugValue:_t,useDeferredValue:_t,useTransition:_t,useSyncExternalStore:_t,useId:_t,useHostTransitionStatus:_t,useFormState:_t,useActionState:_t,useOptimistic:_t,useMemoCache:_t,useCacheRefresh:_t};Oi.useEffectEvent=_t;var Em={readContext:Ft,use:so,useCallback:function(e,s){return en().memoizedState=[e,s===void 0?null:s],e},useContext:Ft,useEffect:um,useImperativeHandle:function(e,s,r){r=r!=null?r.concat([e]):null,ro(4194308,4,pm.bind(null,s,e),r)},useLayoutEffect:function(e,s){return ro(4194308,4,e,s)},useInsertionEffect:function(e,s){ro(4,2,e,s)},useMemo:function(e,s){var r=en();s=s===void 0?null:s;var o=e();if(La){kn(!0);try{e()}finally{kn(!1)}}return r.memoizedState=[o,s],o},useReducer:function(e,s,r){var o=en();if(r!==void 0){var f=r(s);if(La){kn(!0);try{r(s)}finally{kn(!1)}}}else f=s;return o.memoizedState=o.baseState=f,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:f},o.queue=e,e=e.dispatch=Sj.bind(null,ze,e),[o.memoizedState,e]},useRef:function(e){var s=en();return e={current:e},s.memoizedState=e},useState:function(e){e=Iu(e);var s=e.queue,r=Tm.bind(null,ze,s);return s.dispatch=r,[e.memoizedState,r]},useDebugValue:Bu,useDeferredValue:function(e,s){var r=en();return $u(r,e,s)},useTransition:function(){var e=Iu(!1);return e=xm.bind(null,ze,e.queue,!0,!1),en().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,s,r){var o=ze,f=en();if(Ge){if(r===void 0)throw Error(l(407));r=r()}else{if(r=s(),ot===null)throw Error(l(349));($e&127)!==0||Kp(o,s,r)}f.memoizedState=r;var g={value:r,getSnapshot:s};return f.queue=g,um(Qp.bind(null,o,g,e),[e]),o.flags|=2048,jr(9,{destroy:void 0},Xp.bind(null,o,g,r,s),null),r},useId:function(){var e=en(),s=ot.identifierPrefix;if(Ge){var r=is,o=rs;r=(o&~(1<<32-Ht(o)-1)).toString(32)+r,s="_"+s+"R_"+r,r=to++,0<r&&(s+="H"+r.toString(32)),s+="_"}else r=mj++,s="_"+s+"r_"+r.toString(32)+"_";return e.memoizedState=s},useHostTransitionStatus:Hu,useFormState:rm,useActionState:rm,useOptimistic:function(e){var s=en();s.memoizedState=s.baseState=e;var r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=r,s=Gu.bind(null,ze,!0,r),r.dispatch=s,[e,s]},useMemoCache:zu,useCacheRefresh:function(){return en().memoizedState=_j.bind(null,ze)},useEffectEvent:function(e){var s=en(),r={impl:e};return s.memoizedState=r,function(){if((We&2)!==0)throw Error(l(440));return r.impl.apply(void 0,arguments)}}},Vu={readContext:Ft,use:so,useCallback:gm,useContext:Ft,useEffect:Uu,useImperativeHandle:mm,useInsertionEffect:hm,useLayoutEffect:fm,useMemo:ym,useReducer:ao,useRef:cm,useState:function(){return ao(ks)},useDebugValue:Bu,useDeferredValue:function(e,s){var r=Tt();return vm(r,at.memoizedState,e,s)},useTransition:function(){var e=ao(ks)[0],s=Tt().memoizedState;return[typeof e=="boolean"?e:Ri(e),s]},useSyncExternalStore:Yp,useId:Sm,useHostTransitionStatus:Hu,useFormState:im,useActionState:im,useOptimistic:function(e,s){var r=Tt();return Jp(r,at,e,s)},useMemoCache:zu,useCacheRefresh:jm};Vu.useEffectEvent=dm;var Cm={readContext:Ft,use:so,useCallback:gm,useContext:Ft,useEffect:Uu,useImperativeHandle:mm,useInsertionEffect:hm,useLayoutEffect:fm,useMemo:ym,useReducer:Mu,useRef:cm,useState:function(){return Mu(ks)},useDebugValue:Bu,useDeferredValue:function(e,s){var r=Tt();return at===null?$u(r,e,s):vm(r,at.memoizedState,e,s)},useTransition:function(){var e=Mu(ks)[0],s=Tt().memoizedState;return[typeof e=="boolean"?e:Ri(e),s]},useSyncExternalStore:Yp,useId:Sm,useHostTransitionStatus:Hu,useFormState:om,useActionState:om,useOptimistic:function(e,s){var r=Tt();return at!==null?Jp(r,at,e,s):(r.baseState=e,[e,r.queue.dispatch])},useMemoCache:zu,useCacheRefresh:jm};Cm.useEffectEvent=dm;function Fu(e,s,r,o){s=e.memoizedState,r=r(o,s),r=r==null?s:b({},s,r),e.memoizedState=r,e.lanes===0&&(e.updateQueue.baseState=r)}var Yu={enqueueSetState:function(e,s,r){e=e._reactInternals;var o=bn(),f=Zs(o);f.payload=s,r!=null&&(f.callback=r),s=Ws(e,f,o),s!==null&&(cn(s,e,o),Ei(s,e,o))},enqueueReplaceState:function(e,s,r){e=e._reactInternals;var o=bn(),f=Zs(o);f.tag=1,f.payload=s,r!=null&&(f.callback=r),s=Ws(e,f,o),s!==null&&(cn(s,e,o),Ei(s,e,o))},enqueueForceUpdate:function(e,s){e=e._reactInternals;var r=bn(),o=Zs(r);o.tag=2,s!=null&&(o.callback=s),s=Ws(e,o,r),s!==null&&(cn(s,e,r),Ei(s,e,r))}};function Nm(e,s,r,o,f,g,j){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(o,g,j):s.prototype&&s.prototype.isPureReactComponent?!xi(r,o)||!xi(f,g):!0}function Am(e,s,r,o){e=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(r,o),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(r,o),s.state!==e&&Yu.enqueueReplaceState(s,s.state,null)}function Ma(e,s){var r=s;if("ref"in s){r={};for(var o in s)o!=="ref"&&(r[o]=s[o])}if(e=e.defaultProps){r===s&&(r=b({},r));for(var f in e)r[f]===void 0&&(r[f]=e[f])}return r}function Rm(e){Ul(e)}function Dm(e){console.error(e)}function Om(e){Ul(e)}function oo(e,s){try{var r=e.onUncaughtError;r(s.value,{componentStack:s.stack})}catch(o){setTimeout(function(){throw o})}}function zm(e,s,r){try{var o=e.onCaughtError;o(r.value,{componentStack:r.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Ku(e,s,r){return r=Zs(r),r.tag=3,r.payload={element:null},r.callback=function(){oo(e,s)},r}function Lm(e){return e=Zs(e),e.tag=3,e}function Mm(e,s,r,o){var f=r.type.getDerivedStateFromError;if(typeof f=="function"){var g=o.value;e.payload=function(){return f(g)},e.callback=function(){zm(s,r,o)}}var j=r.stateNode;j!==null&&typeof j.componentDidCatch=="function"&&(e.callback=function(){zm(s,r,o),typeof f!="function"&&(aa===null?aa=new Set([this]):aa.add(this));var N=o.stack;this.componentDidCatch(o.value,{componentStack:N!==null?N:""})})}function jj(e,s,r,o,f){if(r.flags|=32768,o!==null&&typeof o=="object"&&typeof o.then=="function"){if(s=r.alternate,s!==null&&mr(s,r,f,!0),r=gn.current,r!==null){switch(r.tag){case 31:case 13:return Ln===null?_o():r.alternate===null&&St===0&&(St=3),r.flags&=-257,r.flags|=65536,r.lanes=f,o===Xl?r.flags|=16384:(s=r.updateQueue,s===null?r.updateQueue=new Set([o]):s.add(o),xd(e,o,f)),!1;case 22:return r.flags|=65536,o===Xl?r.flags|=16384:(s=r.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([o])},r.updateQueue=s):(r=s.retryQueue,r===null?s.retryQueue=new Set([o]):r.add(o)),xd(e,o,f)),!1}throw Error(l(435,r.tag))}return xd(e,o,f),_o(),!1}if(Ge)return s=gn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=f,o!==fu&&(e=Error(l(422),{cause:o}),Si(Rn(e,r)))):(o!==fu&&(s=Error(l(423),{cause:o}),Si(Rn(s,r))),e=e.current.alternate,e.flags|=65536,f&=-f,e.lanes|=f,o=Rn(o,r),f=Ku(e.stateNode,o,f),Tu(e,f),St!==4&&(St=2)),!1;var g=Error(l(520),{cause:o});if(g=Rn(g,r),$i===null?$i=[g]:$i.push(g),St!==4&&(St=2),s===null)return!0;o=Rn(o,r),r=s;do{switch(r.tag){case 3:return r.flags|=65536,e=f&-f,r.lanes|=e,e=Ku(r.stateNode,o,e),Tu(r,e),!1;case 1:if(s=r.type,g=r.stateNode,(r.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(aa===null||!aa.has(g))))return r.flags|=65536,f&=-f,r.lanes|=f,f=Lm(f),Mm(f,e,r,o),Tu(r,f),!1}r=r.return}while(r!==null);return!1}var Xu=Error(l(461)),Nt=!1;function Yt(e,s,r,o){s.child=e===null?Bp(s,null,r,o):za(s,e.child,r,o)}function Im(e,s,r,o,f){r=r.render;var g=s.ref;if("ref"in o){var j={};for(var N in o)N!=="ref"&&(j[N]=o[N])}else j=o;return Aa(s),o=Au(e,s,r,j,g,f),N=Ru(),e!==null&&!Nt?(Du(e,s,f),Es(e,s,f)):(Ge&&N&&du(s),s.flags|=1,Yt(e,s,o,f),s.child)}function qm(e,s,r,o,f){if(e===null){var g=r.type;return typeof g=="function"&&!ou(g)&&g.defaultProps===void 0&&r.compare===null?(s.tag=15,s.type=g,Um(e,s,g,o,f)):(e=Hl(r.type,null,o,s,s.mode,f),e.ref=s.ref,e.return=s,s.child=e)}if(g=e.child,!sd(e,f)){var j=g.memoizedProps;if(r=r.compare,r=r!==null?r:xi,r(j,o)&&e.ref===s.ref)return Es(e,s,f)}return s.flags|=1,e=_s(g,o),e.ref=s.ref,e.return=s,s.child=e}function Um(e,s,r,o,f){if(e!==null){var g=e.memoizedProps;if(xi(g,o)&&e.ref===s.ref)if(Nt=!1,s.pendingProps=o=g,sd(e,f))(e.flags&131072)!==0&&(Nt=!0);else return s.lanes=e.lanes,Es(e,s,f)}return Qu(e,s,r,o,f)}function Bm(e,s,r,o){var f=o.children,g=e!==null?e.memoizedState:null;if(e===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.mode==="hidden"){if((s.flags&128)!==0){if(g=g!==null?g.baseLanes|r:r,e!==null){for(o=s.child=e.child,f=0;o!==null;)f=f|o.lanes|o.childLanes,o=o.sibling;o=f&~g}else o=0,s.child=null;return $m(e,s,g,r,o)}if((r&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},e!==null&&Yl(s,g!==null?g.cachePool:null),g!==null?Hp(s,g):ku(),Gp(s);else return o=s.lanes=536870912,$m(e,s,g!==null?g.baseLanes|r:r,r,o)}else g!==null?(Yl(s,g.cachePool),Hp(s,g),ea(),s.memoizedState=null):(e!==null&&Yl(s,null),ku(),ea());return Yt(e,s,f,r),s.child}function zi(e,s){return e!==null&&e.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function $m(e,s,r,o,f){var g=bu();return g=g===null?null:{parent:Et._currentValue,pool:g},s.memoizedState={baseLanes:r,cachePool:g},e!==null&&Yl(s,null),ku(),Gp(s),e!==null&&mr(e,s,o,!0),s.childLanes=f,null}function co(e,s){return s=ho({mode:s.mode,children:s.children},e.mode),s.ref=e.ref,e.child=s,s.return=e,s}function Pm(e,s,r){return za(s,e.child,null,r),e=co(s,s.pendingProps),e.flags|=2,yn(s),s.memoizedState=null,e}function Tj(e,s,r){var o=s.pendingProps,f=(s.flags&128)!==0;if(s.flags&=-129,e===null){if(Ge){if(o.mode==="hidden")return e=co(s,o),s.lanes=536870912,zi(null,e);if(Cu(s),(e=ut)?(e=ey(e,zn),e=e!==null&&e.data==="&"?e:null,e!==null&&(s.memoizedState={dehydrated:e,treeContext:Fs!==null?{id:rs,overflow:is}:null,retryLane:536870912,hydrationErrors:null},r=wp(e),r.return=s,s.child=r,Vt=s,ut=null)):e=null,e===null)throw Ks(s);return s.lanes=536870912,null}return co(s,o)}var g=e.memoizedState;if(g!==null){var j=g.dehydrated;if(Cu(s),f)if(s.flags&256)s.flags&=-257,s=Pm(e,s,r);else if(s.memoizedState!==null)s.child=e.child,s.flags|=128,s=null;else throw Error(l(558));else if(Nt||mr(e,s,r,!1),f=(r&e.childLanes)!==0,Nt||f){if(o=ot,o!==null&&(j=me(o,r),j!==0&&j!==g.retryLane))throw g.retryLane=j,ka(e,j),cn(o,e,j),Xu;_o(),s=Pm(e,s,r)}else e=g.treeContext,ut=Mn(j.nextSibling),Vt=s,Ge=!0,Ys=null,zn=!1,e!==null&&Cp(s,e),s=co(s,o),s.flags|=4096;return s}return e=_s(e.child,{mode:o.mode,children:o.children}),e.ref=s.ref,s.child=e,e.return=s,e}function uo(e,s){var r=s.ref;if(r===null)e!==null&&e.ref!==null&&(s.flags|=4194816);else{if(typeof r!="function"&&typeof r!="object")throw Error(l(284));(e===null||e.ref!==r)&&(s.flags|=4194816)}}function Qu(e,s,r,o,f){return Aa(s),r=Au(e,s,r,o,void 0,f),o=Ru(),e!==null&&!Nt?(Du(e,s,f),Es(e,s,f)):(Ge&&o&&du(s),s.flags|=1,Yt(e,s,r,f),s.child)}function Hm(e,s,r,o,f,g){return Aa(s),s.updateQueue=null,r=Fp(s,o,r,f),Vp(e),o=Ru(),e!==null&&!Nt?(Du(e,s,g),Es(e,s,g)):(Ge&&o&&du(s),s.flags|=1,Yt(e,s,r,g),s.child)}function Gm(e,s,r,o,f){if(Aa(s),s.stateNode===null){var g=dr,j=r.contextType;typeof j=="object"&&j!==null&&(g=Ft(j)),g=new r(o,g),s.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Yu,s.stateNode=g,g._reactInternals=s,g=s.stateNode,g.props=o,g.state=s.memoizedState,g.refs={},Su(s),j=r.contextType,g.context=typeof j=="object"&&j!==null?Ft(j):dr,g.state=s.memoizedState,j=r.getDerivedStateFromProps,typeof j=="function"&&(Fu(s,r,j,o),g.state=s.memoizedState),typeof r.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(j=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),j!==g.state&&Yu.enqueueReplaceState(g,g.state,null),Ni(s,o,g,f),Ci(),g.state=s.memoizedState),typeof g.componentDidMount=="function"&&(s.flags|=4194308),o=!0}else if(e===null){g=s.stateNode;var N=s.memoizedProps,I=Ma(r,N);g.props=I;var F=g.context,ne=r.contextType;j=dr,typeof ne=="object"&&ne!==null&&(j=Ft(ne));var le=r.getDerivedStateFromProps;ne=typeof le=="function"||typeof g.getSnapshotBeforeUpdate=="function",N=s.pendingProps!==N,ne||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(N||F!==j)&&Am(s,g,o,j),Qs=!1;var K=s.memoizedState;g.state=K,Ni(s,o,g,f),Ci(),F=s.memoizedState,N||K!==F||Qs?(typeof le=="function"&&(Fu(s,r,le,o),F=s.memoizedState),(I=Qs||Nm(s,r,I,o,K,F,j))?(ne||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(s.flags|=4194308)):(typeof g.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=o,s.memoizedState=F),g.props=o,g.state=F,g.context=j,o=I):(typeof g.componentDidMount=="function"&&(s.flags|=4194308),o=!1)}else{g=s.stateNode,ju(e,s),j=s.memoizedProps,ne=Ma(r,j),g.props=ne,le=s.pendingProps,K=g.context,F=r.contextType,I=dr,typeof F=="object"&&F!==null&&(I=Ft(F)),N=r.getDerivedStateFromProps,(F=typeof N=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(j!==le||K!==I)&&Am(s,g,o,I),Qs=!1,K=s.memoizedState,g.state=K,Ni(s,o,g,f),Ci();var W=s.memoizedState;j!==le||K!==W||Qs||e!==null&&e.dependencies!==null&&Vl(e.dependencies)?(typeof N=="function"&&(Fu(s,r,N,o),W=s.memoizedState),(ne=Qs||Nm(s,r,ne,o,K,W,I)||e!==null&&e.dependencies!==null&&Vl(e.dependencies))?(F||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(o,W,I),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(o,W,I)),typeof g.componentDidUpdate=="function"&&(s.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof g.componentDidUpdate!="function"||j===e.memoizedProps&&K===e.memoizedState||(s.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&K===e.memoizedState||(s.flags|=1024),s.memoizedProps=o,s.memoizedState=W),g.props=o,g.state=W,g.context=I,o=ne):(typeof g.componentDidUpdate!="function"||j===e.memoizedProps&&K===e.memoizedState||(s.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||j===e.memoizedProps&&K===e.memoizedState||(s.flags|=1024),o=!1)}return g=o,uo(e,s),o=(s.flags&128)!==0,g||o?(g=s.stateNode,r=o&&typeof r.getDerivedStateFromError!="function"?null:g.render(),s.flags|=1,e!==null&&o?(s.child=za(s,e.child,null,f),s.child=za(s,null,r,f)):Yt(e,s,r,f),s.memoizedState=g.state,e=s.child):e=Es(e,s,f),e}function Vm(e,s,r,o){return Ca(),s.flags|=256,Yt(e,s,r,o),s.child}var Zu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wu(e){return{baseLanes:e,cachePool:zp()}}function Ju(e,s,r){return e=e!==null?e.childLanes&~r:0,s&&(e|=xn),e}function Fm(e,s,r){var o=s.pendingProps,f=!1,g=(s.flags&128)!==0,j;if((j=g)||(j=e!==null&&e.memoizedState===null?!1:(jt.current&2)!==0),j&&(f=!0,s.flags&=-129),j=(s.flags&32)!==0,s.flags&=-33,e===null){if(Ge){if(f?Js(s):ea(),(e=ut)?(e=ey(e,zn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(s.memoizedState={dehydrated:e,treeContext:Fs!==null?{id:rs,overflow:is}:null,retryLane:536870912,hydrationErrors:null},r=wp(e),r.return=s,s.child=r,Vt=s,ut=null)):e=null,e===null)throw Ks(s);return Ld(e)?s.lanes=32:s.lanes=536870912,null}var N=o.children;return o=o.fallback,f?(ea(),f=s.mode,N=ho({mode:"hidden",children:N},f),o=Ea(o,f,r,null),N.return=s,o.return=s,N.sibling=o,s.child=N,o=s.child,o.memoizedState=Wu(r),o.childLanes=Ju(e,j,r),s.memoizedState=Zu,zi(null,o)):(Js(s),ed(s,N))}var I=e.memoizedState;if(I!==null&&(N=I.dehydrated,N!==null)){if(g)s.flags&256?(Js(s),s.flags&=-257,s=td(e,s,r)):s.memoizedState!==null?(ea(),s.child=e.child,s.flags|=128,s=null):(ea(),N=o.fallback,f=s.mode,o=ho({mode:"visible",children:o.children},f),N=Ea(N,f,r,null),N.flags|=2,o.return=s,N.return=s,o.sibling=N,s.child=o,za(s,e.child,null,r),o=s.child,o.memoizedState=Wu(r),o.childLanes=Ju(e,j,r),s.memoizedState=Zu,s=zi(null,o));else if(Js(s),Ld(N)){if(j=N.nextSibling&&N.nextSibling.dataset,j)var F=j.dgst;j=F,o=Error(l(419)),o.stack="",o.digest=j,Si({value:o,source:null,stack:null}),s=td(e,s,r)}else if(Nt||mr(e,s,r,!1),j=(r&e.childLanes)!==0,Nt||j){if(j=ot,j!==null&&(o=me(j,r),o!==0&&o!==I.retryLane))throw I.retryLane=o,ka(e,o),cn(j,e,o),Xu;zd(N)||_o(),s=td(e,s,r)}else zd(N)?(s.flags|=192,s.child=e.child,s=null):(e=I.treeContext,ut=Mn(N.nextSibling),Vt=s,Ge=!0,Ys=null,zn=!1,e!==null&&Cp(s,e),s=ed(s,o.children),s.flags|=4096);return s}return f?(ea(),N=o.fallback,f=s.mode,I=e.child,F=I.sibling,o=_s(I,{mode:"hidden",children:o.children}),o.subtreeFlags=I.subtreeFlags&65011712,F!==null?N=_s(F,N):(N=Ea(N,f,r,null),N.flags|=2),N.return=s,o.return=s,o.sibling=N,s.child=o,zi(null,o),o=s.child,N=e.child.memoizedState,N===null?N=Wu(r):(f=N.cachePool,f!==null?(I=Et._currentValue,f=f.parent!==I?{parent:I,pool:I}:f):f=zp(),N={baseLanes:N.baseLanes|r,cachePool:f}),o.memoizedState=N,o.childLanes=Ju(e,j,r),s.memoizedState=Zu,zi(e.child,o)):(Js(s),r=e.child,e=r.sibling,r=_s(r,{mode:"visible",children:o.children}),r.return=s,r.sibling=null,e!==null&&(j=s.deletions,j===null?(s.deletions=[e],s.flags|=16):j.push(e)),s.child=r,s.memoizedState=null,r)}function ed(e,s){return s=ho({mode:"visible",children:s},e.mode),s.return=e,e.child=s}function ho(e,s){return e=mn(22,e,null,s),e.lanes=0,e}function td(e,s,r){return za(s,e.child,null,r),e=ed(s,s.pendingProps.children),e.flags|=2,s.memoizedState=null,e}function Ym(e,s,r){e.lanes|=s;var o=e.alternate;o!==null&&(o.lanes|=s),gu(e.return,s,r)}function nd(e,s,r,o,f,g){var j=e.memoizedState;j===null?e.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:o,tail:r,tailMode:f,treeForkCount:g}:(j.isBackwards=s,j.rendering=null,j.renderingStartTime=0,j.last=o,j.tail=r,j.tailMode=f,j.treeForkCount=g)}function Km(e,s,r){var o=s.pendingProps,f=o.revealOrder,g=o.tail;o=o.children;var j=jt.current,N=(j&2)!==0;if(N?(j=j&1|2,s.flags|=128):j&=1,de(jt,j),Yt(e,s,o,r),o=Ge?_i:0,!N&&e!==null&&(e.flags&128)!==0)e:for(e=s.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ym(e,r,s);else if(e.tag===19)Ym(e,r,s);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===s)break e;for(;e.sibling===null;){if(e.return===null||e.return===s)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(f){case"forwards":for(r=s.child,f=null;r!==null;)e=r.alternate,e!==null&&Jl(e)===null&&(f=r),r=r.sibling;r=f,r===null?(f=s.child,s.child=null):(f=r.sibling,r.sibling=null),nd(s,!1,f,r,g,o);break;case"backwards":case"unstable_legacy-backwards":for(r=null,f=s.child,s.child=null;f!==null;){if(e=f.alternate,e!==null&&Jl(e)===null){s.child=f;break}e=f.sibling,f.sibling=r,r=f,f=e}nd(s,!0,r,null,g,o);break;case"together":nd(s,!1,null,null,void 0,o);break;default:s.memoizedState=null}return s.child}function Es(e,s,r){if(e!==null&&(s.dependencies=e.dependencies),sa|=s.lanes,(r&s.childLanes)===0)if(e!==null){if(mr(e,s,r,!1),(r&s.childLanes)===0)return null}else return null;if(e!==null&&s.child!==e.child)throw Error(l(153));if(s.child!==null){for(e=s.child,r=_s(e,e.pendingProps),s.child=r,r.return=s;e.sibling!==null;)e=e.sibling,r=r.sibling=_s(e,e.pendingProps),r.return=s;r.sibling=null}return s.child}function sd(e,s){return(e.lanes&s)!==0?!0:(e=e.dependencies,!!(e!==null&&Vl(e)))}function wj(e,s,r){switch(s.tag){case 3:be(s,s.stateNode.containerInfo),Xs(s,Et,e.memoizedState.cache),Ca();break;case 27:case 5:Ze(s);break;case 4:be(s,s.stateNode.containerInfo);break;case 10:Xs(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Cu(s),null;break;case 13:var o=s.memoizedState;if(o!==null)return o.dehydrated!==null?(Js(s),s.flags|=128,null):(r&s.child.childLanes)!==0?Fm(e,s,r):(Js(s),e=Es(e,s,r),e!==null?e.sibling:null);Js(s);break;case 19:var f=(e.flags&128)!==0;if(o=(r&s.childLanes)!==0,o||(mr(e,s,r,!1),o=(r&s.childLanes)!==0),f){if(o)return Km(e,s,r);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),de(jt,jt.current),o)break;return null;case 22:return s.lanes=0,Bm(e,s,r,s.pendingProps);case 24:Xs(s,Et,e.memoizedState.cache)}return Es(e,s,r)}function Xm(e,s,r){if(e!==null)if(e.memoizedProps!==s.pendingProps)Nt=!0;else{if(!sd(e,r)&&(s.flags&128)===0)return Nt=!1,wj(e,s,r);Nt=(e.flags&131072)!==0}else Nt=!1,Ge&&(s.flags&1048576)!==0&&Ep(s,_i,s.index);switch(s.lanes=0,s.tag){case 16:e:{var o=s.pendingProps;if(e=Da(s.elementType),s.type=e,typeof e=="function")ou(e)?(o=Ma(e,o),s.tag=1,s=Gm(null,s,e,o,r)):(s.tag=0,s=Qu(null,s,e,o,r));else{if(e!=null){var f=e.$$typeof;if(f===O){s.tag=11,s=Im(null,s,e,o,r);break e}else if(f===C){s.tag=14,s=qm(null,s,e,o,r);break e}}throw s=J(e)||e,Error(l(306,s,""))}}return s;case 0:return Qu(e,s,s.type,s.pendingProps,r);case 1:return o=s.type,f=Ma(o,s.pendingProps),Gm(e,s,o,f,r);case 3:e:{if(be(s,s.stateNode.containerInfo),e===null)throw Error(l(387));o=s.pendingProps;var g=s.memoizedState;f=g.element,ju(e,s),Ni(s,o,null,r);var j=s.memoizedState;if(o=j.cache,Xs(s,Et,o),o!==g.cache&&yu(s,[Et],r,!0),Ci(),o=j.element,g.isDehydrated)if(g={element:o,isDehydrated:!1,cache:j.cache},s.updateQueue.baseState=g,s.memoizedState=g,s.flags&256){s=Vm(e,s,o,r);break e}else if(o!==f){f=Rn(Error(l(424)),s),Si(f),s=Vm(e,s,o,r);break e}else for(e=s.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,ut=Mn(e.firstChild),Vt=s,Ge=!0,Ys=null,zn=!0,r=Bp(s,null,o,r),s.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Ca(),o===f){s=Es(e,s,r);break e}Yt(e,s,o,r)}s=s.child}return s;case 26:return uo(e,s),e===null?(r=iy(s.type,null,s.pendingProps,null))?s.memoizedState=r:Ge||(r=s.type,e=s.pendingProps,o=Co(ie.current).createElement(r),o[Je]=s,o[Gt]=e,Kt(o,r,e),Ut(o),s.stateNode=o):s.memoizedState=iy(s.type,e.memoizedProps,s.pendingProps,e.memoizedState),null;case 27:return Ze(s),e===null&&Ge&&(o=s.stateNode=sy(s.type,s.pendingProps,ie.current),Vt=s,zn=!0,f=ut,oa(s.type)?(Md=f,ut=Mn(o.firstChild)):ut=f),Yt(e,s,s.pendingProps.children,r),uo(e,s),e===null&&(s.flags|=4194304),s.child;case 5:return e===null&&Ge&&((f=o=ut)&&(o=tT(o,s.type,s.pendingProps,zn),o!==null?(s.stateNode=o,Vt=s,ut=Mn(o.firstChild),zn=!1,f=!0):f=!1),f||Ks(s)),Ze(s),f=s.type,g=s.pendingProps,j=e!==null?e.memoizedProps:null,o=g.children,Rd(f,g)?o=null:j!==null&&Rd(f,j)&&(s.flags|=32),s.memoizedState!==null&&(f=Au(e,s,gj,null,null,r),Xi._currentValue=f),uo(e,s),Yt(e,s,o,r),s.child;case 6:return e===null&&Ge&&((e=r=ut)&&(r=nT(r,s.pendingProps,zn),r!==null?(s.stateNode=r,Vt=s,ut=null,e=!0):e=!1),e||Ks(s)),null;case 13:return Fm(e,s,r);case 4:return be(s,s.stateNode.containerInfo),o=s.pendingProps,e===null?s.child=za(s,null,o,r):Yt(e,s,o,r),s.child;case 11:return Im(e,s,s.type,s.pendingProps,r);case 7:return Yt(e,s,s.pendingProps,r),s.child;case 8:return Yt(e,s,s.pendingProps.children,r),s.child;case 12:return Yt(e,s,s.pendingProps.children,r),s.child;case 10:return o=s.pendingProps,Xs(s,s.type,o.value),Yt(e,s,o.children,r),s.child;case 9:return f=s.type._context,o=s.pendingProps.children,Aa(s),f=Ft(f),o=o(f),s.flags|=1,Yt(e,s,o,r),s.child;case 14:return qm(e,s,s.type,s.pendingProps,r);case 15:return Um(e,s,s.type,s.pendingProps,r);case 19:return Km(e,s,r);case 31:return Tj(e,s,r);case 22:return Bm(e,s,r,s.pendingProps);case 24:return Aa(s),o=Ft(Et),e===null?(f=bu(),f===null&&(f=ot,g=vu(),f.pooledCache=g,g.refCount++,g!==null&&(f.pooledCacheLanes|=r),f=g),s.memoizedState={parent:o,cache:f},Su(s),Xs(s,Et,f)):((e.lanes&r)!==0&&(ju(e,s),Ni(s,null,null,r),Ci()),f=e.memoizedState,g=s.memoizedState,f.parent!==o?(f={parent:o,cache:o},s.memoizedState=f,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=f),Xs(s,Et,o)):(o=g.cache,Xs(s,Et,o),o!==f.cache&&yu(s,[Et],r,!0))),Yt(e,s,s.pendingProps.children,r),s.child;case 29:throw s.pendingProps}throw Error(l(156,s.tag))}function Cs(e){e.flags|=4}function ad(e,s,r,o,f){if((s=(e.mode&32)!==0)&&(s=!1),s){if(e.flags|=16777216,(f&335544128)===f)if(e.stateNode.complete)e.flags|=8192;else if(Sg())e.flags|=8192;else throw Oa=Xl,_u}else e.flags&=-16777217}function Qm(e,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!dy(s))if(Sg())e.flags|=8192;else throw Oa=Xl,_u}function fo(e,s){s!==null&&(e.flags|=4),e.flags&16384&&(s=e.tag!==22?oe():536870912,e.lanes|=s,Er|=s)}function Li(e,s){if(!Ge)switch(e.tailMode){case"hidden":s=e.tail;for(var r=null;s!==null;)s.alternate!==null&&(r=s),s=s.sibling;r===null?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var o=null;r!==null;)r.alternate!==null&&(o=r),r=r.sibling;o===null?s||e.tail===null?e.tail=null:e.tail.sibling=null:o.sibling=null}}function dt(e){var s=e.alternate!==null&&e.alternate.child===e.child,r=0,o=0;if(s)for(var f=e.child;f!==null;)r|=f.lanes|f.childLanes,o|=f.subtreeFlags&65011712,o|=f.flags&65011712,f.return=e,f=f.sibling;else for(f=e.child;f!==null;)r|=f.lanes|f.childLanes,o|=f.subtreeFlags,o|=f.flags,f.return=e,f=f.sibling;return e.subtreeFlags|=o,e.childLanes=r,s}function kj(e,s,r){var o=s.pendingProps;switch(hu(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(s),null;case 1:return dt(s),null;case 3:return r=s.stateNode,o=null,e!==null&&(o=e.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),Ts(Et),Re(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(pr(s)?Cs(s):e===null||e.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,pu())),dt(s),null;case 26:var f=s.type,g=s.memoizedState;return e===null?(Cs(s),g!==null?(dt(s),Qm(s,g)):(dt(s),ad(s,f,null,o,r))):g?g!==e.memoizedState?(Cs(s),dt(s),Qm(s,g)):(dt(s),s.flags&=-16777217):(e=e.memoizedProps,e!==o&&Cs(s),dt(s),ad(s,f,e,o,r)),null;case 27:if(It(s),r=ie.current,f=s.type,e!==null&&s.stateNode!=null)e.memoizedProps!==o&&Cs(s);else{if(!o){if(s.stateNode===null)throw Error(l(166));return dt(s),null}e=fe.current,pr(s)?Np(s):(e=sy(f,o,r),s.stateNode=e,Cs(s))}return dt(s),null;case 5:if(It(s),f=s.type,e!==null&&s.stateNode!=null)e.memoizedProps!==o&&Cs(s);else{if(!o){if(s.stateNode===null)throw Error(l(166));return dt(s),null}if(g=fe.current,pr(s))Np(s);else{var j=Co(ie.current);switch(g){case 1:g=j.createElementNS("http://www.w3.org/2000/svg",f);break;case 2:g=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;default:switch(f){case"svg":g=j.createElementNS("http://www.w3.org/2000/svg",f);break;case"math":g=j.createElementNS("http://www.w3.org/1998/Math/MathML",f);break;case"script":g=j.createElement("div"),g.innerHTML="<script><\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof o.is=="string"?j.createElement("select",{is:o.is}):j.createElement("select"),o.multiple?g.multiple=!0:o.size&&(g.size=o.size);break;default:g=typeof o.is=="string"?j.createElement(f,{is:o.is}):j.createElement(f)}}g[Je]=s,g[Gt]=o;e:for(j=s.child;j!==null;){if(j.tag===5||j.tag===6)g.appendChild(j.stateNode);else if(j.tag!==4&&j.tag!==27&&j.child!==null){j.child.return=j,j=j.child;continue}if(j===s)break e;for(;j.sibling===null;){if(j.return===null||j.return===s)break e;j=j.return}j.sibling.return=j.return,j=j.sibling}s.stateNode=g;e:switch(Kt(g,f,o),f){case"button":case"input":case"select":case"textarea":o=!!o.autoFocus;break e;case"img":o=!0;break e;default:o=!1}o&&Cs(s)}}return dt(s),ad(s,s.type,e===null?null:e.memoizedProps,s.pendingProps,r),null;case 6:if(e&&s.stateNode!=null)e.memoizedProps!==o&&Cs(s);else{if(typeof o!="string"&&s.stateNode===null)throw Error(l(166));if(e=ie.current,pr(s)){if(e=s.stateNode,r=s.memoizedProps,o=null,f=Vt,f!==null)switch(f.tag){case 27:case 5:o=f.memoizedProps}e[Je]=s,e=!!(e.nodeValue===r||o!==null&&o.suppressHydrationWarning===!0||Fg(e.nodeValue,r)),e||Ks(s,!0)}else e=Co(e).createTextNode(o),e[Je]=s,s.stateNode=e}return dt(s),null;case 31:if(r=s.memoizedState,e===null||e.memoizedState!==null){if(o=pr(s),r!==null){if(e===null){if(!o)throw Error(l(318));if(e=s.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[Je]=s}else Ca(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;dt(s),e=!1}else r=pu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=r),e=!0;if(!e)return s.flags&256?(yn(s),s):(yn(s),null);if((s.flags&128)!==0)throw Error(l(558))}return dt(s),null;case 13:if(o=s.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(f=pr(s),o!==null&&o.dehydrated!==null){if(e===null){if(!f)throw Error(l(318));if(f=s.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(l(317));f[Je]=s}else Ca(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;dt(s),f=!1}else f=pu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=f),f=!0;if(!f)return s.flags&256?(yn(s),s):(yn(s),null)}return yn(s),(s.flags&128)!==0?(s.lanes=r,s):(r=o!==null,e=e!==null&&e.memoizedState!==null,r&&(o=s.child,f=null,o.alternate!==null&&o.alternate.memoizedState!==null&&o.alternate.memoizedState.cachePool!==null&&(f=o.alternate.memoizedState.cachePool.pool),g=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(g=o.memoizedState.cachePool.pool),g!==f&&(o.flags|=2048)),r!==e&&r&&(s.child.flags|=8192),fo(s,s.updateQueue),dt(s),null);case 4:return Re(),e===null&&kd(s.stateNode.containerInfo),dt(s),null;case 10:return Ts(s.type),dt(s),null;case 19:if(H(jt),o=s.memoizedState,o===null)return dt(s),null;if(f=(s.flags&128)!==0,g=o.rendering,g===null)if(f)Li(o,!1);else{if(St!==0||e!==null&&(e.flags&128)!==0)for(e=s.child;e!==null;){if(g=Jl(e),g!==null){for(s.flags|=128,Li(o,!1),e=g.updateQueue,s.updateQueue=e,fo(s,e),s.subtreeFlags=0,e=r,r=s.child;r!==null;)Tp(r,e),r=r.sibling;return de(jt,jt.current&1|2),Ge&&Ss(s,o.treeForkCount),s.child}e=e.sibling}o.tail!==null&&mt()>vo&&(s.flags|=128,f=!0,Li(o,!1),s.lanes=4194304)}else{if(!f)if(e=Jl(g),e!==null){if(s.flags|=128,f=!0,e=e.updateQueue,s.updateQueue=e,fo(s,e),Li(o,!0),o.tail===null&&o.tailMode==="hidden"&&!g.alternate&&!Ge)return dt(s),null}else 2*mt()-o.renderingStartTime>vo&&r!==536870912&&(s.flags|=128,f=!0,Li(o,!1),s.lanes=4194304);o.isBackwards?(g.sibling=s.child,s.child=g):(e=o.last,e!==null?e.sibling=g:s.child=g,o.last=g)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=mt(),e.sibling=null,r=jt.current,de(jt,f?r&1|2:r&1),Ge&&Ss(s,o.treeForkCount),e):(dt(s),null);case 22:case 23:return yn(s),Eu(),o=s.memoizedState!==null,e!==null?e.memoizedState!==null!==o&&(s.flags|=8192):o&&(s.flags|=8192),o?(r&536870912)!==0&&(s.flags&128)===0&&(dt(s),s.subtreeFlags&6&&(s.flags|=8192)):dt(s),r=s.updateQueue,r!==null&&fo(s,r.retryQueue),r=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),o=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(o=s.memoizedState.cachePool.pool),o!==r&&(s.flags|=2048),e!==null&&H(Ra),null;case 24:return r=null,e!==null&&(r=e.memoizedState.cache),s.memoizedState.cache!==r&&(s.flags|=2048),Ts(Et),dt(s),null;case 25:return null;case 30:return null}throw Error(l(156,s.tag))}function Ej(e,s){switch(hu(s),s.tag){case 1:return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 3:return Ts(Et),Re(),e=s.flags,(e&65536)!==0&&(e&128)===0?(s.flags=e&-65537|128,s):null;case 26:case 27:case 5:return It(s),null;case 31:if(s.memoizedState!==null){if(yn(s),s.alternate===null)throw Error(l(340));Ca()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 13:if(yn(s),e=s.memoizedState,e!==null&&e.dehydrated!==null){if(s.alternate===null)throw Error(l(340));Ca()}return e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 19:return H(jt),null;case 4:return Re(),null;case 10:return Ts(s.type),null;case 22:case 23:return yn(s),Eu(),e!==null&&H(Ra),e=s.flags,e&65536?(s.flags=e&-65537|128,s):null;case 24:return Ts(Et),null;case 25:return null;default:return null}}function Zm(e,s){switch(hu(s),s.tag){case 3:Ts(Et),Re();break;case 26:case 27:case 5:It(s);break;case 4:Re();break;case 31:s.memoizedState!==null&&yn(s);break;case 13:yn(s);break;case 19:H(jt);break;case 10:Ts(s.type);break;case 22:case 23:yn(s),Eu(),e!==null&&H(Ra);break;case 24:Ts(Et)}}function Mi(e,s){try{var r=s.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var f=o.next;r=f;do{if((r.tag&e)===e){o=void 0;var g=r.create,j=r.inst;o=g(),j.destroy=o}r=r.next}while(r!==f)}}catch(N){st(s,s.return,N)}}function ta(e,s,r){try{var o=s.updateQueue,f=o!==null?o.lastEffect:null;if(f!==null){var g=f.next;o=g;do{if((o.tag&e)===e){var j=o.inst,N=j.destroy;if(N!==void 0){j.destroy=void 0,f=s;var I=r,F=N;try{F()}catch(ne){st(f,I,ne)}}}o=o.next}while(o!==g)}}catch(ne){st(s,s.return,ne)}}function Wm(e){var s=e.updateQueue;if(s!==null){var r=e.stateNode;try{Pp(s,r)}catch(o){st(e,e.return,o)}}}function Jm(e,s,r){r.props=Ma(e.type,e.memoizedProps),r.state=e.memoizedState;try{r.componentWillUnmount()}catch(o){st(e,s,o)}}function Ii(e,s){try{var r=e.ref;if(r!==null){switch(e.tag){case 26:case 27:case 5:var o=e.stateNode;break;case 30:o=e.stateNode;break;default:o=e.stateNode}typeof r=="function"?e.refCleanup=r(o):r.current=o}}catch(f){st(e,s,f)}}function ls(e,s){var r=e.ref,o=e.refCleanup;if(r!==null)if(typeof o=="function")try{o()}catch(f){st(e,s,f)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof r=="function")try{r(null)}catch(f){st(e,s,f)}else r.current=null}function eg(e){var s=e.type,r=e.memoizedProps,o=e.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":r.autoFocus&&o.focus();break e;case"img":r.src?o.src=r.src:r.srcSet&&(o.srcset=r.srcSet)}}catch(f){st(e,e.return,f)}}function rd(e,s,r){try{var o=e.stateNode;Xj(o,e.type,r,s),o[Gt]=s}catch(f){st(e,e.return,f)}}function tg(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&oa(e.type)||e.tag===4}function id(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||tg(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&oa(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ld(e,s,r){var o=e.tag;if(o===5||o===6)e=e.stateNode,s?(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r).insertBefore(e,s):(s=r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,s.appendChild(e),r=r._reactRootContainer,r!=null||s.onclick!==null||(s.onclick=xs));else if(o!==4&&(o===27&&oa(e.type)&&(r=e.stateNode,s=null),e=e.child,e!==null))for(ld(e,s,r),e=e.sibling;e!==null;)ld(e,s,r),e=e.sibling}function po(e,s,r){var o=e.tag;if(o===5||o===6)e=e.stateNode,s?r.insertBefore(e,s):r.appendChild(e);else if(o!==4&&(o===27&&oa(e.type)&&(r=e.stateNode),e=e.child,e!==null))for(po(e,s,r),e=e.sibling;e!==null;)po(e,s,r),e=e.sibling}function ng(e){var s=e.stateNode,r=e.memoizedProps;try{for(var o=e.type,f=s.attributes;f.length;)s.removeAttributeNode(f[0]);Kt(s,o,r),s[Je]=e,s[Gt]=r}catch(g){st(e,e.return,g)}}var Ns=!1,At=!1,od=!1,sg=typeof WeakSet=="function"?WeakSet:Set,Bt=null;function Cj(e,s){if(e=e.containerInfo,Nd=Lo,e=mp(e),tu(e)){if("selectionStart"in e)var r={start:e.selectionStart,end:e.selectionEnd};else e:{r=(r=e.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var f=o.anchorOffset,g=o.focusNode;o=o.focusOffset;try{r.nodeType,g.nodeType}catch{r=null;break e}var j=0,N=-1,I=-1,F=0,ne=0,le=e,K=null;t:for(;;){for(var W;le!==r||f!==0&&le.nodeType!==3||(N=j+f),le!==g||o!==0&&le.nodeType!==3||(I=j+o),le.nodeType===3&&(j+=le.nodeValue.length),(W=le.firstChild)!==null;)K=le,le=W;for(;;){if(le===e)break t;if(K===r&&++F===f&&(N=j),K===g&&++ne===o&&(I=j),(W=le.nextSibling)!==null)break;le=K,K=le.parentNode}le=W}r=N===-1||I===-1?null:{start:N,end:I}}else r=null}r=r||{start:0,end:0}}else r=null;for(Ad={focusedElem:e,selectionRange:r},Lo=!1,Bt=s;Bt!==null;)if(s=Bt,e=s.child,(s.subtreeFlags&1028)!==0&&e!==null)e.return=s,Bt=e;else for(;Bt!==null;){switch(s=Bt,g=s.alternate,e=s.flags,s.tag){case 0:if((e&4)!==0&&(e=s.updateQueue,e=e!==null?e.events:null,e!==null))for(r=0;r<e.length;r++)f=e[r],f.ref.impl=f.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&g!==null){e=void 0,r=s,f=g.memoizedProps,g=g.memoizedState,o=r.stateNode;try{var we=Ma(r.type,f);e=o.getSnapshotBeforeUpdate(we,g),o.__reactInternalSnapshotBeforeUpdate=e}catch(Ae){st(r,r.return,Ae)}}break;case 3:if((e&1024)!==0){if(e=s.stateNode.containerInfo,r=e.nodeType,r===9)Od(e);else if(r===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Od(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=s.sibling,e!==null){e.return=s.return,Bt=e;break}Bt=s.return}}function ag(e,s,r){var o=r.flags;switch(r.tag){case 0:case 11:case 15:Rs(e,r),o&4&&Mi(5,r);break;case 1:if(Rs(e,r),o&4)if(e=r.stateNode,s===null)try{e.componentDidMount()}catch(j){st(r,r.return,j)}else{var f=Ma(r.type,s.memoizedProps);s=s.memoizedState;try{e.componentDidUpdate(f,s,e.__reactInternalSnapshotBeforeUpdate)}catch(j){st(r,r.return,j)}}o&64&&Wm(r),o&512&&Ii(r,r.return);break;case 3:if(Rs(e,r),o&64&&(e=r.updateQueue,e!==null)){if(s=null,r.child!==null)switch(r.child.tag){case 27:case 5:s=r.child.stateNode;break;case 1:s=r.child.stateNode}try{Pp(e,s)}catch(j){st(r,r.return,j)}}break;case 27:s===null&&o&4&&ng(r);case 26:case 5:Rs(e,r),s===null&&o&4&&eg(r),o&512&&Ii(r,r.return);break;case 12:Rs(e,r);break;case 31:Rs(e,r),o&4&&lg(e,r);break;case 13:Rs(e,r),o&4&&og(e,r),o&64&&(e=r.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(r=Ij.bind(null,r),sT(e,r))));break;case 22:if(o=r.memoizedState!==null||Ns,!o){s=s!==null&&s.memoizedState!==null||At,f=Ns;var g=At;Ns=o,(At=s)&&!g?Ds(e,r,(r.subtreeFlags&8772)!==0):Rs(e,r),Ns=f,At=g}break;case 30:break;default:Rs(e,r)}}function rg(e){var s=e.alternate;s!==null&&(e.alternate=null,rg(s)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(s=e.stateNode,s!==null&&qc(s)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var ft=null,an=!1;function As(e,s,r){for(r=r.child;r!==null;)ig(e,s,r),r=r.sibling}function ig(e,s,r){if(Pt&&typeof Pt.onCommitFiberUnmount=="function")try{Pt.onCommitFiberUnmount(ys,r)}catch{}switch(r.tag){case 26:At||ls(r,s),As(e,s,r),r.memoizedState?r.memoizedState.count--:r.stateNode&&(r=r.stateNode,r.parentNode.removeChild(r));break;case 27:At||ls(r,s);var o=ft,f=an;oa(r.type)&&(ft=r.stateNode,an=!1),As(e,s,r),Fi(r.stateNode),ft=o,an=f;break;case 5:At||ls(r,s);case 6:if(o=ft,f=an,ft=null,As(e,s,r),ft=o,an=f,ft!==null)if(an)try{(ft.nodeType===9?ft.body:ft.nodeName==="HTML"?ft.ownerDocument.body:ft).removeChild(r.stateNode)}catch(g){st(r,s,g)}else try{ft.removeChild(r.stateNode)}catch(g){st(r,s,g)}break;case 18:ft!==null&&(an?(e=ft,Wg(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,r.stateNode),Lr(e)):Wg(ft,r.stateNode));break;case 4:o=ft,f=an,ft=r.stateNode.containerInfo,an=!0,As(e,s,r),ft=o,an=f;break;case 0:case 11:case 14:case 15:ta(2,r,s),At||ta(4,r,s),As(e,s,r);break;case 1:At||(ls(r,s),o=r.stateNode,typeof o.componentWillUnmount=="function"&&Jm(r,s,o)),As(e,s,r);break;case 21:As(e,s,r);break;case 22:At=(o=At)||r.memoizedState!==null,As(e,s,r),At=o;break;default:As(e,s,r)}}function lg(e,s){if(s.memoizedState===null&&(e=s.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lr(e)}catch(r){st(s,s.return,r)}}}function og(e,s){if(s.memoizedState===null&&(e=s.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lr(e)}catch(r){st(s,s.return,r)}}function Nj(e){switch(e.tag){case 31:case 13:case 19:var s=e.stateNode;return s===null&&(s=e.stateNode=new sg),s;case 22:return e=e.stateNode,s=e._retryCache,s===null&&(s=e._retryCache=new sg),s;default:throw Error(l(435,e.tag))}}function mo(e,s){var r=Nj(e);s.forEach(function(o){if(!r.has(o)){r.add(o);var f=qj.bind(null,e,o);o.then(f,f)}})}function rn(e,s){var r=s.deletions;if(r!==null)for(var o=0;o<r.length;o++){var f=r[o],g=e,j=s,N=j;e:for(;N!==null;){switch(N.tag){case 27:if(oa(N.type)){ft=N.stateNode,an=!1;break e}break;case 5:ft=N.stateNode,an=!1;break e;case 3:case 4:ft=N.stateNode.containerInfo,an=!0;break e}N=N.return}if(ft===null)throw Error(l(160));ig(g,j,f),ft=null,an=!1,g=f.alternate,g!==null&&(g.return=null),f.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)cg(s,e),s=s.sibling}var Kn=null;function cg(e,s){var r=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:rn(s,e),ln(e),o&4&&(ta(3,e,e.return),Mi(3,e),ta(5,e,e.return));break;case 1:rn(s,e),ln(e),o&512&&(At||r===null||ls(r,r.return)),o&64&&Ns&&(e=e.updateQueue,e!==null&&(o=e.callbacks,o!==null&&(r=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=r===null?o:r.concat(o))));break;case 26:var f=Kn;if(rn(s,e),ln(e),o&512&&(At||r===null||ls(r,r.return)),o&4){var g=r!==null?r.memoizedState:null;if(o=e.memoizedState,r===null)if(o===null)if(e.stateNode===null){e:{o=e.type,r=e.memoizedProps,f=f.ownerDocument||f;t:switch(o){case"title":g=f.getElementsByTagName("title")[0],(!g||g[ui]||g[Je]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=f.createElement(o),f.head.insertBefore(g,f.querySelector("head > title"))),Kt(g,o,r),g[Je]=e,Ut(g),o=g;break e;case"link":var j=cy("link","href",f).get(o+(r.href||""));if(j){for(var N=0;N<j.length;N++)if(g=j[N],g.getAttribute("href")===(r.href==null||r.href===""?null:r.href)&&g.getAttribute("rel")===(r.rel==null?null:r.rel)&&g.getAttribute("title")===(r.title==null?null:r.title)&&g.getAttribute("crossorigin")===(r.crossOrigin==null?null:r.crossOrigin)){j.splice(N,1);break t}}g=f.createElement(o),Kt(g,o,r),f.head.appendChild(g);break;case"meta":if(j=cy("meta","content",f).get(o+(r.content||""))){for(N=0;N<j.length;N++)if(g=j[N],g.getAttribute("content")===(r.content==null?null:""+r.content)&&g.getAttribute("name")===(r.name==null?null:r.name)&&g.getAttribute("property")===(r.property==null?null:r.property)&&g.getAttribute("http-equiv")===(r.httpEquiv==null?null:r.httpEquiv)&&g.getAttribute("charset")===(r.charSet==null?null:r.charSet)){j.splice(N,1);break t}}g=f.createElement(o),Kt(g,o,r),f.head.appendChild(g);break;default:throw Error(l(468,o))}g[Je]=e,Ut(g),o=g}e.stateNode=o}else uy(f,e.type,e.stateNode);else e.stateNode=oy(f,o,e.memoizedProps);else g!==o?(g===null?r.stateNode!==null&&(r=r.stateNode,r.parentNode.removeChild(r)):g.count--,o===null?uy(f,e.type,e.stateNode):oy(f,o,e.memoizedProps)):o===null&&e.stateNode!==null&&rd(e,e.memoizedProps,r.memoizedProps)}break;case 27:rn(s,e),ln(e),o&512&&(At||r===null||ls(r,r.return)),r!==null&&o&4&&rd(e,e.memoizedProps,r.memoizedProps);break;case 5:if(rn(s,e),ln(e),o&512&&(At||r===null||ls(r,r.return)),e.flags&32){f=e.stateNode;try{ar(f,"")}catch(we){st(e,e.return,we)}}o&4&&e.stateNode!=null&&(f=e.memoizedProps,rd(e,f,r!==null?r.memoizedProps:f)),o&1024&&(od=!0);break;case 6:if(rn(s,e),ln(e),o&4){if(e.stateNode===null)throw Error(l(162));o=e.memoizedProps,r=e.stateNode;try{r.nodeValue=o}catch(we){st(e,e.return,we)}}break;case 3:if(Ro=null,f=Kn,Kn=No(s.containerInfo),rn(s,e),Kn=f,ln(e),o&4&&r!==null&&r.memoizedState.isDehydrated)try{Lr(s.containerInfo)}catch(we){st(e,e.return,we)}od&&(od=!1,ug(e));break;case 4:o=Kn,Kn=No(e.stateNode.containerInfo),rn(s,e),ln(e),Kn=o;break;case 12:rn(s,e),ln(e);break;case 31:rn(s,e),ln(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,mo(e,o)));break;case 13:rn(s,e),ln(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(yo=mt()),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,mo(e,o)));break;case 22:f=e.memoizedState!==null;var I=r!==null&&r.memoizedState!==null,F=Ns,ne=At;if(Ns=F||f,At=ne||I,rn(s,e),At=ne,Ns=F,ln(e),o&8192)e:for(s=e.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,f&&(r===null||I||Ns||At||Ia(e)),r=null,s=e;;){if(s.tag===5||s.tag===26){if(r===null){I=r=s;try{if(g=I.stateNode,f)j=g.style,typeof j.setProperty=="function"?j.setProperty("display","none","important"):j.display="none";else{N=I.stateNode;var le=I.memoizedProps.style,K=le!=null&&le.hasOwnProperty("display")?le.display:null;N.style.display=K==null||typeof K=="boolean"?"":(""+K).trim()}}catch(we){st(I,I.return,we)}}}else if(s.tag===6){if(r===null){I=s;try{I.stateNode.nodeValue=f?"":I.memoizedProps}catch(we){st(I,I.return,we)}}}else if(s.tag===18){if(r===null){I=s;try{var W=I.stateNode;f?Jg(W,!0):Jg(I.stateNode,!1)}catch(we){st(I,I.return,we)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===e)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break e;for(;s.sibling===null;){if(s.return===null||s.return===e)break e;r===s&&(r=null),s=s.return}r===s&&(r=null),s.sibling.return=s.return,s=s.sibling}o&4&&(o=e.updateQueue,o!==null&&(r=o.retryQueue,r!==null&&(o.retryQueue=null,mo(e,r))));break;case 19:rn(s,e),ln(e),o&4&&(o=e.updateQueue,o!==null&&(e.updateQueue=null,mo(e,o)));break;case 30:break;case 21:break;default:rn(s,e),ln(e)}}function ln(e){var s=e.flags;if(s&2){try{for(var r,o=e.return;o!==null;){if(tg(o)){r=o;break}o=o.return}if(r==null)throw Error(l(160));switch(r.tag){case 27:var f=r.stateNode,g=id(e);po(e,g,f);break;case 5:var j=r.stateNode;r.flags&32&&(ar(j,""),r.flags&=-33);var N=id(e);po(e,N,j);break;case 3:case 4:var I=r.stateNode.containerInfo,F=id(e);ld(e,F,I);break;default:throw Error(l(161))}}catch(ne){st(e,e.return,ne)}e.flags&=-3}s&4096&&(e.flags&=-4097)}function ug(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var s=e;ug(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),e=e.sibling}}function Rs(e,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)ag(e,s.alternate,s),s=s.sibling}function Ia(e){for(e=e.child;e!==null;){var s=e;switch(s.tag){case 0:case 11:case 14:case 15:ta(4,s,s.return),Ia(s);break;case 1:ls(s,s.return);var r=s.stateNode;typeof r.componentWillUnmount=="function"&&Jm(s,s.return,r),Ia(s);break;case 27:Fi(s.stateNode);case 26:case 5:ls(s,s.return),Ia(s);break;case 22:s.memoizedState===null&&Ia(s);break;case 30:Ia(s);break;default:Ia(s)}e=e.sibling}}function Ds(e,s,r){for(r=r&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var o=s.alternate,f=e,g=s,j=g.flags;switch(g.tag){case 0:case 11:case 15:Ds(f,g,r),Mi(4,g);break;case 1:if(Ds(f,g,r),o=g,f=o.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(F){st(o,o.return,F)}if(o=g,f=o.updateQueue,f!==null){var N=o.stateNode;try{var I=f.shared.hiddenCallbacks;if(I!==null)for(f.shared.hiddenCallbacks=null,f=0;f<I.length;f++)$p(I[f],N)}catch(F){st(o,o.return,F)}}r&&j&64&&Wm(g),Ii(g,g.return);break;case 27:ng(g);case 26:case 5:Ds(f,g,r),r&&o===null&&j&4&&eg(g),Ii(g,g.return);break;case 12:Ds(f,g,r);break;case 31:Ds(f,g,r),r&&j&4&&lg(f,g);break;case 13:Ds(f,g,r),r&&j&4&&og(f,g);break;case 22:g.memoizedState===null&&Ds(f,g,r),Ii(g,g.return);break;case 30:break;default:Ds(f,g,r)}s=s.sibling}}function cd(e,s){var r=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),e=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(e=s.memoizedState.cachePool.pool),e!==r&&(e!=null&&e.refCount++,r!=null&&ji(r))}function ud(e,s){e=null,s.alternate!==null&&(e=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==e&&(s.refCount++,e!=null&&ji(e))}function Xn(e,s,r,o){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)dg(e,s,r,o),s=s.sibling}function dg(e,s,r,o){var f=s.flags;switch(s.tag){case 0:case 11:case 15:Xn(e,s,r,o),f&2048&&Mi(9,s);break;case 1:Xn(e,s,r,o);break;case 3:Xn(e,s,r,o),f&2048&&(e=null,s.alternate!==null&&(e=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==e&&(s.refCount++,e!=null&&ji(e)));break;case 12:if(f&2048){Xn(e,s,r,o),e=s.stateNode;try{var g=s.memoizedProps,j=g.id,N=g.onPostCommit;typeof N=="function"&&N(j,s.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(I){st(s,s.return,I)}}else Xn(e,s,r,o);break;case 31:Xn(e,s,r,o);break;case 13:Xn(e,s,r,o);break;case 23:break;case 22:g=s.stateNode,j=s.alternate,s.memoizedState!==null?g._visibility&2?Xn(e,s,r,o):qi(e,s):g._visibility&2?Xn(e,s,r,o):(g._visibility|=2,Tr(e,s,r,o,(s.subtreeFlags&10256)!==0||!1)),f&2048&&cd(j,s);break;case 24:Xn(e,s,r,o),f&2048&&ud(s.alternate,s);break;default:Xn(e,s,r,o)}}function Tr(e,s,r,o,f){for(f=f&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var g=e,j=s,N=r,I=o,F=j.flags;switch(j.tag){case 0:case 11:case 15:Tr(g,j,N,I,f),Mi(8,j);break;case 23:break;case 22:var ne=j.stateNode;j.memoizedState!==null?ne._visibility&2?Tr(g,j,N,I,f):qi(g,j):(ne._visibility|=2,Tr(g,j,N,I,f)),f&&F&2048&&cd(j.alternate,j);break;case 24:Tr(g,j,N,I,f),f&&F&2048&&ud(j.alternate,j);break;default:Tr(g,j,N,I,f)}s=s.sibling}}function qi(e,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var r=e,o=s,f=o.flags;switch(o.tag){case 22:qi(r,o),f&2048&&cd(o.alternate,o);break;case 24:qi(r,o),f&2048&&ud(o.alternate,o);break;default:qi(r,o)}s=s.sibling}}var Ui=8192;function wr(e,s,r){if(e.subtreeFlags&Ui)for(e=e.child;e!==null;)hg(e,s,r),e=e.sibling}function hg(e,s,r){switch(e.tag){case 26:wr(e,s,r),e.flags&Ui&&e.memoizedState!==null&&mT(r,Kn,e.memoizedState,e.memoizedProps);break;case 5:wr(e,s,r);break;case 3:case 4:var o=Kn;Kn=No(e.stateNode.containerInfo),wr(e,s,r),Kn=o;break;case 22:e.memoizedState===null&&(o=e.alternate,o!==null&&o.memoizedState!==null?(o=Ui,Ui=16777216,wr(e,s,r),Ui=o):wr(e,s,r));break;default:wr(e,s,r)}}function fg(e){var s=e.alternate;if(s!==null&&(e=s.child,e!==null)){s.child=null;do s=e.sibling,e.sibling=null,e=s;while(e!==null)}}function Bi(e){var s=e.deletions;if((e.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var o=s[r];Bt=o,mg(o,e)}fg(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)pg(e),e=e.sibling}function pg(e){switch(e.tag){case 0:case 11:case 15:Bi(e),e.flags&2048&&ta(9,e,e.return);break;case 3:Bi(e);break;case 12:Bi(e);break;case 22:var s=e.stateNode;e.memoizedState!==null&&s._visibility&2&&(e.return===null||e.return.tag!==13)?(s._visibility&=-3,go(e)):Bi(e);break;default:Bi(e)}}function go(e){var s=e.deletions;if((e.flags&16)!==0){if(s!==null)for(var r=0;r<s.length;r++){var o=s[r];Bt=o,mg(o,e)}fg(e)}for(e=e.child;e!==null;){switch(s=e,s.tag){case 0:case 11:case 15:ta(8,s,s.return),go(s);break;case 22:r=s.stateNode,r._visibility&2&&(r._visibility&=-3,go(s));break;default:go(s)}e=e.sibling}}function mg(e,s){for(;Bt!==null;){var r=Bt;switch(r.tag){case 0:case 11:case 15:ta(8,r,s);break;case 23:case 22:if(r.memoizedState!==null&&r.memoizedState.cachePool!==null){var o=r.memoizedState.cachePool.pool;o!=null&&o.refCount++}break;case 24:ji(r.memoizedState.cache)}if(o=r.child,o!==null)o.return=r,Bt=o;else e:for(r=e;Bt!==null;){o=Bt;var f=o.sibling,g=o.return;if(rg(o),o===r){Bt=null;break e}if(f!==null){f.return=g,Bt=f;break e}Bt=g}}}var Aj={getCacheForType:function(e){var s=Ft(Et),r=s.data.get(e);return r===void 0&&(r=e(),s.data.set(e,r)),r},cacheSignal:function(){return Ft(Et).controller.signal}},Rj=typeof WeakMap=="function"?WeakMap:Map,We=0,ot=null,qe=null,$e=0,nt=0,vn=null,na=!1,kr=!1,dd=!1,Os=0,St=0,sa=0,qa=0,hd=0,xn=0,Er=0,$i=null,on=null,fd=!1,yo=0,gg=0,vo=1/0,xo=null,aa=null,zt=0,ra=null,Cr=null,zs=0,pd=0,md=null,yg=null,Pi=0,gd=null;function bn(){return(We&2)!==0&&$e!==0?$e&-$e:B.T!==null?Sd():ba()}function vg(){if(xn===0)if(($e&536870912)===0||Ge){var e=hn;hn<<=1,(hn&3932160)===0&&(hn=262144),xn=e}else xn=536870912;return e=gn.current,e!==null&&(e.flags|=32),xn}function cn(e,s,r){(e===ot&&(nt===2||nt===9)||e.cancelPendingCommit!==null)&&(Nr(e,0),ia(e,$e,xn,!1)),Fe(e,r),((We&2)===0||e!==ot)&&(e===ot&&((We&2)===0&&(qa|=r),St===4&&ia(e,$e,xn,!1)),os(e))}function xg(e,s,r){if((We&6)!==0)throw Error(l(327));var o=!r&&(s&127)===0&&(s&e.expiredLanes)===0||En(e,s),f=o?zj(e,s):vd(e,s,!0),g=o;do{if(f===0){kr&&!o&&ia(e,s,0,!1);break}else{if(r=e.current.alternate,g&&!Dj(r)){f=vd(e,s,!1),g=!1;continue}if(f===2){if(g=s,e.errorRecoveryDisabledLanes&g)var j=0;else j=e.pendingLanes&-536870913,j=j!==0?j:j&536870912?536870912:0;if(j!==0){s=j;e:{var N=e;f=$i;var I=N.current.memoizedState.isDehydrated;if(I&&(Nr(N,j).flags|=256),j=vd(N,j,!1),j!==2){if(dd&&!I){N.errorRecoveryDisabledLanes|=g,qa|=g,f=4;break e}g=on,on=f,g!==null&&(on===null?on=g:on.push.apply(on,g))}f=j}if(g=!1,f!==2)continue}}if(f===1){Nr(e,0),ia(e,s,0,!0);break}e:{switch(o=e,g=f,g){case 0:case 1:throw Error(l(345));case 4:if((s&4194048)!==s)break;case 6:ia(o,s,xn,!na);break e;case 2:on=null;break;case 3:case 5:break;default:throw Error(l(329))}if((s&62914560)===s&&(f=yo+300-mt(),10<f)){if(ia(o,s,xn,!na),Ps(o,0,!0)!==0)break e;zs=s,o.timeoutHandle=Qg(bg.bind(null,o,r,on,xo,fd,s,xn,qa,Er,na,g,"Throttled",-0,0),f);break e}bg(o,r,on,xo,fd,s,xn,qa,Er,na,g,null,-0,0)}}break}while(!0);os(e)}function bg(e,s,r,o,f,g,j,N,I,F,ne,le,K,W){if(e.timeoutHandle=-1,le=s.subtreeFlags,le&8192||(le&16785408)===16785408){le={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xs},hg(s,g,le);var we=(g&62914560)===g?yo-mt():(g&4194048)===g?gg-mt():0;if(we=gT(le,we),we!==null){zs=g,e.cancelPendingCommit=we(Cg.bind(null,e,s,g,r,o,f,j,N,I,ne,le,null,K,W)),ia(e,g,j,!F);return}}Cg(e,s,g,r,o,f,j,N,I)}function Dj(e){for(var s=e;;){var r=s.tag;if((r===0||r===11||r===15)&&s.flags&16384&&(r=s.updateQueue,r!==null&&(r=r.stores,r!==null)))for(var o=0;o<r.length;o++){var f=r[o],g=f.getSnapshot;f=f.value;try{if(!pn(g(),f))return!1}catch{return!1}}if(r=s.child,s.subtreeFlags&16384&&r!==null)r.return=s,s=r;else{if(s===e)break;for(;s.sibling===null;){if(s.return===null||s.return===e)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function ia(e,s,r,o){s&=~hd,s&=~qa,e.suspendedLanes|=s,e.pingedLanes&=~s,o&&(e.warmLanes|=s),o=e.expirationTimes;for(var f=s;0<f;){var g=31-Ht(f),j=1<<g;o[g]=-1,f&=~j}r!==0&&Ot(e,r,s)}function bo(){return(We&6)===0?(Hi(0),!1):!0}function yd(){if(qe!==null){if(nt===0)var e=qe.return;else e=qe,js=Na=null,Ou(e),xr=null,wi=0,e=qe;for(;e!==null;)Zm(e.alternate,e),e=e.return;qe=null}}function Nr(e,s){var r=e.timeoutHandle;r!==-1&&(e.timeoutHandle=-1,Wj(r)),r=e.cancelPendingCommit,r!==null&&(e.cancelPendingCommit=null,r()),zs=0,yd(),ot=e,qe=r=_s(e.current,null),$e=s,nt=0,vn=null,na=!1,kr=En(e,s),dd=!1,Er=xn=hd=qa=sa=St=0,on=$i=null,fd=!1,(s&8)!==0&&(s|=s&32);var o=e.entangledLanes;if(o!==0)for(e=e.entanglements,o&=s;0<o;){var f=31-Ht(o),g=1<<f;s|=e[f],o&=~g}return Os=s,Bl(),r}function _g(e,s){ze=null,B.H=Oi,s===vr||s===Kl?(s=Ip(),nt=3):s===_u?(s=Ip(),nt=4):nt=s===Xu?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,vn=s,qe===null&&(St=1,oo(e,Rn(s,e.current)))}function Sg(){var e=gn.current;return e===null?!0:($e&4194048)===$e?Ln===null:($e&62914560)===$e||($e&536870912)!==0?e===Ln:!1}function jg(){var e=B.H;return B.H=Oi,e===null?Oi:e}function Tg(){var e=B.A;return B.A=Aj,e}function _o(){St=4,na||($e&4194048)!==$e&&gn.current!==null||(kr=!0),(sa&134217727)===0&&(qa&134217727)===0||ot===null||ia(ot,$e,xn,!1)}function vd(e,s,r){var o=We;We|=2;var f=jg(),g=Tg();(ot!==e||$e!==s)&&(xo=null,Nr(e,s)),s=!1;var j=St;e:do try{if(nt!==0&&qe!==null){var N=qe,I=vn;switch(nt){case 8:yd(),j=6;break e;case 3:case 2:case 9:case 6:gn.current===null&&(s=!0);var F=nt;if(nt=0,vn=null,Ar(e,N,I,F),r&&kr){j=0;break e}break;default:F=nt,nt=0,vn=null,Ar(e,N,I,F)}}Oj(),j=St;break}catch(ne){_g(e,ne)}while(!0);return s&&e.shellSuspendCounter++,js=Na=null,We=o,B.H=f,B.A=g,qe===null&&(ot=null,$e=0,Bl()),j}function Oj(){for(;qe!==null;)wg(qe)}function zj(e,s){var r=We;We|=2;var o=jg(),f=Tg();ot!==e||$e!==s?(xo=null,vo=mt()+500,Nr(e,s)):kr=En(e,s);e:do try{if(nt!==0&&qe!==null){s=qe;var g=vn;t:switch(nt){case 1:nt=0,vn=null,Ar(e,s,g,1);break;case 2:case 9:if(Lp(g)){nt=0,vn=null,kg(s);break}s=function(){nt!==2&&nt!==9||ot!==e||(nt=7),os(e)},g.then(s,s);break e;case 3:nt=7;break e;case 4:nt=5;break e;case 7:Lp(g)?(nt=0,vn=null,kg(s)):(nt=0,vn=null,Ar(e,s,g,7));break;case 5:var j=null;switch(qe.tag){case 26:j=qe.memoizedState;case 5:case 27:var N=qe;if(j?dy(j):N.stateNode.complete){nt=0,vn=null;var I=N.sibling;if(I!==null)qe=I;else{var F=N.return;F!==null?(qe=F,So(F)):qe=null}break t}}nt=0,vn=null,Ar(e,s,g,5);break;case 6:nt=0,vn=null,Ar(e,s,g,6);break;case 8:yd(),St=6;break e;default:throw Error(l(462))}}Lj();break}catch(ne){_g(e,ne)}while(!0);return js=Na=null,B.H=o,B.A=f,We=r,qe!==null?0:(ot=null,$e=0,Bl(),St)}function Lj(){for(;qe!==null&&!wn();)wg(qe)}function wg(e){var s=Xm(e.alternate,e,Os);e.memoizedProps=e.pendingProps,s===null?So(e):qe=s}function kg(e){var s=e,r=s.alternate;switch(s.tag){case 15:case 0:s=Hm(r,s,s.pendingProps,s.type,void 0,$e);break;case 11:s=Hm(r,s,s.pendingProps,s.type.render,s.ref,$e);break;case 5:Ou(s);default:Zm(r,s),s=qe=Tp(s,Os),s=Xm(r,s,Os)}e.memoizedProps=e.pendingProps,s===null?So(e):qe=s}function Ar(e,s,r,o){js=Na=null,Ou(s),xr=null,wi=0;var f=s.return;try{if(jj(e,f,s,r,$e)){St=1,oo(e,Rn(r,e.current)),qe=null;return}}catch(g){if(f!==null)throw qe=f,g;St=1,oo(e,Rn(r,e.current)),qe=null;return}s.flags&32768?(Ge||o===1?e=!0:kr||($e&536870912)!==0?e=!1:(na=e=!0,(o===2||o===9||o===3||o===6)&&(o=gn.current,o!==null&&o.tag===13&&(o.flags|=16384))),Eg(s,e)):So(s)}function So(e){var s=e;do{if((s.flags&32768)!==0){Eg(s,na);return}e=s.return;var r=kj(s.alternate,s,Os);if(r!==null){qe=r;return}if(s=s.sibling,s!==null){qe=s;return}qe=s=e}while(s!==null);St===0&&(St=5)}function Eg(e,s){do{var r=Ej(e.alternate,e);if(r!==null){r.flags&=32767,qe=r;return}if(r=e.return,r!==null&&(r.flags|=32768,r.subtreeFlags=0,r.deletions=null),!s&&(e=e.sibling,e!==null)){qe=e;return}qe=e=r}while(e!==null);St=6,qe=null}function Cg(e,s,r,o,f,g,j,N,I){e.cancelPendingCommit=null;do jo();while(zt!==0);if((We&6)!==0)throw Error(l(327));if(s!==null){if(s===e.current)throw Error(l(177));if(g=s.lanes|s.childLanes,g|=iu,bt(e,r,g,j,N,I),e===ot&&(qe=ot=null,$e=0),Cr=s,ra=e,zs=r,pd=g,md=f,yg=o,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Uj($s,function(){return Og(),null})):(e.callbackNode=null,e.callbackPriority=0),o=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||o){o=B.T,B.T=null,f=se.p,se.p=2,j=We,We|=4;try{Cj(e,s,r)}finally{We=j,se.p=f,B.T=o}}zt=1,Ng(),Ag(),Rg()}}function Ng(){if(zt===1){zt=0;var e=ra,s=Cr,r=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||r){r=B.T,B.T=null;var o=se.p;se.p=2;var f=We;We|=4;try{cg(s,e);var g=Ad,j=mp(e.containerInfo),N=g.focusedElem,I=g.selectionRange;if(j!==N&&N&&N.ownerDocument&&pp(N.ownerDocument.documentElement,N)){if(I!==null&&tu(N)){var F=I.start,ne=I.end;if(ne===void 0&&(ne=F),"selectionStart"in N)N.selectionStart=F,N.selectionEnd=Math.min(ne,N.value.length);else{var le=N.ownerDocument||document,K=le&&le.defaultView||window;if(K.getSelection){var W=K.getSelection(),we=N.textContent.length,Ae=Math.min(I.start,we),it=I.end===void 0?Ae:Math.min(I.end,we);!W.extend&&Ae>it&&(j=it,it=Ae,Ae=j);var $=fp(N,Ae),q=fp(N,it);if($&&q&&(W.rangeCount!==1||W.anchorNode!==$.node||W.anchorOffset!==$.offset||W.focusNode!==q.node||W.focusOffset!==q.offset)){var G=le.createRange();G.setStart($.node,$.offset),W.removeAllRanges(),Ae>it?(W.addRange(G),W.extend(q.node,q.offset)):(G.setEnd(q.node,q.offset),W.addRange(G))}}}}for(le=[],W=N;W=W.parentNode;)W.nodeType===1&&le.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<le.length;N++){var ae=le[N];ae.element.scrollLeft=ae.left,ae.element.scrollTop=ae.top}}Lo=!!Nd,Ad=Nd=null}finally{We=f,se.p=o,B.T=r}}e.current=s,zt=2}}function Ag(){if(zt===2){zt=0;var e=ra,s=Cr,r=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||r){r=B.T,B.T=null;var o=se.p;se.p=2;var f=We;We|=4;try{ag(e,s.alternate,s)}finally{We=f,se.p=o,B.T=r}}zt=3}}function Rg(){if(zt===4||zt===3){zt=0,kt();var e=ra,s=Cr,r=zs,o=yg;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?zt=5:(zt=0,Cr=ra=null,Dg(e,e.pendingLanes));var f=e.pendingLanes;if(f===0&&(aa=null),as(r),s=s.stateNode,Pt&&typeof Pt.onCommitFiberRoot=="function")try{Pt.onCommitFiberRoot(ys,s,void 0,(s.current.flags&128)===128)}catch{}if(o!==null){s=B.T,f=se.p,se.p=2,B.T=null;try{for(var g=e.onRecoverableError,j=0;j<o.length;j++){var N=o[j];g(N.value,{componentStack:N.stack})}}finally{B.T=s,se.p=f}}(zs&3)!==0&&jo(),os(e),f=e.pendingLanes,(r&261930)!==0&&(f&42)!==0?e===gd?Pi++:(Pi=0,gd=e):Pi=0,Hi(0)}}function Dg(e,s){(e.pooledCacheLanes&=s)===0&&(s=e.pooledCache,s!=null&&(e.pooledCache=null,ji(s)))}function jo(){return Ng(),Ag(),Rg(),Og()}function Og(){if(zt!==5)return!1;var e=ra,s=pd;pd=0;var r=as(zs),o=B.T,f=se.p;try{se.p=32>r?32:r,B.T=null,r=md,md=null;var g=ra,j=zs;if(zt=0,Cr=ra=null,zs=0,(We&6)!==0)throw Error(l(331));var N=We;if(We|=4,pg(g.current),dg(g,g.current,j,r),We=N,Hi(0,!1),Pt&&typeof Pt.onPostCommitFiberRoot=="function")try{Pt.onPostCommitFiberRoot(ys,g)}catch{}return!0}finally{se.p=f,B.T=o,Dg(e,s)}}function zg(e,s,r){s=Rn(r,s),s=Ku(e.stateNode,s,2),e=Ws(e,s,2),e!==null&&(Fe(e,2),os(e))}function st(e,s,r){if(e.tag===3)zg(e,e,r);else for(;s!==null;){if(s.tag===3){zg(s,e,r);break}else if(s.tag===1){var o=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof o.componentDidCatch=="function"&&(aa===null||!aa.has(o))){e=Rn(r,e),r=Lm(2),o=Ws(s,r,2),o!==null&&(Mm(r,o,s,e),Fe(o,2),os(o));break}}s=s.return}}function xd(e,s,r){var o=e.pingCache;if(o===null){o=e.pingCache=new Rj;var f=new Set;o.set(s,f)}else f=o.get(s),f===void 0&&(f=new Set,o.set(s,f));f.has(r)||(dd=!0,f.add(r),e=Mj.bind(null,e,s,r),s.then(e,e))}function Mj(e,s,r){var o=e.pingCache;o!==null&&o.delete(s),e.pingedLanes|=e.suspendedLanes&r,e.warmLanes&=~r,ot===e&&($e&r)===r&&(St===4||St===3&&($e&62914560)===$e&&300>mt()-yo?(We&2)===0&&Nr(e,0):hd|=r,Er===$e&&(Er=0)),os(e)}function Lg(e,s){s===0&&(s=oe()),e=ka(e,s),e!==null&&(Fe(e,s),os(e))}function Ij(e){var s=e.memoizedState,r=0;s!==null&&(r=s.retryLane),Lg(e,r)}function qj(e,s){var r=0;switch(e.tag){case 31:case 13:var o=e.stateNode,f=e.memoizedState;f!==null&&(r=f.retryLane);break;case 19:o=e.stateNode;break;case 22:o=e.stateNode._retryCache;break;default:throw Error(l(314))}o!==null&&o.delete(s),Lg(e,r)}function Uj(e,s){return ht(e,s)}var To=null,Rr=null,bd=!1,wo=!1,_d=!1,la=0;function os(e){e!==Rr&&e.next===null&&(Rr===null?To=Rr=e:Rr=Rr.next=e),wo=!0,bd||(bd=!0,$j())}function Hi(e,s){if(!_d&&wo){_d=!0;do for(var r=!1,o=To;o!==null;){if(e!==0){var f=o.pendingLanes;if(f===0)var g=0;else{var j=o.suspendedLanes,N=o.pingedLanes;g=(1<<31-Ht(42|e)+1)-1,g&=f&~(j&~N),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(r=!0,Ug(o,g))}else g=$e,g=Ps(o,o===ot?g:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),(g&3)===0||En(o,g)||(r=!0,Ug(o,g));o=o.next}while(r);_d=!1}}function Bj(){Mg()}function Mg(){wo=bd=!1;var e=0;la!==0&&Zj()&&(e=la);for(var s=mt(),r=null,o=To;o!==null;){var f=o.next,g=Ig(o,s);g===0?(o.next=null,r===null?To=f:r.next=f,f===null&&(Rr=r)):(r=o,(e!==0||(g&3)!==0)&&(wo=!0)),o=f}zt!==0&&zt!==5||Hi(e),la!==0&&(la=0)}function Ig(e,s){for(var r=e.suspendedLanes,o=e.pingedLanes,f=e.expirationTimes,g=e.pendingLanes&-62914561;0<g;){var j=31-Ht(g),N=1<<j,I=f[j];I===-1?((N&r)===0||(N&o)!==0)&&(f[j]=Hs(N,s)):I<=s&&(e.expiredLanes|=N),g&=~N}if(s=ot,r=$e,r=Ps(e,e===s?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o=e.callbackNode,r===0||e===s&&(nt===2||nt===9)||e.cancelPendingCommit!==null)return o!==null&&o!==null&&qt(o),e.callbackNode=null,e.callbackPriority=0;if((r&3)===0||En(e,r)){if(s=r&-r,s===e.callbackPriority)return s;switch(o!==null&&qt(o),as(r)){case 2:case 8:r=xa;break;case 32:r=$s;break;case 268435456:r=Wa;break;default:r=$s}return o=qg.bind(null,e),r=ht(r,o),e.callbackPriority=s,e.callbackNode=r,s}return o!==null&&o!==null&&qt(o),e.callbackPriority=2,e.callbackNode=null,2}function qg(e,s){if(zt!==0&&zt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var r=e.callbackNode;if(jo()&&e.callbackNode!==r)return null;var o=$e;return o=Ps(e,e===ot?o:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),o===0?null:(xg(e,o,s),Ig(e,mt()),e.callbackNode!=null&&e.callbackNode===r?qg.bind(null,e):null)}function Ug(e,s){if(jo())return null;xg(e,s,!0)}function $j(){Jj(function(){(We&6)!==0?ht(gs,Bj):Mg()})}function Sd(){if(la===0){var e=gr;e===0&&(e=Vn,Vn<<=1,(Vn&261888)===0&&(Vn=256)),la=e}return la}function Bg(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Dl(""+e)}function $g(e,s){var r=s.ownerDocument.createElement("input");return r.name=s.name,r.value=s.value,e.id&&r.setAttribute("form",e.id),s.parentNode.insertBefore(r,s),e=new FormData(e),r.parentNode.removeChild(r),e}function Pj(e,s,r,o,f){if(s==="submit"&&r&&r.stateNode===f){var g=Bg((f[Gt]||null).action),j=o.submitter;j&&(s=(s=j[Gt]||null)?Bg(s.formAction):j.getAttribute("formAction"),s!==null&&(g=s,j=null));var N=new Ml("action","action",null,o,f);e.push({event:N,listeners:[{instance:null,listener:function(){if(o.defaultPrevented){if(la!==0){var I=j?$g(f,j):new FormData(f);Pu(r,{pending:!0,data:I,method:f.method,action:g},null,I)}}else typeof g=="function"&&(N.preventDefault(),I=j?$g(f,j):new FormData(f),Pu(r,{pending:!0,data:I,method:f.method,action:g},g,I))},currentTarget:f}]})}}for(var jd=0;jd<ru.length;jd++){var Td=ru[jd],Hj=Td.toLowerCase(),Gj=Td[0].toUpperCase()+Td.slice(1);Yn(Hj,"on"+Gj)}Yn(vp,"onAnimationEnd"),Yn(xp,"onAnimationIteration"),Yn(bp,"onAnimationStart"),Yn("dblclick","onDoubleClick"),Yn("focusin","onFocus"),Yn("focusout","onBlur"),Yn(ij,"onTransitionRun"),Yn(lj,"onTransitionStart"),Yn(oj,"onTransitionCancel"),Yn(_p,"onTransitionEnd"),nr("onMouseEnter",["mouseout","mouseover"]),nr("onMouseLeave",["mouseout","mouseover"]),nr("onPointerEnter",["pointerout","pointerover"]),nr("onPointerLeave",["pointerout","pointerover"]),Sa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Sa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Sa("onBeforeInput",["compositionend","keypress","textInput","paste"]),Sa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Sa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Gi="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Vj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Gi));function Pg(e,s){s=(s&4)!==0;for(var r=0;r<e.length;r++){var o=e[r],f=o.event;o=o.listeners;e:{var g=void 0;if(s)for(var j=o.length-1;0<=j;j--){var N=o[j],I=N.instance,F=N.currentTarget;if(N=N.listener,I!==g&&f.isPropagationStopped())break e;g=N,f.currentTarget=F;try{g(f)}catch(ne){Ul(ne)}f.currentTarget=null,g=I}else for(j=0;j<o.length;j++){if(N=o[j],I=N.instance,F=N.currentTarget,N=N.listener,I!==g&&f.isPropagationStopped())break e;g=N,f.currentTarget=F;try{g(f)}catch(ne){Ul(ne)}f.currentTarget=null,g=I}}}}function Ue(e,s){var r=s[Ic];r===void 0&&(r=s[Ic]=new Set);var o=e+"__bubble";r.has(o)||(Hg(s,e,2,!1),r.add(o))}function wd(e,s,r){var o=0;s&&(o|=4),Hg(r,e,o,s)}var ko="_reactListening"+Math.random().toString(36).slice(2);function kd(e){if(!e[ko]){e[ko]=!0,Mf.forEach(function(r){r!=="selectionchange"&&(Vj.has(r)||wd(r,!1,e),wd(r,!0,e))});var s=e.nodeType===9?e:e.ownerDocument;s===null||s[ko]||(s[ko]=!0,wd("selectionchange",!1,s))}}function Hg(e,s,r,o){switch(vy(s)){case 2:var f=xT;break;case 8:f=bT;break;default:f=$d}r=f.bind(null,s,r,e),f=void 0,!Fc||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),o?f!==void 0?e.addEventListener(s,r,{capture:!0,passive:f}):e.addEventListener(s,r,!0):f!==void 0?e.addEventListener(s,r,{passive:f}):e.addEventListener(s,r,!1)}function Ed(e,s,r,o,f){var g=o;if((s&1)===0&&(s&2)===0&&o!==null)e:for(;;){if(o===null)return;var j=o.tag;if(j===3||j===4){var N=o.stateNode.containerInfo;if(N===f)break;if(j===4)for(j=o.return;j!==null;){var I=j.tag;if((I===3||I===4)&&j.stateNode.containerInfo===f)return;j=j.return}for(;N!==null;){if(j=Ja(N),j===null)return;if(I=j.tag,I===5||I===6||I===26||I===27){o=g=j;continue e}N=N.parentNode}}o=o.return}Kf(function(){var F=g,ne=Gc(r),le=[];e:{var K=Sp.get(e);if(K!==void 0){var W=Ml,we=e;switch(e){case"keypress":if(zl(r)===0)break e;case"keydown":case"keyup":W=qS;break;case"focusin":we="focus",W=Qc;break;case"focusout":we="blur",W=Qc;break;case"beforeblur":case"afterblur":W=Qc;break;case"click":if(r.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":W=Zf;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":W=kS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":W=$S;break;case vp:case xp:case bp:W=NS;break;case _p:W=HS;break;case"scroll":case"scrollend":W=TS;break;case"wheel":W=VS;break;case"copy":case"cut":case"paste":W=RS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":W=Jf;break;case"toggle":case"beforetoggle":W=YS}var Ae=(s&4)!==0,it=!Ae&&(e==="scroll"||e==="scrollend"),$=Ae?K!==null?K+"Capture":null:K;Ae=[];for(var q=F,G;q!==null;){var ae=q;if(G=ae.stateNode,ae=ae.tag,ae!==5&&ae!==26&&ae!==27||G===null||$===null||(ae=hi(q,$),ae!=null&&Ae.push(Vi(q,ae,G))),it)break;q=q.return}0<Ae.length&&(K=new W(K,we,null,r,ne),le.push({event:K,listeners:Ae}))}}if((s&7)===0){e:{if(K=e==="mouseover"||e==="pointerover",W=e==="mouseout"||e==="pointerout",K&&r!==Hc&&(we=r.relatedTarget||r.fromElement)&&(Ja(we)||we[Gs]))break e;if((W||K)&&(K=ne.window===ne?ne:(K=ne.ownerDocument)?K.defaultView||K.parentWindow:window,W?(we=r.relatedTarget||r.toElement,W=F,we=we?Ja(we):null,we!==null&&(it=u(we),Ae=we.tag,we!==it||Ae!==5&&Ae!==27&&Ae!==6)&&(we=null)):(W=null,we=F),W!==we)){if(Ae=Zf,ae="onMouseLeave",$="onMouseEnter",q="mouse",(e==="pointerout"||e==="pointerover")&&(Ae=Jf,ae="onPointerLeave",$="onPointerEnter",q="pointer"),it=W==null?K:di(W),G=we==null?K:di(we),K=new Ae(ae,q+"leave",W,r,ne),K.target=it,K.relatedTarget=G,ae=null,Ja(ne)===F&&(Ae=new Ae($,q+"enter",we,r,ne),Ae.target=G,Ae.relatedTarget=it,ae=Ae),it=ae,W&&we)t:{for(Ae=Fj,$=W,q=we,G=0,ae=$;ae;ae=Ae(ae))G++;ae=0;for(var Ne=q;Ne;Ne=Ae(Ne))ae++;for(;0<G-ae;)$=Ae($),G--;for(;0<ae-G;)q=Ae(q),ae--;for(;G--;){if($===q||q!==null&&$===q.alternate){Ae=$;break t}$=Ae($),q=Ae(q)}Ae=null}else Ae=null;W!==null&&Gg(le,K,W,Ae,!1),we!==null&&it!==null&&Gg(le,it,we,Ae,!0)}}e:{if(K=F?di(F):window,W=K.nodeName&&K.nodeName.toLowerCase(),W==="select"||W==="input"&&K.type==="file")var Xe=lp;else if(rp(K))if(op)Xe=sj;else{Xe=tj;var ke=ej}else W=K.nodeName,!W||W.toLowerCase()!=="input"||K.type!=="checkbox"&&K.type!=="radio"?F&&Pc(F.elementType)&&(Xe=lp):Xe=nj;if(Xe&&(Xe=Xe(e,F))){ip(le,Xe,r,ne);break e}ke&&ke(e,K,F),e==="focusout"&&F&&K.type==="number"&&F.memoizedProps.value!=null&&$c(K,"number",K.value)}switch(ke=F?di(F):window,e){case"focusin":(rp(ke)||ke.contentEditable==="true")&&(or=ke,nu=F,bi=null);break;case"focusout":bi=nu=or=null;break;case"mousedown":su=!0;break;case"contextmenu":case"mouseup":case"dragend":su=!1,gp(le,r,ne);break;case"selectionchange":if(rj)break;case"keydown":case"keyup":gp(le,r,ne)}var Me;if(Wc)e:{switch(e){case"compositionstart":var Pe="onCompositionStart";break e;case"compositionend":Pe="onCompositionEnd";break e;case"compositionupdate":Pe="onCompositionUpdate";break e}Pe=void 0}else lr?sp(e,r)&&(Pe="onCompositionEnd"):e==="keydown"&&r.keyCode===229&&(Pe="onCompositionStart");Pe&&(ep&&r.locale!=="ko"&&(lr||Pe!=="onCompositionStart"?Pe==="onCompositionEnd"&&lr&&(Me=Xf()):(Vs=ne,Yc="value"in Vs?Vs.value:Vs.textContent,lr=!0)),ke=Eo(F,Pe),0<ke.length&&(Pe=new Wf(Pe,e,null,r,ne),le.push({event:Pe,listeners:ke}),Me?Pe.data=Me:(Me=ap(r),Me!==null&&(Pe.data=Me)))),(Me=XS?QS(e,r):ZS(e,r))&&(Pe=Eo(F,"onBeforeInput"),0<Pe.length&&(ke=new Wf("onBeforeInput","beforeinput",null,r,ne),le.push({event:ke,listeners:Pe}),ke.data=Me)),Pj(le,e,F,r,ne)}Pg(le,s)})}function Vi(e,s,r){return{instance:e,listener:s,currentTarget:r}}function Eo(e,s){for(var r=s+"Capture",o=[];e!==null;){var f=e,g=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||g===null||(f=hi(e,r),f!=null&&o.unshift(Vi(e,f,g)),f=hi(e,s),f!=null&&o.push(Vi(e,f,g))),e.tag===3)return o;e=e.return}return[]}function Fj(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Gg(e,s,r,o,f){for(var g=s._reactName,j=[];r!==null&&r!==o;){var N=r,I=N.alternate,F=N.stateNode;if(N=N.tag,I!==null&&I===o)break;N!==5&&N!==26&&N!==27||F===null||(I=F,f?(F=hi(r,g),F!=null&&j.unshift(Vi(r,F,I))):f||(F=hi(r,g),F!=null&&j.push(Vi(r,F,I)))),r=r.return}j.length!==0&&e.push({event:s,listeners:j})}var Yj=/\r\n?/g,Kj=/\u0000|\uFFFD/g;function Vg(e){return(typeof e=="string"?e:""+e).replace(Yj,`
|
|
9
|
+
`).replace(Kj,"")}function Fg(e,s){return s=Vg(s),Vg(e)===s}function rt(e,s,r,o,f,g){switch(r){case"children":typeof o=="string"?s==="body"||s==="textarea"&&o===""||ar(e,o):(typeof o=="number"||typeof o=="bigint")&&s!=="body"&&ar(e,""+o);break;case"className":Al(e,"class",o);break;case"tabIndex":Al(e,"tabindex",o);break;case"dir":case"role":case"viewBox":case"width":case"height":Al(e,r,o);break;case"style":Ff(e,o,g);break;case"data":if(s!=="object"){Al(e,"data",o);break}case"src":case"href":if(o===""&&(s!=="a"||r!=="href")){e.removeAttribute(r);break}if(o==null||typeof o=="function"||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(r);break}o=Dl(""+o),e.setAttribute(r,o);break;case"action":case"formAction":if(typeof o=="function"){e.setAttribute(r,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(r==="formAction"?(s!=="input"&&rt(e,s,"name",f.name,f,null),rt(e,s,"formEncType",f.formEncType,f,null),rt(e,s,"formMethod",f.formMethod,f,null),rt(e,s,"formTarget",f.formTarget,f,null)):(rt(e,s,"encType",f.encType,f,null),rt(e,s,"method",f.method,f,null),rt(e,s,"target",f.target,f,null)));if(o==null||typeof o=="symbol"||typeof o=="boolean"){e.removeAttribute(r);break}o=Dl(""+o),e.setAttribute(r,o);break;case"onClick":o!=null&&(e.onclick=xs);break;case"onScroll":o!=null&&Ue("scroll",e);break;case"onScrollEnd":o!=null&&Ue("scrollend",e);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(l(61));if(r=o.__html,r!=null){if(f.children!=null)throw Error(l(60));e.innerHTML=r}}break;case"multiple":e.multiple=o&&typeof o!="function"&&typeof o!="symbol";break;case"muted":e.muted=o&&typeof o!="function"&&typeof o!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(o==null||typeof o=="function"||typeof o=="boolean"||typeof o=="symbol"){e.removeAttribute("xlink:href");break}r=Dl(""+o),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",r);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(r,""+o):e.removeAttribute(r);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":o&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(r,""):e.removeAttribute(r);break;case"capture":case"download":o===!0?e.setAttribute(r,""):o!==!1&&o!=null&&typeof o!="function"&&typeof o!="symbol"?e.setAttribute(r,o):e.removeAttribute(r);break;case"cols":case"rows":case"size":case"span":o!=null&&typeof o!="function"&&typeof o!="symbol"&&!isNaN(o)&&1<=o?e.setAttribute(r,o):e.removeAttribute(r);break;case"rowSpan":case"start":o==null||typeof o=="function"||typeof o=="symbol"||isNaN(o)?e.removeAttribute(r):e.setAttribute(r,o);break;case"popover":Ue("beforetoggle",e),Ue("toggle",e),Nl(e,"popover",o);break;case"xlinkActuate":vs(e,"http://www.w3.org/1999/xlink","xlink:actuate",o);break;case"xlinkArcrole":vs(e,"http://www.w3.org/1999/xlink","xlink:arcrole",o);break;case"xlinkRole":vs(e,"http://www.w3.org/1999/xlink","xlink:role",o);break;case"xlinkShow":vs(e,"http://www.w3.org/1999/xlink","xlink:show",o);break;case"xlinkTitle":vs(e,"http://www.w3.org/1999/xlink","xlink:title",o);break;case"xlinkType":vs(e,"http://www.w3.org/1999/xlink","xlink:type",o);break;case"xmlBase":vs(e,"http://www.w3.org/XML/1998/namespace","xml:base",o);break;case"xmlLang":vs(e,"http://www.w3.org/XML/1998/namespace","xml:lang",o);break;case"xmlSpace":vs(e,"http://www.w3.org/XML/1998/namespace","xml:space",o);break;case"is":Nl(e,"is",o);break;case"innerText":case"textContent":break;default:(!(2<r.length)||r[0]!=="o"&&r[0]!=="O"||r[1]!=="n"&&r[1]!=="N")&&(r=SS.get(r)||r,Nl(e,r,o))}}function Cd(e,s,r,o,f,g){switch(r){case"style":Ff(e,o,g);break;case"dangerouslySetInnerHTML":if(o!=null){if(typeof o!="object"||!("__html"in o))throw Error(l(61));if(r=o.__html,r!=null){if(f.children!=null)throw Error(l(60));e.innerHTML=r}}break;case"children":typeof o=="string"?ar(e,o):(typeof o=="number"||typeof o=="bigint")&&ar(e,""+o);break;case"onScroll":o!=null&&Ue("scroll",e);break;case"onScrollEnd":o!=null&&Ue("scrollend",e);break;case"onClick":o!=null&&(e.onclick=xs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!If.hasOwnProperty(r))e:{if(r[0]==="o"&&r[1]==="n"&&(f=r.endsWith("Capture"),s=r.slice(2,f?r.length-7:void 0),g=e[Gt]||null,g=g!=null?g[r]:null,typeof g=="function"&&e.removeEventListener(s,g,f),typeof o=="function")){typeof g!="function"&&g!==null&&(r in e?e[r]=null:e.hasAttribute(r)&&e.removeAttribute(r)),e.addEventListener(s,o,f);break e}r in e?e[r]=o:o===!0?e.setAttribute(r,""):Nl(e,r,o)}}}function Kt(e,s,r){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ue("error",e),Ue("load",e);var o=!1,f=!1,g;for(g in r)if(r.hasOwnProperty(g)){var j=r[g];if(j!=null)switch(g){case"src":o=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:rt(e,s,g,j,r,null)}}f&&rt(e,s,"srcSet",r.srcSet,r,null),o&&rt(e,s,"src",r.src,r,null);return;case"input":Ue("invalid",e);var N=g=j=f=null,I=null,F=null;for(o in r)if(r.hasOwnProperty(o)){var ne=r[o];if(ne!=null)switch(o){case"name":f=ne;break;case"type":j=ne;break;case"checked":I=ne;break;case"defaultChecked":F=ne;break;case"value":g=ne;break;case"defaultValue":N=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(l(137,s));break;default:rt(e,s,o,ne,r,null)}}Pf(e,g,N,I,F,j,f,!1);return;case"select":Ue("invalid",e),o=j=g=null;for(f in r)if(r.hasOwnProperty(f)&&(N=r[f],N!=null))switch(f){case"value":g=N;break;case"defaultValue":j=N;break;case"multiple":o=N;default:rt(e,s,f,N,r,null)}s=g,r=j,e.multiple=!!o,s!=null?sr(e,!!o,s,!1):r!=null&&sr(e,!!o,r,!0);return;case"textarea":Ue("invalid",e),g=f=o=null;for(j in r)if(r.hasOwnProperty(j)&&(N=r[j],N!=null))switch(j){case"value":o=N;break;case"defaultValue":f=N;break;case"children":g=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(l(91));break;default:rt(e,s,j,N,r,null)}Gf(e,o,f,g);return;case"option":for(I in r)r.hasOwnProperty(I)&&(o=r[I],o!=null)&&(I==="selected"?e.selected=o&&typeof o!="function"&&typeof o!="symbol":rt(e,s,I,o,r,null));return;case"dialog":Ue("beforetoggle",e),Ue("toggle",e),Ue("cancel",e),Ue("close",e);break;case"iframe":case"object":Ue("load",e);break;case"video":case"audio":for(o=0;o<Gi.length;o++)Ue(Gi[o],e);break;case"image":Ue("error",e),Ue("load",e);break;case"details":Ue("toggle",e);break;case"embed":case"source":case"link":Ue("error",e),Ue("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(F in r)if(r.hasOwnProperty(F)&&(o=r[F],o!=null))switch(F){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,s));default:rt(e,s,F,o,r,null)}return;default:if(Pc(s)){for(ne in r)r.hasOwnProperty(ne)&&(o=r[ne],o!==void 0&&Cd(e,s,ne,o,r,void 0));return}}for(N in r)r.hasOwnProperty(N)&&(o=r[N],o!=null&&rt(e,s,N,o,r,null))}function Xj(e,s,r,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,g=null,j=null,N=null,I=null,F=null,ne=null;for(W in r){var le=r[W];if(r.hasOwnProperty(W)&&le!=null)switch(W){case"checked":break;case"value":break;case"defaultValue":I=le;default:o.hasOwnProperty(W)||rt(e,s,W,null,o,le)}}for(var K in o){var W=o[K];if(le=r[K],o.hasOwnProperty(K)&&(W!=null||le!=null))switch(K){case"type":g=W;break;case"name":f=W;break;case"checked":F=W;break;case"defaultChecked":ne=W;break;case"value":j=W;break;case"defaultValue":N=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(l(137,s));break;default:W!==le&&rt(e,s,K,W,o,le)}}Bc(e,j,N,I,F,ne,g,f);return;case"select":W=j=N=K=null;for(g in r)if(I=r[g],r.hasOwnProperty(g)&&I!=null)switch(g){case"value":break;case"multiple":W=I;default:o.hasOwnProperty(g)||rt(e,s,g,null,o,I)}for(f in o)if(g=o[f],I=r[f],o.hasOwnProperty(f)&&(g!=null||I!=null))switch(f){case"value":K=g;break;case"defaultValue":N=g;break;case"multiple":j=g;default:g!==I&&rt(e,s,f,g,o,I)}s=N,r=j,o=W,K!=null?sr(e,!!r,K,!1):!!o!=!!r&&(s!=null?sr(e,!!r,s,!0):sr(e,!!r,r?[]:"",!1));return;case"textarea":W=K=null;for(N in r)if(f=r[N],r.hasOwnProperty(N)&&f!=null&&!o.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:rt(e,s,N,null,o,f)}for(j in o)if(f=o[j],g=r[j],o.hasOwnProperty(j)&&(f!=null||g!=null))switch(j){case"value":K=f;break;case"defaultValue":W=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(l(91));break;default:f!==g&&rt(e,s,j,f,o,g)}Hf(e,K,W);return;case"option":for(var we in r)K=r[we],r.hasOwnProperty(we)&&K!=null&&!o.hasOwnProperty(we)&&(we==="selected"?e.selected=!1:rt(e,s,we,null,o,K));for(I in o)K=o[I],W=r[I],o.hasOwnProperty(I)&&K!==W&&(K!=null||W!=null)&&(I==="selected"?e.selected=K&&typeof K!="function"&&typeof K!="symbol":rt(e,s,I,K,o,W));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ae in r)K=r[Ae],r.hasOwnProperty(Ae)&&K!=null&&!o.hasOwnProperty(Ae)&&rt(e,s,Ae,null,o,K);for(F in o)if(K=o[F],W=r[F],o.hasOwnProperty(F)&&K!==W&&(K!=null||W!=null))switch(F){case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(l(137,s));break;default:rt(e,s,F,K,o,W)}return;default:if(Pc(s)){for(var it in r)K=r[it],r.hasOwnProperty(it)&&K!==void 0&&!o.hasOwnProperty(it)&&Cd(e,s,it,void 0,o,K);for(ne in o)K=o[ne],W=r[ne],!o.hasOwnProperty(ne)||K===W||K===void 0&&W===void 0||Cd(e,s,ne,K,o,W);return}}for(var $ in r)K=r[$],r.hasOwnProperty($)&&K!=null&&!o.hasOwnProperty($)&&rt(e,s,$,null,o,K);for(le in o)K=o[le],W=r[le],!o.hasOwnProperty(le)||K===W||K==null&&W==null||rt(e,s,le,K,o,W)}function Yg(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Qj(){if(typeof performance.getEntriesByType=="function"){for(var e=0,s=0,r=performance.getEntriesByType("resource"),o=0;o<r.length;o++){var f=r[o],g=f.transferSize,j=f.initiatorType,N=f.duration;if(g&&N&&Yg(j)){for(j=0,N=f.responseEnd,o+=1;o<r.length;o++){var I=r[o],F=I.startTime;if(F>N)break;var ne=I.transferSize,le=I.initiatorType;ne&&Yg(le)&&(I=I.responseEnd,j+=ne*(I<N?1:(N-F)/(I-F)))}if(--o,s+=8*(g+j)/(f.duration/1e3),e++,10<e)break}}if(0<e)return s/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var Nd=null,Ad=null;function Co(e){return e.nodeType===9?e:e.ownerDocument}function Kg(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Xg(e,s){if(e===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&s==="foreignObject"?0:e}function Rd(e,s){return e==="textarea"||e==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var Dd=null;function Zj(){var e=window.event;return e&&e.type==="popstate"?e===Dd?!1:(Dd=e,!0):(Dd=null,!1)}var Qg=typeof setTimeout=="function"?setTimeout:void 0,Wj=typeof clearTimeout=="function"?clearTimeout:void 0,Zg=typeof Promise=="function"?Promise:void 0,Jj=typeof queueMicrotask=="function"?queueMicrotask:typeof Zg<"u"?function(e){return Zg.resolve(null).then(e).catch(eT)}:Qg;function eT(e){setTimeout(function(){throw e})}function oa(e){return e==="head"}function Wg(e,s){var r=s,o=0;do{var f=r.nextSibling;if(e.removeChild(r),f&&f.nodeType===8)if(r=f.data,r==="/$"||r==="/&"){if(o===0){e.removeChild(f),Lr(s);return}o--}else if(r==="$"||r==="$?"||r==="$~"||r==="$!"||r==="&")o++;else if(r==="html")Fi(e.ownerDocument.documentElement);else if(r==="head"){r=e.ownerDocument.head,Fi(r);for(var g=r.firstChild;g;){var j=g.nextSibling,N=g.nodeName;g[ui]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&g.rel.toLowerCase()==="stylesheet"||r.removeChild(g),g=j}}else r==="body"&&Fi(e.ownerDocument.body);r=f}while(r);Lr(s)}function Jg(e,s){var r=e;e=0;do{var o=r.nextSibling;if(r.nodeType===1?s?(r._stashedDisplay=r.style.display,r.style.display="none"):(r.style.display=r._stashedDisplay||"",r.getAttribute("style")===""&&r.removeAttribute("style")):r.nodeType===3&&(s?(r._stashedText=r.nodeValue,r.nodeValue=""):r.nodeValue=r._stashedText||""),o&&o.nodeType===8)if(r=o.data,r==="/$"){if(e===0)break;e--}else r!=="$"&&r!=="$?"&&r!=="$~"&&r!=="$!"||e++;r=o}while(r)}function Od(e){var s=e.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var r=s;switch(s=s.nextSibling,r.nodeName){case"HTML":case"HEAD":case"BODY":Od(r),qc(r);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(r.rel.toLowerCase()==="stylesheet")continue}e.removeChild(r)}}function tT(e,s,r,o){for(;e.nodeType===1;){var f=r;if(e.nodeName.toLowerCase()!==s.toLowerCase()){if(!o&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(o){if(!e[ui])switch(s){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(g=e.getAttribute("rel"),g==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(g!==f.rel||e.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||e.getAttribute("title")!==(f.title==null?null:f.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(g=e.getAttribute("src"),(g!==(f.src==null?null:f.src)||e.getAttribute("type")!==(f.type==null?null:f.type)||e.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&g&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(s==="input"&&e.type==="hidden"){var g=f.name==null?null:""+f.name;if(f.type==="hidden"&&e.getAttribute("name")===g)return e}else return e;if(e=Mn(e.nextSibling),e===null)break}return null}function nT(e,s,r){if(s==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!r||(e=Mn(e.nextSibling),e===null))return null;return e}function ey(e,s){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!s||(e=Mn(e.nextSibling),e===null))return null;return e}function zd(e){return e.data==="$?"||e.data==="$~"}function Ld(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function sT(e,s){var r=e.ownerDocument;if(e.data==="$~")e._reactRetry=s;else if(e.data!=="$?"||r.readyState!=="loading")s();else{var o=function(){s(),r.removeEventListener("DOMContentLoaded",o)};r.addEventListener("DOMContentLoaded",o),e._reactRetry=o}}function Mn(e){for(;e!=null;e=e.nextSibling){var s=e.nodeType;if(s===1||s===3)break;if(s===8){if(s=e.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return e}var Md=null;function ty(e){e=e.nextSibling;for(var s=0;e;){if(e.nodeType===8){var r=e.data;if(r==="/$"||r==="/&"){if(s===0)return Mn(e.nextSibling);s--}else r!=="$"&&r!=="$!"&&r!=="$?"&&r!=="$~"&&r!=="&"||s++}e=e.nextSibling}return null}function ny(e){e=e.previousSibling;for(var s=0;e;){if(e.nodeType===8){var r=e.data;if(r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"){if(s===0)return e;s--}else r!=="/$"&&r!=="/&"||s++}e=e.previousSibling}return null}function sy(e,s,r){switch(s=Co(r),e){case"html":if(e=s.documentElement,!e)throw Error(l(452));return e;case"head":if(e=s.head,!e)throw Error(l(453));return e;case"body":if(e=s.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function Fi(e){for(var s=e.attributes;s.length;)e.removeAttributeNode(s[0]);qc(e)}var In=new Map,ay=new Set;function No(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Ls=se.d;se.d={f:aT,r:rT,D:iT,C:lT,L:oT,m:cT,X:dT,S:uT,M:hT};function aT(){var e=Ls.f(),s=bo();return e||s}function rT(e){var s=er(e);s!==null&&s.tag===5&&s.type==="form"?_m(s):Ls.r(e)}var Dr=typeof document>"u"?null:document;function ry(e,s,r){var o=Dr;if(o&&typeof s=="string"&&s){var f=Nn(s);f='link[rel="'+e+'"][href="'+f+'"]',typeof r=="string"&&(f+='[crossorigin="'+r+'"]'),ay.has(f)||(ay.add(f),e={rel:e,crossOrigin:r,href:s},o.querySelector(f)===null&&(s=o.createElement("link"),Kt(s,"link",e),Ut(s),o.head.appendChild(s)))}}function iT(e){Ls.D(e),ry("dns-prefetch",e,null)}function lT(e,s){Ls.C(e,s),ry("preconnect",e,s)}function oT(e,s,r){Ls.L(e,s,r);var o=Dr;if(o&&e&&s){var f='link[rel="preload"][as="'+Nn(s)+'"]';s==="image"&&r&&r.imageSrcSet?(f+='[imagesrcset="'+Nn(r.imageSrcSet)+'"]',typeof r.imageSizes=="string"&&(f+='[imagesizes="'+Nn(r.imageSizes)+'"]')):f+='[href="'+Nn(e)+'"]';var g=f;switch(s){case"style":g=Or(e);break;case"script":g=zr(e)}In.has(g)||(e=b({rel:"preload",href:s==="image"&&r&&r.imageSrcSet?void 0:e,as:s},r),In.set(g,e),o.querySelector(f)!==null||s==="style"&&o.querySelector(Yi(g))||s==="script"&&o.querySelector(Ki(g))||(s=o.createElement("link"),Kt(s,"link",e),Ut(s),o.head.appendChild(s)))}}function cT(e,s){Ls.m(e,s);var r=Dr;if(r&&e){var o=s&&typeof s.as=="string"?s.as:"script",f='link[rel="modulepreload"][as="'+Nn(o)+'"][href="'+Nn(e)+'"]',g=f;switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=zr(e)}if(!In.has(g)&&(e=b({rel:"modulepreload",href:e},s),In.set(g,e),r.querySelector(f)===null)){switch(o){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(r.querySelector(Ki(g)))return}o=r.createElement("link"),Kt(o,"link",e),Ut(o),r.head.appendChild(o)}}}function uT(e,s,r){Ls.S(e,s,r);var o=Dr;if(o&&e){var f=tr(o).hoistableStyles,g=Or(e);s=s||"default";var j=f.get(g);if(!j){var N={loading:0,preload:null};if(j=o.querySelector(Yi(g)))N.loading=5;else{e=b({rel:"stylesheet",href:e,"data-precedence":s},r),(r=In.get(g))&&Id(e,r);var I=j=o.createElement("link");Ut(I),Kt(I,"link",e),I._p=new Promise(function(F,ne){I.onload=F,I.onerror=ne}),I.addEventListener("load",function(){N.loading|=1}),I.addEventListener("error",function(){N.loading|=2}),N.loading|=4,Ao(j,s,o)}j={type:"stylesheet",instance:j,count:1,state:N},f.set(g,j)}}}function dT(e,s){Ls.X(e,s);var r=Dr;if(r&&e){var o=tr(r).hoistableScripts,f=zr(e),g=o.get(f);g||(g=r.querySelector(Ki(f)),g||(e=b({src:e,async:!0},s),(s=In.get(f))&&qd(e,s),g=r.createElement("script"),Ut(g),Kt(g,"link",e),r.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},o.set(f,g))}}function hT(e,s){Ls.M(e,s);var r=Dr;if(r&&e){var o=tr(r).hoistableScripts,f=zr(e),g=o.get(f);g||(g=r.querySelector(Ki(f)),g||(e=b({src:e,async:!0,type:"module"},s),(s=In.get(f))&&qd(e,s),g=r.createElement("script"),Ut(g),Kt(g,"link",e),r.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},o.set(f,g))}}function iy(e,s,r,o){var f=(f=ie.current)?No(f):null;if(!f)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof r.precedence=="string"&&typeof r.href=="string"?(s=Or(r.href),r=tr(f).hoistableStyles,o=r.get(s),o||(o={type:"style",instance:null,count:0,state:null},r.set(s,o)),o):{type:"void",instance:null,count:0,state:null};case"link":if(r.rel==="stylesheet"&&typeof r.href=="string"&&typeof r.precedence=="string"){e=Or(r.href);var g=tr(f).hoistableStyles,j=g.get(e);if(j||(f=f.ownerDocument||f,j={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(e,j),(g=f.querySelector(Yi(e)))&&!g._p&&(j.instance=g,j.state.loading=5),In.has(e)||(r={rel:"preload",as:"style",href:r.href,crossOrigin:r.crossOrigin,integrity:r.integrity,media:r.media,hrefLang:r.hrefLang,referrerPolicy:r.referrerPolicy},In.set(e,r),g||fT(f,e,r,j.state))),s&&o===null)throw Error(l(528,""));return j}if(s&&o!==null)throw Error(l(529,""));return null;case"script":return s=r.async,r=r.src,typeof r=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=zr(r),r=tr(f).hoistableScripts,o=r.get(s),o||(o={type:"script",instance:null,count:0,state:null},r.set(s,o)),o):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Or(e){return'href="'+Nn(e)+'"'}function Yi(e){return'link[rel="stylesheet"]['+e+"]"}function ly(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function fT(e,s,r,o){e.querySelector('link[rel="preload"][as="style"]['+s+"]")?o.loading=1:(s=e.createElement("link"),o.preload=s,s.addEventListener("load",function(){return o.loading|=1}),s.addEventListener("error",function(){return o.loading|=2}),Kt(s,"link",r),Ut(s),e.head.appendChild(s))}function zr(e){return'[src="'+Nn(e)+'"]'}function Ki(e){return"script[async]"+e}function oy(e,s,r){if(s.count++,s.instance===null)switch(s.type){case"style":var o=e.querySelector('style[data-href~="'+Nn(r.href)+'"]');if(o)return s.instance=o,Ut(o),o;var f=b({},r,{"data-href":r.href,"data-precedence":r.precedence,href:null,precedence:null});return o=(e.ownerDocument||e).createElement("style"),Ut(o),Kt(o,"style",f),Ao(o,r.precedence,e),s.instance=o;case"stylesheet":f=Or(r.href);var g=e.querySelector(Yi(f));if(g)return s.state.loading|=4,s.instance=g,Ut(g),g;o=ly(r),(f=In.get(f))&&Id(o,f),g=(e.ownerDocument||e).createElement("link"),Ut(g);var j=g;return j._p=new Promise(function(N,I){j.onload=N,j.onerror=I}),Kt(g,"link",o),s.state.loading|=4,Ao(g,r.precedence,e),s.instance=g;case"script":return g=zr(r.src),(f=e.querySelector(Ki(g)))?(s.instance=f,Ut(f),f):(o=r,(f=In.get(g))&&(o=b({},r),qd(o,f)),e=e.ownerDocument||e,f=e.createElement("script"),Ut(f),Kt(f,"link",o),e.head.appendChild(f),s.instance=f);case"void":return null;default:throw Error(l(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(o=s.instance,s.state.loading|=4,Ao(o,r.precedence,e));return s.instance}function Ao(e,s,r){for(var o=r.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=o.length?o[o.length-1]:null,g=f,j=0;j<o.length;j++){var N=o[j];if(N.dataset.precedence===s)g=N;else if(g!==f)break}g?g.parentNode.insertBefore(e,g.nextSibling):(s=r.nodeType===9?r.head:r,s.insertBefore(e,s.firstChild))}function Id(e,s){e.crossOrigin==null&&(e.crossOrigin=s.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=s.referrerPolicy),e.title==null&&(e.title=s.title)}function qd(e,s){e.crossOrigin==null&&(e.crossOrigin=s.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=s.referrerPolicy),e.integrity==null&&(e.integrity=s.integrity)}var Ro=null;function cy(e,s,r){if(Ro===null){var o=new Map,f=Ro=new Map;f.set(r,o)}else f=Ro,o=f.get(r),o||(o=new Map,f.set(r,o));if(o.has(e))return o;for(o.set(e,null),r=r.getElementsByTagName(e),f=0;f<r.length;f++){var g=r[f];if(!(g[ui]||g[Je]||e==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var j=g.getAttribute(s)||"";j=e+j;var N=o.get(j);N?N.push(g):o.set(j,[g])}}return o}function uy(e,s,r){e=e.ownerDocument||e,e.head.insertBefore(r,s==="title"?e.querySelector("head > title"):null)}function pT(e,s,r){if(r===1||s.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;return s.rel==="stylesheet"?(e=s.disabled,typeof s.precedence=="string"&&e==null):!0;case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function dy(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function mT(e,s,r,o){if(r.type==="stylesheet"&&(typeof o.media!="string"||matchMedia(o.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var f=Or(o.href),g=s.querySelector(Yi(f));if(g){s=g._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(e.count++,e=Do.bind(e),s.then(e,e)),r.state.loading|=4,r.instance=g,Ut(g);return}g=s.ownerDocument||s,o=ly(o),(f=In.get(f))&&Id(o,f),g=g.createElement("link"),Ut(g);var j=g;j._p=new Promise(function(N,I){j.onload=N,j.onerror=I}),Kt(g,"link",o),r.instance=g}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(r,s),(s=r.state.preload)&&(r.state.loading&3)===0&&(e.count++,r=Do.bind(e),s.addEventListener("load",r),s.addEventListener("error",r))}}var Ud=0;function gT(e,s){return e.stylesheets&&e.count===0&&zo(e,e.stylesheets),0<e.count||0<e.imgCount?function(r){var o=setTimeout(function(){if(e.stylesheets&&zo(e,e.stylesheets),e.unsuspend){var g=e.unsuspend;e.unsuspend=null,g()}},6e4+s);0<e.imgBytes&&Ud===0&&(Ud=62500*Qj());var f=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&zo(e,e.stylesheets),e.unsuspend)){var g=e.unsuspend;e.unsuspend=null,g()}},(e.imgBytes>Ud?50:800)+s);return e.unsuspend=r,function(){e.unsuspend=null,clearTimeout(o),clearTimeout(f)}}:null}function Do(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)zo(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Oo=null;function zo(e,s){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Oo=new Map,s.forEach(yT,e),Oo=null,Do.call(e))}function yT(e,s){if(!(s.state.loading&4)){var r=Oo.get(e);if(r)var o=r.get(null);else{r=new Map,Oo.set(e,r);for(var f=e.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<f.length;g++){var j=f[g];(j.nodeName==="LINK"||j.getAttribute("media")!=="not all")&&(r.set(j.dataset.precedence,j),o=j)}o&&r.set(null,o)}f=s.instance,j=f.getAttribute("data-precedence"),g=r.get(j)||o,g===o&&r.set(null,f),r.set(j,f),this.count++,o=Do.bind(this),f.addEventListener("load",o),f.addEventListener("error",o),g?g.parentNode.insertBefore(f,g.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(f,e.firstChild)),s.state.loading|=4}}var Xi={$$typeof:D,Provider:null,Consumer:null,_currentValue:ge,_currentValue2:ge,_threadCount:0};function vT(e,s,r,o,f,g,j,N,I){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=ve(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ve(0),this.hiddenUpdates=ve(null),this.identifierPrefix=o,this.onUncaughtError=f,this.onCaughtError=g,this.onRecoverableError=j,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function hy(e,s,r,o,f,g,j,N,I,F,ne,le){return e=new vT(e,s,r,j,I,F,ne,le,N),s=1,g===!0&&(s|=24),g=mn(3,null,null,s),e.current=g,g.stateNode=e,s=vu(),s.refCount++,e.pooledCache=s,s.refCount++,g.memoizedState={element:o,isDehydrated:r,cache:s},Su(g),e}function fy(e){return e?(e=dr,e):dr}function py(e,s,r,o,f,g){f=fy(f),o.context===null?o.context=f:o.pendingContext=f,o=Zs(s),o.payload={element:r},g=g===void 0?null:g,g!==null&&(o.callback=g),r=Ws(e,o,s),r!==null&&(cn(r,e,s),Ei(r,e,s))}function my(e,s){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var r=e.retryLane;e.retryLane=r!==0&&r<s?r:s}}function Bd(e,s){my(e,s),(e=e.alternate)&&my(e,s)}function gy(e){if(e.tag===13||e.tag===31){var s=ka(e,67108864);s!==null&&cn(s,e,67108864),Bd(e,67108864)}}function yy(e){if(e.tag===13||e.tag===31){var s=bn();s=gt(s);var r=ka(e,s);r!==null&&cn(r,e,s),Bd(e,s)}}var Lo=!0;function xT(e,s,r,o){var f=B.T;B.T=null;var g=se.p;try{se.p=2,$d(e,s,r,o)}finally{se.p=g,B.T=f}}function bT(e,s,r,o){var f=B.T;B.T=null;var g=se.p;try{se.p=8,$d(e,s,r,o)}finally{se.p=g,B.T=f}}function $d(e,s,r,o){if(Lo){var f=Pd(o);if(f===null)Ed(e,s,o,Mo,r),xy(e,o);else if(ST(f,e,s,r,o))o.stopPropagation();else if(xy(e,o),s&4&&-1<_T.indexOf(e)){for(;f!==null;){var g=er(f);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var j=Fn(g.pendingLanes);if(j!==0){var N=g;for(N.pendingLanes|=2,N.entangledLanes|=2;j;){var I=1<<31-Ht(j);N.entanglements[1]|=I,j&=~I}os(g),(We&6)===0&&(vo=mt()+500,Hi(0))}}break;case 31:case 13:N=ka(g,2),N!==null&&cn(N,g,2),bo(),Bd(g,2)}if(g=Pd(o),g===null&&Ed(e,s,o,Mo,r),g===f)break;f=g}f!==null&&o.stopPropagation()}else Ed(e,s,o,null,r)}}function Pd(e){return e=Gc(e),Hd(e)}var Mo=null;function Hd(e){if(Mo=null,e=Ja(e),e!==null){var s=u(e);if(s===null)e=null;else{var r=s.tag;if(r===13){if(e=h(s),e!==null)return e;e=null}else if(r===31){if(e=m(s),e!==null)return e;e=null}else if(r===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;e=null}else s!==e&&(e=null)}}return Mo=e,null}function vy(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ms()){case gs:return 2;case xa:return 8;case $s:case ri:return 32;case Wa:return 268435456;default:return 32}default:return 32}}var Gd=!1,ca=null,ua=null,da=null,Qi=new Map,Zi=new Map,ha=[],_T="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function xy(e,s){switch(e){case"focusin":case"focusout":ca=null;break;case"dragenter":case"dragleave":ua=null;break;case"mouseover":case"mouseout":da=null;break;case"pointerover":case"pointerout":Qi.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zi.delete(s.pointerId)}}function Wi(e,s,r,o,f,g){return e===null||e.nativeEvent!==g?(e={blockedOn:s,domEventName:r,eventSystemFlags:o,nativeEvent:g,targetContainers:[f]},s!==null&&(s=er(s),s!==null&&gy(s)),e):(e.eventSystemFlags|=o,s=e.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),e)}function ST(e,s,r,o,f){switch(s){case"focusin":return ca=Wi(ca,e,s,r,o,f),!0;case"dragenter":return ua=Wi(ua,e,s,r,o,f),!0;case"mouseover":return da=Wi(da,e,s,r,o,f),!0;case"pointerover":var g=f.pointerId;return Qi.set(g,Wi(Qi.get(g)||null,e,s,r,o,f)),!0;case"gotpointercapture":return g=f.pointerId,Zi.set(g,Wi(Zi.get(g)||null,e,s,r,o,f)),!0}return!1}function by(e){var s=Ja(e.target);if(s!==null){var r=u(s);if(r!==null){if(s=r.tag,s===13){if(s=h(r),s!==null){e.blockedOn=s,_a(e.priority,function(){yy(r)});return}}else if(s===31){if(s=m(r),s!==null){e.blockedOn=s,_a(e.priority,function(){yy(r)});return}}else if(s===3&&r.stateNode.current.memoizedState.isDehydrated){e.blockedOn=r.tag===3?r.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Io(e){if(e.blockedOn!==null)return!1;for(var s=e.targetContainers;0<s.length;){var r=Pd(e.nativeEvent);if(r===null){r=e.nativeEvent;var o=new r.constructor(r.type,r);Hc=o,r.target.dispatchEvent(o),Hc=null}else return s=er(r),s!==null&&gy(s),e.blockedOn=r,!1;s.shift()}return!0}function _y(e,s,r){Io(e)&&r.delete(s)}function jT(){Gd=!1,ca!==null&&Io(ca)&&(ca=null),ua!==null&&Io(ua)&&(ua=null),da!==null&&Io(da)&&(da=null),Qi.forEach(_y),Zi.forEach(_y)}function qo(e,s){e.blockedOn===s&&(e.blockedOn=null,Gd||(Gd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,jT)))}var Uo=null;function Sy(e){Uo!==e&&(Uo=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Uo===e&&(Uo=null);for(var s=0;s<e.length;s+=3){var r=e[s],o=e[s+1],f=e[s+2];if(typeof o!="function"){if(Hd(o||r)===null)continue;break}var g=er(r);g!==null&&(e.splice(s,3),s-=3,Pu(g,{pending:!0,data:f,method:r.method,action:o},o,f))}}))}function Lr(e){function s(I){return qo(I,e)}ca!==null&&qo(ca,e),ua!==null&&qo(ua,e),da!==null&&qo(da,e),Qi.forEach(s),Zi.forEach(s);for(var r=0;r<ha.length;r++){var o=ha[r];o.blockedOn===e&&(o.blockedOn=null)}for(;0<ha.length&&(r=ha[0],r.blockedOn===null);)by(r),r.blockedOn===null&&ha.shift();if(r=(e.ownerDocument||e).$$reactFormReplay,r!=null)for(o=0;o<r.length;o+=3){var f=r[o],g=r[o+1],j=f[Gt]||null;if(typeof g=="function")j||Sy(r);else if(j){var N=null;if(g&&g.hasAttribute("formAction")){if(f=g,j=g[Gt]||null)N=j.formAction;else if(Hd(f)!==null)continue}else N=j.action;typeof N=="function"?r[o+1]=N:(r.splice(o,3),o-=3),Sy(r)}}}function jy(){function e(g){g.canIntercept&&g.info==="react-transition"&&g.intercept({handler:function(){return new Promise(function(j){return f=j})},focusReset:"manual",scroll:"manual"})}function s(){f!==null&&(f(),f=null),o||setTimeout(r,20)}function r(){if(!o&&!navigation.transition){var g=navigation.currentEntry;g&&g.url!=null&&navigation.navigate(g.url,{state:g.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var o=!1,f=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(r,100),function(){o=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),f!==null&&(f(),f=null)}}}function Vd(e){this._internalRoot=e}Bo.prototype.render=Vd.prototype.render=function(e){var s=this._internalRoot;if(s===null)throw Error(l(409));var r=s.current,o=bn();py(r,o,e,s,null,null)},Bo.prototype.unmount=Vd.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var s=e.containerInfo;py(e.current,2,null,e,null,null),bo(),s[Gs]=null}};function Bo(e){this._internalRoot=e}Bo.prototype.unstable_scheduleHydration=function(e){if(e){var s=ba();e={blockedOn:null,target:e,priority:s};for(var r=0;r<ha.length&&s!==0&&s<ha[r].priority;r++);ha.splice(r,0,e),r===0&&by(e)}};var Ty=t.version;if(Ty!=="19.2.5")throw Error(l(527,Ty,"19.2.5"));se.findDOMNode=function(e){var s=e._reactInternals;if(s===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=y(s),e=e!==null?v(e):null,e=e===null?null:e.stateNode,e};var TT={bundleType:0,version:"19.2.5",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.2.5"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var $o=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!$o.isDisabled&&$o.supportsFiber)try{ys=$o.inject(TT),Pt=$o}catch{}}return el.createRoot=function(e,s){if(!c(e))throw Error(l(299));var r=!1,o="",f=Rm,g=Dm,j=Om;return s!=null&&(s.unstable_strictMode===!0&&(r=!0),s.identifierPrefix!==void 0&&(o=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(g=s.onCaughtError),s.onRecoverableError!==void 0&&(j=s.onRecoverableError)),s=hy(e,1,!1,null,null,r,o,null,f,g,j,jy),e[Gs]=s.current,kd(e),new Vd(s)},el.hydrateRoot=function(e,s,r){if(!c(e))throw Error(l(299));var o=!1,f="",g=Rm,j=Dm,N=Om,I=null;return r!=null&&(r.unstable_strictMode===!0&&(o=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(g=r.onUncaughtError),r.onCaughtError!==void 0&&(j=r.onCaughtError),r.onRecoverableError!==void 0&&(N=r.onRecoverableError),r.formState!==void 0&&(I=r.formState)),s=hy(e,1,!0,s,r??null,o,f,I,g,j,N,jy),s.context=fy(null),r=s.current,o=bn(),o=gt(o),f=Zs(o),f.callback=null,Ws(r,f,o),r=o,s.current.lanes=r,Fe(s,r),os(s),e[Gs]=s.current,kd(e),new Bo(s)},el.version="19.2.5",el}var zy;function zT(){if(zy)return Kd.exports;zy=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(t){console.error(t)}}return n(),Kd.exports=OT(),Kd.exports}var LT=zT();const MT=Kh(LT);var Qh=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,zx=/^[\\/]{2}/;function IT(n,t){return t+n.replace(/\\/g,"/")}var Ly="popstate";function My(n){return typeof n=="object"&&n!=null&&"pathname"in n&&"search"in n&&"hash"in n&&"state"in n&&"key"in n}function qT(n={}){function t(l,c){let u=c.state?.masked,{pathname:h,search:m,hash:p}=u||l.location;return Nh("",{pathname:h,search:m,hash:p},c.state&&c.state.usr||null,c.state&&c.state.key||"default",u?{pathname:l.location.pathname,search:l.location.search,hash:l.location.hash}:void 0)}function i(l,c){return typeof c=="string"?c:Ga(c)}return BT(t,i,null,n)}function pt(n,t){if(n===!1||n===null||typeof n>"u")throw new Error(t)}function Pn(n,t){if(!n){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function UT(){return Math.random().toString(36).substring(2,10)}function Iy(n,t){return{usr:n.state,key:n.key,idx:t,masked:n.mask?{pathname:n.pathname,search:n.search,hash:n.hash}:void 0}}function Nh(n,t,i=null,l,c){return{pathname:typeof n=="string"?n:n.pathname,search:"",hash:"",...typeof t=="string"?Qr(t):t,state:i,key:t&&t.key||l||UT(),mask:c}}function Ga({pathname:n="/",search:t="",hash:i=""}){return t&&t!=="?"&&(n+=t.charAt(0)==="?"?t:"?"+t),i&&i!=="#"&&(n+=i.charAt(0)==="#"?i:"#"+i),n}function Qr(n){let t={};if(n){let i=n.indexOf("#");i>=0&&(t.hash=n.substring(i),n=n.substring(0,i));let l=n.indexOf("?");l>=0&&(t.search=n.substring(l),n=n.substring(0,l)),n&&(t.pathname=n)}return t}function BT(n,t,i,l={}){let{window:c=document.defaultView,v5Compat:u=!1}=l,h=c.history,m="POP",p=null,y=v();y==null&&(y=0,h.replaceState({...h.state,idx:y},""));function v(){return(h.state||{idx:null}).idx}function b(){m="POP";let w=v(),E=w==null?null:w-y;y=w,p&&p({action:m,location:T.location,delta:E})}function x(w,E){m="PUSH";let R=My(w)?w:Nh(T.location,w,E);y=v()+1;let D=Iy(R,y),O=T.createHref(R.mask||R);try{h.pushState(D,"",O)}catch(z){if(z instanceof DOMException&&z.name==="DataCloneError")throw z;c.location.assign(O)}u&&p&&p({action:m,location:T.location,delta:1})}function _(w,E){m="REPLACE";let R=My(w)?w:Nh(T.location,w,E);y=v();let D=Iy(R,y),O=T.createHref(R.mask||R);h.replaceState(D,"",O),u&&p&&p({action:m,location:T.location,delta:0})}function k(w){return $T(c,w)}let T={get action(){return m},get location(){return n(c,h)},listen(w){if(p)throw new Error("A history only accepts one active listener");return c.addEventListener(Ly,b),p=w,()=>{c.removeEventListener(Ly,b),p=null}},createHref(w){return t(c,w)},createURL:k,encodeLocation(w){let E=k(w);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:x,replace:_,go(w){return h.go(w)}};return T}function $T(n,t,i=!1){let l="http://localhost";n&&(l=n.location.origin!=="null"?n.location.origin:n.location.href),pt(l,"No window.location.(origin|href) available to create URL");let c=typeof t=="string"?t:Ga(t);return c=c.replace(/ $/,"%20"),!i&&zx.test(c)&&(c=l+c),new URL(c,l)}function Lx(n,t,i="/"){return PT(n,t,i,!1)}function PT(n,t,i,l,c){let u=typeof t=="string"?Qr(t):t,h=Ms(u.pathname||"/",i);if(h==null)return null;let m=HT(n),p=null,y=ew(h);for(let v=0;p==null&&v<m.length;++v)p=JT(m[v],y,l);return p}function HT(n){let t=Mx(n);return GT(t),t}function Mx(n,t=[],i=[],l="",c=!1){let u=(h,m,p=c,y)=>{let v={relativePath:y===void 0?h.path||"":y,caseSensitive:h.caseSensitive===!0,childrenIndex:m,route:h};if(v.relativePath.startsWith("/")){if(!v.relativePath.startsWith(l)&&p)return;pt(v.relativePath.startsWith(l),`Absolute route path "${v.relativePath}" nested under path "${l}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),v.relativePath=v.relativePath.slice(l.length)}let b=es([l,v.relativePath]),x=i.concat(v);h.children&&h.children.length>0&&(pt(h.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),Mx(h.children,t,x,b,p)),!(h.path==null&&!h.index)&&t.push({path:b,score:ZT(b,h.index),routesMeta:x.map((_,k)=>{let[T,w]=Ux(_.relativePath,_.caseSensitive,k===x.length-1);return{..._,matcher:T,compiledParams:w}})})};return n.forEach((h,m)=>{if(h.path===""||!h.path?.includes("?"))u(h,m);else for(let p of Ix(h.path))u(h,m,!0,p)}),t}function Ix(n){let t=n.split("/");if(t.length===0)return[];let[i,...l]=t,c=i.endsWith("?"),u=i.replace(/\?$/,"");if(l.length===0)return c?[u,""]:[u];let h=Ix(l.join("/")),m=[];return m.push(...h.map(p=>p===""?u:[u,p].join("/"))),c&&m.push(...h),m.map(p=>n.startsWith("/")&&p===""?"/":p)}function GT(n){n.sort((t,i)=>t.score!==i.score?i.score-t.score:WT(t.routesMeta.map(l=>l.childrenIndex),i.routesMeta.map(l=>l.childrenIndex)))}var VT=/^:[\w-]+$/,FT=3,YT=2,KT=1,XT=10,QT=-2,qy=n=>n==="*";function ZT(n,t){let i=n.split("/"),l=i.length;return i.some(qy)&&(l+=QT),t&&(l+=YT),i.filter(c=>!qy(c)).reduce((c,u)=>c+(VT.test(u)?FT:u===""?KT:XT),l)}function WT(n,t){return n.length===t.length&&n.slice(0,-1).every((l,c)=>l===t[c])?n[n.length-1]-t[t.length-1]:0}function JT(n,t,i=!1){let{routesMeta:l}=n,c={},u="/",h=[];for(let m=0;m<l.length;++m){let p=l[m],y=m===l.length-1,v=u==="/"?t:t.slice(u.length)||"/",b={path:p.relativePath,caseSensitive:p.caseSensitive,end:y},x=p.matcher&&p.compiledParams?qx(b,v,p.matcher,p.compiledParams):gc(b,v),_=p.route;if(!x&&y&&i&&!l[l.length-1].route.index&&(x=gc({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},v)),!x)return null;Object.assign(c,x.params),h.push({params:c,pathname:es([u,x.pathname]),pathnameBase:sw(es([u,x.pathnameBase])),route:_}),x.pathnameBase!=="/"&&(u=es([u,x.pathnameBase]))}return h}function gc(n,t){typeof n=="string"&&(n={path:n,caseSensitive:!1,end:!0});let[i,l]=Ux(n.path,n.caseSensitive,n.end);return qx(n,t,i,l)}function qx(n,t,i,l){let c=t.match(i);if(!c)return null;let u=c[0],h=Yr(u,1),m=c.slice(1);return{params:l.reduce((y,{paramName:v,isOptional:b},x)=>{if(v==="*"){let k=m[x]||"";h=Yr(u.slice(0,u.length-k.length),1)}const _=m[x];return b&&!_?y[v]=void 0:y[v]=(_||"").replace(/%2F/g,"/"),y},{}),pathname:u,pathnameBase:h,pattern:n}}function Ux(n,t=!1,i=!0){Pn(n==="*"||!n.endsWith("*")||n.endsWith("/*"),`Route path "${n}" will be treated as if it were "${n.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${n.replace(/\*$/,"/*")}".`);let l=[],c="^"+n.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(h,m,p,y,v)=>{if(l.push({paramName:m,isOptional:p!=null}),p){let b=v.charAt(y+h.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return n.endsWith("*")?(l.push({paramName:"*"}),c+=n==="*"||n==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):i?c+="\\/*$":n!==""&&n!=="/"&&(c+="(?:(?=\\/|$))"),[new RegExp(c,t?void 0:"i"),l]}function ew(n){try{return n.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Pn(!1,`The URL path "${n}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),n}}function Ms(n,t){if(t==="/")return n;if(!n.toLowerCase().startsWith(t.toLowerCase()))return null;let i=t.endsWith("/")?t.length-1:t.length,l=n.charAt(i);return l&&l!=="/"?null:n.slice(i)||"/"}function tw(n,t="/"){let{pathname:i,search:l="",hash:c=""}=typeof n=="string"?Qr(n):n,u;return i?(i=Bx(i),i.startsWith("/")||i.startsWith("\\")?u=Uy(i.substring(1),"/"):u=Uy(i,t)):u=t,{pathname:u,search:aw(l),hash:rw(c)}}function Uy(n,t){let i=Yr(t).split("/");return n.split("/").forEach(c=>{c===".."?i.length>1&&i.pop():c!=="."&&i.push(c)}),i.length>1?i.join("/"):"/"}function Wd(n,t,i,l){return`Cannot include a '${n}' character in a manually specified \`to.${t}\` field [${JSON.stringify(l)}]. Please separate it out to the \`to.${i}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function nw(n){return n.filter((t,i)=>i===0||t.route.path&&t.route.path.length>0)}function Zh(n){let t=nw(n);return t.map((i,l)=>l===t.length-1?i.pathname:i.pathnameBase)}function Tc(n,t,i,l=!1){let c;typeof n=="string"?c=Qr(n):(c={...n},pt(!c.pathname||!c.pathname.includes("?"),Wd("?","pathname","search",c)),pt(!c.pathname||!c.pathname.includes("#"),Wd("#","pathname","hash",c)),pt(!c.search||!c.search.includes("#"),Wd("#","search","hash",c)));let u=n===""||c.pathname==="",h=u?"/":c.pathname,m;if(h==null)m=i;else{let b=t.length-1;if(!l&&h.startsWith("..")){let x=h.split("/");for(;x[0]==="..";)x.shift(),b-=1;c.pathname=x.join("/")}m=b>=0?t[b]:"/"}let p=tw(c,m),y=h&&h!=="/"&&h.endsWith("/"),v=(u||h===".")&&i.endsWith("/");return!p.pathname.endsWith("/")&&(y||v)&&(p.pathname+="/"),p}var Bx=n=>n.replace(/[\\/]{2,}/g,"/"),es=n=>Bx(n.join("/"));function Yr(n,t=0){let i=n.length;for(;i>t&&n.charCodeAt(i-1)===47;)i--;return i===n.length?n:n.slice(0,i)}var sw=n=>Yr(n).replace(/^\/*/,"/"),aw=n=>!n||n==="?"?"":n.startsWith("?")?n:"?"+n,rw=n=>!n||n==="#"?"":n.startsWith("#")?n:"#"+n,iw=class{constructor(n,t,i,l=!1){this.status=n,this.statusText=t||"",this.internal=l,i instanceof Error?(this.data=i.toString(),this.error=i):this.data=i}};function lw(n){return n!=null&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.internal=="boolean"&&"data"in n}function ow(n){let t=n.map(i=>i.route.path).filter(Boolean);return es(t)||"/"}var $x=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Px(n,t){let i=n;if(typeof i!="string"||!Qh.test(i))return{absoluteURL:void 0,isExternal:!1,to:i};let l=i,c=!1;if($x)try{let u=new URL(window.location.href),h=zx.test(i)?new URL(IT(i,u.protocol)):new URL(i),m=Ms(h.pathname,t);h.origin===u.origin&&m!=null?i=m+h.search+h.hash:c=!0}catch{Pn(!1,`<Link to="${i}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:l,isExternal:c,to:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var By=new URL("http://localhost");function Wh(n){if(n.createURL)return n.createURL("/");try{return new URL(n.createHref("/"),By)}catch{return By}}function Jd(n,t){return n.origin===t.origin&&(n.origin!=="null"||n.protocol===t.protocol&&n.host===t.host)}function cw(n,t){if(n.startsWith("//"))return!0;let i=t.protocol.toLowerCase();return n.toLowerCase().startsWith(i)?t.host===""||n.slice(i.length).startsWith("//"):!1}function Jh(n,t,i,l){let c=null;try{c=n==null?null:new URL(n,i)}catch{}let u=new URL(t,i),h=c!=null&&!Jd(c,i),m=!Jd(u,i);if(l==="reject"){if(h||m)throw new Error("External navigation is not allowed")}else if(m&&(c==null||!cw(n,c)||!Jd(c,u)))throw new Error("External navigation is not allowed")}var Hx=["POST","PUT","PATCH","DELETE"];new Set(Hx);var uw=["GET",...Hx];new Set(uw);var dw=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function hw(n){try{return dw.includes(new URL(n).protocol)}catch{return!1}}var Zr=d.createContext(null);Zr.displayName="DataRouter";var wc=d.createContext(null);wc.displayName="DataRouterState";var Gx=d.createContext(!1);function fw(){return d.useContext(Gx)}var Vx=d.createContext({isTransitioning:!1});Vx.displayName="ViewTransition";var pw=d.createContext(new Map);pw.displayName="Fetchers";var mw=d.createContext(null);mw.displayName="Await";var jn=d.createContext(null);jn.displayName="Navigation";var bl=d.createContext(null);bl.displayName="Location";var Hn=d.createContext({outlet:null,matches:[],isDataRoute:!1});Hn.displayName="Route";var ef=d.createContext(null);ef.displayName="RouteError";var Fx="REACT_ROUTER_ERROR",gw="REDIRECT",yw="ROUTE_ERROR_RESPONSE";function vw(n){if(n.startsWith(`${Fx}:${gw}:{`))try{let t=JSON.parse(n.slice(28));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.location=="string"&&typeof t.reloadDocument=="boolean"&&typeof t.replace=="boolean")return t}catch{}}function xw(n){if(n.startsWith(`${Fx}:${yw}:{`))try{let t=JSON.parse(n.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new iw(t.status,t.statusText,t.data)}catch{}}function bw(n,{relative:t}={}){pt(Wr(),"useHref() may be used only in the context of a <Router> component.");let{basename:i,navigator:l}=d.useContext(jn),{hash:c,pathname:u,search:h}=_l(n,{relative:t}),m=u;return i!=="/"&&(m=u==="/"?i:es([i,u])),l.createHref({pathname:m,search:h,hash:c})}function Wr(){return d.useContext(bl)!=null}function Mt(){return pt(Wr(),"useLocation() may be used only in the context of a <Router> component."),d.useContext(bl).location}var Yx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Kx(n){d.useContext(jn).static||d.useLayoutEffect(n)}function De(){let{isDataRoute:n}=d.useContext(Hn);return n?Lw():_w()}function _w(){pt(Wr(),"useNavigate() may be used only in the context of a <Router> component.");let n=d.useContext(Zr),{basename:t,navigator:i}=d.useContext(jn),{matches:l}=d.useContext(Hn),{pathname:c}=Mt(),u=JSON.stringify(Zh(l)),h=d.useRef(!1);return Kx(()=>{h.current=!0}),d.useCallback((p,y={})=>{if(Pn(h.current,Yx),!h.current)return;if(typeof p=="number"){i.go(p);return}let v=Tc(p,JSON.parse(u),c,y.relative==="path");n==null&&t!=="/"&&(v.pathname=v.pathname==="/"?t:es([t,v.pathname])),Jh(typeof p=="string"?p:Ga(p),i.createHref(v),Wh(i),"reject"),(y.replace?i.replace:i.push)(v,y.state,y)},[t,i,u,c,n])}var Sw=d.createContext(null);function jw(n){let t=d.useContext(Hn).outlet;return d.useMemo(()=>t&&d.createElement(Sw.Provider,{value:n},t),[t,n])}function Jt(){let{matches:n}=d.useContext(Hn);return n[n.length-1]?.params??{}}function _l(n,{relative:t}={}){let{matches:i}=d.useContext(Hn),{pathname:l}=Mt(),c=JSON.stringify(Zh(i));return d.useMemo(()=>Tc(n,JSON.parse(c),l,t==="path"),[n,c,l,t])}function Tw(n,t){return Xx(n,t)}function Xx(n,t,i){pt(Wr(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:l}=d.useContext(jn),{matches:c}=d.useContext(Hn),u=c[c.length-1],h=u?u.params:{},m=u?u.pathname:"/",p=u?u.pathnameBase:"/",y=u&&u.route;{let w=y&&y.path||"";Zx(m,!y||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${m}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
10
|
+
|
|
11
|
+
Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let v=Mt(),b;if(t){let w=typeof t=="string"?Qr(t):t;pt(p==="/"||w.pathname?.startsWith(p),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${p}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=v;let x=b.pathname||"/",_=x;if(p!=="/"){let w=p.replace(/^\//,"").split("/");_="/"+x.replace(/^\//,"").split("/").slice(w.length).join("/")}let k=i&&i.state.matches.length?i.state.matches.map(w=>Object.assign(w,{route:i.manifest[w.route.id]||w.route})):Lx(n,{pathname:_});Pn(y||k!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Pn(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let T=Nw(k&&k.map(w=>Object.assign({},w,{params:Object.assign({},h,w.params),pathname:es([p,l.encodeLocation?l.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?p:es([p,l.encodeLocation?l.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),c,i);return t&&T?d.createElement(bl.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},T):T}function ww(){let n=zw(),t=lw(n)?`${n.status} ${n.statusText}`:n instanceof Error?n.message:JSON.stringify(n),i=n instanceof Error?n.stack:null,l="rgba(200,200,200, 0.5)",c={padding:"0.5rem",backgroundColor:l},u={padding:"2px 4px",backgroundColor:l},h=null;return console.error("Error handled by React Router default ErrorBoundary:",n),h=d.createElement(d.Fragment,null,d.createElement("p",null,"💿 Hey developer 👋"),d.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",d.createElement("code",{style:u},"ErrorBoundary")," or"," ",d.createElement("code",{style:u},"errorElement")," prop on your route.")),d.createElement(d.Fragment,null,d.createElement("h2",null,"Unexpected Application Error!"),d.createElement("h3",{style:{fontStyle:"italic"}},t),i?d.createElement("pre",{style:c},i):null,h)}var kw=d.createElement(ww,null),Qx=class extends d.Component{constructor(n){super(n),this.state={location:n.location,revalidation:n.revalidation,error:n.error}}static getDerivedStateFromError(n){return{error:n}}static getDerivedStateFromProps(n,t){return t.location!==n.location||t.revalidation!=="idle"&&n.revalidation==="idle"?{error:n.error,location:n.location,revalidation:n.revalidation}:{error:n.error!==void 0?n.error:t.error,location:t.location,revalidation:n.revalidation||t.revalidation}}componentDidCatch(n,t){this.props.onError?this.props.onError(n,t):console.error("React Router caught the following error during render",n)}render(){let n=this.state.error;if(this.context&&typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){const i=xw(n.digest);i&&(n=i)}let t=n!==void 0?d.createElement(Hn.Provider,{value:this.props.routeContext},d.createElement(ef.Provider,{value:n,children:this.props.component})):this.props.children;return this.context?d.createElement(Ew,{error:n},t):t}};Qx.contextType=Gx;var eh=new WeakMap;function Ew({children:n,error:t}){let{basename:i,navigator:l}=d.useContext(jn);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let c=vw(t.digest);if(c){let u=eh.get(t);if(u)throw u;let h=Px(c.location,i),m=h.absoluteURL||h.to;if(Jh(c.location,m,Wh(l),"allow-explicit"),hw(m))throw new Error("Invalid redirect location");if($x&&!eh.get(t))if(h.isExternal||c.reloadDocument)window.location.href=m;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(h.to,{replace:c.replace}));throw eh.set(t,p),p}return d.createElement("meta",{httpEquiv:"refresh",content:`0;url=${m}`})}}return n}function Cw({routeContext:n,match:t,children:i}){let l=d.useContext(Zr);return l&&l.static&&l.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(l.staticContext._deepestRenderedBoundaryId=t.route.id),d.createElement(Hn.Provider,{value:n},i)}function Nw(n,t=[],i){let l=i?.state;if(n==null){if(!l)return null;if(l.errors)n=l.matches;else if(t.length===0&&!l.initialized&&l.matches.length>0)n=l.matches;else return null}let c=n,u=l?.errors;if(u!=null){let v=c.findIndex(b=>b.route.id&&u?.[b.route.id]!==void 0);pt(v>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,v+1))}let h=!1,m=-1;if(i&&l){h=l.renderFallback;for(let v=0;v<c.length;v++){let b=c[v];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(m=v),b.route.id){let{loaderData:x,errors:_}=l,k=b.route.loader&&!x.hasOwnProperty(b.route.id)&&(!_||_[b.route.id]===void 0);if(b.route.lazy||k){i.isStatic&&(h=!0),m>=0?c=c.slice(0,m+1):c=[c[0]];break}}}}let p=i?.onError,y=l&&p?(v,b)=>{p(v,{location:l.location,params:l.matches?.[0]?.params??{},pattern:ow(l.matches),errorInfo:b})}:void 0;return c.reduceRight((v,b,x)=>{let _,k=!1,T=null,w=null;l&&(_=u&&b.route.id?u[b.route.id]:void 0,T=b.route.errorElement||kw,h&&(m<0&&x===0?(Zx("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),k=!0,w=null):m===x&&(k=!0,w=b.route.hydrateFallbackElement||null)));let E=t.concat(c.slice(0,x+1)),R=()=>{let D;return _?D=T:k?D=w:b.route.Component?D=d.createElement(b.route.Component,null):b.route.element?D=b.route.element:D=v,d.createElement(Cw,{match:b,routeContext:{outlet:v,matches:E,isDataRoute:l!=null},children:D})};return l&&(b.route.ErrorBoundary||b.route.errorElement||x===0)?d.createElement(Qx,{location:l.location,revalidation:l.revalidation,component:T,error:_,children:R(),routeContext:{outlet:null,matches:E,isDataRoute:!0},onError:y}):R()},null)}function tf(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Aw(n){let t=d.useContext(Zr);return pt(t,tf(n)),t}function Rw(n){let t=d.useContext(wc);return pt(t,tf(n)),t}function Dw(n){let t=d.useContext(Hn);return pt(t,tf(n)),t}function nf(n){let t=Dw(n),i=t.matches[t.matches.length-1];return pt(i.route.id,`${n} can only be used on routes that contain a unique "id"`),i.route.id}function Ow(){return nf("useRouteId")}function zw(){let n=d.useContext(ef),t=Rw("useRouteError"),i=nf("useRouteError");return n!==void 0?n:t.errors?.[i]}function Lw(){let{router:n}=Aw("useNavigate"),t=nf("useNavigate"),i=d.useRef(!1);return Kx(()=>{i.current=!0}),d.useCallback(async(c,u={})=>{Pn(i.current,Yx),i.current&&(typeof c=="number"?await n.navigate(c):await n.navigate(c,{fromRouteId:t,...u}))},[n,t])}var $y={};function Zx(n,t,i){!t&&!$y[n]&&($y[n]=!0,Pn(!1,i))}d.memo(Mw);function Mw({routes:n,manifest:t,future:i,state:l,isStatic:c,onError:u}){return Xx(n,void 0,{manifest:t,state:l,isStatic:c,onError:u})}function Is({to:n,replace:t,state:i,relative:l}){pt(Wr(),"<Navigate> may be used only in the context of a <Router> component.");let{static:c,navigator:u}=d.useContext(jn);Pn(!c,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:h}=d.useContext(Hn),{pathname:m}=Mt(),p=De(),y=Tc(n,Zh(h),m,l==="path");Jh(typeof n=="string"?n:Ga(n),u.createHref(y),Wh(u),"reject");let v=JSON.stringify(y);return d.useEffect(()=>{p(JSON.parse(v),{replace:t,state:i,relative:l})},[p,v,l,t,i]),null}function Qt(n){return jw(n.context)}function je(n){pt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function Iw({basename:n="/",children:t=null,location:i,navigationType:l="POP",navigator:c,static:u=!1,useTransitions:h}){pt(!Wr(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let m=n.replace(/^\/*/,"/"),p=d.useMemo(()=>({basename:m,navigator:c,static:u,useTransitions:h,future:{}}),[m,c,u,h]);typeof i=="string"&&(i=Qr(i));let{pathname:y="/",search:v="",hash:b="",state:x=null,key:_="default",mask:k}=i,T=d.useMemo(()=>{let w=Ms(y,m);return w==null?null:{location:{pathname:w,search:v,hash:b,state:x,key:_,mask:k},navigationType:l}},[m,y,v,b,x,_,l,k]);return Pn(T!=null,`<Router basename="${m}"> is not able to match the URL "${y}${v}${b}" because it does not start with the basename, so the <Router> won't render anything.`),T==null?null:d.createElement(jn.Provider,{value:p},d.createElement(bl.Provider,{children:t,value:T}))}function ps({children:n,location:t}){return Tw(Ah(n),t)}function Ah(n,t=[]){let i=[];return d.Children.forEach(n,(l,c)=>{if(!d.isValidElement(l))return;let u=[...t,c];if(l.type===d.Fragment){i.push.apply(i,Ah(l.props.children,u));return}pt(l.type===je,`[${typeof l.type=="string"?l.type:l.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),pt(!l.props.index||!l.props.children,"An index route cannot have child routes.");let h={id:l.props.id||u.join("-"),caseSensitive:l.props.caseSensitive,element:l.props.element,Component:l.props.Component,index:l.props.index,path:l.props.path,middleware:l.props.middleware,loader:l.props.loader,action:l.props.action,hydrateFallbackElement:l.props.hydrateFallbackElement,HydrateFallback:l.props.HydrateFallback,errorElement:l.props.errorElement,ErrorBoundary:l.props.ErrorBoundary,hasErrorBoundary:l.props.hasErrorBoundary===!0||l.props.ErrorBoundary!=null||l.props.errorElement!=null,shouldRevalidate:l.props.shouldRevalidate,handle:l.props.handle,lazy:l.props.lazy};l.props.children&&(h.children=Ah(l.props.children,u)),i.push(h)}),i}var ic="get",lc="application/x-www-form-urlencoded";function kc(n){return typeof HTMLElement<"u"&&n instanceof HTMLElement}function qw(n){return kc(n)&&n.tagName.toLowerCase()==="button"}function Uw(n){return kc(n)&&n.tagName.toLowerCase()==="form"}function Bw(n){return kc(n)&&n.tagName.toLowerCase()==="input"}function $w(n){return!!(n.metaKey||n.altKey||n.ctrlKey||n.shiftKey)}function Pw(n,t){return n.button===0&&(!t||t==="_self")&&!$w(n)}function Rh(n=""){return new URLSearchParams(typeof n=="string"||Array.isArray(n)||n instanceof URLSearchParams?n:Object.keys(n).reduce((t,i)=>{let l=n[i];return t.concat(Array.isArray(l)?l.map(c=>[i,c]):[[i,l]])},[]))}function Hw(n,t){let i=Rh(n);return t&&t.forEach((l,c)=>{i.has(c)||t.getAll(c).forEach(u=>{i.append(c,u)})}),i}var Po=null;function Gw(){if(Po===null)try{new FormData(document.createElement("form"),0),Po=!1}catch{Po=!0}return Po}var Vw=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function th(n){return n!=null&&!Vw.has(n)?(Pn(!1,`"${n}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${lc}"`),null):n}function Fw(n,t){let i,l,c,u,h;if(Uw(n)){let m=n.getAttribute("action");l=m?Ms(m,t):null,i=n.getAttribute("method")||ic,c=th(n.getAttribute("enctype"))||lc,u=new FormData(n)}else if(qw(n)||Bw(n)&&(n.type==="submit"||n.type==="image")){let m=n.form;if(m==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=n.getAttribute("formaction")||m.getAttribute("action");if(l=p?Ms(p,t):null,i=n.getAttribute("formmethod")||m.getAttribute("method")||ic,c=th(n.getAttribute("formenctype"))||th(m.getAttribute("enctype"))||lc,u=new FormData(m,n),!Gw()){let{name:y,type:v,value:b}=n;if(v==="image"){let x=y?`${y}.`:"";u.append(`${x}x`,"0"),u.append(`${x}y`,"0")}else y&&u.append(y,b)}}else{if(kc(n))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');i=ic,l=null,c=lc,h=n}return u&&c==="text/plain"&&(h=u,u=void 0),{action:l,method:i.toLowerCase(),encType:c,formData:u,body:h}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function sf(n,t){if(n===!1||n===null||typeof n>"u")throw new Error(t)}function Wx(n,t,i,l){let c=typeof n=="string"?new URL(n,typeof window>"u"?"server://singlefetch/":window.location.origin):n;return i?c.pathname.endsWith("/")?c.pathname=`${c.pathname}_.${l}`:c.pathname=`${c.pathname}.${l}`:c.pathname==="/"?c.pathname=`_root.${l}`:t&&Ms(c.pathname,t)==="/"?c.pathname=`${Yr(t)}/_root.${l}`:c.pathname=`${Yr(c.pathname)}.${l}`,c}async function Yw(n,t){if(n.id in t)return t[n.id];try{let i=await import(n.module);return t[n.id]=i,i}catch(i){return console.error(`Error loading route module \`${n.module}\`, reloading page...`),console.error(i),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Kw(n){return n==null?!1:n.href==null?n.rel==="preload"&&typeof n.imageSrcSet=="string"&&typeof n.imageSizes=="string":typeof n.rel=="string"&&typeof n.href=="string"}async function Xw(n,t,i){let l=await Promise.all(n.map(async c=>{let u=t.routes[c.route.id];if(u){let h=await Yw(u,i);return h.links?h.links():[]}return[]}));return Jw(l.flat(1).filter(Kw).filter(c=>c.rel==="stylesheet"||c.rel==="preload").map(c=>c.rel==="stylesheet"?{...c,rel:"prefetch",as:"style"}:{...c,rel:"prefetch"}))}function Py(n,t,i,l,c,u){let h=(p,y)=>i[y]?p.route.id!==i[y].route.id:!0,m=(p,y)=>i[y].pathname!==p.pathname||i[y].route.path?.endsWith("*")&&i[y].params["*"]!==p.params["*"];return u==="assets"?t.filter((p,y)=>h(p,y)||m(p,y)):u==="data"?t.filter((p,y)=>{let v=l.routes[p.route.id];if(!v||!v.hasLoader)return!1;if(h(p,y)||m(p,y))return!0;if(p.route.shouldRevalidate){let b=p.route.shouldRevalidate({currentUrl:new URL(c.pathname+c.search+c.hash,window.origin),currentParams:i[0]?.params||{},nextUrl:new URL(n,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Qw(n,t,{includeHydrateFallback:i}={}){return Zw(n.map(l=>{let c=t.routes[l.route.id];if(!c)return[];let u=[c.module];return c.clientActionModule&&(u=u.concat(c.clientActionModule)),c.clientLoaderModule&&(u=u.concat(c.clientLoaderModule)),i&&c.hydrateFallbackModule&&(u=u.concat(c.hydrateFallbackModule)),c.imports&&(u=u.concat(c.imports)),u}).flat(1))}function Zw(n){return[...new Set(n)]}function Ww(n){let t={},i=Object.keys(n).sort();for(let l of i)t[l]=n[l];return t}function Jw(n,t){let i=new Set;return new Set(t),n.reduce((l,c)=>{let u=JSON.stringify(Ww(c));return i.has(u)||(i.add(u),l.push({key:u,link:c})),l},[])}function af(){let n=d.useContext(Zr);return sf(n,"You must render this element inside a <DataRouterContext.Provider> element"),n}function ek(){let n=d.useContext(wc);return sf(n,"You must render this element inside a <DataRouterStateContext.Provider> element"),n}var rf=d.createContext(void 0);rf.displayName="FrameworkContext";function Ec(){let n=d.useContext(rf);return sf(n,"You must render this element inside a <HydratedRouter> element"),n}function tk(n,t){let i=d.useContext(rf),[l,c]=d.useState(!1),[u,h]=d.useState(!1),{onFocus:m,onBlur:p,onMouseEnter:y,onMouseLeave:v,onTouchStart:b}=t,x=d.useRef(null);d.useEffect(()=>{if(n==="render"&&h(!0),n==="viewport"){let T=E=>{E.forEach(R=>{h(R.isIntersecting)})},w=new IntersectionObserver(T,{threshold:.5});return x.current&&w.observe(x.current),()=>{w.disconnect()}}},[n]),d.useEffect(()=>{if(l){let T=setTimeout(()=>{h(!0)},100);return()=>{clearTimeout(T)}}},[l]);let _=()=>{c(!0)},k=()=>{c(!1),h(!1)};return i?n!=="intent"?[u,x,{}]:[u,x,{onFocus:tl(m,_),onBlur:tl(p,k),onMouseEnter:tl(y,_),onMouseLeave:tl(v,k),onTouchStart:tl(b,_)}]:[!1,x,{}]}function tl(n,t){return i=>{n&&n(i),i.defaultPrevented||t(i)}}function nk({page:n,...t}){let i=fw(),{nonce:l}=Ec(),{router:c}=af(),u=d.useMemo(()=>Lx(c.routes,n,c.basename),[c.routes,n,c.basename]);return u?(t.nonce==null&&l&&(t={...t,nonce:l}),i?d.createElement(ak,{page:n,matches:u,...t}):d.createElement(rk,{page:n,matches:u,...t})):null}function sk(n){let{manifest:t,routeModules:i}=Ec(),[l,c]=d.useState([]);return d.useEffect(()=>{let u=!1;return Xw(n,t,i).then(h=>{u||c(h)}),()=>{u=!0}},[n,t,i]),l}function ak({page:n,matches:t,...i}){let l=Mt(),{future:c}=Ec(),{basename:u}=af(),h=d.useMemo(()=>{if(n===l.pathname+l.search+l.hash)return[];let m=Wx(n,u,c.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,y=[];for(let v of t)typeof v.route.shouldRevalidate=="function"?p=!0:y.push(v.route.id);return p&&y.length>0&&m.searchParams.set("_routes",y.join(",")),[m.pathname+m.search]},[u,c.v8_trailingSlashAwareDataRequests,n,l,t]);return d.createElement(d.Fragment,null,h.map(m=>d.createElement("link",{key:m,rel:"prefetch",as:"fetch",href:m,...i})))}function rk({page:n,matches:t,...i}){let l=Mt(),{future:c,manifest:u,routeModules:h}=Ec(),{basename:m}=af(),{loaderData:p,matches:y}=ek(),v=d.useMemo(()=>Py(n,t,y,u,l,"data"),[n,t,y,u,l]),b=d.useMemo(()=>Py(n,t,y,u,l,"assets"),[n,t,y,u,l]),x=d.useMemo(()=>{if(n===l.pathname+l.search+l.hash)return[];let T=new Set,w=!1;if(t.forEach(R=>{let D=u.routes[R.route.id];!D||!D.hasLoader||(!v.some(O=>O.route.id===R.route.id)&&R.route.id in p&&h[R.route.id]?.shouldRevalidate||D.hasClientLoader?w=!0:T.add(R.route.id))}),T.size===0)return[];let E=Wx(n,m,c.v8_trailingSlashAwareDataRequests,"data");return w&&T.size>0&&E.searchParams.set("_routes",t.filter(R=>T.has(R.route.id)).map(R=>R.route.id).join(",")),[E.pathname+E.search]},[m,c.v8_trailingSlashAwareDataRequests,p,l,u,v,t,n,h]),_=d.useMemo(()=>Qw(b,u),[b,u]),k=sk(b);return d.createElement(d.Fragment,null,x.map(T=>d.createElement("link",{key:T,rel:"prefetch",as:"fetch",href:T,...i})),_.map(T=>d.createElement("link",{key:T,rel:"modulepreload",href:T,...i})),k.map(({key:T,link:w})=>d.createElement("link",{key:T,nonce:i.nonce,...w,crossOrigin:w.crossOrigin??i.crossOrigin})))}function ik(...n){return t=>{n.forEach(i=>{typeof i=="function"?i(t):i!=null&&(i.current=t)})}}var lk=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{lk&&(window.__reactRouterVersion="7.18.4")}catch{}function ok({basename:n,children:t,useTransitions:i,window:l}){let c=d.useRef();c.current==null&&(c.current=qT({window:l,v5Compat:!0}));let u=c.current,[h,m]=d.useState({action:u.action,location:u.location}),p=d.useCallback(y=>{i===!1?m(y):d.startTransition(()=>m(y))},[i]);return d.useLayoutEffect(()=>u.listen(p),[u,p]),d.createElement(Iw,{basename:n,children:t,location:h.location,navigationType:h.action,navigator:u,useTransitions:i})}var qs=d.forwardRef(function({onClick:t,discover:i="render",prefetch:l="none",relative:c,reloadDocument:u,replace:h,mask:m,state:p,target:y,to:v,preventScrollReset:b,viewTransition:x,defaultShouldRevalidate:_,...k},T){let{basename:w,navigator:E,useTransitions:R}=d.useContext(jn),D=typeof v=="string"&&Qh.test(v),O=Px(v,w);v=O.to;let z=bw(v,{relative:c}),A=Mt(),C=null;if(m){let ye=Tc(m,[],A.mask?A.mask.pathname:"/",!0);w!=="/"&&(ye.pathname=ye.pathname==="/"?w:es([w,ye.pathname])),C=E.createHref(ye)}let[L,P,Y]=tk(l,k),U=hk(v,{replace:h,mask:m,state:p,target:y,preventScrollReset:b,relative:c,viewTransition:x,defaultShouldRevalidate:_,useTransitions:R});function re(ye){t&&t(ye),ye.defaultPrevented||U(ye)}let Q=!(O.isExternal||u),J=d.createElement("a",{...k,...Y,href:(Q?C:void 0)||O.absoluteURL||z,onClick:Q?re:t,ref:ik(T,P),target:y,"data-discover":!D&&i==="render"?"true":void 0});return L&&!D?d.createElement(d.Fragment,null,J,d.createElement(nk,{page:z})):J});qs.displayName="Link";var ck=d.forwardRef(function({"aria-current":t="page",caseSensitive:i=!1,className:l="",end:c=!1,style:u,to:h,viewTransition:m,children:p,...y},v){let b=_l(h,{relative:y.relative}),x=Mt(),_=d.useContext(wc),{navigator:k,basename:T}=d.useContext(jn),w=_!=null&&yk(b)&&m===!0,E=k.encodeLocation?k.encodeLocation(b).pathname:b.pathname,R=x.pathname,D=_&&_.navigation&&_.navigation.location?_.navigation.location.pathname:null;i||(R=R.toLowerCase(),D=D?D.toLowerCase():null,E=E.toLowerCase()),D&&T&&(D=Ms(D,T)||D);const O=E!=="/"&&E.endsWith("/")?E.length-1:E.length;let z=R===E||!c&&R.startsWith(E)&&R.charAt(O)==="/",A=D!=null&&(D===E||!c&&D.startsWith(E)&&D.charAt(E.length)==="/"),C={isActive:z,isPending:A,isTransitioning:w},L=z?t:void 0,P;typeof l=="function"?P=l(C):P=[l,z?"active":null,A?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let Y=typeof u=="function"?u(C):u;return d.createElement(qs,{...y,"aria-current":L,className:P,ref:v,style:Y,to:h,viewTransition:m},typeof p=="function"?p(C):p)});ck.displayName="NavLink";var uk=d.forwardRef(({discover:n="render",fetcherKey:t,navigate:i,reloadDocument:l,replace:c,state:u,method:h=ic,action:m,onSubmit:p,relative:y,preventScrollReset:v,viewTransition:b,defaultShouldRevalidate:x,..._},k)=>{let{useTransitions:T}=d.useContext(jn),w=mk(),E=gk(m,{relative:y}),R=h.toLowerCase()==="get"?"get":"post",D=typeof m=="string"&&Qh.test(m),O=z=>{if(p&&p(z),z.defaultPrevented)return;z.preventDefault();let A=z.nativeEvent.submitter,C=A?.getAttribute("formmethod")||h,L=()=>w(A||z.currentTarget,{fetcherKey:t,method:C,navigate:i,replace:c,state:u,relative:y,preventScrollReset:v,viewTransition:b,defaultShouldRevalidate:x});T&&i!==!1?d.startTransition(()=>L()):L()};return d.createElement("form",{ref:k,method:R,action:E,onSubmit:l?p:O,..._,"data-discover":!D&&n==="render"?"true":void 0})});uk.displayName="Form";function dk(n){return`${n} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Jx(n){let t=d.useContext(Zr);return pt(t,dk(n)),t}function hk(n,{target:t,replace:i,mask:l,state:c,preventScrollReset:u,relative:h,viewTransition:m,defaultShouldRevalidate:p,useTransitions:y}={}){let v=De(),b=Mt(),x=_l(n,{relative:h});return d.useCallback(_=>{if(Pw(_,t)){_.preventDefault();let k=i!==void 0?i:Ga(b)===Ga(x),T=()=>v(n,{replace:k,mask:l,state:c,preventScrollReset:u,relative:h,viewTransition:m,defaultShouldRevalidate:p});y?d.startTransition(()=>T()):T()}},[b,v,x,i,l,c,t,n,u,h,m,p,y])}function lf(n){Pn(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=d.useRef(Rh(n)),i=d.useRef(!1),l=Mt(),c=d.useMemo(()=>Hw(l.search,i.current?null:t.current),[l.search]),u=De(),h=d.useCallback((m,p)=>{const y=Rh(typeof m=="function"?m(new URLSearchParams(c)):m);i.current=!0,u("?"+y,p)},[u,c]);return[c,h]}var fk=0,pk=()=>`__${String(++fk)}__`;function mk(){let{router:n}=Jx("useSubmit"),{basename:t}=d.useContext(jn),i=Ow(),l=n.fetch,c=n.navigate;return d.useCallback(async(u,h={})=>{let{action:m,method:p,encType:y,formData:v,body:b}=Fw(u,t);if(h.navigate===!1){let x=h.fetcherKey||pk();await l(x,i,h.action||m,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:v,body:b,formMethod:h.method||p,formEncType:h.encType||y,flushSync:h.flushSync})}else await c(h.action||m,{defaultShouldRevalidate:h.defaultShouldRevalidate,preventScrollReset:h.preventScrollReset,formData:v,body:b,formMethod:h.method||p,formEncType:h.encType||y,replace:h.replace,state:h.state,fromRouteId:i,flushSync:h.flushSync,viewTransition:h.viewTransition})},[l,c,t,i])}function gk(n,{relative:t}={}){let{basename:i}=d.useContext(jn),l=d.useContext(Hn);pt(l,"useFormAction must be used inside a RouteContext");let[c]=l.matches.slice(-1),u={..._l(n||".",{relative:t})},h=Mt();if(n==null){u.search=h.search;let m=new URLSearchParams(u.search),p=m.getAll("index");if(p.some(v=>v==="")){m.delete("index"),p.filter(b=>b).forEach(b=>m.append("index",b));let v=m.toString();u.search=v?`?${v}`:""}}return(!n||n===".")&&c.route.index&&(u.search=u.search?u.search.replace(/^\?/,"?index&"):"?index"),i!=="/"&&(u.pathname=u.pathname==="/"?i:es([i,u.pathname])),Ga(u)}function yk(n,{relative:t}={}){let i=d.useContext(Vx);pt(i!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:l}=Jx("useViewTransitionState"),c=_l(n,{relative:t});if(!i.isTransitioning)return!1;let u=Ms(i.currentLocation.pathname,l)||i.currentLocation.pathname,h=Ms(i.nextLocation.pathname,l)||i.nextLocation.pathname;return gc(c.pathname,h)!=null||gc(c.pathname,u)!=null}var eb=Ox();const vk=Kh(eb),tb=d.createContext(void 0);function xk({children:n}){const[t,i]=d.useState(()=>{const c=localStorage.getItem("theme");return c==="mono"?"kindling":c||"light"});d.useEffect(()=>{document.documentElement.setAttribute("data-theme",t),localStorage.setItem("theme",t)},[t]);const l=c=>{i(c)};return a.jsx(tb.Provider,{value:{theme:t,setTheme:l},children:n})}function nb(){const n=d.useContext(tb);if(!n)throw new Error("useTheme must be used within ThemeProvider");return n}let Hy=class extends Error{url;status;statusText;body;request;constructor(t,i,l){super(l),this.name="ApiError",this.url=i.url,this.status=i.status,this.statusText=i.statusText,this.body=i.body,this.request=t}};class bk extends Error{constructor(t){super(t),this.name="CancelError"}get isCancelled(){return!0}}class _k{#t;#e;#n;#s;#r;#i;#a;constructor(t){this.#t=!1,this.#e=!1,this.#n=!1,this.#s=[],this.#r=new Promise((i,l)=>{this.#i=i,this.#a=l;const c=m=>{this.#t||this.#e||this.#n||(this.#t=!0,this.#i&&this.#i(m))},u=m=>{this.#t||this.#e||this.#n||(this.#e=!0,this.#a&&this.#a(m))},h=m=>{this.#t||this.#e||this.#n||this.#s.push(m)};return Object.defineProperty(h,"isResolved",{get:()=>this.#t}),Object.defineProperty(h,"isRejected",{get:()=>this.#e}),Object.defineProperty(h,"isCancelled",{get:()=>this.#n}),t(c,u,h)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(t,i){return this.#r.then(t,i)}catch(t){return this.#r.catch(t)}finally(t){return this.#r.finally(t)}cancel(){if(!(this.#t||this.#e||this.#n)){if(this.#n=!0,this.#s.length)try{for(const t of this.#s)t()}catch(t){console.warn("Cancellation threw an error",t);return}this.#s.length=0,this.#a&&this.#a(new bk("Request aborted"))}}get isCancelled(){return this.#n}}const Le={BASE:"",VERSION:"1.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var Gy;(function(n){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(n.taskStatus||(n.taskStatus={})),(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(n.taskStatusBeforeClaim||(n.taskStatusBeforeClaim={}))})(Gy||(Gy={}));var Vy;(function(n){(function(t){t.HUMAN="human",t.AGENT="agent"})(n.type||(n.type={}))})(Vy||(Vy={}));var Fy;(function(n){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(n.type||(n.type={}))})(Fy||(Fy={}));var Yy;(function(n){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(n.type||(n.type={}))})(Yy||(Yy={}));var Ky;(function(n){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(n.type||(n.type={}))})(Ky||(Ky={}));var Xy;(function(n){(function(t){t.HTTP="http",t.STDIO="stdio"})(n.type||(n.type={}))})(Xy||(Xy={}));var Qy;(function(n){(function(t){t.CONVERSATION="conversation",t.QUICK_TASKS="quick_tasks",t.MIDDLE_MANAGER="middle_manager",t.EMBEDDINGS="embeddings"})(n.job||(n.job={}))})(Qy||(Qy={}));var Zy;(function(n){(function(t){t.LANGUAGE="language",t.EMBEDDING="embedding"})(n.kind||(n.kind={}))})(Zy||(Zy={}));var Wy;(function(n){(function(t){t.OPENAI="openai",t.ANTHROPIC="anthropic",t.GOOGLE="google",t.GOOGLE_VERTEX="google_vertex",t.XAI="xai",t.OPENAI_COMPATIBLE="openai_compatible"})(n.type||(n.type={}))})(Wy||(Wy={}));var Jy;(function(n){(function(t){t.NOT_STARTED="not_started",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.MCP_AUTH_FLOW_STARTED="mcp_auth_flow_started",t.MCP_AUTH_FLOW_COMPLETED="mcp_auth_flow_completed",t.CONNECTIONS_FLOW_STARTED="connections_flow_started",t.CONNECTIONS_FLOW_COMPLETED="connections_flow_completed",t.AUTHORIZATION_CODE_ISSUED="authorization_code_issued",t.AUTHORIZATION_CODE_EXCHANGED="authorization_code_exchanged"})(n.status||(n.status={}))})(Jy||(Jy={}));var ev;(function(n){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(n.status||(n.status={}))})(ev||(ev={}));var tv;(function(n){(function(t){t.NONE="none",t.CLIENT_SECRET_BASIC="client_secret_basic"})(n.token_endpoint_auth_method||(n.token_endpoint_auth_method={}))})(tv||(tv={}));var nv;(function(n){(function(t){t.PENDING="pending",t.AUTHORIZED="authorized",t.FAILED="failed"})(n.status||(n.status={}))})(nv||(nv={}));var sv;(function(n){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(n.type||(n.type={}))})(sv||(sv={}));var av;(function(n){(function(t){t.OPENAI="openai",t.ANTHROPIC="anthropic",t.GOOGLE="google",t.GOOGLE_VERTEX="google_vertex",t.XAI="xai",t.OPENAI_COMPATIBLE="openai_compatible"})(n.type||(n.type={}))})(av||(av={}));var Pr;(function(n){(function(t){t.ADMIN="admin",t.STANDARD="standard"})(n.role||(n.role={}))})(Pr||(Pr={}));var rv;(function(n){(function(t){t.HTTP="http",t.STDIO="stdio"})(n.type||(n.type={}))})(rv||(rv={}));var iv;(function(n){(function(t){t.CLIENT_NOT_REGISTERED="CLIENT_NOT_REGISTERED",t.CLIENT_REGISTERED="CLIENT_REGISTERED",t.AUTHORIZATION_REQUEST_STARTED="AUTHORIZATION_REQUEST_STARTED",t.USER_CONSENT_OK="USER_CONSENT_OK",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.WAITING_ON_DOWNSTREAM_AUTH="WAITING_ON_DOWNSTREAM_AUTH",t.AUTHORIZATION_CODE_ISSUED="AUTHORIZATION_CODE_ISSUED",t.AUTHORIZATION_CODE_EXCHANGED="AUTHORIZATION_CODE_EXCHANGED"})(n.status||(n.status={}))})(iv||(iv={}));var lv;(function(n){(function(t){t.TASK="task",t.CONTEXT_BLOCK="context_block",t.AGENT="agent",t.PROJECT="project",t.TAG="tag",t.TOOL="tool"})(n.type||(n.type={}))})(lv||(lv={}));var ov;(function(n){(function(t){t.ACCESS_TOKEN="access_token",t.REFRESH_TOKEN="refresh_token"})(n.token_type_hint||(n.token_type_hint={}))})(ov||(ov={}));var cv;(function(n){(function(t){t.BEARER="Bearer"})(n.token_type||(n.token_type={}))})(cv||(cv={}));var uv;(function(n){(function(t){t.ADMIN="admin",t.STANDARD="standard"})(n.role||(n.role={}))})(uv||(uv={}));var dv;(function(n){(function(t){t.CLIENT_NOT_REGISTERED="CLIENT_NOT_REGISTERED",t.CLIENT_REGISTERED="CLIENT_REGISTERED",t.AUTHORIZATION_REQUEST_STARTED="AUTHORIZATION_REQUEST_STARTED",t.USER_CONSENT_OK="USER_CONSENT_OK",t.USER_CONSENT_REJECTED="USER_CONSENT_REJECTED",t.WAITING_ON_DOWNSTREAM_AUTH="WAITING_ON_DOWNSTREAM_AUTH",t.AUTHORIZATION_CODE_ISSUED="AUTHORIZATION_CODE_ISSUED",t.AUTHORIZATION_CODE_EXCHANGED="AUTHORIZATION_CODE_EXCHANGED"})(n.status||(n.status={}))})(dv||(dv={}));var hv;(function(n){(function(t){t.CLAUDE="claude",t.CODEX="codex",t.OPENCODE="opencode",t.ADK="adk",t.GITHUBCOPILOT="githubcopilot",t.OTHER="other"})(n.type||(n.type={}))})(hv||(hv={}));var fv;(function(n){(function(t){t.NONE="none",t.CLIENT_SECRET_BASIC="client_secret_basic"})(n.token_endpoint_auth_method||(n.token_endpoint_auth_method={}))})(fv||(fv={}));var pv;(function(n){(function(t){t.HTTP="http",t.STDIO="stdio"})(n.type||(n.type={}))})(pv||(pv={}));var mv;(function(n){(function(t){t.SUCCEEDED="SUCCEEDED",t.FAILED="FAILED",t.STALE="STALE",t.CANCELLED="CANCELLED"})(n.status||(n.status={})),(function(t){t.OUT_OF_QUOTA="OUT_OF_QUOTA",t.INTERRUPTED="INTERRUPTED",t.UNKNOWN="UNKNOWN"})(n.errorCode||(n.errorCode={}))})(mv||(mv={}));var gv;(function(n){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(n.taskStatus||(n.taskStatus={})),(function(t){t.SUCCEEDED="SUCCEEDED",t.FAILED="FAILED",t.STALE="STALE",t.CANCELLED="CANCELLED"})(n.status||(n.status={})),(function(t){t.OUT_OF_QUOTA="OUT_OF_QUOTA",t.INTERRUPTED="INTERRUPTED",t.UNKNOWN="UNKNOWN"})(n.errorCode||(n.errorCode={}))})(gv||(gv={}));var yv;(function(n){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(n.taskStatus||(n.taskStatus={}))})(yv||(yv={}));var vv;(function(n){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(n.status||(n.status={}))})(vv||(vv={}));var xv;(function(n){(function(t){t.NOT_STARTED="NOT_STARTED",t.IN_PROGRESS="IN_PROGRESS",t.FOR_REVIEW="FOR_REVIEW",t.DONE="DONE"})(n.status||(n.status={}))})(xv||(xv={}));var bv;(function(n){(function(t){t.URN_IETF_PARAMS_OAUTH_GRANT_TYPE_TOKEN_EXCHANGE="urn:ietf:params:oauth:grant-type:token-exchange"})(n.grant_type||(n.grant_type={})),(function(t){t.URN_IETF_PARAMS_OAUTH_TOKEN_TYPE_ACCESS_TOKEN="urn:ietf:params:oauth:token-type:access_token"})(n.subject_token_type||(n.subject_token_type={}))})(bv||(bv={}));var _v;(function(n){(function(t){t.AUTHORIZATION_CODE="authorization_code",t.REFRESH_TOKEN="refresh_token"})(n.grant_type||(n.grant_type={}))})(_v||(_v={}));var Sv;(function(n){(function(t){t.BEARER="Bearer"})(n.token_type||(n.token_type={}))})(Sv||(Sv={}));var jv;(function(n){(function(t){t.HTTP="http",t.STDIO="stdio"})(n.type||(n.type={}))})(jv||(jv={}));var Tv;(function(n){(function(t){t.ADMIN="admin",t.STANDARD="standard"})(n.role||(n.role={})),(function(t){t.FULL_PAGE="FULL_PAGE",t.BANNER="BANNER",t.OFF="OFF"})(n.onboardingDisplayMode||(n.onboardingDisplayMode={}))})(Tv||(Tv={}));var wv;(function(n){(function(t){t.FULL_PAGE="FULL_PAGE",t.BANNER="BANNER",t.OFF="OFF"})(n.onboardingDisplayMode||(n.onboardingDisplayMode={}))})(wv||(wv={}));const of=n=>n!=null,Sl=n=>typeof n=="string",nh=n=>Sl(n)&&n!=="",cf=n=>typeof n=="object"&&typeof n.type=="string"&&typeof n.stream=="function"&&typeof n.arrayBuffer=="function"&&typeof n.constructor=="function"&&typeof n.constructor.name=="string"&&/^(Blob|File)$/.test(n.constructor.name)&&/^(Blob|File)$/.test(n[Symbol.toStringTag]),sb=n=>n instanceof FormData,Sk=n=>{try{return btoa(n)}catch{return Buffer.from(n).toString("base64")}},jk=n=>{const t=[],i=(c,u)=>{t.push(`${encodeURIComponent(c)}=${encodeURIComponent(String(u))}`)},l=(c,u)=>{of(u)&&(Array.isArray(u)?u.forEach(h=>{l(c,h)}):typeof u=="object"?Object.entries(u).forEach(([h,m])=>{l(`${c}[${h}]`,m)}):i(c,u))};return Object.entries(n).forEach(([c,u])=>{l(c,u)}),t.length>0?`?${t.join("&")}`:""},Tk=(n,t)=>{const i=n.ENCODE_PATH||encodeURI,l=t.url.replace("{api-version}",n.VERSION).replace(/{(.*?)}/g,(u,h)=>t.path?.hasOwnProperty(h)?i(String(t.path[h])):u),c=`${n.BASE}${l}`;return t.query?`${c}${jk(t.query)}`:c},wk=n=>{if(n.formData){const t=new FormData,i=(l,c)=>{Sl(c)||cf(c)?t.append(l,c):t.append(l,JSON.stringify(c))};return Object.entries(n.formData).filter(([l,c])=>of(c)).forEach(([l,c])=>{Array.isArray(c)?c.forEach(u=>i(l,u)):i(l,c)}),t}},Ho=async(n,t)=>typeof t=="function"?t(n):t,kk=async(n,t)=>{const[i,l,c,u]=await Promise.all([Ho(t,n.TOKEN),Ho(t,n.USERNAME),Ho(t,n.PASSWORD),Ho(t,n.HEADERS)]),h=Object.entries({Accept:"application/json",...u,...t.headers}).filter(([m,p])=>of(p)).reduce((m,[p,y])=>({...m,[p]:String(y)}),{});if(nh(i)&&(h.Authorization=`Bearer ${i}`),nh(l)&&nh(c)){const m=Sk(`${l}:${c}`);h.Authorization=`Basic ${m}`}return t.body!==void 0&&(t.mediaType?h["Content-Type"]=t.mediaType:cf(t.body)?h["Content-Type"]=t.body.type||"application/octet-stream":Sl(t.body)?h["Content-Type"]="text/plain":sb(t.body)||(h["Content-Type"]="application/json")),new Headers(h)},Ek=n=>{if(n.body!==void 0)return n.mediaType?.includes("/json")?JSON.stringify(n.body):Sl(n.body)||cf(n.body)||sb(n.body)?n.body:JSON.stringify(n.body)},Ck=async(n,t,i,l,c,u,h)=>{const m=new AbortController,p={headers:u,body:l??c,method:t.method,signal:m.signal};return n.WITH_CREDENTIALS&&(p.credentials=n.CREDENTIALS),h(()=>m.abort()),await fetch(i,p)},Nk=(n,t)=>{if(t){const i=n.headers.get(t);if(Sl(i))return i}},Ak=async n=>{if(n.status!==204)try{const t=n.headers.get("Content-Type");if(t)return["application/json","application/problem+json"].some(c=>t.toLowerCase().startsWith(c))?await n.json():await n.text()}catch(t){console.error(t)}},Rk=(n,t)=>{const l={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...n.errors}[t.status];if(l)throw new Hy(n,t,l);if(!t.ok){const c=t.status??"unknown",u=t.statusText??"unknown",h=(()=>{try{return JSON.stringify(t.body,null,2)}catch{return}})();throw new Hy(n,t,`Generic Error: status: ${c}; status text: ${u}; body: ${h}`)}},Be=(n,t)=>new _k(async(i,l,c)=>{try{const u=Tk(n,t),h=wk(t),m=Ek(t),p=await kk(n,t);if(!c.isCancelled){const y=await Ck(n,t,u,m,h,p,c),v=await Ak(y),b=Nk(y,t.responseHeader),x={url:u,ok:y.ok,status:y.status,statusText:y.statusText,body:b??v};Rk(t,x),i(x.body)}}catch(u){l(u)}});class ab{static actorControllerListActors(t=Le){return Be(t,{method:"GET",url:"/api/v1/actors"})}static actorControllerSearchActors(t,i=10,l=.3,c=Le){return Be(c,{method:"GET",url:"/api/v1/actors/search",query:{query:t,limit:i,threshold:l}})}}class hl{static aiModelSelectionsControllerListAiModelSelections(t=Le){return Be(t,{method:"GET",url:"/api/v1/ai-model-selections"})}static aiModelSelectionsControllerSetAiModelSelection(t,i,l=Le){return Be(l,{method:"PUT",url:"/api/v1/ai-model-selections/{job}",path:{job:t},body:i,mediaType:"application/json",errors:{404:"AI provider not found"}})}static aiModelSelectionsControllerClearAiModelSelection(t,i=Le){return Be(i,{method:"DELETE",url:"/api/v1/ai-model-selections/{job}",path:{job:t}})}}class Ua{static aiProvidersControllerCreateAiProvider(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/ai-providers",body:t,mediaType:"application/json"})}static aiProvidersControllerListAiProviders(t=Le){return Be(t,{method:"GET",url:"/api/v1/ai-providers"})}static aiProvidersControllerGetAiProvider(t,i=Le){return Be(i,{method:"GET",url:"/api/v1/ai-providers/{id}",path:{id:t},errors:{404:"AI provider not found"}})}static aiProvidersControllerUpdateAiProvider(t,i,l=Le){return Be(l,{method:"PATCH",url:"/api/v1/ai-providers/{id}",path:{id:t},body:i,mediaType:"application/json",errors:{404:"AI provider not found"}})}static aiProvidersControllerDeleteAiProvider(t,i=Le){return Be(i,{method:"DELETE",url:"/api/v1/ai-providers/{id}",path:{id:t},errors:{404:"AI provider not found"}})}static aiProvidersControllerListAiProviderModels(t,i=Le){return Be(i,{method:"GET",url:"/api/v1/ai-providers/{id}/models",path:{id:t},errors:{404:"AI provider not found"}})}}let rb=class{static metaControllerCreateTag(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/meta/tags",body:t,mediaType:"application/json",errors:{400:"Invalid input data"}})}static metaControllerGetAllTags(t=Le){return Be(t,{method:"GET",url:"/api/v1/meta/tags"})}static metaControllerGetTagColors(t=Le){return Be(t,{method:"GET",url:"/api/v1/meta/tags/colors"})}static metaControllerDeleteTag(t,i=Le){return Be(i,{method:"DELETE",url:"/api/v1/meta/tags/{tagId}",path:{tagId:t},errors:{404:"Tag not found"}})}static metaControllerGetVersion(t=Le){return Be(t,{method:"GET",url:"/api/v1/meta/version"})}};class yc{static projectsControllerCreateProject(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/meta/projects",body:t,mediaType:"application/json",errors:{400:"Invalid input data"}})}static projectsControllerGetAllProjects(t=Le){return Be(t,{method:"GET",url:"/api/v1/meta/projects"})}static projectsControllerSearchProjects(t,i,l,c=Le){return Be(c,{method:"GET",url:"/api/v1/meta/projects/search",query:{q:t,limit:i,threshold:l}})}static projectsControllerGetProjectBySlug(t,i=Le){return Be(i,{method:"GET",url:"/api/v1/meta/projects/by-slug/{slug}",path:{slug:t},errors:{404:"Project not found"}})}static projectsControllerGetProject(t,i=Le){return Be(i,{method:"GET",url:"/api/v1/meta/projects/{projectId}",path:{projectId:t},errors:{404:"Project not found"}})}static projectsControllerUpdateProject(t,i,l=Le){return Be(l,{method:"PATCH",url:"/api/v1/meta/projects/{projectId}",path:{projectId:t},body:i,mediaType:"application/json",errors:{400:"Invalid input data",404:"Project not found"}})}static projectsControllerDeleteProject(t,i=Le){return Be(i,{method:"DELETE",url:"/api/v1/meta/projects/{projectId}",path:{projectId:t},errors:{404:"Project not found"}})}}class tn{static webAuthControllerLogin(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/auth/login",body:t,mediaType:"application/json",errors:{401:"Invalid credentials"}})}static webAuthControllerListUsers(t=Le){return Be(t,{method:"GET",url:"/api/v1/auth/users"})}static webAuthControllerCreateUser(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/auth/users",body:t,mediaType:"application/json"})}static webAuthControllerResetUserPassword(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/auth/users/{userId}/reset-password",path:{userId:t}})}static webAuthControllerDeleteUser(t,i=Le){return Be(i,{method:"DELETE",url:"/api/v1/auth/users/{userId}",path:{userId:t}})}static webAuthControllerGetAccountSetupStatus(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/auth/account-setup-status",body:t,mediaType:"application/json"})}static webAuthControllerSetupAccount(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/auth/setup-account",body:t,mediaType:"application/json"})}static webAuthControllerRefresh(t=Le){return Be(t,{method:"POST",url:"/api/v1/auth/refresh",errors:{401:"Invalid or expired refresh token"}})}static webAuthControllerLogout(t=Le){return Be(t,{method:"POST",url:"/api/v1/auth/logout"})}static webAuthControllerMe(t=Le){return Be(t,{method:"GET",url:"/api/v1/auth/me",errors:{401:"Not authenticated"}})}static webAuthControllerChangePassword(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/auth/change-password",body:t,mediaType:"application/json",errors:{401:"Not authenticated or current password is incorrect"}})}static webAuthControllerGetOnboardingStatus(t=Le){return Be(t,{method:"GET",url:"/api/v1/auth/onboarding-status"})}static webAuthControllerOnboard(t,i=Le){return Be(i,{method:"POST",url:"/api/v1/auth/onboard",body:t,mediaType:"application/json",errors:{409:"Admin users already exist, onboarding not allowed"}})}static webAuthControllerMarkWalkthroughSeen(t=Le){return Be(t,{method:"POST",url:"/api/v1/auth/mark-walkthrough-seen",errors:{401:"Not authenticated"}})}}const Dk=()=>"",va=n=>n,Va=Dk();Le.BASE=Va;Le.CREDENTIALS="include";Le.BASE=Va;const ib=d.createContext(void 0);function Ok({children:n}){const[t,i]=d.useState(null),[l,c]=d.useState(!0);d.useEffect(()=>{tn.webAuthControllerMe().then(y=>{i(y)}).catch(()=>{i(null)}).finally(()=>{c(!1)})},[]),d.useEffect(()=>{if(!t)return;const y=setInterval(async()=>{try{const v=await tn.webAuthControllerRefresh();i(v.user)}catch(v){console.error("Token refresh failed:",v),i(null)}},480*1e3);return()=>clearInterval(y)},[t]);const p={user:t,isAuthenticated:!!t,isLoading:l,login:async(y,v)=>{const b=await tn.webAuthControllerLogin({email:y,password:v});i(b.user)},logout:async()=>{try{await tn.webAuthControllerLogout()}finally{i(null)}},refreshAuth:async()=>{const y=await tn.webAuthControllerRefresh();i(y.user)}};return a.jsx(ib.Provider,{value:p,children:n})}function un(){const n=d.useContext(ib);if(n===void 0)throw new Error("useAuth must be used within an AuthProvider");return n}function lb({children:n}){return a.jsx("div",{className:"login-page",children:a.jsx("div",{className:"login-container",children:a.jsx("div",{className:"login-card",children:n})})})}const sh=["a1","a2","a3","a4","a5","a6"];function zk(n){let t=5381;for(let i=0;i<n.length;i++)t=t*33^n.charCodeAt(i);return t>>>0}function Lk(n){if(!n)return sh[0];const t=zk(n.trim().toLowerCase())%sh.length;return sh[t]}function Mk(n){if(!n)return"?";const t=n.trim();if(!t)return"?";const i=t.split(/\s+/).filter(Boolean),l=i[0]?.[0]??"?",c=i.length>1?i[i.length-1]?.[0]:"";return(l+c).toUpperCase()}function Ik(n){return typeof n=="number"?null:`avatar--${n}`}function qk(n){if(typeof n=="number")return{width:n,height:n,fontSize:Math.max(10,Math.round(n*.42))}}function He({name:n,src:t,alt:i,size:l="md",className:c=""}){const u=Mk(n),h=Lk(n),m=Ik(l),p=qk(l);return t?a.jsx("img",{className:`avatar ${m??""} ${c}`,style:p,src:t,alt:i??n,loading:"lazy"}):a.jsx("div",{className:`avatar avatar--fallback avatar--${h} ${m??""} ${c}`,style:p,"aria-label":i??n,role:"img",title:n,children:u})}function Sn(n){const t=["chip",`chip--${n.color??"gray"}`,n.onClick?"chip--clickable":"",n.className??""].filter(Boolean).join(" ");return n.onClick?a.jsx("button",{type:"button",className:t,style:n.style,title:n.title,"aria-label":n.clickLabel,onClick:i=>{i.stopPropagation(),n.onClick?.()},children:n.children}):a.jsxs("span",{className:t,style:n.style,title:n.title,children:[n.children,n.onRemove?a.jsx("button",{type:"button",className:"chip__remove","aria-label":n.removeLabel??`Remove ${n.children}`,onClick:i=>{i.stopPropagation(),n.onRemove?.()},children:"×"}):null]})}function ee({children:n,spacing:t="4",align:i="stretch",className:l=""}){return a.jsx("div",{className:`stack stack--spacing-${t} stack--align-${i} ${l}`,"data-component":"stack",children:n})}function yt({children:n,spacing:t="4",align:i="center",justify:l="start",className:c=""}){return a.jsx("div",{className:`row row--spacing-${t} row--align-${i} row--justify-${l} ${c}`,"data-component":"row",children:n})}function S({children:n,size:t="2",weight:i="normal",tone:l="default",style:c="sans",as:u="p",className:h="",wrap:m=!1}){return a.jsx(u,{className:`text text--size-${t} text--weight-${i} text--tone-${l} text--style-${c} ${m&&"text--wrap"} ${h}`,"data-component":"text",children:n})}function Zt(n){const{children:t}=n;return a.jsx("div",{className:"error--container",children:a.jsx(S,{size:n.size,weight:n.weight,tone:n.tone,as:n.as,wrap:n.wrap,className:"error--text",children:t})})}function ce({children:n,variant:t="primary",size:i="md",fullWidth:l=!1,className:c="",...u}){return a.jsx("button",{className:`btn btn--${t} btn--${i} ${l?"btn--full-width":""} ${c}`,"data-component":"button",...u,children:n})}function Ye({children:n,padding:t="4",className:i=""}){return a.jsx("div",{className:`card card--padding-${t} ${i}`,"data-component":"card",children:n})}function ob({leading:n,children:t,tags:i=[],topRight:l,footer:c,trailing:u,animation:h,onClick:m,className:p="",pulseKey:y,highlight:v}){const[b,x]=d.useState(!1);d.useEffect(()=>{if(y==null)return;x(!0);const E=setTimeout(()=>x(!1),600);return()=>clearTimeout(E)},[y]);const _=h?`board-card--${h}`:"",k=b?"board-card--eventPulse":"",T=v?"board-card--highlight":"",w=E=>{m?.(E)};return a.jsx("div",{className:`board-card__wrapper ${_}`,onClick:w,children:a.jsxs("div",{className:`board-card ${T} ${k} ${p}`,"data-component":"board-card",children:[a.jsxs("div",{className:"board-card__header",children:[a.jsx("div",{className:"board-card__headerLeft",children:n?a.jsx("div",{className:"board-card__leading",children:n}):null}),a.jsxs("div",{className:"board-card__headerRight",children:[l?a.jsx("div",{className:"board-card__meta",children:l}):null,u?a.jsx("div",{className:"board-card__trailing",children:u}):null]})]}),a.jsx("div",{className:"board-card__main",children:t}),i.length?a.jsx("div",{className:"board-card__tags","aria-label":"tags",children:i.map(E=>a.jsx("span",{className:`chip chip--${E.color??"gray"}`,children:E.label},E.label))}):null,c?a.jsx("div",{className:"board-card__footer",children:c}):null]})})}function _e({leading:n,children:t,tags:i=[],topRight:l,trailing:c,animation:u,onClick:h,highlight:m,className:p=""}){const y=u?`data-row--${u}`:"",v=m?"data-row--highlight":"",b=h?"data-row--clickable":"",x=_=>{h?.(_)};return a.jsx("div",{className:`data-row__wrapper ${y}`,onClick:x,children:a.jsxs("div",{className:`data-row ${v} ${b} ${p}`,"data-component":"data-row",children:[n?a.jsx("div",{className:"data-row__leading",children:n}):null,a.jsxs("div",{className:"data-row__content",children:[a.jsxs("div",{className:"data-row__top",children:[a.jsx("div",{className:`data-row__main ${p}`,children:t}),l?a.jsx("div",{className:"data-row__meta",children:l}):null]}),i.length?a.jsx("div",{className:"data-row__tags","aria-label":"tags",children:i.map((_,k)=>a.jsx(Sn,{color:_.color,onClick:_.onClick,clickLabel:_.clickLabel??_.label,title:_.title,onRemove:_.onRemove,removeLabel:_.removeLabel??`Remove ${_.label}`,children:_.label},`${_.label}-${_.color??"gray"}-${k}`))}):null]}),c?a.jsx("div",{className:"data-row__trailing",children:c}):null]})})}function xe({children:n,title:t,className:i,action:l}){return a.jsxs("div",{className:`data-row__container ${i}`,children:[(t||l)&&a.jsxs("div",{className:"data-row__container-header",children:[t&&a.jsx(S,{size:"4",weight:"bold",children:t}),l&&a.jsx("div",{className:"data-row__container-action",children:l})]}),n]})}function Uk({children:n,onClick:t,interactive:i=!1,className:l=""}){const c=i||!!t;return a.jsx("div",{className:`list-row ${c?"list-row--interactive":""} ${l}`,onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,"data-component":"list-row",children:n})}function ya(n,t,{checkForDefaultPrevented:i=!0}={}){return function(c){if(n?.(c),i===!1||!c.defaultPrevented)return t?.(c)}}function kv(n,t){if(typeof n=="function")return n(t);n!=null&&(n.current=t)}function cb(...n){return t=>{let i=!1;const l=n.map(c=>{const u=kv(c,t);return!i&&typeof u=="function"&&(i=!0),u});if(i)return()=>{for(let c=0;c<l.length;c++){const u=l[c];typeof u=="function"?u():kv(n[c],null)}}}}function Xa(...n){return d.useCallback(cb(...n),n)}function Bk(n,t){const i=d.createContext(t),l=u=>{const{children:h,...m}=u,p=d.useMemo(()=>m,Object.values(m));return a.jsx(i.Provider,{value:p,children:h})};l.displayName=n+"Provider";function c(u){const h=d.useContext(i);if(h)return h;if(t!==void 0)return t;throw new Error(`\`${u}\` must be used within \`${n}\``)}return[l,c]}function $k(n,t=[]){let i=[];function l(u,h){const m=d.createContext(h),p=i.length;i=[...i,h];const y=b=>{const{scope:x,children:_,...k}=b,T=x?.[n]?.[p]||m,w=d.useMemo(()=>k,Object.values(k));return a.jsx(T.Provider,{value:w,children:_})};y.displayName=u+"Provider";function v(b,x){const _=x?.[n]?.[p]||m,k=d.useContext(_);if(k)return k;if(h!==void 0)return h;throw new Error(`\`${b}\` must be used within \`${u}\``)}return[y,v]}const c=()=>{const u=i.map(h=>d.createContext(h));return function(m){const p=m?.[n]||u;return d.useMemo(()=>({[`__scope${n}`]:{...m,[n]:p}}),[m,p])}};return c.scopeName=n,[l,Pk(c,...t)]}function Pk(...n){const t=n[0];if(n.length===1)return t;const i=()=>{const l=n.map(c=>({useScope:c(),scopeName:c.scopeName}));return function(u){const h=l.reduce((m,{useScope:p,scopeName:y})=>{const b=p(u)[`__scope${y}`];return{...m,...b}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:h}),[h])}};return i.scopeName=t.scopeName,i}var yl=globalThis?.document?d.useLayoutEffect:()=>{},Hk=Dx[" useId ".trim().toString()]||(()=>{}),Gk=0;function ah(n){const[t,i]=d.useState(Hk());return yl(()=>{i(l=>l??String(Gk++))},[n]),n||(t?`radix-${t}`:"")}var Vk=Dx[" useInsertionEffect ".trim().toString()]||yl;function Fk({prop:n,defaultProp:t,onChange:i=()=>{},caller:l}){const[c,u,h]=Yk({defaultProp:t,onChange:i}),m=n!==void 0,p=m?n:c;{const v=d.useRef(n!==void 0);d.useEffect(()=>{const b=v.current;b!==m&&console.warn(`${l} is changing from ${b?"controlled":"uncontrolled"} to ${m?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),v.current=m},[m,l])}const y=d.useCallback(v=>{if(m){const b=Kk(v)?v(n):v;b!==n&&h.current?.(b)}else u(v)},[m,n,u,h]);return[p,y]}function Yk({defaultProp:n,onChange:t}){const[i,l]=d.useState(n),c=d.useRef(i),u=d.useRef(t);return Vk(()=>{u.current=t},[t]),d.useEffect(()=>{c.current!==i&&(u.current?.(i),c.current=i)},[i,c]),[i,l,u]}function Kk(n){return typeof n=="function"}function ub(n){const t=Xk(n),i=d.forwardRef((l,c)=>{const{children:u,...h}=l,m=d.Children.toArray(u),p=m.find(Zk);if(p){const y=p.props.children,v=m.map(b=>b===p?d.Children.count(y)>1?d.Children.only(null):d.isValidElement(y)?y.props.children:null:b);return a.jsx(t,{...h,ref:c,children:d.isValidElement(y)?d.cloneElement(y,void 0,v):null})}return a.jsx(t,{...h,ref:c,children:u})});return i.displayName=`${n}.Slot`,i}function Xk(n){const t=d.forwardRef((i,l)=>{const{children:c,...u}=i;if(d.isValidElement(c)){const h=Jk(c),m=Wk(u,c.props);return c.type!==d.Fragment&&(m.ref=l?cb(l,h):h),d.cloneElement(c,m)}return d.Children.count(c)>1?d.Children.only(null):null});return t.displayName=`${n}.SlotClone`,t}var Qk=Symbol("radix.slottable");function Zk(n){return d.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===Qk}function Wk(n,t){const i={...t};for(const l in t){const c=n[l],u=t[l];/^on[A-Z]/.test(l)?c&&u?i[l]=(...m)=>{const p=u(...m);return c(...m),p}:c&&(i[l]=c):l==="style"?i[l]={...c,...u}:l==="className"&&(i[l]=[c,u].filter(Boolean).join(" "))}return{...n,...i}}function Jk(n){let t=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,i=t&&"isReactWarning"in t&&t.isReactWarning;return i?n.ref:(t=Object.getOwnPropertyDescriptor(n,"ref")?.get,i=t&&"isReactWarning"in t&&t.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}var e0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Us=e0.reduce((n,t)=>{const i=ub(`Primitive.${t}`),l=d.forwardRef((c,u)=>{const{asChild:h,...m}=c,p=h?i:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(p,{...m,ref:u})});return l.displayName=`Primitive.${t}`,{...n,[t]:l}},{});function t0(n,t){n&&eb.flushSync(()=>n.dispatchEvent(t))}function vl(n){const t=d.useRef(n);return d.useEffect(()=>{t.current=n}),d.useMemo(()=>(...i)=>t.current?.(...i),[])}function n0(n,t=globalThis?.document){const i=vl(n);d.useEffect(()=>{const l=c=>{c.key==="Escape"&&i(c)};return t.addEventListener("keydown",l,{capture:!0}),()=>t.removeEventListener("keydown",l,{capture:!0})},[i,t])}var s0="DismissableLayer",Dh="dismissableLayer.update",a0="dismissableLayer.pointerDownOutside",r0="dismissableLayer.focusOutside",Ev,db=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),hb=d.forwardRef((n,t)=>{const{disableOutsidePointerEvents:i=!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:u,onInteractOutside:h,onDismiss:m,...p}=n,y=d.useContext(db),[v,b]=d.useState(null),x=v?.ownerDocument??globalThis?.document,[,_]=d.useState({}),k=Xa(t,C=>b(C)),T=Array.from(y.layers),[w]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),E=T.indexOf(w),R=v?T.indexOf(v):-1,D=y.layersWithOutsidePointerEventsDisabled.size>0,O=R>=E,z=o0(C=>{const L=C.target,P=[...y.branches].some(Y=>Y.contains(L));!O||P||(c?.(C),h?.(C),C.defaultPrevented||m?.())},x),A=c0(C=>{const L=C.target;[...y.branches].some(Y=>Y.contains(L))||(u?.(C),h?.(C),C.defaultPrevented||m?.())},x);return n0(C=>{R===y.layers.size-1&&(l?.(C),!C.defaultPrevented&&m&&(C.preventDefault(),m()))},x),d.useEffect(()=>{if(v)return i&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(Ev=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(v)),y.layers.add(v),Cv(),()=>{i&&y.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=Ev)}},[v,x,i,y]),d.useEffect(()=>()=>{v&&(y.layers.delete(v),y.layersWithOutsidePointerEventsDisabled.delete(v),Cv())},[v,y]),d.useEffect(()=>{const C=()=>_({});return document.addEventListener(Dh,C),()=>document.removeEventListener(Dh,C)},[]),a.jsx(Us.div,{...p,ref:k,style:{pointerEvents:D?O?"auto":"none":void 0,...n.style},onFocusCapture:ya(n.onFocusCapture,A.onFocusCapture),onBlurCapture:ya(n.onBlurCapture,A.onBlurCapture),onPointerDownCapture:ya(n.onPointerDownCapture,z.onPointerDownCapture)})});hb.displayName=s0;var i0="DismissableLayerBranch",l0=d.forwardRef((n,t)=>{const i=d.useContext(db),l=d.useRef(null),c=Xa(t,l);return d.useEffect(()=>{const u=l.current;if(u)return i.branches.add(u),()=>{i.branches.delete(u)}},[i.branches]),a.jsx(Us.div,{...n,ref:c})});l0.displayName=i0;function o0(n,t=globalThis?.document){const i=vl(n),l=d.useRef(!1),c=d.useRef(()=>{});return d.useEffect(()=>{const u=m=>{if(m.target&&!l.current){let p=function(){fb(a0,i,y,{discrete:!0})};const y={originalEvent:m};m.pointerType==="touch"?(t.removeEventListener("click",c.current),c.current=p,t.addEventListener("click",c.current,{once:!0})):p()}else t.removeEventListener("click",c.current);l.current=!1},h=window.setTimeout(()=>{t.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(h),t.removeEventListener("pointerdown",u),t.removeEventListener("click",c.current)}},[t,i]),{onPointerDownCapture:()=>l.current=!0}}function c0(n,t=globalThis?.document){const i=vl(n),l=d.useRef(!1);return d.useEffect(()=>{const c=u=>{u.target&&!l.current&&fb(r0,i,{originalEvent:u},{discrete:!1})};return t.addEventListener("focusin",c),()=>t.removeEventListener("focusin",c)},[t,i]),{onFocusCapture:()=>l.current=!0,onBlurCapture:()=>l.current=!1}}function Cv(){const n=new CustomEvent(Dh);document.dispatchEvent(n)}function fb(n,t,i,{discrete:l}){const c=i.originalEvent.target,u=new CustomEvent(n,{bubbles:!1,cancelable:!0,detail:i});t&&c.addEventListener(n,t,{once:!0}),l?t0(c,u):c.dispatchEvent(u)}var rh="focusScope.autoFocusOnMount",ih="focusScope.autoFocusOnUnmount",Nv={bubbles:!1,cancelable:!0},u0="FocusScope",pb=d.forwardRef((n,t)=>{const{loop:i=!1,trapped:l=!1,onMountAutoFocus:c,onUnmountAutoFocus:u,...h}=n,[m,p]=d.useState(null),y=vl(c),v=vl(u),b=d.useRef(null),x=Xa(t,T=>p(T)),_=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(l){let T=function(D){if(_.paused||!m)return;const O=D.target;m.contains(O)?b.current=O:ma(b.current,{select:!0})},w=function(D){if(_.paused||!m)return;const O=D.relatedTarget;O!==null&&(m.contains(O)||ma(b.current,{select:!0}))},E=function(D){if(document.activeElement===document.body)for(const z of D)z.removedNodes.length>0&&ma(m)};document.addEventListener("focusin",T),document.addEventListener("focusout",w);const R=new MutationObserver(E);return m&&R.observe(m,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",T),document.removeEventListener("focusout",w),R.disconnect()}}},[l,m,_.paused]),d.useEffect(()=>{if(m){Rv.add(_);const T=document.activeElement;if(!m.contains(T)){const E=new CustomEvent(rh,Nv);m.addEventListener(rh,y),m.dispatchEvent(E),E.defaultPrevented||(d0(g0(mb(m)),{select:!0}),document.activeElement===T&&ma(m))}return()=>{m.removeEventListener(rh,y),setTimeout(()=>{const E=new CustomEvent(ih,Nv);m.addEventListener(ih,v),m.dispatchEvent(E),E.defaultPrevented||ma(T??document.body,{select:!0}),m.removeEventListener(ih,v),Rv.remove(_)},0)}}},[m,y,v,_]);const k=d.useCallback(T=>{if(!i&&!l||_.paused)return;const w=T.key==="Tab"&&!T.altKey&&!T.ctrlKey&&!T.metaKey,E=document.activeElement;if(w&&E){const R=T.currentTarget,[D,O]=h0(R);D&&O?!T.shiftKey&&E===O?(T.preventDefault(),i&&ma(D,{select:!0})):T.shiftKey&&E===D&&(T.preventDefault(),i&&ma(O,{select:!0})):E===R&&T.preventDefault()}},[i,l,_.paused]);return a.jsx(Us.div,{tabIndex:-1,...h,ref:x,onKeyDown:k})});pb.displayName=u0;function d0(n,{select:t=!1}={}){const i=document.activeElement;for(const l of n)if(ma(l,{select:t}),document.activeElement!==i)return}function h0(n){const t=mb(n),i=Av(t,n),l=Av(t.reverse(),n);return[i,l]}function mb(n){const t=[],i=document.createTreeWalker(n,NodeFilter.SHOW_ELEMENT,{acceptNode:l=>{const c=l.tagName==="INPUT"&&l.type==="hidden";return l.disabled||l.hidden||c?NodeFilter.FILTER_SKIP:l.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;i.nextNode();)t.push(i.currentNode);return t}function Av(n,t){for(const i of n)if(!f0(i,{upTo:t}))return i}function f0(n,{upTo:t}){if(getComputedStyle(n).visibility==="hidden")return!0;for(;n;){if(t!==void 0&&n===t)return!1;if(getComputedStyle(n).display==="none")return!0;n=n.parentElement}return!1}function p0(n){return n instanceof HTMLInputElement&&"select"in n}function ma(n,{select:t=!1}={}){if(n&&n.focus){const i=document.activeElement;n.focus({preventScroll:!0}),n!==i&&p0(n)&&t&&n.select()}}var Rv=m0();function m0(){let n=[];return{add(t){const i=n[0];t!==i&&i?.pause(),n=Dv(n,t),n.unshift(t)},remove(t){n=Dv(n,t),n[0]?.resume()}}}function Dv(n,t){const i=[...n],l=i.indexOf(t);return l!==-1&&i.splice(l,1),i}function g0(n){return n.filter(t=>t.tagName!=="A")}var y0="Portal",gb=d.forwardRef((n,t)=>{const{container:i,...l}=n,[c,u]=d.useState(!1);yl(()=>u(!0),[]);const h=i||c&&globalThis?.document?.body;return h?vk.createPortal(a.jsx(Us.div,{...l,ref:t}),h):null});gb.displayName=y0;function v0(n,t){return d.useReducer((i,l)=>t[i][l]??i,n)}var Cc=n=>{const{present:t,children:i}=n,l=x0(t),c=typeof i=="function"?i({present:l.isPresent}):d.Children.only(i),u=Xa(l.ref,b0(c));return typeof i=="function"||l.isPresent?d.cloneElement(c,{ref:u}):null};Cc.displayName="Presence";function x0(n){const[t,i]=d.useState(),l=d.useRef(null),c=d.useRef(n),u=d.useRef("none"),h=n?"mounted":"unmounted",[m,p]=v0(h,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const y=Go(l.current);u.current=m==="mounted"?y:"none"},[m]),yl(()=>{const y=l.current,v=c.current;if(v!==n){const x=u.current,_=Go(y);n?p("MOUNT"):_==="none"||y?.display==="none"?p("UNMOUNT"):p(v&&x!==_?"ANIMATION_OUT":"UNMOUNT"),c.current=n}},[n,p]),yl(()=>{if(t){let y;const v=t.ownerDocument.defaultView??window,b=_=>{const T=Go(l.current).includes(CSS.escape(_.animationName));if(_.target===t&&T&&(p("ANIMATION_END"),!c.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",y=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},x=_=>{_.target===t&&(u.current=Go(l.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",b),t.addEventListener("animationend",b),()=>{v.clearTimeout(y),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",b),t.removeEventListener("animationend",b)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:d.useCallback(y=>{l.current=y?getComputedStyle(y):null,i(y)},[])}}function Go(n){return n?.animationName||"none"}function b0(n){let t=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,i=t&&"isReactWarning"in t&&t.isReactWarning;return i?n.ref:(t=Object.getOwnPropertyDescriptor(n,"ref")?.get,i=t&&"isReactWarning"in t&&t.isReactWarning,i?n.props.ref:n.props.ref||n.ref)}var lh=0;function _0(){d.useEffect(()=>{const n=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",n[0]??Ov()),document.body.insertAdjacentElement("beforeend",n[1]??Ov()),lh++,()=>{lh===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),lh--}},[])}function Ov(){const n=document.createElement("span");return n.setAttribute("data-radix-focus-guard",""),n.tabIndex=0,n.style.outline="none",n.style.opacity="0",n.style.position="fixed",n.style.pointerEvents="none",n}var ds=function(){return ds=Object.assign||function(t){for(var i,l=1,c=arguments.length;l<c;l++){i=arguments[l];for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&(t[u]=i[u])}return t},ds.apply(this,arguments)};function yb(n,t){var i={};for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&t.indexOf(l)<0&&(i[l]=n[l]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var c=0,l=Object.getOwnPropertySymbols(n);c<l.length;c++)t.indexOf(l[c])<0&&Object.prototype.propertyIsEnumerable.call(n,l[c])&&(i[l[c]]=n[l[c]]);return i}function S0(n,t,i){if(i||arguments.length===2)for(var l=0,c=t.length,u;l<c;l++)(u||!(l in t))&&(u||(u=Array.prototype.slice.call(t,0,l)),u[l]=t[l]);return n.concat(u||Array.prototype.slice.call(t))}var oc="right-scroll-bar-position",cc="width-before-scroll-bar",j0="with-scroll-bars-hidden",T0="--removed-body-scroll-bar-size";function oh(n,t){return typeof n=="function"?n(t):n&&(n.current=t),n}function w0(n,t){var i=d.useState(function(){return{value:n,callback:t,facade:{get current(){return i.value},set current(l){var c=i.value;c!==l&&(i.value=l,i.callback(l,c))}}}})[0];return i.callback=t,i.facade}var k0=typeof window<"u"?d.useLayoutEffect:d.useEffect,zv=new WeakMap;function E0(n,t){var i=w0(null,function(l){return n.forEach(function(c){return oh(c,l)})});return k0(function(){var l=zv.get(i);if(l){var c=new Set(l),u=new Set(n),h=i.current;c.forEach(function(m){u.has(m)||oh(m,null)}),u.forEach(function(m){c.has(m)||oh(m,h)})}zv.set(i,n)},[n]),i}function C0(n){return n}function N0(n,t){t===void 0&&(t=C0);var i=[],l=!1,c={read:function(){if(l)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return i.length?i[i.length-1]:n},useMedium:function(u){var h=t(u,l);return i.push(h),function(){i=i.filter(function(m){return m!==h})}},assignSyncMedium:function(u){for(l=!0;i.length;){var h=i;i=[],h.forEach(u)}i={push:function(m){return u(m)},filter:function(){return i}}},assignMedium:function(u){l=!0;var h=[];if(i.length){var m=i;i=[],m.forEach(u),h=i}var p=function(){var v=h;h=[],v.forEach(u)},y=function(){return Promise.resolve().then(p)};y(),i={push:function(v){h.push(v),y()},filter:function(v){return h=h.filter(v),i}}}};return c}function A0(n){n===void 0&&(n={});var t=N0(null);return t.options=ds({async:!0,ssr:!1},n),t}var vb=function(n){var t=n.sideCar,i=yb(n,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var l=t.read();if(!l)throw new Error("Sidecar medium not found");return d.createElement(l,ds({},i))};vb.isSideCarExport=!0;function R0(n,t){return n.useMedium(t),vb}var xb=A0(),ch=function(){},Nc=d.forwardRef(function(n,t){var i=d.useRef(null),l=d.useState({onScrollCapture:ch,onWheelCapture:ch,onTouchMoveCapture:ch}),c=l[0],u=l[1],h=n.forwardProps,m=n.children,p=n.className,y=n.removeScrollBar,v=n.enabled,b=n.shards,x=n.sideCar,_=n.noRelative,k=n.noIsolation,T=n.inert,w=n.allowPinchZoom,E=n.as,R=E===void 0?"div":E,D=n.gapMode,O=yb(n,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),z=x,A=E0([i,t]),C=ds(ds({},O),c);return d.createElement(d.Fragment,null,v&&d.createElement(z,{sideCar:xb,removeScrollBar:y,shards:b,noRelative:_,noIsolation:k,inert:T,setCallbacks:u,allowPinchZoom:!!w,lockRef:i,gapMode:D}),h?d.cloneElement(d.Children.only(m),ds(ds({},C),{ref:A})):d.createElement(R,ds({},C,{className:p,ref:A}),m))});Nc.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Nc.classNames={fullWidth:cc,zeroRight:oc};var D0=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function O0(){if(!document)return null;var n=document.createElement("style");n.type="text/css";var t=D0();return t&&n.setAttribute("nonce",t),n}function z0(n,t){n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}function L0(n){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(n)}var M0=function(){var n=0,t=null;return{add:function(i){n==0&&(t=O0())&&(z0(t,i),L0(t)),n++},remove:function(){n--,!n&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},I0=function(){var n=M0();return function(t,i){d.useEffect(function(){return n.add(t),function(){n.remove()}},[t&&i])}},bb=function(){var n=I0(),t=function(i){var l=i.styles,c=i.dynamic;return n(l,c),null};return t},q0={left:0,top:0,right:0,gap:0},uh=function(n){return parseInt(n||"",10)||0},U0=function(n){var t=window.getComputedStyle(document.body),i=t[n==="padding"?"paddingLeft":"marginLeft"],l=t[n==="padding"?"paddingTop":"marginTop"],c=t[n==="padding"?"paddingRight":"marginRight"];return[uh(i),uh(l),uh(c)]},B0=function(n){if(n===void 0&&(n="margin"),typeof window>"u")return q0;var t=U0(n),i=document.documentElement.clientWidth,l=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,l-i+t[2]-t[0])}},$0=bb(),Gr="data-scroll-locked",P0=function(n,t,i,l){var c=n.left,u=n.top,h=n.right,m=n.gap;return i===void 0&&(i="margin"),`
|
|
12
|
+
.`.concat(j0,` {
|
|
13
|
+
overflow: hidden `).concat(l,`;
|
|
14
|
+
padding-right: `).concat(m,"px ").concat(l,`;
|
|
15
|
+
}
|
|
16
|
+
body[`).concat(Gr,`] {
|
|
17
|
+
overflow: hidden `).concat(l,`;
|
|
18
|
+
overscroll-behavior: contain;
|
|
19
|
+
`).concat([t&&"position: relative ".concat(l,";"),i==="margin"&&`
|
|
20
|
+
padding-left: `.concat(c,`px;
|
|
21
|
+
padding-top: `).concat(u,`px;
|
|
22
|
+
padding-right: `).concat(h,`px;
|
|
23
|
+
margin-left:0;
|
|
24
|
+
margin-top:0;
|
|
25
|
+
margin-right: `).concat(m,"px ").concat(l,`;
|
|
26
|
+
`),i==="padding"&&"padding-right: ".concat(m,"px ").concat(l,";")].filter(Boolean).join(""),`
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.`).concat(oc,` {
|
|
30
|
+
right: `).concat(m,"px ").concat(l,`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.`).concat(cc,` {
|
|
34
|
+
margin-right: `).concat(m,"px ").concat(l,`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.`).concat(oc," .").concat(oc,` {
|
|
38
|
+
right: 0 `).concat(l,`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.`).concat(cc," .").concat(cc,` {
|
|
42
|
+
margin-right: 0 `).concat(l,`;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
body[`).concat(Gr,`] {
|
|
46
|
+
`).concat(T0,": ").concat(m,`px;
|
|
47
|
+
}
|
|
48
|
+
`)},Lv=function(){var n=parseInt(document.body.getAttribute(Gr)||"0",10);return isFinite(n)?n:0},H0=function(){d.useEffect(function(){return document.body.setAttribute(Gr,(Lv()+1).toString()),function(){var n=Lv()-1;n<=0?document.body.removeAttribute(Gr):document.body.setAttribute(Gr,n.toString())}},[])},G0=function(n){var t=n.noRelative,i=n.noImportant,l=n.gapMode,c=l===void 0?"margin":l;H0();var u=d.useMemo(function(){return B0(c)},[c]);return d.createElement($0,{styles:P0(u,!t,c,i?"":"!important")})},Oh=!1;if(typeof window<"u")try{var Vo=Object.defineProperty({},"passive",{get:function(){return Oh=!0,!0}});window.addEventListener("test",Vo,Vo),window.removeEventListener("test",Vo,Vo)}catch{Oh=!1}var Mr=Oh?{passive:!1}:!1,V0=function(n){return n.tagName==="TEXTAREA"},_b=function(n,t){if(!(n instanceof Element))return!1;var i=window.getComputedStyle(n);return i[t]!=="hidden"&&!(i.overflowY===i.overflowX&&!V0(n)&&i[t]==="visible")},F0=function(n){return _b(n,"overflowY")},Y0=function(n){return _b(n,"overflowX")},Mv=function(n,t){var i=t.ownerDocument,l=t;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var c=Sb(n,l);if(c){var u=jb(n,l),h=u[1],m=u[2];if(h>m)return!0}l=l.parentNode}while(l&&l!==i.body);return!1},K0=function(n){var t=n.scrollTop,i=n.scrollHeight,l=n.clientHeight;return[t,i,l]},X0=function(n){var t=n.scrollLeft,i=n.scrollWidth,l=n.clientWidth;return[t,i,l]},Sb=function(n,t){return n==="v"?F0(t):Y0(t)},jb=function(n,t){return n==="v"?K0(t):X0(t)},Q0=function(n,t){return n==="h"&&t==="rtl"?-1:1},Z0=function(n,t,i,l,c){var u=Q0(n,window.getComputedStyle(t).direction),h=u*l,m=i.target,p=t.contains(m),y=!1,v=h>0,b=0,x=0;do{if(!m)break;var _=jb(n,m),k=_[0],T=_[1],w=_[2],E=T-w-u*k;(k||E)&&Sb(n,m)&&(b+=E,x+=k);var R=m.parentNode;m=R&&R.nodeType===Node.DOCUMENT_FRAGMENT_NODE?R.host:R}while(!p&&m!==document.body||p&&(t.contains(m)||t===m));return(v&&Math.abs(b)<1||!v&&Math.abs(x)<1)&&(y=!0),y},Fo=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},Iv=function(n){return[n.deltaX,n.deltaY]},qv=function(n){return n&&"current"in n?n.current:n},W0=function(n,t){return n[0]===t[0]&&n[1]===t[1]},J0=function(n){return`
|
|
49
|
+
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
|
50
|
+
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
|
51
|
+
`)},eE=0,Ir=[];function tE(n){var t=d.useRef([]),i=d.useRef([0,0]),l=d.useRef(),c=d.useState(eE++)[0],u=d.useState(bb)[0],h=d.useRef(n);d.useEffect(function(){h.current=n},[n]),d.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(c));var T=S0([n.lockRef.current],(n.shards||[]).map(qv),!0).filter(Boolean);return T.forEach(function(w){return w.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),T.forEach(function(w){return w.classList.remove("allow-interactivity-".concat(c))})}}},[n.inert,n.lockRef.current,n.shards]);var m=d.useCallback(function(T,w){if("touches"in T&&T.touches.length===2||T.type==="wheel"&&T.ctrlKey)return!h.current.allowPinchZoom;var E=Fo(T),R=i.current,D="deltaX"in T?T.deltaX:R[0]-E[0],O="deltaY"in T?T.deltaY:R[1]-E[1],z,A=T.target,C=Math.abs(D)>Math.abs(O)?"h":"v";if("touches"in T&&C==="h"&&A.type==="range")return!1;var L=window.getSelection(),P=L&&L.anchorNode,Y=P?P===A||P.contains(A):!1;if(Y)return!1;var U=Mv(C,A);if(!U)return!0;if(U?z=C:(z=C==="v"?"h":"v",U=Mv(C,A)),!U)return!1;if(!l.current&&"changedTouches"in T&&(D||O)&&(l.current=z),!z)return!0;var re=l.current||z;return Z0(re,w,T,re==="h"?D:O)},[]),p=d.useCallback(function(T){var w=T;if(!(!Ir.length||Ir[Ir.length-1]!==u)){var E="deltaY"in w?Iv(w):Fo(w),R=t.current.filter(function(z){return z.name===w.type&&(z.target===w.target||w.target===z.shadowParent)&&W0(z.delta,E)})[0];if(R&&R.should){w.cancelable&&w.preventDefault();return}if(!R){var D=(h.current.shards||[]).map(qv).filter(Boolean).filter(function(z){return z.contains(w.target)}),O=D.length>0?m(w,D[0]):!h.current.noIsolation;O&&w.cancelable&&w.preventDefault()}}},[]),y=d.useCallback(function(T,w,E,R){var D={name:T,delta:w,target:E,should:R,shadowParent:nE(E)};t.current.push(D),setTimeout(function(){t.current=t.current.filter(function(O){return O!==D})},1)},[]),v=d.useCallback(function(T){i.current=Fo(T),l.current=void 0},[]),b=d.useCallback(function(T){y(T.type,Iv(T),T.target,m(T,n.lockRef.current))},[]),x=d.useCallback(function(T){y(T.type,Fo(T),T.target,m(T,n.lockRef.current))},[]);d.useEffect(function(){return Ir.push(u),n.setCallbacks({onScrollCapture:b,onWheelCapture:b,onTouchMoveCapture:x}),document.addEventListener("wheel",p,Mr),document.addEventListener("touchmove",p,Mr),document.addEventListener("touchstart",v,Mr),function(){Ir=Ir.filter(function(T){return T!==u}),document.removeEventListener("wheel",p,Mr),document.removeEventListener("touchmove",p,Mr),document.removeEventListener("touchstart",v,Mr)}},[]);var _=n.removeScrollBar,k=n.inert;return d.createElement(d.Fragment,null,k?d.createElement(u,{styles:J0(c)}):null,_?d.createElement(G0,{noRelative:n.noRelative,gapMode:n.gapMode}):null)}function nE(n){for(var t=null;n!==null;)n instanceof ShadowRoot&&(t=n.host,n=n.host),n=n.parentNode;return t}const sE=R0(xb,tE);var Tb=d.forwardRef(function(n,t){return d.createElement(Nc,ds({},n,{ref:t,sideCar:sE}))});Tb.classNames=Nc.classNames;var aE=function(n){if(typeof document>"u")return null;var t=Array.isArray(n)?n[0]:n;return t.ownerDocument.body},qr=new WeakMap,Yo=new WeakMap,Ko={},dh=0,wb=function(n){return n&&(n.host||wb(n.parentNode))},rE=function(n,t){return t.map(function(i){if(n.contains(i))return i;var l=wb(i);return l&&n.contains(l)?l:(console.error("aria-hidden",i,"in not contained inside",n,". Doing nothing"),null)}).filter(function(i){return!!i})},iE=function(n,t,i,l){var c=rE(t,Array.isArray(n)?n:[n]);Ko[i]||(Ko[i]=new WeakMap);var u=Ko[i],h=[],m=new Set,p=new Set(c),y=function(b){!b||m.has(b)||(m.add(b),y(b.parentNode))};c.forEach(y);var v=function(b){!b||p.has(b)||Array.prototype.forEach.call(b.children,function(x){if(m.has(x))v(x);else try{var _=x.getAttribute(l),k=_!==null&&_!=="false",T=(qr.get(x)||0)+1,w=(u.get(x)||0)+1;qr.set(x,T),u.set(x,w),h.push(x),T===1&&k&&Yo.set(x,!0),w===1&&x.setAttribute(i,"true"),k||x.setAttribute(l,"true")}catch(E){console.error("aria-hidden: cannot operate on ",x,E)}})};return v(t),m.clear(),dh++,function(){h.forEach(function(b){var x=qr.get(b)-1,_=u.get(b)-1;qr.set(b,x),u.set(b,_),x||(Yo.has(b)||b.removeAttribute(l),Yo.delete(b)),_||b.removeAttribute(i)}),dh--,dh||(qr=new WeakMap,qr=new WeakMap,Yo=new WeakMap,Ko={})}},lE=function(n,t,i){i===void 0&&(i="data-aria-hidden");var l=Array.from(Array.isArray(n)?n:[n]),c=aE(n);return c?(l.push.apply(l,Array.from(c.querySelectorAll("[aria-live], script"))),iE(l,c,i,"aria-hidden")):function(){return null}},Ac="Dialog",[kb]=$k(Ac),[oE,ts]=kb(Ac),Eb=n=>{const{__scopeDialog:t,children:i,open:l,defaultOpen:c,onOpenChange:u,modal:h=!0}=n,m=d.useRef(null),p=d.useRef(null),[y,v]=Fk({prop:l,defaultProp:c??!1,onChange:u,caller:Ac});return a.jsx(oE,{scope:t,triggerRef:m,contentRef:p,contentId:ah(),titleId:ah(),descriptionId:ah(),open:y,onOpenChange:v,onOpenToggle:d.useCallback(()=>v(b=>!b),[v]),modal:h,children:i})};Eb.displayName=Ac;var Cb="DialogTrigger",cE=d.forwardRef((n,t)=>{const{__scopeDialog:i,...l}=n,c=ts(Cb,i),u=Xa(t,c.triggerRef);return a.jsx(Us.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":hf(c.open),...l,ref:u,onClick:ya(n.onClick,c.onOpenToggle)})});cE.displayName=Cb;var uf="DialogPortal",[uE,Nb]=kb(uf,{forceMount:void 0}),Ab=n=>{const{__scopeDialog:t,forceMount:i,children:l,container:c}=n,u=ts(uf,t);return a.jsx(uE,{scope:t,forceMount:i,children:d.Children.map(l,h=>a.jsx(Cc,{present:i||u.open,children:a.jsx(gb,{asChild:!0,container:c,children:h})}))})};Ab.displayName=uf;var vc="DialogOverlay",Rb=d.forwardRef((n,t)=>{const i=Nb(vc,n.__scopeDialog),{forceMount:l=i.forceMount,...c}=n,u=ts(vc,n.__scopeDialog);return u.modal?a.jsx(Cc,{present:l||u.open,children:a.jsx(hE,{...c,ref:t})}):null});Rb.displayName=vc;var dE=ub("DialogOverlay.RemoveScroll"),hE=d.forwardRef((n,t)=>{const{__scopeDialog:i,...l}=n,c=ts(vc,i);return a.jsx(Tb,{as:dE,allowPinchZoom:!0,shards:[c.contentRef],children:a.jsx(Us.div,{"data-state":hf(c.open),...l,ref:t,style:{pointerEvents:"auto",...l.style}})})}),Fa="DialogContent",Db=d.forwardRef((n,t)=>{const i=Nb(Fa,n.__scopeDialog),{forceMount:l=i.forceMount,...c}=n,u=ts(Fa,n.__scopeDialog);return a.jsx(Cc,{present:l||u.open,children:u.modal?a.jsx(fE,{...c,ref:t}):a.jsx(pE,{...c,ref:t})})});Db.displayName=Fa;var fE=d.forwardRef((n,t)=>{const i=ts(Fa,n.__scopeDialog),l=d.useRef(null),c=Xa(t,i.contentRef,l);return d.useEffect(()=>{const u=l.current;if(u)return lE(u)},[]),a.jsx(Ob,{...n,ref:c,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ya(n.onCloseAutoFocus,u=>{u.preventDefault(),i.triggerRef.current?.focus()}),onPointerDownOutside:ya(n.onPointerDownOutside,u=>{const h=u.detail.originalEvent,m=h.button===0&&h.ctrlKey===!0;(h.button===2||m)&&u.preventDefault()}),onFocusOutside:ya(n.onFocusOutside,u=>u.preventDefault())})}),pE=d.forwardRef((n,t)=>{const i=ts(Fa,n.__scopeDialog),l=d.useRef(!1),c=d.useRef(!1);return a.jsx(Ob,{...n,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{n.onCloseAutoFocus?.(u),u.defaultPrevented||(l.current||i.triggerRef.current?.focus(),u.preventDefault()),l.current=!1,c.current=!1},onInteractOutside:u=>{n.onInteractOutside?.(u),u.defaultPrevented||(l.current=!0,u.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const h=u.target;i.triggerRef.current?.contains(h)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&c.current&&u.preventDefault()}})}),Ob=d.forwardRef((n,t)=>{const{__scopeDialog:i,trapFocus:l,onOpenAutoFocus:c,onCloseAutoFocus:u,...h}=n,m=ts(Fa,i),p=d.useRef(null),y=Xa(t,p);return _0(),a.jsxs(a.Fragment,{children:[a.jsx(pb,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:c,onUnmountAutoFocus:u,children:a.jsx(hb,{role:"dialog",id:m.contentId,"aria-describedby":m.descriptionId,"aria-labelledby":m.titleId,"data-state":hf(m.open),...h,ref:y,onDismiss:()=>m.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(gE,{titleId:m.titleId}),a.jsx(vE,{contentRef:p,descriptionId:m.descriptionId})]})]})}),df="DialogTitle",zb=d.forwardRef((n,t)=>{const{__scopeDialog:i,...l}=n,c=ts(df,i);return a.jsx(Us.h2,{id:c.titleId,...l,ref:t})});zb.displayName=df;var Lb="DialogDescription",Mb=d.forwardRef((n,t)=>{const{__scopeDialog:i,...l}=n,c=ts(Lb,i);return a.jsx(Us.p,{id:c.descriptionId,...l,ref:t})});Mb.displayName=Lb;var Ib="DialogClose",mE=d.forwardRef((n,t)=>{const{__scopeDialog:i,...l}=n,c=ts(Ib,i);return a.jsx(Us.button,{type:"button",...l,ref:t,onClick:ya(n.onClick,()=>c.onOpenChange(!1))})});mE.displayName=Ib;function hf(n){return n?"open":"closed"}var qb="DialogTitleWarning",[ez,Ub]=Bk(qb,{contentName:Fa,titleName:df,docsSlug:"dialog"}),gE=({titleId:n})=>{const t=Ub(qb),i=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
52
|
+
|
|
53
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
54
|
+
|
|
55
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{n&&(document.getElementById(n)||console.error(i))},[i,n]),null},yE="DialogDescriptionWarning",vE=({contentRef:n,descriptionId:t})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ub(yE).contentName}}.`;return d.useEffect(()=>{const c=n.current?.getAttribute("aria-describedby");t&&c&&(document.getElementById(t)||console.warn(l))},[l,n,t]),null},xE=Eb,bE=Ab,_E=Rb,SE=Db,jE=zb,TE=Mb;function wE({open:n,onOpenChange:t,title:i,description:l,children:c}){return a.jsx(xE,{open:n,onOpenChange:t,children:a.jsxs(bE,{children:[a.jsx(_E,{className:"modal__overlay"}),a.jsxs(SE,{className:"modal__content",...l?{}:{"aria-describedby":void 0},children:[a.jsx(jE,{className:"modal__title",children:i}),l?a.jsx(TE,{className:"modal__description",children:l}):null,c]})]})})}function kE(){const[n,t]=d.useState("sign-in"),[i,l]=d.useState(""),[c,u]=d.useState(""),[h,m]=d.useState(""),[p,y]=d.useState(""),[v,b]=d.useState(""),[x,_]=d.useState(!1),{login:k,refreshAuth:T,isLoading:w,isAuthenticated:E}=un(),R=De(),O=Mt().state?.from,z=O?.pathname||"/",A=O?.search||"",C=z==="/logout"?"/":`${z}${A}`;d.useEffect(()=>{!w&&E&&(console.log("you're in mate"),R(C))},[w,E,C]);const L=async U=>{U.preventDefault(),_(!0),b("");try{await k(i,c),R(C,{replace:!0})}catch{b("Invalid email or password")}finally{_(!1)}},P=async U=>{U.preventDefault(),_(!0),b("");try{const re=await tn.webAuthControllerGetAccountSetupStatus({email:i});if(!re.canSetup){b("That email is not ready for account setup. Ask an admin to create or reset the account.");return}l(re.email),t("setup-account")}catch(re){b(Uv(re,"Could not check that email."))}finally{_(!1)}},Y=async U=>{U.preventDefault(),_(!0),b("");try{await tn.webAuthControllerSetupAccount({email:i,displayName:h,slug:p,password:c}),await T(),R(C,{replace:!0})}catch(re){b(Uv(re,"Failed to set up account."))}finally{_(!1)}};return n==="setup-email"?a.jsx("form",{onSubmit:P,children:a.jsxs(ee,{spacing:"6",children:[a.jsxs(ee,{spacing:"2",align:"center",children:[a.jsx(S,{size:"6",weight:"bold",className:"login__copy",children:"Create account"}),a.jsx(S,{tone:"muted",className:"login__copy",children:"Enter the email an admin invited or reset for you."})]}),a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"setup-email",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Email"})}),a.jsx("input",{id:"setup-email",type:"email",value:i,onChange:U=>l(U.target.value),className:"login-input",placeholder:"name@work.com",required:!0,disabled:x,autoComplete:"email"})]}),v&&a.jsx(Zt,{size:"2",weight:"medium",children:v}),a.jsx(ce,{type:"submit",variant:"primary",size:"lg",disabled:x,className:"login-button",children:x?"Checking...":"Continue"}),a.jsx(ce,{type:"button",variant:"secondary",size:"lg",disabled:x,className:"login-button",onClick:()=>{t("sign-in"),b("")},children:"Back to sign in"})]})]})}):n==="setup-account"?a.jsx("form",{onSubmit:Y,children:a.jsxs(ee,{spacing:"6",children:[a.jsxs(ee,{spacing:"2",align:"center",children:[a.jsx(S,{size:"6",weight:"bold",className:"login__copy",children:"Set up account"}),a.jsxs(S,{tone:"muted",className:"login__copy",children:["Finish your profile and create a password for ",i,"."]})]}),a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"setup-display-name",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Display name"})}),a.jsx("input",{id:"setup-display-name",type:"text",value:h,onChange:U=>m(U.target.value),className:"login-input",placeholder:"Jane User",required:!0,disabled:x,autoComplete:"name"})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"setup-slug",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Username"})}),a.jsx("input",{id:"setup-slug",type:"text",value:p,onChange:U=>y(U.target.value),className:"login-input",placeholder:"jane",required:!0,disabled:x,autoComplete:"username"})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"setup-password",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Password"})}),a.jsx("input",{id:"setup-password",type:"password",value:c,onChange:U=>u(U.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:x,autoComplete:"new-password"})]}),v&&a.jsx(Zt,{size:"2",weight:"medium",children:v}),a.jsx(ce,{type:"submit",variant:"primary",size:"lg",disabled:x,className:"login-button",children:x?"Creating account...":"Create account"}),a.jsx(ce,{type:"button",variant:"secondary",size:"lg",disabled:x,className:"login-button",onClick:()=>{t("setup-email"),b("")},children:"Use a different email"})]})]})}):a.jsx("form",{onSubmit:L,children:a.jsxs(ee,{spacing:"6",children:[a.jsxs(ee,{spacing:"2",align:"center",children:[a.jsx(S,{size:"6",weight:"bold",className:"login__copy",children:"Taico"}),a.jsx(S,{tone:"muted",className:"login__copy",children:"Where people and agents collaborate in threads, using shared context to get work done."})]}),a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"email",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Email"})}),a.jsx("input",{id:"email",type:"email",value:i,onChange:U=>l(U.target.value),className:"login-input",placeholder:"name@work.com",required:!0,disabled:x,autoComplete:"email"})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"password",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Password"})}),a.jsx("input",{id:"password",type:"password",value:c,onChange:U=>u(U.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:x,autoComplete:"current-password"})]}),v&&a.jsx(Zt,{size:"2",weight:"medium",className:"",children:v}),a.jsx(ce,{type:"submit",variant:"primary",size:"lg",disabled:x,className:"login-button",children:x?"Signing in...":"Sign In"}),a.jsx(ce,{type:"button",variant:"secondary",size:"lg",disabled:x,className:"login-button",onClick:()=>{t("setup-email"),b(""),u("")},children:"Create account"})]})]})})}function Uv(n,t){return n?.body?.detail||n?.body?.title||n?.message||t}function EE(){return a.jsx(lb,{children:a.jsx(kE,{})})}function CE(){const[n,t]=d.useState(""),[i,l]=d.useState(""),[c,u]=d.useState(""),[h,m]=d.useState(""),[p,y]=d.useState(""),[v,b]=d.useState(!1),{refreshAuth:x}=un(),_=De(),k=async T=>{T.preventDefault(),b(!0),y("");try{await tn.webAuthControllerOnboard({email:n,displayName:i,slug:c,password:h}),await x(),_("/",{replace:!0})}catch(w){let E="Failed to create admin user";w.body?.context?.fields&&Array.isArray(w.body.context.fields)?E=w.body.context.fields.join(", "):w.body?.detail?E=w.body.detail:w.body?.title?E=w.body.title:w.message&&(E=w.message),y(E)}finally{b(!1)}};return a.jsx("form",{onSubmit:k,children:a.jsxs(ee,{spacing:"6",children:[a.jsxs(ee,{spacing:"2",align:"center",children:[a.jsx(S,{size:"6",weight:"bold",className:"login__copy",children:"Welcome to Taico"}),a.jsx(S,{tone:"muted",className:"login__copy",children:"Let's set up your first admin account to get started."})]}),a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"displayName",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Display Name"})}),a.jsx("input",{id:"displayName",type:"text",value:i,onChange:T=>l(T.target.value),className:"login-input",placeholder:"Admin User",required:!0,disabled:v,autoComplete:"name"})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"slug",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Username"})}),a.jsx("input",{id:"slug",type:"text",value:c,onChange:T=>u(T.target.value),className:"login-input",placeholder:"admin",required:!0,disabled:v,autoComplete:"username"})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"email",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Email"})}),a.jsx("input",{id:"email",type:"email",value:n,onChange:T=>t(T.target.value),className:"login-input",placeholder:"admin@example.com",required:!0,disabled:v,autoComplete:"email"}),a.jsx(S,{size:"1",tone:"muted",children:"Email is not verified and cannot be changed later. Make sure it's correct."})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"password",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Password"})}),a.jsx("input",{id:"password",type:"password",value:h,onChange:T=>m(T.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:v,autoComplete:"new-password"}),a.jsx(S,{size:"1",tone:"muted",children:"Remember this password - you won't receive a confirmation email."})]}),p&&a.jsx(Zt,{size:"2",weight:"medium",className:"",children:p}),a.jsx(ce,{type:"submit",variant:"primary",size:"lg",disabled:v,className:"login-button",children:v?"Creating account...":"Create Admin Account"})]})]})})}function NE(){return a.jsx(lb,{children:a.jsx(CE,{})})}function AE({children:n}){const{isAuthenticated:t,isLoading:i}=un(),l=Mt();return i?null:t?a.jsx(a.Fragment,{children:n}):a.jsx(Is,{to:"/login",state:{from:l},replace:!0})}const RE=4;function DE({children:n}){const[t,i]=d.useState(null),[l,c]=d.useState(!0),[u,h]=d.useState(null),[m,p]=d.useState(0);return d.useEffect(()=>{let y=!0,v;const b=()=>{v&&clearTimeout(v)},x=async()=>{try{const _=await tn.webAuthControllerGetOnboardingStatus();if(!y)return;b(),i(_.needsOnboarding),h(null)}catch(_){if(!y)return;console.error("Failed to check onboarding status:",_),h(_ instanceof Error?_:new Error("Failed to check onboarding status")),i(null),p(k=>k+1),v=setTimeout(()=>{b(),y&&x()},RE*1e3)}finally{y&&c(!1)}};return x(),()=>{y=!1,b()}},[]),l?null:u?a.jsx("div",{className:"onboarding-checker-shell",children:a.jsxs(ee,{spacing:"4",align:"center",className:"onboarding-checker-card",children:[a.jsxs("span",{className:"onboarding-checker-signal","aria-hidden":"true",children:[a.jsx("span",{}),a.jsx("span",{}),a.jsx("span",{})]}),a.jsx(S,{size:"5",weight:"semibold",as:"div",children:"Reconnecting to Taico..."}),a.jsx(S,{size:"3",tone:"muted",as:"div",className:"onboarding-checker-copy",children:"The backend is not responding yet. We will keep retrying until it is back."}),a.jsxs(S,{size:"1",tone:"muted",as:"div",className:"onboarding-checker-feedback",children:["Retry attempt ",m]})]})}):t?a.jsx(Is,{to:"/onboarding",replace:!0}):a.jsx(a.Fragment,{children:n})}function OE(n){return d.useSyncExternalStore(t=>{const i=window.matchMedia(n);return i.addEventListener("change",t),()=>i.removeEventListener("change",t)},()=>window.matchMedia(n).matches,()=>!1)}function Dt(){return OE("(min-width: 768px)")}const Bb=(...n)=>n.filter((t,i,l)=>!!t&&t.trim()!==""&&l.indexOf(t)===i).join(" ").trim();const zE=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const LE=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,i,l)=>l?l.toUpperCase():i.toLowerCase());const Bv=n=>{const t=LE(n);return t.charAt(0).toUpperCase()+t.slice(1)};var hh={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const ME=n=>{for(const t in n)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},IE=d.createContext({}),qE=()=>d.useContext(IE),UE=d.forwardRef(({color:n,size:t,strokeWidth:i,absoluteStrokeWidth:l,className:c="",children:u,iconNode:h,...m},p)=>{const{size:y=24,strokeWidth:v=2,absoluteStrokeWidth:b=!1,color:x="currentColor",className:_=""}=qE()??{},k=l??b?Number(i??v)*24/Number(t??y):i??v;return d.createElement("svg",{ref:p,...hh,width:t??y??hh.width,height:t??y??hh.height,stroke:n??x,strokeWidth:k,className:Bb("lucide",_,c),...!u&&!ME(m)&&{"aria-hidden":"true"},...m},[...h.map(([T,w])=>d.createElement(T,w)),...Array.isArray(u)?u:[u]])});const Ie=(n,t)=>{const i=d.forwardRef(({className:l,...c},u)=>d.createElement(UE,{ref:u,iconNode:t,className:Bb(`lucide-${zE(Bv(n))}`,`lucide-${n}`,l),...c}));return i.displayName=Bv(n),i};const BE=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],$b=Ie("bot",BE);const $E=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],PE=Ie("box",$E);const HE=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]],Pb=Ie("calendar-days",HE);const GE=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],VE=Ie("chevron-down",GE);const FE=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Hb=Ie("chevron-right",FE);const YE=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],KE=Ie("circle-check",YE);const XE=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]],Gb=Ie("clipboard-check",XE);const QE=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],ZE=Ie("database",QE);const WE=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],JE=Ie("external-link",WE);const e1=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],t1=Ie("eye",e1);const n1=[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]],zh=Ie("folder-kanban",n1);const s1=[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]],a1=Ie("footprints",s1);const r1=[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]],Vb=Ie("git-branch",r1);const i1=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],l1=Ie("hammer",i1);const o1=[["path",{d:"M12.409 5.824c-.702.792-1.15 1.496-1.415 2.166l2.153 2.156a.5.5 0 0 1 0 .707l-2.293 2.293a.5.5 0 0 0 0 .707L12 15",key:"idzbju"}],["path",{d:"M13.508 20.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5a5.5 5.5 0 0 1 9.591-3.677.6.6 0 0 0 .818.001A5.5 5.5 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5z",key:"1su70f"}]],c1=Ie("heart-crack",o1);const u1=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],d1=Ie("heart",u1);const h1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],ff=Ie("house",h1);const f1=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],p1=Ie("inbox",f1);const m1=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],g1=Ie("key-round",m1);const y1=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],pf=Ie("layers",y1);const v1=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],Fb=Ie("layout-dashboard",v1);const x1=[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]],b1=Ie("lock-keyhole",x1);const _1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],S1=Ie("lock",_1);const j1=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],T1=Ie("maximize-2",j1);const w1=[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]],k1=Ie("messages-square",w1);const E1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],C1=Ie("palette",E1);const N1=[["path",{d:"M3 2v1c0 1 2 1 2 2S3 6 3 7s2 1 2 2-2 1-2 2 2 1 2 2",key:"19w3oe"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M20.83 8.83a4 4 0 0 0-5.66-5.66l-12 12a4 4 0 1 0 5.66 5.66Z",key:"6fykxj"}],["path",{d:"M18 11.66V22a4 4 0 0 0 4-4V6",key:"1utzek"}]],A1=Ie("pocket-knife",N1);const R1=[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]],D1=Ie("puzzle",R1);const O1=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],z1=Ie("rocket",O1);const L1=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],$v=Ie("server",L1);const M1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Yb=Ie("settings",M1);const I1=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],q1=Ie("shield",I1);const U1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],B1=Ie("sparkles",U1);const $1=[["path",{d:"M15.236 22a3 3 0 0 0-2.2-5",key:"21bitc"}],["path",{d:"M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4",key:"oh0fg0"}],["path",{d:"M18 13h.01",key:"9veqaj"}],["path",{d:"M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10",key:"980v8a"}]],Kb=Ie("squirrel",$1);const P1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],H1=Ie("user-plus",P1);const G1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],V1=Ie("users",G1);const F1=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],Y1=Ie("zap",F1);const K1=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],X1=Ie("zoom-in",K1);const Q1=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],Z1=Ie("zoom-out",Q1),Vr=[{path:"/home",label:"Home",icon:ff},{path:"/tasks",label:"Tasks",icon:Gb},{path:"/tasks/schedule",label:"Schedules",icon:Pb},{path:"/context",label:"Context",icon:pf},{path:"/agents",label:"Agents",icon:Kb},{path:"/threads",label:"Threads",icon:k1},{path:"/tools",label:"Tools",icon:A1},{path:"/runs",label:"Runs",icon:Y1},{path:"/settings",label:"Settings",icon:Yb},{path:"/logout",label:"Logout",icon:S1}];function vt(n){const t=Mt();Jt(),d.useEffect(()=>{const i=t.pathname;let l="taico";if(i.startsWith("/home"))l="taico";else if(i.match(/\/tasks\/task\/.+/)&&n?.task?.name){const c=n.task.name;l=c.length>50?c.substring(0,50)+"...":c}else if(i.startsWith("/tasks"))l="tasks";else if(i.match(/\/context\/block\/.+/)&&n?.contextBlock?.title){const c=n.contextBlock.title;l=c.length>50?c.substring(0,50)+"...":c}else if(i.startsWith("/context"))l="context";else if(i.startsWith("/settings"))l="settings";else if(i.match(/\/agents\/agent\/.+/)&&n?.agent?.name)l=n.agent.name;else if(i.startsWith("/agents"))l="agents";else if(i.match(/\/tools\/tool\/.+/)&&n?.tool?.name)l=n.tool.name;else if(i.startsWith("/tools"))l="tools";else if(i.match(/\/threads\/.+/)&&n?.thread?.title){const c=n.thread.title;l=c.length>50?c.substring(0,50)+"...":c}else i.startsWith("/threads")?l="threads":i.startsWith("/runs")||i.startsWith("/executions")?l="runs":i.startsWith("/walkthrough")&&(l="walkthrough");document.title=l},[t.pathname,n])}function jl({icon:n,className:t,size:i=22}){if(typeof n=="string")return a.jsx("span",{className:t,children:n});const l=n;return a.jsx(l,{className:t,size:i,strokeWidth:1.5,absoluteStrokeWidth:!0})}function W1({children:n}){console.log("Beta shell");const{user:t}=un(),i=Mt();vt();const l=d.useMemo(()=>{if(!(t?.onboardingDisplayMode==="FULL_PAGE"||t?.onboardingDisplayMode==="BANNER"))return Vr;const y=Vr.findIndex(b=>b.path==="/settings"),v=[...Vr];return v.splice(y,0,{path:"/walkthrough",label:"Walkthrough",icon:a1}),v},[t?.onboardingDisplayMode]),c=Dt(),[u,h]=d.useState(()=>localStorage.getItem("sidebar-collapsed")==="true");d.useEffect(()=>{localStorage.setItem("sidebar-collapsed",String(u))},[u]);const m=()=>{h(!u)};return a.jsxs("div",{className:`${c?"beta-shell__desktop":"beta-shell__mobile"}`,"data-shell":`${c?"desktop":"mobile"}`,children:[c&&a.jsxs("aside",{className:`beta-shell__desktop__sidebar ${u?"beta-shell__desktop__sidebar--collapsed":""}`,children:[a.jsx("nav",{className:"beta-shell__desktop__nav",children:a.jsx("div",{className:"beta-shell__desktop__navInner",children:a.jsx(ee,{spacing:"1",children:l.map(p=>{const y=i.pathname.startsWith(p.path);return a.jsxs(qs,{to:p.path,title:u?p.label:void 0,className:`beta-shell__desktop__nav-item ${y?"beta-shell__desktop__nav-item--active":""}`,children:[a.jsx(jl,{icon:p.icon,className:"beta-shell__desktop__nav-icon"}),!u&&a.jsx("span",{className:"beta-shell__desktop__nav-label",children:p.label})]},p.path)})})})}),a.jsx("button",{className:"beta-shell__desktop__sidebar--toggle",onClick:m,"aria-label":u?"Expand sidebar":"Collapse sidebar",children:u?"→":"←"})]}),a.jsx("div",{className:`${c?"beta-shell__desktop__main":""}`,children:n})]})}function J1(n){return typeof n=="object"&&n!==null}function eC(n){if(!J1(n))return;const t=n.detail;if(typeof t=="string"&&t.length>0)return t;const i=n.message;if(typeof i=="string"&&i.length>0)return i;const l=n.title;if(typeof l=="string"&&l.length>0)return l;const c=n.error_description;if(typeof c=="string"&&c.length>0)return c}class Pv extends Error{status;statusText;body;constructor(t,i){const l=eC(i)??`HTTP ${t.status}: ${t.statusText}`;super(l),this.name="ApiError",this.status=t.status,this.statusText=t.statusText,this.body=i}}class ct{config;constructor(t){this.config=t}async parseResponseBody(t,i="auto"){if(i==="void"||t.status===204||t.headers.get("content-length")==="0")return;if(i==="json")try{return await t.json()}catch{return}if(i==="text"){const u=await t.text();return u.length>0?u:void 0}if(i==="arrayBuffer"){const u=await t.arrayBuffer();return u.byteLength>0?u:void 0}if(t.headers.get("content-type")?.includes("application/json"))try{return await t.json()}catch{return}const c=await t.text();return c.length>0?c:void 0}hasHeader(t,i){const l=i.toLowerCase();return Object.keys(t).some(c=>c.toLowerCase()===l)}removeHeader(t,i){const l=i.toLowerCase();for(const c of Object.keys(t))c.toLowerCase()===l&&delete t[c]}async buildAuthHeaders(){const t={};if(this.config.getAccessToken){const i=await this.config.getAccessToken();t.Authorization=`Bearer ${i}`}return this.config.getCookies&&(t.Cookie=await this.config.getCookies()),t}async request(t,i,l){const c=new URL(i,this.config.baseUrl);if(l?.params)for(const[p,y]of Object.entries(l.params))y!=null&&c.searchParams.append(p,String(y));const u={};if(this.config.headers)for(const[p,y]of Object.entries(this.config.headers))y!=null&&(u[p]=String(y));if(l?.headers)for(const[p,y]of Object.entries(l.headers))y!=null&&(u[p]=String(y));Object.assign(u,await this.buildAuthHeaders());let h;if(l?.body!==void 0){const p=l.bodyType??"json";p==="form-data"?(h=l.body,this.removeHeader(u,"Content-Type")):p==="raw"?h=l.body:(this.hasHeader(u,"Content-Type")||(u["Content-Type"]="application/json"),h=JSON.stringify(l.body))}const m=await fetch(c.toString(),{method:t,headers:u,body:h,signal:l?.signal,credentials:this.config.credentials});if(!m.ok){const p=await this.parseResponseBody(m,"auto");throw new Pv(m,p)}return await this.parseResponseBody(m,l?.responseType??"auto")}async*streamEvents(t,i){const l=new URL(t,this.config.baseUrl);if(i?.params)for(const[y,v]of Object.entries(i.params))v!=null&&l.searchParams.append(y,String(v));const c={Accept:"text/event-stream"};if(this.config.headers)for(const[y,v]of Object.entries(this.config.headers))v!=null&&(c[y]=String(v));if(i?.headers)for(const[y,v]of Object.entries(i.headers))v!=null&&(c[y]=String(v));Object.assign(c,await this.buildAuthHeaders());const u=await fetch(l.toString(),{method:"GET",headers:c,signal:i?.signal,credentials:this.config.credentials});if(!u.ok){const y=await this.parseResponseBody(u);throw new Pv(u,y)}if(!u.body)throw new Error("Response body is null");const h=u.body.getReader(),m=new TextDecoder;let p="";try{for(;;){const{done:y,value:v}=await h.read();if(y)break;p+=m.decode(v,{stream:!0});const b=p.split(`
|
|
56
|
+
`);p=b.pop()||"";for(const x of b)if(x.startsWith("data: ")){const _=x.slice(6);try{yield JSON.parse(_)}catch{yield _}}}}finally{h.releaseLock()}}}class tC extends ct{constructor(t){super(t)}async AppController_getHello(t){return this.request("GET","/api/v1",{signal:t?.signal})}async AppController_getLive(t){return this.request("GET","/health/live",{signal:t?.signal})}async AppController_getReady(t){return this.request("GET","/health/ready",{signal:t?.signal})}}class nC extends ct{constructor(t){super(t)}async MetaController_createTag(t){return this.request("POST","/api/v1/meta/tags",{body:t.body,signal:t?.signal})}async MetaController_getAllTags(t){return this.request("GET","/api/v1/meta/tags",{signal:t?.signal})}async MetaController_getTagColors(t){return this.request("GET","/api/v1/meta/tags/colors",{signal:t?.signal})}async MetaController_deleteTag(t){return this.request("DELETE",`/api/v1/meta/tags/${t.tagId}`,{responseType:"void",signal:t?.signal})}async MetaController_getVersion(t){return this.request("GET","/api/v1/meta/version",{signal:t?.signal})}}class sC extends ct{constructor(t){super(t)}async ProjectsController_createProject(t){return this.request("POST","/api/v1/meta/projects",{body:t.body,signal:t?.signal})}async ProjectsController_getAllProjects(t){return this.request("GET","/api/v1/meta/projects",{signal:t?.signal})}async ProjectsController_searchProjects(t){return this.request("GET","/api/v1/meta/projects/search",{params:{q:t.q,limit:t.limit,threshold:t.threshold},signal:t?.signal})}async ProjectsController_getProjectBySlug(t){return this.request("GET",`/api/v1/meta/projects/by-slug/${t.slug}`,{signal:t?.signal})}async ProjectsController_getProject(t){return this.request("GET",`/api/v1/meta/projects/${t.projectId}`,{signal:t?.signal})}async ProjectsController_updateProject(t){return this.request("PATCH",`/api/v1/meta/projects/${t.projectId}`,{body:t.body,signal:t?.signal})}async ProjectsController_deleteProject(t){return this.request("DELETE",`/api/v1/meta/projects/${t.projectId}`,{responseType:"void",signal:t?.signal})}}class aC extends ct{constructor(t){super(t)}async ClientRegistrationController_registerClient(t){return this.request("POST",`/api/v1/auth/clients/register/mcp/${t.serverId}/${t.version}`,{body:t.body,signal:t?.signal})}async ClientRegistrationController_getClient(t){return this.request("GET",`/api/v1/auth/clients/${t.clientId}`,{signal:t?.signal})}async ClientRegistrationController_listClients(t){return this.request("GET","/api/v1/auth/clients",{signal:t?.signal})}async AuthorizationController_authorize(t){return this.request("GET",`/api/v1/auth/authorize/mcp/${t.serverIdentifier}/${t.version}`,{params:{response_type:t.response_type,scope:t.scope,client_id:t.client_id,code_challenge:t.code_challenge,code_challenge_method:t.code_challenge_method,redirect_uri:t.redirect_uri,state:t.state,resource:t.resource},responseType:"void",signal:t?.signal})}async AuthorizationController_authorizeConsent(t){return this.request("POST",`/api/v1/auth/authorize/mcp/${t.serverIdentifier}/${t.version}`,{body:t.body,responseType:"void",signal:t?.signal})}async AuthorizationController_getConsentMetadata(t){return this.request("GET",`/api/v1/auth/consent/${t.flowId}`,{signal:t?.signal})}async AuthorizationController_token(t){return this.request("POST",`/api/v1/auth/token/mcp/${t.serverIdentifier}/${t.version}`,{body:t.body,signal:t?.signal})}async AuthorizationController_introspect(t){return this.request("POST",`/api/v1/auth/introspect/mcp/${t.serverIdentifier}/${t.version}`,{body:t.body,signal:t?.signal})}async AuthorizationController_tokenExchange(t){return this.request("POST",`/api/v1/auth/token-exchange/mcp/${t.serverIdentifier}/${t.version}`,{body:t.body,signal:t?.signal})}async AuthorizationController_callback(t){return this.request("GET","/api/v1/auth/callback",{params:{code:t.code,state:t.state,error:t.error,scope:t.scope,error_description:t.error_description},responseType:"void",signal:t?.signal})}async AuthorizationController_getScopes(t){return this.request("GET","/api/v1/auth/scopes",{signal:t?.signal})}}class rC extends ct{constructor(t){super(t)}async WebAuthController_login(t){return this.request("POST","/api/v1/auth/login",{body:t.body,signal:t?.signal})}async WebAuthController_listUsers(t){return this.request("GET","/api/v1/auth/users",{signal:t?.signal})}async WebAuthController_createUser(t){return this.request("POST","/api/v1/auth/users",{body:t.body,signal:t?.signal})}async WebAuthController_resetUserPassword(t){return this.request("POST",`/api/v1/auth/users/${t.userId}/reset-password`,{signal:t?.signal})}async WebAuthController_deleteUser(t){return this.request("DELETE",`/api/v1/auth/users/${t.userId}`,{signal:t?.signal})}async WebAuthController_getAccountSetupStatus(t){return this.request("POST","/api/v1/auth/account-setup-status",{body:t.body,signal:t?.signal})}async WebAuthController_setupAccount(t){return this.request("POST","/api/v1/auth/setup-account",{body:t.body,signal:t?.signal})}async WebAuthController_refresh(t){return this.request("POST","/api/v1/auth/refresh",{signal:t?.signal})}async WebAuthController_logout(t){return this.request("POST","/api/v1/auth/logout",{signal:t?.signal})}async WebAuthController_me(t){return this.request("GET","/api/v1/auth/me",{signal:t?.signal})}async WebAuthController_changePassword(t){return this.request("POST","/api/v1/auth/change-password",{body:t.body,signal:t?.signal})}async WebAuthController_getOnboardingStatus(t){return this.request("GET","/api/v1/auth/onboarding-status",{signal:t?.signal})}async WebAuthController_onboard(t){return this.request("POST","/api/v1/auth/onboard",{body:t.body,signal:t?.signal})}async WebAuthController_markWalkthroughSeen(t){return this.request("POST","/api/v1/auth/mark-walkthrough-seen",{signal:t?.signal})}}class iC extends ct{constructor(t){super(t)}async AuthJourneysController_getAuthJourneys(t){return this.request("GET",`/api/v1/auth-journeys/servers/${t.serverId}`,{signal:t?.signal})}}class lC extends ct{constructor(t){super(t)}async McpRegistryController_createServer(t){return this.request("POST","/api/v1/mcp/servers",{body:t.body,signal:t?.signal})}async McpRegistryController_listServers(t){return this.request("GET","/api/v1/mcp/servers",{params:{page:t?.page,limit:t?.limit},signal:t?.signal})}async McpRegistryController_getServer(t){return this.request("GET",`/api/v1/mcp/servers/${t.serverId}`,{signal:t?.signal})}async McpRegistryController_updateServer(t){return this.request("PATCH",`/api/v1/mcp/servers/${t.serverId}`,{body:t.body,signal:t?.signal})}async McpRegistryController_deleteServer(t){return this.request("DELETE",`/api/v1/mcp/servers/${t.serverId}`,{signal:t?.signal})}async McpRegistryController_createScopes(t){return this.request("POST",`/api/v1/mcp/servers/${t.serverId}/scopes`,{body:t.body,signal:t?.signal})}async McpRegistryController_listScopes(t){return this.request("GET",`/api/v1/mcp/servers/${t.serverId}/scopes`,{signal:t?.signal})}async McpRegistryController_getScope(t){return this.request("GET",`/api/v1/mcp/servers/${t.serverId}/scopes/${t.scopeId}`,{signal:t?.signal})}async McpRegistryController_deleteScope(t){return this.request("DELETE",`/api/v1/mcp/servers/${t.serverId}/scopes/${t.scopeId}`,{signal:t?.signal})}async McpRegistryController_createConnection(t){return this.request("POST",`/api/v1/mcp/servers/${t.serverId}/connections`,{body:t.body,signal:t?.signal})}async McpRegistryController_listConnections(t){return this.request("GET",`/api/v1/mcp/servers/${t.serverId}/connections`,{signal:t?.signal})}async McpRegistryController_getConnection(t){return this.request("GET",`/api/v1/mcp/connections/${t.connectionId}`,{signal:t?.signal})}async McpRegistryController_updateConnection(t){return this.request("PATCH",`/api/v1/mcp/connections/${t.connectionId}`,{body:t.body,signal:t?.signal})}async McpRegistryController_deleteConnection(t){return this.request("DELETE",`/api/v1/mcp/connections/${t.connectionId}`,{signal:t?.signal})}async McpRegistryController_createMapping(t){return this.request("POST",`/api/v1/mcp/servers/${t.serverId}/mappings`,{body:t.body,signal:t?.signal})}async McpRegistryController_listMappings(t){return this.request("GET",`/api/v1/mcp/servers/${t.serverId}/scopes/${t.scopeId}/mappings`,{signal:t?.signal})}async McpRegistryController_deleteMapping(t){return this.request("DELETE",`/api/v1/mcp/mappings/${t.mappingId}`,{signal:t?.signal})}}class oC extends ct{constructor(t){super(t)}async JwksController_getJwks(t){return this.request("GET","/.well-known/jwks.json",{signal:t?.signal})}}class cC extends ct{constructor(t){super(t)}async ActorController_listActors(t){return this.request("GET","/api/v1/actors",{signal:t?.signal})}async ActorController_searchActors(t){return this.request("GET","/api/v1/actors/search",{params:{query:t.query,limit:t.limit,threshold:t.threshold},signal:t?.signal})}}class uC extends ct{constructor(t){super(t)}async TasksController_createTask(t){return this.request("POST","/api/v1/tasks/tasks",{body:t.body,signal:t?.signal})}async TasksController_listTasks(t){return this.request("GET","/api/v1/tasks/tasks",{params:{assignee:t?.assignee,sessionId:t?.sessionId,tag:t?.tag,page:t?.page,limit:t?.limit},signal:t?.signal})}async TasksController_updateTask(t){return this.request("PATCH",`/api/v1/tasks/tasks/${t.id}`,{body:t.body,signal:t?.signal})}async TasksController_deleteTask(t){return this.request("DELETE",`/api/v1/tasks/tasks/${t.id}`,{responseType:"void",signal:t?.signal})}async TasksController_getTask(t){return this.request("GET",`/api/v1/tasks/tasks/${t.id}`,{signal:t?.signal})}async TasksController_assignTask(t){return this.request("PATCH",`/api/v1/tasks/tasks/${t.id}/assign`,{body:t.body,signal:t?.signal})}async TasksController_assignTaskToMe(t){return this.request("PATCH",`/api/v1/tasks/tasks/${t.id}/assign-to-me`,{signal:t?.signal})}async TasksController_searchTasks(t){return this.request("GET","/api/v1/tasks/tasks/search/query",{params:{query:t.query,limit:t.limit,threshold:t.threshold},signal:t?.signal})}async TasksController_addComment(t){return this.request("POST",`/api/v1/tasks/tasks/${t.id}/comments`,{body:t.body,signal:t?.signal})}async TasksController_addArtefact(t){return this.request("POST",`/api/v1/tasks/tasks/${t.id}/artefacts`,{body:t.body,signal:t?.signal})}async TasksController_changeStatus(t){return this.request("PATCH",`/api/v1/tasks/tasks/${t.id}/status`,{body:t.body,signal:t?.signal})}async TasksController_addTagToTask(t){return this.request("POST",`/api/v1/tasks/tasks/${t.id}/tags`,{body:t.body,signal:t?.signal})}async TasksController_removeTagFromTask(t){return this.request("DELETE",`/api/v1/tasks/tasks/${t.id}/tags/${t.tagId}`,{signal:t?.signal})}async TasksController_createInputRequest(t){return this.request("POST",`/api/v1/tasks/tasks/${t.id}/input-requests`,{body:t.body,signal:t?.signal})}async TasksController_answerInputRequest(t){return this.request("POST",`/api/v1/tasks/tasks/${t.id}/input-requests/${t.inputRequestId}/answer`,{body:t.body,signal:t?.signal})}async TasksController_handleMcp_get(t){return this.request("GET","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:t?.signal})}async TasksController_handleMcp_post(t){return this.request("POST","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:t?.signal})}async TasksController_handleMcp_put(t){return this.request("PUT","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:t?.signal})}async TasksController_handleMcp_delete(t){return this.request("DELETE","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:t?.signal})}async TasksController_handleMcp_patch(t){return this.request("PATCH","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:t?.signal})}async TasksController_handleMcp_options(t){return this.request("OPTIONS","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:t?.signal})}async TasksController_handleMcp_head(t){return this.request("HEAD","/api/v1/tasks/tasks/mcp",{responseType:"void",signal:t?.signal})}}class dC extends ct{constructor(t){super(t)}async AgentRunsController_createAgentRun(t){return this.request("POST","/api/v1/agent-runs",{body:t.body,signal:t?.signal})}async AgentRunsController_listAgentRuns(t){return this.request("GET","/api/v1/agent-runs",{params:{actorId:t?.actorId,parentTaskId:t?.parentTaskId,page:t?.page,limit:t?.limit},signal:t?.signal})}async AgentRunsController_getAgentRunById(t){return this.request("GET",`/api/v1/agent-runs/${t.runId}`,{signal:t?.signal})}async AgentRunsController_updateAgentRun(t){return this.request("PATCH",`/api/v1/agent-runs/${t.runId}`,{body:t.body,signal:t?.signal})}}class hC extends ct{constructor(t){super(t)}async ThreadsController_createThread(t){return this.request("POST","/api/v1/threads",{body:t.body,signal:t?.signal})}async ThreadsController_listThreads(t){return this.request("GET","/api/v1/threads",{params:{page:t?.page,limit:t?.limit},signal:t?.signal})}async ThreadsController_updateThread(t){return this.request("PATCH",`/api/v1/threads/${t.id}`,{body:t.body,signal:t?.signal})}async ThreadsController_getThread(t){return this.request("GET",`/api/v1/threads/${t.id}`,{signal:t?.signal})}async ThreadsController_deleteThread(t){return this.request("DELETE",`/api/v1/threads/${t.id}`,{responseType:"void",signal:t?.signal})}async ThreadsController_getThreadByTaskId(t){return this.request("GET",`/api/v1/threads/by-task/${t.taskId}`,{signal:t?.signal})}async ThreadsController_getThreadsByStateBlockId(t){return this.request("GET",`/api/v1/threads/by-state-block/${t.stateBlockId}`,{signal:t?.signal})}async ThreadsController_attachTask(t){return this.request("POST",`/api/v1/threads/${t.id}/tasks`,{body:t.body,signal:t?.signal})}async ThreadsController_referenceContextBlock(t){return this.request("POST",`/api/v1/threads/${t.id}/context-blocks`,{body:t.body,signal:t?.signal})}async ThreadsController_addTagToThread(t){return this.request("POST",`/api/v1/threads/${t.id}/tags`,{body:t.body,signal:t?.signal})}async ThreadsController_removeTagFromThread(t){return this.request("DELETE",`/api/v1/threads/${t.id}/tags/${t.tagId}`,{signal:t?.signal})}async ThreadsController_addParticipant(t){return this.request("POST",`/api/v1/threads/${t.id}/participants`,{body:t.body,signal:t?.signal})}async ThreadsController_getThreadState(t){return this.request("GET",`/api/v1/threads/${t.id}/state`,{signal:t?.signal})}async ThreadsController_updateThreadState(t){return this.request("PATCH",`/api/v1/threads/${t.id}/state`,{body:t.body,signal:t?.signal})}async ThreadsController_appendThreadState(t){return this.request("POST",`/api/v1/threads/${t.id}/state/append`,{body:t.body,signal:t?.signal})}async ThreadsController_createMessage(t){return this.request("POST",`/api/v1/threads/${t.id}/messages`,{body:t.body,signal:t?.signal})}async ThreadsController_listMessages(t){return this.request("GET",`/api/v1/threads/${t.id}/messages`,{params:{page:t.page,limit:t.limit},signal:t?.signal})}}class fC extends ct{constructor(t){super(t)}async AgentsController_createAgent(t){return this.request("POST","/api/v1/agents",{body:t.body,signal:t?.signal})}async AgentsController_listAgents(t){return this.request("GET","/api/v1/agents",{params:{isActive:t?.isActive,page:t?.page,limit:t?.limit},signal:t?.signal})}async AgentsController_listAgentTemplates(t){return this.request("GET","/api/v1/agents/templates",{signal:t?.signal})}async AgentsController_getAgentBySlug(t){return this.request("GET",`/api/v1/agents/${t.slug}`,{signal:t?.signal})}async AgentsController_patchAgent(t){return this.request("PATCH",`/api/v1/agents/${t.actorId}`,{body:t.body,signal:t?.signal})}async AgentsController_deleteAgent(t){return this.request("DELETE",`/api/v1/agents/${t.actorId}`,{responseType:"void",signal:t?.signal})}async AgentToolPermissionsController_listAgentToolPermissions(t){return this.request("GET",`/api/v1/agents/${t.actorId}/tool-permissions`,{signal:t?.signal})}async AgentToolPermissionsController_upsertAgentToolPermission(t){return this.request("PUT",`/api/v1/agents/${t.actorId}/tool-permissions/${t.serverId}`,{body:t.body,signal:t?.signal})}async AgentToolPermissionsController_deleteAgentToolPermission(t){return this.request("DELETE",`/api/v1/agents/${t.actorId}/tool-permissions/${t.serverId}`,{responseType:"void",signal:t?.signal})}}class pC extends ct{constructor(t){super(t)}async AgentTokensController_issueToken(t){return this.request("POST",`/api/v1/agents/${t.slug}/tokens`,{body:t.body,signal:t?.signal})}async AgentTokensController_listTokens(t){return this.request("GET",`/api/v1/agents/${t.slug}/tokens`,{signal:t?.signal})}async AgentTokensController_revokeToken(t){return this.request("DELETE",`/api/v1/agents/${t.slug}/tokens/${t.tokenId}`,{signal:t?.signal})}}class mC extends ct{constructor(t){super(t)}async AgentExecutionTokensController_requestExecutionToken(t){return this.request("POST",`/api/v1/agents/${t.slug}/execution-token`,{body:t.body,signal:t?.signal})}}class gC extends ct{constructor(t){super(t)}async ContextController_createBlock(t){return this.request("POST","/api/v1/context/blocks",{body:t.body,signal:t?.signal})}async ContextController_listBlocks(t){return this.request("GET","/api/v1/context/blocks",{params:{tag:t?.tag},signal:t?.signal})}async ContextController_searchBlocks(t){return this.request("GET","/api/v1/context/blocks/search/query",{params:{query:t.query,limit:t.limit,threshold:t.threshold},signal:t?.signal})}async ContextController_getBlockTree(t){return this.request("GET","/api/v1/context/blocks/tree",{signal:t?.signal})}async ContextController_exportBlocks(t){return this.request("GET","/api/v1/context/blocks/export",{responseType:"arrayBuffer",signal:t?.signal})}async ContextController_importBlocks(t){return this.request("POST","/api/v1/context/blocks/import",{body:t.body,bodyType:"form-data",signal:t?.signal})}async ContextController_getBlock(t){return this.request("GET",`/api/v1/context/blocks/${t.id}`,{signal:t?.signal})}async ContextController_updateBlock(t){return this.request("PATCH",`/api/v1/context/blocks/${t.id}`,{body:t.body,signal:t?.signal})}async ContextController_deleteBlock(t){return this.request("DELETE",`/api/v1/context/blocks/${t.id}`,{responseType:"void",signal:t?.signal})}async ContextController_appendToBlock(t){return this.request("POST",`/api/v1/context/blocks/${t.id}/append`,{body:t.body,signal:t?.signal})}async ContextController_reorderBlock(t){return this.request("PATCH",`/api/v1/context/blocks/${t.id}/reorder`,{body:t.body,signal:t?.signal})}async ContextController_moveBlock(t){return this.request("PATCH",`/api/v1/context/blocks/${t.id}/move`,{body:t.body,signal:t?.signal})}async ContextController_addTagToBlock(t){return this.request("POST",`/api/v1/context/blocks/${t.id}/tags`,{body:t.body,signal:t?.signal})}async ContextController_removeTagFromBlock(t){return this.request("DELETE",`/api/v1/context/blocks/${t.id}/tags/${t.tagId}`,{signal:t?.signal})}async ContextController_handleMcp_get(t){return this.request("GET","/api/v1/context/blocks/mcp",{responseType:"void",signal:t?.signal})}async ContextController_handleMcp_post(t){return this.request("POST","/api/v1/context/blocks/mcp",{responseType:"void",signal:t?.signal})}async ContextController_handleMcp_put(t){return this.request("PUT","/api/v1/context/blocks/mcp",{responseType:"void",signal:t?.signal})}async ContextController_handleMcp_delete(t){return this.request("DELETE","/api/v1/context/blocks/mcp",{responseType:"void",signal:t?.signal})}async ContextController_handleMcp_patch(t){return this.request("PATCH","/api/v1/context/blocks/mcp",{responseType:"void",signal:t?.signal})}async ContextController_handleMcp_options(t){return this.request("OPTIONS","/api/v1/context/blocks/mcp",{responseType:"void",signal:t?.signal})}async ContextController_handleMcp_head(t){return this.request("HEAD","/api/v1/context/blocks/mcp",{responseType:"void",signal:t?.signal})}}class yC extends ct{constructor(t){super(t)}async AiProvidersController_createAiProvider(t){return this.request("POST","/api/v1/ai-providers",{body:t.body,signal:t?.signal})}async AiProvidersController_listAiProviders(t){return this.request("GET","/api/v1/ai-providers",{signal:t?.signal})}async AiProvidersController_getAiProvider(t){return this.request("GET",`/api/v1/ai-providers/${t.id}`,{signal:t?.signal})}async AiProvidersController_updateAiProvider(t){return this.request("PATCH",`/api/v1/ai-providers/${t.id}`,{body:t.body,signal:t?.signal})}async AiProvidersController_deleteAiProvider(t){return this.request("DELETE",`/api/v1/ai-providers/${t.id}`,{responseType:"void",signal:t?.signal})}async AiProvidersController_listAiProviderModels(t){return this.request("GET",`/api/v1/ai-providers/${t.id}/models`,{signal:t?.signal})}}class vC extends ct{constructor(t){super(t)}async AiModelSelectionsController_listAiModelSelections(t){return this.request("GET","/api/v1/ai-model-selections",{signal:t?.signal})}async AiModelSelectionsController_setAiModelSelection(t){return this.request("PUT",`/api/v1/ai-model-selections/${t.job}`,{body:t.body,signal:t?.signal})}async AiModelSelectionsController_clearAiModelSelection(t){return this.request("DELETE",`/api/v1/ai-model-selections/${t.job}`,{responseType:"void",signal:t?.signal})}}class xC extends ct{constructor(t){super(t)}async SecretsController_createSecret(t){return this.request("POST","/api/v1/secrets",{body:t.body,signal:t?.signal})}async SecretsController_listSecrets(t){return this.request("GET","/api/v1/secrets",{signal:t?.signal})}async SecretsController_getSecret(t){return this.request("GET",`/api/v1/secrets/${t.id}`,{signal:t?.signal})}async SecretsController_updateSecret(t){return this.request("PATCH",`/api/v1/secrets/${t.id}`,{body:t.body,signal:t?.signal})}async SecretsController_deleteSecret(t){return this.request("DELETE",`/api/v1/secrets/${t.id}`,{responseType:"void",signal:t?.signal})}async SecretsController_getSecretValue(t){return this.request("GET",`/api/v1/secrets/${t.id}/value`,{signal:t?.signal})}}class bC extends ct{constructor(t){super(t)}async TaskExecutionQueueController_listQueue(t){return this.request("GET","/api/v1/executions/queue",{params:{page:t?.page,limit:t?.limit},signal:t?.signal})}async TaskExecutionQueueController_claimTask(t){return this.request("POST",`/api/v1/executions/queue/${t.taskId}/claim`,{signal:t?.signal})}async ActiveTaskExecutionController_listActiveExecutions(t){return this.request("GET","/api/v1/executions/active",{params:{page:t?.page,limit:t?.limit,taskId:t?.taskId},signal:t?.signal})}async ActiveTaskExecutionController_stopTaskExecution(t){return this.request("POST",`/api/v1/executions/active/${t.executionId}/stop`,{body:t.body,signal:t?.signal})}async ActiveTaskExecutionController_unclaimTaskExecution(t){return this.request("POST",`/api/v1/executions/active/${t.executionId}/unclaim`,{responseType:"void",signal:t?.signal})}async ActiveTaskExecutionController_updateRunnerSessionId(t){return this.request("PATCH",`/api/v1/executions/active/${t.executionId}/session`,{body:t.body,responseType:"void",signal:t?.signal})}async ActiveTaskExecutionController_incrementToolCallCount(t){return this.request("PATCH",`/api/v1/executions/active/${t.executionId}/tool-calls/increment`,{responseType:"void",signal:t?.signal})}async ActiveTaskExecutionController_updateExecutionStats(t){return this.request("PATCH",`/api/v1/executions/active/${t.executionId}/stats`,{body:t.body,responseType:"void",signal:t?.signal})}async ActiveTaskExecutionController_interruptExecution(t){return this.request("POST",`/api/v1/executions/active/${t.executionId}/interrupt`,{responseType:"void",signal:t?.signal})}async TaskExecutionHistoryController_listHistory(t){return this.request("GET","/api/v1/executions/history",{params:{page:t?.page,limit:t?.limit,taskId:t?.taskId},signal:t?.signal})}}class _C extends ct{constructor(t){super(t)}async WorkersController_listWorkers(t){return this.request("GET","/api/v1/workers",{signal:t?.signal})}}class SC extends ct{constructor(t){super(t)}async TaskBlueprintsController_createTaskBlueprint(t){return this.request("POST","/api/v1/task-blueprints",{body:t.body,signal:t?.signal})}async TaskBlueprintsController_listTaskBlueprints(t){return this.request("GET","/api/v1/task-blueprints",{params:{page:t?.page,limit:t?.limit},signal:t?.signal})}async TaskBlueprintsController_getTaskBlueprint(t){return this.request("GET",`/api/v1/task-blueprints/${t.id}`,{signal:t?.signal})}async TaskBlueprintsController_updateTaskBlueprint(t){return this.request("PATCH",`/api/v1/task-blueprints/${t.id}`,{body:t.body,signal:t?.signal})}async TaskBlueprintsController_deleteTaskBlueprint(t){return this.request("DELETE",`/api/v1/task-blueprints/${t.id}`,{responseType:"void",signal:t?.signal})}async TaskBlueprintsController_createTaskFromBlueprint(t){return this.request("POST",`/api/v1/task-blueprints/${t.id}/create-task`,{signal:t?.signal})}}class jC extends ct{constructor(t){super(t)}async ScheduledTasksController_createScheduledTask(t){return this.request("POST","/api/v1/scheduled-tasks",{body:t.body,signal:t?.signal})}async ScheduledTasksController_listScheduledTasks(t){return this.request("GET","/api/v1/scheduled-tasks",{params:{page:t?.page,limit:t?.limit,enabled:t?.enabled},signal:t?.signal})}async ScheduledTasksController_getScheduledTask(t){return this.request("GET",`/api/v1/scheduled-tasks/${t.id}`,{signal:t?.signal})}async ScheduledTasksController_updateScheduledTask(t){return this.request("PATCH",`/api/v1/scheduled-tasks/${t.id}`,{body:t.body,signal:t?.signal})}async ScheduledTasksController_deleteScheduledTask(t){return this.request("DELETE",`/api/v1/scheduled-tasks/${t.id}`,{responseType:"void",signal:t?.signal})}}class TC extends ct{constructor(t){super(t)}async DiscoveryController_getIssuer(t){return this.request("GET","/.well-known/oauth-authorization-server/mcp/issuer",{signal:t?.signal})}async DiscoveryController_getAuthorizationServerMetadata(t){return this.request("GET",`/.well-known/oauth-authorization-server/mcp/${t.mcpServerId}/${t.version}`,{signal:t?.signal})}async DiscoveryController_all(t){return this.request("GET",`/.well-known/oauth-protected-resource/${t.path}`,{signal:t?.signal})}}class wC extends ct{constructor(t){super(t)}async GlobalSearchController_search(t){return this.request("GET","/api/v1/search/query",{params:{query:t.query,limit:t.limit,threshold:t.threshold},signal:t?.signal})}}class kC extends ct{constructor(t){super(t)}async WalkthroughController_acknowledge(t){return this.request("POST","/api/v1/walkthrough/acknowledge",{responseType:"void",signal:t?.signal})}async WalkthroughController_getStatus(t){return this.request("GET","/api/v1/walkthrough/status",{signal:t?.signal})}}class ns{app;meta;metaProjects;authorizationServer;webAuthentication;authorizationJourneys;tools;jwks;actors;task;agentrun;threads;agent;agentTokens;agentExecutionTokens;context;aiProviders;aiModelSelections;secrets;executions;workers;taskBlueprints;scheduledTasks;discovery;search;walkthrough;constructor(t){this.app=new tC(t),this.meta=new nC(t),this.metaProjects=new sC(t),this.authorizationServer=new aC(t),this.webAuthentication=new rC(t),this.authorizationJourneys=new iC(t),this.tools=new lC(t),this.jwks=new oC(t),this.actors=new cC(t),this.task=new uC(t),this.agentrun=new dC(t),this.threads=new hC(t),this.agent=new fC(t),this.agentTokens=new pC(t),this.agentExecutionTokens=new mC(t),this.context=new gC(t),this.aiProviders=new yC(t),this.aiModelSelections=new vC(t),this.secrets=new xC(t),this.executions=new bC(t),this.workers=new _C(t),this.taskBlueprints=new SC(t),this.scheduledTasks=new jC(t),this.discovery=new TC(t),this.search=new wC(t),this.walkthrough=new kC(t)}}const EC=window.location.origin,CC=new ns({baseUrl:EC,credentials:"include"}),mf=CC.walkthrough,NC=()=>{console.log("useHome mounting");const[n,t]=d.useState(null);return d.useEffect(()=>{console.log("useHome setting message"),t("Message coming from useHome")},[]),{message:n,setMessage:t}},Xb=d.createContext(null);function AC({children:n}){const{message:t}=NC(),[i,l]=d.useState(""),c=d.useMemo(()=>({message:t,sectionTitle:i,setSectionTitle:l}),[t,i,l]);return a.jsx(Xb.Provider,{value:c,children:n})}function Tn(){const n=d.useContext(Xb);if(!n)throw new Error("useHomeCtx must be used within <HomeProvider>");return n}const RC=window.location.origin,Qb=new ns({baseUrl:RC,credentials:"include"}),DC=Qb.search;Qb.search;function Zb(){const[n,t]=d.useState(null),[i,l]=d.useState(!0),[c,u]=d.useState(null);return d.useEffect(()=>{mf.WalkthroughController_getStatus().then(h=>{const m=[{id:"worker",label:"Configure a worker",description:"A worker is a process that runs on your machine and executes agent tasks. Launch the Taico worker binary, then authenticate it with your account — it will appear here once connected.",href:"/settings/workers",completed:h.workerConfigured},{id:"agent",label:"Create an agent",description:"Agents are AI assistants that work on tasks. Create one by picking a runner (e.g. Claude Code, OpenCode), choosing a template, and selecting which tools it can use.",href:"/agents",completed:h.agentCreated},{id:"task",label:"Create a task",description:"Tasks are the core unit of work in Taico. Create your first task, write a clear description, and assign it to an agent to get it working.",href:"/tasks",completed:h.taskCreated},{id:"project-create",label:"Create a project",description:"Projects are created automatically when you add a tag in the format project:<name> to any task. Go to Tasks, open or create a task, and add a tag like project:my-app. Taico will create the project entry for you.",href:"/tasks",completed:h.projectCreated},{id:"project-configure",label:"Configure a project",description:"Link your project to a code repository. Go to Settings → Projects, find your project, and add a repository URL. Taico will automatically clone that repo for any task tagged with this project — no need to specify it per-task.",href:"/settings/projects",completed:h.projectConfigured},{id:"task-with-project",label:"Assign a task to an agent with a project",description:"Tag a task with a project tag and assign it to an agent. Taico will clone the linked repository and make it available in the agent's working directory automatically.",href:"/tasks",completed:h.taskWithProjectCreated},{id:"context",label:"Create a context block",description:"Context blocks are reusable pieces of text — instructions, reference docs, coding standards — that you can attach to tasks and threads. Agents will read them as part of their prompt.",href:"/context",completed:h.contextBlockCreated},{id:"thread",label:"Connect an AI model",description:"Threads are conversations with the Taico agent. Add an AI provider and pick the model that answers. You can also pick a cheaper model for small background jobs.",href:"/settings/models",completed:h.conversationModelReady}],p=m.filter(y=>y.completed).length;t({steps:m,completedCount:p,totalCount:m.length,displayMode:h.onboardingDisplayMode})}).catch(h=>{console.error("Failed to fetch walkthrough status:",h),u(h instanceof Error?h.message:"Failed to load walkthrough")}).finally(()=>{l(!1)})},[]),{status:n,isLoading:i,error:c}}function OC(){const{user:n,refreshAuth:t}=un(),{status:i}=Zb(),l=De(),[c,u]=d.useState(!1),[h,m]=d.useState(!1);if(n?.onboardingDisplayMode!=="BANNER"||c)return null;const p=i?.completedCount??0,y=i?.totalCount??7,v=y-p,b=()=>l("/walkthrough"),x=k=>{k.stopPropagation(),u(!0)},_=async k=>{k.stopPropagation();try{m(!0),await tn.webAuthControllerMarkWalkthroughSeen(),await t()}catch(T){console.error("Failed to hide walkthrough:",T),m(!1)}};return a.jsx("div",{className:"home-walkthrough-wrap",children:a.jsxs("div",{className:"home-walkthrough-card",onClick:b,role:"button",tabIndex:0,onKeyDown:k=>k.key==="Enter"&&b(),children:[a.jsx("div",{className:"home-walkthrough-dots","aria-hidden":"true",children:Array.from({length:y}).map((k,T)=>a.jsx("span",{className:`home-walkthrough-dot${T<p?" home-walkthrough-dot--done":""}`},T))}),a.jsxs("div",{className:"home-walkthrough-body",children:[a.jsx(S,{size:"2",weight:"semibold",children:v===0?"Setup complete!":`${v} step${v===1?"":"s"} to go`}),a.jsxs(S,{size:"1",tone:"muted",children:[p," of ",y," setup steps completed · Click to continue"]})]}),a.jsxs("div",{className:"home-walkthrough-actions",children:[a.jsx("button",{className:"home-walkthrough-not-now",onClick:x,children:"Not now"}),a.jsx("button",{className:"home-walkthrough-all-set",onClick:_,disabled:h,children:h?"…":"I'm all set"})]})]})})}function zC(){const n=De(),{setSectionTitle:t}=Tn(),[i,l]=d.useState(""),[c,u]=d.useState([]),[h,m]=d.useState(!1),[p,y]=d.useState(-1),v=d.useRef(null),b=d.useRef([]);vt(),d.useEffect(()=>{t(""),v.current?.focus()},[t]);const x=d.useCallback(async E=>{if(!E.trim()){u([]),y(-1);return}m(!0);try{const R=await DC.GlobalSearchController_search({query:E,limit:20});u(R),y(-1),b.current=[]}catch(R){console.error("Search failed:",R),u([])}finally{m(!1)}},[]);d.useEffect(()=>{const E=setTimeout(()=>{x(i)},300);return()=>clearTimeout(E)},[i,x]);const _=E=>{E.key==="ArrowDown"?(E.preventDefault(),y(R=>{const D=R<c.length-1?R+1:R;return setTimeout(()=>{b.current[D]?.scrollIntoView({behavior:"smooth",block:"nearest"})},0),D})):E.key==="ArrowUp"?(E.preventDefault(),y(R=>{const D=R>0?R-1:0;return setTimeout(()=>{b.current[D]?.scrollIntoView({behavior:"smooth",block:"nearest"})},0),D})):E.key==="Enter"&&p>=0&&c[p]&&(E.preventDefault(),n(c[p].url))},k=E=>{n(E)},T=E=>{switch(E){case"task":return"blue";case"context_block":return"purple";case"agent":return"green";case"project":return"orange";case"tag":return"yellow";case"tool":return"red";default:return"gray"}},w=E=>{switch(E){case"task":return"Task";case"context_block":return"Context";case"agent":return"Agent";case"project":return"Project";case"tag":return"Tag";case"tool":return"Tool";default:return E}};return a.jsxs("div",{className:"home-page",children:[a.jsx(OC,{}),a.jsx("div",{className:"home-page-search",children:a.jsx("div",{className:"home-search-container",children:a.jsxs(ee,{spacing:"6",align:"center",children:[a.jsxs(ee,{spacing:"3",align:"center",children:[a.jsx(S,{size:"6",weight:"bold",className:"home-search-title",children:"Find anything"}),a.jsx(S,{size:"3",tone:"muted",className:"home-search-subtitle",children:"Search across tasks, context, agents, tools, and more"})]}),a.jsx("div",{className:"home-search-box",children:a.jsx("input",{ref:v,type:"text",className:"home-search-input",placeholder:"Search...",value:i,onChange:E=>l(E.target.value),onKeyDown:_,autoFocus:!0})}),i&&a.jsx(Ye,{className:"home-search-results",children:a.jsxs(ee,{spacing:"2",children:[h&&a.jsx(S,{tone:"muted",size:"2",children:"Searching..."}),!h&&c.length===0&&a.jsx(S,{tone:"muted",size:"2",children:"No results found"}),!h&&c.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs(S,{size:"1",tone:"muted",children:[c.length," ",c.length===1?"result":"results"]}),a.jsx("div",{className:"home-search-results-list",children:c.map((E,R)=>a.jsx("div",{ref:D=>{b.current[R]=D},children:a.jsxs(Uk,{interactive:!0,onClick:()=>k(E.url),className:`home-search-result-row ${R===p?"home-search-result-row--selected":""}`,children:[a.jsx("div",{className:"home-search-result-main",children:a.jsx(S,{weight:"medium",size:"3",children:E.title})}),a.jsxs("div",{className:"home-search-result-meta",children:[a.jsx(Sn,{color:T(E.type),children:w(E.type)}),a.jsxs(S,{size:"1",tone:"muted",children:[Math.round(E.score*100),"% match"]})]})]})},E.id))})]})]})}),a.jsxs(yt,{spacing:"2",className:"home-quick-links",children:[a.jsx(ce,{variant:"ghost",size:"sm",onClick:()=>n("/tasks"),children:"Tasks"}),a.jsx(ce,{variant:"ghost",size:"sm",onClick:()=>n("/threads"),children:"Threads"}),a.jsx(ce,{variant:"ghost",size:"sm",onClick:()=>n("/agents"),children:"Agents"}),a.jsx(ce,{variant:"ghost",size:"sm",onClick:()=>n("/context"),children:"Context"})]})]})})})]})}function Jr({sectionTitle:n,titleAccessory:t,headerActions:i,children:l}){return a.jsxs("div",{className:"desktop-shell",children:[n&&a.jsxs("div",{className:"desktop-shell__header",children:[a.jsxs("div",{className:"desktop-shell__title-row",children:[a.jsx("h1",{className:"desktop-shell__title",children:n}),t?a.jsx("div",{className:"desktop-shell__title-accessory",children:t}):null]}),i?a.jsx("div",{className:"desktop-shell__actions",children:i}):null]}),a.jsx("div",{className:"desktop-shell__content",children:l})]})}function LC({navItems:n,activePath:t,onActiveItemClick:i}){return console.log("Rendering BottomNavContent with navItems:",n),n.length===0?a.jsx(a.Fragment,{}):a.jsx(yt,{spacing:"1",justify:"space-between",children:n.map(l=>{const c=t===l.path;return a.jsxs(qs,{to:l.path,className:`ios-shell__bottom-nav__item ${c?"ios-shell__bottom-nav__item--active":""}`,onClick:()=>{c&&i()},children:[a.jsx(jl,{icon:l.icon,className:"ios-shell__bottom-nav__icon"}),a.jsx(S,{size:"1",className:"ios-shell__bottom-nav-label",children:l.label})]},l.label)})})}function Qa(n){const t=Mt();console.log("Mounting iOS shell");const[i,l]=d.useState(!1),c=()=>{l(!1)},[u,h]=d.useState(!0),[m,p]=d.useState(!0),[y,v]=d.useState(!0),b=d.useRef(null),x=U=>{b.current=U,L(),C(),P()},_=d.useRef(null),k=U=>{_.current=U,L()},T=d.useRef(null),w=d.useRef(null),E=U=>{w.current=U,C()},R=d.useRef(null),D=d.useRef(null),O=U=>{D.current=U,P()},z=d.useRef(null),A=(U,re,Q)=>{const J=re.current,ye=b.current;!J||!ye||(U.current?.disconnect(),U.current=new IntersectionObserver(([B])=>{Q(B.isIntersecting)},{root:ye,threshold:[0,1]}),U.current.observe(J))},C=()=>{A(R,w,U=>{console.log(`title visibility detector: ${U}`),h(U)})},L=()=>{A(T,_,U=>{console.log(`content behind header detector: ${U}`),p(!U)})},P=()=>{A(z,D,U=>{console.log(`bottom detector: ${U}`),v(!U)})},Y=()=>{b.current?.scrollTo({top:0,behavior:"smooth"})};return d.useEffect(()=>()=>{R.current?.disconnect(),T.current?.disconnect(),z.current?.disconnect()},[]),a.jsxs("div",{className:"ios-shell",children:[a.jsxs("aside",{className:`ios-shell__drawer ${i?"ios-shell__drawer--open":""}`,children:[a.jsxs("div",{className:"ios-shell__drawer-header",children:[a.jsx(S,{size:"4",weight:"bold",children:"taico"}),a.jsx("button",{className:"ios-shell__drawer-close",onClick:c,"aria-label":"Close menu",children:"✕"})]}),a.jsx("nav",{className:"ios-shell__drawer-nav",children:Vr.map(U=>{const re=t.pathname===U.path||t.pathname.startsWith(U.path+"/");return a.jsxs(qs,{to:U.path,className:`ios-shell__drawer-item ${re?"ios-shell__drawer-item--active":""}`,onClick:c,children:[a.jsx(jl,{icon:U.icon,className:"ios-shell__drawer-icon"}),a.jsx("span",{className:"ios-shell__drawer-label",children:U.label})]},U.path)})})]}),a.jsx("header",{className:`ios-shell__header ${m?"elevated":""}`,children:a.jsxs(yt,{spacing:"5",align:"center",children:[a.jsx("button",{className:"ios-shell__hamburger",onClick:()=>l(!0),"aria-label":"Open menu",children:"☰"}),a.jsx(S,{size:"3",weight:"normal",as:"div",children:n.appTitle}),a.jsx("div",{className:`ios-shell__header__section-title ${u?"is-hidden":"is-visible"}`,children:n.sectionTitle})]})}),a.jsxs("main",{ref:x,className:"ios-shell__main",children:[a.jsx("div",{className:"ios-shell__main__top-padding"}),a.jsx("div",{ref:k,className:"ios-shell__main__section-title-top-sentinel"}),a.jsx("div",{className:`ios-shell__main__section-title ${u?"is-visible":"is-hidden"}`,children:n.sectionTitle}),n.topActions?a.jsx("div",{className:"ios-shell__main__top-actions",children:n.topActions}):null,a.jsx("div",{ref:E,className:"ios-shell__main__section-title-bottom-sentinel"}),a.jsx("div",{className:"ios-shell__main__top-sentinel"}),n.children,a.jsx("div",{ref:O,className:"ios-shell__main__bottom-sentinel"}),a.jsx("div",{className:"ios-shell__main__bottom-padding"})]}),a.jsx("nav",{className:`ios-shell__bottom-nav ${y?"elevated":""}`,children:a.jsx(LC,{navItems:n.navItems,activePath:t.pathname,onActiveItemClick:Y})})]})}const MC=[{path:"/home",label:"Home",icon:ff},{path:"/tasks",label:"Tasks",icon:Gb},{path:"/context",label:"Context",icon:pf},{path:"/agents",label:"Agents",icon:Kb},{path:"/settings",label:"Settings",icon:Yb}];function IC(){const n=Dt(),{sectionTitle:t}=Tn();return a.jsx(a.Fragment,{children:n?a.jsx(Jr,{sectionTitle:t,children:a.jsx(Qt,{})}):a.jsx(Qa,{appTitle:"Home",sectionTitle:t,navItems:MC,children:a.jsx(Qt,{})})})}const Wb=d.createContext(null);function Tl(){const n=d.useContext(Wb);if(!n)throw new Error("useCommandPalette must be used within a CommandPaletteProvider");return n}function qC({children:n}){const t=De(),[i,l]=d.useState(new Map),[c,u]=d.useState(new Map),h=d.useRef(0),m=d.useMemo(()=>[{id:"nav-home",label:"Home",description:"Go to homepage",aliases:["home","search"],onSelect:()=>t("/home")},{id:"nav-tasks",label:"Tasks",description:"Go to tasks",aliases:["task"],onSelect:()=>t("/tasks")},{id:"nav-context",label:"Context",description:"Go to context blocks",aliases:["blocks","block"],onSelect:()=>t("/context")},{id:"nav-agents",label:"Agents",description:"Go to agents",aliases:["agent"],onSelect:()=>t("/agents")},{id:"nav-threads",label:"Threads",description:"Go to threads",aliases:["thread"],onSelect:()=>t("/threads")},{id:"nav-tools",label:"Tools",description:"Go to tools",aliases:["mcp","tool"],onSelect:()=>t("/tools")},{id:"nav-runs",label:"Runs",description:"Go to runs",aliases:["executions","execution","work queue"],onSelect:()=>t("/runs")},{id:"nav-schedule",label:"Schedule",description:"Go to schedule",aliases:["cron","schedules"],onSelect:()=>t("/tasks/schedule")},{id:"nav-settings",label:"Settings",description:"Go to settings",aliases:["setting","config"],onSelect:()=>t("/settings")}],[t]),p=d.useCallback(_=>{const k=String(++h.current);return l(T=>{const w=new Map(T);return w.set(k,_),w}),()=>{l(T=>{const w=new Map(T);return w.delete(k),w})}},[]),y=d.useCallback(_=>{const k=String(++h.current);return u(T=>{const w=new Map(T);return w.set(k,_),w}),()=>{u(T=>{const w=new Map(T);return w.delete(k),w})}},[]),v=d.useMemo(()=>[...Array.from(i.values()).flat(),...m],[m,i]),b=d.useMemo(()=>{const _=Array.from(c.values());return _[_.length-1]},[c]),x=d.useMemo(()=>({commands:v,registerCommands:p,searchTasks:b,registerTaskSearch:y}),[v,p,b,y]);return a.jsxs(Wb.Provider,{value:x,children:[n,a.jsx(UC,{})]})}function UC(){const{commands:n,searchTasks:t}=Tl(),i=De(),[l,c]=d.useState(!1),[u,h]=d.useState(""),[m,p]=d.useState(0),[y,v]=d.useState(!1),[b,x]=d.useState([]),[_,k]=d.useState(!1),T=d.useRef(null),w=d.useRef(null),E=d.useRef(null),R=d.useRef(0);function D(U,re){const Q=U.label.toLowerCase(),J=U.description?.toLowerCase()||"",ye=Q.indexOf(re);if(ye!==-1)return Q===re?1e3:ye===0?500:300;if(U.aliases)for(const B of U.aliases){const se=B.toLowerCase(),ge=se.indexOf(re);if(ge!==-1)return se===re?800:ge===0?400:200}return J.includes(re)?100:0}const O=u.toLowerCase().trim(),A=[...n.map(U=>({command:U,score:O?D(U,O):0})).filter(U=>U.score>0).sort((U,re)=>re.score!==U.score?re.score-U.score:0).map(U=>U.command).map(U=>({type:"command",command:U})),...b.map(U=>({type:"task",task:U}))];function C(U){if(!O)return U;const re=U.toLowerCase().indexOf(O);return re===-1?U:a.jsxs(a.Fragment,{children:[U.slice(0,re),a.jsx("mark",{children:U.slice(re,re+O.length)}),U.slice(re+O.length)]})}d.useEffect(()=>{if(E.current&&clearTimeout(E.current),!t){R.current+=1,x([]),k(!1);return}if(!O){R.current+=1,x([]),k(!1);return}R.current+=1;const U=R.current;return E.current=window.setTimeout(async()=>{k(!0);try{const re=await t(O);R.current===U&&x(re)}catch(re){console.error("Failed to search tasks:",re),R.current===U&&x([])}finally{R.current===U&&k(!1)}},200),()=>{E.current&&clearTimeout(E.current)}},[O,t]),d.useEffect(()=>{p(0)},[u]),d.useEffect(()=>{const U=re=>{(re.metaKey||re.ctrlKey)&&re.key==="/"&&(re.preventDefault(),c(!0))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[]),d.useEffect(()=>{l&&T.current&&T.current.focus()},[l]),d.useEffect(()=>{const U=re=>{w.current&&!w.current.contains(re.target)&&l&&L()};if(l)return document.addEventListener("mousedown",U),()=>document.removeEventListener("mousedown",U)},[l]);function L(){c(!1),h(""),p(0),x([]),k(!1),E.current&&clearTimeout(E.current),R.current+=1}function P(U){U.type==="command"?U.command.onSelect():i(`/tasks/task/${U.task.id}`),L()}function Y(U){if(U.key==="Escape"){U.preventDefault(),L();return}if(U.key==="ArrowDown"){U.preventDefault(),p(re=>re<A.length-1?re+1:re);return}if(U.key==="ArrowUp"){U.preventDefault(),p(re=>re>0?re-1:0);return}if(U.key==="Enter"){if(U.preventDefault(),A.length===0){v(!0),setTimeout(()=>v(!1),500);return}const re=A[m];re&&P(re);return}}return l?a.jsx("div",{className:"command-palette-backdrop",children:a.jsxs("div",{className:`command-palette-container ${y?"command-palette-container--shake":""}`,ref:w,children:[a.jsx("input",{ref:T,type:"text",className:"command-palette-input",placeholder:"Type a command...",value:u,onChange:U=>h(U.target.value),onKeyDown:Y,autoComplete:"off",spellCheck:!1}),A.length>0&&a.jsx("div",{className:"command-palette-results",children:A.map((U,re)=>{if(U.type==="command"){const Q=U.command;return a.jsxs("div",{className:`command-palette-item ${re===m?"command-palette-item--selected":""}`,onClick:()=>P(U),onMouseEnter:()=>p(re),children:[a.jsx("span",{className:"command-palette-item-label",children:C(Q.label)}),Q.description&&a.jsx("span",{className:"command-palette-item-description",children:Q.description})]},`cmd-${Q.id}`)}else{const Q=U.task;return a.jsxs("div",{className:`command-palette-item command-palette-item--task ${re===m?"command-palette-item--selected":""}`,onClick:()=>P(U),onMouseEnter:()=>p(re),children:[a.jsx("span",{className:"command-palette-item-label",children:C(Q.name)}),a.jsx("span",{className:"command-palette-item-description",children:"Task"})]},`task-${Q.id}`)}})}),u&&A.length===0&&!_&&a.jsx("div",{className:"command-palette-no-results",children:"No results found"}),_&&a.jsx("div",{className:"command-palette-searching",children:"Searching tasks..."})]})}):null}function ei({onDelete:n,deleteLabel:t="Delete",confirmLabel:i="Confirm Delete",cancelLabel:l="Cancel",className:c,size:u="lg"}){const[h,m]=d.useState(!1),p=async()=>{await n(),m(!1)};return a.jsx(xe,{className:c,children:h?a.jsxs(a.Fragment,{children:[a.jsx(ce,{size:u,variant:"secondary",onClick:()=>m(!1),children:l}),a.jsx(ce,{size:u,variant:"danger",onClick:p,children:i})]}):a.jsx(ce,{size:u,variant:"danger",onClick:()=>m(!0),children:t})})}const Jb=d.createContext(void 0);function dn(){const n=d.useContext(Jb);if(!n)throw new Error("useToast must be used within ToastProvider");return n}function BC(n){if(n&&typeof n=="object"){const t=n;if(t.body?.detail)return t.body.detail;if(t.detail)return t.detail;if(t.message)return t.message}return typeof n=="string"?n:"An unexpected error occurred"}function $C({children:n}){const[t,i]=d.useState([]),l=d.useCallback((h,m="info",p=5e3)=>{const y=crypto.randomUUID(),v={id:y,message:h,type:m,duration:p};i(b=>[...b,v]),p>0&&setTimeout(()=>{u(y)},p)},[]),c=d.useCallback(h=>{const m=BC(h);l(m,"error",6e3)},[l]),u=d.useCallback(h=>{i(m=>m.filter(p=>p.id!==h))},[]);return a.jsx(Jb.Provider,{value:{toasts:t,showToast:l,showError:c,dismissToast:u},children:n})}function PC(){const{toasts:n,dismissToast:t}=dn();return n.length===0?null:a.jsx("div",{className:"toast-container",children:n.map(i=>a.jsxs("div",{className:`toast toast--${i.type}`,role:"alert","aria-live":"assertive",children:[a.jsx("div",{className:"toast__content",children:a.jsx(S,{size:"2",className:"toast__message",children:i.message})}),a.jsx("button",{className:"toast__close",onClick:()=>t(i.id),"aria-label":"Dismiss notification",children:"×"})]},i.id))})}Le.BASE=Va;const fs=Object.create(null);fs.open="0";fs.close="1";fs.ping="2";fs.pong="3";fs.message="4";fs.upgrade="5";fs.noop="6";const uc=Object.create(null);Object.keys(fs).forEach(n=>{uc[fs[n]]=n});const Lh={type:"error",data:"parser error"},e_=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",t_=typeof ArrayBuffer=="function",n_=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,gf=({type:n,data:t},i,l)=>e_&&t instanceof Blob?i?l(t):Hv(t,l):t_&&(t instanceof ArrayBuffer||n_(t))?i?l(t):Hv(new Blob([t]),l):l(fs[n]+(t||"")),Hv=(n,t)=>{const i=new FileReader;return i.onload=function(){const l=i.result.split(",")[1];t("b"+(l||""))},i.readAsDataURL(n)};function Gv(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let fh;function HC(n,t){if(e_&&n.data instanceof Blob)return n.data.arrayBuffer().then(Gv).then(t);if(t_&&(n.data instanceof ArrayBuffer||n_(n.data)))return t(Gv(n.data));gf(n,!1,i=>{fh||(fh=new TextEncoder),t(fh.encode(i))})}const Vv="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cl=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<Vv.length;n++)cl[Vv.charCodeAt(n)]=n;const GC=n=>{let t=n.length*.75,i=n.length,l,c=0,u,h,m,p;n[n.length-1]==="="&&(t--,n[n.length-2]==="="&&t--);const y=new ArrayBuffer(t),v=new Uint8Array(y);for(l=0;l<i;l+=4)u=cl[n.charCodeAt(l)],h=cl[n.charCodeAt(l+1)],m=cl[n.charCodeAt(l+2)],p=cl[n.charCodeAt(l+3)],v[c++]=u<<2|h>>4,v[c++]=(h&15)<<4|m>>2,v[c++]=(m&3)<<6|p&63;return y},VC=typeof ArrayBuffer=="function",yf=(n,t)=>{if(typeof n!="string")return{type:"message",data:s_(n,t)};const i=n.charAt(0);return i==="b"?{type:"message",data:FC(n.substring(1),t)}:uc[i]?n.length>1?{type:uc[i],data:n.substring(1)}:{type:uc[i]}:Lh},FC=(n,t)=>{if(VC){const i=GC(n);return s_(i,t)}else return{base64:!0,data:n}},s_=(n,t)=>t==="blob"?n instanceof Blob?n:new Blob([n]):n instanceof ArrayBuffer?n:n.buffer,a_="",YC=(n,t)=>{const i=n.length,l=new Array(i);let c=0;n.forEach((u,h)=>{gf(u,!1,m=>{l[h]=m,++c===i&&t(l.join(a_))})})},KC=(n,t)=>{const i=n.split(a_),l=[];for(let c=0;c<i.length;c++){const u=yf(i[c],t);if(l.push(u),u.type==="error")break}return l};function XC(){return new TransformStream({transform(n,t){HC(n,i=>{const l=i.length;let c;if(l<126)c=new Uint8Array(1),new DataView(c.buffer).setUint8(0,l);else if(l<65536){c=new Uint8Array(3);const u=new DataView(c.buffer);u.setUint8(0,126),u.setUint16(1,l)}else{c=new Uint8Array(9);const u=new DataView(c.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(l))}n.data&&typeof n.data!="string"&&(c[0]|=128),t.enqueue(c),t.enqueue(i)})}})}let ph;function Xo(n){return n.reduce((t,i)=>t+i.length,0)}function Qo(n,t){if(n[0].length===t)return n.shift();const i=new Uint8Array(t);let l=0;for(let c=0;c<t;c++)i[c]=n[0][l++],l===n[0].length&&(n.shift(),l=0);return n.length&&l<n[0].length&&(n[0]=n[0].slice(l)),i}function QC(n,t){ph||(ph=new TextDecoder);const i=[];let l=0,c=-1,u=!1;return new TransformStream({transform(h,m){for(i.push(h);;){if(l===0){if(Xo(i)<1)break;const p=Qo(i,1);u=(p[0]&128)===128,c=p[0]&127,c<126?l=3:c===126?l=1:l=2}else if(l===1){if(Xo(i)<2)break;const p=Qo(i,2);c=new DataView(p.buffer,p.byteOffset,p.length).getUint16(0),l=3}else if(l===2){if(Xo(i)<8)break;const p=Qo(i,8),y=new DataView(p.buffer,p.byteOffset,p.length),v=y.getUint32(0);if(v>Math.pow(2,21)-1){m.enqueue(Lh);break}c=v*Math.pow(2,32)+y.getUint32(4),l=3}else{if(Xo(i)<c)break;const p=Qo(i,c);m.enqueue(yf(u?p:ph.decode(p),t)),l=0}if(c===0||c>n){m.enqueue(Lh);break}}}})}const r_=4;function Rt(n){if(n)return ZC(n)}function ZC(n){for(var t in Rt.prototype)n[t]=Rt.prototype[t];return n}Rt.prototype.on=Rt.prototype.addEventListener=function(n,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(t),this};Rt.prototype.once=function(n,t){function i(){this.off(n,i),t.apply(this,arguments)}return i.fn=t,this.on(n,i),this};Rt.prototype.off=Rt.prototype.removeListener=Rt.prototype.removeAllListeners=Rt.prototype.removeEventListener=function(n,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+n];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var l,c=0;c<i.length;c++)if(l=i[c],l===t||l.fn===t){i.splice(c,1);break}return i.length===0&&delete this._callbacks["$"+n],this};Rt.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),i=this._callbacks["$"+n],l=1;l<arguments.length;l++)t[l-1]=arguments[l];if(i){i=i.slice(0);for(var l=0,c=i.length;l<c;++l)i[l].apply(this,t)}return this};Rt.prototype.emitReserved=Rt.prototype.emit;Rt.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};Rt.prototype.hasListeners=function(n){return!!this.listeners(n).length};const Rc=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,i)=>i(t,0),qn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),WC="arraybuffer";function i_(n,...t){return t.reduce((i,l)=>(n.hasOwnProperty(l)&&(i[l]=n[l]),i),{})}const JC=qn.setTimeout,eN=qn.clearTimeout;function Dc(n,t){t.useNativeTimers?(n.setTimeoutFn=JC.bind(qn),n.clearTimeoutFn=eN.bind(qn)):(n.setTimeoutFn=qn.setTimeout.bind(qn),n.clearTimeoutFn=qn.clearTimeout.bind(qn))}const tN=1.33;function nN(n){return typeof n=="string"?sN(n):Math.ceil((n.byteLength||n.size)*tN)}function sN(n){let t=0,i=0;for(let l=0,c=n.length;l<c;l++)t=n.charCodeAt(l),t<128?i+=1:t<2048?i+=2:t<55296||t>=57344?i+=3:(l++,i+=4);return i}function l_(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function aN(n){let t="";for(let i in n)n.hasOwnProperty(i)&&(t.length&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(n[i]));return t}function rN(n){let t={},i=n.split("&");for(let l=0,c=i.length;l<c;l++){let u=i[l].split("=");t[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return t}class iN extends Error{constructor(t,i,l){super(t),this.description=i,this.context=l,this.type="TransportError"}}class vf extends Rt{constructor(t){super(),this.writable=!1,Dc(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,i,l){return super.emitReserved("error",new iN(t,i,l)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const i=yf(t,this.socket.binaryType);this.onPacket(i)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,i={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(i)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const i=aN(t);return i.length?"?"+i:""}}class lN extends vf{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const i=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let l=0;this._polling&&(l++,this.once("pollComplete",function(){--l||i()})),this.writable||(l++,this.once("drain",function(){--l||i()}))}else i()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const i=l=>{if(this.readyState==="opening"&&l.type==="open"&&this.onOpen(),l.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(l)};KC(t,this.socket.binaryType).forEach(i),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,YC(t,i=>{this.doWrite(i,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",i=this.query||{};return this.opts.timestampRequests!==!1&&(i[this.opts.timestampParam]=l_()),!this.supportsBinary&&!i.sid&&(i.b64=1),this.createUri(t,i)}}let o_=!1;try{o_=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const oN=o_;function cN(){}class uN extends lN{constructor(t){if(super(t),typeof location<"u"){const i=location.protocol==="https:";let l=location.port;l||(l=i?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||l!==t.port}}doWrite(t,i){const l=this.request({method:"POST",data:t});l.on("success",i),l.on("error",(c,u)=>{this.onError("xhr post error",c,u)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(i,l)=>{this.onError("xhr poll error",i,l)}),this.pollXhr=t}}class hs extends Rt{constructor(t,i,l){super(),this.createRequest=t,Dc(this,l),this._opts=l,this._method=l.method||"GET",this._uri=i,this._data=l.data!==void 0?l.data:null,this._create()}_create(){var t;const i=i_(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;const l=this._xhr=this.createRequest(i);try{l.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){l.setDisableHeaderCheck&&l.setDisableHeaderCheck(!0);for(let c in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(c)&&l.setRequestHeader(c,this._opts.extraHeaders[c])}}catch{}if(this._method==="POST")try{l.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{l.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(l),"withCredentials"in l&&(l.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(l.timeout=this._opts.requestTimeout),l.onreadystatechange=()=>{var c;l.readyState===3&&((c=this._opts.cookieJar)===null||c===void 0||c.parseCookies(l.getResponseHeader("set-cookie"))),l.readyState===4&&(l.status===200||l.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof l.status=="number"?l.status:0)},0))},l.send(this._data)}catch(c){this.setTimeoutFn(()=>{this._onError(c)},0);return}typeof document<"u"&&(this._index=hs.requestsCount++,hs.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=cN,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete hs.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}hs.requestsCount=0;hs.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Fv);else if(typeof addEventListener=="function"){const n="onpagehide"in qn?"pagehide":"unload";addEventListener(n,Fv,!1)}}function Fv(){for(let n in hs.requests)hs.requests.hasOwnProperty(n)&&hs.requests[n].abort()}const dN=(function(){const n=c_({xdomain:!1});return n&&n.responseType!==null})();class hN extends uN{constructor(t){super(t);const i=t&&t.forceBase64;this.supportsBinary=dN&&!i}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new hs(c_,this.uri(),t)}}function c_(n){const t=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||oN))return new XMLHttpRequest}catch{}if(!t)try{return new qn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const u_=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class fN extends vf{get name(){return"websocket"}doOpen(){const t=this.uri(),i=this.opts.protocols,l=u_?{}:i_(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(l.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,i,l)}catch(c){return this.emitReserved("error",c)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let i=0;i<t.length;i++){const l=t[i],c=i===t.length-1;gf(l,this.supportsBinary,u=>{try{this.doWrite(l,u)}catch{}c&&Rc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",i=this.query||{};return this.opts.timestampRequests&&(i[this.opts.timestampParam]=l_()),this.supportsBinary||(i.b64=1),this.createUri(t,i)}}const mh=qn.WebSocket||qn.MozWebSocket;class pN extends fN{createSocket(t,i,l){return u_?new mh(t,i,l):i?new mh(t,i):new mh(t)}doWrite(t,i){this.ws.send(i)}}class mN extends vf{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const i=QC(Number.MAX_SAFE_INTEGER,this.socket.binaryType),l=t.readable.pipeThrough(i).getReader(),c=XC();c.readable.pipeTo(t.writable),this._writer=c.writable.getWriter();const u=()=>{l.read().then(({done:m,value:p})=>{m||(this.onPacket(p),u())}).catch(m=>{})};u();const h={type:"open"};this.query.sid&&(h.data=`{"sid":"${this.query.sid}"}`),this._writer.write(h).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let i=0;i<t.length;i++){const l=t[i],c=i===t.length-1;this._writer.write(l).then(()=>{c&&Rc(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const gN={websocket:pN,webtransport:mN,polling:hN},yN=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vN=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Mh(n){if(n.length>8e3)throw"URI too long";const t=n,i=n.indexOf("["),l=n.indexOf("]");i!=-1&&l!=-1&&(n=n.substring(0,i)+n.substring(i,l).replace(/:/g,";")+n.substring(l,n.length));let c=yN.exec(n||""),u={},h=14;for(;h--;)u[vN[h]]=c[h]||"";return i!=-1&&l!=-1&&(u.source=t,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=xN(u,u.path),u.queryKey=bN(u,u.query),u}function xN(n,t){const i=/\/{2,9}/g,l=t.replace(i,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&l.splice(0,1),t.slice(-1)=="/"&&l.splice(l.length-1,1),l}function bN(n,t){const i={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(l,c,u){c&&(i[c]=u)}),i}const Ih=typeof addEventListener=="function"&&typeof removeEventListener=="function",dc=[];Ih&&addEventListener("offline",()=>{dc.forEach(n=>n())},!1);let d_=class Br extends Rt{constructor(t,i={}){var l,c;if(super(),this.binaryType=WC,this.writeBuffer=[],this._prevBufferLen=0,this._upgrades=[],this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(i=t,t=null),t){const u=Mh(t);i.hostname=u.host,i.secure=u.protocol==="https"||u.protocol==="wss",i.port=u.port,u.query&&(i.query=u.query)}else i.host&&(i.hostname=Mh(i.host).host);if(Dc(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),i.transportImplementations&&i.transports)throw new Error("specifying both 'transportImplementations' and 'transports' options is not supported");i.transportImplementations||!((l=i.transports)===null||l===void 0)&&l.length&&typeof i.transports[0]=="function"?(this.transports=[],this._transportsByName=Object.create(null),((c=i.transportImplementations)!==null&&c!==void 0?c:i.transports).forEach(u=>{const h=u.prototype.name;this.transports.push(h),this._transportsByName[h]=u})):(this.transports=i.transports?[...i.transports]:["polling","websocket","webtransport"],this._transportsByName=gN),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=rN(this.opts.query)),Ih&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},dc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const i=Object.assign({},this.opts.query);i.EIO=r_,i.transport=t,this.id&&(i.sid=this.id);const l=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](l)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Br.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const i=this.createTransport(t);i.open(),this.setTransport(i)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}_probe(t){let i=this.createTransport(t),l=!1;Br.priorWebsocketSuccess=!1;const c=()=>{l||(i.send([{type:"ping",data:"probe"}]),i.once("packet",b=>{if(!l)if(b.type==="pong"&&b.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",i),!i)return;Br.priorWebsocketSuccess=i.name==="websocket",this.transport.pause(()=>{l||this.readyState!=="closed"&&(v(),this.setTransport(i),i.send([{type:"upgrade"}]),this.emitReserved("upgrade",i),i=null,this.upgrading=!1,this.flush())})}else{const x=new Error("probe error");x.transport=i.name,this.emitReserved("upgradeError",x)}}))};function u(){l||(l=!0,v(),i.close(),i=null)}const h=b=>{const x=new Error("probe error: "+b);x.transport=i.name,u(),this.emitReserved("upgradeError",x)};function m(){h("transport closed")}function p(){h("socket closed")}function y(b){i&&b.name!==i.name&&u()}const v=()=>{i.removeListener("open",c),i.removeListener("error",h),i.removeListener("close",m),this.off("close",p),this.off("upgrading",y)};i.once("open",c),i.once("error",h),i.once("close",m),this.once("close",p),this.once("upgrading",y),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{l||i.open()},200):i.open()}onOpen(){if(this.readyState="open",Br.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const i=new Error("server error");i.code=t.data,this._onError(i);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._upgrades=this._filterUpgrades(t.upgrades),this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let l=0;l<this.writeBuffer.length;l++){const c=this.writeBuffer[l].data;if(c&&(i+=nN(c)),l>0&&i>this._maxPayload)return this.writeBuffer.slice(0,l);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Rc(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,i,l){return this._sendPacket("message",t,i,l),this}send(t,i,l){return this._sendPacket("message",t,i,l),this}_sendPacket(t,i,l,c){if(typeof i=="function"&&(c=i,i=void 0),typeof l=="function"&&(c=l,l=null),this.readyState==="closing"||this.readyState==="closed")return;l=l||{},l.compress=l.compress!==!1;const u={type:t,data:i,options:l};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),c&&this.once("flush",c),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),t()},l=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?l():t()}):this.upgrading?l():t()),this}_onError(t){if(Br.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Ih&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const l=dc.indexOf(this._offlineEventListener);l!==-1&&dc.splice(l,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,i),this.writeBuffer=[],this._prevBufferLen=0}}_filterUpgrades(t){const i=[];for(let l=0;l<t.length;l++)~this.transports.indexOf(t[l])&&i.push(t[l]);return i}};d_.protocol=r_;function _N(n,t="",i){let l=n;i=i||typeof location<"u"&&location,n==null&&(n=i.protocol+"//"+i.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=i.protocol+n:n=i.host+n),/^(https?|wss?):\/\//.test(n)||(typeof i<"u"?n=i.protocol+"//"+n:n="https://"+n),l=Mh(n)),l.port||(/^(http|ws)$/.test(l.protocol)?l.port="80":/^(http|ws)s$/.test(l.protocol)&&(l.port="443")),l.path=l.path||"/";const u=l.host.indexOf(":")!==-1?"["+l.host+"]":l.host;return l.id=l.protocol+"://"+u+":"+l.port+t,l.href=l.protocol+"://"+u+(i&&i.port===l.port?"":":"+l.port),l}const SN=typeof ArrayBuffer=="function",jN=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,h_=Object.prototype.toString,TN=typeof Blob=="function"||typeof Blob<"u"&&h_.call(Blob)==="[object BlobConstructor]",wN=typeof File=="function"||typeof File<"u"&&h_.call(File)==="[object FileConstructor]";function xf(n){return SN&&(n instanceof ArrayBuffer||jN(n))||TN&&n instanceof Blob||wN&&n instanceof File}function hc(n,t){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let i=0,l=n.length;i<l;i++)if(hc(n[i]))return!0;return!1}if(xf(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return hc(n.toJSON(),!0);for(const i in n)if(Object.prototype.hasOwnProperty.call(n,i)&&hc(n[i]))return!0;return!1}function kN(n){const t=[],i=n.data,l=n;return l.data=fc(i,t),l.attachments=t.length,{packet:l,buffers:t}}function fc(n,t,i){if(!n)return n;if(xf(n)){const l={_placeholder:!0,num:t.length};return t.push(n),l}else if(Array.isArray(n)){const l=new Array(n.length);for(let c=0;c<n.length;c++)l[c]=fc(n[c],t);return l}else if(typeof n=="object"&&!(n instanceof Date)){if(n.toJSON&&typeof n.toJSON=="function"&&!i)return fc(n.toJSON(),t,!0);const l={};for(const c in n)Object.prototype.hasOwnProperty.call(n,c)&&(l[c]=fc(n[c],t));return l}return n}function EN(n,t){return n.data=qh(n.data,t),delete n.attachments,n}function qh(n,t){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<t.length)return t[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let i=0;i<n.length;i++)n[i]=qh(n[i],t);else if(typeof n=="object")for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(n[i]=qh(n[i],t));return n}const CN=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ve;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(Ve||(Ve={}));class NN{constructor(t){this.replacer=t}encode(t){return(t.type===Ve.EVENT||t.type===Ve.ACK)&&hc(t)?this.encodeAsBinary({type:t.type===Ve.EVENT?Ve.BINARY_EVENT:Ve.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let i=""+t.type;return(t.type===Ve.BINARY_EVENT||t.type===Ve.BINARY_ACK)&&(i+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(i+=t.nsp+","),t.id!=null&&(i+=t.id),t.data!=null&&(i+=JSON.stringify(t.data,this.replacer)),i}encodeAsBinary(t){const i=kN(t),l=this.encodeAsString(i.packet),c=i.buffers;return c.unshift(l),c}}class bf extends Rt{constructor(t){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof t=="function"?{reviver:t}:t)}add(t){let i;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");i=this.decodeString(t);const l=i.type===Ve.BINARY_EVENT;l||i.type===Ve.BINARY_ACK?(i.type=l?Ve.EVENT:Ve.ACK,this.reconstructor=new AN(i)):super.emitReserved("decoded",i)}else if(xf(t)||t.base64)if(this.reconstructor)i=this.reconstructor.takeBinaryData(t),i&&(this.reconstructor=null,super.emitReserved("decoded",i));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let i=0;const l={type:Number(t.charAt(0))};if(Ve[l.type]===void 0)throw new Error("unknown packet type "+l.type);if(l.type===Ve.BINARY_EVENT||l.type===Ve.BINARY_ACK){const u=i+1;for(;t.charAt(++i)!=="-"&&i!=t.length;);const h=t.substring(u,i);if(h!=Number(h)||t.charAt(i)!=="-")throw new Error("Illegal attachments");const m=Number(h);if(!RN(m)||m<1)throw new Error("Illegal attachments");if(m>this.opts.maxAttachments)throw new Error("too many attachments");l.attachments=m}if(t.charAt(i+1)==="/"){const u=i+1;for(;++i&&!(t.charAt(i)===","||i===t.length););l.nsp=t.substring(u,i)}else l.nsp="/";const c=t.charAt(i+1);if(c!==""&&Number(c)==c){const u=i+1;for(;++i;){const h=t.charAt(i);if(h==null||Number(h)!=h){--i;break}if(i===t.length)break}l.id=Number(t.substring(u,i+1))}if(t.charAt(++i)){const u=this.tryParse(t.substr(i));if(bf.isPayloadValid(l.type,u))l.data=u;else throw new Error("invalid payload")}return l}tryParse(t){try{return JSON.parse(t,this.opts.reviver)}catch{return!1}}static isPayloadValid(t,i){switch(t){case Ve.CONNECT:return Yv(i);case Ve.DISCONNECT:return i===void 0;case Ve.CONNECT_ERROR:return typeof i=="string"||Yv(i);case Ve.EVENT:case Ve.BINARY_EVENT:return Array.isArray(i)&&(typeof i[0]=="number"||typeof i[0]=="string"&&CN.indexOf(i[0])===-1);case Ve.ACK:case Ve.BINARY_ACK:return Array.isArray(i)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class AN{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const i=EN(this.reconPack,this.buffers);return this.finishedReconstruction(),i}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const RN=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function Yv(n){return Object.prototype.toString.call(n)==="[object Object]"}const DN=Object.freeze(Object.defineProperty({__proto__:null,Decoder:bf,Encoder:NN,get PacketType(){return Ve}},Symbol.toStringTag,{value:"Module"}));function Qn(n,t,i){return n.on(t,i),function(){n.off(t,i)}}const ON=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class f_ extends Rt{constructor(t,i,l){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=i,l&&l.auth&&(this.auth=l.auth),this._opts=Object.assign({},l),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Qn(t,"open",this.onopen.bind(this)),Qn(t,"packet",this.onpacket.bind(this)),Qn(t,"error",this.onerror.bind(this)),Qn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...i){var l,c,u;if(ON.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(i.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(i),this;const h={type:Ve.EVENT,data:i};if(h.options={},h.options.compress=this.flags.compress!==!1,typeof i[i.length-1]=="function"){const v=this.ids++,b=i.pop();this._registerAckCallback(v,b),h.id=v}const m=(c=(l=this.io.engine)===null||l===void 0?void 0:l.transport)===null||c===void 0?void 0:c.writable,p=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!m||(p?(this.notifyOutgoingListeners(h),this.packet(h)):this.sendBuffer.push(h)),this.flags={},this}_registerAckCallback(t,i){var l;const c=(l=this.flags.timeout)!==null&&l!==void 0?l:this._opts.ackTimeout;if(c===void 0){this.acks[t]=i;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let m=0;m<this.sendBuffer.length;m++)this.sendBuffer[m].id===t&&this.sendBuffer.splice(m,1);i.call(this,new Error("operation has timed out"))},c),h=(...m)=>{this.io.clearTimeoutFn(u),i.apply(this,m)};h.withError=!0,this.acks[t]=h}emitWithAck(t,...i){return new Promise((l,c)=>{const u=(h,m)=>h?c(h):l(m);u.withError=!0,i.push(u),this.emit(t,...i)})}_addToQueue(t){let i;typeof t[t.length-1]=="function"&&(i=t.pop());const l={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((c,...u)=>(this._queue[0],c!==null?l.tryCount>this._opts.retries&&(this._queue.shift(),i&&i(c)):(this._queue.shift(),i&&i(null,...u)),l.pending=!1,this._drainQueue())),this._queue.push(l),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const i=this._queue[0];i.pending&&!t||(i.pending=!0,i.tryCount++,this.flags=i.flags,this.emit.apply(this,i.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ve.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,i){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,i),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(l=>String(l.id)===t)){const l=this.acks[t];delete this.acks[t],l.withError&&l.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ve.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ve.EVENT:case Ve.BINARY_EVENT:this.onevent(t);break;case Ve.ACK:case Ve.BINARY_ACK:this.onack(t);break;case Ve.DISCONNECT:this.ondisconnect();break;case Ve.CONNECT_ERROR:this.destroy();const l=new Error(t.data.message);l.data=t.data.data,this.emitReserved("connect_error",l);break}}onevent(t){const i=t.data||[];t.id!=null&&i.push(this.ack(t.id)),this.connected?this.emitEvent(i):this.receiveBuffer.push(Object.freeze(i))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const i=this._anyListeners.slice();for(const l of i)l.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const i=this;let l=!1;return function(...c){l||(l=!0,i.packet({type:Ve.ACK,id:t,data:c}))}}onack(t){const i=this.acks[t.id];typeof i=="function"&&(delete this.acks[t.id],i.withError&&t.data.unshift(null),i.apply(this,t.data))}onconnect(t,i){this.id=t,this.recovered=i&&this._pid===i,this._pid=i,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ve.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const i=this._anyListeners;for(let l=0;l<i.length;l++)if(t===i[l])return i.splice(l,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const i=this._anyOutgoingListeners;for(let l=0;l<i.length;l++)if(t===i[l])return i.splice(l,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const i=this._anyOutgoingListeners.slice();for(const l of i)l.apply(this,t.data)}}}function ti(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}ti.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),i=Math.floor(t*this.jitter*n);n=(Math.floor(t*10)&1)==0?n-i:n+i}return Math.min(n,this.max)|0};ti.prototype.reset=function(){this.attempts=0};ti.prototype.setMin=function(n){this.ms=n};ti.prototype.setMax=function(n){this.max=n};ti.prototype.setJitter=function(n){this.jitter=n};class Uh extends Rt{constructor(t,i){var l;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(i=t,t=void 0),i=i||{},i.path=i.path||"/socket.io",this.opts=i,Dc(this,i),this.reconnection(i.reconnection!==!1),this.reconnectionAttempts(i.reconnectionAttempts||1/0),this.reconnectionDelay(i.reconnectionDelay||1e3),this.reconnectionDelayMax(i.reconnectionDelayMax||5e3),this.randomizationFactor((l=i.randomizationFactor)!==null&&l!==void 0?l:.5),this.backoff=new ti({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(i.timeout==null?2e4:i.timeout),this._readyState="closed",this.uri=t;const c=i.parser||DN;this.encoder=new c.Encoder,this.decoder=new c.Decoder,this._autoConnect=i.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var i;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(i=this.backoff)===null||i===void 0||i.setMin(t),this)}randomizationFactor(t){var i;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(i=this.backoff)===null||i===void 0||i.setJitter(t),this)}reconnectionDelayMax(t){var i;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(i=this.backoff)===null||i===void 0||i.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new d_(this.uri,this.opts);const i=this.engine,l=this;this._readyState="opening",this.skipReconnect=!1;const c=Qn(i,"open",function(){l.onopen(),t&&t()}),u=m=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",m),t?t(m):this.maybeReconnectOnOpen()},h=Qn(i,"error",u);if(this._timeout!==!1){const m=this._timeout,p=this.setTimeoutFn(()=>{c(),u(new Error("timeout")),i.close()},m);this.opts.autoUnref&&p.unref(),this.subs.push(()=>{this.clearTimeoutFn(p)})}return this.subs.push(c),this.subs.push(h),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Qn(t,"ping",this.onping.bind(this)),Qn(t,"data",this.ondata.bind(this)),Qn(t,"error",this.onerror.bind(this)),Qn(t,"close",this.onclose.bind(this)),Qn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(i){this.onclose("parse error",i)}}ondecoded(t){Rc(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,i){let l=this.nsps[t];return l?this._autoConnect&&!l.active&&l.connect():(l=new f_(this,t,i),this.nsps[t]=l),l}_destroy(t){const i=Object.keys(this.nsps);for(const l of i)if(this.nsps[l].active)return;this._close()}_packet(t){const i=this.encoder.encode(t);for(let l=0;l<i.length;l++)this.engine.write(i[l],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,i){var l;this.cleanup(),(l=this.engine)===null||l===void 0||l.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,i),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const i=this.backoff.duration();this._reconnecting=!0;const l=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(c=>{c?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",c)):t.onreconnect()}))},i);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const nl={};function $n(n,t){typeof n=="object"&&(t=n,n=void 0),t=t||{};const i=_N(n,t.path||"/socket.io"),l=i.source,c=i.id,u=i.path,h=nl[c]&&u in nl[c].nsps,m=t.forceNew||t["force new connection"]||t.multiplex===!1||h;let p;return m?p=new Uh(l,t):(nl[c]||(nl[c]=new Uh(l,t)),p=nl[c]),i.query&&!t.query&&(t.query=i.queryKey),p.socket(i.path,t)}Object.assign($n,{Manager:Uh,Socket:f_,io:$n,connect:$n});const _n={TASK_CREATED:"task.created",TASK_UPDATED:"task.updated",TASK_DELETED:"task.deleted",TASK_ASSIGNED:"task.assigned",TASK_STATUS_CHANGED:"task.status_changed",TASK_COMMENTED:"task.commented",INPUT_REQUEST_ANSWERED:"input.request.answered",TASK_ACTIVITY:"task.activity"},Fr={THREAD_UPDATED:"thread.updated",THREAD_TITLE_UPDATED:"thread.title.updated",MESSAGE_CREATED:"thread.message.created",AGENT_ACTIVITY:"thread.agent.activity",AGENT_RESPONSE_DELTA:"thread.agent.response.delta"};var xc;(function(n){n.HUMAN="human",n.AGENT="agent"})(xc||(xc={}));const zN={WORKER_SEEN:"worker.seen"},LN=window.location.origin,p_=new ns({baseUrl:LN,credentials:"include"}),MN=p_.workers;p_.workers;const IN=va("/workers");function _f(){const[n,t]=d.useState([]),[i,l]=d.useState(!0),[c,u]=d.useState(null),[h,m]=d.useState(!1),p=v=>[...v].sort((b,x)=>{const _=new Date(b.lastSeenAt).getTime();return new Date(x.lastSeenAt).getTime()-_}),y=async()=>{try{l(!0),u(null);const v=await MN.WorkersController_listWorkers();t(p(v))}catch(v){console.error("Error fetching workers:",v),u(v instanceof Error?v.message:"Failed to load workers")}finally{l(!1)}};return d.useEffect(()=>{const v=$n(IN,{withCredentials:!0,transports:["websocket","polling"]});return y(),v.on("connect",()=>{v.emit("workers.subscribe",{},b=>{if(b.ok){m(!0);return}m(!1)}),y()}),v.on("disconnect",()=>{m(!1)}),v.on("connect_error",b=>{console.error("Workers WebSocket connection error:",b)}),v.on(zN.WORKER_SEEN,b=>{t(x=>{const _=x.findIndex(k=>k.id===b.worker.id);if(_>=0){const k=[...x];return k[_]=b.worker,p(k)}return p([...x,b.worker])})}),()=>{v.emit("workers.unsubscribe",{}),v.disconnect()}},[]),{workers:n,isLoading:i,error:c,isConnected:h}}function m_({preview:n,size:t="compact"}){const i={"--theme-preview-bg":n.background,"--theme-preview-surface":n.surface,"--theme-preview-card":n.card,"--theme-preview-border":n.border,"--theme-preview-text":n.text,"--theme-preview-muted":n.muted,"--theme-preview-accent":n.accent,"--theme-preview-accent-soft":n.accentSoft};return a.jsx("span",{className:`settings-theme-visual settings-theme-visual--${t}`,style:i,"aria-hidden":"true",children:a.jsxs("span",{className:"settings-theme-visual__window",children:[a.jsxs("span",{className:"settings-theme-visual__rail",children:[a.jsx("span",{className:"settings-theme-visual__accent-dot"}),a.jsx("span",{className:"settings-theme-visual__rail-line"}),a.jsx("span",{className:"settings-theme-visual__rail-line settings-theme-visual__rail-line--short"})]}),a.jsxs("span",{className:"settings-theme-visual__canvas",children:[a.jsx("span",{className:"settings-theme-visual__font",children:n.font==="Mono"?"Aa":"Ag"}),a.jsx("span",{className:"settings-theme-visual__line settings-theme-visual__line--wide"}),a.jsxs("span",{className:"settings-theme-visual__panel",children:[a.jsx("span",{className:"settings-theme-visual__chip"}),a.jsx("span",{className:"settings-theme-visual__line"}),a.jsx("span",{className:"settings-theme-visual__line settings-theme-visual__line--short"})]}),a.jsx("span",{className:"settings-theme-visual__button"})]})]})})}const g_=[{value:"light",label:"Light",description:"Clean light theme with a crisp blue accent.",preview:{background:"#ffffff",surface:"#f6f8fa",card:"#ffffff",border:"#d1d9e0",text:"#1f2328",muted:"#59636e",accent:"#0969da",accentSoft:"#ddf4ff",font:"Inter"}},{value:"dark",label:"Dark",description:"Low-light surfaces with GitHub-style blue highlights.",preview:{background:"#0d1117",surface:"#161b22",card:"#0d1117",border:"#30363d",text:"#e6edf3",muted:"#8b949e",accent:"#2f81f7",accentSoft:"#1f6feb33",font:"Inter"}},{value:"clarity",label:"Clarity",description:"Soft neutral surfaces for focused daytime work.",preview:{background:"#f7f7f5",surface:"#f2f4f7",card:"#ffffff",border:"#d9dee5",text:"#1f2328",muted:"#66707a",accent:"#3971d9",accentSoft:"#e5efff",font:"Inter"}},{value:"github",label:"GitHub",description:"GitHub-inspired neutrals with a green action color.",preview:{background:"#ffffff",surface:"#f6f8fa",card:"#ffffff",border:"#d0d7de",text:"#24292f",muted:"#57606a",accent:"#1f883d",accentSoft:"#dafbe1",font:"Inter"}},{value:"forest",label:"Forest",description:"Dark green workspace with softer natural contrast.",preview:{background:"#0f1a0f",surface:"#152615",card:"#102010",border:"#2d4a2d",text:"#e8f5e8",muted:"#9bb89b",accent:"#52c952",accentSoft:"#1f4d2a",font:"Inter"}},{value:"terminal",label:"Terminal",description:"Classic terminal green on a black interface.",preview:{background:"#000000",surface:"#0a0a0a",card:"#050505",border:"#00aa00",text:"#00ff00",muted:"#00aa00",accent:"#00dd00",accentSoft:"#003b00",font:"Mono"}},{value:"ai-vibes",label:"AI Vibes",description:"Deep purples with neon-like accents.",preview:{background:"#0c0716",surface:"#1a102b",card:"#130b21",border:"#3b255f",text:"#f5efff",muted:"#c4b5db",accent:"#a855f7",accentSoft:"#3b1762",font:"Inter"}},{value:"halo",label:"Halo",description:"Light background with cooler layered surfaces.",preview:{background:"#f9f9fc",surface:"#eef1f9",card:"#ffffff",border:"#d8deef",text:"#1f2937",muted:"#667085",accent:"#3b5bcc",accentSoft:"#e6ebff",font:"Inter"}},{value:"kindling",label:"Kindling",description:"Black and white minimalism inspired by e-reader focus.",preview:{background:"#ffffff",surface:"#f5f5f5",card:"#ffffff",border:"#d4d4d4",text:"#111111",muted:"#666666",accent:"#111111",accentSoft:"#eeeeee",font:"Inter"}},{value:"terminal-amber",label:"Terminal Amber",description:"Warm terminal tones with a calm blue accent.",preview:{background:"#0b0a09",surface:"#17130d",card:"#120f0b",border:"#3a2d16",text:"#f5d78e",muted:"#b9975b",accent:"#8ab4f8",accentSoft:"#1d2740",font:"Mono"}},{value:"oceanic",label:"Oceanic",description:"Cool blues and teals for a calmer dark theme.",preview:{background:"#0c1b2a",surface:"#102a3d",card:"#0f2233",border:"#1d4a5f",text:"#e6fffb",muted:"#9bd5d0",accent:"#4fd1c5",accentSoft:"#123c47",font:"Inter"}},{value:"party",label:"Party",description:"Playful warm palette with saturated highlights.",preview:{background:"#fff7f0",surface:"#fff0e0",card:"#ffffff",border:"#ffd4d4",text:"#2d1b1b",muted:"#7a5a5a",accent:"#ff6b6b",accentSoft:"#ffe3df",font:"Inter"}},{value:"tribute",label:"Tribute",description:"Dark sidebar energy inspired by the previous UI.",preview:{background:"#0b1220",surface:"#111827",card:"#0f172a",border:"#1e293b",text:"#e5e7eb",muted:"#94a3b8",accent:"#2563eb",accentSoft:"#172554",font:"Inter"}}];function qN(){const{setSectionTitle:n}=Tn(),t=Dt(),i=De(),{registerCommands:l}=Tl(),{theme:c,setTheme:u}=nb(),{workers:h,isLoading:m}=_f(),[p,y]=d.useState(null),[v,b]=d.useState({projects:null,conversationModel:null});vt(),d.useEffect(()=>{n("Settings"),x(),_()},[]);const x=async()=>{try{const w=await rb.metaControllerGetVersion();y(w)}catch(w){console.error("Failed to load version:",w)}},_=async()=>{const[w,E]=await Promise.allSettled([yc.projectsControllerGetAllProjects(),hl.aiModelSelectionsControllerListAiModelSelections()]);b({projects:w.status==="fulfilled"?w.value.length:null,conversationModel:E.status==="fulfilled"?E.value.find(R=>R.job==="conversation"&&R.isReady)?.effectiveModelId??null:null})};d.useEffect(()=>l([{id:"settings-account",label:"Account Settings",description:"Manage your account security",aliases:["password","account","security"],onSelect:()=>i("/settings/account")},{id:"settings-appearance",label:"Appearance Settings",description:"Choose your preferred color theme",aliases:["theme","appearance","dark mode","light mode"],onSelect:()=>i("/settings/appearance")},{id:"settings-projects",label:"Projects Settings",description:"Manage your projects",aliases:["projects","manage projects"],onSelect:()=>i("/settings/projects")},{id:"settings-models",label:"AI Models",description:"Connect AI providers and pick a model for each job",aliases:["chat","models","openai","anthropic","providers","ai providers","embeddings"],onSelect:()=>i("/settings/models")},{id:"settings-workers",label:"Workers Settings",description:"Configure and manage background workers",aliases:["workers","background","execution"],onSelect:()=>i("/settings/workers")},{id:"settings-ai-usage",label:"AI Usage",description:"View usage and quota for AI providers",aliases:["ai","usage","quota","anthropic","openai","claude"],onSelect:()=>i("/settings/ai-usage")},{id:"settings-data",label:"Import / Export",description:"Import and export workspace data",aliases:["data","export","import","backup","restore"],onSelect:()=>i("/settings/data")},{id:"settings-users",label:"User Management",description:"Invite users and manage access",aliases:["users","user management","admin","accounts"],onSelect:()=>i("/settings/users")}]),[l,i]);const k=h.filter(w=>{const E=new Date(w.lastSeenAt);return Date.now()-E.getTime()<=120*1e3}).length,T=[{title:"Appearance",description:"Theme and visual preferences for Taico.",icon:C1,iconTone:"accent",path:"/settings/appearance",action:"More themes",detail:{label:"Current theme",value:UN(c),tone:"default"},preview:a.jsx(BN,{activeTheme:c,onSelect:w=>u(w)})},{title:"Projects",description:"Project metadata and repository links.",icon:zh,iconTone:"accent",path:"/settings/projects",action:"Manage",detail:{label:"Projects",value:v.projects===null?"Unavailable":String(v.projects),tone:"default"}},{title:"AI models",description:"AI providers and the model each job uses.",icon:B1,iconTone:"warning",path:"/settings/models",action:"Configure",detail:{label:"Conversation model",value:v.conversationModel??"Not selected",tone:v.conversationModel?"default":"muted"}},{title:"Workers",description:"Background execution workers and harness health.",icon:$v,iconTone:"green",path:"/settings/workers",action:"Open workers",detail:{label:"Connected workers",value:m?"Loading":String(k),tone:"default"}},{title:"Account",description:"Password and account-level access controls.",icon:b1,iconTone:"red",path:"/settings/account",action:"Security",detail:{label:"Password",value:"Change available",tone:"default"}},{title:"Users",description:"Invite people, reset passwords, and disable access.",icon:V1,iconTone:"accent",path:"/settings/users",action:"Manage users",detail:{label:"Access",value:"Admin only",tone:"default"}},{title:"Data",description:"Import and export workspace context blocks.",icon:ZE,iconTone:"neutral",path:"/settings/data",action:"Import / export",detail:{label:"Export",value:"Context blocks",tone:"default"}}];return a.jsxs("div",{className:"settings-page",children:[t?a.jsx(S,{tone:"muted",children:"Manage your workspace, execution, providers, and data."}):null,a.jsxs("div",{className:"settings-page__layout",children:[a.jsxs("main",{className:"settings-page__main","aria-label":"Settings sections",children:[a.jsxs("div",{className:"settings-page__nav","aria-label":"Settings shortcuts",children:[a.jsxs("button",{className:"settings-page__nav-item",type:"button",onClick:()=>i("/settings"),"aria-current":"page",children:[a.jsx(Fb,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),a.jsx("span",{children:"Overview"})]}),T.slice(0,4).map(w=>{const E=w.icon;return a.jsxs("button",{className:"settings-page__nav-item",type:"button",onClick:()=>i(w.path),children:[a.jsx(E,{size:16,strokeWidth:1.8,"aria-hidden":"true"}),a.jsx("span",{children:w.title})]},w.title)})]}),a.jsx("div",{className:"settings-page__section-grid",children:T.map(w=>{const E=w.icon;return a.jsxs(Ye,{padding:"0",className:`settings-page__section-card ${w.preview?"settings-page__section-card--with-carousel":""}`,children:[a.jsxs("div",{className:"settings-page__section-header",children:[a.jsx("span",{className:`settings-page__section-icon settings-page__section-icon--${w.iconTone}`,children:a.jsx(E,{size:22,strokeWidth:1.8,"aria-hidden":"true"})}),a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"3",weight:"semibold",children:w.title}),a.jsx(S,{size:"1",tone:"muted",children:w.description})]})]}),w.preview??a.jsxs("div",{className:"settings-page__detail",children:[a.jsx(S,{size:"1",tone:"muted",children:w.detail.label}),a.jsx(S,{size:"2",weight:"medium",tone:w.detail.tone,children:w.detail.value})]}),a.jsxs(ce,{variant:"secondary",size:"sm",fullWidth:!0,onClick:()=>i(w.path),className:"settings-page__section-action",children:[a.jsx("span",{children:w.action}),a.jsx(Hb,{size:16,strokeWidth:1.8,"aria-hidden":"true"})]})]},w.title)})})]}),a.jsxs("aside",{className:"settings-page__side","aria-label":"Settings status",children:[a.jsx(Ye,{padding:"4",className:"settings-page__side-card",children:a.jsxs(ee,{spacing:"4",children:[a.jsx(S,{size:"3",weight:"semibold",children:"Readiness"}),a.jsx(gh,{icon:a.jsx(KE,{size:16,strokeWidth:1.8}),label:"Conversation model",value:v.conversationModel??"Needs a model",isReady:!!v.conversationModel}),a.jsx(gh,{icon:a.jsx($v,{size:16,strokeWidth:1.8}),label:"Worker connection",value:m?"Checking":k>0?`${k} online`:"No workers online",isReady:k>0}),a.jsx(gh,{icon:a.jsx(zh,{size:16,strokeWidth:1.8}),label:"Projects",value:v.projects===null?"Checking":`${v.projects} available`,isReady:(v.projects??0)>0})]})}),a.jsx(Ye,{padding:"4",className:"settings-page__side-card",children:a.jsxs(ee,{spacing:"3",children:[a.jsx(S,{size:"3",weight:"semibold",children:"Quick links"}),a.jsx(Zo,{icon:a.jsx($b,{size:16}),label:"AI usage",onClick:()=>i("/settings/ai-usage")}),a.jsx(Zo,{icon:a.jsx(g1,{size:16}),label:"AI providers",onClick:()=>i("/settings/models")}),a.jsx(Zo,{icon:a.jsx(PE,{size:16}),label:"Setup walkthrough",onClick:()=>i("/walkthrough")}),a.jsx(Zo,{icon:a.jsx(JE,{size:16}),label:"Tools",onClick:()=>i("/tools")})]})}),p?a.jsxs(S,{size:"1",tone:"muted",className:"settings-page__version",children:["Taico v",p.backend," · UI v",p.ui]}):null]})]})]})}function UN(n){return n.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function BN({activeTheme:n,onSelect:t}){return a.jsx("div",{className:"settings-page__theme-carousel","aria-label":"Theme preview selector",children:g_.map(i=>{const l=n===i.value;return a.jsxs("button",{type:"button",className:`settings-page__theme-preview ${l?"settings-page__theme-preview--active":""}`,onClick:()=>t(i.value),"aria-pressed":l,children:[a.jsx(m_,{preview:i.preview}),a.jsxs("span",{className:"settings-page__theme-preview-copy",children:[a.jsx("span",{children:i.label}),a.jsx("span",{children:i.preview.font})]})]},i.value)})})}function gh({icon:n,label:t,value:i,isReady:l}){return a.jsxs("div",{className:"settings-page__status-row",children:[a.jsx("span",{className:`settings-page__status-icon ${l?"settings-page__status-icon--ready":""}`,children:n}),a.jsxs("div",{children:[a.jsx(S,{size:"2",weight:"medium",children:t}),a.jsx(S,{size:"1",tone:"muted",children:i})]})]})}function Zo({icon:n,label:t,onClick:i}){return a.jsxs("button",{className:"settings-page__quick-link",type:"button",onClick:i,children:[a.jsx("span",{className:"settings-page__quick-link-icon","aria-hidden":"true",children:n}),a.jsx("span",{children:t}),a.jsx(Hb,{size:15,strokeWidth:1.8,"aria-hidden":"true"})]})}function $N(){const{setSectionTitle:n}=Tn(),{logout:t}=un(),i=De(),[l,c]=d.useState(""),[u,h]=d.useState(""),[m,p]=d.useState(""),[y,v]=d.useState(""),[b,x]=d.useState(!1);d.useEffect(()=>{n("Account")},[]);const _=async k=>{k.preventDefault(),p(""),v(""),x(!0);try{await tn.webAuthControllerChangePassword({currentPassword:l,newPassword:u}),v("Password changed successfully! You will be logged out."),c(""),h(""),setTimeout(async()=>{await t(),i("/login")},2e3)}catch(T){p(T?.body?.detail||"Failed to change password. Please check your current password.")}finally{x(!1)}};return a.jsxs(ee,{spacing:"6",className:"settings-subpage",children:[a.jsx(S,{tone:"muted",className:"settings-subpage__intro",children:"Update the password used to sign in to this Taico instance."}),a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"4",weight:"semibold",children:"Change Password"}),a.jsx(S,{tone:"muted",children:"Update your account password"})]}),a.jsx("form",{onSubmit:_,children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"current-password",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Current Password"})}),a.jsx("input",{id:"current-password",type:"password",value:l,onChange:k=>c(k.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:b,autoComplete:"current-password"})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"new-password",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"New Password"})}),a.jsx("input",{id:"new-password",type:"password",value:u,onChange:k=>h(k.target.value),className:"login-input",placeholder:"••••••••",required:!0,disabled:b,autoComplete:"new-password"})]}),m&&a.jsx(Zt,{size:"2",weight:"medium",children:m}),y&&a.jsx("div",{style:{color:"var(--accent)"},children:a.jsx(S,{size:"2",weight:"medium",children:y})}),a.jsx(ce,{type:"submit",variant:"primary",size:"md",disabled:b||!l||!u,children:b?"Changing Password...":"Change Password"})]})})]})})]})}function PN(){const{theme:n,setTheme:t}=nb(),{setSectionTitle:i}=Tn();return d.useEffect(()=>{i("Appearance")},[]),a.jsxs(ee,{spacing:"6",className:"settings-subpage settings-subpage--wide",children:[a.jsx(S,{tone:"muted",className:"settings-subpage__intro",children:"Choose the visual style used across Taico."}),a.jsx("div",{className:"settings-theme-grid","aria-label":"Theme choices",children:g_.map(l=>{const c=n===l.value;return a.jsxs("button",{type:"button",className:`settings-theme-card ${c?"settings-theme-card--active":""}`,onClick:()=>t(l.value),"aria-pressed":c,children:[a.jsx(m_,{preview:l.preview,size:"large"}),a.jsxs("span",{className:"settings-theme-card__body",children:[a.jsxs("span",{className:"settings-theme-card__header",children:[a.jsx("span",{className:"settings-theme-card__title",children:l.label}),a.jsx("span",{className:"settings-theme-card__badge",children:c?"Active":l.preview.font})]}),a.jsx("span",{className:"settings-theme-card__description",children:l.description}),a.jsxs("span",{className:"settings-theme-card__palette","aria-hidden":"true",children:[a.jsx("span",{style:{backgroundColor:l.preview.background}}),a.jsx("span",{style:{backgroundColor:l.preview.surface}}),a.jsx("span",{style:{backgroundColor:l.preview.card}}),a.jsx("span",{style:{backgroundColor:l.preview.accent}})]})]})]},l.value)})})]})}function HN(){const{setSectionTitle:n}=Tn(),t=De(),[i,l]=d.useState([]),[c,u]=d.useState(!0),[h,m]=d.useState(""),[p,y]=d.useState(null),[v,b]=d.useState(""),[x,_]=d.useState(""),[k,T]=d.useState(""),[w,E]=d.useState("");d.useEffect(()=>{n("Projects"),R()},[]);const R=async()=>{u(!0),m("");try{const A=await yc.projectsControllerGetAllProjects();l(A)}catch(A){m(A?.body?.detail||"Failed to load projects")}finally{u(!1)}},D=A=>{y(A.id),b(A.description||""),_(A.repoUrl||""),T(""),E("")},O=()=>{y(null),b(""),_(""),T(""),E("")},z=async A=>{T(""),E("");try{await yc.projectsControllerUpdateProject(A,{description:v,repoUrl:x}),E("Project updated successfully!"),y(null),await R(),setTimeout(()=>{E("")},3e3)}catch(C){T(C?.body?.detail||"Failed to update project")}};return c?a.jsx(ee,{spacing:"6",className:"settings-subpage",children:a.jsx(S,{tone:"muted",children:"Loading projects..."})}):h?a.jsxs(ee,{spacing:"6",className:"settings-subpage",children:[a.jsx(Zt,{children:h}),a.jsx(ce,{variant:"secondary",onClick:R,children:"Retry"})]}):a.jsxs(ee,{spacing:"6",className:"settings-subpage",children:[a.jsx(S,{tone:"muted",className:"settings-subpage__intro",children:"Manage project metadata and repository links used by task workflows."}),a.jsxs(yt,{justify:"space-between",align:"center",className:"settings-projects__toolbar",children:[a.jsx(S,{size:"3",weight:"semibold",children:"Projects"}),a.jsx(ce,{variant:"primary",size:"sm",onClick:()=>t("/settings/projects/new"),children:"New project"})]}),i.length===0?a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"3",children:[a.jsx(S,{tone:"muted",children:"No projects found"}),a.jsx(yt,{children:a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>t("/settings/projects/new"),children:"Create project"})})]})}):i.map(A=>a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"4",weight:"semibold",children:A.slug}),a.jsxs(S,{size:"2",tone:"muted",children:["Tag: ",A.tagName]})]}),p===A.id?a.jsx("form",{onSubmit:C=>{C.preventDefault(),z(A.id)},children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:`description-${A.id}`,className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Description"})}),a.jsx("textarea",{id:`description-${A.id}`,value:v,onChange:C=>b(C.target.value),className:"login-input",placeholder:"Project description",rows:3,style:{resize:"vertical",fontFamily:"inherit"}})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:`repo-url-${A.id}`,className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Repository URL"})}),a.jsx("input",{id:`repo-url-${A.id}`,type:"url",value:x,onChange:C=>_(C.target.value),className:"login-input",placeholder:"https://github.com/username/repo"})]}),k&&a.jsx(Zt,{size:"2",weight:"medium",children:k}),w&&a.jsx("div",{style:{color:"var(--accent)"},children:a.jsx(S,{size:"2",weight:"medium",children:w})}),a.jsxs(yt,{spacing:"3",children:[a.jsx(ce,{type:"submit",variant:"primary",size:"md",children:"Save Changes"}),a.jsx(ce,{type:"button",variant:"secondary",size:"md",onClick:O,children:"Cancel"})]})]})}):a.jsxs(a.Fragment,{children:[a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"2",weight:"medium",children:"Description"}),a.jsx(S,{size:"2",tone:"muted",children:A.description||"No description"})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"2",weight:"medium",children:"Repository URL"}),a.jsx(S,{size:"2",tone:"muted",children:A.repoUrl||"No repository URL"})]}),a.jsx(yt,{justify:"end",children:a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>D(A),children:"Edit Project"})})]})]})},A.id))]})}function GN(){const{setSectionTitle:n}=Tn(),t=De(),[i,l]=d.useState(""),[c,u]=d.useState(""),[h,m]=d.useState(""),[p,y]=d.useState(!1),[v,b]=d.useState("");d.useEffect(()=>{n("Create Project")},[]);const x=async _=>{_.preventDefault(),b(""),y(!0);try{await yc.projectsControllerCreateProject({slug:i.trim(),description:c.trim()||void 0,repoUrl:h.trim()||void 0}),t("/settings/projects")}catch(k){b(k?.body?.detail||"Failed to create project")}finally{y(!1)}};return a.jsxs(ee,{spacing:"6",className:"settings-subpage",children:[a.jsx(S,{tone:"muted",className:"settings-subpage__intro",children:"Add a project tag and optional repository link."}),a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsx("form",{onSubmit:x,children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"project-slug",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Slug"})}),a.jsx("input",{id:"project-slug",value:i,onChange:_=>l(_.target.value),className:"login-input",placeholder:"taico",required:!0,disabled:p})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"project-description",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Description"})}),a.jsx("textarea",{id:"project-description",value:c,onChange:_=>u(_.target.value),className:"login-input",placeholder:"Project description",rows:3,disabled:p,style:{resize:"vertical",fontFamily:"inherit"}})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{htmlFor:"project-repo-url",className:"login-label",children:a.jsx(S,{size:"2",weight:"medium",children:"Repository URL"})}),a.jsx("input",{id:"project-repo-url",type:"url",value:h,onChange:_=>m(_.target.value),className:"login-input",placeholder:"https://github.com/username/repo",disabled:p})]}),v?a.jsx(Zt,{size:"2",weight:"medium",children:v}):null,a.jsxs(yt,{justify:"end",spacing:"3",children:[a.jsx(ce,{type:"button",variant:"secondary",size:"md",onClick:()=>t("/settings/projects"),disabled:p,children:"Cancel"}),a.jsx(ce,{type:"submit",variant:"primary",size:"md",disabled:p||!i.trim(),children:p?"Creating...":"Create project"})]})]})})})]})}const Kv=[{job:"conversation",label:"Conversation",help:"The model that answers in threads. Pick your most capable model.",kind:"language",followsConversation:!1},{job:"quick_tasks",label:"Quick tasks",help:"Small background jobs like naming threads and enriching context. Pick something fast and cheap, such as Claude Haiku or GPT Luna.",kind:"language",followsConversation:!0},{job:"middle_manager",label:"Middle manager",help:"Keeps each thread's shared notes up to date as its tasks change.",kind:"language",followsConversation:!0},{job:"embeddings",label:"Search embeddings",help:"Turns content into vectors for search. Search does not use it yet. Changing it later means re-indexing everything, so pick one and keep it.",kind:"embedding",followsConversation:!1}],Ya={openai:{label:"OpenAI",help:"Get an API key from platform.openai.com/api-keys.",secretLabel:"API key",secretPlaceholder:"sk-...",secretRequired:!0},anthropic:{label:"Anthropic",help:"Get an API key from console.anthropic.com.",secretLabel:"API key",secretPlaceholder:"sk-ant-...",secretRequired:!0},google:{label:"Google Gemini API",help:"Get an API key from aistudio.google.com.",secretLabel:"API key",secretPlaceholder:"AIza...",secretRequired:!0},google_vertex:{label:"Google Vertex AI",help:"Anything left empty falls back to the server environment (application default credentials, GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION).",secretLabel:"Service account JSON (optional)",secretPlaceholder:'{ "type": "service_account", ... }',secretRequired:!1,multilineSecret:!0,hasVertexSettings:!0},xai:{label:"xAI (Grok)",help:"Get an API key from console.x.ai.",secretLabel:"API key",secretPlaceholder:"xai-...",secretRequired:!0},openai_compatible:{label:"OpenAI-compatible",help:"Any server that speaks the OpenAI chat API, such as Ollama, LiteLLM or OpenRouter. Needs a base URL.",secretLabel:"API key (optional)",secretPlaceholder:"sk-...",secretRequired:!1,hasBaseUrl:!0}},VN=Object.keys(Ya),Xv="__add_provider__",Ur=(n,t)=>n?.body?.detail||t;function FN(){const{setSectionTitle:n}=Tn(),[t,i]=d.useState([]),[l,c]=d.useState([]),[u,h]=d.useState({}),[m,p]=d.useState(""),[y,v]=d.useState(!0),[b,x]=d.useState(null),[_,k]=d.useState(!1),T=d.useRef(new Set);vt();const w=d.useCallback(async()=>{try{const[C,L]=await Promise.all([Ua.aiProvidersControllerListAiProviders(),hl.aiModelSelectionsControllerListAiModelSelections()]);i(C),c(L)}catch(C){p(Ur(C,"Failed to load model settings"))}finally{v(!1)}},[]);d.useEffect(()=>{n("AI models"),w()},[w,n]);const E=d.useCallback(async(C,L=!1)=>{if(!(!L&&T.current.has(C))){T.current.add(C),h(P=>({...P,[C]:{status:"loading"}}));try{const P=await Ua.aiProvidersControllerListAiProviderModels(C);h(Y=>({...Y,[C]:{status:"ready",models:P}}))}catch(P){h(Y=>({...Y,[C]:{status:"error",message:Ur(P,"Could not list models from the provider.")}}))}}},[]),R=async(C,L,P)=>{p("");try{return L?await hl.aiModelSelectionsControllerSetAiModelSelection(C,{aiProviderId:L,modelId:P}):await hl.aiModelSelectionsControllerClearAiModelSelection(C),await w(),!0}catch(Y){return p(Ur(Y,"Failed to save the model")),!1}},D=async(C,L)=>{const P=Qv(C,L,!1);if(P)return P;const Y=Ya[C];try{const U=await Ua.aiProvidersControllerCreateAiProvider({name:L.name.trim()||Y.label,type:C,...Y.hasBaseUrl?{baseUrl:L.baseUrl}:{},...Y.hasVertexSettings?{project:L.project,location:L.location}:{}});return L.apiKey.trim()&&await Ua.aiProvidersControllerUpdateAiProvider(U.id,{apiKey:L.apiKey.trim()}),k(!1),await w(),null}catch(U){return await w(),Ur(U,"Failed to add provider")}},O=async(C,L)=>{const P=Ya[C.type],Y=L.name.trim()?Qv(C.type,L,!!C.secretId):"Please enter a name";if(Y){p(Y);return}p("");try{await Ua.aiProvidersControllerUpdateAiProvider(C.id,{name:L.name.trim(),...L.apiKey.trim()?{apiKey:L.apiKey.trim()}:{},...P.hasBaseUrl?{baseUrl:L.baseUrl}:{},...P.hasVertexSettings?{project:L.project,location:L.location}:{}}),x(null),await w(),await E(C.id,!0)}catch(U){p(Ur(U,"Failed to save provider"))}},z=async C=>{p("");try{await Ua.aiProvidersControllerDeleteAiProvider(C.id),await w()}catch(L){p(Ur(L,"Failed to delete provider"))}};if(y)return a.jsx(ee,{spacing:"6",className:"settings-subpage",children:a.jsx(S,{children:"Loading..."})});const A=C=>Kv.filter(L=>l.some(P=>P.job===L.job&&P.aiProviderId===C)).map(L=>L.label);return a.jsxs(ee,{spacing:"6",className:"settings-subpage settings-models",children:[a.jsx(S,{tone:"muted",className:"settings-subpage__intro",children:"Providers are the AI services Taico can call. Models are picked per job, so each job can use a different model from a different provider."}),m&&a.jsx(Zt,{size:"2",weight:"medium",children:m}),a.jsxs(ee,{spacing:"3",children:[a.jsx(S,{size:"4",weight:"semibold",children:"Models"}),a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsx("div",{className:"settings-models__jobs",children:Kv.map(C=>{const L=l.find(P=>P.job===C.job);return L?a.jsx(XN,{info:C,selection:L,providers:t,modelsByProvider:u,onLoadModels:E,onSave:(P,Y)=>R(C.job,P,Y),onAddProvider:()=>k(!0)},C.job):null})})})]}),a.jsxs(ee,{spacing:"3",children:[a.jsxs(yt,{justify:"space-between",align:"center",children:[a.jsx(S,{size:"4",weight:"semibold",children:"Providers"}),a.jsx(ce,{variant:"primary",size:"sm",onClick:()=>k(!0),children:"Add provider"})]}),a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsx("div",{className:"settings-models__jobs",children:t.length===0?a.jsx("div",{className:"settings-models__provider",children:a.jsx(S,{tone:"muted",children:"No providers yet. Add one to pick models from it."})}):t.map(C=>a.jsx(QN,{provider:C,usedBy:A(C.id),models:u[C.id],isEditing:b===C.id,onEdit:()=>{p(""),x(C.id)},onCancel:()=>x(null),onSave:L=>O(C,L),onDelete:()=>z(C),onTest:()=>E(C.id,!0)},C.id))})})]}),a.jsx(YN,{open:_,onOpenChange:k,onAdd:D})]})}function Qv(n,t,i){const l=Ya[n];return l.secretRequired&&!i&&!t.apiKey.trim()?"Please enter an API key":l.hasBaseUrl&&!t.baseUrl.trim()?"Please enter a base URL":null}const Bh={name:"",apiKey:"",baseUrl:"",project:"",location:""};function y_({type:n,form:t,onChange:i,hasStoredSecret:l}){const c=Ya[n],u=(h,m,p)=>a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"2",weight:"medium",children:h}),a.jsx("input",{type:"text",value:t[m],onChange:y=>i({...t,[m]:y.target.value}),className:"settings-models__control",placeholder:p})]});return a.jsxs(a.Fragment,{children:[a.jsx(S,{size:"1",tone:"muted",children:c.help}),u("Name","name",c.label),c.secretLabel?a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"2",weight:"medium",children:c.secretLabel}),c.multilineSecret?a.jsx("textarea",{value:t.apiKey,onChange:h=>i({...t,apiKey:h.target.value}),className:"settings-models__control settings-models__secret-textarea",placeholder:c.secretPlaceholder,rows:4}):a.jsx("input",{type:"password",value:t.apiKey,onChange:h=>i({...t,apiKey:h.target.value}),className:"settings-models__control",placeholder:c.secretPlaceholder}),a.jsx(S,{size:"1",tone:"muted",children:l?"A value is already stored. Leave empty to keep it.":"Stored securely on the server."})]}):null,c.hasBaseUrl?u("Base URL","baseUrl","http://localhost:11434/v1"):null,c.hasVertexSettings?a.jsxs(a.Fragment,{children:[u("Project ID","project","From GOOGLE_CLOUD_PROJECT"),u("Location","location","From GOOGLE_CLOUD_LOCATION")]}):null]})}function YN({open:n,onOpenChange:t,onAdd:i}){const[l,c]=d.useState("anthropic"),[u,h]=d.useState(Bh),[m,p]=d.useState(""),[y,v]=d.useState(!1);d.useEffect(()=>{n&&(h(Bh),p(""))},[n]);const b=async()=>{v(!0),p(await i(l,u)??""),v(!1)};return a.jsx(wE,{open:n,onOpenChange:t,title:"Add a provider",children:a.jsxs(ee,{spacing:"3",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"2",weight:"medium",children:"Type"}),a.jsx("select",{value:l,onChange:x=>{c(x.target.value),p("")},className:"settings-models__control","aria-label":"Provider type",children:VN.map(x=>a.jsx("option",{value:x,children:Ya[x].label},x))})]}),a.jsx(y_,{type:l,form:u,onChange:h,hasStoredSecret:!1}),m?a.jsx(Zt,{size:"2",weight:"medium",children:m}):null,a.jsxs(yt,{spacing:"2",justify:"end",children:[a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>t(!1),children:"Cancel"}),a.jsx(ce,{variant:"primary",size:"sm",onClick:b,disabled:y,children:"Add provider"})]})]})})}function KN({value:n,onChange:t,options:i,placeholder:l,label:c}){const[u,h]=d.useState(!1),[m,p]=d.useState(!1),[y,v]=d.useState(-1),b=d.useRef(null),x=n.trim().toLowerCase(),_=m&&x?i.filter(E=>E.toLowerCase().includes(x)):i;d.useEffect(()=>{b.current?.querySelector('[data-active="true"]')?.scrollIntoView({block:"nearest"})},[y]);const k=()=>{h(!1),p(!1),v(-1)},T=E=>{t(E),k()},w=E=>{if(E.key==="ArrowDown"||E.key==="ArrowUp"){if(E.preventDefault(),!u){h(!0);return}if(_.length>0){const R=E.key==="ArrowDown"?1:-1;v(D=>(D+R+_.length)%_.length)}}else E.key==="Enter"&&u&&y>=0&&_[y]?(E.preventDefault(),T(_[y])):E.key==="Escape"&&u&&(E.preventDefault(),k())};return a.jsxs("div",{className:"settings-models__combobox",children:[a.jsx("input",{type:"text",role:"combobox","aria-label":c,"aria-expanded":u,"aria-autocomplete":"list",autoComplete:"off",spellCheck:!1,value:n,placeholder:l,className:"settings-models__control",onFocus:E=>{h(!0),E.target.select()},onBlur:k,onChange:E=>{t(E.target.value),h(!0),p(!0),v(-1)},onKeyDown:w}),u&&_.length>0?a.jsx("ul",{ref:b,role:"listbox",className:"settings-models__combobox-list",children:_.map((E,R)=>a.jsx("li",{role:"option","aria-selected":E===n,"data-active":R===y,className:"settings-models__combobox-option",onMouseDown:D=>D.preventDefault(),onClick:()=>T(E),onMouseEnter:()=>v(R),children:E},E))}):null]})}function XN({info:n,selection:t,providers:i,modelsByProvider:l,onLoadModels:c,onSave:u,onAddProvider:h}){const m=t.aiProviderId??"",p=t.modelId??"",[y,v]=d.useState(m),[b,x]=d.useState(p),[_,k]=d.useState(!1),[T,w]=d.useState(!1);d.useEffect(()=>{v(m),x(p)},[m,p]);const R=!!i.find(J=>J.id===y)?.isConfigured;d.useEffect(()=>{y&&R&&c(y)},[y,R,c]),d.useEffect(()=>{if(!T)return;const J=window.setTimeout(()=>w(!1),2400);return()=>window.clearTimeout(J)},[T]);const D=y?l[y]:void 0,O=D?.status==="ready"?D.models:[],z=O.filter(J=>J.kind===n.kind),A=(z.length>0?z:O).map(J=>J.id),C=R&&D?.status!=="ready"&&D?.status!=="error",L=y!==m||b.trim()!==p,P=L&&!_&&(y===""||b.trim()!==""),Y=J=>{if(J===Xv){h();return}v(J),x(J===m?p:"")},U=async()=>{k(!0);const J=await u(y,b.trim());k(!1),w(J)},re=n.followsConversation?"Same as Conversation":"Not selected";let Q;return t.isReady?Q={text:t.followsConversation?`Using the conversation model (${t.effectiveModelId})`:"Ready",tone:"ready"}:t.effectiveModelId?Q={text:"The provider still needs setup",tone:"pending"}:Q={text:"Not selected",tone:"pending"},a.jsxs("div",{className:"settings-models__job",children:[a.jsxs(ee,{spacing:"1",className:"settings-models__job-copy",children:[a.jsxs(yt,{spacing:"2",align:"center",className:"settings-models__job-title",children:[a.jsx(S,{size:"3",weight:"semibold",children:n.label}),a.jsx("span",{className:"settings-models__status","data-tone":Q.tone,children:Q.text})]}),a.jsx(S,{size:"1",tone:"muted",children:n.help})]}),a.jsxs("div",{className:"settings-models__job-controls",children:[a.jsxs("select",{value:y,onChange:J=>Y(J.target.value),className:"settings-models__control","aria-label":`${n.label} provider`,children:[a.jsx("option",{value:"",children:re}),i.map(J=>a.jsxs("option",{value:J.id,children:[J.name,J.isConfigured?"":" (needs setup)"]},J.id)),a.jsx("option",{value:Xv,children:"Add provider…"})]}),y===""?null:a.jsx(KN,{value:b,onChange:x,options:A,placeholder:C?"Loading models…":"Search or type a model id",label:`${n.label} model`}),a.jsx(ce,{variant:"primary",size:"sm",onClick:U,disabled:!P,children:T&&!L?"Saved":"Save"})]}),y!==""&&D?.status==="error"?a.jsxs(S,{size:"1",tone:"muted",className:"settings-models__job-note",children:[D.message," You can still type the model id."]}):null,y!==""&&!R?a.jsx(S,{size:"1",tone:"muted",className:"settings-models__job-note",children:"Finish setting up this provider to pick from its models."}):null]})}function QN({provider:n,usedBy:t,models:i,isEditing:l,onEdit:c,onCancel:u,onSave:h,onDelete:m,onTest:p}){const y=Ya[n.type],[v,b]=d.useState(Bh),[x,_]=d.useState(!1),[k,T]=d.useState(!1);d.useEffect(()=>{l&&b({name:n.name,apiKey:"",baseUrl:n.baseUrl??"",project:n.project??"",location:n.location??""})},[l,n]);let w=null;return k&&i&&(w=i.status==="loading"?"Testing…":i.status==="ready"?`Connected. ${i.models.length} models available.`:i.message),a.jsx("div",{className:"settings-models__provider","data-layout":l?"form":"row",children:a.jsxs(ee,{spacing:"3",children:[a.jsxs(ee,{spacing:"1",className:"settings-models__header-copy",children:[a.jsxs(yt,{spacing:"2",align:"center",className:"settings-models__job-title",children:[a.jsx(S,{size:"3",weight:"semibold",children:n.name}),a.jsx("span",{className:"settings-models__status","data-tone":n.isConfigured?"ready":"pending",children:n.isConfigured?"Ready":"Needs setup"})]}),a.jsxs(S,{size:"1",tone:"muted",children:[y.label,n.baseUrl?` · ${n.baseUrl}`:"",t.length>0?` · Used by ${t.join(", ")}`:" · Not used by any job"]}),w&&!l?a.jsx(S,{size:"1",tone:"muted",children:w}):null]}),l?a.jsxs(ee,{spacing:"3",children:[a.jsx(y_,{type:n.type,form:v,onChange:b,hasStoredSecret:!!n.secretId}),a.jsxs(yt,{spacing:"2",children:[a.jsx(ce,{variant:"primary",size:"sm",onClick:()=>h(v),children:"Save"}),a.jsx(ce,{variant:"secondary",size:"sm",onClick:u,children:"Cancel"})]})]}):x?a.jsxs(yt,{spacing:"2",align:"center",className:"settings-models__actions",children:[a.jsxs(S,{size:"2",children:["Delete ",n.name,"?"]}),a.jsx(ce,{variant:"danger",size:"sm",onClick:()=>{_(!1),m()},children:"Delete"}),a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>_(!1),children:"Cancel"})]}):a.jsxs(yt,{spacing:"2",align:"center",className:"settings-models__actions",children:[a.jsx(ce,{variant:"secondary",size:"sm",onClick:c,children:n.isConfigured?"Edit":"Set up"}),a.jsx(ce,{variant:"secondary",size:"sm",disabled:!n.isConfigured,onClick:()=>{T(!0),p()},children:"Test connection"}),a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>_(!0),children:"Delete"})]})]})})}function ZN(){const{setSectionTitle:n}=Tn(),[t,i]=d.useState(!1),[l,c]=d.useState(!1),[u,h]=d.useState(null),[m,p]=d.useState(""),[y,v]=d.useState("");d.useEffect(()=>{n("Import / Export")},[n]);const b=d.useMemo(()=>`${Va}/api/v1/context/blocks/export`,[]),x=d.useMemo(()=>`${Va}/api/v1/context/blocks/import`,[]),_=async()=>{i(!0),p(""),v("");try{const T=await fetch(b,{method:"GET",credentials:"include"});if(!T.ok)throw new Error("Failed to export blocks");const w=await T.blob(),R=T.headers.get("content-disposition")?.match(/filename="?([^";]+)"?/)?.[1]||"context-blocks.zip",D=window.URL.createObjectURL(w),O=document.createElement("a");O.href=D,O.download=R,document.body.appendChild(O),O.click(),O.remove(),window.URL.revokeObjectURL(D),v("Blocks export downloaded successfully.")}catch{p("Failed to export blocks. Please try again.")}finally{i(!1)}},k=async()=>{if(!u){p("Please choose a .zip file first."),v("");return}c(!0),p(""),v("");try{const T=new FormData;T.append("file",u);const w=await fetch(x,{method:"POST",credentials:"include",body:T}),E=await w.json().catch(()=>({}));if(!w.ok)throw new Error("Failed to import blocks");const R=E.importedCount??0;v(`Import complete. ${R} block${R===1?"":"s"} created.`),h(null)}catch{p("Failed to import blocks. Verify the archive format and try again.")}finally{c(!1)}};return a.jsxs(ee,{spacing:"6",className:"settings-subpage",children:[a.jsx(S,{tone:"muted",className:"settings-subpage__intro",children:"Import and export workspace data. Blocks are available now; task support can be added in this section later."}),m?a.jsx(Zt,{size:"2",weight:"medium",children:m}):null,y?a.jsx(S,{size:"2",className:"settings-data__success",children:y}):null,a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"4",weight:"semibold",children:"Export Blocks"}),a.jsx(S,{tone:"muted",children:"Download all context blocks as a nested markdown zip archive."})]}),a.jsx(yt,{justify:"end",children:a.jsx(ce,{variant:"primary",size:"sm",onClick:_,disabled:t,children:t?"Exporting...":"Export Blocks"})})]})}),a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"4",weight:"semibold",children:"Import Blocks"}),a.jsx(S,{tone:"muted",children:"Upload a blocks archive to create context blocks in this workspace."})]}),a.jsx("label",{htmlFor:"blocks-import-file",className:"settings-data__file-label",children:"Select archive (.zip)"}),a.jsx("input",{id:"blocks-import-file",type:"file",accept:".zip,application/zip",onChange:T=>h(T.target.files?.[0]??null),className:"settings-data__file-input"}),a.jsx(S,{size:"1",tone:"muted",children:u?`Selected: ${u.name}`:"No file selected"}),a.jsx(yt,{justify:"end",children:a.jsx(ce,{variant:"secondary",size:"sm",onClick:k,disabled:l,children:l?"Importing...":"Import Blocks"})})]})})]})}function WN(){const{setSectionTitle:n}=Tn(),{workers:t,isLoading:i,error:l}=_f(),[c,u]=d.useState(null);d.useEffect(()=>{n("Workers Settings")},[]);const m=`npx -y @taico/worker --serverurl ${`${window.location.protocol}//${window.location.host}`}`,p=v=>{const b=new Date(v),_=new Date().getTime()-b.getTime(),k=120*1e3;return _<=k},y=async()=>{try{await navigator.clipboard.writeText(m),u("Copied"),window.setTimeout(()=>u(null),1800)}catch{u("Copy failed"),window.setTimeout(()=>u(null),1800)}};return i?a.jsx(ee,{spacing:"6",className:"settings-subpage",children:a.jsx(S,{children:"Loading..."})}):a.jsxs(ee,{spacing:"6",className:"settings-subpage",children:[a.jsx(S,{tone:"muted",className:"settings-subpage__intro",children:"Workers execute tasks in the background. Configure workers to enable automated task execution."}),l?a.jsx(Zt,{size:"2",weight:"medium",children:l}):null,a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"4",weight:"semibold",children:"Configure a New Worker"}),a.jsx(S,{tone:"muted",children:"Run this command in your terminal to start a new worker:"})]}),a.jsxs("div",{className:"settings-workers__command-container",children:[a.jsx("code",{className:"settings-workers__command",children:m}),a.jsx(ce,{className:"settings-workers__copy-button",variant:"secondary",size:"sm",onClick:y,children:c??"Copy"})]}),a.jsx(S,{size:"1",tone:"muted",children:"The worker will automatically register and appear in the list below when it connects."})]})}),a.jsxs(ee,{spacing:"3",children:[a.jsxs(S,{size:"4",weight:"semibold",children:["Registered Workers (",t.length,")"]}),t.length===0?a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsx(S,{tone:"muted",children:"No workers registered yet. Run the command above to start your first worker."})}):t.map(v=>{const b=p(v.lastSeenAt),_=new Date(v.lastSeenAt).toLocaleString();return a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"3",children:[a.jsx(yt,{justify:"space-between",align:"center",children:a.jsxs(ee,{spacing:"1",children:[a.jsxs("div",{className:"settings-workers__title-row",children:[a.jsx(S,{size:"3",weight:"semibold",children:"Worker"}),b?a.jsx(d1,{className:"settings-workers__status-icon settings-workers__status-icon--connected",size:18,strokeWidth:1.5,absoluteStrokeWidth:!0,"aria-label":"Connected"}):a.jsx(c1,{className:"settings-workers__status-icon settings-workers__status-icon--disconnected",size:18,strokeWidth:1.5,absoluteStrokeWidth:!0,"aria-label":"Disconnected"})]}),a.jsxs(S,{size:"1",tone:"muted",children:["ID: ",v.id]}),a.jsxs(S,{size:"1",tone:"muted",children:["Version: ",v.workerVersion??"Unknown"]}),a.jsxs(S,{size:"1",tone:"muted",children:["Last seen: ",_]})]})}),v.harnesses&&v.harnesses.length>0&&a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"2",weight:"medium",children:"Harnesses:"}),a.jsx("div",{className:"settings-workers__harnesses",children:v.harnesses.map(k=>a.jsx("span",{className:"settings-workers__harness-badge",children:k},k))})]})]})},v.id)})]})]})}function JN(){const{setSectionTitle:n}=Tn();return vt(),d.useEffect(()=>{n("AI usage")},[]),a.jsxs(ee,{spacing:"6",className:"settings-subpage",children:[a.jsx(S,{tone:"muted",className:"settings-subpage__intro",children:"View usage and quota information for AI providers."}),a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"4",children:[a.jsx(yt,{justify:"space-between",align:"center",children:a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"4",weight:"semibold",children:"OpenAI"}),a.jsx(S,{size:"1",tone:"muted",children:"Codex and GPT models"})]})}),a.jsx(ee,{spacing:"2",children:a.jsx(yt,{spacing:"2",children:a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>window.open("https://chatgpt.com/codex/cloud/settings/usage","_blank","noopener,noreferrer"),children:"See usage"})})})]})}),a.jsx(Ye,{padding:"5",className:"settings-panel-card",children:a.jsxs(ee,{spacing:"4",children:[a.jsx(yt,{justify:"space-between",align:"center",children:a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"4",weight:"semibold",children:"Anthropic"}),a.jsx(S,{size:"1",tone:"muted",children:"Claude models"})]})}),a.jsx(ee,{spacing:"2",children:a.jsx(yt,{spacing:"2",children:a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>window.open("https://claude.ai/settings/usage","_blank","noopener,noreferrer"),children:"See usage"})})})]})})]})}function eA(){const{setSectionTitle:n}=Tn(),{user:t,isLoading:i}=un(),[l,c]=d.useState([]),[u,h]=d.useState(""),[m,p]=d.useState(Pr.role.STANDARD),[y,v]=d.useState(""),[b,x]=d.useState(""),[_,k]=d.useState(!1),[T,w]=d.useState(!1);d.useEffect(()=>{n("User Management")},[n]);const E=t?.role==="admin";d.useEffect(()=>{i||!E||R()},[i,E]);const R=async()=>{if(E){k(!0),v("");try{const A=await tn.webAuthControllerListUsers();c(A)}catch(A){v(Wo(A,"Failed to load users."))}finally{k(!1)}}},D=async A=>{A.preventDefault(),w(!0),v(""),x("");try{await tn.webAuthControllerCreateUser({email:u,role:m}),h(""),p(Pr.role.STANDARD),x("User created. They can use Create account on the login screen to set their profile and password."),await R()}catch(C){v(Wo(C,"Failed to create user."))}finally{w(!1)}},O=async A=>{v(""),x("");try{await tn.webAuthControllerResetUserPassword(A.id),x(`${A.email} can now set a new password from the login screen.`),await R()}catch(C){v(Wo(C,"Failed to reset password."))}},z=async A=>{if(window.confirm(`Disable login for ${A.email}?`)){v(""),x("");try{await tn.webAuthControllerDeleteUser(A.id),x(`${A.email} has been deactivated.`),await R()}catch(C){v(Wo(C,"Failed to delete user."))}}};return i?a.jsx(Ye,{padding:"5",children:a.jsx(S,{tone:"muted",children:"Loading user management..."})}):E?a.jsxs("div",{className:"settings-users-page",children:[a.jsx(Ye,{padding:"5",className:"settings-users-page__hero",children:a.jsxs(ee,{spacing:"2",children:[a.jsx("span",{className:"settings-users-page__hero-icon","aria-hidden":"true",children:a.jsx(q1,{size:20})}),a.jsx(S,{size:"5",weight:"bold",children:"User management"}),a.jsx(S,{tone:"muted",children:"Invite human users, manage roles, reset passwords, and disable access."})]})}),a.jsx(Ye,{padding:"5",children:a.jsx("form",{onSubmit:D,children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"3",weight:"semibold",children:"Create user"}),a.jsx(S,{size:"1",tone:"muted",children:"New users receive access by setting up their account from the login screen."})]}),a.jsxs("div",{className:"settings-users-page__create-grid",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{className:"login-label",htmlFor:"managed-user-email",children:a.jsx(S,{size:"2",weight:"medium",children:"Email"})}),a.jsx("input",{id:"managed-user-email",className:"login-input",type:"email",value:u,onChange:A=>h(A.target.value),placeholder:"name@work.com",required:!0,disabled:T})]}),a.jsxs(ee,{spacing:"2",children:[a.jsx("label",{className:"login-label",htmlFor:"managed-user-role",children:a.jsx(S,{size:"2",weight:"medium",children:"Role"})}),a.jsxs("select",{id:"managed-user-role",className:"login-input",value:m,onChange:A=>p(A.target.value),disabled:T,children:[a.jsx("option",{value:Pr.role.STANDARD,children:"Normal user"}),a.jsx("option",{value:Pr.role.ADMIN,children:"Admin"})]})]}),a.jsxs(ce,{type:"submit",variant:"primary",disabled:T,className:"settings-users-page__create-button",children:[a.jsx(H1,{size:16}),T?"Creating...":"Create user"]})]}),b?a.jsx(S,{size:"2",tone:"muted",children:b}):null,y?a.jsx(Zt,{size:"2",weight:"medium",children:y}):null]})})}),a.jsxs(Ye,{padding:"0",className:"settings-users-page__list-card",children:[a.jsxs("div",{className:"settings-users-page__list-header",children:[a.jsx(S,{size:"3",weight:"semibold",children:"Users"}),a.jsx(ce,{variant:"secondary",size:"sm",onClick:R,disabled:_,children:_?"Refreshing...":"Refresh"})]}),a.jsxs("div",{className:"settings-users-page__list",children:[l.map(A=>a.jsxs("div",{className:"settings-users-page__row",children:[a.jsxs("div",{className:"settings-users-page__identity",children:[a.jsx(S,{size:"2",weight:"semibold",children:A.displayName}),a.jsxs(S,{size:"1",tone:"muted",children:[A.email," · @",A.slug]})]}),a.jsxs("div",{className:"settings-users-page__badges",children:[a.jsx("span",{className:"settings-users-page__badge",children:A.role==="admin"?"Admin":"Normal"}),a.jsx("span",{className:`settings-users-page__badge ${A.isActive?"settings-users-page__badge--active":"settings-users-page__badge--inactive"}`,children:A.isActive?"Active":"Inactive"}),A.passwordSetupPending?a.jsx("span",{className:"settings-users-page__badge settings-users-page__badge--pending",children:"Setup pending"}):null]}),a.jsxs("div",{className:"settings-users-page__actions",children:[a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>O(A),disabled:!A.isActive,children:"Reset password"}),a.jsx(ce,{variant:"secondary",size:"sm",onClick:()=>z(A),disabled:!A.isActive||A.actorId===t?.actorId,children:"Delete"})]})]},A.id)),!_&&l.length===0?a.jsx(S,{tone:"muted",className:"settings-users-page__empty",children:"No users found."}):null]})]})]}):a.jsx(Ye,{padding:"5",children:a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"4",weight:"semibold",children:"Admin access required"}),a.jsx(S,{tone:"muted",children:"Only admin users can manage user accounts."})]})})}function Wo(n,t){return n?.body?.detail||n?.body?.title||n?.message||t}function tA({step:n,isCompleted:t,isCurrent:i,isLast:l,isExpanded:c,onToggle:u}){return a.jsxs("div",{className:"walkthrough-step",children:[a.jsxs("div",{className:"walkthrough-step-rail",children:[a.jsx("div",{className:["walkthrough-step-dot",t?"walkthrough-step-dot--completed":"",i?"walkthrough-step-dot--current":""].filter(Boolean).join(" "),children:t&&a.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none","aria-hidden":"true",children:a.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),!l&&a.jsx("div",{className:["walkthrough-step-connector",t?"walkthrough-step-connector--completed":""].filter(Boolean).join(" ")})]}),a.jsxs("div",{className:"walkthrough-step-body",children:[a.jsx("button",{className:"walkthrough-step-header",onClick:u,"aria-expanded":c,children:a.jsx(S,{size:"2",weight:i?"semibold":"medium",className:t?"walkthrough-label-done":"",children:n.label})}),c&&a.jsxs("div",{className:"walkthrough-step-detail",children:[a.jsx(S,{size:"2",tone:"muted",as:"p",className:"walkthrough-step-description",children:n.description}),a.jsx(qs,{to:n.href,className:"walkthrough-step-cta",children:"Go →"})]})]})]})}function nA(){const{setSectionTitle:n}=Tn(),{user:t,refreshAuth:i}=un(),{status:l,isLoading:c}=Zb(),[u,h]=d.useState(new Set),m=d.useRef(!1),p=d.useRef(!1);vt(),d.useEffect(()=>{n("Setup walkthrough")},[n]),d.useEffect(()=>{p.current||!t||!l||t.onboardingDisplayMode==="OFF"&&l.completedCount<l.totalCount&&(p.current=!0,mf.WalkthroughController_acknowledge().then(()=>i()).catch(console.error))},[t,l,i]),d.useEffect(()=>{if(!l||m.current)return;m.current=!0;const _=l.steps.find(k=>!k.completed);_&&h(new Set([_.id]))},[l]);const y=_=>{h(k=>{const T=new Set(k);return T.has(_)?T.delete(_):T.add(_),T})},v=l?.completedCount??0,b=l?.totalCount??8,x=l?.steps.findIndex(_=>!_.completed)??-1;return a.jsx("div",{className:"walkthrough-page",children:a.jsxs(ee,{spacing:"5",className:"walkthrough-page-inner",children:[a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"2",tone:"muted",as:"p",children:"Complete these steps to get the most out of Taico."}),a.jsxs(S,{size:"2",weight:"semibold",children:[v," / ",b," completed"]})]}),c?a.jsx(S,{size:"2",tone:"muted",children:"Loading..."}):a.jsx("div",{className:"walkthrough-track",children:l?.steps.map((_,k)=>a.jsx(tA,{step:_,isCompleted:_.completed,isCurrent:k===x,isLast:k===l.steps.length-1,isExpanded:u.has(_.id),onToggle:()=>y(_.id)},_.id))})]})})}function sA(){return a.jsx(AC,{children:a.jsx(ps,{children:a.jsxs(je,{element:a.jsx(IC,{}),children:[a.jsx(je,{path:"/home",element:a.jsx(zC,{})}),a.jsx(je,{path:"/settings",element:a.jsx(qN,{})}),a.jsx(je,{path:"/settings/account",element:a.jsx($N,{})}),a.jsx(je,{path:"/settings/appearance",element:a.jsx(PN,{})}),a.jsx(je,{path:"/settings/projects",element:a.jsx(HN,{})}),a.jsx(je,{path:"/settings/projects/new",element:a.jsx(GN,{})}),a.jsx(je,{path:"/settings/models",element:a.jsx(FN,{})}),a.jsx(je,{path:"/settings/chat",element:a.jsx(Is,{to:"/settings/models",replace:!0})}),a.jsx(je,{path:"/settings/ai-providers",element:a.jsx(Is,{to:"/settings/ai-usage",replace:!0})}),a.jsx(je,{path:"/settings/workers",element:a.jsx(WN,{})}),a.jsx(je,{path:"/settings/ai-usage",element:a.jsx(JN,{})}),a.jsx(je,{path:"/settings/data",element:a.jsx(ZN,{})}),a.jsx(je,{path:"/settings/users",element:a.jsx(eA,{})}),a.jsx(je,{path:"/walkthrough",element:a.jsx(nA,{})})]})})})}const aA="/",rA=window.location.origin,ga=new ns({baseUrl:rA,credentials:"include"}),Xt=ga.task;ga.actors;const iA=ga.meta,lA=ga.metaProjects;ga.task,ga.actors,ga.meta,ga.metaProjects;const oA=va("/tasks"),cA=100,pc="tasks.selectedProjectId";function uA(){try{return localStorage.getItem(pc)}catch{return null}}function yh(n,t){return n.tags.some(i=>i.name===t)}const dA=()=>{const[n,t]=d.useState(!0),[i,l]=d.useState(!1),[c,u]=d.useState(null),[h,m]=d.useState([]),[p,y]=d.useState([]),[v,b]=d.useState([]),[x,_]=d.useState(!1),[k,T]=d.useState(()=>uA()),[w,E]=d.useState(null),[R,D]=d.useState(!1),[O,z]=d.useState({}),A=d.useRef([]),C=d.useRef(null),L=d.useRef(!1),P=d.useRef(0),Y=d.useMemo(()=>k?v.find(ue=>ue.id===k)??null:null,[v,k]),U=Y?.tagName??null,re=!k||!!Y;d.useEffect(()=>{A.current=h},[h]),d.useEffect(()=>{C.current=U},[U]),d.useEffect(()=>{L.current=re},[re]);const Q=d.useCallback(ue=>{T(ue);try{ue?localStorage.setItem(pc,ue):localStorage.removeItem(pc)}catch(X){console.error("Failed to persist selected task project",X)}},[]),J=d.useCallback(async()=>{try{const ue=await lA.ProjectsController_getAllProjects();b(ue)}catch(ue){console.error("Failed to load projects",ue),b([])}finally{_(!0)}},[]),ye=ue=>{if(!ue.message){console.warn("Received task activity event without message, skipping",ue);return}z(X=>({...X,[ue.taskId]:ue}))},B=ue=>{z(X=>{const{[ue]:pe,...Z}=X;return Z})},se=ue=>[...ue].sort((X,pe)=>{const Z=new Date(X.updatedAt).getTime();return new Date(pe.updatedAt).getTime()-Z}),ge=(ue,X)=>{const pe=new Set(X.map(Z=>Z.id));return se([...X,...ue.filter(Z=>!pe.has(Z.id))])},Ee=ue=>{y(X=>ge(X,[ue]))},Ce=async ue=>{const X=C.current,pe=X?{...ue,tagNames:Array.from(new Set([...ue.tagNames??[],X]))}:ue;return await Xt.TasksController_createTask({body:pe})},M=async({taskId:ue})=>await Xt.TasksController_deleteTask({id:ue}),H=async({taskId:ue,comment:X})=>await Xt.TasksController_addComment({id:ue,body:{content:X}}),de=async({taskId:ue,assigneeActorId:X})=>{const pe={assigneeActorId:X};return await Xt.TasksController_assignTask({id:ue,body:pe})},fe=async({taskId:ue})=>await Xt.TasksController_assignTaskToMe({id:ue}),V=async({taskId:ue,inputRequestId:X,answer:pe})=>await Xt.TasksController_answerInputRequest({id:ue,inputRequestId:X,body:{answer:pe}}),ie=async()=>{if(!L.current)return;const ue=P.current+1;P.current=ue;const X=C.current;t(!0),u(null);try{const pe=await Xt.TasksController_listTasks({page:1,limit:cA,tag:X??void 0});if(P.current!==ue||C.current!==X)return;const Z=X?pe.items.filter(Te=>yh(Te,X)):pe.items;m(Te=>ge(Te,Z))}catch(pe){if(P.current!==ue||C.current!==X)return;u(pe instanceof Error?pe.message:"Failed to load tasks")}finally{P.current===ue&&C.current===X&&(l(!0),t(!1))}},te=d.useCallback(async ue=>{try{const X=await Xt.TasksController_getTask({id:ue});return Ee(X),m(pe=>be(X)?pe.some(Z=>Z.id===X.id)?se(pe.map(Z=>Z.id===X.id?X:Z)):se([X,...pe]):pe.filter(Z=>Z.id!==X.id)),X}catch(X){return console.error("Failed to fetch task by ID",X),null}},[]),be=ue=>{const X=C.current;return!X||yh(ue,X)},Re=ue=>{const X=C.current;return X?A.current.some(pe=>pe.id===ue&&yh(pe,X)):!0},Ze=ue=>{if(Ee(ue),!be(ue)){m(X=>X.filter(pe=>pe.id!==ue.id)),B(ue.id);return}m(X=>X.some(pe=>pe.id===ue.id)?se(X.map(pe=>pe.id===ue.id?ue:pe)):se([ue,...X]))},It=ue=>{m(X=>X.filter(pe=>pe.id!==ue)),y(X=>X.filter(pe=>pe.id!==ue)),B(ue)},et=async(ue,X)=>{try{const pe=await Xt.TasksController_getTask({id:ue});Ze(pe)}catch(pe){console.error(X,pe)}},wt=()=>{const ue=$n(oA,{transports:["websocket","polling"],withCredentials:!0});return ue.on("connect",()=>{console.log("Connected to websocket"),ue.emit("tasks.subscribe",{},X=>{X.ok?(console.log(X),console.log("Subscribed to room:",X.room),D(!0)):(console.error("Failed to subscribe to room"),D(!1))}),ie()}),ue.on("disconnect",()=>{console.log("WebSocket disconnected"),D(!1)}),ue.on(_n.TASK_CREATED,X=>{console.log("task.created",X),Ze(X.payload)}),ue.on(_n.TASK_UPDATED,X=>{console.log("task.updated",X),Ze(X.payload)}),ue.on(_n.TASK_DELETED,X=>{console.log("task.deleted",X),It(X.payload.taskId)}),ue.on(_n.TASK_ASSIGNED,X=>{console.log("task.assigned",X),Ze(X.payload)}),ue.on(_n.TASK_COMMENTED,async X=>{console.log("task.commented",X),await et(X.payload.taskId,"Failed to refresh task after comment")}),ue.on(_n.INPUT_REQUEST_ANSWERED,async X=>{console.log("input.request.answered",X),await et(X.payload.taskId,"Failed to refresh task after input request answer")}),ue.on(_n.TASK_STATUS_CHANGED,X=>{console.log("task.status_changed",X),Ze(X.payload)}),ue.on(_n.TASK_ACTIVITY,X=>{console.log("task.activity",X),Re(X.taskId)&&ye(X)}),E(ue),()=>{ue.close()}};return d.useEffect(()=>{J()},[J]),d.useEffect(()=>{const ue=X=>{X.key===pc&&T(X.newValue)};return window.addEventListener("storage",ue),()=>window.removeEventListener("storage",ue)},[]),d.useEffect(()=>{!x||!k||Y||Q(null)},[x,Y,k,Q]),d.useEffect(()=>re?(m([]),z({}),ie(),wt()):void 0,[re,U]),{isLoading:n,hasLoadedOnce:i,error:c,activityByTaskId:O,projects:v,projectsLoaded:x,selectedProjectId:k,selectedProject:Y,selectedProjectTag:U,setSelectedProjectId:Q,tasks:h,detailTasks:p,getTaskById:te,createTask:Ce,deleteTask:M,addComment:H,assignTask:de,assignTaskToMe:fe,answerInputRequest:V,isConnected:R}},Se={NOT_STARTED:"NOT_STARTED",IN_PROGRESS:"IN_PROGRESS",FOR_REVIEW:"FOR_REVIEW",DONE:"DONE"},Jn={[Se.NOT_STARTED]:{path:"/tasks/not-started",label:"Queued",icon:p1},[Se.IN_PROGRESS]:{path:"/tasks/in-progress",label:"Building",icon:l1},[Se.FOR_REVIEW]:{path:"/tasks/in-review",label:"Review",icon:t1},[Se.DONE]:{path:"/tasks/done",label:"Shipped",icon:z1}},hA=[Jn[Se.NOT_STARTED],Jn[Se.IN_PROGRESS],Jn[Se.FOR_REVIEW],Jn[Se.DONE]],fA=()=>({[Se.NOT_STARTED]:{enteringIds:new Set,exitingTasks:[]},[Se.IN_PROGRESS]:{enteringIds:new Set,exitingTasks:[]},[Se.FOR_REVIEW]:{enteringIds:new Set,exitingTasks:[]},[Se.DONE]:{enteringIds:new Set,exitingTasks:[]}}),v_=d.createContext(null),pA=500,mA=4e3;function gA({children:n}){const{tasks:t,detailTasks:i,getTaskById:l,isLoading:c,hasLoadedOnce:u,error:h,isConnected:m,createTask:p,deleteTask:y,addComment:v,assignTask:b,assignTaskToMe:x,answerInputRequest:_,activityByTaskId:k,projects:T,projectsLoaded:w,selectedProjectId:E,selectedProject:R,selectedProjectTag:D,setSelectedProjectId:O}=dA(),[z,A]=d.useState(""),[C,L]=d.useState(0),P=d.useRef(new Map),Y=d.useRef([]),U=d.useRef(new Map),re=d.useRef(0),[Q,J]=d.useState(0),{animationByStatus:ye,globalEnteringIds:B,globalExitingTasks:se}=d.useMemo(()=>{const Ee=Date.now(),Ce=new Map(t.map(te=>[te.id,te])),M=P.current,H=new Set(M.keys()),de=new Set(Ce.keys());if(Y.current=Y.current.filter(te=>te.expiresAt>Ee),H.size>0){const te={[Se.NOT_STARTED]:new Set,[Se.IN_PROGRESS]:new Set,[Se.FOR_REVIEW]:new Set,[Se.DONE]:new Set},be={[Se.NOT_STARTED]:[],[Se.IN_PROGRESS]:[],[Se.FOR_REVIEW]:[],[Se.DONE]:[]},Re=new Set,Ze=[];for(const[et,wt]of Ce){const ue=M.get(et);ue?ue.status!==wt.status&&(be[ue.status].push(ue),te[wt.status].add(et)):(te[wt.status].add(et),Re.add(et))}for(const[et,wt]of M)de.has(et)||(be[wt.status].push(wt),Ze.push(wt));(Object.values(te).some(et=>et.size>0)||Object.values(be).some(et=>et.length>0))&&Y.current.push({enteringByStatus:te,exitingByStatus:be,globalEntering:Re,globalExiting:Ze,expiresAt:Ee+pA})}P.current=Ce;const fe=fA();let V=new Set,ie=[];for(const te of Y.current){for(const be of Object.values(Se))te.enteringByStatus[be].forEach(Re=>fe[be].enteringIds.add(Re)),fe[be].exitingTasks.push(...te.exitingByStatus[be]);te.globalEntering.forEach(be=>V.add(be)),ie.push(...te.globalExiting)}return{animationByStatus:fe,globalEnteringIds:V,globalExitingTasks:ie}},[t,Q]);d.useEffect(()=>{if(Y.current.length===0)return;const Ce=Math.min(...Y.current.map(H=>H.expiresAt))-Date.now();if(Ce<=0){J(H=>H+1);return}const M=setTimeout(()=>{J(H=>H+1)},Ce);return()=>clearTimeout(M)},[ye,B,se]),d.useEffect(()=>{const Ee=U.current,Ce=new Map(t.map(H=>[H.id,H]));if(Ee.size===0){U.current=Ce;return}let M=!1;for(const[H,de]of Ce){const fe=Ee.get(H);if(fe&&fe.status!==Se.DONE&&de.status===Se.DONE){M=!0;break}}if(M){const H=Date.now();H-re.current>=mA&&(re.current=H,L(de=>de+1))}U.current=Ce},[t]);const ge=d.useMemo(()=>({tasks:t,detailTasks:i,getTaskById:l,createTask:p,deleteTask:y,addComment:v,assignTask:b,assignTaskToMe:x,answerInputRequest:_,isLoading:c,hasLoadedOnce:u,error:h,isConnected:m,sectionTitle:z,setSectionTitle:A,animationByStatus:ye,globalEnteringIds:B,globalExitingTasks:se,activityByTaskId:k,shippedCelebrationTrigger:C,projects:T,projectsLoaded:w,selectedProjectId:E,selectedProject:R,selectedProjectTag:D,setSelectedProjectId:O}),[t,i,l,p,y,v,b,x,_,c,u,h,m,z,A,ye,B,se,k,C,T,w,E,R,D,O]);return a.jsx(v_.Provider,{value:ge,children:n})}function Bs(){const n=d.useContext(v_);if(!n)throw new Error("useTasksCtx must be used within <TasksProvider>");return n}function xt({title:n,onCancel:t,onSave:i,children:l,headerLeft:c,headerRight:u,closeMs:h=220}){const[m,p]=d.useState(!1),[y,v]=d.useState(!1);d.useEffect(()=>{requestAnimationFrame(()=>p(!0))},[]);function b(){p(!1),setTimeout(()=>t?.(),h)}async function x(){if(!(!i||y))try{v(!0),await i()&&b()}catch{}finally{v(!1)}}function _(k){if(!k.nativeEvent.isComposing){if(k.key==="Escape"){k.preventDefault(),b();return}k.key==="Enter"&&(!k.metaKey&&!k.ctrlKey||(k.preventDefault(),x()))}}return a.jsxs("div",{className:`pop-shell__overlay ${m?"pop-shell__overlay--open":""}`,children:[a.jsx("div",{className:"pop-shell__space",onClick:b}),a.jsxs("div",{className:`pop-shell__main-panel ${m?"pop-shell__main-panel--open":""}`,onKeyDown:_,children:[a.jsxs("div",{className:"pop-shell__main-title",children:[c??a.jsx("div",{onClick:b,children:a.jsx(S,{size:"4",weight:"normal",className:"pop-shell__main-title-button",children:"cancel"})}),a.jsx(S,{size:"4",weight:"medium",children:n}),u??a.jsx("div",{onClick:x,style:{opacity:y?.6:1,pointerEvents:y?"none":"auto"},children:a.jsx(S,{size:"4",weight:"normal",className:"pop-shell__main-title-button",children:y?"saving":"save"})})]}),a.jsx("div",{className:"pop-shell__main-content",children:l})]})]})}function Zv(n,t){try{const i=localStorage.getItem(n);if(i)return JSON.parse(i)}catch(i){console.error("Error loading draft from localStorage:",i)}return t}function ni({key:n,defaultValue:t,debounceMs:i=500}){const l=d.useRef(t);d.useEffect(()=>{l.current=t},[t]);const[c,u]=d.useState(()=>Zv(n,t)),h=d.useRef(void 0);return d.useEffect(()=>{u(Zv(n,l.current))},[n]),d.useEffect(()=>(h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{try{localStorage.setItem(n,JSON.stringify(c))}catch(p){console.error("Error saving draft to localStorage:",p)}},i),()=>{h.current&&clearTimeout(h.current)}),[c,n,i]),[c,u,()=>{try{localStorage.removeItem(n),u(l.current)}catch(p){console.error("Error clearing draft from localStorage:",p)}}]}const yA={title:"",description:""},Wv=n=>{n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)};function $h({onCancel:n,onSave:t}){const[i,l,c]=ni({key:"new-task-draft",defaultValue:yA}),{title:u,description:h}=i,m=d.useRef(null),p=d.useRef(null),y=(x,_)=>{l({...i,[x]:_})};d.useEffect(()=>{m.current?.focus()},[]),d.useEffect(()=>{Wv(p.current)},[h]);function v(x){y("description",x.target.value),Wv(x.target)}async function b(){const x=await t({title:u,description:h});return x&&c(),x}return a.jsx(xt,{title:"Create a Task",onCancel:n,onSave:b,children:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"new-task-pop__input-title",children:a.jsx("input",{className:"new-task-pop__input-title",ref:m,placeholder:"Title",value:u,onChange:x=>y("title",x.target.value),onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),p.current?.focus())}})}),a.jsx("div",{className:"new-task-pop__input-description",children:a.jsx("textarea",{className:"new-task-pop__input-description",ref:p,placeholder:"Enter a description (optional)",value:h,onChange:v})})]})})}const Lt=n=>{const t=new Date(n),l=Math.round((new Date().getTime()-t.getTime())/(1e3*60));if(l<60)return`${Math.max(l,1)}m ago`;const c=Math.round(l/60);return c<24?`${c}h ago`:t.toLocaleDateString("en-US",{month:"short",day:"numeric"})};function fl({task:n,animation:t,onClick:i,pulseKey:l,additionalTags:c}){const[u,h]=d.useState(!1),m=n.assigneeActor??n.createdByActor;d.useEffect(()=>{if(l==null)return;h(!0);const v=setTimeout(()=>h(!1),1e3);return()=>clearTimeout(v)},[l]);const p=n.tags.map(v=>({label:v.name}));n.comments.length&&p.push({label:`💬 ${n.comments.length}`}),n.artefacts.length&&p.push({label:`🔗 ${n.artefacts.length}`});const y=n.inputRequests.filter(v=>!v.resolvedAt).length;return y&&p.push({label:`✋ ${y}`}),c&&p.push(...c),a.jsxs(_e,{leading:a.jsx(He,{name:m.displayName,size:"lg",src:m.avatarUrl||void 0}),topRight:Lt(n.updatedAt),tags:p,animation:t,highlight:n.inputRequests.filter(v=>!v.resolvedAt)?.length>0,onClick:i,children:[a.jsxs(S,{className:"pre",children:["#",n.id.slice(0,6)]}),a.jsx("div",{style:{minWidth:0,overflow:"hidden"},children:a.jsx(S,{weight:"bold",size:"3",tone:"default",children:a.jsxs("span",{className:"task-row__title",children:[a.jsx("span",{className:"task-row__titleText",children:n.name}),u?a.jsx("span",{className:"task-row__pulseDot","aria-hidden":!0}):null]})})}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.description}),a.jsxs("div",{style:{fontSize:12},className:"text--tone-muted",children:[n.assignee?`Assigned: @${n.assignee}`:"unassigned"," · ",`Created by @${n.createdByActor.slug}`]})]})}function x_(n){const t=new Map,i=new Date;i.setHours(0,0,0,0);for(const l of n){const c=new Date(l.updatedAt);c.setHours(0,0,0,0);const u=c.toISOString().split("T")[0],h=c.getTime()===i.getTime();t.has(u)||t.set(u,{date:c,dateKey:u,tasks:[],isToday:h}),t.get(u).tasks.push(l)}return Array.from(t.values()).sort((l,c)=>c.date.getTime()-l.date.getTime())}function b_(n){const t=new Date;t.setHours(0,0,0,0);const i=new Date(t);i.setDate(i.getDate()-1);const l=new Date(n);if(l.setHours(0,0,0,0),l.getTime()===t.getTime())return"Today";if(l.getTime()===i.getTime())return"Yesterday";const c=t.getFullYear(),u=l.getFullYear(),m=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][l.getMonth()],p=l.getDate();return u===c?`${m} ${p}`:`${m} ${p}, ${u}`}function vA({date:n,taskCount:t,isExpanded:i,onClick:l}){const c=b_(n),u=i?"▼":"▶";return a.jsx(_e,{onClick:l,className:"day-summary-row",children:a.jsxs("div",{className:"day-summary-row__content",children:[a.jsx("span",{className:"day-summary-row__chevron",children:u}),a.jsx(S,{weight:"bold",size:"3",children:c}),a.jsxs(S,{size:"2",tone:"muted",className:"day-summary-row__count",children:["· ",t," ",t===1?"task":"tasks"," shipped"]})]})})}function xA({tasks:n,enteringIds:t,exitingTasks:i,groupByDay:l=!1}){const c=De(),{activityByTaskId:u}=Bs(),[h,m]=d.useState(new Set),p=new Set(i.map(x=>x.id)),y=[...n,...i].sort((x,_)=>new Date(_.updatedAt).getTime()-new Date(x.updatedAt).getTime());if(!l)return a.jsx(xe,{children:y.map(x=>{const _=p.has(x.id),k=t.has(x.id);let T;_?T="exiting":k&&(T="entering");const w=u[x.id];return a.jsx(fl,{task:x,animation:T,pulseKey:w?.ts,onClick:()=>c(`/tasks/task/${x.id}`)},_?`exiting-${x.id}`:x.id)})});const v=x_(y),b=x=>{m(_=>{const k=new Set(_);return k.has(x)?k.delete(x):k.add(x),k})};return a.jsx(xe,{children:v.map(x=>{if(x.isToday)return x.tasks.map(k=>{const T=p.has(k.id),w=t.has(k.id);let E;T?E="exiting":w&&(E="entering");const R=u[k.id];return a.jsx(fl,{task:k,animation:E,pulseKey:R?.ts,onClick:()=>c(`/tasks/task/${k.id}`)},T?`exiting-${k.id}`:k.id)});const _=h.has(x.dateKey);return a.jsxs("div",{children:[a.jsx(vA,{date:x.date,taskCount:x.tasks.length,isExpanded:_,onClick:()=>b(x.dateKey)}),_&&x.tasks.map(k=>{const T=p.has(k.id),w=t.has(k.id);let E;T?E="exiting":w&&(E="entering");const R=u[k.id];return a.jsx(fl,{task:k,animation:E,pulseKey:R?.ts,onClick:()=>c(`/tasks/task/${k.id}`)},T?`exiting-${k.id}`:k.id)})]},x.dateKey)})})}function mc({task:n,animation:t,onClick:i,pulseKey:l}){const c=n.assigneeActor??n.createdByActor,u=n.tags.map(m=>({label:m.name}));n.comments.length&&u.push({label:`💬 ${n.comments.length}`});const h=n.inputRequests.filter(m=>!m.resolvedAt).length;return h&&u.push({label:`✋ ${h}`}),n.artefacts.length&&u.push({label:`🔗 ${n.artefacts.length}`}),a.jsxs(ob,{leading:a.jsx(He,{name:c.displayName,size:"md",src:c.avatarUrl||void 0}),topRight:Lt(n.updatedAt),tags:u,animation:t,onClick:i,pulseKey:l,highlight:n.inputRequests.filter(m=>!m.resolvedAt)?.length>0,footer:a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"row-detail truncate",children:["#",n.id.slice(0,6)]}),a.jsx("span",{className:"row-detail truncate",children:n.assigneeActor?`Assigned: @${n.assigneeActor.slug}`:"unassigned"})]}),children:[a.jsx("div",{className:"row-title truncate",children:n.name}),a.jsx("div",{className:"row-subtitle truncate",children:n.description})]})}function bA({date:n,taskCount:t,isExpanded:i,onClick:l}){const c=b_(n),u=i?"▼":"▶";return a.jsxs("div",{className:"day-summary-card__content",onClick:l,children:[a.jsx("span",{className:"day-summary-card__chevron",children:u}),a.jsxs("span",{className:"day-summary-card__text",children:[a.jsx("strong",{children:c})," · ",t," ",t===1?"task":"tasks"]})]})}function _A({tasks:n,enteringIds:t,exitingTasks:i,groupByDay:l=!1}){const c=De(),{activityByTaskId:u}=Bs(),[h,m]=d.useState(new Set),p=new Set(i.map(_=>_.id)),y=[...n,...i].sort((_,k)=>new Date(k.updatedAt).getTime()-new Date(_.updatedAt).getTime());if(!l)return a.jsx(a.Fragment,{children:y.map(_=>{const k=p.has(_.id),T=t.has(_.id),w=u[_.id];let E;return k?E="exiting":T&&(E="entering"),a.jsx(mc,{task:_,animation:E,onClick:()=>c(`/tasks/task/${_.id}`),pulseKey:w?.ts},k?`exiting-${_.id}`:_.id)})});const v=[],b=x_(y),x=_=>{m(k=>{const T=new Set(k);return T.has(_)?T.delete(_):T.add(_),T})};return b.forEach(_=>{if(_.isToday){_.tasks.forEach(T=>{const w=p.has(T.id),E=t.has(T.id),R=u[T.id];let D;w?D="exiting":E&&(D="entering");const O=a.jsx(mc,{task:T,animation:D,onClick:()=>c(`/tasks/task/${T.id}`),pulseKey:R?.ts},w?`exiting-${T.id}`:T.id);v.push(O)});return}const k=h.has(_.dateKey);v.push(a.jsx(bA,{date:_.date,taskCount:_.tasks.length,isExpanded:k,onClick:()=>x(_.dateKey)},`date-group-${_.date}`)),k&&_.tasks.forEach(T=>{const w=p.has(T.id),E=t.has(T.id),R=u[T.id];let D;w?D="exiting":E&&(D="entering");const O=a.jsx(mc,{task:T,animation:D,onClick:()=>c(`/tasks/task/${T.id}`),pulseKey:R?.ts},w?`exiting-${T.id}`:T.id);v.push(O)})}),a.jsx(a.Fragment,{children:v})}function Jo({status:n}){const t=Dt(),i=t?void 0:n,{tasks:l,createTask:c,setSectionTitle:u,animationByStatus:h,globalEnteringIds:m,globalExitingTasks:p,activityByTaskId:y}=Bs(),{showError:v}=dn(),{registerCommands:b,registerTaskSearch:x}=Tl(),_=De();vt(),d.useEffect(()=>{if(!i){u("All Tasks");return}u(Jn[i].label)},[i,u]),d.useEffect(()=>b([{id:"new-task",label:"New Task",description:"Create a new task",aliases:["create","add task"],onSelect:()=>z(!0)}]),[b]),d.useEffect(()=>x(L=>Xt.TasksController_searchTasks({query:L,limit:5,threshold:.1})),[x]);const k=d.useMemo(()=>i?l.filter(L=>L.status===i):l,[l,i]),T=d.useMemo(()=>i?{enteringIds:h[i].enteringIds,exitingTasks:h[i].exitingTasks}:{enteringIds:m,exitingTasks:p},[i,h,m,p]),[w,E]=lf(),[R,D]=d.useState(null),[O,z]=d.useState(!1);d.useEffect(()=>{w.get("new")==="1"&&(z(!0),E({},{replace:!0}))},[w,E]);const A=()=>{console.log("cancel"),z(!1)},C=async({title:L,description:P})=>{console.log(`save title: ${L} - description: ${P}`),D({name:L,description:P});try{const Y=await c({name:L,description:P});return Y?(D(Y),_(`/tasks/task/${Y.id}`),!0):!1}catch(Y){return console.error("Error saving task"),console.error(Y),v(Y),!1}};return a.jsx("div",{className:`${t?"full-height":""}`,children:t?a.jsxs("div",{className:"tasks-page",children:[a.jsx(SA,{tasks:l,animationByStatus:h}),a.jsxs("button",{className:"tasks-fab tasks-fab--desktop",type:"button",onClick:()=>z(!0),children:[a.jsx("span",{className:"tasks-fab__plus",children:"+"}),a.jsx("span",{className:"tasks-fab__label",children:"New task"})]}),O?a.jsx($h,{onCancel:A,onSave:C}):null]}):a.jsxs(a.Fragment,{children:[a.jsx(xA,{tasks:k,enteringIds:T.enteringIds,exitingTasks:T.exitingTasks,groupByDay:i===Se.DONE}),a.jsx("button",{className:"tasks-fab",type:"button",onClick:()=>z(!0),"aria-label":"Create new task",children:"+"}),O?a.jsx($h,{onCancel:A,onSave:C}):null]})})}function ec({tasks:n,status:t,animationState:i}){const l=d.useMemo(()=>n.filter(u=>u.status===t),[n,t]),c=Jn[t].label;return a.jsxs("div",{className:"tasks-board-column",children:[a.jsxs("div",{className:"tasks-board-column__header",children:[a.jsx(S,{size:"3",weight:"bold",children:c}),a.jsx(S,{size:"1",tone:"muted",children:l.length})]}),a.jsx("div",{className:"tasks-board-column__body",children:a.jsx(_A,{tasks:l,enteringIds:i.enteringIds,exitingTasks:i.exitingTasks,groupByDay:t===Se.DONE})})]})}function SA({tasks:n,animationByStatus:t}){return a.jsxs("div",{className:"tasks-board-view",children:[a.jsx(ec,{status:Se.NOT_STARTED,tasks:n,animationState:t[Se.NOT_STARTED]}),a.jsx(ec,{status:Se.IN_PROGRESS,tasks:n,animationState:t[Se.IN_PROGRESS]}),a.jsx(ec,{status:Se.FOR_REVIEW,tasks:n,animationState:t[Se.FOR_REVIEW]}),a.jsx(ec,{status:Se.DONE,tasks:n,animationState:t[Se.DONE]})]})}const jA=2200;function TA({trigger:n,durationMs:t=jA}){const[i,l]=d.useState(!1);return d.useEffect(()=>{if(n<=0)return;l(!0);const c=window.setTimeout(()=>l(!1),t);return()=>window.clearTimeout(c)},[n,t]),i?a.jsxs("div",{className:"shipped-celebration",style:{"--celebration-duration":`${t}ms`},"aria-hidden":"true",children:[a.jsx("div",{className:"shipped-celebration__veil"}),a.jsx("div",{className:"shipped-celebration__rocket",role:"presentation",children:"🚀"}),a.jsx("div",{className:"shipped-celebration__spark shipped-celebration__spark--one"}),a.jsx("div",{className:"shipped-celebration__spark shipped-celebration__spark--two"}),a.jsx("div",{className:"shipped-celebration__spark shipped-celebration__spark--three"})]}):null}const wA=window.location.origin,__=new ns({baseUrl:wA,credentials:"include"}),sl=__.taskBlueprints,$r=__.scheduledTasks;function kA(){const n=Dt(),{sectionTitle:t,shippedCelebrationTrigger:i,projects:l,projectsLoaded:c,selectedProjectId:u,setSelectedProjectId:h}=Bs(),m=De(),p=Mt(),[y,v]=d.useState(null),b=p.pathname==="/tasks/dependencies"||p.pathname.startsWith("/tasks/dependencies/"),x=["/tasks/not-started","/tasks/in-progress","/tasks/in-review","/tasks/done"].includes(p.pathname),_=x||b,k=x||b,T=a.jsx(CA,{isBoardView:x,isDependencyView:b,onBoardClick:()=>m("/tasks/not-started"),onDependenciesClick:()=>m("/tasks/dependencies")}),w=a.jsx(EA,{projects:l,projectsLoaded:c,selectedProjectId:u,onChange:h});return d.useEffect(()=>{let E=!0;return(async()=>{try{const D=await $r.ScheduledTasksController_listScheduledTasks({page:1,limit:50});if(!E)return;const O=D.items.filter(z=>z.enabled).length;v(O)}catch{E&&v(null)}})(),()=>{E=!1}},[]),a.jsxs("div",{style:{minHeight:0},children:[a.jsx(TA,{trigger:i}),n?a.jsx(Jr,{sectionTitle:t,titleAccessory:k?w:void 0,headerActions:a.jsxs("div",{className:"tasks-layout__header-actions",children:[_?T:null,a.jsxs(ce,{size:"sm",variant:"ghost",className:"tasks-layout__header-button",onClick:()=>m("/tasks/schedule"),children:[a.jsx(Pb,{className:"tasks-layout__header-icon",size:16,strokeWidth:1.5,absoluteStrokeWidth:!0}),"Schedule",y&&y>0?a.jsx("span",{className:"tasks-layout__schedule-badge",children:y}):null]})]}),children:a.jsx(Qt,{})}):a.jsx(Qa,{appTitle:"Tasks",sectionTitle:t,navItems:hA,topActions:k||_?a.jsxs("div",{className:"tasks-layout__mobile-top-actions",children:[k?w:null,_?a.jsx("div",{className:"tasks-layout__mobile-view-toggle",children:T}):null]}):void 0,children:a.jsx(Qt,{})})]})}function EA({projects:n,projectsLoaded:t,selectedProjectId:i,onChange:l}){const[c,u]=d.useState(!1),[h,m]=d.useState(""),p=d.useRef(null),y=d.useRef(null),v=n.find(k=>k.id===i)??null,b=h.trim().toLowerCase(),x=d.useMemo(()=>b?n.filter(k=>k.slug.toLowerCase().includes(b)||k.tagName.toLowerCase().includes(b)):n,[b,n]);d.useEffect(()=>{if(!c)return;const k=w=>{p.current?.contains(w.target)||u(!1)},T=w=>{w.key==="Escape"&&u(!1)};return document.addEventListener("pointerdown",k),document.addEventListener("keydown",T),window.setTimeout(()=>y.current?.focus(),0),()=>{document.removeEventListener("pointerdown",k),document.removeEventListener("keydown",T)}},[c]);const _=k=>{l(k),m(""),u(!1)};return a.jsxs("div",{className:"tasks-layout__project-selector",ref:p,children:[a.jsxs("button",{className:"tasks-layout__project-trigger",type:"button","aria-haspopup":"listbox","aria-expanded":c,"aria-label":"Task project",disabled:!t,onClick:()=>u(k=>!k),children:[a.jsx(zh,{className:"tasks-layout__project-selector-icon",size:15,strokeWidth:1.75,absoluteStrokeWidth:!0}),a.jsx("span",{className:"tasks-layout__project-trigger-label",children:v?.slug??"All projects"}),a.jsx(VE,{className:`tasks-layout__project-selector-chevron${c?" tasks-layout__project-selector-chevron--open":""}`,size:14,strokeWidth:1.75,absoluteStrokeWidth:!0})]}),c?a.jsxs("div",{className:"tasks-layout__project-menu",children:[a.jsx("input",{ref:y,className:"tasks-layout__project-search",type:"search",value:h,onChange:k=>m(k.target.value),placeholder:"Search projects","aria-label":"Search projects"}),a.jsxs("div",{className:"tasks-layout__project-options",role:"listbox","aria-label":"Task project",children:[a.jsx("button",{className:`tasks-layout__project-option${i===null?" tasks-layout__project-option--selected":""}`,type:"button",role:"option","aria-selected":i===null,onClick:()=>_(null),children:"All projects"}),x.length===0?a.jsx("div",{className:"tasks-layout__project-empty",children:"No matching projects"}):x.map(k=>a.jsxs("button",{className:`tasks-layout__project-option${i===k.id?" tasks-layout__project-option--selected":""}`,type:"button",role:"option","aria-selected":i===k.id,onClick:()=>_(k.id),children:[a.jsx("span",{className:"tasks-layout__project-option-name",children:k.slug}),a.jsx("span",{className:"tasks-layout__project-option-tag",children:k.tagName})]},k.id))]})]}):null]})}function CA({isBoardView:n,isDependencyView:t,onBoardClick:i,onDependenciesClick:l}){return a.jsxs("div",{className:"tasks-layout__view-toggle",role:"group","aria-label":"Task view",children:[a.jsxs("button",{className:`tasks-layout__view-toggle-button${n?" tasks-layout__view-toggle-button--active":""}`,type:"button","aria-pressed":n,onClick:i,children:[a.jsx(Fb,{className:"tasks-layout__header-icon",size:16,strokeWidth:1.5,absoluteStrokeWidth:!0}),"Board"]}),a.jsxs("button",{className:`tasks-layout__view-toggle-button${t?" tasks-layout__view-toggle-button--active":""}`,type:"button","aria-pressed":t,onClick:l,children:[a.jsx(Vb,{className:"tasks-layout__header-icon",size:16,strokeWidth:1.5,absoluteStrokeWidth:!0}),"Dependencies"]})]})}const NA={content:""},Jv=n=>{n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)};function AA({onCancel:n,onSave:t,taskId:i}){const[l,c,u]=ni({key:`new-comment-draft-${i}`,defaultValue:NA}),{content:h}=l,m=d.useRef(null);d.useEffect(()=>{m.current?.focus()},[]),d.useEffect(()=>{Jv(m.current)},[h]);function p(v){c({...l,content:v.target.value}),Jv(v.target)}async function y(){const v=await t({content:h});return v&&u(),v}return a.jsx(xt,{title:"Add Comment",onCancel:n,onSave:y,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"new-comment-pop__input-content",children:a.jsx("textarea",{className:"new-comment-pop__input-content",ref:m,placeholder:"Leave a comment...",value:h,onChange:p})})})})}const RA={answer:""},vh=n=>{n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)};function DA({onCancel:n,onSave:t,taskId:i,inputRequestId:l,question:c}){const[u,h,m]=ni({key:`answer-input-request-draft-${l}`,defaultValue:RA}),{answer:p}=u,y=d.useRef(null),v=d.useRef(null);d.useEffect(()=>{v.current?.focus()},[]),d.useEffect(()=>{vh(y.current)},[c]),d.useEffect(()=>{vh(v.current)},[p]);function b(_){h({...u,answer:_.target.value}),vh(_.target)}async function x(){const _=await t({answer:p});return _&&m(),_}return a.jsx(xt,{title:"Answer Input Request",onCancel:n,onSave:x,children:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"new-comment-pop__input-content",children:a.jsx("textarea",{className:"new-comment-pop__input-content",ref:y,value:c,readOnly:!0,style:{opacity:.7,cursor:"default"}})}),a.jsx("div",{className:"new-comment-pop__input-content",children:a.jsx("textarea",{className:"new-comment-pop__input-content",ref:v,placeholder:"Your answer...",value:p,onChange:b})})]})})}function OA({onCancel:n,onSave:t,existingTags:i}){const[l,c]=d.useState([]),[u,h]=d.useState(!0),[m,p]=d.useState(""),[y,v]=d.useState(0),[b,x]=d.useState(!1),_=d.useRef(null),k=d.useRef(null);d.useEffect(()=>{(async()=>{try{const z=await rb.metaControllerGetAllTags();c(z)}catch(z){console.error("Failed to load tags:",z)}finally{h(!1)}})()},[]),d.useEffect(()=>{_.current?.focus()},[]);const T=d.useMemo(()=>{const O=new Set(i.map(L=>L.id)),z=l.filter(L=>!O.has(L.id));if(!m.trim())return z;const A=m.toLowerCase().trim();return z.map(L=>{let P=0;return L.name.toLowerCase().startsWith(A)?P+=100:L.name.toLowerCase().includes(A)&&(P+=50),{tag:L,score:P}}).filter(L=>L.score>0).sort((L,P)=>P.score-L.score).map(L=>L.tag)},[l,i,m]),w=d.useMemo(()=>{if(!m.trim())return!1;const O=m.toLowerCase().trim();return!l.some(z=>z.name.toLowerCase()===O)},[m,l]);d.useEffect(()=>{v(0)},[T.length,m,w]),d.useEffect(()=>{if(k.current){const O=T.length+(w?1:0);if(y<O){const z=k.current.children[y];z&&z.scrollIntoView({block:"nearest"})}}},[y,T.length,w]);const E=d.useCallback(async O=>{if(b)return!1;x(!0);try{const z=await t(O);return z&&n?.(),z}finally{x(!1)}},[b,n,t]),R=d.useCallback(O=>{if(O.nativeEvent.isComposing)return;const z=T.length+(w?1:0);switch(O.key){case"ArrowDown":if(z===0)return;O.preventDefault(),v(A=>A<z-1?A+1:A);break;case"ArrowUp":if(z===0)return;O.preventDefault(),v(A=>A>0?A-1:0);break;case"Enter":O.preventDefault(),y<T.length?E(T[y]):w&&y===T.length&&E(xh(m));break;case"Escape":O.preventDefault(),n?.();break}},[w,T,y,n,m,E]);async function D(){if(T.length+(w?1:0)===0)return!1;if(y<T.length){const z=T[y];return z?E(z):!1}return w&&y===T.length?E(xh(m)):!1}return a.jsx(xt,{title:"Add Tag",onCancel:n,onSave:D,children:a.jsxs("div",{className:"tag-search-pop",children:[a.jsx("input",{ref:_,type:"text",className:"tag-search-pop__input",placeholder:"Search or create tag...",value:m,onChange:O=>p(O.target.value),onKeyDown:R}),a.jsx("div",{className:"tag-search-pop__list",ref:k,role:"listbox","aria-label":"Available tags",children:u?a.jsx("div",{className:"tag-search-pop__empty",children:a.jsx(S,{tone:"muted",children:"Loading tags..."})}):T.length===0&&!w?a.jsx("div",{className:"tag-search-pop__empty",children:a.jsx(S,{tone:"muted",children:"No tags found"})}):a.jsxs(a.Fragment,{children:[T.map((O,z)=>a.jsx("button",{type:"button",role:"option","aria-selected":z===y,className:`tag-search-pop__item ${z===y?"tag-search-pop__item--highlighted":""}`,onClick:()=>{E(O)},onMouseEnter:()=>v(z),disabled:b,children:a.jsx("div",{className:"tag-search-pop__tag-badge",style:{backgroundColor:O.color||"#999"},children:O.name})},O.id)),w&&a.jsxs("button",{type:"button",role:"option","aria-selected":y===T.length,className:`tag-search-pop__item tag-search-pop__item--create ${y===T.length?"tag-search-pop__item--highlighted":""}`,onClick:()=>{E(xh(m))},onMouseEnter:()=>v(T.length),disabled:b,children:[a.jsx(S,{size:"2",tone:"muted",children:"Create new tag:"}),a.jsx("div",{className:"tag-search-pop__tag-badge",style:{backgroundColor:"#999"},children:m.trim()})]})]})})]})})}function xh(n){return{id:"",name:n.trim(),color:void 0,createdAt:"",updatedAt:""}}function zA({onCancel:n,onSave:t,excludeTaskIds:i}){const[l,c]=d.useState(""),[u,h]=d.useState(0),[m,p]=d.useState([]),[y,v]=d.useState(!1),[b,x]=d.useState(null),[_,k]=d.useState(!1),T=d.useRef(null),w=d.useRef(null),E=d.useRef(0);d.useEffect(()=>{T.current?.focus()},[]),d.useEffect(()=>{const C=l.trim();if(!C){E.current=E.current+1,p([]),x(null),v(!1);return}const L=E.current+1;E.current=L,v(!0),x(null);const P=window.setTimeout(async()=>{try{const Y=await Xt.TasksController_searchTasks({query:C,limit:20});if(E.current!==L)return;p(Y??[])}catch(Y){if(E.current!==L)return;x(Y instanceof Error?Y.message:"Failed to search tasks"),p([])}finally{E.current===L&&v(!1)}},200);return()=>{window.clearTimeout(P)}},[l]);const R=d.useMemo(()=>{const C=new Set(i);return m.filter(L=>!C.has(L.id))},[m,i]);d.useEffect(()=>{h(0)},[R.length,l]),d.useEffect(()=>{if(w.current){const C=w.current.children[u];C&&C.scrollIntoView({block:"nearest"})}},[u]);const D=d.useCallback(async C=>{if(_)return!1;k(!0);try{const L=await Xt.TasksController_getTask({id:C.id}),P=await t(L);return P&&n?.(),P}catch(L){return console.error("Failed to fetch task details:",L),!1}finally{k(!1)}},[_,n,t]),O=d.useCallback(()=>{if(R.length===0)return;const C=R[u];C&&D(C)},[R,u,D]),z=d.useCallback(C=>{if(!C.nativeEvent.isComposing)switch(C.key){case"ArrowDown":if(R.length===0)return;C.preventDefault(),h(L=>L<R.length-1?L+1:L);break;case"ArrowUp":if(R.length===0)return;C.preventDefault(),h(L=>L>0?L-1:0);break;case"Enter":C.preventDefault(),O();break;case"Escape":C.preventDefault(),n?.();break}},[R,O,n]);async function A(){if(R.length===0)return!1;const C=R[u];return C?D(C):!1}return a.jsx(xt,{title:"Add Dependency",onCancel:n,onSave:A,children:a.jsxs("div",{className:"task-search-pop",children:[a.jsx("input",{ref:T,type:"text",className:"task-search-pop__input",placeholder:"Search tasks...",value:l,onChange:C=>c(C.target.value),onKeyDown:z}),a.jsx("div",{className:"task-search-pop__list",ref:w,role:"listbox","aria-label":"Tasks",children:R.length===0?a.jsx("div",{className:"task-search-pop__empty",children:a.jsx(S,{tone:"muted",children:l.trim()?y?"Searching tasks...":b||"No tasks found":"Type to search for tasks"})}):R.map((C,L)=>a.jsx("button",{type:"button",role:"option","aria-selected":L===u,className:`task-search-pop__item ${L===u?"task-search-pop__item--highlighted":""}`,onClick:()=>{D(C)},onMouseEnter:()=>h(L),disabled:_,children:a.jsxs("div",{className:"task-search-pop__item-info",children:[a.jsx(S,{weight:"medium",size:"2",children:C.name}),a.jsxs(S,{tone:"muted",size:"1",style:"mono",children:["#",C.id.slice(0,6)]})]})},C.id))})]})})}Le.BASE=Va;const S_=d.createContext(null);function LA({children:n}){const[t,i]=d.useState([]),[l,c]=d.useState(!1),[u,h]=d.useState(null),m=d.useCallback(async()=>{c(!0),h(null);try{const v=await ab.actorControllerListActors();i(v||[])}catch(v){h(v instanceof Error?v.message:"Failed to load actors")}finally{c(!1)}},[]);d.useEffect(()=>{m()},[m]);const p=d.useCallback(async()=>{await m()},[m]),y=d.useMemo(()=>({actors:t,isLoading:l,error:u,refreshActors:p}),[t,l,u,p]);return a.jsx(S_.Provider,{value:y,children:n})}function wl(){const n=d.useContext(S_);if(!n)throw new Error("useActorsCtx must be used within <ActorsProvider>");return n}function MA({onCancel:n,onSave:t}){const{actors:i,isLoading:l,error:c,refreshActors:u}=wl(),[h,m]=d.useState(""),[p,y]=d.useState(0),[v,b]=d.useState(null),[x,_]=d.useState(!1),[k,T]=d.useState(null),[w,E]=d.useState(!1),R=d.useRef(null),D=d.useRef(null),O=d.useRef(0);d.useEffect(()=>{R.current?.focus()},[]),d.useEffect(()=>{u().catch(()=>{})},[u]),d.useEffect(()=>{const Y=h.trim();if(!Y){b(null),T(null),_(!1);return}const U=O.current+1;O.current=U,_(!0),T(null);const re=window.setTimeout(async()=>{try{const Q=await ab.actorControllerSearchActors(Y,20);if(O.current!==U)return;b(Q??[])}catch(Q){if(O.current!==U)return;T(Q instanceof Error?Q.message:"Failed to search actors"),b([])}finally{O.current===U&&_(!1)}},200);return()=>{window.clearTimeout(re)}},[h]);const z=d.useMemo(()=>h.trim()?v??[]:i,[i,h,v]);d.useEffect(()=>{y(0)},[z.length,h]),d.useEffect(()=>{if(D.current){const Y=D.current.children[p];Y&&Y.scrollIntoView({block:"nearest"})}},[p]);const A=d.useCallback(async Y=>{if(w)return!1;E(!0);try{const U=await t(Y);return U&&n?.(),U}finally{E(!1)}},[w,n,t]),C=d.useCallback(()=>{if(z.length===0)return;const Y=z[p];Y&&A(Y)},[z,p,A]),L=d.useCallback(Y=>{if(!Y.nativeEvent.isComposing)switch(Y.key){case"ArrowDown":if(z.length===0)return;Y.preventDefault(),y(U=>U<z.length-1?U+1:U);break;case"ArrowUp":if(z.length===0)return;Y.preventDefault(),y(U=>U>0?U-1:0);break;case"Enter":Y.preventDefault(),C();break}},[z,C]);async function P(){if(z.length===0)return!1;const Y=z[p];return Y?A(Y):!1}return a.jsx(xt,{title:"Assign Task",onCancel:n,onSave:P,children:a.jsxs("div",{className:"actor-search-pop",children:[a.jsx("input",{ref:R,type:"text",className:"actor-search-pop__input",placeholder:"Search by name or @slug...",value:h,onChange:Y=>m(Y.target.value),onKeyDown:L}),a.jsx("div",{className:"actor-search-pop__list",ref:D,role:"listbox","aria-label":"Assignees",children:z.length===0?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(S,{tone:"muted",children:h.trim()?x?"Searching actors...":k||"No actors found":l?"Loading actors...":c||"No actors found"})}):z.map((Y,U)=>a.jsxs("button",{type:"button",role:"option","aria-selected":U===p,className:`actor-search-pop__item ${U===p?"actor-search-pop__item--highlighted":""}`,onClick:()=>{A(Y)},onMouseEnter:()=>y(U),disabled:w,children:[a.jsx(He,{name:Y.displayName,size:"sm",src:Y.avatarUrl||void 0}),a.jsxs("div",{className:"actor-search-pop__item-info",children:[a.jsx(S,{weight:"medium",size:"2",children:Y.displayName}),a.jsxs(S,{tone:"muted",size:"1",children:["@",Y.slug," · ",Y.type]})]})]},Y.id))})]})})}const IA=window.location.origin,qA=new ns({baseUrl:IA,credentials:"include"}),Bn=qA.threads,UA=window.location.origin,BA=new ns({baseUrl:UA,credentials:"include"}),Pa=BA.executions,$A=(n,t)=>{const i=t.find(l=>l.job==="conversation");return i?.isReady?{isReady:!0,title:"Thread chat is ready",description:"Your conversation tools are online.",ctaLabel:"Open model settings"}:i?.modelId?{isReady:!1,title:"Thread chat needs one more step",description:"A conversation model is picked, but its provider still needs credentials before threads can talk back.",ctaLabel:"Finish provider setup"}:n.some(l=>l.isConfigured)?{isReady:!1,title:"Your next level is one pick away",description:"A provider is connected, but no conversation model is picked yet. Choose one in model settings to open the thread portal.",ctaLabel:"Pick a model"}:{isReady:!1,title:"Thread chat is waiting at the gate",description:"Connect an AI provider and pick a conversation model to unlock new threads and live conversation.",ctaLabel:"Set up chat"}},PA=(n,t)=>{const i=t.find(c=>c.job==="conversation"),l=n.find(c=>c.id===i?.effectiveAiProviderId);return i?.isReady&&i.effectiveModelId&&l?{providerName:l.name,modelId:i.effectiveModelId}:null};function si(){const[n,t]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(!0),h=d.useCallback(async()=>{u(!0);try{const[m,p]=await Promise.all([Ua.aiProvidersControllerListAiProviders(),hl.aiModelSelectionsControllerListAiModelSelections()]);t($A(m,p)),l(PA(m,p))}catch{t(null),l(null)}finally{u(!1)}},[]);return d.useEffect(()=>{h()},[h]),{readiness:n,conversationModel:i,isLoading:c,isReady:n?.isReady??!0,refresh:h}}function Oc({title:n,description:t,ctaLabel:i,onOpenSettings:l,className:c}){return a.jsxs("div",{className:`chat-setup-callout ${c??""}`.trim(),children:[a.jsx("div",{className:"chat-setup-callout__badge",children:"Thread Chat"}),a.jsxs(ee,{spacing:"3",children:[a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"4",weight:"semibold",children:n}),a.jsx(S,{tone:"muted",children:t}),a.jsx(S,{size:"1",tone:"muted",children:"Visit `/settings/models` to wire it up."})]}),a.jsx("div",{className:"chat-setup-callout__actions",children:a.jsx(ce,{variant:"primary",onClick:l,children:i})})]})]})}function Ph(n){return n===Se.DONE?{label:"done",color:"purple"}:n===Se.IN_PROGRESS?{label:"in progress",color:"green"}:n===Se.NOT_STARTED?{label:"not started",color:"blue"}:n===Se.FOR_REVIEW?{label:"in review",color:"orange"}:{label:"unknown",color:"gray"}}const bh=3,_h=3,HA=600*1e3,GA="We haven't seen activity in a while. If the worker doesn't report back, we'll mark this run as stale and revert the task to its previous state, where another agent will pick it";function j_({task:n,backPath:t,setSectionTitle:i,isLoadingTask:l=!1,activityByTaskId:c={},handlers:u,allTasks:h}){const m=De(),{actors:p}=wl(),{user:y}=un(),{showError:v,showToast:b}=dn(),{registerCommands:x}=Tl(),{readiness:_,isReady:k,isLoading:T}=si(),[w,E]=d.useState(null),[R,D]=d.useState("idle"),[O,z]=d.useState(!1),[A,C]=d.useState(!1),L=d.useRef(null),P=d.useRef(null),Y=3500,U=220;vt({task:{name:n?.name}});const re=d.useCallback(async oe=>{if(n)try{await u.changeStatus({taskId:n.id,status:oe})}catch(ve){v(ve)}},[n,u,v]),[Q,J]=d.useState(null),[ye,B]=d.useState(!1),se=d.useCallback(async()=>{if(n){if(!k){b("Thread chat unlocks in Chat Settings.","info"),m("/settings/models");return}B(!0);try{if(Q){m(`/threads/${Q}`);return}const oe=await Bn.ThreadsController_createThread({body:{title:n.name,parentTaskId:n.id}});J(oe.id),m(`/threads/${oe.id}`)}catch(oe){v(oe)}finally{B(!1)}}},[n,Q,k,m,v,b]);d.useEffect(()=>{if(!n){J(null);return}let oe=!1;return B(!0),Bn.ThreadsController_getThreadByTaskId({taskId:n.id}).then(ve=>{oe||J(ve?.id??null)}).catch(ve=>{oe||(v(ve),J(null))}).finally(()=>{oe||B(!1)}),()=>{oe=!0}},[n,v]);const ge=d.useMemo(()=>!n||!n.dependsOnIds||n.dependsOnIds.length===0?[]:n.dependsOnIds.map(oe=>h.find(ve=>ve.id===oe)).filter(oe=>oe!==void 0),[n,h]);d.useEffect(()=>{if(!n)return;const oe={[Se.NOT_STARTED]:["not started","to do","todo","queued"],[Se.IN_PROGRESS]:["in progress","doing","building"],[Se.FOR_REVIEW]:["for review","review","in review"],[Se.DONE]:["done","shipped","release","complete"]},ve=Object.entries(Jn).map(([bt,Ot])=>({id:`task-status-${bt}`,label:Ot.label,description:`Mark task as ${Ot.label.toLowerCase()}`,aliases:oe[bt],onSelect:()=>re(bt)})),Fe=[{id:"task-add-comment",label:"Comment",description:"Add a comment to this task",aliases:["add comment","note"],onSelect:()=>pe(!0)},{id:"task-assign",label:"Assign",description:"Assign this task to someone",aliases:["reassign","assignee"],onSelect:()=>Te(!0)},{id:"task-assign-to-me",label:"Assign to Me",description:"Assign this task to yourself",aliases:["claim","take"],onSelect:()=>{u.assignTaskToMe({taskId:n.id}).catch(v)}},{id:"task-add-tag",label:"Tag",description:"Add a tag to this task",aliases:["add tag","label"],onSelect:()=>ht(!0)},{id:"task-thread-action",label:Q?"Go to thread":"Create thread",description:Q?"Open this task thread":"Create a thread from this task",aliases:["thread","open thread","create thread","chat"],onSelect:()=>{se()}}];return x([...ve,...Fe])},[n,x,re,u,v,Q,se]),d.useEffect(()=>{if(l){i("Loading task...");return}if(!n){i("Task");return}i(n.name)},[n,l,i]),d.useEffect(()=>()=>{L.current&&window.clearTimeout(L.current),P.current&&window.clearTimeout(P.current)},[]);const[Ee,Ce]=d.useState(null),[M,H]=d.useState(!1),[de,fe]=d.useState([]),[V,ie]=d.useState(!1),[te,be]=d.useState(null),[Re,Ze]=d.useState(()=>Date.now()),[It,et]=d.useState(new Set),[wt,ue]=d.useState(new Set),[X,pe]=d.useState(!1),[Z,Te]=d.useState(!1),[tt,ht]=d.useState(!1),[qt,wn]=d.useState(!1),[kt,mt]=d.useState(null),ms=d.useCallback(oe=>{et(ve=>{const Fe=new Set(ve);return Fe.has(oe)?Fe.delete(oe):Fe.add(oe),Fe})},[]),gs=d.useCallback(async(oe,ve,Fe)=>{if(confirm(`Are you sure you want to interrupt the active execution for "${ve??"this task"}"?`)){ue(bt=>new Set(bt).add(oe));try{await Pa.ActiveTaskExecutionController_interruptExecution({executionId:oe}),b(`Interrupt signal sent for "${ve??"this task"}"`)}catch(bt){v(bt)}finally{ue(bt=>{const Ot=new Set(bt);return Ot.delete(oe),Ot})}}},[b,v]);d.useEffect(()=>{const oe=ve=>{if(!n||ve.defaultPrevented||ve.metaKey||ve.ctrlKey||ve.altKey||X||Z||tt||qt||kt||XA(ve.target))return;const Fe=ve.key.toLowerCase();Fe==="a"?(ve.preventDefault(),Te(!0)):Fe==="c"?(ve.preventDefault(),pe(!0)):Fe==="t"&&(ve.preventDefault(),ht(!0))};return window.addEventListener("keydown",oe),()=>window.removeEventListener("keydown",oe)},[n,X,Z,tt,qt,kt]);const xa=async({content:oe})=>{if(!n)return!1;try{return await u.addComment({taskId:n.id,comment:oe}),!0}catch(ve){return v(ve),!1}},$s=()=>{pe(!1)},ri=async oe=>{if(!n)return!1;try{return await u.assignTask({taskId:n.id,assigneeActorId:oe.id}),!0}catch(ve){return v(ve),!1}},Wa=()=>{Te(!1)},ii=async({answer:oe})=>{if(!n||!kt)return!1;try{return await u.answerInputRequest({taskId:n.id,inputRequestId:kt.id,answer:oe}),!0}catch(ve){return v(ve),!1}},li=()=>{mt(null)},ys=async oe=>{if(!n)return!1;try{return await u.addTag({taskId:n.id,tag:oe}),!0}catch(ve){return v(ve),!1}},Pt=()=>{ht(!1)},kn=async oe=>{if(n)try{await u.removeTag({taskId:n.id,tagId:oe})}catch(ve){v(ve)}},Ht=async oe=>{if(!n)return!1;try{return await u.addDependency({taskId:n.id,dependencyTaskId:oe.id}),!0}catch(ve){return v(ve),!1}},oi=()=>{wn(!1)},ci=async oe=>{if(n)try{await u.removeDependency({taskId:n.id,dependencyTaskId:oe})}catch(ve){v(ve)}},Gn=n?c[n.id]:null;d.useEffect(()=>{z(!1),C(!1)},[n?.id]);const Vn=d.useCallback(async oe=>{ie(!0);try{const[ve,Fe]=await Promise.all([Pa.ActiveTaskExecutionController_listActiveExecutions({taskId:oe,limit:100}),Pa.TaskExecutionHistoryController_listHistory({taskId:oe,limit:100})]),bt=ve.items.map(me=>({id:`active-${me.id}`,executionId:me.id,agentActorId:me.agentActorId,status:"ACTIVE",source:"active",timestamp:me.claimedAt,lastActivityAt:me.lastHeartbeatAt??me.claimedAt,runnerSessionId:me.runnerSessionId,toolCallCount:me.toolCallCount,errorCode:null,errorMessage:null})),Ot=Fe.items.map(me=>({id:`history-${me.id}`,executionId:me.id,agentActorId:me.agentActorId,status:me.status,source:"history",timestamp:me.transitionedAt,lastActivityAt:me.transitionedAt,runnerSessionId:me.runnerSessionId,toolCallCount:me.toolCallCount,errorCode:me.errorCode,errorMessage:me.errorMessage})),he=[...bt,...Ot].sort((me,gt)=>new Date(gt.timestamp).getTime()-new Date(me.timestamp).getTime());fe(he),be(null)}catch(ve){const Fe=ve instanceof Error?ve.message:"Failed to load runs for this task";be(Fe)}finally{ie(!1)}},[]),hn=d.useMemo(()=>n?[...n.comments.map(oe=>({type:"comment",data:oe,timestamp:new Date(oe.createdAt).getTime()})),...n.inputRequests.map(oe=>({type:"inputRequest",data:oe,timestamp:new Date(oe.createdAt).getTime()}))].sort((oe,ve)=>oe.timestamp-ve.timestamp):[],[n]),ss=O?hn:hn.slice(0,bh),Fn=hn.length>bh,Ps=A?de:de.slice(0,_h),En=de.length>_h;if(d.useEffect(()=>{if(!de.some(ve=>ve.source==="active"))return;Ze(Date.now());const oe=window.setInterval(()=>{Ze(Date.now())},30*1e3);return()=>window.clearInterval(oe)},[de]),d.useEffect(()=>{if(!n){fe([]),be(null),et(new Set);return}et(new Set),Vn(n.id)},[n,Vn]),d.useEffect(()=>{!n||!Gn||Gn.kind.startsWith("execution.")&&Vn(n.id)},[Gn,n,Vn]),d.useEffect(()=>{!n||!Gn||!Gn.message||(L.current&&window.clearTimeout(L.current),P.current&&window.clearTimeout(P.current),E(Gn),D("enter"),L.current=window.setTimeout(()=>{D("exit"),P.current=window.setTimeout(()=>{E(null),D("idle")},U)},Y))},[Gn,n,U,Y]),!n&&l)return a.jsx(FA,{backPath:t});if(!n)return a.jsx("div",{className:"task-detail-page",children:a.jsxs(ee,{spacing:"4",align:"center",children:[a.jsx(S,{size:"3",tone:"muted",children:"Task not found"}),a.jsx(ce,{variant:"secondary",onClick:()=>m(t),children:"Back to tasks"})]})});const Hs=async oe=>{H(!0);try{await u.changeStatus({taskId:n.id,status:oe}),Ce(null)}catch(ve){v(ve)}finally{H(!1)}};return a.jsxs("div",{className:"task-detail-page",children:[Ee&&a.jsxs(Zt,{children:[a.jsx("button",{onClick:()=>Ce(null),className:"task-detail-page__error-close",children:"×"}),Ee]}),a.jsxs(xe,{className:"task-detail-page__section",children:[a.jsxs(_e,{leading:a.jsx(He,{size:"sm",name:n.createdByActor.displayName,src:n.createdByActor.avatarUrl||void 0}),tags:[Ph(n.status),...n.tags.map(oe=>({label:oe.name,onRemove:()=>kn(oe.id)})),{label:"+ add tag",color:"gray",onClick:()=>ht(!0),clickLabel:"Add tag"}],topRight:a.jsx(S,{size:"1",tone:"muted",children:Lt(n.updatedAt)}),children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:n.createdByActor.displayName}),a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${n.createdByActor.slug} created `}),a.jsxs(S,{as:"span",tone:"muted",style:"mono",children:["#",n.id.slice(0,6)]}),n.assigneeActor?null:a.jsx(S,{tone:"muted",children:"unassigned"})]}),n.assigneeActor?a.jsxs(_e,{leading:a.jsx(He,{size:"sm",name:n.assigneeActor.displayName,src:n.assigneeActor.avatarUrl||void 0}),onClick:()=>Te(!0),children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:n.assigneeActor.displayName}),a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${n.assigneeActor.slug} assigned`}),a.jsx(S,{size:"1",tone:"muted",children:"tap to reassign"})]}):null]}),n.artefacts&&n.artefacts.length>0&&a.jsx(xe,{className:"task-detail-page__section",children:n.artefacts.map(oe=>a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:`${oe.name}: `}),a.jsx(S,{as:"span",children:a.jsx("a",{href:oe.link,target:"_blank",rel:"noopener noreferrer",style:{color:"var(--accent)",textDecoration:"underline"},children:oe.link})})]},oe.id))}),(ge.length>0||n)&&a.jsxs(xe,{title:"Depends on",className:"task-detail-page__section",action:ge.length>0?a.jsxs(ce,{size:"sm",variant:"ghost",className:"task-detail-page__dependency-graph-button",onClick:()=>m(`/tasks/dependencies/${n.id}`),children:[a.jsx(Vb,{className:"task-detail-page__dependency-graph-icon",size:14,strokeWidth:1.5,absoluteStrokeWidth:!0}),"View graph"]}):void 0,children:[ge.map(oe=>a.jsx(fl,{task:oe,onClick:()=>m(`/tasks/task/${oe.id}`),additionalTags:[{label:"× remove",color:"red",onClick:()=>ci(oe.id),clickLabel:"Remove dependency"}]},oe.id)),a.jsx(_e,{tags:[{label:"+ add dependency",color:"gray",onClick:()=>wn(!0),clickLabel:"Add dependency"}],children:a.jsx(S,{tone:"muted",size:"2",children:ge.length===0?"No dependencies yet":"Add another dependency"})})]}),a.jsx(xe,{className:"task-detail-page__section",children:a.jsxs(_e,{leading:a.jsx(He,{size:"sm",name:n.createdByActor.displayName,src:n.createdByActor.avatarUrl||void 0}),tags:[],topRight:a.jsx(S,{size:"1",tone:"muted",children:Lt(n.createdAt)}),children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:n.createdByActor.displayName}),a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${n.createdByActor.slug}`}),a.jsx(S,{children:n.description?n.description:"no description"})]})}),a.jsxs(xe,{title:"Updates",className:"task-detail-page__section",children:[hn.length===0?a.jsx(S,{className:"task-detail-page__executions-state",tone:"muted",children:"No updates yet."}):null,ss.map(oe=>{if(oe.type==="comment"){const Je=oe.data,Gt=Je.commenterActor?.displayName||"unknown",Gs=Je.commenterActor?.slug||"unknown";return a.jsxs(_e,{leading:a.jsx(He,{size:"sm",name:Gt,src:Je.commenterActor?.avatarUrl||void 0}),topRight:a.jsx(S,{size:"1",tone:"muted",children:Lt(Je.createdAt)}),children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:Gt}),a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${Gs}`}),a.jsx(S,{children:Je.content})]},`comment-${Je.id}`)}const ve=oe.data,Fe=p.find(Je=>Je.id===ve.askedByActorId),bt=p.find(Je=>Je.id===ve.assignedToActorId),Ot=Fe?.displayName||"Unknown",he=Fe?.slug||"unknown",me=bt?.displayName||"Unknown",gt=bt?.slug||"unknown",as=!!ve.resolvedAt,ba=y&&ve.assignedToActorId===y.actorId,_a=typeof ve.answer=="string"?ve.answer:JSON.stringify(ve.answer),fn=as?[{label:"resolved question",color:"gray"},{label:"answer",color:"green"}]:[{label:"question",color:"orange"}];return a.jsx(_e,{leading:as?a.jsxs("div",{className:"task-detail-page__input-request-avatars",children:[a.jsx(He,{size:"sm",name:Ot,src:Fe?.avatarUrl||void 0}),a.jsx(He,{size:"sm",name:me,src:bt?.avatarUrl||void 0})]}):a.jsx(He,{size:"sm",name:Ot,src:Fe?.avatarUrl||void 0}),tags:fn,topRight:a.jsx(S,{size:"1",tone:"muted",children:Lt(ve.createdAt)}),children:a.jsxs(ee,{spacing:"2",children:[a.jsxs("div",{className:"task-detail-page__input-request",children:[a.jsxs("div",{className:"task-detail-page__input-request-question",children:[a.jsxs("div",{className:"task-detail-page__input-request-header",children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:Ot}),a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${he}`})]}),a.jsxs(S,{children:[a.jsx(S,{as:"span",tone:"muted",children:"Asked:"})," ",ve.question]})]}),as?a.jsxs("div",{className:"task-detail-page__input-request-answer",children:[a.jsxs("div",{className:"task-detail-page__input-request-header",children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:me}),a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${gt}`})]}),a.jsxs(S,{children:[a.jsx(S,{as:"span",tone:"muted",children:"Answered:"})," ",_a]})]}):null]}),!as&&ba&&a.jsx(ce,{size:"sm",variant:"primary",onClick:()=>mt(ve),children:"Respond"})]})},`input-request-${ve.id}`)}),Fn?a.jsx("div",{className:"task-detail-page__section-toggle",children:a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>z(oe=>!oe),children:O?"Show fewer updates":`See ${hn.length-bh} more updates`})}):null]}),a.jsx(xe,{className:"task-detail-page__section",children:a.jsx("div",{className:"task-detail-page__activity",children:a.jsxs("div",{className:`task-detail-page__activity-slot ${w?"task-detail-page__activity-slot--active":""}`,children:[a.jsx("div",{className:"task-detail-page__activity-placeholder",children:a.jsx(S,{size:"2",tone:"muted",children:"Live activity will show here"})}),w?a.jsx("div",{className:`task-detail-page__activity-card ${R==="enter"?"is-entering":""} ${R==="exit"?"is-exiting":""}`,children:a.jsx(S,{size:"2",className:"task-detail-page__activity-message",children:w.message?.replace(/\s+/g," ").trim()||"Activity in progress..."})}):null]})})}),a.jsxs(xe,{title:"Runs",className:"task-detail-page__section",children:[V&&de.length===0?a.jsx(S,{className:"task-detail-page__executions-state",tone:"muted",children:"Loading runs..."}):null,te?a.jsxs(S,{className:"task-detail-page__executions-state",tone:"muted",children:["Failed to load runs: ",te]}):null,!V&&!te&&de.length===0?a.jsx(S,{className:"task-detail-page__executions-state",tone:"muted",children:"No runs yet for this task."}):null,Ps.map(oe=>{const ve=p.find(Je=>Je.id===oe.agentActorId),Fe=ve?.displayName??Sh(oe.agentActorId),bt=ve?.slug,Ot=YA(oe.status),he=oe.status==="FAILED"&&!!(oe.errorCode||oe.errorMessage),me=It.has(oe.id),gt=oe.source==="active",as=gt&&KA(oe,Re),ba=wt.has(oe.executionId),_a={label:gt?"active":"history",color:"gray"},fn=as?{label:"Potentially stale",color:"orange",title:GA}:null;return a.jsx(_e,{leading:a.jsx(He,{size:"sm",name:Fe,src:ve?.avatarUrl||void 0}),tags:fn?[Ot,_a,fn]:[Ot,_a],topRight:gt?a.jsx(ce,{variant:"danger",size:"sm",disabled:ba,onClick:()=>{gs(oe.executionId,n?.name,n?.id??"")},children:ba?"Interrupting…":"Interrupt"}):a.jsx(S,{size:"1",tone:"muted",children:Lt(oe.timestamp)}),children:a.jsxs(ee,{spacing:"1",children:[a.jsxs("div",{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:Fe}),a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:bt?` @${bt}`:""})]}),a.jsx(S,{as:"span",tone:"muted",size:"2",children:a.jsxs("span",{className:"task-detail-page__execution-meta",children:["run #",Sh(oe.executionId),he?a.jsx("button",{type:"button",className:"task-detail-page__execution-error-toggle",onClick:()=>ms(oe.id),"aria-label":me?"Hide failure details":"Show failure details","aria-expanded":me,title:me?"Hide failure details":"Show failure details",children:"i"}):null]})}),a.jsx(S,{as:"span",size:"1",tone:"muted",children:a.jsxs("span",{className:"task-detail-page__execution-stats",children:["tools: ",oe.toolCallCount,a.jsx("span",{className:"task-detail-page__execution-stats-separator",children:"|"}),"session: ",oe.runnerSessionId?Sh(oe.runnerSessionId):"pending",gt?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"task-detail-page__execution-stats-separator",children:"|"}),"heartbeat ",Lt(oe.lastActivityAt)]}):null]})}),he&&me?a.jsxs("div",{className:"task-detail-page__execution-error-detail",children:[oe.errorCode?a.jsx(S,{as:"span",size:"1",style:"mono",className:"task-detail-page__execution-error-code",children:oe.errorCode}):null,oe.errorMessage?a.jsx(S,{as:"span",size:"2",wrap:!0,children:oe.errorMessage}):null]}):null]})},oe.id)}),En?a.jsx("div",{className:"task-detail-page__section-toggle",children:a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>C(oe=>!oe),children:A?"Show fewer runs":`See ${de.length-_h} more runs`})}):null]}),a.jsx(xe,{className:"task-detail-page__status-buttons",children:Object.entries(Jn).map(([oe,ve])=>{const Fe=ve.icon;return a.jsx(ce,{size:"sm",variant:oe===n.status?"primary":"secondary",onClick:()=>Hs(oe),disabled:M,children:a.jsxs(ee,{spacing:"1",align:"center",children:[a.jsx(Fe,{size:20}),a.jsx("div",{children:ve.label})]})},oe)})}),a.jsx(ce,{className:"task-detail-fab",onClick:()=>pe(!0),variant:"primary",size:"lg",children:"Add Comment"}),!n.assigneeActor&&a.jsxs(xe,{className:"task-detail-page__comment-buttons",children:[a.jsx(ce,{size:"lg",onClick:()=>Te(!0),children:"Assign"}),a.jsx(ce,{size:"lg",variant:"primary",onClick:async()=>{await u.assignTaskToMe({taskId:n.id})},children:"Assign to Me"})]}),a.jsx(ei,{className:"task-detail-page__comment-buttons",onDelete:async()=>{try{await u.deleteTask({taskId:n.id}),m(t)}catch(oe){v(oe)}}}),a.jsxs(xe,{className:"task-detail-page__actions",children:[!T&&_&&!_.isReady?a.jsx(Oc,{title:_.title,description:_.description,ctaLabel:_.ctaLabel,onOpenSettings:()=>m("/settings/models")}):null,a.jsx(ce,{size:"lg",variant:Q?"primary":"secondary",onClick:()=>{se()},disabled:ye||!k||T,children:Q?"Go to thread":"Create thread"}),a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>m(t),children:"Back to Tasks"})]}),X?a.jsx(AA,{onCancel:$s,onSave:xa,taskId:n.id}):null,Z?a.jsx(MA,{onCancel:Wa,onSave:ri}):null,tt?a.jsx(OA,{onCancel:Pt,onSave:ys,existingTags:n.tags}):null,qt?a.jsx(zA,{onCancel:oi,onSave:Ht,excludeTaskIds:[n.id,...n.dependsOnIds||[]]}):null,kt?a.jsx(DA,{onCancel:li,onSave:ii,taskId:n.id,inputRequestId:kt.id,question:kt.question}):null]})}function VA(){const{d:n}=Jt(),{tasks:t,detailTasks:i,getTaskById:l,isLoading:c,hasLoadedOnce:u,setSectionTitle:h,addComment:m,deleteTask:p,assignTask:y,assignTaskToMe:v,answerInputRequest:b,activityByTaskId:x}=Bs(),[_,k]=d.useState(!1),T=d.useMemo(()=>{const D=new Map;for(const O of t)D.set(O.id,O);for(const O of i)D.set(O.id,O);return Array.from(D.values())},[t,i]),w=n?T.find(D=>D.id===n):void 0;d.useEffect(()=>{if(!n)return;let D=!1;return k(!0),l(n).catch(O=>console.error("Failed to fetch task",O)).finally(()=>{D||k(!1)}),()=>{D=!0}},[n,l]),d.useEffect(()=>{if(!w||!w.dependsOnIds||w.dependsOnIds.length===0)return;const D=w.dependsOnIds.filter(O=>!T.some(z=>z.id===O));D.length!==0&&Promise.all(D.map(O=>l(O).catch(z=>(console.error(`Failed to hydrate dependency ${O}`,z),null))))},[w,T,l]);const E=!w&&(!u||c||_),R={addComment:({taskId:D,comment:O})=>m({taskId:D,comment:O}),deleteTask:({taskId:D})=>p({taskId:D}),assignTask:({taskId:D,assigneeActorId:O})=>y({taskId:D,assigneeActorId:O}),assignTaskToMe:({taskId:D})=>v({taskId:D}),answerInputRequest:({taskId:D,inputRequestId:O,answer:z})=>b({taskId:D,inputRequestId:O,answer:z}),changeStatus:({taskId:D,status:O})=>Xt.TasksController_changeStatus({id:D,body:{status:O}}),addTag:({taskId:D,tag:O})=>Xt.TasksController_addTagToTask({id:D,body:{name:O.name}}),removeTag:({taskId:D,tagId:O})=>Xt.TasksController_removeTagFromTask({id:D,tagId:O}),addDependency:async({taskId:D,dependencyTaskId:O})=>{const z=T.find(C=>C.id===D);if(!z)return;const A=[...z.dependsOnIds||[],O];await Xt.TasksController_updateTask({id:D,body:{dependsOnIds:A}});try{await l(O)}catch(C){console.error(`Failed to hydrate dependency ${O} after adding`,C)}},removeDependency:async({taskId:D,dependencyTaskId:O})=>{const z=T.find(C=>C.id===D);if(!z)return;const A=(z.dependsOnIds||[]).filter(C=>C!==O);await Xt.TasksController_updateTask({id:D,body:{dependsOnIds:A}})}};return a.jsx(j_,{task:w,backPath:"/tasks",setSectionTitle:h,isLoadingTask:E,activityByTaskId:x,handlers:R,allTasks:T})}function FA({backPath:n}){const t=De();return a.jsxs("div",{className:"task-detail-page",children:[a.jsxs(xe,{className:"task-detail-page__section task-detail-page__shell-container",children:[a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--wide"}),a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--mid"})]}),a.jsxs(xe,{className:"task-detail-page__section task-detail-page__shell-container",children:[a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--full"}),a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--short"}),a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--mid"})]}),a.jsxs(xe,{className:"task-detail-page__section task-detail-page__shell-container",children:[a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--full"}),a.jsx("div",{className:"task-detail-page__shell-line task-detail-page__shell-line--full"})]}),a.jsx("div",{className:"task-detail-page__actions",children:a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t(n),children:"Back to Tasks"})})]})}function YA(n){return n==="ACTIVE"?{label:"active",color:"blue"}:n==="SUCCEEDED"?{label:"succeeded",color:"green"}:n==="FAILED"?{label:"failed",color:"red"}:n==="STALE"?{label:"stale",color:"orange"}:{label:"cancelled",color:"gray"}}function KA(n,t){return t-new Date(n.lastActivityAt).getTime()>=HA}function Sh(n){return n.length<=12?n:`${n.slice(0,8)}…${n.slice(-4)}`}function XA(n){if(!(n instanceof HTMLElement))return!1;if(n.isContentEditable)return!0;const t=n.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"?!0:!!n.closest('[contenteditable="true"], input, textarea, select')}const QA=5e3,ZA=va("/tasks"),Sf=()=>{const[n,t]=d.useState(!0),[i,l]=d.useState(!1),[c,u]=d.useState(null),[h,m]=d.useState(!1),[p,y]=d.useState([]),[v,b]=d.useState([]),[x,_]=d.useState([]),[k,T]=d.useState({queue:0,active:0,history:0}),[w,E]=d.useState(null),R=d.useRef(!1),D=d.useCallback(async O=>{if(R.current)return;R.current=!0;const z=!i,A=O?.silent??!1;z?t(!0):A||m(!0);try{const[C,L,P]=await Promise.all([Pa.TaskExecutionQueueController_listQueue({limit:50}),Pa.ActiveTaskExecutionController_listActiveExecutions({limit:50}),Pa.TaskExecutionHistoryController_listHistory({limit:50})]);y(C.items),b(L.items),_(P.items),T({queue:C.total,active:L.total,history:P.total}),E(new Date().toISOString()),u(null)}catch(C){u(C instanceof Error?C.message:"Failed to load executions")}finally{R.current=!1,l(!0),t(!1),m(!1)}},[i]);return d.useEffect(()=>{D();const O=window.setInterval(()=>{D({silent:!0})},QA);return()=>window.clearInterval(O)},[D]),d.useEffect(()=>{const O=$n(ZA,{transports:["websocket","polling"],withCredentials:!0});return O.on("connect",()=>{O.emit("tasks.subscribe",{},()=>{})}),O.on(_n.TASK_ACTIVITY,z=>{z.kind.startsWith("execution.")&&D({silent:!0})}),()=>{O.close()}},[D]),{isLoading:n,isRefreshing:h,hasLoadedOnce:i,error:c,queue:p,active:v,history:x,totals:k,loadExecutions:D,lastUpdatedAt:w}},ul=228,T_=48,WA=60,JA=84,ex=112,w_=20,tc=48,eR=.55,tR=1.6,tx=.15,nR=.0025,k_="task-dependencies-view-preferences",al={graphMode:"all",hideDonePaths:!0,selectedTagNames:[]};function nx(){const{tasks:n,isLoading:t,error:i,setSectionTitle:l,activityByTaskId:c}=Bs(),{active:u}=Sf(),h=De(),{taskId:m}=Jt(),p=d.useRef(null),y=d.useRef({x:0,y:0}),v=d.useRef(null),b=d.useRef(void 0),x=d.useRef(null),[_,k]=d.useState(1),[T,w]=d.useState({x:0,y:0}),[E,R]=d.useState(!1),[D,O]=d.useState(rR),{graphMode:z,hideDonePaths:A,selectedTagNames:C}=D,[L,P]=d.useState([]),[Y,U]=d.useState(""),[re,Q]=d.useState(!1);vt(),d.useEffect(()=>{l("Tasks")},[l]),d.useEffect(()=>{y.current=T},[T]),d.useEffect(()=>{iR(D)},[D]),d.useEffect(()=>{const Z=new AbortController;return iA.MetaController_getAllTags({signal:Z.signal}).then(P).catch(Te=>{Z.signal.aborted||console.error("Failed to load dependency graph tags:",Te)}),()=>Z.abort()},[]);const J=d.useMemo(()=>uR(n,L),[L,n]),ye=d.useMemo(()=>new Map(J.map(Z=>[Z.name,Z])),[J]),B=d.useMemo(()=>C.map(Z=>ye.get(Z)??{name:Z,count:0}),[ye,C]),se=d.useMemo(()=>{const Z=new Set(C),Te=Y.trim().toLowerCase();return J.filter(tt=>!Z.has(tt.name)).filter(tt=>Te.length===0||tt.name.toLowerCase().includes(Te)).slice(0,8)},[J,C,Y]),ge=d.useMemo(()=>dR(n,C),[n,C]),Ee=d.useMemo(()=>new Set(u.map(Z=>Z.taskId)),[u]),Ce=d.useMemo(()=>new Map(u.map(Z=>[Z.taskId,Z.taskStatus])),[u]),M=d.useMemo(()=>new Set(Object.values(c).filter(pR).map(Z=>Z.taskId)),[c]),H=d.useMemo(()=>cR(ge,Ce,Ee,M,{includeAllTasks:z==="all",hideDonePaths:A,focusedTaskId:m}),[Ce,Ee,M,ge,m,z,A]),de=C.length>0,fe=`${H.nodes.length} shown`,V=A?"Showing paths that contain unfinished work. Click to include completed-only paths.":"Showing every path. Click to hide completed-only paths.";d.useEffect(()=>{if(!re)return;const Z=Te=>{x.current?.contains(Te.target)||Q(!1)};return document.addEventListener("pointerdown",Z),()=>document.removeEventListener("pointerdown",Z)},[re]);const ie=d.useCallback(Z=>{O(Te=>Te.selectedTagNames.includes(Z)?Te:{...Te,selectedTagNames:[...Te.selectedTagNames,Z]}),U(""),Q(!1)},[]),te=d.useCallback(Z=>{O(Te=>({...Te,selectedTagNames:Te.selectedTagNames.filter(tt=>tt!==Z)}))},[]),be=d.useCallback(()=>{O(Z=>({...Z,selectedTagNames:[]}))},[]),Re=d.useCallback(Z=>{if(!Z.nativeEvent.isComposing){if(Z.key==="Enter"){Z.preventDefault();const[Te]=se;Te&&ie(Te.name);return}Z.key==="Escape"&&(Z.preventDefault(),Q(!1))}},[ie,se]),Ze=d.useCallback((Z,Te)=>{const tt=p.current,ht=rx(Z);if(!tt||ht===_){k(ht);return}const qt=Te??{x:tt.clientWidth/2,y:tt.clientHeight/2};w(wn=>{const kt=(qt.x-wn.x)/_,mt=(qt.y-wn.y)/_;return{x:qt.x-kt*ht,y:qt.y-mt*ht}}),k(ht)},[_]),It=d.useCallback(Z=>{k(Te=>rx(Te+Z))},[]),et=d.useCallback(()=>{w(gR(H,p.current,m)),k(1)},[m,H]);d.useEffect(()=>{if(!(m&&b.current!==m)||H.nodes.length===0)return;const Te=H.nodes.find(tt=>tt.task.id===m);Te&&(b.current=m,k(1),w(A_(Te,p.current)))},[m,H]);const wt=d.useCallback(Z=>{if(H.nodes.length===0)return;const Te=Z.currentTarget;if(Z.ctrlKey||Z.metaKey){Z.preventDefault();const tt=Te.getBoundingClientRect();Ze(_*Math.exp(-Z.deltaY*nR),{x:Z.clientX-tt.left,y:Z.clientY-tt.top});return}if(Z.deltaX!==0||Z.deltaY!==0){Z.preventDefault();const tt=Z.deltaMode===1?16:Z.deltaMode===2?Te.clientHeight:1;w(ht=>({x:ht.x-Z.deltaX*tt,y:ht.y-Z.deltaY*tt}))}},[Ze,H.nodes.length,_]),ue=d.useCallback(Z=>{H.nodes.length===0||Z.button!==0||Z.target.closest(".dependency-task-card")||(Z.preventDefault(),Z.currentTarget.setPointerCapture(Z.pointerId),v.current={pointerId:Z.pointerId,startClientX:Z.clientX,startClientY:Z.clientY,startPanX:y.current.x,startPanY:y.current.y},R(!0))},[H.nodes.length]),X=d.useCallback(Z=>{const Te=v.current;!Te||Te.pointerId!==Z.pointerId||(Z.preventDefault(),w({x:Te.startPanX+Z.clientX-Te.startClientX,y:Te.startPanY+Z.clientY-Te.startClientY}))},[]),pe=d.useCallback(Z=>{const Te=v.current;!Te||Te.pointerId!==Z.pointerId||(Z.currentTarget.hasPointerCapture(Z.pointerId)&&Z.currentTarget.releasePointerCapture(Z.pointerId),v.current=null,R(!1))},[]);return t&&n.length===0?a.jsx("div",{className:"task-dependencies-page task-dependencies-page--state",children:a.jsx(S,{tone:"muted",children:"Loading dependencies..."})}):i?a.jsx("div",{className:"task-dependencies-page task-dependencies-page--state",children:a.jsxs(S,{tone:"muted",children:["Could not load dependencies: ",i]})}):a.jsxs("div",{className:"task-dependencies-page",children:[a.jsxs("div",{className:"task-dependencies-controls","aria-label":"Dependency graph filters",children:[a.jsxs("div",{className:"task-dependencies-controls__main",children:[a.jsx("div",{className:"task-dependencies-controls__row",children:a.jsxs("div",{className:"task-dependencies-segmented",role:"group","aria-label":"Tasks shown in graph",children:[a.jsx("button",{className:`task-dependencies-segmented__button ${z==="dependencies"?"task-dependencies-segmented__button--active":""}`,type:"button",title:"Show only tasks that have dependency links.",onClick:()=>O(Z=>({...Z,graphMode:"dependencies"})),children:"Linked tasks"}),a.jsx("button",{className:`task-dependencies-segmented__button ${z==="all"?"task-dependencies-segmented__button--active":""}`,type:"button",title:"Show every task, including tasks without dependency links.",onClick:()=>O(Z=>({...Z,graphMode:"all"})),children:"Every task"})]})}),a.jsx("div",{className:"task-dependencies-controls__row",children:a.jsx("button",{className:`task-dependencies-toggle${A?" task-dependencies-toggle--active":""}`,type:"button","aria-pressed":A,onClick:()=>O(Z=>({...Z,hideDonePaths:!Z.hideDonePaths})),"aria-label":"Show unfinished paths only",title:V,children:"Unfinished paths"})}),a.jsx("span",{className:"task-dependencies-controls__summary",children:fe}),a.jsxs("div",{className:"task-dependencies-tag-picker",ref:x,children:[a.jsx("input",{className:"task-dependencies-tag-picker__input",type:"search",value:Y,placeholder:"+ tag","aria-label":"Add tag filter","aria-expanded":re,"aria-controls":"task-dependencies-tag-picker-list",title:"Filter the graph by tag.",onChange:Z=>{U(Z.target.value),Q(!0)},onFocus:()=>Q(!0),onKeyDown:Re}),re?a.jsx("div",{id:"task-dependencies-tag-picker-list",className:"task-dependencies-tag-picker__menu",role:"listbox","aria-label":"Available tag filters",children:se.length===0?a.jsx("span",{className:"task-dependencies-tag-picker__empty",children:J.length===C.length?"No more tags":"No matching tags"}):se.map(Z=>a.jsxs("button",{className:"task-dependencies-tag-picker__option",type:"button",role:"option","aria-selected":"false",onMouseDown:Te=>Te.preventDefault(),onClick:()=>ie(Z.name),children:[a.jsx("span",{className:"task-dependencies-tag-picker__option-name",children:Z.name}),a.jsx("span",{className:"task-dependencies-tag-picker__option-count",children:Z.count})]},Z.name))}):null]})]}),de?a.jsxs("div",{className:"task-dependencies-controls__tags-row",children:[a.jsx("span",{className:"task-dependencies-controls__label",children:"Tags"}),a.jsx("div",{className:"task-dependencies-tags","aria-label":"Tag filters",children:a.jsxs("div",{className:"task-dependencies-selected-tags","aria-label":"Selected tag filters",children:[B.map(Z=>a.jsx(Sn,{className:"task-dependencies-tag-filter",onRemove:()=>te(Z.name),removeLabel:`Remove ${Z.name} filter`,children:Z.name},Z.name)),a.jsx("button",{className:"task-dependencies-tags__clear",type:"button",onClick:be,children:"Clear"})]})})]}):null]}),a.jsx("div",{className:"task-dependencies-canvas","aria-label":"Task dependency graph",children:H.nodes.length===0?a.jsxs("div",{className:"task-dependencies-empty",children:[a.jsx(S,{size:"3",weight:"semibold",children:"No tasks match this graph"}),a.jsx(S,{tone:"muted",children:"Adjust the task scope or tag filters to show more tasks."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"task-dependencies-toolbar","aria-label":"Dependency graph controls",children:[a.jsx("button",{className:"task-dependencies-toolbar__button",type:"button",onClick:()=>It(-tx),"aria-label":"Zoom out",title:"Zoom out",children:a.jsx(Z1,{size:16,strokeWidth:1.8})}),a.jsxs("span",{className:"task-dependencies-toolbar__zoom",children:[Math.round(_*100),"%"]}),a.jsx("button",{className:"task-dependencies-toolbar__button",type:"button",onClick:()=>It(tx),"aria-label":"Zoom in",title:"Zoom in",children:a.jsx(X1,{size:16,strokeWidth:1.8})}),a.jsx("button",{className:"task-dependencies-toolbar__button",type:"button",onClick:et,"aria-label":"Reset zoom",title:"Reset zoom",children:a.jsx(T1,{size:16,strokeWidth:1.8})})]}),a.jsx("div",{ref:p,className:`task-dependencies-viewport${E?" task-dependencies-viewport--panning":""}`,onWheel:wt,onPointerDown:ue,onPointerMove:X,onPointerUp:pe,onPointerCancel:pe,children:a.jsxs("div",{className:"task-dependencies-graph",style:{width:H.width,height:H.height,transform:`translate(${T.x}px, ${T.y}px) scale(${_})`},children:[a.jsx(oR,{connections:H.connections,width:H.width,height:H.height}),H.nodes.map(Z=>a.jsx(sR,{node:Z,status:Ce.get(Z.task.id)??Z.task.status,hasActiveExecution:Ee.has(Z.task.id)||M.has(Z.task.id),onOpen:()=>h(`/tasks/task/${Z.task.id}`)},Z.task.id))]})})]})})]})}function sR({node:n,status:t,hasActiveExecution:i,onOpen:l}){const{task:c}=n,u=E_(t,i),h=c.assigneeActor?.slug,m=!!(h&&(t===Se.IN_PROGRESS||t===Se.FOR_REVIEW));return a.jsxs("button",{className:`dependency-task-card dependency-task-card--${t.toLowerCase().replaceAll("_","-")}`,type:"button",onClick:l,style:{left:n.x,top:n.y,height:n.height},children:[a.jsxs("span",{className:"dependency-task-card__content",children:[a.jsx("span",{className:"dependency-task-card__title",children:c.name}),m?a.jsxs("span",{className:"dependency-task-card__assignee",children:["@",h]}):null,u?a.jsx("span",{className:"dependency-task-card__status-row",children:a.jsx(Sn,{color:u.color,className:"dependency-task-card__status-chip",children:u.label})}):null]}),a.jsxs("span",{className:"dependency-task-card__meta",children:[t===Se.DONE?a.jsx(aR,{}):null,i?a.jsx("span",{className:"dependency-task-card__spinner","aria-label":"Active execution",title:"Active execution"}):null]})]})}function aR(){return a.jsx("span",{className:"dependency-run-status-icon dependency-run-status-icon--success","aria-label":"Done",children:"✓"})}function E_(n,t=!1){return t&&n===Se.NOT_STARTED?Ph(Se.IN_PROGRESS):n===Se.IN_PROGRESS||n===Se.FOR_REVIEW?Ph(n):null}function rR(){try{const n=localStorage.getItem(k_);if(!n)return al;const t=JSON.parse(n);return{graphMode:lR(t.graphMode)?t.graphMode:al.graphMode,hideDonePaths:typeof t.hideDonePaths=="boolean"?t.hideDonePaths:al.hideDonePaths,selectedTagNames:Array.isArray(t.selectedTagNames)?t.selectedTagNames.filter(i=>typeof i=="string"):al.selectedTagNames}}catch(n){return console.error("Failed to load dependency view preferences:",n),al}}function iR(n){try{localStorage.setItem(k_,JSON.stringify(n))}catch(t){console.error("Failed to save dependency view preferences:",t)}}function lR(n){return n==="dependencies"||n==="all"}function oR({connections:n,width:t,height:i}){return a.jsxs("svg",{className:"task-dependencies-connections",width:t,height:i,viewBox:`0 0 ${t} ${i}`,"aria-hidden":"true",children:[a.jsx("defs",{children:a.jsx("marker",{id:"task-dependencies-connection-arrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:a.jsx("path",{className:"task-dependencies-connection-arrow",d:"M 0 0 L 8 4 L 0 8 Z"})})}),n.map(l=>{const c=Math.max(80,l.endX-l.startX),u=Math.min(140,c*.5);return a.jsx("path",{d:`M ${l.startX} ${l.startY} C ${l.startX+u} ${l.startY}, ${l.endX-u} ${l.endY}, ${l.endX} ${l.endY}`,className:"task-dependencies-connection",markerEnd:"url(#task-dependencies-connection-arrow)"},`${l.fromTaskId}-${l.toTaskId}`)})]})}function cR(n,t,i,l,c){const u=new Map(n.map(z=>[z.id,z])),h=new Set(c.includeAllTasks?n.map(z=>z.id):[]);c.focusedTaskId&&u.has(c.focusedTaskId)&&h.add(c.focusedTaskId);for(const z of n){const A=z.dependsOnIds.filter(C=>u.has(C));if(A.length!==0){h.add(z.id);for(const C of A)h.add(C)}}if(h.size===0)return{nodes:[],connections:[],width:0,height:0};if(c.hideDonePaths&&hR(h,u,t,c.focusedTaskId),h.size===0)return{nodes:[],connections:[],width:0,height:0};const m=new Map(n.map((z,A)=>[z.id,A])),p=new Map,y=new Set,v=z=>{const A=p.get(z);if(A!==void 0)return A;if(y.has(z))return 0;y.add(z);const L=u.get(z)?.dependsOnIds.filter(Y=>h.has(Y)).map(Y=>v(Y))??[];y.delete(z);const P=L.length===0?0:Math.max(...L)+1;return p.set(z,P),P};for(const z of h)v(z);mR(h,u,p);const b=new Map;for(const z of h){const A=p.get(z)??0,C=b.get(A)??[];C.push(z),b.set(A,C)}for(const[z,A]of b)A.sort((C,L)=>{const P=u.get(C),Y=u.get(L),U=ax(P,m),re=ax(Y,m);return U!==re?U-re:(m.get(C)??0)-(m.get(L)??0)}),b.set(z,A);const x=[],_=new Map,k=Array.from(b.keys()).sort((z,A)=>z-A),T=new Map;for(const[z,A]of b){const C=fR(A,u,t,i,l);T.set(z,C)}const w=Math.max(...Array.from(T.values()));for(const z of k){const A=b.get(z)??[],C=T.get(z)??0,L=Math.max(0,(w-C)/2);let P=tc+L;A.forEach(Y=>{const U=u.get(Y);if(!U)return;const re=N_(U,t,i,l),Q={task:U,layer:z,x:tc+z*(ul+ex),y:P,height:re};x.push(Q),_.set(Y,Q),P+=re+w_})}const E=[];for(const z of x)for(const A of z.task.dependsOnIds){const C=_.get(A);C&&E.push({fromTaskId:A,toTaskId:z.task.id,startX:C.x+ul,startY:C.y+C.height/2,endX:z.x,endY:z.y+z.height/2})}const R=k.at(-1)??0,D=tc*2+ul+R*(ul+ex),O=tc*2+w;return{nodes:x,connections:E,width:D,height:O}}function uR(n,t){const i=new Map;for(const l of n)for(const c of l.tags)i.set(c.name,(i.get(c.name)??0)+1);for(const l of t)i.has(l.name)||i.set(l.name,0);return Array.from(i.entries()).map(([l,c])=>({name:l,count:c})).sort((l,c)=>l.name.localeCompare(c.name))}function dR(n,t){if(t.length===0)return n;const i=new Set(t);return n.filter(l=>l.tags.some(c=>i.has(c.name)))}function hR(n,t,i,l){const c=new Map,u=new Map;for(const h of n){const m=t.get(h);if(!m)continue;const p=m.dependsOnIds.filter(y=>n.has(y));c.set(h,p);for(const y of p){const v=u.get(y)??[];v.push(h),u.set(y,v)}}for(const h of Array.from(n)){if(h===l||!C_(h,t,i))continue;sx(h,c,t,i)||sx(h,u,t,i)||n.delete(h)}}function sx(n,t,i,l){const c=new Set([n]),u=[...t.get(n)??[]];for(;u.length>0;){const h=u.pop();if(!(!h||c.has(h))){if(c.add(h),!C_(h,i,l))return!0;u.push(...t.get(h)??[])}}return!1}function C_(n,t,i){const l=t.get(n);return(i.get(n)??l?.status)===Se.DONE}function fR(n,t,i,l,c){return n.reduce((u,h,m)=>{const p=t.get(h),y=p?N_(p,i,l,c):T_;return u+y+(m>0?w_:0)},0)}function N_(n,t,i,l){const c=t.get(n.id)??n.status,u=i.has(n.id)||l.has(n.id);return n.assigneeActor?.slug&&(c===Se.IN_PROGRESS||c===Se.FOR_REVIEW)?JA:E_(c,u)?WA:T_}function pR(n){return n.kind.startsWith("execution.")?n.kind!=="execution.stopped"&&n.kind!=="execution.history.added"&&n.kind!=="execution.unclaimed":!1}function ax(n,t){return!n||n.dependsOnIds.length===0?Number.MAX_SAFE_INTEGER:Math.min(...n.dependsOnIds.map(i=>t.get(i)??Number.MAX_SAFE_INTEGER))}function mR(n,t,i){const l=new Map;for(const u of n){const h=t.get(u);if(h)for(const m of h.dependsOnIds){if(!n.has(m))continue;const p=l.get(m)??[];p.push(u),l.set(m,p)}}let c=!0;for(;c;){c=!1;for(const u of n){const h=l.get(u);if(!h||h.length===0)continue;const m=Math.min(...h.map(v=>i.get(v)??0)),p=Math.max(0,m-1),y=i.get(u)??0;p>y&&(i.set(u,p),c=!0)}}}function gR(n,t,i){const l=i?n.nodes.find(c=>c.task.id===i):void 0;return l?A_(l,t):{x:0,y:0}}function A_(n,t){return t?{x:t.clientWidth/2-n.x-ul/2,y:t.clientHeight/2-n.y-n.height/2}:{x:0,y:0}}function rx(n){return Math.min(tR,Math.max(eR,Number(n.toFixed(2))))}const ix=100,yR=()=>{const[n,t]=d.useState([]),[i,l]=d.useState({}),[c,u]=d.useState([]),[h,m]=d.useState(!1),[p,y]=d.useState(null),v=d.useCallback(A=>{l(C=>({...C,[A.id]:A})),u(C=>C.some(P=>P.id===A.id)?C.map(P=>P.id===A.id?A:P):[A,...C])},[]),b=d.useCallback(A=>{t(C=>C.find(P=>P.id===A.id)?C.map(P=>P.id===A.id?A:P):[A,...C])},[]),x=d.useCallback(async()=>{m(!0),y(null);try{const A=await $r.ScheduledTasksController_listScheduledTasks({page:1,limit:ix});t(A.items),A.items.forEach(C=>{C.taskBlueprint&&v(C.taskBlueprint)})}catch(A){y(A instanceof Error?A.message:"Failed to load scheduled tasks")}finally{m(!1)}},[v]),_=d.useCallback(async A=>{const C=await $r.ScheduledTasksController_getScheduledTask({id:A});return b(C),C.taskBlueprint&&v(C.taskBlueprint),C},[b,v]),k=d.useCallback(async A=>{const C=await sl.TaskBlueprintsController_getTaskBlueprint({id:A});return v(C),C},[v]),T=d.useCallback(async()=>{y(null);try{const A=await sl.TaskBlueprintsController_listTaskBlueprints({page:1,limit:ix});u(A.items),A.items.forEach(C=>v(C))}catch(A){y(A instanceof Error?A.message:"Failed to load task blueprints")}},[v]),w=d.useCallback(async A=>{const C=await sl.TaskBlueprintsController_createTaskBlueprint({body:A});return v(C),C},[v]),E=d.useCallback(async(A,C)=>{const L=await sl.TaskBlueprintsController_updateTaskBlueprint({id:A,body:C});return v(L),L},[v]),R=d.useCallback(async A=>{const C=await $r.ScheduledTasksController_createScheduledTask({body:A});return b(C),C.taskBlueprint&&v(C.taskBlueprint),C},[b,v]),D=d.useCallback(async(A,C)=>{const L=await $r.ScheduledTasksController_updateScheduledTask({id:A,body:C});return b(L),L.taskBlueprint&&v(L.taskBlueprint),L},[b,v]),O=d.useCallback(async A=>{await $r.ScheduledTasksController_deleteScheduledTask({id:A}),t(C=>C.filter(L=>L.id!==A))},[]),z=d.useCallback(async A=>{await sl.TaskBlueprintsController_deleteTaskBlueprint({id:A}),u(C=>C.filter(L=>L.id!==A)),l(C=>{const L={...C};return delete L[A],L})},[]);return d.useEffect(()=>{x()},[x]),{scheduledTasks:n,blueprintsById:i,blueprints:c,isLoading:h,error:p,loadScheduledTasks:x,loadScheduledTask:_,loadBlueprint:k,loadBlueprints:T,createBlueprint:w,updateBlueprint:E,createScheduledTask:R,updateScheduledTask:D,deleteScheduledTask:O,deleteBlueprint:z}},R_=d.createContext(null);function vR({children:n}){const{scheduledTasks:t,blueprints:i,blueprintsById:l,isLoading:c,error:u,loadScheduledTasks:h,loadScheduledTask:m,loadBlueprint:p,loadBlueprints:y,createBlueprint:v,updateBlueprint:b,createScheduledTask:x,updateScheduledTask:_,deleteScheduledTask:k,deleteBlueprint:T}=yR(),[w,E]=d.useState(""),R=d.useMemo(()=>({scheduledTasks:t,blueprints:i,blueprintsById:l,isLoading:c,error:u,sectionTitle:w,setSectionTitle:E,loadScheduledTasks:h,loadScheduledTask:m,loadBlueprint:p,loadBlueprints:y,createBlueprint:v,updateBlueprint:b,createScheduledTask:x,updateScheduledTask:_,deleteScheduledTask:k,deleteBlueprint:T}),[t,i,l,c,u,w,h,m,p,y,v,b,x,_,k,T]);return a.jsx(R_.Provider,{value:R,children:n})}function jf(){const n=d.useContext(R_);if(!n)throw new Error("useScheduledTasksCtx must be used within <ScheduledTasksProvider>");return n}const bc=n=>String(n).padStart(2,"0"),xR=n=>{const[t="0",i="0"]=n.split(":"),l=Number(t),c=Number(i);return{hour:Number.isFinite(l)?l:0,minute:Number.isFinite(c)?c:0}},bR=(n,t,i)=>{if(!n||n==="*")return[];const l=n.split(","),c=[];for(const u of l){const h=u.trim();if(h)if(h.includes("-")){const[m,p]=h.split("-"),y=Number(m),v=Number(p);if(!Number.isFinite(y)||!Number.isFinite(v))continue;const b=Math.max(t,Math.min(y,v)),x=Math.min(i,Math.max(y,v));for(let _=b;_<=x;_+=1)c.push(_)}else{const m=Number(h);Number.isFinite(m)&&m>=t&&m<=i&&c.push(m)}}return Array.from(new Set(c)).sort((u,h)=>u-h)},_R=n=>{if(n.preset==="custom")return n.cronExpression.trim();const{hour:t,minute:i}=xR(n.time),l=bc(i),c=bc(t);if(n.preset==="daily")return`${l} ${c} * * *`;if(n.preset==="weekly"){const h=n.days.length?n.days.join(","):"1";return`${l} ${c} * * ${h}`}const u=Math.min(Math.max(n.dayOfMonth,1),28);return`${l} ${c} ${u} * *`},D_=n=>{const t=n.trim(),i=t.split(/\s+/);if(i.length<5)return{preset:"custom",time:"09:00",days:[],dayOfMonth:1,cronExpression:t};const[l,c,u,h,m]=i,p=`${bc(Number(c))}:${bc(Number(l))}`;if(u==="*"&&h==="*"&&m==="*")return{preset:"daily",time:p,days:[],dayOfMonth:1,cronExpression:t};if(u==="*"&&h==="*"&&m!=="*"){const y=bR(m,0,7).map(v=>v===7?0:v);return y.length?{preset:"weekly",time:p,days:y,dayOfMonth:1,cronExpression:t}:{preset:"custom",time:p,days:[],dayOfMonth:1,cronExpression:t}}if(u!=="*"&&h==="*"&&m==="*"){const y=Number(u);return{preset:"monthly",time:p,days:[],dayOfMonth:Number.isFinite(y)?y:1,cronExpression:t}}return{preset:"custom",time:"09:00",days:[],dayOfMonth:1,cronExpression:t}},O_=n=>{if(n.preset==="custom")return`Cron: ${n.cronExpression}`;if(n.preset==="daily")return`Daily at ${n.time}`;if(n.preset==="weekly"){const t=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];return`Weekly on ${(n.days.length?n.days:[1]).map(c=>t[c]??"").join(", ")} at ${n.time}`}return`Monthly on day ${n.dayOfMonth} at ${n.time}`},SR=/^[\d*/,\-]+$/,jR=n=>{const t=n.trim().split(/\s+/);return t.length!==5?"Cron must have 5 fields: minute hour day-of-month month day-of-week.":t.some(i=>!i||!SR.test(i))?"Cron can only include digits, *, /, -, and commas.":null};function TR({blueprints:n,onCancel:t,onSave:i,onRequestNewBlueprint:l}){const[c,u]=d.useState(""),[h,m]=d.useState(null),[p,y]=d.useState(0),v=d.useMemo(()=>{const x=c.trim().toLowerCase();return x?n.filter(_=>[_.name,_.description||"",_.assigneeActor?.displayName||"",_.assigneeActor?.slug||""].join(" ").toLowerCase().includes(x)):n},[n,c]),b=async()=>h?i(h):!1;return a.jsx(xt,{title:"Create Schedule",onCancel:t,onSave:b,children:a.jsxs("div",{className:"new-schedule-pop",children:[h?a.jsxs("div",{className:"new-schedule-pop__selected",onClick:()=>m(null),children:[a.jsx(He,{size:"md",name:h.name,src:h.assigneeActor?.avatarUrl||void 0}),a.jsxs("div",{className:"new-schedule-pop__selected-meta",children:[a.jsx(S,{weight:"medium",size:"3",children:h.name}),a.jsx(S,{tone:"muted",size:"2",children:h.description||"No description"})]}),a.jsx(S,{size:"2",tone:"muted",children:"tap to change"})]}):a.jsxs(a.Fragment,{children:[a.jsx("input",{className:"new-schedule-pop__input",placeholder:"Search blueprint by name...",value:c,onChange:x=>u(x.target.value),onKeyDown:x=>{x.key==="ArrowDown"&&(x.preventDefault(),y(_=>Math.min(_+1,v.length-1))),x.key==="ArrowUp"&&(x.preventDefault(),y(_=>Math.max(_-1,0))),x.key==="Enter"&&v[p]&&(x.preventDefault(),m(v[p]))}}),a.jsx("div",{className:"new-schedule-pop__list",children:v.length===0?a.jsx("div",{className:"new-schedule-pop__empty",children:a.jsx(S,{tone:"muted",size:"2",children:"No blueprints found"})}):v.map((x,_)=>a.jsxs("div",{className:`new-schedule-pop__item ${_===p?"new-schedule-pop__item--highlighted":""}`,onMouseEnter:()=>y(_),onClick:()=>m(x),children:[a.jsx(He,{size:"sm",name:x.name,src:x.assigneeActor?.avatarUrl||void 0}),a.jsxs("div",{className:"new-schedule-pop__item-meta",children:[a.jsx(S,{size:"2",weight:"medium",children:x.name}),a.jsx(S,{size:"1",tone:"muted",children:x.assigneeActor?`@${x.assigneeActor.slug}`:"Unassigned"})]})]},x.id))})]}),a.jsx(ce,{size:"sm",variant:"secondary",onClick:l,children:"+ New blueprint"})]})})}function wR(){const n=De(),{scheduledTasks:t,blueprints:i,isLoading:l,error:c,createBlueprint:u,createScheduledTask:h,deleteScheduledTask:m,loadBlueprints:p}=jf(),{setSectionTitle:y}=Bs(),{showError:v}=dn(),b=Dt(),[x,_]=d.useState(!1),[k,T]=d.useState(!1),w=d.useRef(!1);vt(),d.useEffect(()=>{y("Schedule")},[y]),d.useEffect(()=>{p().catch(v)},[p,v]);const E=d.useMemo(()=>t.filter(A=>A.enabled).length,[t]),R=async A=>{try{const C=await u({name:A.title,description:A.description});return _(!1),n(`/tasks/blueprints/${C.id}`),!0}catch(C){return v(C),!1}},D=async A=>{if(w.current)return!1;w.current=!0;try{const C=await h({taskBlueprintId:A.id,cronExpression:"0 9 * * *",enabled:!1});return T(!1),n(`/tasks/schedule/${C.id}`),!0}catch(C){return v(C),!1}finally{w.current=!1}},O=d.useMemo(()=>i.map(A=>({id:A.id,name:A.name,description:A.description,status:Se.NOT_STARTED,assignee:null,assigneeActor:A.assigneeActor??void 0,sessionId:null,comments:[],artefacts:[],inputRequests:[],tags:A.tags,createdByActor:A.createdByActor,dependsOnIds:A.dependsOnIds,createdAt:A.createdAt,updatedAt:A.updatedAt})),[i]),z=async A=>{if(window.confirm("Delete this schedule?"))try{await m(A.id)}catch(C){v(C)}};return a.jsxs("div",{className:"scheduled-tasks-page",children:[c?a.jsx(S,{tone:"muted",children:c}):null,a.jsx("section",{className:"scheduled-tasks-page__section",children:l?a.jsx(S,{tone:"muted",children:"Loading scheduled tasks..."}):a.jsx(xe,{title:"Schedules",action:a.jsxs("div",{className:"scheduled-tasks-page__header-actions",children:[a.jsxs(S,{size:"2",tone:"muted",children:[E," active schedules"]}),a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>T(!0),children:"+ Add schedule"})]}),children:t.length===0?a.jsxs(Ye,{className:"scheduled-tasks-page__empty",children:[a.jsx(S,{weight:"medium",children:"No schedules yet"}),a.jsx(S,{tone:"muted",children:"Create a schedule from a blueprint."})]}):t.map(A=>{const C=A.taskBlueprint,L=O_(D_(A.cronExpression));return a.jsxs(_e,{onClick:()=>n(`/tasks/schedule/${A.id}`),tags:[{label:A.enabled?"enabled":"paused",color:A.enabled?"green":"gray"}],topRight:a.jsxs(S,{size:"1",tone:"muted",children:["Next: ",new Date(A.nextRunAt).toLocaleString()]}),trailing:a.jsx(ce,{size:"sm",variant:"danger",onClick:P=>{P.stopPropagation(),z(A)},children:"Delete"}),children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:C?.name||"Untitled blueprint"}),a.jsx(S,{as:"span",size:"2",tone:"muted",children:` ${L}`})]},A.id)})})}),a.jsx("section",{className:"scheduled-tasks-page__section",children:O.length===0?a.jsxs(Ye,{className:"scheduled-tasks-page__empty",children:[a.jsx(S,{weight:"medium",children:"No blueprints yet"}),a.jsx(S,{tone:"muted",children:"Create a blueprint to reuse task definitions."})]}):b?a.jsx(xe,{title:"Blueprints",action:a.jsxs("div",{className:"scheduled-tasks-page__header-actions",children:[a.jsxs(S,{size:"2",tone:"muted",children:[i.length," blueprints"]}),a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>_(!0),children:"+ New blueprint"})]}),children:a.jsx("div",{className:"scheduled-tasks-page__blueprints-board",children:O.map(A=>a.jsx(mc,{task:A,onClick:()=>n(`/tasks/blueprints/${A.id}`)},A.id))})}):a.jsx(xe,{title:"Blueprints",action:a.jsxs("div",{className:"scheduled-tasks-page__header-actions",children:[a.jsxs(S,{size:"2",tone:"muted",children:[i.length," blueprints"]}),a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>_(!0),children:"+ New blueprint"})]}),children:O.map(A=>a.jsx(fl,{task:A,onClick:()=>n(`/tasks/blueprints/${A.id}`)},A.id))})}),x?a.jsx($h,{onCancel:()=>_(!1),onSave:R}):null,k?a.jsx(TR,{blueprints:i,onCancel:()=>T(!1),onSave:D,onRequestNewBlueprint:()=>{T(!1),_(!0)}}):null]})}const kR=[{value:0,label:"Sun"},{value:1,label:"Mon"},{value:2,label:"Tue"},{value:3,label:"Wed"},{value:4,label:"Thu"},{value:5,label:"Fri"},{value:6,label:"Sat"}];function ER(){const{scheduleId:n}=Jt(),t=De(),{scheduledTasks:i,blueprintsById:l,loadScheduledTask:c,loadBlueprint:u,updateScheduledTask:h}=jf(),{setSectionTitle:m}=Bs(),{showError:p,showToast:y}=dn(),[v,b]=d.useState("daily"),[x,_]=d.useState("09:00"),[k,T]=d.useState([1]),[w,E]=d.useState(1),[R,D]=d.useState("0 9 * * *"),[O,z]=d.useState(!1),[A,C]=d.useState(!1),[L,P]=d.useState(null),Y=i.find(B=>B.id===n),U=Y?.taskBlueprint||(Y?l[Y.taskBlueprintId]:void 0);vt(),d.useEffect(()=>{n&&(Y||c(n).catch(p))},[n,Y,c,p]),d.useEffect(()=>{Y&&!Y.taskBlueprint&&u(Y.taskBlueprintId).catch(p)},[Y,u,p]),d.useEffect(()=>{U?.name?m(U.name):m("Schedule")},[U,m]),d.useEffect(()=>{if(!Y)return;const B=D_(Y.cronExpression);b(B.preset),_(B.time),T(B.days.length?B.days:[1]),E(B.dayOfMonth||1),D(B.cronExpression||Y.cronExpression),z(Y.enabled)},[Y]);const re=d.useMemo(()=>_R({preset:v,time:x,days:k,dayOfMonth:w,cronExpression:R}),[v,x,k,w,R]);if(!Y)return a.jsxs("div",{className:"scheduled-task-detail-page",children:[a.jsx(S,{tone:"muted",children:"Scheduled task not found."}),a.jsx(ce,{variant:"secondary",onClick:()=>t("/tasks/schedule"),children:"Back to schedules"})]});const Q=O_({preset:v,time:x,days:k,dayOfMonth:w,cronExpression:re}),J=B=>{T(se=>{if(se.includes(B)){const ge=se.filter(Ee=>Ee!==B);return ge.length?ge:se}return[...se,B].sort((ge,Ee)=>ge-Ee)})},ye=async()=>{if(v==="custom"){const B=jR(re);if(B){P(B);return}}P(null),C(!0);try{await h(Y.id,{cronExpression:re,enabled:O}),y("Schedule saved","success")}catch(B){p(B)}finally{C(!1)}};return a.jsxs("div",{className:"scheduled-task-detail-page",children:[a.jsx(xe,{title:"Task",className:"scheduled-task-detail-page__section",children:a.jsxs(_e,{onClick:()=>t(`/tasks/blueprints/${Y.taskBlueprintId}`),tags:[{label:"blueprint",color:"blue"}],trailing:a.jsx(S,{size:"2",tone:"muted",children:"Open"}),children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:U?.name||"Untitled blueprint"}),a.jsx(S,{as:"span",tone:"muted",size:"2",children:` ${U?.description||"No description"}`})]})}),a.jsxs(xe,{title:"Schedule",className:"scheduled-task-detail-page__section",children:[a.jsxs("div",{className:"scheduled-task-detail-page__controls",children:[a.jsxs("label",{className:"scheduled-task-detail-page__label",children:[a.jsx(S,{size:"2",tone:"muted",children:"Frequency"}),a.jsxs("select",{className:"scheduled-task-detail-page__select",value:v,onChange:B=>b(B.target.value),children:[a.jsx("option",{value:"daily",children:"Daily"}),a.jsx("option",{value:"weekly",children:"Weekly"}),a.jsx("option",{value:"monthly",children:"Monthly"}),a.jsx("option",{value:"custom",children:"Custom (cron)"})]})]}),v!=="custom"?a.jsxs("label",{className:"scheduled-task-detail-page__label",children:[a.jsx(S,{size:"2",tone:"muted",children:"Time"}),a.jsx("input",{className:"scheduled-task-detail-page__input",type:"time",value:x,onChange:B=>_(B.target.value)})]}):null,v==="weekly"?a.jsxs("div",{className:"scheduled-task-detail-page__label",children:[a.jsx(S,{size:"2",tone:"muted",children:"Days"}),a.jsx("div",{className:"scheduled-task-detail-page__day-grid",children:kR.map(B=>a.jsx("button",{type:"button",className:`scheduled-task-detail-page__day ${k.includes(B.value)?"is-selected":""}`,onClick:()=>J(B.value),children:B.label},B.value))})]}):null,v==="monthly"?a.jsxs("label",{className:"scheduled-task-detail-page__label",children:[a.jsx(S,{size:"2",tone:"muted",children:"Date"}),a.jsx("input",{className:"scheduled-task-detail-page__input",type:"date",value:`2026-01-${String(Math.min(Math.max(w,1),28)).padStart(2,"0")}`,onChange:B=>{const se=new Date(`${B.target.value}T00:00:00`).getDate();Number.isFinite(se)&&E(Math.min(Math.max(se,1),28))}})]}):null,v==="custom"?a.jsxs("label",{className:"scheduled-task-detail-page__label",children:[a.jsx(S,{size:"2",tone:"muted",children:"Cron expression"}),a.jsx("input",{className:"scheduled-task-detail-page__input",value:R,onChange:B=>{D(B.target.value),L&&P(null)},placeholder:"0 9 * * 1-5"}),a.jsx(S,{size:"1",tone:"muted",children:"Use 5 fields: minute hour day-of-month month day-of-week."})]}):null,a.jsx(S,{size:"1",tone:"muted",children:"Schedules run using the server timezone."}),L?a.jsx(Zt,{size:"1",children:L}):null,a.jsxs("div",{className:"scheduled-task-detail-page__toggle-row",children:[a.jsx(S,{size:"2",tone:"muted",children:"Status"}),a.jsxs("div",{className:"scheduled-task-detail-page__toggle-buttons",children:[a.jsx(ce,{size:"sm",variant:O?"primary":"secondary",onClick:()=>z(!0),children:"On"}),a.jsx(ce,{size:"sm",variant:O?"secondary":"primary",onClick:()=>z(!1),children:"Off"})]})]})]}),a.jsx(_e,{topRight:a.jsxs(S,{size:"1",tone:"muted",children:["Next: ",new Date(Y.nextRunAt).toLocaleString()]}),children:a.jsx(S,{as:"span",size:"2",children:Q})}),a.jsx(_e,{children:a.jsx(S,{as:"span",size:"2",style:"mono",children:re})})]}),a.jsxs(xe,{className:"scheduled-task-detail-page__actions",children:[a.jsx(ce,{size:"lg",variant:"primary",onClick:ye,disabled:A,children:A?"Saving...":"Save schedule"}),a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t("/tasks/schedule"),children:"Back to schedules"})]})]})}function CR(){const{taskBlueprintId:n}=Jt(),{user:t}=un(),{showError:i}=dn(),{blueprints:l,blueprintsById:c,loadBlueprint:u,updateBlueprint:h,deleteBlueprint:m}=jf(),{setSectionTitle:p,tasks:y}=Bs(),v=d.useMemo(()=>{if(n)return c[n]||l.find(_=>_.id===n)},[l,c,n]);d.useEffect(()=>{!n||v||u(n).catch(i)},[n,v,u,i]);const b=d.useMemo(()=>{if(v)return{id:v.id,name:v.name,description:v.description,status:Se.NOT_STARTED,assignee:null,assigneeActor:v.assigneeActor??void 0,sessionId:null,comments:[],artefacts:[],inputRequests:[],tags:v.tags,createdByActor:v.createdByActor,dependsOnIds:v.dependsOnIds,createdAt:v.createdAt,updatedAt:v.updatedAt}},[v]),x={addComment:async()=>{throw new Error("Blueprints do not support comments.")},deleteTask:async({taskId:_})=>{await m(_)},assignTask:async({taskId:_,assigneeActorId:k})=>{await h(_,{assigneeActorId:k})},assignTaskToMe:async({taskId:_})=>{if(!t?.actorId)throw new Error("No user session found.");await h(_,{assigneeActorId:t.actorId})},answerInputRequest:async()=>{throw new Error("Blueprints do not support input requests.")},changeStatus:async()=>{throw new Error("Blueprints do not have status updates.")},addTag:async({taskId:_,tag:k})=>{const T=v?.tags?.map(E=>E.name)??[],w=T.includes(k.name)?T:[...T,k.name];await h(_,{tagNames:w})},removeTag:async({taskId:_,tagId:k})=>{const w=(v?.tags??[]).filter(E=>E.id!==k).map(E=>E.name);await h(_,{tagNames:w})},addDependency:async({taskId:_,dependencyTaskId:k})=>{const w=[...v?.dependsOnIds??[],k];await h(_,{dependsOnIds:w})},removeDependency:async({taskId:_,dependencyTaskId:k})=>{const w=(v?.dependsOnIds??[]).filter(E=>E!==k);await h(_,{dependsOnIds:w})}};return a.jsx(j_,{task:b,backPath:"/tasks/schedule",setSectionTitle:p,handlers:x,allTasks:y})}function NR(){return a.jsx(vR,{children:a.jsx(Qt,{})})}function AR(){return a.jsx(gA,{children:a.jsx(ps,{children:a.jsxs(je,{element:a.jsx(kA,{}),children:[a.jsx(je,{index:!0,element:a.jsx(Is,{to:"/tasks/not-started",replace:!0})}),a.jsx(je,{path:"not-started",element:a.jsx(Jo,{status:Se.NOT_STARTED})}),a.jsx(je,{path:"in-progress",element:a.jsx(Jo,{status:Se.IN_PROGRESS})}),a.jsx(je,{path:"in-review",element:a.jsx(Jo,{status:Se.FOR_REVIEW})}),a.jsx(je,{path:"done",element:a.jsx(Jo,{status:Se.DONE})}),a.jsx(je,{path:"dependencies",element:a.jsx(nx,{})}),a.jsx(je,{path:"dependencies/:taskId",element:a.jsx(nx,{})}),a.jsx(je,{path:"task/:d",element:a.jsx(VA,{})}),a.jsxs(je,{element:a.jsx(NR,{}),children:[a.jsx(je,{path:"schedule",element:a.jsx(wR,{})}),a.jsx(je,{path:"schedule/:scheduleId",element:a.jsx(ER,{})}),a.jsx(je,{path:"blueprints/:taskBlueprintId",element:a.jsx(CR,{})})]})]})})})}function RR(){const{logout:n}=un(),t=De();return d.useEffect(()=>{(async()=>{try{await n()}finally{t("/login",{replace:!0})}})()},[n,t]),null}const DR=window.location.origin,z_=new ns({baseUrl:DR,credentials:"include"}),Ha=z_.context;z_.context;const L_=va("/context"),pl={CONTEXT_BLOCK_CREATED:"context.block.created",CONTEXT_BLOCK_UPDATED:"context.block.updated",CONTEXT_BLOCK_DELETED:"context.block.deleted"};function OR(){const[n,t]=d.useState([]),[i,l]=d.useState(!0),[c,u]=d.useState(null),[h,m]=d.useState(!1),p=x=>[...x].sort((_,k)=>{const T=new Date(_.updatedAt).getTime();return new Date(k.updatedAt).getTime()-T}),y=async()=>{try{l(!0),u(null);const x=await Ha.ContextController_listBlocks();t(p(x.items))}catch(x){u(x instanceof Error?x.message:"Failed to fetch context blocks"),console.error("Error fetching context blocks:",x)}finally{l(!1)}},v=()=>{const x=$n(L_,{transports:["websocket","polling"],withCredentials:!0});return x.on("connect",()=>{console.log("Connected to context WebSocket"),x.emit("context.subscribe",{},_=>{_.ok?(console.log("Subscribed to context room:",_.room),m(!0)):(console.error("Failed to subscribe to context room"),m(!1))}),y()}),x.on("disconnect",()=>{console.log("Context WebSocket disconnected"),m(!1)}),x.on("connect_error",_=>{console.error("Context websocket connect_error",_.message)}),x.on(pl.CONTEXT_BLOCK_CREATED,_=>{console.log("context.block.created",_),t(k=>k.some(T=>T.id===_.payload.id)?k:p([_.payload,...k]))}),x.on(pl.CONTEXT_BLOCK_UPDATED,_=>{console.log("context.block.updated",_),t(k=>p(k.map(T=>T.id===_.payload.id?_.payload:T)))}),x.on(pl.CONTEXT_BLOCK_DELETED,_=>{console.log("context.block.deleted",_),t(k=>k.filter(T=>T.id!==_.payload.blockId))}),()=>{x.emit("context.unsubscribe",{}),x.close()}},b=d.useCallback(async x=>{try{const _=await Ha.ContextController_getBlock({id:x});return t(k=>k.some(T=>T.id===_.id)?k:p([_,...k])),_}catch(_){return console.error("Failed to fetch block by ID",_),null}},[]);return d.useEffect(()=>(y(),v()),[]),{blocks:n,getBlockById:b,isLoading:i,error:c,isConnected:h,reload:y}}function zR(n){const[t,i]=d.useState(null),[l,c]=d.useState(!0),[u,h]=d.useState(null),[m,p]=d.useState(!1),y=d.useCallback(async()=>{try{c(!0),h(null);const v=await Ha.ContextController_getBlock({id:n});i(v),p(!1)}catch(v){h(v instanceof Error?v.message:"Failed to fetch context block"),console.error("Error fetching context block:",v)}finally{c(!1)}},[n]);return d.useEffect(()=>{n&&y()},[n,y]),d.useEffect(()=>{if(!n)return;const v=$n(L_,{transports:["websocket","polling"],withCredentials:!0});return v.on("connect",()=>{console.log("Connected to context WebSocket (detail page)"),v.emit("context.subscribe",{blockId:n},b=>{b.ok?(console.log("Subscribed to context room (detail page):",b.room),y()):console.error("Failed to subscribe to context room (detail page)",b.error)})}),v.on("connect_error",b=>{console.error("Context detail websocket connect_error",b.message)}),v.on("disconnect",()=>{console.log("Context WebSocket disconnected (detail page)")}),v.on(pl.CONTEXT_BLOCK_UPDATED,b=>{b.payload.id===n&&(console.log("context.block.updated (detail page)",b),y().catch(x=>console.error("Error refreshing block after update:",x)))}),v.on(pl.CONTEXT_BLOCK_DELETED,b=>{b.payload.blockId===n&&(console.log("context.block.deleted (detail page)",b),p(!0),i(null))}),()=>{v.emit("context.unsubscribe",{blockId:n}),v.close()}},[n,y]),{block:t,isLoading:l,error:u,isDeleted:m}}const M_=d.createContext(null);function LR({children:n}){const{blocks:t,getBlockById:i,isLoading:l,error:c,isConnected:u,reload:h}=OR(),[m,p]=d.useState(""),y=d.useMemo(()=>({blocks:t,getBlockById:i,isLoading:l,error:c,isConnected:u,reload:h,sectionTitle:m,setSectionTitle:p}),[t,i,l,c,u,h,m,p]);return a.jsx(M_.Provider,{value:y,children:n})}function zc(){const n=d.useContext(M_);if(!n)throw new Error("useContextCtx must be used within <ContextProvider>");return n}const MR=6;function I_(n){return typeof n=="string"?n:n&&typeof n=="object"&&"id"in n&&typeof n.id=="string"?n.id:null}function lx(n,t){return n.order!==t.order?t.order-n.order:n.title.localeCompare(t.title)}function IR(n){const t=new Map;n.forEach(u=>{t.set(u.id,{block:u,children:[],latestUpdatedAt:new Date(u.updatedAt).getTime()})});const i=[];n.forEach(u=>{const h=t.get(u.id);if(!h)return;const m=I_(u.parentId);if(!m){i.push(h);return}const p=t.get(m);if(!p){i.push(h);return}p.children.push(h)});const l=u=>{u.sort((h,m)=>lx(h.block,m.block)),u.forEach(h=>l(h.children))};l(i);const c=u=>{if(u.children.length===0)return u.latestUpdatedAt;let h=u.latestUpdatedAt;return u.children.forEach(m=>{const p=c(m);p>h&&(h=p)}),u.latestUpdatedAt=h,h};return i.forEach(u=>{c(u)}),i.sort((u,h)=>{const m=h.latestUpdatedAt-u.latestUpdatedAt;return m!==0?m:lx(u.block,h.block)}),i}function q_({nodes:n,depth:t,onOpenBlock:i,onAddChild:l,collapsedIds:c,onToggleNode:u,selectedBlockId:h,compact:m=!1}){return a.jsx("ul",{className:"context-tree__branch",role:t===0?"tree":"group",children:n.map(p=>{const y=p.children.length>0,v=y?!c.has(p.block.id):!1,b=Math.min(t,MR),x=h===p.block.id;return a.jsxs("li",{className:"context-tree__item",role:"treeitem","aria-expanded":y?v:void 0,children:[a.jsxs("div",{className:`context-tree__row ${x?"context-tree__row--selected":""} ${m?"context-tree__row--compact":""}`,style:{"--tree-depth":b},children:[y?a.jsx("button",{type:"button",className:"context-tree__toggle","aria-expanded":v,"aria-label":v?`Collapse ${p.block.title}`:`Expand ${p.block.title}`,onClick:()=>u(p.block.id),children:a.jsx("span",{className:"context-tree__marker","aria-hidden":"true",children:v?"▼":"►"})}):a.jsx("span",{className:"context-tree__spacer","aria-hidden":"true"}),a.jsxs("button",{type:"button",className:"context-tree__open",onClick:()=>i(p.block.id),children:[a.jsxs("div",{className:"context-tree__main",children:[a.jsx(S,{weight:x?"bold":"medium",size:m?"2":"3",tone:"default",className:"context-tree__title",children:p.block.title}),m?null:a.jsxs("div",{className:"context-tree__meta",children:[a.jsxs("span",{className:"context-tree__id",children:["#",p.block.id.slice(0,6)]}),a.jsx("span",{children:p.block.createdBy||"unknown"})]})]}),!m&&p.block.tags.length>0?a.jsxs("div",{className:"context-tree__tags","aria-label":"Block tags",children:[p.block.tags.slice(0,2).map(_=>a.jsx("span",{className:"context-tree__tag",children:_.name},`${p.block.id}-${_.id}`)),p.block.tags.length>2?a.jsxs("span",{className:"context-tree__tag context-tree__tag--count",children:["+",p.block.tags.length-2]}):null]}):null]}),l?a.jsx("button",{type:"button",className:"context-tree__add-child","aria-label":`Add child block under ${p.block.title}`,onClick:_=>{_.stopPropagation(),l(p.block.id)},children:"+"}):null]}),y&&v?a.jsx(q_,{nodes:p.children,depth:t+1,onOpenBlock:i,onAddChild:l,collapsedIds:c,onToggleNode:u,selectedBlockId:h,compact:m}):null]},p.block.id)})})}function ox(n){const t=new Set,i=l=>{for(const c of l)c.children.length>0&&(t.add(c.block.id),i(c.children))};return i(n),t}function U_({blocks:n,onOpenBlock:t,onAddChild:i,selectedBlockId:l,compact:c=!1}){const u=d.useMemo(()=>IR(n),[n]),[h,m]=d.useState(()=>ox(u)),p=d.useRef(!1);d.useEffect(()=>{!p.current&&u.length>0&&(m(ox(u)),p.current=!0)},[u]),d.useEffect(()=>{if(!l)return;const v=new Map;n.forEach(_=>{v.set(_.id,I_(_.parentId))});const b=new Set;let x=v.get(l)??null;for(;x;)b.add(x),x=v.get(x)??null;b.size!==0&&m(_=>{const k=new Set(_);return b.forEach(T=>k.delete(T)),k})},[n,l]);const y=v=>{m(b=>{const x=new Set(b);return x.has(v)?x.delete(v):x.add(v),x})};return a.jsx("section",{className:`context-tree ${c?"context-tree--compact":""}`,children:a.jsx(q_,{nodes:u,depth:0,onOpenBlock:t,onAddChild:i,collapsedIds:h,onToggleNode:y,selectedBlockId:l,compact:c})})}function qR(){const n=Dt(),{sectionTitle:t,blocks:i,isLoading:l,error:c}=zc(),u=De(),h=Mt(),{id:m}=Jt(),[p,y]=d.useState(!1),[v,b]=d.useState(!1);return d.useEffect(()=>{if(!n)return;const x=localStorage.getItem("context-sidebar-collapsed");y(x==="true")},[n]),d.useEffect(()=>{n&&localStorage.setItem("context-sidebar-collapsed",String(p))},[n,p]),d.useEffect(()=>{b(!1)},[h.pathname]),a.jsxs("div",{className:`context-layout ${n?"context-layout--desktop":"context-layout--mobile"}`,children:[!n&&a.jsxs(a.Fragment,{children:[v&&a.jsx("div",{className:"context-layout__drawer-overlay",onClick:()=>b(!1)}),a.jsxs("aside",{className:`context-layout__drawer ${v?"context-layout__drawer--open":""}`,children:[a.jsxs("div",{className:"context-layout__drawer-header",children:[a.jsx(S,{size:"4",weight:"bold",children:"taico"}),a.jsx("button",{className:"context-layout__drawer-close",onClick:()=>b(!1),"aria-label":"Close menu",children:"✕"})]}),a.jsx("nav",{className:"context-layout__drawer-nav",children:Vr.map(x=>{const _=h.pathname===x.path||h.pathname.startsWith(x.path+"/");return a.jsxs(qs,{to:x.path,className:`context-layout__drawer-item ${_?"context-layout__drawer-item--active":""}`,children:[a.jsx(jl,{icon:x.icon,className:"context-layout__drawer-icon"}),a.jsx("span",{children:x.label})]},x.path)})})]})]}),!n&&a.jsx("header",{className:"context-layout__mobile-header",children:a.jsxs(yt,{spacing:"5",align:"center",children:[a.jsx("button",{className:"context-layout__hamburger",onClick:()=>b(!0),"aria-label":"Open menu",children:"☰"}),a.jsx(S,{size:"3",weight:"normal",as:"div",children:"Context"}),a.jsx(S,{size:"3",weight:"semibold",as:"div",className:"context-layout__mobile-section-title",children:t})]})}),n&&a.jsxs("aside",{className:`context-desktop__sidebar ${p?"context-desktop__sidebar--collapsed":""}`,children:[a.jsx("div",{className:"context-desktop__sidebar-header",children:p?a.jsx(S,{as:"div",size:"1",tone:"muted",children:i.length}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"context-desktop__sidebar-title",onClick:()=>u("/context/home"),children:a.jsx(S,{as:"span",size:"2",weight:"semibold",children:"Context"})}),a.jsxs("div",{className:"context-desktop__sidebar-header-actions",children:[a.jsx(S,{as:"div",size:"1",tone:"muted",children:i.length}),a.jsx("button",{type:"button",className:"context-desktop__sidebar-new",onClick:()=>u("/context/new"),"aria-label":"New block",title:"New block",children:"+"})]})]})}),a.jsx("div",{className:"context-desktop__sidebar-body",children:p?null:l?a.jsx("div",{className:"context-home__loading",children:"Loading context blocks..."}):c?a.jsxs("div",{className:"context-home__error",children:["Error: ",c]}):i.length===0?a.jsx("div",{className:"context-home__empty",children:"No context blocks found"}):a.jsx(U_,{blocks:i,onOpenBlock:x=>u(`/context/block/${x}`),onAddChild:x=>u(`/context/new?parentId=${x}`),selectedBlockId:m,compact:!0})}),a.jsx("button",{type:"button",className:"context-desktop__sidebar-toggle",onClick:()=>y(x=>!x),"aria-label":p?"Expand context sidebar":"Collapse context sidebar",children:p?"→":"←"})]}),a.jsx("main",{className:"context-layout__main",children:a.jsx(Qt,{})})]})}function UR(){const{setSectionTitle:n,blocks:t,isLoading:i,error:l}=zc(),c=De(),u=Dt(),[h,m]=d.useState("");return vt(),d.useEffect(()=>{n("Context")},[n]),i?a.jsx("div",{className:"context-home__loading",children:"Loading context blocks..."}):l?a.jsxs("div",{className:"context-home__error",children:["Error: ",l]}):t.length===0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"context-home__empty",children:a.jsx("div",{className:"context-home__empty-message",children:"No context blocks found"})}),a.jsx(jh,{onClick:()=>c("/context/new"),isDesktop:u})]}):u?a.jsxs(a.Fragment,{children:[a.jsx(BR,{blocks:t,searchQuery:h,onSearchQueryChange:m,onOpenBlock:p=>c(`/context/block/${p}`)}),a.jsx(jh,{onClick:()=>c("/context/new"),isDesktop:u})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"context-home",children:a.jsx(U_,{blocks:t,onOpenBlock:p=>c(`/context/block/${p}`),onAddChild:p=>c(`/context/new?parentId=${p}`)})}),a.jsx(jh,{onClick:()=>c("/context/new"),isDesktop:u})]})}function jh({onClick:n,isDesktop:t}){return t?a.jsxs("button",{className:"context-fab context-fab--desktop",type:"button",onClick:n,children:[a.jsx("span",{className:"context-fab__plus",children:"+"}),a.jsx("span",{className:"context-fab__label",children:"New block"})]}):a.jsx("button",{className:"context-fab",type:"button",onClick:n,"aria-label":"Create new block",children:"+"})}function BR({blocks:n,searchQuery:t,onSearchQueryChange:i,onOpenBlock:l}){const c=t.trim().toLowerCase(),u=d.useMemo(()=>c?n.filter(h=>[h.title,h.createdBy||"",h.id,...h.tags.map(p=>p.name)].some(p=>p.toLowerCase().includes(c))):n.slice(0,18),[n,c]);return a.jsxs("div",{className:"context-home-desktop",children:[a.jsx("div",{className:"context-home-desktop__hero",children:a.jsx(S,{as:"div",size:"6",weight:"bold",className:"context-home-desktop__title",children:"Blocks"})}),a.jsx("div",{className:"context-home-desktop__search-box",children:a.jsx("input",{type:"search",className:"context-home-desktop__search-input",placeholder:"Search by title, tag, author, or block id",value:t,onChange:h=>i(h.target.value)})}),a.jsx("div",{className:"context-home-desktop__results",children:u.length===0?a.jsxs("div",{className:"context-home-desktop__empty",children:[a.jsx(S,{as:"div",size:"3",weight:"medium",children:"No matching blocks"}),a.jsx(S,{as:"div",size:"2",tone:"muted",children:"Try a different title, tag, author, or id fragment."})]}):u.map(h=>a.jsx(_e,{className:"context-home-desktop__result",onClick:()=>l(h.id),topRight:a.jsx(S,{as:"span",size:"2",tone:"muted",children:Lt(h.updatedAt)}),tags:h.tags.slice(0,3).map(m=>({label:m.name})),children:a.jsxs("div",{className:"context-home-desktop__result-main",children:[a.jsx("div",{className:"row-title",children:h.title}),a.jsxs("div",{className:"row-detail",children:["#",h.id.slice(0,6)," ",h.createdBy||"unknown"]})]})},h.id))})]})}function Tf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Za=Tf();function B_(n){Za=n}var Ba={exec:()=>null};function Ke(n,t=""){let i=typeof n=="string"?n:n.source,l={replace:(c,u)=>{let h=typeof u=="string"?u:u.source;return h=h.replace(nn.caret,"$1"),i=i.replace(c,h),l},getRegex:()=>new RegExp(i,t)};return l}var $R=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),nn={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:n=>new RegExp(`^( {0,3}${n})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}#`),htmlBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:n=>new RegExp(`^ {0,${Math.min(3,n-1)}}>`)},PR=/^(?:[ \t]*(?:\n|$))+/,HR=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,GR=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,kl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,VR=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,wf=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,$_=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,P_=Ke($_).replace(/bull/g,wf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),FR=Ke($_).replace(/bull/g,wf).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),kf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,YR=/^[^\n]+/,Ef=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,KR=Ke(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Ef).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),XR=Ke(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,wf).getRegex(),Lc="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Cf=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,QR=Ke("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Cf).replace("tag",Lc).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),H_=Ke(kf).replace("hr",kl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Lc).getRegex(),ZR=Ke(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",H_).getRegex(),Nf={blockquote:ZR,code:HR,def:KR,fences:GR,heading:VR,hr:kl,html:QR,lheading:P_,list:XR,newline:PR,paragraph:H_,table:Ba,text:YR},cx=Ke("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",kl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Lc).getRegex(),WR={...Nf,lheading:FR,table:cx,paragraph:Ke(kf).replace("hr",kl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",cx).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Lc).getRegex()},JR={...Nf,html:Ke(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Cf).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Ba,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ke(kf).replace("hr",kl).replace("heading",` *#{1,6} *[^
|
|
57
|
+
]`).replace("lheading",P_).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},e2=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,t2=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,G_=/^( {2,}|\\)\n(?!\s*$)/,n2=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ai=/[\p{P}\p{S}]/u,Mc=/[\s\p{P}\p{S}]/u,Af=/[^\s\p{P}\p{S}]/u,s2=Ke(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Mc).getRegex(),V_=/(?!~)[\p{P}\p{S}]/u,a2=/(?!~)[\s\p{P}\p{S}]/u,r2=/(?:[^\s\p{P}\p{S}]|~)/u,i2=Ke(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",$R?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),F_=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,l2=Ke(F_,"u").replace(/punct/g,ai).getRegex(),o2=Ke(F_,"u").replace(/punct/g,V_).getRegex(),Y_="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",c2=Ke(Y_,"gu").replace(/notPunctSpace/g,Af).replace(/punctSpace/g,Mc).replace(/punct/g,ai).getRegex(),u2=Ke(Y_,"gu").replace(/notPunctSpace/g,r2).replace(/punctSpace/g,a2).replace(/punct/g,V_).getRegex(),d2=Ke("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Af).replace(/punctSpace/g,Mc).replace(/punct/g,ai).getRegex(),h2=Ke(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ai).getRegex(),f2="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",p2=Ke(f2,"gu").replace(/notPunctSpace/g,Af).replace(/punctSpace/g,Mc).replace(/punct/g,ai).getRegex(),m2=Ke(/\\(punct)/,"gu").replace(/punct/g,ai).getRegex(),g2=Ke(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),y2=Ke(Cf).replace("(?:-->|$)","-->").getRegex(),v2=Ke("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",y2).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),_c=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,x2=Ke(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",_c).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),K_=Ke(/^!?\[(label)\]\[(ref)\]/).replace("label",_c).replace("ref",Ef).getRegex(),X_=Ke(/^!?\[(ref)\](?:\[\])?/).replace("ref",Ef).getRegex(),b2=Ke("reflink|nolink(?!\\()","g").replace("reflink",K_).replace("nolink",X_).getRegex(),ux=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Rf={_backpedal:Ba,anyPunctuation:m2,autolink:g2,blockSkip:i2,br:G_,code:t2,del:Ba,delLDelim:Ba,delRDelim:Ba,emStrongLDelim:l2,emStrongRDelimAst:c2,emStrongRDelimUnd:d2,escape:e2,link:x2,nolink:X_,punctuation:s2,reflink:K_,reflinkSearch:b2,tag:v2,text:n2,url:Ba},_2={...Rf,link:Ke(/^!?\[(label)\]\((.*?)\)/).replace("label",_c).getRegex(),reflink:Ke(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",_c).getRegex()},Hh={...Rf,emStrongRDelimAst:u2,emStrongLDelim:o2,delLDelim:h2,delRDelim:p2,url:Ke(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ux).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Ke(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",ux).getRegex()},S2={...Hh,br:Ke(G_).replace("{2,}","*").getRegex(),text:Ke(Hh.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},nc={normal:Nf,gfm:WR,pedantic:JR},rl={normal:Rf,gfm:Hh,breaks:S2,pedantic:_2},j2={"&":"&","<":"<",">":">",'"':""","'":"'"},dx=n=>j2[n];function cs(n,t){if(t){if(nn.escapeTest.test(n))return n.replace(nn.escapeReplace,dx)}else if(nn.escapeTestNoEncode.test(n))return n.replace(nn.escapeReplaceNoEncode,dx);return n}function hx(n){try{n=encodeURI(n).replace(nn.percentDecode,"%")}catch{return null}return n}function fx(n,t){let i=n.replace(nn.findPipe,(u,h,m)=>{let p=!1,y=h;for(;--y>=0&&m[y]==="\\";)p=!p;return p?"|":" |"}),l=i.split(nn.splitPipe),c=0;if(l[0].trim()||l.shift(),l.length>0&&!l.at(-1)?.trim()&&l.pop(),t)if(l.length>t)l.splice(t);else for(;l.length<t;)l.push("");for(;c<l.length;c++)l[c]=l[c].trim().replace(nn.slashPipe,"|");return l}function il(n,t,i){let l=n.length;if(l===0)return"";let c=0;for(;c<l&&n.charAt(l-c-1)===t;)c++;return n.slice(0,l-c)}function T2(n,t){if(n.indexOf(t[1])===-1)return-1;let i=0;for(let l=0;l<n.length;l++)if(n[l]==="\\")l++;else if(n[l]===t[0])i++;else if(n[l]===t[1]&&(i--,i<0))return l;return i>0?-2:-1}function w2(n,t=0){let i=t,l="";for(let c of n)if(c===" "){let u=4-i%4;l+=" ".repeat(u),i+=u}else l+=c,i++;return l}function px(n,t,i,l,c){let u=t.href,h=t.title||null,m=n[1].replace(c.other.outputLinkReplace,"$1");l.state.inLink=!0;let p={type:n[0].charAt(0)==="!"?"image":"link",raw:i,href:u,title:h,text:m,tokens:l.inlineTokens(m)};return l.state.inLink=!1,p}function k2(n,t,i){let l=n.match(i.other.indentCodeCompensation);if(l===null)return t;let c=l[1];return t.split(`
|
|
58
|
+
`).map(u=>{let h=u.match(i.other.beginningSpace);if(h===null)return u;let[m]=h;return m.length>=c.length?u.slice(c.length):u}).join(`
|
|
59
|
+
`)}var Sc=class{options;rules;lexer;constructor(n){this.options=n||Za}space(n){let t=this.rules.block.newline.exec(n);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(n){let t=this.rules.block.code.exec(n);if(t){let i=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:il(i,`
|
|
60
|
+
`)}}}fences(n){let t=this.rules.block.fences.exec(n);if(t){let i=t[0],l=k2(i,t[3]||"",this.rules);return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:l}}}heading(n){let t=this.rules.block.heading.exec(n);if(t){let i=t[2].trim();if(this.rules.other.endingHash.test(i)){let l=il(i,"#");(this.options.pedantic||!l||this.rules.other.endingSpaceChar.test(l))&&(i=l.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(n){let t=this.rules.block.hr.exec(n);if(t)return{type:"hr",raw:il(t[0],`
|
|
61
|
+
`)}}blockquote(n){let t=this.rules.block.blockquote.exec(n);if(t){let i=il(t[0],`
|
|
62
|
+
`).split(`
|
|
63
|
+
`),l="",c="",u=[];for(;i.length>0;){let h=!1,m=[],p;for(p=0;p<i.length;p++)if(this.rules.other.blockquoteStart.test(i[p]))m.push(i[p]),h=!0;else if(!h)m.push(i[p]);else break;i=i.slice(p);let y=m.join(`
|
|
64
|
+
`),v=y.replace(this.rules.other.blockquoteSetextReplace,`
|
|
65
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");l=l?`${l}
|
|
66
|
+
${y}`:y,c=c?`${c}
|
|
67
|
+
${v}`:v;let b=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(v,u,!0),this.lexer.state.top=b,i.length===0)break;let x=u.at(-1);if(x?.type==="code")break;if(x?.type==="blockquote"){let _=x,k=_.raw+`
|
|
68
|
+
`+i.join(`
|
|
69
|
+
`),T=this.blockquote(k);u[u.length-1]=T,l=l.substring(0,l.length-_.raw.length)+T.raw,c=c.substring(0,c.length-_.text.length)+T.text;break}else if(x?.type==="list"){let _=x,k=_.raw+`
|
|
70
|
+
`+i.join(`
|
|
71
|
+
`),T=this.list(k);u[u.length-1]=T,l=l.substring(0,l.length-x.raw.length)+T.raw,c=c.substring(0,c.length-_.raw.length)+T.raw,i=k.substring(u.at(-1).raw.length).split(`
|
|
72
|
+
`);continue}}return{type:"blockquote",raw:l,tokens:u,text:c}}}list(n){let t=this.rules.block.list.exec(n);if(t){let i=t[1].trim(),l=i.length>1,c={type:"list",raw:"",ordered:l,start:l?+i.slice(0,-1):"",loose:!1,items:[]};i=l?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=l?i:"[*+-]");let u=this.rules.other.listItemRegex(i),h=!1;for(;n;){let p=!1,y="",v="";if(!(t=u.exec(n))||this.rules.block.hr.test(n))break;y=t[0],n=n.substring(y.length);let b=w2(t[2].split(`
|
|
73
|
+
`,1)[0],t[1].length),x=n.split(`
|
|
74
|
+
`,1)[0],_=!b.trim(),k=0;if(this.options.pedantic?(k=2,v=b.trimStart()):_?k=t[1].length+1:(k=b.search(this.rules.other.nonSpaceChar),k=k>4?1:k,v=b.slice(k),k+=t[1].length),_&&this.rules.other.blankLine.test(x)&&(y+=x+`
|
|
75
|
+
`,n=n.substring(x.length+1),p=!0),!p){let T=this.rules.other.nextBulletRegex(k),w=this.rules.other.hrRegex(k),E=this.rules.other.fencesBeginRegex(k),R=this.rules.other.headingBeginRegex(k),D=this.rules.other.htmlBeginRegex(k),O=this.rules.other.blockquoteBeginRegex(k);for(;n;){let z=n.split(`
|
|
76
|
+
`,1)[0],A;if(x=z,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),A=x):A=x.replace(this.rules.other.tabCharGlobal," "),E.test(x)||R.test(x)||D.test(x)||O.test(x)||T.test(x)||w.test(x))break;if(A.search(this.rules.other.nonSpaceChar)>=k||!x.trim())v+=`
|
|
77
|
+
`+A.slice(k);else{if(_||b.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||E.test(b)||R.test(b)||w.test(b))break;v+=`
|
|
78
|
+
`+x}_=!x.trim(),y+=z+`
|
|
79
|
+
`,n=n.substring(z.length+1),b=A.slice(k)}}c.loose||(h?c.loose=!0:this.rules.other.doubleBlankLine.test(y)&&(h=!0)),c.items.push({type:"list_item",raw:y,task:!!this.options.gfm&&this.rules.other.listIsTask.test(v),loose:!1,text:v,tokens:[]}),c.raw+=y}let m=c.items.at(-1);if(m)m.raw=m.raw.trimEnd(),m.text=m.text.trimEnd();else return;c.raw=c.raw.trimEnd();for(let p of c.items){if(this.lexer.state.top=!1,p.tokens=this.lexer.blockTokens(p.text,[]),p.task){if(p.text=p.text.replace(this.rules.other.listReplaceTask,""),p.tokens[0]?.type==="text"||p.tokens[0]?.type==="paragraph"){p.tokens[0].raw=p.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),p.tokens[0].text=p.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let v=this.lexer.inlineQueue.length-1;v>=0;v--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[v].src)){this.lexer.inlineQueue[v].src=this.lexer.inlineQueue[v].src.replace(this.rules.other.listReplaceTask,"");break}}let y=this.rules.other.listTaskCheckbox.exec(p.raw);if(y){let v={type:"checkbox",raw:y[0]+" ",checked:y[0]!=="[ ]"};p.checked=v.checked,c.loose?p.tokens[0]&&["paragraph","text"].includes(p.tokens[0].type)&&"tokens"in p.tokens[0]&&p.tokens[0].tokens?(p.tokens[0].raw=v.raw+p.tokens[0].raw,p.tokens[0].text=v.raw+p.tokens[0].text,p.tokens[0].tokens.unshift(v)):p.tokens.unshift({type:"paragraph",raw:v.raw,text:v.raw,tokens:[v]}):p.tokens.unshift(v)}}if(!c.loose){let y=p.tokens.filter(b=>b.type==="space"),v=y.length>0&&y.some(b=>this.rules.other.anyLine.test(b.raw));c.loose=v}}if(c.loose)for(let p of c.items){p.loose=!0;for(let y of p.tokens)y.type==="text"&&(y.type="paragraph")}return c}}html(n){let t=this.rules.block.html.exec(n);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(n){let t=this.rules.block.def.exec(n);if(t){let i=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),l=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",c=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:i,raw:t[0],href:l,title:c}}}table(n){let t=this.rules.block.table.exec(n);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let i=fx(t[1]),l=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),c=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
80
|
+
`):[],u={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===l.length){for(let h of l)this.rules.other.tableAlignRight.test(h)?u.align.push("right"):this.rules.other.tableAlignCenter.test(h)?u.align.push("center"):this.rules.other.tableAlignLeft.test(h)?u.align.push("left"):u.align.push(null);for(let h=0;h<i.length;h++)u.header.push({text:i[h],tokens:this.lexer.inline(i[h]),header:!0,align:u.align[h]});for(let h of c)u.rows.push(fx(h,u.header.length).map((m,p)=>({text:m,tokens:this.lexer.inline(m),header:!1,align:u.align[p]})));return u}}lheading(n){let t=this.rules.block.lheading.exec(n);if(t){let i=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:i,tokens:this.lexer.inline(i)}}}paragraph(n){let t=this.rules.block.paragraph.exec(n);if(t){let i=t[1].charAt(t[1].length-1)===`
|
|
81
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}text(n){let t=this.rules.block.text.exec(n);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(n){let t=this.rules.inline.escape.exec(n);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(n){let t=this.rules.inline.tag.exec(n);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(n){let t=this.rules.inline.link.exec(n);if(t){let i=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(i)){if(!this.rules.other.endAngleBracket.test(i))return;let u=il(i.slice(0,-1),"\\");if((i.length-u.length)%2===0)return}else{let u=T2(t[2],"()");if(u===-2)return;if(u>-1){let h=(t[0].indexOf("!")===0?5:4)+t[1].length+u;t[2]=t[2].substring(0,u),t[0]=t[0].substring(0,h).trim(),t[3]=""}}let l=t[2],c="";if(this.options.pedantic){let u=this.rules.other.pedanticHrefTitle.exec(l);u&&(l=u[1],c=u[3])}else c=t[3]?t[3].slice(1,-1):"";return l=l.trim(),this.rules.other.startAngleBracket.test(l)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(i)?l=l.slice(1):l=l.slice(1,-1)),px(t,{href:l&&l.replace(this.rules.inline.anyPunctuation,"$1"),title:c&&c.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(n,t){let i;if((i=this.rules.inline.reflink.exec(n))||(i=this.rules.inline.nolink.exec(n))){let l=(i[2]||i[1]).replace(this.rules.other.multipleSpaceGlobal," "),c=t[l.toLowerCase()];if(!c){let u=i[0].charAt(0);return{type:"text",raw:u,text:u}}return px(i,c,i[0],this.lexer,this.rules)}}emStrong(n,t,i=""){let l=this.rules.inline.emStrongLDelim.exec(n);if(!(!l||!l[1]&&!l[2]&&!l[3]&&!l[4]||l[4]&&i.match(this.rules.other.unicodeAlphaNumeric))&&(!(l[1]||l[3])||!i||this.rules.inline.punctuation.exec(i))){let c=[...l[0]].length-1,u,h,m=c,p=0,y=l[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(y.lastIndex=0,t=t.slice(-1*n.length+c);(l=y.exec(t))!==null;){if(u=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!u)continue;if(h=[...u].length,l[3]||l[4]){m+=h;continue}else if((l[5]||l[6])&&c%3&&!((c+h)%3)){p+=h;continue}if(m-=h,m>0)continue;h=Math.min(h,h+m+p);let v=[...l[0]][0].length,b=n.slice(0,c+l.index+v+h);if(Math.min(c,h)%2){let _=b.slice(1,-1);return{type:"em",raw:b,text:_,tokens:this.lexer.inlineTokens(_)}}let x=b.slice(2,-2);return{type:"strong",raw:b,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(n){let t=this.rules.inline.code.exec(n);if(t){let i=t[2].replace(this.rules.other.newLineCharGlobal," "),l=this.rules.other.nonSpaceChar.test(i),c=this.rules.other.startingSpaceChar.test(i)&&this.rules.other.endingSpaceChar.test(i);return l&&c&&(i=i.substring(1,i.length-1)),{type:"codespan",raw:t[0],text:i}}}br(n){let t=this.rules.inline.br.exec(n);if(t)return{type:"br",raw:t[0]}}del(n,t,i=""){let l=this.rules.inline.delLDelim.exec(n);if(l&&(!l[1]||!i||this.rules.inline.punctuation.exec(i))){let c=[...l[0]].length-1,u,h,m=c,p=this.rules.inline.delRDelim;for(p.lastIndex=0,t=t.slice(-1*n.length+c);(l=p.exec(t))!==null;){if(u=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!u||(h=[...u].length,h!==c))continue;if(l[3]||l[4]){m+=h;continue}if(m-=h,m>0)continue;h=Math.min(h,h+m);let y=[...l[0]][0].length,v=n.slice(0,c+l.index+y+h),b=v.slice(c,-c);return{type:"del",raw:v,text:b,tokens:this.lexer.inlineTokens(b)}}}}autolink(n){let t=this.rules.inline.autolink.exec(n);if(t){let i,l;return t[2]==="@"?(i=t[1],l="mailto:"+i):(i=t[1],l=i),{type:"link",raw:t[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}url(n){let t;if(t=this.rules.inline.url.exec(n)){let i,l;if(t[2]==="@")i=t[0],l="mailto:"+i;else{let c;do c=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(c!==t[0]);i=t[0],t[1]==="www."?l="http://"+t[0]:l=t[0]}return{type:"link",raw:t[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(n){let t=this.rules.inline.text.exec(n);if(t){let i=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:i}}}},Zn=class Gh{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Za,this.options.tokenizer=this.options.tokenizer||new Sc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let i={other:nn,block:nc.normal,inline:rl.normal};this.options.pedantic?(i.block=nc.pedantic,i.inline=rl.pedantic):this.options.gfm&&(i.block=nc.gfm,this.options.breaks?i.inline=rl.breaks:i.inline=rl.gfm),this.tokenizer.rules=i}static get rules(){return{block:nc,inline:rl}}static lex(t,i){return new Gh(i).lex(t)}static lexInline(t,i){return new Gh(i).inlineTokens(t)}lex(t){t=t.replace(nn.carriageReturn,`
|
|
82
|
+
`),this.blockTokens(t,this.tokens);for(let i=0;i<this.inlineQueue.length;i++){let l=this.inlineQueue[i];this.inlineTokens(l.src,l.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,i=[],l=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(nn.tabCharGlobal," ").replace(nn.spaceLine,""));t;){let c;if(this.options.extensions?.block?.some(h=>(c=h.call({lexer:this},t,i))?(t=t.substring(c.raw.length),i.push(c),!0):!1))continue;if(c=this.tokenizer.space(t)){t=t.substring(c.raw.length);let h=i.at(-1);c.raw.length===1&&h!==void 0?h.raw+=`
|
|
83
|
+
`:i.push(c);continue}if(c=this.tokenizer.code(t)){t=t.substring(c.raw.length);let h=i.at(-1);h?.type==="paragraph"||h?.type==="text"?(h.raw+=(h.raw.endsWith(`
|
|
84
|
+
`)?"":`
|
|
85
|
+
`)+c.raw,h.text+=`
|
|
86
|
+
`+c.text,this.inlineQueue.at(-1).src=h.text):i.push(c);continue}if(c=this.tokenizer.fences(t)){t=t.substring(c.raw.length),i.push(c);continue}if(c=this.tokenizer.heading(t)){t=t.substring(c.raw.length),i.push(c);continue}if(c=this.tokenizer.hr(t)){t=t.substring(c.raw.length),i.push(c);continue}if(c=this.tokenizer.blockquote(t)){t=t.substring(c.raw.length),i.push(c);continue}if(c=this.tokenizer.list(t)){t=t.substring(c.raw.length),i.push(c);continue}if(c=this.tokenizer.html(t)){t=t.substring(c.raw.length),i.push(c);continue}if(c=this.tokenizer.def(t)){t=t.substring(c.raw.length);let h=i.at(-1);h?.type==="paragraph"||h?.type==="text"?(h.raw+=(h.raw.endsWith(`
|
|
87
|
+
`)?"":`
|
|
88
|
+
`)+c.raw,h.text+=`
|
|
89
|
+
`+c.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[c.tag]||(this.tokens.links[c.tag]={href:c.href,title:c.title},i.push(c));continue}if(c=this.tokenizer.table(t)){t=t.substring(c.raw.length),i.push(c);continue}if(c=this.tokenizer.lheading(t)){t=t.substring(c.raw.length),i.push(c);continue}let u=t;if(this.options.extensions?.startBlock){let h=1/0,m=t.slice(1),p;this.options.extensions.startBlock.forEach(y=>{p=y.call({lexer:this},m),typeof p=="number"&&p>=0&&(h=Math.min(h,p))}),h<1/0&&h>=0&&(u=t.substring(0,h+1))}if(this.state.top&&(c=this.tokenizer.paragraph(u))){let h=i.at(-1);l&&h?.type==="paragraph"?(h.raw+=(h.raw.endsWith(`
|
|
90
|
+
`)?"":`
|
|
91
|
+
`)+c.raw,h.text+=`
|
|
92
|
+
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):i.push(c),l=u.length!==t.length,t=t.substring(c.raw.length);continue}if(c=this.tokenizer.text(t)){t=t.substring(c.raw.length);let h=i.at(-1);h?.type==="text"?(h.raw+=(h.raw.endsWith(`
|
|
93
|
+
`)?"":`
|
|
94
|
+
`)+c.raw,h.text+=`
|
|
95
|
+
`+c.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):i.push(c);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,i}inline(t,i=[]){return this.inlineQueue.push({src:t,tokens:i}),i}inlineTokens(t,i=[]){this.tokenizer.lexer=this;let l=t,c=null;if(this.tokens.links){let p=Object.keys(this.tokens.links);if(p.length>0)for(;(c=this.tokenizer.rules.inline.reflinkSearch.exec(l))!==null;)p.includes(c[0].slice(c[0].lastIndexOf("[")+1,-1))&&(l=l.slice(0,c.index)+"["+"a".repeat(c[0].length-2)+"]"+l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(c=this.tokenizer.rules.inline.anyPunctuation.exec(l))!==null;)l=l.slice(0,c.index)+"++"+l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let u;for(;(c=this.tokenizer.rules.inline.blockSkip.exec(l))!==null;)u=c[2]?c[2].length:0,l=l.slice(0,c.index+u)+"["+"a".repeat(c[0].length-u-2)+"]"+l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);l=this.options.hooks?.emStrongMask?.call({lexer:this},l)??l;let h=!1,m="";for(;t;){h||(m=""),h=!1;let p;if(this.options.extensions?.inline?.some(v=>(p=v.call({lexer:this},t,i))?(t=t.substring(p.raw.length),i.push(p),!0):!1))continue;if(p=this.tokenizer.escape(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.tag(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.link(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(p.raw.length);let v=i.at(-1);p.type==="text"&&v?.type==="text"?(v.raw+=p.raw,v.text+=p.text):i.push(p);continue}if(p=this.tokenizer.emStrong(t,l,m)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.codespan(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.br(t)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.del(t,l,m)){t=t.substring(p.raw.length),i.push(p);continue}if(p=this.tokenizer.autolink(t)){t=t.substring(p.raw.length),i.push(p);continue}if(!this.state.inLink&&(p=this.tokenizer.url(t))){t=t.substring(p.raw.length),i.push(p);continue}let y=t;if(this.options.extensions?.startInline){let v=1/0,b=t.slice(1),x;this.options.extensions.startInline.forEach(_=>{x=_.call({lexer:this},b),typeof x=="number"&&x>=0&&(v=Math.min(v,x))}),v<1/0&&v>=0&&(y=t.substring(0,v+1))}if(p=this.tokenizer.inlineText(y)){t=t.substring(p.raw.length),p.raw.slice(-1)!=="_"&&(m=p.raw.slice(-1)),h=!0;let v=i.at(-1);v?.type==="text"?(v.raw+=p.raw,v.text+=p.text):i.push(p);continue}if(t){let v="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(v);break}else throw new Error(v)}}return i}},jc=class{options;parser;constructor(n){this.options=n||Za}space(n){return""}code({text:n,lang:t,escaped:i}){let l=(t||"").match(nn.notSpaceStart)?.[0],c=n.replace(nn.endingNewline,"")+`
|
|
96
|
+
`;return l?'<pre><code class="language-'+cs(l)+'">'+(i?c:cs(c,!0))+`</code></pre>
|
|
97
|
+
`:"<pre><code>"+(i?c:cs(c,!0))+`</code></pre>
|
|
98
|
+
`}blockquote({tokens:n}){return`<blockquote>
|
|
99
|
+
${this.parser.parse(n)}</blockquote>
|
|
100
|
+
`}html({text:n}){return n}def(n){return""}heading({tokens:n,depth:t}){return`<h${t}>${this.parser.parseInline(n)}</h${t}>
|
|
101
|
+
`}hr(n){return`<hr>
|
|
102
|
+
`}list(n){let t=n.ordered,i=n.start,l="";for(let h=0;h<n.items.length;h++){let m=n.items[h];l+=this.listitem(m)}let c=t?"ol":"ul",u=t&&i!==1?' start="'+i+'"':"";return"<"+c+u+`>
|
|
103
|
+
`+l+"</"+c+`>
|
|
104
|
+
`}listitem(n){return`<li>${this.parser.parse(n.tokens)}</li>
|
|
105
|
+
`}checkbox({checked:n}){return"<input "+(n?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:n}){return`<p>${this.parser.parseInline(n)}</p>
|
|
106
|
+
`}table(n){let t="",i="";for(let c=0;c<n.header.length;c++)i+=this.tablecell(n.header[c]);t+=this.tablerow({text:i});let l="";for(let c=0;c<n.rows.length;c++){let u=n.rows[c];i="";for(let h=0;h<u.length;h++)i+=this.tablecell(u[h]);l+=this.tablerow({text:i})}return l&&(l=`<tbody>${l}</tbody>`),`<table>
|
|
107
|
+
<thead>
|
|
108
|
+
`+t+`</thead>
|
|
109
|
+
`+l+`</table>
|
|
110
|
+
`}tablerow({text:n}){return`<tr>
|
|
111
|
+
${n}</tr>
|
|
112
|
+
`}tablecell(n){let t=this.parser.parseInline(n.tokens),i=n.header?"th":"td";return(n.align?`<${i} align="${n.align}">`:`<${i}>`)+t+`</${i}>
|
|
113
|
+
`}strong({tokens:n}){return`<strong>${this.parser.parseInline(n)}</strong>`}em({tokens:n}){return`<em>${this.parser.parseInline(n)}</em>`}codespan({text:n}){return`<code>${cs(n,!0)}</code>`}br(n){return"<br>"}del({tokens:n}){return`<del>${this.parser.parseInline(n)}</del>`}link({href:n,title:t,tokens:i}){let l=this.parser.parseInline(i),c=hx(n);if(c===null)return l;n=c;let u='<a href="'+n+'"';return t&&(u+=' title="'+cs(t)+'"'),u+=">"+l+"</a>",u}image({href:n,title:t,text:i,tokens:l}){l&&(i=this.parser.parseInline(l,this.parser.textRenderer));let c=hx(n);if(c===null)return cs(i);n=c;let u=`<img src="${n}" alt="${cs(i)}"`;return t&&(u+=` title="${cs(t)}"`),u+=">",u}text(n){return"tokens"in n&&n.tokens?this.parser.parseInline(n.tokens):"escaped"in n&&n.escaped?n.text:cs(n.text)}},Df=class{strong({text:n}){return n}em({text:n}){return n}codespan({text:n}){return n}del({text:n}){return n}html({text:n}){return n}text({text:n}){return n}link({text:n}){return""+n}image({text:n}){return""+n}br(){return""}checkbox({raw:n}){return n}},Wn=class Vh{options;renderer;textRenderer;constructor(t){this.options=t||Za,this.options.renderer=this.options.renderer||new jc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Df}static parse(t,i){return new Vh(i).parse(t)}static parseInline(t,i){return new Vh(i).parseInline(t)}parse(t){this.renderer.parser=this;let i="";for(let l=0;l<t.length;l++){let c=t[l];if(this.options.extensions?.renderers?.[c.type]){let h=c,m=this.options.extensions.renderers[h.type].call({parser:this},h);if(m!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(h.type)){i+=m||"";continue}}let u=c;switch(u.type){case"space":{i+=this.renderer.space(u);break}case"hr":{i+=this.renderer.hr(u);break}case"heading":{i+=this.renderer.heading(u);break}case"code":{i+=this.renderer.code(u);break}case"table":{i+=this.renderer.table(u);break}case"blockquote":{i+=this.renderer.blockquote(u);break}case"list":{i+=this.renderer.list(u);break}case"checkbox":{i+=this.renderer.checkbox(u);break}case"html":{i+=this.renderer.html(u);break}case"def":{i+=this.renderer.def(u);break}case"paragraph":{i+=this.renderer.paragraph(u);break}case"text":{i+=this.renderer.text(u);break}default:{let h='Token with "'+u.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return i}parseInline(t,i=this.renderer){this.renderer.parser=this;let l="";for(let c=0;c<t.length;c++){let u=t[c];if(this.options.extensions?.renderers?.[u.type]){let m=this.options.extensions.renderers[u.type].call({parser:this},u);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(u.type)){l+=m||"";continue}}let h=u;switch(h.type){case"escape":{l+=i.text(h);break}case"html":{l+=i.html(h);break}case"link":{l+=i.link(h);break}case"image":{l+=i.image(h);break}case"checkbox":{l+=i.checkbox(h);break}case"strong":{l+=i.strong(h);break}case"em":{l+=i.em(h);break}case"codespan":{l+=i.codespan(h);break}case"br":{l+=i.br(h);break}case"del":{l+=i.del(h);break}case"text":{l+=i.text(h);break}default:{let m='Token with "'+h.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return l}},dl=class{options;block;constructor(n){this.options=n||Za}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(n){return n}postprocess(n){return n}processAllTokens(n){return n}emStrongMask(n){return n}provideLexer(n=this.block){return n?Zn.lex:Zn.lexInline}provideParser(n=this.block){return n?Wn.parse:Wn.parseInline}},Q_=class{defaults=Tf();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Wn;Renderer=jc;TextRenderer=Df;Lexer=Zn;Tokenizer=Sc;Hooks=dl;constructor(...n){this.use(...n)}walkTokens(n,t){let i=[];for(let l of n)switch(i=i.concat(t.call(this,l)),l.type){case"table":{let c=l;for(let u of c.header)i=i.concat(this.walkTokens(u.tokens,t));for(let u of c.rows)for(let h of u)i=i.concat(this.walkTokens(h.tokens,t));break}case"list":{let c=l;i=i.concat(this.walkTokens(c.items,t));break}default:{let c=l;this.defaults.extensions?.childTokens?.[c.type]?this.defaults.extensions.childTokens[c.type].forEach(u=>{let h=c[u].flat(1/0);i=i.concat(this.walkTokens(h,t))}):c.tokens&&(i=i.concat(this.walkTokens(c.tokens,t)))}}return i}use(...n){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return n.forEach(i=>{let l={...i};if(l.async=this.defaults.async||l.async||!1,i.extensions&&(i.extensions.forEach(c=>{if(!c.name)throw new Error("extension name required");if("renderer"in c){let u=t.renderers[c.name];u?t.renderers[c.name]=function(...h){let m=c.renderer.apply(this,h);return m===!1&&(m=u.apply(this,h)),m}:t.renderers[c.name]=c.renderer}if("tokenizer"in c){if(!c.level||c.level!=="block"&&c.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let u=t[c.level];u?u.unshift(c.tokenizer):t[c.level]=[c.tokenizer],c.start&&(c.level==="block"?t.startBlock?t.startBlock.push(c.start):t.startBlock=[c.start]:c.level==="inline"&&(t.startInline?t.startInline.push(c.start):t.startInline=[c.start]))}"childTokens"in c&&c.childTokens&&(t.childTokens[c.name]=c.childTokens)}),l.extensions=t),i.renderer){let c=this.defaults.renderer||new jc(this.defaults);for(let u in i.renderer){if(!(u in c))throw new Error(`renderer '${u}' does not exist`);if(["options","parser"].includes(u))continue;let h=u,m=i.renderer[h],p=c[h];c[h]=(...y)=>{let v=m.apply(c,y);return v===!1&&(v=p.apply(c,y)),v||""}}l.renderer=c}if(i.tokenizer){let c=this.defaults.tokenizer||new Sc(this.defaults);for(let u in i.tokenizer){if(!(u in c))throw new Error(`tokenizer '${u}' does not exist`);if(["options","rules","lexer"].includes(u))continue;let h=u,m=i.tokenizer[h],p=c[h];c[h]=(...y)=>{let v=m.apply(c,y);return v===!1&&(v=p.apply(c,y)),v}}l.tokenizer=c}if(i.hooks){let c=this.defaults.hooks||new dl;for(let u in i.hooks){if(!(u in c))throw new Error(`hook '${u}' does not exist`);if(["options","block"].includes(u))continue;let h=u,m=i.hooks[h],p=c[h];dl.passThroughHooks.has(u)?c[h]=y=>{if(this.defaults.async&&dl.passThroughHooksRespectAsync.has(u))return(async()=>{let b=await m.call(c,y);return p.call(c,b)})();let v=m.call(c,y);return p.call(c,v)}:c[h]=(...y)=>{if(this.defaults.async)return(async()=>{let b=await m.apply(c,y);return b===!1&&(b=await p.apply(c,y)),b})();let v=m.apply(c,y);return v===!1&&(v=p.apply(c,y)),v}}l.hooks=c}if(i.walkTokens){let c=this.defaults.walkTokens,u=i.walkTokens;l.walkTokens=function(h){let m=[];return m.push(u.call(this,h)),c&&(m=m.concat(c.call(this,h))),m}}this.defaults={...this.defaults,...l}}),this}setOptions(n){return this.defaults={...this.defaults,...n},this}lexer(n,t){return Zn.lex(n,t??this.defaults)}parser(n,t){return Wn.parse(n,t??this.defaults)}parseMarkdown(n){return(t,i)=>{let l={...i},c={...this.defaults,...l},u=this.onError(!!c.silent,!!c.async);if(this.defaults.async===!0&&l.async===!1)return u(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return u(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return u(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(c.hooks&&(c.hooks.options=c,c.hooks.block=n),c.async)return(async()=>{let h=c.hooks?await c.hooks.preprocess(t):t,m=await(c.hooks?await c.hooks.provideLexer(n):n?Zn.lex:Zn.lexInline)(h,c),p=c.hooks?await c.hooks.processAllTokens(m):m;c.walkTokens&&await Promise.all(this.walkTokens(p,c.walkTokens));let y=await(c.hooks?await c.hooks.provideParser(n):n?Wn.parse:Wn.parseInline)(p,c);return c.hooks?await c.hooks.postprocess(y):y})().catch(u);try{c.hooks&&(t=c.hooks.preprocess(t));let h=(c.hooks?c.hooks.provideLexer(n):n?Zn.lex:Zn.lexInline)(t,c);c.hooks&&(h=c.hooks.processAllTokens(h)),c.walkTokens&&this.walkTokens(h,c.walkTokens);let m=(c.hooks?c.hooks.provideParser(n):n?Wn.parse:Wn.parseInline)(h,c);return c.hooks&&(m=c.hooks.postprocess(m)),m}catch(h){return u(h)}}}onError(n,t){return i=>{if(i.message+=`
|
|
114
|
+
Please report this to https://github.com/markedjs/marked.`,n){let l="<p>An error occurred:</p><pre>"+cs(i.message+"",!0)+"</pre>";return t?Promise.resolve(l):l}if(t)return Promise.reject(i);throw i}}},Ka=new Q_;function lt(n,t){return Ka.parse(n,t)}lt.options=lt.setOptions=function(n){return Ka.setOptions(n),lt.defaults=Ka.defaults,B_(lt.defaults),lt};lt.getDefaults=Tf;lt.defaults=Za;lt.use=function(...n){return Ka.use(...n),lt.defaults=Ka.defaults,B_(lt.defaults),lt};lt.walkTokens=function(n,t){return Ka.walkTokens(n,t)};lt.parseInline=Ka.parseInline;lt.Parser=Wn;lt.parser=Wn.parse;lt.Renderer=jc;lt.TextRenderer=Df;lt.Lexer=Zn;lt.lexer=Zn.lex;lt.Tokenizer=Sc;lt.Hooks=dl;lt.parse=lt;lt.options;lt.setOptions;lt.use;lt.walkTokens;lt.parseInline;Wn.parse;Zn.lex;var Hr=function(){return Hr=Object.assign||function(n){for(var t,i=1,l=arguments.length;i<l;i++){t=arguments[i];for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=t[c])}return n},Hr.apply(this,arguments)},E2="~",C2="~~";function Of(n,t){for(var i={},l={},c=n.split(C2),u=!1,h=0;c.length>h;h++){for(var m=c[h].split(E2),p=0;p<m.length;p+=2){var y=m[p],v=m[p+1],b="&"+y+";";i[b]=v,u&&(i["&"+y]=v),l[v]=b}u=!0}return t?{entities:Hr(Hr({},i),t.entities),characters:Hr(Hr({},l),t.characters)}:{entities:i,characters:l}}var Th={xml:/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g,html4:/∉|&(?:nbsp|iexcl|cent|pound|curren|yen|brvbar|sect|uml|copy|ordf|laquo|not|shy|reg|macr|deg|plusmn|sup2|sup3|acute|micro|para|middot|cedil|sup1|ordm|raquo|frac14|frac12|frac34|iquest|Agrave|Aacute|Acirc|Atilde|Auml|Aring|AElig|Ccedil|Egrave|Eacute|Ecirc|Euml|Igrave|Iacute|Icirc|Iuml|ETH|Ntilde|Ograve|Oacute|Ocirc|Otilde|Ouml|times|Oslash|Ugrave|Uacute|Ucirc|Uuml|Yacute|THORN|szlig|agrave|aacute|acirc|atilde|auml|aring|aelig|ccedil|egrave|eacute|ecirc|euml|igrave|iacute|icirc|iuml|eth|ntilde|ograve|oacute|ocirc|otilde|ouml|divide|oslash|ugrave|uacute|ucirc|uuml|yacute|thorn|yuml|quot|amp|lt|gt|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g,html5:/·|℗|⋇|⪧|⩺|⋗|⦕|⩼|⪆|⥸|⋗|⋛|⪌|≷|≳|⪦|⩹|⋖|⋋|⋉|⥶|⩻|⦖|◃|⊴|◂|∉|⋹̸|⋵̸|∉|⋷|⋶|∌|∌|⋾|⋽|∥|⊠|⨱|⨰|&(?:AElig|AMP|Aacute|Acirc|Agrave|Aring|Atilde|Auml|COPY|Ccedil|ETH|Eacute|Ecirc|Egrave|Euml|GT|Iacute|Icirc|Igrave|Iuml|LT|Ntilde|Oacute|Ocirc|Ograve|Oslash|Otilde|Ouml|QUOT|REG|THORN|Uacute|Ucirc|Ugrave|Uuml|Yacute|aacute|acirc|acute|aelig|agrave|amp|aring|atilde|auml|brvbar|ccedil|cedil|cent|copy|curren|deg|divide|eacute|ecirc|egrave|eth|euml|frac12|frac14|frac34|gt|iacute|icirc|iexcl|igrave|iquest|iuml|laquo|lt|macr|micro|middot|nbsp|not|ntilde|oacute|ocirc|ograve|ordf|ordm|oslash|otilde|ouml|para|plusmn|pound|quot|raquo|reg|sect|shy|sup1|sup2|sup3|szlig|thorn|times|uacute|ucirc|ugrave|uml|uuml|yacute|yen|yuml|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g},Kr={};Kr.xml=Of(`lt~<~gt~>~quot~"~apos~'~amp~&`);Kr.html4=Of(`apos~'~OElig~Œ~oelig~œ~Scaron~Š~scaron~š~Yuml~Ÿ~circ~ˆ~tilde~˜~ensp~ ~emsp~ ~thinsp~ ~zwnj~~zwj~~lrm~~rlm~~ndash~–~mdash~—~lsquo~‘~rsquo~’~sbquo~‚~ldquo~“~rdquo~”~bdquo~„~dagger~†~Dagger~‡~permil~‰~lsaquo~‹~rsaquo~›~euro~€~fnof~ƒ~Alpha~Α~Beta~Β~Gamma~Γ~Delta~Δ~Epsilon~Ε~Zeta~Ζ~Eta~Η~Theta~Θ~Iota~Ι~Kappa~Κ~Lambda~Λ~Mu~Μ~Nu~Ν~Xi~Ξ~Omicron~Ο~Pi~Π~Rho~Ρ~Sigma~Σ~Tau~Τ~Upsilon~Υ~Phi~Φ~Chi~Χ~Psi~Ψ~Omega~Ω~alpha~α~beta~β~gamma~γ~delta~δ~epsilon~ε~zeta~ζ~eta~η~theta~θ~iota~ι~kappa~κ~lambda~λ~mu~μ~nu~ν~xi~ξ~omicron~ο~pi~π~rho~ρ~sigmaf~ς~sigma~σ~tau~τ~upsilon~υ~phi~φ~chi~χ~psi~ψ~omega~ω~thetasym~ϑ~upsih~ϒ~piv~ϖ~bull~•~hellip~…~prime~′~Prime~″~oline~‾~frasl~⁄~weierp~℘~image~ℑ~real~ℜ~trade~™~alefsym~ℵ~larr~←~uarr~↑~rarr~→~darr~↓~harr~↔~crarr~↵~lArr~⇐~uArr~⇑~rArr~⇒~dArr~⇓~hArr~⇔~forall~∀~part~∂~exist~∃~empty~∅~nabla~∇~isin~∈~notin~∉~ni~∋~prod~∏~sum~∑~minus~−~lowast~∗~radic~√~prop~∝~infin~∞~ang~∠~and~∧~or~∨~cap~∩~cup~∪~int~∫~there4~∴~sim~∼~cong~≅~asymp~≈~ne~≠~equiv~≡~le~≤~ge~≥~sub~⊂~sup~⊃~nsub~⊄~sube~⊆~supe~⊇~oplus~⊕~otimes~⊗~perp~⊥~sdot~⋅~lceil~⌈~rceil~⌉~lfloor~⌊~rfloor~⌋~lang~〈~rang~〉~loz~◊~spades~♠~clubs~♣~hearts~♥~diams~♦~~nbsp~ ~iexcl~¡~cent~¢~pound~£~curren~¤~yen~¥~brvbar~¦~sect~§~uml~¨~copy~©~ordf~ª~laquo~«~not~¬~shy~~reg~®~macr~¯~deg~°~plusmn~±~sup2~²~sup3~³~acute~´~micro~µ~para~¶~middot~·~cedil~¸~sup1~¹~ordm~º~raquo~»~frac14~¼~frac12~½~frac34~¾~iquest~¿~Agrave~À~Aacute~Á~Acirc~Â~Atilde~Ã~Auml~Ä~Aring~Å~AElig~Æ~Ccedil~Ç~Egrave~È~Eacute~É~Ecirc~Ê~Euml~Ë~Igrave~Ì~Iacute~Í~Icirc~Î~Iuml~Ï~ETH~Ð~Ntilde~Ñ~Ograve~Ò~Oacute~Ó~Ocirc~Ô~Otilde~Õ~Ouml~Ö~times~×~Oslash~Ø~Ugrave~Ù~Uacute~Ú~Ucirc~Û~Uuml~Ü~Yacute~Ý~THORN~Þ~szlig~ß~agrave~à~aacute~á~acirc~â~atilde~ã~auml~ä~aring~å~aelig~æ~ccedil~ç~egrave~è~eacute~é~ecirc~ê~euml~ë~igrave~ì~iacute~í~icirc~î~iuml~ï~eth~ð~ntilde~ñ~ograve~ò~oacute~ó~ocirc~ô~otilde~õ~ouml~ö~divide~÷~oslash~ø~ugrave~ù~uacute~ú~ucirc~û~uuml~ü~yacute~ý~thorn~þ~yuml~ÿ~quot~"~amp~&~lt~<~gt~>`);Kr.html5=Of('Abreve~Ă~Acy~А~Afr~𝔄~Amacr~Ā~And~⩓~Aogon~Ą~Aopf~𝔸~ApplyFunction~~Ascr~𝒜~Assign~≔~Backslash~∖~Barv~⫧~Barwed~⌆~Bcy~Б~Because~∵~Bernoullis~ℬ~Bfr~𝔅~Bopf~𝔹~Breve~˘~Bscr~ℬ~Bumpeq~≎~CHcy~Ч~Cacute~Ć~Cap~⋒~CapitalDifferentialD~ⅅ~Cayleys~ℭ~Ccaron~Č~Ccirc~Ĉ~Cconint~∰~Cdot~Ċ~Cedilla~¸~CenterDot~·~Cfr~ℭ~CircleDot~⊙~CircleMinus~⊖~CirclePlus~⊕~CircleTimes~⊗~ClockwiseContourIntegral~∲~CloseCurlyDoubleQuote~”~CloseCurlyQuote~’~Colon~∷~Colone~⩴~Congruent~≡~Conint~∯~ContourIntegral~∮~Copf~ℂ~Coproduct~∐~CounterClockwiseContourIntegral~∳~Cross~⨯~Cscr~𝒞~Cup~⋓~CupCap~≍~DD~ⅅ~DDotrahd~⤑~DJcy~Ђ~DScy~Ѕ~DZcy~Џ~Darr~↡~Dashv~⫤~Dcaron~Ď~Dcy~Д~Del~∇~Dfr~𝔇~DiacriticalAcute~´~DiacriticalDot~˙~DiacriticalDoubleAcute~˝~DiacriticalGrave~`~DiacriticalTilde~˜~Diamond~⋄~DifferentialD~ⅆ~Dopf~𝔻~Dot~¨~DotDot~⃜~DotEqual~≐~DoubleContourIntegral~∯~DoubleDot~¨~DoubleDownArrow~⇓~DoubleLeftArrow~⇐~DoubleLeftRightArrow~⇔~DoubleLeftTee~⫤~DoubleLongLeftArrow~⟸~DoubleLongLeftRightArrow~⟺~DoubleLongRightArrow~⟹~DoubleRightArrow~⇒~DoubleRightTee~⊨~DoubleUpArrow~⇑~DoubleUpDownArrow~⇕~DoubleVerticalBar~∥~DownArrow~↓~DownArrowBar~⤓~DownArrowUpArrow~⇵~DownBreve~̑~DownLeftRightVector~⥐~DownLeftTeeVector~⥞~DownLeftVector~↽~DownLeftVectorBar~⥖~DownRightTeeVector~⥟~DownRightVector~⇁~DownRightVectorBar~⥗~DownTee~⊤~DownTeeArrow~↧~Downarrow~⇓~Dscr~𝒟~Dstrok~Đ~ENG~Ŋ~Ecaron~Ě~Ecy~Э~Edot~Ė~Efr~𝔈~Element~∈~Emacr~Ē~EmptySmallSquare~◻~EmptyVerySmallSquare~▫~Eogon~Ę~Eopf~𝔼~Equal~⩵~EqualTilde~≂~Equilibrium~⇌~Escr~ℰ~Esim~⩳~Exists~∃~ExponentialE~ⅇ~Fcy~Ф~Ffr~𝔉~FilledSmallSquare~◼~FilledVerySmallSquare~▪~Fopf~𝔽~ForAll~∀~Fouriertrf~ℱ~Fscr~ℱ~GJcy~Ѓ~Gammad~Ϝ~Gbreve~Ğ~Gcedil~Ģ~Gcirc~Ĝ~Gcy~Г~Gdot~Ġ~Gfr~𝔊~Gg~⋙~Gopf~𝔾~GreaterEqual~≥~GreaterEqualLess~⋛~GreaterFullEqual~≧~GreaterGreater~⪢~GreaterLess~≷~GreaterSlantEqual~⩾~GreaterTilde~≳~Gscr~𝒢~Gt~≫~HARDcy~Ъ~Hacek~ˇ~Hat~^~Hcirc~Ĥ~Hfr~ℌ~HilbertSpace~ℋ~Hopf~ℍ~HorizontalLine~─~Hscr~ℋ~Hstrok~Ħ~HumpDownHump~≎~HumpEqual~≏~IEcy~Е~IJlig~IJ~IOcy~Ё~Icy~И~Idot~İ~Ifr~ℑ~Im~ℑ~Imacr~Ī~ImaginaryI~ⅈ~Implies~⇒~Int~∬~Integral~∫~Intersection~⋂~InvisibleComma~~InvisibleTimes~~Iogon~Į~Iopf~𝕀~Iscr~ℐ~Itilde~Ĩ~Iukcy~І~Jcirc~Ĵ~Jcy~Й~Jfr~𝔍~Jopf~𝕁~Jscr~𝒥~Jsercy~Ј~Jukcy~Є~KHcy~Х~KJcy~Ќ~Kcedil~Ķ~Kcy~К~Kfr~𝔎~Kopf~𝕂~Kscr~𝒦~LJcy~Љ~Lacute~Ĺ~Lang~⟪~Laplacetrf~ℒ~Larr~↞~Lcaron~Ľ~Lcedil~Ļ~Lcy~Л~LeftAngleBracket~⟨~LeftArrow~←~LeftArrowBar~⇤~LeftArrowRightArrow~⇆~LeftCeiling~⌈~LeftDoubleBracket~⟦~LeftDownTeeVector~⥡~LeftDownVector~⇃~LeftDownVectorBar~⥙~LeftFloor~⌊~LeftRightArrow~↔~LeftRightVector~⥎~LeftTee~⊣~LeftTeeArrow~↤~LeftTeeVector~⥚~LeftTriangle~⊲~LeftTriangleBar~⧏~LeftTriangleEqual~⊴~LeftUpDownVector~⥑~LeftUpTeeVector~⥠~LeftUpVector~↿~LeftUpVectorBar~⥘~LeftVector~↼~LeftVectorBar~⥒~Leftarrow~⇐~Leftrightarrow~⇔~LessEqualGreater~⋚~LessFullEqual~≦~LessGreater~≶~LessLess~⪡~LessSlantEqual~⩽~LessTilde~≲~Lfr~𝔏~Ll~⋘~Lleftarrow~⇚~Lmidot~Ŀ~LongLeftArrow~⟵~LongLeftRightArrow~⟷~LongRightArrow~⟶~Longleftarrow~⟸~Longleftrightarrow~⟺~Longrightarrow~⟹~Lopf~𝕃~LowerLeftArrow~↙~LowerRightArrow~↘~Lscr~ℒ~Lsh~↰~Lstrok~Ł~Lt~≪~Map~⤅~Mcy~М~MediumSpace~ ~Mellintrf~ℳ~Mfr~𝔐~MinusPlus~∓~Mopf~𝕄~Mscr~ℳ~NJcy~Њ~Nacute~Ń~Ncaron~Ň~Ncedil~Ņ~Ncy~Н~NegativeMediumSpace~~NegativeThickSpace~~NegativeThinSpace~~NegativeVeryThinSpace~~NestedGreaterGreater~≫~NestedLessLess~≪~NewLine~\n~Nfr~𝔑~NoBreak~~NonBreakingSpace~ ~Nopf~ℕ~Not~⫬~NotCongruent~≢~NotCupCap~≭~NotDoubleVerticalBar~∦~NotElement~∉~NotEqual~≠~NotEqualTilde~≂̸~NotExists~∄~NotGreater~≯~NotGreaterEqual~≱~NotGreaterFullEqual~≧̸~NotGreaterGreater~≫̸~NotGreaterLess~≹~NotGreaterSlantEqual~⩾̸~NotGreaterTilde~≵~NotHumpDownHump~≎̸~NotHumpEqual~≏̸~NotLeftTriangle~⋪~NotLeftTriangleBar~⧏̸~NotLeftTriangleEqual~⋬~NotLess~≮~NotLessEqual~≰~NotLessGreater~≸~NotLessLess~≪̸~NotLessSlantEqual~⩽̸~NotLessTilde~≴~NotNestedGreaterGreater~⪢̸~NotNestedLessLess~⪡̸~NotPrecedes~⊀~NotPrecedesEqual~⪯̸~NotPrecedesSlantEqual~⋠~NotReverseElement~∌~NotRightTriangle~⋫~NotRightTriangleBar~⧐̸~NotRightTriangleEqual~⋭~NotSquareSubset~⊏̸~NotSquareSubsetEqual~⋢~NotSquareSuperset~⊐̸~NotSquareSupersetEqual~⋣~NotSubset~⊂⃒~NotSubsetEqual~⊈~NotSucceeds~⊁~NotSucceedsEqual~⪰̸~NotSucceedsSlantEqual~⋡~NotSucceedsTilde~≿̸~NotSuperset~⊃⃒~NotSupersetEqual~⊉~NotTilde~≁~NotTildeEqual~≄~NotTildeFullEqual~≇~NotTildeTilde~≉~NotVerticalBar~∤~Nscr~𝒩~Ocy~О~Odblac~Ő~Ofr~𝔒~Omacr~Ō~Oopf~𝕆~OpenCurlyDoubleQuote~“~OpenCurlyQuote~‘~Or~⩔~Oscr~𝒪~Otimes~⨷~OverBar~‾~OverBrace~⏞~OverBracket~⎴~OverParenthesis~⏜~PartialD~∂~Pcy~П~Pfr~𝔓~PlusMinus~±~Poincareplane~ℌ~Popf~ℙ~Pr~⪻~Precedes~≺~PrecedesEqual~⪯~PrecedesSlantEqual~≼~PrecedesTilde~≾~Product~∏~Proportion~∷~Proportional~∝~Pscr~𝒫~Qfr~𝔔~Qopf~ℚ~Qscr~𝒬~RBarr~⤐~Racute~Ŕ~Rang~⟫~Rarr~↠~Rarrtl~⤖~Rcaron~Ř~Rcedil~Ŗ~Rcy~Р~Re~ℜ~ReverseElement~∋~ReverseEquilibrium~⇋~ReverseUpEquilibrium~⥯~Rfr~ℜ~RightAngleBracket~⟩~RightArrow~→~RightArrowBar~⇥~RightArrowLeftArrow~⇄~RightCeiling~⌉~RightDoubleBracket~⟧~RightDownTeeVector~⥝~RightDownVector~⇂~RightDownVectorBar~⥕~RightFloor~⌋~RightTee~⊢~RightTeeArrow~↦~RightTeeVector~⥛~RightTriangle~⊳~RightTriangleBar~⧐~RightTriangleEqual~⊵~RightUpDownVector~⥏~RightUpTeeVector~⥜~RightUpVector~↾~RightUpVectorBar~⥔~RightVector~⇀~RightVectorBar~⥓~Rightarrow~⇒~Ropf~ℝ~RoundImplies~⥰~Rrightarrow~⇛~Rscr~ℛ~Rsh~↱~RuleDelayed~⧴~SHCHcy~Щ~SHcy~Ш~SOFTcy~Ь~Sacute~Ś~Sc~⪼~Scedil~Ş~Scirc~Ŝ~Scy~С~Sfr~𝔖~ShortDownArrow~↓~ShortLeftArrow~←~ShortRightArrow~→~ShortUpArrow~↑~SmallCircle~∘~Sopf~𝕊~Sqrt~√~Square~□~SquareIntersection~⊓~SquareSubset~⊏~SquareSubsetEqual~⊑~SquareSuperset~⊐~SquareSupersetEqual~⊒~SquareUnion~⊔~Sscr~𝒮~Star~⋆~Sub~⋐~Subset~⋐~SubsetEqual~⊆~Succeeds~≻~SucceedsEqual~⪰~SucceedsSlantEqual~≽~SucceedsTilde~≿~SuchThat~∋~Sum~∑~Sup~⋑~Superset~⊃~SupersetEqual~⊇~Supset~⋑~TRADE~™~TSHcy~Ћ~TScy~Ц~Tab~ ~Tcaron~Ť~Tcedil~Ţ~Tcy~Т~Tfr~𝔗~Therefore~∴~ThickSpace~ ~ThinSpace~ ~Tilde~∼~TildeEqual~≃~TildeFullEqual~≅~TildeTilde~≈~Topf~𝕋~TripleDot~⃛~Tscr~𝒯~Tstrok~Ŧ~Uarr~↟~Uarrocir~⥉~Ubrcy~Ў~Ubreve~Ŭ~Ucy~У~Udblac~Ű~Ufr~𝔘~Umacr~Ū~UnderBar~_~UnderBrace~⏟~UnderBracket~⎵~UnderParenthesis~⏝~Union~⋃~UnionPlus~⊎~Uogon~Ų~Uopf~𝕌~UpArrow~↑~UpArrowBar~⤒~UpArrowDownArrow~⇅~UpDownArrow~↕~UpEquilibrium~⥮~UpTee~⊥~UpTeeArrow~↥~Uparrow~⇑~Updownarrow~⇕~UpperLeftArrow~↖~UpperRightArrow~↗~Upsi~ϒ~Uring~Ů~Uscr~𝒰~Utilde~Ũ~VDash~⊫~Vbar~⫫~Vcy~В~Vdash~⊩~Vdashl~⫦~Vee~⋁~Verbar~‖~Vert~‖~VerticalBar~∣~VerticalLine~|~VerticalSeparator~❘~VerticalTilde~≀~VeryThinSpace~ ~Vfr~𝔙~Vopf~𝕍~Vscr~𝒱~Vvdash~⊪~Wcirc~Ŵ~Wedge~⋀~Wfr~𝔚~Wopf~𝕎~Wscr~𝒲~Xfr~𝔛~Xopf~𝕏~Xscr~𝒳~YAcy~Я~YIcy~Ї~YUcy~Ю~Ycirc~Ŷ~Ycy~Ы~Yfr~𝔜~Yopf~𝕐~Yscr~𝒴~ZHcy~Ж~Zacute~Ź~Zcaron~Ž~Zcy~З~Zdot~Ż~ZeroWidthSpace~~Zfr~ℨ~Zopf~ℤ~Zscr~𝒵~abreve~ă~ac~∾~acE~∾̳~acd~∿~acy~а~af~~afr~𝔞~aleph~ℵ~amacr~ā~amalg~⨿~andand~⩕~andd~⩜~andslope~⩘~andv~⩚~ange~⦤~angle~∠~angmsd~∡~angmsdaa~⦨~angmsdab~⦩~angmsdac~⦪~angmsdad~⦫~angmsdae~⦬~angmsdaf~⦭~angmsdag~⦮~angmsdah~⦯~angrt~∟~angrtvb~⊾~angrtvbd~⦝~angsph~∢~angst~Å~angzarr~⍼~aogon~ą~aopf~𝕒~ap~≈~apE~⩰~apacir~⩯~ape~≊~apid~≋~approx~≈~approxeq~≊~ascr~𝒶~ast~*~asympeq~≍~awconint~∳~awint~⨑~bNot~⫭~backcong~≌~backepsilon~϶~backprime~‵~backsim~∽~backsimeq~⋍~barvee~⊽~barwed~⌅~barwedge~⌅~bbrk~⎵~bbrktbrk~⎶~bcong~≌~bcy~б~becaus~∵~because~∵~bemptyv~⦰~bepsi~϶~bernou~ℬ~beth~ℶ~between~≬~bfr~𝔟~bigcap~⋂~bigcirc~◯~bigcup~⋃~bigodot~⨀~bigoplus~⨁~bigotimes~⨂~bigsqcup~⨆~bigstar~★~bigtriangledown~▽~bigtriangleup~△~biguplus~⨄~bigvee~⋁~bigwedge~⋀~bkarow~⤍~blacklozenge~⧫~blacksquare~▪~blacktriangle~▴~blacktriangledown~▾~blacktriangleleft~◂~blacktriangleright~▸~blank~␣~blk12~▒~blk14~░~blk34~▓~block~█~bne~=⃥~bnequiv~≡⃥~bnot~⌐~bopf~𝕓~bot~⊥~bottom~⊥~bowtie~⋈~boxDL~╗~boxDR~╔~boxDl~╖~boxDr~╓~boxH~═~boxHD~╦~boxHU~╩~boxHd~╤~boxHu~╧~boxUL~╝~boxUR~╚~boxUl~╜~boxUr~╙~boxV~║~boxVH~╬~boxVL~╣~boxVR~╠~boxVh~╫~boxVl~╢~boxVr~╟~boxbox~⧉~boxdL~╕~boxdR~╒~boxdl~┐~boxdr~┌~boxh~─~boxhD~╥~boxhU~╨~boxhd~┬~boxhu~┴~boxminus~⊟~boxplus~⊞~boxtimes~⊠~boxuL~╛~boxuR~╘~boxul~┘~boxur~└~boxv~│~boxvH~╪~boxvL~╡~boxvR~╞~boxvh~┼~boxvl~┤~boxvr~├~bprime~‵~breve~˘~bscr~𝒷~bsemi~⁏~bsim~∽~bsime~⋍~bsol~\\~bsolb~⧅~bsolhsub~⟈~bullet~•~bump~≎~bumpE~⪮~bumpe~≏~bumpeq~≏~cacute~ć~capand~⩄~capbrcup~⩉~capcap~⩋~capcup~⩇~capdot~⩀~caps~∩︀~caret~⁁~caron~ˇ~ccaps~⩍~ccaron~č~ccirc~ĉ~ccups~⩌~ccupssm~⩐~cdot~ċ~cemptyv~⦲~centerdot~·~cfr~𝔠~chcy~ч~check~✓~checkmark~✓~cir~○~cirE~⧃~circeq~≗~circlearrowleft~↺~circlearrowright~↻~circledR~®~circledS~Ⓢ~circledast~⊛~circledcirc~⊚~circleddash~⊝~cire~≗~cirfnint~⨐~cirmid~⫯~cirscir~⧂~clubsuit~♣~colon~:~colone~≔~coloneq~≔~comma~,~commat~@~comp~∁~compfn~∘~complement~∁~complexes~ℂ~congdot~⩭~conint~∮~copf~𝕔~coprod~∐~copysr~℗~cross~✗~cscr~𝒸~csub~⫏~csube~⫑~csup~⫐~csupe~⫒~ctdot~⋯~cudarrl~⤸~cudarrr~⤵~cuepr~⋞~cuesc~⋟~cularr~↶~cularrp~⤽~cupbrcap~⩈~cupcap~⩆~cupcup~⩊~cupdot~⊍~cupor~⩅~cups~∪︀~curarr~↷~curarrm~⤼~curlyeqprec~⋞~curlyeqsucc~⋟~curlyvee~⋎~curlywedge~⋏~curvearrowleft~↶~curvearrowright~↷~cuvee~⋎~cuwed~⋏~cwconint~∲~cwint~∱~cylcty~⌭~dHar~⥥~daleth~ℸ~dash~‐~dashv~⊣~dbkarow~⤏~dblac~˝~dcaron~ď~dcy~д~dd~ⅆ~ddagger~‡~ddarr~⇊~ddotseq~⩷~demptyv~⦱~dfisht~⥿~dfr~𝔡~dharl~⇃~dharr~⇂~diam~⋄~diamond~⋄~diamondsuit~♦~die~¨~digamma~ϝ~disin~⋲~div~÷~divideontimes~⋇~divonx~⋇~djcy~ђ~dlcorn~⌞~dlcrop~⌍~dollar~$~dopf~𝕕~dot~˙~doteq~≐~doteqdot~≑~dotminus~∸~dotplus~∔~dotsquare~⊡~doublebarwedge~⌆~downarrow~↓~downdownarrows~⇊~downharpoonleft~⇃~downharpoonright~⇂~drbkarow~⤐~drcorn~⌟~drcrop~⌌~dscr~𝒹~dscy~ѕ~dsol~⧶~dstrok~đ~dtdot~⋱~dtri~▿~dtrif~▾~duarr~⇵~duhar~⥯~dwangle~⦦~dzcy~џ~dzigrarr~⟿~eDDot~⩷~eDot~≑~easter~⩮~ecaron~ě~ecir~≖~ecolon~≕~ecy~э~edot~ė~ee~ⅇ~efDot~≒~efr~𝔢~eg~⪚~egs~⪖~egsdot~⪘~el~⪙~elinters~⏧~ell~ℓ~els~⪕~elsdot~⪗~emacr~ē~emptyset~∅~emptyv~∅~emsp13~ ~emsp14~ ~eng~ŋ~eogon~ę~eopf~𝕖~epar~⋕~eparsl~⧣~eplus~⩱~epsi~ε~epsiv~ϵ~eqcirc~≖~eqcolon~≕~eqsim~≂~eqslantgtr~⪖~eqslantless~⪕~equals~=~equest~≟~equivDD~⩸~eqvparsl~⧥~erDot~≓~erarr~⥱~escr~ℯ~esdot~≐~esim~≂~excl~!~expectation~ℰ~exponentiale~ⅇ~fallingdotseq~≒~fcy~ф~female~♀~ffilig~ffi~fflig~ff~ffllig~ffl~ffr~𝔣~filig~fi~fjlig~fj~flat~♭~fllig~fl~fltns~▱~fopf~𝕗~fork~⋔~forkv~⫙~fpartint~⨍~frac13~⅓~frac15~⅕~frac16~⅙~frac18~⅛~frac23~⅔~frac25~⅖~frac35~⅗~frac38~⅜~frac45~⅘~frac56~⅚~frac58~⅝~frac78~⅞~frown~⌢~fscr~𝒻~gE~≧~gEl~⪌~gacute~ǵ~gammad~ϝ~gap~⪆~gbreve~ğ~gcirc~ĝ~gcy~г~gdot~ġ~gel~⋛~geq~≥~geqq~≧~geqslant~⩾~ges~⩾~gescc~⪩~gesdot~⪀~gesdoto~⪂~gesdotol~⪄~gesl~⋛︀~gesles~⪔~gfr~𝔤~gg~≫~ggg~⋙~gimel~ℷ~gjcy~ѓ~gl~≷~glE~⪒~gla~⪥~glj~⪤~gnE~≩~gnap~⪊~gnapprox~⪊~gne~⪈~gneq~⪈~gneqq~≩~gnsim~⋧~gopf~𝕘~grave~`~gscr~ℊ~gsim~≳~gsime~⪎~gsiml~⪐~gtcc~⪧~gtcir~⩺~gtdot~⋗~gtlPar~⦕~gtquest~⩼~gtrapprox~⪆~gtrarr~⥸~gtrdot~⋗~gtreqless~⋛~gtreqqless~⪌~gtrless~≷~gtrsim~≳~gvertneqq~≩︀~gvnE~≩︀~hairsp~ ~half~½~hamilt~ℋ~hardcy~ъ~harrcir~⥈~harrw~↭~hbar~ℏ~hcirc~ĥ~heartsuit~♥~hercon~⊹~hfr~𝔥~hksearow~⤥~hkswarow~⤦~hoarr~⇿~homtht~∻~hookleftarrow~↩~hookrightarrow~↪~hopf~𝕙~horbar~―~hscr~𝒽~hslash~ℏ~hstrok~ħ~hybull~⁃~hyphen~‐~ic~~icy~и~iecy~е~iff~⇔~ifr~𝔦~ii~ⅈ~iiiint~⨌~iiint~∭~iinfin~⧜~iiota~℩~ijlig~ij~imacr~ī~imagline~ℐ~imagpart~ℑ~imath~ı~imof~⊷~imped~Ƶ~in~∈~incare~℅~infintie~⧝~inodot~ı~intcal~⊺~integers~ℤ~intercal~⊺~intlarhk~⨗~intprod~⨼~iocy~ё~iogon~į~iopf~𝕚~iprod~⨼~iscr~𝒾~isinE~⋹~isindot~⋵~isins~⋴~isinsv~⋳~isinv~∈~it~~itilde~ĩ~iukcy~і~jcirc~ĵ~jcy~й~jfr~𝔧~jmath~ȷ~jopf~𝕛~jscr~𝒿~jsercy~ј~jukcy~є~kappav~ϰ~kcedil~ķ~kcy~к~kfr~𝔨~kgreen~ĸ~khcy~х~kjcy~ќ~kopf~𝕜~kscr~𝓀~lAarr~⇚~lAtail~⤛~lBarr~⤎~lE~≦~lEg~⪋~lHar~⥢~lacute~ĺ~laemptyv~⦴~lagran~ℒ~langd~⦑~langle~⟨~lap~⪅~larrb~⇤~larrbfs~⤟~larrfs~⤝~larrhk~↩~larrlp~↫~larrpl~⤹~larrsim~⥳~larrtl~↢~lat~⪫~latail~⤙~late~⪭~lates~⪭︀~lbarr~⤌~lbbrk~❲~lbrace~{~lbrack~[~lbrke~⦋~lbrksld~⦏~lbrkslu~⦍~lcaron~ľ~lcedil~ļ~lcub~{~lcy~л~ldca~⤶~ldquor~„~ldrdhar~⥧~ldrushar~⥋~ldsh~↲~leftarrow~←~leftarrowtail~↢~leftharpoondown~↽~leftharpoonup~↼~leftleftarrows~⇇~leftrightarrow~↔~leftrightarrows~⇆~leftrightharpoons~⇋~leftrightsquigarrow~↭~leftthreetimes~⋋~leg~⋚~leq~≤~leqq~≦~leqslant~⩽~les~⩽~lescc~⪨~lesdot~⩿~lesdoto~⪁~lesdotor~⪃~lesg~⋚︀~lesges~⪓~lessapprox~⪅~lessdot~⋖~lesseqgtr~⋚~lesseqqgtr~⪋~lessgtr~≶~lesssim~≲~lfisht~⥼~lfr~𝔩~lg~≶~lgE~⪑~lhard~↽~lharu~↼~lharul~⥪~lhblk~▄~ljcy~љ~ll~≪~llarr~⇇~llcorner~⌞~llhard~⥫~lltri~◺~lmidot~ŀ~lmoust~⎰~lmoustache~⎰~lnE~≨~lnap~⪉~lnapprox~⪉~lne~⪇~lneq~⪇~lneqq~≨~lnsim~⋦~loang~⟬~loarr~⇽~lobrk~⟦~longleftarrow~⟵~longleftrightarrow~⟷~longmapsto~⟼~longrightarrow~⟶~looparrowleft~↫~looparrowright~↬~lopar~⦅~lopf~𝕝~loplus~⨭~lotimes~⨴~lowbar~_~lozenge~◊~lozf~⧫~lpar~(~lparlt~⦓~lrarr~⇆~lrcorner~⌟~lrhar~⇋~lrhard~⥭~lrtri~⊿~lscr~𝓁~lsh~↰~lsim~≲~lsime~⪍~lsimg~⪏~lsqb~[~lsquor~‚~lstrok~ł~ltcc~⪦~ltcir~⩹~ltdot~⋖~lthree~⋋~ltimes~⋉~ltlarr~⥶~ltquest~⩻~ltrPar~⦖~ltri~◃~ltrie~⊴~ltrif~◂~lurdshar~⥊~luruhar~⥦~lvertneqq~≨︀~lvnE~≨︀~mDDot~∺~male~♂~malt~✠~maltese~✠~map~↦~mapsto~↦~mapstodown~↧~mapstoleft~↤~mapstoup~↥~marker~▮~mcomma~⨩~mcy~м~measuredangle~∡~mfr~𝔪~mho~℧~mid~∣~midast~*~midcir~⫰~minusb~⊟~minusd~∸~minusdu~⨪~mlcp~⫛~mldr~…~mnplus~∓~models~⊧~mopf~𝕞~mp~∓~mscr~𝓂~mstpos~∾~multimap~⊸~mumap~⊸~nGg~⋙̸~nGt~≫⃒~nGtv~≫̸~nLeftarrow~⇍~nLeftrightarrow~⇎~nLl~⋘̸~nLt~≪⃒~nLtv~≪̸~nRightarrow~⇏~nVDash~⊯~nVdash~⊮~nacute~ń~nang~∠⃒~nap~≉~napE~⩰̸~napid~≋̸~napos~ʼn~napprox~≉~natur~♮~natural~♮~naturals~ℕ~nbump~≎̸~nbumpe~≏̸~ncap~⩃~ncaron~ň~ncedil~ņ~ncong~≇~ncongdot~⩭̸~ncup~⩂~ncy~н~neArr~⇗~nearhk~⤤~nearr~↗~nearrow~↗~nedot~≐̸~nequiv~≢~nesear~⤨~nesim~≂̸~nexist~∄~nexists~∄~nfr~𝔫~ngE~≧̸~nge~≱~ngeq~≱~ngeqq~≧̸~ngeqslant~⩾̸~nges~⩾̸~ngsim~≵~ngt~≯~ngtr~≯~nhArr~⇎~nharr~↮~nhpar~⫲~nis~⋼~nisd~⋺~niv~∋~njcy~њ~nlArr~⇍~nlE~≦̸~nlarr~↚~nldr~‥~nle~≰~nleftarrow~↚~nleftrightarrow~↮~nleq~≰~nleqq~≦̸~nleqslant~⩽̸~nles~⩽̸~nless~≮~nlsim~≴~nlt~≮~nltri~⋪~nltrie~⋬~nmid~∤~nopf~𝕟~notinE~⋹̸~notindot~⋵̸~notinva~∉~notinvb~⋷~notinvc~⋶~notni~∌~notniva~∌~notnivb~⋾~notnivc~⋽~npar~∦~nparallel~∦~nparsl~⫽⃥~npart~∂̸~npolint~⨔~npr~⊀~nprcue~⋠~npre~⪯̸~nprec~⊀~npreceq~⪯̸~nrArr~⇏~nrarr~↛~nrarrc~⤳̸~nrarrw~↝̸~nrightarrow~↛~nrtri~⋫~nrtrie~⋭~nsc~⊁~nsccue~⋡~nsce~⪰̸~nscr~𝓃~nshortmid~∤~nshortparallel~∦~nsim~≁~nsime~≄~nsimeq~≄~nsmid~∤~nspar~∦~nsqsube~⋢~nsqsupe~⋣~nsubE~⫅̸~nsube~⊈~nsubset~⊂⃒~nsubseteq~⊈~nsubseteqq~⫅̸~nsucc~⊁~nsucceq~⪰̸~nsup~⊅~nsupE~⫆̸~nsupe~⊉~nsupset~⊃⃒~nsupseteq~⊉~nsupseteqq~⫆̸~ntgl~≹~ntlg~≸~ntriangleleft~⋪~ntrianglelefteq~⋬~ntriangleright~⋫~ntrianglerighteq~⋭~num~#~numero~№~numsp~ ~nvDash~⊭~nvHarr~⤄~nvap~≍⃒~nvdash~⊬~nvge~≥⃒~nvgt~>⃒~nvinfin~⧞~nvlArr~⤂~nvle~≤⃒~nvlt~<⃒~nvltrie~⊴⃒~nvrArr~⤃~nvrtrie~⊵⃒~nvsim~∼⃒~nwArr~⇖~nwarhk~⤣~nwarr~↖~nwarrow~↖~nwnear~⤧~oS~Ⓢ~oast~⊛~ocir~⊚~ocy~о~odash~⊝~odblac~ő~odiv~⨸~odot~⊙~odsold~⦼~ofcir~⦿~ofr~𝔬~ogon~˛~ogt~⧁~ohbar~⦵~ohm~Ω~oint~∮~olarr~↺~olcir~⦾~olcross~⦻~olt~⧀~omacr~ō~omid~⦶~ominus~⊖~oopf~𝕠~opar~⦷~operp~⦹~orarr~↻~ord~⩝~order~ℴ~orderof~ℴ~origof~⊶~oror~⩖~orslope~⩗~orv~⩛~oscr~ℴ~osol~⊘~otimesas~⨶~ovbar~⌽~par~∥~parallel~∥~parsim~⫳~parsl~⫽~pcy~п~percnt~%~period~.~pertenk~‱~pfr~𝔭~phiv~ϕ~phmmat~ℳ~phone~☎~pitchfork~⋔~planck~ℏ~planckh~ℎ~plankv~ℏ~plus~+~plusacir~⨣~plusb~⊞~pluscir~⨢~plusdo~∔~plusdu~⨥~pluse~⩲~plussim~⨦~plustwo~⨧~pm~±~pointint~⨕~popf~𝕡~pr~≺~prE~⪳~prap~⪷~prcue~≼~pre~⪯~prec~≺~precapprox~⪷~preccurlyeq~≼~preceq~⪯~precnapprox~⪹~precneqq~⪵~precnsim~⋨~precsim~≾~primes~ℙ~prnE~⪵~prnap~⪹~prnsim~⋨~profalar~⌮~profline~⌒~profsurf~⌓~propto~∝~prsim~≾~prurel~⊰~pscr~𝓅~puncsp~ ~qfr~𝔮~qint~⨌~qopf~𝕢~qprime~⁗~qscr~𝓆~quaternions~ℍ~quatint~⨖~quest~?~questeq~≟~rAarr~⇛~rAtail~⤜~rBarr~⤏~rHar~⥤~race~∽̱~racute~ŕ~raemptyv~⦳~rangd~⦒~range~⦥~rangle~⟩~rarrap~⥵~rarrb~⇥~rarrbfs~⤠~rarrc~⤳~rarrfs~⤞~rarrhk~↪~rarrlp~↬~rarrpl~⥅~rarrsim~⥴~rarrtl~↣~rarrw~↝~ratail~⤚~ratio~∶~rationals~ℚ~rbarr~⤍~rbbrk~❳~rbrace~}~rbrack~]~rbrke~⦌~rbrksld~⦎~rbrkslu~⦐~rcaron~ř~rcedil~ŗ~rcub~}~rcy~р~rdca~⤷~rdldhar~⥩~rdquor~”~rdsh~↳~realine~ℛ~realpart~ℜ~reals~ℝ~rect~▭~rfisht~⥽~rfr~𝔯~rhard~⇁~rharu~⇀~rharul~⥬~rhov~ϱ~rightarrow~→~rightarrowtail~↣~rightharpoondown~⇁~rightharpoonup~⇀~rightleftarrows~⇄~rightleftharpoons~⇌~rightrightarrows~⇉~rightsquigarrow~↝~rightthreetimes~⋌~ring~˚~risingdotseq~≓~rlarr~⇄~rlhar~⇌~rmoust~⎱~rmoustache~⎱~rnmid~⫮~roang~⟭~roarr~⇾~robrk~⟧~ropar~⦆~ropf~𝕣~roplus~⨮~rotimes~⨵~rpar~)~rpargt~⦔~rppolint~⨒~rrarr~⇉~rscr~𝓇~rsh~↱~rsqb~]~rsquor~’~rthree~⋌~rtimes~⋊~rtri~▹~rtrie~⊵~rtrif~▸~rtriltri~⧎~ruluhar~⥨~rx~℞~sacute~ś~sc~≻~scE~⪴~scap~⪸~sccue~≽~sce~⪰~scedil~ş~scirc~ŝ~scnE~⪶~scnap~⪺~scnsim~⋩~scpolint~⨓~scsim~≿~scy~с~sdotb~⊡~sdote~⩦~seArr~⇘~searhk~⤥~searr~↘~searrow~↘~semi~;~seswar~⤩~setminus~∖~setmn~∖~sext~✶~sfr~𝔰~sfrown~⌢~sharp~♯~shchcy~щ~shcy~ш~shortmid~∣~shortparallel~∥~sigmav~ς~simdot~⩪~sime~≃~simeq~≃~simg~⪞~simgE~⪠~siml~⪝~simlE~⪟~simne~≆~simplus~⨤~simrarr~⥲~slarr~←~smallsetminus~∖~smashp~⨳~smeparsl~⧤~smid~∣~smile~⌣~smt~⪪~smte~⪬~smtes~⪬︀~softcy~ь~sol~/~solb~⧄~solbar~⌿~sopf~𝕤~spadesuit~♠~spar~∥~sqcap~⊓~sqcaps~⊓︀~sqcup~⊔~sqcups~⊔︀~sqsub~⊏~sqsube~⊑~sqsubset~⊏~sqsubseteq~⊑~sqsup~⊐~sqsupe~⊒~sqsupset~⊐~sqsupseteq~⊒~squ~□~square~□~squarf~▪~squf~▪~srarr~→~sscr~𝓈~ssetmn~∖~ssmile~⌣~sstarf~⋆~star~☆~starf~★~straightepsilon~ϵ~straightphi~ϕ~strns~¯~subE~⫅~subdot~⪽~subedot~⫃~submult~⫁~subnE~⫋~subne~⊊~subplus~⪿~subrarr~⥹~subset~⊂~subseteq~⊆~subseteqq~⫅~subsetneq~⊊~subsetneqq~⫋~subsim~⫇~subsub~⫕~subsup~⫓~succ~≻~succapprox~⪸~succcurlyeq~≽~succeq~⪰~succnapprox~⪺~succneqq~⪶~succnsim~⋩~succsim~≿~sung~♪~supE~⫆~supdot~⪾~supdsub~⫘~supedot~⫄~suphsol~⟉~suphsub~⫗~suplarr~⥻~supmult~⫂~supnE~⫌~supne~⊋~supplus~⫀~supset~⊃~supseteq~⊇~supseteqq~⫆~supsetneq~⊋~supsetneqq~⫌~supsim~⫈~supsub~⫔~supsup~⫖~swArr~⇙~swarhk~⤦~swarr~↙~swarrow~↙~swnwar~⤪~target~⌖~tbrk~⎴~tcaron~ť~tcedil~ţ~tcy~т~tdot~⃛~telrec~⌕~tfr~𝔱~therefore~∴~thetav~ϑ~thickapprox~≈~thicksim~∼~thkap~≈~thksim~∼~timesb~⊠~timesbar~⨱~timesd~⨰~tint~∭~toea~⤨~top~⊤~topbot~⌶~topcir~⫱~topf~𝕥~topfork~⫚~tosa~⤩~tprime~‴~triangle~▵~triangledown~▿~triangleleft~◃~trianglelefteq~⊴~triangleq~≜~triangleright~▹~trianglerighteq~⊵~tridot~◬~trie~≜~triminus~⨺~triplus~⨹~trisb~⧍~tritime~⨻~trpezium~⏢~tscr~𝓉~tscy~ц~tshcy~ћ~tstrok~ŧ~twixt~≬~twoheadleftarrow~↞~twoheadrightarrow~↠~uHar~⥣~ubrcy~ў~ubreve~ŭ~ucy~у~udarr~⇅~udblac~ű~udhar~⥮~ufisht~⥾~ufr~𝔲~uharl~↿~uharr~↾~uhblk~▀~ulcorn~⌜~ulcorner~⌜~ulcrop~⌏~ultri~◸~umacr~ū~uogon~ų~uopf~𝕦~uparrow~↑~updownarrow~↕~upharpoonleft~↿~upharpoonright~↾~uplus~⊎~upsi~υ~upuparrows~⇈~urcorn~⌝~urcorner~⌝~urcrop~⌎~uring~ů~urtri~◹~uscr~𝓊~utdot~⋰~utilde~ũ~utri~▵~utrif~▴~uuarr~⇈~uwangle~⦧~vArr~⇕~vBar~⫨~vBarv~⫩~vDash~⊨~vangrt~⦜~varepsilon~ϵ~varkappa~ϰ~varnothing~∅~varphi~ϕ~varpi~ϖ~varpropto~∝~varr~↕~varrho~ϱ~varsigma~ς~varsubsetneq~⊊︀~varsubsetneqq~⫋︀~varsupsetneq~⊋︀~varsupsetneqq~⫌︀~vartheta~ϑ~vartriangleleft~⊲~vartriangleright~⊳~vcy~в~vdash~⊢~vee~∨~veebar~⊻~veeeq~≚~vellip~⋮~verbar~|~vert~|~vfr~𝔳~vltri~⊲~vnsub~⊂⃒~vnsup~⊃⃒~vopf~𝕧~vprop~∝~vrtri~⊳~vscr~𝓋~vsubnE~⫋︀~vsubne~⊊︀~vsupnE~⫌︀~vsupne~⊋︀~vzigzag~⦚~wcirc~ŵ~wedbar~⩟~wedge~∧~wedgeq~≙~wfr~𝔴~wopf~𝕨~wp~℘~wr~≀~wreath~≀~wscr~𝓌~xcap~⋂~xcirc~◯~xcup~⋃~xdtri~▽~xfr~𝔵~xhArr~⟺~xharr~⟷~xlArr~⟸~xlarr~⟵~xmap~⟼~xnis~⋻~xodot~⨀~xopf~𝕩~xoplus~⨁~xotime~⨂~xrArr~⟹~xrarr~⟶~xscr~𝓍~xsqcup~⨆~xuplus~⨄~xutri~△~xvee~⋁~xwedge~⋀~yacy~я~ycirc~ŷ~ycy~ы~yfr~𝔶~yicy~ї~yopf~𝕪~yscr~𝓎~yucy~ю~zacute~ź~zcaron~ž~zcy~з~zdot~ż~zeetrf~ℨ~zfr~𝔷~zhcy~ж~zigrarr~⇝~zopf~𝕫~zscr~𝓏~~AMP~&~COPY~©~GT~>~LT~<~QUOT~"~REG~®',Kr.html4);var N2={0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376},A2=String.fromCodePoint||function(n){return String.fromCharCode(Math.floor((n-65536)/1024)+55296,(n-65536)%1024+56320)},Xr=function(){return Xr=Object.assign||function(n){for(var t,i=1,l=arguments.length;i<l;i++){t=arguments[i];for(var c in t)Object.prototype.hasOwnProperty.call(t,c)&&(n[c]=t[c])}return n},Xr.apply(this,arguments)},R2=Xr(Xr({},Kr),{all:Kr.html5}),D2={scope:"body",level:"all"},wh=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g,kh=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g,mx={xml:{strict:wh,attribute:kh,body:Th.xml},html4:{strict:wh,attribute:kh,body:Th.html4},html5:{strict:wh,attribute:kh,body:Th.html5}},O2=Xr(Xr({},mx),{all:mx.html5}),Z_=String.fromCharCode,z2=Z_(65533);function L2(n,t,i,l){var c=n,u=n[n.length-1];if(i&&u==="=")c=n;else if(l&&u!==";")c=n;else{var h=t[n];if(h)c=h;else if(n[0]==="&"&&n[1]==="#"){var m=n[2],p=m=="x"||m=="X"?parseInt(n.substr(3),16):parseInt(n.substr(2));c=p>=1114111?z2:p>65535?A2(p):Z_(N2[p]||p)}}return c}function M2(n,t){var i=D2,l=i.level,c=l===void 0?"all":l,u=i.scope,h=u===void 0?c==="xml"?"strict":"body":u;if(!n)return"";var m=O2[c][h],p=R2[c].entities,y=h==="attribute",v=h==="strict";return n.replace(m,function(b){return L2(b,p,y,v)})}const gx=(n="")=>!n||!n.includes("&")?n:M2(n),yx=(n,t)=>{if(!t)return n;try{return new URL(n,t).href}catch{return n}};var I2=class{constructor(n){this.renderer=n.renderer}parse(n){this.renderer.elIdList.push(0);const t=n.map(i=>{switch(i.type){case"space":return null;case"heading":{const l=i.depth;return this.renderer.heading(this.parseInline(i.tokens),l)}case"paragraph":return this.renderer.paragraph(this.parseInline(i.tokens));case"text":{const l=i;return l.tokens?this.parseInline(l.tokens):i.text}case"blockquote":{const l=i,c=this.parse(l.tokens);return this.renderer.blockquote(c)}case"list":{const l=i;this.renderer.elIdList.push(0);const c=l.items.map(u=>{const h=[];return u.task&&h.push(this.renderer.checkbox(u.checked??!1)),h.push(this.parse(u.tokens)),this.renderer.listItem(h)});return this.renderer.elIdList.pop(),this.renderer.list(c,i.ordered,i.ordered?i.start:void 0)}case"code":return this.renderer.code(i.text,i.lang);case"html":return this.renderer.html(i.text);case"table":{const l=i;this.renderer.elIdList.push(0);const c=l.header.map((y,v)=>this.renderer.tableCell(this.parseInline(y.tokens),{header:!0,align:i.align[v]}));this.renderer.elIdList.pop();const u=this.renderer.tableRow(c),h=this.renderer.tableHeader(u);this.renderer.elIdList.push(0);const m=l.rows.map(y=>{this.renderer.elIdList.push(0);const v=y.map((b,x)=>this.renderer.tableCell(this.parseInline(b.tokens),{header:!1,align:i.align[x]}));return this.renderer.elIdList.pop(),this.renderer.tableRow(v)});this.renderer.elIdList.pop();const p=this.renderer.tableBody(m);return this.renderer.table([h,p])}case"hr":return this.renderer.hr();default:return console.warn(`Token with "${i.type}" type was not found`),null}});return this.renderer.elIdList.pop(),t}parseInline(n=[]){this.renderer.elIdList.push(0);const t=n.map(i=>{switch(i.type){case"text":return this.renderer.text(gx(i.text));case"strong":return this.renderer.strong(this.parseInline(i.tokens));case"em":return this.renderer.em(this.parseInline(i.tokens));case"del":return this.renderer.del(this.parseInline(i.tokens));case"codespan":return this.renderer.codespan(gx(i.text));case"link":return this.renderer.link(i.href,this.parseInline(i.tokens));case"image":return this.renderer.image(i.href,i.text,i.title);case"html":return this.renderer.html(i.text);case"br":return this.renderer.br();case"escape":return this.renderer.text(i.text);default:return console.warn(`Token with "${i.type}" type was not found`),null}});return this.renderer.elIdList.pop(),t}},q2=class{#t;constructor(n={}){this.elIdList=[];const{renderer:t}=n;this.#t=n,t&&typeof t=="object"&&Object.entries(t).forEach(([i,l])=>{const c=i,u=l;!this[c]||c==="elementId"||c==="elIdList"||typeof u!="function"||Object.defineProperty(this,c,{value(...h){return this.#n(),u.apply(this,h)},writable:!0,enumerable:!0,configurable:!0})})}#e(n,t=null,i={}){const l={key:`marked-react-${this.elementId}`,suppressHydrationWarning:!0};return this.#n(),d.createElement(n,{...i,...l},t)}#n(){this.elIdList[this.elIdList.length-1]+=1}get elementId(){return this.elIdList.join("-")}heading(n,t){return this.#e(`h${t}`,n)}paragraph(n){return this.#e("p",n)}link(n,t){const i=yx(n,this.#t.baseURL),l=this.#t.openLinksInNewTab?"_blank":null;return this.#e("a",t,{href:i,target:l})}image(n,t,i=null){const l=yx(n,this.#t.baseURL);return this.#e("img",null,{src:l,alt:t,title:i})}codespan(n,t=null){const i=t?`${this.#t.langPrefix}${t}`:null;return this.#e("code",n,{className:i})}code(n,t){return this.#e("pre",this.codespan(n,t))}blockquote(n){return this.#e("blockquote",n)}list(n,t,i){return this.#e(t?"ol":"ul",n,t&&i!==1?{start:i}:{})}listItem(n){return this.#e("li",n)}checkbox(n){return this.#e("input",null,{type:"checkbox",disabled:!0,checked:n})}table(n){return this.#e("table",n)}tableHeader(n){return this.#e("thead",n)}tableBody(n){return this.#e("tbody",n)}tableRow(n){return this.#e("tr",n)}tableCell(n,t){const i=t.header?"th":"td";return this.#e(i,n,{align:t.align})}strong(n){return this.#e("strong",n)}em(n){return this.#e("em",n)}del(n){return this.#e("del",n)}text(n){return n}html(n){return n}hr(){return this.#e("hr")}br(){return this.#e("br")}};const U2=n=>{if(n.value&&typeof n.value!="string")throw new TypeError(`[marked-react]: Expected value to be of type string but got ${typeof n.value}`);if(n.children&&typeof n.children!="string")throw new TypeError(`[marked-react]: Expected children to be of type string but got ${typeof n.children}`)},B2={isInline:!1,breaks:!1,gfm:!0,baseURL:void 0,openLinksInNewTab:!0,langPrefix:"language-",renderer:void 0},$2=new Q_,P2=n=>{U2(n);const t={...B2,...n},i=t.instance??$2,l={breaks:t.breaks,gfm:t.gfm,tokenizer:i.defaults.tokenizer},c=t.value??t.children??"",u=t.isInline?i.Lexer.lexInline(c,l):i.lexer(c,l),h=new I2({renderer:new q2({renderer:t.renderer,baseURL:t.baseURL,openLinksInNewTab:t.openLinksInNewTab,langPrefix:t.langPrefix})});return d.createElement(d.Fragment,null,t.isInline?h.parseInline(u):h.parse(u))};var Fh=P2;function H2(n){return typeof n=="string"?n:n&&typeof n=="object"&&typeof n.id=="string"?n.id:null}function G2(){const{id:n}=Jt(),t=De(),{setSectionTitle:i,blocks:l}=zc(),{showError:c}=dn(),u=Dt(),{block:h,isLoading:m,error:p,isDeleted:y}=zR(n||""),[v,b]=d.useState(null),[x,_]=d.useState(!1);vt(h?{contextBlock:{title:h.title}}:void 0),d.useEffect(()=>{h&&i(u?"Context":h.title)},[h,u,i]),d.useEffect(()=>{if(!h?.id){b(null);return}let w=!1;return _(!0),Bn.ThreadsController_getThreadsByStateBlockId({stateBlockId:h.id}).then(E=>{w||b(E.length>0?E[0].id:null)}).catch(E=>{w||(console.error("Error checking for thread:",E),b(null))}).finally(()=>{w||_(!1)}),()=>{w=!0}},[h?.id]),d.useEffect(()=>{y&&t("/context/home")},[y,t]);const k=()=>{if(!h)return;const E=`${h.title.replace(/[^a-z0-9]/gi,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase()||"context-block"}.md`,R=new Blob([h.content],{type:"text/markdown"}),D=URL.createObjectURL(R),O=document.createElement("a");O.href=D,O.download=E,document.body.appendChild(O),O.click(),document.body.removeChild(O),URL.revokeObjectURL(D)},T=d.useMemo(()=>{if(!h)return[];const w=new Map(l.map(D=>[D.id,D])),E=[];let R=h.id;for(;R;){const D=R===h.id?h:w.get(R);if(!D)break;E.unshift({id:D.id,title:D.title}),R=H2(D.parentId)}return E},[h,l]);return m?a.jsx("div",{className:"context-block-detail__loading",children:a.jsx(S,{children:"Loading..."})}):p?a.jsx("div",{className:"context-block-detail__error",children:a.jsxs(S,{className:"text--error",children:["Error: ",p]})}):h?a.jsxs("div",{className:"context-block-detail",children:[a.jsxs(ee,{spacing:"3",className:"context-block-detail__header",children:[u?a.jsxs("div",{className:"context-block-detail__breadcrumbs","aria-label":"Breadcrumb",children:[a.jsx("button",{type:"button",className:"context-block-detail__breadcrumb",onClick:()=>t("/context/home"),children:"Home"}),T.map((w,E)=>a.jsxs("div",{className:"context-block-detail__breadcrumb-segment",children:[a.jsx("span",{className:"context-block-detail__breadcrumb-separator",children:"›"}),a.jsx("button",{type:"button",className:`context-block-detail__breadcrumb ${E===T.length-1?"context-block-detail__breadcrumb--current":""}`,onClick:()=>t(`/context/block/${w.id}`),disabled:E===T.length-1,children:w.title})]},w.id))]}):null,u?a.jsx("div",{className:"context-block-detail__title-wrap",children:a.jsx("h1",{className:"context-block-detail__title",children:h.title})}):null,h.tags.length>0&&a.jsx("div",{className:"context-block-detail__tags",children:h.tags.map(w=>a.jsx(Sn,{children:w.name},w.id))}),a.jsxs("div",{className:"context-block-detail__meta",children:[a.jsxs(S,{size:"2",tone:"muted",children:["by @",h.createdBy||"unknown"]}),a.jsx(S,{size:"2",tone:"muted",children:"•"}),a.jsx(S,{size:"2",tone:"muted",children:new Date(h.createdAt).toDateString()}),a.jsx(S,{size:"2",tone:"muted",children:"•"}),a.jsxs(S,{size:"2",tone:"muted",children:["Last edited ",Lt(h.updatedAt)]})]})]}),a.jsx("div",{className:"context-block-detail__content",children:a.jsx(Fh,{children:h.content})}),a.jsx(ei,{className:"context-block-detail__actions",onDelete:async()=>{try{await Ha.ContextController_deleteBlock({id:h.id}),t("/context")}catch(w){c(w)}},deleteLabel:"Delete",confirmLabel:"Confirm Delete"}),a.jsxs(xe,{className:"context-block-detail__actions",children:[a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t(`/context/block/${h.id}/edit`),children:"Edit"}),a.jsx(ce,{size:"lg",variant:"secondary",onClick:k,children:"Download as Markdown"}),v&&a.jsx(ce,{size:"lg",variant:"primary",onClick:()=>t(`/threads/${v}`),disabled:x,children:"Go to thread"}),u?null:a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t("/context"),children:"Back to blocks"})]})]}):a.jsx("div",{className:"context-block-detail__error",children:a.jsx(S,{className:"text--error",children:"Context block not found"})})}function vx(){const{id:n}=Jt(),t=!!n,{setSectionTitle:i}=zc(),l=De(),[c]=lf(),u=c.get("parentId")??void 0,{showError:h,showToast:m}=dn(),p=Dt(),y=d.useRef(null),[v,b]=d.useState(""),[x,_]=d.useState(""),[k]=d.useState([]),[T,w]=d.useState(!1),[E,R]=d.useState(t),[D,O]=d.useState(null);d.useEffect(()=>{n&&(R(!0),Ha.ContextController_getBlock({id:n}).then(L=>{b(L.title),_(L.content)}).catch(L=>{h(L),l("/context/home")}).finally(()=>R(!1)))},[n]),d.useEffect(()=>{i(p?"Context":t?"Edit Block":"New Block")},[i,p,t]);const z=async L=>{const P=L.target.files?.[0];if(P){if(!P.name.endsWith(".md")){h(new Error("Please select a markdown (.md) file"));return}O(P.name);try{const Y=await P.text();_(Y);const U=Y.match(/^#\s+(.+)$/m);b(U?U[1].trim():P.name.replace(/\.md$/,""))}catch(Y){h(Y),O(null)}}},A=async()=>{if(!v.trim()){h(new Error("Title is required"));return}if(!x.trim()){h(new Error("Content is required"));return}w(!0);try{if(t&&n)await Ha.ContextController_updateBlock({id:n,body:{title:v.trim(),content:x.trim()}}),m("Context block updated","success"),l(`/context/block/${n}`);else{const L=await Ha.ContextController_createBlock({body:{title:v.trim(),content:x.trim(),tagNames:k.length>0?k:void 0,parentId:u}});m("Context block created","success"),l(`/context/block/${L.id}`)}}catch(L){h(L)}finally{w(!1)}},C=t&&n?`/context/block/${n}`:"/context/home";return E?a.jsx("div",{className:"context-block-create",children:a.jsx(S,{tone:"muted",children:"Loading…"})}):a.jsxs("div",{className:"context-block-create",children:[p&&a.jsxs("div",{className:"context-block-create__breadcrumbs",children:[a.jsx("button",{type:"button",className:"context-block-create__breadcrumb",onClick:()=>l("/context/home"),children:"Home"}),a.jsx("span",{className:"context-block-create__breadcrumb-separator",children:"›"}),a.jsx("span",{className:"context-block-create__breadcrumb context-block-create__breadcrumb--current",children:t?"Edit Block":"New Block"})]}),a.jsxs("div",{className:"context-block-create__title-row",children:[a.jsx("input",{type:"text",value:v,onChange:L=>b(L.target.value),placeholder:"Untitled",className:"context-block-create__title-input",maxLength:255,"aria-label":"Block title",autoFocus:!0}),a.jsx(ce,{type:"button",size:"lg",variant:"secondary",onClick:()=>y.current?.click(),title:D?`File: ${D}`:"Upload markdown file",tabIndex:-1,children:D?`↑ ${D}`:"↑ Upload .md"}),a.jsx("input",{ref:y,type:"file",accept:".md",onChange:z,className:"context-block-create__file-input-hidden","aria-hidden":"true"})]}),a.jsx("textarea",{value:x,onChange:L=>_(L.target.value),placeholder:"Write markdown content here, or upload a .md file above…",className:"context-block-create__editor","aria-label":"Block content (Markdown)"}),a.jsx("div",{className:"context-block-create__bottom-bar",children:a.jsxs("div",{className:"context-block-create__actions",children:[a.jsx(ce,{type:"button",size:"lg",variant:"secondary",onClick:()=>l(C),disabled:T,children:"Cancel"}),a.jsx(ce,{type:"button",size:"lg",variant:"primary",onClick:A,disabled:T||!v.trim()||!x.trim(),children:T?t?"Saving…":"Creating…":t?"Save":"Create"})]})})]})}function V2(){return a.jsx(LR,{children:a.jsx(ps,{children:a.jsxs(je,{element:a.jsx(qR,{}),children:[a.jsx(je,{index:!0,element:a.jsx(Is,{to:"home",replace:!0})}),a.jsx(je,{path:"home",element:a.jsx(UR,{})}),a.jsx(je,{path:"new",element:a.jsx(vx,{})}),a.jsx(je,{path:"block/:id",element:a.jsx(G2,{})}),a.jsx(je,{path:"block/:id/edit",element:a.jsx(vx,{})})]})})})}const F2=window.location.origin,Un=new ns({baseUrl:F2,credentials:"include"}),$a=Un.agent,sc=Un.agentTokens,ml=Un.agent,Y2=Un.authorizationServer,Yh=Un.meta,gl=Un.tools;Un.agent,Un.agentTokens,Un.agent,Un.authorizationServer,Un.meta,Un.tools;const K2=()=>{const[n,t]=d.useState(!1),[i,l]=d.useState(null),[c,u]=d.useState([]);d.useEffect(()=>{m()},[]);const h=x=>[...x].sort((_,k)=>{const T=new Date(_.updatedAt).getTime();return new Date(k.updatedAt).getTime()-T}),m=async()=>{t(!0),l(null);try{const x=await $a.AgentsController_listAgents({});u(h(x.items||[]))}catch(x){l(x instanceof Error?x.message:"Failed to load agents")}finally{t(!1)}};return{isLoading:n,error:i,agents:c,loadAgents:m,loadAgentDetails:async x=>{t(!0),l(null);try{return await $a.AgentsController_getAgentBySlug({slug:x})}catch(_){return l(_ instanceof Error?_.message:"Failed to load agent details"),null}finally{t(!1)}},createAgent:async x=>{t(!0),l(null);try{const _=await $a.AgentsController_createAgent({body:{name:x.name,slug:x.slug,systemPrompt:x.systemPrompt,allowedTools:x.allowedTools??[],type:x.type,description:x.description,introduction:x.introduction,avatarUrl:x.avatarUrl,providerId:x.providerId,modelId:x.modelId,statusTriggers:x.statusTriggers,tagTriggers:x.tagTriggers,isActive:x.isActive,concurrencyLimit:x.concurrencyLimit}});return u(k=>h([...k,_])),_}catch(_){return l(_ instanceof Error?_.message:"Failed to create agent"),null}finally{t(!1)}},updateAgent:async(x,_)=>{t(!0),l(null);try{const k=await $a.AgentsController_patchAgent({actorId:x,body:_});return u(T=>{const w=T.map(E=>E.actorId===x?k:E);return h(w)}),k}catch(k){return l(k instanceof Error?k.message:"Failed to update agent"),null}finally{t(!1)}},deleteAgent:async x=>{t(!0),l(null);try{return await $a.AgentsController_deleteAgent({actorId:x}),u(_=>_.filter(k=>k.actorId!==x)),!0}catch(_){return l(_ instanceof Error?_.message:"Failed to delete agent"),!1}finally{t(!1)}}}},W_=d.createContext(null);function X2({children:n}){const{agents:t,isLoading:i,error:l,loadAgentDetails:c,createAgent:u,updateAgent:h,deleteAgent:m}=K2(),[p,y]=d.useState(""),v=d.useMemo(()=>({agents:t,isLoading:i,error:l,sectionTitle:p,setSectionTitle:y,loadAgentDetails:c,createAgent:u,updateAgent:h,deleteAgent:m}),[t,i,l,p,y,c,u,h,m]);return a.jsx(W_.Provider,{value:v,children:n})}function El(){const n=d.useContext(W_);if(!n)throw new Error("useAgentsCtx must be used within <AgentsProvider>");return n}function Q2(){const{agents:n,setSectionTitle:t,isLoading:i,error:l}=El(),c=De(),u=Dt();return vt(),d.useEffect(()=>{t("All Agents")},[t]),i&&n.length===0?a.jsx(xe,{children:a.jsx(_e,{leading:a.jsx(He,{name:"...",size:"lg"}),children:a.jsx(S,{tone:"muted",children:"Loading agents..."})})}):l?a.jsx(xe,{children:a.jsx(_e,{leading:a.jsx(He,{name:"!",size:"lg"}),children:a.jsxs(S,{tone:"muted",children:["Error: ",l]})})}):n.length===0?a.jsxs(a.Fragment,{children:[a.jsx(xe,{children:a.jsx(_e,{leading:a.jsx(He,{name:"?",size:"lg"}),children:a.jsx(S,{tone:"muted",children:"No agents found"})})}),a.jsx(xx,{isDesktop:u,onClick:()=>c("/agents/new")})]}):a.jsxs(a.Fragment,{children:[a.jsx(xe,{children:n.map(h=>a.jsx(Z2,{agent:h,onClick:()=>c(`/agents/agent/${h.slug}`)},h.actorId))}),a.jsx(xx,{isDesktop:u,onClick:()=>c("/agents/new")})]})}function xx({isDesktop:n,onClick:t}){return a.jsx("button",{className:`agents-fab ${n?"agents-fab--desktop":""}`,type:"button",onClick:t,"aria-label":"Create new agent",children:n?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"agents-fab__plus",children:"+"}),a.jsx("span",{className:"agents-fab__label",children:"New agent"})]}):"+"})}function Z2({agent:n,onClick:t}){const i=[W2(n.type),J2(n.isActive)];return a.jsxs(_e,{leading:a.jsx(He,{name:n.name,size:"lg"}),topRight:Lt(n.updatedAt),tags:i,onClick:t,children:[a.jsxs(S,{className:"pre",style:"mono",tone:"muted",children:["@",n.slug]}),a.jsx(S,{weight:"bold",size:"3",tone:"default",children:n.name}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.jsx(S,{tone:"muted",size:"2",children:n.description?String(n.description):"No description"})}),a.jsxs("div",{style:{fontSize:12},className:"text--tone-muted",children:[n.statusTriggers.length>0&&a.jsxs("span",{children:["Triggers: ",n.statusTriggers.join(", ")]}),n.statusTriggers.length>0&&n.allowedTools.length>0&&" · ",n.allowedTools.length>0&&a.jsxs("span",{children:["Tools: ",n.allowedTools.length]})]})]})}function W2(n){return{label:n,color:{claude:"purple",codex:"green",opencode:"blue",adk:"red",githubcopilot:"yellow",other:"gray"}[n]||"gray"}}function J2(n){return{label:n?"active":"inactive",color:n?"green":"gray"}}function eD(){const n=Dt(),{sectionTitle:t}=El(),i=[];return a.jsx("div",{style:{minHeight:0},children:n?a.jsx(Jr,{sectionTitle:t,children:a.jsx(Qt,{})}):a.jsx(Qa,{appTitle:"Agents",sectionTitle:t,navItems:i,children:a.jsx(Qt,{})})})}const bx=n=>{n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)};function tD({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState(n),u=d.useRef(null);d.useEffect(()=>{u.current?.focus()},[]),d.useEffect(()=>{bx(u.current)},[l]);function h(p){c(p.target.value),bx(p.target)}async function m(){return i({systemPrompt:l})}return a.jsx(xt,{title:"Edit System Prompt",onCancel:t,onSave:m,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-system-prompt-pop__input-wrapper",children:a.jsx("textarea",{className:"edit-system-prompt-pop__input-content",ref:u,placeholder:"Enter system prompt...",value:l,onChange:h})})})})}function nD({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState(new Set(n)),u=p=>{c(y=>{const v=new Set(y);return v.has(p)?v.delete(p):v.add(p),v})};async function h(){return i({statusTriggers:Array.from(l)})}const m=[Se.NOT_STARTED,Se.IN_PROGRESS,Se.FOR_REVIEW,Se.DONE];return a.jsx(xt,{title:"Edit Status Triggers",onCancel:t,onSave:h,children:a.jsxs("div",{className:"edit-status-triggers-pop__content",children:[a.jsx(S,{size:"2",tone:"muted",className:"edit-status-triggers-pop__description",children:"Select which task statuses will trigger this agent to activate"}),a.jsx("div",{className:"edit-status-triggers-pop__checklist",children:m.map(p=>{const y=Jn[p];return a.jsxs("label",{className:"edit-status-triggers-pop__checklist-item",children:[a.jsx("input",{type:"checkbox",checked:l.has(p),onChange:()=>u(p),className:"edit-status-triggers-pop__checkbox"}),a.jsxs("div",{className:"edit-status-triggers-pop__status-info",children:[a.jsx(S,{size:"3",weight:"medium",children:y.label}),a.jsx(S,{size:"2",tone:"muted",children:p})]})]},p)})})]})})}function sD({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState([]),[u,h]=d.useState(!0),[m,p]=d.useState(new Set(n)),[y,v]=d.useState(""),[b,x]=d.useState(0),_=d.useRef(null),k=d.useRef(null);d.useEffect(()=>{(async()=>{try{const C=await Yh.MetaController_getAllTags({});c(C)}catch(C){console.error("Failed to load tags:",C)}finally{h(!1)}})()},[]),d.useEffect(()=>{_.current?.focus()},[]);const T=d.useMemo(()=>{if(!y.trim())return l;const A=y.toLowerCase().trim();return l.map(L=>{let P=0;return L.name.toLowerCase().startsWith(A)?P+=100:L.name.toLowerCase().includes(A)&&(P+=50),{tag:L,score:P}}).filter(L=>L.score>0).sort((L,P)=>P.score-L.score).map(L=>L.tag)},[l,y]),w=d.useMemo(()=>{if(!y.trim())return!1;const A=y.toLowerCase().trim();return!l.some(C=>C.name.toLowerCase()===A)},[y,l]);d.useEffect(()=>{x(0)},[T.length,y,w]),d.useEffect(()=>{if(k.current){const A=T.length+(w?1:0);if(b<A){const C=k.current.children[b];C&&C.scrollIntoView({block:"nearest"})}}},[b,T.length,w]);const E=A=>{p(C=>{const L=new Set(C);return L.has(A)?L.delete(A):L.add(A),L})},R=async()=>{try{const A=await Yh.MetaController_createTag({body:{name:y.trim()}});c(C=>[...C,A]),p(C=>new Set([...C,A.name])),v(""),_.current?.focus()}catch(A){console.error("Failed to create tag:",A)}},D=d.useCallback(A=>{const C=T.length+(w?1:0);if(C!==0)switch(A.key){case"ArrowDown":A.preventDefault(),x(L=>L<C-1?L+1:L);break;case"ArrowUp":A.preventDefault(),x(L=>L>0?L-1:0);break;case"Enter":A.preventDefault(),b<T.length?E(T[b].name):w&&b===T.length&&R();break;case"Escape":A.preventDefault(),y&&v("");break}},[T,b,w,y]);async function O(){return i({tagTriggers:Array.from(m)})}const z=d.useMemo(()=>Array.from(m).sort((A,C)=>A.localeCompare(C)),[m]);return a.jsx(xt,{title:"Edit Tag Triggers",onCancel:t,onSave:O,children:a.jsxs("div",{className:"edit-tag-triggers-pop__content",children:[a.jsxs(S,{size:"2",tone:"muted",className:"edit-tag-triggers-pop__description",children:["Select which tag names will trigger this agent to activate when added to a task (",m.size," selected)"]}),z.length>0&&a.jsxs(S,{size:"2",tone:"muted",className:"edit-tag-triggers-pop__description",children:["Selected: ",z.join(", ")]}),a.jsx("input",{ref:_,type:"text",className:"edit-tag-triggers-pop__input",placeholder:"Search or create tag...",value:y,onChange:A=>v(A.target.value),onKeyDown:D}),a.jsx("div",{className:"edit-tag-triggers-pop__list",ref:k,children:u?a.jsx("div",{className:"edit-tag-triggers-pop__empty",children:a.jsx(S,{tone:"muted",children:"Loading tags..."})}):T.length===0&&!w?a.jsx("div",{className:"edit-tag-triggers-pop__empty",children:a.jsx(S,{tone:"muted",children:"No tags found"})}):a.jsxs(a.Fragment,{children:[T.map((A,C)=>a.jsxs("label",{className:`edit-tag-triggers-pop__item ${C===b?"edit-tag-triggers-pop__item--highlighted":""}`,onMouseEnter:()=>x(C),children:[a.jsx("input",{type:"checkbox",checked:m.has(A.name),onChange:()=>E(A.name),className:"edit-tag-triggers-pop__checkbox"}),a.jsx("div",{className:"edit-tag-triggers-pop__tag-badge",style:{backgroundColor:A.color||"#999"},children:A.name})]},A.id)),w&&a.jsxs("div",{className:`edit-tag-triggers-pop__item edit-tag-triggers-pop__item--create ${b===T.length?"edit-tag-triggers-pop__item--highlighted":""}`,onClick:R,onMouseEnter:()=>x(T.length),children:[a.jsx(S,{size:"2",tone:"muted",children:"Create new tag:"}),a.jsx("div",{className:"edit-tag-triggers-pop__tag-badge",style:{backgroundColor:"#999"},children:y.trim()})]})]})})]})})}const _x=n=>{n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)};function aD({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState(n),u=d.useRef(null);d.useEffect(()=>{u.current?.focus()},[]),d.useEffect(()=>{_x(u.current)},[l]);function h(p){c(p.target.value),_x(p.target)}async function m(){return i({introduction:l})}return a.jsx(xt,{title:"Edit Introduction",onCancel:t,onSave:m,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-introduction-pop__input-wrapper",children:a.jsx("textarea",{className:"edit-introduction-pop__input-content",ref:u,placeholder:"Enter introduction...",value:l,onChange:h})})})})}const rD=[{value:"claude",label:"Claude",description:"Anthropic's Claude AI"},{value:"codex",label:"Codex",description:"OpenAI's Codex"},{value:"opencode",label:"OpenCode",description:"OpenCode agent"},{value:"adk",label:"ADK",description:"Agent Development Kit"},{value:"githubcopilot",label:"GitHub Copilot",description:"GitHub Copilot agent"},{value:"other",label:"Other",description:"Other agent type"}];function iD({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState(n);async function u(){return i({type:l})}return a.jsx(xt,{title:"Edit Agent Type",onCancel:t,onSave:u,children:a.jsxs("div",{className:"edit-agent-type-pop__content",children:[a.jsx(S,{size:"2",tone:"muted",className:"edit-agent-type-pop__description",children:"Select the type of agent (provider). An agent can only be of one type."}),a.jsx("div",{className:"edit-agent-type-pop__radio-list",children:rD.map(h=>a.jsxs("label",{className:"edit-agent-type-pop__radio-item",children:[a.jsx("input",{type:"radio",name:"agent-type",value:h.value,checked:l===h.value,onChange:()=>c(h.value),className:"edit-agent-type-pop__radio"}),a.jsxs("div",{className:"edit-agent-type-pop__type-info",children:[a.jsx(S,{size:"3",weight:"medium",children:h.label}),a.jsx(S,{size:"2",tone:"muted",children:h.description})]})]},h.value))})]})})}function lD({initialProviderId:n,initialModelId:t,onCancel:i,onSave:l}){const[c,u]=d.useState(n),[h,m]=d.useState(t),p=d.useRef(null),y=d.useRef(null);d.useEffect(()=>{p.current?.focus()},[]);async function v(){return l({providerId:c.trim(),modelId:h.trim()})}return a.jsx(xt,{title:"Edit Model",onCancel:i,onSave:v,children:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"edit-agent-model-pop__field",children:a.jsx("input",{className:"edit-agent-model-pop__input",ref:p,placeholder:"Provider ID (optional)",value:c,onChange:b=>u(b.target.value),onKeyDown:b=>{b.key==="Enter"&&(b.preventDefault(),y.current?.focus())}})}),a.jsx("div",{className:"edit-agent-model-pop__field",children:a.jsx("input",{className:"edit-agent-model-pop__input",ref:y,placeholder:"Model ID (optional)",value:h,onChange:b=>m(b.target.value)})})]})})}function oD({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState(n!==null?String(n):""),[u,h]=d.useState(null),m=d.useRef(null);d.useEffect(()=>{m.current?.focus()},[]);const p=async()=>{const y=l.trim();if(y.length===0)return i({concurrencyLimit:null});const v=Number(y);return!Number.isInteger(v)||v<1?(h("Use a whole number of 1 or higher, or leave empty for unlimited."),!1):(h(null),i({concurrencyLimit:v}))};return a.jsx(xt,{title:"Edit Concurrency",onCancel:t,onSave:p,children:a.jsxs("div",{className:"edit-concurrency-limit-pop__content",children:[a.jsx(S,{size:"2",tone:"muted",children:"Leave empty for unlimited parallel tasks."}),a.jsx("input",{ref:m,className:"edit-concurrency-limit-pop__input",type:"number",min:1,step:1,placeholder:"Unlimited",value:l,onChange:y=>{c(y.target.value),u&&h(null)}}),u&&a.jsx(S,{size:"1",className:"edit-concurrency-limit-pop__error",children:u})]})})}function J_({avatars:n,selectedUrl:t,onSelect:i}){return a.jsx("div",{className:"agent-avatar-picker",children:n.map(l=>{const c=t===l.url;return a.jsxs("button",{type:"button",className:`agent-avatar-picker__option ${c?"agent-avatar-picker__option--selected":""}`,onClick:()=>i(l.url),"aria-pressed":c,children:[a.jsx(He,{name:l.label,src:l.url,size:64,className:"agent-avatar-picker__image"}),a.jsx(S,{size:"2",weight:"medium",children:l.label})]},l.id)})})}function cD({avatars:n,initialValue:t,onCancel:i,onSave:l}){const[c,u]=d.useState(t??n[0]?.url??"");async function h(){return c?l({avatarUrl:c}):!1}return a.jsx(xt,{title:"Choose Avatar",onCancel:i,onSave:h,children:a.jsx(J_,{avatars:n,selectedUrl:c,onSelect:u})})}const Eh=["meta:read","meta:write","tasks:read","tasks:write","context:read","context:write","agents:read","run:read","run:write","threads:read","threads:write","mcp-registry:read","mcp:use","secret:read"];function uD(){const{slug:n}=Jt(),t=De(),{agents:i,setSectionTitle:l,loadAgentDetails:c,updateAgent:u,deleteAgent:h}=El(),{showError:m}=dn(),p=i.find(he=>he.slug===n),[y,v]=d.useState(p||null),[b,x]=d.useState(!p),[_,k]=d.useState([]),[T,w]=d.useState(!1),[E,R]=d.useState(null),[D,O]=d.useState(!1),[z,A]=d.useState(!1),[C,L]=d.useState(""),[P,Y]=d.useState(new Set(Eh)),[U,re]=d.useState(30),[Q,J]=d.useState([]),[ye,B]=d.useState(!1),[se,ge]=d.useState([]),[Ee,Ce]=d.useState(!1),[M,H]=d.useState([]),[de,fe]=d.useState(!1),[V,ie]=d.useState(!1),[te,be]=d.useState(!1),[Re,Ze]=d.useState(!1),[It,et]=d.useState(!1),[wt,ue]=d.useState(!1),[X,pe]=d.useState(!1),[Z,Te]=d.useState(!1),[tt,ht]=d.useState(!1),[qt,wn]=d.useState([]),kt=d.useCallback(async()=>{if(n){w(!0);try{const he=await sc.AgentTokensController_listTokens({slug:n});k(he)}catch(he){console.error("Failed to load tokens:",he)}finally{w(!1)}}},[n]),mt=d.useCallback(async()=>{B(!0);try{const he=await Y2.AuthorizationController_getScopes({});J(he.scopes)}catch(he){console.error("Failed to load scopes:",he)}finally{B(!1)}},[]),ms=d.useCallback(async()=>{try{const he=await $a.AgentsController_listAgentTemplates({});wn(he.avatars)}catch(he){console.error("Failed to load avatar catalog:",he)}},[]),gs=d.useCallback(async()=>{Ce(!0);try{const he=await Yh.MetaController_getAllTags({});ge(he)}catch(he){console.error("Failed to load tags:",he)}finally{Ce(!1)}},[]),xa=d.useCallback(async()=>{if(y){fe(!0);try{const he=await ml.AgentToolPermissionsController_listAgentToolPermissions({actorId:y.actorId});H(he)}catch(he){console.error("Failed to load tool permissions:",he)}finally{fe(!1)}}},[y]);d.useEffect(()=>{!p&&n?(x(!0),console.log("AGENT DETAIL PAGE"),c(n).then(he=>{v(he),x(!1)}).catch(he=>{v(null)})):p&&v(p)},[n,p,c]),d.useEffect(()=>{y&&(kt(),gs(),xa(),qt.length===0&&ms())},[y,qt.length,kt,gs,xa,ms]),d.useEffect(()=>{z&&Q.length===0&&mt(),z||Y(new Set(Eh))},[z,Q.length,mt]),vt({agent:{name:y?.name}}),d.useEffect(()=>{if(!y){l("Agent");return}l(y.name)},[y,l]);const $s=async()=>{if(!(!n||!C.trim()||P.size===0)){O(!0);try{const he=Array.from(P),me=await sc.AgentTokensController_issueToken({slug:n,body:{name:C.trim(),scopes:he,expirationDays:U}});R(me.token),A(!1),L(""),Y(new Set(Eh)),await kt()}catch(he){console.error("Failed to create token:",he),alert("Failed to create token")}finally{O(!1)}}},ri=he=>{Y(me=>{const gt=new Set(me);return gt.has(he)?gt.delete(he):gt.add(he),gt})},Wa=async({systemPrompt:he})=>{if(!y)return!1;try{const me=await u(y.actorId,{systemPrompt:he});return me?(v(me),ie(!1),!0):!1}catch(me){return console.error("Failed to update system prompt:",me),m(me),!1}},ii=async({statusTriggers:he})=>{if(!y)return!1;try{const me=await u(y.actorId,{statusTriggers:he});return me?(v(me),be(!1),!0):!1}catch(me){return console.error("Failed to update status triggers:",me),m(me),!1}},li=async({tagTriggers:he})=>{if(!y)return!1;try{const me=await u(y.actorId,{tagTriggers:he});return me?(v(me),Ze(!1),!0):!1}catch(me){return console.error("Failed to update tag triggers:",me),m(me),!1}},ys=async({introduction:he})=>{if(!y)return!1;try{const me=await u(y.actorId,{introduction:he});return me?(v(me),ue(!1),!0):!1}catch(me){return console.error("Failed to update introduction:",me),m(me),!1}},Pt=async({type:he})=>{if(!y)return!1;try{const me=await u(y.actorId,{type:he});return me?(v(me),et(!1),!0):!1}catch(me){return console.error("Failed to update agent type:",me),m(me),!1}},kn=async({providerId:he,modelId:me})=>{if(!y)return!1;try{const gt=await u(y.actorId,{providerId:he,modelId:me});return gt?(v(gt),pe(!1),!0):!1}catch(gt){return console.error("Failed to update model config:",gt),m(gt),!1}},Ht=async({concurrencyLimit:he})=>{if(!y)return!1;try{const me=await u(y.actorId,{concurrencyLimit:he});return me?(v(me),Te(!1),!0):!1}catch(me){return console.error("Failed to update concurrency limit:",me),m(me),!1}},oi=async({avatarUrl:he})=>{if(!y)return!1;try{const me=await u(y.actorId,{avatarUrl:he});return me?(v(me),ht(!1),!0):!1}catch(me){return console.error("Failed to update avatar:",me),m(me),!1}},ci=async he=>{if(n&&confirm("Are you sure you want to revoke this token? This action cannot be undone."))try{await sc.AgentTokensController_revokeToken({slug:n,tokenId:he}),await kt()}catch(me){console.error("Failed to revoke token:",me),alert("Failed to revoke token")}},Gn=async he=>{if(n){O(!0);try{const me=await sc.AgentTokensController_issueToken({slug:n,body:{name:he.name,scopes:he.scopes,expirationDays:U}});R(me.token),await kt()}catch(me){console.error("Failed to refresh token:",me),alert("Failed to refresh token")}finally{O(!1)}}},Vn=he=>{navigator.clipboard.writeText(he)};if(b)return a.jsx("div",{className:"agent-detail-page",children:a.jsx(ee,{spacing:"4",align:"center",children:a.jsx(S,{size:"3",tone:"muted",children:"Loading agent..."})})});if(!y)return a.jsx("div",{className:"agent-detail-page",children:a.jsxs(ee,{spacing:"4",align:"center",children:[a.jsx(S,{size:"3",tone:"muted",children:"Agent not found"}),a.jsx(ce,{variant:"secondary",onClick:()=>t("/agents"),children:"Back to agents"})]})});const hn=y.introduction,ss=typeof hn=="string"?hn:"",Fn=y.providerId&&y.providerId.trim().length>0?y.providerId:"Default provider",Ps=y.modelId&&y.modelId.trim().length>0?y.modelId:"Default model",En=y.concurrencyLimit,Hs=typeof En=="number"&&Number.isFinite(En)&&En>0?Math.floor(En):null,oe=new Map(se.map(he=>[he.name,he.color])),ve=M.filter(he=>he.server.providedId==="tasks"||he.server.providedId==="context").length,Fe=M.length-ve,bt=de?"Loading tool permissions...":M.length===0?"No tools configured":`${M.length} ${M.length===1?"tool":"tools"} configured`,Ot=de?"Checking assigned tools and scopes":M.length===0?"Tasks and Context can be configured from the dedicated tools page.":`${ve} system ${ve===1?"tool":"tools"}, ${Fe} additional ${Fe===1?"tool":"tools"}`;return a.jsxs("div",{className:"agent-detail-page",children:[a.jsx(xe,{className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>ht(!0),leading:a.jsx(He,{size:"sm",name:y.name,src:y.avatarUrl||void 0}),tags:[dD(y.type),hD(y.isActive)],topRight:a.jsx(S,{size:"1",tone:"muted",children:Lt(y.updatedAt)}),children:[a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:` @${y.slug} `}),a.jsxs(S,{as:"span",tone:"muted",style:"mono",children:["#",y.actorId.slice(0,6)]}),a.jsx(S,{children:y.description?String(y.description):"No description"}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit avatar"})]})}),a.jsx(xe,{title:"System Prompt",className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>ie(!0),children:[a.jsx(S,{size:"2",style:"mono",className:"agent-detail-page__text-preview agent-detail-page__text-preview--system",children:y.systemPrompt||"No system prompt configured"}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(xe,{title:"Introduction",className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>ue(!0),children:[a.jsx(S,{size:"2",className:"agent-detail-page__text-preview",children:ss.trim().length>0?ss:"No introduction configured"}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(xe,{title:"Agent Type",className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>et(!0),children:[a.jsx(S,{size:"2",tone:"muted",children:y.type}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(xe,{title:"Model",className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>pe(!0),children:[a.jsxs(ee,{spacing:"1",children:[a.jsxs(S,{size:"2",tone:"muted",children:["Provider: ",Fn]}),a.jsxs(S,{size:"2",tone:"muted",children:["Model: ",Ps]})]}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(xe,{title:"Concurrency",className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>Te(!0),children:[a.jsx(S,{size:"2",tone:"muted",children:Hs===null?"Unlimited parallel tasks":`${Hs} parallel ${Hs===1?"task":"tasks"}`}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(xe,{title:"Status Triggers",className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>be(!0),children:[y.statusTriggers.length>0?y.statusTriggers.map(he=>a.jsx(S,{tone:"muted",children:he},he)):a.jsx(S,{tone:"muted",children:"No status triggers configured"}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(xe,{title:"Tag Triggers",className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>Ze(!0),children:[y.tagTriggers&&y.tagTriggers.length>0?a.jsx("div",{className:"agent-detail-page__tag-triggers",children:Ee?a.jsx(S,{tone:"muted",children:"Loading tags..."}):y.tagTriggers.map(he=>a.jsx(Sn,{color:fD(oe.get(he)),children:he},he))}):a.jsx(S,{tone:"muted",children:"No tag triggers configured"}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(xe,{title:"Tools",className:"agent-detail-page__section",children:a.jsxs(_e,{onClick:()=>t(`/agents/agent/${y.slug}/tools`),children:[a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"2",weight:"medium",children:bt}),a.jsx(S,{size:"1",tone:"muted",children:Ot})]}),a.jsx(S,{size:"1",tone:"muted",children:"tap to manage"})]})}),E&&a.jsx(xe,{title:"New Token Created",className:"agent-detail-page__section agent-detail-page__new-token",children:a.jsx(_e,{children:a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{weight:"medium",size:"2",className:"agent-detail-page__warning-text",children:"Copy this token now. It will not be shown again."}),a.jsx("div",{className:"agent-detail-page__token-display",children:a.jsx("code",{className:"agent-detail-page__token-code",children:E})}),a.jsxs("div",{className:"agent-detail-page__button-row",children:[a.jsx(ce,{size:"sm",onClick:()=>Vn(E),children:"Copy Token"}),a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>R(null),children:"Dismiss"})]})]})})}),a.jsxs(xe,{title:"Access Tokens",className:"agent-detail-page__section",action:!z&&a.jsx(ce,{size:"sm",onClick:()=>A(!0),children:"New Token"}),children:[z&&a.jsx(_e,{children:a.jsxs(ee,{spacing:"3",children:[a.jsx(S,{weight:"medium",size:"2",children:"Create New Token"}),a.jsxs("div",{className:"agent-detail-page__form-field",children:[a.jsx("label",{children:a.jsx(S,{size:"1",tone:"muted",children:"Token Name"})}),a.jsx("input",{type:"text",value:C,onChange:he=>L(he.target.value),placeholder:"e.g., CI/CD Pipeline",className:"agent-detail-page__input"})]}),a.jsxs("div",{className:"agent-detail-page__form-field",children:[a.jsx("label",{children:a.jsx(S,{size:"1",tone:"muted",children:"Scopes"})}),a.jsx(S,{size:"1",tone:"muted",className:"agent-detail-page__scope-note",children:"The preselected scopes are sufficient for the worker process running this agent."}),ye?a.jsx(S,{size:"2",tone:"muted",children:"Loading available scopes..."}):a.jsx("div",{className:"agent-detail-page__scopes-list",children:Q.map(he=>a.jsxs("label",{className:"agent-detail-page__scope-item",children:[a.jsx("input",{type:"checkbox",checked:P.has(he.id),onChange:()=>ri(he.id)}),a.jsxs("div",{className:"agent-detail-page__scope-info",children:[a.jsx(S,{size:"2",weight:"medium",children:he.id}),a.jsx(S,{size:"1",tone:"muted",children:he.description})]})]},he.id))})]}),a.jsxs("div",{className:"agent-detail-page__form-field",children:[a.jsx("label",{children:a.jsx(S,{size:"1",tone:"muted",children:"Expires in (days)"})}),a.jsx("input",{type:"number",value:U,onChange:he=>re(parseInt(he.target.value)||30),min:1,max:365,className:"agent-detail-page__input"})]}),a.jsxs("div",{className:"agent-detail-page__button-row",children:[a.jsx(ce,{size:"sm",onClick:$s,disabled:D||!C.trim()||P.size===0,children:D?"Creating...":"Create Token"}),a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>A(!1),children:"Cancel"})]})]})}),T?a.jsx(_e,{children:a.jsx(S,{tone:"muted",size:"2",children:"Loading tokens..."})}):_.length===0?a.jsx(_e,{children:a.jsx(S,{tone:"muted",size:"2",children:"No tokens issued for this agent yet."})}):_.map(he=>a.jsxs(_e,{tags:[he.isValid?{label:"active",color:"green"}:{label:he.revokedAt?"revoked":"expired",color:"gray"}],topRight:he.isValid?a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>ci(he.id),children:"Revoke"}):a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>Gn(he),disabled:D,children:"Refresh"}),children:[a.jsx(S,{weight:"medium",size:"2",children:he.name}),a.jsxs(ee,{spacing:"1",children:[a.jsxs(S,{size:"1",tone:"muted",children:["Scopes: ",he.scopes.join(", ")]}),a.jsxs(S,{size:"1",tone:"muted",children:["Created: ",new Date(he.createdAt).toLocaleDateString()," by ",he.issuedByDisplayName]}),a.jsxs(S,{size:"1",tone:"muted",children:["Expires: ",new Date(he.expiresAt).toLocaleDateString()]}),he.revokedAt&&a.jsxs(S,{size:"1",tone:"muted",className:"agent-detail-page__revoked-text",children:["Revoked: ",new Date(String(he.revokedAt)).toLocaleDateString()]})]})]},he.id))]}),a.jsx(ei,{className:"agent-detail-page__actions",onDelete:async()=>{h(y.actorId),t("/agents")}}),a.jsx(xe,{className:"agent-detail-page__actions",children:a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t("/agents"),children:"Back to Agents"})}),V&&y&&a.jsx(tD,{initialValue:y.systemPrompt,onCancel:()=>ie(!1),onSave:Wa}),te&&y&&a.jsx(nD,{initialValue:y.statusTriggers,onCancel:()=>be(!1),onSave:ii}),Re&&y&&a.jsx(sD,{initialValue:y.tagTriggers||[],onCancel:()=>Ze(!1),onSave:li}),It&&y&&a.jsx(iD,{initialValue:y.type,onCancel:()=>et(!1),onSave:Pt}),wt&&y&&a.jsx(aD,{initialValue:ss,onCancel:()=>ue(!1),onSave:ys}),X&&y&&a.jsx(lD,{initialProviderId:y.providerId??"",initialModelId:y.modelId??"",onCancel:()=>pe(!1),onSave:kn}),Z&&y&&a.jsx(oD,{initialValue:Hs,onCancel:()=>Te(!1),onSave:Ht}),tt&&y&&qt.length>0&&a.jsx(cD,{avatars:qt,initialValue:y.avatarUrl,onCancel:()=>ht(!1),onSave:oi})]})}function dD(n){return{label:n,color:{claude:"orange",codex:"green",opencode:"blue",adk:"red",githubcopilot:"yellow",other:"gray"}[n]||"gray"}}function hD(n){return{label:n?"active":"inactive",color:n?"green":"gray"}}function fD(n){if(!n)return"gray";const t={"#6B7280":"gray","#3B82F6":"blue","#10B981":"green","#52B788":"green","#F59E0B":"yellow","#F97316":"orange","#EF4444":"red","#8B5CF6":"purple","#A855F7":"purple","#98D8C8":"green"};if(t[n])return t[n];const i=parseInt(n.slice(1,3),16),l=parseInt(n.slice(3,5),16),c=parseInt(n.slice(5,7),16);return i>l&&i>c?l>100?"orange":"red":l>i&&l>c?"green":c>i&&c>l?i>100?"purple":"blue":i>150&&l>150&&c<100?"yellow":"gray"}function pD({currentPermissions:n,onCancel:t,onSaveUnscopedTool:i,onConfigureScopedTool:l}){const[c,u]=d.useState([]),[h,m]=d.useState(!0),[p,y]=d.useState(""),[v,b]=d.useState(0),[x,_]=d.useState(""),[k,T]=d.useState([]),[w,E]=d.useState(!1),[R,D]=d.useState(!1),O=d.useRef(null),z=d.useRef(null);d.useEffect(()=>{O.current?.focus()},[]),d.useEffect(()=>{(async()=>{m(!0);try{const ye=await gl.McpRegistryController_listServers({});u(ye.items)}catch(ye){console.error("Failed to load tools:",ye)}finally{m(!1)}})()},[]);const A=new Set(n.map(J=>J.serverId)),C=d.useMemo(()=>c.filter(J=>!A.has(J.id)),[c,A]),L=d.useMemo(()=>{const J=p.trim().toLowerCase();return J?C.filter(ye=>ye.name.toLowerCase().includes(J)||ye.type.toLowerCase().includes(J)||ye.description.toLowerCase().includes(J)||ye.providedId.toLowerCase().includes(J)):C},[p,C]),P=L.find(J=>J.id===x)??C.find(J=>J.id===x)??null;d.useEffect(()=>{b(0)},[L.length,p]),d.useEffect(()=>{if(!z.current)return;z.current.children[v]?.scrollIntoView({block:"nearest"})},[v]),d.useEffect(()=>{if(!P||P.type!=="http"){T([]),E(!1);return}let J=!1;return E(!0),gl.McpRegistryController_listScopes({serverId:P.id}).then(ye=>{J||T(ye)}).catch(ye=>{J||(console.error("Failed to load scopes:",ye),T([]))}).finally(()=>{J||E(!1)}),()=>{J=!0}},[P]);const Y=d.useCallback(J=>{if(!(J.nativeEvent.isComposing||L.length===0))switch(J.key){case"ArrowDown":J.preventDefault(),b(ye=>ye<L.length-1?ye+1:ye);break;case"ArrowUp":J.preventDefault(),b(ye=>ye>0?ye-1:0);break;case"Enter":J.preventDefault(),_(L[v]?.id??"");break}},[L,v]),U=d.useCallback(async()=>{if(!(!P||w||R)){if(P.type==="http"&&k.length>0){l(P,k),t?.();return}D(!0);try{await i(P),t?.()}finally{D(!1)}}},[R,w,t,l,i,P,k]),re=d.useCallback(async(J,ye)=>{if(!R){if(_(J.id),b(ye),J.type!=="http"){D(!0);try{await i(J),t?.()}finally{D(!1)}return}E(!0);try{const B=await gl.McpRegistryController_listScopes({serverId:J.id});if(B.length>0){l(J,B),t?.();return}D(!0);try{await i(J),t?.()}finally{D(!1)}}catch(B){console.error("Failed to load scopes:",B)}finally{E(!1)}}},[R,t,l,i]),Q=P?.type==="http"&&k.length>0?"next":R?"saving":"save";return a.jsx(xt,{title:"Add Tool",onCancel:t,headerRight:a.jsx("div",{onClick:()=>{U()},style:{opacity:!P||w||R?.5:1,pointerEvents:!P||w||R?"none":"auto"},children:a.jsx(S,{size:"4",weight:"normal",className:"pop-shell__main-title-button",children:Q})}),children:a.jsx("div",{className:"actor-search-pop",children:h?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(S,{tone:"muted",children:"Loading tools..."})}):C.length===0?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(S,{tone:"muted",children:"All available tools already assigned"})}):a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:O,type:"text",className:"actor-search-pop__input",placeholder:"Search tools...",value:p,onChange:J=>y(J.target.value),onKeyDown:Y}),a.jsx("div",{className:"actor-search-pop__list",ref:z,role:"listbox","aria-label":"Tools",children:L.length===0?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(S,{tone:"muted",children:"No tools found"})}):L.map((J,ye)=>{const B=ye===v,se=J.id===x;return a.jsxs("button",{type:"button",role:"option","aria-selected":se,className:`actor-search-pop__item ${B||se?"actor-search-pop__item--highlighted":""}`,onClick:()=>{re(J,ye)},onMouseEnter:()=>b(ye),disabled:R||w,children:[a.jsx(He,{name:J.name,size:"sm"}),a.jsxs("div",{className:"actor-search-pop__item-info",children:[a.jsx(S,{weight:"medium",size:"2",children:J.name}),a.jsxs(S,{tone:"muted",size:"1",children:["@",J.providedId," · ",J.type]})]})]},J.id)})})]})})})}function Sx({agentActorId:n,currentPermissions:t,onCancel:i,onSave:l,editingPermission:c=null,onDelete:u,fixedTool:h=null,title:m,saveLabel:p}){const[y,v]=d.useState([]),[b,x]=d.useState(!0),[_,k]=d.useState(""),[T,w]=d.useState(0),[E,R]=d.useState(h?.serverId||c?.serverId||""),[D,O]=d.useState([]),[z,A]=d.useState(!1),[C,L]=d.useState(c?new Set(c.scopeIds):new Set),[P,Y]=d.useState(c?.hasAllScopes||!1),[U,re]=d.useState(!1),Q=!!c,J=!!h,ye=d.useRef(null),B=d.useRef(null);d.useEffect(()=>{(async()=>{x(!0);try{const be=await gl.McpRegistryController_listServers({});v(be.items)}catch(be){console.error("Failed to load tools:",be)}finally{x(!1)}})()},[]);const se=y.find(te=>te.id===E),ge=se?.type==="http",Ee=!!(ge&&D.length>0),Ce=new Set(t.map(te=>te.serverId)),M=y.filter(te=>!Ce.has(te.id)||Q&&c&&te.id===c.serverId),H=d.useMemo(()=>{if(Q||J)return M;const te=_.trim().toLowerCase();return te?M.filter(be=>be.name.toLowerCase().includes(te)||be.type.toLowerCase().includes(te)||be.description.toLowerCase().includes(te)):M},[Q,J,_,M]);d.useEffect(()=>{!Q&&!J&&ye.current?.focus()},[Q,J]),d.useEffect(()=>{w(0)},[H.length,_]),d.useEffect(()=>{if(!B.current||Q||J)return;B.current.children[T]?.scrollIntoView({block:"nearest"})},[T,Q,J]),d.useEffect(()=>{E&&ge?(A(!0),gl.McpRegistryController_listScopes({serverId:E}).then(te=>{O(te),c&&c.serverId===E&&(L(new Set(c.scopeIds)),Y(c.hasAllScopes))}).catch(te=>{console.error("Failed to load scopes:",te),O([])}).finally(()=>{A(!1)})):(O([]),!Q&&!J&&(L(new Set),Y(!1)))},[E,ge,c,Q,J]);const de=()=>{const te=!P;Y(te),L(te?new Set(D.map(be=>be.id)):new Set)},fe=te=>{L(be=>{const Re=new Set(be);Re.has(te)?Re.delete(te):Re.add(te);const Ze=D.length>0&&D.every(It=>Re.has(It.id));return Y(Ze),Re})},V=d.useCallback(async()=>{if(!E)return!1;re(!0);try{return await ml.AgentToolPermissionsController_upsertAgentToolPermission({actorId:n,serverId:E,body:{scopeIds:Array.from(C)}}),!J&&!Q&&R(""),L(new Set),Y(!1),await l(),!0}catch(te){return console.error("Failed to add permission:",te),alert("Failed to add tool permission"),!1}finally{re(!1)}},[n,Q,J,l,Ee,C,E]),ie=d.useCallback(te=>{if(!(te.nativeEvent.isComposing||H.length===0))switch(te.key){case"ArrowDown":te.preventDefault(),w(be=>be<H.length-1?be+1:be);break;case"ArrowUp":te.preventDefault(),w(be=>be>0?be-1:0);break;case"Enter":te.preventDefault(),R(H[T]?.id??"");break}},[H,T]);return a.jsx(xt,{title:m??(Q?"Edit Tool Permission":"Select Scopes"),onCancel:i,onSave:V,headerRight:p?a.jsx("div",{onClick:()=>{V()},style:{opacity:U?.5:1,pointerEvents:U?"none":"auto"},children:a.jsx(S,{size:"4",weight:"normal",className:"pop-shell__main-title-button",children:U?"saving":p})}):void 0,children:a.jsx("div",{className:"actor-search-pop",children:a.jsx(ee,{spacing:"2",children:b?a.jsx(S,{size:"2",tone:"muted",children:"Loading available tools..."}):M.length===0?a.jsx(S,{size:"2",tone:"muted",children:"All available tools already assigned"}):a.jsxs(a.Fragment,{children:[!Q&&!J?a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:ye,type:"text",className:"actor-search-pop__input",placeholder:"Search tools...",value:_,onChange:te=>k(te.target.value),onKeyDown:ie}),a.jsx("div",{className:"actor-search-pop__list",ref:B,role:"listbox","aria-label":"Tools",children:H.length===0?a.jsx("div",{className:"actor-search-pop__empty",children:a.jsx(S,{tone:"muted",size:"2",children:"No tools found"})}):H.map((te,be)=>{const Re=be===T,Ze=te.id===E;return a.jsxs("button",{type:"button",role:"option","aria-selected":Ze,className:`actor-search-pop__item ${Re||Ze?"actor-search-pop__item--highlighted":""}`,onClick:()=>{R(te.id),w(be)},onMouseEnter:()=>w(be),disabled:U,children:[a.jsx(He,{name:te.name,size:"sm"}),a.jsxs("div",{className:"actor-search-pop__item-info",children:[a.jsx(S,{weight:"medium",size:"2",children:te.name}),a.jsxs(S,{tone:"muted",size:"1",children:["@",te.providedId," · ",te.type]})]})]},te.id)})})]}):a.jsxs("div",{className:"edit-agent-tool-permissions-pop__selected-tool",children:[a.jsx(S,{size:"2",weight:"medium",children:se?.name??h?.serverName??c?.serverName}),a.jsx(S,{size:"1",tone:"muted",children:se?.description??"Update the scopes for this tool."})]}),E&&ge&&D.length>0&&a.jsxs("div",{className:"edit-agent-tool-permissions-pop__scopes",children:[a.jsx(S,{size:"2",weight:"medium",children:"Select Scopes"}),a.jsxs("label",{className:"edit-agent-tool-permissions-pop__scope-item",children:[a.jsx("input",{type:"checkbox",checked:P,onChange:de}),a.jsxs("div",{className:"edit-agent-tool-permissions-pop__scope-info",children:[a.jsx(S,{size:"2",weight:"medium",children:"All scopes"}),a.jsx(S,{size:"1",tone:"muted",children:"Grant all available scopes"})]})]}),D.map(te=>a.jsxs("label",{className:"edit-agent-tool-permissions-pop__scope-item",children:[a.jsx("input",{type:"checkbox",checked:C.has(te.id),onChange:()=>fe(te.id)}),a.jsxs("div",{className:"edit-agent-tool-permissions-pop__scope-info",children:[a.jsx(S,{size:"2",weight:"medium",style:"mono",children:te.id}),a.jsx(S,{size:"1",tone:"muted",children:te.description})]})]},te.id))]}),E&&ge&&D.length===0&&!z&&a.jsx(S,{size:"2",tone:"muted",children:"This HTTP tool does not define scopes. Access will be granted without scope selection."}),E&&!ge&&a.jsx(S,{size:"2",tone:"muted",children:"This STDIO tool does not require scope configuration."}),E&&Q&&u&&a.jsx(ee,{spacing:"2",children:a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>{u()},children:"Remove Tool"})})]})})})})}function jx(n){return n.server.providedId==="tasks"||n.server.providedId==="context"}function Tx(n){return n.server.type==="stdio"?"No scopes required":n.hasAllScopes?"All scopes":`${n.grantedScopes.length} scope${n.grantedScopes.length===1?"":"s"} granted`}function mD(){const{slug:n}=Jt(),t=De(),{agents:i,setSectionTitle:l,loadAgentDetails:c}=El(),{showError:u}=dn(),h=i.find(Q=>Q.slug===n),[m,p]=d.useState(h||null),[y,v]=d.useState(!h),[b,x]=d.useState([]),[_,k]=d.useState(!1),[T,w]=d.useState(!1),[E,R]=d.useState(!1),[D,O]=d.useState(null),[z,A]=d.useState(null),C=d.useCallback(async Q=>{k(!0);try{const J=await ml.AgentToolPermissionsController_listAgentToolPermissions({actorId:Q});x(J)}catch(J){console.error("Failed to load tool permissions:",J),u(J)}finally{k(!1)}},[u]);d.useEffect(()=>{!h&&n?(v(!0),c(n).then(Q=>{p(Q),v(!1)}).catch(()=>{p(null),v(!1)})):h&&(p(h),v(!1))},[n,h,c]),d.useEffect(()=>{m&&C(m.actorId)},[m,C]),d.useEffect(()=>{if(!m){l("Tools");return}l(`${m.name} Tools`)},[m,l]),vt({agent:{name:m?`${m.name} Tools`:void 0}});const L=()=>{w(!0)},P=Q=>{O(Q),R(!0)},Y=async Q=>{if(m&&confirm("Remove this tool permission?"))try{await ml.AgentToolPermissionsController_deleteAgentToolPermission({actorId:m.actorId,serverId:Q}),R(!1),O(null),await C(m.actorId)}catch(J){console.error("Failed to delete tool permission:",J),u(J)}};if(y)return a.jsx("div",{className:"agent-tools-page",children:a.jsx(ee,{spacing:"4",align:"center",children:a.jsx(S,{size:"3",tone:"muted",children:"Loading tools..."})})});if(!m)return a.jsx("div",{className:"agent-tools-page",children:a.jsxs(ee,{spacing:"4",align:"center",children:[a.jsx(S,{size:"3",tone:"muted",children:"Agent not found"}),a.jsx(ce,{variant:"secondary",onClick:()=>t("/agents"),children:"Back to agents"})]})});const U=b.filter(jx),re=b.filter(Q=>!jx(Q));return a.jsxs("div",{className:"agent-tools-page",children:[a.jsx(xe,{className:"agent-tools-page__section",children:a.jsx(_e,{children:a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"3",weight:"medium",children:"Tools"}),a.jsx(S,{size:"2",tone:"muted",children:"Tasks and Context stay available. Additional tools can be assigned per agent with scoped access."})]})})}),a.jsx(xe,{title:"System Tools",className:"agent-tools-page__section",children:U.map(Q=>a.jsx(_e,{children:a.jsx("div",{className:"agent-tools-page__row",children:a.jsxs("div",{className:"agent-tools-page__row-main",children:[a.jsxs("div",{className:"agent-tools-page__row-title",children:[a.jsx(S,{size:"2",weight:"medium",children:Q.server.name}),a.jsxs("div",{className:"agent-tools-page__chips",children:[a.jsx(Sn,{color:"purple",children:"System Tool"}),a.jsx(Sn,{color:Q.server.type==="http"?"green":"orange",children:Q.server.type})]})]}),a.jsx(S,{size:"1",tone:"muted",children:Q.server.description}),a.jsx(S,{size:"1",tone:"muted",children:Tx(Q)})]})})},Q.server.id))}),a.jsx(xe,{title:"Additional Tools",className:"agent-tools-page__section",children:_?a.jsx(_e,{children:a.jsx(S,{size:"2",tone:"muted",children:"Loading tool permissions..."})}):re.length===0?a.jsx(_e,{children:a.jsxs(ee,{spacing:"1",children:[a.jsx(S,{size:"2",tone:"muted",children:"No additional tools configured"}),a.jsx(S,{size:"1",tone:"muted",children:"Add a tool to grant this agent access beyond Tasks and Context."})]})}):re.map(Q=>a.jsx(_e,{onClick:()=>P(Q),trailing:a.jsx(S,{size:"2",tone:"muted",children:"Edit"}),children:a.jsx("div",{className:"agent-tools-page__row",children:a.jsxs("div",{className:"agent-tools-page__row-main",children:[a.jsxs("div",{className:"agent-tools-page__row-title",children:[a.jsx(S,{size:"2",weight:"medium",children:Q.server.name}),a.jsx("div",{className:"agent-tools-page__chips",children:a.jsx(Sn,{color:Q.server.type==="http"?"green":"orange",children:Q.server.type})})]}),a.jsx(S,{size:"1",tone:"muted",children:Q.server.description}),a.jsx(S,{size:"1",tone:"muted",children:Tx(Q)})]})})},Q.server.id))}),a.jsxs(xe,{className:"agent-tools-page__actions",children:[a.jsx(ce,{size:"lg",onClick:L,children:"Add Tool"}),a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t(`/agents/agent/${m.slug}`),children:"Back to agent details"})]}),T&&a.jsx(pD,{currentPermissions:b.map(Q=>({serverId:Q.server.id})),onCancel:()=>w(!1),onSaveUnscopedTool:async Q=>{await ml.AgentToolPermissionsController_upsertAgentToolPermission({actorId:m.actorId,serverId:Q.id,body:{scopeIds:[]}}),await C(m.actorId)},onConfigureScopedTool:(Q,J)=>{A({serverId:Q.id,serverName:Q.name,serverProvidedId:Q.providedId,serverType:Q.type})}}),E&&a.jsx(Sx,{agentActorId:m.actorId,currentPermissions:b.map(Q=>({serverId:Q.server.id,serverName:Q.server.name,serverProvidedId:Q.server.providedId,serverType:Q.server.type,scopeIds:Q.grantedScopes.map(J=>J.id),hasAllScopes:Q.hasAllScopes})),editingPermission:D?{serverId:D.server.id,serverName:D.server.name,serverProvidedId:D.server.providedId,serverType:D.server.type,scopeIds:D.grantedScopes.map(Q=>Q.id),hasAllScopes:D.hasAllScopes}:null,onCancel:()=>{R(!1),O(null)},onSave:async()=>{await C(m.actorId),R(!1),O(null)},onDelete:D?async()=>{await Y(D.server.id)}:void 0}),z&&a.jsx(Sx,{agentActorId:m.actorId,currentPermissions:b.map(Q=>({serverId:Q.server.id,serverName:Q.server.name,serverProvidedId:Q.server.providedId,serverType:Q.server.type,scopeIds:Q.grantedScopes.map(J=>J.id),hasAllScopes:Q.hasAllScopes})),fixedTool:z,title:"Select Scopes",saveLabel:"save",onCancel:()=>A(null),onSave:async()=>{await C(m.actorId),A(null)}})]})}function ac(n,t){const i=t.providerId?.trim().toLowerCase()??"",l=t.modelId?.trim().toLowerCase()??"";return i.includes("anthropic")||l.includes("claude")?ll(n,"claude"):i.includes("openai")||l.includes("gpt")||l.includes("codex")?ll(n,"openai"):i.includes("google")||l.includes("gemini")||t.type==="adk"?ll(n,"gemini"):l.includes("qwen")?ll(n,"qwen"):ll(n,yD[t.type??"other"])}function gD(n,t){return n.avatars.find(i=>i.url===t)?.label??"Default"}function ll(n,t){return n.avatars.find(i=>i.id===t)?.url}const yD={claude:"claude",codex:"openai",opencode:"opencode",adk:"gemini",githubcopilot:"openai",other:void 0},wx=["template","harness","model","status","tags","avatar"],vD=[Se.NOT_STARTED,Se.IN_PROGRESS,Se.FOR_REVIEW,Se.DONE],xD={name:"",slug:"",type:"other",description:void 0,systemPrompt:"",providerId:void 0,modelId:void 0,statusTriggers:[],tagTriggers:[],allowedTools:[],isActive:!0,concurrencyLimit:1},bD={stepIndex:0,draft:xD,selectedModelOptionId:"default",customProviderId:"",customModelId:"",tagText:"",slugTouched:!1,avatarTouched:!1};function _D(){const n=De(),{setSectionTitle:t,createAgent:i}=El(),[l,c]=d.useState(null),[u,h]=d.useState(null),[m,p]=d.useState(!0),[y,v,b]=ni({key:"new-agent-wizard-draft",defaultValue:bD,debounceMs:0}),[x,_]=d.useState(!1),[k,T]=d.useState(null),{stepIndex:w,draft:E,selectedModelOptionId:R,customProviderId:D,customModelId:O,tagText:z,slugTouched:A}=y;vt(),d.useEffect(()=>{t("New Agent")},[t]),d.useEffect(()=>{let V=!0;async function ie(){try{const te=await $a.AgentsController_listAgentTemplates({});if(!V)return;c(te);const be=te.templates.find(Re=>Re.id==="custom")??te.templates[0];be&&!y.draft.templateId&&Q(be)}catch(te){if(!V)return;h(te instanceof Error?te.message:"Failed to load agent templates")}finally{V&&p(!1)}}return ie(),()=>{V=!1}},[]);const C=d.useMemo(()=>E.templateId==="custom"?[...wx,"prompt","identity"]:[...wx,"identity"],[E.templateId]),L=Math.min(w,C.length-1),P=C[L],Y=d.useMemo(()=>l?.harnesses.find(V=>V.type===E.type)??null,[l,E.type]),U=kx(P,E),re=L===C.length-1;function Q(V){v(ie=>({...ie,draft:{...ie.draft,templateId:V.id,type:V.type??ie.draft.type??"other",description:V.agentDescription||void 0,systemPrompt:V.systemPrompt,providerId:V.providerId||void 0,modelId:V.modelId||void 0,statusTriggers:V.statusTriggers,tagTriggers:V.tagTriggers,avatarUrl:V.avatarUrl,concurrencyLimit:V.concurrencyLimit,allowedTools:[],isActive:!0},tagText:V.tagTriggers.join(", "),selectedModelOptionId:V.providerId||V.modelId?`${V.providerId||"default-provider"}:${V.modelId}`:"default",customProviderId:"",customModelId:"",avatarTouched:!1}))}function J(V){v(ie=>({...ie,avatarTouched:!1,draft:{...ie.draft,type:V.type,providerId:void 0,modelId:void 0,avatarUrl:l?ac(l,{type:V.type}):ie.draft.avatarUrl},selectedModelOptionId:"default",customProviderId:"",customModelId:""}))}function ye(V){if(V==="custom"){v(ie=>({...ie,selectedModelOptionId:"custom",draft:{...ie.draft,providerId:ie.customProviderId.trim()||void 0,modelId:ie.customModelId.trim()||void 0,avatarUrl:l&&!ie.avatarTouched?ac(l,{type:ie.draft.type,providerId:ie.customProviderId,modelId:ie.customModelId}):ie.draft.avatarUrl}}));return}v(ie=>({...ie,selectedModelOptionId:V.id,draft:{...ie.draft,providerId:V.providerId,modelId:V.modelId,avatarUrl:l&&!ie.avatarTouched?ac(l,{type:ie.draft.type,providerId:V.providerId,modelId:V.modelId}):ie.draft.avatarUrl}}))}function B(V,ie){v(te=>({...te,customProviderId:V,customModelId:ie,draft:{...te.draft,providerId:V.trim()||void 0,modelId:ie.trim()||void 0,avatarUrl:l&&!te.avatarTouched?ac(l,{type:te.draft.type,providerId:V,modelId:ie}):te.draft.avatarUrl}}))}function se(V){v(ie=>({...ie,avatarTouched:!0,draft:{...ie.draft,avatarUrl:V}}))}function ge(V){v(ie=>{const te=new Set(ie.draft.statusTriggers??[]);return te.has(V)?te.delete(V):te.add(V),{...ie,draft:{...ie.draft,statusTriggers:Array.from(te)}}})}function Ee(V){v(ie=>({...ie,tagText:V,draft:{...ie.draft,tagTriggers:V.split(",").map(te=>te.trim()).filter(Boolean)}}))}function Ce(V){v(ie=>({...ie,draft:{...ie.draft,name:V,slug:ie.slugTouched?ie.draft.slug:jD(V)}}))}function M(V){v(ie=>({...ie,slugTouched:!0,draft:{...ie.draft,slug:TD(V)}}))}function H(){U&&v(V=>({...V,stepIndex:Math.min(V.stepIndex+1,C.length-1)}))}function de(){v(V=>({...V,stepIndex:Math.max(V.stepIndex-1,0)}))}async function fe(){if(!(!kx("identity",E)||x)){_(!0),T(null);try{const V=await i({name:E.name.trim(),slug:E.slug.trim(),type:E.type,description:E.description,avatarUrl:E.avatarUrl,systemPrompt:E.systemPrompt,providerId:E.providerId,modelId:E.modelId,statusTriggers:E.statusTriggers??[],tagTriggers:E.tagTriggers??[],allowedTools:[],isActive:!0,concurrencyLimit:E.concurrencyLimit});V?(b(),n(`/agents/agent/${V.slug}`)):T("Agent creation failed")}finally{_(!1)}}}return m?a.jsx(xe,{children:a.jsx(_e,{children:a.jsx(S,{tone:"muted",children:"Loading agent templates..."})})}):u||!l?a.jsx(xe,{children:a.jsx(_e,{children:a.jsxs(ee,{spacing:"3",children:[a.jsx(S,{tone:"muted",children:u??"Agent templates are unavailable"}),a.jsx(ce,{variant:"secondary",onClick:()=>n("/agents"),children:"Back to Agents"})]})})}):a.jsxs("div",{className:"new-agent-wizard",children:[a.jsxs("div",{className:"new-agent-wizard__header",children:[a.jsxs(S,{size:"1",tone:"muted",children:["Step ",L+1," of ",C.length]}),a.jsx("div",{className:"new-agent-wizard__progress","aria-hidden":"true",children:a.jsx("div",{className:"new-agent-wizard__progress-fill",style:{width:`${(L+1)/C.length*100}%`}})})]}),a.jsxs("div",{className:"new-agent-wizard__body",children:[P==="template"&&a.jsx(pa,{title:"What kind of agent are you making?",support:"Pick a starting point. You can adjust the agent from its page later.",children:a.jsx("div",{className:"new-agent-wizard__option-grid",children:l.templates.map(V=>a.jsx(ol,{title:V.label,description:V.description,selected:E.templateId===V.id,onClick:()=>Q(V)},V.id))})}),P==="harness"&&a.jsx(pa,{title:"What harness do you want to use?",support:"Choose the runtime that will execute this agent.",children:a.jsx("div",{className:"new-agent-wizard__option-grid",children:l.harnesses.map(V=>a.jsx(ol,{title:V.label,description:V.description,selected:E.type===V.type,onClick:()=>J(V)},V.type))})}),P==="model"&&a.jsxs(pa,{title:"Which model should it use?",support:"Default lets the harness choose. You can also pick a preset or enter a model.",children:[a.jsxs("div",{className:"new-agent-wizard__option-grid",children:[(Y?.modelOptions??[]).map(V=>a.jsx(ol,{title:V.label,description:V.isDefault?"Use the harness default":Ex(V),selected:R===V.id,onClick:()=>ye(V)},V.id)),a.jsx(ol,{title:"Custom",description:"Use a provider and model ID",selected:R==="custom",onClick:()=>ye("custom")})]}),R==="custom"&&a.jsxs("div",{className:"new-agent-wizard__field-grid",children:[a.jsxs("label",{className:"new-agent-wizard__field",children:[a.jsx(S,{size:"1",tone:"muted",children:"Provider ID"}),a.jsx("input",{value:D,onChange:V=>B(V.target.value,O),placeholder:"openai"})]}),a.jsxs("label",{className:"new-agent-wizard__field",children:[a.jsx(S,{size:"1",tone:"muted",children:"Model ID"}),a.jsx("input",{value:O,onChange:V=>B(D,V.target.value),placeholder:"gpt-5.3-codex"})]})]})]}),P==="status"&&a.jsx(pa,{title:"When should this agent react?",support:"These task statuses trigger the agent. Select none if it should only run manually.",children:a.jsx("div",{className:"new-agent-wizard__option-grid",children:vD.map(V=>{const ie=Jn[V];return a.jsx(ol,{title:ie.label,description:V,selected:(E.statusTriggers??[]).includes(V),onClick:()=>ge(V)},V)})})}),P==="tags"&&a.jsx(pa,{title:"Should this only run for certain tags?",support:"Leave this blank to react to every task with the selected status.",children:a.jsxs("label",{className:"new-agent-wizard__field",children:[a.jsx(S,{size:"1",tone:"muted",children:"Tag names"}),a.jsx("input",{value:z,onChange:V=>Ee(V.target.value),placeholder:"code, review"})]})}),P==="avatar"&&a.jsx(pa,{title:"Choose avatar",support:"Pick one of the bundled avatars that the backend exposes for agents.",children:a.jsx(J_,{avatars:l.avatars,selectedUrl:E.avatarUrl??void 0,onSelect:se})}),P==="prompt"&&a.jsx(pa,{title:"What should this agent do?",support:"Write the system prompt for this custom agent.",children:a.jsx("textarea",{className:"new-agent-wizard__prompt-editor",value:E.systemPrompt,onChange:V=>v(ie=>({...ie,draft:{...ie.draft,systemPrompt:V.target.value}})),placeholder:"You are an agent that...","aria-label":"System prompt"})}),P==="identity"&&a.jsxs(pa,{title:"Almost done. Name your agent.",support:"Tools can be added from the agent page after creation.",children:[a.jsxs("div",{className:"new-agent-wizard__identity-fields",children:[a.jsxs("label",{className:"new-agent-wizard__identity-field",children:[a.jsx(S,{size:"1",tone:"muted",children:"Display name"}),a.jsx("input",{className:"new-agent-wizard__name-input",value:E.name,onChange:V=>Ce(V.target.value),placeholder:"Code Reviewer",autoFocus:!0})]}),a.jsxs("label",{className:"new-agent-wizard__identity-field",children:[a.jsx(S,{size:"1",tone:"muted",children:"Slug"}),a.jsxs("div",{className:"new-agent-wizard__slug-row",children:[a.jsx(S,{as:"span",size:"4",tone:"muted",children:"@"}),a.jsx("input",{className:"new-agent-wizard__slug-input",value:E.slug,onChange:V=>M(V.target.value),placeholder:"code-reviewer"})]})]})]}),a.jsxs("div",{className:"new-agent-wizard__summary",children:[a.jsx(S,{size:"2",weight:"medium",children:"Summary"}),a.jsxs(S,{size:"2",tone:"muted",children:["Template: ",SD(l.templates,E.templateId)]}),a.jsxs(S,{size:"2",tone:"muted",children:["Harness: ",Y?.label??E.type??"Other"]}),a.jsxs(S,{size:"2",tone:"muted",children:["Model: ",E.modelId?Ex(E):"Default"]}),a.jsxs(S,{size:"2",tone:"muted",children:["Avatar: ",gD(l,E.avatarUrl)]}),a.jsxs(S,{size:"2",tone:"muted",children:["Triggers: ",(E.statusTriggers??[]).length>0?E.statusTriggers?.join(", "):"Manual"]}),a.jsxs(S,{size:"2",tone:"muted",children:["Tags: ",(E.tagTriggers??[]).length>0?E.tagTriggers?.join(", "):"Any tag"]})]})]}),k&&a.jsx(S,{size:"2",className:"new-agent-wizard__error",children:k})]}),a.jsxs("div",{className:"new-agent-wizard__footer",children:[a.jsx(ce,{variant:"secondary",size:"lg",fullWidth:!0,onClick:L===0?()=>{b(),n("/agents")}:de,children:L===0?"Cancel":"Back"}),a.jsx(ce,{size:"lg",fullWidth:!0,onClick:re?fe:H,disabled:!U||x,children:re?x?"Creating...":"Create agent":"Next"})]})]})}function pa({title:n,support:t,children:i}){return a.jsxs(ee,{spacing:"4",className:"new-agent-wizard__section",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"5",weight:"bold",children:n}),a.jsx(S,{size:"2",tone:"muted",children:t})]}),i]})}function ol({title:n,description:t,selected:i,onClick:l}){return a.jsxs("button",{className:`new-agent-wizard__option ${i?"new-agent-wizard__option--selected":""}`,type:"button",onClick:l,children:[a.jsx(S,{size:"3",weight:"medium",children:n}),a.jsx(S,{size:"2",tone:"muted",children:t})]})}function kx(n,t){return n==="template"?!!t.templateId:n==="harness"?!!t.type:n==="prompt"?!!t.systemPrompt.trim():n==="identity"?!!(t.name.trim()&&t.slug.trim()):!0}function SD(n,t){return n.find(i=>i.id===t)?.label??"Custom"}function Ex(n){const t=[n.providerId,n.modelId].filter(Boolean);return t.length>0?t.join(" / "):"Default"}function jD(n){return n.toLowerCase().trim().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}function TD(n){return n.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9_-]/g,"")}function wD(){return a.jsx(X2,{children:a.jsx(ps,{children:a.jsxs(je,{element:a.jsx(eD,{}),children:[a.jsx(je,{index:!0,element:a.jsx(Q2,{})}),a.jsx(je,{path:"/new",element:a.jsx(_D,{})}),a.jsx(je,{path:"/agent/:slug",element:a.jsx(uD,{})}),a.jsx(je,{path:"/agent/:slug/tools",element:a.jsx(mD,{})})]})})})}const kD=va("/threads"),ED=()=>{const[n,t]=d.useState(!1),[i,l]=d.useState(null),[c,u]=d.useState([]),[h,m]=d.useState(null),[p,y]=d.useState(!1),v=d.useCallback(async()=>{t(!0),l(null);try{const T=await Bn.ThreadsController_listThreads({});u(T.items||[])}catch(T){l(T instanceof Error?T.message:"Failed to load threads")}finally{t(!1)}},[]),b=d.useCallback(async T=>await Bn.ThreadsController_getThread({id:T}),[]),x=d.useCallback(async T=>{const w=await Bn.ThreadsController_createThread({body:{title:T}});return u(E=>[w,...E]),w},[]),_=d.useCallback(async T=>{await Bn.ThreadsController_deleteThread({id:T}),u(w=>w.filter(E=>E.id!==T))},[]),k=d.useCallback(()=>{const T=$n(kD,{transports:["websocket","polling"],withCredentials:!0});return T.on("connect",()=>{console.log("Connected to websocket"),T.emit("threads.subscribe",{},w=>{w.ok?(console.log(w),console.log("Subscribed to room:",w.room),y(!0)):(console.error("Failed to subscribe to room"),y(!1))})}),T.on(Fr.THREAD_TITLE_UPDATED,w=>{u(E=>E.map(R=>R.id===w.payload.threadId?{...R,title:w.payload.title}:R))}),T.on("disconnect",()=>{console.log("WebSocket disconnected"),y(!1)}),m(T),()=>{T.emit("threads.unsubscribe",{}),T.close(),m(null),y(!1)}},[]);return d.useEffect(()=>(v(),k()),[v,k]),{isLoading:n,error:i,threads:c,loadThreads:v,getThread:b,createThread:x,deleteThread:_}},eS=d.createContext(null);function CD({children:n}){const{threads:t,isLoading:i,error:l,loadThreads:c,getThread:u,createThread:h,deleteThread:m}=ED(),[p,y]=d.useState(""),[v,b]=d.useState([]),[x,_]=d.useState(null),k=d.useMemo(()=>({threads:t,isLoading:i,error:l,loadThreads:c,sectionTitle:p,setSectionTitle:y,navItems:v,setNavItems:b,getThread:u,createThread:h,deleteThread:m,optimisticDraftThread:x,setOptimisticDraftThread:_}),[t,i,l,c,p,y,v,b,u,h,m,x,_]);return a.jsx(eS.Provider,{value:k,children:n})}function xl(){const n=d.useContext(eS);if(!n)throw new Error("useThreadsCtx must be used within <ThreadsProvider>");return n}function ND({thread:n,onClick:t}){return a.jsx(_e,{onClick:t,children:a.jsx("div",{style:{minWidth:0,overflow:"hidden"},children:a.jsx(S,{weight:"bold",size:"3",tone:"default",children:n.title})})})}function zf({contextBlock:n,isStateMemory:t=!1}){const i=De(),l=u=>{u.metaKey||u.ctrlKey?(u.stopPropagation(),window.open(`/context/block/${n.id}`,"_blank")):i(`/context/block/${n.id}`)},c=u=>{(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),i(`/context/block/${n.id}`))};return a.jsx(Ye,{className:"thread-context-card",children:a.jsxs("div",{className:"thread-context-card__content",role:"button",tabIndex:0,onClick:l,onKeyDown:c,children:[a.jsx(S,{size:"2",weight:"semibold",children:n.title}),a.jsxs("div",{className:"thread-context-card__meta",children:[a.jsxs(S,{size:"1",tone:"muted",children:["#",n.id.slice(0,6)]}),t&&a.jsx(Sn,{color:"blue",children:"State"})]})]})})}function AD(){const{threads:n,setSectionTitle:t,createThread:i}=xl(),l=De(),c=Dt(),{showError:u,showToast:h}=dn(),{registerCommands:m}=Tl(),{readiness:p,isReady:y,isLoading:v}=si();vt(),d.useEffect(()=>{t("Threads 🧵")},[t]);const b=_=>{l(`/threads/${_}`)},x=d.useCallback(async()=>{if(c){l("/threads");return}if(!y){h("Thread chat unlocks in Chat Settings.","info"),l("/settings/models");return}try{const _=await i();_&&l(`/threads/${_.id}`)}catch(_){console.error("Error creating thread"),console.error(_),u(_)}},[i,y,l,u,h]);return d.useEffect(()=>m([{id:"new-thread",label:"New Thread",description:"Create a new thread",aliases:["create thread","add thread"],onSelect:x}]),[m,x]),c?a.jsx(RD,{}):a.jsxs(a.Fragment,{children:[!v&&p&&!p.isReady?a.jsx(Oc,{title:p.title,description:p.description,ctaLabel:p.ctaLabel,onOpenSettings:()=>l("/settings/models")}):null,a.jsx(xe,{children:n.map(_=>a.jsx(ND,{thread:_,onClick:()=>b(_.id)},_.id))}),a.jsx("button",{className:`threads-fab ${c?"threads-fab--desktop":""}`,type:"button",onClick:x,disabled:!y||v,"aria-label":"Create new thread",children:c?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"threads-fab__plus",children:"+"}),a.jsx("span",{className:"threads-fab__label",children:"New thread"})]}):"+"})]})}function RD(){const n=De(),{createThread:t,optimisticDraftThread:i,setOptimisticDraftThread:l}=xl(),{showError:c}=dn(),[u,h,m]=ni({key:"thread-chat-draft-new",defaultValue:{content:""}}),[p,y]=d.useState(!1),[v,b]=d.useState(null),x=d.useRef(null),{readiness:_,isLoading:k}=si();d.useEffect(()=>{k||x.current?.focus()},[k]);const T=d.useCallback(async w=>{w.preventDefault();const E=u.content.trim();if(!(!E||p)){y(!0),b(null),l({title:"New thread",message:E}),h({content:""});try{const R=await t();await Bn.ThreadsController_createMessage({id:R.id,body:{content:E}}),m(),l(null),n(`/threads/${R.id}`)}catch(R){const D=R instanceof Error?R.message:"Failed to start thread";b(D),h({content:E}),l(null),c(R)}finally{y(!1)}}},[m,t,u.content,p,n,h,l,c]);return i?a.jsx(DD,{title:i.title,message:i.message}):a.jsxs("div",{className:"threads-page-desktop",children:[a.jsx("div",{className:"thread-detail-page__header",children:a.jsx("div",{className:"thread-detail-page__header-top",children:a.jsx("div",{children:a.jsx(S,{size:"5",weight:"bold",children:"New thread"})})})}),a.jsxs("div",{className:"thread-chat threads-page-desktop__chat",children:[a.jsx("div",{className:"thread-chat__messages","aria-label":"New thread messages"}),!k&&_&&!_.isReady?a.jsx("div",{className:"thread-chat__setup-callout",children:a.jsx(Oc,{title:_.title,description:_.description,ctaLabel:_.ctaLabel,onOpenSettings:()=>n("/settings/models")})}):a.jsxs("form",{className:"thread-chat__input-form",onSubmit:T,children:[a.jsxs("div",{className:"thread-chat__composer-row",children:[a.jsx("textarea",{ref:x,className:"thread-chat__input",value:u.content,onChange:w=>h({content:w.target.value}),placeholder:"Write a message...",rows:3,disabled:p||k,onKeyDown:w=>{w.key==="Enter"&&!w.shiftKey&&(w.preventDefault(),T(w))}}),a.jsx(ce,{type:"submit",variant:"secondary",className:"thread-chat__send-btn",disabled:!u.content.trim()||p||k,children:p?"starting...":"send"})]}),v?a.jsx("div",{className:"thread-chat__status thread-chat__status--error",children:a.jsx(S,{size:"1",children:v})}):null]})]})]})}function DD({title:n,message:t}){const{user:i}=un(),{actors:l}=wl(),c=l.find(p=>p.id===i?.actorId),u=c?.displayName||i?.displayName||"You",h=c?.slug,m=c?.avatarUrl||void 0;return a.jsxs("div",{className:"thread-detail-page thread-detail-page--desktop threads-page-desktop__optimistic",children:[a.jsx("div",{className:"thread-detail-page__main",children:a.jsxs("div",{className:"thread-detail-page__content",children:[a.jsx("div",{className:"thread-detail-page__header",children:a.jsx("div",{className:"thread-detail-page__header-top",children:a.jsxs("div",{children:[a.jsx(S,{size:"5",weight:"bold",children:n}),a.jsxs("div",{className:"thread-detail-page__meta-row",children:[a.jsx(Sn,{color:"gray",children:"creating"}),a.jsx(S,{size:"1",tone:"muted",children:"1 participant"})]})]})})}),a.jsx("div",{className:"thread-detail-page__chat",children:a.jsxs("div",{className:"thread-chat",children:[a.jsx("div",{className:"thread-chat__messages",children:a.jsxs("div",{className:"thread-chat__message thread-chat__message--mine",children:[a.jsxs("div",{className:"thread-chat__message-header",children:[a.jsxs("div",{className:"thread-chat__author",children:[a.jsx(He,{name:u,src:m,size:"xs"}),a.jsx(S,{size:"1",weight:"semibold",children:u}),h?a.jsxs(S,{size:"1",tone:"muted",children:["@",h]}):null]}),a.jsx(S,{size:"1",tone:"muted",children:"sending..."})]}),a.jsx(S,{size:"2",children:t})]})}),a.jsx("form",{className:"thread-chat__input-form",children:a.jsxs("div",{className:"thread-chat__composer-row",children:[a.jsx("textarea",{className:"thread-chat__input",placeholder:"Write a message...",rows:3,disabled:!0}),a.jsx(ce,{type:"submit",variant:"secondary",className:"thread-chat__send-btn",disabled:!0,children:"starting..."})]})})]})})]})}),a.jsx("div",{className:"thread-detail-page__sidebar threads-page-desktop__optimistic-sidebar",children:a.jsx("div",{className:"thread-detail-page__sidebar-scroll",children:a.jsxs("div",{className:"thread-detail-page__sidebar-section",children:[a.jsx(S,{size:"2",weight:"semibold",className:"thread-detail-page__sidebar-header",children:"Context (1)"}),a.jsx("div",{className:"thread-detail-page__sidebar-content",children:a.jsx(zf,{contextBlock:{id:"creating",title:"Thread state memory"},isStateMemory:!0})})]})})})]})}function OD(){const n=Dt(),{id:t}=Jt(),i=!!t,l=De(),{threads:c,isLoading:u,error:h,sectionTitle:m,navItems:p,optimisticDraftThread:y}=xl(),[v,b]=d.useState(!1);return d.useEffect(()=>{if(!n)return;const x=localStorage.getItem("threads-sidebar-collapsed");b(x==="true")},[n]),d.useEffect(()=>{n&&localStorage.setItem("threads-sidebar-collapsed",String(v))},[n,v]),n?a.jsxs("div",{className:"threads-layout threads-layout--desktop",children:[a.jsxs("aside",{className:`threads-layout__sidebar ${v?"threads-layout__sidebar--collapsed":""}`,children:[a.jsx("div",{className:"threads-layout__sidebar-header",children:v?a.jsx(S,{as:"div",size:"1",tone:"muted",children:c.length}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"threads-layout__sidebar-title",onClick:()=>l("/threads"),children:a.jsx(S,{as:"span",size:"2",weight:"semibold",children:"Threads"})}),a.jsxs("div",{className:"threads-layout__sidebar-header-actions",children:[a.jsx(S,{as:"div",size:"1",tone:"muted",children:c.length}),a.jsx("button",{type:"button",className:"threads-layout__sidebar-new",onClick:()=>l("/threads"),"aria-label":"New thread",title:"New thread",children:"+"})]})]})}),a.jsx("div",{className:"threads-layout__sidebar-body",children:v?null:u?a.jsx("div",{className:"threads-layout__sidebar-status",children:"Loading threads..."}):h?a.jsxs("div",{className:"threads-layout__sidebar-status",children:["Error: ",h]}):c.length===0?a.jsx("div",{className:"threads-layout__sidebar-status",children:"No threads yet"}):a.jsxs("div",{className:"threads-layout__thread-list",children:[y?a.jsx("button",{type:"button",className:"threads-layout__thread-item threads-layout__thread-item--active",onClick:()=>l("/threads"),children:a.jsx("span",{className:"threads-layout__thread-title",children:y.title})}):null,c.map(x=>{const _=x.id===t;return a.jsx("button",{type:"button",className:`threads-layout__thread-item ${_?"threads-layout__thread-item--active":""}`,onClick:()=>l(`/threads/${x.id}`),children:a.jsx("span",{className:"threads-layout__thread-title",children:x.title})},x.id)})]})}),a.jsx("button",{type:"button",className:"threads-layout__sidebar-toggle",onClick:()=>b(x=>!x),"aria-label":v?"Expand threads sidebar":"Collapse threads sidebar",children:v?"→":"←"})]}),a.jsx("main",{className:"threads-layout__main",children:a.jsx(Qt,{})})]}):a.jsx("div",{style:{minHeight:0},children:i?a.jsx(Qt,{}):a.jsx(Qa,{appTitle:"Threads",sectionTitle:m,navItems:p,children:a.jsx(Qt,{})})})}function zD({task:n}){const t=De(),i=n.tags.map(u=>({label:u.name}));n.commentCount>0&&i.push({label:`💬 ${n.commentCount}`});const l=n.inputRequests.filter(u=>!u.resolvedAt).length;l>0&&i.push({label:`✋ ${l}`});const c=u=>{u.metaKey||u.ctrlKey?(u.stopPropagation(),window.open(`/tasks/task/${n.id}`,"_blank")):t(`/tasks/task/${n.id}`)};return a.jsxs(ob,{leading:a.jsx(He,{name:n.createdByActor.displayName,size:"md",src:n.createdByActor.avatarUrl||void 0}),topRight:Lt(n.updatedAt),tags:i,onClick:c,highlight:l>0,footer:a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"row-detail truncate",children:["#",n.id.slice(0,6)]}),a.jsx("span",{className:"row-detail truncate",children:n.assigneeActor?`Assigned: @${n.assigneeActor.slug}`:"unassigned"})]}),children:[a.jsx("div",{className:"row-title truncate",children:n.name}),a.jsx("div",{className:"row-subtitle truncate",children:n.description})]})}function LD({task:n,onClick:t}){const i=n.assigneeActor??n.createdByActor,l=n.tags.map(u=>({label:u.name}));n.commentCount>0&&l.push({label:`comments ${n.commentCount}`});const c=n.inputRequests.filter(u=>!u.resolvedAt).length;return c>0&&l.push({label:`questions ${c}`}),a.jsxs(_e,{leading:a.jsx(He,{name:i.displayName,size:"lg",src:i.avatarUrl||void 0}),topRight:Lt(n.updatedAt),tags:l,highlight:c>0,onClick:t,children:[a.jsxs(S,{className:"pre",children:["#",n.id.slice(0,6)]}),a.jsx("div",{style:{minWidth:0,overflow:"hidden"},children:a.jsx(S,{weight:"bold",size:"3",tone:"default",children:a.jsx("span",{className:"task-row__title",children:a.jsx("span",{className:"task-row__titleText",children:n.name})})})}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.description}),a.jsxs("div",{style:{fontSize:12},className:"text--tone-muted",children:[n.assigneeActor?`Assigned: @${n.assigneeActor.slug}`:"unassigned"," - ",`Created by @${n.createdByActor.slug}`]})]})}const MD=n=>[...n].sort((t,i)=>{const l=new Date(t.updatedAt).getTime(),c=new Date(i.updatedAt).getTime();return l-c}),ID=n=>{const[t,i]=d.useState(!1),[l,c]=d.useState(null),[u,h]=d.useState(!1),[m,p]=d.useState(null),[y,v]=d.useState(!1),[b,x]=d.useState(null),[_,k]=d.useState(null),[T,w]=d.useState([]),E=d.useCallback(async()=>{i(!0),c(null);try{const z=await Bn.ThreadsController_getThread({id:n});k(z||null)}catch(z){c(z instanceof Error?z.message:"Failed to load thread")}finally{i(!1)}},[n]),R=d.useCallback(async()=>{h(!0),p(null);try{const z=await Bn.ThreadsController_listMessages({id:n});w(MD(z.items))}catch(z){p(z instanceof Error?z.message:"Failed to load messages")}finally{h(!1)}},[n]),D=d.useCallback(async z=>{v(!0),x(null);let A=null;try{A=await Bn.ThreadsController_createMessage({id:n,body:{content:z}})}catch(C){x(C instanceof Error?C.message:"Failed to send message")}finally{v(!1)}return A},[n]),O=d.useCallback(async z=>{await Bn.ThreadsController_deleteThread({id:z}),k(null)},[]);return{thread:_,messages:T,isLoading:t,error:l,chatIsLoading:u,chatError:m,chatIsSending:y,chatSendError:b,loadThread:E,loadMessages:R,sendMessage:D,deleteThread:O,setMessages:w,setThread:k}},Cx={HUMAN:"human",AGENT:"agent"},qD=va("/threads"),UD=n=>{if(n){if(n.type===xc.HUMAN)return{...n,type:Cx.HUMAN};if(n.type===xc.AGENT)return{...n,type:Cx.AGENT}}},BD=n=>{const[t,i]=d.useState(null),[l,c]=d.useState(!1),[u,h]=d.useState(null),[m,p]=d.useState(null),y=d.useRef(null),v=d.useRef(null),b=d.useCallback(()=>{y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{h(null),y.current=null},3e3)},[]),x=d.useCallback(_=>{v.current=_},[]);return d.useEffect(()=>{const _=$n(qD,{transports:["websocket","polling"],withCredentials:!0});return _.on("connect",()=>{_.emit("threads.subscribe",{threadId:n},k=>{k.ok?c(!0):(console.error("Failed to subscribe to thread room",{threadId:n,ack:k}),c(!1))})}),_.on("connect_error",k=>{console.error("Thread websocket connect_error",{threadId:n,message:k.message})}),_.on("disconnect",()=>{c(!1),y.current&&(clearTimeout(y.current),y.current=null),h(null),p(null)}),_.on(Fr.MESSAGE_CREATED,k=>{if(k.payload.threadId!==n)return;y.current&&(clearTimeout(y.current),y.current=null),h(null),p(E=>E&&(E.actorId===k.payload.createdByActorId?null:E));const T=UD(k.payload.createdByActor),w={...k.payload,createdByActor:T};v.current&&v.current(w)}),_.on(Fr.AGENT_ACTIVITY,k=>{k.payload.threadId===n&&(h(k.payload.kind),b())}),_.on(Fr.AGENT_RESPONSE_DELTA,k=>{k.payload.threadId===n&&p(T=>!T||T.streamId!==k.payload.streamId?{streamId:k.payload.streamId,actorId:k.actor.id,content:k.payload.delta}:{...T,content:`${T.content}${k.payload.delta}`})}),i(_),()=>{_.emit("threads.unsubscribe",{threadId:n}),y.current&&(clearTimeout(y.current),y.current=null),p(null),_.close()}},[n,b]),{socket:t,isConnected:l,agentActivity:u,agentResponseStream:m,onMessageCreated:x}},$D=n=>[...n].sort((t,i)=>{const l=new Date(t.updatedAt).getTime(),c=new Date(i.updatedAt).getTime();return l-c}),PD=n=>{const{messages:t,isLoading:i,error:l,chatIsLoading:c,chatError:u,chatIsSending:h,chatSendError:m,loadThread:p,loadMessages:y,sendMessage:v,setMessages:b}=ID(n),{agentActivity:x,agentResponseStream:_,onMessageCreated:k}=BD(n);return d.useEffect(()=>{p(),y()},[p,y]),d.useEffect(()=>{k(T=>{b(w=>$D([...w.filter(E=>E.id!==T.id),T]))})},[k,b]),{isLoading:i,error:l,chatIsLoading:c,chatError:u,chatIsSending:h,chatSendError:m,messages:t,agentActivity:x,agentResponseStream:_,sendMessage:v}};function tS({threadId:n}){const t=De(),[i,l,c]=ni({key:`thread-chat-draft-${n}`,defaultValue:{content:""}}),{content:u}=i,h=d.useRef(null),m=d.useRef(null),{user:p}=un(),{readiness:y,isReady:v,isLoading:b}=si(),{messages:x,agentActivity:_,agentResponseStream:k,sendMessage:T,chatIsSending:w,chatIsLoading:E,chatError:R,chatSendError:D}=PD(n);d.useEffect(()=>{h.current?.scrollIntoView({behavior:"smooth"})},[x,_,k?.content]),d.useEffect(()=>{E||m.current?.focus()},[E,n]);const O=async A=>{if(A.preventDefault(),!(!u.trim()||w))try{await T(u),c(),requestAnimationFrame(()=>{m.current?.focus()})}catch(C){console.error("Failed to send message:",C)}},z=A=>{const C=new Date(A);return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(C)};return E?a.jsx("div",{className:"thread-chat",children:a.jsx(S,{size:"2",tone:"muted",children:"Loading messages..."})}):a.jsxs("div",{className:"thread-chat",children:[a.jsxs("div",{className:"thread-chat__messages",children:[R&&a.jsx("div",{className:"thread-chat__status thread-chat__status--error",children:a.jsx(S,{size:"2",children:R})}),x.length===0?a.jsx("div",{className:"thread-chat__empty-state",children:a.jsx(S,{size:"2",tone:"muted",children:"No messages yet. Start the conversation."})}):x.map(A=>{const C=A.createdByActor,L=!!(p?.actorId&&p.actorId===A.createdByActorId),P=C?.displayName||"Anonymous",Y=C?.slug;return a.jsxs("div",{className:`thread-chat__message ${L?"thread-chat__message--mine":""}`,children:[a.jsxs("div",{className:"thread-chat__message-header",children:[a.jsxs("div",{className:"thread-chat__author",children:[a.jsx(He,{name:P,src:C?.avatarUrl||void 0,size:"xs"}),a.jsx(S,{size:"1",weight:"semibold",children:P}),Y&&a.jsxs(S,{size:"1",tone:"muted",children:["@",Y]})]}),a.jsx(S,{size:"1",tone:"muted",children:z(A.createdAt)})]}),a.jsx("div",{className:"thread-chat__message-content",children:a.jsx(Fh,{children:A.content})})]},A.id)}),k&&a.jsxs("div",{className:"thread-chat__message thread-chat__message--streaming",role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"thread-chat__message-header",children:[a.jsxs("div",{className:"thread-chat__author",children:[a.jsx(He,{name:"Assistant",size:"xs"}),a.jsx(S,{size:"1",weight:"semibold",children:"Assistant"})]}),a.jsx(S,{size:"1",tone:"muted",children:"typing..."})]}),a.jsx("div",{className:"thread-chat__message-content",children:a.jsx(Fh,{children:k.content})})]}),a.jsx("div",{ref:h})]}),v&&_&&a.jsx("div",{className:"thread-chat__activity",role:"status","aria-live":"polite",children:a.jsx(S,{size:"1",tone:"muted",children:_==="thinking"?"Assistant is thinking...":"Assistant is calling a tool..."})}),!b&&y&&!y.isReady?a.jsx("div",{className:"thread-chat__setup-callout",children:a.jsx(Oc,{title:y.title,description:y.description,ctaLabel:y.ctaLabel,onOpenSettings:()=>t("/settings/models")})}):a.jsxs("form",{className:"thread-chat__input-form",onSubmit:O,children:[a.jsxs("div",{className:"thread-chat__composer-row",children:[a.jsx("textarea",{ref:m,className:"thread-chat__input",value:u,onChange:A=>l({...i,content:A.target.value}),placeholder:"Write a message to this thread...",rows:3,disabled:w||b,onKeyDown:A=>{A.key==="Enter"&&!A.shiftKey&&(A.preventDefault(),O(A))}}),a.jsx(ce,{type:"submit",variant:"secondary",className:"thread-chat__send-btn",disabled:!u.trim()||w||b,children:w?"sending...":"send"})]}),D&&a.jsx("div",{className:"thread-chat__status thread-chat__status--error",children:a.jsx(S,{size:"1",children:D})})]})]})}const HD=[{path:"/dashboard",label:"Dashboard",icon:ff},{path:"/tasks",label:"Tasks",icon:D1},{path:"/context",label:"Context",icon:pf}];function GD(n){return HD.map(t=>({...t,path:`/threads/${n}${t.path}`}))}const VD=va("/threads"),FD=va("/tasks"),YD=[Se.DONE,Se.FOR_REVIEW,Se.IN_PROGRESS,Se.NOT_STARTED],nS=n=>{const t=n.parentTaskId,i=t&&typeof t=="string"?n.tasks.find(u=>u.id===t):null,l=[];i&&l.push({status:"parent",label:"Parent Task",tasks:[i]});const c={[Se.DONE]:[],[Se.FOR_REVIEW]:[],[Se.IN_PROGRESS]:[],[Se.NOT_STARTED]:[]};return n.tasks.forEach(u=>{if(t&&u.id===t)return;const h=u.status;c[h]&&c[h].push(u)}),YD.forEach(u=>{c[u].length>0&&l.push({status:u,label:Jn[u].label,tasks:c[u]})}),l},sS=n=>{const t=[{id:n.stateContextBlockId,title:"Thread state memory",isStateMemory:!0}];return n.referencedContextBlocks.forEach(i=>{i.id!==n.stateContextBlockId&&t.push({id:i.id,title:i.title,isStateMemory:!1})}),t};function rc(){const{id:n}=Jt(),t=De(),{setSectionTitle:i,getThread:l,deleteThread:c}=xl(),u=Dt(),[h,m]=d.useState(null),[p,y]=d.useState(!0),[v,b]=d.useState(null),x=d.useRef(new Set),{setNavItems:_}=xl();vt(h?{thread:{title:h.title}}:void 0);const k=d.useCallback(async()=>{if(n)try{const w=await l(n);m(w),b(null)}catch(w){b(w instanceof Error?w.message:"Failed to load thread")}},[n,l]);if(d.useEffect(()=>{x.current=new Set(h?.tasks.map(w=>w.id)??[])},[h]),d.useEffect(()=>{if(!n)return;_(GD(n)),(async()=>(y(!0),await k(),y(!1)))()},[n,k,_]),d.useEffect(()=>{if(!n)return;const w=$n(VD,{transports:["websocket","polling"],withCredentials:!0});w.on("connect",()=>{w.emit("threads.subscribe",{threadId:n}),k()}),w.on(Fr.THREAD_UPDATED,D=>{D.payload.id===n&&k()}),w.on(Fr.THREAD_TITLE_UPDATED,D=>{D.payload.threadId===n&&k()});const E=$n(FD,{transports:["websocket","polling"],withCredentials:!0});E.on("connect",()=>{E.emit("tasks.subscribe",{}),k()});const R=D=>{x.current.has(D)&&k()};return E.on(_n.TASK_UPDATED,D=>{R(D.payload.id)}),E.on(_n.TASK_STATUS_CHANGED,D=>{R(D.payload.id)}),E.on(_n.TASK_ASSIGNED,D=>{R(D.payload.id)}),E.on(_n.TASK_DELETED,D=>{R(D.payload.taskId)}),()=>{w.emit("threads.unsubscribe",{threadId:n}),w.close(),E.emit("tasks.unsubscribe",{}),E.close()}},[n,k]),d.useEffect(()=>{if(!h){i("Thread");return}i(h.title)},[h,i]),p)return a.jsx("div",{className:"thread-detail-page",children:a.jsx(ee,{spacing:"4",align:"center",children:a.jsx(S,{size:"3",tone:"muted",children:"Loading..."})})});if(v||!h)return a.jsx("div",{className:"thread-detail-page",children:a.jsxs(ee,{spacing:"4",align:"center",children:[a.jsx(S,{size:"3",tone:"muted",children:v||"Thread not found"}),a.jsx(ce,{variant:"secondary",onClick:()=>t("/threads"),children:"Back to threads"})]})});const T=async()=>{await c(h.id),t("/threads")};return u?a.jsx(KD,{thread:h,onDelete:T}):a.jsx(XD,{thread:h,onDelete:T})}function aS({label:n}){return a.jsxs("span",{className:"thread-detail-page__model",title:"Model answering in this thread",children:[a.jsx($b,{size:14,strokeWidth:1.8,"aria-hidden":"true"}),a.jsx(S,{size:"1",tone:"muted",children:n})]})}function KD({thread:n,onDelete:t}){const{conversationModel:i}=si(),[l,c]=d.useState(!0),u=nS(n),h=sS(n);return a.jsxs("div",{className:"thread-detail-page thread-detail-page--desktop",children:[a.jsx("div",{className:"thread-detail-page__main",children:a.jsxs("div",{className:"thread-detail-page__content",children:[a.jsx("div",{className:"thread-detail-page__header",children:a.jsx("div",{className:"thread-detail-page__header-top",children:a.jsxs("div",{children:[a.jsx(S,{size:"5",weight:"bold",children:n.title}),a.jsxs("div",{className:"thread-detail-page__meta-row",children:[a.jsxs(Sn,{color:"gray",children:["#",n.id.slice(0,6)]}),a.jsxs(S,{size:"1",tone:"muted",children:[n.participants.length," participants"]}),i&&a.jsx(aS,{label:`${i.modelId} via ${i.providerName}`})]})]})})}),a.jsx("div",{className:"thread-detail-page__chat",children:a.jsx(tS,{threadId:n.id})})]})}),a.jsxs("div",{className:`thread-detail-page__sidebar ${l?"":"thread-detail-page__sidebar--collapsed"}`,children:[l&&a.jsxs("div",{className:"thread-detail-page__sidebar-scroll",children:[n.participants.length>0&&a.jsxs("div",{className:"thread-detail-page__sidebar-section",children:[a.jsxs(S,{size:"2",weight:"semibold",className:"thread-detail-page__sidebar-header",children:["Participants (",n.participants.length,")"]}),a.jsx("div",{className:"thread-detail-page__participants",children:n.participants.map(m=>a.jsxs("div",{className:"thread-detail-page__participant",children:[a.jsx(He,{name:m.displayName,size:"sm",src:m.avatarUrl||void 0}),a.jsxs("div",{className:"thread-detail-page__participant-text",children:[a.jsx(S,{size:"2",weight:"medium",children:m.displayName}),a.jsxs(S,{size:"1",tone:"muted",children:["@",m.slug]})]})]},m.id))})]}),u.map(m=>a.jsxs("div",{className:"thread-detail-page__sidebar-section",children:[a.jsxs(S,{size:"2",weight:"semibold",className:"thread-detail-page__sidebar-header",children:[m.label," (",m.tasks.length,")"]}),a.jsx("div",{className:"thread-detail-page__sidebar-content",children:m.tasks.map(p=>a.jsx(zD,{task:p},p.id))})]},m.status)),h.length>0&&a.jsxs("div",{className:"thread-detail-page__sidebar-section",children:[a.jsxs(S,{size:"2",weight:"semibold",className:"thread-detail-page__sidebar-header",children:["Context (",h.length,")"]}),a.jsx("div",{className:"thread-detail-page__sidebar-content",children:h.map(m=>a.jsx(zf,{contextBlock:m,isStateMemory:m.isStateMemory},`${m.id}-${m.isStateMemory?"state":"reference"}`))})]}),n.tasks.length===0&&h.length===0&&a.jsx("div",{className:"thread-detail-page__sidebar-empty",children:a.jsx(S,{size:"2",tone:"muted",children:"No context or tasks attached"})}),a.jsx("div",{className:"thread-detail-page__sidebar-section thread-detail-page__sidebar-delete",children:a.jsx("div",{className:"thread-detail-page__sidebar-content thread-detail-page__sidebar-content--centered",children:a.jsx(ei,{className:"thread-detail-page__delete-actions",onDelete:t,size:"md",deleteLabel:"Delete thread",confirmLabel:"Delete forever"})})})]}),a.jsx("button",{className:"thread-detail-page__sidebar-toggle",onClick:()=>c(m=>!m),"aria-label":l?"Collapse details panel":"Expand details panel",children:l?"→":"←"})]})]})}function XD({thread:n,onDelete:t}){const{conversationModel:i}=si(),l=De(),c=nS(n),u=sS(n),[h,m]=d.useState("chat"),[p,y]=d.useState(!1);return a.jsxs("div",{className:"thread-detail-page thread-detail-page--mobile",children:[a.jsx(QD,{isOpen:p,onClose:()=>y(!1)}),a.jsxs("header",{className:"thread-detail-page__mobile-header",children:[a.jsx("button",{className:"thread-detail-page__mobile-burger",onClick:()=>y(!0),"aria-label":"Open menu",children:"☰"}),a.jsxs("div",{className:"thread-detail-page__mobile-header-content",children:[a.jsx(S,{size:"2",weight:"semibold",children:n.title}),a.jsxs("div",{className:"thread-detail-page__mobile-meta",children:[a.jsxs(S,{size:"1",tone:"muted",children:["#",n.id.slice(0,6)," · ",n.participants.length," participants"]}),i&&a.jsx(aS,{label:i.modelId})]})]})]}),a.jsxs("div",{className:"thread-detail-page__mobile-tabs",role:"tablist","aria-label":"Thread mobile views",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":h==="chat",className:`thread-detail-page__mobile-tab ${h==="chat"?"thread-detail-page__mobile-tab--active":""}`,onClick:()=>m("chat"),children:"Chat"}),a.jsx("button",{type:"button",role:"tab","aria-selected":h==="tasks",className:`thread-detail-page__mobile-tab ${h==="tasks"?"thread-detail-page__mobile-tab--active":""}`,onClick:()=>m("tasks"),children:"Tasks"}),a.jsx("button",{type:"button",role:"tab","aria-selected":h==="context",className:`thread-detail-page__mobile-tab ${h==="context"?"thread-detail-page__mobile-tab--active":""}`,onClick:()=>m("context"),children:"Context"}),a.jsx("button",{type:"button",role:"tab","aria-selected":h==="more",className:`thread-detail-page__mobile-tab ${h==="more"?"thread-detail-page__mobile-tab--active":""}`,onClick:()=>m("more"),children:"More"})]}),a.jsxs("div",{className:"thread-detail-page__mobile-content",children:[h==="chat"&&a.jsx("div",{className:"thread-detail-page__mobile-chat-container",children:a.jsx(tS,{threadId:n.id})}),h==="tasks"&&a.jsx("div",{className:"thread-detail-page__mobile-scrollable",children:c.length>0?c.map(v=>a.jsx("div",{className:"thread-detail-page__mobile-section",children:a.jsx(xe,{title:v.label,children:v.tasks.map(b=>a.jsx(LD,{task:b,onClick:()=>l(`/tasks/task/${b.id}`)},b.id))})},v.status)):a.jsx("div",{className:"thread-detail-page__mobile-empty",children:a.jsx(S,{size:"2",tone:"muted",children:"No tasks attached"})})}),h==="context"&&a.jsx("div",{className:"thread-detail-page__mobile-scrollable",children:u.length>0?a.jsx("div",{className:"thread-detail-page__mobile-section",children:a.jsx("div",{className:"thread-detail-page__mobile-list",children:u.map(v=>a.jsx(zf,{contextBlock:v,isStateMemory:v.isStateMemory},`${v.id}-${v.isStateMemory?"state":"reference"}`))})}):a.jsx("div",{className:"thread-detail-page__mobile-empty",children:a.jsx(S,{size:"2",tone:"muted",children:"No context blocks attached"})})}),h==="more"&&a.jsx("div",{className:"thread-detail-page__mobile-scrollable",children:a.jsx("div",{className:"thread-detail-page__mobile-section",children:a.jsxs(ee,{spacing:"4",children:[a.jsxs(ee,{spacing:"2",children:[a.jsx(S,{size:"2",weight:"semibold",children:"Thread Settings"}),a.jsx(S,{size:"2",tone:"muted",children:"Manage this thread's settings and data."})]}),a.jsx("div",{className:"thread-detail-page__mobile-settings-section",children:a.jsxs(ee,{spacing:"3",children:[a.jsx(S,{size:"2",weight:"semibold",children:"Attach Items (Coming Soon)"}),a.jsxs(ee,{spacing:"2",children:[a.jsx(ce,{variant:"secondary",disabled:!0,className:"thread-detail-page__mobile-settings-button",children:"Add Task"}),a.jsx(ce,{variant:"secondary",disabled:!0,className:"thread-detail-page__mobile-settings-button",children:"Add Context Block"})]})]})}),a.jsx("div",{className:"thread-detail-page__mobile-settings-section",children:a.jsxs(ee,{spacing:"3",children:[a.jsx(S,{size:"2",weight:"semibold",children:"Danger Zone"}),a.jsx(ei,{className:"thread-detail-page__mobile-delete-action",onDelete:t,size:"md",deleteLabel:"Delete Thread",confirmLabel:"Delete Forever"})]})})]})})})]})]})}function QD({isOpen:n,onClose:t}){const i=Mt();return a.jsxs(a.Fragment,{children:[n&&a.jsx("div",{className:"thread-detail-page__mobile-drawer-overlay",onClick:t}),a.jsxs("aside",{className:`thread-detail-page__mobile-drawer ${n?"thread-detail-page__mobile-drawer--open":""}`,children:[a.jsxs("div",{className:"thread-detail-page__mobile-drawer-header",children:[a.jsx(S,{size:"4",weight:"bold",children:"taico"}),a.jsx("button",{className:"thread-detail-page__mobile-drawer-close",onClick:t,"aria-label":"Close menu",children:"✕"})]}),a.jsx("nav",{className:"thread-detail-page__mobile-drawer-nav",children:Vr.map(l=>{const c=i.pathname===l.path||i.pathname.startsWith(l.path+"/");return a.jsxs(qs,{to:l.path,className:`thread-detail-page__mobile-drawer-item ${c?"thread-detail-page__mobile-drawer-item--active":""}`,onClick:t,children:[a.jsx(jl,{icon:l.icon,className:"thread-detail-page__mobile-drawer-icon"}),a.jsx("span",{className:"thread-detail-page__mobile-drawer-label",children:l.label})]},l.path)})})]})]})}function ZD(){return a.jsx(CD,{children:a.jsx(ps,{children:a.jsxs(je,{element:a.jsx(OD,{}),children:[a.jsx(je,{index:!0,element:a.jsx(AD,{})}),a.jsx(je,{path:"/:id",element:a.jsx(rc,{})}),a.jsx(je,{path:"/:id/dashboard",element:a.jsx(rc,{})}),a.jsx(je,{path:"/:id/tasks",element:a.jsx(rc,{})}),a.jsx(je,{path:"/:id/context",element:a.jsx(rc,{})})]})})})}const WD=window.location.origin,rS=new ns({baseUrl:WD,credentials:"include"}),us=rS.tools,JD=rS.authorizationJourneys,eO="http://localhost:3000/mcp",tO="npx",nO=["-y","@modelcontextprotocol/server-memory"],sO=n=>n.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"new-tool",aO=(n,t)=>{const i=new Set(t.map(u=>u.providedId));if(!i.has(n))return n;let l=2,c=`${n}-${l}`;for(;i.has(c);)l+=1,c=`${n}-${l}`;return c},rO=()=>{const[n,t]=d.useState(!1),[i,l]=d.useState(null),[c,u]=d.useState([]);d.useEffect(()=>{m()},[]);const h=w=>[...w].sort((E,R)=>{const D=new Date(E.updatedAt).getTime();return new Date(R.updatedAt).getTime()-D}),m=async()=>{t(!0),l(null);try{const w=await us.McpRegistryController_listServers({});u(h(w.items||[]))}catch(w){l(w instanceof Error?w.message:"Failed to load tools")}finally{t(!1)}},p=d.useCallback(async w=>{t(!0),l(null);try{return await us.McpRegistryController_getServer({serverId:w})}catch(E){return l(E instanceof Error?E.message:"Failed to load tool details"),null}finally{t(!1)}},[]),y=d.useCallback(async w=>{try{return await us.McpRegistryController_listScopes({serverId:w})}catch(E){return console.error("Failed to load scopes:",E),[]}},[]),v=d.useCallback(async w=>{console.log(`loading clients for server ${w}`);try{const E=await us.McpRegistryController_listConnections({serverId:w});return console.log(`clients: ${E}`),E}catch(E){return console.error("Failed to load clients:",E),[]}},[]),b=d.useCallback(async w=>{console.log(`loading authorizations for server ${w}`);try{const E=await JD.AuthJourneysController_getAuthJourneys({serverId:w});return console.log("authorizations:",E),E}catch(E){return console.error("Failed to load authorizations:",E),[]}},[]),x=d.useCallback(async w=>{t(!0),l(null);try{return await us.McpRegistryController_getConnection({connectionId:w})}catch(E){return l(E instanceof Error?E.message:"Failed to load client details"),null}finally{t(!1)}},[]),_=async w=>{t(!0),l(null);try{const E=sO(w.name),D={providedId:aO(E,c),name:w.name,description:`New ${w.type.toUpperCase()} MCP server`,type:w.type,...w.type==="http"?{url:eO}:{cmd:tO,args:[...nO]}},O=await us.McpRegistryController_createServer({body:D});return u(z=>h([...z,O])),O}catch(E){throw l(E instanceof Error?E.message:"Failed to create tool"),E}finally{t(!1)}},k=d.useCallback(async(w,E)=>{t(!0),l(null);try{const R=await us.McpRegistryController_updateServer({serverId:w,body:E});return u(D=>{const O=D.map(z=>z.id===w?R:z);return h(O)}),R}catch(R){return l(R instanceof Error?R.message:"Failed to update tool"),null}finally{t(!1)}},[]),T=d.useCallback(async w=>{t(!0),l(null);try{return await us.McpRegistryController_deleteServer({serverId:w}),u(E=>E.filter(R=>R.id!==w)),!0}catch(E){return l(E instanceof Error?E.message:"Failed to delete tool"),!1}finally{t(!1)}},[]);return{isLoading:n,error:i,tools:c,loadTools:m,loadToolDetails:p,loadToolScopes:y,loadToolClients:v,loadToolAuthorizations:b,loadClientDetails:x,createTool:_,updateTool:k,deleteTool:T}},iS=d.createContext(null);function iO({children:n}){const{tools:t,isLoading:i,error:l,loadToolDetails:c,loadToolScopes:u,loadToolClients:h,loadToolAuthorizations:m,loadClientDetails:p,createTool:y,updateTool:v,deleteTool:b}=rO(),[x,_]=d.useState(""),k=d.useMemo(()=>({tools:t,isLoading:i,error:l,sectionTitle:x,setSectionTitle:_,loadToolDetails:c,loadToolScopes:u,loadToolClients:h,loadToolAuthorizations:m,loadClientDetails:p,createTool:y,updateTool:v,deleteTool:b}),[t,i,l,x,_,c,u,h,m,p,y,v,b]);return a.jsx(iS.Provider,{value:k,children:n})}function Cl(){const n=d.useContext(iS);if(!n)throw new Error("useToolsCtx must be used within <ToolsProvider>");return n}function lO({onCancel:n,onSave:t,error:i}){const[l,c]=d.useState(""),[u,h]=d.useState("http"),m=d.useRef(null);d.useEffect(()=>{m.current?.focus()},[]);const p=d.useMemo(()=>l.trim().length>0,[l]),y=async()=>p?t({name:l.trim(),type:u}):!1;return a.jsxs(xt,{title:"Create a Tool",onCancel:n,onSave:y,children:[a.jsx("div",{className:"new-tool-pop__group",children:a.jsx("input",{className:"new-tool-pop__input",ref:m,placeholder:"Tool name",value:l,onChange:v=>c(v.target.value)})}),i?a.jsx("p",{className:"new-tool-pop__error",children:i}):null,a.jsxs("div",{className:"new-tool-pop__group",children:[a.jsx("label",{className:"new-tool-pop__label",htmlFor:"new-tool-transport-type",children:"Transport type"}),a.jsxs("select",{id:"new-tool-transport-type",className:"new-tool-pop__select",value:u,onChange:v=>h(v.target.value),children:[a.jsx("option",{value:"http",children:"HTTP"}),a.jsx("option",{value:"stdio",children:"STDIO"})]})]})]})}function oO(){const{tools:n,setSectionTitle:t,isLoading:i,error:l,createTool:c}=Cl(),u=De(),h=Dt(),[m,p]=d.useState(!1),[y,v]=d.useState(null);if(vt(),d.useEffect(()=>{t("All Tools")},[t]),i&&n.length===0)return a.jsx(xe,{children:a.jsx(_e,{leading:a.jsx(He,{name:"...",size:"lg"}),children:a.jsx(S,{tone:"muted",children:"Loading tools..."})})});if(l&&n.length===0)return a.jsx(xe,{children:a.jsx(_e,{leading:a.jsx(He,{name:"!",size:"lg"}),children:a.jsxs(S,{tone:"muted",children:["Error: ",l]})})});const b=()=>{p(!1),v(null)},x=async({name:_,type:k})=>{v(null);try{const T=await c({name:_,type:k});return T?(u(`/tools/tool/${T.id}`),!0):!1}catch(T){const w=T?.body?.detail??T?.message??"Failed to create tool";return v(w),!1}};return a.jsxs(a.Fragment,{children:[a.jsx(xe,{children:n.length===0?a.jsx(_e,{leading:a.jsx(He,{name:"?",size:"lg"}),children:a.jsx(S,{tone:"muted",children:"No tools found"})}):n.map(_=>a.jsx(cO,{tool:_,onClick:()=>u(`/tools/tool/${_.id}`)},_.id))}),a.jsx("button",{className:`tools-fab ${h?"tools-fab--desktop":""}`,type:"button",onClick:()=>p(!0),"aria-label":"Create new tool",children:h?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"tools-fab__plus",children:"+"}),a.jsx("span",{className:"tools-fab__label",children:"New tool"})]}):"+"}),m?a.jsx(lO,{onCancel:b,onSave:x,error:y}):null]})}function cO({tool:n,onClick:t}){const i=[{label:"MCP Server",color:"blue"}];return n.type==="http"?i.push({label:"remote",color:"green"}):i.push({label:"stdio",color:"orange"}),a.jsxs(_e,{leading:a.jsx(He,{name:n.name,size:"lg"}),topRight:Lt(n.updatedAt),tags:i,onClick:t,children:[a.jsx(S,{className:"pre",style:"mono",tone:"muted",children:n.providedId}),a.jsx(S,{weight:"bold",size:"3",tone:"default",children:n.name}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.jsx(S,{tone:"muted",size:"2",children:n.description||"No description"})})]})}function uO(){const n=Dt(),{sectionTitle:t}=Cl(),i=[];return a.jsx("div",{style:{minHeight:0},children:n?a.jsx(Jr,{sectionTitle:t,children:a.jsx(Qt,{})}):a.jsx(Qa,{appTitle:"Tools",sectionTitle:t,navItems:i,children:a.jsx(Qt,{})})})}function dO({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState(n),u=d.useRef(null);d.useEffect(()=>{u.current?.focus()},[]);async function h(){return l.trim()?i({name:l.trim()}):!1}return a.jsx(xt,{title:"Edit Tool Name",onCancel:t,onSave:h,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-name-pop__input-wrapper",children:a.jsx("input",{type:"text",className:"edit-tool-name-pop__input",ref:u,placeholder:"Enter tool name...",value:l,onChange:m=>c(m.target.value)})})})})}const Nx=n=>{n&&(n.style.height="auto",n.style.height=`${n.scrollHeight}px`)};function hO({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState(n),u=d.useRef(null);d.useEffect(()=>{u.current?.focus()},[]),d.useEffect(()=>{Nx(u.current)},[l]);function h(p){c(p.target.value),Nx(p.target)}async function m(){return i({description:l})}return a.jsx(xt,{title:"Edit Tool Description",onCancel:t,onSave:m,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-description-pop__input-wrapper",children:a.jsx("textarea",{className:"edit-tool-description-pop__input",ref:u,placeholder:"Enter description...",value:l,onChange:h})})})})}function fO({initialValue:n,onCancel:t,onSave:i}){const[l,c]=d.useState(n),u=d.useRef(null);d.useEffect(()=>{u.current?.focus()},[]);async function h(){return l.trim()?i({url:l.trim()}):!1}return a.jsx(xt,{title:"Edit Server URL",onCancel:t,onSave:h,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-url-pop__input-wrapper",children:a.jsx("input",{type:"url",className:"edit-tool-url-pop__input",ref:u,placeholder:"https://example.com/mcp",value:l,onChange:m=>c(m.target.value)})})})})}function pO({initialCmd:n,initialArgs:t,onCancel:i,onSave:l}){const[c,u]=d.useState(n),[h,m]=d.useState(t.join(`
|
|
115
|
+
`)),p=d.useRef(null);d.useEffect(()=>{p.current?.focus()},[]);async function y(){if(!c.trim())return!1;const v=h.split(`
|
|
116
|
+
`).map(b=>b.trim()).filter(b=>b.length>0);return l({cmd:c.trim(),args:v})}return a.jsx(xt,{title:"Edit Command",onCancel:i,onSave:y,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-command-pop__wrapper",children:a.jsxs(ee,{spacing:"3",children:[a.jsxs("div",{children:[a.jsx(S,{size:"2",weight:"medium",children:"Command"}),a.jsx("input",{type:"text",className:"edit-tool-command-pop__input",ref:p,placeholder:"npx",value:c,onChange:v=>u(v.target.value)})]}),a.jsxs("div",{children:[a.jsx(S,{size:"2",weight:"medium",children:"Arguments (one per line)"}),a.jsx("textarea",{className:"edit-tool-command-pop__textarea",placeholder:`-y
|
|
117
|
+
@modelcontextprotocol/server-memory`,value:h,onChange:v=>m(v.target.value),rows:5})]})]})})})})}function mO({toolId:n,initialScopes:t,onCancel:i,onSave:l}){const[c,u]=d.useState(t),[h,m]=d.useState(""),[p,y]=d.useState(""),v=()=>{if(!h.trim()||!p.trim())return;const _={id:h.trim(),description:p.trim(),serverId:n,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()};u([...c,_]),m(""),y("")},b=_=>{u(c.filter(k=>k.id!==_))};async function x(){const _=new Set(t.map(E=>E.id)),k=new Set(c.map(E=>E.id)),T=c.filter(E=>!_.has(E.id)).map(E=>({id:E.id,description:E.description})),w=t.filter(E=>!k.has(E.id)).map(E=>E.id);return l({scopesToCreate:T,scopesToDelete:w})}return a.jsx(xt,{title:"Edit Scopes",onCancel:i,onSave:x,children:a.jsx(a.Fragment,{children:a.jsx("div",{className:"edit-tool-scopes-pop__wrapper",children:a.jsxs(ee,{spacing:"3",children:[a.jsxs("div",{children:[a.jsx(S,{size:"2",weight:"medium",children:"Current Scopes"}),c.length===0?a.jsx(S,{size:"2",tone:"muted",children:"No scopes configured"}):a.jsx("div",{className:"edit-tool-scopes-pop__scopes-list",children:c.map(_=>a.jsxs("div",{className:"edit-tool-scopes-pop__scope-item",children:[a.jsxs("div",{className:"edit-tool-scopes-pop__scope-info",children:[a.jsx(S,{size:"2",weight:"medium",style:"mono",children:_.id}),a.jsx(S,{size:"1",tone:"muted",children:_.description})]}),a.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>b(_.id),children:"Remove"})]},_.id))})]}),a.jsxs("div",{children:[a.jsx(S,{size:"2",weight:"medium",children:"Add New Scope"}),a.jsxs("div",{className:"edit-tool-scopes-pop__new-scope",children:[a.jsx("input",{type:"text",className:"edit-tool-scopes-pop__input",placeholder:"Scope ID (e.g., tool:read)",value:h,onChange:_=>m(_.target.value)}),a.jsx("input",{type:"text",className:"edit-tool-scopes-pop__input",placeholder:"Description",value:p,onChange:_=>y(_.target.value)}),a.jsx(ce,{size:"sm",onClick:v,disabled:!h.trim()||!p.trim(),children:"Add Scope"})]})]})]})})})})}function gO(n){switch(n){case"AUTHORIZATION_CODE_EXCHANGED":return{color:"green",label:"Active"};case"USER_CONSENT_REJECTED":return{color:"red",label:"Rejected"};case"AUTHORIZATION_CODE_ISSUED":return{color:"blue",label:"Code Issued"};case"mcp_auth_flow_started":return{color:"yellow",label:"Flow Started"};case"mcp_auth_flow_completed":return{color:"blue",label:"MCP Auth Complete"};case"CONNECTIONS_FLOW_STARTED":return{color:"yellow",label:"Connecting"};case"CONNECTIONS_FLOW_COMPLETED":return{color:"blue",label:"Connected"};case"not_started":return{color:"gray",label:"Not Started"};default:return{color:"gray",label:n.replace(/_/g," ").toLowerCase()}}}function yO(){const{toolId:n}=Jt(),t=De(),{tools:i,setSectionTitle:l,loadToolDetails:c,loadToolScopes:u,loadToolClients:h,loadToolAuthorizations:m,updateTool:p,deleteTool:y}=Cl(),{showError:v}=dn(),b=i.find(X=>X.id===n),[x,_]=d.useState(b||null),[k,T]=d.useState([]),[w,E]=d.useState([]),[R,D]=d.useState([]),[O,z]=d.useState(!b),[A,C]=d.useState(!1),[L,P]=d.useState(null),[Y,U]=d.useState(!1),[re,Q]=d.useState(!1),[J,ye]=d.useState(!1),[B,se]=d.useState(!1),[ge,Ee]=d.useState(!1),[Ce,M]=d.useState(!1),H=x?.type==="http",de=x?.type==="stdio",fe=X=>{navigator.clipboard.writeText(X),U(!0),setTimeout(()=>U(!1),1500)},V=d.useRef(b?n??null:null);d.useEffect(()=>{if(!n)return;const X=b;if(X){_(X),V.current=n;return}V.current!==n&&(V.current=n,z(!0),c(n).then(pe=>{_(pe),z(!1)}))},[n,c]),d.useEffect(()=>{x&&n&&(x.type==="http"?(u(n).then(T),m(n).then(D)):(T([]),D([])),h(n).then(E))},[x,n,u,h,m]);const ie=d.useMemo(()=>!x||x.type!=="stdio"?[]:[x.cmd,...x.args??[]].filter(X=>!!X),[x]),te=X=>/^[a-zA-Z0-9._/@:=+-]+$/.test(X)?X:`"${X.replace(/(["\\$`])/g,"\\$1")}"`,be=X=>X.map(pe=>te(pe)).join(" "),Re=async({name:X})=>{if(!x)return!1;try{const pe=await p(x.id,{name:X});return pe?(_(pe),Q(!1),!0):!1}catch(pe){return console.error("Failed to update name:",pe),v(pe),!1}},Ze=async({description:X})=>{if(!x)return!1;try{const pe=await p(x.id,{description:X});return pe?(_(pe),ye(!1),!0):!1}catch(pe){return console.error("Failed to update description:",pe),v(pe),!1}},It=async({url:X})=>{if(!x)return!1;try{const pe=await p(x.id,{url:X});return pe?(_(pe),se(!1),!0):!1}catch(pe){return console.error("Failed to update URL:",pe),v(pe),!1}},et=async({cmd:X,args:pe})=>{if(!x)return!1;try{const Z=await p(x.id,{cmd:X,args:pe});return Z?(_(Z),Ee(!1),!0):!1}catch(Z){return console.error("Failed to update command:",Z),v(Z),!1}},wt=async({scopesToCreate:X,scopesToDelete:pe})=>{if(!x)return!1;try{for(const Te of pe)await us.McpRegistryController_deleteScope({serverId:x.id,scopeId:Te});X.length>0&&await us.McpRegistryController_createScopes({serverId:x.id,body:X});const Z=await u(x.id);return T(Z),M(!1),!0}catch(Z){return console.error("Failed to update scopes:",Z),v(Z),!1}};if(d.useEffect(()=>{const X=x?.url;if(!X){P(null);return}const pe=new AbortController;return(async()=>{try{const Te=new URL(X),tt=new URL(`/.well-known/oauth-protected-resource${Te.pathname}`,Te.origin),ht=await fetch(tt.toString(),{signal:pe.signal});if(!ht.ok){P(null);return}const wn=(await ht.json()).authorization_servers?.[0];if(!wn){P(null);return}const kt=new URL(wn),mt=new URL(`${kt.origin}/.well-known/oauth-authorization-server${kt.pathname}`),ms=await fetch(mt,{signal:pe.signal});if(!ms.ok){P(null);return}const gs=await ms.json();P(gs)}catch(Te){if(console.error(Te),Te.name==="AbortError")return;P(null)}})(),()=>{pe.abort()}},[x?.url]),vt({tool:{name:x?.name}}),d.useEffect(()=>{if(!x){l("Tool");return}l(x.name)},[x,l]),O)return a.jsx("div",{className:"tool-detail-page",children:a.jsx(ee,{spacing:"4",align:"center",children:a.jsx(S,{size:"3",tone:"muted",children:"Loading tool..."})})});if(!x)return a.jsx("div",{className:"tool-detail-page",children:a.jsxs(ee,{spacing:"4",align:"center",children:[a.jsx(S,{size:"3",tone:"muted",children:"Tool not found"}),a.jsx(ce,{variant:"secondary",onClick:()=>t("/tools"),children:"Back to tools"})]})});const ue=[{label:"MCP Server",color:"blue"}];return x.type==="http"?ue.push({label:"remote",color:"green"}):ue.push({label:"stdio",color:"orange"}),a.jsxs("div",{className:"tool-detail-page",children:[a.jsx(xe,{className:"tool-detail-page__section",children:a.jsxs(_e,{leading:a.jsx(He,{name:x.name}),tags:ue,topRight:a.jsx(S,{size:"1",tone:"muted",children:Lt(x.updatedAt)}),children:[a.jsx(S,{as:"span",weight:"normal",tone:"muted",size:"3",children:`${x.providedId} `}),a.jsxs(S,{as:"span",tone:"muted",style:"mono",children:["#",x.id.slice(0,6)]}),a.jsx(S,{children:x.description}),L?a.jsxs(_e,{onClick:()=>C(!A),children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Auth Server Metadata"}),a.jsx(S,{size:"2",tone:"muted",children:A?"(tap to collapse)":"(tap to expand)"})]}),A&&a.jsx("div",{className:"tool-detail-page__metadata",children:a.jsx("pre",{children:JSON.stringify(L,null,2)})})]}):a.jsx(S,{tone:"muted",size:"2",children:"Authorization Server metadata not found"})]})}),a.jsx(xe,{title:"Name",className:"tool-detail-page__section",children:a.jsxs(_e,{onClick:()=>Q(!0),children:[a.jsx(S,{size:"2",children:x.name}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),a.jsx(xe,{title:"Description",className:"tool-detail-page__section",children:a.jsxs(_e,{onClick:()=>ye(!0),children:[a.jsx(S,{size:"2",children:x.description}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),H&&x.url?a.jsx(xe,{title:"Server URL",className:"tool-detail-page__section",children:a.jsxs(_e,{onClick:()=>se(!0),children:[a.jsx(S,{as:"div",size:"2",style:"mono",className:"tool-detail-page__url",children:x.url}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}):null,de&&a.jsx(xe,{title:"Command",className:"tool-detail-page__section",children:a.jsxs(_e,{onClick:()=>Ee(!0),children:[a.jsx(S,{size:"2",style:"mono",children:x.cmd}),x.args&&x.args.length>0&&a.jsxs(S,{size:"2",tone:"muted",style:"mono",children:["Args: ",x.args.join(" ")]}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),H&&x.url&&a.jsxs(xe,{title:"Configure",className:"tool-detail-page__section",children:[a.jsxs(_e,{onClick:()=>fe(`npx @modelcontextprotocol/inspector --transport http --server-url ${x.url}`),children:[a.jsx(S,{weight:"medium",size:"3",children:"Inspector Command"}),a.jsx(S,{size:"2",tone:"muted",children:"Run this command to start the MCP inspector:"}),a.jsxs(S,{as:"div",style:"mono",children:[`npx @modelcontextprotocol/inspector --transport http --server-url ${x.url}`,a.jsx(S,{size:"1",tone:"muted",children:"tap to copy"})]})]}),a.jsxs(_e,{onClick:()=>fe(`codex mcp add ${x.providedId} --url ${x.url}`),children:[a.jsx(S,{weight:"medium",size:"3",children:"Codex"}),a.jsx(S,{size:"2",tone:"muted",children:"Run this command to add this MCP server to Codex:"}),a.jsxs(S,{as:"div",style:"mono",children:[`codex mcp add ${x.providedId} --url ${x.url}`,a.jsx(S,{size:"1",tone:"muted",children:"tap to copy"})]})]}),a.jsxs(_e,{onClick:()=>fe(`claude mcp add ${x.providedId} --transport http ${x.url}`),children:[a.jsx(S,{weight:"medium",size:"3",children:"Claude Code"}),a.jsxs(S,{as:"div",style:"mono",children:[`claude mcp add ${x.providedId} --transport http ${x.url}`,a.jsx(S,{size:"1",tone:"muted",children:"tap to copy"})]})]})]}),de&&ie.length>0&&a.jsxs(xe,{title:"Configure",className:"tool-detail-page__section",children:[a.jsxs(_e,{onClick:()=>fe(be(["npx","@modelcontextprotocol/inspector","--transport","stdio",...ie])),children:[a.jsx(S,{weight:"medium",size:"3",children:"Inspector Command"}),a.jsx(S,{size:"2",tone:"muted",children:"Run this command to start the MCP inspector:"}),a.jsxs(S,{style:"mono",children:[be(["npx","@modelcontextprotocol/inspector","--transport","stdio",...ie]),a.jsx(S,{size:"1",tone:"muted",children:"tap to copy"})]})]}),a.jsxs(_e,{onClick:()=>fe(be(["codex","mcp","add",x.providedId,...ie])),children:[a.jsx(S,{weight:"medium",size:"3",children:"Codex"}),a.jsxs(S,{style:"mono",children:[be(["codex","mcp","add",x.providedId,...ie]),a.jsx(S,{size:"1",tone:"muted",children:"tap to copy"})]})]}),a.jsxs(_e,{onClick:()=>fe(be(["claude","mcp","add",x.providedId,"--",...ie])),children:[a.jsx(S,{weight:"medium",size:"3",children:"Claude Code"}),a.jsxs(S,{style:"mono",children:[be(["claude","mcp","add",x.providedId,"--",...ie]),a.jsx(S,{size:"1",tone:"muted",children:"tap to copy"})]})]})]}),H&&a.jsx(xe,{title:"Scopes",className:"tool-detail-page__section",children:a.jsxs(_e,{onClick:()=>M(!0),children:[k.length>0?a.jsx(ee,{spacing:"1",children:k.map(X=>a.jsxs("div",{children:[a.jsx(S,{size:"2",style:"mono",weight:"medium",children:X.id}),a.jsx(S,{size:"2",tone:"muted",children:X.description})]},X.id))}):a.jsx(S,{tone:"muted",size:"2",children:"No scopes configured"}),a.jsx(S,{size:"1",tone:"muted",children:"tap to edit"})]})}),de&&a.jsx(S,{tone:"muted",size:"2",children:"STDIO servers do not expose OAuth scopes."}),H&&a.jsx(xe,{title:"Authorizations",className:"tool-detail-page__section",children:R.length===0?a.jsx(_e,{children:a.jsx(S,{tone:"muted",size:"2",children:"No active authorizations"})}):[...R].sort((X,pe)=>new Date(pe.updatedAt).getTime()-new Date(X.updatedAt).getTime()).map(X=>{const pe=gO(X.status),Z=Lt(X.updatedAt);return a.jsxs(_e,{children:[a.jsx(S,{weight:"medium",size:"3",children:X.mcpAuthorizationFlow.clientName||"Unknown Client"}),X.actor&&a.jsxs(S,{size:"2",tone:"muted",children:["@",X.actor.slug," updated ",Z]}),a.jsx("div",{style:{marginTop:"4px"},children:a.jsx(Sn,{color:pe.color,children:pe.label})})]},X.id)})}),a.jsx(ei,{className:"tool-detail-page__actions",onDelete:async()=>{await y(x.id)?t("/tools"):v("Failed to delete tool")}}),a.jsx(xe,{className:"tool-detail-page__actions",children:a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t("/tools"),children:"Back to Tools"})}),a.jsx("div",{className:`tool-detail-page__toast ${Y?"tool-detail-page__toast--visible":""}`,children:"Copied!"}),re&&x&&a.jsx(dO,{initialValue:x.name,onCancel:()=>Q(!1),onSave:Re}),J&&x&&a.jsx(hO,{initialValue:x.description,onCancel:()=>ye(!1),onSave:Ze}),B&&x&&H&&x.url&&a.jsx(fO,{initialValue:x.url,onCancel:()=>se(!1),onSave:It}),ge&&x&&de&&a.jsx(pO,{initialCmd:x.cmd||"",initialArgs:x.args||[],onCancel:()=>Ee(!1),onSave:et}),Ce&&x&&H&&a.jsx(mO,{toolId:x.id,initialScopes:k,onCancel:()=>M(!1),onSave:wt})]})}function vO(){const{toolId:n}=Jt(),t=De(),{tools:i,setSectionTitle:l,loadToolDetails:c,loadToolClients:u}=Cl(),h=i.find(_=>_.id===n),[m,p]=d.useState(h||null),[y,v]=d.useState([]),[b,x]=d.useState(!0);return d.useEffect(()=>{!h&&n?c(n).then(p):h&&p(h)},[n,h,c]),d.useEffect(()=>{n&&(x(!0),u(n).then(_=>{const k=[..._].sort((T,w)=>new Date(w.updatedAt).getTime()-new Date(T.updatedAt).getTime());v(k),x(!1)}))},[n,u]),d.useEffect(()=>{l(m?`${m.name} Clients`:"Clients")},[m,l]),b?a.jsx(xe,{children:a.jsx(_e,{leading:a.jsx(He,{name:"...",size:"lg"}),children:a.jsx(S,{tone:"muted",children:"Loading clients..."})})}):y.length===0?a.jsxs("div",{className:"clients-page",children:[a.jsx(xe,{children:a.jsx(_e,{leading:a.jsx(He,{name:"?",size:"lg"}),children:a.jsx(S,{tone:"muted",children:"No clients found for this tool"})})}),a.jsx(xe,{className:"clients-page__actions",children:a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t(`/tools/tool/${n}`),children:"Back to Tool"})})]}):a.jsxs("div",{className:"clients-page",children:[a.jsx(xe,{children:y.map(_=>a.jsx(xO,{client:_,onClick:()=>t(`/tools/tool/${n}/clients/${_.id}`)},_.id))}),a.jsx(xe,{className:"clients-page__actions",children:a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>t(`/tools/tool/${n}`),children:"Back to Tool"})})]})}function xO({client:n,onClick:t}){const i=bO(n);return a.jsxs(_e,{leading:a.jsx(He,{name:n.friendlyName,size:"lg"}),topRight:Lt(n.updatedAt),tags:i,onClick:t,children:[a.jsx(S,{className:"pre",style:"mono",tone:"muted",children:n.clientId}),a.jsx(S,{weight:"bold",size:"3",tone:"default",children:n.friendlyName}),a.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:a.jsx(S,{tone:"muted",size:"2",children:n.authorizeUrl})})]})}function bO(n){const t=[];return n.authorizeUrl&&n.tokenUrl?t.push({label:"OAuth Ready",color:"green"}):t.push({label:"Incomplete",color:"orange"}),n.clientSecret&&t.push({label:"Secret Set",color:"blue"}),t}function _O(){const{toolId:n,clientId:t}=Jt(),i=De(),{tools:l,setSectionTitle:c,loadToolDetails:u,loadClientDetails:h}=Cl(),m=l.find(T=>T.id===n),[p,y]=d.useState(m||null),[v,b]=d.useState(null),[x,_]=d.useState(!0);if(d.useEffect(()=>{!m&&n?u(n).then(y):m&&y(m)},[n,m,u]),d.useEffect(()=>{t&&(_(!0),h(t).then(T=>{b(T),_(!1)}))},[t,h]),d.useEffect(()=>{if(!v){c("Client");return}c(v.friendlyName)},[v,c]),x)return a.jsx("div",{className:"client-detail-page",children:a.jsx(ee,{spacing:"4",align:"center",children:a.jsx(S,{size:"3",tone:"muted",children:"Loading client..."})})});if(!v)return a.jsx("div",{className:"client-detail-page",children:a.jsxs(ee,{spacing:"4",align:"center",children:[a.jsx(S,{size:"3",tone:"muted",children:"Client not found"}),a.jsx(ce,{variant:"secondary",onClick:()=>i(`/tools/tool/${n}/clients`),children:"Back to clients"})]})});const k=SO(v);return a.jsxs("div",{className:"client-detail-page",children:[a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{leading:a.jsx(He,{size:"sm",name:v.friendlyName}),tags:k,topRight:a.jsx(S,{size:"1",tone:"muted",children:Lt(v.updatedAt)}),children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:v.friendlyName}),a.jsx(S,{as:"span",tone:"muted",style:"mono",children:` #${v.id.slice(0,6)}`})]})}),a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Client ID"}),a.jsx(S,{size:"2",style:"mono",className:"client-detail-page__value",children:v.clientId})]})}),a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Connection ID"}),a.jsx(S,{size:"2",style:"mono",className:"client-detail-page__value",children:v.id})]})}),a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Server ID"}),a.jsx(S,{size:"2",style:"mono",className:"client-detail-page__value",children:v.serverId})]})}),a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Authorization URL"}),a.jsx(S,{size:"2",style:"mono",className:"client-detail-page__value",children:v.authorizeUrl})]})}),a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Token URL"}),a.jsx(S,{size:"2",style:"mono",className:"client-detail-page__value",children:v.tokenUrl})]})}),a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Client Secret"}),a.jsx(S,{size:"2",tone:"muted",children:v.clientSecret?"Configured (hidden)":"Not configured"})]})}),a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Registration Date"}),a.jsx(S,{size:"2",tone:"muted",children:new Date(v.createdAt).toLocaleString()})]})}),a.jsx(xe,{className:"client-detail-page__section",children:a.jsxs(_e,{children:[a.jsx(S,{as:"span",weight:"medium",size:"3",children:"Last Updated"}),a.jsx(S,{size:"2",tone:"muted",children:new Date(v.updatedAt).toLocaleString()})]})}),a.jsxs(xe,{className:"client-detail-page__actions",children:[a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>i(`/tools/tool/${n}/clients`),children:"Back to Clients"}),a.jsx(ce,{size:"lg",variant:"secondary",onClick:()=>i(`/tools/tool/${n}`),children:"Back to Tool"})]})]})}function SO(n){const t=[];return n.authorizeUrl&&n.tokenUrl?t.push({label:"OAuth Ready",color:"green"}):t.push({label:"Incomplete",color:"orange"}),n.clientSecret&&t.push({label:"Secret Set",color:"blue"}),t}function jO(){return a.jsx(iO,{children:a.jsx(ps,{children:a.jsxs(je,{element:a.jsx(uO,{}),children:[a.jsx(je,{index:!0,element:a.jsx(oO,{})}),a.jsx(je,{path:"/tool/:toolId",element:a.jsx(yO,{})}),a.jsx(je,{path:"/tool/:toolId/clients",element:a.jsx(vO,{})}),a.jsx(je,{path:"/tool/:toolId/clients/:clientId",element:a.jsx(_O,{})})]})})})}const TO=window.location.origin,wO=new ns({baseUrl:TO,credentials:"include"}),kO=wO.authorizationServer,EO=()=>{console.log("useConsent mounting");const[n,t]=d.useState(null),[i,l]=d.useState(null),[c,u]=d.useState(!0),[h,m]=d.useState(null),[p,y]=d.useState(!1);return d.useEffect(()=>{console.log("useConsent setting message"),t("Message coming from useConsent")},[]),{message:n,setMessage:t,loadConsentMetadata:async x=>{if(x){u(!0),m(null);try{const _=await kO.AuthorizationController_getConsentMetadata({flowId:x});l(_)}catch(_){m(_ instanceof Error?_.message:"Failed to load authorization details")}finally{u(!1)}}},consentMetadata:i,submitConsent:async(x,_,k)=>{y(!0),m(null);try{const T={flow_id:x,approved:k},w=Va||window.location.origin,E=document.createElement("form");E.method="POST",E.action=`${w}/api/v1/auth/authorize/mcp/${_}/0.0.0`,Object.entries(T).forEach(([R,D])=>{const O=document.createElement("input");O.type="hidden",O.name=R,O.value=String(D),E.appendChild(O)}),document.body.appendChild(E),E.submit()}catch(T){m(T instanceof Error?T.message:"Failed to submit consent decision"),y(!1)}},error:h,isApproving:p,isLoading:c}},lS=d.createContext(null);function CO({children:n}){const{message:t,error:i,isLoading:l,isApproving:c,loadConsentMetadata:u,consentMetadata:h,submitConsent:m}=EO(),[p,y]=d.useState(""),v=d.useMemo(()=>({message:t,sectionTitle:p,setSectionTitle:y,loadConsentMetadata:u,consentMetadata:h,submitConsent:m,error:i,isLoading:l,isApproving:c}),[t,p,y,u,h,m,i,l,c]);return a.jsx(lS.Provider,{value:v,children:n})}function oS(){const n=d.useContext(lS);if(!n)throw new Error("useConsentCtx must be used within <ConsentProvider>");return n}function NO(){const n=Dt();console.log("Consent page mounting");const{setSectionTitle:t,loadConsentMetadata:i,submitConsent:l,consentMetadata:c,isLoading:u,isApproving:h,error:m}=oS(),[p]=lf(),y=p.get("flow");if(!y)return a.jsx("div",{children:"whoops! missing flow id 👀"});d.useEffect(()=>{i(y)},[y]),d.useEffect(()=>{console.log("Consent page useEffect hook triggered"),console.log("setting section title"),t("🔐 Authorization request")},[]),d.useMemo(()=>!u&&!m&&c,[u,m,c]);const v=()=>{c&&l(y,T.providedId,!0)},b=()=>{c&&l(y,T.providedId,!1)};if(u)return a.jsxs("div",{children:[a.jsx("div",{className:"spinner"}),a.jsx("p",{children:"Loading authorization details..."})]});if(m||!c)return a.jsxs("div",{children:[a.jsx("h2",{children:"Authorization Error"}),a.jsx(Zt,{children:m||"Invalid authorization request"})]});const{client:x,scopes:_,redirectUri:k,server:T,resource:w,createdAt:E}=c;return a.jsxs("div",{className:"consent-page",children:[a.jsxs("div",{className:"consent-container",children:[n?a.jsxs("div",{className:"consent-header",children:[a.jsx("div",{className:"oauth-icon",children:"🔐"}),a.jsx("h1",{children:"Authorization Request"}),a.jsx("p",{className:"subtitle",children:"Review the following authorization request carefully"})]}):null,a.jsxs("div",{className:"consent-details",children:[a.jsxs(Ye,{className:"detail-section",children:[a.jsx("h2",{children:"WHO is requesting access"}),a.jsxs("div",{className:"client-info",children:[a.jsxs("div",{className:"info-row",children:[a.jsx("span",{className:"label",children:"Client Name:"}),a.jsx("span",{className:"value",children:x.clientName})]}),a.jsxs("div",{className:"info-row",children:[a.jsx("span",{className:"label",children:"Client ID:"}),a.jsx("span",{className:"value",children:a.jsx("code",{children:x.clientId})})]}),a.jsxs("div",{className:"info-row",children:[a.jsx("span",{className:"label",children:"Registered:"}),a.jsx("span",{className:"value",children:a.jsx("code",{children:new Date(E).toLocaleString()})})]})]})]}),a.jsxs(Ye,{className:"detail-section",children:[a.jsx("h2",{children:"WHAT access is requested"}),_&&_.length>0?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"scopes-list",children:_.map(R=>a.jsx(AO,{children:R},R))}),a.jsx("p",{style:{marginTop:"12px",fontSize:"13px",color:"#7f8c8d",marginBottom:0},children:"These permissions determine what the client can do on your behalf."})]}):a.jsx("p",{style:{fontSize:"13px",color:"#7f8c8d",marginBottom:0},children:"No specific permissions requested."})]}),a.jsxs(Ye,{className:"detail-section",children:[a.jsx("h2",{children:"WHERE access is granted"}),a.jsxs("div",{className:"server-info",children:[a.jsx("div",{className:"server-name",children:T.name}),a.jsxs("div",{className:"server-id",children:["Server ID: ",T.providedId]})]}),a.jsxs("div",{className:"resource-info",style:{marginTop:"16px"},children:[a.jsx("div",{style:{fontSize:"13px",color:"#7f8c8d",marginBottom:"8px"},children:"Resource:"}),a.jsx("code",{children:w})]})]}),a.jsxs(Ye,{className:"detail-section",children:[a.jsx("h2",{children:"Redirect Information"}),a.jsx("div",{className:"client-info",children:a.jsxs("div",{className:"info-row",children:[a.jsx("span",{className:"label",children:"Redirect URI:"}),a.jsx("span",{className:"value",children:a.jsx("code",{children:k})})]})}),a.jsx("p",{style:{marginTop:"12px",fontSize:"13px",color:"#7f8c8d",marginBottom:0},children:"After authorization, you will be redirected to this URL."})]})]})]}),m&&a.jsx(Zt,{children:m}),a.jsxs("div",{className:"consent-actions",children:[a.jsx(ce,{variant:"danger",onClick:b,disabled:h,children:"Deny"}),a.jsx(ce,{variant:"primary",onClick:v,disabled:h,children:h?"Approving...":"Approve"})]}),a.jsxs("div",{className:"consent-footer",children:[a.jsxs("p",{children:["By approving, you authorize ",a.jsx("strong",{children:c.client.clientName})," to access the specified resources with the requested permissions."]}),a.jsx(qs,{to:"/",children:"Home"})]})]})}function AO({children:n}){return a.jsx("span",{className:"scope-badge",children:n})}function RO(){const n=Dt(),{sectionTitle:t}=oS();return a.jsx(a.Fragment,{children:n?a.jsx(Jr,{sectionTitle:t,children:a.jsx(Qt,{})}):a.jsx(Qa,{appTitle:"Consent",sectionTitle:t,navItems:[],children:a.jsx(Qt,{})})})}function DO(){return a.jsx(CO,{children:a.jsx(ps,{children:a.jsx(je,{element:a.jsx(RO,{}),children:a.jsx(je,{path:"/",element:a.jsx(NO,{})})})})})}const OO=600*1e3,cS="We haven't seen activity in a while. If the worker doesn't report back, we'll mark this run as stale and revert the task to its previous state, where another agent will pick it";function zO(){const n=De(),{actors:t}=wl(),{showToast:i,showError:l}=dn(),{queue:c,active:u,history:h,totals:m,isLoading:p,hasLoadedOnce:y,error:v,loadExecutions:b}=Sf(),{workers:x}=_f(),[_,k]=d.useState(()=>new Set);vt();const T=d.useMemo(()=>{const R=Date.now(),D=120*1e3;return x.filter(O=>R-new Date(O.lastSeenAt).getTime()<=D).length},[x]),w=d.useMemo(()=>[...c.map(R=>({kind:"queue",entry:R})),...u.map(R=>({kind:"active",entry:R})),...h.map(R=>({kind:"history",entry:R}))],[u,h,c]),E=async(R,D)=>{if(confirm(`Are you sure you want to interrupt the execution for "${D??"Untitled task"}"?`)){k(O=>new Set(O).add(R));try{await Pa.ActiveTaskExecutionController_interruptExecution({executionId:R}),i(`Interrupt signal sent for "${D??"Untitled task"}"`),await b()}catch(O){l(O)}finally{k(O=>{const z=new Set(O);return z.delete(R),z})}}};return a.jsxs("div",{className:"executions-page",children:[a.jsxs("div",{className:"executions-hero",children:[a.jsxs("div",{className:"executions-hero__summary",children:[a.jsxs("div",{className:"executions-worker-status",children:[a.jsx("span",{className:"executions-worker-status__indicator",style:{color:T>0?"var(--success)":"var(--danger)"},"aria-label":T>0?"Workers connected":"No workers connected",children:"●"}),a.jsxs(S,{as:"span",size:"2",tone:"muted",children:[T>0?`${T} worker${T!==1?"s":""} connected`:"no worker connected"," · ",a.jsx("button",{type:"button",className:"executions-worker-status__link",onClick:()=>n("/settings/workers"),children:"configure"})]})]}),a.jsxs(S,{as:"div",size:"2",tone:"muted",className:"executions-run-counts",children:[m.queue.toLocaleString()," queued · ",m.active.toLocaleString()," running · ",m.history.toLocaleString()," finished"]})]}),v?a.jsx("span",{className:"executions-error-copy",children:"Fetch failed"}):null]}),p&&!y?a.jsx(Ye,{className:"executions-empty-card",children:a.jsx(S,{as:"div",size:"3",weight:"medium",children:"Loading executions..."})}):null,v?a.jsxs(Ye,{className:"executions-empty-card",children:[a.jsx(S,{as:"div",size:"3",weight:"medium",children:"Could not load executions"}),a.jsx(S,{as:"div",tone:"muted",wrap:!0,children:v})]}):null,y&&!v?w.length>0?a.jsx("div",{className:"executions-feed","aria-label":"Execution runs",children:w.map(R=>{const D=BO(R),O=$O(R),z=hS(R,t),A=R.kind==="active"&&_.has(R.entry.id);return a.jsx(MO,{feedEntry:R,actor:z,isInterrupting:A,onClick:()=>n(O),onInterrupt:R.kind==="active"?()=>{E(R.entry.id,R.entry.taskName)}:void 0},D)})}):a.jsxs(Ye,{className:"executions-empty-card",children:[a.jsx(S,{as:"div",size:"3",weight:"medium",children:"No executions yet"}),a.jsx(S,{as:"div",tone:"muted",children:"Queued, running, and completed executions will appear here."})]}):null]})}function LO(){const n=De(),{kind:t,id:i}=Jt(),{actors:l}=wl(),{queue:c,active:u,history:h,isLoading:m,hasLoadedOnce:p,error:y}=Sf();vt();const v=d.useMemo(()=>{if(!t||!i)return null;if(t==="queue"){const k=c.find(T=>T.taskId===i);return k?{kind:"queue",entry:k}:null}if(t==="active"){const k=u.find(T=>T.id===i);return k?{kind:"active",entry:k}:null}if(t==="history"){const k=h.find(T=>T.id===i);return k?{kind:"history",entry:k}:null}return null},[u,h,i,t,c]);if(m&&!p)return a.jsx("div",{className:"executions-page",children:a.jsx(Ye,{className:"executions-empty-card",children:a.jsx(S,{as:"div",size:"3",weight:"medium",children:"Loading run..."})})});if(y)return a.jsx("div",{className:"executions-page",children:a.jsxs(Ye,{className:"executions-empty-card",children:[a.jsx(S,{as:"div",size:"3",weight:"medium",children:"Could not load run"}),a.jsx(S,{as:"div",tone:"muted",wrap:!0,children:y})]})});if(!v)return a.jsxs("div",{className:"executions-page executions-page--detail",children:[a.jsx("div",{className:"executions-detail-topbar",children:a.jsx(ce,{variant:"secondary",onClick:()=>n("/runs"),children:"Back to runs"})}),a.jsx(S,{as:"div",size:"5",weight:"bold",children:"Run not found"}),a.jsx(S,{as:"div",tone:"muted",wrap:!0,children:"The run may have moved between queued, active, and historical states."})]});const b=hS(v,l),x=v.entry.taskName??"Untitled task",_=PO(v);return a.jsxs("div",{className:"executions-page executions-page--detail",children:[a.jsxs("div",{className:"executions-detail-topbar",children:[a.jsx(ce,{variant:"secondary",onClick:()=>n("/runs"),children:"Back to runs"}),a.jsx(ce,{variant:"secondary",onClick:()=>n(`/tasks/task/${v.entry.taskId}`),children:"Open task"})]}),a.jsxs("header",{className:"executions-run-header",children:[a.jsx(uS,{feedEntry:v}),a.jsxs("div",{className:"executions-run-header__copy",children:[a.jsx(S,{as:"div",size:"5",weight:"bold",wrap:!0,children:x}),a.jsx(S,{as:"div",size:"2",tone:"muted",children:b?`picked by @${b.slug??b.displayName??b.id}`:"waiting to be picked"})]}),a.jsx(S,{as:"div",size:"2",tone:"muted",className:"executions-run-status-label",children:_})]}),v.kind==="queue"?a.jsxs("section",{className:"executions-detail-section",children:[a.jsx(S,{as:"div",size:"1",weight:"semibold",tone:"muted",className:"executions-detail-section__title",children:"Queue"}),a.jsxs("div",{className:"executions-detail-list",children:[a.jsx($t,{label:"Task status",value:v.entry.taskStatus??"Unknown"}),a.jsx($t,{label:"Task ID",value:v.entry.taskId,mono:!0})]})]}):a.jsx(IO,{execution:v.entry,actor:b})]})}function MO({feedEntry:n,actor:t,isInterrupting:i,onClick:l,onInterrupt:c}){const u=n.entry.taskName??"Untitled task",h=HO(n),m=GO(n),p=t?`picked by @${t.slug??t.displayName??t.id}`:"waiting to be picked",y=UO(n);return a.jsxs("div",{role:"button",tabIndex:0,className:"executions-feed-row",onClick:l,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),l())},"aria-label":`Open run for ${u}`,children:[a.jsx(uS,{feedEntry:n}),a.jsxs("div",{className:"executions-feed-row__main",children:[a.jsx(S,{as:"div",size:"3",weight:"semibold",wrap:!0,children:u}),a.jsx(S,{as:"div",size:"2",tone:"muted",wrap:!0,children:p})]}),a.jsxs("div",{className:"executions-feed-row__meta",children:[a.jsxs("div",{className:"executions-feed-row__status-line",children:[a.jsx(S,{as:"span",size:"2",weight:"medium",children:h}),y?a.jsx(qO,{}):null]}),a.jsx(S,{as:"div",size:"1",tone:"muted",children:m})]}),a.jsx("div",{className:"executions-feed-row__stats",children:a.jsx(S,{as:"div",size:"2",weight:"medium",children:VO(n)})}),c?a.jsx("div",{className:"executions-feed-row__actions",children:a.jsx(ce,{variant:"danger",size:"sm",disabled:i,onClick:v=>{v.stopPropagation(),c()},children:i?"Interrupting...":"Interrupt"})}):null]})}function uS({feedEntry:n}){return n.kind==="queue"?a.jsx("span",{className:"executions-run-icon executions-run-icon--queued","aria-label":"Queued"}):n.kind==="active"?a.jsx("span",{className:"executions-run-icon executions-run-icon--active","aria-label":"Active"}):n.entry.status==="SUCCEEDED"?a.jsx("span",{className:"executions-run-icon executions-run-icon--success","aria-label":"Succeeded",children:"✓"}):a.jsx("span",{className:"executions-run-icon executions-run-icon--danger","aria-label":n.entry.status,children:"×"})}function IO({execution:n,actor:t}){const i="transitionedAt"in n,l=new Date(n.claimedAt),c=i?new Date(n.transitionedAt):new Date,u=pS(c.getTime()-l.getTime()),h=n.stats,m=!i&&dS(n);return a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"executions-detail-section",children:[a.jsx(S,{as:"div",size:"1",weight:"semibold",tone:"muted",className:"executions-detail-section__title",children:"Timing"}),m?a.jsxs("div",{className:"executions-stale-callout",role:"status",children:[a.jsx(S,{as:"div",size:"2",weight:"semibold",children:"Potentially stale"}),a.jsx(S,{as:"div",size:"2",wrap:!0,children:cS})]}):null,a.jsxs("div",{className:"executions-detail-list",children:[a.jsx($t,{label:"Claimed at",value:Ch(n.claimedAt)}),i?a.jsx($t,{label:"Finished at",value:Ch(n.transitionedAt)}):null,!i&&"lastHeartbeatAt"in n?a.jsx($t,{label:"Latest heartbeat",value:Ch(n.lastHeartbeatAt)}):null,a.jsx($t,{label:"Duration",value:u})]})]}),a.jsxs("section",{className:"executions-detail-section",children:[a.jsx(S,{as:"div",size:"1",weight:"semibold",tone:"muted",className:"executions-detail-section__title",children:"Work"}),a.jsxs("div",{className:"executions-detail-list",children:[a.jsx($t,{label:"Agent",value:t?`@${t.slug??t.displayName??t.id}`:n.agentActorId,mono:!t}),a.jsx($t,{label:"Tool calls",value:n.toolCallCount.toLocaleString()}),a.jsx($t,{label:"Harness",value:h?.harness??"Unknown"}),a.jsx($t,{label:"Provider",value:h?.providerId??"Unknown"}),a.jsx($t,{label:"Model",value:h?.modelId??"Unknown"}),a.jsx($t,{label:"Worker version",value:h?.workerVersion??"Unknown"})]})]}),a.jsxs("section",{className:"executions-detail-section",children:[a.jsx(S,{as:"div",size:"1",weight:"semibold",tone:"muted",className:"executions-detail-section__title",children:"IDs"}),a.jsxs("div",{className:"executions-detail-list",children:[a.jsx($t,{label:"Run ID",value:n.id,mono:!0}),a.jsx($t,{label:"Task ID",value:n.taskId,mono:!0}),a.jsx($t,{label:"Worker ID",value:n.workerClientId,mono:!0}),a.jsx($t,{label:"Session ID",value:n.runnerSessionId??"pending",mono:!0})]})]}),i&&(n.errorCode||n.errorMessage)?a.jsxs("section",{className:"executions-detail-section executions-detail-section--danger",children:[a.jsx(S,{as:"div",size:"1",weight:"semibold",tone:"muted",className:"executions-detail-section__title",children:"Failure"}),a.jsxs("div",{className:"executions-detail-list",children:[a.jsx($t,{label:"Error code",value:n.errorCode??"None"}),n.errorMessage?a.jsx($t,{label:"Message",value:n.errorMessage}):null]})]}):null]})}function $t({label:n,value:t,mono:i}){return a.jsxs("div",{className:"executions-detail-row",children:[a.jsx(S,{as:"span",size:"1",tone:"muted",children:n}),a.jsx(S,{as:"span",size:"2",style:i?"mono":"sans",wrap:!0,children:t})]})}function qO(){return a.jsx("span",{className:"executions-stale-badge",title:cS,children:"Potentially stale"})}function UO(n){return n.kind==="active"&&dS(n.entry)}function dS(n){const t=n.lastHeartbeatAt??n.claimedAt;return Date.now()-new Date(t).getTime()>=OO}function hS(n,t){if(n.kind!=="queue")return t.find(i=>i.id===n.entry.agentActorId)}function BO(n){return n.kind==="queue"?`queue-${n.entry.taskId}`:`${n.kind}-${n.entry.id}`}function $O(n){return n.kind==="queue"?`/runs/queue/${n.entry.taskId}`:`/runs/${n.kind}/${n.entry.id}`}function PO(n){return n.kind==="queue"?"Queued":n.kind==="active"?"Running":fS(n.entry.status)}function HO(n){if(n.kind==="queue")return`Queued · ${n.entry.taskStatus??"Unknown task status"}`;if(n.kind==="active")return`Running · ${n.entry.taskStatus??"Unknown task status"}`;const t=n.entry.errorCode?` · ${n.entry.errorCode}`:"";return`${fS(n.entry.status)}${t}`}function GO(n){return n.kind==="queue"?FO(n.entry.taskId):n.kind==="active"?`heartbeat ${Ax(n.entry.lastHeartbeatAt)}`:`${pS(new Date(n.entry.transitionedAt).getTime()-new Date(n.entry.claimedAt).getTime())} · ${Ax(n.entry.transitionedAt)}`}function VO(n){return n.kind==="queue"?"No tools yet":`${n.entry.toolCallCount.toLocaleString()} tool calls`}function fS(n){return n.toLowerCase().replace(/^./,t=>t.toUpperCase())}function pS(n){const t=Math.floor(n/1e3),i=Math.floor(t/60),l=Math.floor(i/60),c=Math.floor(l/24);return c>0?`${c}d ${l%24}h ${i%60}m`:l>0?`${l}h ${i%60}m`:i>0?`${i}m ${t%60}s`:`${t}s`}function Ch(n){return n?new Date(n).toLocaleString():"Never"}function Ax(n){if(!n)return"never";const t=Date.now()-new Date(n).getTime(),i=Math.max(0,Math.floor(t/1e3));if(i<60)return`${i}s ago`;const l=Math.floor(i/60);if(l<60)return`${l}m ago`;const c=Math.floor(l/60);return c<24?`${c}h ago`:`${Math.floor(c/24)}d ago`}function FO(n){return n.length>12?`${n.slice(0,8)}...${n.slice(-4)}`:n}function YO(){const n=Dt(),t="Runs",i=[];return a.jsx("div",{style:{minHeight:0},children:n?a.jsx(Jr,{sectionTitle:t,children:a.jsx(Qt,{})}):a.jsx(Qa,{appTitle:"Runs",sectionTitle:t,navItems:i,children:a.jsx(Qt,{})})})}function KO(){return a.jsx(ps,{children:a.jsxs(je,{element:a.jsx(YO,{}),children:[a.jsx(je,{index:!0,element:a.jsx(zO,{})}),a.jsx(je,{path:":kind/:id",element:a.jsx(LO,{})})]})})}function XO({children:n}){const{user:t,refreshAuth:i}=un(),l=d.useRef(!1);return d.useEffect(()=>{l.current||!t||t.onboardingDisplayMode==="FULL_PAGE"&&(l.current=!0,mf.WalkthroughController_acknowledge().then(()=>i()).catch(console.error))},[t,i]),!l.current&&t?.onboardingDisplayMode==="FULL_PAGE"?a.jsx(Is,{to:"/walkthrough",replace:!0}):a.jsx(a.Fragment,{children:n})}function QO(){return a.jsxs(ps,{children:[a.jsx(je,{path:"/logout",element:a.jsx(RR,{})}),a.jsx(je,{index:!0,element:a.jsx(Is,{to:"home",replace:!0})}),a.jsx(je,{path:"/consent",element:a.jsx(DO,{})}),a.jsx(je,{path:"/*",element:a.jsx(sA,{})}),a.jsx(je,{path:"/tasks/*",element:a.jsx(AR,{})}),a.jsx(je,{path:"/context/*",element:a.jsx(V2,{})}),a.jsx(je,{path:"/agents/*",element:a.jsx(wD,{})}),a.jsx(je,{path:"/threads/*",element:a.jsx(ZD,{})}),a.jsx(je,{path:"/tools/*",element:a.jsx(jO,{})}),a.jsx(je,{path:"/runs/*",element:a.jsx(KO,{})}),a.jsx(je,{path:"/executions/*",element:a.jsx(Is,{to:"/runs",replace:!0})})]})}function ZO(){return a.jsx(ok,{basename:aA,children:a.jsx(xk,{children:a.jsx($C,{children:a.jsx(Ok,{children:a.jsxs(LA,{children:[a.jsxs(ps,{children:[a.jsx(je,{path:"/onboarding",element:a.jsx(NE,{})}),a.jsx(je,{path:"/login",element:a.jsx(DE,{children:a.jsx(EE,{})})}),a.jsx(je,{path:"*",element:a.jsx(AE,{children:a.jsx(qC,{children:a.jsx(XO,{children:a.jsx(W1,{children:a.jsx(QO,{})})})})})})]}),a.jsx(PC,{})]})})})})})}MT.createRoot(document.getElementById("root")).render(a.jsx(Rx.StrictMode,{children:a.jsx(ZO,{})}));
|