Compare commits

...
Author SHA1 Message Date
Ttungx ab1a0dba30 remove proxy banner 2026-09-20 12:42:27 +08:00
Ttungx 28ee9f9a1c add dakeyun 2026-08-21 13:18:43 +08:00
Ttungx 1dd951691a fix 2026-08-21 11:31:36 +08:00
Ttungx 74829e3867 remove rapidproxy ads 2026-07-01 19:14:16 +08:00
Ttungx 90490e72c5 remove bestproxy ads 2026-06-10 10:18:58 +08:00
Ttungx 24dd6c0b1e update readme 2026-05-25 22:17:33 +08:00
Ttungx 03dfacb896 add banner 2026-05-20 22:53:53 +08:00
Ttungx c93f892e01 fix ad 2026-05-06 16:00:56 +08:00
Ttungx 57c8662860 fix ad 2026-05-06 12:42:20 +08:00
Ttungx a5671f2109 fix ad 2026-05-06 12:40:57 +08:00
Ttungx b86894b157 add ad 2026-05-06 12:34:06 +08:00
y0ung 302c0fccee Delete .github/workflows/update-management-html.yml 2026-04-10 23:32:46 +08:00
y0ung 16ad904289 delete action of update-management-console 2026-04-10 23:31:56 +08:00
github-actions[bot] e10e7c1c20 chore: update management.html to v1.7.31 2026-04-09 16:57:39 +00:00
github-actions[bot] 3465e0779d chore: update management.html to v1.7.30 2026-04-02 19:42:57 +00:00
github-actions[bot] 6aef059fe1 chore: update management.html to v1.7.28 2026-04-01 16:02:00 +00:00
github-actions[bot] bd7a43c28c chore: update management.html to v1.7.27 2026-03-30 06:25:00 +00:00
github-actions[bot] 3eddb9f539 chore: update management.html to v1.7.25 2026-03-27 23:23:29 +00:00
github-actions[bot] 9a413fe866 chore: update management.html to v1.7.24 2026-03-27 19:36:24 +00:00
github-actions[bot] df7c9b1cfd chore: update management.html to v1.7.23 2026-03-27 18:44:12 +00:00
github-actions[bot] edf6cc86fa chore: update management.html to v1.7.21 2026-03-27 15:42:59 +00:00
github-actions[bot] f21c9dc229 chore: update management.html to v1.7.19 2026-03-27 11:35:43 +00:00
github-actions[bot] 4f1f982dd5 chore: update management.html to v1.7.17 2026-03-27 10:39:10 +00:00
github-actions[bot] 7cd1faf677 chore: update management.html to v1.7.16 2026-03-25 10:39:55 +00:00
github-actions[bot] 7c92aafcd5 chore: update management.html to v1.7.15 2026-03-22 16:19:25 +00:00
github-actions[bot] e482eb162d chore: update management.html to v1.7.14 2026-03-22 10:18:47 +00:00
github-actions[bot] 4a03ed3ef3 chore: update management.html to v1.7.13 2026-03-21 13:36:26 +00:00
github-actions[bot] 2a856254df chore: update management.html to v1.7.12 2026-03-17 16:59:51 +00:00
github-actions[bot] f952215f7f chore: update management.html to v1.7.11 2026-03-16 19:48:28 +00:00
github-actions[bot] 59842da1fb chore: update management.html to v1.7.10 2026-03-15 11:18:49 +00:00
Ttungx f0cf3e21b3 upgrade actions/checkout to v5 for Node.js 24 support 2026-03-14 23:11:54 +08:00
Ttungx c9c65445ce Merge branch 'main' of https://github.com/Ttungx/codex_auto_register
111
2026-03-14 23:08:10 +08:00
Ttungx 3d2c78d80f add gh_token to fix actions failure 2026-03-14 23:07:48 +08:00
github-actions[bot] 41115a706d chore: update management.html to v1.7.9 2026-03-14 08:25:20 +00:00
github-actions[bot] 6a8873669b chore: update management.html to v1.7.8 2026-03-13 05:41:41 +00:00
Nooo b431c4af3d update README 2026-03-09 21:55:46 +08:00
Nooo 4f8478294a Merge pull request #1 from Ttungx/copilot/add-github-action-update-management-html
feat: auto-update management.html from upstream releases via GitHub Actions
2026-03-09 15:17:03 +08:00
7 changed files with 149 additions and 251 deletions

No files matched your search

