scream-code 0.15.8 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{app-Bbg_nJTR.mjs → app-N_PRvDIk.mjs} +702 -101
- package/dist/{dispatch-CEK-syAX.mjs → dispatch-5S52okPl.mjs} +1 -1
- package/dist/{dispatch-BaAsj0v5.mjs → dispatch-CsrteWRw.mjs} +40 -10
- package/dist/main.mjs +1 -1
- package/dist/public/assets/index-DwX1jGaf.js +96 -0
- package/dist/public/assets/index-DwX1jGaf.js.map +1 -0
- package/dist/public/assets/index-zIKfLBMX.css +1 -0
- package/dist/public/index.html +2 -2
- package/dist/{text-input-dialog-BBSjCM5z.mjs → text-input-dialog-B0PROY20.mjs} +1 -1
- package/dist/{text-input-dialog-C5pDKZ-c.mjs → text-input-dialog-BVQaKy1Z.mjs} +30 -6
- package/package.json +1 -1
- package/dist/public/assets/index-DjlCHEg8.js +0 -96
- package/dist/public/assets/index-DjlCHEg8.js.map +0 -1
- package/dist/public/assets/index-yCBo3yth.css +0 -1
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
var hh=Object.defineProperty;var ph=(e,t,n)=>t in e?hh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var z=(e,t,n)=>ph(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))s(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const l of i.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&s(l)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function s(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();/**
|
|
2
|
-
* @vue/shared v3.5.40
|
|
3
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
-
* @license MIT
|
|
5
|
-
**/function Hl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Je={},rs=[],Vt=()=>{},Cc=()=>!1,li=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),ri=e=>e.startsWith("onUpdate:"),at=Object.assign,Wl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},gh=Object.prototype.hasOwnProperty,He=(e,t)=>gh.call(e,t),we=Array.isArray,as=e=>eo(e)==="[object Map]",ai=e=>eo(e)==="[object Set]",Gr=e=>eo(e)==="[object Date]",Ae=e=>typeof e=="function",st=e=>typeof e=="string",Yt=e=>typeof e=="symbol",qe=e=>e!==null&&typeof e=="object",Tc=e=>(qe(e)||Ae(e))&&Ae(e.then)&&Ae(e.catch),Ic=Object.prototype.toString,eo=e=>Ic.call(e),mh=e=>eo(e).slice(8,-1),Rc=e=>eo(e)==="[object Object]",ql=e=>st(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ps=Hl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),ci=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},vh=/-\w/g,Et=ci(e=>e.replace(vh,t=>t.slice(1).toUpperCase())),yh=/\B([A-Z])/g,Mn=ci(e=>e.replace(yh,"-$1").toLowerCase()),ui=ci(e=>e.charAt(0).toUpperCase()+e.slice(1)),Di=ci(e=>e?`on${ui(e)}`:""),rn=(e,t)=>!Object.is(e,t),$o=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Ac=(e,t,n,s=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:s,value:n})},di=e=>{const t=parseFloat(e);return isNaN(t)?e:t},bh=e=>{const t=st(e)?Number(e):NaN;return isNaN(t)?e:t};let zr;const fi=()=>zr||(zr=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Nt(e){if(we(e)){const t={};for(let n=0;n<e.length;n++){const s=e[n],o=st(s)?Sh(s):Nt(s);if(o)for(const i in o)t[i]=o[i]}return t}else if(st(e)||qe(e))return e}const kh=/;(?![^(]*\))/g,wh=/:([^]+)/,_h=/\/\*[^]*?\*\//g;function Sh(e){const t={};return e.replace(_h,"").split(kh).forEach(n=>{if(n){const s=n.split(wh);s.length>1&&(t[s[0].trim()]=s[1].trim())}}),t}function fe(e){let t="";if(st(e))t=e;else if(we(e))for(let n=0;n<e.length;n++){const s=fe(e[n]);s&&(t+=s+" ")}else if(qe(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const $h="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",xh=Hl($h);function Ec(e){return!!e||e===""}function Ch(e,t){if(e.length!==t.length)return!1;let n=!0;for(let s=0;n&&s<e.length;s++)n=to(e[s],t[s]);return n}function to(e,t){if(e===t)return!0;let n=Gr(e),s=Gr(t);if(n||s)return n&&s?e.getTime()===t.getTime():!1;if(n=Yt(e),s=Yt(t),n||s)return e===t;if(n=we(e),s=we(t),n||s)return n&&s?Ch(e,t):!1;if(n=qe(e),s=qe(t),n||s){if(!n||!s)return!1;const o=Object.keys(e).length,i=Object.keys(t).length;if(o!==i)return!1;for(const l in e){const r=e.hasOwnProperty(l),a=t.hasOwnProperty(l);if(r&&!a||!r&&a||!to(e[l],t[l]))return!1}}return String(e)===String(t)}function Th(e,t){return e.findIndex(n=>to(n,t))}const Mc=e=>!!(e&&e.__v_isRef===!0),R=e=>st(e)?e:e==null?"":we(e)||qe(e)&&(e.toString===Ic||!Ae(e.toString))?Mc(e)?R(e.value):JSON.stringify(e,Pc,2):String(e),Pc=(e,t)=>Mc(t)?Pc(e,t.value):as(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[s,o],i)=>(n[Ni(s,i)+" =>"]=o,n),{})}:ai(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Ni(n))}:Yt(t)?Ni(t):qe(t)&&!we(t)&&!Rc(t)?String(t):t,Ni=(e,t="")=>{var n;return Yt(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};function Ih(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:String(e)}/**
|
|
6
|
-
* @vue/reactivity v3.5.40
|
|
7
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
8
|
-
* @license MIT
|
|
9
|
-
**/let vt;class Rh{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&vt&&(vt.active?(this.parent=vt,this.index=(vt.scopes||(vt.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes){const s=this.scopes.slice();for(t=0,n=s.length;t<n;t++)s[t].pause()}for(t=0,n=this.effects.length;t<n;t++)this.effects[t].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let t,n;if(this.scopes){const o=this.scopes.slice();for(t=0,n=o.length;t<n;t++)o[t].resume()}const s=this.effects.slice();for(t=0,n=s.length;t<n;t++)s[t].resume()}}run(t){if(this._active){const n=vt;try{return vt=this,t()}finally{vt=n}}}on(){++this._on===1&&(this.prevScope=vt,vt=this)}off(){if(this._on>0&&--this._on===0){if(vt===this)vt=this.prevScope;else{let t=vt;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,s;for(n=0,s=this.effects.length;n<s;n++)this.effects[n].stop();for(this.effects.length=0,n=0,s=this.cleanups.length;n<s;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){const o=this.scopes.slice();for(n=0,s=o.length;n<s;n++)o[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const o=this.parent.scopes.pop();o&&o!==this&&(this.parent.scopes[this.index]=o,o.index=this.index)}this.parent=void 0}}}function Ah(){return vt}let tt;const Bi=new WeakSet;class Lc{constructor(t){this.fn=t,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,vt&&(vt.active?vt.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Bi.has(this)&&(Bi.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Dc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Hr(this),Nc(this);const t=tt,n=Kt;tt=this,Kt=!0;try{return this.fn()}finally{Bc(this),tt=t,Kt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Yl(t);this.deps=this.depsTail=void 0,Hr(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Bi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){fl(this)&&this.run()}get dirty(){return fl(this)}}let Oc=0,Ls,Os;function Dc(e,t=!1){if(e.flags|=8,t){e.next=Os,Os=e;return}e.next=Ls,Ls=e}function Vl(){Oc++}function Kl(){if(--Oc>0)return;if(Os){let t=Os;for(Os=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Ls;){let t=Ls;for(Ls=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(s){e||(e=s)}t=n}}if(e)throw e}function Nc(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Bc(e){let t,n=e.depsTail,s=n;for(;s;){const o=s.prevDep;s.version===-1?(s===n&&(n=o),Yl(s),Eh(s)):t=s,s.dep.activeLink=s.prevActiveLink,s.prevActiveLink=void 0,s=o}e.deps=t,e.depsTail=n}function fl(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Fc(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Fc(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===js)||(e.globalVersion=js,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!fl(e))))return;e.flags|=2;const t=e.dep,n=tt,s=Kt;tt=e,Kt=!0;try{Nc(e);const o=e.fn(e._value);(t.version===0||rn(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{tt=n,Kt=s,Bc(e),e.flags&=-3}}function Yl(e,t=!1){const{dep:n,prevSub:s,nextSub:o}=e;if(s&&(s.nextSub=o,e.prevSub=void 0),o&&(o.prevSub=s,e.nextSub=void 0),n.subs===e&&(n.subs=s,!s&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)Yl(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Eh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Kt=!0;const jc=[];function bn(){jc.push(Kt),Kt=!1}function kn(){const e=jc.pop();Kt=e===void 0?!0:e}function Hr(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=tt;tt=void 0;try{t()}finally{tt=n}}}let js=0;class Mh{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Zl{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!tt||!Kt||tt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==tt)n=this.activeLink=new Mh(tt,this),tt.deps?(n.prevDep=tt.depsTail,tt.depsTail.nextDep=n,tt.depsTail=n):tt.deps=tt.depsTail=n,Uc(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const s=n.nextDep;s.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=s),n.prevDep=tt.depsTail,n.nextDep=void 0,tt.depsTail.nextDep=n,tt.depsTail=n,tt.deps===n&&(tt.deps=s)}return n}trigger(t){this.version++,js++,this.notify(t)}notify(t){Vl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Kl()}}}function Uc(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let s=t.deps;s;s=s.nextDep)Uc(s)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const hl=new WeakMap,Wn=Symbol(""),pl=Symbol(""),Us=Symbol("");function _t(e,t,n){if(Kt&&tt){let s=hl.get(e);s||hl.set(e,s=new Map);let o=s.get(n);o||(s.set(n,o=new Zl),o.map=s,o.key=n),o.track()}}function dn(e,t,n,s,o,i){const l=hl.get(e);if(!l){js++;return}const r=a=>{a&&a.trigger()};if(Vl(),t==="clear")l.forEach(r);else{const a=we(e),c=a&&ql(n);if(a&&n==="length"){const u=Number(s);l.forEach((f,h)=>{(h==="length"||h===Us||!Yt(h)&&h>=u)&&r(f)})}else switch((n!==void 0||l.has(void 0))&&r(l.get(n)),c&&r(l.get(Us)),t){case"add":a?c&&r(l.get("length")):(r(l.get(Wn)),as(e)&&r(l.get(pl)));break;case"delete":a||(r(l.get(Wn)),as(e)&&r(l.get(pl)));break;case"set":as(e)&&r(l.get(Wn));break}}Kl()}function os(e){const t=Ge(e);return t===e?t:(_t(t,"iterate",Us),Wt(e)?t:t.map(Zt))}function hi(e){return _t(e=Ge(e),"iterate",Us),e}function on(e,t){return wn(e)?ps(qn(e)?Zt(t):t):Zt(t)}const Ph={__proto__:null,[Symbol.iterator](){return Fi(this,Symbol.iterator,e=>on(this,e))},concat(...e){return os(this).concat(...e.map(t=>we(t)?os(t):t))},entries(){return Fi(this,"entries",e=>(e[1]=on(this,e[1]),e))},every(e,t){return an(this,"every",e,t,void 0,arguments)},filter(e,t){return an(this,"filter",e,t,n=>n.map(s=>on(this,s)),arguments)},find(e,t){return an(this,"find",e,t,n=>on(this,n),arguments)},findIndex(e,t){return an(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return an(this,"findLast",e,t,n=>on(this,n),arguments)},findLastIndex(e,t){return an(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return an(this,"forEach",e,t,void 0,arguments)},includes(...e){return ji(this,"includes",e)},indexOf(...e){return ji(this,"indexOf",e)},join(e){return os(this).join(e)},lastIndexOf(...e){return ji(this,"lastIndexOf",e)},map(e,t){return an(this,"map",e,t,void 0,arguments)},pop(){return ws(this,"pop")},push(...e){return ws(this,"push",e)},reduce(e,...t){return Wr(this,"reduce",e,t)},reduceRight(e,...t){return Wr(this,"reduceRight",e,t)},shift(){return ws(this,"shift")},some(e,t){return an(this,"some",e,t,void 0,arguments)},splice(...e){return ws(this,"splice",e)},toReversed(){return os(this).toReversed()},toSorted(e){return os(this).toSorted(e)},toSpliced(...e){return os(this).toSpliced(...e)},unshift(...e){return ws(this,"unshift",e)},values(){return Fi(this,"values",e=>on(this,e))}};function Fi(e,t,n){const s=hi(e),o=s[t]();return s!==e&&!Wt(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}const Lh=Array.prototype;function an(e,t,n,s,o,i){const l=hi(e),r=l!==e&&!Wt(e),a=l[t];if(a!==Lh[t]){const f=a.apply(e,i);return r?Zt(f):f}let c=n;l!==e&&(r?c=function(f,h){return n.call(this,on(e,f),h,e)}:n.length>2&&(c=function(f,h){return n.call(this,f,h,e)}));const u=a.call(l,c,s);return r&&o?o(u):u}function Wr(e,t,n,s){const o=hi(e),i=o!==e&&!Wt(e);let l=n,r=!1;o!==e&&(i?(r=s.length===0,l=function(c,u,f){return r&&(r=!1,c=on(e,c)),n.call(this,c,on(e,u),f,e)}):n.length>3&&(l=function(c,u,f){return n.call(this,c,u,f,e)}));const a=o[t](l,...s);return r?on(e,a):a}function ji(e,t,n){const s=Ge(e);_t(s,"iterate",Us);const o=s[t](...n);return(o===-1||o===!1)&&Ql(n[0])?(n[0]=Ge(n[0]),s[t](...n)):o}function ws(e,t,n=[]){bn(),Vl();const s=Ge(e)[t].apply(e,n);return Kl(),kn(),s}const Oh=Hl("__proto__,__v_isRef,__isVue"),Gc=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Yt));function Dh(e){Yt(e)||(e=String(e));const t=Ge(this);return _t(t,"has",e),t.hasOwnProperty(e)}class zc{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,s){if(n==="__v_skip")return t.__v_skip;const o=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!o;if(n==="__v_isReadonly")return o;if(n==="__v_isShallow")return i;if(n==="__v_raw")return s===(o?i?qh:Vc:i?qc:Wc).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(s)?t:void 0;const l=we(t);if(!o){let a;if(l&&(a=Ph[n]))return a;if(n==="hasOwnProperty")return Dh}const r=Reflect.get(t,n,ht(t)?t:s);if((Yt(n)?Gc.has(n):Oh(n))||(o||_t(t,"get",n),i))return r;if(ht(r)){const a=l&&ql(n)?r:r.value;return o&&qe(a)?ml(a):a}return qe(r)?o?ml(r):An(r):r}}class Hc extends zc{constructor(t=!1){super(!1,t)}set(t,n,s,o){let i=t[n];const l=we(t)&&ql(n);if(!this._isShallow){const c=wn(i);if(!Wt(s)&&!wn(s)&&(i=Ge(i),s=Ge(s)),!l&&ht(i)&&!ht(s))return c||(i.value=s),!0}const r=l?Number(n)<t.length:He(t,n),a=Reflect.set(t,n,s,ht(t)?t:o);return t===Ge(o)&&a&&(r?rn(s,i)&&dn(t,"set",n,s):dn(t,"add",n,s)),a}deleteProperty(t,n){const s=He(t,n);t[n];const o=Reflect.deleteProperty(t,n);return o&&s&&dn(t,"delete",n,void 0),o}has(t,n){const s=Reflect.has(t,n);return(!Yt(n)||!Gc.has(n))&&_t(t,"has",n),s}ownKeys(t){return _t(t,"iterate",we(t)?"length":Wn),Reflect.ownKeys(t)}}class Nh extends zc{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const Bh=new Hc,Fh=new Nh,jh=new Hc(!0);const gl=e=>e,fo=e=>Reflect.getPrototypeOf(e);function Uh(e,t,n){return function(...s){const o=this.__v_raw,i=Ge(o),l=as(i),r=e==="entries"||e===Symbol.iterator&&l,a=e==="keys"&&l,c=o[e](...s),u=n?gl:t?ps:Zt;return!t&&_t(i,"iterate",a?pl:Wn),at(Object.create(c),{next(){const{value:f,done:h}=c.next();return h?{value:f,done:h}:{value:r?[u(f[0]),u(f[1])]:u(f),done:h}}})}}function ho(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Gh(e,t){const n={get(o){const i=this.__v_raw,l=Ge(i),r=Ge(o);e||(rn(o,r)&&_t(l,"get",o),_t(l,"get",r));const{has:a}=fo(l),c=t?gl:e?ps:Zt;if(a.call(l,o))return c(i.get(o));if(a.call(l,r))return c(i.get(r));i!==l&&i.get(o)},get size(){const o=this.__v_raw;return!e&&_t(Ge(o),"iterate",Wn),o.size},has(o){const i=this.__v_raw,l=Ge(i),r=Ge(o);return e||(rn(o,r)&&_t(l,"has",o),_t(l,"has",r)),o===r?i.has(o):i.has(o)||i.has(r)},forEach(o,i){const l=this,r=l.__v_raw,a=Ge(r),c=t?gl:e?ps:Zt;return!e&&_t(a,"iterate",Wn),r.forEach((u,f)=>o.call(i,c(u),c(f),l))}};return at(n,e?{add:ho("add"),set:ho("set"),delete:ho("delete"),clear:ho("clear")}:{add(o){const i=Ge(this),l=fo(i),r=Ge(o),a=!t&&!Wt(o)&&!wn(o)?r:o;return l.has.call(i,a)||rn(o,a)&&l.has.call(i,o)||rn(r,a)&&l.has.call(i,r)||(i.add(a),dn(i,"add",a,a)),this},set(o,i){!t&&!Wt(i)&&!wn(i)&&(i=Ge(i));const l=Ge(this),{has:r,get:a}=fo(l);let c=r.call(l,o);c||(o=Ge(o),c=r.call(l,o));const u=a.call(l,o);return l.set(o,i),c?rn(i,u)&&dn(l,"set",o,i):dn(l,"add",o,i),this},delete(o){const i=Ge(this),{has:l,get:r}=fo(i);let a=l.call(i,o);a||(o=Ge(o),a=l.call(i,o)),r&&r.call(i,o);const c=i.delete(o);return a&&dn(i,"delete",o,void 0),c},clear(){const o=Ge(this),i=o.size!==0,l=o.clear();return i&&dn(o,"clear",void 0,void 0),l}}),["keys","values","entries",Symbol.iterator].forEach(o=>{n[o]=Uh(o,e,t)}),n}function Jl(e,t){const n=Gh(e,t);return(s,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?s:Reflect.get(He(n,o)&&o in s?n:s,o,i)}const zh={get:Jl(!1,!1)},Hh={get:Jl(!1,!0)},Wh={get:Jl(!0,!1)};const Wc=new WeakMap,qc=new WeakMap,Vc=new WeakMap,qh=new WeakMap;function Vh(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function An(e){return wn(e)?e:Xl(e,!1,Bh,zh,Wc)}function Kh(e){return Xl(e,!1,jh,Hh,qc)}function ml(e){return Xl(e,!0,Fh,Wh,Vc)}function Xl(e,t,n,s,o){if(!qe(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const i=o.get(e);if(i)return i;const l=Vh(mh(e));if(l===0)return e;const r=new Proxy(e,l===2?s:n);return o.set(e,r),r}function qn(e){return wn(e)?qn(e.__v_raw):!!(e&&e.__v_isReactive)}function wn(e){return!!(e&&e.__v_isReadonly)}function Wt(e){return!!(e&&e.__v_isShallow)}function Ql(e){return e?!!e.__v_raw:!1}function Ge(e){const t=e&&e.__v_raw;return t?Ge(t):e}function Yh(e){return!He(e,"__v_skip")&&Object.isExtensible(e)&&Ac(e,"__v_skip",!0),e}const Zt=e=>qe(e)?An(e):e,ps=e=>qe(e)?ml(e):e;function ht(e){return e?e.__v_isRef===!0:!1}function F(e){return Zh(e,!1)}function Zh(e,t){return ht(e)?e:new Jh(e,t)}class Jh{constructor(t,n){this.dep=new Zl,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Ge(t),this._value=n?t:Zt(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,s=this.__v_isShallow||Wt(t)||wn(t);t=s?t:Ge(t),rn(t,n)&&(this._rawValue=t,this._value=s?t:Zt(t),this.dep.trigger())}}function W(e){return ht(e)?e.value:e}const Xh={get:(e,t,n)=>t==="__v_raw"?e:W(Reflect.get(e,t,n)),set:(e,t,n,s)=>{const o=e[t];return ht(o)&&!ht(n)?(o.value=n,!0):Reflect.set(e,t,n,s)}};function Kc(e){return qn(e)?e:new Proxy(e,Xh)}class Qh{constructor(t,n,s){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Zl(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=js-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=s}notify(){if(this.flags|=16,!(this.flags&8)&&tt!==this)return Dc(this,!0),!0}get value(){const t=this.dep.track();return Fc(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function ep(e,t,n=!1){let s,o;return Ae(e)?s=e:(s=e.get,o=e.set),new Qh(s,o,n)}const po={},Lo=new WeakMap;let Fn;function tp(e,t=!1,n=Fn){if(n){let s=Lo.get(n);s||Lo.set(n,s=[]),s.push(e)}}function np(e,t,n=Je){const{immediate:s,deep:o,once:i,scheduler:l,augmentJob:r,call:a}=n,c=P=>o?P:Wt(P)||o===!1||o===0?fn(P,1):fn(P);let u,f,h,p,v=!1,k=!1;if(ht(e)?(f=()=>e.value,v=Wt(e)):qn(e)?(f=()=>c(e),v=!0):we(e)?(k=!0,v=e.some(P=>qn(P)||Wt(P)),f=()=>e.map(P=>{if(ht(P))return P.value;if(qn(P))return c(P);if(Ae(P))return a?a(P,2):P()})):Ae(e)?t?f=a?()=>a(e,2):e:f=()=>{if(h){bn();try{h()}finally{kn()}}const P=Fn;Fn=u;try{return a?a(e,3,[p]):e(p)}finally{Fn=P}}:f=Vt,t&&o){const P=f,Z=o===!0?1/0:o;f=()=>fn(P(),Z)}const w=Ah(),S=()=>{u.stop(),w&&w.active&&Wl(w.effects,u)};if(i&&t){const P=t;t=(...Z)=>{const j=P(...Z);return S(),j}}let $=k?new Array(e.length).fill(po):po;const M=P=>{if(!(!(u.flags&1)||!u.dirty&&!P))if(t){const Z=u.run();if(P||o||v||(k?Z.some((j,C)=>rn(j,$[C])):rn(Z,$))){h&&h();const j=Fn;Fn=u;try{const C=[Z,$===po?void 0:k&&$[0]===po?[]:$,p];$=Z,a?a(t,3,C):t(...C)}finally{Fn=j}}}else u.run()};return r&&r(M),u=new Lc(f),u.scheduler=l?()=>l(M,!1):M,p=P=>tp(P,!1,u),h=u.onStop=()=>{const P=Lo.get(u);if(P){if(a)a(P,4);else for(const Z of P)Z();Lo.delete(u)}},t?s?M(!0):$=u.run():l?l(M.bind(null,!0),!0):u.run(),S.pause=u.pause.bind(u),S.resume=u.resume.bind(u),S.stop=S,S}function fn(e,t=1/0,n){if(t<=0||!qe(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,ht(e))fn(e.value,t,n);else if(we(e))for(let s=0;s<e.length;s++)fn(e[s],t,n);else if(ai(e)||as(e))e.forEach(s=>{fn(s,t,n)});else if(Rc(e)){for(const s in e)fn(e[s],t,n);for(const s of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,s)&&fn(e[s],t,n)}return e}/**
|
|
10
|
-
* @vue/runtime-core v3.5.40
|
|
11
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
12
|
-
* @license MIT
|
|
13
|
-
**/function no(e,t,n,s){try{return s?e(...s):e()}catch(o){pi(o,t,n)}}function qt(e,t,n,s){if(Ae(e)){const o=no(e,t,n,s);return o&&Tc(o)&&o.catch(i=>{pi(i,t,n)}),o}if(we(e)){const o=[];for(let i=0;i<e.length;i++)o.push(qt(e[i],t,n,s));return o}}function pi(e,t,n,s=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:l}=t&&t.appContext.config||Je;if(t){let r=t.parent;const a=t.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){const u=r.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](e,a,c)===!1)return}r=r.parent}if(i){bn(),no(i,null,10,[e,a,c]),kn();return}}sp(e,n,o,s,l)}function sp(e,t,n,s=!0,o=!1){if(o)throw e;console.error(e)}const Rt=[];let sn=-1;const cs=[];let Tn=null,is=0;const Yc=Promise.resolve();let Oo=null;function ft(e){const t=Oo||Yc;return e?t.then(this?e.bind(this):e):t}function op(e){let t=sn+1,n=Rt.length;for(;t<n;){const s=t+n>>>1,o=Rt[s],i=Gs(o);i<e||i===e&&o.flags&2?t=s+1:n=s}return t}function er(e){if(!(e.flags&1)){const t=Gs(e),n=Rt[Rt.length-1];!n||!(e.flags&2)&&t>=Gs(n)?Rt.push(e):Rt.splice(op(t),0,e),e.flags|=1,Zc()}}function Zc(){Oo||(Oo=Yc.then(Qc))}function Jc(e){we(e)?cs.push(...e):Tn&&e.id===-1?Tn.splice(is+1,0,e):e.flags&1||(cs.push(e),e.flags|=1),Zc()}function qr(e,t,n=sn+1){for(;n<Rt.length;n++){const s=Rt[n];if(s&&s.flags&2){if(e&&s.id!==e.uid)continue;Rt.splice(n,1),n--,s.flags&4&&(s.flags&=-2),s(),s.flags&4||(s.flags&=-2)}}}function Xc(e){if(cs.length){const t=[...new Set(cs)].sort((n,s)=>Gs(n)-Gs(s));if(cs.length=0,Tn){Tn.push(...t);return}for(Tn=t,is=0;is<Tn.length;is++){const n=Tn[is];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Tn=null,is=0}}const Gs=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Qc(e){try{for(sn=0;sn<Rt.length;sn++){const t=Rt[sn];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),no(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;sn<Rt.length;sn++){const t=Rt[sn];t&&(t.flags&=-2)}sn=-1,Rt.length=0,Xc(),Oo=null,(Rt.length||cs.length)&&Qc()}}let yt=null,eu=null;function Do(e){const t=yt;return yt=e,eu=e&&e.type.__scopeId||null,t}function Pt(e,t=yt,n){if(!t||e._n)return e;const s=(...o)=>{s._d&&Fo(-1);const i=Do(t),l=yn.length;let r;try{r=e(...o)}finally{for(let a=yn.length;a>l;a--)lr();Do(i),s._d&&Fo(1)}return r};return s._n=!0,s._c=!0,s._d=!0,s}function it(e,t){if(yt===null)return e;const n=wi(yt),s=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,l,r,a=Je]=t[o];i&&(Ae(i)&&(i={mounted:i,updated:i}),i.deep&&fn(l),s.push({dir:i,instance:n,value:l,oldValue:void 0,arg:r,modifiers:a}))}return e}function On(e,t,n,s){const o=e.dirs,i=t&&t.dirs;for(let l=0;l<o.length;l++){const r=o[l];i&&(r.oldValue=i[l].value);let a=r.dir[s];a&&(bn(),qt(a,n,8,[e.el,r,e,t]),kn())}}function xo(e,t){if($t){let n=$t.provides;const s=$t.parent&&$t.parent.provides;s===n&&(n=$t.provides=Object.create(s)),n[e]=t}}function vn(e,t,n=!1){const s=ki();if(s||ds){let o=ds?ds._context.provides:s?s.parent==null||s.ce?s.vnode.appContext&&s.vnode.appContext.provides:s.parent.provides:void 0;if(o&&e in o)return o[e];if(arguments.length>1)return n&&Ae(t)?t.call(s&&s.proxy):t}}const ip=Symbol.for("v-scx"),lp=()=>vn(ip);function Me(e,t,n){return tu(e,t,n)}function tu(e,t,n=Je){const{immediate:s,deep:o,flush:i,once:l}=n,r=at({},n),a=t&&s||!t&&i!=="post";let c;if(qs){if(i==="sync"){const p=lp();c=p.__watcherHandles||(p.__watcherHandles=[])}else if(!a){const p=()=>{};return p.stop=Vt,p.resume=Vt,p.pause=Vt,p}}const u=$t;r.call=(p,v,k)=>qt(p,u,v,k);let f=!1;i==="post"?r.scheduler=p=>{It(p,u&&u.suspense)}:i!=="sync"&&(f=!0,r.scheduler=(p,v)=>{v?p():er(p)}),r.augmentJob=p=>{t&&(p.flags|=4),f&&(p.flags|=2,u&&(p.id=u.uid,p.i=u))};const h=np(e,t,r);return qs&&(c?c.push(h):a&&h()),h}function rp(e,t,n){const s=this.proxy,o=st(e)?e.includes(".")?nu(s,e):()=>s[e]:e.bind(s,s);let i;Ae(t)?i=t:(i=t.handler,n=t);const l=so(this),r=tu(o,i.bind(s),n);return l(),r}function nu(e,t){const n=t.split(".");return()=>{let s=e;for(let o=0;o<n.length&&s;o++)s=s[n[o]];return s}}const xn=new WeakMap,su=Symbol("_vte"),ou=e=>e.__isTeleport,jn=e=>e&&(e.disabled||e.disabled===""),ap=e=>e&&(e.defer||e.defer===""),Vr=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Kr=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,vl=(e,t)=>{const n=e&&e.to;return st(n)?t?t(n):null:n},cp={name:"Teleport",__isTeleport:!0,process(e,t,n,s,o,i,l,r,a,c){const{mc:u,pc:f,pbc:h,o:{insert:p,querySelector:v,createText:k,createComment:w,parentNode:S}}=c,$=jn(t.props);let{dynamicChildren:M}=t;const P=(C,x,y)=>{C.shapeFlag&16&&u(C.children,x,y,o,i,l,r,a)},Z=(C=t)=>{const x=jn(C.props),y=C.target=vl(C.props,v),T=yl(y,C,k,p);y&&(l!=="svg"&&Vr(y)?l="svg":l!=="mathml"&&Kr(y)&&(l="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(y),x||(P(C,y,T),Rs(C,!1)))},j=C=>{const x=()=>{if(xn.get(C)===x){if(xn.delete(C),jn(C.props)){const y=S(C.el)||n;P(C,y,C.anchor),Rs(C,!0)}Z(C)}};xn.set(C,x),It(x,i)};if(e==null){const C=t.el=k(""),x=t.anchor=k("");if(p(C,n,s),p(x,n,s),ap(t.props)||i&&i.pendingBranch){j(t);return}$&&(P(t,n,x),Rs(t,!0)),Z()}else{t.el=e.el;const C=t.anchor=e.anchor,x=xn.get(e);if(x){x.flags|=8,xn.delete(e),j(t);return}t.targetStart=e.targetStart;const y=t.target=e.target,T=t.targetAnchor=e.targetAnchor,O=jn(e.props),I=O?n:y,H=O?C:T;if(l==="svg"||Vr(y)?l="svg":(l==="mathml"||Kr(y))&&(l="mathml"),M?(h(e.dynamicChildren,M,I,o,i,l,r),ir(e,t,!0)):a||f(e,t,I,H,o,i,l,r,!1),$)O?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):go(t,n,C,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const L=vl(t.props,v);L&&(t.target=L,go(t,L,null,c,0))}else O&&go(t,y,T,c,1);Rs(t,$)}},remove(e,t,n,{um:s,o:{remove:o}},i){const{shapeFlag:l,children:r,anchor:a,targetStart:c,targetAnchor:u,target:f,props:h}=e,p=jn(h),v=i||!p,k=xn.get(e);if(k&&(k.flags|=8,xn.delete(e)),f&&(o(c),o(u)),i&&o(a),!k&&(p||f)&&l&16)for(let w=0;w<r.length;w++){const S=r[w];s(S,t,n,v,!!S.dynamicChildren)}},move:go,hydrate:up};function go(e,t,n,{o:{insert:s},m:o},i=2){i===0&&s(e.targetAnchor,t,n);const{el:l,anchor:r,shapeFlag:a,children:c,props:u}=e,f=i===2;if(f&&s(l,t,n),!xn.has(e)&&(!f||jn(u))&&a&16)for(let h=0;h<c.length;h++)o(c[h],t,n,2);f&&s(r,t,n)}function up(e,t,n,s,o,i,{o:{nextSibling:l,parentNode:r,querySelector:a,insert:c,createText:u}},f){function h(w,S){let $=S;for(;$;){if($&&$.nodeType===8){if($.data==="teleport start anchor")t.targetStart=$;else if($.data==="teleport anchor"){t.targetAnchor=$,w._lpa=t.targetAnchor&&l(t.targetAnchor);break}}$=l($)}}function p(w,S){S.anchor=f(l(w),S,r(w),n,s,o,i)}const v=t.target=vl(t.props,a),k=jn(t.props);if(v){const w=v._lpa||v.firstChild;t.shapeFlag&16&&(k?(p(e,t),h(v,w),t.targetAnchor||yl(v,t,u,c,r(e)===v?e:null)):(t.anchor=l(e),h(v,w),t.targetAnchor||yl(v,t,u,c),f(w&&l(w),t,v,n,s,o,i))),Rs(t,k)}else k&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=l(e));return t.anchor&&l(t.anchor)}const tr=cp;function Rs(e,t){const n=e.ctx;if(n&&n.ut){let s,o;for(t?(s=e.el,o=e.anchor):(s=e.targetStart,o=e.targetAnchor);s&&s!==o;)s.nodeType===1&&s.setAttribute("data-v-owner",n.uid),s=s.nextSibling;n.ut()}}function yl(e,t,n,s,o=null){const i=t.targetStart=n(""),l=t.targetAnchor=n("");return i[su]=l,e&&(s(i,e,o),s(l,e,o)),l}const zt=Symbol("_leaveCb"),_s=Symbol("_enterCb");function iu(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ct(()=>{e.isMounted=!0}),Ct(()=>{e.isUnmounting=!0}),e}const Ut=[Function,Array],lu={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ut,onEnter:Ut,onAfterEnter:Ut,onEnterCancelled:Ut,onBeforeLeave:Ut,onLeave:Ut,onAfterLeave:Ut,onLeaveCancelled:Ut,onBeforeAppear:Ut,onAppear:Ut,onAfterAppear:Ut,onAppearCancelled:Ut},ru=e=>{const t=e.subTree;return t.component?ru(t.component):t},dp={name:"BaseTransition",props:lu,setup(e,{slots:t}){const n=ki(),s=iu();return()=>{const o=t.default&&nr(t.default(),!0),i=o&&o.length?au(o):n.subTree?U():void 0;if(!i)return;const l=Ge(e),{mode:r}=l;if(s.isLeaving)return Ui(i);const a=Yr(i);if(!a)return Ui(i);let c=zs(a,l,s,n,f=>c=f);a.type!==St&&Yn(a,c);let u=n.subTree&&Yr(n.subTree);if(u&&u.type!==St&&!Un(u,a)&&ru(n).type!==St){let f=zs(u,l,s,n);if(Yn(u,f),r==="out-in"&&a.type!==St)return s.isLeaving=!0,f.afterLeave=()=>{s.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,u=void 0},Ui(i);r==="in-out"&&a.type!==St?f.delayLeave=(h,p,v)=>{const k=cu(s,u);k[String(u.key)]=u,h[zt]=()=>{p(),h[zt]=void 0,delete c.delayedLeave,u=void 0},c.delayedLeave=()=>{v(),delete c.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return i}}};function au(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==St){t=n;break}}return t}const fp=dp;function cu(e,t){const{leavingVNodes:n}=e;let s=n.get(t.type);return s||(s=Object.create(null),n.set(t.type,s)),s}function zs(e,t,n,s,o){const{appear:i,mode:l,persisted:r=!1,onBeforeEnter:a,onEnter:c,onAfterEnter:u,onEnterCancelled:f,onBeforeLeave:h,onLeave:p,onAfterLeave:v,onLeaveCancelled:k,onBeforeAppear:w,onAppear:S,onAfterAppear:$,onAppearCancelled:M}=t,P=String(e.key),Z=cu(n,e),j=(y,T)=>{y&&qt(y,s,9,T)},C=(y,T)=>{const O=T[1];j(y,T),we(y)?y.every(I=>I.length<=1)&&O():y.length<=1&&O()},x={mode:l,persisted:r,beforeEnter(y){let T=a;if(!n.isMounted)if(i)T=w||a;else return;y[zt]&&y[zt](!0);const O=Z[P];O&&Un(e,O)&&O.el[zt]&&O.el[zt](),j(T,[y])},enter(y){if(Z[P]===e)return;let T=c,O=u,I=f;if(!n.isMounted)if(i)T=S||c,O=$||u,I=M||f;else return;let H=!1;y[_s]=B=>{H||(H=!0,B?j(I,[y]):j(O,[y]),x.delayedLeave&&x.delayedLeave(),y[_s]=void 0)};const L=y[_s].bind(null,!1);T?C(T,[y,L]):L()},leave(y,T){const O=String(e.key);if(y[_s]&&y[_s](!0),n.isUnmounting)return T();j(h,[y]);let I=!1;y[zt]=L=>{I||(I=!0,T(),L?j(k,[y]):j(v,[y]),y[zt]=void 0,Z[O]===e&&delete Z[O])};const H=y[zt].bind(null,!1);Z[O]=e,p?C(p,[y,H]):H()},clone(y){const T=zs(y,t,n,s,o);return o&&o(T),T}};return x}function Ui(e){if(gi(e))return e=En(e),e.children=null,e}function Yr(e){if(!gi(e))return ou(e.type)&&e.children?au(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&Ae(n.default))return n.default()}}function Yn(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Yn(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function nr(e,t=!1,n){let s=[],o=0;for(let i=0;i<e.length;i++){let l=e[i];const r=n==null?l.key:String(n)+String(l.key!=null?l.key:i);l.type===ee?(l.patchFlag&128&&o++,s=s.concat(nr(l.children,t,r))):(t||l.type!==St)&&s.push(r!=null?En(l,{key:r}):l)}if(o>1)for(let i=0;i<s.length;i++)s[i].patchFlag=-2;return s}function Te(e,t){return Ae(e)?at({name:e.name},t,{setup:e}):e}function uu(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Zr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const No=new WeakMap;function Ds(e,t,n,s,o=!1){if(we(e)){e.forEach((k,w)=>Ds(k,t&&(we(t)?t[w]:t),n,s,o));return}if(us(s)&&!o){s.shapeFlag&512&&s.type.__asyncResolved&&s.component.subTree.component&&Ds(e,t,n,s.component.subTree);return}const i=s.shapeFlag&4?wi(s.component):s.el,l=o?null:i,{i:r,r:a}=e,c=t&&t.r,u=r.refs===Je?r.refs={}:r.refs,f=r.setupState,h=Ge(f),p=f===Je?Cc:k=>Zr(u,k)?!1:He(h,k),v=(k,w)=>!(w&&Zr(u,w));if(c!=null&&c!==a){if(Jr(t),st(c))u[c]=null,p(c)&&(f[c]=null);else if(ht(c)){const k=t;v(c,k.k)&&(c.value=null),k.k&&(u[k.k]=null)}}if(Ae(a))no(a,r,12,[l,u]);else{const k=st(a),w=ht(a);if(k||w){const S=()=>{if(e.f){const $=k?p(a)?f[a]:u[a]:v()||!e.k?a.value:u[e.k];if(o)we($)&&Wl($,i);else if(we($))$.includes(i)||$.push(i);else if(k)u[a]=[i],p(a)&&(f[a]=u[a]);else{const M=[i];v(a,e.k)&&(a.value=M),e.k&&(u[e.k]=M)}}else k?(u[a]=l,p(a)&&(f[a]=l)):w&&(v(a,e.k)&&(a.value=l),e.k&&(u[e.k]=l))};if(l){const $=()=>{S(),No.delete(e)};$.id=-1,No.set(e,$),It($,n)}else Jr(e),S()}}}function Jr(e){const t=No.get(e);t&&(t.flags|=8,No.delete(e))}fi().requestIdleCallback;fi().cancelIdleCallback;const us=e=>!!e.type.__asyncLoader,gi=e=>e.type.__isKeepAlive;function hp(e,t){du(e,"a",t)}function pp(e,t){du(e,"da",t)}function du(e,t,n=$t){const s=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(mi(t,s,n),n){let o=n.parent;for(;o&&o.parent;)gi(o.parent.vnode)&&gp(s,t,n,o),o=o.parent}}function gp(e,t,n,s){const o=mi(t,e,s,!0);vi(()=>{Wl(s[t],o)},n)}function mi(e,t,n=$t,s=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...l)=>{bn();const r=so(n),a=qt(t,n,e,l);return r(),kn(),a});return s?o.unshift(i):o.push(i),i}}const _n=e=>(t,n=$t)=>{(!qs||e==="sp")&&mi(e,(...s)=>t(...s),n)},mp=_n("bm"),ct=_n("m"),fu=_n("bu"),hu=_n("u"),Ct=_n("bum"),vi=_n("um"),vp=_n("sp"),yp=_n("rtg"),bp=_n("rtc");function kp(e,t=$t){mi("ec",e,t)}const pu="components";function wp(e,t){return mu(pu,e,!0,t)||e}const gu=Symbol.for("v-ndc");function _p(e){return st(e)?mu(pu,e,!1)||e:e||gu}function mu(e,t,n=!0,s=!1){const o=yt||$t;if(o){const i=o.type;{const r=ig(i,!1);if(r&&(r===t||r===Et(t)||r===ui(Et(t))))return i}const l=Xr(o[e]||i[e],t)||Xr(o.appContext[e],t);return!l&&s?i:l}}function Xr(e,t){return e&&(e[t]||e[Et(t)]||e[ui(Et(t))])}function Ee(e,t,n,s){let o;const i=n,l=we(e);if(l||st(e)){const r=l&&qn(e);let a=!1,c=!1;r&&(a=!Wt(e),c=wn(e),e=hi(e)),o=new Array(e.length);for(let u=0,f=e.length;u<f;u++)o[u]=t(a?c?ps(Zt(e[u])):Zt(e[u]):e[u],u,void 0,i)}else if(typeof e=="number"){o=new Array(e);for(let r=0;r<e;r++)o[r]=t(r+1,r,void 0,i)}else if(qe(e))if(e[Symbol.iterator])o=Array.from(e,(r,a)=>t(r,a,void 0,i));else{const r=Object.keys(e);o=new Array(r.length);for(let a=0,c=r.length;a<c;a++){const u=r[a];o[a]=t(e[u],u,a,i)}}else o=[];return o}function Co(e,t,n={},s,o,i){if(yt.ce||yt.parent&&us(yt.parent)&&yt.parent.ce){const c=n,u=Object.keys(c).length>0;return t!=="default"&&(c.name=t),g(),Xe(ee,null,[J("slot",c,s&&s())],u?-2:64)}let l=e[t];l&&l._c&&(l._d=!1);const r=yn.length;g();let a;try{const c=l&&vu(l(n)),u=n.key||i||c&&c.key;a=Xe(ee,{key:(u&&!Yt(u)?u:`_${t}`)+(!c&&s?"_fb":"")},c||(s?s():[]),c&&e._===1?64:-2)}catch(c){for(let u=yn.length;u>r;u--)lr();throw c}finally{l&&l._c&&(l._d=!0)}return a}function vu(e){return e.some(t=>Ws(t)?!(t.type===St||t.type===ee&&!vu(t.children)):!0)?e:null}const bl=e=>e?Du(e)?wi(e):bl(e.parent):null,Ns=at(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>bl(e.parent),$root:e=>bl(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>bu(e),$forceUpdate:e=>e.f||(e.f=()=>{er(e.update)}),$nextTick:e=>e.n||(e.n=ft.bind(e.proxy)),$watch:e=>rp.bind(e)}),Gi=(e,t)=>e!==Je&&!e.__isScriptSetup&&He(e,t),Sp={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:s,data:o,props:i,accessCache:l,type:r,appContext:a}=e;if(t[0]!=="$"){const h=l[t];if(h!==void 0)switch(h){case 1:return s[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(Gi(s,t))return l[t]=1,s[t];if(o!==Je&&He(o,t))return l[t]=2,o[t];if(He(i,t))return l[t]=3,i[t];if(n!==Je&&He(n,t))return l[t]=4,n[t];kl&&(l[t]=0)}}const c=Ns[t];let u,f;if(c)return t==="$attrs"&&_t(e.attrs,"get",""),c(e);if((u=r.__cssModules)&&(u=u[t]))return u;if(n!==Je&&He(n,t))return l[t]=4,n[t];if(f=a.config.globalProperties,He(f,t))return f[t]},set({_:e},t,n){const{data:s,setupState:o,ctx:i}=e;return Gi(o,t)?(o[t]=n,!0):s!==Je&&He(s,t)?(s[t]=n,!0):He(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:s,appContext:o,props:i,type:l}},r){let a;return!!(n[r]||e!==Je&&r[0]!=="$"&&He(e,r)||Gi(t,r)||He(i,r)||He(s,r)||He(Ns,r)||He(o.config.globalProperties,r)||(a=l.__cssModules)&&a[r])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:He(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Qr(e){return we(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let kl=!0;function $p(e){const t=bu(e),n=e.proxy,s=e.ctx;kl=!1,t.beforeCreate&&ea(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:l,watch:r,provide:a,inject:c,created:u,beforeMount:f,mounted:h,beforeUpdate:p,updated:v,activated:k,deactivated:w,beforeDestroy:S,beforeUnmount:$,destroyed:M,unmounted:P,render:Z,renderTracked:j,renderTriggered:C,errorCaptured:x,serverPrefetch:y,expose:T,inheritAttrs:O,components:I,directives:H,filters:L}=t;if(c&&xp(c,s,null),l)for(const ie in l){const _e=l[ie];Ae(_e)&&(s[ie]=_e.bind(n))}if(o){const ie=o.call(n,n);qe(ie)&&(e.data=An(ie))}if(kl=!0,i)for(const ie in i){const _e=i[ie],Se=Ae(_e)?_e.bind(n,n):Ae(_e.get)?_e.get.bind(n,n):Vt,je=!Ae(_e)&&Ae(_e.set)?_e.set.bind(n):Vt,Qe=q({get:Se,set:je});Object.defineProperty(s,ie,{enumerable:!0,configurable:!0,get:()=>Qe.value,set:ge=>Qe.value=ge})}if(r)for(const ie in r)yu(r[ie],s,n,ie);if(a){const ie=Ae(a)?a.call(n):a;Reflect.ownKeys(ie).forEach(_e=>{xo(_e,ie[_e])})}u&&ea(u,e,"c");function ne(ie,_e){we(_e)?_e.forEach(Se=>ie(Se.bind(n))):_e&&ie(_e.bind(n))}if(ne(mp,f),ne(ct,h),ne(fu,p),ne(hu,v),ne(hp,k),ne(pp,w),ne(kp,x),ne(bp,j),ne(yp,C),ne(Ct,$),ne(vi,P),ne(vp,y),we(T))if(T.length){const ie=e.exposed||(e.exposed={});T.forEach(_e=>{Object.defineProperty(ie,_e,{get:()=>n[_e],set:Se=>n[_e]=Se,enumerable:!0})})}else e.exposed||(e.exposed={});Z&&e.render===Vt&&(e.render=Z),O!=null&&(e.inheritAttrs=O),I&&(e.components=I),H&&(e.directives=H),y&&uu(e)}function xp(e,t,n=Vt){we(e)&&(e=wl(e));for(const s in e){const o=e[s];let i;qe(o)?"default"in o?i=vn(o.from||s,o.default,!0):i=vn(o.from||s):i=vn(o),ht(i)?Object.defineProperty(t,s,{enumerable:!0,configurable:!0,get:()=>i.value,set:l=>i.value=l}):t[s]=i}}function ea(e,t,n){qt(we(e)?e.map(s=>s.bind(t.proxy)):e.bind(t.proxy),t,n)}function yu(e,t,n,s){let o=s.includes(".")?nu(n,s):()=>n[s];if(st(e)){const i=t[e];Ae(i)&&Me(o,i)}else if(Ae(e))Me(o,e.bind(n));else if(qe(e))if(we(e))e.forEach(i=>yu(i,t,n,s));else{const i=Ae(e.handler)?e.handler.bind(n):t[e.handler];Ae(i)&&Me(o,i,e)}}function bu(e){const t=e.type,{mixins:n,extends:s}=t,{mixins:o,optionsCache:i,config:{optionMergeStrategies:l}}=e.appContext,r=i.get(t);let a;return r?a=r:!o.length&&!n&&!s?a=t:(a={},o.length&&o.forEach(c=>Bo(a,c,l,!0)),Bo(a,t,l)),qe(t)&&i.set(t,a),a}function Bo(e,t,n,s=!1){const{mixins:o,extends:i}=t;i&&Bo(e,i,n,!0),o&&o.forEach(l=>Bo(e,l,n,!0));for(const l in t)if(!(s&&l==="expose")){const r=Cp[l]||n&&n[l];e[l]=r?r(e[l],t[l]):t[l]}return e}const Cp={data:ta,props:na,emits:na,methods:As,computed:As,beforeCreate:Tt,created:Tt,beforeMount:Tt,mounted:Tt,beforeUpdate:Tt,updated:Tt,beforeDestroy:Tt,beforeUnmount:Tt,destroyed:Tt,unmounted:Tt,activated:Tt,deactivated:Tt,errorCaptured:Tt,serverPrefetch:Tt,components:As,directives:As,watch:Ip,provide:ta,inject:Tp};function ta(e,t){return t?e?function(){return at(Ae(e)?e.call(this,this):e,Ae(t)?t.call(this,this):t)}:t:e}function Tp(e,t){return As(wl(e),wl(t))}function wl(e){if(we(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Tt(e,t){return e?[...new Set([].concat(e,t))]:t}function As(e,t){return e?at(Object.create(null),e,t):t}function na(e,t){return e?we(e)&&we(t)?[...new Set([...e,...t])]:at(Object.create(null),Qr(e),Qr(t??{})):t}function Ip(e,t){if(!e)return t;if(!t)return e;const n=at(Object.create(null),e);for(const s in t)n[s]=Tt(e[s],t[s]);return n}function ku(){return{app:null,config:{isNativeTag:Cc,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Rp=0;function Ap(e,t){return function(s,o=null){Ae(s)||(s=at({},s)),o!=null&&!qe(o)&&(o=null);const i=ku(),l=new WeakSet,r=[];let a=!1;const c=i.app={_uid:Rp++,_component:s,_props:o,_container:null,_context:i,_instance:null,version:rg,get config(){return i.config},set config(u){},use(u,...f){return l.has(u)||(u&&Ae(u.install)?(l.add(u),u.install(c,...f)):Ae(u)&&(l.add(u),u(c,...f))),c},mixin(u){return i.mixins.includes(u)||i.mixins.push(u),c},component(u,f){return f?(i.components[u]=f,c):i.components[u]},directive(u,f){return f?(i.directives[u]=f,c):i.directives[u]},mount(u,f,h){if(!a){const p=c._ceVNode||J(s,o);return p.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),e(p,u,h),a=!0,c._container=u,u.__vue_app__=c,wi(p.component)}},onUnmount(u){r.push(u)},unmount(){a&&(qt(r,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(u,f){return i.provides[u]=f,c},runWithContext(u){const f=ds;ds=c;try{return u()}finally{ds=f}}};return c}}let ds=null;const Ep=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Et(t)}Modifiers`]||e[`${Mn(t)}Modifiers`];function Mp(e,t,...n){if(e.isUnmounted)return;const s=e.vnode.props||Je;let o=n;const i=t.startsWith("update:"),l=i&&Ep(s,t.slice(7));l&&(l.trim&&(o=n.map(u=>st(u)?u.trim():u)),l.number&&(o=n.map(di)));let r,a=s[r=Di(t)]||s[r=Di(Et(t))];!a&&i&&(a=s[r=Di(Mn(t))]),a&&qt(a,e,6,o);const c=s[r+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[r])return;e.emitted[r]=!0,qt(c,e,6,o)}}const Pp=new WeakMap;function wu(e,t,n=!1){const s=n?Pp:t.emitsCache,o=s.get(e);if(o!==void 0)return o;const i=e.emits;let l={},r=!1;if(!Ae(e)){const a=c=>{const u=wu(c,t,!0);u&&(r=!0,at(l,u))};!n&&t.mixins.length&&t.mixins.forEach(a),e.extends&&a(e.extends),e.mixins&&e.mixins.forEach(a)}return!i&&!r?(qe(e)&&s.set(e,null),null):(we(i)?i.forEach(a=>l[a]=null):at(l,i),qe(e)&&s.set(e,l),l)}function yi(e,t){return!e||!li(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),He(e,t[0].toLowerCase()+t.slice(1))||He(e,Mn(t))||He(e,t))}function sa(e){const{type:t,vnode:n,proxy:s,withProxy:o,propsOptions:[i],slots:l,attrs:r,emit:a,render:c,renderCache:u,props:f,data:h,setupState:p,ctx:v,inheritAttrs:k}=e,w=Do(e);let S,$;try{if(n.shapeFlag&4){const P=o||s,Z=P;S=ln(c.call(Z,P,u,f,p,h,v)),$=r}else{const P=t;S=ln(P.length>1?P(f,{attrs:r,slots:l,emit:a}):P(f,null)),$=t.props?r:Lp(r)}}catch(P){yn.length=0,pi(P,e,1),S=J(St)}let M=S;if($&&k!==!1){const P=Object.keys($),{shapeFlag:Z}=M;P.length&&Z&7&&(i&&P.some(ri)&&($=Op($,i)),M=En(M,$,!1,!0))}return n.dirs&&(M=En(M,null,!1,!0),M.dirs=M.dirs?M.dirs.concat(n.dirs):n.dirs),n.transition&&Yn(M,n.transition),S=M,Do(w),S}const Lp=e=>{let t;for(const n in e)(n==="class"||n==="style"||li(n))&&((t||(t={}))[n]=e[n]);return t},Op=(e,t)=>{const n={};for(const s in e)(!ri(s)||!(s.slice(9)in t))&&(n[s]=e[s]);return n};function Dp(e,t,n){const{props:s,children:o,component:i}=e,{props:l,children:r,patchFlag:a}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&a>=0){if(a&1024)return!0;if(a&16)return s?oa(s,l,c):!!l;if(a&8){const u=t.dynamicProps;for(let f=0;f<u.length;f++){const h=u[f];if(_u(l,s,h)&&!yi(c,h))return!0}}}else return(o||r)&&(!r||!r.$stable)?!0:s===l?!1:s?l?oa(s,l,c):!0:!!l;return!1}function oa(e,t,n){const s=Object.keys(t);if(s.length!==Object.keys(e).length)return!0;for(let o=0;o<s.length;o++){const i=s[o];if(_u(t,e,i)&&!yi(n,i))return!0}return!1}function _u(e,t,n){const s=e[n],o=t[n];return n==="style"&&qe(s)&&qe(o)?!to(s,o):s!==o}function Np({vnode:e,parent:t,suspense:n},s){for(;t;){const o=t.subTree;if(o.suspense&&o.suspense.activeBranch===e&&(o.suspense.vnode.el=o.el=s,e=o),o===e)(e=t.vnode).el=s,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=s)}const Su={},$u=()=>Object.create(Su),xu=e=>Object.getPrototypeOf(e)===Su;function Bp(e,t,n,s=!1){const o={},i=$u();e.propsDefaults=Object.create(null),Cu(e,t,o,i);for(const l in e.propsOptions[0])l in o||(o[l]=void 0);n?e.props=s?o:Kh(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function Fp(e,t,n,s){const{props:o,attrs:i,vnode:{patchFlag:l}}=e,r=Ge(o),[a]=e.propsOptions;let c=!1;if((s||l>0)&&!(l&16)){if(l&8){const u=e.vnode.dynamicProps;for(let f=0;f<u.length;f++){let h=u[f];if(yi(e.emitsOptions,h))continue;const p=t[h];if(a)if(He(i,h))p!==i[h]&&(i[h]=p,c=!0);else{const v=Et(h);o[v]=_l(a,r,v,p,e,!1)}else p!==i[h]&&(i[h]=p,c=!0)}}}else{Cu(e,t,o,i)&&(c=!0);let u;for(const f in r)(!t||!He(t,f)&&((u=Mn(f))===f||!He(t,u)))&&(a?n&&(n[f]!==void 0||n[u]!==void 0)&&(o[f]=_l(a,r,f,void 0,e,!0)):delete o[f]);if(i!==r)for(const f in i)(!t||!He(t,f))&&(delete i[f],c=!0)}c&&dn(e.attrs,"set","")}function Cu(e,t,n,s){const[o,i]=e.propsOptions;let l=!1,r;if(t)for(let a in t){if(Ps(a))continue;const c=t[a];let u;o&&He(o,u=Et(a))?!i||!i.includes(u)?n[u]=c:(r||(r={}))[u]=c:yi(e.emitsOptions,a)||(!(a in s)||c!==s[a])&&(s[a]=c,l=!0)}if(i){const a=Ge(n),c=r||Je;for(let u=0;u<i.length;u++){const f=i[u];n[f]=_l(o,a,f,c[f],e,!He(c,f))}}return l}function _l(e,t,n,s,o,i){const l=e[n];if(l!=null){const r=He(l,"default");if(r&&s===void 0){const a=l.default;if(l.type!==Function&&!l.skipFactory&&Ae(a)){const{propsDefaults:c}=o;if(n in c)s=c[n];else{const u=so(o);s=c[n]=a.call(null,t),u()}}else s=a;o.ce&&o.ce._setProp(n,s)}l[0]&&(i&&!r?s=!1:l[1]&&(s===""||s===Mn(n))&&(s=!0))}return s}const jp=new WeakMap;function Tu(e,t,n=!1){const s=n?jp:t.propsCache,o=s.get(e);if(o)return o;const i=e.props,l={},r=[];let a=!1;if(!Ae(e)){const u=f=>{a=!0;const[h,p]=Tu(f,t,!0);at(l,h),p&&r.push(...p)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!i&&!a)return qe(e)&&s.set(e,rs),rs;if(we(i))for(let u=0;u<i.length;u++){const f=Et(i[u]);ia(f)&&(l[f]=Je)}else if(i)for(const u in i){const f=Et(u);if(ia(f)){const h=i[u],p=l[f]=we(h)||Ae(h)?{type:h}:at({},h),v=p.type;let k=!1,w=!0;if(we(v))for(let S=0;S<v.length;++S){const $=v[S],M=Ae($)&&$.name;if(M==="Boolean"){k=!0;break}else M==="String"&&(w=!1)}else k=Ae(v)&&v.name==="Boolean";p[0]=k,p[1]=w,(k||He(p,"default"))&&r.push(f)}}const c=[l,r];return qe(e)&&s.set(e,c),c}function ia(e){return e[0]!=="$"&&!Ps(e)}const sr=e=>e==="_"||e==="_ctx"||e==="$stable",or=e=>we(e)?e.map(ln):[ln(e)],Up=(e,t,n)=>{if(t._n)return t;const s=Pt((...o)=>or(t(...o)),n);return s._c=!1,s},Iu=(e,t,n)=>{const s=e._ctx;for(const o in e){if(sr(o))continue;const i=e[o];if(Ae(i))t[o]=Up(o,i,s);else if(i!=null){const l=or(i);t[o]=()=>l}}},Ru=(e,t)=>{const n=or(t);e.slots.default=()=>n},Au=(e,t,n)=>{for(const s in t)(n||!sr(s))&&(e[s]=t[s])},Gp=(e,t,n)=>{const s=e.slots=$u();if(e.vnode.shapeFlag&32){const o=t._;o?(Au(s,t,n),n&&Ac(s,"_",o,!0)):Iu(t,s)}else t&&Ru(e,t)},zp=(e,t,n)=>{const{vnode:s,slots:o}=e;let i=!0,l=Je;if(s.shapeFlag&32){const r=t._;r?n&&r===1?i=!1:Au(o,t,n):(i=!t.$stable,Iu(t,o)),l=t}else t&&(Ru(e,t),l={default:1});if(i)for(const r in o)!sr(r)&&l[r]==null&&delete o[r]},It=Kp;function Hp(e){return Wp(e)}function Wp(e,t){const n=fi();n.__VUE__=!0;const{insert:s,remove:o,patchProp:i,createElement:l,createText:r,createComment:a,setText:c,setElementText:u,parentNode:f,nextSibling:h,setScopeId:p=Vt,insertStaticContent:v}=e,k=(_,E,G,Q=null,K=null,X=null,le=void 0,ce=null,A=!!E.dynamicChildren)=>{if(_===E)return;_&&!Un(_,E)&&(Q=V(_),ge(_,K,X,!0),_=null),E.patchFlag===-2&&(A=!1,E.dynamicChildren=null);const{type:N,ref:ue,shapeFlag:de}=E;switch(N){case bi:w(_,E,G,Q);break;case St:S(_,E,G,Q);break;case To:_==null&&$(E,G,Q,le);break;case ee:I(_,E,G,Q,K,X,le,ce,A);break;default:de&1?Z(_,E,G,Q,K,X,le,ce,A):de&6?H(_,E,G,Q,K,X,le,ce,A):(de&64||de&128)&&N.process(_,E,G,Q,K,X,le,ce,A,Ue)}ue!=null&&K?Ds(ue,_&&_.ref,X,E||_,!E):ue==null&&_&&_.ref!=null&&Ds(_.ref,null,X,_,!0)},w=(_,E,G,Q)=>{if(_==null)s(E.el=r(E.children),G,Q);else{const K=E.el=_.el;E.children!==_.children&&c(K,E.children)}},S=(_,E,G,Q)=>{_==null?s(E.el=a(E.children||""),G,Q):E.el=_.el},$=(_,E,G,Q)=>{[_.el,_.anchor]=v(_.children,E,G,Q,_.el,_.anchor)},M=({el:_,anchor:E},G,Q)=>{let K;for(;_&&_!==E;)K=h(_),s(_,G,Q),_=K;s(E,G,Q)},P=({el:_,anchor:E})=>{let G;for(;_&&_!==E;)G=h(_),o(_),_=G;o(E)},Z=(_,E,G,Q,K,X,le,ce,A)=>{if(E.type==="svg"?le="svg":E.type==="math"&&(le="mathml"),_==null)j(E,G,Q,K,X,le,ce,A);else{const N=_.el&&_.el._isVueCE?_.el:null;try{N&&N._beginPatch(),y(_,E,K,X,le,ce,A)}finally{N&&N._endPatch()}}},j=(_,E,G,Q,K,X,le,ce)=>{let A,N;const{props:ue,shapeFlag:de,transition:pe,dirs:be}=_;if(A=_.el=l(_.type,X,ue&&ue.is,ue),de&8?u(A,_.children):de&16&&x(_.children,A,null,Q,K,zi(_,X),le,ce),be&&On(_,null,Q,"created"),C(A,_,_.scopeId,le,Q),ue){for(const De in ue)De!=="value"&&!Ps(De)&&i(A,De,null,ue[De],X,Q);"value"in ue&&i(A,"value",null,ue.value,X),(N=ue.onVnodeBeforeMount)&&Xt(N,Q,_)}be&&On(_,null,Q,"beforeMount");const Le=qp(K,pe);Le&&pe.beforeEnter(A),s(A,E,G),((N=ue&&ue.onVnodeMounted)||Le||be)&&It(()=>{try{N&&Xt(N,Q,_),Le&&pe.enter(A),be&&On(_,null,Q,"mounted")}finally{}},K)},C=(_,E,G,Q,K)=>{if(G&&p(_,G),Q)for(let X=0;X<Q.length;X++)p(_,Q[X]);if(K){let X=K.subTree;if(E===X||Pu(X.type)&&(X.ssContent===E||X.ssFallback===E)){const le=K.vnode;C(_,le,le.scopeId,le.slotScopeIds,K.parent)}}},x=(_,E,G,Q,K,X,le,ce,A=0)=>{for(let N=A;N<_.length;N++){const ue=_[N]=ce?un(_[N]):ln(_[N]);k(null,ue,E,G,Q,K,X,le,ce)}},y=(_,E,G,Q,K,X,le)=>{const ce=E.el=_.el;let{patchFlag:A,dynamicChildren:N,dirs:ue}=E;A|=_.patchFlag&16;const de=_.props||Je,pe=E.props||Je;let be;if(G&&Dn(G,!1),(be=pe.onVnodeBeforeUpdate)&&Xt(be,G,E,_),ue&&On(E,_,G,"beforeUpdate"),G&&Dn(G,!0),N&&(!_.dynamicChildren||_.dynamicChildren.length!==N.length)&&(A=0,le=!1,N=null),(de.innerHTML&&pe.innerHTML==null||de.textContent&&pe.textContent==null)&&u(ce,""),N?T(_.dynamicChildren,N,ce,G,Q,zi(E,K),X):le||_e(_,E,ce,null,G,Q,zi(E,K),X,!1),A>0){if(A&16)O(ce,de,pe,G,K);else if(A&2&&de.class!==pe.class&&i(ce,"class",null,pe.class,K),A&4&&i(ce,"style",de.style,pe.style,K),A&8){const Le=E.dynamicProps;for(let De=0;De<Le.length;De++){const Ne=Le[De],Ke=de[Ne],ot=pe[Ne];(ot!==Ke||Ne==="value")&&i(ce,Ne,Ke,ot,K,G)}}A&1&&_.children!==E.children&&u(ce,E.children)}else!le&&N==null&&O(ce,de,pe,G,K);((be=pe.onVnodeUpdated)||ue)&&It(()=>{be&&Xt(be,G,E,_),ue&&On(E,_,G,"updated")},Q)},T=(_,E,G,Q,K,X,le)=>{for(let ce=0;ce<E.length;ce++){const A=_[ce],N=E[ce],ue=A.el&&(A.type===ee||!Un(A,N)||A.shapeFlag&198)?f(A.el):G;k(A,N,ue,null,Q,K,X,le,!0)}},O=(_,E,G,Q,K)=>{if(E!==G){if(E!==Je)for(const X in E)!Ps(X)&&!(X in G)&&i(_,X,E[X],null,K,Q);for(const X in G){if(Ps(X))continue;const le=G[X],ce=E[X];le!==ce&&X!=="value"&&i(_,X,ce,le,K,Q)}"value"in G&&i(_,"value",E.value,G.value,K)}},I=(_,E,G,Q,K,X,le,ce,A)=>{const N=E.el=_?_.el:r(""),ue=E.anchor=_?_.anchor:r("");let{patchFlag:de,dynamicChildren:pe,slotScopeIds:be}=E;be&&(ce=ce?ce.concat(be):be),_==null?(s(N,G,Q),s(ue,G,Q),x(E.children||[],G,ue,K,X,le,ce,A)):de>0&&de&64&&pe&&_.dynamicChildren&&_.dynamicChildren.length===pe.length?(T(_.dynamicChildren,pe,G,K,X,le,ce),(E.key!=null||K&&E===K.subTree)&&ir(_,E,!0)):_e(_,E,G,ue,K,X,le,ce,A)},H=(_,E,G,Q,K,X,le,ce,A)=>{E.slotScopeIds=ce,_==null?E.shapeFlag&512?K.ctx.activate(E,G,Q,le,A):L(E,G,Q,K,X,le,A):B(_,E,A)},L=(_,E,G,Q,K,X,le)=>{const ce=_.component=eg(_,Q,K);if(gi(_)&&(ce.ctx.renderer=Ue),tg(ce,!1,le),ce.asyncDep){if(K&&K.registerDep(ce,ne,le),!_.el){const A=ce.subTree=J(St);S(null,A,E,G),_.placeholder=A.el}}else ne(ce,_,E,G,K,X,le)},B=(_,E,G)=>{const Q=E.component=_.component;if(Dp(_,E,G))if(Q.asyncDep&&!Q.asyncResolved){ie(Q,E,G);return}else Q.next=E,Q.update();else E.el=_.el,Q.vnode=E},ne=(_,E,G,Q,K,X,le)=>{const ce=()=>{if(_.isMounted){let{next:de,bu:pe,u:be,parent:Le,vnode:De}=_;{const se=Eu(_);if(se){de&&(de.el=De.el,ie(_,de,le)),se.asyncDep.then(()=>{It(()=>{_.isUnmounted||N()},K)});return}}let Ne=de,Ke;Dn(_,!1),de?(de.el=De.el,ie(_,de,le)):de=De,pe&&$o(pe),(Ke=de.props&&de.props.onVnodeBeforeUpdate)&&Xt(Ke,Le,de,De),Dn(_,!0);const ot=sa(_),bt=_.subTree;_.subTree=ot,k(bt,ot,f(bt.el),V(bt),_,K,X),de.el=ot.el,Ne===null&&Np(_,ot.el),be&&It(be,K),(Ke=de.props&&de.props.onVnodeUpdated)&&It(()=>Xt(Ke,Le,de,De),K)}else{let de;const{el:pe,props:be}=E,{bm:Le,m:De,parent:Ne,root:Ke,type:ot}=_,bt=us(E);Dn(_,!1),Le&&$o(Le),!bt&&(de=be&&be.onVnodeBeforeMount)&&Xt(de,Ne,E),Dn(_,!0);{Ke.ce&&Ke.ce._hasShadowRoot()&&Ke.ce._injectChildStyle(ot,_.parent?_.parent.type:void 0);const se=_.subTree=sa(_);k(null,se,G,Q,_,K,X),E.el=se.el}if(De&&It(De,K),!bt&&(de=be&&be.onVnodeMounted)){const se=E;It(()=>Xt(de,Ne,se),K)}(E.shapeFlag&256||Ne&&us(Ne.vnode)&&Ne.vnode.shapeFlag&256)&&_.a&&It(_.a,K),_.isMounted=!0,E=G=Q=null}};_.scope.on();const A=_.effect=new Lc(ce);_.scope.off();const N=_.update=A.run.bind(A),ue=_.job=A.runIfDirty.bind(A);ue.i=_,ue.id=_.uid,A.scheduler=()=>er(ue),Dn(_,!0),N()},ie=(_,E,G)=>{E.component=_;const Q=_.vnode.props;_.vnode=E,_.next=null,Fp(_,E.props,Q,G),zp(_,E.children,G),bn(),qr(_),kn()},_e=(_,E,G,Q,K,X,le,ce,A=!1)=>{const N=_&&_.children,ue=_?_.shapeFlag:0,de=E.children,{patchFlag:pe,shapeFlag:be}=E;if(pe>0){if(pe&128){je(N,de,G,Q,K,X,le,ce,A);return}else if(pe&256){Se(N,de,G,Q,K,X,le,ce,A);return}}be&8?(ue&16&&ae(N,K,X),de!==N&&u(G,de)):ue&16?be&16?je(N,de,G,Q,K,X,le,ce,A):ae(N,K,X,!0):(ue&8&&u(G,""),be&16&&x(de,G,Q,K,X,le,ce,A))},Se=(_,E,G,Q,K,X,le,ce,A)=>{_=_||rs,E=E||rs;const N=_.length,ue=E.length,de=Math.min(N,ue);let pe;for(pe=0;pe<de;pe++){const be=E[pe]=A?un(E[pe]):ln(E[pe]);k(_[pe],be,G,null,K,X,le,ce,A)}N>ue?ae(_,K,X,!0,!1,de):x(E,G,Q,K,X,le,ce,A,de)},je=(_,E,G,Q,K,X,le,ce,A)=>{let N=0;const ue=E.length;let de=_.length-1,pe=ue-1;for(;N<=de&&N<=pe;){const be=_[N],Le=E[N]=A?un(E[N]):ln(E[N]);if(Un(be,Le))k(be,Le,G,null,K,X,le,ce,A);else break;N++}for(;N<=de&&N<=pe;){const be=_[de],Le=E[pe]=A?un(E[pe]):ln(E[pe]);if(Un(be,Le))k(be,Le,G,null,K,X,le,ce,A);else break;de--,pe--}if(N>de){if(N<=pe){const be=pe+1,Le=be<ue?E[be].el:Q;for(;N<=pe;)k(null,E[N]=A?un(E[N]):ln(E[N]),G,Le,K,X,le,ce,A),N++}}else if(N>pe)for(;N<=de;)ge(_[N],K,X,!0),N++;else{const be=N,Le=N,De=new Map;for(N=Le;N<=pe;N++){const Ye=E[N]=A?un(E[N]):ln(E[N]);Ye.key!=null&&De.set(Ye.key,N)}let Ne,Ke=0;const ot=pe-Le+1;let bt=!1,se=0;const ke=new Array(ot);for(N=0;N<ot;N++)ke[N]=0;for(N=be;N<=de;N++){const Ye=_[N];if(Ke>=ot){ge(Ye,K,X,!0);continue}let Bt;if(Ye.key!=null)Bt=De.get(Ye.key);else for(Ne=Le;Ne<=pe;Ne++)if(ke[Ne-Le]===0&&Un(Ye,E[Ne])){Bt=Ne;break}Bt===void 0?ge(Ye,K,X,!0):(ke[Bt-Le]=N+1,Bt>=se?se=Bt:bt=!0,k(Ye,E[Bt],G,null,K,X,le,ce,A),Ke++)}const Mt=bt?Vp(ke):rs;for(Ne=Mt.length-1,N=ot-1;N>=0;N--){const Ye=Le+N,Bt=E[Ye],Sn=E[Ye+1],ro=Ye+1<ue?Sn.el||Mu(Sn):Q;ke[N]===0?k(null,Bt,G,ro,K,X,le,ce,A):bt&&(Ne<0||N!==Mt[Ne]?Qe(Bt,G,ro,2):Ne--)}}},Qe=(_,E,G,Q,K=null)=>{const{el:X,type:le,transition:ce,children:A,shapeFlag:N}=_;if(N&6){Qe(_.component.subTree,E,G,Q);return}if(N&128){_.suspense.move(E,G,Q);return}if(N&64){le.move(_,E,G,Ue);return}if(le===ee){s(X,E,G);for(let de=0;de<A.length;de++)Qe(A[de],E,G,Q);s(_.anchor,E,G);return}if(le===To){M(_,E,G);return}if(Q!==2&&N&1&&ce)if(Q===0)ce.persisted&&!X[zt]?s(X,E,G):(ce.beforeEnter(X),s(X,E,G),It(()=>ce.enter(X),K));else{const{leave:de,delayLeave:pe,afterLeave:be}=ce,Le=()=>{_.ctx.isUnmounted?o(X):s(X,E,G)},De=()=>{const Ne=X._isLeaving||!!X[zt];X._isLeaving&&X[zt](!0),ce.persisted&&!Ne?Le():de(X,()=>{Le(),be&&be()})};pe?pe(X,Le,De):De()}else s(X,E,G)},ge=(_,E,G,Q=!1,K=!1)=>{const{type:X,props:le,ref:ce,children:A,dynamicChildren:N,shapeFlag:ue,patchFlag:de,dirs:pe,cacheIndex:be,memo:Le}=_;if(de===-2&&(K=!1),ce!=null&&(bn(),Ds(ce,null,G,_,!0),kn()),be!=null&&(E.renderCache[be]=void 0),ue&256){E.ctx.deactivate(_);return}const De=ue&1&&pe,Ne=!us(_);let Ke;if(Ne&&(Ke=le&&le.onVnodeBeforeUnmount)&&Xt(Ke,E,_),ue&6)Y(_.component,G,Q);else{if(ue&128){_.suspense.unmount(G,Q);return}De&&On(_,null,E,"beforeUnmount"),ue&64?_.type.remove(_,E,G,Ue,Q):N&&!N.hasOnce&&(X!==ee||de>0&&de&64)?ae(N,E,G,!1,!0):(X===ee&&de&384||!K&&ue&16)&&ae(A,E,G),Q&&he(_)}const ot=Le!=null&&be==null;(Ne&&(Ke=le&&le.onVnodeUnmounted)||De||ot)&&It(()=>{Ke&&Xt(Ke,E,_),De&&On(_,null,E,"unmounted"),ot&&(_.el=null)},G)},he=_=>{const{type:E,el:G,anchor:Q,transition:K}=_;if(E===ee){Fe(G,Q);return}if(E===To){P(_);return}const X=()=>{o(G),K&&!K.persisted&&K.afterLeave&&K.afterLeave()};if(_.shapeFlag&1&&K&&!K.persisted){const{leave:le,delayLeave:ce}=K,A=()=>le(G,X);ce?ce(_.el,X,A):A()}else X()},Fe=(_,E)=>{let G;for(;_!==E;)G=h(_),o(_),_=G;o(E)},Y=(_,E,G)=>{const{bum:Q,scope:K,job:X,subTree:le,um:ce,m:A,a:N}=_;la(A),la(N),Q&&$o(Q),K.stop(),X&&(X.flags|=8,ge(le,_,E,G)),ce&&It(ce,E),It(()=>{_.isUnmounted=!0},E)},ae=(_,E,G,Q=!1,K=!1,X=0)=>{for(let le=X;le<_.length;le++)ge(_[le],E,G,Q,K)},V=_=>{if(_.shapeFlag&6)return V(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const E=h(_.anchor||_.el),G=E&&E[su];return G?h(G):E};let ve=!1;const Oe=(_,E,G)=>{let Q;_==null?E._vnode&&(ge(E._vnode,null,null,!0),Q=E._vnode.component):k(E._vnode||null,_,E,null,null,null,G),E._vnode=_,ve||(ve=!0,qr(Q),Xc(),ve=!1)},Ue={p:k,um:ge,m:Qe,r:he,mt:L,mc:x,pc:_e,pbc:T,n:V,o:e};return{render:Oe,hydrate:void 0,createApp:Ap(Oe)}}function zi({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Dn({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function qp(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function ir(e,t,n=!1){const s=e.children,o=t.children;if(we(s)&&we(o))for(let i=0;i<s.length;i++){const l=s[i];let r=o[i];r.shapeFlag&1&&!r.dynamicChildren&&((r.patchFlag<=0||r.patchFlag===32)&&(r=o[i]=un(o[i]),r.el=l.el),!n&&r.patchFlag!==-2&&ir(l,r)),r.type===bi&&(r.patchFlag===-1&&(r=o[i]=un(r)),r.el=l.el),r.type===St&&!r.el&&(r.el=l.el)}}function Vp(e){const t=e.slice(),n=[0];let s,o,i,l,r;const a=e.length;for(s=0;s<a;s++){const c=e[s];if(c!==0){if(o=n[n.length-1],e[o]<c){t[s]=o,n.push(s);continue}for(i=0,l=n.length-1;i<l;)r=i+l>>1,e[n[r]]<c?i=r+1:l=r;c<e[n[i]]&&(i>0&&(t[s]=n[i-1]),n[i]=s)}}for(i=n.length,l=n[i-1];i-- >0;)n[i]=l,l=t[l];return n}function Eu(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Eu(t)}function la(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Mu(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Mu(t.subTree):null}const Pu=e=>e.__isSuspense;function Kp(e,t){t&&t.pendingBranch?we(e)?t.effects.push(...e):t.effects.push(e):Jc(e)}const ee=Symbol.for("v-fgt"),bi=Symbol.for("v-txt"),St=Symbol.for("v-cmt"),To=Symbol.for("v-stc"),yn=[];let Dt=null;function g(e=!1){yn.push(Dt=e?null:[])}function lr(){yn.pop(),Dt=yn[yn.length-1]||null}let Hs=1;function Fo(e,t=!1){Hs+=e,e<0&&Dt&&t&&(Dt.hasOnce=!0)}function Lu(e){return e.dynamicChildren=Hs>0?Dt||rs:null,lr(),Hs>0&&Dt&&Dt.push(e),e}function m(e,t,n,s,o,i){return Lu(d(e,t,n,s,o,i,!0))}function Xe(e,t,n,s,o){return Lu(J(e,t,n,s,o,!0))}function Ws(e){return e?e.__v_isVNode===!0:!1}function Un(e,t){return e.type===t.type&&e.key===t.key}const Ou=({key:e})=>e??null,Io=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?st(e)||ht(e)||Ae(e)?{i:yt,r:e,k:t,f:!!n}:e:null);function d(e,t=null,n=null,s=0,o=null,i=e===ee?0:1,l=!1,r=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ou(t),ref:t&&Io(t),scopeId:eu,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:s,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:yt};return r?(jo(a,n),i&128&&e.normalize(a)):n&&(a.shapeFlag|=st(n)?8:16),Hs>0&&!l&&Dt&&(a.patchFlag>0||i&6)&&a.patchFlag!==32&&Dt.push(a),a}const J=Yp;function Yp(e,t=null,n=null,s=0,o=null,i=!1){if((!e||e===gu)&&(e=St),Ws(e)){const r=En(e,t,!0);return n&&jo(r,n),Hs>0&&!i&&Dt&&(r.shapeFlag&6?Dt[Dt.indexOf(e)]=r:Dt.push(r)),r.patchFlag=-2,r}if(lg(e)&&(e=e.__vccOpts),t){t=Zp(t);let{class:r,style:a}=t;r&&!st(r)&&(t.class=fe(r)),qe(a)&&(Ql(a)&&!we(a)&&(a=at({},a)),t.style=Nt(a))}const l=st(e)?1:Pu(e)?128:ou(e)?64:qe(e)?4:Ae(e)?2:0;return d(e,t,n,s,o,l,i,!0)}function Zp(e){return e?Ql(e)||xu(e)?at({},e):e:null}function En(e,t,n=!1,s=!1){const{props:o,ref:i,patchFlag:l,children:r,transition:a}=e,c=t?Jp(o||{},t):o,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Ou(c),ref:t&&t.ref?n&&i?we(i)?i.concat(Io(t)):[i,Io(t)]:Io(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:r,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==ee?l===-1?16:l|16:l,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&En(e.ssContent),ssFallback:e.ssFallback&&En(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&s&&Yn(u,a.clone(u)),u}function Ce(e=" ",t=0){return J(bi,null,e,t)}function U(e="",t=!1){return t?(g(),Xe(St,null,e)):J(St,null,e)}function ln(e){return e==null||typeof e=="boolean"?J(St):we(e)?J(ee,null,e.slice()):Ws(e)?un(e):J(bi,null,String(e))}function un(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:En(e)}function jo(e,t){let n=0;const{shapeFlag:s}=e;if(t==null)t=null;else if(we(t))n=16;else if(typeof t=="object")if(s&65){const o=t.default;o&&(o._c&&(o._d=!1),jo(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!xu(t)?t._ctx=yt:o===3&&yt&&(yt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(Ae(t)){if(s&65){jo(e,{default:t});return}t={default:t,_ctx:yt},n=32}else t=String(t),s&64?(n=16,t=[Ce(t)]):n=8;e.children=t,e.shapeFlag|=n}function Jp(...e){const t={};for(let n=0;n<e.length;n++){const s=e[n];for(const o in s)if(o==="class")t.class!==s.class&&(t.class=fe([t.class,s.class]));else if(o==="style")t.style=Nt([t.style,s.style]);else if(li(o)){const i=t[o],l=s[o];l&&i!==l&&!(we(i)&&i.includes(l))?t[o]=i?[].concat(i,l):l:l==null&&i==null&&!ri(o)&&(t[o]=l)}else o!==""&&(t[o]=s[o])}return t}function Xt(e,t,n,s=null){qt(e,t,7,[n,s])}const Xp=ku();let Qp=0;function eg(e,t,n){const s=e.type,o=(t?t.appContext:e.appContext)||Xp,i={uid:Qp++,vnode:e,type:s,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Rh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(o.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Tu(s,o),emitsOptions:wu(s,o),emit:null,emitted:null,propsDefaults:Je,inheritAttrs:s.inheritAttrs,ctx:Je,data:Je,props:Je,attrs:Je,slots:Je,refs:Je,setupState:Je,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return i.ctx={_:i},i.root=t?t.root:i,i.emit=Mp.bind(null,i),e.ce&&e.ce(i),i}let $t=null;const ki=()=>$t||yt;let Uo,Sl;{const e=fi(),t=(n,s)=>{let o;return(o=e[n])||(o=e[n]=[]),o.push(s),i=>{o.length>1?o.forEach(l=>l(i)):o[0](i)}};Uo=t("__VUE_INSTANCE_SETTERS__",n=>$t=n),Sl=t("__VUE_SSR_SETTERS__",n=>qs=n)}const so=e=>{const t=$t;return Uo(e),e.scope.on(),()=>{e.scope.off(),Uo(t)}},ra=()=>{$t&&$t.scope.off(),Uo(null)};function Du(e){return e.vnode.shapeFlag&4}let qs=!1;function tg(e,t=!1,n=!1){t&&Sl(t);const{props:s,children:o}=e.vnode,i=Du(e);Bp(e,s,i,t),Gp(e,o,n||t);const l=i?ng(e,t):void 0;return t&&Sl(!1),l}function ng(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Sp);const{setup:s}=n;if(s){bn();const o=e.setupContext=s.length>1?og(e):null,i=so(e),l=no(s,e,0,[e.props,o]),r=Tc(l);if(kn(),i(),(r||e.sp)&&!us(e)&&uu(e),r){if(l.then(ra,ra),t)return l.then(a=>{aa(e,a)}).catch(a=>{pi(a,e,0)});e.asyncDep=l}else aa(e,l)}else Nu(e)}function aa(e,t,n){Ae(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:qe(t)&&(e.setupState=Kc(t)),Nu(e)}function Nu(e,t,n){const s=e.type;e.render||(e.render=s.render||Vt);{const o=so(e);bn();try{$p(e)}finally{kn(),o()}}}const sg={get(e,t){return _t(e,"get",""),e[t]}};function og(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,sg),slots:e.slots,emit:e.emit,expose:t}}function wi(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Kc(Yh(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ns)return Ns[n](e)},has(t,n){return n in t||n in Ns}})):e.proxy}function ig(e,t=!0){return Ae(e)?e.displayName||e.name:e.name||t&&e.__name}function lg(e){return Ae(e)&&"__vccOpts"in e}const q=(e,t)=>ep(e,t,qs);function ze(e,t,n){try{Fo(-1);const s=arguments.length;return s===2?qe(t)&&!we(t)?Ws(t)?J(e,null,[t]):J(e,t):J(e,null,t):(s>3?n=Array.prototype.slice.call(arguments,2):s===3&&Ws(n)&&(n=[n]),J(e,t,n))}finally{Fo(1)}}const rg="3.5.40";/**
|
|
14
|
-
* @vue/runtime-dom v3.5.40
|
|
15
|
-
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
16
|
-
* @license MIT
|
|
17
|
-
**/let $l;const ca=typeof window<"u"&&window.trustedTypes;if(ca)try{$l=ca.createPolicy("vue",{createHTML:e=>e})}catch{}const Bu=$l?e=>$l.createHTML(e):e=>e,ag="http://www.w3.org/2000/svg",cg="http://www.w3.org/1998/Math/MathML",cn=typeof document<"u"?document:null,ua=cn&&cn.createElement("template"),ug={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,s)=>{const o=t==="svg"?cn.createElementNS(ag,e):t==="mathml"?cn.createElementNS(cg,e):n?cn.createElement(e,{is:n}):cn.createElement(e);return e==="select"&&s&&s.multiple!=null&&o.setAttribute("multiple",s.multiple),o},createText:e=>cn.createTextNode(e),createComment:e=>cn.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>cn.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,s,o,i){const l=n?n.previousSibling:t.lastChild;if(o&&(o===i||o.nextSibling))for(;t.insertBefore(o.cloneNode(!0),n),!(o===i||!(o=o.nextSibling)););else{ua.innerHTML=Bu(s==="svg"?`<svg>${e}</svg>`:s==="mathml"?`<math>${e}</math>`:e);const r=ua.content;if(s==="svg"||s==="mathml"){const a=r.firstChild;for(;a.firstChild;)r.appendChild(a.firstChild);r.removeChild(a)}t.insertBefore(r,n)}return[l?l.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},$n="transition",Ss="animation",gs=Symbol("_vtc"),Fu={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},ju=at({},lu,Fu),dg=e=>(e.displayName="Transition",e.props=ju,e),_i=dg((e,{slots:t})=>ze(fp,Uu(e),t)),Nn=(e,t=[])=>{we(e)?e.forEach(n=>n(...t)):e&&e(...t)},da=e=>e?we(e)?e.some(t=>t.length>1):e.length>1:!1;function Uu(e){const t={};for(const I in e)I in Fu||(t[I]=e[I]);if(e.css===!1)return t;const{name:n="v",type:s,duration:o,enterFromClass:i=`${n}-enter-from`,enterActiveClass:l=`${n}-enter-active`,enterToClass:r=`${n}-enter-to`,appearFromClass:a=i,appearActiveClass:c=l,appearToClass:u=r,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:p=`${n}-leave-to`}=e,v=fg(o),k=v&&v[0],w=v&&v[1],{onBeforeEnter:S,onEnter:$,onEnterCancelled:M,onLeave:P,onLeaveCancelled:Z,onBeforeAppear:j=S,onAppear:C=$,onAppearCancelled:x=M}=t,y=(I,H,L,B)=>{I._enterCancelled=B,Cn(I,H?u:r),Cn(I,H?c:l),L&&L()},T=(I,H)=>{I._isLeaving=!1,Cn(I,f),Cn(I,p),Cn(I,h),H&&H()},O=I=>(H,L)=>{const B=I?C:$,ne=()=>y(H,I,L);Nn(B,[H,ne]),fa(()=>{Cn(H,I?a:i),Qt(H,I?u:r),da(B)||ha(H,s,k,ne)})};return at(t,{onBeforeEnter(I){Nn(S,[I]),Qt(I,i),Qt(I,l)},onBeforeAppear(I){Nn(j,[I]),Qt(I,a),Qt(I,c)},onEnter:O(!1),onAppear:O(!0),onLeave(I,H){I._isLeaving=!0;const L=()=>T(I,H);Qt(I,f),I._enterCancelled?(Qt(I,h),xl(I)):(xl(I),Qt(I,h)),fa(()=>{I._isLeaving&&(Cn(I,f),Qt(I,p),da(P)||ha(I,s,w,L))}),Nn(P,[I,L])},onEnterCancelled(I){y(I,!1,void 0,!0),Nn(M,[I])},onAppearCancelled(I){y(I,!0,void 0,!0),Nn(x,[I])},onLeaveCancelled(I){T(I),Nn(Z,[I])}})}function fg(e){if(e==null)return null;if(qe(e))return[Hi(e.enter),Hi(e.leave)];{const t=Hi(e);return[t,t]}}function Hi(e){return bh(e)}function Qt(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[gs]||(e[gs]=new Set)).add(t)}function Cn(e,t){t.split(/\s+/).forEach(s=>s&&e.classList.remove(s));const n=e[gs];n&&(n.delete(t),n.size||(e[gs]=void 0))}function fa(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let hg=0;function ha(e,t,n,s){const o=e._endId=++hg,i=()=>{o===e._endId&&s()};if(n!=null)return setTimeout(i,n);const{type:l,timeout:r,propCount:a}=Gu(e,t);if(!l)return s();const c=l+"end";let u=0;const f=()=>{e.removeEventListener(c,h),i()},h=p=>{p.target===e&&++u>=a&&f()};setTimeout(()=>{u<a&&f()},r+1),e.addEventListener(c,h)}function Gu(e,t){const n=window.getComputedStyle(e),s=v=>(n[v]||"").split(", "),o=s(`${$n}Delay`),i=s(`${$n}Duration`),l=pa(o,i),r=s(`${Ss}Delay`),a=s(`${Ss}Duration`),c=pa(r,a);let u=null,f=0,h=0;t===$n?l>0&&(u=$n,f=l,h=i.length):t===Ss?c>0&&(u=Ss,f=c,h=a.length):(f=Math.max(l,c),u=f>0?l>c?$n:Ss:null,h=u?u===$n?i.length:a.length:0);const p=u===$n&&/\b(?:transform|all)(?:,|$)/.test(s(`${$n}Property`).toString());return{type:u,timeout:f,propCount:h,hasTransform:p}}function pa(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,s)=>ga(n)+ga(e[s])))}function ga(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function xl(e){return(e?e.ownerDocument:document).body.offsetHeight}function pg(e,t,n){const s=e[gs];s&&(t=(t?[t,...s]:[...s]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Go=Symbol("_vod"),rr=Symbol("_vsh"),zu={name:"show",beforeMount(e,{value:t},{transition:n}){e[Go]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):$s(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:s}){!t!=!n&&(s?t?(s.beforeEnter(e),$s(e,!0),s.enter(e)):s.leave(e,()=>{$s(e,!1)}):$s(e,t))},beforeUnmount(e,{value:t}){$s(e,t)}};function $s(e,t){e.style.display=t?e[Go]:"none",e[rr]=!t}const Hu=Symbol("");function gg(e){const t=ki();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>zo(i,o))},s=()=>{const o=e(t.proxy);t.ce?zo(t.ce,o):Cl(t.subTree,o),n(o)};fu(()=>{Jc(s)}),ct(()=>{Me(s,Vt,{flush:"post"});const o=new MutationObserver(s);o.observe(t.subTree.el.parentNode,{childList:!0}),vi(()=>o.disconnect())})}function Cl(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{Cl(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)zo(e.el,t);else if(e.type===ee)e.children.forEach(n=>Cl(n,t));else if(e.type===To){let{el:n,anchor:s}=e;for(;n&&(zo(n,t),n!==s);)n=n.nextSibling}}function zo(e,t){if(e.nodeType===1){const n=e.style;let s="";for(const o in t){const i=Ih(t[o]);n.setProperty(`--${o}`,i),s+=`--${o}: ${i};`}n[Hu]=s}}const mg=/(?:^|;)\s*display\s*:/;function vg(e,t,n){const s=e.style,o=st(n);let i=!1;if(n&&!o){if(t)if(st(t))for(const l of t.split(";")){const r=l.slice(0,l.indexOf(":")).trim();n[r]==null&&Es(s,r,"")}else for(const l in t)n[l]==null&&Es(s,l,"");for(const l in n){l==="display"&&(i=!0);const r=n[l];r!=null?bg(e,l,!st(t)&&t?t[l]:void 0,r)||Es(s,l,r):Es(s,l,"")}}else if(o){if(t!==n){const l=s[Hu];l&&(n+=";"+l),s.cssText=n,i=mg.test(n)}}else t&&e.removeAttribute("style");Go in e&&(e[Go]=i?s.display:"",e[rr]&&(s.display="none"))}const ma=/\s*!important$/;function Es(e,t,n){if(we(n))n.forEach(s=>Es(e,t,s));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const s=yg(e,t);ma.test(n)?e.setProperty(Mn(s),n.replace(ma,""),"important"):e[s]=n}}const va=["Webkit","Moz","ms"],Wi={};function yg(e,t){const n=Wi[t];if(n)return n;let s=Et(t);if(s!=="filter"&&s in e)return Wi[t]=s;s=ui(s);for(let o=0;o<va.length;o++){const i=va[o]+s;if(i in e)return Wi[t]=i}return t}function bg(e,t,n,s){return e.tagName==="TEXTAREA"&&(t==="width"||t==="height")&&st(s)&&n===s}const ya="http://www.w3.org/1999/xlink";function ba(e,t,n,s,o,i=xh(t)){s&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(ya,t.slice(6,t.length)):e.setAttributeNS(ya,t,n):n==null||i&&!Ec(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Yt(n)?String(n):n)}function ka(e,t,n,s,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Bu(n):n);return}const i=e.tagName;if(t==="value"&&i!=="PROGRESS"&&!i.includes("-")){const r=i==="OPTION"?e.getAttribute("value")||"":e.value,a=n==null?e.type==="checkbox"?"on":"":String(n);(r!==a||!("_value"in e))&&(e.value=a),n==null&&e.removeAttribute(t),e._value=n;return}let l=!1;if(n===""||n==null){const r=typeof e[t];r==="boolean"?n=Ec(n):n==null&&r==="string"?(n="",l=!0):r==="number"&&(n=0,l=!0)}try{e[t]=n}catch{}l&&e.removeAttribute(o||t)}function Gn(e,t,n,s){e.addEventListener(t,n,s)}function kg(e,t,n,s){e.removeEventListener(t,n,s)}const wa=Symbol("_vei");function wg(e,t,n,s,o=null){const i=e[wa]||(e[wa]={}),l=i[t];if(s&&l)l.value=s;else{const[r,a]=$g(t);if(s){const c=i[t]=Tg(s,o);Gn(e,r,c,a)}else l&&(kg(e,r,l,a),i[t]=void 0)}}const _g=/(Once|Passive|Capture)$/,Sg=/^on:?(?:Once|Passive|Capture)$/;function $g(e){let t,n;for(;(n=e.match(_g))&&!Sg.test(e);)t||(t={}),e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===":"?e.slice(3):Mn(e.slice(2)),t]}let qi=0;const xg=Promise.resolve(),Cg=()=>qi||(xg.then(()=>qi=0),qi=Date.now());function Tg(e,t){const n=s=>{if(!s._vts)s._vts=Date.now();else if(s._vts<=n.attached)return;const o=n.value;if(we(o)){const i=s.stopImmediatePropagation;s.stopImmediatePropagation=()=>{i.call(s),s._stopped=!0};const l=o.slice(),r=[s];for(let a=0;a<l.length&&!s._stopped;a++){const c=l[a];c&&qt(c,t,5,r)}}else qt(o,t,5,[s])};return n.value=e,n.attached=Cg(),n}const _a=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Ig=(e,t,n,s,o,i)=>{const l=o==="svg";t==="class"?pg(e,s,l):t==="style"?vg(e,n,s):li(t)?ri(t)||wg(e,t,n,s,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):Rg(e,t,s,l))?(ka(e,t,s),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&ba(e,t,s,l,i,t!=="value")):e._isVueCE&&(Ag(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!st(s)))?ka(e,Et(t),s,i,t):(t==="true-value"?e._trueValue=s:t==="false-value"&&(e._falseValue=s),ba(e,t,s,l))};function Rg(e,t,n,s){if(s)return!!(t==="innerHTML"||t==="textContent"||t in e&&_a(t)&&Ae(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const o=e.tagName;if(o==="IMG"||o==="VIDEO"||o==="CANVAS"||o==="SOURCE")return!1}return _a(t)&&st(n)?!1:t in e}function Ag(e,t){const n=e._def.props;if(!n)return!1;const s=Et(t);return Array.isArray(n)?n.some(o=>Et(o)===s):Object.keys(n).some(o=>Et(o)===s)}const Wu=new WeakMap,qu=new WeakMap,Ho=Symbol("_moveCb"),Sa=Symbol("_enterCb"),Eg=e=>(delete e.props.mode,e),Mg=Eg({name:"TransitionGroup",props:at({},ju,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=ki(),s=iu();let o,i;return hu(()=>{if(!o.length)return;const l=e.moveClass||`${e.name||"v"}-move`;if(!Ng(o[0].el,n.vnode.el,l)){o=[];return}o.forEach(Lg),o.forEach(Og);const r=o.filter(Dg);xl(n.vnode.el),r.forEach(a=>{const c=a.el,u=c.style;Qt(c,l),u.transform=u.webkitTransform=u.transitionDuration="";const f=c[Ho]=h=>{h&&h.target!==c||(!h||h.propertyName.endsWith("transform"))&&(c.removeEventListener("transitionend",f),c[Ho]=null,Cn(c,l))};c.addEventListener("transitionend",f)}),o=[]}),()=>{const l=Ge(e),r=Uu(l);let a=l.tag||ee;if(o=[],i)for(let c=0;c<i.length;c++){const u=i[c];u.el&&u.el instanceof Element&&!u.el[rr]&&(o.push(u),Yn(u,zs(u,r,s,n)),Wu.set(u,Vu(u.el)))}i=t.default?nr(t.default()):[];for(let c=0;c<i.length;c++){const u=i[c];u.key!=null&&Yn(u,zs(u,r,s,n))}return J(a,null,i)}}}),Pg=Mg;function Lg(e){const t=e.el;t[Ho]&&t[Ho](),t[Sa]&&t[Sa]()}function Og(e){qu.set(e,Vu(e.el))}function Dg(e){const t=Wu.get(e),n=qu.get(e),s=t.left-n.left,o=t.top-n.top;if(s||o){const i=e.el,l=i.style,r=i.getBoundingClientRect();let a=1,c=1;return i.offsetWidth&&(a=r.width/i.offsetWidth),i.offsetHeight&&(c=r.height/i.offsetHeight),(!Number.isFinite(a)||a===0)&&(a=1),(!Number.isFinite(c)||c===0)&&(c=1),Math.abs(a-1)<.01&&(a=1),Math.abs(c-1)<.01&&(c=1),l.transform=l.webkitTransform=`translate(${s/a}px,${o/c}px)`,l.transitionDuration="0s",e}}function Vu(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function Ng(e,t,n){const s=e.cloneNode(),o=e[gs];o&&o.forEach(r=>{r.split(/\s+/).forEach(a=>a&&s.classList.remove(a))}),n.split(/\s+/).forEach(r=>r&&s.classList.add(r)),s.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(s);const{hasTransform:l}=Gu(s);return i.removeChild(s),l}const Wo=e=>{const t=e.props["onUpdate:modelValue"]||!1;return we(t)?n=>$o(t,n):t};function Bg(e){e.target.composing=!0}function $a(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const fs=Symbol("_assign");function xa(e,t,n){return t&&(e=e.trim()),n&&(e=di(e)),e}const ut={created(e,{modifiers:{lazy:t,trim:n,number:s}},o){e[fs]=Wo(o);const i=s||o.props&&o.props.type==="number";Gn(e,t?"change":"input",l=>{l.target.composing||e[fs](xa(e.value,n,i))}),(n||i)&&Gn(e,"change",()=>{e.value=xa(e.value,n,i)}),t||(Gn(e,"compositionstart",Bg),Gn(e,"compositionend",$a),Gn(e,"change",$a))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:s,trim:o,number:i}},l){if(e[fs]=Wo(l),e.composing)return;const r=(i||e.type==="number")&&!/^0\d/.test(e.value)?di(e.value):e.value,a=t??"";if(r===a)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(s&&t===n||o&&e.value.trim()===a)||(e.value=a)}},Ca={deep:!0,created(e,{value:t,modifiers:{number:n}},s){e._modelValue=t,Gn(e,"change",()=>{const o=Array.prototype.filter.call(e.options,i=>i.selected).map(i=>n?di(qo(i)):qo(i));e[fs](e.multiple?ai(e._modelValue)?new Set(o):o:o[0]),e._assigning=!0,ft(()=>{e._assigning=!1})}),e[fs]=Wo(s)},mounted(e,{value:t}){Ta(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[fs]=Wo(n)},updated(e,{value:t}){e._assigning||Ta(e,t)}};function Ta(e,t){const n=e.multiple,s=we(t);if(!(n&&!s&&!ai(t))){for(let o=0,i=e.options.length;o<i;o++){const l=e.options[o],r=qo(l);if(n)if(s){const a=typeof r;a==="string"||a==="number"?l.selected=t.some(c=>String(c)===String(r)):l.selected=Th(t,r)>-1}else l.selected=t.has(r);else if(to(qo(l),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function qo(e){return"_value"in e?e._value:e.value}const Fg=["ctrl","shift","alt","meta"],jg={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>Fg.some(n=>e[`${n}Key`]&&!t.includes(n))},rt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),s=t.join(".");return n[s]||(n[s]=((o,...i)=>{for(let l=0;l<t.length;l++){const r=jg[t[l]];if(r&&r(o,t))return}return e(o,...i)}))},Ug={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Vn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),s=t.join(".");return n[s]||(n[s]=(o=>{if(!("key"in o))return;const i=Mn(o.key);if(t.some(l=>l===i||Ug[l]===i))return e(o)}))},Gg=at({patchProp:Ig},ug);let Ia;function zg(){return Ia||(Ia=Hp(Gg))}const Hg=((...e)=>{const t=zg().createApp(...e),{mount:n}=t;return t.mount=s=>{const o=qg(s);if(!o)return;const i=t._component;!Ae(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const l=n(o,!1,Wg(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),l},t});function Wg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function qg(e){return st(e)?document.querySelector(e):e}function mo(e,t,n,s){return e===n&&t===s}function Vg(e){return e.currentSessionId===e.targetSessionId&&e.snapshot.sessionId===e.targetSessionId&&e.currentSessionGeneration===e.targetSessionGeneration&&e.currentConnectionGeneration===e.targetConnectionGeneration&&e.currentPromptGeneration===e.targetPromptGeneration&&e.currentLiveGeneration===e.targetLiveGeneration&&(e.currentEpoch===0||e.snapshot.epoch===e.currentEpoch)&&(e.snapshot.epoch!==e.currentEpoch||e.snapshot.seq>=e.currentSeq)}function Kg(e){return{objective:e.objective,completionCriterion:e.completionCriterion,replace:e.replace,budgets:e.budgets}}function Yg(e){return{objective:e.objective,budgets:e.budgets}}function Zg(e,t,n){return e!==0&&n.epoch!==e?"resync":n.seq<=t?"duplicate":"apply"}function Jg(e,t){return t.type==="goal.updated"?{...e,goal:t.snapshot}:t.type==="todo.updated"?{...e,todos:t.todos}:e}function Xg(e){const t=[],n=new Map;for(const s of e){const o=s.phase??null;let i=n.get(o);i===void 0&&(i=t.length,n.set(o,i),t.push({phase:o,items:[]})),t[i].items.push(s)}return t}const Vs=F([]);let Qg=0;function em(e,t="info",n=3500){const s=`toast_${++Qg}`;Vs.value=[...Vs.value,{id:s,type:t,message:e}],n>0&&window.setTimeout(()=>Ku(s),n)}function Ku(e){Vs.value=Vs.value.filter(t=>t.id!==e)}function ar(){return{toasts:Vs,showToast:em,removeToast:Ku}}function tm(e){let t=null;return{schedule:()=>{t===null&&(t=requestAnimationFrame(()=>{t=null,e()}))},flushNow:()=>{t!==null&&(cancelAnimationFrame(t),t=null),e()},dispose:()=>{t!==null&&(cancelAnimationFrame(t),t=null)}}}const Ks=new Map;function nm(e){Ks.set(e,Date.now())}function sm(e){return Ks.get(e)}function om(e){const t=Ks.get(e);return t!==void 0&&Ks.delete(e),t}function im(){Ks.clear()}function Vi(e){const t=e/1e3;return t<10?`${t.toFixed(1)}s`:t<60?`${Math.round(t)}s`:`${Math.floor(t/60)}m${String(Math.round(t%60)).padStart(2,"0")}s`}const Be="/api/v1",lm=2*3e4;function rm(){const{showToast:e}=ar(),t=F("connecting"),n=F([]),s=F(!1),o=F(void 0),i=F([]),l=F({busy:!1}),r=F(null),a=F([]),c=F(!1),u=F(null),f=F(!1),h=F(null),p=F(null),v=F(null),k=q(()=>l.value.busy||f.value),w=F([]),S=F(null),$=F(!1),M=q(()=>p.value!==null&&!$.value),P=F(null),Z=F([]),j=F(null),C=F([]),x=F([]),y=F(null),T=F([]),O=F(null),I=F([]),H=F(""),L=F(null),B=F(null),ne=F(!1);let ie=null,_e=null,Se=null,je=null,Qe=Date.now(),ge=0,he=0,Fe=0,Y=0,ae=0,V=0,ve=0,Oe=0,Ue=0,Pe=null,_=!1,E=null,G=!1,Q=!1;const K=new Map,X="scream-offline-prompt-queue";let le=[];try{const b=localStorage.getItem(X);if(b){const D=JSON.parse(b);Array.isArray(D)&&(le=D.filter(te=>typeof te=="string"))}}catch{le=[]}function ce(){try{localStorage.setItem(X,JSON.stringify(le.slice(0,20)))}catch{}}function A(){if(le.length===0)return;const b=le[0],D=`client_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,te=Ye();K.set(D,{messageId:te,connectionGeneration:ae,queueText:b}),V++,G=!1,f.value=!0,n.value.push({id:te,role:"user",content:b,clientMessageId:D,tools:[],ts:Date.now()}),Lr(b),Ne({type:"prompt",text:b,clientMessageId:D})}function N(){le.length>0&&le.shift(),ce(),A()}let ue=0,de=0,pe=null,be=0;function Le(){const D=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/v1/ws`;return S.value?`${D}?sessionId=${encodeURIComponent(S.value)}`:D}function De(b){t.value=b}function Ne(b){(ie==null?void 0:ie.readyState)===WebSocket.OPEN&&ie.send(JSON.stringify(b))}function Ke(){c.value=_||Pe!==null}function ot(){Ue++,Pe=null,_=!1,E=null,c.value=!1,u.value=null}function bt(b,D){if(b!==null&&typeof b=="object"){const te=b.message;if(typeof te=="string")return te}return D}function se(){Q||je!==null||(je=window.setTimeout(()=>{je=null;const b=E;E=null,ke(b??void 0)},250))}async function ke(b){const D=p.value;if(!D)return;const te=n.value.length===0?100:void 0,oe=Y,ye=ae,Re=V,et=ve;try{const nt=await fetch(`${Be}/sessions/${D}/snapshot${te?`?tail=${te}`:""}`);if(!nt.ok){b!==void 0&&(Pe==null?void 0:Pe.generation)===b&&(E=b,se());return}const Ft=await nt.json();if(!Vg({snapshot:Ft,targetSessionId:D,currentSessionId:p.value,targetSessionGeneration:oe,currentSessionGeneration:Y,targetConnectionGeneration:ye,currentConnectionGeneration:ae,targetPromptGeneration:Re,currentPromptGeneration:V,targetLiveGeneration:et,currentLiveGeneration:ve,currentEpoch:he,currentSeq:ge})){b!==void 0&&(E=b),se();return}Mt(Ft,b)}catch{b!==void 0&&(Pe==null?void 0:Pe.generation)===b&&(E=b,se())}}function Mt(b,D){var Ur;es="",Pn="",Ln.clear();const te=n.value.filter(jt=>jt.local),oe=K.keys().next().value,ye=oe?K.get(oe):void 0,Re=ye?n.value.find(jt=>jt.id===ye.messageId):void 0,et=!!(oe&&b.messages.some(jt=>jt.clientMessageId===oe)),nt=!!(ye&&!et&&ye.connectionGeneration<ae);nt&&Re&&(Re.isError=!0);const Ft=Re&&!et?[Re]:[];n.value=[...b.messages.map(jt=>({...jt,id:jt.id??Ye()})),...te,...Ft];for(let jt=n.value.length-1;jt>=0;jt--){const uo=(Ur=n.value[jt])==null?void 0:Ur.turnStats;if(uo&&typeof uo.turn=="number"&&uo.turn>0){ue=uo.turn;break}}i.value=b.pendingApprovals,l.value={...b.status,busy:b.busy},s.value=!!b.olderAvailable,o.value=b.oldestSeq,r.value=b.goal,a.value=b.todos,D!==void 0&&Pe!==null&&Pe.generation===D&&Ue===D&&(Pe=null,Ke()),(et||nt)&&(f.value=!1,G=!1,K.clear(),nt&&e("消息未送达,已恢复连接。","error")),ge=b.seq,he=b.epoch,v.value=b.workDir}function Ye(){return`msg_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function Bt(b){Sn();const D=Number.isFinite(b)&&b>=1e3&&b<=12e4?b:15e3;Qe=Date.now(),_e=window.setInterval(()=>{if(Date.now()-Qe>lm){ie==null||ie.close();return}Ne({type:"ping"})},D)}function Sn(){_e!==null&&(clearInterval(_e),_e=null)}function ro(){if(Q||Se!==null)return;De("reconnecting"),Fe++;const b=Math.min(1e3*2**Fe,3e4);Se=window.setTimeout(()=>{Se=null,Jt()},b)}function af(b){var D;switch(b.type){case"server_hello":{const te=b;p.value=te.sessionId,v.value=te.workDir,S.value=te.sessionId,$.value=te.active;const oe=he;he=te.epoch,Bt(te.heartbeat_ms),Ne({type:"client_hello",lastSeq:ge,epoch:oe}),oe!==0&&oe!==te.epoch&&(ge=0),De("connected"),Fe=0,A(),te.active?(ke(),ss(),ao()):yf(te.sessionId).then(ye=>{ye&&p.value===te.sessionId&&($.value=!0),ke(),ss(),ao()});break}case"event":{const te=Zg(he,ge,b);if(te==="resync"){he=b.epoch,ge=0,ke();break}if(te==="duplicate")break;ge=b.seq,he=b.epoch,ve++,uf(b.payload);break}case"user_message":{if(ve++,b.clientMessageId&&K.has(b.clientMessageId)){G=!0,((D=K.get(b.clientMessageId))==null?void 0:D.queueText)!==void 0&&N();break}n.value.push({id:Ye(),role:"user",content:b.text,clientMessageId:b.clientMessageId,tools:[],ts:Date.now()});break}case"approval_request":{ve++,i.value=[...i.value,{id:b.id,toolName:b.toolName,action:b.action,display:b.display}];break}case"approval_resolved":{ve++,i.value=i.value.filter(te=>te.id!==b.id);break}case"command_result":{const te=b.pendingMsgId?n.value.findIndex(oe=>oe.id===b.pendingMsgId):-1;if(te>=0){const oe=n.value[te];n.value[te]={...oe,content:b.message,isError:!b.ok,pending:!1}}else n.value.push({id:Ye(),role:"system",content:b.message,tools:[],isError:!b.ok,ts:Date.now(),local:!0});(b.command==="fork"||b.command==="title")&&ss(),b.ok&&b.command==="compact"&&ke();break}case"resync_required":{ge=0,ke();break}case"status":{ve++,l.value={...l.value,...b.status};break}case"error":{if(h.value=b.message,b.clientMessageId){const te=K.get(b.clientMessageId);if(te){K.delete(b.clientMessageId),f.value=!1,G=!1;const oe=n.value.find(ye=>ye.id===te.messageId);if(oe&&(oe.isError=!0),e(`消息未发送:${b.message}`,"error"),te.queueText!==void 0){const ye=le.indexOf(te.queueText);ye>=0&&(le.splice(ye,1),ce())}}}break}case"server_empty":{De("idle");break}}}let es="",Pn="";const Ln=new Map;let Mr=!1;function cf(){if(Mr)return;const b=ns();if(!b){es="",Pn="",Ln.clear();return}if(es&&(b.content+=es,es=""),Pn){const D=b.tools.find(te=>te.name==="thinking");D?D.output=(D.output??"")+Pn:b.tools.push({toolCallId:"thinking",name:"thinking",output:Pn}),Pn=""}if(Ln.size>0){for(const[D,te]of Ln){const oe=b.tools.find(ye=>ye.toolCallId===D);oe&&(oe.progress=te)}Ln.clear()}}const ts=tm(cf);function uf(b){var te;const D=Jg({goal:r.value,todos:a.value},b);switch(r.value=D.goal,a.value=D.todos,b.type==="goal.updated"&&Pe!==null&&Pe.generation===Ue&&(Pe=null,E=null,Ke()),b.type){case"turn.started":{G&&(f.value=!1,G=!1,K.clear()),ts.flushNow(),l.value={...l.value,busy:!0},ue+=1,de=Date.now(),pe=null,be=0,im(),n.value.push({id:Ye(),role:"assistant",content:"",tools:[],ts:Date.now(),model:l.value.model,turnStats:{turn:ue,step:0,status:"running",firstTokenMs:null,llmMs:0,toolMs:0,tokens:null,tokensPerSec:null}});break}case"assistant.delta":{pe===null&&(pe=Date.now()),es+=String(b.delta),ts.schedule();break}case"thinking.delta":{pe===null&&(pe=Date.now()),Pn+=String(b.delta),ts.schedule();break}case"tool.call.started":{const oe=ns();oe&&(oe.tools.push({toolCallId:String(b.toolCallId),name:String(b.name),args:b.args}),oe.turnStats&&(oe.turnStats.step+=1)),nm(String(b.toolCallId));break}case"tool.result":{Ln.delete(String(b.toolCallId));const oe=om(String(b.toolCallId));oe!==void 0&&(be+=Date.now()-oe);const ye=ns();if(ye){const Re=ye.tools.find(et=>et.toolCallId===b.toolCallId);Re&&(Re.output=String(b.output),Re.isError=!!b.isError,Re.progress=void 0,oe!==void 0&&(Re.durationMs=Date.now()-oe))}break}case"tool.progress":{Ln.set(String(b.toolCallId),String(b.message??b.output)),ts.schedule();break}case"turn.ended":{if(ts.flushNow(),l.value={...l.value,busy:!1},b.reason==="failed"){const nt=ns();nt&&(nt.isError=!0),h.value=bt(b.error,"Turn failed")}const oe=ns(),ye=Date.now()-de,Re=(te=l.value.usage)==null?void 0:te.currentTurn,et=Re?Re.inputOther+Re.output+Re.inputCacheRead+Re.inputCacheCreation:null;oe&&oe.turnStats&&(oe.turnStats.status="done",oe.turnStats.llmMs=ye,oe.turnStats.toolMs=be,oe.turnStats.firstTokenMs=pe!==null?pe-de:null,oe.turnStats.tokens=et,oe.turnStats.tokensPerSec=et!==null&&ye>0?Math.round(et/ye*1e3):null),ss(),ao();break}case"session.meta.updated":{const oe={};b.model!==void 0&&(oe.model=b.model),b.contextTokens!==void 0&&(oe.contextTokens=b.contextTokens),b.maxContextTokens!==void 0&&(oe.maxContextTokens=b.maxContextTokens),b.contextUsage!==void 0&&(oe.contextUsage=b.contextUsage),l.value={...l.value,...oe};break}case"agent.status.updated":{const oe={};if(b.model!==void 0&&(oe.model=b.model),b.thinkingLevel!==void 0&&(oe.thinkingLevel=b.thinkingLevel),b.contextTokens!==void 0&&(oe.contextTokens=b.contextTokens),b.maxContextTokens!==void 0&&(oe.maxContextTokens=b.maxContextTokens),b.contextUsage!==void 0&&(oe.contextUsage=b.contextUsage),b.usage!==void 0){oe.usage=b.usage;const ye=b.usage;if(ye!=null&&ye.currentTurn){const Re=ns(),et=ye.currentTurn.inputOther+ye.currentTurn.output+ye.currentTurn.inputCacheRead+ye.currentTurn.inputCacheCreation;Re!=null&&Re.turnStats&&Re.turnStats.status==="done"&&Re.turnStats.tokens===null&&(Re.turnStats.tokens=et,Re.turnStats.tokensPerSec=Re.turnStats.llmMs?Math.round(et/Re.turnStats.llmMs*1e3):null)}}l.value={...l.value,...oe};break}case"error":{h.value=bt(b.error,"Unknown error");break}}}function ns(){for(let b=n.value.length-1;b>=0;b--)if(n.value[b].role==="assistant")return n.value[b];return null}function df(){if(!Q){if(Se!==null&&(clearTimeout(Se),Se=null),ie!==null){try{ie.close()}catch{}ie=null}Fe=0,Jt()}}async function ff(){var te;const b=p.value,D=o.value;if(!b||D===void 0)return 0;try{const oe=await fetch(`${Be}/sessions/${b}/messages?before=${D}&tail=50`);if(!oe.ok)return 0;const ye=await oe.json();if(ye.messages.length===0)return 0;const Re=ye.messages.map(et=>({...et,id:et.id??Ye()}));return n.value=[...Re,...n.value],o.value=((te=Re[0])==null?void 0:te.seq)??D,s.value=ye.hasMore,Re.length}catch{return 0}}function Jt(){if(Q||ie&&(ie.readyState===WebSocket.CONNECTING||ie.readyState===WebSocket.OPEN))return;De("connecting"),h.value=null,ot(),ae++;const b=new WebSocket(Le());ie=b,b.onclose=D=>{if(ie===b&&(ie=null,Sn(),t.value!=="idle")){if(D.code===1008){Y++,ot(),p.value=null,S.value=null,$.value=!1,r.value=null,a.value=[],n.value=[],h.value=null,f.value=!1,K.clear(),De("idle");return}De("disconnected"),ro()}},b.onerror=()=>{ie===b&&De("reconnecting")},b.onmessage=D=>{if(ie!==b)return;Qe=Date.now();let te;try{te=JSON.parse(D.data)}catch{return}af(te)}}function hf(b){if(!b)return;if(t.value==="idle"){e("暂无会话,请先新建会话。","warning");return}if(t.value!=="connected"){le.push(b),ce(),e("连接已断开,消息已排队,重连后自动发送。","warning"),Jt();return}if(k.value)return;const D=`client_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,te=Ye();K.set(D,{messageId:te,connectionGeneration:ae}),V++,G=!1,f.value=!0,n.value.push({id:te,role:"user",content:b,clientMessageId:D,tools:[],ts:Date.now()}),Lr(b),Ne({type:"prompt",text:b,clientMessageId:D})}const Pr="scream-recent-prompts";let bs=[];try{const b=localStorage.getItem(Pr);if(b){const D=JSON.parse(b);Array.isArray(D)&&(bs=D.filter(te=>typeof te=="string"))}}catch{bs=[]}function Lr(b){const D=b.trim();if(D){bs=[D,...bs.filter(te=>te!==D)].slice(0,8);try{localStorage.setItem(Pr,JSON.stringify(bs))}catch{}}}function pf(){Ne({type:"abort"})}function gf(b,D){if(t.value==="idle"){e("暂无会话,请先新建会话。","warning");return}if(t.value!=="connected"){e("连接已断开,命令未发送。","error"),Jt();return}if(k.value&&b!=="btw"){e(`会话忙碌中,无法执行 /${b},请稍后再试。`,"warning");return}const te=["compact","plan","auto","yes","fork","title"];let oe=null;te.includes(b)&&(oe=Ye(),n.value.push({id:oe,role:"system",content:`正在执行 /${b}${D?` ${D}`:""}...`,tools:[],pending:!0,ts:Date.now(),local:!0})),Ne({type:"command",command:b,...D?{args:D}:{},...oe?{pendingMsgId:oe}:{}})}function mf(){n.value=[],i.value=[]}function Or(b){n.value.push({id:Ye(),role:"system",content:b,tools:[],ts:Date.now(),local:!0})}function vf(b,D,te,oe){if(t.value!=="connected"){e("连接已断开,审批结果未发送。","error"),Jt();return}i.value=i.value.filter(ye=>ye.id!==b),Ne({type:"approval_response",id:b,decision:D,...te?{feedback:te}:{},...oe?{scope:oe}:{}})}async function ss(){try{const b=await fetch(`${Be}/sessions`);if(!b.ok)return;w.value=await b.json()}catch{}}async function yf(b){const D=Y,te=ae;try{return(await fetch(`${Be}/sessions/${b}/activate`,{method:"POST"})).ok&&ae===te&&mo(p.value,Y,b,D)}catch{return!1}}async function ao(){try{const b=await fetch(`${Be}/git/status`);if(!b.ok)return;const D=await b.json();P.value=D.isRepo?D:null}catch{}}async function Dr(){try{const b=await fetch(`${Be}/models`);if(!b.ok)return;const D=await b.json();Z.value=D.models}catch{}}const Mi=F({});async function bf(){try{const b=await fetch(`${Be}/like`);if(!b.ok)return;Mi.value=await b.json()}catch{}}async function kf(b){try{return(await fetch(`${Be}/like`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)})).ok?(Mi.value=b,!0):!1}catch{return!1}}async function Nr(b,D,te){const oe=p.value;if(!oe)return;const ye=Y,Re=ae,et=++Oe;try{const nt=await fetch(`${Be}/sessions/${oe}/${b}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),Ft=await nt.json();if(p.value!==oe||Y!==ye||ae!==Re||Oe!==et)return;if(!nt.ok){e(Ft.message??`请求失败(HTTP ${nt.status})`,"error");return}Ft.status&&(l.value={...l.value,...Ft.status}),Or(te)}catch(nt){if(p.value!==oe||Y!==ye||ae!==Re||Oe!==et)return;e(`请求失败:${nt instanceof Error?nt.message:String(nt)}`,"error")}}async function wf(b){b!==l.value.model&&await Nr("model",{model:b},`已切换模型:${b}`)}async function _f(b){b!==l.value.thinkingLevel&&await Nr("thinking",{level:b},`思考强度已切换为 ${b}`)}async function co(b,D,te,oe){const ye=p.value;if(!ye)return u.value="暂无可操作的会话。",null;if(t.value!=="connected")return u.value="连接已断开,请等待重连后再试。",null;if(M.value)return u.value="当前会话已归档,无法修改 Goal。",null;if(_)return u.value="正在处理上一个请求,请稍候。",null;Pe!==null&&(Pe=null,Ke());const Re=Y,et=++Ue;_=!0,Ke(),u.value=null;try{const nt=await fetch(`${Be}/sessions/${ye}/goal${b}`,{method:D,headers:{"Content-Type":"application/json"},body:JSON.stringify(te)}),Ft=await nt.json().catch(()=>({}));return!mo(p.value,Y,ye,Re)||Ue!==et?null:nt.ok?(oe&&(Pe={generation:et},E=et),Ft):(u.value=typeof Ft.message=="string"?Ft.message:`请求失败(HTTP ${nt.status})`,null)}catch(nt){return mo(p.value,Y,ye,Re)&&Ue===et&&(u.value=`请求失败:${nt instanceof Error?nt.message:String(nt)}`),null}finally{mo(p.value,Y,ye,Re)&&Ue===et&&(_=!1,Ke())}}async function Sf(b){const D=await co("/refine","POST",{description:b},!1);return typeof(D==null?void 0:D.objective)=="string"?D.objective:null}async function $f(b){return await co("","POST",Kg(b),!0)===null?!1:(Pe!==null&&ke(Pe.generation),!0)}async function xf(b){return await co("","PATCH",Yg(b),!0)===null?!1:(Pe!==null&&ke(Pe.generation),!0)}async function Pi(b){return await co(b,"POST",{},!0)===null?!1:(Pe!==null&&ke(Pe.generation),!0)}function Cf(){return Pi("/pause")}function Tf(){return Pi("/resume")}function If(){return Pi("/cancel")}async function Rf(){try{const b=await fetch(`${Be}/sessions`,{method:"POST"});if(!b.ok){e(`新建会话失败(HTTP ${b.status})`,"error");return}const D=await b.json();w.value=[D,...w.value],await Li(D.sessionId)}catch(b){e(`新建会话失败:${b instanceof Error?b.message:String(b)}`,"error")}}async function Li(b){S.value===b&&t.value==="connected"||(S.value=b,p.value=b,Y++,ot(),ge=0,he=0,n.value=[],i.value=[],l.value={busy:!1},r.value=null,a.value=[],j.value=null,C.value=[],x.value=[],y.value=null,T.value=[],O.value=null,I.value=[],H.value="",$.value=!1,f.value=!1,G=!1,K.clear(),Se!==null&&(clearTimeout(Se),Se=null),je!==null&&(clearTimeout(je),je=null),ie&&(ie.onclose=null,ie.close(),ie=null),Sn(),Jt())}async function Af(b){try{const D=await fetch(`${Be}/sessions/${b}`,{method:"DELETE"});if(!D.ok){e(`删除会话失败(HTTP ${D.status})`,"error");return}if(w.value=w.value.filter(te=>te.sessionId!==b),S.value===b){const te=w.value[0];te?await Li(te.sessionId):(Y++,ot(),p.value=null,S.value=null,$.value=!1,ge=0,he=0,n.value=[],i.value=[],l.value={busy:!1},r.value=null,a.value=[],j.value=null,C.value=[],x.value=[],y.value=null,T.value=[],O.value=null,I.value=[],H.value="",f.value=!1,G=!1,K.clear(),ie&&(ie.onclose=null,ie.close(),ie=null),Sn(),De("idle"))}}catch(D){e(`删除会话失败:${D instanceof Error?D.message:String(D)}`,"error")}}async function Ef(b){try{const D=await fetch(`${Be}/sessions/${b}/export`);if(!D.ok){e(`导出会话失败(HTTP ${D.status})`,"error");return}const te=await D.blob(),oe=URL.createObjectURL(te),ye=document.createElement("a");ye.href=oe,ye.download=`${b}.md`,ye.click(),URL.revokeObjectURL(oe)}catch(D){e(`导出会话失败:${D instanceof Error?D.message:String(D)}`,"error")}}async function ks(){const b=p.value;if(b)try{const D=await fetch(`${Be}/sessions/${b}/status`);if(!D.ok)return;const te=await D.json();l.value={...l.value,...te}}catch{}}async function Mf(){const b=p.value;if(b)try{const D=await fetch(`${Be}/sessions/${b}/usage`);if(!D.ok)return;const te=await D.json();l.value={...l.value,usage:te}}catch{}}async function Pf(){const b=p.value;if(b)try{const D=await fetch(`${Be}/sessions/${b}/context`);if(!D.ok)return;const te=await D.json();te.tokenCount!==void 0&&(l.value={...l.value,contextTokens:te.tokenCount})}catch{}}async function Lf(){const b=p.value;if(b)try{const D=await fetch(`${Be}/sessions/${b}/plan`);if(!D.ok)return;j.value=await D.json()}catch{}}async function Of(){const b=p.value;if(!b)return!1;try{return(await fetch(`${Be}/sessions/${b}/plan/clear`,{method:"POST"})).ok?(j.value=null,!0):!1}catch{return!1}}async function kt(b,D){const te=p.value;if(!te)return!1;if(t.value!=="connected")return e("连接已断开,操作未发送。","error"),Jt(),!1;try{const oe=await fetch(`${Be}/sessions/${te}/${b}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D??{})});if(!oe.ok){const ye=await oe.json().catch(()=>({}));return e(ye.message??`操作失败(HTTP ${oe.status})`,"error"),!1}return!0}catch(oe){return e(`操作失败:${oe instanceof Error?oe.message:String(oe)}`,"error"),!1}}async function Df(b){const D=await kt("permission",{mode:b});return D&&await ks(),D}async function Nf(b,D){const te=await kt("plan",{enabled:b,...D?{strategy:D}:{}});return te&&await ks(),te}async function Bf(b){const D=await kt("wolfpack",{enabled:b});return D&&await ks(),D}async function Ff(b,D){const te=await kt("rlm",{enabled:b,...D!==void 0?{maxDepth:D}:{}});return te&&await ks(),te}async function jf(b=1){return kt("undo",{count:b})}async function Uf(b){return kt("compact",b?{instruction:b}:{})}async function Gf(){const b=p.value;if(b)try{const D=await fetch(`${Be}/sessions/${b}/skills`);if(!D.ok)return;C.value=await D.json()}catch{}}async function zf(b,D){return kt(`skills/${encodeURIComponent(b)}/activate`,D?{args:D}:{})}async function Hf(b){const D=p.value;if(!D)return!1;try{return(await fetch(`${Be}/sessions/${D}/skills/${encodeURIComponent(b)}`,{method:"DELETE"})).ok?(C.value=C.value.filter(oe=>oe.name!==b),!0):!1}catch{return!1}}async function Oi(){const b=p.value;if(b)try{const D=await fetch(`${Be}/sessions/${b}/plugins`);if(!D.ok)return;x.value=await D.json()}catch{}}async function Wf(b){const D=p.value;if(D)try{const te=await fetch(`${Be}/sessions/${D}/plugins/${encodeURIComponent(b)}`);if(!te.ok)return;y.value=await te.json()}catch{}}async function qf(b){const D=p.value;if(!D)return null;try{const te=await fetch(`${Be}/sessions/${D}/plugins/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:b})});if(!te.ok)return null;const oe=await te.json();return await Oi(),oe}catch{return null}}async function Vf(b,D){return kt(`plugins/${encodeURIComponent(b)}/enable`,{enabled:D})}async function Kf(b,D,te){return kt(`plugins/${encodeURIComponent(b)}/mcp/${encodeURIComponent(D)}/enable`,{enabled:te})}async function Yf(b){const D=p.value;if(!D)return!1;try{return(await fetch(`${Be}/sessions/${D}/plugins/${encodeURIComponent(b)}`,{method:"DELETE"})).ok?(x.value=x.value.filter(oe=>oe.id!==b),!0):!1}catch{return!1}}async function Zf(){const b=p.value;if(!b)return null;try{const D=await fetch(`${Be}/sessions/${b}/plugins/reload`,{method:"POST"});if(!D.ok)return null;const te=await D.json();return await Oi(),te}catch{return null}}async function Jf(b){return kt(`plugins/${encodeURIComponent(b)}/activate`)}async function Xf(b){return kt(`plugins/${encodeURIComponent(b)}/deactivate`)}async function Qf(b){return kt(`plugins/${encodeURIComponent(b)}/inject`)}async function eh(){const b=p.value;if(b)try{const D=await fetch(`${Be}/sessions/${b}/mcp`);if(!D.ok)return;T.value=await D.json()}catch{}}async function th(){const b=p.value;if(b)try{const D=await fetch(`${Be}/sessions/${b}/mcp/startup-metrics`);if(!D.ok)return;O.value=await D.json()}catch{}}async function nh(b,D){return kt("mcp/add",{name:b,config:D})}async function sh(b){return kt(`mcp/${encodeURIComponent(b)}/reconnect`)}async function oh(b){return kt(`mcp/${encodeURIComponent(b)}/stop`)}async function ih(b){const D=p.value;if(!D)return!1;try{return(await fetch(`${Be}/sessions/${D}/mcp/${encodeURIComponent(b)}`,{method:"DELETE"})).ok?(T.value=T.value.filter(oe=>oe.name!==b),!0):!1}catch{return!1}}async function lh(b,D){const te=p.value;if(te)try{const oe=new URLSearchParams;b!==void 0&&oe.set("activeOnly",String(b)),D!==void 0&&oe.set("limit",String(D));const ye=oe.toString(),Re=await fetch(`${Be}/sessions/${te}/tasks${ye?`?${ye}`:""}`);if(!Re.ok)return;I.value=await Re.json()}catch{}}async function rh(b,D){const te=p.value;if(te)try{const oe=D!==void 0?`?tail=${D}`:"",ye=await fetch(`${Be}/sessions/${te}/tasks/${encodeURIComponent(b)}/output${oe}`);if(!ye.ok)return;const Re=await ye.json();H.value=Re.output}catch{}}async function ah(b,D){return kt(`tasks/${encodeURIComponent(b)}/stop`,D?{reason:D}:{})}async function Br(){try{const b=await fetch(`${Be}/config`);if(!b.ok)return;L.value=await b.json()}catch{}}async function ch(b){try{const D=await fetch(`${Be}/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({patch:b})});return D.ok?(L.value=await D.json(),!0):!1}catch{return!1}}async function uh(b){try{return(await fetch(`${Be}/config/providers/${encodeURIComponent(b)}`,{method:"DELETE"})).ok?(await Br(),!0):!1}catch{return!1}}async function dh(){try{const b=await fetch(`${Be}/experimental-flags`);if(!b.ok)return;B.value=await b.json()}catch{}}async function fh(){try{if(!(await fetch(`${Be}/preflight`)).ok)return;ne.value=!0}catch{}}Jt(),ss(),Dr();const Fr=()=>{Jt()},jr=()=>{!document.hidden&&t.value!=="connected"&&Jt()};return window.addEventListener("online",Fr),document.addEventListener("visibilitychange",jr),Ct(()=>{Q=!0,Mr=!0,ts.dispose(),window.removeEventListener("online",Fr),document.removeEventListener("visibilitychange",jr),Sn(),Se!==null&&(clearTimeout(Se),Se=null),je!==null&&(clearTimeout(je),je=null),ie&&(ie.onclose=null,ie.close(),ie=null)}),{connectionStatus:t,messages:n,pendingApprovals:i,status:l,goal:r,todos:a,goalRequestPending:c,goalRequestError:u,error:h,sessionId:p,workDir:v,isBusy:k,isArchived:M,sessions:w,currentSessionId:S,gitStatus:P,models:Z,like:Mi,fetchLike:bf,updateLike:kf,sendPrompt:hf,sendCommand:gf,clearMessages:mf,appendSystemMessage:Or,abort:pf,resolveApproval:vf,fetchSessions:ss,fetchGitStatus:ao,fetchModels:Dr,reconnectNow:df,olderAvailable:s,oldestSeq:o,loadOlderMessages:ff,switchModel:wf,switchThinking:_f,refineGoal:Sf,createGoal:$f,updateGoal:xf,pauseGoal:Cf,resumeGoal:Tf,cancelGoal:If,createSession:Rf,switchSession:Li,deleteSession:Af,exportSession:Ef,fetchSnapshot:ke,fetchSessionStatus:ks,fetchSessionUsage:Mf,fetchSessionContext:Pf,fetchSessionPlan:Lf,sessionPlan:j,clearPlan:Of,switchPermission:Df,switchPlanMode:Nf,switchWolfpack:Bf,switchRlm:Ff,undoHistory:jf,compact:Uf,skills:C,fetchSkills:Gf,activateSkill:zf,removeSkill:Hf,plugins:x,pluginInfo:y,fetchPlugins:Oi,fetchPluginInfo:Wf,installPlugin:qf,setPluginEnabled:Vf,setPluginMcpServerEnabled:Kf,removePlugin:Yf,reloadPlugins:Zf,activatePlugin:Jf,deactivatePlugin:Xf,injectPlugin:Qf,mcpServers:T,mcpStartupMetrics:O,fetchMcpServers:eh,fetchMcpStartupMetrics:th,addMcpServer:nh,reconnectMcpServer:sh,stopMcpServer:oh,removeMcpServer:ih,backgroundTasks:I,backgroundTaskOutput:H,fetchBackgroundTasks:lh,fetchBackgroundTaskOutput:rh,stopBackgroundTask:ah,config:L,fetchConfig:Br,setConfig:ch,removeProvider:uh,experimentalFlags:B,fetchExperimentalFlags:dh,preflightOk:ne,preflight:fh}}const Si=[{name:"compact",description:"压缩会话上下文",target:"backend"},{name:"model",description:"切换模型 / 思考强度",target:"local"},{name:"clear",description:"清空本地消息列表",target:"local"},{name:"new",description:"新建会话",target:"local"},{name:"help",description:"显示可用命令",target:"local"},{name:"auto",description:"切换为 auto 权限模式",target:"backend"},{name:"yes",description:"切换为 yolo 权限模式",target:"backend",aliases:["yolo"]},{name:"bot",description:"切换为 Bot 无人值守模式",target:"backend"},{name:"plan",description:"切换计划模式",target:"backend"},{name:"fork",description:"复制当前会话为新分支",target:"backend"},{name:"title",description:"重命名当前会话",target:"backend",aliases:["rename"],acceptsInput:!0},{name:"status",description:"查看会话状态",target:"local"},{name:"usage",description:"查看 Token 用量",target:"local"},{name:"btw",description:"快速侧问(不打断当前回合)",target:"backend",acceptsInput:!0}];function am(e){const t=e.toLowerCase();return Si.filter(n=>{var s;return n.name.startsWith(t)||((s=n.aliases)==null?void 0:s.some(o=>o.startsWith(t)))})}function cm(e){const t=e.toLowerCase(),n=Si.find(s=>{var o;return s.name===t||((o=s.aliases)==null?void 0:o.includes(t))});return(n==null?void 0:n.name)??t}function Yu(){return["可用命令:",...Si.map(t=>{var s;return`${(s=t.aliases)!=null&&s.length?[t.name,...t.aliases].map(o=>`/${o}`).join(", "):`/${t.name}`} - ${t.description}`})].join(`
|
|
18
|
-
`)}const um=640,cr=960,Ra=480,Aa=300,Ea=1200,dm=320,Zu=420;function Ju(e,t,n){const s=Number.isFinite(e)?e:t,o=Math.max(t,n);return Math.round(Math.max(t,Math.min(o,s)))}function Ma(e){return Ju(e*.42,360,640)}function Pa(e){const{viewportWidth:t,rightPanelOpen:n,rightPanelWidth:s}=e;if(t<=um)return Ra;const o=t<cr,i=o?dm:Zu,l=!o&&n?s:0;return Math.min(Ra,t-i-l)}function fm(e){const{viewportWidth:t,sidebarOpen:n,sidebarWidth:s}=e;if(t<cr)return Ea;const o=n?s:0;return Math.min(Ea,t-Zu-o)}function hm(e,t){return(e==null?void 0:e.displayMode)??t??"source"}function pm(e,t){const n=e.find(i=>i.id===t.tabId);if(!n)return[...e,{id:t.tabId,label:t.fileName,filePath:t.filePath,sourceSessionId:t.sourceSessionId,initialDisplayMode:t.modeHint,viewerState:t.modeHint?{displayMode:t.modeHint,wrapLines:!1,scrollTop:0,scrollLeft:0}:void 0,viewerRevision:0}];const s=!!(t.sourceSessionId&&n.sourceSessionId!==t.sourceSessionId);return!s&&!t.modeHint?e:e.map(i=>{var r;if(i.id!==t.tabId)return i;const l={...i};return s&&(l.sourceSessionId=t.sourceSessionId),t.modeHint?(l.initialDisplayMode=t.modeHint,l.viewerState={displayMode:t.modeHint,wrapLines:((r=i.viewerState)==null?void 0:r.wrapLines)??!1,scrollTop:0,scrollLeft:0},l.viewerRevision=(i.viewerRevision??0)+1):s&&(l.viewerRevision=(i.viewerRevision??0)+1),l})}function gm(e,t,n,s){const o=e.findIndex(l=>l.id===t);if(o===-1||(e[o].viewerRevision??0)!==n)return e;const i=[...e];return i[o]={...i[o],viewerState:s},i}const Xu="scream-file-tabs";function mm(){try{const e=localStorage.getItem(Xu);return e?JSON.parse(e):{}}catch{return{}}}function $i(e){try{localStorage.setItem(Xu,JSON.stringify(e))}catch{}}const Ys=mm(),Ki=Array.isArray(Ys.tabs)?Ys.tabs:[],La=typeof Ys.activeTabId=="string"?Ys.activeTabId:null;var xc;const $e=An({tabs:Ki,activeTabId:Ki.some(e=>e.id===La)?La:((xc=Ki.at(-1))==null?void 0:xc.id)??null,panelOpen:Ys.panelOpen===!0});function vm(){var e;if($e.tabs.length===0){$e.activeTabId=null;return}$e.tabs.some(t=>t.id===$e.activeTabId)||($e.activeTabId=((e=$e.tabs.at(-1))==null?void 0:e.id)??null)}function Zn(e,t={}){const n=e.split("/").pop()||e,s=e;return $e.tabs=pm($e.tabs,{fileName:t.label??n,filePath:e,modeHint:t.modeHint,sourceSessionId:t.sessionId??null,tabId:s}),$e.activeTabId=s,$e.panelOpen=!0,$i($e),s}function ym(e){$e.tabs.some(t=>t.id===e)&&($e.activeTabId=e,$i($e))}function Oa(e){const t=$e.tabs.findIndex(n=>n.id===e);if(t!==-1){if($e.tabs=$e.tabs.filter(n=>n.id!==e),$e.activeTabId===e){const n=$e.tabs[t]??$e.tabs[t-1]??null;$e.activeTabId=n?n.id:null}$e.tabs.length===0&&($e.panelOpen=!1,$e.activeTabId=null),$i($e)}}function Qu(e){$e.panelOpen=e,e&&vm(),$i($e)}function Da(){Qu(!$e.panelOpen)}const bm=()=>$e.tabs.find(e=>e.id===$e.activeTabId),km=["type","disabled"],wm=Te({__name:"Button",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean},type:{default:"button"}},setup(e){return(t,n)=>(g(),m("button",{class:fe(["ui-btn",[`ui-btn--${e.variant}`,`ui-btn--${e.size}`]]),type:e.type,disabled:e.disabled},[Co(t.$slots,"default",{},void 0)],10,km))}}),Ie=(e,t)=>{const n=e.__vccOpts||e;for(const[s,o]of t)n[s]=o;return n},zn=Ie(wm,[["__scopeId","data-v-746fbd2d"]]),_m={key:0,class:"approval-card"},Sm={class:"approval-header"},$m={class:"approval-title"},xm={class:"tool-name"},Cm={class:"action-summary"},Tm={key:0,class:"approval-count"},Im={class:"approval-action"},Rm={key:0,class:"feedback-area"},Am={class:"approval-buttons"},Em={key:0,class:"busy-indicator","aria-label":"处理中"},Mm=Te({__name:"ApprovalCard",props:{approvals:{}},emits:["resolve"],setup(e,{emit:t}){const n=e,s=t,o=F(!1),i=F(!1),l=F(""),r=F(new Set),a=q(()=>n.approvals[0]);Me(()=>n.approvals.map(v=>v.id).join(","),()=>{i.value=!1,l.value="";const v=new Set(n.approvals.map(k=>k.id));r.value=new Set([...r.value].filter(k=>v.has(k)))});function c(v){return typeof v.display=="string"?v.display:v.display&&typeof v.display=="object"&&"description"in v.display?String(v.display.description??""):v.action??"执行该操作"}function u(v){return r.value.has(v)}function f(v,k,w){const S=a.value;!S||u(S.id)||(r.value=new Set([...r.value,S.id]),s("resolve",S.id,v,k,w))}function h(){const v=l.value.trim();v&&f("rejected",v)}function p(v){if(!a.value||o.value)return;const w=v.target;if(w&&(w.tagName==="TEXTAREA"||w.tagName==="INPUT")){i.value&&v.key==="Enter"&&!v.shiftKey&&(v.preventDefault(),h());return}switch(v.key){case"1":v.preventDefault(),f("approved",void 0,"once");break;case"2":v.preventDefault(),f("approved",void 0,"session");break;case"3":v.preventDefault(),f("rejected");break;case"4":v.preventDefault(),i.value=!i.value;break}}return ct(()=>window.addEventListener("keydown",p)),Ct(()=>window.removeEventListener("keydown",p)),(v,k)=>e.approvals.length?(g(),m("div",_m,[o.value?(g(),m("button",{key:0,class:"approval-minibar",onClick:k[0]||(k[0]=w=>o.value=!1)}," ⚠ "+R(e.approvals.length)+" 个待审批请求 — 点击展开 ",1)):a.value?(g(),m(ee,{key:1},[d("div",Sm,[k[7]||(k[7]=d("span",{class:"approval-icon"},"⚠",-1)),d("span",$m,[d("span",xm,R(a.value.toolName),1),d("span",Cm,R(c(a.value)),1)]),e.approvals.length>1?(g(),m("span",Tm,"+"+R(e.approvals.length-1),1)):U("",!0),d("button",{class:"icon-btn",title:"最小化","aria-label":"最小化",onClick:k[1]||(k[1]=w=>o.value=!0)},"—")]),d("pre",Im,R(c(a.value)),1),i.value?(g(),m("div",Rm,[it(d("textarea",{"onUpdate:modelValue":k[2]||(k[2]=w=>l.value=w),class:"feedback-input",rows:"2",name:"approval-feedback","aria-label":"拒绝反馈",placeholder:"输入反馈,Enter 提交(将作为拒绝原因反馈给 Agent)"},null,512),[[ut,l.value]])])):U("",!0),d("div",Am,[J(zn,{variant:"primary",disabled:u(a.value.id),onClick:k[3]||(k[3]=w=>f("approved",void 0,"once"))},{default:Pt(()=>[...k[8]||(k[8]=[d("kbd",null,"1",-1),Ce(" 批准 ",-1)])]),_:1},8,["disabled"]),J(zn,{variant:"secondary",disabled:u(a.value.id),onClick:k[4]||(k[4]=w=>f("approved",void 0,"session"))},{default:Pt(()=>[...k[9]||(k[9]=[d("kbd",null,"2",-1),Ce(" 会话批准 ",-1)])]),_:1},8,["disabled"]),J(zn,{variant:"danger",disabled:u(a.value.id),onClick:k[5]||(k[5]=w=>f("rejected"))},{default:Pt(()=>[...k[10]||(k[10]=[d("kbd",null,"3",-1),Ce(" 拒绝 ",-1)])]),_:1},8,["disabled"]),J(zn,{variant:"secondary",class:fe({"feedback-active":i.value}),disabled:u(a.value.id),onClick:k[6]||(k[6]=w=>i.value=!i.value)},{default:Pt(()=>[...k[11]||(k[11]=[d("kbd",null,"4",-1),Ce(" 反馈 ",-1)])]),_:1},8,["class","disabled"]),u(a.value.id)?(g(),m("span",Em,[...k[12]||(k[12]=[d("span",{class:"spinner"},null,-1),Ce(" 处理中… ",-1)])])):U("",!0)])],64)):U("",!0)])):U("",!0)}}),Pm=Ie(Mm,[["__scopeId","data-v-fa5dc764"]]);function Lm(e){const t=/(?:^|\s)@"([^"\n]*)$/.exec(e);if(t)return{start:e.length-(t[1].length+2),query:t[1],quoted:!0};const n=/(?:^|\s)@([^\s"]*)$/.exec(e);return n?{start:e.length-(n[1].length+1),query:n[1],quoted:!1}:null}function Na(e){let t=0;for(let n=0;n<e.length;n++)e[n]==="/"&&t++;return t}function Ba(e,t){if(!e)return!0;let n=0;for(let s=0;s<t.length&&n<e.length;s++)t[s]===e[n]&&n++;return n===e.length}function Om(e,t){const n=e.path.toLowerCase();let s=0;if(t.includes("/"))n===t?s=100:n.startsWith(t)?s=80:n.includes(t)?s=50:Ba(t,n)&&(s=10);else{const o=n.lastIndexOf("/"),i=o===-1?n:n.slice(o+1);i===t?s=100:i.startsWith(t)?s=80:i.includes(t)?s=50:n.includes(t)?s=30:Ba(t,n)&&(s=10)}return e.isDir&&s>0&&(s+=10),s}const Dm=20;function ed(e,t,n=Dm){const s=t.toLowerCase();if(!s)return e.slice(0,n);const o=[];for(const i of e){const l=Om(i,s);l>0&&o.push({entry:i,score:l})}return o.sort((i,l)=>l.score-i.score||Na(i.entry.path)-Na(l.entry.path)||i.entry.path.localeCompare(l.entry.path)),o.slice(0,n).map(i=>i.entry)}function Nm(e,t){const n=t?`${e}/`:e,s=n.includes(" ");if(t){const i=s?`@"${n}"`:`@${n}`;return{text:i,cursorOffset:s?i.length-1:i.length}}const o=s?`@"${n}" `:`@${n} `;return{text:o,cursorOffset:o.length}}const Bm="/api/v1/files",Fm=3e4,Tl=new Map,Ro=new Map;async function td(e){const t=Tl.get(e);if(t&&Date.now()-t.at<Fm)return t.entries;const n=Ro.get(e);if(n)return n;const s=(async()=>{try{const o=await fetch(`${Bm}/list?path=${encodeURIComponent(e)}`);if(!o.ok)return null;const i=await o.json();return i.entries&&Tl.set(e,{entries:i.entries,at:Date.now()}),i.entries??null}catch{return null}finally{Ro.delete(e)}})();return Ro.set(e,s),s}function jm(e){Tl.delete(e),Ro.delete(e)}function Um(e,t){const n=e.replace(/\/+$/,""),s=n.split("/").filter(Boolean),o=[...s];for(const l of t.split("/"))if(!(!l||l===".")){if(l===".."){if(o.length<=s.length)return null;o.pop();continue}o.push(l)}const i=`/${o.join("/")}`;return i===n||i.startsWith(`${n}/`)?i:null}function Gm(e,t,n){const s=F(null),o=F([]),i=F(!1),l=F(!1),r=F(0),a=F(!1),c=F(null),u=F("");let f=null;function h(){f||(f=(async()=>{var x;try{const y=await fetch("/api/v1/files/root"),T=y.ok?await y.json():{};u.value=((x=T.roots)==null?void 0:x[0])??""}catch{u.value=""}M()})())}const p=q(()=>{const x=c.value;if(!x)return[];const y=x.query.lastIndexOf("/"),T=x.query.slice(y+1);return ed(o.value,T)}),v=q(()=>c.value!==null&&!a.value&&(i.value||p.value.length>0));function k(x){const y=x.lastIndexOf("/");return y===-1?{dirRel:"",tail:x}:{dirRel:x.slice(0,y),tail:x.slice(y+1)}}let w=!1,S=0;async function $(x,y){const T=++S;i.value=!0;try{const O=await td(x);if(O===null)throw new Error("listing failed");if(T!==S)return;const I=y?`${y.replace(/\/+$/,"")}/`:"";o.value=O.map(H=>({path:`${I}${H.name}`,isDir:H.type==="dir"})),l.value=!1}catch{if(T!==S)return;o.value=[],l.value=!0,s.value=null}finally{T===S&&(i.value=!1)}}function M(){var B;if(w)return;const x=t.value;if(x&&x.value!==e.value){c.value=null;return}let y=(B=n.value)==null?void 0:B.trim();if(y||(h(),y=u.value),!x||!y){c.value=null;return}const T=x.selectionStart??x.value.length,O=Lm(x.value.slice(0,T));if(!O){c.value=null,a.value=!1;return}const I=c.value;(!I||I.start!==O.start||I.query!==O.query)&&(a.value=!1),c.value=O,r.value=0;const{dirRel:H}=k(O.query),L=Um(y,H);if(L===null){s.value=null,o.value=[],l.value=!0;return}s.value!==L&&(s.value=L,$(L,H))}function P(x){const y=p.value.length;y>0&&(r.value=(r.value+x+y)%y)}function Z(x){const y=c.value,T=x??p.value[r.value];if(!y||!T)return!1;const O=t.value;if(!O)return!1;const I=O.selectionStart??O.value.length,H=Nm(T.path,T.isDir),L=e.value.slice(0,y.start),B=e.value.slice(I);e.value=L+H.text+B,w=!0;const ne=()=>{const ie=y.start+H.cursorOffset;O.focus(),O.setSelectionRange(ie,ie),w=!1,M()};return typeof requestAnimationFrame=="function"?requestAnimationFrame(ne):Promise.resolve().then(ne),!0}function j(){a.value=!0}function C(){c.value=null,a.value=!1,r.value=0}return{visible:v,suggestions:p,index:r,dirLoading:i,dirMissing:l,refresh:M,move:P,confirm:Z,dismiss:j,reset:C}}const nd=50;function zm(e,t=nd){const n=new Set,s=[];for(let o=e.length-1;o>=0&&s.length<t;o-=1){const i=e[o];if(!i||i.role!=="user"||i.local)continue;const l=(i.content??"").trim();!l||n.has(l)||(n.add(l),s.push(l))}return s}function Hm(e,t,n=nd){const s=new Set,o=[],i=l=>{const r=l.trim();!r||s.has(r)||(s.add(r),o.push(r))};for(const l of t)i(l);for(let l=e.length-1;l>=0;l-=1){const r=e[l];r!==void 0&&i(r)}return o.slice(0,n).toReversed()}const Wm=["width","height"],qm={key:0,d:"M4 7h16M4 12h16M4 17h16"},Vm={key:1,d:"M12 5v14M5 12h14"},Km={key:5,d:"M4 6h16M7 12h10M10 18h4"},Ym={key:6,d:"M12 3v12m0 0 4-4m-4 4-4-4M5 20h14"},Zm={key:7,d:"M4 7h16M9 7V4h6v3m3 0-1 13H7L6 7m4 4v5m4-5v5"},Jm={key:8,d:"M3 12h4l2-7 4 14 2-7h6"},Xm={key:10,d:"m15 18-6-6 6-6"},Qm={key:11,d:"m9 18 6-6-6-6"},ev={key:12,d:"m6 9 6 6 6-6"},tv={key:16,d:"M20 15.5A8.5 8.5 0 0 1 8.5 4 8.5 8.5 0 1 0 20 15.5Z"},nv={key:18,d:"M5 9a11 11 0 0 1 14 0M8.5 12.5a6 6 0 0 1 7 0M12 17h.01"},sv={key:19,d:"M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L8 18l-4 1 1-4Z"},ov={key:20,d:"M12 16V4m0 0-4 4m4-4 4 4M5 20h14"},iv={key:21,d:"m15 4 5 5M17.5 6.5 10 14m-2-2 4 4-3 4H3l1-6Z"},lv={key:22,d:"M9 6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3Z"},rv={key:24,d:"m22 2-7 20-4-9-9-4ZM22 2 11 13"},av={key:25,x:"6",y:"6",width:"12",height:"12",rx:"2"},cv={key:26,d:"m8 3 4 4 4-4M8 21l4-4 4 4M12 7v10"},uv={key:27,d:"M9.5 4.5A3 3 0 0 0 5 7a3 3 0 0 0 .5 5.5A3 3 0 0 0 9 17v2a2 2 0 0 0 4 0V5a2.5 2.5 0 0 0-3.5-.5ZM13 6a3 3 0 0 1 5 2 3 3 0 0 1 .5 5.5A3 3 0 0 1 15 18"},dv={key:30,d:"M21 12a8 8 0 0 1-9 8 9 9 0 0 1-4-.9L3 21l1.7-4A9 9 0 1 1 21 12Z"},fv={key:31,d:"M20 13 13 20l-9-9V4h7ZM8.5 8.5h.01"},hv={key:32,d:"m12 3 1.3 3.7L17 8l-3.7 1.3L12 13l-1.3-3.7L7 8l3.7-1.3ZM5 15l.8 2.2L8 18l-2.2.8L5 21l-.8-2.2L2 18l2.2-.8ZM19 14l.7 1.8 1.8.7-1.8.7L19 19l-.7-1.8-1.8-.7 1.8-.7Z"},pv={key:34,d:"M3 6h7l2 2h9v11H3Z"},gv={key:35,d:"m5 12 4 4L19 6"},mv={key:39,d:"M21 12a9 9 0 1 1-2.6-6.4M21 3v6h-6"},vv={key:46,d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-3-3Z"},yv={key:47,d:"M12 19V5m0 0-6 6m6-6 6 6"},bv={key:48,d:"M18 6 6 18M6 6l12 12"},kv={key:51,d:"M4 20V10M10 20V4M16 20v-7M21 20H3"},wv=Te({__name:"SvgIcon",props:{name:{},size:{default:20}},setup(e){return(t,n)=>(g(),m("svg",{class:"svg-icon",width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[e.name==="menu"?(g(),m("path",qm)):e.name==="plus"?(g(),m("path",Vm)):e.name==="panel-left"?(g(),m(ee,{key:2},[n[0]||(n[0]=d("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"},null,-1)),n[1]||(n[1]=d("path",{d:"M9 4v16"},null,-1))],64)):e.name==="panel-right"?(g(),m(ee,{key:3},[n[2]||(n[2]=d("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"},null,-1)),n[3]||(n[3]=d("path",{d:"M15 4v16"},null,-1))],64)):e.name==="search"?(g(),m(ee,{key:4},[n[4]||(n[4]=d("circle",{cx:"11",cy:"11",r:"7"},null,-1)),n[5]||(n[5]=d("path",{d:"m20 20-4-4"},null,-1))],64)):e.name==="filter"?(g(),m("path",Km)):e.name==="download"?(g(),m("path",Ym)):e.name==="trash"?(g(),m("path",Zm)):e.name==="activity"?(g(),m("path",Jm)):e.name==="help"?(g(),m(ee,{key:9},[n[6]||(n[6]=d("circle",{cx:"12",cy:"12",r:"9"},null,-1)),n[7]||(n[7]=d("path",{d:"M9.7 9a2.5 2.5 0 1 1 3.5 2.3c-.8.4-1.2 1-1.2 1.7M12 17h.01"},null,-1))],64)):e.name==="chevron-left"?(g(),m("path",Xm)):e.name==="chevron-right"?(g(),m("path",Qm)):e.name==="chevron-down"?(g(),m("path",ev)):e.name==="bot"?(g(),m(ee,{key:13},[n[8]||(n[8]=d("rect",{x:"4",y:"7",width:"16",height:"12",rx:"3"},null,-1)),n[9]||(n[9]=d("path",{d:"M12 3v4M8 12h.01M16 12h.01M9 16h6"},null,-1))],64)):e.name==="git-branch"?(g(),m(ee,{key:14},[n[10]||(n[10]=d("circle",{cx:"6",cy:"5",r:"2"},null,-1)),n[11]||(n[11]=d("circle",{cx:"18",cy:"7",r:"2"},null,-1)),n[12]||(n[12]=d("circle",{cx:"6",cy:"19",r:"2"},null,-1)),n[13]||(n[13]=d("path",{d:"M6 7v10M8 10c5 0 3-3 8-3"},null,-1))],64)):e.name==="sun"?(g(),m(ee,{key:15},[n[14]||(n[14]=d("circle",{cx:"12",cy:"12",r:"4"},null,-1)),n[15]||(n[15]=d("path",{d:"M12 2v2M12 20v2M4.93 4.93l1.42 1.42m11.3 11.3 1.42 1.42M2 12h2m16 0h2M4.93 19.07l1.42-1.42m11.3-11.3 1.42-1.42"},null,-1))],64)):e.name==="moon"?(g(),m("path",tv)):e.name==="monitor"?(g(),m(ee,{key:17},[n[16]||(n[16]=d("rect",{x:"3",y:"4",width:"18",height:"13",rx:"2"},null,-1)),n[17]||(n[17]=d("path",{d:"M8 21h8M12 17v4"},null,-1))],64)):e.name==="wifi"?(g(),m("path",nv)):e.name==="edit"?(g(),m("path",sv)):e.name==="upload"?(g(),m("path",ov)):e.name==="broom"?(g(),m("path",iv)):e.name==="command"?(g(),m("path",lv)):e.name==="at"?(g(),m(ee,{key:23},[n[18]||(n[18]=d("circle",{cx:"12",cy:"12",r:"4"},null,-1)),n[19]||(n[19]=d("path",{d:"M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-3.5 7"},null,-1))],64)):e.name==="send"?(g(),m("path",rv)):e.name==="stop"?(g(),m("rect",av)):e.name==="compact"?(g(),m("path",cv)):e.name==="brain"?(g(),m("path",uv)):e.name==="clipboard"?(g(),m(ee,{key:28},[n[20]||(n[20]=d("rect",{x:"5",y:"4",width:"14",height:"17",rx:"2"},null,-1)),n[21]||(n[21]=d("path",{d:"M9 4V2h6v2M9 10h6M9 14h6"},null,-1))],64)):e.name==="fork"?(g(),m(ee,{key:29},[n[22]||(n[22]=d("circle",{cx:"6",cy:"4",r:"2"},null,-1)),n[23]||(n[23]=d("circle",{cx:"18",cy:"6",r:"2"},null,-1)),n[24]||(n[24]=d("circle",{cx:"6",cy:"20",r:"2"},null,-1)),n[25]||(n[25]=d("path",{d:"M6 6v12M8 10c6 0 4-4 8-4"},null,-1))],64)):e.name==="message-circle"?(g(),m("path",dv)):e.name==="tag"?(g(),m("path",fv)):e.name==="sparkles"?(g(),m("path",hv)):e.name==="terminal"?(g(),m(ee,{key:33},[n[26]||(n[26]=d("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"},null,-1)),n[27]||(n[27]=d("path",{d:"m7 9 3 3-3 3m5 0h5"},null,-1))],64)):e.name==="folder"?(g(),m("path",pv)):e.name==="check"?(g(),m("path",gv)):e.name==="speaker"?(g(),m(ee,{key:36},[n[28]||(n[28]=d("path",{d:"M11 5 6 9H3v6h3l5 4V5z"},null,-1)),n[29]||(n[29]=d("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"},null,-1)),n[30]||(n[30]=d("path",{d:"M18 6a8.5 8.5 0 0 1 0 12"},null,-1))],64)):e.name==="speaker-off"?(g(),m(ee,{key:37},[n[31]||(n[31]=d("path",{d:"M11 5 6 9H3v6h3l5 4V5z"},null,-1)),n[32]||(n[32]=d("path",{d:"m16 9 5 6M21 9l-5 6"},null,-1))],64)):e.name==="copy"?(g(),m(ee,{key:38},[n[33]||(n[33]=d("rect",{x:"8",y:"8",width:"12",height:"12",rx:"2"},null,-1)),n[34]||(n[34]=d("path",{d:"M16 8V4H4v12h4"},null,-1))],64)):e.name==="refresh"?(g(),m("path",mv)):e.name==="target"?(g(),m(ee,{key:40},[n[35]||(n[35]=d("circle",{cx:"12",cy:"12",r:"9"},null,-1)),n[36]||(n[36]=d("circle",{cx:"12",cy:"12",r:"5"},null,-1)),n[37]||(n[37]=d("circle",{cx:"12",cy:"12",r:"1"},null,-1))],64)):e.name==="settings"?(g(),m(ee,{key:41},[n[38]||(n[38]=d("circle",{cx:"12",cy:"12",r:"3"},null,-1)),n[39]||(n[39]=d("path",{d:"M19.4 15a1.7 1.7 0 0 0 .34 1.87l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1.87-.34 1.7 1.7 0 0 0-1 1.55V21a2 2 0 1 1-4 0v-.09a1.7 1.7 0 0 0-1-1.55 1.7 1.7 0 0 0-1.87.34l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.7 1.7 0 0 0 .34-1.87 1.7 1.7 0 0 0-1.55-1H3a2 2 0 1 1 0-4h.09a1.7 1.7 0 0 0 1.55-1 1.7 1.7 0 0 0-.34-1.87l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.7 1.7 0 0 0 1.87.34h.09a1.7 1.7 0 0 0 1-1.55V3a2 2 0 1 1 4 0v.09a1.7 1.7 0 0 0 1 1.55 1.7 1.7 0 0 0 1.87-.34l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.7 1.7 0 0 0-.34 1.87v.09a1.7 1.7 0 0 0 1.55 1H21a2 2 0 1 1 0 4h-.09a1.7 1.7 0 0 0-1.55 1Z"},null,-1))],64)):e.name==="home"?(g(),m(ee,{key:42},[n[40]||(n[40]=d("path",{d:"M3 10.5 12 3l9 7.5"},null,-1)),n[41]||(n[41]=d("path",{d:"M5 9.5V21h14V9.5"},null,-1))],64)):e.name==="bell"?(g(),m(ee,{key:43},[n[42]||(n[42]=d("path",{d:"M6 9a6 6 0 1 1 12 0c0 5 2 6 2 6H4s2-1 2-6"},null,-1)),n[43]||(n[43]=d("path",{d:"M10 19a2 2 0 0 0 4 0"},null,-1))],64)):e.name==="book"?(g(),m(ee,{key:44},[n[44]||(n[44]=d("path",{d:"M4 5a2 2 0 0 1 2-2h13v18H6a2 2 0 0 0-2 2Z"},null,-1)),n[45]||(n[45]=d("path",{d:"M6 3v18"},null,-1))],64)):e.name==="layers"?(g(),m(ee,{key:45},[n[46]||(n[46]=d("path",{d:"m12 3 9 5-9 5-9-5Z"},null,-1)),n[47]||(n[47]=d("path",{d:"m3 13 9 5 9-5"},null,-1))],64)):e.name==="wrench"?(g(),m("path",vv)):e.name==="arrow-up"?(g(),m("path",yv)):e.name==="x"?(g(),m("path",bv)):e.name==="file"?(g(),m(ee,{key:49},[n[48]||(n[48]=d("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"},null,-1)),n[49]||(n[49]=d("path",{d:"M14 2v6h6"},null,-1))],64)):e.name==="user"?(g(),m(ee,{key:50},[n[50]||(n[50]=d("circle",{cx:"12",cy:"8",r:"3.5"},null,-1)),n[51]||(n[51]=d("path",{d:"M5 20a7 7 0 0 1 14 0"},null,-1))],64)):e.name==="bar-chart"?(g(),m("path",kv)):U("",!0)],8,Wm))}}),me=Ie(wv,[["__scopeId","data-v-3f977afb"]]),_v={class:"at-menu",role:"listbox","aria-label":"文件提及"},Sv={key:0,class:"at-status"},$v={key:1,class:"at-status"},xv=["data-active","aria-selected","onClick","onMousemove"],Cv={class:"at-item-name"},Tv={key:0,class:"at-item-dir"},Iv={class:"at-hints"},Rv={class:"at-hint"},Av=["title"],Ev=Te({__name:"AtFileMenu",props:{suggestions:{},activeIndex:{},loading:{type:Boolean,default:!1},workDir:{default:""}},emits:["select","hover"],setup(e,{emit:t}){const n=e,s=t,o=F(null);Me(()=>n.activeIndex,async()=>{var c;await ft();const a=(c=o.value)==null?void 0:c.querySelector('[data-active="true"]');a==null||a.scrollIntoView({block:"nearest"})});const i=a=>a.split("/").pop()||a;function l(a){return i(a.path)}function r(a){const c=a.path.lastIndexOf("/");return c===-1?"":a.path.slice(0,c)}return(a,c)=>{var u;return g(),m("div",_v,[e.loading&&e.suggestions.length===0?(g(),m("div",Sv,"加载文件列表…")):e.suggestions.length===0?(g(),m("div",$v,"无匹配文件")):(g(),m("ul",{key:2,ref_key:"listRef",ref:o,class:"at-list"},[(g(!0),m(ee,null,Ee(e.suggestions,(f,h)=>(g(),m("li",{key:f.path},[d("button",{class:fe(["at-item",{selected:h===e.activeIndex}]),"data-active":h===e.activeIndex?"true":void 0,role:"option","aria-selected":h===e.activeIndex,onClick:p=>s("select",f),onMousemove:p=>s("hover",h)},[d("span",{class:fe(["at-item-icon",{"is-dir":f.isDir}])},[J(me,{name:f.isDir?"folder":"file",size:14},null,8,["name"])],2),d("span",Cv,R(l(f)),1),r(f)?(g(),m("span",Tv,R(r(f)),1)):U("",!0)],42,xv)]))),128))],512)),d("div",Iv,[c[1]||(c[1]=d("span",{class:"at-hint"},[d("kbd",null,"↑↓"),Ce("选择")],-1)),d("span",Rv,[c[0]||(c[0]=d("kbd",null,"Tab/Enter",-1)),Ce(R((u=e.suggestions[e.activeIndex])!=null&&u.isDir?"进入目录":"插入引用"),1)]),c[2]||(c[2]=d("span",{class:"at-hint"},[d("kbd",null,"Esc"),Ce("关闭")],-1)),e.workDir?(g(),m("span",{key:0,class:"at-root",title:e.workDir},"根:"+R(i(e.workDir)),9,Av)):U("",!0)])])}}}),Mv=Ie(Ev,[["__scopeId","data-v-c228c98f"]]),Pv=["title","aria-label"],Lv=["width","height","viewBox"],Ov=["cx","cy","r"],Dv=["cx","cy","r","stroke-dasharray","stroke-dashoffset","transform"],Yi=2,Nv=Te({__name:"ContextRing",props:{usage:{default:void 0},size:{default:16}},setup(e){gg(a=>({v1d95ffa8:r.value}));const t=e,n=q(()=>{if(t.usage===void 0||Number.isNaN(t.usage))return 0;const a=t.usage>1?t.usage/100:t.usage;return Math.min(1,Math.max(0,a))}),s=q(()=>Math.round(n.value*100)),o=q(()=>(t.size-Yi)/2),i=q(()=>2*Math.PI*o.value),l=q(()=>i.value*(1-n.value)),r=q(()=>n.value>=.9?"var(--color-danger)":n.value>=.7?"var(--color-warning)":"var(--color-accent)");return(a,c)=>(g(),m("span",{class:"context-ring",role:"img",title:`上下文占用 ${s.value}%`,"aria-label":`上下文占用 ${s.value}%`},[(g(),m("svg",{width:e.size,height:e.size,viewBox:`0 0 ${e.size} ${e.size}`},[d("circle",{class:"ring-track",cx:e.size/2,cy:e.size/2,r:o.value,"stroke-width":Yi,fill:"none"},null,8,Ov),d("circle",{class:"ring-value",cx:e.size/2,cy:e.size/2,r:o.value,"stroke-width":Yi,fill:"none","stroke-linecap":"round","stroke-dasharray":i.value,"stroke-dashoffset":l.value,transform:`rotate(-90 ${e.size/2} ${e.size/2})`},null,8,Dv)],8,Lv))],8,Pv))}}),sd=Ie(Nv,[["__scopeId","data-v-3ffc343b"]]),Bv={class:"history-menu",role:"listbox","aria-label":"输入历史"},Fv={class:"history-header",title:"输入历史"},jv=["data-active","aria-selected","onClick","onMousemove"],Uv={class:"history-item-index"},Gv={class:"history-item-text"},zv=Te({__name:"HistoryMenu",props:{items:{},activeIndex:{}},emits:["apply","hover"],setup(e,{emit:t}){const n=e,s=t,o=F(null);return Me(()=>n.activeIndex,async()=>{var l;await ft();const i=(l=o.value)==null?void 0:l.querySelector('[data-active="true"]');i==null||i.scrollIntoView({block:"nearest"})}),ct(async()=>{var l;await ft();const i=(l=o.value)==null?void 0:l.querySelector('[data-active="true"]');i==null||i.scrollIntoView({block:"nearest"})}),(i,l)=>(g(),m("div",Bv,[d("div",Fv,[J(me,{name:"refresh",size:14}),l[0]||(l[0]=d("span",{class:"history-hints"},[d("span",{class:"history-hint"},[d("kbd",null,"↑↓"),Ce("选择")]),d("span",{class:"history-hint"},[d("kbd",null,"Tab/Enter"),Ce("填入")]),d("span",{class:"history-hint"},[d("kbd",null,"Esc"),Ce("关闭")])],-1))]),d("ul",{ref_key:"listRef",ref:o,class:"history-list"},[(g(!0),m(ee,null,Ee(e.items,(r,a)=>(g(),m("li",{key:`${a}:${r}`},[d("button",{class:fe(["history-item",{selected:a===e.activeIndex}]),"data-active":a===e.activeIndex?"true":void 0,role:"option","aria-selected":a===e.activeIndex,onClick:c=>s("apply",r),onMousemove:c=>s("hover",a)},[d("span",Uv,R(a+1),1),d("span",Gv,R(r),1)],42,jv)]))),128))],512)]))}}),Hv=Ie(zv,[["__scopeId","data-v-598dec8a"]]),Wv=["onKeydown"],qv={key:0,class:"picker-empty"},Vv={class:"picker-group-title"},Kv=["onClick"],Yv={class:"row-main"},Zv={class:"row-name"},Jv={class:"row-alias"},Xv={class:"row-meta"},Qv={key:0,class:"row-check"},ey={class:"picker-thinking"},ty={class:"thinking-options"},ny=["onClick"],sy=Te({__name:"ModelPicker",props:{models:{},currentModel:{},currentThinking:{}},emits:["apply-model","apply-thinking","close"],setup(e,{emit:t}){const n=e,s=t,o=["off","low","medium","high"],i={off:"关闭",low:"低",medium:"中",high:"高",xhigh:"超高",max:"最大"},l=F(""),r=F(null);ct(()=>{var C;(C=r.value)==null||C.focus()});const a=q(()=>{const C=l.value.trim().toLowerCase();return C?n.models.filter(x=>x.alias.toLowerCase().includes(C)||x.provider.toLowerCase().includes(C)||(x.displayName??"").toLowerCase().includes(C)):n.models}),c=q(()=>{const C=new Map;for(const x of a.value){const y=C.get(x.provider)??[];y.push(x),C.set(x.provider,y)}return[...C.entries()].map(([x,y])=>({provider:x,models:y}))}),u=q(()=>n.models.find(C=>C.alias===n.currentModel)),f=q(()=>{var C;return((C=u.value)==null?void 0:C.thinkingLevels)??o});function h(C){return i[C]??C}function p(C){return C>=1e3?`${Math.round(C/1e3)}k`:String(C)}function v(C){return C.displayName??C.model}const k=F(null);function w(C){k.value&&!k.value.contains(C.target)&&s("close")}ct(()=>document.addEventListener("mousedown",w,!0)),Ct(()=>document.removeEventListener("mousedown",w,!0));function S(C){C!==n.currentModel&&s("apply-model",C),s("close")}const $=F(null);function M(){const C=$.value;return C?Array.from(C.querySelectorAll(".picker-row")):[]}function P(){var C;(C=M()[0])==null||C.focus()}function Z(C){var T,O,I;if(C.key!=="ArrowDown"&&C.key!=="ArrowUp")return;const x=M();if(x.length===0)return;const y=x.indexOf(document.activeElement);C.preventDefault(),y===-1?(T=x[0])==null||T.focus():C.key==="ArrowDown"?(O=x[(y+1)%x.length])==null||O.focus():(I=x[(y-1+x.length)%x.length])==null||I.focus()}function j(C){C!==n.currentThinking&&s("apply-thinking",C)}return(C,x)=>(g(),m("div",{ref_key:"rootRef",ref:k,class:"model-picker",role:"dialog","aria-label":"模型选择",onKeydown:x[1]||(x[1]=Vn(rt(y=>s("close"),["stop"]),["esc"]))},[it(d("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":x[0]||(x[0]=y=>l.value=y),class:"picker-search",type:"text",placeholder:"搜索模型…",id:"model-search-input",name:"model-search",autocomplete:"off",spellcheck:"false",onKeydown:Vn(rt(P,["prevent"]),["arrow-down"])},null,40,Wv),[[ut,l.value]]),d("div",{ref_key:"listRef",ref:$,class:"picker-list",onKeydown:Z},[c.value.length===0?(g(),m("div",qv,"无匹配模型")):U("",!0),(g(!0),m(ee,null,Ee(c.value,y=>(g(),m("div",{key:y.provider,class:"picker-group"},[d("div",Vv,R(y.provider),1),(g(!0),m(ee,null,Ee(y.models,T=>(g(),m("button",{key:T.alias,class:fe(["picker-row",{active:T.alias===e.currentModel}]),onClick:O=>S(T.alias)},[d("span",Yv,[d("span",Zv,R(v(T)),1),d("span",Jv,R(T.alias),1)]),d("span",Xv,R(p(T.maxContextSize)),1),T.alias===e.currentModel?(g(),m("span",Qv,"✓")):U("",!0)],10,Kv))),128))]))),128))],544),d("div",ey,[x[2]||(x[2]=d("span",{class:"thinking-label"},"思考强度",-1)),d("div",ty,[(g(!0),m(ee,null,Ee(f.value,y=>(g(),m("button",{key:y,class:fe(["thinking-btn",{active:y===e.currentThinking}]),onClick:T=>j(y)},R(h(y)),11,ny))),128))])])],544))}}),oy=Ie(sy,[["__scopeId","data-v-438275ef"]]),iy={class:"slash-menu",role:"listbox","aria-label":"斜杠命令"},ly=["aria-selected","onMousedown","onMouseenter"],ry={class:"slash-name"},ay={key:0,class:"slash-aliases"},cy={class:"slash-desc"},uy={key:0,class:"slash-badge slash-badge-input"},dy={key:1,class:"slash-badge"},fy=Te({__name:"SlashMenu",props:{commands:{},activeIndex:{}},emits:["select","hover"],setup(e,{emit:t}){const n=t;return(s,o)=>(g(),m("div",iy,[(g(!0),m(ee,null,Ee(e.commands,(i,l)=>{var r;return g(),m("button",{key:i.name,class:fe(["slash-item",{active:l===e.activeIndex}]),role:"option","aria-selected":l===e.activeIndex,onMousedown:rt(a=>n("select",i),["prevent"]),onMouseenter:a=>n("hover",l)},[d("span",ry,[Ce("/"+R(i.name),1),(r=i.aliases)!=null&&r.length?(g(),m("span",ay,R(i.aliases.map(a=>`/${a}`).join(" ")),1)):U("",!0)]),d("span",cy,R(i.description),1),i.acceptsInput?(g(),m("span",uy,"输入参数")):U("",!0),i.target==="backend"?(g(),m("span",dy,"服务端")):U("",!0)],42,ly)}),128)),o[0]||(o[0]=d("div",{class:"slash-hint"},"↑↓ 选择 · Enter/Tab 执行 · Esc 关闭",-1))]))}}),hy=Ie(fy,[["__scopeId","data-v-6983799d"]]),py=["placeholder"],gy={class:"composer-footer"},my={class:"composer-quick-actions"},vy=["title"],yy={key:3,class:"queue-label",title:"运行结束后自动发送"},by={class:"composer-actions"},ky=["disabled","title"],wy={key:1,class:"context-label",title:"上下文使用率"},_y=["disabled"],Fa=50,Sy=Te({__name:"Composer",props:{busy:{type:Boolean},status:{default:void 0},sessionId:{default:null},models:{default:()=>[]},workDir:{default:""},variant:{default:"chat"},placeholder:{default:void 0},messages:{}},emits:["send","abort","command","switch-model","switch-thinking"],setup(e,{expose:t,emit:n}){const s=e,o=n,i=F(""),l=F(null),r=q(()=>s.workDir||void 0),a=Gm(i,l,r),c=F(0),u=F(!1),f=q(()=>{const A=i.value;return!A.startsWith("/")||A.includes(`
|
|
19
|
-
`)||/\s/.test(A.slice(1))?null:A.slice(1)}),h=q(()=>f.value===null?[]:am(f.value)),p=q(()=>f.value!==null&&h.value.length>0&&!u.value);Me(f,()=>{c.value=0,u.value=!1});function v(A){const N=A??h.value[c.value];if(N){if(N.acceptsInput){i.value=`/${N.name} `,u.value=!0,ft(()=>{var ue;(ue=l.value)==null||ue.focus(),H()});return}C(`/${N.name}`),_e(),o("command",N.name)}}const k=F([]);Me(()=>s.sessionId,()=>{k.value=[]}),Me(()=>s.busy,A=>{if(!A&&k.value.length>0){const[N,...ue]=k.value;k.value=ue,N&&o("send",N)}});let w=0;const S=F([]),$=q(()=>Hm(S.value,zm(s.messages??[]),Fa)),M=F(!1),P=F(0);function Z(){return`scream-history:${s.sessionId??"default"}`}function j(){try{const A=localStorage.getItem(Z());S.value=A?JSON.parse(A):[]}catch{S.value=[]}}function C(A){if(S.value.at(-1)!==A){S.value=[...S.value,A].slice(-Fa);try{localStorage.setItem(Z(),JSON.stringify(S.value))}catch{}}}function x(A){i.value=A,M.value=!1,ft(()=>{const N=l.value;N&&(N.focus(),N.setSelectionRange(N.value.length,N.value.length),H(),a.reset())})}function y(){u.value=!0,a.dismiss(),P.value=Math.max(0,$.value.length-1),M.value=!0}function T(A){const N=$.value.length;N!==0&&(P.value=Math.min(N-1,Math.max(0,P.value+A)))}Me(()=>$.value.length,()=>{P.value>=$.value.length&&(P.value=Math.max(0,$.value.length-1))});function O(){return`scream-draft:${s.sessionId??"default"}`}let I;Me(i,()=>{H(),M.value=!1,a.refresh(),clearTimeout(I),I=setTimeout(()=>{try{i.value?localStorage.setItem(O(),i.value):localStorage.removeItem(O())}catch{}},300)}),Me(()=>s.sessionId,()=>{clearTimeout(I),j(),M.value=!1,P.value=0;let A="";try{A=localStorage.getItem(O())??""}catch{A=""}i.value=A,ft(H)},{immediate:!0});function H(){const A=l.value;if(!A)return;A.style.height="auto";const N=Math.round(window.innerHeight*.25);A.style.height=`${Math.min(Math.max(A.scrollHeight,36),N)}px`}function L(){a.refresh()}const B=F(0);function ne(){const A=window.visualViewport;if(!A)return;const N=Math.round(window.innerHeight-A.height-A.offsetTop);B.value=N>120?N:0}"visualViewport"in window&&(ct(()=>{var A;(A=window.visualViewport)==null||A.addEventListener("resize",ne),ne()}),Ct(()=>{var A;(A=window.visualViewport)==null||A.removeEventListener("resize",ne),B.value=0}));function ie(A){if(!M.value)return;const N=A.target;N instanceof Element&&(N.closest(".history-menu")||N.closest("#composer-input")||(M.value=!1))}ct(()=>document.addEventListener("mousedown",ie)),Ct(()=>document.removeEventListener("mousedown",ie));function _e(){i.value="",a.reset(),M.value=!1,ft(()=>{l.value&&(l.value.style.height="auto")})}function Se(){const A=i.value.trim();if(A){if(A.startsWith("/")){const N=A.indexOf(" "),ue=(N===-1?A.slice(1):A.slice(1,N)).toLowerCase(),de=cm(ue),pe=N===-1?"":A.slice(N+1).trim();C(A),o("command",de,pe),_e();return}if(s.busy){je();return}C(A),o("send",A),_e()}}function je(){const A=i.value.trim();A&&(C(A),k.value=[...k.value,A],_e())}function Qe(A){if(a.visible.value){if(A.key==="ArrowDown"){A.preventDefault(),a.move(1);return}if(A.key==="ArrowUp"){A.preventDefault(),a.move(-1);return}if((A.key==="Tab"||A.key==="Enter"&&!A.shiftKey)&&(A.isComposing||(A.preventDefault(),a.dirLoading.value)||a.confirm()))return;if(A.key==="Escape"){A.preventDefault(),a.dismiss();return}}if(p.value){if(A.key==="ArrowUp"){A.preventDefault(),c.value=(c.value-1+h.value.length)%h.value.length;return}if(A.key==="ArrowDown"){A.preventDefault(),c.value=(c.value+1)%h.value.length;return}if(A.key==="Tab"||A.key==="Enter"&&!A.shiftKey){if(A.key==="Enter"&&A.isComposing)return;A.preventDefault(),v();return}if(A.key==="Escape"){A.preventDefault(),u.value=!0;return}}if((A.ctrlKey||A.metaKey)&&A.key.toLowerCase()==="s"){A.preventDefault(),s.busy?je():Se();return}if(M.value&&!A.isComposing){if(A.key==="ArrowDown"){A.preventDefault(),T(1);return}if(A.key==="ArrowUp"){A.preventDefault(),T(-1);return}if(A.key==="Escape"){A.preventDefault(),M.value=!1;return}if((A.key==="Tab"||A.key==="Enter"&&!A.shiftKey)&&$.value[P.value]!==void 0){A.preventDefault(),x($.value[P.value]);return}}if(A.key==="Enter"&&!A.shiftKey){if(A.isComposing||Date.now()-w<100)return;A.preventDefault(),Se();return}A.key==="ArrowUp"&&!A.isComposing&&!s.busy&&i.value.trim().length===0&&$.value.length>0&&(A.preventDefault(),y())}function ge(){k.value=[],o("abort")}function he(A){i.value=A,M.value=!1,ft(()=>{var N;H(),(N=l.value)==null||N.focus()})}function Fe(A){i.value+=A,ft(()=>{var N;H(),(N=l.value)==null||N.focus()})}t({insertText:he,openModelPicker:G});const Y=q(()=>{var A;return(A=s.status)==null?void 0:A.model}),ae=q(()=>{var A;return(A=s.status)==null?void 0:A.permission}),V=q(()=>{var A;return(A=s.status)==null?void 0:A.contextUsage}),ve=q(()=>s.placeholder??(s.busy?"回合进行中:Enter/Ctrl+S 排队消息,随下一轮注入":"输入消息,@ 提及,/ 触发指令")),Oe=F(!1),Ue={off:"关闭",low:"低",medium:"中",high:"高",xhigh:"超高",max:"最大"},Pe=q(()=>{var A;return(A=s.status)==null?void 0:A.thinkingLevel}),_=q(()=>{const A=Pe.value;return!A||A==="none"?"":Ue[A]??A}),E=q(()=>s.models.length>0);function G(){return E.value?(Oe.value=!0,!0):!1}function Q(){E.value&&(Oe.value=!Oe.value)}function K(A){o("switch-model",A)}function X(A){o("switch-thinking",A)}const le=q(()=>{switch(ae.value){case"auto":return"perm-auto";case"yolo":return"perm-yolo";default:return"perm-manual"}}),ce=q(()=>{switch(ae.value){case"auto":return"自动";case"yolo":return"YOLO";default:return"手动"}});return(A,N)=>(g(),m("div",{class:"composer",style:Nt(B.value?{paddingBottom:B.value+"px"}:void 0)},[p.value?(g(),Xe(hy,{key:0,commands:h.value,"active-index":c.value,onSelect:v,onHover:N[0]||(N[0]=ue=>c.value=ue)},null,8,["commands","active-index"])):U("",!0),W(a).visible.value?(g(),Xe(Mv,{key:1,suggestions:W(a).suggestions.value,"active-index":W(a).index.value,loading:W(a).dirLoading.value,"work-dir":e.workDir,onSelect:N[1]||(N[1]=ue=>W(a).confirm(ue)),onHover:N[2]||(N[2]=ue=>W(a).index.value=ue)},null,8,["suggestions","active-index","loading","work-dir"])):U("",!0),M.value&&$.value.length>0?(g(),Xe(Hv,{key:2,items:$.value,"active-index":P.value,onApply:x,onHover:N[3]||(N[3]=ue=>P.value=ue)},null,8,["items","active-index"])):U("",!0),it(d("textarea",{ref_key:"textareaRef",ref:l,"onUpdate:modelValue":N[4]||(N[4]=ue=>i.value=ue),id:"composer-input",name:"message",class:"composer-input",rows:"1",placeholder:ve.value,onKeydown:Qe,onCompositionend:N[5]||(N[5]=ue=>ht(w)?w.value=Date.now():w=Date.now()),onClick:L,onKeyup:L},null,40,py),[[ut,i.value]]),d("div",gy,[d("div",my,[e.variant==="home"?(g(),m("button",{key:0,class:"quick-action",title:"插入 / 触发指令",onClick:N[6]||(N[6]=ue=>Fe("/"))},[J(me,{name:"command",size:15}),N[10]||(N[10]=d("span",null,"技能",-1))])):(g(),m(ee,{key:1},[d("button",{class:"quick-action",title:"插入 @ 提及",onClick:N[7]||(N[7]=ue=>Fe("@"))},[J(me,{name:"at",size:15}),N[11]||(N[11]=d("span",null,"提及",-1))]),d("button",{class:"quick-action",title:"插入 / 触发指令",onClick:N[8]||(N[8]=ue=>Fe("/"))},[J(me,{name:"command",size:15}),N[12]||(N[12]=d("span",null,"指令",-1))])],64)),ae.value?(g(),m("span",{key:2,class:fe(["permission-label",le.value]),title:`权限模式:${ae.value}`},R(ce.value),11,vy)):U("",!0),k.value.length?(g(),m("span",yy,"已排队 "+R(k.value.length)+" 条",1)):U("",!0)]),d("div",by,[Y.value?(g(),m("button",{key:0,class:fe(["model-select",{clickable:E.value}]),disabled:!E.value,title:e.variant==="home"?`当前模型:${Y.value}`:`当前模型:${Y.value}`,onClick:Q},[J(me,{name:"brain",size:15}),d("span",null,R(e.variant==="home"?"通用智能体":Y.value),1),e.variant!=="home"&&_.value?(g(),m(ee,{key:0},[Ce(" · "+R(_.value),1)],64)):U("",!0),E.value?(g(),Xe(me,{key:1,name:"chevron-down",size:12})):U("",!0)],10,ky)):U("",!0),J(_i,{name:"picker"},{default:Pt(()=>[Oe.value?(g(),Xe(oy,{key:0,models:e.models,"current-model":Y.value,"current-thinking":Pe.value,onApplyModel:K,onApplyThinking:X,onClose:N[9]||(N[9]=ue=>Oe.value=!1)},null,8,["models","current-model","current-thinking"])):U("",!0)]),_:1}),V.value!==void 0?(g(),m("span",wy,[J(sd,{usage:V.value,size:15},null,8,["usage"])])):U("",!0),e.busy?(g(),m("button",{key:2,class:"stop-btn",title:"停止当前回合",onClick:ge},[J(me,{name:"stop",size:14}),N[13]||(N[13]=d("span",null,"停止",-1))])):(g(),m("button",{key:3,class:"send-btn",disabled:!i.value.trim(),title:"发送 (Enter)","aria-label":"发送",onClick:Se},[J(me,{name:"arrow-up",size:16})],8,_y))])])],4))}}),od=Ie(Sy,[["__scopeId","data-v-ef09b90f"]]),$y={class:"conv-bar"},xy={class:"conv-bar-left"},Cy=["title"],Ty=["title"],Iy={key:1,class:"title-text"},Ry={class:"conv-bar-right"},Ay=["title","aria-label"],Ey=["title","aria-label","aria-expanded"],My={key:0,class:"stats-token mono"},Py=["title","aria-label"],Ly=Te({__name:"ConversationHeader",props:{title:{default:null},busy:{type:Boolean,default:!1},drawerOpen:{type:Boolean,default:!1},statsOpen:{type:Boolean,default:!1},turnTokens:{default:null}},emits:["home","rename","export","clear","toggle-drawer","toggle-stats"],setup(e,{emit:t}){const n=e,s=t;function o(f){return f===null||f<=0?"":f>=1e6?`${(f/1e6).toFixed(1)}M`:f>=1e3?`${(f/1e3).toFixed(1)}k`:String(f)}const i=F(!1),l=F("");function r(){l.value=n.title??"",i.value=!0}function a(){const f=l.value.trim();i.value=!1,f&&f!==n.title&&s("rename",f)}function c(f){f.key==="Enter"?(f.preventDefault(),a()):f.key==="Escape"&&(f.preventDefault(),i.value=!1)}const u=q(()=>n.busy?"运行中":"就绪");return(f,h)=>(g(),m("header",$y,[d("div",xy,[d("button",{class:"ghost-btn back-btn",title:"返回工作台","aria-label":"返回工作台",onClick:h[0]||(h[0]=p=>s("home"))},[J(me,{name:"chevron-left",size:20})]),d("span",{class:fe(["status-dot",{busy:e.busy}]),title:u.value,"aria-hidden":"true"},null,10,Cy),d("button",{class:"title-btn",title:i.value?"":"点击重命名",onClick:r},[i.value?it((g(),m("input",{key:0,"onUpdate:modelValue":h[1]||(h[1]=p=>l.value=p),class:"title-input","aria-label":"会话标题",onKeydown:c,onBlur:a,onClick:h[2]||(h[2]=rt(()=>{},["stop"]))},null,544)),[[ut,l.value]]):(g(),m("span",Iy,R(e.title||"新会话"),1))],8,Ty)]),d("div",Ry,[d("button",{class:"ghost-btn",title:"导出 Markdown","aria-label":"导出 Markdown",onClick:h[3]||(h[3]=p=>s("export"))},[J(me,{name:"download",size:18})]),d("button",{class:"ghost-btn",title:"清空本地消息","aria-label":"清空本地消息",onClick:h[4]||(h[4]=p=>s("clear"))},[J(me,{name:"broom",size:18})]),d("button",{class:fe(["ghost-btn",{active:e.drawerOpen}]),title:e.drawerOpen?"收起详情":"会话详情","aria-label":e.drawerOpen?"收起详情":"会话详情",onClick:h[5]||(h[5]=p=>s("toggle-drawer"))},[J(me,{name:"panel-right",size:18})],10,Ay),d("button",{class:fe(["ghost-btn stats-btn",{active:e.statsOpen}]),title:e.statsOpen?"收起会话统计":"会话统计","aria-label":e.statsOpen?"收起会话统计":"会话统计","aria-expanded":e.statsOpen,onPointerdown:h[6]||(h[6]=rt(()=>{},["stop"])),onClick:h[7]||(h[7]=p=>s("toggle-stats"))},[J(me,{name:"bar-chart",size:18}),o(e.turnTokens)?(g(),m("span",My,R(o(e.turnTokens)),1)):U("",!0)],42,Ey),d("button",{class:fe(["ghost-btn",{active:W($e).panelOpen}]),title:W($e).panelOpen?"收起文件面板":"打开文件面板","aria-label":W($e).panelOpen?"收起文件面板":"打开文件面板",onClick:h[8]||(h[8]=(...p)=>W(Da)&&W(Da)(...p))},[J(me,{name:"file",size:18})],10,Py)])]))}}),Oy=Ie(Ly,[["__scopeId","data-v-2090798b"]]),Dy={key:0,class:"ui-dialog-header"},Ny={class:"ui-dialog-title"},By={class:"ui-dialog-body"},Fy={key:1,class:"ui-dialog-footer"},jy='a[href], button:not([disabled]), textarea, input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',Uy=Te({__name:"Dialog",props:{open:{type:Boolean},title:{default:void 0},closable:{type:Boolean,default:!0},maxWidth:{default:void 0}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,o=F(null);let i=null;function l(){const a=o.value;return a?Array.from(a.querySelectorAll(jy)).filter(c=>c.offsetParent!==null||c===document.activeElement):[]}function r(a){var p,v,k;if(!n.open)return;if(a.key==="Escape"&&n.closable!==!1){a.stopPropagation(),s("close");return}if(a.key!=="Tab")return;const c=l();if(c.length===0){a.preventDefault(),(p=o.value)==null||p.focus();return}const u=c[0],f=c[c.length-1],h=document.activeElement;a.shiftKey?(h===u||!((v=o.value)!=null&&v.contains(h)))&&(a.preventDefault(),f.focus()):(h===f||!((k=o.value)!=null&&k.contains(h)))&&(a.preventDefault(),u.focus())}return Me(()=>n.open,a=>{a?(i=document.activeElement instanceof HTMLElement?document.activeElement:null,ft(()=>{const c=l()[0]??o.value;c==null||c.focus()})):i&&(i.focus(),i=null)},{immediate:!1}),ct(()=>window.addEventListener("keydown",r,!0)),Ct(()=>window.removeEventListener("keydown",r,!0)),(a,c)=>(g(),Xe(tr,{to:"body"},[J(_i,{name:"dialog"},{default:Pt(()=>[e.open?(g(),m("div",{key:0,class:"ui-dialog-overlay",onClick:c[1]||(c[1]=rt(u=>e.closable!==!1&&s("close"),["self"]))},[d("div",{ref_key:"dialogRef",ref:o,class:"ui-dialog",style:Nt(e.maxWidth?{maxWidth:e.maxWidth}:void 0),role:"dialog","aria-modal":"true",tabindex:"-1"},[e.title||a.$slots.header?(g(),m("div",Dy,[Co(a.$slots,"header",{},()=>[d("span",Ny,R(e.title),1)],!0),e.closable!==!1?(g(),m("button",{key:0,class:"ui-dialog-close","aria-label":"关闭",onClick:c[0]||(c[0]=u=>s("close"))},"✕")):U("",!0)])):U("",!0),d("div",By,[Co(a.$slots,"default",{},void 0,!0)]),a.$slots.footer?(g(),m("div",Fy,[Co(a.$slots,"footer",{},void 0,!0)])):U("",!0)],4)])):U("",!0)]),_:3})]))}}),Gy=Ie(Uy,[["__scopeId","data-v-396acebf"]]),zy={class:"info-row"},Hy={class:"info-val mono"},Wy={class:"info-row"},qy={class:"info-val mono"},Vy={class:"info-row"},Ky={class:"info-val"},Yy={class:"info-row"},Zy={class:"info-val"},Jy={class:"info-row"},Xy={class:"info-val"},Qy={class:"info-row"},eb={class:"info-val"},tb={class:"info-row"},nb={class:"info-val"},sb={class:"info-row"},ob={class:"info-val"},ib={class:"info-row"},lb={class:"info-val"},rb={class:"info-row"},ab={class:"info-val"},cb={key:0,class:"info-row"},ub={class:"info-val"},db={key:1,class:"info-row"},fb={class:"info-val"},hb={class:"info-val mono"},pb={class:"info-val"},gb={key:3,class:"info-empty"},mb=Te({__name:"InfoPanel",props:{mode:{},status:{},sessionId:{},workDir:{}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,o=q(()=>n.mode==="status"?"会话状态":"Token 用量");function i(p){switch(p){case"auto":return"自动 (auto)";case"yolo":return"YOLO";case"manual":return"手动 (manual)";default:return p??"-"}}function l(p){return p?"开启":"关闭"}function r(p){return p!=null}function a(p){return typeof p=="number"?p.toLocaleString():"-"}function c(p){return typeof p!="number"?"-":`${(p>1?p:p*100).toFixed(1)}%`}function u(p){return p?p.inputOther+p.output+p.inputCacheRead+p.inputCacheCreation:0}function f(p){return p!=null&&p.byModel?Object.entries(p.byModel).map(([v,k])=>({model:v,tokens:u(k),output:k.output,cacheRead:k.inputCacheRead})):[]}const h=q(()=>r(n.status.usage)||r(n.status.contextTokens));return(p,v)=>(g(),Xe(Gy,{open:!0,title:o.value,onClose:v[0]||(v[0]=k=>s("close"))},{default:Pt(()=>{var k,w;return[e.mode==="status"?(g(),m(ee,{key:0},[d("div",zy,[v[1]||(v[1]=d("span",{class:"info-key"},"会话 ID",-1)),d("span",Hy,R(e.sessionId??"-"),1)]),d("div",Wy,[v[2]||(v[2]=d("span",{class:"info-key"},"工作目录",-1)),d("span",qy,R(e.workDir??"-"),1)]),d("div",Vy,[v[3]||(v[3]=d("span",{class:"info-key"},"模型",-1)),d("span",Ky,R(e.status.model??"-"),1)]),d("div",Yy,[v[4]||(v[4]=d("span",{class:"info-key"},"权限模式",-1)),d("span",Zy,R(i(e.status.permission)),1)]),d("div",Jy,[v[5]||(v[5]=d("span",{class:"info-key"},"思考级别",-1)),d("span",Xy,R(e.status.thinkingLevel??"-"),1)]),d("div",Qy,[v[6]||(v[6]=d("span",{class:"info-key"},"计划模式",-1)),d("span",eb,R(l(e.status.planMode)),1)]),d("div",tb,[v[7]||(v[7]=d("span",{class:"info-key"},"WolfPack 模式",-1)),d("span",nb,R(l(e.status.wolfpackMode)),1)]),d("div",sb,[v[8]||(v[8]=d("span",{class:"info-key"},"上下文",-1)),d("span",ob,R(a(e.status.contextTokens))+" / "+R(a(e.status.maxContextTokens))+" ("+R(c(e.status.contextUsage))+")",1)])],64)):(g(),m(ee,{key:1},[d("div",ib,[v[9]||(v[9]=d("span",{class:"info-key"},"上下文 Token",-1)),d("span",lb,R(a(e.status.contextTokens))+" / "+R(a(e.status.maxContextTokens)),1)]),d("div",rb,[v[10]||(v[10]=d("span",{class:"info-key"},"上下文占比",-1)),d("span",ab,R(c(e.status.contextUsage)),1)]),(k=e.status.usage)!=null&&k.total?(g(),m("div",cb,[v[11]||(v[11]=d("span",{class:"info-key"},"累计 Token",-1)),d("span",ub,R(a(u(e.status.usage.total))),1)])):U("",!0),(w=e.status.usage)!=null&&w.currentTurn?(g(),m("div",db,[v[12]||(v[12]=d("span",{class:"info-key"},"当前回合",-1)),d("span",fb,R(a(u(e.status.usage.currentTurn))),1)])):U("",!0),f(e.status.usage).length?(g(),m(ee,{key:2},[v[13]||(v[13]=d("div",{class:"info-subhead"},"按模型",-1)),(g(!0),m(ee,null,Ee(f(e.status.usage),S=>(g(),m("div",{key:S.model,class:"info-row info-row-model"},[d("span",hb,R(S.model),1),d("span",pb,R(a(S.tokens))+"(输出 "+R(a(S.output))+" · 缓存读 "+R(a(S.cacheRead))+")",1)]))),128))],64)):U("",!0),h.value?U("",!0):(g(),m("div",gb,"暂无用量数据"))],64))]}),_:1},8,["title"]))}}),vb=Ie(mb,[["__scopeId","data-v-1555711d"]]);function yb(e,t=Date.now()){const n=new Date(e),s=new Date(t),o=n.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()&&n.getDate()===s.getDate()?o:`${n.getFullYear()===s.getFullYear()?`${n.getMonth()+1}月${n.getDate()}日`:`${n.getFullYear()}年${n.getMonth()+1}月${n.getDate()}日`} ${o}`}function bb(e,t){const n=new Date(e),s=new Date(t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()&&n.getDate()===s.getDate()}function kb(e,t=Date.now()){const n=new Date(e),s=new Date(t);return n.getFullYear()===s.getFullYear()?`${n.getMonth()+1}月${n.getDate()}日`:`${n.getFullYear()}年${n.getMonth()+1}月${n.getDate()}日`}const wb=new Set(["edit","str_replace","replace","write","multi_edit","create_file","edit_file","apply_patch"]);function id(e){return wb.has(e.toLowerCase())}function xi(e,t=!0){return e.suspended?"suspended":e.isError?"error":e.output===void 0?t?"running":"unknown":"ok"}function _b(e,t=!0){const n=new Set(e.map(s=>xi(s,t)));return n.has("running")?"running":n.has("error")?"error":n.has("suspended")?"suspended":n.has("unknown")?"unknown":"ok"}function Sb(e){if(!e||typeof e!="object")return null;const t=e,n=t.file_path??t.path;return typeof n=="string"&&n.length>0?n:null}function ur(e,t){if(e.startsWith("/")||e.startsWith("~"))return e;let n=e;for(;n.startsWith("./");)n=n.slice(2);return t?`${t.replace(/\/+$/,"")}/${n}`:n}function $b(e,t){const n=new Set,s=[];for(const o of e.tools){if(!id(o.name)||xi(o,!1)!=="ok")continue;const i=Sb(o.args);if(!i)continue;const l=ur(i,t);n.has(l)||(n.add(l),s.push({filePath:l,toolName:o.name}))}return s}function dr(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Xn=dr();function ld(e){Xn=e}var Bs={exec:()=>null};function Ve(e,t=""){let n=typeof e=="string"?e:e.source;const s={replace:(o,i)=>{let l=typeof i=="string"?i:i.source;return l=l.replace(At.caret,"$1"),n=n.replace(o,l),s},getRegex:()=>new RegExp(n,t)};return s}var At={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},xb=/^(?:[ \t]*(?:\n|$))+/,Cb=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Tb=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,oo=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Ib=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,fr=/(?:[*+-]|\d{1,9}[.)])/,rd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ad=Ve(rd).replace(/bull/g,fr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Rb=Ve(rd).replace(/bull/g,fr).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),hr=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ab=/^[^\n]+/,pr=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Eb=Ve(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",pr).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Mb=Ve(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,fr).getRegex(),Ci="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",gr=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Pb=Ve("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",gr).replace("tag",Ci).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cd=Ve(hr).replace("hr",oo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ci).getRegex(),Lb=Ve(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",cd).getRegex(),mr={blockquote:Lb,code:Cb,def:Eb,fences:Tb,heading:Ib,hr:oo,html:Pb,lheading:ad,list:Mb,newline:xb,paragraph:cd,table:Bs,text:Ab},ja=Ve("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",oo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ci).getRegex(),Ob={...mr,lheading:Rb,table:ja,paragraph:Ve(hr).replace("hr",oo).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",ja).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Ci).getRegex()},Db={...mr,html:Ve(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",gr).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Bs,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ve(hr).replace("hr",oo).replace("heading",` *#{1,6} *[^
|
|
20
|
-
]`).replace("lheading",ad).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Nb=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Bb=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ud=/^( {2,}|\\)\n(?!\s*$)/,Fb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Ti=/[\p{P}\p{S}]/u,vr=/[\s\p{P}\p{S}]/u,dd=/[^\s\p{P}\p{S}]/u,jb=Ve(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,vr).getRegex(),fd=/(?!~)[\p{P}\p{S}]/u,Ub=/(?!~)[\s\p{P}\p{S}]/u,Gb=/(?:[^\s\p{P}\p{S}]|~)/u,zb=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,hd=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Hb=Ve(hd,"u").replace(/punct/g,Ti).getRegex(),Wb=Ve(hd,"u").replace(/punct/g,fd).getRegex(),pd="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",qb=Ve(pd,"gu").replace(/notPunctSpace/g,dd).replace(/punctSpace/g,vr).replace(/punct/g,Ti).getRegex(),Vb=Ve(pd,"gu").replace(/notPunctSpace/g,Gb).replace(/punctSpace/g,Ub).replace(/punct/g,fd).getRegex(),Kb=Ve("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,dd).replace(/punctSpace/g,vr).replace(/punct/g,Ti).getRegex(),Yb=Ve(/\\(punct)/,"gu").replace(/punct/g,Ti).getRegex(),Zb=Ve(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Jb=Ve(gr).replace("(?:-->|$)","-->").getRegex(),Xb=Ve("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Jb).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Vo=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,Qb=Ve(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",Vo).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gd=Ve(/^!?\[(label)\]\[(ref)\]/).replace("label",Vo).replace("ref",pr).getRegex(),md=Ve(/^!?\[(ref)\](?:\[\])?/).replace("ref",pr).getRegex(),e1=Ve("reflink|nolink(?!\\()","g").replace("reflink",gd).replace("nolink",md).getRegex(),yr={_backpedal:Bs,anyPunctuation:Yb,autolink:Zb,blockSkip:zb,br:ud,code:Bb,del:Bs,emStrongLDelim:Hb,emStrongRDelimAst:qb,emStrongRDelimUnd:Kb,escape:Nb,link:Qb,nolink:md,punctuation:jb,reflink:gd,reflinkSearch:e1,tag:Xb,text:Fb,url:Bs},t1={...yr,link:Ve(/^!?\[(label)\]\((.*?)\)/).replace("label",Vo).getRegex(),reflink:Ve(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Vo).getRegex()},Il={...yr,emStrongRDelimAst:Vb,emStrongLDelim:Wb,url:Ve(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},n1={...Il,br:Ve(ud).replace("{2,}","*").getRegex(),text:Ve(Il.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},vo={normal:mr,gfm:Ob,pedantic:Db},xs={normal:yr,gfm:Il,breaks:n1,pedantic:t1},s1={"&":"&","<":"<",">":">",'"':""","'":"'"},Ua=e=>s1[e];function en(e,t){if(t){if(At.escapeTest.test(e))return e.replace(At.escapeReplace,Ua)}else if(At.escapeTestNoEncode.test(e))return e.replace(At.escapeReplaceNoEncode,Ua);return e}function Ga(e){try{e=encodeURI(e).replace(At.percentDecode,"%")}catch{return null}return e}function za(e,t){var i;const n=e.replace(At.findPipe,(l,r,a)=>{let c=!1,u=r;for(;--u>=0&&a[u]==="\\";)c=!c;return c?"|":" |"}),s=n.split(At.splitPipe);let o=0;if(s[0].trim()||s.shift(),s.length>0&&!((i=s.at(-1))!=null&&i.trim())&&s.pop(),t)if(s.length>t)s.splice(t);else for(;s.length<t;)s.push("");for(;o<s.length;o++)s[o]=s[o].trim().replace(At.slashPipe,"|");return s}function Cs(e,t,n){const s=e.length;if(s===0)return"";let o=0;for(;o<s&&e.charAt(s-o-1)===t;)o++;return e.slice(0,s-o)}function o1(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let s=0;s<e.length;s++)if(e[s]==="\\")s++;else if(e[s]===t[0])n++;else if(e[s]===t[1]&&(n--,n<0))return s;return n>0?-2:-1}function Ha(e,t,n,s,o){const i=t.href,l=t.title||null,r=e[1].replace(o.other.outputLinkReplace,"$1");s.state.inLink=!0;const a={type:e[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:l,text:r,tokens:s.inlineTokens(r)};return s.state.inLink=!1,a}function i1(e,t,n){const s=e.match(n.other.indentCodeCompensation);if(s===null)return t;const o=s[1];return t.split(`
|
|
21
|
-
`).map(i=>{const l=i.match(n.other.beginningSpace);if(l===null)return i;const[r]=l;return r.length>=o.length?i.slice(o.length):i}).join(`
|
|
22
|
-
`)}var Ko=class{constructor(e){z(this,"options");z(this,"rules");z(this,"lexer");this.options=e||Xn}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Cs(n,`
|
|
23
|
-
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],s=i1(n,t[3]||"",this.rules);return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(this.rules.other.endingHash.test(n)){const s=Cs(n,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(n=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Cs(t[0],`
|
|
24
|
-
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let n=Cs(t[0],`
|
|
25
|
-
`).split(`
|
|
26
|
-
`),s="",o="";const i=[];for(;n.length>0;){let l=!1;const r=[];let a;for(a=0;a<n.length;a++)if(this.rules.other.blockquoteStart.test(n[a]))r.push(n[a]),l=!0;else if(!l)r.push(n[a]);else break;n=n.slice(a);const c=r.join(`
|
|
27
|
-
`),u=c.replace(this.rules.other.blockquoteSetextReplace,`
|
|
28
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
29
|
-
${c}`:c,o=o?`${o}
|
|
30
|
-
${u}`:u;const f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=f,n.length===0)break;const h=i.at(-1);if((h==null?void 0:h.type)==="code")break;if((h==null?void 0:h.type)==="blockquote"){const p=h,v=p.raw+`
|
|
31
|
-
`+n.join(`
|
|
32
|
-
`),k=this.blockquote(v);i[i.length-1]=k,s=s.substring(0,s.length-p.raw.length)+k.raw,o=o.substring(0,o.length-p.text.length)+k.text;break}else if((h==null?void 0:h.type)==="list"){const p=h,v=p.raw+`
|
|
33
|
-
`+n.join(`
|
|
34
|
-
`),k=this.list(v);i[i.length-1]=k,s=s.substring(0,s.length-h.raw.length)+k.raw,o=o.substring(0,o.length-p.raw.length)+k.raw,n=v.substring(i.at(-1).raw.length).split(`
|
|
35
|
-
`);continue}}return{type:"blockquote",raw:s,tokens:i,text:o}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim();const s=n.length>1,o={type:"list",raw:"",ordered:s,start:s?+n.slice(0,-1):"",loose:!1,items:[]};n=s?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=s?n:"[*+-]");const i=this.rules.other.listItemRegex(n);let l=!1;for(;e;){let a=!1,c="",u="";if(!(t=i.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let f=t[2].split(`
|
|
36
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,S=>" ".repeat(3*S.length)),h=e.split(`
|
|
37
|
-
`,1)[0],p=!f.trim(),v=0;if(this.options.pedantic?(v=2,u=f.trimStart()):p?v=t[1].length+1:(v=t[2].search(this.rules.other.nonSpaceChar),v=v>4?1:v,u=f.slice(v),v+=t[1].length),p&&this.rules.other.blankLine.test(h)&&(c+=h+`
|
|
38
|
-
`,e=e.substring(h.length+1),a=!0),!a){const S=this.rules.other.nextBulletRegex(v),$=this.rules.other.hrRegex(v),M=this.rules.other.fencesBeginRegex(v),P=this.rules.other.headingBeginRegex(v),Z=this.rules.other.htmlBeginRegex(v);for(;e;){const j=e.split(`
|
|
39
|
-
`,1)[0];let C;if(h=j,this.options.pedantic?(h=h.replace(this.rules.other.listReplaceNesting," "),C=h):C=h.replace(this.rules.other.tabCharGlobal," "),M.test(h)||P.test(h)||Z.test(h)||S.test(h)||$.test(h))break;if(C.search(this.rules.other.nonSpaceChar)>=v||!h.trim())u+=`
|
|
40
|
-
`+C.slice(v);else{if(p||f.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(f)||P.test(f)||$.test(f))break;u+=`
|
|
41
|
-
`+h}!p&&!h.trim()&&(p=!0),c+=j+`
|
|
42
|
-
`,e=e.substring(j.length+1),f=C.slice(v)}}o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(c)&&(l=!0));let k=null,w;this.options.gfm&&(k=this.rules.other.listIsTask.exec(u),k&&(w=k[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),o.items.push({type:"list_item",raw:c,task:!!k,checked:w,loose:!1,text:u,tokens:[]}),o.raw+=c}const r=o.items.at(-1);if(r)r.raw=r.raw.trimEnd(),r.text=r.text.trimEnd();else return;o.raw=o.raw.trimEnd();for(let a=0;a<o.items.length;a++)if(this.lexer.state.top=!1,o.items[a].tokens=this.lexer.blockTokens(o.items[a].text,[]),!o.loose){const c=o.items[a].tokens.filter(f=>f.type==="space"),u=c.length>0&&c.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=u}if(o.loose)for(let a=0;a<o.items.length;a++)o.items[a].loose=!0;return o}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:s,title:o}}}table(e){var l;const t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;const n=za(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),o=(l=t[3])!=null&&l.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
43
|
-
`):[],i={type:"table",raw:t[0],header:[],align:[],rows:[]};if(n.length===s.length){for(const r of s)this.rules.other.tableAlignRight.test(r)?i.align.push("right"):this.rules.other.tableAlignCenter.test(r)?i.align.push("center"):this.rules.other.tableAlignLeft.test(r)?i.align.push("left"):i.align.push(null);for(let r=0;r<n.length;r++)i.header.push({text:n[r],tokens:this.lexer.inline(n[r]),header:!0,align:i.align[r]});for(const r of o)i.rows.push(za(r,i.header.length).map((a,c)=>({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[c]})));return i}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
|
|
44
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const i=Cs(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{const i=o1(t[2],"()");if(i===-2)return;if(i>-1){const r=(t[0].indexOf("!")===0?5:4)+t[1].length+i;t[2]=t[2].substring(0,i),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let s=t[2],o="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(s);i&&(s=i[1],o=i[3])}else o=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Ha(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){const s=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),o=t[s.toLowerCase()];if(!o){const i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return Ha(n,o,n[0],this.lexer,this.rules)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const i=[...s[0]].length-1;let l,r,a=i,c=0;const u=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,t=t.slice(-1*e.length+i);(s=u.exec(t))!=null;){if(l=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!l)continue;if(r=[...l].length,s[3]||s[4]){a+=r;continue}else if((s[5]||s[6])&&i%3&&!((i+r)%3)){c+=r;continue}if(a-=r,a>0)continue;r=Math.min(r,r+a+c);const f=[...s[0]][0].length,h=e.slice(0,i+s.index+f+r);if(Math.min(i,r)%2){const v=h.slice(1,-1);return{type:"em",raw:h,text:v,tokens:this.lexer.inlineTokens(v)}}const p=h.slice(2,-2);return{type:"strong",raw:h,text:p,tokens:this.lexer.inlineTokens(p)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(this.rules.other.newLineCharGlobal," ");const s=this.rules.other.nonSpaceChar.test(n),o=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return s&&o&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let n,s;return t[2]==="@"?(n=t[1],s="mailto:"+n):(n=t[1],s=n),{type:"link",raw:t[0],text:n,href:s,tokens:[{type:"text",raw:n,text:n}]}}}url(e){var n;let t;if(t=this.rules.inline.url.exec(e)){let s,o;if(t[2]==="@")s=t[0],o="mailto:"+s;else{let i;do i=t[0],t[0]=((n=this.rules.inline._backpedal.exec(t[0]))==null?void 0:n[0])??"";while(i!==t[0]);s=t[0],t[1]==="www."?o="http://"+t[0]:o=t[0]}return{type:"link",raw:t[0],text:s,href:o,tokens:[{type:"text",raw:s,text:s}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){const n=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:n}}}},pn=class Rl{constructor(t){z(this,"tokens");z(this,"options");z(this,"state");z(this,"tokenizer");z(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Xn,this.options.tokenizer=this.options.tokenizer||new Ko,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:At,block:vo.normal,inline:xs.normal};this.options.pedantic?(n.block=vo.pedantic,n.inline=xs.pedantic):this.options.gfm&&(n.block=vo.gfm,this.options.breaks?n.inline=xs.breaks:n.inline=xs.gfm),this.tokenizer.rules=n}static get rules(){return{block:vo,inline:xs}}static lex(t,n){return new Rl(n).lex(t)}static lexInline(t,n){return new Rl(n).inlineTokens(t)}lex(t){t=t.replace(At.carriageReturn,`
|
|
45
|
-
`),this.blockTokens(t,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const s=this.inlineQueue[n];this.inlineTokens(s.src,s.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,n=[],s=!1){var o,i,l;for(this.options.pedantic&&(t=t.replace(At.tabCharGlobal," ").replace(At.spaceLine,""));t;){let r;if((i=(o=this.options.extensions)==null?void 0:o.block)!=null&&i.some(c=>(r=c.call({lexer:this},t,n))?(t=t.substring(r.raw.length),n.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);const c=n.at(-1);r.raw.length===1&&c!==void 0?c.raw+=`
|
|
46
|
-
`:n.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);const c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
47
|
-
`+r.raw,c.text+=`
|
|
48
|
-
`+r.text,this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(r=this.tokenizer.fences(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.heading(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.hr(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.blockquote(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.list(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.html(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.def(t)){t=t.substring(r.raw.length);const c=n.at(-1);(c==null?void 0:c.type)==="paragraph"||(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
49
|
-
`+r.raw,c.text+=`
|
|
50
|
-
`+r.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title});continue}if(r=this.tokenizer.table(t)){t=t.substring(r.raw.length),n.push(r);continue}if(r=this.tokenizer.lheading(t)){t=t.substring(r.raw.length),n.push(r);continue}let a=t;if((l=this.options.extensions)!=null&&l.startBlock){let c=1/0;const u=t.slice(1);let f;this.options.extensions.startBlock.forEach(h=>{f=h.call({lexer:this},u),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(a=t.substring(0,c+1))}if(this.state.top&&(r=this.tokenizer.paragraph(a))){const c=n.at(-1);s&&(c==null?void 0:c.type)==="paragraph"?(c.raw+=`
|
|
51
|
-
`+r.raw,c.text+=`
|
|
52
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r),s=a.length!==t.length,t=t.substring(r.raw.length);continue}if(r=this.tokenizer.text(t)){t=t.substring(r.raw.length);const c=n.at(-1);(c==null?void 0:c.type)==="text"?(c.raw+=`
|
|
53
|
-
`+r.raw,c.text+=`
|
|
54
|
-
`+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):n.push(r);continue}if(t){const c="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,n}inline(t,n=[]){return this.inlineQueue.push({src:t,tokens:n}),n}inlineTokens(t,n=[]){var r,a,c;let s=t,o=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(s))!=null;)u.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(s))!=null;)s=s.slice(0,o.index)+"++"+s.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(o=this.tokenizer.rules.inline.blockSkip.exec(s))!=null;)s=s.slice(0,o.index)+"["+"a".repeat(o[0].length-2)+"]"+s.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,l="";for(;t;){i||(l=""),i=!1;let u;if((a=(r=this.options.extensions)==null?void 0:r.inline)!=null&&a.some(h=>(u=h.call({lexer:this},t,n))?(t=t.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.escape(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.tag(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.link(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(u.raw.length);const h=n.at(-1);u.type==="text"&&(h==null?void 0:h.type)==="text"?(h.raw+=u.raw,h.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(t,s,l)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.codespan(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.br(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.del(t)){t=t.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(t)){t=t.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(t))){t=t.substring(u.raw.length),n.push(u);continue}let f=t;if((c=this.options.extensions)!=null&&c.startInline){let h=1/0;const p=t.slice(1);let v;this.options.extensions.startInline.forEach(k=>{v=k.call({lexer:this},p),typeof v=="number"&&v>=0&&(h=Math.min(h,v))}),h<1/0&&h>=0&&(f=t.substring(0,h+1))}if(u=this.tokenizer.inlineText(f)){t=t.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(l=u.raw.slice(-1)),i=!0;const h=n.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=u.raw,h.text+=u.text):n.push(u);continue}if(t){const h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return n}},Yo=class{constructor(e){z(this,"options");z(this,"parser");this.options=e||Xn}space(e){return""}code({text:e,lang:t,escaped:n}){var i;const s=(i=(t||"").match(At.notSpaceStart))==null?void 0:i[0],o=e.replace(At.endingNewline,"")+`
|
|
55
|
-
`;return s?'<pre><code class="language-'+en(s)+'">'+(n?o:en(o,!0))+`</code></pre>
|
|
56
|
-
`:"<pre><code>"+(n?o:en(o,!0))+`</code></pre>
|
|
57
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
58
|
-
${this.parser.parse(e)}</blockquote>
|
|
59
|
-
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
60
|
-
`}hr(e){return`<hr>
|
|
61
|
-
`}list(e){const t=e.ordered,n=e.start;let s="";for(let l=0;l<e.items.length;l++){const r=e.items[l];s+=this.listitem(r)}const o=t?"ol":"ul",i=t&&n!==1?' start="'+n+'"':"";return"<"+o+i+`>
|
|
62
|
-
`+s+"</"+o+`>
|
|
63
|
-
`}listitem(e){var n;let t="";if(e.task){const s=this.checkbox({checked:!!e.checked});e.loose?((n=e.tokens[0])==null?void 0:n.type)==="paragraph"?(e.tokens[0].text=s+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=s+" "+en(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:s+" ",text:s+" ",escaped:!0}):t+=s+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
|
|
64
|
-
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
65
|
-
`}table(e){let t="",n="";for(let o=0;o<e.header.length;o++)n+=this.tablecell(e.header[o]);t+=this.tablerow({text:n});let s="";for(let o=0;o<e.rows.length;o++){const i=e.rows[o];n="";for(let l=0;l<i.length;l++)n+=this.tablecell(i[l]);s+=this.tablerow({text:n})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
66
|
-
<thead>
|
|
67
|
-
`+t+`</thead>
|
|
68
|
-
`+s+`</table>
|
|
69
|
-
`}tablerow({text:e}){return`<tr>
|
|
70
|
-
${e}</tr>
|
|
71
|
-
`}tablecell(e){const t=this.parser.parseInline(e.tokens),n=e.header?"th":"td";return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
72
|
-
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${en(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){const s=this.parser.parseInline(n),o=Ga(e);if(o===null)return s;e=o;let i='<a href="'+e+'"';return t&&(i+=' title="'+en(t)+'"'),i+=">"+s+"</a>",i}image({href:e,title:t,text:n,tokens:s}){s&&(n=this.parser.parseInline(s,this.parser.textRenderer));const o=Ga(e);if(o===null)return en(n);e=o;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${en(t)}"`),i+=">",i}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:en(e.text)}},br=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},gn=class Al{constructor(t){z(this,"options");z(this,"renderer");z(this,"textRenderer");this.options=t||Xn,this.options.renderer=this.options.renderer||new Yo,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new br}static parse(t,n){return new Al(n).parse(t)}static parseInline(t,n){return new Al(n).parseInline(t)}parse(t,n=!0){var o,i;let s="";for(let l=0;l<t.length;l++){const r=t[l];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[r.type]){const c=r,u=this.options.extensions.renderers[c.type].call({parser:this},c);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(c.type)){s+=u||"";continue}}const a=r;switch(a.type){case"space":{s+=this.renderer.space(a);continue}case"hr":{s+=this.renderer.hr(a);continue}case"heading":{s+=this.renderer.heading(a);continue}case"code":{s+=this.renderer.code(a);continue}case"table":{s+=this.renderer.table(a);continue}case"blockquote":{s+=this.renderer.blockquote(a);continue}case"list":{s+=this.renderer.list(a);continue}case"html":{s+=this.renderer.html(a);continue}case"paragraph":{s+=this.renderer.paragraph(a);continue}case"text":{let c=a,u=this.renderer.text(c);for(;l+1<t.length&&t[l+1].type==="text";)c=t[++l],u+=`
|
|
73
|
-
`+this.renderer.text(c);n?s+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):s+=u;continue}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}parseInline(t,n=this.renderer){var o,i;let s="";for(let l=0;l<t.length;l++){const r=t[l];if((i=(o=this.options.extensions)==null?void 0:o.renderers)!=null&&i[r.type]){const c=this.options.extensions.renderers[r.type].call({parser:this},r);if(c!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(r.type)){s+=c||"";continue}}const a=r;switch(a.type){case"escape":{s+=n.text(a);break}case"html":{s+=n.html(a);break}case"link":{s+=n.link(a);break}case"image":{s+=n.image(a);break}case"strong":{s+=n.strong(a);break}case"em":{s+=n.em(a);break}case"codespan":{s+=n.codespan(a);break}case"br":{s+=n.br(a);break}case"del":{s+=n.del(a);break}case"text":{s+=n.text(a);break}default:{const c='Token with "'+a.type+'" type was not found.';if(this.options.silent)return console.error(c),"";throw new Error(c)}}}return s}},dl,Ao=(dl=class{constructor(e){z(this,"options");z(this,"block");this.options=e||Xn}preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?pn.lex:pn.lexInline}provideParser(){return this.block?gn.parse:gn.parseInline}},z(dl,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),dl),l1=class{constructor(...e){z(this,"defaults",dr());z(this,"options",this.setOptions);z(this,"parse",this.parseMarkdown(!0));z(this,"parseInline",this.parseMarkdown(!1));z(this,"Parser",gn);z(this,"Renderer",Yo);z(this,"TextRenderer",br);z(this,"Lexer",pn);z(this,"Tokenizer",Ko);z(this,"Hooks",Ao);this.use(...e)}walkTokens(e,t){var s,o;let n=[];for(const i of e)switch(n=n.concat(t.call(this,i)),i.type){case"table":{const l=i;for(const r of l.header)n=n.concat(this.walkTokens(r.tokens,t));for(const r of l.rows)for(const a of r)n=n.concat(this.walkTokens(a.tokens,t));break}case"list":{const l=i;n=n.concat(this.walkTokens(l.items,t));break}default:{const l=i;(o=(s=this.defaults.extensions)==null?void 0:s.childTokens)!=null&&o[l.type]?this.defaults.extensions.childTokens[l.type].forEach(r=>{const a=l[r].flat(1/0);n=n.concat(this.walkTokens(a,t))}):l.tokens&&(n=n.concat(this.walkTokens(l.tokens,t)))}}return n}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(n=>{const s={...n};if(s.async=this.defaults.async||s.async||!1,n.extensions&&(n.extensions.forEach(o=>{if(!o.name)throw new Error("extension name required");if("renderer"in o){const i=t.renderers[o.name];i?t.renderers[o.name]=function(...l){let r=o.renderer.apply(this,l);return r===!1&&(r=i.apply(this,l)),r}:t.renderers[o.name]=o.renderer}if("tokenizer"in o){if(!o.level||o.level!=="block"&&o.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=t[o.level];i?i.unshift(o.tokenizer):t[o.level]=[o.tokenizer],o.start&&(o.level==="block"?t.startBlock?t.startBlock.push(o.start):t.startBlock=[o.start]:o.level==="inline"&&(t.startInline?t.startInline.push(o.start):t.startInline=[o.start]))}"childTokens"in o&&o.childTokens&&(t.childTokens[o.name]=o.childTokens)}),s.extensions=t),n.renderer){const o=this.defaults.renderer||new Yo(this.defaults);for(const i in n.renderer){if(!(i in o))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const l=i,r=n.renderer[l],a=o[l];o[l]=(...c)=>{let u=r.apply(o,c);return u===!1&&(u=a.apply(o,c)),u||""}}s.renderer=o}if(n.tokenizer){const o=this.defaults.tokenizer||new Ko(this.defaults);for(const i in n.tokenizer){if(!(i in o))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const l=i,r=n.tokenizer[l],a=o[l];o[l]=(...c)=>{let u=r.apply(o,c);return u===!1&&(u=a.apply(o,c)),u}}s.tokenizer=o}if(n.hooks){const o=this.defaults.hooks||new Ao;for(const i in n.hooks){if(!(i in o))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const l=i,r=n.hooks[l],a=o[l];Ao.passThroughHooks.has(i)?o[l]=c=>{if(this.defaults.async)return Promise.resolve(r.call(o,c)).then(f=>a.call(o,f));const u=r.call(o,c);return a.call(o,u)}:o[l]=(...c)=>{let u=r.apply(o,c);return u===!1&&(u=a.apply(o,c)),u}}s.hooks=o}if(n.walkTokens){const o=this.defaults.walkTokens,i=n.walkTokens;s.walkTokens=function(l){let r=[];return r.push(i.call(this,l)),o&&(r=r.concat(o.call(this,l))),r}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return pn.lex(e,t??this.defaults)}parser(e,t){return gn.parse(e,t??this.defaults)}parseMarkdown(e){return(n,s)=>{const o={...s},i={...this.defaults,...o},l=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&o.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=e);const r=i.hooks?i.hooks.provideLexer():e?pn.lex:pn.lexInline,a=i.hooks?i.hooks.provideParser():e?gn.parse:gn.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then(c=>r(c,i)).then(c=>i.hooks?i.hooks.processAllTokens(c):c).then(c=>i.walkTokens?Promise.all(this.walkTokens(c,i.walkTokens)).then(()=>c):c).then(c=>a(c,i)).then(c=>i.hooks?i.hooks.postprocess(c):c).catch(l);try{i.hooks&&(n=i.hooks.preprocess(n));let c=r(n,i);i.hooks&&(c=i.hooks.processAllTokens(c)),i.walkTokens&&this.walkTokens(c,i.walkTokens);let u=a(c,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(c){return l(c)}}}onError(e,t){return n=>{if(n.message+=`
|
|
74
|
-
Please report this to https://github.com/markedjs/marked.`,e){const s="<p>An error occurred:</p><pre>"+en(n.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}},Jn=new l1;function We(e,t){return Jn.parse(e,t)}We.options=We.setOptions=function(e){return Jn.setOptions(e),We.defaults=Jn.defaults,ld(We.defaults),We};We.getDefaults=dr;We.defaults=Xn;We.use=function(...e){return Jn.use(...e),We.defaults=Jn.defaults,ld(We.defaults),We};We.walkTokens=function(e,t){return Jn.walkTokens(e,t)};We.parseInline=Jn.parseInline;We.Parser=gn;We.parser=gn.parse;We.Renderer=Yo;We.TextRenderer=br;We.Lexer=pn;We.lexer=pn.lex;We.Tokenizer=Ko;We.Hooks=Ao;We.parse=We;We.options;We.setOptions;We.use;We.walkTokens;We.parseInline;gn.parse;pn.lex;const r1="modulepreload",a1=function(e,t){return new URL(e,t).href},Wa={},yo=function(t,n,s){let o=Promise.resolve();if(n&&n.length>0){let l=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};const r=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));o=l(n.map(u=>{if(u=a1(u,s),u in Wa)return;Wa[u]=!0;const f=u.endsWith(".css"),h=f?'[rel="stylesheet"]':"";if(!!s)for(let k=r.length-1;k>=0;k--){const w=r[k];if(w.href===u&&(!f||w.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${u}"]${h}`))return;const v=document.createElement("link");if(v.rel=f?"stylesheet":r1,f||(v.as="script"),v.crossOrigin="",v.href=u,c&&v.setAttribute("nonce",c),document.head.appendChild(v),f)return new Promise((k,w)=>{v.addEventListener("load",k),v.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(l){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=l,window.dispatchEvent(r),!r.defaultPrevented)throw l}return o.then(l=>{for(const r of l||[])r.status==="rejected"&&i(r.reason);return t().catch(i)})};let mt=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function c1(e){return kr(e)}function kr(e){return Array.isArray(e)?u1(e):e instanceof RegExp?e:typeof e=="object"?d1(e):e}function u1(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=kr(e[n]);return t}function d1(e){let t={};for(let n in e)t[n]=kr(e[n]);return t}function vd(e,...t){return t.forEach(n=>{for(let s in n)e[s]=n[s]}),e}function yd(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?yd(e.substring(0,e.length-1)):e.substr(~t+1)}var Zi=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,bo=class{static hasCaptures(e){return e===null?!1:(Zi.lastIndex=0,Zi.test(e))}static replaceCaptures(e,t,n){return e.replace(Zi,(s,o,i,l)=>{let r=n[parseInt(o||i,10)];if(r){let a=t.substring(r.start,r.end);for(;a[0]===".";)a=a.substring(1);switch(l){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return s})}};function bd(e,t){return e<t?-1:e>t?1:0}function kd(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let o=0;o<n;o++){let i=bd(e[o],t[o]);if(i!==0)return i}return 0}return n-s}function qa(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function wd(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var _d=class{constructor(e){z(this,"cache",new Map);this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Zo=class{constructor(e,t,n){z(this,"_cachedMatchRoot",new _d(e=>this._root.match(e)));this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(p1(e),t)}static createFromParsedTheme(e,t){return m1(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,s=this._cachedMatchRoot.get(t).find(o=>f1(e.parent,o.parentScopes));return s?new Sd(s.fontStyle,s.foreground,s.background):null}},Ji=class Eo{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const s of n)t=new Eo(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new Eo(n,t[s]);return n}push(t){return new Eo(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let s=this;for(;s&&s!==t;)n.push(s.scopeName),s=s.parent;return s===t?n.reverse():void 0}};function f1(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let s=t[n],o=!1;if(s===">"){if(n===t.length-1)return!1;s=t[++n],o=!0}for(;e&&!h1(e.scopeName,s);){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function h1(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Sd=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function p1(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let o=0,i=t.length;o<i;o++){let l=t[o];if(!l.settings)continue;let r;if(typeof l.scope=="string"){let f=l.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),r=f.split(",")}else Array.isArray(l.scope)?r=l.scope:r=[""];let a=-1;if(typeof l.settings.fontStyle=="string"){a=0;let f=l.settings.fontStyle.split(" ");for(let h=0,p=f.length;h<p;h++)switch(f[h]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let c=null;typeof l.settings.foreground=="string"&&qa(l.settings.foreground)&&(c=l.settings.foreground);let u=null;typeof l.settings.background=="string"&&qa(l.settings.background)&&(u=l.settings.background);for(let f=0,h=r.length;f<h;f++){let v=r[f].trim().split(" "),k=v[v.length-1],w=null;v.length>1&&(w=v.slice(0,v.length-1),w.reverse()),n[s++]=new g1(k,w,o,a,c,u)}}return n}var g1=class{constructor(e,t,n,s,o,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=o,this.background=i}},xt=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(xt||{});function m1(e,t){e.sort((a,c)=>{let u=bd(a.scope,c.scope);return u!==0||(u=kd(a.parentScopes,c.parentScopes),u!==0)?u:a.index-c.index});let n=0,s="#000000",o="#ffffff";for(;e.length>=1&&e[0].scope==="";){let a=e.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(s=a.foreground),a.background!==null&&(o=a.background)}let i=new v1(t),l=new Sd(n,i.getId(s),i.getId(o)),r=new b1(new El(0,null,-1,0,0),[]);for(let a=0,c=e.length;a<c;a++){let u=e[a];r.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new Zo(i,l,r)}var v1=class{constructor(e){z(this,"_isFrozen");z(this,"_lastColorId");z(this,"_id2color");z(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},y1=Object.freeze([]),El=class $d{constructor(t,n,s,o,i){z(this,"scopeDepth");z(this,"parentScopes");z(this,"fontStyle");z(this,"foreground");z(this,"background");this.scopeDepth=t,this.parentScopes=n||y1,this.fontStyle=s,this.foreground=o,this.background=i}clone(){return new $d(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let s=0,o=t.length;s<o;s++)n[s]=t[s].clone();return n}acceptOverwrite(t,n,s,o){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),s!==0&&(this.foreground=s),o!==0&&(this.background=o)}},b1=class Ml{constructor(t,n=[],s={}){z(this,"_rulesWithParentScopes");this._mainRule=t,this._children=s,this._rulesWithParentScopes=n}static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let s=0,o=0;for(;t.parentScopes[s]===">"&&s++,n.parentScopes[o]===">"&&o++,!(s>=t.parentScopes.length||o>=n.parentScopes.length);){const i=n.parentScopes[o].length-t.parentScopes[s].length;if(i!==0)return i;s++,o++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let s=t.indexOf("."),o,i;if(s===-1?(o=t,i=""):(o=t.substring(0,s),i=t.substring(s+1)),this._children.hasOwnProperty(o))return this._children[o].match(i)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Ml._cmpBySpecificity),n}insert(t,n,s,o,i,l){if(n===""){this._doInsertHere(t,s,o,i,l);return}let r=n.indexOf("."),a,c;r===-1?(a=n,c=""):(a=n.substring(0,r),c=n.substring(r+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new Ml(this._mainRule.clone(),El.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(t+1,c,s,o,i,l)}_doInsertHere(t,n,s,o,i){if(n===null){this._mainRule.acceptOverwrite(t,s,o,i);return}for(let l=0,r=this._rulesWithParentScopes.length;l<r;l++){let a=this._rulesWithParentScopes[l];if(kd(a.parentScopes,n)===0){a.acceptOverwrite(t,s,o,i);return}}s===-1&&(s=this._mainRule.fontStyle),o===0&&(o=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new El(t,n,s,o,i))}},ms=class Gt{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Gt.getLanguageId(t),s=Gt.getTokenType(t),o=Gt.getFontStyle(t),i=Gt.getForeground(t),l=Gt.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:o,foreground:i,background:l})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,s,o,i,l,r){let a=Gt.getLanguageId(t),c=Gt.getTokenType(t),u=Gt.containsBalancedBrackets(t)?1:0,f=Gt.getFontStyle(t),h=Gt.getForeground(t),p=Gt.getBackground(t);return n!==0&&(a=n),s!==8&&(c=s),o!==null&&(u=o?1:0),i!==-1&&(f=i),l!==0&&(h=l),r!==0&&(p=r),(a<<0|c<<8|u<<10|f<<11|h<<15|p<<24)>>>0}};function Jo(e,t){const n=[],s=k1(e);let o=s.next();for(;o!==null;){let a=0;if(o.length===2&&o.charAt(1)===":"){switch(o.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=s.next()}let c=l();if(n.push({matcher:c,priority:a}),o!==",")break;o=s.next()}return n;function i(){if(o==="-"){o=s.next();const a=i();return c=>!!a&&!a(c)}if(o==="("){o=s.next();const a=r();return o===")"&&(o=s.next()),a}if(Va(o)){const a=[];do a.push(o),o=s.next();while(Va(o));return c=>t(a,c)}return null}function l(){const a=[];let c=i();for(;c;)a.push(c),c=i();return u=>a.every(f=>f(u))}function r(){const a=[];let c=l();for(;c&&(a.push(c),o==="|"||o===",");){do o=s.next();while(o==="|"||o===",");c=l()}return u=>a.some(f=>f(u))}}function Va(e){return!!e&&!!e.match(/[\w\.:]+/)}function k1(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}function xd(e){typeof e.dispose=="function"&&e.dispose()}var Zs=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},w1=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},_1=class{constructor(){z(this,"_references",[]);z(this,"_seenReferenceKeys",new Set);z(this,"visitedRule",new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},S1=class{constructor(e,t){z(this,"seenFullScopeRequests",new Set);z(this,"seenPartialScopeRequests",new Set);z(this,"Q");this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Zs(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new _1;for(const n of e)$1(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Zs){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function $1(e,t,n,s){const o=n.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof Zs?Mo({baseGrammar:i,selfGrammar:o},s):Pl(e.ruleName,{baseGrammar:i,selfGrammar:o,repository:o.repository},s);const l=n.injections(e.scopeName);if(l)for(const r of l)s.add(new Zs(r))}function Pl(e,t,n){if(t.repository&&t.repository[e]){const s=t.repository[e];Xo([s],t,n)}}function Mo(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Xo(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Xo(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Xo(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const o=s.repository?vd({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&Xo(s.patterns,{...t,repository:o},n);const i=s.include;if(!i)continue;const l=Cd(i);switch(l.kind){case 0:Mo({...t,selfGrammar:t.baseGrammar},n);break;case 1:Mo(t,n);break;case 2:Pl(l.ruleName,{...t,repository:o},n);break;case 3:case 4:const r=l.scopeName===t.selfGrammar.scopeName?t.selfGrammar:l.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){const a={baseGrammar:t.baseGrammar,selfGrammar:r,repository:o};l.kind===4?Pl(l.ruleName,a,n):Mo(a,n)}else l.kind===4?n.add(new w1(l.scopeName,l.ruleName)):n.add(new Zs(l.scopeName));break}}}var x1=class{constructor(){z(this,"kind",0)}},C1=class{constructor(){z(this,"kind",1)}},T1=class{constructor(e){z(this,"kind",2);this.ruleName=e}},I1=class{constructor(e){z(this,"kind",3);this.scopeName=e}},R1=class{constructor(e,t){z(this,"kind",4);this.scopeName=e,this.ruleName=t}};function Cd(e){if(e==="$base")return new x1;if(e==="$self")return new C1;const t=e.indexOf("#");if(t===-1)return new I1(e);if(t===0)return new T1(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new R1(n,s)}}var A1=/\\(\d+)/,Ka=/\\(\d+)/g,E1=-1,Td=-2;var io=class{constructor(e,t,n,s){z(this,"$location");z(this,"id");z(this,"_nameIsCapturing");z(this,"_name");z(this,"_contentNameIsCapturing");z(this,"_contentName");this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=bo.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=bo.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${yd(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:bo.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:bo.replaceCaptures(this._contentName,e,t)}},M1=class extends io{constructor(t,n,s,o,i){super(t,n,s,o);z(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(t,n){throw new Error("Not supported!")}compile(t,n){throw new Error("Not supported!")}compileAG(t,n,s,o){throw new Error("Not supported!")}},P1=class extends io{constructor(t,n,s,o,i){super(t,n,s,null);z(this,"_match");z(this,"captures");z(this,"_cachedCompiledPatterns");this._match=new Js(o,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,n){n.push(this._match)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,o){return this._getCachedCompiledPatterns(t).compileAG(t,s,o)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Xs,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ya=class extends io{constructor(t,n,s,o,i){super(t,n,s,o);z(this,"hasMissingPatterns");z(this,"patterns");z(this,"_cachedCompiledPatterns");this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,n){for(const s of this.patterns)t.getRule(s).collectPatterns(t,n)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,o){return this._getCachedCompiledPatterns(t).compileAG(t,s,o)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Xs,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ll=class extends io{constructor(t,n,s,o,i,l,r,a,c,u){super(t,n,s,o);z(this,"_begin");z(this,"beginCaptures");z(this,"_end");z(this,"endHasBackReferences");z(this,"endCaptures");z(this,"applyEndPatternLast");z(this,"hasMissingPatterns");z(this,"patterns");z(this,"_cachedCompiledPatterns");this._begin=new Js(i,this.id),this.beginCaptures=l,this._end=new Js(r||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,n){return this._end.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t,n).compile(t)}compileAG(t,n,s,o){return this._getCachedCompiledPatterns(t,n).compileAG(t,s,o)}_getCachedCompiledPatterns(t,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Xs;for(const s of this.patterns)t.getRule(s).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},Qo=class extends io{constructor(t,n,s,o,i,l,r,a,c){super(t,n,s,o);z(this,"_begin");z(this,"beginCaptures");z(this,"whileCaptures");z(this,"_while");z(this,"whileHasBackReferences");z(this,"hasMissingPatterns");z(this,"patterns");z(this,"_cachedCompiledPatterns");z(this,"_cachedCompiledWhilePatterns");this._begin=new Js(i,this.id),this.beginCaptures=l,this.whileCaptures=a,this._while=new Js(r,Td),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,n){return this._while.resolveBackReferences(t,n)}collectPatterns(t,n){n.push(this._begin)}compile(t,n){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,n,s,o){return this._getCachedCompiledPatterns(t).compileAG(t,s,o)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Xs;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,n){return this._getCachedCompiledWhilePatterns(t,n).compile(t)}compileWhileAG(t,n,s,o){return this._getCachedCompiledWhilePatterns(t,n).compileAG(t,s,o)}_getCachedCompiledWhilePatterns(t,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Xs,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Id=class wt{static createCaptureRule(t,n,s,o,i){return t.registerRule(l=>new M1(n,l,s,o,i))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(o=>{if(t.id=o,t.match)return new P1(t.$vscodeTextmateLocation,t.id,t.name,t.match,wt._compileCaptures(t.captures,n,s));if(typeof t.begin>"u"){t.repository&&(s=vd({},s,t.repository));let i=t.patterns;return typeof i>"u"&&t.include&&(i=[{include:t.include}]),new Ya(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,wt._compilePatterns(i,n,s))}return t.while?new Qo(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,wt._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,wt._compileCaptures(t.whileCaptures||t.captures,n,s),wt._compilePatterns(t.patterns,n,s)):new Ll(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,wt._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,wt._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,wt._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let o=[];if(t){let i=0;for(const l in t){if(l==="$vscodeTextmateLocation")continue;const r=parseInt(l,10);r>i&&(i=r)}for(let l=0;l<=i;l++)o[l]=null;for(const l in t){if(l==="$vscodeTextmateLocation")continue;const r=parseInt(l,10);let a=0;t[l].patterns&&(a=wt.getCompiledRuleId(t[l],n,s)),o[r]=wt.createCaptureRule(n,t[l].$vscodeTextmateLocation,t[l].name,t[l].contentName,a)}}return o}static _compilePatterns(t,n,s){let o=[];if(t)for(let i=0,l=t.length;i<l;i++){const r=t[i];let a=-1;if(r.include){const c=Cd(r.include);switch(c.kind){case 0:case 1:a=wt.getCompiledRuleId(s[r.include],n,s);break;case 2:let u=s[c.ruleName];u&&(a=wt.getCompiledRuleId(u,n,s));break;case 3:case 4:const f=c.scopeName,h=c.kind===4?c.ruleName:null,p=n.getExternalGrammar(f,s);if(p)if(h){let v=p.repository[h];v&&(a=wt.getCompiledRuleId(v,n,p.repository))}else a=wt.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else a=wt.getCompiledRuleId(r,n,s);if(a!==-1){const c=n.getRule(a);let u=!1;if((c instanceof Ya||c instanceof Ll||c instanceof Qo)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;o.push(a)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},Js=class Rd{constructor(t,n){z(this,"source");z(this,"ruleId");z(this,"hasAnchor");z(this,"hasBackReferences");z(this,"_anchorCache");if(t&&typeof t=="string"){const s=t.length;let o=0,i=[],l=!1;for(let r=0;r<s;r++)if(t.charAt(r)==="\\"&&r+1<s){const c=t.charAt(r+1);c==="z"?(i.push(t.substring(o,r)),i.push("$(?!\\n)(?<!\\n)"),o=r+2):(c==="A"||c==="G")&&(l=!0),r++}this.hasAnchor=l,o===0?this.source=t:(i.push(t.substring(o,s)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=A1.test(this.source):this.hasBackReferences=!1}clone(){return new Rd(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let s=n.map(o=>t.substring(o.start,o.end));return Ka.lastIndex=0,this.source.replace(Ka,(o,i)=>wd(s[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],s=[],o=[],i,l,r,a;for(i=0,l=this.source.length;i<l;i++)r=this.source.charAt(i),t[i]=r,n[i]=r,s[i]=r,o[i]=r,r==="\\"&&i+1<l&&(a=this.source.charAt(i+1),a==="A"?(t[i+1]="",n[i+1]="",s[i+1]="A",o[i+1]="A"):a==="G"?(t[i+1]="",n[i+1]="G",s[i+1]="",o[i+1]="G"):(t[i+1]=a,n[i+1]=a,s[i+1]=a,o[i+1]=a),i++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:s.join(""),A1_G1:o.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Xs=class{constructor(){z(this,"_items");z(this,"_hasAnchors");z(this,"_cached");z(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Za(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(o=>o.resolveAnchors(t,n));return new Za(e,s,this._items.map(o=>o.ruleId))}},Za=class{constructor(e,t,n){z(this,"scanner");this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
75
|
-
`)}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},Xi=class{constructor(e,t){this.languageId=e,this.tokenType=t}},hn,L1=(hn=class{constructor(t,n){z(this,"_defaultAttributes");z(this,"_embeddedLanguagesMatcher");z(this,"_getBasicScopeAttributes",new _d(t=>{const n=this._scopeToLanguage(t),s=this._toStandardTokenType(t);return new Xi(n,s)}));this._defaultAttributes=new Xi(t,8),this._embeddedLanguagesMatcher=new O1(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?hn._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(hn.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},z(hn,"_NULL_SCOPE_METADATA",new Xi(0,0)),z(hn,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),hn),O1=class{constructor(e){z(this,"values");z(this,"scopesRegExp");if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,s])=>wd(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Ja=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Ad(e,t,n,s,o,i,l,r){const a=t.content.length;let c=!1,u=-1;if(l){const p=D1(e,t,n,s,o,i);o=p.stack,s=p.linePos,n=p.isFirstLine,u=p.anchorPosition}const f=Date.now();for(;!c;){if(r!==0&&Date.now()-f>r)return new Ja(o,!0);h()}return new Ja(o,!1);function h(){const p=N1(e,t,n,s,o,u);if(!p){i.produce(o,a),c=!0;return}const v=p.captureIndices,k=p.matchedRuleId,w=v&&v.length>0?v[0].end>s:!1;if(k===E1){const S=o.getRule(e);i.produce(o,v[0].start),o=o.withContentNameScopesList(o.nameScopesList),Ms(e,t,n,o,i,S.endCaptures,v),i.produce(o,v[0].end);const $=o;if(o=o.parent,u=$.getAnchorPos(),!w&&$.getEnterPos()===s){o=$,i.produce(o,a),c=!0;return}}else{const S=e.getRule(k);i.produce(o,v[0].start);const $=o,M=S.getName(t.content,v),P=o.contentNameScopesList.pushAttributed(M,e);if(o=o.push(k,s,u,v[0].end===a,null,P,P),S instanceof Ll){const Z=S;Ms(e,t,n,o,i,Z.beginCaptures,v),i.produce(o,v[0].end),u=v[0].end;const j=Z.getContentName(t.content,v),C=P.pushAttributed(j,e);if(o=o.withContentNameScopesList(C),Z.endHasBackReferences&&(o=o.withEndRule(Z.getEndWithResolvedBackReferences(t.content,v))),!w&&$.hasSameRuleAs(o)){o=o.pop(),i.produce(o,a),c=!0;return}}else if(S instanceof Qo){const Z=S;Ms(e,t,n,o,i,Z.beginCaptures,v),i.produce(o,v[0].end),u=v[0].end;const j=Z.getContentName(t.content,v),C=P.pushAttributed(j,e);if(o=o.withContentNameScopesList(C),Z.whileHasBackReferences&&(o=o.withEndRule(Z.getWhileWithResolvedBackReferences(t.content,v))),!w&&$.hasSameRuleAs(o)){o=o.pop(),i.produce(o,a),c=!0;return}}else if(Ms(e,t,n,o,i,S.captures,v),i.produce(o,v[0].end),o=o.pop(),!w){o=o.safePop(),i.produce(o,a),c=!0;return}}v[0].end>s&&(s=v[0].end,n=!1)}}function D1(e,t,n,s,o,i){let l=o.beginRuleCapturedEOL?0:-1;const r=[];for(let a=o;a;a=a.pop()){const c=a.getRule(e);c instanceof Qo&&r.push({rule:c,stack:a})}for(let a=r.pop();a;a=r.pop()){const{ruleScanner:c,findOptions:u}=j1(a.rule,e,a.stack.endRule,n,s===l),f=c.findNextMatchSync(t,s,u);if(f){if(f.ruleId!==Td){o=a.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(i.produce(a.stack,f.captureIndices[0].start),Ms(e,t,n,a.stack,i,a.rule.whileCaptures,f.captureIndices),i.produce(a.stack,f.captureIndices[0].end),l=f.captureIndices[0].end,f.captureIndices[0].end>s&&(s=f.captureIndices[0].end,n=!1))}else{o=a.stack.pop();break}}return{stack:o,linePos:s,anchorPosition:l,isFirstLine:n}}function N1(e,t,n,s,o,i){const l=B1(e,t,n,s,o,i),r=e.getInjections();if(r.length===0)return l;const a=F1(r,e,t,n,s,o,i);if(!a)return l;if(!l)return a;const c=l.captureIndices[0].start,u=a.captureIndices[0].start;return u<c||a.priorityMatch&&u===c?a:l}function B1(e,t,n,s,o,i){const l=o.getRule(e),{ruleScanner:r,findOptions:a}=Ed(l,e,o.endRule,n,s===i),c=r.findNextMatchSync(t,s,a);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function F1(e,t,n,s,o,i,l){let r=Number.MAX_VALUE,a=null,c,u=0;const f=i.contentNameScopesList.getScopeNames();for(let h=0,p=e.length;h<p;h++){const v=e[h];if(!v.matcher(f))continue;const k=t.getRule(v.ruleId),{ruleScanner:w,findOptions:S}=Ed(k,t,null,s,o===l),$=w.findNextMatchSync(n,o,S);if(!$)continue;const M=$.captureIndices[0].start;if(!(M>=r)&&(r=M,a=$.captureIndices,c=$.ruleId,u=v.priority,r===o))break}return a?{priorityMatch:u===-1,captureIndices:a,matchedRuleId:c}:null}function Ed(e,t,n,s,o){return{ruleScanner:e.compileAG(t,n,s,o),findOptions:0}}function j1(e,t,n,s,o){return{ruleScanner:e.compileWhileAG(t,n,s,o),findOptions:0}}function Ms(e,t,n,s,o,i,l){if(i.length===0)return;const r=t.content,a=Math.min(i.length,l.length),c=[],u=l[0].end;for(let f=0;f<a;f++){const h=i[f];if(h===null)continue;const p=l[f];if(p.length===0)continue;if(p.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=p.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,p.start):o.produce(s,p.start),h.retokenizeCapturedWithRuleId){const k=h.getName(r,l),w=s.contentNameScopesList.pushAttributed(k,e),S=h.getContentName(r,l),$=w.pushAttributed(S,e),M=s.push(h.retokenizeCapturedWithRuleId,p.start,-1,!1,null,w,$),P=e.createOnigString(r.substring(0,p.end));Ad(e,P,n&&p.start===0,p.start,M,o,!1,0),xd(P);continue}const v=h.getName(r,l);if(v!==null){const w=(c.length>0?c[c.length-1].scopes:s.contentNameScopesList).pushAttributed(v,e);c.push(new U1(w,p.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var U1=class{constructor(e,t){z(this,"scopes");z(this,"endPos");this.scopes=e,this.endPos=t}};function G1(e,t,n,s,o,i,l,r){return new H1(e,t,n,s,o,i,l,r)}function Xa(e,t,n,s,o){const i=Jo(t,ei),l=Id.getCompiledRuleId(n,s,o.repository);for(const r of i)e.push({debugSelector:t,matcher:r.matcher,ruleId:l,grammar:o,priority:r.priority})}function ei(e,t){if(t.length<e.length)return!1;let n=0;return e.every(s=>{for(let o=n;o<t.length;o++)if(z1(t[o],s))return n=o+1,!0;return!1})}function z1(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var H1=class{constructor(e,t,n,s,o,i,l,r){z(this,"_rootId");z(this,"_lastRuleId");z(this,"_ruleId2desc");z(this,"_includedGrammars");z(this,"_grammarRepository");z(this,"_grammar");z(this,"_injections");z(this,"_basicScopeAttributesProvider");z(this,"_tokenTypeMatchers");if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=r,this._basicScopeAttributesProvider=new L1(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=l,this._grammar=Qa(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const a of Object.keys(o)){const c=Jo(a,ei);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:o[a]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:o=>o===this._rootScopeName?this._grammar:this.getExternalGrammar(o),injections:o=>this._grammarRepository.injections(o)},t=[],n=this._rootScopeName,s=e.lookup(n);if(s){const o=s.injections;if(o)for(let l in o)Xa(t,l,o[l],this,s);const i=this._grammarRepository.injections(n);i&&i.forEach(l=>{const r=this.getExternalGrammar(l);if(r){const a=r.injectionSelector;a&&Xa(t,a,r,this,r)}})}return t.sort((o,i)=>o.priority-i.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Qa(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){this._rootId===-1&&(this._rootId=Id.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let o;if(!t||t===Ol.NULL){o=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=ms.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let p;h?p=Fs.createRootAndLookUpScopeName(h,f,this):p=Fs.createRoot("unknown",f),t=new Ol(null,this._rootId,-1,-1,!1,null,p,p)}else o=!1,t.reset();e=e+`
|
|
76
|
-
`;const i=this.createOnigString(e),l=i.content.length,r=new q1(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),a=Ad(this,i,o,0,t,r,!0,s);return xd(i),{lineLength:l,lineTokens:r,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function Qa(e,t){return e=c1(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Fs=class tn{constructor(t,n,s){this.parent=t,this.scopePath=n,this.tokenAttributes=s}static fromExtension(t,n){let s=t,o=(t==null?void 0:t.scopePath)??null;for(const i of n)o=Ji.push(o,i.scopeNames),s=new tn(s,o,i.encodedTokenAttributes);return s}static createRoot(t,n){return new tn(null,new Ji(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const o=s.getMetadataForScope(t),i=new Ji(null,t),l=s.themeProvider.themeMatch(i),r=tn.mergeAttributes(n,o,l);return new tn(null,i,r)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return tn.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,s){let o=-1,i=0,l=0;return s!==null&&(o=s.fontStyle,i=s.foregroundId,l=s.backgroundId),ms.set(t,n.languageId,n.tokenType,null,o,i,l)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return tn._pushAttributed(this,t,n);const s=t.split(/ /g);let o=this;for(const i of s)o=tn._pushAttributed(o,i,n);return o}static _pushAttributed(t,n,s){const o=s.getMetadataForScope(n),i=t.scopePath.push(n),l=s.themeProvider.themeMatch(i),r=tn.mergeAttributes(t.tokenAttributes,o,l);return new tn(t,i,r)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){var o;const n=[];let s=this;for(;s&&s!==t;)n.push({encodedTokenAttributes:s.tokenAttributes,scopeNames:s.scopePath.getExtensionIfDefined(((o=s.parent)==null?void 0:o.scopePath)??null)}),s=s.parent;return s===t?n.reverse():void 0}},Ht,Ol=(Ht=class{constructor(t,n,s,o,i,l,r,a){z(this,"_stackElementBrand");z(this,"_enterPos");z(this,"_anchorPos");z(this,"depth");this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=l,this.nameScopesList=r,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=s,this._anchorPos=o}equals(t){return t===null?!1:Ht._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Fs.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){Ht._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,o,i,l,r){return new Ht(this,t,n,s,o,i,l,r)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){var s,o;return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${(s=this.nameScopesList)==null?void 0:s.toString()}, ${(o=this.contentNameScopesList)==null?void 0:o.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new Ht(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var t,n,s;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((t=this.parent)==null?void 0:t.nameScopesList)??null))??[],contentNameScopesList:((s=this.contentNameScopesList)==null?void 0:s.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(t,n){const s=Fs.fromExtension((t==null?void 0:t.nameScopesList)??null,n.nameScopesList);return new Ht(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,Fs.fromExtension(s,n.contentNameScopesList))}},z(Ht,"NULL",new Ht(null,0,0,0,!1,null,null,null)),Ht),W1=class{constructor(e,t){z(this,"balancedBracketScopes");z(this,"unbalancedBracketScopes");z(this,"allowAny",!1);this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Jo(n,ei).map(s=>s.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Jo(n,ei).map(s=>s.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},q1=class{constructor(e,t,n,s){z(this,"_emitBinaryTokens");z(this,"_lineText");z(this,"_tokens");z(this,"_binaryTokens");z(this,"_lastTokenEndIndex");z(this,"_tokenTypeOverrides");this.balancedBracketSelectors=s,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){var s;if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let o=(e==null?void 0:e.tokenAttributes)??0,i=!1;if((s=this.balancedBracketSelectors)!=null&&s.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const l=(e==null?void 0:e.getScopeNames())??[];for(const r of this._tokenTypeOverrides)r.matcher(l)&&(o=ms.set(o,0,r.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(l))}if(i&&(o=ms.set(o,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===o){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(o),this._lastTokenEndIndex=t;return}const n=(e==null?void 0:e.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,o=this._binaryTokens.length;s<o;s++)n[s]=this._binaryTokens[s];return n}},V1=class{constructor(e,t){z(this,"_grammars",new Map);z(this,"_rawGrammars",new Map);z(this,"_injectionGrammars",new Map);z(this,"_theme");this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,s,o){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,G1(e,i,t,n,s,o,this,this._onigLib))}return this._grammars.get(e)}},K1=class{constructor(t){z(this,"_options");z(this,"_syncRegistry");z(this,"_ensureGrammarCache");this._options=t,this._syncRegistry=new V1(Zo.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Zo.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,s){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:s})}loadGrammarWithConfiguration(t,n,s){return this._loadGrammar(t,n,s.embeddedLanguages,s.tokenTypes,new W1(s.balancedBracketSelectors||[],s.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,s,o,i){const l=new S1(this._syncRegistry,t);for(;l.Q.length>0;)l.Q.map(r=>this._loadSingleGrammar(r.scopeName)),l.processQueue();return this._grammarForScopeName(t,n,s,o,i)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const s=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,s)}}addGrammar(t,n=[],s=0,o=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,s,o)}_grammarForScopeName(t,n=0,s=null,o=null,i=null){return this._syncRegistry.grammarForScopeName(t,n,s,o,i)}},Dl=Ol.NULL;const Y1=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class lo{constructor(t,n,s){this.normal=n,this.property=t,s&&(this.space=s)}}lo.prototype.normal={};lo.prototype.property={};lo.prototype.space=void 0;function Md(e,t){const n={},s={};for(const o of e)Object.assign(n,o.property),Object.assign(s,o.normal);return new lo(n,s,t)}function Nl(e){return e.toLowerCase()}class Lt{constructor(t,n){this.attribute=n,this.property=t}}Lt.prototype.attribute="";Lt.prototype.booleanish=!1;Lt.prototype.boolean=!1;Lt.prototype.commaOrSpaceSeparated=!1;Lt.prototype.commaSeparated=!1;Lt.prototype.defined=!1;Lt.prototype.mustUseProperty=!1;Lt.prototype.number=!1;Lt.prototype.overloadedBoolean=!1;Lt.prototype.property="";Lt.prototype.spaceSeparated=!1;Lt.prototype.space=void 0;let Z1=0;const xe=Qn(),lt=Qn(),Bl=Qn(),re=Qn(),Ze=Qn(),Kn=Qn(),Ot=Qn();function Qn(){return 2**++Z1}const Fl=Object.freeze(Object.defineProperty({__proto__:null,boolean:xe,booleanish:lt,commaOrSpaceSeparated:Ot,commaSeparated:Kn,number:re,overloadedBoolean:Bl,spaceSeparated:Ze},Symbol.toStringTag,{value:"Module"})),Qi=Object.keys(Fl);class wr extends Lt{constructor(t,n,s,o){let i=-1;if(super(t,n),ec(this,"space",o),typeof s=="number")for(;++i<Qi.length;){const l=Qi[i];ec(this,Qi[i],(s&Fl[l])===Fl[l])}}}wr.prototype.defined=!0;function ec(e,t,n){n&&(e[t]=n)}function vs(e){const t={},n={};for(const[s,o]of Object.entries(e.properties)){const i=new wr(s,e.transform(e.attributes||{},s),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(s)&&(i.mustUseProperty=!0),t[s]=i,n[Nl(s)]=s,n[Nl(i.attribute)]=s}return new lo(t,n,e.space)}const Pd=vs({properties:{ariaActiveDescendant:null,ariaAtomic:lt,ariaAutoComplete:null,ariaBusy:lt,ariaChecked:lt,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:Ze,ariaCurrent:null,ariaDescribedBy:Ze,ariaDetails:null,ariaDisabled:lt,ariaDropEffect:Ze,ariaErrorMessage:null,ariaExpanded:lt,ariaFlowTo:Ze,ariaGrabbed:lt,ariaHasPopup:null,ariaHidden:lt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ze,ariaLevel:re,ariaLive:null,ariaModal:lt,ariaMultiLine:lt,ariaMultiSelectable:lt,ariaOrientation:null,ariaOwns:Ze,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:lt,ariaReadOnly:lt,ariaRelevant:null,ariaRequired:lt,ariaRoleDescription:Ze,ariaRowCount:re,ariaRowIndex:re,ariaRowSpan:re,ariaSelected:lt,ariaSetSize:re,ariaSort:null,ariaValueMax:re,ariaValueMin:re,ariaValueNow:re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Ld(e,t){return t in e?e[t]:t}function Od(e,t){return Ld(e,t.toLowerCase())}const J1=vs({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Kn,acceptCharset:Ze,accessKey:Ze,action:null,allow:null,allowFullScreen:xe,allowPaymentRequest:xe,allowUserMedia:xe,alpha:xe,alt:null,as:null,async:xe,autoCapitalize:null,autoComplete:Ze,autoFocus:xe,autoPlay:xe,blocking:Ze,capture:null,charSet:null,checked:xe,cite:null,className:Ze,closedBy:null,colorSpace:null,cols:re,colSpan:re,command:null,commandFor:null,content:null,contentEditable:lt,controls:xe,controlsList:Ze,coords:re|Kn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xe,defer:xe,dir:null,dirName:null,disabled:xe,download:Bl,draggable:lt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xe,formTarget:null,headers:Ze,height:re,hidden:Bl,high:re,href:null,hrefLang:null,htmlFor:Ze,httpEquiv:Ze,id:null,imageSizes:null,imageSrcSet:null,inert:xe,inputMode:null,integrity:null,is:null,isMap:xe,itemId:null,itemProp:Ze,itemRef:Ze,itemScope:xe,itemType:Ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xe,low:re,manifest:null,max:null,maxLength:re,media:null,method:null,min:null,minLength:re,multiple:xe,muted:xe,name:null,nonce:null,noModule:xe,noValidate:xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:xe,optimum:re,pattern:null,ping:Ze,placeholder:null,playsInline:xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xe,referrerPolicy:null,rel:Ze,required:xe,reversed:xe,rows:re,rowSpan:re,sandbox:Ze,scope:null,scoped:xe,seamless:xe,selected:xe,shadowRootClonable:xe,shadowRootCustomElementRegistry:xe,shadowRootDelegatesFocus:xe,shadowRootMode:null,shadowRootSerializable:xe,shape:null,size:re,sizes:null,slot:null,span:re,spellCheck:lt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:re,step:null,style:null,tabIndex:re,target:null,title:null,translate:null,type:null,typeMustMatch:xe,useMap:null,value:lt,width:re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ze,axis:null,background:null,bgColor:null,border:re,borderColor:null,bottomMargin:re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xe,declare:xe,event:null,face:null,frame:null,frameBorder:null,hSpace:re,leftMargin:re,link:null,longDesc:null,lowSrc:null,marginHeight:re,marginWidth:re,noResize:xe,noHref:xe,noShade:xe,noWrap:xe,object:null,profile:null,prompt:null,rev:null,rightMargin:re,rules:null,scheme:null,scrolling:lt,standby:null,summary:null,text:null,topMargin:re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:re,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:xe,disablePictureInPicture:xe,disableRemotePlayback:xe,exportParts:Kn,part:Ze,prefix:null,property:null,results:re,security:null,unselectable:null},space:"html",transform:Od}),X1=vs({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ot,accentHeight:re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:re,amplitude:re,arabicForm:null,ascent:re,attributeName:null,attributeType:null,azimuth:re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:re,by:null,calcMode:null,capHeight:re,className:Ze,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:re,diffuseConstant:re,direction:null,display:null,dur:null,divisor:re,dominantBaseline:null,download:xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:re,enableBackground:null,end:null,event:null,exponent:re,externalResourcesRequired:null,fill:null,fillOpacity:re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Kn,g2:Kn,glyphName:Kn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:re,horizOriginX:re,horizOriginY:re,id:null,ideographic:re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:re,k:re,k1:re,k2:re,k3:re,k4:re,kernelMatrix:Ot,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:re,overlineThickness:re,paintOrder:null,panose1:null,path:null,pathLength:re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:re,pointsAtY:re,pointsAtZ:re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ot,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ot,rev:Ot,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ot,requiredFeatures:Ot,requiredFonts:Ot,requiredFormats:Ot,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:re,specularExponent:re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:re,strikethroughThickness:re,string:null,stroke:null,strokeDashArray:Ot,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:re,strokeOpacity:re,strokeWidth:null,style:null,surfaceScale:re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ot,tabIndex:re,tableValues:null,target:null,targetX:re,targetY:re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ot,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:re,underlineThickness:re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:re,values:null,vAlphabetic:re,vMathematical:re,vectorEffect:null,vHanging:re,vIdeographic:re,version:null,vertAdvY:re,vertOriginX:re,vertOriginY:re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Ld}),Dd=vs({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),Nd=vs({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Od}),Bd=vs({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),Q1=/[A-Z]/g,tc=/-[a-z]/g,ek=/^data[-\w.:]+$/i;function tk(e,t){const n=Nl(t);let s=t,o=Lt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ek.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(tc,sk);s="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!tc.test(i)){let l=i.replace(Q1,nk);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=wr}return new o(s,t)}function nk(e){return"-"+e.toLowerCase()}function sk(e){return e.charAt(1).toUpperCase()}const ok=Md([Pd,J1,Dd,Nd,Bd],"html"),Fd=Md([Pd,X1,Dd,Nd,Bd],"svg"),nc={}.hasOwnProperty;function ik(e,t){const n=t||{};function s(o,...i){let l=s.invalid;const r=s.handlers;if(o&&nc.call(o,e)){const a=String(o[e]);l=nc.call(r,a)?r[a]:s.unknown}if(l)return l.call(this,o,...i)}return s.handlers=n.handlers||{},s.invalid=n.invalid,s.unknown=n.unknown,s}const lk=/["&'<>`]/g,rk=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ak=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ck=/[|\\{}()[\]^$+*?.]/g,sc=new WeakMap;function uk(e,t){if(e=e.replace(t.subset?dk(t.subset):lk,s),t.subset||t.escapeOnly)return e;return e.replace(rk,n).replace(ak,s);function n(o,i,l){return t.format((o.charCodeAt(0)-55296)*1024+o.charCodeAt(1)-56320+65536,l.charCodeAt(i+2),t)}function s(o,i,l){return t.format(o.charCodeAt(0),l.charCodeAt(i+1),t)}}function dk(e){let t=sc.get(e);return t||(t=fk(e),sc.set(e,t)),t}function fk(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(ck,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const hk=/[\dA-Fa-f]/;function pk(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!hk.test(String.fromCharCode(t))?s:s+";"}const gk=/\d/;function mk(e,t,n){const s="&#"+String(e);return n&&t&&!gk.test(String.fromCharCode(t))?s:s+";"}const vk=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],el={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},yk=["cent","copy","divide","gt","lt","not","para","times"],jd={}.hasOwnProperty,jl={};let ko;for(ko in el)jd.call(el,ko)&&(jl[el[ko]]=ko);const bk=/[^\dA-Za-z]/;function kk(e,t,n,s){const o=String.fromCharCode(e);if(jd.call(jl,o)){const i=jl[o],l="&"+i;return n&&vk.includes(i)&&!yk.includes(i)&&(!s||t&&t!==61&&bk.test(String.fromCharCode(t)))?l:l+";"}return""}function wk(e,t,n){let s=pk(e,t,n.omitOptionalSemicolons),o;if((n.useNamedReferences||n.useShortestReferences)&&(o=kk(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!o)&&n.useShortestReferences){const i=mk(e,t,n.omitOptionalSemicolons);i.length<s.length&&(s=i)}return o&&(!n.useShortestReferences||o.length<s.length)?o:s}function hs(e,t){return uk(e,Object.assign({format:wk},t))}const _k=/^>|^->|<!--|-->|--!>|<!-$/g,Sk=[">"],$k=["<",">"];function xk(e,t,n,s){return s.settings.bogusComments?"<?"+hs(e.value,Object.assign({},s.settings.characterReferences,{subset:Sk}))+">":"<!--"+e.value.replace(_k,o)+"-->";function o(i){return hs(i,Object.assign({},s.settings.characterReferences,{subset:$k}))}}function Ck(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"}function oc(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let s=0,o=n.indexOf(t);for(;o!==-1;)s++,o=n.indexOf(t,o+t.length);return s}function Tk(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Ik(e){return e.join(" ").trim()}const Rk=/[ \t\n\f\r]/g;function _r(e){return typeof e=="object"?e.type==="text"?ic(e.value):!1:ic(e)}function ic(e){return e.replace(Rk,"")===""}const pt=Gd(1),Ud=Gd(-1),Ak=[];function Gd(e){return t;function t(n,s,o){const i=n?n.children:Ak;let l=(s||0)+e,r=i[l];if(!o)for(;r&&_r(r);)l+=e,r=i[l];return r}}const Ek={}.hasOwnProperty;function zd(e){return t;function t(n,s,o){return Ek.call(e,n.tagName)&&e[n.tagName](n,s,o)}}const Sr=zd({body:Pk,caption:tl,colgroup:tl,dd:Nk,dt:Dk,head:tl,html:Mk,li:Ok,optgroup:Bk,option:Fk,p:Lk,rp:lc,rt:lc,tbody:Uk,td:rc,tfoot:Gk,th:rc,thead:jk,tr:zk});function tl(e,t,n){const s=pt(n,t,!0);return!s||s.type!=="comment"&&!(s.type==="text"&&_r(s.value.charAt(0)))}function Mk(e,t,n){const s=pt(n,t);return!s||s.type!=="comment"}function Pk(e,t,n){const s=pt(n,t);return!s||s.type!=="comment"}function Lk(e,t,n){const s=pt(n,t);return s?s.type==="element"&&(s.tagName==="address"||s.tagName==="article"||s.tagName==="aside"||s.tagName==="blockquote"||s.tagName==="details"||s.tagName==="div"||s.tagName==="dl"||s.tagName==="fieldset"||s.tagName==="figcaption"||s.tagName==="figure"||s.tagName==="footer"||s.tagName==="form"||s.tagName==="h1"||s.tagName==="h2"||s.tagName==="h3"||s.tagName==="h4"||s.tagName==="h5"||s.tagName==="h6"||s.tagName==="header"||s.tagName==="hgroup"||s.tagName==="hr"||s.tagName==="main"||s.tagName==="menu"||s.tagName==="nav"||s.tagName==="ol"||s.tagName==="p"||s.tagName==="pre"||s.tagName==="section"||s.tagName==="table"||s.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Ok(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&s.tagName==="li"}function Dk(e,t,n){const s=pt(n,t);return!!(s&&s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd"))}function Nk(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="dt"||s.tagName==="dd")}function lc(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="rp"||s.tagName==="rt")}function Bk(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&s.tagName==="optgroup"}function Fk(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="option"||s.tagName==="optgroup")}function jk(e,t,n){const s=pt(n,t);return!!(s&&s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot"))}function Uk(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="tbody"||s.tagName==="tfoot")}function Gk(e,t,n){return!pt(n,t)}function zk(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&s.tagName==="tr"}function rc(e,t,n){const s=pt(n,t);return!s||s.type==="element"&&(s.tagName==="td"||s.tagName==="th")}const Hk=zd({body:Vk,colgroup:Kk,head:qk,html:Wk,tbody:Yk});function Wk(e){const t=pt(e,-1);return!t||t.type!=="comment"}function qk(e){const t=new Set;for(const s of e.children)if(s.type==="element"&&(s.tagName==="base"||s.tagName==="title")){if(t.has(s.tagName))return!1;t.add(s.tagName)}const n=e.children[0];return!n||n.type==="element"}function Vk(e){const t=pt(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&_r(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function Kk(e,t,n){const s=Ud(n,t),o=pt(e,-1,!0);return n&&s&&s.type==="element"&&s.tagName==="colgroup"&&Sr(s,n.children.indexOf(s),n)?!1:!!(o&&o.type==="element"&&o.tagName==="col")}function Yk(e,t,n){const s=Ud(n,t),o=pt(e,-1);return n&&s&&s.type==="element"&&(s.tagName==="thead"||s.tagName==="tbody")&&Sr(s,n.children.indexOf(s),n)?!1:!!(o&&o.type==="element"&&o.tagName==="tr")}const wo={name:[[`
|
|
77
|
-
\f\r &/=>`.split(""),`
|
|
78
|
-
\f\r "&'/=>\``.split("")],[`\0
|
|
79
|
-
\f\r "&'/<=>`.split(""),`\0
|
|
80
|
-
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
81
|
-
\f\r &>`.split(""),`\0
|
|
82
|
-
\f\r "&'<=>\``.split("")],[`\0
|
|
83
|
-
\f\r "&'<=>\``.split(""),`\0
|
|
84
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Zk(e,t,n,s){const o=s.schema,i=o.space==="svg"?!1:s.settings.omitOptionalTags;let l=o.space==="svg"?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const r=[];let a;o.space==="html"&&e.tagName==="svg"&&(s.schema=Fd);const c=Jk(s,e.properties),u=s.all(o.space==="html"&&e.tagName==="template"?e.content:e);return s.schema=o,u&&(l=!1),(c||!i||!Hk(e,t,n))&&(r.push("<",e.tagName,c?" "+c:""),l&&(o.space==="svg"||s.settings.closeSelfClosing)&&(a=c.charAt(c.length-1),(!s.settings.tightSelfClosing||a==="/"||a&&a!=='"'&&a!=="'")&&r.push(" "),r.push("/")),r.push(">")),r.push(u),!l&&(!i||!Sr(e,t,n))&&r.push("</"+e.tagName+">"),r.join("")}function Jk(e,t){const n=[];let s=-1,o;if(t){for(o in t)if(t[o]!==null&&t[o]!==void 0){const i=Xk(e,o,t[o]);i&&n.push(i)}}for(;++s<n.length;){const i=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&i!=='"'&&i!=="'"&&(n[s]+=" ")}return n.join("")}function Xk(e,t,n){const s=tk(e.schema,t),o=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let l=e.quote,r;if(s.overloadedBoolean&&(n===s.attribute||n==="")?n=!0:(s.boolean||s.overloadedBoolean)&&(typeof n!="string"||n===s.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const a=hs(s.attribute,Object.assign({},e.settings.characterReferences,{subset:wo.name[o][i]}));return n===!0||(n=Array.isArray(n)?(s.commaSeparated?Tk:Ik)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?a:(e.settings.preferUnquoted&&(r=hs(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:wo.unquoted[o][i]}))),r!==n&&(e.settings.quoteSmart&&oc(n,l)>oc(n,e.alternative)&&(l=e.alternative),r=l+hs(n,Object.assign({},e.settings.characterReferences,{subset:(l==="'"?wo.single:wo.double)[o][i],attribute:!0}))+l),a+(r&&"="+r))}const Qk=["<","&"];function Hd(e,t,n,s){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:hs(e.value,Object.assign({},s.settings.characterReferences,{subset:Qk}))}function e0(e,t,n,s){return s.settings.allowDangerousHtml?e.value:Hd(e,t,n,s)}function t0(e,t,n,s){return s.all(e)}const n0=ik("type",{invalid:s0,unknown:o0,handlers:{comment:xk,doctype:Ck,element:Zk,raw:e0,root:t0,text:Hd}});function s0(e){throw new Error("Expected node, not `"+e+"`")}function o0(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const i0={},l0={},r0=[];function a0(e,t){const n=t||i0,s=n.quote||'"',o=s==='"'?"'":'"';if(s!=='"'&&s!=="'")throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:c0,all:u0,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||Y1,characterReferences:n.characterReferences||l0,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Fd:ok,quote:s,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function c0(e,t,n){return n0(e,t,n,this)}function u0(e){const t=[],n=e&&e.children||r0;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function ti(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},s=typeof e=="string"?e:e.name;for(const[o,i]of Object.entries((t==null?void 0:t.colorReplacements)||{}))typeof i=="string"?n[o]=i:o===s&&Object.assign(n,i);return n}function Rn(e,t){return e&&((t==null?void 0:t[e==null?void 0:e.toLowerCase()])||e)}function d0(e){return Array.isArray(e)?e:[e]}async function Wd(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function $r(e){return!e||["plaintext","txt","text","plain"].includes(e)}function f0(e){return e==="ansi"||$r(e)}function xr(e){return e==="none"}function h0(e){return xr(e)}function qd(e,t){var s;if(!t)return e;e.properties||(e.properties={}),(s=e.properties).class||(s.class=[]),typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const o of n)o&&!e.properties.class.includes(o)&&e.properties.class.push(o);return e}function Ii(e,t=!1){var i;if(e.length===0)return[["",0]];const n=e.split(/(\r?\n)/g);let s=0;const o=[];for(let l=0;l<n.length;l+=2){const r=t?n[l]+(n[l+1]||""):n[l];o.push([r,s]),s+=n[l].length,s+=((i=n[l+1])==null?void 0:i.length)||0}return o}function p0(e){const t=Ii(e,!0).map(([o])=>o);function n(o){if(o===e.length)return{line:t.length-1,character:t[t.length-1].length};let i=o,l=0;for(const r of t){if(i<r.length)break;i-=r.length,l++}return{line:l,character:i}}function s(o,i){let l=0;for(let r=0;r<o;r++)l+=t[r].length;return l+=i,l}return{lines:t,indexToPos:n,posToIndex:s}}const Cr="light-dark()",g0=["color","background-color"];function m0(e,t){let n=0;const s=[];for(const o of t)o>n&&s.push({...e,content:e.content.slice(n,o),offset:e.offset+n}),n=o;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function v0(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((s,o)=>s-o);return n.length?e.map(s=>s.flatMap(o=>{const i=n.filter(l=>o.offset<l&&l<o.offset+o.content.length).map(l=>l-o.offset).sort((l,r)=>l-r);return i.length?m0(o,i):o})):e}function y0(e,t,n,s,o="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},l=t.map(u=>ni(e.variants[u])),r=new Set(l.flatMap(u=>Object.keys(u))),a={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+t[u]+(f==="color"?"":h)};return l.forEach((u,f)=>{for(const h of r){const p=u[h]||"inherit";if(f===0&&s&&g0.includes(h))if(s===Cr&&l.length>1){const v=t.findIndex($=>$==="light"),k=t.findIndex($=>$==="dark");if(v===-1||k===-1)throw new mt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const w=l[v][h]||"inherit",S=l[k][h]||"inherit";a[h]=`light-dark(${w}, ${S})`,o==="css-vars"&&(a[c(f,h)]=p)}else a[h]=p;else o==="css-vars"&&(a[c(f,h)]=p)}}),i.htmlStyle=a,i}function ni(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&xt.Italic&&(t["font-style"]="italic"),e.fontStyle&xt.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&xt.Underline&&n.push("underline"),e.fontStyle&xt.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function Ul(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}const Vd=new WeakMap;function Ri(e,t){Vd.set(e,t)}function Qs(e){return Vd.get(e)}class ys{constructor(...t){z(this,"_stacks",{});z(this,"lang");if(t.length===2){const[n,s]=t;this.lang=s,this._stacks=n}else{const[n,s,o]=t;this.lang=s,this._stacks={[o]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new ys(Object.fromEntries(d0(n).map(s=>[s,Dl])),t)}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return b0(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function b0(e){const t=[],n=new Set;function s(o){var l;if(n.has(o))return;n.add(o);const i=(l=o==null?void 0:o.nameScopesList)==null?void 0:l.scopeName;i&&t.push(i),o.parent&&s(o.parent)}return s(e),t}function k0(e,t){if(!(e instanceof ys))throw new mt("Invalid grammar state");return e.getInternalStack(t)}function w0(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let s=function(l){if(typeof l=="number"){if(l<0||l>n.source.length)throw new mt(`Invalid decoration offset: ${l}. Code length: ${n.source.length}`);return{...o.indexToPos(l),offset:l}}else{const r=o.lines[l.line];if(r===void 0)throw new mt(`Invalid decoration position ${JSON.stringify(l)}. Lines length: ${o.lines.length}`);let a=l.character;if(a<0&&(a=r.length+a),a<0||a>r.length)throw new mt(`Invalid decoration position ${JSON.stringify(l)}. Line ${l.line} length: ${r.length}`);return{...l,character:a,offset:o.posToIndex(l.line,a)}}};const o=p0(n.source),i=(n.options.decorations||[]).map(l=>({...l,start:s(l.start),end:s(l.end)}));_0(i),e.set(n.meta,{decorations:i,converter:o,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){var l;if(!((l=this.options.decorations)!=null&&l.length))return;const o=t(this).decorations.flatMap(r=>[r.start.offset,r.end.offset]);return v0(n,o)},code(n){var u;if(!((u=this.options.decorations)!=null&&u.length))return;const s=t(this),o=Array.from(n.children).filter(f=>f.type==="element"&&f.tagName==="span");if(o.length!==s.converter.lines.length)throw new mt(`Number of lines in code element (${o.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function i(f,h,p,v){const k=o[f];let w="",S=-1,$=-1;if(h===0&&(S=0),p===0&&($=0),p===Number.POSITIVE_INFINITY&&($=k.children.length),S===-1||$===-1)for(let P=0;P<k.children.length;P++)w+=Kd(k.children[P]),S===-1&&w.length===h&&(S=P+1),$===-1&&w.length===p&&($=P+1);if(S===-1)throw new mt(`Failed to find start index for decoration ${JSON.stringify(v.start)}`);if($===-1)throw new mt(`Failed to find end index for decoration ${JSON.stringify(v.end)}`);const M=k.children.slice(S,$);if(!v.alwaysWrap&&M.length===k.children.length)r(k,v,"line");else if(!v.alwaysWrap&&M.length===1&&M[0].type==="element")r(M[0],v,"token");else{const P={type:"element",tagName:"span",properties:{},children:M};r(P,v,"wrapper"),k.children.splice(S,M.length,P)}}function l(f,h){o[f]=r(o[f],h,"line")}function r(f,h,p){var w;const v=h.properties||{},k=h.transform||(S=>S);return f.tagName=h.tagName||"span",f.properties={...f.properties,...v,class:f.properties.class},(w=h.properties)!=null&&w.class&&qd(f,h.properties.class),f=k(f,p)||f,f}const a=[],c=s.decorations.sort((f,h)=>h.start.offset-f.start.offset||f.end.offset-h.end.offset);for(const f of c){const{start:h,end:p}=f;if(h.line===p.line)i(h.line,h.character,p.character,f);else if(h.line<p.line){i(h.line,h.character,Number.POSITIVE_INFINITY,f);for(let v=h.line+1;v<p.line;v++)a.unshift(()=>l(v,f));i(p.line,0,p.character,f)}}a.forEach(f=>f())}}}function _0(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new mt(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const o=e[s],i=n.start.offset<=o.start.offset&&o.start.offset<n.end.offset,l=n.start.offset<o.end.offset&&o.end.offset<=n.end.offset,r=o.start.offset<=n.start.offset&&n.start.offset<o.end.offset,a=o.start.offset<n.end.offset&&n.end.offset<=o.end.offset;if(i||l||r||a){if(i&&l||r&&a||r&&n.start.offset===n.end.offset||l&&o.start.offset===o.end.offset)continue;throw new mt(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(o.start)} intersect.`)}}}}function Kd(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Kd).join(""):""}const S0=[w0()];function si(e){const t=$0(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...S0]}function $0(e){const t=[],n=[],s=[];for(const o of e)switch(o.enforce){case"pre":t.push(o);break;case"post":n.push(o);break;default:s.push(o)}return{pre:t,post:n,normal:s}}var Hn=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],nl={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function x0(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const s=e.indexOf("m",n);if(s!==-1)return{sequence:e.substring(n+2,s).split(";"),startPosition:n,position:s+1}}return{position:e.length}}function ac(e){const t=e.shift();if(t==="2"){const n=e.splice(0,3).map(s=>Number.parseInt(s));return n.length!==3||n.some(s=>Number.isNaN(s))?void 0:{type:"rgb",rgb:n}}else if(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function C0(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(s===0)t.push({type:"resetAll"});else if(s<=9)nl[s]&&t.push({type:"setDecoration",value:nl[s]});else if(s<=29){const o=nl[s-20];o&&(t.push({type:"resetDecoration",value:o}),o==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Hn[s-30]}});else if(s===38){const o=ac(e);o&&t.push({type:"setForegroundColor",value:o})}else if(s===39)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Hn[s-40]}});else if(s===48){const o=ac(e);o&&t.push({type:"setBackgroundColor",value:o})}else s===49?t.push({type:"resetBackgroundColor"}):s===53?t.push({type:"setDecoration",value:"overline"}):s===55?t.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Hn[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Hn[s-100+8]}})}return t}function T0(){let e=null,t=null,n=new Set;return{parse(s){const o=[];let i=0;do{const l=x0(s,i),r=l.sequence?s.substring(i,l.startPosition):s.substring(i);if(r.length>0&&o.push({value:r,foreground:e,background:t,decorations:new Set(n)}),l.sequence){const a=C0(l.sequence);for(const c of a)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of a)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}i=l.position}while(i<s.length);return o}}}var I0={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function R0(e=I0){function t(r){return e[r]}function n(r){return`#${r.map(a=>Math.max(0,Math.min(a,255)).toString(16).padStart(2,"0")).join("")}`}let s;function o(){if(s)return s;s=[];for(let c=0;c<Hn.length;c++)s.push(t(Hn[c]));let r=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let f=0;f<6;f++)s.push(n([r[c],r[u],r[f]]));let a=8;for(let c=0;c<24;c++,a+=10)s.push(n([a,a,a]));return s}function i(r){return o()[r]}function l(r){switch(r.type){case"named":return t(r.name);case"rgb":return n(r.rgb);case"table":return i(r.index)}}return{value:l}}const A0={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function E0(e,t,n){const s=ti(e,n),o=Ii(t),i=Object.fromEntries(Hn.map(a=>{var f;const c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`,u=(f=e.colors)==null?void 0:f[c];return[a,u||A0[a]]})),l=R0(i),r=T0();return o.map(a=>r.parse(a[0]).map(c=>{let u,f;c.decorations.has("reverse")?(u=c.background?l.value(c.background):e.bg,f=c.foreground?l.value(c.foreground):e.fg):(u=c.foreground?l.value(c.foreground):e.fg,f=c.background?l.value(c.background):void 0),u=Rn(u,s),f=Rn(f,s),c.decorations.has("dim")&&(u=M0(u));let h=xt.None;return c.decorations.has("bold")&&(h|=xt.Bold),c.decorations.has("italic")&&(h|=xt.Italic),c.decorations.has("underline")&&(h|=xt.Underline),c.decorations.has("strikethrough")&&(h|=xt.Strikethrough),{content:c.value,offset:a[1],color:u,bgColor:f,fontStyle:h}}))}function M0(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const s=t[1];if(s.length===8){const o=Math.round(Number.parseInt(s.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${s.slice(0,6)}${o}`}else{if(s.length===6)return`#${s}80`;if(s.length===4){const o=s[0],i=s[1],l=s[2],r=s[3],a=Math.round(Number.parseInt(`${r}${r}`,16)/2).toString(16).padStart(2,"0");return`#${o}${o}${i}${i}${l}${l}${a}`}else if(s.length===3){const o=s[0],i=s[1],l=s[2];return`#${o}${o}${i}${i}${l}${l}80`}}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}function Tr(e,t,n={}){const{theme:s=e.getLoadedThemes()[0]}=n,o=e.resolveLangAlias(n.lang||"text");if($r(o)||xr(s))return Ii(t).map(a=>[{content:a[0],offset:a[1]}]);const{theme:i,colorMap:l}=e.setTheme(s);if(o==="ansi")return E0(i,t,n);const r=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==r.name)throw new mt(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${r.name}"`);if(!n.grammarState.themes.includes(i.name))throw new mt(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return L0(t,r,i,l,n)}function P0(...e){if(e.length===2)return Qs(e[1]);const[t,n,s={}]=e,{lang:o="text",theme:i=t.getLoadedThemes()[0]}=s;if($r(o)||xr(i))throw new mt("Plain language does not have grammar state");if(o==="ansi")throw new mt("ANSI language does not have grammar state");const{theme:l,colorMap:r}=t.setTheme(i),a=t.getLanguage(o);return new ys(Ir(n,a,l,r,s).stateStack,a.name,l.name)}function L0(e,t,n,s,o){const i=Ir(e,t,n,s,o),l=new ys(i.stateStack,t.name,n.name);return Ri(i.tokens,l),i.tokens}function Ir(e,t,n,s,o){const i=ti(n,o),{tokenizeMaxLineLength:l=0,tokenizeTimeLimit:r=500}=o,a=Ii(e);let c=o.grammarState?k0(o.grammarState,n.name)??Dl:o.grammarContextCode!=null?Ir(o.grammarContextCode,t,n,s,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:Dl,u=[];const f=[];for(let h=0,p=a.length;h<p;h++){const[v,k]=a[h];if(v===""){u=[],f.push([]);continue}if(l>0&&v.length>=l){u=[],f.push([{content:v,offset:k,color:"",fontStyle:0}]);continue}let w,S,$;o.includeExplanation&&(w=t.tokenizeLine(v,c,r),S=w.tokens,$=0);const M=t.tokenizeLine2(v,c,r),P=M.tokens.length/2;for(let Z=0;Z<P;Z++){const j=M.tokens[2*Z],C=Z+1<P?M.tokens[2*Z+2]:v.length;if(j===C)continue;const x=M.tokens[2*Z+1],y=Rn(s[ms.getForeground(x)],i),T=ms.getFontStyle(x),O={content:v.substring(j,C),offset:k+j,color:y,fontStyle:T};if(o.includeExplanation){const I=[];if(o.includeExplanation!=="scopeName")for(const L of n.settings){let B;switch(typeof L.scope){case"string":B=L.scope.split(/,/).map(ne=>ne.trim());break;case"object":B=L.scope;break;default:continue}I.push({settings:L,selectors:B.map(ne=>ne.split(/ /))})}O.explanation=[];let H=0;for(;j+H<C;){const L=S[$],B=v.substring(L.startIndex,L.endIndex);H+=B.length,O.explanation.push({content:B,scopes:o.includeExplanation==="scopeName"?O0(L.scopes):D0(I,L.scopes)}),$+=1}}u.push(O)}f.push(u),u=[],c=M.ruleStack}return{tokens:f,stateStack:c}}function O0(e){return e.map(t=>({scopeName:t}))}function D0(e,t){const n=[];for(let s=0,o=t.length;s<o;s++){const i=t[s];n[s]={scopeName:i,themeMatches:B0(e,i,t.slice(0,s))}}return n}function cc(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function N0(e,t,n){if(!cc(e[e.length-1],t))return!1;let s=e.length-2,o=n.length-1;for(;s>=0&&o>=0;)cc(e[s],n[o])&&(s-=1),o-=1;return s===-1}function B0(e,t,n){const s=[];for(const{selectors:o,settings:i}of e)for(const l of o)if(N0(l,t,n)){s.push(i);break}return s}function Yd(e,t,n){const s=Object.entries(n.themes).filter(a=>a[1]).map(a=>({color:a[0],theme:a[1]})),o=s.map(a=>{const c=Tr(e,t,{...n,theme:a.theme}),u=Qs(c),f=typeof a.theme=="string"?a.theme:a.theme.name;return{tokens:c,state:u,theme:f}}),i=F0(...o.map(a=>a.tokens)),l=i[0].map((a,c)=>a.map((u,f)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=u.explanation),i.forEach((p,v)=>{const{content:k,explanation:w,offset:S,...$}=p[c][f];h.variants[s[v].color]=$}),h})),r=o[0].state?new ys(Object.fromEntries(o.map(a=>{var c;return[a.theme,(c=a.state)==null?void 0:c.getInternalStack(a.theme)]})),o[0].state.lang):void 0;return r&&Ri(l,r),l}function F0(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const o=e.map(a=>a[s]),i=t.map(()=>[]);t.forEach((a,c)=>a.push(i[c]));const l=o.map(()=>0),r=o.map(a=>a[0]);for(;r.every(a=>a);){const a=Math.min(...r.map(c=>c.content.length));for(let c=0;c<n;c++){const u=r[c];u.content.length===a?(i[c].push(u),l[c]+=1,r[c]=o[c][l[c]]):(i[c].push({...u,content:u.content.slice(0,a)}),r[c]={...u,content:u.content.slice(a),offset:u.offset+a})}}}return t}function oi(e,t,n){let s,o,i,l,r,a;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(S=>S[1]).map(S=>({color:S[0],theme:S[1]})).sort((S,$)=>S.color===c?-1:$.color===c?1:0);if(h.length===0)throw new mt("`themes` option must not be empty");const p=Yd(e,t,n);if(a=Qs(p),c&&Cr!==c&&!h.find(S=>S.color===c))throw new mt(`\`themes\` option must contain the defaultColor key \`${c}\``);const v=h.map(S=>e.getTheme(S.theme)),k=h.map(S=>S.color);i=p.map(S=>S.map($=>y0($,k,u,c,f))),a&&Ri(i,a);const w=h.map(S=>ti(S.theme,n));o=uc(h,v,w,u,c,"fg",f),s=uc(h,v,w,u,c,"bg",f),l=`shiki-themes ${v.map(S=>S.name).join(" ")}`,r=c?void 0:[o,s].join(";")}else if("theme"in n){const c=ti(n.theme,n);i=Tr(e,t,n);const u=e.getTheme(n.theme);s=Rn(u.bg,c),o=Rn(u.fg,c),l=u.name,a=Qs(i)}else throw new mt("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:o,bg:s,themeName:l,rootStyle:r,grammarState:a}}function uc(e,t,n,s,o,i,l){return e.map((r,a)=>{const c=Rn(t[a][i],n[a])||"inherit",u=`${s+r.color}${i==="bg"?"-bg":""}:${c}`;if(a===0&&o){if(o===Cr&&e.length>1){const f=e.findIndex(k=>k.color==="light"),h=e.findIndex(k=>k.color==="dark");if(f===-1||h===-1)throw new mt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=Rn(t[f][i],n[f])||"inherit",v=Rn(t[h][i],n[h])||"inherit";return`light-dark(${p}, ${v});${u}`}return c}return l==="css-vars"?u:null}).filter(r=>!!r).join(";")}function ii(e,t,n,s={meta:{},options:n,codeToHast:(o,i)=>ii(e,o,i),codeToTokens:(o,i)=>oi(e,o,i)}){var v,k;let o=t;for(const w of si(n))o=((v=w.preprocess)==null?void 0:v.call(s,o,n))||o;let{tokens:i,fg:l,bg:r,themeName:a,rootStyle:c,grammarState:u}=oi(e,o,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?i=U0(i):f==="never"&&(i=G0(i)),h&&(i=z0(i));const p={...s,get source(){return o}};for(const w of si(n))i=((k=w.tokens)==null?void 0:k.call(p,i))||i;return j0(i,{...n,fg:l,bg:r,themeName:a,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},p,u)}function j0(e,t,n,s=Qs(e)){var k,w,S,$;const o=si(t),i=[],l={type:"root",children:[]},{structure:r="classic",tabindex:a="0"}=t,c={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),a!==!1&&a!=null&&(c.tabindex=a.toString());for(const[M,P]of Object.entries(t.meta||{}))M.startsWith("_")||(c[M]=P);let u={type:"element",tagName:"pre",properties:c,children:[],data:t.data},f={type:"element",tagName:"code",properties:{},children:i};const h=[],p={...n,structure:r,addClassToHast:qd,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return l},get pre(){return u},get code(){return f},get lines(){return h}};if(e.forEach((M,P)=>{var C,x;P&&(r==="inline"?l.children.push({type:"element",tagName:"br",properties:{},children:[]}):r==="classic"&&i.push({type:"text",value:`
|
|
85
|
-
`}));let Z={type:"element",tagName:"span",properties:{class:"line"},children:[]},j=0;for(const y of M){let T={type:"element",tagName:"span",properties:{...y.htmlAttrs},children:[{type:"text",value:y.content}]};const O=Ul(y.htmlStyle||ni(y));O&&(T.properties.style=O);for(const I of o)T=((C=I==null?void 0:I.span)==null?void 0:C.call(p,T,P+1,j,Z,y))||T;r==="inline"?l.children.push(T):r==="classic"&&Z.children.push(T),j+=y.content.length}if(r==="classic"){for(const y of o)Z=((x=y==null?void 0:y.line)==null?void 0:x.call(p,Z,P+1))||Z;h.push(Z),i.push(Z)}else r==="inline"&&h.push(Z)}),r==="classic"){for(const M of o)f=((k=M==null?void 0:M.code)==null?void 0:k.call(p,f))||f;u.children.push(f);for(const M of o)u=((w=M==null?void 0:M.pre)==null?void 0:w.call(p,u))||u;l.children.push(u)}else if(r==="inline"){const M=[];let P={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const C of l.children)C.type==="element"&&C.tagName==="br"?(M.push(P),P={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(C.type==="element"||C.type==="text")&&P.children.push(C);M.push(P);let j={type:"element",tagName:"code",properties:{},children:M};for(const C of o)j=((S=C==null?void 0:C.code)==null?void 0:S.call(p,j))||j;l.children=[];for(let C=0;C<j.children.length;C++){C>0&&l.children.push({type:"element",tagName:"br",properties:{},children:[]});const x=j.children[C];x.type==="element"&&l.children.push(...x.children)}}let v=l;for(const M of o)v=(($=M==null?void 0:M.root)==null?void 0:$.call(p,v))||v;return s&&Ri(v,s),v}function U0(e){return e.map(t=>{const n=[];let s="",o;return t.forEach((i,l)=>{const a=!(i.fontStyle&&(i.fontStyle&xt.Underline||i.fontStyle&xt.Strikethrough));a&&i.content.match(/^\s+$/)&&t[l+1]?(o===void 0&&(o=i.offset),s+=i.content):s?(a?n.push({...i,offset:o,content:s+i.content}):n.push({content:s,offset:o},i),o=void 0,s=""):n.push(i)}),n})}function G0(e){return e.map(t=>t.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const s=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!s)return n;const[,o,i,l]=s;if(!o&&!l)return n;const r=[{...n,offset:n.offset+o.length,content:i}];return o&&r.unshift({content:o,offset:n.offset}),l&&r.push({content:l,offset:n.offset+o.length+i.length}),r}))}function z0(e){return e.map(t=>{const n=[];for(const s of t){if(n.length===0){n.push({...s});continue}const o=n[n.length-1],i=Ul(o.htmlStyle||ni(o)),l=Ul(s.htmlStyle||ni(s)),r=o.fontStyle&&(o.fontStyle&xt.Underline||o.fontStyle&xt.Strikethrough),a=s.fontStyle&&(s.fontStyle&xt.Underline||s.fontStyle&xt.Strikethrough);!r&&!a&&i===l?o.content+=s.content:n.push({...s})}return n})}const H0=a0;function W0(e,t,n){var i;const s={meta:{},options:n,codeToHast:(l,r)=>ii(e,l,r),codeToTokens:(l,r)=>oi(e,l,r)};let o=H0(ii(e,t,n,s));for(const l of si(n))o=((i=l.postprocess)==null?void 0:i.call(s,o,n))||o;return o}const dc={light:"#333333",dark:"#bbbbbb"},fc={light:"#fffffe",dark:"#1e1e1e"},hc="__shiki_resolved";function Rr(e){var r,a,c,u,f;if(e!=null&&e[hc])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const h=t.settings?t.settings.find(p=>!p.name&&!p.scope):void 0;(r=h==null?void 0:h.settings)!=null&&r.foreground&&(s=h.settings.foreground),(a=h==null?void 0:h.settings)!=null&&a.background&&(n=h.settings.background),!s&&((c=t==null?void 0:t.colors)!=null&&c["editor.foreground"])&&(s=t.colors["editor.foreground"]),!n&&((u=t==null?void 0:t.colors)!=null&&u["editor.background"])&&(n=t.colors["editor.background"]),s||(s=t.type==="light"?dc.light:dc.dark),n||(n=t.type==="light"?fc.light:fc.dark),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const i=new Map;function l(h){var v;if(i.has(h))return i.get(h);o+=1;const p=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return(v=t.colorReplacements)!=null&&v[`#${p}`]?l(h):(i.set(h,p),p)}t.settings=t.settings.map(h=>{var w,S;const p=((w=h.settings)==null?void 0:w.foreground)&&!h.settings.foreground.startsWith("#"),v=((S=h.settings)==null?void 0:S.background)&&!h.settings.background.startsWith("#");if(!p&&!v)return h;const k={...h,settings:{...h.settings}};if(p){const $=l(h.settings.foreground);t.colorReplacements[$]=h.settings.foreground,k.settings.foreground=$}if(v){const $=l(h.settings.background);t.colorReplacements[$]=h.settings.background,k.settings.background=$}return k});for(const h of Object.keys(t.colors||{}))if((h==="editor.foreground"||h==="editor.background"||h.startsWith("terminal.ansi"))&&!((f=t.colors[h])!=null&&f.startsWith("#"))){const p=l(t.colors[h]);t.colorReplacements[p]=t.colors[h],t.colors[h]=p}return Object.defineProperty(t,hc,{enumerable:!1,writable:!1,value:!0}),t}async function Zd(e){return Array.from(new Set((await Promise.all(e.filter(t=>!f0(t)).map(async t=>await Wd(t).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Jd(e){return(await Promise.all(e.map(async n=>h0(n)?null:Rr(await Wd(n))))).filter(n=>!!n)}let q0=3;function V0(e,t=3){t>q0||console.trace(`[SHIKI DEPRECATE]: ${e}`)}let ls=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Xd(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new ls(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class K0 extends K1{constructor(n,s,o,i={}){super(n);z(this,"_resolvedThemes",new Map);z(this,"_resolvedGrammars",new Map);z(this,"_langMap",new Map);z(this,"_langGraph",new Map);z(this,"_textmateThemeCache",new WeakMap);z(this,"_loadedThemesCache",null);z(this,"_loadedLanguagesCache",null);this._resolver=n,this._themes=s,this._langs=o,this._alias=i,this._themes.map(l=>this.loadTheme(l)),this.loadLanguages(this._langs)}getTheme(n){return typeof n=="string"?this._resolvedThemes.get(n):this.loadTheme(n)}loadTheme(n){const s=Rr(n);return s.name&&(this._resolvedThemes.set(s.name,s),this._loadedThemesCache=null),s}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(n){let s=this._textmateThemeCache.get(n);s||(s=Zo.createFromRawTheme(n),this._textmateThemeCache.set(n,s)),this._syncRegistry.setTheme(s)}getGrammar(n){return n=Xd(n,this._alias),this._resolvedGrammars.get(n)}loadLanguage(n){var l,r,a,c;if(this.getGrammar(n.name))return;const s=new Set([...this._langMap.values()].filter(u=>{var f;return(f=u.embeddedLangsLazy)==null?void 0:f.includes(n.name)}));this._resolver.addLanguage(n);const o={balancedBracketSelectors:n.balancedBracketSelectors||["*"],unbalancedBracketSelectors:n.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(n.scopeName,n);const i=this.loadGrammarWithConfiguration(n.scopeName,1,o);if(i.name=n.name,this._resolvedGrammars.set(n.name,i),n.aliases&&n.aliases.forEach(u=>{this._alias[u]=n.name}),this._loadedLanguagesCache=null,s.size)for(const u of s)this._resolvedGrammars.delete(u.name),this._loadedLanguagesCache=null,(r=(l=this._syncRegistry)==null?void 0:l._injectionGrammars)==null||r.delete(u.scopeName),(c=(a=this._syncRegistry)==null?void 0:a._grammars)==null||c.delete(u.scopeName),this.loadLanguage(this._langMap.get(u.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(n){for(const i of n)this.resolveEmbeddedLanguages(i);const s=Array.from(this._langGraph.entries()),o=s.filter(([i,l])=>!l);if(o.length){const i=s.filter(([l,r])=>{if(!r)return!1;const a=r.embeddedLanguages||r.embeddedLangs;return a==null?void 0:a.some(c=>o.map(([u])=>u).includes(c))}).filter(l=>!o.includes(l));throw new ls(`Missing languages ${o.map(([l])=>`\`${l}\``).join(", ")}, required by ${i.map(([l])=>`\`${l}\``).join(", ")}`)}for(const[i,l]of s)this._resolver.addLanguage(l);for(const[i,l]of s)this.loadLanguage(l)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(n){this._langMap.set(n.name,n),this._langGraph.set(n.name,n);const s=n.embeddedLanguages??n.embeddedLangs;if(s)for(const o of s)this._langGraph.set(o,this._langMap.get(o))}}class Y0{constructor(t,n){z(this,"_langs",new Map);z(this,"_scopeToLang",new Map);z(this,"_injections",new Map);z(this,"_onigLib");this._onigLib={createOnigScanner:s=>t.createScanner(s),createOnigString:s=>t.createString(s)},n.forEach(s=>this.addLanguage(s))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(n=>{this._langs.set(n,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(t.scopeName)})}getInjections(t){const n=t.split(".");let s=[];for(let o=1;o<=n.length;o++){const i=n.slice(0,o).join(".");s=[...s,...this._injections.get(i)||[]]}return s}}let Ts=0;function Z0(e){Ts+=1,e.warnings!==!1&&Ts>=10&&Ts%10===0&&console.warn(`[Shiki] ${Ts} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new ls("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(Rr),o=new Y0(e.engine,n),i=new K0(o,s,n,e.langAlias);let l;function r(M){return Xd(M,e.langAlias)}function a(M){S();const P=i.getGrammar(typeof M=="string"?M:M.name);if(!P)throw new ls(`Language \`${M}\` not found, you may need to load it first`);return P}function c(M){if(M==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};S();const P=i.getTheme(M);if(!P)throw new ls(`Theme \`${M}\` not found, you may need to load it first`);return P}function u(M){S();const P=c(M);l!==M&&(i.setTheme(P),l=M);const Z=i.getColorMap();return{theme:P,colorMap:Z}}function f(){return S(),i.getLoadedThemes()}function h(){return S(),i.getLoadedLanguages()}function p(...M){S(),i.loadLanguages(M.flat(1))}async function v(...M){return p(await Zd(M))}function k(...M){S();for(const P of M.flat(1))i.loadTheme(P)}async function w(...M){return S(),k(await Jd(M))}function S(){if(t)throw new ls("Shiki instance has been disposed")}function $(){t||(t=!0,i.dispose(),Ts-=1)}return{setTheme:u,getTheme:c,getLanguage:a,getLoadedThemes:f,getLoadedLanguages:h,resolveLangAlias:r,loadLanguage:v,loadLanguageSync:p,loadTheme:w,loadThemeSync:k,dispose:$,[Symbol.dispose]:$}}async function J0(e){e.engine||V0("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,s]=await Promise.all([Jd(e.themes||[]),Zd(e.langs||[]),e.engine]);return Z0({...e,themes:t,langs:n,engine:s})}async function X0(e){const t=await J0(e);return{getLastGrammarState:(...n)=>P0(t,...n),codeToTokensBase:(n,s)=>Tr(t,n,s),codeToTokensWithThemes:(n,s)=>Yd(t,n,s),codeToTokens:(n,s)=>oi(t,n,s),codeToHast:(n,s)=>ii(t,n,s),codeToHtml:(n,s)=>W0(t,n,s),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}class Ar extends Error{constructor(t){super(t),this.name="ShikiError"}}function Q0(){return 2147483648}function ew(){return typeof performance<"u"?performance.now():Date.now()}const tw=(e,t)=>e+(t-e%t)%t;async function nw(e){let t,n;const s={};function o(p){n=p,s.HEAPU8=new Uint8Array(p),s.HEAPU32=new Uint32Array(p)}function i(p,v,k){s.HEAPU8.copyWithin(p,v,v+k)}function l(p){try{return t.grow(p-n.byteLength+65535>>>16),o(t.buffer),1}catch{}}function r(p){const v=s.HEAPU8.length;p=p>>>0;const k=Q0();if(p>k)return!1;for(let w=1;w<=4;w*=2){let S=v*(1+.2/w);S=Math.min(S,p+100663296);const $=Math.min(k,tw(Math.max(p,S),65536));if(l($))return!0}return!1}const a=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(p,v,k=1024){const w=v+k;let S=v;for(;p[S]&&!(S>=w);)++S;if(S-v>16&&p.buffer&&a)return a.decode(p.subarray(v,S));let $="";for(;v<S;){let M=p[v++];if(!(M&128)){$+=String.fromCharCode(M);continue}const P=p[v++]&63;if((M&224)===192){$+=String.fromCharCode((M&31)<<6|P);continue}const Z=p[v++]&63;if((M&240)===224?M=(M&15)<<12|P<<6|Z:M=(M&7)<<18|P<<12|Z<<6|p[v++]&63,M<65536)$+=String.fromCharCode(M);else{const j=M-65536;$+=String.fromCharCode(55296|j>>10,56320|j&1023)}}return $}function u(p,v){return p?c(s.HEAPU8,p,v):""}const f={emscripten_get_now:ew,emscripten_memcpy_big:i,emscripten_resize_heap:r,fd_write:()=>0};async function h(){const v=await e({env:f,wasi_snapshot_preview1:f});t=v.memory,o(t.buffer),Object.assign(s,v),s.UTF8ToString=u}return await h(),s}var sw=Object.defineProperty,ow=(e,t,n)=>t in e?sw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dt=(e,t,n)=>ow(e,typeof t!="symbol"?t+"":t,n);let gt=null;function iw(e){throw new Ar(e.UTF8ToString(e.getLastOnigError()))}class Ai{constructor(t){dt(this,"utf16Length"),dt(this,"utf8Length"),dt(this,"utf16Value"),dt(this,"utf8Value"),dt(this,"utf16OffsetToUtf8"),dt(this,"utf8OffsetToUtf16");const n=t.length,s=Ai._utf8ByteLength(t),o=s!==n,i=o?new Uint32Array(n+1):null;o&&(i[n]=s);const l=o?new Uint32Array(s+1):null;o&&(l[s]=n);const r=new Uint8Array(s);let a=0;for(let c=0;c<n;c++){const u=t.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const p=t.charCodeAt(c+1);p>=56320&&p<=57343&&(f=(u-55296<<10)+65536|p-56320,h=!0)}o&&(i[c]=a,h&&(i[c+1]=a),f<=127?l[a+0]=c:f<=2047?(l[a+0]=c,l[a+1]=c):f<=65535?(l[a+0]=c,l[a+1]=c,l[a+2]=c):(l[a+0]=c,l[a+1]=c,l[a+2]=c,l[a+3]=c)),f<=127?r[a++]=f:f<=2047?(r[a++]=192|(f&1984)>>>6,r[a++]=128|(f&63)>>>0):f<=65535?(r[a++]=224|(f&61440)>>>12,r[a++]=128|(f&4032)>>>6,r[a++]=128|(f&63)>>>0):(r[a++]=240|(f&1835008)>>>18,r[a++]=128|(f&258048)>>>12,r[a++]=128|(f&4032)>>>6,r[a++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=s,this.utf16Value=t,this.utf8Value=r,this.utf16OffsetToUtf8=i,this.utf8OffsetToUtf16=l}static _utf8ByteLength(t){let n=0;for(let s=0,o=t.length;s<o;s++){const i=t.charCodeAt(s);let l=i,r=!1;if(i>=55296&&i<=56319&&s+1<o){const a=t.charCodeAt(s+1);a>=56320&&a<=57343&&(l=(i-55296<<10)+65536|a-56320,r=!0)}l<=127?n+=1:l<=2047?n+=2:l<=65535?n+=3:n+=4,r&&s++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const Ei=class nn{constructor(t){if(dt(this,"id",++nn.LAST_ID),dt(this,"_onigBinding"),dt(this,"content"),dt(this,"utf16Length"),dt(this,"utf8Length"),dt(this,"utf16OffsetToUtf8"),dt(this,"utf8OffsetToUtf16"),dt(this,"ptr"),!gt)throw new Ar("Must invoke loadWasm first.");this._onigBinding=gt,this.content=t;const n=new Ai(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!nn._sharedPtrInUse?(nn._sharedPtr||(nn._sharedPtr=gt.omalloc(1e4)),nn._sharedPtrInUse=!0,gt.HEAPU8.set(n.utf8Value,nn._sharedPtr),this.ptr=nn._sharedPtr):this.ptr=n.createString(gt)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===nn._sharedPtr?nn._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};dt(Ei,"LAST_ID",0);dt(Ei,"_sharedPtr",0);dt(Ei,"_sharedPtrInUse",!1);let Qd=Ei;class lw{constructor(t){if(dt(this,"_onigBinding"),dt(this,"_ptr"),!gt)throw new Ar("Must invoke loadWasm first.");const n=[],s=[];for(let r=0,a=t.length;r<a;r++){const c=new Ai(t[r]);n[r]=c.createString(gt),s[r]=c.utf8Length}const o=gt.omalloc(4*t.length);gt.HEAPU32.set(n,o/4);const i=gt.omalloc(4*t.length);gt.HEAPU32.set(s,i/4);const l=gt.createOnigScanner(o,i,t.length);for(let r=0,a=t.length;r<a;r++)gt.ofree(n[r]);gt.ofree(i),gt.ofree(o),l===0&&iw(gt),this._onigBinding=gt,this._ptr=l}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,s){let o=0;if(typeof s=="number"&&(o=s),typeof t=="string"){t=new Qd(t);const i=this._findNextMatchSync(t,n,!1,o);return t.dispose(),i}return this._findNextMatchSync(t,n,!1,o)}_findNextMatchSync(t,n,s,o){const i=this._onigBinding,l=i.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),o);if(l===0)return null;const r=i.HEAPU32;let a=l/4;const c=r[a++],u=r[a++],f=[];for(let h=0;h<u;h++){const p=t.convertUtf8OffsetToUtf16(r[a++]),v=t.convertUtf8OffsetToUtf16(r[a++]);f[h]={start:p,end:v,length:v-p}}return{index:c,captureIndices:f}}}function rw(e){return typeof e.instantiator=="function"}function aw(e){return typeof e.default=="function"}function cw(e){return typeof e.data<"u"}function uw(e){return typeof Response<"u"&&e instanceof Response}function dw(e){var t;return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&((t=Buffer.isBuffer)==null?void 0:t.call(Buffer,e))||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let _o;function fw(e){if(_o)return _o;async function t(){gt=await nw(async n=>{let s=e;return s=await s,typeof s=="function"&&(s=await s(n)),typeof s=="function"&&(s=await s(n)),rw(s)?s=await s.instantiator(n):aw(s)?s=await s.default(n):(cw(s)&&(s=s.data),uw(s)?typeof WebAssembly.instantiateStreaming=="function"?s=await hw(s)(n):s=await pw(s)(n):dw(s)?s=await sl(s)(n):s instanceof WebAssembly.Module?s=await sl(s)(n):"default"in s&&s.default instanceof WebAssembly.Module&&(s=await sl(s.default)(n))),"instance"in s&&(s=s.instance),"exports"in s&&(s=s.exports),s})}return _o=t(),_o}function sl(e){return t=>WebAssembly.instantiate(e,t)}function hw(e){return t=>WebAssembly.instantiateStreaming(e,t)}function pw(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function gw(e){return e&&await fw(e),{createScanner(t){return new lw(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Qd(t)}}}const mw={class:"code-block"},vw={class:"code-header"},yw={class:"code-lang"},bw=["innerHTML"],kw=Te({__name:"CodeBlock",props:{code:{},lang:{},streaming:{type:Boolean}},setup(e){const t=e,n=vn("effectiveTheme",F(typeof document<"u"&&document.documentElement.dataset.theme==="dark"?"dark":"light")),s=F(""),o=F(""),i=F(!1);let l=null;const r=new Set,a=new Map,c={js:"javascript",ts:"typescript",py:"python",sh:"bash",shell:"bash",shscript:"bash","shell-script":"bash",yml:"yaml",md:"markdown",rs:"rust",rb:"ruby",go:"go",java:"java",c:"c",cpp:"cpp","c++":"cpp",cs:"csharp","c#":"csharp",kt:"kotlin",kts:"kotlin",scala:"scala",swift:"swift",dart:"dart",lua:"lua",r:"r",sql:"sql",toml:"toml",ini:"ini",xml:"xml",svelte:"svelte",astro:"astro",dockerfile:"docker",makefile:"make",graphql:"graphql",proto:"protobuf",pl:"perl",pm:"perl"};async function u(){if(l)return l;const[w,S]=await Promise.all([yo(()=>import("./github-dark-DHJKELXO.js"),[],import.meta.url),yo(()=>import("./github-light-DAi9KRSo.js"),[],import.meta.url)]);return l=await X0({themes:[w.default,S.default],langs:[],engine:gw(()=>yo(()=>import("./wasm-CG6Dc4jp.js"),[],import.meta.url))}),l}async function f(w){if(r.has(w))return!0;if(a.has(w))return await a.get(w),r.has(w);const S=(async()=>{try{const $=await u(),M=await yo(()=>import(`shiki/langs/${w}.mjs`),[],import.meta.url);await $.loadLanguage(M.default),r.add(w)}catch{}})();return a.set(w,S),await S,a.delete(w),r.has(w)}function h(w){const S=w.toLowerCase();return c[S]??S}async function p(){var M;const w=((M=t.lang)==null?void 0:M.toLowerCase())??"text",S=h(w),$=n.value==="light"?"github-light":"github-dark";try{const P=await u();await f(S)?s.value=P.codeToHtml(t.code,{lang:S,theme:$}):s.value=`<pre class="shiki-fallback"><code>${v(t.code)}</code></pre>`}catch{s.value=`<pre class="shiki-fallback"><code>${v(t.code)}</code></pre>`}}function v(w){return w.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">")}function k(){navigator.clipboard.writeText(t.code).then(()=>{i.value=!0,setTimeout(()=>i.value=!1,1500)})}return Me(()=>[t.code,t.lang,n.value],([w])=>{t.streaming?o.value=`<pre class="shiki-fallback"><code>${v(w)}</code></pre>`:p()},{immediate:!0}),Me(()=>t.streaming,(w,S)=>{S&&!w&&p()}),(w,S)=>(g(),m("div",mw,[d("div",vw,[d("span",yw,R(e.lang||"text"),1),d("button",{class:fe(["code-copy",{copied:i.value}]),onClick:k},R(i.value?"已复制":"复制"),3)]),d("div",{class:"code-content",innerHTML:t.streaming?o.value:s.value||o.value},null,8,bw)]))}}),Gl=Ie(kw,[["__scopeId","data-v-f94a1d0a"]]),In=An({open:!1,src:"",alt:""});function ef(e,t=""){e&&(In.src=e,In.alt=t,In.open=!0)}function ol(){In.open=!1}We.setOptions({gfm:!0,breaks:!1});const ww=4e4,Po=6e3,_w=Te({props:{content:{type:String,required:!0},streaming:{type:Boolean,default:!1}},setup(e){const t=F(e.content);let n=null;const s=F(!1);let o=e.content;Me(()=>e.content,a=>{!a.startsWith(o)&&!o.startsWith(a)&&(s.value=!1),o=a});const i=q(()=>!e.streaming&&!s.value&&t.value.length>ww);Me(()=>e.content,a=>{if(!e.streaming){t.value=a;return}n===null&&(n=requestAnimationFrame(()=>{n=null,t.value=e.content}))}),Me(()=>e.streaming,(a,c)=>{c&&!a&&(n!==null&&(cancelAnimationFrame(n),n=null),t.value=e.content)});const l=q(()=>{const a=i.value?Sw(t.value):t.value,c=$w(a);return We.lexer(c).flatMap(f=>zl(f,e.streaming))}),r=q(()=>t.value.length);return()=>{const a=l.value.slice();return i.value&&a.push(ze("button",{class:"md-expand",type:"button",onClick:()=>{s.value=!0}},`展开全文(共 ${r.value.toLocaleString()} 字符,当前仅预览前 ${Po.toLocaleString()})`)),ze("div",{class:"markdown-body"},a)}}});function Sw(e){const t=e.lastIndexOf(`
|
|
86
|
-
`,Po);return(t>Po/2?e.slice(0,t):e.slice(0,Po))+`
|
|
87
|
-
…`}function $w(e){const t=/^(`{3,})/gm;let n=null,s=-1,o=0,i;for(;(i=t.exec(e))!==null;){const l=i[1];n===null?(n=l,s=i.index,o=l.length):l.length>=o&&(n=null)}return n!==null?e.substring(0,s).trimEnd():e}function zl(e,t=!1){const n=e;switch(n.type){case"paragraph":return[ze("p",{class:"md-p"},mn(n.tokens??[]))];case"heading":return[ze(`h${n.depth??2}`,{class:`md-h${n.depth??2}`},mn(n.tokens??[]))];case"code":return[ze(Gl,{code:n.text??"",lang:n.lang??"text",streaming:t})];case"blockquote":return[ze("blockquote",{class:"md-blockquote"},(n.tokens??[]).flatMap(s=>zl(s,t)))];case"list":{const s=(n.items??[]).map(o=>{const i=[];return o.task&&i.push(ze("input",{type:"checkbox",checked:o.checked,disabled:!0,class:"md-checkbox"})),i.push(...o.tokens.flatMap(l=>zl(l,t))),ze("li",{class:["md-li",o.task?"md-task":""]},i)});return[ze(n.ordered?"ol":"ul",{class:n.ordered?"md-ol":"md-ul"},s)]}case"hr":return[ze("hr",{class:"md-hr"})];case"space":return[];case"html":return[ze("pre",{class:"md-raw-html"},n.text??"")];case"table":return[ze("div",{class:"md-table-wrap",style:"overflow-x:auto"},[xw(n)])];case"br":return[ze("br")];case"text":return[ze("span",{class:"md-text"},n.tokens?mn(n.tokens):n.text??"")];case"def":return[];default:return[ze("p",{class:"md-p"},n.raw??"")]}}function xw(e){const t=(e.header??[]).map((s,o)=>{var r;const i=(r=e.align)==null?void 0:r[o],l=s;return ze("th",{class:"md-th",style:i?`text-align:${i}`:""},l.tokens?mn(l.tokens):String(l.text??""))}),n=(e.rows??[]).map(s=>ze("tr",{},s.map((o,i)=>{var a;const l=(a=e.align)==null?void 0:a[i],r=o;return ze("td",{class:"md-td",style:l?`text-align:${l}`:""},r.tokens?mn(r.tokens):String(r.text??""))})));return ze("table",{class:"md-table"},[ze("thead",{},[ze("tr",{},t)]),ze("tbody",{},n)])}function mn(e){return e.map(t=>{const n=t;switch(n.type){case"text":return n.text??"";case"codespan":return ze("code",{class:"md-code"},n.text??"");case"strong":return ze("strong",{class:"md-strong"},mn(n.tokens??[]));case"em":return ze("em",{class:"md-em"},mn(n.tokens??[]));case"del":return ze("del",{class:"md-del"},mn(n.tokens??[]));case"link":{const s=n.href;return s&&!/^(https?:|mailto:|#|\/)/i.test(s)?n.raw??"":ze("a",{class:"md-a",href:s,target:"_blank",rel:"noopener"},mn(n.tokens??[]))}case"image":{const s=n.href??"";return ze("button",{type:"button",class:"md-img-btn",title:"点击图片放大预览","aria-label":n.text?`放大预览图片:${n.text}`:"放大预览图片",onClick:()=>ef(s,n.text??"")},[ze("img",{class:"md-img",src:s,alt:n.text??"",loading:"lazy"})])}case"br":return ze("br");case"html":return ze("code",{class:"md-raw-inline"},n.text??"");case"escape":return n.text??"";default:return n.raw??""}})}const tf=Ie(_w,[["__scopeId","data-v-71ba5071"]]);function nf(e,t,n){const s=F("");let o;function i(){o!==void 0&&(clearInterval(o),o=void 0)}return Me(()=>[e.value.durationMs,t.value],()=>{i();const l=e.value.durationMs;if(l!==void 0){s.value=Vi(l);return}if(s.value="",t.value!=="running"||!n())return;const r=sm(e.value.toolCallId);r!==void 0&&(s.value=Vi(Date.now()-r),o=setInterval(()=>{s.value=Vi(Date.now()-r)},1e3))},{immediate:!0}),Ct(i),s}const Cw=["onKeydown"],Tw={class:"tool-name"},Iw=["title"],Rw=["title"],Aw={class:"tool-collapse-inner"},Ew={class:"tool-body"},Mw={key:0,class:"tool-args"},Pw={key:1,class:"tool-result"},Lw={key:2,class:"tool-image-wrap"},Ow=["src"],Dw={key:3,class:"tool-output-actions"},Nw={key:4,class:"tool-running-hint"},Bw=Te({__name:"GenericToolCard",props:{tool:{},live:{type:Boolean,default:!0},workDir:{default:""},sessionId:{default:""}},setup(e){const t=e,n=q(()=>xi(t.tool,t.live)),s=q(()=>{switch(n.value){case"ok":return"✓";case"error":return"✗";default:return""}}),o=F(!1);let i=!1;Me(n,j=>{i||(o.value=j==="running")},{immediate:!0});function l(){i=!0,o.value=!o.value}const r=new Set(["path","file_path","filePath","file","filename"]),a=q(()=>{const j=t.tool.args;if(!j||typeof j!="object")return null;for(const[C,x]of Object.entries(j))if(r.has(C)&&typeof x=="string"&&x.length>0&&!x.includes(`
|
|
88
|
-
`))return x;return null});function c(){const j=a.value;j&&Zn(ur(j,t.workDir||void 0),{sessionId:t.sessionId||null})}const u=q(()=>{const j=t.tool.args;if(!j||typeof j!="object")return j===void 0?"":String(j);const C=[];for(const[x,y]of Object.entries(j)){if(a.value!==null&&r.has(x)&&y===a.value)continue;let T;if(typeof y=="string")T=y.length>40?`${y.slice(0,40)}…`:y;else{try{T=JSON.stringify(y)}catch{T=String(y)}T.length>40&&(T=`${T.slice(0,40)}…`)}if(C.push(`${x}=${T}`),C.length>=3)break}return C.join(" ")});function f(){if(!t.tool.args)return"";try{return JSON.stringify(t.tool.args,null,2)}catch{return String(t.tool.args)}}function h(j){return j??""}const p=q(()=>h(t.tool.output)),v=q(()=>p.value.length>8192),k=F(!1),w=q(()=>{const j=p.value;return v.value&&!k.value?`…${j.slice(-400)}`:j}),S=q(()=>{var x;const j=t.tool.progress;if(!j)return"";const C=j.split(`
|
|
89
|
-
`).filter(y=>y.trim());return((x=C[C.length-1])==null?void 0:x.slice(0,60))??""}),$=nf(q(()=>t.tool),n,()=>t.live);async function M(){var j;try{await((j=navigator.clipboard)==null?void 0:j.writeText(p.value))}catch{}}const P=q(()=>{const j=p.value.trim();return!/^[\w@./-]+\.(png|jpe?g|gif|webp|avif)$/i.test(j)||j.includes("..")||j.startsWith("/")||v.value?null:`/api/v1/files/raw?path=${encodeURIComponent(j)}`});function Z(){const j=P.value;j&&ef(j)}return(j,C)=>(g(),m("div",{class:fe(["tool-card",`is-${n.value}`])},[d("div",{class:"tool-header",role:"button",tabindex:"0",onClick:l,onKeydown:Vn(rt(l,["prevent"]),["enter"])},[d("span",{class:fe(["status-dot",n.value])},[s.value?(g(),m(ee,{key:0},[Ce(R(s.value),1)],64)):U("",!0)],2),d("span",Tw,R(e.tool.name),1),a.value?(g(),m("button",{key:0,class:"tool-pathlink",title:`在文件面板中打开 ${a.value}`,onClick:rt(c,["stop"])},R(a.value),9,Iw)):U("",!0),u.value?(g(),m("span",{key:1,class:"tool-params",title:u.value},R(u.value),9,Rw)):U("",!0),W($)?(g(),m("span",{key:2,class:fe(["tool-duration",{live:e.tool.durationMs===void 0}])},R(W($)),3)):U("",!0),d("span",{class:fe(["tool-chevron",{open:o.value}])},"▸",2)],40,Cw),d("div",{class:fe(["tool-collapse",{open:o.value}])},[d("div",Aw,[d("div",Ew,[f()?(g(),m("pre",Mw,[d("code",null,R(f()),1)])):U("",!0),e.tool.output!==void 0&&!P.value?(g(),m("pre",Pw,[d("code",null,R(w.value||"(无输出)"),1)])):U("",!0),e.tool.output!==void 0&&P.value?(g(),m("div",Lw,[d("button",{type:"button",class:"tool-image-btn",title:"点击图片放大预览","aria-label":"放大预览图片",onClick:Z},[d("img",{class:"tool-image",src:P.value,alt:"",loading:"lazy",onError:C[0]||(C[0]=x=>x.currentTarget.style.display="none")},null,40,Ow)])])):U("",!0),v.value?(g(),m("div",Dw,[d("button",{class:"tool-output-btn",onClick:C[1]||(C[1]=x=>k.value=!k.value)},R(k.value?"收起":"展开全文"),1),d("button",{class:"tool-output-btn",onClick:M},"复制")])):n.value==="running"?(g(),m("div",Nw,R(S.value||"执行中…"),1)):U("",!0)])])],2)],2))}}),Fw=Ie(Bw,[["__scopeId","data-v-9bfab7a6"]]),jw=500;function Uw(e,t){const n=e.length,s=t.length,o=Array.from({length:n+1},()=>new Array(s+1).fill(0));for(let i=1;i<=n;i++)for(let l=1;l<=s;l++)o[i][l]=e[i-1]===t[l-1]?o[i-1][l-1]+1:Math.max(o[i-1][l],o[i][l-1]);return o}function Gw(e,t,n,s,o){const i=[];for(;s>0||o>0;)s>0&&o>0&&t[s-1]===n[o-1]?(i.unshift({type:"context",text:t[s-1],oldNo:s,newNo:o}),s--,o--):o>0&&(s===0||e[s][o-1]>=e[s-1][o])?(i.unshift({type:"add",text:n[o-1],newNo:o}),o--):(i.unshift({type:"del",text:t[s-1],oldNo:s}),s--);return i}function sf(e){const t=[],n=e.replaceAll(`\r
|
|
90
|
-
`,`
|
|
91
|
-
`).split(`
|
|
92
|
-
`);let s=0,o=0;for(const i of n){if(i.startsWith("@@")){const l=/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(i);s=l?Number(l[1]):0,o=l?Number(l[2]):0;const r=i.startsWith("@@")?i.slice(i.indexOf("@@")+2,i.lastIndexOf("@@")||i.length):"";t.push({type:"context",text:r.trim()?`@@ hunk ${s},${o} @@`:i,oldNo:s,newNo:o});continue}if(i.startsWith("+++")||i.startsWith("---")){t.push({type:"context",text:i,oldNo:s,newNo:o});continue}i.startsWith("+")?(o+=1,t.push({type:"add",text:i.slice(1),newNo:o})):i.startsWith("-")?(s+=1,t.push({type:"del",text:i.slice(1),oldNo:s})):(s+=1,o+=1,t.push({type:"context",text:i,oldNo:s,newNo:o}))}return t}function zw(e,t){const n=e.split(`
|
|
93
|
-
`),s=t.split(`
|
|
94
|
-
`);if(n.length+s.length>jw){const i=[];return n.forEach((l,r)=>i.push({type:"del",text:l,oldNo:r+1})),s.forEach((l,r)=>i.push({type:"add",text:l,newNo:r+1})),i}const o=Uw(n,s);return Gw(o,n,s,n.length,s.length)}function Hw(e){let t=0,n=0;for(const s of e)s.type==="add"?t++:s.type==="del"&&n++;return{added:t,removed:n}}const Ww=["old_string","oldString","old_str","old_text","oldText","old","search"],qw=["new_string","newString","new_str","new_text","newText","new","replace","content"],Vw=["path","file_path","filePath","file","filename"];function il(e,t){for(const n of t){const s=e[n];if(typeof s=="string"&&s.length>0)return s}}function Kw(e){if(!e||typeof e!="object")return null;const t=e,n=il(t,Vw),s=il(t,Ww),o=il(t,qw);if(!o&&!s)return null;const i=zw(s??"",o??""),l=Hw(i);return{path:n,diff:i,stats:l}}const Yw={class:"diff-lines"},Zw={class:"dl-gutter old"},Jw={class:"dl-gutter new"},Xw={class:"dl-sign"},Qw={class:"dl-text"},e_=Te({__name:"DiffLines",props:{lines:{}},setup(e){return(t,n)=>(g(),m("div",Yw,[(g(!0),m(ee,null,Ee(e.lines,(s,o)=>(g(),m("div",{key:o,class:fe(["dl",`dl-${s.type}`])},[d("span",Zw,R(s.oldNo??""),1),d("span",Jw,R(s.newNo??""),1),d("span",Xw,R(s.type==="add"?"+":s.type==="del"?"−":" "),1),d("span",Qw,R(s.text),1)],2))),128))]))}}),Er=Ie(e_,[["__scopeId","data-v-e2e145aa"]]),t_=["onKeydown"],n_={class:"tool-name"},s_=["title"],o_={key:1,class:"diff-chip"},i_={class:"tool-collapse-inner"},l_={class:"tool-body"},r_={key:1,class:"tool-result"},a_={key:2,class:"tool-running-hint"},c_=Te({__name:"EditToolCard",props:{tool:{},live:{type:Boolean,default:!0},workDir:{default:""},sessionId:{default:""}},setup(e){const t=e,n=q(()=>xi(t.tool,t.live)),s=q(()=>{switch(n.value){case"ok":return"✓";case"error":return"✗";default:return""}}),o=q(()=>Kw(t.tool.args)),i=q(()=>{const k=o.value;if(!k||n.value==="error")return"";const{added:w,removed:S}=k.stats;return!w&&!S?"":`+${w} −${S}`}),l=q(()=>{var k;return(k=o.value)==null?void 0:k.path}),r=F(!1);let a=!1;Me(n,k=>{a||(r.value=k==="running")},{immediate:!0});function c(){a=!0,r.value=!r.value}const u=q(()=>{var k;return((k=o.value)==null?void 0:k.diff)??[]}),f=q(()=>u.value.length>0),h=nf(q(()=>t.tool),n,()=>t.live);function p(){const k=l.value;k&&Zn(ur(k,t.workDir||void 0),{modeHint:"diff",sessionId:t.sessionId||null})}const v=q(()=>{var S;const k=t.tool.progress;if(!k)return"";const w=k.split(`
|
|
95
|
-
`).filter($=>$.trim());return((S=w[w.length-1])==null?void 0:S.slice(0,60))??""});return(k,w)=>(g(),m("div",{class:fe(["tool-card",`is-${n.value}`,"edit-tool-card"])},[d("div",{class:"tool-header",role:"button",tabindex:"0",onClick:c,onKeydown:Vn(rt(c,["prevent"]),["enter"])},[d("span",{class:fe(["status-dot",n.value])},[s.value?(g(),m(ee,{key:0},[Ce(R(s.value),1)],64)):U("",!0)],2),d("span",n_,R(e.tool.name),1),l.value?(g(),m("button",{key:0,class:"tool-filepath",title:`在文件面板中打开(diff) ${l.value}`,onClick:rt(p,["stop"])},R(l.value),9,s_)):U("",!0),i.value?(g(),m("span",o_,R(i.value),1)):U("",!0),W(h)?(g(),m("span",{key:2,class:fe(["tool-duration",{live:e.tool.durationMs===void 0}])},R(W(h)),3)):U("",!0),d("span",{class:fe(["tool-chevron",{open:r.value}])},"▸",2)],40,t_),d("div",{class:fe(["tool-collapse",{open:r.value}])},[d("div",i_,[d("div",l_,[f.value?(g(),Xe(Er,{key:0,lines:u.value},null,8,["lines"])):U("",!0),e.tool.output!==void 0?(g(),m("pre",r_,[d("code",null,R(e.tool.output||"(无输出)"),1)])):(g(),m("div",a_,R(v.value||"执行中…"),1))])])],2)],2))}}),u_=Ie(c_,[["__scopeId","data-v-eff4962d"]]),d_=["aria-expanded"],f_={class:"process-label"},h_={class:"process-meta"},p_=["title"],g_={class:"process-collapse"},m_={class:"process-inner"},v_=Te({__name:"ToolGroup",props:{name:{},tools:{},live:{type:Boolean,default:!0},workDir:{default:""},sessionId:{default:""}},setup(e){const t=e,n=F(!1),s=q(()=>_b(t.tools,t.live)),o=q(()=>t.tools.filter(r=>r.output!==void 0&&!r.isError).length),i=q(()=>s.value==="running"?"执行中":s.value==="error"?"含失败调用":s.value==="suspended"?"含挂起等待":s.value==="unknown"?"结果未持久化":`已完成 ${o.value} 项`);function l(){n.value=!n.value}return(r,a)=>(g(),m("section",{class:fe(["tool-process",{open:n.value,running:s.value==="running",error:s.value==="error"}])},[d("button",{class:"process-head",type:"button","aria-expanded":n.value,onClick:l},[J(me,{name:"chevron-down",size:12,class:"chevron"}),d("span",{class:fe(["process-dot",s.value]),"aria-hidden":"true"},null,2),d("span",f_,R(e.name),1),d("span",h_,R(i.value)+" · "+R(e.tools.length)+" 步",1),d("span",{class:"process-names",title:e.tools.map(c=>c.name).join("、")},R(e.tools.map(c=>c.name).join(" · ")),9,p_)],8,d_),d("div",g_,[d("div",m_,[(g(!0),m(ee,null,Ee(t.tools,c=>(g(),Xe(_p(W(id)(c.name)?u_:Fw),{key:c.toolCallId,tool:c,live:e.live,"work-dir":e.workDir,"session-id":e.sessionId},null,8,["tool","live","work-dir","session-id"]))),128))])])],2))}}),y_=Ie(v_,[["__scopeId","data-v-ca5b0e07"]]),b_={class:"thinking-block"},k_=["title"],w_={class:"teaser-text"},__={class:"teaser-open"},S_={key:1,class:"thinking-stream"},$_={class:"thinking-panel",role:"dialog","aria-label":"思考过程"},x_={class:"panel-body"},C_=Te({__name:"ThinkingBlock",props:{tool:{},active:{type:Boolean,default:!1},sessionId:{default:""},msgSeq:{default:void 0}},setup(e){const t=e,n=F(!1),s=F(null),o=F(!1),i=F(!1),l=F(t.tool.output??"");Me(()=>t.tool.output,h=>{h!==void 0&&!o.value&&!i.value&&(l.value=h)});const r=q(()=>!!t.tool.truncated);async function a(){if(!(!r.value||i.value||o.value)&&!(!t.sessionId||t.msgSeq===void 0)){o.value=!0;try{const p=await(await fetch(`/api/v1/sessions/${t.sessionId}/messages?seq=${t.msgSeq}&tool=${encodeURIComponent(t.tool.toolCallId)}`)).json();typeof p.output=="string"&&p.output.length>0&&(l.value=p.output,i.value=!0)}catch{}finally{o.value=!1}}}const c=q(()=>l.value.split(/\n+/).map(p=>p.trim()).filter(Boolean).at(-1)??"");Me(l,()=>{t.active&&ft(()=>{const h=s.value;h&&(h.scrollTop=h.scrollHeight)})});function u(){a(),n.value=!0}function f(){n.value=!1}return(h,p)=>(g(),m("div",b_,[e.active?(g(),m("div",S_,[p[1]||(p[1]=d("div",{class:"stream-header"},[d("span",{class:"stream-icon"},"💭"),d("span",{class:"stream-title"},"思考中…"),d("span",{class:"stream-dot"})],-1)),d("div",{ref_key:"streamRef",ref:s,class:"stream-body"},R(l.value),513)])):(g(),m("button",{key:0,class:"thinking-teaser",title:r.value?"思考较长,点击查看完整思考过程":"点击查看完整思考过程",onClick:u},[p[0]||(p[0]=d("span",{class:"teaser-icon"},"💭",-1)),d("span",w_,R(o.value?"加载完整思考…":c.value||"思考过程"),1),d("span",__,R(r.value?"查看全文":"展开"),1)],8,k_)),(g(),Xe(tr,{to:"body"},[n.value?(g(),m("div",{key:0,class:"thinking-overlay",onClick:rt(f,["self"])},[d("aside",$_,[d("header",{class:"panel-header"},[p[2]||(p[2]=d("span",null,"💭 思考过程",-1)),d("button",{class:"panel-close","aria-label":"关闭",onClick:f},"✕")]),d("div",x_,R(l.value||"(空)"),1)])])):U("",!0)]))]))}}),T_=Ie(C_,[["__scopeId","data-v-436ab760"]]),I_={key:0,class:"clock"},R_={class:"stat"},A_={class:"stat"},E_={class:"stat"},M_={class:"stat"},P_={class:"stat"},L_={class:"stat"},O_=Te({__name:"TurnStats",props:{stats:{}},setup(e){const t=e,n=F(null);let s=null;function o(){s!==null&&(clearInterval(s),s=null)}function i(){o();const a=t.stats.llmMs??0,c=Date.now();n.value=a,s=setInterval(()=>{n.value=a+(Date.now()-c)},300)}Me(()=>t.stats.status,a=>{a==="running"?i():o()},{immediate:!0}),Ct(o);function l(a){return a==null?"—":a<1e3?`${Math.round(a)}ms`:`${(a/1e3).toFixed(1)}s`}function r(a){return a==null?"—":a>=1e3?`${(a/1e3).toFixed(1)}k`:`${a}`}return(a,c)=>(g(),m("div",{class:fe(["turn-stats",`is-${e.stats.status}`]),"aria-live":"polite"},[e.stats.status==="running"?(g(),m(ee,{key:0},[c[0]||(c[0]=d("span",{class:"badge-gradient"},"正在思考",-1)),n.value!==null?(g(),m("span",I_,R(l(n.value)),1)):U("",!0)],64)):(g(),m(ee,{key:1},[d("span",R_,R(e.stats.turn)+" 轮 · "+R(e.stats.step)+" 步",1),c[10]||(c[10]=d("span",{class:"dot"},"·",-1)),d("span",A_,[c[1]||(c[1]=d("span",{class:"k"},"LLM",-1)),Ce(" "+R(l(e.stats.llmMs)),1)]),e.stats.toolMs?(g(),m(ee,{key:0},[c[3]||(c[3]=d("span",{class:"dot"},"·",-1)),d("span",E_,[c[2]||(c[2]=d("span",{class:"k"},"工具",-1)),Ce(" "+R(l(e.stats.toolMs)),1)])],64)):U("",!0),e.stats.firstTokenMs!==null&&e.stats.firstTokenMs!==void 0?(g(),m(ee,{key:1},[c[5]||(c[5]=d("span",{class:"dot"},"·",-1)),d("span",M_,[c[4]||(c[4]=d("span",{class:"k"},"首token",-1)),Ce(" "+R(l(e.stats.firstTokenMs)),1)])],64)):U("",!0),e.stats.tokens!==null&&e.stats.tokens!==void 0?(g(),m(ee,{key:2},[c[7]||(c[7]=d("span",{class:"dot"},"·",-1)),d("span",P_,[c[6]||(c[6]=d("span",{class:"k"},"tokens",-1)),Ce(" "+R(r(e.stats.tokens)),1)])],64)):U("",!0),e.stats.tokensPerSec!==null&&e.stats.tokensPerSec!==void 0?(g(),m(ee,{key:3},[c[9]||(c[9]=d("span",{class:"dot"},"·",-1)),d("span",L_,[c[8]||(c[8]=d("span",{class:"k"},"tok/s",-1)),Ce(" "+R(e.stats.tokensPerSec),1)])],64)):U("",!0)],64))],2))}}),D_=Ie(O_,[["__scopeId","data-v-95536a3e"]]),N_=["data-message-id","data-message-role"],B_={key:0,class:"user-wrap"},F_={class:"user-head"},j_={key:0,class:"meta-time"},U_={class:"user-avatar","aria-hidden":"true"},G_={class:"user-bubble"},z_=["title","onClick"],H_={key:0,class:"message-meta user-meta"},W_={key:1,class:"assistant-wrap"},q_={key:0,class:"assistant-brand"},V_={key:0,class:"brand-model"},K_={key:1,class:"brand-streaming"},Y_={key:2,class:"brand-time"},Z_={class:"assistant-body"},J_={key:0,class:"degraded-note"},X_={key:4,class:"streaming-cursor","aria-label":"正在生成"},Q_={key:6,class:"written-files",role:"group","aria-label":"本回合写入的文件"},eS=["title","onClick"],tS={class:"written-file-name"},nS={key:7,class:"message-meta"},sS=["title"],oS=["title"],iS=Te({__name:"MessageItem",props:{message:{},isLatestUser:{type:Boolean,default:!1},idle:{type:Boolean,default:!0},streaming:{type:Boolean,default:!1},canFork:{type:Boolean,default:!1},showTimestamp:{type:Boolean,default:!0},sessionId:{default:""},workDir:{default:""}},emits:["edit","retry","fork"],setup(e,{emit:t}){const n=e,s=t,o=F(!1);let i=null;const l=q(()=>n.message.role==="user"),r=q(()=>n.message.role==="assistant"),a=q(()=>n.message.tools.filter(y=>y.name==="thinking")),c=q(()=>n.message.tools.filter(y=>y.name!=="thinking")),u=q(()=>n.message.ts!==void 0?yb(n.message.ts):""),f=q(()=>l.value&&n.isLatestUser&&n.idle),h=q(()=>r.value&&!n.streaming?$b(n.message,n.workDir||void 0):[]);function p(y){return y.split("/").pop()||y}function v(y){Zn(y,{sessionId:n.sessionId||void 0})}const k=/(^|\s)@("[^"\n]+"|[^\s"]+)/g;function w(y){if(!y||y.startsWith("/")||y.startsWith("~"))return y;const T=n.workDir.trim();if(!T)return y;let O=y;for(;O.startsWith("./");)O=O.slice(2);return`${T.replace(/\/+$/,"")}/${O}`}const S=q(()=>{const y=n.message.content;if(!l.value||!y||!y.includes("@"))return[];const T=[];let O=0;k.lastIndex=0;let I;for(;(I=k.exec(y))!==null;){const H=I.index+I[1].length;H>O&&T.push({text:y.slice(O,H),path:null});const L=I[2],B=L.startsWith('"')?L.slice(1,-1):L;T.push({text:y.slice(H,H+1+L.length),path:w(B)}),O=H+1+L.length}return O<y.length&&T.push({text:y.slice(O),path:null}),T});function $(y){Zn(y,{sessionId:n.sessionId||void 0})}const M=vn("showThinking",F(!0)),P=vn("showTools",F(!0)),Z=F(!1);let j=null;function C(){if(typeof window>"u"||!("speechSynthesis"in window))return;if(Z.value){window.speechSynthesis.cancel(),Z.value=!1,j=null;return}const y=n.message.content;if(!y)return;const T=new SpeechSynthesisUtterance(y);T.lang="zh-CN";const O=()=>{j===O&&(Z.value=!1,j=null)};j=O,T.addEventListener("end",O),T.addEventListener("error",O),window.speechSynthesis.cancel(),requestAnimationFrame(()=>{window.speechSynthesis.speak(T)}),Z.value=!0}Ct(()=>{Z.value&&"speechSynthesis"in window&&window.speechSynthesis.cancel()});async function x(){try{await navigator.clipboard.writeText(n.message.content)}catch{const y=document.createElement("textarea");y.value=n.message.content,document.body.append(y),y.select(),document.execCommand("copy"),y.remove()}o.value=!0,i!==null&&clearTimeout(i),i=window.setTimeout(()=>{o.value=!1},1500)}return(y,T)=>(g(),m("article",{class:fe(["message",e.message.role,{error:e.message.isError}]),"data-message-id":e.message.id,"data-message-role":e.message.role},[l.value?(g(),m("div",B_,[d("div",F_,[u.value?(g(),m("span",j_,R(u.value),1)):U("",!0),T[3]||(T[3]=d("span",{class:"head-name"},"你",-1)),d("span",U_,[J(me,{name:"user",size:12})])]),d("div",G_,[S.value.length?(g(!0),m(ee,{key:0},Ee(S.value,(O,I)=>(g(),m(ee,{key:I},[O.path!==null?(g(),m("button",{key:0,class:"at-link",title:`在文件面板中打开 ${O.path}`,onClick:H=>$(O.path??"")},R(O.text),9,z_)):(g(),m(ee,{key:1},[Ce(R(O.text),1)],64))],64))),128)):(g(),m(ee,{key:1},[Ce(R(e.message.content),1)],64))]),f.value?(g(),m("div",H_,[d("button",{title:"编辑并重新发送",onClick:T[0]||(T[0]=O=>s("edit",e.message.content))},[J(me,{name:"edit",size:12}),T[4]||(T[4]=Ce("编辑重发",-1))])])):U("",!0)])):(g(),m("div",W_,[r.value&&(e.message.model||e.streaming||e.showTimestamp&&u.value)?(g(),m("div",q_,[e.message.model?(g(),m("span",V_,R(e.message.model),1)):U("",!0),e.streaming?(g(),m("span",K_,[...T[5]||(T[5]=[d("i",{"aria-hidden":"true"},null,-1),Ce("生成中",-1)])])):U("",!0),e.showTimestamp&&u.value?(g(),m("time",Y_,R(u.value),1)):U("",!0)])):U("",!0),d("div",Z_,[e.message.degraded?(g(),m("p",J_,"该回合早于持久化快照:正文与思考在服务重启后无法恢复(工具记录与消息结构已保留)。")):U("",!0),W(M)?(g(!0),m(ee,{key:1},Ee(a.value,O=>(g(),Xe(T_,{key:O.toolCallId,tool:O,active:e.streaming,"session-id":e.sessionId,"msg-seq":e.message.seq},null,8,["tool","active","session-id","msg-seq"]))),128)):U("",!0),c.value.length&&W(P)?(g(),Xe(y_,{key:2,name:"工具调用过程",tools:c.value,live:e.streaming,"work-dir":e.workDir,"session-id":e.sessionId},null,8,["tools","live","work-dir","session-id"])):U("",!0),e.message.content?(g(),Xe(tf,{key:3,class:"assistant-content",content:e.message.content,streaming:e.streaming},null,8,["content","streaming"])):e.streaming?(g(),m("span",X_)):U("",!0),e.message.turnStats?(g(),Xe(D_,{key:5,stats:e.message.turnStats},null,8,["stats"])):U("",!0),h.value.length?(g(),m("div",Q_,[(g(!0),m(ee,null,Ee(h.value,O=>(g(),m("button",{key:O.filePath,type:"button",class:"written-file",title:`在文件面板中打开 ${O.filePath}`,onClick:I=>v(O.filePath)},[J(me,{name:"file",size:12}),d("span",tS,R(p(O.filePath)),1)],8,eS))),128))])):U("",!0),e.message.content||e.message.isError&&!e.streaming||e.canFork?(g(),m("div",nS,[e.message.content?(g(),m("button",{key:0,title:o.value?"已复制":"复制内容",onClick:x},[J(me,{name:o.value?"check":"copy",size:12},null,8,["name"]),Ce(R(o.value?"已复制":"复制"),1)],8,sS)):U("",!0),e.message.content?(g(),m("button",{key:1,title:Z.value?"停止朗读":"朗读",onClick:C},[J(me,{name:Z.value?"speaker-off":"speaker",size:12},null,8,["name"]),Ce(R(Z.value?"停止":"朗读"),1)],8,oS)):U("",!0),e.message.isError&&!e.streaming?(g(),m("button",{key:2,class:"retry-btn",title:"重发最后一条消息",onClick:T[1]||(T[1]=O=>s("retry"))},[J(me,{name:"refresh",size:12}),T[6]||(T[6]=Ce("重试",-1))])):U("",!0),r.value&&e.canFork&&!e.streaming?(g(),m("button",{key:3,title:"以当前对话为起点创建一个新会话",onClick:T[2]||(T[2]=O=>s("fork"))},[J(me,{name:"fork",size:12}),T[7]||(T[7]=Ce("Fork",-1))])):U("",!0)])):U("",!0)])]))],10,N_))}}),lS=Ie(iS,[["__scopeId","data-v-b04b0b4d"]]),rS=""+new URL("../icon.ico",import.meta.url).href,aS={class:"empty-state"},cS={class:"suggestions"},uS=["onClick"],dS={class:"suggestion-icon"},fS={class:"suggestion-title"},hS={key:0,class:"recent","aria-label":"最近输入"},pS={class:"recent-chips"},gS=["title","onClick"],mS=["title"],vS={class:"workdir-path"},yS={class:"empty-status","aria-label":"连接与模型状态"},bS={class:"status-item"},kS={class:"status-item"},wS={class:"status-item"},_S="scream-recent-prompts",SS=Te({__name:"EmptyState",props:{workDir:{default:null},model:{default:null},contextUsage:{default:null},connected:{type:Boolean,default:!1}},emits:["pick"],setup(e,{emit:t}){const n=t,s=[{icon:"edit",title:"帮我写一个函数",prompt:"帮我写一个函数"},{icon:"clipboard",title:"解释这段代码",prompt:"解释这段代码"},{icon:"activity",title:"调试这个问题",prompt:"调试这个问题"}],o=F([]);ct(()=>{try{const l=localStorage.getItem(_S);if(l){const r=JSON.parse(l);Array.isArray(r)&&(o.value=r.filter(a=>typeof a=="string").slice(0,4))}}catch{o.value=[]}});function i(l){if(l==null)return"—";const r=l<=1?Math.round(l*100):Math.round(l);return`${Math.min(r,100)}%`}return(l,r)=>(g(),m("div",aS,[r[4]||(r[4]=d("div",{class:"empty-logo"},[d("img",{src:rS,alt:"Scream",class:"logo-img"})],-1)),r[5]||(r[5]=d("h1",{class:"empty-title"},"Scream Web UI",-1)),r[6]||(r[6]=d("p",{class:"empty-subtitle"},"给 Scream 发消息,开始处理你的任务",-1)),d("div",cS,[(g(),m(ee,null,Ee(s,a=>d("button",{key:a.title,class:"suggestion-card",onClick:c=>n("pick",a.prompt)},[d("span",dS,[J(me,{name:a.icon,size:22},null,8,["name"])]),d("span",fS,R(a.title),1)],8,uS)),64))]),o.value.length>0?(g(),m("div",hS,[r[0]||(r[0]=d("span",{class:"recent-label"},"最近",-1)),d("div",pS,[(g(!0),m(ee,null,Ee(o.value,(a,c)=>(g(),m("button",{key:`${c}-${a}`,class:"recent-chip",title:a,onClick:u=>n("pick",a)},R(a),9,gS))),128))])])):U("",!0),e.workDir?(g(),m("div",{key:1,class:"empty-workdir",title:e.workDir},[r[1]||(r[1]=d("span",{class:"workdir-label"},"工作目录",-1)),d("span",vS,R(e.workDir),1)],8,mS)):U("",!0),d("div",yS,[d("span",{class:fe(["status-dot",e.connected?"on":"off"])},null,2),d("span",bS,R(e.connected?"已连接":"未连接"),1),e.model?(g(),m(ee,{key:0},[r[2]||(r[2]=d("span",{class:"status-sep"},"·",-1)),d("span",kS,"模型 "+R(e.model),1)],64)):U("",!0),e.contextUsage!==null&&e.contextUsage!==void 0?(g(),m(ee,{key:1},[r[3]||(r[3]=d("span",{class:"status-sep"},"·",-1)),d("span",wS,"上下文 "+R(i(e.contextUsage)),1)],64)):U("",!0)]),r[7]||(r[7]=d("div",{class:"empty-shortcuts","aria-hidden":"true"},[d("span",null,[d("kbd",null,"⌘K"),Ce(" 搜索会话")]),d("span",null,[d("kbd",null,"⌘N"),Ce(" 新建会话")])],-1))]))}}),$S=Ie(SS,[["__scopeId","data-v-71ca3ccd"]]),xS={key:0,class:"minimap",role:"navigation","aria-label":"消息地图"},CS={class:"minimap-track"},TS=["title","aria-label","onMouseenter","onClick"],IS={key:0,class:"minimap-tooltip"},RS="(min-width: 960px)",AS=Te({__name:"ChatMinimap",props:{messages:{},host:{}},setup(e){const t=e,n=F(null),o=typeof window.matchMedia=="function"?window.matchMedia(RS):null,i=F((o==null?void 0:o.matches)??!1);function l(w){i.value=w.matches}ct(()=>o==null?void 0:o.addEventListener("change",l)),Ct(()=>o==null?void 0:o.removeEventListener("change",l));function r(w){var $;const S=(($=w.content)==null?void 0:$.length)??0;return S<=0?.2:.2+.8*(1-1/(1+S/200))}const a=q(()=>{let w=0;return t.messages.map((S,$)=>{const M=r(S),P={id:S.id??`seq-${$}`,seq:S.seq??$,role:S.role??"tool",ratio:M,offset:w};return w+=M,P})}),c=q(()=>a.value.reduce((w,S)=>w+S.ratio,0)||1),u=F(new Set);let f=null;const h=typeof window<"u"&&typeof IntersectionObserver=="function";function p(){f==null||f.disconnect();const w=t.host;if(!(!w||!i.value||!h)){f=new IntersectionObserver(S=>{const $=new Set(u.value);for(const M of S){const P=M.target.dataset.messageId;P&&(M.isIntersecting?$.add(P):$.delete(P))}u.value=$},{root:w,threshold:0});for(const S of t.messages){if(!S.id)continue;const $=w.querySelector(`[data-message-id="${CSS.escape(S.id)}"]`);$&&f.observe($)}}}Me([()=>t.messages.length,()=>t.host,i],()=>{ft(p)}),ct(()=>p()),Ct(()=>f==null?void 0:f.disconnect());function v(w){const S=t.host;if(!S)return;const $=S.querySelector(`[data-message-id="${CSS.escape(w)}"]`);$&&$.scrollIntoView({behavior:"smooth",block:"start"})}function k(w){const S=w.role==="user"?"用户":w.role==="assistant"?"助手":"工具";return`#${w.seq} ${S}`}return(w,S)=>i.value&&a.value.length>0?(g(),m("div",xS,[d("div",CS,[(g(!0),m(ee,null,Ee(a.value,$=>(g(),m("button",{key:$.id,class:fe(["minimap-block",[`role-${$.role}`,{"in-view":u.value.has($.id)}]]),style:Nt({top:`${$.offset/c.value*100}%`,height:`${Math.max($.ratio/c.value*100,2)}%`}),title:k($),"aria-label":k($),onMouseenter:M=>n.value=$.seq,onMouseleave:S[0]||(S[0]=M=>n.value=null),onClick:M=>v($.id)},[n.value===$.seq?(g(),m("span",IS,R(k($)),1)):U("",!0)],46,TS))),128))])])):U("",!0)}}),ES=Ie(AS,[["__scopeId","data-v-78b50335"]]),MS={class:"message-list-wrapper"},PS={key:0,class:"conn-banner",role:"status"},LS=["disabled"],OS={key:0,class:"day-divider",role:"separator"},DS={key:1,class:"turn-divider","aria-hidden":"true"},NS={key:2,class:"message-skeleton","aria-hidden":"true"},BS=["aria-label"],FS={key:0,class:"scroll-badge"},jS=Te({__name:"MessageList",props:{messages:{},busy:{type:Boolean,default:!1},workDir:{default:null},sessionId:{default:""},model:{default:null},contextUsage:{default:null},connected:{type:Boolean,default:!1},olderAvailable:{type:Boolean,default:!1},olderLoading:{type:Boolean,default:!1}},emits:["edit","pick","retry-connection","retry-message","load-older","fork"],setup(e,{emit:t}){const n=e,s=t,o=F(null),i=F(null);let l=null;const r=q(()=>{for(let I=n.messages.length-1;I>=0;I--)if(n.messages[I].role==="user")return n.messages[I].id;return null}),a=q(()=>{var I;return((I=n.messages.at(-1))==null?void 0:I.id)??null}),c=q(()=>{var I;return((I=[...n.messages].reverse().find(H=>H.role==="assistant"))==null?void 0:I.id)??null});function u(I){const H=n.messages[I];if(!H)return!1;if(H.role!=="assistant")return!0;const L=n.messages[I+1];return!L||L.role!=="assistant"||H.ts!==void 0&&L.ts!==void 0&&L.ts-H.ts>300*1e3}function f(I){const H=n.messages[I];return!!H&&I>0&&H.role==="user"}function h(I){const H=n.messages[I],L=I>0?n.messages[I-1]:void 0;return!H||!L||H.ts===void 0||L.ts===void 0||bb(L.ts,H.ts)?null:kb(H.ts)}const p=q(()=>{var L;const I=n.messages.at(-1);if(!I)return 0;let H=I.content.length;for(const B of I.tools)H+=((L=B.output)==null?void 0:L.length)??0;return H});let v=!1;const k=F(!1),w=F(0);function S(){const I=o.value;return I?I.scrollHeight-I.scrollTop-I.clientHeight<80:!0}function $(){return typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function M(I){requestAnimationFrame(()=>{const H=o.value;if(!H)return;const L=$()?"auto":I;H.scrollTo({top:H.scrollHeight,behavior:L})})}let P=null;function Z(){const I=o.value,H=n.sessionId;!I||!H||P===null&&(P=requestAnimationFrame(()=>{P=null;try{localStorage.setItem(`scream-scroll:${H}`,String(I.scrollTop))}catch{}}))}function j(){const I=o.value,H=n.sessionId;if(!I||!H)return;let L=null;try{L=localStorage.getItem(`scream-scroll:${H}`)}catch{}L&&(I.scrollTop=Number(L))}let C=!1;Me(()=>{var I;return[((I=n.messages[0])==null?void 0:I.id)??null,n.messages.length]},([I,H],[L,B])=>{const ne=H>0&&I!==null&&L!==null&&I!==L&&H>(B??0);if(C=ne,!ne)return;const ie=o.value;if(!ie)return;const _e=ie.scrollHeight;ft(()=>{const Se=ie.scrollHeight-_e;Se>0&&(ie.scrollTop+=Se)})});function x(){const I=o.value;if(!I)return;const H=I.scrollHeight-I.scrollTop-I.clientHeight>80;k.value=H,H||(w.value=0),H&&v&&(v=!1),n.busy||Z()}let y="";Me(()=>n.sessionId,()=>{y="",w.value=0,C=!1}),Me(()=>[n.messages.length,p.value],([I],[H])=>{if(I!==H){const L=C;if(C=!1,I>0&&y!==n.sessionId){y=n.sessionId,requestAnimationFrame(()=>requestAnimationFrame(j));return}if(L)return;if(!S()){w.value=Math.max(0,w.value+Math.max(0,I-(H??0)));return}v=!0,k.value=!1,M("smooth");return}!v&&!S()||M("auto")}),Me(()=>n.busy,I=>{I||(v=!1)});function T(){v=!0,k.value=!1,w.value=0,M("smooth")}const O=q(()=>!n.busy||n.messages.length===0?!1:n.messages.at(-1).role==="user");return ct(()=>{var I;(I=o.value)==null||I.addEventListener("scroll",x,{passive:!0}),typeof IntersectionObserver<"u"&&(l=new IntersectionObserver(H=>{var L;(L=H[0])!=null&&L.isIntersecting&&n.olderAvailable&&!n.olderLoading&&n.messages.length>0&&s("load-older")},{root:o.value,rootMargin:"120px 0px 0px 0px"}),i.value&&l.observe(i.value)),requestAnimationFrame(()=>requestAnimationFrame(j))}),vi(()=>{var I;(I=o.value)==null||I.removeEventListener("scroll",x),l==null||l.disconnect(),l=null,P!==null&&(cancelAnimationFrame(P),P=null)}),Me(i,I=>{l&&(l.disconnect(),I&&l.observe(I))}),(I,H)=>(g(),m("div",MS,[!e.connected&&e.messages.length>0?(g(),m("div",PS,[H[6]||(H[6]=d("span",{class:"conn-dot","aria-hidden":"true"},null,-1)),H[7]||(H[7]=d("span",null,"连接中断,自动恢复中…",-1)),d("button",{class:"conn-retry",onClick:H[0]||(H[0]=L=>s("retry-connection"))},"立即重试")])):U("",!0),d("div",{ref_key:"listRef",ref:o,class:"message-list"},[e.olderAvailable?(g(),m("div",{key:0,ref_key:"topSentinelRef",ref:i,class:"load-older-row"},[d("button",{class:"load-older-btn",disabled:e.olderLoading,onClick:H[1]||(H[1]=L=>s("load-older"))},R(e.olderLoading?"加载中…":"加载更早消息"),9,LS)],512)):U("",!0),e.messages.length===0?(g(),Xe($S,{key:1,"work-dir":e.workDir,model:e.model,"context-usage":e.contextUsage,connected:e.connected,onPick:H[2]||(H[2]=L=>s("pick",L))},null,8,["work-dir","model","context-usage","connected"])):U("",!0),(g(!0),m(ee,null,Ee(e.messages,(L,B)=>(g(),m(ee,{key:L.id},[h(B)?(g(),m("div",OS,[d("span",null,R(h(B)),1)])):f(B)?(g(),m("div",DS)):U("",!0),J(lS,{message:L,"is-latest-user":L.id===r.value,idle:!e.busy,streaming:e.busy&&L.id===a.value&&L.role==="assistant","session-id":e.sessionId,"can-fork":!e.busy&&L.id===c.value,"show-timestamp":u(B),"work-dir":e.workDir??void 0,onEdit:H[3]||(H[3]=ne=>s("edit",ne)),onRetry:H[4]||(H[4]=ne=>s("retry-message")),onFork:H[5]||(H[5]=ne=>s("fork"))},null,8,["message","is-latest-user","idle","streaming","session-id","can-fork","show-timestamp","work-dir"])],64))),128)),O.value?(g(),m("div",NS,[...H[8]||(H[8]=[d("div",{class:"sk-body"},[d("div",{class:"sk-line sk-w-60"}),d("div",{class:"sk-line sk-w-90"}),d("div",{class:"sk-line sk-w-40"})],-1)])])):U("",!0)],512),J(ES,{messages:e.messages,host:o.value},null,8,["messages","host"]),J(_i,{name:"scroll-btn"},{default:Pt(()=>[k.value?(g(),m("button",{key:0,class:fe(["scroll-to-bottom",{streaming:e.busy}]),title:"滚动到最新消息","aria-label":w.value>0?`滚动到最新消息,${w.value} 条新消息`:"滚动到最新消息",onClick:T},[J(me,{name:"chevron-down",size:18}),w.value>0?(g(),m("span",FS,R(w.value>99?"99+":w.value),1)):U("",!0)],10,BS)):U("",!0)]),_:1})]))}}),US=Ie(jS,[["__scopeId","data-v-2626b931"]]),GS={class:"files-pane"},zS={class:"files-path"},HS={class:"crumbs"},WS=["onClick"],qS={key:0,class:"crumb-sep"},VS={class:"crumb-name"},KS={key:0,class:"files-error"},YS={key:1,class:"files-loading"},ZS={class:"files-list"},JS=["onClick"],XS={class:"files-name"},QS={class:"files-meta"},e$={key:0,class:"files-empty"},pc="/api/v1/files",t$=Te({__name:"FilesBrowser",props:{initialPath:{default:""}},setup(e){const t=e,n=F(""),s=F([]),o=F(!1),i=F(""),l=q(()=>{if(!n.value)return[];const f=n.value.split("/"),h=[];for(let p=0;p<f.length;p++){if(f[p]==="")continue;let v=f[p];p>1&&v==="Users"&&f[p-1]===""&&(v=v),h.push({label:v.slice(0,12),path:f.slice(0,p+1).join("/")||"/"})}return h.length>4?[{label:"…",path:"/"},...h.slice(h.length-3)]:h});async function r(f){o.value=!0,i.value="";try{const h=await fetch(`${pc}/list?path=${encodeURIComponent(f)}`);if(!h.ok)throw new Error(`HTTP ${h.status}`);const p=await h.json();n.value=p.path||await a(),s.value=p.entries,n.value||(i.value="没有可访问的目录(尚无会话)")}catch(h){i.value=h instanceof Error?h.message:String(h)}finally{o.value=!1}}async function a(){try{return(await(await fetch(`${pc}/root`)).json()).roots[0]??""}catch{return""}}async function c(f){if(f.type==="dir"){await r(f.path);return}Zn(f.path)}function u(f){return f<1024?`${f} B`:f<1024*1024?`${(f/1024).toFixed(1)} KB`:`${(f/(1024*1024)).toFixed(1)} MB`}return ct(()=>{r(t.initialPath)}),Me(()=>t.initialPath,f=>{f&&r(f)}),(f,h)=>(g(),m("div",GS,[d("div",zS,[d("button",{class:"files-up",title:"上一级","aria-label":"上一级",onClick:h[0]||(h[0]=p=>r(n.value.split("/").slice(0,-1).join("/")||"/"))},[J(me,{name:"chevron-left",size:16})]),d("div",HS,[(g(!0),m(ee,null,Ee(l.value,(p,v)=>(g(),m("span",{key:v,class:"crumb",onClick:k=>r(p.path)},[v>0?(g(),m("b",qS,"/")):U("",!0),d("span",VS,R(p.label),1)],8,WS))),128))])]),i.value?(g(),m("p",KS,R(i.value),1)):o.value?(g(),m("p",YS,"加载中…")):U("",!0),d("ul",ZS,[(g(!0),m(ee,null,Ee(s.value,p=>(g(),m("li",{key:p.path},[d("button",{class:fe(["files-item",{dir:p.type==="dir"}]),onClick:v=>c(p)},[J(me,{name:p.type==="dir"?"folder":"file",size:16},null,8,["name"]),d("span",XS,R(p.name),1),d("span",QS,R(p.type==="dir"?"目录":u(p.size)),1)],10,JS)]))),128)),!o.value&&s.value.length===0?(g(),m("li",e$,"空目录")):U("",!0)])]))}}),n$=Ie(t$,[["__scopeId","data-v-5b582389"]]),s$=34;function ll(e){const t=e.split("/"),n=t.at(-1)??e;return t.length<=2?{dir:t.length===2?`${t[0]}/`:"",base:n}:e.length<=s$?{dir:`${t.slice(0,-1).join("/")}/`,base:n}:{dir:`…/${t.at(-2)}/`,base:n}}const o$={class:"panel-head-row"},i$=["aria-expanded"],l$={class:"head-icon"},r$=["title"],a$={key:1,class:"head-hint"},c$={class:"head-tail"},u$={key:0,class:"head-count"},d$={class:"panel-body"},f$={key:0,class:"git-files"},h$=["title","onClick"],p$={class:"git-file-name"},g$={key:0,class:"git-file-dir"},m$={class:"git-file-base"},v$={key:0,class:"git-file-stat"},y$={key:0,class:"add"},b$={key:1,class:"del"},k$={key:2,class:"diff-body"},w$={key:3,class:"diff-empty"},_$={key:1,class:"diff-empty"},S$=8,gc="scream-panel-git-open",$$=Te({__name:"GitPanel",props:{gitStatus:{default:null}},emits:["refresh","diff"],setup(e,{emit:t}){const n=e,s=t,o={M:"M",A:"A",D:"D",R:"R",U:"U","??":"?","?":"?"},i={D:"danger",A:"success",R:"success",U:"danger","??":"warning","?":"warning"},l=F(!1),r=F(!0);try{r.value=localStorage.getItem(gc)!=="0"}catch{}function a(){r.value=!r.value;try{localStorage.setItem(gc,r.value?"1":"0")}catch{}}function c(){s("refresh")}const u=q(()=>{var v;const p=((v=n.gitStatus)==null?void 0:v.files)??[];return l.value?p:p.slice(0,S$)}),f=q(()=>{var p,v;return Math.max(0,(((v=(p=n.gitStatus)==null?void 0:p.files)==null?void 0:v.length)??0)-u.value.length)}),h=q(()=>{var w,S;const p=((w=n.gitStatus)==null?void 0:w.ahead)??0,v=((S=n.gitStatus)==null?void 0:S.behind)??0;if(!p&&!v)return"";const k=[];return p&&k.push(`↑${p}`),v&&k.push(`↓${v}`),` · ${k.join(" ")}`});return(p,v)=>{var k;return g(),m("section",{class:fe(["panel-section","git-panel",{"is-open":r.value}])},[d("div",o$,[d("button",{class:"panel-head","aria-expanded":r.value,onClick:a},[d("span",l$,[J(me,{name:"git-branch",size:14})]),v[1]||(v[1]=d("span",{class:"head-title"},"Git 变更",-1)),e.gitStatus?(g(),m("span",{key:0,class:"head-hint",title:`${e.gitStatus.branch??"detached"}${h.value}`},R(e.gitStatus.branch??"detached")+R(h.value),9,r$)):(g(),m("span",a$,"状态不可用")),d("span",c$,[e.gitStatus?(g(),m("span",u$,R(e.gitStatus.changed),1)):U("",!0),J(me,{class:fe(["chevron",{rotated:r.value}]),name:"chevron-down",size:14},null,8,["class"])])],8,i$),d("button",{class:"icon-btn",title:"刷新","aria-label":"刷新 Git 状态",onClick:c},[J(me,{name:"refresh",size:14})])]),it(d("div",d$,[e.gitStatus?(g(),m(ee,{key:0},[u.value.length?(g(),m("ul",f$,[(g(!0),m(ee,null,Ee(u.value,w=>(g(),m("li",{key:w.path},[d("button",{class:"git-file",title:`查看 ${w.displayPath??w.path} 的 diff`,onClick:S=>s("diff",{path:w.path,display:w.displayPath??w.path,adds:w.adds,dels:w.dels})},[d("span",{class:fe(["git-file-status",i[w.status]??""])},R(o[w.status]??w.status),3),d("span",p$,[W(ll)(w.displayPath??w.path).dir?(g(),m("span",g$,R(W(ll)(w.displayPath??w.path).dir),1)):U("",!0),d("span",m$,R(W(ll)(w.displayPath??w.path).base),1)]),w.adds!==void 0||w.dels!==void 0?(g(),m("span",v$,[w.adds?(g(),m("span",y$,"+"+R(w.adds),1)):U("",!0),w.dels?(g(),m("span",b$,"−"+R(w.dels),1)):U("",!0)])):U("",!0)],8,h$)]))),128))])):U("",!0),f.value?(g(),m("button",{key:1,class:"git-more",onClick:v[0]||(v[0]=w=>l.value=!l.value)},R(l.value?"收起列表":`显示全部 ${((k=e.gitStatus.files)==null?void 0:k.length)??0} 个文件`),1)):U("",!0),e.gitStatus.diffStat?(g(),m("pre",k$,R(e.gitStatus.diffStat),1)):u.value.length?U("",!0):(g(),m("div",w$,"工作区干净,没有变更。"))],64)):(g(),m("div",_$,"读取 Git 状态失败,点右上角刷新重试。"))],512),[[zu,r.value]])],2)}}}),x$=Ie($$,[["__scopeId","data-v-07e2afd4"]]),C$={class:"goal-panel panel-section"},T$={class:"section-heading"},I$={class:"head-icon"},R$=["title"],A$={key:0,class:"head-tail"},E$={class:"panel-body"},M$={key:0,class:"empty-state"},P$=["disabled"],L$={class:"refine-row"},O$=["disabled"],D$={key:0},N$=["disabled"],B$={class:"budget-grid"},F$=["disabled"],j$=["disabled"],U$={class:"time-budget"},G$=["disabled"],z$=["disabled"],H$=["disabled"],W$={key:0,class:"goal-summary"},q$={class:"objective"},V$={class:"criterion"},K$={key:0,class:"reason"},Y$={class:"goal-metrics"},Z$={class:"goal-metric"},J$={key:0,class:"bar"},X$={class:"goal-metric"},Q$={key:0,class:"bar"},ex={class:"goal-metric"},tx={key:0,class:"bar"},nx={key:1,class:"budget-warning"},sx={key:2,class:"notes"},ox={class:"panel-actions"},ix=["disabled"],lx=["disabled"],rx=["disabled"],ax=["disabled"],cx=["disabled"],ux={class:"budget-grid"},dx=["disabled"],fx=["disabled"],hx={class:"time-budget"},px=["disabled"],gx=["disabled"],mx={class:"edit-actions"},vx=["disabled"],yx=["disabled"],bx={key:3,class:"form-error"},kx={key:4,class:"pending-copy"},wx=Te({__name:"GoalPanel",props:{goal:{},sessionId:{default:null},connectionStatus:{},busy:{type:Boolean,default:!1},archived:{type:Boolean,default:!1},pending:{type:Boolean,default:!1},error:{default:null},refineGoal:{},createGoal:{},updateGoal:{},pauseGoal:{},resumeGoal:{},cancelGoal:{}},setup(e){const t=e,n=F(""),s=F(""),o=F(""),i=F(""),l=F(""),r=F("minutes"),a=F(!1),c=F(null),u=F(!1),f=q(()=>t.connectionStatus==="connected"),h=q(()=>!t.sessionId||!f.value||t.archived||t.pending),p=q(()=>h.value),v=q(()=>{var L;return{active:"进行中",paused:"已暂停",blocked:"受阻",complete:"已完成"}[((L=t.goal)==null?void 0:L.status)??"active"]}),k=q(()=>t.sessionId?t.archived?"归档会话为只读状态":f.value?t.pending?"正在提交请求…":t.goal?"状态由核心事件实时同步":"创建后 Agent 将自动开始执行":"连接恢复后可继续管理":"选择或新建会话后即可配置");Me(()=>t.sessionId,()=>{a.value=!1,w()}),Me(()=>{var L;return(L=t.goal)==null?void 0:L.goalId},(L,B)=>{a.value=!1,L!==B&&w()});function w(){n.value="",s.value="",o.value="",i.value="",l.value="",r.value="minutes",u.value=!1,c.value=null}function S(L,B){const ne=L.trim();if(!ne)return null;const ie=Number(ne);if(!Number.isSafeInteger(ie)||ie<=0){c.value=`${B}必须是正整数。`;return}return ie}function $(){c.value=null;const L=S(o.value,"轮次预算");if(L===void 0)return null;const B=S(i.value,"Token 预算");if(B===void 0)return null;const ne=S(l.value,"时间预算");if(ne===void 0)return null;const ie=[];return L!==null&&ie.push({value:L,unit:"turns"}),B!==null&&ie.push({value:B,unit:"tokens"}),ne!==null&&ie.push({value:ne,unit:r.value}),ie}async function M(){const L=n.value.trim();if(!L){c.value="请先输入需要优化的目标描述。";return}c.value=null,u.value=!1;const B=await t.refineGoal(L);B!==null&&(n.value=B,u.value=!0)}async function P(){const L=n.value.trim();if(!L){c.value="目标内容不能为空。";return}const B=$();if(B===null)return;await t.createGoal({objective:L,completionCriterion:s.value.trim()||void 0,replace:!1,budgets:B})&&(u.value=!1)}function Z(L){L===null?(l.value="",r.value="minutes"):L%36e5===0?(l.value=String(L/36e5),r.value="hours"):L%6e4===0?(l.value=String(L/6e4),r.value="minutes"):L%1e3===0?(l.value=String(L/1e3),r.value="seconds"):(l.value=String(L),r.value="milliseconds")}function j(){const L=t.goal;L&&(n.value=L.objective,o.value=L.budget.turnBudget===null?"":String(L.budget.turnBudget),i.value=L.budget.tokenBudget===null?"":String(L.budget.tokenBudget),Z(L.budget.wallClockBudgetMs),c.value=null,a.value=!0)}function C(L,B){return B==="hours"?L*36e5:B==="minutes"?L*6e4:B==="seconds"?L*1e3:L}async function x(){const L=t.goal;if(!L)return;const B=n.value.trim();if(!B){c.value="目标内容不能为空。";return}const ne=$();if(ne===null)return;const ie=S(o.value,"轮次预算"),_e=S(i.value,"Token 预算"),Se=S(l.value,"时间预算");if(ie===void 0||_e===void 0||Se===void 0)return;if(L.budget.turnBudget!==null&&ie===null){c.value="当前协议不支持清除已有轮次预算,请填写新的正整数。";return}if(L.budget.tokenBudget!==null&&_e===null){c.value="当前协议不支持清除已有 Token 预算,请填写新的正整数。";return}if(L.budget.wallClockBudgetMs!==null&&Se===null){c.value="当前协议不支持清除已有时间预算,请填写新的正整数。";return}const je=ne.filter(he=>he.unit==="turns"?he.value!==L.budget.turnBudget:he.unit==="tokens"?he.value!==L.budget.tokenBudget:C(he.value,he.unit)!==L.budget.wallClockBudgetMs),Qe=B===L.objective?void 0:B;if(Qe===void 0&&je.length===0){c.value="目标与预算没有变化。";return}await t.updateGoal({objective:Qe,budgets:je})&&(a.value=!1)}async function y(L){c.value=null,!(L==="cancel"&&!window.confirm("确定取消当前 Goal?当前 Goal 状态将被清除。"))&&(L==="pause"?await t.pauseGoal():L==="resume"?await t.resumeGoal():await t.cancelGoal())}function T(L){return L.toLocaleString("zh-CN")}function O(L){if(L<1e3)return`${L} 毫秒`;const B=Math.floor(L/1e3);if(B<60)return`${B} 秒`;const ne=Math.floor(B/3600),ie=Math.floor(B%3600/60);return ne>0?`${ne} 小时 ${ie} 分钟`:`${ie} 分钟`}function I(L,B){return B===null||B<=0?0:Math.min(100,Math.round(L/B*100))}function H(L){return new Date(L).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}return(L,B)=>(g(),m("section",C$,[d("div",T$,[d("span",I$,[J(me,{name:"target",size:14})]),B[15]||(B[15]=d("span",{class:"head-title"},"Goal 管理",-1)),d("span",{class:"head-hint",title:k.value},R(k.value),9,R$),e.goal?(g(),m("span",A$,[d("span",{class:fe(["status-pill",`is-${e.goal.status}`])},R(v.value),3)])):U("",!0)]),d("div",E$,[e.sessionId?e.goal?(g(),m(ee,{key:2},[a.value?(g(),m("form",{key:1,class:"goal-form edit-form",onSubmit:rt(x,["prevent"])},[d("label",null,[B[31]||(B[31]=d("span",null,"目标内容",-1)),it(d("textarea",{"onUpdate:modelValue":B[9]||(B[9]=ne=>n.value=ne),rows:"3",maxlength:"4000",disabled:h.value||e.busy},null,8,cx),[[ut,n.value]])]),B[36]||(B[36]=d("div",{class:"budget-title"},[Ce("更新预算 "),d("small",null,"仅提交发生变化的预算")],-1)),d("div",ux,[d("label",null,[B[32]||(B[32]=d("span",null,"轮次",-1)),it(d("input",{"onUpdate:modelValue":B[10]||(B[10]=ne=>o.value=ne),type:"number",min:"1",step:"1",placeholder:"不限",disabled:h.value||e.busy},null,8,dx),[[ut,o.value]])]),d("label",null,[B[33]||(B[33]=d("span",null,"Token",-1)),it(d("input",{"onUpdate:modelValue":B[11]||(B[11]=ne=>i.value=ne),type:"number",min:"1",step:"1",placeholder:"不限",disabled:h.value||e.busy},null,8,fx),[[ut,i.value]])])]),d("div",hx,[d("label",null,[B[34]||(B[34]=d("span",null,"时间",-1)),it(d("input",{"onUpdate:modelValue":B[12]||(B[12]=ne=>l.value=ne),type:"number",min:"1",step:"1",placeholder:"不限",disabled:h.value||e.busy},null,8,px),[[ut,l.value]])]),it(d("select",{"onUpdate:modelValue":B[13]||(B[13]=ne=>r.value=ne),"aria-label":"时间预算单位",disabled:h.value||e.busy},[...B[35]||(B[35]=[d("option",{value:"minutes"},"分钟",-1),d("option",{value:"hours"},"小时",-1),d("option",{value:"seconds"},"秒",-1),d("option",{value:"milliseconds"},"毫秒",-1)])],8,gx),[[Ca,r.value]])]),d("div",mx,[d("button",{type:"button",class:"secondary",disabled:e.pending,onClick:B[14]||(B[14]=ne=>a.value=!1)},"返回",8,vx),d("button",{class:"primary small",type:"submit",disabled:h.value||e.busy},"保存修改",8,yx)])],32)):(g(),m("div",W$,[d("div",q$,[B[24]||(B[24]=d("small",null,"目标",-1)),d("p",null,R(e.goal.objective),1)]),d("div",V$,[B[25]||(B[25]=d("small",null,"完成标准",-1)),d("p",null,R(e.goal.completionCriterion??"未设置,由 Agent 根据目标判断完成。"),1)]),e.goal.terminalReason?(g(),m("div",K$,[B[26]||(B[26]=d("strong",null,"状态原因",-1)),d("span",null,R(e.goal.terminalReason),1)])):U("",!0),d("dl",Y$,[d("div",Z$,[B[27]||(B[27]=d("dt",null,"轮次",-1)),d("dd",null,R(e.goal.turnsUsed)+" / "+R(e.goal.budget.turnBudget??"不限"),1),e.goal.budget.turnBudget!==null?(g(),m("i",J$,[d("i",{style:Nt({width:`${I(e.goal.turnsUsed,e.goal.budget.turnBudget)}%`})},null,4)])):U("",!0)]),d("div",X$,[B[28]||(B[28]=d("dt",null,"Token",-1)),d("dd",null,R(T(e.goal.tokensUsed))+" / "+R(e.goal.budget.tokenBudget===null?"不限":T(e.goal.budget.tokenBudget)),1),e.goal.budget.tokenBudget!==null?(g(),m("i",Q$,[d("i",{style:Nt({width:`${I(e.goal.tokensUsed,e.goal.budget.tokenBudget)}%`})},null,4)])):U("",!0)]),d("div",ex,[B[29]||(B[29]=d("dt",null,"时间",-1)),d("dd",null,R(O(e.goal.wallClockMs))+" / "+R(e.goal.budget.wallClockBudgetMs===null?"不限":O(e.goal.budget.wallClockBudgetMs)),1),e.goal.budget.wallClockBudgetMs!==null?(g(),m("i",tx,[d("i",{style:Nt({width:`${I(e.goal.wallClockMs,e.goal.budget.wallClockBudgetMs)}%`})},null,4)])):U("",!0)])]),e.goal.budget.overBudget?(g(),m("div",nx,"已达到或超过执行预算。")):U("",!0),e.goal.notes.length?(g(),m("details",sx,[d("summary",null,"工作记录("+R(e.goal.notes.length)+")",1),d("ol",null,[(g(!0),m(ee,null,Ee(e.goal.notes,ne=>(g(),m("li",{key:`${ne.time}-${ne.content}`},[d("time",null,R(H(ne.time)),1),d("span",null,R(ne.content),1)]))),128))])])):U("",!0),d("div",ox,[e.goal.status!=="complete"?(g(),m("button",{key:0,class:"secondary",disabled:h.value||e.busy,onClick:j},[J(me,{name:"edit",size:14}),B[30]||(B[30]=Ce("编辑",-1))],8,ix)):U("",!0),e.goal.status==="active"?(g(),m("button",{key:1,class:"secondary",disabled:h.value,onClick:B[6]||(B[6]=ne=>y("pause"))},"暂停",8,lx)):U("",!0),e.goal.status==="paused"||e.goal.status==="blocked"?(g(),m("button",{key:2,class:"primary small",disabled:h.value||e.busy,onClick:B[7]||(B[7]=ne=>y("resume"))},"继续",8,rx)):U("",!0),d("button",{class:"danger",disabled:h.value,onClick:B[8]||(B[8]=ne=>y("cancel"))},"取消 Goal",8,ax)])]))],64)):(g(),m("form",{key:1,class:"goal-form",onSubmit:rt(P,["prevent"])},[d("label",null,[B[16]||(B[16]=d("span",null,"目标内容",-1)),it(d("textarea",{"onUpdate:modelValue":B[0]||(B[0]=ne=>n.value=ne),rows:"3",maxlength:"4000",placeholder:"描述希望 Agent 持续完成的目标",disabled:p.value},null,8,P$),[[ut,n.value]])]),d("div",L$,[d("button",{type:"button",class:"secondary",disabled:p.value||!n.value.trim(),onClick:M},[J(me,{name:"sparkles",size:15}),B[17]||(B[17]=Ce(" AI 优化 ",-1))],8,O$),u.value?(g(),m("small",D$,"已优化,请确认或继续编辑后再创建。")):U("",!0)]),d("label",null,[B[18]||(B[18]=d("span",null,[Ce("完成标准 "),d("small",null,"可选")],-1)),it(d("textarea",{"onUpdate:modelValue":B[1]||(B[1]=ne=>s.value=ne),rows:"2",placeholder:"例如:聚焦测试、类型检查与 Web 构建全部通过",disabled:p.value},null,8,N$),[[ut,s.value]])]),B[23]||(B[23]=d("div",{class:"budget-title"},[Ce("执行预算 "),d("small",null,"留空表示不限制")],-1)),d("div",B$,[d("label",null,[B[19]||(B[19]=d("span",null,"轮次",-1)),it(d("input",{"onUpdate:modelValue":B[2]||(B[2]=ne=>o.value=ne),type:"number",min:"1",step:"1",placeholder:"不限",disabled:p.value},null,8,F$),[[ut,o.value]])]),d("label",null,[B[20]||(B[20]=d("span",null,"Token",-1)),it(d("input",{"onUpdate:modelValue":B[3]||(B[3]=ne=>i.value=ne),type:"number",min:"1",step:"1",placeholder:"不限",disabled:p.value},null,8,j$),[[ut,i.value]])])]),d("div",U$,[d("label",null,[B[21]||(B[21]=d("span",null,"时间",-1)),it(d("input",{"onUpdate:modelValue":B[4]||(B[4]=ne=>l.value=ne),type:"number",min:"1",step:"1",placeholder:"不限",disabled:p.value},null,8,G$),[[ut,l.value]])]),it(d("select",{"onUpdate:modelValue":B[5]||(B[5]=ne=>r.value=ne),"aria-label":"时间预算单位",disabled:p.value},[...B[22]||(B[22]=[d("option",{value:"minutes"},"分钟",-1),d("option",{value:"hours"},"小时",-1),d("option",{value:"seconds"},"秒",-1),d("option",{value:"milliseconds"},"毫秒",-1)])],8,z$),[[Ca,r.value]])]),d("button",{class:"primary",type:"submit",disabled:p.value||!n.value.trim()},R(e.pending?"正在创建…":"创建并开始执行"),9,H$)],32)):(g(),m("div",M$,"暂无会话,Goal 管理暂不可用。")),c.value||e.error?(g(),m("p",bx,R(c.value??e.error),1)):e.pending?(g(),m("p",kx,"请求处理中,状态将在核心事件到达后同步。")):U("",!0)])]))}}),_x=Ie(wx,[["__scopeId","data-v-2e8dbdc6"]]),Sx={class:"panel-section like-section"},$x={class:"section-heading"},xx={class:"head-icon"},Cx={class:"panel-body"},Tx={class:"kv-rows"},Ix={class:"dialog"},Rx=["onUpdate:modelValue","placeholder"],Ax={key:0,class:"dialog-error"},Ex={class:"dialog-actions"},Mx=["disabled"],Px=Te({__name:"LikePanel",props:{like:{},updateLike:{type:Function}},setup(e){const t=e,n=F(!1),s=F(!1),o=F(""),i=F({}),l=[{key:"nickname",label:"昵称",placeholder:"用户称呼,如:老板"},{key:"tone",label:"语气",placeholder:"AI 风格,如:专业不拖沓"},{key:"other",label:"偏好",placeholder:"其他用户偏好"},{key:"doNot",label:"禁止",placeholder:"用户明确不让做的事"}];function r(){i.value={...t.like},o.value="",n.value=!0}async function a(){s.value=!0,o.value="";const c=await t.updateLike(i.value);s.value=!1,c?n.value=!1:o.value="保存失败"}return(c,u)=>(g(),m("section",Sx,[d("div",$x,[d("span",xx,[J(me,{name:"settings",size:14})]),u[2]||(u[2]=d("span",{class:"head-title"},"偏好设置",-1)),u[3]||(u[3]=d("span",{class:"head-hint"},"/like 用户偏好",-1))]),d("div",Cx,[d("dl",Tx,[(g(),m(ee,null,Ee(l,f=>d("div",{key:f.key,class:"kv-row"},[d("dt",null,R(f.label),1),d("dd",null,R((e.like[f.key]??"").trim()||"未设置"),1)])),64))]),d("div",{class:"panel-actions"},[d("button",{class:"like-edit",onClick:r},"编辑偏好")])]),n.value?(g(),m("div",{key:0,class:"dialog-overlay",onClick:u[1]||(u[1]=rt(f=>n.value=!1,["self"]))},[d("div",Ix,[u[4]||(u[4]=d("div",{class:"dialog-title"},"编辑用户偏好",-1)),(g(),m(ee,null,Ee(l,f=>d("label",{key:f.key,class:"dialog-field"},[d("span",null,R(f.label),1),it(d("input",{"onUpdate:modelValue":h=>i.value[f.key]=h,placeholder:f.placeholder},null,8,Rx),[[ut,i.value[f.key]]])])),64)),o.value?(g(),m("div",Ax,R(o.value),1)):U("",!0),d("div",Ex,[d("button",{onClick:u[0]||(u[0]=f=>n.value=!1)},"取消"),d("button",{disabled:s.value,onClick:a},R(s.value?"保存中…":"确认"),9,Mx)])])])):U("",!0)]))}}),Lx=Ie(Px,[["__scopeId","data-v-a7906d58"]]),Ox=["aria-expanded"],Dx={class:"head-icon"},Nx={class:"head-hint"},Bx={class:"head-tail"},Fx=["title"],jx={class:"panel-body"},Ux={class:"stat-grid"},Gx={class:"stat"},zx={class:"stat"},Hx=["title"],Wx={key:1,class:"faint"},qx={class:"stat wide"},Vx={class:"mono"},mc="scream-panel-runstatus-open",Kx=Te({__name:"RunStatusPanel",props:{status:{},busy:{type:Boolean,default:!1},connectionStatus:{}},setup(e){const t=e,n=F(!0);try{n.value=localStorage.getItem(mc)!=="0"}catch{}function s(){n.value=!n.value;try{localStorage.setItem(mc,n.value?"1":"0")}catch{}}const o=q(()=>{const r=t.status.contextUsage;return r===void 0?null:Math.round((r>1?r/100:r)*100)}),i=q(()=>{var r,a;return`Tokens: ${((r=t.status.contextTokens)==null?void 0:r.toLocaleString())??"-"} / ${((a=t.status.maxContextTokens)==null?void 0:a.toLocaleString())??"-"}`}),l=q(()=>({connected:"已连接",connecting:"连接中",reconnecting:"重连中",disconnected:"已断开",idle:"空闲"})[t.connectionStatus]??"空闲");return Me(()=>t.busy,()=>{t.busy&&!n.value&&(n.value=!0)}),(r,a)=>{var c,u;return g(),m("section",{class:fe(["panel-section","run-status",{"is-open":n.value}])},[d("button",{class:"panel-head","aria-expanded":n.value,onClick:s},[d("span",Dx,[J(me,{name:"activity",size:14})]),a[0]||(a[0]=d("span",{class:"head-title"},"运行状态",-1)),d("span",Nx,R(e.busy?"正在处理会话":"已就绪,等待任务"),1),d("span",Bx,[d("span",{class:fe(["head-dot",{busy:e.busy}]),title:e.busy?"Agent 正在处理":"空闲"},null,10,Fx),J(me,{class:fe(["chevron",{rotated:n.value}]),name:"chevron-down",size:14},null,8,["class"])])],8,Ox),it(d("div",jx,[d("dl",Ux,[d("div",Gx,[a[1]||(a[1]=d("dt",null,"连接",-1)),d("dd",null,[d("span",{class:fe(["conn-dot",e.connectionStatus]),"aria-hidden":"true"},null,2),d("span",{class:fe(["conn",e.connectionStatus])},R(l.value),3)])]),d("div",zx,[a[2]||(a[2]=d("dt",null,"上下文占用",-1)),o.value!==null?(g(),m("dd",{key:0,title:i.value},[J(sd,{usage:e.status.contextUsage,size:14},null,8,["usage"]),Ce(R(o.value)+"% ",1)],8,Hx)):(g(),m("dd",Wx,"未知"))]),d("div",qx,[a[3]||(a[3]=d("dt",null,"Token(输入 / 上限)",-1)),d("dd",Vx,R(((c=e.status.contextTokens)==null?void 0:c.toLocaleString())??"-")+" / "+R(((u=e.status.maxContextTokens)==null?void 0:u.toLocaleString())??"-"),1)])])],512),[[zu,n.value]])],2)}}}),Yx=Ie(Kx,[["__scopeId","data-v-59b0c4e7"]]),Zx={class:"todo-panel panel-section"},Jx={class:"section-heading"},Xx={class:"head-icon"},Qx={class:"head-hint"},eC={class:"head-tail"},tC={class:"head-count"},nC={key:0,class:"panel-body"},sC={class:"empty-state"},oC={key:1,class:"panel-body"},iC={class:"progress-row"},lC={class:"bar","aria-hidden":"true"},rC={class:"progress-value"},aC=["title"],cC={class:"todo-title"},uC=Te({__name:"TodoPanel",props:{todos:{}},setup(e){const t=e,n=q(()=>Xg(t.todos)),s=q(()=>t.todos.filter(c=>c.status==="done").length),o=q(()=>t.todos.filter(c=>c.status==="in_progress").length),i=q(()=>t.todos.filter(c=>c.status==="pending").length),l=q(()=>t.todos.length?Math.round(s.value/t.todos.length*100):0),r=q(()=>{if(!t.todos.length)return"直接来自 Agent 核心状态";if(s.value===t.todos.length)return"全部完成";const c=[];return o.value&&c.push(`进行中 ${o.value}`),i.value&&c.push(`待处理 ${i.value}`),c.join(" · ")||"直接来自 Agent 核心状态"}),a={pending:{label:"待处理",symbol:"○"},in_progress:{label:"进行中",symbol:"●"},done:{label:"已完成",symbol:"✓"}};return(c,u)=>(g(),m("section",Zx,[d("div",Jx,[d("span",Xx,[J(me,{name:"clipboard",size:14})]),u[0]||(u[0]=d("span",{class:"head-title"},"核心 Todo",-1)),d("span",Qx,R(r.value),1),d("span",eC,[d("span",tC,R(s.value)+"/"+R(e.todos.length),1)])]),e.todos.length===0?(g(),m("div",nC,[d("div",sC,[J(me,{name:"check",size:18}),u[1]||(u[1]=d("span",null,"暂无 Todo",-1)),u[2]||(u[2]=d("small",null,"Agent 创建任务清单后会在这里实时显示。",-1))])])):(g(),m("div",oC,[d("div",iC,[d("i",lC,[d("i",{style:Nt({width:`${l.value}%`})},null,4)]),d("span",rC,R(l.value)+"%",1)]),(g(!0),m(ee,null,Ee(n.value,(f,h)=>(g(),m("section",{key:f.phase??`unphased-${h}`,class:"todo-group"},[d("h4",null,R(f.phase??"未分阶段"),1),d("ol",null,[(g(!0),m(ee,null,Ee(f.items,(p,v)=>(g(),m("li",{key:`${h}-${v}-${p.title}`,class:fe(`is-${p.status}`)},[d("span",{class:"status-symbol",title:a[p.status].label},R(a[p.status].symbol),9,aC),d("span",cC,R(p.title),1),d("small",null,R(a[p.status].label),1)],2))),128))])]))),128))]))]))}}),dC=Ie(uC,[["__scopeId","data-v-6a025f22"]]),fC={class:"drawer"},hC={class:"drawer-toolbar"},pC={class:"drawer-tabs",role:"tablist","aria-label":"抽屉面板"},gC=["aria-selected"],mC=["aria-selected"],vC={class:"drawer-body"},yC={class:"git-diff-head"},bC=["title"],kC={class:"git-diff-tools"},wC={key:0,class:"git-diff-stat"},_C={key:0,class:"add"},SC={key:1,class:"del"},$C={key:0,class:"git-diff-body"},xC={key:1,class:"git-diff-empty"},CC=Te({__name:"SessionDrawer",props:{client:{}},emits:["refresh-git","close","insert"],setup(e){const t=e,n=F("detail"),s=F(null),o=F(null);async function i(C){var y,T,O;s.value={...C,lines:[],loading:!0};try{const H=await(await fetch(`/api/v1/git/diff?path=${encodeURIComponent(C.path)}`)).json(),L=sf(H.patch??""),B=C.adds??(C.dels===void 0?L.filter(ne=>ne.type==="add").length:void 0);s.value={...C,adds:B,lines:L,loading:!1}}catch{s.value={...C,lines:[],loading:!1}}await ft();const x=((T=(y=globalThis.window)==null?void 0:y.matchMedia)==null?void 0:T.call(y,"(prefers-reduced-motion: reduce)").matches)===!0;(O=o.value)==null||O.scrollIntoView({block:"start",behavior:x?"auto":"smooth"})}const{connectionStatus:l,status:r,sessionId:a,isBusy:c,isArchived:u,goal:f,todos:h,goalRequestPending:p,goalRequestError:v,like:k,gitStatus:w,refineGoal:S,createGoal:$,updateGoal:M,pauseGoal:P,resumeGoal:Z,cancelGoal:j}=t.client;return(C,x)=>{const y=wp("SvgIcon");return g(),m("aside",fC,[d("div",hC,[d("div",pC,[d("button",{role:"tab","aria-selected":n.value==="detail",class:fe(["drawer-tab",{active:n.value==="detail"}]),onClick:x[0]||(x[0]=T=>n.value="detail")}," 详情 ",10,gC),d("button",{role:"tab","aria-selected":n.value==="files",class:fe(["drawer-tab",{active:n.value==="files"}]),onClick:x[1]||(x[1]=T=>n.value="files")}," 文件 ",10,mC)]),d("button",{class:"drawer-close",title:"收起面板","aria-label":"收起详情",onClick:x[2]||(x[2]=T=>C.$emit("close"))},[J(y,{name:"panel-right",size:16})])]),d("div",vC,[n.value==="detail"?(g(),m(ee,{key:0},[J(Yx,{status:W(r),busy:W(c),"connection-status":W(l)},null,8,["status","busy","connection-status"]),J(x$,{"git-status":W(w),onRefresh:x[3]||(x[3]=T=>C.$emit("refresh-git")),onDiff:i},null,8,["git-status"]),s.value?(g(),m("div",{key:0,ref_key:"diffRef",ref:o,class:"git-diff-view"},[d("div",yC,[d("span",{class:"git-diff-title",title:s.value.path},R(s.value.loading?"加载中…":s.value.display),9,bC),d("span",kC,[!s.value.loading&&(s.value.adds||s.value.dels)?(g(),m("span",wC,[s.value.adds?(g(),m("span",_C,"+"+R(s.value.adds),1)):U("",!0),s.value.dels?(g(),m("span",SC,"−"+R(s.value.dels),1)):U("",!0)])):U("",!0),d("button",{class:"git-diff-close",title:"关闭 diff","aria-label":"关闭 diff",onClick:x[4]||(x[4]=T=>s.value=null)},"✕")])]),s.value.lines.length?(g(),m("div",$C,[J(Er,{lines:s.value.lines},null,8,["lines"])])):s.value.loading?U("",!0):(g(),m("p",xC,"该文件无差异内容(可能是二进制文件或已被忽略)。"))],512)):U("",!0),J(dC,{todos:W(h)},null,8,["todos"]),J(Lx,{like:W(k),"update-like":t.client.updateLike},null,8,["like","update-like"]),J(_x,{goal:W(f),"session-id":W(a),"connection-status":W(l),busy:W(c),archived:W(u),pending:W(p),error:W(v),"refine-goal":W(S),"create-goal":W($),"update-goal":W(M),"pause-goal":W(P),"resume-goal":W(Z),"cancel-goal":W(j)},null,8,["goal","session-id","connection-status","busy","archived","pending","error","refine-goal","create-goal","update-goal","pause-goal","resume-goal","cancel-goal"])],64)):(g(),Xe(n$,{key:t.client.workDir.value||"none","initial-path":t.client.workDir.value||""},null,8,["initial-path"]))])])}}}),TC=Ie(CC,[["__scopeId","data-v-2d1f803d"]]),IC={class:"stats-head"},RC={class:"stats-body"},AC={class:"stats-section"},EC={class:"stats-label-row"},MC={class:"stats-value mono"},PC=["aria-valuenow","aria-label"],LC={key:0,class:"stats-section"},OC={class:"stats-label-row"},DC={class:"stats-value mono"},NC={class:"stats-section"},BC={class:"stats-label-row"},FC={class:"stats-value mono"},jC={class:"stats-grid"},UC={class:"stats-cell-label"},GC={class:"stats-cell-value mono"},zC={key:1,class:"stats-section"},HC=["title"],WC={class:"model-tokens mono"},qC={class:"model-dims mono"},VC={key:1,class:"stats-empty"},KC=Te({__name:"SessionStatsPanel",props:{status:{},fetchUsage:{type:Function},fetchContext:{type:Function}},emits:["close"],setup(e,{emit:t}){const n=e,s=t,o=F(null);ct(()=>{n.fetchUsage(),n.fetchContext()});function i($){const M=o.value;M&&!M.contains($.target)&&s("close")}function l($){$.key==="Escape"&&s("close")}ct(()=>{document.addEventListener("pointerdown",i),window.addEventListener("keydown",l)}),Ct(()=>{document.removeEventListener("pointerdown",i),window.removeEventListener("keydown",l)});function r($){return $?$.inputOther+$.output+$.inputCacheRead+$.inputCacheCreation:0}function a($){return typeof $!="number"?"-":$>=1e6?`${($/1e6).toFixed(1)}M`:$>=1e3?`${($/1e3).toFixed(1)}k`:String($)}function c($){return typeof $=="number"?$.toLocaleString():"-"}const u=q(()=>{const $=n.status.contextUsage;if(typeof $=="number"&&Number.isFinite($)){const Z=$>1?$:$*100;return Math.max(0,Math.min(Z,100))}const M=n.status.contextTokens??0,P=n.status.maxContextTokens??0;return P<=0?0:Math.max(0,Math.min(M/P*100,100))}),f=q(()=>typeof n.status.contextTokens=="number"&&typeof n.status.maxContextTokens=="number"?`${c(n.status.contextTokens)} / ${c(n.status.maxContextTokens)}`:u.value>0?`${u.value.toFixed(1)}%`:"-"),h=q(()=>{var $;return($=n.status.usage)==null?void 0:$.total}),p=q(()=>{var $;return($=n.status.usage)==null?void 0:$.currentTurn}),v=q(()=>r(h.value)),k=q(()=>{var M;const $=(M=n.status.usage)==null?void 0:M.byModel;return $?Object.entries($).map(([P,Z])=>({model:P,tokens:r(Z),input:Z.inputOther,output:Z.output,cacheRead:Z.inputCacheRead,cacheCreation:Z.inputCacheCreation})):[]}),w=q(()=>v.value>0||k.value.length>0||r(p.value)>0),S=q(()=>{var $,M,P,Z;return[{key:"input",label:"输入",value:($=h.value)==null?void 0:$.inputOther},{key:"output",label:"输出",value:(M=h.value)==null?void 0:M.output},{key:"cacheRead",label:"缓存读",value:(P=h.value)==null?void 0:P.inputCacheRead},{key:"cacheCreation",label:"缓存写",value:(Z=h.value)==null?void 0:Z.inputCacheCreation}]});return($,M)=>(g(),m("div",{ref_key:"rootRef",ref:o,class:"stats-panel",role:"dialog","aria-label":"会话统计"},[d("div",IC,[M[1]||(M[1]=d("span",{class:"stats-title"},"会话统计",-1)),d("button",{class:"stats-close","aria-label":"关闭统计面板",onClick:M[0]||(M[0]=P=>s("close"))},[J(me,{name:"x",size:14})])]),d("div",RC,[d("div",AC,[d("div",EC,[M[2]||(M[2]=d("span",{class:"stats-label"},"上下文水位",-1)),d("span",MC,R(f.value),1)]),d("div",{class:"ctx-track",role:"progressbar","aria-valuenow":Math.round(u.value),"aria-valuemin":"0","aria-valuemax":"100","aria-label":`上下文 ${u.value.toFixed(1)}%`},[d("div",{class:"ctx-fill",style:Nt({width:`${u.value}%`})},null,4)],8,PC)]),w.value?(g(),m(ee,{key:0},[r(p.value)>0?(g(),m("div",LC,[d("div",OC,[M[3]||(M[3]=d("span",{class:"stats-label"},"当前回合",-1)),d("span",DC,R(a(r(p.value)))+" tokens",1)])])):U("",!0),d("div",NC,[d("div",BC,[M[4]||(M[4]=d("span",{class:"stats-label"},"本会话累计",-1)),d("span",FC,R(a(v.value))+" tokens",1)]),d("div",jC,[(g(!0),m(ee,null,Ee(S.value,P=>(g(),m("div",{key:P.key,class:"stats-cell"},[d("span",UC,R(P.label),1),d("span",GC,R(c(P.value)),1)]))),128))])]),k.value.length>0?(g(),m("div",zC,[M[5]||(M[5]=d("div",{class:"stats-label"},"按模型",-1)),(g(!0),m(ee,null,Ee(k.value,P=>(g(),m("div",{key:P.model,class:"model-row"},[d("span",{class:"model-name",title:P.model},R(P.model),9,HC),d("span",WC,R(c(P.tokens)),1),d("span",qC," 入 "+R(c(P.input))+" · 出 "+R(c(P.output))+" · 缓存 "+R(c(P.cacheRead+P.cacheCreation)),1)]))),128))])):U("",!0)],64)):(g(),m("div",VC,"暂无用量数据"))])],512))}}),YC=Ie(KC,[["__scopeId","data-v-d7ef23ee"]]),ZC={class:"conversation"},JC={key:0,class:"stats-anchor"},XC={class:"chat-stage"},QC={class:"chat-column"},eT={class:"composer-dock"},tT=Te({__name:"ConversationView",props:{client:{}},emits:["home"],setup(e,{emit:t}){const n=e,s=t,{connectionStatus:o,messages:i,pendingApprovals:l,status:r,sessionId:a,workDir:c,isBusy:u,models:f,sendPrompt:h,sendCommand:p,clearMessages:v,appendSystemMessage:k,abort:w,resolveApproval:S,exportSession:$,fetchSnapshot:M,switchModel:P,switchThinking:Z}=n.client,j=F(null),C=F(!1),x=F(!1),y=F(!1),T=F("status"),O=q(()=>{var Fe;const ge=(Fe=r.value.usage)==null?void 0:Fe.currentTurn;if(!ge)return null;const he=ge.inputOther+ge.output+ge.inputCacheRead+ge.inputCacheCreation;return he>0?he:null}),I=q(()=>{const ge=n.client.sessions.value.find(Y=>Y.sessionId===n.client.currentSessionId.value),he=ge==null?void 0:ge.title;if(he&&he!=="新会话"&&he!=="New Session")return he;const Fe=i.value.find(Y=>Y.role==="user");if(Fe){const Y=Fe.content.replace(/\s+/g," ").trim();if(Y)return Y.length>24?`${Y.slice(0,24)}…`:Y}return he??null});function H(ge){var he;(he=j.value)==null||he.insertText(ge)}function L(ge){M(),T.value=ge,y.value=!0}function B(){var he;(((he=j.value)==null?void 0:he.openModelPicker())??!1)||k(`当前模型:${r.value.model??"unknown"}`)}function ne(ge,he){switch(ge){case"compact":p("compact");break;case"model":B();break;case"clear":v();break;case"new":s("home");break;case"help":k(Yu());break;case"auto":case"yes":case"plan":case"fork":case"title":case"btw":p(ge,he);break;case"status":L("status");break;case"usage":L("usage");break;default:k(`未知命令:/${ge}`)}}function ie(ge){p("title",ge)}function _e(){if(u.value||!o.value)return;const ge=[...i.value].reverse().find(he=>he.role==="user");ge&&h(ge.content)}const Se=F(!1);async function je(){Se.value=!0,await n.client.loadOlderMessages(),Se.value=!1}function Qe(){u.value||(p("fork"),setTimeout(()=>{n.client.fetchSessions()},1200))}return(ge,he)=>(g(),m("div",ZC,[J(Oy,{title:I.value,busy:W(u),"drawer-open":C.value,"stats-open":x.value,"turn-tokens":O.value,onHome:he[0]||(he[0]=Fe=>s("home")),onRename:ie,onExport:he[1]||(he[1]=Fe=>W(a)&&W($)(W(a))),onClear:W(v),onToggleDrawer:he[2]||(he[2]=Fe=>C.value=!C.value),onToggleStats:he[3]||(he[3]=Fe=>x.value=!x.value)},null,8,["title","busy","drawer-open","stats-open","turn-tokens","onClear"]),x.value?(g(),m("div",JC,[J(YC,{status:W(r),"fetch-usage":n.client.fetchSessionUsage,"fetch-context":n.client.fetchSessionContext,onClose:he[4]||(he[4]=Fe=>x.value=!1)},null,8,["status","fetch-usage","fetch-context"])])):U("",!0),d("div",XC,[d("div",QC,[J(US,{messages:W(i),busy:W(u),"work-dir":W(c),"session-id":W(a)??"",model:W(r).model??null,"context-usage":W(r).contextUsage??null,connected:W(o)==="connected","older-available":n.client.olderAvailable.value,"older-loading":Se.value,onEdit:H,onPick:W(h),onRetryConnection:he[5]||(he[5]=Fe=>n.client.reconnectNow()),onRetryMessage:_e,onLoadOlder:je,onFork:Qe},null,8,["messages","busy","work-dir","session-id","model","context-usage","connected","older-available","older-loading","onPick"]),d("div",eT,[J(Pm,{approvals:W(l),onResolve:W(S)},null,8,["approvals","onResolve"]),J(od,{ref_key:"composerRef",ref:j,busy:W(u),status:W(r),"session-id":W(a),models:W(f),"work-dir":W(c)||"",messages:W(i),onSend:W(h),onAbort:W(w),onCommand:ne,onSwitchModel:W(P),onSwitchThinking:W(Z)},null,8,["busy","status","session-id","models","work-dir","messages","onSend","onAbort","onSwitchModel","onSwitchThinking"])])]),J(_i,{name:"drawer"},{default:Pt(()=>[C.value?(g(),Xe(TC,{key:0,client:n.client,onRefreshGit:he[6]||(he[6]=Fe=>n.client.fetchGitStatus()),onClose:he[7]||(he[7]=Fe=>C.value=!1)},null,8,["client"])):U("",!0)]),_:1})]),y.value?(g(),Xe(vb,{key:1,mode:T.value,status:W(r),"session-id":W(a),"work-dir":W(c),onClose:he[8]||(he[8]=Fe=>y.value=!1)},null,8,["mode","status","session-id","work-dir"])):U("",!0)]))}}),nT=Ie(tT,[["__scopeId","data-v-1f8d863e"]]),sT=new Set(["png","jpg","jpeg","gif","webp","svg","avif","ico"]),oT=new Set(["mp3","wav","m4a","ogg"]),iT=new Set(["md","markdown"]);function of(e){const t=e.split(/[\\/]/).pop()??e,n=t.lastIndexOf(".");return n>0?t.slice(n+1).toLowerCase():""}function lT(e){const t=of(e);return sT.has(t)?"image":oT.has(t)?"audio":iT.has(t)?"markdown":t==="pdf"?"pdf":"source"}const rT={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",mjs:"javascript",cjs:"javascript",py:"python",rs:"rust",go:"go",java:"java",c:"c",h:"c",cpp:"cpp",hpp:"cpp",cs:"csharp",rb:"ruby",php:"php",sh:"bash",bash:"bash",zsh:"bash",yml:"yaml",yaml:"yaml",json:"json",toml:"toml",ini:"ini",xml:"xml",html:"html",css:"css",scss:"scss",less:"less",sql:"sql",md:"markdown",markdown:"markdown",vue:"vue",svelte:"svelte",swift:"swift",kt:"kotlin",lua:"lua",r:"r",dart:"dart",graphql:"graphql",proto:"protobuf",txt:"text"};function vc(e){const t=(e.split(/[\\/]/).pop()??"").toLowerCase();return t==="dockerfile"?"docker":t==="makefile"?"make":rT[of(e)]??"text"}const aT={key:0,class:"file-viewer"},cT={class:"fv-toolbar"},uT=["title","aria-label"],dT={class:"fv-path-text"},fT={class:"fv-modes",role:"tablist","aria-label":"显示模式"},hT=["aria-selected","title","onClick"],pT={class:"fv-body"},gT={key:0,class:"fv-status"},mT={key:1,class:"fv-status fv-error"},vT={class:"fv-error-name"},yT={class:"fv-error-msg"},bT={key:0,class:"fv-scroll"},kT={key:1,class:"fv-status"},wT={key:0,class:"fv-media"},_T=["src","alt"],ST={key:1,class:"fv-media"},$T=["src"],xT={key:2,class:"fv-media fv-pdf"},CT=["src","title"],TT={key:3,class:"fv-scroll fv-markdown"},IT={key:4,class:"fv-scroll"},RT={key:4,class:"fv-scroll"},AT={key:0,class:"fv-note"},ET={key:1,class:"fv-empty"},rl="/api/v1",MT=Te({__name:"FileViewer",props:{client:{}},setup(e){const t=e,n=[{id:"source",label:"源码"},{id:"preview",label:"预览"},{id:"diff",label:"Diff"}],s=q(()=>bm()),o=q(()=>s.value?hm(s.value.viewerState,s.value.initialDisplayMode):"source"),i=q(()=>s.value?lT(s.value.filePath):"source"),l=F(0),r=q(()=>{if(!s.value)return"";const y=l.value>0?`&t=${l.value}`:"";return`${rl}/files/raw?path=${encodeURIComponent(s.value.filePath)}${y}`}),a=An(new Map),c=An(new Map);async function u(y){try{const T=await y.json();return T.message??T.error??`HTTP ${y.status}`}catch{return`HTTP ${y.status}`}}function f(y){var H,L;const T=(H=t.client)==null?void 0:H.gitStatus.value,O=((L=t.client)==null?void 0:L.workDir.value)??"";if(!(T!=null&&T.files)||T.files.length===0)return null;const I=O&&y.startsWith(`${O}/`)?y.slice(O.length+1):y.startsWith("/")?null:y;if(I){const B=T.files.find(ne=>(ne.displayPath??ne.path)===I);if(B)return B.path;for(const ne of T.files){const ie=ne.displayPath??ne.path;if(ie&&ne.path.endsWith(ie))return ne.path.slice(0,ne.path.length-ie.length)+I}}return null}function h(y){var H;const T=[],O=L=>{L&&L!==y&&!T.includes(L)&&T.push(L)};O(f(y)),T.push(y);const I=((H=t.client)==null?void 0:H.workDir.value)??"";return I&&y.startsWith(`${I}/`)&&O(y.slice(I.length+1)),T}async function p(){const y=s.value;if(!(!y||c.has(y.filePath)))try{for(const T of h(y.filePath)){const O=await fetch(`${rl}/git/diff?path=${encodeURIComponent(T)}`);if(!O.ok){c.set(y.filePath,{status:"error",message:await u(O)});return}const I=await O.json();if((I.patch??"")!==""){c.set(y.filePath,{status:"ok",patch:I.patch??""});return}}c.set(y.filePath,{status:"ok",patch:""})}catch(T){c.set(y.filePath,{status:"error",message:T instanceof Error?T.message:String(T)})}}async function v(){const y=s.value;if(y){if(o.value==="diff"){await p();return}if(!(o.value==="preview"&&(i.value==="image"||i.value==="audio"||i.value==="pdf"))&&!a.has(y.filePath))try{const T=await fetch(`${rl}/files/read?path=${encodeURIComponent(y.filePath)}`);if(!T.ok)a.set(y.filePath,{status:"error",message:await u(T)});else{const O=await T.json();a.set(y.filePath,{status:"ok",content:O.content,truncated:O.truncated===!0})}}catch(T){a.set(y.filePath,{status:"error",message:T instanceof Error?T.message:String(T)})}}}Me(()=>{var y;return[(y=s.value)==null?void 0:y.id,o.value]},()=>{v()},{immediate:!0});const k=q(()=>{const y=s.value;if(y)return o.value==="diff"?c.get(y.filePath):o.value==="preview"&&(i.value==="image"||i.value==="audio"||i.value==="pdf")?{status:"ok"}:a.get(y.filePath)}),w=q(()=>s.value!==void 0&&k.value===void 0),S=q(()=>{var y;return((y=k.value)==null?void 0:y.status)==="error"?k.value:null}),$=q(()=>{const y=s.value?a.get(s.value.filePath):void 0;return(y==null?void 0:y.status)==="ok"?y.content:""}),M=q(()=>{const y=s.value?a.get(s.value.filePath):void 0;return(y==null?void 0:y.status)==="ok"?y.truncated:!1}),P=q(()=>{const y=s.value?c.get(s.value.filePath):void 0;return(y==null?void 0:y.status)==="ok"&&y.patch.trim()!==""?sf(y.patch):[]});function Z(y){var I,H,L;const T=s.value;if(!T||o.value===y)return;const O={displayMode:y,wrapLines:((I=T.viewerState)==null?void 0:I.wrapLines)??!1,scrollTop:((H=T.viewerState)==null?void 0:H.scrollTop)??0,scrollLeft:((L=T.viewerState)==null?void 0:L.scrollLeft)??0};$e.tabs=gm($e.tabs,T.id,T.viewerRevision??0,O)}function j(){const y=s.value;if(y){if(o.value==="diff")c.delete(y.filePath);else if(o.value==="preview"&&(i.value==="image"||i.value==="audio"||i.value==="pdf")){l.value+=1;return}else a.delete(y.filePath);v()}}const C=F(!1);function x(){var T;const y=s.value;y&&((T=navigator.clipboard)==null||T.writeText(y.filePath).then(()=>{C.value=!0,setTimeout(()=>C.value=!1,1500)}).catch(()=>{}))}return(y,T)=>s.value?(g(),m("div",aT,[d("div",cT,[d("button",{class:"fv-path",title:C.value?"已复制路径":`复制路径:${s.value.filePath}`,"aria-label":`文件路径 ${s.value.filePath}`,onClick:x},[J(me,{name:"copy",size:12,class:"fv-path-icon"}),d("span",dT,R(s.value.filePath),1)],8,uT),d("div",fT,[(g(),m(ee,null,Ee(n,O=>d("button",{key:O.id,class:fe(["fv-mode",{active:o.value===O.id}]),role:"tab","aria-selected":o.value===O.id,title:`${O.label}模式`,onClick:I=>Z(O.id)},R(O.label),11,hT)),64))]),d("button",{class:"fv-icon-btn",title:"刷新","aria-label":"刷新",onClick:j},[J(me,{name:"refresh",size:14})])]),d("div",pT,[w.value?(g(),m("div",gT,[...T[0]||(T[0]=[d("span",{class:"fv-spinner","aria-hidden":"true"},null,-1),d("span",null,"加载中…",-1)])])):S.value?(g(),m("div",mT,[d("p",vT,R(s.value.label),1),d("p",yT,R(S.value.message),1),d("button",{class:"fv-retry",onClick:j},"重试")])):o.value==="diff"?(g(),m(ee,{key:2},[P.value.length>0?(g(),m("div",bT,[J(Er,{lines:P.value},null,8,["lines"])])):(g(),m("div",kT,"该文件没有未提交的改动。"))],64)):o.value==="preview"?(g(),m(ee,{key:3},[i.value==="image"?(g(),m("div",wT,[d("img",{src:r.value,alt:s.value.label},null,8,_T)])):i.value==="audio"?(g(),m("div",ST,[d("audio",{class:"fv-audio",controls:"",src:r.value},null,8,$T)])):i.value==="pdf"?(g(),m("div",xT,[d("iframe",{class:"fv-pdf-frame",src:r.value,title:s.value.label},null,8,CT)])):i.value==="markdown"?(g(),m("div",TT,[J(tf,{content:$.value},null,8,["content"])])):(g(),m("div",IT,[T[1]||(T[1]=d("p",{class:"fv-note"},"该类型暂不支持预览,显示源码内容。",-1)),J(Gl,{code:$.value,lang:W(vc)(s.value.filePath)},null,8,["code","lang"])]))],64)):(g(),m("div",RT,[M.value?(g(),m("p",AT,"文件较大,仅显示前 256KB。")):U("",!0),J(Gl,{code:$.value,lang:W(vc)(s.value.filePath)},null,8,["code","lang"])]))])])):(g(),m("div",ET,"从工具卡片、文件浏览或消息中选择文件打开"))}}),PT=Ie(MT,[["__scopeId","data-v-7756f288"]]),LT={class:"settings"},OT={class:"settings-layout"},DT={class:"rail","aria-label":"设置分区"},NT=["aria-current","onClick"],BT={class:"pane"},FT={key:0,class:"pane-section"},jT={class:"block"},UT={class:"theme-grid",role:"radiogroup","aria-label":"主题"},GT=["aria-checked","onClick"],zT={class:"block"},HT={class:"like-fields"},WT={class:"like-label"},qT=["onUpdate:modelValue","placeholder","aria-label"],VT={class:"like-actions"},KT={key:0,class:"saved-hint"},YT={key:1,class:"pane-section"},ZT={key:0,class:"empty"},JT={key:1,class:"list"},XT={class:"row-main"},QT={class:"row-title"},e2={class:"row-sub"},t2=["disabled","onClick"],n2={key:2,class:"pane-section"},s2={key:0,class:"empty"},o2={key:1,class:"list"},i2={class:"row-main"},l2={class:"row-title"},r2={class:"row-sub"},a2={class:"row-actions"},c2=["disabled","onClick"],u2=["disabled","onClick"],d2={key:3,class:"pane-section"},f2={class:"block"},h2={class:"inline-form"},p2={key:0,class:"hint"},g2={key:0,class:"empty"},m2={key:1,class:"list"},v2={class:"row-main"},y2={class:"row-title"},b2={key:0,class:"version"},k2={class:"row-sub"},w2=["disabled","onClick"],_2={key:4,class:"pane-section"},S2={key:0,class:"hint"},$2={key:1,class:"empty"},x2={key:2,class:"list"},C2={class:"row-main"},T2={class:"row-title"},I2={class:"row-sub"},R2={class:"row-actions"},A2=["disabled","onClick"],E2=["disabled","onClick"],M2=["disabled","onClick"],P2={key:5,class:"pane-section"},L2={key:0,class:"hint"},O2={key:1,class:"empty"},D2={key:2,class:"list"},N2={class:"row-main"},B2={class:"row-title"},F2={class:"row-sub"},j2={class:"row-actions"},U2=["disabled","onClick"],G2=["disabled","onClick"],z2=Te({__name:"SettingsView",props:{like:{default:()=>({})},client:{}},emits:["update-like"],setup(e,{emit:t}){const n=e,s=t;function o(Y){return Y!==null&&typeof Y=="object"&&Y.__v_isRef===!0?Y.value:Y}const i=[{id:"general",label:"通用",icon:"settings"},{id:"models",label:"模型",icon:"bot"},{id:"skills",label:"技能",icon:"sparkles"},{id:"plugins",label:"插件",icon:"layers"},{id:"mcp",label:"MCP 服务器",icon:"monitor"},{id:"tasks",label:"后台任务",icon:"activity"}],l=F("general"),r=q(()=>n.client),a=vn("theme",F("system")),c=vn("setTheme",()=>{}),u=[{id:"light",label:"浅色",icon:"sun"},{id:"dark",label:"深色",icon:"moon"},{id:"system",label:"跟随系统",icon:"monitor"}],f=F({...n.like}),h=F(!1);Me(()=>n.like,Y=>{f.value={...Y}});const p=[{key:"nickname",label:"称呼",hint:"AI 如何称呼你"},{key:"tone",label:"语气",hint:"回复的语气风格"},{key:"other",label:"偏好",hint:"其他偏好说明"},{key:"doNot",label:"禁止事项",hint:"明确禁止的行为"}];function v(){s("update-like",k()),h.value=!0,setTimeout(()=>h.value=!1,1500)}function k(){const Y={};for(const ae of p){const V=f.value[ae.key];typeof V=="string"&&V.trim()&&(Y[ae.key]=V.trim())}return Y}const w=q(()=>{var Y;return o((Y=r.value)==null?void 0:Y.models)??[]}),S=q(()=>{var Y,ae;return((ae=o((Y=r.value)==null?void 0:Y.status))==null?void 0:ae.model)??""});function $(Y){var ae,V;(V=(ae=r.value)==null?void 0:ae.switchModel)==null||V.call(ae,Y)}const M=q(()=>{var Y;return o((Y=r.value)==null?void 0:Y.skills)??[]}),P=F(!1);async function Z(Y){var ae,V,ve,Oe;P.value=!0;try{await((V=(ae=r.value)==null?void 0:ae.activateSkill)==null?void 0:V.call(ae,Y))&&await((Oe=(ve=r.value)==null?void 0:ve.fetchSkills)==null?void 0:Oe.call(ve))}finally{P.value=!1}}async function j(Y){var V,ve,Oe,Ue;if(!window.confirm(`移除技能「${Y}」?`))return;await((ve=(V=r.value)==null?void 0:V.removeSkill)==null?void 0:ve.call(V,Y))&&await((Ue=(Oe=r.value)==null?void 0:Oe.fetchSkills)==null?void 0:Ue.call(Oe))}const C=q(()=>{var Y;return o((Y=r.value)==null?void 0:Y.plugins)??[]}),x=F(!1);async function y(Y,ae){var V,ve,Oe,Ue;x.value=!0;try{await((ve=(V=r.value)==null?void 0:V.setPluginEnabled)==null?void 0:ve.call(V,Y,ae))&&await((Ue=(Oe=r.value)==null?void 0:Oe.fetchPlugins)==null?void 0:Ue.call(Oe))}finally{x.value=!1}}const T=F(""),O=F(!1),I=F("");async function H(){var ae,V;const Y=T.value.trim();if(Y){O.value=!0,I.value="";try{const ve=await((V=(ae=r.value)==null?void 0:ae.installPlugin)==null?void 0:V.call(ae,Y));I.value=ve?`已安装 ${ve.displayName}`:"安装失败",ve&&(T.value="")}finally{O.value=!1}}}const L=q(()=>{var Y;return o((Y=r.value)==null?void 0:Y.mcpServers)??[]}),B=F(!1),ne=F("");async function ie(Y,ae){var V,ve,Oe,Ue;B.value=!0,ne.value="";try{const Pe=await((ve=(V=r.value)==null?void 0:V[Y])==null?void 0:ve.call(V,ae));ne.value=Pe?"操作成功":"操作失败",await((Ue=(Oe=r.value)==null?void 0:Oe.fetchMcpServers)==null?void 0:Ue.call(Oe))}finally{B.value=!1}}const _e=q(()=>{var Y;return o((Y=r.value)==null?void 0:Y.backgroundTasks)??[]}),Se=F(""),je=F(!1),Qe=F("");async function ge(Y){var ae,V,ve,Oe;je.value=!0,Qe.value="";try{const Ue=await((V=(ae=r.value)==null?void 0:ae.stopBackgroundTask)==null?void 0:V.call(ae,Y));Qe.value=Ue?"已停止":"取消失败",await((Oe=(ve=r.value)==null?void 0:ve.fetchBackgroundTasks)==null?void 0:Oe.call(ve))}finally{je.value=!1}}async function he(Y){var ae,V,ve;je.value=!0,Qe.value="";try{await((V=(ae=r.value)==null?void 0:ae.fetchBackgroundTaskOutput)==null?void 0:V.call(ae,Y,200)),Se.value=o((ve=r.value)==null?void 0:ve.backgroundTaskOutput)??""}finally{je.value=!1}}ct(()=>{var ae,V,ve,Oe,Ue,Pe;const Y=r.value;(ae=Y==null?void 0:Y.fetchModels)==null||ae.call(Y),(V=Y==null?void 0:Y.fetchConfig)==null||V.call(Y),(ve=Y==null?void 0:Y.fetchSkills)==null||ve.call(Y),(Oe=Y==null?void 0:Y.fetchPlugins)==null||Oe.call(Y),(Ue=Y==null?void 0:Y.fetchMcpServers)==null||Ue.call(Y),(Pe=Y==null?void 0:Y.fetchBackgroundTasks)==null||Pe.call(Y)});function Fe(Y){return Y==="connected"||Y==="completed"?"ok":Y==="failed"||Y==="killed"?"bad":Y==="running"||Y==="pending"?"run":"muted"}return(Y,ae)=>(g(),m("div",LT,[d("div",OT,[d("nav",DT,[(g(),m(ee,null,Ee(i,V=>d("button",{key:V.id,class:fe(["rail-tab",{active:l.value===V.id}]),"aria-current":l.value===V.id?"page":void 0,onClick:ve=>l.value=V.id},[J(me,{name:V.icon,size:16},null,8,["name"]),d("span",null,R(V.label),1)],10,NT)),64))]),d("div",BT,[l.value==="general"?(g(),m("section",FT,[ae[4]||(ae[4]=d("h1",{class:"settings-title"},"通用设置",-1)),d("div",jT,[ae[1]||(ae[1]=d("h2",{class:"block-title"},"外观",-1)),d("div",UT,[(g(),m(ee,null,Ee(u,V=>d("button",{key:V.id,role:"radio","aria-checked":W(a)===V.id,class:fe(["theme-option",{active:W(a)===V.id}]),onClick:ve=>W(c)(V.id)},[J(me,{name:V.icon,size:20},null,8,["name"]),d("span",null,R(V.label),1)],10,GT)),64))])]),d("div",zT,[ae[3]||(ae[3]=d("h2",{class:"block-title"},"偏好设置",-1)),d("div",HT,[(g(),m(ee,null,Ee(p,V=>d("label",{key:V.key,class:"like-field"},[d("span",WT,R(V.label),1),it(d("input",{"onUpdate:modelValue":ve=>f.value[V.key]=ve,class:"like-input",placeholder:V.hint,"aria-label":V.label},null,8,qT),[[ut,f.value[V.key]]])])),64)),d("div",VT,[J(zn,{variant:"primary",onClick:v},{default:Pt(()=>[...ae[2]||(ae[2]=[Ce("保存偏好",-1)])]),_:1}),h.value?(g(),m("span",KT,"已保存")):U("",!0)])])])])):l.value==="models"?(g(),m("section",YT,[ae[5]||(ae[5]=d("h1",{class:"settings-title"},"模型",-1)),w.value.length===0?(g(),m("p",ZT,"没有可用的模型")):(g(),m("ul",JT,[(g(!0),m(ee,null,Ee(w.value,V=>(g(),m("li",{key:V.alias,class:fe(["list-row",{selected:V.alias===S.value}])},[d("div",XT,[d("span",QT,R(V.displayName||V.model),1),d("span",e2,R(V.provider)+" · "+R(V.alias)+" · "+R(V.maxContextSize),1)]),d("button",{class:"row-action",disabled:V.alias===S.value,onClick:ve=>$(V.alias)},R(V.alias===S.value?"使用中":"切换"),9,t2)],2))),128))]))])):l.value==="skills"?(g(),m("section",n2,[ae[6]||(ae[6]=d("h1",{class:"settings-title"},"技能",-1)),M.value.length===0?(g(),m("p",s2,"当前会话没有可用技能")):(g(),m("ul",o2,[(g(!0),m(ee,null,Ee(M.value,V=>(g(),m("li",{key:V.name,class:"list-row"},[d("div",i2,[d("span",l2,R(V.name),1),d("span",r2,[Ce(R(V.description||"—")+" ",1),V.pluginId?(g(),m(ee,{key:0},[Ce("· 来自插件 "+R(V.pluginId),1)],64)):U("",!0)])]),d("div",a2,[d("button",{class:"row-action",disabled:P.value,onClick:ve=>Z(V.name)}," 激活 ",8,c2),d("button",{class:"row-action danger",disabled:P.value,onClick:ve=>j(V.name)}," 移除 ",8,u2)])]))),128))]))])):l.value==="plugins"?(g(),m("section",d2,[ae[9]||(ae[9]=d("h1",{class:"settings-title"},"插件",-1)),d("div",f2,[ae[8]||(ae[8]=d("h2",{class:"block-title"},"安装插件",-1)),d("div",h2,[it(d("input",{"onUpdate:modelValue":ae[0]||(ae[0]=V=>T.value=V),class:"like-input",placeholder:"本地路径 / zip URL / GitHub 地址","aria-label":"插件来源",spellcheck:"false"},null,512),[[ut,T.value]]),J(zn,{variant:"primary",disabled:O.value||!T.value.trim(),onClick:H},{default:Pt(()=>[...ae[7]||(ae[7]=[Ce(" 安装 ",-1)])]),_:1},8,["disabled"])]),I.value?(g(),m("p",p2,R(I.value),1)):U("",!0)]),C.value.length===0?(g(),m("p",g2,"还没有安装插件")):(g(),m("ul",m2,[(g(!0),m(ee,null,Ee(C.value,V=>(g(),m("li",{key:V.id,class:"list-row"},[d("div",v2,[d("span",y2,[Ce(R(V.displayName)+" ",1),V.version?(g(),m("span",b2,"v"+R(V.version),1)):U("",!0)]),d("span",k2,R(V.skillCount)+" 技能 · "+R(V.enabledMcpServerCount)+"/"+R(V.mcpServerCount)+" MCP",1)]),d("button",{class:"row-action",disabled:x.value,onClick:ve=>y(V.id,!V.enabled)},R(V.enabled?"停用":"启用"),9,w2)]))),128))]))])):l.value==="mcp"?(g(),m("section",_2,[ae[10]||(ae[10]=d("h1",{class:"settings-title"},"MCP 服务器",-1)),ne.value?(g(),m("p",S2,R(ne.value),1)):U("",!0),L.value.length===0?(g(),m("p",$2,"没有配置 MCP 服务器")):(g(),m("ul",x2,[(g(!0),m(ee,null,Ee(L.value,V=>(g(),m("li",{key:V.name,class:"list-row"},[d("div",C2,[d("span",T2,R(V.name),1),d("span",I2,R(V.transport)+" · "+R(V.toolCount)+" 工具",1),d("span",{class:fe(["status-pill",Fe(V.status)])},R(V.status),3)]),d("div",R2,[d("button",{class:"row-action",disabled:B.value,onClick:ve=>ie("reconnectMcpServer",V.name)},"重连",8,A2),d("button",{class:"row-action",disabled:B.value,onClick:ve=>ie("stopMcpServer",V.name)},"停止",8,E2),d("button",{class:"row-action danger",disabled:B.value,onClick:ve=>ie("removeMcpServer",V.name)},"移除",8,M2)])]))),128))]))])):l.value==="tasks"?(g(),m("section",P2,[ae[11]||(ae[11]=d("h1",{class:"settings-title"},"后台任务",-1)),Qe.value?(g(),m("p",L2,R(Qe.value),1)):U("",!0),_e.value.length===0?(g(),m("p",O2,"没有后台任务")):(g(),m("ul",D2,[(g(!0),m(ee,null,Ee(_e.value,V=>(g(),m("li",{key:V.taskId,class:"list-row"},[d("div",N2,[d("span",B2,R(V.command),1),d("span",F2,R(V.description),1),d("span",{class:fe(["status-pill",Fe(V.status)])},R(V.status),3)]),d("div",j2,[d("button",{class:"row-action",disabled:je.value,onClick:ve=>he(V.taskId)},"输出",8,U2),V.status==="running"||V.status==="awaiting_approval"?(g(),m("button",{key:0,class:"row-action danger",disabled:je.value,onClick:ve=>ge(V.taskId)}," 停止 ",8,G2)):U("",!0)])]))),128))]))])):U("",!0)])])]))}}),H2=Ie(z2,[["__scopeId","data-v-76c28b05"]]),yc=F(""),al=F(new Set),W2=F("sessions");function q2(){function e(n){const s=new Set(al.value);s.has(n)?s.delete(n):s.add(n),al.value=s}function t(){yc.value=""}return{query:yc,collapsedSpaces:al,section:W2,toggleSpace:e,clearSearch:t}}const lf="scream-file-tree-expanded",V2=F("");function K2(){try{const e=localStorage.getItem(lf);if(!e)return{};const t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t)){const n={};for(const[s,o]of Object.entries(t))Array.isArray(o)&&(n[s]=o.filter(i=>typeof i=="string"));return n}return{}}catch{return{}}}const Bn=F(K2()),Is=An(new Map),cl=F(null),ul=new Map;function Y2(){function e(a){return a?new Set(Bn.value[a]??[]):new Set}function t(a){if(!a)return;const c={...Bn.value};c[a]=[...e(a)],Bn.value=c;try{localStorage.setItem(lf,JSON.stringify(c))}catch{}}function n(a){cl.value!==a&&(cl.value=a)}function s(a,c){var u;return a?((u=Bn.value[a])==null?void 0:u.includes(c))??!1:!1}function o(a,c){if(!a)return!1;const u=Bn.value[a]??[],f=u.includes(c)?u.filter(h=>h!==c):[...u,c];return Bn.value={...Bn.value,[a]:f},t(a),!u.includes(c)}function i(a){return Is.get(a)??[]}async function l(a){const c=(ul.get(a)??0)+1;ul.set(a,c);const u=await td(a);return c!==(ul.get(a)??0)?Is.get(a)??[]:(u!==null&&Is.set(a,u),Is.get(a)??[])}function r(a){Is.delete(a)}return{activeWorkDir:cl,query:V2,isExpanded:s,toggleExpand:o,loadedChildren:i,loadChildren:l,invalidate:r,setRoot:n}}const Z2={class:"file-tree"},J2={key:0,class:"tree-toolbar"},X2={class:"tree-search"},Q2={key:1,class:"tree-empty"},eI={key:2,class:"tree-empty"},tI={key:3,class:"tree-empty"},nI={key:4,class:"tree-empty"},sI=["aria-label"],oI=["aria-expanded","onClick"],iI=["title"],lI=["aria-expanded","onClick"],rI=["title"],aI=Te({__name:"FileTree",props:{workDir:{},gitStatus:{},refreshGit:{type:Function}},setup(e){const t=e,{query:n,isExpanded:s,toggleExpand:o,loadedChildren:i,loadChildren:l,invalidate:r,setRoot:a}=Y2(),c=F(!1),u=F(!1);Me(()=>t.workDir,j=>{a(j),j&&f(j)},{immediate:!0});async function f(j){c.value=!0,u.value=!1;try{(await l(j)).length===0&&(u.value=!0)}finally{c.value=!1}}async function h(j){const C=t.workDir;if(!C)return;o(C,j)&&await l(j)}function p(j,C){return`${j.replace(/\/+$/,"")}/${C}`}function v(j){const C=t.workDir;if(!C)return j;const x=C.replace(/\/+$/,"");return j===x?"":j.startsWith(`${x}/`)?j.slice(x.length+1):j}function k(j){var T;const C=(T=t.gitStatus)==null?void 0:T.files;if(!C||C.length===0)return null;const x=v(j),y=C.find(O=>(O.displayPath??O.path)===x);return y?y.status.includes("?")?"?":y.status.includes("A")?"A":y.status.includes("M")?"M":null:null}const w=q(()=>{const j=t.workDir;if(!j)return[];const C=[],x=(y,T)=>{for(const O of i(y)){const I=p(y,O.name);C.push({abs:I,name:O.name,rel:v(I),isDir:O.type==="dir",depth:T,git:k(I)}),O.type==="dir"&&s(j,I)&&x(I,T+1)}};return x(j,0),C}),S=q(()=>w.value),$=q(()=>{const j=n.value.trim();if(!j)return[];const C=new Map(S.value.map(x=>[x.rel,x]));return ed(S.value.map(x=>({path:x.rel,isDir:x.isDir})),j,50).map(x=>C.get(x.path)).filter(x=>x!==void 0)}),M=q(()=>n.value.trim().length>0);function P(j){j.isDir?h(j.abs):Zn(j.abs)}function Z(){var C;const j=t.workDir;j&&(r(j),jm(j),f(j),(C=t.refreshGit)==null||C.call(t))}return(j,C)=>(g(),m("div",Z2,[e.workDir?(g(),m("div",J2,[d("label",X2,[J(me,{name:"search",size:13}),it(d("input",{"onUpdate:modelValue":C[0]||(C[0]=x=>ht(n)?n.value=x:null),type:"text",placeholder:"过滤文件…","aria-label":"过滤文件",spellcheck:"false"},null,512),[[ut,W(n)]])]),d("button",{class:"tree-refresh",title:"刷新文件树与 Git 状态","aria-label":"刷新文件树与 Git 状态",onClick:Z},[J(me,{name:"refresh",size:13})])])):U("",!0),e.workDir?c.value&&w.value.length===0?(g(),m("div",eI,"加载中…")):u.value&&w.value.length===0?(g(),m("div",tI,"工作目录为空")):M.value&&$.value.length===0?(g(),m("div",nI,"没有匹配的文件")):(g(),m("div",{key:5,class:"tree-scroll",role:"tree","aria-label":"文件树 "+e.workDir},[M.value?(g(!0),m(ee,{key:0},Ee($.value,x=>(g(),m("button",{key:x.abs,class:fe(["tree-row",{"is-dir":x.isDir}]),role:"treeitem","aria-expanded":x.isDir?W(s)(e.workDir,x.abs):void 0,onClick:y=>P(x)},[J(me,{name:x.isDir?"folder":"file",size:14,class:"row-icon"},null,8,["name"]),d("span",{class:"row-label mono",title:x.rel},R(x.rel),9,iI),x.git?(g(),m("span",{key:0,class:fe(["row-git",`g-${x.git}`])},R(x.git),3)):U("",!0)],10,oI))),128)):(g(!0),m(ee,{key:1},Ee(w.value,x=>(g(),m("button",{key:x.abs,class:fe(["tree-row",{"is-dir":x.isDir}]),style:Nt({paddingLeft:`${8+x.depth*14}px`}),role:"treeitem","aria-expanded":x.isDir?W(s)(e.workDir,x.abs):void 0,onClick:y=>P(x)},[J(me,{name:x.isDir?W(s)(e.workDir,x.abs)?"chevron-down":"chevron-right":"file",size:13,class:"row-caret"},null,8,["name"]),J(me,{name:x.isDir?"folder":"file",size:14,class:"row-icon"},null,8,["name"]),d("span",{class:fe(["row-label",{mono:!x.isDir}]),title:x.rel},R(x.name),11,rI),x.git?(g(),m("span",{key:0,class:fe(["row-git",`g-${x.git}`])},R(x.git),3)):U("",!0)],14,lI))),128))],8,sI)):(g(),m("div",Q2,"当前会话没有工作目录"))]))}}),cI=Ie(aI,[["__scopeId","data-v-78dceb03"]]),rf=""+new URL("logo-v2-ChmPAIbI.svg",import.meta.url).href,uI={class:"sidebar-head"},dI=["src"],fI=["title","aria-label","aria-expanded"],hI=["title"],pI={key:0},gI={key:0,class:"section-switch",role:"tablist","aria-label":"侧栏分区"},mI=["aria-selected"],vI=["aria-selected"],yI={key:0,class:"side-search"},bI={class:"spaces"},kI=["title"],wI=["title","onClick"],_I={class:"space-name"},SI={class:"space-count"},$I={key:0,class:"space-sessions"},xI=["title","onClick","onDblclick"],CI={key:0,class:"session-run","aria-hidden":"true"},TI={class:"session-text"},II={key:0,class:"session-rename"},RI=["aria-label","onKeydown","onBlur"],AI={class:"session-title"},EI={class:"session-meta"},MI=["title","onClick","onKeydown"],PI={key:0,class:"spaces-empty"},LI={class:"sidebar-foot","aria-label":"功能区"},OI=["title"],DI={key:0},NI=["title"],BI={key:0},FI={class:"sidebar-identity"},jI={key:0,class:"identity-text"},UI=Te({__name:"Sidebar",props:{view:{},sessions:{},currentSessionId:{default:null},workDir:{default:null},gitStatus:{default:null},refreshGit:{type:Function,default:void 0},collapsed:{type:Boolean,default:!1},showCollapseToggle:{type:Boolean,default:!0}},emits:["navigate","switch-session","delete-session","create-session","toggle-collapse","open-file","rename-session"],setup(e,{expose:t,emit:n}){const s=e,o=n,i=F(null),{query:l,collapsedSpaces:r,section:a,toggleSpace:c}=q2();function u(){var x,y;(x=i.value)==null||x.focus(),(y=i.value)==null||y.select()}t({focusSearch:u});const f=q(()=>{const x=l.value.trim().toLowerCase();return x?s.sessions.filter(y=>C(y).toLowerCase().includes(x)||y.workDir.toLowerCase().includes(x)):s.sessions}),h=q(()=>{var T;const x=new Map;for(const O of f.value){const I=O.workDir||"默认空间",H=I.split(/[\\/]/).filter(Boolean),L=H.length>0?H[H.length-1]:I,B=x.get(I);B?B.items.push(O):x.set(I,{key:I,name:L,items:[O]})}const y=(T=s.sessions.find(O=>O.sessionId===s.currentSessionId))==null?void 0:T.workDir;return[...x.values()].sort((O,I)=>{var H,L;return O.key===y?-1:I.key===y?1:(((H=I.items[0])==null?void 0:H.createdAt)??0)-(((L=O.items[0])==null?void 0:L.createdAt)??0)})});function p(x){o("switch-session",x)}function v(x,y){window.confirm(`删除会话「${y}」?此操作不可恢复。`)&&o("delete-session",x)}function k(x){o("open-file",x)}const w=F(null),S=F(null),$=F("");function M(x){S.value=x.sessionId,$.value=C(x),ft(()=>{var y,T;(y=w.value)==null||y.focus(),(T=w.value)==null||T.select()})}function P(){S.value=null,$.value=""}function Z(x){const y=$.value.trim();if(S.value=null,$.value="",!y)return;const T=s.sessions.find(O=>O.sessionId===x);!T||y===C(T)||o("rename-session",x,y)}function j(x){if(!x)return"";const y=Date.now()-x;if(y<6e4)return"刚刚";if(y<36e5)return`${Math.floor(y/6e4)} 分钟前`;if(y<864e5)return`${Math.floor(y/36e5)} 小时前`;const T=new Date(x);return`${T.getMonth()+1}/${T.getDate()}`}function C(x){const y=(x.title||"").trim();return y&&y!=="新会话"&&y!=="New Session"?y:"未命名会话"}return(x,y)=>(g(),m("aside",{class:fe(["sidebar",{"is-collapsed":e.collapsed}])},[d("div",uI,[d("button",{class:"sidebar-brand",title:"回到新对话",onClick:y[0]||(y[0]=T=>o("navigate","home"))},[d("img",{class:"brand-logo",src:W(rf),alt:"scream"},null,8,dI)]),e.showCollapseToggle?(g(),m("button",{key:0,class:fe(["collapse-btn",{rotated:e.collapsed}]),title:e.collapsed?"展开侧栏":"折叠侧栏","aria-label":e.collapsed?"展开侧栏":"折叠侧栏","aria-expanded":!e.collapsed,onClick:y[1]||(y[1]=T=>o("toggle-collapse"))},[J(me,{name:"panel-left",size:15})],10,fI)):U("",!0)]),d("button",{class:"new-chat-btn",title:e.collapsed?"新建对话":void 0,onClick:y[2]||(y[2]=T=>o("create-session"))},[J(me,{name:"plus",size:16}),e.collapsed?U("",!0):(g(),m("span",pI,"新建对话"))],8,hI),e.collapsed?U("",!0):(g(),m("div",gI,[d("button",{class:fe(["section-tab",{active:W(a)==="sessions"}]),role:"tab","aria-selected":W(a)==="sessions",onClick:y[3]||(y[3]=T=>a.value="sessions")},[J(me,{name:"message-circle",size:13}),y[12]||(y[12]=d("span",null,"会话",-1))],10,mI),d("button",{class:fe(["section-tab",{active:W(a)==="files"}]),role:"tab","aria-selected":W(a)==="files",onClick:y[4]||(y[4]=T=>a.value="files")},[J(me,{name:"folder",size:13}),y[13]||(y[13]=d("span",null,"文件",-1))],10,vI)])),!e.collapsed&&W(a)==="files"?(g(),Xe(cI,{key:1,"work-dir":e.workDir,"git-status":e.gitStatus,"refresh-git":e.refreshGit,onOpenFile:k},null,8,["work-dir","git-status","refresh-git"])):U("",!0),e.collapsed||W(a)==="sessions"?(g(),m(ee,{key:2},[e.collapsed?U("",!0):(g(),m("label",yI,[J(me,{name:"search",size:15}),it(d("input",{ref_key:"searchRef",ref:i,"onUpdate:modelValue":y[5]||(y[5]=T=>ht(l)?l.value=T:null),type:"text",placeholder:"搜索会话… (⌘K)","aria-label":"搜索会话",spellcheck:"false"},null,512),[[ut,W(l)]])])),d("div",bI,[(g(!0),m(ee,null,Ee(h.value,T=>(g(),m("div",{key:T.key,class:"space-group"},[e.collapsed?(g(),m("button",{key:0,class:fe(["space-dot",{active:T.items.some(O=>O.sessionId===e.currentSessionId)}]),title:T.name,onClick:y[6]||(y[6]=O=>o("toggle-collapse"))},R(T.name.slice(0,1).toUpperCase()),11,kI)):(g(),m(ee,{key:1},[d("button",{class:"space-head",title:T.key,onClick:O=>W(c)(T.key)},[J(me,{name:W(r).has(T.key)?"chevron-right":"chevron-down",size:14},null,8,["name"]),d("span",_I,R(T.name),1),d("span",SI,R(T.items.length),1)],8,wI),W(r).has(T.key)?U("",!0):(g(),m("div",$I,[(g(!0),m(ee,null,Ee(T.items,O=>(g(),m("div",{key:O.sessionId,class:"session-item-wrap"},[d("button",{class:fe(["session-item",{active:O.sessionId===e.currentSessionId}]),title:C(O),onClick:I=>p(O.sessionId),onDblclick:I=>M(O)},[O.active?(g(),m("span",CI)):U("",!0),d("span",TI,[S.value===O.sessionId?(g(),m("span",II,[it(d("input",{ref_for:!0,ref_key:"renameInputRef",ref:w,"onUpdate:modelValue":y[7]||(y[7]=I=>$.value=I),class:"rename-input",spellcheck:"false","aria-label":`重命名会话 ${C(O)}`,onClick:y[8]||(y[8]=rt(()=>{},["stop"])),onKeydown:[Vn(rt(I=>Z(O.sessionId),["prevent"]),["enter"]),y[9]||(y[9]=Vn(rt(I=>P(),["prevent"]),["esc"]))],onBlur:I=>Z(O.sessionId)},null,40,RI),[[ut,$.value]])])):(g(),m(ee,{key:1},[d("span",AI,R(C(O)),1),d("span",EI,[d("span",null,R(j(O.createdAt)),1),y[14]||(y[14]=d("span",{class:"meta-sep","aria-hidden":"true"},"·",-1)),d("span",null,R(O.messageCount)+" 条",1)])],64))]),d("span",{class:"session-delete",role:"button",tabindex:"0",title:`删除会话 ${C(O)}`,"aria-label":"删除会话",onClick:rt(I=>v(O.sessionId,C(O)),["stop"]),onKeydown:Vn(rt(I=>v(O.sessionId,C(O)),["stop","prevent"]),["enter"])},[J(me,{name:"trash",size:14})],40,MI)],42,xI)]))),128))]))],64))]))),128)),!e.collapsed&&h.value.length===0?(g(),m("p",PI,R(W(l)?"没有匹配的会话":"还没有会话,点击上方「新建对话」开始"),1)):U("",!0)])],64)):U("",!0),d("nav",LI,[d("button",{class:fe(["foot-item",{active:e.view==="skills"}]),title:e.collapsed?"技能中心":void 0,onClick:y[10]||(y[10]=T=>o("navigate","skills"))},[J(me,{name:"sparkles",size:17}),e.collapsed?U("",!0):(g(),m("span",DI,"技能中心"))],10,OI),d("button",{class:fe(["foot-item",{active:e.view==="settings"}]),title:e.collapsed?"设置":void 0,onClick:y[11]||(y[11]=T=>o("navigate","settings"))},[J(me,{name:"settings",size:17}),e.collapsed?U("",!0):(g(),m("span",BI,"设置"))],10,NI),d("div",FI,[y[15]||(y[15]=d("span",{class:"identity-dot","aria-hidden":"true"},null,-1)),e.collapsed?U("",!0):(g(),m("span",jI,"scream web"))])])],2))}}),bc=Ie(UI,[["__scopeId","data-v-b028f75e"]]),GI={class:"skills"},zI={class:"skills-head"},HI={class:"skills-grid"},WI={class:"skill-card-head"},qI={class:"skill-cmd"},VI={class:"skill-desc"},KI={key:0,class:"skill-aliases"},YI=Te({__name:"SkillsView",emits:["create"],setup(e,{emit:t}){const n=t,s={backend:"服务端",local:"本地"};return(o,i)=>(g(),m("div",GI,[d("div",zI,[i[2]||(i[2]=d("div",null,[d("h1",{class:"skills-title"},"技能中心"),d("p",{class:"skills-sub"},[Ce("在输入框中输入 "),d("code",null,"/"),Ce(" 即可触发以下命令")])],-1)),J(zn,{variant:"primary",onClick:i[0]||(i[0]=l=>n("create"))},{default:Pt(()=>[J(me,{name:"plus",size:16}),i[1]||(i[1]=Ce(" 新建会话 ",-1))]),_:1})]),d("div",HI,[(g(!0),m(ee,null,Ee(W(Si),l=>{var r;return g(),m("article",{key:l.name,class:"skill-card"},[d("div",WI,[d("span",qI,"/"+R(l.name),1),d("span",{class:fe(["skill-target",`target-${l.target}`])},R(s[l.target]),3)]),d("p",VI,R(l.description),1),(r=l.aliases)!=null&&r.length?(g(),m("p",KI," 别名:"+R(l.aliases.map(a=>`/${a}`).join(" ")),1)):U("",!0)])}),128))])]))}}),ZI=Ie(YI,[["__scopeId","data-v-35313e25"]]),JI=["aria-selected","title","onClick","onAuxclick"],XI={class:"tab-label"},QI=["title","aria-label","onClick"],eR=Te({__name:"TabBar",setup(e){const t=F(null);Me(()=>$e.activeTabId,async()=>{var o;await ft();const s=(o=t.value)==null?void 0:o.querySelector(".tab-button.active");s==null||s.scrollIntoView({block:"nearest",inline:"nearest"})},{immediate:!0});function n(s,o){s.button===1&&(s.preventDefault(),s.stopPropagation(),Oa(o))}return(s,o)=>W($e).tabs.length>0?(g(),m("div",{key:0,ref_key:"barRef",ref:t,class:"tab-bar",role:"tablist","aria-label":"文件标签"},[(g(!0),m(ee,null,Ee(W($e).tabs,i=>(g(),m("div",{key:i.id,class:fe(["tab-button",{active:i.id===W($e).activeTabId}]),role:"tab","aria-selected":i.id===W($e).activeTabId,title:i.filePath,onClick:l=>W(ym)(i.id),onMousedown:o[0]||(o[0]=l=>{l.button===1&&l.preventDefault()}),onAuxclick:l=>n(l,i.id)},[J(me,{name:"file",size:13,class:"tab-icon"}),d("span",XI,R(i.label),1),d("button",{class:"tab-close",title:`关闭 ${i.label}`,"aria-label":`关闭 ${i.label}`,onClick:rt(l=>W(Oa)(i.id),["stop"])},[J(me,{name:"x",size:11})],8,QI)],42,JI))),128))],512)):U("",!0)}}),tR=Ie(eR,[["__scopeId","data-v-cad2e90f"]]),nR={class:"mode-switch",role:"group","aria-label":"工作模式"},sR=["aria-pressed","onClick"],oR=Te({__name:"ModeSwitch",props:{modelValue:{default:"chat"}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t,s=[{id:"chat",label:"智能工作"},{id:"goal",label:"任务模式"}];return(o,i)=>(g(),m("div",nR,[(g(),m(ee,null,Ee(s,l=>d("button",{key:l.id,class:fe(["mode-pill",`is-${l.id}`,{active:e.modelValue===l.id}]),"aria-pressed":e.modelValue===l.id,onClick:r=>n("update:modelValue",l.id)},R(l.label),11,sR)),64))]))}}),iR=Ie(oR,[["__scopeId","data-v-c4ac7862"]]),lR={class:"workspace"},rR={class:"workspace-hero"},aR={class:"workspace-brand"},cR=["src"],uR={class:"mode-hint"},dR={class:"workspace-composer"},fR=Te({__name:"WorkspaceHome",props:{models:{},status:{default:void 0},busy:{type:Boolean},mode:{default:"chat"}},emits:["send","command","switch-model","switch-thinking","update:mode"],setup(e,{emit:t}){const n=e,s=t,o=q(()=>n.mode==="goal"),i=q(()=>o.value?"任务模式:提交后将创建执行目标(Goal),Agent 持续执行到完成或预算耗尽;抽屉「Goal 管理」可查看与暂停。":"直接对话:提问后 Agent 按需调用工具完成你的请求。");return(l,r)=>(g(),m("div",lR,[d("section",rR,[d("h1",aR,[d("img",{class:"brand-logo",src:W(rf),alt:"scream"},null,8,cR)]),r[5]||(r[5]=d("p",{class:"workspace-tagline"},"你的智能协作伙伴",-1)),J(iR,{class:"workspace-mode","model-value":n.mode,"onUpdate:modelValue":r[0]||(r[0]=a=>s("update:mode",a))},null,8,["model-value"]),d("p",uR,[(g(),m("span",{key:String(o.value),class:"hint-fade"},R(i.value),1))])]),d("section",dR,[J(od,{busy:e.busy,status:e.status,models:e.models,variant:"home",placeholder:o.value?"描述你要完成的目标,Enter 创建并开始执行…":"输入 @ 引用知识库 / 使用技能 / 或者直接提问...",onSend:r[1]||(r[1]=a=>s("send",a,n.mode)),onCommand:r[2]||(r[2]=(a,c)=>s("command",a,c)),onSwitchModel:r[3]||(r[3]=a=>s("switch-model",a)),onSwitchThinking:r[4]||(r[4]=a=>s("switch-thinking",a))},null,8,["busy","status","models","placeholder"])])]))}}),hR=Ie(fR,[["__scopeId","data-v-2f5f04ab"]]),pR=["aria-valuenow"],gR={key:2,class:"sidebar-mobile"},mR={class:"canvas"},vR={class:"topbar mobile-only"},yR={class:"topbar-left"},bR={key:0,class:"topbar-running",title:"Agent 运行中"},kR={class:"canvas-body"},wR=["aria-valuenow"],_R={class:"right-panel-head"},SR={class:"right-panel-body"},kc="scream-sidebar-collapsed",wc="scream-sidebar-width",So=180,$R=480,_c=288,Sc="scream-right-panel-width",$c="scream-workspace-mode",xR=Te({__name:"WebShell",setup(e){const t=rm(),{showToast:n}=ar(),{connectionStatus:s,status:o,isBusy:i,sessions:l,currentSessionId:r,workDir:a,gitStatus:c,models:u,like:f,sendPrompt:h,sendCommand:p,appendSystemMessage:v,createSession:k,switchSession:w,deleteSession:S,switchModel:$,switchThinking:M,fetchLike:P,fetchGitStatus:Z,abort:j}=t,C=F("home"),x=F(!1),y=F(null);function T(se=8e3){return s.value==="connected"?Promise.resolve(!0):new Promise(ke=>{const Mt=Date.now(),Ye=window.setInterval(()=>{s.value==="connected"?(window.clearInterval(Ye),ke(!0)):Date.now()-Mt>se&&(window.clearInterval(Ye),ke(!1))},80)})}function O(se){se==="chat"?r.value?C.value="chat":I():C.value=se,x.value=!1}function I(){x.value=!1,C.value="chat",k()}async function H(se,ke){if(x.value=!1,r.value||await k(),!!await T())if(C.value="chat",ke==="goal")try{await t.createGoal({objective:se,budgets:[]})}catch(Ye){v(`Goal 创建失败:${L(Ye)}。已保留对话模式,可重新发送。`),h(se);return}else h(se)}function L(se){return se instanceof Error?se.message:String(se)}function B(se){x.value=!1,C.value="chat",w(se)}function ne(se){Zn(se)}function ie(se,ke){if(se!==r.value){n("请先点击该会话,再双击重命名。","warning");return}p("title",ke)}function _e(se,ke){switch(se){case"compact":case"auto":case"yes":case"plan":case"fork":case"title":case"btw":if(!r.value){k().then(()=>p(se,ke));return}p(se,ke);break;case"clear":t.clearMessages();break;case"new":I();break;case"help":v(Yu());break;case"model":v(`当前模型:${o.value.model??"unknown"}`);break;case"status":case"usage":v("请在对话页查看会话详情");break;default:v(`未知命令:/${se}`)}}const Se=F(!1);try{Se.value=localStorage.getItem(kc)==="1"}catch{}function je(){Se.value=!Se.value;try{localStorage.setItem(kc,Se.value?"1":"0")}catch{}}function Qe(){try{const se=Number(localStorage.getItem(wc));if(Number.isFinite(se)&&se>=So&&se<=$R)return Math.round(se)}catch{}return _c}const ge=F(Qe()),he=F(!1);let Fe=null;function Y(){try{localStorage.setItem(wc,String(ge.value))}catch{}}function ae(se){if(!Se.value){se.preventDefault(),he.value=!0,Fe=se.pointerId;try{se.currentTarget.setPointerCapture(se.pointerId)}catch{}}}function V(se){if(!he.value||se.pointerId!==Fe)return;const ke=Pa({viewportWidth:Pe.value,rightPanelOpen:$e.panelOpen,rightPanelWidth:Le.value});ge.value=Math.min(ke,Math.max(So,Math.round(se.clientX)))}function ve(se){!he.value||se.pointerId!==Fe||(he.value=!1,Fe=null,Y())}function Oe(){ge.value=_c,Y()}function Ue(se){const ke=se.shiftKey?32:12,Mt=Pa({viewportWidth:Pe.value,rightPanelOpen:$e.panelOpen,rightPanelWidth:Le.value});if(se.key==="ArrowLeft")se.preventDefault(),ge.value=Math.max(So,ge.value-ke);else if(se.key==="ArrowRight")se.preventDefault(),ge.value=Math.min(Mt,ge.value+ke);else if(se.key==="Home")se.preventDefault(),ge.value=So;else if(se.key==="End")se.preventDefault(),ge.value=Mt;else if(se.key==="Enter")se.preventDefault(),Oe();else return;Y()}const Pe=F(window.innerWidth),_=q(()=>Pe.value>=cr);function E(){try{const se=Number(localStorage.getItem(Sc));if(Number.isFinite(se)&&se>=Aa)return Math.round(se)}catch{}return null}const G=F(E()??Ma(window.innerWidth)),Q=F(!1);let K=null;function X(se){const ke=fm({viewportWidth:Pe.value,sidebarOpen:!Se.value,sidebarWidth:ge.value});return Ju(se,Aa,ke)}function le(){try{localStorage.setItem(Sc,String(G.value))}catch{}}function ce(se){se.preventDefault(),Q.value=!0,K=se.pointerId;try{se.currentTarget.setPointerCapture(se.pointerId)}catch{}}function A(se){!Q.value||se.pointerId!==K||(G.value=X(window.innerWidth-se.clientX))}function N(se){!Q.value||se.pointerId!==K||(Q.value=!1,K=null,le())}function ue(){G.value=X(Ma(Pe.value)),le()}function de(se){const ke=se.shiftKey?32:12;if(se.key==="ArrowLeft")se.preventDefault(),G.value=X(G.value+ke);else if(se.key==="ArrowRight")se.preventDefault(),G.value=X(G.value-ke);else if(se.key==="Enter")se.preventDefault(),ue();else return;le()}function pe(){Qu(!1)}function be(){Pe.value=window.innerWidth}Me(_,()=>{Q.value&&(Q.value=!1,K=null,le())});const Le=q(()=>X(G.value)),De=q(()=>({"--sidebar-width":`${ge.value}px`,"--right-panel-width":`${Le.value}px`}));function Ne(){try{return localStorage.getItem($c)==="goal"?"goal":"chat"}catch{return"chat"}}const Ke=F(Ne());function ot(se){Ke.value=se;try{localStorage.setItem($c,se)}catch{}}function bt(se){if((se.metaKey||se.ctrlKey)&&se.key==="k")se.preventDefault(),Se.value&&je(),ft(()=>{var ke;return(ke=y.value)==null?void 0:ke.focusSearch()});else if((se.metaKey||se.ctrlKey)&&se.key==="n")se.preventDefault(),I();else if(se.key==="Escape"&&i.value){const ke=se.target;ke&&(ke.tagName==="TEXTAREA"||ke.tagName==="INPUT")||(se.preventDefault(),j())}}return ct(()=>{window.addEventListener("keydown",bt),window.addEventListener("resize",be),P(),Z()}),Ct(()=>{window.removeEventListener("keydown",bt),window.removeEventListener("resize",be)}),(se,ke)=>(g(),m("div",{class:fe(["shell",{"sidebar-collapsed":Se.value,resizing:he.value||Q.value,"right-panel-open":W($e).panelOpen&&_.value}]),style:Nt(De.value)},[J(bc,{ref_key:"sidebarRef",ref:y,view:C.value,sessions:W(l),"current-session-id":W(r),"work-dir":W(a),"git-status":W(c),"refresh-git":W(Z),collapsed:Se.value,onNavigate:O,onSwitchSession:B,onDeleteSession:W(S),onCreateSession:I,onToggleCollapse:je,onOpenFile:ne,onRenameSession:ie},null,8,["view","sessions","current-session-id","work-dir","git-status","refresh-git","collapsed","onDeleteSession"]),Se.value?U("",!0):(g(),m("div",{key:0,class:fe(["sidebar-resize-handle",{resizing:he.value}]),role:"separator","aria-orientation":"vertical","aria-label":"调整侧栏宽度","aria-valuenow":ge.value,"aria-valuemin":"180","aria-valuemax":"480",tabindex:"0",title:"拖拽调整宽度 · 双击复位",onPointerdown:ae,onPointermove:V,onPointerup:ve,onPointercancel:ve,onDblclick:Oe,onKeydown:Ue},null,42,pR)),x.value?(g(),m("div",{key:1,class:"sidebar-backdrop","aria-hidden":"true",onClick:ke[0]||(ke[0]=Mt=>x.value=!1)})):U("",!0),x.value?(g(),m("div",gR,[J(bc,{view:C.value,sessions:W(l),"current-session-id":W(r),"work-dir":W(a),"git-status":W(c),"refresh-git":W(Z),"show-collapse-toggle":!1,onNavigate:O,onSwitchSession:B,onDeleteSession:W(S),onCreateSession:I,onOpenFile:ne,onRenameSession:ie},null,8,["view","sessions","current-session-id","work-dir","git-status","refresh-git","onDeleteSession"])])):U("",!0),d("main",mR,[d("header",vR,[d("div",yR,[d("button",{class:"topbar-icon mobile-menu",title:"菜单","aria-label":"打开菜单",onClick:ke[1]||(ke[1]=Mt=>x.value=!0)},[J(me,{name:"menu",size:20})]),W(i)?(g(),m("span",bR,[...ke[3]||(ke[3]=[d("span",{class:"running-dot","aria-hidden":"true"},null,-1),d("span",{class:"running-text"},"运行中",-1)])])):U("",!0)])]),d("div",kR,[C.value==="home"?(g(),Xe(hR,{key:0,models:W(u),status:W(o),busy:W(i),mode:Ke.value,"onUpdate:mode":ot,onSend:H,onCommand:_e,onSwitchModel:W($),onSwitchThinking:W(M)},null,8,["models","status","busy","mode","onSwitchModel","onSwitchThinking"])):C.value==="chat"?(g(),Xe(nT,{key:1,client:W(t),onHome:ke[2]||(ke[2]=Mt=>C.value="home")},null,8,["client"])):C.value==="skills"?(g(),Xe(ZI,{key:2,onCreate:I})):C.value==="settings"?(g(),Xe(H2,{key:3,like:W(f),client:W(t),onUpdateLike:W(t).updateLike},null,8,["like","client","onUpdateLike"])):U("",!0)])]),W($e).panelOpen&&!_.value?(g(),m("div",{key:3,class:"right-panel-backdrop","aria-hidden":"true",onClick:pe})):U("",!0),W($e).panelOpen&&_.value?(g(),m("div",{key:4,class:fe(["right-resize-handle",{resizing:Q.value}]),role:"separator","aria-orientation":"vertical","aria-label":"调整文件面板宽度","aria-valuenow":Le.value,tabindex:"0",title:"拖拽调整宽度 · 双击复位",onPointerdown:ce,onPointermove:A,onPointerup:N,onPointercancel:N,onDblclick:ue,onKeydown:de},null,42,wR)):U("",!0),W($e).panelOpen?(g(),m("aside",{key:5,class:fe(["right-panel",{overlay:!_.value}]),"aria-label":"文件面板"},[d("div",_R,[J(tR),d("button",{class:"right-panel-close",title:"收起文件面板","aria-label":"收起文件面板",onClick:pe},[J(me,{name:"chevron-right",size:16})])]),d("div",SR,[J(PT,{client:W(t)},null,8,["client"])])],2)):U("",!0)],6))}}),CR=Ie(xR,[["__scopeId","data-v-6c995f44"]]),TR=["src","alt"],IR={key:1,class:"lightbox-note",role:"alert"},RR=Te({__name:"ImageLightbox",setup(e){const t=F(null),n=F(!1);Me(()=>In.open,i=>{const l=t.value;l&&(i?(n.value=!1,l.open||l.showModal()):l.open&&l.close())});function s(i){i.preventDefault(),ol()}function o(i){i.target===t.value&&ol()}return(i,l)=>(g(),m("dialog",{ref_key:"dialogRef",ref:t,class:"image-lightbox","aria-label":"图片预览",onCancel:s,onClick:o},[W(In).open?(g(),m("img",{key:0,class:"lightbox-img",src:W(In).src,alt:W(In).alt||"图片预览",onError:l[0]||(l[0]=r=>n.value=!0)},null,40,TR)):U("",!0),n.value?(g(),m("p",IR,"图片加载失败")):U("",!0),d("button",{type:"button",class:"lightbox-close","aria-label":"关闭预览",title:"关闭(Esc)",onClick:l[1]||(l[1]=r=>W(ol)())},[J(me,{name:"x",size:16})])],544))}}),AR=Ie(RR,[["__scopeId","data-v-7d7939d6"]]),ER={class:"toast-container"},MR=["onClick"],PR={class:"toast-icon"},LR={class:"toast-msg"},OR=Te({__name:"Toast",setup(e){const{toasts:t,removeToast:n}=ar(),s={info:"ℹ",success:"✓",error:"✗",warning:"⚠"};return(o,i)=>(g(),Xe(tr,{to:"body"},[d("div",ER,[J(Pg,{name:"toast"},{default:Pt(()=>[(g(!0),m(ee,null,Ee(W(t),l=>(g(),m("div",{key:l.id,class:fe(["toast",`toast--${l.type}`]),onClick:r=>W(n)(l.id)},[d("span",PR,R(s[l.type]),1),d("span",LR,R(l.message),1)],10,MR))),128))]),_:1})])]))}}),DR=Ie(OR,[["__scopeId","data-v-a432e638"]]),NR={class:"app"},BR=Te({__name:"App",setup(e){const t=F("system"),n=F("dark");xo("effectiveTheme",n),xo("theme",t);const s={light:"#ffffff",dark:"#101113"};function o(){const a=document.documentElement,c=window.matchMedia("(prefers-color-scheme: dark)").matches,u=t.value==="system"?c?"dark":"light":t.value;n.value=u,a.dataset.theme=u;const f=document.querySelector('meta[name="theme-color"]');f&&f.setAttribute("content",s[u])}let i=null;function l(a){const c=t.value;t.value=a;try{localStorage.setItem("scream-theme",a)}catch{}if(c===a)return;const u=document.documentElement,f=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,h=()=>{u.classList.add("theme-transition"),o(),i!==null&&clearTimeout(i),i=window.setTimeout(()=>u.classList.remove("theme-transition"),320)},p=document;if(typeof p.startViewTransition=="function"&&!f){p.startViewTransition(()=>{o()}).finished.then(()=>u.classList.remove("theme-transition"),()=>{u.classList.remove("theme-transition")});return}h()}xo("setTheme",l),ct(()=>{try{const a=localStorage.getItem("scream-theme");(a==="light"||a==="dark"||a==="system")&&(t.value=a)}catch{}o()}),Me(t,o);const r=window.matchMedia("(prefers-color-scheme: dark)");return r.addEventListener("change",o),Ct(()=>{r.removeEventListener("change",o),i!==null&&clearTimeout(i),document.documentElement.classList.remove("theme-transition")}),(a,c)=>(g(),m("div",NR,[J(CR),J(AR),J(DR)]))}}),FR=Ie(BR,[["__scopeId","data-v-5c26ee23"]]);Hg(FR).mount("#app");
|
|
96
|
-
//# sourceMappingURL=index-DjlCHEg8.js.map
|