@parcha/agentrun-serve 0.1.0-beta.36 → 0.1.0-beta.37
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/CHANGELOG.md +170 -0
- package/README.md +158 -52
- package/dist/attach-conformance-cli.d.ts +1 -0
- package/dist/attach-conformance-cli.js +18 -0
- package/dist/attach-conformance.d.ts +25 -0
- package/dist/attach-conformance.js +343 -0
- package/dist/browser-cost.d.ts +1 -1
- package/dist/browser-live.d.ts +20 -8
- package/dist/browser-live.js +50 -27
- package/dist/cap.d.ts +0 -17
- package/dist/cap.js +0 -91
- package/dist/catalog.d.ts +1 -12
- package/dist/catalog.js +3 -33
- package/dist/cli.js +13 -4
- package/dist/composio-preset.d.ts +36 -0
- package/dist/composio-preset.js +179 -0
- package/dist/computer-attach.d.ts +125 -0
- package/dist/computer-attach.js +330 -0
- package/dist/computer-calls.d.ts +48 -0
- package/dist/computer-calls.js +126 -0
- package/dist/computer-channel.d.ts +57 -0
- package/dist/computer-channel.js +115 -0
- package/dist/computer-commands.d.ts +1 -1
- package/dist/computer-held-routes.d.ts +35 -0
- package/dist/computer-held-routes.js +106 -0
- package/dist/computer-held.d.ts +48 -0
- package/dist/computer-held.js +87 -0
- package/dist/computer-keys.d.ts +21 -1
- package/dist/computer-keys.js +53 -11
- package/dist/computer-live.d.ts +160 -0
- package/dist/computer-live.js +643 -0
- package/dist/computer-view.d.ts +13 -0
- package/dist/computer-view.js +50 -3
- package/dist/computer-viewer.d.ts +6 -0
- package/dist/computer-viewer.js +297 -0
- package/dist/computers.d.ts +33 -7
- package/dist/computers.js +50 -8
- package/dist/console/assets/index-Cn6JX1uH.js +563 -0
- package/dist/console/assets/index-DRN62V5v.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/faux-computers.d.ts +9 -20
- package/dist/faux-computers.js +53 -25
- package/dist/github-connection.d.ts +10 -2
- package/dist/github-connection.js +65 -2
- package/dist/github-faux.js +1 -1
- package/dist/graph-view.d.ts +1 -1
- package/dist/harness.d.ts +1 -0
- package/dist/harness.js +35 -1
- package/dist/host-tools.d.ts +1 -1
- package/dist/hosted-search.d.ts +5 -4
- package/dist/hosted-search.js +2 -7
- package/dist/import-sources.d.ts +10 -0
- package/dist/import-sources.js +44 -2
- package/dist/import.d.ts +3 -3
- package/dist/import.js +37 -6
- package/dist/learn/check.d.ts +4 -1
- package/dist/learn/check.js +1 -1
- package/dist/learn/commit.d.ts +4 -2
- package/dist/learn/commit.js +5 -5
- package/dist/learn/folder.d.ts +6 -0
- package/dist/learn/folder.js +4 -1
- package/dist/learn/general.d.ts +66 -0
- package/dist/learn/general.js +73 -0
- package/dist/learn/grade.d.ts +4 -0
- package/dist/learn/grade.js +22 -1
- package/dist/learn/reflect.d.ts +10 -1
- package/dist/learn/reflect.js +14 -4
- package/dist/learn/skills.d.ts +33 -5
- package/dist/learn/skills.js +53 -7
- package/dist/learned-workflow.d.ts +24 -0
- package/dist/learned-workflow.js +66 -3
- package/dist/learning-batch.d.ts +283 -0
- package/dist/learning-batch.js +574 -0
- package/dist/learning-evals.d.ts +33 -0
- package/dist/learning-evals.js +98 -0
- package/dist/learning-routes.d.ts +25 -2
- package/dist/learning-routes.js +39 -6
- package/dist/learning-words.d.ts +6 -0
- package/dist/learning-words.js +6 -0
- package/dist/learning.d.ts +28 -15
- package/dist/learning.js +84 -44
- package/dist/live/stream.js +6 -3
- package/dist/live/translate.d.ts +4 -3
- package/dist/live/translate.js +8 -4
- package/dist/live-reach.d.ts +37 -0
- package/dist/live-reach.js +62 -0
- package/dist/mcp-gateway.d.ts +9 -0
- package/dist/mcp-gateway.js +60 -11
- package/dist/mcp-oauth.d.ts +57 -7
- package/dist/mcp-oauth.js +133 -18
- package/dist/mcp-private-hosts.d.ts +4 -4
- package/dist/mcp-private-hosts.js +20 -12
- package/dist/mcp-probe.d.ts +19 -2
- package/dist/mcp-probe.js +44 -9
- package/dist/mcp-secret-writes.js +4 -0
- package/dist/mcp-servers-store.d.ts +38 -15
- package/dist/mcp-servers-store.js +112 -20
- package/dist/mcp-store.d.ts +10 -4
- package/dist/mcp-store.js +17 -6
- package/dist/model-form.d.ts +26 -0
- package/dist/model-form.js +80 -0
- package/dist/model.js +23 -10
- package/dist/openapi.js +386 -21
- package/dist/page.d.ts +18 -0
- package/dist/page.js +48 -20
- package/dist/paid-calls.d.ts +1 -1
- package/dist/place-offers.d.ts +2 -3
- package/dist/place-offers.js +3 -7
- package/dist/place.js +1 -2
- package/dist/print.d.ts +15 -1
- package/dist/print.js +14 -3
- package/dist/propose.d.ts +3 -0
- package/dist/propose.js +13 -5
- package/dist/provider.js +3 -2
- package/dist/reflect-range.d.ts +8 -1
- package/dist/reflect-range.js +1 -1
- package/dist/run-launch.d.ts +14 -2
- package/dist/run-launch.js +9 -4
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-reads-over-store.d.ts +1 -1
- package/dist/run-repo.d.ts +20 -0
- package/dist/run-repo.js +63 -0
- package/dist/run-timeline-served.d.ts +1 -1
- package/dist/run-view.d.ts +3 -3
- package/dist/run-view.js +14 -7
- package/dist/runner/adapter-loop.d.ts +23 -7
- package/dist/runner/adapter-loop.js +648 -62
- package/dist/runner/adapter-run-spec.d.ts +11 -3
- package/dist/runner/adapter-run-spec.js +77 -22
- package/dist/runner/adapters/pi-computer.d.ts +7 -0
- package/dist/runner/adapters/pi-computer.js +43 -0
- package/dist/runner/adapters/pi.d.ts +9 -4
- package/dist/runner/adapters/pi.js +76 -14
- package/dist/runner/beside.d.ts +7 -3
- package/dist/runner/beside.js +21 -11
- package/dist/runner/claim-secrets.d.ts +4 -0
- package/dist/runner/claim-secrets.js +6 -1
- package/dist/runner/cli-run-spec.d.ts +20 -3
- package/dist/runner/cli-run-spec.js +113 -43
- package/dist/runner/commands.d.ts +3 -1
- package/dist/runner/commands.js +28 -3
- package/dist/runner/computer-channel.d.ts +34 -0
- package/dist/runner/computer-channel.js +61 -0
- package/dist/runner/conformance/harness.js +80 -14
- package/dist/runner/conformance/subject.d.ts +1 -1
- package/dist/runner/dispatch.js +3 -0
- package/dist/runner/end-of-run.d.ts +22 -12
- package/dist/runner/end-of-run.js +38 -16
- package/dist/runner/github-app.d.ts +2 -1
- package/dist/runner/github-app.js +4 -2
- package/dist/runner/harness-loops.js +15 -1
- package/dist/runner/held-run.d.ts +65 -0
- package/dist/runner/held-run.js +158 -0
- package/dist/runner/journal-kinds.d.ts +20 -1
- package/dist/runner/journal-kinds.js +14 -0
- package/dist/runner/journal-reader.d.ts +5 -4
- package/dist/runner/journal-reader.js +12 -10
- package/dist/runner/learning-ask.d.ts +7 -1
- package/dist/runner/learning-ask.js +21 -6
- package/dist/runner/learning-dispatch.d.ts +22 -0
- package/dist/runner/learning-dispatch.js +77 -10
- package/dist/runner/learning-end.d.ts +22 -1
- package/dist/runner/learning-end.js +92 -12
- package/dist/runner/learning-factory.d.ts +1 -1
- package/dist/runner/learning-factory.js +11 -5
- package/dist/runner/learning-loop.d.ts +67 -7
- package/dist/runner/learning-loop.js +173 -21
- package/dist/runner/learning-seed.d.ts +7 -0
- package/dist/runner/learning-seed.js +13 -0
- package/dist/runner/live-ticker.js +1 -0
- package/dist/runner/loop-contract.d.ts +8 -1
- package/dist/runner/loop.d.ts +5 -1
- package/dist/runner/loop.js +2 -1
- package/dist/runner/main.d.ts +13 -1
- package/dist/runner/main.js +27 -5
- package/dist/runner/mcp-claim.d.ts +10 -7
- package/dist/runner/mcp-claim.js +113 -24
- package/dist/runner/mcp-github.js +1 -1
- package/dist/runner/mcp-run.d.ts +5 -5
- package/dist/runner/mcp-run.js +15 -3
- package/dist/runner/metrics.d.ts +11 -2
- package/dist/runner/metrics.js +12 -2
- package/dist/runner/pr-checkout.d.ts +1 -0
- package/dist/runner/pr-checkout.js +1 -1
- package/dist/runner/reflect-hook.d.ts +18 -0
- package/dist/runner/reflect-hook.js +20 -8
- package/dist/runner/runner.d.ts +26 -0
- package/dist/runner/runner.js +184 -15
- package/dist/runner/scratch-sweep.d.ts +13 -0
- package/dist/runner/scratch-sweep.js +62 -0
- package/dist/runner/sessions.d.ts +1 -1
- package/dist/runner/store-port.d.ts +4 -2
- package/dist/runner/store-secrets.js +4 -3
- package/dist/runner/subagent.js +3 -1
- package/dist/runner/workflow-host.d.ts +6 -1
- package/dist/runner/workflow-host.js +1 -1
- package/dist/runner/workflow-loop.d.ts +1 -1
- package/dist/runner/workflow-spec.d.ts +14 -2
- package/dist/runner/workflow-spec.js +56 -20
- package/dist/runs-over-store.d.ts +6 -1
- package/dist/runs-over-store.js +38 -9
- package/dist/seal-key.js +3 -3
- package/dist/sealed-settings-store.d.ts +5 -2
- package/dist/sealed-settings-store.js +10 -4
- package/dist/secret-writes.d.ts +5 -4
- package/dist/secret-writes.js +5 -4
- package/dist/server-secrets-store.d.ts +4 -3
- package/dist/server-secrets-store.js +15 -9
- package/dist/server-secrets.js +3 -2
- package/dist/server.d.ts +43 -14
- package/dist/server.js +472 -126
- package/dist/settings-wake.d.ts +21 -0
- package/dist/settings-wake.js +59 -0
- package/dist/standard-webhooks.d.ts +4 -1
- package/dist/standard-webhooks.js +8 -4
- package/dist/store/command-wake.d.ts +12 -0
- package/dist/store/command-wake.js +37 -0
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +5 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/journal/storage.d.ts +3 -2
- package/dist/store/journal/storage.js +13 -5
- package/dist/store/postgres/dialect.js +4 -0
- package/dist/store/postgres/migrations/0005_learning_rounds.sql +14 -0
- package/dist/store/postgres/migrations/0006_run_changes_channel_attempts.sql +57 -0
- package/dist/store/postgres/migrations/0007_viewer_host.sql +11 -0
- package/dist/store/postgres/migrations/0008_paired_computers.sql +30 -0
- package/dist/store/postgres/migrations/0009_commands_answer.sql +10 -0
- package/dist/store/schema.d.ts +1 -1
- package/dist/store/schema.js +77 -8
- package/dist/store/sqlite/run-patch.d.ts +7 -5
- package/dist/store/sqlite/run-patch.js +28 -13
- package/dist/store/sqlite/store.js +272 -54
- package/dist/store/store.d.ts +268 -9
- package/dist/store/store.js +12 -1
- package/dist/store-reads/cap.d.ts +1 -1
- package/dist/store-reads/cap.js +8 -1
- package/dist/store-reads/decisions.d.ts +2 -2
- package/dist/store-reads/decisions.js +1 -1
- package/dist/store-reads/import-summary.d.ts +1 -1
- package/dist/store-reads/journal.d.ts +5 -4
- package/dist/store-reads/journal.js +73 -15
- package/dist/store-reads/learning.d.ts +20 -4
- package/dist/store-reads/learning.js +74 -18
- package/dist/store-reads/runs.d.ts +1 -1
- package/dist/store-reads/workflow.d.ts +1 -1
- package/dist/store-view.d.ts +5 -0
- package/dist/store-view.js +26 -11
- package/dist/template-eval.js +6 -4
- package/dist/template-github-permissions.d.ts +22 -8
- package/dist/template-github-permissions.js +35 -15
- package/dist/timeline/timeline.d.ts +27 -0
- package/dist/timeline/timeline.js +10 -9
- package/dist/timeline/util.d.ts +4 -0
- package/dist/timeline/util.js +14 -0
- package/dist/tool-budget.d.ts +19 -7
- package/dist/tool-budget.js +14 -8
- package/dist/tool-gate.d.ts +16 -9
- package/dist/tool-gate.js +53 -42
- package/dist/tool-plane.d.ts +16 -12
- package/dist/tool-plane.js +9 -4
- package/dist/tools.d.ts +13 -4
- package/dist/tools.js +13 -4
- package/dist/trigger-adapter.d.ts +4 -0
- package/dist/trigger-secrets-shown.d.ts +2 -2
- package/dist/trigger-secrets-shown.js +1 -1
- package/dist/trigger-signatures.d.ts +25 -6
- package/dist/trigger-signatures.js +41 -7
- package/dist/trigger-targets.d.ts +2 -0
- package/dist/trigger-targets.js +1 -0
- package/dist/trigger-webhook.js +5 -2
- package/dist/triggers.d.ts +7 -3
- package/dist/triggers.js +35 -5
- package/dist/turns.js +16 -1
- package/dist/validate.js +11 -1
- package/dist/web-fetch.d.ts +1 -1
- package/dist/web-search.d.ts +10 -5
- package/dist/web-search.js +7 -6
- package/dist/webhooks.d.ts +145 -102
- package/dist/webhooks.js +559 -322
- package/dist/workflow/decisions.d.ts +1 -1
- package/dist/workflow/node-runner.d.ts +2 -1
- package/dist/workflow/node.d.ts +2 -1
- package/dist/workflow/node.js +3 -1
- package/dist/workflow/pi-versions.d.ts +23 -0
- package/dist/workflow/pi-versions.js +57 -0
- package/dist/workflow/record-tool.d.ts +2 -1
- package/dist/workflow/store.d.ts +1 -1
- package/dist/workflow/task.js +3 -2
- package/dist/workflow-run.d.ts +1 -1
- package/dist/workspace/attached-computers.d.ts +41 -0
- package/dist/workspace/attached-computers.js +114 -0
- package/dist/workspace/computer-deps.d.ts +16 -9
- package/dist/workspace/computer-deps.js +19 -7
- package/dist/workspace/computer-for-claim.d.ts +17 -8
- package/dist/workspace/computer-for-claim.js +62 -21
- package/dist/workspace/computer-hold.d.ts +11 -27
- package/dist/workspace/computer-hold.js +36 -56
- package/dist/workspace/computer-ledger.d.ts +3 -1
- package/dist/workspace/computer-ledger.js +4 -0
- package/dist/workspace/computer-mcp.d.ts +25 -0
- package/dist/workspace/computer-mcp.js +41 -0
- package/dist/workspace/computer-ports.d.ts +4 -13
- package/dist/workspace/computer-ports.js +4 -107
- package/dist/workspace/computer-script.d.ts +37 -0
- package/dist/workspace/computer-script.js +138 -0
- package/dist/workspace/executors.d.ts +1 -1
- package/dist/workspace/index.d.ts +4 -2
- package/dist/workspace/index.js +3 -1
- package/dist/workspace/kind-skills/desktop/SKILL.md +119 -84
- package/dist/workspace/kind-skills/phone/SKILL.md +100 -85
- package/dist/workspace/resolve-computer.d.ts +3 -0
- package/dist/workspace/resolve-computer.js +8 -2
- package/dist/workspace/run-tools.d.ts +32 -15
- package/dist/workspace/run-tools.js +23 -30
- package/package.json +19 -16
- package/templates/market-monitor/agent.md +1 -1
- package/dist/console/assets/index-BI4Byidu.js +0 -550
- package/dist/console/assets/index-C19gUF2n.css +0 -1
- package/dist/run-db.d.ts +0 -53
- package/dist/run-db.js +0 -116
- package/dist/workflow/readers.d.ts +0 -36
- package/dist/workflow/readers.js +0 -145
- package/dist/workflow/wal.d.ts +0 -11
- package/dist/workflow/wal.js +0 -106
|
@@ -1,550 +0,0 @@
|
|
|
1
|
-
var A2=Object.defineProperty;var O2=(e,t,n)=>t in e?A2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var st=(e,t,n)=>O2(e,typeof t!="symbol"?t+"":t,n);function M2(e,t){for(var n=0;n<t.length;n++){const o=t[n];if(typeof o!="string"&&!Array.isArray(o)){for(const i in o)if(i!=="default"&&!(i in e)){const l=Object.getOwnPropertyDescriptor(o,i);l&&Object.defineProperty(e,i,l.get?l:{enumerable:!0,get:()=>o[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))o(i);new MutationObserver(i=>{for(const l of i)if(l.type==="childList")for(const c of l.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&o(c)}).observe(document,{childList:!0,subtree:!0});function n(i){const l={};return i.integrity&&(l.integrity=i.integrity),i.referrerPolicy&&(l.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?l.credentials="include":i.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function o(i){if(i.ep)return;i.ep=!0;const l=n(i);fetch(i.href,l)}})();function Jw(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Pm={exports:{}},Ui={},Lm={exports:{}},Ye={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var uv;function P2(){if(uv)return Ye;uv=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),b=Symbol.iterator;function x(P){return P===null||typeof P!="object"?null:(P=b&&P[b]||P["@@iterator"],typeof P=="function"?P:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v=Object.assign,w={};function j(P,q,ne){this.props=P,this.context=q,this.refs=w,this.updater=ne||m}j.prototype.isReactComponent={},j.prototype.setState=function(P,q){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,q,"setState")},j.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function S(){}S.prototype=j.prototype;function T(P,q,ne){this.props=P,this.context=q,this.refs=w,this.updater=ne||m}var $=T.prototype=new S;$.constructor=T,v($,j.prototype),$.isPureReactComponent=!0;var _=Array.isArray,E=Object.prototype.hasOwnProperty,R={current:null},C={key:!0,ref:!0,__self:!0,__source:!0};function O(P,q,ne){var ae,ie={},ce=null,le=null;if(q!=null)for(ae in q.ref!==void 0&&(le=q.ref),q.key!==void 0&&(ce=""+q.key),q)E.call(q,ae)&&!C.hasOwnProperty(ae)&&(ie[ae]=q[ae]);var ye=arguments.length-2;if(ye===1)ie.children=ne;else if(1<ye){for(var ee=Array(ye),be=0;be<ye;be++)ee[be]=arguments[be+2];ie.children=ee}if(P&&P.defaultProps)for(ae in ye=P.defaultProps,ye)ie[ae]===void 0&&(ie[ae]=ye[ae]);return{$$typeof:e,type:P,key:ce,ref:le,props:ie,_owner:R.current}}function z(P,q){return{$$typeof:e,type:P.type,key:q,ref:P.ref,props:P.props,_owner:P._owner}}function F(P){return typeof P=="object"&&P!==null&&P.$$typeof===e}function D(P){var q={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(ne){return q[ne]})}var B=/\/+/g;function U(P,q){return typeof P=="object"&&P!==null&&P.key!=null?D(""+P.key):q.toString(36)}function W(P,q,ne,ae,ie){var ce=typeof P;(ce==="undefined"||ce==="boolean")&&(P=null);var le=!1;if(P===null)le=!0;else switch(ce){case"string":case"number":le=!0;break;case"object":switch(P.$$typeof){case e:case t:le=!0}}if(le)return le=P,ie=ie(le),P=ae===""?"."+U(le,0):ae,_(ie)?(ne="",P!=null&&(ne=P.replace(B,"$&/")+"/"),W(ie,q,ne,"",function(be){return be})):ie!=null&&(F(ie)&&(ie=z(ie,ne+(!ie.key||le&&le.key===ie.key?"":(""+ie.key).replace(B,"$&/")+"/")+P)),q.push(ie)),1;if(le=0,ae=ae===""?".":ae+":",_(P))for(var ye=0;ye<P.length;ye++){ce=P[ye];var ee=ae+U(ce,ye);le+=W(ce,q,ne,ee,ie)}else if(ee=x(P),typeof ee=="function")for(P=ee.call(P),ye=0;!(ce=P.next()).done;)ce=ce.value,ee=ae+U(ce,ye++),le+=W(ce,q,ne,ee,ie);else if(ce==="object")throw q=String(P),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.");return le}function X(P,q,ne){if(P==null)return P;var ae=[],ie=0;return W(P,ae,"","",function(ce){return q.call(ne,ce,ie++)}),ae}function M(P){if(P._status===-1){var q=P._result;q=q(),q.then(function(ne){(P._status===0||P._status===-1)&&(P._status=1,P._result=ne)},function(ne){(P._status===0||P._status===-1)&&(P._status=2,P._result=ne)}),P._status===-1&&(P._status=0,P._result=q)}if(P._status===1)return P._result.default;throw P._result}var K={current:null},L={transition:null},I={ReactCurrentDispatcher:K,ReactCurrentBatchConfig:L,ReactCurrentOwner:R};function G(){throw Error("act(...) is not supported in production builds of React.")}return Ye.Children={map:X,forEach:function(P,q,ne){X(P,function(){q.apply(this,arguments)},ne)},count:function(P){var q=0;return X(P,function(){q++}),q},toArray:function(P){return X(P,function(q){return q})||[]},only:function(P){if(!F(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},Ye.Component=j,Ye.Fragment=n,Ye.Profiler=i,Ye.PureComponent=T,Ye.StrictMode=o,Ye.Suspense=f,Ye.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,Ye.act=G,Ye.cloneElement=function(P,q,ne){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var ae=v({},P.props),ie=P.key,ce=P.ref,le=P._owner;if(q!=null){if(q.ref!==void 0&&(ce=q.ref,le=R.current),q.key!==void 0&&(ie=""+q.key),P.type&&P.type.defaultProps)var ye=P.type.defaultProps;for(ee in q)E.call(q,ee)&&!C.hasOwnProperty(ee)&&(ae[ee]=q[ee]===void 0&&ye!==void 0?ye[ee]:q[ee])}var ee=arguments.length-2;if(ee===1)ae.children=ne;else if(1<ee){ye=Array(ee);for(var be=0;be<ee;be++)ye[be]=arguments[be+2];ae.children=ye}return{$$typeof:e,type:P.type,key:ie,ref:ce,props:ae,_owner:le}},Ye.createContext=function(P){return P={$$typeof:c,_currentValue:P,_currentValue2:P,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},P.Provider={$$typeof:l,_context:P},P.Consumer=P},Ye.createElement=O,Ye.createFactory=function(P){var q=O.bind(null,P);return q.type=P,q},Ye.createRef=function(){return{current:null}},Ye.forwardRef=function(P){return{$$typeof:u,render:P}},Ye.isValidElement=F,Ye.lazy=function(P){return{$$typeof:h,_payload:{_status:-1,_result:P},_init:M}},Ye.memo=function(P,q){return{$$typeof:p,type:P,compare:q===void 0?null:q}},Ye.startTransition=function(P){var q=L.transition;L.transition={};try{P()}finally{L.transition=q}},Ye.unstable_act=G,Ye.useCallback=function(P,q){return K.current.useCallback(P,q)},Ye.useContext=function(P){return K.current.useContext(P)},Ye.useDebugValue=function(){},Ye.useDeferredValue=function(P){return K.current.useDeferredValue(P)},Ye.useEffect=function(P,q){return K.current.useEffect(P,q)},Ye.useId=function(){return K.current.useId()},Ye.useImperativeHandle=function(P,q,ne){return K.current.useImperativeHandle(P,q,ne)},Ye.useInsertionEffect=function(P,q){return K.current.useInsertionEffect(P,q)},Ye.useLayoutEffect=function(P,q){return K.current.useLayoutEffect(P,q)},Ye.useMemo=function(P,q){return K.current.useMemo(P,q)},Ye.useReducer=function(P,q,ne){return K.current.useReducer(P,q,ne)},Ye.useRef=function(P){return K.current.useRef(P)},Ye.useState=function(P){return K.current.useState(P)},Ye.useSyncExternalStore=function(P,q,ne){return K.current.useSyncExternalStore(P,q,ne)},Ye.useTransition=function(){return K.current.useTransition()},Ye.version="18.3.1",Ye}var dv;function md(){return dv||(dv=1,Lm.exports=P2()),Lm.exports}/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var fv;function L2(){if(fv)return Ui;fv=1;var e=md(),t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function c(u,f,p){var h,b={},x=null,m=null;p!==void 0&&(x=""+p),f.key!==void 0&&(x=""+f.key),f.ref!==void 0&&(m=f.ref);for(h in f)o.call(f,h)&&!l.hasOwnProperty(h)&&(b[h]=f[h]);if(u&&u.defaultProps)for(h in f=u.defaultProps,f)b[h]===void 0&&(b[h]=f[h]);return{$$typeof:t,type:u,key:x,ref:m,props:b,_owner:i.current}}return Ui.Fragment=n,Ui.jsx=c,Ui.jsxs=c,Ui}var mv;function I2(){return mv||(mv=1,Pm.exports=L2()),Pm.exports}var s=I2(),y=md();const je=Jw(y),kp=M2({__proto__:null,default:je},[y]);var nu={},Im={exports:{}},Fn={},zm={exports:{}},Dm={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var pv;function z2(){return pv||(pv=1,(function(e){function t(L,I){var G=L.length;L.push(I);e:for(;0<G;){var P=G-1>>>1,q=L[P];if(0<i(q,I))L[P]=I,L[G]=q,G=P;else break e}}function n(L){return L.length===0?null:L[0]}function o(L){if(L.length===0)return null;var I=L[0],G=L.pop();if(G!==I){L[0]=G;e:for(var P=0,q=L.length,ne=q>>>1;P<ne;){var ae=2*(P+1)-1,ie=L[ae],ce=ae+1,le=L[ce];if(0>i(ie,G))ce<q&&0>i(le,ie)?(L[P]=le,L[ce]=G,P=ce):(L[P]=ie,L[ae]=G,P=ae);else if(ce<q&&0>i(le,G))L[P]=le,L[ce]=G,P=ce;else break e}}return I}function i(L,I){var G=L.sortIndex-I.sortIndex;return G!==0?G:L.id-I.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var c=Date,u=c.now();e.unstable_now=function(){return c.now()-u}}var f=[],p=[],h=1,b=null,x=3,m=!1,v=!1,w=!1,j=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function $(L){for(var I=n(p);I!==null;){if(I.callback===null)o(p);else if(I.startTime<=L)o(p),I.sortIndex=I.expirationTime,t(f,I);else break;I=n(p)}}function _(L){if(w=!1,$(L),!v)if(n(f)!==null)v=!0,M(E);else{var I=n(p);I!==null&&K(_,I.startTime-L)}}function E(L,I){v=!1,w&&(w=!1,S(O),O=-1),m=!0;var G=x;try{for($(I),b=n(f);b!==null&&(!(b.expirationTime>I)||L&&!D());){var P=b.callback;if(typeof P=="function"){b.callback=null,x=b.priorityLevel;var q=P(b.expirationTime<=I);I=e.unstable_now(),typeof q=="function"?b.callback=q:b===n(f)&&o(f),$(I)}else o(f);b=n(f)}if(b!==null)var ne=!0;else{var ae=n(p);ae!==null&&K(_,ae.startTime-I),ne=!1}return ne}finally{b=null,x=G,m=!1}}var R=!1,C=null,O=-1,z=5,F=-1;function D(){return!(e.unstable_now()-F<z)}function B(){if(C!==null){var L=e.unstable_now();F=L;var I=!0;try{I=C(!0,L)}finally{I?U():(R=!1,C=null)}}else R=!1}var U;if(typeof T=="function")U=function(){T(B)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,X=W.port2;W.port1.onmessage=B,U=function(){X.postMessage(null)}}else U=function(){j(B,0)};function M(L){C=L,R||(R=!0,U())}function K(L,I){O=j(function(){L(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(L){L.callback=null},e.unstable_continueExecution=function(){v||m||(v=!0,M(E))},e.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<L?Math.floor(1e3/L):5},e.unstable_getCurrentPriorityLevel=function(){return x},e.unstable_getFirstCallbackNode=function(){return n(f)},e.unstable_next=function(L){switch(x){case 1:case 2:case 3:var I=3;break;default:I=x}var G=x;x=I;try{return L()}finally{x=G}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(L,I){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var G=x;x=L;try{return I()}finally{x=G}},e.unstable_scheduleCallback=function(L,I,G){var P=e.unstable_now();switch(typeof G=="object"&&G!==null?(G=G.delay,G=typeof G=="number"&&0<G?P+G:P):G=P,L){case 1:var q=-1;break;case 2:q=250;break;case 5:q=1073741823;break;case 4:q=1e4;break;default:q=5e3}return q=G+q,L={id:h++,callback:I,priorityLevel:L,startTime:G,expirationTime:q,sortIndex:-1},G>P?(L.sortIndex=G,t(p,L),n(f)===null&&L===n(p)&&(w?(S(O),O=-1):w=!0,K(_,G-P))):(L.sortIndex=q,t(f,L),v||m||(v=!0,M(E))),L},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(L){var I=x;return function(){var G=x;x=I;try{return L.apply(this,arguments)}finally{x=G}}}})(Dm)),Dm}var hv;function D2(){return hv||(hv=1,zm.exports=z2()),zm.exports}/**
|
|
26
|
-
* @license React
|
|
27
|
-
* react-dom.production.min.js
|
|
28
|
-
*
|
|
29
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the MIT license found in the
|
|
32
|
-
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var gv;function F2(){if(gv)return Fn;gv=1;var e=md(),t=D2();function n(r){for(var a="https://reactjs.org/docs/error-decoder.html?invariant="+r,d=1;d<arguments.length;d++)a+="&args[]="+encodeURIComponent(arguments[d]);return"Minified React error #"+r+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var o=new Set,i={};function l(r,a){c(r,a),c(r+"Capture",a)}function c(r,a){for(i[r]=a,r=0;r<a.length;r++)o.add(a[r])}var u=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),f=Object.prototype.hasOwnProperty,p=/^[: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]*$/,h={},b={};function x(r){return f.call(b,r)?!0:f.call(h,r)?!1:p.test(r)?b[r]=!0:(h[r]=!0,!1)}function m(r,a,d,g){if(d!==null&&d.type===0)return!1;switch(typeof a){case"function":case"symbol":return!0;case"boolean":return g?!1:d!==null?!d.acceptsBooleans:(r=r.toLowerCase().slice(0,5),r!=="data-"&&r!=="aria-");default:return!1}}function v(r,a,d,g){if(a===null||typeof a>"u"||m(r,a,d,g))return!0;if(g)return!1;if(d!==null)switch(d.type){case 3:return!a;case 4:return a===!1;case 5:return isNaN(a);case 6:return isNaN(a)||1>a}return!1}function w(r,a,d,g,k,N,A){this.acceptsBooleans=a===2||a===3||a===4,this.attributeName=g,this.attributeNamespace=k,this.mustUseProperty=d,this.propertyName=r,this.type=a,this.sanitizeURL=N,this.removeEmptyString=A}var j={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(r){j[r]=new w(r,0,!1,r,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(r){var a=r[0];j[a]=new w(a,1,!1,r[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(r){j[r]=new w(r,2,!1,r.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(r){j[r]=new w(r,2,!1,r,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(r){j[r]=new w(r,3,!1,r.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(r){j[r]=new w(r,3,!0,r,null,!1,!1)}),["capture","download"].forEach(function(r){j[r]=new w(r,4,!1,r,null,!1,!1)}),["cols","rows","size","span"].forEach(function(r){j[r]=new w(r,6,!1,r,null,!1,!1)}),["rowSpan","start"].forEach(function(r){j[r]=new w(r,5,!1,r.toLowerCase(),null,!1,!1)});var S=/[\-:]([a-z])/g;function T(r){return r[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(r){var a=r.replace(S,T);j[a]=new w(a,1,!1,r,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(r){var a=r.replace(S,T);j[a]=new w(a,1,!1,r,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(r){var a=r.replace(S,T);j[a]=new w(a,1,!1,r,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(r){j[r]=new w(r,1,!1,r.toLowerCase(),null,!1,!1)}),j.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(r){j[r]=new w(r,1,!1,r.toLowerCase(),null,!0,!0)});function $(r,a,d,g){var k=j.hasOwnProperty(a)?j[a]:null;(k!==null?k.type!==0:g||!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(v(a,d,k,g)&&(d=null),g||k===null?x(a)&&(d===null?r.removeAttribute(a):r.setAttribute(a,""+d)):k.mustUseProperty?r[k.propertyName]=d===null?k.type===3?!1:"":d:(a=k.attributeName,g=k.attributeNamespace,d===null?r.removeAttribute(a):(k=k.type,d=k===3||k===4&&d===!0?"":""+d,g?r.setAttributeNS(g,a,d):r.setAttribute(a,d))))}var _=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,E=Symbol.for("react.element"),R=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),z=Symbol.for("react.profiler"),F=Symbol.for("react.provider"),D=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),K=Symbol.for("react.offscreen"),L=Symbol.iterator;function I(r){return r===null||typeof r!="object"?null:(r=L&&r[L]||r["@@iterator"],typeof r=="function"?r:null)}var G=Object.assign,P;function q(r){if(P===void 0)try{throw Error()}catch(d){var a=d.stack.trim().match(/\n( *(at )?)/);P=a&&a[1]||""}return`
|
|
34
|
-
`+P+r}var ne=!1;function ae(r,a){if(!r||ne)return"";ne=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(a)if(a=function(){throw Error()},Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(re){var g=re}Reflect.construct(r,[],a)}else{try{a.call()}catch(re){g=re}r.call(a.prototype)}else{try{throw Error()}catch(re){g=re}r()}}catch(re){if(re&&g&&typeof re.stack=="string"){for(var k=re.stack.split(`
|
|
35
|
-
`),N=g.stack.split(`
|
|
36
|
-
`),A=k.length-1,H=N.length-1;1<=A&&0<=H&&k[A]!==N[H];)H--;for(;1<=A&&0<=H;A--,H--)if(k[A]!==N[H]){if(A!==1||H!==1)do if(A--,H--,0>H||k[A]!==N[H]){var V=`
|
|
37
|
-
`+k[A].replace(" at new "," at ");return r.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",r.displayName)),V}while(1<=A&&0<=H);break}}}finally{ne=!1,Error.prepareStackTrace=d}return(r=r?r.displayName||r.name:"")?q(r):""}function ie(r){switch(r.tag){case 5:return q(r.type);case 16:return q("Lazy");case 13:return q("Suspense");case 19:return q("SuspenseList");case 0:case 2:case 15:return r=ae(r.type,!1),r;case 11:return r=ae(r.type.render,!1),r;case 1:return r=ae(r.type,!0),r;default:return""}}function ce(r){if(r==null)return null;if(typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case C:return"Fragment";case R:return"Portal";case z:return"Profiler";case O:return"StrictMode";case U:return"Suspense";case W:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case D:return(r.displayName||"Context")+".Consumer";case F:return(r._context.displayName||"Context")+".Provider";case B:var a=r.render;return r=r.displayName,r||(r=a.displayName||a.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case X:return a=r.displayName||null,a!==null?a:ce(r.type)||"Memo";case M:a=r._payload,r=r._init;try{return ce(r(a))}catch{}}return null}function le(r){var a=r.type;switch(r.tag){case 24:return"Cache";case 9:return(a.displayName||"Context")+".Consumer";case 10:return(a._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return r=a.render,r=r.displayName||r.name||"",a.displayName||(r!==""?"ForwardRef("+r+")":"ForwardRef");case 7:return"Fragment";case 5:return a;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ce(a);case 8:return a===O?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a}return null}function ye(r){switch(typeof r){case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function ee(r){var a=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function be(r){var a=ee(r)?"checked":"value",d=Object.getOwnPropertyDescriptor(r.constructor.prototype,a),g=""+r[a];if(!r.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var k=d.get,N=d.set;return Object.defineProperty(r,a,{configurable:!0,get:function(){return k.call(this)},set:function(A){g=""+A,N.call(this,A)}}),Object.defineProperty(r,a,{enumerable:d.enumerable}),{getValue:function(){return g},setValue:function(A){g=""+A},stopTracking:function(){r._valueTracker=null,delete r[a]}}}}function Oe(r){r._valueTracker||(r._valueTracker=be(r))}function We(r){if(!r)return!1;var a=r._valueTracker;if(!a)return!0;var d=a.getValue(),g="";return r&&(g=ee(r)?r.checked?"true":"false":r.value),r=g,r!==d?(a.setValue(r),!0):!1}function fe(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Re(r,a){var d=a.checked;return G({},a,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:d??r._wrapperState.initialChecked})}function Xe(r,a){var d=a.defaultValue==null?"":a.defaultValue,g=a.checked!=null?a.checked:a.defaultChecked;d=ye(a.value!=null?a.value:d),r._wrapperState={initialChecked:g,initialValue:d,controlled:a.type==="checkbox"||a.type==="radio"?a.checked!=null:a.value!=null}}function Yt(r,a){a=a.checked,a!=null&&$(r,"checked",a,!1)}function De(r,a){Yt(r,a);var d=ye(a.value),g=a.type;if(d!=null)g==="number"?(d===0&&r.value===""||r.value!=d)&&(r.value=""+d):r.value!==""+d&&(r.value=""+d);else if(g==="submit"||g==="reset"){r.removeAttribute("value");return}a.hasOwnProperty("value")?Ht(r,a.type,d):a.hasOwnProperty("defaultValue")&&Ht(r,a.type,ye(a.defaultValue)),a.checked==null&&a.defaultChecked!=null&&(r.defaultChecked=!!a.defaultChecked)}function et(r,a,d){if(a.hasOwnProperty("value")||a.hasOwnProperty("defaultValue")){var g=a.type;if(!(g!=="submit"&&g!=="reset"||a.value!==void 0&&a.value!==null))return;a=""+r._wrapperState.initialValue,d||a===r.value||(r.value=a),r.defaultValue=a}d=r.name,d!==""&&(r.name=""),r.defaultChecked=!!r._wrapperState.initialChecked,d!==""&&(r.name=d)}function Ht(r,a,d){(a!=="number"||fe(r.ownerDocument)!==r)&&(d==null?r.defaultValue=""+r._wrapperState.initialValue:r.defaultValue!==""+d&&(r.defaultValue=""+d))}var Bt=Array.isArray;function _t(r,a,d,g){if(r=r.options,a){a={};for(var k=0;k<d.length;k++)a["$"+d[k]]=!0;for(d=0;d<r.length;d++)k=a.hasOwnProperty("$"+r[d].value),r[d].selected!==k&&(r[d].selected=k),k&&g&&(r[d].defaultSelected=!0)}else{for(d=""+ye(d),a=null,k=0;k<r.length;k++){if(r[k].value===d){r[k].selected=!0,g&&(r[k].defaultSelected=!0);return}a!==null||r[k].disabled||(a=r[k])}a!==null&&(a.selected=!0)}}function os(r,a){if(a.dangerouslySetInnerHTML!=null)throw Error(n(91));return G({},a,{value:void 0,defaultValue:void 0,children:""+r._wrapperState.initialValue})}function gn(r,a){var d=a.value;if(d==null){if(d=a.children,a=a.defaultValue,d!=null){if(a!=null)throw Error(n(92));if(Bt(d)){if(1<d.length)throw Error(n(93));d=d[0]}a=d}a==null&&(a=""),d=a}r._wrapperState={initialValue:ye(d)}}function Qt(r,a){var d=ye(a.value),g=ye(a.defaultValue);d!=null&&(d=""+d,d!==r.value&&(r.value=d),a.defaultValue==null&&r.defaultValue!==d&&(r.defaultValue=d)),g!=null&&(r.defaultValue=""+g)}function ot(r){var a=r.textContent;a===r._wrapperState.initialValue&&a!==""&&a!==null&&(r.value=a)}function ct(r){switch(r){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Pe(r,a){return r==null||r==="http://www.w3.org/1999/xhtml"?ct(a):r==="http://www.w3.org/2000/svg"&&a==="foreignObject"?"http://www.w3.org/1999/xhtml":r}var Le,Mt=(function(r){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(a,d,g,k){MSApp.execUnsafeLocalFunction(function(){return r(a,d,g,k)})}:r})(function(r,a){if(r.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in r)r.innerHTML=a;else{for(Le=Le||document.createElement("div"),Le.innerHTML="<svg>"+a.valueOf().toString()+"</svg>",a=Le.firstChild;r.firstChild;)r.removeChild(r.firstChild);for(;a.firstChild;)r.appendChild(a.firstChild)}});function ut(r,a){if(a){var d=r.firstChild;if(d&&d===r.lastChild&&d.nodeType===3){d.nodeValue=a;return}}r.textContent=a}var It={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},En=["Webkit","ms","Moz","O"];Object.keys(It).forEach(function(r){En.forEach(function(a){a=a+r.charAt(0).toUpperCase()+r.substring(1),It[a]=It[r]})});function Tn(r,a,d){return a==null||typeof a=="boolean"||a===""?"":d||typeof a!="number"||a===0||It.hasOwnProperty(r)&&It[r]?(""+a).trim():a+"px"}function Zt(r,a){r=r.style;for(var d in a)if(a.hasOwnProperty(d)){var g=d.indexOf("--")===0,k=Tn(d,a[d],g);d==="float"&&(d="cssFloat"),g?r.setProperty(d,k):r[d]=k}}var Hn=G({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function as(r,a){if(a){if(Hn[r]&&(a.children!=null||a.dangerouslySetInnerHTML!=null))throw Error(n(137,r));if(a.dangerouslySetInnerHTML!=null){if(a.children!=null)throw Error(n(60));if(typeof a.dangerouslySetInnerHTML!="object"||!("__html"in a.dangerouslySetInnerHTML))throw Error(n(61))}if(a.style!=null&&typeof a.style!="object")throw Error(n(62))}}function is(r,a){if(r.indexOf("-")===-1)return typeof a.is=="string";switch(r){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 Cn=null;function Bn(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var Gn=null,J=null,we=null;function Ge(r){if(r=_i(r)){if(typeof Gn!="function")throw Error(n(280));var a=r.stateNode;a&&(a=xc(a),Gn(r.stateNode,r.type,a))}}function dt(r){J?we?we.push(r):we=[r]:J=r}function Ke(){if(J){var r=J,a=we;if(we=J=null,Ge(r),a)for(r=0;r<a.length;r++)Ge(a[r])}}function $t(r,a){return r(a)}function on(){}var bt=!1;function Hs(r,a,d){if(bt)return r(a,d);bt=!0;try{return $t(r,a,d)}finally{bt=!1,(J!==null||we!==null)&&(on(),Ke())}}function an(r,a){var d=r.stateNode;if(d===null)return null;var g=xc(d);if(g===null)return null;d=g[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(g=!g.disabled)||(r=r.type,g=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!g;break e;default:r=!1}if(r)return null;if(d&&typeof d!="function")throw Error(n(231,a,typeof d));return d}var $s=!1;if(u)try{var Rn={};Object.defineProperty(Rn,"passive",{get:function(){$s=!0}}),window.addEventListener("test",Rn,Rn),window.removeEventListener("test",Rn,Rn)}catch{$s=!1}function An(r,a,d,g,k,N,A,H,V){var re=Array.prototype.slice.call(arguments,3);try{a.apply(d,re)}catch(de){this.onError(de)}}var ls=!1,rr=null,or=!1,Bs=null,Yo={onError:function(r){ls=!0,rr=r}};function On(r,a,d,g,k,N,A,H,V){ls=!1,rr=null,An.apply(Yo,arguments)}function fo(r,a,d,g,k,N,A,H,V){if(On.apply(this,arguments),ls){if(ls){var re=rr;ls=!1,rr=null}else throw Error(n(198));or||(or=!0,Bs=re)}}function qn(r){var a=r,d=r;if(r.alternate)for(;a.return;)a=a.return;else{r=a;do a=r,(a.flags&4098)!==0&&(d=a.return),r=a.return;while(r)}return a.tag===3?d:null}function Nr(r){if(r.tag===13){var a=r.memoizedState;if(a===null&&(r=r.alternate,r!==null&&(a=r.memoizedState)),a!==null)return a.dehydrated}return null}function Sr(r){if(qn(r)!==r)throw Error(n(188))}function Qo(r){var a=r.alternate;if(!a){if(a=qn(r),a===null)throw Error(n(188));return a!==r?null:r}for(var d=r,g=a;;){var k=d.return;if(k===null)break;var N=k.alternate;if(N===null){if(g=k.return,g!==null){d=g;continue}break}if(k.child===N.child){for(N=k.child;N;){if(N===d)return Sr(k),r;if(N===g)return Sr(k),a;N=N.sibling}throw Error(n(188))}if(d.return!==g.return)d=k,g=N;else{for(var A=!1,H=k.child;H;){if(H===d){A=!0,d=k,g=N;break}if(H===g){A=!0,g=k,d=N;break}H=H.sibling}if(!A){for(H=N.child;H;){if(H===d){A=!0,d=N,g=k;break}if(H===g){A=!0,g=N,d=k;break}H=H.sibling}if(!A)throw Error(n(189))}}if(d.alternate!==g)throw Error(n(190))}if(d.tag!==3)throw Error(n(188));return d.stateNode.current===d?r:a}function Ae(r){return r=Qo(r),r!==null?Y(r):null}function Y(r){if(r.tag===5||r.tag===6)return r;for(r=r.child;r!==null;){var a=Y(r);if(a!==null)return a;r=r.sibling}return null}var pe=t.unstable_scheduleCallback,Ne=t.unstable_cancelCallback,at=t.unstable_shouldYield,Ct=t.unstable_requestPaint,Be=t.unstable_now,zt=t.unstable_getCurrentPriorityLevel,Jt=t.unstable_ImmediatePriority,Es=t.unstable_UserBlockingPriority,wt=t.unstable_NormalPriority,mo=t.unstable_LowPriority,_r=t.unstable_IdlePriority,po=null,Vn=null;function ec(r){if(Vn&&typeof Vn.onCommitFiberRoot=="function")try{Vn.onCommitFiberRoot(po,r,void 0,(r.current.flags&128)===128)}catch{}}var Mn=Math.clz32?Math.clz32:Te,he=Math.log,xe=Math.LN2;function Te(r){return r>>>=0,r===0?32:31-(he(r)/xe|0)|0}var Je=64,qe=4194304;function xt(r){switch(r&-r){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: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 r&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return r&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return r}}function Dt(r,a){var d=r.pendingLanes;if(d===0)return 0;var g=0,k=r.suspendedLanes,N=r.pingedLanes,A=d&268435455;if(A!==0){var H=A&~k;H!==0?g=xt(H):(N&=A,N!==0&&(g=xt(N)))}else A=d&~k,A!==0?g=xt(A):N!==0&&(g=xt(N));if(g===0)return 0;if(a!==0&&a!==g&&(a&k)===0&&(k=g&-g,N=a&-a,k>=N||k===16&&(N&4194240)!==0))return a;if((g&4)!==0&&(g|=d&16),a=r.entangledLanes,a!==0)for(r=r.entanglements,a&=g;0<a;)d=31-Mn(a),k=1<<d,g|=r[d],a&=~k;return g}function nf(r,a){switch(r){case 1:case 2:case 4:return a+250;case 8:case 16:case 32:case 64: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 a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ai(r,a){for(var d=r.suspendedLanes,g=r.pingedLanes,k=r.expirationTimes,N=r.pendingLanes;0<N;){var A=31-Mn(N),H=1<<A,V=k[A];V===-1?((H&d)===0||(H&g)!==0)&&(k[A]=nf(H,a)):V<=a&&(r.expiredLanes|=H),N&=~H}}function ii(r){return r=r.pendingLanes&-1073741825,r!==0?r:r&1073741824?1073741824:0}function li(){var r=Je;return Je<<=1,(Je&4194240)===0&&(Je=64),r}function ci(r){for(var a=[],d=0;31>d;d++)a.push(r);return a}function ar(r,a,d){r.pendingLanes|=a,a!==536870912&&(r.suspendedLanes=0,r.pingedLanes=0),r=r.eventTimes,a=31-Mn(a),r[a]=d}function tc(r,a){var d=r.pendingLanes&~a;r.pendingLanes=a,r.suspendedLanes=0,r.pingedLanes=0,r.expiredLanes&=a,r.mutableReadLanes&=a,r.entangledLanes&=a,a=r.entanglements;var g=r.eventTimes;for(r=r.expirationTimes;0<d;){var k=31-Mn(d),N=1<<k;a[k]=0,g[k]=-1,r[k]=-1,d&=~N}}function sf(r,a){var d=r.entangledLanes|=a;for(r=r.entanglements;d;){var g=31-Mn(d),k=1<<g;k&a|r[g]&a&&(r[g]|=a),d&=~k}}var it=0;function Wg(r){return r&=-r,1<r?4<r?(r&268435455)!==0?16:536870912:4:1}var Hg,rf,Bg,Gg,qg,of=!1,nc=[],$r=null,Er=null,Tr=null,ui=new Map,di=new Map,Cr=[],eS="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 submit".split(" ");function Vg(r,a){switch(r){case"focusin":case"focusout":$r=null;break;case"dragenter":case"dragleave":Er=null;break;case"mouseover":case"mouseout":Tr=null;break;case"pointerover":case"pointerout":ui.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":di.delete(a.pointerId)}}function fi(r,a,d,g,k,N){return r===null||r.nativeEvent!==N?(r={blockedOn:a,domEventName:d,eventSystemFlags:g,nativeEvent:N,targetContainers:[k]},a!==null&&(a=_i(a),a!==null&&rf(a)),r):(r.eventSystemFlags|=g,a=r.targetContainers,k!==null&&a.indexOf(k)===-1&&a.push(k),r)}function tS(r,a,d,g,k){switch(a){case"focusin":return $r=fi($r,r,a,d,g,k),!0;case"dragenter":return Er=fi(Er,r,a,d,g,k),!0;case"mouseover":return Tr=fi(Tr,r,a,d,g,k),!0;case"pointerover":var N=k.pointerId;return ui.set(N,fi(ui.get(N)||null,r,a,d,g,k)),!0;case"gotpointercapture":return N=k.pointerId,di.set(N,fi(di.get(N)||null,r,a,d,g,k)),!0}return!1}function Kg(r){var a=ho(r.target);if(a!==null){var d=qn(a);if(d!==null){if(a=d.tag,a===13){if(a=Nr(d),a!==null){r.blockedOn=a,qg(r.priority,function(){Bg(d)});return}}else if(a===3&&d.stateNode.current.memoizedState.isDehydrated){r.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}r.blockedOn=null}function sc(r){if(r.blockedOn!==null)return!1;for(var a=r.targetContainers;0<a.length;){var d=lf(r.domEventName,r.eventSystemFlags,a[0],r.nativeEvent);if(d===null){d=r.nativeEvent;var g=new d.constructor(d.type,d);Cn=g,d.target.dispatchEvent(g),Cn=null}else return a=_i(d),a!==null&&rf(a),r.blockedOn=d,!1;a.shift()}return!0}function Xg(r,a,d){sc(r)&&d.delete(a)}function nS(){of=!1,$r!==null&&sc($r)&&($r=null),Er!==null&&sc(Er)&&(Er=null),Tr!==null&&sc(Tr)&&(Tr=null),ui.forEach(Xg),di.forEach(Xg)}function mi(r,a){r.blockedOn===a&&(r.blockedOn=null,of||(of=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,nS)))}function pi(r){function a(k){return mi(k,r)}if(0<nc.length){mi(nc[0],r);for(var d=1;d<nc.length;d++){var g=nc[d];g.blockedOn===r&&(g.blockedOn=null)}}for($r!==null&&mi($r,r),Er!==null&&mi(Er,r),Tr!==null&&mi(Tr,r),ui.forEach(a),di.forEach(a),d=0;d<Cr.length;d++)g=Cr[d],g.blockedOn===r&&(g.blockedOn=null);for(;0<Cr.length&&(d=Cr[0],d.blockedOn===null);)Kg(d),d.blockedOn===null&&Cr.shift()}var Zo=_.ReactCurrentBatchConfig,rc=!0;function sS(r,a,d,g){var k=it,N=Zo.transition;Zo.transition=null;try{it=1,af(r,a,d,g)}finally{it=k,Zo.transition=N}}function rS(r,a,d,g){var k=it,N=Zo.transition;Zo.transition=null;try{it=4,af(r,a,d,g)}finally{it=k,Zo.transition=N}}function af(r,a,d,g){if(rc){var k=lf(r,a,d,g);if(k===null)Sf(r,a,g,oc,d),Vg(r,g);else if(tS(k,r,a,d,g))g.stopPropagation();else if(Vg(r,g),a&4&&-1<eS.indexOf(r)){for(;k!==null;){var N=_i(k);if(N!==null&&Hg(N),N=lf(r,a,d,g),N===null&&Sf(r,a,g,oc,d),N===k)break;k=N}k!==null&&g.stopPropagation()}else Sf(r,a,g,null,d)}}var oc=null;function lf(r,a,d,g){if(oc=null,r=Bn(g),r=ho(r),r!==null)if(a=qn(r),a===null)r=null;else if(d=a.tag,d===13){if(r=Nr(a),r!==null)return r;r=null}else if(d===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;r=null}else a!==r&&(r=null);return oc=r,null}function Yg(r){switch(r){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(zt()){case Jt:return 1;case Es:return 4;case wt:case mo:return 16;case _r:return 536870912;default:return 16}default:return 16}}var Rr=null,cf=null,ac=null;function Qg(){if(ac)return ac;var r,a=cf,d=a.length,g,k="value"in Rr?Rr.value:Rr.textContent,N=k.length;for(r=0;r<d&&a[r]===k[r];r++);var A=d-r;for(g=1;g<=A&&a[d-g]===k[N-g];g++);return ac=k.slice(r,1<g?1-g:void 0)}function ic(r){var a=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&a===13&&(r=13)):r=a,r===10&&(r=13),32<=r||r===13?r:0}function lc(){return!0}function Zg(){return!1}function Kn(r){function a(d,g,k,N,A){this._reactName=d,this._targetInst=k,this.type=g,this.nativeEvent=N,this.target=A,this.currentTarget=null;for(var H in r)r.hasOwnProperty(H)&&(d=r[H],this[H]=d?d(N):N[H]);return this.isDefaultPrevented=(N.defaultPrevented!=null?N.defaultPrevented:N.returnValue===!1)?lc:Zg,this.isPropagationStopped=Zg,this}return G(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=lc)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=lc)},persist:function(){},isPersistent:lc}),a}var Jo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uf=Kn(Jo),hi=G({},Jo,{view:0,detail:0}),oS=Kn(hi),df,ff,gi,cc=G({},hi,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pf,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==gi&&(gi&&r.type==="mousemove"?(df=r.screenX-gi.screenX,ff=r.screenY-gi.screenY):ff=df=0,gi=r),df)},movementY:function(r){return"movementY"in r?r.movementY:ff}}),Jg=Kn(cc),aS=G({},cc,{dataTransfer:0}),iS=Kn(aS),lS=G({},hi,{relatedTarget:0}),mf=Kn(lS),cS=G({},Jo,{animationName:0,elapsedTime:0,pseudoElement:0}),uS=Kn(cS),dS=G({},Jo,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),fS=Kn(dS),mS=G({},Jo,{data:0}),ex=Kn(mS),pS={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},hS={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"},gS={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function xS(r){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(r):(r=gS[r])?!!a[r]:!1}function pf(){return xS}var yS=G({},hi,{key:function(r){if(r.key){var a=pS[r.key]||r.key;if(a!=="Unidentified")return a}return r.type==="keypress"?(r=ic(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?hS[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pf,charCode:function(r){return r.type==="keypress"?ic(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ic(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),vS=Kn(yS),bS=G({},cc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tx=Kn(bS),wS=G({},hi,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pf}),kS=Kn(wS),jS=G({},Jo,{propertyName:0,elapsedTime:0,pseudoElement:0}),NS=Kn(jS),SS=G({},cc,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),_S=Kn(SS),$S=[9,13,27,32],hf=u&&"CompositionEvent"in window,xi=null;u&&"documentMode"in document&&(xi=document.documentMode);var ES=u&&"TextEvent"in window&&!xi,nx=u&&(!hf||xi&&8<xi&&11>=xi),sx=" ",rx=!1;function ox(r,a){switch(r){case"keyup":return $S.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ax(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var ea=!1;function TS(r,a){switch(r){case"compositionend":return ax(a);case"keypress":return a.which!==32?null:(rx=!0,sx);case"textInput":return r=a.data,r===sx&&rx?null:r;default:return null}}function CS(r,a){if(ea)return r==="compositionend"||!hf&&ox(r,a)?(r=Qg(),ac=cf=Rr=null,ea=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return nx&&a.locale!=="ko"?null:a.data;default:return null}}var RS={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 ix(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a==="input"?!!RS[r.type]:a==="textarea"}function lx(r,a,d,g){dt(g),a=pc(a,"onChange"),0<a.length&&(d=new uf("onChange","change",null,d,g),r.push({event:d,listeners:a}))}var yi=null,vi=null;function AS(r){_x(r,0)}function uc(r){var a=oa(r);if(We(a))return r}function OS(r,a){if(r==="change")return a}var cx=!1;if(u){var gf;if(u){var xf="oninput"in document;if(!xf){var ux=document.createElement("div");ux.setAttribute("oninput","return;"),xf=typeof ux.oninput=="function"}gf=xf}else gf=!1;cx=gf&&(!document.documentMode||9<document.documentMode)}function dx(){yi&&(yi.detachEvent("onpropertychange",fx),vi=yi=null)}function fx(r){if(r.propertyName==="value"&&uc(vi)){var a=[];lx(a,vi,r,Bn(r)),Hs(AS,a)}}function MS(r,a,d){r==="focusin"?(dx(),yi=a,vi=d,yi.attachEvent("onpropertychange",fx)):r==="focusout"&&dx()}function PS(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return uc(vi)}function LS(r,a){if(r==="click")return uc(a)}function IS(r,a){if(r==="input"||r==="change")return uc(a)}function zS(r,a){return r===a&&(r!==0||1/r===1/a)||r!==r&&a!==a}var Ts=typeof Object.is=="function"?Object.is:zS;function bi(r,a){if(Ts(r,a))return!0;if(typeof r!="object"||r===null||typeof a!="object"||a===null)return!1;var d=Object.keys(r),g=Object.keys(a);if(d.length!==g.length)return!1;for(g=0;g<d.length;g++){var k=d[g];if(!f.call(a,k)||!Ts(r[k],a[k]))return!1}return!0}function mx(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function px(r,a){var d=mx(r);r=0;for(var g;d;){if(d.nodeType===3){if(g=r+d.textContent.length,r<=a&&g>=a)return{node:d,offset:a-r};r=g}e:{for(;d;){if(d.nextSibling){d=d.nextSibling;break e}d=d.parentNode}d=void 0}d=mx(d)}}function hx(r,a){return r&&a?r===a?!0:r&&r.nodeType===3?!1:a&&a.nodeType===3?hx(r,a.parentNode):"contains"in r?r.contains(a):r.compareDocumentPosition?!!(r.compareDocumentPosition(a)&16):!1:!1}function gx(){for(var r=window,a=fe();a instanceof r.HTMLIFrameElement;){try{var d=typeof a.contentWindow.location.href=="string"}catch{d=!1}if(d)r=a.contentWindow;else break;a=fe(r.document)}return a}function yf(r){var a=r&&r.nodeName&&r.nodeName.toLowerCase();return a&&(a==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||a==="textarea"||r.contentEditable==="true")}function DS(r){var a=gx(),d=r.focusedElem,g=r.selectionRange;if(a!==d&&d&&d.ownerDocument&&hx(d.ownerDocument.documentElement,d)){if(g!==null&&yf(d)){if(a=g.start,r=g.end,r===void 0&&(r=a),"selectionStart"in d)d.selectionStart=a,d.selectionEnd=Math.min(r,d.value.length);else if(r=(a=d.ownerDocument||document)&&a.defaultView||window,r.getSelection){r=r.getSelection();var k=d.textContent.length,N=Math.min(g.start,k);g=g.end===void 0?N:Math.min(g.end,k),!r.extend&&N>g&&(k=g,g=N,N=k),k=px(d,N);var A=px(d,g);k&&A&&(r.rangeCount!==1||r.anchorNode!==k.node||r.anchorOffset!==k.offset||r.focusNode!==A.node||r.focusOffset!==A.offset)&&(a=a.createRange(),a.setStart(k.node,k.offset),r.removeAllRanges(),N>g?(r.addRange(a),r.extend(A.node,A.offset)):(a.setEnd(A.node,A.offset),r.addRange(a)))}}for(a=[],r=d;r=r.parentNode;)r.nodeType===1&&a.push({element:r,left:r.scrollLeft,top:r.scrollTop});for(typeof d.focus=="function"&&d.focus(),d=0;d<a.length;d++)r=a[d],r.element.scrollLeft=r.left,r.element.scrollTop=r.top}}var FS=u&&"documentMode"in document&&11>=document.documentMode,ta=null,vf=null,wi=null,bf=!1;function xx(r,a,d){var g=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;bf||ta==null||ta!==fe(g)||(g=ta,"selectionStart"in g&&yf(g)?g={start:g.selectionStart,end:g.selectionEnd}:(g=(g.ownerDocument&&g.ownerDocument.defaultView||window).getSelection(),g={anchorNode:g.anchorNode,anchorOffset:g.anchorOffset,focusNode:g.focusNode,focusOffset:g.focusOffset}),wi&&bi(wi,g)||(wi=g,g=pc(vf,"onSelect"),0<g.length&&(a=new uf("onSelect","select",null,a,d),r.push({event:a,listeners:g}),a.target=ta)))}function dc(r,a){var d={};return d[r.toLowerCase()]=a.toLowerCase(),d["Webkit"+r]="webkit"+a,d["Moz"+r]="moz"+a,d}var na={animationend:dc("Animation","AnimationEnd"),animationiteration:dc("Animation","AnimationIteration"),animationstart:dc("Animation","AnimationStart"),transitionend:dc("Transition","TransitionEnd")},wf={},yx={};u&&(yx=document.createElement("div").style,"AnimationEvent"in window||(delete na.animationend.animation,delete na.animationiteration.animation,delete na.animationstart.animation),"TransitionEvent"in window||delete na.transitionend.transition);function fc(r){if(wf[r])return wf[r];if(!na[r])return r;var a=na[r],d;for(d in a)if(a.hasOwnProperty(d)&&d in yx)return wf[r]=a[d];return r}var vx=fc("animationend"),bx=fc("animationiteration"),wx=fc("animationstart"),kx=fc("transitionend"),jx=new Map,Nx="abort auxClick 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(" ");function Ar(r,a){jx.set(r,a),l(a,[r])}for(var kf=0;kf<Nx.length;kf++){var jf=Nx[kf],US=jf.toLowerCase(),WS=jf[0].toUpperCase()+jf.slice(1);Ar(US,"on"+WS)}Ar(vx,"onAnimationEnd"),Ar(bx,"onAnimationIteration"),Ar(wx,"onAnimationStart"),Ar("dblclick","onDoubleClick"),Ar("focusin","onFocus"),Ar("focusout","onBlur"),Ar(kx,"onTransitionEnd"),c("onMouseEnter",["mouseout","mouseover"]),c("onMouseLeave",["mouseout","mouseover"]),c("onPointerEnter",["pointerout","pointerover"]),c("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ki="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(" "),HS=new Set("cancel close invalid load scroll toggle".split(" ").concat(ki));function Sx(r,a,d){var g=r.type||"unknown-event";r.currentTarget=d,fo(g,a,void 0,r),r.currentTarget=null}function _x(r,a){a=(a&4)!==0;for(var d=0;d<r.length;d++){var g=r[d],k=g.event;g=g.listeners;e:{var N=void 0;if(a)for(var A=g.length-1;0<=A;A--){var H=g[A],V=H.instance,re=H.currentTarget;if(H=H.listener,V!==N&&k.isPropagationStopped())break e;Sx(k,H,re),N=V}else for(A=0;A<g.length;A++){if(H=g[A],V=H.instance,re=H.currentTarget,H=H.listener,V!==N&&k.isPropagationStopped())break e;Sx(k,H,re),N=V}}}if(or)throw r=Bs,or=!1,Bs=null,r}function pt(r,a){var d=a[Rf];d===void 0&&(d=a[Rf]=new Set);var g=r+"__bubble";d.has(g)||($x(a,r,2,!1),d.add(g))}function Nf(r,a,d){var g=0;a&&(g|=4),$x(d,r,g,a)}var mc="_reactListening"+Math.random().toString(36).slice(2);function ji(r){if(!r[mc]){r[mc]=!0,o.forEach(function(d){d!=="selectionchange"&&(HS.has(d)||Nf(d,!1,r),Nf(d,!0,r))});var a=r.nodeType===9?r:r.ownerDocument;a===null||a[mc]||(a[mc]=!0,Nf("selectionchange",!1,a))}}function $x(r,a,d,g){switch(Yg(a)){case 1:var k=sS;break;case 4:k=rS;break;default:k=af}d=k.bind(null,a,d,r),k=void 0,!$s||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(k=!0),g?k!==void 0?r.addEventListener(a,d,{capture:!0,passive:k}):r.addEventListener(a,d,!0):k!==void 0?r.addEventListener(a,d,{passive:k}):r.addEventListener(a,d,!1)}function Sf(r,a,d,g,k){var N=g;if((a&1)===0&&(a&2)===0&&g!==null)e:for(;;){if(g===null)return;var A=g.tag;if(A===3||A===4){var H=g.stateNode.containerInfo;if(H===k||H.nodeType===8&&H.parentNode===k)break;if(A===4)for(A=g.return;A!==null;){var V=A.tag;if((V===3||V===4)&&(V=A.stateNode.containerInfo,V===k||V.nodeType===8&&V.parentNode===k))return;A=A.return}for(;H!==null;){if(A=ho(H),A===null)return;if(V=A.tag,V===5||V===6){g=N=A;continue e}H=H.parentNode}}g=g.return}Hs(function(){var re=N,de=Bn(d),me=[];e:{var ue=jx.get(r);if(ue!==void 0){var ke=uf,_e=r;switch(r){case"keypress":if(ic(d)===0)break e;case"keydown":case"keyup":ke=vS;break;case"focusin":_e="focus",ke=mf;break;case"focusout":_e="blur",ke=mf;break;case"beforeblur":case"afterblur":ke=mf;break;case"click":if(d.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ke=Jg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ke=iS;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ke=kS;break;case vx:case bx:case wx:ke=uS;break;case kx:ke=NS;break;case"scroll":ke=oS;break;case"wheel":ke=_S;break;case"copy":case"cut":case"paste":ke=fS;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ke=tx}var $e=(a&4)!==0,Rt=!$e&&r==="scroll",te=$e?ue!==null?ue+"Capture":null:ue;$e=[];for(var Q=re,se;Q!==null;){se=Q;var ge=se.stateNode;if(se.tag===5&&ge!==null&&(se=ge,te!==null&&(ge=an(Q,te),ge!=null&&$e.push(Ni(Q,ge,se)))),Rt)break;Q=Q.return}0<$e.length&&(ue=new ke(ue,_e,null,d,de),me.push({event:ue,listeners:$e}))}}if((a&7)===0){e:{if(ue=r==="mouseover"||r==="pointerover",ke=r==="mouseout"||r==="pointerout",ue&&d!==Cn&&(_e=d.relatedTarget||d.fromElement)&&(ho(_e)||_e[ir]))break e;if((ke||ue)&&(ue=de.window===de?de:(ue=de.ownerDocument)?ue.defaultView||ue.parentWindow:window,ke?(_e=d.relatedTarget||d.toElement,ke=re,_e=_e?ho(_e):null,_e!==null&&(Rt=qn(_e),_e!==Rt||_e.tag!==5&&_e.tag!==6)&&(_e=null)):(ke=null,_e=re),ke!==_e)){if($e=Jg,ge="onMouseLeave",te="onMouseEnter",Q="mouse",(r==="pointerout"||r==="pointerover")&&($e=tx,ge="onPointerLeave",te="onPointerEnter",Q="pointer"),Rt=ke==null?ue:oa(ke),se=_e==null?ue:oa(_e),ue=new $e(ge,Q+"leave",ke,d,de),ue.target=Rt,ue.relatedTarget=se,ge=null,ho(de)===re&&($e=new $e(te,Q+"enter",_e,d,de),$e.target=se,$e.relatedTarget=Rt,ge=$e),Rt=ge,ke&&_e)t:{for($e=ke,te=_e,Q=0,se=$e;se;se=sa(se))Q++;for(se=0,ge=te;ge;ge=sa(ge))se++;for(;0<Q-se;)$e=sa($e),Q--;for(;0<se-Q;)te=sa(te),se--;for(;Q--;){if($e===te||te!==null&&$e===te.alternate)break t;$e=sa($e),te=sa(te)}$e=null}else $e=null;ke!==null&&Ex(me,ue,ke,$e,!1),_e!==null&&Rt!==null&&Ex(me,Rt,_e,$e,!0)}}e:{if(ue=re?oa(re):window,ke=ue.nodeName&&ue.nodeName.toLowerCase(),ke==="select"||ke==="input"&&ue.type==="file")var Ce=OS;else if(ix(ue))if(cx)Ce=IS;else{Ce=PS;var Ie=MS}else(ke=ue.nodeName)&&ke.toLowerCase()==="input"&&(ue.type==="checkbox"||ue.type==="radio")&&(Ce=LS);if(Ce&&(Ce=Ce(r,re))){lx(me,Ce,d,de);break e}Ie&&Ie(r,ue,re),r==="focusout"&&(Ie=ue._wrapperState)&&Ie.controlled&&ue.type==="number"&&Ht(ue,"number",ue.value)}switch(Ie=re?oa(re):window,r){case"focusin":(ix(Ie)||Ie.contentEditable==="true")&&(ta=Ie,vf=re,wi=null);break;case"focusout":wi=vf=ta=null;break;case"mousedown":bf=!0;break;case"contextmenu":case"mouseup":case"dragend":bf=!1,xx(me,d,de);break;case"selectionchange":if(FS)break;case"keydown":case"keyup":xx(me,d,de)}var ze;if(hf)e:{switch(r){case"compositionstart":var Fe="onCompositionStart";break e;case"compositionend":Fe="onCompositionEnd";break e;case"compositionupdate":Fe="onCompositionUpdate";break e}Fe=void 0}else ea?ox(r,d)&&(Fe="onCompositionEnd"):r==="keydown"&&d.keyCode===229&&(Fe="onCompositionStart");Fe&&(nx&&d.locale!=="ko"&&(ea||Fe!=="onCompositionStart"?Fe==="onCompositionEnd"&&ea&&(ze=Qg()):(Rr=de,cf="value"in Rr?Rr.value:Rr.textContent,ea=!0)),Ie=pc(re,Fe),0<Ie.length&&(Fe=new ex(Fe,r,null,d,de),me.push({event:Fe,listeners:Ie}),ze?Fe.data=ze:(ze=ax(d),ze!==null&&(Fe.data=ze)))),(ze=ES?TS(r,d):CS(r,d))&&(re=pc(re,"onBeforeInput"),0<re.length&&(de=new ex("onBeforeInput","beforeinput",null,d,de),me.push({event:de,listeners:re}),de.data=ze))}_x(me,a)})}function Ni(r,a,d){return{instance:r,listener:a,currentTarget:d}}function pc(r,a){for(var d=a+"Capture",g=[];r!==null;){var k=r,N=k.stateNode;k.tag===5&&N!==null&&(k=N,N=an(r,d),N!=null&&g.unshift(Ni(r,N,k)),N=an(r,a),N!=null&&g.push(Ni(r,N,k))),r=r.return}return g}function sa(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5);return r||null}function Ex(r,a,d,g,k){for(var N=a._reactName,A=[];d!==null&&d!==g;){var H=d,V=H.alternate,re=H.stateNode;if(V!==null&&V===g)break;H.tag===5&&re!==null&&(H=re,k?(V=an(d,N),V!=null&&A.unshift(Ni(d,V,H))):k||(V=an(d,N),V!=null&&A.push(Ni(d,V,H)))),d=d.return}A.length!==0&&r.push({event:a,listeners:A})}var BS=/\r\n?/g,GS=/\u0000|\uFFFD/g;function Tx(r){return(typeof r=="string"?r:""+r).replace(BS,`
|
|
38
|
-
`).replace(GS,"")}function hc(r,a,d){if(a=Tx(a),Tx(r)!==a&&d)throw Error(n(425))}function gc(){}var _f=null,$f=null;function Ef(r,a){return r==="textarea"||r==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Tf=typeof setTimeout=="function"?setTimeout:void 0,qS=typeof clearTimeout=="function"?clearTimeout:void 0,Cx=typeof Promise=="function"?Promise:void 0,VS=typeof queueMicrotask=="function"?queueMicrotask:typeof Cx<"u"?function(r){return Cx.resolve(null).then(r).catch(KS)}:Tf;function KS(r){setTimeout(function(){throw r})}function Cf(r,a){var d=a,g=0;do{var k=d.nextSibling;if(r.removeChild(d),k&&k.nodeType===8)if(d=k.data,d==="/$"){if(g===0){r.removeChild(k),pi(a);return}g--}else d!=="$"&&d!=="$?"&&d!=="$!"||g++;d=k}while(d);pi(a)}function Or(r){for(;r!=null;r=r.nextSibling){var a=r.nodeType;if(a===1||a===3)break;if(a===8){if(a=r.data,a==="$"||a==="$!"||a==="$?")break;if(a==="/$")return null}}return r}function Rx(r){r=r.previousSibling;for(var a=0;r;){if(r.nodeType===8){var d=r.data;if(d==="$"||d==="$!"||d==="$?"){if(a===0)return r;a--}else d==="/$"&&a++}r=r.previousSibling}return null}var ra=Math.random().toString(36).slice(2),Gs="__reactFiber$"+ra,Si="__reactProps$"+ra,ir="__reactContainer$"+ra,Rf="__reactEvents$"+ra,XS="__reactListeners$"+ra,YS="__reactHandles$"+ra;function ho(r){var a=r[Gs];if(a)return a;for(var d=r.parentNode;d;){if(a=d[ir]||d[Gs]){if(d=a.alternate,a.child!==null||d!==null&&d.child!==null)for(r=Rx(r);r!==null;){if(d=r[Gs])return d;r=Rx(r)}return a}r=d,d=r.parentNode}return null}function _i(r){return r=r[Gs]||r[ir],!r||r.tag!==5&&r.tag!==6&&r.tag!==13&&r.tag!==3?null:r}function oa(r){if(r.tag===5||r.tag===6)return r.stateNode;throw Error(n(33))}function xc(r){return r[Si]||null}var Af=[],aa=-1;function Mr(r){return{current:r}}function ht(r){0>aa||(r.current=Af[aa],Af[aa]=null,aa--)}function mt(r,a){aa++,Af[aa]=r.current,r.current=a}var Pr={},ln=Mr(Pr),Pn=Mr(!1),go=Pr;function ia(r,a){var d=r.type.contextTypes;if(!d)return Pr;var g=r.stateNode;if(g&&g.__reactInternalMemoizedUnmaskedChildContext===a)return g.__reactInternalMemoizedMaskedChildContext;var k={},N;for(N in d)k[N]=a[N];return g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=a,r.__reactInternalMemoizedMaskedChildContext=k),k}function Ln(r){return r=r.childContextTypes,r!=null}function yc(){ht(Pn),ht(ln)}function Ax(r,a,d){if(ln.current!==Pr)throw Error(n(168));mt(ln,a),mt(Pn,d)}function Ox(r,a,d){var g=r.stateNode;if(a=a.childContextTypes,typeof g.getChildContext!="function")return d;g=g.getChildContext();for(var k in g)if(!(k in a))throw Error(n(108,le(r)||"Unknown",k));return G({},d,g)}function vc(r){return r=(r=r.stateNode)&&r.__reactInternalMemoizedMergedChildContext||Pr,go=ln.current,mt(ln,r),mt(Pn,Pn.current),!0}function Mx(r,a,d){var g=r.stateNode;if(!g)throw Error(n(169));d?(r=Ox(r,a,go),g.__reactInternalMemoizedMergedChildContext=r,ht(Pn),ht(ln),mt(ln,r)):ht(Pn),mt(Pn,d)}var lr=null,bc=!1,Of=!1;function Px(r){lr===null?lr=[r]:lr.push(r)}function QS(r){bc=!0,Px(r)}function Lr(){if(!Of&&lr!==null){Of=!0;var r=0,a=it;try{var d=lr;for(it=1;r<d.length;r++){var g=d[r];do g=g(!0);while(g!==null)}lr=null,bc=!1}catch(k){throw lr!==null&&(lr=lr.slice(r+1)),pe(Jt,Lr),k}finally{it=a,Of=!1}}return null}var la=[],ca=0,wc=null,kc=0,cs=[],us=0,xo=null,cr=1,ur="";function yo(r,a){la[ca++]=kc,la[ca++]=wc,wc=r,kc=a}function Lx(r,a,d){cs[us++]=cr,cs[us++]=ur,cs[us++]=xo,xo=r;var g=cr;r=ur;var k=32-Mn(g)-1;g&=~(1<<k),d+=1;var N=32-Mn(a)+k;if(30<N){var A=k-k%5;N=(g&(1<<A)-1).toString(32),g>>=A,k-=A,cr=1<<32-Mn(a)+k|d<<k|g,ur=N+r}else cr=1<<N|d<<k|g,ur=r}function Mf(r){r.return!==null&&(yo(r,1),Lx(r,1,0))}function Pf(r){for(;r===wc;)wc=la[--ca],la[ca]=null,kc=la[--ca],la[ca]=null;for(;r===xo;)xo=cs[--us],cs[us]=null,ur=cs[--us],cs[us]=null,cr=cs[--us],cs[us]=null}var Xn=null,Yn=null,yt=!1,Cs=null;function Ix(r,a){var d=ps(5,null,null,0);d.elementType="DELETED",d.stateNode=a,d.return=r,a=r.deletions,a===null?(r.deletions=[d],r.flags|=16):a.push(d)}function zx(r,a){switch(r.tag){case 5:var d=r.type;return a=a.nodeType!==1||d.toLowerCase()!==a.nodeName.toLowerCase()?null:a,a!==null?(r.stateNode=a,Xn=r,Yn=Or(a.firstChild),!0):!1;case 6:return a=r.pendingProps===""||a.nodeType!==3?null:a,a!==null?(r.stateNode=a,Xn=r,Yn=null,!0):!1;case 13:return a=a.nodeType!==8?null:a,a!==null?(d=xo!==null?{id:cr,overflow:ur}:null,r.memoizedState={dehydrated:a,treeContext:d,retryLane:1073741824},d=ps(18,null,null,0),d.stateNode=a,d.return=r,r.child=d,Xn=r,Yn=null,!0):!1;default:return!1}}function Lf(r){return(r.mode&1)!==0&&(r.flags&128)===0}function If(r){if(yt){var a=Yn;if(a){var d=a;if(!zx(r,a)){if(Lf(r))throw Error(n(418));a=Or(d.nextSibling);var g=Xn;a&&zx(r,a)?Ix(g,d):(r.flags=r.flags&-4097|2,yt=!1,Xn=r)}}else{if(Lf(r))throw Error(n(418));r.flags=r.flags&-4097|2,yt=!1,Xn=r}}}function Dx(r){for(r=r.return;r!==null&&r.tag!==5&&r.tag!==3&&r.tag!==13;)r=r.return;Xn=r}function jc(r){if(r!==Xn)return!1;if(!yt)return Dx(r),yt=!0,!1;var a;if((a=r.tag!==3)&&!(a=r.tag!==5)&&(a=r.type,a=a!=="head"&&a!=="body"&&!Ef(r.type,r.memoizedProps)),a&&(a=Yn)){if(Lf(r))throw Fx(),Error(n(418));for(;a;)Ix(r,a),a=Or(a.nextSibling)}if(Dx(r),r.tag===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(n(317));e:{for(r=r.nextSibling,a=0;r;){if(r.nodeType===8){var d=r.data;if(d==="/$"){if(a===0){Yn=Or(r.nextSibling);break e}a--}else d!=="$"&&d!=="$!"&&d!=="$?"||a++}r=r.nextSibling}Yn=null}}else Yn=Xn?Or(r.stateNode.nextSibling):null;return!0}function Fx(){for(var r=Yn;r;)r=Or(r.nextSibling)}function ua(){Yn=Xn=null,yt=!1}function zf(r){Cs===null?Cs=[r]:Cs.push(r)}var ZS=_.ReactCurrentBatchConfig;function $i(r,a,d){if(r=d.ref,r!==null&&typeof r!="function"&&typeof r!="object"){if(d._owner){if(d=d._owner,d){if(d.tag!==1)throw Error(n(309));var g=d.stateNode}if(!g)throw Error(n(147,r));var k=g,N=""+r;return a!==null&&a.ref!==null&&typeof a.ref=="function"&&a.ref._stringRef===N?a.ref:(a=function(A){var H=k.refs;A===null?delete H[N]:H[N]=A},a._stringRef=N,a)}if(typeof r!="string")throw Error(n(284));if(!d._owner)throw Error(n(290,r))}return r}function Nc(r,a){throw r=Object.prototype.toString.call(a),Error(n(31,r==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":r))}function Ux(r){var a=r._init;return a(r._payload)}function Wx(r){function a(te,Q){if(r){var se=te.deletions;se===null?(te.deletions=[Q],te.flags|=16):se.push(Q)}}function d(te,Q){if(!r)return null;for(;Q!==null;)a(te,Q),Q=Q.sibling;return null}function g(te,Q){for(te=new Map;Q!==null;)Q.key!==null?te.set(Q.key,Q):te.set(Q.index,Q),Q=Q.sibling;return te}function k(te,Q){return te=Br(te,Q),te.index=0,te.sibling=null,te}function N(te,Q,se){return te.index=se,r?(se=te.alternate,se!==null?(se=se.index,se<Q?(te.flags|=2,Q):se):(te.flags|=2,Q)):(te.flags|=1048576,Q)}function A(te){return r&&te.alternate===null&&(te.flags|=2),te}function H(te,Q,se,ge){return Q===null||Q.tag!==6?(Q=Tm(se,te.mode,ge),Q.return=te,Q):(Q=k(Q,se),Q.return=te,Q)}function V(te,Q,se,ge){var Ce=se.type;return Ce===C?de(te,Q,se.props.children,ge,se.key):Q!==null&&(Q.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===M&&Ux(Ce)===Q.type)?(ge=k(Q,se.props),ge.ref=$i(te,Q,se),ge.return=te,ge):(ge=Kc(se.type,se.key,se.props,null,te.mode,ge),ge.ref=$i(te,Q,se),ge.return=te,ge)}function re(te,Q,se,ge){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==se.containerInfo||Q.stateNode.implementation!==se.implementation?(Q=Cm(se,te.mode,ge),Q.return=te,Q):(Q=k(Q,se.children||[]),Q.return=te,Q)}function de(te,Q,se,ge,Ce){return Q===null||Q.tag!==7?(Q=_o(se,te.mode,ge,Ce),Q.return=te,Q):(Q=k(Q,se),Q.return=te,Q)}function me(te,Q,se){if(typeof Q=="string"&&Q!==""||typeof Q=="number")return Q=Tm(""+Q,te.mode,se),Q.return=te,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case E:return se=Kc(Q.type,Q.key,Q.props,null,te.mode,se),se.ref=$i(te,null,Q),se.return=te,se;case R:return Q=Cm(Q,te.mode,se),Q.return=te,Q;case M:var ge=Q._init;return me(te,ge(Q._payload),se)}if(Bt(Q)||I(Q))return Q=_o(Q,te.mode,se,null),Q.return=te,Q;Nc(te,Q)}return null}function ue(te,Q,se,ge){var Ce=Q!==null?Q.key:null;if(typeof se=="string"&&se!==""||typeof se=="number")return Ce!==null?null:H(te,Q,""+se,ge);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case E:return se.key===Ce?V(te,Q,se,ge):null;case R:return se.key===Ce?re(te,Q,se,ge):null;case M:return Ce=se._init,ue(te,Q,Ce(se._payload),ge)}if(Bt(se)||I(se))return Ce!==null?null:de(te,Q,se,ge,null);Nc(te,se)}return null}function ke(te,Q,se,ge,Ce){if(typeof ge=="string"&&ge!==""||typeof ge=="number")return te=te.get(se)||null,H(Q,te,""+ge,Ce);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case E:return te=te.get(ge.key===null?se:ge.key)||null,V(Q,te,ge,Ce);case R:return te=te.get(ge.key===null?se:ge.key)||null,re(Q,te,ge,Ce);case M:var Ie=ge._init;return ke(te,Q,se,Ie(ge._payload),Ce)}if(Bt(ge)||I(ge))return te=te.get(se)||null,de(Q,te,ge,Ce,null);Nc(Q,ge)}return null}function _e(te,Q,se,ge){for(var Ce=null,Ie=null,ze=Q,Fe=Q=0,Vt=null;ze!==null&&Fe<se.length;Fe++){ze.index>Fe?(Vt=ze,ze=null):Vt=ze.sibling;var nt=ue(te,ze,se[Fe],ge);if(nt===null){ze===null&&(ze=Vt);break}r&&ze&&nt.alternate===null&&a(te,ze),Q=N(nt,Q,Fe),Ie===null?Ce=nt:Ie.sibling=nt,Ie=nt,ze=Vt}if(Fe===se.length)return d(te,ze),yt&&yo(te,Fe),Ce;if(ze===null){for(;Fe<se.length;Fe++)ze=me(te,se[Fe],ge),ze!==null&&(Q=N(ze,Q,Fe),Ie===null?Ce=ze:Ie.sibling=ze,Ie=ze);return yt&&yo(te,Fe),Ce}for(ze=g(te,ze);Fe<se.length;Fe++)Vt=ke(ze,te,Fe,se[Fe],ge),Vt!==null&&(r&&Vt.alternate!==null&&ze.delete(Vt.key===null?Fe:Vt.key),Q=N(Vt,Q,Fe),Ie===null?Ce=Vt:Ie.sibling=Vt,Ie=Vt);return r&&ze.forEach(function(Gr){return a(te,Gr)}),yt&&yo(te,Fe),Ce}function $e(te,Q,se,ge){var Ce=I(se);if(typeof Ce!="function")throw Error(n(150));if(se=Ce.call(se),se==null)throw Error(n(151));for(var Ie=Ce=null,ze=Q,Fe=Q=0,Vt=null,nt=se.next();ze!==null&&!nt.done;Fe++,nt=se.next()){ze.index>Fe?(Vt=ze,ze=null):Vt=ze.sibling;var Gr=ue(te,ze,nt.value,ge);if(Gr===null){ze===null&&(ze=Vt);break}r&&ze&&Gr.alternate===null&&a(te,ze),Q=N(Gr,Q,Fe),Ie===null?Ce=Gr:Ie.sibling=Gr,Ie=Gr,ze=Vt}if(nt.done)return d(te,ze),yt&&yo(te,Fe),Ce;if(ze===null){for(;!nt.done;Fe++,nt=se.next())nt=me(te,nt.value,ge),nt!==null&&(Q=N(nt,Q,Fe),Ie===null?Ce=nt:Ie.sibling=nt,Ie=nt);return yt&&yo(te,Fe),Ce}for(ze=g(te,ze);!nt.done;Fe++,nt=se.next())nt=ke(ze,te,Fe,nt.value,ge),nt!==null&&(r&&nt.alternate!==null&&ze.delete(nt.key===null?Fe:nt.key),Q=N(nt,Q,Fe),Ie===null?Ce=nt:Ie.sibling=nt,Ie=nt);return r&&ze.forEach(function(R2){return a(te,R2)}),yt&&yo(te,Fe),Ce}function Rt(te,Q,se,ge){if(typeof se=="object"&&se!==null&&se.type===C&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case E:e:{for(var Ce=se.key,Ie=Q;Ie!==null;){if(Ie.key===Ce){if(Ce=se.type,Ce===C){if(Ie.tag===7){d(te,Ie.sibling),Q=k(Ie,se.props.children),Q.return=te,te=Q;break e}}else if(Ie.elementType===Ce||typeof Ce=="object"&&Ce!==null&&Ce.$$typeof===M&&Ux(Ce)===Ie.type){d(te,Ie.sibling),Q=k(Ie,se.props),Q.ref=$i(te,Ie,se),Q.return=te,te=Q;break e}d(te,Ie);break}else a(te,Ie);Ie=Ie.sibling}se.type===C?(Q=_o(se.props.children,te.mode,ge,se.key),Q.return=te,te=Q):(ge=Kc(se.type,se.key,se.props,null,te.mode,ge),ge.ref=$i(te,Q,se),ge.return=te,te=ge)}return A(te);case R:e:{for(Ie=se.key;Q!==null;){if(Q.key===Ie)if(Q.tag===4&&Q.stateNode.containerInfo===se.containerInfo&&Q.stateNode.implementation===se.implementation){d(te,Q.sibling),Q=k(Q,se.children||[]),Q.return=te,te=Q;break e}else{d(te,Q);break}else a(te,Q);Q=Q.sibling}Q=Cm(se,te.mode,ge),Q.return=te,te=Q}return A(te);case M:return Ie=se._init,Rt(te,Q,Ie(se._payload),ge)}if(Bt(se))return _e(te,Q,se,ge);if(I(se))return $e(te,Q,se,ge);Nc(te,se)}return typeof se=="string"&&se!==""||typeof se=="number"?(se=""+se,Q!==null&&Q.tag===6?(d(te,Q.sibling),Q=k(Q,se),Q.return=te,te=Q):(d(te,Q),Q=Tm(se,te.mode,ge),Q.return=te,te=Q),A(te)):d(te,Q)}return Rt}var da=Wx(!0),Hx=Wx(!1),Sc=Mr(null),_c=null,fa=null,Df=null;function Ff(){Df=fa=_c=null}function Uf(r){var a=Sc.current;ht(Sc),r._currentValue=a}function Wf(r,a,d){for(;r!==null;){var g=r.alternate;if((r.childLanes&a)!==a?(r.childLanes|=a,g!==null&&(g.childLanes|=a)):g!==null&&(g.childLanes&a)!==a&&(g.childLanes|=a),r===d)break;r=r.return}}function ma(r,a){_c=r,Df=fa=null,r=r.dependencies,r!==null&&r.firstContext!==null&&((r.lanes&a)!==0&&(In=!0),r.firstContext=null)}function ds(r){var a=r._currentValue;if(Df!==r)if(r={context:r,memoizedValue:a,next:null},fa===null){if(_c===null)throw Error(n(308));fa=r,_c.dependencies={lanes:0,firstContext:r}}else fa=fa.next=r;return a}var vo=null;function Hf(r){vo===null?vo=[r]:vo.push(r)}function Bx(r,a,d,g){var k=a.interleaved;return k===null?(d.next=d,Hf(a)):(d.next=k.next,k.next=d),a.interleaved=d,dr(r,g)}function dr(r,a){r.lanes|=a;var d=r.alternate;for(d!==null&&(d.lanes|=a),d=r,r=r.return;r!==null;)r.childLanes|=a,d=r.alternate,d!==null&&(d.childLanes|=a),d=r,r=r.return;return d.tag===3?d.stateNode:null}var Ir=!1;function Bf(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Gx(r,a){r=r.updateQueue,a.updateQueue===r&&(a.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,effects:r.effects})}function fr(r,a){return{eventTime:r,lane:a,tag:0,payload:null,callback:null,next:null}}function zr(r,a,d){var g=r.updateQueue;if(g===null)return null;if(g=g.shared,(tt&2)!==0){var k=g.pending;return k===null?a.next=a:(a.next=k.next,k.next=a),g.pending=a,dr(r,d)}return k=g.interleaved,k===null?(a.next=a,Hf(g)):(a.next=k.next,k.next=a),g.interleaved=a,dr(r,d)}function $c(r,a,d){if(a=a.updateQueue,a!==null&&(a=a.shared,(d&4194240)!==0)){var g=a.lanes;g&=r.pendingLanes,d|=g,a.lanes=d,sf(r,d)}}function qx(r,a){var d=r.updateQueue,g=r.alternate;if(g!==null&&(g=g.updateQueue,d===g)){var k=null,N=null;if(d=d.firstBaseUpdate,d!==null){do{var A={eventTime:d.eventTime,lane:d.lane,tag:d.tag,payload:d.payload,callback:d.callback,next:null};N===null?k=N=A:N=N.next=A,d=d.next}while(d!==null);N===null?k=N=a:N=N.next=a}else k=N=a;d={baseState:g.baseState,firstBaseUpdate:k,lastBaseUpdate:N,shared:g.shared,effects:g.effects},r.updateQueue=d;return}r=d.lastBaseUpdate,r===null?d.firstBaseUpdate=a:r.next=a,d.lastBaseUpdate=a}function Ec(r,a,d,g){var k=r.updateQueue;Ir=!1;var N=k.firstBaseUpdate,A=k.lastBaseUpdate,H=k.shared.pending;if(H!==null){k.shared.pending=null;var V=H,re=V.next;V.next=null,A===null?N=re:A.next=re,A=V;var de=r.alternate;de!==null&&(de=de.updateQueue,H=de.lastBaseUpdate,H!==A&&(H===null?de.firstBaseUpdate=re:H.next=re,de.lastBaseUpdate=V))}if(N!==null){var me=k.baseState;A=0,de=re=V=null,H=N;do{var ue=H.lane,ke=H.eventTime;if((g&ue)===ue){de!==null&&(de=de.next={eventTime:ke,lane:0,tag:H.tag,payload:H.payload,callback:H.callback,next:null});e:{var _e=r,$e=H;switch(ue=a,ke=d,$e.tag){case 1:if(_e=$e.payload,typeof _e=="function"){me=_e.call(ke,me,ue);break e}me=_e;break e;case 3:_e.flags=_e.flags&-65537|128;case 0:if(_e=$e.payload,ue=typeof _e=="function"?_e.call(ke,me,ue):_e,ue==null)break e;me=G({},me,ue);break e;case 2:Ir=!0}}H.callback!==null&&H.lane!==0&&(r.flags|=64,ue=k.effects,ue===null?k.effects=[H]:ue.push(H))}else ke={eventTime:ke,lane:ue,tag:H.tag,payload:H.payload,callback:H.callback,next:null},de===null?(re=de=ke,V=me):de=de.next=ke,A|=ue;if(H=H.next,H===null){if(H=k.shared.pending,H===null)break;ue=H,H=ue.next,ue.next=null,k.lastBaseUpdate=ue,k.shared.pending=null}}while(!0);if(de===null&&(V=me),k.baseState=V,k.firstBaseUpdate=re,k.lastBaseUpdate=de,a=k.shared.interleaved,a!==null){k=a;do A|=k.lane,k=k.next;while(k!==a)}else N===null&&(k.shared.lanes=0);ko|=A,r.lanes=A,r.memoizedState=me}}function Vx(r,a,d){if(r=a.effects,a.effects=null,r!==null)for(a=0;a<r.length;a++){var g=r[a],k=g.callback;if(k!==null){if(g.callback=null,g=d,typeof k!="function")throw Error(n(191,k));k.call(g)}}}var Ei={},qs=Mr(Ei),Ti=Mr(Ei),Ci=Mr(Ei);function bo(r){if(r===Ei)throw Error(n(174));return r}function Gf(r,a){switch(mt(Ci,a),mt(Ti,r),mt(qs,Ei),r=a.nodeType,r){case 9:case 11:a=(a=a.documentElement)?a.namespaceURI:Pe(null,"");break;default:r=r===8?a.parentNode:a,a=r.namespaceURI||null,r=r.tagName,a=Pe(a,r)}ht(qs),mt(qs,a)}function pa(){ht(qs),ht(Ti),ht(Ci)}function Kx(r){bo(Ci.current);var a=bo(qs.current),d=Pe(a,r.type);a!==d&&(mt(Ti,r),mt(qs,d))}function qf(r){Ti.current===r&&(ht(qs),ht(Ti))}var kt=Mr(0);function Tc(r){for(var a=r;a!==null;){if(a.tag===13){var d=a.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||d.data==="$?"||d.data==="$!"))return a}else if(a.tag===19&&a.memoizedProps.revealOrder!==void 0){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Vf=[];function Kf(){for(var r=0;r<Vf.length;r++)Vf[r]._workInProgressVersionPrimary=null;Vf.length=0}var Cc=_.ReactCurrentDispatcher,Xf=_.ReactCurrentBatchConfig,wo=0,jt=null,Ft=null,Gt=null,Rc=!1,Ri=!1,Ai=0,JS=0;function cn(){throw Error(n(321))}function Yf(r,a){if(a===null)return!1;for(var d=0;d<a.length&&d<r.length;d++)if(!Ts(r[d],a[d]))return!1;return!0}function Qf(r,a,d,g,k,N){if(wo=N,jt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,Cc.current=r===null||r.memoizedState===null?s2:r2,r=d(g,k),Ri){N=0;do{if(Ri=!1,Ai=0,25<=N)throw Error(n(301));N+=1,Gt=Ft=null,a.updateQueue=null,Cc.current=o2,r=d(g,k)}while(Ri)}if(Cc.current=Mc,a=Ft!==null&&Ft.next!==null,wo=0,Gt=Ft=jt=null,Rc=!1,a)throw Error(n(300));return r}function Zf(){var r=Ai!==0;return Ai=0,r}function Vs(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Gt===null?jt.memoizedState=Gt=r:Gt=Gt.next=r,Gt}function fs(){if(Ft===null){var r=jt.alternate;r=r!==null?r.memoizedState:null}else r=Ft.next;var a=Gt===null?jt.memoizedState:Gt.next;if(a!==null)Gt=a,Ft=r;else{if(r===null)throw Error(n(310));Ft=r,r={memoizedState:Ft.memoizedState,baseState:Ft.baseState,baseQueue:Ft.baseQueue,queue:Ft.queue,next:null},Gt===null?jt.memoizedState=Gt=r:Gt=Gt.next=r}return Gt}function Oi(r,a){return typeof a=="function"?a(r):a}function Jf(r){var a=fs(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var g=Ft,k=g.baseQueue,N=d.pending;if(N!==null){if(k!==null){var A=k.next;k.next=N.next,N.next=A}g.baseQueue=k=N,d.pending=null}if(k!==null){N=k.next,g=g.baseState;var H=A=null,V=null,re=N;do{var de=re.lane;if((wo&de)===de)V!==null&&(V=V.next={lane:0,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),g=re.hasEagerState?re.eagerState:r(g,re.action);else{var me={lane:de,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null};V===null?(H=V=me,A=g):V=V.next=me,jt.lanes|=de,ko|=de}re=re.next}while(re!==null&&re!==N);V===null?A=g:V.next=H,Ts(g,a.memoizedState)||(In=!0),a.memoizedState=g,a.baseState=A,a.baseQueue=V,d.lastRenderedState=g}if(r=d.interleaved,r!==null){k=r;do N=k.lane,jt.lanes|=N,ko|=N,k=k.next;while(k!==r)}else k===null&&(d.lanes=0);return[a.memoizedState,d.dispatch]}function em(r){var a=fs(),d=a.queue;if(d===null)throw Error(n(311));d.lastRenderedReducer=r;var g=d.dispatch,k=d.pending,N=a.memoizedState;if(k!==null){d.pending=null;var A=k=k.next;do N=r(N,A.action),A=A.next;while(A!==k);Ts(N,a.memoizedState)||(In=!0),a.memoizedState=N,a.baseQueue===null&&(a.baseState=N),d.lastRenderedState=N}return[N,g]}function Xx(){}function Yx(r,a){var d=jt,g=fs(),k=a(),N=!Ts(g.memoizedState,k);if(N&&(g.memoizedState=k,In=!0),g=g.queue,tm(Jx.bind(null,d,g,r),[r]),g.getSnapshot!==a||N||Gt!==null&&Gt.memoizedState.tag&1){if(d.flags|=2048,Mi(9,Zx.bind(null,d,g,k,a),void 0,null),qt===null)throw Error(n(349));(wo&30)!==0||Qx(d,a,k)}return k}function Qx(r,a,d){r.flags|=16384,r={getSnapshot:a,value:d},a=jt.updateQueue,a===null?(a={lastEffect:null,stores:null},jt.updateQueue=a,a.stores=[r]):(d=a.stores,d===null?a.stores=[r]:d.push(r))}function Zx(r,a,d,g){a.value=d,a.getSnapshot=g,ey(a)&&ty(r)}function Jx(r,a,d){return d(function(){ey(a)&&ty(r)})}function ey(r){var a=r.getSnapshot;r=r.value;try{var d=a();return!Ts(r,d)}catch{return!0}}function ty(r){var a=dr(r,1);a!==null&&Ms(a,r,1,-1)}function ny(r){var a=Vs();return typeof r=="function"&&(r=r()),a.memoizedState=a.baseState=r,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Oi,lastRenderedState:r},a.queue=r,r=r.dispatch=n2.bind(null,jt,r),[a.memoizedState,r]}function Mi(r,a,d,g){return r={tag:r,create:a,destroy:d,deps:g,next:null},a=jt.updateQueue,a===null?(a={lastEffect:null,stores:null},jt.updateQueue=a,a.lastEffect=r.next=r):(d=a.lastEffect,d===null?a.lastEffect=r.next=r:(g=d.next,d.next=r,r.next=g,a.lastEffect=r)),r}function sy(){return fs().memoizedState}function Ac(r,a,d,g){var k=Vs();jt.flags|=r,k.memoizedState=Mi(1|a,d,void 0,g===void 0?null:g)}function Oc(r,a,d,g){var k=fs();g=g===void 0?null:g;var N=void 0;if(Ft!==null){var A=Ft.memoizedState;if(N=A.destroy,g!==null&&Yf(g,A.deps)){k.memoizedState=Mi(a,d,N,g);return}}jt.flags|=r,k.memoizedState=Mi(1|a,d,N,g)}function ry(r,a){return Ac(8390656,8,r,a)}function tm(r,a){return Oc(2048,8,r,a)}function oy(r,a){return Oc(4,2,r,a)}function ay(r,a){return Oc(4,4,r,a)}function iy(r,a){if(typeof a=="function")return r=r(),a(r),function(){a(null)};if(a!=null)return r=r(),a.current=r,function(){a.current=null}}function ly(r,a,d){return d=d!=null?d.concat([r]):null,Oc(4,4,iy.bind(null,a,r),d)}function nm(){}function cy(r,a){var d=fs();a=a===void 0?null:a;var g=d.memoizedState;return g!==null&&a!==null&&Yf(a,g[1])?g[0]:(d.memoizedState=[r,a],r)}function uy(r,a){var d=fs();a=a===void 0?null:a;var g=d.memoizedState;return g!==null&&a!==null&&Yf(a,g[1])?g[0]:(r=r(),d.memoizedState=[r,a],r)}function dy(r,a,d){return(wo&21)===0?(r.baseState&&(r.baseState=!1,In=!0),r.memoizedState=d):(Ts(d,a)||(d=li(),jt.lanes|=d,ko|=d,r.baseState=!0),a)}function e2(r,a){var d=it;it=d!==0&&4>d?d:4,r(!0);var g=Xf.transition;Xf.transition={};try{r(!1),a()}finally{it=d,Xf.transition=g}}function fy(){return fs().memoizedState}function t2(r,a,d){var g=Wr(r);if(d={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null},my(r))py(a,d);else if(d=Bx(r,a,d,g),d!==null){var k=yn();Ms(d,r,g,k),hy(d,a,g)}}function n2(r,a,d){var g=Wr(r),k={lane:g,action:d,hasEagerState:!1,eagerState:null,next:null};if(my(r))py(a,k);else{var N=r.alternate;if(r.lanes===0&&(N===null||N.lanes===0)&&(N=a.lastRenderedReducer,N!==null))try{var A=a.lastRenderedState,H=N(A,d);if(k.hasEagerState=!0,k.eagerState=H,Ts(H,A)){var V=a.interleaved;V===null?(k.next=k,Hf(a)):(k.next=V.next,V.next=k),a.interleaved=k;return}}catch{}finally{}d=Bx(r,a,k,g),d!==null&&(k=yn(),Ms(d,r,g,k),hy(d,a,g))}}function my(r){var a=r.alternate;return r===jt||a!==null&&a===jt}function py(r,a){Ri=Rc=!0;var d=r.pending;d===null?a.next=a:(a.next=d.next,d.next=a),r.pending=a}function hy(r,a,d){if((d&4194240)!==0){var g=a.lanes;g&=r.pendingLanes,d|=g,a.lanes=d,sf(r,d)}}var Mc={readContext:ds,useCallback:cn,useContext:cn,useEffect:cn,useImperativeHandle:cn,useInsertionEffect:cn,useLayoutEffect:cn,useMemo:cn,useReducer:cn,useRef:cn,useState:cn,useDebugValue:cn,useDeferredValue:cn,useTransition:cn,useMutableSource:cn,useSyncExternalStore:cn,useId:cn,unstable_isNewReconciler:!1},s2={readContext:ds,useCallback:function(r,a){return Vs().memoizedState=[r,a===void 0?null:a],r},useContext:ds,useEffect:ry,useImperativeHandle:function(r,a,d){return d=d!=null?d.concat([r]):null,Ac(4194308,4,iy.bind(null,a,r),d)},useLayoutEffect:function(r,a){return Ac(4194308,4,r,a)},useInsertionEffect:function(r,a){return Ac(4,2,r,a)},useMemo:function(r,a){var d=Vs();return a=a===void 0?null:a,r=r(),d.memoizedState=[r,a],r},useReducer:function(r,a,d){var g=Vs();return a=d!==void 0?d(a):a,g.memoizedState=g.baseState=a,r={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:a},g.queue=r,r=r.dispatch=t2.bind(null,jt,r),[g.memoizedState,r]},useRef:function(r){var a=Vs();return r={current:r},a.memoizedState=r},useState:ny,useDebugValue:nm,useDeferredValue:function(r){return Vs().memoizedState=r},useTransition:function(){var r=ny(!1),a=r[0];return r=e2.bind(null,r[1]),Vs().memoizedState=r,[a,r]},useMutableSource:function(){},useSyncExternalStore:function(r,a,d){var g=jt,k=Vs();if(yt){if(d===void 0)throw Error(n(407));d=d()}else{if(d=a(),qt===null)throw Error(n(349));(wo&30)!==0||Qx(g,a,d)}k.memoizedState=d;var N={value:d,getSnapshot:a};return k.queue=N,ry(Jx.bind(null,g,N,r),[r]),g.flags|=2048,Mi(9,Zx.bind(null,g,N,d,a),void 0,null),d},useId:function(){var r=Vs(),a=qt.identifierPrefix;if(yt){var d=ur,g=cr;d=(g&~(1<<32-Mn(g)-1)).toString(32)+d,a=":"+a+"R"+d,d=Ai++,0<d&&(a+="H"+d.toString(32)),a+=":"}else d=JS++,a=":"+a+"r"+d.toString(32)+":";return r.memoizedState=a},unstable_isNewReconciler:!1},r2={readContext:ds,useCallback:cy,useContext:ds,useEffect:tm,useImperativeHandle:ly,useInsertionEffect:oy,useLayoutEffect:ay,useMemo:uy,useReducer:Jf,useRef:sy,useState:function(){return Jf(Oi)},useDebugValue:nm,useDeferredValue:function(r){var a=fs();return dy(a,Ft.memoizedState,r)},useTransition:function(){var r=Jf(Oi)[0],a=fs().memoizedState;return[r,a]},useMutableSource:Xx,useSyncExternalStore:Yx,useId:fy,unstable_isNewReconciler:!1},o2={readContext:ds,useCallback:cy,useContext:ds,useEffect:tm,useImperativeHandle:ly,useInsertionEffect:oy,useLayoutEffect:ay,useMemo:uy,useReducer:em,useRef:sy,useState:function(){return em(Oi)},useDebugValue:nm,useDeferredValue:function(r){var a=fs();return Ft===null?a.memoizedState=r:dy(a,Ft.memoizedState,r)},useTransition:function(){var r=em(Oi)[0],a=fs().memoizedState;return[r,a]},useMutableSource:Xx,useSyncExternalStore:Yx,useId:fy,unstable_isNewReconciler:!1};function Rs(r,a){if(r&&r.defaultProps){a=G({},a),r=r.defaultProps;for(var d in r)a[d]===void 0&&(a[d]=r[d]);return a}return a}function sm(r,a,d,g){a=r.memoizedState,d=d(g,a),d=d==null?a:G({},a,d),r.memoizedState=d,r.lanes===0&&(r.updateQueue.baseState=d)}var Pc={isMounted:function(r){return(r=r._reactInternals)?qn(r)===r:!1},enqueueSetState:function(r,a,d){r=r._reactInternals;var g=yn(),k=Wr(r),N=fr(g,k);N.payload=a,d!=null&&(N.callback=d),a=zr(r,N,k),a!==null&&(Ms(a,r,k,g),$c(a,r,k))},enqueueReplaceState:function(r,a,d){r=r._reactInternals;var g=yn(),k=Wr(r),N=fr(g,k);N.tag=1,N.payload=a,d!=null&&(N.callback=d),a=zr(r,N,k),a!==null&&(Ms(a,r,k,g),$c(a,r,k))},enqueueForceUpdate:function(r,a){r=r._reactInternals;var d=yn(),g=Wr(r),k=fr(d,g);k.tag=2,a!=null&&(k.callback=a),a=zr(r,k,g),a!==null&&(Ms(a,r,g,d),$c(a,r,g))}};function gy(r,a,d,g,k,N,A){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(g,N,A):a.prototype&&a.prototype.isPureReactComponent?!bi(d,g)||!bi(k,N):!0}function xy(r,a,d){var g=!1,k=Pr,N=a.contextType;return typeof N=="object"&&N!==null?N=ds(N):(k=Ln(a)?go:ln.current,g=a.contextTypes,N=(g=g!=null)?ia(r,k):Pr),a=new a(d,N),r.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Pc,r.stateNode=a,a._reactInternals=r,g&&(r=r.stateNode,r.__reactInternalMemoizedUnmaskedChildContext=k,r.__reactInternalMemoizedMaskedChildContext=N),a}function yy(r,a,d,g){r=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(d,g),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(d,g),a.state!==r&&Pc.enqueueReplaceState(a,a.state,null)}function rm(r,a,d,g){var k=r.stateNode;k.props=d,k.state=r.memoizedState,k.refs={},Bf(r);var N=a.contextType;typeof N=="object"&&N!==null?k.context=ds(N):(N=Ln(a)?go:ln.current,k.context=ia(r,N)),k.state=r.memoizedState,N=a.getDerivedStateFromProps,typeof N=="function"&&(sm(r,a,N,d),k.state=r.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof k.getSnapshotBeforeUpdate=="function"||typeof k.UNSAFE_componentWillMount!="function"&&typeof k.componentWillMount!="function"||(a=k.state,typeof k.componentWillMount=="function"&&k.componentWillMount(),typeof k.UNSAFE_componentWillMount=="function"&&k.UNSAFE_componentWillMount(),a!==k.state&&Pc.enqueueReplaceState(k,k.state,null),Ec(r,d,k,g),k.state=r.memoizedState),typeof k.componentDidMount=="function"&&(r.flags|=4194308)}function ha(r,a){try{var d="",g=a;do d+=ie(g),g=g.return;while(g);var k=d}catch(N){k=`
|
|
39
|
-
Error generating stack: `+N.message+`
|
|
40
|
-
`+N.stack}return{value:r,source:a,stack:k,digest:null}}function om(r,a,d){return{value:r,source:null,stack:d??null,digest:a??null}}function am(r,a){try{console.error(a.value)}catch(d){setTimeout(function(){throw d})}}var a2=typeof WeakMap=="function"?WeakMap:Map;function vy(r,a,d){d=fr(-1,d),d.tag=3,d.payload={element:null};var g=a.value;return d.callback=function(){Wc||(Wc=!0,wm=g),am(r,a)},d}function by(r,a,d){d=fr(-1,d),d.tag=3;var g=r.type.getDerivedStateFromError;if(typeof g=="function"){var k=a.value;d.payload=function(){return g(k)},d.callback=function(){am(r,a)}}var N=r.stateNode;return N!==null&&typeof N.componentDidCatch=="function"&&(d.callback=function(){am(r,a),typeof g!="function"&&(Fr===null?Fr=new Set([this]):Fr.add(this));var A=a.stack;this.componentDidCatch(a.value,{componentStack:A!==null?A:""})}),d}function wy(r,a,d){var g=r.pingCache;if(g===null){g=r.pingCache=new a2;var k=new Set;g.set(a,k)}else k=g.get(a),k===void 0&&(k=new Set,g.set(a,k));k.has(d)||(k.add(d),r=b2.bind(null,r,a,d),a.then(r,r))}function ky(r){do{var a;if((a=r.tag===13)&&(a=r.memoizedState,a=a!==null?a.dehydrated!==null:!0),a)return r;r=r.return}while(r!==null);return null}function jy(r,a,d,g,k){return(r.mode&1)===0?(r===a?r.flags|=65536:(r.flags|=128,d.flags|=131072,d.flags&=-52805,d.tag===1&&(d.alternate===null?d.tag=17:(a=fr(-1,1),a.tag=2,zr(d,a,1))),d.lanes|=1),r):(r.flags|=65536,r.lanes=k,r)}var i2=_.ReactCurrentOwner,In=!1;function xn(r,a,d,g){a.child=r===null?Hx(a,null,d,g):da(a,r.child,d,g)}function Ny(r,a,d,g,k){d=d.render;var N=a.ref;return ma(a,k),g=Qf(r,a,d,g,N,k),d=Zf(),r!==null&&!In?(a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~k,mr(r,a,k)):(yt&&d&&Mf(a),a.flags|=1,xn(r,a,g,k),a.child)}function Sy(r,a,d,g,k){if(r===null){var N=d.type;return typeof N=="function"&&!Em(N)&&N.defaultProps===void 0&&d.compare===null&&d.defaultProps===void 0?(a.tag=15,a.type=N,_y(r,a,N,g,k)):(r=Kc(d.type,null,g,a,a.mode,k),r.ref=a.ref,r.return=a,a.child=r)}if(N=r.child,(r.lanes&k)===0){var A=N.memoizedProps;if(d=d.compare,d=d!==null?d:bi,d(A,g)&&r.ref===a.ref)return mr(r,a,k)}return a.flags|=1,r=Br(N,g),r.ref=a.ref,r.return=a,a.child=r}function _y(r,a,d,g,k){if(r!==null){var N=r.memoizedProps;if(bi(N,g)&&r.ref===a.ref)if(In=!1,a.pendingProps=g=N,(r.lanes&k)!==0)(r.flags&131072)!==0&&(In=!0);else return a.lanes=r.lanes,mr(r,a,k)}return im(r,a,d,g,k)}function $y(r,a,d){var g=a.pendingProps,k=g.children,N=r!==null?r.memoizedState:null;if(g.mode==="hidden")if((a.mode&1)===0)a.memoizedState={baseLanes:0,cachePool:null,transitions:null},mt(xa,Qn),Qn|=d;else{if((d&1073741824)===0)return r=N!==null?N.baseLanes|d:d,a.lanes=a.childLanes=1073741824,a.memoizedState={baseLanes:r,cachePool:null,transitions:null},a.updateQueue=null,mt(xa,Qn),Qn|=r,null;a.memoizedState={baseLanes:0,cachePool:null,transitions:null},g=N!==null?N.baseLanes:d,mt(xa,Qn),Qn|=g}else N!==null?(g=N.baseLanes|d,a.memoizedState=null):g=d,mt(xa,Qn),Qn|=g;return xn(r,a,k,d),a.child}function Ey(r,a){var d=a.ref;(r===null&&d!==null||r!==null&&r.ref!==d)&&(a.flags|=512,a.flags|=2097152)}function im(r,a,d,g,k){var N=Ln(d)?go:ln.current;return N=ia(a,N),ma(a,k),d=Qf(r,a,d,g,N,k),g=Zf(),r!==null&&!In?(a.updateQueue=r.updateQueue,a.flags&=-2053,r.lanes&=~k,mr(r,a,k)):(yt&&g&&Mf(a),a.flags|=1,xn(r,a,d,k),a.child)}function Ty(r,a,d,g,k){if(Ln(d)){var N=!0;vc(a)}else N=!1;if(ma(a,k),a.stateNode===null)Ic(r,a),xy(a,d,g),rm(a,d,g,k),g=!0;else if(r===null){var A=a.stateNode,H=a.memoizedProps;A.props=H;var V=A.context,re=d.contextType;typeof re=="object"&&re!==null?re=ds(re):(re=Ln(d)?go:ln.current,re=ia(a,re));var de=d.getDerivedStateFromProps,me=typeof de=="function"||typeof A.getSnapshotBeforeUpdate=="function";me||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(H!==g||V!==re)&&yy(a,A,g,re),Ir=!1;var ue=a.memoizedState;A.state=ue,Ec(a,g,A,k),V=a.memoizedState,H!==g||ue!==V||Pn.current||Ir?(typeof de=="function"&&(sm(a,d,de,g),V=a.memoizedState),(H=Ir||gy(a,d,H,g,ue,V,re))?(me||typeof A.UNSAFE_componentWillMount!="function"&&typeof A.componentWillMount!="function"||(typeof A.componentWillMount=="function"&&A.componentWillMount(),typeof A.UNSAFE_componentWillMount=="function"&&A.UNSAFE_componentWillMount()),typeof A.componentDidMount=="function"&&(a.flags|=4194308)):(typeof A.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=g,a.memoizedState=V),A.props=g,A.state=V,A.context=re,g=H):(typeof A.componentDidMount=="function"&&(a.flags|=4194308),g=!1)}else{A=a.stateNode,Gx(r,a),H=a.memoizedProps,re=a.type===a.elementType?H:Rs(a.type,H),A.props=re,me=a.pendingProps,ue=A.context,V=d.contextType,typeof V=="object"&&V!==null?V=ds(V):(V=Ln(d)?go:ln.current,V=ia(a,V));var ke=d.getDerivedStateFromProps;(de=typeof ke=="function"||typeof A.getSnapshotBeforeUpdate=="function")||typeof A.UNSAFE_componentWillReceiveProps!="function"&&typeof A.componentWillReceiveProps!="function"||(H!==me||ue!==V)&&yy(a,A,g,V),Ir=!1,ue=a.memoizedState,A.state=ue,Ec(a,g,A,k);var _e=a.memoizedState;H!==me||ue!==_e||Pn.current||Ir?(typeof ke=="function"&&(sm(a,d,ke,g),_e=a.memoizedState),(re=Ir||gy(a,d,re,g,ue,_e,V)||!1)?(de||typeof A.UNSAFE_componentWillUpdate!="function"&&typeof A.componentWillUpdate!="function"||(typeof A.componentWillUpdate=="function"&&A.componentWillUpdate(g,_e,V),typeof A.UNSAFE_componentWillUpdate=="function"&&A.UNSAFE_componentWillUpdate(g,_e,V)),typeof A.componentDidUpdate=="function"&&(a.flags|=4),typeof A.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof A.componentDidUpdate!="function"||H===r.memoizedProps&&ue===r.memoizedState||(a.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||H===r.memoizedProps&&ue===r.memoizedState||(a.flags|=1024),a.memoizedProps=g,a.memoizedState=_e),A.props=g,A.state=_e,A.context=V,g=re):(typeof A.componentDidUpdate!="function"||H===r.memoizedProps&&ue===r.memoizedState||(a.flags|=4),typeof A.getSnapshotBeforeUpdate!="function"||H===r.memoizedProps&&ue===r.memoizedState||(a.flags|=1024),g=!1)}return lm(r,a,d,g,N,k)}function lm(r,a,d,g,k,N){Ey(r,a);var A=(a.flags&128)!==0;if(!g&&!A)return k&&Mx(a,d,!1),mr(r,a,N);g=a.stateNode,i2.current=a;var H=A&&typeof d.getDerivedStateFromError!="function"?null:g.render();return a.flags|=1,r!==null&&A?(a.child=da(a,r.child,null,N),a.child=da(a,null,H,N)):xn(r,a,H,N),a.memoizedState=g.state,k&&Mx(a,d,!0),a.child}function Cy(r){var a=r.stateNode;a.pendingContext?Ax(r,a.pendingContext,a.pendingContext!==a.context):a.context&&Ax(r,a.context,!1),Gf(r,a.containerInfo)}function Ry(r,a,d,g,k){return ua(),zf(k),a.flags|=256,xn(r,a,d,g),a.child}var cm={dehydrated:null,treeContext:null,retryLane:0};function um(r){return{baseLanes:r,cachePool:null,transitions:null}}function Ay(r,a,d){var g=a.pendingProps,k=kt.current,N=!1,A=(a.flags&128)!==0,H;if((H=A)||(H=r!==null&&r.memoizedState===null?!1:(k&2)!==0),H?(N=!0,a.flags&=-129):(r===null||r.memoizedState!==null)&&(k|=1),mt(kt,k&1),r===null)return If(a),r=a.memoizedState,r!==null&&(r=r.dehydrated,r!==null)?((a.mode&1)===0?a.lanes=1:r.data==="$!"?a.lanes=8:a.lanes=1073741824,null):(A=g.children,r=g.fallback,N?(g=a.mode,N=a.child,A={mode:"hidden",children:A},(g&1)===0&&N!==null?(N.childLanes=0,N.pendingProps=A):N=Xc(A,g,0,null),r=_o(r,g,d,null),N.return=a,r.return=a,N.sibling=r,a.child=N,a.child.memoizedState=um(d),a.memoizedState=cm,r):dm(a,A));if(k=r.memoizedState,k!==null&&(H=k.dehydrated,H!==null))return l2(r,a,A,g,H,k,d);if(N){N=g.fallback,A=a.mode,k=r.child,H=k.sibling;var V={mode:"hidden",children:g.children};return(A&1)===0&&a.child!==k?(g=a.child,g.childLanes=0,g.pendingProps=V,a.deletions=null):(g=Br(k,V),g.subtreeFlags=k.subtreeFlags&14680064),H!==null?N=Br(H,N):(N=_o(N,A,d,null),N.flags|=2),N.return=a,g.return=a,g.sibling=N,a.child=g,g=N,N=a.child,A=r.child.memoizedState,A=A===null?um(d):{baseLanes:A.baseLanes|d,cachePool:null,transitions:A.transitions},N.memoizedState=A,N.childLanes=r.childLanes&~d,a.memoizedState=cm,g}return N=r.child,r=N.sibling,g=Br(N,{mode:"visible",children:g.children}),(a.mode&1)===0&&(g.lanes=d),g.return=a,g.sibling=null,r!==null&&(d=a.deletions,d===null?(a.deletions=[r],a.flags|=16):d.push(r)),a.child=g,a.memoizedState=null,g}function dm(r,a){return a=Xc({mode:"visible",children:a},r.mode,0,null),a.return=r,r.child=a}function Lc(r,a,d,g){return g!==null&&zf(g),da(a,r.child,null,d),r=dm(a,a.pendingProps.children),r.flags|=2,a.memoizedState=null,r}function l2(r,a,d,g,k,N,A){if(d)return a.flags&256?(a.flags&=-257,g=om(Error(n(422))),Lc(r,a,A,g)):a.memoizedState!==null?(a.child=r.child,a.flags|=128,null):(N=g.fallback,k=a.mode,g=Xc({mode:"visible",children:g.children},k,0,null),N=_o(N,k,A,null),N.flags|=2,g.return=a,N.return=a,g.sibling=N,a.child=g,(a.mode&1)!==0&&da(a,r.child,null,A),a.child.memoizedState=um(A),a.memoizedState=cm,N);if((a.mode&1)===0)return Lc(r,a,A,null);if(k.data==="$!"){if(g=k.nextSibling&&k.nextSibling.dataset,g)var H=g.dgst;return g=H,N=Error(n(419)),g=om(N,g,void 0),Lc(r,a,A,g)}if(H=(A&r.childLanes)!==0,In||H){if(g=qt,g!==null){switch(A&-A){case 4:k=2;break;case 16:k=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:k=32;break;case 536870912:k=268435456;break;default:k=0}k=(k&(g.suspendedLanes|A))!==0?0:k,k!==0&&k!==N.retryLane&&(N.retryLane=k,dr(r,k),Ms(g,r,k,-1))}return $m(),g=om(Error(n(421))),Lc(r,a,A,g)}return k.data==="$?"?(a.flags|=128,a.child=r.child,a=w2.bind(null,r),k._reactRetry=a,null):(r=N.treeContext,Yn=Or(k.nextSibling),Xn=a,yt=!0,Cs=null,r!==null&&(cs[us++]=cr,cs[us++]=ur,cs[us++]=xo,cr=r.id,ur=r.overflow,xo=a),a=dm(a,g.children),a.flags|=4096,a)}function Oy(r,a,d){r.lanes|=a;var g=r.alternate;g!==null&&(g.lanes|=a),Wf(r.return,a,d)}function fm(r,a,d,g,k){var N=r.memoizedState;N===null?r.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:g,tail:d,tailMode:k}:(N.isBackwards=a,N.rendering=null,N.renderingStartTime=0,N.last=g,N.tail=d,N.tailMode=k)}function My(r,a,d){var g=a.pendingProps,k=g.revealOrder,N=g.tail;if(xn(r,a,g.children,d),g=kt.current,(g&2)!==0)g=g&1|2,a.flags|=128;else{if(r!==null&&(r.flags&128)!==0)e:for(r=a.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&Oy(r,d,a);else if(r.tag===19)Oy(r,d,a);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===a)break e;for(;r.sibling===null;){if(r.return===null||r.return===a)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}g&=1}if(mt(kt,g),(a.mode&1)===0)a.memoizedState=null;else switch(k){case"forwards":for(d=a.child,k=null;d!==null;)r=d.alternate,r!==null&&Tc(r)===null&&(k=d),d=d.sibling;d=k,d===null?(k=a.child,a.child=null):(k=d.sibling,d.sibling=null),fm(a,!1,k,d,N);break;case"backwards":for(d=null,k=a.child,a.child=null;k!==null;){if(r=k.alternate,r!==null&&Tc(r)===null){a.child=k;break}r=k.sibling,k.sibling=d,d=k,k=r}fm(a,!0,d,null,N);break;case"together":fm(a,!1,null,null,void 0);break;default:a.memoizedState=null}return a.child}function Ic(r,a){(a.mode&1)===0&&r!==null&&(r.alternate=null,a.alternate=null,a.flags|=2)}function mr(r,a,d){if(r!==null&&(a.dependencies=r.dependencies),ko|=a.lanes,(d&a.childLanes)===0)return null;if(r!==null&&a.child!==r.child)throw Error(n(153));if(a.child!==null){for(r=a.child,d=Br(r,r.pendingProps),a.child=d,d.return=a;r.sibling!==null;)r=r.sibling,d=d.sibling=Br(r,r.pendingProps),d.return=a;d.sibling=null}return a.child}function c2(r,a,d){switch(a.tag){case 3:Cy(a),ua();break;case 5:Kx(a);break;case 1:Ln(a.type)&&vc(a);break;case 4:Gf(a,a.stateNode.containerInfo);break;case 10:var g=a.type._context,k=a.memoizedProps.value;mt(Sc,g._currentValue),g._currentValue=k;break;case 13:if(g=a.memoizedState,g!==null)return g.dehydrated!==null?(mt(kt,kt.current&1),a.flags|=128,null):(d&a.child.childLanes)!==0?Ay(r,a,d):(mt(kt,kt.current&1),r=mr(r,a,d),r!==null?r.sibling:null);mt(kt,kt.current&1);break;case 19:if(g=(d&a.childLanes)!==0,(r.flags&128)!==0){if(g)return My(r,a,d);a.flags|=128}if(k=a.memoizedState,k!==null&&(k.rendering=null,k.tail=null,k.lastEffect=null),mt(kt,kt.current),g)break;return null;case 22:case 23:return a.lanes=0,$y(r,a,d)}return mr(r,a,d)}var Py,mm,Ly,Iy;Py=function(r,a){for(var d=a.child;d!==null;){if(d.tag===5||d.tag===6)r.appendChild(d.stateNode);else if(d.tag!==4&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===a)break;for(;d.sibling===null;){if(d.return===null||d.return===a)return;d=d.return}d.sibling.return=d.return,d=d.sibling}},mm=function(){},Ly=function(r,a,d,g){var k=r.memoizedProps;if(k!==g){r=a.stateNode,bo(qs.current);var N=null;switch(d){case"input":k=Re(r,k),g=Re(r,g),N=[];break;case"select":k=G({},k,{value:void 0}),g=G({},g,{value:void 0}),N=[];break;case"textarea":k=os(r,k),g=os(r,g),N=[];break;default:typeof k.onClick!="function"&&typeof g.onClick=="function"&&(r.onclick=gc)}as(d,g);var A;d=null;for(re in k)if(!g.hasOwnProperty(re)&&k.hasOwnProperty(re)&&k[re]!=null)if(re==="style"){var H=k[re];for(A in H)H.hasOwnProperty(A)&&(d||(d={}),d[A]="")}else re!=="dangerouslySetInnerHTML"&&re!=="children"&&re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&re!=="autoFocus"&&(i.hasOwnProperty(re)?N||(N=[]):(N=N||[]).push(re,null));for(re in g){var V=g[re];if(H=k!=null?k[re]:void 0,g.hasOwnProperty(re)&&V!==H&&(V!=null||H!=null))if(re==="style")if(H){for(A in H)!H.hasOwnProperty(A)||V&&V.hasOwnProperty(A)||(d||(d={}),d[A]="");for(A in V)V.hasOwnProperty(A)&&H[A]!==V[A]&&(d||(d={}),d[A]=V[A])}else d||(N||(N=[]),N.push(re,d)),d=V;else re==="dangerouslySetInnerHTML"?(V=V?V.__html:void 0,H=H?H.__html:void 0,V!=null&&H!==V&&(N=N||[]).push(re,V)):re==="children"?typeof V!="string"&&typeof V!="number"||(N=N||[]).push(re,""+V):re!=="suppressContentEditableWarning"&&re!=="suppressHydrationWarning"&&(i.hasOwnProperty(re)?(V!=null&&re==="onScroll"&&pt("scroll",r),N||H===V||(N=[])):(N=N||[]).push(re,V))}d&&(N=N||[]).push("style",d);var re=N;(a.updateQueue=re)&&(a.flags|=4)}},Iy=function(r,a,d,g){d!==g&&(a.flags|=4)};function Pi(r,a){if(!yt)switch(r.tailMode){case"hidden":a=r.tail;for(var d=null;a!==null;)a.alternate!==null&&(d=a),a=a.sibling;d===null?r.tail=null:d.sibling=null;break;case"collapsed":d=r.tail;for(var g=null;d!==null;)d.alternate!==null&&(g=d),d=d.sibling;g===null?a||r.tail===null?r.tail=null:r.tail.sibling=null:g.sibling=null}}function un(r){var a=r.alternate!==null&&r.alternate.child===r.child,d=0,g=0;if(a)for(var k=r.child;k!==null;)d|=k.lanes|k.childLanes,g|=k.subtreeFlags&14680064,g|=k.flags&14680064,k.return=r,k=k.sibling;else for(k=r.child;k!==null;)d|=k.lanes|k.childLanes,g|=k.subtreeFlags,g|=k.flags,k.return=r,k=k.sibling;return r.subtreeFlags|=g,r.childLanes=d,a}function u2(r,a,d){var g=a.pendingProps;switch(Pf(a),a.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return un(a),null;case 1:return Ln(a.type)&&yc(),un(a),null;case 3:return g=a.stateNode,pa(),ht(Pn),ht(ln),Kf(),g.pendingContext&&(g.context=g.pendingContext,g.pendingContext=null),(r===null||r.child===null)&&(jc(a)?a.flags|=4:r===null||r.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Cs!==null&&(Nm(Cs),Cs=null))),mm(r,a),un(a),null;case 5:qf(a);var k=bo(Ci.current);if(d=a.type,r!==null&&a.stateNode!=null)Ly(r,a,d,g,k),r.ref!==a.ref&&(a.flags|=512,a.flags|=2097152);else{if(!g){if(a.stateNode===null)throw Error(n(166));return un(a),null}if(r=bo(qs.current),jc(a)){g=a.stateNode,d=a.type;var N=a.memoizedProps;switch(g[Gs]=a,g[Si]=N,r=(a.mode&1)!==0,d){case"dialog":pt("cancel",g),pt("close",g);break;case"iframe":case"object":case"embed":pt("load",g);break;case"video":case"audio":for(k=0;k<ki.length;k++)pt(ki[k],g);break;case"source":pt("error",g);break;case"img":case"image":case"link":pt("error",g),pt("load",g);break;case"details":pt("toggle",g);break;case"input":Xe(g,N),pt("invalid",g);break;case"select":g._wrapperState={wasMultiple:!!N.multiple},pt("invalid",g);break;case"textarea":gn(g,N),pt("invalid",g)}as(d,N),k=null;for(var A in N)if(N.hasOwnProperty(A)){var H=N[A];A==="children"?typeof H=="string"?g.textContent!==H&&(N.suppressHydrationWarning!==!0&&hc(g.textContent,H,r),k=["children",H]):typeof H=="number"&&g.textContent!==""+H&&(N.suppressHydrationWarning!==!0&&hc(g.textContent,H,r),k=["children",""+H]):i.hasOwnProperty(A)&&H!=null&&A==="onScroll"&&pt("scroll",g)}switch(d){case"input":Oe(g),et(g,N,!0);break;case"textarea":Oe(g),ot(g);break;case"select":case"option":break;default:typeof N.onClick=="function"&&(g.onclick=gc)}g=k,a.updateQueue=g,g!==null&&(a.flags|=4)}else{A=k.nodeType===9?k:k.ownerDocument,r==="http://www.w3.org/1999/xhtml"&&(r=ct(d)),r==="http://www.w3.org/1999/xhtml"?d==="script"?(r=A.createElement("div"),r.innerHTML="<script><\/script>",r=r.removeChild(r.firstChild)):typeof g.is=="string"?r=A.createElement(d,{is:g.is}):(r=A.createElement(d),d==="select"&&(A=r,g.multiple?A.multiple=!0:g.size&&(A.size=g.size))):r=A.createElementNS(r,d),r[Gs]=a,r[Si]=g,Py(r,a,!1,!1),a.stateNode=r;e:{switch(A=is(d,g),d){case"dialog":pt("cancel",r),pt("close",r),k=g;break;case"iframe":case"object":case"embed":pt("load",r),k=g;break;case"video":case"audio":for(k=0;k<ki.length;k++)pt(ki[k],r);k=g;break;case"source":pt("error",r),k=g;break;case"img":case"image":case"link":pt("error",r),pt("load",r),k=g;break;case"details":pt("toggle",r),k=g;break;case"input":Xe(r,g),k=Re(r,g),pt("invalid",r);break;case"option":k=g;break;case"select":r._wrapperState={wasMultiple:!!g.multiple},k=G({},g,{value:void 0}),pt("invalid",r);break;case"textarea":gn(r,g),k=os(r,g),pt("invalid",r);break;default:k=g}as(d,k),H=k;for(N in H)if(H.hasOwnProperty(N)){var V=H[N];N==="style"?Zt(r,V):N==="dangerouslySetInnerHTML"?(V=V?V.__html:void 0,V!=null&&Mt(r,V)):N==="children"?typeof V=="string"?(d!=="textarea"||V!=="")&&ut(r,V):typeof V=="number"&&ut(r,""+V):N!=="suppressContentEditableWarning"&&N!=="suppressHydrationWarning"&&N!=="autoFocus"&&(i.hasOwnProperty(N)?V!=null&&N==="onScroll"&&pt("scroll",r):V!=null&&$(r,N,V,A))}switch(d){case"input":Oe(r),et(r,g,!1);break;case"textarea":Oe(r),ot(r);break;case"option":g.value!=null&&r.setAttribute("value",""+ye(g.value));break;case"select":r.multiple=!!g.multiple,N=g.value,N!=null?_t(r,!!g.multiple,N,!1):g.defaultValue!=null&&_t(r,!!g.multiple,g.defaultValue,!0);break;default:typeof k.onClick=="function"&&(r.onclick=gc)}switch(d){case"button":case"input":case"select":case"textarea":g=!!g.autoFocus;break e;case"img":g=!0;break e;default:g=!1}}g&&(a.flags|=4)}a.ref!==null&&(a.flags|=512,a.flags|=2097152)}return un(a),null;case 6:if(r&&a.stateNode!=null)Iy(r,a,r.memoizedProps,g);else{if(typeof g!="string"&&a.stateNode===null)throw Error(n(166));if(d=bo(Ci.current),bo(qs.current),jc(a)){if(g=a.stateNode,d=a.memoizedProps,g[Gs]=a,(N=g.nodeValue!==d)&&(r=Xn,r!==null))switch(r.tag){case 3:hc(g.nodeValue,d,(r.mode&1)!==0);break;case 5:r.memoizedProps.suppressHydrationWarning!==!0&&hc(g.nodeValue,d,(r.mode&1)!==0)}N&&(a.flags|=4)}else g=(d.nodeType===9?d:d.ownerDocument).createTextNode(g),g[Gs]=a,a.stateNode=g}return un(a),null;case 13:if(ht(kt),g=a.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(yt&&Yn!==null&&(a.mode&1)!==0&&(a.flags&128)===0)Fx(),ua(),a.flags|=98560,N=!1;else if(N=jc(a),g!==null&&g.dehydrated!==null){if(r===null){if(!N)throw Error(n(318));if(N=a.memoizedState,N=N!==null?N.dehydrated:null,!N)throw Error(n(317));N[Gs]=a}else ua(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;un(a),N=!1}else Cs!==null&&(Nm(Cs),Cs=null),N=!0;if(!N)return a.flags&65536?a:null}return(a.flags&128)!==0?(a.lanes=d,a):(g=g!==null,g!==(r!==null&&r.memoizedState!==null)&&g&&(a.child.flags|=8192,(a.mode&1)!==0&&(r===null||(kt.current&1)!==0?Ut===0&&(Ut=3):$m())),a.updateQueue!==null&&(a.flags|=4),un(a),null);case 4:return pa(),mm(r,a),r===null&&ji(a.stateNode.containerInfo),un(a),null;case 10:return Uf(a.type._context),un(a),null;case 17:return Ln(a.type)&&yc(),un(a),null;case 19:if(ht(kt),N=a.memoizedState,N===null)return un(a),null;if(g=(a.flags&128)!==0,A=N.rendering,A===null)if(g)Pi(N,!1);else{if(Ut!==0||r!==null&&(r.flags&128)!==0)for(r=a.child;r!==null;){if(A=Tc(r),A!==null){for(a.flags|=128,Pi(N,!1),g=A.updateQueue,g!==null&&(a.updateQueue=g,a.flags|=4),a.subtreeFlags=0,g=d,d=a.child;d!==null;)N=d,r=g,N.flags&=14680066,A=N.alternate,A===null?(N.childLanes=0,N.lanes=r,N.child=null,N.subtreeFlags=0,N.memoizedProps=null,N.memoizedState=null,N.updateQueue=null,N.dependencies=null,N.stateNode=null):(N.childLanes=A.childLanes,N.lanes=A.lanes,N.child=A.child,N.subtreeFlags=0,N.deletions=null,N.memoizedProps=A.memoizedProps,N.memoizedState=A.memoizedState,N.updateQueue=A.updateQueue,N.type=A.type,r=A.dependencies,N.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),d=d.sibling;return mt(kt,kt.current&1|2),a.child}r=r.sibling}N.tail!==null&&Be()>ya&&(a.flags|=128,g=!0,Pi(N,!1),a.lanes=4194304)}else{if(!g)if(r=Tc(A),r!==null){if(a.flags|=128,g=!0,d=r.updateQueue,d!==null&&(a.updateQueue=d,a.flags|=4),Pi(N,!0),N.tail===null&&N.tailMode==="hidden"&&!A.alternate&&!yt)return un(a),null}else 2*Be()-N.renderingStartTime>ya&&d!==1073741824&&(a.flags|=128,g=!0,Pi(N,!1),a.lanes=4194304);N.isBackwards?(A.sibling=a.child,a.child=A):(d=N.last,d!==null?d.sibling=A:a.child=A,N.last=A)}return N.tail!==null?(a=N.tail,N.rendering=a,N.tail=a.sibling,N.renderingStartTime=Be(),a.sibling=null,d=kt.current,mt(kt,g?d&1|2:d&1),a):(un(a),null);case 22:case 23:return _m(),g=a.memoizedState!==null,r!==null&&r.memoizedState!==null!==g&&(a.flags|=8192),g&&(a.mode&1)!==0?(Qn&1073741824)!==0&&(un(a),a.subtreeFlags&6&&(a.flags|=8192)):un(a),null;case 24:return null;case 25:return null}throw Error(n(156,a.tag))}function d2(r,a){switch(Pf(a),a.tag){case 1:return Ln(a.type)&&yc(),r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 3:return pa(),ht(Pn),ht(ln),Kf(),r=a.flags,(r&65536)!==0&&(r&128)===0?(a.flags=r&-65537|128,a):null;case 5:return qf(a),null;case 13:if(ht(kt),r=a.memoizedState,r!==null&&r.dehydrated!==null){if(a.alternate===null)throw Error(n(340));ua()}return r=a.flags,r&65536?(a.flags=r&-65537|128,a):null;case 19:return ht(kt),null;case 4:return pa(),null;case 10:return Uf(a.type._context),null;case 22:case 23:return _m(),null;case 24:return null;default:return null}}var zc=!1,dn=!1,f2=typeof WeakSet=="function"?WeakSet:Set,Se=null;function ga(r,a){var d=r.ref;if(d!==null)if(typeof d=="function")try{d(null)}catch(g){Et(r,a,g)}else d.current=null}function pm(r,a,d){try{d()}catch(g){Et(r,a,g)}}var zy=!1;function m2(r,a){if(_f=rc,r=gx(),yf(r)){if("selectionStart"in r)var d={start:r.selectionStart,end:r.selectionEnd};else e:{d=(d=r.ownerDocument)&&d.defaultView||window;var g=d.getSelection&&d.getSelection();if(g&&g.rangeCount!==0){d=g.anchorNode;var k=g.anchorOffset,N=g.focusNode;g=g.focusOffset;try{d.nodeType,N.nodeType}catch{d=null;break e}var A=0,H=-1,V=-1,re=0,de=0,me=r,ue=null;t:for(;;){for(var ke;me!==d||k!==0&&me.nodeType!==3||(H=A+k),me!==N||g!==0&&me.nodeType!==3||(V=A+g),me.nodeType===3&&(A+=me.nodeValue.length),(ke=me.firstChild)!==null;)ue=me,me=ke;for(;;){if(me===r)break t;if(ue===d&&++re===k&&(H=A),ue===N&&++de===g&&(V=A),(ke=me.nextSibling)!==null)break;me=ue,ue=me.parentNode}me=ke}d=H===-1||V===-1?null:{start:H,end:V}}else d=null}d=d||{start:0,end:0}}else d=null;for($f={focusedElem:r,selectionRange:d},rc=!1,Se=a;Se!==null;)if(a=Se,r=a.child,(a.subtreeFlags&1028)!==0&&r!==null)r.return=a,Se=r;else for(;Se!==null;){a=Se;try{var _e=a.alternate;if((a.flags&1024)!==0)switch(a.tag){case 0:case 11:case 15:break;case 1:if(_e!==null){var $e=_e.memoizedProps,Rt=_e.memoizedState,te=a.stateNode,Q=te.getSnapshotBeforeUpdate(a.elementType===a.type?$e:Rs(a.type,$e),Rt);te.__reactInternalSnapshotBeforeUpdate=Q}break;case 3:var se=a.stateNode.containerInfo;se.nodeType===1?se.textContent="":se.nodeType===9&&se.documentElement&&se.removeChild(se.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(n(163))}}catch(ge){Et(a,a.return,ge)}if(r=a.sibling,r!==null){r.return=a.return,Se=r;break}Se=a.return}return _e=zy,zy=!1,_e}function Li(r,a,d){var g=a.updateQueue;if(g=g!==null?g.lastEffect:null,g!==null){var k=g=g.next;do{if((k.tag&r)===r){var N=k.destroy;k.destroy=void 0,N!==void 0&&pm(a,d,N)}k=k.next}while(k!==g)}}function Dc(r,a){if(a=a.updateQueue,a=a!==null?a.lastEffect:null,a!==null){var d=a=a.next;do{if((d.tag&r)===r){var g=d.create;d.destroy=g()}d=d.next}while(d!==a)}}function hm(r){var a=r.ref;if(a!==null){var d=r.stateNode;switch(r.tag){case 5:r=d;break;default:r=d}typeof a=="function"?a(r):a.current=r}}function Dy(r){var a=r.alternate;a!==null&&(r.alternate=null,Dy(a)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(a=r.stateNode,a!==null&&(delete a[Gs],delete a[Si],delete a[Rf],delete a[XS],delete a[YS])),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}function Fy(r){return r.tag===5||r.tag===3||r.tag===4}function Uy(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||Fy(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function gm(r,a,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,a?d.nodeType===8?d.parentNode.insertBefore(r,a):d.insertBefore(r,a):(d.nodeType===8?(a=d.parentNode,a.insertBefore(r,d)):(a=d,a.appendChild(r)),d=d._reactRootContainer,d!=null||a.onclick!==null||(a.onclick=gc));else if(g!==4&&(r=r.child,r!==null))for(gm(r,a,d),r=r.sibling;r!==null;)gm(r,a,d),r=r.sibling}function xm(r,a,d){var g=r.tag;if(g===5||g===6)r=r.stateNode,a?d.insertBefore(r,a):d.appendChild(r);else if(g!==4&&(r=r.child,r!==null))for(xm(r,a,d),r=r.sibling;r!==null;)xm(r,a,d),r=r.sibling}var en=null,As=!1;function Dr(r,a,d){for(d=d.child;d!==null;)Wy(r,a,d),d=d.sibling}function Wy(r,a,d){if(Vn&&typeof Vn.onCommitFiberUnmount=="function")try{Vn.onCommitFiberUnmount(po,d)}catch{}switch(d.tag){case 5:dn||ga(d,a);case 6:var g=en,k=As;en=null,Dr(r,a,d),en=g,As=k,en!==null&&(As?(r=en,d=d.stateNode,r.nodeType===8?r.parentNode.removeChild(d):r.removeChild(d)):en.removeChild(d.stateNode));break;case 18:en!==null&&(As?(r=en,d=d.stateNode,r.nodeType===8?Cf(r.parentNode,d):r.nodeType===1&&Cf(r,d),pi(r)):Cf(en,d.stateNode));break;case 4:g=en,k=As,en=d.stateNode.containerInfo,As=!0,Dr(r,a,d),en=g,As=k;break;case 0:case 11:case 14:case 15:if(!dn&&(g=d.updateQueue,g!==null&&(g=g.lastEffect,g!==null))){k=g=g.next;do{var N=k,A=N.destroy;N=N.tag,A!==void 0&&((N&2)!==0||(N&4)!==0)&&pm(d,a,A),k=k.next}while(k!==g)}Dr(r,a,d);break;case 1:if(!dn&&(ga(d,a),g=d.stateNode,typeof g.componentWillUnmount=="function"))try{g.props=d.memoizedProps,g.state=d.memoizedState,g.componentWillUnmount()}catch(H){Et(d,a,H)}Dr(r,a,d);break;case 21:Dr(r,a,d);break;case 22:d.mode&1?(dn=(g=dn)||d.memoizedState!==null,Dr(r,a,d),dn=g):Dr(r,a,d);break;default:Dr(r,a,d)}}function Hy(r){var a=r.updateQueue;if(a!==null){r.updateQueue=null;var d=r.stateNode;d===null&&(d=r.stateNode=new f2),a.forEach(function(g){var k=k2.bind(null,r,g);d.has(g)||(d.add(g),g.then(k,k))})}}function Os(r,a){var d=a.deletions;if(d!==null)for(var g=0;g<d.length;g++){var k=d[g];try{var N=r,A=a,H=A;e:for(;H!==null;){switch(H.tag){case 5:en=H.stateNode,As=!1;break e;case 3:en=H.stateNode.containerInfo,As=!0;break e;case 4:en=H.stateNode.containerInfo,As=!0;break e}H=H.return}if(en===null)throw Error(n(160));Wy(N,A,k),en=null,As=!1;var V=k.alternate;V!==null&&(V.return=null),k.return=null}catch(re){Et(k,a,re)}}if(a.subtreeFlags&12854)for(a=a.child;a!==null;)By(a,r),a=a.sibling}function By(r,a){var d=r.alternate,g=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:if(Os(a,r),Ks(r),g&4){try{Li(3,r,r.return),Dc(3,r)}catch($e){Et(r,r.return,$e)}try{Li(5,r,r.return)}catch($e){Et(r,r.return,$e)}}break;case 1:Os(a,r),Ks(r),g&512&&d!==null&&ga(d,d.return);break;case 5:if(Os(a,r),Ks(r),g&512&&d!==null&&ga(d,d.return),r.flags&32){var k=r.stateNode;try{ut(k,"")}catch($e){Et(r,r.return,$e)}}if(g&4&&(k=r.stateNode,k!=null)){var N=r.memoizedProps,A=d!==null?d.memoizedProps:N,H=r.type,V=r.updateQueue;if(r.updateQueue=null,V!==null)try{H==="input"&&N.type==="radio"&&N.name!=null&&Yt(k,N),is(H,A);var re=is(H,N);for(A=0;A<V.length;A+=2){var de=V[A],me=V[A+1];de==="style"?Zt(k,me):de==="dangerouslySetInnerHTML"?Mt(k,me):de==="children"?ut(k,me):$(k,de,me,re)}switch(H){case"input":De(k,N);break;case"textarea":Qt(k,N);break;case"select":var ue=k._wrapperState.wasMultiple;k._wrapperState.wasMultiple=!!N.multiple;var ke=N.value;ke!=null?_t(k,!!N.multiple,ke,!1):ue!==!!N.multiple&&(N.defaultValue!=null?_t(k,!!N.multiple,N.defaultValue,!0):_t(k,!!N.multiple,N.multiple?[]:"",!1))}k[Si]=N}catch($e){Et(r,r.return,$e)}}break;case 6:if(Os(a,r),Ks(r),g&4){if(r.stateNode===null)throw Error(n(162));k=r.stateNode,N=r.memoizedProps;try{k.nodeValue=N}catch($e){Et(r,r.return,$e)}}break;case 3:if(Os(a,r),Ks(r),g&4&&d!==null&&d.memoizedState.isDehydrated)try{pi(a.containerInfo)}catch($e){Et(r,r.return,$e)}break;case 4:Os(a,r),Ks(r);break;case 13:Os(a,r),Ks(r),k=r.child,k.flags&8192&&(N=k.memoizedState!==null,k.stateNode.isHidden=N,!N||k.alternate!==null&&k.alternate.memoizedState!==null||(bm=Be())),g&4&&Hy(r);break;case 22:if(de=d!==null&&d.memoizedState!==null,r.mode&1?(dn=(re=dn)||de,Os(a,r),dn=re):Os(a,r),Ks(r),g&8192){if(re=r.memoizedState!==null,(r.stateNode.isHidden=re)&&!de&&(r.mode&1)!==0)for(Se=r,de=r.child;de!==null;){for(me=Se=de;Se!==null;){switch(ue=Se,ke=ue.child,ue.tag){case 0:case 11:case 14:case 15:Li(4,ue,ue.return);break;case 1:ga(ue,ue.return);var _e=ue.stateNode;if(typeof _e.componentWillUnmount=="function"){g=ue,d=ue.return;try{a=g,_e.props=a.memoizedProps,_e.state=a.memoizedState,_e.componentWillUnmount()}catch($e){Et(g,d,$e)}}break;case 5:ga(ue,ue.return);break;case 22:if(ue.memoizedState!==null){Vy(me);continue}}ke!==null?(ke.return=ue,Se=ke):Vy(me)}de=de.sibling}e:for(de=null,me=r;;){if(me.tag===5){if(de===null){de=me;try{k=me.stateNode,re?(N=k.style,typeof N.setProperty=="function"?N.setProperty("display","none","important"):N.display="none"):(H=me.stateNode,V=me.memoizedProps.style,A=V!=null&&V.hasOwnProperty("display")?V.display:null,H.style.display=Tn("display",A))}catch($e){Et(r,r.return,$e)}}}else if(me.tag===6){if(de===null)try{me.stateNode.nodeValue=re?"":me.memoizedProps}catch($e){Et(r,r.return,$e)}}else if((me.tag!==22&&me.tag!==23||me.memoizedState===null||me===r)&&me.child!==null){me.child.return=me,me=me.child;continue}if(me===r)break e;for(;me.sibling===null;){if(me.return===null||me.return===r)break e;de===me&&(de=null),me=me.return}de===me&&(de=null),me.sibling.return=me.return,me=me.sibling}}break;case 19:Os(a,r),Ks(r),g&4&&Hy(r);break;case 21:break;default:Os(a,r),Ks(r)}}function Ks(r){var a=r.flags;if(a&2){try{e:{for(var d=r.return;d!==null;){if(Fy(d)){var g=d;break e}d=d.return}throw Error(n(160))}switch(g.tag){case 5:var k=g.stateNode;g.flags&32&&(ut(k,""),g.flags&=-33);var N=Uy(r);xm(r,N,k);break;case 3:case 4:var A=g.stateNode.containerInfo,H=Uy(r);gm(r,H,A);break;default:throw Error(n(161))}}catch(V){Et(r,r.return,V)}r.flags&=-3}a&4096&&(r.flags&=-4097)}function p2(r,a,d){Se=r,Gy(r)}function Gy(r,a,d){for(var g=(r.mode&1)!==0;Se!==null;){var k=Se,N=k.child;if(k.tag===22&&g){var A=k.memoizedState!==null||zc;if(!A){var H=k.alternate,V=H!==null&&H.memoizedState!==null||dn;H=zc;var re=dn;if(zc=A,(dn=V)&&!re)for(Se=k;Se!==null;)A=Se,V=A.child,A.tag===22&&A.memoizedState!==null?Ky(k):V!==null?(V.return=A,Se=V):Ky(k);for(;N!==null;)Se=N,Gy(N),N=N.sibling;Se=k,zc=H,dn=re}qy(r)}else(k.subtreeFlags&8772)!==0&&N!==null?(N.return=k,Se=N):qy(r)}}function qy(r){for(;Se!==null;){var a=Se;if((a.flags&8772)!==0){var d=a.alternate;try{if((a.flags&8772)!==0)switch(a.tag){case 0:case 11:case 15:dn||Dc(5,a);break;case 1:var g=a.stateNode;if(a.flags&4&&!dn)if(d===null)g.componentDidMount();else{var k=a.elementType===a.type?d.memoizedProps:Rs(a.type,d.memoizedProps);g.componentDidUpdate(k,d.memoizedState,g.__reactInternalSnapshotBeforeUpdate)}var N=a.updateQueue;N!==null&&Vx(a,N,g);break;case 3:var A=a.updateQueue;if(A!==null){if(d=null,a.child!==null)switch(a.child.tag){case 5:d=a.child.stateNode;break;case 1:d=a.child.stateNode}Vx(a,A,d)}break;case 5:var H=a.stateNode;if(d===null&&a.flags&4){d=H;var V=a.memoizedProps;switch(a.type){case"button":case"input":case"select":case"textarea":V.autoFocus&&d.focus();break;case"img":V.src&&(d.src=V.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(a.memoizedState===null){var re=a.alternate;if(re!==null){var de=re.memoizedState;if(de!==null){var me=de.dehydrated;me!==null&&pi(me)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(n(163))}dn||a.flags&512&&hm(a)}catch(ue){Et(a,a.return,ue)}}if(a===r){Se=null;break}if(d=a.sibling,d!==null){d.return=a.return,Se=d;break}Se=a.return}}function Vy(r){for(;Se!==null;){var a=Se;if(a===r){Se=null;break}var d=a.sibling;if(d!==null){d.return=a.return,Se=d;break}Se=a.return}}function Ky(r){for(;Se!==null;){var a=Se;try{switch(a.tag){case 0:case 11:case 15:var d=a.return;try{Dc(4,a)}catch(V){Et(a,d,V)}break;case 1:var g=a.stateNode;if(typeof g.componentDidMount=="function"){var k=a.return;try{g.componentDidMount()}catch(V){Et(a,k,V)}}var N=a.return;try{hm(a)}catch(V){Et(a,N,V)}break;case 5:var A=a.return;try{hm(a)}catch(V){Et(a,A,V)}}}catch(V){Et(a,a.return,V)}if(a===r){Se=null;break}var H=a.sibling;if(H!==null){H.return=a.return,Se=H;break}Se=a.return}}var h2=Math.ceil,Fc=_.ReactCurrentDispatcher,ym=_.ReactCurrentOwner,ms=_.ReactCurrentBatchConfig,tt=0,qt=null,Pt=null,tn=0,Qn=0,xa=Mr(0),Ut=0,Ii=null,ko=0,Uc=0,vm=0,zi=null,zn=null,bm=0,ya=1/0,pr=null,Wc=!1,wm=null,Fr=null,Hc=!1,Ur=null,Bc=0,Di=0,km=null,Gc=-1,qc=0;function yn(){return(tt&6)!==0?Be():Gc!==-1?Gc:Gc=Be()}function Wr(r){return(r.mode&1)===0?1:(tt&2)!==0&&tn!==0?tn&-tn:ZS.transition!==null?(qc===0&&(qc=li()),qc):(r=it,r!==0||(r=window.event,r=r===void 0?16:Yg(r.type)),r)}function Ms(r,a,d,g){if(50<Di)throw Di=0,km=null,Error(n(185));ar(r,d,g),((tt&2)===0||r!==qt)&&(r===qt&&((tt&2)===0&&(Uc|=d),Ut===4&&Hr(r,tn)),Dn(r,g),d===1&&tt===0&&(a.mode&1)===0&&(ya=Be()+500,bc&&Lr()))}function Dn(r,a){var d=r.callbackNode;ai(r,a);var g=Dt(r,r===qt?tn:0);if(g===0)d!==null&&Ne(d),r.callbackNode=null,r.callbackPriority=0;else if(a=g&-g,r.callbackPriority!==a){if(d!=null&&Ne(d),a===1)r.tag===0?QS(Yy.bind(null,r)):Px(Yy.bind(null,r)),VS(function(){(tt&6)===0&&Lr()}),d=null;else{switch(Wg(g)){case 1:d=Jt;break;case 4:d=Es;break;case 16:d=wt;break;case 536870912:d=_r;break;default:d=wt}d=rv(d,Xy.bind(null,r))}r.callbackPriority=a,r.callbackNode=d}}function Xy(r,a){if(Gc=-1,qc=0,(tt&6)!==0)throw Error(n(327));var d=r.callbackNode;if(va()&&r.callbackNode!==d)return null;var g=Dt(r,r===qt?tn:0);if(g===0)return null;if((g&30)!==0||(g&r.expiredLanes)!==0||a)a=Vc(r,g);else{a=g;var k=tt;tt|=2;var N=Zy();(qt!==r||tn!==a)&&(pr=null,ya=Be()+500,No(r,a));do try{y2();break}catch(H){Qy(r,H)}while(!0);Ff(),Fc.current=N,tt=k,Pt!==null?a=0:(qt=null,tn=0,a=Ut)}if(a!==0){if(a===2&&(k=ii(r),k!==0&&(g=k,a=jm(r,k))),a===1)throw d=Ii,No(r,0),Hr(r,g),Dn(r,Be()),d;if(a===6)Hr(r,g);else{if(k=r.current.alternate,(g&30)===0&&!g2(k)&&(a=Vc(r,g),a===2&&(N=ii(r),N!==0&&(g=N,a=jm(r,N))),a===1))throw d=Ii,No(r,0),Hr(r,g),Dn(r,Be()),d;switch(r.finishedWork=k,r.finishedLanes=g,a){case 0:case 1:throw Error(n(345));case 2:So(r,zn,pr);break;case 3:if(Hr(r,g),(g&130023424)===g&&(a=bm+500-Be(),10<a)){if(Dt(r,0)!==0)break;if(k=r.suspendedLanes,(k&g)!==g){yn(),r.pingedLanes|=r.suspendedLanes&k;break}r.timeoutHandle=Tf(So.bind(null,r,zn,pr),a);break}So(r,zn,pr);break;case 4:if(Hr(r,g),(g&4194240)===g)break;for(a=r.eventTimes,k=-1;0<g;){var A=31-Mn(g);N=1<<A,A=a[A],A>k&&(k=A),g&=~N}if(g=k,g=Be()-g,g=(120>g?120:480>g?480:1080>g?1080:1920>g?1920:3e3>g?3e3:4320>g?4320:1960*h2(g/1960))-g,10<g){r.timeoutHandle=Tf(So.bind(null,r,zn,pr),g);break}So(r,zn,pr);break;case 5:So(r,zn,pr);break;default:throw Error(n(329))}}}return Dn(r,Be()),r.callbackNode===d?Xy.bind(null,r):null}function jm(r,a){var d=zi;return r.current.memoizedState.isDehydrated&&(No(r,a).flags|=256),r=Vc(r,a),r!==2&&(a=zn,zn=d,a!==null&&Nm(a)),r}function Nm(r){zn===null?zn=r:zn.push.apply(zn,r)}function g2(r){for(var a=r;;){if(a.flags&16384){var d=a.updateQueue;if(d!==null&&(d=d.stores,d!==null))for(var g=0;g<d.length;g++){var k=d[g],N=k.getSnapshot;k=k.value;try{if(!Ts(N(),k))return!1}catch{return!1}}}if(d=a.child,a.subtreeFlags&16384&&d!==null)d.return=a,a=d;else{if(a===r)break;for(;a.sibling===null;){if(a.return===null||a.return===r)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Hr(r,a){for(a&=~vm,a&=~Uc,r.suspendedLanes|=a,r.pingedLanes&=~a,r=r.expirationTimes;0<a;){var d=31-Mn(a),g=1<<d;r[d]=-1,a&=~g}}function Yy(r){if((tt&6)!==0)throw Error(n(327));va();var a=Dt(r,0);if((a&1)===0)return Dn(r,Be()),null;var d=Vc(r,a);if(r.tag!==0&&d===2){var g=ii(r);g!==0&&(a=g,d=jm(r,g))}if(d===1)throw d=Ii,No(r,0),Hr(r,a),Dn(r,Be()),d;if(d===6)throw Error(n(345));return r.finishedWork=r.current.alternate,r.finishedLanes=a,So(r,zn,pr),Dn(r,Be()),null}function Sm(r,a){var d=tt;tt|=1;try{return r(a)}finally{tt=d,tt===0&&(ya=Be()+500,bc&&Lr())}}function jo(r){Ur!==null&&Ur.tag===0&&(tt&6)===0&&va();var a=tt;tt|=1;var d=ms.transition,g=it;try{if(ms.transition=null,it=1,r)return r()}finally{it=g,ms.transition=d,tt=a,(tt&6)===0&&Lr()}}function _m(){Qn=xa.current,ht(xa)}function No(r,a){r.finishedWork=null,r.finishedLanes=0;var d=r.timeoutHandle;if(d!==-1&&(r.timeoutHandle=-1,qS(d)),Pt!==null)for(d=Pt.return;d!==null;){var g=d;switch(Pf(g),g.tag){case 1:g=g.type.childContextTypes,g!=null&&yc();break;case 3:pa(),ht(Pn),ht(ln),Kf();break;case 5:qf(g);break;case 4:pa();break;case 13:ht(kt);break;case 19:ht(kt);break;case 10:Uf(g.type._context);break;case 22:case 23:_m()}d=d.return}if(qt=r,Pt=r=Br(r.current,null),tn=Qn=a,Ut=0,Ii=null,vm=Uc=ko=0,zn=zi=null,vo!==null){for(a=0;a<vo.length;a++)if(d=vo[a],g=d.interleaved,g!==null){d.interleaved=null;var k=g.next,N=d.pending;if(N!==null){var A=N.next;N.next=k,g.next=A}d.pending=g}vo=null}return r}function Qy(r,a){do{var d=Pt;try{if(Ff(),Cc.current=Mc,Rc){for(var g=jt.memoizedState;g!==null;){var k=g.queue;k!==null&&(k.pending=null),g=g.next}Rc=!1}if(wo=0,Gt=Ft=jt=null,Ri=!1,Ai=0,ym.current=null,d===null||d.return===null){Ut=1,Ii=a,Pt=null;break}e:{var N=r,A=d.return,H=d,V=a;if(a=tn,H.flags|=32768,V!==null&&typeof V=="object"&&typeof V.then=="function"){var re=V,de=H,me=de.tag;if((de.mode&1)===0&&(me===0||me===11||me===15)){var ue=de.alternate;ue?(de.updateQueue=ue.updateQueue,de.memoizedState=ue.memoizedState,de.lanes=ue.lanes):(de.updateQueue=null,de.memoizedState=null)}var ke=ky(A);if(ke!==null){ke.flags&=-257,jy(ke,A,H,N,a),ke.mode&1&&wy(N,re,a),a=ke,V=re;var _e=a.updateQueue;if(_e===null){var $e=new Set;$e.add(V),a.updateQueue=$e}else _e.add(V);break e}else{if((a&1)===0){wy(N,re,a),$m();break e}V=Error(n(426))}}else if(yt&&H.mode&1){var Rt=ky(A);if(Rt!==null){(Rt.flags&65536)===0&&(Rt.flags|=256),jy(Rt,A,H,N,a),zf(ha(V,H));break e}}N=V=ha(V,H),Ut!==4&&(Ut=2),zi===null?zi=[N]:zi.push(N),N=A;do{switch(N.tag){case 3:N.flags|=65536,a&=-a,N.lanes|=a;var te=vy(N,V,a);qx(N,te);break e;case 1:H=V;var Q=N.type,se=N.stateNode;if((N.flags&128)===0&&(typeof Q.getDerivedStateFromError=="function"||se!==null&&typeof se.componentDidCatch=="function"&&(Fr===null||!Fr.has(se)))){N.flags|=65536,a&=-a,N.lanes|=a;var ge=by(N,H,a);qx(N,ge);break e}}N=N.return}while(N!==null)}ev(d)}catch(Ce){a=Ce,Pt===d&&d!==null&&(Pt=d=d.return);continue}break}while(!0)}function Zy(){var r=Fc.current;return Fc.current=Mc,r===null?Mc:r}function $m(){(Ut===0||Ut===3||Ut===2)&&(Ut=4),qt===null||(ko&268435455)===0&&(Uc&268435455)===0||Hr(qt,tn)}function Vc(r,a){var d=tt;tt|=2;var g=Zy();(qt!==r||tn!==a)&&(pr=null,No(r,a));do try{x2();break}catch(k){Qy(r,k)}while(!0);if(Ff(),tt=d,Fc.current=g,Pt!==null)throw Error(n(261));return qt=null,tn=0,Ut}function x2(){for(;Pt!==null;)Jy(Pt)}function y2(){for(;Pt!==null&&!at();)Jy(Pt)}function Jy(r){var a=sv(r.alternate,r,Qn);r.memoizedProps=r.pendingProps,a===null?ev(r):Pt=a,ym.current=null}function ev(r){var a=r;do{var d=a.alternate;if(r=a.return,(a.flags&32768)===0){if(d=u2(d,a,Qn),d!==null){Pt=d;return}}else{if(d=d2(d,a),d!==null){d.flags&=32767,Pt=d;return}if(r!==null)r.flags|=32768,r.subtreeFlags=0,r.deletions=null;else{Ut=6,Pt=null;return}}if(a=a.sibling,a!==null){Pt=a;return}Pt=a=r}while(a!==null);Ut===0&&(Ut=5)}function So(r,a,d){var g=it,k=ms.transition;try{ms.transition=null,it=1,v2(r,a,d,g)}finally{ms.transition=k,it=g}return null}function v2(r,a,d,g){do va();while(Ur!==null);if((tt&6)!==0)throw Error(n(327));d=r.finishedWork;var k=r.finishedLanes;if(d===null)return null;if(r.finishedWork=null,r.finishedLanes=0,d===r.current)throw Error(n(177));r.callbackNode=null,r.callbackPriority=0;var N=d.lanes|d.childLanes;if(tc(r,N),r===qt&&(Pt=qt=null,tn=0),(d.subtreeFlags&2064)===0&&(d.flags&2064)===0||Hc||(Hc=!0,rv(wt,function(){return va(),null})),N=(d.flags&15990)!==0,(d.subtreeFlags&15990)!==0||N){N=ms.transition,ms.transition=null;var A=it;it=1;var H=tt;tt|=4,ym.current=null,m2(r,d),By(d,r),DS($f),rc=!!_f,$f=_f=null,r.current=d,p2(d),Ct(),tt=H,it=A,ms.transition=N}else r.current=d;if(Hc&&(Hc=!1,Ur=r,Bc=k),N=r.pendingLanes,N===0&&(Fr=null),ec(d.stateNode),Dn(r,Be()),a!==null)for(g=r.onRecoverableError,d=0;d<a.length;d++)k=a[d],g(k.value,{componentStack:k.stack,digest:k.digest});if(Wc)throw Wc=!1,r=wm,wm=null,r;return(Bc&1)!==0&&r.tag!==0&&va(),N=r.pendingLanes,(N&1)!==0?r===km?Di++:(Di=0,km=r):Di=0,Lr(),null}function va(){if(Ur!==null){var r=Wg(Bc),a=ms.transition,d=it;try{if(ms.transition=null,it=16>r?16:r,Ur===null)var g=!1;else{if(r=Ur,Ur=null,Bc=0,(tt&6)!==0)throw Error(n(331));var k=tt;for(tt|=4,Se=r.current;Se!==null;){var N=Se,A=N.child;if((Se.flags&16)!==0){var H=N.deletions;if(H!==null){for(var V=0;V<H.length;V++){var re=H[V];for(Se=re;Se!==null;){var de=Se;switch(de.tag){case 0:case 11:case 15:Li(8,de,N)}var me=de.child;if(me!==null)me.return=de,Se=me;else for(;Se!==null;){de=Se;var ue=de.sibling,ke=de.return;if(Dy(de),de===re){Se=null;break}if(ue!==null){ue.return=ke,Se=ue;break}Se=ke}}}var _e=N.alternate;if(_e!==null){var $e=_e.child;if($e!==null){_e.child=null;do{var Rt=$e.sibling;$e.sibling=null,$e=Rt}while($e!==null)}}Se=N}}if((N.subtreeFlags&2064)!==0&&A!==null)A.return=N,Se=A;else e:for(;Se!==null;){if(N=Se,(N.flags&2048)!==0)switch(N.tag){case 0:case 11:case 15:Li(9,N,N.return)}var te=N.sibling;if(te!==null){te.return=N.return,Se=te;break e}Se=N.return}}var Q=r.current;for(Se=Q;Se!==null;){A=Se;var se=A.child;if((A.subtreeFlags&2064)!==0&&se!==null)se.return=A,Se=se;else e:for(A=Q;Se!==null;){if(H=Se,(H.flags&2048)!==0)try{switch(H.tag){case 0:case 11:case 15:Dc(9,H)}}catch(Ce){Et(H,H.return,Ce)}if(H===A){Se=null;break e}var ge=H.sibling;if(ge!==null){ge.return=H.return,Se=ge;break e}Se=H.return}}if(tt=k,Lr(),Vn&&typeof Vn.onPostCommitFiberRoot=="function")try{Vn.onPostCommitFiberRoot(po,r)}catch{}g=!0}return g}finally{it=d,ms.transition=a}}return!1}function tv(r,a,d){a=ha(d,a),a=vy(r,a,1),r=zr(r,a,1),a=yn(),r!==null&&(ar(r,1,a),Dn(r,a))}function Et(r,a,d){if(r.tag===3)tv(r,r,d);else for(;a!==null;){if(a.tag===3){tv(a,r,d);break}else if(a.tag===1){var g=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof g.componentDidCatch=="function"&&(Fr===null||!Fr.has(g))){r=ha(d,r),r=by(a,r,1),a=zr(a,r,1),r=yn(),a!==null&&(ar(a,1,r),Dn(a,r));break}}a=a.return}}function b2(r,a,d){var g=r.pingCache;g!==null&&g.delete(a),a=yn(),r.pingedLanes|=r.suspendedLanes&d,qt===r&&(tn&d)===d&&(Ut===4||Ut===3&&(tn&130023424)===tn&&500>Be()-bm?No(r,0):vm|=d),Dn(r,a)}function nv(r,a){a===0&&((r.mode&1)===0?a=1:(a=qe,qe<<=1,(qe&130023424)===0&&(qe=4194304)));var d=yn();r=dr(r,a),r!==null&&(ar(r,a,d),Dn(r,d))}function w2(r){var a=r.memoizedState,d=0;a!==null&&(d=a.retryLane),nv(r,d)}function k2(r,a){var d=0;switch(r.tag){case 13:var g=r.stateNode,k=r.memoizedState;k!==null&&(d=k.retryLane);break;case 19:g=r.stateNode;break;default:throw Error(n(314))}g!==null&&g.delete(a),nv(r,d)}var sv;sv=function(r,a,d){if(r!==null)if(r.memoizedProps!==a.pendingProps||Pn.current)In=!0;else{if((r.lanes&d)===0&&(a.flags&128)===0)return In=!1,c2(r,a,d);In=(r.flags&131072)!==0}else In=!1,yt&&(a.flags&1048576)!==0&&Lx(a,kc,a.index);switch(a.lanes=0,a.tag){case 2:var g=a.type;Ic(r,a),r=a.pendingProps;var k=ia(a,ln.current);ma(a,d),k=Qf(null,a,g,r,k,d);var N=Zf();return a.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(a.tag=1,a.memoizedState=null,a.updateQueue=null,Ln(g)?(N=!0,vc(a)):N=!1,a.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,Bf(a),k.updater=Pc,a.stateNode=k,k._reactInternals=a,rm(a,g,r,d),a=lm(null,a,g,!0,N,d)):(a.tag=0,yt&&N&&Mf(a),xn(null,a,k,d),a=a.child),a;case 16:g=a.elementType;e:{switch(Ic(r,a),r=a.pendingProps,k=g._init,g=k(g._payload),a.type=g,k=a.tag=N2(g),r=Rs(g,r),k){case 0:a=im(null,a,g,r,d);break e;case 1:a=Ty(null,a,g,r,d);break e;case 11:a=Ny(null,a,g,r,d);break e;case 14:a=Sy(null,a,g,Rs(g.type,r),d);break e}throw Error(n(306,g,""))}return a;case 0:return g=a.type,k=a.pendingProps,k=a.elementType===g?k:Rs(g,k),im(r,a,g,k,d);case 1:return g=a.type,k=a.pendingProps,k=a.elementType===g?k:Rs(g,k),Ty(r,a,g,k,d);case 3:e:{if(Cy(a),r===null)throw Error(n(387));g=a.pendingProps,N=a.memoizedState,k=N.element,Gx(r,a),Ec(a,g,null,d);var A=a.memoizedState;if(g=A.element,N.isDehydrated)if(N={element:g,isDehydrated:!1,cache:A.cache,pendingSuspenseBoundaries:A.pendingSuspenseBoundaries,transitions:A.transitions},a.updateQueue.baseState=N,a.memoizedState=N,a.flags&256){k=ha(Error(n(423)),a),a=Ry(r,a,g,d,k);break e}else if(g!==k){k=ha(Error(n(424)),a),a=Ry(r,a,g,d,k);break e}else for(Yn=Or(a.stateNode.containerInfo.firstChild),Xn=a,yt=!0,Cs=null,d=Hx(a,null,g,d),a.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling;else{if(ua(),g===k){a=mr(r,a,d);break e}xn(r,a,g,d)}a=a.child}return a;case 5:return Kx(a),r===null&&If(a),g=a.type,k=a.pendingProps,N=r!==null?r.memoizedProps:null,A=k.children,Ef(g,k)?A=null:N!==null&&Ef(g,N)&&(a.flags|=32),Ey(r,a),xn(r,a,A,d),a.child;case 6:return r===null&&If(a),null;case 13:return Ay(r,a,d);case 4:return Gf(a,a.stateNode.containerInfo),g=a.pendingProps,r===null?a.child=da(a,null,g,d):xn(r,a,g,d),a.child;case 11:return g=a.type,k=a.pendingProps,k=a.elementType===g?k:Rs(g,k),Ny(r,a,g,k,d);case 7:return xn(r,a,a.pendingProps,d),a.child;case 8:return xn(r,a,a.pendingProps.children,d),a.child;case 12:return xn(r,a,a.pendingProps.children,d),a.child;case 10:e:{if(g=a.type._context,k=a.pendingProps,N=a.memoizedProps,A=k.value,mt(Sc,g._currentValue),g._currentValue=A,N!==null)if(Ts(N.value,A)){if(N.children===k.children&&!Pn.current){a=mr(r,a,d);break e}}else for(N=a.child,N!==null&&(N.return=a);N!==null;){var H=N.dependencies;if(H!==null){A=N.child;for(var V=H.firstContext;V!==null;){if(V.context===g){if(N.tag===1){V=fr(-1,d&-d),V.tag=2;var re=N.updateQueue;if(re!==null){re=re.shared;var de=re.pending;de===null?V.next=V:(V.next=de.next,de.next=V),re.pending=V}}N.lanes|=d,V=N.alternate,V!==null&&(V.lanes|=d),Wf(N.return,d,a),H.lanes|=d;break}V=V.next}}else if(N.tag===10)A=N.type===a.type?null:N.child;else if(N.tag===18){if(A=N.return,A===null)throw Error(n(341));A.lanes|=d,H=A.alternate,H!==null&&(H.lanes|=d),Wf(A,d,a),A=N.sibling}else A=N.child;if(A!==null)A.return=N;else for(A=N;A!==null;){if(A===a){A=null;break}if(N=A.sibling,N!==null){N.return=A.return,A=N;break}A=A.return}N=A}xn(r,a,k.children,d),a=a.child}return a;case 9:return k=a.type,g=a.pendingProps.children,ma(a,d),k=ds(k),g=g(k),a.flags|=1,xn(r,a,g,d),a.child;case 14:return g=a.type,k=Rs(g,a.pendingProps),k=Rs(g.type,k),Sy(r,a,g,k,d);case 15:return _y(r,a,a.type,a.pendingProps,d);case 17:return g=a.type,k=a.pendingProps,k=a.elementType===g?k:Rs(g,k),Ic(r,a),a.tag=1,Ln(g)?(r=!0,vc(a)):r=!1,ma(a,d),xy(a,g,k),rm(a,g,k,d),lm(null,a,g,!0,r,d);case 19:return My(r,a,d);case 22:return $y(r,a,d)}throw Error(n(156,a.tag))};function rv(r,a){return pe(r,a)}function j2(r,a,d,g){this.tag=r,this.key=d,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=g,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ps(r,a,d,g){return new j2(r,a,d,g)}function Em(r){return r=r.prototype,!(!r||!r.isReactComponent)}function N2(r){if(typeof r=="function")return Em(r)?1:0;if(r!=null){if(r=r.$$typeof,r===B)return 11;if(r===X)return 14}return 2}function Br(r,a){var d=r.alternate;return d===null?(d=ps(r.tag,a,r.key,r.mode),d.elementType=r.elementType,d.type=r.type,d.stateNode=r.stateNode,d.alternate=r,r.alternate=d):(d.pendingProps=a,d.type=r.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=r.flags&14680064,d.childLanes=r.childLanes,d.lanes=r.lanes,d.child=r.child,d.memoizedProps=r.memoizedProps,d.memoizedState=r.memoizedState,d.updateQueue=r.updateQueue,a=r.dependencies,d.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},d.sibling=r.sibling,d.index=r.index,d.ref=r.ref,d}function Kc(r,a,d,g,k,N){var A=2;if(g=r,typeof r=="function")Em(r)&&(A=1);else if(typeof r=="string")A=5;else e:switch(r){case C:return _o(d.children,k,N,a);case O:A=8,k|=8;break;case z:return r=ps(12,d,a,k|2),r.elementType=z,r.lanes=N,r;case U:return r=ps(13,d,a,k),r.elementType=U,r.lanes=N,r;case W:return r=ps(19,d,a,k),r.elementType=W,r.lanes=N,r;case K:return Xc(d,k,N,a);default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case F:A=10;break e;case D:A=9;break e;case B:A=11;break e;case X:A=14;break e;case M:A=16,g=null;break e}throw Error(n(130,r==null?r:typeof r,""))}return a=ps(A,d,a,k),a.elementType=r,a.type=g,a.lanes=N,a}function _o(r,a,d,g){return r=ps(7,r,g,a),r.lanes=d,r}function Xc(r,a,d,g){return r=ps(22,r,g,a),r.elementType=K,r.lanes=d,r.stateNode={isHidden:!1},r}function Tm(r,a,d){return r=ps(6,r,null,a),r.lanes=d,r}function Cm(r,a,d){return a=ps(4,r.children!==null?r.children:[],r.key,a),a.lanes=d,a.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},a}function S2(r,a,d,g,k){this.tag=a,this.containerInfo=r,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=ci(0),this.expirationTimes=ci(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ci(0),this.identifierPrefix=g,this.onRecoverableError=k,this.mutableSourceEagerHydrationData=null}function Rm(r,a,d,g,k,N,A,H,V){return r=new S2(r,a,d,H,V),a===1?(a=1,N===!0&&(a|=8)):a=0,N=ps(3,null,null,a),r.current=N,N.stateNode=r,N.memoizedState={element:g,isDehydrated:d,cache:null,transitions:null,pendingSuspenseBoundaries:null},Bf(N),r}function _2(r,a,d){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:R,key:g==null?null:""+g,children:r,containerInfo:a,implementation:d}}function ov(r){if(!r)return Pr;r=r._reactInternals;e:{if(qn(r)!==r||r.tag!==1)throw Error(n(170));var a=r;do{switch(a.tag){case 3:a=a.stateNode.context;break e;case 1:if(Ln(a.type)){a=a.stateNode.__reactInternalMemoizedMergedChildContext;break e}}a=a.return}while(a!==null);throw Error(n(171))}if(r.tag===1){var d=r.type;if(Ln(d))return Ox(r,d,a)}return a}function av(r,a,d,g,k,N,A,H,V){return r=Rm(d,g,!0,r,k,N,A,H,V),r.context=ov(null),d=r.current,g=yn(),k=Wr(d),N=fr(g,k),N.callback=a??null,zr(d,N,k),r.current.lanes=k,ar(r,k,g),Dn(r,g),r}function Yc(r,a,d,g){var k=a.current,N=yn(),A=Wr(k);return d=ov(d),a.context===null?a.context=d:a.pendingContext=d,a=fr(N,A),a.payload={element:r},g=g===void 0?null:g,g!==null&&(a.callback=g),r=zr(k,a,A),r!==null&&(Ms(r,k,A,N),$c(r,k,A)),A}function Qc(r){if(r=r.current,!r.child)return null;switch(r.child.tag){case 5:return r.child.stateNode;default:return r.child.stateNode}}function iv(r,a){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var d=r.retryLane;r.retryLane=d!==0&&d<a?d:a}}function Am(r,a){iv(r,a),(r=r.alternate)&&iv(r,a)}function $2(){return null}var lv=typeof reportError=="function"?reportError:function(r){console.error(r)};function Om(r){this._internalRoot=r}Zc.prototype.render=Om.prototype.render=function(r){var a=this._internalRoot;if(a===null)throw Error(n(409));Yc(r,a,null,null)},Zc.prototype.unmount=Om.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var a=r.containerInfo;jo(function(){Yc(null,r,null,null)}),a[ir]=null}};function Zc(r){this._internalRoot=r}Zc.prototype.unstable_scheduleHydration=function(r){if(r){var a=Gg();r={blockedOn:null,target:r,priority:a};for(var d=0;d<Cr.length&&a!==0&&a<Cr[d].priority;d++);Cr.splice(d,0,r),d===0&&Kg(r)}};function Mm(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function Jc(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11&&(r.nodeType!==8||r.nodeValue!==" react-mount-point-unstable "))}function cv(){}function E2(r,a,d,g,k){if(k){if(typeof g=="function"){var N=g;g=function(){var re=Qc(A);N.call(re)}}var A=av(a,g,r,0,null,!1,!1,"",cv);return r._reactRootContainer=A,r[ir]=A.current,ji(r.nodeType===8?r.parentNode:r),jo(),A}for(;k=r.lastChild;)r.removeChild(k);if(typeof g=="function"){var H=g;g=function(){var re=Qc(V);H.call(re)}}var V=Rm(r,0,!1,null,null,!1,!1,"",cv);return r._reactRootContainer=V,r[ir]=V.current,ji(r.nodeType===8?r.parentNode:r),jo(function(){Yc(a,V,d,g)}),V}function eu(r,a,d,g,k){var N=d._reactRootContainer;if(N){var A=N;if(typeof k=="function"){var H=k;k=function(){var V=Qc(A);H.call(V)}}Yc(a,A,r,k)}else A=E2(d,a,r,k,g);return Qc(A)}Hg=function(r){switch(r.tag){case 3:var a=r.stateNode;if(a.current.memoizedState.isDehydrated){var d=xt(a.pendingLanes);d!==0&&(sf(a,d|1),Dn(a,Be()),(tt&6)===0&&(ya=Be()+500,Lr()))}break;case 13:jo(function(){var g=dr(r,1);if(g!==null){var k=yn();Ms(g,r,1,k)}}),Am(r,1)}},rf=function(r){if(r.tag===13){var a=dr(r,134217728);if(a!==null){var d=yn();Ms(a,r,134217728,d)}Am(r,134217728)}},Bg=function(r){if(r.tag===13){var a=Wr(r),d=dr(r,a);if(d!==null){var g=yn();Ms(d,r,a,g)}Am(r,a)}},Gg=function(){return it},qg=function(r,a){var d=it;try{return it=r,a()}finally{it=d}},Gn=function(r,a,d){switch(a){case"input":if(De(r,d),a=d.name,d.type==="radio"&&a!=null){for(d=r;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll("input[name="+JSON.stringify(""+a)+'][type="radio"]'),a=0;a<d.length;a++){var g=d[a];if(g!==r&&g.form===r.form){var k=xc(g);if(!k)throw Error(n(90));We(g),De(g,k)}}}break;case"textarea":Qt(r,d);break;case"select":a=d.value,a!=null&&_t(r,!!d.multiple,a,!1)}},$t=Sm,on=jo;var T2={usingClientEntryPoint:!1,Events:[_i,oa,xc,dt,Ke,Sm]},Fi={findFiberByHostInstance:ho,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},C2={bundleType:Fi.bundleType,version:Fi.version,rendererPackageName:Fi.rendererPackageName,rendererConfig:Fi.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_.ReactCurrentDispatcher,findHostInstanceByFiber:function(r){return r=Ae(r),r===null?null:r.stateNode},findFiberByHostInstance:Fi.findFiberByHostInstance||$2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var tu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tu.isDisabled&&tu.supportsFiber)try{po=tu.inject(C2),Vn=tu}catch{}}return Fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=T2,Fn.createPortal=function(r,a){var d=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Mm(a))throw Error(n(200));return _2(r,a,null,d)},Fn.createRoot=function(r,a){if(!Mm(r))throw Error(n(299));var d=!1,g="",k=lv;return a!=null&&(a.unstable_strictMode===!0&&(d=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onRecoverableError!==void 0&&(k=a.onRecoverableError)),a=Rm(r,1,!1,null,null,d,!1,g,k),r[ir]=a.current,ji(r.nodeType===8?r.parentNode:r),new Om(a)},Fn.findDOMNode=function(r){if(r==null)return null;if(r.nodeType===1)return r;var a=r._reactInternals;if(a===void 0)throw typeof r.render=="function"?Error(n(188)):(r=Object.keys(r).join(","),Error(n(268,r)));return r=Ae(a),r=r===null?null:r.stateNode,r},Fn.flushSync=function(r){return jo(r)},Fn.hydrate=function(r,a,d){if(!Jc(a))throw Error(n(200));return eu(null,r,a,!0,d)},Fn.hydrateRoot=function(r,a,d){if(!Mm(r))throw Error(n(405));var g=d!=null&&d.hydratedSources||null,k=!1,N="",A=lv;if(d!=null&&(d.unstable_strictMode===!0&&(k=!0),d.identifierPrefix!==void 0&&(N=d.identifierPrefix),d.onRecoverableError!==void 0&&(A=d.onRecoverableError)),a=av(a,null,r,1,d??null,k,!1,N,A),r[ir]=a.current,ji(r),g)for(r=0;r<g.length;r++)d=g[r],k=d._getVersion,k=k(d._source),a.mutableSourceEagerHydrationData==null?a.mutableSourceEagerHydrationData=[d,k]:a.mutableSourceEagerHydrationData.push(d,k);return new Zc(a)},Fn.render=function(r,a,d){if(!Jc(a))throw Error(n(200));return eu(null,r,a,!1,d)},Fn.unmountComponentAtNode=function(r){if(!Jc(r))throw Error(n(40));return r._reactRootContainer?(jo(function(){eu(null,null,r,!1,function(){r._reactRootContainer=null,r[ir]=null})}),!0):!1},Fn.unstable_batchedUpdates=Sm,Fn.unstable_renderSubtreeIntoContainer=function(r,a,d,g){if(!Jc(d))throw Error(n(200));if(r==null||r._reactInternals===void 0)throw Error(n(38));return eu(r,a,d,!1,g)},Fn.version="18.3.1-next-f1338f8080-20240426",Fn}var xv;function e0(){if(xv)return Im.exports;xv=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Im.exports=F2(),Im.exports}var yv;function U2(){if(yv)return nu;yv=1;var e=e0();return nu.createRoot=e.createRoot,nu.hydrateRoot=e.hydrateRoot,nu}var W2=U2();const vt=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),H2=e=>e.replace(/~/g,"~0").replace(/\//g,"~1"),jp=128,B2=e=>{try{return JSON.stringify(e)??"null"}catch{return JSON.stringify(`[${typeof e}:${String(e)}]`)}},Np=(e,t=0)=>t>jp?'"…"':Array.isArray(e)?`[${e.map(n=>Np(n,t+1)).join(",")}]`:vt(e)?`{${Object.keys(e).filter(n=>e[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${Np(e[n],t+1)}`).join(",")}}`:B2(e),G2=e=>{let t=2166136261;for(let n=0;n<e.length;n+=1)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(16).padStart(8,"0")},Wi=(e,t)=>Object.fromEntries(Object.entries(e).filter(([n])=>n!==t)),q2=e=>{switch(e.node){case"chain":return Wi(e,"steps");case"parallel":return Wi(e,"branches");case"map":case"loop":return Wi(e,"body");case"route":return vt(e.branches)?{...e,branches:Object.fromEntries(Object.entries(e.branches).map(([t,n])=>[t,vt(n)?Wi(n,"body"):n]))}:e;case"workflow":return vt(e.workflow)?{...e,workflow:Wi(e.workflow,"root")}:e;default:return e}};function fl(e){const t=[],n=[],o=(i,l,c,u)=>{if(!vt(i)||typeof i.node!="string"||c>jp)return;t.push({path:l,kind:i.node,label:typeof i.label=="string"?i.label:i.node,...i.node==="call"&&typeof i.via=="string"?{via:i.via}:{},changeCheck:G2(Np(q2(i))),...K2(i,u)});const f=(p,h,b,x=l,m=u)=>{!vt(p)||typeof p.node!="string"||c+1>jp||(n.push({from:x,to:h,kind:b}),o(p,h,c+1,m))};switch(i.node){case"chain":Array.isArray(i.steps)&&i.steps.forEach((p,h)=>f(p,`${l}/steps/${h}`,"next",h===0?l:`${l}/steps/${h-1}`));break;case"parallel":Array.isArray(i.branches)&&i.branches.forEach((p,h)=>f(p,`${l}/branches/${h}`,"branch"));break;case"map":f(i.body,`${l}/body`,"item");break;case"loop":f(i.body,`${l}/body`,"next");break;case"route":if(vt(i.branches))for(const[p,h]of Object.entries(i.branches))vt(h)&&f(h.body,`${l}/branches/${H2(p)}/body`,"route");break;case"workflow":vt(i.workflow)&&f(i.workflow.root,`${l}/workflow/root`,"child",l,vt(i.workflow.schemas)?i.workflow.schemas:{});break}};return o(vt(e)?e.root:void 0,"/root",0,vt(e)&&vt(e.schemas)?e.schemas:{}),{nodes:t,edges:n}}const V2=(e,t)=>{const n=typeof e=="string"&&Object.hasOwn(t,e)?t[e]:void 0,o=l=>{var c;for(let u=0;vt(l)&&typeof l.$ref=="string"&&u<8;u+=1){const f=(c=/^#\/definitions\/(.+)$/.exec(l.$ref))==null?void 0:c[1],p=vt(n)&&vt(n.definitions)?n.definitions:{};l=f===void 0?void 0:Object.hasOwn(p,f)?p[f]:Object.hasOwn(t,f)?t[f]:void 0}return l},i=o(n);return!vt(i)||!vt(i.properties)?[]:Object.entries(i.properties).map(([l,c])=>{const u=o(c),f=vt(u)&&typeof u.description=="string"?u.description:"",p=vt(u)?(Array.isArray(u.type)?u.type:[u.type]).filter(h=>h!=="null"):[];return vt(u)&&Array.isArray(u.enum)?{id:l,type:"choice",instructions:f,options:u.enum.map(String)}:p.length===1&&p[0]==="boolean"?{id:l,type:"noul",instructions:f}:p.length===1&&p[0]==="integer"?{id:l,type:"score",instructions:f}:{id:l,type:"unknown",instructions:f}})},K2=(e,t)=>{let n=e,o;const i=l=>typeof l=="string"?l:"";switch(e.node){case"judge":case"sift":o=V2(e.out,t);break;case"pick":o=[{id:"pick",type:"choice",instructions:i(e.instructions)}];break;case"route":if(e.valuePath!==void 0)return{};o=[{id:"branch",type:"choice",instructions:i(e.instructions),options:vt(e.branches)?Object.keys(e.branches):[]}];break;case"loop":case"escalate":{const l=e.node==="loop"?e.until:e.when;if(!vt(l)||l.predicate!=="ask")return{};n=l,o=[{id:"holds",type:"noul",instructions:i(l.instructions)}];break}default:return{}}return{...typeof n.provider=="string"?{provider:n.provider}:{},...typeof n.model=="string"?{model:n.model}:{},questions:o,...vt(n.images)&&Object.keys(n.images).length?{images:Object.keys(n.images)}:{}}};function X2(e,t){const n=$=>JSON.stringify([$.kind,$.label]),o=$=>{const _=new Map;for(const E of $.nodes)_.set(n(E),(_.get(n(E))??0)+1);return _},[i,l]=[o(e),o(t)],c=$=>i.get(n($))===1&&l.get(n($))===1,u=new Map,f=new Map,p=($,_)=>{u.set(_,$),f.set($,_)},h=new Map(e.nodes.filter(c).map($=>[n($),$.path]));for(const $ of t.nodes){const _=c($)?h.get(n($)):void 0;_!==void 0&&p(_,$.path)}const b=new Map(e.nodes.map($=>[$.path,$])),x=[];for(const $ of t.nodes){const _=b.get($.path);u.has($.path)||_===void 0||f.has(_.path)||(p(_.path,$.path),(_.kind!==$.kind||_.label!==$.label)&&x.push({prev:_.path,next:$.path,was:{kind:_.kind,label:_.label},now:{kind:$.kind,label:$.label}}))}const m=[];for(const $ of t.nodes){const _=u.get($.path),E=_===void 0?void 0:b.get(_);E===void 0||E.kind!==$.kind||E.label!==$.label||E.changeCheck!==void 0&&$.changeCheck!==void 0&&E.changeCheck!==$.changeCheck&&m.push({prev:E.path,next:$.path,kind:$.kind,label:$.label})}const v=({path:$,kind:_,label:E})=>({path:$,kind:_,label:E}),w=($,_,E)=>JSON.stringify([$,_,E]),j=new Set(e.edges.map($=>w($.from,$.to,$.kind))),S=new Set(t.edges.map($=>w($.from,$.to,$.kind))),T=($,_,E)=>{const[R,C]=[_.get($.from),_.get($.to)];return R!==void 0&&C!==void 0&&E.has(w(R,C,$.kind))};return{added:t.nodes.filter($=>!u.has($.path)).map(v),removed:e.nodes.filter($=>!f.has($.path)).map(v),changed:x,moved:t.nodes.flatMap($=>{const _=u.get($.path);return _!==void 0&&_!==$.path?[{prev:_,next:$.path}]:[]}),rewritten:m,edges:{added:t.edges.filter($=>!T($,u,j)).map(({from:$,to:_,kind:E})=>({from:$,to:_,kind:E})),removed:e.edges.filter($=>!T($,f,S)).map(({from:$,to:_,kind:E})=>({from:$,to:_,kind:E}))}}}/**
|
|
41
|
-
* @license lucide-react v0.468.0 - ISC
|
|
42
|
-
*
|
|
43
|
-
* This source code is licensed under the ISC license.
|
|
44
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/const Y2=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),t0=(...e)=>e.filter((t,n,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===n).join(" ").trim();/**
|
|
46
|
-
* @license lucide-react v0.468.0 - ISC
|
|
47
|
-
*
|
|
48
|
-
* This source code is licensed under the ISC license.
|
|
49
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/var Q2={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"};/**
|
|
51
|
-
* @license lucide-react v0.468.0 - ISC
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the ISC license.
|
|
54
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const Z2=y.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:i="",children:l,iconNode:c,...u},f)=>y.createElement("svg",{ref:f,...Q2,width:t,height:t,stroke:e,strokeWidth:o?Number(n)*24/Number(t):n,className:t0("lucide",i),...u},[...c.map(([p,h])=>y.createElement(p,h)),...Array.isArray(l)?l:[l]]));/**
|
|
56
|
-
* @license lucide-react v0.468.0 - ISC
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the ISC license.
|
|
59
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/const ve=(e,t)=>{const n=y.forwardRef(({className:o,...i},l)=>y.createElement(Z2,{ref:l,iconNode:t,className:t0(`lucide-${Y2(e)}`,o),...i}));return n.displayName=`${e}`,n};/**
|
|
61
|
-
* @license lucide-react v0.468.0 - ISC
|
|
62
|
-
*
|
|
63
|
-
* This source code is licensed under the ISC license.
|
|
64
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
65
|
-
*/const n0=ve("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
|
|
66
|
-
* @license lucide-react v0.468.0 - ISC
|
|
67
|
-
*
|
|
68
|
-
* This source code is licensed under the ISC license.
|
|
69
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
-
*/const Rl=ve("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
|
|
71
|
-
* @license lucide-react v0.468.0 - ISC
|
|
72
|
-
*
|
|
73
|
-
* This source code is licensed under the ISC license.
|
|
74
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/const Ds=ve("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
|
|
76
|
-
* @license lucide-react v0.468.0 - ISC
|
|
77
|
-
*
|
|
78
|
-
* This source code is licensed under the ISC license.
|
|
79
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
-
*/const xh=ve("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
81
|
-
* @license lucide-react v0.468.0 - ISC
|
|
82
|
-
*
|
|
83
|
-
* This source code is licensed under the ISC license.
|
|
84
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
-
*/const J2=ve("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
|
|
86
|
-
* @license lucide-react v0.468.0 - ISC
|
|
87
|
-
*
|
|
88
|
-
* This source code is licensed under the ISC license.
|
|
89
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
90
|
-
*/const s0=ve("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
91
|
-
* @license lucide-react v0.468.0 - ISC
|
|
92
|
-
*
|
|
93
|
-
* This source code is licensed under the ISC license.
|
|
94
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
95
|
-
*/const Mu=ve("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
|
|
96
|
-
* @license lucide-react v0.468.0 - ISC
|
|
97
|
-
*
|
|
98
|
-
* This source code is licensed under the ISC license.
|
|
99
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
100
|
-
*/const yh=ve("Bot",[["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"}]]);/**
|
|
101
|
-
* @license lucide-react v0.468.0 - ISC
|
|
102
|
-
*
|
|
103
|
-
* This source code is licensed under the ISC license.
|
|
104
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
105
|
-
*/const e_=ve("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
|
|
106
|
-
* @license lucide-react v0.468.0 - ISC
|
|
107
|
-
*
|
|
108
|
-
* This source code is licensed under the ISC license.
|
|
109
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
110
|
-
*/const pd=ve("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
|
|
111
|
-
* @license lucide-react v0.468.0 - ISC
|
|
112
|
-
*
|
|
113
|
-
* This source code is licensed under the ISC license.
|
|
114
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
115
|
-
*/const hd=ve("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
116
|
-
* @license lucide-react v0.468.0 - ISC
|
|
117
|
-
*
|
|
118
|
-
* This source code is licensed under the ISC license.
|
|
119
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
120
|
-
*/const Bo=ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
121
|
-
* @license lucide-react v0.468.0 - ISC
|
|
122
|
-
*
|
|
123
|
-
* This source code is licensed under the ISC license.
|
|
124
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
125
|
-
*/const Us=ve("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
126
|
-
* @license lucide-react v0.468.0 - ISC
|
|
127
|
-
*
|
|
128
|
-
* This source code is licensed under the ISC license.
|
|
129
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
-
*/const Fa=ve("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
131
|
-
* @license lucide-react v0.468.0 - ISC
|
|
132
|
-
*
|
|
133
|
-
* This source code is licensed under the ISC license.
|
|
134
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
135
|
-
*/const t_=ve("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/**
|
|
136
|
-
* @license lucide-react v0.468.0 - ISC
|
|
137
|
-
*
|
|
138
|
-
* This source code is licensed under the ISC license.
|
|
139
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
140
|
-
*/const r0=ve("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
141
|
-
* @license lucide-react v0.468.0 - ISC
|
|
142
|
-
*
|
|
143
|
-
* This source code is licensed under the ISC license.
|
|
144
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/const vh=ve("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/**
|
|
146
|
-
* @license lucide-react v0.468.0 - ISC
|
|
147
|
-
*
|
|
148
|
-
* This source code is licensed under the ISC license.
|
|
149
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
-
*/const o0=ve("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
|
|
151
|
-
* @license lucide-react v0.468.0 - ISC
|
|
152
|
-
*
|
|
153
|
-
* This source code is licensed under the ISC license.
|
|
154
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
-
*/const n_=ve("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/**
|
|
156
|
-
* @license lucide-react v0.468.0 - ISC
|
|
157
|
-
*
|
|
158
|
-
* This source code is licensed under the ISC license.
|
|
159
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
-
*/const gd=ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
161
|
-
* @license lucide-react v0.468.0 - ISC
|
|
162
|
-
*
|
|
163
|
-
* This source code is licensed under the ISC license.
|
|
164
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
-
*/const s_=ve("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
|
|
166
|
-
* @license lucide-react v0.468.0 - ISC
|
|
167
|
-
*
|
|
168
|
-
* This source code is licensed under the ISC license.
|
|
169
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
-
*/const r_=ve("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
171
|
-
* @license lucide-react v0.468.0 - ISC
|
|
172
|
-
*
|
|
173
|
-
* This source code is licensed under the ISC license.
|
|
174
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
-
*/const o_=ve("ExternalLink",[["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"}]]);/**
|
|
176
|
-
* @license lucide-react v0.468.0 - ISC
|
|
177
|
-
*
|
|
178
|
-
* This source code is licensed under the ISC license.
|
|
179
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
-
*/const a0=ve("Eye",[["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"}]]);/**
|
|
181
|
-
* @license lucide-react v0.468.0 - ISC
|
|
182
|
-
*
|
|
183
|
-
* This source code is licensed under the ISC license.
|
|
184
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
-
*/const Xa=ve("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
186
|
-
* @license lucide-react v0.468.0 - ISC
|
|
187
|
-
*
|
|
188
|
-
* This source code is licensed under the ISC license.
|
|
189
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
-
*/const i0=ve("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
|
|
191
|
-
* @license lucide-react v0.468.0 - ISC
|
|
192
|
-
*
|
|
193
|
-
* This source code is licensed under the ISC license.
|
|
194
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
-
*/const a_=ve("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
196
|
-
* @license lucide-react v0.468.0 - ISC
|
|
197
|
-
*
|
|
198
|
-
* This source code is licensed under the ISC license.
|
|
199
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
-
*/const bh=ve("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/**
|
|
201
|
-
* @license lucide-react v0.468.0 - ISC
|
|
202
|
-
*
|
|
203
|
-
* This source code is licensed under the ISC license.
|
|
204
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
-
*/const vv=ve("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
|
|
206
|
-
* @license lucide-react v0.468.0 - ISC
|
|
207
|
-
*
|
|
208
|
-
* This source code is licensed under the ISC license.
|
|
209
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
-
*/const l0=ve("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
|
|
211
|
-
* @license lucide-react v0.468.0 - ISC
|
|
212
|
-
*
|
|
213
|
-
* This source code is licensed under the ISC license.
|
|
214
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
-
*/const i_=ve("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["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"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
|
|
216
|
-
* @license lucide-react v0.468.0 - ISC
|
|
217
|
-
*
|
|
218
|
-
* This source code is licensed under the ISC license.
|
|
219
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
-
*/const wh=ve("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/**
|
|
221
|
-
* @license lucide-react v0.468.0 - ISC
|
|
222
|
-
*
|
|
223
|
-
* This source code is licensed under the ISC license.
|
|
224
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
-
*/const kh=ve("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
|
|
226
|
-
* @license lucide-react v0.468.0 - ISC
|
|
227
|
-
*
|
|
228
|
-
* This source code is licensed under the ISC license.
|
|
229
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
-
*/const Sp=ve("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
231
|
-
* @license lucide-react v0.468.0 - ISC
|
|
232
|
-
*
|
|
233
|
-
* This source code is licensed under the ISC license.
|
|
234
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
-
*/const Al=ve("KeyRound",[["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"}]]);/**
|
|
236
|
-
* @license lucide-react v0.468.0 - ISC
|
|
237
|
-
*
|
|
238
|
-
* This source code is licensed under the ISC license.
|
|
239
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
-
*/const l_=ve("Layers",[["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"}]]);/**
|
|
241
|
-
* @license lucide-react v0.468.0 - ISC
|
|
242
|
-
*
|
|
243
|
-
* This source code is licensed under the ISC license.
|
|
244
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
-
*/const c_=ve("LayoutDashboard",[["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"}]]);/**
|
|
246
|
-
* @license lucide-react v0.468.0 - ISC
|
|
247
|
-
*
|
|
248
|
-
* This source code is licensed under the ISC license.
|
|
249
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
-
*/const c0=ve("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
|
|
251
|
-
* @license lucide-react v0.468.0 - ISC
|
|
252
|
-
*
|
|
253
|
-
* This source code is licensed under the ISC license.
|
|
254
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
-
*/const u_=ve("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
256
|
-
* @license lucide-react v0.468.0 - ISC
|
|
257
|
-
*
|
|
258
|
-
* This source code is licensed under the ISC license.
|
|
259
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
-
*/const d_=ve("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
261
|
-
* @license lucide-react v0.468.0 - ISC
|
|
262
|
-
*
|
|
263
|
-
* This source code is licensed under the ISC license.
|
|
264
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
-
*/const bv=ve("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/**
|
|
266
|
-
* @license lucide-react v0.468.0 - ISC
|
|
267
|
-
*
|
|
268
|
-
* This source code is licensed under the ISC license.
|
|
269
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
-
*/const f_=ve("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
271
|
-
* @license lucide-react v0.468.0 - ISC
|
|
272
|
-
*
|
|
273
|
-
* This source code is licensed under the ISC license.
|
|
274
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
-
*/const m_=ve("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
276
|
-
* @license lucide-react v0.468.0 - ISC
|
|
277
|
-
*
|
|
278
|
-
* This source code is licensed under the ISC license.
|
|
279
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
-
*/const p_=ve("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
|
|
281
|
-
* @license lucide-react v0.468.0 - ISC
|
|
282
|
-
*
|
|
283
|
-
* This source code is licensed under the ISC license.
|
|
284
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
-
*/const jh=ve("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
286
|
-
* @license lucide-react v0.468.0 - ISC
|
|
287
|
-
*
|
|
288
|
-
* This source code is licensed under the ISC license.
|
|
289
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
-
*/const h_=ve("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/**
|
|
291
|
-
* @license lucide-react v0.468.0 - ISC
|
|
292
|
-
*
|
|
293
|
-
* This source code is licensed under the ISC license.
|
|
294
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
-
*/const g_=ve("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
296
|
-
* @license lucide-react v0.468.0 - ISC
|
|
297
|
-
*
|
|
298
|
-
* This source code is licensed under the ISC license.
|
|
299
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
-
*/const Ol=ve("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/**
|
|
301
|
-
* @license lucide-react v0.468.0 - ISC
|
|
302
|
-
*
|
|
303
|
-
* This source code is licensed under the ISC license.
|
|
304
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
-
*/const x_=ve("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
306
|
-
* @license lucide-react v0.468.0 - ISC
|
|
307
|
-
*
|
|
308
|
-
* This source code is licensed under the ISC license.
|
|
309
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
-
*/const y_=ve("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
311
|
-
* @license lucide-react v0.468.0 - ISC
|
|
312
|
-
*
|
|
313
|
-
* This source code is licensed under the ISC license.
|
|
314
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
-
*/const ml=ve("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
|
|
316
|
-
* @license lucide-react v0.468.0 - ISC
|
|
317
|
-
*
|
|
318
|
-
* This source code is licensed under the ISC license.
|
|
319
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
-
*/const Ml=ve("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
321
|
-
* @license lucide-react v0.468.0 - ISC
|
|
322
|
-
*
|
|
323
|
-
* This source code is licensed under the ISC license.
|
|
324
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
-
*/const Pl=ve("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
326
|
-
* @license lucide-react v0.468.0 - ISC
|
|
327
|
-
*
|
|
328
|
-
* This source code is licensed under the ISC license.
|
|
329
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
-
*/const v_=ve("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/**
|
|
331
|
-
* @license lucide-react v0.468.0 - ISC
|
|
332
|
-
*
|
|
333
|
-
* This source code is licensed under the ISC license.
|
|
334
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
-
*/const pl=ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
336
|
-
* @license lucide-react v0.468.0 - ISC
|
|
337
|
-
*
|
|
338
|
-
* This source code is licensed under the ISC license.
|
|
339
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
-
*/const b_=ve("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
|
341
|
-
* @license lucide-react v0.468.0 - ISC
|
|
342
|
-
*
|
|
343
|
-
* This source code is licensed under the ISC license.
|
|
344
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
-
*/const u0=ve("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
346
|
-
* @license lucide-react v0.468.0 - ISC
|
|
347
|
-
*
|
|
348
|
-
* This source code is licensed under the ISC license.
|
|
349
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
-
*/const w_=ve("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/**
|
|
351
|
-
* @license lucide-react v0.468.0 - ISC
|
|
352
|
-
*
|
|
353
|
-
* This source code is licensed under the ISC license.
|
|
354
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
-
*/const k_=ve("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
356
|
-
* @license lucide-react v0.468.0 - ISC
|
|
357
|
-
*
|
|
358
|
-
* This source code is licensed under the ISC license.
|
|
359
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
-
*/const d0=ve("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
361
|
-
* @license lucide-react v0.468.0 - ISC
|
|
362
|
-
*
|
|
363
|
-
* This source code is licensed under the ISC license.
|
|
364
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
-
*/const f0=ve("ShieldQuestion",[["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"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
366
|
-
* @license lucide-react v0.468.0 - ISC
|
|
367
|
-
*
|
|
368
|
-
* This source code is licensed under the ISC license.
|
|
369
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
-
*/const j_=ve("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
|
|
371
|
-
* @license lucide-react v0.468.0 - ISC
|
|
372
|
-
*
|
|
373
|
-
* This source code is licensed under the ISC license.
|
|
374
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
-
*/const Nh=ve("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
376
|
-
* @license lucide-react v0.468.0 - ISC
|
|
377
|
-
*
|
|
378
|
-
* This source code is licensed under the ISC license.
|
|
379
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
-
*/const N_=ve("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/**
|
|
381
|
-
* @license lucide-react v0.468.0 - ISC
|
|
382
|
-
*
|
|
383
|
-
* This source code is licensed under the ISC license.
|
|
384
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
385
|
-
*/const S_=ve("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
386
|
-
* @license lucide-react v0.468.0 - ISC
|
|
387
|
-
*
|
|
388
|
-
* This source code is licensed under the ISC license.
|
|
389
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
390
|
-
*/const __=ve("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
391
|
-
* @license lucide-react v0.468.0 - ISC
|
|
392
|
-
*
|
|
393
|
-
* This source code is licensed under the ISC license.
|
|
394
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
395
|
-
*/const m0=ve("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
396
|
-
* @license lucide-react v0.468.0 - ISC
|
|
397
|
-
*
|
|
398
|
-
* This source code is licensed under the ISC license.
|
|
399
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
400
|
-
*/const $_=ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
401
|
-
* @license lucide-react v0.468.0 - ISC
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the ISC license.
|
|
404
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/const er=ve("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
406
|
-
* @license lucide-react v0.468.0 - ISC
|
|
407
|
-
*
|
|
408
|
-
* This source code is licensed under the ISC license.
|
|
409
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
410
|
-
*/const Sh=ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
|
|
411
|
-
* @license lucide-react v0.468.0 - ISC
|
|
412
|
-
*
|
|
413
|
-
* This source code is licensed under the ISC license.
|
|
414
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
415
|
-
*/const hl=ve("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/**
|
|
416
|
-
* @license lucide-react v0.468.0 - ISC
|
|
417
|
-
*
|
|
418
|
-
* This source code is licensed under the ISC license.
|
|
419
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
420
|
-
*/const p0=ve("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
421
|
-
* @license lucide-react v0.468.0 - ISC
|
|
422
|
-
*
|
|
423
|
-
* This source code is licensed under the ISC license.
|
|
424
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
425
|
-
*/const Go=ve("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
|
|
426
|
-
* @license lucide-react v0.468.0 - ISC
|
|
427
|
-
*
|
|
428
|
-
* This source code is licensed under the ISC license.
|
|
429
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
430
|
-
*/const Pu=ve("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
|
|
431
|
-
* @license lucide-react v0.468.0 - ISC
|
|
432
|
-
*
|
|
433
|
-
* This source code is licensed under the ISC license.
|
|
434
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
435
|
-
*/const Ll=ve("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
436
|
-
* @license lucide-react v0.468.0 - ISC
|
|
437
|
-
*
|
|
438
|
-
* This source code is licensed under the ISC license.
|
|
439
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
440
|
-
*/const E_=ve("Zap",[["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"}]]);function h0(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=h0(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function g0(){for(var e,t,n=0,o="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=h0(e))&&(o&&(o+=" "),o+=t);return o}const _h="-",T_=e=>{const t=R_(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:c=>{const u=c.split(_h);return u[0]===""&&u.length!==1&&u.shift(),x0(u,t)||C_(c)},getConflictingClassGroupIds:(c,u)=>{const f=n[c]||[];return u&&o[c]?[...f,...o[c]]:f}}},x0=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),i=o?x0(e.slice(1),o):void 0;if(i)return i;if(t.validators.length===0)return;const l=e.join(_h);return(c=t.validators.find(({validator:u})=>u(l)))==null?void 0:c.classGroupId},wv=/^\[(.+)\]$/,C_=e=>{if(wv.test(e)){const t=wv.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},R_=e=>{const{theme:t,prefix:n}=e,o={nextPart:new Map,validators:[]};return O_(Object.entries(e.classGroups),n).forEach(([l,c])=>{_p(c,o,l,t)}),o},_p=(e,t,n,o)=>{e.forEach(i=>{if(typeof i=="string"){const l=i===""?t:kv(t,i);l.classGroupId=n;return}if(typeof i=="function"){if(A_(i)){_p(i(o),t,n,o);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([l,c])=>{_p(c,kv(t,l),n,o)})})},kv=(e,t)=>{let n=e;return t.split(_h).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},A_=e=>e.isThemeGetter,O_=(e,t)=>t?e.map(([n,o])=>{const i=o.map(l=>typeof l=="string"?t+l:typeof l=="object"?Object.fromEntries(Object.entries(l).map(([c,u])=>[t+c,u])):l);return[n,i]}):e,M_=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,o=new Map;const i=(l,c)=>{n.set(l,c),t++,t>e&&(t=0,o=n,n=new Map)};return{get(l){let c=n.get(l);if(c!==void 0)return c;if((c=o.get(l))!==void 0)return i(l,c),c},set(l,c){n.has(l)?n.set(l,c):i(l,c)}}},y0="!",P_=e=>{const{separator:t,experimentalParseClassName:n}=e,o=t.length===1,i=t[0],l=t.length,c=u=>{const f=[];let p=0,h=0,b;for(let j=0;j<u.length;j++){let S=u[j];if(p===0){if(S===i&&(o||u.slice(j,j+l)===t)){f.push(u.slice(h,j)),h=j+l;continue}if(S==="/"){b=j;continue}}S==="["?p++:S==="]"&&p--}const x=f.length===0?u:u.substring(h),m=x.startsWith(y0),v=m?x.substring(1):x,w=b&&b>h?b-h:void 0;return{modifiers:f,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:w}};return n?u=>n({className:u,parseClassName:c}):c},L_=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(o=>{o[0]==="["?(t.push(...n.sort(),o),n=[]):n.push(o)}),t.push(...n.sort()),t},I_=e=>({cache:M_(e.cacheSize),parseClassName:P_(e),...T_(e)}),z_=/\s+/,D_=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i}=t,l=[],c=e.trim().split(z_);let u="";for(let f=c.length-1;f>=0;f-=1){const p=c[f],{modifiers:h,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:m}=n(p);let v=!!m,w=o(v?x.substring(0,m):x);if(!w){if(!v){u=p+(u.length>0?" "+u:u);continue}if(w=o(x),!w){u=p+(u.length>0?" "+u:u);continue}v=!1}const j=L_(h).join(":"),S=b?j+y0:j,T=S+w;if(l.includes(T))continue;l.push(T);const $=i(w,v);for(let _=0;_<$.length;++_){const E=$[_];l.push(S+E)}u=p+(u.length>0?" "+u:u)}return u};function F_(){let e=0,t,n,o="";for(;e<arguments.length;)(t=arguments[e++])&&(n=v0(t))&&(o&&(o+=" "),o+=n);return o}const v0=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=v0(e[o]))&&(n&&(n+=" "),n+=t);return n};function jv(e,...t){let n,o,i,l=c;function c(f){const p=t.reduce((h,b)=>b(h),e());return n=I_(p),o=n.cache.get,i=n.cache.set,l=u,u(f)}function u(f){const p=o(f);if(p)return p;const h=D_(f,n);return i(f,h),h}return function(){return l(F_.apply(null,arguments))}}const gt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},b0=/^\[(?:([a-z-]+):)?(.+)\]$/i,U_=/^\d+\/\d+$/,W_=new Set(["px","full","screen"]),H_=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,B_=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,G_=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,q_=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,V_=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,hr=e=>Ca(e)||W_.has(e)||U_.test(e),qr=e=>Ya(e,"length",t$),Ca=e=>!!e&&!Number.isNaN(Number(e)),Fm=e=>Ya(e,"number",Ca),Hi=e=>!!e&&Number.isInteger(Number(e)),K_=e=>e.endsWith("%")&&Ca(e.slice(0,-1)),Ve=e=>b0.test(e),Vr=e=>H_.test(e),X_=new Set(["length","size","percentage"]),Y_=e=>Ya(e,X_,w0),Q_=e=>Ya(e,"position",w0),Z_=new Set(["image","url"]),J_=e=>Ya(e,Z_,s$),e$=e=>Ya(e,"",n$),Bi=()=>!0,Ya=(e,t,n)=>{const o=b0.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):n(o[2]):!1},t$=e=>B_.test(e)&&!G_.test(e),w0=()=>!1,n$=e=>q_.test(e),s$=e=>V_.test(e),Nv=()=>{const e=gt("colors"),t=gt("spacing"),n=gt("blur"),o=gt("brightness"),i=gt("borderColor"),l=gt("borderRadius"),c=gt("borderSpacing"),u=gt("borderWidth"),f=gt("contrast"),p=gt("grayscale"),h=gt("hueRotate"),b=gt("invert"),x=gt("gap"),m=gt("gradientColorStops"),v=gt("gradientColorStopPositions"),w=gt("inset"),j=gt("margin"),S=gt("opacity"),T=gt("padding"),$=gt("saturate"),_=gt("scale"),E=gt("sepia"),R=gt("skew"),C=gt("space"),O=gt("translate"),z=()=>["auto","contain","none"],F=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",Ve,t],B=()=>[Ve,t],U=()=>["",hr,qr],W=()=>["auto",Ca,Ve],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],I=()=>["","0",Ve],G=()=>["auto","avoid","all","avoid-page","page","left","right","column"],P=()=>[Ca,Ve];return{cacheSize:500,separator:":",theme:{colors:[Bi],spacing:[hr,qr],blur:["none","",Vr,Ve],brightness:P(),borderColor:[e],borderRadius:["none","","full",Vr,Ve],borderSpacing:B(),borderWidth:U(),contrast:P(),grayscale:I(),hueRotate:P(),invert:I(),gap:B(),gradientColorStops:[e],gradientColorStopPositions:[K_,qr],inset:D(),margin:D(),opacity:P(),padding:B(),saturate:P(),scale:P(),sepia:I(),skew:P(),space:B(),translate:B()},classGroups:{aspect:[{aspect:["auto","square","video",Ve]}],container:["container"],columns:[{columns:[Vr]}],"break-after":[{"break-after":G()}],"break-before":[{"break-before":G()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...X(),Ve]}],overflow:[{overflow:F()}],"overflow-x":[{"overflow-x":F()}],"overflow-y":[{"overflow-y":F()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[w]}],"inset-x":[{"inset-x":[w]}],"inset-y":[{"inset-y":[w]}],start:[{start:[w]}],end:[{end:[w]}],top:[{top:[w]}],right:[{right:[w]}],bottom:[{bottom:[w]}],left:[{left:[w]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Hi,Ve]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ve]}],grow:[{grow:I()}],shrink:[{shrink:I()}],order:[{order:["first","last","none",Hi,Ve]}],"grid-cols":[{"grid-cols":[Bi]}],"col-start-end":[{col:["auto",{span:["full",Hi,Ve]},Ve]}],"col-start":[{"col-start":W()}],"col-end":[{"col-end":W()}],"grid-rows":[{"grid-rows":[Bi]}],"row-start-end":[{row:["auto",{span:[Hi,Ve]},Ve]}],"row-start":[{"row-start":W()}],"row-end":[{"row-end":W()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ve]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ve]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ve,t]}],"min-w":[{"min-w":[Ve,t,"min","max","fit"]}],"max-w":[{"max-w":[Ve,t,"none","full","min","max","fit","prose",{screen:[Vr]},Vr]}],h:[{h:[Ve,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ve,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ve,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ve,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Vr,qr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Fm]}],"font-family":[{font:[Bi]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ve]}],"line-clamp":[{"line-clamp":["none",Ca,Fm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",hr,Ve]}],"list-image":[{"list-image":["none",Ve]}],"list-style-type":[{list:["none","disc","decimal",Ve]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",hr,qr]}],"underline-offset":[{"underline-offset":["auto",hr,Ve]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:B()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...X(),Q_]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Y_]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},J_]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[l]}],"rounded-s":[{"rounded-s":[l]}],"rounded-e":[{"rounded-e":[l]}],"rounded-t":[{"rounded-t":[l]}],"rounded-r":[{"rounded-r":[l]}],"rounded-b":[{"rounded-b":[l]}],"rounded-l":[{"rounded-l":[l]}],"rounded-ss":[{"rounded-ss":[l]}],"rounded-se":[{"rounded-se":[l]}],"rounded-ee":[{"rounded-ee":[l]}],"rounded-es":[{"rounded-es":[l]}],"rounded-tl":[{"rounded-tl":[l]}],"rounded-tr":[{"rounded-tr":[l]}],"rounded-br":[{"rounded-br":[l]}],"rounded-bl":[{"rounded-bl":[l]}],"border-w":[{border:[u]}],"border-w-x":[{"border-x":[u]}],"border-w-y":[{"border-y":[u]}],"border-w-s":[{"border-s":[u]}],"border-w-e":[{"border-e":[u]}],"border-w-t":[{"border-t":[u]}],"border-w-r":[{"border-r":[u]}],"border-w-b":[{"border-b":[u]}],"border-w-l":[{"border-l":[u]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...M(),"hidden"]}],"divide-x":[{"divide-x":[u]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[u]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[hr,Ve]}],"outline-w":[{outline:[hr,qr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[hr,qr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Vr,e$]}],"shadow-color":[{shadow:[Bi]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[f]}],"drop-shadow":[{"drop-shadow":["","none",Vr,Ve]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[b]}],saturate:[{saturate:[$]}],sepia:[{sepia:[E]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[f]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[$]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ve]}],duration:[{duration:P()}],ease:[{ease:["linear","in","out","in-out",Ve]}],delay:[{delay:P()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ve]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[_]}],"scale-x":[{"scale-x":[_]}],"scale-y":[{"scale-y":[_]}],rotate:[{rotate:[Hi,Ve]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ve]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ve]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":B()}],"scroll-mx":[{"scroll-mx":B()}],"scroll-my":[{"scroll-my":B()}],"scroll-ms":[{"scroll-ms":B()}],"scroll-me":[{"scroll-me":B()}],"scroll-mt":[{"scroll-mt":B()}],"scroll-mr":[{"scroll-mr":B()}],"scroll-mb":[{"scroll-mb":B()}],"scroll-ml":[{"scroll-ml":B()}],"scroll-p":[{"scroll-p":B()}],"scroll-px":[{"scroll-px":B()}],"scroll-py":[{"scroll-py":B()}],"scroll-ps":[{"scroll-ps":B()}],"scroll-pe":[{"scroll-pe":B()}],"scroll-pt":[{"scroll-pt":B()}],"scroll-pr":[{"scroll-pr":B()}],"scroll-pb":[{"scroll-pb":B()}],"scroll-pl":[{"scroll-pl":B()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ve]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[hr,qr,Fm]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},r$=(e,{cacheSize:t,prefix:n,separator:o,experimentalParseClassName:i,extend:l={},override:c={}})=>{el(e,"cacheSize",t),el(e,"prefix",n),el(e,"separator",o),el(e,"experimentalParseClassName",i);for(const u in c)o$(e[u],c[u]);for(const u in l)a$(e[u],l[u]);return e},el=(e,t,n)=>{n!==void 0&&(e[t]=n)},o$=(e,t)=>{if(t)for(const n in t)el(e,n,t[n])},a$=(e,t)=>{if(t)for(const n in t){const o=t[n];o!==void 0&&(e[n]=(e[n]||[]).concat(o))}},i$=(e,...t)=>typeof e=="function"?jv(Nv,e,...t):jv(()=>r$(Nv(),e),...t),l$=i$({override:{conflictingClassGroups:{"font-size":[]}},extend:{theme:{spacing:["sidebar","control-sm","control-md","control-lg"]},classGroups:{"max-w":[{"max-w":["page","page-wide"]}],"font-size":[{text:["micro","label","small","body","lead","prose","figure","display"]}],z:[{z:["raised","sticky","overlay","dialog","popover","toast"]}],shadow:[{shadow:["float"]}],duration:[{duration:["fast","base","slow"]}],ease:[{ease:["standard"]}],"outline-w":[{outline:["focus"]}],"outline-offset":[{"outline-offset":["focus"]}]}}}),oe=(...e)=>l$(g0(e));function c$({value:e,onChange:t,options:n,label:o,name:i,size:l="md",className:c}){return s.jsx("div",{role:"radiogroup","aria-label":o,className:oe("inline-flex",c),children:n.map(u=>s.jsxs("label",{title:u.title,className:oe("caps -ml-px inline-flex items-center justify-center gap-1.5 border first:ml-0 has-[:focus-visible]:relative has-[:focus-visible]:outline has-[:focus-visible]:outline-focus has-[:focus-visible]:outline-offset-focus has-[:focus-visible]:outline-ring [&_svg]:size-3.5",l==="sm"?"h-control-sm px-2.5 text-label":"h-control-md px-3 text-small",u.disabled?"cursor-not-allowed opacity-45":"cursor-pointer",e===u.value?"relative border-foreground bg-foreground text-background":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[s.jsx("input",{type:"radio",name:i,value:u.value,checked:e===u.value,disabled:u.disabled,onChange:()=>t(u.value),className:"sr-only"}),u.label]},u.value))})}const ks=e=>u$(e)?e.document:d$(e)?e:(e==null?void 0:e.ownerDocument)??(typeof document<"u"?document:void 0),xd=e=>{let t=ks(e);return(t==null?void 0:t.defaultView)??(typeof window<"u"?window:void 0)};function k0(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function u$(e){return typeof e=="object"&&e!=null&&"window"in e&&e.window===e}function d$(e){return k0(e)&&e.nodeType===9}function f$(e){return k0(e)&&e.nodeType===11&&"host"in e}let m$=!1;function $h(){return m$}function Oo(e,t){var o;if(!$h())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!=null;){if(n===e)return!0;typeof n.assignedElements!="function"&&((o=n.assignedSlot)!=null&&o.parentNode)?n=n.assignedSlot.parentNode:f$(n)?n=n.host:n=n.parentNode}return!1}const ro=(e=document)=>{var n;if(!$h())return e.activeElement;let t=e.activeElement;for(;t&&"shadowRoot"in t&&((n=t.shadowRoot)!=null&&n.activeElement);)t=t.shadowRoot.activeElement;return t};function wn(e){if($h()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}function p$(e){e.focus({preventScroll:!0})}const h$=typeof document<"u"?je.useLayoutEffect:()=>{};function j0(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function g$(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function N0(e){let t=y.useRef({isFocused:!1,observer:null});return h$(()=>{const n=t.current;return()=>{n.observer&&(n.observer.disconnect(),n.observer=null)}},[]),y.useCallback(n=>{let o=wn(n);if(o instanceof HTMLButtonElement||o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLSelectElement){t.current.isFocused=!0;let i=o,l=c=>{if(t.current.isFocused=!1,i.disabled){let u=j0(c);e==null||e(u)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};i.addEventListener("focusout",l,{once:!0}),t.current.observer=new MutationObserver(()=>{var c;if(t.current.isFocused&&i.disabled){(c=t.current.observer)==null||c.disconnect();let u=i===ro()?null:ro();i.dispatchEvent(new FocusEvent("blur",{relatedTarget:u})),i.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:u}))}}),t.current.observer.observe(i,{attributes:!0,attributeFilter:["disabled"]})}},[e])}function Eh(e){var n;if(typeof window>"u"||window.navigator==null)return!1;let t=(n=window.navigator.userAgentData)==null?void 0:n.brands;return Array.isArray(t)&&t.some(o=>e.test(o.brand))||e.test(window.navigator.userAgent)}function Th(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)==null?void 0:t.platform)||window.navigator.platform):!1}function qo(e){let t=null;return()=>(t==null&&(t=e()),t)}const Ch=qo(function(){return Th(/^Mac/i)}),x$=qo(function(){return Th(/^iPhone/i)}),S0=qo(function(){return Th(/^iPad/i)||Ch()&&navigator.maxTouchPoints>1}),y$=qo(function(){return x$()||S0()}),v$=qo(function(){return Eh(/AppleWebKit/i)&&(y$()||!b$())}),b$=qo(function(){return Eh(/Chrome|CriOS|CrMo/i)}),w$=qo(function(){return Eh(/Android/i)});function k$(e){return e.pointerType===""&&e.isTrusted?!0:w$()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function gl(e,t,n=!0){let{metaKey:o,ctrlKey:i,altKey:l,shiftKey:c}=t,u=v$()&&Ch()&&!S0()?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:o,ctrlKey:i,altKey:l,shiftKey:c}):new MouseEvent("click",{metaKey:o,ctrlKey:i,altKey:l,shiftKey:c,detail:1,bubbles:!0,cancelable:!0});gl.isOpening=n,p$(e),e.dispatchEvent(u),gl.isOpening=!1}gl.isOpening=!1;let Qa=null;const $p=new Set;let al=new Map,Io=!1,Nu=!1;const j$={Tab:!0,Escape:!0};function yd(e,t){for(let n of $p)n(e,t)}function N$(e){return!(e.metaKey||!Ch()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Lu(e){Io=!0,!gl.isOpening&&N$(e)&&(Qa="keyboard",yd("keyboard",e))}function Ra(e){Qa="pointer","pointerType"in e&&e.pointerType,(e.type==="mousedown"||e.type==="pointerdown")&&(Io=!0,yd("pointer",e))}function _0(e){!gl.isOpening&&k$(e)&&(Io=!0,Qa="virtual")}function $0(e){let t=wn(e),n=xd(t),o=ks(t);if(t===n){Nu=!0;return}t===o||!e.isTrusted||(!Io&&!Nu&&(Qa="virtual",yd("virtual",e)),Io=!1,Nu=!1)}function E0(){Io=!1,Nu=!0}function T0(e){let t=ro(ks(wn(e)));queueMicrotask(()=>{ro(ks(wn(e)))!==t&&_$("keyboard")})}function Ep(e){if(typeof window>"u"||typeof document>"u")return;const t=xd(e),n=ks(e);if(al.get(t))return;let o=t.HTMLElement.prototype.focus;Reflect.defineProperty(t.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(){Io=!0,o.apply(this,arguments)}}),n.addEventListener("keydown",Lu,!0),n.addEventListener("keyup",Lu,!0),n.addEventListener("click",_0,!0),n.addEventListener("invalid",T0,!0),t.addEventListener("focus",$0,!0),t.addEventListener("blur",E0,!1),typeof PointerEvent<"u"&&(n.addEventListener("pointerdown",Ra,!0),n.addEventListener("pointermove",Ra,!0),n.addEventListener("pointerup",Ra,!0)),t.addEventListener("beforeunload",()=>{C0(e)},{once:!0}),al.set(t,{focus:o})}const C0=(e,t)=>{const n=xd(e),o=ks(e);t&&o.removeEventListener("DOMContentLoaded",t),al.has(n)&&(Reflect.defineProperty(n.HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:al.get(n).focus}),o.removeEventListener("keydown",Lu,!0),o.removeEventListener("keyup",Lu,!0),o.removeEventListener("click",_0,!0),o.removeEventListener("invalid",T0,!0),n.removeEventListener("focus",$0,!0),n.removeEventListener("blur",E0,!1),typeof PointerEvent<"u"&&(o.removeEventListener("pointerdown",Ra,!0),o.removeEventListener("pointermove",Ra,!0),o.removeEventListener("pointerup",Ra,!0)),al.delete(n))};function S$(e){const t=ks(e);let n;return t.readyState!=="loading"?Ep(e):(n=()=>{Ep(e)},t.addEventListener("DOMContentLoaded",n)),()=>C0(e,n)}typeof document<"u"&&S$();function Tp(){return Qa!=="pointer"}function _$(e){Qa=e,yd(e,null)}const $$=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function E$(e,t,n){let o=n?wn(n):void 0,i=ks(o),l=xd(o);const c=typeof l<"u"?l.HTMLInputElement:HTMLInputElement,u=typeof l<"u"?l.HTMLTextAreaElement:HTMLTextAreaElement,f=typeof l<"u"?l.HTMLElement:HTMLElement,p=typeof l<"u"?l.KeyboardEvent:KeyboardEvent;let h=ro(i);return e=e||h instanceof c&&!$$.has(h.type)||h instanceof u||h instanceof f&&h.isContentEditable,!(e&&t==="keyboard"&&n instanceof p&&!j$[n.key])}function T$(e,t,n){Ep(),y.useEffect(()=>{if((n==null?void 0:n.enabled)===!1)return;let o=(i,l)=>{E$(!!(n!=null&&n.isTextInput),i,l)&&e(Tp())};return $p.add(o),()=>{$p.delete(o)}},t)}function C$(e){let{isDisabled:t,onFocus:n,onBlur:o,onFocusChange:i}=e;const l=y.useCallback(f=>{if(wn(f)===f.currentTarget)return o&&o(f),i&&i(!1),!0},[o,i]),c=N0(l),u=y.useCallback(f=>{let p=wn(f);const h=ks(p),b=h?ro(h):ro();p===f.currentTarget&&p===b&&(n&&n(f),i&&i(!0),c(f))},[i,n,c]);return{focusProps:{onFocus:!t&&(n||i||o)?u:void 0,onBlur:!t&&(o||i)?l:void 0}}}function R0(){let e=y.useRef(new Map),t=y.useCallback((i,l,c,u)=>{let f=u!=null&&u.once?(...p)=>{e.current.delete(c),c(...p)}:c;e.current.set(c,{type:l,eventTarget:i,fn:f,options:u}),i.addEventListener(l,f,u)},[]),n=y.useCallback((i,l,c,u)=>{var p;let f=((p=e.current.get(c))==null?void 0:p.fn)||c;i.removeEventListener(l,f,u),e.current.delete(c)},[]),o=y.useCallback(()=>{e.current.forEach((i,l)=>{n(i.eventTarget,i.type,l,i.options)})},[n]);return y.useEffect(()=>o,[o]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:o}}function R$(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:o,onFocusWithinChange:i}=e,l=y.useRef({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:u}=R0(),f=y.useCallback(b=>{Oo(b.currentTarget,wn(b))&&l.current.isFocusWithin&&!Oo(b.currentTarget,b.relatedTarget)&&(l.current.isFocusWithin=!1,u(),n&&n(b),i&&i(!1))},[n,i,l,u]),p=N0(f),h=y.useCallback(b=>{if(!Oo(b.currentTarget,wn(b)))return;let x=wn(b);const m=ks(x),v=ro(m);if(!l.current.isFocusWithin&&v===x){o&&o(b),i&&i(!0),l.current.isFocusWithin=!0,p(b);let w=b.currentTarget;c(m,"focus",j=>{let S=wn(j);if(l.current.isFocusWithin&&!Oo(w,S)){let T=new m.defaultView.FocusEvent("blur",{relatedTarget:S});g$(T,w);let $=j0(T);f($)}},{capture:!0})}},[o,i,p,c,f]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:h,onBlur:f}}}function A$(e={}){let{autoFocus:t=!1,isTextInput:n,within:o}=e,i=y.useRef({isFocused:!1,isFocusVisible:t||Tp()}),[l,c]=y.useState(!1),[u,f]=y.useState(()=>i.current.isFocused&&i.current.isFocusVisible),p=y.useCallback(()=>f(i.current.isFocused&&i.current.isFocusVisible),[]),h=y.useCallback(m=>{i.current.isFocused=m,i.current.isFocusVisible=Tp(),c(m),p()},[p]);T$(m=>{i.current.isFocusVisible=m,p()},[n,l],{enabled:l,isTextInput:n});let{focusProps:b}=C$({isDisabled:o,onFocusChange:h}),{focusWithinProps:x}=R$({isDisabled:!o,onFocusWithinChange:h});return{isFocused:l,isFocusVisible:u,focusProps:o?x:b}}var tr=e0();let Cp=!1,su=0;function O$(){Cp=!0,setTimeout(()=>{Cp=!1},500)}function Sv(e){e.pointerType==="touch"&&O$()}function M$(){let e=ks(null);if(!(typeof e>"u"))return su===0&&typeof PointerEvent<"u"&&e.addEventListener("pointerup",Sv),su++,()=>{su--,!(su>0)&&typeof PointerEvent<"u"&&e.removeEventListener("pointerup",Sv)}}function P$(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:o,isDisabled:i}=e,[l,c]=y.useState(!1),u=y.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;y.useEffect(M$,[]);let{addGlobalListener:f,removeAllGlobalListeners:p}=R0(),{hoverProps:h,triggerHoverEnd:b}=y.useMemo(()=>{let x=(w,j)=>{if(u.pointerType=j,i||j==="touch"||u.isHovered||!Oo(w.currentTarget,wn(w)))return;u.isHovered=!0;let S=w.currentTarget;u.target=S,f(ks(wn(w)),"pointerover",T=>{u.isHovered&&u.target&&!Oo(u.target,wn(T))&&m(T,T.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:S,pointerType:j}),n&&n(!0),c(!0)},m=(w,j)=>{let S=u.target;u.pointerType="",u.target=null,!(j==="touch"||!u.isHovered||!S)&&(u.isHovered=!1,p(),o&&o({type:"hoverend",target:S,pointerType:j}),n&&n(!1),c(!1))},v={};return typeof PointerEvent<"u"&&(v.onPointerEnter=w=>{Cp&&w.pointerType==="mouse"||x(w,w.pointerType)},v.onPointerLeave=w=>{!i&&Oo(w.currentTarget,wn(w))&&m(w,w.pointerType)}),{hoverProps:v,triggerHoverEnd:m}},[t,n,o,i,u,f,p]);return y.useEffect(()=>{i&&b({currentTarget:u.target},u.pointerType)},[i]),{hoverProps:h,isHovered:l}}var L$=Object.defineProperty,I$=(e,t,n)=>t in e?L$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Um=(e,t,n)=>(I$(e,typeof t!="symbol"?t+"":t,n),n);let z$=class{constructor(){Um(this,"current",this.detect()),Um(this,"handoffState","pending"),Um(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Zs=new z$;function Za(e){var t;return Zs.isServer?null:e==null?document:(t=e==null?void 0:e.ownerDocument)!=null?t:document}function Iu(e){var t,n;return Zs.isServer?null:e==null?document:(n=(t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))!=null?n:document}function A0(e){var t,n;return(n=(t=Iu(e))==null?void 0:t.activeElement)!=null?n:null}function O0(e){return A0(e)===e}function vd(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function rs(){let e=[],t={addEventListener(n,o,i,l){return n.addEventListener(o,i,l),t.add(()=>n.removeEventListener(o,i,l))},requestAnimationFrame(...n){let o=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(o))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let o=setTimeout(...n);return t.add(()=>clearTimeout(o))},microTask(...n){let o={current:!0};return vd(()=>{o.current&&n[0]()}),t.add(()=>{o.current=!1})},style(n,o,i){let l=n.style.getPropertyValue(o);return Object.assign(n.style,{[o]:i}),this.add(()=>{Object.assign(n.style,{[o]:l})})},group(n){let o=rs();return n(o),this.add(()=>o.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let o=e.indexOf(n);if(o>=0)for(let i of e.splice(o,1))i()}},dispose(){for(let n of e.splice(0))n()}};return t}function lo(){let[e]=y.useState(rs);return y.useEffect(()=>()=>e.dispose(),[e]),e}let Nt=(e,t)=>{Zs.isServer?y.useEffect(e,t):y.useLayoutEffect(e,t)};function co(e){let t=y.useRef(e);return Nt(()=>{t.current=e},[e]),t}let Ue=function(e){let t=co(e);return je.useCallback((...n)=>t.current(...n),[t])};function D$(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function F$(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function U$({disabled:e=!1}={}){let t=y.useRef(null),[n,o]=y.useState(!1),i=lo(),l=Ue(()=>{t.current=null,o(!1),i.dispose()}),c=Ue(u=>{if(i.dispose(),t.current===null){t.current=u.currentTarget,o(!0);{let f=Za(u.currentTarget);i.addEventListener(f,"pointerup",l,!1),i.addEventListener(f,"pointermove",p=>{if(t.current){let h=D$(p);o(F$(h,t.current.getBoundingClientRect()))}},!1),i.addEventListener(f,"pointercancel",l,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:c,onPointerUp:l,onClick:l}}}function js(e){return y.useMemo(()=>e,Object.values(e))}let W$=y.createContext(void 0);function Rh(){return y.useContext(W$)}function Rp(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Sn(e,t,...n){if(e in t){let i=t[e];return typeof i=="function"?i(...n):i}let o=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(i=>`"${i}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,Sn),o}var Ua=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Ua||{}),Zr=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Zr||{});function Xt(){let e=B$();return y.useCallback(t=>H$({mergeRefs:e,...t}),[e])}function H$({ourProps:e,theirProps:t,slot:n,defaultTag:o,features:i,visible:l=!0,name:c,mergeRefs:u}){u=u??G$;let f=M0(t,e);if(l)return ru(f,n,o,c,u);let p=i??0;if(p&2){let{static:h=!1,...b}=f;if(h)return ru(b,n,o,c,u)}if(p&1){let{unmount:h=!0,...b}=f;return Sn(h?0:1,{0(){return null},1(){return ru({...b,hidden:!0,style:{display:"none"}},n,o,c,u)}})}return ru(f,n,o,c,u)}function ru(e,t={},n,o,i){let{as:l=n,children:c,refName:u="ref",...f}=Wm(e,["unmount","static"]),p=e.ref!==void 0?{[u]:e.ref}:{},h=typeof c=="function"?c(t):c;h=L0(h),"className"in f&&f.className&&typeof f.className=="function"&&(f.className=f.className(t)),f["aria-labelledby"]&&f["aria-labelledby"]===f.id&&(f["aria-labelledby"]=void 0);let b={};if(t){let x=!1,m=[];for(let[v,w]of Object.entries(t))typeof w=="boolean"&&(x=!0),w===!0&&m.push(v.replace(/([A-Z])/g,j=>`-${j.toLowerCase()}`));if(x){b["data-headlessui-state"]=m.join(" ");for(let v of m)b[`data-${v}`]=""}}if(il(l)&&(Object.keys(Xr(f)).length>0||Object.keys(Xr(b)).length>0))if(!y.isValidElement(h)||Array.isArray(h)&&h.length>1||V$(h)){if(Object.keys(Xr(f)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(Xr(f)).concat(Object.keys(Xr(b))).map(x=>` - ${x}`).join(`
|
|
441
|
-
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(x=>` - ${x}`).join(`
|
|
442
|
-
`)].join(`
|
|
443
|
-
`))}else{let x=h.props,m=x==null?void 0:x.className,v=typeof m=="function"?(...S)=>Rp(m(...S),f.className):Rp(m,f.className),w=v?{className:v}:{},j=M0(h.props,Xr(Wm(f,["ref"])));for(let S in b)S in j&&delete b[S];return y.cloneElement(h,Object.assign({},j,b,p,{ref:i(q$(h),p.ref)},w))}return y.createElement(l,Object.assign({},Wm(f,["ref"]),!il(l)&&p,!il(l)&&b),h)}function B$(){let e=y.useRef([]),t=y.useCallback(n=>{for(let o of e.current)o!=null&&(typeof o=="function"?o(n):o.current=n)},[]);return(...n)=>{if(!n.every(o=>o==null))return e.current=n,t}}function G$(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function M0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let o of e)for(let i in o)i.startsWith("on")&&typeof o[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(o[i])):t[i]=o[i];if(t.disabled||t["aria-disabled"])for(let o in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(o)&&(n[o]=[i=>{var l;return(l=i==null?void 0:i.preventDefault)==null?void 0:l.call(i)}]);for(let o in n)Object.assign(t,{[o](i,...l){let c=n[o];for(let u of c){if((i instanceof Event||(i==null?void 0:i.nativeEvent)instanceof Event)&&i.defaultPrevented)return;u(i,...l)}}});return t}function P0(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let o of e)for(let i in o)i.startsWith("on")&&typeof o[i]=="function"?(n[i]!=null||(n[i]=[]),n[i].push(o[i])):t[i]=o[i];for(let o in n)Object.assign(t,{[o](...i){let l=n[o];for(let c of l)c==null||c(...i)}});return t}function Lt(e){var t;return Object.assign(y.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Xr(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Wm(e,t=[]){let n=Object.assign({},e);for(let o of t)o in n&&delete n[o];return n}function q$(e){return je.version.split(".")[0]>="19"?e.props.ref:e.ref}function L0(e){if(e!=null&&e.$$typeof===Symbol.for("react.lazy")){let t=e._payload;if(t!=null&&t.status==="fulfilled")return L0(t.value)}return e}function il(e){return e===y.Fragment||e===Symbol.for("react.fragment")}function V$(e){return il(e.type)}function K$(e,t,n){let[o,i]=y.useState(n),l=e!==void 0,c=y.useRef(l),u=y.useRef(!1),f=y.useRef(!1);return l&&!c.current&&!u.current?(u.current=!0,c.current=l,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!l&&c.current&&!f.current&&(f.current=!0,c.current=l,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[l?e:o,Ue(p=>(l||tr.flushSync(()=>i(p)),t==null?void 0:t(p)))]}function X$(e){let[t]=y.useState(e);return t}function I0(e={},t=null,n=[]){for(let[o,i]of Object.entries(e))D0(n,z0(t,o),i);return n}function z0(e,t){return e?e+"["+t+"]":t}function D0(e,t,n){if(Array.isArray(n))for(let[o,i]of n.entries())D0(e,z0(t,o.toString()),i);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):Q$(n)&&!y.isValidElement(n)&&I0(n,t,e)}function Y$(e){var t,n;let o=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(o){for(let i of o.elements)if(i!==e&&(i.tagName==="INPUT"&&i.type==="submit"||i.tagName==="BUTTON"&&i.type==="submit"||i.nodeName==="INPUT"&&i.type==="image")){i.click();return}(n=o.requestSubmit)==null||n.call(o)}}function Q$(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}let Z$="span";var Wa=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Wa||{});function J$(e,t){var n;let{features:o=1,...i}=e,l={ref:t,"aria-hidden":(o&2)===2?!0:(n=i["aria-hidden"])!=null?n:void 0,hidden:(o&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(o&4)===4&&(o&2)!==2&&{display:"none"}}};return Xt()({ourProps:l,theirProps:i,slot:{},defaultTag:Z$,name:"Hidden"})}let xl=Lt(J$),eE=y.createContext(null);function tE({children:e}){let t=y.useContext(eE);if(!t)return je.createElement(je.Fragment,null,e);let{target:n}=t;return n?tr.createPortal(je.createElement(je.Fragment,null,e),n):null}function nE({data:e,form:t,disabled:n,onReset:o,overrides:i}){let[l,c]=y.useState(null),u=lo();return y.useEffect(()=>{if(o&&l)return u.addEventListener(l,"reset",o)},[l,t,o]),je.createElement(tE,null,je.createElement(sE,{setForm:c,formId:t}),I0(e).map(([f,p])=>je.createElement(xl,{features:Wa.Hidden,...Xr({key:f,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:f,value:p,...i})})))}function sE({setForm:e,formId:t}){return y.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:je.createElement(xl,{features:Wa.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let o=n.closest("form");o&&e(o)}})}let rE=y.createContext(void 0);function F0(){return y.useContext(rE)}function U0(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function br(e){return U0(e)&&"tagName"in e}function es(e){return br(e)&&"accessKey"in e}function yr(e){return br(e)&&"tabIndex"in e}function oE(e){return br(e)&&"style"in e}function aE(e){return es(e)&&e.nodeName==="IFRAME"}function W0(e){return es(e)&&e.nodeName==="INPUT"}function _v(e){return es(e)&&e.nodeName==="LABEL"}function iE(e){return es(e)&&e.nodeName==="FIELDSET"}function H0(e){return es(e)&&e.nodeName==="LEGEND"}function lE(e){return br(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function $v(e){let t=e.parentElement,n=null;for(;t&&!iE(t);)H0(t)&&(n=t),t=t.parentElement;let o=(t==null?void 0:t.getAttribute("disabled"))==="";return o&&cE(n)?!1:o}function cE(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(H0(t))return!1;t=t.previousElementSibling}return!0}let B0=Symbol();function uE(e,t=!0){return Object.assign(e,{[B0]:t})}function pn(...e){let t=y.useRef(e);y.useEffect(()=>{t.current=e},[e]);let n=Ue(o=>{for(let i of t.current)i!=null&&(typeof i=="function"?i(o):i.current=o)});return e.every(o=>o==null||(o==null?void 0:o[B0]))?void 0:n}let bd=y.createContext(null);bd.displayName="DescriptionContext";function G0(){let e=y.useContext(bd);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,G0),t}return e}function dE(){var e,t;return(t=(e=y.useContext(bd))==null?void 0:e.value)!=null?t:void 0}function fE(){let[e,t]=y.useState([]);return[e.length>0?e.join(" "):void 0,y.useMemo(()=>function(n){let o=Ue(l=>(t(c=>[...c,l]),()=>t(c=>{let u=c.slice(),f=u.indexOf(l);return f!==-1&&u.splice(f,1),u}))),i=y.useMemo(()=>({register:o,slot:n.slot,name:n.name,props:n.props,value:n.value}),[o,n.slot,n.name,n.props,n.value]);return je.createElement(bd.Provider,{value:i},n.children)},[t])]}let mE="p";function pE(e,t){let n=y.useId(),o=Rh(),{id:i=`headlessui-description-${n}`,...l}=e,c=G0(),u=pn(t);Nt(()=>c.register(i),[i,c.register]);let f=js({...c.slot,disabled:o||!1}),p={ref:u,...c.props,id:i};return Xt()({ourProps:p,theirProps:l,slot:f,defaultTag:mE,name:c.name||"Description"})}let hE=Lt(pE),q0=Object.assign(hE,{});var Wt=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(Wt||{});let wd=y.createContext(null);wd.displayName="LabelContext";function V0(){let e=y.useContext(wd);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,V0),t}return e}function K0(e){var t,n,o;let i=(n=(t=y.useContext(wd))==null?void 0:t.value)!=null?n:void 0;return((o=e==null?void 0:e.length)!=null?o:0)>0?[i,...e].filter(Boolean).join(" "):i}function gE({inherit:e=!1}={}){let t=K0(),[n,o]=y.useState([]),i=e?[t,...n].filter(Boolean):n;return[i.length>0?i.join(" "):void 0,y.useMemo(()=>function(l){let c=Ue(f=>(o(p=>[...p,f]),()=>o(p=>{let h=p.slice(),b=h.indexOf(f);return b!==-1&&h.splice(b,1),h}))),u=y.useMemo(()=>({register:c,slot:l.slot,name:l.name,props:l.props,value:l.value}),[c,l.slot,l.name,l.props,l.value]);return je.createElement(wd.Provider,{value:u},l.children)},[o])]}let xE="label";function yE(e,t){var n;let o=y.useId(),i=V0(),l=F0(),c=Rh(),{id:u=`headlessui-label-${o}`,htmlFor:f=l??((n=i.props)==null?void 0:n.htmlFor),passive:p=!1,...h}=e,b=pn(t);Nt(()=>i.register(u),[u,i.register]);let x=Ue(w=>{let j=w.currentTarget;if(!(w.target!==w.currentTarget&&lE(w.target))&&(_v(j)&&w.preventDefault(),i.props&&"onClick"in i.props&&typeof i.props.onClick=="function"&&i.props.onClick(w),_v(j))){let S=document.getElementById(j.htmlFor);if(S){let T=S.getAttribute("disabled");if(T==="true"||T==="")return;let $=S.getAttribute("aria-disabled");if($==="true"||$==="")return;(W0(S)&&(S.type==="file"||S.type==="radio"||S.type==="checkbox")||S.role==="radio"||S.role==="checkbox"||S.role==="switch")&&S.click(),S.focus({preventScroll:!0})}}}),m=js({...i.slot,disabled:c||!1}),v={ref:b,...i.props,id:u,htmlFor:f,onClick:x};return p&&("onClick"in v&&(delete v.htmlFor,delete v.onClick),"onClick"in h&&delete h.onClick),Xt()({ourProps:v,theirProps:h,slot:m,defaultTag:f?xE:"div",name:i.name||"Label"})}let vE=Lt(yE),bE=Object.assign(vE,{}),wE=y.createContext(()=>{});function kE({value:e,children:t}){return je.createElement(wE.Provider,{value:e},t)}function jE(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function NE(e=jE){return y.useCallback((t,n)=>{if(typeof e=="string"){let o=e;return(t==null?void 0:t[o])===(n==null?void 0:n[o])}return e(t,n)},[e])}function Ev(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function SE(e,t,n=!1){let[o,i]=y.useState(()=>Ev(t));return Nt(()=>{if(!t||!e)return;let l=rs();return l.requestAnimationFrame(function c(){l.requestAnimationFrame(c),i(u=>{let f=Ev(t);return f.width===u.width&&f.height===u.height?u:f})}),()=>{l.dispose()}},[t,e]),n?{width:`${o.width}px`,height:`${o.height}px`}:o}var X0=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(X0||{});function _E(e){let t=y.useRef(null),n=Ue(i=>{t.current=i.pointerType,!$v(i.currentTarget)&&i.pointerType==="mouse"&&i.button===X0.Left&&(i.preventDefault(),e(i))}),o=Ue(i=>{t.current!=="mouse"&&($v(i.currentTarget)||e(i))});return{onPointerDown:n,onClick:o}}let Y0=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var $E=Object.defineProperty,EE=(e,t,n)=>t in e?$E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,TE=(e,t,n)=>(EE(e,t+"",n),n),Q0=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},hs=(e,t,n)=>(Q0(e,t,"read from private field"),n?n.call(e):t.get(e)),Hm=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Tv=(e,t,n,o)=>(Q0(e,t,"write to private field"),t.set(e,n),n),Xs,tl,nl;let Z0=class{constructor(t){Hm(this,Xs,{}),Hm(this,tl,new Y0(()=>new Set)),Hm(this,nl,new Set),TE(this,"disposables",rs()),Tv(this,Xs,t),Zs.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return hs(this,Xs)}subscribe(t,n){if(Zs.isServer)return()=>{};let o={selector:t,callback:n,current:t(hs(this,Xs))};return hs(this,nl).add(o),this.disposables.add(()=>{hs(this,nl).delete(o)})}on(t,n){return Zs.isServer?()=>{}:(hs(this,tl).get(t).add(n),this.disposables.add(()=>{hs(this,tl).get(t).delete(n)}))}send(t){let n=this.reduce(hs(this,Xs),t);if(n!==hs(this,Xs)){Tv(this,Xs,n);for(let o of hs(this,nl)){let i=o.selector(hs(this,Xs));J0(o.current,i)||(o.current=i,o.callback(i))}for(let o of hs(this,tl).get(t.type))o(hs(this,Xs),t)}}};Xs=new WeakMap,tl=new WeakMap,nl=new WeakMap;function J0(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Bm(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Bm(e.entries(),t.entries()):Cv(e)&&Cv(t)?Bm(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Bm(e,t){do{let n=e.next(),o=t.next();if(n.done&&o.done)return!0;if(n.done||o.done||!Object.is(n.value,o.value))return!1}while(!0)}function Cv(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Gm(e){let[t,n]=e(),o=rs();return(...i)=>{t(...i),o.dispose(),o.microTask(n)}}var CE=Object.defineProperty,RE=(e,t,n)=>t in e?CE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rv=(e,t,n)=>(RE(e,typeof t!="symbol"?t+"":t,n),n),ek=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(ek||{});let AE={0(e,t){let n=t.id,o=e.stack,i=e.stack.indexOf(n);if(i!==-1){let l=e.stack.slice();return l.splice(i,1),l.push(n),o=l,{...e,stack:o}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,o=e.stack.indexOf(n);if(o===-1)return e;let i=e.stack.slice();return i.splice(o,1),{...e,stack:i}}},OE=class tk extends Z0{constructor(){super(...arguments),Rv(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Rv(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new tk({stack:[]})}reduce(t,n){return Sn(n.type,AE,t,n)}};const kd=new Y0(()=>OE.new());var qm={exports:{}},Vm={};/**
|
|
444
|
-
* @license React
|
|
445
|
-
* use-sync-external-store-with-selector.production.js
|
|
446
|
-
*
|
|
447
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
448
|
-
*
|
|
449
|
-
* This source code is licensed under the MIT license found in the
|
|
450
|
-
* LICENSE file in the root directory of this source tree.
|
|
451
|
-
*/var Av;function ME(){if(Av)return Vm;Av=1;var e=md();function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,o=e.useSyncExternalStore,i=e.useRef,l=e.useEffect,c=e.useMemo,u=e.useDebugValue;return Vm.useSyncExternalStoreWithSelector=function(f,p,h,b,x){var m=i(null);if(m.current===null){var v={hasValue:!1,value:null};m.current=v}else v=m.current;m=c(function(){function j(E){if(!S){if(S=!0,T=E,E=b(E),x!==void 0&&v.hasValue){var R=v.value;if(x(R,E))return $=R}return $=E}if(R=$,n(T,E))return R;var C=b(E);return x!==void 0&&x(R,C)?(T=E,R):(T=E,$=C)}var S=!1,T,$,_=h===void 0?null:h;return[function(){return j(p())},_===null?void 0:function(){return j(_())}]},[p,h,b,x]);var w=o(f,m[0],m[1]);return l(function(){v.hasValue=!0,v.value=w},[w]),u(w),w},Vm}var Ov;function PE(){return Ov||(Ov=1,qm.exports=ME()),qm.exports}var LE=PE();function bn(e,t,n=J0){return LE.useSyncExternalStoreWithSelector(Ue(o=>e.subscribe(IE,o)),Ue(()=>e.state),Ue(()=>e.state),Ue(t),n)}function IE(e){return e}function Il(e,t){let n=y.useId(),o=kd.get(t),[i,l]=bn(o,y.useCallback(c=>[o.selectors.isTop(c,n),o.selectors.inStack(c,n)],[o,n]));return Nt(()=>{if(e)return o.actions.push(n),()=>o.actions.pop(n)},[o,e,n]),e?l?i:!0:!1}let Ap=new Map,ll=new Map;function Mv(e){var t;let n=(t=ll.get(e))!=null?t:0;return ll.set(e,n+1),n!==0?()=>Pv(e):(Ap.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Pv(e))}function Pv(e){var t;let n=(t=ll.get(e))!=null?t:1;if(n===1?ll.delete(e):ll.set(e,n-1),n!==1)return;let o=Ap.get(e);o&&(o["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",o["aria-hidden"]),e.inert=o.inert,Ap.delete(e))}function nk(e,{allowed:t,disallowed:n}={}){let o=Il(e,"inert-others");Nt(()=>{var i,l;if(!o)return;let c=rs();for(let f of(i=n==null?void 0:n())!=null?i:[])f&&c.add(Mv(f));let u=(l=t==null?void 0:t())!=null?l:[];for(let f of u){if(!f)continue;let p=Za(f);if(!p)continue;let h=f.parentElement;for(;h&&h!==p.body;){for(let b of h.children)u.some(x=>b.contains(x))||c.add(Mv(b));h=h.parentElement}}return c.dispose},[o,t,n])}function sk(e,t,n){let o=co(i=>{let l=i.getBoundingClientRect();l.x===0&&l.y===0&&l.width===0&&l.height===0&&n()});y.useEffect(()=>{if(!e)return;let i=t===null?null:es(t)?t:t.current;if(!i)return;let l=rs();if(typeof ResizeObserver<"u"){let c=new ResizeObserver(()=>o.current(i));c.observe(i),l.add(()=>c.disconnect())}if(typeof IntersectionObserver<"u"){let c=new IntersectionObserver(()=>o.current(i));c.observe(i),l.add(()=>c.disconnect())}return()=>l.dispose()},[t,o,e])}let zu=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","details>summary","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),zE=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Is=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Is||{}),Op=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Op||{}),DE=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(DE||{});function rk(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(zu)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function FE(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(zE)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Ah=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ah||{});function ok(e,t=0){var n;return e===((n=Za(e))==null?void 0:n.body)?!1:Sn(t,{0(){return e.matches(zu)},1(){let o=e;for(;o!==null;){if(o.matches(zu))return!0;o=o.parentElement}return!1}})}var UE=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(UE||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));function wr(e){e==null||e.focus({preventScroll:!0})}let WE=["textarea","input"].join(",");function HE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,WE))!=null?n:!1}function ak(e,t=n=>n){return e.slice().sort((n,o)=>{let i=t(n),l=t(o);if(i===null||l===null)return 0;let c=i.compareDocumentPosition(l);return c&Node.DOCUMENT_POSITION_FOLLOWING?-1:c&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function BE(e,t,n=e===null?document.body:Iu(e)){return Aa(rk(n),t,{relativeTo:e})}function Aa(e,t,{sorted:n=!0,relativeTo:o=null,skipElements:i=[]}={}){let l=Array.isArray(e)?e.length>0?Iu(e[0]):document:Iu(e),c=Array.isArray(e)?n?ak(e):e:t&64?FE(e):rk(e);i.length>0&&c.length>1&&(c=c.filter(m=>!i.some(v=>v!=null&&"current"in v?(v==null?void 0:v.current)===m:v===m))),o=o??(l==null?void 0:l.activeElement);let u=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),f=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,c.indexOf(o))-1;if(t&4)return Math.max(0,c.indexOf(o))+1;if(t&8)return c.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),p=t&32?{preventScroll:!0}:{},h=0,b=c.length,x;do{if(h>=b||h+b<=0)return 0;let m=f+h;if(t&16)m=(m+b)%b;else{if(m<0)return 3;if(m>=b)return 1}x=c[m],x==null||x.focus(p),h+=u}while(x!==A0(x));return t&6&&HE(x)&&x.select(),2}function ik(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function GE(){return/Android/gi.test(window.navigator.userAgent)}function Lv(){return ik()||GE()}function _a(e,t,n,o){let i=co(n);y.useEffect(()=>{if(!e)return;function l(c){i.current(c)}return document.addEventListener(t,l,o),()=>document.removeEventListener(t,l,o)},[e,t,o])}function lk(e,t,n,o){let i=co(n);y.useEffect(()=>{if(!e)return;function l(c){i.current(c)}return window.addEventListener(t,l,o),()=>window.removeEventListener(t,l,o)},[e,t,o])}const Iv=30;function ck(e,t,n){let o=co(n),i=y.useCallback(function(u,f){if(u.defaultPrevented)return;let p=f(u);if(p===null||!p.getRootNode().contains(p)||!p.isConnected)return;let h=(function b(x){return typeof x=="function"?b(x()):Array.isArray(x)||x instanceof Set?x:[x]})(t);for(let b of h)if(b!==null&&(b.contains(p)||u.composed&&u.composedPath().includes(b)))return;return!ok(p,Ah.Loose)&&p.tabIndex!==-1&&u.preventDefault(),o.current(u,p)},[o,t]),l=y.useRef(null);_a(e,"pointerdown",u=>{var f,p;Lv()||(l.current=((p=(f=u.composedPath)==null?void 0:f.call(u))==null?void 0:p[0])||u.target)},!0),_a(e,"pointerup",u=>{if(Lv()||!l.current)return;let f=l.current;return l.current=null,i(u,()=>f)},!0);let c=y.useRef({x:0,y:0});_a(e,"touchstart",u=>{c.current.x=u.touches[0].clientX,c.current.y=u.touches[0].clientY},!0),_a(e,"touchend",u=>{let f={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(f.x-c.current.x)>=Iv||Math.abs(f.y-c.current.y)>=Iv))return i(u,()=>yr(u.target)?u.target:null)},!0),lk(e,"blur",u=>i(u,()=>aE(window.document.activeElement)?window.document.activeElement:null),!0)}function yl(...e){return y.useMemo(()=>Za(...e),[...e])}var qE=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(qE||{});const ou={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},VE=200,zv=5;function KE(e,{trigger:t,action:n,close:o,select:i}){let l=y.useRef(null),c=y.useRef(null),u=y.useRef(null);_a(e&&t!==null,"pointerdown",f=>{U0(f==null?void 0:f.target)&&t!=null&&t.contains(f.target)&&(c.current=f.x,u.current=f.y,l.current=f.timeStamp)}),_a(e&&t!==null,"pointerup",f=>{var p,h;let b=l.current;if(b===null||(l.current=null,!yr(f.target))||Math.abs(f.x-((p=c.current)!=null?p:f.x))<zv&&Math.abs(f.y-((h=u.current)!=null?h:f.y))<zv)return;let x=n(f);switch(x.kind){case 0:return;case 1:{f.timeStamp-b>VE&&(i(x.target),o());break}case 2:{o();break}}},{capture:!0})}function uk(e,t,n,o){let i=co(n);y.useEffect(()=>{e=e??window;function l(c){i.current(c)}return e.addEventListener(t,l,o),()=>e.removeEventListener(t,l,o)},[e,t,o])}function XE(e,t){return y.useMemo(()=>{var n;if(e.type)return e.type;let o=(n=e.as)!=null?n:"button";if(typeof o=="string"&&o.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function YE(e){return y.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function QE(e,t){let n=e(),o=new Set;return{getSnapshot(){return n},subscribe(i){return o.add(i),()=>o.delete(i)},dispatch(i,...l){let c=t[i].call(n,...l);c&&(n=c,o.forEach(u=>u()))}}}function ZE(){let e;return{before({doc:t}){var n;let o=t.documentElement,i=(n=t.defaultView)!=null?n:window;e=Math.max(0,i.innerWidth-o.clientWidth)},after({doc:t,d:n}){let o=t.documentElement,i=Math.max(0,o.clientWidth-o.offsetWidth),l=Math.max(0,e-i);n.style(o,"paddingRight",`${l}px`)}}}function JE(){return ik()?{before({doc:e,d:t,meta:n}){function o(i){for(let l of n().containers)for(let c of l())if(c.contains(i))return!0;return!1}t.microTask(()=>{var i;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let u=rs();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let l=(i=window.scrollY)!=null?i:window.pageYOffset,c=null;t.addEventListener(e,"click",u=>{if(yr(u.target))try{let f=u.target.closest("a");if(!f)return;let{hash:p}=new URL(f.href),h=e.querySelector(p);yr(h)&&!o(h)&&(c=h)}catch{}},!0),t.group(u=>{t.addEventListener(e,"touchstart",f=>{if(u.dispose(),yr(f.target)&&oE(f.target))if(o(f.target)){let p=f.target;for(;p.parentElement&&o(p.parentElement);)p=p.parentElement;u.style(p,"overscrollBehavior","contain")}else u.style(f.target,"touchAction","none")})}),t.addEventListener(e,"touchmove",u=>{if(yr(u.target)){if(W0(u.target))return;if(o(u.target)){let f=u.target;for(;f.parentElement&&f.dataset.headlessuiPortal!==""&&!(f.scrollHeight>f.clientHeight||f.scrollWidth>f.clientWidth);)f=f.parentElement;f.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let f=(u=window.scrollY)!=null?u:window.pageYOffset;l!==f&&window.scrollTo(0,l),c&&c.isConnected&&(c.scrollIntoView({block:"nearest"}),c=null)})})}}:{}}function eT(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Dv(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Mo=QE(()=>new Map,{PUSH(e,t){var n;let o=(n=this.get(e))!=null?n:{doc:e,count:0,d:rs(),meta:new Set,computedMeta:{}};return o.count++,o.meta.add(t),o.computedMeta=Dv(o.meta),this.set(e,o),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t),n.computedMeta=Dv(n.meta)),this},SCROLL_PREVENT(e){let t={doc:e.doc,d:e.d,meta(){return e.computedMeta}},n=[JE(),ZE(),eT()];n.forEach(({before:o})=>o==null?void 0:o(t)),n.forEach(({after:o})=>o==null?void 0:o(t))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Mo.subscribe(()=>{let e=Mo.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let o=t.get(n.doc)==="hidden",i=n.count!==0;(i&&!o||!i&&o)&&Mo.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Mo.dispatch("TEARDOWN",n)}});function tT(e,t,n=()=>({containers:[]})){let o=YE(Mo),i=t?o.get(t):void 0,l=i?i.count>0:!1;return Nt(()=>{if(!(!t||!e))return Mo.dispatch("PUSH",t,n),()=>Mo.dispatch("POP",t,n)},[e,t]),l}function dk(e,t,n=()=>[document.body]){let o=Il(e,"scroll-lock");tT(o,t,i=>{var l;return{containers:[...(l=i.containers)!=null?l:[],n]}})}function Fv(e){return[e.screenX,e.screenY]}function nT(){let e=y.useRef([-1,-1]);return{wasMoved(t){let n=Fv(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Fv(t)}}}function sT(e=0){let[t,n]=y.useState(e),o=y.useCallback(f=>n(f),[]),i=y.useCallback(f=>n(p=>p|f),[]),l=y.useCallback(f=>(t&f)===f,[t]),c=y.useCallback(f=>n(p=>p&~f),[]),u=y.useCallback(f=>n(p=>p^f),[]);return{flags:t,setFlag:o,addFlag:i,hasFlag:l,removeFlag:c,toggleFlag:u}}var rT={},Uv,Wv;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Uv=process==null?void 0:rT)==null?void 0:Uv.NODE_ENV)==="test"&&typeof((Wv=Element==null?void 0:Element.prototype)==null?void 0:Wv.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
452
|
-
`)),[]});var oT=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(oT||{});function fk(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function mk(e,t,n,o){let[i,l]=y.useState(n),{hasFlag:c,addFlag:u,removeFlag:f}=sT(e&&i?3:0),p=y.useRef(!1),h=y.useRef(!1),b=lo();return Nt(()=>{var x;if(e){if(n&&l(!0),!t){n&&u(3);return}return(x=o==null?void 0:o.start)==null||x.call(o,n),aT(t,{inFlight:p,prepare(){h.current?h.current=!1:h.current=p.current,p.current=!0,!h.current&&(n?(u(3),f(4)):(u(4),f(2)))},run(){h.current?n?(f(3),u(4)):(f(4),u(3)):n?f(1):u(1)},done(){var m;h.current&&cT(t)||(p.current=!1,f(7),n||l(!1),(m=o==null?void 0:o.end)==null||m.call(o,n))}})}},[e,n,t,b]),e?[i,{closed:c(1),enter:c(2),leave:c(4),transition:c(2)||c(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function aT(e,{prepare:t,run:n,done:o,inFlight:i}){let l=rs();return lT(e,{prepare:t,inFlight:i}),l.nextFrame(()=>{n(),l.requestAnimationFrame(()=>{l.add(iT(e,o))})}),l.dispose}function iT(e,t){var n,o;let i=rs();if(!e)return i.dispose;let l=!1;i.add(()=>{l=!0});let c=(o=(n=e.getAnimations)==null?void 0:n.call(e).filter(u=>u instanceof CSSTransition))!=null?o:[];return c.length===0?(t(),i.dispose):(Promise.allSettled(c.map(u=>u.finished)).then(()=>{l||t()}),i.dispose)}function lT(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let o=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=o}function cT(e){var t,n;return((n=(t=e.getAnimations)==null?void 0:t.call(e))!=null?n:[]).some(o=>o instanceof CSSTransition&&o.playState!=="finished")}function Oh(e,t){let n=y.useRef([]),o=Ue(e);y.useEffect(()=>{let i=[...n.current];for(let[l,c]of t.entries())if(n.current[l]!==c){let u=o(t,i);return n.current=t,u}},[o,...t])}function jd(){return typeof window<"u"}function Ja(e){return pk(e)?(e.nodeName||"").toLowerCase():"#document"}function Wn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function jr(e){var t;return(t=(pk(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function pk(e){return jd()?e instanceof Node||e instanceof Wn(e).Node:!1}function Un(e){return jd()?e instanceof Element||e instanceof Wn(e).Element:!1}function uo(e){return jd()?e instanceof HTMLElement||e instanceof Wn(e).HTMLElement:!1}function Hv(e){return!jd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wn(e).ShadowRoot}function Nd(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=nr(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&i!=="inline"&&i!=="contents"}function uT(e){return/^(table|td|th)$/.test(Ja(e))}function Sd(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const dT=/transform|translate|scale|rotate|perspective|filter/,fT=/paint|layout|strict|content/,$o=e=>!!e&&e!=="none";let Km;function Mh(e){const t=Un(e)?nr(e):e;return $o(t.transform)||$o(t.translate)||$o(t.scale)||$o(t.rotate)||$o(t.perspective)||!Ph()&&($o(t.backdropFilter)||$o(t.filter))||dT.test(t.willChange||"")||fT.test(t.contain||"")}function mT(e){let t=zo(e);for(;uo(t)&&!vl(t);){if(Mh(t))return t;if(Sd(t))return null;t=zo(t)}return null}function Ph(){return Km==null&&(Km=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Km}function vl(e){return/^(html|body|#document)$/.test(Ja(e))}function nr(e){return Wn(e).getComputedStyle(e)}function _d(e){return Un(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function zo(e){if(Ja(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Hv(e)&&e.host||jr(e);return Hv(t)?t.host:t}function hk(e){const t=zo(e);return vl(t)?(e.ownerDocument||e).body:uo(t)&&Nd(t)?t:hk(t)}function bl(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=hk(e),l=i===((o=e.ownerDocument)==null?void 0:o.body),c=Wn(i);if(l){const u=Mp(c);return t.concat(c,c.visualViewport||[],Nd(i)?i:[],u&&n?bl(u):[])}else return t.concat(i,bl(i,[],n))}function Mp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pT(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:o}=t;return n+"/"+o}).join(" "):navigator.userAgent}const Do=Math.min,bs=Math.max,wl=Math.round,au=Math.floor,kr=e=>({x:e,y:e}),hT={left:"right",right:"left",bottom:"top",top:"bottom"};function gT(e,t,n){return bs(e,Do(t,n))}function ei(e,t){return typeof e=="function"?e(t):e}function Fo(e){return e.split("-")[0]}function zl(e){return e.split("-")[1]}function gk(e){return e==="x"?"y":"x"}function xk(e){return e==="y"?"height":"width"}function vr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yk(e){return gk(vr(e))}function xT(e,t,n){n===void 0&&(n=!1);const o=zl(e),i=yk(e),l=xk(i);let c=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(c=Du(c)),[c,Du(c)]}function yT(e){const t=Du(e);return[Pp(e),t,Pp(t)]}function Pp(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bv=["left","right"],Gv=["right","left"],vT=["top","bottom"],bT=["bottom","top"];function wT(e,t,n){switch(e){case"top":case"bottom":return n?t?Gv:Bv:t?Bv:Gv;case"left":case"right":return t?vT:bT;default:return[]}}function kT(e,t,n,o){const i=zl(e);let l=wT(Fo(e),n==="start",o);return i&&(l=l.map(c=>c+"-"+i),t&&(l=l.concat(l.map(Pp)))),l}function Du(e){const t=Fo(e);return hT[t]+e.slice(t.length)}function jT(e){var t,n,o,i;return{top:(t=e.top)!=null?t:0,right:(n=e.right)!=null?n:0,bottom:(o=e.bottom)!=null?o:0,left:(i=e.left)!=null?i:0}}function NT(e){return typeof e!="number"?jT(e):{top:e,right:e,bottom:e,left:e}}function Fu(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function qv(e,t,n){let{reference:o,floating:i}=e;const l=vr(t),c=yk(t),u=xk(c),f=Fo(t),p=l==="y",h=o.x+o.width/2-i.width/2,b=o.y+o.height/2-i.height/2,x=o[u]/2-i[u]/2;let m;switch(f){case"top":m={x:h,y:o.y-i.height};break;case"bottom":m={x:h,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:b};break;case"left":m={x:o.x-i.width,y:b};break;default:m={x:o.x,y:o.y}}const v=zl(t);return v&&(m[c]+=x*(v==="end"?1:-1)*(n&&p?-1:1)),m}async function vk(e,t){var n;t===void 0&&(t={});const{x:o,y:i,platform:l,rects:c,elements:u,strategy:f}=e,{boundary:p="clippingAncestors",rootBoundary:h="viewport",elementContext:b="floating",altBoundary:x=!1,padding:m=0}=ei(t,e),v=NT(m),j=u[x?b==="floating"?"reference":"floating":b],S=Fu(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(j)))==null||n?j:j.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:p,rootBoundary:h,strategy:f})),T=b==="floating"?{x:o,y:i,width:c.floating.width,height:c.floating.height}:c.reference,$=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),_=await(l.isElement==null?void 0:l.isElement($))&&await(l.getScale==null?void 0:l.getScale($))||{x:1,y:1},E=Fu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:T,offsetParent:$,strategy:f}):T);return{top:(S.top-E.top+v.top)/_.y,bottom:(E.bottom-S.bottom+v.bottom)/_.y,left:(S.left-E.left+v.left)/_.x,right:(E.right-S.right+v.right)/_.x}}const ST=50,_T=async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:l=[],platform:c}=n,u=c.detectOverflow?c:{...c,detectOverflow:vk},f=await(c.isRTL==null?void 0:c.isRTL(t));let p=await c.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:b}=qv(p,o,f),x=o,m=0;const v={};for(let w=0;w<l.length;w++){const j=l[w];if(!j)continue;const{name:S,fn:T}=j,{x:$,y:_,data:E,reset:R}=await T({x:h,y:b,initialPlacement:o,placement:x,strategy:i,middlewareData:v,rects:p,platform:u,elements:{reference:e,floating:t}});h=$??h,b=_??b,v[S]={...v[S],...E},R&&m<ST&&(m++,typeof R=="object"&&(R.placement&&(x=R.placement),R.rects&&(p=R.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:i}):R.rects),{x:h,y:b}=qv(p,x,f)),w=-1)}return{x:h,y:b,placement:x,strategy:i,middlewareData:v}},$T=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:l,rects:c,initialPlacement:u,platform:f,elements:p}=t,{mainAxis:h=!0,crossAxis:b=!0,fallbackPlacements:x,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:w=!0,...j}=ei(e,t);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const S=Fo(i),T=vr(u),$=Fo(u)===u,_=await(f.isRTL==null?void 0:f.isRTL(p.floating)),E=x||($||!w?[Du(u)]:yT(u)),R=v!=="none";!x&&R&&E.push(...kT(u,w,v,_));const C=[u,...E],O=await f.detectOverflow(t,j),z=[];let F=((o=l.flip)==null?void 0:o.overflows)||[];if(h&&z.push(O[S]),b){const W=xT(i,c,_);z.push(O[W[0]],O[W[1]])}if(F=[...F,{placement:i,overflows:z}],!z.every(W=>W<=0)){var D,B;const W=(((D=l.flip)==null?void 0:D.index)||0)+1,X=C[W];if(X&&(!(b==="alignment"?T!==vr(X):!1)||F.every(L=>vr(L.placement)===T?L.overflows[0]>0:!0)))return{data:{index:W,overflows:F},reset:{placement:X}};let M=(B=F.filter(K=>K.overflows[0]<=0).sort((K,L)=>K.overflows[1]-L.overflows[1])[0])==null?void 0:B.placement;if(!M)switch(m){case"bestFit":{var U;const K=(U=F.filter(L=>{if(R){const I=vr(L.placement);return I===T||I==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(I=>I>0).reduce((I,G)=>I+G,0)]).sort((L,I)=>L[1]-I[1])[0])==null?void 0:U[0];K&&(M=K);break}case"initialPlacement":M=u;break}if(i!==M)return{reset:{placement:M}}}return{}}}},ET=new Set(["left","top"]);async function TT(e,t){const{placement:n,platform:o,elements:i}=e,l=await(o.isRTL==null?void 0:o.isRTL(i.floating)),c=Fo(n),u=zl(n),f=vr(n)==="y",p=ET.has(c)?-1:1,h=l&&f?-1:1,b=ei(t,e);let{mainAxis:x,crossAxis:m,alignmentAxis:v}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return u&&typeof v=="number"&&(m=u==="end"?v*-1:v),f?{x:m*h,y:x*p}:{x:x*p,y:m*h}}const CT=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:l,placement:c,middlewareData:u}=t,f=await TT(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(o=u.arrow)!=null&&o.alignmentOffset?{}:{x:i+f.x,y:l+f.y,data:{...f,placement:c}}}}},RT=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:o,placement:i,platform:l}=t,{mainAxis:c=!0,crossAxis:u=!1,limiter:f={fn:T=>{let{x:$,y:_}=T;return{x:$,y:_}}},...p}=ei(e,t),h={x:n,y:o},b=await l.detectOverflow(t,p),x=vr(i),m=gk(x);let v=h[m],w=h[x];const j=(T,$)=>gT($+b[T==="y"?"top":"left"],$,$-b[T==="y"?"bottom":"right"]);c&&(v=j(m,v)),u&&(w=j(x,w));const S=f.fn({...t,[m]:v,[x]:w});return{...S,data:{x:S.x-n,y:S.y-o,enabled:{[m]:c,[x]:u}}}}}},AT=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:o,platform:i,elements:l}=t,{apply:c=()=>{},...u}=ei(e,t),f=await i.detectOverflow(t,u),p=Fo(n),h=zl(n),b=vr(n)==="y",{width:x,height:m}=o.floating;let v,w;p==="top"||p==="bottom"?(v=p,w=h===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(w=p,v=h==="end"?"top":"bottom");const j=m-f.top-f.bottom,S=x-f.left-f.right,T=Do(m-f[v],j),$=Do(x-f[w],S),_=t.middlewareData.shift,E=!_;let R=T,C=$;_!=null&&_.enabled.x&&(C=S),_!=null&&_.enabled.y&&(R=j),E&&!h&&(b?C=x-2*bs(f.left,f.right):R=m-2*bs(f.top,f.bottom)),await c({...t,availableWidth:C,availableHeight:R});const O=await i.getDimensions(l.floating);return x!==O.width||m!==O.height?{reset:{rects:!0}}:{}}}};function bk(e){const t=nr(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=uo(e),l=i?e.offsetWidth:n,c=i?e.offsetHeight:o,u=wl(n)!==l||wl(o)!==c;return u&&(n=l,o=c),{width:n,height:o,$:u}}function Lh(e){return Un(e)?e:e.contextElement}function Oa(e){const t=Lh(e);if(!uo(t))return kr(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:l}=bk(t);let c=(l?wl(n.width):n.width)/o,u=(l?wl(n.height):n.height)/i;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const OT=kr(0);function wk(e){const t=Wn(e);return!Ph()||!t.visualViewport?OT:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function MT(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===Wn(e)}function Uo(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),l=Lh(e);let c=kr(1);t&&(o?Un(o)&&(c=Oa(o)):c=Oa(e));const u=MT(l,n,o)?wk(l):kr(0);let f=(i.left+u.x)/c.x,p=(i.top+u.y)/c.y,h=i.width/c.x,b=i.height/c.y;if(l&&o){const x=Wn(l),m=Un(o)?Wn(o):o;let v=x,w=Mp(v);for(;w&&m!==v;){const j=Oa(w),S=w.getBoundingClientRect(),T=nr(w),$=S.left+(w.clientLeft+parseFloat(T.paddingLeft))*j.x,_=S.top+(w.clientTop+parseFloat(T.paddingTop))*j.y;f*=j.x,p*=j.y,h*=j.x,b*=j.y,f+=$,p+=_,v=Wn(w),w=Mp(v)}}return Fu({width:h,height:b,x:f,y:p})}function $d(e,t){const n=_d(e).scrollLeft;return t?t.left+n:Uo(jr(e)).left+n}function kk(e,t){const n=e.getBoundingClientRect(),o=n.left+t.scrollLeft-$d(e,n),i=n.top+t.scrollTop;return{x:o,y:i}}function PT(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const l=i==="fixed",c=jr(o),u=t?Sd(t.floating):!1;if(o===c||u&&l)return n;let f={scrollLeft:0,scrollTop:0},p=kr(1);const h=kr(0),b=uo(o);if((b||!l)&&((Ja(o)!=="body"||Nd(c))&&(f=_d(o)),b)){const m=Uo(o);p=Oa(o),h.x=m.x+o.clientLeft,h.y=m.y+o.clientTop}const x=c&&!b&&!l?kk(c,f):kr(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-f.scrollLeft*p.x+h.x+x.x,y:n.y*p.y-f.scrollTop*p.y+h.y+x.y}}function LT(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function IT(e){const t=_d(e),n=e.ownerDocument.body,o=bs(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=bs(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let l=-t.scrollLeft+$d(e);const c=-t.scrollTop;return nr(n).direction==="rtl"&&(l+=bs(e.clientWidth,n.clientWidth)-o),{width:o,height:i,x:l,y:c}}const zT=25;function DT(e,t,n){n===void 0&&(n="viewport");const o=n==="layoutViewport",i=Wn(e),l=jr(e),c=i.visualViewport;let u=l.clientWidth,f=l.clientHeight,p=0,h=0;if(c){const x=!Ph()||t==="fixed";o?x||(p=-c.offsetLeft,h=-c.offsetTop):(u=c.width,f=c.height,x&&(p=c.offsetLeft,h=c.offsetTop))}if($d(l)<=0){const x=l.ownerDocument,m=x.body,v=getComputedStyle(m),w=x.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,j=Math.abs(l.clientWidth-m.clientWidth-w),S=getComputedStyle(l).scrollbarGutter==="stable both-edges"?j/2:j;S<=zT&&(u-=S)}return{width:u,height:f,x:p,y:h}}function FT(e,t){const n=Uo(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,l=Oa(e),c=e.clientWidth*l.x,u=e.clientHeight*l.y,f=i*l.x,p=o*l.y;return{width:c,height:u,x:f,y:p}}function Vv(e,t,n){let o;if(t==="viewport"||t==="layoutViewport")o=DT(e,n,t);else if(t==="document")o=IT(jr(e));else if(Un(t))o=FT(t,n);else{const i=wk(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Fu(o)}function UT(e,t){const n=t.get(e);if(n)return n;let o=bl(e,[],!1).filter(u=>Un(u)&&Ja(u)!=="body"),i=null;const l=nr(e).position==="fixed";let c=l?zo(e):e;for(;Un(c)&&!vl(c);){const u=nr(c),f=Mh(c),p=i?i.position:l?"fixed":"";!f&&(p==="fixed"||p==="absolute"&&u.position==="static")?o=o.filter(b=>b!==c):i=u,c=zo(c)}return t.set(e,o),o}function WT(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e;const c=[...n==="clippingAncestors"?Sd(t)?[]:UT(t,this._c):[].concat(n),o],u=Vv(t,c[0],i);let f=u.top,p=u.right,h=u.bottom,b=u.left;for(let x=1;x<c.length;x++){const m=Vv(t,c[x],i);f=bs(m.top,f),p=Do(m.right,p),h=Do(m.bottom,h),b=bs(m.left,b)}return{width:p-b,height:h-f,x:b,y:f}}function HT(e){const{width:t,height:n}=bk(e);return{width:t,height:n}}function BT(e,t,n){const o=uo(t),i=jr(t),l=n==="fixed",c=Uo(e,!0,l,t);let u={scrollLeft:0,scrollTop:0};const f=kr(0);if((o||!l)&&((Ja(t)!=="body"||Nd(i))&&(u=_d(t)),o)){const x=Uo(t,!0,l,t);f.x=x.x+t.clientLeft,f.y=x.y+t.clientTop}!o&&i&&(f.x=$d(i));const p=i&&!o&&!l?kk(i,u):kr(0),h=c.left+u.scrollLeft-f.x-p.x,b=c.top+u.scrollTop-f.y-p.y;return{x:h,y:b,width:c.width,height:c.height}}function Xm(e){return nr(e).position==="static"}function Kv(e,t){if(!uo(e)||nr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return jr(e)===n&&(n=n.ownerDocument.body),n}function jk(e,t){const n=Wn(e);if(Sd(e))return n;if(!uo(e)){let i=zo(e);for(;i&&!vl(i);){if(Un(i)&&!Xm(i))return i;i=zo(i)}return n}let o=Kv(e,t);for(;o&&uT(o)&&Xm(o);)o=Kv(o,t);return o&&vl(o)&&Xm(o)&&!Mh(o)?n:o||mT(e)||n}const GT=async function(e){const t=this.getOffsetParent||jk,n=this.getDimensions,o=await n(e.floating);return{reference:BT(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function qT(e){return nr(e).direction==="rtl"}const VT={convertOffsetParentRelativeRectToViewportRelativeRect:PT,getDocumentElement:jr,getClippingRect:WT,getOffsetParent:jk,getElementRects:GT,getClientRects:LT,getDimensions:HT,getScale:Oa,isElement:Un,isRTL:qT};function Nk(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function KT(e,t,n){let o=null,i;const l=jr(e);function c(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function u(h,b){h===void 0&&(h=!1),b===void 0&&(b=1),c();const x=e.getBoundingClientRect(),{left:m,top:v,width:w,height:j}=x;if(h||t(),!w||!j)return;const S=au(v),T=au(l.clientWidth-(m+w)),$=au(l.clientHeight-(v+j)),_=au(m),R={rootMargin:-S+"px "+-T+"px "+-$+"px "+-_+"px",threshold:bs(0,Do(1,b))||1};let C=!0;function O(z){const F=z[0].intersectionRatio;if(!Nk(x,e.getBoundingClientRect()))return u();if(F!==b){if(!C)return u();F?u(!1,F):i=setTimeout(()=>{u(!1,1e-7)},1e3)}C=!1}try{o=new IntersectionObserver(O,{...R,root:l.ownerDocument})}catch{o=new IntersectionObserver(O,R)}o.observe(e)}const f=Wn(e),p=()=>u(n);return f.addEventListener("resize",p),u(!0),()=>{f.removeEventListener("resize",p),c()}}function XT(e,t,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=o,p=Lh(e),h=i||l?[...p?bl(p):[],...t?bl(t):[]]:[];h.forEach(S=>{i&&S.addEventListener("scroll",n),l&&S.addEventListener("resize",n)});const b=p&&u?KT(p,n,l):null;let x=-1,m=null;c&&(m=new ResizeObserver(S=>{let[T]=S;T&&T.target===p&&m&&t&&(m.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var $;($=m)==null||$.observe(t)})),n()}),p&&!f&&m.observe(p),t&&m.observe(t));let v,w=f?Uo(e):null;f&&j();function j(){const S=Uo(e);w&&!Nk(w,S)&&n(),w=S,v=requestAnimationFrame(j)}return n(),()=>{var S;h.forEach(T=>{i&&T.removeEventListener("scroll",n),l&&T.removeEventListener("resize",n)}),b==null||b(),(S=m)==null||S.disconnect(),m=null,f&&cancelAnimationFrame(v)}}const Ym=vk,YT=CT,QT=RT,ZT=$T,JT=AT,eC=(e,t,n)=>{const o=new Map,i=n??{},l={...VT,...i.platform,_c:o};return _T(e,t,{...i,platform:l})};var tC=typeof document<"u",nC=function(){},Su=tC?y.useLayoutEffect:nC;function Uu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,o,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(o=n;o--!==0;)if(!Uu(e[o],t[o]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(t,i[o]))return!1;for(o=n;o--!==0;){const l=i[o];if(!(l==="_owner"&&e.$$typeof)&&!Uu(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function Sk(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xv(e,t){const n=Sk(e);return Math.round(t*n)/n}function Qm(e){const t=y.useRef(e);return Su(()=>{t.current=e}),t}function sC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:l,floating:c}={},transform:u=!0,whileElementsMounted:f,open:p}=e,[h,b]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[x,m]=y.useState(o);Uu(x,o)||m(o);const[v,w]=y.useState(null),[j,S]=y.useState(null),T=y.useCallback(L=>{L!==R.current&&(R.current=L,w(L))},[]),$=y.useCallback(L=>{L!==C.current&&(C.current=L,S(L))},[]),_=l||v,E=c||j,R=y.useRef(null),C=y.useRef(null),O=y.useRef(h),z=f!=null,F=Qm(f),D=Qm(i),B=Qm(p),U=y.useCallback(()=>{if(!R.current||!C.current)return;const L={placement:t,strategy:n,middleware:x};D.current&&(L.platform=D.current),eC(R.current,C.current,L).then(I=>{const G={...I,isPositioned:B.current!==!1};W.current&&!Uu(O.current,G)&&(O.current=G,tr.flushSync(()=>{b(G)}))})},[x,t,n,D,B]);Su(()=>{p===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,b(L=>({...L,isPositioned:!1})))},[p]);const W=y.useRef(!1);Su(()=>(W.current=!0,()=>{W.current=!1}),[]),Su(()=>{if(_&&(R.current=_),E&&(C.current=E),_&&E){if(F.current)return F.current(_,E,U);U()}},[_,E,U,F,z]);const X=y.useMemo(()=>({reference:R,floating:C,setReference:T,setFloating:$}),[T,$]),M=y.useMemo(()=>({reference:_,floating:E}),[_,E]),K=y.useMemo(()=>{const L={position:n,left:0,top:0};if(!M.floating)return L;const I=Xv(M.floating,h.x),G=Xv(M.floating,h.y);return u?{...L,transform:"translate("+I+"px, "+G+"px)",...Sk(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:G}},[n,u,M.floating,h.x,h.y]);return y.useMemo(()=>({...h,update:U,refs:X,elements:M,floatingStyles:K}),[h,U,X,M,K])}const _k=(e,t)=>{const n=YT(e);return{name:n.name,fn:n.fn,options:[e,t]}},rC=(e,t)=>{const n=QT(e);return{name:n.name,fn:n.fn,options:[e,t]}},oC=(e,t)=>{const n=ZT(e);return{name:n.name,fn:n.fn,options:[e,t]}},aC=(e,t)=>{const n=JT(e);return{name:n.name,fn:n.fn,options:[e,t]}},$k={...kp},iC=$k.useInsertionEffect,lC=iC||(e=>e());function Ek(e){const t=y.useRef(()=>{});return lC(()=>{t.current=e}),y.useCallback(function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return t.current==null?void 0:t.current(...o)},[])}var Lp=typeof document<"u"?y.useLayoutEffect:y.useEffect;let Yv=!1,cC=0;const Qv=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+cC++;function uC(){const[e,t]=y.useState(()=>Yv?Qv():void 0);return Lp(()=>{e==null&&t(Qv())},[]),y.useEffect(()=>{Yv=!0},[]),e}const dC=$k.useId,fC=dC||uC;function mC(){const e=new Map;return{emit(t,n){var o;(o=e.get(t))==null||o.forEach(i=>i(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var o;e.set(t,((o=e.get(t))==null?void 0:o.filter(i=>i!==n))||[])}}}const pC=y.createContext(null),hC=y.createContext(null),gC=()=>{var e;return((e=y.useContext(pC))==null?void 0:e.id)||null},xC=()=>y.useContext(hC),yC="data-floating-ui-focusable";function vC(e){const{open:t=!1,onOpenChange:n,elements:o}=e,i=fC(),l=y.useRef({}),[c]=y.useState(()=>mC()),u=gC()!=null,[f,p]=y.useState(o.reference),h=Ek((m,v,w)=>{l.current.openEvent=m?v:void 0,c.emit("openchange",{open:m,event:v,reason:w,nested:u}),n==null||n(m,v,w)}),b=y.useMemo(()=>({setPositionReference:p}),[]),x=y.useMemo(()=>({reference:f||o.reference||null,floating:o.floating||null,domReference:o.reference}),[f,o.reference,o.floating]);return y.useMemo(()=>({dataRef:l,open:t,onOpenChange:h,elements:x,events:c,floatingId:i,refs:b}),[t,h,x,c,i,b])}function bC(e){e===void 0&&(e={});const{nodeId:t}=e,n=vC({...e,elements:{reference:null,floating:null,...e.elements}}),o=e.rootContext||n,i=o.elements,[l,c]=y.useState(null),[u,f]=y.useState(null),h=(i==null?void 0:i.domReference)||l,b=y.useRef(null),x=xC();Lp(()=>{h&&(b.current=h)},[h]);const m=sC({...e,elements:{...i,...u&&{reference:u}}}),v=y.useCallback($=>{const _=Un($)?{getBoundingClientRect:()=>$.getBoundingClientRect(),contextElement:$}:$;f(_),m.refs.setReference(_)},[m.refs]),w=y.useCallback($=>{(Un($)||$===null)&&(b.current=$,c($)),(Un(m.refs.reference.current)||m.refs.reference.current===null||$!==null&&!Un($))&&m.refs.setReference($)},[m.refs]),j=y.useMemo(()=>({...m.refs,setReference:w,setPositionReference:v,domReference:b}),[m.refs,w,v]),S=y.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),T=y.useMemo(()=>({...m,...o,refs:j,elements:S,nodeId:t}),[m,j,S,t,o]);return Lp(()=>{o.dataRef.current.floatingContext=T;const $=x==null?void 0:x.nodesRef.current.find(_=>_.id===t);$&&($.context=T)}),y.useMemo(()=>({...m,context:T,refs:j,elements:S}),[m,j,S,T])}const Zv="active",Jv="selected";function Zm(e,t,n){const o=new Map,i=n==="item";let l=e;if(i&&e){const{[Zv]:c,[Jv]:u,...f}=e;l=f}return{...n==="floating"&&{tabIndex:-1,[yC]:""},...l,...t.map(c=>{const u=c?c[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((c,u)=>(u&&Object.entries(u).forEach(f=>{let[p,h]=f;if(!(i&&[Zv,Jv].includes(p)))if(p.indexOf("on")===0){if(o.has(p)||o.set(p,[]),typeof h=="function"){var b;(b=o.get(p))==null||b.push(h),c[p]=function(){for(var x,m=arguments.length,v=new Array(m),w=0;w<m;w++)v[w]=arguments[w];return(x=o.get(p))==null?void 0:x.map(j=>j(...v)).find(j=>j!==void 0)}}}else c[p]=h}),c),{})}}function wC(e){e===void 0&&(e=[]);const t=e.map(u=>u==null?void 0:u.reference),n=e.map(u=>u==null?void 0:u.floating),o=e.map(u=>u==null?void 0:u.item),i=y.useCallback(u=>Zm(u,e,"reference"),t),l=y.useCallback(u=>Zm(u,e,"floating"),n),c=y.useCallback(u=>Zm(u,e,"item"),o);return y.useMemo(()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c}),[i,l,c])}function eb(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const kC=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:o,onFallbackChange:i,offset:l=0,index:c=0,minItemsVisible:u=4,referenceOverflowThreshold:f=0,scrollRef:p,...h}=ei(e,t),{rects:b,elements:{floating:x}}=t,m=n.current[c],v=(p==null?void 0:p.current)||x,w=x.clientTop||v.clientTop,j=x.clientTop!==0,S=v.clientTop!==0,T=x===v;if(!m)return{};const $={...t,...await _k(-m.offsetTop-x.clientTop-b.reference.height/2-m.offsetHeight/2-l).fn(t)},_=await Ym(eb($,v.scrollHeight+w+x.clientTop),h),E=await Ym($,{...h,elementContext:"reference"}),R=bs(0,_.top),C=$.y+R,F=(v.scrollHeight>v.clientHeight?D=>D:wl)(bs(0,v.scrollHeight+(j&&T||S?w*2:0)-R-bs(0,_.bottom)));if(v.style.maxHeight=F+"px",v.scrollTop=R,i){const D=v.offsetHeight<m.offsetHeight*Do(u,n.current.length)-1||E.top>=-f||E.bottom>=-f;tr.flushSync(()=>i(D))}return o&&(o.current=await Ym(eb({...$,y:C},v.offsetHeight+w+x.clientTop),h)),{y:C}}});function jC(e,t){const{open:n,elements:o}=e,{enabled:i=!0,overflowRef:l,scrollRef:c,onChange:u}=t,f=Ek(u),p=y.useRef(!1),h=y.useRef(null),b=y.useRef(null);y.useEffect(()=>{if(!i)return;function m(w){if(w.ctrlKey||!v||l.current==null)return;const j=w.deltaY,S=l.current.top>=-.5,T=l.current.bottom>=-.5,$=v.scrollHeight-v.clientHeight,_=j<0?-1:1,E=j<0?"max":"min";v.scrollHeight<=v.clientHeight||(!S&&j>0||!T&&j<0?(w.preventDefault(),tr.flushSync(()=>{f(R=>R+Math[E](j,$*_))})):/firefox/i.test(pT())&&(v.scrollTop+=j))}const v=(c==null?void 0:c.current)||o.floating;if(n&&v)return v.addEventListener("wheel",m),requestAnimationFrame(()=>{h.current=v.scrollTop,l.current!=null&&(b.current={...l.current})}),()=>{h.current=null,b.current=null,v.removeEventListener("wheel",m)}},[i,n,o.floating,l,c,f]);const x=y.useMemo(()=>({onKeyDown(){p.current=!0},onWheel(){p.current=!1},onPointerMove(){p.current=!1},onScroll(){const m=(c==null?void 0:c.current)||o.floating;if(!(!l.current||!m||!p.current)){if(h.current!==null){const v=m.scrollTop-h.current;(l.current.bottom<-.5&&v<-1||l.current.top<-.5&&v>1)&&tr.flushSync(()=>f(w=>w+v))}requestAnimationFrame(()=>{h.current=m.scrollTop})}}}),[o.floating,f,l,c]);return y.useMemo(()=>i?{floating:x}:{},[i,x])}let ti=y.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});ti.displayName="FloatingContext";let Ih=y.createContext(null);Ih.displayName="PlacementContext";function NC(e){return y.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function SC(){return y.useContext(ti).setReference}function _C(){return y.useContext(ti).getReferenceProps}function $C(){let{getFloatingProps:e,slot:t}=y.useContext(ti);return y.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function EC(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=y.useContext(Ih),n=y.useMemo(()=>e,[JSON.stringify(e,(i,l)=>{var c;return(c=l==null?void 0:l.outerHTML)!=null?c:l})]);Nt(()=>{t==null||t(n??null)},[t,n]);let o=y.useContext(ti);return y.useMemo(()=>[o.setFloating,e?o.styles:{}],[o.setFloating,e,o.styles])}let tb=4;function TC({children:e,enabled:t=!0}){let[n,o]=y.useState(null),[i,l]=y.useState(0),c=y.useRef(null),[u,f]=y.useState(null);CC(u);let p=t&&n!==null&&u!==null,{to:h="bottom",gap:b=0,offset:x=0,padding:m=0,inner:v}=RC(n,u),[w,j="center"]=h.split(" ");Nt(()=>{p&&l(0)},[p]);let{refs:S,floatingStyles:T,context:$}=bC({open:p,placement:w==="selection"?j==="center"?"bottom":`bottom-${j}`:j==="center"?`${w}`:`${w}-${j}`,strategy:"absolute",transform:!1,middleware:[_k({mainAxis:w==="selection"?0:b,crossAxis:x}),rC({padding:m}),w!=="selection"&&oC({padding:m}),w==="selection"&&v?kC({...v,padding:m,overflowRef:c,offset:i,minItemsVisible:tb,referenceOverflowThreshold:m,onFallbackChange(D){var B,U;if(!D)return;let W=$.elements.floating;if(!W)return;let X=parseFloat(getComputedStyle(W).scrollPaddingBottom)||0,M=Math.min(tb,W.childElementCount),K=0,L=0;for(let I of(U=(B=$.elements.floating)==null?void 0:B.childNodes)!=null?U:[])if(es(I)){let G=I.offsetTop,P=G+I.clientHeight+X,q=W.scrollTop,ne=q+W.clientHeight;if(G>=q&&P<=ne)M--;else{L=Math.max(0,Math.min(P,ne)-Math.max(G,q)),K=I.clientHeight;break}}M>=1&&l(I=>{let G=K*M-L+X;return I>=G?I:G})}}):null,aC({padding:m,apply({availableWidth:D,availableHeight:B,elements:U}){Object.assign(U.floating.style,{overflow:"auto",maxWidth:`${D}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${B}px)`})}})].filter(Boolean),whileElementsMounted:XT}),[_=w,E=j]=$.placement.split("-");w==="selection"&&(_="selection");let R=y.useMemo(()=>({anchor:[_,E].filter(Boolean).join(" ")}),[_,E]),C=jC($,{overflowRef:c,onChange:l}),{getReferenceProps:O,getFloatingProps:z}=wC([C]),F=Ue(D=>{f(D),S.setFloating(D)});return y.createElement(Ih.Provider,{value:o},y.createElement(ti.Provider,{value:{setFloating:F,setReference:S.setReference,styles:T,getReferenceProps:O,getFloatingProps:z,slot:R}},e))}function CC(e){Nt(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,o=parseFloat(n);if(isNaN(o))return;let i=parseInt(n);isNaN(i)||o!==i&&(e.style.maxHeight=`${Math.ceil(o)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function RC(e,t){var n,o,i;let l=Jm((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),c=Jm((o=e==null?void 0:e.offset)!=null?o:"var(--anchor-offset, 0)",t),u=Jm((i=e==null?void 0:e.padding)!=null?i:"var(--anchor-padding, 0)",t);return{...e,gap:l,offset:c,padding:u}}function Jm(e,t,n=void 0){let o=lo(),i=Ue((f,p)=>{if(f==null)return[n,null];if(typeof f=="number")return[f,null];if(typeof f=="string"){if(!p)return[n,null];let h=nb(f,p);return[h,b=>{let x=Tk(f);{let m=x.map(v=>window.getComputedStyle(p).getPropertyValue(v));o.requestAnimationFrame(function v(){o.nextFrame(v);let w=!1;for(let[S,T]of x.entries()){let $=window.getComputedStyle(p).getPropertyValue(T);if(m[S]!==$){m[S]=$,w=!0;break}}if(!w)return;let j=nb(f,p);h!==j&&(b(j),h=j)})}return o.dispose}]}return[n,null]}),l=y.useMemo(()=>i(e,t)[0],[e,t]),[c=l,u]=y.useState();return Nt(()=>{let[f,p]=i(e,t);if(u(f),!!p)return p(u)},[e,t]),c}function Tk(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let o=t[1].slice(0,n).trim(),i=t[1].slice(n+1).trim();return i?[o,...Tk(i)]:[o]}return[]}function nb(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let o=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),o}function AC({children:e,freeze:t},n){let o=Ck(t,e);return y.isValidElement(o)?y.cloneElement(o,{ref:n}):je.createElement(je.Fragment,null,o)}je.forwardRef(AC);function Ck(e,t){let[n,o]=y.useState(t);return!e&&n!==t&&o(t),e?n:t}let Ed=y.createContext(null);Ed.displayName="OpenClosedContext";var kn=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(kn||{});function Dl(){return y.useContext(Ed)}function Rk({value:e,children:t}){return je.createElement(Ed.Provider,{value:e},t)}function OC({children:e}){return je.createElement(Ed.Provider,{value:null},e)}function MC(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Yr=[];MC(()=>{function e(t){if(!yr(t.target)||t.target===document.body||Yr[0]===t.target)return;let n=t.target;n=n.closest(zu),Yr.unshift(n??t.target),Yr=Yr.filter(o=>o!=null&&o.isConnected),Yr.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function PC(e){throw new Error("Unexpected object: "+e)}var Tt=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(Tt||{});function iu(e,t){let n=t.resolveItems();if(n.length<=0)return null;let o=t.resolveActiveIndex(),i=o??-1;switch(e.focus){case 0:{for(let l=0;l<n.length;++l)if(!t.resolveDisabled(n[l],l,n))return l;return o}case 1:{i===-1&&(i=n.length);for(let l=i-1;l>=0;--l)if(!t.resolveDisabled(n[l],l,n))return l;return o}case 2:{for(let l=i+1;l<n.length;++l)if(!t.resolveDisabled(n[l],l,n))return l;return o}case 3:{for(let l=n.length-1;l>=0;--l)if(!t.resolveDisabled(n[l],l,n))return l;return o}case 4:{for(let l=0;l<n.length;++l)if(t.resolveId(n[l],l,n)===e.id)return l;return o}case 5:return null;default:PC(e)}}function zh(e){let t=Ue(e),n=y.useRef(!1);y.useEffect(()=>(n.current=!1,()=>{n.current=!0,vd(()=>{n.current&&t()})}),[t])}function LC(){let e=typeof document>"u";return"useSyncExternalStore"in kp?(t=>t.useSyncExternalStore)(kp)(()=>()=>{},()=>!1,()=>!e):!1}function Fl(){let e=LC(),[t,n]=y.useState(Zs.isHandoffComplete);return t&&Zs.isHandoffComplete===!1&&n(!1),y.useEffect(()=>{t!==!0&&n(!0)},[t]),y.useEffect(()=>Zs.handoff(),[]),e?!1:t}let Ak=y.createContext(!1);function IC(){return y.useContext(Ak)}function sb(e){return je.createElement(Ak.Provider,{value:e.force},e.children)}function zC(e){let t=IC(),n=y.useContext(Mk),[o,i]=y.useState(()=>{var l;if(!t&&n!==null)return(l=n.current)!=null?l:null;if(Zs.isServer)return null;let c=e==null?void 0:e.getElementById("headlessui-portal-root");if(c)return c;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});return y.useEffect(()=>{o!==null&&(e!=null&&e.body.contains(o)||e==null||e.body.appendChild(o))},[o,e]),y.useEffect(()=>{t||n!==null&&i(n.current)},[n,i,t]),o}let Ok=y.Fragment,DC=Lt(function(e,t){let{ownerDocument:n=null,...o}=e,i=y.useRef(null),l=pn(uE(m=>{i.current=m}),t),c=yl(i.current),u=n??c,f=zC(u),p=y.useContext(Ip),h=lo(),b=Fl(),x=Xt();return zh(()=>{var m;f&&f.childNodes.length<=0&&((m=f.parentElement)==null||m.removeChild(f))}),!f||!b?null:tr.createPortal(je.createElement("div",{"data-headlessui-portal":"",ref:m=>{h.dispose(),p&&m&&h.add(p.register(m))}},x({ourProps:{ref:l},theirProps:o,slot:{},defaultTag:Ok,name:"Portal"})),f)});function FC(e,t){let n=pn(t),{enabled:o=!0,ownerDocument:i,...l}=e,c=Xt();return o?je.createElement(DC,{...l,ownerDocument:i,ref:n}):c({ourProps:{ref:n},theirProps:l,slot:{},defaultTag:Ok,name:"Portal"})}let UC=y.Fragment,Mk=y.createContext(null);function WC(e,t){let{target:n,...o}=e,i={ref:pn(t)},l=Xt();return je.createElement(Mk.Provider,{value:n},l({ourProps:i,theirProps:o,defaultTag:UC,name:"Popover.Group"}))}let Ip=y.createContext(null);function HC(){let e=y.useContext(Ip),t=y.useRef([]),n=Ue(l=>(t.current.push(l),e&&e.register(l),()=>o(l))),o=Ue(l=>{let c=t.current.indexOf(l);c!==-1&&t.current.splice(c,1),e&&e.unregister(l)}),i=y.useMemo(()=>({register:n,unregister:o,portals:t}),[n,o,t]);return[t,y.useMemo(()=>function({children:l}){return je.createElement(Ip.Provider,{value:i},l)},[i])]}let BC=Lt(FC),Pk=Lt(WC),Lk=Object.assign(BC,{Group:Pk});const _u={Idle:{kind:"Idle"},Tracked:e=>({kind:"Tracked",position:e}),Moved:{kind:"Moved"}};function Ik(e){let t=e.getBoundingClientRect();return`${t.x},${t.y}`}function GC(e,t,n){let o=rs();if(t.kind==="Tracked"){let i=function(){l!==Ik(e)&&(o.dispose(),n())},{position:l}=t,c=new ResizeObserver(i);c.observe(e),o.add(()=>c.disconnect()),o.addEventListener(window,"scroll",i,{passive:!0}),o.addEventListener(window,"resize",i)}return()=>o.dispose()}function qC(e,t=typeof document<"u"?document.defaultView:null,n){let o=Il(e,"escape");uk(t,"keydown",i=>{o&&(i.defaultPrevented||i.key===Wt.Escape&&n(i))})}function VC(){var e;let[t]=y.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,o]=y.useState((e=t==null?void 0:t.matches)!=null?e:!1);return Nt(()=>{if(!t)return;function i(l){o(l.matches)}return t.addEventListener("change",i),()=>t.removeEventListener("change",i)},[t]),n}function KC({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let o=Ue(()=>{var i,l;let c=Za(n),u=[];for(let f of e)f!==null&&(br(f)?u.push(f):"current"in f&&br(f.current)&&u.push(f.current));if(t!=null&&t.current)for(let f of t.current)u.push(f);for(let f of(i=c==null?void 0:c.querySelectorAll("html > *, body > *"))!=null?i:[])f!==document.body&&f!==document.head&&br(f)&&f.id!=="headlessui-portal-root"&&(n&&(f.contains(n)||f.contains((l=n==null?void 0:n.getRootNode())==null?void 0:l.host))||u.some(p=>f.contains(p))||u.push(f));return u});return{resolveContainers:o,contains:Ue(i=>o().some(l=>l.contains(i)))}}let zk=y.createContext(null);function rb({children:e,node:t}){let[n,o]=y.useState(null),i=Dk(t??n);return je.createElement(zk.Provider,{value:i},e,i===null&&je.createElement(xl,{features:Wa.Hidden,ref:l=>{var c,u;if(l){for(let f of(u=(c=Za(l))==null?void 0:c.querySelectorAll("html > *, body > *"))!=null?u:[])if(f!==document.body&&f!==document.head&&br(f)&&f!=null&&f.contains(l)){o(f);break}}}}))}function Dk(e=null){var t;return(t=y.useContext(zk))!=null?t:e}function Dh(){let e=y.useRef(!1);return Nt(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var sl=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(sl||{});function XC(){let e=y.useRef(0);return lk(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function Fk(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)br(n.current)&&t.add(n.current);return t}let YC="div";var Co=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(Co||{});function QC(e,t){let n=y.useRef(null),o=pn(n,t),{initialFocus:i,initialFocusFallback:l,containers:c,features:u=15,...f}=e;Fl()||(u=0);let p=yl(n.current);tR(u,{ownerDocument:p});let h=nR(u,{ownerDocument:p,container:n,initialFocus:i,initialFocusFallback:l});sR(u,{ownerDocument:p,container:n,containers:c,previousActiveElement:h});let b=XC(),x=Ue(T=>{if(!es(n.current))return;let $=n.current;(_=>_())(()=>{Sn(b.current,{[sl.Forwards]:()=>{Aa($,Is.First,{skipElements:[T.relatedTarget,l]})},[sl.Backwards]:()=>{Aa($,Is.Last,{skipElements:[T.relatedTarget,l]})}})})}),m=Il(!!(u&2),"focus-trap#tab-lock"),v=lo(),w=y.useRef(!1),j={ref:o,onKeyDown(T){T.key=="Tab"&&(w.current=!0,v.requestAnimationFrame(()=>{w.current=!1}))},onBlur(T){if(!(u&4))return;let $=Fk(c);es(n.current)&&$.add(n.current);let _=T.relatedTarget;yr(_)&&_.dataset.headlessuiFocusGuard!=="true"&&(Uk($,_)||(w.current?Aa(n.current,Sn(b.current,{[sl.Forwards]:()=>Is.Next,[sl.Backwards]:()=>Is.Previous})|Is.WrapAround,{relativeTo:T.target}):yr(T.target)&&wr(T.target)))}},S=Xt();return je.createElement(je.Fragment,null,m&&je.createElement(xl,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:Wa.Focusable}),S({ourProps:j,theirProps:f,defaultTag:YC,name:"FocusTrap"}),m&&je.createElement(xl,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:x,features:Wa.Focusable}))}let ZC=Lt(QC),JC=Object.assign(ZC,{features:Co});function eR(e=!0){let t=y.useRef(Yr.slice());return Oh(([n],[o])=>{o===!0&&n===!1&&vd(()=>{t.current.splice(0)}),o===!1&&n===!0&&(t.current=Yr.slice())},[e,Yr,t]),Ue(()=>{var n;return(n=t.current.find(o=>o!=null&&o.isConnected))!=null?n:null})}function tR(e,{ownerDocument:t}){let n=!!(e&8),o=eR(n);Oh(()=>{n||O0(t==null?void 0:t.body)&&wr(o())},[n]),zh(()=>{n&&wr(o())})}function nR(e,{ownerDocument:t,container:n,initialFocus:o,initialFocusFallback:i}){let l=y.useRef(null),c=Il(!!(e&1),"focus-trap#initial-focus"),u=Dh();return Oh(()=>{if(e===0)return;if(!c){i!=null&&i.current&&wr(i.current);return}let f=n.current;f&&vd(()=>{if(!u.current)return;let p=t==null?void 0:t.activeElement;if(o!=null&&o.current){if((o==null?void 0:o.current)===p){l.current=p;return}}else if(f.contains(p)){l.current=p;return}if(o!=null&&o.current)wr(o.current);else{if(e&16){if(Aa(f,Is.First|Is.AutoFocus)!==Op.Error)return}else if(Aa(f,Is.First)!==Op.Error)return;if(i!=null&&i.current&&(wr(i.current),(t==null?void 0:t.activeElement)===i.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}l.current=t==null?void 0:t.activeElement})},[i,c,e]),l}function sR(e,{ownerDocument:t,container:n,containers:o,previousActiveElement:i}){let l=Dh(),c=!!(e&4);uk(t==null?void 0:t.defaultView,"focus",u=>{if(!c||!l.current)return;let f=Fk(o);es(n.current)&&f.add(n.current);let p=i.current;if(!p)return;let h=u.target;es(h)?Uk(f,h)?(i.current=h,wr(h)):(u.preventDefault(),u.stopPropagation(),wr(p)):wr(i.current)},!0)}function Uk(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function Wk(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||!il((t=e.as)!=null?t:Bk)||je.Children.count(e.children)===1}let Td=y.createContext(null);Td.displayName="TransitionContext";var rR=(e=>(e.Visible="visible",e.Hidden="hidden",e))(rR||{});function oR(){let e=y.useContext(Td);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function aR(){let e=y.useContext(Cd);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Cd=y.createContext(null);Cd.displayName="NestingContext";function Rd(e){return"children"in e?Rd(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Hk(e,t){let n=co(e),o=y.useRef([]),i=Dh(),l=lo(),c=Ue((m,v=Zr.Hidden)=>{let w=o.current.findIndex(({el:j})=>j===m);w!==-1&&(Sn(v,{[Zr.Unmount](){o.current.splice(w,1)},[Zr.Hidden](){o.current[w].state="hidden"}}),l.microTask(()=>{var j;!Rd(o)&&i.current&&((j=n.current)==null||j.call(n))}))}),u=Ue(m=>{let v=o.current.find(({el:w})=>w===m);return v?v.state!=="visible"&&(v.state="visible"):o.current.push({el:m,state:"visible"}),()=>c(m,Zr.Unmount)}),f=y.useRef([]),p=y.useRef(Promise.resolve()),h=y.useRef({enter:[],leave:[]}),b=Ue((m,v,w)=>{f.current.splice(0),t&&(t.chains.current[v]=t.chains.current[v].filter(([j])=>j!==m)),t==null||t.chains.current[v].push([m,new Promise(j=>{f.current.push(j)})]),t==null||t.chains.current[v].push([m,new Promise(j=>{Promise.all(h.current[v].map(([S,T])=>T)).then(()=>j())})]),v==="enter"?p.current=p.current.then(()=>t==null?void 0:t.wait.current).then(()=>w(v)):w(v)}),x=Ue((m,v,w)=>{Promise.all(h.current[v].splice(0).map(([j,S])=>S)).then(()=>{var j;(j=f.current.shift())==null||j()}).then(()=>w(v))});return y.useMemo(()=>({children:o,register:u,unregister:c,onStart:b,onStop:x,wait:p,chains:h}),[u,c,o,b,x,h,p])}let Bk=y.Fragment,Gk=Ua.RenderStrategy;function iR(e,t){var n,o;let{transition:i=!0,beforeEnter:l,afterEnter:c,beforeLeave:u,afterLeave:f,enter:p,enterFrom:h,enterTo:b,entered:x,leave:m,leaveFrom:v,leaveTo:w,...j}=e,[S,T]=y.useState(null),$=y.useRef(null),_=Wk(e),E=pn(..._?[$,t,T]:t===null?[]:[t]),R=(n=j.unmount)==null||n?Zr.Unmount:Zr.Hidden,{show:C,appear:O,initial:z}=oR(),[F,D]=y.useState(C?"visible":"hidden"),B=aR(),{register:U,unregister:W}=B;Nt(()=>U($),[U,$]),Nt(()=>{if(R===Zr.Hidden&&$.current){if(C&&F!=="visible"){D("visible");return}return Sn(F,{hidden:()=>W($),visible:()=>U($)})}},[F,$,U,W,C,R]);let X=Fl();Nt(()=>{if(_&&X&&F==="visible"&&$.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[$,F,X,_]);let M=z&&!O,K=O&&C&&z,L=y.useRef(!1),I=Hk(()=>{L.current||(D("hidden"),W($))},B),G=Ue(le=>{L.current=!0;let ye=le?"enter":"leave";I.onStart($,ye,ee=>{ee==="enter"?l==null||l():ee==="leave"&&(u==null||u())})}),P=Ue(le=>{let ye=le?"enter":"leave";L.current=!1,I.onStop($,ye,ee=>{ee==="enter"?c==null||c():ee==="leave"&&(f==null||f())}),ye==="leave"&&!Rd(I)&&(D("hidden"),W($))});y.useEffect(()=>{_&&i||(G(C),P(C))},[C,_,i]);let q=!(!i||!_||!X||M),[,ne]=mk(q,S,C,{start:G,end:P}),ae=Xr({ref:E,className:((o=Rp(j.className,K&&p,K&&h,ne.enter&&p,ne.enter&&ne.closed&&h,ne.enter&&!ne.closed&&b,ne.leave&&m,ne.leave&&!ne.closed&&v,ne.leave&&ne.closed&&w,!ne.transition&&C&&x))==null?void 0:o.trim())||void 0,...fk(ne)}),ie=0;F==="visible"&&(ie|=kn.Open),F==="hidden"&&(ie|=kn.Closed),C&&F==="hidden"&&(ie|=kn.Opening),!C&&F==="visible"&&(ie|=kn.Closing);let ce=Xt();return je.createElement(Cd.Provider,{value:I},je.createElement(Rk,{value:ie},ce({ourProps:ae,theirProps:j,defaultTag:Bk,features:Gk,visible:F==="visible",name:"Transition.Child"})))}function lR(e,t){let{show:n,appear:o=!1,unmount:i=!0,...l}=e,c=y.useRef(null),u=Wk(e),f=pn(...u?[c,t]:t===null?[]:[t]);Fl();let p=Dl();if(n===void 0&&p!==null&&(n=(p&kn.Open)===kn.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[h,b]=y.useState(n?"visible":"hidden"),x=Hk(()=>{n||b("hidden")}),[m,v]=y.useState(!0),w=y.useRef([n]);Nt(()=>{m!==!1&&w.current[w.current.length-1]!==n&&(w.current.push(n),v(!1))},[w,n]);let j=y.useMemo(()=>({show:n,appear:o,initial:m}),[n,o,m]);Nt(()=>{n?b("visible"):!Rd(x)&&c.current!==null&&b("hidden")},[n,x]);let S={unmount:i},T=Ue(()=>{var E;m&&v(!1),(E=e.beforeEnter)==null||E.call(e)}),$=Ue(()=>{var E;m&&v(!1),(E=e.beforeLeave)==null||E.call(e)}),_=Xt();return je.createElement(Cd.Provider,{value:x},je.createElement(Td.Provider,{value:j},_({ourProps:{...S,as:y.Fragment,children:je.createElement(qk,{ref:f,...S,...l,beforeEnter:T,beforeLeave:$})},theirProps:{},defaultTag:y.Fragment,features:Gk,visible:h==="visible",name:"Transition"})))}function cR(e,t){let n=y.useContext(Td)!==null,o=Dl()!==null;return je.createElement(je.Fragment,null,!n&&o?je.createElement(zp,{ref:t,...e}):je.createElement(qk,{ref:t,...e}))}let zp=Lt(lR),qk=Lt(iR),Fh=Lt(cR),uR=Object.assign(zp,{Child:Fh,Root:zp});var dR=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(dR||{}),fR=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(fR||{});let mR={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Uh=y.createContext(null);Uh.displayName="DialogContext";function Ad(e){let t=y.useContext(Uh);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ad),n}return t}function pR(e,t){return Sn(t.type,mR,e,t)}let ob=Lt(function(e,t){let n=y.useId(),{id:o=`headlessui-dialog-${n}`,open:i,onClose:l,initialFocus:c,role:u="dialog",autoFocus:f=!0,__demoMode:p=!1,unmount:h=!1,...b}=e,x=y.useRef(!1);u=(function(){return u==="dialog"||u==="alertdialog"?u:(x.current||(x.current=!0,console.warn(`Invalid role [${u}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let m=Dl();i===void 0&&m!==null&&(i=(m&kn.Open)===kn.Open);let v=y.useRef(null),w=pn(v,t),j=yl(v.current),S=i?0:1,[T,$]=y.useReducer(pR,{titleId:null,descriptionId:null,panelRef:y.createRef()}),_=Ue(()=>l(!1)),E=Ue(ne=>$({type:0,id:ne})),R=Fl()?S===0:!1,[C,O]=HC(),z={get current(){var ne;return(ne=T.panelRef.current)!=null?ne:v.current}},F=Dk(),{resolveContainers:D}=KC({mainTreeNode:F,portals:C,defaultContainers:[z]}),B=m!==null?(m&kn.Closing)===kn.Closing:!1;nk(p||B?!1:R,{allowed:Ue(()=>{var ne,ae;return[(ae=(ne=v.current)==null?void 0:ne.closest("[data-headlessui-portal]"))!=null?ae:null]}),disallowed:Ue(()=>{var ne;return[(ne=F==null?void 0:F.closest("body > *:not(#headlessui-portal-root)"))!=null?ne:null]})});let U=kd.get(null);Nt(()=>{if(R)return U.actions.push(o),()=>U.actions.pop(o)},[U,o,R]);let W=bn(U,y.useCallback(ne=>U.selectors.isTop(ne,o),[U,o]));ck(W,D,ne=>{ne.preventDefault(),_()}),qC(W,j==null?void 0:j.defaultView,ne=>{ne.preventDefault(),ne.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),_()}),dk(p||B?!1:R,j,D),sk(R,v,_);let[X,M]=fE(),K=y.useMemo(()=>[{dialogState:S,close:_,setTitleId:E,unmount:h},T],[S,_,E,h,T]),L=js({open:S===0}),I={ref:w,id:o,role:u,tabIndex:-1,"aria-modal":p?void 0:S===0?!0:void 0,"aria-labelledby":T.titleId,"aria-describedby":X,unmount:h},G=!VC(),P=Co.None;R&&!p&&(P|=Co.RestoreFocus,P|=Co.TabLock,f&&(P|=Co.AutoFocus),G&&(P|=Co.InitialFocus));let q=Xt();return je.createElement(OC,null,je.createElement(sb,{force:!0},je.createElement(Lk,null,je.createElement(Uh.Provider,{value:K},je.createElement(Pk,{target:v},je.createElement(sb,{force:!1},je.createElement(M,{slot:L},je.createElement(O,null,je.createElement(JC,{initialFocus:c,initialFocusFallback:v,containers:D,features:P},je.createElement(kE,{value:_},q({ourProps:I,theirProps:b,slot:L,defaultTag:hR,features:gR,visible:S===0,name:"Dialog"})))))))))))}),hR="div",gR=Ua.RenderStrategy|Ua.Static;function xR(e,t){let{transition:n=!1,open:o,...i}=e,l=Dl(),c=e.hasOwnProperty("open")||l!==null,u=e.hasOwnProperty("onClose");if(!c&&!u)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!c)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!u)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!l&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(o!==void 0||n)&&!i.static?je.createElement(rb,null,je.createElement(uR,{show:o,transition:n,unmount:i.unmount},je.createElement(ob,{ref:t,...i}))):je.createElement(rb,null,je.createElement(ob,{ref:t,open:o,...i}))}let yR="div";function vR(e,t){let n=y.useId(),{id:o=`headlessui-dialog-panel-${n}`,transition:i=!1,...l}=e,[{dialogState:c,unmount:u},f]=Ad("Dialog.Panel"),p=pn(t,f.panelRef),h=js({open:c===0}),b=Ue(j=>{j.stopPropagation()}),x={ref:p,id:o,onClick:b},m=i?Fh:y.Fragment,v=i?{unmount:u}:{},w=Xt();return je.createElement(m,{...v},w({ourProps:x,theirProps:l,slot:h,defaultTag:yR,name:"Dialog.Panel"}))}let bR="div";function wR(e,t){let{transition:n=!1,...o}=e,[{dialogState:i,unmount:l}]=Ad("Dialog.Backdrop"),c=js({open:i===0}),u={ref:t,"aria-hidden":!0},f=n?Fh:y.Fragment,p=n?{unmount:l}:{},h=Xt();return je.createElement(f,{...p},h({ourProps:u,theirProps:o,slot:c,defaultTag:bR,name:"Dialog.Backdrop"}))}let kR="h2";function jR(e,t){let n=y.useId(),{id:o=`headlessui-dialog-title-${n}`,...i}=e,[{dialogState:l,setTitleId:c}]=Ad("Dialog.Title"),u=pn(t);y.useEffect(()=>(c(o),()=>c(null)),[o,c]);let f=js({open:l===0}),p={ref:u,id:o};return Xt()({ourProps:p,theirProps:i,slot:f,defaultTag:kR,name:"Dialog.Title"})}let NR=Lt(xR),Vk=Lt(vR),SR=Lt(wR),Kk=Lt(jR),_R=Object.assign(NR,{Panel:Vk,Title:Kk,Description:q0}),ab=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ib(e){var t,n;let o=(t=e.innerText)!=null?t:"",i=e.cloneNode(!0);if(!es(i))return o;let l=!1;for(let u of i.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),l=!0;let c=l?(n=i.innerText)!=null?n:"":o;return ab.test(c)&&(c=c.replace(ab,"")),c}function $R(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let o=n.split(" ").map(i=>{let l=document.getElementById(i);if(l){let c=l.getAttribute("aria-label");return typeof c=="string"?c.trim():ib(l).trim()}return null}).filter(Boolean);if(o.length>0)return o.join(", ")}return ib(e).trim()}function ER(e){let t=y.useRef(""),n=y.useRef("");return Ue(()=>{let o=e.current;if(!o)return"";let i=o.innerText;if(t.current===i)return n.current;let l=$R(o).trim().toLowerCase();return t.current=i,n.current=l,l})}var TR=Object.defineProperty,CR=(e,t,n)=>t in e?TR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lb=(e,t,n)=>(CR(e,typeof t!="symbol"?t+"":t,n),n),fn=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(fn||{}),Jr=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Jr||{}),$u=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))($u||{}),Xk=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.SelectOption=5]="SelectOption",e[e.RegisterOptions=6]="RegisterOptions",e[e.UnregisterOptions=7]="UnregisterOptions",e[e.SetButtonElement=8]="SetButtonElement",e[e.SetOptionsElement=9]="SetOptionsElement",e[e.SortOptions=10]="SortOptions",e[e.MarkButtonAsMoved=11]="MarkButtonAsMoved",e))(Xk||{});function cb(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,o=ak(t(e.options.slice()),l=>l.dataRef.current.domRef.current),i=n?o.indexOf(n):null;return i===-1&&(i=null),{options:o,activeOptionIndex:i}}let RR={1(e){if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.buttonElement?_u.Tracked(Ik(e.buttonElement)):e.buttonPositionState;return{...e,activeOptionIndex:null,pendingFocus:{focus:Tt.Nothing},listboxState:1,__demoMode:!1,buttonPositionState:t}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:o}=e.dataRef.current,i=e.options.findIndex(l=>o(l.dataRef.current.value));return i!==-1&&(n=i),{...e,frozenValue:!1,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1,buttonPositionState:_u.Idle}},2(e,t){var n,o,i,l,c;if(e.dataRef.current.disabled||e.listboxState===1)return e;let u={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===Tt.Nothing)return{...u,activeOptionIndex:null};if(t.focus===Tt.Specific)return{...u,activeOptionIndex:e.options.findIndex(h=>h.id===t.id)};if(t.focus===Tt.Previous){let h=e.activeOptionIndex;if(h!==null){let b=e.options[h].dataRef.current.domRef,x=iu(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:m=>m.id,resolveDisabled:m=>m.dataRef.current.disabled});if(x!==null){let m=e.options[x].dataRef.current.domRef;if(((o=b.current)==null?void 0:o.previousElementSibling)===m.current||((i=m.current)==null?void 0:i.previousElementSibling)===null)return{...u,activeOptionIndex:x}}}}else if(t.focus===Tt.Next){let h=e.activeOptionIndex;if(h!==null){let b=e.options[h].dataRef.current.domRef,x=iu(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:m=>m.id,resolveDisabled:m=>m.dataRef.current.disabled});if(x!==null){let m=e.options[x].dataRef.current.domRef;if(((l=b.current)==null?void 0:l.nextElementSibling)===m.current||((c=m.current)==null?void 0:c.nextElementSibling)===null)return{...u,activeOptionIndex:x}}}}let f=cb(e),p=iu(t,{resolveItems:()=>f.options,resolveActiveIndex:()=>f.activeOptionIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.current.disabled});return{...u,...f,activeOptionIndex:p}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,o=e.searchQuery+t.value.toLowerCase(),i=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(c=>{var u;return!c.dataRef.current.disabled&&((u=c.dataRef.current.textValue)==null?void 0:u.startsWith(o))}),l=i?e.options.indexOf(i):-1;return l===-1||l===e.activeOptionIndex?{...e,searchQuery:o}:{...e,searchQuery:o,activeOptionIndex:l,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5(e){return e.dataRef.current.mode===0?{...e,frozenValue:!0}:{...e}},6:(e,t)=>{let n=e.options.concat(t.options),o=e.activeOptionIndex;if(e.pendingFocus.focus!==Tt.Nothing&&(o=iu(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:i=>i.id,resolveDisabled:i=>i.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:i}=e.dataRef.current;if(i){let l=n.findIndex(c=>i==null?void 0:i(c.dataRef.current.value));l!==-1&&(o=l)}}return{...e,options:n,activeOptionIndex:o,pendingFocus:{focus:Tt.Nothing},pendingShouldSort:!0}},7:(e,t)=>{let n=e.options,o=[],i=new Set(t.options);for(let[l,c]of n.entries())if(i.has(c.id)&&(o.push(l),i.delete(c.id),i.size===0))break;if(o.length>0){n=n.slice();for(let l of o.reverse())n.splice(l,1)}return{...e,options:n,activationTrigger:1}},8:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},9:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},10:e=>e.pendingShouldSort?{...e,...cb(e),pendingShouldSort:!1}:e,11(e){return e.buttonPositionState.kind!=="Tracked"?e:{...e,buttonPositionState:_u.Moved}}};class Wh extends Z0{constructor(t){super(t),lb(this,"actions",{onChange:n=>{let{onChange:o,compare:i,mode:l,value:c}=this.state.dataRef.current;return Sn(l,{0:()=>o==null?void 0:o(n),1:()=>{let u=c.slice(),f=u.findIndex(p=>i(p,n));return f===-1?u.push(n):u.splice(f,1),o==null?void 0:o(u)}})},registerOption:Gm(()=>{let n=[],o=new Set;return[(i,l)=>{o.has(l)||(o.add(l),n.push({id:i,dataRef:l}))},()=>(o.clear(),this.send({type:6,options:n.splice(0)}))]}),unregisterOption:Gm(()=>{let n=[];return[o=>n.push(o),()=>{this.send({type:7,options:n.splice(0)})}]}),goToOption:Gm(()=>{let n=null;return[(o,i)=>{n={type:2,...o,trigger:i}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{var n;if(this.state.activeOptionIndex!==null){let{dataRef:o}=this.state.options[this.state.activeOptionIndex];this.actions.selectOption(o.current.value)}else this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(n=this.state.buttonElement)==null||n.focus({preventScroll:!0}))},selectOption:n=>{this.send({type:5,value:n})},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:8,element:n})},setOptionsElement:n=>{this.send({type:9,element:n})}}),lb(this,"selectors",{activeDescendantId(n){var o;let i=n.activeOptionIndex,l=n.options;return i===null||(o=l[i])==null?void 0:o.id},isActive(n,o){var i;let l=n.activeOptionIndex,c=n.options;return l!==null?((i=c[l])==null?void 0:i.id)===o:!1},hasFrozenValue(n){return n.frozenValue},shouldScrollIntoView(n,o){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,o)},didButtonMove(n){return n.buttonPositionState.kind==="Moved"}}),this.on(6,()=>{requestAnimationFrame(()=>{this.send({type:10})})});{let n=this.state.id,o=kd.get(null);this.disposables.add(o.on(ek.Push,i=>{!o.selectors.isTop(i,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>o.actions.push(n)),this.on(1,()=>o.actions.pop(n))}this.disposables.group(n=>{this.on(1,o=>{o.buttonElement&&(n.dispose(),n.add(GC(o.buttonElement,o.buttonPositionState,()=>{this.send({type:11})})))})}),this.on(5,(n,o)=>{var i;this.actions.onChange(o.value),this.state.dataRef.current.mode===0&&(this.actions.closeListbox(),(i=this.state.buttonElement)==null||i.focus({preventScroll:!0}))})}static new({id:t,__demoMode:n=!1}){return new Wh({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:Tt.Nothing},frozenValue:!1,__demoMode:n,buttonPositionState:_u.Idle})}reduce(t,n){return Sn(n.type,RR,t,n)}}const Yk=y.createContext(null);function Hh(e){let t=y.useContext(Yk);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Qk),n}return t}function Qk({id:e,__demoMode:t=!1}){let n=y.useMemo(()=>Wh.new({id:e,__demoMode:t}),[]);return zh(()=>n.dispose()),n}let Od=y.createContext(null);Od.displayName="ListboxDataContext";function Ul(e){let t=y.useContext(Od);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ul),n}return t}let AR=y.Fragment;function OR(e,t){let n=y.useId(),o=Rh(),{value:i,defaultValue:l,form:c,name:u,onChange:f,by:p,invalid:h=!1,disabled:b=o||!1,horizontal:x=!1,multiple:m=!1,__demoMode:v=!1,...w}=e;const j=x?"horizontal":"vertical";let S=pn(t),T=X$(l),[$=m?[]:void 0,_]=K$(i,f,T),E=Qk({id:n,__demoMode:v}),R=y.useRef({static:!1,hold:!1}),C=y.useRef(new Map),O=NE(p),z=y.useCallback(q=>Sn(F.mode,{[Jr.Multi]:()=>$.some(ne=>O(ne,q)),[Jr.Single]:()=>O($,q)}),[$]),F=js({value:$,disabled:b,invalid:h,mode:m?Jr.Multi:Jr.Single,orientation:j,onChange:_,compare:O,isSelected:z,optionsPropsRef:R,listRef:C});Nt(()=>{E.state.dataRef.current=F},[F]);let D=bn(E,q=>q.listboxState),B=kd.get(null),U=bn(B,y.useCallback(q=>B.selectors.isTop(q,n),[B,n])),[W,X]=bn(E,q=>[q.buttonElement,q.optionsElement]);ck(U,[W,X],(q,ne)=>{E.send({type:Xk.CloseListbox}),ok(ne,Ah.Loose)||(q.preventDefault(),W==null||W.focus())});let M=js({open:D===fn.Open,disabled:b,invalid:h,value:$}),[K,L]=gE({inherit:!0}),I={ref:S},G=y.useCallback(()=>{if(T!==void 0)return _==null?void 0:_(T)},[_,T]),P=Xt();return je.createElement(L,{value:K,props:{htmlFor:W==null?void 0:W.id},slot:{open:D===fn.Open,disabled:b}},je.createElement(TC,null,je.createElement(Yk.Provider,{value:E},je.createElement(Od.Provider,{value:F},je.createElement(Rk,{value:Sn(D,{[fn.Open]:kn.Open,[fn.Closed]:kn.Closed})},u!=null&&$!=null&&je.createElement(nE,{disabled:b,data:{[u]:$},form:c,onReset:G}),P({ourProps:I,theirProps:w,slot:M,defaultTag:AR,name:"Listbox"}))))))}let MR="button";function PR(e,t){let n=y.useId(),o=F0(),i=Ul("Listbox.Button"),l=Hh("Listbox.Button"),{id:c=o||`headlessui-listbox-button-${n}`,disabled:u=i.disabled||!1,autoFocus:f=!1,...p}=e,h=pn(t,SC(),l.actions.setButtonElement),b=_C(),[x,m,v]=bn(l,X=>[X.listboxState,X.buttonElement,X.optionsElement]),w=x===fn.Open;KE(w,{trigger:m,action:y.useCallback(X=>{if(m!=null&&m.contains(X.target))return ou.Ignore;let M=X.target.closest('[role="option"]:not([data-disabled])');return es(M)?ou.Select(M):v!=null&&v.contains(X.target)?ou.Ignore:ou.Close},[m,v]),close:l.actions.closeListbox,select:l.actions.selectActiveOption});let j=Ue(X=>{switch(X.key){case Wt.Enter:Y$(X.currentTarget);break;case Wt.Space:case Wt.ArrowDown:X.preventDefault(),l.actions.openListbox({focus:i.value?Tt.Nothing:Tt.First});break;case Wt.ArrowUp:X.preventDefault(),l.actions.openListbox({focus:i.value?Tt.Nothing:Tt.Last});break}}),S=Ue(X=>{switch(X.key){case Wt.Space:X.preventDefault();break}}),T=_E(X=>{var M;l.state.listboxState===fn.Open?(tr.flushSync(()=>l.actions.closeListbox()),(M=l.state.buttonElement)==null||M.focus({preventScroll:!0})):(X.preventDefault(),l.actions.openListbox({focus:Tt.Nothing}))}),$=Ue(X=>X.preventDefault()),_=K0([c]),E=dE(),{isFocusVisible:R,focusProps:C}=A$({autoFocus:f}),{isHovered:O,hoverProps:z}=P$({isDisabled:u}),{pressed:F,pressProps:D}=U$({disabled:u}),B=js({open:x===fn.Open,active:F||x===fn.Open,disabled:u,invalid:i.invalid,value:i.value,hover:O,focus:R,autofocus:f}),U=bn(l,X=>X.listboxState===fn.Open),W=P0(b(),{ref:h,id:c,type:XE(e,m),"aria-haspopup":"listbox","aria-controls":v==null?void 0:v.id,"aria-expanded":U,"aria-labelledby":_,"aria-describedby":E,disabled:u||void 0,autoFocus:f,onKeyDown:j,onKeyUp:S,onKeyPress:$},T,C,z,D);return Xt()({ourProps:W,theirProps:p,slot:B,defaultTag:MR,name:"Listbox.Button"})}let Zk=y.createContext(!1),LR="div",IR=Ua.RenderStrategy|Ua.Static;function zR(e,t){let n=y.useId(),{id:o=`headlessui-listbox-options-${n}`,anchor:i,portal:l=!1,modal:c=!0,transition:u=!1,...f}=e,p=NC(i),[h,b]=y.useState(null);p&&(l=!0);let x=Ul("Listbox.Options"),m=Hh("Listbox.Options"),[v,w,j,S]=bn(m,ce=>[ce.listboxState,ce.buttonElement,ce.optionsElement,ce.__demoMode]),T=yl(w),$=yl(j),_=Dl(),[E,R]=mk(u,h,_!==null?(_&kn.Open)===kn.Open:v===fn.Open);sk(E,w,m.actions.closeListbox);let C=S?!1:c&&v===fn.Open;dk(C,$);let O=S?!1:c&&v===fn.Open;nk(O,{allowed:y.useCallback(()=>[w,j],[w,j])});let z=bn(m,m.selectors.didButtonMove)?!1:E,F=bn(m,m.selectors.hasFrozenValue)&&!e.static,D=Ck(F,x.value),B=y.useCallback(ce=>x.compare(D,ce),[x.compare,D]),U=bn(m,ce=>{var le;if(p==null||!((le=p==null?void 0:p.to)!=null&&le.includes("selection")))return null;let ye=ce.options.findIndex(ee=>B(ee.dataRef.current.value));return ye===-1&&(ye=0),ye}),W=(()=>{if(p==null)return;if(U===null)return{...p,inner:void 0};let ce=Array.from(x.listRef.current.values());return{...p,inner:{listRef:{current:ce},index:U}}})(),[X,M]=EC(W),K=$C(),L=pn(t,p?X:null,m.actions.setOptionsElement,b),I=lo();y.useEffect(()=>{let ce=j;ce&&v===fn.Open&&(O0(ce)||ce==null||ce.focus({preventScroll:!0}))},[v,j]);let G=Ue(ce=>{var le;switch(I.dispose(),ce.key){case Wt.Space:if(m.state.searchQuery!=="")return ce.preventDefault(),ce.stopPropagation(),m.actions.search(ce.key);case Wt.Enter:ce.preventDefault(),ce.stopPropagation(),m.actions.selectActiveOption();break;case Sn(x.orientation,{vertical:Wt.ArrowDown,horizontal:Wt.ArrowRight}):return ce.preventDefault(),ce.stopPropagation(),m.actions.goToOption({focus:Tt.Next});case Sn(x.orientation,{vertical:Wt.ArrowUp,horizontal:Wt.ArrowLeft}):return ce.preventDefault(),ce.stopPropagation(),m.actions.goToOption({focus:Tt.Previous});case Wt.Home:case Wt.PageUp:return ce.preventDefault(),ce.stopPropagation(),m.actions.goToOption({focus:Tt.First});case Wt.End:case Wt.PageDown:return ce.preventDefault(),ce.stopPropagation(),m.actions.goToOption({focus:Tt.Last});case Wt.Escape:ce.preventDefault(),ce.stopPropagation(),tr.flushSync(()=>m.actions.closeListbox()),(le=m.state.buttonElement)==null||le.focus({preventScroll:!0});return;case Wt.Tab:ce.preventDefault(),ce.stopPropagation(),tr.flushSync(()=>m.actions.closeListbox()),BE(m.state.buttonElement,ce.shiftKey?Is.Previous:Is.Next);break;default:ce.key.length===1&&(m.actions.search(ce.key),I.setTimeout(()=>m.actions.clearSearch(),350));break}}),P=bn(m,ce=>{var le;return(le=ce.buttonElement)==null?void 0:le.id}),q=js({open:v===fn.Open}),ne=P0(p?K():{},{id:o,ref:L,"aria-activedescendant":bn(m,m.selectors.activeDescendantId),"aria-multiselectable":x.mode===Jr.Multi?!0:void 0,"aria-labelledby":P,"aria-orientation":x.orientation,onKeyDown:G,role:"listbox",tabIndex:v===fn.Open?0:void 0,style:{...f.style,...M,"--button-width":SE(E,w,!0).width},...fk(R)}),ae=Xt(),ie=y.useMemo(()=>x.mode===Jr.Multi?x:{...x,isSelected:B},[x,B]);return je.createElement(Lk,{enabled:l?e.static||E:!1,ownerDocument:T},je.createElement(Od.Provider,{value:ie},ae({ourProps:ne,theirProps:f,slot:q,defaultTag:LR,features:IR,visible:z,name:"Listbox.Options"})))}let DR="div";function FR(e,t){let n=y.useId(),{id:o=`headlessui-listbox-option-${n}`,disabled:i=!1,value:l,...c}=e,u=y.useContext(Zk)===!0,f=Ul("Listbox.Option"),p=Hh("Listbox.Option"),h=bn(p,F=>p.selectors.isActive(F,o)),b=f.isSelected(l),x=y.useRef(null),m=ER(x),v=co({disabled:i,value:l,domRef:x,get textValue(){return m()}}),w=pn(t,x,F=>{F?f.listRef.current.set(o,F):f.listRef.current.delete(o)}),j=bn(p,F=>p.selectors.shouldScrollIntoView(F,o));Nt(()=>{if(j)return rs().requestAnimationFrame(()=>{var F,D;(D=(F=x.current)==null?void 0:F.scrollIntoView)==null||D.call(F,{block:"nearest"})})},[j,x]),Nt(()=>{if(!u)return p.actions.registerOption(o,v),()=>p.actions.unregisterOption(o)},[v,o,u]);let S=Ue(F=>{if(i)return F.preventDefault();p.actions.selectOption(l)}),T=Ue(()=>{if(i)return p.actions.goToOption({focus:Tt.Nothing});p.actions.goToOption({focus:Tt.Specific,id:o})}),$=nT(),_=Ue(F=>$.update(F)),E=Ue(F=>{$.wasMoved(F)&&(i||h&&p.state.activationTrigger===$u.Pointer||p.actions.goToOption({focus:Tt.Specific,id:o},$u.Pointer))}),R=Ue(F=>{$.wasMoved(F)&&(i||h&&p.state.activationTrigger===$u.Pointer&&p.actions.goToOption({focus:Tt.Nothing}))}),C=js({active:h,focus:h,selected:b,disabled:i,selectedOption:b&&u}),O=u?{}:{id:o,ref:w,role:"option",tabIndex:i===!0?void 0:-1,"aria-disabled":i===!0?!0:void 0,"aria-selected":b,disabled:void 0,onClick:S,onFocus:T,onPointerEnter:_,onMouseEnter:_,onPointerMove:E,onMouseMove:E,onPointerLeave:R,onMouseLeave:R},z=Xt();return!b&&u?null:z({ourProps:O,theirProps:c,slot:C,defaultTag:DR,name:"Listbox.Option"})}let UR=y.Fragment;function WR(e,t){let{options:n,placeholder:o,...i}=e,l={ref:pn(t)},c=Ul("ListboxSelectedOption"),u=js({}),f=c.value===void 0||c.value===null||c.mode===Jr.Multi&&Array.isArray(c.value)&&c.value.length===0,p=Xt();return je.createElement(Zk.Provider,{value:!0},p({ourProps:l,theirProps:{...i,children:je.createElement(je.Fragment,null,o&&f?o:n)},slot:u,defaultTag:UR,name:"ListboxSelectedOption"}))}let HR=Lt(OR),Jk=Lt(PR),BR=bE,e1=Lt(zR),t1=Lt(FR),GR=Lt(WR),qR=Object.assign(HR,{Button:Jk,Label:BR,Options:e1,Option:t1,SelectedOption:GR});const Bh=y.createContext(null),VR=()=>y.useContext(Bh);function Gh(e){const t=y.useContext(Bh);return{id:e.id??(t==null?void 0:t.id),"aria-describedby":e["aria-describedby"]??(t==null?void 0:t.describedBy),"aria-invalid":e["aria-invalid"]??((t==null?void 0:t.invalid)||void 0),"aria-required":e["aria-required"]??((t==null?void 0:t.required)&&!e.required||void 0)}}function Po({label:e,id:t,required:n,optional:o,note:i,hint:l,error:c,warning:u,aside:f,group:p,className:h,children:b}){const x=y.useId(),m=t??`${x}-control`,[v,w,j,S,T]=[`${x}-label`,`${x}-note`,`${x}-hint`,`${x}-error`,`${x}-warning`],$=[i&&w,l&&j,c&&S,u&&T].filter(Boolean).join(" ")||void 0,_=s.jsxs(s.Fragment,{children:[e,n&&s.jsx("span",{className:"text-destructive-text","aria-hidden":!0,children:" *"}),o&&s.jsx("span",{className:"font-normal normal-case text-muted-foreground",children:" (optional)"})]});return s.jsxs("div",{className:h,...p===!0?{role:"group","aria-labelledby":v,"aria-describedby":$}:{},children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between gap-3",children:[p?s.jsx("span",{id:v,className:"caps text-small font-semibold",children:_}):s.jsx("label",{id:v,htmlFor:m,className:"caps text-small font-semibold",children:_}),f]}),i&&s.jsx("p",{id:w,className:"-mt-1 mb-2 text-small text-muted-foreground",children:i}),s.jsx(Bh.Provider,{value:p?null:{id:m,describedBy:$,invalid:!!c,required:!!n},children:b}),l&&s.jsx("p",{id:j,className:"mt-1.5 text-small text-muted-foreground",children:l}),c&&s.jsx("p",{id:S,className:"mt-2 font-mono text-small text-destructive-text",role:"alert",children:c}),u&&s.jsx("p",{id:T,className:"mt-2 font-mono text-small text-warning-text",children:u})]})}const n1="w-full border border-input bg-background px-3 font-mono text-body placeholder:text-muted-foreground hover:border-foreground/60 focus-visible:outline-offset-0 read-only:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-45 aria-[invalid=true]:border-destructive",s1="min-w-0 bg-transparent font-mono text-body outline-none placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed",r1="border border-input bg-background hover:border-foreground/60 focus-within:outline focus-within:outline-focus focus-within:outline-ring",He=y.forwardRef(({className:e,fieldSize:t="md",bare:n,...o},i)=>s.jsx("input",{ref:i,...o,...Gh(o),className:oe(n?s1:oe(n1,t==="sm"?"h-control-sm":"h-control-md"),e)}));He.displayName="Input";const Ss=y.forwardRef(({className:e,bare:t,...n},o)=>s.jsx("textarea",{ref:o,...n,...Gh(n),className:oe(t?s1:oe(n1,"py-2.5"),e)}));Ss.displayName="Textarea";const o1=e=>{const t=y.forwardRef(({label:n,note:o,className:i,disabled:l,...c},u)=>s.jsxs("label",{className:oe("flex items-start gap-2.5 text-body",l?"cursor-not-allowed opacity-45":"cursor-pointer",i),children:[s.jsx("input",{ref:u,type:e,disabled:l,...c,...Gh(c),className:"mt-0.5 size-4 shrink-0 accent-primary"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block",children:n}),o&&s.jsx("span",{className:"mt-0.5 block text-small text-muted-foreground",children:o})]})]}));return t.displayName=e==="checkbox"?"Checkbox":"Radio",t};o1("checkbox");o1("radio");function Kt({value:e,onChange:t,options:n,label:o,id:i,className:l,disabled:c=!1,name:u,small:f=!1,placeholder:p,autoFocus:h}){const b=n.find(m=>m.value===e),x=VR();return s.jsxs(qR,{value:e,onChange:t,disabled:c,name:u,children:[s.jsxs(Jk,{id:i??(x==null?void 0:x.id),autoFocus:h,"aria-label":o,"aria-describedby":x==null?void 0:x.describedBy,"aria-invalid":(x==null?void 0:x.invalid)||void 0,"data-value":e,className:oe("flex min-w-0 items-center justify-between gap-2 border border-input bg-background text-left font-mono hover:border-foreground/60 focus-visible:outline-offset-0 disabled:opacity-60 data-[open]:border-foreground",f?"h-control-sm px-2 text-small":"h-control-md px-3 text-body",l),children:[s.jsx("span",{className:oe("min-w-0 truncate",!b&&"text-muted-foreground"),children:(b==null?void 0:b.label)??p??""}),s.jsx(Bo,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0})]}),s.jsx(e1,{anchor:"bottom start","data-picker-list":"",className:"z-popover max-h-72 w-[var(--button-width)] min-w-[12rem] overflow-auto border border-border-strong bg-background py-1 font-mono text-body shadow-float outline-none [--anchor-gap:2px] [--anchor-padding:8px]",children:n.map(m=>s.jsxs(t1,{value:m.value,disabled:m.disabled,title:m.title,"data-value":m.value,className:"group flex min-h-10 cursor-pointer items-center gap-2 px-3 py-2 data-[disabled]:cursor-not-allowed data-[focus]:bg-accent data-[disabled]:opacity-50 data-[selected]:text-foreground",children:[s.jsx(hd,{className:"invisible size-3.5 shrink-0 text-primary-text group-data-[selected]:visible","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 break-words",children:m.label})]},m.value))})]})}const a1=(e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:"base",numeric:!0})||(e.id<t.id?-1:e.id>t.id?1:0),Md=e=>[...e].sort((t,n)=>a1({name:t.definition.name||t.agent_id,id:t.agent_id},{name:n.definition.name||n.agent_id,id:n.agent_id}));/*! @license DOMPurify 3.2.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.3/LICENSE */const{entries:i1,setPrototypeOf:ub,isFrozen:KR,getPrototypeOf:XR,getOwnPropertyDescriptor:YR}=Object;let{freeze:_n,seal:Ns,create:l1}=Object,{apply:Dp,construct:Fp}=typeof Reflect<"u"&&Reflect;_n||(_n=function(t){return t});Ns||(Ns=function(t){return t});Dp||(Dp=function(t,n,o){return t.apply(n,o)});Fp||(Fp=function(t,n){return new t(...n)});const lu=ts(Array.prototype.forEach),db=ts(Array.prototype.pop),Gi=ts(Array.prototype.push),Eu=ts(String.prototype.toLowerCase),ep=ts(String.prototype.toString),fb=ts(String.prototype.match),qi=ts(String.prototype.replace),QR=ts(String.prototype.indexOf),ZR=ts(String.prototype.trim),Ls=ts(Object.prototype.hasOwnProperty),vn=ts(RegExp.prototype.test),Vi=JR(TypeError);function ts(e){return function(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return Dp(e,t,o)}}function JR(e){return function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return Fp(e,n)}}function Qe(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Eu;ub&&ub(e,null);let o=t.length;for(;o--;){let i=t[o];if(typeof i=="string"){const l=n(i);l!==i&&(KR(t)||(t[o]=l),i=l)}e[i]=!0}return e}function e3(e){for(let t=0;t<e.length;t++)Ls(e,t)||(e[t]=null);return e}function To(e){const t=l1(null);for(const[n,o]of i1(e))Ls(e,n)&&(Array.isArray(o)?t[n]=e3(o):o&&typeof o=="object"&&o.constructor===Object?t[n]=To(o):t[n]=o);return t}function Ki(e,t){for(;e!==null;){const o=YR(e,t);if(o){if(o.get)return ts(o.get);if(typeof o.value=="function")return ts(o.value)}e=XR(e)}function n(){return null}return n}const mb=_n(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),tp=_n(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),np=_n(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),t3=_n(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),sp=_n(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),n3=_n(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),pb=_n(["#text"]),hb=_n(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),rp=_n(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),gb=_n(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),cu=_n(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),s3=Ns(/\{\{[\w\W]*|[\w\W]*\}\}/gm),r3=Ns(/<%[\w\W]*|[\w\W]*%>/gm),o3=Ns(/\$\{[\w\W]*}/gm),a3=Ns(/^data-[\-\w.\u00B7-\uFFFF]+$/),i3=Ns(/^aria-[\-\w]+$/),c1=Ns(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),l3=Ns(/^(?:\w+script|data):/i),c3=Ns(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),u1=Ns(/^html$/i),u3=Ns(/^[a-z][.\w]*(-[.\w]+)+$/i);var xb=Object.freeze({__proto__:null,ARIA_ATTR:i3,ATTR_WHITESPACE:c3,CUSTOM_ELEMENT:u3,DATA_ATTR:a3,DOCTYPE_NAME:u1,ERB_EXPR:r3,IS_ALLOWED_URI:c1,IS_SCRIPT_OR_DATA:l3,MUSTACHE_EXPR:s3,TMPLIT_EXPR:o3});const Xi={element:1,text:3,progressingInstruction:7,comment:8,document:9},d3=function(){return typeof window>"u"?null:window},f3=function(t,n){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let o=null;const i="data-tt-policy-suffix";n&&n.hasAttribute(i)&&(o=n.getAttribute(i));const l="dompurify"+(o?"#"+o:"");try{return t.createPolicy(l,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},yb=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function d1(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d3();const t=Ae=>d1(Ae);if(t.version="3.2.3",t.removed=[],!e||!e.document||e.document.nodeType!==Xi.document)return t.isSupported=!1,t;let{document:n}=e;const o=n,i=o.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:u,Element:f,NodeFilter:p,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:b,DOMParser:x,trustedTypes:m}=e,v=f.prototype,w=Ki(v,"cloneNode"),j=Ki(v,"remove"),S=Ki(v,"nextSibling"),T=Ki(v,"childNodes"),$=Ki(v,"parentNode");if(typeof c=="function"){const Ae=n.createElement("template");Ae.content&&Ae.content.ownerDocument&&(n=Ae.content.ownerDocument)}let _,E="";const{implementation:R,createNodeIterator:C,createDocumentFragment:O,getElementsByTagName:z}=n,{importNode:F}=o;let D=yb();t.isSupported=typeof i1=="function"&&typeof $=="function"&&R&&R.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:B,ERB_EXPR:U,TMPLIT_EXPR:W,DATA_ATTR:X,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:K,ATTR_WHITESPACE:L,CUSTOM_ELEMENT:I}=xb;let{IS_ALLOWED_URI:G}=xb,P=null;const q=Qe({},[...mb,...tp,...np,...sp,...pb]);let ne=null;const ae=Qe({},[...hb,...rp,...gb,...cu]);let ie=Object.seal(l1(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ce=null,le=null,ye=!0,ee=!0,be=!1,Oe=!0,We=!1,fe=!0,Re=!1,Xe=!1,Yt=!1,De=!1,et=!1,Ht=!1,Bt=!0,_t=!1;const os="user-content-";let gn=!0,Qt=!1,ot={},ct=null;const Pe=Qe({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Le=null;const Mt=Qe({},["audio","video","img","source","image","track"]);let ut=null;const It=Qe({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),En="http://www.w3.org/1998/Math/MathML",Tn="http://www.w3.org/2000/svg",Zt="http://www.w3.org/1999/xhtml";let Hn=Zt,as=!1,is=null;const Cn=Qe({},[En,Tn,Zt],ep);let Bn=Qe({},["mi","mo","mn","ms","mtext"]),Gn=Qe({},["annotation-xml"]);const J=Qe({},["title","style","font","a","script"]);let we=null;const Ge=["application/xhtml+xml","text/html"],dt="text/html";let Ke=null,$t=null;const on=n.createElement("form"),bt=function(Y){return Y instanceof RegExp||Y instanceof Function},Hs=function(){let Y=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!($t&&$t===Y)){if((!Y||typeof Y!="object")&&(Y={}),Y=To(Y),we=Ge.indexOf(Y.PARSER_MEDIA_TYPE)===-1?dt:Y.PARSER_MEDIA_TYPE,Ke=we==="application/xhtml+xml"?ep:Eu,P=Ls(Y,"ALLOWED_TAGS")?Qe({},Y.ALLOWED_TAGS,Ke):q,ne=Ls(Y,"ALLOWED_ATTR")?Qe({},Y.ALLOWED_ATTR,Ke):ae,is=Ls(Y,"ALLOWED_NAMESPACES")?Qe({},Y.ALLOWED_NAMESPACES,ep):Cn,ut=Ls(Y,"ADD_URI_SAFE_ATTR")?Qe(To(It),Y.ADD_URI_SAFE_ATTR,Ke):It,Le=Ls(Y,"ADD_DATA_URI_TAGS")?Qe(To(Mt),Y.ADD_DATA_URI_TAGS,Ke):Mt,ct=Ls(Y,"FORBID_CONTENTS")?Qe({},Y.FORBID_CONTENTS,Ke):Pe,ce=Ls(Y,"FORBID_TAGS")?Qe({},Y.FORBID_TAGS,Ke):{},le=Ls(Y,"FORBID_ATTR")?Qe({},Y.FORBID_ATTR,Ke):{},ot=Ls(Y,"USE_PROFILES")?Y.USE_PROFILES:!1,ye=Y.ALLOW_ARIA_ATTR!==!1,ee=Y.ALLOW_DATA_ATTR!==!1,be=Y.ALLOW_UNKNOWN_PROTOCOLS||!1,Oe=Y.ALLOW_SELF_CLOSE_IN_ATTR!==!1,We=Y.SAFE_FOR_TEMPLATES||!1,fe=Y.SAFE_FOR_XML!==!1,Re=Y.WHOLE_DOCUMENT||!1,De=Y.RETURN_DOM||!1,et=Y.RETURN_DOM_FRAGMENT||!1,Ht=Y.RETURN_TRUSTED_TYPE||!1,Yt=Y.FORCE_BODY||!1,Bt=Y.SANITIZE_DOM!==!1,_t=Y.SANITIZE_NAMED_PROPS||!1,gn=Y.KEEP_CONTENT!==!1,Qt=Y.IN_PLACE||!1,G=Y.ALLOWED_URI_REGEXP||c1,Hn=Y.NAMESPACE||Zt,Bn=Y.MATHML_TEXT_INTEGRATION_POINTS||Bn,Gn=Y.HTML_INTEGRATION_POINTS||Gn,ie=Y.CUSTOM_ELEMENT_HANDLING||{},Y.CUSTOM_ELEMENT_HANDLING&&bt(Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ie.tagNameCheck=Y.CUSTOM_ELEMENT_HANDLING.tagNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&bt(Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ie.attributeNameCheck=Y.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),Y.CUSTOM_ELEMENT_HANDLING&&typeof Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ie.allowCustomizedBuiltInElements=Y.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),We&&(ee=!1),et&&(De=!0),ot&&(P=Qe({},pb),ne=[],ot.html===!0&&(Qe(P,mb),Qe(ne,hb)),ot.svg===!0&&(Qe(P,tp),Qe(ne,rp),Qe(ne,cu)),ot.svgFilters===!0&&(Qe(P,np),Qe(ne,rp),Qe(ne,cu)),ot.mathMl===!0&&(Qe(P,sp),Qe(ne,gb),Qe(ne,cu))),Y.ADD_TAGS&&(P===q&&(P=To(P)),Qe(P,Y.ADD_TAGS,Ke)),Y.ADD_ATTR&&(ne===ae&&(ne=To(ne)),Qe(ne,Y.ADD_ATTR,Ke)),Y.ADD_URI_SAFE_ATTR&&Qe(ut,Y.ADD_URI_SAFE_ATTR,Ke),Y.FORBID_CONTENTS&&(ct===Pe&&(ct=To(ct)),Qe(ct,Y.FORBID_CONTENTS,Ke)),gn&&(P["#text"]=!0),Re&&Qe(P,["html","head","body"]),P.table&&(Qe(P,["tbody"]),delete ce.tbody),Y.TRUSTED_TYPES_POLICY){if(typeof Y.TRUSTED_TYPES_POLICY.createHTML!="function")throw Vi('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Y.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Vi('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');_=Y.TRUSTED_TYPES_POLICY,E=_.createHTML("")}else _===void 0&&(_=f3(m,i)),_!==null&&typeof E=="string"&&(E=_.createHTML(""));_n&&_n(Y),$t=Y}},an=Qe({},[...tp,...np,...t3]),$s=Qe({},[...sp,...n3]),Rn=function(Y){let pe=$(Y);(!pe||!pe.tagName)&&(pe={namespaceURI:Hn,tagName:"template"});const Ne=Eu(Y.tagName),at=Eu(pe.tagName);return is[Y.namespaceURI]?Y.namespaceURI===Tn?pe.namespaceURI===Zt?Ne==="svg":pe.namespaceURI===En?Ne==="svg"&&(at==="annotation-xml"||Bn[at]):!!an[Ne]:Y.namespaceURI===En?pe.namespaceURI===Zt?Ne==="math":pe.namespaceURI===Tn?Ne==="math"&&Gn[at]:!!$s[Ne]:Y.namespaceURI===Zt?pe.namespaceURI===Tn&&!Gn[at]||pe.namespaceURI===En&&!Bn[at]?!1:!$s[Ne]&&(J[Ne]||!an[Ne]):!!(we==="application/xhtml+xml"&&is[Y.namespaceURI]):!1},An=function(Y){Gi(t.removed,{element:Y});try{$(Y).removeChild(Y)}catch{j(Y)}},ls=function(Y,pe){try{Gi(t.removed,{attribute:pe.getAttributeNode(Y),from:pe})}catch{Gi(t.removed,{attribute:null,from:pe})}if(pe.removeAttribute(Y),Y==="is")if(De||et)try{An(pe)}catch{}else try{pe.setAttribute(Y,"")}catch{}},rr=function(Y){let pe=null,Ne=null;if(Yt)Y="<remove></remove>"+Y;else{const Be=fb(Y,/^[\r\n\t ]+/);Ne=Be&&Be[0]}we==="application/xhtml+xml"&&Hn===Zt&&(Y='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Y+"</body></html>");const at=_?_.createHTML(Y):Y;if(Hn===Zt)try{pe=new x().parseFromString(at,we)}catch{}if(!pe||!pe.documentElement){pe=R.createDocument(Hn,"template",null);try{pe.documentElement.innerHTML=as?E:at}catch{}}const Ct=pe.body||pe.documentElement;return Y&&Ne&&Ct.insertBefore(n.createTextNode(Ne),Ct.childNodes[0]||null),Hn===Zt?z.call(pe,Re?"html":"body")[0]:Re?pe.documentElement:Ct},or=function(Y){return C.call(Y.ownerDocument||Y,Y,p.SHOW_ELEMENT|p.SHOW_COMMENT|p.SHOW_TEXT|p.SHOW_PROCESSING_INSTRUCTION|p.SHOW_CDATA_SECTION,null)},Bs=function(Y){return Y instanceof b&&(typeof Y.nodeName!="string"||typeof Y.textContent!="string"||typeof Y.removeChild!="function"||!(Y.attributes instanceof h)||typeof Y.removeAttribute!="function"||typeof Y.setAttribute!="function"||typeof Y.namespaceURI!="string"||typeof Y.insertBefore!="function"||typeof Y.hasChildNodes!="function")},Yo=function(Y){return typeof u=="function"&&Y instanceof u};function On(Ae,Y,pe){lu(Ae,Ne=>{Ne.call(t,Y,pe,$t)})}const fo=function(Y){let pe=null;if(On(D.beforeSanitizeElements,Y,null),Bs(Y))return An(Y),!0;const Ne=Ke(Y.nodeName);if(On(D.uponSanitizeElement,Y,{tagName:Ne,allowedTags:P}),Y.hasChildNodes()&&!Yo(Y.firstElementChild)&&vn(/<[/\w]/g,Y.innerHTML)&&vn(/<[/\w]/g,Y.textContent)||Y.nodeType===Xi.progressingInstruction||fe&&Y.nodeType===Xi.comment&&vn(/<[/\w]/g,Y.data))return An(Y),!0;if(!P[Ne]||ce[Ne]){if(!ce[Ne]&&Nr(Ne)&&(ie.tagNameCheck instanceof RegExp&&vn(ie.tagNameCheck,Ne)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ne)))return!1;if(gn&&!ct[Ne]){const at=$(Y)||Y.parentNode,Ct=T(Y)||Y.childNodes;if(Ct&&at){const Be=Ct.length;for(let zt=Be-1;zt>=0;--zt){const Jt=w(Ct[zt],!0);Jt.__removalCount=(Y.__removalCount||0)+1,at.insertBefore(Jt,S(Y))}}}return An(Y),!0}return Y instanceof f&&!Rn(Y)||(Ne==="noscript"||Ne==="noembed"||Ne==="noframes")&&vn(/<\/no(script|embed|frames)/i,Y.innerHTML)?(An(Y),!0):(We&&Y.nodeType===Xi.text&&(pe=Y.textContent,lu([B,U,W],at=>{pe=qi(pe,at," ")}),Y.textContent!==pe&&(Gi(t.removed,{element:Y.cloneNode()}),Y.textContent=pe)),On(D.afterSanitizeElements,Y,null),!1)},qn=function(Y,pe,Ne){if(Bt&&(pe==="id"||pe==="name")&&(Ne in n||Ne in on))return!1;if(!(ee&&!le[pe]&&vn(X,pe))){if(!(ye&&vn(M,pe))){if(!ne[pe]||le[pe]){if(!(Nr(Y)&&(ie.tagNameCheck instanceof RegExp&&vn(ie.tagNameCheck,Y)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Y))&&(ie.attributeNameCheck instanceof RegExp&&vn(ie.attributeNameCheck,pe)||ie.attributeNameCheck instanceof Function&&ie.attributeNameCheck(pe))||pe==="is"&&ie.allowCustomizedBuiltInElements&&(ie.tagNameCheck instanceof RegExp&&vn(ie.tagNameCheck,Ne)||ie.tagNameCheck instanceof Function&&ie.tagNameCheck(Ne))))return!1}else if(!ut[pe]){if(!vn(G,qi(Ne,L,""))){if(!((pe==="src"||pe==="xlink:href"||pe==="href")&&Y!=="script"&&QR(Ne,"data:")===0&&Le[Y])){if(!(be&&!vn(K,qi(Ne,L,"")))){if(Ne)return!1}}}}}}return!0},Nr=function(Y){return Y!=="annotation-xml"&&fb(Y,I)},Sr=function(Y){On(D.beforeSanitizeAttributes,Y,null);const{attributes:pe}=Y;if(!pe||Bs(Y))return;const Ne={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ne,forceKeepAttr:void 0};let at=pe.length;for(;at--;){const Ct=pe[at],{name:Be,namespaceURI:zt,value:Jt}=Ct,Es=Ke(Be);let wt=Be==="value"?Jt:ZR(Jt);if(Ne.attrName=Es,Ne.attrValue=wt,Ne.keepAttr=!0,Ne.forceKeepAttr=void 0,On(D.uponSanitizeAttribute,Y,Ne),wt=Ne.attrValue,_t&&(Es==="id"||Es==="name")&&(ls(Be,Y),wt=os+wt),fe&&vn(/((--!?|])>)|<\/(style|title)/i,wt)){ls(Be,Y);continue}if(Ne.forceKeepAttr||(ls(Be,Y),!Ne.keepAttr))continue;if(!Oe&&vn(/\/>/i,wt)){ls(Be,Y);continue}We&&lu([B,U,W],_r=>{wt=qi(wt,_r," ")});const mo=Ke(Y.nodeName);if(qn(mo,Es,wt)){if(_&&typeof m=="object"&&typeof m.getAttributeType=="function"&&!zt)switch(m.getAttributeType(mo,Es)){case"TrustedHTML":{wt=_.createHTML(wt);break}case"TrustedScriptURL":{wt=_.createScriptURL(wt);break}}try{zt?Y.setAttributeNS(zt,Be,wt):Y.setAttribute(Be,wt),Bs(Y)?An(Y):db(t.removed)}catch{}}}On(D.afterSanitizeAttributes,Y,null)},Qo=function Ae(Y){let pe=null;const Ne=or(Y);for(On(D.beforeSanitizeShadowDOM,Y,null);pe=Ne.nextNode();)On(D.uponSanitizeShadowNode,pe,null),fo(pe),Sr(pe),pe.content instanceof l&&Ae(pe.content);On(D.afterSanitizeShadowDOM,Y,null)};return t.sanitize=function(Ae){let Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},pe=null,Ne=null,at=null,Ct=null;if(as=!Ae,as&&(Ae="<!-->"),typeof Ae!="string"&&!Yo(Ae))if(typeof Ae.toString=="function"){if(Ae=Ae.toString(),typeof Ae!="string")throw Vi("dirty is not a string, aborting")}else throw Vi("toString is not a function");if(!t.isSupported)return Ae;if(Xe||Hs(Y),t.removed=[],typeof Ae=="string"&&(Qt=!1),Qt){if(Ae.nodeName){const Jt=Ke(Ae.nodeName);if(!P[Jt]||ce[Jt])throw Vi("root node is forbidden and cannot be sanitized in-place")}}else if(Ae instanceof u)pe=rr("<!---->"),Ne=pe.ownerDocument.importNode(Ae,!0),Ne.nodeType===Xi.element&&Ne.nodeName==="BODY"||Ne.nodeName==="HTML"?pe=Ne:pe.appendChild(Ne);else{if(!De&&!We&&!Re&&Ae.indexOf("<")===-1)return _&&Ht?_.createHTML(Ae):Ae;if(pe=rr(Ae),!pe)return De?null:Ht?E:""}pe&&Yt&&An(pe.firstChild);const Be=or(Qt?Ae:pe);for(;at=Be.nextNode();)fo(at),Sr(at),at.content instanceof l&&Qo(at.content);if(Qt)return Ae;if(De){if(et)for(Ct=O.call(pe.ownerDocument);pe.firstChild;)Ct.appendChild(pe.firstChild);else Ct=pe;return(ne.shadowroot||ne.shadowrootmode)&&(Ct=F.call(o,Ct,!0)),Ct}let zt=Re?pe.outerHTML:pe.innerHTML;return Re&&P["!doctype"]&&pe.ownerDocument&&pe.ownerDocument.doctype&&pe.ownerDocument.doctype.name&&vn(u1,pe.ownerDocument.doctype.name)&&(zt="<!DOCTYPE "+pe.ownerDocument.doctype.name+`>
|
|
453
|
-
`+zt),We&&lu([B,U,W],Jt=>{zt=qi(zt,Jt," ")}),_&&Ht?_.createHTML(zt):zt},t.setConfig=function(){let Ae=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Hs(Ae),Xe=!0},t.clearConfig=function(){$t=null,Xe=!1},t.isValidAttribute=function(Ae,Y,pe){$t||Hs({});const Ne=Ke(Ae),at=Ke(Y);return qn(Ne,at,pe)},t.addHook=function(Ae,Y){typeof Y=="function"&&Gi(D[Ae],Y)},t.removeHook=function(Ae){return db(D[Ae])},t.removeHooks=function(Ae){D[Ae]=[]},t.removeAllHooks=function(){D=yb()},t}var Tu=d1();function qh(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let Vo=qh();function f1(e){Vo=e}const cl={exec:()=>null};function lt(e,t=""){let n=typeof e=="string"?e:e.source;const o={replace:(i,l)=>{let c=typeof l=="string"?l:l.source;return c=c.replace(jn.caret,"$1"),n=n.replace(i,c),o},getRegex:()=>new RegExp(n,t)};return o}const jn={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,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ 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,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},m3=/^(?:[ \t]*(?:\n|$))+/,p3=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,h3=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Wl=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,g3=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,m1=/(?:[*+-]|\d{1,9}[.)])/,p1=lt(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,m1).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/).getRegex(),Vh=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,x3=/^[^\n]+/,Kh=/(?!\s*\])(?:\\.|[^\[\]\\])+/,y3=lt(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Kh).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),v3=lt(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,m1).getRegex(),Pd="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",Xh=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,b3=lt("^ {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",Xh).replace("tag",Pd).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),h1=lt(Vh).replace("hr",Wl).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pd).getRegex(),w3=lt(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",h1).getRegex(),Yh={blockquote:w3,code:p3,def:y3,fences:h3,heading:g3,hr:Wl,html:b3,lheading:p1,list:v3,newline:m3,paragraph:h1,table:cl,text:x3},vb=lt("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Wl).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[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pd).getRegex(),k3={...Yh,table:vb,paragraph:lt(Vh).replace("hr",Wl).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",vb).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Pd).getRegex()},j3={...Yh,html:lt(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Xh).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:cl,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:lt(Vh).replace("hr",Wl).replace("heading",` *#{1,6} *[^
|
|
454
|
-
]`).replace("lheading",p1).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},N3=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,S3=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,g1=/^( {2,}|\\)\n(?!\s*$)/,_3=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ld=/[\p{P}\p{S}]/u,Qh=/[\s\p{P}\p{S}]/u,x1=/[^\s\p{P}\p{S}]/u,$3=lt(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Qh).getRegex(),y1=/(?!~)[\p{P}\p{S}]/u,E3=/(?!~)[\s\p{P}\p{S}]/u,T3=/(?:[^\s\p{P}\p{S}]|~)/u,C3=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,v1=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,R3=lt(v1,"u").replace(/punct/g,Ld).getRegex(),A3=lt(v1,"u").replace(/punct/g,y1).getRegex(),b1="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",O3=lt(b1,"gu").replace(/notPunctSpace/g,x1).replace(/punctSpace/g,Qh).replace(/punct/g,Ld).getRegex(),M3=lt(b1,"gu").replace(/notPunctSpace/g,T3).replace(/punctSpace/g,E3).replace(/punct/g,y1).getRegex(),P3=lt("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,x1).replace(/punctSpace/g,Qh).replace(/punct/g,Ld).getRegex(),L3=lt(/\\(punct)/,"gu").replace(/punct/g,Ld).getRegex(),I3=lt(/^<(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(),z3=lt(Xh).replace("(?:-->|$)","-->").getRegex(),D3=lt("^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",z3).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Wu=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,F3=lt(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",Wu).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),w1=lt(/^!?\[(label)\]\[(ref)\]/).replace("label",Wu).replace("ref",Kh).getRegex(),k1=lt(/^!?\[(ref)\](?:\[\])?/).replace("ref",Kh).getRegex(),U3=lt("reflink|nolink(?!\\()","g").replace("reflink",w1).replace("nolink",k1).getRegex(),Zh={_backpedal:cl,anyPunctuation:L3,autolink:I3,blockSkip:C3,br:g1,code:S3,del:cl,emStrongLDelim:R3,emStrongRDelimAst:O3,emStrongRDelimUnd:P3,escape:N3,link:F3,nolink:k1,punctuation:$3,reflink:w1,reflinkSearch:U3,tag:D3,text:_3,url:cl},W3={...Zh,link:lt(/^!?\[(label)\]\((.*?)\)/).replace("label",Wu).getRegex(),reflink:lt(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Wu).getRegex()},Up={...Zh,emStrongRDelimAst:M3,emStrongLDelim:A3,url:lt(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").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~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},H3={...Up,br:lt(g1).replace("{2,}","*").getRegex(),text:lt(Up.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},uu={normal:Yh,gfm:k3,pedantic:j3},Yi={normal:Zh,gfm:Up,breaks:H3,pedantic:W3},B3={"&":"&","<":"<",">":">",'"':""","'":"'"},bb=e=>B3[e];function Ys(e,t){if(t){if(jn.escapeTest.test(e))return e.replace(jn.escapeReplace,bb)}else if(jn.escapeTestNoEncode.test(e))return e.replace(jn.escapeReplaceNoEncode,bb);return e}function wb(e){try{e=encodeURI(e).replace(jn.percentDecode,"%")}catch{return null}return e}function kb(e,t){var l;const n=e.replace(jn.findPipe,(c,u,f)=>{let p=!1,h=u;for(;--h>=0&&f[h]==="\\";)p=!p;return p?"|":" |"}),o=n.split(jn.splitPipe);let i=0;if(o[0].trim()||o.shift(),o.length>0&&!((l=o.at(-1))!=null&&l.trim())&&o.pop(),t)if(o.length>t)o.splice(t);else for(;o.length<t;)o.push("");for(;i<o.length;i++)o[i]=o[i].trim().replace(jn.slashPipe,"|");return o}function Qi(e,t,n){const o=e.length;if(o===0)return"";let i=0;for(;i<o&&e.charAt(o-i-1)===t;)i++;return e.slice(0,o-i)}function G3(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let o=0;o<e.length;o++)if(e[o]==="\\")o++;else if(e[o]===t[0])n++;else if(e[o]===t[1]&&(n--,n<0))return o;return-1}function jb(e,t,n,o,i){const l=t.href,c=t.title||null,u=e[1].replace(i.other.outputLinkReplace,"$1");if(e[0].charAt(0)!=="!"){o.state.inLink=!0;const f={type:"link",raw:n,href:l,title:c,text:u,tokens:o.inlineTokens(u)};return o.state.inLink=!1,f}return{type:"image",raw:n,href:l,title:c,text:u}}function q3(e,t,n){const o=e.match(n.other.indentCodeCompensation);if(o===null)return t;const i=o[1];return t.split(`
|
|
455
|
-
`).map(l=>{const c=l.match(n.other.beginningSpace);if(c===null)return l;const[u]=c;return u.length>=i.length?l.slice(i.length):l}).join(`
|
|
456
|
-
`)}class Hu{constructor(t){st(this,"options");st(this,"rules");st(this,"lexer");this.options=t||Vo}space(t){const n=this.rules.block.newline.exec(t);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(t){const n=this.rules.block.code.exec(t);if(n){const o=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?o:Qi(o,`
|
|
457
|
-
`)}}}fences(t){const n=this.rules.block.fences.exec(t);if(n){const o=n[0],i=q3(o,n[3]||"",this.rules);return{type:"code",raw:o,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:i}}}heading(t){const n=this.rules.block.heading.exec(t);if(n){let o=n[2].trim();if(this.rules.other.endingHash.test(o)){const i=Qi(o,"#");(this.options.pedantic||!i||this.rules.other.endingSpaceChar.test(i))&&(o=i.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:o,tokens:this.lexer.inline(o)}}}hr(t){const n=this.rules.block.hr.exec(t);if(n)return{type:"hr",raw:Qi(n[0],`
|
|
458
|
-
`)}}blockquote(t){const n=this.rules.block.blockquote.exec(t);if(n){let o=Qi(n[0],`
|
|
459
|
-
`).split(`
|
|
460
|
-
`),i="",l="";const c=[];for(;o.length>0;){let u=!1;const f=[];let p;for(p=0;p<o.length;p++)if(this.rules.other.blockquoteStart.test(o[p]))f.push(o[p]),u=!0;else if(!u)f.push(o[p]);else break;o=o.slice(p);const h=f.join(`
|
|
461
|
-
`),b=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
462
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");i=i?`${i}
|
|
463
|
-
${h}`:h,l=l?`${l}
|
|
464
|
-
${b}`:b;const x=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(b,c,!0),this.lexer.state.top=x,o.length===0)break;const m=c.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){const v=m,w=v.raw+`
|
|
465
|
-
`+o.join(`
|
|
466
|
-
`),j=this.blockquote(w);c[c.length-1]=j,i=i.substring(0,i.length-v.raw.length)+j.raw,l=l.substring(0,l.length-v.text.length)+j.text;break}else if((m==null?void 0:m.type)==="list"){const v=m,w=v.raw+`
|
|
467
|
-
`+o.join(`
|
|
468
|
-
`),j=this.list(w);c[c.length-1]=j,i=i.substring(0,i.length-m.raw.length)+j.raw,l=l.substring(0,l.length-v.raw.length)+j.raw,o=w.substring(c.at(-1).raw.length).split(`
|
|
469
|
-
`);continue}}return{type:"blockquote",raw:i,tokens:c,text:l}}}list(t){let n=this.rules.block.list.exec(t);if(n){let o=n[1].trim();const i=o.length>1,l={type:"list",raw:"",ordered:i,start:i?+o.slice(0,-1):"",loose:!1,items:[]};o=i?`\\d{1,9}\\${o.slice(-1)}`:`\\${o}`,this.options.pedantic&&(o=i?o:"[*+-]");const c=this.rules.other.listItemRegex(o);let u=!1;for(;t;){let p=!1,h="",b="";if(!(n=c.exec(t))||this.rules.block.hr.test(t))break;h=n[0],t=t.substring(h.length);let x=n[2].split(`
|
|
470
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,T=>" ".repeat(3*T.length)),m=t.split(`
|
|
471
|
-
`,1)[0],v=!x.trim(),w=0;if(this.options.pedantic?(w=2,b=x.trimStart()):v?w=n[1].length+1:(w=n[2].search(this.rules.other.nonSpaceChar),w=w>4?1:w,b=x.slice(w),w+=n[1].length),v&&this.rules.other.blankLine.test(m)&&(h+=m+`
|
|
472
|
-
`,t=t.substring(m.length+1),p=!0),!p){const T=this.rules.other.nextBulletRegex(w),$=this.rules.other.hrRegex(w),_=this.rules.other.fencesBeginRegex(w),E=this.rules.other.headingBeginRegex(w),R=this.rules.other.htmlBeginRegex(w);for(;t;){const C=t.split(`
|
|
473
|
-
`,1)[0];let O;if(m=C,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting," "),O=m):O=m.replace(this.rules.other.tabCharGlobal," "),_.test(m)||E.test(m)||R.test(m)||T.test(m)||$.test(m))break;if(O.search(this.rules.other.nonSpaceChar)>=w||!m.trim())b+=`
|
|
474
|
-
`+O.slice(w);else{if(v||x.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(x)||E.test(x)||$.test(x))break;b+=`
|
|
475
|
-
`+m}!v&&!m.trim()&&(v=!0),h+=C+`
|
|
476
|
-
`,t=t.substring(C.length+1),x=O.slice(w)}}l.loose||(u?l.loose=!0:this.rules.other.doubleBlankLine.test(h)&&(u=!0));let j=null,S;this.options.gfm&&(j=this.rules.other.listIsTask.exec(b),j&&(S=j[0]!=="[ ] ",b=b.replace(this.rules.other.listReplaceTask,""))),l.items.push({type:"list_item",raw:h,task:!!j,checked:S,loose:!1,text:b,tokens:[]}),l.raw+=h}const f=l.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;l.raw=l.raw.trimEnd();for(let p=0;p<l.items.length;p++)if(this.lexer.state.top=!1,l.items[p].tokens=this.lexer.blockTokens(l.items[p].text,[]),!l.loose){const h=l.items[p].tokens.filter(x=>x.type==="space"),b=h.length>0&&h.some(x=>this.rules.other.anyLine.test(x.raw));l.loose=b}if(l.loose)for(let p=0;p<l.items.length;p++)l.items[p].loose=!0;return l}}html(t){const n=this.rules.block.html.exec(t);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(t){const n=this.rules.block.def.exec(t);if(n){const o=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),i=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",l=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:o,raw:n[0],href:i,title:l}}}table(t){var u;const n=this.rules.block.table.exec(t);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const o=kb(n[1]),i=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),l=(u=n[3])!=null&&u.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
477
|
-
`):[],c={type:"table",raw:n[0],header:[],align:[],rows:[]};if(o.length===i.length){for(const f of i)this.rules.other.tableAlignRight.test(f)?c.align.push("right"):this.rules.other.tableAlignCenter.test(f)?c.align.push("center"):this.rules.other.tableAlignLeft.test(f)?c.align.push("left"):c.align.push(null);for(let f=0;f<o.length;f++)c.header.push({text:o[f],tokens:this.lexer.inline(o[f]),header:!0,align:c.align[f]});for(const f of l)c.rows.push(kb(f,c.header.length).map((p,h)=>({text:p,tokens:this.lexer.inline(p),header:!1,align:c.align[h]})));return c}}lheading(t){const n=this.rules.block.lheading.exec(t);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(t){const n=this.rules.block.paragraph.exec(t);if(n){const o=n[1].charAt(n[1].length-1)===`
|
|
478
|
-
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:o,tokens:this.lexer.inline(o)}}}text(t){const n=this.rules.block.text.exec(t);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(t){const n=this.rules.inline.escape.exec(t);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(t){const n=this.rules.inline.tag.exec(t);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(t){const n=this.rules.inline.link.exec(t);if(n){const o=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(o)){if(!this.rules.other.endAngleBracket.test(o))return;const c=Qi(o.slice(0,-1),"\\");if((o.length-c.length)%2===0)return}else{const c=G3(n[2],"()");if(c>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+c;n[2]=n[2].substring(0,c),n[0]=n[0].substring(0,f).trim(),n[3]=""}}let i=n[2],l="";if(this.options.pedantic){const c=this.rules.other.pedanticHrefTitle.exec(i);c&&(i=c[1],l=c[3])}else l=n[3]?n[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(o)?i=i.slice(1):i=i.slice(1,-1)),jb(n,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:l&&l.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(t,n){let o;if((o=this.rules.inline.reflink.exec(t))||(o=this.rules.inline.nolink.exec(t))){const i=(o[2]||o[1]).replace(this.rules.other.multipleSpaceGlobal," "),l=n[i.toLowerCase()];if(!l){const c=o[0].charAt(0);return{type:"text",raw:c,text:c}}return jb(o,l,o[0],this.lexer,this.rules)}}emStrong(t,n,o=""){let i=this.rules.inline.emStrongLDelim.exec(t);if(!i||i[3]&&o.match(this.rules.other.unicodeAlphaNumeric))return;if(!(i[1]||i[2]||"")||!o||this.rules.inline.punctuation.exec(o)){const c=[...i[0]].length-1;let u,f,p=c,h=0;const b=i[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(b.lastIndex=0,n=n.slice(-1*t.length+c);(i=b.exec(n))!=null;){if(u=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!u)continue;if(f=[...u].length,i[3]||i[4]){p+=f;continue}else if((i[5]||i[6])&&c%3&&!((c+f)%3)){h+=f;continue}if(p-=f,p>0)continue;f=Math.min(f,f+p+h);const x=[...i[0]][0].length,m=t.slice(0,c+i.index+x+f);if(Math.min(c,f)%2){const w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}const v=m.slice(2,-2);return{type:"strong",raw:m,text:v,tokens:this.lexer.inlineTokens(v)}}}}codespan(t){const n=this.rules.inline.code.exec(t);if(n){let o=n[2].replace(this.rules.other.newLineCharGlobal," ");const i=this.rules.other.nonSpaceChar.test(o),l=this.rules.other.startingSpaceChar.test(o)&&this.rules.other.endingSpaceChar.test(o);return i&&l&&(o=o.substring(1,o.length-1)),{type:"codespan",raw:n[0],text:o}}}br(t){const n=this.rules.inline.br.exec(t);if(n)return{type:"br",raw:n[0]}}del(t){const n=this.rules.inline.del.exec(t);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(t){const n=this.rules.inline.autolink.exec(t);if(n){let o,i;return n[2]==="@"?(o=n[1],i="mailto:"+o):(o=n[1],i=o),{type:"link",raw:n[0],text:o,href:i,tokens:[{type:"text",raw:o,text:o}]}}}url(t){var o;let n;if(n=this.rules.inline.url.exec(t)){let i,l;if(n[2]==="@")i=n[0],l="mailto:"+i;else{let c;do c=n[0],n[0]=((o=this.rules.inline._backpedal.exec(n[0]))==null?void 0:o[0])??"";while(c!==n[0]);i=n[0],n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(t){const n=this.rules.inline.text.exec(t);if(n){const o=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:o}}}}class xs{constructor(t){st(this,"tokens");st(this,"options");st(this,"state");st(this,"tokenizer");st(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Vo,this.options.tokenizer=this.options.tokenizer||new Hu,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:jn,block:uu.normal,inline:Yi.normal};this.options.pedantic?(n.block=uu.pedantic,n.inline=Yi.pedantic):this.options.gfm&&(n.block=uu.gfm,this.options.breaks?n.inline=Yi.breaks:n.inline=Yi.gfm),this.tokenizer.rules=n}static get rules(){return{block:uu,inline:Yi}}static lex(t,n){return new xs(n).lex(t)}static lexInline(t,n){return new xs(n).inlineTokens(t)}lex(t){t=t.replace(jn.carriageReturn,`
|
|
479
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const o=this.inlineQueue[n];this.inlineTokens(o.src,o.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],o=!1){var i,l,c;for(this.options.pedantic&&(t=t.replace(jn.tabCharGlobal," ").replace(jn.spaceLine,""));t;){let u;if((l=(i=this.options.extensions)==null?void 0:i.block)!=null&&l.some(p=>(u=p.call({lexer:this},t,n))?(t=t.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.space(t)){t=t.substring(u.raw.length);const p=n.at(-1);u.raw.length===1&&p!==void 0?p.raw+=`
|
|
480
|
-
`:n.push(u);continue}if(u=this.tokenizer.code(t)){t=t.substring(u.raw.length);const p=n.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=`
|
|
481
|
-
`+u.raw,p.text+=`
|
|
482
|
-
`+u.text,this.inlineQueue.at(-1).src=p.text):n.push(u);continue}if(u=this.tokenizer.fences(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.heading(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.hr(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.blockquote(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.list(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.html(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.def(t)){t=t.substring(u.raw.length);const p=n.at(-1);(p==null?void 0:p.type)==="paragraph"||(p==null?void 0:p.type)==="text"?(p.raw+=`
|
|
483
|
-
`+u.raw,p.text+=`
|
|
484
|
-
`+u.raw,this.inlineQueue.at(-1).src=p.text):this.tokens.links[u.tag]||(this.tokens.links[u.tag]={href:u.href,title:u.title});continue}if(u=this.tokenizer.table(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.lheading(t)){t=t.substring(u.raw.length),n.push(u);continue}let f=t;if((c=this.options.extensions)!=null&&c.startBlock){let p=1/0;const h=t.slice(1);let b;this.options.extensions.startBlock.forEach(x=>{b=x.call({lexer:this},h),typeof b=="number"&&b>=0&&(p=Math.min(p,b))}),p<1/0&&p>=0&&(f=t.substring(0,p+1))}if(this.state.top&&(u=this.tokenizer.paragraph(f))){const p=n.at(-1);o&&(p==null?void 0:p.type)==="paragraph"?(p.raw+=`
|
|
485
|
-
`+u.raw,p.text+=`
|
|
486
|
-
`+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(u),o=f.length!==t.length,t=t.substring(u.raw.length);continue}if(u=this.tokenizer.text(t)){t=t.substring(u.raw.length);const p=n.at(-1);(p==null?void 0:p.type)==="text"?(p.raw+=`
|
|
487
|
-
`+u.raw,p.text+=`
|
|
488
|
-
`+u.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=p.text):n.push(u);continue}if(t){const p="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(p);break}else throw new Error(p)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var u,f,p;let o=t,i=null;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(o))!=null;)h.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(o=o.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.blockSkip.exec(o))!=null;)o=o.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+o.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(o))!=null;)o=o.slice(0,i.index)+"++"+o.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let l=!1,c="";for(;t;){l||(c=""),l=!1;let h;if((f=(u=this.options.extensions)==null?void 0:u.inline)!=null&&f.some(x=>(h=x.call({lexer:this},t,n))?(t=t.substring(h.raw.length),n.push(h),!0):!1))continue;if(h=this.tokenizer.escape(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.tag(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.link(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(h.raw.length);const x=n.at(-1);h.type==="text"&&(x==null?void 0:x.type)==="text"?(x.raw+=h.raw,x.text+=h.text):n.push(h);continue}if(h=this.tokenizer.emStrong(t,o,c)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.codespan(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.br(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.del(t)){t=t.substring(h.raw.length),n.push(h);continue}if(h=this.tokenizer.autolink(t)){t=t.substring(h.raw.length),n.push(h);continue}if(!this.state.inLink&&(h=this.tokenizer.url(t))){t=t.substring(h.raw.length),n.push(h);continue}let b=t;if((p=this.options.extensions)!=null&&p.startInline){let x=1/0;const m=t.slice(1);let v;this.options.extensions.startInline.forEach(w=>{v=w.call({lexer:this},m),typeof v=="number"&&v>=0&&(x=Math.min(x,v))}),x<1/0&&x>=0&&(b=t.substring(0,x+1))}if(h=this.tokenizer.inlineText(b)){t=t.substring(h.raw.length),h.raw.slice(-1)!=="_"&&(c=h.raw.slice(-1)),l=!0;const x=n.at(-1);(x==null?void 0:x.type)==="text"?(x.raw+=h.raw,x.text+=h.text):n.push(h);continue}if(t){const x="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(x);break}else throw new Error(x)}}return n}}class Bu{constructor(t){st(this,"options");st(this,"parser");this.options=t||Vo}space(t){return""}code({text:t,lang:n,escaped:o}){var c;const i=(c=(n||"").match(jn.notSpaceStart))==null?void 0:c[0],l=t.replace(jn.endingNewline,"")+`
|
|
489
|
-
`;return i?'<pre><code class="language-'+Ys(i)+'">'+(o?l:Ys(l,!0))+`</code></pre>
|
|
490
|
-
`:"<pre><code>"+(o?l:Ys(l,!0))+`</code></pre>
|
|
491
|
-
`}blockquote({tokens:t}){return`<blockquote>
|
|
492
|
-
${this.parser.parse(t)}</blockquote>
|
|
493
|
-
`}html({text:t}){return t}heading({tokens:t,depth:n}){return`<h${n}>${this.parser.parseInline(t)}</h${n}>
|
|
494
|
-
`}hr(t){return`<hr>
|
|
495
|
-
`}list(t){const n=t.ordered,o=t.start;let i="";for(let u=0;u<t.items.length;u++){const f=t.items[u];i+=this.listitem(f)}const l=n?"ol":"ul",c=n&&o!==1?' start="'+o+'"':"";return"<"+l+c+`>
|
|
496
|
-
`+i+"</"+l+`>
|
|
497
|
-
`}listitem(t){var o;let n="";if(t.task){const i=this.checkbox({checked:!!t.checked});t.loose?((o=t.tokens[0])==null?void 0:o.type)==="paragraph"?(t.tokens[0].text=i+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=i+" "+Ys(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:i+" ",text:i+" ",escaped:!0}):n+=i+" "}return n+=this.parser.parse(t.tokens,!!t.loose),`<li>${n}</li>
|
|
498
|
-
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
|
|
499
|
-
`}table(t){let n="",o="";for(let l=0;l<t.header.length;l++)o+=this.tablecell(t.header[l]);n+=this.tablerow({text:o});let i="";for(let l=0;l<t.rows.length;l++){const c=t.rows[l];o="";for(let u=0;u<c.length;u++)o+=this.tablecell(c[u]);i+=this.tablerow({text:o})}return i&&(i=`<tbody>${i}</tbody>`),`<table>
|
|
500
|
-
<thead>
|
|
501
|
-
`+n+`</thead>
|
|
502
|
-
`+i+`</table>
|
|
503
|
-
`}tablerow({text:t}){return`<tr>
|
|
504
|
-
${t}</tr>
|
|
505
|
-
`}tablecell(t){const n=this.parser.parseInline(t.tokens),o=t.header?"th":"td";return(t.align?`<${o} align="${t.align}">`:`<${o}>`)+n+`</${o}>
|
|
506
|
-
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${Ys(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:n,tokens:o}){const i=this.parser.parseInline(o),l=wb(t);if(l===null)return i;t=l;let c='<a href="'+t+'"';return n&&(c+=' title="'+Ys(n)+'"'),c+=">"+i+"</a>",c}image({href:t,title:n,text:o}){const i=wb(t);if(i===null)return Ys(o);t=i;let l=`<img src="${t}" alt="${o}"`;return n&&(l+=` title="${Ys(n)}"`),l+=">",l}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:Ys(t.text)}}class Jh{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}}class ys{constructor(t){st(this,"options");st(this,"renderer");st(this,"textRenderer");this.options=t||Vo,this.options.renderer=this.options.renderer||new Bu,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Jh}static parse(t,n){return new ys(n).parse(t)}static parseInline(t,n){return new ys(n).parseInline(t)}parse(t,n=!0){var i,l;let o="";for(let c=0;c<t.length;c++){const u=t[c];if((l=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&l[u.type]){const p=u,h=this.options.extensions.renderers[p.type].call({parser:this},p);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type)){o+=h||"";continue}}const f=u;switch(f.type){case"space":{o+=this.renderer.space(f);continue}case"hr":{o+=this.renderer.hr(f);continue}case"heading":{o+=this.renderer.heading(f);continue}case"code":{o+=this.renderer.code(f);continue}case"table":{o+=this.renderer.table(f);continue}case"blockquote":{o+=this.renderer.blockquote(f);continue}case"list":{o+=this.renderer.list(f);continue}case"html":{o+=this.renderer.html(f);continue}case"paragraph":{o+=this.renderer.paragraph(f);continue}case"text":{let p=f,h=this.renderer.text(p);for(;c+1<t.length&&t[c+1].type==="text";)p=t[++c],h+=`
|
|
507
|
-
`+this.renderer.text(p);n?o+=this.renderer.paragraph({type:"paragraph",raw:h,text:h,tokens:[{type:"text",raw:h,text:h,escaped:!0}]}):o+=h;continue}default:{const p='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}parseInline(t,n=this.renderer){var i,l;let o="";for(let c=0;c<t.length;c++){const u=t[c];if((l=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&l[u.type]){const p=this.options.extensions.renderers[u.type].call({parser:this},u);if(p!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(u.type)){o+=p||"";continue}}const f=u;switch(f.type){case"escape":{o+=n.text(f);break}case"html":{o+=n.html(f);break}case"link":{o+=n.link(f);break}case"image":{o+=n.image(f);break}case"strong":{o+=n.strong(f);break}case"em":{o+=n.em(f);break}case"codespan":{o+=n.codespan(f);break}case"br":{o+=n.br(f);break}case"del":{o+=n.del(f);break}case"text":{o+=n.text(f);break}default:{const p='Token with "'+f.type+'" type was not found.';if(this.options.silent)return console.error(p),"";throw new Error(p)}}}return o}}class ul{constructor(t){st(this,"options");st(this,"block");this.options=t||Vo}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?xs.lex:xs.lexInline}provideParser(){return this.block?ys.parse:ys.parseInline}}st(ul,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"]));class V3{constructor(...t){st(this,"defaults",qh());st(this,"options",this.setOptions);st(this,"parse",this.parseMarkdown(!0));st(this,"parseInline",this.parseMarkdown(!1));st(this,"Parser",ys);st(this,"Renderer",Bu);st(this,"TextRenderer",Jh);st(this,"Lexer",xs);st(this,"Tokenizer",Hu);st(this,"Hooks",ul);this.use(...t)}walkTokens(t,n){var i,l;let o=[];for(const c of t)switch(o=o.concat(n.call(this,c)),c.type){case"table":{const u=c;for(const f of u.header)o=o.concat(this.walkTokens(f.tokens,n));for(const f of u.rows)for(const p of f)o=o.concat(this.walkTokens(p.tokens,n));break}case"list":{const u=c;o=o.concat(this.walkTokens(u.items,n));break}default:{const u=c;(l=(i=this.defaults.extensions)==null?void 0:i.childTokens)!=null&&l[u.type]?this.defaults.extensions.childTokens[u.type].forEach(f=>{const p=u[f].flat(1/0);o=o.concat(this.walkTokens(p,n))}):u.tokens&&(o=o.concat(this.walkTokens(u.tokens,n)))}}return o}use(...t){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(o=>{const i={...o};if(i.async=this.defaults.async||i.async||!1,o.extensions&&(o.extensions.forEach(l=>{if(!l.name)throw new Error("extension name required");if("renderer"in l){const c=n.renderers[l.name];c?n.renderers[l.name]=function(...u){let f=l.renderer.apply(this,u);return f===!1&&(f=c.apply(this,u)),f}:n.renderers[l.name]=l.renderer}if("tokenizer"in l){if(!l.level||l.level!=="block"&&l.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const c=n[l.level];c?c.unshift(l.tokenizer):n[l.level]=[l.tokenizer],l.start&&(l.level==="block"?n.startBlock?n.startBlock.push(l.start):n.startBlock=[l.start]:l.level==="inline"&&(n.startInline?n.startInline.push(l.start):n.startInline=[l.start]))}"childTokens"in l&&l.childTokens&&(n.childTokens[l.name]=l.childTokens)}),i.extensions=n),o.renderer){const l=this.defaults.renderer||new Bu(this.defaults);for(const c in o.renderer){if(!(c in l))throw new Error(`renderer '${c}' does not exist`);if(["options","parser"].includes(c))continue;const u=c,f=o.renderer[u],p=l[u];l[u]=(...h)=>{let b=f.apply(l,h);return b===!1&&(b=p.apply(l,h)),b||""}}i.renderer=l}if(o.tokenizer){const l=this.defaults.tokenizer||new Hu(this.defaults);for(const c in o.tokenizer){if(!(c in l))throw new Error(`tokenizer '${c}' does not exist`);if(["options","rules","lexer"].includes(c))continue;const u=c,f=o.tokenizer[u],p=l[u];l[u]=(...h)=>{let b=f.apply(l,h);return b===!1&&(b=p.apply(l,h)),b}}i.tokenizer=l}if(o.hooks){const l=this.defaults.hooks||new ul;for(const c in o.hooks){if(!(c in l))throw new Error(`hook '${c}' does not exist`);if(["options","block"].includes(c))continue;const u=c,f=o.hooks[u],p=l[u];ul.passThroughHooks.has(c)?l[u]=h=>{if(this.defaults.async)return Promise.resolve(f.call(l,h)).then(x=>p.call(l,x));const b=f.call(l,h);return p.call(l,b)}:l[u]=(...h)=>{let b=f.apply(l,h);return b===!1&&(b=p.apply(l,h)),b}}i.hooks=l}if(o.walkTokens){const l=this.defaults.walkTokens,c=o.walkTokens;i.walkTokens=function(u){let f=[];return f.push(c.call(this,u)),l&&(f=f.concat(l.call(this,u))),f}}this.defaults={...this.defaults,...i}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,n){return xs.lex(t,n??this.defaults)}parser(t,n){return ys.parse(t,n??this.defaults)}parseMarkdown(t){return(o,i)=>{const 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 o>"u"||o===null)return u(new Error("marked(): input parameter is undefined or null"));if(typeof o!="string")return u(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(o)+", string expected"));c.hooks&&(c.hooks.options=c,c.hooks.block=t);const f=c.hooks?c.hooks.provideLexer():t?xs.lex:xs.lexInline,p=c.hooks?c.hooks.provideParser():t?ys.parse:ys.parseInline;if(c.async)return Promise.resolve(c.hooks?c.hooks.preprocess(o):o).then(h=>f(h,c)).then(h=>c.hooks?c.hooks.processAllTokens(h):h).then(h=>c.walkTokens?Promise.all(this.walkTokens(h,c.walkTokens)).then(()=>h):h).then(h=>p(h,c)).then(h=>c.hooks?c.hooks.postprocess(h):h).catch(u);try{c.hooks&&(o=c.hooks.preprocess(o));let h=f(o,c);c.hooks&&(h=c.hooks.processAllTokens(h)),c.walkTokens&&this.walkTokens(h,c.walkTokens);let b=p(h,c);return c.hooks&&(b=c.hooks.postprocess(b)),b}catch(h){return u(h)}}}onError(t,n){return o=>{if(o.message+=`
|
|
508
|
-
Please report this to https://github.com/markedjs/marked.`,t){const i="<p>An error occurred:</p><pre>"+Ys(o.message+"",!0)+"</pre>";return n?Promise.resolve(i):i}if(n)return Promise.reject(o);throw o}}}const Wo=new V3;function rt(e,t){return Wo.parse(e,t)}rt.options=rt.setOptions=function(e){return Wo.setOptions(e),rt.defaults=Wo.defaults,f1(rt.defaults),rt};rt.getDefaults=qh;rt.defaults=Vo;rt.use=function(...e){return Wo.use(...e),rt.defaults=Wo.defaults,f1(rt.defaults),rt};rt.walkTokens=function(e,t){return Wo.walkTokens(e,t)};rt.parseInline=Wo.parseInline;rt.Parser=ys;rt.parser=ys.parse;rt.Renderer=Bu;rt.TextRenderer=Jh;rt.Lexer=xs;rt.lexer=xs.lex;rt.Tokenizer=Hu;rt.Hooks=ul;rt.parse=rt;rt.options;rt.setOptions;rt.use;rt.walkTokens;rt.parseInline;ys.parse;xs.lex;let Zi;const K3=e=>(Zi||(Tu.addHook("uponSanitizeElement",(t,n)=>{Zi??(Zi=n.allowedTags)}),Tu.sanitize("<b></b>"),Tu.removeHook("uponSanitizeElement")),(Zi==null?void 0:Zi[e.toLowerCase()])===!0),X3=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");rt.use({breaks:!0,renderer:{html:({text:e,block:t})=>{let n=0;const o=e.replace(/<\/?([A-Za-z][\w:-]*)[^<>]*>/g,(i,l)=>K3(l)?(n++,i):X3(i));return t&&!n&&o!==e?`<p>${o.trim().replace(/\n/g,`<br>
|
|
509
|
-
`)}</p>
|
|
510
|
-
`:o}}});const Hl=e=>e.slice(-8),Id=e=>new Date(e).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"}),St=e=>new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"});function Ha(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}const j1=e=>e.basis==="estimate",eg=e=>e>0&&e<1e-4?"<$0.0001":e<.01?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`,Nb=e=>{if(e>0&&e<1e-4)return"<$0.0001";if(e>=1)return`$${e.toFixed(2)}`;const[t,n=""]=e.toFixed(4).split(".");return`$${t}.${n.replace(/0+$/,"").padEnd(2,"0")}`},ni=e=>e&&e.usd===null&&typeof e.so_far_usd=="number"&&typeof e.unpriced=="number"?e:void 0,Y3=(e,{ended:t=!1}={})=>`The charges priced${t?"":" so far"}. ${e.unpriced} ${e.unpriced===1?"charge has":"charges have"} no price, so this is not the whole cost.`,Q3=new Set(["completed","failed","cancelled"]),kl=e=>typeof e=="string"&&Q3.has(e);function oo(e,{ended:t=!1}={}){const n=ni(e),o=i=>j1(i)?" est.":"";return n?t?`${Nb(n.so_far_usd)}${o(n)} known · ${n.unpriced} not priced`:`so far ${Nb(n.so_far_usd)}${o(n)} · ${n.unpriced} not priced`:!e||e.usd===null?"Unknown":`${eg(e.usd)}${o(e)}`}function Sb(e,t,{ended:n=!1,text:o}={}){const i=o??oo(e,{ended:n});return typeof t!="number"?i:(o!==void 0?Z3.test(o):!ni(e)&&!!e&&e.usd!==null)?`${i} of ${_b(t)}`:`${i} · cap ${_b(t)}`}const Z3=/^<?\$[\d.,]+( est\.)?$/;function _b(e){for(let t=2;t<8;t++)if(Number(e.toFixed(t))===e)return`$${e.toFixed(t)}`;return`$${e.toFixed(8)}`}function J3(e,t){if(e.startsWith("/")||e.startsWith("#"))return null;const n=t.from?`${t.from.replace(/\/*$/,"").split("/").map(encodeURIComponent).join("/")}/`:"";try{const o=decodeURIComponent(new URL(e,`file:///${n}`).pathname.slice(1));return t.paths.includes(o)?o:null}catch{return null}}function Ba(e,t){const n=Tu.sanitize(rt.parse(e,{async:!1}),{RETURN_DOM:!0});for(const o of[...n.querySelectorAll("a[href]")]){const i=o.getAttribute("href").trim();if(/^(https?|ftps?):/i.test(i)){o.setAttribute("target","_blank"),o.setAttribute("rel","noopener noreferrer");continue}if(/^[a-z][a-z\d+.-]*:/i.test(i))continue;const l=t&&J3(i,t);if(l){const c=o.ownerDocument.createElement("button");c.type="button",c.title=`Open ${l}`,c.dataset.runFile=l,c.append(...o.childNodes),o.replaceWith(c)}else o.replaceWith(...o.childNodes)}return n.innerHTML}const N1=e=>t=>{var o,i,l;const n=(l=(i=(o=t.target).closest)==null?void 0:i.call(o,"[data-run-file]"))==null?void 0:l.getAttribute("data-run-file");n&&(t.preventDefault(),e(n))},e4=e=>{const t=n=>{var o;return(o=new RegExp(`\\b${n}="([^"]*)"`).exec(e))==null?void 0:o[1]};return t("scheme")==="github"||t("source")==="github"?"A GitHub event":t("source")==="webhook"?"A webhook request":"A trigger's request"};function rn(e){const{title:t}=e;if(!e.trigger)return t;let n=t.search(/<trigger-payload\b/);if(n<0){const i=/<([a-z-]*)…$/.exec(t);if(!i||!"trigger-payload".startsWith(i[1]))return t;n=i.index}return t.slice(0,n).trim()||e4(t.slice(n))}function t4(e){return e.usd===null?{total:"Unknown"}:{total:oo({usd:e.usd,basis:"estimate",charge_state:null,cap_usd:null}),...e.unknownRuns?{note:`${e.unknownRuns} ${e.unknownRuns===1?"run":"runs"} unknown`}:{}}}const tg=[{id:"7d",label:"7 days",days:7},{id:"30d",label:"30 days",days:30},{id:"all",label:"All",days:null}],Ma=864e5,Wp=e=>Math.floor(e/Ma)*Ma;function ng(e,t=Date.now()){var o;const n=(o=tg.find(i=>i.id===e))==null?void 0:o.days;return n?new Date(Wp(t)-(n-1)*Ma).toISOString():void 0}const S1=e=>e.completed+e.failed?(e.completed-e.needs_review)/(e.completed+e.failed):null;function n4(e){return[`${e.completed-e.needs_review} completed`,`${e.failed} failed`,e.needs_review?`${e.needs_review} ${e.needs_review===1?"needs":"need"} review`:""].filter(Boolean).join(" · ")}function s4(e){const t=e.input+e.cache_read+e.cache_write;return t?e.cache_read/t:null}const _1=(e,t)=>t4({usd:e.cost_usd,unknownRuns:e.unknown_cost_runs}),sg=e=>e.runs_with_metrics<e.runs?`tokens from ${e.runs_with_metrics} of ${e.runs} runs`:void 0;function Ho(e){if(e<1e4)return e.toLocaleString("en-US");const[t,n]=e<1e6?[e/1e3,"K"]:e<1e9?[e/1e6,"M"]:[e/1e9,"B"];return`${t<100?t.toFixed(1).replace(/\.0$/,""):Math.round(t)}${n}`}const Gu=e=>e===null?"—":`${Math.round(e*100)}%`;function $b(e){return e>=36e5?`${(e/36e5).toFixed(1).replace(/\.0$/,"")} h`:e>=6e4?`${Math.round(e/6e4)} min`:`${Math.round(e/1e3)} s`}function r4(e,t,n=Date.now()){if(!e.length)return[];const o=Wp(n),i=Math.max(o-29*Ma,t?Wp(Date.parse(t)):o-29*Ma),l=new Map(e.map(u=>[u.day,u])),c=[];for(let u=i;u<=o;u+=Ma){const f=new Date(u).toISOString().slice(0,10);c.push(l.get(f)??{day:f,runs:0,completed:0,failed:0,needs_review:0,runs_with_metrics:0,tokens:0,cost_usd:null,unknown_cost_runs:0})}return c}function o4(e,t){return{agents:e.agents,runs:{total:e.runs.total,active:e.runs.active,needsInput:e.runs.needs_input,failed:e.runs.failed,statusUnknown:e.runs.status_unknown,needsReview:e.runs.needs_review},perAgent:e.per_agent.map(n=>({agentId:n.agent_id,name:n.name,runs:n.runs})).sort((n,o)=>a1({name:n.name,id:n.agentId},{name:o.name,id:o.agentId})),cost:{usd:e.cost.usd,basis:e.cost.basis,unknownRuns:e.cost.unknown_runs},recent:t,analytics:e.analytics}}function $1({range:e,onRange:t,agent:n,agents:o,onAgent:i}){return s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(c$,{label:"Range",name:"mission-range",value:e,onChange:t,options:tg.map(l=>({value:l.id,label:l.label}))}),i&&o.length>0&&s.jsx(Kt,{label:"Agent",value:n??"",onChange:l=>i(l||null),className:"h-[38px] w-56",options:[{value:"",label:"All agents"},...o.map(l=>({value:l.agentId,label:l.name}))]})]})}const Cu=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`;function E1({a:e,basis:t,now:n=Date.now(),refreshing:o=!1}){const i=e.totals,l=s4(i),c=S1(i),u=_1(i),f=[{label:"Tokens",value:Ho(i.tokens),notes:[`${l===null?"":`${Gu(l)} of input cached · `}${Ho(i.output)} output`,sg(i),i.unmetered?`${Cu(i.unmetered,"request")} with no token count`:void 0]},{label:"Run time",value:$b(e.time.wall_ms),notes:[`wall time of ${Cu(e.time.ended_runs,"ended run")}`,e.time.active_runs?`${$b(e.time.active_ms)} active, over ${Cu(e.time.active_runs,"run")}`:void 0]},{label:"Success rate",value:Gu(c),notes:[i.completed+i.failed?n4(i):"No run completed or failed yet"]},{label:"Cost",value:u.total,notes:[u.note]}];return s.jsxs("div",{className:oe("space-y-6 transition-opacity",o&&"opacity-60"),"aria-busy":o,children:[s.jsx("ul",{className:"grid grid-cols-2 gap-3 xl:grid-cols-4",children:f.map(p=>s.jsxs("li",{className:"border p-4",children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:p.label}),s.jsx("p",{className:"mt-2 font-mono text-xl font-semibold",children:p.value}),p.notes.filter(Boolean).map(h=>s.jsx("p",{className:"mt-1 font-mono text-label text-muted-foreground",children:h},h))]},p.label))}),s.jsx(c4,{days:r4(e.by_day,e.filter.from,n)}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 xl:grid-cols-2",children:[s.jsx(a4,{rows:e.by_harness_effort,basis:t}),s.jsx(i4,{tools:e.tools})]}),s.jsx(l4,{groups:e.by_source})]})}function qu({title:e,children:t}){return s.jsxs("section",{className:"border",children:[s.jsx("h3",{className:"caps border-b px-4 py-3 text-small font-semibold",children:e}),t]})}const T1="px-4 py-2 text-left font-normal",Qs="px-4 py-2.5 align-top";function a4({rows:e,basis:t}){return s.jsx(qu,{title:"Success by harness and effort",children:e.length?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-collapse text-body",children:[s.jsx("thead",{children:s.jsx("tr",{className:"caps border-b text-label text-muted-foreground",children:["Harness","Effort","Runs","Success","Tokens","Cost"].map(n=>s.jsx("th",{className:T1,children:n},n))})}),s.jsx("tbody",{children:e.map(n=>{const o=_1(n),i=sg(n);return s.jsxs("tr",{className:"border-b font-mono last:border-b-0",children:[s.jsx("td",{className:Qs,children:n.harness}),s.jsx("td",{className:oe(Qs,!n.effort&&"text-muted-foreground"),children:n.effort??"unset"}),s.jsx("td",{className:Qs,children:n.runs}),s.jsx("td",{className:Qs,children:Gu(S1(n))}),s.jsxs("td",{className:Qs,children:[s.jsx("span",{className:"whitespace-nowrap",children:Ho(n.tokens)}),i&&s.jsx("span",{className:"block text-label text-muted-foreground",children:i})]}),s.jsxs("td",{className:Qs,children:[s.jsx("span",{className:"whitespace-nowrap",children:o.total}),o.note&&s.jsx("span",{className:"block text-label text-muted-foreground",children:o.note})]})]},`${n.harness}:${n.effort??""}`)})})]})}):s.jsx("p",{className:"px-4 py-6 text-center font-mono text-body text-muted-foreground",children:"No runs in this range."})})}function i4({tools:e}){return s.jsx(qu,{title:"Top tools",children:e.length?s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-collapse text-body",children:[s.jsx("thead",{children:s.jsx("tr",{className:"caps border-b text-label text-muted-foreground",children:["Tool","Calls","Errors","Error rate"].map(t=>s.jsx("th",{className:T1,children:t},t))})}),s.jsx("tbody",{children:e.map(t=>s.jsxs("tr",{className:"border-b font-mono last:border-b-0",children:[s.jsx("td",{className:Qs,title:t.tool,children:t.label}),s.jsx("td",{className:Qs,children:Ho(t.calls)}),s.jsx("td",{className:oe(Qs,t.errors>0&&"text-destructive-text"),children:Ho(t.errors)}),s.jsx("td",{className:Qs,children:Gu(t.calls?t.errors/t.calls:null)})]},t.tool))})]})}):s.jsx("p",{className:"px-4 py-6 text-center font-mono text-body text-muted-foreground",children:"No tool calls in runs with metrics."})})}function l4({groups:e}){return e.some(t=>t.source!=="live"&&t.runs>0)?s.jsx("p",{className:"font-mono text-small text-muted-foreground","aria-label":"Runs by source",children:e.map(t=>`${t.source==="live"?"Run here":`Imported from ${t.source}`}: ${Cu(t.runs,"run")}`).join(" · ")}):null}const op=e=>Math.max(0,e.runs-e.completed-e.failed);function Eb(e){if(e<=0)return 1;const t=10**Math.floor(Math.log10(e));return[1,2,5,10].map(n=>n*t).find(n=>n>=e)}const ap=e=>e.slice(5);function c4({days:e}){if(!e.some(l=>l.runs>0))return s.jsx(qu,{title:"Per day",children:s.jsxs("p",{className:"px-4 py-6 text-center font-mono text-body text-muted-foreground",children:["No runs started in this range",e.length?" in the last 30 days":"","."]})});const n=Eb(Math.max(...e.map(l=>l.runs))),o=Eb(Math.max(...e.map(l=>l.tokens))),i=[{key:"completed",label:"Completed",className:"bg-muted-foreground",of:l=>l.completed},{key:"failed",label:"Failed",className:"bg-destructive",of:l=>l.failed},{key:"other",label:"Other",className:"bg-border-strong",of:op}];return s.jsxs(qu,{title:`Per day, ${e[0].day} to ${e.at(-1).day} (UTC)`,children:[s.jsxs("div",{className:"grid grid-cols-1 gap-6 p-4 xl:grid-cols-2",children:[s.jsxs("figure",{children:[s.jsxs("figcaption",{className:"mb-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-small",children:[s.jsx("span",{className:"font-semibold",children:"Runs"}),i.map(l=>s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-muted-foreground",children:[s.jsx("span",{className:oe("inline-block size-2.5",l.className),"aria-hidden":!0}),l.label]},l.key))]}),s.jsx(Tb,{days:e,top:n,label:"Runs per day",stack:l=>i.map(c=>({className:c.className,value:c.of(l)})),readout:l=>[`${l.runs} ${l.runs===1?"run":"runs"}`,`${l.completed} completed · ${l.failed} failed · ${op(l)} other`]})]}),s.jsxs("figure",{children:[s.jsx("figcaption",{className:"mb-2 text-small font-semibold",children:"Tokens"}),s.jsx(Tb,{days:e,top:o,label:"Tokens per day",format:Ho,stack:l=>[{className:"bg-primary",value:l.tokens}],readout:l=>[`${Ho(l.tokens)} tokens`,sg(l)??`${l.runs} ${l.runs===1?"run":"runs"}`]})]})]}),s.jsxs("details",{className:"border-t px-4 py-2",children:[s.jsx("summary",{className:"caps cursor-pointer text-label text-muted-foreground",children:"Table"}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"mt-2 w-full border-collapse font-mono text-small",children:[s.jsx("thead",{children:s.jsx("tr",{className:"caps text-label text-muted-foreground",children:["Day","Runs","Completed","Failed","Other","Tokens"].map(l=>s.jsx("th",{className:"py-1 pr-4 text-left font-normal",children:l},l))})}),s.jsx("tbody",{children:e.map(l=>s.jsxs("tr",{children:[s.jsx("td",{className:"py-0.5 pr-4",children:l.day}),s.jsx("td",{className:"pr-4",children:l.runs}),s.jsx("td",{className:"pr-4",children:l.completed}),s.jsx("td",{className:"pr-4",children:l.failed}),s.jsx("td",{className:"pr-4",children:op(l)}),s.jsx("td",{className:"pr-4",children:l.tokens.toLocaleString("en-US")})]},l.day))})]})})]})]})}function Tb({days:e,top:t,label:n,stack:o,readout:i,format:l=c=>c.toLocaleString("en-US")}){return s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"flex w-10 shrink-0 flex-col justify-between text-right font-mono text-micro text-muted-foreground",style:{height:140},"aria-hidden":!0,children:[s.jsx("span",{children:l(t)}),s.jsx("span",{children:l(t/2)}),s.jsx("span",{children:"0"})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"relative flex items-end gap-px border-b border-border-strong",style:{height:140},role:"list","aria-label":n,children:[s.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-0 border-t border-border","aria-hidden":!0}),s.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-1/2 border-t border-border","aria-hidden":!0}),e.map(u=>{const f=o(u).filter(p=>p.value>0);return s.jsxs("div",{role:"listitem",tabIndex:0,"aria-label":`${u.day}: ${i(u).join(", ")}`,className:"group relative flex h-full min-w-0 flex-1 flex-col items-center justify-end outline-none hover:bg-accent/60 focus-visible:bg-accent/60",children:[s.jsx("div",{className:"flex w-full max-w-[24px] flex-col-reverse gap-[2px]",children:f.map((p,h)=>s.jsx("div",{className:oe(p.className,h===f.length-1&&""),style:{height:Math.max(1,Math.round(p.value/t*(140-2*(f.length-1))))}},h))}),s.jsxs("div",{className:"pointer-events-none absolute bottom-full left-1/2 z-raised mb-1 hidden -translate-x-1/2 whitespace-nowrap border bg-card px-2 py-1 text-left font-mono text-label shadow-float group-hover:block group-focus-visible:block",children:[s.jsx("span",{className:"block font-semibold",children:i(u)[0]}),i(u).slice(1).map(p=>s.jsx("span",{className:"block text-muted-foreground",children:p},p)),s.jsx("span",{className:"block text-muted-foreground",children:u.day})]})]},u.day)})]}),s.jsxs("div",{className:"mt-1 flex justify-between font-mono text-micro text-muted-foreground","aria-hidden":!0,children:[s.jsx("span",{children:ap(e[0].day)}),e.length>2&&s.jsx("span",{children:ap(e[Math.floor(e.length/2)].day)}),s.jsx("span",{children:ap(e.at(-1).day)})]})]})]})}function u4(e,t){if(t.unchanged&&!t.reset&&!t.drop.length&&!t.rows.length)return e;const n=new Map;if(!t.reset)for(const o of e)n.set(o.id,o);for(const o of t.drop)n.delete(o);for(const o of t.rows)n.set(o.id,o);return[...n.values()].sort((o,i)=>o.seq-i.seq)}const C1=e=>(e.kind==="tool_use"?e.tool_input_preview:e.kind==="tool_result"?e.tool_result_preview:e.text)??null,R1=e=>e.tool_status==="failed"||e.kind==="error",d4=e=>e.paused===!0;function f4(e){const t=new Map(e.filter(p=>p.kind==="tool_result"&&p.tool_use_id).map(p=>[p.tool_use_id,p])),n=new Set(e.filter(p=>p.kind==="tool_use"&&p.tool_use_id).map(p=>p.tool_use_id)),o=new Set(e.filter(p=>p.kind==="waiting"&&p.id.endsWith(":waiting")).map(p=>p.id.slice(0,-8))),i=p=>{var h;return o.has(p.id)||(p.tool_use_id?o.has(((h=t.get(p.tool_use_id))==null?void 0:h.id)??""):!1)},l=e.findLast(p=>p.kind==="usage"),c=[],u=new Map;let f;for(const p of e){if(p.kind==="usage")continue;if(p.tool_name==="ask_person"&&(p.kind==="tool_use"||p.kind==="tool_result")&&i(p)){f=void 0;continue}if(p.kind==="tool_result"&&p.tool_use_id&&n.has(p.tool_use_id)){f=u.get(p.tool_use_id);continue}if(p.kind==="phase"&&p.path&&f&&(f.row.kind==="tool_result"||f.row.kind==="tool_use")&&!f.saved){f.saved=p.path;continue}const h=c.at(-1);if(p.kind==="error"&&(h==null?void 0:h.row.kind)==="error"&&h.row.summary===p.summary&&h.row.text===p.text&&(h.row.agent_label??null)===(p.agent_label??null)){h.times=(h.times??1)+1,h.until=p.timestamp,f=h;continue}let b;const x=p.kind==="tool_use"&&p.tool_use_id?t.get(p.tool_use_id):void 0;if(x){const m=x.tool_status!=="failed",v=[p.tool_input_preview,x.tool_result_preview].filter(Boolean),w=x.tool_status!==null;b={row:{...x,id:p.id,seq:p.seq,timestamp:p.timestamp,summary:m?(x.summary??"").replace(/:\s*ok$/i,""):x.summary},...w?{ms:Math.max(0,Date.parse(x.timestamp)-Date.parse(p.timestamp))}:{},detail:v.length===2?`${v[0]}
|
|
511
|
-
|
|
512
|
-
→ ${v[1]}`:v[0]??null}}else b={row:p};c.push(b),p.kind==="tool_use"&&p.tool_use_id&&u.set(p.tool_use_id,b),f=b}return l&&c.push({row:l}),c}class Ee extends Error{constructor(n,o,i,l=!1,c){super(i);st(this,"fields");st(this,"retryAfterMs");st(this,"details");st(this,"problems");this.status=n,this.code=o,this.retryable=l,this.requestId=c,this.name="ClientError"}toApiError(){return{code:this.code,message:this.message,retryable:this.retryable,request_id:this.requestId,...this.details?{details:this.details}:{}}}}const Nn=e=>e instanceof Ee?`${e.code}: ${e.message}`:e instanceof Error?e.message:String(e),Cb=(e,t,{status:n,archived:o}={})=>{const i=new URLSearchParams({limit:String(e)});return t&&i.set("cursor",t),n&&i.set("status",n),o&&i.set("archived","true"),`?${i}`},m4=new Set(["/auth/sign-in","/setup"]);function p4({fetch:e=globalThis.fetch.bind(globalThis),base:t="/v2",onSignedOut:n}={}){async function o(m,v,w={}){return(await i(m,v,w)).body}async function i(m,v,{body:w,headers:j={},signal:S,text:T=!1}={}){var R;const $=w!==void 0||m!=="GET"&&m!=="HEAD",_=await e(`${t}${v}`,{method:m,signal:S,credentials:"same-origin",headers:{accept:"application/json",...$?{"content-type":"application/json"}:{},...j},body:w===void 0?void 0:JSON.stringify(w)});if(!_.ok){_.status===401&&!m4.has(v)&&(n==null||n());const C=(R=await _.json().catch(()=>null))==null?void 0:R.error,O=new Ee(_.status,(C==null?void 0:C.code)??"http_error",(C==null?void 0:C.message)??`${m} ${v}: ${_.status}`,(C==null?void 0:C.retryable)??!1,C==null?void 0:C.request_id);throw C!=null&&C.fields&&(O.fields=C.fields),typeof(C==null?void 0:C.retry_after_ms)=="number"&&(O.retryAfterMs=C.retry_after_ms),C!=null&&C.details&&typeof C.details=="object"&&!Array.isArray(C.details)&&(O.details=C.details),Array.isArray(C==null?void 0:C.problems)&&(O.problems=C.problems),O}return{body:!T&&(_.headers.get("content-type")??"").includes("json")?await _.json():await _.text(),etag:_.headers.get("etag"),status:_.status}}const l=m=>`/agents/${encodeURIComponent(m)}`,c=m=>`/runs/${encodeURIComponent(m)}`,u=m=>`/settings/mcp-servers/${encodeURIComponent(m)}`,f=m=>`/triggers/${encodeURIComponent(m)}`,p=new Map,h=(m,v)=>`${l(m)}/learning/files/${encodeURIComponent(v)}`,b=m=>({note:m.body,etag:m.etag}),x={accept:"text/markdown, application/json"};return{capabilities:()=>o("GET","/capabilities"),session:()=>i("GET","/auth/session").then(m=>({status:m.status,body:m.body})),signIn:m=>o("POST","/auth/sign-in",{body:{password:m}}),setup:(m,v,w=!1)=>o("POST","/setup",{body:{password:m,...v?{code:v}:{},...w?{import:!0}:{}}}),setupImport:()=>o("GET","/setup/import").then(m=>(m==null?void 0:m.offer)===!1?null:m,m=>{if(m instanceof Ee&&(m.status===404||m.status===403))return null;throw m}),signOut:()=>o("POST","/auth/sign-out",{body:{}}),signOutEverywhere:()=>o("POST","/auth/sign-out-everywhere",{body:{}}),stats:()=>o("GET","/stats"),listRuns:(m=50,v,w)=>o("GET",`/runs${Cb(m,v,w)}`),listAgentRuns:(m,v=50,w,j={})=>o("GET",`${l(m)}/runs${Cb(v,w,typeof j=="boolean"?{archived:j}:j)}`),listAgents:({archived:m=!1,cursor:v}={})=>{const w=new URLSearchParams;return m&&w.set("archived","true"),v&&w.set("cursor",v),o("GET",`/agents${w.size?`?${w}`:""}`)},getAgent:async m=>{const v=await i("GET",l(m)),w=p.get(m);return{agent:w&&w.revision===v.body.revision&&!v.body.warnings?{...v.body,warnings:w.warnings}:v.body,etag:v.etag}},createAgent:async m=>{var w;const v=await o("POST","/agents",{body:m});return(w=v.warnings)!=null&&w.length&&p.set(v.agent_id,{revision:v.revision,warnings:v.warnings}),v},updateDefinition:async(m,v,w)=>{const j=await i("PUT",`${l(m)}/definition`,{body:v,headers:w?{"if-match":w}:{}});return p.delete(m),{agent:j.body,etag:j.etag}},listRevisions:(m,v)=>o("GET",`${l(m)}/revisions${v?`?cursor=${encodeURIComponent(v)}`:""}`),setCurrent:async(m,v)=>{const w=await o("POST",`${l(m)}/current`,{body:{revision:v}});return p.delete(m),w},archiveAgent:m=>o("POST",`${l(m)}/archive`,{body:{}}),unarchiveAgent:m=>o("POST",`${l(m)}/unarchive`,{body:{}}),agentLearning:m=>o("GET",`${l(m)}/learning`),learningCost:(m,v)=>o("GET",`${l(m)}/learning/cost${v?`?limit=${v}`:""}`),learningNotes:(m,v)=>o("GET",`${l(m)}/learning/notes?cursor=${encodeURIComponent(v)}`),learningLog:(m,v)=>o("GET",`${l(m)}/learning/log?cursor=${encodeURIComponent(v)}`),readNote:async(m,v)=>b(await i("GET",h(m,v),{headers:x,text:!0})),writeNote:async(m,v,w,j)=>b(await i("PUT",h(m,v),{body:{text:w},headers:{...x,..."etag"in j?{"if-match":j.etag}:{"if-none-match":"*"}},text:!0})),retireNote:async(m,v,w)=>b(await i("POST",`${h(m,v)}/retire`,{body:{},headers:{...x,"if-match":w},text:!0})),approveNote:async(m,v,w)=>b(await i("POST",`${h(m,v)}/approve`,{body:{},headers:{...x,"if-match":w},text:!0})),restoreNote:async(m,v,w)=>b(await i("POST",`${h(m,v)}/restore`,{body:{},headers:{...x,"if-match":w},text:!0})),promoteWorkflow:async(m,v,w)=>{var S;const j=await o("POST",`${l(m)}/learning/workflows/${encodeURIComponent(v)}/promote`,{body:{},headers:{"idempotency-key":w}});return(S=j.warnings)!=null&&S.length&&p.set(j.agent_id,{revision:j.revision,warnings:j.warnings}),j},getRun:m=>o("GET",c(m)),runLearningDiff:m=>o("GET",`${c(m)}/learning/diff`),runLearning:m=>o("GET",`${c(m)}/learning`),runComputer:m=>o("GET",`${c(m)}/computer`),takeOverComputer:m=>o("POST",`${c(m)}/computer/take-over`,{body:{}}),handBackComputer:(m,v)=>o("POST",`${c(m)}/computer/hand-back`,{body:v?{outcome:v}:{}}),archiveRun:m=>o("POST",`${c(m)}/archive`,{body:{}}),unarchiveRun:m=>o("POST",`${c(m)}/unarchive`,{body:{}}),raiseCap:(m,v)=>o("PATCH",c(m),{body:{max_cost_usd:v}}),startRun:async(m,v,w)=>{const j=await i("POST",`${l(m)}/runs`,{body:v,headers:{"idempotency-key":w}});return{run:j.body,status:j.status}},getTimeline:(m,{after:v,waitMs:w,signal:j}={})=>{const S=new URLSearchParams;return v!==void 0&&S.set("after",String(v)),w!==void 0&&S.set("wait_ms",String(w)),o("GET",`${c(m)}/timeline${S.size?`?${S}`:""}`,{signal:j})},listFiles:m=>o("GET",`${c(m)}/files`),deleteUpload:m=>o("DELETE",`/files/${encodeURIComponent(m)}`),readFile:(m,v)=>o("GET",`${c(m)}/files/${v.split("/").map(encodeURIComponent).join("/")}`,{text:!0}),sendMessage:(m,v,w)=>o("POST",`${c(m)}/messages`,{body:{content:v},headers:{"idempotency-key":w}}),getRunGraph:(m,v)=>o("GET",`${c(m)}/graph`,{signal:v}),pauseRun:m=>o("POST",`${c(m)}/pause`,{body:{}}),resumeRun:m=>o("POST",`${c(m)}/resume`,{body:{}}),validateWorkflow:(m,v)=>o("POST","/workflows/validate",{body:m,signal:v}),statsOver:({from:m,agent:v})=>{const w=new URLSearchParams;return m&&w.set("from",m),v&&w.set("agent",v),o("GET",`/stats${w.size?`?${w}`:""}`)},fileUrl:(m,v)=>`${t}${c(m)}/files/${v.split("/").map(encodeURIComponent).join("/")}`,listToolKeys:()=>o("GET","/settings/tool-keys"),saveToolKey:(m,v)=>o("PUT",`/settings/tool-keys/${encodeURIComponent(m)}`,{body:{values:v}}),removeToolKey:m=>o("DELETE",`/settings/tool-keys/${encodeURIComponent(m)}`),computers:()=>o("GET","/computers"),saveComputerKeys:(m,v)=>o("PUT",`/computers/${encodeURIComponent(m)}/keys`,{body:v}),testComputer:m=>o("POST",`/computers/${encodeURIComponent(m)}/test`),archil:()=>o("GET","/workspace/archil"),saveArchil:m=>o("PUT","/workspace/archil",{body:m}),archilOff:()=>o("DELETE","/workspace/archil"),testArchil:()=>o("POST","/workspace/archil/test"),webhook:()=>o("GET","/settings/webhook"),saveWebhook:m=>o("PUT","/settings/webhook",{body:{url:m}}),removeWebhook:()=>o("DELETE","/settings/webhook"),testWebhook:()=>o("POST","/settings/webhook/test",{body:{}}),listTriggers:()=>o("GET","/triggers"),getTrigger:m=>o("GET",f(m)),createTrigger:(m,v)=>o("POST","/triggers",{body:m,headers:{"idempotency-key":v}}),rotateTriggerSecret:m=>o("POST",`${f(m)}/secret`,{body:{}}),updateTrigger:(m,v)=>o("PATCH",f(m),{body:v}),deleteTrigger:m=>o("DELETE",f(m)),fireTrigger:(m,v)=>o("POST",`${f(m)}/fire`,{body:{},headers:{"idempotency-key":v}}),triggerFirings:m=>o("GET",`${f(m)}/firings`),webhookDeliveries:()=>o("GET","/settings/webhook/deliveries"),redeliverWebhook:m=>o("POST",`/settings/webhook/deliveries/${encodeURIComponent(m)}/redeliver`,{body:{}}),listTemplates:()=>o("GET","/templates"),applyTemplate:(m,v,w)=>o("POST",`/templates/${encodeURIComponent(m)}/apply`,{body:v,headers:{"idempotency-key":w}}),listMcpServers:()=>o("GET","/settings/mcp-servers"),previewMcpServer:(m,v)=>o("POST","/settings/mcp-servers/preview",{body:{url:m,auth:v}}),saveMcpServer:(m,v,w)=>o("PUT",u(m),{body:{url:v,auth:w}}),refreshMcpServer:m=>o("POST",`${u(m)}/refresh`,{body:{}}),deleteMcpServer:m=>o("DELETE",u(m)),startMcpSignIn:(m,v)=>o("POST",`${u(m)}/oauth/start`,{body:v}),mcpPrivateHosts:()=>o("GET","/settings/mcp-servers/oauth/private-hosts"),saveMcpPrivateHosts:m=>o("PUT","/settings/mcp-servers/oauth/private-hosts",{body:{hosts:m}}),githubConnection:()=>o("GET","/integrations/github"),connectGitHub:m=>o("POST","/integrations/github/connect",{body:m?{org:m}:{}}),disconnectGitHub:()=>o("DELETE","/integrations/github"),toolSettings:()=>o("GET","/settings/tools"),saveToolSettings:m=>o("PUT","/settings/tools",{body:m}),stop:m=>o("POST",`${c(m)}/stop`,{body:{}}),answerApproval:(m,v,w,j)=>o("POST",`${c(m)}/approvals/${encodeURIComponent(v)}`,{body:{decision:w,...j?{note:j}:{}}}),cancel:m=>o("POST",`${c(m)}/cancel`,{body:{}})}}async function Qr(e,t,n=100){const o=[];let i=null;for(let l=0;l<n;l++){const c=await e(i);if(o.push(...t(c)),!c.next_cursor)break;i=c.next_cursor}return o}async function rg(e,t,{onRows:n,onPage:o,signal:i,waitMs:l=25e3,minDelayMs:c=250}){let u=[],f,p;for(;!(i!=null&&i.aborted);){const h=await e.getTimeline(t,f===void 0?{signal:i}:{after:f,waitMs:l,signal:i}).catch(x=>{if(i!=null&&i.aborted)return null;throw x});if(!h||i!=null&&i.aborted||(p=h,n&&(u=u4(u,h)),o==null||o(h),n==null||n(u),h.final&&!h.has_more))break;f=h.next_after;const b=Math.max(c,h.unchanged?h.poll_after_ms??0:0);b&&await new Promise(x=>setTimeout(x,b))}return p}const At=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ru=e=>e.replace(/~/g,"~0").replace(/\//g,"~1");function h4(e){const t=new Map;let n=0;const o=u=>{throw Object.assign(new Error(u),{offset:n})},i=()=>{for(;n<e.length&&`
|
|
513
|
-
\r`.includes(e[n]);)n++},l=()=>{const u=n;for(n++;n<e.length&&e[n]!=='"';)e[n]==="\\"?n++:e.charCodeAt(n)<32&&o("a string cannot hold a raw line break or control character"),n++;n>=e.length&&(n=u,o("this string is not closed")),n++;try{return JSON.parse(e.slice(u,n))}catch{return n=u,o("this string has a bad escape")}},c=u=>{i();const f=n;let p;const h=e[n];if(h==="{"){n++;const b={};if(i(),e[n]==="}")n++;else for(;;){i(),e[n]!=='"'&&o(e[n]==="}"?"a trailing comma before }":"expected a key in double quotes");const x=l();if(i(),e[n]!==":"&&o("expected : after the key"),n++,b[x]=c(`${u}/${Ru(x)}`),i(),e[n]===","){n++;continue}if(e[n]==="}"){n++;break}o("expected , or } after the value")}p=b}else if(h==="["){n++;const b=[];if(i(),e[n]==="]")n++;else for(;;){if(b.push(c(`${u}/${b.length}`)),i(),e[n]===","){n++,i(),e[n]==="]"&&o("a trailing comma before ]");continue}if(e[n]==="]"){n++;break}o("expected , or ] after the value")}p=b}else if(h==='"')p=l();else{const b=/^(?:-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?|true|false|null)/.exec(e.slice(n,n+400));b||o(n>=e.length?"the text ends before the value":"expected a value"),n+=b[0].length,p=JSON.parse(b[0])}return t.set(u,{start:f,end:n}),p};try{const u=c("");return i(),n<e.length&&o("text after the end of the JSON"),{ok:!0,value:u,spans:t}}catch(u){return{ok:!1,error:{message:u.message,offset:u.offset??0}}}}function g4(e,t){let n=1,o=-1;for(let i=0;i<Math.min(t,e.length);i++)e[i]===`
|
|
514
|
-
`&&(n++,o=i);return{line:n,col:t-o}}function A1(e,t){let n=e;for(const o of t.split("/").slice(1)){const i=o.replace(/~1/g,"/").replace(/~0/g,"~");if(Array.isArray(n))n=n[Number(i)];else if(At(n))n=Object.prototype.hasOwnProperty.call(n,i)?n[i]:void 0;else return}return n}const O1=new Set(["judge","pick","sift","route"]),Rb=["jev","parallel","openrouter"];function x4(e){return!At(e)||!At(e.properties)?[]:Object.entries(e.properties).flatMap(([t,n])=>{if(!At(n))return[];const o=typeof n.description=="string"?n.description:t;return Array.isArray(n.enum)?[{id:t,type:"choice",text:o,options:n.enum.map(String)}]:n.type==="boolean"?[{id:t,type:"noul",text:o}]:n.type==="integer"?[{id:t,type:"score",text:o}]:[{id:t,type:"choice",text:o}]})}function og(e,t,n){const o=A1(e,t);if(!At(o))return{decision:!1};const i=o.node,l=n??{},c=i==="route"&&typeof o.valuePath=="string",u=typeof i=="string"&&O1.has(i)&&!c||Array.isArray(l.questions);if(!u)return{decision:!1,...i==="call"&&typeof o.tool=="string"?{tool:o.tool}:{}};const f=typeof l.provider=="string"?l.provider:typeof o.provider=="string"?o.provider:"jev",p=typeof l.model=="string"?l.model:typeof o.model=="string"?o.model:void 0,h=At(e)&&At(e.schemas)?e.schemas:{};let b=[];Array.isArray(l.questions)?b=l.questions.map(v=>({id:v.id,type:v.type==="choice"||v.type==="score"?v.type:"noul",text:v.instructions||v.id,...v.options?{options:v.options}:{}})):i==="judge"||i==="sift"?b=typeof o.out=="string"?x4(h[o.out]):[]:i==="pick"?b=[{id:"pick",type:"choice",text:typeof o.instructions=="string"?o.instructions:"Pick one"}]:i==="route"&&(b=[{id:"branch",type:"choice",text:typeof o.instructions=="string"?o.instructions:"Which branch?",options:At(o.branches)?Object.keys(o.branches):[]}]);const x=Array.isArray(l.images)?l.images.map(String):At(o.images)?Object.keys(o.images):[],m=At(o.unsure)&&typeof o.unsure.branch=="string"&&typeof o.unsure.gte=="number"?{branch:o.unsure.branch,gte:o.unsure.gte}:void 0;return{decision:u,provider:f,model:p,questions:b,...x.length?{images:x}:{},web:f==="parallel",...m?{unsure:m}:{}}}const y4=new Set(["chain","code","agent","decide","extract","report","map","parallel","loop","escalate","judge","pick","sift","route","workflow","artifact","call"]);function v4(e){const t=[],n=(u,f)=>t.push({path:u,message:f,severity:"error"}),o=(u,f)=>t.push({path:u,message:f,severity:"warning"});if(!At(e))return n("","the workflow is a JSON object"),t;e.v!==2&&n("/v",'the workflow format is "v": 2'),(typeof e.name!="string"||!e.name)&&n("/name","the workflow needs a name");const i=At(e.schemas)?e.schemas:{};At(e.input)&&typeof e.input.schemaId=="string"&&!i[e.input.schemaId]&&n("/input/schemaId",`no schema "${e.input.schemaId}" in schemas`),At(e.output)?typeof e.output.schemaId=="string"&&!i[e.output.schemaId]&&n("/output/schemaId",`no schema "${e.output.schemaId}" in schemas`):n("",'the workflow needs an output: { "schemaId": ..., "path": ... }');const l=new Map,c=(u,f)=>{if(!At(u)){n(f,'expected a node (an object with a "node" kind)');return}const p=u.node;if(typeof p!="string"||!y4.has(p)){n(`${f}/node`,typeof p=="string"?`"${p}" is not a node kind`:'a node names its kind in "node"');return}p!=="chain"&&(typeof u.label!="string"||!u.label?n(f,`a ${p} node needs a label`):l.has(u.label)?o(`${f}/label`,`the label "${u.label}" is also used at ${l.get(u.label)}; receipts name nodes by label`):l.set(u.label,f));const h=(x,m)=>{u[x]===void 0&&n(f,`a ${p} node needs ${x} (${m})`)},b=x=>{typeof u[x]=="string"&&!i[u[x]]&&n(`${f}/${x}`,`no schema "${u[x]}" in schemas`)};switch(p){case"chain":!Array.isArray(u.steps)||!u.steps.length?n(f,"a chain needs steps"):u.steps.forEach((x,m)=>c(x,`${f}/steps/${m}`));break;case"parallel":!Array.isArray(u.branches)||!u.branches.length?n(f,"a parallel node needs branches"):u.branches.forEach((x,m)=>c(x,`${f}/branches/${m}`));break;case"map":h("itemsPath","where the items are"),h("as","where the results go"),c(u.body,`${f}/body`);break;case"loop":h("until","when it stops"),h("maxIters","a bound"),c(u.body,`${f}/body`);break;case"workflow":At(u.workflow)?c(u.workflow.root,`${f}/workflow/root`):n(f,"a workflow node embeds its workflow");break;case"call":h("via","tool, executor or shell"),u.via==="tool"&&h("tool","the tool's name");break;case"code":typeof u.code!="string"&&n(f,"a code node needs code");break;case"escalate":h("when","the predicate that fires it"),h("kind","the review it asks for");break;case"judge":case"sift":h("out","the questions' schema"),b("out"),h("as","where the answers go");break;case"pick":h("itemsPath","the options' list"),h("as","where the pick goes");break;case"agent":case"decide":case"extract":b("out");break}if(p==="route"){if(!At(u.branches)||!Object.keys(u.branches).length)n(f,"a route needs branches");else for(const[x,m]of Object.entries(u.branches))At(m)?c(m.body,`${f}/branches/${Ru(x)}/body`):n(`${f}/branches/${Ru(x)}`,`branch "${x}" is an object with a body`);typeof u.valuePath!="string"&&u.instructions===void 0&&n(f,"a route asks by instructions (and state), or reads a valuePath"),At(u.unsure)&&At(u.branches)&&typeof u.unsure.branch=="string"&&!(u.unsure.branch in u.branches)&&n(`${f}/unsure/branch`,`the unsure branch "${u.unsure.branch}" is not one of the branches`)}if(O1.has(p)&&!(p==="route"&&typeof u.valuePath=="string")&&(u.provider!==void 0&&!Rb.includes(u.provider)&&o(`${f}/provider`,`provider "${String(u.provider)}" is not one of ${Rb.join(", ")}`),u.provider==="openrouter"&&typeof u.model!="string"&&n(f,"an openrouter decision names its model (e.g. perplexity/pplx-decider-v1.2)"),At(u.images))){const x=JSON.stringify(u.state??{})+JSON.stringify(u.instructions??"")+(typeof u.out=="string"?JSON.stringify(i[u.out]??{}):"");for(const m of Object.keys(u.images))x.includes(m)||n(`${f}/images/${Ru(m)}`,`the image token "${m}" must appear in the state or a question, or the model never sees it`)}};return e.root===void 0?n("","the workflow needs a root node"):c(e.root,"/root"),t}function Ab(e,t){for(let n=t;;n=n.slice(0,n.lastIndexOf("/"))){const o=e.get(n);if(o)return o;if(!n)return}}function b4(e,t,n){let o=null,i=1/0;for(const l of t){const c=e.get(l);c&&c.start<=n&&n<=c.end&&c.end-c.start<i&&(o=l,i=c.end-c.start)}return o}function w4(e){const t=fl(e),o=t.nodes.map(l=>og(e,l.path,l)).filter(l=>l.decision),i=[...new Set(o.map(l=>l.provider??"jev"))];return`${t.nodes.length} nodes · ${o.length} ${o.length===1?"decision":"decisions"}${i.length?` · ${i.join(", ")}`:""}`}const Vu=e=>e==="not_run"?"not-run":e==="needs_review"?"review":e,Ob=e=>e.replace(/~/g,"~0").replace(/\//g,"~1"),Bl=e=>["completed","failed","cancelled","stopped","escalated"].includes(e);function zd(e,t){return Object.fromEntries(t.nodes.map(n=>[n.path,og(e,n.path,n)]))}const du=e=>e>=.995?"1.00":e.toFixed(2);function Ga(e){var u;if(e.status==="failed")return"failed";if(e.status==="cancelled")return"interrupted";const t=e.answers??{},n=e.action;if(((u=e.rule)==null?void 0:u.kind)==="route"&&n&&typeof n=="object"&&(n.taken||n.branch)){const f=t.branch,p=f&&f.type==="choice"?f.confidence:void 0;return n.unsure?`${n.taken} (unsure)`:`${n.taken??n.branch}${p!==void 0?` ${du(p)}`:""}`}const o=Object.keys(t);if(!o.length)return;const i=f=>{const p=t[f];return p.type==="choice"?`${M1(e,f,p.choice)} ${du(p.probabilities[p.choice]??p.confidence)}`:p.type==="noul"?`${p.noul>=.5?"yes":"no"} ${du(p.noul>=.5?p.noul:1-p.noul)}`:p.type==="score"?`${p.score} ${du(p.confidence)}`:p.type==="refusal"?"refused":"box"};if(o.length===1)return i(o[0]);const l=f=>{const p=t[f];return p.type==="noul"?Math.abs(p.noul-.5)*2:"confidence"in p&&typeof p.confidence=="number"?p.confidence:1},c=o.reduce((f,p)=>l(p)<l(f)?p:f,o[0]);return`${c} ${i(c)}`}function M1(e,t,n){var l,c;const o=(l=e.questions)==null?void 0:l[t],i=e.kind==="pick"&&(o==null?void 0:o.type)==="choice"?(c=o.criteria)==null?void 0:c[n]:null;return typeof i=="string"&&i?i:n}const P1=(e,t)=>e.nodes.filter(n=>n.path.startsWith(`${t}/body`)).map(n=>n.path);function k4(e,t,n){var b,x;const o=(x=(b=e.nodes[t])==null?void 0:b.items)==null?void 0:x.find(m=>m.index===n),i={};if(!o)return i;const l=new Set(["chain","parallel","route","map","loop","workflow"]),c=new Map(e.graph.nodes.map(m=>[m.path,m.kind])),u=P1(e.graph,t).filter(m=>!l.has(c.get(m)??""));let f=-1;u.forEach((m,v)=>{const w=e.decisions.filter(S=>S.node===m&&S.item===n),j=e.effects.filter(S=>S.node===m&&S.item===n);!w.length&&!j.length||(f=v,w.some(S=>S.status==="failed")||j.some(S=>S.status==="failed")?i[m]="failed":w.some(S=>S.status==="cancelled")?i[m]="review":j.some(S=>!S.endedAt)?i[m]=j.some(S=>S.status==="stopped")?"stopped":"working":i[m]="done")});const p=Vu(o.status)??"pending";let h=!Object.values(i).includes("working");return u.forEach((m,v)=>{i[m]||(v<f||p==="done"?i[m]="done":p==="working"?(i[m]=h?"working":"pending",h=!1):p==="pending"?i[m]="pending":i[m]="not-run")}),i}function j4(e,t){var h,b,x;const n={},o=[],i={};let l=null;const c=new Map(e.graph.nodes.map(m=>[m.path,m.kind]));for(const[m,v]of Object.entries(e.nodes)){const w=Vu(v.status);w&&(n[m]=w),v.branch&&o.push(`${m}/branches/${Ob(v.branch)}/body`),v.items&&(i[m]=v.items.map(j=>({index:j.index,status:Vu(j.status)??"pending",label:jl(e,m,j.index),...ag(e,m,j)}))),v.status==="escalated"&&c.get(m)==="escalate"&&(l=m)}const u={},f=m=>/\/body(\/|$)/.test(m)&&e.graph.nodes.some(v=>v.kind==="map"&&m.startsWith(`${v.path}/body`));for(const m of e.decisions){if(!m.node||m.item!==null||f(m.node))continue;const v=Ga(m);v&&(u[m.node]=v)}if(t&&t.item!=null&&c.get(t.path)==="map"){Object.assign(n,k4(e,t.path,t.item));const m=((x=(b=(h=e.nodes[t.path])==null?void 0:h.items)==null?void 0:b.find(v=>v.index===t.item))==null?void 0:x.branches)??{};for(const[v,w]of Object.entries(m)){const j=`${v}/branches/`,S=`${j}${Ob(w)}/body`;for(let T=o.length-1;T>=0;T--)o[T].startsWith(j)&&o.splice(T,1);o.push(S);for(const T of e.graph.nodes)T.path.startsWith(j)&&!(T.path===S||T.path.startsWith(`${S}/`))&&(n[T.path]="not-run")}for(const v of e.decisions)if(v.node&&v.item===t.item&&v.node.startsWith(`${t.path}/body`)){const w=Ga(v);w&&(u[v.node]=w)}}if(e.run.paused){for(const[m,v]of Object.entries(n))v==="working"&&(n[m]="held");for(const m of Object.values(i))for(const v of m)v.status==="working"&&(v.status="held")}const p={};for(const[m,v]of Object.entries(e.nodes))v.model&&(p[m]={model:v.model,...v.tier?{tier:v.tier}:{}});return{status:n,taken:o,items:i,fired:l,verdict:u,meta:zd(e.workflow,e.graph),selected:t,...Object.keys(p).length?{ran:p}:{}}}const ip={accept:"good",accepted:"good",approve:"good",approved:"good",valid:"good",pass:"good",auto:"good",agree:"good",ok:"good",clear:"good",low:"good",review:"warn",hold:"warn",doubtful:"warn",borderline:"warn",unsure:"warn",human:"warn",escalate:"warn",edd:"warn",medium:"warn",second_look:"warn",disagree:"warn",reject:"bad",rejected:"bad",decline:"bad",declined:"bad",invalid:"bad",fail:"bad",deny:"bad",high:"bad",block:"bad"},N4=e=>{if(!e)return;const t=e.toLowerCase();return ip[t]??ip[t.split(/[_\s-]/)[0]]??ip[t.split(/[_\s-]/).at(-1)??""]};function S4(e){if(e.status!=="answered"||!e.answers)return;const t=e.action,n=e.answers.branch;if(t&&typeof t=="object"&&t.taken&&(n==null?void 0:n.type)==="choice")return{p:n.confidence,note:`${e.kind} confidence`};let o;for(const[i,l]of Object.entries(e.answers)){const c=l.type==="noul"?{p:Math.max(l.noul,1-l.noul),note:`${i}: ${l.noul>=.5?"yes":"no"}, P(yes) ${l.noul.toFixed(2)}`,sure:Math.abs(l.noul-.5)}:l.type==="choice"||l.type==="score"?{p:l.confidence,note:`${i} confidence`,sure:l.confidence-.5}:void 0;c&&(!o||c.sure<o.sure)&&(o=c)}return o&&{p:o.p,note:`least sure: ${o.note}`}}function ag(e,t,n){const o=P1(e.graph,t),i=x=>x?o.indexOf(x):-1,l=e.decisions.filter(x=>{var m;return x.item===n.index&&!!((m=x.node)!=null&&m.startsWith(`${t}/body`))}).sort((x,m)=>i(x.node)-i(m.node));let c,u;const f=Object.entries(n.branches??{}).sort(([x],[m])=>i(x)-i(m));if(f.length)[u,c]=f[f.length-1];else{const x=l.filter(m=>{var v;return m.status==="answered"&&((v=m.action)==null?void 0:v.taken)}).at(-1);x&&(c=x.action.taken,u=x.node??void 0)}const p=u&&l.filter(x=>x.node===u).at(-1)||l.filter(x=>x.status==="answered").at(-1),h=p?S4(p):void 0,b=n.status==="failed"?"bad":n.status==="needs_review"||n.status==="escalated"?"warn":N4(c);return{...c?{outcome:c}:{},...h?{p:h.p,pNote:h.note}:{},...b?{tone:b}:{}}}function jl(e,t,n){var u,f;const o=(f=(u=e.nodes[t])==null?void 0:u.items)==null?void 0:f.find(p=>p.index===n);if(o!=null&&o.label)return o.label;const i=e.effects.find(p=>{var h;return p.item===n&&!!((h=p.node)!=null&&h.startsWith(`${t}/body`))}),l=i==null?void 0:i.input,c=(l==null?void 0:l.path)??(l==null?void 0:l.url);return typeof c=="string"?c:void 0}function L1(e=[]){const t={total:e.length,done:0,working:0,failed:0,review:0,pending:0};for(const n of e)n.status==="done"?t.done++:n.status==="working"?t.working++:n.status==="failed"?t.failed++:n.status==="needs_review"||n.status==="escalated"?t.review++:t.pending++;return t}function I1(e){const t=e.decisions.filter(n=>n.cost_usd===null).length;return{usd:e.totals.cost_usd??e.decisions.reduce((n,o)=>n+(o.cost_usd??0),0),unknown:e.totals.cost_usd===null?t:0}}const si=e=>e==null?"Unknown":e>0&&e<1e-4?"<$0.0001":e<1?`$${e.toFixed(4)}`:`$${e.toFixed(2)}`,Pa=e=>e==null?"—":e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(e<1e4?2:1)} s`;function qa(e){const t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/60);return n?`${n}m ${String(t%60).padStart(2,"0")}s`:`${t}s`}const _4=(e,t,n)=>{const o=e.totals.elapsed_ms??(Date.parse(e.run.endedAt??"")||t)-Date.parse(e.run.startedAt);return Bl(e.run.status)||e.run.paused?o:o+Math.max(0,n-t)};function $4(e,t,n){return e!=="input_required"||t!=="waiting"?null:n.findLast(o=>o.kind==="waiting")??null}function E4(e){const t=e.content_type??"";return t.startsWith("text/markdown")||e.path.toLowerCase().endsWith(".md")?"markdown":t.startsWith("text/")||t.includes("json")?"text":"download"}const Hp=[0,250,1e3],z1=e=>new Promise(t=>setTimeout(t,e));function Ku(){let e=0;return{begin:()=>++e,current:t=>t===e,cancel:()=>{e++}}}const D1="30d",Mb=10,T4=["queued","working","input_required","paused"];function C4({agent:e,v2:t,now:n=Date.now,stats:o}){const[i,l]=y.useState(D1),[c,u]=y.useState(o??null),[f,p]=y.useState(null),[h,b]=y.useState(!0),[x,m]=y.useState(0),v=y.useRef(0),w=y.useRef(!0);y.useEffect(()=>(w.current=!0,()=>{w.current=!1}),[]);const j=y.useRef(null),S=y.useRef(null);y.useEffect(()=>{const $=`${i}/${x}`;if(S.current===$)return;const _=++v.current;if(j.current===$){S.current=null,p(null),b(!1);return}S.current=$,b(!0),p(null),(async()=>{for(const[E,R]of Hp.entries()){if(R&&await z1(R),_!==v.current||!w.current)return;try{const C=await t.statsOver({from:ng(i,n()),agent:e.agent_id});if(_!==v.current||!w.current)return;const O=!(C.runs.status_unknown>0);if(u(C),j.current=O||E===Hp.length-1?$:null,O)break}catch(C){_===v.current&&p(Nn(C));break}}_===v.current&&(S.current=null,b(!1))})()},[t,e.agent_id,i,x]),y.useEffect(()=>{const $=new AbortController,_=E=>({status:E,...e.archived_at?{archived:!0}:{}});return Promise.allSettled(T4.map(E=>t.listAgentRuns(e.agent_id,Mb,null,_(E)))).then(E=>{if($.signal.aborted)return;const R=E.flatMap(C=>C.status==="fulfilled"?C.value.runs:[]).filter(C=>!Bl(C.status));for(const C of R.slice(0,Mb)){let O=`${C.status}/${C.state}`;rg(t,C.run_id,{signal:$.signal,onPage:z=>{const F=`${z.status}/${z.state}`;F!==O&&(O=F,m(D=>D+1))}}).catch(()=>{})}}),()=>$.abort()},[t,e.agent_id]);const T=c==null?void 0:c.analytics;return s.jsxs("div",{className:"space-y-6",children:[s.jsx($1,{range:i,onRange:l,agent:null,agents:[]}),f?s.jsxs("p",{className:"border p-4 font-mono text-body text-destructive-text",role:"alert",children:["The analytics could not be read: ",f]}):!c||!T?s.jsx("p",{className:"py-12 text-center font-mono text-body text-muted-foreground",children:"Loading analytics..."}):T.totals.runs?s.jsx(E1,{a:T,basis:c.cost.basis,now:n(),refreshing:h}):s.jsx("div",{className:"border px-4 py-12 text-center",children:s.jsx("p",{className:"font-mono text-body text-muted-foreground",children:"No runs of this agent in this range."})})]})}const R4={neutral:{box:"border-border bg-card",text:"text-foreground",Icon:Sp},info:{box:"border-info/50 bg-info/5",text:"text-info-text",Icon:Sp},success:{box:"border-success/50 bg-success/5",text:"text-success-text",Icon:r0},warning:{box:"border-warning/50 bg-warning/5",text:"text-warning-text",Icon:er},error:{box:"border-destructive/50 bg-destructive/5",text:"text-destructive-text",Icon:Fa}};function ns({tone:e="neutral",title:t,actions:n,bar:o,icon:i,role:l,className:c,children:u,...f}){const p=R4[e],h=i===!1?null:i??p.Icon;return s.jsxs("div",{role:l??(e==="error"?"alert":"status"),...f,className:oe("flex gap-3 text-body",o?"shrink-0 items-center border-b bg-card px-5 py-2 md:px-8":oe("border p-4",p.box),c),children:[h&&s.jsx(h,{className:oe("size-4 shrink-0",!o&&"mt-0.5",p.text),"aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[t&&s.jsx("p",{className:oe("font-semibold",!o&&"caps text-small",!o&&p.text),children:t}),u&&s.jsx("div",{className:oe(t&&!o&&"mt-2"),children:u})]}),n&&s.jsx("div",{className:"flex shrink-0 items-start gap-2",children:n})]})}const Pb=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Lb=g0,A4=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return Lb(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:l}=t,c=Object.keys(i).map(p=>{const h=n==null?void 0:n[p],b=l==null?void 0:l[p];if(h===null)return null;const x=Pb(h)||Pb(b);return i[p][x]}),u=n&&Object.entries(n).reduce((p,h)=>{let[b,x]=h;return x===void 0||(p[b]=x),p},{}),f=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((p,h)=>{let{class:b,className:x,...m}=h;return Object.entries(m).every(v=>{let[w,j]=v;return Array.isArray(j)?j.includes({...l,...u}[w]):{...l,...u}[w]===j})?[...p,b,x]:p},[]);return Lb(e,c,f,n==null?void 0:n.class,n==null?void 0:n.className)},Va=A4("caps inline-flex items-center justify-center gap-2 whitespace-nowrap border text-small transition-colors disabled:cursor-not-allowed disabled:opacity-45 [&_svg]:size-3.5 [&_svg]:shrink-0",{variants:{variant:{outline:"border-border bg-background hover:border-border-strong hover:bg-accent",primary:"border-primary text-primary-text hover:bg-primary/10",solid:"border-primary bg-primary text-primary-foreground hover:bg-primary/90",destructive:"border-destructive/60 text-destructive-text hover:bg-destructive/10",ghost:"border-transparent hover:bg-accent"},size:{xs:"h-7 gap-1.5 px-2 text-label",sm:"h-control-sm px-3",md:"h-control-md px-4",lg:"h-control-lg px-5",icon:"size-control-sm"}},defaultVariants:{variant:"outline",size:"md"}}),Z=y.forwardRef(({className:e,variant:t,size:n,...o},i)=>s.jsx("button",{ref:i,className:oe(Va({variant:t,size:n}),e),...o}));Z.displayName="Button";const O4={plain:"border-border text-muted-foreground",active:"border-run-active/50 text-run-active",success:"border-success/50 bg-success/10 text-success-text",warning:"border-warning/50 bg-warning/10 text-warning-text",error:"border-destructive/50 bg-destructive/10 text-destructive-text",info:"border-info/50 bg-info/10 text-info-text",muted:"border-border-strong/60 text-muted-foreground"};function Me({tone:e="plain",className:t,title:n,children:o}){return s.jsx("span",{title:n,className:oe("caps inline-flex h-5 items-center gap-1 border px-1.5 text-micro leading-none",O4[e],t),children:o})}const M4={sm:"max-w-sm",md:"max-w-lg",lg:"max-w-3xl",full:"h-full max-w-5xl"};function ig({open:e,onClose:t,title:n,description:o,footer:i,size:l="md",initialFocus:c,hideClose:u,className:f,children:p}){return s.jsxs(_R,{open:e,onClose:t,initialFocus:c,className:"relative z-dialog",children:[s.jsx(SR,{className:"fixed inset-0 bg-overlay/70"}),s.jsx("div",{className:oe("fixed inset-0 flex justify-center p-4 md:p-8",l==="full"?"items-stretch":"items-start overflow-y-auto pt-[12vh]"),children:s.jsxs(Vk,{className:oe("flex w-full flex-col border border-border-strong bg-background text-foreground shadow-float",M4[l],f),children:[s.jsxs("header",{className:"flex items-start gap-3 border-b px-5 py-4",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx(Kk,{className:"text-lg font-semibold",children:n}),o&&s.jsx(q0,{className:"mt-1 text-body text-muted-foreground",children:o})]}),!u&&s.jsx(Z,{size:"icon",variant:"ghost",onClick:t,"aria-label":"Close",children:s.jsx(Ll,{"aria-hidden":!0})})]}),p&&s.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4 text-body",children:p}),i&&s.jsx("footer",{className:"flex flex-wrap justify-end gap-2 border-t px-5 py-3",children:i})]})})]})}function P4({open:e,title:t,confirm:n,cancel:o="Cancel",tone:i="destructive",busy:l,onConfirm:c,onCancel:u,children:f}){const p=y.useRef(null);return s.jsx(ig,{open:e,onClose:l?()=>{}:u,title:t,size:"sm",hideClose:!0,initialFocus:p,footer:s.jsxs(s.Fragment,{children:[s.jsx(Z,{ref:p,size:"sm",onClick:u,disabled:l,children:o}),s.jsx(Z,{size:"sm",variant:i,onClick:c,disabled:l,"aria-busy":l||void 0,children:n})]}),children:f})}function L4({icon:e,active:t,className:n,children:o,...i}){return s.jsxs("button",{type:"button","aria-current":t?"page":void 0,...i,className:oe("flex min-h-11 items-center gap-2.5 p-3 text-left text-body -outline-offset-2 hover:bg-accent",t&&"relative bg-primary/[0.06] text-primary-text before:absolute before:inset-y-0 before:left-0 before:w-0.5 before:bg-primary",n),children:[e&&s.jsx(e,{className:"size-4 shrink-0","aria-hidden":!0})," ",o]})}function I4({label:e,className:t}){return s.jsxs("span",{role:e?"status":void 0,className:"inline-flex",children:[s.jsx(d_,{className:oe("size-4 animate-spin text-run-active",t),"aria-hidden":!0}),e&&s.jsx("span",{className:"sr-only",children:e})]})}function z4({checked:e,onChange:t,disabled:n,label:o,labelledBy:i,busy:l,className:c}){return s.jsx("button",{type:"button",role:"switch","aria-checked":e,"aria-label":o,"aria-labelledby":i,"aria-busy":l||void 0,disabled:n||l,onClick:()=>t(!e),className:oe("relative inline-flex h-5 w-9 shrink-0 items-center border transition-colors disabled:cursor-not-allowed disabled:opacity-45",e?"border-primary bg-primary/20":"border-border-strong bg-background hover:border-foreground/60",l&&"motion-safe:animate-pulse",c),children:s.jsx("span",{"aria-hidden":!0,className:oe("absolute top-1/2 size-3 -translate-y-1/2 transition-[left,background-color] duration-fast",e?"left-[calc(100%-16px)] bg-primary":"left-[3px] bg-muted-foreground")})})}function F1({tabs:e,value:t,onChange:n,label:o,id:i,className:l}){var p;const c=e.some(h=>h.id===t)?t:(p=e[0])==null?void 0:p.id,u=y.useRef(null),f=h=>{var m,v;const b=e.findIndex(w=>w.id===t),x=h.key==="ArrowRight"?(b+1)%e.length:h.key==="ArrowLeft"?(b-1+e.length)%e.length:h.key==="Home"?0:h.key==="End"?e.length-1:-1;x<0||x===b||(h.preventDefault(),n(e[x].id),(v=(m=u.current)==null?void 0:m.querySelectorAll('[role="tab"]')[x])==null||v.focus())};return s.jsx("div",{ref:u,role:"tablist","aria-label":o,onKeyDown:f,className:oe("flex border-b px-5 md:px-8",l),children:e.map(h=>s.jsx("button",{type:"button",role:"tab",id:i&&`${i}-tab-${h.id}`,"aria-controls":i&&`${i}-panel-${h.id}`,"aria-selected":t===h.id,tabIndex:c===h.id?0:-1,onClick:()=>n(h.id),className:oe("caps -mb-px whitespace-nowrap border-b-2 px-3 py-3 text-small -outline-offset-2 max-sm:px-2.5 max-sm:py-2",t===h.id?"border-primary text-primary-text":"border-transparent text-muted-foreground hover:text-foreground"),children:h.label},h.id))})}function D4({tip:e,children:t,className:n,align:o="start"}){const i=y.useId();return s.jsxs("span",{className:oe("group/tip relative inline-flex",n),children:[y.cloneElement(t,{"aria-describedby":i}),s.jsx("span",{role:"tooltip",id:i,className:oe("pointer-events-none absolute top-full z-popover mt-1.5 hidden w-max max-w-[min(20rem,80vw)] border border-border-strong bg-card px-3 py-2 text-left font-sans text-small normal-case leading-snug tracking-normal text-card-foreground shadow-float group-hover/tip:block group-focus-within/tip:block",o==="end"?"right-0":"left-0"),children:e})]})}const F4=y.createContext(null),U4={neutral:[Sp,"text-muted-foreground"],success:[r0,"text-success-text"],warning:[er,"text-warning-text"],error:[Fa,"text-destructive-text"]},W4=5e3;function H4({toast:e,done:t}){const n=y.useCallback(()=>t(e.id),[t,e.id]),o=e.tone??"neutral",i=e.duration??(o==="error"?0:W4),[l,c]=y.useState(!1),[u,f]=y.useState(!1),p=l||u;y.useEffect(()=>{if(!i||p)return;const x=setTimeout(n,i);return()=>clearTimeout(x)},[i,p,n]);const[h,b]=U4[o];return s.jsxs("div",{role:o==="error"?"alert":"status",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>f(!0),onBlur:()=>f(!1),className:"pointer-events-auto flex w-full items-start gap-3 border border-border-strong bg-card p-3 text-body text-card-foreground shadow-float motion-safe:animate-toast-in",children:[s.jsx(h,{className:oe("mt-0.5 size-4 shrink-0",b),"aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"font-semibold",children:e.title}),e.description&&s.jsx("p",{className:"mt-0.5 text-small text-muted-foreground",children:e.description})]}),s.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss",className:"-m-1 shrink-0 p-1 text-muted-foreground hover:text-foreground",children:s.jsx(Ll,{className:"size-3.5","aria-hidden":!0})})]})}function B4({children:e}){const[t,n]=y.useState([]),o=y.useRef(0),i=y.useCallback(c=>n(u=>[...u,{...c,id:o.current++}].slice(-3)),[]),l=y.useCallback(c=>n(u=>u.filter(f=>f.id!==c)),[]);return s.jsxs(F4.Provider,{value:i,children:[e,s.jsx("div",{role:"region","aria-label":"Notifications","aria-live":"polite",className:"pointer-events-none fixed inset-x-4 bottom-4 z-toast flex flex-col gap-2 sm:left-auto sm:w-[22rem]",children:t.map(c=>s.jsx(H4,{toast:c,done:l},c.id))})]})}const Xu=[{id:"claude",label:"Claude Code app",instruction:"Open your project in Claude Code and paste the prompt into a new or existing conversation."},{id:"claude-cli",label:"Claude Code CLI",instruction:"Open your project in a terminal, start Claude Code with claude, and paste the prompt."},{id:"codex",label:"Codex app",instruction:"Open your project in the Codex app and paste the prompt into a new or existing chat."},{id:"codex-cli",label:"Codex CLI",instruction:"Open your project in a terminal, start Codex with codex, and paste the prompt."}],U1="agentrun.coding-agent",G4="https://github.com/Parcha-ai/agentrun/tree/main/packages/serve/skills/agentrun-serve",W1=()=>{try{return globalThis.localStorage??null}catch{return null}};function q4(e=W1()){var t;try{const n=e==null?void 0:e.getItem(U1);return((t=Xu.find(o=>o.id===n))==null?void 0:t.id)??"claude"}catch{return"claude"}}function V4(e,t=W1()){try{t==null||t.setItem(U1,e)}catch{}}const Ib=e=>Xu.find(t=>t.id===e)??Xu[0];function zb(e,t=(n=>(n=globalThis.location)==null?void 0:n.href)()){const o=new URL(e||"/",t),i=o.pathname.replace(/\/+$/,"");return{origin:o.origin,path:i,api:`${o.origin}${i}`}}const K4={create:"Create an AgentRun agent on this server.",edit:"Review and revise this AgentRun agent.",run:"Run this AgentRun agent on its pinned revision."};function X4(e,t,n){const{origin:o,path:i,api:l}=zb(t),c=i.endsWith("/v2"),u=e.kind==="create"?"":encodeURIComponent(e.agentId),f=e.kind==="create"?`POST ${i}/agents`:e.kind==="edit"?`PUT ${i}/agents/${u}/definition`:`POST ${i}/agents/${u}/runs`,p=e.kind==="run"?{...e.input!==void 0?{input:e.input}:{},...e.effort?{effort:e.effort}:{},revision:e.revision}:void 0,h={server:l,operation:f,...e.kind==="create"?{}:{agent_id:e.agentId,revision:e.revision},...p?{request:p}:{}},b=n?`${zb(n).api}/`:void 0,x=e.kind==="create"?[`Create it with POST ${i}/agents and one Idempotency-Key for the request and any unchanged retry.`,"Write a native definition: instructions with the tools the agent needs, or a workflow this server supports. Include every skill file the person supplies in the same request.","Do not submit missing requirements or configuration this server's capabilities do not offer."]:e.kind==="edit"?[`Read the agent first with GET ${i}/agents/${u} and keep its ETag.`,`Send the full definition with PUT ${i}/agents/${u}/definition, a higher version and If-Match set to that ETag. Keep the agent's identity and every field you were not asked to change; skill files do not change through this route.`,"A 412 precondition_failed means another revision was saved first: report it, and do not overwrite that revision."]:[`Read the pinned revision's input contract. Start the run with POST ${i}/agents/${u}/runs, the revision pinned, and one stable Idempotency-Key for this run and any unchanged retry.`,"Do not add a spending cap unless the person asks for one.","Follow the run's actual status, its questions (input_required), its result and its files until it ends."];return[K4[e.kind],"","Install or update the public AgentRun Server skill with your own skill installation workflow:",G4,`Read its SKILL.md, then ${c?`${o}/llms.txt and `:""}${l}/openapi.json. Check ${l}/capabilities before you choose models, tools or workflow features.`,"",`Use this existing server. Authentication is separate from the skill: use the AgentRun API token the owner configured in your environment, as the skill describes. Never print a credential or ask for one in the conversation. The console's browser session does not sign you in.${c?` You can work over the server's MCP endpoint (${l}/mcp), as the skill connects it, or over the HTTP API.`:""}`,"","Task context:","```json",JSON.stringify(h,null,2),"```","","Ask about missing task inputs, required outputs and scope before you submit anything. Keep the answers and any approval already given. Explain the change or the run first when it still needs approval.",...x,`Report the server's actual answer and the ${e.kind==="run"?"run":"revision"} it names${b?`, with its link in the console (${b})`:""}. Keep an unknown cost unknown. Copying this prompt submitted nothing, so do not claim that anything ran before the server says so.`].join(`
|
|
515
|
-
`)}const Y4={create:"Build with your coding agent",edit:"Edit with your coding agent",run:"Run with your coding agent"},Q4=()=>globalThis.location?`${location.origin}${location.pathname}`:void 0;function Z4({open:e,onClose:t,context:n,serverUrl:o="/v2",consoleUrl:i=Q4()}){const[l,c]=y.useState(()=>q4()),[u,f]=y.useState(()=>X4(n,o,i)),[p,h]=y.useState("no"),b=y.useRef(null),x=Ib(l),m=async()=>{var v,w,j;try{if(!((v=navigator.clipboard)!=null&&v.writeText))throw new Error("No clipboard");await navigator.clipboard.writeText(u),h("yes")}catch{h("unavailable"),(w=b.current)==null||w.focus(),(j=b.current)==null||j.select()}};return s.jsx(ig,{open:e,onClose:t,size:"lg",title:Y4[n.kind],description:"Pick where you work, then review and copy the prompt. Nothing opens or runs from here.",footer:s.jsxs(s.Fragment,{children:[s.jsx(Z,{size:"sm",onClick:t,children:"Close"}),s.jsxs(Z,{size:"sm",variant:"solid",onClick:()=>void m(),disabled:!u.trim(),children:[s.jsx(gd,{"aria-hidden":!0})," Copy prompt"]})]}),children:s.jsxs("div",{className:"space-y-5",children:[s.jsx(Po,{label:"Application",hint:x.instruction,children:s.jsx(Kt,{label:"Application",autoFocus:!0,value:l,className:"w-full sm:w-72",onChange:v=>{const w=Ib(v).id;V4(w),c(w),h("no")},options:Xu.map(v=>({value:v.id,label:v.label}))})}),s.jsx(Po,{label:"Prompt",note:"Review it and edit it before you copy it. It holds the task and no credential: your coding agent signs in to the server on its own.",children:s.jsx(Ss,{ref:b,value:u,rows:14,spellCheck:!1,className:"resize-y text-small leading-relaxed",onChange:v=>{f(v.target.value),h("no")}})}),p==="yes"&&s.jsxs(ns,{tone:"success",title:"Copied",children:["Paste it into ",x.label,". Nothing was sent to the server."]}),p==="unavailable"&&s.jsx(ns,{tone:"warning",role:"alert",title:"Clipboard unavailable",children:"The prompt is selected in its field. Copy it with your keyboard (Ctrl+C, or Cmd+C on a Mac)."})]})})}function lg({context:e,label:t,serverUrl:n="/v2",size:o="sm",iconOnPhone:i,unavailable:l,className:c}){const[u,f]=y.useState(null),[p,h]=y.useState(!1),[b,x]=y.useState(0);return s.jsxs(s.Fragment,{children:[s.jsxs(Z,{size:o,onClick:()=>{f(typeof e=="function"?e():e),x(m=>m+1),h(!0)},"aria-haspopup":"dialog",disabled:!!l,title:l??(i?t:void 0),className:oe(i&&"max-sm:w-8 max-sm:shrink-0 max-sm:px-0",c),children:[s.jsx(N_,{"aria-hidden":!0})," ",i?s.jsx("span",{className:"max-sm:sr-only",children:t}):t]}),u&&s.jsx(Z4,{open:p,onClose:()=>h(!1),context:u,serverUrl:n},b)]})}const J4="Not read: its front matter can't be read; fix the file to use it",eA={approved:"Approved",edited:"Edited",created:"Created",retired:"Retired",restored:"Restored",learned:"Learned",superseded:"Replaced"},H1=(e,t)=>`${eA[e]} by ${t==="person"?"you":"a run"}`,Bp=e=>e.readme??e.file,lp="Can't tell which version this is: reload.",Dd="It changed since you opened it.",tA=e=>e==="active"?"It becomes active again for the next run.":"It goes back to waiting for your OK: no run uses it until you approve it.",nA=e=>`It makes a new agent that runs the steps of ${e} on their own, with no agent loop, under this agent's tool settings, approvals and cap. ${e} stays here, unchanged.`,sA="Making an agent from it takes your password sign-in in the console.",rA="Restoring takes your password sign-in in the console.",B1=["feedback","project","reference","user"],oA={user:"About you",feedback:"How to work",project:"About the work",reference:"Where to look"},G1=e=>oA[e]??e,aA={feedback:"How to work: a rule or a correction",project:"Facts about the work itself",reference:"Where to find things",user:"About the person it works for"},iA=["seeded","reflecting","proposed"],q1=e=>!!e&&iA.includes(e.state),Gl=e=>Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&typeof t.file=="string"&&typeof t.name=="string"):[],V1=e=>Gl(e==null?void 0:e.given),K1=e=>Gl(e==null?void 0:e.read),Nl=e=>(e==null?void 0:e.state)==="merged"?Gl(e.learned):[],cg=e=>Gl(e==null?void 0:e.pending),X1=e=>Gl(e),Db=e=>(e==null?void 0:e.state)==="merged"?X1(e.skills):[],Fb=e=>(e==null?void 0:e.state)==="merged"?X1(e.workflows):[],lA=e=>cg(e).length>0,Yu=(e,t)=>`${e} ${t}${e===1?"":"s"}`,Y1=e=>e.status==="pending",Qu=e=>{var t;return((t=e==null?void 0:e.learning)==null?void 0:t.pending)??0},ug=e=>`${e} learned ${e===1?"item waits":"items wait"} for your OK`;function cA(e){const t=e&&typeof e=="object"?e.learning:void 0;return t&&typeof t=="object"&&t.approve===!0?"yes":"password"}const Q1="Approving needs your password sign-in. Until then it stays out of every run.",uA="It changes what this agent trusts or skips, so it waits for you.",dA="Runs that use bash on the host run as you. For untrusted tasks, use the sandbox.",Z1="[redacted]",J1=e=>e===1?"1 note waits for your OK":e>1?`${e} notes wait for your OK`:"A note waits for your OK",La=e=>`${e} ${e===1?"note":"notes"}`,no=e=>`${e} ${e===1?"run":"runs"}`,fA={grader:"refused",checker:"refused",screen:"refused",screen_down:"refused",unparsed:"refused",empty:"nothing",no_budget:"skipped",unknown_cost:"skipped",no_write_tool:"skipped",tool_denied:"skipped"},Zu=e=>fA[e??""]??"stopped",mA={empty:"Nothing new to remember from this run.",unparsed:"Not kept: its notes weren't in the expected format.",grader:"Not kept: it wouldn't help later runs enough.",checker:"Not kept: it held something that must not be stored.",screen:"Not kept: it held something that must not be stored.",screen_down:"Not kept: it couldn't be checked for safety.",no_write_tool:"Not kept: this agent can't write notes (give it the write tool).",tool_denied:"Not kept: this agent isn't allowed to write notes.",no_budget:"Skipped: no budget left in this run to look back.",unknown_cost:"Skipped: no budget left in this run to look back.",seed_failed:"Started without its notes: they couldn't be read.",cancelled:"Not kept: learning stopped (the run was cancelled).",crashed:"Not kept: learning stopped (the run ended unexpectedly).",reflect_timeout:"Not kept: learning stopped (it ran out of time).",reflect_failed:"Not kept: learning stopped (an error).",propose_failed:"Not kept: learning stopped (an error).",grade_failed:"Not kept: learning stopped (the check couldn't run)."};function dg(e){return e.detail&&e.detail.trim()?e.detail.trim():mA[e.reason??""]??"Not kept: learning stopped."}const pA=e=>e==="seeded"?"Learns after the run":"Looking back",Ju=e=>qa(Math.round(e)*1e3),Ia=e=>oo({usd:e,basis:"estimate",charge_state:null,cap_usd:null}),Ub=(e,t)=>e>0?Math.round((t-e)/e*100):null,ej=e=>typeof e.before.median_cost_usd=="number"&&typeof e.after.median_cost_usd=="number",tj=e=>e.after.median_learning_usd;function hA(e){const t=[`answers in ${Ju(e.after.median_duration_s)} instead of ${Ju(e.before.median_duration_s)}`];ej(e)&&t.push(`${Ia(e.after.median_cost_usd)} instead of ${Ia(e.before.median_cost_usd)} a run`);const n=tj(e);return n!==null&&t.push(`learning itself ${Ia(n)} a run`),`Since it learned (on ${no(e.after.runs)}): ${t.join(" · ")}`}const gA=e=>{const t=n=>!!n&&typeof n=="object"&&typeof n.runs=="number"&&n.runs>=2&&typeof n.median_duration_s=="number";return!!e&&typeof e=="object"&&t(e.before)&&t(e.after)},xA=/^---\n([\s\S]*?)\n?^---$\n?/m,Gp=e=>/^"[^"]*"$|^'[^']*'$/.test(e)?e.slice(1,-1):e;function ed(e){const t=e.replace(/\r\n/g,`
|
|
516
|
-
`),n=t.startsWith(`---
|
|
517
|
-
`)?xA.exec(t):null;if(!n||n.index!==0)return{name:"",description:"",type:"project",body:t,rest:[]};const o={},i=[];for(const c of n[1].split(`
|
|
518
|
-
`)){const u=/^(name|description|type):(?:\s+(.*))?$/.exec(c);u&&!(u[1]in o)?o[u[1]]=Gp((u[2]??"").trim()):c.trim()&&i.push(c)}const l=B1.includes(o.type??"")?o.type:"project";return{name:o.name??"",description:o.description??"",type:l,body:t.slice(n[0].length),rest:i}}const Wb=e=>{const t=e.replace(/\s*\n\s*/g," ").trim();return/^["'].*["']$/.test(t)?t.includes('"')?`'${t}'`:`"${t}"`:t},yA=e=>`---
|
|
519
|
-
name: ${Wb(e.name)}
|
|
520
|
-
description: ${Wb(e.description)}
|
|
521
|
-
type: ${e.type}
|
|
522
|
-
${e.rest.map(t=>`${t}
|
|
523
|
-
`).join("")}---
|
|
524
|
-
${e.body.replace(/^\n*/,`
|
|
525
|
-
`)}`;function vA(e){const t=ed(e).rest.find(o=>/^supersedes:/.test(o)),n=t?Gp(t.replace(/^supersedes:\s*/,"").trim()).trim():"";return n?(/^\[.*\]$/.test(n)?n.slice(1,-1).split(","):[n]).map(o=>Gp(o.trim())).filter(Boolean):[]}const Sl=e=>ed(e).body.replace(/^\n+/,"");function Hb(e,t=[]){const n=e.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)||"note";let o=`${n}.md`;for(let i=2;t.includes(o);i++)o=`${n}-${i}.md`;return o}const Fd=(e,t=[])=>{const n=t.filter(i=>i!==Z1),o=new URLSearchParams(n.map(i=>["note",i]));return`#/agents/${encodeURIComponent(e)}/learning${n.length?`?${o}`:""}`};function nj(e){return e.kind===xr?{...e,agent_label:null}:e.kind==="user_message"&&e.agent_label===xr?{...e,kind:xr,agent_label:null}:e}const xr="learning",bA={seeded:0,reflecting:1,proposed:2,merged:3,dropped:3},qp=e=>e?bA[e.state]??0:-1,wA=e=>{const t=e==null?void 0:e.learning;return t&&typeof t=="object"&&typeof t.state=="string"?t:void 0},Bb=e=>e.charAt(0).toLowerCase()+e.slice(1);function kA(e){var n,o;if(!e||qp(e)<2)return"Looking back on this run…";if(e.state==="proposed")return`Looking back: ${Bb(((n=e.detail)==null?void 0:n.trim())||"Checking its new notes…")}`;const t=i=>i.map(l=>l.name.replace(/\s+/g," ").trim()).join(", ");if(e.state==="merged"){const i=Nl(e),l=cg(e),c=[...i.length?[`kept ${La(i.length)} (${t(i)})`]:[],...l.length?[`${Bb(J1(l.length))} (${t(l)})`]:[]];return c.length?`Looked back: ${c.join("; ")}`:`Looked back. ${((o=e.detail)==null?void 0:o.trim())||"It kept what it learned."}`}return Zu(e.reason)==="nothing"?"Looked back: nothing new to keep":`Looked back: ${dg(e)}`}function jA(e){var l;const t=nj(e),n=t.summary??"",o=R1(t)?`${n} (failed)`:n,i=(l=C1(t))==null?void 0:l.trimEnd();return i&&i.trim()!==n.trim()?`${o}
|
|
526
|
-
${i.replace(/^(?=.)/gm," ")}`:o}function sj(e,t){const n=e.filter(f=>f.agent_label===xr&&f.kind!==xr);if(!n.length)return e.map(nj);const o=e.findLast(f=>f.kind===xr),i=wA(o),l=qp(i)>qp(t??void 0)?i:t&&{...t,detail:t.detail??(i==null?void 0:i.detail)??(o==null?void 0:o.summary)??null},c=n[0],u={id:c.id,seq:c.seq,timestamp:c.timestamp,created_at:c.created_at,kind:xr,agent_label:null,tool_name:null,tool_use_id:null,tool_status:null,tool_input_preview:null,tool_result_preview:null,tool_result_size_bytes:null,summary:kA(l??void 0),text:[...n,...o?[o]:[]].map(jA).join(`
|
|
527
|
-
`)};return e.flatMap(f=>f===c?[u]:f.agent_label===xr||f.kind===xr?[]:[f])}const NA={too_large:"It's too large to show here.",secret:"Not shown: it holds one of this server's secrets."},Gb=["Added","Replaced","Retired","Removed","Changed"];function SA(e){const t=[],n=[];let o=0;for(const i of e.split(`
|
|
528
|
-
`)){const l=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(i);l?((o||Number(l[1])>1)&&t.push({text:"…",mark:"gap"}),(o||Number(l[2])>1)&&n.push({text:"…",mark:"gap"}),o++):o&&i.startsWith(" ")?(t.push({text:i.slice(1),mark:"same"}),n.push({text:i.slice(1),mark:"same"})):o&&i.startsWith("-")?t.push({text:i.slice(1),mark:"removed"}):o&&i.startsWith("+")&&n.push({text:i.slice(1),mark:"added"})}return{before:t,after:n}}function _A(e,t){const n=e.files.filter(u=>u.path!=="MEMORY.md"),o=new Map(n.map(u=>[u.path,u.patch===void 0?null:SA(u.patch)])),i=new Map([...V1(t),...K1(t),...Nl(t)].map(u=>[u.file,u.name])),l=u=>{const f=o.get(u),p=[...(f==null?void 0:f.after)??[],...(f==null?void 0:f.before)??[]].find(h=>h.mark!=="gap"&&/^name:\s*\S/.test(h.text));return i.get(u)??(p==null?void 0:p.text.replace(/^name:\s*/,"").trim())??u.replace(/\.md$/,"")};return n.map(u=>{var m,v;const f=o.get(u.path),p=l(u.path),h=((f==null?void 0:f.after)??[]).filter(w=>w.mark==="added").map(w=>w.text.trim()),b=((m=h.find(w=>w.startsWith("superseded_by:")))==null?void 0:m.replace(/^superseded_by:\s*/,""))??((v=Nl(t).find(w=>{var j;return(j=w.supersedes)==null?void 0:j.includes(u.path)}))==null?void 0:v.file),x=u.status==="added"?`Added: ${p}`:u.status==="deleted"?`Removed: ${p}`:h.includes("status: superseded")||!f&&b?`Replaced: ${p}${b?` → ${l(b)}`:""}`:h.includes("status: retired")?`Retired: ${p}`:`Changed: ${p}`;return f?{file:u.path,said:x,before:u.status==="added"?null:f.before,after:u.status==="deleted"?null:f.after}:{file:u.path,said:x,before:null,after:null,withheld:NA[u.withheld??""]??"Not shown."}}).sort((u,f)=>Gb.indexOf(u.said.split(":")[0])-Gb.indexOf(f.said.split(":")[0]))}function $A(e){const t=new Map;for(const n of e)for(const o of n.files){const i=t.get(o)??{};"run"in n.by&&(i.run={id:n.by.run,at:n.at,reason:n.reason}),t.set(o,i)}return t}function Ud({run:e,link:t=!1,className:n}){var b;const o=V1(e.learning),i=K1(e.learning),l=Nl(e.learning),c=q1(e.learning)&&e.learning.state!=="seeded",u=cg(e.learning),f=lA(e.learning),p=[...Db(e.learning),...Fb(e.learning)],h=((b=e.learning)==null?void 0:b.state)==="dropped"&&Zu(e.learning.reason)!=="nothing"?dg(e.learning):null;return!o.length&&!i.length&&!l.length&&!c&&!f&&!p.length&&!h?null:s.jsxs("span",{className:oe("inline-flex flex-wrap items-center gap-2",n),"aria-label":"Learning",children:[o.length>0&&s.jsx(fu,{agentId:e.agent_id,refs:o,link:t,kind:"given"}),i.length>0&&s.jsx(fu,{agentId:e.agent_id,refs:i,link:t,kind:"read"}),l.length>0&&s.jsx(fu,{agentId:e.agent_id,refs:l,link:t,kind:"learned",replaces:l.reduce((x,m)=>{var v;return x+(((v=m.supersedes)==null?void 0:v.length)??0)},0)}),f&&s.jsx(fu,{agentId:e.agent_id,refs:u,link:t,kind:"pending"}),h&&s.jsx(EA,{agentId:e.agent_id,said:h,link:t}),["skill","workflow"].flatMap(x=>{const m=(x==="skill"?Db:Fb)(e.learning);return[!1,!0].map(v=>{const w=m.filter(j=>j.pending===!0===v);return w.length?s.jsx(TA,{agentId:e.agent_id,refs:w,link:t,kind:x,pending:v},`${x}-${v}`):null})}),c&&s.jsxs(Me,{tone:"active",children:[s.jsxs("span",{className:"relative flex size-1.5","aria-hidden":!0,children:[s.jsx("span",{className:"absolute inline-flex size-full animate-ping bg-run-active opacity-75"}),s.jsx("span",{className:"relative inline-flex size-1.5 bg-run-active"})]}),pA(e.learning.state)]})]})}function EA({agentId:e,said:t,link:n}){const o=s.jsxs(Me,{tone:"muted",className:oe(n&&"cursor-pointer"),children:[s.jsx(n_,{className:"size-3","aria-hidden":!0}),"Kept nothing"]});return n?s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-2",children:[s.jsx("a",{href:Fd(e),"aria-label":`Kept nothing: ${t}`,className:"inline-flex",children:o}),s.jsx("span",{className:"text-small text-muted-foreground",children:t})]}):s.jsx("span",{title:`Kept nothing: ${t}`,"aria-label":`Kept nothing: ${t}`,className:"inline-flex",children:o})}function TA({agentId:e,refs:t,link:n,kind:o,pending:i}){const l=i?`${Yu(t.length,o)} ${t.length===1?"waits":"wait"} for your OK`:`Learned ${Yu(t.length,o)}`,c=`${l}: ${t.map(p=>p.name).join(", ")}`,u=i?kh:o==="skill"?Pu:Go,f=s.jsxs(Me,{tone:i?"warning":void 0,className:oe(!i&&"border-primary/50 bg-primary/10 text-primary-text",n&&"cursor-pointer"),children:[s.jsx(u,{className:"size-3","aria-hidden":!0}),l]});return n?s.jsx("a",{href:Fd(e),title:c,"aria-label":c,className:"inline-flex",children:f}):s.jsx("span",{title:c,"aria-label":c,className:"inline-flex",children:f})}function fu({agentId:e,refs:t,link:n,kind:o,replaces:i=0}){const l=o==="pending"?J1(t.length):o==="given"?`Started with: ${La(t.length)}`:o==="read"?`Read: ${La(t.length)}`:`Learned ${La(t.length)}`,c=t.map(m=>m.name).join(", "),u=o==="given"||o==="read",f=u?Mu:o==="pending"?kh:Nh,p=s.jsxs(Me,{tone:o==="pending"?"warning":void 0,className:oe(o==="learned"?"border-primary/50 bg-primary/10 text-primary-text":u?"border-border-strong/70 text-foreground/80":"",n&&"cursor-pointer transition-colors group-hover/tip:border-foreground/70"),children:[s.jsx(f,{className:"size-3","aria-hidden":!0}),l]}),h=t.filter(m=>m.file!==Z1),b=`${l}${c?`: ${c}`:""}${i?` (replaces ${i===1?"1 older note":`${i} older notes`})`:""}`;if(!n||!h.length&&o!=="pending")return s.jsx("span",{title:b,"aria-label":b,className:"inline-flex",children:p});const x=s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"caps block text-micro text-muted-foreground",children:o==="given"?"This run started with":o==="read"?"This run read":o==="learned"?"This run kept":"Waits for your OK before any run reads it"}),t.length>0&&s.jsx("ul",{className:"mt-1 space-y-0.5",children:t.map(m=>s.jsx("li",{className:"font-semibold",children:m.name},m.file))}),i>0&&s.jsxs("span",{className:"mt-1 block text-muted-foreground",children:["Replaces ",i===1?"1 older note":`${i} older notes`,"."]}),s.jsx("span",{className:"mt-1.5 block text-label text-muted-foreground",children:"Open in Learning"})]});return s.jsx(D4,{tip:x,children:s.jsx("a",{href:Fd(e,h.map(m=>m.file)),"aria-label":b,className:"inline-flex",children:p})})}function CA({n:e,className:t}){return e<=0?null:s.jsx("span",{"aria-label":ug(e),className:oe("inline-flex min-w-[18px] items-center justify-center border border-warning/50 bg-warning/10 px-1 font-mono text-micro text-warning-text",t),children:e})}function RA(e,t){var i;const n=e??"pi",o=(i=t.find(l=>l.id===n))==null?void 0:i.steer;return typeof o=="boolean"?o:n==="pi"}const ql={steer:!1,answer:!1,follow_up:!1,steer_workflow_runs:!1},AA=new Set(["completed","failed","cancelled"]);function OA(e,t,n,o,i){const c=e==="queued"||e==="working"&&t==="working"?i||n==="workflow"?"steer":"follow_up":e==="input_required"&&t==="waiting"?"answer":e==="input_required"||e==="working"||e==="completed"?"follow_up":null;return!c||!o[c]?null:n==="workflow"?c==="steer"&&o.steer_workflow_runs?c:null:c}const rj=(e,t)=>e==="failed"&&(t==null?void 0:t.code)==="escalated",MA=(e,t)=>e==="completed"&&!!t;function Vl(e,t,n,o,i,l,c){const u=AA.has(e),f=n==="agentic",p=rj(e,l),h=MA(e,c),b=p?"Escalated":h?"Needs review":e==="input_required"?t==="waiting"?"Input required":"Stopped":{queued:"Queued",working:"Working",completed:"Completed",failed:"Failed",cancelled:"Cancelled",paused:"Paused"}[e],x=p||h?"warning":e==="completed"?"success":e==="failed"?"error":e==="cancelled"?"muted":e==="input_required"||e==="paused"?"warning":"active",m=OA(e,t,n,o,i);return{label:b,tone:x,live:e==="queued"||e==="working",needsYou:e==="input_required",final:u,canStop:f&&e==="working"&&t==="working",canCancel:!u,canMessage:m!==null,messageMode:m}}const PA={Queued:bv,Working:bv,Completed:hd,Failed:Fa,Escalated:t_,"Needs review":a0,Cancelled:s0,"Input required":jh,Stopped:ml,Paused:o0};function Kl({run:e}){const t=Vl(e.status,e.state,e.kind,ql,!0,e.error,e.review),n=PA[t.label];return s.jsxs(Me,{tone:t.tone,children:[s.jsx(n,{className:t.live?"size-3 animate-spin [animation-duration:2s]":"size-3","aria-hidden":!0}),t.label]})}const ba=(e,t={})=>({type:"object",properties:{op:{const:e,description:`Action operation. Use "op": "${e}"; never use a "kind" field.`},id:{type:"string",description:'Bracketed ID copied from the latest snapshot, as a string. Use "id"; never use "ref".'},...t},required:["op","id",...Object.keys(t).filter(n=>n!=="delay")],additionalProperties:!1}),sr=(e,t=[])=>({type:"object",additionalProperties:!1,properties:e,...t.length?{required:t}:{}}),LA={name:"snapshot",label:"Browser: snapshot",description:"Capture the active page's accessibility tree and hydrate its displayed IDs for subsequent run actions. Every call replaces the active page's ID map. On an agent's browser computer a frame another site runs in its own process is not in the tree: the snapshot names each frame it left out.",parameters:sr({includeIframes:{type:"boolean",default:!0}}),effect:"read",replay:"safe",executionMode:"sequential",evidence:"none",listedWhen:"always"},IA=Object.freeze({cookies:"It keeps cookies across pages: use it for a page that depends on an earlier one, or one that sets cookies.",signIns:"This browser opens with this agent's saved browser profile: a site the agent was signed in to there opens signed in here, and only here (web_fetch reads every page signed out). Use it for anything behind a sign-in, or a page that depends on an earlier one."}),zA=e=>`Browse and automate websites in the persistent browser. ${IA.cookies} Navigate with JavaScript such as await page.goto("https://example.com"), or with a goto action; there is no separate navigate or start tool. Execute either a JavaScript workflow against the Stagehand Playwright facade or a batch of actions using IDs from the latest snapshot. Code is the body of an async function with page, context and browser in scope: \`return\` the value you want back. Provide exactly one of code or actions. An agent's browser computer (Browserbase, Kernel or Local Chrome) takes actions only: code is refused there. Each action must use "op" (never "kind") and "id" (never "ref"), but goto, which takes a "url". Copy the bracketed snapshot ID as a string. Examples: {"actions":[{"op":"goto","url":"https://example.com"}]}, {"actions":[{"op":"click","id":"1-42"}]}, {"actions":[{"op":"fill","id":"2-14","value":"Miami"}]}, {"actions":[{"op":"select","id":"3-9","values":"Lowest price"}]}.`,DA={name:"run",label:"Browser: run",description:zA(),parameters:sr({code:{type:"string",minLength:1},actions:{type:"array",description:'Snapshot actions with the exact fields "op" and "id" (goto: "op" and "url"). Do not use "kind" or "ref".',items:{oneOf:[{type:"object",properties:{op:{const:"goto",description:'Action operation. Use "op": "goto"; never use a "kind" field.'},url:{type:"string",description:"The http or https URL to open in the active page (or about:blank)."}},required:["op","url"],additionalProperties:!1},ba("click"),ba("hover"),ba("fill",{value:{type:"string"}}),ba("type",{text:{type:"string"},delay:{type:"number",minimum:0}}),ba("press",{key:{type:"string"}}),ba("select",{values:{oneOf:[{type:"string"},{type:"array",items:{type:"string"},minItems:1}]}})]},minItems:1}}),effect:"effect",replay:"unsafe",executionMode:"sequential",evidence:"none",listedWhen:"always"},FA={name:"screenshot",label:"Browser: screenshot",description:'Capture a screenshot of the active page. For size-constrained MCP clients, prefer a viewport JPEG: {"type":"jpeg","quality":40,"fullPage":false}.',parameters:sr({fullPage:{type:"boolean"},type:{type:"string",enum:["png","jpeg"]},quality:{type:"number",minimum:0,maximum:100},ask:{type:"string",description:"What you want to know from this capture. It travels with the image, so a host can answer it from the pixels when your model cannot see them."},clip:{...sr({x:{type:"number"},y:{type:"number"},width:{type:"number"},height:{type:"number"}},["x","y","width","height"]),description:"Capture only this region, in CSS pixels from the viewport's top-left corner (what the page shows now). Width and height 0 mean no clip: leave it out, or send zeros, to capture the whole viewport. A region that leaves the viewport is refused. Use one of clip, id or selector; an empty id or selector means none."},id:{type:"string",description:"Capture only this element: a bracketed ID from the latest snapshot, as a string. It is scrolled into view first. It must match one element."},selector:{type:"string",description:"Capture only the element this CSS selector matches (when there is no snapshot ID for it). It is scrolled into view first. It must match exactly one element."}}),effect:"read",replay:"safe",executionMode:"sequential",evidence:"image",listedWhen:"always"},UA={name:"browser_read",label:"Browser: read",description:"Read the CURRENT page of the browser as evidence and persist it under evidence/ with the page URL: `what` = markdown (the whole page as markdown, the default for citing), text, html, url, or title. This is the citable door for anything you saw in the browser: snapshot, screenshot and run return values are not evidence. Cite the returned URL. A browser page URL in a receipt keeps its query names but shows every value replaced by a redaction marker, the word redacted in square brackets (the site chose where the browser went, and a value in it can be a credential); web_fetch keeps a query value that is in the URL you asked for.",parameters:sr({what:{type:"string",enum:["markdown","text","html","url","title"],description:"Default markdown."}}),effect:"read",replay:"safe",executionMode:"sequential",evidence:"receipt",listedWhen:"always"},WA={name:"browser_release",label:"Browser: release",description:"Release the browser session now. You do not need it to finish: the session is released when your work ends and after a stretch with no browser call. Call it only to drop a session mid-task (to start the next browser call on a fresh session, or before a long stretch of work that needs no browser). Your next browser call launches a fresh session (a new tab, no cookies from the old one), so finish a flow before releasing.",parameters:sr({}),effect:"custody",replay:"safe",executionMode:"sequential",evidence:"none",listedWhen:"always"},HA={name:"browser_relaunch",label:"Browser: relaunch",description:"Replace the browser session with a fresh one, after a site blocked it (403/429, a CAPTCHA wall, a bot-detection page, an empty page that should have content). The new session is Verified whenever the run's sessions are, and a relaunch never lowers that: `verified: true` asks for a Verified session where the run's sessions are not (a Verified browser carries a stronger identity and costs more). Use `geolocation` to browse as a visitor from a given place: the proxy egresses from that country (ISO alpha-2), optionally a US state and a city, so geo-aware sites (storefront region, prices, payment methods, content availability) show what a local sees. Page state is lost; navigate again with run.",parameters:sr({verified:{type:"boolean",description:"true launches the new session as a Verified browser. false, or leaving it out, keeps the run's setting: a Verified run's sessions stay Verified."},geolocation:{type:"object",additionalProperties:!1,description:"Proxy egress location for the new session. Omit to keep the run's default.",properties:{country:{type:"string",description:"ISO 3166-1 alpha-2 country code, e.g. GB, US, DE."},state:{type:"string",description:"US state abbreviation, United States only."},city:{type:"string",description:"City name, e.g. LONDON or SAO_PAULO."}},required:["country"]}}),effect:"custody",replay:"safe",executionMode:"sequential",evidence:"none",listedWhen:"always"},BA={name:"browser_request_handoff",label:"Browser: hand to a person",description:"Hand the browser to a person for a step only a human can do: a CAPTCHA you cannot pass, a sign-in that needs their device, a confirmation only they can give. Say in instruction what they should do and in completion_condition what the page shows once it is done. The call waits until the person finishes, cancels or the request expires; while they have the browser, every other browser call fails with waiting_for_human. The same request_id retries the same request. Afterwards take a snapshot and check the completion condition on the page before acting.",parameters:sr({request_id:{type:"string",pattern:"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$",description:"A UUID you choose for this request; the same one retries the same request."},instruction:{type:"string",minLength:1,maxLength:2e3,description:"What the person should do, in plain words."},completion_condition:{type:"string",minLength:1,maxLength:1e3,description:"What the page shows once the step is done, for you to verify afterwards."}},["request_id","instruction","completion_condition"]),effect:"custody",replay:"safe",executionMode:"sequential",evidence:"none",listedWhen:"handoff"},GA={name:"browser_downloads",label:"Browser: downloads",description:"Copy the files this browser session downloaded into the workspace under downloads/, with downloads/manifest.json listing each file's SHA-256. Returns the files fetched now, those fetched before and those skipped with why, never their bytes; open a fetched file with read. A file the browser is still downloading is skipped as still downloading: call again to fetch it.",parameters:sr({}),effect:"read",replay:"safe",executionMode:"sequential",evidence:"files",listedWhen:"downloads"},qA={name:"browser_upload",label:"Browser: upload",description:"Choose one workspace file in a file input on the page, as a person picking it would; nothing is submitted. Returns the file's name, size and SHA-256; submit the form with run afterwards.",parameters:sr({path:{type:"string",minLength:1,maxLength:1e3,description:"The file's path relative to the workspace, for example reports/q3.pdf."},selector:{type:"string",minLength:1,maxLength:500,description:'CSS selector of the <input type="file">, for example input[type=file].'}},["path","selector"]),effect:"effect",replay:"unsafe",executionMode:"sequential",evidence:"none",listedWhen:"upload"},VA=Object.freeze([LA,DA,FA,UA,WA,HA,BA,GA,qA]),KA=Object.freeze(VA.map(e=>e.name)),Ka=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,Jn=e=>typeof e=="string"?e:void 0,_l=(e,t)=>e.length>t?`${e.slice(0,t-3)}...`:e,oj=e=>e.split(`
|
|
529
|
-
`).map(t=>t.trim()).find(Boolean)??"";function td(e){try{return Ka(JSON.parse(e))}catch{return}}const XA=/^[a-z][a-z0-9+.-]*:\/\/(?:[^@/?#]*@)?([^/?#]+)([^?#]*)/i;function $l(e){const t=XA.exec(e.trim());return _l(t?`${t[1]}${t[2]==="/"?"":t[2]}`:e.split(/[?#]/)[0]??"",80)}const YA="…",QA=/https?:\/\/[^\s"'`<>\\]+/gi,ZA=/^(https?:\/\/)(?:[^@/?#]*@)?([^/?#]*)([^?#]*)(?:\?([^#]*))?/i;function fg(e){return e.replace(QA,t=>{var l;const n=((l=/[.,;:!?)\]}]+$/.exec(t))==null?void 0:l[0])??"",o=ZA.exec(t.slice(0,t.length-n.length));if(!o)return t;const i=[...new Set((o[4]??"").split("&").map(c=>c.split("=")[0]).filter(Boolean))];return`${o[1]}${o[2]}${o[3]}${i.length?`?${i.map(c=>`${c}=${YA}`).join("&")}`:""}${n}`})}const JA=e=>e.length>2?`${e.slice(0,2).join(", ")}, +${e.length-2} more`:e.join(", "),eO=new Map,tO=new Map,aj=new Map;function hn(e,t,n,{name:o}={}){eO.set(e,t),n&&tO.set(e,n),o&&aj.set(e,o)}const nO=/^mcp__([a-z][a-z0-9-]{0,31})__([A-Za-z0-9_-]{1,64})$/,sO=e=>{const t=nO.exec(e);return t&&t[1]!=="hands"?`${t[1]} · ${t[2]}`:void 0},rO=e=>aj.get(e)??sO(e)??e,oO=new Map;function ij(e,t){oO.set(e,t)}const aO=new Set(["snapshot","run","screenshot","browser_read","browser_downloads"]);[...aO];const mg=e=>Jn(e.path)??Jn(e.file_path),iO=/page\.goto\(\s*["'`]([^"'`]+)/;hn("read",e=>`Read ${mg(e)??"a file"}`,{many:e=>`Read ${e} files`,subject:e=>e??void 0,path:!0},{name:"Read files"});hn("write",e=>`Wrote ${mg(e)??"a file"}`,{many:e=>`Wrote ${e} files`,subject:e=>e??void 0,path:!0},{name:"Write files"});hn("edit",e=>`Edited ${mg(e)??"a file"}`,{many:e=>`Edited ${e} files`,subject:e=>e??void 0,path:!0},{name:"Edit files"});hn("bash",e=>`Ran \`${_l(fg(oj(Jn(e.command)??"")),60)}\``,{many:e=>`Ran ${e} commands`},{name:"Run commands"});const lj=e=>{const t=e&&Ka(td(e.text)??td(oj(e.text)));if((t==null?void 0:t.ok)!==!1)return;const n=Jn(t.refused);return n!==void 0?{refused:!0,detail:n.replace(/^refused:\s*/,"")}:{refused:!1,detail:Jn(t.error)??Jn(t.message)??"no detail"}},lO=(e,t)=>`${lj(t)?"Tried to fetch":"Fetched"} ${$l(Jn(e.url)??"a page")}`,cO={many:e=>`Fetched ${e} pages`,subject:e=>e?$l(e):void 0},uO=e=>{const t=lj(e);return t&&{failed:!0,text:`${t.refused?"refused":"failed"}: ${t.detail}`}};hn("web_fetch",lO,cO,{name:"Fetch web pages"});ij("web_fetch",uO);hn("web_search",e=>{const t=Jn(e.query);return t?`Searched the web for "${_l(fg(t),60)}"`:"Searched the web"},{many:e=>`Searched the web ${e} times`,subject:e=>e?`"${_l(e,40)}"`:void 0},{name:"Search the web"});ij("web_search",e=>{var n;const t=Jn((n=Ka(td(e.text)))==null?void 0:n.error);return t!==void 0?{failed:!0,text:`failed: ${t}`}:void 0});hn("browser_read",(e,t)=>{var o;const n=t&&((o=/^title: (.+)$/m.exec(t.text))==null?void 0:o[1]);return n?`Read the page "${_l(fg(n),60)}"`:"Read the page"},{many:e=>`Read ${e} pages`,subject:(e,t)=>{var o;const n=t&&((o=/^url: (\S+)/m.exec(t))==null?void 0:o[1]);return n?$l(n):void 0}},{name:"Read the browser's page"});hn("snapshot",()=>"Looked at the page structure",{many:e=>`Looked at the page structure ${e} times`},{name:"Look at the page structure"});hn("screenshot",()=>"Took a screenshot",{many:e=>`Took ${e} screenshots`},{name:"Take screenshots"});hn("run",(e,t)=>{var l,c;const n=(l=iO.exec(Jn(e.code)??""))==null?void 0:l[1];if(n)return`Opened ${$l(n)}`;const o=(c=Ka(t==null?void 0:t.details))==null?void 0:c.sent,i=Array.isArray(o)?o.flatMap(u=>{const f=Ka(u),[p,h]=[Jn(f==null?void 0:f.method),Jn(f==null?void 0:f.url)];return p&&h?`${p} ${$l(h)}`:[]}):[];return i.length?`Acted on the page (${i.length} request${i.length===1?"":"s"} sent: ${JA(i)})`:"Acted on the page"},{many:e=>`Acted on the page ${e} times`},{name:"Open or act on a page in the browser"});hn("browser_downloads",(e,t)=>{var i;const n=t&&((i=td(t.text))==null?void 0:i.fetched),o=Array.isArray(n)?n.flatMap(l=>{var c;return Jn((c=Ka(l))==null?void 0:c.name)??[]}):[];return o.length===1?`Downloaded ${o[0]}`:o.length?`Downloaded ${o.length} files`:"Downloaded files"},{many:e=>`Downloaded files ${e} times`},{name:"Download files in the browser"});hn("browser_release",()=>"Released the browser session",void 0,{name:"Release the browser session"});hn("browser_relaunch",()=>"Started a fresh browser session",void 0,{name:"Start a fresh browser session"});hn("submit",()=>"Submitted the answer",void 0,{name:"Submit the answer"});hn("codemode",()=>"Ran a script",{many:e=>`Ran ${e} scripts`},{name:"Run scripts"});hn("request_sign_in",()=>"Asked you to sign in",void 0,{name:"Ask you to sign in"});const dO="These are the tools the server offers, not what this credential allows: a read-only token still sees its write tools. A call the credential can't make is refused by the server when a run makes it.",fO=(e,t)=>`mcp:${e}/${t}`;function nd(e){const t=/^mcp:([^/]+)\/(.+)$/.exec(e);return t?{server:t[1],tool:t[2]}:null}const mO=/^[A-Za-z0-9_-]{1,52}$/;function pO(e,t){if(e==="hands")return"hands is the harnesses' own name: save this server under another to grant its tools";const n=`mcp__${e}__${t}`;if(!mO.test(n))return/^[A-Za-z0-9_-]+$/.test(t)?`name too long to grant (${n.length}/52)`:"its name has a character a tool name can't carry"}function hO(e,t,n){const o=t.input_schema,i=n==="claude-agent"&&o&&typeof o=="object"?["anyOf","allOf","oneOf"].find(l=>l in o):void 0;return pO(e,t.name)??(i?`claude-agent drops a tool whose schema's root has ${i}`:void 0)}function gO(e,t){return e.flatMap(n=>{const o=nd(n);if(!o)return[];const i=t.find(l=>l.name===o.server);return i?i.tools.some(l=>l.name===o.tool)?[]:[{grant:n,why:`${o.server} no longer lists ${o.tool}: refresh it, or untick this.`}]:[{grant:n,why:`The MCP server ${o.server} is not saved here any more, so a run can't call it.`}]})}function El(e){var n,o,i,l;if(!(e instanceof Ee))return{text:`The request didn't reach this server: ${e instanceof Error?e.message:String(e)}`};const t=(n=e.fields)==null?void 0:n.find(c=>c.field==="url"&&c.reason==="redirect");return e.code==="auth_required"?((o=e.details)==null?void 0:o.auth)==="oauth"?{text:"This server signs in with OAuth.",detail:"Sign in to it: its tools are saved once you approve.",signIn:!0}:{text:"This server asks for a token.",detail:e.message}:e.code==="not_mcp"?{text:"This address doesn't speak MCP.",detail:e.message}:t?{text:"This address redirects; use the final address.",detail:t.message}:e.status===424?{text:`The server failed: ${e.message}`}:e.code==="wrong_origin"?{text:"Sign in from this server's own address: the sign-in comes back there.",...typeof((i=e.details)==null?void 0:i.open)=="string"?{detail:`Open ${e.details.open} and sign in from it.`}:{}}:(l=e.fields)!=null&&l.length?{text:e.fields.map(c=>c.message).join(" ")}:{text:`${e.code}: ${e.message}`}}const qb={access_denied:"the sign-in was declined on its approval page",invalid_scope:"its authorization server doesn't offer the scopes asked for: change them and sign in again",invalid_grant:"its authorization server didn't take the sign-in's code (it expired, or was used already): sign in again",invalid_client:"its authorization server didn't take this client: check the client ID and secret, or leave them empty",unauthorized_client:"its authorization server doesn't let this client sign in this way: check the client ID, or leave it empty",invalid_request:"its authorization server refused the sign-in's request",unsupported_response_type:"its authorization server doesn't support this way of signing in",unsupported_grant_type:"its authorization server doesn't support this way of signing in",invalid_target:"its authorization server won't give a token for this MCP server",server_error:"its authorization server failed: try again",temporarily_unavailable:"its authorization server is busy: try again in a moment",login_required:"its authorization server wants you to sign in on its page: sign in again",interaction_required:"its authorization server wants you to sign in on its page: sign in again",consent_required:"its authorization server wants your consent on its page: sign in again",auth_required:"the MCP server didn't take the token the sign-in gave",not_mcp:"the address doesn't speak MCP",input_invalid:"the MCP server's tools could not be kept (too many of them, or the address redirects)",upstream_failed:"the MCP server or its authorization server failed: try again",unavailable:"this server was stopping: sign in again",changed_meanwhile:"the server was changed or removed while you signed in, so nothing was saved"},xO="the sign-in didn't finish: try again",yO=e=>e&&Object.hasOwn(qb,e)?qb[e]:xO;function vO(e){const t=new URLSearchParams(e??""),n=t.get("server"),o=t.get("sign_in");if(!(!n||o!=="ok"&&o!=="failed"))return{server:n,ok:o==="ok",...o==="failed"?{error:t.get("error")??"sign_in_failed"}:{}}}function Xl(e){const t=/^mcp:([a-z][a-z0-9-]{0,31})\/(.+)$/.exec(e);return t?{server:t[1],tool:t[2]}:null}function bO(e){const t=/^mcp__([a-z][a-z0-9-]{0,31})__(.+)$/.exec(e);return t&&t[1]!=="hands"?`${t[1]} · ${t[2]}`:null}const pg=(e,t)=>[e,t!=null&&t.model?t.tier:void 0,t==null?void 0:t.model].filter(Boolean).join(" · "),cj=e=>e!=null&&e.model?`ran on ${e.model}${e.tier?` (the ${e.tier} tier)`:""}`:"",wO={user_message:Sh,thinking:e_,tool_use:Pu,tool_result:Pu,waiting:jh,usage:vh,final_answer:Xa,phase:i0,error:Fa,decision:w_,text_block:h_,tool_approval_requested:f0},Vb=e=>{var t;return e.kind==="tool_approval_requested"?(t=/\n\n(Not sent: [\s\S]*)$/.exec(e.text??""))==null?void 0:t[1]:void 0},Kb=e=>e.kind==="tool_approval_requested"&&(e.summary??"").startsWith("Waiting for your approval"),hg=e=>e.origin==="server",uj=e=>e.origin==="trigger",dj=e=>{var l;const t=e.summary??"",n=(l=e.trigger)==null?void 0:l.name,o=n?t.indexOf(` ${n}: `):-1;if(n&&o>0&&!t.slice(0,o).includes(" "))return{who:t.slice(0,o+1+n.length),said:t.slice(o+n.length+3).trimStart()};const i=/^([^:]+):\s*/.exec(t);return i?{who:i[1],said:t.slice(i[0].length)}:{who:null,said:t}},kO=e=>{const t=uj(e)?dj(e).said:(e.summary??"").replace(hg(e)?/^AgentRun:\s*/:/^(You|Thinking|Asked you|Waiting for you):\s*/,"");if(e.kind==="user_message"&&t.startsWith("{"))try{return Object.entries(JSON.parse(t)).map(([n,o])=>`${n}: ${typeof o=="string"?o:JSON.stringify(o)}`).join(" · ")}catch{}if(e.kind==="final_answer"){const n=(e.text??"").split(`
|
|
530
|
-
`).filter(o=>o.trim()).length>1;return`${t.replace(/^\s*(#{1,6}\s+|>\s+|[-*+]\s+)/,"").replace(/(\*\*|__|`)/g,"")}${n?"…":""}`}return t},Vp=e=>e<1e3?`${e} ms`:`${(e/1e3).toFixed(1)} s`,jO=new Set(KA),Xb=e=>e&&(bO(e)??(jO.has(e)?rO(e):e)),Yb=e=>hg(e)?"AgentRun":uj(e)?dj(e).who??"Trigger":{user_message:"You",thinking:"Thinking",tool_use:Xb(e.tool_name)??"Tool",tool_result:Xb(e.tool_name)??"Result",waiting:"Waiting for you",usage:"Usage",final_answer:"Answer",phase:"Phase",error:"Error",decision:"Decision",text_block:"Text",tool_approval_requested:"Your approval",learning:"Learning"}[e.kind]??e.kind,NO={budget:"Paused at cap"};function SO({step:e,last:t,waitingChip:n}){var x;const o=e.row,[i,l]=y.useState(!1),u=d4(o)?o0:wO[o.kind]??i0,f=e.above?o.kind==="tool_approval_requested"?"Waits for your approval above.":"Asked you the question above.":kO(o),p=e.above?null:e.detail??C1(o),h=p&&p.trim()!==f.trim()?p:null,b=R1(o);return s.jsxs("li",{className:"relative flex gap-3",children:[s.jsxs("div",{className:"flex w-7 shrink-0 flex-col items-center",children:[s.jsx("span",{className:oe("mt-3 flex size-7 items-center justify-center border bg-background",(o.kind==="waiting"||Kb(o))&&"border-warning/60 text-warning-text",b&&"border-destructive/60 text-destructive-text"),children:s.jsx(u,{className:"size-3.5","aria-hidden":!0})}),!t&&s.jsx("span",{className:"w-px flex-1 bg-border","aria-hidden":!0})]}),s.jsxs("div",{className:"min-w-0 flex-1 border-b py-3",children:[s.jsxs("button",{type:"button",className:"flex w-full items-start gap-3 text-left",onClick:()=>l(m=>!m),"aria-expanded":i,disabled:!h,children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-body text-muted-foreground",children:[s.jsx("span",{"data-label":!0,className:"min-w-0 truncate",title:Yb(o),children:Yb(o)}),o.kind==="waiting"&&s.jsx(Me,{tone:"warning",children:n??"Input required"}),Kb(o)&&s.jsx(Me,{tone:"warning",children:"Approval required"}),b&&s.jsx(Me,{tone:"error",children:"Error"}),o.agent_label&&s.jsx(Me,{children:o.agent_label}),e.ms!==void 0&&s.jsx("span",{className:"font-mono text-label",children:Vp(e.ms)}),e.times&&s.jsxs("span",{className:"font-mono text-label",children:[e.times," times",e.until?` over ${Vp(Math.max(0,Date.parse(e.until)-Date.parse(o.timestamp)))}`:""]})]}),s.jsx("span",{className:oe("mt-0.5 block break-words text-prose leading-snug",hg(o)&&"text-muted-foreground"),children:f}),e.saved&&s.jsxs("span",{className:"mt-0.5 block font-mono text-small text-muted-foreground",children:["saved ",e.saved]}),Vb(o)&&s.jsx("span",{className:"mt-0.5 block break-words text-body text-muted-foreground",children:Vb(o)})]}),s.jsx("span",{className:"caps shrink-0 pt-0.5 text-label text-muted-foreground",children:Id(o.timestamp)}),h&&s.jsx(Us,{className:oe("mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform",i&&"rotate-90"),"aria-hidden":!0})]}),i&&h&&s.jsx("pre",{className:"mt-3 max-h-80 overflow-auto whitespace-pre-wrap break-words border bg-card p-3 font-mono text-small leading-[1.7]",children:h}),(x=o.learned_nodes)!=null&&x.length?s.jsx($O,{nodes:o.learned_nodes}):null]})]})}const _O={ok:"success",failed:"error",escalated:"warning"};function $O({nodes:e}){const[t,n]=y.useState(!1),o=Object.entries(e.reduce((l,c)=>({...l,[c.status]:(l[c.status]??0)+1}),{})).filter(([l])=>l!=="ok"),i=[`${e.length} ${e.length===1?"node":"nodes"}`,...o.map(([l,c])=>`${c} ${l}`)].join(" · ");return s.jsxs("div",{className:"mt-2",children:[s.jsxs("button",{type:"button",className:"caps flex items-center gap-1 text-label text-muted-foreground hover:text-foreground",onClick:()=>n(l=>!l),"aria-expanded":t,"aria-label":`${t?"Hide":"Show"} the workflow's ${e.length===1?"node":"nodes"}`,children:[s.jsx(Us,{className:oe("size-3 transition-transform",t&&"rotate-90"),"aria-hidden":!0}),s.jsx(Go,{className:"size-3","aria-hidden":!0}),i]}),t&&s.jsx("ol",{"aria-label":"The workflow's nodes",className:"mt-2 divide-y border bg-card",children:e.map((l,c)=>s.jsxs("li",{className:"flex items-center gap-3 px-3 py-1.5",children:[s.jsx("span",{"data-status":l.status,className:"contents",children:s.jsx(Me,{tone:_O[l.status]??"muted",className:"w-[5.5rem] justify-center",children:l.status})}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-body",title:l.label,children:l.label}),s.jsx("span",{"data-kind":!0,className:"font-mono text-label text-muted-foreground",title:cj(l)||void 0,children:pg(l.kind,l)}),s.jsx("span",{className:"w-14 text-right font-mono text-label text-muted-foreground",children:Vp(l.duration_ms)})]},c))})]})}function fj({rows:e,live:t,fold:n=6,asking:o,waitingOn:i}){var x;const l=i==="budget"?e.findLastIndex(m=>m.paused===!0):-1,c=l>=0?(x=e.slice(l+1).findLast(m=>m.kind==="waiting"))==null?void 0:x.id:void 0,[u,f]=y.useState(!1),p=f4(e).map(m=>o&&m.row.id===o?{...m,above:!0}:m),h=u?0:Math.max(0,p.length-n),b=p.slice(h);return e.length?s.jsxs("div",{children:[h>0&&s.jsxs("button",{type:"button",className:"caps mb-1 ml-10 flex items-center gap-1 py-2 text-label text-muted-foreground hover:text-foreground",onClick:()=>f(!0),children:[s.jsx(Us,{className:"size-3","aria-hidden":!0})," ",h," earlier steps"]}),s.jsx("ol",{children:b.map((m,v)=>s.jsx(SO,{step:m,last:v===b.length-1&&!t,waitingChip:m.row.id===c&&i?NO[i]:void 0},m.row.id))}),t&&s.jsx(Kp,{title:"Working",note:"Steps appear as the agent takes them.",spin:!0})]}):s.jsx(Kp,{title:t?"The run is starting":"Nothing on the timeline",note:t?"Steps appear here as the agent works.":"This run recorded no steps.",spin:t})}function Kp({title:e,note:t,spin:n=!0}){return s.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-center",children:[n&&s.jsx(I4,{className:"size-5"}),s.jsx("p",{className:"caps text-label font-semibold",children:e}),s.jsx("p",{className:"max-w-sm text-body text-muted-foreground",children:t})]})}const Qb=new Set(["completed","failed","cancelled"]),EO={firstMs:2e3,maxMs:16e3,totalMs:12e4};function mj(e,t,n,o=EO){var h;const i=!!e&&Qb.has(e.status)&&q1(e.learning),l=y.useRef(t);l.current=t;const c=y.useRef(n);c.current=n;const u=(h=e==null?void 0:e.learning)==null?void 0:h.state,f=!!e&&Qb.has(e.status),p=y.useRef(u);y.useEffect(()=>{var x;const b=p.current;p.current=u,b!==void 0&&b!==u&&f&&((x=c.current)==null||x.call(c))},[u,f]),y.useEffect(()=>{if(!i)return;let b,x=0,m=o.firstMs,v=!1,w=!1;const j=()=>{w||x+m>o.totalMs||(b=setTimeout(S,m))},S=()=>{if(b=void 0,document.visibilityState==="hidden"){v=!0;return}x+=m,m=Math.min(m*2,o.maxMs),l.current(),j()},T=()=>{v&&document.visibilityState!=="hidden"&&(v=!1,S())};return document.addEventListener("visibilitychange",T),j(),()=>{w=!0,b&&clearTimeout(b),document.removeEventListener("visibilitychange",T)}},[i])}function TO({v2:e,run:t,onRun:n}){const[o,i]=y.useState(null),[l,c]=y.useState(null),[u,f]=y.useState(null),[p,h]=y.useState(null),[b,x]=y.useState(!1),[m,v]=y.useState(0),w=y.useRef(Ku()).current,j=y.useRef(`${t.status}/${t.state}`),S=y.useRef(null),T=y.useRef(j.current),$=async R=>{const C=w.begin();S.current=R;let O="";for(const z of Hp){if(z&&await z1(z),!w.current(C))return;try{const F=await e.getRun(t.run_id);if(!w.current(C))return;j.current=R,S.current=null,h(null),n(F);return}catch(F){O=Nn(F)}}w.current(C)&&(S.current=null,h(O))};y.useEffect(()=>{const R=new AbortController;return rg(e,t.run_id,{signal:R.signal,onRows:i,onPage:C=>{f({status:C.status,state:C.state});const O=`${C.status}/${C.state}`,z=O!==T.current;if(T.current=O,O===j.current){w.cancel(),S.current=null,h(null);return}(z||S.current===null)&&$(O)}}).catch(C=>{R.signal.aborted||c(Nn(C))}),()=>{R.abort(),w.cancel(),S.current=null}},[e,t.run_id,m]),mj(t,()=>{const R=j.current;e.getRun(t.run_id).then(C=>{j.current===R&&S.current===null&&n(C)},()=>{})},()=>v(R=>R+1));const _=`#/runs/${encodeURIComponent(t.run_id)}`,E=u??t;return s.jsxs("section",{className:"mb-6 border","aria-label":"Latest run",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-b px-4 py-2",children:[s.jsx("span",{className:"caps text-label font-semibold",children:"Latest run"}),p?s.jsx(Me,{tone:"muted",children:"Not refreshed"}):s.jsx(Kl,{run:t}),s.jsx("a",{href:_,className:"min-w-0 flex-1 truncate text-lead hover:underline",title:rn(t),children:rn(t)}),s.jsx(Ud,{run:t,link:!0}),s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:St(t.created_at)}),s.jsxs("a",{href:_,className:Va({size:"sm"}),children:["Open the run ",s.jsx(xh,{"aria-hidden":!0})]})]}),p&&s.jsxs("p",{className:"flex flex-wrap items-center gap-3 border-b px-4 py-2 font-mono text-small text-destructive-text",role:"alert",children:["This run could not be refreshed: ",p,s.jsx(Z,{type:"button",disabled:b,onClick:()=>{x(!0),$(T.current).finally(()=>x(!1))},size:"xs",className:"text-foreground",children:b?"Retrying":"Retry"})]}),s.jsx("div",{className:"px-4 py-3",children:l?s.jsxs("p",{className:"font-mono text-body text-destructive-text",role:"alert",children:["The timeline could not be read: ",l]}):o?s.jsx(fj,{rows:sj(o,t.learning),live:Vl(E.status,E.state,t.kind,ql,!0).live}):s.jsx("p",{className:"py-6 text-center font-mono text-body text-muted-foreground",children:"Reading the timeline..."})})]})}function $n({problem:e,onRetry:t,link:n,className:o="m-8"}){return s.jsxs("section",{className:`flex gap-3 border bg-card px-4 py-4 md:px-5 ${o}`,role:"alert",children:[s.jsx(er,{className:"mt-0.5 size-4 shrink-0 text-destructive-text","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-prose font-semibold",children:e.title}),s.jsxs("p",{className:"mt-1 text-lead leading-relaxed",children:[e.why," ",e.next]}),(e.said||e.code)&&s.jsx("p",{className:"mt-2 break-words font-mono text-label text-muted-foreground",children:[e.said,e.code].filter(Boolean).join(" · ")}),(t||n)&&s.jsxs("div",{className:"mt-3 flex flex-wrap gap-3",children:[t&&s.jsx(Z,{type:"button",onClick:t,size:"sm",children:"Try again"}),n&&s.jsx("a",{href:n.href,className:"caps border px-3 py-2 text-small hover:bg-accent",children:n.label})]})]})]})}function pj({what:e,id:t,list:n}){return s.jsx($n,{problem:{title:`No ${e} with this id.`,why:`This server has no ${e} ${t}.`,next:`Check the address, or find the ${e} in the list.`},link:n})}function CO(e,{base:t="/v2",onProgress:n,signal:o,request:i=()=>new XMLHttpRequest}={}){return new Promise((l,c)=>{if(o!=null&&o.aborted)return c(new Ee(0,"aborted","The upload was stopped."));const u=i();u.open("POST",`${t}/files?path=${encodeURIComponent(e.name)}`),u.setRequestHeader("accept","application/json"),e.type&&u.setRequestHeader("content-type",e.type),u.upload.onprogress=f=>{f.lengthComputable&&f.total>0&&(n==null||n(Math.min(1,f.loaded/f.total)))},u.onload=()=>{let f=null;try{f=JSON.parse(u.responseText)}catch{}if(u.status===201||u.status===200){const b=f==null?void 0:f.file;return b!=null&&b.file_id?(n==null||n(1),l(b)):c(new Ee(u.status,"bad_answer","The server's answer named no file."))}const p=f==null?void 0:f.error,h=new Ee(u.status,(p==null?void 0:p.code)??"http_error",(p==null?void 0:p.message)??`The server answered ${u.status}.`,(p==null?void 0:p.retryable)??!1,p==null?void 0:p.request_id);p!=null&&p.fields&&(h.fields=p.fields),c(h)},u.onerror=()=>c(new Ee(0,"network","The upload did not reach the server.")),u.onabort=()=>c(new Ee(0,"aborted","The upload was stopped.")),o==null||o.addEventListener("abort",()=>u.abort(),{once:!0}),u.send(e)})}const hj=(e,t,n)=>CO(e,{onProgress:t,signal:n});function cp(e){if(!(e instanceof Ee))return e instanceof Error?e.message:String(e);const t=(e.fields??[]).filter(n=>n.message!==e.message).map(n=>n.message);return[e.message,...t].join(" ")}function gj({upload:e,remove:t,limits:n,frozen:o=!1}){const[i,l]=y.useState([]),[c,u]=y.useState([]),f=y.useRef(new Map),p=y.useRef(0),h=y.useRef(0);h.current=i.length;const b=y.useRef({items:i,frozen:o,remove:t});b.current={items:i,frozen:o,remove:t};const x=y.useRef(!0);y.useEffect(()=>{x.current=!0;const S=f.current;return()=>{var E;x.current=!1;for(const R of S.values())R.abort();const{items:T,frozen:$,remove:_}=b.current;if(!$)for(const R of T)R.file&&!R.removing&&((E=_==null?void 0:_(R.file.file_id))==null||E.catch(()=>{}))}},[]);const m=y.useCallback(S=>{if(b.current.frozen)return;const T=[],$=n?n.max_files_per_run-h.current:1/0,_=(n==null?void 0:n.max_upload_bytes)??null,E=[];for(const C of S)_!==null&&C.size>_?T.push({text:`${C.name} is ${Ha(C.size)}: this server takes files up to ${Ha(_)}.`}):E.length>=$?T.push({text:`${C.name} is not added: a run names at most ${n==null?void 0:n.max_files_per_run} files here.`}):E.push(C);u(T);const R=E.map(C=>({key:`f${p.current++}`,name:C.name,size:C.size,progress:0}));h.current+=R.length,l(C=>[...C,...R]),R.forEach((C,O)=>{const z=new AbortController;f.current.set(C.key,z);const F=D=>{x.current&&l(B=>B.map(U=>U.key===C.key?{...U,...D}:U))};e(E[O],D=>F({progress:D}),z.signal).then(D=>{var B,U,W;if(f.current.delete(C.key),z.signal.aborted){(W=(U=(B=b.current).remove)==null?void 0:U.call(B,D.file_id))==null||W.catch(X=>{x.current&&u(M=>[...M,{text:`${C.name} was sent before it was stopped, and was not removed: ${cp(X)}`}])});return}F({file:D,progress:1})},D=>{f.current.delete(C.key),!(z.signal.aborted||!x.current)&&(l(B=>B.filter(U=>U.key!==C.key)),u(B=>[...B,{text:`${C.name}: ${cp(D)}`}]))})})},[n==null?void 0:n.max_files_per_run,n==null?void 0:n.max_upload_bytes,e]),v=y.useCallback(S=>{var R;const{items:T,frozen:$,remove:_}=b.current,E=T.find(C=>C.key===S);if(!($||!E||E.removing)){if(!E.file||!_){(R=f.current.get(S))==null||R.abort(),f.current.delete(S),l(C=>C.filter(O=>O.key!==S));return}l(C=>C.map(O=>O.key===S?{...O,removing:!0}:O)),u(C=>C.filter(O=>O.about!==S)),_(E.file.file_id).then(()=>{x.current&&l(C=>C.filter(O=>O.key!==S))},C=>{x.current&&(l(O=>O.map(z=>z.key===S?{...z,removing:!1}:z)),u(O=>[...O,{about:S,text:`${E.name} was not removed: ${cp(C)}`}]))})}},[]),w=y.useCallback(()=>{b.current={...b.current,items:[]},l([]),u([])},[]),j=i.flatMap(S=>S.file&&!S.removing?[S.file.file_id]:[]);return{items:i,refusals:c.map(S=>S.text),add:m,drop:v,clear:w,fileIds:j,frozen:o,busy:i.some(S=>!S.file||S.removing)}}function Xp({attachments:e,limits:t,disabled:n,compact:o=!1}){const i=y.useRef(null),[l,c]=y.useState(!1),{items:u,refusals:f,add:p,drop:h}=e,b=n||e.frozen,x=t?[`up to ${t.max_files_per_run} files`,...t.max_upload_bytes!==null?[`${Ha(t.max_upload_bytes)} each`]:[]].join(", "):"";return s.jsxs("div",{className:oe("border border-dashed px-3 py-2.5",l?"border-primary bg-primary/5":"border-border",o&&"max-sm:border-0 max-sm:p-0"),onDragOver:m=>{b||(m.preventDefault(),c(!0))},onDragLeave:()=>c(!1),onDrop:m=>{m.preventDefault(),c(!1),b||p([...m.dataTransfer.files])},role:"group","aria-label":"Files for the run",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(Z,{type:"button",size:"sm",onClick:()=>{var m;return(m=i.current)==null?void 0:m.click()},disabled:b,title:o?`Attach files${x?` (${x})`:""}`:void 0,className:oe(o&&"max-sm:h-10 max-sm:w-10 max-sm:px-0"),children:[s.jsx(y_,{"aria-hidden":!0})," ",s.jsx("span",{className:oe(o&&"max-sm:sr-only"),children:"Attach files"})]}),s.jsxs("span",{className:oe("text-small text-muted-foreground",o&&"max-sm:hidden"),children:["or drop them here",x?` (${x})`:"",". The run finds them in inputs/."]}),s.jsx("input",{ref:i,type:"file",multiple:!0,hidden:!0,"aria-label":"Pick files",onChange:m=>{p([...m.target.files??[]]),m.target.value=""}})]}),u.length>0&&s.jsx("ul",{className:"mt-2 flex flex-wrap gap-2","aria-label":"Attached files",children:u.map(m=>s.jsxs("li",{className:"flex h-7 items-center gap-2 border bg-card px-2 font-mono text-small",children:[s.jsx("span",{className:"max-w-[16rem] truncate",title:m.name,children:m.name}),s.jsx("span",{className:"text-muted-foreground",children:Ha(m.size)}),!m.file&&s.jsxs("span",{className:"text-muted-foreground","aria-label":`${m.name} sent ${Math.round(m.progress*100)}%`,children:[Math.round(m.progress*100),"%"]}),m.removing&&s.jsx("span",{className:"text-muted-foreground",children:"removing"}),s.jsx("button",{type:"button",onClick:()=>h(m.key),disabled:b||m.removing,"aria-label":`Remove ${m.name}`,className:"text-muted-foreground hover:text-foreground disabled:opacity-45",children:s.jsx(Ll,{className:"size-3.5","aria-hidden":!0})})]},m.key))}),u.some(m=>!m.file)&&s.jsx("p",{className:"mt-2 text-small text-muted-foreground",role:"status",children:"The run can start once every file is sent."}),f.length>0&&s.jsx("ul",{className:"mt-2 font-mono text-small text-destructive-text",role:"alert",children:f.map((m,v)=>s.jsx("li",{children:m},`${v}:${m}`))})]})}const RO=["pi","claude-agent","codex","opencode"];function AO(e){const t=new Set,n=o=>{if(Array.isArray(o)){o.forEach(n);return}if(!o||typeof o!="object")return;const i=o;i.node==="call"&&typeof i.tool=="string"&&t.add(i.tool),Object.values(i).forEach(n)};return n(e),[...t].sort()}function OO(e){const t=n=>Array.isArray(n)&&n.every(o=>typeof o=="string")?[...new Set(n)]:[];return{denied:t(e==null?void 0:e.denied),asks:t(e==null?void 0:e.asks)}}function MO(e){return(Array.isArray(e)?e:[]).flatMap(t=>{const n=t;return!n||typeof n.name!="string"||!Array.isArray(n.providers)||!n.providers.length?[]:[{name:n.name,providers:n.providers,provider:n.provider??n.providers[0],default_provider:n.default_provider??n.providers[0],resolves:n.resolves&&typeof n.resolves=="object"?n.resolves:{},available:n.available!==!1,...typeof n.reason=="string"&&n.reason?{reason:n.reason}:{}}]})}const gg="Refused on this server for every agent, whatever the agent's own setting or Never ask.",PO="Deny stops this tool only. The agent can still reach the web with other tools it has, such as browser, bash or web_search: deny those too to keep it offline.",xj=(e,t,n,o)=>{var u;const i=n==null?void 0:n.find(f=>f.name===e);if(i)return i.permission==="deny"&&i.permission_from==="server";const l=/^mcp:([^/]+)\/(.+)$/.exec(e),c=l?(u=o==null?void 0:o.find(f=>f.name===l[1]))==null?void 0:u.tools.find(f=>f.name===l[2]):void 0;return c?c.permission==="deny":t.some(f=>f.name===e&&f.permission==="deny")};function LO(e){return(e??[]).map(({name:t,permission:n,default_permission:o,permissions:i,ask_needs:l})=>({name:t,permission:n,default_permission:o,permissions:i,...l==="password"?{ask_needs:l}:{}}))}const IO={auto:"auto",native:"native",kernel:"kernel fetch","exa-keyless":"Exa keyless",parallel:"Parallel"},yj={browser:{label:{auto:"Auto (Browserbase where its key is saved, else Kernel)",browserbase:"Browserbase",kernel:"Kernel",chrome:"Local Chrome"},help:{auto:"Browserbase where its key is set or saved, else Kernel where its key is; unavailable with neither.",browserbase:"Browserbase's hosted browser: needs the Browserbase key and project id.",kernel:"Kernel's hosted browser: needs the Kernel key.",chrome:"A Chrome on this server's own host. No server sets one up yet, so it stays unavailable."}}},sd=(e,t)=>{var n;return(t&&((n=yj[t])==null?void 0:n.label[e]))??IO[e]??e},zO={auto:"The harness's own search, or the model provider's hosted one, else keyless Exa.",native:"The harness's own search, or the model provider's hosted one, never a third party: unavailable where there is none.","exa-keyless":"Exa's keyless search: no key, a third party.",parallel:"Parallel: needs the Parallel key.",kernel:"This server's own fetch, guarded against private addresses."},Zb=(e,t)=>{var n;return(t&&((n=yj[t])==null?void 0:n.help[e]))??zO[e]};function vj(e,t){return e?e.startsWith("unavailable")?{text:e,unavailable:!0}:{text:sd(e,t),unavailable:!1}:{text:"not known",unavailable:!1}}function bj(e,t,n,o,i){const{[t]:l,...c}=e,{[n]:u,...f}=l??{},p=o===void 0||o===i?f:{...f,[n]:o};return Object.keys(p).length?{...c,[t]:p}:c}const DO=(e,t,n,o)=>bj(e,t,"provider",n,o),FO=(e,t,n,o)=>bj(e,t,"permission",n,o);function Jb(e,t){const n=new Map(t.map(o=>[o.name,o.default_provider]));return Object.fromEntries(Object.entries(e).flatMap(([o,i])=>{if(!i||typeof i!="object")return[];const{provider:l,...c}=i,u=l!==void 0&&!(n.has(o)&&l===n.get(o))?{...c,provider:l}:c;return Object.keys(u).length?[[o,u]]:[]}))}function wj(e,t,n){const o={},i=[];for(const[l,c]of Object.entries(e)){if(t&&l!==t&&!l.startsWith(`${t}.`)&&!l.startsWith(`${t}/`))continue;const u=t?l.slice(t.length+1):l,f=[...n].sort((p,h)=>h.length-p.length).find(p=>u===p||u.startsWith(`${p}.`)||u.startsWith(`${p}/`));f?(o[f]??(o[f]=[])).push(c):i.push(c)}return{byTool:o,rest:i}}const UO=e=>{if(!Array.isArray(e))return[e];const t=[...new Set(e.filter(n=>n!==null).map(n=>JSON.stringify(n)))].sort();return[...e.includes(null)?[null]:[],...t.map(n=>JSON.parse(n))]},WO=e=>typeof e=="string"?e:JSON.stringify(e);function HO(e){return Object.keys(e).sort().map(t=>{const n=UO(e[t]),o=n[0]===null,i=(o?n.slice(1):n).map(c=>WO(c));if(!i.length)return`${t} must be left out`;const l=i.length===1?i[0]:`one of ${i.join(", ")}`;return`${t} must be ${o?`left out or ${l}`:l}`}).join("; ")}const BO="Calls outside it are refused before they run or ask.",GO="This pin doesn't read, so every call to this tool is refused. Set the pin again, or remove the tool's setting.";function kj({agentId:e,details:t}){const{denied:n,asks:o}=OO(t),i=[...new Set([...n,...o])];return i.length?s.jsxs("p",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1",children:[i.map(l=>s.jsxs("a",{href:`#/agents/${encodeURIComponent(e)}/edit?tool=${encodeURIComponent(l)}`,className:"underline underline-offset-4",children:["Set ",l," for this agent"]},l)),s.jsxs("span",{children:["or for every agent: ",s.jsx("a",{href:"#/settings/tools",className:"underline underline-offset-4",children:"Settings → Tools"})]})]}):null}function Wd(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const e=crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Ws(e=Wd){let t=null;return{keyFor(n,o){const i=JSON.stringify([n,o]);return(t==null?void 0:t.request)!==i&&(t={request:i,key:e()}),t.key},done(){t=null}}}async function jj(e,t,n,o){const i=await o(t,n,e.keyFor(t,{content:n}));return e.done(),i}function qO(e=Wd){const t=new Map;return n=>{let o=t.get(n);return o||(o=Ws(e),t.set(n,o)),o}}function Nj(e,t){const n=new Set(e.map(o=>o.run_id));return[...e,...t.filter(o=>!n.has(o.run_id))]}function Sj(e,t){var i,l;let n;if(e==="agentic"){if(!t.text.trim())return{ok:!1,field:"input",message:"Write the run's first message."};n={content:t.text}}else try{n=JSON.parse(t.text)}catch{return{ok:!1,field:"input",message:"The workflow's input is JSON: this is not."}}const o={input:n};if(t.revision&&(o.revision=t.revision),t.effort&&(o.effort=t.effort),e==="agentic"&&((i=t.maxCostUsd)!=null&&i.trim())){const c=Number(t.maxCostUsd);if(!Number.isFinite(c)||c<=0)return{ok:!1,field:"max_cost_usd",message:"A spend cap is a positive number of dollars."};o.max_cost_usd=c}return(l=t.fileIds)!=null&&l.length&&(o.file_ids=[...t.fileIds]),{ok:!0,body:o}}function VO(e,t){return n=>{var i,l,c;const o=new Set;for(;n!=null&&n.$ref&&!o.has(n.$ref);){o.add(n.$ref);const u=(l=(i=/^#\/(?:definitions|\$defs)\/(.+)$/.exec(n.$ref))==null?void 0:i[1])==null?void 0:l.replace(/~1/g,"/").replace(/~0/g,"~"),f=u===void 0?void 0:((c=e.definitions)==null?void 0:c[u])??(Object.hasOwn(t,u)?t[u]:void 0);if(!f)break;n=f}return n}}function _j(e,t){if(e.from==="example")return`The workflow's example input. Edit it, then ${t}.`;const n=e.optional.length?` It also takes ${e.optional.join(", ")}, if you add ${e.optional.length===1?"it":"them"}.`:"";return`The workflow's input, its required fields empty. Fill them in, then ${t}.${n}`}function $j(e){var p,h,b;const t=e,n=(p=t==null?void 0:t.input)!=null&&p.schemaId?(h=t.schemas)==null?void 0:h[t.input.schemaId]:void 0;if(!n)return null;const o=VO(n,(t==null?void 0:t.schemas)??{}),i=o(n),l=Object.entries(i.properties??{}).map(([x,m])=>{const v=o(m);return{name:x,...v!=null&&v.description?{note:v.description}:{}}}),c=((b=i.examples)==null?void 0:b[0])??i.default;if(c!==void 0)return{text:JSON.stringify(c,null,2),from:"example",fields:l,optional:[]};const u=(x,m=0)=>{var j,S;const v=o(x);if(!v||m>4)return null;if((j=v.examples)!=null&&j.length)return v.examples[0];if(v.default!==void 0)return v.default;if((S=v.enum)!=null&&S.length)return v.enum[0];const w=Array.isArray(v.type)?v.type[0]:v.type;return w==="object"||v.properties?Object.fromEntries(Object.entries(v.properties??{}).filter(([T])=>(v.required??[]).includes(T)).map(([T,$])=>[T,u($,m+1)])):w==="array"?[]:w==="string"?"":w==="number"||w==="integer"?0:w==="boolean"?!1:null},f=new Set(i.required??[]);return{text:JSON.stringify(u(i),null,2),from:"shape",fields:l,optional:l.map(x=>x.name).filter(x=>!f.has(x))}}const up=e=>`'${e.replace(/'/g,"'\\''")}'`;function KO(e,t,n,o){return[`curl -X POST ${up(`${e}/v2/agents/${t?encodeURIComponent(t):"{agent_id}"}/runs`)} \\`,' -H "Authorization: Bearer $AGENTRUN_TOKEN" \\'," -H 'Content-Type: application/json' \\",` -H ${up(`Idempotency-Key: ${o}`)} \\`,` -d ${up(JSON.stringify(n))}`].join(`
|
|
531
|
-
`)}const XO=e=>e>=200&&e<300;async function Ej(e,t,n,o){const i=await o(t,n,e.keyFor(t,n));return XO(i.status)&&e.done(),i}function YO({agent:e,efforts:t,v2:n,go:o,blocked:i,limits:l,upload:c=hj}){const u=e.kind==="workflow",f=y.useMemo(()=>u?$j(e.definition.workflow):null,[u,e.definition.workflow]),[p,h]=y.useState((f==null?void 0:f.text)??""),[b,x]=y.useState(""),[m,v]=y.useState(null),w=y.useMemo(()=>Ws(),[]),[j,S]=y.useState(!1),T=gj({upload:c,remove:n.deleteUpload,limits:l,frozen:j}),$=Sj(e.kind,{text:p,effort:b,fileIds:T.fileIds}),_=async(O,z,F)=>{var D;try{const B=await n.startRun(O,z,F);return{status:B.status,runId:B.run.run_id}}catch(B){return B instanceof Ee?{status:B.status,problem:{message:B.message,fields:B.fields,...B.code==="agent_not_runnable"&&typeof((D=B.details)==null?void 0:D.box)=="string"?{box:B.details.box}:{},...B.code==="agent_not_runnable"&&B.details?{details:B.details}:{}}}:{status:0,problem:{message:B instanceof Error?B.message:String(B)}}}},E=y.useRef(!0);y.useEffect(()=>(E.current=!0,()=>{E.current=!1}),[]);const R=async()=>{if(!$.ok||j||i||T.busy)return;S(!0),v(null);const O=await Ej(w,e.agent_id,$.body,_);E.current&&(S(!1),O.runId?(T.clear(),o(`#/runs/${encodeURIComponent(O.runId)}`)):v(O.problem??{message:`The server answered ${O.status}.`}))},C=((m==null?void 0:m.fields)??[]).filter(O=>O.message!==(m==null?void 0:m.message));return s.jsxs("section",{className:"border-b px-5 py-4 max-sm:py-3 md:px-8","aria-label":"Start a run",children:[s.jsxs("div",{"data-phone-row":!0,className:"max-sm:flex max-sm:flex-wrap max-sm:items-center max-sm:gap-x-2 max-sm:gap-y-2",children:[s.jsxs("div",{className:"flex flex-col gap-3 max-sm:contents lg:flex-row lg:items-start",children:[s.jsx(Ss,{value:p,onChange:O=>h(O.target.value),rows:u?6:2,spellCheck:!u,"aria-label":u?"The run's input, as JSON":"The run's first message",placeholder:u?"The workflow's input, as JSON":"The run's first message",onKeyDown:O=>{O.key==="Enter"&&(O.metaKey||O.ctrlKey)&&(O.preventDefault(),R())},className:oe("min-w-0 flex-1 resize-y max-sm:order-first max-sm:basis-full",u?"leading-[1.6]":"max-sm:h-10")}),s.jsxs("div",{className:"flex shrink-0 items-center gap-3 max-sm:order-last max-sm:gap-2",children:[t.length>0&&s.jsxs("div",{className:"flex items-center gap-2",title:"How hard the model thinks before it answers. default leaves it to the agent.",children:[s.jsxs("span",{className:"flex flex-col leading-tight",children:[s.jsx("label",{htmlFor:"runbar-effort",className:"caps text-label text-muted-foreground",children:"Effort"}),s.jsx("span",{className:"text-label text-muted-foreground max-sm:hidden",children:"How hard the model thinks"})]}),s.jsx(Kt,{id:"runbar-effort",label:"Effort",value:b,onChange:x,className:"w-32",options:["",...t].map(O=>({value:O,label:O||"default"}))})]}),s.jsxs(Z,{variant:"solid",onClick:()=>void R(),disabled:!$.ok||j||!!i||T.busy,title:i??(T.busy?"Waiting for the files to be sent":void 0),children:[s.jsx(Pl,{"aria-hidden":!0})," ",j?"Starting":"Run"]})]})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 max-sm:mt-0",children:[s.jsx("div",{className:"min-w-0 flex-1",children:s.jsx(Xp,{attachments:T,limits:l,disabled:!!i,compact:!0})}),s.jsx(lg,{label:"Run with your coding agent",className:"max-sm:hidden",unavailable:T.items.length?"Remove the attached files first: they are for a run started here, and are deleted when you leave this page. Your coding agent uploads its own.":void 0,context:()=>({kind:"run",agentId:e.agent_id,revision:e.revision,...$.ok?{input:$.body.input}:{},...b?{effort:b}:{}})})]})]}),f&&s.jsx("p",{className:"mt-2 font-mono text-label text-muted-foreground",children:_j(f,"run")}),!$.ok&&p.trim()&&s.jsx("p",{className:"mt-2 font-mono text-small text-destructive-text",role:"alert",children:$.message}),m&&s.jsxs("div",{className:"mt-3 border border-destructive/50 bg-destructive/10 px-3 py-2 font-mono text-small text-destructive-text",role:"alert",children:[s.jsxs("p",{children:["The run did not start: ",m.message]}),m.box&&s.jsxs("p",{className:"mt-1",children:["This server can't run the ",m.box," box this agent runs in: change where it runs in its settings."]}),s.jsx(kj,{agentId:e.agent_id,details:m.details}),C.length>0&&s.jsx("ul",{className:"mt-1",children:C.map(O=>s.jsxs("li",{children:[O.field,": ",O.message]},`${O.field}:${O.message}`))})]})]})}function sn({className:e}){return s.jsx("span",{"aria-hidden":!0,className:oe("block bg-muted motion-safe:animate-pulse",e)})}function Hd({label:e,className:t,children:n}){return s.jsxs("div",{role:"status","aria-label":e,"aria-busy":"true",className:t,children:[n,s.jsxs("span",{className:"sr-only",children:[e,"…"]})]})}function QO(){return s.jsxs(Hd,{label:"Loading Mission Control",className:"mx-auto max-w-[1600px] space-y-8 px-6 py-8",children:[s.jsx(sn,{className:"h-8 w-56"}),s.jsx("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-6",children:Array.from({length:6},(e,t)=>s.jsxs("div",{className:"border p-4",children:[s.jsx(sn,{className:"h-3 w-16"}),s.jsx(sn,{className:"mt-3 h-6 w-12"})]},t))}),s.jsx(sn,{className:"h-48 w-full"}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]",children:[s.jsx(rd,{n:4}),s.jsx(rd,{n:6})]})]})}function rd({n:e}){return s.jsx("div",{className:"border",children:Array.from({length:e},(t,n)=>s.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-3 last:border-b-0",children:[s.jsx(sn,{className:"h-4 w-20"}),s.jsx(sn,{className:"h-4 flex-1"}),s.jsx(sn,{className:"hidden h-4 w-24 sm:block"})]},n))})}function _s({label:e,rows:t=8}){return s.jsx(Hd,{label:e,children:s.jsx(rd,{n:t})})}function ZO(){return s.jsxs(Hd,{label:"Loading the run",className:"space-y-6 p-5 md:p-8",children:[s.jsxs("div",{className:"space-y-3 border-b pb-6",children:[s.jsx(sn,{className:"h-4 w-24"}),s.jsx(sn,{className:"h-7 w-2/3"}),s.jsx(sn,{className:"h-3 w-1/3"})]}),s.jsx("div",{className:"flex gap-6",children:Array.from({length:3},(e,t)=>s.jsx(sn,{className:"h-4 w-16"},t))}),s.jsx("div",{className:"space-y-4",children:Array.from({length:5},(e,t)=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx(sn,{className:"size-4 shrink-0"}),s.jsx(sn,{className:oe("h-4",t%2?"w-1/2":"w-3/4")})]},t))})]})}function JO(){return s.jsxs(Hd,{label:"Loading the agent",className:"space-y-6 p-5 md:p-8",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx(sn,{className:"h-7 w-64"}),s.jsx(sn,{className:"h-3 w-80 max-w-full"})]}),s.jsx(sn,{className:"h-12 w-full"}),s.jsx(rd,{n:5})]})}const e5=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),t5=e=>e instanceof TypeError&&/fetch|network/i.test(e.message);function ao(e,t){var c,u;const n=`${e5(t)} could not be read.`;if(t5(e))return{title:n,why:"Can't reach agentrun-serve.",next:"It may be restarting: try again in a moment."};if(!(e instanceof Ee))return{title:n,why:"Something went wrong in the console.",next:"Reload the page.",said:e instanceof Error?e.message:String(e)};const o=((u=(c=e.fields)==null?void 0:c[0])==null?void 0:u.message)??e.message,i=[e.code,e.requestId].filter(Boolean).join(" · "),l=(f,p)=>({title:n,why:f,next:p,said:o,code:i});return e.status===401?l("This browser is signed out.","Reload the page to sign in again."):e.status===403?l("The server doesn't allow this here.","Sign in as the server's owner, or open the console from the address the server printed."):e.status===404?l("This server doesn't have it.","Check the address, or open the list it belongs to."):e.status===412?l("Someone, or a run, changed it first.","Reload to see it as it is now."):e.status===429?l("Too many requests at once.","Wait a few seconds, then try again."):e.retryable||e.status===409||e.status===503?l("The server is busy.","Try again in a moment."):e.status>=500?l("The server hit a problem on its side.","Try again. If it keeps failing, the server's log says why."):l("The server turned the request down.","Try again, and if it keeps happening, the server's words below say why.")}function ss({problem:e,onRetry:t,className:n="m-8"}){return s.jsxs("section",{className:`flex gap-3 border bg-card px-4 py-4 md:px-5 ${n}`,role:"alert",children:[s.jsx(er,{className:"mt-0.5 size-4 shrink-0 text-destructive-text","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-prose font-semibold",children:e.title}),s.jsxs("p",{className:"mt-1 text-lead leading-relaxed",children:[e.why," ",e.next]}),(e.said||e.code)&&s.jsx("p",{className:"mt-2 break-words font-mono text-label text-muted-foreground",children:[e.said,e.code].filter(Boolean).join(" · ")}),t&&s.jsx("div",{className:"mt-3 flex flex-wrap gap-3",children:s.jsx(Z,{type:"button",onClick:t,size:"sm",children:"Try again"})})]})]})}const Tj=[{path:"agent",label:"By the agent",fill:"fill-chart-agent",stroke:"stroke-chart-agent"},{path:"handed_back",label:"Handed back",fill:"fill-chart-handed-back",stroke:"stroke-chart-handed-back"},{path:"workflow",label:"Learned workflow",fill:"fill-chart-workflow",stroke:"stroke-chart-workflow"}],mu=e=>Tj.find(t=>t.path===e),n5=e=>e.filter(t=>t.total_usd!==null),s5=e=>Math.min(25,Math.max(3,Math.round(e/15)));function r5(e,t){const n=[];let o=0;return e.forEach((i,l)=>{o+=i.total_usd,l>=t&&(o-=e[l-t].total_usd),n.push(o/Math.min(l+1,t))}),n}function o5(e){if(!(e>0))return 1;const t=10**Math.floor(Math.log10(e));return[1,2,2.5,5,10].map(n=>n*t).find(n=>n>=e*(1-1e-9))}function a5(e,t,n){if(!e.length)return{top:1,above:0};const o=e.map(c=>c.total_usd).sort((c,u)=>c-u),i=o[Math.min(o.length-1,Math.floor(o.length*.95))],l=o5(Math.max(i,...t,n??0)*1.08);return{top:l,above:e.filter(c=>c.total_usd>l).length}}function i5(e,t,n=6){if(t<=e)return[e];const o=(t-e)/Math.max(1,n-1),i=10**Math.floor(Math.log10(o)),l=Math.max(1,[1,2,5,10].map(u=>u*i).find(u=>u>=o)),c=[];for(let u=Math.ceil(e/l)*l;u<=t;u+=l)c.push(u);return!c.includes(e)&&(c[0]??1/0)-e>l/2&&c.unshift(e),c}function l5(e,t){let n=0;for(let o=1;o<e.length;o++)Math.abs(e[o].n-t)<Math.abs(e[n].n-t)&&(n=o);return n}function Kr(e){return e===0?"$0":e<1e-4?"<$0.0001":e>=1?`$${e.toFixed(2)}`:`$${e.toFixed(4).replace(/(\.\d\d\d?)0+$/,"$1").replace(/(\.\d\d)0$/,"$1")}`}function pu(e){return e===0?"$0":e<1e-4?"<$0.0001":e>=1?`$${e.toFixed(2)}`:`$${e.toPrecision(3)}`}const c5=1e3,Cj="Turn learning on and run the same job about 20 times: each run's cost shows here, and where a learned workflow takes the job over, the line falls.";function ew({v2:e,agentId:t,on:n,quiet:o=!1}){const[i,l]=y.useState(null),[c,u]=y.useState(null),[f,p]=y.useState(0);return y.useEffect(()=>{let h=!0;return u(null),Promise.resolve().then(()=>e.learningCost(t,c5)).then(b=>{h&&l(b)},b=>{h&&u(b??new Error("unknown"))}),()=>{h=!1}},[e,t,f]),o&&(!i||i.runs.filter(h=>h.total_usd!==null).length<2)?null:c&&!i?s.jsx(ss,{problem:ao(c,"the cost per run"),onRetry:()=>p(h=>h+1),className:""}):i?s.jsx(u5,{data:i,on:n}):s.jsx(sn,{className:"h-[320px] w-full"})}const ft={top:30,right:16,bottom:30,left:60},Eo=260;function u5({data:e,on:t,width:n}){var L;const o=y.useMemo(()=>n5(e.runs),[e.runs]),i=s5(o.length),l=y.useMemo(()=>r5(o,i),[o,i]),{summary:c}=e,u=y.useRef(null),[f,p]=y.useState(n??720);y.useEffect(()=>{const I=u.current;if(n||!I||typeof ResizeObserver>"u")return;const G=new ResizeObserver(([P])=>{P&&P.contentRect.width>0&&p(P.contentRect.width)});return G.observe(I),()=>G.disconnect()},[n]);const[h,b]=y.useState(null),x=Tj.map(I=>({...I,runs:e.runs.filter(G=>G.path===I.path).length})),m=[e.total_runs>e.runs.length?`The latest ${e.runs.length.toLocaleString("en-US")} of ${e.total_runs.toLocaleString("en-US")} runs.`:null,e.unknown_cost_runs?`${e.unknown_cost_runs===1?"1 run's":`${e.unknown_cost_runs} runs'`} cost is not known: left out.`:null].filter(I=>!!I);if(o.length<2)return s.jsx(tw,{title:"Cost per run",headline:null,children:s.jsxs("div",{className:"px-4 py-8 text-center",role:"status",children:[s.jsx("p",{className:"font-mono text-body",children:o.length?"One run so far.":"No run with a known cost yet."}),s.jsx("p",{className:"mx-auto mt-1 max-w-prose text-body text-muted-foreground",children:Cj})]})});const v=Math.max(300,f),w=v-ft.left-ft.right,j=o[0].n,S=o.at(-1).n,T=I=>ft.left+(S===j?w/2:(I-j)/(S-j)*w),{top:$,above:_}=a5(o,l,((L=c.before)==null?void 0:L.mean_usd)??null),E=I=>ft.top+Eo-Math.min(I,$)/$*Eo,R=[0,$/4,$/2,3*$/4,$],C=i5(j,S,v<520?5:7),O=c.takeover&&c.takeover.n>=j?c.takeover:null,z=c.takeover?Math.max(c.takeover.n,j):null,F=o.map((I,G)=>`${G?"L":"M"}${T(I.n).toFixed(1)},${E(l[G]).toFixed(1)}`).join(""),D=h===null?null:o[h],B=c.times_cheaper!==null?`${c.times_cheaper}x cheaper`:null,U=c.before&&c.after?`${pu(c.before.mean_usd)} a run before learning, ${pu(c.after.mean_usd)} after takeover${B?`: ${B}`:""}`:null,W=I=>{const G=I.currentTarget.getBoundingClientRect(),P=(I.clientX-G.left)/G.width*v;b(l5(o,j+(P-ft.left)/w*(S-j)))},X=I=>{const P={ArrowRight:q=>q+1,ArrowLeft:q=>q-1,Home:()=>0,End:()=>o.length-1,PageUp:q=>q+10,PageDown:q=>q-10}[I.key];if(!P){I.key==="Escape"&&b(null);return}I.preventDefault(),b(q=>Math.min(o.length-1,Math.max(0,P(q??(I.key==="ArrowLeft"?o.length:-1)))))},M=I=>[`Run ${I.n}`,`${Kr(I.total_usd)} all-in${I.learning_usd?` (${Kr(I.cost_usd??0)} the run, ${Kr(I.learning_usd)} learning)`:""}`,`${mu(I.path).label}${I.workflow?`: ${I.workflow}`:""}`,I.learned_revision?`Learned revision ${I.learned_revision.slice(0,7)}`:"Nothing learned yet"],K=O?T(O.n)>ft.left+w*.62:!1;return s.jsxs(tw,{title:"Cost per run",headline:U,children:[s.jsxs("figure",{className:"px-4 pb-2 pt-3",children:[s.jsxs("figcaption",{className:"mb-2 flex flex-wrap items-center gap-x-4 gap-y-1 font-mono text-small text-muted-foreground",children:[x.filter(I=>I.runs>0).map(I=>s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("svg",{width:"10",height:"10","aria-hidden":!0,children:s.jsx("circle",{cx:"5",cy:"5",r:"4",className:I.fill})}),I.label," ",s.jsx("span",{className:"text-foreground",children:I.runs})]},I.path)),s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("svg",{width:"18",height:"10","aria-hidden":!0,children:s.jsx("path",{d:"M1,5H17",className:"stroke-foreground",strokeWidth:2})}),"Rolling mean of ",i," runs"]}),c.before&&s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("svg",{width:"18",height:"10","aria-hidden":!0,children:s.jsx("path",{d:"M1,5H17",className:"stroke-muted-foreground",strokeWidth:1.5,strokeDasharray:"4 3"})}),"Before learning"]})]}),s.jsxs("div",{ref:u,className:"relative",tabIndex:0,onKeyDown:X,onBlur:()=>b(null),"aria-label":`Cost per run, runs ${j} to ${S}. ${U??""} Arrow keys step through the runs.`,children:[s.jsxs("svg",{width:v,height:ft.top+Eo+ft.bottom,className:"block select-none font-mono",onPointerMove:W,onPointerLeave:()=>b(null),"aria-hidden":!0,children:[R.map(I=>s.jsxs("g",{children:[s.jsx("path",{d:`M${ft.left},${E(I)}H${ft.left+w}`,className:I===0?"stroke-border-strong":"stroke-border",strokeWidth:1}),s.jsx("text",{x:ft.left-8,y:E(I),dy:"0.32em",textAnchor:"end",className:"fill-muted-foreground text-label",children:Kr(I)})]},I)),C.map(I=>s.jsx("text",{x:T(I),y:ft.top+Eo+18,textAnchor:"middle",className:"fill-muted-foreground text-label",children:I},I)),s.jsx("text",{x:ft.left,y:ft.top-16,className:"caps fill-muted-foreground text-label",children:"$ a run, all-in"}),s.jsx("text",{x:ft.left-8,y:ft.top+Eo+18,textAnchor:"end",className:"caps fill-muted-foreground text-label",children:"Run"}),o.map((I,G)=>s.jsx("circle",{cx:T(I.n),cy:E(I.total_usd),r:G===h?0:3,className:oe(mu(I.path).fill),fillOpacity:.65},I.run_id)),c.before&&s.jsxs("g",{children:[s.jsx("path",{d:`M${ft.left},${E(c.before.mean_usd)}H${ft.left+w}`,className:"stroke-muted-foreground",strokeWidth:1.5,strokeDasharray:"6 4"}),s.jsxs(dp,{x:ft.left+w-4,y:E(c.before.mean_usd)-6,anchor:"end",children:["Before learning ",pu(c.before.mean_usd)]})]}),O&&s.jsxs("g",{children:[s.jsx("path",{d:`M${T(O.n)},${ft.top-4}V${ft.top+Eo}`,className:"stroke-chart-workflow",strokeWidth:1.5}),s.jsxs(dp,{x:T(O.n)+(K?-6:6),y:ft.top+6,anchor:K?"end":"start",children:["Workflow took over, run ",O.n]})]}),z!==null&&c.after&&s.jsxs("g",{children:[s.jsx("path",{d:`M${T(z)},${E(c.after.mean_usd)}H${ft.left+w}`,className:"stroke-foreground",strokeWidth:1,strokeDasharray:"2 3"}),s.jsxs(dp,{x:ft.left+w-4,y:E(c.after.mean_usd)-8,anchor:"end",strong:!0,children:["After takeover ",pu(c.after.mean_usd),B?` · ${B}`:""]})]}),s.jsx("path",{d:F,fill:"none",className:"stroke-foreground",strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}),D&&s.jsxs("g",{children:[s.jsx("path",{d:`M${T(D.n)},${ft.top}V${ft.top+Eo}`,className:"stroke-border-strong",strokeWidth:1}),s.jsx("circle",{cx:T(D.n),cy:E(D.total_usd),r:5,className:oe(mu(D.path).fill,"stroke-card"),strokeWidth:2})]})]}),D&&s.jsxs("div",{className:oe("pointer-events-none absolute z-raised whitespace-nowrap border bg-card px-2 py-1 font-mono text-label shadow-float",T(D.n)>v*.6&&"-translate-x-full"),style:{left:T(D.n)>v*.6?T(D.n)-10:T(D.n)+10,top:ft.top},children:[M(D).map((I,G)=>s.jsx("span",{className:oe("block",G===0?"font-semibold":"text-muted-foreground"),children:I},I)),s.jsx("span",{className:"block text-muted-foreground",children:St(D.started_at)})]}),s.jsx("p",{className:"sr-only","aria-live":"polite",children:D?M(D).join(", "):""})]}),s.jsxs("p",{className:"mt-1 text-small text-muted-foreground",children:["Each dot is a run: its own cost plus what learning spent for it (the look-back and the grade). The line is the mean of the last ",i," runs.",_?` ${_===1?"1 run costs":`${_} runs cost`} more than ${Kr($)} and ${_===1?"is":"are"} drawn at the top.`:"",c.before?" The dashed line is what a run cost the agent before a learned workflow took over, learning left out.":""]}),[...m,...d5(e,t)].map(I=>s.jsx("p",{className:"mt-1 text-small text-muted-foreground",children:I},I))]}),s.jsxs("details",{className:"border-t px-4 py-2",children:[s.jsx("summary",{className:"caps cursor-pointer text-label text-muted-foreground",children:"Table"}),s.jsx("div",{className:"max-h-96 overflow-auto",children:s.jsxs("table",{className:"mt-2 w-full border-collapse font-mono text-small",children:[s.jsx("thead",{className:"sticky top-0 z-sticky bg-card",children:s.jsx("tr",{className:"caps text-label text-muted-foreground",children:["Run","Started","Path","Revision","Run $","Learning $","All-in $"].map(I=>s.jsx("th",{className:"py-1 pr-4 text-left font-normal",children:I},I))})}),s.jsx("tbody",{children:e.runs.map(I=>{var G;return s.jsxs("tr",{children:[s.jsx("td",{className:"py-0.5 pr-4",children:I.n}),s.jsx("td",{className:"pr-4",children:St(I.started_at)}),s.jsxs("td",{className:"pr-4",children:[mu(I.path).label,I.workflow?`: ${I.workflow}`:""]}),s.jsx("td",{className:"pr-4",children:((G=I.learned_revision)==null?void 0:G.slice(0,7))??"-"}),s.jsx("td",{className:"pr-4",children:I.cost_usd===null?"unknown":Kr(I.cost_usd)}),s.jsx("td",{className:"pr-4",children:I.learning_usd===null?"unknown":Kr(I.learning_usd)}),s.jsx("td",{className:"pr-4",children:I.total_usd===null?"unknown":Kr(I.total_usd)})]},I.run_id)})})]})}),s.jsxs("p",{className:"mt-2 text-small text-muted-foreground",children:["As CSV: ",s.jsxs("code",{className:"font-mono",children:["agentrun learning cost ",e.agent," --format csv"]})]})]})]})}function d5(e,t){const n=e.summary;return n.takeover?n.times_cheaper===null&&n.after?[`${n.after.runs===1?"1 run":`${n.after.runs} runs`} since the workflow took over: how many times cheaper it is shows after 20.`]:[]:[t?"No learned workflow has finished a run alone yet. Keep running the same job: once one does, a marker shows where, and the level after it.":Cj]}function tw({title:e,headline:t,children:n}){return s.jsxs("section",{className:"min-w-0 border","aria-label":e,"data-testid":"cost-per-run",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-4 gap-y-1 border-b px-4 py-3",children:[s.jsx("h3",{className:"caps text-small font-semibold",children:e}),t&&s.jsx("p",{className:"font-mono text-small text-muted-foreground",children:t})]}),n]})}function dp({x:e,y:t,anchor:n="start",strong:o=!1,children:i}){return s.jsx("text",{x:e,y:t,textAnchor:n,className:oe("stroke-card text-label [paint-order:stroke]",o?"fill-foreground font-semibold":"fill-muted-foreground"),strokeWidth:4,strokeLinejoin:"round",children:i})}function Rj({id:e,checked:t,onChange:n,busy:o,disabled:i,quiet:l,server:c,problem:u,className:f}){return s.jsxs("div",{className:oe("space-y-2",f),children:[s.jsxs("div",{className:oe("flex gap-4",l?"items-center":"items-start"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{id:e,className:"text-lead font-semibold",children:"Learns from its runs"}),!l&&s.jsx("p",{className:"mt-0.5 text-body text-muted-foreground",children:"After each run, it looks back and keeps a short note when something will help next time; later runs read them first."})]}),s.jsx(z4,{checked:t,onChange:n,busy:o,disabled:i,labelledBy:e})]}),c==="off"&&s.jsx("p",{className:"font-mono text-label text-warning-text",children:"This server has learning turned off, so no run learns until it's on."}),u]})}function f5({fields:e,onFields:t,saved:n,server:o,error:i,warning:l}){const c=e.learning??n,u=c===!0||c==="notes",f=p=>t({learning:p===!1&&n===void 0?void 0:p});return s.jsxs("div",{children:[s.jsx("div",{className:"mb-2",children:s.jsx("span",{className:"caps text-small font-semibold",children:"Learning"})}),s.jsx(Rj,{id:"learning-switch",className:"border px-4 py-3",checked:u,server:o,onChange:p=>f(p?n==="notes"?"notes":!0:!1)}),u&&s.jsx("fieldset",{"aria-label":"What it learns",className:"mt-2 space-y-2",children:[[!0,"Notes, skills and workflows","Once a job repeats, it can learn it as a workflow and run it as one step."],["notes","Notes and skills only","It never runs a learned workflow, and is never asked to draft one."]].map(([p,h,b])=>s.jsxs("label",{className:oe("flex items-start gap-3 border px-3 py-2.5",c===p&&"border-foreground"),children:[s.jsx("input",{type:"radio",name:"learning-kind",className:"mt-1 accent-primary",checked:c===p,onChange:()=>f(p)}),s.jsxs("span",{children:[s.jsx("span",{className:"font-mono text-body",children:h}),s.jsx("span",{className:"block text-small text-muted-foreground",children:b})]})]},String(p)))}),i&&s.jsx("p",{className:"mt-2 font-mono text-small text-destructive-text",role:"alert",children:i}),l&&s.jsx("p",{className:"mt-2 font-mono text-small text-warning-text",children:l})]})}const m5="http://www.w3.org/2000/svg",wa=16,Ot=240,p5=40,h5=58,fp=16,mp=26,hu=18,ka=14,nw=16,g5=26,x5=14,y5=22,gs=14,sw=16,gu=16,v5=4,b5=10,w5=18,k5=30,j5=5,rl=124,Yp=34,N5=4,pp=10*.6,S5=12.5*.6,Tl=10.5*.6,rw=11*.6,xg=9*.66,ow=10.5*.6,_5={agent:"agent",decide:"agent",extract:"agent",report:"agent",artifact:"agent",judge:"jev",pick:"jev",sift:"jev",route:"jev",call:"tool",code:"code",escalate:"exit",chain:"control",parallel:"control",map:"control",loop:"control",workflow:"control"},yg=new Set(["done","working","held","failed","escalated","stopped","not-run","review","pending"]),od={review:"needs review","not-run":"",pending:""};function Ze(e,t,...n){const o=document.createElementNS(m5,e);if(t)for(const[i,l]of Object.entries(t))o.setAttribute(i,String(l));for(const i of n)Zn(o,i);return o}function Zn(e,t){if(t!=null){if(Array.isArray(t)){for(const n of t)Zn(e,n);return}e.appendChild(typeof t=="string"?document.createTextNode(t):t)}}const Js=(e,t)=>e.length>t?`${e.slice(0,t-1)}…`:e,$5=(e,t)=>{const n=/^(.*) (\d\.\d\d)$/.exec(e);return!n||e.length<=t?Js(e,t):`${Js(n[1],Math.max(2,t-n[2].length-1))} ${n[2]}`},eo=(e,t)=>Math.max(2,Math.floor(e/t)),io=(e,t)=>Math.ceil(e.length*t),vs=(e,t,n,o,i)=>Ze("line",{x1:e,y1:t,x2:n,y2:o,class:i?`wire ${i}`:"wire"});function Aj(e){const t={},n={};for(const i of e)t[i.path]=i;const o=i=>{var l;return((l=t[i])==null?void 0:l.kind)??""};for(const i of e){let l;const c={node:i,order:0,name:null};let u=null;(l=/^(.*)\/steps\/(\d+)$/.exec(i.path))&&o(l[1])==="chain"?(u=l[1],c.order=Number(l[2])):(l=/^(.*)\/branches\/([^/]*)\/body$/.exec(i.path))&&o(l[1])==="route"?(u=l[1],c.name=l[2].replace(/~1/g,"/").replace(/~0/g,"~")):(l=/^(.*)\/branches\/(\d+)$/.exec(i.path))&&o(l[1])==="parallel"?(u=l[1],c.order=Number(l[2])):((l=/^(.*)\/body$/.exec(i.path))&&(o(l[1])==="map"||o(l[1])==="loop")||(l=/^(.*)\/workflow\/root$/.exec(i.path))&&o(l[1])==="workflow")&&(u=l[1]),u!==null&&(n[u]??(n[u]=[])).push(c)}for(const i of Object.values(n))i.sort((l,c)=>l.order-c.order);return{byPath:t,kids:n}}function vg(e,t){var f,p,h,b;const{diff:n={},status:o={},fired:i}=e.marks,l=t===i?"escalated":o[t],c=l&&yg.has(l)?l:"",u=(f=n.added)!=null&&f.includes(t)?"NEW":(p=n.edited)!=null&&p.includes(t)?"EDITED":(h=n.moved)!=null&&h.includes(t)?"MOVED":"";return{state:c,tag:u,fired:t===i,selected:((b=e.marks.selected)==null?void 0:b.path)===t&&e.marks.selected.item==null}}function Yl(e,t,n){var x,m,v;const o=vg(e,t.path),i=(x=e.marks.meta)==null?void 0:x[t.path],l=i!=null&&i.tool?Xl(i.tool):null,c=(m=e.marks.ran)==null?void 0:m[t.path],u=i!=null&&i.decision?(c==null?void 0:c.model)??i.model:i==null?void 0:i.model;let f=`${t.label} (${t.kind}${l?`: ${l.tool} on ${l.server}, an MCP server's tool`:t.via?` via ${t.via}`:""}${i!=null&&i.provider?`, ${i.provider}${u?` ${u}`:""}`:""}${c&&!(i!=null&&i.decision)?`, ${cj(c)}`:""})`;o.state&&(f+=`: ${o.state.replace("-"," ")}`),o.tag&&(f+=`${o.state?", ":": "}${o.tag.toLowerCase()}`),(v=i==null?void 0:i.questions)!=null&&v.length&&(f+=`
|
|
532
|
-
${i.questions.map(w=>`• ${w.text}`).join(`
|
|
533
|
-
`)}`);const p=i!=null&&i.decision&&i.provider?`who-${i.provider==="parallel"||i.provider==="openrouter"?i.provider:"jev"}`:t.kind==="route"&&i&&!i.decision?"who-control":`who-${_5[t.kind]??"code"}`;let h=`node ${n} ${p}`;o.state&&(h+=` ${o.state}`),o.fired&&(h+=" fired"),o.tag&&(h+=` ${o.tag.toLowerCase()}`),o.selected&&(h+=" selected");const b=Ze("g",{class:h,"data-path":t.path},Ze("title",null,f));return e.svg.appendChild(b),b}const za=e=>io(e,xg)+10;function Au(e,t,n,o,i="tag"){const l=za(o);return Zn(e,[Ze("rect",{x:t,y:n,width:l,height:13,class:`${i}-box`}),Ze("text",{x:t+l/2,y:n+9.5,class:i,"text-anchor":"middle"},o)]),l}const E5=(e,t)=>{var n,o;return!!((o=(n=e.marks.meta)==null?void 0:n[t.path])!=null&&o.decision)},Bd=(e,t)=>E5(e,t)?h5:p5;function bg(e,t,n,o,i){var S,T,$,_,E;const l=vg(e,n.path),c=(S=e.marks.meta)==null?void 0:S[n.path],u=Bd(e,n),f=(T=e.marks.verdict)==null?void 0:T[n.path],p=l.state in od?od[l.state]:l.state,h=(($=c==null?void 0:c.questions)==null?void 0:$.length)??0,b=c!=null&&c.tool?Xl(c.tool):null,x=(_=e.marks.ran)==null?void 0:_[n.path],m=(x&&!(c!=null&&c.decision)?pg(n.kind,x):n.kind)+(b?` · ${b.tool} on ${b.server}`:c!=null&&c.tool?` · ${c.tool}`:n.via?` · ${n.via}`:"")+(c!=null&&c.decision&&h?` · ${h} ${h===1?"question":"questions"}`:""),v=[(E=c==null?void 0:c.images)!=null&&E.length?"IMG":"",c!=null&&c.web?"WEB":"",b?"MCP":""].filter(Boolean),w=v.reduce((R,C)=>R+za(C)+4,0);l.selected&&t.appendChild(Ze("rect",{x:o-4,y:i-4,width:Ot+8,height:u+8,class:"sel"})),Zn(t,[Ze("rect",{x:o,y:i,width:Ot,height:u,class:"box"}),Ze("rect",{x:o+10,y:i+9,width:8,height:8,class:"swatch"}),Ze("text",{x:o+24,y:i+17,class:"label"},Js(n.label,eo(Ot-34-w,S5))),Ze("text",{x:o+24,y:i+31,class:"kind"},Js(m,eo(Ot-34-(p?io(p,xg)+8:0),Tl))),p?Ze("text",{x:o+Ot-10,y:i+31,class:"state","text-anchor":"end"},p):null]);let j=o+Ot-8;for(const R of v.reverse())j-=za(R),Au(t,j,i+7,R,"badge"),j-=4;if(c!=null&&c.decision&&c.provider){const R=Au(t,o+24,i+38,c.provider,"chip"),C=f?$5(f,eo(Ot-44-R-20,ow)):"",O=Ot-40-R-(C?io(C,ow)+10:0),z=(x==null?void 0:x.model)??c.model;z&&O>24&&t.appendChild(Ze("text",{x:o+24+R+6,y:i+47.5,class:"model"},Js(z,eo(O,Tl)))),C&&t.appendChild(Ze("text",{x:o+Ot-10,y:i+47.5,class:"verdict","text-anchor":"end"},C))}else f&&t.appendChild(Ze("text",{x:o+Ot-10,y:i+17,class:"verdict","text-anchor":"end"},f));l.tag&&Au(t,o+Ot-za(l.tag),i-7,l.tag)}function T5(e,t){return{w:Ot,h:Bd(e,t),cx:Ot/2,place:(n,o)=>bg(e,Yl(e,t,"card"),t,n,o)}}function Oj(e,t,n){const o=vg(e,t.path),i=o.state==="done"?"passed":o.state in od?od[o.state]:o.state,l=Js(t.label===t.kind?"exit":`exit: ${t.label}`,40),c=io(l,Tl)+16;return{w:ka+c+(o.tag?6+za(o.tag):0)+(i?6+io(i,xg):0),h:mp,cx:0,exit:!0,place:(u,f)=>{const p=Yl(e,t,"exit"),h=f+mp/2;let b=u+ka+c;n&&p.appendChild(vs(u,f,u,f+mp,"spine")),o.selected&&p.appendChild(Ze("rect",{x:u+ka-3,y:h-hu/2-3,width:c+6,height:hu+6,class:"sel"})),Zn(p,[vs(u,h,u+ka,h,"exit-wire"),Ze("rect",{x:u+ka,y:h-hu/2,width:c,height:hu,class:"exit-box"}),Ze("text",{x:u+ka+8,y:h+3.5,class:"exit-text"},l)]),o.tag&&(Au(p,b+6,h-6.5,o.tag),b+=6+za(o.tag)),i&&p.appendChild(Ze("text",{x:b+6,y:h+3.5,class:"state"},i))}}}function C5(e,t,n){const o=n.map(u=>u.node.kind==="escalate"?Oj(e,u.node,!1):Gd(e,u.node));let i=Ot/2,l=Ot/2,c=-fp;for(const u of o)i=Math.max(i,u.cx),l=Math.max(l,u.w-u.cx),c+=u.h+fp;return{w:i+l,h:c,cx:i,place:(u,f)=>{const p=Yl(e,t,"chain"),h=u+i;let b=f,x=null;o.forEach((m,v)=>{v&&(b+=fp),m.exit?x===null&&(x=b):x!==null&&p.appendChild(vs(h,x,h,b,"spine")),m.place(m.exit?h:h-m.cx,b),b+=m.h,m.exit||(x=b)}),o[o.length-1].exit&&x!==null&&p.appendChild(vs(h,x,h,b,"spine"))}}}function R5(e,t,n){const o=Bd(e,t),i=n.map(m=>({kid:m,box:Gd(e,m.node),x:0,c:0}));let l=0,c=0;i.forEach((m,v)=>{v&&(l+=y5),m.x=l,m.c=l+m.box.cx,l+=m.box.w,c=Math.max(c,m.box.h)});const u=i.length-1,f=Math.round((i[0].c+i[u].c)/2),p=Math.min(0,f-Ot/2),h=Math.max(l,f+Ot/2),b=o+nw+g5,x=b+c+x5;return{w:h-p,h:x,cx:f-p,place:(m,v)=>{const w=Yl(e,t,"card"),j=m-p,S=v+o+nw,T=v+x;bg(e,w,t,j+f-Ot/2,v),w.appendChild(vs(j+f,v+o,j+f,S)),u&&Zn(w,[vs(j+i[0].c,S,j+i[u].c,S),vs(j+i[0].c,T,j+i[u].c,T)]),i.forEach(($,_)=>{const E=j+$.c,R=$.kid.node.path,C=e.taken.has(R);if(w.appendChild(Ze("line",{x1:E,y1:S,x2:E,y2:v+b,class:C?"wire branch taken":"wire branch","data-to":R})),$.kid.name!==null){const O=(_<u?i[_+1].c-6:$.x+$.box.w)-$.c-12,z=Js($.kid.name,eo(O,Tl)),F=Ze("text",{x:E+6,y:S+15,class:C?"branch-name taken":"branch-name"},z);w.appendChild(z===$.kid.name?F:Ze("g",null,Ze("title",null,$.kid.name),F))}w.appendChild(vs(E,v+b+$.box.h,E,T,C?"taken":void 0)),$.box.place(j+$.x,v+b)})}}}const A5=e=>e.replace(/^.*\//,"").replace(/\.(pdf|png|jpe?g|webp|gif|tiff?)$/i,"");function O5(e,t,n,o,i,l){const c=yg.has(n.status)?n.status:"pending",u=n.label?A5(n.label):`#${n.index+1}`,f=n.outcome??(c==="review"?"needs review":c==="not-run"?"not run":c),p=n.p!==void 0?n.p.toFixed(2):"",h=`#${n.index+1}${n.label?` ${n.label}`:""}: ${c==="review"?"needs review":c.replace("-"," ")}${n.outcome?`, ${n.outcome}`:""}${n.pNote?` (${n.pNote})`:""}`,b=Ze("g",{class:`rcell ${c}${n.tone?` tone-${n.tone}`:""}${l?" picked":""}`,"data-path":t.path,"data-item":n.index},Ze("title",null,h),Ze("rect",{x:o,y:i,width:rl,height:Yp,class:"cell"}),Ze("rect",{x:o,y:i,width:3,height:Yp,class:"cell-edge"}),Ze("text",{x:o+9,y:i+14,class:"cell-name"},Js(u,eo(rl-14,pp))),Ze("text",{x:o+9,y:i+27,class:"cell-out"},Js(f,eo(rl-18-(p?io(p,pp)+6:0),pp))),p?Ze("text",{x:o+rl-6,y:i+27,class:"cell-p","text-anchor":"end"},p):null);e.appendChild(b)}function M5(e,t){var j;const n=((j=e.marks.items)==null?void 0:j[t.path])??[];if(!n.length)return null;const o=n.length<=k5,[i,l,c]=o?[rl,Yp,N5]:[gu,gu,v5],u=Math.min(n.length,o?j5:b5),f=Math.ceil(n.length/u),p=u*(i+c)-c,h=f*(l+c)-c+w5+(o?4:0),b={};for(const S of n)b[S.status]=(b[S.status]??0)+1;const x={};for(const S of n)S.outcome&&(x[S.outcome]=(x[S.outcome]??0)+1);const m=Object.entries(x).map(([S,T])=>`${T} ${S}`),w=[`${b.done??0}/${n.length} done`,b.working?`${b.working} working`:"",b.held?`${b.held} held`:"",b.failed?`${b.failed} failed`:"",b.review?`${b.review} review`:"",...m].filter(Boolean).join(" · ");return{w:Math.max(p,io(w,Tl)),h,place:(S,T,$)=>{const _=T-p/2,E=e.marks.selected;n.forEach((R,C)=>{const O=_+C%u*(i+c),z=$+Math.floor(C/u)*(l+c),F=yg.has(R.status)?R.status:"pending",D=(E==null?void 0:E.path)===t.path&&E.item===R.index;if(o){O5(S,t,R,O,z,D);return}Zn(S,Ze("rect",{x:O,y:z,width:gu,height:gu,class:`cell ${F}${D?" picked":""}`,"data-path":t.path,"data-item":R.index},Ze("title",null,`#${R.index+1}${R.label?` ${R.label}`:""}: ${F==="review"?"needs review":F.replace("-"," ")}`)))}),Zn(S,Ze("text",{x:T,y:$+h-4,class:"caption","text-anchor":"middle"},w))}}}function P5(e,t,n){const o=Gd(e,n),i=Bd(e,t),l=t.kind==="map"?M5(e,t):null,c=l?l.h+gs:0,u=Math.max(Ot/2,o.cx,l?l.w/2:0)+gs,f=Math.max(Ot/2,o.w-o.cx,l?l.w/2:0)+gs,p=i+gs+c+o.h+gs;return{w:u+f,h:p,cx:u,place:(h,b)=>{const x=Yl(e,t,"card"),m=h+u;if(Zn(x,Ze("rect",{x:h,y:b+i/2,width:u+f,height:p-i/2,class:"frame"})),l?(Zn(x,vs(m,b+i,m,b+i+gs)),Zn(x,vs(m,b+i+gs+l.h,m,b+i+gs+c))):Zn(x,vs(m,b+i,m,b+i+gs)),Zn(x,vs(m,b+i+gs+c+o.h,m,b+p)),bg(e,x,t,m-Ot/2,b),l){const v=Ze("g",{class:"items"});l.place(v,m,b+i+gs),x.appendChild(v)}o.place(m-o.cx,b+i+gs+c)}}}function Mj(e,t){return e.kind==="escalate"?"exit":t.length?e.kind==="chain"?"chain":e.kind==="route"||e.kind==="parallel"?"fan":"frame":"leaf"}function Gd(e,t){const n=e.kids[t.path]??[],o=Mj(t,n);return o==="exit"?Oj(e,t,!0):o==="leaf"?T5(e,t):o==="chain"?C5(e,t,n):o==="fan"?R5(e,t,n):P5(e,t,n[0].node)}function Pj(e){const{byPath:t,kids:n}=Aj(Lj(e)),o=i=>{const l=n[i.path]??[],c=Mj(i,l),u=c==="frame"?o(l[0].node):c==="chain"||c==="fan"?l.reduce((f,p)=>f+o(p.node),0):0;return(c==="chain"?0:1)+u};return t["/root"]?o(t["/root"]):0}const wg=e=>`${e} ${e===1?"node":"nodes"}`,Lj=e=>(e&&Array.isArray(e.nodes)?e.nodes:[]).filter(t=>t&&typeof t.path=="string"&&typeof t.kind=="string").map(t=>({path:t.path,kind:t.kind,label:String(t.label??t.kind),via:typeof t.via=="string"?t.via:""}));function L5(e,t,n={}){var h;for(;e.firstChild;)e.removeChild(e.firstChild);e.classList.add("wf");const o=Aj(Lj(t)),i=(b,x)=>(e.setAttribute("viewBox",`0 0 ${b} ${x}`),e.setAttribute("width",String(b)),e.setAttribute("height",String(x)),e.style.setProperty("min-width",`${Math.min(b,480)}px`),{w:b,h:x});if(!o.byPath["/root"])return i(0,0);const l={svg:e,kids:o.kids,marks:n,taken:new Set(n.taken??[])},c=Gd(l,o.byPath["/root"]);c.place(wa,wa);let u=c.w,f=c.h;const p=(((h=n.diff)==null?void 0:h.removed)??[]).map(b=>`${b.label} (${b.kind})`);if(p.length){const b=["Removed:",...p.map(m=>Js(m,eo(Math.max(u,300),rw)))],x=Ze("g",{class:"removed-list"},Ze("title",null,`Removed: ${p.join(", ")}`));b.forEach((m,v)=>{x.appendChild(Ze("text",{x:wa,y:wa+f+33+v*sw,class:"removed"},m)),u=Math.max(u,io(m,rw))}),e.appendChild(x),f+=22+b.length*sw}return i(u+2*wa,f+2*wa)}function I5(e){var i,l;const t=e,n=(i=t==null?void 0:t.closest)==null?void 0:i.call(t,"[data-item]");if(n)return{path:n.getAttribute("data-path"),item:Number(n.getAttribute("data-item"))};const o=(l=t==null?void 0:t.closest)==null?void 0:l.call(t,"g[data-path]");return!o||o.classList.contains("chain")?null:{path:o.getAttribute("data-path"),item:null}}const z5=1600;function qd({graph:e,marks:t,onSelect:n,className:o,label:i="Workflow graph",minScale:l=.8,maxScale:c=1.3}){const u=y.useRef(null),[f,p]=y.useState({w:0,h:0}),[h,b]=y.useState(0),x=y.useMemo(()=>JSON.stringify([(e==null?void 0:e.nodes)??null,t??null]),[e,t]);y.useEffect(()=>{if(!u.current)return;const v=L5(u.current,e,t);p(w=>w.w===v.w&&w.h===v.h?w:v),u.current.style.setProperty("--wf-phase",`-${Date.now()%z5}ms`)},[x]),y.useEffect(()=>{var j;const v=(j=u.current)==null?void 0:j.parentElement;if(!v||typeof ResizeObserver>"u")return;const w=new ResizeObserver(([S])=>b(S.contentRect.width));return w.observe(v),()=>w.disconnect()},[]);const m=f.w&&h?Math.min(c,Math.max(l,h/f.w)):1;return s.jsx("svg",{ref:u,role:"img","aria-label":i,className:oe("wf select-none",o),style:f.w?{width:f.w*m,height:f.h*m,maxWidth:"none",minWidth:0}:void 0,onClick:v=>{const w=I5(v.target);w&&n&&n(w)}})}function Vd({run:e=!1}){const t=[["hsl(var(--wf-jev))","Jev"],["hsl(var(--wf-parallel))","Parallel"],["hsl(var(--wf-openrouter))","OpenRouter"],["hsl(var(--wf-tool))","Tool"],["hsl(var(--muted-foreground))","Code"],["hsl(var(--primary))","Agent"]],n=[["border-success bg-success/40","Done"],["border-primary bg-primary/20","Working"],["border-dashed border-warning","Held (paused)"],["border-warning bg-warning/60","Needs review"],["border-destructive bg-destructive/60","Failed"],["border-dashed border-border-strong","Pending"]];return s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 font-mono text-label text-muted-foreground",children:[t.map(([o,i])=>s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{className:"inline-block size-2",style:{background:o}}),i]},i)),e&&s.jsx("span",{className:"h-3 border-l","aria-hidden":!0}),e&&n.map(([o,i])=>s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx("span",{className:oe("inline-block size-2.5 border",o)}),i]},i))]})}const D5=["ready","unavailable"],Ou=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),aw=e=>e.mode==="sandbox"?{kind:"sandbox",provider:e.box}:{kind:"none"};function Kd(e){if(Ou(e)){if(e.mode==="runner")return{mode:"runner"};if(e.mode==="sandbox"&&typeof e.box=="string")return{mode:"sandbox",box:e.box}}}function iw(e){const t=Ou(e)?e.places:void 0;if(!Ou(t)||!Array.isArray(t.modes)||!Array.isArray(t.boxes))return null;const n=t.boxes.filter(Ou).filter(i=>typeof i.id=="string").map(i=>({id:i.id,available:i.available===!0,...typeof i.reason=="string"?{reason:i.reason}:{},...D5.includes(i.state)?{state:i.state}:{}})),o=Kd(t.default_place);return o?{modes:t.modes.filter(i=>typeof i=="string"),boxes:n,defaultPlace:o}:null}const hp=e=>(e==null?void 0:e.defaultPlace.mode)==="sandbox"?e.defaultPlace:void 0,F5=e=>e?e.mode==="sandbox"?`In a ${e.box} box`:"On the server":"Where this server's default place is",U5=e=>e.mode==="sandbox"?`in a ${e.box} box`:"on the server",W5={v:2,name:"decision",schemas:{Input:{type:"object",required:["case_id","payment"],properties:{case_id:{type:"string"},payment:{type:"object",required:["descriptor"],properties:{descriptor:{type:"string"},memo:{type:"string"},merchant_site:{type:"string"},amount:{type:"string"}},description:"What the payment says about itself: card descriptor, memo, and the merchant's own site text."}},examples:[{case_id:"case-1",payment:{descriptor:"TILEWORKS SUPPLY CO 8885550142 OH",memo:"Invoice 4471: 40 pallets glazed ceramic floor tile",amount:"USD 18,420.00",merchant_site:"Tileworks Supply sells porcelain and ceramic tile to contractors across the Midwest."}}]},Verdict:{type:"object",additionalProperties:!1,required:["verdict"],properties:{verdict:{type:"string",enum:["gambling","not_gambling","unclear"],description:"Is the payment described in `payment` a payment for gambling: staking money or a paid currency on a game of chance or skill for a chance to win money or prizes redeemable for money, including sweepstakes casinos and social casinos that pay out cash prizes?",criteria:{gambling:"It is a payment for gambling, as described.",not_gambling:"It pays for something else: goods, services or a transfer with no stake on a game.",unclear:"What the payment says about itself is not enough to tell."}}}}},input:{schemaId:"Input"},output:{schemaId:"Verdict",path:"judged"},root:{node:"chain",steps:[{node:"judge",label:"judge",timeoutMs:6e4,state:{case_id:"{case_id}",payment:"{payment}"},out:"Verdict",as:"judged"},{node:"escalate",label:"unclear",when:{predicate:"field_equals",path:"judged.verdict",value:"unclear"},kind:"review",stage:"decision",summary:"A person decides case {case_id}: what the payment says is not enough to tell."},{node:"escalate",label:"no-confidence",when:{predicate:"not",of:{predicate:"field_type",path:"judged$answers.answers.verdict.confidence",type:"number"}},kind:"review",stage:"decision",summary:"A person decides case {case_id}: the judge gave no confidence."},{node:"escalate",label:"low-confidence",when:{predicate:"lt",path:"judged$answers.answers.verdict.confidence",n:.7},kind:"review",stage:"decision",summary:"A person decides case {case_id}: the judge leaned {judged.verdict}, below the confidence this decision needs."}]}},H5=["jev","parallel"];function B5(e="jev"){const t=structuredClone(W5);return e!=="jev"&&Object.assign(t.root.steps[0],{provider:e,...e==="parallel"?{timeoutMs:12e4}:{}}),t}const G5={v:2,name:"workflow",schemas:{Input:{type:"object",required:["task"],additionalProperties:!1,properties:{task:{type:"string",minLength:1,description:"What the step is asked to do."}},examples:[{task:"Write three lines on what this workflow could do next."}]},Answer:{type:"object",required:["answer"],additionalProperties:!1,properties:{answer:{type:"string"}}}},input:{schemaId:"Input"},output:{schemaId:"Answer",path:"step"},root:{node:"chain",steps:[{node:"agent",label:"step",state:{task:"{task}"},out:"Answer",as:"step",effort:"low",instructions:"Do what `task` asks and put your answer in `answer`."}]}},q5=()=>structuredClone(G5);function kg(e,t,n){const{name:o,description:i,...l}=t,c={...e.definition,...l},u={...e.definition};c.computer!==void 0&&(delete c.place,delete u.place),e.kind==="workflow"&&(delete c.thinking,delete c.instructions,delete c.model),c.model===""&&delete c.model,c.tool_settings&&!Object.keys(c.tool_settings).length&&delete c.tool_settings;for(const p of Object.keys(c))c[p]===void 0&&delete c[p];const f=dl({...c,version:0},{...u,version:0});return c.version=f?e.definition.version:e.revisions+1,{definition:c,...n.trim()?{note:n.trim()}:{},unchanged:f}}function dl(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(e).filter(i=>e[i]!==void 0),o=Object.keys(t).filter(i=>t[i]!==void 0);return n.length===o.length&&n.every(i=>dl(e[i],t[i]))}const jg="decision",Ij="workflow",zj={[jg]:B5,[Ij]:q5},Dj=e=>e!==void 0&&Object.hasOwn(zj,e);function V5(e){var n,o;if(!((n=e==null?void 0:e.adapters)!=null&&n.includes("runJudge")))return;const t=(o=e.decisions)==null?void 0:o.providers;return t?H5.find(i=>t.some(l=>l.id===i&&l.available)):"jev"}const K5="You are a helpful agent. Do the task you're given and report what you found.";function X5(e){var t;return Dj(e.harness)?{definition:{version:1,name:e.name,...e.description.trim()?{description:e.description}:{},workflow:zj[e.harness](e.decisionProvider),skills:[],tools:[]}}:{definition:{version:1,name:e.name,...e.description.trim()?{description:e.description}:{},instructions:e.instructions,harness:e.harness,...e.thinking?{thinking:e.thinking}:{},...(t=e.model)!=null&&t.trim()?{model:e.model.trim()}:{},...e.computer?{computer:e.computer}:{},...e.learning?{learning:e.learning}:{},...e.max_cost_usd!==void 0?{max_cost_usd:e.max_cost_usd}:{},skills:[],tools:e.tools,...e.tool_settings&&Object.keys(e.tool_settings).length?{tool_settings:e.tool_settings}:{},...e.approvals==="never"?{approvals:"never"}:{}}}}function lw(e){const t=(e??"").trim();if(!t)return{ok:!0,value:void 0};const n=t.replace(/^\$\s*/,""),o=Number(n);return n&&Number.isFinite(o)?{ok:!0,value:o}:{ok:!1,message:"A spend cap is a number of dollars, such as 2.50; empty means none."}}function Y5(e){return(Array.isArray(e)?e:[]).flatMap(t=>{if(!t||typeof t!="object"||typeof t.name!="string")return[];const{name:n,available:o,summary:i,blurb:l,missing:c,reason:u,harnesses:f,call_only:p,sandbox_only:h,nodes:b}=t;return[{name:n,available:o!==!1,...typeof i=="string"&&i?{summary:i}:{},...typeof l=="string"&&l.trim()?{blurb:l.trim()}:{},...c!=null&&c.length?{missing:c}:{},...typeof u=="string"&&u?{reason:u}:{},harnesses:Array.isArray(f)?f:[],...p===!0?{call_only:!0}:{},...h===!0?{sandbox_only:!0}:{},...typeof b=="boolean"?{nodes:b}:{}}]})}function Xd(e,t){return t.filter(n=>!n.call_only&&n.harnesses.includes(e))}function Qp(e,t,n,{mcpHarnesses:o,workflow:i=!1}={}){if(t.startsWith("mcp:"))return!o||o.includes(e);const l=n.find(c=>c.name===t);return l?l.call_only?i:Xd(e,n).some(c=>c.name===t):!0}const Zp=e=>Uj[e]??e,cw=e=>e.map(Zp).join(" and ");function uw(e,t,n,o){var l;if(t.startsWith("mcp:"))return`${Zp(e)} doesn't run MCP tools here${o!=null&&o.length?`: ${cw(o)} do`:""}`;const i=((l=n.find(c=>c.name===t))==null?void 0:l.harnesses)??[];return i.length?`Runs on ${cw(i)} here, not on ${Zp(e)}`:"No harness runs it here"}function Q5(e,t,n,o,i={}){const l=[...t,...n.filter(c=>!t.includes(c))];return{tools:l.filter(c=>Qp(e,c,o,i)),held:l.filter(c=>!Qp(e,c,o,i))}}const Z5=(e,t)=>e.sandbox_only&&(t==null?void 0:t.mode)!=="sandbox"?"Sandbox-only: it runs in a box, and this agent's place is the runner":void 0,Ng=new Set(["browser"]),Sg=(e,t,n)=>e||t.some(o=>Ng.has(o))||!n?{mode:"runner"}:n.defaultPlace;function Fj(e,t){const n=Kd(e.definition.place);if(n)return{place:n,byDefault:!1};const o=e.kind==="workflow",i=e.definition.tools??[];if(!(!o&&!i.some(l=>Ng.has(l))&&!t))return{place:Sg(o,i,t),byDefault:!0}}const gp=(e,t,n)=>Xd(e,t).filter(o=>o.available&&((n==null?void 0:n.mode)==="sandbox"?!Ng.has(o.name):!o.sandbox_only)).map(o=>o.name),J5=["web_fetch","web_search"],dw=e=>e.some(t=>J5.includes(t)),Uj={pi:"Pi","claude-agent":"Claude",codex:"Codex",opencode:"OpenCode"},eM=["pi","claude-agent","codex","opencode"];function tM(e,t){const n=eM.flatMap(o=>{const i=e.find(l=>l.id===o);return i?[{id:o,label:Uj[o],available:i.available,reason:i.reason}]:[]});return t&&(n.push({id:jg,label:"Decision",available:t.available,reason:t.available?void 0:"This server runs no decision workflows: it has no decision provider's key."}),n.push({id:Ij,label:"Workflow",available:!0,reason:void 0})),n}function nM(e){var t;return e.status===412||e.code==="precondition_failed"?{kind:"conflict",message:e.message}:e.status===422&&((t=e.fields)!=null&&t.length)?{kind:"invalid",message:e.message,fields:Object.fromEntries(e.fields.map(n=>[n.field,n.message]))}:{kind:"other",message:e.message}}function Yd(e,t=!1){var n,o,i;return e.status===412||e.code==="precondition_failed"?t?{kind:"taken"}:{kind:"conflict"}:(n=e.problems)!=null&&n.length?{kind:"refused",problems:e.problems}:{kind:"other",message:((i=(o=e.fields)==null?void 0:o[0])==null?void 0:i.message)??e.message,code:e.code}}function sM(e,t){const n=`definition.${t}`;return(e??[]).filter(o=>o.field===n||o.field.startsWith(`${n}[`)||o.field.startsWith(`${n}.`)||o.field.startsWith(`${n}/`))}const Ko=(e,t,n)=>({...ao(e,t),title:n}),rM=(e,t)=>{const n=e.get(t);return n!=null&&n.title?rn(n):`run ${Hl(t)}`},Wj="text-lead leading-[1.65] [&_a]:text-primary-text [&_a]:underline [&_a]:underline-offset-2 [&_code]:bg-muted [&_code]:px-1 [&_code]:font-mono [&_code]:text-body [&_h1]:mb-2 [&_h1]:text-prose [&_h1]:font-semibold [&_h2]:mb-2 [&_h2]:mt-3 [&_h2]:text-lead [&_h2]:font-semibold [&_h3]:mt-3 [&_h3]:font-semibold [&_li]:mb-0.5 [&_ol]:mb-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:mb-2 [&_p:last-child]:mb-0 [&_pre]:mb-2 [&_pre]:overflow-x-auto [&_pre]:border [&_pre]:bg-background [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-small [&_ul]:mb-2 [&_ul]:list-disc [&_ul]:pl-5",oM=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),fw=20;function aM({agent:e,v2:t,focus:n=[],server:o,onAgent:i,places:l,onChanged:c}){var ye;const[u,f]=y.useState(null),[p,h]=y.useState(null),[b,x]=y.useState([]),[m,v]=y.useState({items:[],cursor:null,pages:0}),[w,j]=y.useState({items:[],cursor:null,pages:0}),[S,T]=y.useState(!1),$=y.useRef(0),_=y.useRef(!1),E=()=>{const ee=++$.current;_.current=!1,h(null);const be=t.agentLearning(e.agent_id).then(Oe=>{ee===$.current&&(f(Oe),v({items:[],cursor:Oe.notes.next_cursor,pages:0}),j({items:[],cursor:Oe.log.next_cursor,pages:0}))},Oe=>{ee===$.current&&h(Oe??new Error("unknown"))});return t.listAgentRuns(e.agent_id,50,null,!!e.archived_at).then(Oe=>{ee===$.current&&x(Oe.runs)},()=>{}),be};y.useEffect(()=>{E()},[t,e.agent_id]);const R=()=>(c==null||c(),E()),C=()=>{if(!m.cursor||_.current)return;const ee=$.current;_.current=!0,t.learningNotes(e.agent_id,m.cursor).then(be=>{ee===$.current&&(_.current=!1,v(Oe=>({items:[...Oe.items,...be.items.filter(We=>!Oe.items.some(fe=>fe.file===We.file))],cursor:be.next_cursor,pages:Oe.pages+1})))},be=>{ee===$.current&&(_.current=!1,v(Oe=>({...Oe,error:be??new Error("unknown")})))})},O=e.definition.learning===!0||e.definition.learning==="notes",z=!!e.archived_at,F=y.useMemo(()=>[...(u==null?void 0:u.notes.items)??[],...m.items],[u,m.items]),D=F.filter(ee=>ee.status==="active"),B=F.filter(Y1),U=(u==null?void 0:u.skills)??[],W=(u==null?void 0:u.workflows)??[],[X,M]=y.useState(void 0),L=B.length>0||[...U,...W].some(ee=>ee.status==="pending")||W.some(ee=>ee.status==="active");y.useEffect(()=>{if(!L||X!==void 0)return;let ee=!0;return Promise.resolve().then(()=>t.capabilities()).then(be=>{ee&&M(cA(be))},()=>{ee&&M("password")}),()=>{ee=!1}},[L]);const I=F.filter(ee=>ee.status==="superseded"||ee.status==="retired"),G=y.useMemo(()=>{const ee=new Map(F.map(Oe=>[Oe.file,Oe])),be=new Map;for(const Oe of F){if(Oe.status==="superseded")continue;const fe=[...new Set([...vA(Oe.text),...F.filter(Re=>Re.status==="superseded"&&Re.superseded_by===Oe.file).map(Re=>Re.file)])].flatMap(Re=>{const Xe=ee.get(Re);return Xe?Xe.status==="superseded"&&Xe.superseded_by===Oe.file?[{file:Re,name:Xe.name}]:[]:[{file:Re,name:null}]});fe.length&&be.set(Oe.file,fe)}return be},[F]),P=y.useMemo(()=>new Map(b.map(ee=>[ee.run_id,ee])),[b]),q=y.useMemo(()=>$A([...(u==null?void 0:u.log.items)??[],...w.items]),[u,w.items]),ne=n.filter(ee=>!F.some(be=>be.file===ee)).length>0;y.useEffect(()=>{u&&ne&&m.cursor&&m.error===void 0&&m.pages<fw&&C()},[u,ne,m.cursor,m.pages]);const ae=F.some(ee=>!q.has(ee.file));y.useEffect(()=>{if(!u||!ae||!w.cursor||w.pages>=fw)return;const ee=$.current;t.learningLog(e.agent_id,w.cursor).then(be=>{ee===$.current&&j(Oe=>({items:[...Oe.items,...be.items],cursor:be.next_cursor,pages:Oe.pages+1}))},()=>{ee===$.current&&j(be=>({...be,cursor:null}))})},[u,ae,w.cursor]);const ie=b.filter(ee=>ee.learning&&(ee.learning.state==="merged"||ee.learning.state==="dropped")).length;if(p&&!u)return s.jsx(ss,{problem:ao(p,"what this agent learned"),onRetry:E,className:""});if(!u)return s.jsx(cM,{});const ce=p?s.jsx(iM,{error:p,onRetry:E}):null,le=ee=>s.jsx(dM,{agent:e,v2:t,onAgent:i,server:o,disabled:z,quiet:ee});return!F.length&&!U.length&&!W.length&&!S?s.jsxs("div",{className:"space-y-6",children:[ce,s.jsx(mM,{on:O,lookedBack:ie,switchRow:le(!0),onAdd:z?void 0:()=>T(!0)}),s.jsx(ew,{v2:t,agentId:e.agent_id,on:O,quiet:!0}),s.jsx(pw,{runs:b})]}):s.jsxs("div",{className:"space-y-6",children:[B.length>0&&s.jsxs("section",{className:"border border-warning/50","aria-label":"Waiting for your OK",children:[s.jsxs("h2",{className:"caps flex items-baseline gap-2 border-b border-warning/50 px-4 py-3 text-small font-semibold",children:["Waiting for your OK",s.jsx("span",{className:"font-mono font-normal text-muted-foreground",children:B.length})]}),s.jsx("p",{className:"px-4 pt-3 text-body text-muted-foreground",children:uA}),((ye=Fj(e,l))==null?void 0:ye.place.mode)==="runner"&&(e.definition.tools??[]).includes("bash")&&s.jsx("p",{className:"px-4 pt-1 text-body text-muted-foreground",children:dA}),s.jsx("ul",{className:"space-y-3 p-4",children:B.map(ee=>s.jsx("li",{children:s.jsx(mw,{note:ee,v2:t,agentId:e.agent_id,readOnly:z,focused:n.includes(ee.file),from:q.get(ee.file),runs:P,onChanged:R,approves:X,replaces:G.get(ee.file)})},ee.file))})]}),gA(u.impact)?s.jsx(uM,{impact:u.impact}):u.impact===null&&O&&s.jsx("p",{className:"font-mono text-small text-muted-foreground",children:lM}),s.jsx(ew,{v2:t,agentId:e.agent_id,on:O}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]",children:[s.jsxs("div",{className:"min-w-0 space-y-6",children:[s.jsxs("section",{className:"min-w-0 space-y-3","aria-label":"Notes",children:[s.jsxs("div",{className:"flex flex-wrap items-end gap-x-4 gap-y-2",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"What it has learned"}),s.jsx("p",{className:"mt-0.5 text-body text-muted-foreground",children:D.length?`${La(D.length)} in use. Every later run reads ${D.length===1?"it":"them"} before it starts.`:[...U,...W].some(ee=>ee.status==="active")?"No note is in use.":"No note is in use: the next run starts with nothing learned."})]}),!z&&!S&&s.jsxs(Z,{size:"sm",onClick:()=>T(!0),children:[s.jsx(pl,{"aria-hidden":!0})," Add a note"]})]}),ce,!O&&s.jsx(fM,{server:o}),S&&s.jsx(Vj,{title:"New note",v2:t,agentId:e.agent_id,taken:F.map(ee=>ee.file),onDone:ee=>{T(!1),ee&&R()}},"new"),s.jsx("ul",{className:"space-y-3",children:D.map(ee=>s.jsx("li",{children:s.jsx(mw,{note:ee,v2:t,agentId:e.agent_id,readOnly:z,focused:n.includes(ee.file),from:q.get(ee.file),runs:P,onChanged:R,replaces:G.get(ee.file)})},ee.file))}),m.error!==void 0&&s.jsx(ss,{problem:ao(m.error,"more notes"),onRetry:C,className:""}),m.cursor&&s.jsx("div",{className:"flex justify-center",children:s.jsx(Z,{size:"sm",onClick:C,children:"Load more notes"})}),I.length>0&&s.jsx(yM,{notes:I,all:F,from:q,focus:n,runs:P,v2:t,agentId:e.agent_id,readOnly:z,onChanged:R})]}),["skill","workflow"].map(ee=>{const be=ee==="skill"?U:W;if(!be.length)return null;const Oe=ee==="skill"?"Skills it learned":"Workflows it learned",We=be.filter(Re=>Re.status!=="retired"),fe=be.filter(Re=>Re.status==="retired");return s.jsxs("section",{className:"min-w-0 space-y-3","aria-label":Oe,children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold",children:Oe}),s.jsx("p",{className:"mt-0.5 text-body text-muted-foreground",children:We.length?ee==="skill"?`${Yu(We.length,"skill")}: how to do a job it does again, given to every later run once active.`:`${Yu(We.length,"workflow")}: a job it does again, as steps a later run can call.`:`No ${ee} is in use: the next run gets none.`})]}),We.length>0&&s.jsx("ul",{className:"space-y-3",children:We.map(Re=>s.jsx("li",{children:s.jsx(pM,{item:Re,kind:ee,v2:t,agentId:e.agent_id,readOnly:z,runs:P,approves:X,onChanged:R})},Re.file))}),fe.length>0&&s.jsx(vM,{kind:ee,items:fe,v2:t,agentId:e.agent_id,runs:P,readOnly:z,onChanged:R})]},ee)})]}),s.jsxs("aside",{className:"min-w-0 space-y-6","aria-label":"About learning",children:[s.jsx(Hj,{title:"Learning",children:le(!1)}),s.jsx(pw,{runs:b}),s.jsx(wM,{index:u.index,skills:U.filter(ee=>ee.status==="active").map(ee=>ee.name),off:!O||o==="off"})]})]})]})}function iM({error:e,onRetry:t}){const n=ao(e,"the notes"),o=[n.said,n.code].filter(Boolean).join(" · ");return s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 border border-destructive/40 px-3 py-2 text-body",role:"alert",title:o||void 0,children:[s.jsxs("span",{className:"min-w-0 flex-1",children:["Couldn't refresh the notes: ",n.why.charAt(0).toLowerCase()+n.why.slice(1)," What's shown may be out of date."]}),s.jsx(Z,{type:"button",onClick:t,size:"sm",children:"Try again"})]})}const lM="After two runs on each side of the first thing it learned (a note, a skill or a workflow), this shows what learning changed.";function Hj({title:e,children:t,label:n}){return s.jsxs("section",{className:"border","aria-label":n??e,children:[s.jsx("h2",{className:"caps border-b px-4 py-3 text-small font-semibold",children:e}),t]})}function cM(){const e="block bg-muted motion-safe:animate-pulse";return s.jsxs("div",{className:"space-y-3",role:"status","aria-busy":"true","aria-label":"Loading what it learned",children:[s.jsx("span",{"aria-hidden":!0,className:oe(e,"h-6 w-56")}),[0,1,2].map(t=>s.jsxs("div",{"aria-hidden":!0,className:"space-y-3 border p-5",children:[s.jsx("span",{className:oe(e,"h-4 w-1/3")}),s.jsx("span",{className:oe(e,"h-3 w-2/3 bg-muted/70")}),s.jsx("span",{className:oe(e,"h-3 w-1/2 bg-muted/70")})]},t)),s.jsx("span",{className:"sr-only",children:"Loading what it learned…"})]})}function uM({impact:e}){const{before:t,after:n}=e,o=[{label:"Answers in",now:Ju(n.median_duration_s),was:Ju(t.median_duration_s),delta:Ub(t.median_duration_s,n.median_duration_s)},...ej(e)?[{label:"A run costs",now:Ia(n.median_cost_usd),was:Ia(t.median_cost_usd),delta:Ub(t.median_cost_usd,n.median_cost_usd)}]:[]],i=tj(e),l=[`Medians of ${no(t.runs)} before it first learned and ${no(n.runs)} that started from what it learned (a note, a skill or a workflow).`,`Costs are of the ${t.cost_runs} and ${n.cost_runs} runs whose cost is known.`].join(" ");return s.jsx("section",{className:"border","aria-label":hA(e),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-x-8 gap-y-4 px-4 py-3",children:[s.jsxs("div",{className:"flex items-baseline gap-2.5",children:[s.jsx("span",{className:"caps text-small font-semibold",children:"Since it learned"}),s.jsxs("span",{className:"font-mono text-label text-muted-foreground",title:l,children:["on ",no(n.runs)]})]}),s.jsxs("dl",{className:"flex flex-1 flex-wrap items-baseline gap-x-10 gap-y-3","aria-hidden":!0,children:[o.map(c=>s.jsxs("div",{className:"flex items-baseline gap-3",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:c.label}),s.jsxs("dd",{className:"flex items-baseline gap-2 font-mono",children:[s.jsx("span",{className:"text-figure font-semibold leading-none",children:c.now}),s.jsxs("span",{className:"text-small text-muted-foreground",children:["instead of ",c.was]}),c.delta!==null&&c.delta!==0&&s.jsxs("span",{className:oe("text-small",c.delta<0?"text-primary-text":"text-warning-text"),children:[c.delta>0?"+":"−",Math.abs(c.delta),"%"]})]})]},c.label)),i!==null&&s.jsxs("div",{className:"flex items-baseline gap-3",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:"Learning itself"}),s.jsxs("dd",{className:"font-mono text-body text-muted-foreground",children:[Ia(i)," a run"]})]})]})]})})}function dM({agent:e,v2:t,onAgent:n,server:o,disabled:i,quiet:l}){const[c,u]=y.useState(!1),[f,p]=y.useState(null),[h,b]=y.useState(null),x=async m=>{u(!0),p(null),b(m);try{const{agent:v,etag:w}=await t.getAgent(e.agent_id),j=kg(v,{learning:m},m?"Learning on":"Learning off");if(j.unchanged)n==null||n(v);else{const{unchanged:S,...T}=j;n==null||n((await t.updateDefinition(e.agent_id,T,w)).agent)}}catch(v){p(v??new Error("unknown"))}b(null),u(!1)};return s.jsx(Rj,{id:`learns-${e.agent_id}`,className:"px-4 py-4",quiet:l,checked:h??(e.definition.learning===!0||e.definition.learning==="notes"),onChange:m=>void x(m),busy:c,disabled:i,server:o,problem:f?s.jsx(ss,{problem:Ko(f,"the agent","Learning was not changed."),className:"mt-2"}):null})}function fM({server:e}){return s.jsxs(ns,{tone:"warning",children:["Learning is off",e==="off"?" on this server":"",", so later runs don't read these notes. They're kept for when it's back on."]})}function mM({on:e,lookedBack:t,switchRow:n,onAdd:o}){return s.jsxs("section",{className:"mx-auto max-w-xl border","aria-label":"Learning",children:[s.jsxs("div",{className:"px-6 py-12 text-center",children:[s.jsx(Nh,{className:"mx-auto mb-3 size-5 text-primary-text","aria-hidden":!0}),s.jsx("p",{className:"font-mono text-body text-muted-foreground",children:e?"Nothing learned yet.":"Learning is off for this agent."}),s.jsx("p",{className:"mx-auto mt-2 max-w-md text-lead text-muted-foreground",children:e?"After each run, it looks back and keeps a note when something will help next time. Its notes show here, and every later run reads them first.":"With learning on, it keeps short notes on what worked after each run, and every later run reads them before it starts."}),e&&t>0&&s.jsxs("p",{className:"mt-3 font-mono text-small text-muted-foreground",children:[no(t)," looked back: nothing worth keeping yet."]})]}),s.jsx("div",{className:"border-t",children:n}),o&&s.jsx("div",{className:"flex justify-center border-t px-4 py-3",children:s.jsxs(Z,{size:"sm",variant:"ghost",onClick:o,children:[s.jsx(pl,{"aria-hidden":!0})," Or write a note yourself"]})})]})}function mw({note:e,v2:t,agentId:n,readOnly:o,focused:i,from:l,runs:c,onChanged:u,approves:f,replaces:p=[]}){const[h,b]=y.useState(!1),[x,m]=y.useState(!1),[v,w]=y.useState(!1),[j,S]=y.useState(i),[T,$]=y.useState(null),[_,E]=y.useState(!1),[R,C]=y.useState(null),O=y.useRef(null),z=Y1(e),F=async()=>{const U=W=>s.jsx("p",{className:"text-small text-destructive-text",role:"alert",children:W});E(!0),C(null);try{await t.approveNote(n,e.file,e.etag)}catch(W){E(!1),C(W instanceof Ee&&Yd(W).kind==="conflict"?U(`${Dd} Reload the tab to see the newest version.`):s.jsx(ss,{problem:Ko(W,"the note","The note was not approved."),className:""}));return}await u(),E(!1)};if(y.useEffect(()=>{var W,X;if(!i)return;S(!0),(X=(W=O.current)==null?void 0:W.scrollIntoView)==null||X.call(W,{block:"center",behavior:"smooth"});const U=setTimeout(()=>S(!1),2600);return()=>clearTimeout(U)},[i]),y.useEffect(()=>{if(!T)return;const U=setTimeout(()=>$(null),2400);return()=>clearTimeout(U)},[T]),h)return s.jsx(Vj,{title:"Edit note",v2:t,agentId:n,file:e.file,seen:e,onDone:U=>{b(!1),U&&($("Saved"),u())}});const D=Sl(e.text),B=Jp(e.last_change);return s.jsxs("article",{ref:O,id:`note-${e.file}`,tabIndex:-1,"aria-label":e.name,className:oe("border bg-card/40 outline-none focus-visible:border-primary transition-[border-color,box-shadow] duration-slow",j&&"border-primary ring-1 ring-primary"),children:[s.jsxs("header",{className:"flex flex-col gap-x-3 gap-y-1 px-5 pt-4 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{className:"min-w-0 break-words text-prose font-semibold leading-snug",children:e.name}),s.jsx(Me,{children:G1(e.type)}),e.origin==="you"&&s.jsx(Me,{tone:"muted",children:"From you"}),T&&s.jsx("span",{className:"caps text-micro text-success-text",role:"status",children:T})]}),s.jsx("p",{className:"mt-1 text-body text-muted-foreground",children:e.description}),z&&f==="password"&&s.jsx("p",{className:"mt-2 font-mono text-label text-muted-foreground",children:Q1})]}),!o&&!v&&s.jsxs("div",{className:"-ml-3 flex shrink-0 items-center gap-1 sm:ml-0",children:[z?f==="yes"&&s.jsx(Z,{size:"sm",variant:"solid",onClick:()=>void F(),disabled:_,"aria-label":`Approve ${e.name}`,children:_?"Approving":"Approve"}):s.jsxs(Z,{size:"sm",variant:"ghost",onClick:()=>b(!0),"aria-label":`Edit ${e.name}`,children:[s.jsx(Ml,{"aria-hidden":!0})," Edit"]}),s.jsx(Z,{size:"sm",variant:"destructive",onClick:()=>w(!0),"aria-label":`Retire ${e.name}`,children:"Retire"})]})]}),R&&s.jsx("div",{className:"px-5 pt-3",children:R}),D.trim()&&s.jsx(Zd,{text:D}),s.jsxs("footer",{className:"flex flex-wrap items-center gap-x-5 gap-y-1.5 border-t px-5 py-2.5 font-mono text-label text-muted-foreground",children:[(l==null?void 0:l.run)&&s.jsx(Qd,{run:l.run.id,runs:c,at:l.run.at,reason:l.run.reason}),B&&s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Sh,{className:"size-3","aria-hidden":!0}),B]}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Mu,{className:"size-3","aria-hidden":!0}),"Given to ",no(e.runs.given)]}),e.runs.read>0&&s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Mu,{className:"size-3","aria-hidden":!0}),"Read in ",no(e.runs.read)]}),p.length>0&&s.jsxs("button",{type:"button",onClick:()=>m(U=>!U),"aria-expanded":x,className:"flex items-center gap-1.5 hover:text-foreground",children:[s.jsx(l_,{className:"size-3","aria-hidden":!0}),"Replaces ",p.length," older ",p.length===1?"note":"notes",s.jsx(Bo,{className:oe("size-3 transition-transform",x&&"rotate-180"),"aria-hidden":!0})]})]}),x&&p.length>0&&s.jsx("ul",{"aria-label":"Notes it replaces",className:"space-y-1 border-t px-5 py-2.5 text-body text-muted-foreground",children:p.map(U=>s.jsx("li",{className:oe("break-words",U.name===null&&"font-mono text-small"),children:U.name??U.file},U.file))}),v&&s.jsx(Gj,{name:e.name,kind:"note",retire:()=>t.retireNote(n,e.file,e.etag),onDone:async U=>{U&&await u(),w(!1)}})]})}function pM({item:e,kind:t,v2:n,agentId:o,readOnly:i,runs:l,approves:c,onChanged:u}){const[f,p]=y.useState(!1),[h,b]=y.useState(null),[x,m]=y.useState(null),[v,w]=y.useState(null),[j,S]=y.useState(!1),[T,$]=y.useState(!1),[_,E]=y.useState(!1),R=y.useRef(Ws()).current,[C,O]=y.useState(null),[z,F]=y.useState(null),D=e.status==="pending",B=t==="workflow"&&e.status==="active"&&c==="yes",U=async()=>{w(null),b(null),m(null);try{const L=await n.readNote(o,e.file);b(L.note),m(L.etag)}catch(L){w(L??new Error("unknown"))}},W=async()=>{if(f)return p(!1);p(!0),h===null&&await U()};y.useEffect(()=>{h===null&&x===null||(f?U():(b(null),m(null)))},[e.etag]);const X=t==="skill"&&f&&x?x:e.etag,M=async()=>{S(!0),F(null);try{await n.approveNote(o,Bp(e),X)}catch(L){S(!1),F(L instanceof Ee&&Yd(L).kind==="conflict"?s.jsx("p",{className:"text-small text-destructive-text",role:"alert",children:`${Dd} Reload the tab to see the newest version.`}):s.jsx(ss,{problem:Ko(L,`the ${t}`,`The ${t} was not approved.`),className:""}));return}await u(),S(!1)},K=`the ${t} ${e.name}`;return s.jsxs("article",{"aria-label":e.name,className:"border bg-card/40",children:[s.jsxs("header",{className:"flex flex-col gap-x-3 gap-y-1 px-5 pt-4 sm:flex-row sm:items-start",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h3",{className:"min-w-0 break-words font-mono text-lead font-semibold leading-snug",children:e.name}),D&&s.jsxs(Me,{tone:"warning",children:[s.jsx(kh,{className:"size-3","aria-hidden":!0}),"Waits for your OK"]})]}),e.description&&s.jsx("p",{className:"mt-1 text-body text-muted-foreground",children:e.description}),D&&c==="password"&&s.jsx("p",{className:"mt-2 font-mono text-label text-muted-foreground",children:Q1})]}),s.jsxs("div",{className:"-ml-3 flex shrink-0 items-center gap-1 sm:ml-0",children:[!i&&!T&&!_&&s.jsxs(s.Fragment,{children:[D&&c==="yes"&&s.jsx(Z,{size:"sm",variant:"solid",onClick:()=>void M(),disabled:j,"aria-label":`Approve ${e.name}`,children:j?"Approving":"Approve"}),B&&s.jsx(Z,{size:"sm",onClick:()=>{O(null),E(!0)},"aria-label":`Make ${e.name} an agent`,children:"Make this an agent"}),s.jsx(Z,{size:"sm",variant:"destructive",onClick:()=>$(!0),"aria-label":`Retire ${e.name}`,children:"Retire"})]}),s.jsxs(Z,{size:"sm",variant:"ghost",onClick:()=>void W(),"aria-expanded":f,"aria-label":`${f?"Hide":"Show"} ${K}`,children:[s.jsx(Bo,{className:oe("transition-transform",f&&"rotate-180"),"aria-hidden":!0}),f?"Hide":"Show"]})]})]}),z&&s.jsx("div",{className:"px-5 pt-3",children:z}),C&&s.jsxs("p",{className:"px-5 pt-3 text-body",role:"status",children:["Made the agent ",s.jsx("a",{href:`#/agents/${encodeURIComponent(C.agent_id)}`,className:"font-mono underline underline-offset-2",children:C.definition.name}),". Open it to run it."]}),f&&(v!==null?s.jsx("div",{className:"px-5 pt-3",children:s.jsx(ss,{problem:ao(v,K),onRetry:()=>void U(),className:""})}):h===null?s.jsx("div",{className:"px-5 pt-3",role:"status","aria-label":`Loading ${K}`,children:s.jsx("div",{"aria-hidden":!0,className:"h-16 bg-muted motion-safe:animate-pulse"})}):t==="skill"?s.jsx(Zd,{text:Sl(h)}):s.jsx(hM,{name:e.name,text:h})),s.jsxs("footer",{className:"mt-3 flex flex-wrap items-center gap-x-5 gap-y-1.5 border-t px-5 py-2.5 font-mono text-label text-muted-foreground",children:[e.run&&s.jsx(Qd,{run:e.run,runs:l}),Jp(e.last_change)&&s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Sh,{className:"size-3","aria-hidden":!0}),Jp(e.last_change)]}),s.jsx("span",{children:e.bytes<1024?`${e.bytes} B`:`${(e.bytes/1024).toFixed(1)} KB`})]}),T&&s.jsx(Gj,{name:e.name,kind:t,retire:()=>n.retireNote(o,Bp(e),X),onDone:async L=>{L&&await u(),$(!1)}}),_&&s.jsx(xM,{name:e.name,keys:R,promote:L=>n.promoteWorkflow(o,e.name,L),onDone:L=>{E(!1),L&&O(L)}})]})}function hM({name:e,text:t}){const{doc:n,graph:o}=y.useMemo(()=>{try{const c=JSON.parse(t);return{doc:c,graph:fl(c)}}catch{return{doc:null,graph:null}}},[t]),i=y.useMemo(()=>o?{meta:zd(n,o)}:void 0,[n,o]),l=s.jsx("pre",{className:"max-h-80 overflow-auto border bg-background p-3 font-mono text-small",children:t});return o!=null&&o.nodes.length?s.jsxs("div",{className:"mx-5 mt-3 space-y-2",children:[s.jsx("div",{className:"overflow-auto border bg-[radial-gradient(hsl(var(--border))_1px,transparent_1px)] [background-size:22px_22px] px-4 py-4",children:s.jsx(qd,{graph:o,marks:i,label:`The workflow ${e}, as a graph`,minScale:.55,maxScale:1})}),s.jsx(Vd,{}),s.jsxs("details",{children:[s.jsx("summary",{className:"caps cursor-pointer text-label text-muted-foreground hover:text-foreground",children:"workflow.json"}),s.jsx("div",{className:"mt-2",children:l})]})]}):s.jsx("div",{className:"mx-5 mt-3",children:l})}function Jp(e){return e&&e.kind!=="learned"?`${H1(e.kind,e.by)} · ${St(e.at)}`:null}function Bj(e){return(e==null?void 0:e.by)==="host"?J4:e?`${H1("retired",e.by)} · ${St(e.at)}`:"Retired"}function Qd({run:e,runs:t,at:n,reason:o}){return s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsxs("span",{className:"flex shrink-0 items-center gap-1.5 whitespace-nowrap",title:o?`Kept because: ${o}`:void 0,children:[s.jsx(Nh,{className:"size-3 shrink-0 text-primary-text","aria-hidden":!0}),"Learned in"]}),s.jsx("a",{href:`#/runs/${encodeURIComponent(e)}`,className:"shrink-0 font-mono text-foreground/80 underline-offset-2 hover:text-foreground hover:underline",title:rM(t,e),children:Hl(e)}),n&&s.jsxs("span",{className:"shrink-0",children:["· ",St(n)]})]})}function Zd({text:e}){const[t,n]=y.useState(!1),o=e.split(`
|
|
534
|
-
`).length>8||e.length>520,i=y.useMemo(()=>Ba(e),[e]);return s.jsxs("div",{className:"px-5 pb-4 pt-3",children:[s.jsxs("div",{className:oe("relative",o&&!t&&"max-h-[9.5rem] overflow-hidden"),children:[s.jsx("div",{className:Wj,dangerouslySetInnerHTML:{__html:i}}),o&&!t&&s.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-0 h-10 bg-gradient-to-t from-background to-transparent","aria-hidden":!0})]}),o&&s.jsxs("button",{type:"button",onClick:()=>n(l=>!l),className:"caps mt-2 flex items-center gap-1 text-label text-muted-foreground hover:text-foreground",children:[s.jsx(Bo,{className:oe("size-3.5 transition-transform",t&&"rotate-180"),"aria-hidden":!0}),t?"Show less":"Show all"]})]})}const gM={note:"Later runs stop reading it. It stays under Earlier notes.",skill:"Later runs stop getting it. It stays under Earlier skills.",workflow:"Later runs stop getting it. It stays under Earlier workflows."};function Gj({name:e,kind:t,retire:n,onDone:o}){const[i,l]=y.useState(!1),[c,u]=y.useState(null),f=y.useRef(null);y.useEffect(()=>{var b;(b=f.current)==null||b.focus()},[]);const p=b=>s.jsx("p",{className:"text-small text-destructive-text",role:"alert",children:b}),h=async()=>{l(!0),u(null);try{await n()}catch(b){l(!1),u(b instanceof Ee&&Yd(b).kind==="conflict"?p(`${Dd} Reload the tab to see the newest version.`):s.jsx(ss,{problem:Ko(b,`the ${t}`,`The ${t} was not retired.`),className:""}));return}await o(!0)};return s.jsxs("div",{role:"alertdialog","aria-label":`Retire ${e}?`,onKeyDown:b=>{b.key==="Escape"&&(b.stopPropagation(),o(!1))},className:"flex flex-wrap items-center gap-3 border-t border-destructive/40 bg-destructive/5 px-5 py-3",children:[s.jsxs("p",{className:"min-w-0 flex-1 text-body",children:[s.jsx("span",{className:"font-semibold",children:"Retire it?"})," ",gM[t]]}),c&&s.jsx("div",{className:"w-full",children:c}),s.jsx(Z,{ref:f,size:"sm",variant:"destructive",onClick:()=>void h(),disabled:i,children:i?"Retiring":"Yes, retire"}),s.jsx(Z,{size:"sm",variant:"ghost",onClick:()=>void o(!1),disabled:i,children:"Keep"})]})}function xM({name:e,keys:t,promote:n,onDone:o}){const[i,l]=y.useState(!1),[c,u]=y.useState(null),f=y.useRef(null);y.useEffect(()=>{var h;(h=f.current)==null||h.focus()},[]);const p=async()=>{var b;l(!0),u(null);let h;try{h=await n(t.keyFor("promote",e))}catch(x){return l(!1),x instanceof Ee&&x.status<500&&t.done(),x instanceof Ee&&x.status===403?void u(s.jsx("p",{className:"text-small text-destructive-text",role:"alert",children:sA})):x instanceof Ee&&((b=x.problems)!=null&&b.length)?void u(s.jsxs("div",{className:"text-small text-destructive-text",role:"alert",children:[s.jsxs("p",{children:["No agent was made: ",x.message]}),s.jsx("ul",{className:"mt-1 list-disc space-y-0.5 pl-5",children:x.problems.map((m,v)=>s.jsx("li",{children:m.detail},v))})]})):void u(s.jsx(ss,{problem:Ko(x,"the agent","No agent was made."),className:""}))}t.done(),o(h)};return s.jsxs("div",{role:"alertdialog","aria-label":`Make ${e} an agent?`,onKeyDown:h=>{h.key==="Escape"&&(h.stopPropagation(),i||o(null))},className:"flex flex-wrap items-center gap-3 border-t px-5 py-3",children:[s.jsxs("p",{className:"min-w-0 flex-1 text-body",children:[s.jsx("span",{className:"font-semibold",children:"Make it an agent?"})," ",nA(e)]}),c&&s.jsx("div",{className:"w-full",children:c}),s.jsx(Z,{ref:f,size:"sm",variant:"solid",onClick:()=>void p(),disabled:i,children:i?"Making the agent":"Yes, make the agent"}),s.jsx(Z,{size:"sm",variant:"ghost",onClick:()=>o(null),disabled:i,children:"Cancel"})]})}function qj({name:e,kind:t,from:n,restore:o,onChanged:i,onDone:l}){const[c,u]=y.useState(!1),[f,p]=y.useState(null),h=y.useRef(null);y.useEffect(()=>{var m;(m=h.current)==null||m.focus()},[]);const b=m=>s.jsx("p",{className:"text-small text-destructive-text",role:"alert",children:m}),x=async()=>{var m;u(!0),p(null);try{await o()}catch(v){if(u(!1),v instanceof Ee&&(v.status===412||v.code==="precondition_failed")){p(b(Dd)),await i();return}if(v instanceof Ee&&v.status===403)return void p(b(rA));if(v instanceof Ee&&((m=v.problems)!=null&&m.length))return void p(s.jsxs("div",{className:"text-small text-destructive-text",role:"alert",children:[s.jsxs("p",{children:["Not restored: ",v.message]}),s.jsx("ul",{className:"mt-1 list-disc space-y-0.5 pl-5",children:v.problems.map((w,j)=>s.jsx("li",{children:w.detail},j))})]}));if(v instanceof Ee&&v.status===400){await i(),l();return}return void p(s.jsx(ss,{problem:Ko(v,`the ${t}`,`The ${t} was not restored.`),className:""}))}await i(),l()};return s.jsxs("div",{role:"alertdialog","aria-label":`Restore ${e}?`,onKeyDown:m=>{m.key==="Escape"&&(m.stopPropagation(),l())},className:"flex flex-wrap items-center gap-3 border-t bg-card px-5 py-3",children:[s.jsxs("p",{className:"min-w-0 flex-1 text-body",children:[s.jsx("span",{className:"font-semibold",children:"Restore it?"})," ",tA(n)]}),f&&s.jsx("div",{className:"w-full",children:f}),s.jsx(Z,{ref:h,size:"sm",variant:"solid",onClick:()=>void x(),disabled:c,children:c?"Restoring":"Yes, restore"}),s.jsx(Z,{size:"sm",variant:"ghost",onClick:l,disabled:c,children:"Keep"})]})}function Vj({title:e,v2:t,agentId:n,file:o,seen:i,taken:l=[],onDone:c}){const[u,f]=y.useState(i?ed(i.text):{name:"",description:"",type:"feedback",body:`
|
|
535
|
-
`,rest:[]}),[p,h]=y.useState((i==null?void 0:i.etag)??null),[b,x]=y.useState(null),[m,v]=y.useState(!1),[w,j]=y.useState([]),[S,T]=y.useState(null),[$,_]=y.useState(!1),[E,R]=y.useState(null),C=y.useRef(null),O=async()=>{if(o)try{const U=await t.readNote(n,o);f(ed(U.note)),h(U.etag),x(null)}catch(U){x(U??new Error("unknown"))}};y.useEffect(()=>{var U;(U=C.current)==null||U.focus()},[]);const z=U=>f(W=>({...W,...U})),F=u.name.trim()!==""&&u.description.trim()!==""&&!m,D=async()=>{if(!F)return;if(T(null),j([]),_(!1),o&&!p){T(lp);return}v(!0);const U=yA(u);try{await t.writeNote(n,o??Hb(u.name,l),U,o?{etag:p??""}:{create:!0}),c(!0)}catch(W){v(!1);const X=W instanceof Ee?Yd(W,!o):null;(X==null?void 0:X.kind)==="conflict"?(R(U),await O()):(X==null?void 0:X.kind)==="refused"?j(X.problems):(X==null?void 0:X.kind)==="taken"?_(!0):T(W??new Error("unknown"))}},B=U=>{U.key==="Escape"?(U.preventDefault(),U.stopPropagation(),c(!1)):U.key==="Enter"&&(U.metaKey||U.ctrlKey||U.target.tagName==="INPUT")&&(U.preventDefault(),D())};return s.jsxs("section",{className:"border border-border-strong bg-card","aria-label":e,onKeyDown:B,children:[s.jsxs("div",{className:"flex items-center gap-3 border-b px-5 py-2.5",children:[s.jsx("h3",{className:"caps text-label font-semibold",children:e}),s.jsxs("span",{className:"ml-auto hidden font-mono text-label text-muted-foreground sm:inline",children:[s.jsxs("kbd",{children:[oM?"⌘":"Ctrl","+Enter"]})," save · ",s.jsx("kbd",{children:"Esc"})," cancel"]})]}),b!==null&&s.jsx(ss,{problem:ao(b,"the note"),onRetry:()=>{x(null),O()},className:"m-5"}),s.jsxs("div",{className:"space-y-4 px-5 py-4",children:[E&&s.jsxs("div",{className:"border border-warning/50 bg-warning/10 px-4 py-3 text-body",role:"alert",children:[s.jsxs("p",{className:"flex items-center gap-2 font-semibold",children:[s.jsx(er,{className:"size-4 text-warning-text","aria-hidden":!0}),"Changed since you opened it"]}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:"This is the newest version. Your edit wasn't saved; it's below to copy."}),s.jsxs("details",{className:"mt-2",children:[s.jsx("summary",{className:"caps cursor-pointer text-label text-muted-foreground hover:text-foreground",children:"Your edit"}),s.jsx("pre",{className:"mt-2 max-h-48 overflow-auto whitespace-pre-wrap break-words border bg-background p-3 font-mono text-small",children:E})]})]}),s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-1.5 block text-label font-semibold",children:"Name"}),s.jsx(He,{ref:C,value:u.name,onChange:U=>z({name:U.target.value}),placeholder:"e.g., Try /policies/refund-policy first"})]}),s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-1.5 block text-label font-semibold",children:"Description"}),s.jsx("span",{className:"-mt-0.5 mb-1.5 block text-small text-muted-foreground",children:"One line: what the next run sees before it opens the note."}),s.jsx(He,{value:u.description,onChange:U=>z({description:U.target.value}),placeholder:"When it applies, and what to do"})]}),s.jsxs("fieldset",{children:[s.jsx("legend",{className:"caps mb-1.5 text-label font-semibold",children:"Type"}),s.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Type",children:B1.map(U=>s.jsxs("label",{className:oe("caps cursor-pointer border px-3 py-1.5 text-label",u.type===U?"border-foreground":"text-muted-foreground hover:text-foreground"),title:U,children:[s.jsx("input",{type:"radio",name:`type-${o??"new"}`,className:"sr-only",checked:u.type===U,onChange:()=>z({type:U})}),G1(U)]},U))}),s.jsx("p",{className:"mt-1.5 text-small text-muted-foreground",children:aA[u.type]})]}),s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-1.5 block text-label font-semibold",children:"Note"}),s.jsx(Ss,{value:u.body.replace(/^\n/,""),onChange:U=>z({body:`
|
|
536
|
-
${U.target.value}`}),rows:7,placeholder:"What to do, and why. Markdown.",className:"resize-y leading-[1.65]"})]}),w.length>0&&s.jsxs("div",{className:"border border-destructive/50 bg-destructive/5 px-4 py-3 text-body",role:"alert",children:[s.jsx("p",{className:"font-semibold text-destructive-text",children:"Not saved: the note doesn't pass the checks."}),s.jsx("ul",{className:"mt-1 list-disc space-y-0.5 pl-5",children:w.map((U,W)=>s.jsx("li",{children:U.detail},W))})]}),$&&s.jsx("p",{className:"text-body text-destructive-text",role:"alert",children:"Not saved: a note by this name exists already. Change its name."}),S===lp?s.jsxs("p",{className:"text-body text-destructive-text",role:"alert",children:["Not saved: ",lp]}):S!==null&&s.jsx(ss,{problem:Ko(S,"the note","The note was not saved."),className:""}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Z,{size:"sm",variant:"solid",onClick:()=>void D(),disabled:!F,children:m?"Saving":o?"Save":"Add note"}),s.jsx(Z,{size:"sm",variant:"ghost",onClick:()=>c(!1),disabled:m,children:"Cancel"}),!o&&u.name.trim()&&s.jsx("span",{className:"ml-auto font-mono text-label text-muted-foreground",children:Hb(u.name,l)})]})]})]})}function yM({notes:e,all:t,from:n,focus:o,runs:i,v2:l,agentId:c,readOnly:u,onChanged:f}){const[p,h]=y.useState(null),[b,x]=y.useState(e.some($=>o.includes($.file))),[m,v]=y.useState(new Set),w=$=>v(_=>{const E=new Set(_);return E.has($)?E.delete($):E.add($),E}),j=e.some($=>o.includes($.file));y.useEffect(()=>{j&&x(!0)},[j]);const S=$=>{var _;return((_=t.find(E=>E.file===$))==null?void 0:_.name)??$},T=$=>{var E;const _=document.getElementById(`note-${$}`);(E=_==null?void 0:_.scrollIntoView)==null||E.call(_,{block:"center",behavior:"smooth"}),_==null||_.focus({preventScroll:!0})};return s.jsx(Kj,{title:"Earlier notes",count:`${e.length} no longer read`,open:b,onToggle:()=>x($=>!$),children:e.map($=>{var C,O;const _=$.status==="retired",E=_&&m.has($.file),R=(C=n.get($.file))==null?void 0:C.run;return s.jsxs("li",{id:`note-${$.file}`,className:oe("border-b px-4 py-3 last:border-b-0",o.includes($.file)&&"bg-primary/5"),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-lead text-muted-foreground line-through decoration-muted-foreground/40",children:$.name}),s.jsx(Me,{tone:"muted",children:_?"Retired":"Replaced"}),_&&s.jsx(Xj,{open:E,label:`the note ${$.name}`,onClick:()=>w($.file)}),_&&!u&&$.etag&&p!==$.file&&s.jsxs(Z,{size:"sm",onClick:()=>h($.file),"aria-label":`Restore ${$.name}`,children:[s.jsx(u0,{"aria-hidden":!0})," Restore"]})]}),s.jsx("p",{className:"mt-1 font-mono text-label text-muted-foreground",children:$.status==="superseded"&&$.superseded_by?s.jsxs(s.Fragment,{children:["Replaced by ",s.jsx("button",{type:"button",onClick:()=>T($.superseded_by),className:"text-foreground/80 underline-offset-2 hover:text-foreground hover:underline",children:S($.superseded_by)})]}):_?Bj($.retired):null}),p===$.file&&s.jsx("div",{className:"-mx-4 mt-2",children:s.jsx(qj,{name:$.name,kind:"note",from:(O=$.retired)==null?void 0:O.from,restore:()=>l.restoreNote(c,$.file,$.etag),onChanged:f,onDone:()=>h(null)})}),E&&s.jsxs("div",{className:"-mx-4 mt-2 border-t pt-1",children:[s.jsx("p",{className:"mt-2 px-5 text-body text-muted-foreground",children:$.description}),Sl($.text).trim()&&s.jsx(Zd,{text:Sl($.text)}),R&&s.jsx("p",{className:"mt-3 flex px-5 font-mono text-label text-muted-foreground",children:s.jsx(Qd,{run:R.id,runs:i,at:R.at,reason:R.reason})})]})]},$.file)})})}function Kj({title:e,count:t,open:n,onToggle:o,children:i}){return s.jsxs("section",{className:"border","aria-label":e,children:[s.jsxs("button",{type:"button","aria-expanded":n,onClick:o,className:"flex w-full items-center gap-2 px-4 py-3 text-left hover:bg-accent",children:[s.jsx(Bo,{className:oe("size-3.5 text-muted-foreground transition-transform",!n&&"-rotate-90"),"aria-hidden":!0}),s.jsx("span",{className:"caps text-small font-semibold",children:e}),s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:t})]}),n&&s.jsx("ul",{className:"border-t",children:i})]})}function vM({kind:e,items:t,v2:n,agentId:o,runs:i,readOnly:l,onChanged:c}){const[u,f]=y.useState(!1),[p,h]=y.useState(null),[b,x]=y.useState(new Set),m=v=>x(w=>{const j=new Set(w);return j.has(v)?j.delete(v):j.add(v),j});return s.jsx(Kj,{title:e==="skill"?"Earlier skills":"Earlier workflows",count:`${t.length} no longer given`,open:u,onToggle:()=>f(v=>!v),children:t.map(v=>{var w;return s.jsxs("li",{className:"border-b px-4 py-3 last:border-b-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-mono text-body text-muted-foreground line-through decoration-muted-foreground/40",children:v.name}),s.jsx(Me,{tone:"muted",children:"Retired"}),s.jsx(Xj,{open:b.has(v.file),label:`the ${e} ${v.name}`,onClick:()=>m(v.file)}),!l&&p!==v.file&&s.jsxs(Z,{size:"sm",onClick:()=>h(v.file),"aria-label":`Restore ${v.name}`,children:[s.jsx(u0,{"aria-hidden":!0})," Restore"]})]}),v.description&&s.jsx("p",{className:"mt-1 text-small text-muted-foreground",children:v.description}),s.jsx("p",{className:"mt-1 font-mono text-label text-muted-foreground",children:Bj(v.retired)}),p===v.file&&s.jsx("div",{className:"-mx-4 mt-2",children:s.jsx(qj,{name:v.name,kind:e,from:(w=v.retired)==null?void 0:w.from,restore:()=>n.restoreNote(o,Bp(v),v.etag),onChanged:c,onDone:()=>h(null)})}),b.has(v.file)&&s.jsxs("div",{className:"-mx-4 mt-2 border-t pt-1",children:[s.jsx(bM,{v2:n,agentId:o,file:v.file,etag:v.etag,kind:e,label:`the ${e} ${v.name}`}),v.run&&s.jsx("p",{className:"mt-3 flex px-5 font-mono text-label text-muted-foreground",children:s.jsx(Qd,{run:v.run,runs:i})})]})]},v.file)})})}function Xj({open:e,label:t,onClick:n}){return s.jsxs(Z,{size:"sm",variant:"ghost",className:"ml-auto",onClick:n,"aria-expanded":e,"aria-label":`${e?"Hide":"Show"} ${t}`,children:[s.jsx(Bo,{className:oe("transition-transform",e&&"rotate-180"),"aria-hidden":!0}),e?"Hide":"Show"]})}function bM({v2:e,agentId:t,file:n,etag:o,kind:i,label:l}){const[c,u]=y.useState(null),[f,p]=y.useState(null),h=y.useRef(0),b=async()=>{const x=++h.current;p(null),u(null);try{const m=await e.readNote(t,n);x===h.current&&u(m.note)}catch(m){x===h.current&&p(m??new Error("unknown"))}};return y.useEffect(()=>{b()},[n,o]),f!==null?s.jsx("div",{className:"px-5 pt-3",children:s.jsx(ss,{problem:ao(f,l),onRetry:()=>void b(),className:""})}):c===null?s.jsx("div",{className:"px-5 pt-3",role:"status","aria-label":`Loading ${l}`,children:s.jsx("div",{"aria-hidden":!0,className:"h-16 bg-muted motion-safe:animate-pulse"})}):i==="skill"?s.jsx(Zd,{text:Sl(c)}):s.jsx("pre",{className:"mx-5 mt-3 max-h-80 overflow-auto border bg-background p-3 font-mono text-small",children:c})}function pw({runs:e}){const t=e.filter(i=>{var l;return((l=i.learning)==null?void 0:l.state)==="dropped"}),n=t.filter(i=>Zu(i.learning.reason)!=="nothing").slice(0,6),o=t.length-t.filter(i=>Zu(i.learning.reason)!=="nothing").length;return t.length?s.jsxs(Hj,{title:"Kept nothing",children:[n.length>0&&s.jsx("ul",{children:n.map(i=>s.jsx("li",{className:"border-b last:border-b-0",children:s.jsxs("a",{href:`#/runs/${encodeURIComponent(i.run_id)}`,className:"block px-4 py-3 hover:bg-accent",children:[s.jsx("span",{className:"block text-body",children:dg(i.learning)}),s.jsxs("span",{className:"mt-1 flex items-center gap-2 font-mono text-label text-muted-foreground",children:[s.jsx("span",{className:"min-w-0 truncate",title:rn(i),children:rn(i)}),s.jsxs("span",{className:"shrink-0",children:["· ",St(i.created_at)]})]})]})},i.run_id))}),o>0&&s.jsxs("p",{className:oe("px-4 py-3 font-mono text-label text-muted-foreground",n.length>0&&"border-t"),children:[n.length?`${o} more ${o===1?"run":"runs"} had`:`${no(o)} had`," nothing new to remember."]})]}):null}function wM({index:e,skills:t,off:n}){const[o,i]=y.useState(!1),l=n?0:e.split(`
|
|
537
|
-
`).filter(p=>p.trim()).length,c=y.useMemo(()=>Ba(e.trim()),[e]),u=n?[]:t,f=u.length?`${u.length} ${u.length===1?"skill":"skills"}`:"";return s.jsxs("section",{className:"border","aria-label":"What the next run reads",children:[s.jsxs("button",{type:"button","aria-expanded":o,onClick:()=>i(p=>!p),className:"flex w-full items-center gap-2 px-4 py-3 text-left hover:bg-accent",children:[s.jsx(Bo,{className:oe("size-3.5 text-muted-foreground transition-transform",!o&&"-rotate-90"),"aria-hidden":!0}),s.jsx("span",{className:"caps text-small font-semibold",children:"What the next run reads"}),s.jsx("span",{className:"ml-auto font-mono text-label text-muted-foreground",children:[l?La(l):"",f].filter(Boolean).join(" · ")||"nothing"})]}),o&&s.jsxs("div",{className:"border-t",children:[n?s.jsx("p",{className:"px-4 py-3 text-body text-muted-foreground",children:"Learning is off: the next run gets no notes or skills."}):l?s.jsx("div",{className:oe(Wj,"max-h-72 overflow-auto break-words px-4 py-3 text-body"),dangerouslySetInnerHTML:{__html:c}}):s.jsx("p",{className:"px-4 py-3 text-body text-muted-foreground",children:u.length?"No note is in use.":"Nothing yet: no note is in use."}),u.length>0&&s.jsxs("p",{className:"break-words border-t px-4 py-3 font-mono text-small leading-[1.7]",children:["Active skills: ",u.join(", ")]}),s.jsx("p",{className:"border-t px-4 py-2 text-label text-muted-foreground",children:"Read-only: the notes in use, one line each, and the agent's active skills."})]})]})}function eh(e,t){return t&&e.startsWith(`${t}/`)&&e.length>t.length+1?{text:e.slice(t.length+1),title:e}:{text:e}}function Yj(e,t){var n;return((n=t==null?void 0:t.find(o=>o.id===e))==null?void 0:n.default_model)??void 0}const kM="No default for this harness yet: add a model key in Settings → Model keys, or choose a model here.",jM="none yet: add a model key in Settings → Model keys";class th extends Error{constructor(){super("Can't reach agentrun-serve. Try again once it's back."),this.name="Unreachable"}}const hw=e=>Math.min(1e4,1e3*2**e),gw=e=>e.status>=500&&!(e.headers.get("content-type")??"").includes("json"),NM=e=>(e==null?void 0:e.name)==="AbortError",xw=e=>e.reason instanceof Error?e.reason:new DOMException("The operation was aborted.","AbortError");function SM({fetch:e=(i,l)=>globalThis.fetch(i,l),probe:t="/v2/health",resumedMs:n=5e3,probeMs:o=5e3}={}){let i={state:"online"};const l=new Set,c=new Set;let u=[],f,p=null,h=null;const b=_=>{i=_;for(const E of[...l])E()},x=_=>{const E=hw(_);clearTimeout(f),b({state:"offline",attempt:_,retryAt:Date.now()+E}),f=setTimeout(()=>void j(),E)},m=()=>{i.state!=="offline"&&x(0)},v=()=>{if(i.state!=="offline")return;clearTimeout(f),b({state:"resumed"});const _=u;u=[];for(const E of _)E();for(const E of[...c])E();f=setTimeout(()=>{i.state==="resumed"&&b({state:"online"})},n)};async function w(_){const E=setTimeout(()=>_.abort(),o);try{return!gw(await e(t,{method:"GET",cache:"no-store",credentials:"same-origin",signal:_.signal}))}catch{return!1}finally{clearTimeout(E)}}async function j(){if(i.state!=="offline")return;clearTimeout(f),p==null||p.abort();const _=p=new AbortController,E=await w(_);p===_&&(p=null,i.state==="offline"&&(E?v():x(i.attempt+1)))}const S=()=>h??(h=w(new AbortController).finally(()=>{h=null})),T=_=>new Promise((E,R)=>{if(_!=null&&_.aborted)return R(xw(_));const C=()=>{u=u.filter(z=>z!==O),R(xw(_))},O=()=>{_==null||_.removeEventListener("abort",C),E()};u.push(O),_==null||_.addEventListener("abort",C,{once:!0})});return{fetch:async(_,E)=>{var O;const R=((E==null?void 0:E.method)??"GET").toUpperCase(),C=R==="GET"||R==="HEAD";for(let z=0;;z++){let F,D;try{F=await e(_,E)}catch(B){if((O=E==null?void 0:E.signal)!=null&&O.aborted||NM(B))throw B;D=B}if(F&&!gw(F))return v(),F;if(i.state!=="offline"&&await S()){if(F)return F;if(!C)throw new th;if(z>=2)throw D;await new Promise(B=>setTimeout(B,hw(z)));continue}if(m(),!C)throw new th;await T(E==null?void 0:E.signal)}},link:()=>i,subscribe:_=>(l.add(_),()=>{l.delete(_)}),onResume:_=>(c.add(_),()=>{c.delete(_)}),retryNow:()=>void j()}}const _M=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),Qj=e=>e instanceof th||e instanceof TypeError&&/fetch|network/i.test(e.message);function mn(e,t){const n=`${_M(t)} could not be read.`;if(Qj(e))return{title:n,why:"Can't reach agentrun-serve.",next:"It may be restarting: the console reconnects by itself."};if(!(e instanceof Ee))return{title:n,why:"Something went wrong in the console.",next:"Reload the page.",said:e instanceof Error?e.message:String(e)};const o=e.message,i=[e.code,e.requestId].filter(Boolean).join(" · "),l=(c,u)=>({title:n,why:c,next:u,said:o,code:i});return e.status===401?l("This browser is signed out.","Reload the page to sign in again."):e.status===403?l("The server doesn't allow this here.","Sign in as the server's owner, or open the console from the address the server printed."):e.status===404?l("This server doesn't have it.","Check the address, or open the list it belongs to."):e.status===429?l("Too many requests at once.","Wait a few seconds, then try again."):e.retryable||e.status===409||e.status===503?l("The server is busy.","Try again in a moment."):e.status>=500?l("The server hit a problem on its side.","Try again. If it keeps failing, the server's log says why."):l("The server turned the request down.","Its words say why: change what they name, then try again.")}function $M(e){return Qj(e)?"Can't reach agentrun-serve":e instanceof Ee?e.status>=500?"The server hit a problem":"The server refused this":"Something went wrong in the console"}const EM=[{id:"runs",label:"Runs",shows:()=>!0,Body:CM},{id:"workflow",label:"Workflow",shows:e=>e.kind==="workflow",Body:RM},{id:"learning",label:"Learning",shows:(e,t)=>e.kind==="agentic"&&t.learning!==!1,Body:e=>s.jsx(aM,{agent:e.agent,v2:e.v2,focus:e.focus,server:e.learning,onAgent:e.onAgent,places:e.places,onChanged:e.onChanged})},{id:"analytics",label:"Analytics",shows:(e,t)=>t.analytics,Body:C4}],zs=(e,t)=>`#/agents/${encodeURIComponent(e)}${t?`/${t}`:e==="new"?"/runs":""}`;function TM({v2:e,agentId:t,routePrefix:n,harnesses:o,efforts:i=[],go:l,tab:c,limits:u,learning:f,notes:p,places:h}){var ce;const[b,x]=y.useState(null),[m,v]=y.useState(null),[w,j]=y.useState(0),[S,T]=y.useState(void 0),[$,_]=y.useState(!1);y.useEffect(()=>{let le=!0;return x(null),v(null),T(void 0),e.getAgent(t).then(ye=>{le&&x(ye.agent)},ye=>{le&&v({cause:ye})}),e.statsOver({from:ng(D1),agent:t}).then(ye=>{le&&T(ye)},()=>{le&&T(null)}),()=>{le=!1}},[e,t,w]);const E=Qu(b),R=y.useRef(0),[C,O]=y.useState(!1),z=()=>{const le=++R.current;e.getAgent(t).then(ye=>{le===R.current&&(x(ee=>ee&&ee.agent_id===ye.agent.agent_id?ye.agent:ee),O(!1))},()=>{le===R.current&&O(!0)})},F=le=>{x(ye=>({...le,tools:(ye==null?void 0:ye.tools)??le.tools})),z()},D=z,B=S===void 0?void 0:S!==null;if(m)return m.cause instanceof Ee&&m.cause.status===404?s.jsx(pj,{what:"agent",id:t,list:{href:"#/agents",label:"Open the agents list"}}):s.jsx($n,{problem:mn(m.cause,"the agent"),onRetry:()=>j(le=>le+1)});if(!b)return s.jsx(JO,{});const U=b.definition,W=b.kind==="workflow",X=W?Go:yh,M=Yj(U.harness??"pi",o),K=U.model?eh(U.model,n):M?(({text:le,title:ye})=>({text:`${le} (default)`,title:ye}))(eh(M,n)):{text:jM},L=W||o==null?void 0:o.find(le=>le.id===(U.harness??"pi")&&le.available===!1),I=L?`${L.id} doesn't run on this server${L.reason?`: ${L.reason}`:"."}`:void 0,G=Fj(b,h),P=`${F5(G==null?void 0:G.place)}${G!=null&&G.byDefault?" (server default)":""}`,q=[...W?[]:[["Harness",U.harness??"pi"],["Model",K.text,K.title],["Thinking",U.thinking??"default"],["Runs",P]],["Revision",`rev ${U.version} of ${b.revisions}`]],ne=EM.filter(le=>le.shows(b,{analytics:B===!0,learning:f===void 0?c==="learning"?void 0:!1:!!f})),ae=ne.find(le=>le.id===c)??ne[0],ie=c==="analytics"&&B===void 0;return s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsxs("header",{className:"border-b px-5 py-4 max-sm:py-3 md:px-8",children:[s.jsxs("div",{"data-phone-row":!0,className:"flex flex-col gap-3 max-sm:flex-row max-sm:items-center",children:[s.jsxs("button",{type:"button",onClick:()=>l(b.archived_at?"#/agents?archived=true":"#/agents"),className:"caps flex items-center gap-2 self-start text-label text-muted-foreground hover:text-foreground max-sm:-m-1 max-sm:self-center max-sm:p-1",children:[s.jsx(Ds,{className:"size-3.5","aria-hidden":!0})," ",s.jsx("span",{className:"max-sm:sr-only",children:"Agents"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 max-sm:min-w-0 max-sm:flex-1 max-sm:flex-nowrap max-sm:gap-2",children:[s.jsx(X,{className:"size-5 shrink-0 text-muted-foreground max-sm:hidden","aria-hidden":!0}),s.jsx("h1",{className:"min-w-0 truncate font-mono text-xl font-semibold max-sm:text-lg",children:U.name}),s.jsx(Me,{children:b.kind}),b.archived_at&&s.jsx(Me,{tone:"muted",children:"Archived"}),U.approvals==="never"&&s.jsx(Me,{tone:"warning",title:"Never ask: a call of this agent never waits for you. A tool set to deny, and a template's pins, still hold.",children:"Unattended"}),s.jsx("span",{className:"flex-1"}),s.jsxs(Z,{size:"sm",onClick:()=>l(zs(b.agent_id,"edit")),title:"Edit",className:"max-sm:w-8 max-sm:shrink-0 max-sm:px-0",children:[s.jsx(Ml,{"aria-hidden":!0})," ",s.jsx("span",{className:"max-sm:sr-only",children:"Edit"})]}),s.jsx(lg,{context:{kind:"edit",agentId:b.agent_id,revision:b.revision},label:"Edit with your coding agent",iconOnPhone:!0})]})]}),U.description&&s.jsx("p",{id:"agent-description",className:oe("mt-2 max-w-3xl text-lead text-muted-foreground",!$&&"max-sm:line-clamp-2"),children:U.description}),s.jsxs("button",{type:"button","aria-expanded":$,"aria-controls":U.description?"agent-description agent-facts":"agent-facts",onClick:()=>_(le=>!le),className:"mt-1.5 flex w-full min-w-0 items-center gap-1.5 text-left font-mono text-small text-muted-foreground sm:hidden",children:[s.jsx(Us,{className:oe("size-3.5 shrink-0 transition-transform",$&&"rotate-90"),"aria-hidden":!0}),s.jsx("span",{className:"truncate",children:q.map(([,le])=>le).join(" · ")})]}),s.jsxs("dl",{id:"agent-facts",className:oe("mt-3 flex flex-wrap gap-x-6 gap-y-2",!$&&"max-sm:hidden"),"aria-label":"Current revision",children:[q.map(([le,ye,ee])=>s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:le}),s.jsx("dd",{className:"font-mono text-small",title:ee,children:ye})]},le)),!W&&s.jsxs("div",{className:"flex items-baseline gap-2",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:"Tools"}),s.jsx("dd",{className:"font-mono text-small",children:(ce=b.tools)!=null&&ce.length?s.jsx("ul",{className:"flex flex-wrap gap-x-4 gap-y-1","aria-label":"Tools",children:b.tools.map(le=>s.jsxs("li",{children:[s.jsx("span",{title:le.blurb,children:le.name}),le.provider?` · ${sd(le.provider,le.name)}`:"",le.permission?` · ${le.permission}`:"",vj(le.resolved,le.name).unavailable&&s.jsx("span",{"data-unavailable":!0,className:"text-warning-text",title:le.resolved,children:" · unavailable"})]},le.name))}):"none"})]})]}),C&&s.jsxs("p",{role:"alert",className:"mt-3 flex items-center gap-3 text-body text-warning-text",children:["Couldn't refresh this agent.",s.jsx(Z,{size:"sm",variant:"outline",onClick:z,children:"Retry"})]}),I&&s.jsx("p",{className:"mt-3 font-mono text-small text-warning-text",role:"status","aria-label":"Harness not available",children:I})]}),!b.archived_at&&s.jsx(YO,{agent:b,efforts:i,v2:e,go:l,blocked:I,limits:u}),s.jsx(F1,{tabs:ne.map(le=>le.id==="learning"?{...le,label:s.jsxs(s.Fragment,{children:[le.label,s.jsx(CA,{n:E,className:"ml-1.5"})]})}:le),value:ae.id,onChange:le=>l(zs(b.agent_id,le))}),s.jsx("div",{role:"tabpanel","aria-label":ie?void 0:ae.label,className:"min-h-0 flex-1 overflow-auto px-5 py-6 md:px-8",children:ie?s.jsx(_s,{label:"Loading the tab",rows:4}):s.jsx(ae.Body,{agent:b,v2:e,go:l,stats:S,focus:p,learning:f,onAgent:F,onChanged:D,places:h})})]})}function CM({agent:e,v2:t}){const[n,o]=y.useState(null),[i,l]=y.useState(null),[c,u]=y.useState(!1),[f,p]=y.useState(null),h=y.useRef(0),b=x=>{const m=++h.current;p(null),x&&u(!0),t.listAgentRuns(e.agent_id,50,x,!!e.archived_at).then(v=>{m===h.current&&(o(w=>x?Nj(w??[],v.runs):v.runs),l(v.next_cursor))}).catch(v=>{m===h.current&&p(mn(v,x?"more runs":"the runs"))}).finally(()=>{m===h.current&&u(!1)})};return y.useEffect(()=>{b(null)},[t,e.agent_id]),f&&!n?s.jsx($n,{problem:f,onRetry:()=>b(null),className:""}):n?n.length?s.jsxs(s.Fragment,{children:[s.jsx(TO,{v2:t,run:n[0],onRun:x=>o(m=>m&&m.map(v=>v.run_id===x.run_id?x:v))},n[0].run_id),s.jsxs("p",{className:"mb-3 font-mono text-small text-muted-foreground",children:[n.length,i?"+":""," ",n.length===1&&!i?"run":"runs"]}),s.jsx("ul",{className:"border","aria-label":"Runs",children:n.map(x=>s.jsx("li",{className:"border-b last:border-b-0",children:s.jsxs("a",{href:`#/runs/${encodeURIComponent(x.run_id)}`,className:"flex flex-wrap items-center gap-x-4 gap-y-1 px-4 py-3 hover:bg-accent",children:[s.jsx(Kl,{run:x}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-lead",title:rn(x),children:rn(x)}),s.jsx(Ud,{run:x}),x.effort&&s.jsxs(Me,{children:["effort ",x.effort]}),s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:St(x.created_at)}),x.ended_at&&s.jsx("span",{className:"font-mono text-small text-muted-foreground",title:"How long it ran",children:qa(Date.parse(x.ended_at)-Date.parse(x.created_at))}),x.cost&&(x.cost.usd!==null||ni(x.cost))&&s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:oo(x.cost,{ended:kl(x.status)})})]})},x.run_id))}),f&&s.jsx($n,{problem:f,className:"mt-4"}),i&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(Z,{type:"button",size:"sm",onClick:()=>b(i),disabled:c,children:c?"Loading":"Load more"})})]}):s.jsxs("div",{className:"border px-4 py-12 text-center",children:[s.jsx("p",{className:"font-mono text-body text-muted-foreground",children:"No runs of this agent yet."}),!e.archived_at&&s.jsx("p",{className:"mt-2 text-body text-muted-foreground",children:"Start one above: its timeline shows here as the agent works."})]}):s.jsx(_s,{label:"Loading the runs",rows:5})}function RM({agent:e,go:t}){const n=e.definition.workflow,o=y.useMemo(()=>fl(n),[n]),i=y.useMemo(()=>({meta:zd(n,o)}),[n,o]);return s.jsxs("section",{className:"border",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b px-4 py-2",children:[s.jsx("span",{className:"caps text-label font-semibold",children:"Graph"}),s.jsxs("span",{className:"font-mono text-label text-muted-foreground",children:[wg(Pj(o))," · rev ",e.definition.version]}),s.jsx("span",{className:"flex-1"}),s.jsxs(Z,{size:"sm",onClick:()=>t(zs(e.agent_id,"edit")),children:[s.jsx(Ml,{"aria-hidden":!0})," Edit the workflow"]})]}),s.jsx("div",{className:"min-h-[360px] overflow-auto bg-[radial-gradient(hsl(var(--border))_1px,transparent_1px)] [background-size:22px_22px] px-4 py-5",children:o.nodes.length?s.jsx(qd,{graph:o,marks:i,label:"The workflow's graph",minScale:.55}):s.jsx("p",{className:"p-6 text-center font-mono text-body text-muted-foreground",children:"This revision's workflow has no root node to draw."})}),s.jsx("div",{className:"border-t px-4 py-2",children:s.jsx(Vd,{})})]})}const AM=140,OM=32,MM=40,PM=60;function Zj({value:e,name:t,note:n,blurb:o,description:i,tag:l,why:c,alert:u,on:f,disabled:p,warn:h,onToggle:b}){const[x,m]=y.useState(!1),v=y.useRef(null),w=y.useRef(null),j=y.useRef(null),S=y.useRef(null),T=xu(v,"width",x,t),$=xu(w,"height",x,i),_=xu(j,"width",x,l),E=xu(S,"width",x,u),R=T??t.length>OM,C=!!i&&($??i.length>AM),O=!!l&&(_??l.length>MM),z=!!u&&(E??u.length>PM),F=!!c&&(c!==l||O),D=!!i&&(!!o||C)||F||z||R,B=(W,X)=>!x&&W&&X?W:void 0,U=W=>{W.preventDefault(),W.stopPropagation(),m(X=>!X)};return s.jsxs("label",{"data-tool-card":e,className:oe("flex w-full min-w-0 flex-col border px-3 py-2.5 font-mono text-body",x?"min-h-36":"h-36 overflow-hidden",f&&"border-foreground",h&&"border-warning/60",p?"cursor-not-allowed opacity-60":"cursor-pointer"),children:[s.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[s.jsx("input",{type:"checkbox",value:e,checked:f,disabled:p,onChange:b,className:"shrink-0 accent-primary"}),s.jsx("span",{ref:v,title:B(t,R),className:oe("min-w-0",x?"[overflow-wrap:anywhere]":"truncate"),children:t}),n&&s.jsx("span",{className:"shrink-0 font-sans text-label text-muted-foreground",children:n})]}),o?s.jsx("span",{"data-line":!0,className:"mt-1 truncate font-sans text-small text-muted-foreground",children:o}):i&&!x?s.jsx("span",{ref:w,"data-line":!0,className:"mt-1 line-clamp-3 font-sans text-label text-muted-foreground [overflow-wrap:anywhere]",title:B(i,C),children:i}):null,l&&s.jsx("span",{ref:j,"data-tag":!0,title:B(c,F),className:"mt-1 max-w-full self-start truncate border px-1.5 text-micro text-muted-foreground",children:l}),u&&!x&&s.jsx("span",{ref:S,className:"mt-1 truncate font-sans text-label text-warning-text",role:"alert",title:B(u,z),children:u}),x&&s.jsxs("span",{"data-more":!0,className:"mt-2 min-w-0 space-y-1 font-sans text-label text-muted-foreground",children:[i&&s.jsx("span",{className:"block whitespace-pre-wrap [overflow-wrap:anywhere]",children:i}),c&&c!==i&&s.jsx("span",{className:"block [overflow-wrap:anywhere]",children:c}),u&&s.jsx("span",{className:"block text-warning-text [overflow-wrap:anywhere]",role:"alert",children:u})]}),D&&s.jsx("button",{type:"button",onClick:U,"aria-expanded":x,className:"mt-auto self-start pt-1 font-sans text-label underline underline-offset-2 hover:text-foreground",children:x?"Less":"More"})]})}function xu(e,t,n,o){const[i,l]=y.useState(null);return y.useLayoutEffect(()=>{const c=e.current;if(n||!c)return;const u=()=>{(t==="width"?c.clientWidth>0:c.clientHeight>0)&&l(t==="width"?c.scrollWidth>c.clientWidth+1:c.scrollHeight>c.clientHeight+1)};u();const f=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return f==null||f.observe(c),()=>f==null?void 0:f.disconnect()},[e,t,n,o]),i}function LM({servers:e,tools:t,harness:n,harnesses:o,onChange:i,onRetry:l}){const c=m=>i(t.includes(m)?t.filter(v=>v!==m):[...t,m]),u=t.filter(m=>nd(m)),f=!o||o.includes(n),p=(m,v,w,j,S,T)=>{const $=t.includes(m),_=(!f||!!S)&&!$,E=j??S??($&&!f?`Won't run on ${n}.`:void 0);return s.jsx("li",{className:"min-w-0",children:s.jsx(Zj,{value:m,name:v,note:T,description:w,alert:E,on:$,disabled:_,warn:!!j,onToggle:()=>c(m)})},m)},h=m=>s.jsx("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(min(100%,18rem),1fr))] items-start gap-2",children:m}),b=!f&&s.jsxs("p",{className:"text-small text-warning-text",children:[n," doesn't run MCP tools on this server",o!=null&&o.length?`: ${o.join(" and ")} do`:"","."]});if(e==="failed")return s.jsxs("div",{className:"mt-4 space-y-2",children:[s.jsxs("p",{className:"font-mono text-small text-warning-text",role:"alert",children:["The MCP servers could not be read."," ",l&&s.jsx(Z,{type:"button",onClick:l,size:"xs",className:"ml-1",children:"Retry"})]}),u.length>0&&h(u.map(m=>p(m,m,"Can't check right now whether its server still lists it.")))]});if(!e)return u.length?s.jsx("p",{className:"mt-3 font-mono text-small text-muted-foreground",children:"Reading the MCP servers..."}):null;const x=gO(t,e);return!e.length&&!x.length?s.jsx("p",{className:"mt-3 text-small text-muted-foreground",children:"No MCP server is saved: add one in Settings → MCP servers to grant its tools."}):s.jsxs("div",{className:"mt-4 space-y-4",children:[b,e.map(m=>s.jsxs("section",{"aria-label":`MCP server ${m.name}`,children:[s.jsxs("p",{className:"caps mb-2 text-label font-semibold text-muted-foreground",children:[m.name," · MCP server"]}),h(m.tools.map(v=>{var w;return p(fO(m.name,v.name),v.name,[v.title,v.description].filter(Boolean).join(": ")||void 0,void 0,hO(m.name,v,n)??(v.permission==="deny"?gg:void 0),(w=m.not_metered)!=null&&w.includes(v.name)?"not metered":void 0)}))]},m.name)),x.length>0&&s.jsxs("section",{"aria-label":"MCP grants that can't run",children:[s.jsx("p",{className:"caps mb-2 text-label font-semibold text-warning-text",children:"Granted, but not on a saved server"}),h(x.map(m=>p(m.grant,m.grant,void 0,m.why)))]})]})}const IM=e=>e.offered&&(e.kind==="none"||e.providers.some(t=>t.ready)),zM=e=>{var t;return e.why??((t=e.providers.find(n=>!n.ready))==null?void 0:t.why)};function DM(e,t){var i;if(e.kind==="none")return{kind:"none"};const o=((t==null?void 0:t.kind)===e.kind&&e.providers.some(l=>l.ready&&l.id===t.provider)?t.provider:void 0)??((i=e.providers.find(l=>l.ready))==null?void 0:i.id);return o?{kind:e.kind,provider:o}:{kind:e.kind}}const FM=e=>e.kind==="sandbox"&&e.provider?{mode:"sandbox",box:e.provider}:{mode:"runner"},_g="This provider bills by the minute through your own vendor account, and those minutes aren't counted in a run's spending cap.",$g=new Set(["sandbox","desktop","phone"]),UM=e=>e.charAt(0).toUpperCase()+e.slice(1);function WM({kinds:e,value:t,onChange:n,error:o,warning:i}){const l=e.find(c=>c.kind===t.kind);return s.jsxs("div",{children:[s.jsx("div",{className:"mb-2 caps text-small font-semibold",children:"Kind"}),s.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-5",role:"radiogroup","aria-label":"Kind",children:e.map(c=>{const u=IM(c),f=u?void 0:zM(c),p=c.providers.filter(h=>h.ready).map(h=>h.name).join(", ");return s.jsxs("div",{"data-kind":c.kind,className:oe("border px-4 py-3",t.kind===c.kind?"border-foreground":"border-border",!u&&"opacity-60"),children:[s.jsxs("label",{className:oe("flex items-start gap-3",u?"cursor-pointer":"cursor-not-allowed"),children:[s.jsx("input",{type:"radio",name:"computer-kind",value:c.kind,checked:t.kind===c.kind,disabled:!u&&t.kind!==c.kind,onChange:()=>n(DM(c,t)),className:"mt-1 accent-primary"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block text-lead font-semibold",children:UM(c.kind)}),s.jsx("span",{className:"mt-0.5 block text-small text-muted-foreground",children:u?c.kind==="none"?"The run's folder only":p:"Not available here"})]})]}),f&&s.jsxs("p",{className:"mt-2 break-words text-small text-muted-foreground",children:[f," ",s.jsx("a",{href:"#/settings/computers",className:"underline underline-offset-2 hover:text-foreground",children:"Computers settings"})]})]},c.kind)})}),l&&l.kind!=="none"&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"mb-2 mt-5 caps text-small font-semibold",children:"Provider"}),s.jsx("ul",{className:"border",role:"radiogroup","aria-label":"Provider",children:l.providers.map(c=>s.jsx("li",{className:"border-b last:border-b-0",children:s.jsxs("label",{className:oe("flex items-start gap-3 px-4 py-2.5",c.ready?"cursor-pointer":"cursor-not-allowed text-muted-foreground"),children:[s.jsx("input",{type:"radio",name:"computer-provider",value:c.id,checked:t.provider===c.id,disabled:!c.ready&&t.provider!==c.id,onChange:()=>n({kind:l.kind,provider:c.id}),className:"mt-1 accent-primary"}),s.jsxs("span",{className:"min-w-0",children:[s.jsxs("span",{className:"flex flex-wrap items-baseline gap-2",children:[s.jsx("span",{className:"text-body font-semibold",children:c.name}),c.metered&&s.jsx("span",{className:"caps text-label text-muted-foreground",children:"Metered"})]}),c.metered&&$g.has(l.kind)&&s.jsx("span",{className:"mt-0.5 block text-small text-muted-foreground",children:_g}),!c.ready&&c.why&&s.jsx("span",{className:"mt-0.5 block text-small",children:c.why})]})]})},c.id))})]}),l&&l.tools.length>0&&s.jsxs("p",{className:"mt-4 border bg-muted/40 px-4 py-2.5 text-small","aria-label":"The loop gets",children:[s.jsx("span",{className:"caps mr-2",children:"The loop gets"}),s.jsx("span",{className:"font-mono",children:l.tools.join(", ")})]}),o&&s.jsx("p",{className:"mt-2 font-mono text-small text-destructive-text",role:"alert",children:o}),i&&s.jsx("p",{className:"mt-2 font-mono text-small text-warning-text",children:i})]})}function HM({value:e,saved:t,places:n,tools:o,picked:i,onChange:l,error:c,warning:u}){var _;const f=e??Kd(t),p=(f??Sg(!1,i,n)).mode,h=(_=n.boxes.find(E=>E.available))==null?void 0:_.id,b=(f==null?void 0:f.mode)==="sandbox"?f.box:h,x=!h&&p!=="sandbox",m=new Set(o.filter(E=>E.sandbox_only).map(E=>E.name)),[v,w]=y.useState([]),j=()=>{const E=i.filter(R=>m.has(R));w(E),l({place:{mode:"runner"},...E.length?{tools:i.filter(R=>!m.has(R))}:{}})},S=E=>{w([]),E&&l({place:{mode:"sandbox",box:E}})},T=E=>E.map(R=>R.charAt(0).toUpperCase()+R.slice(1)).join(" and "),$=(E,R,C,O,z=!1)=>s.jsxs("label",{className:oe("flex items-start gap-3 border px-4 py-3",p===E?"border-foreground":"border-border",z?"cursor-not-allowed opacity-60":"cursor-pointer"),children:[s.jsx("input",{type:"radio",name:"place",value:E,checked:p===E,disabled:z,onChange:O,className:"mt-1 accent-primary"}),s.jsxs("span",{children:[s.jsx("span",{className:"block text-lead font-semibold",children:R}),s.jsx("span",{className:"mt-0.5 block text-small text-muted-foreground",children:C})]})]});return s.jsxs("div",{children:[s.jsx("div",{className:"mb-2 caps text-small font-semibold",children:"Where it runs"}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",role:"radiogroup","aria-label":"Where it runs",children:[$("runner","On the server","No box and no shell: its files stay in the run's folder on the server.",j),$("sandbox","In a sandbox","Its file and shell tools run in a box; its keys stay on the server.",()=>S(b),x)]}),x&&s.jsxs("div",{className:"mt-3 border px-4 py-3 text-small text-muted-foreground",role:"status",children:[s.jsx("p",{children:"No box is set up on this server, so this agent runs on the server."}),s.jsx("ul",{className:"mt-1",children:n.boxes.map(E=>s.jsxs("li",{children:[s.jsx("span",{className:"font-mono",children:E.id}),E.reason?`: ${E.reason}`:""]},E.id))})]}),p==="sandbox"&&s.jsx("ul",{className:"mt-3 border","aria-label":"Box",children:n.boxes.map(E=>s.jsx("li",{className:"border-b last:border-b-0",children:s.jsxs("label",{className:oe("flex items-start gap-3 px-4 py-2.5",E.available?"cursor-pointer":"cursor-not-allowed text-muted-foreground"),children:[s.jsx("input",{type:"radio",name:"box",value:E.id,checked:b===E.id,disabled:!E.available&&b!==E.id,onChange:()=>S(E.id),className:"mt-1 accent-primary"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block font-mono text-body",children:E.id}),!E.available&&E.reason&&s.jsx("span",{className:"mt-0.5 block text-small",children:E.reason})]})]})},E.id))}),p==="runner"&&v.length>0&&s.jsxs("p",{className:"mt-2 text-small text-muted-foreground",role:"status",children:[T(v)," ",v.length===1?"runs":"run"," only in a sandbox, so ",v.length===1?"it's":"they're"," turned off for this agent."]}),c&&s.jsx("p",{className:"mt-2 font-mono text-small text-destructive-text",role:"alert",children:c}),u&&s.jsx("p",{className:"mt-2 font-mono text-small text-warning-text",children:u})]})}function Jj(e,t,n=t.map(o=>o.name)){return[...new Set([...n.filter(i=>e.some(l=>l.name===i)||t.some(l=>l.name===i)),...t.map(i=>i.name),...e.map(i=>i.name)])].map(i=>{const l=e.find(u=>u.name===i),c=t.find(u=>u.name===i);return{name:i,...l?{choice:l}:{},...c?{gate:c}:{}}})}function nh({setting:e,label:t="Pinned",also:n=!1}){return e!=null&&e.pin_broken?s.jsx("p",{className:"max-w-[640px] text-small text-warning-text",role:"note",children:GO}):e!=null&&e.pin?s.jsxs("p",{className:"max-w-[640px] text-small text-muted-foreground",role:"note",children:[s.jsxs("span",{className:"text-foreground",children:[t,":"]})," ",HO(e.pin),". ",BO,n?" This server pins it too; both hold.":""]}):null}const BM="Ask is off on this server: approving a call takes the owner's password sign-in, and this server runs with accounts off.";function eN({label:e,rows:t,settings:n,fallbackOf:o,permissionFallbackOf:i=m=>m.default_permission,resolvesOf:l,issues:c,busy:u=!1,refused:f=()=>!1,locked:p=!1,unattended:h=!1,noteOf:b,onEdit:x}){const m=t.some(T=>T.choice),v=t.some(T=>T.gate),w=t.some(T=>{var $;return(($=T.gate)==null?void 0:$.ask_needs)==="password"}),j=["Tool",...v?["Permission"]:[],...m?["Provider","Resolves to"]:[]],S=s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:"—"});return s.jsxs(s.Fragment,{children:[w&&s.jsx("p",{className:"mb-2 text-small text-warning-text",children:BM}),s.jsx("div",{className:"relative overflow-x-auto",children:s.jsxs("table",{"aria-label":e,className:"w-full border text-left",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b",children:[j.map(T=>s.jsx("th",{className:"caps px-3 py-2 text-label font-semibold text-muted-foreground",children:T},T)),s.jsx("th",{children:s.jsx("span",{className:"sr-only",children:"Reset"})})]})}),s.jsx("tbody",{children:t.map(({name:T,choice:$,gate:_})=>{var K,L,I;const E=$?o($):"",R=(K=n[T])==null?void 0:K.provider,C=$!==void 0&&R!==void 0&&R!==E,O=C?R:E,z=G=>x(P=>DO(P,T,G,E)),F=_?i(_):"allow",D=(L=n[T])==null?void 0:L.permission,B=_!==void 0&&D!==void 0&&D!==F,U=B?D:F,W=_!==void 0&&f(T,U),X=W&&p,M=X?"deny":U;return s.jsxs(y.Fragment,{children:[s.jsxs("tr",{"data-tool":T,"data-set":C||B?"":void 0,className:"border-b align-top last:border-b-0",children:[s.jsx("td",{className:"px-3 py-2.5 font-mono text-body",children:T}),v&&s.jsx("td",{className:"px-3 py-2",children:_?s.jsxs(s.Fragment,{children:[s.jsx(Kt,{small:!0,label:`${T} permission`,value:M,disabled:u||X,onChange:G=>{const P=G;x(q=>FO(q,T,P,F))},className:oe("w-36",B&&"border-primary text-primary"),options:_.permissions.map(G=>({value:G,label:`${G}${G===F?" (default)":""}`,...G==="ask"&&_.ask_needs==="password"&&!h?{disabled:!0,title:"No one can approve a call here: it takes the owner's password sign-in."}:{}}))}),B&&!X&&s.jsxs("span",{className:"mt-1 block font-mono text-label text-muted-foreground",children:["default: ",F]}),W&&s.jsx("span",{className:"mt-1 block max-w-[260px] text-label text-warning-text",children:gg}),M==="deny"&&s.jsx("span",{className:"mt-1 block max-w-[260px] text-label text-muted-foreground",children:PO}),M==="ask"&&h&&!W&&s.jsx("span",{className:"mt-1 block max-w-[220px] text-label text-warning-text",children:"Runs without asking: Never ask is on."}),M==="ask"&&_.ask_needs==="password"&&!h&&s.jsx("span",{className:"mt-1 block max-w-[220px] text-label text-warning-text",children:"Each call is refused: no one can approve it here."})]}):S}),m&&s.jsx("td",{className:"px-3 py-2",children:$?s.jsxs(s.Fragment,{children:[s.jsx(Kt,{small:!0,label:`${T} provider`,value:O,disabled:u,onChange:G=>z(G),className:oe("w-56 max-w-full",C&&"border-primary text-primary"),options:$.providers.map(G=>({value:G,label:`${sd(G,T)}${G===E?" (default)":""}`}))}),Zb(O,T)&&s.jsx("span",{className:"mt-1 block max-w-[300px] text-label text-muted-foreground",children:Zb(O,T)}),C&&s.jsxs("span",{className:"mt-1 block font-mono text-label text-muted-foreground",children:["default: ",sd(E,T)]})]}):S}),m&&s.jsx("td",{className:"px-3 py-2.5",children:$?l($,O):S}),s.jsx("td",{className:"px-2 py-2 text-right",children:C&&s.jsx(Z,{size:"sm",variant:"ghost",disabled:u,"aria-label":`Reset ${T} to its default`,onClick:()=>z(void 0),children:"Reset"})})]}),b!=null&&b(T)?s.jsx("tr",{"data-note":T,children:s.jsx("td",{colSpan:j.length+1,className:"px-3 pb-2.5",children:b(T)})}):null,(I=c[T])!=null&&I.length?s.jsx("tr",{children:s.jsx("td",{colSpan:j.length+1,className:"px-3 pb-2.5",children:c[T].map(G=>s.jsx("p",{className:"font-mono text-small text-destructive-text",role:"alert",children:G},G))})}):null]},T)})})]})})]})}function sh({value:e,prefix:t,tool:n}){const o=vj(e,n);return s.jsxs("span",{className:oe("block font-mono text-small",o.unavailable?"text-warning-text":"text-muted-foreground"),children:[t,o.text]})}const GM=({choice:e,harnesses:t=[]})=>s.jsx(s.Fragment,{children:RO.map(n=>{const o=t.find(i=>i.id===n&&!i.available);return o?s.jsxs("span",{title:o.reason,className:"block font-mono text-small text-muted-foreground opacity-60",children:[n,": not offered here"]},n):s.jsx(sh,{value:e.resolves[n],prefix:`${n}: `,tool:e.name},n)})});function qM({agent:e,harness:t,model:n,tools:o,choices:i,gates:l=[],mcpServers:c,serverSettings:u,focus:f,callTools:p,value:h,issues:b,unattended:x=!1,onChange:m}){const v=new Set(o),w=i.filter(D=>v.has(D.name)||!D.available),j=l.some(D=>D.ask_needs==="password"),S=D=>{var B;return(B=e==null?void 0:e.tools)==null?void 0:B.find(U=>U.name===D)},T=D=>{var U;const B=nd(D);return B?(U=c==null?void 0:c.find(W=>W.name===B.server))==null?void 0:U.tools.find(W=>W.name===B.tool):void 0},$=D=>{var U;const B=nd(D);return B?(U=h[`mcp:${B.server}/*`])==null?void 0:U.permission:void 0},_=p?p.flatMap(D=>l.filter(B=>B.name===D)):[...new Set(o)].flatMap(D=>{var W;const B=l.find(X=>X.name===D);if(B)return[B];const U=S(D)??T(D);return!((W=U==null?void 0:U.permissions)!=null&&W.length)||!U.default_permission?[]:[{name:D,permission:U.permission??U.default_permission,default_permission:U.default_permission,permissions:U.permissions,...j&&U.permissions.includes("ask")?{ask_needs:"password"}:{}}]}),E=Jj(w,_,[...l.map(D=>D.name),...i.map(D=>D.name)]),R=y.useRef(null);if(y.useEffect(()=>{var U,W;if(!f)return;const D=`${f} permission`,B=[...((U=R.current)==null?void 0:U.querySelectorAll('button[aria-haspopup="listbox"]'))??[]].find(X=>X.getAttribute("aria-label")===D);(W=B==null?void 0:B.scrollIntoView)==null||W.call(B,{block:"center"}),B==null||B.focus()},[]),!E.length)return null;const C=(e==null?void 0:e.definition.tool_settings)??{},O=x!==(((e==null?void 0:e.definition.approvals)??"ask")==="never"),{byTool:z,rest:F}=wj(b,"definition.tool_settings",E.map(D=>D.name));return s.jsxs("section",{"aria-label":"Tool settings",ref:R,children:[s.jsx("div",{className:"mb-2",children:s.jsx("span",{className:"caps text-small font-semibold",children:"Tool settings"})}),s.jsxs("p",{className:"-mt-1 mb-2 text-small text-muted-foreground",children:["Each of these tools takes this server's setting (its default here) unless it is changed here. ",p?"A call node can't wait for an approval: a tool set to ask stops the run from starting. Set it to allow.":x?"Never ask is on: a tool on ask runs without waiting for you. A tool set to deny still holds.":"A tool on ask makes the run wait for your approval at each call."]}),s.jsx(eN,{label:"This agent's tool settings",unattended:x,rows:E,settings:h,fallbackOf:D=>D.provider,issues:z,onEdit:D=>m(D(h)),noteOf:D=>{const B=h[D],U=u==null?void 0:u[D],W=!!(B!=null&&B.pin||B!=null&&B.pin_broken);return!W&&!(U!=null&&U.pin)&&!(U!=null&&U.pin_broken)?null:s.jsxs(s.Fragment,{children:[W&&s.jsx(nh,{setting:B,label:"Pinned for this agent",also:!!(U!=null&&U.pin)}),(!W||(U==null?void 0:U.pin_broken))&&s.jsx(nh,{setting:U,label:"Pinned on this server"})]})},refused:D=>xj(D,l,e==null?void 0:e.tools,c),locked:!0,permissionFallbackOf:D=>{var B;return $(D.name)??((B=S(D.name))==null?void 0:B.default_permission)??D.permission},resolvesOf:D=>{var M,K,L,I,G,P;const B=(((M=h[D.name])==null?void 0:M.provider)??null)!==(((K=C[D.name])==null?void 0:K.provider)??null)||(((L=h[D.name])==null?void 0:L.permission)??null)!==(((I=C[D.name])==null?void 0:I.permission)??null)||O,U=(G=e==null?void 0:e.tools)==null?void 0:G.find(q=>q.name===D.name),W=U&&U.provider===(((P=h[D.name])==null?void 0:P.provider)??D.provider)?U.resolved:void 0,X=(n??"")===((e==null?void 0:e.definition.model)??"");return!B&&t===((e==null?void 0:e.definition.harness)??"pi")&&X&&W?s.jsx(sh,{value:W,prefix:`${t}: `,tool:D.name}):!B&&!C[D.name]&&!n?s.jsx(sh,{value:D.resolves[t],prefix:`${t}: `,tool:D.name}):s.jsx("span",{className:"block font-mono text-small text-muted-foreground",children:"once saved"})}}),F.map(D=>s.jsx("p",{className:"mt-2 font-mono text-small text-destructive-text",role:"alert",children:D},D))]})}const yu=20,VM=400;function KM(e,t,n,o,i){const[l,c]=y.useState(null),[u,f]=y.useState(0),p=(o??[]).join(",");y.useEffect(()=>{if(!i||!n||l==="unsupported")return;const b=new AbortController,x=setTimeout(()=>{i({workflow:t,...o?{tools:o}:{}},b.signal).then(m=>{b.signal.aborted||c({text:e,check:m})},m=>{b.signal.aborted||((m==null?void 0:m.status)===404||(m==null?void 0:m.status)===405?c("unsupported"):c({text:e,failed:(m==null?void 0:m.message)||`the server answered ${(m==null?void 0:m.status)??"nothing"}`}))})},VM);return()=>{clearTimeout(x),b.abort()}},[e,n,p,i,u]);const h=()=>{c(null),f(b=>b+1)};return l==="unsupported"||!i?{mode:"lint",retry:h}:l&&l.text===e?"failed"in l?{mode:"failed",failed:l.failed,retry:h}:{mode:"server",check:l.check,retry:h}:{mode:"pending",retry:h}}function yw({text:e,onText:t,base:n,baseLabel:o,serverIssues:i,readOnly:l=!1,validate:c,tools:u}){var X;const f=y.useRef(null),p=y.useRef(null),[h,b]=y.useState(0),x=y.useMemo(()=>h4(e),[e]),m=y.useRef(null);x.ok&&(m.current={value:x.value,spans:x.spans});const v=(X=m.current)==null?void 0:X.value,w=y.useMemo(()=>fl(v),[v]),j=y.useMemo(()=>n===void 0?null:fl(n),[n]),S=y.useMemo(()=>j?X2(j,w):null,[j,w]),T=KM(e,x.ok?x.value:void 0,x.ok,u,l?void 0:c),$=y.useMemo(()=>x.ok&&!l?v4(x.value):[],[x,l]),_=y.useMemo(()=>T.mode!=="server"?$:[...T.check.issues.map(M=>({path:M.path,message:M.message,severity:"error"})),...T.check.warnings.map(M=>typeof M=="string"?{path:"",message:M,severity:"warning"}:{path:M.path??"",message:M.message,severity:"warning"})],[T.mode,T.mode==="server"?T.check:null,$]),E=x.ok?b4(x.spans,w.nodes.map(M=>M.path),h):null,R=y.useMemo(()=>({meta:zd(v,w),diff:S?{added:S.added.map(M=>M.path),edited:[...S.changed,...S.rewritten].map(M=>M.next),moved:S.moved.map(M=>M.next),removed:S.removed.map(({label:M,kind:K})=>({label:M,kind:K}))}:void 0,selected:E?{path:E}:null}),[v,w,S,E]),C=e.split(`
|
|
538
|
-
`).length,O=M=>g4(e,M),z=[];x.ok||z.push({...O(x.error.offset),message:`JSON: ${x.error.message}`,severity:"error",offset:x.error.offset});for(const M of _){const K=x.ok?Ab(x.spans,M.path):void 0,L=(K==null?void 0:K.start)??0;z.push({...O(L),message:M.message,severity:M.severity,offset:L,path:M.path})}for(const M of[...i??[]].reverse()){const K=M.path&&x.ok?Ab(x.spans,M.path):void 0;z.unshift({...K?O(K.start):{line:0,col:0},message:`Server: ${M.message}`,severity:"error",offset:(K==null?void 0:K.start)??-1})}const F=new Map;for(const M of z)M.line&&F.get(M.line)!=="error"&&F.set(M.line,M.severity);const D=(M,K=M)=>{const L=f.current;!L||M<0||(L.focus(),L.setSelectionRange(M,K),L.scrollTop=Math.max(0,(O(M).line-4)*yu),b(M))};y.useEffect(()=>{const M=x.ok?x.spans.get("/root"):void 0;M&&f.current&&(f.current.scrollTop=Math.max(0,(O(M.start).line-2)*yu))},[]);const B=S?S.edges.added.length+S.edges.removed.length:0,U=S?S.added.length+S.changed.length+S.rewritten.length+S.removed.length+S.moved.length+B:0,W=z.filter(M=>M.severity==="error").length;return s.jsxs("div",{className:"grid min-h-0 grid-cols-1 border xl:grid-cols-[minmax(420px,5fr)_7fr]",children:[s.jsxs("div",{className:"flex min-h-0 flex-col border-b xl:border-b-0 xl:border-r",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b px-4 py-2",children:[s.jsx("span",{className:"caps text-label font-semibold",children:"workflow.json"}),s.jsxs("span",{className:"font-mono text-label text-muted-foreground",children:[C," lines"]}),s.jsx("span",{className:"flex-1"}),l?s.jsx("span",{className:"caps text-label text-muted-foreground",children:"Read-only"}):s.jsxs(s.Fragment,{children:[T.mode==="failed"&&x.ok?s.jsxs("span",{className:"font-mono text-label text-warning-text",title:T.failed,children:["server check failed, showing local checks ",s.jsx(Z,{type:"button",onClick:T.retry,size:"xs",className:"ml-1",children:"Retry"})]}):T.mode!=="lint"&&x.ok&&s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:T.mode==="pending"?"checking...":"checked by the server"}),W?s.jsxs("span",{className:"caps inline-flex items-center gap-1 text-label text-destructive-text",children:[s.jsx(Fa,{className:"size-3.5","aria-hidden":!0})," ",W," ",W===1?"problem":"problems"]}):s.jsx("span",{className:"caps text-label text-success-text",children:T.mode==="server"?"Valid":"Valid shape"})]})]}),s.jsxs("div",{className:"relative flex h-[560px] min-h-0 xl:h-[calc(100vh-390px)] xl:min-h-[440px]",children:[s.jsx("div",{ref:p,"aria-hidden":!0,className:"w-12 shrink-0 select-none overflow-hidden border-r bg-card py-3 text-right font-mono text-label text-muted-foreground",style:{lineHeight:`${yu}px`},children:Array.from({length:C},(M,K)=>s.jsx("div",{className:oe("pr-2",F.get(K+1)==="error"&&"bg-destructive/15 text-destructive-text",F.get(K+1)==="warning"&&"bg-warning/15 text-warning-text"),children:K+1},K))}),s.jsx(Ss,{bare:!0,ref:f,value:e,readOnly:l,spellCheck:!1,wrap:"off","aria-label":"Workflow JSON",onChange:M=>{l||t(M.target.value),b(M.target.selectionStart)},onSelect:M=>b(M.target.selectionStart),onScroll:M=>{p.current&&(p.current.scrollTop=M.target.scrollTop)},onKeyDown:M=>{if(M.key!=="Tab"||l)return;M.preventDefault();const K=M.currentTarget,L=K.selectionStart,I=K.selectionEnd;t(`${e.slice(0,L)} ${e.slice(I)}`),requestAnimationFrame(()=>K.setSelectionRange(L+2,L+2))},className:"flex-1 resize-none overflow-auto bg-background px-3 py-3 text-small selection:bg-primary/[0.28] selection:text-foreground focus-visible:outline focus-visible:outline-focus focus-visible:-outline-offset-2 focus-visible:outline-ring",style:{lineHeight:`${yu}px`,tabSize:2}})]}),!l&&s.jsxs("ul",{className:"max-h-48 min-h-[44px] overflow-auto border-t font-mono text-small","aria-label":"Problems",children:[z.length===0&&s.jsx("li",{className:"px-4 py-3 text-muted-foreground",children:T.mode==="server"?"No problems: the server's validator takes this workflow as it is.":"No problems the console can see. The server checks the workflow again when you save."}),z.map((M,K)=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>D(M.offset),className:"flex w-full items-start gap-2.5 border-b px-4 py-2 text-left hover:bg-accent",children:[M.severity==="error"?s.jsx(Fa,{className:"mt-0.5 size-3.5 shrink-0 text-destructive-text","aria-hidden":!0}):s.jsx(er,{className:"mt-0.5 size-3.5 shrink-0 text-warning-text","aria-hidden":!0}),s.jsx("span",{className:"w-16 shrink-0 tabular-nums text-muted-foreground",children:M.line?`L${M.line}:${M.col}`:"—"}),s.jsx("span",{className:"min-w-0 flex-1 break-words",children:M.message})]})},K))]})]}),s.jsxs("div",{className:"flex min-h-0 flex-col",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b px-4 py-2",children:[s.jsx("span",{className:"caps text-label font-semibold",children:"Graph"}),s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:wg(Pj(w))}),S&&(U?s.jsxs("span",{className:"font-mono text-label",children:[[S.added.length&&`${S.added.length} new`,S.changed.length+S.rewritten.length&&`${S.changed.length+S.rewritten.length} edited`,S.removed.length&&`${S.removed.length} removed`,S.moved.length&&`${S.moved.length} moved`,!S.moved.length&&B&&`${B} ${B===1?"connection":"connections"} changed`].filter(Boolean).join(" · ")," ",s.jsxs("span",{className:"text-muted-foreground",children:["against ",o??"the current revision"]})]}):s.jsxs("span",{className:"font-mono text-label text-muted-foreground",children:["Same as ",o??"the current revision"]})),s.jsx("span",{className:"flex-1"}),!x.ok&&m.current&&s.jsx("span",{className:"caps text-label text-warning-text",children:"Showing the last JSON that parsed"})]}),s.jsx("div",{className:oe("min-h-[360px] flex-1 overflow-auto bg-[radial-gradient(hsl(var(--border))_1px,transparent_1px)] [background-size:22px_22px] px-4 py-5 xl:h-[calc(100vh-330px)] xl:min-h-[480px]",!x.ok&&"opacity-60"),children:w.nodes.length?s.jsx(qd,{graph:w,marks:R,label:"The workflow's graph",minScale:.55,onSelect:M=>{const K=x.ok?x.spans.get(`${M.path}/label`)??x.spans.get(M.path):void 0;K&&D(K.start,K.end)}}):s.jsx("p",{className:"p-6 text-center font-mono text-body text-muted-foreground",children:"No root node to draw yet."})}),s.jsx("div",{className:"border-t px-4 py-2",children:s.jsx(Vd,{})})]})]})}const XM="https://github.com/Parcha-ai/agentrun/blob/main/packages/serve/README.md#spend-cap";function tN(){return s.jsxs(s.Fragment,{children:["A run on Sonnet needs about $0.10 to take a few steps; under that it pauses before its next step (",s.jsx("a",{className:"underline underline-offset-2 hover:text-foreground",href:XM,target:"_blank",rel:"noreferrer",children:"the smallest cap"}),")."]})}let $a=null;function vu(e,t){return $a?$a({to:e,replay:t}):!1}function YM(e){const[t,n]=y.useState(null),o=y.useRef(location.hash);return y.useEffect(()=>{if(!e)return;const i=c=>c.to===o.current?!1:(n(c),!0);$a=i;const l=c=>{c.preventDefault(),c.returnValue=""};return window.addEventListener("beforeunload",l),()=>{$a===i&&($a=null),window.removeEventListener("beforeunload",l)}},[e]),{asking:t!==null,stay:()=>n(null),leave:()=>{var i;if(t!==null){if(n(null),t.to===null){(i=t.replay)==null||i.call(t);return}if($a=null,!t.replay){location.hash=t.to;return}location.hash!==o.current?window.addEventListener("hashchange",t.replay,{once:!0}):t.replay()}}}}const nN="Never ask: every tool this agent has runs without waiting for you. A tool set to deny, and a template's pins, still hold.",vw=e=>{try{return e?JSON.parse(e):void 0}catch{return}};function QM(e,t){if((e==null?void 0:e.kind)!=="invalid")return null;const n=Object.entries(e.fields).filter(([o])=>o==="definition.workflow"||o.startsWith("definition.workflow/")).map(([o,i])=>({path:o.slice(19),message:i}));return n.length?n:t?[{path:"",message:e.message}]:null}function ZM(e){var n;const t=(n=/^definition\.([a-z_]+)/.exec(e))==null?void 0:n[1];if(t){if(["name","description","instructions"].includes(t))return"context";if(["tools","tool_settings","approvals","skills"].includes(t))return"tools";if(["harness","thinking","model","max_cost_usd","learning"].includes(t))return"settings";if(["place","computer"].includes(t))return"computer";if(t==="workflow")return"workflow"}}const JM=[{id:"context",label:"Context",note:"Name, description and instructions",Icon:Xa},{id:"workflow",label:"Workflow",note:"Its graph and its JSON",Icon:Go},{id:"computer",label:"Computer",note:"Where it runs and what it drives",Icon:Ol},{id:"tools",label:"Tools & skills",note:"What this agent can do",Icon:Pu},{id:"settings",label:"Settings",note:"Harness, thinking and model",Icon:d0},{id:"history",label:"History",note:"Revisions and the current one",Icon:wh}];function eP({agent:e,revisions:t=[],caps:n,onSave:o,onMakeCurrent:i,onArchive:l,onReload:c,onBack:u,step:f,problem:p=null,notice:h,draft:b,validate:x,providerChoices:m=[],permissionGates:v=[],focusTool:w,mcpServers:j=null,serverToolSettings:S,onRetryMcp:T}){var Zt,Hn,as,is,Cn,Bn,Gn;const $=!e,_=e==null?void 0:e.definition,[E,R]=y.useState(f??((e==null?void 0:e.kind)==="workflow"?"workflow":"context")),C=$?hp(n.places):void 0,[O,z]=y.useState({name:(_==null?void 0:_.name)??"",description:(_==null?void 0:_.description)??"",instructions:(_==null?void 0:_.instructions)??($?K5:""),harness:(_==null?void 0:_.harness)??"pi",thinking:_==null?void 0:_.thinking,model:_==null?void 0:_.model,tools:$?gp("pi",n.tools,C):(_==null?void 0:_.tools)??[],maxCostText:typeof(_==null?void 0:_.max_cost_usd)=="number"&&_.max_cost_usd>0?String(_.max_cost_usd):"",...C?{place:C}:{},...(e==null?void 0:e.kind)==="workflow"?{workflowText:b??JSON.stringify(_.workflow,null,2)}:{}}),F=y.useRef(O);F.current=O;const[D,B]=y.useState(O),U=J=>{const{maxCostText:we,workflowText:Ge,...dt}=J,Ke=lw(we),$t=vw(Ge),on={...dt,maxCost:Ke.ok?Ke.value??0:we,...Ge!==void 0?{workflowSent:$t!==void 0?$t:Ge}:{}},bt=e?{...kg(e,on,"").definition}:{...on};return delete bt.version,bt.tool_settings&&!Object.keys(bt.tool_settings).length&&delete bt.tool_settings,{...bt,tools:[...bt.tools??[]].sort(),approvals:J.approvals??(_==null?void 0:_.approvals)??"ask"}},W=!dl(U(O),U(D)),[X,M]=y.useState([]),[K,L]=y.useState(!1),I=n.tools.map(J=>`${J.name}:${J.available}:${(J.harnesses??[]).join("+")}`).join(","),G=JSON.stringify(hp(n.places)??null);y.useEffect(()=>{if(!$)return;const J=we=>{const Ge=we.place??hp(n.places);return{...we,...Ge?{place:Ge}:{},...K?{}:{tools:gp(we.harness??"pi",n.tools,Ge)}}};z(J),B(J)},[I,G]);const[P,q]=y.useState(""),[ne,ae]=y.useState(!1),[ie,ce]=y.useState(!1),[le,ye]=y.useState(p),[ee,be]=y.useState(null),Oe=J=>{be(null),R(J)},We=J=>(le==null?void 0:le.kind)==="invalid"&&Object.entries(le.fields).filter(([we])=>we===`definition.${J}`||we.startsWith(`definition.${J}[`)||we.startsWith(`definition.${J}.`)).map(([,we])=>we).join(" ")||void 0,fe=(e==null?void 0:e.warnings)??[],Re=J=>sM(fe,J).map(we=>we.message).join(" ")||void 0,Xe=J=>{$&&ie||z(we=>({...we,...J}))},Yt=y.useRef(null);y.useEffect(()=>{var J;((le==null?void 0:le.kind)==="invalid"||(le==null?void 0:le.kind)==="other")&&((J=Yt.current)==null||J.focus())},[le]);const De=(e==null?void 0:e.kind)==="workflow",et=$&&Dj(O.harness),Ht=[...(Zt=O.name)!=null&&Zt.trim()?[]:["Give the agent a name to create it."],...!De&&!et&&!((Hn=O.instructions)!=null&&Hn.trim())?["Write its instructions to create it."]:[]],Bt=O.approvals??(_==null?void 0:_.approvals)??"ask",_t=tM(n.harnesses,$?{available:!!n.decisionProvider}:void 0),os={mcpHarnesses:n.mcpHarnesses,workflow:De},gn=J=>{if(J.mode==="sandbox")return;const we=new Set(n.tools.filter(Ge=>Ge.sandbox_only).map(Ge=>Ge.name));M(Ge=>Ge.filter(dt=>!we.has(dt)))},Qt=J=>{if($&&!K){Xe({harness:J,tools:gp(J,n.tools,O.place)}),M([]);return}const we=Q5(J,O.tools??[],X,n.tools,os);Xe({harness:J,tools:we.tools}),M(we.held)},ot=t.find(J=>J.revision===(e==null?void 0:e.revision))??t.find(J=>J.current),ct=JM.filter(J=>!($&&J.id==="history")&&(J.id!=="workflow"||De)&&!(et&&J.id==="tools")&&(J.id!=="computer"||!De&&!et&&!!(n.computers||n.places))),Pe=ct.some(J=>J.id===E)?E:ct[0].id,Le=ct.findIndex(J=>J.id===Pe),Mt=async()=>{if(!o)return;const J=O;ce(!0);let we={...O,workflowText:void 0,maxCostText:void 0};if(!et){const Ke=lw(O.maxCostText);if(!Ke.ok){ce(!1),ye({kind:"invalid",message:Ke.message,fields:{"definition.max_cost_usd":Ke.message}});return}const $t=typeof(_==null?void 0:_.max_cost_usd)=="number"&&_.max_cost_usd>0,on=Ke.value??0;(on!==0||$t)&&(we={...we,max_cost_usd:on})}if(De)try{we={...we,workflow:JSON.parse(O.workflowText??"")}}catch(Ke){ce(!1),ye({kind:"invalid",message:`The workflow is not JSON: ${Ke.message}`,fields:{"definition.workflow":`The workflow is not JSON: ${Ke.message}`}});return}const Ge=await o(we,P),dt=dl(F.current.tool_settings??{},we.tool_settings??{});ce(!1),ye(Ge),!Ge&&(q(""),F.current.harness===J.harness&&M([]),B(dt?(({tool_settings:Ke,...$t})=>$t)(J):J),dt&&z(({tool_settings:Ke,...$t})=>$t))},ut=YM(!ie&&W),It=Yj(O.harness??"pi",n.harnesses),En=It?eh(It,n.routePrefix):void 0,Tn=Xd(O.harness??"pi",n.tools).filter(J=>dw([J.name])).map(J=>J.name);return s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsxs("header",{className:"flex flex-wrap items-center gap-3 border-b px-5 py-4 md:px-8",children:[s.jsx(Z,{size:"icon",variant:"ghost","aria-label":"Back to agents",onClick:u,children:s.jsx(Ds,{"aria-hidden":!0})}),s.jsx("h1",{className:"min-w-0 flex-1 truncate font-mono text-xl font-semibold",title:$?void 0:_.name,children:$?"New agent":_.name}),e&&s.jsxs("div",{className:"flex basis-full flex-wrap items-center gap-3 sm:basis-auto",role:"group","aria-label":"About this agent",children:[s.jsx(Me,{children:e.kind}),s.jsxs("span",{className:"caps text-label text-muted-foreground",children:[ot?`rev ${ot.version} current · `:"",e.revisions," ",e.revisions===1?"revision":"revisions"]}),l&&s.jsxs(Z,{size:"sm",variant:e.archived_at?"primary":"outline",onClick:()=>l(!e.archived_at),children:[s.jsx(Rl,{"aria-hidden":!0})," ",e.archived_at?"Unarchive":"Archive"]})]})]}),(le==null?void 0:le.kind)==="conflict"&&s.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b bg-card px-5 py-3 md:px-8",role:"alert",children:[s.jsx(er,{className:"size-4 text-warning-text","aria-hidden":!0}),s.jsx("p",{className:"min-w-0 flex-1 text-body",children:"This agent changed since you opened it: another revision was saved first, so this save was not made. Reload to see the current revision; it replaces your unsaved edits here."}),s.jsx(Z,{size:"sm",onClick:c,children:"Reload"})]}),h&&s.jsx("p",{className:"border-b bg-card px-5 py-3 font-mono text-body text-warning-text md:px-8",role:"alert",children:h}),fe.length>0&&s.jsxs("div",{className:"border-b bg-card px-5 py-3 md:px-8",role:"status","aria-label":"Save warnings",children:[s.jsxs("p",{className:"flex items-center gap-2 font-mono text-body text-warning-text",children:[s.jsx(er,{className:"size-4 shrink-0","aria-hidden":!0})," Saved. A run of this revision is refused until the server has what each line names:"]}),s.jsx("ul",{className:"mt-2 space-y-1 font-mono text-small",children:fe.map((J,we)=>{const Ge=ct.find(dt=>dt.id===ZM(J.field));return s.jsxs("li",{children:[Ge?s.jsx("button",{type:"button",title:J.field,onClick:()=>Oe(Ge.id),className:"text-muted-foreground underline underline-offset-2 hover:text-foreground",children:Ge.label}):s.jsx("span",{className:"text-muted-foreground",children:J.field})," ",J.message]},`${J.field}:${we}`)})})]}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col md:flex-row",children:[s.jsx("ol",{className:oe("relative flex shrink-0 gap-1 overflow-x-auto border-b p-3 md:flex-col md:gap-0 md:border-b-0 md:border-r md:p-4",Pe==="workflow"?"md:w-[76px]":"md:w-[240px]"),children:ct.map((J,we)=>s.jsx("li",{className:"shrink-0",children:s.jsxs("button",{type:"button","aria-current":Pe===J.id?"step":void 0,onClick:()=>Oe(J.id),className:oe("flex w-full items-start gap-3 border-l-2 px-3 py-2.5 text-left font-mono",Pe===J.id?"border-l-foreground bg-foreground/5":"border-l-transparent text-muted-foreground hover:text-foreground"),children:[s.jsx("span",{className:oe("inline-flex size-6 shrink-0 items-center justify-center border text-label font-semibold",Pe===J.id?"border-foreground bg-foreground text-background":we<Le?"border-border-strong":"border-border"),children:we<Le?s.jsx(hd,{className:"size-3","aria-hidden":!0}):we+1}),s.jsxs("span",{className:oe("hidden min-w-0",Pe!=="workflow"&&"md:block"),title:Pe==="workflow"?J.label:void 0,children:[s.jsxs("span",{className:"caps flex items-center gap-1.5 text-small",children:[s.jsx(J.Icon,{className:"size-3.5","aria-hidden":!0})," ",J.label]}),s.jsx("span",{className:"mt-0.5 block text-label text-muted-foreground",children:J.note})]}),s.jsx("span",{className:"sr-only md:hidden",children:J.label})]})},J.id))}),s.jsx("section",{className:"min-h-0 flex-1 overflow-auto px-5 py-6 md:px-10",children:s.jsxs("fieldset",{disabled:$&&ie,className:"m-0 min-w-0 border-0 p-0",children:[s.jsxs("p",{className:"caps text-label text-muted-foreground",children:["Step ",Le+1]}),s.jsx("h2",{className:"caps mb-6 border-b pb-4 text-prose font-semibold",children:ct[Le].label}),Pe==="context"&&s.jsxs("div",{className:"max-w-3xl space-y-6",children:[s.jsx(Ps,{label:"Name",id:"agent-name",required:$,note:$?void 0:"Set when the agent was created; an edit keeps it.",error:We("name"),warning:Re("name"),children:s.jsx(He,{id:"agent-name",value:O.name,readOnly:!$,onChange:J=>Xe({name:J.target.value}),placeholder:"e.g., Invoice checker"})}),s.jsx(Ps,{label:"Description",id:"agent-description",optional:!0,note:$?void 0:"Set when the agent was created; an edit keeps it.",error:We("description"),warning:Re("description"),children:s.jsx(He,{id:"agent-description",value:O.description,readOnly:!$,onChange:J=>Xe({description:J.target.value}),placeholder:$?"Short summary for the agent list":"No description"})}),et?s.jsx(Ps,{label:"Workflow",children:s.jsx("p",{className:"border px-3 py-4 font-mono text-body text-muted-foreground",children:O.harness===jg?"A decision agent is a workflow. It starts from a starter decision workflow: one typed question, and a person when the answer is unclear or not confident enough. Create it, then edit its nodes in the Workflow step.":"A workflow agent starts from a one-step workflow: an agent node that does what its input's task asks. Create it, then edit its nodes, or paste a workflow's JSON over it, in the Workflow step."})}):De?s.jsx(Ps,{label:"Workflow",note:"This agent is a workflow. Edit its nodes in the Workflow step: the graph redraws as you type and the server checks it.",warning:Re("workflow"),children:s.jsxs(Z,{size:"sm",onClick:()=>R("workflow"),children:[s.jsx(Go,{"aria-hidden":!0})," Open the workflow"]})}):s.jsxs(Ps,{label:"Instructions",id:ne?void 0:"agent-instructions",required:!0,error:We("instructions"),warning:Re("instructions"),aside:s.jsx("span",{className:"flex",children:["Preview","Edit"].map(J=>s.jsx(Z,{type:"button",size:"xs","aria-pressed":J==="Preview"===ne,onClick:()=>ae(J==="Preview"),className:oe("-ml-px first:ml-0",J==="Preview"===ne?"relative border-foreground bg-foreground text-background hover:bg-foreground":"text-muted-foreground"),children:J},J))}),children:[ne?s.jsx("article",{className:"report min-h-64 border p-4",dangerouslySetInnerHTML:{__html:Ba(O.instructions||"")}}):s.jsx(Ss,{id:"agent-instructions",value:O.instructions,onChange:J=>Xe({instructions:J.target.value}),rows:14,placeholder:"Describe what the agent does, how, and its rules.",className:"resize-y leading-[1.7]"}),s.jsxs("p",{className:"mt-2 font-mono text-label text-muted-foreground",children:[(O.instructions??"").length," characters"]})]})]}),Pe==="workflow"&&s.jsx(yw,{text:O.workflowText??"",onText:J=>Xe({workflowText:J}),base:De?_.workflow:void 0,baseLabel:ot?`rev ${ot.version}`:void 0,validate:x,tools:O.tools,serverIssues:QM(le,De)}),Pe==="computer"&&!De&&!et&&n.computers&&s.jsx("div",{className:"max-w-4xl space-y-8",children:s.jsx(WM,{kinds:n.computers,value:O.computer??(_==null?void 0:_.computer)??aw(O.place??{mode:"runner"}),onChange:J=>{const we=FM(J),Ge=new Set(n.tools.filter(dt=>dt.sandbox_only).map(dt=>dt.name));Xe({computer:J,place:we,...we.mode==="runner"?{tools:(O.tools??[]).filter(dt=>!Ge.has(dt))}:{}}),gn(we)},error:We("computer")??We("place"),warning:Re("computer")??Re("place")})}),Pe==="computer"&&!De&&!et&&!n.computers&&n.places&&s.jsx("div",{className:"max-w-3xl space-y-8",children:s.jsx(HM,{value:O.place,saved:_==null?void 0:_.place,places:n.places,tools:n.tools,picked:O.tools??[],onChange:J=>{Xe({...J,...J.place?{computer:aw(J.place)}:{}}),J.place&&gn(J.place)},error:We("computer")??We("place"),warning:Re("computer")??Re("place")})}),Pe==="tools"&&s.jsxs("div",{className:"max-w-3xl space-y-6",children:[s.jsxs(Ps,{label:"Tools",note:"On by default: the tools this agent's harness runs on this server. Untick one to take it away.",error:We("tools"),warning:Re("tools"),children:[s.jsxs("ul",{className:"grid grid-cols-[repeat(auto-fill,minmax(min(100%,18rem),1fr))] items-start gap-2",children:[n.tools.filter(J=>{var we;return De||!J.call_only||((we=O.tools)==null?void 0:we.includes(J.name))}).map(J=>{var an,$s;const we=Qp(O.harness??"pi",J.name,n.tools,os),Ge=((an=O.tools)==null?void 0:an.includes(J.name))??!1,dt=m.find(Rn=>Rn.name===J.name),Ke=($s=(O.tool_settings??(_==null?void 0:_.tool_settings)??{})[J.name])==null?void 0:$s.provider,$t=!!dt&&Ke!==void 0&&Ke!==dt.provider,on=Z5(J,O.place??Kd(_==null?void 0:_.place)??Sg(De,O.tools??[],n.places)),bt=xj(J.name,v,e==null?void 0:e.tools)?gg:J.call_only&&!De?"Workflow-only: a workflow's call node runs it, not an agent":we?on??(!J.available&&!$t?(dt==null?void 0:dt.reason)??J.reason??`Needs ${(J.missing??[]).join(", ")}`:void 0):uw(O.harness??"pi",J.name,n.tools),Hs=bt?J.call_only&&!De?"Workflow only":on&&we&&bt===on?"Sandbox-only":bt:void 0;return s.jsx("li",{className:"min-w-0",children:s.jsx(Zj,{value:J.name,name:J.name,blurb:J.blurb,description:J.summary,why:bt,tag:Hs,on:Ge,disabled:!!bt&&!Ge,onToggle:()=>{L(!0),Xe({tools:Ge?O.tools.filter(Rn=>Rn!==J.name):[...O.tools??[],J.name]})}})},J.name)}),n.mcp&&!De&&s.jsx("li",{className:"sm:col-span-2",children:s.jsx(LM,{servers:j,tools:O.tools??[],harness:O.harness??"pi",harnesses:n.mcpHarnesses,onRetry:T,onChange:J=>{L(!0),Xe({tools:J})}})})]}),!De&&!dw(O.tools??[])&&s.jsxs("p",{className:"mt-2 font-mono text-small text-muted-foreground",children:["This agent can't reach the web: ",Tn.length?`tick ${Tn.join(" or ")} in Tools.`:`${O.harness??"pi"} runs no web tool on this server.`]})]}),s.jsx(qM,{agent:e,unattended:!De&&Bt==="never",harness:O.harness??"pi",model:O.model,tools:O.tools??[],choices:De?[]:m,gates:v,mcpServers:Array.isArray(j)?j:void 0,serverSettings:S,focus:w,callTools:De?AO(vw(O.workflowText)??(_==null?void 0:_.workflow)):void 0,value:O.tool_settings??(_==null?void 0:_.tool_settings)??{},issues:(le==null?void 0:le.kind)==="invalid"?le.fields:{},onChange:J=>!ie&&dl(J,(_==null?void 0:_.tool_settings)??{})?z(({tool_settings:we,...Ge})=>Ge):Xe({tool_settings:J})}),!De&&!et&&s.jsxs("fieldset",{"aria-label":"Approvals",className:"space-y-2",children:[s.jsx("legend",{className:"caps text-small font-semibold",children:"Approvals"}),[["ask","Ask me","A call whose permission is ask waits for your answer."],["never","Never ask (run unattended)","For an agent that runs on a trigger, with no one there to answer."]].map(([J,we,Ge])=>s.jsxs("label",{className:oe("flex items-start gap-3 border px-3 py-2.5",Bt===J&&"border-foreground"),children:[s.jsx("input",{type:"radio",name:"approvals",value:J,className:"mt-1 accent-primary",checked:Bt===J,disabled:ie,onChange:()=>Xe({approvals:J})}),s.jsxs("span",{children:[s.jsx("span",{className:"font-mono text-body",children:we}),s.jsx("span",{className:"block text-small text-muted-foreground",children:Ge})]})]},J)),Bt==="never"&&s.jsx("p",{className:"text-small text-warning-text",children:nN})]}),s.jsx(Ps,{label:"Skills",note:"Skill files are saved with each revision and kept as they are by an edit.",children:(as=_==null?void 0:_.skills)!=null&&as.length?s.jsx("ul",{className:"border",children:_.skills.map(J=>s.jsx("li",{className:"border-b px-3 py-2 font-mono text-body last:border-b-0",children:J},J))}):s.jsx("p",{className:"border px-3 py-4 font-mono text-body text-muted-foreground",children:"No skills."})})]}),Pe==="settings"&&s.jsxs("div",{className:"max-w-3xl space-y-8",children:[!De&&s.jsxs(Ps,{named:!0,label:"Harness",note:"What runtime runs this agent.",error:We("harness"),warning:Re("harness"),children:[s.jsx("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(min(100%,9rem),1fr))] gap-3",role:"radiogroup","aria-label":"Harness",children:_t.map(J=>{const we=s.jsxs(s.Fragment,{children:[s.jsx("input",{type:"radio",name:"harness",value:J.id,checked:O.harness===J.id,disabled:!J.available&&O.harness!==J.id,onChange:()=>Qt(J.id),className:"mt-1 accent-primary"}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"block break-words font-mono text-body font-semibold",children:J.label}),s.jsx("span",{className:"mt-0.5 block font-mono text-label text-muted-foreground",children:J.available?J.id:"Not available here"})]})]}),Ge=oe("min-w-0 border px-4 py-3",O.harness===J.id?"border-foreground":"border-border");return J.available?s.jsx("label",{className:oe(Ge,"flex cursor-pointer items-start gap-3"),children:we},J.id):s.jsxs("div",{className:oe(Ge,"opacity-60"),children:[s.jsx("label",{className:"flex cursor-not-allowed items-start gap-3",children:we}),J.reason&&s.jsxs("details",{className:"mt-2 font-mono text-label text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer select-none hover:text-foreground",children:"Why, and what to do"}),s.jsx("p",{className:"mt-1 break-words leading-[1.6]",children:J.reason})]})]},J.id)})}),X.length>0&&s.jsxs("div",{className:"mt-3 border px-3 py-2 font-mono text-small",role:"status","aria-label":"Tools this harness doesn't run",children:[s.jsxs("p",{className:"text-warning-text",children:[((is=_t.find(J=>J.id===O.harness))==null?void 0:is.label)??O.harness," doesn't run ",X.length===1?"this tool":"these tools"," here, so ",X.length===1?"it's":"they're"," unticked. Switching back ticks ",X.length===1?"it":"them"," again."]}),s.jsx("ul",{className:"mt-1 space-y-0.5",children:X.map(J=>s.jsxs("li",{children:[J,": ",s.jsx("span",{className:"text-muted-foreground",children:uw(O.harness??"pi",J,n.tools,n.mcpHarnesses)})]},J))})]})]}),!De&&!et&&s.jsx(Ps,{named:!0,label:"Thinking",note:"How hard the model thinks before it answers.",error:We("thinking"),warning:Re("thinking"),children:s.jsx("div",{className:"flex flex-wrap gap-2",role:"radiogroup","aria-label":"Thinking",children:n.thinking.map(J=>s.jsxs("label",{className:oe("caps cursor-pointer border px-3 py-2 text-small",O.thinking===J?"border-foreground":"text-muted-foreground"),children:[s.jsx("input",{type:"radio",name:"thinking",className:"sr-only",checked:O.thinking===J,onChange:()=>Xe({thinking:J})}),J]},J))})}),!et&&s.jsx(Ps,{label:"Model",id:"agent-model",optional:!0,note:En?s.jsxs(s.Fragment,{children:["Empty uses the server's default (",s.jsx("span",{title:En.title,children:En.text}),")."]}):kM,error:We("model"),warning:Re("model"),children:s.jsx(He,{id:"agent-model",value:O.model??"",onChange:J=>Xe({model:J.target.value||void 0}),placeholder:"provider/model"})}),!et&&s.jsx(Ps,{label:"Default spend cap per run, $",id:"agent-max-cost",optional:!0,note:"A run started without a cap of its own, and a trigger with none, stops at this spend. Empty means none.",hint:s.jsx(tN,{}),error:We("max_cost_usd"),warning:Re("max_cost_usd"),children:s.jsx(He,{id:"agent-max-cost",inputMode:"decimal",value:O.maxCostText??"",onChange:J=>Xe({maxCostText:J.target.value}),placeholder:"e.g., 2.50"})}),!De&&!et&&n.learning&&s.jsx(f5,{fields:O,onFields:Xe,saved:_==null?void 0:_.learning,server:n.learning,error:We("learning"),warning:Re("learning")})]}),Pe==="history"&&ee&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs(Z,{size:"sm",variant:"ghost",onClick:()=>be(null),children:[s.jsx(Ds,{"aria-hidden":!0})," Back to History"]}),s.jsxs("span",{className:"caps text-small",children:["rev ",ee.version]}),s.jsx("span",{className:"min-w-0 flex-1 text-lead",children:ee.note??s.jsx("span",{className:"text-muted-foreground",children:"No note"})}),s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:St(ee.created_at)}),s.jsx(Z,{size:"sm",onClick:()=>i==null?void 0:i(ee.revision),disabled:!i,children:"Make current"})]}),s.jsx(yw,{readOnly:!0,text:JSON.stringify((Cn=ee.definition)==null?void 0:Cn.workflow,null,2),onText:()=>{},base:_.workflow,baseLabel:ot?`rev ${ot.version}, the current one`:"the current revision"})]}),Pe==="history"&&!ee&&s.jsx("ul",{className:"max-w-3xl border",children:t.map(J=>{var we;return s.jsxs("li",{className:"flex flex-wrap items-center gap-3 border-b px-4 py-3 last:border-b-0",children:[s.jsxs("span",{className:"caps w-14 text-small",children:["rev ",J.version]}),s.jsx("span",{className:"min-w-0 flex-[1_1_14rem] break-words text-lead",children:J.note??s.jsx("span",{className:"text-muted-foreground",children:"No note"})}),s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:St(J.created_at)}),De&&!J.current&&((we=J.definition)==null?void 0:we.workflow)!==void 0&&s.jsxs(Z,{size:"sm",variant:"ghost",onClick:()=>be(J),"aria-label":`View rev ${J.version}`,children:[s.jsx(a0,{"aria-hidden":!0})," View"]}),J.current?s.jsx(Me,{tone:"success",children:"Current"}):s.jsx(Z,{size:"sm",onClick:()=>i==null?void 0:i(J.revision),disabled:!i,children:"Make current"})]},J.revision)})})]})})]}),s.jsxs("footer",{className:"flex flex-wrap items-center gap-3 border-t px-5 py-3 md:px-8",children:[s.jsxs(Z,{size:"sm",variant:"ghost",disabled:Le===0,onClick:()=>Oe(ct[Le-1].id),children:[s.jsx(Ds,{"aria-hidden":!0})," Previous"]}),Pe!=="history"&&s.jsx(He,{value:P,onChange:J=>q(J.target.value),placeholder:$?"":"What changed (a note on this revision)","aria-label":"Revision note",className:oe("h-9 min-w-0 flex-1",$&&"invisible")}),Pe==="history"&&s.jsx("span",{className:"flex-1"}),Le<ct.length-1&&s.jsxs(Z,{size:"sm",onClick:()=>Oe(ct[Le+1].id),children:["Next ",s.jsx(xh,{"aria-hidden":!0})]}),!ee&&s.jsx(Z,{ref:Yt,size:"sm",variant:"solid",onClick:Mt,disabled:!o||ie||!$&&!W||!((Bn=O.name)!=null&&Bn.trim())||!De&&!et&&!((Gn=O.instructions)!=null&&Gn.trim()),children:$?ie?"Creating…":"Create":ie?"Saving…":W?"Save revision":ot?`Saved · rev ${ot.version}`:"Saved"}),$&&!ie&&!ee&&Ht.map(J=>s.jsx("p",{className:"w-full text-right font-mono text-small text-muted-foreground",children:J},J)),(le==null?void 0:le.kind)==="invalid"&&s.jsxs("p",{className:"w-full text-right font-mono text-small text-destructive-text",role:"alert",children:["The server refused the save: ",le.message]}),(le==null?void 0:le.kind)==="other"&&s.jsx("p",{className:"w-full text-right font-mono text-small text-destructive-text",role:"alert",children:le.message})]}),s.jsxs(P4,{open:ut.asking,title:"Leave without saving?",confirm:"Leave",cancel:"Stay",onConfirm:ut.leave,onCancel:ut.stay,children:[$?"This new agent is not saved yet.":"Your changes to this agent are not saved."," Leave drops them; Stay keeps them here."]})]})}const Ps=({named:e,...t})=>s.jsx(Po,{...t,group:t.id?!1:e?"heading":!0});function tP({agents:e,archived:t=!1,onArchivedChange:n,actions:o={},error:i,handoff:l}){const[c,u]=y.useState(""),f=(e??[]).filter(p=>`${p.definition.name} ${p.definition.description??""}`.toLowerCase().includes(c.toLowerCase()));return s.jsxs("div",{className:"p-5 md:p-8",children:[s.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-3",children:[s.jsxs("label",{className:oe("flex h-control-lg min-w-0 flex-1 items-center gap-3 px-3",r1),children:[s.jsx(k_,{className:"size-4 text-muted-foreground","aria-hidden":!0}),s.jsx(He,{bare:!0,value:c,onChange:p=>u(p.target.value),placeholder:"Search agents by name or description...","aria-label":"Search agents",className:"flex-1 max-sm:portrait:placeholder:text-transparent"})]}),s.jsxs(Z,{size:"lg",variant:t?"primary":"outline","aria-pressed":t,onClick:()=>n==null?void 0:n(!t),children:[s.jsx(Rl,{"aria-hidden":!0})," Archived"]}),!t&&l,!t&&s.jsxs(Z,{size:"lg",variant:"primary",onClick:o.onNew,children:[s.jsx(pl,{"aria-hidden":!0})," New agent"]})]}),i?s.jsx("p",{className:"border p-4 font-mono text-body text-destructive-text",role:"alert",children:i}):e?f.length?s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"mb-3 font-mono text-small text-muted-foreground",children:[f.length," ",f.length===1?"agent":"agents"]}),s.jsx("ul",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-3",children:f.map(p=>s.jsx(nP,{agent:p,actions:o},p.agent_id))})]}):s.jsxs("div",{className:"border px-4 py-12 text-center",children:[s.jsx("p",{className:"font-mono text-body text-muted-foreground",children:c?"No agent matches.":t?"No archived agents.":"No agents yet."}),!c&&!t&&s.jsxs(Z,{className:"mt-4",variant:"primary",onClick:o.onNew,children:[s.jsx(pl,{"aria-hidden":!0})," New agent"]})]}):s.jsx(_s,{label:"Loading the agents",rows:6})]})}function nP({agent:e,actions:t}){const n=e.kind==="workflow"?Go:yh,o=!!e.archived_at,i=Qu(e);return s.jsxs("li",{className:oe("flex flex-col border p-4",o&&"opacity-70"),children:[s.jsxs("button",{type:"button",className:"flex min-w-0 items-start gap-2.5 text-left",onClick:()=>{var l;return(l=t.onOpen)==null?void 0:l.call(t,e.agent_id)},children:[s.jsx(n,{className:"mt-0.5 size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-mono text-prose font-semibold",children:e.definition.name}),s.jsx(Me,{children:e.kind}),e.kind==="agentic"&&s.jsx(Me,{children:e.definition.harness??"pi"}),o&&s.jsx(Me,{tone:"muted",children:"Archived"})]}),s.jsx("span",{className:"mt-1.5 line-clamp-2 block font-mono text-small leading-relaxed text-muted-foreground",children:e.definition.description||(e.kind==="workflow"?w4(e.definition.workflow):"No description.")})]})]}),s.jsxs("div",{"data-testid":"agent-card-footer",className:"mt-auto flex min-w-0 flex-wrap items-start gap-x-2 gap-y-1 pt-4",children:[s.jsxs("div",{"data-testid":"agent-card-chips",className:"flex min-w-0 flex-auto flex-wrap items-center gap-x-2 gap-y-1.5 py-1.5",children:[s.jsxs(Me,{className:"shrink-0 whitespace-nowrap",children:[e.revisions," ",e.revisions===1?"revision":"revisions"]}),e.runs&&s.jsxs(Me,{className:"shrink-0 whitespace-nowrap",children:[e.runs.count," ",e.runs.count===1?"run":"runs",e.runs.live?` · ${e.runs.live} live`:""]}),i>0&&s.jsxs(Z,{size:"xs","aria-label":ug(i),onClick:()=>{var l;return(l=t.onLearning)==null?void 0:l.call(t,e.agent_id)},className:"h-5 shrink-0 whitespace-nowrap border-warning/50 bg-warning/10 px-1.5 text-micro text-warning-text hover:bg-warning/20",children:["Learning · ",i]})]}),s.jsxs("div",{"data-testid":"agent-card-actions",className:"ml-auto flex shrink-0 items-center gap-2",children:[s.jsx(Z,{size:"icon",variant:"outline",className:"shrink-0","aria-label":`Edit ${e.definition.name}`,onClick:()=>{var l;return(l=t.onEdit)==null?void 0:l.call(t,e.agent_id)},children:s.jsx(Ml,{"aria-hidden":!0})}),s.jsx(Z,{size:"icon",variant:"outline",className:"shrink-0","aria-label":`Runs of ${e.definition.name}`,onClick:()=>{var l;return(l=t.onRuns)==null?void 0:l.call(t,e.agent_id)},children:s.jsx(wh,{"aria-hidden":!0})}),s.jsx(Z,{size:"icon",variant:"outline",className:"shrink-0","aria-label":`${o?"Unarchive":"Archive"} ${e.definition.name}`,onClick:()=>{var l;return(l=t.onArchive)==null?void 0:l.call(t,e.agent_id,!o)},children:o?s.jsx(n0,{"aria-hidden":!0}):s.jsx(Rl,{"aria-hidden":!0})})]})]})]})}const Ro=e=>e instanceof Ee?nM(e):{kind:"other",message:e instanceof Error?e.message:String(e)};function sP({v2:e,archived:t,go:n}){const[o,i]=y.useState(null),[l,c]=y.useState(null),u=y.useRef(0),f=()=>{const p=++u.current;i(null),c(null),Qr(h=>e.listAgents({archived:t,cursor:h}),h=>h.agents).then(h=>{p===u.current&&i(h)}).catch(h=>{p===u.current&&c(Ro(h).message)})};return y.useEffect(f,[e,t]),s.jsx(tP,{agents:o,archived:t,onArchivedChange:p=>n(p?"#/agents?archived=true":"#/agents"),error:l,handoff:s.jsx(lg,{context:{kind:"create"},label:"Build with your coding agent",size:"lg",iconOnPhone:!0,className:"max-sm:w-11"}),actions:{onOpen:p=>n(zs(p)),onEdit:p=>n(zs(p,"edit")),onNew:()=>n("#/agents/new"),onRuns:p=>n(zs(p,"runs")),onLearning:p=>n(zs(p,"learning")),onArchive:async(p,h)=>{try{await(h?e.archiveAgent(p):e.unarchiveAgent(p)),f()}catch(b){c(Ro(b).message)}}}})}function rP({v2:e,caps:t,choices:n=[],gates:o=[],focusTool:i,agentId:l,go:c}){const[u,f]=y.useState(null),[p,h]=y.useState(null),[b,x]=y.useState([]),[m,v]=y.useState(null),[w,j]=y.useState(null),[S,T]=y.useState(0),[$,_]=y.useState(null),E=y.useRef(!0);y.useEffect(()=>(E.current=!0,()=>{E.current=!1}),[]);const R=L=>Qr(I=>e.listRevisions(L,I),I=>I.revisions),C=async()=>{if(l)try{const[{agent:L,etag:I},G]=await Promise.all([e.getAgent(l),R(l)]);f(L),h(I),x(G),_(L.revision),T(P=>P+1),j(null),v(null)}catch(L){u?j(`The agent could not be reloaded: ${Ro(L).message}`):v(Ro(L).message)}};y.useEffect(()=>{C()},[l]);const[O,z]=y.useState(null),F=y.useRef(0);y.useEffect(()=>{const L=++F.current;e.computers().then(I=>{L===F.current&&z(I.kinds)},()=>{L===F.current&&z(null)})},[e]);const[D,B]=y.useState(void 0);y.useEffect(()=>{let L=!0;return Promise.resolve().then(()=>e.toolSettings()).then(I=>{L&&B(I)},()=>{}),()=>{L=!1}},[e]);const[U,W]=y.useState(null),X=y.useRef(0),M=()=>{if(!t.mcp)return;const L=++X.current;W(null),e.listMcpServers().then(I=>{L===X.current&&W(I.servers)},()=>{L===X.current&&W("failed")})};y.useEffect(M,[e,t.mcp]);const K=async(L,I)=>{let G;try{G=await I()}catch(P){j(`${L} did not finish: ${Ro(P).message}`);return}f(G);try{const{agent:P,etag:q}=await e.getAgent(G.agent_id),ne=await R(G.agent_id).catch(()=>b);f(P),h(q),x(ne),P.revision!==$?(_(P.revision),T(ae=>ae+1),j(L==="Make current"?null:`${L} done. This agent changed since you opened it: the form now shows its current revision.`)):j(null)}catch(P){j(`${L} done. The page could not be refreshed: ${Ro(P).message}. Reload to see the current state.`)}};return l&&m&&!u?s.jsx("p",{className:"m-8 border p-4 font-mono text-body text-destructive-text",role:"alert",children:m}):l&&!u?s.jsx("p",{className:"p-8 text-center font-mono text-body text-muted-foreground",children:"Loading the agent..."}):s.jsx(eP,{agent:u,revisions:b,caps:{...t,computers:O},providerChoices:n,permissionGates:o,mcpServers:U,serverToolSettings:D,onRetryMcp:M,...i?{focusTool:i,step:"tools"}:{},notice:w,validate:e.validateWorkflow,onBack:()=>c("#/agents"),onReload:()=>{C(),M()},onSave:async(L,I)=>{let G;try{if(!u){const ae=await e.createAgent(X5({name:L.name??"",description:L.description??"",instructions:L.instructions??"",harness:L.harness??"pi",tools:L.tools??[],approvals:L.approvals,tool_settings:L.tool_settings,thinking:L.thinking,model:L.model,computer:L.computer,learning:L.learning,max_cost_usd:L.max_cost_usd,decisionProvider:t.decisionProvider}));return E.current&&c(zs(ae.agent_id,ae.kind==="workflow"?"workflow":void 0)),null}const P=kg(u,L,I);if(P.unchanged)return{kind:"other",message:"Nothing to save: the definition is the current revision's, and a note alone makes no new revision."};const{unchanged:q,...ne}=P;G=await e.updateDefinition(u.agent_id,ne,p)}catch(P){return Ro(P)}return f(G.agent),h(G.etag),_(G.agent.revision),e.getAgent(G.agent.agent_id).then(P=>f(q=>q&&q.revision===P.agent.revision?{...q,tools:P.agent.tools}:q)).catch(()=>{}),R(G.agent.agent_id).then(x).catch(()=>j("Saved. The history could not be refreshed; reload to see it.")),null},onMakeCurrent:L=>{u&&K("Make current",()=>e.setCurrent(u.agent_id,L))},onArchive:L=>{u&&K(L?"Archive":"Unarchive",()=>L?e.archiveAgent(u.agent_id):e.unarchiveAgent(u.agent_id))}},`${(u==null?void 0:u.agent_id)??"new"}:${S}`)}function Xo({error:e,title:t="The run failed"}){return s.jsxs("section",{className:"flex gap-3 bg-card px-4 py-4 md:px-5",role:"alert",children:[s.jsx(er,{className:"mt-0.5 size-4 shrink-0 text-destructive-text","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"caps text-small font-semibold",children:t}),s.jsx("p",{className:"mt-2 break-words font-mono text-body leading-relaxed",children:e.message}),s.jsxs("p",{className:"mt-2 font-mono text-label text-muted-foreground",children:[e.code,e.retryable?" · retryable":"",e.request_id?` · ${e.request_id}`:""]})]})]})}const oP={anthropic:"claude.ai",openai:"chatgpt.com",openrouter:"openrouter.ai",parallel:"parallel.ai",monid:"monid.ai",browserbase:"browserbase.com",kernel:"kernel.sh",typesafe:"typesafe.ai"},aP={anthropic:"M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z",openrouter:"M16.778 1.844v1.919q-.569-.026-1.138-.032-.708-.008-1.415.037c-1.93.126-4.023.728-6.149 2.237-2.911 2.066-2.731 1.95-4.14 2.75-.396.223-1.342.574-2.185.798-.841.225-1.753.333-1.751.333v4.229s.768.108 1.61.333c.842.224 1.789.575 2.185.799 1.41.798 1.228.683 4.14 2.75 2.126 1.509 4.22 2.11 6.148 2.236.88.058 1.716.041 2.555.005v1.918l7.222-4.168-7.222-4.17v2.176c-.86.038-1.611.065-2.278.021-1.364-.09-2.417-.357-3.979-1.465-2.244-1.593-2.866-2.027-3.68-2.508.889-.518 1.449-.906 3.822-2.59 1.56-1.109 2.614-1.377 3.978-1.466.667-.044 1.418-.017 2.278.02v2.176L24 6.014Z"},iP=e=>`https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64`;function lP({id:e,className:t}){const[n,o]=y.useState(!1),i=oP[e],l=aP[e];return i&&!n?s.jsx("img",{"data-provider-icon":e,src:iP(i),alt:"",width:16,height:16,loading:"lazy",referrerPolicy:"no-referrer",onError:()=>o(!0),className:oe("size-4 shrink-0 object-contain",t)}):l?s.jsx("svg",{"data-provider-mark":e,viewBox:"0 0 24 24",fill:"currentColor",className:oe("size-4 shrink-0",t),"aria-hidden":!0,children:s.jsx("path",{d:l})}):s.jsx(Al,{className:oe("size-4 shrink-0 text-muted-foreground",t),"aria-hidden":!0})}const cP=/^(which|what|who|whom|whose|where|when|why|how|should|shall|do|does|did|is|are|was|were|can|could|would|will|may|might)\b/i,uP=40;function dP(e){const t=e.trim().replace(/\?+$/,""),n=t.lastIndexOf(":"),o=(n>=0?t.slice(n+1):t.split(new RegExp("(?<=[.!?])\\s+")).at(-1)??"").trim();if(n<0&&cP.test(o))return[];const i=o.split(/,?\s+or\s+|,\s+/i).map(c=>c.trim()).filter(Boolean);if(i.length<2||i.length>4||!/\bor\b/i.test(o))return[];const l=i.map(c=>c.replace(/^(the|a|an)\s+/i,"").replace(/\s+instead$/i,""));return l.some(c=>!c||c.length>uP)?[]:l.map(c=>/\s/.test(c)?c[0].toUpperCase()+c.slice(1):c)}function fP(e){var o,i;const t=new Map;for(const l of e){if(l.imported_from)continue;const c=((i=(o=l.error)==null?void 0:o.message)==null?void 0:i.trim())||"The run failed.";t.set(c,[...t.get(c)??[],l])}const n=l=>Date.parse(l.ended_at??l.created_at);return[...t].map(([l,c])=>({message:l,runs:c.sort((u,f)=>n(f)-n(u))})).sort((l,c)=>n(c.runs[0])-n(l.runs[0]))}function mP(e,t){return e.some(n=>!n.imported_from)||t.some(n=>n.source==="live"&&n.runs>0)}function Ql(e,t){const n=Math.max(0,Math.round((t-Date.parse(e))/1e3));return n<60?`${n} s`:n<3600?`${Math.floor(n/60)} min`:n<86400?`${Math.floor(n/3600)} h`:`${Math.floor(n/86400)} days`}const pP=2e3;function hP(e,t){var o;if(e.kind==="workflow")return{refusal:`"${e.title}" is a workflow run: start it again from its agent's page`};if(!t)return{refusal:`"${e.title}": its first message could not be read`};if(t.length>=pP&&t.endsWith("..."))return{refusal:`"${e.title}": its first message is longer than the timeline keeps; start it again from its agent's page`};if(/\n\nFiles for this run: [^\n]*$/.test(t))return{refusal:`"${e.title}" was given files, which a run started again can't take along: start it again from its agent's page with them`};const n=(o=e.cost)==null?void 0:o.cap_usd;return{body:{input:{content:t},...e.effort?{effort:e.effort}:{},...typeof n=="number"?{max_cost_usd:n}:{}}}}function gP(e,t){let n=!1,o;const i=()=>{n||e().catch(()=>{}).finally(()=>{n||(o=setTimeout(i,t))})};return i(),()=>{n=!0,clearTimeout(o)}}const sN=e=>e.pending!=null,xP=e=>e.status==="input_required"&&e.state!=="waiting"&&!sN(e),yP=[["asking","The runs asking a question"],["failed","The failed runs"],["live","The running runs"]];function bw(e,t){const n={asking:(e==null?void 0:e.asking)??[],failed:(e==null?void 0:e.failed)??[],live:(e==null?void 0:e.live)??[]},o=[];return yP.forEach(([i,l],c)=>{const u=t[c];(u==null?void 0:u.status)==="fulfilled"?n[i]=u.value:u&&o.push(`${l} could not be read: ${u.reason instanceof Error?u.reason.message:String(u.reason)}`)}),{needs:n,problem:o.length?o.join(" · "):null}}const vP={env:"Set in the environment",console:"Pasted here","sign-in":"From sign-in"},bP={tool:1,model:1,mcp:2,computer:2,source:2};function ad(e,t){const n=e.split(":"),o=bP[n[0]];return(o===void 0?"":n.slice(o).join(":"))||t||n.slice(1).join(":")}const wP="Sign in with your password to change secrets.",kP="This server has no accounts: set secrets in its environment, or turn accounts on to change them here.",jP="Open the console from the server's link to change secrets.",Zl={sign_in:wP,no_accounts:kP,token:jP},rN=e=>e.status===200&&e.body&&typeof e.body=="object"?e.body:null,NP=e=>{var t;return((t=rN(e))==null?void 0:t.secrets_writable)===!0};function SP(e){const t=rN(e);return t!=null&&t.secrets_reason?t.secrets_reason:(t==null?void 0:t.accounts)===!1?"no_accounts":"sign_in"}function _P(e){const[t,n]=y.useState({writable:!1,whyNot:"sign_in"});return y.useEffect(()=>{let o=!0;return e.session().then(i=>{o&&n({writable:NP(i),whyNot:SP(i)})},()=>{}),()=>{o=!1}},[e]),t}function Jd({field:e,label:t,writable:n,required:o=!0,stateSaid:i=!1,now:l=Date.now,note:c,onPaste:u,onRemove:f}){const p=e.source==="env",h=n&&!p;return s.jsxs("li",{"data-secret":e.name,"data-source":e.source??"none",className:oe("relative flex flex-wrap items-center gap-x-3 gap-y-1 font-mono text-small",p&&"opacity-60"),children:[s.jsxs("span",{children:[ad(e.name,t),!o&&s.jsx("span",{className:"ml-2 font-sans text-label text-muted-foreground",children:"Optional"})]}),s.jsx("span",{"data-state":e.set?"set":o?"missing":"optional-missing",className:i?"sr-only":c?"text-warning-text":e.set?"text-success-text":"text-muted-foreground",children:e.set?"Set":"Missing"}),e.source&&s.jsx("span",{className:"text-muted-foreground",children:vP[e.source]}),e.changed_at&&s.jsxs("span",{className:"text-muted-foreground",children:["Changed ",Ql(e.changed_at,l())," ago"]}),c&&s.jsx("span",{className:"text-warning-text",children:c}),h&&s.jsxs("span",{className:"ml-auto flex gap-2 font-sans",children:[u&&s.jsx(Z,{type:"button",size:"sm",variant:e.set?"outline":"primary",onClick:u,children:e.set?"Replace":"Paste"}),f&&e.set&&s.jsx(Z,{type:"button",size:"sm",variant:"destructive",onClick:f,children:"Remove"})]})]})}const $P={seal_key_changed:"This server's seal key changed since these keys were saved, so they can't be opened.",file_unreadable:"The file this server keeps the saved keys in is damaged, so they can't be opened."},ww=e=>e instanceof Ee?e.toApiError():{code:"network",message:e instanceof Error?e.message:String(e),retryable:!1};function kw(e,t){return t?t.state==="accepted"?`${e} accepted this key · ${St(t.at)}`:`Not checked: ${t.reason}${t.at?` · ${St(t.at)}`:""}`:null}const EP="can't be opened: paste it again",TP=[{kind:"model",label:"Model keys"},{kind:"tool",label:"Tool keys"}],oN="We recommend an OpenRouter key with a dollar cap and an expiration date. Do not share this key with anyone.";function CP({v2:e,onChange:t,writable:n,whyNot:o="sign_in"}){const[i,l]=y.useState(null),[c,u]=y.useState(null),[f,p]=y.useState(null),[h,b]=y.useState(null),x=y.useRef(0),m=()=>{const _=++x.current;e.listToolKeys().then(E=>{_===x.current&&(l(E),u(null))}).catch(E=>{_===x.current&&u(ww(E))})};y.useEffect(m,[e]);const v=_=>p(E=>E===_?null:E),w=_=>{v(_),m(),t==null||t()},j=(_,E,R,C)=>{b({id:_,title:E,error:ww(R)}),R instanceof Ee&&R.code==="key_set_by_server"&&(v(C),m())};if(!i)return c?s.jsx(jw,{error:c,onRetry:m}):s.jsx("div",{className:"p-5 md:p-8",children:s.jsx(_s,{label:"Loading the tool keys",rows:3})});const S=i.reenter,T=TP.map(_=>({..._,keys:i.keys.filter(E=>E.kind==="model"==(_.kind==="model"))})).filter(_=>_.keys.length),$=_=>s.jsx(RP,{tool:_,writable:n,again:!!S&&_.fields.some(E=>E.stored_unreadable||S.fields.includes(E.name)),open:(f==null?void 0:f.id)===_.id?f.mode:null,problem:(h==null?void 0:h.id)===_.id?h:null,onOpen:E=>{p(E?{id:_.id,mode:E}:null),b(null)},onSave:async E=>{const R=f;try{await e.saveToolKey(_.id,E)}catch(C){return C instanceof Ee&&C.status===422?C:(j(_.id,"The key was not saved",C,R),null)}return w(R),null},onRemove:async()=>{const E=f;try{await e.removeToolKey(_.id)}catch(R){j(_.id,"The key was not removed",R,E);return}w(E)}},_.id);return s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1100px] space-y-6 px-6 py-8",children:[s.jsxs("div",{children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:"Settings"}),s.jsx("h1",{className:"mt-1 text-2xl font-semibold",children:"Keys"}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:"A model provider's key, which every agent runs on, and a tool's key, for every agent that uses the tool, kept on this server. A saved key is never shown again."})]}),!n&&s.jsx("p",{className:"border bg-card p-4 text-body",role:"status",children:Zl[o]}),c&&s.jsx(jw,{inline:!0,error:c,onRetry:m}),S&&s.jsxs(ns,{tone:"warning",role:"alert","aria-label":"Keys to enter again",title:"Enter these keys again",children:[s.jsx("p",{children:$P[S.reason]}),s.jsx("p",{className:"mt-2 font-mono",children:S.fields.length?S.fields.join(", "):"Which keys it held is not known: enter again each key you had saved."})]}),T.map(_=>s.jsxs("section",{"aria-label":_.label,children:[T.length>1&&s.jsx("h2",{className:"caps mb-2 text-small font-semibold text-muted-foreground",children:_.label}),_.kind==="model"&&s.jsx("p",{className:"mb-2 text-body text-muted-foreground",children:oN}),s.jsx("ul",{className:"border",children:_.keys.map($)})]},_.label))]})})}function jw({error:e,onRetry:t,inline:n=!1}){return s.jsx(ns,{tone:"error",className:n?void 0:"m-8",actions:s.jsx(Z,{type:"button",size:"xs",onClick:t,children:"Try again"}),children:s.jsxs("p",{className:"font-mono",children:["The tool keys could not be read: ",e.code,": ",e.message]})})}function RP({tool:e,writable:t,again:n,open:o,problem:i,onOpen:l,onSave:c,onRemove:u}){var x;const f=m=>e.secrets.find(v=>ad(v.name)===m.name),p=m=>e.fields.find(v=>v.name===ad(m.name)),h=e.fields.filter(m=>{var v;return((v=f(m))==null?void 0:v.source)!=="env"}),b=e.secrets.filter(m=>m.set).length;return s.jsxs("li",{className:"border-b p-4 last:border-b-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[s.jsx(lP,{id:e.id,className:"mt-1"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-mono text-prose font-semibold",children:e.label}),s.jsx(Me,{tone:b===e.secrets.length?"success":"plain",children:b===e.secrets.length?"set":b?`${b} of ${e.secrets.length} set`:"not set"}),n&&s.jsx(Me,{tone:"warning",children:"enter again"})]}),s.jsxs("p",{className:"mt-1.5 font-mono text-small text-muted-foreground",children:[e.kind==="model"?"Model provider":`Unlocks ${e.unlocks.join(", ")}`,e.harnesses.length>0&&` · Harnesses ${e.harnesses.length===1?`${e.harnesses[0]} only`:e.harnesses.join(", ")}`]}),kw(e.label,e.check)&&s.jsx("p",{className:`mt-1.5 text-small ${((x=e.check)==null?void 0:x.state)==="accepted"?"text-success-text":"text-muted-foreground"}`,children:kw(e.label,e.check)}),s.jsx("ul",{className:"mt-3 space-y-1.5",children:e.secrets.map(m=>{var v;return s.jsx(Jd,{field:m,stateSaid:e.secrets.length===1,writable:t&&o===null,note:(v=p(m))!=null&&v.stored_unreadable?EP:void 0,onPaste:()=>l("edit"),onRemove:m.source==="console"?()=>l("remove"):void 0},m.name)})}),!h.length&&s.jsx("p",{className:"mt-3 text-small text-muted-foreground",children:"Set when the server starts, and that one wins: change it where the server is started."})]})]}),o==="edit"&&s.jsx(aN,{tool:e,fields:h,onSave:c,onCancel:()=>l(null)}),o==="remove"&&s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-3 border bg-card p-3",children:[s.jsxs("p",{className:"min-w-0 flex-1 text-body",children:["Remove the ",e.label," key saved here?",e.secrets.some(m=>m.source==="env")?" The one set in the environment stays.":""]}),s.jsx(Z,{size:"sm",variant:"destructive",onClick:()=>void u(),children:"Remove"}),s.jsx(Z,{size:"sm",onClick:()=>l(null),children:"Keep"})]}),i&&s.jsx("div",{className:"mt-4 border",children:s.jsx(Xo,{error:i.error,title:i.title})})]})}function aN({tool:e,fields:t,onSave:n,onCancel:o}){const i=y.useRef(null),[l,c]=y.useState(!1),[u,f]=y.useState(!1),[p,h]=y.useState(null),b=()=>t.some(v=>{var w,j;return(j=(w=i.current)==null?void 0:w.elements.namedItem(v.name))==null?void 0:j.value}),x=()=>{var v;(v=i.current)==null||v.reset(),c(!1)},m=async v=>{var $,_;v.preventDefault();const w={};for(const E of t){const R=(_=($=i.current)==null?void 0:$.elements.namedItem(E.name))==null?void 0:_.value;R&&(w[E.name]=R)}if(!Object.keys(w).length)return;f(!0),h(null);const j=await n(w);if(f(!1),!j){x();return}const S={},T=[];for(const E of j.fields??[]){const R=E.field.startsWith("values.")?E.field.slice(7):null;R&&t.some(C=>C.name===R)?S[R]=E.message:T.push(E.message)}h({fields:S,message:T.length?T.join(" "):Object.keys(S).length?null:j.message})};return s.jsxs("form",{ref:i,autoComplete:"off",onSubmit:v=>void m(v),onInput:()=>c(!!b()),className:"mt-4 space-y-4 border bg-card p-4","aria-label":`${e.label} key`,children:[t.map(v=>s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:v.name}),v.set&&s.jsx("span",{className:"-mt-1 mb-2 block text-small text-muted-foreground",children:"Saved already. A new value replaces it; leave it empty to keep it."}),s.jsx(He,{type:"password",name:v.name,autoComplete:"new-password",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","data-1p-ignore":!0,"data-lpignore":"true"}),(p==null?void 0:p.fields[v.name])&&s.jsx("span",{className:"mt-2 block font-mono text-small text-destructive-text",role:"alert",children:p.fields[v.name]})]},v.name)),(p==null?void 0:p.message)&&s.jsx("p",{className:"font-mono text-small text-destructive-text",role:"alert",children:p.message}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Z,{type:"submit",size:"sm",variant:"solid",disabled:!l||u,children:u?"Saving":"Save"}),s.jsx(Z,{type:"button",size:"sm",onClick:()=>{x(),o()},children:"Cancel"})]})]})}const Jl=y.createContext(null);function Nw({connection:e,children:t}){return s.jsx(Jl.Provider,{value:e,children:t})}const AP={state:"online"},OP=()=>()=>{},Sw=()=>AP;function Eg(){const e=y.useContext(Jl);return y.useSyncExternalStore(e?e.subscribe:OP,e?e.link:Sw,Sw)}function iN(e){const t=y.useContext(Jl),n=y.useRef(e);n.current=e,y.useEffect(()=>t==null?void 0:t.onResume(()=>n.current()),[t])}function lN(e){const[t,n]=y.useState(()=>Date.now());return y.useEffect(()=>{if(e===null)return;n(Date.now());const o=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(o)},[e]),e===null?0:Math.max(0,Math.ceil((e-t)/1e3))}function MP(){const e=y.useContext(Jl),t=Eg(),n=lN(t.state==="offline"?t.retryAt:null);return!e||t.state==="online"?null:t.state==="resumed"?s.jsxs(ns,{bar:!0,tone:"success",icon:b_,"data-connection":"resumed",children:[s.jsx("span",{className:"font-semibold",children:"Resumed."})," agentrun-serve is back."]}):s.jsxs(ns,{bar:!0,tone:"warning",icon:p0,"data-connection":"offline",actions:s.jsx(Z,{type:"button",onClick:e.retryNow,size:"xs",children:"Retry now"}),children:[s.jsxs("span",{className:"font-semibold",children:["Can't reach agentrun-serve at ",location.host,"."]})," Reconnecting… next try in ",n," s. The page shows what it had."]})}function PP(){const e=y.useContext(Jl),t=Eg(),n=lN(t.state==="offline"?t.retryAt:null);return s.jsxs("div",{"data-connection":"offline",role:"status",className:"mx-auto mt-[12vh] max-w-md border bg-card p-6",children:[s.jsx(p0,{className:"size-5 text-warning-text","aria-hidden":!0}),s.jsxs("p",{className:"mt-3 text-base font-semibold",children:["Can't reach agentrun-serve at ",location.host,"."]}),s.jsx("p",{className:"mt-2 text-lead leading-relaxed text-muted-foreground",children:"Is it running? This page connects by itself as soon as the server answers."}),s.jsxs("div",{className:"mt-4 flex items-center gap-3",children:[s.jsx(Z,{type:"button",onClick:e==null?void 0:e.retryNow,size:"sm",children:"Retry now"}),s.jsxs("span",{className:"font-mono text-small text-muted-foreground",children:["Next try in ",n," s"]})]})]})}const LP=[{id:"keys",label:"Tool keys"},{id:"tools",label:"Tools"},{id:"mcp",label:"MCP servers"},{id:"github",label:"GitHub"},{id:"computers",label:"Computers"},{id:"workspace",label:"Workspace"},{id:"webhook",label:"Webhook"}];function IP({active:e,offered:t,children:n}){return s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[t.length>1&&s.jsx("nav",{"aria-label":"Settings",className:"flex shrink-0 gap-1 border-b px-6",children:LP.filter(o=>t.includes(o.id)).map(o=>s.jsx("a",{href:`#/settings/${o.id}`,"aria-current":e===o.id?"page":void 0,className:oe("caps -mb-px border-b-2 px-3 py-3 text-small",e===o.id?"border-primary text-primary-text":"border-transparent text-muted-foreground hover:text-foreground"),children:o.label},o.id))}),s.jsx("div",{className:"min-h-0 flex-1",children:n})]})}const _w=e=>e instanceof Ee?e.toApiError():{code:"network",message:e instanceof Error?e.message:String(e),retryable:!1};function zP({v2:e,choices:t,gates:n=[],harnesses:o,onSaved:i,onOpen:l}){const[c,u]=y.useState(null),[f,p]=y.useState(null),[h,b]=y.useState(null),[x,m]=y.useState(!1),[v,w]=y.useState(null),j=y.useRef(0),S=()=>{const W=++j.current;e.toolSettings().then(X=>{W===j.current&&(u(X),p(null))},X=>{W===j.current&&p(_w(X))})};y.useEffect(S,[e]);const[T,$]=y.useState("reading"),_=()=>{$("reading"),Promise.resolve(l==null?void 0:l()).then(W=>$(W===!1?"failed":"landed"))},E=()=>{S(),_()};if(y.useEffect(_,[]),!c)return f?s.jsx(ns,{tone:"error",className:"m-8",actions:s.jsx(Z,{type:"button",size:"xs",onClick:S,children:"Try again"}),children:s.jsxs("p",{className:"font-mono",children:["The tool settings could not be read: ",f.code,": ",f.message]})}):s.jsx("p",{className:"p-8 text-center font-mono text-body text-muted-foreground",children:"Loading..."});const R=Jb(c,t),C=v?v(R):R,O=Jj(t,n),z=Object.entries(C).filter(([,W])=>(W==null?void 0:W.pin)||(W==null?void 0:W.pin_broken)),F=W=>{var M;const X=n.find(K=>K.name===W);return!X||(((M=C[W])==null?void 0:M.permission)??X.default_permission)===X.permission},{byTool:D,rest:B}=wj((h==null?void 0:h.fields)??{},"",O.map(W=>W.name)),U=async W=>{var L;const X=v?I=>W(v(I)):W;m(!0),b(null);const M=++j.current;let K;try{K=await e.toolSettings()}catch{w(()=>X),b({fields:{},error:null,unread:!0}),m(!1);return}try{const I=await e.saveToolSettings(X(Jb(K,t)));w(null),M===j.current&&(u(I),p(null)),i()}catch(I){b(I instanceof Ee&&I.status===422&&((L=I.fields)!=null&&L.length)?{fields:Object.fromEntries(I.fields.map(G=>[G.field,G.message])),error:null}:{fields:{},error:_w(I)})}m(!1)};return s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1100px] space-y-6 px-6 py-8",children:[s.jsxs("div",{children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:"Settings"}),s.jsx("h1",{className:"mt-1 text-2xl font-semibold",children:"Tools"}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:"This server's provider for each tool that has a choice, and what it resolves to on each harness. A change is saved at once and applies to every run launched from then on. An agent with a provider of its own keeps it."}),n.length>0&&s.jsxs("p",{className:"mt-2 text-lead text-muted-foreground",children:["Each tool's permission: ",s.jsx("span",{className:"font-mono text-body",children:"allow"})," runs it, ",s.jsx("span",{className:"font-mono text-body",children:"ask"})," makes the run wait for your approval at each call, ",s.jsx("span",{className:"font-mono text-body",children:"deny"})," refuses it and tells the agent why. A permission applies at the next call, in runs already going too. An agent's own allow or ask takes the place of this server's; deny here refuses it for every agent."]})]}),s.jsxs("section",{"aria-label":"This server's providers",children:[O.length?s.jsx(eN,{label:"This server's tool settings",rows:O,settings:C,fallbackOf:W=>W.default_provider,issues:D,busy:x,onEdit:W=>void U(W),refused:(W,X)=>X==="deny",resolvesOf:(W,X)=>X===W.provider&&F(W.name)?s.jsx(GM,{choice:W,harnesses:o}):T==="reading"?s.jsx("span",{className:"block font-mono text-small text-muted-foreground",children:"reading…"}):s.jsxs("span",{className:"block text-small text-muted-foreground",children:[T==="failed"?"What it resolves to couldn't be read.":"It changed while this page read it."," ",s.jsx(Z,{type:"button",onClick:E,disabled:x,size:"xs",className:"ml-1",children:"Retry"})]})}):s.jsx("p",{className:"border px-3 py-4 font-mono text-body text-muted-foreground",children:"This server offers no tool with a choice of provider."}),B.map(W=>s.jsx("p",{className:"mt-2 font-mono text-small text-destructive-text",role:"alert",children:W},W)),(h==null?void 0:h.error)&&s.jsx("div",{className:"mt-3 border",children:s.jsx(Xo,{error:h.error,title:"The change was not saved"})}),(h==null?void 0:h.unread)&&s.jsxs("div",{className:"mt-3 border p-3",role:"alert",children:[s.jsx("p",{className:"font-mono text-small text-destructive-text",children:"Couldn't read the current settings, so nothing was saved. Try again."}),s.jsx(Z,{type:"button",size:"xs",className:"mt-2",onClick:()=>void U(W=>W),disabled:x,children:"Try again"})]}),f&&s.jsxs("div",{className:"mt-3 border p-3",role:"alert",children:[s.jsxs("p",{className:"font-mono text-small text-destructive-text",children:["The tool settings could not be read again: ",f.code,": ",f.message]}),s.jsx("p",{className:"mt-1 text-small text-muted-foreground",children:"The table shows the last ones read."}),s.jsx(Z,{type:"button",onClick:E,disabled:x,size:"xs",className:"mt-2",children:"Try again"})]})]}),z.length>0&&s.jsxs("section",{"aria-label":"Pinned tools",children:[s.jsx("h2",{className:"caps text-small font-semibold",children:"Pinned tools"}),s.jsx("p",{className:"mt-1 text-body text-muted-foreground",children:"A pin bounds a tool's calls for every agent on this server, its own pin beside it."}),s.jsx("ul",{className:"mt-2 border",children:z.map(([W,X])=>s.jsxs("li",{"data-pin":W,className:"border-b px-3 py-2.5 last:border-b-0",children:[s.jsx("p",{className:"font-mono text-body",children:W}),s.jsx(nh,{setting:X})]},W))})]})]})})}function DP(e){const t=new URLSearchParams(e??""),n=t.get("github");if(n==="connected")return{ok:!0};if(n==="error"){const o=t.get("reason");return o?{ok:!1,reason:o}:{ok:!1}}}const $w={state_invalid:"That connection was started elsewhere or has expired. Start again.",conversion_failed:"GitHub didn't hand back the App. Try connecting again.",installation_unverified:"The App's install couldn't be confirmed. Install it again from GitHub.",already_connected:"Another GitHub App was connected while this one was being created. Delete the new App on GitHub."},FP=e=>e.ok?"Connected. The App is installed.":e.reason&&Object.hasOwn($w,e.reason)?$w[e.reason]:"The connection didn't finish. Try again.";function UP(e,t){const n=t(e);if(!n)return;const o=new URL(n);return o.protocol==="https:"&&o.hostname==="github.com"?n:void 0}function Lo(e){if(!(typeof e!="string"||!e))try{const t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t.href:void 0}catch{return}}function WP({note:e}){const t=e.lastIndexOf(": "),n=t>=0?e.slice(t+2).trim():"",o=n?Lo(n):void 0;return o?s.jsxs(s.Fragment,{children:[e.slice(0,t+2),s.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"break-all underline underline-offset-2",children:n})]}):s.jsx(s.Fragment,{children:e})}function HP({v2:e,returned:t}){const[n,o]=y.useState(void 0),[i,l]=y.useState(null),[c,u]=y.useState(""),[f,p]=y.useState(!1),[h,b]=y.useState(null),[x,m]=y.useState(null),[v,w]=y.useState(null),[j,S]=y.useState(!1),[T,$]=y.useState(null),_=y.useRef(!1),E=y.useRef(null),R=y.useCallback(async()=>{try{const F=await e.githubConnection();o(F.connected?F:null),l(null)}catch(F){l(F instanceof Error?F.message:String(F))}},[e]);y.useEffect(()=>{R()},[R]),y.useEffect(()=>{t&&history.replaceState(null,"",`${location.pathname}${location.search}#/settings/github`)},[]),y.useEffect(()=>{var F;h&&((F=E.current)==null||F.submit())},[h]);const C=async()=>{var F;if(!_.current){_.current=!0,p(!0),m(null),w(null),$(null);try{const D=await e.connectGitHub(c.trim()||void 0),B=UP(D.action,Lo);if(!B){m("GitHub's address didn't look right, so nothing was sent."),_.current=!1,p(!1);return}b({action:B,manifest:JSON.stringify(D.manifest)})}catch(D){if(_.current=!1,p(!1),m(D instanceof Error?D.message:String(D)),D instanceof Ee&&D.code==="github_wrong_origin"){const B=(F=D.details)==null?void 0:F.public_url;w(typeof B=="string"&&Lo(B)||null)}D instanceof Ee&&D.code==="github_already_connected"&&R()}}},O=async()=>{S(!1),p(!0),m(null),w(null);try{$(await e.disconnectGitHub()),o(null)}catch(F){F instanceof Ee&&(F.status===404||F.code==="github_not_connected")?await R():m(F instanceof Error?F.message:String(F))}finally{p(!1)}},z=n?Lo(`https://github.com/apps/${encodeURIComponent(n.slug)}`):void 0;return s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1100px] space-y-6 px-6 py-8",children:[s.jsxs("div",{children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:"Settings"}),s.jsx("h1",{className:"mt-1 text-2xl font-semibold",children:"GitHub"}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:"One GitHub App for this server: its templates and triggers reach GitHub through it."})]}),t&&s.jsx("p",{"aria-label":"From GitHub",role:"status",className:oe("border p-4 text-lead",t.ok?"border-success/50 bg-success/5":"border-warning/50 bg-warning/5 text-warning-text"),children:FP(t)}),(x||v)&&s.jsx("div",{role:"alert",className:"border border-destructive/50 px-4 py-3 text-lead text-destructive-text",children:v?s.jsxs("p",{children:["Open this server at ",s.jsx("a",{href:v,className:"break-all underline underline-offset-2",children:v})," to connect GitHub."]}):s.jsx("p",{children:x})}),T&&s.jsxs("section",{"aria-label":"Disconnected",className:"border p-4 text-lead",children:[s.jsx("p",{children:s.jsx(WP,{note:T.note})}),s.jsx("p",{className:"mt-1 text-muted-foreground",children:T.triggers_off?`${T.triggers_off} GitHub ${T.triggers_off===1?"trigger":"triggers"} turned off.`:"No GitHub trigger was on."})]}),i&&s.jsx(ns,{tone:"error",actions:s.jsx(Z,{type:"button",size:"xs",onClick:()=>void R(),children:"Try again"}),children:s.jsxs("p",{className:"font-mono",children:["GitHub's connection could not be read: ",i]})}),n===void 0&&!i&&s.jsx("p",{className:"font-mono text-body text-muted-foreground",children:"Loading..."}),n===null&&s.jsxs("section",{"aria-label":"Connect GitHub",className:"border bg-card p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-end gap-3",children:[s.jsxs("label",{className:"flex min-w-[240px] flex-1 flex-col gap-1 text-body",children:[s.jsx("span",{className:"text-muted-foreground",children:"Organization (optional): the App is made under it"}),s.jsx(He,{name:"org",value:c,onChange:F=>u(F.target.value),disabled:f,placeholder:"your-org",className:"h-9 w-auto"})]}),s.jsxs(Z,{type:"button",variant:"solid",onClick:()=>void C(),disabled:f,children:[s.jsx(vv,{"aria-hidden":!0}),h?"Opening GitHub…":"Connect GitHub"]})]}),s.jsx("p",{className:"mt-3 text-body text-muted-foreground",children:"GitHub asks you to create the App, then to install it on the accounts it may use. You come back here after."})]}),n&&s.jsxs("section",{"aria-label":"GitHub App",className:"border bg-card p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-lead",children:[s.jsx(vv,{className:"size-4 text-muted-foreground","aria-hidden":!0}),z?s.jsx("a",{href:z,target:"_blank",rel:"noopener noreferrer",className:"font-mono underline underline-offset-2",children:n.slug}):s.jsx("span",{className:"font-mono",children:n.slug}),s.jsxs("span",{className:"font-mono text-small text-muted-foreground",children:["App ",n.app_id]})]}),n.installations.length?s.jsx("ul",{"aria-label":"Installations",className:"mt-3 space-y-1 font-mono text-body",children:n.installations.map(F=>s.jsx("li",{children:F.account},F.id))}):s.jsx("p",{className:"mt-3 text-body text-muted-foreground",children:"Not installed on any account yet."}),j?s.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 text-body",role:"alertdialog","aria-label":"Disconnect GitHub?",children:[s.jsx("span",{children:"Disconnect GitHub? Every GitHub trigger turns off."}),s.jsx(Z,{type:"button",variant:"destructive",disabled:f,onClick:()=>void O(),children:"Disconnect GitHub"}),s.jsx(Z,{type:"button",variant:"ghost",onClick:()=>S(!1),children:"Cancel"})]}):s.jsx(Z,{type:"button",variant:"outline",className:"mt-4",disabled:f,onClick:()=>S(!0),children:"Disconnect"})]}),h&&s.jsx("form",{"data-github-manifest":!0,ref:E,method:"post",action:h.action,hidden:!0,children:s.jsx("input",{type:"hidden",name:"manifest",defaultValue:h.manifest})})]})})}const BP=8,GP={sealed:["sealed","success"],expired:["sign-in expired","warning"],unreadable:["can't be opened: enter it again","warning"]};function qP({v2:e,signIn:t,writable:n,whyNot:o="sign_in",open:i=l=>location.assign(l)}){var v;const[l,c]=y.useState(null),[u,f]=y.useState(null),[p,h]=y.useState(null),b=y.useRef(0),x=()=>{const w=++b.current;e.listMcpServers().then(j=>{w===b.current&&(c(j.servers),f(null))},j=>{w===b.current&&f(El(j))})};y.useEffect(x,[e]),y.useEffect(()=>{t&&location.hash.includes("sign_in=")&&history.replaceState(null,"","#/settings/mcp")},[t]);const m=async(w,j)=>i((await e.startMcpSignIn(w,j)).authorization_url);return s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1100px] space-y-6 px-6 py-8",children:[s.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:"Settings"}),s.jsx("h1",{className:"mt-1 text-2xl font-semibold",children:"MCP servers"}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:"A remote MCP server's tools, for any agent you grant them to in its Tools step. A saved credential is never shown again."})]}),!p&&s.jsx(Z,{size:"sm",variant:"primary",onClick:()=>h({}),children:"Add server"})]}),t&&s.jsx("p",{className:`border p-4 text-body ${t.ok?"border-success/50 text-success-text":"border-warning/50 text-warning-text"}`,role:"status",children:t.ok?`Signed in to ${t.server}. Its tools are saved.`:`Signing in to ${t.server} failed: ${yO(t.error)}.`}),!n&&s.jsx("p",{className:"border bg-card p-4 text-body",role:"status",children:Zl[o]}),u&&s.jsx(ns,{tone:"error",actions:s.jsx(Z,{type:"button",size:"xs",onClick:x,children:"Try again"}),children:s.jsxs("p",{className:"font-mono",children:["The MCP servers could not be read. ",u.text]})}),p&&s.jsx(QP,{v2:e,saved:p.saved,writable:n,signIn:m,onCancel:()=>h(null),onSaved:(w=>()=>{h(j=>j===w?null:j),x()})(p)},((v=p.saved)==null?void 0:v.name)??"new"),l&&(l.length?s.jsx("ul",{className:"border",children:l.map(w=>s.jsx(VP,{v2:e,server:w,writable:n&&!p,signIn:m,onChange:()=>h({saved:w}),onChanged:x},w.name))}):s.jsx("p",{className:"border px-3 py-4 font-mono text-body text-muted-foreground",children:"No MCP server is saved here yet."})),s.jsx(KP,{v2:e})]})})}const Tg=({problem:e})=>s.jsxs("div",{role:"alert",children:[s.jsx("p",{className:"font-mono text-body text-destructive-text",children:e.text}),e.detail&&s.jsx("p",{className:"mt-1 text-small text-muted-foreground",children:e.detail})]});function VP({v2:e,server:t,writable:n,signIn:o,onChange:i,onChanged:l}){var $;const[c,u]=y.useState(!1),[f,p]=y.useState(!1),[h,b]=y.useState(null),[x,m]=y.useState(null),v=async _=>{u(!0),m(null);try{await _()}catch(E){m(El(E))}u(!1)},[w,j]=t.credential?GP[t.credential]??[t.credential,"plain"]:["no credential","plain"],S=t.auth.type==="oauth",T=h&&[["Added",h.added],["Removed",h.removed],["Changed",h.changed]].filter(([,_])=>_.length).map(([_,E])=>`${_} ${E.join(", ")}`);return s.jsxs("li",{"data-server":t.name,className:"border-b p-4 last:border-b-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[s.jsx(v_,{className:"mt-1 size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-mono text-prose font-semibold",children:t.name}),s.jsx(Me,{tone:j,children:w}),!!(($=t.not_metered)!=null&&$.length)&&s.jsx(Me,{tone:"plain",children:"not metered"})]}),s.jsx("p",{className:"mt-1.5 break-all font-mono text-small text-muted-foreground",children:t.url}),S&&t.oauth&&s.jsxs("p",{className:"mt-1 font-mono text-small text-muted-foreground",children:["Signed in with OAuth",t.oauth.scopes.length?` · ${t.oauth.scopes.join(" ")}`:"",t.oauth.client==="pre-registered"&&t.oauth.client_id?` · client ${t.oauth.client_id}`:"",t.credential==="expired"?" · sign-in expired: sign in again":t.oauth.expires_at?` · token until ${St(t.oauth.expires_at)}`:""]}),s.jsxs("details",{className:"mt-2",children:[s.jsxs("summary",{className:"cursor-pointer font-mono text-small",children:[t.tools.length," tool",t.tools.length===1?"":"s"]}),s.jsx("ul",{className:"mt-1 space-y-0.5",children:t.tools.map(_=>{var E,R;return s.jsxs("li",{className:"font-mono text-small",children:[_.name,((E=t.prices)==null?void 0:E[_.name])!==void 0&&s.jsxs("span",{className:"text-muted-foreground",children:[" · $",t.prices[_.name]," a call"]}),((R=t.not_metered)==null?void 0:R.includes(_.name))&&s.jsx("span",{className:"text-muted-foreground",children:" · not metered"})]},_.name)})})]}),t.secret&&s.jsx("ul",{className:"mt-2",children:s.jsx(Jd,{field:t.secret,label:YP[t.auth.type],writable:n,onPaste:S?void 0:i})}),T&&s.jsx("p",{className:"mt-2 font-mono text-small",role:"status",children:T.length?T.join(" · "):"No change: it lists the same tools."})]}),!f&&s.jsxs("div",{className:"flex flex-wrap gap-2",children:[S&&t.credential!=="sealed"&&n&&s.jsx(Z,{size:"sm",variant:"primary",disabled:c,onClick:()=>void v(()=>{var _;return o(t.name,{url:t.url,...(_=t.oauth)!=null&&_.scopes.length?{scopes:t.oauth.scopes}:{}})}),children:"Sign in again"}),s.jsx(Z,{size:"sm",disabled:c,onClick:()=>void v(async()=>{try{b(await e.refreshMcpServer(t.name))}finally{l()}}),children:"Refresh"}),s.jsx(Z,{size:"sm",disabled:c,onClick:i,children:"Change"}),s.jsx(Z,{size:"sm",variant:"destructive",disabled:c,onClick:()=>p(!0),children:"Delete"})]})]}),f&&s.jsxs("div",{role:"alertdialog","aria-label":`Delete ${t.name}`,className:"mt-4 flex flex-wrap items-center gap-3 border bg-card p-3",children:[s.jsxs("p",{className:"min-w-0 flex-1 text-body",children:["Delete ",t.name,"? Its credential goes with it, and an agent that grants its tools can't call them."]}),s.jsx(Z,{size:"sm",variant:"destructive",disabled:c,onClick:()=>void v(async()=>{await e.deleteMcpServer(t.name),l()}),children:"Delete"}),s.jsx(Z,{size:"sm",onClick:()=>p(!1),children:"Keep"})]}),x&&s.jsx("div",{className:"mt-3",children:s.jsx(Tg,{problem:x})})]})}function KP({v2:e}){const[t,n]=y.useState(null),[o,i]=y.useState(null),[l,c]=y.useState(null),[u,f]=y.useState(!1),[p,h]=y.useState(""),b=()=>void e.mcpPrivateHosts().then(v=>{n(v.hosts),i(null)},v=>i(El(v)));y.useEffect(b,[e]);const x=async v=>{f(!0),c(null);try{return n((await e.saveMcpPrivateHosts(v)).hosts),!0}catch(w){return c(El(w)),!1}finally{f(!1)}},m=async v=>{v.preventDefault(),t&&p.trim()&&await x([...t,p.trim()])&&h("")};return s.jsxs("section",{"aria-labelledby":"mcp-private-hosts",className:"space-y-3 border bg-card p-4",children:[s.jsx("h2",{id:"mcp-private-hosts",className:"caps text-small font-semibold",children:"Private network hosts"}),s.jsx("p",{className:"text-body text-muted-foreground",children:"Off by default. A host listed here may run an MCP server's sign-in on your private network (10.x, 172.16–31.x, 192.168.x, 100.64–127.x, fc00::/7), over https only; never this machine, loopback or a link-local address such as cloud metadata."}),o&&s.jsxs("div",{role:"alert",children:[s.jsxs("p",{className:"font-mono text-body text-destructive-text",children:["The private network hosts could not be read. ",o.text]}),s.jsx(Z,{size:"sm",onClick:b,className:"mt-3",children:"Try again"})]}),t&&(t.length?s.jsx("ul",{"aria-label":"Allowed private network hosts",className:"border bg-background",children:t.map(v=>s.jsxs("li",{"data-host":v,className:"flex items-center justify-between gap-3 border-b px-3 py-2 last:border-b-0",children:[s.jsx("span",{className:"break-all font-mono text-body",children:v}),s.jsx(Z,{size:"sm",disabled:u,onClick:()=>void x(t.filter(w=>w!==v)),children:"Remove"})]},v))}):s.jsx("p",{className:"border bg-background px-3 py-3 font-mono text-body text-muted-foreground",children:"No host is allowed: a sign-in on a private network is refused."})),t&&s.jsxs("form",{onSubmit:v=>void m(v),"aria-label":"Allow a private network host",className:"flex gap-2",children:[s.jsx(He,{name:"mcp-private-host","aria-label":"Host name or IP address",value:p,onChange:v=>h(v.target.value),placeholder:"auth.corp.example",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off"}),s.jsx(Z,{type:"submit",size:"sm",variant:"solid",disabled:u||!p.trim(),children:"Allow"})]}),l&&s.jsx(Tg,{problem:l})]})}const xp={type:"password",autoComplete:"new-password",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","data-1p-ignore":!0,"data-lpignore":"true"},XP=[["none","None"],["bearer","Bearer token"],["headers","Headers"],["oauth","Sign in with OAuth"]],YP={none:"Credential",bearer:"Bearer token",headers:"Headers",oauth:"OAuth sign-in"};function QP({v2:e,saved:t,writable:n,signIn:o,onCancel:i,onSaved:l}){var I,G,P,q,ne;const c=y.useRef(null),[u,f]=y.useState((t==null?void 0:t.name)??""),[p,h]=y.useState((t==null?void 0:t.url)??""),[b,x]=y.useState((t==null?void 0:t.auth.type)??"none"),[m,v]=y.useState(Math.max(1,((I=t==null?void 0:t.auth.headers)==null?void 0:I.length)??0)),[w,j]=y.useState(null),[S,T]=y.useState(null),[$,_]=y.useState(!1),E=y.useRef(0),R=()=>{E.current++,j(null)},C=ae=>{var ie,ce;return(((ce=(ie=c.current)==null?void 0:ie.elements.namedItem(ae))==null?void 0:ce.value)??"").trim()},[O,z]=y.useState(!1),F=ae=>{try{return new URL(ae).origin}catch{return ae}},D=(ae=b)=>{var ie;return z(!!t&&ae==="oauth"&&(t.auth.type!=="oauth"||C("mcp-scopes")!==(((ie=t.oauth)==null?void 0:ie.scopes.join(" "))??"")||!!C("mcp-client-id")||!!C("mcp-client-secret")||F(C("mcp-url"))!==F(t.url)))};y.useEffect(()=>D(),[b]);const B=()=>{if(b==="bearer")return C("mcp-token")?{type:b,token:C("mcp-token")}:{type:b};if(b!=="headers")return{type:b};const ae=Object.fromEntries(Array.from({length:m},(ie,ce)=>[C(`mcp-header-name-${ce}`),C(`mcp-header-value-${ce}`)]).filter(([ie,ce])=>ie&&ce));return Object.keys(ae).length?{type:b,headers:ae}:{type:b}},U=async ae=>{_(!0),T(null);try{await ae()}catch(ie){T(El(ie))}_(!1)},W=()=>U(()=>{const ae=C("mcp-scopes").split(/\s+/).filter(Boolean),ie=C("mcp-client-id");return o(u.trim(),{url:p.trim(),...ae.length?{scopes:ae}:{},...ie?{client_id:ie,...C("mcp-client-secret")?{client_secret:C("mcp-client-secret")}:{}}:{}})}),X=()=>{const ae=E.current;U(async()=>{try{const ie=await e.previewMcpServer(p.trim(),B());ae===E.current&&j(ie)}catch(ie){if(ae===E.current)throw ie}})},M=ae=>{if(ae.preventDefault(),b==="oauth"&&(!t||O))return void W();U(async()=>{var ie;await e.saveMcpServer(u.trim(),p.trim(),B()),(ie=c.current)==null||ie.reset(),l()})},K=!$&&!!u.trim()&&!!p.trim()&&(!!t||!!w),L=ae=>(t==null?void 0:t.credential)==="sealed"&&t.auth.type===b&&s.jsxs("span",{className:"-mt-1 mb-2 block text-small text-muted-foreground",children:["Saved. ",ae]});return s.jsxs("form",{ref:c,autoComplete:"off",onSubmit:M,"aria-label":t?`Change ${t.name}`:"Add an MCP server",className:"space-y-4 border bg-card p-4",onInput:ae=>{ae.target.name!=="mcp-name"&&R(),D()},children:[s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:"Name"}),s.jsxs("span",{className:"-mt-1 mb-2 block text-small text-muted-foreground",children:["Lowercase letters, digits and dashes: an agent grants its tools as mcp:",u.trim()||"<name>","/<tool>."]}),s.jsx(He,{name:"mcp-name",value:u,readOnly:!!t,onChange:ae=>f(ae.target.value),spellCheck:!1})]}),s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:"Address"}),s.jsx(He,{name:"mcp-url",value:p,onChange:ae=>h(ae.target.value),placeholder:"https://mcp.example.com/mcp",spellCheck:!1})]}),s.jsxs("fieldset",{children:[s.jsx("legend",{className:"caps mb-2 text-small font-semibold",children:"Credential"}),s.jsx("div",{className:"flex flex-wrap gap-4",children:XP.map(([ae,ie])=>s.jsxs("label",{className:"flex items-center gap-2 text-body",children:[s.jsx("input",{type:"radio",name:"mcp-auth",value:ae,checked:b===ae,disabled:!n&&ae!=="none",onChange:()=>{x(ae),R()},className:"accent-primary"}),ie]},ae))})]}),b==="bearer"&&s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:"Token"}),L("A new token replaces it; leave this empty to keep it."),s.jsx(He,{name:"mcp-token",...xp})]}),b==="headers"&&s.jsxs("div",{className:"space-y-2",children:[L(`Its headers: ${(G=t==null?void 0:t.auth.headers)==null?void 0:G.join(", ")}. New ones replace them all; leave the values empty to keep them.`),Array.from({length:m},(ae,ie)=>{var ce;return s.jsxs("div",{className:"flex gap-2",children:[s.jsx(He,{name:`mcp-header-name-${ie}`,"aria-label":`Header ${ie+1} name`,placeholder:"X-Api-Key",defaultValue:(ce=t==null?void 0:t.auth.headers)==null?void 0:ce[ie],spellCheck:!1}),s.jsx(He,{name:`mcp-header-value-${ie}`,"aria-label":`Header ${ie+1} value`,...xp})]},ie)}),m<BP&&s.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>v(ae=>ae+1),children:"Add header"})]}),b==="oauth"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-small text-muted-foreground",children:"This server signs in for you and keeps the tokens; an agent never sees one. Sign in opens the server's own page to approve it, and its tools are saved once you do."}),((P=t==null?void 0:t.oauth)==null?void 0:P.client_id)&&s.jsxs("p",{className:"text-small text-muted-foreground",children:["Signing in again uses the client it signed in with (",t.oauth.client_id,"); a client ID here replaces it."]}),s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:"Scopes (optional)"}),s.jsx(He,{name:"mcp-scopes",placeholder:"read write",defaultValue:(q=t==null?void 0:t.oauth)==null?void 0:q.scopes.join(" "),spellCheck:!1})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("label",{className:"block flex-1",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:"Client ID (optional)"}),s.jsx(He,{name:"mcp-client-id",spellCheck:!1})]}),n&&s.jsxs("label",{className:"block flex-1",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:"Client secret (optional)"}),s.jsx(He,{name:"mcp-client-secret",...xp})]})]})]}),S&&s.jsxs("div",{className:"space-y-2",children:[s.jsx(Tg,{problem:S}),S.signIn&&b!=="oauth"&&n&&s.jsx(Z,{type:"button",size:"sm",variant:"primary",disabled:$||!u.trim(),onClick:()=>void W(),children:"Sign in"})]}),w&&s.jsxs("section",{"aria-label":"Preview",className:"border bg-background p-3",children:[s.jsxs("p",{className:"font-mono text-small text-muted-foreground",children:["MCP ",w.protocol,(ne=w.server_info)!=null&&ne.name?` · ${w.server_info.name}${w.server_info.version?` ${w.server_info.version}`:""}`:""," · ",w.tools.length," tool",w.tools.length===1?"":"s"]}),w.instructions&&s.jsx("p",{className:"mt-2 whitespace-pre-wrap text-small",children:w.instructions}),s.jsx("p",{className:"mt-2 text-small text-muted-foreground",children:dO}),s.jsx("ul",{"aria-label":"Tools it lists",className:"mt-2 divide-y border",children:w.tools.map(ae=>s.jsxs("li",{className:"px-3 py-2",children:[s.jsx("span",{className:"font-mono text-body",children:ae.name}),ae.title&&s.jsx("span",{className:"ml-2 text-small",children:ae.title}),ae.description&&s.jsx("span",{className:"mt-0.5 block text-small text-muted-foreground",children:ae.description})]},ae.name))})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[b==="oauth"&&!n?null:b==="oauth"&&O?s.jsx(Z,{type:"submit",size:"sm",variant:"solid",disabled:$||!p.trim(),children:"Sign in again with these settings"}):b==="oauth"?s.jsx(Z,{type:"button",size:"sm",variant:"solid",disabled:$||!u.trim()||!p.trim(),onClick:()=>void W(),children:t?"Sign in again":"Sign in"}):s.jsx(Z,{type:"button",size:"sm",disabled:$||!p.trim(),onClick:X,children:"Preview"}),(b!=="oauth"||t&&!O)&&s.jsx(Z,{type:"submit",size:"sm",variant:"solid",disabled:!K,children:$?"Working":"Save"}),s.jsx(Z,{type:"button",size:"sm",onClick:()=>{var ae;(ae=c.current)==null||ae.reset(),i()},children:"Cancel"})]})]})}const Ew=e=>e instanceof Ee?e.toApiError():{code:"network",message:e instanceof Error?e.message:String(e),retryable:!1};function ZP({v2:e,needs:t,model:n,onSaved:o,writable:i,whyNot:l="sign_in"}){const[c,u]=y.useState(null),[f,p]=y.useState(null),[h,b]=y.useState(null),[x,m]=y.useState(null),v=y.useRef(0),w=()=>{const E=++v.current;e.listToolKeys().then(R=>{E===v.current&&(u(R.keys.filter(C=>C.kind==="model")),p(null))}).catch(R=>{E===v.current&&p(Ew(R))})};y.useEffect(()=>{t!=="model"&&w()},[e,t]);const j=n!=null&&n.includes("/")?n.slice(0,n.indexOf("/")):void 0,S=c==null?void 0:c.find(E=>E.id===j),T=S?[S]:c,$=c==null?void 0:c.find(E=>E.id===h),_=($==null?void 0:$.fields.filter(E=>{var R;return((R=$.secrets.find(C=>ad(C.name)===E.name))==null?void 0:R.source)!=="env"}))??[];return s.jsx("section",{className:"border-b bg-card px-5 py-5 md:px-8","aria-label":"Model key",children:s.jsxs("div",{className:"mx-auto flex max-w-[1600px] gap-3",children:[s.jsx(Al,{className:"mt-1 size-4 shrink-0 text-warning-text","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-3",children:[s.jsx("h2",{className:"text-prose font-semibold",children:t==="model"?"This server's default model doesn't run":"Add a model key to run agents"}),t==="model"?s.jsx("p",{className:"text-body text-muted-foreground",children:"The server's AGENT_MODEL names a model it doesn't know, so an agent that names no model can't run. Set AGENT_MODEL to a provider/model-id where the server starts, or name a model in each agent."}):S?s.jsxs("p",{className:"text-body text-muted-foreground",children:["This server's default model is ",s.jsx("span",{className:"font-mono",children:n}),", and no ",S.label," key is set, so an agent that names no model can't run. Save the ",S.label," key: such an agent then runs on that model."]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-body text-muted-foreground",children:"No model provider's key is set on this server, so an agent that names no model can't run. Save one: such an agent then runs on that provider's everyday model."}),s.jsx("p",{className:"text-body text-muted-foreground",children:oN})]}),t!=="model"&&f&&s.jsxs("div",{role:"alert",children:[s.jsxs("p",{className:"font-mono text-body text-destructive-text",children:["The keys could not be read: ",f.code,": ",f.message]}),s.jsx(Z,{type:"button",onClick:w,size:"sm",className:"mt-2",children:"Try again"})]}),t!=="model"&&c&&!i&&s.jsx("p",{className:"text-body",role:"status",children:Zl[l]}),t!=="model"&&c&&i&&s.jsx("div",{className:"flex flex-wrap gap-2",role:"group","aria-label":"Provider",children:T.map(E=>s.jsx(Z,{size:"sm",variant:h===E.id?"solid":"primary","aria-pressed":h===E.id,onClick:()=>{b(h===E.id?null:E.id),m(null)},children:E.label},E.id))}),$&&i&&(_.length?s.jsx(aN,{tool:$,fields:_,onCancel:()=>b(null),onSave:async E=>{m(null);try{await e.saveToolKey($.id,E)}catch(R){return R instanceof Ee&&R.status===422?R:(m(Ew(R)),null)}return b(null),w(),o==null||o(),null}},$.id):s.jsxs("p",{className:"text-body text-muted-foreground",children:["The server sets the ",$.label," key when it starts: change it there."]})),x&&s.jsx("div",{className:"border",children:s.jsx(Xo,{error:x,title:"The key was not saved"})}),s.jsxs("p",{className:"text-small text-muted-foreground",children:["Every key is in ",s.jsx("a",{className:"underline underline-offset-2 hover:text-foreground",href:"#/settings/keys",children:"Settings"}),"."]})]})]})})}function JP({needs:e,settings:t,model:n,source:o}){return s.jsx("p",{role:"status","aria-label":"No model",className:"border-b bg-card px-5 py-3 text-body text-warning-text md:px-8",children:e==="model"?"This server's default model doesn't run here: set AGENT_MODEL to a model it knows, and restart.":s.jsxs(s.Fragment,{children:["No model yet."," ",o==="gateway"?s.jsxs(s.Fragment,{children:["This server sends its models to a gateway: name the gateway's model in AGENT_MODEL where AgentRun starts, and restart",t?s.jsxs(s.Fragment,{children:[", or ",s.jsx("a",{href:"#/settings/keys",className:"underline underline-offset-2",children:"add a model key in Settings → Model keys"})]}):null,"."]}):n?`This server's default model is ${n}: set its provider's key where AgentRun starts, and restart.`:t?s.jsxs(s.Fragment,{children:[s.jsx("a",{href:"#/settings/keys",className:"underline underline-offset-2",children:"Add a key in Settings → Model keys"})," (one OpenRouter key gives every harness its model), and it takes effect at once. Or set OPENROUTER_API_KEY, ANTHROPIC_API_KEY or OPENAI_API_KEY where AgentRun starts, and restart."]}):"Set OPENROUTER_API_KEY (one key gives every harness its model), or ANTHROPIC_API_KEY or OPENAI_API_KEY, and restart."]})})}const Tw=e=>e instanceof Ee?e.toApiError():{code:"network",message:e instanceof Error?e.message:String(e),retryable:!1},eL={unreadable:"Its secret can't sign here: it was sealed under another key, or is damaged. Nothing is sent until the webhook is removed and set again."};function tL({v2:e}){const[t,n]=y.useState(null),[o,i]=y.useState([]),[l,c]=y.useState(null),[u,f]=y.useState(null),[p,h]=y.useState(null),[b,x]=y.useState(null),[m,v]=y.useState(!1),[w,j]=y.useState(!1),[S,T]=y.useState(""),$=y.useRef(0),_=()=>{const C=++$.current;Promise.all([e.webhook(),e.webhookDeliveries()]).then(([O,z])=>{C===$.current&&(n(O),i(z.attempts),c(null),O.configured&&T(F=>F||O.url))}).catch(O=>{C===$.current&&c(Tw(O))})};y.useEffect(_,[e]);const E=async(C,O)=>{h(null),j(!0);try{await O()}catch(z){h({title:C,error:Tw(z)})}finally{j(!1)}_()},R=C=>{C.preventDefault(),E("The webhook was not saved",async()=>{const O=await e.saveWebhook(S.trim());O.signing_secret&&f(O.signing_secret);const{signing_secret:z,...F}=O;n(F)})};return t?s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1100px] space-y-6 px-6 py-8",children:[s.jsxs("div",{children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:"Settings"}),s.jsx("h1",{className:"mt-1 text-2xl font-semibold",children:"Webhook"}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:"One URL this server POSTs to when a run needs its person (`run.needs_input`) and when it ends (`run.ended`), signed by the Standard Webhooks spec, so a receiver checks each message with any of that spec's libraries."})]}),p&&s.jsx(Xo,{error:p.error,title:p.title}),l&&s.jsx(ns,{tone:"error",actions:s.jsx(Z,{type:"button",size:"xs",onClick:_,children:"Try again"}),children:s.jsxs("p",{className:"font-mono",children:["The webhook could not be read: ",l.code,": ",l.message,". What is shown may be out of date."]})}),u&&s.jsxs("section",{className:"border border-warning/50 bg-warning/5 p-4","aria-label":"Webhook secret",children:[s.jsx("p",{className:"caps text-small font-semibold text-warning-text",children:"The signing secret, shown this once"}),s.jsx("p",{className:"mt-2 break-all font-mono text-body",children:u}),s.jsxs("p",{className:"mt-2 text-body text-muted-foreground",children:["Keep it where the receiver checks ",s.jsx("span",{className:"font-mono",children:"webhook-signature"}),". This server never shows it again."]}),s.jsx(Z,{type:"button",variant:"outline",className:"mt-3",onClick:()=>f(null),children:"Done"})]}),s.jsxs("section",{className:"border bg-card p-4","aria-label":"Webhook URL",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(hl,{className:"size-4 text-muted-foreground","aria-hidden":!0}),t.configured?s.jsx("span",{className:"min-w-0 break-all font-mono text-body",children:t.url}):s.jsx("span",{className:"text-body text-muted-foreground",children:"No webhook is set."}),t.configured&&(t.disabled?s.jsx(Me,{tone:"error",children:"off"}):t.signing==="sealed"?s.jsx(Me,{tone:"success",children:"on"}):s.jsx(Me,{tone:"warning",children:"not signing"}))]}),t.configured&&t.disabled&&s.jsxs("p",{className:"mt-2 text-body text-destructive-text",children:["Off: ",t.disabled.reason,", ",St(t.disabled.at),". Nothing is sent until the URL is saved again."]}),t.configured&&t.signing!=="sealed"&&s.jsxs("p",{className:"mt-2 flex gap-2 text-body text-warning-text",children:[s.jsx(er,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),eL[t.signing]]}),s.jsxs("form",{className:"mt-4 flex flex-wrap gap-2",onSubmit:R,children:[s.jsx(He,{name:"url",type:"url",required:!0,maxLength:2048,placeholder:"https://...",value:S,onChange:C=>T(C.target.value),className:"h-9 min-w-[280px] flex-1","aria-label":"Webhook URL"}),s.jsx(Z,{type:"submit",variant:"solid",disabled:w||!S.trim(),children:"Save"}),t.configured&&s.jsx(Z,{type:"button",variant:"outline",disabled:w,onClick:()=>E("The test was not sent",async()=>x(await e.testWebhook())),children:"Send a test"}),t.configured&&!m&&s.jsx(Z,{type:"button",variant:"outline",disabled:w,onClick:()=>v(!0),children:"Remove"})]}),m&&s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2 text-body",children:[s.jsx("span",{children:"Its pending messages are dropped; the log of attempts stays."}),s.jsx(Z,{type:"button",variant:"destructive",disabled:w,onClick:()=>{v(!1),T(""),x(null),E("The webhook was not removed",async()=>{await e.removeWebhook(),n({configured:!1,secret:{name:"webhook:outbound",set:!1,source:null,changed_at:null}}),f(null)})},children:"Remove the webhook"}),s.jsx(Z,{type:"button",variant:"ghost",onClick:()=>v(!1),children:"Cancel"})]}),b&&s.jsxs("p",{className:"mt-3 font-mono text-body","aria-label":"Test send",children:["Test send: ",Cw(b)]})]}),s.jsxs("section",{"aria-label":"Deliveries",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"caps text-small font-semibold text-muted-foreground",children:"Last deliveries"}),s.jsx(Z,{type:"button",variant:"ghost",onClick:_,children:"Refresh"})]}),o.length===0?s.jsx("p",{className:"mt-2 border p-4 text-body text-muted-foreground",children:"No message has been tried yet."}):s.jsx("ul",{className:"mt-2 border",children:o.map((C,O)=>s.jsxs("li",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-b px-4 py-3 text-body last:border-b-0",children:[s.jsx("span",{className:"w-[170px] shrink-0 text-muted-foreground",children:St(C.at)}),s.jsx("span",{className:"w-[130px] shrink-0 font-mono",children:C.type}),s.jsx("span",{className:C.error?"min-w-0 flex-1 font-mono text-destructive-text":"min-w-0 flex-1 font-mono",children:Cw(C)}),C.redelivery&&s.jsx(Me,{children:"redelivery"}),s.jsxs("span",{className:"font-mono text-small text-muted-foreground",title:C.webhook_id,children:[C.webhook_id.slice(0,12),"…"]}),s.jsx(Z,{type:"button",variant:"outline",size:"sm",disabled:w,onClick:()=>E("The message was not sent again",()=>e.redeliverWebhook(C.webhook_id)),children:"Redeliver"})]},`${C.webhook_id}:${C.at}:${O}`))})]})]})}):l?s.jsx(ns,{tone:"error",className:"m-8",actions:s.jsx(Z,{type:"button",size:"xs",onClick:_,children:"Try again"}),children:s.jsxs("p",{className:"font-mono",children:["The webhook could not be read: ",l.code,": ",l.message]})}):s.jsx("p",{className:"p-8 text-center font-mono text-body text-muted-foreground",children:"Loading..."})}function Cw(e){const t=e.error??`${e.status_code}`,n=e.status_code!==null?`, ${e.latency_ms} ms`:"";return`${t}${n}${e.retry_at?`; tried again ${St(e.retry_at)}`:""}`}const nL={none:{label:"None",gives:"The run's folder only."},sandbox:{label:"Sandbox",gives:"A Linux container."},desktop:{label:"Desktop",gives:"A screen, with a pointer and keys."},phone:{label:"Phone",gives:"A phone's screen and its apps."},browser:{label:"Browser",gives:"A browser the agent drives."}},sL=e=>nL[e]??{label:e,gives:""},rL=e=>e instanceof Ee?e.toApiError():{code:"network",message:e instanceof Error?e.message:String(e),retryable:!1},Rw=e=>e.slice(e.lastIndexOf(":")+1);function oL({v2:e,writable:t,whyNot:n="sign_in"}){const[o,i]=y.useState(null),[l,c]=y.useState(null),[u,f]=y.useState(null),[p,h]=y.useState(null),[b,x]=y.useState({}),[m,v]=y.useState(new Set),w=y.useRef(0),j=y.useCallback(()=>{const _=++w.current;c(null),e.computers().then(E=>{_===w.current&&i(E)},E=>{_===w.current&&c(rL(E))})},[e]);if(y.useEffect(j,[j]),!o)return l?s.jsxs("div",{className:"m-8 border p-4",role:"alert",children:[s.jsxs("p",{className:"font-mono text-body text-destructive-text",children:["The computers could not be read: ",l.code,": ",l.message]}),s.jsx(Z,{size:"sm",onClick:j,className:"mt-3",children:"Try again"})]}):s.jsx("div",{className:"p-5 md:p-8",children:s.jsx(_s,{label:"Loading the computers",rows:3})});const S=_=>o.kinds.filter(E=>E.providers.some(R=>R.id===_)).map(E=>E.kind),T=async(_,E,R)=>{h(null);try{await e.saveComputerKeys(E.id,R)}catch(C){return C instanceof Ee&&C.status===422?C:(h({at:_,words:Nn(C)}),null)}return f(null),j(),null},$=async _=>{v(R=>new Set(R).add(_.id));let E;try{const R=await e.testComputer(_.id);E=R.ok?{ok:!0,words:R.detail,at:new Date().toISOString()}:{ok:!1,words:R.why,at:new Date().toISOString()}}catch(R){E={ok:!1,words:Nn(R),at:new Date().toISOString()}}x(R=>({...R,[_.id]:E})),v(R=>{const C=new Set(R);return C.delete(_.id),C})};return s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1100px] space-y-6 px-6 py-8",children:[s.jsxs("div",{children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:"Settings"}),s.jsx("h1",{className:"mt-1 text-2xl font-semibold",children:"Computers"}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:"The computers an agent can be given, and who provides them. An agent can have a kind once one of its providers is ready. Keys are kept sealed on this server and never shown again."})]}),!t&&s.jsx("p",{role:"status",className:"border bg-card p-4 text-body",children:Zl[n]}),o.kinds.map(_=>s.jsx(aL,{kind:_,children:_.providers.map(E=>{const R=`${_.kind}/${E.id}`;return s.jsx(iL,{kind:_.kind,provider:E,writable:t,serves:S(E.id),tested:b[E.id],testing:m.has(E.id),open:(u==null?void 0:u.at)===R?u.mode:null,problem:(p==null?void 0:p.at)===R?p.words:null,onOpen:C=>{f(C?{at:R,mode:C}:null),h(null)},onSave:C=>T(R,E,C),onRemove:async C=>{var z;const O=await T(R,E,{[C]:null});O&&h({at:R,words:((z=O.fields)==null?void 0:z.map(F=>F.message).join(" "))||O.message})},onTest:()=>void $(E)},E.id)})},_.kind))]})})}function aL({kind:e,children:t}){const{label:n,gives:o}=sL(e.kind);return s.jsxs("section",{"aria-label":n,children:[s.jsxs("h2",{className:"mb-2 flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"caps text-small font-semibold",children:n}),o&&s.jsx("span",{className:"text-small text-muted-foreground",children:o}),!e.offered&&s.jsx(Me,{tone:"muted",children:"Not offered here"})]}),!e.offered&&e.why&&s.jsx("p",{className:"mb-2 font-mono text-small text-muted-foreground",children:e.why}),e.providers.length?s.jsx("ul",{className:"border",children:t}):s.jsx("p",{className:"border p-4 text-body text-muted-foreground",children:e.kind==="none"?"Nothing to set up.":"No provider serves it on this server."})]})}function iL({kind:e,provider:t,writable:n,serves:o,tested:i,testing:l,open:c,problem:u,onOpen:f,onSave:p,onRemove:h,onTest:b}){const x=c&&"paste"in c?c.paste:null,m=c&&"remove"in c?c.remove:null;return s.jsxs("li",{className:"border-b p-4 last:border-b-0",children:[s.jsxs("div",{className:"flex flex-wrap items-start gap-3",children:[s.jsx(Ol,{className:"mt-1 size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{"data-provider":!0,className:"font-mono text-prose font-semibold",children:t.name}),t.ready?s.jsx(Me,{tone:"success",children:"Ready"}):s.jsx(Me,{children:"Not ready"}),t.metered&&s.jsx("span",{"data-metered":!0,className:"text-small text-muted-foreground",children:"Metered"})]}),!t.ready&&t.why&&s.jsx("p",{className:"mt-1.5 font-mono text-small text-muted-foreground",children:t.why}),t.metered&&$g.has(e)&&s.jsx("p",{className:"mt-1.5 text-small text-muted-foreground",children:_g}),t.secrets.length>0&&s.jsx("ul",{className:"mt-3 space-y-1.5",children:t.secrets.map(v=>{const w=Rw(v.name);return s.jsx(Jd,{field:v,required:t.required.includes(v.name),writable:n&&!c,onPaste:()=>f({paste:w}),onRemove:()=>f({remove:w})},v.name)})}),i&&s.jsx("p",{"data-test":!0,className:`mt-2 text-small ${i.ok?"text-success-text":"text-destructive-text"}`,children:`${i.ok?"Passed":"Failed"} · ${Id(i.at)} · ${i.words}`}),s.jsxs("p",{className:"mt-2 text-small text-muted-foreground",children:[t.secrets.length?"":"No key. ","Serves: ",o.join(", ")]})]}),s.jsx("div",{className:"flex gap-2",children:s.jsx(Z,{size:"sm",onClick:b,disabled:l,children:l?"Testing…":"Test connection"})})]}),n&&x&&s.jsx(lL,{provider:t.name,name:x,set:t.secrets.some(v=>Rw(v.name)===x&&v.set),onSave:p,onCancel:()=>f(null)}),n&&m&&s.jsxs("div",{"data-confirm":!0,className:"mt-4 flex flex-wrap items-center gap-3 border bg-card p-3",children:[s.jsxs("p",{className:"min-w-0 flex-1 text-body",children:["Remove ",m," saved on this server?"]}),s.jsx(Z,{size:"sm",variant:"destructive",onClick:()=>void h(m),children:"Remove"}),s.jsx(Z,{size:"sm",onClick:()=>f(null),children:"Cancel"})]}),u&&s.jsx("p",{role:"alert",className:"mt-4 border border-destructive/50 px-3 py-2 font-mono text-small text-destructive-text",children:u})]})}function lL({provider:e,name:t,set:n,onSave:o,onCancel:i}){const l=y.useRef(null),[c,u]=y.useState(!1),[f,p]=y.useState(!1),[h,b]=y.useState(null),x=()=>{var w,j;return((j=(w=l.current)==null?void 0:w.elements.namedItem(t))==null?void 0:j.value)??""},m=()=>{var w;(w=l.current)==null||w.reset(),u(!1)},v=async w=>{var _;w.preventDefault();const j=x();if(!j)return;p(!0),b(null);const S=await o({[t]:j});if(p(!1),!S){m();return}const T=(_=S.fields)==null?void 0:_.find(E=>E.field===t),$=(S.fields??[]).filter(E=>E.field!==t).map(E=>E.message);b(T?{field:T.message,message:$.join(" ")}:{field:null,message:$.join(" ")||S.message})};return s.jsxs("form",{ref:l,autoComplete:"off",onSubmit:w=>void v(w),onInput:()=>u(!!x()),className:"mt-4 space-y-4 border bg-card p-4","aria-label":`${e} ${t}`,children:[s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:t}),n&&s.jsx("span",{className:"-mt-1 mb-2 block text-small text-muted-foreground",children:"A new value replaces the one saved."}),s.jsx(He,{type:"password",name:t,autoComplete:"new-password",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","data-1p-ignore":!0,"data-lpignore":"true"}),(h==null?void 0:h.field)&&s.jsx("span",{className:"mt-2 block font-mono text-small text-destructive-text",role:"alert",children:h.field})]}),(h==null?void 0:h.message)&&s.jsx("p",{className:"font-mono text-small text-destructive-text",role:"alert",children:h.message}),s.jsx("p",{className:"text-small text-muted-foreground",children:"Kept sealed on this server. It is never shown again, here or anywhere."}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Z,{type:"submit",size:"sm",variant:"solid",disabled:!c||f,children:f?"Saving":"Save"}),s.jsx(Z,{type:"button",size:"sm",onClick:()=>{m(),i()},children:"Cancel"})]})]})}const cL="Each agent keeps its runs' folders on its own Archil disk, made on its first run in this region. The server never mounts one; computers that support it mount a run's folder.",Aw=[{name:"region",label:"Region"},{name:"s3Url",label:"S3 URL",placeholder:"https://"},{name:"image",label:"Image",placeholder:"serve's default, Debian with git 2.47 (recommended)"}],uL=e=>({region:e.region??"",s3Url:e.s3Url??"",image:e.image??""}),gr="ARCHIL_API_KEY",dL=e=>e instanceof Ee?e.toApiError():{code:"network",message:e instanceof Error?e.message:String(e),retryable:!1};function fL({v2:e,writable:t,whyNot:n="sign_in"}){const[o,i]=y.useState(null),[l,c]=y.useState(null),[u,f]=y.useState({region:"",s3Url:"",image:""}),[p,h]=y.useState(null),[b,x]=y.useState(null),[m,v]=y.useState(!1),[w,j]=y.useState(null),[S,T]=y.useState(!1),[$,_]=y.useState(!1),[E,R]=y.useState(!1),[C,O]=y.useState(!1),z=y.useRef(null),F=y.useRef(0),D=y.useCallback(L=>{i(L),f(uL(L))},[]),B=y.useCallback(()=>{const L=++F.current;c(null),e.archil().then(I=>{L===F.current&&D(I)},I=>{L===F.current&&c(dL(I))})},[e,D]);if(y.useEffect(B,[B]),!o)return l?s.jsxs("div",{className:"m-8 border p-4",role:"alert",children:[s.jsxs("p",{className:"font-mono text-body text-destructive-text",children:["Archil's settings could not be read: ",l.code,": ",l.message]}),s.jsx(Z,{size:"sm",onClick:B,className:"mt-3",children:"Try again"})]}):s.jsx("div",{className:"p-5 md:p-8",children:s.jsx(_s,{label:"Loading Archil's settings",rows:2})});const U=()=>{var L,I;return((I=(L=z.current)==null?void 0:L.elements.namedItem(gr))==null?void 0:I.value)??""},W=async L=>{const I={region:u.region,s3Url:u.s3Url,...u.image?{image:u.image}:{},...L!==void 0?{keys:{[gr]:L}}:{}};v(!0),h(null),x(null);try{const G=await e.saveArchil(I);R(!1),O(!1),D(G)}catch(G){if(G instanceof Ee&&G.status===422){const P={},q=[];for(const ne of G.fields??[]){const ae=ne.field.startsWith("keys.")?ne.field.slice(5):ne.field;Aw.some(ie=>ie.name===ae)||ae===gr?P[ae]=ne.message:q.push(ne.message)}h({fields:P,message:q.length?q.join(" "):Object.keys(P).length?null:G.message})}else x(Nn(G))}finally{v(!1)}},X=L=>{L.preventDefault(),W(E&&U()?U():void 0)},M=async()=>{T(!0);try{const L=await e.testArchil();j(L.ok?{ok:!0,words:L.detail,at:new Date().toISOString()}:{ok:!1,words:L.why,at:new Date().toISOString()})}catch(L){j({ok:!1,words:Nn(L),at:new Date().toISOString()})}finally{T(!1)}},K=async()=>{x(null);try{D(await e.archilOff()),_(!1)}catch(L){x(Nn(L))}};return s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1100px] space-y-6 px-6 py-8",children:[s.jsxs("div",{children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:"Settings"}),s.jsx("h1",{className:"mt-1 text-2xl font-semibold",children:"Workspace"}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:cL})]}),!t&&s.jsx("p",{role:"status",className:"border bg-card p-4 text-body",children:Zl[n]}),s.jsxs("section",{"aria-label":"Archil",className:"border p-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsx(i_,{className:"size-4 text-muted-foreground","aria-hidden":!0}),s.jsx("span",{className:"font-mono text-prose font-semibold",children:"Archil"}),s.jsx("span",{"data-archil-state":!0,children:o.on?s.jsx(Me,{tone:"success",children:"On"}):s.jsx(Me,{children:"Off"})}),o.on&&s.jsx("span",{"data-disk":!0,className:"font-mono text-small text-muted-foreground",children:o.region??""}),s.jsx("span",{className:"flex-1"}),s.jsx(Z,{size:"sm",onClick:()=>void M(),disabled:S,children:S?"Testing…":"Test"}),o.on&&s.jsx(Z,{size:"sm",variant:"destructive",onClick:()=>_(!0),children:"Turn off"})]}),w&&s.jsx("p",{"data-test":!0,className:`mt-3 text-small ${w.ok?"text-success-text":"text-destructive-text"}`,children:`${w.ok?"Passed":"Failed"} · ${Id(w.at)} · ${w.words}`}),$&&s.jsxs("div",{"data-confirm":!0,className:"mt-4 flex flex-wrap items-center gap-3 border bg-card p-3",children:[s.jsx("p",{className:"min-w-0 flex-1 text-body",children:"Turn Archil off? Its keys are kept, for turning it on again."}),s.jsx(Z,{size:"sm",variant:"destructive",onClick:()=>void K(),children:"Turn off"}),s.jsx(Z,{size:"sm",onClick:()=>_(!1),children:"Cancel"})]}),b&&s.jsx("p",{role:"alert",className:"mt-4 border border-destructive/50 px-3 py-2 font-mono text-small text-destructive-text",children:b}),s.jsxs("form",{ref:z,autoComplete:"off",onSubmit:X,className:"mt-5 space-y-4","aria-label":"Archil settings",children:[Aw.map(L=>s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:L.label}),s.jsx(He,{name:L.name,value:u[L.name],placeholder:L.placeholder,spellCheck:!1,autoCapitalize:"off",autoCorrect:"off",onChange:I=>{const G=I.currentTarget.value;f(P=>({...P,[L.name]:G}))}}),(p==null?void 0:p.fields[L.name])&&s.jsx("span",{className:"mt-2 block font-mono text-small text-destructive-text",role:"alert",children:p.fields[L.name]})]},L.name)),s.jsx("ul",{children:s.jsx(Jd,{field:o.secret,label:gr,writable:t&&!E&&!C,onPaste:()=>R(!0),onRemove:()=>O(!0)})}),t&&C&&s.jsxs("div",{"data-confirm-key":!0,className:"flex flex-wrap items-center gap-3 border bg-card p-3",children:[s.jsxs("p",{className:"min-w-0 flex-1 text-body",children:["Remove ",gr," saved on this server?"]}),s.jsx(Z,{type:"button",size:"sm",variant:"destructive",onClick:()=>void W(null),children:"Remove"}),s.jsx(Z,{type:"button",size:"sm",onClick:()=>O(!1),children:"Cancel"})]}),t&&E&&s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"caps mb-2 block text-small font-semibold",children:gr}),s.jsx(He,{type:"password",name:gr,autoComplete:"new-password",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","data-1p-ignore":!0,"data-lpignore":"true"}),(p==null?void 0:p.fields[gr])&&s.jsx("span",{className:"mt-2 block font-mono text-small text-destructive-text",role:"alert",children:p.fields[gr]})]}),t&&E&&s.jsx(Z,{type:"button",size:"sm",onClick:()=>R(!1),children:"Cancel"}),(p==null?void 0:p.message)&&s.jsx("p",{className:"font-mono text-small text-destructive-text",role:"alert",children:p.message}),s.jsx(Z,{type:"submit",size:"sm",variant:"solid",disabled:m,children:m?"Saving":o.on?"Save":"Turn on"})]})]})]})})}const cN=y.createContext(new Map),mL={schedule:"Schedule",webhook:"Webhook",github:"GitHub"};function uN({run:e}){const t=y.useContext(cN);if(!e.trigger)return null;const{id:n}=e.trigger,o=t.get(n),i=o?`${mL[o.kind]??"Trigger"}: ${o.name}`:`Trigger: ${n}`;return s.jsx("a",{href:`#/triggers/${encodeURIComponent(n)}`,onClick:l=>l.stopPropagation(),className:"inline-flex max-w-full",title:i,children:s.jsxs(Me,{className:"max-w-full",children:[s.jsx(pd,{className:"size-3 shrink-0","aria-hidden":!0}),s.jsx("span",{className:"truncate",children:i})]})})}const bu=(e,t,n)=>{if(!/^\d{1,2}$/.test(e))return null;const o=Number(e);return o>=t&&o<=n?o:null};function pL(e){const t=e.trim().split(/\s+/);if(t.length!==5)return null;const[n,o,i,l,c]=t,u=bu(n,0,59);if(u===null||l!=="*")return null;if(o==="*")return i==="*"&&c==="*"?{kind:"hourly",minute:u}:null;const f=bu(o,0,23);if(f===null)return null;const p={hour:f,minute:u};if(i==="*"&&c==="*")return{kind:"daily",at:p};if(i==="*"&&c==="1-5")return{kind:"weekdays",at:p};if(i==="*"){const h=bu(c,0,6);return h===null?null:{kind:"weekly",day:h,at:p}}if(c==="*"){const h=bu(i,1,31);return h===null?null:{kind:"monthly",date:h,at:p}}return null}function hL(e){if(e.kind==="hourly")return`${e.minute} * * * *`;const t=`${e.at.minute} ${e.at.hour}`;return e.kind==="daily"?`${t} * * *`:e.kind==="weekdays"?`${t} * * 1-5`:e.kind==="weekly"?`${t} * * ${e.day}`:`${t} ${e.date} * *`}function gL(e,t){const n=t&&"at"in t?t.at:{hour:9,minute:(t==null?void 0:t.kind)==="hourly"?t.minute:0};return e==="hourly"?{kind:e,minute:n.minute}:e==="weekly"?{kind:e,day:(t==null?void 0:t.kind)==="weekly"?t.day:1,at:n}:e==="monthly"?{kind:e,date:(t==null?void 0:t.kind)==="monthly"?t.date:1,at:n}:{kind:e,at:n}}const Ow=e=>String(e).padStart(2,"0"),xL=e=>`${Ow(e.hour)}:${Ow(e.minute)}`;function yL(e){const t=/^(\d{2}):(\d{2})/.exec(e);if(!t)return null;const n=Number(t[1]),o=Number(t[2]);return n<=23&&o<=59?{hour:n,minute:o}:null}var yp={exports:{}},Mw;function vL(){return Mw||(Mw=1,(function(e,t){(function(o,i){e.exports=i()})(globalThis,()=>(()=>{var n={6949(c,u,f){Object.defineProperty(u,"__esModule",{value:!0}),u.CronParser=void 0;var p=f(9515),h=(function(){function b(x,m,v){m===void 0&&(m=!0),v===void 0&&(v=!1),this.expression=x,this.dayOfWeekStartIndexZero=m,this.monthStartIndexZero=v}return b.prototype.parse=function(){var x,m,v=(x=this.expression)!==null&&x!==void 0?x:"";if(v==="@reboot")return m=["@reboot","","","","","",""],m;if(v.startsWith("@")){var w=this.parseSpecial(this.expression);m=this.extractParts(w)}else m=this.extractParts(this.expression);return this.normalize(m),this.validate(m),m},b.prototype.parseSpecial=function(x){var m={"@yearly":"0 0 1 JAN *","@annually":"0 0 1 JAN *","@monthly":"0 0 1 * *","@weekly":"0 0 * * SUN","@daily":"0 0 * * *","@midnight":"0 0 * * *","@hourly":"0 * * * *","@reboot":"@reboot"},v=m[x];if(!v)throw new Error("Unknown special expression.");return v},b.prototype.extractParts=function(x){if(!this.expression)throw new Error("cron expression is empty");for(var m=x.trim().split(/[ ]+/),v=0;v<m.length;v++)if(m[v].includes(",")){var w=m[v].split(",").map(function(S){return S.trim()}).filter(function(S){return S!==""}).map(function(S){return isNaN(Number(S))?S:Number(S)}).filter(function(S){return S!==null&&S!==""});w.length===0&&w.push("*"),w.sort(function(S,T){return S!==null&&T!==null?S-T:0}),m[v]=w.map(function(S){return S!==null?S.toString():""}).join(",")}if(m.length<5)throw new Error("Expression has only ".concat(m.length," part").concat(m.length==1?"":"s",". At least 5 parts are required."));if(m.length==5)m.unshift(""),m.push("");else if(m.length==6){var j=/\d{4}$/.test(m[5])||m[4]=="?"||m[2]=="?";j?m.unshift(""):m.push("")}else if(m.length>7)throw new Error("Expression has ".concat(m.length," parts; too many!"));return m},b.prototype.normalize=function(x){var m=this;x[3]=x[3].replace("?","*"),x[5]=x[5].replace("?","*"),x[2]=x[2].replace("?","*"),x[0].indexOf("0/")==0&&(x[0]=x[0].replace("0/","*/")),x[1].indexOf("0/")==0&&(x[1]=x[1].replace("0/","*/")),x[2].indexOf("0/")==0&&(x[2]=x[2].replace("0/","*/")),x[3].indexOf("1/")==0&&(x[3]=x[3].replace("1/","*/")),!this.monthStartIndexZero&&x[4].indexOf("1/")==0&&(x[4]=x[4].replace("1/","*/")),x[6].indexOf("1/")==0&&(x[6]=x[6].replace("1/","*/")),x[5]=x[5].replace(/(^\d+)|([^#/\s\d]\d+)/g,function(R){var C=R.replace(/\D/,""),O=C;return m.dayOfWeekStartIndexZero?C=="7"&&(O="0"):O=(parseInt(C)-1).toString(),R.replace(C,O)}),x[5]=="L"&&(x[5]="6"),x[3]=="?"&&(x[3]="*");var v=/^\d{1,2}W[+-]\d{1,2}$/;if(x[3].indexOf("W")>-1&&(x[3].indexOf(",")>-1||/[-+]/.test(x[3]))&&!v.test(x[3]))throw new Error("The 'W' character can be specified only when the day-of-month is a single day, not a range or list of days.");var w={SUN:0,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6};for(var j in w)x[5]=x[5].replace(new RegExp(j,"gi"),w[j].toString());x[4]=x[4].replace(/(^\d{1,2})|([^#/\s\d]\d{1,2})/g,function(R){var C=R.replace(/\D/,""),O=C;return m.monthStartIndexZero&&(O=(parseInt(C)+1).toString()),R.replace(C,O)});var S={JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12};for(var T in S)x[4]=x[4].replace(new RegExp(T,"gi"),S[T].toString());x[0]=="0"&&(x[0]=""),!/\*|\-|\,|\//.test(x[2])&&(/\*|\//.test(x[1])||/\*|\//.test(x[0]))&&(x[2]+="-".concat(x[2]));for(var $=0;$<x.length;$++)if(x[$].indexOf(",")!=-1&&(x[$]=x[$].split(",").filter(function(R){return R!==""}).join(",")||"*"),x[$]=="*/1"&&(x[$]="*"),x[$].indexOf("/")>-1&&!/^\*|\-|\,/.test(x[$])){var _=null;switch($){case 4:_="12";break;case 5:_="6";break;case 6:_="9999";break;default:_=null;break}if(_!==null){var E=x[$].split("/");x[$]="".concat(E[0],"-").concat(_,"/").concat(E[1])}}},b.prototype.validate=function(x){var m="0-9,\\-*/";this.validateOnlyExpectedCharactersFound(x[0],m),this.validateOnlyExpectedCharactersFound(x[1],m),this.validateOnlyExpectedCharactersFound(x[2],m),this.validateOnlyExpectedCharactersFound(x[3].replace(/^(\d{1,2}W)[+-]\d{1,2}$/,"$1"),"0-9,\\-*/LW"),this.validateOnlyExpectedCharactersFound(x[4],m),this.validateOnlyExpectedCharactersFound(x[5],"0-9,\\-*/L#"),this.validateOnlyExpectedCharactersFound(x[6],m),this.validateAnyRanges(x)},b.prototype.validateAnyRanges=function(x){x.forEach(function(m){return p.default.stepRange(m)}),p.default.secondRange(x[0]),p.default.minuteRange(x[1]),p.default.hourRange(x[2]),p.default.dayOfMonthRange(x[3]),p.default.monthRange(x[4],this.monthStartIndexZero),p.default.dayOfWeekRange(x[5],this.dayOfWeekStartIndexZero)},b.prototype.validateOnlyExpectedCharactersFound=function(x,m){var v=x.match(new RegExp("[^".concat(m,"]+"),"gi"));if(v&&v.length)throw new Error("Expression contains invalid values: '".concat(v.toString(),"'"))},b})();u.CronParser=h},8333(c,u,f){Object.defineProperty(u,"__esModule",{value:!0}),u.ExpressionDescriptor=void 0;var p=f(1823),h=f(6949),b=(function(){function x(m,v){if(this.expression=m,this.options=v,this.expressionParts=new Array(5),!this.options.locale&&x.defaultLocale&&(this.options.locale=x.defaultLocale),!x.locales[this.options.locale]){var w=Object.keys(x.locales)[0];console.warn("Locale '".concat(this.options.locale,"' could not be found; falling back to '").concat(w,"'.")),this.options.locale=w}this.i18n=x.locales[this.options.locale],v.use24HourTimeFormat===void 0&&(v.use24HourTimeFormat=this.i18n.use24HourTimeFormatByDefault())}return x.toString=function(m,v){var w=v===void 0?{}:v,j=w.throwExceptionOnParseError,S=j===void 0?!0:j,T=w.verbose,$=T===void 0?!1:T,_=w.dayOfWeekStartIndexZero,E=_===void 0?!0:_,R=w.monthStartIndexZero,C=R===void 0?!1:R,O=w.use24HourTimeFormat,z=w.trimHoursLeadingZero,F=z===void 0?!1:z,D=w.locale,B=D===void 0?null:D,U=w.logicalAndDayFields,W=U===void 0?!1:U,X={throwExceptionOnParseError:S,verbose:$,dayOfWeekStartIndexZero:E,monthStartIndexZero:C,use24HourTimeFormat:O,trimHoursLeadingZero:F,locale:B,logicalAndDayFields:W};X.tzOffset&&console.warn("'tzOffset' option has been deprecated and is no longer supported.");var M=new x(m,X);return M.getFullDescription()},x.initialize=function(m,v){v===void 0&&(v="en"),x.specialCharacters=["/","-",",","*"],x.defaultLocale=v,m.load(x.locales)},x.prototype.getFullDescription=function(){var m,v,w="";try{var j=new h.CronParser(this.expression,this.options.dayOfWeekStartIndexZero,this.options.monthStartIndexZero);if(this.expressionParts=j.parse(),this.expressionParts[0]==="@reboot")return((v=(m=this.i18n).atReboot)===null||v===void 0?void 0:v.call(m))||"Run once, at startup";var S=this.getTimeOfDayDescription(),T=this.getDayOfMonthDescription(),$=this.getMonthDescription(),_=this.getDayOfWeekDescription(),E=this.getYearDescription();w+=S+T+_+$+E,w=this.transformVerbosity(w,!!this.options.verbose),w=w.charAt(0).toLocaleUpperCase()+w.substr(1)}catch(R){if(!this.options.throwExceptionOnParseError)w=this.i18n.anErrorOccuredWhenGeneratingTheExpressionD();else throw"".concat(R)}return w},x.prototype.getTimeOfDayDescription=function(){var m=this.expressionParts[0],v=this.expressionParts[1],w=this.expressionParts[2],j="";if(!p.StringUtilities.containsAny(v,x.specialCharacters)&&!p.StringUtilities.containsAny(w,x.specialCharacters)&&!p.StringUtilities.containsAny(m,x.specialCharacters))j+=this.i18n.atSpace()+this.formatTime(w,v,m);else if(!m&&v.indexOf("-")>-1&&!(v.indexOf(",")>-1)&&!(v.indexOf("/")>-1)&&!p.StringUtilities.containsAny(w,x.specialCharacters)){var S=v.split("-");j+=p.StringUtilities.format(this.i18n.everyMinuteBetweenX0AndX1(),this.formatTime(w,S[0],""),this.formatTime(w,S[1],""))}else if(!m&&w.indexOf(",")>-1&&w.indexOf("-")==-1&&w.indexOf("/")==-1&&!p.StringUtilities.containsAny(v,x.specialCharacters)){var T=w.split(",");j+=this.i18n.at();for(var $=0;$<T.length;$++)j&&(j+=" "),j+=this.formatTime(T[$],v,""),$<T.length-2&&(j+=","),$==T.length-2&&(j+=this.i18n.spaceAnd())}else{var _=this.getSecondsDescription(),E=this.getMinutesDescription(),R=this.getHoursDescription();if(j+=_,j&&E&&(j+=", "),j+=E,E===R)return j;j&&R&&(j+=", "),j+=R}return j},x.prototype.getSecondsDescription=function(){var m=this,v=this.getSegmentDescription(this.expressionParts[0],this.i18n.everySecond(),function(w){return w},function(w){return p.StringUtilities.format(m.i18n.everyX0Seconds(w),w)},function(w){return m.i18n.secondsX0ThroughX1PastTheMinute()},function(w){return w=="0"?"":parseInt(w)<20?m.i18n.atX0SecondsPastTheMinute(w):m.i18n.atX0SecondsPastTheMinuteGt20()||m.i18n.atX0SecondsPastTheMinute(w)},{min:0,max:59});return v},x.prototype.getMinutesDescription=function(){var m=this,v=this.expressionParts[0],w=this.expressionParts[2],j=this.getSegmentDescription(this.expressionParts[1],this.i18n.everyMinute(),function(S){return S},function(S){return p.StringUtilities.format(m.i18n.everyX0Minutes(S),S)},function(S){return m.i18n.minutesX0ThroughX1PastTheHour()},function(S){var T,$;try{return S=="0"&&w.indexOf("/")==-1&&v==""?m.i18n.everyHour():S=="0"?(($=(T=m.i18n).onTheHour)===null||$===void 0?void 0:$.call(T))||m.i18n.atX0MinutesPastTheHour(S):parseInt(S)<20?m.i18n.atX0MinutesPastTheHour(S):m.i18n.atX0MinutesPastTheHourGt20()||m.i18n.atX0MinutesPastTheHour(S)}catch{return m.i18n.atX0MinutesPastTheHour(S)}},{min:0,max:59});return j},x.prototype.getHoursDescription=function(){var m=this,v=this.expressionParts[2],w=0,j=[];v.split("/")[0].split(",").forEach(function($){var _=$.split("-");_.length===2&&j.push({value:_[1],index:w+1}),w+=_.length});var S=0,T=this.getSegmentDescription(v,this.i18n.everyHour(),function($){var _=j.find(function(R){return R.value===$&&R.index===S}),E=_&&m.expressionParts[1]!=="0";return S++,E?m.formatTime($,"59",""):m.formatTime($,"0","")},function($){return p.StringUtilities.format(m.i18n.everyX0Hours($),$)},function($){return m.i18n.betweenX0AndX1()},function($){return m.i18n.atX0()},{min:0,max:23});return T},x.prototype.getDayOfWeekDescription=function(){var m=this,v=this.i18n.daysOfTheWeek(),w=null;return this.expressionParts[5]=="*"?w="":w=this.getSegmentDescription(this.expressionParts[5],this.i18n.commaEveryDay(),function(j,S){var T=j;j.indexOf("#")>-1?T=j.substring(0,j.indexOf("#")):j.indexOf("L")>-1&&(T=T.replace("L",""));var $=parseInt(T),_=m.i18n.daysOfTheWeekInCase?m.i18n.daysOfTheWeekInCase(S)[$]:v[$];if(j.indexOf("#")>-1){var E=null,R=j.substring(j.indexOf("#")+1),C=j.substring(0,j.indexOf("#"));switch(R){case"1":E=m.i18n.first(C);break;case"2":E=m.i18n.second(C);break;case"3":E=m.i18n.third(C);break;case"4":E=m.i18n.fourth(C);break;case"5":E=m.i18n.fifth(C);break}_=E+" "+_}return _},function(j){return parseInt(j)==1?"":p.StringUtilities.format(m.i18n.commaEveryX0DaysOfTheWeek(j),j)},function(j){var S=j.substring(0,j.indexOf("-")),T=m.expressionParts[3]!="*";return T?m.i18n.commaAndX0ThroughX1(S):m.i18n.commaX0ThroughX1(S)},function(j){var S=null;if(j.indexOf("#")>-1){var T=j.substring(j.indexOf("#")+1),$=j.substring(0,j.indexOf("#"));S=m.i18n.commaOnThe(T,$).trim()+m.i18n.spaceX0OfTheMonth()}else if(j.indexOf("L")>-1)S=m.i18n.commaOnTheLastX0OfTheMonth(j.replace("L",""));else{var _=m.expressionParts[3]!="*";_?m.options.logicalAndDayFields?S=m.i18n.commaOnlyOnX0(j):S=m.i18n.commaAndOnX0():S=m.i18n.commaOnlyOnX0(j)}return S}),w},x.prototype.getMonthDescription=function(){var m=this,v=this.i18n.monthsOfTheYear(),w=this.getSegmentDescription(this.expressionParts[4],"",function(j,S){return S&&m.i18n.monthsOfTheYearInCase?m.i18n.monthsOfTheYearInCase(S)[parseInt(j)-1]:v[parseInt(j)-1]},function(j){return parseInt(j)==1?"":p.StringUtilities.format(m.i18n.commaEveryX0Months(j),j)},function(j){return m.i18n.commaMonthX0ThroughMonthX1()||m.i18n.commaX0ThroughX1()},function(j){return m.i18n.commaOnlyInMonthX0?m.i18n.commaOnlyInMonthX0():m.i18n.commaOnlyInX0()});return w},x.prototype.getDayOfMonthDescription=function(){var m=this,v,w,j,S,T=null,$=this.expressionParts[3];switch($){case"L":T=this.i18n.commaOnTheLastDayOfTheMonth();break;case"WL":case"LW":T=this.i18n.commaOnTheLastWeekdayOfTheMonth();break;default:var _=$.match(/^(?:(\d{1,2})W|W(\d{1,2}))(?:([+-])(\d{1,2}))?$/);if(_){var E=parseInt(_[1]||_[2]),R=E==1?this.i18n.firstWeekday():p.StringUtilities.format(this.i18n.weekdayNearestDayX0(),E.toString()),C=_[4];C?_[3]=="-"?T=p.StringUtilities.format(((w=(v=this.i18n).commaDaysBeforeTheX0OfTheMonth)===null||w===void 0?void 0:w.call(v,C))||", %s days before the %s of the month",C,R):T=p.StringUtilities.format(((S=(j=this.i18n).commaDaysAfterTheX0OfTheMonth)===null||S===void 0?void 0:S.call(j,C))||", %s days after the %s of the month",C,R):T=p.StringUtilities.format(this.i18n.commaOnTheX0OfTheMonth(),R);break}else{var O=$.match(/L-(\d{1,2})/);if(O){var z=O[1];T=p.StringUtilities.format(this.i18n.commaDaysBeforeTheLastDayOfTheMonth(z),z);break}else{if($=="*"&&this.expressionParts[5]!="*")return"";T=this.getSegmentDescription($,this.i18n.commaEveryDay(),function(F){return F=="L"?m.i18n.lastDay():m.i18n.dayX0?p.StringUtilities.format(m.i18n.dayX0(),F):F},function(F){return F=="1"?m.i18n.commaEveryDay():m.i18n.commaEveryX0Days(F)},function(F){return m.i18n.commaBetweenDayX0AndX1OfTheMonth(F)},function(F){return m.i18n.commaOnDayX0OfTheMonth(F)})}break}}return T},x.prototype.getYearDescription=function(){var m=this,v=this.getSegmentDescription(this.expressionParts[6],"",function(w){return/^\d+$/.test(w)?new Date(parseInt(w),1).getFullYear().toString():w},function(w){return p.StringUtilities.format(m.i18n.commaEveryX0Years(w),w)},function(w){return m.i18n.commaYearX0ThroughYearX1()||m.i18n.commaX0ThroughX1()},function(w){return m.i18n.commaOnlyInYearX0?m.i18n.commaOnlyInYearX0():m.i18n.commaOnlyInX0()});return v},x.prototype.getSegmentDescription=function(m,v,w,j,S,T,$){var _=null,E=m.indexOf("/")>-1,R=m.indexOf("-")>-1,C=m.indexOf(",")>-1;if(!m)_="";else if(m==="*")_=v;else if(!E&&!R&&!C)_=p.StringUtilities.format(T(m),w(m));else if(C){for(var O=m.split(","),z="",F=this.i18n.spaceAnd(),D=0;D<O.length;D++)if(D>0&&O.length>2&&(z+=",",D<O.length-1&&(z+=" ")),D>0&&O.length>1&&(D==O.length-1||O.length==2)&&(z+=F==","&&O.length>2?" ":"".concat(F," ")),O[D].indexOf("/")>-1||O[D].indexOf("-")>-1){var B=O[D].indexOf("-")>-1&&O[D].indexOf("/")==-1,U=this.getSegmentDescription(O[D],v,w,j,B?this.i18n.commaX0ThroughX1:S,T);B?U=U.replace(", ",""):D>0&&U.startsWith(", ")&&(U=U.substring(2)),z+=U}else if(!E)z+=w(O[D]);else{var W=this.getSegmentDescription(O[D],v,w,j,S,T);D>0&&W&&W.startsWith(", ")&&(W=W.substring(2)),z+=W}E?_=z:_=p.StringUtilities.format(T(m),z)}else if(E){var O=m.split("/");if(_=p.StringUtilities.format(j(O[1]),O[1]),O[0].indexOf("-")>-1){var X=this.generateRangeSegmentDescription(O[0],S,w);X.indexOf(", ")!=0&&(_+=", "),_+=X}else if(O[0].indexOf("*")==-1){var M=p.StringUtilities.format(T(O[0]),w(O[0]));M=M.replace(", ",""),_+=p.StringUtilities.format(this.i18n.commaStartingX0(),M)}_+=this.getWrappingIncrementDescription(m,$,v,w,j,S,T)}else R&&(_=this.generateRangeSegmentDescription(m,S,w));return _},x.prototype.getWrappingIncrementDescription=function(m,v,w,j,S,T,$){if(!this.options.verbose||!v)return"";var _=m.split("/"),E=_[0],R=_[1],C=parseInt(R),O=v.max-v.min+1,z=E==="*",F=Number.isInteger(C)&&C>1,D=F&&O%C===0;if(!z||!F||D)return"";for(var B=[],U=v.min;U<=v.max;U+=C)B.push(U);if(B.length<2)return"";var W=this.getSegmentDescription(B.join(","),w,j,S,T,$);return W?", ".concat(W):""},x.prototype.generateRangeSegmentDescription=function(m,v,w){var j="",S=m.split("-"),T=w(S[0],1),$=w(S[1],2),_=v(m);return j+=p.StringUtilities.format(_,T,$),j},x.prototype.formatTime=function(m,v,w){var j=0,S=0,T=parseInt(m)+j,$=parseInt(v)+S;$>=60?($-=60,T+=1):$<0&&($+=60,T-=1),T>=24?T=T-24:T<0&&(T=24+T);var _="",E=!1;this.options.use24HourTimeFormat||(E=!!(this.i18n.setPeriodBeforeTime&&this.i18n.setPeriodBeforeTime()),_=E?"".concat(this.getPeriod(T)," "):" ".concat(this.getPeriod(T)),T>12&&(T-=12),T===0&&(T=12));var R="";w&&(R=":".concat(("00"+w).substring(w.length)));var C=T.toString(),O=("00"+C).substring(C.length),z=$.toString(),F=("00"+z).substring(z.length),D=this.options.trimHoursLeadingZero?C:O;return"".concat(E?_:"").concat(D,":").concat(F).concat(R).concat(E?"":_)},x.prototype.transformVerbosity=function(m,v){if(!v&&(m=m.replace(new RegExp(", ".concat(this.i18n.everyMinute()),"g"),""),m=m.replace(new RegExp(", ".concat(this.i18n.everyHour()),"g"),""),m=m.replace(new RegExp(this.i18n.commaEveryDay(),"g"),""),m=m.replace(/\, ?$/,""),this.i18n.conciseVerbosityReplacements))for(var w=0,j=Object.entries(this.i18n.conciseVerbosityReplacements());w<j.length;w++){var S=j[w],T=S[0],$=S[1];m=m.replace(new RegExp(T,"g"),$)}return m},x.prototype.getPeriod=function(m){return m>=12?this.i18n.pm&&this.i18n.pm()||"PM":this.i18n.am&&this.i18n.am()||"AM"},x.locales={},x})();u.ExpressionDescriptor=b},3747(c,u,f){Object.defineProperty(u,"__esModule",{value:!0}),u.enLocaleLoader=void 0;var p=f(9486),h=(function(){function b(){}return b.prototype.load=function(x){x.en=new p.en},b})();u.enLocaleLoader=h},9486(c,u){Object.defineProperty(u,"__esModule",{value:!0}),u.en=void 0;var f=function(h){return Number(h)===1},p=(function(){function h(){}return h.prototype.atX0SecondsPastTheMinuteGt20=function(){return null},h.prototype.atX0MinutesPastTheHourGt20=function(){return null},h.prototype.commaMonthX0ThroughMonthX1=function(){return null},h.prototype.commaYearX0ThroughYearX1=function(){return null},h.prototype.use24HourTimeFormatByDefault=function(){return!1},h.prototype.anErrorOccuredWhenGeneratingTheExpressionD=function(){return"An error occurred when generating the expression description. Check the cron expression syntax."},h.prototype.everyMinute=function(){return"every minute"},h.prototype.everyHour=function(){return"every hour"},h.prototype.atSpace=function(){return"At "},h.prototype.everyMinuteBetweenX0AndX1=function(){return"Every minute between %s and %s"},h.prototype.at=function(){return"At"},h.prototype.spaceAnd=function(){return" and"},h.prototype.everySecond=function(){return"every second"},h.prototype.everyX0Seconds=function(b){return f(b)?"every %s second":"every %s seconds"},h.prototype.secondsX0ThroughX1PastTheMinute=function(){return"seconds %s through %s past the minute"},h.prototype.atX0SecondsPastTheMinute=function(b){return f(b)?"at %s second past the minute":"at %s seconds past the minute"},h.prototype.everyX0Minutes=function(b){return f(b)?"every %s minute":"every %s minutes"},h.prototype.minutesX0ThroughX1PastTheHour=function(){return"minutes %s through %s past the hour"},h.prototype.atX0MinutesPastTheHour=function(b){return f(b)?"at %s minute past the hour":"at %s minutes past the hour"},h.prototype.everyX0Hours=function(b){return f(b)?"every %s hour":"every %s hours"},h.prototype.betweenX0AndX1=function(){return"between %s and %s"},h.prototype.atX0=function(){return"at %s"},h.prototype.commaEveryDay=function(){return", every day"},h.prototype.commaEveryX0DaysOfTheWeek=function(){return", every %s days of the week"},h.prototype.commaX0ThroughX1=function(){return", %s through %s"},h.prototype.commaAndX0ThroughX1=function(){return", %s through %s"},h.prototype.first=function(){return"first"},h.prototype.second=function(){return"second"},h.prototype.third=function(){return"third"},h.prototype.fourth=function(){return"fourth"},h.prototype.fifth=function(){return"fifth"},h.prototype.commaOnThe=function(){return", on the "},h.prototype.spaceX0OfTheMonth=function(){return" %s of the month"},h.prototype.lastDay=function(){return"the last day"},h.prototype.commaOnTheLastX0OfTheMonth=function(){return", on the last %s of the month"},h.prototype.commaOnlyOnX0=function(){return", only on %s"},h.prototype.commaAndOnX0=function(){return", and on %s"},h.prototype.commaEveryX0Months=function(){return", every %s months"},h.prototype.commaOnlyInX0=function(){return", only in %s"},h.prototype.commaOnTheLastDayOfTheMonth=function(){return", on the last day of the month"},h.prototype.commaOnTheLastWeekdayOfTheMonth=function(){return", on the last weekday of the month"},h.prototype.commaDaysBeforeTheLastDayOfTheMonth=function(b){return f(b)?", %s day before the last day of the month":", %s days before the last day of the month"},h.prototype.firstWeekday=function(){return"first weekday"},h.prototype.weekdayNearestDayX0=function(){return"weekday nearest day %s"},h.prototype.commaOnTheX0OfTheMonth=function(){return", on the %s of the month"},h.prototype.commaDaysBeforeTheX0OfTheMonth=function(b){return f(b)?", %s day before the %s of the month":", %s days before the %s of the month"},h.prototype.commaDaysAfterTheX0OfTheMonth=function(b){return f(b)?", %s day after the %s of the month":", %s days after the %s of the month"},h.prototype.commaEveryX0Days=function(){return", every %s days in a month"},h.prototype.commaBetweenDayX0AndX1OfTheMonth=function(){return", between day %s and %s of the month"},h.prototype.commaOnDayX0OfTheMonth=function(){return", on day %s of the month"},h.prototype.commaEveryHour=function(){return", every hour"},h.prototype.commaEveryX0Years=function(b){return f(b)?", every %s year":", every %s years"},h.prototype.commaStartingX0=function(){return", starting %s"},h.prototype.daysOfTheWeek=function(){return["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},h.prototype.monthsOfTheYear=function(){return["January","February","March","April","May","June","July","August","September","October","November","December"]},h.prototype.atReboot=function(){return"Run once, at startup"},h.prototype.onTheHour=function(){return"on the hour"},h})();u.en=p},9515(c,u){Object.defineProperty(u,"__esModule",{value:!0});function f(b,x){if(!b)throw new Error(x)}function p(b){var x=[];if(!isNaN(parseInt(b,10))){x.push(parseInt(b,10));var m=b.match(/^\d+-(-?\d+)/);m&&x.push(parseInt(m[1],10))}return x}var h=(function(){function b(){}return b.stepRange=function(x){for(var m=x.split(","),v=0;v<m.length;v++){var w=m[v].split("/")[1];f(w===void 0||!/^0+$/.test(w),"step value must be greater than 0")}},b.secondRange=function(x){for(var m=x.split(","),v=0;v<m.length;v++)for(var w=0,j=p(m[v]);w<j.length;w++){var S=j[w];f(S>=0&&S<=59,"seconds part must be >= 0 and <= 59")}},b.minuteRange=function(x){for(var m=x.split(","),v=0;v<m.length;v++)for(var w=0,j=p(m[v]);w<j.length;w++){var S=j[w];f(S>=0&&S<=59,"minutes part must be >= 0 and <= 59")}},b.hourRange=function(x){for(var m=x.split(","),v=0;v<m.length;v++)for(var w=0,j=p(m[v]);w<j.length;w++){var S=j[w];f(S>=0&&S<=23,"hours part must be >= 0 and <= 23")}},b.dayOfMonthRange=function(x){for(var m=x.split(","),v=0;v<m.length;v++)for(var w=0,j=p(m[v]);w<j.length;w++){var S=j[w];f(S>=1&&S<=31,"DOM part must be >= 1 and <= 31")}},b.monthRange=function(x,m){for(var v=x.split(","),w=0;w<v.length;w++)for(var j=0,S=p(v[w]);j<S.length;j++){var T=S[j];f(T>=1&&T<=12,m?"month part must be >= 0 and <= 11":"month part must be >= 1 and <= 12")}},b.dayOfWeekRange=function(x,m){for(var v=x.split(","),w=0;w<v.length;w++){if(v[w].indexOf("#")>-1){var j=v[w].substring(v[w].indexOf("#")+1);f(/^[1-5]$/.test(j),"DOW nth weekday must be >= 1 and <= 5")}for(var S=0,T=p(v[w]);S<T.length;S++){var $=T[S];f($>=0&&$<=6,m?"DOW part must be >= 0 and <= 6":"DOW part must be >= 1 and <= 7")}}},b})();u.default=h},1823(c,u){Object.defineProperty(u,"__esModule",{value:!0}),u.StringUtilities=void 0;var f=(function(){function p(){}return p.format=function(h){for(var b=[],x=1;x<arguments.length;x++)b[x-1]=arguments[x];return h.replace(/%s/g,function(m){return b.shift()})},p.containsAny=function(h,b){return b.some(function(x){return h.indexOf(x)>-1})},p})();u.StringUtilities=f}},o={};function i(c){var u=o[c];if(u!==void 0)return u.exports;var f=o[c]={exports:{}};return n[c](f,f.exports,i),f.exports}var l={};return(()=>{var c=l;Object.defineProperty(c,"__esModule",{value:!0}),c.toString=void 0;var u=i(8333),f=i(3747);u.ExpressionDescriptor.initialize(new f.enLocaleLoader),c.default=u.ExpressionDescriptor;var p=u.ExpressionDescriptor.toString;c.toString=p})(),l})())})(yp)),yp.exports}var bL=vL();const wL=Jw(bL),Ea=(e,t)=>t&&e===oh(t)?t:OL(e),ri=()=>Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC",dN=(e="")=>({name:"",kind:"cron",cron:"",timezone:ri(),at:"",every:"",everyUnit:"minutes",startAt:"",agentId:e,content:"",maxCost:"",enabled:!0}),fN={seconds:1,minutes:60,hours:3600};function mN(e){const[t,n]=e%3600===0?[e/3600,"hour"]:e%60===0?[e/60,"minute"]:[e,"second"];return t===1?n:`${t} ${n}s`}function pN(e){try{return wL.toString(e,{use24HourTimeFormat:!0,throwExceptionOnParseError:!0,verbose:!1})}catch{return`Cron ${e}`}}const Ao=e=>String(e).padStart(2,"0"),id=(e,t)=>e.toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",timeZone:t});function hN(e,t){const n=l=>{var c;return((c=new Intl.DateTimeFormat(l,{timeZone:t,timeZoneName:"short"}).formatToParts(e).find(u=>u.type==="timeZoneName"))==null?void 0:c.value)??t},o=n("en-US");if(!/^GMT[+-]/.test(o))return o;const i=n("en-GB");return/^GMT[+-]/.test(i)?o:i}const Pw=(e,t)=>{const n=new Date(e);return`${n.toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",timeZone:t}).replace(",","")}, ${id(n,t)} ${hN(n,t)}`};function Lw(e,{zone:t=ri(),now:n=Date.now()}={}){const o=new Date(e),i=c=>c.toLocaleDateString("en-US",{year:"numeric",month:"numeric",day:"numeric",timeZone:t});return`Pick a time in the future: ${i(o)===i(new Date(n))?`${id(o,t)} today`:`${o.toLocaleDateString("en-US",{month:"short",day:"numeric",timeZone:t})}, ${id(o,t)} ${hN(o,t)}`} has already passed.`}function ld(e,t){const n={};for(const{type:o,value:i}of new Intl.DateTimeFormat("en-US",{timeZone:t,hourCycle:"h23",year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric"}).formatToParts(e))n[o]=i;return Date.UTC(Number(n.year),Number(n.month)-1,Number(n.day),Number(n.hour),Number(n.minute))}function kL(e,t,n,o){const i=new Date(ld(e,t)),l=Date.UTC(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),n,o);let c=l;for(let u=0;u<2;u++)c+=l-ld(new Date(c),t);return new Date(c)}const jL=e=>{const t=e.trim().split(/\s+/);return t.length!==5||!/^\d{1,2}$/.test(t[0])||!/^\d{1,2}$/.test(t[1])?null:{minute:Number(t[0]),hour:Number(t[1]),days:t.slice(2).some(n=>n!=="*"&&n!=="?")}};function NL(e,t,n,o,i){const l=pN(e),c=t!==n,u=jL(e),f=u&&`At ${Ao(u.hour)}:${Ao(u.minute)}`;if(u&&f&&l.startsWith(f))try{const p=o??kL(i,t,u.hour,u.minute),h=u.days?Math.floor(ld(p,n)/864e5)-Math.floor(ld(p,t)/864e5):0,b=h>0?" the next day":h<0?" the day before":"";return`At ${id(p,n)} your time${b}${c?` (${f.slice(3)} ${t})`:""}${l.slice(f.length)}`}catch{}return`${l}${c?` (${t})`:""}`}function Cg(e,t,{zone:n=ri(),instead:o,now:i=Date.now()}={}){const l=o?` · ${o}`:t?` · next ${Pw(t,n)}`:" · no next time";return"cron"in e?`${NL(e.cron,e.timezone,n,t?new Date(t):null,new Date(i))}${l}`:"at"in e?`Once, ${Pw(e.at,n)}${!o&&t&&Date.parse(t)===Date.parse(e.at)?"":l}`:`Every ${mN(e.every_s)}${l}`}const oi=e=>`$${Number.isInteger(Math.round(e*1e6)/1e4)?e.toFixed(2):String(e)}`,SL=e=>`${oi(e)} a run`,_L=(e,t)=>typeof e=="number"?SL(e):typeof t=="number"&&t>0?`Agent's default (${oi(t)})`:"Agent's default";function Rg(e,t,n=[]){if(e.source.kind!=="schedule"||!("at"in e.source)||e.next_at!==null)return null;const o=Date.parse(e.source.at);if(o>t)return null;const i=[e.last_firing,...n].find(l=>l&&l.status==="started"&&Date.parse(l.nominal_at)===o);return i?{ran:i}:{passed:e.source.at}}const Ag=e=>e.source.kind==="schedule"&&e.target.kind==="start_run",$L=e=>e.source.kind==="webhook"&&e.target.kind==="start_run",EL=e=>e.source.kind==="github"&&e.target.kind==="start_run",gN=[{event:"pull_request",action:"opened",label:"A pull request is opened"},{event:"pull_request",action:"synchronize",label:"A pull request gets new commits"},{event:"pull_request",action:"reopened",label:"A pull request is reopened"},{event:"issue_comment",action:"created",label:"Someone comments on an issue or pull request"}],Cl=e=>`${location.origin}/v2/hooks/${encodeURIComponent(e.id)}`,Og="This server's address as this page sees it: behind a proxy, use its public address.",rh={standard:"Standard Webhooks (webhook-signature)",github:"GitHub's (X-Hub-Signature-256)"},TL=e=>"in"in e?`${e.pointer} is one of ${e.in.map(t=>JSON.stringify(t)).join(", ")}`:"exists"in e?`${e.pointer} ${e.exists?"is there":"is absent"}`:`${e.pointer} starts with ${JSON.stringify(e.prefix)}`,cd=(e,t=!0)=>{var n,o;return`${e.event}${(n=e.actions)!=null&&n.length?` (${e.actions.join(", ")})`:""}${t&&((o=e.where)!=null&&o.length)?` where ${e.where.map(TL).join(" and ")}`:""}`},xN=e=>{var t;return(t=e.accept)!=null&&t.length?`Only signed requests for ${e.accept.map(n=>cd(n,!1)).join(" or ")}`:"On each signed request"},CL={schedule:"On schedule",manual:"Run now",webhook:"On a request",github:"On a GitHub event"},yN=e=>`On GitHub ${e.accept.map(t=>cd(t,!1)).join(" or ")}`;function vN(e){var n;const t=(o,i)=>i?`${o}: ${i}`:o;switch(e.status){case"started":return"Started";case"skipped":return t("Skipped",e.reason);case"missed":return t(`Missed ${e.count??1} ${e.count===1||e.count===void 0?"time":"times"}`,e.reason);case"failed":return t("Failed",((n=e.error)==null?void 0:n.message)??e.reason);case"due":return e.retry_at?`Due: the server was full, tries again at ${Id(e.retry_at)}`:"Due";case"sent":return"Sent";default:return String(e.status)}}const RL={due:"Due",started:"Started",sent:"Sent",skipped:"Skipped",failed:"Failed",missed:"Missed"},AL=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2})?$/;function OL(e){if(!AL.test(e))return null;const t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString().replace(/\.\d{3}Z$/,"Z")}function oh(e){const t=new Date(e);return`${t.getFullYear()}-${Ao(t.getMonth()+1)}-${Ao(t.getDate())}T${Ao(t.getHours())}:${Ao(t.getMinutes())}${t.getSeconds()?`:${Ao(t.getSeconds())}`:""}`}const Iw=e=>`${new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:"UTC"})} UTC`;function ML(e){const t=mN(e);return/^\d/.test(t)?`At least ${t}.`:`At least ${t==="hour"?"an":"a"} ${t}.`}const ah="A number is needed.",ih=e=>e.trim()!==""&&Number.isFinite(Number(e))?Number(e):void 0;function zw(e,t=!1){var l,c;const n={};let o;if(e.kind==="cron")e.cron.trim()||(n["source.cron"]="Pick when it runs."),o={kind:"schedule",cron:e.cron.trim(),timezone:e.timezone.trim()||ri()};else if(e.kind==="at"){const u=Ea(e.at,(l=e.read)==null?void 0:l.at);u===null&&(n["source.at"]="A time is needed."),o={kind:"schedule",at:u??""}}else{const u=ih(e.every);e.every.trim()?u===void 0&&(n["source.every_s"]=ah):n["source.every_s"]="A number is needed.";const f=e.startAt?Ea(e.startAt,(c=e.read)==null?void 0:c.startAt):null;o={kind:"schedule",every_s:Math.round((u??0)*fN[e.everyUnit]),...f?{start_at:f}:{}}}e.agentId||(n["target.agent_id"]="Pick an agent."),e.content.trim()||(n["target.input"]="Say what each run is asked.");const i=ih(e.maxCost);return e.maxCost.trim()?i===void 0&&(n["target.max_cost_usd"]=ah):t||(n["target.max_cost_usd"]="A cost cap is needed: every run a schedule starts is capped."),Object.keys(n).length?{issues:n}:{body:{...e.name.trim()?{name:e.name.trim()}:{},enabled:e.enabled,source:o,target:{kind:"start_run",agent_id:e.agentId,input:{content:e.content},...i!==void 0?{max_cost_usd:i}:{}}}}}const PL=()=>({name:"",signature:"standard",agentId:"",content:"",maxCost:""});function LL(e,t=!1){return bN(e,{kind:"webhook",signature:e.signature},{},t,"a webhook")}const IL=()=>({name:"",events:["pull_request:opened"],agentId:"",content:"",maxCost:""});function zL(e,t=!1){const n=[];for(const{event:o,action:i}of gN.filter(l=>e.events.includes(`${l.event}:${l.action}`))){const l=n.find(c=>c.event===o);l?l.actions.push(i):n.push({event:o,actions:[i]})}return bN(e,{kind:"github",accept:n},n.length?{}:{"source.accept":"Pick at least one event."},t,"a GitHub trigger")}function bN(e,t,n,o,i){e.agentId||(n["target.agent_id"]="Pick an agent."),e.content.trim()||(n["target.input"]="Say what each run is asked.");const l=ih(e.maxCost);return e.maxCost.trim()?l===void 0&&(n["target.max_cost_usd"]=ah):o||(n["target.max_cost_usd"]=`A cost cap is needed: every run ${i} starts is capped.`),Object.keys(n).length?{issues:n}:{body:{...e.name.trim()?{name:e.name.trim()}:{},source:t,target:{kind:"start_run",agent_id:e.agentId,input:{content:e.content},...l!==void 0?{max_cost_usd:l}:{}}}}}function DL(e){const t=e.source,n="cron"in t?t.timezone:ri(),o={...dN(e.target.agent_id),name:e.name,timezone:n,content:typeof e.target.input.content=="string"?e.target.input.content:"",maxCost:typeof e.target.max_cost_usd=="number"?String(e.target.max_cost_usd):"",enabled:e.enabled};if("cron"in t)return{...o,kind:"cron",cron:t.cron};if("at"in t)return{...o,kind:"at",at:oh(t.at),read:{at:t.at}};const i=t.every_s%3600===0?"hours":t.every_s%60===0?"minutes":"seconds";return{...o,kind:"every",every:String(t.every_s/fN[i]),everyUnit:i,startAt:oh(t.start_at),read:{startAt:t.start_at}}}const lh=(e,t)=>{if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e===null||t===null||Array.isArray(e)!==Array.isArray(t))return!1;const[n,o]=[Object.keys(e),Object.keys(t)];return n.length===o.length&&n.every(i=>lh(e[i],t[i]))};function Dw(e,t){const n=t.source&&"every_s"in t.source&&!t.source.start_at&&"every_s"in e.source?{...t.source,start_at:e.source.start_at}:t.source,o=t.target&&{...t.target,input:{...e.target.input,...t.target.input},...e.target.effort!==void 0&&t.target.effort===void 0?{effort:e.target.effort}:{}};return{...t.name!==void 0&&t.name!==e.name?{name:t.name}:{},...n&&!lh(n,e.source)?{source:n}:{},...o&&!lh(o,e.target)?{target:o}:{}}}const FL=["name","enabled","source.cron","source.timezone","source.at","source.every_s","source.start_at","target.agent_id","target.input","target.max_cost_usd"];function Mg(e){var o;if(!(e instanceof Ee))return{fields:{},rest:[e instanceof Error?e.message:String(e)]};if(e.status!==422||!((o=e.fields)!=null&&o.length))return{fields:{},rest:[`${e.code}: ${e.message}`]};const t={},n=[];for(const i of e.fields){const l=i.field.startsWith("target.input")?"target.input":i.field;FL.includes(l)&&!t[l]?t[l]=i.message:n.push(i.message)}return{fields:t,rest:n}}const UL=[{value:"hourly",label:"Every hour"},{value:"daily",label:"Every day"},{value:"weekdays",label:"Every weekday (Monday to Friday)"},{value:"weekly",label:"Every week"},{value:"monthly",label:"Every month"},{value:"custom",label:"Custom schedule"}],WL=[1,2,3,4,5,6,0].map(e=>({value:String(e),label:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][e]})),HL=Array.from({length:31},(e,t)=>({value:String(t+1),label:String(t+1)})),BL=Array.from({length:60},(e,t)=>({value:String(t),label:`:${String(t).padStart(2,"0")}`}));function wN({value:e,onChange:t,label:n,name:o}){const i=pL(e),[l,c]=y.useState(()=>e.trim()!==""&&!i),u=y.useId(),f=l||e.trim()!==""&&!i,p=x=>t(hL(x)),h=x=>{if(x==="custom"){c(!0);return}c(!1),p(gL(x,i))},b=i&&"at"in i?i.at:null;return s.jsxs("div",{className:"space-y-2","data-schedule-when":!0,children:[s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(Kt,{label:n,className:"min-w-56 flex-1",value:f?"custom":(i==null?void 0:i.kind)??"",onChange:h,placeholder:"Pick when it runs",options:UL}),!f&&(i==null?void 0:i.kind)==="weekly"&&s.jsx(Kt,{id:`${u}-day`,label:"Day of the week",className:"w-40",value:String(i.day),onChange:x=>p({...i,day:Number(x)}),options:WL}),!f&&(i==null?void 0:i.kind)==="monthly"&&s.jsx(Kt,{id:`${u}-date`,label:"Day of the month",className:"w-24",value:String(i.date),onChange:x=>p({...i,date:Number(x)}),options:HL}),!f&&(i==null?void 0:i.kind)==="hourly"&&s.jsx(Kt,{id:`${u}-minute`,label:"Minutes past the hour",className:"w-24",value:String(i.minute),onChange:x=>p({...i,minute:Number(x)}),options:BL}),!f&&i&&b&&s.jsx(He,{id:`${u}-at`,type:"time","aria-label":"At",className:"w-32",value:xL(b),onChange:x=>{const m=yL(x.target.value);m&&p({...i,at:m})}})]}),f&&s.jsxs(s.Fragment,{children:[s.jsx(He,{id:`${u}-line`,name:o,"aria-label":"Custom schedule",value:e,onChange:x=>t(x.target.value),placeholder:"30 1 * * *",spellCheck:!1}),s.jsx("p",{className:"text-small text-muted-foreground","aria-live":"polite",children:e.trim()?pN(e.trim()):"Minute, hour, day of month, month, day of week."})]})]})}const Fw=Intl.supportedValuesOf,wu=typeof Fw=="function"?Fw("timeZone"):[],ku=wu.length&&!wu.includes("UTC")?["UTC",...wu]:wu;function kN({value:e,onChange:t,label:n,name:o,id:i,className:l}){if(!ku.length)return s.jsx(He,{id:i,name:o,"aria-label":n,className:l,value:e,onChange:u=>t(u.target.value),placeholder:"Europe/Madrid"});const c=e&&!ku.includes(e)?[e,...ku]:ku;return s.jsx(Kt,{id:i,name:o,label:n,className:l,value:e,onChange:t,placeholder:"Pick a time zone",options:c.map(u=>({value:u,label:u.replace(/_/g," ")}))})}const to=e=>`#/triggers/${encodeURIComponent(e)}`,ud=e=>St(e),GL={started:"success",sent:"success",skipped:"muted",missed:"warning",failed:"error",due:"active"};function qL({v2:e,view:t,go:n,agentName:o,minEvery:i,refreshMs:l=15e3,now:c=Date.now}){return t.trigger===void 0?s.jsx(XL,{v2:e,go:n,agentName:o,every:l*2,now:c}):t.trigger===null?t.kind==="webhook"?s.jsx(nI,{v2:e,go:n}):t.kind==="github"?s.jsx(sI,{v2:e,go:n}):s.jsx($N,{v2:e,go:n,minEvery:i,now:c}):t.edit?s.jsx(eI,{v2:e,go:n,id:t.trigger,minEvery:i,now:c},t.trigger):s.jsx(JL,{v2:e,go:n,agentName:o,id:t.trigger,every:l,now:c},t.trigger)}function jN(e,t,n){const o=y.useRef(e);o.current=e,y.useEffect(()=>{const i=()=>document.visibilityState!=="hidden",l=setInterval(()=>{i()&&o.current()},t),c=()=>{i()&&o.current()};return document.addEventListener("visibilitychange",c),()=>{clearInterval(l),document.removeEventListener("visibilitychange",c)}},[t,...n])}const NN=e=>e?"ran"in e?`Done · ran ${ud(e.ran.nominal_at)}`:`Its time passed · ${ud(e.passed)}`:null,VL=/has already passed\.?$/,KL=e=>e.last_firing?`${vN(e.last_firing)} · ${ud(e.last_firing.nominal_at)}`:"Not fired yet";function XL({v2:e,go:t,agentName:n,every:o,now:i}){const[l,c]=y.useState(null),[u,f]=y.useState(null),[p,h]=y.useState(0),b=y.useRef(!1),x=y.useRef(!0);y.useEffect(()=>(x.current=!0,()=>{x.current=!1}),[]);const m=()=>{b.current||(b.current=!0,e.listTriggers().then(v=>{x.current&&(c(v.triggers),f(null))},v=>{x.current&&f(mn(v,"the triggers"))}).finally(()=>{b.current=!1}))};return y.useEffect(m,[e,p]),jN(m,o,[e]),s.jsxs("div",{className:"p-5 md:p-8",children:[s.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-3",children:[s.jsx("h1",{className:"mr-auto font-mono text-2xl font-semibold",children:"Triggers"}),!(l&&!l.length)&&s.jsxs(s.Fragment,{children:[s.jsxs(Z,{size:"lg",onClick:()=>t("#/triggers/new-github"),children:[s.jsx(bh,{"aria-hidden":!0})," New GitHub trigger"]}),s.jsxs(Z,{size:"lg",onClick:()=>t("#/triggers/new-webhook"),children:[s.jsx(hl,{"aria-hidden":!0})," New webhook"]}),s.jsxs(Z,{size:"lg",variant:"solid",onClick:()=>t("#/triggers/new"),children:[s.jsx(pl,{"aria-hidden":!0})," New schedule"]})]})]}),u&&!l?s.jsx($n,{problem:u,onRetry:()=>h(v=>v+1),className:""}):l?l.length?s.jsx("ul",{className:"border",children:l.map(v=>s.jsxs("li",{"data-trigger":v.id,className:"grid grid-cols-1 gap-x-6 gap-y-1.5 border-b px-4 py-3 last:border-b-0 md:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("a",{href:to(v.id),className:"min-w-0 break-words text-prose font-semibold hover:underline",children:v.name}),s.jsx(Me,{children:QL[v.source.kind]}),!v.enabled&&!Rg(v,i())&&s.jsx(Me,{tone:"muted",children:"Paused"})]}),s.jsx("p",{className:"mt-1 break-words font-mono text-small text-muted-foreground",title:SN(v),children:ZL(v,n,i())})]}),s.jsx("div",{className:"min-w-0 font-mono text-small text-muted-foreground md:text-right",children:s.jsx("p",{className:"break-words",children:KL(v)})})]},v.id))}):s.jsx(YL,{go:t}):s.jsx(_s,{label:"Loading the triggers",rows:4}),l&&u&&s.jsx($n,{problem:u,className:"mt-4"})]})}function YL({go:e}){const t=[{Icon:pd,name:"Schedule",what:"At the times you set: every day or week at a time, every few minutes or hours, or once.",action:"New schedule",to:"#/triggers/new"},{Icon:hl,name:"Webhook",what:"On each signed request another system sends to its URL.",action:"New webhook",to:"#/triggers/new-webhook"},{Icon:bh,name:"GitHub",what:"On the events you pick from this server's GitHub App. Connect GitHub in Settings first.",action:"New GitHub trigger",to:"#/triggers/new-github"}];return s.jsxs("section",{"aria-labelledby":"first-trigger",className:"border border-primary/50 bg-primary/5 p-5",children:[s.jsx("p",{className:"caps text-label text-primary-text",children:"No triggers yet"}),s.jsx("h2",{id:"first-trigger",className:"mt-2 text-xl font-semibold",children:"Start runs without being here"}),s.jsx("p",{className:"mt-1 max-w-prose text-lead text-muted-foreground",children:"A trigger starts a run of an agent for you, and each run it starts stops at a spend cap. Pick what should start it."}),s.jsx("ul",{className:"mt-5 grid grid-cols-1 gap-3 md:grid-cols-3",children:t.map(({Icon:n,name:o,what:i,action:l,to:c})=>s.jsxs("li",{className:"flex flex-col border bg-background p-4",children:[s.jsxs("p",{className:"flex items-center gap-2 text-prose font-semibold",children:[s.jsx(n,{className:"size-4 text-primary-text","aria-hidden":!0}),o]}),s.jsx("p",{className:"mt-2 flex-1 text-lead leading-relaxed text-muted-foreground",children:i}),s.jsx(Z,{size:"sm",variant:c==="#/triggers/new"?"solid":"outline",className:"mt-4 self-start",onClick:()=>e(c),children:l})]},o))})]})}const QL={schedule:"Schedule",webhook:"Webhook",github:"GitHub"},SN=e=>e.source.kind==="schedule"&&"cron"in e.source?e.source.cron:void 0;function ZL(e,t,n){return`${e.source.kind==="schedule"?Cg(e.source,e.next_at,{instead:NN(Rg(e,n)),now:n}):e.source.kind==="github"?yN(e.source):xN(e.source)} · ${e.target.kind==="start_run"?t(e.target.agent_id)||e.target.agent_id:`messages run ${Hl(e.target.run_id)}`}`}function _N(){return s.jsxs("div",{className:"p-5 md:p-8",children:[s.jsxs("a",{href:"#/triggers",className:"caps flex items-center gap-2 text-label text-muted-foreground hover:text-foreground",children:[s.jsx(Ds,{className:"size-3.5","aria-hidden":!0})," Triggers"]}),s.jsx("p",{className:"mt-4 border px-4 py-6 text-body text-muted-foreground",children:"This trigger sends its firings to a run: this page doesn't open it yet."})]})}function JL({v2:e,go:t,agentName:n,id:o,every:i,now:l}){var ye;const[c,u]=y.useState(null),[f,p]=y.useState([]),[h,b]=y.useState(null),[x,m]=y.useState(null),[v,w]=y.useState(null),[j,S]=y.useState(!1),[T,$]=y.useState(!1),[_,E]=y.useState(null),R=y.useRef(!1),[C,O]=y.useState(!1),[z,F]=y.useState(0),D=y.useRef(!1),B=y.useRef(!1),U=y.useRef(0),W=()=>{B.current=!0;const ee=U.current;return Promise.all([e.getTrigger(o),e.triggerFirings(o)]).then(([be,Oe])=>{ee===U.current&&(u(be),p(Oe.firings),b(null))}).finally(()=>{B.current=!1})};y.useEffect(()=>{W().catch(ee=>b(mn(ee,"the trigger")))},[e,o,z]),jN(()=>{!B.current&&!D.current&&W().catch(()=>{})},i,[e,o]);const[X,M]=y.useState(void 0),K=c&&c.target.kind==="start_run"&&typeof c.target.max_cost_usd!="number"?c.target.agent_id:null;if(y.useEffect(()=>{if(!K)return;let ee=!0;return e.getAgent(K).then(be=>{ee&&M(typeof be.agent.definition.max_cost_usd=="number"?be.agent.definition.max_cost_usd:void 0)},()=>{}),()=>{ee=!1}},[e,K]),!c)return h?s.jsx($n,{problem:h,onRetry:()=>F(ee=>ee+1),link:{href:"#/triggers",label:"All triggers"}}):s.jsx(_s,{label:"Loading the trigger",rows:4});const L=$L(c)?c:null,I=EL(c)?c:null;if(!L&&!I&&!Ag(c))return s.jsx(_N,{});const G=c,P=Rg(c,l(),f),q=async(ee,be,Oe)=>{w(ee),m(null);try{await be()}catch(We){m(mn(We,Oe))}finally{w(null)}},ne=()=>q("pause",async()=>{U.current++;const ee=await e.updateTrigger(o,{enabled:!c.enabled});U.current++,u(ee)},c.enabled?"the pause":"the resume"),ae=()=>q("delete",async()=>{await e.deleteTrigger(o),t("#/triggers")},"the delete"),ie=async()=>{if(!R.current){R.current=!0,O(!0),m(null),E(null);try{E((await e.rotateTriggerSecret(o)).signing_secret)}catch(ee){m(mn(ee,"the new secret"))}finally{R.current=!1,O(!1)}}},ce=async()=>{if(!D.current){D.current=!0,w("fire"),m(null),U.current++;try{const ee=await e.fireTrigger(o,Wd());U.current++,p(be=>[ee,...be.filter(Oe=>Oe.key!==ee.key)]),await W().catch(()=>{})}catch(ee){m(mn(ee,"the run now"))}finally{D.current=!1,w(null)}}},le=typeof G.target.input.content=="string"?G.target.input.content:null;return s.jsxs("div",{className:"p-5 md:p-8",children:[s.jsxs("a",{href:"#/triggers",className:"caps flex items-center gap-2 text-label text-muted-foreground hover:text-foreground",children:[s.jsx(Ds,{className:"size-3.5","aria-hidden":!0})," Triggers"]}),s.jsxs("div",{className:"mt-3 flex flex-col items-start gap-x-6 gap-y-3 sm:flex-row",children:[s.jsxs("div",{className:"min-w-0 flex-1 self-stretch",children:[s.jsxs("h1",{className:"flex flex-wrap items-center gap-2 break-words text-2xl font-semibold leading-tight",children:[c.name,!c.enabled&&!P&&s.jsx(Me,{tone:"muted",children:"Paused"})]}),s.jsx("p",{className:"mt-2 break-words font-mono text-small text-muted-foreground",children:L?`Webhook · ${xN(L.source)}`:I?`GitHub · ${yN(I.source)}`:s.jsx("span",{title:SN(c),children:Cg(G.source,c.next_at,{instead:NN(P),now:l()})})})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs(Z,{size:"sm",variant:"solid",onClick:()=>void ce(),disabled:v==="fire",children:[s.jsx(E_,{"aria-hidden":!0})," ",v==="fire"?"Starting":"Run now"]}),!(P&&"ran"in P)&&s.jsx(Z,{size:"sm",onClick:()=>void ne(),disabled:v!==null,children:c.enabled?s.jsxs(s.Fragment,{children:[s.jsx(ml,{"aria-hidden":!0})," Pause"]}):s.jsxs(s.Fragment,{children:[s.jsx(Pl,{"aria-hidden":!0})," Resume"]})}),!L&&!I&&s.jsxs(Z,{size:"sm",onClick:()=>t(`${to(o)}/edit`),children:[s.jsx(Ml,{"aria-hidden":!0})," Edit"]}),L&&(T?s.jsxs("span",{className:"flex items-center gap-2 border border-warning/50 px-2 py-1 text-small",role:"alertdialog","aria-label":"Make a new secret?",children:[s.jsx("span",{children:"The old secret stops signing at once."}),s.jsx(Z,{size:"sm",variant:"solid",onClick:()=>{$(!1),ie()},children:"Yes, make a new one"}),s.jsx(Z,{size:"sm",variant:"ghost",onClick:()=>$(!1),children:"Keep"})]}):s.jsxs(Z,{size:"sm",onClick:()=>$(!0),disabled:v!==null||C,children:[s.jsx(Al,{"aria-hidden":!0})," Rotate secret"]})),j?s.jsxs("span",{className:"flex items-center gap-2 border border-destructive/50 px-2 py-1 text-small",role:"alertdialog","aria-label":"Delete this trigger?",children:[s.jsx("span",{children:"Delete for good? Its runs stay."}),s.jsx(Z,{size:"sm",variant:"destructive",onClick:()=>{S(!1),ae()},children:"Yes, delete"}),s.jsx(Z,{size:"sm",variant:"ghost",onClick:()=>S(!1),children:"Keep"})]}):s.jsxs(Z,{size:"sm",variant:"destructive",onClick:()=>S(!0),disabled:v!==null,children:[s.jsx($_,{"aria-hidden":!0})," Delete"]})]})]}),x&&s.jsx($n,{problem:x,className:"mt-4"}),L&&_&&s.jsx(Ig,{label:"The webhook's new secret",secret:_}),s.jsxs("dl",{className:"mt-5 grid grid-cols-1 gap-x-6 gap-y-3 border p-4 text-body sm:grid-cols-[max-content_minmax(0,1fr)]",children:[s.jsx("dt",{className:"caps text-label text-muted-foreground",children:"Agent"}),s.jsx("dd",{className:"min-w-0 break-words",children:s.jsx("a",{href:`#/agents/${encodeURIComponent(G.target.agent_id)}`,className:"hover:underline",children:n(G.target.agent_id)||G.target.agent_id})}),s.jsx("dt",{className:"caps text-label text-muted-foreground",children:"Each run is asked"}),s.jsx("dd",{className:"min-w-0 whitespace-pre-wrap break-words",children:le??JSON.stringify(G.target.input)}),s.jsx("dt",{className:"caps text-label text-muted-foreground",children:"Cost cap"}),s.jsx("dd",{className:"font-mono",children:_L(G.target.max_cost_usd,X)}),L?s.jsxs(s.Fragment,{children:[s.jsx("dt",{className:"caps text-label text-muted-foreground",children:"URL"}),s.jsxs("dd",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("code",{className:"min-w-0 break-all font-mono text-small",children:Cl(L)}),s.jsx(EN,{text:Cl(L),label:"Copy URL"}),s.jsx("span",{className:"basis-full text-small text-muted-foreground",children:Og})]}),s.jsx("dt",{className:"caps text-label text-muted-foreground",children:"Signature"}),s.jsx("dd",{children:rh[L.source.signature??"standard"]}),s.jsx("dt",{className:"caps text-label text-muted-foreground",children:"Accepts"}),s.jsx("dd",{className:"min-w-0 break-words",children:(ye=L.source.accept)!=null&&ye.length?s.jsx("ul",{className:"space-y-1 font-mono text-small",children:L.source.accept.map((ee,be)=>s.jsx("li",{children:cd(ee)},be))}):"Every signed request"})]}):I?s.jsxs(s.Fragment,{children:[s.jsx("dt",{className:"caps text-label text-muted-foreground",children:"Accepts"}),s.jsxs("dd",{className:"min-w-0 break-words",children:[s.jsx("ul",{className:"space-y-1 font-mono text-small",children:I.source.accept.map((ee,be)=>s.jsx("li",{children:cd(ee)},be))}),s.jsx("p",{className:"mt-1 text-small text-muted-foreground",children:"From this server's GitHub App (Settings → GitHub)."})]})]}):s.jsxs(s.Fragment,{children:[s.jsx("dt",{className:"caps text-label text-muted-foreground",children:"While a run is going"}),s.jsx("dd",{children:"The next time is skipped."})]})]}),s.jsxs("section",{className:"mt-6","aria-label":"Firings",children:[s.jsx("h2",{className:"text-lg font-semibold",children:"Firings"}),f.length?s.jsx("ul",{className:"mt-3 border",children:f.map(ee=>s.jsxs("li",{"data-firing":ee.key,className:"flex flex-col gap-1 border-b px-4 py-2.5 text-body last:border-b-0 sm:flex-row sm:items-start sm:gap-4",children:[s.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[s.jsx(Me,{tone:GL[ee.status],children:RL[ee.status]}),s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:ud(ee.nominal_at)})]}),s.jsx("span",{className:"min-w-0 flex-1 break-words",children:ee.status==="started"?CL[ee.by]:`${vN(ee)}${ee.by==="manual"?" · Run now":""}`}),ee.run_id&&s.jsxs("a",{href:`#/runs/${encodeURIComponent(ee.run_id)}`,className:"shrink-0 font-mono text-small underline-offset-2 hover:underline",children:["Run ",Hl(ee.run_id)]})]},ee.key))}):s.jsx("p",{className:"mt-2 font-mono text-small text-muted-foreground",children:"Not fired yet."})]})]})}function eI({v2:e,go:t,id:n,minEvery:o,now:i}){const[l,c]=y.useState(null),[u,f]=y.useState(null),[p,h]=y.useState(0);return y.useEffect(()=>{e.getTrigger(n).then(c,b=>f(mn(b,"the trigger")))},[e,n,p]),l?Ag(l)?s.jsx($N,{v2:e,go:t,trigger:l,minEvery:o,now:i}):s.jsx(_N,{}):u?s.jsx($n,{problem:u,onRetry:()=>h(b=>b+1)}):s.jsx(_s,{label:"Loading the schedule",rows:4})}function nn({label:e,field:t,issue:n,hint:o,children:i}){return s.jsx(Po,{className:"min-w-0",label:e,hint:o,error:n?s.jsx("span",{"data-issue":t,children:n}):void 0,children:i})}const Pg=e=>e!==void 0?`${oi(e)}, the agent's default`:void 0;async function Lg(e){const t=[];let n=null;for(let o=0;o<20;o++){const i=await e.listAgents({cursor:n});if(t.push(...i.agents),n=i.next_cursor,!n)break}return t}function $N({v2:e,go:t,trigger:n,minEvery:o,now:i=Date.now}){var U,W,X;const[l,c]=y.useState(()=>n?DL(n):dN()),[u,f]=y.useState(null),[p,h]=y.useState({}),[b,x]=y.useState([]),[m,v]=y.useState(!1),w=y.useRef(Ws()).current;y.useEffect(()=>{Lg(e).then(f,()=>f([]))},[e]);const j=M=>K=>c(L=>({...L,[M]:K})),S=M=>{var L;j("at")(M);const K=Ea(M,(L=l.read)==null?void 0:L.at);K!==null&&Date.parse(K)>i()?h(({"source.at":I,...G})=>G):K!==null&&h(I=>I["source.at"]?{...I,"source.at":Lw(K,{now:i()})}:I)},T=new Set(["name","source.cron","source.timezone","source.at","source.every_s","source.start_at","target.agent_id","target.input","target.max_cost_usd",...n?[]:["enabled"]]),$=(U=(u??[]).find(M=>M.agent_id===l.agentId))==null?void 0:U.definition.max_cost_usd,_=typeof $=="number"&&$>0?$:void 0,E=_!==void 0||!!n&&typeof n.target.max_cost_usd!="number"&&l.agentId===n.target.agent_id,R=async M=>{var I;M.preventDefault();const{body:K,issues:L}=zw(l,E);if(x([]),!K){h(L??{});return}h({}),v(!0);try{if(n){const G=Dw(n,K);Object.keys(G).length&&await e.updateTrigger(n.id,G),t(to(n.id))}else{const G=await e.createTrigger(K,w.keyFor("createTrigger",K));t(to(G.id))}}catch(G){const P=Mg(G),q=l.kind==="at"?Ea(l.at,(I=l.read)==null?void 0:I.at):null,ne=P.fields["source.at"];ne&&q!==null&&(Date.parse(q)<=i()||VL.test(ne))&&(P.fields["source.at"]=Lw(q,{now:i()})),h(Object.fromEntries(Object.entries(P.fields).filter(([ae])=>T.has(ae)))),x([...P.rest,...Object.entries(P.fields).filter(([ae])=>!T.has(ae)).map(([,ae])=>ae)]),v(!1)}},C=n?zw(l,E).body:void 0,O=!!(n&&C&&Dw(n,C).source),z=l.kind==="at"?Ea(l.at,(W=l.read)==null?void 0:W.at):null,F=l.startAt?Ea(l.startAt,(X=l.read)==null?void 0:X.startAt):null,D=Md((u??[]).filter(M=>!M.archived_at||M.agent_id===l.agentId)),B=[{kind:"cron",label:"Repeats"},{kind:"at",label:"Once"},{kind:"every",label:"Every"}];return s.jsxs("form",{onSubmit:M=>void R(M),className:"max-w-2xl p-5 md:p-8",noValidate:!0,children:[s.jsxs("a",{href:n?to(n.id):"#/triggers",className:"caps flex items-center gap-2 text-label text-muted-foreground hover:text-foreground",children:[s.jsx(Ds,{className:"size-3.5","aria-hidden":!0})," ",n?n.name:"Triggers"]}),s.jsxs("h1",{className:"mt-3 flex items-center gap-2 text-2xl font-semibold",children:[s.jsx(pd,{className:"size-5 text-primary-text","aria-hidden":!0}),n?"Edit schedule":"New schedule"]}),b.length>0&&s.jsx("div",{className:"mt-4 border border-destructive/50 p-3 text-body text-destructive-text",role:"alert",children:b.map((M,K)=>s.jsx("p",{children:M},K))}),s.jsxs("div",{className:"mt-5 space-y-5",children:[s.jsx(nn,{label:"Name",field:"name",issue:p.name,children:s.jsx(He,{name:"name",value:l.name,onChange:M=>j("name")(M.target.value),placeholder:"nightly triage"})}),s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:"caps text-label text-muted-foreground",children:"When"}),s.jsx("div",{className:"mt-1 flex flex-wrap gap-2",role:"radiogroup",children:B.map(({kind:M,label:K})=>s.jsxs("label",{className:`flex h-9 cursor-pointer items-center gap-2 border px-3 text-body ${l.kind===M?"border-primary text-primary-text":""}`,children:[s.jsx("input",{type:"radio",name:"kind",value:M,checked:l.kind===M,onChange:()=>j("kind")(M),className:"accent-primary"}),K]},M))}),s.jsxs("div",{className:"mt-3 grid grid-cols-1 gap-4 sm:grid-cols-2",children:[l.kind==="cron"&&s.jsx(nn,{label:"Runs",field:"source.cron",issue:p["source.cron"],children:s.jsx(wN,{label:"Runs",name:"cron",value:l.cron,onChange:j("cron")})}),l.kind==="at"&&s.jsx(nn,{label:"At, your time",field:"source.at",issue:p["source.at"],hint:z?`= ${Iw(z)}`:void 0,children:s.jsx(He,{name:"at",type:"datetime-local",step:60,value:l.at,onChange:M=>S(M.target.value)})}),l.kind==="every"&&s.jsx(nn,{label:"Every",field:"source.every_s",issue:p["source.every_s"],hint:o?ML(o):void 0,children:s.jsxs("span",{className:"flex gap-2",children:[s.jsx(He,{name:"every",inputMode:"decimal",value:l.every,onChange:M=>j("every")(M.target.value),placeholder:"5"}),s.jsx(Kt,{id:"schedule-every-unit",name:"everyUnit",label:"Unit",className:"w-32 shrink-0",value:l.everyUnit,onChange:M=>j("everyUnit")(M),options:["seconds","minutes","hours"].map(M=>({value:M,label:M}))})]})}),l.kind==="cron"&&s.jsx(nn,{label:"Time zone",field:"source.timezone",issue:p["source.timezone"],hint:"The time zone this schedule runs in.",children:s.jsx(kN,{name:"timezone",label:"Time zone",className:"w-full",value:l.timezone,onChange:j("timezone")})}),l.kind==="every"&&s.jsx(nn,{label:"Starting, your time (optional)",field:"source.start_at",issue:p["source.start_at"],hint:F?`= ${Iw(F)}`:void 0,children:s.jsx(He,{name:"startAt",type:"datetime-local",step:60,value:l.startAt,onChange:M=>j("startAt")(M.target.value)})})]}),O&&s.jsx("p",{className:"mt-3 text-small text-warning-text",role:"note",children:"Changing when restarts the schedule from now."})]}),s.jsx(nn,{label:"Agent",field:"target.agent_id",issue:p["target.agent_id"],children:s.jsx(Kt,{name:"agent",label:"Agent",className:"w-full",value:l.agentId,onChange:M=>j("agentId")(M),options:[{value:"",label:u?"Pick an agent":"Loading the agents"},...D.map(M=>({value:M.agent_id,label:`${M.definition.name||M.agent_id}${M.kind==="workflow"?" (workflow)":""}`})),...l.agentId&&u&&!D.some(M=>M.agent_id===l.agentId)?[{value:l.agentId,label:l.agentId}]:[]]})}),s.jsx(nn,{label:"Each run is asked",field:"target.input",issue:p["target.input"],children:s.jsx(Ss,{name:"content",rows:4,className:"p-3 font-sans",value:l.content,onChange:M=>j("content")(M.target.value)})}),s.jsx(nn,{label:"Cost cap, US dollars a run",field:"target.max_cost_usd",issue:p["target.max_cost_usd"],hint:_!==void 0?`Uses the agent's default (${oi(_)}) if empty.`:E?"Uses the agent's default if empty.":"Required: each run this schedule starts stops at this spend.",children:s.jsx(He,{name:"maxCost",inputMode:"decimal",className:"max-w-64",value:l.maxCost,onChange:M=>j("maxCost")(M.target.value),placeholder:Pg(_)})}),!n&&s.jsxs("div",{children:[s.jsxs("label",{className:"flex items-center gap-2 text-body",children:[s.jsx("input",{type:"checkbox",name:"enabled",checked:l.enabled,onChange:M=>j("enabled")(M.target.checked),className:"accent-primary"})," On from now (off: made paused)"]}),p.enabled&&s.jsx("p",{className:"mt-1 text-small text-destructive-text",role:"alert","data-issue":"enabled",children:p.enabled})]})]}),s.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[s.jsx(Z,{type:"submit",size:"lg",variant:"solid",disabled:m,children:m?"Saving":n?"Save changes":"Create schedule"}),s.jsx(Z,{type:"button",size:"lg",variant:"ghost",onClick:()=>t(n?to(n.id):"#/triggers"),children:"Cancel"})]})]})}function EN({text:e,label:t}){const[n,o]=y.useState(null),i="The browser won't copy here. Select it and copy it.",l=()=>{const c=typeof navigator<"u"?navigator.clipboard:void 0;if(!(c!=null&&c.writeText)){o(i);return}c.writeText(e).then(()=>o("Copied"),()=>o(i))};return s.jsxs("span",{className:"inline-flex flex-wrap items-center gap-2",children:[s.jsxs(Z,{type:"button",size:"sm",onClick:l,children:[s.jsx(gd,{"aria-hidden":!0})," ",t]}),n&&s.jsx("span",{className:"font-mono text-label text-muted-foreground",role:"status",children:n})]})}function Ig({label:e,secret:t,url:n}){return s.jsxs("section",{"aria-label":e,className:"mt-4 space-y-3 border border-primary/50 p-4 text-body",children:[n&&s.jsx(ch,{title:"URL",text:n,label:"Copy URL",hint:Og}),s.jsx(ch,{title:"Signing secret",text:t,label:"Copy secret"}),s.jsx("p",{className:"text-warning-text",role:"note",children:"You won't see this secret again."})]})}function ch({title:e,text:t,label:n,hint:o}){return s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"caps text-label text-muted-foreground",children:e}),s.jsxs("div",{className:"mt-1 flex min-w-0 flex-wrap items-center gap-2",children:[s.jsx("code",{className:"min-w-0 break-all border bg-muted/40 px-2 py-1 font-mono text-small",children:t}),s.jsx(EN,{text:t,label:n})]}),o&&s.jsx("p",{className:"mt-1 text-small text-muted-foreground",children:o})]})}const tI=["standard","github"];function nI({v2:e,go:t}){var R;const[n,o]=y.useState(PL),[i,l]=y.useState(null),[c,u]=y.useState({}),[f,p]=y.useState([]),[h,b]=y.useState(!1),[x,m]=y.useState(null),v=y.useRef(Ws()).current;y.useEffect(()=>{Lg(e).then(l,()=>l([]))},[e]);const w=C=>O=>o(z=>({...z,[C]:O})),j=new Set(["name","source.signature","target.agent_id","target.input","target.max_cost_usd"]),S=(R=(i??[]).find(C=>C.agent_id===n.agentId))==null?void 0:R.definition.max_cost_usd,T=typeof S=="number"&&S>0?S:void 0,$=async C=>{C.preventDefault();const{body:O,issues:z}=LL(n,T!==void 0);if(p([]),!O){u(z??{});return}u({}),b(!0);try{m(await e.createTrigger(O,v.keyFor("createTrigger",O)))}catch(F){const D=Mg(F);u(Object.fromEntries(Object.entries(D.fields).filter(([B])=>j.has(B)))),p([...D.rest,...Object.entries(D.fields).filter(([B])=>!j.has(B)).map(([,B])=>B)])}finally{b(!1)}},_=s.jsxs("a",{href:"#/triggers",className:"caps flex items-center gap-2 text-label text-muted-foreground hover:text-foreground",children:[s.jsx(Ds,{className:"size-3.5","aria-hidden":!0})," Triggers"]});if(x)return s.jsxs("div",{className:"max-w-2xl p-5 md:p-8",children:[_,s.jsxs("h1",{className:"mt-3 flex items-center gap-2 text-2xl font-semibold",children:[s.jsx(hl,{className:"size-5 text-primary-text","aria-hidden":!0}),x.name]}),s.jsxs("p",{className:"mt-2 text-body text-muted-foreground",children:["Send each request to this URL, signed with this secret (",rh[x.source.kind==="webhook"?x.source.signature??"standard":"standard"],"). Each one starts a run."]}),x.signing_secret?s.jsx(Ig,{label:"The webhook's URL and secret",url:Cl(x),secret:x.signing_secret}):s.jsxs("section",{"aria-label":"The webhook's URL and secret",className:"mt-4 space-y-3 border p-4 text-body",children:[s.jsx(ch,{title:"URL",text:Cl(x),label:"Copy URL",hint:Og}),x.note&&s.jsx("p",{role:"note",children:x.note})]}),s.jsx("div",{className:"mt-6",children:s.jsx(Z,{type:"button",size:"lg",variant:"solid",onClick:()=>t(to(x.id)),children:"Done"})})]});const E=Md((i??[]).filter(C=>!C.archived_at));return s.jsxs("form",{onSubmit:C=>void $(C),className:"max-w-2xl p-5 md:p-8",noValidate:!0,children:[_,s.jsxs("h1",{className:"mt-3 flex items-center gap-2 text-2xl font-semibold",children:[s.jsx(hl,{className:"size-5 text-primary-text","aria-hidden":!0}),"New webhook"]}),s.jsx("p",{className:"mt-2 text-body text-muted-foreground",children:"Each signed request to its URL starts a capped run of the agent. Its URL and signing secret show once it is made."}),f.length>0&&s.jsx("div",{className:"mt-4 border border-destructive/50 p-3 text-body text-destructive-text",role:"alert",children:f.map((C,O)=>s.jsx("p",{children:C},O))}),s.jsxs("div",{className:"mt-5 space-y-5",children:[s.jsx(nn,{label:"Name",field:"name",issue:c.name,children:s.jsx(He,{name:"name",value:n.name,onChange:C=>w("name")(C.target.value),placeholder:"on deploy"})}),s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:"caps text-label text-muted-foreground",children:"Signature"}),s.jsx("div",{className:"mt-1 flex flex-wrap gap-2",role:"radiogroup",children:tI.map(C=>s.jsxs("label",{className:`flex h-9 cursor-pointer items-center gap-2 border px-3 text-body ${n.signature===C?"border-primary text-primary-text":""}`,children:[s.jsx("input",{type:"radio",name:"signature",value:C,checked:n.signature===C,onChange:()=>w("signature")(C),className:"accent-primary"}),rh[C]]},C))}),c["source.signature"]&&s.jsx("p",{className:"mt-1 text-small text-destructive-text",role:"alert","data-issue":"source.signature",children:c["source.signature"]})]}),s.jsx(nn,{label:"Agent",field:"target.agent_id",issue:c["target.agent_id"],children:s.jsx(Kt,{name:"agent",label:"Agent",className:"w-full",value:n.agentId,onChange:C=>w("agentId")(C),options:[{value:"",label:i?"Pick an agent":"Loading the agents"},...E.map(C=>({value:C.agent_id,label:`${C.definition.name||C.agent_id}${C.kind==="workflow"?" (workflow)":""}`}))]})}),s.jsx(nn,{label:"Each run is asked",field:"target.input",issue:c["target.input"],children:s.jsx(Ss,{name:"content",rows:4,className:"p-3 font-sans",value:n.content,onChange:C=>w("content")(C.target.value)})}),s.jsx(nn,{label:"Cost cap, US dollars a run",field:"target.max_cost_usd",issue:c["target.max_cost_usd"],hint:T!==void 0?`Uses the agent's default (${oi(T)}) if empty.`:"Required: each run this webhook starts stops at this spend.",children:s.jsx(He,{name:"maxCost",inputMode:"decimal",className:"max-w-64",value:n.maxCost,onChange:C=>w("maxCost")(C.target.value),placeholder:Pg(T)})})]}),s.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[s.jsx(Z,{type:"submit",size:"lg",variant:"solid",disabled:h,children:h?"Creating":"Create webhook"}),s.jsx(Z,{type:"button",size:"lg",variant:"ghost",onClick:()=>t("#/triggers"),children:"Cancel"})]})]})}function sI({v2:e,go:t}){var U;const[n,o]=y.useState(null),[i,l]=y.useState(null),[c,u]=y.useState(0),[f,p]=y.useState(IL),[h,b]=y.useState(null),[x,m]=y.useState({}),[v,w]=y.useState([]),[j,S]=y.useState(!1),T=y.useRef(Ws()).current,$=y.useRef(!0);y.useEffect(()=>($.current=!0,()=>{$.current=!1}),[]),y.useEffect(()=>{let W=!0;return l(null),e.githubConnection().then(X=>{W&&o(!!X&&"app_id"in X&&!!X.app_id)},X=>{W&&(X instanceof Ee&&X.status===404?o(!1):l(mn(X,"GitHub's connection")))}),()=>{W=!1}},[e,c]),y.useEffect(()=>{Lg(e).then(b,()=>b([]))},[e]);const _=W=>X=>p(M=>({...M,[W]:X})),E=W=>p(X=>({...X,events:X.events.includes(W)?X.events.filter(M=>M!==W):[...X.events,W]})),R=new Set(["name","source.accept","target.agent_id","target.input","target.max_cost_usd"]),C=(U=(h??[]).find(W=>W.agent_id===f.agentId))==null?void 0:U.definition.max_cost_usd,O=typeof C=="number"&&C>0?C:void 0,z=async W=>{W.preventDefault();const{body:X,issues:M}=zL(f,O!==void 0);if(w([]),!X){m(M??{});return}m({}),S(!0);try{const K=await e.createTrigger(X,T.keyFor("createTrigger",X));$.current&&t(to(K.id))}catch(K){const L=Mg(K);m(Object.fromEntries(Object.entries(L.fields).filter(([I])=>R.has(I)))),w([...L.rest,...Object.entries(L.fields).filter(([I])=>!R.has(I)).map(([,I])=>I)]),S(!1)}},F=s.jsxs("a",{href:"#/triggers",className:"caps flex items-center gap-2 text-label text-muted-foreground hover:text-foreground",children:[s.jsx(Ds,{className:"size-3.5","aria-hidden":!0})," Triggers"]}),D=s.jsxs("h1",{className:"mt-3 flex items-center gap-2 text-2xl font-semibold",children:[s.jsx(bh,{className:"size-5 text-primary-text","aria-hidden":!0}),"New GitHub trigger"]});if(i)return s.jsxs("div",{className:"max-w-2xl p-5 md:p-8",children:[F,D,s.jsx($n,{problem:i,onRetry:()=>u(W=>W+1),className:"mt-4"})]});if(n===null)return s.jsx(_s,{label:"Reading GitHub's connection",rows:3});if(!n)return s.jsxs("div",{className:"max-w-2xl p-5 md:p-8",children:[F,D,s.jsxs("p",{className:"mt-4 border px-4 py-6 text-body",children:["Connect GitHub first: ",s.jsx("a",{href:"#/settings/github",className:"underline underline-offset-2",children:"Settings → GitHub"}),". A GitHub trigger takes events from this server's GitHub App."]})]});const B=Md((h??[]).filter(W=>!W.archived_at));return s.jsxs("form",{onSubmit:W=>void z(W),className:"max-w-2xl p-5 md:p-8",noValidate:!0,children:[F,D,s.jsx("p",{className:"mt-2 text-body text-muted-foreground",children:"Each event it takes from this server's GitHub App starts a capped run of the agent."}),v.length>0&&s.jsx("div",{className:"mt-4 border border-destructive/50 p-3 text-body text-destructive-text",role:"alert",children:v.map((W,X)=>s.jsx("p",{children:W},X))}),s.jsxs("div",{className:"mt-5 space-y-5",children:[s.jsx(nn,{label:"Name",field:"name",issue:x.name,children:s.jsx(He,{name:"name",value:f.name,onChange:W=>_("name")(W.target.value),placeholder:"review PRs"})}),s.jsxs("fieldset",{className:"min-w-0",children:[s.jsx("legend",{className:"caps text-label text-muted-foreground",children:"Events"}),s.jsx("div",{className:"mt-1 space-y-1",children:gN.map(({event:W,action:X,label:M})=>{const K=`${W}:${X}`;return s.jsxs("label",{className:"flex items-center gap-2 text-body",children:[s.jsx("input",{type:"checkbox",name:"event",value:K,checked:f.events.includes(K),onChange:()=>E(K),className:"accent-primary"}),M," ",s.jsxs("span",{className:"font-mono text-label text-muted-foreground",children:[W," ",X]})]},K)})}),x["source.accept"]&&s.jsx("p",{className:"mt-1 text-small text-destructive-text",role:"alert","data-issue":"source.accept",children:x["source.accept"]})]}),s.jsx(nn,{label:"Agent",field:"target.agent_id",issue:x["target.agent_id"],children:s.jsx(Kt,{name:"agent",label:"Agent",className:"w-full",value:f.agentId,onChange:W=>_("agentId")(W),options:[{value:"",label:h?"Pick an agent":"Loading the agents"},...B.map(W=>({value:W.agent_id,label:`${W.definition.name||W.agent_id}${W.kind==="workflow"?" (workflow)":""}`}))]})}),s.jsx(nn,{label:"Each run is asked",field:"target.input",issue:x["target.input"],hint:"The event's payload comes with it.",children:s.jsx(Ss,{name:"content",rows:4,className:"p-3 font-sans",value:f.content,onChange:W=>_("content")(W.target.value)})}),s.jsx(nn,{label:"Cost cap, US dollars a run",field:"target.max_cost_usd",issue:x["target.max_cost_usd"],hint:O!==void 0?`Uses the agent's default (${oi(O)}) if empty.`:"Required: each run this trigger starts stops at this spend.",children:s.jsx(He,{name:"maxCost",inputMode:"decimal",className:"max-w-64",value:f.maxCost,onChange:W=>_("maxCost")(W.target.value),placeholder:Pg(O)})})]}),s.jsxs("div",{className:"mt-6 flex flex-wrap gap-2",children:[s.jsx(Z,{type:"submit",size:"lg",variant:"solid",disabled:j,children:j?"Creating":"Create GitHub trigger"}),s.jsx(Z,{type:"button",size:"lg",variant:"ghost",onClick:()=>t("#/triggers"),children:"Cancel"})]})]})}const dd=(e,t={})=>(e.display_name||e.name).replace(/\$\{parameters\.([A-Za-z0-9_]+)\}/g,(n,o)=>(Object.hasOwn(t,o)?t[o].trim():"")||"…"),rI=e=>`#/templates/${encodeURIComponent(e)}`,Uw=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function TN(e,{secrets:t=!0,mcp:n=!0}={}){var i,l,c;const o=[];return t&&e.secrets.length&&o.push(["Keys",e.secrets.join(", ")]),n&&e.mcp.length&&o.push(["MCP",e.mcp.map(u=>`${u.server}${u.required?"":" (optional)"}`).join(", ")]),e.triggers.length&&o.push(["Triggers",Uw(e.triggers.length,"trigger")]),(i=e.budget)!=null&&i.per_run_usd&&o.push(["Budget",`${eg(e.budget.per_run_usd)} a run`]),(l=e.budget)!=null&&l.tool_calls&&o.push(["Tool calls",`${Uw(e.budget.tool_calls,"call")} a conversation`]),(c=e.harness)!=null&&c.length&&o.push(["Harness",e.harness.join(", ")]),e.model&&o.push(["Model",`${e.model.tier}${e.model.prefer?`, ${e.model.prefer} first`:""}`]),o}function ef(e){var n;if(e.type==="boolean")return null;if((n=e.enum)!=null&&n.length)return e.enum.map(String);const t=e.pattern?/^\^\(([A-Za-z0-9_-]+(?:\|[A-Za-z0-9_-]+)+)\)\$$/.exec(e.pattern):null;return t?t[1].split("|"):null}function oI(e,t){const n={};for(const[o,i]of Object.entries(e.parameters)){const l=t[o];if(i.type==="boolean"){n[o]=l==="true";continue}l===void 0||l===""||(i.type==="number"||i.type==="integer"?n[o]=Number.isFinite(Number(l))?Number(l):l:n[o]=l)}return n}function aI(e){return Object.fromEntries(Object.entries(e.parameters).flatMap(([t,n])=>n.type==="boolean"?typeof n.default=="boolean"?[[t,String(n.default)]]:[]:ef(n)?[]:n.format==="timezone"?[[t,ri()]]:n.format==="cron"?typeof n.default=="string"?[[t,n.default]]:[]:[]))}const iI=(e,t)=>e.mcp.flatMap(n=>n.tools.map(o=>o.tool)).filter(n=>t.has(n)),lI=(e,t)=>e.filter(n=>n.field===t),ol=(e,t)=>(t==null?void 0:t.type)==="string"&&t.format==="cron"?"Schedule":(t==null?void 0:t.type)==="string"&&t.format==="timezone"?"Time zone":e;function cI(e){if(e.type!=="string"||e.format!=="cron"&&e.format!=="timezone"||!e.description)return e.description;if(e.format==="timezone")return;const t=e.description.indexOf(": ");return t<0?void 0:e.description.slice(t+2).trim()||void 0}function Ww(e){const t=ef(e);if(!t)return null;const n=e.default===void 0?void 0:String(e.default),o=!e.required&&n!==void 0&&t.includes(n);return[...o?[]:[{value:"",label:e.required?"Choose one":n!==void 0?`${n} (default)`:"None chosen"}],...t.map(l=>o&&l===n?{value:"",label:`${l} (default)`}:{value:l,label:l})]}function uI(e,t,n){const o=ol(t,n);if(!n)return e.message;switch(e.reason){case"missing":return`${o} is required.`;case"wrong_type":return`${o} takes ${n.type==="integer"?"a whole number":n.type==="number"?"a number":n.type==="boolean"?"yes or no":"text"}.`;case"not_an_option":return`${o} takes one of: ${CN(n).join(", ")}.`;case"bad_format":return`${o} isn't in the form its description asks for.`;default:return e.message}}const CN=e=>{var t;return(t=e.enum)!=null&&t.length?e.enum.map(String):ef(e)??[]};function dI(e,t){var o;if(t==="")return!e.required;const n=ef(e);if(n)return n.includes(t);if(e.type==="integer")return t.trim()!==""&&Number.isSafeInteger(Number(t));if(e.type==="number")return t.trim()!==""&&Number.isFinite(Number(t));if(e.type==="boolean")return(t==="true"||t==="false")&&(!((o=e.enum)!=null&&o.length)||CN(e).includes(t));if(e.pattern)try{return new RegExp(e.pattern,"u").test(t)}catch{return!0}return!0}function fI({v2:e,name:t,go:n}){const[o,i]=y.useState(null),[l,c]=y.useState(null),[u,f]=y.useState(0);y.useEffect(()=>{let h=!0;return c(null),e.listTemplates().then(b=>{h&&i(b.templates)},b=>{h&&c(mn(b,"the templates"))}),()=>{h=!1}},[e,u]);const p=t===void 0||o==null?void 0:o.find(h=>h.name===t);return s.jsx("div",{className:"p-5 md:p-8",children:l&&!o?s.jsx($n,{problem:l,onRetry:()=>f(h=>h+1),className:""}):o?t===void 0?s.jsx(mI,{templates:o,go:n}):p?s.jsx(gI,{v2:e,template:p,go:n},p.name):s.jsxs("p",{className:"border px-4 py-12 text-center font-mono text-body text-muted-foreground",role:"alert",children:["This server offers no template named ",t,". ",s.jsx("a",{href:"#/templates",className:"underline",children:"See its templates"}),"."]}):s.jsx(_s,{label:"Loading the templates",rows:3})})}function mI({templates:e,go:t}){return s.jsxs(s.Fragment,{children:[s.jsx("h1",{className:"mb-5 font-mono text-2xl font-semibold",children:"Templates"}),e.length?s.jsx("ul",{className:"grid gap-3 md:grid-cols-2",children:e.map(n=>s.jsx("li",{children:s.jsxs("article",{"aria-label":dd(n),className:"flex h-full flex-col border bg-card px-5 py-4",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[s.jsx(c0,{className:"size-4 shrink-0 self-center text-muted-foreground","aria-hidden":!0}),s.jsx("h2",{className:"min-w-0 break-words text-prose font-semibold",children:dd(n)}),s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:n.version})]}),s.jsx("p",{className:"mt-2 text-lead leading-[1.6]",children:n.description}),s.jsx("dl",{className:"mt-3 space-y-1 font-mono text-small text-muted-foreground",children:TN(n).map(([o,i])=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("dt",{className:"shrink-0",children:o}),s.jsx("dd",{className:"min-w-0 break-words text-foreground/80",children:i})]},o))}),s.jsx("div",{className:"mt-auto pt-4",children:s.jsx(Z,{size:"sm",variant:"solid",onClick:()=>t(rI(n.name)),children:"Apply"})})]})},n.name))}):s.jsx("p",{className:"border px-4 py-12 text-center font-mono text-body text-muted-foreground",children:"This server offers no templates yet."})]})}const pI=3e3;function hI(e,t){let n;const o=new Promise(i=>n=setTimeout(()=>i(void 0),t));return Promise.race([e,o]).finally(()=>clearTimeout(n))}function gI({v2:e,template:t,go:n}){var X;const[o,i]=y.useState(()=>aI(t)),[l,c]=y.useState(new Set),[u,f]=y.useState(t.approvals_default??"ask"),[p,h]=y.useState(null),[b,x]=y.useState(!1),[m,v]=y.useState([]),[w,j]=y.useState(null),[S,T]=y.useState(null),[$,_]=y.useState([]),[E,R]=y.useState({}),C=y.useRef(Ws()).current,O=y.useRef(!0);y.useEffect(()=>(O.current=!0,()=>{O.current=!1}),[]),y.useEffect(()=>{let M=!0;return e.listMcpServers().then(K=>{M&&h(new Set(K.servers.map(L=>L.name)))},()=>{}),()=>{M=!1}},[e]);const z=iI(t,l),F=M=>lI(m,M),D=(M,K)=>{i(I=>({...I,[M]:K}));const L=t.parameters[M];L&&dI(L,K)&&v(I=>I.filter(G=>G.field!==`parameters.${M}`))},B=async()=>{var L,I;x(!0),v([]),j(null);const M=o,K={parameters:oI(t,M),...z.length?{grants:z}:{},overrides:{approvals:u}};try{const G=await e.applyTemplate(t.name,K,C.keyFor(t.name,K));C.done();const P=async()=>(await Promise.all(G.trigger_ids.map(ae=>hI(e.getTrigger(ae),pI).catch(()=>null)))).filter(ae=>ae!=null&&Ag(ae));if(G.warnings.length||(L=G.webhook_secrets)!=null&&L.length){R(M),T(G),P().then(_,()=>{});return}const q=G.trigger_ids.length?await P():[];if(!O.current)return;if(!q.length){n(`#/agents/${encodeURIComponent(G.agent_id)}`);return}R(M),_(q),T(G)}catch(G){G instanceof Ee&&((I=G.fields)!=null&&I.length)?(v(G.fields),j({text:G.message,withIssues:!0})):j({text:G instanceof Error?G.message:String(G),withIssues:!1})}finally{x(!1)}},U=Object.entries(t.parameters),W=M=>/^(parameters|secrets|mcp)\./.test(M.field)||/^grants\.\d+$/.test(M.field);return S?s.jsxs("section",{"aria-label":"Applied",className:"max-w-3xl",children:[s.jsxs("h1",{className:"mb-4 flex items-center gap-2 font-mono text-2xl font-semibold",children:[s.jsx(hd,{className:"size-5 text-success-text","aria-hidden":!0})," ",dd(t,E)," applied"]}),S.warnings.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"mb-3 text-lead",children:"The agent is made. The server says:"}),s.jsx("ul",{className:"mb-5 space-y-2 border bg-card px-4 py-3 text-body",role:"status","aria-label":"Warnings",children:S.warnings.map((M,K)=>{var P,q;const L=/^triggers\.(\d+)\.secret$/.exec(M.field),I=L?S.trigger_ids[Number(L[1])]:void 0,G=L?(P=t.triggers[Number(L[1])])==null?void 0:P.name:void 0;return I&&((q=S.webhook_secrets)!=null&&q.some(ne=>ne.trigger_id===I))?s.jsxs("li",{children:[s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:M.field})," ",M.message]},`${M.field}:${K}`):s.jsxs("li",{children:[s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:M.field})," ",M.message,M.fix?s.jsx("span",{className:"block text-muted-foreground",children:M.fix}):null,I&&s.jsxs("a",{href:`#/triggers/${encodeURIComponent(I)}`,className:"mt-1 block font-mono text-small text-primary-text underline-offset-2 hover:underline",children:["Open ",typeof G=="string"&&G?G:I," to get its signing secret (Rotate)"]})]},`${M.field}:${K}`)})})]}),(X=S.webhook_secrets)==null?void 0:X.map(M=>{var G;const K=S.trigger_ids.indexOf(M.trigger_id),L=K>=0?(G=t.triggers[K])==null?void 0:G.name:void 0,I=typeof L=="string"&&L?L:M.trigger_id;return M.signing_secret?s.jsx(Ig,{label:`The webhook's URL and secret (${I})`,url:Cl({id:M.trigger_id}),secret:M.signing_secret},M.trigger_id):s.jsxs("div",{className:"mt-4 border px-4 py-3 text-body",children:[M.note&&s.jsx("p",{className:"text-muted-foreground",role:"note",children:M.note}),s.jsxs("a",{href:`#/triggers/${encodeURIComponent(M.trigger_id)}`,className:"mt-1 block font-mono text-small text-primary-text underline-offset-2 hover:underline",children:["Open ",I," to get its signing secret (Rotate)"]})]},M.trigger_id)}),$.length>0&&s.jsx("ul",{className:"mt-4 divide-y border","aria-label":"Schedules",children:$.map(M=>s.jsxs("li",{"data-trigger":M.id,className:"px-4 py-3",children:[s.jsx("a",{href:`#/triggers/${encodeURIComponent(M.id)}`,className:"break-words text-prose font-semibold hover:underline",children:M.name}),s.jsx("p",{className:"mt-1 break-words font-mono text-small text-muted-foreground",children:Cg(M.source,M.next_at)})]},M.id))}),s.jsx("div",{className:"mt-5"}),s.jsx("a",{href:`#/agents/${encodeURIComponent(S.agent_id)}`,className:"inline-flex border px-3 py-2 font-mono text-body font-semibold hover:bg-accent",children:"Open the agent"})]}):s.jsxs("div",{className:"max-w-3xl",children:[s.jsxs("a",{href:"#/templates",className:"caps mb-4 inline-flex items-center gap-1.5 text-small text-muted-foreground hover:text-foreground",children:[s.jsx(Ds,{className:"size-3.5","aria-hidden":!0})," Templates"]}),s.jsxs("h1",{className:"font-mono text-2xl font-semibold",children:[dd(t,o)," ",s.jsx("span",{className:"text-lead font-normal text-muted-foreground",children:t.version})]}),s.jsx("p",{className:"mt-2 text-lead leading-[1.6]",children:t.description}),U.length>0&&s.jsx(ju,{title:"Parameters",children:U.map(([M,K])=>s.jsxs("div",{"data-field":`parameters.${M}`,className:"px-4 py-3",children:[s.jsxs("label",{className:"block",children:[s.jsxs("span",{className:"caps text-small font-semibold",children:[ol(M,K),K.required&&s.jsx("span",{className:"text-destructive-text",children:" *"})]}),s.jsx("span",{className:"mb-1.5 block text-small text-muted-foreground",children:cI(K)}),Ww(K)?s.jsx(Kt,{label:ol(M,K),className:"w-full",value:o[M]??"",onChange:L=>D(M,L),options:Ww(K)}):K.format==="cron"&&K.type==="string"?s.jsx(wN,{label:ol(M,K),value:o[M]??"",onChange:L=>D(M,L)}):K.format==="timezone"&&K.type==="string"?s.jsx(kN,{label:ol(M,K),className:"w-full",value:o[M]??"",onChange:L=>D(M,L)}):K.type==="boolean"?s.jsx("input",{type:"checkbox",className:"size-4 accent-primary",checked:o[M]==="true",onChange:L=>D(M,L.target.checked?"true":"false")}):s.jsx(He,{type:K.type==="string"?"text":"number",step:K.type==="integer"?1:"any",value:o[M]??"",required:K.required,placeholder:K.default===void 0?void 0:String(K.default),onChange:L=>D(M,L.target.value)})]}),s.jsx(Ji,{issues:F(`parameters.${M}`),words:L=>uI(L,M,K)})]},M))}),t.mcp.length>0&&s.jsx(ju,{title:"Tools you allow",note:"Nothing is granted until you tick it. A tool you leave unticked stays at your own setting for it.",children:t.mcp.map(M=>s.jsxs("div",{"data-mcp":M.server,className:"px-4 py-3",children:[s.jsxs("p",{className:"flex flex-wrap items-center gap-2 font-mono text-body",children:[s.jsx("span",{className:"font-semibold",children:M.server}),s.jsx(Me,{tone:M.required?"plain":"muted",children:M.required?"Required":"Optional"}),p&&s.jsx("span",{className:"text-small text-muted-foreground",children:p.has(M.server)?"Set up here":"Not set up here"})]}),s.jsx(Ji,{issues:F(`mcp.${M.server}`)}),s.jsx("ul",{className:"mt-2 space-y-2",children:M.tools.map(K=>{const L=z.indexOf(K.tool);return s.jsxs("li",{"data-tool":K.tool,children:[s.jsxs("label",{className:"flex items-start gap-2.5",children:[s.jsx("input",{type:"checkbox",className:"mt-1 accent-primary",checked:l.has(K.tool),onChange:()=>c(I=>{const G=new Set(I);return G.has(K.tool)?G.delete(K.tool):G.add(K.tool),G})}),s.jsxs("span",{className:"min-w-0",children:[s.jsx("span",{className:"font-mono text-body",children:K.name})," ",s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:K.tool}),s.jsx("span",{className:"block text-small",children:"Allow: the agent may call this without asking you."}),s.jsx("span",{className:"block text-small text-muted-foreground",children:K.asks==="allow"?"The template asks you to allow this.":"The template does not ask for this; unticked, it stays at your setting."})]})]}),L>=0&&s.jsx(Ji,{issues:F(`grants.${L}`)})]},K.tool)})})]},M.server))}),t.secrets.length>0&&s.jsx(ju,{title:"Keys it uses",note:"Saved on this server by name; a run is given them.",children:t.secrets.map(M=>s.jsxs("div",{"data-secret":M,className:"px-4 py-3 font-mono text-body",children:[M,s.jsx(Ji,{issues:F(`secrets.${M}`)})]},M))}),s.jsxs("fieldset",{"aria-label":"Approvals",className:"mt-6",children:[s.jsx("legend",{className:"caps text-small font-semibold",children:"Approvals"}),s.jsx("div",{className:"mt-2 divide-y border",children:[["ask","Ask me","A call whose permission is ask waits for your answer."],["never","Never ask (run unattended)","For an agent that runs on its triggers, with no one there to answer."]].map(([M,K,L])=>s.jsxs("label",{className:"flex items-start gap-3 px-4 py-3",children:[s.jsx("input",{type:"radio",name:"approvals",value:M,className:"mt-1 accent-primary",checked:u===M,onChange:()=>f(M)}),s.jsxs("span",{children:[s.jsx("span",{className:"font-mono text-body",children:K}),s.jsx("span",{className:"block text-small text-muted-foreground",children:L})]})]},M))}),u==="never"&&s.jsx("p",{className:"mt-2 text-small text-warning-text",children:nN})]}),s.jsx(ju,{title:"What it makes",children:s.jsx("dl",{className:"space-y-1 px-4 py-3 font-mono text-small",children:TN(t,{secrets:!1,mcp:!1}).map(([M,K])=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("dt",{className:"shrink-0 text-muted-foreground",children:M}),s.jsx("dd",{className:"min-w-0 break-words",children:K})]},M))})}),s.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[s.jsx(Z,{size:"sm",variant:"solid",onClick:()=>void B(),disabled:b,children:b?"Applying…":"Apply"}),w&&(!w.withIssues||m.length>0)&&s.jsx("p",{className:"min-w-0 flex-1 text-body text-destructive-text",role:"alert",children:w.text})]}),m.filter(M=>!W(M)).length>0&&s.jsx("div",{className:"mt-2",children:s.jsx(Ji,{issues:m.filter(M=>!W(M)),named:!0})})]})}function ju({title:e,note:t,children:n}){return s.jsxs("section",{"aria-label":e,className:"mt-6",children:[s.jsx("h2",{className:"caps text-small font-semibold",children:e}),t&&s.jsx("p",{className:"mt-0.5 text-small text-muted-foreground",children:t}),s.jsx("div",{className:"mt-2 divide-y border",children:n})]})}function Ji({issues:e,named:t=!1,words:n=o=>o.message}){return e.length?s.jsx("ul",{className:"mt-1.5 space-y-1 text-small text-destructive-text",role:"alert",children:e.map((o,i)=>s.jsxs("li",{children:[t&&s.jsxs("span",{className:"font-mono",children:[o.field," "]}),n(o),o.fix&&s.jsx("span",{className:"block text-foreground/80",children:o.fix})]},`${o.field}:${i}`))}):null}const RN="tool_approval_requested";function xI(e){var t;return e.status!=="input_required"||e.state!=="waiting"?null:((t=e.pending)==null?void 0:t.kind)==="approval"?e.pending:null}function yI(e){return e==="not metered"?"Not metered":e===0?"Costs nothing per call":typeof e=="number"?`Costs ${eg(e)} per call`:null}function vI(e){let t;try{t=JSON.parse(e)}catch{return e}return!t||typeof t!="object"||Array.isArray(t)?JSON.stringify(t,null,2):Object.entries(t).map(([n,o])=>`${n}: ${typeof o=="string"?o:JSON.stringify(o)}`).join(`
|
|
539
|
-
`)}const bI={allow:"This call was already allowed, in another tab or by another answer. The run shows what happened next.",deny:"This call was already declined. The run shows what happened next.",withdrawn:"The run was stopped before this call ran, so it was withdrawn and never ran.",canceled:"The run was cancelled before this call ran, so it never ran."};function AN(e){var t;if(e instanceof Ee){const n=((t=e.details)==null?void 0:t.reason)==="already_answered"&&typeof e.details.decision=="string"?bI[e.details.decision]:void 0;if(e.status===409&&n)return n;if(e.status===403)return"Only the owner, signed in with the password on this page, can answer an approval.";if(e.status===401)return"Your sign-in ended. Sign in again to answer.";if(e.status===404)return"This run no longer waits on that call."}return Nn(e)}const wI=2e3;function ON({pending:e,onAnswer:t,compact:n=!1,heading:o}){const[i,l]=y.useState(""),[c,u]=y.useState(!1),[f,p]=y.useState(null),[h,b]=y.useState(null),x=y.useRef(!1),m=yI(e.price),v=async w=>{if(x.current)return;x.current=!0,u(!0),p(null);const j=i.trim(),S=await t(w,w==="deny"&&j?j:void 0);x.current=!1,u(!1),S?p(S):b(w)};return s.jsxs("section",{"aria-label":"Approval required",className:oe("min-w-0 border border-warning/50 bg-warning/5",n?"p-4":"p-4 md:p-5"),children:[o,s.jsxs("p",{className:oe("caps flex items-center gap-2 text-label text-warning-text",o&&"mt-2"),children:[s.jsx(f0,{className:"size-3.5","aria-hidden":!0})," Approval required"]}),s.jsxs("p",{className:"mt-2 text-prose leading-snug",children:["The agent wants to run ",s.jsx("span",{className:"break-all font-mono text-lead",children:e.tool}),"."]}),s.jsx("pre",{"aria-label":`${e.tool} arguments`,title:e.args_preview,className:oe("mt-2 overflow-auto whitespace-pre-wrap break-all border bg-card p-3 font-mono text-small leading-[1.6]",n?"max-h-28":"max-h-64"),children:vI(e.args_preview)}),m&&s.jsx("p",{className:"mt-2 font-mono text-small text-muted-foreground",children:m}),h?s.jsx("p",{className:"mt-3 font-mono text-body text-success-text",role:"status",children:h==="allow"?"Allowed. The run goes on.":"Denied. The agent reads why and goes on."}):s.jsxs("div",{className:"mt-3 space-y-2",children:[s.jsxs("label",{className:"block",children:[s.jsx("span",{className:"text-small text-muted-foreground",children:"Tell the agent why (optional, sent with Deny)"}),s.jsx(Ss,{value:i,onChange:w=>l(w.target.value),maxLength:wI,rows:n?1:2,disabled:c,className:"mt-1 block resize-y py-2 font-sans text-lead"})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Z,{type:"button",variant:"solid",size:"sm",disabled:c,onClick:()=>void v("allow"),children:"Allow once"}),s.jsx(Z,{type:"button",size:"sm",disabled:c,onClick:()=>void v("deny"),children:"Deny"}),c&&s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:"Sending…"})]}),!n&&s.jsx("p",{className:"text-small text-muted-foreground",children:"or type what to do instead; sending it declines this call"}),f&&s.jsx("p",{className:"font-mono text-small text-destructive-text",role:"alert",children:f})]})]})}const kI={steer:{label:"Steer the run",placeholder:"Steer the run...",does:"The agent reads it when its current step ends."},answer:{label:"Answer the question",placeholder:"Answer the question...",does:"Answers what the agent asked; the run goes back to work."},follow_up:{label:"Ask a follow-up",placeholder:"Ask a follow-up question...",does:"Continues this run with your message; the same spend cap applies."}};function jI({mode:e,onSend:t,sending:n,sent:o,purpose:i}){const l=i??kI[e],[c,u]=y.useState(""),[f,p]=y.useState(!1),h=n||f,b=async()=>{if(!c.trim()||!t||h)return;p(!0);const x=await t(c.trim());p(!1),x!==!1&&u("")};return s.jsxs("form",{className:"border bg-card focus-within:border-foreground",onSubmit:x=>{x.preventDefault(),b()},children:[s.jsx(Ss,{bare:!0,id:"composer",rows:2,value:c,readOnly:h,"aria-busy":h,onChange:x=>u(x.target.value),placeholder:l.placeholder,onKeyDown:x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),b())},className:"block w-full resize-none px-4 pt-3"}),s.jsxs("div",{className:"flex items-center justify-between gap-3 px-3 pb-3",children:[s.jsxs("span",{className:"min-w-0 text-label text-muted-foreground",children:[s.jsx("label",{htmlFor:"composer",className:"font-semibold text-foreground",children:l.label})," · ",o?"Sent. It appears on the timeline when the run takes it.":l.does]}),s.jsxs(Z,{type:"submit",size:"sm",disabled:!c.trim()||!t||h,children:[h?"Sending":"Send"," ",s.jsx(s_,{"aria-hidden":!0})]})]})]})}function so(e){if(Number.isInteger(e))return`$${e}`;for(let t=2;t<8;t++)if(Number(e.toFixed(t))===Number(e.toFixed(8)))return`$${e.toFixed(t)}`;return`$${e.toFixed(8)}`}const MN=e=>`Paused at its ${typeof e.cap_usd=="number"&&Number.isFinite(e.cap_usd)?`${so(e.cap_usd)} `:""}spend cap`;function NI({pending:e}){return s.jsxs("section",{className:"border border-warning/50 bg-warning/5 p-4","aria-label":"Paused at its spend cap",children:[s.jsxs("p",{className:"caps flex items-center gap-2 text-label text-warning-text",children:[s.jsx(vh,{className:"size-3.5","aria-hidden":!0})," ",MN(e)]}),typeof e.said=="string"&&s.jsx("p",{className:"mt-2 text-prose leading-relaxed",children:e.said}),s.jsx("p",{className:"mt-1 text-body text-muted-foreground",children:"It waits for its cap to be raised; a message can't go on until then."})]})}const PN=e=>typeof(e==null?void 0:e.suggested_cap_usd)=="number"&&Number.isFinite(e.suggested_cap_usd)?e.suggested_cap_usd:null,LN=e=>typeof(e==null?void 0:e.least_cap_usd)=="number"&&Number.isFinite(e.least_cap_usd)?e.least_cap_usd:null;function SI(e){var t,n;return e instanceof Ee?e.status===422?((n=(t=e.fields)==null?void 0:t[0])==null?void 0:n.message)??e.message:e.status===409?"This run has ended, so its cap can't be raised.":e.status===404?"This run is no longer on the server.":e.message:e instanceof Error?e.message:String(e)}function IN({cap:e,suggested:t,least:n=null,paused:o,onRaise:i}){const[l,c]=y.useState(t===null?"":String(t)),[u,f]=y.useState(!1),[p,h]=y.useState(null),[b,x]=y.useState(null),m=y.useRef(!1),v=Number(l),w=l.trim()!==""&&Number.isFinite(v)&&v>0,j=async S=>{if(S==null||S.preventDefault(),!(!w||m.current)){m.current=!0,f(!0),h(null),x(null);try{const T=await i(v);T.note&&x(T.note)}catch(T){h(SI(T))}finally{m.current=!1,f(!1)}}};return s.jsxs("form",{className:"border border-warning/50 p-4","aria-label":"Raise the cap",onSubmit:S=>void j(S),children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[s.jsxs("label",{className:"flex items-center gap-2 font-mono text-body",children:[s.jsx("span",{className:"text-muted-foreground",children:"$"}),s.jsx(He,{"aria-label":"New cap in dollars",inputMode:"decimal",value:l,onChange:S=>c(S.target.value),disabled:u,placeholder:`more than ${so(e)}`,className:"h-9 w-32"})]}),s.jsx(Z,{type:"submit",size:"sm",variant:"solid",disabled:u||!w,children:u?"Raising":o?"Raise the cap and continue":"Raise the cap"})]}),(n!==null||t!==null)&&s.jsxs("ul",{className:"mt-2 space-y-0.5 font-mono text-small","aria-label":"Cap figures",children:[n!==null&&s.jsxs("li",{"data-cap-figure":"least",children:["Least to continue: ",so(n)]}),t!==null&&s.jsxs("li",{"data-cap-figure":"suggested",children:["Suggested: ",so(t)]})]}),t!==null&&s.jsx("p",{className:"mt-1 text-small text-muted-foreground",children:"The suggestion is prefilled; change it before you raise, if you like."}),p&&s.jsx("p",{className:"mt-2 text-body text-destructive-text",role:"alert",children:p}),b&&s.jsx("p",{className:"mt-2 text-body text-muted-foreground",role:"status",children:b})]})}function _I({waiting:e}){if(e){const t=(e.text??e.summary??"").replace(/^Waiting for you:\s*/,"");return s.jsxs("section",{className:"border border-warning/50 bg-warning/5 p-4","aria-label":"The agent asks",children:[s.jsxs("p",{className:"caps flex items-center gap-2 text-label text-warning-text",children:[s.jsx(jh,{className:"size-3.5","aria-hidden":!0})," Input required"]}),s.jsx("p",{className:"mt-2 text-prose leading-relaxed",children:t})]})}return s.jsxs("section",{className:"border border-border-strong/60 p-4","aria-label":"Stopped",children:[s.jsxs("p",{className:"caps flex items-center gap-2 text-label text-muted-foreground",children:[s.jsx(ml,{className:"size-3.5","aria-hidden":!0})," Stopped"]}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:"The turn was stopped. The run stays open: send a message to continue it."})]})}let Da=0;const uh=()=>{var t;const e=(t=history.state)==null?void 0:t.console_at;return typeof e=="number"?e:void 0},Hw=e=>{Da=e,history.replaceState({...history.state??{},console_at:e},"")};function $I(){const e=uh();e===void 0?Hw(0):Da=e;const t=()=>{const n=uh();n===void 0?Hw(Da+1):Da=n};return window.addEventListener("hashchange",t),()=>window.removeEventListener("hashchange",t)}function EI(){const e=uh();return e===void 0?-1:Da-e}function TI(e){Da>0?history.back():location.hash=e}const CI=(e,t)=>{const n=ni(e);return n?Y3(n,{ended:t}):e&&e.usd!==null&&j1(e)?"A local estimate, not a bill":void 0};function RI({run:e,agentName:t,actions:n={},costText:o}){var w,j;const i=U5(e.place),l=Vl(e.status,e.state,e.kind,ql,!0,e.error,e.review),[c,u]=y.useState(!1),f=!!e.archived_at,p=(w=e.cost)==null?void 0:w.cap_usd,h=!!e.pending&&e.pending.kind!=="budget",b=!!n.onRaiseCap&&!l.final&&typeof p=="number"&&!h,[x,m]=y.useState(!1),v=((j=e.pending)==null?void 0:j.kind)==="budget"?e.pending:null;return s.jsxs("header",{className:"border-b px-5 py-4 max-sm:py-3 md:px-8",children:[s.jsxs("nav",{className:"caps flex min-w-0 items-center gap-2 text-label text-muted-foreground","aria-label":"Breadcrumb",children:[s.jsx("button",{type:"button","aria-label":"Back",title:"Back",onClick:()=>TI(zs(e.agent_id)),className:"-m-1 shrink-0 p-1 hover:text-foreground",children:s.jsx(Ds,{className:"size-3.5","aria-hidden":!0})}),s.jsx("a",{href:zs(e.agent_id),className:"truncate hover:text-foreground hover:underline",children:t}),s.jsx("span",{"aria-hidden":!0,children:"/"}),s.jsxs("span",{className:"truncate",children:["Run ",Hl(e.run_id)]})]}),s.jsxs("div",{"data-phone-row":!0,className:"mt-3 flex flex-col items-start gap-x-6 gap-y-3 max-sm:mt-2 max-sm:flex-row max-sm:flex-wrap max-sm:items-center max-sm:gap-x-3 max-sm:gap-y-2 sm:flex-row",children:[s.jsxs("div",{className:"min-w-0 flex-1 self-stretch max-sm:contents",children:[s.jsx("h1",{className:"break-words text-2xl font-semibold leading-tight max-sm:line-clamp-2 max-sm:basis-full max-sm:text-lg",title:rn(e),children:e.kind==="workflow"&&/^[[{]/.test(e.title.trim())?t:rn(e)}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-4 gap-y-2 text-small text-muted-foreground max-sm:contents",children:[s.jsx(Kl,{run:e}),f&&s.jsx(Me,{tone:"muted",children:"Archived"}),e.approvals==="never"&&s.jsx(Me,{tone:"warning",title:"This run's agent never asks: no call of it waits for you.",children:"Unattended"}),s.jsxs("span",{className:"font-mono",children:[e.kind," · rev ",e.agent_version,i&&` · ${i}`]}),s.jsx("span",{className:"font-mono",children:St(e.created_at)}),o!==void 0?s.jsx("span",{className:"font-mono",title:"The run's decisions and model calls, as the providers priced them",children:Sb(e.cost,p,{text:o})}):s.jsx("span",{className:"font-mono",title:CI(e.cost,kl(e.status)),children:Sb(e.cost,p,{ended:kl(e.status)})}),s.jsx(Ud,{run:e,link:!0}),s.jsx(uN,{run:e})]}),e.status==="completed"&&e.review&&s.jsxs("p",{className:"mt-2 text-body text-warning-text max-sm:mt-0 max-sm:basis-full",children:["Needs review: ",e.review.reason]})]}),(l.canStop||l.canCancel||n.onArchive||b)&&s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[b&&s.jsxs(Z,{size:"sm",onClick:()=>m(S=>!S),"aria-expanded":x,title:`Raise its ${so(p)} spend cap.`,children:[s.jsx(vh,{"aria-hidden":!0})," Raise the cap"]}),l.canStop&&s.jsxs(Z,{size:"sm",onClick:n.onStop,disabled:!n.onStop||!!n.busy,title:"End this turn. The run stays open and waits for your next message.",children:[s.jsx(S_,{"aria-hidden":!0})," ",n.busy==="stop"?"Stopping":"Stop"]}),l.canCancel&&!c&&s.jsxs(Z,{size:"sm",variant:"destructive",onClick:()=>u(!0),disabled:!n.onCancel||!!n.busy,title:"End the run for good.",children:[s.jsx(s0,{"aria-hidden":!0})," ",n.busy==="cancel"?"Cancelling":"Cancel run"]}),c&&s.jsxs("span",{className:"flex items-center gap-2 border border-destructive/50 px-2 py-1 text-small",role:"alertdialog","aria-label":"Cancel this run?",children:[s.jsx("span",{children:"Cancel for good?"}),s.jsx(Z,{size:"sm",variant:"destructive",onClick:()=>{var S;u(!1),(S=n.onCancel)==null||S.call(n)},children:"Yes, cancel"}),s.jsx(Z,{size:"sm",variant:"ghost",onClick:()=>u(!1),children:"Keep"})]}),n.onArchive&&s.jsxs(Z,{size:"sm",onClick:n.onArchive,disabled:!!n.busy,title:f?"Show it in the runs list again.":"Hide it from the runs list. Its history is kept.",children:[f?s.jsx(n0,{"aria-hidden":!0}):s.jsx(Rl,{"aria-hidden":!0})," ",n.busy==="archive"?f?"Unarchiving":"Archiving":f?"Unarchive":"Archive"]})]})]}),b&&x&&s.jsx("div",{className:"mt-3 max-w-xl",children:s.jsx(IN,{cap:p,suggested:PN(v),least:LN(v),paused:!!v,onRaise:n.onRaiseCap},v?`${e.run_id}:${v.at}`:`${e.run_id}:working`)})]})}const AI=[{id:"rendered",label:"Rendered"},{id:"raw",label:"Raw"}];function OI({view:e,onView:t}){return s.jsx("div",{className:"flex",role:"radiogroup","aria-label":"View",children:AI.map(n=>s.jsxs("label",{className:oe("caps -ml-px cursor-pointer border px-3 py-1.5 text-label first:ml-0 has-[:focus-visible]:outline has-[:focus-visible]:outline-1 has-[:focus-visible]:outline-offset-2",e===n.id?"relative border-foreground bg-foreground text-background":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:[s.jsx("input",{type:"radio",name:"file-view",value:n.id,checked:e===n.id,onChange:()=>t(n.id),className:"sr-only"}),n.label]},n.id))})}function MI({files:e,onOpen:t}){const n=e.reduce((o,i)=>o+i.size_bytes,0);return s.jsxs("section",{children:[s.jsxs("p",{className:"caps mb-2 flex items-center gap-2 text-label text-muted-foreground",children:[s.jsx(a_,{className:"size-3.5","aria-hidden":!0})," Files · ",e.length," ",e.length===1?"file":"files"," (",Ha(n),")"]}),e.length===0?s.jsx("p",{className:"border px-4 py-8 text-center font-mono text-body text-muted-foreground",children:"This run wrote no files."}):s.jsx("ul",{className:"border",children:e.map(o=>s.jsx("li",{className:"border-b last:border-b-0",children:s.jsxs("button",{type:"button",onClick:()=>t(o),className:"flex w-full items-center gap-3 px-3 py-2.5 text-left hover:bg-accent",children:[s.jsx(Xa,{className:"size-4 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-body",children:o.path}),s.jsx("span",{className:"hidden font-mono text-label text-muted-foreground sm:inline",children:St(o.modified_at)}),s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:Ha(o.size_bytes)})]})},o.path))})]})}function PI({file:e,text:t,onClose:n,files:o=[],onOpen:i}){const[l,c]=y.useState(!1),u=y.useRef(null);y.useEffect(()=>{var S;const w=document.activeElement,j=u.current;return j&&!j.open&&((S=j.showModal)==null||S.call(j)),()=>{var T;j!=null&&j.open&&j.close(),(T=w==null?void 0:w.focus)==null||T.call(w)}},[]),y.useEffect(()=>c(!1),[e.path]);const f=y.useRef(!1),p=y.useRef(!1),h=E4(e),[b,x]=y.useState(h==="markdown"?"rendered":"raw");y.useEffect(()=>x(h==="markdown"?"rendered":"raw"),[e.path]);const m=N1(w=>{const j=o.find(S=>S.path===w);j&&(i==null||i(j))}),v=()=>{if(t===null)return;const w=URL.createObjectURL(new Blob([t],{type:e.content_type??"application/octet-stream"}));Object.assign(document.createElement("a"),{href:w,download:e.path.split("/").pop()}).click(),URL.revokeObjectURL(w)};return s.jsx("dialog",{ref:u,"aria-label":e.path,onCancel:w=>{w.preventDefault(),n()},onMouseDown:w=>{f.current=w.target===w.currentTarget},onMouseUp:w=>{p.current=w.target===w.currentTarget},onClick:w=>{f.current&&p.current&&w.target===w.currentTarget&&n(),f.current=p.current=!1},className:"m-0 h-full max-h-none w-full max-w-none border-0 bg-transparent p-0 text-foreground backdrop:bg-overlay/60 md:p-8",children:s.jsxs("div",{className:"mx-auto flex h-full w-full max-w-5xl flex-col border bg-background",children:[s.jsxs("header",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 border-b px-4 py-2.5",children:[s.jsx(Z,{size:"icon",variant:"ghost",onClick:n,"aria-label":"Close",children:s.jsx(Ll,{"aria-hidden":!0})}),s.jsx(Xa,{className:"size-4 text-muted-foreground","aria-hidden":!0}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-body",children:e.path}),h!=="download"&&s.jsx("div",{className:"order-last basis-full sm:order-none sm:basis-auto",children:s.jsx(OI,{view:b,onView:x})}),s.jsxs(Z,{size:"sm",disabled:t===null,onClick:async()=>{var w;t!==null&&(await((w=navigator.clipboard)==null?void 0:w.writeText(t)),c(!0))},children:[s.jsx(gd,{"aria-hidden":!0})," ",l?"Copied":"Copy"]}),s.jsxs(Z,{size:"sm",disabled:t===null,onClick:v,children:[s.jsx(r_,{"aria-hidden":!0})," Download"]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-6 py-8 md:px-16",children:t===null?s.jsx("p",{className:"font-mono text-body text-muted-foreground",children:"Loading the file..."}):h==="download"?s.jsx("p",{className:"font-mono text-body text-muted-foreground",children:"This file type is not shown here. Download it to open it."}):b==="rendered"?s.jsx("article",{className:"report mx-auto max-w-3xl",onClick:m,dangerouslySetInnerHTML:{__html:Ba(t,i&&{paths:o.map(w=>w.path),from:e.path.split("/").slice(0,-1).join("/")})}}):s.jsx("pre",{className:"whitespace-pre-wrap break-words font-mono text-small leading-[1.8]",children:t})}),s.jsxs("footer",{className:"border-t px-4 py-2 font-mono text-label text-muted-foreground",children:["File · ",t===null?"...":`${t.length.toLocaleString("en-US")} characters`," · ",e.content_type??"unknown type"]})]})})}function LI({run:e,rows:t,files:n=[],onOpen:o}){var u,f,p;const i=((u=e.result)==null?void 0:u.final_answer)??((f=t.findLast(h=>h.kind==="final_answer"))==null?void 0:f.text)??null,l=o?{paths:n.map(h=>h.path)}:void 0,c=N1(h=>{const b=n.find(x=>x.path===h);b&&(o==null||o(b))});if(i)return s.jsx("article",{className:"report max-w-none",onClick:c,dangerouslySetInnerHTML:{__html:Ba(i,l)}});if(((p=e.result)==null?void 0:p.output)!==void 0&&e.result.output!==null){const h=e.result.output,b=h&&typeof h=="object"&&!Array.isArray(h)?Object.entries(h).filter(m=>typeof m[1]=="string"&&m[1].includes(`
|
|
540
|
-
`)&&m[1].length>80):[],x=b.length?Object.fromEntries(Object.entries(h).filter(([m])=>!b.some(([v])=>v===m))):h;return s.jsxs("div",{className:"space-y-8",children:[b.map(([m,v])=>s.jsxs("section",{children:[s.jsx("p",{className:"caps mb-2 text-label text-muted-foreground",children:m.replace(/_/g," ")}),s.jsx("article",{className:"report max-w-none border bg-card p-5",onClick:c,dangerouslySetInnerHTML:{__html:Ba(v,l)}})]},m)),(!b.length||Object.keys(x).length>0)&&s.jsxs("section",{children:[s.jsx("p",{className:"caps mb-2 text-label text-muted-foreground",children:b.length?"The rest of the output":"Output"}),s.jsx("pre",{className:"overflow-auto border bg-card p-4 font-mono text-small leading-[1.8]",children:JSON.stringify(x,null,2)})]})]})}return null}function II(e,t,n=3e3){const[o,i]=y.useState(null),[l,c]=y.useState(!1),u=y.useRef(e);u.current=e;const f=y.useRef(!1),p=!!e;y.useEffect(()=>{if(!p||l)return;if(!t&&f.current){i(v=>v&&Bw(v));return}let b=!0,x;const m=async()=>{try{const v=await u.current();if(!b)return;f.current=!0,v.state==="off"?i(null):i(t?w=>zI(w,v)?w:v:Bw(v))}catch(v){if(!b)return;if(v instanceof Ee&&v.status===401){c(!0),i(w=>w?{state:"signed_out"}:null);return}if(v instanceof Ee&&v.status===403){c(!0),i(null);return}}b&&t&&(x=setTimeout(()=>void m(),n))};return m(),()=>{b=!1,clearTimeout(x)}},[p,t,n,l]);const h=y.useCallback(b=>i(x=>x&&x.state==="live"&&x.hold!==b?{...x,hold:b}:x),[]);return{view:o,held:h}}const zI=(e,t)=>{var n,o;return!!e&&e.state!=="signed_out"&&e.state===t.state&&e.kind===t.kind&&e.hold===t.hold&&(e.state!=="live"||t.state==="live"&&e.viewer===t.viewer)&&(e.state!=="none"||t.state==="none"&&((n=e.ended)==null?void 0:n.at)===((o=t.ended)==null?void 0:o.at))},Bw=e=>e.state==="off"?null:e.state==="signed_out"?e:{state:"none",kind:e.kind,hold:"agent"},DI={browser:l0,desktop:Ol,phone:j_,sandbox:m0},FI={browser:"Browser",desktop:"Desktop",phone:"Phone",sandbox:"Sandbox"},UI={agent:"The agent drives",pending:"Yours after the agent's step",person:"You drive"};function WI({runId:e,screen:t,machine:n,opens:o,followUp:i,metered:l,onTake:c,onHand:u}){const f=y.useRef({viewer:"",n:0});(t==null?void 0:t.state)==="live"&&t.viewer!==f.current.viewer&&(f.current={viewer:t.viewer,n:f.current.n+1});const p=(t==null?void 0:t.state)==="live"?GI(t.viewer,e):void 0,h=t&&t.state!=="signed_out"?t.kind:(n==null?void 0:n.kind)??"browser",b=DI[h],x=(t==null?void 0:t.state)==="live"?t:null,[m,v]=y.useState(!1),[w,j]=y.useState(null),S=async U=>{if(!(!U||m)){v(!0),j(null);try{j(await U())}finally{v(!1)}}},T=x&&p&&h!=="browser"?x:null,[$,_]=y.useState(!1),E=y.useRef(null),R=y.useRef(null),C=y.useRef(null),O=y.useRef(!1),z=!!(x&&p);y.useEffect(()=>{z||_(!1)},[z]),y.useEffect(()=>{var U,W,X;if($){O.current=!0,(W=(U=R.current)==null?void 0:U.querySelector("button"))==null||W.focus();return}O.current&&(O.current=!1,(X=C.current)==null||X.focus())},[$]),y.useEffect(()=>{if(!$)return;const U=L=>{if(L.key==="Escape"){_(!1);return}if(L.key!=="Tab"||!R.current)return;const I=[...R.current.querySelectorAll("button:not([disabled]), iframe")];if(!I.length)return;const G=I[0],P=I[I.length-1],q=document.activeElement;R.current.contains(q)?L.shiftKey&&q===G?(L.preventDefault(),P.focus()):!L.shiftKey&&q===P&&(L.preventDefault(),G.focus()):(L.preventDefault(),G.focus())},W=L=>{L.key==="Escape"&&_(!1)};document.addEventListener("keydown",U);const X=E.current;let M=null;const K=()=>{try{M==null||M.removeEventListener("keydown",W,!0)}catch{}try{M=(X==null?void 0:X.contentWindow)??null,M==null||M.addEventListener("keydown",W,!0)}catch{M=null}};return K(),X==null||X.addEventListener("load",K),()=>{document.removeEventListener("keydown",U),X==null||X.removeEventListener("load",K);try{M==null||M.removeEventListener("keydown",W,!0)}catch{}}},[$,f.current.n]);const F=x?h==="browser"?"browser · take over in the view below":`${UI[x.hold]} · ${h}`:"",D=T&&(T.hold==="person"?s.jsx(Z,{size:"sm",variant:"solid",disabled:m,onClick:()=>void S(u),children:"Hand back"}):s.jsx(Z,{size:"sm",variant:"solid",disabled:m||T.hold==="pending",onClick:()=>void S(c),children:T.hold==="pending"?"Taking over":"Take over"})),B=z&&s.jsx(Z,{ref:$?void 0:C,size:"sm",variant:"ghost",onClick:()=>_(U=>!U),"aria-label":$?"Exit full window (Esc)":"Fill the window",title:$?"Exit full window (Esc)":"Fill the window","aria-pressed":$,children:$?s.jsx(g_,{className:"size-4","aria-hidden":!0}):s.jsx(m_,{className:"size-4","aria-hidden":!0})});return s.jsxs("section",{"aria-label":"Screen",className:"border",children:[s.jsxs("header",{className:"flex flex-wrap items-center gap-3 border-b px-4 py-2.5",children:[s.jsx(b,{className:"size-4 text-muted-foreground","aria-hidden":!0}),s.jsx("span",{className:"caps text-small font-semibold",children:x?"Live":FI[h]}),s.jsx("span",{className:"flex-1 font-mono text-small text-muted-foreground",children:F}),!$&&D,!$&&B]}),l&&h!=="browser"&&s.jsx("p",{className:"border-b px-4 py-2 text-small text-muted-foreground",children:_g}),!$&&w&&s.jsx("p",{className:"border-b px-4 py-2 text-small text-warning-text",role:"alert",children:w}),x&&p?s.jsxs("div",{ref:R,"data-testid":"screen-frame",className:$?"fixed inset-0 z-dialog flex flex-col bg-background":void 0,role:$?"dialog":void 0,"aria-modal":$?!0:void 0,"aria-label":$?"The run's screen, filling the window":void 0,children:[$&&s.jsxs("div",{className:"flex items-center gap-3 border-b bg-background px-4 py-2 text-foreground",children:[s.jsx("span",{className:"flex-1 font-mono text-small",children:F}),D,B]}),$&&w&&s.jsx("p",{className:"border-b px-4 py-2 text-small text-warning-text",role:"alert",children:w}),s.jsx("iframe",{ref:E,src:p,title:"The run's screen",referrerPolicy:"no-referrer",sandbox:"allow-forms allow-scripts allow-same-origin",className:$?"block min-h-0 w-full flex-1 bg-background":h==="phone"?"mx-auto block aspect-[9/19] h-[70vh] max-w-full bg-background":"block aspect-[16/10] w-full bg-background"},f.current.n)]}):s.jsx("p",{className:"px-4 py-12 text-center font-mono text-body text-muted-foreground",children:HI(h,t,n,o,i)})]})}function HI(e,t,n,o,i){return(t==null?void 0:t.state)==="live"?"The live view can't be shown here.":(t==null?void 0:t.state)==="signed_out"?"Signed out: sign in to watch.":e==="sandbox"?"A sandbox has no screen. What the agent runs in it is on the timeline.":(n==null?void 0:n.state)==="failed"?`The ${e} didn't start.${n.why?` ${n.why}`:""}`:o&&(t==null?void 0:t.state)==="none"&&t.ended?`${t.ended.why} (${BI(t.ended.at)}). A new browser opens when the run goes on.`:o?e==="browser"?"Waiting for the browser. The agent's page shows here once it opens one.":`Waiting for the ${e}. Its screen shows here once it is up.`:`The ${e} closed when the run ended.${i?" A follow-up opens a new one if the agent needs it.":""}`}function BI(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:`at ${t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}function GI(e,t){let n;try{n=new URL(e,location.origin).href}catch{return}const o=Lo(n);if(!o)return;const i=new URL(o);return i.origin===location.origin&&i.pathname.startsWith(`/v2/runs/${encodeURIComponent(t)}/computer/live/`)?o:void 0}const Ta=e=>{var t,n;return e.status==="input_required"&&(((t=e.pending)==null?void 0:t.kind)==="browser"||((n=e.pending)==null?void 0:n.kind)==="computer")?e.pending:null},zN=e=>e.kind==="computer"?e.computer:"browser";function dh(e,t){var n;if(e instanceof Ee&&e.code==="handoff_answered"){const o=(n=e.details)==null?void 0:n.outcome;return o==="expired"?"The ask expired before your answer: the agent was told.":o==="done"||o==="cancelled"?`It was already answered: ${o}.`:e.message}return e instanceof Ee&&e.code==="computer_not_live"?e.message:e instanceof Ee&&e.status===404?t==="hand"?"The agent isn't asking for you now.":"This run has no screen to take over.":e instanceof Ee&&e.status===403?"Sign in with your password to do this from here.":`${t==="hand"?"Not answered":"Not taken"}: ${Nn(e)}`}function DN({ask:e,onAnswer:t,open:n,heading:o,compact:i=!1}){const[l,c]=y.useState(!1),[u,f]=y.useState(null),p=y.useRef(!1),h=async b=>{if(!(!t||p.current)){p.current=!0,c(!0),f(null);try{f(await t(b))}finally{p.current=!1,c(!1)}}};return s.jsxs("section",{"aria-label":"Waiting for you at the computer",className:i?"px-4 py-3":"border border-warning/50 bg-warning/5 p-4",children:[o,s.jsxs("p",{className:oe("caps flex items-center gap-2 text-label text-warning-text",o&&"mt-1"),children:[s.jsx(Ol,{className:"size-3.5","aria-hidden":!0})," Waiting for you · ",zN(e)]}),s.jsxs("div",{"data-agent-request":!0,className:oe("border-l-2 border-warning/60 pl-3",i?"mt-1":"mt-2"),children:[s.jsxs("p",{className:i?"text-prose leading-snug":"text-prose leading-relaxed",children:["The agent asks you to: ",e.instruction]}),s.jsxs("p",{className:"mt-1 text-body text-muted-foreground",children:["Done when: ",e.completion_condition]})]}),s.jsx("p",{className:"mt-2 text-small font-semibold",children:"You never need to type your AgentRun password for this."}),s.jsxs("p",{className:"mt-1 font-mono text-label text-muted-foreground",children:["Expires ",St(e.expires_at)," unanswered"]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[n,s.jsx("span",{className:"flex-1"}),t&&s.jsxs(s.Fragment,{children:[s.jsx(Z,{size:"sm",variant:"solid",disabled:l,onClick:()=>void h("done"),children:"Done"}),s.jsx(Z,{size:"sm",variant:"ghost",disabled:l,onClick:()=>void h("cancelled"),children:"Cancel"})]})]}),u&&s.jsx("p",{className:"mt-2 text-small text-warning-text",role:"alert",children:u})]})}function qI(e,t){const n=!!t&&Nl(e.learning).length>0,[o,i]=y.useState({state:"reading"}),[l,c]=y.useState(0);return y.useEffect(()=>{if(!n)return;let u=!0;return i({state:"reading"}),Promise.resolve().then(()=>t()).then(f=>{u&&i({state:"read",changes:_A(f,e.learning)})},f=>{u&&i({state:"failed",error:f??new Error("unknown")})}),()=>{u=!1}},[e.run_id,n,l]),n?{got:o,retry:()=>c(u=>u+1)}:null}function VI({got:e,retry:t}){if(e.state==="read"&&!e.changes.length)return null;const n=e.state==="failed"?mn(e.error,"what it changed"):null;return s.jsxs("section",{className:"border","aria-label":"What it changed",children:[s.jsx("h2",{className:"caps border-b px-4 py-3 text-small font-semibold",children:"What it changed"}),e.state==="reading"&&s.jsx("p",{className:"px-4 py-3 text-body text-muted-foreground",role:"status",children:"Reading what it changed…"}),n&&s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 px-4 py-3 text-body",role:"alert",children:[s.jsxs("span",{className:"min-w-0 flex-1",children:["Couldn't read what it changed: ",n.why.charAt(0).toLowerCase()+n.why.slice(1)]}),s.jsx(Z,{type:"button",onClick:t,size:"sm",children:"Try again"})]}),e.state==="read"&&s.jsx("ul",{className:"divide-y",children:e.changes.map(o=>s.jsx("li",{children:s.jsx(KI,{change:o})},o.file))})]})}function KI({change:e}){const[t,n]=y.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsxs("button",{type:"button",className:"flex w-full items-start gap-3 px-4 py-3 text-left hover:bg-accent/40","aria-expanded":t,onClick:()=>n(o=>!o),children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block break-words text-lead","data-said":!0,children:e.said}),s.jsx("span",{className:"mt-0.5 block break-all font-mono text-label text-muted-foreground",children:e.file})]}),s.jsx(Us,{className:oe("mt-0.5 size-4 shrink-0 text-muted-foreground transition-transform",t&&"rotate-90"),"aria-hidden":!0})]}),t&&(e.withheld?s.jsx("p",{className:"px-4 pb-3 text-body text-muted-foreground",children:e.withheld}):s.jsxs("div",{className:"grid grid-cols-1 gap-3 px-4 pb-4 md:grid-cols-2",children:[s.jsx(Gw,{name:"before",lines:e.before,none:"Not there before."}),s.jsx(Gw,{name:"after",lines:e.after,none:"Not there after."})]}))]})}function Gw({name:e,lines:t,none:n}){return s.jsxs("div",{className:"min-w-0 border","data-side":e,children:[s.jsx("p",{className:"caps border-b px-3 py-2 text-label text-muted-foreground",children:e==="before"?"Before":"After"}),t===null?s.jsx("p",{className:"px-3 py-2 text-body text-muted-foreground",children:n}):s.jsx("pre",{className:"max-h-80 overflow-auto py-2 font-mono text-small leading-[1.7]",children:t.map((o,i)=>s.jsxs("span",{className:oe("flex min-h-[1.7em] px-3",o.mark==="added"&&"bg-primary/10",o.mark==="removed"&&"bg-destructive/10"),children:[s.jsx("span",{"aria-hidden":!0,className:"w-4 shrink-0 select-none text-muted-foreground",children:o.mark==="added"?"+":o.mark==="removed"?"−":""}),o.mark==="added"&&s.jsx("span",{className:"sr-only",children:"Added line: "}),o.mark==="removed"&&s.jsx("span",{className:"sr-only",children:"Taken out: "}),s.jsx("span",{"data-mark":o.mark,className:oe("min-w-0 whitespace-pre-wrap break-words",o.mark==="gap"&&"text-muted-foreground"),children:o.text})]},i))})]})}function XI(e,t,n){const o=!!n&&!!e.learning,[i,l]=y.useState(null);return y.useEffect(()=>{if(!o)return;let c=!0;return Promise.resolve().then(()=>n()).then(u=>{c&&l((u==null?void 0:u.used)??null)},()=>{c&&l(null)}),()=>{c=!1}},[e.run_id,o,t]),o?i:null}const YI=e=>e===1?"once":e===2?"twice":`${e} times`;function QI({used:e,agentId:t}){return!e||!e.skills.length&&!e.workflows.length?null:s.jsxs("section",{className:"border","aria-label":"What it used of what it learned",children:[s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-3 gap-y-1 border-b px-4 py-3",children:[s.jsx("h2",{className:"caps text-small font-semibold",children:"What it used of what it learned"}),s.jsx("span",{className:"flex-1"}),s.jsx("a",{href:Fd(t),className:"font-mono text-label text-muted-foreground underline-offset-2 hover:text-foreground hover:underline",children:"Open the Learning tab"})]}),s.jsxs("ul",{className:"divide-y",children:[e.skills.map(n=>s.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2.5",children:[s.jsx(Mu,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("span",{className:"caps w-16 text-micro text-muted-foreground",children:"Skill"}),s.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-body",children:n.name}),n.read?s.jsx(Me,{tone:"success",children:"Read"}):s.jsx(Me,{tone:"muted",children:"Given, not read"})]},`skill:${n.name}`)),e.workflows.map(n=>s.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 px-4 py-2.5",children:[s.jsx(Go,{className:"size-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}),s.jsx("span",{className:"caps w-16 text-micro text-muted-foreground",children:"Workflow"}),s.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-body",children:n.name}),s.jsxs("span",{className:"font-mono text-label text-muted-foreground",children:["Called ",YI(n.calls)]}),n.failed>0&&s.jsxs(Me,{tone:"error",children:[n.failed," failed"]})]},`workflow:${n.name}`))]})]})}const ZI={label:"Decline and say what to do instead",placeholder:"Tell the agent what to do instead...",does:"Sending it declines the waiting call; the agent reads your message."},JI={steer:{label:"Steer the run",placeholder:"Steer the run...",does:"A message steers the run; it doesn't answer the ask. Do it on the screen, then Done or Cancel above."},follow_up:{label:"Message the run",placeholder:"Message the run...",does:"A message goes to the run after its turn; it doesn't answer the ask. Do it on the screen, then Done or Cancel above."}};function ez(e,t){var o,i;if(e.status==="input_required"&&((o=e.pending)==null?void 0:o.kind)==="budget"){const{cap_usd:l,spent_usd:c}=e.pending,u=typeof l=="number"&&Number.isFinite(l);return{title:"Paused at its spend cap",note:`${u&&typeof c=="number"?`It has spent ${so(c)} of its ${so(l)} cap.`:u?`Its ${so(l)} cap is reached.`:"Its spend cap is reached."} Raise the cap above to continue.`,spin:!1}}if(e.status==="input_required"&&((i=e.pending)==null?void 0:i.kind)==="approval")return{title:"Waiting for your approval",note:`The run continues once you answer the approval above${t.canMessage?", or send a message below to decline it":""}.`,spin:!1};const n=Ta(e);return n?{title:`Waiting for you at the ${zN(n)}`,note:"The run continues once you answer the ask above, or hand the computer back on the Screen tab.",spin:!1}:e.status==="input_required"&&e.state==="waiting"?{title:"Waiting for your answer",note:t.messageMode==="answer"?"The run continues when you reply below.":"The run continues once the question is answered.",spin:!1}:e.status==="input_required"?{title:"Stopped",note:`Stopped before it wrote an answer.${t.canMessage?" Send a message below to continue it.":""}`,spin:!1}:e.status==="paused"?{title:"Paused",note:"No new step starts until it's resumed. The answer appears here when it finishes.",spin:!1}:{title:"Writing the answer",note:"The answer appears here when the run finishes. Follow it on the timeline.",spin:t.live}}function tz({run:e,agentName:t,messages:n,harnessSteers:o,rows:i,files:l,readFile:c,openFile:u=null,actions:f,onMessage:p,onApprove:h,tab:b,graphView:x,costText:m,readLearningDiff:v,readLearning:w,readComputer:j,computerEvery:S,onTakeOver:T,onHandBack:$,readComputers:_}){var gn,Qt,ot,ct;const E=((gn=e.pending)==null?void 0:gn.kind)==="budget"?e.pending:null,R=Ta(e),C=R?o&&n.steer?"steer":n.follow_up?"follow_up":null:null,O=Vl(e.status,e.state,e.kind,n,o,e.error,e.review),z=E?{...O,canMessage:!1,messageMode:null}:R?{...O,canMessage:C!==null,messageMode:C}:O,F=x?"graph":z.final&&e.status==="completed"?"report":"timeline",[D,B]=y.useState(b??F),U=D==="graph"&&!x?F:D,[W,X]=y.useState(u?{file:u,text:null}:null),M=xI(e),K=M||R?null:$4(e.status,e.state,i),L=M?i.findLast(Pe=>Pe.kind===RN&&Pe.tool_use_id===M.call_id):void 0,[I,G]=y.useState(null),P=async(Pe,Le,Mt)=>{const ut=h?await h(Pe,Le,Mt):"This page can't answer an approval.";return G(ut?{id:Pe,text:ut}:null),ut},q=y.useRef(Ku()).current,ne=async Pe=>{const Le=q.begin();if(X({file:Pe,text:null}),!c)return;const Mt=await c(Pe);q.current(Le)&&X({file:Pe,text:Mt})},ae=()=>{q.cancel(),X(null)},ie=qI(e,v),ce=XI(e,z.final,w),le=z.live||e.status==="input_required"&&e.state==="waiting"||e.status==="paused",{view:ye,held:ee}=II(j,!z.final,S),be=e.computer,Oe=!!ye||!!be||!!R,We=y.useRef(!1);y.useEffect(()=>{if(Oe){We.current=!0;return}We.current&&U==="screen"&&B(F),We.current=!1},[Oe,U,F]);const[fe,Re]=y.useState(!1);y.useEffect(()=>{if(!be||!$g.has(be.kind)||!_)return;let Pe=!0;return _().then(Le=>{var Mt,ut;Pe&&Re(!!((ut=(Mt=Le.kinds.find(It=>It.kind===be.kind))==null?void 0:Mt.providers.find(It=>It.id===be.provider))!=null&&ut.metered))}).catch(()=>{}),()=>{Pe=!1}},[be==null?void 0:be.kind,be==null?void 0:be.provider]);const Xe=R?`${R.kind}:${R.asked_at}`:null,Yt=y.useRef(null);y.useEffect(()=>{!Xe||Yt.current===Xe||!Oe||(Yt.current=Xe,B("screen"))},[Xe,Oe]);const De=async()=>{if(!T)return"This page can't take the computer over.";try{return ee((await T()).hold),null}catch(Pe){return dh(Pe,"take")}},et=async Pe=>{if(!$)return"This page can't hand the computer back.";try{return ee((await $(Pe)).hold),null}catch(Le){return dh(Le,"hand")}},[Ht,Bt]=y.useState(null),_t=async Pe=>{const Le=(R==null?void 0:R.asked_at)??"",Mt=await et(Pe);return Bt(Mt?{at:Le,text:Mt}:null),Mt};y.useEffect(()=>{u&&c&&ne(u)},[u]);const os=[...x?[["graph","Graph"]]:[],["report","Report"],["timeline","Timeline"],["files",`Files ${l.length}`],...Oe?[["screen","Screen"]]:[]];return s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsx(RI,{run:e,agentName:t,actions:f,costText:m}),s.jsx(F1,{tabs:os.map(([Pe,Le])=>({id:Pe,label:Le})),value:U,onChange:B}),U==="graph"?s.jsx("div",{className:"min-h-0 flex-1",children:x}):s.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 px-5 py-8 md:px-8",children:[e.status==="failed"&&e.error&&s.jsx(Xo,{error:e.error,title:rj(e.status,e.error)?"The run escalated":void 0}),e.status==="cancelled"&&s.jsxs("section",{className:"border border-border-strong/60 p-4",children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:"Cancelled"}),s.jsx("p",{className:"mt-2 text-lead text-muted-foreground",children:"This run was cancelled. It keeps what it did before; it takes no more messages."})]}),e.status==="completed"&&e.review&&s.jsxs("section",{className:"border border-warning/50 bg-warning/10 p-4","aria-label":"Needs review",children:[s.jsx("p",{className:"caps text-label text-warning-text",children:"Needs review"}),s.jsx("p",{className:"mt-2 text-lead",children:e.review.reason}),s.jsxs("p",{className:"mt-1 font-mono text-small text-muted-foreground",children:[[e.review.node&&`Stopped at ${e.review.node}`,e.review.kind].filter(Boolean).join(" · "),". A person takes it from here."]})]}),I&&I.id!==(M==null?void 0:M.id)&&s.jsxs("p",{className:"border border-destructive/50 px-4 py-2.5 font-mono text-small text-destructive-text",role:"alert",children:["Your answer wasn't taken: ",I.text]}),Ht&&Ht.at!==(R==null?void 0:R.asked_at)&&s.jsxs("p",{className:"border border-destructive/50 px-4 py-2.5 font-mono text-small text-destructive-text",role:"alert",children:["Your answer wasn't taken: ",Ht.text]}),M?s.jsx(ON,{pending:M,onAnswer:(Pe,Le)=>P(M.id,Pe,Le)},M.id):R?s.jsx(DN,{ask:R,onAnswer:$?_t:void 0,open:U!=="screen"?s.jsx(Z,{size:"sm",variant:"primary",onClick:()=>B("screen"),children:"Open the screen"}):null},Xe):z.needsYou&&(E?s.jsx(NI,{pending:E}):s.jsx(_I,{waiting:K})),z.needsYou&&E&&typeof E.cap_usd=="number"&&(f==null?void 0:f.onRaiseCap)&&s.jsx(IN,{cap:E.cap_usd,suggested:PN(E),least:LN(E),paused:!0,onRaise:f.onRaiseCap},`${e.run_id}:${E.at}`),U==="report"&&s.jsx(LI,{run:e,rows:i,files:l,onOpen:ne}),U==="report"&&!e.result&&!z.final&&s.jsx(Kp,{...ez(e,z)}),U==="report"&&z.final&&!((Qt=e.result)!=null&&Qt.final_answer)&&!((ot=e.result)!=null&&ot.output)&&!i.some(Pe=>Pe.kind==="final_answer")&&e.status!=="failed"&&e.status!=="cancelled"&&!e.review&&s.jsx("p",{className:"font-mono text-body text-muted-foreground",children:"This run gave no answer."}),U==="timeline"&&s.jsx(fj,{rows:sj(i,e.learning),live:z.live,asking:(L==null?void 0:L.id)??(z.needsYou&&!E?K==null?void 0:K.id:void 0),waitingOn:e.status==="input_required"?(ct=e.pending)==null?void 0:ct.kind:void 0}),(U==="report"||U==="timeline")&&s.jsx(QI,{used:ce,agentId:e.agent_id}),(U==="report"||U==="timeline")&&ie&&s.jsx(VI,{got:ie.got,retry:ie.retry}),U==="files"&&s.jsx(MI,{files:l,onOpen:ne}),U==="screen"&&Oe&&s.jsx(WI,{runId:e.run_id,screen:ye,machine:be,opens:le,followUp:z.canMessage&&z.messageMode==="follow_up",metered:fe,onTake:T?De:void 0,onHand:$?()=>et():void 0})]})}),z.canMessage&&s.jsx("div",{className:"border-t px-5 py-4 md:px-8",children:s.jsx("div",{className:"mx-auto max-w-4xl",children:s.jsx(jI,{mode:z.messageMode,onSend:p,purpose:M?ZI:R&&C?JI[C]:void 0})})}),W&&s.jsx(PI,{file:W.file,text:W.text,onClose:ae,files:l,onOpen:ne})]})}const FN=new Set(["chain","parallel","route","map","loop","workflow"]),nz={done:"success",working:"active",failed:"error",review:"warning",escalated:"warning",stopped:"muted","not-run":"muted",pending:"plain"},sz=e=>e==="review"?"needs review":e.replace("-"," ");function zg({state:e}){const t=Vu(e)??"pending";return s.jsx(Me,{tone:nz[t]??"plain",className:"whitespace-nowrap",children:sz(t)})}function Dg({provider:e}){if(!e)return null;const t=e==="parallel"?"--wf-parallel":e==="openrouter"?"--wf-openrouter":"--wf-jev";return s.jsx("span",{className:"caps inline-flex h-5 items-center border px-1.5 text-micro leading-none",style:{color:`hsl(var(${t}))`,borderColor:`hsl(var(${t}) / .6)`,background:`hsl(var(${t}) / .12)`},children:e})}const UN={good:"text-success-text",warn:"text-warning-text",bad:"text-destructive-text"},Fg=(e,t)=>e&&t?Date.parse(t)-Date.parse(e):void 0;function rz({data:e,selected:t,onSelect:n,onClose:o,fileUrl:i}){var j,S,T,$,_,E;const l=e.graph.nodes.find(R=>R.path===t.path),[c,u]=y.useState(null);if(!l)return null;const f=e.nodes[l.path],p=og(e.workflow,l.path,l),h=l.kind==="map"?l.path:(j=e.graph.nodes.find(R=>R.kind==="map"&&l.path.startsWith(`${R.path}/body/`)))==null?void 0:j.path,b=t.item!=null&&h?(T=(S=e.nodes[h])==null?void 0:S.items)==null?void 0:T.find(R=>R.index===t.item):void 0,x=e.decisions.filter(R=>R.node===l.path),m=e.effects.filter(R=>R.node===l.path),v=!!h&&l.kind!=="map",w=Fg(f==null?void 0:f.startedAt,f==null?void 0:f.endedAt);return s.jsxs("aside",{className:"flex min-h-0 flex-col bg-background","aria-label":"Node details",children:[s.jsxs("header",{className:"border-b px-5 py-4",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"caps flex items-center gap-1.5 text-label text-muted-foreground",children:[p.decision?l.kind:pg(l.kind,f),p.tool?` · ${BN(p.tool)}`:l.via?` · ${l.via}`:"",p.tool&&Xl(p.tool)&&s.jsx(GN,{}),b&&s.jsxs(s.Fragment,{children:[s.jsx(Us,{className:"size-3","aria-hidden":!0})," item ",b.index+1]})]}),s.jsx("h2",{className:"mt-1 break-words font-mono text-lg font-semibold leading-tight",children:b?jl(e,h,b.index)??`Item ${b.index+1}`:l.label}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[s.jsx(zg,{state:b?b.status:f==null?void 0:f.status}),b&&(()=>{const R=ag(e,h,b);return R.outcome?s.jsxs("span",{className:"font-mono text-label",title:R.pNote,children:["outcome ",s.jsx("b",{className:UN[R.tone??""],children:R.outcome}),R.p!==void 0&&s.jsxs("span",{className:"text-muted-foreground",children:[" · ",ws(R.p)]})]}):null})(),p.decision&&s.jsx(Dg,{provider:p.provider}),p.decision&&((f==null?void 0:f.model)??p.model)&&s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:(f==null?void 0:f.model)??p.model}),(f==null?void 0:f.branch)&&s.jsxs("span",{className:"font-mono text-label",children:["took ",s.jsx("b",{children:f.branch})]}),!b&&w!==void 0&&s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:Pa(w)})]})]}),s.jsx(Z,{size:"icon",variant:"ghost","aria-label":"Close details",onClick:o,children:s.jsx(Ll,{"aria-hidden":!0})})]}),b&&s.jsxs("button",{type:"button",className:"caps mt-3 text-label text-muted-foreground hover:text-foreground",onClick:()=>n({path:h,item:null}),children:["All ",(_=($=e.nodes[h])==null?void 0:$.items)==null?void 0:_.length," items of ",(E=e.graph.nodes.find(R=>R.path===h))==null?void 0:E.label]})]}),s.jsxs("div",{className:"min-h-0 flex-1 space-y-5 overflow-auto px-5 py-5",children:[b?s.jsx(lz,{data:e,mapPath:h,index:b.index,status:b.status,fileUrl:i,zoom:u}):l.kind==="map"?s.jsx(oz,{data:e,mapPath:l.path,onSelect:n}):v&&(x.length||m.length)?s.jsx(az,{data:e,path:l.path,mapPath:h,onSelect:n}):s.jsxs(s.Fragment,{children:[l.kind==="parallel"&&s.jsx(iz,{data:e,path:l.path,onSelect:n}),x.map((R,C)=>s.jsx(HN,{d:R,fileUrl:i,zoom:u},R.id??C)),m.map((R,C)=>s.jsx(qN,{e:R,fileUrl:i,zoom:u},C)),!x.length&&!m.length&&l.kind!=="parallel"&&s.jsx(WN,{kind:l.kind,status:f==null?void 0:f.status,meta:p})]}),s.jsx(mz,{workflow:e.workflow,path:l.path,kind:l.kind})]}),c&&s.jsx(pz,{src:c,onClose:()=>u(null)})]})}function WN({kind:e,status:t,meta:n}){const o=n.decision?t==="working"?"Asking now. The verdict shows here when the answer comes back.":"Not asked yet.":e==="code"?"A code node: a pure transform of the run's state. It calls nothing, so it leaves no record of its own.":e==="route"?"Routed by a value already in the state: no model was asked.":FN.has(e)?"Its nodes are drawn inside it. Pick one to see what it did.":"Nothing recorded yet.";return s.jsx("p",{className:"border border-dashed px-4 py-3 text-body text-muted-foreground",children:o})}function oz({data:e,mapPath:t,onSelect:n}){var l;const o=((l=e.nodes[t])==null?void 0:l.items)??[],i=L1(o);return s.jsxs("section",{children:[s.jsx("div",{className:"mb-3 grid grid-cols-5 border",children:[["Items",i.total],["Done",i.done],["Working",i.working],["Review",i.review],["Failed",i.failed]].map(([c,u])=>s.jsxs("div",{className:"border-r px-3 py-2 last:border-r-0",children:[s.jsx("p",{className:"caps text-micro text-muted-foreground",children:c}),s.jsx("p",{className:"font-mono text-lg font-semibold tabular-nums",children:u})]},c))}),s.jsxs("table",{className:"w-full border-collapse font-mono text-small",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"caps text-left text-micro text-muted-foreground",children:[s.jsx("th",{className:"border-b py-1.5 pr-2 font-normal",children:"#"}),s.jsx("th",{className:"border-b py-1.5 pr-2 font-normal",children:"Item"}),s.jsx("th",{className:"border-b py-1.5 pr-2 font-normal",children:"State"}),s.jsx("th",{className:"border-b py-1.5 pr-2 font-normal",children:"Verdict"}),s.jsx("th",{className:"border-b py-1.5 text-right font-normal",children:"Cost"})]})}),s.jsx("tbody",{children:o.map(c=>{const u=e.decisions.filter(h=>{var b;return h.item===c.index&&!!((b=h.node)!=null&&b.startsWith(`${t}/body`))}),f=ag(e,t,c),p=u.length?u.some(h=>h.cost_usd===null)?null:u.reduce((h,b)=>h+(b.cost_usd??0),0):void 0;return s.jsxs("tr",{className:"cursor-pointer hover:bg-accent",onClick:()=>n({path:t,item:c.index}),children:[s.jsx("td",{className:"border-b py-1.5 pr-2 tabular-nums text-muted-foreground",children:c.index+1}),s.jsx("td",{className:"max-w-[140px] truncate border-b py-1.5 pr-2",title:jl(e,t,c.index),children:jl(e,t,c.index)??"—"}),s.jsx("td",{className:"border-b py-1.5 pr-2",children:s.jsx(zg,{state:c.status})}),s.jsx("td",{className:"max-w-[150px] truncate whitespace-nowrap border-b py-1.5 pr-2",title:[f.pNote,...u.map(h=>Ga(h))].filter(Boolean).join(", "),children:f.outcome?s.jsxs(s.Fragment,{children:[s.jsx("span",{className:oe("font-semibold",UN[f.tone??""]),children:f.outcome}),f.p!==void 0&&s.jsx("span",{className:"ml-2 tabular-nums text-muted-foreground",children:ws(f.p)})]}):u.map(h=>Ga(h)).filter(Boolean).join(", ")||s.jsx("span",{className:"text-muted-foreground",children:"—"})}),s.jsx("td",{className:"border-b py-1.5 text-right tabular-nums",children:p===void 0?s.jsx("span",{className:"text-muted-foreground",children:"—"}):si(p)})]},c.index)})})]})]})}function az({data:e,path:t,mapPath:n,onSelect:o}){var h;const i=e.decisions.filter(b=>b.node===t),l=e.effects.filter(b=>b.node===t),c=(((h=e.nodes[n])==null?void 0:h.items)??[]).map(b=>({it:b,d:i.find(x=>x.item===b.index),e:l.find(x=>x.item===b.index)})).filter(b=>b.d||b.e),u=i.filter(b=>b.cost_usd!==null),f=i.filter(b=>b.latency_ms!==null),p=f.length?f.reduce((b,x)=>b+(x.latency_ms??0),0)/f.length:void 0;return s.jsxs("section",{children:[i.length>0&&s.jsxs("p",{className:"mb-3 font-mono text-small text-muted-foreground",children:[i.length," asked · ",si(u.reduce((b,x)=>b+(x.cost_usd??0),0)),u.length<i.length?` + ${i.length-u.length} unknown`:""," · mean ",Pa(p)]}),s.jsx("table",{className:"w-full border-collapse font-mono text-small",children:s.jsx("tbody",{children:c.map(({it:b,d:x,e:m})=>s.jsxs("tr",{className:"cursor-pointer hover:bg-accent",onClick:()=>o({path:n,item:b.index}),children:[s.jsx("td",{className:"border-b py-1.5 pr-2 tabular-nums text-muted-foreground",children:b.index+1}),s.jsx("td",{className:"max-w-[150px] truncate border-b py-1.5 pr-2",children:jl(e,n,b.index)}),s.jsx("td",{className:"border-b py-1.5 pr-2",children:x?Ga(x):m?s.jsx(zg,{state:m.status}):null}),s.jsx("td",{className:"border-b py-1.5 text-right tabular-nums text-muted-foreground",children:x?Pa(x.latency_ms):m?Pa(Fg(m.startedAt,m.endedAt)):""})]},b.index))})})]})}function iz({data:e,path:t,onSelect:n}){var x,m;const o=`${t}/branches/`,i=e.decisions.filter(v=>{var w;return((w=v.node)==null?void 0:w.startsWith(o))&&/^\d+$/.test(v.node.slice(o.length))&&v.item===null}),l=new Set(i.flatMap(v=>Object.keys(v.answers??{}))),[c]=[...l],u=i.map(v=>{var w;return{d:v,a:(w=v.answers)==null?void 0:w[c]}}).filter(v=>{var w;return((w=v.a)==null?void 0:w.type)==="noul"});if(l.size!==1||u.length<2)return s.jsx(WN,{kind:"parallel",meta:{decision:!1}});const f=u.map(v=>v.a.noul),p=f.reduce((v,w)=>v+w,0)/f.length,h=Math.max(...f)-Math.min(...f),b=v=>{var w;return((w=e.graph.nodes.find(j=>j.path===v.node))==null?void 0:w.label)??v.node};return s.jsxs("section",{className:"border bg-card",children:[s.jsxs("header",{className:"border-b px-4 py-2.5",children:[s.jsxs("p",{className:"caps text-micro text-muted-foreground",children:["Jury · ",u.length," models · ",c]}),s.jsx("p",{className:"mt-1 text-body leading-snug",children:((m=(x=i[0].questions)==null?void 0:x[c])==null?void 0:m.instructions)??c})]}),s.jsx("ul",{className:"divide-y",children:u.map(({d:v,a:w})=>s.jsx("li",{children:s.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-2 text-left font-mono text-small hover:bg-accent",onClick:()=>n({path:v.node,item:null}),children:[s.jsx("span",{className:"w-[92px] shrink-0",children:s.jsx(Dg,{provider:v.provider})}),s.jsx("span",{className:"w-[132px] shrink-0 truncate",title:v.model??"",children:v.model??b(v)}),s.jsx(fh,{p:w.noul,strong:!0,tick:.5,tone:w.noul>=.5?"fg":"muted"}),s.jsx("span",{className:"w-10 text-right tabular-nums",children:ws(w.noul)})]})},v.id??v.executionPath))}),s.jsxs("dl",{className:"grid grid-cols-3 border-t font-mono text-small",children:[s.jsxs("div",{className:"border-r px-4 py-2",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:"Mean P(yes)"}),s.jsx("dd",{className:"font-semibold tabular-nums",children:ws(p)})]}),s.jsxs("div",{className:"border-r px-4 py-2",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:"Spread"}),s.jsx("dd",{className:oe("font-semibold tabular-nums",h>.3&&"text-warning-text"),children:ws(h)})]}),s.jsxs("div",{className:"px-4 py-2",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:"Cost"}),s.jsx("dd",{className:"tabular-nums",children:si(u.some(v=>v.d.cost_usd===null)?null:u.reduce((v,w)=>v+(w.d.cost_usd??0),0))})]})]})]})}function lz({data:e,mapPath:t,index:n,status:o,fileUrl:i,zoom:l}){const u=e.graph.nodes.filter(f=>f.path.startsWith(`${t}/body`)).map(f=>({n:f,ds:e.decisions.filter(p=>p.node===f.path&&p.item===n),es:e.effects.filter(p=>p.node===f.path&&p.item===n)})).filter(f=>!FN.has(f.n.kind)||f.ds.length||f.es.length);return o==="pending"?s.jsx("p",{className:"border border-dashed px-4 py-3 text-body text-muted-foreground",children:"Not started: this item waits for a free slot in the map."}):s.jsxs("div",{className:"space-y-5",children:[u.map(({n:f,ds:p,es:h})=>p.length||h.length?s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:f.label}),h.map((b,x)=>s.jsx(qN,{e:b,fileUrl:i,zoom:l,compact:!0},x)),p.map((b,x)=>s.jsx(HN,{d:b,fileUrl:i,zoom:l},b.id??x))]},f.path):null),o==="working"&&!u.some(f=>f.ds.length)&&s.jsx("p",{className:"border border-dashed px-4 py-3 text-body text-muted-foreground",children:"In flight: the verdict shows here when it comes back."})]})}const qw=e=>`${Math.round(e*100)}%`,ws=e=>e.toFixed(2);function fh({p:e,strong:t,tick:n,tone:o="fg"}){const i={fg:"bg-foreground",success:"bg-success",warning:"bg-warning",muted:"bg-muted-foreground/50"}[o];return s.jsxs("span",{className:"relative block h-2 flex-1 bg-muted",children:[s.jsx("span",{className:oe("absolute inset-y-0 left-0 transition-[width] duration-slow",t?i:"bg-muted-foreground/45"),style:{width:qw(Math.max(0,Math.min(1,e)))}}),n!==void 0&&s.jsx("span",{className:"absolute -inset-y-1 w-px bg-primary",style:{left:qw(n)},title:`threshold ${ws(n)}`})]})}function cz({id:e,q:t,a:n,rule:o}){const i=u=>{var f;return(o==null?void 0:o.kind)==="pick"&&(t==null?void 0:t.type)==="choice"&&typeof((f=t.criteria)==null?void 0:f[u])=="string"?t.criteria[u]:u},l=(t==null?void 0:t.instructions)??e,c=(o==null?void 0:o.kind)==="route"?o.unsure:null;return s.jsxs("div",{className:"py-2.5",children:[s.jsxs("p",{className:"mb-2 text-body leading-snug",children:[s.jsx("span",{className:"mr-2 font-mono text-label text-muted-foreground",children:e}),l]}),n?n.type==="refusal"?s.jsx("p",{className:"font-mono text-small text-warning-text",children:"Refused to answer."}):n.type==="noul"?s.jsxs("div",{className:"flex items-center gap-3 font-mono text-small",children:[s.jsx("span",{className:oe("w-8 font-semibold",n.noul>=.5?"text-foreground":"text-muted-foreground"),children:n.noul>=.5?"YES":"NO"}),s.jsx(fh,{p:n.noul,strong:!0,tick:.5,tone:n.noul>=.5?"fg":"muted"}),s.jsxs("span",{className:"w-24 text-right tabular-nums text-muted-foreground",children:["P(yes) ",ws(n.noul)]})]}):n.type==="box"?s.jsxs("p",{className:"font-mono text-small",children:["box ",JSON.stringify(n.box)]}):s.jsxs("div",{className:"space-y-1.5",children:[Object.entries(n.probabilities).sort((u,f)=>f[1]-u[1]).slice(0,(o==null?void 0:o.kind)==="pick"?5:void 0).map(([u,f])=>{const p=(n.type==="choice"?n.choice:String(n.score))===u;return s.jsxs("div",{className:"flex items-center gap-3 font-mono text-small",children:[s.jsx("span",{className:oe("truncate",(o==null?void 0:o.kind)==="pick"?"w-48":"w-28",p?"font-semibold":"text-muted-foreground"),title:i(u),children:n.type==="score"?`${u} ${n.legend[u]??""}`:i(u)}),s.jsx(fh,{p:f,strong:p,tick:p&&c?c.gte:void 0}),s.jsx("span",{className:"w-12 text-right tabular-nums text-muted-foreground",children:ws(f)})]},u)}),(o==null?void 0:o.kind)==="pick"&&Object.keys(n.probabilities).length>5&&s.jsxs("p",{className:"font-mono text-label text-muted-foreground",children:[Object.keys(n.probabilities).length-5," more options, each less likely"]})]}):s.jsx("p",{className:"font-mono text-small text-muted-foreground",children:"No answer."})]})}function uz(e){if(!e)return"No rule applied: nothing came back to decide on.";switch(e.kind){case"judge":return"Each answer is decoded on its own: a yes/no is yes at P(yes) ≥ 0.50, a choice is its top option.";case"route":return e.unsure?`Take the chosen branch; below ${ws(e.unsure.gte)} confidence take "${e.unsure.branch}".`:"Take the chosen branch.";case"pick":return`Pick one of ${e.options.length} options${e.none?`, or "${e.none}"`:""}.`;case"ask":return`Holds when P(yes) ≥ ${ws(e.gte)}.`;case"sift":return e.keep?`Keep an item when its ${e.keep.id} ${e.keep.measure} ≥ ${ws(e.keep.gte)}.`:"Keep every item.";case"verify":return"A yes/no fails below its threshold."}}function dz(e){var n,o,i,l;const t=e.action;if(t==null)return e.status==="cancelled"?"None: the outcome is unknown, so it goes to review and is not asked again.":"None.";if(((n=e.rule)==null?void 0:n.kind)==="route"){const c=((i=(o=e.answers)==null?void 0:o.branch)==null?void 0:i.type)==="choice"?e.answers.branch.confidence:void 0;return t.unsure?`Took "${String(t.taken)}": "${String(t.branch)}" at ${c!==void 0?ws(c):"?"} is below the threshold.`:`Took "${String(t.taken??t.branch)}".`}if(((l=e.rule)==null?void 0:l.kind)==="pick"&&typeof t.index=="number"){const c=e.rule.options[t.index];return t.none?`None of the options: "${e.rule.none??"none"}".`:`Picked ${c!==void 0?`"${M1(e,Object.keys(e.questions??{})[0]??"pick",c)}"`:`option ${t.index}`}.`}return typeof t=="object"?Object.entries(t).map(([c,u])=>`${c} = ${typeof u=="object"?JSON.stringify(u):String(u)}`).join(" · "):String(t)}function HN({d:e,fileUrl:t,zoom:n}){var l,c,u;const o=Array.from(new Set([...Object.keys(e.questions??{}),...Object.keys(e.answers??{})])),i=e.status==="answered"?"success":e.status==="cancelled"?"warning":"error";return s.jsxs("section",{className:"border bg-card",children:[s.jsxs("header",{className:"flex flex-wrap items-center gap-2 border-b px-4 py-2.5",children:[s.jsx(Dg,{provider:e.provider}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-small",children:e.model??"default model"}),s.jsx(Me,{tone:i,children:e.status==="cancelled"?"outcome unknown":e.status})]}),s.jsxs("dl",{className:"grid grid-cols-[minmax(0,1fr)_100px_92px] border-b font-mono text-small",children:[s.jsxs("div",{className:"border-r px-4 py-2",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:Object.keys(e.answers??{}).length>1&&((l=e.rule)==null?void 0:l.kind)!=="route"?"Least sure answer":"Verdict"}),s.jsx("dd",{className:"break-words font-semibold",children:Ga(e)??"—"})]}),s.jsxs("div",{className:"border-r px-4 py-2",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:"Cost"}),s.jsx("dd",{className:"tabular-nums",title:e.cost_basis??void 0,children:si(e.cost_usd)})]}),s.jsxs("div",{className:"px-4 py-2",children:[s.jsx("dt",{className:"caps text-micro text-muted-foreground",children:"Latency"}),s.jsx("dd",{className:"tabular-nums",children:Pa(e.latency_ms)})]})]}),e.error&&s.jsx("p",{className:oe("border-b px-4 py-2.5 font-mono text-small",e.status==="cancelled"?"text-warning-text":"text-destructive-text"),children:e.error}),!!((c=e.images)!=null&&c.length)&&s.jsx("div",{className:"space-y-3 border-b px-4 py-3",children:e.images.map(f=>({img:f,src:f.ref&&t(f.ref)||Lo(f.url)})).filter(({src:f})=>f).map(({img:f,src:p})=>s.jsxs("figure",{className:"flex gap-3",children:[s.jsx("button",{type:"button",className:"block shrink-0 border bg-white hover:border-foreground",onClick:()=>n(p),"aria-label":`Open ${f.ref}`,children:s.jsx("img",{src:p,alt:`The page the model saw as ${f.token}`,className:"block h-[155px] w-[120px] object-cover object-top",loading:"lazy"})}),s.jsxs("figcaption",{className:"min-w-0 flex-1 space-y-1.5 font-mono text-label",children:[s.jsx("p",{className:"caps text-micro text-muted-foreground",children:"What the model saw"}),s.jsxs("p",{children:[s.jsx("span",{className:"text-muted-foreground",children:"token "}),f.token]}),s.jsxs("p",{className:"break-all",children:[s.jsx("span",{className:"text-muted-foreground",children:"page "}),f.ref]}),f.sha256&&s.jsxs("p",{className:"break-all",title:f.sha256,children:[s.jsx("span",{className:"text-muted-foreground",children:"sha256 "}),f.sha256.slice(0,16),"…"]}),(f.mime||f.bytes)&&s.jsx("p",{className:"text-muted-foreground",children:[f.mime,f.bytes?`${Math.round(f.bytes/1024)} KB`:null].filter(Boolean).join(" · ")})]})]},f.token))}),s.jsx("div",{className:"divide-y px-4",children:o.map(f=>{var p,h;return s.jsx(cz,{id:f,q:(p=e.questions)==null?void 0:p[f],a:(h=e.answers)==null?void 0:h[f],rule:e.rule},f)})}),s.jsxs("dl",{className:"space-y-2 border-t px-4 py-3 text-body",children:[s.jsxs("div",{className:"flex gap-3",children:[s.jsx("dt",{className:"caps w-14 shrink-0 pt-0.5 text-micro text-muted-foreground",children:"Rule"}),s.jsx("dd",{children:uz(e.rule)})]}),s.jsxs("div",{className:"flex gap-3",children:[s.jsx("dt",{className:"caps w-14 shrink-0 pt-0.5 text-micro text-muted-foreground",children:"Action"}),s.jsx("dd",{className:"font-mono text-small",children:dz(e)})]})]}),!!((u=e.evidence)!=null&&u.length)&&s.jsx(fz,{evidence:e.evidence}),e.state!=null&&s.jsxs("details",{className:"group border-t",children:[s.jsxs("summary",{className:"caps flex cursor-pointer list-none items-center gap-1.5 px-4 py-2.5 text-label text-muted-foreground hover:text-foreground",children:[s.jsx(Us,{className:"size-3 transition-transform group-open:rotate-90","aria-hidden":!0})," What the model saw",e.state_truncated?" (cut at 64 KB)":""]}),s.jsx(fd,{value:e.state})]})]})}function fz({evidence:e}){return s.jsxs("section",{className:"border-t px-4 py-3",children:[s.jsxs("p",{className:"caps mb-2 text-micro text-muted-foreground",children:["Sources · ",e.length]}),s.jsx("ol",{className:"space-y-3",children:e.map((t,n)=>{let o=t.url;try{o=new URL(t.url).host}catch{}const i=Lo(t.url);return s.jsxs("li",{className:"flex gap-3",children:[s.jsx("span",{className:"font-mono text-label text-muted-foreground",children:n+1}),s.jsxs("div",{className:"min-w-0 flex-1",children:[i?s.jsxs("a",{href:i,target:"_blank",rel:"noreferrer noopener",className:"inline-flex items-start gap-1 text-body font-semibold leading-snug hover:underline",children:[t.title??o,s.jsx(o_,{className:"mt-0.5 size-3 shrink-0 text-muted-foreground","aria-hidden":!0})]}):s.jsx("span",{className:"break-all text-body font-semibold leading-snug",children:t.title??o}),s.jsxs("p",{className:"mt-0.5 flex items-center gap-2 font-mono text-label text-muted-foreground",children:[o,t.scope&&s.jsx("span",{className:"border px-1",children:t.scope})]}),t.excerpts.slice(0,2).map((l,c)=>s.jsx("blockquote",{className:"mt-1.5 line-clamp-3 border-l-2 border-wf-parallel/[.6] pl-2.5 text-body leading-snug text-muted-foreground",children:l},c))]})]},n)})})]})}const BN=e=>{const t=Xl(e);return t?`${t.tool} on ${t.server}`:e},GN=()=>s.jsx(Me,{tone:"muted",title:"An MCP server's tool",children:s.jsx("span",{"data-mcp":!0,children:"MCP"})});function qN({e,fileUrl:t,zoom:n,compact:o=!1}){var h;const i=e.output,l=i!=null,c=i&&typeof i=="object"?i:null,u=!e.endedAt&&!["done","ok","failed","stopped"].includes(e.status),f=e.error??(c!=null&&c.error?`${c.error.code?`${c.error.code}: `:""}${c.error.message??""}`:null),p=e.status==="done"||e.status==="ok"?"success":e.status==="failed"?"error":e.status==="stopped"?"muted":"active";return s.jsxs("section",{className:"border bg-card",children:[s.jsxs("header",{className:"flex items-center gap-2 border-b px-4 py-2.5",children:[s.jsx("span",{className:"caps inline-flex h-5 items-center border border-wf-tool/[.6] bg-wf-tool/[.12] px-1.5 text-micro leading-none text-wf-tool",children:"tool"}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-small",title:e.tool,children:BN(e.tool)}),Xl(e.tool)&&s.jsx(GN,{}),s.jsx("span",{className:"font-mono text-label tabular-nums text-muted-foreground",children:e.endedAt?Pa(Fg(e.startedAt,e.endedAt)):""}),s.jsx(Me,{tone:p,children:e.status})]}),s.jsxs("div",{className:"space-y-3 px-4 py-3",children:[o?s.jsxs("p",{className:"break-all font-mono text-label",children:[s.jsx("span",{className:"caps mr-2 text-micro text-muted-foreground",children:"Input"}),JSON.stringify(e.input)]}):s.jsxs("div",{children:[s.jsx("p",{className:"caps mb-1 text-micro text-muted-foreground",children:"Input"}),s.jsx(fd,{value:e.input,small:!0})]}),f&&s.jsx("p",{className:"font-mono text-small text-destructive-text",children:f}),!!((h=c==null?void 0:c.pages)!=null&&h.length)&&s.jsx("div",{className:"flex flex-wrap gap-3",children:c.pages.map(b=>s.jsx("button",{type:"button",className:"block border bg-white hover:border-foreground",onClick:()=>n(t(b.image)),"aria-label":`Open page ${b.page}`,children:s.jsx("img",{src:t(b.image),alt:`Page ${b.page}`,className:"block h-[124px] w-[96px] object-cover object-top",loading:"lazy"})},b.page))}),l&&!f&&s.jsxs("details",{className:"group",children:[s.jsxs("summary",{className:"caps flex cursor-pointer list-none items-center gap-1.5 text-micro text-muted-foreground hover:text-foreground",children:[s.jsx(Us,{className:"size-3 transition-transform group-open:rotate-90","aria-hidden":!0})," Output"]}),s.jsx(fd,{value:i,small:!0})]}),!l&&!f&&s.jsx("p",{className:"font-mono text-small text-muted-foreground",children:e.status==="stopped"?"Stopped before it answered.":u?"Running…":"Finished with no output."})]})]})}function mz({workflow:e,path:t,kind:n}){const o=A1(e,t);if(!o)return null;const i=Object.fromEntries(Object.entries(o).map(([l,c])=>[l,(l==="steps"||l==="branches"&&n==="parallel")&&Array.isArray(c)?`… ${wg(c.length)}`:l==="body"?"… its body":l==="branches"&&n==="route"&&c&&typeof c=="object"?Object.fromEntries(Object.entries(c).map(([u,f])=>[u,(f==null?void 0:f.criteria)??"…"])):c]));return s.jsxs("details",{className:"group border",children:[s.jsxs("summary",{className:"caps flex cursor-pointer list-none items-center gap-1.5 px-4 py-2.5 text-label text-muted-foreground hover:text-foreground",children:[s.jsx(Us,{className:"size-3 transition-transform group-open:rotate-90","aria-hidden":!0})," Definition ",s.jsx("span",{className:"normal-case tracking-normal",children:t})]}),s.jsx(fd,{value:i})]})}function fd({value:e,small:t}){return s.jsx("pre",{className:oe("overflow-auto whitespace-pre-wrap break-words border-t bg-background px-4 py-3 font-mono leading-[1.6]",t?"max-h-48 border text-label":"max-h-80 text-small"),children:JSON.stringify(e,null,2)})}function pz({src:e,onClose:t}){return s.jsx(ig,{open:!0,onClose:t,title:"Page image",size:"full",children:s.jsx("img",{src:e,alt:"Page",className:"mx-auto max-h-full max-w-full border bg-white"})})}const VN=e=>[400,401,403,404,405,410,422].includes((e==null?void 0:e.status)??0);function hz(e,{everyMs:t=1e3,key:n="",enabled:o=!0}={}){const[i,l]=y.useState(null),[c,u]=y.useState(null),[f,p]=y.useState(0),[h,b]=y.useState(0),x=y.useRef(e);return x.current=e,y.useEffect(()=>{if(!o)return;const m=new AbortController;let v;const w=async()=>{try{const j=Date.now(),S=await x.current(m.signal);if(m.signal.aborted||(l(S),u(null),p(j),Bl(S.run.status)))return}catch(j){if(m.signal.aborted)return;u(j);const S=j;if(S.retryable){v=setTimeout(w,Math.min(t,S.retryAfterMs??500));return}if(VN(j))return}v=setTimeout(w,t)};return w(),()=>{m.abort(),clearTimeout(v)}},[n,t,h,o]),{data:i,error:c,readAt:f,reload:()=>b(m=>m+1)}}function gz({data:e,actions:t={},fileUrl:n,initial:o=null,lastRead:i}){const[l,c]=y.useState(o),u=y.useMemo(()=>j4(e,l),[e,l]),f=Bl(e.run.status),[p,h]=y.useState(()=>Date.now()),b=y.useMemo(()=>Date.now(),[e]);return y.useEffect(()=>{if(f||e.run.paused)return;const x=setInterval(()=>h(Date.now()),1e3);return()=>clearInterval(x)},[f,e.run.paused]),s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsx(xz,{data:e,readAt:b,now:p,actions:t,stale:!f&&i&&p-i>5e3?Math.max(1e3,p-i):0}),e.run.paused&&s.jsx("p",{className:"border-b border-warning/40 bg-warning/10 px-5 py-2 font-mono text-small text-warning-text md:px-8",role:"status",children:"Paused. Calls already in flight finish; no new node starts until you resume. The run keeps its place across a restart."}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col lg:flex-row",children:[s.jsx("div",{className:"min-h-[320px] min-w-0 flex-1 overflow-auto bg-[radial-gradient(hsl(var(--border))_1px,transparent_1px)] [background-size:22px_22px]",children:s.jsx("div",{className:"px-5 py-6 md:px-8",children:s.jsx(qd,{graph:e.graph,marks:u,onSelect:x=>c(m=>m&&m.path===x.path&&(m.item??null)===x.item?null:x),label:"The run's workflow graph"})})}),l&&s.jsx("div",{className:"flex min-h-0 shrink-0 flex-col border-t lg:w-[460px] lg:border-l lg:border-t-0",children:s.jsx(rz,{data:e,selected:l,onSelect:c,onClose:()=>c(null),fileUrl:n})})]}),s.jsx("div",{className:"border-t px-5 py-2 md:px-8",children:s.jsx(Vd,{run:!0})})]})}function xz({data:e,readAt:t,now:n,actions:o,stale:i}){const l=Bl(e.run.status),c=e.graph.nodes.find(b=>{var x,m;return b.kind==="map"&&((m=(x=e.nodes[b.path])==null?void 0:x.items)==null?void 0:m.length)}),u=c?L1(e.nodes[c.path].items):null,{usd:f,unknown:p}=I1(e),h=[["Elapsed",qa(_4(e,t,n))],["Cost",s.jsxs(s.Fragment,{children:[si(f),p>0&&s.jsxs("span",{className:"text-label font-normal text-muted-foreground",children:[" + ",p," unknown"]})]}),"Decisions and model calls, as the providers priced them"],["Decisions",e.totals.decisions],["Tool calls",e.totals.effects],["Agents",vz(e),"Agent loops this run started. Decision models and tools answer one call each; none of them is an agent."]];return u&&h.push(["Items",s.jsxs(s.Fragment,{children:[s.jsx("span",{children:u.done}),s.jsxs("span",{className:"text-muted-foreground",children:["/",u.total]}),u.failed>0&&s.jsxs("span",{className:"ml-2 text-label text-destructive-text",children:[u.failed," failed"]}),u.review>0&&s.jsxs("span",{className:"ml-2 text-label text-warning-text",children:[u.review," review"]})]})]),s.jsxs("div",{className:"flex flex-wrap items-stretch border-b",children:[e.run.paused&&s.jsx("div",{className:"flex items-center pl-5 md:pl-8",children:s.jsxs(Me,{tone:"warning",children:[s.jsx(ml,{className:"size-3","aria-hidden":!0})," Paused"]})}),h.map(([b,x,m],v)=>s.jsxs("div",{className:oe("px-4 py-2",v?"border-l":"pl-5 md:pl-8"),title:m,children:[s.jsx("p",{className:"caps text-micro text-muted-foreground",children:b}),s.jsx("p",{className:"font-mono text-prose font-semibold tabular-nums",children:x})]},b)),s.jsxs("div",{className:"flex flex-1 items-center justify-end gap-3 px-5 py-2 md:px-8",children:[i>0&&s.jsxs("span",{className:"font-mono text-label text-muted-foreground",role:"status",children:["Last read ",qa(i)," ago, reading again"]}),!l&&(e.run.paused?s.jsxs(Z,{size:"sm",variant:"solid",onClick:o.onResume,disabled:!o.onResume||!!o.busy,children:[s.jsx(Pl,{"aria-hidden":!0})," ",o.busy==="resume"?"Resuming":"Resume"]}):s.jsxs(Z,{size:"sm",onClick:o.onPause,disabled:!o.onPause||!!o.busy,title:"Calls in flight finish; no new node starts.",children:[s.jsx(ml,{"aria-hidden":!0})," ",o.busy==="pause"?"Pausing":"Pause"]}))]})]})}const yz=new Set(["agent","decide","extract","report","artifact"]),vz=e=>e.graph.nodes.filter(t=>{var n;return yz.has(t.kind)&&!["pending","not_run"].includes(((n=e.nodes[t.path])==null?void 0:n.status)??"pending")}).length;function bz({error:e}){const t=e==null?void 0:e.status;return s.jsx("p",{className:oe("m-8 border p-4 font-mono text-body",t===404?"text-muted-foreground":"text-destructive-text"),role:"status",children:e==null?"Reading the run's graph...":t===404?"This server does not give run graphs: GET /v2/runs/{id}/graph is not there.":`The run's graph could not be read: ${e.message??String(e)}`})}function wz(e,t){return!t||e.state==="loading"?{messages:ql,steers:!1}:e.state==="failed"?{messages:t.features.messages,steers:!1}:{messages:t.features.messages,steers:RA(e.id,t.harnesses)}}async function kz(e,t){try{let n=null;do{const o=await e.listRevisions(t.agent_id,n),i=o.revisions.find(l=>l.revision===t.revision);if(i)return{state:"read",id:i.definition.harness};n=o.next_cursor}while(n)}catch{}return{state:"failed"}}const Vw=new Set(["completed","failed","cancelled"]),jz=e=>{const t=I1(e);return`${si(t.usd)}${t.unknown?` + ${t.unknown} unknown`:""}`},Nz=e=>e instanceof Ee?e.toApiError():{code:"network",message:e instanceof Error?e.message:String(e),retryable:!0},Sa=e=>({api:Nz(e),title:$M(e),cause:e});function Kw({v2:e,runId:t,caps:n,agentName:o}){const[i,l]=y.useState(null),[c,u]=y.useState(null),[f,p]=y.useState([]),[h,b]=y.useState([]),[x,m]=y.useState(null),[v,w]=y.useState(null),[j,S]=y.useState(0),T=y.useRef(""),$=y.useRef(Ku()).current,_=y.useRef(Ku()).current,E=y.useRef(Ws()).current,R=y.useRef(0),C=y.useRef(""),[O,z]=y.useState({state:"loading"});y.useEffect(()=>{i&&O.state==="loading"&&kz(e,i).then(z)},[i==null?void 0:i.revision]);const F=wz(O,n);mj(i,()=>D(),()=>S(P=>P+1));const D=async()=>{const P=$.begin();try{const[q,ne]=await Promise.all([e.getRun(t),e.listFiles(t)]);$.current(P)&&(l(q),b(ne.files))}catch(q){$.current(P)&&m(Sa(q))}};y.useEffect(()=>{D()},[t]),iN(()=>{D()}),y.useEffect(()=>{const P=new AbortController;return u(null),rg(e,t,{signal:P.signal,onRows:q=>{p(q);const ne=q.filter(ie=>ie.kind===RN).map(ie=>`${ie.id}\0${ie.summary}`).join("");ne!==C.current&&(C.current=ne,D());const ae=q.filter(ie=>ie.kind==="tool_result").length;if(ae>R.current){R.current=ae;const ie=_.begin();e.listFiles(t).then(ce=>{_.current(ie)&&b(ce.files)}).catch(()=>{})}},onPage:q=>{q.cost&&u(q.cost);const ne=`${q.status}/${q.state}`;(ne!==T.current||q.status==="input_required"&&!q.unchanged)&&(T.current=ne,D())}}).catch(q=>{P.signal.aborted||m(Sa(q))}),()=>P.abort()},[t,j]);const B=async P=>{w(P);try{await e[P](t),m(null)}catch(q){m(Sa(q))}w(null),await D(),S(q=>q+1)},U=async()=>{if(i){w("archive");try{const P=await(i.archived_at?e.unarchiveRun(t):e.archiveRun(t));l(q=>q?{...q,archived_at:P.archived_at}:P),m(null)}catch(P){m(Sa(P))}w(null),D()}},W=async P=>{const q=await e.raiseCap(t,P);return await D(),S(ne=>ne+1),q},X=async P=>{let q=!0;try{await jj(E,t,P,e.sendMessage),m(null)}catch(ne){m(Sa(ne)),q=!1}return await D(),S(ne=>ne+1),q},M=async(P,q,ne)=>{let ae=null;try{await e.answerApproval(t,P,q,ne)}catch(ie){ae=AN(ie)}return await D(),S(ie=>ie+1),ae},K=async P=>{try{return await P()}finally{await D(),S(q=>q+1)}},L=hz(P=>e.getRunGraph(t,P),{key:t,enabled:(i==null?void 0:i.kind)==="workflow"}),I=!L.data&&VN(L.error);if(!i)return x?x.cause instanceof Ee&&x.cause.status===404?s.jsx(pj,{what:"run",id:t,list:{href:"#/runs",label:"Open the runs list"}}):s.jsx($n,{problem:mn(x.cause,"the run"),onRetry:()=>{m(null),D(),S(P=>P+1)}}):s.jsx(ZO,{});const G=c&&!Vw.has(i.status)?{...i,cost:c}:i;return s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[x&&s.jsx("div",{className:"border-b p-3",children:s.jsx(Xo,{title:x.title,error:x.api})}),s.jsx(tz,{run:G,agentName:o(i.agent_id),messages:F.messages,harnessSteers:F.steers,graphView:i.kind==="workflow"&&!I?s.jsx(Sz,{v2:e,runId:t,graph:L,onMoved:()=>{D()}}):void 0,costText:i.kind==="workflow"&&!Vw.has(i.status)&&L.data?jz(L.data):void 0,rows:f,files:h,readFile:P=>e.readFile(t,P.path),readLearningDiff:()=>e.runLearningDiff(t),readLearning:()=>e.runLearning(t),readComputer:()=>e.runComputer(t),onTakeOver:()=>K(()=>e.takeOverComputer(t)),onHandBack:P=>K(()=>e.handBackComputer(t,P)),readComputers:()=>e.computers(),onMessage:X,onApprove:M,actions:{onStop:()=>void B("stop"),onCancel:()=>void B("cancel"),onArchive:()=>void U(),onRaiseCap:W,busy:v}},i.run_id)]})}function Sz({v2:e,runId:t,graph:n,onMoved:o}){const{data:i,error:l,readAt:c,reload:u}=n,[f,p]=y.useState(null),[h,b]=y.useState(null),[x,m]=y.useState(null),v=async j=>{p(j);try{const S=await(j==="pause"?e.pauseRun(t):e.resumeRun(t));m({paused:S.paused,status:S.status,at:Date.now()}),b(null)}catch(S){b(Sa(S))}p(null),u(),o()},w=i&&x&&c<x.at?{...i,run:{...i.run,paused:x.paused,...x.status?{status:x.status}:{}}}:i;return w?s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[h&&s.jsx("div",{className:"border-b p-3",children:s.jsx(Xo,{title:h.title,error:h.api})}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(gz,{data:w,lastRead:c,fileUrl:j=>e.fileUrl(t,j),actions:{onPause:()=>void v("pause"),onResume:()=>void v("resume"),busy:f}})})]}):s.jsx(bz,{error:l})}function _z({view:e,error:t,onRetry:n,scope:o,needsYou:i,asking:l,startHere:c}){if(t)return s.jsx($n,{problem:t,onRetry:n});if(!e)return s.jsx(QO,{});if(c)return s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1600px] space-y-6 px-6 py-8",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Mission Control"}),c]})});const u=h=>{var b;return((b=e.perAgent.find(x=>x.agentId===h))==null?void 0:b.name)??h},f=o!=null&&o.agent?e.perAgent.filter(h=>h.agentId===o.agent):e.perAgent,p=[["Agents",String(e.agents),"#/agents"],["Runs",String(e.runs.total),"#/runs"],["Active",String(e.runs.active),void 0,void 0,e.runs.statusUnknown?`${e.runs.statusUnknown} unknown`:void 0],["Needs input",l===null?"–":String(l??e.runs.needsInput),"#/runs?status=input_required",l??e.runs.needsInput?"text-warning-text":void 0],["Failed",String(e.runs.failed),"#/runs?status=failed",e.runs.failed?"text-destructive-text":void 0,e.runs.needsReview?`${e.runs.needsReview} ${e.runs.needsReview===1?"needs":"need"} review`:void 0]];return s.jsx("div",{className:"h-full overflow-auto",children:s.jsxs("div",{className:"mx-auto max-w-[1600px] space-y-8 px-6 py-8",children:[s.jsx("h1",{className:"text-2xl font-semibold",children:"Mission Control"}),i,s.jsx("ul",{className:"grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5",children:p.map(([h,b,x,m,v])=>{const w=s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"caps text-label text-muted-foreground",children:h}),s.jsx("p",{className:oe("mt-2 font-mono text-xl font-semibold",m),children:b}),v&&s.jsx("p",{className:"mt-1 font-mono text-label text-muted-foreground",children:v})]});return s.jsx("li",{children:x?s.jsx("a",{href:x,className:"block h-full border p-4 hover:border-border-strong hover:bg-accent",children:w}):s.jsx("div",{className:"h-full border p-4",children:w})},h)})}),s.jsxs("section",{className:"space-y-4","aria-label":"Analytics",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-x-6 gap-y-3",children:[s.jsx("h2",{className:"text-lg font-semibold",children:$z(e)}),o&&s.jsx($1,{range:o.range,onRange:o.onRange,agent:o.agent,agents:e.perAgent,onAgent:o.onAgent})]}),s.jsx(E1,{a:e.analytics,basis:e.cost.basis,refreshing:o==null?void 0:o.refreshing})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]",children:[s.jsxs("section",{className:"border",children:[s.jsx("h2",{className:"caps border-b px-4 py-3 text-small font-semibold",children:"Runs per agent"}),f.length?s.jsx("ul",{children:f.map(h=>s.jsx("li",{className:"border-b last:border-b-0",children:s.jsxs("a",{href:zs(h.agentId,"runs"),className:"flex items-center justify-between gap-3 px-4 py-3 text-lead hover:bg-accent",children:[s.jsx("span",{className:"min-w-0 truncate",children:h.name}),s.jsx("span",{className:"font-mono text-body text-muted-foreground",children:h.runs})]})},h.agentId))}):s.jsx("p",{className:"px-4 py-6 text-center font-mono text-body text-muted-foreground",children:"No agents yet."})]}),s.jsxs("section",{className:"border",children:[s.jsx("h2",{className:"caps border-b px-4 py-3 text-small font-semibold",children:"Recent runs"}),e.recent.length?s.jsx("ul",{children:e.recent.map(h=>s.jsx("li",{className:"border-b last:border-b-0",children:s.jsxs("a",{href:`#/runs/${encodeURIComponent(h.run_id)}`,className:"flex items-center gap-3 px-4 py-3 hover:bg-accent",children:[s.jsx(Kl,{run:h}),s.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[s.jsx("span",{className:"min-w-0 truncate text-lead",children:rn(h)}),s.jsx(Ud,{run:h,className:"hidden sm:inline-flex"}),xP(h)&&s.jsx("span",{className:"shrink-0 text-small text-muted-foreground",children:"send a message to continue"})]}),s.jsx("span",{className:"hidden shrink-0 text-body text-muted-foreground md:inline",children:u(h.agent_id)}),h.ended_at&&s.jsx("span",{className:"hidden font-mono text-small text-muted-foreground sm:inline",title:"How long it ran",children:qa(Date.parse(h.ended_at)-Date.parse(h.created_at))}),h.cost&&(h.cost.usd!==null||ni(h.cost))&&s.jsx("span",{className:"hidden font-mono text-small text-muted-foreground sm:inline",children:oo(h.cost,{ended:kl(h.status)})}),s.jsx("span",{className:"hidden font-mono text-small text-muted-foreground sm:inline",children:St(h.created_at)})]})},h.run_id))}):s.jsx("p",{className:"px-4 py-6 text-center font-mono text-body text-muted-foreground",children:"No runs yet."})]})]})]})})}function $z(e,t=Date.now()){var l;const n=e.analytics.filter,o=n.from?Math.round((Math.floor(t/864e5)*864e5-Date.parse(n.from))/864e5)+1:null,i=n.from?tg.some(c=>c.days===o)?`Runs started in the last ${o} days`:`Runs started since ${n.from.slice(0,10)}`:"All runs";return n.agent?`${i}, of ${((l=e.perAgent.find(c=>c.agentId===n.agent))==null?void 0:l.name)??n.agent}`:i}const Fs=e=>`#/runs/${encodeURIComponent(e)}`;function Ez({asking:e,failed:t,live:n,learning:o=[],agentName:i,onAnswer:l,onApprove:c,onHandBack:u,onRunAgain:f,onStop:p,problem:h,now:b=Date.now}){const x=fP(t),[,m]=y.useState(0);y.useEffect(()=>{if(!n.length)return;const z=setInterval(()=>m(F=>F+1),1e3);return()=>clearInterval(z)},[n.length]);const[v,w]=y.useState([]),j=(z,F,D)=>{const B=e.find(W=>W.run_id===z),U=B?rn(B):z;w(W=>[...W.filter(X=>X.runId!==z),...D?[{runId:z,what:F,title:U,text:D}]:[]])},S=c&&(async(z,F,D,B)=>{const U=await c(z,F,D,B);return j(z,F,U),U}),T=u&&(async(z,F,D)=>{const B=await u(z,D);return j(z,`ask:${F.asked_at}`,B),B}),$=z=>{var D;const F=Ta(z);return((D=z.pending)==null?void 0:D.kind)==="approval"?z.pending.id:F?`ask:${F.asked_at}`:null},_=x.reduce((z,F)=>z+F.runs.length,0),E=o.filter(z=>z.pending>0),R=E.reduce((z,F)=>z+F.pending,0),C=e.length+_+R;if(!C&&!n.length&&!h&&!v.length)return null;const O=b();return s.jsxs("section",{"aria-label":"Needs you",className:"space-y-3",children:[C>0&&s.jsxs("h2",{className:"caps text-small font-semibold",children:["Needs you ",s.jsxs("span",{className:"text-warning-text",children:["· ",C]})]}),h&&s.jsx("p",{className:"border border-destructive/50 px-4 py-2.5 font-mono text-small text-destructive-text",role:"alert",children:h}),v.filter(z=>!e.some(F=>F.run_id===z.runId&&$(F)===z.what)).map(z=>s.jsxs("p",{className:"flex items-start gap-3 border border-destructive/50 px-4 py-2.5 font-mono text-small text-destructive-text",role:"alert",children:[s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("a",{href:Fs(z.runId),className:"underline-offset-4 hover:underline",children:z.title}),": your answer wasn't taken. ",z.text]}),s.jsx("button",{type:"button",className:"caps shrink-0 text-label text-muted-foreground hover:text-foreground",onClick:()=>w(F=>F.filter(D=>D.runId!==z.runId)),children:"Dismiss"})]},z.runId)),e.length>0&&s.jsx("ul",{className:"grid grid-cols-1 gap-3 xl:grid-cols-2",children:e.map(z=>{var F,D,B;return((F=z.pending)==null?void 0:F.kind)==="approval"?s.jsx(Tz,{run:z,pending:z.pending,agentName:i(z.agent_id),at:O,onApprove:S},`${z.run_id}:${z.pending.id}`):Ta(z)?s.jsx(Cz,{run:z,ask:Ta(z),agentName:i(z.agent_id),at:O,onHandBack:T},`${z.run_id}:${Ta(z).asked_at}`):s.jsx(Rz,{run:z,agentName:i(z.agent_id),at:O,onAnswer:l},`${z.run_id}:${((D=z.pending)==null?void 0:D.kind)==="question"?z.pending.asked_at:((B=z.pending)==null?void 0:B.kind)==="budget"?z.pending.at??"":""}`)})}),x.length>0&&s.jsxs("div",{className:"border",children:[s.jsxs("p",{className:"caps flex items-center justify-between border-b px-4 py-2.5 text-label text-muted-foreground",children:[s.jsxs("span",{children:["Failed · ",_]}),s.jsx("a",{href:"#/runs?status=failed",className:"normal-case tracking-normal hover:text-foreground",children:"All failed runs →"})]}),s.jsx("ul",{children:x.map(z=>s.jsx(Mz,{message:z.message,runs:z.runs,agentName:i,at:O,onRunAgain:f},z.message))})]}),E.length>0&&s.jsxs("div",{className:"border",children:[s.jsxs("p",{className:"caps border-b px-4 py-2.5 text-label text-muted-foreground",children:["Learned, waiting for your OK · ",R]}),s.jsx("ul",{children:E.map(z=>s.jsxs("li",{className:"flex min-w-0 items-center gap-3 border-b px-4 py-3 last:border-b-0",children:[s.jsx("span",{className:"size-2 shrink-0 bg-warning","aria-hidden":!0}),s.jsx("span",{className:"shrink-0 font-mono text-small",children:z.name}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-body text-muted-foreground",children:ug(z.pending)}),s.jsx("a",{href:`#/agents/${encodeURIComponent(z.agent_id)}/learning`,className:"caps shrink-0 text-label text-muted-foreground hover:text-foreground",children:"Review →"})]},z.agent_id))})]}),n.length>0&&s.jsxs("div",{className:"border",children:[s.jsxs("p",{className:"caps border-b px-4 py-2.5 text-label text-muted-foreground",children:["Running now · ",n.length]}),s.jsx("ul",{children:n.map(z=>s.jsx(Pz,{run:z,agentName:i(z.agent_id),at:O,onStop:p},z.run_id))})]})]})}function Tz({run:e,pending:t,agentName:n,at:o,onApprove:i}){return s.jsx("li",{"data-run":e.run_id,className:"min-w-0",children:s.jsx(ON,{compact:!0,pending:t,heading:s.jsx(Ug,{run:e,agentName:n,since:`asked ${Ql(t.requested_at,o)} ago`}),onAnswer:(l,c)=>i?i(e.run_id,t.id,l,c):Promise.resolve("Open the run to answer it.")})})}function Cz({run:e,ask:t,agentName:n,at:o,onHandBack:i}){return s.jsx("li",{"data-run":e.run_id,className:"min-w-0 border border-warning/50 bg-warning/5",children:s.jsx(DN,{compact:!0,ask:t,heading:s.jsx(Ug,{run:e,agentName:n,since:`asked ${Ql(t.asked_at,o)} ago`}),open:s.jsx("a",{href:Fs(e.run_id),className:"text-body underline underline-offset-2",children:"Open its screen"}),onAnswer:i&&(l=>i(e.run_id,t,l))})})}function Rz(e){var t;return((t=e.run.pending)==null?void 0:t.kind)==="budget"?s.jsx(Az,{run:e.run,pending:e.run.pending,agentName:e.agentName}):s.jsx(Oz,{...e})}function Az({run:e,pending:t,agentName:n}){return s.jsxs("li",{"data-run":e.run_id,className:"min-w-0 border border-warning/50 bg-warning/5 p-4",children:[s.jsxs("p",{className:"flex min-w-0 items-center gap-2 text-body",children:[s.jsx("span",{className:"size-2 shrink-0 bg-warning","aria-hidden":!0}),s.jsx("span",{className:"shrink-0 font-mono text-small",children:n}),s.jsx("a",{href:Fs(e.run_id),className:"min-w-0 truncate text-muted-foreground hover:text-foreground",children:rn(e)})]}),s.jsx("p",{className:"caps mt-2 text-label text-warning-text",children:MN(t)}),typeof t.said=="string"&&s.jsx("p",{className:"mt-1 text-prose leading-snug",children:t.said}),s.jsx("p",{className:"mt-3 font-mono text-small text-muted-foreground",children:s.jsx("a",{href:Fs(e.run_id),className:"underline-offset-4 hover:underline",children:"open the run"})})]})}function Ug({run:e,agentName:t,since:n}){return s.jsxs("p",{className:"flex min-w-0 items-center gap-2 text-body",children:[s.jsx("span",{className:"size-2 shrink-0 bg-warning","aria-hidden":!0}),s.jsx("span",{className:"shrink-0 font-mono text-small",children:t}),s.jsx("a",{href:Fs(e.run_id),className:"min-w-0 truncate text-muted-foreground hover:text-foreground",children:rn(e)}),n&&s.jsx("span",{className:"ml-auto shrink-0 font-mono text-small text-muted-foreground",children:n})]})}function Oz({run:e,agentName:t,at:n,onAnswer:o}){var j;const i=((j=e.pending)==null?void 0:j.kind)==="question"?e.pending:null,l=(i==null?void 0:i.question)??"",c=dP(l),[u,f]=y.useState(""),[p,h]=y.useState(!1),[b,x]=y.useState(null),[m,v]=y.useState(null),w=async S=>{S.preventDefault();const T=u.trim();if(!T||p)return;h(!0),x(null);const $=await o(e.run_id,T);h(!1),$?x($):v(T)};return s.jsxs("li",{"data-run":e.run_id,className:"min-w-0 border border-warning/50 bg-warning/5 p-4",children:[s.jsx(Ug,{run:e,agentName:t,since:i!=null&&i.asked_at?`asked ${Ql(i.asked_at,n)} ago`:void 0}),s.jsx("p",{className:"mt-2 text-base leading-snug",children:l}),m?s.jsxs("p",{className:"mt-3 font-mono text-body text-success-text",children:["Answered: ",m," · ",s.jsx("a",{href:Fs(e.run_id),className:"underline-offset-4 hover:underline",children:"open the run"})]}):s.jsxs("form",{onSubmit:S=>void w(S),className:"mt-3 flex flex-wrap items-center gap-2",children:[c.map(S=>s.jsx("button",{type:"button",onClick:()=>f(S),className:oe("border px-3 py-1.5 text-body hover:border-border-strong",u===S?"border-warning text-warning-text":"border-border"),children:S},S)),s.jsx(He,{value:u,onChange:S=>f(S.target.value),"aria-label":`Answer ${t}`,placeholder:c.length?"Or type an answer…":"Type an answer…",className:"h-9 min-w-[9rem] flex-1 font-sans text-lead"}),s.jsx(Z,{type:"submit",variant:"solid",size:"sm",disabled:p||!u.trim(),children:p?"Sending…":"Send"}),b&&s.jsx("p",{className:"w-full font-mono text-small text-destructive-text",role:"alert",children:b})]})]})}function Mz({message:e,runs:t,agentName:n,at:o,onRunAgain:i}){const[l,c]=y.useState(!1),[u,f]=y.useState(null),[p,h]=y.useState(new Set),b=t.filter(S=>!p.has(S.run_id)),x=t.length-b.length,m=async()=>{c(!0),f(null);const{started:S,problem:T}=await i(b);c(!1),f(T),h($=>new Set([...$,...S]))},v=x>0&&s.jsxs("span",{className:"font-mono text-small text-success-text",children:["Started again: ",x===1?"1 run":`${x} runs`]});if(!b.length)return s.jsxs("li",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-b px-4 py-3 last:border-b-0",children:[s.jsx("span",{className:"size-2 shrink-0 bg-border-strong","aria-hidden":!0}),s.jsx("p",{className:"min-w-0 flex-1 truncate font-mono text-small text-muted-foreground",children:e}),v]});const w=b[0],j=b.length===1;return s.jsxs("li",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-b px-4 py-3 last:border-b-0",children:[s.jsx("span",{className:"size-2 shrink-0 bg-destructive","aria-hidden":!0}),s.jsxs("div",{className:"min-w-0 flex-1",children:[j?s.jsxs("p",{className:"flex min-w-0 gap-3 text-lead",children:[s.jsx("span",{className:"shrink-0 font-mono text-small leading-5",children:n(w.agent_id)}),s.jsx("a",{href:Fs(w.run_id),className:"min-w-0 truncate hover:underline",children:rn(w)})]}):s.jsxs("p",{className:"text-lead",children:[b.length," runs failed ",s.jsxs("span",{className:"text-muted-foreground",children:["· ",[...new Set(b.map(S=>n(S.agent_id)))].join(", ")]})]}),s.jsx("p",{className:"mt-0.5 truncate font-mono text-small text-destructive-text",children:e}),!j&&s.jsxs("details",{className:"mt-1 text-body",children:[s.jsx("summary",{className:"cursor-pointer font-mono text-small text-muted-foreground",children:"The runs"}),s.jsx("ul",{className:"mt-1 space-y-1",children:b.map(S=>s.jsxs("li",{children:[s.jsx("a",{href:Fs(S.run_id),className:"hover:underline",children:rn(S)})," ",s.jsxs("span",{className:"font-mono text-small text-muted-foreground",children:["· ",n(S.agent_id)]})]},S.run_id))})]}),u&&s.jsx("p",{className:"mt-1 font-mono text-small text-destructive-text",role:"alert",children:u})]}),s.jsxs("span",{className:"font-mono text-small text-muted-foreground",children:[Ql(w.ended_at??w.created_at,o)," ago"]}),v,s.jsx(Z,{type:"button",size:"sm",disabled:l,onClick:()=>void m(),children:j?"Run again":"Run all again"})]})}function Pz({run:e,agentName:t,at:n,onStop:o}){var h;const[i,l]=y.useState(!1),[c,u]=y.useState(null),f=(h=e.cost)==null?void 0:h.usd,p=f===0?"nothing spent yet":typeof f=="number"?`${oo(e.cost)} so far`:ni(e.cost)?oo(e.cost):"cost not known yet";return s.jsxs("li",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 border-b px-4 py-3 last:border-b-0",children:[s.jsx("span",{className:"size-2 shrink-0 bg-run-active ring-4 ring-run-active/[0.18]","aria-hidden":!0}),s.jsx("span",{className:"shrink-0 font-mono text-small",children:t}),s.jsx("a",{href:Fs(e.run_id),className:"min-w-0 flex-1 truncate text-lead hover:underline",children:rn(e)}),s.jsxs("span",{className:"font-mono text-body text-run-active",children:["working · ",qa(n-Date.parse(e.created_at))]}),s.jsx("span",{className:"font-mono text-small text-muted-foreground",children:p}),s.jsx("a",{href:Fs(e.run_id),className:"caps inline-flex h-8 items-center border px-3 text-small hover:bg-accent",children:"Steer"}),Vl(e.status,e.state,e.kind,ql,!0,e.error,e.review).canStop?s.jsx(Z,{type:"button",size:"sm",disabled:i,onClick:async()=>{l(!0),u(await o(e.run_id)),l(!1)},children:"Stop"}):s.jsx("a",{href:Fs(e.run_id),className:"caps inline-flex h-8 items-center border px-3 text-small hover:bg-accent",children:"Open to cancel"}),c&&s.jsx("p",{className:"w-full font-mono text-small text-destructive-text",role:"alert",children:c})]})}function Lz({keyCard:e=!1}){const t="font-mono text-small text-foreground";return s.jsxs("div",{className:"border bg-background p-5",children:[s.jsxs("p",{className:"flex items-center gap-2 text-base font-semibold",children:[s.jsx(Al,{className:"size-4 text-primary-text","aria-hidden":!0}),"Add a model key"]}),s.jsx("p",{className:"mt-2 max-w-prose text-lead leading-relaxed text-muted-foreground",children:e?"Add a model key in the card above, and the templates here run in one click.":s.jsxs(s.Fragment,{children:["This server has no model to run an agent on yet. Start agentrun-serve with the model to run in its environment, ",s.jsx("span",{className:t,children:"AGENT_MODEL"}),"=provider/model-id, and that provider's key (",s.jsx("span",{className:t,children:"ANTHROPIC_API_KEY"}),", ",s.jsx("span",{className:t,children:"OPENAI_API_KEY"})," or ",s.jsx("span",{className:t,children:"OPENROUTER_API_KEY"}),"). Or name a gateway: ",s.jsx("span",{className:t,children:"AGENT_MODEL_BASE_URL"})," and ",s.jsx("span",{className:t,children:"AGENT_MODEL_API_KEY"}),", with the gateway's model in ",s.jsx("span",{className:t,children:"AGENT_MODEL"}),". Then reload this page, and the templates here run in one click."]})})]})}const Iz=[{id:"hello",name:"Hello, AgentRun",shows:"Writes a file, then answers",description:"A first agent: writes hello.md and answers in one line.",instructions:"You are a friendly first agent on this machine. Do what the person asks, briefly and plainly.",tools:["write"],input:"Write hello.md listing three things you could help me with on this machine, then answer in one line."},{id:"web",name:"Summarize a web page",shows:"Reads the web, then sums it up",description:"Reads a public web page and sums it up in three bullets.",instructions:"Read the page you are given and summarize it in three short bullets, then name the one thing worth remembering.",tools:["web_fetch"],input:"Summarize https://en.wikipedia.org/wiki/Hacker_News in three bullets."},{id:"plan",name:"Plan a task",shows:"Thinks it through, no tools",description:"Turns a goal into steps, risks and a first move.",instructions:"Turn the goal you are given into a short plan: the steps in order, the main risks, and what to do first. Keep it to one screen.",tools:[],input:"Plan a weekend launch of a small side project: the steps, the risks, and what to do first."}];function KN(e){var o;const t=["pi","claude-agent","codex"],n=e.filter(i=>i.available&&i.default_model);return n.sort((i,l)=>(t.indexOf(i.id)+1||99)-(t.indexOf(l.id)+1||99)),((o=n[0])==null?void 0:o.id)??null}function zz(e,t,n){const o=Xd(t,[...n]).filter(l=>l.available).map(l=>l.name),i=e.tools.find(l=>!o.includes(l));return i?{ok:!1,reason:`${i} can't run on this server yet`}:{ok:!0}}async function Dz(e,t,n,o=Ws()){const l=(await Qr(p=>e.listAgents({cursor:p}),p=>p.agents)).find(p=>p.definition.name===t.name&&!p.archived_at),c=(l==null?void 0:l.agent_id)??(await e.createAgent({definition:{version:1,name:t.name,description:t.description,instructions:t.instructions,harness:n,tools:t.tools,skills:[]}})).agent_id,u={input:{content:t.input}},{run:f}=await e.startRun(c,u,o.keyFor(t.name,u));return o.done(),f.run_id}const Fz={hello:Xa,web:l0,plan:u_};function Uz({harnesses:e,tools:t,onTry:n,imported:o=0,keyCard:i=!1}){const[l,c]=y.useState(null),[u,f]=y.useState(null),p=KN(e),h=async b=>{c(b.id),f(null);const x=await n(b);c(null),f(x)};return s.jsxs("section",{"aria-label":"Start here",className:"space-y-4",children:[s.jsxs("div",{className:"border border-primary/50 bg-primary/5 p-6",children:[s.jsx("p",{className:"caps text-label text-primary-text",children:"Start here"}),s.jsx("h2",{className:"mt-2 text-xl font-semibold",children:"Watch an agent work in about ten seconds"}),s.jsx("p",{className:"mt-1 text-lead text-muted-foreground",children:p?"Pick one: it makes the agent, runs it, and opens the run as it happens.":"First a model to run on; then one click makes an agent, runs it, and opens the run as it happens."}),s.jsxs("div",{className:"mt-5",children:[p?s.jsx("ul",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:Iz.map(b=>{const x=zz(b,p,t),m=Fz[b.id]??Xa;return s.jsxs("li",{className:"flex flex-col border bg-background p-4",children:[s.jsxs("p",{className:"flex items-center gap-2 text-prose font-semibold",children:[s.jsx(m,{className:"size-4 text-primary-text","aria-hidden":!0}),b.name]}),s.jsx("p",{className:"mt-1 font-mono text-label text-muted-foreground",children:b.shows}),s.jsx("p",{className:"mt-2 flex-1 text-lead leading-relaxed text-muted-foreground",children:b.description}),x.ok?s.jsx(Z,{type:"button",variant:b.id==="hello"?"solid":"outline",size:"sm",className:"mt-4 self-start",disabled:l!==null,onClick:()=>void h(b),children:l===b.id?"Starting…":"Try it"}):s.jsx("p",{className:"mt-4 font-mono text-small text-muted-foreground",children:x.reason})]},b.id)})}):s.jsx(Lz,{keyCard:i}),u&&s.jsx("p",{className:"mt-3 font-mono text-body text-destructive-text",role:"alert",children:u})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border px-5 py-4",children:[s.jsxs("p",{className:"text-lead",children:["Or ",s.jsx("a",{href:"#/agents/new",className:"text-primary-text underline-offset-4 hover:underline",children:"Create your own"}),": name it, say what it does, pick its tools."]}),o>0&&s.jsxs("p",{className:"text-lead text-muted-foreground",children:[o," imported sessions to read · ",s.jsx("a",{href:"#/runs",className:"text-primary-text underline-offset-4 hover:underline",children:"Browse them"})]})]})]})}const Wz=(e,t)=>e instanceof Ee?{status:e.status,ms:t,body:{error:{...e.toApiError(),...e.fields?{fields:e.fields}:{}}}}:{status:0,ms:t,body:{error:{code:"network",message:String(e)}}};function Hz({agents:e,revisions:t=[],efforts:n,origin:o,agentId:i,onAgent:l,onSend:c,onOpenRun:u,result:f=null,live:p,limits:h,upload:b=hj,removeUpload:x}){var We;const[m,v]=y.useState(i??((We=e[0])==null?void 0:We.agent_id)??"");y.useEffect(()=>{var fe;i&&i!==m&&e.some(Re=>Re.agent_id===i)?v(i):e.some(Re=>Re.agent_id===m)||v(((fe=e[0])==null?void 0:fe.agent_id)??"")},[e,i]);const w=e.find(fe=>fe.agent_id===m),j=(w==null?void 0:w.kind)??"agentic",[S,T]=y.useState(""),$=j==="workflow"?$j(w==null?void 0:w.definition.workflow):null,_=y.useRef("");y.useEffect(()=>{if(S.trim()&&S!==_.current)return;const fe=($==null?void 0:$.text)??"";_.current=fe,T(fe)},[m,$==null?void 0:$.text]);const[E,R]=y.useState(""),[C,O]=y.useState(""),[z,F]=y.useState(""),[D,B]=y.useState("form"),[U,W]=y.useState(f?"response":"code"),[X,M]=y.useState("curl"),[K,L]=y.useState(!1),[I,G]=y.useState(f),P=y.useMemo(()=>{var Xe,Yt;const fe=I&&I.status>=400?(Xe=I.body)==null?void 0:Xe.error:void 0;if(!fe||typeof fe.message!="string")return;const Re=Array.isArray(fe.fields)?fe.fields.filter(De=>!!De&&typeof De.field=="string"&&typeof De.message=="string"&&De.message!==fe.message):[];return{message:fe.message,more:Re,box:typeof((Yt=fe.details)==null?void 0:Yt.box)=="string"?fe.details.box:void 0,details:fe.code==="agent_not_runnable"?fe.details:void 0}},[I]),[q,ne]=y.useState(!1),ae=y.useMemo(()=>Ws(),[]),ie=gj({upload:b,remove:x,limits:h,frozen:q}),ce=Sj(j,{text:S,revision:E,effort:C,maxCostUsd:z,fileIds:ie.fileIds}),le=ce.ok?ce.body:{input:j==="agentic"?{content:S}:S,...ie.fileIds.length?{file_ids:ie.fileIds}:{}},ye=m?ae.keyFor(m,le):"",ee=X==="curl"?KO(o,m,le,ye):`const res = await fetch(${JSON.stringify(`${o}/v2/agents/${m||"{agent_id}"}/runs`)}, {
|
|
541
|
-
method: "POST",
|
|
542
|
-
headers: {
|
|
543
|
-
Authorization: \`Bearer \${process.env.AGENTRUN_TOKEN}\`,
|
|
544
|
-
"Content-Type": "application/json",
|
|
545
|
-
"Idempotency-Key": ${JSON.stringify(ye)},
|
|
546
|
-
},
|
|
547
|
-
body: JSON.stringify(${JSON.stringify(le,null,2).replace(/\n/g,`
|
|
548
|
-
`)}),
|
|
549
|
-
});
|
|
550
|
-
console.log(res.status, await res.json());`,be=async()=>{if(!ce.ok||!c||ie.busy)return;ne(!0);const fe=await Ej(ae,m,ce.body,c);ne(!1),G(fe),W("response"),L(!0),fe.status>=200&&fe.status<300&&ie.clear()},Oe=j==="agentic"?"The run's first message, e.g. Summarize the standup: we ship Friday.":'{ "subject": "...", "body": "..." }';return s.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden",children:[s.jsxs("div",{"aria-label":"Playground agent",className:"flex shrink-0 flex-wrap items-center gap-3 border-b px-5 py-3 md:px-6",children:[e.length>0&&s.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-small",children:[s.jsx("label",{htmlFor:"playground-agent",className:"caps text-muted-foreground",children:"Agent"}),s.jsx(Kt,{id:"playground-agent",label:"Agent",placeholder:"Pick an agent",value:m,onChange:fe=>{v(fe),R(""),l==null||l(fe)},options:Md(e).map(fe=>({value:fe.agent_id,label:fe.definition.name})),className:"w-56 max-w-[60vw]"})]}),s.jsxs("span",{className:"font-mono text-small",children:[s.jsx("span",{className:"text-primary-text",children:"POST"})," ",s.jsxs("span",{className:"text-muted-foreground",children:["/v2/agents/",m||"{agent_id}","/runs"]})]}),s.jsx("span",{className:"flex-1"}),s.jsx("span",{className:"caps text-label text-muted-foreground",children:"Live API"}),s.jsx(Z,{type:"button",size:"xs",onClick:()=>L(fe=>!fe),"aria-expanded":K,className:"hidden text-muted-foreground hover:text-foreground short:inline-flex",children:K?"Hide code":"Show code"})]}),s.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 lg:[@media(min-height:501px)]:grid-cols-2",children:[s.jsx("section",{"aria-label":"Request",className:oe("flex min-h-0 flex-col border-b lg:border-b-0 lg:border-r",K&&"short:hidden"),children:e.length===0?s.jsxs(s.Fragment,{children:[s.jsx("header",{className:"flex items-center justify-between border-b px-5 py-3 md:px-6",children:s.jsx("span",{className:"pb-1 text-lead font-semibold",children:"Request"})}),s.jsxs("div",{className:"min-h-0 flex-1 space-y-6 overflow-auto px-5 py-6 md:px-6",children:[s.jsxs("div",{className:"border border-primary/50 bg-primary/5 p-5",children:[s.jsx("p",{className:"caps text-label text-primary-text",children:"No agents yet"}),s.jsx("h2",{className:"mt-2 text-xl font-semibold",children:"Start a run"}),s.jsx("p",{className:"mt-1 text-lead text-muted-foreground",children:"Runs start from an agent. Make one, then send its first request here."}),s.jsxs("div",{className:"mt-5 flex flex-wrap gap-2",children:[s.jsx("a",{href:"#/agents/new",className:Va({variant:"solid",size:"lg"}),children:"Create an agent"}),s.jsx("a",{href:"#/templates",className:Va({variant:"outline",size:"lg"}),children:"Browse templates"})]})]}),s.jsxs("div",{children:[s.jsx("h3",{className:"caps text-label text-muted-foreground",children:"What a request takes"}),s.jsx("dl",{className:"mt-3 divide-y border-y",children:Object.entries(ja).map(([fe,Re])=>s.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-4 gap-y-1 py-3",children:[s.jsx("dt",{className:"w-40 font-mono text-body",children:fe}),s.jsx("dd",{className:"text-small text-muted-foreground",children:Re})]},fe))})]})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("header",{className:"flex items-center justify-between border-b px-5 py-3 md:px-6",children:[s.jsx("span",{className:"text-lead font-semibold",children:"Request"}),s.jsx("span",{className:"flex gap-4 text-small",children:["form","json"].map(fe=>s.jsx("button",{type:"button",onClick:()=>B(fe),className:oe("border-b pb-1 capitalize",D===fe?"border-foreground":"border-transparent text-muted-foreground"),children:fe==="json"?"JSON":"Form"},fe))})]}),s.jsxs("div",{className:"min-h-0 flex-1 space-y-6 overflow-auto px-5 py-6 md:px-6",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-xl font-semibold",children:"Start a run"}),s.jsxs("p",{className:"mt-1 text-body text-muted-foreground",children:[w?`${w.definition.name}: ${j==="agentic"?"an":"a"} ${j} agent.`:"Pick an agent."," The server answers 202 with the run; follow it on its page."]})]}),D==="json"?s.jsxs(s.Fragment,{children:[s.jsx("pre",{className:"overflow-auto border bg-card p-4 font-mono text-small leading-[1.7]",children:JSON.stringify(le,null,2)}),s.jsx(Na,{name:"file_ids",note:ja.file_ids,children:s.jsx(Xp,{attachments:ie,limits:h})})]}):s.jsxs(s.Fragment,{children:[s.jsxs(Na,{name:j==="agentic"?"input.content":"input",required:!0,error:!ce.ok&&ce.field==="input"&&S?ce.message:void 0,children:[s.jsx(Ss,{value:S,onChange:fe=>T(fe.target.value),rows:j==="agentic"?4:7,placeholder:Oe}),$&&s.jsxs("p",{className:"mt-1 font-mono text-label text-muted-foreground",children:[_j($,"start"),$.fields.length>0&&s.jsxs(s.Fragment,{children:[" Fields: ",$.fields.map((fe,Re)=>s.jsxs("span",{title:fe.note,children:[Re?", ":"",s.jsx("span",{className:"text-foreground",children:fe.name})]},fe.name)),"."]})]})]}),s.jsx(Na,{name:"file_ids",note:ja.file_ids,children:s.jsx(Xp,{attachments:ie,limits:h})}),s.jsx(Na,{name:"revision",note:ja.revision,children:s.jsx(Kt,{label:"Revision",value:E,onChange:R,className:"w-full",options:[{value:"",label:"The current revision"},...t.map(fe=>({value:fe.revision,label:`rev ${fe.version}${fe.current?" (current)":""}${fe.note?`: ${fe.note}`:""}`}))]})}),s.jsx(Na,{name:"effort",note:ja.effort,children:s.jsx("div",{className:"flex gap-2",children:["",...n].map(fe=>s.jsx(Z,{type:"button",size:"sm","aria-pressed":C===fe,onClick:()=>O(fe),className:C===fe?"border-foreground hover:border-foreground":"text-muted-foreground",children:fe||"default"},fe||"default"))})}),j==="agentic"&&s.jsxs(Na,{name:"max_cost_usd",note:ja.max_cost_usd,error:!ce.ok&&ce.field==="max_cost_usd"?ce.message:void 0,children:[s.jsx(He,{value:z,onChange:fe=>F(fe.target.value),inputMode:"decimal",placeholder:"e.g. 0.50"}),s.jsx("p",{className:"mt-1.5 text-small text-muted-foreground",children:s.jsx(tN,{})})]})]})]}),s.jsxs("footer",{className:"flex shrink-0 items-center justify-between gap-3 border-t px-5 py-3 md:px-6",children:[s.jsx("span",{className:"text-small text-muted-foreground",children:"Sends a real request to this server."}),s.jsxs(Z,{variant:"primary",size:"lg",onClick:be,disabled:!ce.ok||!c||q||!m||ie.busy,title:ie.busy?"Waiting for the files to be sent":void 0,children:[s.jsx(Pl,{"aria-hidden":!0})," ",q?"Sending":"Send request"]})]})]})}),s.jsxs("section",{"aria-label":"Code and response",className:oe("flex min-h-0 flex-col",!K&&"short:hidden"),children:[s.jsxs("header",{className:"flex items-center justify-between border-b px-5 py-3 md:px-6",children:[s.jsxs("span",{className:"flex gap-4 text-body",children:[s.jsx("button",{type:"button",onClick:()=>W("code"),className:oe("border-b pb-1",U==="code"?"border-foreground":"border-transparent text-muted-foreground"),children:"Code"}),s.jsxs("button",{type:"button",onClick:()=>W("response"),disabled:!I,className:oe("border-b pb-1 disabled:opacity-45",U==="response"?"border-foreground":"border-transparent text-muted-foreground"),children:["Response",I&&s.jsx("span",{className:oe("ml-2 font-mono",I.status<300?"text-success-text":"text-destructive-text"),children:I.status})]})]}),U==="code"&&s.jsx(Z,{size:"icon",variant:"outline","aria-label":"Copy code",onClick:()=>{var fe;return void((fe=navigator.clipboard)==null?void 0:fe.writeText(ee))},children:s.jsx(gd,{"aria-hidden":!0})})]}),U==="code"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex gap-5 border-b px-5 text-small md:px-6",children:["curl","fetch"].map(fe=>s.jsx("button",{type:"button",onClick:()=>M(fe),className:oe("-mb-px border-b-2 py-2.5",X===fe?"border-primary":"border-transparent text-muted-foreground"),children:fe==="curl"?"cURL":"JavaScript"},fe))}),s.jsx("pre",{className:"min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words px-5 py-5 font-mono text-small leading-[1.8] md:px-6",children:ee}),s.jsx("footer",{className:"border-t px-5 py-3 text-small text-muted-foreground md:px-6",children:"The same request from your code: set AGENTRUN_TOKEN in your environment."})]}):I&&s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"border-b px-5 py-2.5 font-mono text-small md:px-6",children:[s.jsx("span",{className:I.status<300?"text-success-text":"text-destructive-text",children:I.status})," ",s.jsxs("span",{className:"text-muted-foreground",children:[I.ms," ms"]})]}),P&&s.jsxs("p",{className:"border-b px-5 py-2.5 font-mono text-small text-destructive-text md:px-6",role:"alert",children:["The run did not start: ",P.message,P.box?s.jsxs("span",{className:"text-muted-foreground",children:[" (box: ",P.box,")"]}):null,s.jsx(kj,{agentId:m,details:P.details}),P.more.length>0&&s.jsx("span",{className:"mt-1 block",children:P.more.map(fe=>s.jsxs("span",{className:"block",children:[fe.field,": ",fe.message]},`${fe.field}:${fe.message}`))})]}),I.runId&&p?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden border-b",children:p(I.runId)}),s.jsxs("details",{className:"border-b px-5 py-2.5 md:px-6",children:[s.jsx("summary",{className:"caps cursor-pointer text-label text-muted-foreground",children:"Response body"}),s.jsx("pre",{className:"max-h-64 overflow-auto whitespace-pre-wrap break-words py-3 font-mono text-small leading-[1.8]",children:JSON.stringify(I.body,null,2)})]})]}):s.jsx("pre",{className:"min-h-0 flex-1 overflow-auto whitespace-pre-wrap break-words px-5 py-5 font-mono text-small leading-[1.8] md:px-6",children:JSON.stringify(I.body,null,2)}),I.runId&&s.jsxs("button",{type:"button",onClick:()=>u==null?void 0:u(I.runId),className:"caps flex items-center justify-between border-t px-5 py-4 text-small text-primary-text hover:bg-accent md:px-6",children:["Open this run ",s.jsx(xh,{className:"size-4","aria-hidden":!0})]})]})]})]})]})}const ja={"input.content":"Required. The run's first message.",file_ids:"Empty names none.",revision:"Empty runs the current revision.",effort:"How hard the model thinks. Empty uses the agent's own.",max_cost_usd:"A spend cap in dollars; empty means none."};function Na({name:e,required:t,note:n,error:o,children:i}){return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("span",{className:"font-mono text-body",children:e}),t&&s.jsx("span",{className:"text-label text-muted-foreground",children:"required"})]}),i,n&&s.jsx("p",{className:"mt-1.5 text-small text-muted-foreground",children:n}),o&&s.jsx("p",{className:"mt-1.5 font-mono text-small text-destructive-text",role:"alert",children:o})]})}const XN=["queued","working","paused","input_required","completed","failed","cancelled"],Bz={queued:"Queued",working:"Working",paused:"Paused",input_required:"Input required",completed:"Completed",failed:"Failed",cancelled:"Cancelled"};function Gz({runs:e,agentName:t,onOpen:n,error:o,onRetry:i,onMore:l,loadingMore:c,filter:u={},onFilter:f}){const p=!!u.archived;return s.jsxs("div",{className:"p-5 md:p-8",children:[s.jsxs("div",{className:"mb-5 flex flex-wrap items-center gap-3",children:[s.jsx("h1",{className:"mr-auto font-mono text-2xl font-semibold",children:p?"Archived runs":"Runs"}),f&&s.jsxs(s.Fragment,{children:[s.jsx(Kt,{label:"Runs in one state",value:u.status??"",onChange:h=>f({...u,status:h||void 0}),className:"h-11 w-48",options:[{value:"",label:"Any state"},...XN.map(h=>({value:h,label:Bz[h]}))]}),s.jsxs(Z,{size:"lg",variant:p?"primary":"outline","aria-pressed":p,onClick:()=>f({...u,archived:!p}),children:[s.jsx(Rl,{"aria-hidden":!0})," Archived"]})]})]}),o&&!e?s.jsx($n,{problem:o,onRetry:i,className:""}):e?e.length?s.jsx(Vz,{runs:e,agentName:t,onOpen:n}):u.status||p?s.jsx("p",{className:"border px-4 py-12 text-center font-mono text-body text-muted-foreground",children:u.status?"No run matches.":"No archived runs."}):s.jsx(qz,{}):s.jsx(_s,{label:"Loading the runs"}),e&&o&&s.jsx($n,{problem:o,className:"mt-4"}),e&&l&&s.jsx("div",{className:"mt-4 flex justify-center",children:s.jsx(Z,{type:"button",onClick:l,disabled:c,size:"sm",children:c?"Loading":"Load more"})})]})}function qz(){return s.jsxs("section",{"aria-labelledby":"first-run",className:"border border-primary/50 bg-primary/5 p-5",children:[s.jsx("p",{className:"caps text-label text-primary-text",children:"No runs yet"}),s.jsx("h2",{id:"first-run",className:"mt-2 text-xl font-semibold",children:"Start your first run"}),s.jsx("p",{className:"mt-1 max-w-prose text-lead text-muted-foreground",children:"A run is one piece of work an agent does: a question answered, a page researched, a file written. Each one is listed here with its state, when it started and what it cost."}),s.jsxs("div",{className:"mt-5 flex flex-wrap gap-2",children:[s.jsxs("a",{href:"#/playground",className:Va({variant:"solid",size:"lg"}),children:[s.jsx(Pl,{"aria-hidden":!0})," Start a run"]}),s.jsx("a",{href:"#/templates",className:Va({variant:"outline",size:"lg"}),children:"Browse templates"})]})]})}function Vz({runs:e,agentName:t,onOpen:n}){return s.jsxs("table",{className:"w-full border-collapse border text-body",children:[s.jsx("thead",{className:"hidden md:table-header-group",children:s.jsx("tr",{className:"caps text-label text-muted-foreground",children:["Status","Run","Agent","Kind","Started","Cost"].map(o=>s.jsx("th",{className:"border-b px-3 py-2 text-left font-normal",children:o},o))})}),s.jsx("tbody",{children:e.map(o=>s.jsxs("tr",{className:"cursor-pointer border-b hover:bg-accent",onClick:()=>n(o.run_id),children:[s.jsx("td",{className:"px-3 py-2.5 align-top",children:s.jsx(Kl,{run:o})}),s.jsxs("td",{className:"px-3 py-2.5 align-top",children:[s.jsxs("button",{type:"button",className:"flex items-start gap-1 text-left",onClick:i=>{i.stopPropagation(),n(o.run_id)},children:[s.jsx("span",{className:"line-clamp-2",children:rn(o)}),s.jsx(J2,{className:"mt-0.5 size-3 shrink-0 text-muted-foreground","aria-hidden":!0})]}),o.status==="completed"&&o.review&&s.jsx("span",{className:"mt-1 block text-small text-warning-text",children:o.review.reason}),o.trigger&&s.jsx("span",{className:"mt-1 flex",children:s.jsx(uN,{run:o})}),s.jsxs("span",{className:"mt-1 block font-mono text-label text-muted-foreground md:hidden",children:[t(o.agent_id)," · ",St(o.created_at)]})]}),s.jsx("td",{className:"hidden px-3 py-2.5 align-top md:table-cell",children:t(o.agent_id)}),s.jsx("td",{className:"hidden px-3 py-2.5 align-top font-mono text-small text-muted-foreground md:table-cell",children:o.kind}),s.jsx("td",{className:"hidden px-3 py-2.5 align-top font-mono text-small text-muted-foreground md:table-cell",children:St(o.created_at)}),s.jsx("td",{className:"hidden px-3 py-2.5 align-top font-mono text-small text-muted-foreground md:table-cell",children:oo(o.cost,{ended:kl(o.status)})})]},o.run_id))})]})}const Kz=["system","light","dark"],mh="agentrun.theme",Xz="(prefers-color-scheme: dark)",tf=()=>{try{return globalThis.localStorage??null}catch{return null}},YN=()=>typeof globalThis.matchMedia=="function"?globalThis.matchMedia(Xz):null;let ph=null;function Yz(e=tf()){try{const t=e==null?void 0:e.getItem(mh);return t==="light"||t==="dark"?t:"system"}catch{return"system"}}const hh=(e=tf())=>ph??Yz(e);function Qz(e,t=tf()){ph=null;try{e==="system"?t==null||t.removeItem(mh):t==null||t.setItem(mh,e)}catch{ph=e}}function gh(e,t=document.documentElement,n=YN()){const o=e==="dark"||e==="system"&&!!(n!=null&&n.matches);t.classList.toggle("dark",o),t.classList.toggle("light",!o)}function Zz(e=document.documentElement,t=YN(),n=tf()){gh(hh(n),e,t);const o=()=>{hh(n)==="system"&&gh("system",e,t)};return t==null||t.addEventListener("change",o),()=>t==null?void 0:t.removeEventListener("change",o)}const Jz=[{id:"mission",label:"Mission Control",Icon:c_},{id:"playground",label:"Playground",Icon:m0},{id:"agents",label:"Agents",Icon:yh},{id:"templates",label:"Templates",Icon:c0},{id:"runs",label:"Runs",Icon:wh},{id:"triggers",label:"Triggers",Icon:pd},{id:"settings",label:"Settings",Icon:d0}],e6={system:["System",Ol],light:["Light",__],dark:["Dark",x_]};function t6(){const[e,t]=y.useState(()=>hh()),n=o=>{Qz(o),gh(o),t(o)};return s.jsx("div",{role:"group","aria-label":"Theme",className:"flex border",children:Kz.map(o=>{const[i,l]=e6[o];return s.jsx("button",{type:"button","aria-label":i,title:i,"aria-pressed":e===o,onClick:()=>n(o),className:oe("flex flex-1 items-center justify-center py-2 hover:bg-accent",e===o&&"bg-primary/[0.06] text-primary-text"),children:s.jsx(l,{className:"size-4","aria-hidden":!0})},o)})})}function Xw(){return s.jsxs("span",{className:"whitespace-nowrap font-mono text-figure font-semibold","aria-label":"AgentRun",children:["agent",s.jsx("span",{className:"text-primary-text",children:".run()"})]})}function n6({active:e,settings:t=!1,triggers:n=!1,onNavigate:o,onSignOut:i,onSignOutEverywhere:l,banners:c,children:u}){const[f,p]=y.useState(!1),[h,b]=y.useState(!1),x=y.useRef(null),m=y.useRef(null),v=y.useRef(!1);y.useEffect(()=>{var j,S;h?(j=m.current)==null||j.focus():v.current&&((S=x.current)==null||S.focus())},[h]);const w=()=>{v.current=!0,b(!1)};return s.jsxs("div",{className:"relative flex h-dvh min-h-0 flex-col overflow-hidden bg-background text-foreground md:flex-row",children:[s.jsxs("header",{className:"flex shrink-0 items-center justify-between border-b px-4 py-3 md:hidden",children:[s.jsx(Xw,{}),s.jsx(Z,{size:"icon",className:"size-9 [&_svg]:size-[18px]","aria-label":"Navigation","aria-expanded":f,onClick:()=>p(j=>!j),children:s.jsx(p_,{"aria-hidden":!0})})]}),s.jsxs("aside",{className:oe("shrink-0 flex-col border-r bg-background px-3 pb-4 pt-6 md:flex md:h-dvh md:w-sidebar md:overflow-y-auto",f?"flex max-h-[60dvh] overflow-y-auto border-b md:max-h-none":"hidden"),children:[s.jsx("div",{className:"hidden px-3 pb-[30px] md:block",children:s.jsx(Xw,{})}),s.jsx("nav",{"aria-label":"Navigation",className:"flex flex-col gap-1",children:Jz.filter(j=>(j.id!=="settings"||t)&&(j.id!=="triggers"||n)).map(({id:j,label:S,Icon:T})=>s.jsx(L4,{icon:T,active:e===j,onClick:()=>{o==null||o(j),p(!1)},children:S},j))}),s.jsx("div",{className:"mt-4 md:mt-auto",children:s.jsx(t6,{})}),s.jsxs(Z,{type:"button",onClick:i,className:"mt-2 justify-start gap-2.5 px-3",children:[s.jsx(f_,{"aria-hidden":!0})," Sign out"]}),l&&(h?s.jsxs("div",{role:"alertdialog","aria-label":"Sign out everywhere?",onKeyDown:j=>{j.key==="Escape"&&w()},className:"mt-2 space-y-2 border border-destructive/50 px-3 py-2.5 text-small",children:[s.jsx("p",{children:"Signs out every browser and phone signed in to this server, this one too."}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsx(Z,{type:"button",variant:"destructive",size:"xs",onClick:()=>{b(!1),l()},children:"Sign out everywhere"}),s.jsx(Z,{type:"button",ref:m,onClick:w,size:"xs",children:"Cancel"})]})]}):s.jsx("button",{type:"button",ref:x,onClick:()=>b(!0),className:"mt-1 px-3 py-1.5 text-left text-small text-muted-foreground hover:text-foreground",children:"Sign out everywhere"}))]}),s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[s.jsx(MP,{}),c,s.jsx("main",{className:"relative min-h-0 min-w-0 flex-1 overflow-auto",children:u})]})]})}const vp={setup:{label:"New password",autocomplete:"new-password"},sign_in:{label:"Password",autocomplete:"current-password"}},Yw={sign_in:{title:"Sign in",body:"Sign in to make agents, start runs and follow them on this server."},setup:{title:"Start building",body:"This is the server's first visit: set the owner's password. You sign in with it from now on."},token_link:{title:"Open the server's link",body:"This server has no accounts. Open the link it printed when it started: it signs this browser in once, and the token leaves the address."}};function s6({mode:e,code:t=null,codeNeeded:n=!1,onSubmit:o,problem:i=null,offer:l=null}){const[c,u]=y.useState(""),[f,p]=y.useState(!1),[h,b]=y.useState(""),[x,m]=y.useState(t??"");y.useEffect(()=>{t!==null&&m(t)},[t]);const[v,w]=y.useState(i),[j,S]=y.useState(!1),T=e==="setup",$=T&&l!==null&&!("sessions"in l&&l.sessions===0),_=T&&(n||t!==null),E=e!=="token_link"&&c.length>0&&(!T||c===h&&c.length>=12)&&(!_||x.trim()!==""),R=async()=>{if(!E||!o)return;S(!0);const C=await o(c,_&&x.trim()?x.trim():void 0,T&&$&&f);S(!1),w(C)};return s.jsx("main",{className:"grid min-h-dvh place-items-center bg-background p-6 text-foreground",children:s.jsxs("div",{className:"w-full max-w-[440px] border bg-card p-8",children:[s.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-figure font-semibold","aria-label":"AgentRun",children:[s.jsx(Us,{className:"size-5 text-primary-text","aria-hidden":!0}),s.jsxs("span",{children:["agent",s.jsx("span",{className:"text-primary-text",children:".run()"})]})]}),s.jsx("h1",{className:"mb-3 mt-8 text-2xl",children:Yw[e].title}),s.jsx("p",{className:"mb-6 text-prose leading-relaxed text-muted-foreground",children:Yw[e].body}),e!=="token_link"&&s.jsxs("form",{className:"space-y-5",onSubmit:C=>{C.preventDefault(),R()},children:[_&&s.jsx(Po,{label:"Setup code",id:"setup-code",hint:"On Render: paste the server's AGENTRUN_TOKEN from the service's Environment tab. Elsewhere: paste the setup code the server printed in its log, or open the link it prints.",children:s.jsx(He,{name:"setup-code",value:x,onChange:C=>m(C.target.value),autoComplete:"one-time-code",spellCheck:!1,className:"text-lead"})}),s.jsx(Po,{label:vp[e].label,hint:T?"12 characters or more.":void 0,children:s.jsxs("span",{className:oe("flex items-center gap-3 px-3",r1),children:[s.jsx(Al,{className:"size-4 text-muted-foreground","aria-hidden":!0}),s.jsx(He,{bare:!0,type:"password",value:c,onChange:C=>u(C.target.value),autoComplete:vp[e].autocomplete,autoFocus:!0,"aria-label":vp[e].label,className:"h-control-md flex-1 text-lead"})]})}),T&&s.jsx(Po,{label:"Again",hint:h&&h!==c?"The two passwords differ.":void 0,children:s.jsx(He,{type:"password",value:h,onChange:C=>b(C.target.value),autoComplete:"new-password","aria-label":"Password again",className:"text-lead"})}),$&&s.jsxs("label",{className:"flex items-start gap-3 text-lead",children:[s.jsx("input",{type:"checkbox",name:"import",checked:f,onChange:C=>p(C.target.checked),className:"mt-1 size-4 accent-primary"}),s.jsxs("span",{children:[s.jsx("span",{className:"block",children:"Import this machine's Claude Code, Codex and pi sessions"}),s.jsx("span",{className:"mt-1 block text-small text-muted-foreground","aria-live":"polite",children:r6(l)})]})]}),s.jsx(Z,{type:"submit",variant:"solid",disabled:!E||j,"aria-busy":j||void 0,className:"w-full text-body",children:j?"Signing in":T?"Set password and continue":"Continue"}),v&&s.jsx("p",{className:"font-mono text-body text-destructive-text",role:"alert",children:v}),!T&&s.jsxs("p",{className:"text-small leading-relaxed text-muted-foreground",children:["Forgot it? Where the server runs: ",s.jsx("code",{className:"font-mono text-foreground",children:"npx @parcha/agentrun reset-password"})," (add"," ",s.jsx("code",{className:"font-mono text-foreground",children:"--data DIR"})," if you started it with one). For a server you started yourself:"," ",s.jsx("code",{className:"font-mono text-foreground",children:"agentrun-serve reset-password --data DIR"})," (in the image:"," ",s.jsx("code",{className:"font-mono text-foreground",children:"--data /data"}),"). The next visit here sets a new one."]})]})]})})}const Qw=(e,t)=>`${e.toLocaleString("en-US")} ${t}${e===1?"":"s"}`,bp="Each project becomes an agent, each session a run you can read.";function r6(e){return"counting"in e?`Counting sessions… ${bp}`:e.sessions===null||e.projects===null?`The count isn't known. ${bp}`:`${Qw(e.sessions,"session")} in ${Qw(e.projects,"project")}. ${bp}`}function o6({problem:e,starting:t=!1,onRetry:n}){return s.jsx("main",{className:"grid min-h-dvh place-items-center bg-background p-6 text-foreground",children:s.jsxs("div",{className:"w-full max-w-[440px] border bg-card p-8",children:[s.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-figure font-semibold","aria-label":"AgentRun",children:[s.jsx(Us,{className:"size-5 text-primary-text","aria-hidden":!0}),s.jsxs("span",{children:["agent",s.jsx("span",{className:"text-primary-text",children:".run()"})]})]}),s.jsx("h1",{className:"mb-3 mt-8 text-2xl",children:t?"This server is starting":"Can't read this server's sign-in"}),s.jsx("p",{className:"mb-4 text-prose leading-relaxed text-muted-foreground",children:t?"Its address answers for it until it is up (a first start, a redeploy or a wake can take a minute or two). Trying again…":"The page asked the server whether it has its owner yet, and got no answer it could read, so it can't show setup or sign-in. It asks again on its own."}),s.jsx("p",{className:"mb-6 break-words font-mono text-body text-destructive-text",role:"alert",children:e}),s.jsx(Z,{type:"button",variant:"solid",onClick:n,className:"w-full text-body",children:"Retry now"})]})})}const QN=e=>{var t;return e.status===200&&((t=e.body)==null?void 0:t.accounts)===!1};function a6(e,t){if(QN(e))return t===200?"signed_in":"token_link";const n=e.body??{};return n.signed_in?"signed_in":n.password_set?"sign_in":"setup"}const i6=e=>{var t;return e.status===200&&((t=e.body)==null?void 0:t.setup_code)===!0};function l6(e){var t,n;if(e.status===401)return"That is not the password.";if(e.status===429){const o=e.retryAfterMs===void 0?60:Math.max(1,Math.ceil(e.retryAfterMs/1e3));return`Too many sign-ins. Try again in ${o===1?"a second":o>=60?"a minute":`${o} seconds`}.`}return e.status===403&&/has its owner/.test(e.message)?"This server has its owner already: sign in.":e.status===403&&/a new one is in the server's log/.test(e.message)?"That setup code expired or was voided after too many wrong tries: a new one is in the server's log (on Render, the Logs tab).":e.status===403&&/takes the setup code/.test(e.message)?"Enter the setup code from the server's log.":e.status===403&&/setup code/.test(e.message)?"That setup code was refused: open the newest setup link in the server's log, or paste the server's token (AGENTRUN_TOKEN) here.":((n=(t=e.fields)==null?void 0:t[0])==null?void 0:n.message)??e.message}function ZN(e){const t=new URLSearchParams(e.startsWith("#")?e.slice(1):e),n=t.get("code");if(n===null)return{code:null,rest:e};t.delete("code");const o=t.toString();return{code:/^[A-Za-z0-9_-]*/.exec(n)[0],rest:o?`#${o}`:""}}const c6=1e4;function Zw(e=location.hash){let t=e.match(/^#\/runs\/([^/?]+)$/);if(t)return{section:"runs",run:decodeURIComponent(t[1])};if(e==="#/agents/new")return{section:"agents",agent:null};if(t=e.match(/^#\/agents\/([^/?]+)\/learning\?(.*)$/),t)return{section:"agents",agent:decodeURIComponent(t[1]),tab:"learning",notes:new URLSearchParams(t[2]).getAll("note")};if(t=e.match(/^#\/agents\/([^/?]+)\/edit\?(.*)$/),t){const l=new URLSearchParams(t[2]).get("tool");return{section:"agents",agent:decodeURIComponent(t[1]),edit:!0,...l?{tool:l}:{}}}if(t=e.match(/^#\/agents\/([^/?]+)(?:\/([a-z]+))?$/),t)return{section:"agents",agent:decodeURIComponent(t[1]),...t[2]==="edit"?{edit:!0}:t[2]?{tab:t[2]}:{}};if(e.startsWith("#/agents"))return{section:"agents",archived:/[?&]archived=true\b/.test(e)};if(e.startsWith("#/playground"))return{section:"playground"};if(t=e.match(/^#\/templates\/([^/?]+)$/),t)return{section:"templates",template:decodeURIComponent(t[1])};if(e.startsWith("#/templates"))return{section:"templates"};if(e==="#/triggers/new")return{section:"triggers",trigger:null,kind:"schedule"};if(e==="#/triggers/new-webhook")return{section:"triggers",trigger:null,kind:"webhook"};if(e==="#/triggers/new-github")return{section:"triggers",trigger:null,kind:"github"};if(t=e.match(/^#\/triggers\/([^/?]+)(\/edit)?$/),t)return{section:"triggers",trigger:decodeURIComponent(t[1]),...t[2]?{edit:!0}:{}};if(e.startsWith("#/triggers"))return{section:"triggers"};if(t=e.match(/^#\/settings\/mcp(?:\?(.*))?$/),t)return{section:"settings",settings:"mcp",signIn:vO(t[1])};if(t=e.match(/^#\/settings\/github(?:\?(.*))?$/),t){const l=DP(t[1]);return{section:"settings",settings:"github",...l?{github:l}:{}}}if(t=e.match(/^#\/settings(?:\/(keys|tools|computers|workspace|webhook))?$/),t)return{section:"settings",settings:t[1]??"keys"};if(e===""||e==="#"||e==="#/"||e.startsWith("#/start")||e.startsWith("#/mission"))return{section:"mission"};if(!e.startsWith("#/runs?"))return{section:"runs"};const n=new URLSearchParams(e.slice(7)),o=n.get("agent"),i=n.get("status");return{section:"runs",...o?{runsOf:o}:{},...i&&XN.includes(i)?{status:i}:{},...n.get("archived")==="true"?{archived:!0}:{}}}function u6({runsOf:e,status:t,archived:n}){const o=new URLSearchParams;return e&&o.set("agent",e),t&&o.set("status",t),n&&o.set("archived","true"),`#/runs${o.size?`?${o}`:""}`}let wp;function d6(){if(!wp){const{code:e,rest:t}=ZN(location.hash);e!==null&&history.replaceState(null,"",`${location.pathname}${location.search}${t}`),wp={code:e}}return wp.code}const f6=e=>Math.min(1e3*2**e,3e4),JN=1e3,m6=30;function p6(e){return e.state==="running"?"Importing this machine's sessions: agents appear as they arrive.":e.state==="stopped"?"The import of this machine's sessions stopped. It goes on when the server starts again.":`Imported ${`${e.runs.toLocaleString("en-US")} session${e.runs===1?"":"s"}`} into ${e.agents.toLocaleString("en-US")} agent${e.agents===1?"":"s"}${e.skipped?`; ${e.skipped.toLocaleString("en-US")} left out`:""}.`}function h6(){const[e]=y.useState(SM),[t,n]=y.useState(null),[o,i]=y.useState(!1),l=y.useRef(null);l.current=t;const c=y.useRef(!1),u=y.useRef(async()=>{}),f=y.useMemo(()=>p4({fetch:e.fetch,onSignedOut:()=>void u.current()}),[e]),[p,h]=y.useState(d6);y.useEffect(()=>{if(t!=="setup")return;const R=()=>{const{code:C,rest:O}=ZN(location.hash);C!==null&&(history.replaceState(null,"",`${location.pathname}${location.search}${O}`),h(C))};return window.addEventListener("hashchange",R),R(),()=>window.removeEventListener("hashchange",R)},[t]);const[b,x]=y.useState(!1),m=async()=>{const R=await f.session(),C=QN(R)?await f.listAgents().then(()=>200,O=>O instanceof Ee?O.status:0):void 0;return{mode:a6(R,C),codeNeeded:i6(R)}},v=async()=>{const R=await m();return x(R.codeNeeded),R.mode},w=async()=>n(await v());u.current=async()=>{if(!(l.current!=="signed_in"||c.current)){c.current=!0;try{const R=await v();R!=="signed_in"&&l.current==="signed_in"&&(i(!0),n(R))}catch{}finally{c.current=!1}}};const[j,S]=y.useState(null),[T,$]=y.useState(0);y.useEffect(()=>{let R=!0,C;return m().then(O=>{!R||l.current!==null||(x(O.codeNeeded),n(O.mode),S(null))},O=>{if(!R||l.current!==null)return;const z=f6(T),F=O instanceof Ee?O:null,D=(F==null?void 0:F.code)==="http_error",B=D&&[502,503,504].includes(F.status);S({problem:F===null?Nn(O):B?`Its address answered ${F.status}, not the server.`:`GET /v2/auth/session answered ${F.status}${D?", not as this server answers":`: ${F.message}`}`,starting:B}),C=setTimeout(()=>$(U=>U+1),z)}),()=>{R=!1,clearTimeout(C)}},[f,T]);const[_,E]=y.useState(null);return y.useEffect(()=>{if(t!=="setup")return;let R=!0;return(async()=>{for(let C=!1;R;){const O=await f.setupImport().then(z=>z,()=>{});if(!R)return;if(O===void 0&&C)return void E({projects:null,sessions:null});if(O!==void 0&&(!O||!("counting"in O||"sessions"in O)||(E(O),C=!0,!("counting"in O))))return;await new Promise(z=>setTimeout(z,JN))}})(),()=>{R=!1}},[f,t]),t===null&&j!==null?s.jsx(o6,{problem:j.problem,starting:j.starting,onRetry:()=>$(R=>R+1)}):t===null?s.jsx(Nw,{connection:e,children:s.jsx(g6,{})}):t!=="signed_in"?s.jsx(s6,{mode:t,code:p,codeNeeded:b,offer:_,problem:o&&t==="sign_in"?"You were signed out. Sign in to go on.":null,onSubmit:async(R,C,O)=>{try{return await(t==="setup"?f.setup(R,C,O):f.signIn(R)),i(!1),n("signed_in"),null}catch(z){return z instanceof Ee&&z.status===403&&t==="setup"&&await w().catch(()=>{}),z instanceof Ee?l6(z):z instanceof Error?z.message:String(z)}}},t):s.jsx(Nw,{connection:e,children:s.jsx(x6,{v2:f,onSignedOut:()=>{i(!1),n("sign_in")}})})}function g6(){return Eg().state==="offline"?s.jsx(PP,{}):s.jsx("p",{className:"p-8 text-center font-mono text-body text-muted-foreground",role:"status",children:"Connecting…"})}function x6({v2:e,onSignedOut:t}){var Nr,Sr,Qo,Ae,Y,pe,Ne,at,Ct,Be,zt,Jt,Es,wt,mo,_r,po,Vn,ec,Mn;const{writable:n,whyNot:o}=_P(e),[i,l]=y.useState(null),[c,u]=y.useState(()=>Zw()),[f,p]=y.useState(null),h=((Sr=(Nr=f==null?void 0:f.features)==null?void 0:Nr.triggers)==null?void 0:Sr.routes)===!0,[b,x]=y.useState(new Map);y.useEffect(()=>{if(!h)return;let he=!0;return e.listTriggers().then(xe=>{he&&x(new Map(xe.triggers.map(Te=>[Te.id,{name:Te.name,kind:Te.source.kind}])))},()=>{}),()=>{he=!1}},[e,h,c.section,c.trigger]);const[m,v]=y.useState(null),[w,j]=y.useState(null),[S,T]=y.useState(0),[$,_]=y.useState("30d"),[E,R]=y.useState(null),[C,O]=y.useState(!1),[z,F]=y.useState(null),[D,B]=y.useState(null),[U,W]=y.useState(null),[X,M]=y.useState(0),[K,L]=y.useState(!1),[I,G]=y.useState(null),[P,q]=y.useState(null),[ne,ae]=y.useState(!1),[ie,ce]=y.useState({}),[le,ye]=y.useState(!1),ee=y.useRef(0),[be,Oe]=y.useState([]),We=y.useRef(-1),[fe,Re]=y.useState(null),[Xe,Yt]=y.useState(0),De=y.useRef(0),et=he=>{vu(he)||(location.hash=he)},[Ht,Bt]=y.useState(null),[_t,os]=y.useState(0);y.useEffect(()=>{let he=!0;return(async()=>{let xe=!1;for(let Te=0;he&&Te<m6;){const Je=await e.setupImport().then(qe=>qe,()=>{});if(!he)return;if(Je===void 0)Te+=1;else{if(Te=0,!Je||!("state"in Je))return;if(Bt(Je),Je.state!=="running")return void(xe&&os(qe=>qe+1));xe=!0}await new Promise(qe=>setTimeout(qe,JN))}})(),()=>{he=!1}},[e]),y.useEffect(()=>{const he=()=>{const xe=EI();vu(location.hash,()=>{xe&&history.go(-xe)})?xe&&history.go(xe):u(Zw())};return window.addEventListener("hashchange",he),()=>window.removeEventListener("hashchange",he)},[]),y.useEffect(()=>$I(),[]);const gn=y.useRef(0),Qt=y.useRef(!1),ot=()=>{const he=++gn.current;return e.capabilities().then(xe=>(he===gn.current&&p(xe),!0),()=>!1)};y.useEffect(()=>{ot()},[e]),y.useEffect(()=>{if(ee.current&&c.section!=="runs"&&c.section!=="mission"&&We.current===_t)return;We.current=_t;const he=++ee.current;ye(!1),Promise.allSettled([!1,!0].map(xe=>Qr(Te=>e.listAgents({archived:xe,cursor:Te}),Te=>Te.agents))).then(xe=>{if(he!==ee.current)return;const Te=Object.fromEntries(xe.flatMap(qe=>qe.status==="fulfilled"?qe.value:[]).map(qe=>[qe.agent_id,qe.definition.name??qe.agent_id])),Je=xe.every(qe=>qe.status==="fulfilled");ce(qe=>Je?Te:{...qe,...Te}),ye(Je)})},[e,c,_t]);const ct={status:c.status,archived:c.archived};y.useEffect(()=>{if(c.section!=="runs"||c.run)return;const he=++De.current;G(null),Re(null),(c.runsOf?e.listAgentRuns(c.runsOf,50,null,ct):e.listRuns(50,null,ct)).then(xe=>{he===De.current&&(G(xe.runs),q(xe.next_cursor))}).catch(xe=>{he===De.current&&Re(mn(xe,"the runs"))})},[e,c,_t,Xe]);const Pe=he=>{var xe;return ie[he]??((xe=Cn==null?void 0:Cn.find(Te=>Te.agent_id===he))==null?void 0:xe.definition.name)??(le?he:"")},Le=f,Mt=(f==null?void 0:f.models.ready)===!1&&f.models.needs!=="model"&&!f.models.default&&f.models.source!=="gateway"&&!!((Ae=(Qo=f.features)==null?void 0:Qo.tool_keys)!=null&&Ae.routes),ut={harnesses:(Le==null?void 0:Le.harnesses)??[],tools:Y5(Le==null?void 0:Le.tools),thinking:((Y=Le==null?void 0:Le.features)==null?void 0:Y.thinking)??[]},It=MO(Le==null?void 0:Le.tools),En=LO(Le==null?void 0:Le.tools),Tn=[...(Ne=(pe=f==null?void 0:f.features)==null?void 0:pe.tool_keys)!=null&&Ne.routes?["keys"]:[],...It.length||En.length?["tools"]:[],"mcp","github","computers","workspace",...(Ct=(at=f==null?void 0:f.features)==null?void 0:at.webhooks)!=null&&Ct.routes?["webhook"]:[]],Zt=he=>et({runs:"#/runs",agents:"#/agents",playground:"#/playground",mission:"#/",triggers:"#/triggers",templates:"#/templates",settings:`#/settings/${Tn[0]??"keys"}`}[he]),Hn=y.useRef(Ws()).current,as=async he=>{const xe=KN(ut.harnesses);if(!xe)return"This server has no model to run it on yet.";try{const Te=await Dz(e,he,xe,Hn);return et(`#/runs/${encodeURIComponent(Te)}`),null}catch(Te){return Nn(Te)}},is=((m==null?void 0:m.analytics.by_source)??[]).filter(he=>he.source!=="live").reduce((he,xe)=>he+xe.runs,0),[Cn,Bn]=y.useState(null),[Gn,J]=y.useState([]),[we,Ge]=y.useState(null),[dt,Ke]=y.useState(null),[$t,on]=y.useState(0),bt=y.useRef(0);y.useEffect(()=>{if(c.section!=="playground")return;Ke(null);const he=++bt.current;Qr(xe=>e.listAgents({cursor:xe}),xe=>xe.agents).then(xe=>{if(he!==bt.current)return;Bn(xe);const Te=xe.filter(Je=>!Je.archived_at);Ge(Je=>{var qe;return Je&&Te.some(xt=>xt.agent_id===Je)?Je:((qe=Te[0])==null?void 0:qe.agent_id)??null})}).catch(xe=>{if(he===bt.current){const Te=mn(xe,"the agents");Ke(`${Te.why} ${Te.next}${Te.said?` (${Te.said})`:""}`)}})},[e,c.section,$t,_t]),y.useEffect(()=>{if(c.section!=="mission")return;let he=!0;j(null),O(!0);const xe=ng($);return Promise.all([e.statsOver({...xe?{from:xe}:{},...E?{agent:E}:{}}),E?e.listAgentRuns(E,10):e.listRuns(10)]).then(([Te,Je])=>{he&&(v(o4(Te,Je.runs)),E||W(qe=>qe||mP(Je.runs,Te.analytics.by_source)))}).catch(Te=>{he&&j(mn(Te,"Mission Control"))}).finally(()=>{he&&O(!1)}),()=>{he=!1}},[e,c.section,S,$,E,_t]),iN(()=>T(he=>he+1)),y.useEffect(()=>{if(c.section!=="mission")return;let he=!0;const xe=xt=>Qr(Dt=>e.listRuns(50,Dt,{status:xt}),Dt=>Dt.runs,2),Te=()=>Qr(xt=>e.listAgents({archived:!1,cursor:xt}),xt=>xt.agents).then(xt=>{he&&Oe(xt.filter(Dt=>Qu(Dt)>0).map(Dt=>({agent_id:Dt.agent_id,name:Dt.definition.name??Dt.agent_id,pending:Qu(Dt)})))},()=>{}),qe=gP(()=>Promise.allSettled([xe("input_required"),xe("failed"),xe("working"),Te()]).then(([xt,Dt,nf])=>{var li;if(!he)return;const ai=[xt,Dt,nf],ii=Date.now()-864e5;B(bw(null,ai).problem),((li=ai[0])==null?void 0:li.status)==="fulfilled"&&L(!0),F(ci=>{const{needs:ar}=bw(ci,ai);return{asking:ar.asking.filter(sN),failed:ar.failed.filter(tc=>Date.parse(tc.ended_at??tc.created_at)>ii),live:ar.live}})}),1e4);return()=>{he=!1,qe()}},[e,c.section,X]);const Hs=y.useRef(qO()).current,an=()=>setTimeout(()=>M(he=>he+1),2500),$s=async(he,xe)=>{try{return await jj(Hs(he),he,xe,e.sendMessage),an(),null}catch(Te){return Nn(Te)}},Rn=y.useRef(new Map).current,An=async he=>{const xe=[];try{for(const Te of he){const Je=Te.kind==="workflow"?void 0:(await e.getTimeline(Te.run_id)).rows.find(Dt=>Dt.kind==="user_message"),qe=hP(Te,Je==null?void 0:Je.text);if("refusal"in qe)throw new Error(qe.refusal);const xt=Rn.get(Te.run_id)??Wd();Rn.set(Te.run_id,xt),await e.startRun(Te.agent_id,qe.body,xt),xe.push(Te.run_id)}return an(),{started:xe,problem:null}}catch(Te){return xe.length&&an(),{started:xe,problem:Nn(Te)}}},ls=async he=>{try{return await e.stop(he),an(),null}catch(xe){return Nn(xe)}},rr=async(he,xe,Te,Je)=>{let qe=null;try{await e.answerApproval(he,xe,Te,Je)}catch(xt){qe=AN(xt)}return M(xt=>xt+1),qe},or=async(he,xe)=>{let Te=null;try{await e.handBackComputer(he,xe)}catch(Je){Te=dh(Je,"hand")}return M(Je=>Je+1),Te},Bs=y.useRef(0);y.useEffect(()=>{const he=++Bs.current;J([]),we&&Qr(xe=>e.listRevisions(we,xe),xe=>xe.revisions).then(xe=>{he===Bs.current&&J(xe)}).catch(()=>{})},[e,we]);const Yo=async(he,xe,Te)=>{const Je=performance.now();try{const qe=await e.startRun(he,xe,Te);return{status:qe.status,ms:Math.round(performance.now()-Je),body:qe.run,runId:qe.run.run_id}}catch(qe){return Wz(qe,Math.round(performance.now()-Je))}},On=((Be=f==null?void 0:f.features)==null?void 0:Be.efforts)??[],fo=f?((zt=f.features)==null?void 0:zt.learning)??null:void 0;ut.learning=fo??void 0;const qn=f==null?void 0:f.models.ready;return y.useEffect(()=>{if(qn!==!1)return;const he=()=>{Qt.current||(Qt.current=!0,ot().finally(()=>{Qt.current=!1}))},xe=()=>ot(),Te=setInterval(he,c6);return window.addEventListener("focus",xe),()=>{clearInterval(Te),window.removeEventListener("focus",xe)}},[e,qn]),s.jsx(cN.Provider,{value:b,children:s.jsx(n6,{active:c.section,settings:Tn.length>0,triggers:h,onNavigate:Zt,onSignOut:()=>{const he=()=>void e.signOut().then(t,xe=>l(xe instanceof Ee?xe.message:"The sign-out did not reach the server. Try again."));vu(null,he)||he()},onSignOutEverywhere:()=>{const he=()=>void e.signOutEverywhere().then(t,xe=>l(xe instanceof Ee?xe.message:"The sign-out did not reach the server. Try again."));vu(null,he)||he()},banners:s.jsxs(s.Fragment,{children:[i&&s.jsxs("p",{className:"border-b bg-card px-5 py-3 font-mono text-body text-destructive-text md:px-8",role:"alert",children:["Not signed out: ",i]}),Ht&&s.jsxs("p",{className:"flex items-center gap-3 border-b bg-card px-5 py-3 font-mono text-body md:px-8",role:"status",children:[s.jsx("span",{className:"flex-1",children:p6(Ht)}),Ht.state!=="running"&&s.jsx(Z,{type:"button",size:"xs",onClick:()=>Bt(null),children:"Dismiss"})]}),(f==null?void 0:f.models.ready)===!1&&c.section!=="mission"&&s.jsx(JP,{needs:f.models.needs,source:f.models.source,model:f.models.default,settings:((Es=(Jt=f.features)==null?void 0:Jt.tool_keys)==null?void 0:Es.routes)===!0})]}),children:c.section==="playground"&&dt?s.jsx(ns,{tone:"error",className:"m-8",actions:s.jsx(Z,{type:"button",size:"xs",onClick:()=>on(he=>he+1),children:"Try again"}),children:s.jsxs("p",{className:"font-mono",children:["The agents could not be read: ",dt]})}):c.section==="settings"?s.jsx(IP,{active:c.settings??"keys",offered:Tn,children:c.settings==="tools"?s.jsx(zP,{v2:e,choices:It,gates:En,harnesses:ut.harnesses,onSaved:ot,onOpen:ot}):c.settings==="mcp"?s.jsx(qP,{v2:e,signIn:c.signIn,writable:n,whyNot:o}):c.settings==="github"?s.jsx(HP,{v2:e,returned:c.github}):c.settings==="computers"?s.jsx(oL,{v2:e,writable:n,whyNot:o}):c.settings==="workspace"?s.jsx(fL,{v2:e,writable:n,whyNot:o}):c.settings==="webhook"?s.jsx(tL,{v2:e}):s.jsx(CP,{v2:e,onChange:ot,writable:n,whyNot:o})}):c.section==="mission"?s.jsxs("div",{className:"flex h-full flex-col",children:[(f==null?void 0:f.models.ready)===!1&&s.jsx(ZP,{v2:e,needs:f.models.needs,model:f.models.default,onSaved:ot,writable:n,whyNot:o}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(_z,{view:m,error:w,onRetry:()=>T(he=>he+1),scope:{range:$,onRange:_,agent:E,onAgent:R,refreshing:C&&m!==null},asking:z&&K?z.asking.length:null,needsYou:z&&s.jsx(Ez,{asking:z.asking,failed:z.failed,live:z.live,learning:be,problem:D,agentName:Pe,onAnswer:$s,onApprove:rr,onHandBack:or,onRunAgain:An,onStop:ls}),startHere:U===!1?s.jsx(Uz,{harnesses:ut.harnesses,tools:ut.tools,onTry:as,imported:is,keyCard:Mt}):void 0})})]}):c.section==="templates"?s.jsx(fI,{v2:e,name:c.template,go:et},c.template??""):c.section==="triggers"?s.jsx(qL,{v2:e,view:{trigger:c.trigger,kind:c.kind,edit:c.edit},go:et,agentName:Pe,minEvery:(mo=(wt=f==null?void 0:f.features)==null?void 0:wt.triggers)==null?void 0:mo.min_every_s}):c.section==="playground"?Cn&&s.jsx(Hz,{agents:Cn.filter(he=>!he.archived_at),revisions:Gn,efforts:On,origin:location.origin,agentId:we??void 0,onAgent:Ge,onSend:Yo,limits:f==null?void 0:f.limits,removeUpload:e.deleteUpload,onOpenRun:he=>et(`#/runs/${encodeURIComponent(he)}`),live:he=>s.jsx(Kw,{v2:e,runId:he,caps:f,agentName:Pe},he)}):c.section==="agents"?c.agent===void 0?s.jsx(sP,{v2:e,archived:!!c.archived,go:et},_t):c.agent!==null&&!c.edit?s.jsx(TM,{v2:e,agentId:c.agent,tab:c.tab,notes:c.notes,learning:fo,routePrefix:(_r=Le==null?void 0:Le.models)==null?void 0:_r.route_prefix,harnesses:ut.harnesses,efforts:On,limits:f==null?void 0:f.limits,places:iw(f),go:et},c.agent):s.jsx(rP,{v2:e,choices:It,gates:En,focusTool:c.tool,caps:{...ut,routePrefix:(po=Le==null?void 0:Le.models)==null?void 0:po.route_prefix,decisionProvider:V5(f==null?void 0:f.workflows),places:iw(f),mcp:!!((Vn=f==null?void 0:f.features)!=null&&Vn.mcp_client),mcpHarnesses:(Mn=(ec=f==null?void 0:f.features)==null?void 0:ec.mcp_client)==null?void 0:Mn.harnesses},agentId:c.agent,go:et},`${c.agent??"new"}:${c.tool??""}`):c.run?s.jsx(Kw,{v2:e,runId:c.run,caps:f,agentName:Pe},c.run):s.jsx(Gz,{runs:I,agentName:Pe,error:fe,onRetry:()=>Yt(he=>he+1),onOpen:he=>et(`#/runs/${encodeURIComponent(he)}`),loadingMore:ne,filter:ct,onFilter:he=>et(u6({runsOf:c.runsOf,...he})),onMore:P?()=>{const he=De.current;ae(!0),(c.runsOf?e.listAgentRuns(c.runsOf,50,P,ct):e.listRuns(50,P,ct)).then(xe=>{he===De.current&&(G(Te=>Nj(Te??[],xe.runs)),q(xe.next_cursor),Re(null))}).catch(xe=>Re(mn(xe,"more runs"))).finally(()=>ae(!1))}:void 0})})})}Zz();W2.createRoot(document.getElementById("root")).render(s.jsx(y.StrictMode,{children:s.jsx(B4,{children:s.jsx(h6,{})})}));
|