@@ -1,63 +0,0 @@
name: Update management.html
on:
schedule:
- cron: '0 * * * *' # Run every hour
workflow_dispatch: # Allow manual trigger
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get latest release info
id: release
run: |
RELEASE=$(curl -sf https://api.github.com/repos/router-for-me/Cli-Proxy-API-Management-Center/releases/latest)
TAG=$(echo "$RELEASE" | jq -r '.tag_name')
DOWNLOAD_URL=$(echo "$RELEASE" | jq -r '.assets[] | select(.name == "management.html") | .browser_download_url')
if [ -z "$TAG" ] || [ "$TAG" = "null" ]; then
echo "Error: could not retrieve release tag from upstream repository." >&2
exit 1
fi
if [ -z "$DOWNLOAD_URL" ] || [ "$DOWNLOAD_URL" = "null" ]; then
echo "Error: management.html asset not found in release $TAG." >&2
exit 1
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "download_url=$DOWNLOAD_URL" >> "$GITHUB_OUTPUT"
- name: Check current version
id: check
run: |
CURRENT_TAG=$(cat .management-html-version 2>/dev/null | tr -d '[:space:]' || echo "none")
echo "current_tag=$CURRENT_TAG" >> "$GITHUB_OUTPUT"
if [ "$CURRENT_TAG" != "${{ steps.release.outputs.tag }}" ]; then
echo "needs_update=true" >> "$GITHUB_OUTPUT"
else
echo "needs_update=false" >> "$GITHUB_OUTPUT"
fi
- name: Download management.html
if: steps.check.outputs.needs_update == 'true'
run: |
curl -fL "${{ steps.release.outputs.download_url }}" -o management.html
- name: Update version tracker
if: steps.check.outputs.needs_update == 'true'
run: |
echo "${{ steps.release.outputs.tag }}" > .management-html-version
- name: Commit and push changes
if: steps.check.outputs.needs_update == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add management.html .management-html-version
git commit -m "chore: update management.html to ${{ steps.release.outputs.tag }}"
git push
+2
View File
@@ -1,3 +1,5 @@
.claude
__pycache__/
*.py[cod]
*.pyo
-1
View File
@@ -1 +0,0 @@
v1.7.7
+7 -2
View File
@@ -1,6 +1,11 @@
# codex_auto_register
基于 DuckMail 的 ChatGPT / Codex 自动注册与 OAuth Token 生成工具集。
[English](README_EN.md) | 简体中文
For updates, bug reports, and more Web3/AI tools, join our official developer community: [Telegram 社群](https://t.me/+inDiCrZ6ZeZiODQx)
>⚠️ **免责声明**:本项目仅供学习和研究使用,不得用于任何商业用途。使用本项目所产生的一切后果由使用者自行承担。
## 致谢
@@ -17,7 +22,7 @@
- `chatgpt_register.py`:根目录下的 DuckMail 注册脚本
- `codex/protocol_keygen.py`:纯 HTTP 的 Codex OAuth 注册与 token 生成脚本
- `duckmaildoc.md`:DuckMail API 参考文档(https://raw.githubusercontent.com/MoonWeSif/DuckMail/main/public/llm-api-docs.txt)
- [management.html](https://github.com/router-for-me/Cli-Proxy-API-Management-Center/releases)
- [management.html](https://github.com/router-for-me/Cli-Proxy-API-Management-Center/releases)(自动更新)
## 环境依赖
+140
View File
@@ -0,0 +1,140 @@
<p><strong style="color:red;">⚠ 🚨 [DEPRECATED] V1 is no longer maintained due to API changes. <p>🔥 V2 (Working & Undetected) is currently closed-source and exclusively available in our community. <p>👉 Join our TG/Discord (HNUDAO Dev) to get API access: <a href="https://t.me/+inDiCrZ6ZeZiODQx">https://t.me/+inDiCrZ6ZeZiODQx</a></strong></p>
# codex_auto_register
English | [简体中文](README.md)
This is an automated OAuth authorization testing tool built on the DuckMail API. It is designed for researching high-concurrency AI API calls and identity verification mechanisms. This tool is maintained and developed by the [HNU Blockchain Association](https://github.com/HNUDAO).
For updates, bug reports, and more Web3/AI tools, join our official developer community: [Telegram Community](https://t.me/+inDiCrZ6ZeZiODQx)
## Sponsor HNU Blockchain Association
| Tier | Price | Benefits |
| --- | --- | --- |
| Silver Sponsor | 100U/month | Logo at the bottom of README + display on the association website |
| Gold Sponsor | 300U/month | Prominent position in the middle of README + mentor slot on the association website |
| Diamond Sponsor | 500U/month | Exclusive top placement in README + association WeChat official account post + pinned GitHub Discussion |
> WARNING: This project is for learning and research purposes only and must not be used for any commercial purpose. Users are solely responsible for all consequences arising from the use of this project.
## Credits
This project is adapted from the original project: https://github.com/adminlove520/chatgpt_register
Main differences in this repository:
- Replaced the original Codex registration email service with the DuckMail API.
- Preserved and extended the Codex protocol OAuth flow.
- Outputs Codex auth files recognizable by CLIProxyAPI v6.
## Contents
- `chatgpt_register.py`: DuckMail registration script in the repository root.
- `codex/protocol_keygen.py`: Pure HTTP Codex OAuth registration and token generation script.
- `duckmaildoc.md`: DuckMail API reference documentation (https://raw.githubusercontent.com/MoonWeSif/DuckMail/main/public/llm-api-docs.txt).
- [management.html](https://github.com/router-for-me/Cli-Proxy-API-Management-Center/releases) (auto update).
## Requirements
Root script:
```bash
pip install curl_cffi
```
Codex script:
```bash
pip install requests urllib3
```
## Configuration
This repository only commits example configuration files and does not include real configuration.
Before use, copy the examples:
```bash
copy config.example.json config.json
copy codex\config.example.json codex\config.json
```
Then fill in your own DuckMail, proxy, and CPA parameters.
## Root Script
Run:
```bash
python chatgpt_register.py
```
See `config.example.json` for the example configuration.
Main configuration items:
| Config Item | Description |
| --- | --- |
| total_accounts | Number of accounts to register |
| duckmail_api_base | DuckMail API address |
| duckmail_bearer | DuckMail Bearer Token |
| proxy | HTTP/HTTPS proxy |
| output_file | Registration result output file |
| enable_oauth | Whether to run OAuth |
| oauth_required | Whether OAuth success is required |
| upload_api_url | Optional API endpoint for uploading to CPA |
| upload_api_token | Optional CPA management API token |
## Codex Protocol Script
Run:
```bash
python codex\protocol_keygen.py
```
See `codex/config.example.json` for the example configuration.
This script will:
- Create temporary email addresses with DuckMail.
- Complete the ChatGPT registration flow.
- Execute Codex OAuth login and exchange it for a token.
- Generate token JSON files with CLIProxyAPI v6-compatible filenames.
- Optionally upload results to the CPA management API.
## Output Files
The following local files are usually generated during execution. They are already included in `.gitignore` and will not be committed to the repository:
- `config.json`
- `codex/config.json`
- `registered_accounts.txt`
- `codex/accounts.txt`
- `codex/ak.txt`
- `codex/rk.txt`
- `codex/registered_accounts.csv`
- `codex/codex_tokens/`
- `codex/codex_accounts_tokens/`
## Repository Structure
```text
chatgpt_register/
├── chatgpt_register.py
├── config.example.json
├── duckmaildoc.md
├── README.md
└── codex/
├── config.example.json
├── protocol_keygen.py
└── README.md
```
## Notes
- A working proxy is required. Otherwise, registration, OAuth, and CPA auto-refresh may fail.
- `config.json` and `codex/config.json` should only be kept locally and should not be committed.
- If you use CLIProxyAPI, it is recommended to keep the `refresh_token` and token JSON files intact.
Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

-185
View File
@@ -1,185 +0,0 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20aria-hidden%3D%22true%22%20role%3D%22img%22%20class%3D%22iconify%20iconify--logos%22%20width%3D%2231.88%22%20height%3D%2232%22%20preserveAspectRatio%3D%22xMidYMid%20meet%22%20viewBox%3D%220%200%20256%20257%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22IconifyId1813088fe1fbc01fb466%22%20x1%3D%22-.828%25%22%20x2%3D%2257.636%25%22%20y1%3D%227.652%25%22%20y2%3D%2278.411%25%22%3E%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%2341D1FF%22%3E%3C%2Fstop%3E%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%23BD34FE%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3ClinearGradient%20id%3D%22IconifyId1813088fe1fbc01fb467%22%20x1%3D%2243.376%25%22%20x2%3D%2250.316%25%22%20y1%3D%222.242%25%22%20y2%3D%2289.03%25%22%3E%3Cstop%20offset%3D%220%25%22%20stop-color%3D%22%23FFEA83%22%3E%3C%2Fstop%3E%3Cstop%20offset%3D%228.333%25%22%20stop-color%3D%22%23FFDD35%22%3E%3C%2Fstop%3E%3Cstop%20offset%3D%22100%25%22%20stop-color%3D%22%23FFA800%22%3E%3C%2Fstop%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cpath%20fill%3D%22url(%23IconifyId1813088fe1fbc01fb466)%22%20d%3D%22M255.153%2037.938L134.897%20252.976c-2.483%204.44-8.862%204.466-11.382.048L.875%2037.958c-2.746-4.814%201.371-10.646%206.827-9.67l120.385%2021.517a6.537%206.537%200%200%200%202.322-.004l117.867-21.483c5.438-.991%209.574%204.796%206.877%209.62Z%22%3E%3C%2Fpath%3E%3Cpath%20fill%3D%22url(%23IconifyId1813088fe1fbc01fb467)%22%20d%3D%22M185.432.063L96.44%2017.501a3.268%203.268%200%200%200-2.634%203.014l-5.474%2092.456a3.268%203.268%200%200%200%203.997%203.378l24.777-5.718c2.318-.535%204.413%201.507%203.936%203.838l-7.361%2036.047c-.495%202.426%201.782%204.5%204.151%203.78l15.304-4.649c2.372-.72%204.652%201.36%204.15%203.788l-11.698%2056.621c-.732%203.542%203.979%205.473%205.943%202.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505%204.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CLI Proxy API Management Center</title>
<script type="module" crossorigin>var UB=Object.defineProperty;var BB=(t,e,n)=>e in t?UB(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Ct=(t,e,n)=>BB(t,typeof e!="symbol"?e+"":e,n);function IB(t,e){for(var n=0;n<e.length;n++){const i=e[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in t)){const a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function oj(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yx={exports:{}},vh={};var bN;function qB(){if(bN)return vh;bN=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,s,a){var o=null;if(a!==void 0&&(o=""+a),s.key!==void 0&&(o=""+s.key),"key"in s){a={};for(var r in s)r!=="key"&&(a[r]=s[r])}else a=s;return s=a.ref,{$$typeof:t,type:i,key:o,ref:s!==void 0?s:null,props:a}}return vh.Fragment=e,vh.jsx=n,vh.jsxs=n,vh}var xN;function zB(){return xN||(xN=1,Yx.exports=qB()),Yx.exports}var f=zB(),Zx={exports:{}},wt={};var vN;function KB(){if(vN)return wt;vN=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),r=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.activity"),g=Symbol.iterator;function y(R){return R===null||typeof R!="object"?null:(R=g&&R[g]||R["@@iterator"],typeof R=="function"?R:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,v={};function A(R,B,$){this.props=R,this.context=B,this.refs=v,this.updater=$||b}A.prototype.isReactComponent={},A.prototype.setState=function(R,B){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,B,"setState")},A.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function C(){}C.prototype=A.prototype;function T(R,B,$){this.props=R,this.context=B,this.refs=v,this.updater=$||b}var L=T.prototype=new C;L.constructor=T,x(L,A.prototype),L.isPureReactComponent=!0;var N=Array.isArray;function O(){}var M={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function j(R,B,$){var te=$.ref;return{$$typeof:t,type:R,key:B,ref:te!==void 0?te:null,props:$}}function D(R,B){return j(R.type,B,R.props)}function F(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function U(R){var B={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function($){return B[$]})}var W=/\/+/g;function Y(R,B){return typeof R=="object"&&R!==null&&R.key!=null?U(""+R.key):B.toString(36)}function Z(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(O,O):(R.status="pending",R.then(function(B){R.status==="pending"&&(R.status="fulfilled",R.value=B)},function(B){R.status==="pending"&&(R.status="rejected",R.reason=B)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function I(R,B,$,te,Q){var V=typeof R;(V==="undefined"||V==="boolean")&&(R=null);var ne=!1;if(R===null)ne=!0;else switch(V){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(R.$$typeof){case t:case e:ne=!0;break;case h:return ne=R._init,I(ne(R._payload),B,$,te,Q)}}if(ne)return Q=Q(R),ne=te===""?"."+Y(R,0):te,N(Q)?($="",ne!=null&&($=ne.replace(W,"$&/")+"/"),I(Q,B,$,"",function(he){return he})):Q!=null&&(F(Q)&&(Q=D(Q,$+(Q.key==null||R&&R.key===Q.key?"":(""+Q.key).replace(W,"$&/")+"/")+ne)),B.push(Q)),1;ne=0;var J=te===""?".":te+":";if(N(R))for(var oe=0;oe<R.length;oe++)te=R[oe],V=J+Y(te,oe),ne+=I(te,B,$,V,Q);else if(oe=y(R),typeof oe=="function")for(R=oe.call(R),oe=0;!(te=R.next()).done;)te=te.value,V=J+Y(te,oe++),ne+=I(te,B,$,V,Q);else if(V==="object"){if(typeof R.then=="function")return I(Z(R),B,$,te,Q);throw B=String(R),Error("Objects are noLine truncated
at`)?" (<anonymous>)":-1<m.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Ce+l+at}var Bt=!1;function Re(l,d){if(!l||Bt)return"";Bt=!0;var m=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var _={DetermineComponentFrameRoot:function(){try{if(d){var Ne=function(){throw Error()};if(Object.defineProperty(Ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ne,[])}catch(xe){var ye=xe}Reflect.construct(l,[],Ne)}else{try{Ne.call()}catch(xe){ye=xe}l.call(Ne.prototype)}}else{try{throw Error()}catch(xe){ye=xe}(Ne=l())&&typeof Ne.catch=="function"&&Ne.catch(function(){})}}catch(xe){if(xe&&ye&&typeof xe.stack=="string")return[xe.stack,ye.stack]}return[null,null]}};_.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var S=Object.getOwnPropertyDescriptor(_.DetermineComponentFrameRoot,"name");S&&S.configurable&&Object.defineProperty(_.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var k=_.DetermineComponentFrameRoot(),P=k[0],z=k[1];if(P&&z){var ie=P.split(`
`),ge=z.split(`
`);for(S=_=0;_<ie.length&&!ie[_].includes("DetermineComponentFrameRoot");)_++;for(;S<ge.length&&!ge[S].includes("DetermineComponentFrameRoot");)S++;if(_===ie.length||S===ge.length)for(_=ie.length-1,S=ge.length-1;1<=_&&0<=S&&ie[_]!==ge[S];)S--;for(;1<=_&&0<=S;_--,S--)if(ie[_]!==ge[S]){if(_!==1||S!==1)do if(_--,S--,0>S||ie[_]!==ge[S]){var we=`
`+ie[_].replace(" at new "," at ");return l.displayName&&we.includes("<anonymous>")&&(we=we.replace("<anonymous>",l.displayName)),we}while(1<=_&&0<=S);break}}}finally{Bt=!1,Error.prepareStackTrace=m}return(m=l?l.displayName||l.name:"")?vt(m):""}function Ye(l,d){switch(l.tag){case 26:case 27:case 5:return vt(l.type);case 16:return vt("Lazy");case 13:return l.child!==d&&d!==null?vt("Suspense Fallback"):vt("Suspense");case 19:return vt("SuspenseList");case 0:case 15:return Re(l.type,!1);case 11:return Re(l.type.render,!1);case 1:return Re(l.type,!0);case 31:return vt("Activity");default:return""}}function Lt(l){try{var d="",m=null;do d+=Ye(l,m),m=l,l=l.return;while(l);return d}catch(_){return`
Error generating stack: `+_.message+`
`+_.stack}}var me=Object.prototype.hasOwnProperty,Ie=t.unstable_scheduleCallback,$e=t.unstable_cancelCallback,lt=t.unstable_shouldYield,le=t.unstable_requestPaint,_e=t.unstable_now,Le=t.unstable_getCurrentPriorityLevel,Ze=t.unstable_ImmediatePriority,St=t.unstable_UserBlockingPriority,bt=t.unstable_NormalPriority,_t=t.unstable_LowPriority,cn=t.unstable_IdlePriority,ce=t.log,He=t.unstable_setDisableYieldValue,jt=null,Dt=null;function Tn(l){if(typeof ce=="function"&&He(l),Dt&&typeof Dt.setStrictMode=="function")try{Dt.setStrictMode(jt,l)}catch{}}var Ln=Math.clz32?Math.clz32:Cs,Ri=Math.log,ba=Math.LN2;function Cs(l){return l>>>=0,l===0?32:31-(Ri(l)/ba|0)|0}var pi=256,rs=262144,Xi=4194304;function As(l){var d=l&42;if(d!==0)return d;switch(l&-l){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return l&261888;case 262144:case 524288:case 1048576:case 2097152:return l&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return l&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return l}}function xa(l,d,m){var _=l.pendingLanes;if(_===0)return 0;var S=0,k=l.suspendedLanes,P=l.pingedLanes;l=l.warmLanes;var z=_&134217727;return z!==0?(_=z&~k,_!==0?S=As(_):(P&=z,P!==0?S=As(P):m||(m=z&~l,m!==0&&(S=As(m))))):(z=_&~k,z!==0?S=As(z):P!==0?S=As(P):m||(m=_&~l,m!==0&&(S=As(m)))),S===0?0:d!==0&&d!==S&&(d&k)===0&&(k=S&-S,m=d&-d,k>=m||k===32&&(m&4194048)!==0)?d:S}function va(l,d){return(l.pendingLanes&~(l.suspendedLanes&~l.pingedLanes)&d)===0}function Ae(l,d){switch(l){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Je(){var l=Xi;return Xi<<=1,(Xi&62914560)===0&&(Xi=4194304),l}function dt(l){for(var d=[],m=0;31>m;m++)d.push(l);return d}function un(l,d){l.pendingLanes|=d,d!==268435456&&(l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0)}function Sn(l,d,m,_,S,k){var P=l.pendingLanes;l.pendingLanes=m,l.suspendedLanes=0,l.pingedLanes=0,l.warmLanes=0,l.expiredLanes&=m,l.entangledLanes&=m,l.errorRecoveryDisabledLanes&=m,l.shellSuspendCounter=0;var z=l.entanglements,ie=l.expirationTimes,ge=l.hiddenUpdates;for(m=P&~m;0<m;){var we=31-Ln(m),Ne=1<<we;z[we]=0,ie[we]=-1;var ye=ge[we];if(ye!==null)for(ge[we]=null,we=0;we<ye.length;we++){var xe=ye[we];xe!==null&&(xe.lane&=-536870913)}m&=~Ne}_!==0&&Gn(l,_,0),k!==0&&S===0&&l.tag!==0&&(l.suspendedLanes|=k&~(P&~d))}function Gn(l,d,m){l.pendingLanes|=d,l.suspendedLanes&=~d;var _=31-Ln(d);l.entangledLanes|=d,l.entanglements[_]=l.entanglements[_]|1073741824|m&261930}function ee(l,d){var m=l.entangledLanes|=d;for(l=l.entanglements;m;){var _=31-Ln(m),S=1<<_;S&d|l[_]&d&&(l[_]|=d),m&=~S}}function ae(l,d){var m=d&-d;return m=(m&42)!==0?1:fe(m),(m&(l.suspendedLanes|d))!==0?0:m}function fe(l){switch(l){case 2:l=1;break;case 8:l=4;break;case 32:l=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:l=128;break;case 268435456:l=134217728;break;default:l=0}return l}function Te(l){return l&=-l,2<l?8<l?(l&134217727)!==0?32:268435456:8:2}function Ee(){var l=H.p;return l!==0?l:(l=window.event,l===void 0?32:hN(l.type))}function Ve(l,d){var m=H.p;try{return H.p=l,d()}finally{H.p=m}}var Fe=Math.random().toString(36).slice(2),je="__reactFiber$"+Fe,Be="__reactProps$"+Fe,We="__reactContainer$"+Fe,ot="__reactEvents$"+Fe,Qe="__reactListeners$"+Fe,Ft="__reactHandles$"+Fe,Et="__reactResources$"+Fe,gn="__reactMarker$"+Fe;function wn(l){delete l[je],delete l[Be],delete l[ot],delete l[Qe],delete l[Ft]}function Fn(l){var d=l[je];if(d)return d;for(var m=l.parentNode;m;){if(d=m[We]||m[je]){if(m=d.alternate,d.child!==null||m!==null&&m.child!==null)for(l=QT(l);l!==null;){if(m=l[je])return m;l=QT(l)}return d}l=m,m=l.parentNode}return null}function It(l){if(l=l[je]||l[We]){var d=l.tag;if(d===5||d===6||d===13||d===31||d===26||d===27||d===3)return l}return null}function Ue(l){var d=l.tag;if(d===5||d===26||d===27||d===6)return l.stateNode;throw Error(i(33))}function pt(l){var d=l[Et];return d||(d=l[Et]={hoistableStyles:new Map,hoistableScripts:new Map}),d}function ct(l){l[gn]=!0}var dn=new Set,Si={};function Sa(l,d){zs(l,d),zs(l+"Capture",d)}function zs(l,d){for(Si[l]=d,l=0;l<d.length;l++)dn.add(d[l])}var Co=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u2Line truncated
`).replace(oB,"")}function IT(l,d){return d=BT(d),BT(l)===d}function yn(l,d,m,_,S,k){switch(m){case"children":typeof _=="string"?d==="body"||d==="textarea"&&_===""||jc(l,_):(typeof _=="number"||typeof _=="bigint")&&d!=="body"&&jc(l,""+_);break;case"className":wa(l,"class",_);break;case"tabIndex":wa(l,"tabindex",_);break;case"dir":case"role":case"viewBox":case"width":case"height":wa(l,m,_);break;case"style":Ik(l,_,k);break;case"data":if(d!=="object"){wa(l,"data",_);break}case"src":case"href":if(_===""&&(d!=="a"||m!=="href")){l.removeAttribute(m);break}if(_==null||typeof _=="function"||typeof _=="symbol"||typeof _=="boolean"){l.removeAttribute(m);break}_=np(""+_),l.setAttribute(m,_);break;case"action":case"formAction":if(typeof _=="function"){l.setAttribute(m,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof k=="function"&&(m==="formAction"?(d!=="input"&&yn(l,d,"name",S.name,S,null),yn(l,d,"formEncType",S.formEncType,S,null),yn(l,d,"formMethod",S.formMethod,S,null),yn(l,d,"formTarget",S.formTarget,S,null)):(yn(l,d,"encType",S.encType,S,null),yn(l,d,"method",S.method,S,null),yn(l,d,"target",S.target,S,null)));if(_==null||typeof _=="symbol"||typeof _=="boolean"){l.removeAttribute(m);break}_=np(""+_),l.setAttribute(m,_);break;case"onClick":_!=null&&(l.onclick=Ao);break;case"onScroll":_!=null&&zt("scroll",l);break;case"onScrollEnd":_!=null&&zt("scrollend",l);break;case"dangerouslySetInnerHTML":if(_!=null){if(typeof _!="object"||!("__html"in _))throw Error(i(61));if(m=_.__html,m!=null){if(S.children!=null)throw Error(i(60));l.innerHTML=m}}break;case"multiple":l.multiple=_&&typeof _!="function"&&typeof _!="symbol";break;case"muted":l.muted=_&&typeof _!="function"&&typeof _!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(_==null||typeof _=="function"||typeof _=="boolean"||typeof _=="symbol"){l.removeAttribute("xlink:href");break}m=np(""+_),l.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",m);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":_!=null&&typeof _!="function"&&typeof _!="symbol"?l.setAttribute(m,""+_):l.removeAttribute(m);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":_&&typeof _!="function"&&typeof _!="symbol"?l.setAttribute(m,""):l.removeAttribute(m);break;case"capture":case"download":_===!0?l.setAttribute(m,""):_!==!1&&_!=null&&typeof _!="function"&&typeof _!="symbol"?l.setAttribute(m,_):l.removeAttribute(m);break;case"cols":case"rows":case"size":case"span":_!=null&&typeof _!="function"&&typeof _!="symbol"&&!isNaN(_)&&1<=_?l.setAttribute(m,_):l.removeAttribute(m);break;case"rowSpan":case"start":_==null||typeof _=="function"||typeof _=="symbol"||isNaN(_)?l.removeAttribute(m):l.setAttribute(m,_);break;case"popover":zt("beforetoggle",l),zt("toggle",l),Xn(l,"popover",_);break;case"xlinkActuate":wi(l,"http://www.w3.org/1999/xlink","xlink:actuate",_);break;case"xlinkArcrole":wi(l,"http://www.w3.org/1999/xlink","xlink:arcrole",_);break;case"xlinkRole":wi(l,"http://www.w3.org/1999/xlink","xlink:role",_);break;case"xlinkShow":wi(l,"http://www.w3.org/1999/xlink","xlink:show",_);break;case"xlinkTitle":wi(l,"http://www.w3.org/1999/xlink","xlink:title",_);break;case"xlinkType":wi(l,"http://www.w3.org/1999/xlink","xlink:type",_);break;case"xmlBase":wi(l,"http://www.w3.org/XML/1998/namespace","xml:base",_);break;case"xmlLang":wi(l,"http://www.w3.org/XML/1998/namespace","xml:lang",_);break;case"xmlSpace":wi(l,"http://www.w3.org/XML/1998/namespace","xml:space",_);break;case"is":Xn(l,"is",_);break;case"innerText":case"textContent":break;default:(!(2<m.length)||m[0]!=="o"&&m[0]!=="O"||m[1]!=="n"&&m[1]!=="N")&&(m=RF.get(m)||m,Xn(l,m,_))}}function Px(l,d,m,_,S,k){switch(m){case"style":Ik(l,_,k);break;case"dangerouslySetInnerHTML":if(_!=null){if(typeof _!="object"||!("__html"in _))throw Error(i(61));if(m=_.__html,m!=null){if(S.children!=null)throw Error(i(60));l.innerHTML=m}}break;case"children":typeof _=="string"?jc(l,_):(typeof _=="number"||typeof _=="bigint")&&jc(l,""+_);break;case"onScroll":_!=null&&zt("scroll",l);break;case"onScrollEnd":_!=null&&zt("scrollend",l);break;case"onClick":_!=null&&(l.onclick=Ao);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"inneLine truncated
`,""):String(n.body);return{path:e,submission:{formMethod:a,formAction:o,formEncType:n.formEncType,formData:void 0,json:void 0,text:p}}}else if(n.formEncType==="application/json"){if(!Fi(a))return i();try{let p=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:e,submission:{formMethod:a,formAction:o,formEncType:n.formEncType,formData:void 0,json:p,text:void 0}}}catch{return i()}}}Pt(typeof FormData=="function","FormData is not available in this environment");let r,c;if(n.formData)r=W1(n.formData),c=n.formData;else if(n.body instanceof FormData)r=W1(n.body),c=n.body;else if(n.body instanceof URLSearchParams)r=n.body,c=HN(r);else if(n.body==null)r=new URLSearchParams,c=new FormData;else try{r=new URLSearchParams(n.body),c=HN(r)}catch{return i()}let u={formMethod:a,formAction:o,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:c,json:void 0,text:void 0};if(Fi(u.formMethod))return{path:e,submission:u};let h=bo(e);return t&&h.search&&DS(h.search)&&r.append("index",""),h.search=`?${r}`,{path:po(h),submission:u}}function UN(t,e,n,i,s,a,o,r,c,u,h,p,g,y,b,x,v,A,C,T,L){let N=T?Fs(T[1])?T[1].error:T[1].data:void 0,O=s.createURL(a.location),M=s.createURL(c),E;if(h&&a.errors){let Z=Object.keys(a.errors)[0];E=o.findIndex(I=>I.route.id===Z)}else if(T&&Fs(T[1])){let Z=T[0];E=o.findIndex(I=>I.route.id===Z)-1}let j=T?T[1].statusCode:void 0,D=j&&j>=400,F={currentUrl:O,currentParams:a.matches[0]?.params||{},nextUrl:M,nextParams:o[0].params,...r,actionResult:N,actionStatus:j},U=bm(o),W=o.map((Z,I)=>{let{route:H}=Z,G=null;if(E!=null&&I>E?G=!1:H.lazy?G=!0:RS(H)?h?G=H1(H,a.loaderData,a.errors):BI(a.loaderData,a.matches[I],Z)&&(G=!0):G=!1,G!==null)return V1(n,i,t,U,Z,u,e,G);let X=!1;typeof L=="boolean"?X=L:D?X=!1:(p||O.pathname+O.search===M.pathname+M.search||O.search!==M.search||II(a.matches[I],Z))&&(X=!0);let K={...F,defaultShouldRevalidate:X},R=_f(Z,K);return V1(n,i,t,U,Z,u,e,R,K,L)}),Y=[];return b.forEach((Z,I)=>{if(h||!o.some(te=>te.route.id===Z.routeId)||y.has(I))return;let H=a.fetchers.get(I),G=H&&H.state!=="idle"&&H.data===void 0,X=$r(v,Z.path,A);if(!X){if(C&&G)return;Y.push({key:I,routeId:Z.routeId,path:Z.path,matches:null,match:null,request:null,controller:null});return}if(x.has(I))return;let K=k_(X,Z.path),R=new AbortController,B=Cu(s,Z.path,R.signal),$=null;if(g.has(I))g.delete(I),$=Bu(n,i,B,X,K,u,e);else if(G)p&&($=Bu(n,i,B,X,K,u,e));else{let te;typeof L=="boolean"?te=L:D?te=!1:te=p;let Q={...F,defaultShouldRevalidate:te};_f(K,Q)&&($=Bu(n,i,B,X,K,u,e,Q))}$&&Y.push({key:I,routeId:Z.routeId,path:Z.path,matches:$,match:K,request:B,controller:R})}),{dsMatches:W,revalidatingFetchers:Y}}function RS(t){return t.loader!=null||t.middleware!=null&&t.middleware.length>0}function H1(t,e,n){if(t.lazy)return!0;if(!RS(t))return!1;let i=e!=null&&t.id in e,s=n!=null&&n[t.id]!==void 0;return!i&&s?!1:typeof t.loader=="function"&&t.loader.hydrate===!0?!0:!i&&!s}function BI(t,e,n){let i=!e||n.route.id!==e.route.id,s=!t.hasOwnProperty(n.route.id);return i||s}function II(t,e){let n=t.route.path;return t.pathname!==e.pathname||n!=null&&n.endsWith("*")&&t.params["*"]!==e.params["*"]}function _f(t,e){if(t.route.shouldRevalidate){let n=t.route.shouldRevalidate(e);if(typeof n=="boolean")return n}return e.defaultShouldRevalidate}function BN(t,e,n,i,s,a){let o;if(t){let u=i[t];Pt(u,`No route found to patch children into: routeId = ${t}`),u.children||(u.children=[]),o=u.children}else o=n;let r=[],c=[];if(e.forEach(u=>{let h=o.find(p=>vj(u,p));h?c.push({existingRoute:h,newRoute:u}):r.push(u)}),r.length>0){let u=zf(r,s,[t||"_","patch",String(o?.length||"0")],i);o.push(...u)}if(a&&c.length>0)for(let u=0;u<c.length;u++){let{existingRoute:h,newRoute:p}=c[u],g=h,[y]=zf([p],s,[],{},!0);Object.assign(g,{element:y.element?y.element:g.element,errorElement:y.errorElement?y.errorElement:g.errorElement,hydrateFallbackElement:y.hydrateFallbackElement?y.hydrateFallbackElement:g.hydrateFallbackElement})}}function vj(t,e){return"id"in t&&"id"in e&&t.id===e.id?!0:t.index===e.index&&t.path===e.path&&t.caseSensitive===e.caseSensitive?(!t.children||t.children.length===0)&&(!e.children||e.children.length===0)?!0:t.children.every((n,i)=>e.children?.some(s=>vj(n,s))):!1}var IN=new WeakMap,Sj=({key:t,route:e,manifest:n,mapRouteProperties:i})=>{let s=n[e.id];if(Pt(s,"No route found in manifest"),!s.lazy||typeof s.lazy!="object")return;let a=s.lazy[t];if(!a)return;let o=IN.get(s);o||(o={},IN.set(s,o));let r=o[t];if(r)return r;let c=(async()=>{let u=iI(t),p=s[t]!==void 0&&t!=="hasErrorBoundary";if(u)qn(!u,"Route property "+t+" is not a supported lazy route property. This property will be ignored."),o[t]=Promise.resolve();else if(p)qn(!1,`Route "${s.id}" has a static property "${t}" defined. The lazy property will be ignored.`);else{let g=await a();g!=null&&(Object.assign(s,{[t]:g}),Object.assign(s,i(s)))}typeof s.lazy=="object"&&(s.lazy[t]=void 0,Object.values(s.lazy).every(g=>g===void 0)&&(s.lazy=void 0))})();return o[t]=c,c},qN=new WeakMLine truncated
Please change the parent <Route path="${C}"> to <Route path="${C==="/"?"*":`${C}/*`}">.`)}let g=Kn(),y;if(e){let C=typeof e=="string"?bo(e):e;Pt(h==="/"||C.pathname?.startsWith(h),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${h}" but pathname "${C.pathname}" was given in the \`location\` prop.`),y=C}else y=g;let b=y.pathname||"/",x=b;if(h!=="/"){let C=h.replace(/^\//,"").split("/");x="/"+b.replace(/^\//,"").split("/").slice(C.length).join("/")}let v=$r(t,{pathname:x});qn(p||v!=null,`No routes matched location "${y.pathname}${y.search}${y.hash}" `),qn(v==null||v[v.length-1].route.element!==void 0||v[v.length-1].route.Component!==void 0||v[v.length-1].route.lazy!==void 0,`Matched leaf route at location "${y.pathname}${y.search}${y.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=S7(v&&v.map(C=>Object.assign({},C,{params:Object.assign({},c,C.params),pathname:ho([h,a.encodeLocation?a.encodeLocation(C.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathname]),pathnameBase:C.pathnameBase==="/"?h:ho([h,a.encodeLocation?a.encodeLocation(C.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:C.pathnameBase])})),o,n,i,s);return e&&A?w.createElement(vm.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...y},navigationType:"POP"}},A):A}function y7(){let t=C7(),e=Kf(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:i},a={padding:"2px 4px",backgroundColor:i},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=w.createElement(w.Fragment,null,w.createElement("p",null,"💿 Hey developer 👋"),w.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",w.createElement("code",{style:a},"ErrorBoundary")," or"," ",w.createElement("code",{style:a},"errorElement")," prop on your route.")),w.createElement(w.Fragment,null,w.createElement("h2",null,"Unexpected Application Error!"),w.createElement("h3",{style:{fontStyle:"italic"}},e),n?w.createElement("pre",{style:s},n):null,o)}var b7=w.createElement(y7,null),Rj=class extends w.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=f7(t.digest);n&&(t=n)}let e=t!==void 0?w.createElement(pa.Provider,{value:this.props.routeContext},w.createElement(US.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?w.createElement(x7,{error:t},e):e}};Rj.contextType=Tj;var rv=new WeakMap;function x7({children:t,error:e}){let{basename:n}=w.useContext(qs);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let i=h7(e.digest);if(i){let s=rv.get(e);if(s)throw s;let a=pj(i.location,n);if(mj&&!rv.get(e))if(a.isExternal||i.reloadDocument)window.location.href=a.absoluteURL||a.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:i.replace}));throw rv.set(e,o),o}return w.createElement("meta",{httpEquiv:"refresh",content:`0;url=${a.absoluteURL||a.to}`})}}return t}function v7({routeContext:t,match:e,children:n}){let i=w.useContext(Ac);return i&&i.static&&i.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=e.route.id),w.createElement(pa.Provider,{value:t},n)}function S7(t,e=[],n=null,i=null,s=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let a=t,o=n?.errors;if(o!=null){let h=a.findIndex(p=>p.route.id&&o?.[p.route.id]!==void 0);Pt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),a=a.slice(0,Math.min(a.length,h+1))}let r=!1,c=-1;if(n)for(let h=0;h<a.length;h++){let p=a[h];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(c=h),p.route.id){let{loaderData:g,errors:y}=n,b=p.route.loader&&!g.hasOwnProperty(p.route.id)&&(!y||y[p.route.id]===void 0);if(p.route.lazy||b){r=!0,c>=0?a=a.slice(0,c+1):a=[a[0]];break}}}Line truncated
`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),i=o.substring(s+1).trim(),!(!n||e[n]&&JH[n])&&(n==="set-cookie"?e[n]?e[n].push(i):e[n]=[i]:e[n]=e[n]?e[n]+", "+i:i)}),e},jM=Symbol("internals");function Th(t){return t&&String(t).trim().toLowerCase()}function L_(t){return t===!1||t==null?t:be.isArray(t)?t.map(L_):String(t)}function tV(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=n.exec(t);)e[i[1]]=i[2];return e}const nV=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function pv(t,e,n,i,s){if(be.isFunction(i))return i.call(this,e,n);if(s&&(e=n),!!be.isString(e)){if(be.isString(i))return e.indexOf(i)!==-1;if(be.isRegExp(i))return i.test(e)}}function iV(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,i)=>n.toUpperCase()+i)}function sV(t,e){const n=be.toCamelCase(" "+e);["get","set","has"].forEach(i=>{Object.defineProperty(t,i+n,{value:function(s,a,o){return this[i].call(this,e,s,a,o)},configurable:!0})})}let vs=class{constructor(e){e&&this.set(e)}set(e,n,i){const s=this;function a(r,c,u){const h=Th(c);if(!h)throw new Error("header name must be a non-empty string");const p=be.findKey(s,h);(!p||s[p]===void 0||u===!0||u===void 0&&s[p]!==!1)&&(s[p||c]=L_(r))}const o=(r,c)=>be.forEach(r,(u,h)=>a(u,h,c));if(be.isPlainObject(e)||e instanceof this.constructor)o(e,n);else if(be.isString(e)&&(e=e.trim())&&!nV(e))o(eV(e),n);else if(be.isObject(e)&&be.isIterable(e)){let r={},c,u;for(const h of e){if(!be.isArray(h))throw TypeError("Object iterator must return a key-value pair");r[u=h[0]]=(c=r[u])?be.isArray(c)?[...c,h[1]]:[c,h[1]]:h[1]}o(r,n)}else e!=null&&a(n,e,i);return this}get(e,n){if(e=Th(e),e){const i=be.findKey(this,e);if(i){const s=this[i];if(!n)return s;if(n===!0)return tV(s);if(be.isFunction(n))return n.call(this,s,i);if(be.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Th(e),e){const i=be.findKey(this,e);return!!(i&&this[i]!==void 0&&(!n||pv(this,this[i],i,n)))}return!1}delete(e,n){const i=this;let s=!1;function a(o){if(o=Th(o),o){const r=be.findKey(i,o);r&&(!n||pv(i,i[r],r,n))&&(delete i[r],s=!0)}}return be.isArray(e)?e.forEach(a):a(e),s}clear(e){const n=Object.keys(this);let i=n.length,s=!1;for(;i--;){const a=n[i];(!e||pv(this,this[a],a,e,!0))&&(delete this[a],s=!0)}return s}normalize(e){const n=this,i={};return be.forEach(this,(s,a)=>{const o=be.findKey(i,a);if(o){n[o]=L_(s),delete n[a];return}const r=e?iV(a):String(a).trim();r!==a&&delete n[a],n[r]=L_(s),i[r]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return be.forEach(this,(i,s)=>{i!=null&&i!==!1&&(n[s]=e&&be.isArray(i)?i.join(", "):i)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(`
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const i=new this(e);return n.forEach(s=>i.set(s)),i}static accessor(e){const i=(this[jM]=this[jM]={accessors:{}}).accessors,s=this.prototype;function a(o){const r=Th(o);i[r]||(sV(s,o),i[r]=!0)}return be.isArray(e)?e.forEach(a):a(e),this}};vs.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);be.reduceDescriptors(vs.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(i){this[n]=i}}});be.freezeMethods(vs);function gv(t,e){const n=this||Tm,i=e||n,s=vs.from(i.headers);let a=i.data;return be.forEach(t,function(r){a=r.call(n,a,s.normalize(),e?e.status:void 0)}),s.normalize(),a}function T3(t){return!!(t&&t.__CANCEL__)}let Nm=class extends yt{constructor(e,n,i){super(e??"canceled",yt.ERR_CANCELED,n,i),this.name="CanceledError",this.__CANCEL__=!0}};function N3(t,e,n){const i=n.config.validateStatus;!n.status||!i||i(n.status)?t(n):e(new yt("Request failed with status code "+n.status,[yt.ERR_BAD_REQUEST,yt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function aV(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function oV(t,e){t=t||10;const n=new Array(t),i=new Array(t);let s=0,a=0,o;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),h=i[a];o||(o=u),n[s]=c,i[s]=u;let p=a,g=0;for(;p!==s;)g+=n[p++],p=p%t;if(s=(s+1)%t,s===a&&(a=(a+1)%t),u-o<e)return;const y=h&&u-h;return y?Math.round(g*1e3/y):void 0}}function rV(t,e){let n=0,i=1e3/e,s,a;const o=(u,h=Date.now())=>{n=h,s=null,a&&(clearTimeout(a),a=null),t(...u)};return[(...u)=>{const h=Date.now(),p=h-n;p>=i?o(u,h):(s=u,a||(a=setTimeout(()=>{a=null,o(s)},i-p)))},()=>s&&o(s)]}const a0=(t,e,n=3)=>{let i=0;const s=oV(50,250);return rV(a=>{const o=a.loaded,r=a.lengthComputable?a.total:void 0,c=o-i,u=s(c),h=o<=r;i=o;const p={loaded:o,total:r,progress:r?o/r:void 0,bytes:c,rate:u||void 0,estimated:u&&r&&h?(r-o)/u:void 0,event:a,lengthComputable:r!=null,[e?"download":"upload"]:!0};t(p)},n)},DM=(t,e)=>{const n=t!=null;return[i=>e[0]({lengthComputable:n,total:t,loaded:i}),e[1]]},FM=t=>(...e)=>be.asap(()=>t(...e)),lV=Bi.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Bi.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Bi.origin),Bi.navigator&&/(msie|trident)/i.test(Bi.navigator.userAgent)):()=>!0,cV=Bi.hasStandardBrowserEnv?{write(t,e,n,i,s,a,o){if(typeof document>"u")return;const r=[`${t}=${encodeURIComponent(e)}`];be.isNumber(n)&&r.push(`expires=${new Date(n).toUTCString()}`),be.isString(i)&&r.push(`path=${i}`),be.isString(s)&&r.push(`domain=${s}`),a===!0&&r.push("secure"),be.isString(o)&&r.push(`SameSite=${o}`),document.cookie=r.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function uV(t){return typeof t!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function dV(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function M3(t,e,n){let i=!uV(e);return t&&(i||n==!1)?dV(t,e):e}const UM=t=>t instanceof vs?{...t}:t;function pc(t,e){e=e||{};const n={};function i(u,h,p,g){return be.isPlainObject(u)&&be.isPlainObject(h)?be.merge.call({caseless:g},u,h):be.isPlainObject(h)?be.merge({},h):be.isArray(h)?h.slice():h}function s(u,h,p,g){if(be.isUndefined(h)){if(!be.isUndefined(u))return i(void 0,u,p,g)}else return i(u,h,p,g)}function a(u,h){if(!be.isUndefined(h))return i(void 0,h)}function o(u,h){if(be.isUndefined(h)){if(!be.isUndefined(u))return i(void 0,u)}else return i(void 0,h)}function r(u,h,p){if(p in e)return i(u,h);if(p in t)return i(void 0,u)}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:r,headers:(u,h,p)=>s(UM(u),UM(h),p,!0)};return be.forEach(Object.keys({...t,...e}),function(h){if(h==="__proto__"||h==="constructor"||h==="prototype")return;const p=be.hasOwnProp(c,h)?c[h]:s,g=p(t[h],e[h],h);be.isUndefined(g)&&p!==r||(n[h]=g)}),n}const O3=t=>{const e=pc({},t);let{data:n,withXSRFToken:i,xsrfHeaderName:s,xsrfCookieName:a,headers:o,auth:r}=e;if(e.headers=o=vs.from(o),e.url=C3(M3(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),r&&o.set("Authorization","Basic "+btoa((r.username||"")+":"+(r.password?unescape(encodeURIComponent(r.password)):""))),be.isFormData(n)){if(Bi.hasStandardBrowserEnv||Bi.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Line truncated
`+o.map(HM).join(`
`):" "+HM(o[0]):"as no adapter specified";throw new yt("There is no suitable adapter to dispatch the request "+r,"ERR_NOT_SUPPORT")}return s}const E3={getAdapter:SV,adapters:iw};function _v(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Nm(null,t)}function VM(t){return _v(t),t.headers=vs.from(t.headers),t.data=gv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),E3.getAdapter(t.adapter||Tm.adapter,t)(t).then(function(i){return _v(t),i.data=gv.call(t,t.transformResponse,i),i.headers=vs.from(i.headers),i},function(i){return T3(i)||(_v(t),i&&i.response&&(i.response.data=gv.call(t,t.transformResponse,i.response),i.response.headers=vs.from(i.response.headers))),Promise.reject(i)})}const P3="1.13.5",ry={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{ry[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}});const WM={};ry.transitional=function(e,n,i){function s(a,o){return"[Axios v"+P3+"] Transitional option '"+a+"'"+o+(i?". "+i:"")}return(a,o,r)=>{if(e===!1)throw new yt(s(o," has been removed"+(n?" in "+n:"")),yt.ERR_DEPRECATED);return n&&!WM[o]&&(WM[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(a,o,r):!0}};ry.spelling=function(e){return(n,i)=>(console.warn(`${i} is likely a misspelling of ${e}`),!0)};function wV(t,e,n){if(typeof t!="object")throw new yt("options must be an object",yt.ERR_BAD_OPTION_VALUE);const i=Object.keys(t);let s=i.length;for(;s-- >0;){const a=i[s],o=e[a];if(o){const r=t[a],c=r===void 0||o(r,a,t);if(c!==!0)throw new yt("option "+a+" must be "+c,yt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new yt("Unknown option "+a,yt.ERR_BAD_OPTION)}}const E_={assertOptions:wV,validators:ry},Zs=E_.validators;let lc=class{constructor(e){this.defaults=e||{},this.interceptors={request:new RM,response:new RM}}async request(e,n){try{return await this._request(e,n)}catch(i){if(i instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const a=s.stack?s.stack.replace(/^.+\n/,""):"";try{i.stack?a&&!String(i.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(i.stack+=`
`+a):i.stack=a}catch{}}throw i}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=pc(this.defaults,n);const{transitional:i,paramsSerializer:s,headers:a}=n;i!==void 0&&E_.assertOptions(i,{silentJSONParsing:Zs.transitional(Zs.boolean),forcedJSONParsing:Zs.transitional(Zs.boolean),clarifyTimeoutError:Zs.transitional(Zs.boolean),legacyInterceptorReqResOrdering:Zs.transitional(Zs.boolean)},!1),s!=null&&(be.isFunction(s)?n.paramsSerializer={serialize:s}:E_.assertOptions(s,{encode:Zs.function,serialize:Zs.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),E_.assertOptions(n,{baseUrl:Zs.spelling("baseURL"),withXsrfToken:Zs.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=a&&be.merge(a.common,a[n.method]);a&&be.forEach(["delete","get","head","post","put","patch","common"],b=>{delete a[b]}),n.headers=vs.concat(o,a);const r=[];let c=!0;this.interceptors.request.forEach(function(x){if(typeof x.runWhen=="function"&&x.runWhen(n)===!1)return;c=c&&x.synchronous;const v=n.transitional||tw;v&&v.legacyInterceptorReqResOrdering?r.unshift(x.fulfilled,x.rejected):r.push(x.fulfilled,x.rejected)});const u=[];this.interceptors.response.forEach(function(x){u.push(x.fulfilled,x.rejected)});let h,p=0,g;if(!c){const b=[VM.bind(this),void 0];for(b.unshift(...r),b.push(...u),g=b.length,h=Promise.resolve(n);p<g;)h=h.then(b[p++],b[p++]);return h}g=r.length;let y=n;for(;p<g;){const b=r[p++],x=r[p++];try{y=b(y)}catch(v){x.call(this,v);break}}try{h=VM.call(this,y)}catch(b){return Promise.reject(b)}for(p=0,g=u.length;p<g;)h=h.then(u[p++],u[p++]);return h}getUri(e){e=pc(this.defaults,e);const n=M3(e.baseURL,e.url,e.allowAbsoluteUrls);return C3(n,e.params,e.paramsSerializer)}};be.forEach(["delete","get","head","options"],function(e){lc.prototype[e]=function(n,i){return this.request(pc(i||{},{method:e,url:n,data:(i||{}).data}))}});be.forEach(["post","put","patch"],function(e){function n(i){return function(a,o,r){return this.request(pc(r||{},{method:e,headers:i?{"Content-Type":"multipart/form-data"}:{},url:a,data:o}))}}lc.prototype[e]=n(),lc.prototype[e+"Form"]=n(!0)});let kV=class R3{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(a){n=a});const i=this;this.promise.then(s=>{if(!i._listeners)return;let a=i._listeners.length;for(;a-- >0;)i._listeners[a](s);i._listeners=null}),this.promise.then=s=>{let a;const o=new Promise(r=>{i.subscribe(r),a=r}).then(s);return o.cancel=function(){i.unsubscribe(a)},o},e(function(a,o,r){i.reason||(i.reason=new Nm(a,o,r),n(i.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=i=>{e.abort(i)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new R3(function(s){e=s}),cancel:e}}};function CV(t){return function(n){return t.apply(null,n)}}function AV(t){return be.isObject(t)&&t.isAxiosError===!0}const s2={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(s2).forEach(([t,e])=>{s2[e]=t});function j3(t){const e=new lc(t),n=m3(lc.prototype.request,e);return be.extend(n,lc.prototype,e,{allOwnKeys:!0}),be.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return j3(pc(t,s))},n}const zn=j3(Tm);zn.Axios=lc;zn.CanceledError=Nm;zn.CancelToken=kV;zn.isCancel=T3;zn.VERLine truncated
`):"",Y3=t=>{let e=String(t||"").trim();return e?(e=e.replace(/\/?v0\/management\/?$/i,""),e=e.replace(/\/+$/g,""),/^https?:\/\//i.test(e)||(e=`http://${e}`),e):""},fW=t=>{let e=String(t||"").trim();return e?(e=e.replace(/\/?v0\/management\/?$/i,""),e=e.replace(/\/+$/g,""),/^https?:\/\//i.test(e)||(e=`http://${e}`),e):"https://api.anthropic.com"},mW=t=>{const e=Y3(t);return e?`${e}/models`:""},oO=t=>{const e=Y3(t);return e?e.endsWith("/chat/completions")?e:`${e}/chat/completions`:""},pW=t=>{const e=fW(t);return e?e.endsWith("/v1/messages")?e:e.endsWith("/v1")?`${e}/messages`:`${e}/v1/messages`:""},Em=(t,e,n)=>{const i=e.bySource??{},s=is({apiKey:t,prefix:n});if(!s.length)return{success:0,failure:0};let a=0,o=0;return s.forEach(r=>{const c=i[r];c&&(a+=c.success,o+=c.failure)}),{success:a,failure:o}},gW=(t,e,n)=>{const i=e.bySource??{},s=new Set;is({prefix:n}).forEach(r=>s.add(r)),(t||[]).forEach(r=>{is({apiKey:r?.apiKey}).forEach(c=>s.add(c))});let a=0,o=0;return s.forEach(r=>{const c=i[r];c&&(a+=c.success,o+=c.failure)}),{success:a,failure:o}},zu=t=>({apiKey:"",proxyUrl:"",headers:{}}),_W=t=>!Array.isArray(t)||t.length===0?[{name:"",alias:""}]:t.map(e=>({name:e.from??"",alias:e.to??""})),yW=t=>{const e=new Set,n=[];return t.forEach(i=>{const s=i.name.trim(),a=i.alias.trim();if(!s||!a)return;const o=s.toLowerCase();e.has(o)||(e.add(o),n.push({from:s,to:a}))}),n},xg=t=>({upstreamUrl:t?.upstreamUrl??"",upstreamApiKey:"",forceModelMappings:t?.forceModelMappings??!1,mappingEntries:_W(t?.modelMappings)}),vg=(t,e)=>typeof t=="function"?t(e):t,bW=()=>({name:"",prefix:"",baseUrl:"",headers:[],apiKeyEntries:[zu()],modelEntries:[{name:"",alias:""}],testModel:void 0}),Ko=()=>({initialized:!1,baselineSignature:"",form:bW(),testModel:"",testStatus:"idle",testMessage:"",keyTestStatuses:[]}),Ta=xo((t,e)=>({drafts:{},refCounts:{},acquireDraft:n=>{n&&t(i=>{const s=i.drafts[n],a=i.refCounts[n]??0;return{drafts:s?i.drafts:{...i.drafts,[n]:Ko()},refCounts:{...i.refCounts,[n]:a+1}}})},releaseDraft:n=>{n&&t(i=>{const s=i.refCounts[n];if(!s)return i;if(s>1)return{refCounts:{...i.refCounts,[n]:s-1}};const a={...i.refCounts};delete a[n];const o={...i.drafts};return delete o[n],{refCounts:a,drafts:o}})},ensureDraft:n=>{!n||e().drafts[n]||t(s=>({drafts:{...s.drafts,[n]:Ko()}}))},initDraft:(n,i)=>{!n||e().drafts[n]?.initialized||t(a=>({drafts:{...a.drafts,[n]:{...i,initialized:!0}}}))},setDraftBaselineSignature:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Ko();return{drafts:{...s.drafts,[n]:{...a,initialized:!0,baselineSignature:i}}}})},setDraftForm:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Ko(),o=vg(i,a.form);return{drafts:{...s.drafts,[n]:{...a,initialized:!0,form:o}}}})},setDraftTestModel:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Ko(),o=vg(i,a.testModel);return{drafts:{...s.drafts,[n]:{...a,initialized:!0,testModel:o}}}})},setDraftTestStatus:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Ko(),o=vg(i,a.testStatus);return{drafts:{...s.drafts,[n]:{...a,initialized:!0,testStatus:o}}}})},setDraftTestMessage:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Ko(),o=vg(i,a.testMessage);return{drafts:{...s.drafts,[n]:{...a,initialized:!0,testMessage:o}}}})},setDraftKeyTestStatus:(n,i,s)=>{n&&t(a=>{const o=a.drafts[n]??Ko(),r=[...o.keyTestStatuses];return r[i]=s,{drafts:{...a.drafts,[n]:{...o,initialized:!0,keyTestStatuses:r}}}})},resetDraftKeyTestStatuses:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Ko();return{drafts:{...s.drafts,[n]:{...a,initialized:!0,keyTestStatuses:Array.from({length:i},()=>({status:"idle",message:""}))}}}})},clearDraft:n=>{n&&t(i=>{if(!i.drafts[n]&&!i.refCounts[n])return i;const s={...i.drafts};delete s[n];const a={...i.refCounts};return delete a[n],{drafts:s,refCounts:a}})}})),Sg=(t,e)=>typeof t=="function"?t(e):t,xW=()=>({apiKey:"",prefix:"",baseUrl:"",proxyUrl:"",headers:[],models:[],excludedModels:[],modelEntries:[{name:"",alias:""}],excludedText:""}),Dl=()=>({initialized:!1,baselineSignature:"",form:xW(),testModel:"",testStatus:"idle",testMessage:""}),Ho=xo((t,e)=>({drafts:{},refCounts:{},acquireDraft:n=>{n&&t(i=>{const s=i.drafts[n],a=i.refCounts[n]??0;return{drafts:s?i.drafts:{...i.drafts,[n]:Dl()},refCounts:{...i.refCounts,[n]:a+1}}})},releaseDraft:n=>{n&&t(i=>{const s=i.refCounts[n];if(!s)return i;if(s>1)return{refCounts:{...i.refCounts,[n]:s-1}};const a={...i.refCounts};delete a[n];const o={...i.drafts};return delete o[n],{refCounts:a,drafts:o}})},ensureDraft:n=>{!n||e().drafts[n]||t(s=>({drafts:{...s.drafts,[n]:Dl()}}))},initDraft:(n,i)=>{!n||e().drafts[n]?.initialized||t(a=>({drafts:{...a.drafts,[n]:{...i,initialized:!0}}}))},setDraftBaselineSignature:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Dl();return{drafts:{...s.drafts,[n]:{...a,initialized:!0,baselineSignature:i}}}})},setDraftForm:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Dl(),o=Sg(i,a.form);return{drafts:{...s.drafts,[n]:{...a,initialized:!0,form:o}}}})},setDraftTestModel:(n,i)=>{n&&t(s=>{const a=s.drafts[n]??Dl(),o=Sg(i,a.testModel);return{drafts:{...s.drafts,[n]:{...a,initialized:!0,testModel:o}}Line truncated
`),onChange:H=>{const G=Q3(H.target.value);h(X=>({...X,cloak:{...X.cloak??{},sensitiveWords:G.length?G:void 0}}))},rows:3,disabled:c||o||O}),f.jsx("div",{className:"hint",children:t("ai_providers.claude_cloak_sensitive_words_hint")})]})]}):null]})]})})})}const vY=t=>t instanceof Error?t.message:typeof t=="string"?t:"";function PO(){const{t}=et(),e=vi(),{disableControls:n,loading:i,saving:s,form:a,mergeDiscoveredModels:o}=Y0(),[r,c]=w.useState(""),[u,h]=w.useState([]),[p,g]=w.useState(!1),[y,b]=w.useState(""),[x,v]=w.useState(""),[A,C]=w.useState(new Set),T=w.useRef(""),L=w.useMemo(()=>{const F=x.trim().toLowerCase();return F?u.filter(U=>{const W=(U.name||"").toLowerCase(),Y=(U.alias||"").toLowerCase(),Z=(U.description||"").toLowerCase();return W.includes(F)||Y.includes(F)||Z.includes(F)}):u},[u,x]),N=w.useCallback(async()=>{g(!0),b("");const F=ns(a.headers);try{const U=await hr.fetchClaudeModelsViaApiCall(a.baseUrl??"",a.apiKey.trim()||void 0,F);h(U)}catch(U){h([]);const W=vY(U),Y=Object.keys(F).some(G=>G.toLowerCase()==="x-api-key"),Z=Object.keys(F).some(G=>G.toLowerCase()==="authorization"),H=W.toLowerCase().includes("x-api-key")||W.includes("401")?` [diag: apiKeyField=${a.apiKey.trim()?"yes":"no"}, customXApiKey=${Y?"yes":"no"}, customAuthorization=${Z?"yes":"no"}]`:"";b(`${t("ai_providers.claude_models_fetch_error")}: ${W}${H}`)}finally{g(!1)}},[a.apiKey,a.baseUrl,a.headers,t]);w.useEffect(()=>{if(i)return;const F=hr.buildClaudeModelsEndpoint(a.baseUrl??"");c(F),h([]),v(""),C(new Set),b("");const U=ns(a.headers),W=Object.keys(U).some(X=>X.toLowerCase()==="x-api-key"),Y=Object.keys(U).some(X=>X.toLowerCase()==="authorization");if(!(!!a.apiKey.trim()||W||Y))return;const H=Object.entries(U).sort(([X],[K])=>X.toLowerCase().localeCompare(K.toLowerCase())).map(([X,K])=>`${X}:${K}`).join("|"),G=`${F}||${a.apiKey.trim()}||${H}`;T.current!==G&&(T.current=G,N())},[N,a.apiKey,a.baseUrl,a.headers,i]);const O=w.useCallback(()=>{e(-1)},[e]),M=vo({onBack:O});w.useEffect(()=>{const F=U=>{U.key==="Escape"&&O()};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[O]);const E=F=>{C(U=>{const W=new Set(U);return W.has(F)?W.delete(F):W.add(F),W})},j=()=>{const F=u.filter(U=>A.has(U.name));F.length&&o(F),O()},D=!n&&!s&&!p;return f.jsx(So,{ref:M,contentClassName:Jt.content,title:t("ai_providers.claude_models_fetch_title"),onBack:O,backLabel:t("common.back"),backAriaLabel:t("common.back"),hideTopBarBackButton:!0,hideTopBarRightAction:!0,floatingAction:f.jsxs("div",{className:Jt.floatingActions,children:[f.jsx(de,{variant:"secondary",size:"sm",onClick:O,className:Jt.floatingBackButton,children:t("common.back")}),f.jsx(de,{size:"sm",onClick:j,disabled:!D,className:Jt.floatingSaveButton,children:t("ai_providers.claude_models_fetch_apply")})]}),isLoading:i,loadingLabel:t("common.loading"),children:f.jsx(kt,{children:f.jsxs("div",{className:q.openaiModelsContent,children:[f.jsx("div",{className:q.sectionHint,children:t("ai_providers.claude_models_fetch_hint")}),f.jsxs("div",{className:q.openaiModelsEndpointSection,children:[f.jsx("label",{className:q.openaiModelsEndpointLabel,children:t("ai_providers.claude_models_fetch_url_label")}),f.jsxs("div",{className:q.openaiModelsEndpointControls,children:[f.jsx("input",{className:`input ${q.openaiModelsEndpointInput}`,readOnly:!0,value:r}),f.jsx(de,{variant:"secondary",size:"sm",onClick:()=>void N(),loading:p,disabled:n||s,children:t("ai_providers.claude_models_fetch_refresh")})]})]}),f.jsx(nt,{label:t("ai_providers.claude_models_search_label"),placeholder:t("ai_providers.claude_models_search_placeholder"),value:x,onChange:F=>v(F.target.value),disabled:p}),y&&f.jsx("div",{className:"error-box",children:y}),p?f.jsx("div",{className:q.sectionHint,children:t("ai_providers.claude_models_fetch_loading")}):u.length===0?f.jsx("div",{className:q.sectionHint,children:t("ai_providers.claude_models_fetch_empty")}):L.length===0?f.jsx("div",{className:q.sectionHint,children:t("ai_providers.claude_models_search_empty")}):f.jsx("div",{className:q.modelDiscoveryList,children:L.map(F=>{const U=A.has(F.name);return f.jsxs("label",{className:`${q.modelDiscoveryRow} ${U?q.modelDiscoveryRowSelected:""}`,children:[f.jsx("input",{type:"checkbox",checked:U,onChange:()=>E(F.name)}),f.jsxs("div",{className:q.modelDiscoveryMeta,children:[f.jsxs("div",{className:q.modelDiscoveryName,children:[F.name,F.alias&&f.jsx("span",{className:q.modelDiscoveryAlias,children:F.alias})]}),F.description&&f.jsx("div",{className:q.modelDiscoveryDesc,children:F.description})]})]},F.name)})})]})})})}const Ov=()=>({apiKey:"",priority:void 0,prefix:"",baseUrl:"",websockets:!1,proxyUrl:"",headers:[],models:[],excludedModels:[],modelEntries:[{name:"",alias:""}],excludedText:""}),SY=t=>{if(!t)return null;const e=Number.parseInt(t,10);return Number.isFinite(e)?e:null},wY=t=>t instanceof Error?t.message:typeof t=="string"?t:"",kY=t=>(t??[]).reduce((e,n)=>{const i=String(n?.name??"").trim();let s=String(nLine truncated
`),disableCooling:U===void 0?"":U?"true":"false",websocket:W??!1,error:null})}catch(T){const L=T instanceof Error?T.message:s("notification.download_failed");r(N=>!N||N.fileName!==x?N:{...N,loading:!1,error:L,rawText:""}),a(`${s("notification.download_failed")}: ${L}`,"error")}}},closePrefixProxyEditor:()=>{r(null)},handlePrefixProxyChange:(b,x)=>{r(v=>v&&(b==="prefix"?{...v,prefix:String(x)}:b==="proxyUrl"?{...v,proxyUrl:String(x)}:b==="priority"?{...v,priority:String(x)}:b==="excludedModelsText"?{...v,excludedModelsText:String(x)}:b==="disableCooling"?{...v,disableCooling:String(x)}:{...v,websocket:!!x}))},handlePrefixProxySave:async()=>{if(!o?.json||!u)return;const b=o.fileName,x=c;if(new Blob([x]).size>s0){a(s("auth_files.upload_error_size",{maxSize:ow(s0)}),"error");return}r(A=>!A||A.fileName!==b?A:{...A,saving:!0});try{const A=new File([x],b,{type:"application/json"});await At.upload(A),a(s("auth_files.prefix_proxy_saved_success",{name:b}),"success"),await n(),await i(),r(null)}catch(A){const C=A instanceof Error?A.message:"";a(`${s("notification.upload_failed")}: ${C}`,"error"),r(T=>!T||T.fileName!==b?T:{...T,saving:!1})}}}}function Yie(){const t=Ji(a=>a.keyStats),e=Ji(a=>a.usageDetails),n=Ji(a=>a.loadUsageStats),i=w.useCallback(async()=>{await n({staleTimeMs:cr})},[n]),s=w.useCallback(async()=>{await n({force:!0,staleTimeMs:cr})},[n]);return{keyStats:t,usageDetails:e,loadKeyStats:i,refreshKeyStats:s}}function Zie(t,e){return w.useMemo(()=>{const n=new Map;return t.forEach(i=>{const s=i.auth_index??i.authIndex,a=Ki(s);if(a){const o=e.filter(r=>{const c=Ki(r.auth_index);return c!==null&&c===a});n.set(a,da(o))}}),n},[t,e])}const g4="authFilesPage.uiState",Jie=()=>{if(typeof window>"u")return null;try{const t=window.sessionStorage.getItem(g4);if(!t)return null;const e=JSON.parse(t);return e&&typeof e=="object"?e:null}catch{return null}},ese=t=>{if(!(typeof window>"u"))try{window.sessionStorage.setItem(g4,JSON.stringify(t))}catch{}},tse=t=>1-(1-t)**4,nse=t=>t**3,Dv="translateX(-50%)",JO="translateX(-50%) translateY(56px)";function ise(){const{t}=et(),e=rn(Ue=>Ue.showNotification),n=Kt(Ue=>Ue.connectionStatus),i=ua(Ue=>Ue.resolvedTheme),s=hw(),a=s?s.status==="current":!0,o=vi(),[r,c]=w.useState("all"),[u,h]=w.useState(""),[p,g]=w.useState(1),[y,b]=w.useState(9),[x,v]=w.useState("9"),[A,C]=w.useState(!1),[T,L]=w.useState(null),[N,O]=w.useState("list"),[M,E]=w.useState(!1),j=w.useRef(null),D=w.useRef(null),F=w.useRef(0),U=w.useRef(0),{keyStats:W,usageDetails:Y,loadKeyStats:Z,refreshKeyStats:I}=Yie(),{files:H,selectedFiles:G,selectionCount:X,loading:K,error:R,uploading:B,deleting:$,deletingAll:te,statusUpdating:Q,fileInputRef:V,loadFiles:ne,handleUploadClick:J,handleFileChange:oe,handleDelete:he,handleDeleteAll:Pe,handleDownload:Ce,handleStatusToggle:at,toggleSelect:vt,selectAllVisible:Bt,deselectAll:Re,batchSetStatus:Ye,batchDelete:Lt}=Wie({refreshKeyStats:I}),me=Zie(H,Y),{excluded:Ie,excludedError:$e,modelAlias:lt,modelAliasError:le,allProviderModels:_e,loadExcluded:Le,loadModelAlias:Ze,deleteExcluded:St,deleteModelAlias:bt,handleMappingUpdate:_t,handleDeleteLink:cn,handleToggleFork:ce,handleRenameAlias:He,handleDeleteAlias:jt}=Xie({viewMode:N,files:H}),{modelsModalOpen:Dt,modelsLoading:Tn,modelsList:Ln,modelsFileName:Ri,modelsFileType:ba,modelsError:Cs,showModels:pi,closeModelsModal:rs}=Gie(),{prefixProxyEditor:Xi,prefixProxyUpdatedText:As,prefixProxyDirty:xa,openPrefixProxyEditor:va,closePrefixProxyEditor:Ae,handlePrefixProxyChange:Je,handlePrefixProxySave:dt}=Qie({disableControls:n!=="connected",loadFiles:ne,loadKeyStats:I}),un=n!=="connected",Sn=to(String(r)),Gn=o4.has(Sn)?Sn:null;w.useEffect(()=>{const Ue=Jie();Ue&&(typeof Ue.filter=="string"&&Ue.filter.trim()&&c(Ue.filter),typeof Ue.search=="string"&&h(Ue.search),typeof Ue.page=="number"&&Number.isFinite(Ue.page)&&g(Math.max(1,Math.round(Ue.page))),typeof Ue.pageSize=="number"&&Number.isFinite(Ue.pageSize)&&b(HO(Ue.pageSize)))},[]),w.useEffect(()=>{ese({filter:r,search:u,page:p,pageSize:y})},[r,u,p,y]),w.useEffect(()=>{v(String(y))},[y]);const ee=Ue=>{const pt=Ue.trim();if(!pt){v(String(y));return}const ct=Number(pt);if(!Number.isFinite(ct)){v(String(y));return}const dn=HO(ct);b(dn),v(String(dn)),g(1)},ae=Ue=>{const pt=Ue.currentTarget.value;v(pt);const ct=pt.trim();if(!ct)return;const dn=Number(ct);if(!Number.isFinite(dn))return;const Si=Math.round(dn);Si<l2||Si>c2||(b(Si),g(1))},fe=w.useCallback(async()=>{await Promise.all([ne(),I(),Le(),Ze()])},[ne,I,Le,Ze]);jm(fe),w.useEffect(()=>{a&&(ne(),Z().catch(()=>{}),Le(),Ze())},[a,ne,Z,Le,Ze]),s4(()=>{I().catch(()=>{})},a?24e4:null);const Te=w.useMemo(()=>{const Ue=new Set(["all"]);return H.forEach(pt=>{pt.type&&Ue.add(pt.type)}),Array.from(Ue)},[H]),Ee=w.useMemo(()=>{const Ue={all:H.length};return H.forEach(pt=>{pt.type&&(Ue[pt.type]=(Ue[pt.type]||0)+1)}),Ue},[H]),Ve=w.useMemo(()=>H.filter(Ue=>{const pt=r==="all"||Ue.type===r,ct=u.trim().toLowerCase(),dn=!ct||Ue.name.toLowerCase().includes(ct)||(Ue.typeLine truncated
`)>-1?t.split(`
`):t}function Ece(t,e){const{element:n,datasetIndex:i,index:s}=e,a=t.getDatasetMeta(i).controller,{label:o,value:r}=a.getLabelAndValue(s);return{chart:t,label:o,parsed:a.getParsed(s),raw:t.data.datasets[i].data[s],formattedValue:r,dataset:a.getDataset(),dataIndex:s,datasetIndex:i,element:n}}function oE(t,e){const n=t.chart.ctx,{body:i,footer:s,title:a}=t,{boxWidth:o,boxHeight:r}=e,c=qi(e.bodyFont),u=qi(e.titleFont),h=qi(e.footerFont),p=a.length,g=s.length,y=i.length,b=ha(e.padding);let x=b.height,v=0,A=i.reduce((L,N)=>L+N.before.length+N.lines.length+N.after.length,0);if(A+=t.beforeBody.length+t.afterBody.length,p&&(x+=p*u.lineHeight+(p-1)*e.titleSpacing+e.titleMarginBottom),A){const L=e.displayColors?Math.max(r,c.lineHeight):c.lineHeight;x+=y*L+(A-y)*c.lineHeight+(A-1)*e.bodySpacing}g&&(x+=e.footerMarginTop+g*h.lineHeight+(g-1)*e.footerSpacing);let C=0;const T=function(L){v=Math.max(v,n.measureText(L).width+C)};return n.save(),n.font=u.string,pn(t.title,T),n.font=c.string,pn(t.beforeBody.concat(t.afterBody),T),C=e.displayColors?o+2+e.boxPadding:0,pn(i,L=>{pn(L.before,T),pn(L.lines,T),pn(L.after,T)}),C=0,n.font=h.string,pn(t.footer,T),n.restore(),v+=b.width,{width:v,height:x}}function Pce(t,e){const{y:n,height:i}=e;return n<i/2?"top":n>t.height-i/2?"bottom":"center"}function Rce(t,e,n,i){const{x:s,width:a}=i,o=n.caretSize+n.caretPadding;if(t==="left"&&s+a+o>e.width||t==="right"&&s-a-o<0)return!0}function jce(t,e,n,i){const{x:s,width:a}=n,{width:o,chartArea:{left:r,right:c}}=t;let u="center";return i==="center"?u=s<=(r+c)/2?"left":"right":s<=a/2?u="left":s>=o-a/2&&(u="right"),Rce(u,t,e,n)&&(u="center"),u}function rE(t,e,n){const i=n.yAlign||e.yAlign||Pce(t,n);return{xAlign:n.xAlign||e.xAlign||jce(t,e,n,i),yAlign:i}}function Dce(t,e){let{x:n,width:i}=t;return e==="right"?n-=i:e==="center"&&(n-=i/2),n}function Fce(t,e,n){let{y:i,height:s}=t;return e==="top"?i+=n:e==="bottom"?i-=s+n:i-=s/2,i}function lE(t,e,n,i){const{caretSize:s,caretPadding:a,cornerRadius:o}=t,{xAlign:r,yAlign:c}=n,u=s+a,{topLeft:h,topRight:p,bottomLeft:g,bottomRight:y}=Tf(o);let b=Dce(e,r);const x=Fce(e,c,u);return c==="center"?r==="left"?b+=u:r==="right"&&(b-=u):r==="left"?b-=Math.max(h,g)+s:r==="right"&&(b+=Math.max(p,y)+s),{x:ia(b,0,i.width-e.width),y:ia(x,0,i.height-e.height)}}function zg(t,e,n){const i=ha(n.padding);return e==="center"?t.x+t.width/2:e==="right"?t.x+t.width-i.right:t.x+i.left}function cE(t){return Ja([],Jo(t))}function Uce(t,e,n){return Oc(t,{tooltip:e,tooltipItems:n,type:"tooltip"})}function uE(t,e){const n=e&&e.dataset&&e.dataset.tooltip&&e.dataset.tooltip.callbacks;return n?t.override(n):t}const l5={beforeTitle:Wo,title(t){if(t.length>0){const e=t[0],n=e.chart.data.labels,i=n?n.length:0;if(this&&this.options&&this.options.mode==="dataset")return e.dataset.label||"";if(e.label)return e.label;if(i>0&&e.dataIndex<i)return n[e.dataIndex]}return""},afterTitle:Wo,beforeBody:Wo,beforeLabel:Wo,label(t){if(this&&this.options&&this.options.mode==="dataset")return t.label+": "+t.formattedValue||t.formattedValue;let e=t.dataset.label||"";e&&(e+=": ");const n=t.formattedValue;return Mn(n)||(e+=n),e},labelColor(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{borderColor:n.borderColor,backgroundColor:n.backgroundColor,borderWidth:n.borderWidth,borderDash:n.borderDash,borderDashOffset:n.borderDashOffset,borderRadius:0}},labelTextColor(){return this.options.bodyColor},labelPointStyle(t){const n=t.chart.getDatasetMeta(t.datasetIndex).controller.getStyle(t.dataIndex);return{pointStyle:n.pointStyle,rotation:n.rotation}},afterLabel:Wo,afterBody:Wo,beforeFooter:Wo,footer:Wo,afterFooter:Wo};function ms(t,e,n,i){const s=t[e].call(n,i);return typeof s>"u"?l5[e].call(n,i):s}class x2 extends fr{constructor(e){super(),this.opacity=0,this._active=[],this._eventPosition=void 0,this._size=void 0,this._cachedAnimations=void 0,this._tooltipItems=[],this.$animations=void 0,this.$context=void 0,this.chart=e.chart,this.options=e.options,this.dataPoints=void 0,this.title=void 0,this.beforeBody=void 0,this.body=void 0,this.afterBody=void 0,this.footer=void 0,this.xAlign=void 0,this.yAlign=void 0,this.x=void 0,this.y=void 0,this.height=void 0,this.width=void 0,this.caretX=void 0,this.caretY=void 0,this.labelColors=void 0,this.labelPointStyles=void 0,this.labelTextColors=void 0}initialize(e){this.options=e,this._cachedAnimations=void 0,this.$context=void 0}_resolveAnimations(){const e=this._cachedAnimations;if(e)return e;const n=this.chart,i=this.options.setContext(this.getContext()),s=i.enabled&&n.options.animation&&i.animations,a=new V4(this.chart,s);return s._cacheable&&(this._cachedAnimations=Object.freeze(a)),a}getContext(){return this.$context||(this.$context=Uce(this.chart.getContext(),this,this._tooltipItems))}getTitle(e,n){const{callbacks:i}=n,s=ms(i,"beforeTitle",this,e),a=ms(i,"title",this,e),o=ms(i,"afterTitle",this,e);let r=[];return r=Ja(r,Jo(s)),r=Ja(r,Jo(a)),r=Ja(r,Jo(o)),r}getBeforeBody(e,n){returnLine truncated
`),R=new Date().toISOString().replace(/[:.]/g,"-");uc({filename:`usage-events-${R}.csv`,blob:new Blob([K],{type:"text/csv;charset=utf-8"})})},H=()=>{if(!U.length)return;const G=U.map(R=>({timestamp:R.timestamp,model:R.model,source:R.source,source_raw:R.sourceRaw,auth_index:R.authIndex,failed:R.failed,tokens:{input_tokens:R.inputTokens,output_tokens:R.outputTokens,reasoning_tokens:R.reasoningTokens,cached_tokens:R.cachedTokens,total_tokens:R.totalTokens}})),X=JSON.stringify(G,null,2),K=new Date().toISOString().replace(/[:.]/g,"-");uc({filename:`usage-events-${K}.json`,blob:new Blob([X],{type:"application/json;charset=utf-8"})})};return f.jsxs(kt,{title:r("usage_stats.request_events_title"),extra:f.jsxs("div",{className:se.requestEventsActions,children:[f.jsx(de,{variant:"ghost",size:"sm",onClick:Z,disabled:!Y,children:r("usage_stats.clear_filters")}),f.jsx(de,{variant:"secondary",size:"sm",onClick:I,disabled:U.length===0,children:r("usage_stats.export_csv")}),f.jsx(de,{variant:"secondary",size:"sm",onClick:H,disabled:U.length===0,children:r("usage_stats.export_json")})]}),children:[f.jsxs("div",{className:se.requestEventsToolbar,children:[f.jsxs("div",{className:se.requestEventsFilterItem,children:[f.jsx("span",{className:se.requestEventsFilterLabel,children:r("usage_stats.request_events_filter_model")}),f.jsx(Ss,{value:j,options:T,onChange:h,className:se.requestEventsSelect,ariaLabel:r("usage_stats.request_events_filter_model"),fullWidth:!1})]}),f.jsxs("div",{className:se.requestEventsFilterItem,children:[f.jsx("span",{className:se.requestEventsFilterLabel,children:r("usage_stats.request_events_filter_source")}),f.jsx(Ss,{value:D,options:L,onChange:g,className:se.requestEventsSelect,ariaLabel:r("usage_stats.request_events_filter_source"),fullWidth:!1})]}),f.jsxs("div",{className:se.requestEventsFilterItem,children:[f.jsx("span",{className:se.requestEventsFilterLabel,children:r("usage_stats.request_events_filter_auth_index")}),f.jsx(Ss,{value:F,options:N,onChange:b,className:se.requestEventsSelect,ariaLabel:r("usage_stats.request_events_filter_auth_index"),fullWidth:!1})]})]}),e&&C.length===0?f.jsx("div",{className:se.hint,children:r("common.loading")}):C.length===0?f.jsx(zi,{title:r("usage_stats.request_events_empty_title"),description:r("usage_stats.request_events_empty_desc")}):U.length===0?f.jsx(zi,{title:r("usage_stats.request_events_no_result_title"),description:r("usage_stats.request_events_no_result_desc")}):f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:se.requestEventsMeta,children:[f.jsx("span",{children:r("usage_stats.request_events_count",{count:U.length})}),U.length>Qv&&f.jsx("span",{className:se.requestEventsLimitHint,children:r("usage_stats.request_events_limit_hint",{shown:Qv,total:U.length})})]}),f.jsx("div",{className:se.requestEventsTableWrapper,children:f.jsxs("table",{className:se.table,children:[f.jsx("thead",{children:f.jsxs("tr",{children:[f.jsx("th",{children:r("usage_stats.request_events_timestamp")}),f.jsx("th",{children:r("usage_stats.model_name")}),f.jsx("th",{children:r("usage_stats.request_events_source")}),f.jsx("th",{children:r("usage_stats.request_events_auth_index")}),f.jsx("th",{children:r("usage_stats.request_events_result")}),f.jsx("th",{children:r("usage_stats.input_tokens")}),f.jsx("th",{children:r("usage_stats.output_tokens")}),f.jsx("th",{children:r("usage_stats.reasoning_tokens")}),f.jsx("th",{children:r("usage_stats.cached_tokens")}),f.jsx("th",{children:r("usage_stats.total_tokens")})]})}),f.jsx("tbody",{children:W.map(G=>f.jsxs("tr",{children:[f.jsx("td",{title:G.timestamp,className:se.requestEventsTimestamp,children:G.timestampLabel}),f.jsx("td",{className:se.modelCell,children:G.model}),f.jsxs("td",{className:se.requestEventsSourceCell,title:G.source,children:[f.jsx("span",{children:G.source}),G.sourceType&&f.jsx("span",{className:se.credentialType,children:G.sourceType})]}),f.jsx("td",{className:se.requestEventsAuthIndex,title:G.authIndex,children:G.authIndex}),f.jsx("td",{children:f.jsx("span",{className:G.failed?se.requestEventsResultFailed:se.requestEventsResultSuccess,children:G.failed?r("stats.failure"):r("stats.success")})}),f.jsx("td",{children:G.inputTokens.toLocaleString()}),f.jsx("td",{children:G.outputTokens.toLocaleString()}),f.jsx("td",{children:G.reasoningTokens.toLocaleString()}),f.jsx("td",{children:G.cachedTokens.toLocaleString()}),f.jsx("td",{children:G.totalTokens.toLocaleString()})]},G.id))})]})})]})]})}_y.register(v2,S2,F_,tl,Lce,Bce,Mce,wce);const m5="cli-proxy-usage-chart-lines-v1",p5="cli-proxy-usage-time-range-v1",Mf=["all"],Yv="24h",g5=9,Uhe=[{value:"all",labelKey:"usage_stats.range_all"},{value:"7h",labelKey:"usage_stats.range_7h"},{value:"24h",labelKey:"usage_stats.range_24h"},{value:"7d",labelKey:"usage_stats.range_7d"}],Bhe={"7h":7,"24h":24,"7d":168},Ihe=t=>t==="7h"||t==="24h"||t==="7d"||t==="all",_5=(t,e=g5)=>{if(!Array.isArray(t))return Mf;const n=t.filter(i=>typeof i=="string").map(i=>i.trim()).filter(Boolean).slice(0,eLine truncated
`){[e,n]=od(this,e,n);let s="";for(let a=0,o=0;a<=n&&o<this.text.length;o++){let r=this.text[o],c=a+r.length;a>e&&o&&(s+=i),e<c&&n>a&&(s+=r.slice(Math.max(0,e-a),n-a)),a=c+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let i=[],s=-1;for(let a of e)i.push(a),s+=a.length+1,i.length==32&&(n.push(new Yn(i,s)),i=[],s=-1);return s>-1&&n.push(new Yn(i,s)),n}}class so extends Zt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,n,i,s){for(let a=0;;a++){let o=this.children[a],r=s+o.length,c=i+o.lines-1;if((n?c:r)>=e)return o.lineInner(e,n,i,s);s=r+1,i=c+1}}decompose(e,n,i,s){for(let a=0,o=0;o<=n&&a<this.children.length;a++){let r=this.children[a],c=o+r.length;if(e<=c&&n>=o){let u=s&((o<=e?1:0)|(c>=n?2:0));o>=e&&c<=n&&!u?i.push(r):r.decompose(e-o,n-o,i,u)}o=c+1}}replace(e,n,i){if([e,n]=od(this,e,n),i.lines<this.lines)for(let s=0,a=0;s<this.children.length;s++){let o=this.children[s],r=a+o.length;if(e>=a&&n<=r){let c=o.replace(e-a,n-a,i),u=this.lines-o.lines+c.lines;if(c.lines<u>>4&&c.lines>u>>6){let h=this.children.slice();return h[s]=c,new so(h,this.length-(n-e)+i.length)}return super.replace(a,r,c)}a=r+1}return super.replace(e,n,i)}sliceString(e,n=this.length,i=`
`){[e,n]=od(this,e,n);let s="";for(let a=0,o=0;a<this.children.length&&o<=n;a++){let r=this.children[a],c=o+r.length;o>e&&a&&(s+=i),e<c&&n>o&&(s+=r.sliceString(e-o,n-o,i)),o=c+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof so))return 0;let i=0,[s,a,o,r]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,a+=n){if(s==o||a==r)return i;let c=this.children[s],u=e.children[a];if(c!=u)return i+c.scanIdentical(u,n);i+=c.length+1}}static from(e,n=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let y of e)i+=y.lines;if(i<32){let y=[];for(let b of e)b.flatten(y);return new Yn(y,n)}let s=Math.max(32,i>>5),a=s<<1,o=s>>1,r=[],c=0,u=-1,h=[];function p(y){let b;if(y.lines>a&&y instanceof so)for(let x of y.children)p(x);else y.lines>o&&(c>o||!c)?(g(),r.push(y)):y instanceof Yn&&c&&(b=h[h.length-1])instanceof Yn&&y.lines+b.lines<=32?(c+=y.lines,u+=y.length+1,h[h.length-1]=new Yn(b.text.concat(y.text),b.length+1+y.length)):(c+y.lines>s&&g(),c+=y.lines,u+=y.length+1,h.push(y))}function g(){c!=0&&(r.push(h.length==1?h[0]:so.from(h,u)),u=-1,c=h.length=0)}for(let y of e)p(y);return g(),r.length==1?r[0]:new so(r,n)}}Zt.empty=new Yn([""],0);function Xhe(t){let e=-1;for(let n of t)e+=n.length+1;return e}function U_(t,e,n=0,i=1e9){for(let s=0,a=0,o=!0;a<t.length&&s<=i;a++){let r=t[a],c=s+r.length;c>=n&&(c>i&&(r=r.slice(0,i-s)),s<n&&(r=r.slice(n-s)),o?(e[e.length-1]+=r,o=!1):e.push(r)),s=c+1}return e}function AE(t,e,n){return U_(t,[""],e,n)}class Of{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof Yn?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],a=this.offsets[i],o=a>>1,r=s instanceof Yn?s.text.length:s.children.length;if(o==(n>0?r:0)){if(i==0)return this.done=!0,this.value="",this;n>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(n>0?0:1)){if(this.offsets[i]+=n,e==0)return this.lineBreak=!0,this.value=`
`,this;e--}else if(s instanceof Yn){let c=s.text[o+(n<0?-1:0)];if(this.offsets[i]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[o+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[i]+=n):(n<0&&this.offsets[i]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Yn?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class S5{constructor(e,n,i){this.value="",this.done=!1,this.cursor=new Of(e,n>i?-1:1),this.pos=n>i?e.length:0,this.from=Math.min(n,i),this.to=Math.max(n,i)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let i=n<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=i?s:n<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class w5{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:i,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Zt.prototype[Symbol.iterator]=function(){return this.iter()},Of.prototype[Symbol.iterator]=S5.prototype[Symbol.iterator]=w5.prototype[Symbol.iterator]=function(){return this});class $he{constructor(e,n,i,s){this.from=e,this.to=n,this.number=i,this.text=s}get length(){return this.to-this.from}}function od(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function Oi(t,e,n=!0,i=!0){return Whe(t,e,n,i)}function Qhe(t){return t>=56320&&t<57344}function Yhe(t){return t>=55296&&t<56320}function ps(t,e){let n=t.charCodeAt(e);if(!Yhe(n)||e+1==t.length)return n;let i=t.charCodeAt(e+1);return Qhe(i)?(n-55296<<10)+(i-56320)+65536:n}function Dw(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function ao(t){return t<65536?1:2}const C2=/\r\n?|\n/;var es=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(es||(es={}));class mo{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let i=this.sections[n+1];e+=i<0?this.sections[n]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,i=0,s=0;n<this.sections.length;){let a=this.sections[n++],o=this.sections[n++];o<0?(e(i,s,a),s+=a):s+=o,i+=a}}iterChangedRanges(e,n=!1){A2(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let i=this.sections[n++],s=this.sections[n++];s<0?e.push(i,s):e.push(s,i)}return new mo(e)}composeDesc(e){return this.empty?e:e.empty?this:k5(this,e)}mapDesc(e,n=!1){return e.empty?this:T2(this,e,n)}mapPos(e,n=-1,i=es.Simple){let s=0,a=0;for(let o=0;o<this.sections.length;){let r=this.sections[o++],c=this.sections[o++],u=s+r;if(c<0){if(u>e)return a+(e-s);a+=r}else{if(i!=es.Simple&&u>=e&&(i==es.TrackDel&&s<e&&u>e||i==es.TrackBefore&&s<e||i==es.TrackAfter&&u>e))return null;if(u>e||u==e&&n<0&&!r)return e==s||n<0?a:a+c;a+=c}s=u}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return a}touchesRange(e,n=e){for(let i=0,s=0;i<this.sections.length&&s<=n;){let a=this.sections[i++],o=this.sections[i++],r=s+a;if(o>=0&&s<=n&&r>=e)return s<e&&r>n?"cover":!0;s=r}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let i=this.sections[n++],s=this.sections[n++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new mo(e)}static create(e){return new mo(e)}}class hi extends mo{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return A2(this,(n,i,s,a,o)=>e=e.replace(s,s+(i-n),o),!1),e}mapDesc(e,n=!1){return T2(this,e,n,!0)}invert(e){let n=this.sections.slice(),i=[];for(let s=0,a=0;s<n.length;s+=2){let o=n[s],r=n[s+1];if(r>=0){n[s]=r,n[s+1]=o;let c=s>>1;for(;i.length<c;)i.push(Zt.empty);i.push(o?e.slice(a,a+o):Zt.empty)}a+=o}return new hi(n,i)}compose(e){return this.empty?e:e.empty?this:k5(this,e,!0)}map(e,n=!1){return e.empty?this:T2(this,e,n,!0)}iterChanges(e,n=!1){A2(this,e,n)}get desc(){retLine truncated
`}get readOnly(){return this.facet(E5)}phrase(e,...n){for(let i of this.facet(Qt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let a=+(s||1);return!a||a>n.length?i:n[a-1]})),e}languageDataAt(e,n,i=-1){let s=[];for(let a of this.facet(T5))for(let o of a(this,n,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){return lfe(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:i,length:s}=this.doc.lineAt(e),a=this.charCategorizer(e),o=e-i,r=e-i;for(;o>0;){let c=Oi(n,o,!1);if(a(n.slice(c,o))!=In.Word)break;o=c}for(;r<s;){let c=Oi(n,r);if(a(n.slice(r,c))!=In.Word)break;r=c}return o==r?null:Me.range(o+i,r+i)}}Qt.allowMultipleSelections=O2;Qt.tabSize=Xe.define({combine:t=>t.length?t[0]:4});Qt.lineSeparator=N5;Qt.readOnly=E5;Qt.phrases=Xe.define({compare(t,e){let n=Object.keys(t),i=Object.keys(e);return n.length==i.length&&n.every(s=>t[s]==e[s])}});Qt.languageData=T5;Qt.changeFilter=M5;Qt.transactionFilter=O5;Qt.transactionExtender=L5;vy.reconfigure=Mt.define();function ko(t,e,n={}){let i={};for(let s of t)for(let a of Object.keys(s)){let o=s[a],r=i[a];if(r===void 0)i[a]=o;else if(!(r===o||o===void 0))if(Object.hasOwnProperty.call(n,a))i[a]=n[a](r,o);else throw new Error("Config merge conflict for field "+a)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class bc{eq(e){return this==e}range(e,n=e){return P2.create(e,n,this)}}bc.prototype.startSide=bc.prototype.endSide=0;bc.prototype.point=!1;bc.prototype.mapMode=es.TrackDel;let P2=class j5{constructor(e,n,i){this.from=e,this.to=n,this.value=i}static create(e,n,i){return new j5(e,n,i)}};function R2(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}let cfe=class D5{constructor(e,n,i,s){this.from=e,this.to=n,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,i,s=0){let a=i?this.to:this.from;for(let o=s,r=a.length;;){if(o==r)return o;let c=o+r>>1,u=a[c]-e||(i?this.value[c].endSide:this.value[c].startSide)-n;if(c==o)return u>=0?o:r;u>=0?r=c:o=c+1}}between(e,n,i,s){for(let a=this.findIndex(n,-1e9,!0),o=this.findIndex(i,1e9,!1,a);a<o;a++)if(s(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,n){let i=[],s=[],a=[],o=-1,r=-1;for(let c=0;c<this.value.length;c++){let u=this.value[c],h=this.from[c]+e,p=this.to[c]+e,g,y;if(h==p){let b=n.mapPos(h,u.startSide,u.mapMode);if(b==null||(g=y=b,u.startSide!=u.endSide&&(y=n.mapPos(h,u.endSide),y<g)))continue}else if(g=n.mapPos(h,u.startSide),y=n.mapPos(p,u.endSide),g>y||g==y&&u.startSide>0&&u.endSide<=0)continue;(y-g||u.endSide-u.startSide)<0||(o<0&&(o=g),u.point&&(r=Math.max(r,y-g)),i.push(u),s.push(g-o),a.push(y-o))}return{mapped:i.length?new D5(s,a,i,r):null,pos:o}}};class tn{constructor(e,n,i,s){this.chunkPos=e,this.chunk=n,this.nextLayer=i,this.maxPoint=s}static create(e,n,i,s){return new tn(e,n,i,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:i=!1,filterFrom:s=0,filterTo:a=this.length}=e,o=e.filter;if(n.length==0&&!o)return this;if(i&&(n=n.slice().sort(R2)),this.isEmpty)return n.length?tn.of(n):this;let r=new F5(this,null,-1).goto(0),c=0,u=[],h=new mr;for(;r.value||c<n.length;)if(c<n.length&&(r.from-n[c].from||r.startSide-n[c].value.startSide)>=0){let p=n[c++];h.addInner(p.from,p.to,p.value)||u.push(p)}else r.rangeIndex==1&&r.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(r.chunkIndex)<n[c].from)&&(!o||s>this.chunkEnd(r.chunkIndex)||a<this.chunkPos[r.chunkIndex])&&h.addChunk(this.chunkPos[r.chunkIndex],this.chunk[r.chunkIndex])?r.nextChunk():((!o||s>r.to||a<r.from||o(r.from,r.to,r.value))&&(h.addInner(r.from,r.to,r.value)||u.push(P2.create(r.from,r.to,r.value))),r.next());return h.finishInner(this.nextLayer.isEmpty&&!u.length?tn.empty:this.nextLayer.update({add:u,filter:o,filterFrom:s,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],i=[],s=-1;for(let o=0;o<this.chunk.length;o++){let r=this.chunkPos[o],c=this.chunk[o],u=e.touchesRange(r,r+c.length);if(u===!1)s=Math.max(s,c.maxPoint),n.push(c),i.push(e.mapPos(r));else if(u===!0){let{mapped:h,pos:p}=c.map(r,e);h&&(s=Math.max(s,h.maxPoint),n.push(h),i.push(p))}}let a=this.nextLayer.map(e);return n.length==0?a:new tn(i,n,a||tn.empty,s)}between(e,n,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let a=this.chunkPos[s],o=this.chunk[s];if(n>=a&&e<=a+o.length&&o.between(a,e-a,n-a,i)===!1)return}this.nextLayer.between(e,n,i)}}iter(e=0){return em.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return em.from(e).goto(n)}static compare(e,n,i,s,a=-1){let o=e.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=a),r=n.filter(p=>p.maxPoint>0||!p.isEmpty&&p.maxPoint>=a),Line truncated
`)}static newName(){let e=EE[LE]||1;return EE[LE]=e+1,F2+e.toString(36)}static mount(e,n,i){let s=e[U2],a=i&&i.nonce;s?a&&s.setNonce(a):s=new dfe(e,a),s.mount(Array.isArray(n)?n:[n],e)}}let PE=new Map;class dfe{constructor(e,n){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let a=PE.get(i);if(a)return e[U2]=a;this.sheet=new s.CSSStyleSheet,PE.set(i,this)}else this.styleTag=i.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[U2]=this}mount(e,n){let i=this.sheet,s=0,a=0;for(let o=0;o<e.length;o++){let r=e[o],c=this.modules.indexOf(r);if(c<a&&c>-1&&(this.modules.splice(c,1),a--,c=-1),c==-1){if(this.modules.splice(a++,0,r),i)for(let u=0;u<r.rules.length;u++)i.insertRule(r.rules[u],s++)}else{for(;a<c;)s+=this.modules[a++].rules.length;s+=r.rules.length,a++}}if(i)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let o="";for(let c=0;c<this.modules.length;c++)o+=this.modules[c].getRules()+`
`;this.styleTag.textContent=o;let r=n.head||n;this.styleTag.parentNode!=r&&r.insertBefore(this.styleTag,r.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var ul={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},tm={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},hfe=typeof navigator<"u"&&/Mac/.test(navigator.platform),ffe=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Mi=0;Mi<10;Mi++)ul[48+Mi]=ul[96+Mi]=String(Mi);for(var Mi=1;Mi<=24;Mi++)ul[Mi+111]="F"+Mi;for(var Mi=65;Mi<=90;Mi++)ul[Mi]=String.fromCharCode(Mi+32),tm[Mi]=String.fromCharCode(Mi);for(var e1 in ul)tm.hasOwnProperty(e1)||(tm[e1]=ul[e1]);function mfe(t){var e=hfe&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ffe&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?tm:ul)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function Cn(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var s=n[i];typeof s=="string"?t.setAttribute(i,s):s!=null&&(t[i]=s)}e++}for(;e<arguments.length;e++)U5(t,arguments[e]);return t}function U5(t,e){if(typeof e=="string")t.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)t.appendChild(e);else if(Array.isArray(e))for(var n=0;n<e.length;n++)U5(t,e[n]);else throw new RangeError("Unsupported child node: "+e)}let Zi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},B2=typeof document<"u"?document:{documentElement:{style:{}}};const I2=/Edge\/(\d+)/.exec(Zi.userAgent),B5=/MSIE \d/.test(Zi.userAgent),q2=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zi.userAgent),Sy=!!(B5||q2||I2),RE=!Sy&&/gecko\/(\d+)/i.test(Zi.userAgent),t1=!Sy&&/Chrome\/(\d+)/.exec(Zi.userAgent),pfe="webkitFontSmoothing"in B2.documentElement.style,z2=!Sy&&/Apple Computer/.test(Zi.vendor),jE=z2&&(/Mobile\/\w+/.test(Zi.userAgent)||Zi.maxTouchPoints>2);var ze={mac:jE||/Mac/.test(Zi.platform),windows:/Win/.test(Zi.platform),linux:/Linux|X11/.test(Zi.platform),ie:Sy,ie_version:B5?B2.documentMode||6:q2?+q2[1]:I2?+I2[1]:0,gecko:RE,gecko_version:RE?+(/Firefox\/(\d+)/.exec(Zi.userAgent)||[0,0])[1]:0,chrome:!!t1,chrome_version:t1?+t1[1]:0,ios:jE,android:/Android\b/.test(Zi.userAgent),webkit_version:pfe?+(/\bAppleWebKit\/(\d+)/.exec(Zi.userAgent)||[0,0])[1]:0,safari:z2,safari_version:z2?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Zi.userAgent)||[0,0])[1]:0,tabSize:B2.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function nm(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function K2(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function I_(t,e){if(!e.anchorNode)return!1;try{return K2(t,e.anchorNode)}catch{return!1}}function rd(t){return t.nodeType==3?vc(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Ef(t,e,n,i){return n?DE(t,e,n,i,-1)||DE(t,e,n,i,1):!1}function xc(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function x0(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function DE(t,e,n,i,s){for(;;){if(t==n&&e==i)return!0;if(e==(s<0?0:_o(t))){if(t.nodeName=="DIV")return!1;let a=t.parentNode;if(!a||a.nodeType!=1)return!1;e=xc(t)+(s<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?_o(t):0}else return!1}}function _o(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qm(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function gfe(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function I5(t,e){let n=e.width/t.offsetWidth,i=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-t.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function _fe(t,e,n,i,s,a,o,r){let c=t.ownerDocument,u=c.defaulLine truncated
`,s=t.state.doc.line(s.number+(n?1:-1)),a=t.bidiSpans(s),u=t.visualLineSide(s,!n)}if(c){if(!c(h))return r}else{if(!i)return u;c=i(h)}r=u}}function Yfe(t,e,n){let i=t.state.charCategorizer(e),s=i(n);return a=>{let o=i(a);return s==In.Space&&(s=o),s==o}}function Zfe(t,e,n,i){let s=e.head,a=n?1:-1;if(s==(n?t.state.doc.length:0))return Me.cursor(s,e.assoc);let o=e.goalColumn,r,c=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(s,e.assoc||-1),h=t.documentTop;if(u)o==null&&(o=u.left-c.left),r=a<0?u.top:u.bottom;else{let y=t.viewState.lineBlockAt(s);o==null&&(o=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-y.from))),r=(a<0?y.top:y.bottom)+h}let p=c.left+o,g=i??t.viewState.heightOracle.textHeight>>1;for(let y=0;;y+=10){let b=r+(g+y)*a,x=bD(t,{x:p,y:b},!1,a);if(b<c.top||b>c.bottom||(a<0?x<s:x>s)){let v=t.docView.coordsForChar(x),A=!v||b<v.top?-1:1;return Me.cursor(x,A,void 0,o)}}}function Rf(t,e,n){for(;;){let i=0;for(let s of t)s.between(e-1,e+1,(a,o,r)=>{if(e>a&&e<o){let c=i||n||(e-a<o-e?-1:1);e=c<0?a:o,i=c}});if(!i)return e}}function vD(t,e){let n=null;for(let i=0;i<e.ranges.length;i++){let s=e.ranges[i],a=null;if(s.empty){let o=Rf(t,s.from,0);o!=s.from&&(a=Me.cursor(o,-1))}else{let o=Rf(t,s.from,-1),r=Rf(t,s.to,1);(o!=s.from||r!=s.to)&&(a=Me.range(s.from==s.anchor?o:r,s.from==s.head?o:r))}a&&(n||(n=e.ranges.slice()),n[i]=a)}return n?Me.create(n,e.mainIndex):e}function s1(t,e,n){let i=Rf(t.state.facet(Hm).map(s=>s(t)),n.from,e.head>n.from?-1:1);return i==n.from?n:Me.cursor(i,i<n.from?1:-1)}const uf="￿";class Jfe{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(Qt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=uf}readRange(e,n){if(!e)return this;let i=e.parentNode;for(let s=e;;){this.findPointBefore(i,s);let a=this.text.length;this.readNode(s);let o=s.nextSibling;if(o==n)break;let r=vn.get(s),c=vn.get(o);(r&&c?r.breakAfter:(r?r.breakAfter:x0(s))||x0(o)&&(s.nodeName!="BR"||s.cmIgnore)&&this.text.length>a)&&!tme(o,n)&&this.lineBreak(),s=o}return this.findPointBefore(i,n),this}readTextNode(e){let n=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,n.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,r;if(this.lineSeparator?(a=n.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(r=s.exec(n))&&(a=r.index,o=r[0].length),this.append(n.slice(i,a<0?n.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=o-1);i=a+o}}readNode(e){if(e.cmIgnore)return;let n=vn.get(e),i=n&&n.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==n&&(i.pos=this.text.length)}findPointInside(e,n){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(eme(e,i.node,i.offset)?n:0))}}function eme(t,e,n){for(;;){if(!e||n<_o(e))return!1;if(e==t)return!0;n=xc(e)+1,e=e.parentNode}}function tme(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let i=vn.get(t);if(!(i?.isWidget||t.cmIgnore))return!1;i&&(n||(n=[])).push(i)}if(n)for(let i of n){let s=i.overrideDOMText;if(s?.length)return!1}return!0}class GE{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class nme{constructor(e,n,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:a,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,i,0))){let r=a||o?[]:sme(e),c=new Jfe(r,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=ame(r,this.bounds.from)}else{let r=e.observer.selectionRange,c=a&&a.node==r.focusNode&&a.offset==r.focusOffset||!K2(e.contentDOM,r.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(r.focusNode,r.focusOffset),u=o&&o.node==r.anchorNode&&o.offset==r.anchorOffset||!K2(e.contentDOM,r.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(r.anchorNode,r.anchorOffset),h=e.viewport;if((ze.ios||ze.chrome)&&e.state.selection.main.empty&&c!=u&&(h.from>0||h.to<e.state.doc.length)){let p=Math.min(c,u),g=Math.max(c,u),y=h.from-p,b=h.to-g;(y==0||y==1||p==0)&&(b==0||b==-1||g==e.state.doc.length)&&(c=0,u=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Me.range(u,c)):this.newSel=Me.single(u,c)}}}function SD(t,e){let n,{newSel:i}=e,s=t.state.selection.main,a=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:r}=e.bounds,c=s.from,u=null;(a===8||ze.android&&e.text.length<r-o)&&(c=s.to,u="end");let h=wD(t.state.doc.sliceString(o,r,uf),e.text,c-o,u);h&&(ze.chrome&&a==13&&h.toB==h.from+2&&e.text.slice(h.frLine truncated
`&&t.lineWrapping&&(i&&(i=Me.single(i.main.anchor-1,i.main.head-1)),n={from:s.from,to:s.to,insert:Zt.of([" "])}),n)return Vw(t,n,i,a);if(i&&!i.main.eq(s)){let o=!1,r="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(o=!0),r=t.inputState.lastSelectionOrigin,r=="select.pointer"&&(i=vD(t.state.facet(Hm).map(c=>c(t)),i))),t.dispatch({selection:i,scrollIntoView:o,userEvent:r}),!0}else return!1}function Vw(t,e,n,i=-1){if(ze.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(ze.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Wu(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&Wu(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&Wu(t.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let o,r=()=>o||(o=ime(t,e,n));return t.state.facet(lD).some(c=>c(t,e.from,e.to,a,r))||t.dispatch(r()),!0}function ime(t,e,n){let i,s=t.state,a=s.selection.main,o=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let c=e.from<a.from?-1:1,u=c<0?a.from:a.to,h=Rf(s.facet(Hm).map(p=>p(t)),u,c);e.from==h&&(o=h)}if(o>-1)i={changes:e,selection:Me.cursor(e.from+e.insert.length,-1)};else if(e.from>=a.from&&e.to<=a.to&&e.to-e.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let c=a.from<e.from?s.sliceDoc(a.from,e.from):"",u=a.to>e.to?s.sliceDoc(e.to,a.to):"";i=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+u))}else{let c=s.changes(e),u=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let h=t.state.sliceDoc(e.from,e.to),p,g=n&&yD(t,n.main.head);if(g){let b=e.insert.length-(e.to-e.from);p={from:g.from,to:g.to-b}}else p=t.state.doc.lineAt(a.head);let y=a.to-e.to;i=s.changeByRange(b=>{if(b.from==a.from&&b.to==a.to)return{changes:c,range:u||b.map(c)};let x=b.to-y,v=x-h.length;if(t.state.sliceDoc(v,x)!=h||x>=p.from&&v<=p.to)return{range:b};let A=s.changes({from:v,to:x,insert:e.insert}),C=b.to-a.to;return{changes:A,range:u?Me.range(Math.max(0,u.anchor+C),Math.max(0,u.head+C)):b.map(A)}})}else i={changes:c,selection:u&&s.selection.replaceRange(u)}}let r="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,r+=".compose",t.inputState.compositionFirstChange&&(r+=".start",t.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:r,scrollIntoView:!0})}function wD(t,e,n,i){let s=Math.min(t.length,e.length),a=0;for(;a<s&&t.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==s&&t.length==e.length)return null;let o=t.length,r=e.length;for(;o>0&&r>0&&t.charCodeAt(o-1)==e.charCodeAt(r-1);)o--,r--;if(i=="end"){let c=Math.max(0,a-Math.min(o,r));n-=o+c-a}if(o<a&&t.length<e.length){let c=n<=a&&n>=o?a-n:0;a-=c,r=a+(r-o),o=a}else if(r<a){let c=n<=a&&n>=r?a-n:0;a-=c,o=a+(o-r),r=a}return{from:a,toA:o,toB:r}}function sme(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:i,focusNode:s,focusOffset:a}=t.observer.selectionRange;return n&&(e.push(new GE(n,i)),(s!=n||a!=i)&&e.push(new GE(s,a))),e}function ame(t,e){if(t.length==0)return null;let n=t[0].pos,i=t.length==2?t[1].pos:n;return n>-1&&i>-1?Me.single(n+e,i+e):null}class ome{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ze.safari&&e.contentDOM.addEventListener("input",()=>null),ze.gecko&&Sme(e.contentDOM.ownerDocument)}handleEvent(e){!mme(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,n);for(let s of i.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=rme(e),i=this.handlers,s=this.view.contentDOM;for(let a in n)if(a!="scroll"){let o=!n[a].handlers.length,r=i[a];r&&o!=!r.handlers.length&&(s.remoLine truncated
`))};if((ze.mac||ze.android)&&p.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(p={from:r,to:c,insert:Zt.of([i.text.replace("."," ")])}),this.pendingContextChange=p,!e.state.readOnly){let g=this.to-this.from+(p.to-p.from+p.insert.length);Vw(e,p,Me.single(this.toEditorPos(i.selectionStart,g),this.toEditorPos(i.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),p.from<p.to&&!p.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(n.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],a=null;for(let o=this.toEditorPos(i.rangeStart),r=this.toEditorPos(i.rangeEnd);o<r;o++){let c=e.coordsForChar(o);a=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||a||new DOMRect,s.push(a)}n.updateCharacterBounds(i.rangeStart,s)},this.handlers.textformatupdate=i=>{let s=[];for(let a of i.getTextFormats()){let o=a.underlineStyle,r=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(r)){let c=this.toEditorPos(a.rangeStart),u=this.toEditorPos(a.rangeEnd);if(c<u){let h=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(r)?1:2}px`;s.push(ht.mark({attributes:{style:h}}).range(c,u))}}}e.dispatch({effects:fD.of(ht.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)n.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=nm(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((a,o,r,c,u)=>{if(i)return;let h=u.length-(o-a);if(s&&o>=s.to)if(s.from==a&&s.to==o&&s.insert.eq(u)){s=this.pendingContextChange=null,n+=h,this.to+=h;return}else s=null,this.revertPending(e.state);if(a+=n,o+=n,o<=this.from)this.from+=h,this.to+=h;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+u.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),u.toString()),this.to+=h}n+=h}),s&&!i&&this.revertPending(e.state),!i}update(e){let n=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ke{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measuLine truncated
--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,sS),ape={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let r1=null;function ope(){var t;if(r1==null&&typeof document<"u"&&document.body){let e=document.body.style;r1=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return r1||!1}const H_=Xe.define({combine(t){let e=ko(t,{render:null,specialChars:spe,addSpecialChars:null});return(e.replaceTabs=!ope())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,sS)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,sS)),e}});function rpe(t={}){return[H_.of(t),lpe()]}let gP=null;function lpe(){return gP||(gP=ti.fromClass(class{constructor(t){this.view=t,this.decorations=ht.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(H_)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new ipe({regexp:t.specialChars,decoration:(e,n,i)=>{let{doc:s}=n.state,a=ps(e[0],0);if(a==9){let o=s.lineAt(i),r=n.state.tabSize,c=Td(o.text,r,i-o.from);return ht.replace({widget:new hpe((r-c%r)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[a]||(this.decorationCache[a]=ht.replace({widget:new dpe(t,a)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(H_);t.startState.facet(H_)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const cpe="•";function upe(t){return t>=32?cpe:t==10?"␤":String.fromCharCode(9216+t)}class dpe extends yr{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=upe(this.code),i=e.state.phrase("Control character")+" "+(ape[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,n);if(s)return s;let a=document.createElement("span");return a.textContent=n,a.title=i,a.setAttribute("aria-label",i),a.className="cm-specialChar",a}ignoreEvent(){return!1}}class hpe extends yr{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function fpe(){return ppe}const mpe=ht.line({class:"cm-activeLine"}),ppe=ti.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let i of t.state.selection.ranges){let s=t.lineBlockAt(i.head);s.from>e&&(n.push(mpe.range(s.from)),e=s.from)}return ht.set(n)}},{decorations:t=>t.decorations});class gpe extends yr{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?rd(e.firstChild):[];if(!n.length)return null;let i=window.getComputedStyle(e.parentNode),s=qm(n[0],i.direction!="rtl"),a=parseInt(i.lineHeight);return s.bottom-s.top>a*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+a}:s}ignoreEvent(){return!1}}function _pe(t){let e=ti.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ht.set([ht.widget({widget:new gpe(t),side:1}).range(0)]):ht.none}get decorations(){return this.view.state.doc.length?ht.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,Ke.contentAttributes.of({"aria-placeholder":t})]:e}const aS=2e3;function ype(t,e,n){let i=Math.min(e.line,n.line),s=Math.max(e.line,n.line),a=[];if(e.off>aS||n.off>aS||e.col<0||n.col<0){let o=Math.min(e.off,n.off),r=Math.max(e.off,n.off);for(let c=i;c<=s;c++){let u=t.doc.line(c);u.length<=r&&a.push(Me.range(u.from+o,u.to+r))}}else{let o=Math.min(e.col,n.col),r=Math.max(e.col,n.col);for(let c=i;c<=s;c++){let u=t.doc.line(c),h=D2(u.text,o,t.tabSize,!0);if(h<0)a.push(Me.cursor(u.to));else{let p=D2(u.text,r,t.tabSize);a.push(Me.range(u.from+h,u.from+p))}}}return a}function bpe(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function _P(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),i=t.state.doc.lineAt(n),s=n-i.from,a=s>aS?-1:s==i.length?bpe(t,e.clientX):Td(i.text,t.state.tabSize,n-i.from);return{line:i.number,col:a,oLine truncated
`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new M0e(this):new T0e(this)}getCursor(e,n=0,i){let s=e.doc?e:Qt.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?Tu(this,s,n,i):Au(this,s,n,i)}}class n8{constructor(e){this.spec=e}}function Au(t,e,n,i){return new hd(e.doc,t.unquoted,n,i,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?A0e(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function A0e(t,e){return(n,i,s,a)=>((a>n||a+s.length<i)&&(a=Math.max(0,n-2),s=t.sliceString(a,Math.min(t.length,i+2))),(e(j0(s,n-a))!=In.Word||e(D0(s,n-a))!=In.Word)&&(e(D0(s,i-a))!=In.Word||e(j0(s,i-a))!=In.Word))}class T0e extends n8{constructor(e){super(e)}nextMatch(e,n,i){let s=Au(this.spec,e,i,e.doc.length).nextOverlapping();if(s.done){let a=Math.min(e.doc.length,n+this.spec.unquoted.length);s=Au(this.spec,e,0,a).nextOverlapping()}return s.done||s.value.from==n&&s.value.to==i?null:s.value}prevMatchInRange(e,n,i){for(let s=i;;){let a=Math.max(n,s-1e4-this.spec.unquoted.length),o=Au(this.spec,e,a,s),r=null;for(;!o.nextOverlapping().done;)r=o.value;if(r)return r;if(a==n)return null;s-=1e4}}prevMatch(e,n,i){let s=this.prevMatchInRange(e,0,n);return s||(s=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=n||s.to!=i)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,n){let i=Au(this.spec,e,0,e.doc.length),s=[];for(;!i.next().done;){if(s.length>=n)return null;s.push(i.value)}return s}highlight(e,n,i,s){let a=Au(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}function Tu(t,e,n,i){return new Z6(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?N0e(e.charCategorizer(e.selection.main.head)):void 0},n,i)}function j0(t,e){return t.slice(Oi(t,e,!1),e)}function D0(t,e){return t.slice(e,Oi(t,e))}function N0e(t){return(e,n,i)=>!i[0].length||(t(j0(i.input,i.index))!=In.Word||t(D0(i.input,i.index))!=In.Word)&&(t(D0(i.input,i.index+i[0].length))!=In.Word||t(j0(i.input,i.index+i[0].length))!=In.Word)}class M0e extends n8{nextMatch(e,n,i){let s=Tu(this.spec,e,i,e.doc.length).next();return s.done&&(s=Tu(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,i){for(let s=1;;s++){let a=Math.max(n,i-s*1e4),o=Tu(this.spec,e,a,i),r=null;for(;!o.next().done;)r=o.value;if(r&&(a==n||r.from>a+10))return r;if(a==n)return null}}prevMatch(e,n,i){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let a=+i.slice(0,s);if(a>0&&a<e.match.length)return e.match[a]+i.slice(s)}return n})}matchAll(e,n){let i=Tu(this.spec,e,0,e.doc.length),s=[];for(;!i.next().done;){if(s.length>=n)return null;s.push(i.value)}return s}highlight(e,n,i,s){let a=Tu(this.spec,e,Math.max(0,n-250),Math.min(i+250,e.doc.length));for(;!a.next().done;)s(a.value.from,a.value.to)}}const um=Mt.define(),ok=Mt.define(),ol=Pi.define({create(t){return new x1(bS(t).create(),null)},update(t,e){for(let n of e.effects)n.is(um)?t=new x1(n.value.create(),t.panel):n.is(ok)&&(t=new x1(t.query,n.value?rk:null));return t},provide:t=>om.from(t,e=>e.panel)});class x1{constructor(e,n){this.query=e,this.panel=n}}const O0e=ht.mark({class:"cm-searchMatch"}),L0e=ht.mark({class:"cm-searchMatch cm-searchMatch-selected"}),E0e=ti.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(ol))}update(t){let e=t.state.field(ol);(e!=t.startState.field(ol)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ht.none;let{view:n}=this,i=new mr;for(let s=0,a=n.visibleRanges,o=a.length;s<o;s++){let{from:r,to:c}=a[s];for(;s<o-1&&c>a[s+1].from-500;)c=a[++s].to;t.highlight(n.state,r,c,(u,h)=>{let p=n.state.selection.ranges.some(g=>g.from==u&&g.to==h);i.add(u,h,p?L0e:O0e)})}return i.finish()}},{decorations:t=>t.decorations});function Qm(t){return e=>{let n=e.state.field(ol,!1);return n&&n.query.spec.valid?t(e,n):a8(e)}}const F0=Qm((t,{query:e})=>{let{to:n}=t.state.selection.main,i=e.nextMatch(t.state,n,n);if(!i)return!1;let s=Me.single(i.from,i.to),a=t.state.facet(Ec);return t.dispatch({selection:s,effects:[lk(t,i),a.scrollToMatch(s.main,t)],userEvent:"select.search"}),s8(t),!0}),U0=Qm((t,{query:e})=>{let{state:n}=t,{from:i}=n.selection.main,s=e.prevMatch(n,i,i);if(!s)return!1;let a=Me.single(s.from,s.to),o=t.state.facet(Ec);return t.dispatch({selection:a,effects:[lk(t,s),o.scrollToMatch(a.main,t)],userEvent:"select.search"}),s8(t),!0}),P0e=Qm((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Me.create(n.mLine truncated
`)}}Yi.defaultYaml={explicit:!1,version:"1.2"};Yi.defaultTags={"!!":"tag:yaml.org,2002:"};function E8(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){const n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function P8(t){const e=new Set;return Od(t,{Value(n,i){i.anchor&&e.add(i.anchor)}}),e}function R8(t,e){for(let n=1;;++n){const i=`${t}${n}`;if(!e.has(i))return i}}function Qbe(t,e){const n=[],i=new Map;let s=null;return{onAnchor:a=>{n.push(a),s??(s=P8(t));const o=R8(e,s);return s.add(o),o},setAnchors:()=>{for(const a of n){const o=i.get(a);if(typeof o=="object"&&o.anchor&&(On(o.node)||Zn(o.node)))o.node.anchor=o.anchor;else{const r=new Error("Failed to resolve repeated object (this should not happen)");throw r.source=a,r}}},sourceObjects:i}}function Fu(t,e,n,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let s=0,a=i.length;s<a;++s){const o=i[s],r=Fu(t,i,String(s),o);r===void 0?delete i[s]:r!==o&&(i[s]=r)}else if(i instanceof Map)for(const s of Array.from(i.keys())){const a=i.get(s),o=Fu(t,i,s,a);o===void 0?i.delete(s):o!==a&&i.set(s,o)}else if(i instanceof Set)for(const s of Array.from(i)){const a=Fu(t,i,s,s);a===void 0?i.delete(s):a!==s&&(i.delete(s),i.add(a))}else for(const[s,a]of Object.entries(i)){const o=Fu(t,i,s,a);o===void 0?delete i[s]:o!==a&&(i[s]=o)}return t.call(e,n,i)}function ca(t,e,n){if(Array.isArray(t))return t.map((i,s)=>ca(i,String(s),n));if(t&&typeof t.toJSON=="function"){if(!n||!L8(t))return t.toJSON(e,n);const i={aliasCount:0,count:1,res:void 0};n.anchors.set(t,i),n.onCreate=a=>{i.res=a,delete n.onCreate};const s=t.toJSON(e,n);return n.onCreate&&n.onCreate(s),s}return typeof t=="bigint"&&!n?.keep?Number(t):t}class gk{constructor(e){Object.defineProperty(this,ma,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:i,onAnchor:s,reviver:a}={}){if(!Ry(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},r=ca(this,"",o);if(typeof s=="function")for(const{count:c,res:u}of o.anchors.values())s(u,c);return typeof a=="function"?Fu(a,{"":r},"",r):r}}class _k extends gk{constructor(e){super(pk),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){let i;n?.aliasResolveCache?i=n.aliasResolveCache:(i=[],Od(e,{Node:(a,o)=>{(Pc(o)||L8(o))&&i.push(o)}}),n&&(n.aliasResolveCache=i));let s;for(const a of i){if(a===this)break;a.anchor===this.source&&(s=a)}return s}toJSON(e,n){if(!n)return{source:this.source};const{anchors:i,doc:s,maxAliasCount:a}=n,o=this.resolve(s,n);if(!o){const c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let r=i.get(o);if(r||(ca(o,null,n),r=i.get(o)),r?.res===void 0){const c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(a>=0&&(r.count+=1,r.aliasCount===0&&(r.aliasCount=$_(s,o,i)),r.count*r.aliasCount>a)){const c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return r.res}toString(e,n,i){const s=`*${this.source}`;if(e){if(E8(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const a=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(a)}if(e.implicitKey)return`${s} `}return s}}function $_(t,e,n){if(Pc(e)){const i=e.resolve(t),s=n&&i&&n.get(i);return s?s.count*s.aliasCount:0}else if(Zn(e)){let i=0;for(const s of e.items){const a=$_(t,s,n);a>i&&(i=a)}return i}else if(ni(e)){const i=$_(t,e.key,n),s=$_(t,e.value,n);return Math.max(i,s)}return 1}const j8=t=>!t||typeof t!="function"&&typeof t!="object";class Tt extends gk{constructor(e){super(yo),this.value=e}toJSON(e,n){return n?.keep?this.value:ca(this.value,e,n)}toString(){return String(this.value)}}Tt.BLOCK_FOLDED="BLOCK_FOLDED";Tt.BLOCK_LITERAL="BLOCK_LITERAL";Tt.PLAIN="PLAIN";Tt.QUOTE_DOUBLE="QUOTE_DOUBLE";Tt.QUOTE_SINGLE="QUOTE_SINGLE";const Ybe="tag:yaml.org,2002:";function Zbe(t,e,n){if(e){const i=n.filter(a=>a.tag===e),s=i.find(a=>!a.format)??i[0];if(!s)throw new Error(`Tag ${e} not found`);return s}return n.find(i=>i.identify?.(t)&&!i.format)}function gm(t,e,n){if(Ry(t)&&(t=t.contents),ei(t))return t;if(ni(t)){const p=n.schema[rl].createNode?.(n.schema,null,n);return p.items.push(t),p}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());const{aliasDuplicateObjects:i,onAnchor:s,onTagObj:a,schema:o,sourceObjects:r}=n;let c;if(i&&t&&typeof t=="object"){if(c=r.get(t),c)return c.anchor??(c.anchor=s(t)),new _k(c.anchor);c={anchor:null,node:null},r.set(t,c)}e?.startsWith("!!")&&(e=Ybe+e.slice(2));let u=Zbe(t,e,o.tags);if(!u){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){Line truncated
`)?rr(n,e):n.includes(`
`)?`
`+rr(n,e):(t.endsWith(" ")?"":" ")+n,F8="flow",TS="block",Q_="quoted";function jy(t,e,n="flow",{indentAtStart:i,lineWidth:s=80,minContentWidth:a=20,onFold:o,onOverflow:r}={}){if(!s||s<0)return t;s<a&&(a=0);const c=Math.max(1+a,1+s-e.length);if(t.length<=c)return t;const u=[],h={};let p=s-e.length;typeof i=="number"&&(i>s-Math.max(2,a)?u.push(0):p=s-i);let g,y,b=!1,x=-1,v=-1,A=-1;n===TS&&(x=TR(t,x,e.length),x!==-1&&(p=x+c));for(let T;T=t[x+=1];){if(n===Q_&&T==="\\"){switch(v=x,t[x+1]){case"x":x+=3;break;case"u":x+=5;break;case"U":x+=9;break;default:x+=1}A=x}if(T===`
`)n===TS&&(x=TR(t,x,e.length)),p=x+e.length+c,g=void 0;else{if(T===" "&&y&&y!==" "&&y!==`
`&&y!==" "){const L=t[x+1];L&&L!==" "&&L!==`
`&&L!==" "&&(g=x)}if(x>=p)if(g)u.push(g),p=g+c,g=void 0;else if(n===Q_){for(;y===" "||y===" ";)y=T,T=t[x+=1],b=!0;const L=x>A+1?x-2:v-1;if(h[L])return t;u.push(L),h[L]=!0,p=L+c,g=void 0}else b=!0}y=T}if(b&&r&&r(),u.length===0)return t;o&&o();let C=t.slice(0,u[0]);for(let T=0;T<u.length;++T){const L=u[T],N=u[T+1]||t.length;L===0?C=`
${e}${t.slice(0,N)}`:(n===Q_&&h[L]&&(C+=`${t[L]}\\`),C+=`
${e}${t.slice(L+1,N)}`)}return C}function TR(t,e,n){let i=e,s=e+1,a=t[s];for(;a===" "||a===" ";)if(e<s+n)a=t[++e];else{do a=t[++e];while(a&&a!==`
`);i=e,s=e+1,a=t[s]}return i}const Dy=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Fy=t=>/^(%|---|\.\.\.)/m.test(t);function exe(t,e,n){if(!e||e<0)return!1;const i=e-n,s=t.length;if(s<=i)return!1;for(let a=0,o=0;a<s;++a)if(t[a]===`
`){if(a-o>i)return!0;if(o=a+1,s-o<=i)return!1}return!0}function Bf(t,e){const n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;const{implicitKey:i}=e,s=e.options.doubleQuotedMinMultiLineLength,a=e.indent||(Fy(t)?" ":"");let o="",r=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(o+=n.slice(r,c)+"\\ ",c+=1,r=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{o+=n.slice(r,c);const h=n.substr(c+2,4);switch(h){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:h.substr(0,2)==="00"?o+="\\x"+h.substr(2):o+=n.substr(c,6)}c+=5,r=c+1}break;case"n":if(i||n[c+2]==='"'||n.length<s)c+=1;else{for(o+=n.slice(r,c)+`
`;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)o+=`
`,c+=2;o+=a,n[c+2]===" "&&(o+="\\"),c+=1,r=c+1}break;default:c+=1}return o=r?o+n.slice(r):n,i?o:jy(o,a,Q_,Dy(e,!1))}function NS(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
`)||/[ \t]\n|\n[ \t]/.test(t))return Bf(t,e);const n=e.indent||(Fy(t)?" ":""),i="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
${n}`)+"'";return e.implicitKey?i:jy(i,n,F8,Dy(e,!1))}function Uu(t,e){const{singleQuote:n}=e.options;let i;if(n===!1)i=Bf;else{const s=t.includes('"'),a=t.includes("'");s&&!a?i=NS:a&&!s?i=Bf:i=n?NS:Bf}return i(t,e)}let MS;try{MS=new RegExp(`(^|(?<!
))
+(?!
|$)`,"g")}catch{MS=/\n+(?!\n|$)/g}function Y_({comment:t,type:e,value:n},i,s,a){const{blockQuote:o,commentString:r,lineWidth:c}=i.options;if(!o||/\n[\t ]+$/.test(n))return Uu(n,i);const u=i.indent||(i.forceBlockIndent||Fy(n)?" ":""),h=o==="literal"?!0:o==="folded"||e===Tt.BLOCK_FOLDED?!1:e===Tt.BLOCK_LITERAL?!0:!exe(n,c,u.length);if(!n)return h?`|
`:`>
`;let p,g;for(g=n.length;g>0;--g){const N=n[g-1];if(N!==`
`&&N!==" "&&N!==" ")break}let y=n.substring(g);const b=y.indexOf(`
`);b===-1?p="-":n===y||b!==y.length-1?(p="+",a&&a()):p="",y&&(n=n.slice(0,-y.length),y[y.length-1]===`
`&&(y=y.slice(0,-1)),y=y.replace(MS,`$&${u}`));let x=!1,v,A=-1;for(v=0;v<n.length;++v){const N=n[v];if(N===" ")x=!0;else if(N===`
`)A=v;else break}let C=n.substring(0,A<v?A+1:v);C&&(n=n.substring(C.length),C=C.replace(/\n+/g,`$&${u}`));let L=(x?u?"2":"1":"")+p;if(t&&(L+=" "+r(t.replace(/ ?[\r\n]+/g," ")),s&&s()),!h){const N=n.replace(/\n+/g,`
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`);let O=!1;const M=Dy(i,!0);o!=="folded"&&e!==Tt.BLOCK_FOLDED&&(M.onOverflow=()=>{O=!0});const E=jy(`${C}${N}${y}`,u,TS,M);if(!O)return`>${L}
${u}${E}`}return n=n.replace(/\n+/g,`$&${u}`),`|${L}
${u}${C}${n}${y}`}function txe(t,e,n,i){const{type:s,value:a}=t,{actualString:o,implicitKey:r,indent:c,indentStep:u,inFlow:h}=e;if(r&&a.includes(`
`)||h&&/[[\]{},]/.test(a))return Uu(a,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return r||h||!a.includes(`
`)?Uu(a,e):Y_(t,e,n,i);if(!r&&!h&&s!==Tt.PLAIN&&a.includes(`
`))return Y_(t,e,n,i);if(Fy(a)){if(c==="")return e.forceBlockIndent=!0,Y_(t,e,n,i);if(r&&c===u)return Uu(a,e)}const p=a.replace(/\n+/g,`$&
${c}`);if(o){const g=x=>x.default&&x.tag!=="tag:yaml.org,2002:str"&&x.test?.test(p),{compat:y,tags:b}=e.doc.schema;if(b.some(g)||y?.some(g))return Uu(a,e)}return r?p:jy(p,c,F8,Dy(e,!1))}function yk(t,e,n,i){const{implicitKey:s,inFlow:a}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)});let{type:r}=t;r!==Tt.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(r=Tt.QUOTE_DOUBLE);const c=h=>{switch(h){case Tt.BLOCK_FOLDED:case Tt.BLOCK_LITERAL:return s||a?Uu(o.value,e):Y_(o,e,n,i);case Tt.QUOTE_DOUBLE:return Bf(o.value,e);case Tt.QUOTE_SINGLE:return NS(o.value,e);case Tt.PLAIN:return txe(o,e,n,i);default:return null}};let u=c(r);if(u===null){const{defaultKeyType:h,defaultStringType:p}=e.options,g=s&&h||p;if(u=c(g),u===null)throw new Error(`Unsupported default string type ${g}`)}return u}function U8(t,e){const n=Object.assign({blockQuote:!0,commentString:Jbe,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e);let i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:i,options:n}}function nxe(t,e){if(e.tag){const s=t.filter(a=>a.tag===e.tag);if(s.length>0)return s.find(a=>a.format===e.format)??s[0]}let n,i;if(On(e)){i=e.value;let s=t.filter(a=>a.identify?.(i));if(s.length>1){const a=s.filter(o=>o.test);a.length>0&&(s=a)}n=s.find(a=>a.format===e.format)??s.find(a=>!a.format)}else i=e,n=t.find(s=>s.nodeClass&&i instanceof s.nodeClass);if(!n){const s=i?.constructor?.name??(i===null?"null":typeof i);throw new Error(`Tag not resolved for ${s} value`)}return n}function ixe(t,e,{anchors:n,doc:i}){if(!i.directives)return"";const s=[],a=(On(t)||Zn(t))&&t.anchor;a&&E8(a)&&(n.add(a),s.push(`&${a}`));const o=t.tag??(e.default?null:e.tag);return o&&s.push(i.directives.tagString(o)),s.join(" ")}function pd(t,e,n,i){if(ni(t))return t.toString(e,n,i);if(Pc(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let s;const a=ei(t)?t:e.doc.createNode(t,{onTagObj:c=>s=c});s??(s=nxe(e.doc.schema.tags,a));const o=ixe(a,s,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const r=typeof s.stringify=="function"?s.stringify(a,e,n,i):On(a)?yk(a,e,n,i):a.toString(e,n,i);return o?On(a)||r[0]==="{"||r[0]==="["?`${o} ${r}`:`${o}
${e.indent}${r}`:r}function sxe({key:t,value:e},n,i,s){const{allNullValues:a,doc:o,indent:r,indentStep:c,options:{commentString:u,indentSeq:h,simpleKeys:p}}=n;let g=ei(t)&&t.comment||null;if(p){if(g)throw new Error("With simple keys, key nodes cannot have comments");if(Zn(t)||!ei(t)&&typeof t=="object"){const M="With simple keys, collection cannot be used as a key value";throw new Error(M)}}let y=!p&&(!t||g&&e==null&&!n.inFlow||Zn(t)||(On(t)?t.type===Tt.BLOCK_FOLDED||t.type===Tt.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!y&&(p||!a),indent:r+c});let b=!1,x=!1,v=pd(t,n,()=>b=!0,()=>x=!0);if(!y&&!n.inFlow&&v.length>1024){if(p)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(n.inFlow){if(a||e==null)return b&&i&&i(),v===""?"?":y?`? ${v}`:v}else if(a&&!p||e==null&&y)return v=`? ${v}`,g&&!b?v+=oc(v,n.indent,u(g)):x&&s&&s(),v;b&&(g=null),y?(g&&(v+=oc(v,n.indent,u(g))),v=`? ${v}
${r}:`):(v=`${v}:`,g&&(v+=oc(v,n.indent,u(g))));let A,C,T;ei(e)?(A=!!e.spaceBefore,C=e.commentBefore,T=e.comment):(A=!1,C=null,T=null,e&&typeof e=="object"&&(e=o.createNode(e))),n.implicitKey=!1,!y&&!g&&On(e)&&(n.indentAtStart=v.length+1),x=!1,!h&&c.length>=2&&!n.inFlow&&!y&&Ym(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let L=!1;const N=pd(e,n,()=>L=!0,()=>x=!0);let O=" ";if(g||A||C){if(O=A?`
`:"",C){const M=u(C);O+=`
${rr(M,n.indent)}`}N===""&&!n.inFlow?O===`
`&&T&&(O=`
`):O+=`
${n.indent}`}else if(!y&&Zn(e)){const M=N[0],E=N.indexOf(`
`),j=E!==-1,D=n.inFlow??e.flow??e.items.length===0;if(j||!D){let F=!1;if(j&&(M==="&"||M==="!")){let U=N.indexOf(" ");M==="&"&&U!==-1&&U<E&&N[U+1]==="!"&&(U=N.indexOf(" ",U+1)),(U===-1||E<U)&&(F=!0)}F||(O=`
${n.indent}`)}}else(N===""||N[0]===`
`)&&(O="");return v+=O+N,n.inFlow?L&&i&&i():T&&!L?v+=oc(v,n.indent,u(T)):x&&s&&s(),v}function B8(t,e){(t==="debug"||t==="warn")&&console.warn(e)}const g_="<<",dr={identify:t=>t===g_||typeof t=="symbol"&&t.description===g_,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Tt(Symbol(g_)),{addToJSMap:I8}),stringify:()=>g_},axe=(t,e)=>(dr.identify(e)||On(e)&&(!e.type||e.type===Tt.PLAIN)&&dr.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===dr.tag&&n.default);function I8(t,e,n){if(n=t&&Pc(n)?n.resolve(t.doc):n,Ym(n))for(const i of n.items)M1(t,e,i);else if(Array.isArray(n))for(const i of n)M1(t,e,i);else M1(t,e,n)}function M1(t,e,n){const i=t&&Pc(n)?n.resolve(t.doc):n;if(!pl(i))throw new Error("Merge sources must be maps or map aliases");const s=i.toJSON(null,t,Map);for(const[a,o]of s)e instanceof Map?e.has(a)||e.set(a,o):e instanceof Set?e.add(a):Object.prototype.hasOwnProperty.call(e,a)||Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function q8(t,e,{key:n,value:i}){if(ei(n)&&n.addToJSMap)n.addToJSMap(t,e,i);else if(axe(t,n))I8(t,e,i);else{const s=ca(n,"",t);if(e instanceof Map)e.set(s,ca(i,s,t));else if(e instanceof Set)e.add(s);else{const a=oxe(n,s,t),o=ca(i,a,t);a in e?Object.defineProperty(e,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[a]=o}}return e}function oxe(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(ei(t)&&n?.doc){const i=U8(n.doc,{});i.anchors=new Set;for(const a of n.anchors.keys())i.anchors.add(a.anchor);i.inFlow=!0,i.inStringifyKey=!0;const s=t.toString(i);if(!n.mapKeyWarned){let a=JSON.stringify(s);a.length>40&&(a=a.substring(0,36)+'..."'),B8(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${a}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return s}return JSON.stringify(e)}function bk(t,e,n){const i=gm(t,void 0,n),s=gm(e,void 0,n);return new os(i,s)}class os{constructor(e,n=null){Object.defineProperty(this,ma,{value:O8}),this.key=e,this.value=n}clone(e){let{key:n,value:i}=this;return ei(n)&&(n=n.clone(e)),ei(i)&&(i=i.clone(e)),new os(n,i)}toJSON(e,n){const i=n?.mapAsMap?new Map:{};return q8(n,i,this)}toString(e,n,i){return e?.doc?sxe(this,e,n,i):JSON.stringify(this)}}function z8(t,e,n){return(e.inFlow??t.flow?lxe:rxe)(t,e,n)}function rxe({comment:t,items:e},n,{blockItemPrefix:i,flowChars:s,itemIndent:a,onChompKeep:o,onComment:r}){const{indent:c,options:{commentString:u}}=n,h=Object.assign({},n,{indent:a,type:null});let p=!1;const g=[];for(let b=0;b<e.length;++b){const x=e[b];let v=null;if(ei(x))!p&&x.spaceBefore&&g.push(""),W0(n,g,x.commentBefore,p),x.comment&&(v=x.comment);else if(ni(x)){const C=ei(x.key)?x.key:null;C&&(!p&&C.spaceBefore&&g.push(""),W0(n,g,C.commentBefore,p))}p=!1;let A=pd(x,h,()=>v=null,()=>p=!0);v&&(A+=oc(A,a,u(v))),p&&v&&(p=!1),g.push(i+A)}let y;if(g.length===0)y=s.start+s.end;else{y=g[0];for(let b=1;b<g.length;++b){const x=g[b];y+=x?`
${c}${x}`:`
`}}return t?(y+=`
`+rr(u(t),c),r&&r()):p&&o&&o(),y}function lxe({items:t},e,{flowChars:n,itemIndent:i}){const{indent:s,indentStep:a,flowCollectionPadding:o,options:{commentString:r}}=e;i+=a;const c=Object.assign({},e,{indent:i,inFlow:!0,type:null});let u=!1,h=0;const p=[];for(let b=0;b<t.length;++b){const x=t[b];let v=null;if(ei(x))x.spaceBefore&&p.push(""),W0(e,p,x.commentBefore,!1),x.comment&&(v=x.comment);else if(ni(x)){const C=ei(x.key)?x.key:null;C&&(C.spaceBefore&&p.push(""),W0(e,p,C.commentBefore,!1),C.comment&&(u=!0));const T=ei(x.value)?x.value:null;T?(T.comment&&(v=T.comment),T.commentBefore&&(u=!0)):x.value==null&&C?.comment&&(v=C.comment)}v&&(u=!0);let A=pd(x,c,()=>v=null);b<t.length-1&&(A+=","),v&&(A+=oc(A,i,r(v))),!u&&(p.length>h||A.includes(`
`))&&(u=!0),p.push(A),h=p.length}const{start:g,end:y}=n;if(p.length===0)return g+y;if(!u){const b=p.reduce((x,v)=>x+v.length+2,2);u=e.options.lineWidth>0&&b>e.options.lineWidth}if(u){let b=g;for(const x of p)b+=x?`
${a}${s}${x}`:`
`;return`${b}
${s}${y}`}else return`${g}${o}${p.join(" ")}${o}${y}`}function W0({indent:t,options:{commentString:e}},n,i,s){if(i&&s&&(i=i.replace(/^\n+/,"")),i){const a=rr(e(i),t);n.push(a.trimStart())}}function rc(t,e){const n=On(e)?e.value:e;for(const i of t)if(ni(i)&&(i.key===e||i.key===n||On(i.key)&&i.key.value===n))return i}class na extends D8{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(rl,e),this.items=[]}static from(e,n,i){const{keepUndefined:s,replacer:a}=i,o=new this(e),r=(c,u)=>{if(typeof a=="function")u=a.call(n,c,u);else if(Array.isArray(a)&&!a.includes(c))return;(u!==void 0||s)&&o.items.push(bk(c,u,i))};if(n instanceof Map)for(const[c,u]of n)r(c,u);else if(n&&typeof n=="object")for(const c of Object.keys(n))r(c,n[c]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,n){let i;ni(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new os(e,e?.value):i=new os(e.key,e.value);const s=rc(this.items,i.key),a=this.schema?.sortMapEntries;if(s){if(!n)throw new Error(`Key ${i.key} already set`);On(s.value)&&j8(i.value)?s.value.value=i.value:s.value=i.value}else if(a){const o=this.items.findIndex(r=>a(i,r)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){const n=rc(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){const s=rc(this.items,e)?.value;return(!n&&On(s)?s.value:s)??void 0}has(e){return!!rc(this.items,e)}set(e,n){this.add(new os(e,n),!0)}toJSON(e,n,i){const s=i?new i:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(s);for(const a of this.items)q8(n,s,a);return s}toString(e,n,i){if(!e)return JSON.stringify(this);for(const s of this.items)if(!ni(s))throw new Error(`Map items must all be pairs; found ${JSON.stringify(s)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),z8(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:n})}}const Ld={collection:"map",default:!0,nodeClass:na,tag:"tag:yaml.org,2002:map",resolve(t,e){return pl(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>na.from(t,e,n)};class kc extends D8{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Md,e),this.items=[]}add(e){this.items.push(e)}delete(e){const n=__(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){const i=__(e);if(typeof i!="number")return;const s=this.items[i];return!n&&On(s)?s.value:s}has(e){const n=__(e);return typeof n=="number"&&n<this.items.length}set(e,n){const i=__(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);const s=this.items[i];On(s)&&j8(n)?s.value=n:this.items[i]=n}toJSON(e,n){const i=[];n?.onCreate&&n.onCreate(i);let s=0;for(const a of this.items)i.push(ca(a,String(s++),n));return i}toString(e,n,i){return e?z8(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:n}):JSON.stringify(this)}static from(e,n,i){const{replacer:s}=i,a=new this(e);if(n&&Symbol.iterator in Object(n)){let o=0;for(let r of n){if(typeof s=="function"){const c=n instanceof Set?r:String(o++);r=s.call(n,c,r)}a.items.push(gm(r,void 0,i))}}return a}}function __(t){let e=On(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const Ed={collection:"seq",default:!0,nodeClass:kc,tag:"tag:yaml.org,2002:seq",resolve(t,e){return Ym(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>kc.from(t,e,n)},Uy={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,i){return e=Object.assign({actualString:!0},e),yk(t,e,n,i)}},By={identify:t=>t==null,createNode:()=>new Tt(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Tt(null),stringify:({source:t},e)=>typeof t=="string"&&By.test.test(t)?t:e.options.nullStr},xk={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new Tt(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&xk.test.test(t)){const i=t[0]==="t"||t[0]==="T";if(e===i)return t}return e?n.options.trueStr:n.options.falseStr}};function qa({format:t,minFractionDigits:e,tag:n,value:i}){if(typeof i=="bigint")return String(i);const s=typeof i=="number"?i:Number(i);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let a=Object.is(i,-0)?"-0":JSON.stringify(i);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^\d/.test(a)){let o=a.indexOf(".");o<0&&(o=a.length,a+=".");let r=e-(a.length-o-1);for(;r-- >0;)a+="0"}return a}const K8={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:qa},H8={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",forLine truncated
`:" ")}return yk({comment:t,type:e,value:r},i,s,a)}};function Q8(t,e){if(Ym(t))for(let n=0;n<t.items.length;++n){let i=t.items[n];if(!ni(i)){if(pl(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");const s=i.items[0]||new os(new Tt(null));if(i.commentBefore&&(s.key.commentBefore=s.key.commentBefore?`${i.commentBefore}
${s.key.commentBefore}`:i.commentBefore),i.comment){const a=s.value??s.key;a.comment=a.comment?`${i.comment}
${a.comment}`:i.comment}i=s}t.items[n]=ni(i)?i:new os(i)}}else e("Expected a sequence for this tag");return t}function Y8(t,e,n){const{replacer:i}=n,s=new kc(t);s.tag="tag:yaml.org,2002:pairs";let a=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof i=="function"&&(o=i.call(e,String(a++),o));let r,c;if(Array.isArray(o))if(o.length===2)r=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const u=Object.keys(o);if(u.length===1)r=u[0],c=o[r];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else r=o;s.items.push(bk(r,c,n))}return s}const wk={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Q8,createNode:Y8};class Yu extends kc{constructor(){super(),this.add=na.prototype.add.bind(this),this.delete=na.prototype.delete.bind(this),this.get=na.prototype.get.bind(this),this.has=na.prototype.has.bind(this),this.set=na.prototype.set.bind(this),this.tag=Yu.tag}toJSON(e,n){if(!n)return super.toJSON(e);const i=new Map;n?.onCreate&&n.onCreate(i);for(const s of this.items){let a,o;if(ni(s)?(a=ca(s.key,"",n),o=ca(s.value,a,n)):a=ca(s,"",n),i.has(a))throw new Error("Ordered maps must not include duplicate keys");i.set(a,o)}return i}static from(e,n,i){const s=Y8(e,n,i),a=new this;return a.items=s.items,a}}Yu.tag="tag:yaml.org,2002:omap";const kk={collection:"seq",identify:t=>t instanceof Map,nodeClass:Yu,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){const n=Q8(t,e),i=[];for(const{key:s}of n.items)On(s)&&(i.includes(s.value)?e(`Ordered maps must not include duplicate keys: ${s.value}`):i.push(s.value));return Object.assign(new Yu,n)},createNode:(t,e,n)=>Yu.from(t,e,n)};function Z8({value:t,source:e},n){return e&&(t?J8:eF).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}const J8={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Tt(!0),stringify:Z8},eF={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Tt(!1),stringify:Z8},fxe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:qa},mxe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){const e=Number(t.value);return isFinite(e)?e.toExponential():qa(t)}},pxe={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){const e=new Tt(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){const i=t.substring(n+1).replace(/_/g,"");i[i.length-1]==="0"&&(e.minFractionDigits=i.length)}return e},stringify:qa},Zm=t=>typeof t=="bigint"||Number.isInteger(t);function qy(t,e,n,{intAsBigInt:i}){const s=t[0];if((s==="-"||s==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),i){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}const o=BigInt(t);return s==="-"?BigInt(-1)*o:o}const a=parseInt(t,n);return s==="-"?-1*a:a}function Ck(t,e,n){const{value:i}=t;if(Zm(i)){const s=i.toString(e);return i<0?"-"+n+s.substr(1):n+s}return qa(t)}const gxe={identify:Zm,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>qy(t,2,2,n),stringify:t=>Ck(t,2,"0b")},_xe={identify:Zm,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>qy(t,1,8,n),stringify:t=>Ck(t,8,"0")},yxe={identify:Zm,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>qy(t,0,10,n),stringify:qa},bxe={identify:Zm,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>qy(t,2,16,n),stringify:t=>Ck(t,16,"0x")};class Zu extends na{constructor(e){super(e),this.tag=Zu.tag}add(e){let n;ni(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new os(e.key,null):n=new os(e,null),rc(this.items,n.key)||this.items.push(n)}get(e,n){const i=rc(this.items,e);return!n&&ni(i)?On(i.key)?i.key.value:i.key:i}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);const i=rc(this.items,e);i&&!n?this.items.splice(this.items.indexOf(i),1):!i&&n&&this.items.push(new os(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,i){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,i);throw new Error("Set items must all have null values")}static from(e,n,i){const{replacer:s}=i,a=new this(e);if(n&&Symbol.iterator in Object(n))for(let o of n)typeof s=="function"&&(o=s.call(n,o,o)),a.items.push(bk(o,null,i));return a}}Zu.tag="tag:yaml.org,2002:set";const Ak={collLine truncated
`)?(n.push("..."),n.push(rr(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||r)&&n[n.length-1]!==""&&n.push(""),n.push(rr(a(c),"")))}return n.join(`
`)+`
`}class Ky{constructor(e,n,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ma,{value:AS});let s=null;typeof n=="function"||Array.isArray(n)?s=n:i===void 0&&n&&(i=n,n=void 0);const a=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=a;let{version:o}=a;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new Yi({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,s,i)}clone(){const e=Object.create(Ky.prototype,{[ma]:{value:AS}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=ei(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){xu(this.contents)&&this.contents.add(e)}addIn(e,n){xu(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){const i=P8(this);e.anchor=!n||i.has(n)?R8(n||"a",i):n}return new _k(e.anchor)}createNode(e,n,i){let s;if(typeof n=="function")e=n.call({"":e},"",e),s=n;else if(Array.isArray(n)){const v=C=>typeof C=="number"||C instanceof String||C instanceof Number,A=n.filter(v).map(String);A.length>0&&(n=n.concat(A)),s=n}else i===void 0&&n&&(i=n,n=void 0);const{aliasDuplicateObjects:a,anchorPrefix:o,flow:r,keepUndefined:c,onTagObj:u,tag:h}=i??{},{onAnchor:p,setAnchors:g,sourceObjects:y}=Qbe(this,o||"a"),b={aliasDuplicateObjects:a??!0,keepUndefined:c??!1,onAnchor:p,onTagObj:u,replacer:s,schema:this.schema,sourceObjects:y},x=gm(e,h,b);return r&&Zn(x)&&(x.flow=!0),g(),x}createPair(e,n,i={}){const s=this.createNode(e,null,i),a=this.createNode(n,null,i);return new os(s,a)}delete(e){return xu(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ff(e)?this.contents==null?!1:(this.contents=null,!0):xu(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return Zn(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return ff(e)?!n&&On(this.contents)?this.contents.value:this.contents:Zn(this.contents)?this.contents.getIn(e,n):void 0}has(e){return Zn(this.contents)?this.contents.has(e):!1}hasIn(e){return ff(e)?this.contents!==void 0:Zn(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=V0(this.schema,[e],n):xu(this.contents)&&this.contents.set(e,n)}setIn(e,n){ff(e)?this.contents=n:this.contents==null?this.contents=V0(this.schema,Array.from(e),n):xu(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Yi({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Yi({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{const s=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${s}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(i)this.schema=new Nk(Object.assign(i,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:i,maxAliasCount:s,onAnchor:a,reviver:o}={}){const r={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},c=ca(this.contents,n??"",r);if(typeof a=="function")for(const{count:u,res:h}of r.anchors.values())a(h,u);return typeof o=="function"?Fu(o,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Sxe(this,e)}}function xu(t){if(Zn(t))return!0;throw new Error("Expected a YAML collection as document contents")}class sF extends Error{constructor(e,n,i,s){super(),this.name=e,this.code=i,this.message=s,this.pos=n}}class mf extends sF{constructor(e,n,i){super("YAMLParseError",e,n,i)}}class wxe extends sF{constructor(e,n,i){super("YAMLWarning",e,n,i)}}const ER=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(r=>e.linePos(r));const{line:i,col:s}=n.linePos[0];n.message+=` at line ${i}, column ${s}`;let a=s-1,o=t.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(a>=60&&o.length>80){const r=Math.min(a-39,o.length-79);o="…"+o.substring(r),a-=r-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,a))){let r=t.substring(e.lineStarts[i-2],e.lineStarts[i-1]);r.length>8Line truncated
`),o=r+o}if(/[^ ]/.test(o)){let r=1;const c=n.linePos[1];c?.line===i&&c.col>s&&(r=Math.max(1,Math.min(c.col-s,80-a)));const u=" ".repeat(a)+"^".repeat(r);n.message+=`:
${o}
${u}
`}};function gd(t,{flow:e,indicator:n,next:i,offset:s,onError:a,parentIndent:o,startOnNewline:r}){let c=!1,u=r,h=r,p="",g="",y=!1,b=!1,x=null,v=null,A=null,C=null,T=null,L=null,N=null;for(const E of t)switch(b&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&a(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),b=!1),x&&(u&&E.type!=="comment"&&E.type!=="newline"&&a(x,"TAB_AS_INDENT","Tabs are not allowed as indentation"),x=null),E.type){case"space":!e&&(n!=="doc-start"||i?.type!=="flow-collection")&&E.source.includes(" ")&&(x=E),h=!0;break;case"comment":{h||a(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const j=E.source.substring(1)||" ";p?p+=g+j:p=j,g="",u=!1;break}case"newline":u?p?p+=E.source:(!L||n!=="seq-item-ind")&&(c=!0):g+=E.source,u=!0,y=!0,(v||A)&&(C=E),h=!0;break;case"anchor":v&&a(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&a(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),v=E,N??(N=E.offset),u=!1,h=!1,b=!0;break;case"tag":{A&&a(E,"MULTIPLE_TAGS","A node can have at most one tag"),A=E,N??(N=E.offset),u=!1,h=!1,b=!0;break}case n:(v||A)&&a(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),L&&a(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),L=E,u=n==="seq-item-ind"||n==="explicit-key-ind",h=!1;break;case"comma":if(e){T&&a(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),T=E,u=!1,h=!1;break}default:a(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),u=!1,h=!1}const O=t[t.length-1],M=O?O.offset+O.source.length:s;return b&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&a(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),x&&(u&&x.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&a(x,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:T,found:L,spaceBefore:c,comment:p,hasNewline:y,anchor:v,tag:A,newlineAfterProp:C,end:M,start:N??M}}function _m(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
`))return!0;if(t.end){for(const e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of t.items){for(const n of e.start)if(n.type==="newline")return!0;if(e.sep){for(const n of e.sep)if(n.type==="newline")return!0}if(_m(e.key)||_m(e.value))return!0}return!1;default:return!0}}function OS(t,e,n){if(e?.type==="flow-collection"){const i=e.end[0];i.indent===t&&(i.source==="]"||i.source==="}")&&_m(e)&&n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function aF(t,e,n){const{uniqueKeys:i}=t.options;if(i===!1)return!1;const s=typeof i=="function"?i:(a,o)=>a===o||On(a)&&On(o)&&a.value===o.value;return e.some(a=>s(a.key,n))}const PR="All mapping items must start at the same column";function kxe({composeNode:t,composeEmptyNode:e},n,i,s,a){const o=a?.nodeClass??na,r=new o(n.schema);n.atRoot&&(n.atRoot=!1);let c=i.offset,u=null;for(const h of i.items){const{start:p,key:g,sep:y,value:b}=h,x=gd(p,{indicator:"explicit-key-ind",next:g??y?.[0],offset:c,onError:s,parentIndent:i.indent,startOnNewline:!0}),v=!x.found;if(v){if(g&&(g.type==="block-seq"?s(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in g&&g.indent!==i.indent&&s(c,"BAD_INDENT",PR)),!x.anchor&&!x.tag&&!y){u=x.end,x.comment&&(r.comment?r.comment+=`
`+x.comment:r.comment=x.comment);continue}(x.newlineAfterProp||_m(g))&&s(g??p[p.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else x.found?.indent!==i.indent&&s(c,"BAD_INDENT",PR);n.atKey=!0;const A=x.end,C=g?t(n,g,x,s):e(n,A,p,null,x,s);n.schema.compat&&OS(i.indent,g,s),n.atKey=!1,aF(n,r.items,C)&&s(A,"DUPLICATE_KEY","Map keys must be unique");const T=gd(y??[],{indicator:"map-value-ind",next:b,offset:C.range[2],onError:s,parentIndent:i.indent,startOnNewline:!g||g.type==="block-scalar"});if(c=T.end,T.found){v&&(b?.type==="block-map"&&!T.hasNewline&&s(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&x.start<T.found.offset-1024&&s(C.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const L=b?t(n,b,T,s):e(n,c,y,null,T,s);n.schema.compat&&OS(i.indent,b,s),c=L.range[2];const N=new os(C,L);n.options.keepSourceTokens&&(N.srcToken=h),r.items.push(N)}else{v&&s(C.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),T.comment&&(C.comment?C.comment+=`
`+T.comment:C.comment=T.comment);const L=new os(C);n.options.keepSourceTokens&&(L.srcToken=h),r.items.push(L)}}return u&&u<c&&s(u,"IMPOSSIBLE","Map comment with trailing content"),r.range=[i.offset,c,u??c],r}function Cxe({composeNode:t,composeEmptyNode:e},n,i,s,a){const o=a?.nodeClass??kc,r=new o(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=i.offset,u=null;for(const{start:h,value:p}of i.items){const g=gd(h,{indicator:"seq-item-ind",next:p,offset:c,onError:s,parentIndent:i.indent,startOnNewline:!0});if(!g.found)if(g.anchor||g.tag||p)p?.type==="block-seq"?s(g.end,"BAD_INDENT","All sequence items must start at the same column"):s(c,"MISSING_CHAR","Sequence item without - indicator");else{u=g.end,g.comment&&(r.comment=g.comment);continue}const y=p?t(n,p,g,s):e(n,g.end,h,null,g,s);n.schema.compat&&OS(i.indent,p,s),c=y.range[2],r.items.push(y)}return r.range=[i.offset,c,u??c],r}function Jm(t,e,n,i){let s="";if(t){let a=!1,o="";for(const r of t){const{source:c,type:u}=r;switch(u){case"space":a=!0;break;case"comment":{n&&!a&&i(r,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const h=c.substring(1)||" ";s?s+=o+h:s=h,o="";break}case"newline":s&&(o+=c),a=!0;break;default:i(r,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}e+=c.length}}return{comment:s,offset:e}}const L1="Block collections are not allowed within flow collections",E1=t=>t&&(t.type==="block-map"||t.type==="block-seq");function Axe({composeNode:t,composeEmptyNode:e},n,i,s,a){const o=i.start.source==="{",r=o?"flow map":"flow sequence",c=a?.nodeClass??(o?na:kc),u=new c(n.schema);u.flow=!0;const h=n.atRoot;h&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let p=i.offset+i.start.source.length;for(let v=0;v<i.items.length;++v){const A=i.items[v],{start:C,key:T,sep:L,value:N}=A,O=gd(C,{flow:r,indicator:"explicit-key-ind",next:T??L?.[0],offset:p,onError:s,parentIndent:i.indent,startOnNewline:!1});if(!O.found){if(!O.anchor&&!O.tag&&!L&&!N){v===0&&O.comma?s(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${r}`):v<i.items.length-1&&s(O.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${r}`),O.comment&&(u.comment?u.comment+=`
`+O.comment:u.comment=O.comment),p=O.end;continue}!o&&n.options.strict&&_m(T)&&s(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(v===0)O.comma&&s(O.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${r}`);else if(O.comma||s(O.start,"MISSING_CHAR",`Missing , between ${r} items`),O.comment){let M="";e:for(const E of C)switch(E.type){case"comma":case"space":break;case"comment":M=E.source.substring(1);break e;default:break e}if(M){let E=u.items[u.items.length-1];ni(E)&&(E=E.value??E.key),E.comment?E.comment+=`
`+M:E.comment=M,O.comment=O.comment.substring(M.length+1)}}if(!o&&!L&&!O.found){const M=N?t(n,N,O,s):e(n,O.end,L,null,O,s);u.items.push(M),p=M.range[2],E1(N)&&s(M.range,"BLOCK_IN_FLOW",L1)}else{n.atKey=!0;const M=O.end,E=T?t(n,T,O,s):e(n,M,C,null,O,s);E1(T)&&s(E.range,"BLOCK_IN_FLOW",L1),n.atKey=!1;const j=gd(L??[],{flow:r,indicator:"map-value-ind",next:N,offset:E.range[2],onError:s,parentIndent:i.indent,startOnNewline:!1});if(j.found){if(!o&&!O.found&&n.options.strict){if(L)for(const U of L){if(U===j.found)break;if(U.type==="newline"){s(U,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}O.start<j.found.offset-1024&&s(j.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else N&&("source"in N&&N.source?.[0]===":"?s(N,"MISSING_CHAR",`Missing space after : in ${r}`):s(j.start,"MISSING_CHAR",`Missing , or : between ${r} items`));const D=N?t(n,N,j,s):j.found?e(n,j.end,L,null,j,s):null;D?E1(N)&&s(D.range,"BLOCK_IN_FLOW",L1):j.comment&&(E.comment?E.comment+=`
`+j.comment:E.comment=j.comment);const F=new os(E,D);if(n.options.keepSourceTokens&&(F.srcToken=A),o){const U=u;aF(n,U.items,E)&&s(M,"DUPLICATE_KEY","Map keys must be unique"),U.items.push(F)}else{const U=new na(n.schema);U.flow=!0,U.items.push(F);const W=(D??E).range;U.range=[E.range[0],W[1],W[2]],u.items.push(U)}p=D?D.range[2]:j.end}}const g=o?"}":"]",[y,...b]=i.end;let x=p;if(y?.source===g)x=y.offset+y.source.length;else{const v=r[0].toUpperCase()+r.substring(1),A=h?`${v} must end with a ${g}`:`${v} in block collection must be sufficiently indented and end with a ${g}`;s(p,h?"MISSING_CHAR":"BAD_INDENT",A),y&&y.source.length!==1&&b.unshift(y)}if(b.length>0){const v=Jm(b,x,n.options.strict,s);v.comment&&(u.comment?u.comment+=`
`+v.comment:u.comment=v.comment),u.range=[i.offset,x,v.offset]}else u.range=[i.offset,x,x];return u}function P1(t,e,n,i,s,a){const o=n.type==="block-map"?kxe(t,e,n,i,a):n.type==="block-seq"?Cxe(t,e,n,i,a):Axe(t,e,n,i,a),r=o.constructor;return s==="!"||s===r.tagName?(o.tag=r.tagName,o):(s&&(o.tag=s),o)}function Txe(t,e,n,i,s){const a=i.tag,o=a?e.directives.tagName(a.source,g=>s(a,"TAG_RESOLVE_FAILED",g)):null;if(n.type==="block-seq"){const{anchor:g,newlineAfterProp:y}=i,b=g&&a?g.offset>a.offset?g:a:g??a;b&&(!y||y.offset<b.offset)&&s(b,"MISSING_CHAR","Missing newline after block sequence props")}const r=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!a||!o||o==="!"||o===na.tagName&&r==="map"||o===kc.tagName&&r==="seq")return P1(t,e,n,s,o);let c=e.schema.tags.find(g=>g.tag===o&&g.collection===r);if(!c){const g=e.schema.knownTags[o];if(g?.collection===r)e.schema.tags.push(Object.assign({},g,{default:!1})),c=g;else return g?s(a,"BAD_COLLECTION_TYPE",`${g.tag} used for ${r} collection, but expects ${g.collection??"scalar"}`,!0):s(a,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),P1(t,e,n,s,o)}const u=P1(t,e,n,s,o,c),h=c.resolve?.(u,g=>s(a,"TAG_RESOLVE_FAILED",g),e.options)??u,p=ei(h)?h:new Tt(h);return p.range=u.range,p.tag=o,c?.format&&(p.format=c.format),p}function Nxe(t,e,n){const i=e.offset,s=Mxe(e,t.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[i,i,i]};const a=s.mode===">"?Tt.BLOCK_FOLDED:Tt.BLOCK_LITERAL,o=e.source?Oxe(e.source):[];let r=o.length;for(let x=o.length-1;x>=0;--x){const v=o[x][1];if(v===""||v==="\r")r=x;else break}if(r===0){const x=s.chomp==="+"&&o.length>0?`
`.repeat(Math.max(1,o.length-1)):"";let v=i+s.length;return e.source&&(v+=e.source.length),{value:x,type:a,comment:s.comment,range:[i,v,v]}}let c=e.indent+s.indent,u=e.offset+s.length,h=0;for(let x=0;x<r;++x){const[v,A]=o[x];if(A===""||A==="\r")s.indent===0&&v.length>c&&(c=v.length);else{v.length<c&&n(u+v.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),s.indent===0&&(c=v.length),h=x,c===0&&!t.atRoot&&n(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=v.length+A.length+1}for(let x=o.length-1;x>=r;--x)o[x][0].length>c&&(r=x+1);let p="",g="",y=!1;for(let x=0;x<h;++x)p+=o[x][0].slice(c)+`
`;for(let x=h;x<r;++x){let[v,A]=o[x];u+=v.length+A.length+1;const C=A[A.length-1]==="\r";if(C&&(A=A.slice(0,-1)),A&&v.length<c){const L=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;n(u-A.length-(C?2:1),"BAD_INDENT",L),v=""}a===Tt.BLOCK_LITERAL?(p+=g+v.slice(c)+A,g=`
`):v.length>c||A[0]===" "?(g===" "?g=`
`:!y&&g===`
`&&(g=`
`),p+=g+v.slice(c)+A,g=`
`,y=!0):A===""?g===`
`?p+=`
`:g=`
`:(p+=g+A,g=" ",y=!1)}switch(s.chomp){case"-":break;case"+":for(let x=r;x<o.length;++x)p+=`
`+o[x][0].slice(c);p[p.length-1]!==`
`&&(p+=`
`);break;default:p+=`
`}const b=i+s.length+e.source.length;return{value:p,type:a,comment:s.comment,range:[i,b,b]}}function Mxe({offset:t,props:e},n,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:s}=e[0],a=s[0];let o=0,r="",c=-1;for(let g=1;g<s.length;++g){const y=s[g];if(!r&&(y==="-"||y==="+"))r=y;else{const b=Number(y);!o&&b?o=b:c===-1&&(c=t+g)}}c!==-1&&i(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let u=!1,h="",p=s.length;for(let g=1;g<e.length;++g){const y=e[g];switch(y.type){case"space":u=!0;case"newline":p+=y.source.length;break;case"comment":n&&!u&&i(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),p+=y.source.length,h=y.source.substring(1);break;case"error":i(y,"UNEXPECTED_TOKEN",y.message),p+=y.source.length;break;default:{const b=`Unexpected token in block scalar header: ${y.type}`;i(y,"UNEXPECTED_TOKEN",b);const x=y.source;x&&typeof x=="string"&&(p+=x.length)}}}return{mode:a,indent:o,chomp:r,comment:h,length:p}}function Oxe(t){const e=t.split(/\n( *)/),n=e[0],i=n.match(/^( *)/),a=[i?.[1]?[i[1],n.slice(i[1].length)]:["",n]];for(let o=1;o<e.length;o+=2)a.push([e[o],e[o+1]]);return a}function Lxe(t,e,n){const{offset:i,type:s,source:a,end:o}=t;let r,c;const u=(g,y,b)=>n(i+g,y,b);switch(s){case"scalar":r=Tt.PLAIN,c=Exe(a,u);break;case"single-quoted-scalar":r=Tt.QUOTE_SINGLE,c=Pxe(a,u);break;case"double-quoted-scalar":r=Tt.QUOTE_DOUBLE,c=Rxe(a,u);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[i,i+a.length,i+a.length]}}const h=i+a.length,p=Jm(o,h,e,n);return{value:c,type:r,comment:p.comment,range:[i,h,p.offset]}}function Exe(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),oF(t)}function Pxe(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),oF(t.slice(1,-1)).replace(/''/g,"'")}function oF(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
`,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(t);if(!i)return t;let s=i[1],a=" ",o=e.lastIndex;for(n.lastIndex=o;i=n.exec(t);)i[1]===""?a===`
`?s+=a:a=`
`:(s+=a+i[1],a=" "),o=n.lastIndex;const r=/[ \t]*(.*)/sy;return r.lastIndex=o,i=r.exec(t),s+a+(i?.[1]??"")}function Rxe(t,e){let n="";for(let i=1;i<t.length-1;++i){const s=t[i];if(!(s==="\r"&&t[i+1]===`
`))if(s===`
`){const{fold:a,offset:o}=jxe(t,i);n+=a,i=o}else if(s==="\\"){let a=t[++i];const o=Dxe[a];if(o)n+=o;else if(a===`
`)for(a=t[i+1];a===" "||a===" ";)a=t[++i+1];else if(a==="\r"&&t[i+1]===`
`)for(a=t[++i+1];a===" "||a===" ";)a=t[++i+1];else if(a==="x"||a==="u"||a==="U"){const r={x:2,u:4,U:8}[a];n+=Fxe(t,i+1,r,e),i+=r}else{const r=t.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${r}`),n+=r}}else if(s===" "||s===" "){const a=i;let o=t[i+1];for(;o===" "||o===" ";)o=t[++i+1];o!==`
`&&!(o==="\r"&&t[i+2]===`
`)&&(n+=i>a?t.slice(a,i+1):s)}else n+=s}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function jxe(t,e){let n="",i=t[e+1];for(;(i===" "||i===" "||i===`
`||i==="\r")&&!(i==="\r"&&t[e+2]!==`
`);)i===`
`&&(n+=`
`),e+=1,i=t[e+1];return n||(n=" "),{fold:n,offset:e}}const Dxe={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
`,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function Fxe(t,e,n,i){const s=t.substr(e,n),o=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(o)){const r=t.substr(e-2,n+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${r}`),r}return String.fromCodePoint(o)}function rF(t,e,n,i){const{value:s,type:a,comment:o,range:r}=e.type==="block-scalar"?Nxe(t,e,i):Lxe(e,t.options.strict,i),c=n?t.directives.tagName(n.source,p=>i(n,"TAG_RESOLVE_FAILED",p)):null;let u;t.options.stringKeys&&t.atKey?u=t.schema[yo]:c?u=Uxe(t.schema,s,c,n,i):e.type==="scalar"?u=Bxe(t,s,e,i):u=t.schema[yo];let h;try{const p=u.resolve(s,g=>i(n??e,"TAG_RESOLVE_FAILED",g),t.options);h=On(p)?p:new Tt(p)}catch(p){const g=p instanceof Error?p.message:String(p);i(n??e,"TAG_RESOLVE_FAILED",g),h=new Tt(s)}return h.range=r,h.source=s,a&&(h.type=a),c&&(h.tag=c),u.format&&(h.format=u.format),o&&(h.comment=o),h}function Uxe(t,e,n,i,s){if(n==="!")return t[yo];const a=[];for(const r of t.tags)if(!r.collection&&r.tag===n)if(r.default&&r.test)a.push(r);else return r;for(const r of a)if(r.test?.test(e))return r;const o=t.knownTags[n];return o&&!o.collection?(t.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[yo])}function Bxe({atKey:t,directives:e,schema:n},i,s,a){const o=n.tags.find(r=>(r.default===!0||t&&r.default==="key")&&r.test?.test(i))||n[yo];if(n.compat){const r=n.compat.find(c=>c.default&&c.test?.test(i))??n[yo];if(o.tag!==r.tag){const c=e.tagString(o.tag),u=e.tagString(r.tag),h=`Value may be parsed as either ${c} or ${u}`;a(s,"TAG_RESOLVE_FAILED",h,!0)}}return o}function Ixe(t,e,n){if(e){n??(n=e.length);for(let i=n-1;i>=0;--i){let s=e[i];switch(s.type){case"space":case"comment":case"newline":t-=s.source.length;continue}for(s=e[++i];s?.type==="space";)t+=s.source.length,s=e[++i];break}}return t}const qxe={composeNode:lF,composeEmptyNode:Mk};function lF(t,e,n,i){const s=t.atKey,{spaceBefore:a,comment:o,anchor:r,tag:c}=n;let u,h=!0;switch(e.type){case"alias":u=zxe(t,e,i),(r||c)&&i(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=rF(t,e,c,i),r&&(u.anchor=r.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":u=Txe(qxe,t,e,n,i),r&&(u.anchor=r.source.substring(1));break;default:{const p=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",p),u=Mk(t,e.offset,void 0,null,n,i),h=!1}}return r&&u.anchor===""&&i(r,"BAD_ALIAS","Anchor cannot be an empty string"),s&&t.options.stringKeys&&(!On(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&i(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),a&&(u.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?u.comment=o:u.commentBefore=o),t.options.keepSourceTokens&&h&&(u.srcToken=e),u}function Mk(t,e,n,i,{spaceBefore:s,comment:a,anchor:o,tag:r,end:c},u){const h={type:"scalar",offset:Ixe(e,n,i),indent:-1,source:""},p=rF(t,h,r,u);return o&&(p.anchor=o.source.substring(1),p.anchor===""&&u(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(p.spaceBefore=!0),a&&(p.comment=a,p.range[2]=c),p}function zxe({options:t},{offset:e,source:n,end:i},s){const a=new _k(n.substring(1));a.source===""&&s(e,"BAD_ALIAS","Alias cannot be an empty string"),a.source.endsWith(":")&&s(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+n.length,r=Jm(i,o,t.strict,s);return a.range=[e,o,r.offset],r.comment&&(a.comment=r.comment),a}function Kxe(t,e,{offset:n,start:i,value:s,end:a},o){const r=Object.assign({_directives:e},t),c=new Ky(void 0,r),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},h=gd(i,{indicator:"doc-start",next:s??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});h.found&&(c.directives.docStart=!0,s&&(s.type==="block-map"||s.type==="block-seq")&&!h.hasNewline&&o(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=s?lF(u,s,h,o):Mk(u,h.end,i,null,h,o);const p=c.contents.range[2],g=Jm(a,p,!1,o);return g.comment&&(c.comment=g.comment),c.range=[n,p,g.offset],c}function Yh(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];const{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function RR(t){let e="",n=!1,i=!1;for(let s=0;s<t.length;++s){const a=t[s];switch(a[0]){case"#":e+=(e===""?"":i?`
`:`
`)+(a.substring(1)||" "),n=!0,i=!1;break;case"%":t[s+1]?.[0]!=="#"&&(s+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:e,afterEmptyLine:i}}class Hxe{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,i,s,a)=>{const o=Yh(n);a?this.warnings.push(new wxe(o,i,s)):this.errors.push(new mf(o,i,s))},this.directives=new Yi({version:e.version||"1.2"}),this.options=e}decorate(e,n){const{comment:i,afterEmptyLine:s}=RR(this.prelude);if(i){const a=e.contents;if(n)e.comment=e.comment?`${e.comment}
${i}`:i;else if(s||e.directives.docStart||!a)e.commentBefore=i;else if(Zn(a)&&!a.flow&&a.items.length>0){let o=a.items[0];ni(o)&&(o=o.key);const r=o.commentBefore;o.commentBefore=r?`${i}
${r}`:i}else{const o=a.commentBefore;a.commentBefore=o?`${i}
${o}`:i}}n?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:RR(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,i=-1){for(const s of e)yield*this.next(s);yield*this.end(n,i)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(n,i,s)=>{const a=Yh(e);a[0]+=n,this.onError(a,"BAD_DIRECTIVE",i,s)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const n=Kxe(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new mf(Yh(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){const i="Unexpected doc-end without preceding document";this.errors.push(new mf(Yh(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;const n=Jm(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){const i=this.doc.comment;this.doc.comment=i?`${i}
${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new mf(Yh(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const i=Object.assign({_directives:this.directives},this.options),s=new Ky(void 0,i);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),s.range=[0,n,n],this.decorate(s,!1),yield s}}}const cF="\uFEFF",uF="",dF="",LS="";function Vxe(t){switch(t){case cF:return"byte-order-mark";case uF:return"doc-mode";case dF:return"flow-error-end";case LS:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
`:case`\r
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Na(t){switch(t){case void 0:case" ":case`
`:case"\r":case" ":return!0;default:return!1}}const jR=new Set("0123456789ABCDEFabcdef"),Wxe=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),b_=new Set(",[]{}"),Gxe=new Set(` ,[]{}
\r `),R1=t=>!t||Gxe.has(t);class Xxe{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let i=this.next??"stream";for(;i&&(n||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
`?!0:n==="\r"?this.buffer[e+1]===`
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let i=0;for(;n===" ";)n=this.buffer[++i+e];if(n==="\r"){const s=this.buffer[i+e+1];if(s===`
`||!s&&!this.atEnd)return e+i+1}return n===`
`||i>=this.indentNext||!n&&!this.atEnd?e+i:-1}if(n==="-"||n==="."){const i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&Na(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===cF&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,i=e.indexOf("#");for(;i!==-1;){const a=e[i-1];if(a===" "||a===" "){n=i-1;break}else i=e.indexOf("#",i+1)}for(;;){const a=e[n-1];if(a===" "||a===" ")n-=1;else break}const s=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-s),this.pushNewline(),"stream"}if(this.atLineEnd()){const n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield uF,yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const n=this.peek(3);if((n==="---"||n==="...")&&Na(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Na(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Na(n)){const i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(R1),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,i=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=i=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);const s=this.getLine();if(s===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&s[0]!=="#"||i===0&&(s.startsWith("---")||s.startsWith("..."))&&Na(s[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(s[0]==="]"||s[0]==="}")))return this.flowLevel=0,yield dF,yield*this.parseLineStart();let a=0;for(;s[a]===",";)a+=yield*this.pushCount(1),a+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(a+=yield*this.pushIndicators(),s[a]){case void 0:return"flow";case"#":return yield*this.pushCount(s.length-a),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(R1),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const o=this.charAt(1);if(this.flowKey||Na(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let a=0;for(;this.buffer[n-1-a]==="\\";)a+=1;if(a%2===0)break;n=this.buffer.indexOf('"',n+1)}const i=this.buffer.substring(0,n);let s=i.indexOf(`
`,this.pos);if(s!==-1){for(;s!==-1;){const a=this.continueScalar(s+1);if(a===-1)break;s=i.indexOf(`
`,a)}s!==-1&&(n=s-(i[s-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Na(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,i;e:for(let a=this.pos;i=this.buffer[a];++a)switch(i){case" ":n+=1;break;case`
`:e=a,n=0;break;case"\r":{const o=this.buffer[a+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
`)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const a=this.continueScalar(e+1);if(a===-1)break;e=this.buffer.indexOf(`
`,a)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let s=e+1;for(i=this.buffer[s];i===" ";)i=this.buffer[++s];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===`
`;)i=this.buffer[++s];e=s-1}else if(!this.blockScalarKeep)do{let a=e-1,o=this.buffer[a];o==="\r"&&(o=this.buffer[--a]);const r=a;for(;o===" ";)o=this.buffer[--a];if(o===`
`&&a>=this.pos&&a+1+n>r)e=a;else break}while(!0);return yield LS,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let n=this.pos-1,i=this.pos-1,s;for(;s=this.buffer[++i];)if(s===":"){const a=this.buffer[i+1];if(Na(a)||e&&b_.has(a))break;n=i}else if(Na(s)){let a=this.buffer[i+1];if(s==="\r"&&(a===`
`?(i+=1,s=`
`,a=this.buffer[i+1]):n=i),a==="#"||e&&b_.has(a))break;if(s===`
`){const o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&b_.has(s))break;n=i}return!s&&!this.atEnd?this.setNext("plain-scalar"):(yield LS,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){const i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(n&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(R1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,n=this.charAt(1);if(Na(n)||e&&b_.has(n))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!Na(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(Wxe.has(n))n=this.buffer[++e];else if(n==="%"&&jR.has(this.buffer[e+1])&&jR.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
`?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,i;do i=this.buffer[++n];while(i===" "||e&&i===" ");const s=n-this.pos;return s>0&&(yield this.buffer.substr(this.pos,s),this.pos=n),s}*pushUntil(e){let n=this.pos,i=this.buffer[n];for(;!e(i);)i=this.buffer[++n];return yield*this.pushToIndex(n,!1)}}class $xe{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,i=this.lineStarts.length;for(;n<i;){const a=n+i>>1;this.lineStarts[a]<e?n=a+1:i=a}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};const s=this.lineStarts[n-1];return{line:n,col:e-s+1}}}}function Xr(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function DR(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function hF(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function x_(t){switch(t.type){case"document":return t.start;case"block-map":{const e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function vu(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function FR(t){if(t.start.type==="flow-seq-start")for(const e of t.items)e.sep&&!e.value&&!Xr(e.start,"explicit-key-ind")&&!Xr(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,hF(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class Qxe{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Xxe,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const i of this.lexer.lex(e,n))yield*this.next(i);n||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const n=Vxe(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{const i=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in i?i.indent:0:n.type==="flow-collection"&&i.type==="document"&&(n.indent=0),n.type==="flow-collection"&&FR(n),i.type){case"document":i.value=n;break;case"block-scalar":i.props.push(n);break;case"block-map":{const s=i.items[i.items.length-1];if(s.value){i.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(s.sep)s.value=n;else{Object.assign(s,{key:n,sep:[]}),this.onKeyLine=!s.explicitKey;return}break}case"block-seq":{const s=i.items[i.items.length-1];s.value?i.items.push({start:[],value:n}):s.value=n;break}case"flow-collection":{const s=i.items[i.items.length-1];!s||s.value?i.items.push({start:[],key:n,sep:[]}):s.sep?s.value=n:Object.assign(s,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){const s=n.items[n.items.length-1];s&&!s.sep&&!s.value&&s.start.length>0&&DR(s.start)===-1&&(n.indent===0||s.start.every(a=>a.type!=="comment"||a.indent<n.indent))&&(i.type==="documentLine truncated
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
`,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){const i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){const s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,n.start),s.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const i=!this.onKeyLine&&this.indent===e.indent,s=i&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind";let a=[];if(s&&n.sep&&!n.value){const o=[];for(let r=0;r<n.sep.length;++r){const c=n.sep[r];switch(c.type){case"newline":o.push(r);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(a=n.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":s||n.value?(a.push(this.sourceToken),e.items.push({start:a}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):s||n.value?(a.push(this.sourceToken),e.items.push({start:a,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Xr(n.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:a,key:null,sep:[this.sourceToken]}]});else if(hF(n.key)&&!Xr(n.sep,"newline")){const o=vu(n.start),r=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:r,sep:c}]})}else a.length>0?n.sep=n.sep.concat(a,this.sourceToken):n.sep.push(this.sourceToken);else if(Xr(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{const o=vu(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||s?e.items.push({start:a,key:null,sep:[this.sourceToken]}):Xr(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);s||n.value?(e.items.push({start:a,key:o,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(o):(Object.assign(n,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!n.explicitKey&&n.sep&&!Xr(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else i&&e.items.push({start:a});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){const i="end"in n.value?n.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){const s=e.items[e.items.length-2]?.value?.end;if(Array.isArray(s)){Array.prototype.push.apply(s,n.start),s.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||Xr(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){const i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;caLine truncated
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
`,n)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const n=x_(e),i=vu(n);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const n=x_(e),i=vu(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(i=>i.type==="newline"||i.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function Yxe(t){const e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new $xe||null,prettyErrors:e}}function Ok(t,e={}){const{lineCounter:n,prettyErrors:i}=Yxe(e),s=new Qxe(n?.addNewLine),a=new Hxe(e);let o=null;for(const r of a.compose(s.parse(t),!0,t.length))if(!o)o=r;else if(o.options.logLevel!=="silent"){o.errors.push(new mf(r.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&n&&(o.errors.forEach(ER(t,n)),o.warnings.forEach(ER(t,n))),o}function fF(t,e,n){let i;const s=Ok(t,n);if(!s)return null;if(s.warnings.forEach(a=>B8(s.options.logLevel,a)),s.errors.length>0){if(s.options.logLevel!=="silent")throw s.errors[0];s.errors=[]}return s.toJS(Object.assign({reviver:i},n))}function Go({title:t,description:e,className:n,children:i}){return f.jsxs(kt,{title:t,className:n,children:[e&&f.jsx("p",{style:{margin:"-4px 0 16px 0",color:"var(--text-secondary)",fontSize:13},children:e}),i]})}const Zxe="VisualConfigEditor-module__payloadRuleModelRow___VKBv1",Jxe="VisualConfigEditor-module__payloadRuleModelRowProtocolFirst___OaJ2F",eve="VisualConfigEditor-module__payloadRuleParamRow___KZJW-",tve="VisualConfigEditor-module__payloadFilterModelRow___MeP9-",nve="VisualConfigEditor-module__payloadRowActionButton___8Fdka",Ql={payloadRuleModelRow:Zxe,payloadRuleModelRowProtocolFirst:Jxe,payloadRuleParamRow:eve,payloadFilterModelRow:tve,payloadRowActionButton:nve},If=()=>typeof globalThis.crypto?.randomUUID=="function"?globalThis.crypto.randomUUID():`${Date.now().toString(36)}_${Math.random().toString(36).slice(2,10)}`,v_={host:"",port:"",tlsEnable:!1,tlsCert:"",tlsKey:"",rmAllowRemote:!1,rmSecretKey:"",rmDisableControlPanel:!1,rmPanelRepo:"",authDir:"",apiKeysText:"",debug:!1,commercialMode:!1,loggingToFile:!1,logsMaxTotalSizeMb:"",usageStatisticsEnabled:!1,proxyUrl:"",forceModelPrefix:!1,requestRetry:"",maxRetryInterval:"",quotaSwitchProject:!0,quotaSwitchPreviewModel:!0,routingStrategy:"round-robin",wsAuth:!1,payloadDefaultRules:[],payloadOverrideRules:[],payloadFilterRules:[],streaming:{keepaliveSeconds:"",bootstrapRetries:"",nonstreamKeepaliveInterval:""}};function Us(t){return t===null||typeof t!="object"||Array.isArray(t)?null:t}function ive(t){if(typeof t=="string"){const i=t.trim();return i||null}const e=Us(t);if(!e)return null;const n=[e["api-key"],e.apiKey,e.key,e.Key];for(const i of n)if(typeof i=="string"){const s=i.trim();if(s)return s}return null}function sve(t){if(!Array.isArray(t))return"";const e=[];for(const n of t){const i=ive(n);i&&e.push(i)}return e.join(`
`)}function Qi(t,e){return t.hasIn(e)}function Su(t,e){const n=t.getIn(e,!0);pl(n)||t.setIn(e,{})}function wu(t,e){const n=t.getIn(e,!0);pl(n)&&n.items.length===0&&t.deleteIn(e)}function Xo(t,e,n){if(n){t.setIn(e,!0);return}Qi(t,e)&&t.setIn(e,!1)}function ql(t,e,n){const i=typeof n=="string"?n:"";if(i.trim()!==""){t.setIn(e,i);return}Qi(t,e)&&t.setIn(e,"")}function zl(t,e,n){const s=(typeof n=="string"?n:"").trim();if(s===""){Qi(t,e)&&t.deleteIn(e);return}const a=Number.parseInt(s,10);if(Number.isFinite(a)){t.setIn(e,a);return}Qi(t,e)&&t.deleteIn(e)}function UR(t){return typeof structuredClone=="function"?structuredClone(t):JSON.parse(JSON.stringify(t))}function ave(t){if(typeof t=="number")return{valueType:"number",value:String(t)};if(typeof t=="boolean")return{valueType:"boolean",value:String(t)};if(t===null||typeof t=="object")try{return{valueType:"json",value:JSON.stringify(t,null,2)??"null"}}catch{return{valueType:"json",value:String(t)}}return{valueType:"string",value:String(t??"")}}const ove=["openai","openai-response","gemini","claude","codex","antigravity"];function mF(t){if(typeof t=="string")return ove.includes(t)?t:void 0}function BR(t){return Array.isArray(t)?t.map((e,n)=>{const i=Us(e)??{},s=i.models,a=Array.isArray(s)?s.map((c,u)=>{const h=Us(c),p=typeof c=="string"?c:h?.name??h?.id??"",g=typeof p=="string"?p:String(p??"");return{id:`model-${n}-${u}`,name:g,protocol:mF(h?.protocol)}}):[],o=Us(i.params),r=o?Object.entries(o).map(([c,u],h)=>{const p=ave(u);return{id:`param-${n}-${h}`,path:c,valueType:p.valueType,value:p.value}}):[];return{id:`payload-rule-${n}`,models:a,params:r}}):[]}function rve(t){return Array.isArray(t)?t.map((e,n)=>{const i=Us(e)??{},s=i.models,a=Array.isArray(s)?s.map((c,u)=>{const h=Us(c),p=typeof c=="string"?c:h?.name??h?.id??"",g=typeof p=="string"?p:String(p??"");return{id:`filter-model-${n}-${u}`,name:g,protocol:mF(h?.protocol)}}):[],o=i.params,r=Array.isArray(o)?o.map(String):[];return{id:`payload-filter-rule-${n}`,models:a,params:r}}):[]}function IR(t){return t.map(e=>{const n=(e.models||[]).filter(s=>s.name?.trim()).map(s=>{const a={name:s.name.trim()};return s.protocol&&(a.protocol=s.protocol),a}),i={};for(const s of e.params||[]){if(!s.path?.trim())continue;let a=s.value;if(s.valueType==="number"){const o=Number(s.value);a=Number.isFinite(o)?o:s.value}else if(s.valueType==="boolean")a=s.value==="true";else if(s.valueType==="json")try{a=JSON.parse(s.value)}catch{a=s.value}i[s.path.trim()]=a}return{models:n,params:i}}).filter(e=>e.models.length>0)}function lve(t){return t.map(e=>{const n=(e.models||[]).filter(s=>s.name?.trim()).map(s=>{const a={name:s.name.trim()};return s.protocol&&(a.protocol=s.protocol),a}),i=(Array.isArray(e.params)?e.params:[]).map(s=>String(s).trim()).filter(Boolean);return{models:n,params:i}}).filter(e=>e.models.length>0)}function cve(){const[t,e]=w.useState({...v_}),[n,i]=w.useState({...v_}),s=w.useMemo(()=>JSON.stringify(t)!==JSON.stringify(n),[n,t]),a=w.useCallback(c=>{try{const u=fF(c)||{},h=Us(u)??{},p=Us(h.tls),g=Us(h["remote-management"]),y=Us(h["quota-exceeded"]),b=Us(h.routing),x=Us(h.payload),v=Us(h.streaming),A={host:typeof h.host=="string"?h.host:"",port:String(h.port??""),tlsEnable:!!p?.enable,tlsCert:typeof p?.cert=="string"?p.cert:"",tlsKey:typeof p?.key=="string"?p.key:"",rmAllowRemote:!!g?.["allow-remote"],rmSecretKey:typeof g?.["secret-key"]=="string"?g["secret-key"]:"",rmDisableControlPanel:!!g?.["disable-control-panel"],rmPanelRepo:typeof g?.["panel-github-repository"]=="string"?g["panel-github-repository"]:typeof g?.["panel-repo"]=="string"?g["panel-repo"]:"",authDir:typeof h["auth-dir"]=="string"?h["auth-dir"]:"",apiKeysText:sve(h["api-keys"]),debug:!!h.debug,commercialMode:!!h["commercial-mode"],loggingToFile:!!h["logging-to-file"],logsMaxTotalSizeMb:String(h["logs-max-total-size-mb"]??""),usageStatisticsEnabled:!!h["usage-statistics-enabled"],proxyUrl:typeof h["proxy-url"]=="string"?h["proxy-url"]:"",forceModelPrefix:!!h["force-model-prefix"],requestRetry:String(h["request-retry"]??""),maxRetryInterval:String(h["max-retry-interval"]??""),wsAuth:!!h["ws-auth"],quotaSwitchProject:!!(y?.["switch-project"]??!0),quotaSwitchPreviewModel:!!(y?.["switch-preview-model"]??!0),routingStrategy:b?.strategy==="fill-first"?"fill-first":"round-robin",payloadDefaultRules:BR(x?.default),payloadOverrideRules:BR(x?.override),payloadFilterRules:rve(x?.filter),streaming:{keepaliveSeconds:String(v?.["keepalive-seconds"]??""),bootstrapRetries:String(v?.["bootstrap-retries"]??""),nonstreamKeepaliveInterval:String(h["nonstream-keepalive-interval"]??"")}};e(A),i(UR(A))}catch{e({...v_}),i(UR(v_))}},[]),o=w.useCallback(c=>{try{const u=Ok(c);if(u.errors.length>0)return c;pl(u.contents)||(u.contents=u.createNode({}));const h=t;if(ql(u,["host"],h.host),zl(u,["port"],h.port),(Qi(u,["tls"])||h.tlsEnable||h.tlsCert.trim()||h.tlsKey.trim())&&(Su(u,["tls"]),Xo(u,["tls","enable"],h.tlsEnable),ql(u,["tls","cert"],h.tlsCert),ql(u,["tls","key"],h.tlsKey),wLine truncated
`).map(v=>v.trim()).filter(Boolean);x.length>0?u.setIn(["api-keys"],x):Qi(u,["api-keys"])&&u.deleteIn(["api-keys"])}Xo(u,["debug"],h.debug),Xo(u,["commercial-mode"],h.commercialMode),Xo(u,["logging-to-file"],h.loggingToFile),zl(u,["logs-max-total-size-mb"],h.logsMaxTotalSizeMb),Xo(u,["usage-statistics-enabled"],h.usageStatisticsEnabled),ql(u,["proxy-url"],h.proxyUrl),Xo(u,["force-model-prefix"],h.forceModelPrefix),zl(u,["request-retry"],h.requestRetry),zl(u,["max-retry-interval"],h.maxRetryInterval),Xo(u,["ws-auth"],h.wsAuth),(Qi(u,["quota-exceeded"])||!h.quotaSwitchProject||!h.quotaSwitchPreviewModel)&&(Su(u,["quota-exceeded"]),u.setIn(["quota-exceeded","switch-project"],h.quotaSwitchProject),u.setIn(["quota-exceeded","switch-preview-model"],h.quotaSwitchPreviewModel),wu(u,["quota-exceeded"])),(Qi(u,["routing"])||h.routingStrategy!=="round-robin")&&(Su(u,["routing"]),u.setIn(["routing","strategy"],h.routingStrategy),wu(u,["routing"]));const p=typeof h.streaming?.keepaliveSeconds=="string"?h.streaming.keepaliveSeconds:"",g=typeof h.streaming?.bootstrapRetries=="string"?h.streaming.bootstrapRetries:"",y=typeof h.streaming?.nonstreamKeepaliveInterval=="string"?h.streaming.nonstreamKeepaliveInterval:"";return(Qi(u,["streaming"])||p.trim()||g.trim())&&(Su(u,["streaming"]),zl(u,["streaming","keepalive-seconds"],p),zl(u,["streaming","bootstrap-retries"],g),wu(u,["streaming"])),zl(u,["nonstream-keepalive-interval"],y),(Qi(u,["payload"])||h.payloadDefaultRules.length>0||h.payloadOverrideRules.length>0||h.payloadFilterRules.length>0)&&(Su(u,["payload"]),h.payloadDefaultRules.length>0?u.setIn(["payload","default"],IR(h.payloadDefaultRules)):Qi(u,["payload","default"])&&u.deleteIn(["payload","default"]),h.payloadOverrideRules.length>0?u.setIn(["payload","override"],IR(h.payloadOverrideRules)):Qi(u,["payload","override"])&&u.deleteIn(["payload","override"]),h.payloadFilterRules.length>0?u.setIn(["payload","filter"],lve(h.payloadFilterRules)):Qi(u,["payload","filter"])&&u.deleteIn(["payload","filter"]),wu(u,["payload"])),u.toString({indent:2,lineWidth:120,minContentWidth:0})}catch{return c}},[n,t]),r=w.useCallback(c=>{e(u=>{const h={...u,...c};return c.streaming&&(h.streaming={...u.streaming,...c.streaming}),h})},[]);return{visualValues:t,visualDirty:s,loadVisualValuesFromYaml:a,applyVisualChangesToYaml:o,setVisualValues:r}}const pF=[{value:"",labelKey:"config_management.visual.payload_rules.provider_default",defaultLabel:"Default"},{value:"openai",labelKey:"config_management.visual.payload_rules.provider_openai",defaultLabel:"OpenAI"},{value:"openai-response",labelKey:"config_management.visual.payload_rules.provider_openai_response",defaultLabel:"OpenAI Response"},{value:"gemini",labelKey:"config_management.visual.payload_rules.provider_gemini",defaultLabel:"Gemini"},{value:"claude",labelKey:"config_management.visual.payload_rules.provider_claude",defaultLabel:"Claude"},{value:"codex",labelKey:"config_management.visual.payload_rules.provider_codex",defaultLabel:"Codex"},{value:"antigravity",labelKey:"config_management.visual.payload_rules.provider_antigravity",defaultLabel:"Antigravity"}],uve=[{value:"string",labelKey:"config_management.visual.payload_rules.value_type_string",defaultLabel:"String"},{value:"number",labelKey:"config_management.visual.payload_rules.value_type_number",defaultLabel:"Number"},{value:"boolean",labelKey:"config_management.visual.payload_rules.value_type_boolean",defaultLabel:"Boolean"},{value:"json",labelKey:"config_management.visual.payload_rules.value_type_json",defaultLabel:"JSON"}];function dve(t){return t?/^[\x21-\x7E]+$/.test(t):!1}function Ma({title:t,description:e,checked:n,disabled:i,onChange:s}){return f.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16,flexWrap:"wrap"},children:[f.jsxs("div",{style:{minWidth:220},children:[f.jsx("div",{style:{fontWeight:600,color:"var(--text-primary)"},children:t}),e&&f.jsx("div",{style:{marginTop:4,fontSize:13,color:"var(--text-secondary)"},children:e})]}),f.jsx(Li,{checked:n,onChange:s,disabled:i,ariaLabel:t})]})}function Hr({children:t}){return f.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(240px, 1fr))",gap:16},children:t})}function hve(){return f.jsx("div",{style:{height:1,background:"var(--border-color)",margin:"16px 0"}})}function fve({value:t,disabled:e,onChange:n}){const{t:i}=et(),{showNotification:s}=rn(),a=w.useMemo(()=>t.split(`
`).map(M=>M.trim()).filter(Boolean),[t]),[o,r]=w.useState(!1),[c,u]=w.useState(null),[h,p]=w.useState(""),[g,y]=w.useState("");function b(){const M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",E=new Uint8Array(17);return crypto.getRandomValues(E),"sk-"+Array.from(E,j=>M[j%M.length]).join("")}const x=()=>{u(null),p(""),y(""),r(!0)},v=M=>{u(M),p(a[M]??""),y(""),r(!0)},A=()=>{r(!1),p(""),u(null),y("")},C=M=>{n(M.join(`
`))},T=M=>{C(a.filter((E,j)=>j!==M))},L=()=>{const M=h.trim();if(!M){y(i("config_management.visual.api_keys.error_empty"));return}if(!dve(M)){y(i("config_management.visual.api_keys.error_invalid"));return}const E=c===null?[...a,M]:a.map((j,D)=>D===c?M:j);C(E),A()},N=async M=>{const E=await hy(M);s(i(E?"notification.link_copied":"notification.copy_failed"),E?"success":"error")},O=()=>{p(b()),y("")};return f.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[f.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[f.jsx("label",{style:{margin:0},children:i("config_management.visual.api_keys.label")}),f.jsx(de,{size:"sm",onClick:x,disabled:e,children:i("config_management.visual.api_keys.add")})]}),a.length===0?f.jsx("div",{style:{border:"1px dashed var(--border-color)",borderRadius:12,padding:16,color:"var(--text-secondary)",textAlign:"center"},children:i("config_management.visual.api_keys.empty")}):f.jsx("div",{className:"item-list",style:{marginTop:4},children:a.map((M,E)=>f.jsxs("div",{className:"item-row",children:[f.jsxs("div",{className:"item-meta",children:[f.jsxs("div",{className:"pill",children:["#",E+1]}),f.jsx("div",{className:"item-title",children:"API Key"}),f.jsx("div",{className:"item-subtitle",children:ga(String(M||""))})]}),f.jsxs("div",{className:"item-actions",children:[f.jsx(de,{variant:"secondary",size:"sm",onClick:()=>N(M),disabled:e,children:i("common.copy")}),f.jsx(de,{variant:"secondary",size:"sm",onClick:()=>v(E),disabled:e,children:i("config_management.visual.common.edit")}),f.jsx(de,{variant:"danger",size:"sm",onClick:()=>T(E),disabled:e,children:i("config_management.visual.common.delete")})]})]},`${M}-${E}`))}),f.jsx("div",{className:"hint",children:i("config_management.visual.api_keys.hint")}),f.jsx(Hi,{open:o,onClose:A,title:i(c!==null?"config_management.visual.api_keys.edit_title":"config_management.visual.api_keys.add_title"),footer:f.jsxs(f.Fragment,{children:[f.jsx(de,{variant:"secondary",onClick:A,disabled:e,children:i("config_management.visual.common.cancel")}),f.jsx(de,{onClick:L,disabled:e,children:i(c!==null?"config_management.visual.common.update":"config_management.visual.common.add")})]}),children:f.jsx(nt,{label:i("config_management.visual.api_keys.input_label"),placeholder:i("config_management.visual.api_keys.input_placeholder"),value:h,onChange:M=>p(M.target.value),disabled:e,error:g||void 0,hint:i("config_management.visual.api_keys.input_hint"),style:{paddingRight:148},rightElement:f.jsx(de,{type:"button",variant:"secondary",size:"sm",onClick:O,disabled:e,children:i("config_management.visual.api_keys.generate")})})})]})}function mve({value:t,disabled:e,placeholder:n,onChange:i}){const{t:s}=et(),a=t.length?t:[],o=(u,h)=>i(a.map((p,g)=>g===u?h:p)),r=()=>i([...a,""]),c=u=>i(a.filter((h,p)=>p!==u));return f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[a.map((u,h)=>f.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[f.jsx("input",{className:"input",placeholder:n,value:u,onChange:p=>o(h,p.target.value),disabled:e,style:{flex:1}}),f.jsx(de,{variant:"ghost",size:"sm",onClick:()=>c(h),disabled:e,children:s("config_management.visual.common.delete")})]},h)),f.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:f.jsx(de,{variant:"secondary",size:"sm",onClick:r,disabled:e,children:s("config_management.visual.common.add")})})]})}function qR({value:t,disabled:e,protocolFirst:n=!1,onChange:i}){const{t:s}=et(),a=t.length?t:[],o=w.useMemo(()=>pF.map(C=>({value:C.value,label:s(C.labelKey,{defaultValue:C.defaultLabel})})),[s]),r=w.useMemo(()=>uve.map(C=>({value:C.value,label:s(C.labelKey,{defaultValue:C.defaultLabel})})),[s]),c=()=>i([...a,{id:If(),models:[],params:[]}]),u=C=>i(a.filter((T,L)=>L!==C)),h=(C,T)=>i(a.map((L,N)=>N===C?{...L,...T}:L)),p=C=>{const T=a[C],L={id:If(),name:"",protocol:void 0};h(C,{models:[...T.models,L]})},g=(C,T)=>{const L=a[C];h(C,{models:L.models.filter((N,O)=>O!==T)})},y=(C,T,L)=>{const N=a[C];h(C,{models:N.models.map((O,M)=>M===T?{...O,...L}:O)})},b=C=>{const T=a[C],L={id:If(),path:"",valueType:"string",value:""};h(C,{params:[...T.params,L]})},x=(C,T)=>{const L=a[C];h(C,{params:L.params.filter((N,O)=>O!==T)})},v=(C,T,L)=>{const N=a[C];h(C,{params:N.params.map((O,M)=>M===T?{...O,...L}:O)})},A=C=>{switch(C){case"string":return s("config_management.visual.payload_rules.value_string");case"number":return s("config_management.visual.payload_rules.value_number");case"boolean":return s("config_management.visual.payload_rules.value_boolean");case"json":return s("config_management.visual.payload_rules.value_json");default:return s("config_management.visual.payload_rules.value_default")}};return f.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[a.map((C,T)=>f.jsxs("div",{style:{border:"1px solid var(--border-color)",borderRadius:12,padding:12,display:"flex",flexDirection:"column",gap:12},chiLine truncated
`)),i=Zt.of(e.split(`
`)),s=Hy.build(n,i);let a=0,o=0;return{hunks:s.map(c=>{const u=[],h=c.fromA<c.toA,p=c.fromB<c.toB,g=[];if(h){const D=n.lineAt(c.fromA).number,F=n.lineAt(c.toA-1).number;for(let U=D;U<=F;U++)g.push({num:U,text:n.line(U).text})}const y=[];if(p){const D=i.lineAt(c.fromB).number,F=i.lineAt(c.toB-1).number;for(let U=D;U<=F;U++)y.push({num:U,text:i.line(U).text})}o+=g.length,a+=y.length;let b,x,v,A;if(h)b=g[0].num-1,x=g[g.length-1].num+1;else{const D=ZR(n,c.fromA),F=n.lineAt(D);c.fromA===F.from?(b=F.number-1,x=F.number):(b=F.number,x=F.number+1)}if(p)v=y[0].num-1,A=y[y.length-1].num+1;else{const D=ZR(i,c.fromB),F=i.lineAt(D);c.fromB===F.from?(v=F.number-1,A=F.number):(v=F.number,A=F.number+1)}const C=Math.min(F1,Math.max(0,b),Math.max(0,v));for(let D=C;D>0;D--){const F=b-D+1,U=v-D+1;F>=1&&U>=1&&F<=n.lines&&u.push({type:"context",oldNum:F,newNum:U,text:n.line(F).text})}for(const D of g)u.push({type:"deletion",oldNum:D.num,newNum:null,text:D.text});for(const D of y)u.push({type:"addition",oldNum:null,newNum:D.num,text:D.text});const T=Math.max(0,Math.min(F1,n.lines-x+1)),L=Math.max(0,Math.min(F1,i.lines-A+1)),N=Math.min(T,L);for(let D=0;D<N;D++){const F=x+D,U=A+D;F>=1&&F<=n.lines&&U>=1&&U<=i.lines&&u.push({type:"context",oldNum:F,newNum:U,text:n.line(F).text})}const O=u.find(D=>D.oldNum!==null)?.oldNum??1,M=u.find(D=>D.newNum!==null)?.newNum??1,E=u.filter(D=>D.type!=="addition").length,j=u.filter(D=>D.type!=="deletion").length;return{oldStart:O,oldCount:E,newStart:M,newCount:j,lines:u}}),additions:a,deletions:o}}const JR=5;function Yve({additions:t,deletions:e}){const n=t+e;if(n===0)return null;const i=Math.round(t/n*JR);return f.jsx("span",{className:mn.statBar,children:Array.from({length:JR},(s,a)=>f.jsx("span",{className:`${mn.statBlock} ${a<i?mn.statBlockAdd:mn.statBlockDel}`},a))})}function Zve({open:t,original:e,modified:n,onConfirm:i,onCancel:s,loading:a=!1}){const{t:o}=et(),r=w.useMemo(()=>Qve(e,n),[e,n]);return f.jsx(Hi,{open:t,title:o("config_management.diff.title"),onClose:s,width:"min(1200px, 90vw)",className:mn.diffModal,closeDisabled:a,footer:f.jsxs(f.Fragment,{children:[f.jsx(de,{variant:"secondary",onClick:s,disabled:a,children:o("common.cancel")}),f.jsx(de,{onClick:i,loading:a,disabled:a,children:o("config_management.diff.confirm")})]}),children:f.jsx("div",{className:mn.content,children:r.hunks.length===0?f.jsx("div",{className:mn.emptyState,children:o("config_management.diff.no_changes")}):f.jsxs("div",{className:mn.diffContainer,children:[f.jsxs("div",{className:mn.fileHeader,children:[f.jsx("svg",{className:mn.fileIcon,viewBox:"0 0 16 16",width:"16",height:"16",children:f.jsx("path",{fillRule:"evenodd",d:"M3.75 1.5a.25.25 0 00-.25.25v11.5c0 .138.112.25.25.25h8.5a.25.25 0 00.25-.25V6H9.75A1.75 1.75 0 018 4.25V1.5H3.75zm5.75.56v2.19c0 .138.112.25.25.25h2.19L9.5 2.06zM2 1.75C2 .784 2.784 0 3.75 0h5.086c.464 0 .909.184 1.237.513l3.414 3.414c.329.328.513.773.513 1.237v8.086A1.75 1.75 0 0112.25 15h-8.5A1.75 1.75 0 012 13.25V1.75z",fill:"currentColor"})}),f.jsx("span",{className:mn.fileName,children:"config.yaml"}),f.jsxs("span",{className:mn.fileStats,children:[f.jsxs("span",{className:mn.statAdditions,children:["+",r.additions]}),f.jsxs("span",{className:mn.statDeletions,children:["-",r.deletions]}),f.jsx(Yve,{additions:r.additions,deletions:r.deletions})]})]}),f.jsx("div",{className:mn.diffBody,children:r.hunks.map((c,u)=>f.jsxs("div",{className:mn.hunk,children:[f.jsxs("div",{className:mn.hunkHeader,children:[f.jsx("span",{className:mn.hunkGutter,children:f.jsx("svg",{className:mn.hunkExpandIcon,viewBox:"0 0 16 16",width:"12",height:"12",children:f.jsx("path",{d:"M8.177 1.677l2.896 2.896a.25.25 0 01-.177.427H8.75v1.25a.75.75 0 01-1.5 0V5H5.104a.25.25 0 01-.177-.427l2.896-2.896a.25.25 0 01.354 0zM7.25 11.75a.75.75 0 011.5 0V13h2.146a.25.25 0 01.177.427l-2.896 2.896a.25.25 0 01-.354 0l-2.896-2.896A.25.25 0 015.104 13H7.25v-1.25z",fill:"currentColor"})})}),f.jsx("span",{className:mn.hunkGutter}),f.jsxs("span",{className:mn.hunkText,children:["@@ -",c.oldStart,",",c.oldCount," +",c.newStart,",",c.newCount," @@"]})]}),c.lines.map((h,p)=>f.jsxs("div",{className:`${mn.diffLine} ${mn[h.type]}`,children:[f.jsx("span",{className:`${mn.lineNum} ${h.oldNum===null?mn.lineNumEmpty:""}`,children:h.oldNum??""}),f.jsx("span",{className:`${mn.lineNum} ${h.newNum===null?mn.lineNumEmpty:""}`,children:h.newNum??""}),f.jsx("span",{className:mn.linePrefix,children:h.type==="deletion"?"-":h.type==="addition"?"+":" "}),f.jsx("code",{className:mn.lineText,children:h.text||" "})]},`${u}-${p}`))]},u))})]})})})}const Jve="ConfigPage-module__container___5kN-Y",e1e="ConfigPage-module__pageTitle___BoVLE",t1e="ConfigPage-module__description___qruwQ",n1e="ConfigPage-module__tabBar___PelpE",i1e="ConfigPage-module__tabItem___Uj1rU",s1e="ConfigPage-module__tabActive___sZLh-",a1e="ConfigPage-module__content___PgFbt",o1e="ConfigPage-module__searchInputWrapper___-GeEQ",r1e="ConfigPage-module__searchInput___ock8o",l1e="ConfigPage-moduleLine truncated
`);uc({filename:"logs.txt",blob:new Blob([ce],{type:"text/plain"})}),e(t("logs.download_success"),"success")},he=async()=>{if(i!=="connected"){W(!1);return}W(!0),Z("");try{const ce=await Ph.fetchErrorLogs();F(Array.isArray(ce.files)?ce.files:[])}catch(ce){console.error("Failed to load error logs:",ce),F([]);const He=Zh(ce);Z(He?`${t("logs.error_logs_load_error")}: ${He}`:t("logs.error_logs_load_error"))}finally{W(!1)}},Pe=async ce=>{try{const He=await Ph.downloadErrorLog(ce);uc({filename:ce,blob:new Blob([He.data],{type:"text/plain"})}),e(t("logs.error_log_download_success"),"success")}catch(He){const jt=Zh(He);e(`${t("notification.download_failed")}${jt?`: ${jt}`:""}`,"error")}};w.useEffect(()=>{i==="connected"&&(Q.current=0,ne(!1))},[i]),w.useEffect(()=>{u==="errors"&&i==="connected"&&he()},[u,i,c]),w.useEffect(()=>{if(!A||i!=="connected")return;const ce=window.setInterval(()=>{ne(!0)},8e3);return()=>window.clearInterval(ce)},[A,i]);const Ce=w.useMemo(()=>p.buffer.slice(p.visibleFrom),[p.buffer,p.visibleFrom]),at=N.trim(),vt=at.length>0,Bt=vt?p.buffer:Ce,Re=w.useMemo(()=>{let ce=Bt;if(O&&(ce=ce.filter(He=>!He.includes(Y1))),at){const He=at.toLowerCase();ce=ce.filter(jt=>jt.toLowerCase().includes(He))}return ce.map(He=>F1e(He))},[Bt,O,at]),Ye=B1e({parsedLines:Re}),{filteredParsedLines:Lt,filteredLines:me,removedCount:Ie}=w.useMemo(()=>{const ce=Re.filter(He=>{if(Ye.methodFilterSet.size>0&&(!He.method||!Ye.methodFilterSet.has(He.method)))return!1;const jt=MF(He.statusCode);return!(Ye.statusFilterSet.size>0&&(!jt||!Ye.statusFilterSet.has(jt))||Ye.pathFilterSet.size>0&&(!He.path||!Ye.pathFilterSet.has(He.path)))});return{filteredParsedLines:ce,filteredLines:ce.map(He=>He.raw),removedCount:Math.max(Bt.length-ce.length,0)}},[Bt,Ye.methodFilterSet,Ye.pathFilterSet,Ye.statusFilterSet,Re]),$e=w.useMemo(()=>E?[]:Lt,[Lt,E]),lt=w.useMemo(()=>me.join(`
`),[me]),le=K1e({logState:p,setLogState:g,loading:y,isSearching:vt,filteredLineCount:me.length,hasStructuredFilters:Ye.hasStructuredFilters,showRawLogs:E});R.current=le;const _e=async ce=>{await hy(ce)?e(t("logs.copy_success",{defaultValue:"Copied to clipboard"}),"success"):e(t("logs.copy_failed",{defaultValue:"Copy failed"}),"error")},Le=()=>{B.current?.timer&&(window.clearTimeout(B.current.timer),B.current.timer=null)},Ze=(ce,He)=>{c&&He&&(I||(Le(),B.current={timer:window.setTimeout(()=>{H(He),B.current&&(B.current.fired=!0,B.current.timer=null)},gSe),startX:ce.clientX,startY:ce.clientY,fired:!1}))},St=()=>{Le(),B.current=null},bt=ce=>{const He=B.current;if(!He||He.timer===null||He.fired)return;const jt=Math.abs(ce.clientX-He.startX),Dt=Math.abs(ce.clientY-He.startY);(jt>sj||Dt>sj)&&St()},_t=()=>{G||H(null)},cn=async ce=>{X(!0);try{const He=await Ph.downloadRequestLogById(ce);uc({filename:`request-${ce}.log`,blob:new Blob([He.data],{type:"text/plain"})}),e(t("logs.request_log_download_success"),"success"),H(null)}catch(He){const jt=Zh(He);e(`${t("notification.download_failed")}${jt?`: ${jt}`:""}`,"error")}finally{X(!1)}};return w.useEffect(()=>()=>{B.current?.timer&&(window.clearTimeout(B.current.timer),B.current.timer=null)},[]),f.jsxs("div",{className:Se.container,children:[f.jsx("h1",{className:Se.pageTitle,children:t("logs.title")}),f.jsxs("div",{className:Se.tabBar,children:[f.jsx("button",{type:"button",className:`${Se.tabItem} ${u==="logs"?Se.tabActive:""}`,onClick:()=>h("logs"),children:t("logs.log_content")}),f.jsx("button",{type:"button",className:`${Se.tabItem} ${u==="errors"?Se.tabActive:""}`,onClick:()=>h("errors"),children:t("logs.error_logs_modal_title")})]}),f.jsxs("div",{className:Se.content,children:[u==="logs"&&f.jsxs(kt,{className:Se.logCard,children:[x&&f.jsx("div",{className:"error-box",children:x}),f.jsxs("div",{className:Se.filters,children:[f.jsx("div",{className:Se.searchWrapper,children:f.jsx(nt,{value:T,onChange:ce=>L(ce.target.value),placeholder:t("logs.search_placeholder"),className:Se.searchInput,rightElement:T?f.jsx("button",{type:"button",className:Se.searchClear,onClick:()=>L(""),title:"Clear","aria-label":"Clear",children:f.jsx(Nc,{size:16})}):f.jsx(i3,{size:16,className:Se.searchIcon})})}),f.jsxs("div",{className:Se.structuredFilters,children:[f.jsxs("div",{className:Se.filterChipGroup,children:[f.jsx("span",{className:Se.filterChipLabel,children:t("logs.filter_method")}),f.jsx("div",{className:Se.filterChipList,children:Rk.map(ce=>{const He=Ye.methodFilters.includes(ce),jt=Ye.methodCounts[ce]??0;return f.jsxs("button",{type:"button",className:`${Se.filterChip} ${He?Se.filterChipActive:""}`,onClick:()=>Ye.toggleMethodFilter(ce),disabled:jt===0&&!He,"aria-pressed":He,children:[ce," (",jt,")"]},ce)})})]}),f.jsxs("div",{className:Se.filterChipGroup,children:[f.jsx("span",{className:Se.filterChipLabel,children:t("logs.filter_status")}),f.jsx("div",{className:Se.filterChipList,children:A1e.map(ce=>{const He=Ye.statusFilters.includes(ce),jt=Ye.statusCounts[ce]??0;return f.jsxs("button",{type:"button",className:`${Se.filterChip} ${He?Se.filterChipActive:""}`,onClick:()=>Ye.toggleStatusFilter(ce),disabled:jt===0&&!He,"aria-pressed":He,children:[t(`logs.filter_status_${ce}`)," (",jt,")"]},ce)})})]}),f.jsxs("div",{className:Se.filterChipGroup,children:[f.jsx("span",{className:Se.filterChipLabel,children:t("logs.filter_path")}),f.jsx("div",{className:Se.filterChipList,children:Ye.pathOptions.length===0?f.jsx("span",{className:Se.filterChipHint,children:t("logs.filter_path_empty")}):Ye.pathOptions.map(({path:ce,count:He})=>{const jt=Ye.pathFilters.includes(ce);return f.jsxs("button",{type:"button",className:`${Se.filterChip} ${jt?Se.filterChipActive:""}`,onClick:()=>Ye.togglePathFilter(ce),"aria-pressed":jt,title:ce,children:[ce," (",He,")"]},ce)})})]}),f.jsx(de,{variant:"ghost",size:"sm",onClick:Ye.clearStructuredFilters,disabled:!Ye.hasStructuredFilters,children:t("logs.clear_filters")})]}),f.jsx(Li,{checked:O,onChange:M,label:f.jsxs("span",{className:Se.switchLabel,children:[f.jsx(s3,{size:16}),t("logs.hide_management_logs",{prefix:Y1})]})}),f.jsx(Li,{checked:E,onChange:j,label:f.jsxs("span",{className:Se.switchLabel,title:t("logs.show_raw_logs_hint",{defaultValue:"Show original log text for easier multi-line copy"}),children:[f.jsx(QS,{size:16}),t("logs.show_raw_logs",{defaultValue:"Show raw logs"})]})}),f.jsxs("div",{className:Se.toolbar,children:[f.jsx(de,{variant:"secondary",size:"sm",onClick:()=>ne(!1),disabled:V||y,className:Se.actionButton,children:f.jsxs("span",{className:Se.buttonContent,children:[f.jsx(WS,{size:16}),t("logs.refresh_button")]})}),f.jsx(Li,{checked:A,onChange:ce=>C(ce),disabled:V,label:f.jsxs("span",{className:Se.switchLabel,children:[f.jsx($S,{size:16}),t("logs.auto_refresh")]})}),f.jsx(de,{variant:"secondary",size:"sm",onClick:oe,disabled:p.buffer.length===0,className:Se.actionButton,children:f.jsxs("span",{className:Se.buttonContent,children:[f.jsx(tLine truncated
<style rel="stylesheet" crossorigin>*,*:before,*:after{box-sizing:border-box;margin:0;padding:0}html,body{height:100%;width:100%}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;line-height:1.5}#root{height:100%;width:100%}button,input,textarea,select{font:inherit}a{color:inherit;text-decoration:none}ul,ol{list-style:none}:root{--bg-secondary: #faf9f5;--bg-primary: #f0eee8;--bg-tertiary: #e9e6df;--bg-hover: var(--bg-tertiary);--bg-quinary: #f6f4ee;--bg-error-light: rgba(198, 87, 70, .1);--text-primary: #2d2a26;--text-secondary: #6d6760;--text-tertiary: #a29c95;--text-quaternary: #c0bab3;--text-muted: var(--text-tertiary);--border-color: #e3e1db;--border-secondary: var(--border-color);--border-primary: #d5d2cb;--border-hover: #cecac4;--primary-color: #8b8680;--primary-hover: #7f7a74;--primary-active: #726d67;--primary-contrast: #ffffff;--success-color: #10b981;--warning-color: #c65746;--error-color: #c65746;--danger-color: var(--error-color);--info-color: var(--primary-color);--warning-bg: rgba(198, 87, 70, .12);--warning-border: rgba(198, 87, 70, .35);--warning-text: var(--warning-color);--success-badge-bg: #d1fae5;--success-badge-text: #065f46;--success-badge-border: #6ee7b7;--failure-badge-bg: rgba(198, 87, 70, .14);--failure-badge-text: #8a3a30;--failure-badge-border: rgba(198, 87, 70, .35);--count-badge-bg: rgba(139, 134, 128, .18);--count-badge-text: var(--primary-active);--shadow: 0 1px 2px 0 rgb(0 0 0 / .08);--shadow-lg: 0 10px 18px -3px rgb(0 0 0 / .1);--radius-md: 8px;--accent-tertiary: var(--bg-tertiary)}[data-theme=dark]{--bg-secondary: #151412;--bg-primary: #1d1b18;--bg-tertiary: #262320;--bg-hover: #2e2a26;--bg-quinary: #191714;--bg-error-light: rgba(198, 87, 70, .18);--text-primary: #f6f4f1;--text-secondary: #c9c3bb;--text-tertiary: #9c958d;--text-quaternary: #6f6962;--text-muted: var(--text-tertiary);--border-color: #3a3530;--border-secondary: var(--border-color);--border-primary: #4a453f;--border-hover: #5a544d;--primary-color: #8b8680;--primary-hover: #9a948e;--primary-active: #a6a099;--primary-contrast: #ffffff;--success-color: #10b981;--warning-color: #c65746;--error-color: #c65746;--danger-color: var(--error-color);--info-color: var(--primary-color);--warning-bg: rgba(198, 87, 70, .22);--warning-border: rgba(198, 87, 70, .45);--warning-text: #f1b0a6;--success-badge-bg: rgba(6, 78, 59, .3);--success-badge-text: #6ee7b7;--success-badge-border: #059669;--failure-badge-bg: rgba(198, 87, 70, .24);--failure-badge-text: #f1b0a6;--failure-badge-border: rgba(198, 87, 70, .5);--count-badge-bg: rgba(139, 134, 128, .28);--count-badge-text: var(--primary-active);--shadow: 0 1px 3px 0 rgb(0 0 0 / .3);--shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .3);--radius-md: 8px;--accent-tertiary: var(--bg-tertiary)}.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid transparent;border-radius:8px;padding:10px 14px;font-weight:600;cursor:pointer;transition:all .15s ease;background-color:var(--bg-secondary);color:var(--text-primary)}.btn.btn-primary{background-color:var(--primary-color);color:var(--primary-contrast, #fff);border-color:var(--primary-color)}.btn.btn-primary:hover{background-color:var(--primary-hover);border-color:var(--primary-hover)}.btn.btn-secondary{background-color:var(--bg-tertiary);border-color:var(--border-color);color:var(--text-primary)}.btn.btn-secondary:hover{background-color:var(--bg-hover, var(--bg-tertiary));border-color:var(--border-hover)}.btn.btn-ghost{background:transparent;border-color:transparent;color:var(--text-secondary)}.btn.btn-ghost:hover{color:var(--text-primary);background:var(--bg-tertiary)}.btn.btn-danger{background-color:#c65746;border-color:#c65746;color:#fff}.btn.btn-danger:hover{background-color:#b94a39}.btn.btn-full{width:100%}.btn.btn-sm{padding:8px 10px;font-size:14px}.btn:disabled{opacity:.6;cursor:not-allowed}:global([data-theme=dark]) .btn{color:#fff}:global([data-theme=dark]) .btn.btn-secondary,:global([data-theme=dark]) .btn.btn-ghost{color:#fff}.input,textarea{width:100%;border:1px solid var(--border-color);border-radius:8px;padding:10px 12px;background-color:var(--bg-secondary);color:var(--text-primary);transition:border-color .15s ease,box-shadow .15s ease}.input:focus,textarea:focus{outline:none;border-color:var(--primary-color);box-shadow:0 0 0 3px #8b86802e}.form-group{display:flex;flex-direction:column;gap:4px;margin-bottom:16px}.form-group label{font-weight:600;color:var(--text-primary)}.form-group .hint{color:var(--text-secondary);font-size:13px}.card{background-color:var(--bg-primary);border:1px solid var(--border-color);border-radius:12px;box-shadow:var(--shadow);padding:24px}.card-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.card-header .title{font-size:18px;font-weight:700;color:var(--text-primary)}.sLine truncated
</head>
<body>
<div id="root"></div>
</body>
</html>