@nervmor/codexui 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1440 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();/**
2
- * @vue/shared v3.5.30
3
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
- * @license MIT
5
- **/function Ya(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const xt={},Ss=[],dr=()=>{},Zu=()=>!1,mi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Qa=e=>e.startsWith("onUpdate:"),Jt=Object.assign,Xa=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},jh=Object.prototype.hasOwnProperty,kt=(e,t)=>jh.call(e,t),Ge=Array.isArray,Is=e=>So(e)==="[object Map]",ed=e=>So(e)==="[object Set]",Vl=e=>So(e)==="[object Date]",Ze=e=>typeof e=="function",Lt=e=>typeof e=="string",Jn=e=>typeof e=="symbol",Tt=e=>e!==null&&typeof e=="object",td=e=>(Tt(e)||Ze(e))&&Ze(e.then)&&Ze(e.catch),nd=Object.prototype.toString,So=e=>nd.call(e),Bh=e=>So(e).slice(8,-1),rd=e=>So(e)==="[object Object]",Za=e=>Lt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Qs=Ya(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),gi=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Fh=/-\w/g,wn=gi(e=>e.replace(Fh,t=>t.slice(1).toUpperCase())),Uh=/\B([A-Z])/g,Qr=gi(e=>e.replace(Uh,"-$1").toLowerCase()),vi=gi(e=>e.charAt(0).toUpperCase()+e.slice(1)),Li=gi(e=>e?`on${vi(e)}`:""),ar=(e,t)=>!Object.is(e,t),Vo=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},sd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},el=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Hh=e=>{const t=Lt(e)?Number(e):NaN;return isNaN(t)?e:t};let Wl;const yi=()=>Wl||(Wl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function qr(e){if(Ge(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Lt(r)?Gh(r):qr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Lt(e)||Tt(e))return e}const Vh=/;(?![^(]*\))/g,Wh=/:([^]+)/,zh=/\/\*[^]*?\*\//g;function Gh(e){const t={};return e.replace(zh,"").split(Vh).forEach(n=>{if(n){const r=n.split(Wh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function ft(e){let t="";if(Lt(e))t=e;else if(Ge(e))for(let n=0;n<e.length;n++){const r=ft(e[n]);r&&(t+=r+" ")}else if(Tt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const qh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Kh=Ya(qh);function od(e){return!!e||e===""}function Jh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=tl(e[r],t[r]);return n}function tl(e,t){if(e===t)return!0;let n=Vl(e),r=Vl(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Jn(e),r=Jn(t),n||r)return e===t;if(n=Ge(e),r=Ge(t),n||r)return n&&r?Jh(e,t):!1;if(n=Tt(e),r=Tt(t),n||r){if(!n||!r)return!1;const s=Object.keys(e).length,o=Object.keys(t).length;if(s!==o)return!1;for(const i in e){const a=e.hasOwnProperty(i),l=t.hasOwnProperty(i);if(a&&!l||!a&&l||!tl(e[i],t[i]))return!1}}return String(e)===String(t)}const id=e=>!!(e&&e.__v_isRef===!0),W=e=>Lt(e)?e:e==null?"":Ge(e)||Tt(e)&&(e.toString===nd||!Ze(e.toString))?id(e)?W(e.value):JSON.stringify(e,ad,2):String(e),ad=(e,t)=>id(t)?ad(e,t.value):Is(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ji(r,o)+" =>"]=s,n),{})}:ed(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ji(n))}:Jn(t)?ji(t):Tt(t)&&!Ge(t)&&!rd(t)?String(t):t,ji=(e,t="")=>{var n;return Jn(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
6
- * @vue/reactivity v3.5.30
7
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
8
- * @license MIT
9
- **/let En;class Yh{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=En,!t&&En&&(this.index=(En.scopes||(En.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[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)for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].resume();for(t=0,n=this.effects.length;t<n;t++)this.effects[t].resume()}}run(t){if(this._active){const n=En;try{return En=this,t()}finally{En=n}}}on(){++this._on===1&&(this.prevScope=En,En=this)}off(){this._on>0&&--this._on===0&&(En=this.prevScope,this.prevScope=void 0)}stop(t){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!t){const s=this.parent.scopes.pop();s&&s!==this&&(this.parent.scopes[this.index]=s,s.index=this.index)}this.parent=void 0}}}function Qh(){return En}let Pt;const Bi=new WeakSet;class ld{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,En&&En.active&&En.effects.push(this)}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||ud(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,zl(this),dd(this);const t=Pt,n=Gn;Pt=this,Gn=!0;try{return this.fn()}finally{fd(this),Pt=t,Gn=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)sl(t);this.deps=this.depsTail=void 0,zl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Bi.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){wa(this)&&this.run()}get dirty(){return wa(this)}}let cd=0,Xs,Zs;function ud(e,t=!1){if(e.flags|=8,t){e.next=Zs,Zs=e;return}e.next=Xs,Xs=e}function nl(){cd++}function rl(){if(--cd>0)return;if(Zs){let t=Zs;for(Zs=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Xs;){let t=Xs;for(Xs=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(r){e||(e=r)}t=n}}if(e)throw e}function dd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function fd(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),sl(r),Xh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function wa(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(hd(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function hd(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===lo)||(e.globalVersion=lo,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!wa(e))))return;e.flags|=2;const t=e.dep,n=Pt,r=Gn;Pt=e,Gn=!0;try{dd(e);const s=e.fn(e._value);(t.version===0||ar(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Pt=n,Gn=r,fd(e),e.flags&=-3}}function sl(e,t=!1){const{dep:n,prevSub:r,nextSub:s}=e;if(r&&(r.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let o=n.computed.deps;o;o=o.nextDep)sl(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Xh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Gn=!0;const pd=[];function Cr(){pd.push(Gn),Gn=!1}function Ar(){const e=pd.pop();Gn=e===void 0?!0:e}function zl(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Pt;Pt=void 0;try{t()}finally{Pt=n}}}let lo=0;class Zh{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 ol{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(!Pt||!Gn||Pt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Pt)n=this.activeLink=new Zh(Pt,this),Pt.deps?(n.prevDep=Pt.depsTail,Pt.depsTail.nextDep=n,Pt.depsTail=n):Pt.deps=Pt.depsTail=n,md(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Pt.depsTail,n.nextDep=void 0,Pt.depsTail.nextDep=n,Pt.depsTail=n,Pt.deps===n&&(Pt.deps=r)}return n}trigger(t){this.version++,lo++,this.notify(t)}notify(t){nl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{rl()}}}function md(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let r=t.deps;r;r=r.nextDep)md(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const ba=new WeakMap,fs=Symbol(""),_a=Symbol(""),co=Symbol("");function on(e,t,n){if(Gn&&Pt){let r=ba.get(e);r||ba.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new ol),s.map=r,s.key=n),s.track()}}function kr(e,t,n,r,s,o){const i=ba.get(e);if(!i){lo++;return}const a=l=>{l&&l.trigger()};if(nl(),t==="clear")i.forEach(a);else{const l=Ge(e),d=l&&Za(n);if(l&&n==="length"){const c=Number(r);i.forEach((h,b)=>{(b==="length"||b===co||!Jn(b)&&b>=c)&&a(h)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),d&&a(i.get(co)),t){case"add":l?d&&a(i.get("length")):(a(i.get(fs)),Is(e)&&a(i.get(_a)));break;case"delete":l||(a(i.get(fs)),Is(e)&&a(i.get(_a)));break;case"set":Is(e)&&a(i.get(fs));break}}rl()}function vs(e){const t=wt(e);return t===e?t:(on(t,"iterate",co),jn(e)?t:t.map(Yn))}function wi(e){return on(e=wt(e),"iterate",co),e}function or(e,t){return xr(e)?$s(hs(e)?Yn(t):t):Yn(t)}const ep={__proto__:null,[Symbol.iterator](){return Fi(this,Symbol.iterator,e=>or(this,e))},concat(...e){return vs(this).concat(...e.map(t=>Ge(t)?vs(t):t))},entries(){return Fi(this,"entries",e=>(e[1]=or(this,e[1]),e))},every(e,t){return vr(this,"every",e,t,void 0,arguments)},filter(e,t){return vr(this,"filter",e,t,n=>n.map(r=>or(this,r)),arguments)},find(e,t){return vr(this,"find",e,t,n=>or(this,n),arguments)},findIndex(e,t){return vr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return vr(this,"findLast",e,t,n=>or(this,n),arguments)},findLastIndex(e,t){return vr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return vr(this,"forEach",e,t,void 0,arguments)},includes(...e){return Ui(this,"includes",e)},indexOf(...e){return Ui(this,"indexOf",e)},join(e){return vs(this).join(e)},lastIndexOf(...e){return Ui(this,"lastIndexOf",e)},map(e,t){return vr(this,"map",e,t,void 0,arguments)},pop(){return Ws(this,"pop")},push(...e){return Ws(this,"push",e)},reduce(e,...t){return Gl(this,"reduce",e,t)},reduceRight(e,...t){return Gl(this,"reduceRight",e,t)},shift(){return Ws(this,"shift")},some(e,t){return vr(this,"some",e,t,void 0,arguments)},splice(...e){return Ws(this,"splice",e)},toReversed(){return vs(this).toReversed()},toSorted(e){return vs(this).toSorted(e)},toSpliced(...e){return vs(this).toSpliced(...e)},unshift(...e){return Ws(this,"unshift",e)},values(){return Fi(this,"values",e=>or(this,e))}};function Fi(e,t,n){const r=wi(e),s=r[t]();return r!==e&&!jn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const tp=Array.prototype;function vr(e,t,n,r,s,o){const i=wi(e),a=i!==e&&!jn(e),l=i[t];if(l!==tp[t]){const h=l.apply(e,o);return a?Yn(h):h}let d=n;i!==e&&(a?d=function(h,b){return n.call(this,or(e,h),b,e)}:n.length>2&&(d=function(h,b){return n.call(this,h,b,e)}));const c=l.call(i,d,r);return a&&s?s(c):c}function Gl(e,t,n,r){const s=wi(e),o=s!==e&&!jn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(d,c,h){return a&&(a=!1,d=or(e,d)),n.call(this,d,or(e,c),h,e)}):n.length>3&&(i=function(d,c,h){return n.call(this,d,c,h,e)}));const l=s[t](i,...r);return a?or(e,l):l}function Ui(e,t,n){const r=wt(e);on(r,"iterate",co);const s=r[t](...n);return(s===-1||s===!1)&&ll(n[0])?(n[0]=wt(n[0]),r[t](...n)):s}function Ws(e,t,n=[]){Cr(),nl();const r=wt(e)[t].apply(e,n);return rl(),Ar(),r}const np=Ya("__proto__,__v_isRef,__isVue"),gd=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Jn));function rp(e){Jn(e)||(e=String(e));const t=wt(this);return on(t,"has",e),t.hasOwnProperty(e)}class vd{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(s?o?hp:_d:o?bd:wd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Ge(t);if(!s){let l;if(i&&(l=ep[n]))return l;if(n==="hasOwnProperty")return rp}const a=Reflect.get(t,n,cn(t)?t:r);if((Jn(n)?gd.has(n):np(n))||(s||on(t,"get",n),o))return a;if(cn(a)){const l=i&&Za(n)?a:a.value;return s&&Tt(l)?Ta(l):l}return Tt(a)?s?Ta(a):bi(a):a}}class yd extends vd{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Ge(t)&&Za(n);if(!this._isShallow){const d=xr(o);if(!jn(r)&&!xr(r)&&(o=wt(o),r=wt(r)),!i&&cn(o)&&!cn(r))return d||(o.value=r),!0}const a=i?Number(n)<t.length:kt(t,n),l=Reflect.set(t,n,r,cn(t)?t:s);return t===wt(s)&&(a?ar(r,o)&&kr(t,"set",n,r):kr(t,"add",n,r)),l}deleteProperty(t,n){const r=kt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&kr(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!Jn(n)||!gd.has(n))&&on(t,"has",n),r}ownKeys(t){return on(t,"iterate",Ge(t)?"length":fs),Reflect.ownKeys(t)}}class sp extends vd{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const op=new yd,ip=new sp,ap=new yd(!0);const ka=e=>e,Oo=e=>Reflect.getPrototypeOf(e);function lp(e,t,n){return function(...r){const s=this.__v_raw,o=wt(s),i=Is(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,d=s[e](...r),c=n?ka:t?$s:Yn;return!t&&on(o,"iterate",l?_a:fs),Jt(Object.create(d),{next(){const{value:h,done:b}=d.next();return b?{value:h,done:b}:{value:a?[c(h[0]),c(h[1])]:c(h),done:b}}})}}function No(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function cp(e,t){const n={get(s){const o=this.__v_raw,i=wt(o),a=wt(s);e||(ar(s,a)&&on(i,"get",s),on(i,"get",a));const{has:l}=Oo(i),d=t?ka:e?$s:Yn;if(l.call(i,s))return d(o.get(s));if(l.call(i,a))return d(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&on(wt(s),"iterate",fs),s.size},has(s){const o=this.__v_raw,i=wt(o),a=wt(s);return e||(ar(s,a)&&on(i,"has",s),on(i,"has",a)),s===a?o.has(s):o.has(s)||o.has(a)},forEach(s,o){const i=this,a=i.__v_raw,l=wt(a),d=t?ka:e?$s:Yn;return!e&&on(l,"iterate",fs),a.forEach((c,h)=>s.call(o,d(c),d(h),i))}};return Jt(n,e?{add:No("add"),set:No("set"),delete:No("delete"),clear:No("clear")}:{add(s){const o=wt(this),i=Oo(o),a=wt(s),l=!t&&!jn(s)&&!xr(s)?a:s;return i.has.call(o,l)||ar(s,l)&&i.has.call(o,s)||ar(a,l)&&i.has.call(o,a)||(o.add(l),kr(o,"add",l,l)),this},set(s,o){!t&&!jn(o)&&!xr(o)&&(o=wt(o));const i=wt(this),{has:a,get:l}=Oo(i);let d=a.call(i,s);d||(s=wt(s),d=a.call(i,s));const c=l.call(i,s);return i.set(s,o),d?ar(o,c)&&kr(i,"set",s,o):kr(i,"add",s,o),this},delete(s){const o=wt(this),{has:i,get:a}=Oo(o);let l=i.call(o,s);l||(s=wt(s),l=i.call(o,s)),a&&a.call(o,s);const d=o.delete(s);return l&&kr(o,"delete",s,void 0),d},clear(){const s=wt(this),o=s.size!==0,i=s.clear();return o&&kr(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=lp(s,e,t)}),n}function il(e,t){const n=cp(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(kt(n,s)&&s in r?n:r,s,o)}const up={get:il(!1,!1)},dp={get:il(!1,!0)},fp={get:il(!0,!1)};const wd=new WeakMap,bd=new WeakMap,_d=new WeakMap,hp=new WeakMap;function pp(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function mp(e){return e.__v_skip||!Object.isExtensible(e)?0:pp(Bh(e))}function bi(e){return xr(e)?e:al(e,!1,op,up,wd)}function kd(e){return al(e,!1,ap,dp,bd)}function Ta(e){return al(e,!0,ip,fp,_d)}function al(e,t,n,r,s){if(!Tt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=mp(e);if(o===0)return e;const i=s.get(e);if(i)return i;const a=new Proxy(e,o===2?r:n);return s.set(e,a),a}function hs(e){return xr(e)?hs(e.__v_raw):!!(e&&e.__v_isReactive)}function xr(e){return!!(e&&e.__v_isReadonly)}function jn(e){return!!(e&&e.__v_isShallow)}function ll(e){return e?!!e.__v_raw:!1}function wt(e){const t=e&&e.__v_raw;return t?wt(t):e}function gp(e){return!kt(e,"__v_skip")&&Object.isExtensible(e)&&sd(e,"__v_skip",!0),e}const Yn=e=>Tt(e)?bi(e):e,$s=e=>Tt(e)?Ta(e):e;function cn(e){return e?e.__v_isRef===!0:!1}function D(e){return Td(e,!1)}function vp(e){return Td(e,!0)}function Td(e,t){return cn(e)?e:new yp(e,t)}class yp{constructor(t,n){this.dep=new ol,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:wt(t),this._value=n?t:Yn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||jn(t)||xr(t);t=r?t:wt(t),ar(t,n)&&(this._rawValue=t,this._value=r?t:Yn(t),this.dep.trigger())}}function ye(e){return cn(e)?e.value:e}const wp={get:(e,t,n)=>t==="__v_raw"?e:ye(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return cn(s)&&!cn(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Sd(e){return hs(e)?e:new Proxy(e,wp)}class bp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new ol(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=lo-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Pt!==this)return ud(this,!0),!0}get value(){const t=this.dep.track();return hd(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function _p(e,t,n=!1){let r,s;return Ze(e)?r=e:(r=e.get,s=e.set),new bp(r,s,n)}const Do={},ei=new WeakMap;let is;function kp(e,t=!1,n=is){if(n){let r=ei.get(n);r||ei.set(n,r=[]),r.push(e)}}function Tp(e,t,n=xt){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,d=te=>s?te:jn(te)||s===!1||s===0?Tr(te,1):Tr(te);let c,h,b,T,N=!1,O=!1;if(cn(e)?(h=()=>e.value,N=jn(e)):hs(e)?(h=()=>d(e),N=!0):Ge(e)?(O=!0,N=e.some(te=>hs(te)||jn(te)),h=()=>e.map(te=>{if(cn(te))return te.value;if(hs(te))return d(te);if(Ze(te))return l?l(te,2):te()})):Ze(e)?t?h=l?()=>l(e,2):e:h=()=>{if(b){Cr();try{b()}finally{Ar()}}const te=is;is=c;try{return l?l(e,3,[T]):e(T)}finally{is=te}}:h=dr,t&&s){const te=h,be=s===!0?1/0:s;h=()=>Tr(te(),be)}const J=Qh(),oe=()=>{c.stop(),J&&J.active&&Xa(J.effects,c)};if(o&&t){const te=t;t=(...be)=>{te(...be),oe()}}let L=O?new Array(e.length).fill(Do):Do;const ne=te=>{if(!(!(c.flags&1)||!c.dirty&&!te))if(t){const be=c.run();if(s||N||(O?be.some((ce,me)=>ar(ce,L[me])):ar(be,L))){b&&b();const ce=is;is=c;try{const me=[be,L===Do?void 0:O&&L[0]===Do?[]:L,T];L=be,l?l(t,3,me):t(...me)}finally{is=ce}}}else c.run()};return a&&a(ne),c=new ld(h),c.scheduler=i?()=>i(ne,!1):ne,T=te=>kp(te,!1,c),b=c.onStop=()=>{const te=ei.get(c);if(te){if(l)l(te,4);else for(const be of te)be();ei.delete(c)}},t?r?ne(!0):L=c.run():i?i(ne.bind(null,!0),!0):c.run(),oe.pause=c.pause.bind(c),oe.resume=c.resume.bind(c),oe.stop=oe,oe}function Tr(e,t=1/0,n){if(t<=0||!Tt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,cn(e))Tr(e.value,t,n);else if(Ge(e))for(let r=0;r<e.length;r++)Tr(e[r],t,n);else if(ed(e)||Is(e))e.forEach(r=>{Tr(r,t,n)});else if(rd(e)){for(const r in e)Tr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Tr(e[r],t,n)}return e}/**
10
- * @vue/runtime-core v3.5.30
11
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
12
- * @license MIT
13
- **/function Io(e,t,n,r){try{return r?e(...r):e()}catch(s){_i(s,t,n)}}function Qn(e,t,n,r){if(Ze(e)){const s=Io(e,t,n,r);return s&&td(s)&&s.catch(o=>{_i(o,t,n)}),s}if(Ge(e)){const s=[];for(let o=0;o<e.length;o++)s.push(Qn(e[o],t,n,r));return s}}function _i(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||xt;if(t){let a=t.parent;const l=t.proxy,d=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let h=0;h<c.length;h++)if(c[h](e,l,d)===!1)return}a=a.parent}if(o){Cr(),Io(o,null,10,[e,l,d]),Ar();return}}Sp(e,n,s,r,i)}function Sp(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const vn=[];let rr=-1;const Es=[];let Ur=null,_s=0;const Id=Promise.resolve();let ti=null;function Kt(e){const t=ti||Id;return e?t.then(this?e.bind(this):e):t}function Ip(e){let t=rr+1,n=vn.length;for(;t<n;){const r=t+n>>>1,s=vn[r],o=uo(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function cl(e){if(!(e.flags&1)){const t=uo(e),n=vn[vn.length-1];!n||!(e.flags&2)&&t>=uo(n)?vn.push(e):vn.splice(Ip(t),0,e),e.flags|=1,Ed()}}function Ed(){ti||(ti=Id.then(Ad))}function Ep(e){Ge(e)?Es.push(...e):Ur&&e.id===-1?Ur.splice(_s+1,0,e):e.flags&1||(Es.push(e),e.flags|=1),Ed()}function ql(e,t,n=rr+1){for(;n<vn.length;n++){const r=vn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;vn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Cd(e){if(Es.length){const t=[...new Set(Es)].sort((n,r)=>uo(n)-uo(r));if(Es.length=0,Ur){Ur.push(...t);return}for(Ur=t,_s=0;_s<Ur.length;_s++){const n=Ur[_s];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ur=null,_s=0}}const uo=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Ad(e){try{for(rr=0;rr<vn.length;rr++){const t=vn[rr];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Io(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;rr<vn.length;rr++){const t=vn[rr];t&&(t.flags&=-2)}rr=-1,vn.length=0,Cd(),ti=null,(vn.length||Es.length)&&Ad()}}let en=null,xd=null;function ni(e){const t=en;return en=e,xd=e&&e.type.__scopeId||null,t}function bt(e,t=en,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&ii(-1);const o=ni(t);let i;try{i=e(...s)}finally{ni(o),r._d&&ii(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Pr(e,t){if(en===null)return e;const n=Ci(en),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=xt]=t[s];o&&(Ze(o)&&(o={mounted:o,updated:o}),o.deep&&Tr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function ts(e,t,n,r){const s=e.dirs,o=t&&t.dirs;for(let i=0;i<s.length;i++){const a=s[i];o&&(a.oldValue=o[i].value);let l=a.dir[r];l&&(Cr(),Qn(l,n,8,[e.el,a,e,t]),Ar())}}function Wo(e,t){if(ln){let n=ln.provides;const r=ln.parent&&ln.parent.provides;r===n&&(n=ln.provides=Object.create(r)),n[e]=t}}function qn(e,t,n=!1){const r=pl();if(r||As){let s=As?As._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(s&&e in s)return s[e];if(arguments.length>1)return n&&Ze(t)?t.call(r&&r.proxy):t}}const Cp=Symbol.for("v-scx"),Ap=()=>qn(Cp);function gt(e,t,n){return Pd(e,t,n)}function Pd(e,t,n=xt){const{immediate:r,deep:s,flush:o,once:i}=n,a=Jt({},n),l=t&&r||!t&&o!=="post";let d;if(go){if(o==="sync"){const T=Ap();d=T.__watcherHandles||(T.__watcherHandles=[])}else if(!l){const T=()=>{};return T.stop=dr,T.resume=dr,T.pause=dr,T}}const c=ln;a.call=(T,N,O)=>Qn(T,c,N,O);let h=!1;o==="post"?a.scheduler=T=>{sn(T,c&&c.suspense)}:o!=="sync"&&(h=!0,a.scheduler=(T,N)=>{N?T():cl(T)}),a.augmentJob=T=>{t&&(T.flags|=4),h&&(T.flags|=2,c&&(T.id=c.uid,T.i=c))};const b=Tp(e,t,a);return go&&(d?d.push(b):l&&b()),b}function xp(e,t,n){const r=this.proxy,s=Lt(e)?e.includes(".")?Rd(r,e):()=>r[e]:e.bind(r,r);let o;Ze(t)?o=t:(o=t.handler,n=t);const i=Eo(this),a=Pd(s,o.bind(r),n);return i(),a}function Rd(e,t){const n=t.split(".");return()=>{let r=e;for(let s=0;s<n.length&&r;s++)r=r[n[s]];return r}}const Md=Symbol("_vte"),$d=e=>e.__isTeleport,eo=e=>e&&(e.disabled||e.disabled===""),Kl=e=>e&&(e.defer||e.defer===""),Jl=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Yl=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Sa=(e,t)=>{const n=e&&e.to;return Lt(n)?t?t(n):null:n},Od={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,d){const{mc:c,pc:h,pbc:b,o:{insert:T,querySelector:N,createText:O,createComment:J}}=d,oe=eo(t.props);let{shapeFlag:L,children:ne,dynamicChildren:te}=t;if(e==null){const be=t.el=O(""),ce=t.anchor=O("");T(be,n,r),T(ce,n,r);const me=(ae,Q)=>{L&16&&c(ne,ae,Q,s,o,i,a,l)},Oe=()=>{const ae=t.target=Sa(t.props,N),Q=Ia(ae,t,O,T);ae&&(i!=="svg"&&Jl(ae)?i="svg":i!=="mathml"&&Yl(ae)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(ae),oe||(me(ae,Q),zo(t,!1)))};oe&&(me(n,ce),zo(t,!0)),Kl(t.props)?(t.el.__isMounted=!1,sn(()=>{Oe(),delete t.el.__isMounted},o)):Oe()}else{if(Kl(t.props)&&e.el.__isMounted===!1){sn(()=>{Od.process(e,t,n,r,s,o,i,a,l,d)},o);return}t.el=e.el,t.targetStart=e.targetStart;const be=t.anchor=e.anchor,ce=t.target=e.target,me=t.targetAnchor=e.targetAnchor,Oe=eo(e.props),ae=Oe?n:ce,Q=Oe?be:me;if(i==="svg"||Jl(ce)?i="svg":(i==="mathml"||Yl(ce))&&(i="mathml"),te?(b(e.dynamicChildren,te,ae,s,o,i,a),fl(e,t,!0)):l||h(e,t,ae,Q,s,o,i,a,!1),oe)Oe?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Lo(t,n,be,d,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const le=t.target=Sa(t.props,N);le&&Lo(t,le,null,d,0)}else Oe&&Lo(t,ce,me,d,1);zo(t,oe)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:d,targetAnchor:c,target:h,props:b}=e;if(h&&(s(d),s(c)),o&&s(l),i&16){const T=o||!eo(b);for(let N=0;N<a.length;N++){const O=a[N];r(O,t,n,T,!!O.dynamicChildren)}}},move:Lo,hydrate:Pp};function Lo(e,t,n,{o:{insert:r},m:s},o=2){o===0&&r(e.targetAnchor,t,n);const{el:i,anchor:a,shapeFlag:l,children:d,props:c}=e,h=o===2;if(h&&r(i,t,n),(!h||eo(c))&&l&16)for(let b=0;b<d.length;b++)s(d[b],t,n,2);h&&r(a,t,n)}function Pp(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:d,createText:c}},h){function b(J,oe){let L=oe;for(;L;){if(L&&L.nodeType===8){if(L.data==="teleport start anchor")t.targetStart=L;else if(L.data==="teleport anchor"){t.targetAnchor=L,J._lpa=t.targetAnchor&&i(t.targetAnchor);break}}L=i(L)}}function T(J,oe){oe.anchor=h(i(J),oe,a(J),n,r,s,o)}const N=t.target=Sa(t.props,l),O=eo(t.props);if(N){const J=N._lpa||N.firstChild;t.shapeFlag&16&&(O?(T(e,t),b(N,J),t.targetAnchor||Ia(N,t,c,d,a(e)===N?e:null)):(t.anchor=i(e),b(N,J),t.targetAnchor||Ia(N,t,c,d),h(J&&i(J),t,N,n,r,s,o))),zo(t,O)}else O&&t.shapeFlag&16&&(T(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const to=Od;function zo(e,t){const n=e.ctx;if(n&&n.ut){let r,s;for(t?(r=e.el,s=e.anchor):(r=e.targetStart,s=e.targetAnchor);r&&r!==s;)r.nodeType===1&&r.setAttribute("data-v-owner",n.uid),r=r.nextSibling;n.ut()}}function Ia(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[Md]=i,e&&(r(o,e,s),r(i,e,s)),i}const sr=Symbol("_leaveCb"),zs=Symbol("_enterCb");function Rp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Nr(()=>{e.isMounted=!0}),Dr(()=>{e.isUnmounting=!0}),e}const Dn=[Function,Array],Nd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Dn,onEnter:Dn,onAfterEnter:Dn,onEnterCancelled:Dn,onBeforeLeave:Dn,onLeave:Dn,onAfterLeave:Dn,onLeaveCancelled:Dn,onBeforeAppear:Dn,onAppear:Dn,onAfterAppear:Dn,onAppearCancelled:Dn},Dd=e=>{const t=e.subTree;return t.component?Dd(t.component):t},Mp={name:"BaseTransition",props:Nd,setup(e,{slots:t}){const n=pl(),r=Rp();return()=>{const s=t.default&&Bd(t.default(),!0);if(!s||!s.length)return;const o=Ld(s),i=wt(e),{mode:a}=i;if(r.isLeaving)return Hi(o);const l=Ql(o);if(!l)return Hi(o);let d=Ea(l,i,r,n,h=>d=h);l.type!==an&&fo(l,d);let c=n.subTree&&Ql(n.subTree);if(c&&c.type!==an&&!ls(c,l)&&Dd(n).type!==an){let h=Ea(c,i,r,n);if(fo(c,h),a==="out-in"&&l.type!==an)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,c=void 0},Hi(o);a==="in-out"&&l.type!==an?h.delayLeave=(b,T,N)=>{const O=jd(r,c);O[String(c.key)]=c,b[sr]=()=>{T(),b[sr]=void 0,delete d.delayedLeave,c=void 0},d.delayedLeave=()=>{N(),delete d.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return o}}};function Ld(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==an){t=n;break}}return t}const $p=Mp;function jd(e,t){const{leavingVNodes:n}=e;let r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Ea(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:d,onAfterEnter:c,onEnterCancelled:h,onBeforeLeave:b,onLeave:T,onAfterLeave:N,onLeaveCancelled:O,onBeforeAppear:J,onAppear:oe,onAfterAppear:L,onAppearCancelled:ne}=t,te=String(e.key),be=jd(n,e),ce=(ae,Q)=>{ae&&Qn(ae,r,9,Q)},me=(ae,Q)=>{const le=Q[1];ce(ae,Q),Ge(ae)?ae.every(ee=>ee.length<=1)&&le():ae.length<=1&&le()},Oe={mode:i,persisted:a,beforeEnter(ae){let Q=l;if(!n.isMounted)if(o)Q=J||l;else return;ae[sr]&&ae[sr](!0);const le=be[te];le&&ls(e,le)&&le.el[sr]&&le.el[sr](),ce(Q,[ae])},enter(ae){if(be[te]===e)return;let Q=d,le=c,ee=h;if(!n.isMounted)if(o)Q=oe||d,le=L||c,ee=ne||h;else return;let Pe=!1;ae[zs]=qe=>{Pe||(Pe=!0,qe?ce(ee,[ae]):ce(le,[ae]),Oe.delayedLeave&&Oe.delayedLeave(),ae[zs]=void 0)};const Ne=ae[zs].bind(null,!1);Q?me(Q,[ae,Ne]):Ne()},leave(ae,Q){const le=String(e.key);if(ae[zs]&&ae[zs](!0),n.isUnmounting)return Q();ce(b,[ae]);let ee=!1;ae[sr]=Ne=>{ee||(ee=!0,Q(),Ne?ce(O,[ae]):ce(N,[ae]),ae[sr]=void 0,be[le]===e&&delete be[le])};const Pe=ae[sr].bind(null,!1);be[le]=e,T?me(T,[ae,Pe]):Pe()},clone(ae){const Q=Ea(ae,t,n,r,s);return s&&s(Q),Q}};return Oe}function Hi(e){if(ki(e))return e=Yr(e),e.children=null,e}function Ql(e){if(!ki(e))return $d(e.type)&&e.children?Ld(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&&Ze(n.default))return n.default()}}function fo(e,t){e.shapeFlag&6&&e.component?(e.transition=t,fo(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 Bd(e,t=!1,n){let r=[],s=0;for(let o=0;o<e.length;o++){let i=e[o];const a=n==null?i.key:String(n)+String(i.key!=null?i.key:o);i.type===$e?(i.patchFlag&128&&s++,r=r.concat(Bd(i.children,t,a))):(t||i.type!==an)&&r.push(a!=null?Yr(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Xt(e,t){return Ze(e)?Jt({name:e.name},t,{setup:e}):e}function Fd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function Xl(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const ri=new WeakMap;function no(e,t,n,r,s=!1){if(Ge(e)){e.forEach((O,J)=>no(O,t&&(Ge(t)?t[J]:t),n,r,s));return}if(Cs(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&no(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Ci(r.component):r.el,i=s?null:o,{i:a,r:l}=e,d=t&&t.r,c=a.refs===xt?a.refs={}:a.refs,h=a.setupState,b=wt(h),T=h===xt?Zu:O=>Xl(c,O)?!1:kt(b,O),N=(O,J)=>!(J&&Xl(c,J));if(d!=null&&d!==l){if(Zl(t),Lt(d))c[d]=null,T(d)&&(h[d]=null);else if(cn(d)){const O=t;N(d,O.k)&&(d.value=null),O.k&&(c[O.k]=null)}}if(Ze(l))Io(l,a,12,[i,c]);else{const O=Lt(l),J=cn(l);if(O||J){const oe=()=>{if(e.f){const L=O?T(l)?h[l]:c[l]:N()||!e.k?l.value:c[e.k];if(s)Ge(L)&&Xa(L,o);else if(Ge(L))L.includes(o)||L.push(o);else if(O)c[l]=[o],T(l)&&(h[l]=c[l]);else{const ne=[o];N(l,e.k)&&(l.value=ne),e.k&&(c[e.k]=ne)}}else O?(c[l]=i,T(l)&&(h[l]=i)):J&&(N(l,e.k)&&(l.value=i),e.k&&(c[e.k]=i))};if(i){const L=()=>{oe(),ri.delete(e)};L.id=-1,ri.set(e,L),sn(L,n)}else Zl(e),oe()}}}function Zl(e){const t=ri.get(e);t&&(t.flags|=8,ri.delete(e))}yi().requestIdleCallback;yi().cancelIdleCallback;const Cs=e=>!!e.type.__asyncLoader,ki=e=>e.type.__isKeepAlive;function Op(e,t){Ud(e,"a",t)}function Np(e,t){Ud(e,"da",t)}function Ud(e,t,n=ln){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Ti(t,r,n),n){let s=n.parent;for(;s&&s.parent;)ki(s.parent.vnode)&&Dp(r,t,n,s),s=s.parent}}function Dp(e,t,n,r){const s=Ti(t,e,r,!0);Si(()=>{Xa(r[t],s)},n)}function Ti(e,t,n=ln,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Cr();const a=Eo(n),l=Qn(t,n,e,i);return a(),Ar(),l});return r?s.unshift(o):s.push(o),o}}const Or=e=>(t,n=ln)=>{(!go||e==="sp")&&Ti(e,(...r)=>t(...r),n)},Lp=Or("bm"),Nr=Or("m"),jp=Or("bu"),Bp=Or("u"),Dr=Or("bum"),Si=Or("um"),Fp=Or("sp"),Up=Or("rtg"),Hp=Or("rtc");function Vp(e,t=ln){Ti("ec",e,t)}const Wp="components",Hd=Symbol.for("v-ndc");function si(e){return Lt(e)?zp(Wp,e,!1)||e:e||Hd}function zp(e,t,n=!0,r=!1){const s=en||ln;if(s){const o=s.type;{const a=xm(o,!1);if(a&&(a===t||a===wn(t)||a===vi(wn(t))))return o}const i=ec(s[e]||o[e],t)||ec(s.appContext[e],t);return!i&&r?o:i}}function ec(e,t){return e&&(e[t]||e[wn(t)]||e[vi(wn(t))])}function dt(e,t,n,r){let s;const o=n,i=Ge(e);if(i||Lt(e)){const a=i&&hs(e);let l=!1,d=!1;a&&(l=!jn(e),d=xr(e),e=wi(e)),s=new Array(e.length);for(let c=0,h=e.length;c<h;c++)s[c]=t(l?d?$s(Yn(e[c])):Yn(e[c]):e[c],c,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,o)}else if(Tt(e))if(e[Symbol.iterator])s=Array.from(e,(a,l)=>t(a,l,void 0,o));else{const a=Object.keys(e);s=new Array(a.length);for(let l=0,d=a.length;l<d;l++){const c=a[l];s[l]=t(e[c],c,l,o)}}else s=[];return s}function ur(e,t,n={},r,s){if(en.ce||en.parent&&Cs(en.parent)&&en.parent.ce){const d=Object.keys(n).length>0;return t!=="default"&&(n.name=t),m(),mt($e,null,[De("slot",n,r)],d?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),m();const i=o&&Vd(o(n)),a=n.key||i&&i.key,l=mt($e,{key:(a&&!Jn(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function Vd(e){return e.some(t=>po(t)?!(t.type===an||t.type===$e&&!Vd(t.children)):!0)?e:null}const Ca=e=>e?uf(e)?Ci(e):Ca(e.parent):null,ro=Jt(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=>Ca(e.parent),$root:e=>Ca(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>zd(e),$forceUpdate:e=>e.f||(e.f=()=>{cl(e.update)}),$nextTick:e=>e.n||(e.n=Kt.bind(e.proxy)),$watch:e=>xp.bind(e)}),Vi=(e,t)=>e!==xt&&!e.__isScriptSetup&&kt(e,t),Gp={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:s,props:o,accessCache:i,type:a,appContext:l}=e;if(t[0]!=="$"){const b=i[t];if(b!==void 0)switch(b){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(Vi(r,t))return i[t]=1,r[t];if(s!==xt&&kt(s,t))return i[t]=2,s[t];if(kt(o,t))return i[t]=3,o[t];if(n!==xt&&kt(n,t))return i[t]=4,n[t];Aa&&(i[t]=0)}}const d=ro[t];let c,h;if(d)return t==="$attrs"&&on(e.attrs,"get",""),d(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==xt&&kt(n,t))return i[t]=4,n[t];if(h=l.config.globalProperties,kt(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return Vi(s,t)?(s[t]=n,!0):r!==xt&&kt(r,t)?(r[t]=n,!0):kt(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:s,props:o,type:i}},a){let l;return!!(n[a]||e!==xt&&a[0]!=="$"&&kt(e,a)||Vi(t,a)||kt(o,a)||kt(r,a)||kt(ro,a)||kt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:kt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function qp(){return Kp().slots}function Kp(e){const t=pl();return t.setupContext||(t.setupContext=ff(t))}function tc(e){return Ge(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Aa=!0;function Jp(e){const t=zd(e),n=e.proxy,r=e.ctx;Aa=!1,t.beforeCreate&&nc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:d,created:c,beforeMount:h,mounted:b,beforeUpdate:T,updated:N,activated:O,deactivated:J,beforeDestroy:oe,beforeUnmount:L,destroyed:ne,unmounted:te,render:be,renderTracked:ce,renderTriggered:me,errorCaptured:Oe,serverPrefetch:ae,expose:Q,inheritAttrs:le,components:ee,directives:Pe,filters:Ne}=t;if(d&&Yp(d,r,null),i)for(const Fe in i){const Ae=i[Fe];Ze(Ae)&&(r[Fe]=Ae.bind(n))}if(s){const Fe=s.call(n,n);Tt(Fe)&&(e.data=bi(Fe))}if(Aa=!0,o)for(const Fe in o){const Ae=o[Fe],rt=Ze(Ae)?Ae.bind(n,n):Ze(Ae.get)?Ae.get.bind(n,n):dr,ze=!Ze(Ae)&&Ze(Ae.set)?Ae.set.bind(n):dr,Be=pe({get:rt,set:ze});Object.defineProperty(r,Fe,{enumerable:!0,configurable:!0,get:()=>Be.value,set:lt=>Be.value=lt})}if(a)for(const Fe in a)Wd(a[Fe],r,n,Fe);if(l){const Fe=Ze(l)?l.call(n):l;Reflect.ownKeys(Fe).forEach(Ae=>{Wo(Ae,Fe[Ae])})}c&&nc(c,e,"c");function He(Fe,Ae){Ge(Ae)?Ae.forEach(rt=>Fe(rt.bind(n))):Ae&&Fe(Ae.bind(n))}if(He(Lp,h),He(Nr,b),He(jp,T),He(Bp,N),He(Op,O),He(Np,J),He(Vp,Oe),He(Hp,ce),He(Up,me),He(Dr,L),He(Si,te),He(Fp,ae),Ge(Q))if(Q.length){const Fe=e.exposed||(e.exposed={});Q.forEach(Ae=>{Object.defineProperty(Fe,Ae,{get:()=>n[Ae],set:rt=>n[Ae]=rt,enumerable:!0})})}else e.exposed||(e.exposed={});be&&e.render===dr&&(e.render=be),le!=null&&(e.inheritAttrs=le),ee&&(e.components=ee),Pe&&(e.directives=Pe),ae&&Fd(e)}function Yp(e,t,n=dr){Ge(e)&&(e=xa(e));for(const r in e){const s=e[r];let o;Tt(s)?"default"in s?o=qn(s.from||r,s.default,!0):o=qn(s.from||r):o=qn(s),cn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function nc(e,t,n){Qn(Ge(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Wd(e,t,n,r){let s=r.includes(".")?Rd(n,r):()=>n[r];if(Lt(e)){const o=t[e];Ze(o)&&gt(s,o)}else if(Ze(e))gt(s,e.bind(n));else if(Tt(e))if(Ge(e))e.forEach(o=>Wd(o,t,n,r));else{const o=Ze(e.handler)?e.handler.bind(n):t[e.handler];Ze(o)&&gt(s,o,e)}}function zd(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:s,optionsCache:o,config:{optionMergeStrategies:i}}=e.appContext,a=o.get(t);let l;return a?l=a:!s.length&&!n&&!r?l=t:(l={},s.length&&s.forEach(d=>oi(l,d,i,!0)),oi(l,t,i)),Tt(t)&&o.set(t,l),l}function oi(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&oi(e,o,n,!0),s&&s.forEach(i=>oi(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=Qp[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Qp={data:rc,props:sc,emits:sc,methods:Js,computed:Js,beforeCreate:mn,created:mn,beforeMount:mn,mounted:mn,beforeUpdate:mn,updated:mn,beforeDestroy:mn,beforeUnmount:mn,destroyed:mn,unmounted:mn,activated:mn,deactivated:mn,errorCaptured:mn,serverPrefetch:mn,components:Js,directives:Js,watch:Zp,provide:rc,inject:Xp};function rc(e,t){return t?e?function(){return Jt(Ze(e)?e.call(this,this):e,Ze(t)?t.call(this,this):t)}:t:e}function Xp(e,t){return Js(xa(e),xa(t))}function xa(e){if(Ge(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function mn(e,t){return e?[...new Set([].concat(e,t))]:t}function Js(e,t){return e?Jt(Object.create(null),e,t):t}function sc(e,t){return e?Ge(e)&&Ge(t)?[...new Set([...e,...t])]:Jt(Object.create(null),tc(e),tc(t??{})):t}function Zp(e,t){if(!e)return t;if(!t)return e;const n=Jt(Object.create(null),e);for(const r in t)n[r]=mn(e[r],t[r]);return n}function Gd(){return{app:null,config:{isNativeTag:Zu,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 em=0;function tm(e,t){return function(r,s=null){Ze(r)||(r=Jt({},r)),s!=null&&!Tt(s)&&(s=null);const o=Gd(),i=new WeakSet,a=[];let l=!1;const d=o.app={_uid:em++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Rm,get config(){return o.config},set config(c){},use(c,...h){return i.has(c)||(c&&Ze(c.install)?(i.add(c),c.install(d,...h)):Ze(c)&&(i.add(c),c(d,...h))),d},mixin(c){return o.mixins.includes(c)||o.mixins.push(c),d},component(c,h){return h?(o.components[c]=h,d):o.components[c]},directive(c,h){return h?(o.directives[c]=h,d):o.directives[c]},mount(c,h,b){if(!l){const T=d._ceVNode||De(r,s);return T.appContext=o,b===!0?b="svg":b===!1&&(b=void 0),e(T,c,b),l=!0,d._container=c,c.__vue_app__=d,Ci(T.component)}},onUnmount(c){a.push(c)},unmount(){l&&(Qn(a,d._instance,16),e(null,d._container),delete d._container.__vue_app__)},provide(c,h){return o.provides[c]=h,d},runWithContext(c){const h=As;As=d;try{return c()}finally{As=h}}};return d}}let As=null;const nm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${wn(t)}Modifiers`]||e[`${Qr(t)}Modifiers`];function rm(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||xt;let s=n;const o=t.startsWith("update:"),i=o&&nm(r,t.slice(7));i&&(i.trim&&(s=n.map(c=>Lt(c)?c.trim():c)),i.number&&(s=n.map(el)));let a,l=r[a=Li(t)]||r[a=Li(wn(t))];!l&&o&&(l=r[a=Li(Qr(t))]),l&&Qn(l,e,6,s);const d=r[a+"Once"];if(d){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Qn(d,e,6,s)}}const sm=new WeakMap;function qd(e,t,n=!1){const r=n?sm:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!Ze(e)){const l=d=>{const c=qd(d,t,!0);c&&(a=!0,Jt(i,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(Tt(e)&&r.set(e,null),null):(Ge(o)?o.forEach(l=>i[l]=null):Jt(i,o),Tt(e)&&r.set(e,i),i)}function Ii(e,t){return!e||!mi(t)?!1:(t=t.slice(2).replace(/Once$/,""),kt(e,t[0].toLowerCase()+t.slice(1))||kt(e,Qr(t))||kt(e,t))}function oc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:d,renderCache:c,props:h,data:b,setupState:T,ctx:N,inheritAttrs:O}=e,J=ni(e);let oe,L;try{if(n.shapeFlag&4){const te=s||r,be=te;oe=ir(d.call(be,te,c,h,T,b,N)),L=a}else{const te=t;oe=ir(te.length>1?te(h,{attrs:a,slots:i,emit:l}):te(h,null)),L=t.props?a:om(a)}}catch(te){so.length=0,_i(te,e,1),oe=De(an)}let ne=oe;if(L&&O!==!1){const te=Object.keys(L),{shapeFlag:be}=ne;te.length&&be&7&&(o&&te.some(Qa)&&(L=im(L,o)),ne=Yr(ne,L,!1,!0))}return n.dirs&&(ne=Yr(ne,null,!1,!0),ne.dirs=ne.dirs?ne.dirs.concat(n.dirs):n.dirs),n.transition&&fo(ne,n.transition),oe=ne,ni(J),oe}const om=e=>{let t;for(const n in e)(n==="class"||n==="style"||mi(n))&&((t||(t={}))[n]=e[n]);return t},im=(e,t)=>{const n={};for(const r in e)(!Qa(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function am(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,d=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?ic(r,i,d):!!i;if(l&8){const c=t.dynamicProps;for(let h=0;h<c.length;h++){const b=c[h];if(Kd(i,r,b)&&!Ii(d,b))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?ic(r,i,d):!0:!!i;return!1}function ic(e,t,n){const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let s=0;s<r.length;s++){const o=r[s];if(Kd(t,e,o)&&!Ii(n,o))return!0}return!1}function Kd(e,t,n){const r=e[n],s=t[n];return n==="style"&&Tt(r)&&Tt(s)?!tl(r,s):r!==s}function lm({vnode:e,parent:t},n){for(;t;){const r=t.subTree;if(r.suspense&&r.suspense.activeBranch===e&&(r.el=e.el),r===e)(e=t.vnode).el=n,t=t.parent;else break}}const Jd={},Yd=()=>Object.create(Jd),Qd=e=>Object.getPrototypeOf(e)===Jd;function cm(e,t,n,r=!1){const s={},o=Yd();e.propsDefaults=Object.create(null),Xd(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:kd(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function um(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=wt(s),[l]=e.propsOptions;let d=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let h=0;h<c.length;h++){let b=c[h];if(Ii(e.emitsOptions,b))continue;const T=t[b];if(l)if(kt(o,b))T!==o[b]&&(o[b]=T,d=!0);else{const N=wn(b);s[N]=Pa(l,a,N,T,e,!1)}else T!==o[b]&&(o[b]=T,d=!0)}}}else{Xd(e,t,s,o)&&(d=!0);let c;for(const h in a)(!t||!kt(t,h)&&((c=Qr(h))===h||!kt(t,c)))&&(l?n&&(n[h]!==void 0||n[c]!==void 0)&&(s[h]=Pa(l,a,h,void 0,e,!0)):delete s[h]);if(o!==a)for(const h in o)(!t||!kt(t,h))&&(delete o[h],d=!0)}d&&kr(e.attrs,"set","")}function Xd(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(Qs(l))continue;const d=t[l];let c;s&&kt(s,c=wn(l))?!o||!o.includes(c)?n[c]=d:(a||(a={}))[c]=d:Ii(e.emitsOptions,l)||(!(l in r)||d!==r[l])&&(r[l]=d,i=!0)}if(o){const l=wt(n),d=a||xt;for(let c=0;c<o.length;c++){const h=o[c];n[h]=Pa(s,l,h,d[h],e,!kt(d,h))}}return i}function Pa(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=kt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&Ze(l)){const{propsDefaults:d}=s;if(n in d)r=d[n];else{const c=Eo(s);r=d[n]=l.call(null,t),c()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===Qr(n))&&(r=!0))}return r}const dm=new WeakMap;function Zd(e,t,n=!1){const r=n?dm:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!Ze(e)){const c=h=>{l=!0;const[b,T]=Zd(h,t,!0);Jt(i,b),T&&a.push(...T)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!o&&!l)return Tt(e)&&r.set(e,Ss),Ss;if(Ge(o))for(let c=0;c<o.length;c++){const h=wn(o[c]);ac(h)&&(i[h]=xt)}else if(o)for(const c in o){const h=wn(c);if(ac(h)){const b=o[c],T=i[h]=Ge(b)||Ze(b)?{type:b}:Jt({},b),N=T.type;let O=!1,J=!0;if(Ge(N))for(let oe=0;oe<N.length;++oe){const L=N[oe],ne=Ze(L)&&L.name;if(ne==="Boolean"){O=!0;break}else ne==="String"&&(J=!1)}else O=Ze(N)&&N.name==="Boolean";T[0]=O,T[1]=J,(O||kt(T,"default"))&&a.push(h)}}const d=[i,a];return Tt(e)&&r.set(e,d),d}function ac(e){return e[0]!=="$"&&!Qs(e)}const ul=e=>e==="_"||e==="_ctx"||e==="$stable",dl=e=>Ge(e)?e.map(ir):[ir(e)],fm=(e,t,n)=>{if(t._n)return t;const r=bt((...s)=>dl(t(...s)),n);return r._c=!1,r},ef=(e,t,n)=>{const r=e._ctx;for(const s in e){if(ul(s))continue;const o=e[s];if(Ze(o))t[s]=fm(s,o,r);else if(o!=null){const i=dl(o);t[s]=()=>i}}},tf=(e,t)=>{const n=dl(t);e.slots.default=()=>n},nf=(e,t,n)=>{for(const r in t)(n||!ul(r))&&(e[r]=t[r])},hm=(e,t,n)=>{const r=e.slots=Yd();if(e.vnode.shapeFlag&32){const s=t._;s?(nf(r,t,n),n&&sd(r,"_",s,!0)):ef(t,r)}else t&&tf(e,t)},pm=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=xt;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:nf(s,t,n):(o=!t.$stable,ef(t,s)),i=t}else t&&(tf(e,t),i={default:1});if(o)for(const a in s)!ul(a)&&i[a]==null&&delete s[a]},sn=wm;function mm(e){return gm(e)}function gm(e,t){const n=yi();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:d,setElementText:c,parentNode:h,nextSibling:b,setScopeId:T=dr,insertStaticContent:N}=e,O=(k,I,M,K=null,F=null,R=null,H=void 0,U=null,z=!!I.dynamicChildren)=>{if(k===I)return;k&&!ls(k,I)&&(K=V(k),lt(k,F,R,!0),k=null),I.patchFlag===-2&&(z=!1,I.dynamicChildren=null);const{type:G,ref:Te,shapeFlag:ve}=I;switch(G){case Ei:J(k,I,M,K);break;case an:oe(k,I,M,K);break;case zi:k==null&&L(I,M,K,H);break;case $e:ee(k,I,M,K,F,R,H,U,z);break;default:ve&1?be(k,I,M,K,F,R,H,U,z):ve&6?Pe(k,I,M,K,F,R,H,U,z):(ve&64||ve&128)&&G.process(k,I,M,K,F,R,H,U,z,Ce)}Te!=null&&F?no(Te,k&&k.ref,R,I||k,!I):Te==null&&k&&k.ref!=null&&no(k.ref,null,R,k,!0)},J=(k,I,M,K)=>{if(k==null)r(I.el=a(I.children),M,K);else{const F=I.el=k.el;I.children!==k.children&&d(F,I.children)}},oe=(k,I,M,K)=>{k==null?r(I.el=l(I.children||""),M,K):I.el=k.el},L=(k,I,M,K)=>{[k.el,k.anchor]=N(k.children,I,M,K,k.el,k.anchor)},ne=({el:k,anchor:I},M,K)=>{let F;for(;k&&k!==I;)F=b(k),r(k,M,K),k=F;r(I,M,K)},te=({el:k,anchor:I})=>{let M;for(;k&&k!==I;)M=b(k),s(k),k=M;s(I)},be=(k,I,M,K,F,R,H,U,z)=>{if(I.type==="svg"?H="svg":I.type==="math"&&(H="mathml"),k==null)ce(I,M,K,F,R,H,U,z);else{const G=k.el&&k.el._isVueCE?k.el:null;try{G&&G._beginPatch(),ae(k,I,F,R,H,U,z)}finally{G&&G._endPatch()}}},ce=(k,I,M,K,F,R,H,U)=>{let z,G;const{props:Te,shapeFlag:ve,transition:_e,dirs:Ie}=k;if(z=k.el=i(k.type,R,Te&&Te.is,Te),ve&8?c(z,k.children):ve&16&&Oe(k.children,z,null,K,F,Wi(k,R),H,U),Ie&&ts(k,null,K,"created"),me(z,k,k.scopeId,H,K),Te){for(const tt in Te)tt!=="value"&&!Qs(tt)&&o(z,tt,null,Te[tt],R,K);"value"in Te&&o(z,"value",null,Te.value,R),(G=Te.onVnodeBeforeMount)&&nr(G,K,k)}Ie&&ts(k,null,K,"beforeMount");const Ue=vm(F,_e);Ue&&_e.beforeEnter(z),r(z,I,M),((G=Te&&Te.onVnodeMounted)||Ue||Ie)&&sn(()=>{G&&nr(G,K,k),Ue&&_e.enter(z),Ie&&ts(k,null,K,"mounted")},F)},me=(k,I,M,K,F)=>{if(M&&T(k,M),K)for(let R=0;R<K.length;R++)T(k,K[R]);if(F){let R=F.subTree;if(I===R||of(R.type)&&(R.ssContent===I||R.ssFallback===I)){const H=F.vnode;me(k,H,H.scopeId,H.slotScopeIds,F.parent)}}},Oe=(k,I,M,K,F,R,H,U,z=0)=>{for(let G=z;G<k.length;G++){const Te=k[G]=U?_r(k[G]):ir(k[G]);O(null,Te,I,M,K,F,R,H,U)}},ae=(k,I,M,K,F,R,H)=>{const U=I.el=k.el;let{patchFlag:z,dynamicChildren:G,dirs:Te}=I;z|=k.patchFlag&16;const ve=k.props||xt,_e=I.props||xt;let Ie;if(M&&ns(M,!1),(Ie=_e.onVnodeBeforeUpdate)&&nr(Ie,M,I,k),Te&&ts(I,k,M,"beforeUpdate"),M&&ns(M,!0),(ve.innerHTML&&_e.innerHTML==null||ve.textContent&&_e.textContent==null)&&c(U,""),G?Q(k.dynamicChildren,G,U,M,K,Wi(I,F),R):H||Ae(k,I,U,null,M,K,Wi(I,F),R,!1),z>0){if(z&16)le(U,ve,_e,M,F);else if(z&2&&ve.class!==_e.class&&o(U,"class",null,_e.class,F),z&4&&o(U,"style",ve.style,_e.style,F),z&8){const Ue=I.dynamicProps;for(let tt=0;tt<Ue.length;tt++){const Qe=Ue[tt],ut=ve[Qe],et=_e[Qe];(et!==ut||Qe==="value")&&o(U,Qe,ut,et,F,M)}}z&1&&k.children!==I.children&&c(U,I.children)}else!H&&G==null&&le(U,ve,_e,M,F);((Ie=_e.onVnodeUpdated)||Te)&&sn(()=>{Ie&&nr(Ie,M,I,k),Te&&ts(I,k,M,"updated")},K)},Q=(k,I,M,K,F,R,H)=>{for(let U=0;U<I.length;U++){const z=k[U],G=I[U],Te=z.el&&(z.type===$e||!ls(z,G)||z.shapeFlag&198)?h(z.el):M;O(z,G,Te,null,K,F,R,H,!0)}},le=(k,I,M,K,F)=>{if(I!==M){if(I!==xt)for(const R in I)!Qs(R)&&!(R in M)&&o(k,R,I[R],null,F,K);for(const R in M){if(Qs(R))continue;const H=M[R],U=I[R];H!==U&&R!=="value"&&o(k,R,U,H,F,K)}"value"in M&&o(k,"value",I.value,M.value,F)}},ee=(k,I,M,K,F,R,H,U,z)=>{const G=I.el=k?k.el:a(""),Te=I.anchor=k?k.anchor:a("");let{patchFlag:ve,dynamicChildren:_e,slotScopeIds:Ie}=I;Ie&&(U=U?U.concat(Ie):Ie),k==null?(r(G,M,K),r(Te,M,K),Oe(I.children||[],M,Te,F,R,H,U,z)):ve>0&&ve&64&&_e&&k.dynamicChildren&&k.dynamicChildren.length===_e.length?(Q(k.dynamicChildren,_e,M,F,R,H,U),(I.key!=null||F&&I===F.subTree)&&fl(k,I,!0)):Ae(k,I,M,Te,F,R,H,U,z)},Pe=(k,I,M,K,F,R,H,U,z)=>{I.slotScopeIds=U,k==null?I.shapeFlag&512?F.ctx.activate(I,M,K,H,z):Ne(I,M,K,F,R,H,z):qe(k,I,z)},Ne=(k,I,M,K,F,R,H)=>{const U=k.component=Im(k,K,F);if(ki(k)&&(U.ctx.renderer=Ce),Em(U,!1,H),U.asyncDep){if(F&&F.registerDep(U,He,H),!k.el){const z=U.subTree=De(an);oe(null,z,I,M),k.placeholder=z.el}}else He(U,k,I,M,F,R,H)},qe=(k,I,M)=>{const K=I.component=k.component;if(am(k,I,M))if(K.asyncDep&&!K.asyncResolved){Fe(K,I,M);return}else K.next=I,K.update();else I.el=k.el,K.vnode=I},He=(k,I,M,K,F,R,H)=>{const U=()=>{if(k.isMounted){let{next:ve,bu:_e,u:Ie,parent:Ue,vnode:tt}=k;{const Ke=rf(k);if(Ke){ve&&(ve.el=tt.el,Fe(k,ve,H)),Ke.asyncDep.then(()=>{sn(()=>{k.isUnmounted||G()},F)});return}}let Qe=ve,ut;ns(k,!1),ve?(ve.el=tt.el,Fe(k,ve,H)):ve=tt,_e&&Vo(_e),(ut=ve.props&&ve.props.onVnodeBeforeUpdate)&&nr(ut,Ue,ve,tt),ns(k,!0);const et=oc(k),pt=k.subTree;k.subTree=et,O(pt,et,h(pt.el),V(pt),k,F,R),ve.el=et.el,Qe===null&&lm(k,et.el),Ie&&sn(Ie,F),(ut=ve.props&&ve.props.onVnodeUpdated)&&sn(()=>nr(ut,Ue,ve,tt),F)}else{let ve;const{el:_e,props:Ie}=I,{bm:Ue,m:tt,parent:Qe,root:ut,type:et}=k,pt=Cs(I);ns(k,!1),Ue&&Vo(Ue),!pt&&(ve=Ie&&Ie.onVnodeBeforeMount)&&nr(ve,Qe,I),ns(k,!0);{ut.ce&&ut.ce._hasShadowRoot()&&ut.ce._injectChildStyle(et,k.parent?k.parent.type:void 0);const Ke=k.subTree=oc(k);O(null,Ke,M,K,k,F,R),I.el=Ke.el}if(tt&&sn(tt,F),!pt&&(ve=Ie&&Ie.onVnodeMounted)){const Ke=I;sn(()=>nr(ve,Qe,Ke),F)}(I.shapeFlag&256||Qe&&Cs(Qe.vnode)&&Qe.vnode.shapeFlag&256)&&k.a&&sn(k.a,F),k.isMounted=!0,I=M=K=null}};k.scope.on();const z=k.effect=new ld(U);k.scope.off();const G=k.update=z.run.bind(z),Te=k.job=z.runIfDirty.bind(z);Te.i=k,Te.id=k.uid,z.scheduler=()=>cl(Te),ns(k,!0),G()},Fe=(k,I,M)=>{I.component=k;const K=k.vnode.props;k.vnode=I,k.next=null,um(k,I.props,K,M),pm(k,I.children,M),Cr(),ql(k),Ar()},Ae=(k,I,M,K,F,R,H,U,z=!1)=>{const G=k&&k.children,Te=k?k.shapeFlag:0,ve=I.children,{patchFlag:_e,shapeFlag:Ie}=I;if(_e>0){if(_e&128){ze(G,ve,M,K,F,R,H,U,z);return}else if(_e&256){rt(G,ve,M,K,F,R,H,U,z);return}}Ie&8?(Te&16&&Ve(G,F,R),ve!==G&&c(M,ve)):Te&16?Ie&16?ze(G,ve,M,K,F,R,H,U,z):Ve(G,F,R,!0):(Te&8&&c(M,""),Ie&16&&Oe(ve,M,K,F,R,H,U,z))},rt=(k,I,M,K,F,R,H,U,z)=>{k=k||Ss,I=I||Ss;const G=k.length,Te=I.length,ve=Math.min(G,Te);let _e;for(_e=0;_e<ve;_e++){const Ie=I[_e]=z?_r(I[_e]):ir(I[_e]);O(k[_e],Ie,M,null,F,R,H,U,z)}G>Te?Ve(k,F,R,!0,!1,ve):Oe(I,M,K,F,R,H,U,z,ve)},ze=(k,I,M,K,F,R,H,U,z)=>{let G=0;const Te=I.length;let ve=k.length-1,_e=Te-1;for(;G<=ve&&G<=_e;){const Ie=k[G],Ue=I[G]=z?_r(I[G]):ir(I[G]);if(ls(Ie,Ue))O(Ie,Ue,M,null,F,R,H,U,z);else break;G++}for(;G<=ve&&G<=_e;){const Ie=k[ve],Ue=I[_e]=z?_r(I[_e]):ir(I[_e]);if(ls(Ie,Ue))O(Ie,Ue,M,null,F,R,H,U,z);else break;ve--,_e--}if(G>ve){if(G<=_e){const Ie=_e+1,Ue=Ie<Te?I[Ie].el:K;for(;G<=_e;)O(null,I[G]=z?_r(I[G]):ir(I[G]),M,Ue,F,R,H,U,z),G++}}else if(G>_e)for(;G<=ve;)lt(k[G],F,R,!0),G++;else{const Ie=G,Ue=G,tt=new Map;for(G=Ue;G<=_e;G++){const st=I[G]=z?_r(I[G]):ir(I[G]);st.key!=null&&tt.set(st.key,G)}let Qe,ut=0;const et=_e-Ue+1;let pt=!1,Ke=0;const Ot=new Array(et);for(G=0;G<et;G++)Ot[G]=0;for(G=Ie;G<=ve;G++){const st=k[G];if(ut>=et){lt(st,F,R,!0);continue}let vt;if(st.key!=null)vt=tt.get(st.key);else for(Qe=Ue;Qe<=_e;Qe++)if(Ot[Qe-Ue]===0&&ls(st,I[Qe])){vt=Qe;break}vt===void 0?lt(st,F,R,!0):(Ot[vt-Ue]=G+1,vt>=Ke?Ke=vt:pt=!0,O(st,I[vt],M,null,F,R,H,U,z),ut++)}const dn=pt?ym(Ot):Ss;for(Qe=dn.length-1,G=et-1;G>=0;G--){const st=Ue+G,vt=I[st],at=I[st+1],Vt=st+1<Te?at.el||sf(at):K;Ot[G]===0?O(null,vt,M,Vt,F,R,H,U,z):pt&&(Qe<0||G!==dn[Qe]?Be(vt,M,Vt,2):Qe--)}}},Be=(k,I,M,K,F=null)=>{const{el:R,type:H,transition:U,children:z,shapeFlag:G}=k;if(G&6){Be(k.component.subTree,I,M,K);return}if(G&128){k.suspense.move(I,M,K);return}if(G&64){H.move(k,I,M,Ce);return}if(H===$e){r(R,I,M);for(let ve=0;ve<z.length;ve++)Be(z[ve],I,M,K);r(k.anchor,I,M);return}if(H===zi){ne(k,I,M);return}if(K!==2&&G&1&&U)if(K===0)U.beforeEnter(R),r(R,I,M),sn(()=>U.enter(R),F);else{const{leave:ve,delayLeave:_e,afterLeave:Ie}=U,Ue=()=>{k.ctx.isUnmounted?s(R):r(R,I,M)},tt=()=>{R._isLeaving&&R[sr](!0),ve(R,()=>{Ue(),Ie&&Ie()})};_e?_e(R,Ue,tt):tt()}else r(R,I,M)},lt=(k,I,M,K=!1,F=!1)=>{const{type:R,props:H,ref:U,children:z,dynamicChildren:G,shapeFlag:Te,patchFlag:ve,dirs:_e,cacheIndex:Ie}=k;if(ve===-2&&(F=!1),U!=null&&(Cr(),no(U,null,M,k,!0),Ar()),Ie!=null&&(I.renderCache[Ie]=void 0),Te&256){I.ctx.deactivate(k);return}const Ue=Te&1&&_e,tt=!Cs(k);let Qe;if(tt&&(Qe=H&&H.onVnodeBeforeUnmount)&&nr(Qe,I,k),Te&6)ct(k.component,M,K);else{if(Te&128){k.suspense.unmount(M,K);return}Ue&&ts(k,null,I,"beforeUnmount"),Te&64?k.type.remove(k,I,M,Ce,K):G&&!G.hasOnce&&(R!==$e||ve>0&&ve&64)?Ve(G,I,M,!1,!0):(R===$e&&ve&384||!F&&Te&16)&&Ve(z,I,M),K&&Dt(k)}(tt&&(Qe=H&&H.onVnodeUnmounted)||Ue)&&sn(()=>{Qe&&nr(Qe,I,k),Ue&&ts(k,null,I,"unmounted")},M)},Dt=k=>{const{type:I,el:M,anchor:K,transition:F}=k;if(I===$e){it(M,K);return}if(I===zi){te(k);return}const R=()=>{s(M),F&&!F.persisted&&F.afterLeave&&F.afterLeave()};if(k.shapeFlag&1&&F&&!F.persisted){const{leave:H,delayLeave:U}=F,z=()=>H(M,R);U?U(k.el,R,z):z()}else R()},it=(k,I)=>{let M;for(;k!==I;)M=b(k),s(k),k=M;s(I)},ct=(k,I,M)=>{const{bum:K,scope:F,job:R,subTree:H,um:U,m:z,a:G}=k;lc(z),lc(G),K&&Vo(K),F.stop(),R&&(R.flags|=8,lt(H,k,I,M)),U&&sn(U,I),sn(()=>{k.isUnmounted=!0},I)},Ve=(k,I,M,K=!1,F=!1,R=0)=>{for(let H=R;H<k.length;H++)lt(k[H],I,M,K,F)},V=k=>{if(k.shapeFlag&6)return V(k.component.subTree);if(k.shapeFlag&128)return k.suspense.next();const I=b(k.anchor||k.el),M=I&&I[Md];return M?b(M):I};let we=!1;const he=(k,I,M)=>{let K;k==null?I._vnode&&(lt(I._vnode,null,null,!0),K=I._vnode.component):O(I._vnode||null,k,I,null,null,null,M),I._vnode=k,we||(we=!0,ql(K),Cd(),we=!1)},Ce={p:O,um:lt,m:Be,r:Dt,mt:Ne,mc:Oe,pc:Ae,pbc:Q,n:V,o:e};return{render:he,hydrate:void 0,createApp:tm(he)}}function Wi({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 ns({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function vm(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function fl(e,t,n=!1){const r=e.children,s=t.children;if(Ge(r)&&Ge(s))for(let o=0;o<r.length;o++){const i=r[o];let a=s[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[o]=_r(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&fl(i,a)),a.type===Ei&&(a.patchFlag===-1&&(a=s[o]=_r(a)),a.el=i.el),a.type===an&&!a.el&&(a.el=i.el)}}function ym(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const d=e[r];if(d!==0){if(s=n[n.length-1],e[s]<d){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<d?o=a+1:i=a;d<e[n[o]]&&(o>0&&(t[r]=n[o-1]),n[o]=r)}}for(o=n.length,i=n[o-1];o-- >0;)n[o]=i,i=t[i];return n}function rf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:rf(t)}function lc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function sf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?sf(t.subTree):null}const of=e=>e.__isSuspense;function wm(e,t){t&&t.pendingBranch?Ge(e)?t.effects.push(...e):t.effects.push(e):Ep(e)}const $e=Symbol.for("v-fgt"),Ei=Symbol.for("v-txt"),an=Symbol.for("v-cmt"),zi=Symbol.for("v-stc"),so=[];let Rn=null;function m(e=!1){so.push(Rn=e?null:[])}function bm(){so.pop(),Rn=so[so.length-1]||null}let ho=1;function ii(e,t=!1){ho+=e,e<0&&Rn&&t&&(Rn.hasOnce=!0)}function af(e){return e.dynamicChildren=ho>0?Rn||Ss:null,bm(),ho>0&&Rn&&Rn.push(e),e}function w(e,t,n,r,s,o){return af(y(e,t,n,r,s,o,!0))}function mt(e,t,n,r,s){return af(De(e,t,n,r,s,!0))}function po(e){return e?e.__v_isVNode===!0:!1}function ls(e,t){return e.type===t.type&&e.key===t.key}const lf=({key:e})=>e??null,Go=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Lt(e)||cn(e)||Ze(e)?{i:en,r:e,k:t,f:!!n}:e:null);function y(e,t=null,n=null,r=0,s=null,o=e===$e?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&lf(t),ref:t&&Go(t),scopeId:xd,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:o,patchFlag:r,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:en};return a?(hl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Lt(n)?8:16),ho>0&&!i&&Rn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&Rn.push(l),l}const De=_m;function _m(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===Hd)&&(e=an),po(e)){const a=Yr(e,t,!0);return n&&hl(a,n),ho>0&&!o&&Rn&&(a.shapeFlag&6?Rn[Rn.indexOf(e)]=a:Rn.push(a)),a.patchFlag=-2,a}if(Pm(e)&&(e=e.__vccOpts),t){t=km(t);let{class:a,style:l}=t;a&&!Lt(a)&&(t.class=ft(a)),Tt(l)&&(ll(l)&&!Ge(l)&&(l=Jt({},l)),t.style=qr(l))}const i=Lt(e)?1:of(e)?128:$d(e)?64:Tt(e)?4:Ze(e)?2:0;return y(e,t,n,r,s,i,o,!0)}function km(e){return e?ll(e)||Qd(e)?Jt({},e):e:null}function Yr(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,d=t?cf(s||{},t):s,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:d,key:d&&lf(d),ref:t&&t.ref?n&&o?Ge(o)?o.concat(Go(t)):[o,Go(t)]:Go(t):o,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:a,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==$e?i===-1?16:i|16:i,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:l,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Yr(e.ssContent),ssFallback:e.ssFallback&&Yr(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&fo(c,l.clone(c)),c}function mo(e=" ",t=0){return De(Ei,null,e,t)}function ue(e="",t=!1){return t?(m(),mt(an,null,e)):De(an,null,e)}function ir(e){return e==null||typeof e=="boolean"?De(an):Ge(e)?De($e,null,e.slice()):po(e)?_r(e):De(Ei,null,String(e))}function _r(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Yr(e)}function hl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Ge(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),hl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!Qd(t)?t._ctx=en:s===3&&en&&(en.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ze(t)?(t={default:t,_ctx:en},n=32):(t=String(t),r&64?(n=16,t=[mo(t)]):n=8);e.children=t,e.shapeFlag|=n}function cf(...e){const t={};for(let n=0;n<e.length;n++){const r=e[n];for(const s in r)if(s==="class")t.class!==r.class&&(t.class=ft([t.class,r.class]));else if(s==="style")t.style=qr([t.style,r.style]);else if(mi(s)){const o=t[s],i=r[s];i&&o!==i&&!(Ge(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function nr(e,t,n,r=null){Qn(e,t,7,[n,r])}const Tm=Gd();let Sm=0;function Im(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Tm,o={uid:Sm++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Yh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Zd(r,s),emitsOptions:qd(r,s),emit:null,emitted:null,propsDefaults:xt,inheritAttrs:r.inheritAttrs,ctx:xt,data:xt,props:xt,attrs:xt,slots:xt,refs:xt,setupState:xt,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 o.ctx={_:o},o.root=t?t.root:o,o.emit=rm.bind(null,o),e.ce&&e.ce(o),o}let ln=null;const pl=()=>ln||en;let ai,Ra;{const e=yi(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),o=>{s.length>1?s.forEach(i=>i(o)):s[0](o)}};ai=t("__VUE_INSTANCE_SETTERS__",n=>ln=n),Ra=t("__VUE_SSR_SETTERS__",n=>go=n)}const Eo=e=>{const t=ln;return ai(e),e.scope.on(),()=>{e.scope.off(),ai(t)}},cc=()=>{ln&&ln.scope.off(),ai(null)};function uf(e){return e.vnode.shapeFlag&4}let go=!1;function Em(e,t=!1,n=!1){t&&Ra(t);const{props:r,children:s}=e.vnode,o=uf(e);cm(e,r,o,t),hm(e,s,n||t);const i=o?Cm(e,t):void 0;return t&&Ra(!1),i}function Cm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Gp);const{setup:r}=n;if(r){Cr();const s=e.setupContext=r.length>1?ff(e):null,o=Eo(e),i=Io(r,e,0,[e.props,s]),a=td(i);if(Ar(),o(),(a||e.sp)&&!Cs(e)&&Fd(e),a){if(i.then(cc,cc),t)return i.then(l=>{uc(e,l)}).catch(l=>{_i(l,e,0)});e.asyncDep=i}else uc(e,i)}else df(e)}function uc(e,t,n){Ze(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Tt(t)&&(e.setupState=Sd(t)),df(e)}function df(e,t,n){const r=e.type;e.render||(e.render=r.render||dr);{const s=Eo(e);Cr();try{Jp(e)}finally{Ar(),s()}}}const Am={get(e,t){return on(e,"get",""),e[t]}};function ff(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Am),slots:e.slots,emit:e.emit,expose:t}}function Ci(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Sd(gp(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in ro)return ro[n](e)},has(t,n){return n in t||n in ro}})):e.proxy}function xm(e,t=!0){return Ze(e)?e.displayName||e.name:e.name||t&&e.__name}function Pm(e){return Ze(e)&&"__vccOpts"in e}const pe=(e,t)=>_p(e,t,go);function ml(e,t,n){try{ii(-1);const r=arguments.length;return r===2?Tt(t)&&!Ge(t)?po(t)?De(e,null,[t]):De(e,t):De(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&po(n)&&(n=[n]),De(e,t,n))}finally{ii(1)}}const Rm="3.5.30";/**
14
- * @vue/runtime-dom v3.5.30
15
- * (c) 2018-present Yuxi (Evan) You and Vue contributors
16
- * @license MIT
17
- **/let Ma;const dc=typeof window<"u"&&window.trustedTypes;if(dc)try{Ma=dc.createPolicy("vue",{createHTML:e=>e})}catch{}const hf=Ma?e=>Ma.createHTML(e):e=>e,Mm="http://www.w3.org/2000/svg",$m="http://www.w3.org/1998/Math/MathML",br=typeof document<"u"?document:null,fc=br&&br.createElement("template"),Om={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{const s=t==="svg"?br.createElementNS(Mm,e):t==="mathml"?br.createElementNS($m,e):n?br.createElement(e,{is:n}):br.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>br.createTextNode(e),createComment:e=>br.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>br.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,r,s,o){const i=n?n.previousSibling:t.lastChild;if(s&&(s===o||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===o||!(s=s.nextSibling)););else{fc.innerHTML=hf(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=fc.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}t.insertBefore(a,n)}return[i?i.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Lr="transition",Gs="animation",vo=Symbol("_vtc"),pf={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},Nm=Jt({},Nd,pf),Dm=e=>(e.displayName="Transition",e.props=Nm,e),mf=Dm((e,{slots:t})=>ml($p,Lm(e),t)),rs=(e,t=[])=>{Ge(e)?e.forEach(n=>n(...t)):e&&e(...t)},hc=e=>e?Ge(e)?e.some(t=>t.length>1):e.length>1:!1;function Lm(e){const t={};for(const ee in e)ee in pf||(t[ee]=e[ee]);if(e.css===!1)return t;const{name:n="v",type:r,duration:s,enterFromClass:o=`${n}-enter-from`,enterActiveClass:i=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=o,appearActiveClass:d=i,appearToClass:c=a,leaveFromClass:h=`${n}-leave-from`,leaveActiveClass:b=`${n}-leave-active`,leaveToClass:T=`${n}-leave-to`}=e,N=jm(s),O=N&&N[0],J=N&&N[1],{onBeforeEnter:oe,onEnter:L,onEnterCancelled:ne,onLeave:te,onLeaveCancelled:be,onBeforeAppear:ce=oe,onAppear:me=L,onAppearCancelled:Oe=ne}=t,ae=(ee,Pe,Ne,qe)=>{ee._enterCancelled=qe,ss(ee,Pe?c:a),ss(ee,Pe?d:i),Ne&&Ne()},Q=(ee,Pe)=>{ee._isLeaving=!1,ss(ee,h),ss(ee,T),ss(ee,b),Pe&&Pe()},le=ee=>(Pe,Ne)=>{const qe=ee?me:L,He=()=>ae(Pe,ee,Ne);rs(qe,[Pe,He]),pc(()=>{ss(Pe,ee?l:o),yr(Pe,ee?c:a),hc(qe)||mc(Pe,r,O,He)})};return Jt(t,{onBeforeEnter(ee){rs(oe,[ee]),yr(ee,o),yr(ee,i)},onBeforeAppear(ee){rs(ce,[ee]),yr(ee,l),yr(ee,d)},onEnter:le(!1),onAppear:le(!0),onLeave(ee,Pe){ee._isLeaving=!0;const Ne=()=>Q(ee,Pe);yr(ee,h),ee._enterCancelled?(yr(ee,b),yc(ee)):(yc(ee),yr(ee,b)),pc(()=>{ee._isLeaving&&(ss(ee,h),yr(ee,T),hc(te)||mc(ee,r,J,Ne))}),rs(te,[ee,Ne])},onEnterCancelled(ee){ae(ee,!1,void 0,!0),rs(ne,[ee])},onAppearCancelled(ee){ae(ee,!0,void 0,!0),rs(Oe,[ee])},onLeaveCancelled(ee){Q(ee),rs(be,[ee])}})}function jm(e){if(e==null)return null;if(Tt(e))return[Gi(e.enter),Gi(e.leave)];{const t=Gi(e);return[t,t]}}function Gi(e){return Hh(e)}function yr(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[vo]||(e[vo]=new Set)).add(t)}function ss(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[vo];n&&(n.delete(t),n.size||(e[vo]=void 0))}function pc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Bm=0;function mc(e,t,n,r){const s=e._endId=++Bm,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=Fm(e,t);if(!i)return r();const d=i+"end";let c=0;const h=()=>{e.removeEventListener(d,b),o()},b=T=>{T.target===e&&++c>=l&&h()};setTimeout(()=>{c<l&&h()},a+1),e.addEventListener(d,b)}function Fm(e,t){const n=window.getComputedStyle(e),r=N=>(n[N]||"").split(", "),s=r(`${Lr}Delay`),o=r(`${Lr}Duration`),i=gc(s,o),a=r(`${Gs}Delay`),l=r(`${Gs}Duration`),d=gc(a,l);let c=null,h=0,b=0;t===Lr?i>0&&(c=Lr,h=i,b=o.length):t===Gs?d>0&&(c=Gs,h=d,b=l.length):(h=Math.max(i,d),c=h>0?i>d?Lr:Gs:null,b=c?c===Lr?o.length:l.length:0);const T=c===Lr&&/\b(?:transform|all)(?:,|$)/.test(r(`${Lr}Property`).toString());return{type:c,timeout:h,propCount:b,hasTransform:T}}function gc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>vc(n)+vc(e[r])))}function vc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function yc(e){return(e?e.ownerDocument:document).body.offsetHeight}function Um(e,t,n){const r=e[vo];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const wc=Symbol("_vod"),Hm=Symbol("_vsh"),Vm=Symbol(""),Wm=/(?:^|;)\s*display\s*:/;function zm(e,t,n){const r=e.style,s=Lt(n);let o=!1;if(n&&!s){if(t)if(Lt(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&qo(r,a,"")}else for(const i in t)n[i]==null&&qo(r,i,"");for(const i in n)i==="display"&&(o=!0),qo(r,i,n[i])}else if(s){if(t!==n){const i=r[Vm];i&&(n+=";"+i),r.cssText=n,o=Wm.test(n)}}else t&&e.removeAttribute("style");wc in e&&(e[wc]=o?r.display:"",e[Hm]&&(r.display="none"))}const bc=/\s*!important$/;function qo(e,t,n){if(Ge(n))n.forEach(r=>qo(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Gm(e,t);bc.test(n)?e.setProperty(Qr(r),n.replace(bc,""),"important"):e[r]=n}}const _c=["Webkit","Moz","ms"],qi={};function Gm(e,t){const n=qi[t];if(n)return n;let r=wn(t);if(r!=="filter"&&r in e)return qi[t]=r;r=vi(r);for(let s=0;s<_c.length;s++){const o=_c[s]+r;if(o in e)return qi[t]=o}return t}const kc="http://www.w3.org/1999/xlink";function Tc(e,t,n,r,s,o=Kh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(kc,t.slice(6,t.length)):e.setAttributeNS(kc,t,n):n==null||o&&!od(n)?e.removeAttribute(t):e.setAttribute(t,o?"":Jn(n)?String(n):n)}function Sc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?hf(n):n);return}const o=e.tagName;if(t==="value"&&o!=="PROGRESS"&&!o.includes("-")){const a=o==="OPTION"?e.getAttribute("value")||"":e.value,l=n==null?e.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in e))&&(e.value=l),n==null&&e.removeAttribute(t),e._value=n;return}let i=!1;if(n===""||n==null){const a=typeof e[t];a==="boolean"?n=od(n):n==null&&a==="string"?(n="",i=!0):a==="number"&&(n=0,i=!0)}try{e[t]=n}catch{}i&&e.removeAttribute(s||t)}function ks(e,t,n,r){e.addEventListener(t,n,r)}function qm(e,t,n,r){e.removeEventListener(t,n,r)}const Ic=Symbol("_vei");function Km(e,t,n,r,s=null){const o=e[Ic]||(e[Ic]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=Jm(t);if(r){const d=o[t]=Xm(r,s);ks(e,a,d,l)}else i&&(qm(e,a,i,l),o[t]=void 0)}}const Ec=/(?:Once|Passive|Capture)$/;function Jm(e){let t;if(Ec.test(e)){t={};let r;for(;r=e.match(Ec);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Qr(e.slice(2)),t]}let Ki=0;const Ym=Promise.resolve(),Qm=()=>Ki||(Ym.then(()=>Ki=0),Ki=Date.now());function Xm(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Qn(Zm(r,n.value),t,5,[r])};return n.value=e,n.attached=Qm(),n}function Zm(e,t){if(Ge(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Cc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,eg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Um(e,r,i):t==="style"?zm(e,n,r):mi(t)?Qa(t)||Km(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):tg(e,t,r,i))?(Sc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Tc(e,t,r,i,o,t!=="value")):e._isVueCE&&(ng(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Lt(r)))?Sc(e,wn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Tc(e,t,r,i))};function tg(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Cc(t)&&Ze(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 s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Cc(t)&&Lt(n)?!1:t in e}function ng(e,t){const n=e._def.props;if(!n)return!1;const r=wn(t);return Array.isArray(n)?n.some(s=>wn(s)===r):Object.keys(n).some(s=>wn(s)===r)}const Ac=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ge(t)?n=>Vo(t,n):t};function rg(e){e.target.composing=!0}function xc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const Ji=Symbol("_assign");function Pc(e,t,n){return t&&(e=e.trim()),n&&(e=el(e)),e}const Rr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[Ji]=Ac(s);const o=r||s.props&&s.props.type==="number";ks(e,t?"change":"input",i=>{i.target.composing||e[Ji](Pc(e.value,n,o))}),(n||o)&&ks(e,"change",()=>{e.value=Pc(e.value,n,o)}),t||(ks(e,"compositionstart",rg),ks(e,"compositionend",xc),ks(e,"change",xc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[Ji]=Ac(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?el(e.value):e.value,l=t??"";a!==l&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l))}},sg=["ctrl","shift","alt","meta"],og={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)=>sg.some(n=>e[`${n}Key`]&&!t.includes(n))},yt=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),r=t.join(".");return n[r]||(n[r]=((s,...o)=>{for(let i=0;i<t.length;i++){const a=og[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},ig={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},yn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=Qr(s.key);if(t.some(i=>i===o||ig[i]===o))return e(s)}))},ag=Jt({patchProp:eg},Om);let Rc;function lg(){return Rc||(Rc=mm(ag))}const cg=((...e)=>{const t=lg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=dg(r);if(!s)return;const o=t._component;!Ze(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,ug(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function ug(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function dg(e){return Lt(e)?document.querySelector(e):e}/*!
18
- * vue-router v4.6.4
19
- * (c) 2025 Eduardo San Martin Morote
20
- * @license MIT
21
- */const Ts=typeof document<"u";function gf(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function fg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&gf(e.default)}const _t=Object.assign;function Yi(e,t){const n={};for(const r in t){const s=t[r];n[r]=Xn(s)?s.map(e):e(s)}return n}const oo=()=>{},Xn=Array.isArray;function Mc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const vf=/#/g,hg=/&/g,pg=/\//g,mg=/=/g,gg=/\?/g,yf=/\+/g,vg=/%5B/g,yg=/%5D/g,wf=/%5E/g,wg=/%60/g,bf=/%7B/g,bg=/%7C/g,_f=/%7D/g,_g=/%20/g;function gl(e){return e==null?"":encodeURI(""+e).replace(bg,"|").replace(vg,"[").replace(yg,"]")}function kg(e){return gl(e).replace(bf,"{").replace(_f,"}").replace(wf,"^")}function $a(e){return gl(e).replace(yf,"%2B").replace(_g,"+").replace(vf,"%23").replace(hg,"%26").replace(wg,"`").replace(bf,"{").replace(_f,"}").replace(wf,"^")}function Tg(e){return $a(e).replace(mg,"%3D")}function Sg(e){return gl(e).replace(vf,"%23").replace(gg,"%3F")}function Ig(e){return Sg(e).replace(pg,"%2F")}function yo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Eg=/\/$/,Cg=e=>e.replace(Eg,"");function Qi(e,t,n="/"){let r,s={},o="",i="";const a=t.indexOf("#");let l=t.indexOf("?");return l=a>=0&&l>a?-1:l,l>=0&&(r=t.slice(0,l),o=t.slice(l,a>0?a:t.length),s=e(o.slice(1))),a>=0&&(r=r||t.slice(0,a),i=t.slice(a,t.length)),r=Rg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:yo(i)}}function Ag(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function $c(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function xg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Os(t.matched[r],n.matched[s])&&kf(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Os(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function kf(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Pg(e[n],t[n]))return!1;return!0}function Pg(e,t){return Xn(e)?Oc(e,t):Xn(t)?Oc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Oc(e,t){return Xn(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Rg(e,t){if(e.startsWith("/"))return e;if(!e)return t;const n=t.split("/"),r=e.split("/"),s=r[r.length-1];(s===".."||s===".")&&r.push("");let o=n.length-1,i,a;for(i=0;i<r.length;i++)if(a=r[i],a!==".")if(a==="..")o>1&&o--;else break;return n.slice(0,o).join("/")+"/"+r.slice(i).join("/")}const jr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Oa=(function(e){return e.pop="pop",e.push="push",e})({}),Xi=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Mg(e){if(!e)if(Ts){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Cg(e)}const $g=/^[^#]+#/;function Og(e,t){return e.replace($g,"#")+t}function Ng(e,t){const n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect();return{behavior:t.behavior,left:r.left-n.left-(t.left||0),top:r.top-n.top-(t.top||0)}}const Ai=()=>({left:window.scrollX,top:window.scrollY});function Dg(e){let t;if("el"in e){const n=e.el,r=typeof n=="string"&&n.startsWith("#"),s=typeof n=="string"?r?document.getElementById(n.slice(1)):document.querySelector(n):n;if(!s)return;t=Ng(s,e)}else t=e;"scrollBehavior"in document.documentElement.style?window.scrollTo(t):window.scrollTo(t.left!=null?t.left:window.scrollX,t.top!=null?t.top:window.scrollY)}function Nc(e,t){return(history.state?history.state.position-t:-1)+e}const Na=new Map;function Lg(e,t){Na.set(e,t)}function jg(e){const t=Na.get(e);return Na.delete(e),t}function Bg(e){return typeof e=="string"||e&&typeof e=="object"}function Tf(e){return typeof e=="string"||typeof e=="symbol"}let Ut=(function(e){return e[e.MATCHER_NOT_FOUND=1]="MATCHER_NOT_FOUND",e[e.NAVIGATION_GUARD_REDIRECT=2]="NAVIGATION_GUARD_REDIRECT",e[e.NAVIGATION_ABORTED=4]="NAVIGATION_ABORTED",e[e.NAVIGATION_CANCELLED=8]="NAVIGATION_CANCELLED",e[e.NAVIGATION_DUPLICATED=16]="NAVIGATION_DUPLICATED",e})({});const Sf=Symbol("");Ut.MATCHER_NOT_FOUND+"",Ut.NAVIGATION_GUARD_REDIRECT+"",Ut.NAVIGATION_ABORTED+"",Ut.NAVIGATION_CANCELLED+"",Ut.NAVIGATION_DUPLICATED+"";function Ns(e,t){return _t(new Error,{type:e,[Sf]:!0},t)}function wr(e,t){return e instanceof Error&&Sf in e&&(t==null||!!(e.type&t))}const Fg=["params","query","hash"];function Ug(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Fg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Hg(e){const t={};if(e===""||e==="?")return t;const n=(e[0]==="?"?e.slice(1):e).split("&");for(let r=0;r<n.length;++r){const s=n[r].replace(yf," "),o=s.indexOf("="),i=yo(o<0?s:s.slice(0,o)),a=o<0?null:yo(s.slice(o+1));if(i in t){let l=t[i];Xn(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Dc(e){let t="";for(let n in e){const r=e[n];if(n=Tg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(Xn(r)?r.map(s=>s&&$a(s)):[r&&$a(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Vg(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=Xn(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const Wg=Symbol(""),Lc=Symbol(""),xi=Symbol(""),vl=Symbol(""),Da=Symbol("");function qs(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Hr(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const d=b=>{b===!1?l(Ns(Ut.NAVIGATION_ABORTED,{from:n,to:t})):b instanceof Error?l(b):Bg(b)?l(Ns(Ut.NAVIGATION_GUARD_REDIRECT,{from:t,to:b})):(i&&r.enterCallbacks[s]===i&&typeof b=="function"&&i.push(b),a())},c=o(()=>e.call(r&&r.instances[s],t,n,d));let h=Promise.resolve(c);e.length<3&&(h=h.then(d)),h.catch(b=>l(b))})}function Zi(e,t,n,r,s=o=>o()){const o=[];for(const i of e)for(const a in i.components){let l=i.components[a];if(!(t!=="beforeRouteEnter"&&!i.instances[a]))if(gf(l)){const d=(l.__vccOpts||l)[t];d&&o.push(Hr(d,n,r,i,a,s))}else{let d=l();o.push(()=>d.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const h=fg(c)?c.default:c;i.mods[a]=c,i.components[a]=h;const b=(h.__vccOpts||h)[t];return b&&Hr(b,n,r,i,a,s)()}))}}return o}function zg(e,t){const n=[],r=[],s=[],o=Math.max(t.matched.length,e.matched.length);for(let i=0;i<o;i++){const a=t.matched[i];a&&(e.matched.find(d=>Os(d,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(d=>Os(d,l))||s.push(l))}return[n,r,s]}/*!
22
- * vue-router v4.6.4
23
- * (c) 2025 Eduardo San Martin Morote
24
- * @license MIT
25
- */let Gg=()=>location.protocol+"//"+location.host;function If(e,t){const{pathname:n,search:r,hash:s}=t,o=e.indexOf("#");if(o>-1){let i=s.includes(e.slice(o))?e.slice(o).length:1,a=s.slice(i);return a[0]!=="/"&&(a="/"+a),$c(a,"")}return $c(n,e)+r+s}function qg(e,t,n,r){let s=[],o=[],i=null;const a=({state:b})=>{const T=If(e,location),N=n.value,O=t.value;let J=0;if(b){if(n.value=T,t.value=b,i&&i===N){i=null;return}J=O?b.position-O.position:0}else r(T);s.forEach(oe=>{oe(n.value,N,{delta:J,type:Oa.pop,direction:J?J>0?Xi.forward:Xi.back:Xi.unknown})})};function l(){i=n.value}function d(b){s.push(b);const T=()=>{const N=s.indexOf(b);N>-1&&s.splice(N,1)};return o.push(T),T}function c(){if(document.visibilityState==="hidden"){const{history:b}=window;if(!b.state)return;b.replaceState(_t({},b.state,{scroll:Ai()}),"")}}function h(){for(const b of o)b();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:d,destroy:h}}function jc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Ai():null}}function Kg(e){const{history:t,location:n}=window,r={value:If(e,n)},s={value:t.state};s.value||o(r.value,{back:null,current:r.value,forward:null,position:t.length-1,replaced:!0,scroll:null},!0);function o(l,d,c){const h=e.indexOf("#"),b=h>-1?(n.host&&document.querySelector("base")?e:e.slice(h))+l:Gg()+e+l;try{t[c?"replaceState":"pushState"](d,"",b),s.value=d}catch(T){console.error(T),n[c?"replace":"assign"](b)}}function i(l,d){o(l,_t({},t.state,jc(s.value.back,l,s.value.forward,!0),d,{position:s.value.position}),!0),r.value=l}function a(l,d){const c=_t({},s.value,t.state,{forward:l,scroll:Ai()});o(c.current,c,!0),o(l,_t({},jc(r.value,l,null),{position:c.position+1},d),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function Jg(e){e=Mg(e);const t=Kg(e),n=qg(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=_t({location:"",base:e,go:r,createHref:Og.bind(null,e)},t,n);return Object.defineProperty(s,"location",{enumerable:!0,get:()=>t.location.value}),Object.defineProperty(s,"state",{enumerable:!0,get:()=>t.state.value}),s}function Yg(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),Jg(e)}let us=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var qt=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.ParamRegExp=2]="ParamRegExp",e[e.ParamRegExpEnd=3]="ParamRegExpEnd",e[e.EscapeNext=4]="EscapeNext",e})(qt||{});const Qg={type:us.Static,value:""},Xg=/[a-zA-Z0-9_]/;function Zg(e){if(!e)return[[]];if(e==="/")return[[Qg]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(T){throw new Error(`ERR (${n})/"${d}": ${T}`)}let n=qt.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,d="",c="";function h(){d&&(n===qt.Static?o.push({type:us.Static,value:d}):n===qt.Param||n===qt.ParamRegExp||n===qt.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${d}) must be alone in its segment. eg: '/:ids+.`),o.push({type:us.Param,value:d,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),d="")}function b(){d+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==qt.ParamRegExp){r=n,n=qt.EscapeNext;continue}switch(n){case qt.Static:l==="/"?(d&&h(),i()):l===":"?(h(),n=qt.Param):b();break;case qt.EscapeNext:b(),n=r;break;case qt.Param:l==="("?n=qt.ParamRegExp:Xg.test(l)?b():(h(),n=qt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case qt.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=qt.ParamRegExpEnd:c+=l;break;case qt.ParamRegExpEnd:h(),n=qt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,c="";break;default:t("Unknown state");break}}return n===qt.ParamRegExp&&t(`Unfinished custom RegExp for param "${d}"`),h(),i(),s}const Bc="[^/]+?",ev={sensitive:!1,strict:!1,start:!0,end:!0};var gn=(function(e){return e[e._multiplier=10]="_multiplier",e[e.Root=90]="Root",e[e.Segment=40]="Segment",e[e.SubSegment=30]="SubSegment",e[e.Static=40]="Static",e[e.Dynamic=20]="Dynamic",e[e.BonusCustomRegExp=10]="BonusCustomRegExp",e[e.BonusWildcard=-50]="BonusWildcard",e[e.BonusRepeatable=-20]="BonusRepeatable",e[e.BonusOptional=-8]="BonusOptional",e[e.BonusStrict=.7000000000000001]="BonusStrict",e[e.BonusCaseSensitive=.25]="BonusCaseSensitive",e})(gn||{});const tv=/[.+*?^${}()[\]/\\]/g;function nv(e,t){const n=_t({},ev,t),r=[];let s=n.start?"^":"";const o=[];for(const d of e){const c=d.length?[]:[gn.Root];n.strict&&!d.length&&(s+="/");for(let h=0;h<d.length;h++){const b=d[h];let T=gn.Segment+(n.sensitive?gn.BonusCaseSensitive:0);if(b.type===us.Static)h||(s+="/"),s+=b.value.replace(tv,"\\$&"),T+=gn.Static;else if(b.type===us.Param){const{value:N,repeatable:O,optional:J,regexp:oe}=b;o.push({name:N,repeatable:O,optional:J});const L=oe||Bc;if(L!==Bc){T+=gn.BonusCustomRegExp;try{`${L}`}catch(te){throw new Error(`Invalid custom RegExp for param "${N}" (${L}): `+te.message)}}let ne=O?`((?:${L})(?:/(?:${L}))*)`:`(${L})`;h||(ne=J&&d.length<2?`(?:/${ne})`:"/"+ne),J&&(ne+="?"),s+=ne,T+=gn.Dynamic,J&&(T+=gn.BonusOptional),O&&(T+=gn.BonusRepeatable),L===".*"&&(T+=gn.BonusWildcard)}c.push(T)}r.push(c)}if(n.strict&&n.end){const d=r.length-1;r[d][r[d].length-1]+=gn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(d){const c=d.match(i),h={};if(!c)return null;for(let b=1;b<c.length;b++){const T=c[b]||"",N=o[b-1];h[N.name]=T&&N.repeatable?T.split("/"):T}return h}function l(d){let c="",h=!1;for(const b of e){(!h||!c.endsWith("/"))&&(c+="/"),h=!1;for(const T of b)if(T.type===us.Static)c+=T.value;else if(T.type===us.Param){const{value:N,repeatable:O,optional:J}=T,oe=N in d?d[N]:"";if(Xn(oe)&&!O)throw new Error(`Provided param "${N}" is an array but it is not repeatable (* or + modifiers)`);const L=Xn(oe)?oe.join("/"):oe;if(!L)if(J)b.length<2&&(c.endsWith("/")?c=c.slice(0,-1):h=!0);else throw new Error(`Missing required param "${N}"`);c+=L}}return c||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function rv(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=t[n]-e[n];if(r)return r;n++}return e.length<t.length?e.length===1&&e[0]===gn.Static+gn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===gn.Static+gn.Segment?1:-1:0}function Ef(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=rv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(Fc(r))return 1;if(Fc(s))return-1}return s.length-r.length}function Fc(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const sv={strict:!1,end:!0,sensitive:!1};function ov(e,t,n){const r=nv(Zg(e.path),n),s=_t(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function iv(e,t){const n=[],r=new Map;t=Mc(sv,t);function s(h){return r.get(h)}function o(h,b,T){const N=!T,O=Hc(h);O.aliasOf=T&&T.record;const J=Mc(t,h),oe=[O];if("alias"in h){const te=typeof h.alias=="string"?[h.alias]:h.alias;for(const be of te)oe.push(Hc(_t({},O,{components:T?T.record.components:O.components,path:be,aliasOf:T?T.record:O})))}let L,ne;for(const te of oe){const{path:be}=te;if(b&&be[0]!=="/"){const ce=b.record.path,me=ce[ce.length-1]==="/"?"":"/";te.path=b.record.path+(be&&me+be)}if(L=ov(te,b,J),T?T.alias.push(L):(ne=ne||L,ne!==L&&ne.alias.push(L),N&&h.name&&!Vc(L)&&i(h.name)),Cf(L)&&l(L),O.children){const ce=O.children;for(let me=0;me<ce.length;me++)o(ce[me],L,T&&T.children[me])}T=T||L}return ne?()=>{i(ne)}:oo}function i(h){if(Tf(h)){const b=r.get(h);b&&(r.delete(h),n.splice(n.indexOf(b),1),b.children.forEach(i),b.alias.forEach(i))}else{const b=n.indexOf(h);b>-1&&(n.splice(b,1),h.record.name&&r.delete(h.record.name),h.children.forEach(i),h.alias.forEach(i))}}function a(){return n}function l(h){const b=cv(h,n);n.splice(b,0,h),h.record.name&&!Vc(h)&&r.set(h.record.name,h)}function d(h,b){let T,N={},O,J;if("name"in h&&h.name){if(T=r.get(h.name),!T)throw Ns(Ut.MATCHER_NOT_FOUND,{location:h});J=T.record.name,N=_t(Uc(b.params,T.keys.filter(ne=>!ne.optional).concat(T.parent?T.parent.keys.filter(ne=>ne.optional):[]).map(ne=>ne.name)),h.params&&Uc(h.params,T.keys.map(ne=>ne.name))),O=T.stringify(N)}else if(h.path!=null)O=h.path,T=n.find(ne=>ne.re.test(O)),T&&(N=T.parse(O),J=T.record.name);else{if(T=b.name?r.get(b.name):n.find(ne=>ne.re.test(b.path)),!T)throw Ns(Ut.MATCHER_NOT_FOUND,{location:h,currentLocation:b});J=T.record.name,N=_t({},b.params,h.params),O=T.stringify(N)}const oe=[];let L=T;for(;L;)oe.unshift(L.record),L=L.parent;return{name:J,path:O,params:N,matched:oe,meta:lv(oe)}}e.forEach(h=>o(h));function c(){n.length=0,r.clear()}return{addRoute:o,resolve:d,removeRoute:i,clearRoutes:c,getRoutes:a,getRecordMatcher:s}}function Uc(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function Hc(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:av(e),children:e.children||[],instances:{},leaveGuards:new Set,updateGuards:new Set,enterCallbacks:{},components:"components"in e?e.components||null:e.component&&{default:e.component}};return Object.defineProperty(t,"mods",{value:{}}),t}function av(e){const t={},n=e.props||!1;if("component"in e)t.default=n;else for(const r in e.components)t[r]=typeof n=="object"?n[r]:n;return t}function Vc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function lv(e){return e.reduce((t,n)=>_t(t,n.meta),{})}function cv(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;Ef(e,t[o])<0?r=o:n=o+1}const s=uv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function uv(e){let t=e;for(;t=t.parent;)if(Cf(t)&&Ef(e,t)===0)return t}function Cf({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Wc(e){const t=qn(xi),n=qn(vl),r=pe(()=>{const l=ye(e.to);return t.resolve(l)}),s=pe(()=>{const{matched:l}=r.value,{length:d}=l,c=l[d-1],h=n.matched;if(!c||!h.length)return-1;const b=h.findIndex(Os.bind(null,c));if(b>-1)return b;const T=zc(l[d-2]);return d>1&&zc(c)===T&&h[h.length-1].path!==T?h.findIndex(Os.bind(null,l[d-2])):b}),o=pe(()=>s.value>-1&&mv(n.params,r.value.params)),i=pe(()=>s.value>-1&&s.value===n.matched.length-1&&kf(n.params,r.value.params));function a(l={}){if(pv(l)){const d=t[ye(e.replace)?"replace":"push"](ye(e.to)).catch(oo);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>d),d}return Promise.resolve()}return{route:r,href:pe(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function dv(e){return e.length===1?e[0]:e}const fv=Xt({name:"RouterLink",compatConfig:{MODE:3},props:{to:{type:[String,Object],required:!0},replace:Boolean,activeClass:String,exactActiveClass:String,custom:Boolean,ariaCurrentValue:{type:String,default:"page"},viewTransition:Boolean},useLink:Wc,setup(e,{slots:t}){const n=bi(Wc(e)),{options:r}=qn(xi),s=pe(()=>({[Gc(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Gc(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&dv(t.default(n));return e.custom?o:ml("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),hv=fv;function pv(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function mv(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!Xn(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function zc(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Gc=(e,t,n)=>e??t??n,gv=Xt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=qn(Da),s=pe(()=>e.route||r.value),o=qn(Lc,0),i=pe(()=>{let d=ye(o);const{matched:c}=s.value;let h;for(;(h=c[d])&&!h.components;)d++;return d}),a=pe(()=>s.value.matched[i.value]);Wo(Lc,pe(()=>i.value+1)),Wo(Wg,a),Wo(Da,s);const l=D();return gt(()=>[l.value,a.value,e.name],([d,c,h],[b,T,N])=>{c&&(c.instances[h]=d,T&&T!==c&&d&&d===b&&(c.leaveGuards.size||(c.leaveGuards=T.leaveGuards),c.updateGuards.size||(c.updateGuards=T.updateGuards))),d&&c&&(!T||!Os(c,T)||!b)&&(c.enterCallbacks[h]||[]).forEach(O=>O(d))},{flush:"post"}),()=>{const d=s.value,c=e.name,h=a.value,b=h&&h.components[c];if(!b)return qc(n.default,{Component:b,route:d});const T=h.props[c],N=T?T===!0?d.params:typeof T=="function"?T(d):T:null,J=ml(b,_t({},N,t,{onVnodeUnmounted:oe=>{oe.component.isUnmounted&&(h.instances[c]=null)},ref:l}));return qc(n.default,{Component:J,route:d})||J}}});function qc(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const vv=gv;function yv(e){const t=iv(e.routes,e),n=e.parseQuery||Hg,r=e.stringifyQuery||Dc,s=e.history,o=qs(),i=qs(),a=qs(),l=vp(jr);let d=jr;Ts&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=Yi.bind(null,V=>""+V),h=Yi.bind(null,Ig),b=Yi.bind(null,yo);function T(V,we){let he,Ce;return Tf(V)?(he=t.getRecordMatcher(V),Ce=we):Ce=V,t.addRoute(Ce,he)}function N(V){const we=t.getRecordMatcher(V);we&&t.removeRoute(we)}function O(){return t.getRoutes().map(V=>V.record)}function J(V){return!!t.getRecordMatcher(V)}function oe(V,we){if(we=_t({},we||l.value),typeof V=="string"){const M=Qi(n,V,we.path),K=t.resolve({path:M.path},we),F=s.createHref(M.fullPath);return _t(M,K,{params:b(K.params),hash:yo(M.hash),redirectedFrom:void 0,href:F})}let he;if(V.path!=null)he=_t({},V,{path:Qi(n,V.path,we.path).path});else{const M=_t({},V.params);for(const K in M)M[K]==null&&delete M[K];he=_t({},V,{params:h(M)}),we.params=h(we.params)}const Ce=t.resolve(he,we),xe=V.hash||"";Ce.params=c(b(Ce.params));const k=Ag(r,_t({},V,{hash:kg(xe),path:Ce.path})),I=s.createHref(k);return _t({fullPath:k,hash:xe,query:r===Dc?Vg(V.query):V.query||{}},Ce,{redirectedFrom:void 0,href:I})}function L(V){return typeof V=="string"?Qi(n,V,l.value.path):_t({},V)}function ne(V,we){if(d!==V)return Ns(Ut.NAVIGATION_CANCELLED,{from:we,to:V})}function te(V){return me(V)}function be(V){return te(_t(L(V),{replace:!0}))}function ce(V,we){const he=V.matched[V.matched.length-1];if(he&&he.redirect){const{redirect:Ce}=he;let xe=typeof Ce=="function"?Ce(V,we):Ce;return typeof xe=="string"&&(xe=xe.includes("?")||xe.includes("#")?xe=L(xe):{path:xe},xe.params={}),_t({query:V.query,hash:V.hash,params:xe.path!=null?{}:V.params},xe)}}function me(V,we){const he=d=oe(V),Ce=l.value,xe=V.state,k=V.force,I=V.replace===!0,M=ce(he,Ce);if(M)return me(_t(L(M),{state:typeof M=="object"?_t({},xe,M.state):xe,force:k,replace:I}),we||he);const K=he;K.redirectedFrom=we;let F;return!k&&xg(r,Ce,he)&&(F=Ns(Ut.NAVIGATION_DUPLICATED,{to:K,from:Ce}),Be(Ce,Ce,!0,!1)),(F?Promise.resolve(F):Q(K,Ce)).catch(R=>wr(R)?wr(R,Ut.NAVIGATION_GUARD_REDIRECT)?R:ze(R):Ae(R,K,Ce)).then(R=>{if(R){if(wr(R,Ut.NAVIGATION_GUARD_REDIRECT))return me(_t({replace:I},L(R.to),{state:typeof R.to=="object"?_t({},xe,R.to.state):xe,force:k}),we||K)}else R=ee(K,Ce,!0,I,xe);return le(K,Ce,R),R})}function Oe(V,we){const he=ne(V,we);return he?Promise.reject(he):Promise.resolve()}function ae(V){const we=it.values().next().value;return we&&typeof we.runWithContext=="function"?we.runWithContext(V):V()}function Q(V,we){let he;const[Ce,xe,k]=zg(V,we);he=Zi(Ce.reverse(),"beforeRouteLeave",V,we);for(const M of Ce)M.leaveGuards.forEach(K=>{he.push(Hr(K,V,we))});const I=Oe.bind(null,V,we);return he.push(I),Ve(he).then(()=>{he=[];for(const M of o.list())he.push(Hr(M,V,we));return he.push(I),Ve(he)}).then(()=>{he=Zi(xe,"beforeRouteUpdate",V,we);for(const M of xe)M.updateGuards.forEach(K=>{he.push(Hr(K,V,we))});return he.push(I),Ve(he)}).then(()=>{he=[];for(const M of k)if(M.beforeEnter)if(Xn(M.beforeEnter))for(const K of M.beforeEnter)he.push(Hr(K,V,we));else he.push(Hr(M.beforeEnter,V,we));return he.push(I),Ve(he)}).then(()=>(V.matched.forEach(M=>M.enterCallbacks={}),he=Zi(k,"beforeRouteEnter",V,we,ae),he.push(I),Ve(he))).then(()=>{he=[];for(const M of i.list())he.push(Hr(M,V,we));return he.push(I),Ve(he)}).catch(M=>wr(M,Ut.NAVIGATION_CANCELLED)?M:Promise.reject(M))}function le(V,we,he){a.list().forEach(Ce=>ae(()=>Ce(V,we,he)))}function ee(V,we,he,Ce,xe){const k=ne(V,we);if(k)return k;const I=we===jr,M=Ts?history.state:{};he&&(Ce||I?s.replace(V.fullPath,_t({scroll:I&&M&&M.scroll},xe)):s.push(V.fullPath,xe)),l.value=V,Be(V,we,he,I),ze()}let Pe;function Ne(){Pe||(Pe=s.listen((V,we,he)=>{if(!ct.listening)return;const Ce=oe(V),xe=ce(Ce,ct.currentRoute.value);if(xe){me(_t(xe,{replace:!0,force:!0}),Ce).catch(oo);return}d=Ce;const k=l.value;Ts&&Lg(Nc(k.fullPath,he.delta),Ai()),Q(Ce,k).catch(I=>wr(I,Ut.NAVIGATION_ABORTED|Ut.NAVIGATION_CANCELLED)?I:wr(I,Ut.NAVIGATION_GUARD_REDIRECT)?(me(_t(L(I.to),{force:!0}),Ce).then(M=>{wr(M,Ut.NAVIGATION_ABORTED|Ut.NAVIGATION_DUPLICATED)&&!he.delta&&he.type===Oa.pop&&s.go(-1,!1)}).catch(oo),Promise.reject()):(he.delta&&s.go(-he.delta,!1),Ae(I,Ce,k))).then(I=>{I=I||ee(Ce,k,!1),I&&(he.delta&&!wr(I,Ut.NAVIGATION_CANCELLED)?s.go(-he.delta,!1):he.type===Oa.pop&&wr(I,Ut.NAVIGATION_ABORTED|Ut.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),le(Ce,k,I)}).catch(oo)}))}let qe=qs(),He=qs(),Fe;function Ae(V,we,he){ze(V);const Ce=He.list();return Ce.length?Ce.forEach(xe=>xe(V,we,he)):console.error(V),Promise.reject(V)}function rt(){return Fe&&l.value!==jr?Promise.resolve():new Promise((V,we)=>{qe.add([V,we])})}function ze(V){return Fe||(Fe=!V,Ne(),qe.list().forEach(([we,he])=>V?he(V):we()),qe.reset()),V}function Be(V,we,he,Ce){const{scrollBehavior:xe}=e;if(!Ts||!xe)return Promise.resolve();const k=!he&&jg(Nc(V.fullPath,0))||(Ce||!he)&&history.state&&history.state.scroll||null;return Kt().then(()=>xe(V,we,k)).then(I=>I&&Dg(I)).catch(I=>Ae(I,V,we))}const lt=V=>s.go(V);let Dt;const it=new Set,ct={currentRoute:l,listening:!0,addRoute:T,removeRoute:N,clearRoutes:t.clearRoutes,hasRoute:J,getRoutes:O,resolve:oe,options:e,push:te,replace:be,go:lt,back:()=>lt(-1),forward:()=>lt(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:He.add,isReady:rt,install(V){V.component("RouterLink",hv),V.component("RouterView",vv),V.config.globalProperties.$router=ct,Object.defineProperty(V.config.globalProperties,"$route",{enumerable:!0,get:()=>ye(l)}),Ts&&!Dt&&l.value===jr&&(Dt=!0,te(s.location).catch(Ce=>{}));const we={};for(const Ce in jr)Object.defineProperty(we,Ce,{get:()=>l.value[Ce],enumerable:!0});V.provide(xi,ct),V.provide(vl,kd(we)),V.provide(Da,l);const he=V.unmount;it.add(V),V.unmount=function(){it.delete(V),it.size<1&&(d=jr,Pe&&Pe(),Pe=null,l.value=jr,Dt=!1,Fe=!1),he()}}};function Ve(V){return V.reduce((we,he)=>we.then(()=>ae(he)),Promise.resolve())}return ct}function wv(){return qn(xi)}function bv(e){return qn(vl)}const Kc=768;function Af(){const e=D(typeof window<"u"?window.innerWidth<Kc:!1);let t=null;function n(r){e.value=r.matches}return Nr(()=>{t=window.matchMedia(`(max-width: ${Kc-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Si(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const _v={key:0,class:"desktop-sidebar"},kv={class:"desktop-main"},Jc="codex-web-local.sidebar-width.v1",Tv=260,Sv=620,Yc=320,Iv=Xt({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Af();function r(d){return Math.min(Sv,Math.max(Tv,d))}function s(){if(typeof window>"u")return Yc;const d=window.localStorage.getItem(Jc),c=Number(d);return Number.isFinite(c)?r(c):Yc}const o=D(s()),i=pe(()=>n.value||t.isSidebarCollapsed?{"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{"--sidebar-width":`${o.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"});function a(d){typeof window>"u"||window.localStorage.setItem(Jc,String(d))}function l(d){d.preventDefault();const c=d.clientX,h=o.value,b=N=>{const O=N.clientX-c;o.value=r(h+O)},T=()=>{a(o.value),window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",T)};window.addEventListener("mousemove",b),window.addEventListener("mouseup",T)}return(d,c)=>(m(),w("div",{class:ft(["desktop-layout",{"is-mobile":ye(n)}]),style:qr(i.value)},[ye(n)?(m(),mt(to,{key:0,to:"body"},[De(mf,{name:"drawer"},{default:bt(()=>[e.isSidebarCollapsed?ue("",!0):(m(),w("div",{key:0,class:"mobile-drawer-backdrop",onClick:c[1]||(c[1]=h=>d.$emit("close-sidebar"))},[y("aside",{class:"mobile-drawer",onClick:c[0]||(c[0]=yt(()=>{},["stop"]))},[ur(d.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ue("",!0),ye(n)?ue("",!0):(m(),w($e,{key:1},[e.isSidebarCollapsed?ue("",!0):(m(),w("aside",_v,[ur(d.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ue("",!0):(m(),w("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),y("section",kv,[ur(d.$slots,"content",{},void 0)])],6))}}),ht=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Ev=ht(Iv,[["__scopeId","data-v-df29c633"]]),Cv={},Av={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function xv(e,t){return m(),w("svg",Av,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Pi=ht(Cv,[["render",xv]]),Pv={},Rv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Mv(e,t){return m(),w("svg",Rv,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const xf=ht(Pv,[["render",Mv]]),$v={},Ov={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Nv(e,t){return m(),w("svg",Ov,[...t[0]||(t[0]=[y("path",{fill:"currentColor",d:"M6 12a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const Ks=ht($v,[["render",Nv]]),Dv={},Lv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function jv(e,t){return m(),w("svg",Lv,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 20h4L18.5 9.5a2.828 2.828 0 1 0-4-4L4 16zm9.5-13.5l4 4"},null,-1)])])}const li=ht(Dv,[["render",jv]]),Bv={},Fv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Uv(e,t){return m(),w("svg",Fv,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2"},null,-1)])])}const yl=ht(Bv,[["render",Uv]]),Hv={},Vv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Wv(e,t){return m(),w("svg",Vv,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m5 19l2.757-7.351A1 1 0 0 1 8.693 11H21a1 1 0 0 1 .986 1.164l-.996 5.211A2 2 0 0 1 19.026 19za2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2"},null,-1)])])}const zv=ht(Hv,[["render",Wv]]),Gv={},qv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Kv(e,t){return m(),w("svg",qv,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 18v-6m0 0a4 4 0 0 1 4-4h2m-6 4a4 4 0 0 0-4-4H6m0-4a2 2 0 1 0 0 4a2 2 0 0 0 0-4m12 0a2 2 0 1 0 0 4a2 2 0 0 0 0-4m-6 14a2 2 0 1 0 0 4a2 2 0 0 0 0-4"},null,-1)])])}const Ko=ht(Gv,[["render",Kv]]),Jv={},Yv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Qv(e,t){return m(),w("svg",Yv,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 4.5l-4 4L7 10l-1.5 1.5l7 7L14 17l1.5-4l4-4M9 15l-4.5 4.5M14.5 4L20 9.5"},null,-1)])])}const ea=ht(Jv,[["render",Qv]]),Xv={key:0,class:"sidebar-menu-row-left"},Zv={class:"sidebar-menu-row-main"},ey={key:1,class:"sidebar-menu-row-right"},ty={key:0,class:"sidebar-menu-row-right-default"},ny={key:1,class:"sidebar-menu-row-right-hover"},ry=Xt({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=qp(),r=pe(()=>!!n.left),s=pe(()=>!!n.right),o=pe(()=>!!n["right-hover"]),i=pe(()=>s.value||o.value);return(a,l)=>(m(),mt(si(t.as),cf({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":i.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},a.$attrs),{default:bt(()=>[r.value?(m(),w("span",Xv,[ur(a.$slots,"left",{},void 0,!0)])):ue("",!0),y("span",Zv,[ur(a.$slots,"default",{},void 0,!0)]),i.value?(m(),w("span",ey,[s.value?(m(),w("span",ty,[ur(a.$slots,"right",{},void 0,!0)])):ue("",!0),o.value?(m(),w("span",ny,[ur(a.$slots,"right-hover",{},void 0,!0)])):ue("",!0)])):ue("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),os=ht(ry,[["__scopeId","data-v-36239f39"]]),sy={class:"thread-tree-root"},oy={key:0,class:"pinned-section"},iy={class:"thread-list"},ay=["data-menu-open"],ly={class:"thread-left-stack"},cy=["data-state"],uy=["onClick"],dy=["onClick"],fy={class:"thread-row-title-wrap"},hy={class:"thread-row-title"},py={class:"thread-row-time"},my=["onClick"],gy=["aria-expanded"],vy=["data-active"],yy={key:0},wy=["data-active"],by={key:0},_y={key:1,class:"thread-tree-no-results"},ky={key:2,class:"thread-tree-loading"},Ty={key:3,class:"thread-list thread-list-global"},Sy=["data-menu-open"],Iy={class:"thread-left-stack"},Ey=["data-state"],Cy=["onClick"],Ay=["onClick"],xy={class:"thread-row-title-wrap"},Py={class:"thread-row-title"},Ry={class:"thread-row-time"},My=["onClick"],$y=["data-project-name","data-expanded","data-dragging"],Oy={class:"project-icon-stack"},Ny={class:"project-icon-folder"},Dy={class:"project-icon-chevron"},Ly=["data-dragging-handle","onMousedown"],jy={class:"project-title"},By={class:"project-hover-controls"},Fy=["onClick"],Uy=["data-open-direction"],Hy=["onClick"],Vy=["onClick"],Wy=["onClick"],zy=["onInput"],Gy=["aria-label","title","onClick"],qy={key:0,class:"thread-list"},Ky=["data-menu-open"],Jy={class:"thread-left-stack"},Yy=["data-state"],Qy=["onClick"],Xy=["onClick"],Zy={class:"thread-row-title-wrap"},ew={class:"thread-row-title"},tw={class:"thread-row-time"},nw=["onClick"],rw=["onClick"],sw=["data-open-direction"],ow={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},iw=["onKeydown"],aw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},lw={class:"rename-thread-subtitle"},cw=4,Qc=6,Xc="codex-web-local.thread-view-mode.v1",Zc="codex-web-local.collapsed-projects.v1",uw=Xt({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-project-files","rename-project","rename-thread","remove-project","reorder-project","export-thread"],setup(e,{emit:t}){const n=e,r=t,s=D({}),o=D({}),i=D([]),a=D(""),l=D(""),d=D({}),c=D({}),h=D({}),b=D("actions"),T=D(""),N=D(!1),O=D(""),J=D(""),oe=D(null),L=D(!1),ne=D(""),te=D(""),be=D(null),ce=D(null),me=D(null);let Oe=null,ae=null;const Q=D(""),le=D({}),ee=new Map,Pe=new Map,Ne=new Map,qe=new WeakMap,He=D(null),Fe=D(null),Ae=D(!1),rt=D(lt()),ze=typeof window<"u"?new ResizeObserver(S=>{for(const x of S){const $=x.target,Z=qe.get($);Z&&In(Z,$)}}):null;function Be(){if(typeof window>"u")return{};try{const S=window.localStorage.getItem(Zc);if(!S)return{};const x=JSON.parse(S);return!x||typeof x!="object"||Array.isArray(x)?{}:x}catch{return{}}}function lt(){return typeof window>"u"?"project":window.localStorage.getItem(Xc)==="chronological"?"chronological":"project"}o.value=Be(),gt(o,S=>{typeof window>"u"||window.localStorage.setItem(Zc,JSON.stringify(S))},{deep:!0}),gt(rt,S=>{typeof window>"u"||window.localStorage.setItem(Xc,S)});const Dt=pe(()=>n.searchQuery.trim().toLowerCase()),it=pe(()=>Dt.value.length>0),ct=pe(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function Ve(S){if(!it.value)return!0;if(ct.value)return ct.value.has(S.id);const x=Dt.value;return S.title.toLowerCase().includes(x)||S.preview.toLowerCase().includes(x)}const V=pe(()=>it.value?n.groups.map(S=>({...S,threads:S.threads.filter(Ve)})).filter(S=>S.threads.length>0):n.groups),we=pe(()=>rt.value==="chronological"),he=pe(()=>{const S=V.value,x=[];for(const $ of S)for(const Z of $.threads)H(Z.id)||x.push(Z);return x.sort(($,Z)=>{const We=new Date($.updatedAtIso||$.createdAtIso).getTime();return new Date(Z.updatedAtIso||Z.createdAtIso).getTime()-We})}),Ce=pe(()=>{const S=new Map;for(const x of n.groups)for(const $ of x.threads)S.set($.id,$);return S}),xe=pe(()=>{const S=l.value;return S?Ce.value.get(S)??null:null}),k=pe(()=>i.value.map(S=>Ce.value.get(S)??null).filter(S=>S!==null).filter(Ve)),I=pe(()=>{const S=me.value;if(!S||S.dropTargetIndexFull===null||n.groups.length===0)return null;const x=Math.max(0,Math.min(S.dropTargetIndexFull,n.groups.length)),$=x>S.fromIndex?x-1:x,Z=Math.max(0,Math.min($,n.groups.length-1));return Z===S.fromIndex?null:Z}),M=pe(()=>{const x=(it.value?V.value:n.groups).map(Zt=>Zt.projectName),$=me.value,Z=I.value;if(!$||Z===null)return x;const We=[...x],[Mt]=We.splice($.fromIndex,1);return Mt?(We.splice(Z,0,Mt),We):x}),K=pe(()=>{const S={};let x=0;for(const $ of M.value)S[$]=x,x+=$n($);return S}),F=pe(()=>{let S=0;for(const x of M.value)S+=$n(x);return{height:`${Math.max(0,S)}px`}});function R(S){const x=new Date(S).getTime();if(Number.isNaN(x))return"n/a";const $=Math.abs(Date.now()-x);if($<6e4)return"now";const Z=Math.floor($/6e4);if(Z<60)return`${Z}m`;const We=Math.floor(Z/60);return We<24?`${We}h`:`${Math.floor(We/24)}d`}function H(S){return i.value.includes(S)}function U(S){if(H(S)){i.value=i.value.filter(x=>x!==S);return}i.value=[S,...i.value]}function z(S){r("select",S)}function G(S){r("export-thread",S),Ie()}function Te(S){return`start new thread ${Ot(S)}`}function ve(S){r("start-new-thread",S)}function _e(S){return l.value===S}function Ie(){l.value="",h.value={}}function Ue(S){if(l.value===S){Ie();return}st(),Ae.value=!1,l.value=S,Kt(()=>{Re(S)})}function tt(S,x){O.value=S,J.value=x,N.value=!0,Ie(),Kt(()=>{var $,Z;($=oe.value)==null||$.focus(),(Z=oe.value)==null||Z.select()})}function Qe(){N.value=!1,O.value="",J.value=""}function ut(){const S=O.value,x=J.value.trim();!S||!x||(r("rename-thread",{threadId:S,title:x}),Qe())}function et(S,x){ne.value=S,te.value=x,L.value=!0,Ie()}function pt(){L.value=!1,ne.value="",te.value=""}function Ke(){const S=ne.value;S&&(i.value=i.value.filter(x=>x!==S),r("archive",S),pt())}function Ot(S){return n.projectDisplayNameById[S]??S}function dn(S){return a.value===S}function st(){a.value="",b.value="actions",T.value=""}function vt(){const S=!Ae.value;S&&(st(),Ie()),Ae.value=S}function at(S){rt.value=S,Ae.value=!1}function Vt(S){if(a.value===S){st();return}Ie(),Ae.value=!1,a.value=S,b.value="actions",T.value=Ot(S),Kt(()=>{Hn(S)})}function Rt(S){Ie(),a.value=S,b.value="rename",T.value=Ot(S),Kt(()=>{Hn(S)})}function Et(S){r("rename-project",{projectName:S,displayName:T.value})}function Bn(S){r("remove-project",S),st()}function _n(S){r("browse-project-files",S),st()}function kn(S,x){if(!S.altKey||S.key!=="ArrowUp"&&S.key!=="ArrowDown")return;const $=n.groups.findIndex(Mt=>Mt.projectName===x);if($<0)return;const Z=S.key==="ArrowUp"?-1:1,We=Math.max(0,Math.min($+Z,n.groups.length-1));We!==$&&(S.preventDefault(),r("reorder-project",{projectName:x,toIndex:We}))}function jt(S){return s.value[S]===!0}function Wt(S){return o.value[S]===!0}function fn(S){s.value={...s.value,[S]:!jt(S)}}function Mn(S){if(Q.value===S){Q.value="";return}o.value={...o.value,[S]:!Wt(S)}}function $n(S){const x=le.value[S]??0,$=me.value,We=(($==null?void 0:$.projectName)===S?$.groupHeight:null)??x,Mt=Wt(S)?0:Qc;return Math.max(0,We+Mt)}function Fn(S,x){const $=x instanceof HTMLElement?x:x&&"$el"in x&&x.$el instanceof HTMLElement?x.$el:null;if($){Pe.set(S,$);return}Pe.delete(S)}function tn(S,x){const $=x instanceof HTMLElement?x:x&&"$el"in x&&x.$el instanceof HTMLElement?x.$el:null;if($){Ne.set(S,$);return}Ne.delete(S)}function Tn(S){let x=S.parentElement;for(;x;){const $=window.getComputedStyle(x),Z=$.overflowY||$.overflow;if(Z==="auto"||Z==="scroll"||Z==="hidden"||Z==="clip")return x.getBoundingClientRect();x=x.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function Un(S,x){const $=S.getBoundingClientRect(),Z=Tn(S),We=6,Mt=Z.bottom-$.bottom,Zt=$.top-Z.top;return Mt>=x+We?"down":Zt>Mt?"up":"down"}function pr(S,x){const $=Ne.get(S);if(!$)return"down";const Z=Un($,x);return c.value={...c.value,[S]:Z},Z}function mr(S){return c.value[S]??"down"}function Hn(S){const x=Pe.get(S);x&&(d.value={...d.value,[S]:Un(x,112)})}function Le(S,x,$){return Math.min(Math.max(S,x),$)}function Re(S){const x=Ne.get(S);if(!x)return;const $=Fe.value,Z=$==null?void 0:$.getBoundingClientRect(),We=(Z==null?void 0:Z.height)||($==null?void 0:$.offsetHeight)||112,Mt=(Z==null?void 0:Z.width)||($==null?void 0:$.offsetWidth)||160,Zt=pr(S,We),Pn=x.getBoundingClientRect(),nn=8,pn=4,Vn=Math.max(nn,window.innerWidth-Mt-nn),gr=Le(Pn.right-Mt,nn,Vn),er=Le(Zt==="up"?Pn.top-We-pn:Pn.bottom+pn,nn,Math.max(nn,window.innerHeight-We-nn));h.value={left:`${Math.round(gr)}px`,top:`${Math.round(er)}px`}}function Sn(){const S=l.value;S&&Re(S)}function Bt(){window.addEventListener("resize",Sn),document.addEventListener("scroll",Sn,!0)}function Cn(){window.removeEventListener("resize",Sn),document.removeEventListener("scroll",Sn,!0)}function On(S){const x=a.value;if(!x)return!1;const $=Pe.get(x);if(!$)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes($))return!0;const We=S.target;return We instanceof Node?$.contains(We):!1}function hn(S){const x=l.value;if(!x)return!1;const $=Ne.get(x);if(!$)return!1;if((typeof S.composedPath=="function"?S.composedPath():[]).includes($))return!0;const We=S.target;return We instanceof Node?$.contains(We):!1}function zt(S){if(Ae.value){const x=He.value,$=typeof S.composedPath=="function"?S.composedPath():[];!!x&&($.includes(x)||S.target instanceof Node&&x.contains(S.target))||(Ae.value=!1)}a.value&&(On(S)||st(),l.value&&(hn(S)||Ie()))}function Nn(S){a.value&&!On(S)&&st(),l.value&&!hn(S)&&Ie()}function An(){Ae.value&&(Ae.value=!1),a.value&&st(),l.value&&Ie()}function Zn(){window.addEventListener("pointerdown",zt,{capture:!0}),window.addEventListener("focusin",Nn,{capture:!0}),window.addEventListener("blur",An)}function xn(){window.removeEventListener("pointerdown",zt,{capture:!0}),window.removeEventListener("focusin",Nn,{capture:!0}),window.removeEventListener("blur",An)}function In(S,x){const $=x.getBoundingClientRect().height;if(!Number.isFinite($)||$<=0)return;const Z=le.value[S];Z!==void 0&&Math.abs(Z-$)<.5||(le.value={...le.value,[S]:$})}function C(S,x){const $=ee.get(S);$&&$!==x&&ze&&ze.unobserve($);const Z=x instanceof HTMLElement?x:x&&"$el"in x&&x.$el instanceof HTMLElement?x.$el:null;if(Z){ee.set(S,Z),qe.set(Z,S),In(S,Z),ze==null||ze.observe(Z);return}$&&(ze==null||ze.unobserve($)),ee.delete(S)}function j(S,x){if(S.button!==0||ce.value||me.value)return;const $=n.groups.findIndex(Zt=>Zt.projectName===x),Z=ee.get(x);if($<0||!Z)return;const We=Z.getBoundingClientRect(),Mt=Wt(x)?0:Qc;ce.value={projectName:x,fromIndex:$,startClientX:S.clientX,startClientY:S.clientY,pointerOffsetY:S.clientY-We.top,groupLeft:We.left,groupWidth:We.width,groupHeight:We.height,groupOuterHeight:We.height+Mt},S.preventDefault(),re()}function re(){window.addEventListener("mousemove",g),window.addEventListener("mouseup",p),window.addEventListener("keydown",v)}function je(){window.removeEventListener("mousemove",g),window.removeEventListener("mouseup",p),window.removeEventListener("keydown",v)}function g(S){Oe={clientX:S.clientX,clientY:S.clientY},B()}function p(S){q({clientX:S.clientX,clientY:S.clientY});const x=me.value;if(x&&I.value!==null){const $=n.groups.findIndex(Z=>Z.projectName===x.projectName);if($>=0){const Z=I.value;Z!==$&&r("reorder-project",{projectName:x.projectName,toIndex:Z})}}P()}function v(S){S.key==="Escape"&&(!ce.value&&!me.value||(S.preventDefault(),P()))}function P(){ae!==null&&(window.cancelAnimationFrame(ae),ae=null),Oe=null,ce.value=null,me.value=null,Q.value="",je()}function B(){ae===null&&(ae=window.requestAnimationFrame(()=>{if(ae=null,!Oe)return;const S=Oe;Oe=null,q(S)}))}function q(S){const x=ce.value;if(!me.value&&x){const $=S.clientX-x.startClientX,Z=S.clientY-x.startClientY;if(Math.hypot($,Z)<cw)return;st(),Q.value=x.projectName,me.value={projectName:x.projectName,fromIndex:x.fromIndex,pointerOffsetY:x.pointerOffsetY,groupLeft:x.groupLeft,groupWidth:x.groupWidth,groupHeight:x.groupHeight,groupOuterHeight:x.groupOuterHeight,ghostTop:S.clientY-x.pointerOffsetY,dropTargetIndexFull:null}}me.value&&Ee(S)}function Ee(S){const x=me.value;if(!x)return;if(x.ghostTop=S.clientY-x.pointerOffsetY,!X(S)){x.dropTargetIndexFull=null;return}const $=S.clientY,Z=be.value;if(!Z){x.dropTargetIndexFull=null;return}const We=Z.getBoundingClientRect(),Mt=new Map(n.groups.map((pn,Vn)=>[pn.projectName,Vn])),Zt=n.groups.map(pn=>pn.projectName).filter(pn=>pn!==x.projectName);let Pn=0,nn=n.groups.length;for(const pn of Zt){const Vn=Mt.get(pn);if(Vn===void 0)continue;const gr=$n(pn),er=We.top+Pn+gr/2;if($<er){nn=Vn;break}Pn+=gr}x.dropTargetIndexFull=nn}function X(S){const x=be.value;if(!x)return!1;const $=x.getBoundingClientRect(),Z=S.clientX>=$.left&&S.clientX<=$.right,We=S.clientY>=$.top-32&&S.clientY<=$.bottom+32;return Z&&We}function ke(S){var x;return((x=me.value)==null?void 0:x.projectName)===S}function fe(S){const x=me.value,$=K.value[S]??0,Z=a.value===S;return!x||x.projectName!==S?{position:"absolute",top:"0",left:"0",right:"0",zIndex:Z?"40":"1",transform:`translate3d(0, ${$}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${x.groupLeft}px`,width:`${x.groupWidth}px`,height:`${x.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${x.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Je(S){return S.threads.filter(x=>!H(x.id))}function Ft(S){if(it.value)return Je(S);if(Wt(S.projectName))return[];const x=Je(S);return jt(S.projectName)?x:x.slice(0,10)}function Ht(S){return it.value?!1:!Wt(S.projectName)&&Je(S).length>10}function Ct(S){return Je(S).length>0}function Gt(S){return S.inProgress?"working":S.unread?"unread":"idle"}gt(()=>n.groups.map(S=>S.projectName),S=>{var We,Mt;const x=((We=me.value)==null?void 0:We.projectName)??((Mt=ce.value)==null?void 0:Mt.projectName)??"";x&&!n.groups.some(Zt=>Zt.projectName===x)&&P();const $=new Set(S),Z=Object.fromEntries(Object.entries(le.value).filter(([Zt])=>$.has(Zt)));Object.keys(Z).length!==Object.keys(le.value).length&&(le.value=Z)});const Us=pe(()=>Ae.value||a.value!==""||l.value!=="");return gt(Us,S=>{if(S){Zn();return}xn()}),gt(l,S=>{if(!S){Cn();return}Bt(),Kt(()=>{Re(S)})}),Dr(()=>{for(const S of ee.values())ze==null||ze.unobserve(S);ee.clear(),Pe.clear(),Cn(),xn(),P()}),(S,x)=>(m(),w("section",sy,[k.value.length>0?(m(),w("section",oy,[y("ul",iy,[(m(!0),w($e,null,dt(k.value,$=>(m(),w("li",{key:$.id,class:"thread-row-item","data-menu-open":_e($.id)?"true":"false"},[De(os,{class:"thread-row","data-active":$.id===e.selectedThreadId,"data-pinned":H($.id),"data-menu-open":_e($.id)?"true":"false","force-right-hover":_e($.id)},{left:bt(()=>[y("span",ly,[$.inProgress||$.unread?(m(),w("span",{key:0,class:"thread-status-indicator","data-state":Gt($)},null,8,cy)):ue("",!0),y("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Z=>U($.id)},[De(ea,{class:"thread-icon"})],8,uy)])]),right:bt(()=>[y("span",py,W(R($.createdAtIso||$.updatedAtIso)),1)]),"right-hover":bt(()=>[y("div",{ref_for:!0,ref:Z=>tn($.id,Z),class:"thread-menu-wrap"},[y("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:yt(Z=>Ue($.id),["stop"])},[De(Ks,{class:"thread-icon"})],8,my)],512)]),default:bt(()=>[y("button",{class:"thread-main-button",type:"button",onClick:Z=>z($.id)},[y("span",fy,[y("span",hy,W($.title),1),$.hasWorktree?(m(),mt(Ko,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ue("",!0)])],8,dy)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,ay))),128))])])):ue("",!0),De(os,{as:"header",class:"thread-tree-header-row"},{right:bt(()=>[y("div",{ref_key:"organizeMenuWrapRef",ref:He,class:"organize-menu-wrap"},[y("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Ae.value,"aria-label":"Organize threads",title:"Organize threads",onClick:vt},[De(Ks,{class:"thread-icon"})],8,gy),Ae.value?(m(),w("div",{key:0,class:"organize-menu-panel",onClick:x[2]||(x[2]=yt(()=>{},["stop"]))},[x[12]||(x[12]=y("p",{class:"organize-menu-title"},"Organize",-1)),y("button",{class:"organize-menu-item","data-active":rt.value==="project",type:"button",onClick:x[0]||(x[0]=$=>at("project"))},[x[10]||(x[10]=y("span",null,"By project",-1)),rt.value==="project"?(m(),w("span",yy,"✓")):ue("",!0)],8,vy),y("button",{class:"organize-menu-item","data-active":rt.value==="chronological",type:"button",onClick:x[1]||(x[1]=$=>at("chronological"))},[x[11]||(x[11]=y("span",null,"Chronological list",-1)),rt.value==="chronological"?(m(),w("span",by,"✓")):ue("",!0)],8,wy)])):ue("",!0)],512)]),default:bt(()=>[x[13]||(x[13]=y("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),it.value&&V.value.length===0?(m(),w("p",_y,"No matching threads")):e.isLoading&&e.groups.length===0?(m(),w("p",ky,"Loading threads...")):we.value?(m(),w("ul",Ty,[(m(!0),w($e,null,dt(he.value,$=>(m(),w("li",{key:$.id,class:"thread-row-item","data-menu-open":_e($.id)?"true":"false"},[De(os,{class:"thread-row","data-active":$.id===e.selectedThreadId,"data-pinned":H($.id),"data-menu-open":_e($.id)?"true":"false","force-right-hover":_e($.id)},{left:bt(()=>[y("span",Iy,[$.inProgress||$.unread?(m(),w("span",{key:0,class:"thread-status-indicator","data-state":Gt($)},null,8,Ey)):ue("",!0),y("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Z=>U($.id)},[De(ea,{class:"thread-icon"})],8,Cy)])]),right:bt(()=>[y("span",Ry,W(R($.createdAtIso||$.updatedAtIso)),1)]),"right-hover":bt(()=>[y("div",{ref_for:!0,ref:Z=>tn($.id,Z),class:"thread-menu-wrap"},[y("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:yt(Z=>Ue($.id),["stop"])},[De(Ks,{class:"thread-icon"})],8,My)],512)]),default:bt(()=>[y("button",{class:"thread-main-button",type:"button",onClick:Z=>z($.id)},[y("span",xy,[y("span",Py,W($.title),1),$.hasWorktree?(m(),mt(Ko,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ue("",!0)])],8,Ay)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,Sy))),128))])):(m(),w("div",{key:4,ref_key:"groupsContainerRef",ref:be,class:"thread-tree-groups",style:qr(F.value)},[(m(!0),w($e,null,dt(V.value,$=>(m(),w("article",{key:$.projectName,ref_for:!0,ref:Z=>C($.projectName,Z),class:"project-group","data-project-name":$.projectName,"data-expanded":!Wt($.projectName),"data-dragging":ke($.projectName),style:qr(fe($.projectName))},[De(os,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:Z=>Mn($.projectName),onKeydown:[Z=>kn(Z,$.projectName),yn(yt(Z=>Mn($.projectName),["prevent"]),["enter"]),yn(yt(Z=>Mn($.projectName),["prevent"]),["space"])]},{left:bt(()=>[y("span",Oy,[y("span",Ny,[Wt($.projectName)?(m(),mt(yl,{key:0,class:"thread-icon"})):(m(),mt(zv,{key:1,class:"thread-icon"}))]),y("span",Dy,[Wt($.projectName)?(m(),mt(xf,{key:0,class:"thread-icon"})):(m(),mt(Pi,{key:1,class:"thread-icon"}))])])]),right:bt(()=>[y("div",By,[y("div",{ref_for:!0,ref:Z=>Fn($.projectName,Z),class:"project-menu-wrap"},[y("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:yt(Z=>Vt($.projectName),["stop"])},[De(Ks,{class:"thread-icon"})],8,Fy),dn($.projectName)?(m(),w("div",{key:0,class:"project-menu-panel","data-open-direction":d.value[$.projectName]??"down",onClick:x[4]||(x[4]=yt(()=>{},["stop"]))},[b.value==="actions"?(m(),w($e,{key:0},[y("button",{class:"project-menu-item",type:"button",onClick:Z=>_n($.projectName)}," Browse files ",8,Hy),y("button",{class:"project-menu-item",type:"button",onClick:Z=>Rt($.projectName)}," Edit name ",8,Vy),y("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:Z=>Bn($.projectName)}," Remove ",8,Wy)],64)):(m(),w($e,{key:1},[x[14]||(x[14]=y("label",{class:"project-menu-label"},"Project name",-1)),Pr(y("input",{"onUpdate:modelValue":x[3]||(x[3]=Z=>T.value=Z),class:"project-menu-input",type:"text",onInput:Z=>Et($.projectName)},null,40,zy),[[Rr,T.value]])],64))],8,Uy)):ue("",!0)],512),y("button",{class:"thread-start-button",type:"button","aria-label":Te($.projectName),title:Te($.projectName),onClick:yt(Z=>ve($.projectName),["stop"])},[De(li,{class:"thread-icon"})],8,Gy)])]),default:bt(()=>[y("span",{class:"project-main-button","data-dragging-handle":ke($.projectName),onMousedown:yt(Z=>j(Z,$.projectName),["left"])},[y("span",jy,W(Ot($.projectName)),1)],40,Ly)]),_:2},1032,["onClick","onKeydown"]),Ct($)?(m(),w("ul",qy,[(m(!0),w($e,null,dt(Ft($),Z=>(m(),w("li",{key:Z.id,class:"thread-row-item","data-menu-open":_e(Z.id)?"true":"false"},[De(os,{class:"thread-row","data-active":Z.id===e.selectedThreadId,"data-pinned":H(Z.id),"data-menu-open":_e(Z.id)?"true":"false","force-right-hover":_e(Z.id)},{left:bt(()=>[y("span",Jy,[Z.inProgress||Z.unread?(m(),w("span",{key:0,class:"thread-status-indicator","data-state":Gt(Z)},null,8,Yy)):ue("",!0),y("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:We=>U(Z.id)},[De(ea,{class:"thread-icon"})],8,Qy)])]),right:bt(()=>[y("span",tw,W(R(Z.createdAtIso||Z.updatedAtIso)),1)]),"right-hover":bt(()=>[y("div",{ref_for:!0,ref:We=>tn(Z.id,We),class:"thread-menu-wrap"},[y("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:yt(We=>Ue(Z.id),["stop"])},[De(Ks,{class:"thread-icon"})],8,nw)],512)]),default:bt(()=>[y("button",{class:"thread-main-button",type:"button",onClick:We=>z(Z.id)},[y("span",Zy,[y("span",ew,W(Z.title),1),Z.hasWorktree?(m(),mt(Ko,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ue("",!0)])],8,Xy)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,Ky))),128))])):(m(),mt(os,{key:1,as:"p",class:"project-empty-row"},{left:bt(()=>[...x[15]||(x[15]=[y("span",{class:"project-empty-spacer"},null,-1)])]),default:bt(()=>[x[16]||(x[16]=y("span",{class:"project-empty"},"No threads",-1))]),_:1})),Ht($)?(m(),mt(os,{key:2,class:"thread-show-more-row"},{left:bt(()=>[...x[17]||(x[17]=[y("span",{class:"thread-show-more-spacer"},null,-1)])]),default:bt(()=>[y("button",{class:"thread-show-more-button",type:"button",onClick:Z=>fn($.projectName)},W(jt($.projectName)?"Show less":"Show more"),9,rw)]),_:2},1024)):ue("",!0)],12,$y))),128))],4)),(m(),mt(to,{to:"body"},[xe.value?(m(),w("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:Fe,class:"thread-menu-panel thread-menu-panel-fixed",style:qr(h.value),"data-open-direction":mr(xe.value.id),onClick:x[8]||(x[8]=yt(()=>{},["stop"]))},[y("button",{class:"thread-menu-item",type:"button",onClick:x[5]||(x[5]=$=>G(xe.value.id))}," Export chat "),y("button",{class:"thread-menu-item",type:"button",onClick:x[6]||(x[6]=$=>tt(xe.value.id,xe.value.title))}," Rename thread "),y("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:x[7]||(x[7]=$=>et(xe.value.id,xe.value.title))}," Delete thread ")],12,sw)):ue("",!0)])),(m(),mt(to,{to:"body"},[N.value?(m(),w("div",{key:0,class:"rename-thread-overlay",onClick:yt(Qe,["self"])},[y("div",ow,[x[18]||(x[18]=y("h3",{class:"rename-thread-title"},"Rename thread",-1)),x[19]||(x[19]=y("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Pr(y("input",{ref_key:"renameThreadInputRef",ref:oe,"onUpdate:modelValue":x[9]||(x[9]=$=>J.value=$),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[yn(yt(ut,["prevent"]),["enter"]),yn(yt(Qe,["prevent"]),["esc"])]},null,40,iw),[[Rr,J.value]]),y("div",{class:"rename-thread-actions"},[y("button",{class:"rename-thread-button",type:"button",onClick:Qe},"Cancel"),y("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:ut},"Save")])])])):ue("",!0)])),(m(),mt(to,{to:"body"},[L.value?(m(),w("div",{key:0,class:"rename-thread-overlay",onClick:yt(pt,["self"])},[y("div",aw,[x[20]||(x[20]=y("h3",{class:"rename-thread-title"},"Delete thread?",-1)),y("p",lw,' This will archive the thread "'+W(te.value)+'". You can find it later in archived threads. ',1),y("div",{class:"rename-thread-actions"},[y("button",{class:"rename-thread-button",type:"button",onClick:pt},"Cancel"),y("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Ke},"Delete")])])])):ue("",!0)]))]))}}),dw=ht(uw,[["__scopeId","data-v-2e1439c4"]]),fw={class:"content-header"},hw={class:"content-leading"},pw={class:"content-title"},mw={class:"content-actions"},gw=Xt({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(m(),w("header",fw,[y("div",hw,[ur(t.$slots,"leading",{},void 0)]),y("h1",pw,W(e.title),1),y("div",mw,[ur(t.$slots,"actions",{},void 0)])]))}}),vw=ht(gw,[["__scopeId","data-v-66ee223c"]]),yw={},ww={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function bw(e,t){return m(),w("svg",ww,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const wl=ht(yw,[["render",bw]]),_w={},kw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Tw(e,t){return m(),w("svg",kw,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const Sw=ht(_w,[["render",Tw]]),Iw={},Ew={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Cw(e,t){return m(),w("svg",Ew,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zm-4 4a2 2 0 0 1-2-2V8m4 8h10"},null,-1)])])}const Aw=ht(Iw,[["render",Cw]]),xw={class:"conversation-root"},Pw={key:0,class:"conversation-loading"},Rw={key:1,class:"conversation-empty"},Mw=["data-role","data-message-type"],$w={key:0,class:"message-row","data-role":"system"},Ow={class:"message-stack","data-role":"system"},Nw=["onClick"],Dw={class:"cmd-label"},Lw={class:"cmd-status"},jw={class:"cmd-output-inner"},Bw={class:"cmd-output"},Fw=["data-role","data-message-type"],Uw=["data-role"],Hw=["data-role"],Vw=["data-role"],Ww=["onClick"],zw=["src"],Gw={key:1,class:"message-file-attachments"},qw=["href","title"],Kw=["data-role"],Jw={key:0,class:"worked-separator-wrap","aria-live":"polite"},Yw=["onClick"],Qw={class:"worked-separator-text"},Xw={key:0,class:"worked-details"},Zw=["onClick"],eb={class:"cmd-label"},tb={class:"cmd-status"},nb={class:"cmd-output-inner"},rb={class:"cmd-output"},sb=["data-streaming"],ob={class:"plan-card-header"},ib={key:0,class:"plan-card-badge"},ab=["innerHTML"],lb={key:1,class:"plan-step-list"},cb=["data-status"],ub=["data-status"],db=["innerHTML"],fb=["innerHTML"],hb={key:2,class:"message-text-flow"},pb={key:0,class:"message-text"},mb={key:0},gb={key:1,class:"message-bold-text"},vb={key:2,class:"message-italic-text"},yb={key:3,class:"message-strikethrough-text"},wb=["href","title"],bb=["href","title"],_b={key:6,class:"message-inline-code"},kb={key:0},Tb={key:1,class:"message-bold-text"},Sb={key:2,class:"message-italic-text"},Ib={key:3,class:"message-strikethrough-text"},Eb=["href","title"],Cb=["href","title"],Ab={key:6,class:"message-inline-code"},xb={key:2,class:"message-blockquote"},Pb={key:0},Rb={key:1,class:"message-bold-text"},Mb={key:2,class:"message-italic-text"},$b={key:3,class:"message-strikethrough-text"},Ob=["href","title"],Nb=["href","title"],Db={key:6,class:"message-inline-code"},Lb={key:3,class:"message-list message-list-unordered"},jb={class:"message-list-item-text"},Bb={key:0},Fb={key:1,class:"message-bold-text"},Ub={key:2,class:"message-italic-text"},Hb={key:3,class:"message-strikethrough-text"},Vb=["href","title"],Wb=["href","title"],zb={key:6,class:"message-inline-code"},Gb={key:4,class:"message-list message-task-list"},qb=["data-checked"],Kb={class:"message-list-item-text"},Jb={key:0},Yb={key:1,class:"message-bold-text"},Qb={key:2,class:"message-italic-text"},Xb={key:3,class:"message-strikethrough-text"},Zb=["href","title"],e_=["href","title"],t_={key:6,class:"message-inline-code"},n_={key:5,class:"message-list message-list-ordered"},r_={class:"message-list-item-text"},s_={key:0},o_={key:1,class:"message-bold-text"},i_={key:2,class:"message-italic-text"},a_={key:3,class:"message-strikethrough-text"},l_=["href","title"],c_=["href","title"],u_={key:6,class:"message-inline-code"},d_={key:6,class:"message-code-block"},f_={key:0,class:"message-code-language"},h_={class:"message-code-pre"},p_={key:7,class:"message-divider"},m_={key:8,class:"message-text"},g_=["onClick"],v_=["src","alt","onError"],y_={key:0,class:"message-actions"},w_=["onClick"],b_=["onClick"],__={key:0,class:"conversation-item conversation-item-overlay"},k_={class:"message-row"},T_={class:"message-stack"},S_={class:"live-overlay-inline","aria-live":"polite"},I_={class:"live-overlay-label"},E_={key:1,class:"live-overlay-error"},C_={class:"message-row"},A_={class:"message-stack"},x_={class:"request-card"},P_={class:"request-title"},R_={class:"request-meta"},M_={key:0,class:"request-reason"},$_={key:1,class:"request-actions"},O_=["onClick"],N_=["onClick"],D_=["onClick"],L_=["onClick"],j_={key:2,class:"request-actions"},B_=["onClick"],F_=["onClick"],U_=["onClick"],H_=["onClick"],V_={key:3,class:"request-user-input"},W_={class:"request-question-title"},z_={key:0,class:"request-question-text"},G_=["value","onChange"],q_=["value"],K_={key:2,class:"request-question-option-description"},J_=["type","value","placeholder","onInput"],Y_=["type","value","onInput"],Q_=["onClick"],X_={key:4,class:"request-actions"},Z_=["onClick"],ek=["onClick"],tk={key:5,class:"request-actions"},nk=["onClick"],rk=["onClick"],sk=["src"],ok=16,ik=Xt({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{},isTurnInProgress:{type:Boolean},isRollingBack:{type:Boolean}},emits:["updateScrollState","respondServerRequest","rollback"],setup(e,{emit:t}){const n=D(new Set),r=D(new Set),s=D(new Set),o=D({});function i(g){var B;const p=g.replace(/\r\n/g,`
26
- `).trim();if(!p)return null;const v=[],P=[];for(const q of p.split(`
27
- `)){const Ee=q.trim();if(!Ee){v.length===0&&P.push("");continue}const X=Ee.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(X){const ke=(X[1]??" ").toLowerCase();let fe="pending";ke==="x"&&(fe="completed"),(ke==="~"||ke===">"||ke==="-")&&(fe="inProgress"),v.push({step:((B=X[2])==null?void 0:B.trim())??"",status:fe});continue}P.push(Ee)}return v.length===0?null:{explanation:P.join(`
28
- `).trim(),steps:v.filter(q=>q.step.length>0)}}function a(g){var p;return g.plan&&g.plan.steps.length>0?{explanation:((p=g.plan.explanation)==null?void 0:p.trim())??"",steps:g.plan.steps}:i(g.text)}function l(g){return g.messageType==="commandExecution"&&!!g.commandExecution}function d(g){return g.messageType==="plan"||g.messageType==="plan.live"}function c(g){var p;return((p=a(g))==null?void 0:p.explanation)??""}function h(g){var p;return((p=a(g))==null?void 0:p.steps)??[]}function b(g){switch(g){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function T(g){var p;return((p=g.commandExecution)==null?void 0:p.status)==="inProgress"||r.value.has(g.id)?!0:n.value.has(g.id)}function N(g){return r.value.has(g.id)}function O(g){var v;if(((v=g.commandExecution)==null?void 0:v.status)==="inProgress")return;const p=new Set(n.value);p.has(g.id)?p.delete(g.id):p.add(g.id),n.value=p}function J(g){const p=new Set(s.value);p.has(g.id)?p.delete(g.id):p.add(g.id),s.value=p}function oe(g){return s.value.has(g.id)}function L(g){const p=g.commandExecution;if(!p)return"";switch(p.status){case"inProgress":return"⟳ Running";case"completed":return p.exitCode===0?"✓ Completed":`✗ Exit ${p.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function ne(g){var v,P;const p=(v=g.commandExecution)==null?void 0:v.status;return p==="inProgress"?"cmd-status-running":p==="completed"&&((P=g.commandExecution)==null?void 0:P.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function te(g){const p=new Set(r.value);p.add(g),r.value=p,setTimeout(()=>{const v=new Set(r.value);v.delete(g),r.value=v},1e3)}function be(g,p){const v=[];for(let P=p-1;P>=0;P--){const B=g[P];if(B.messageType==="commandExecution")v.unshift(B);else if(B.role==="user"||B.messageType==="worked")break}return v}const ce=e,me=t,Oe=D(null),ae=D(null),Q=D(null),le=D(""),ee=D({}),Pe=D({});let Ne=0,qe=0,He=0;const Fe=new WeakSet,Ae=D(new Set);function rt(g){if(!g||/\s/u.test(g)||g.endsWith("/")||g.endsWith("\\"))return!1;if(g.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(g))return!1;const p=g.startsWith("/"),v=/^[A-Za-z]:[\\/]/u.test(g),P=g.startsWith("./")||g.startsWith("../")||g.startsWith("~/"),B=g.includes("/")||g.includes("\\");return p||v||P||B}function ze(g){return g.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||g}function Be(g){return g.replace(/\\/gu,"/")}function lt(g){if(!g.startsWith("file://"))return g;let p=g.replace(/^file:\/\//u,"");try{p=decodeURIComponent(p)}catch{}return/^\/[A-Za-z]:\//u.test(p)&&(p=p.slice(1)),p}function Dt(g){const p=Be(g),v=p.match(/^\/Users\/([^/]+)/u);if(v)return`/Users/${v[1]}`;const P=p.match(/^\/home\/([^/]+)/u);return P?`/home/${P[1]}`:""}function it(g){const p=Be(g);if(!p)return p;let v="",P=p;const B=P.match(/^([A-Za-z]:)(\/.*)?$/u);B?(v=`${B[1]}/`,P=(B[2]??"").replace(/^\/+/u,"")):P.startsWith("/")&&(v="/",P=P.slice(1));const q=P.split("/").filter(Boolean),Ee=[];for(const ke of q)if(ke!=="."){if(ke===".."){Ee.length>0&&Ee.pop();continue}Ee.push(ke)}const X=Ee.join("/");return v?`${v}${X}`.replace(/\/+$/u,"")||v:X||p}function ct(g,p){const v=Be(lt(g.trim()));if(!v)return"";if(v.startsWith("/")||/^[A-Za-z]:\//u.test(v))return it(v);if(v.startsWith("~/")){const q=Dt(p);if(q)return it(`${q}/${v.slice(2)}`)}const B=Be(p.trim());return it(B?`${B.replace(/\/+$/u,"")}/${v}`:v)}function Ve(g){if(!g)return null;let p=g.trim();p=V(p).core.trim();let P=null;const B=p.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(B)p=B[1],P=Number(B[2]);else{const q=p.match(/^(.*):(\d+)(?::\d+)?$/u);q&&(p=q[1],P=Number(q[2]))}return p=lt(p),rt(p)?{path:p,line:P}:null}function V(g){let p=g,v="",P="";for(;/^[('"`[{<“‘]/u.test(p);)v+=p[0],p=p.slice(1);for(;/[)"'`\]}>”’]$/u.test(p);)P=p.slice(-1)+P,p=p.slice(0,-1);return{core:p,leading:v,trailing:P}}function we(g){const v=g.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!v)return null;const P=(v[1]??"").trim(),B=(v[2]??"").trim(),q=V(P).core.trim()||P,Ee=V(B).core.trim();return Ee?{label:q,target:Ee}:null}function he(g){const p=Math.min(6,Math.max(1,Math.trunc(g)));return`h${String(p)}`}function Ce(g){switch(Math.min(6,Math.max(1,Math.trunc(g)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function xe(g){const p=[],v=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let P=0;for(const B of g.matchAll(v)){if(typeof B.index!="number")continue;const q=B.index,Ee=q+B[0].length;q>P&&p.push({kind:"text",value:g.slice(P,q)});let X=B[0],ke="";for(;/[.,;:]$/u.test(X);)ke=X.slice(-1)+ke,X=X.slice(0,-1);const fe=V(X);X=fe.core;const Je=fe.leading,Ft=fe.trailing+ke;if(Je&&p.push({kind:"text",value:Je}),X.startsWith("**")&&X.endsWith("**")&&X.length>4)p.push({kind:"bold",value:X.slice(2,-2)}),Ft&&p.push({kind:"text",value:Ft});else if(/^https?:\/\//u.test(X))p.push({kind:"url",value:X,href:X}),Ft&&p.push({kind:"text",value:Ft});else{const Ht=Ve(X);Ht?(p.push({kind:"file",value:X,path:Ht.path,displayPath:X,downloadName:ze(Ht.path)}),Ft&&p.push({kind:"text",value:Ft})):p.push({kind:"text",value:B[0]})}P=Ee}return P<g.length&&p.push({kind:"text",value:g.slice(P)}),I(p)}function k(g,p){const v=[];let P=!1,B="";const q=Ee=>{Ee&&v.push({kind:"text",value:Ee})};for(const Ee of g){if(Ee.kind!=="text"){P&&(q(`${p.marker}${B}`),P=!1,B=""),v.push(Ee);continue}let X=Ee.value;for(;X.length>0;){const ke=X.indexOf(p.marker);if(ke<0){P?B+=X:q(X);break}const fe=X.slice(0,ke);if(P?B+=fe:q(fe),X=X.slice(ke+p.marker.length),P){const Je=B;Je.length>0&&(!p.isValidContent||p.isValidContent(Je))?v.push({kind:p.kind,value:Je}):q(`${p.marker}${Je}${p.marker}`),B="",P=!1}else P=!0}}return P&&q(`${p.marker}${B}`),v}function I(g){const p=P=>P.trim().length>0&&!/^\s/u.test(P)&&!/\s$/u.test(P);let v=k(g,{marker:"**",kind:"bold",isValidContent:p});return v=k(v,{marker:"~~",kind:"strikethrough",isValidContent:p}),v=k(v,{marker:"*",kind:"italic",isValidContent:p}),v}function M(g){const p=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,v=[];let P=0;for(const B of g.matchAll(p)){if(typeof B.index!="number")continue;const[q,Ee,X]=B,ke=B.index,fe=ke+q.length;ke>P&&v.push(...xe(g.slice(P,ke)));const Je=we(`[${Ee??""}](${X??""})`),Ft=(Je==null?void 0:Je.label)??(Ee??"").trim(),Ht=(Je==null?void 0:Je.target)??(X??"").trim();if(/^https?:\/\//u.test(Ht))v.push({kind:"url",value:Ft||Ht,href:Ht});else{const Ct=Ve(Ht);Ct?v.push({kind:"file",value:Ht,path:Ct.path,displayPath:Ft||Ht,downloadName:ze(Ct.path)}):v.push({kind:"text",value:q})}P=fe}return P<g.length&&v.push(...xe(g.slice(P))),v}function K(g){if(!g.includes("`"))return M(g);const p=[];let v=0,P=0;for(;v<g.length;){if(g[v]!=="`"){v+=1;continue}let B=1;for(;v+B<g.length&&g[v+B]==="`";)B+=1;const q="`".repeat(B);let Ee=v+B,X=-1;for(;Ee<g.length;){const fe=g.indexOf(q,Ee);if(fe<0)break;const Je=fe>0&&g[fe-1]==="`",Ft=fe+B<g.length&&g[fe+B]==="`",Ht=g.slice(v+B,fe).includes(`
29
- `);if(!Je&&!Ft&&!Ht){X=fe;break}Ee=fe+1}if(X<0){v+=B;continue}v>P&&p.push(...M(g.slice(P,v)));const ke=g.slice(v+B,X);if(ke.length>0){const fe=we(ke);if(fe)if(/^https?:\/\//u.test(fe.target))p.push({kind:"url",value:fe.label||fe.target,href:fe.target});else{const Je=Ve(fe.target);Je?p.push({kind:"file",value:fe.target,path:Je.path,displayPath:fe.label||fe.target,downloadName:ze(Je.path)}):p.push({kind:"code",value:ke})}else{const Je=Ve(ke);if(Je){const Ft=Je.line?`${Je.path}:${String(Je.line)}`:Je.path;p.push({kind:"file",value:ke,path:Je.path,displayPath:Ft,downloadName:ze(Je.path)})}else p.push({kind:"code",value:ke})}}else p.push({kind:"text",value:`${q}${q}`});v=X+B,P=v}return P<g.length&&p.push(...M(g.slice(P))),p}function F(g){const p=g.trim();if(!p)return"";if(p.startsWith("data:")||p.startsWith("blob:")||p.startsWith("http://")||p.startsWith("https://")||p.startsWith("/codex-local-image?"))return p;if(p.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(p)}`;const v=p.startsWith("/"),P=/^[A-Za-z]:[\\/]/u.test(p);return v||P?`/codex-local-image?path=${encodeURIComponent(p)}`:p}function R(g){const p=g.trim();if(!p)return"#";const v=Ee=>Ee.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(Ee),P=Ve(p),B=(P==null?void 0:P.path)??p,q=ct(B,ce.cwd);if(v(q)){const Ee=q.startsWith("/")?q:`/${q}`;return`/codex-local-browse${encodeURI(Ee)}`}return"#"}function H(g){return g.replace(/\r\n/gu,`
30
- `)}function U(g){return g.trim().length===0}function z(g){const p=g.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return p?{level:p[1].length,value:p[2].trim()}:null}function G(g){const p=g.match(/^\s{0,3}>\s?(.*)$/u);return p?p[1]??"":null}function Te(g){var v;const p=g.match(/^\s*[-*+]\s+(.+)$/u);return((v=p==null?void 0:p[1])==null?void 0:v.trim())??null}function ve(g){var v;const p=g.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return p?{checked:(p[1]??" ").toLowerCase()==="x",text:((v=p[2])==null?void 0:v.trim())??""}:null}function _e(g){var v;const p=g.match(/^\s*\d+[.)]\s+(.+)$/u);return((v=p==null?void 0:p[1])==null?void 0:v.trim())??null}function Ie(g){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(g.trim())}function Ue(g){const p=g.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return p?{marker:p[1],language:(p[2]??"").trim()}:null}function tt(g){const v=H(g).split(`
31
- `),P=[];let B=0;for(;B<v.length;){if(U(v[B])){B+=1;continue}const q=Ue(v[B]);if(q){B+=1;const Ct=[];for(;B<v.length;){if(v[B].trim()===q.marker){B+=1;break}Ct.push(v[B]),B+=1}P.push({kind:"codeBlock",language:q.language,value:Ct.join(`
32
- `)});continue}if(Ie(v[B])){P.push({kind:"thematicBreak"}),B+=1;continue}const Ee=z(v[B]);if(Ee){P.push({kind:"heading",level:Ee.level,value:Ee.value}),B+=1;continue}if(G(v[B])!==null){const Ct=[];for(;B<v.length;){const Gt=G(v[B]);if(Gt===null)break;Ct.push(Gt),B+=1}P.push({kind:"blockquote",value:Ct.join(`
33
- `).trim()});continue}if(ve(v[B])!==null){const Ct=[];for(;B<v.length;){const Gt=ve(v[B]);if(Gt===null)break;Ct.push(Gt),B+=1}if(Ct.length>0){P.push({kind:"taskList",items:Ct});continue}}if(Te(v[B])!==null){const Ct=[];for(;B<v.length;){const Gt=Te(v[B]);if(Gt===null)break;Ct.push(Gt),B+=1}if(Ct.length>0){P.push({kind:"unorderedList",items:Ct});continue}}if(_e(v[B])!==null){const Ct=[];for(;B<v.length;){const Gt=_e(v[B]);if(Gt===null)break;Ct.push(Gt),B+=1}if(Ct.length>0){P.push({kind:"orderedList",items:Ct});continue}}const Ft=[];for(;B<v.length&&!(U(v[B])||Ue(v[B])||Ie(v[B])||z(v[B])||G(v[B])!==null||ve(v[B])!==null||Te(v[B])!==null||_e(v[B])!==null);)Ft.push(v[B]),B+=1;const Ht=Ft.join(`
34
- `).trim();Ht&&P.push({kind:"paragraph",value:Ht})}return P}function Qe(g){if(!g.includes("![")||!g.includes("]("))return tt(g);const p=[],v=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let P=0;for(const B of g.matchAll(v)){const[q,Ee,X]=B;if(typeof B.index!="number")continue;const ke=B.index,fe=ke+q.length,Je=F(X.trim());Je&&(ke>P&&p.push(...tt(g.slice(P,ke))),p.push({kind:"image",url:Je,alt:Ee.trim(),markdown:q}),P=fe)}return P<g.length&&p.push(...tt(g.slice(P))),p}function ut(g){const v=H(g).split(`
35
- `),P=[];let B=0,q=0;const Ee=X=>{if(X<=q)return;const ke=v.slice(q,X).join(`
36
- `);P.push(...Qe(ke))};for(;B<v.length;){const X=Ue(v[B]);if(!X){B+=1;continue}Ee(B),B+=1;const ke=[];for(;B<v.length;){if(v[B].trim()===X.marker){B+=1;break}ke.push(v[B]),B+=1}P.push({kind:"codeBlock",language:X.language,value:ke.join(`
37
- `)}),q=B}return Ee(v.length),P.length>0?P:[{kind:"paragraph",value:g}]}function et(g){return g.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function pt(g){return K(g).map(p=>p.kind==="text"?et(p.value):p.kind==="bold"?`<strong class="message-bold-text">${et(p.value)}</strong>`:p.kind==="italic"?`<em class="message-italic-text">${et(p.value)}</em>`:p.kind==="strikethrough"?`<s class="message-strikethrough-text">${et(p.value)}</s>`:p.kind==="file"?`<a class="message-file-link" href="${et(R(p.path))}" target="_blank" rel="noopener noreferrer" title="${et(p.path)}">${et(p.displayPath)}</a>`:p.kind==="url"?`<a class="message-file-link" href="${et(p.href)}" target="_blank" rel="noopener noreferrer" title="${et(p.href)}">${et(p.value)}</a>`:`<code class="message-inline-code">${et(p.value)}</code>`).join("")}function Ke(g){return ut(g).map(p=>{if(p.kind==="paragraph")return`<p class="message-text">${pt(p.value)}</p>`;if(p.kind==="heading"){const v=Math.min(6,Math.max(1,Math.trunc(p.level))),P=he(v),B=`message-heading ${Ce(v)}`;return`<${P} class="${B}">${pt(p.value)}</${P}>`}return p.kind==="blockquote"?`<blockquote class="message-blockquote">${pt(p.value)}</blockquote>`:p.kind==="unorderedList"?`<ul class="message-list message-list-unordered">${p.items.map(P=>`<li class="message-list-item"><div class="message-list-item-text">${pt(P)}</div></li>`).join("")}</ul>`:p.kind==="taskList"?`<ul class="message-list message-task-list">${p.items.map(P=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${P.checked?"true":"false"}">${P.checked?"☑":"☐"}</span><div class="message-list-item-text">${pt(P.text)}</div></li>`).join("")}</ul>`:p.kind==="orderedList"?`<ol class="message-list message-list-ordered">${p.items.map(P=>`<li class="message-list-item"><div class="message-list-item-text">${pt(P)}</div></li>`).join("")}</ol>`:p.kind==="codeBlock"?`<div class="message-code-block">${p.language?`<div class="message-code-language">${et(p.language)}</div>`:""}<pre class="message-code-pre"><code>${et(p.value)}</code></pre></div>`:p.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${et(p.url)}" alt="${et(p.alt||"Embedded message image")}" loading="lazy">`}).join("")}function Ot(g){return g!==null&&typeof g=="object"&&!Array.isArray(g)?g:null}function dn(g){const p=new Date(g);return Number.isNaN(p.getTime())?g:p.toLocaleTimeString()}function st(g){const p=Ot(g.params),v=p==null?void 0:p.reason;return typeof v=="string"?v.trim():""}function vt(g,p){return`${String(g)}:${p}`}function at(g){const p=Ot(g.params),v=Array.isArray(p==null?void 0:p.questions)?p.questions:[],P=[];for(const B of v){const q=Ot(B);if(!q)continue;const Ee=typeof q.id=="string"?q.id:"";if(!Ee)continue;const X=Array.isArray(q.options)?q.options.map(ke=>Ot(ke)).map(ke=>({label:typeof(ke==null?void 0:ke.label)=="string"?ke.label:"",description:typeof(ke==null?void 0:ke.description)=="string"?ke.description:""})).filter(ke=>ke.label.length>0):[];P.push({id:Ee,header:typeof q.header=="string"?q.header:"",question:typeof q.question=="string"?q.question:"",isSecret:q.isSecret===!0,isOther:q.isOther===!0,options:X})}return P}function Vt(g,p,v){const P=vt(g,p),B=ee.value[P];return typeof B=="string"&&B.length>0?B:v}function Rt(g,p,v){const P=v.target;if(!(P instanceof HTMLInputElement))return;const B=vt(g,p);ee.value={...ee.value,[B]:P.value}}function Et(g,p){var B;const v=Vt(g,p.id,((B=p.options[0])==null?void 0:B.label)||""),P=p.options.find(q=>q.label===v);return(P==null?void 0:P.description)??""}function Bn(g,p){const v=vt(g,p);return Pe.value[v]??""}function _n(g,p,v){const P=v.target;if(!(P instanceof HTMLSelectElement))return;const B=vt(g,p);ee.value={...ee.value,[B]:P.value}}function kn(g,p,v){const P=v.target;if(!(P instanceof HTMLInputElement))return;const B=vt(g,p);Pe.value={...Pe.value,[B]:P.value}}function jt(g,p){me("respondServerRequest",{id:g,result:{decision:p}})}function Wt(g){var P;const p=at(g),v={};for(const B of p){const q=Vt(g.id,B.id,((P=B.options[0])==null?void 0:P.label)||""),Ee=Bn(g.id,B.id).trim(),X=[q,Ee].map(ke=>ke.trim()).filter(ke=>ke.length>0);v[B.id]={answers:X}}me("respondServerRequest",{id:g.id,result:{answers:v}})}function fn(g){me("respondServerRequest",{id:g,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function Mn(g){me("respondServerRequest",{id:g,result:{success:!0,contentItems:[]}})}function $n(g){me("respondServerRequest",{id:g,result:{}})}function Fn(g){me("respondServerRequest",{id:g,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function tn(g){return!(g.role!=="user"&&g.role!=="assistant"||typeof g.turnIndex!="number"||ce.isTurnInProgress||ce.isRollingBack)}function Tn(g){return g.role!=="user"&&g.role!=="assistant"?!1:g.text.trim().length>0}function Un(g){return Tn(g)||tn(g)}async function pr(g){if(!Tn(g))return;const p=g.text.trim();try{await navigator.clipboard.writeText(p)}catch{const v=document.createElement("textarea");v.value=p,v.setAttribute("readonly","true"),v.style.position="fixed",v.style.opacity="0",document.body.appendChild(v),v.select(),document.execCommand("copy"),document.body.removeChild(v)}}function mr(g){tn(g)&&me("rollback",{turnIndex:g.turnIndex})}function Hn(){const g=Oe.value,p=ae.value;!g||!p||(g.scrollTop=g.scrollHeight,p.scrollIntoView({block:"end"}))}function Le(g){return g.scrollHeight-(g.scrollTop+g.clientHeight)<=ok}function Re(g){if(!ce.activeThreadId)return;const p=Math.max(g.scrollHeight-g.clientHeight,0),v=p>0?Math.min(Math.max(g.scrollTop/p,0),1):1;me("updateScrollState",{threadId:ce.activeThreadId,state:{scrollTop:g.scrollTop,isAtBottom:Le(g),scrollRatio:v}})}function Sn(){const g=Oe.value;if(!g)return;const p=ce.scrollState;if(!p||p.isAtBottom){Bt();return}const v=Math.max(g.scrollHeight-g.clientHeight,0),P=typeof p.scrollRatio=="number"?p.scrollRatio*v:p.scrollTop;g.scrollTop=Math.min(Math.max(P,0),v),Re(g)}function Bt(){const g=Oe.value;g&&(Hn(),Re(g))}function Cn(){const g=ce.scrollState;return!g||g.isAtBottom===!0}function On(){if(!Cn()){He=0,qe=0;return}if(Bt(),He-=1,He<=0){qe=0;return}qe=requestAnimationFrame(On)}function hn(g=6){Cn()&&(qe&&(cancelAnimationFrame(qe),qe=0),He=Math.max(g,1),qe=requestAnimationFrame(On))}function zt(){hn(3)}function Nn(){if(!Cn())return;const g=Oe.value;if(!g)return;const p=g.querySelectorAll("img.message-image-preview");for(const v of p)v.complete||Fe.has(v)||(Fe.add(v),v.addEventListener("load",zt,{once:!0}),v.addEventListener("error",zt,{once:!0}))}async function An(){await Kt(),Ne&&cancelAnimationFrame(Ne),Ne=requestAnimationFrame(()=>{Ne=0,Sn(),Nn(),hn()})}gt(()=>ce.messages,async g=>{if(!ce.isLoading){for(const p of g){if(p.messageType!=="commandExecution"||!p.commandExecution)continue;const v=o.value[p.id],P=p.commandExecution.status;v==="inProgress"&&P!=="inProgress"&&te(p.id),o.value[p.id]=P}await An()}}),gt(()=>ce.pendingRequests,async()=>{ce.isLoading||await An()},{deep:!0}),gt(()=>ce.liveOverlay,async g=>{g&&(await Kt(),Bt(),hn(8))},{deep:!0}),gt(()=>ce.isLoading,async g=>{g||await An()}),gt(()=>ce.activeThreadId,()=>{le.value="",Ae.value=new Set},{flush:"post"});function Zn(){const g=Oe.value;!g||ce.isLoading||Re(g)}function xn(g){le.value=F(g)}function In(g,p){return`${g}:${String(p)}`}function C(g,p){const v=new Set(Ae.value);v.add(In(g,p)),Ae.value=v}function j(g,p){return Ae.value.has(In(g,p))}function re(){le.value=""}function je(){const g=Q.value;g&&(g.scrollTop=g.scrollHeight)}return gt(()=>{var g;return(g=ce.liveOverlay)==null?void 0:g.reasoningText},async g=>{g&&(await Kt(),je())}),Dr(()=>{Ne&&cancelAnimationFrame(Ne),qe&&cancelAnimationFrame(qe)}),(g,p)=>(m(),w("section",xw,[e.isLoading?(m(),w("p",Pw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(m(),w("p",Rw," No messages in this thread yet. ")):(m(),w("ul",{key:2,ref_key:"conversationListRef",ref:Oe,class:"conversation-list",onScroll:Zn},[(m(!0),w($e,null,dt(e.messages,v=>{var P,B;return m(),w("li",{key:v.id,class:ft(["conversation-item",{"conversation-item-actionable":Un(v)}]),"data-role":v.role,"data-message-type":v.messageType||""},[l(v)?(m(),w("div",$w,[y("div",Ow,[y("button",{type:"button",class:ft(["cmd-row",[ne(v),{"cmd-expanded":T(v)}]]),onClick:q=>O(v)},[y("span",{class:ft(["cmd-chevron",{"cmd-chevron-open":T(v)}])},"▶",2),y("code",Dw,W(((P=v.commandExecution)==null?void 0:P.command)||"(command)"),1),y("span",Lw,W(L(v)),1)],10,Nw),y("div",{class:ft(["cmd-output-wrap",{"cmd-output-visible":T(v),"cmd-output-collapsing":N(v)}])},[y("div",jw,[y("pre",Bw,W(((B=v.commandExecution)==null?void 0:B.aggregatedOutput)||"(no output)"),1)])],2)])])):(m(),w("div",{key:1,class:"message-row","data-role":v.role,"data-message-type":v.messageType||""},[y("div",{class:"message-stack","data-role":v.role},[y("article",{class:"message-body","data-role":v.role},[v.images&&v.images.length>0?(m(),w("ul",{key:0,class:"message-image-list","data-role":v.role},[(m(!0),w($e,null,dt(v.images,q=>(m(),w("li",{key:q,class:"message-image-item"},[y("button",{class:"message-image-button",type:"button",onClick:Ee=>xn(q)},[y("img",{class:"message-image-preview",src:F(q),alt:"Message image preview",loading:"lazy"},null,8,zw)],8,Ww)]))),128))],8,Vw)):ue("",!0),v.fileAttachments&&v.fileAttachments.length>0?(m(),w("div",Gw,[(m(!0),w($e,null,dt(v.fileAttachments,q=>(m(),w("span",{key:q.path,class:"message-file-chip"},[p[1]||(p[1]=y("span",{class:"message-file-chip-icon"},"📄",-1)),y("a",{class:"message-file-link message-file-chip-name",href:R(q.path),target:"_blank",rel:"noopener noreferrer",title:q.path},W(q.path),9,qw)]))),128))])):ue("",!0),v.text.length>0?(m(),w("article",{key:2,class:"message-card","data-role":v.role},[v.messageType==="worked"?(m(),w("div",Jw,[y("button",{type:"button",class:"worked-separator",onClick:q=>J(v)},[p[2]||(p[2]=y("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),y("span",{class:ft(["worked-chevron",{"worked-chevron-open":oe(v)}])},"▶",2),y("p",Qw,W(v.text),1),p[3]||(p[3]=y("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,Yw),oe(v)?(m(),w("div",Xw,[(m(!0),w($e,null,dt(be(e.messages,e.messages.indexOf(v)),q=>{var Ee,X;return m(),w("div",{key:`worked-cmd-${q.id}`,class:"worked-cmd-item"},[y("button",{type:"button",class:ft(["cmd-row",[ne(q),{"cmd-expanded":T(q)}]]),onClick:ke=>O(q)},[y("span",{class:ft(["cmd-chevron",{"cmd-chevron-open":T(q)}])},"▶",2),y("code",eb,W(((Ee=q.commandExecution)==null?void 0:Ee.command)||"(command)"),1),y("span",tb,W(L(q)),1)],10,Zw),y("div",{class:ft(["cmd-output-wrap",{"cmd-output-visible":T(q),"cmd-output-collapsing":N(q)}])},[y("div",nb,[y("pre",rb,W(((X=q.commandExecution)==null?void 0:X.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):ue("",!0)])):d(v)?(m(),w("div",{key:1,class:"plan-card","data-streaming":v.messageType==="plan.live"},[y("div",ob,[p[4]||(p[4]=y("p",{class:"plan-card-title"},"Plan",-1)),v.messageType==="plan.live"?(m(),w("span",ib,"Updating")):ue("",!0)]),c(v)?(m(),w("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:Ke(c(v))},null,8,ab)):ue("",!0),h(v).length>0?(m(),w("ol",lb,[(m(!0),w($e,null,dt(h(v),(q,Ee)=>(m(),w("li",{key:`${v.id}:plan-step:${Ee}`,class:"plan-step-item","data-status":q.status},[y("span",{class:"plan-step-status","data-status":q.status},W(b(q.status)),9,ub),y("div",{class:"plan-step-text plan-card-markdown",innerHTML:Ke(q.step)},null,8,db)],8,cb))),128))])):(m(),w("div",{key:2,class:"plan-card-markdown",innerHTML:Ke(v.text)},null,8,fb))],8,sb)):(m(),w("div",hb,[(m(!0),w($e,null,dt(ut(v.text),(q,Ee)=>(m(),w($e,{key:`block-${Ee}`},[q.kind==="paragraph"?(m(),w("p",pb,[(m(!0),w($e,null,dt(K(q.value),(X,ke)=>(m(),w($e,{key:`seg-${Ee}-${ke}`},[X.kind==="text"?(m(),w("span",mb,W(X.value),1)):X.kind==="bold"?(m(),w("strong",gb,W(X.value),1)):X.kind==="italic"?(m(),w("em",vb,W(X.value),1)):X.kind==="strikethrough"?(m(),w("s",yb,W(X.value),1)):X.kind==="file"?(m(),w("a",{key:4,class:"message-file-link",href:R(X.path),target:"_blank",rel:"noopener noreferrer",title:X.path},W(X.displayPath),9,wb)):X.kind==="url"?(m(),w("a",{key:5,class:"message-file-link",href:X.href,target:"_blank",rel:"noopener noreferrer",title:X.href},W(X.value),9,bb)):(m(),w("code",_b,W(X.value),1))],64))),128))])):q.kind==="heading"?(m(),mt(si(he(q.level)),{key:1,class:ft(["message-heading",Ce(q.level)])},{default:bt(()=>[(m(!0),w($e,null,dt(K(q.value),(X,ke)=>(m(),w($e,{key:`heading-seg-${Ee}-${ke}`},[X.kind==="text"?(m(),w("span",kb,W(X.value),1)):X.kind==="bold"?(m(),w("strong",Tb,W(X.value),1)):X.kind==="italic"?(m(),w("em",Sb,W(X.value),1)):X.kind==="strikethrough"?(m(),w("s",Ib,W(X.value),1)):X.kind==="file"?(m(),w("a",{key:4,class:"message-file-link",href:R(X.path),target:"_blank",rel:"noopener noreferrer",title:X.path},W(X.displayPath),9,Eb)):X.kind==="url"?(m(),w("a",{key:5,class:"message-file-link",href:X.href,target:"_blank",rel:"noopener noreferrer",title:X.href},W(X.value),9,Cb)):(m(),w("code",Ab,W(X.value),1))],64))),128))]),_:2},1032,["class"])):q.kind==="blockquote"?(m(),w("blockquote",xb,[(m(!0),w($e,null,dt(K(q.value),(X,ke)=>(m(),w($e,{key:`quote-seg-${Ee}-${ke}`},[X.kind==="text"?(m(),w("span",Pb,W(X.value),1)):X.kind==="bold"?(m(),w("strong",Rb,W(X.value),1)):X.kind==="italic"?(m(),w("em",Mb,W(X.value),1)):X.kind==="strikethrough"?(m(),w("s",$b,W(X.value),1)):X.kind==="file"?(m(),w("a",{key:4,class:"message-file-link",href:R(X.path),target:"_blank",rel:"noopener noreferrer",title:X.path},W(X.displayPath),9,Ob)):X.kind==="url"?(m(),w("a",{key:5,class:"message-file-link",href:X.href,target:"_blank",rel:"noopener noreferrer",title:X.href},W(X.value),9,Nb)):(m(),w("code",Db,W(X.value),1))],64))),128))])):q.kind==="unorderedList"?(m(),w("ul",Lb,[(m(!0),w($e,null,dt(q.items,(X,ke)=>(m(),w("li",{key:`ul-${Ee}-${ke}`,class:"message-list-item"},[y("div",jb,[(m(!0),w($e,null,dt(K(X),(fe,Je)=>(m(),w($e,{key:`ul-seg-${Ee}-${ke}-${Je}`},[fe.kind==="text"?(m(),w("span",Bb,W(fe.value),1)):fe.kind==="bold"?(m(),w("strong",Fb,W(fe.value),1)):fe.kind==="italic"?(m(),w("em",Ub,W(fe.value),1)):fe.kind==="strikethrough"?(m(),w("s",Hb,W(fe.value),1)):fe.kind==="file"?(m(),w("a",{key:4,class:"message-file-link",href:R(fe.path),target:"_blank",rel:"noopener noreferrer",title:fe.path},W(fe.displayPath),9,Vb)):fe.kind==="url"?(m(),w("a",{key:5,class:"message-file-link",href:fe.href,target:"_blank",rel:"noopener noreferrer",title:fe.href},W(fe.value),9,Wb)):(m(),w("code",zb,W(fe.value),1))],64))),128))])]))),128))])):q.kind==="taskList"?(m(),w("ul",Gb,[(m(!0),w($e,null,dt(q.items,(X,ke)=>(m(),w("li",{key:`task-${Ee}-${ke}`,class:"message-task-item"},[y("span",{class:"message-task-checkbox","data-checked":X.checked},W(X.checked?"☑":"☐"),9,qb),y("div",Kb,[(m(!0),w($e,null,dt(K(X.text),(fe,Je)=>(m(),w($e,{key:`task-seg-${Ee}-${ke}-${Je}`},[fe.kind==="text"?(m(),w("span",Jb,W(fe.value),1)):fe.kind==="bold"?(m(),w("strong",Yb,W(fe.value),1)):fe.kind==="italic"?(m(),w("em",Qb,W(fe.value),1)):fe.kind==="strikethrough"?(m(),w("s",Xb,W(fe.value),1)):fe.kind==="file"?(m(),w("a",{key:4,class:"message-file-link",href:R(fe.path),target:"_blank",rel:"noopener noreferrer",title:fe.path},W(fe.displayPath),9,Zb)):fe.kind==="url"?(m(),w("a",{key:5,class:"message-file-link",href:fe.href,target:"_blank",rel:"noopener noreferrer",title:fe.href},W(fe.value),9,e_)):(m(),w("code",t_,W(fe.value),1))],64))),128))])]))),128))])):q.kind==="orderedList"?(m(),w("ol",n_,[(m(!0),w($e,null,dt(q.items,(X,ke)=>(m(),w("li",{key:`ol-${Ee}-${ke}`,class:"message-list-item"},[y("div",r_,[(m(!0),w($e,null,dt(K(X),(fe,Je)=>(m(),w($e,{key:`ol-seg-${Ee}-${ke}-${Je}`},[fe.kind==="text"?(m(),w("span",s_,W(fe.value),1)):fe.kind==="bold"?(m(),w("strong",o_,W(fe.value),1)):fe.kind==="italic"?(m(),w("em",i_,W(fe.value),1)):fe.kind==="strikethrough"?(m(),w("s",a_,W(fe.value),1)):fe.kind==="file"?(m(),w("a",{key:4,class:"message-file-link",href:R(fe.path),target:"_blank",rel:"noopener noreferrer",title:fe.path},W(fe.displayPath),9,l_)):fe.kind==="url"?(m(),w("a",{key:5,class:"message-file-link",href:fe.href,target:"_blank",rel:"noopener noreferrer",title:fe.href},W(fe.value),9,c_)):(m(),w("code",u_,W(fe.value),1))],64))),128))])]))),128))])):q.kind==="codeBlock"?(m(),w("div",d_,[q.language?(m(),w("div",f_,W(q.language),1)):ue("",!0),y("pre",h_,[y("code",null,W(q.value),1)])])):q.kind==="thematicBreak"?(m(),w("hr",p_)):j(v.id,Ee)?(m(),w("p",m_,W(q.markdown),1)):(m(),w("button",{key:9,class:"message-image-button",type:"button",onClick:X=>xn(q.url)},[y("img",{class:"message-image-preview message-markdown-image",src:q.url,alt:q.alt||"Embedded message image",loading:"lazy",onError:X=>C(v.id,Ee)},null,40,v_)],8,g_))],64))),128))]))],8,Kw)):ue("",!0)],8,Hw),Un(v)?(m(),w("div",y_,[Tn(v)?(m(),w("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:q=>pr(v)},[De(Aw,{class:"message-action-icon"}),p[5]||(p[5]=y("span",{class:"message-action-label"},"Copy",-1))],8,w_)):ue("",!0),tn(v)?(m(),w("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:q=>mr(v)},[De(Sw,{class:"message-action-icon"}),p[6]||(p[6]=y("span",{class:"message-action-label"},"Rollback",-1))],8,b_)):ue("",!0)])):ue("",!0)],8,Uw)],8,Fw))],10,Mw)}),128)),e.liveOverlay?(m(),w("li",__,[y("div",k_,[y("div",T_,[y("article",S_,[y("p",I_,W(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(m(),w("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:Q},W(e.liveOverlay.reasoningText),513)):ue("",!0),e.liveOverlay.errorText?(m(),w("p",E_,W(e.liveOverlay.errorText),1)):ue("",!0)])])])])):ue("",!0),(m(!0),w($e,null,dt(e.pendingRequests,v=>(m(),w("li",{key:`server-request:${v.id}`,class:"conversation-item conversation-item-request"},[y("div",C_,[y("div",A_,[y("article",x_,[y("p",P_,W(v.method),1),y("p",R_,"Request #"+W(v.id)+" · "+W(dn(v.receivedAtIso)),1),st(v)?(m(),w("p",M_,W(st(v)),1)):ue("",!0),v.method==="item/commandExecution/requestApproval"?(m(),w("section",$_,[y("button",{type:"button",class:"request-button request-button-primary",onClick:P=>jt(v.id,"accept")},"Accept",8,O_),y("button",{type:"button",class:"request-button",onClick:P=>jt(v.id,"acceptForSession")},"Accept for Session",8,N_),y("button",{type:"button",class:"request-button",onClick:P=>jt(v.id,"decline")},"Decline",8,D_),y("button",{type:"button",class:"request-button",onClick:P=>jt(v.id,"cancel")},"Cancel",8,L_)])):v.method==="item/fileChange/requestApproval"?(m(),w("section",j_,[y("button",{type:"button",class:"request-button request-button-primary",onClick:P=>jt(v.id,"accept")},"Accept",8,B_),y("button",{type:"button",class:"request-button",onClick:P=>jt(v.id,"acceptForSession")},"Accept for Session",8,F_),y("button",{type:"button",class:"request-button",onClick:P=>jt(v.id,"decline")},"Decline",8,U_),y("button",{type:"button",class:"request-button",onClick:P=>jt(v.id,"cancel")},"Cancel",8,H_)])):v.method==="item/tool/requestUserInput"?(m(),w("section",V_,[(m(!0),w($e,null,dt(at(v),P=>{var B;return m(),w("div",{key:`${v.id}:${P.id}`,class:"request-question"},[y("p",W_,W(P.header||P.question),1),P.header&&P.question?(m(),w("p",z_,W(P.question),1)):ue("",!0),P.options.length>0?(m(),w("select",{key:1,class:"request-select",value:Vt(v.id,P.id,((B=P.options[0])==null?void 0:B.label)||""),onChange:q=>_n(v.id,P.id,q)},[(m(!0),w($e,null,dt(P.options,q=>(m(),w("option",{key:`${v.id}:${P.id}:${q.label}`,value:q.label},W(q.label),9,q_))),128))],40,G_)):ue("",!0),P.options.length>0&&Et(v.id,P)?(m(),w("p",K_,W(Et(v.id,P)),1)):(m(),w("input",{key:3,class:"request-input",type:P.isSecret?"password":"text",value:Vt(v.id,P.id,""),placeholder:P.isSecret?"Enter secret answer":"Enter answer",onInput:q=>Rt(v.id,P.id,q)},null,40,J_)),P.isOther?(m(),w("input",{key:4,class:"request-input",type:P.isSecret?"password":"text",value:Bn(v.id,P.id),placeholder:"Other answer",onInput:q=>kn(v.id,P.id,q)},null,40,Y_)):ue("",!0)])}),128)),y("button",{type:"button",class:"request-button request-button-primary",onClick:P=>Wt(v)}," Submit Answers ",8,Q_)])):v.method==="item/tool/call"?(m(),w("section",X_,[y("button",{type:"button",class:"request-button request-button-primary",onClick:P=>fn(v.id)},"Fail Tool Call",8,Z_),y("button",{type:"button",class:"request-button",onClick:P=>Mn(v.id)},"Success (Empty)",8,ek)])):(m(),w("section",tk,[y("button",{type:"button",class:"request-button request-button-primary",onClick:P=>$n(v.id)},"Return Empty Result",8,nk),y("button",{type:"button",class:"request-button",onClick:P=>Fn(v.id)},"Reject Request",8,rk)]))])])])]))),128)),y("li",{ref_key:"bottomAnchorRef",ref:ae,class:"conversation-bottom-anchor"},null,512)],544)),le.value.length>0?(m(),w("div",{key:3,class:"image-modal-backdrop",onClick:re},[y("div",{class:"image-modal-content",onClick:p[0]||(p[0]=yt(()=>{},["stop"]))},[y("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:re},[De(wl,{class:"icon-svg"})]),y("img",{class:"image-modal-image",src:le.value,alt:"Expanded message image"},null,8,sk)])])):ue("",!0)]))}}),ak=ht(ik,[["__scopeId","data-v-dfa02d5e"]]),eu=.0025,ta=3,tu=2,lk=256;function ck(e){var Oe;const t=D("idle"),n=D(typeof navigator<"u"&&!!((Oe=navigator.mediaDevices)!=null&&Oe.getUserMedia)),r=D(0),s=D(null);let o=null,i=null,a=[],l=null,d=null,c=null,h=null,b=[],T=!1,N=!1;function O(){const ae=s.value;if(!ae||typeof window>"u")return;const Q=ae.getContext("2d");if(!Q)return;const le=Math.max(1,Math.floor(ae.clientWidth)),ee=Math.max(1,Math.floor(ae.clientHeight||36)),Pe=window.devicePixelRatio||1,Ne=Math.max(1,Math.floor(le*Pe)),qe=Math.max(1,Math.floor(ee*Pe));(ae.width!==Ne||ae.height!==qe)&&(ae.width=Ne,ae.height=qe),Q.setTransform(Pe,0,0,Pe,0,0),Q.clearRect(0,0,le,ee);const He=Math.max(12,Math.floor(le/(ta+tu))),Fe=b.slice(-He),Ae=Math.max(0,He-Fe.length),rt=ee/2,ze=getComputedStyle(ae).color||"#000000";for(let Be=0;Be<He;Be+=1){const lt=Fe[Be-Ae]??0,it=Math.max(.08,Math.min(1,lt*18))*rt,ct=Be*(ta+tu);Q.globalAlpha=lt<=eu?.35:1,Q.fillStyle=ze,Q.fillRect(ct,rt-it,ta,it*2)}Q.globalAlpha=1}function J(){b=[],r.value=0,O()}function oe(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),d&&(d.disconnect(),d=null),l&&(l.close(),l=null),h=null}function L(ae){if(typeof window>"u")return;const Q=window.webkitAudioContext,le=window.AudioContext??Q;le&&(oe(),J(),l=new le,d=l.createMediaStreamSource(ae),c=l.createScriptProcessor(2048,1,1),h=performance.now(),c.onaudioprocess=ee=>{const Pe=ee.inputBuffer.getChannelData(0);let Ne=0;for(let qe=0;qe<Pe.length;qe+=1){const He=Math.abs(Pe[qe]??0);Ne+=He<eu?0:He}b.push(Ne/Pe.length),b.length>lk&&b.shift(),h!==null&&(r.value=Math.max(0,performance.now()-h)),O()},d.connect(c),c.connect(l.destination),O())}async function ne(){var ae;if(!(t.value!=="idle"||!n.value||T)){T=!0,N=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=Q=>{Q.data.size>0&&a.push(Q.data)},o.onstop=()=>{var ee;const Q=a,le=(o==null?void 0:o.mimeType)||((ee=Q[0])==null?void 0:ee.type)||"audio/webm";ce(),be(Q,le)},L(i),o.start(250),t.value="recording",N&&te()}catch(Q){ce(),t.value="idle",(ae=e.onError)==null||ae.call(e,Q)}finally{T=!1}}}function te(){if(T&&t.value==="idle"){N=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}async function be(ae,Q){var ee,Pe,Ne,qe;if(ae.length===0){(ee=e.onEmpty)==null||ee.call(e),t.value="idle";return}const le=new Blob(ae,{type:Q});t.value="transcribing";try{const He=Q.split(/[/;]/)[1]??"webm",Fe=new FormData;Fe.append("file",le,`codex.${He}`);const Ae=await fetch("/codex-api/transcribe",{method:"POST",body:Fe}),rt=await Ae.text();let ze=null;try{ze=rt.trim()?JSON.parse(rt):null}catch{ze=null}if(!Ae.ok){const lt=(Pe=ze==null?void 0:ze.error)==null?void 0:Pe.trim(),Dt=rt.trim();throw new Error(lt||Dt||`Transcription failed: ${Ae.status}`)}const Be=((ze==null?void 0:ze.text)??"").trim();Be.length>0?e.onTranscript(Be):(Ne=e.onEmpty)==null||Ne.call(e)}catch(He){(qe=e.onError)==null||qe.call(e,He)}finally{t.value="idle"}}function ce(){oe(),J(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(ae=>ae.stop()),i=null),a=[]}Dr(ce);function me(){if(t.value==="recording"){te();return}t.value==="idle"&&ne()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:ne,stopRecording:te,toggleRecording:me}}function nu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Er extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function bl(e,t){const n=nu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=nu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function gs(e,t,n){return e instanceof Er?e:e instanceof Error?new Er(e.message||t,{code:"unknown_error",method:n}):new Er(t,{code:"unknown_error",method:n})}function Pf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function uk(e,t){const n={method:e,params:t??null};let r;try{r=await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)})}catch(i){throw new Er(i instanceof Error?i.message:`RPC ${e} failed before request was sent`,{code:"network_error",method:e})}let s=null;try{s=await r.json()}catch{s=null}if(!r.ok)throw new Er(bl(s,`RPC ${e} failed with HTTP ${r.status}`),{code:"http_error",method:e,status:r.status});const o=s;if(!o||typeof o!="object"||!("result"in o))throw new Er(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function dk(e){const t=Pf(e);if(!t||typeof t.method!="string"||t.method.length===0)return null;const n=typeof t.atIso=="string"&&t.atIso.length>0?t.atIso:new Date().toISOString();return{method:t.method,params:t.params??null,atIso:n}}function ru(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function fk(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const s=()=>{r!==null&&(window.clearTimeout(r),r=null)},o=(d,c)=>{if(n||r!==null)return;const h=Math.min(1e3*2**c,1e4);r=window.setTimeout(()=>{r=null,!n&&d()},h)},i=d=>{const c=dk(d);c&&e(c)},a=(d=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const c=new EventSource("/codex-api/events");let h=!1;c.onmessage=b=>{try{i(JSON.parse(b.data))}catch{}},c.addEventListener("ready",b=>{try{const T=b.data?JSON.parse(b.data):{ok:!0};ru(e,T)}catch{ru(e)}}),c.onerror=()=>{n||h||c.readyState===EventSource.CLOSED&&(h=!0,c.close(),o(()=>a(d+1),d))},t=()=>{h=!0,c.close()}},l=(d=0)=>{if(typeof WebSocket>"u"||n){a();return}t==null||t();const c=window.location.protocol==="https:"?"wss:":"ws:",h=new WebSocket(`${c}//${window.location.host}/codex-api/ws`);let b=!1,T=!1,N=window.setTimeout(()=>{b||n||T||(T=!0,h.close(),a())},2500);h.onopen=()=>{b=!0,s(),N!==null&&(window.clearTimeout(N),N=null)},h.onmessage=O=>{try{i(JSON.parse(String(O.data)))}catch{}},h.onerror=()=>{},h.onclose=()=>{if(N!==null&&(window.clearTimeout(N),N=null),!(n||T)){if(!b){a();return}o(()=>l(d+1),d)}},t=()=>{T=!0,N!==null&&(window.clearTimeout(N),N=null),h.close()}};return typeof WebSocket<"u"?l():a(),()=>{n=!0,s(),t==null||t()}}async function hk(e){let t;try{t=await fetch("/codex-api/server-requests/respond",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(r){throw new Er(r instanceof Error?r.message:"Failed to reply to server request",{code:"network_error",method:"server-requests/respond"})}let n=null;try{n=await t.json()}catch{n=null}if(!t.ok)throw new Er(bl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function pk(){const e=await fetch("/codex-api/server-requests/pending");let t=null;try{t=await e.json()}catch{t=null}if(!e.ok)throw new Er(bl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Pf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function su(e){return new Date(e*1e3).toISOString()}function mk(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function gk(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const vk=/^##\s+(.+?):\s+(.+?)\s*$/,yk=/^#\s*files mentioned by the user\s*:?\s*$/i;function wk(e){var s,o;const t=e.split(`
38
- `).findIndex(i=>yk.test(i.trim()));if(t<0)return[];const n=e.split(`
39
- `).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(vk);if(!l)break;const d=(s=l[1])==null?void 0:s.trim(),c=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");d&&c&&r.push({label:d,path:c})}return r}function bk(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const s=r.index+r[0].length;return e.slice(s).trim()}function _k(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[]};const n=[],r=[],s=[];for(const[a,l]of t.entries())l.type==="text"&&typeof l.text=="string"&&l.text.length>0&&n.push(l.text),l.type==="image"&&typeof l.url=="string"&&l.url.trim().length>0&&r.push(l.url.trim()),l.type!=="text"&&l.type!=="image"&&s.push({id:`${e}:user-content:${a}`,role:"user",text:"",messageType:`userContent.${l.type}`,rawPayload:gk(l),isUnhandled:!0});const o=n.join(`
40
- `),i=wk(o);return{text:bk(o),images:r,fileAttachments:i,rawBlocks:s}}function kk(e){var o;const t=e.replace(/\r\n/g,`
41
- `).trim();if(!t)return null;const n=t.split(`
42
- `),r=[],s=[];for(const i of n){const a=i.trim();if(!a){r.length===0&&s.push("");continue}const l=a.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(l){const d=(l[1]??" ").toLowerCase(),c=(o=l[2])==null?void 0:o.trim();if(!c)continue;let h="pending";d==="x"&&(h="completed"),(d==="~"||d===">"||d==="-")&&(h="inProgress"),r.push({step:c,status:h});continue}s.push(a)}return r.length===0?null:{explanation:s.join(`
43
- `).trim()||void 0,steps:r}}function Tk(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=_k(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="reasoning")return[];if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:kk(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=Sk(t.status),r=typeof t.command=="string"?t.command:"",s=typeof t.cwd=="string"?t.cwd:null,o=typeof t.aggregatedOutput=="string"?t.aggregatedOutput:"",i=typeof t.exitCode=="number"?t.exitCode:null;return[{id:e.id,role:"system",text:r,messageType:"commandExecution",commandExecution:{command:r,cwd:s,status:n,aggregatedOutput:o,exitCode:i}}]}return[]}function Sk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Ik(e){const t=[e.preview];for(const n of t)if(typeof n=="string"&&n.trim().length>0)return n.trim();return""}function Ek(e){const t=Ik(e);return t.length>0?t:"Untitled thread"}function Rf(e){return(e==null?void 0:e.status)==="inProgress"}function Ck(e){const t=e;if(t.inProgress===!0||t.status==="inProgress"||t.turnStatus==="inProgress")return!0;const r=(Array.isArray(e.turns)?e.turns:[]).at(-1);return Rf(r)}function Ak(e){const t=e,n=typeof t.cwd=="string"?t.cwd:e.cwd,r=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||n.includes("/.codex/worktrees/")||n.includes("/.git/worktrees/");return{id:e.id,title:Ek(e),projectName:mk(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:su(e.createdAt),updatedAtIso:su(e.updatedAt),preview:e.preview,unread:!1,inProgress:Ck(e)}}function xk(e){const t=new Map;for(const n of e){const r=t.get(n.projectName);r?r.push(n):t.set(n.projectName,[n])}return Array.from(t.entries()).map(([n,r])=>({projectName:n,threads:r.sort((s,o)=>new Date(o.updatedAtIso).getTime()-new Date(s.updatedAtIso).getTime())})).sort((n,r)=>{var i,a;const s=new Date(((i=n.threads[0])==null?void 0:i.updatedAtIso)??0).getTime();return new Date(((a=r.threads[0])==null?void 0:a.updatedAtIso)??0).getTime()-s})}function Pk(e){const t=e.data.map(Ak);return xk(t)}function Mf(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[],n=[];for(let r=0;r<t.length;r++){const s=t[r],o=Array.isArray(s.items)?s.items:[];for(const i of o)for(const a of Tk(i))n.push({...a,turnIndex:r})}return n}function Rk(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Rf(t.at(-1))}function na(e){return e&&e.length>0?e:null}const ou=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function wo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function Jo(e){return typeof e=="string"&&e.length>0?e:null}function ra(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function iu(e){return typeof e=="boolean"?e:null}function au(e){const t=wo(e);if(!t)return null;const n=ra(t.usedPercent??t.used_percent);return n===null?null:{usedPercent:n,windowMinutes:ra(t.windowDurationMins??t.window_minutes),resetsAt:ra(t.resetsAt??t.resets_at)}}function Mk(e){const t=wo(e);if(!t)return null;const n=iu(t.hasCredits??t.has_credits),r=iu(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:Jo(t.balance)}}function lu(e){const t=wo(e);if(!t)return null;const n=au(t.primary),r=au(t.secondary),s=Mk(t.credits);return!n&&!r&&!s?null:{limitId:Jo(t.limitId??t.limit_id),limitName:Jo(t.limitName??t.limit_name),primary:n,secondary:r,credits:s,planType:Jo(t.planType??t.plan_type)}}function $f(e){const t=wo(e);if(!t)return null;const n=wo(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=lu(n==null?void 0:n.codex);return r||lu(t.rateLimits??t.rate_limits)}async function un(e,t){try{return await uk(e,t)}catch(n){throw gs(n,`RPC ${e} failed`,e)}}function $k(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function Ok(){const e=await un("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return Pk(e)}async function Nk(e){const t=await un("thread/read",{threadId:e,includeTurns:!0});return{messages:Mf(t),inProgress:Rk(t)}}async function Dk(){try{return await Ok()}catch(e){throw gs(e,"Failed to load thread groups","thread/list")}}async function Lk(e){try{return await Nk(e)}catch(t){throw gs(t,`Failed to load thread ${e}`,"thread/read")}}function jk(e){return fk(e)}async function Bk(e,t){await hk({id:e,...t})}async function Fk(){return pk()}async function Uk(){try{const e=await un("account/rateLimits/read");return $f(e)}catch(e){throw gs(e,"Failed to load account rate limits","account/rateLimits/read")}}async function sa(e){await un("thread/resume",{threadId:e})}async function Hk(e){await un("thread/archive",{threadId:e})}async function Vk(e,t){await un("thread/name/set",{threadId:e,name:t})}async function cu(e,t){const n=await un("thread/rollback",{threadId:e,numTurns:t});return Mf(n)}function Wk(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}async function uu(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await un("thread/start",n),s=Wk(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw gs(n,"Failed to start a new thread","thread/start")}}function zk(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
44
- `;for(const r of t)n+=`
45
- ## ${r.label}: ${r.path}
46
- `;return`${n}
47
- ## My request for Codex:
48
-
49
- ${e}
50
- `}async function Gk(e,t){var a;const n=(e==null?void 0:e.trim())??"";if(n)return{model:n,reasoningEffort:na(t)};let r=null;try{r=await Nf()}catch{r=null}const s=(r==null?void 0:r.model.trim())??"";if(s)return{model:s,reasoningEffort:na(t??(r==null?void 0:r.reasoningEffort))};let o=[];try{o=await Of()}catch{o=[]}const i=((a=o.find(l=>l.trim().length>0))==null?void 0:a.trim())??"";if(i)return{model:i,reasoningEffort:na(t??(r==null?void 0:r.reasoningEffort))};throw new Error("Plan mode requires an available model. Wait for models to load and try again.")}async function oa(e,t,n=[],r,s,o,i=[],a){try{const l=(r==null?void 0:r.trim())??"",c=[{type:"text",text:zk(t,i)}];for(const T of n){const N=T.trim();N&&c.push({type:"image",url:N,image_url:N})}if(o)for(const T of o)c.push({type:"skill",name:T.name,path:T.path});const h=i.map(T=>({label:T.label,path:T.path,fsPath:T.fsPath})),b={threadId:e,input:c};if(h.length>0&&(b.attachments=h),l&&(b.model=l),typeof s=="string"&&s.length>0&&(b.effort=s),a==="plan"){const T=await Gk(l,s);b.collaborationMode={mode:"plan",settings:{model:T.model,reasoning_effort:T.reasoningEffort,developer_instructions:null}}}await un("turn/start",b)}catch(l){throw gs(l,`Failed to start turn for thread ${e}`,"turn/start")}}async function qk(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await un("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw gs(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function Kk(e){await un("setDefaultModel",{model:e})}async function Of(){const e=await un("model/list",{}),t=[];for(const n of e.data){const r=n.id||n.model;!r||t.includes(r)||t.push(r)}return t}async function Nf(){const e=await un("config/read",{}),t=e.config.model??"",n=$k(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function Jk(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function Yk(){try{const e=await un("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const s=r.mode;s!=="default"&&s!=="plan"||t.has(s)||(t.add(s),n.push({value:s,label:Jk(r.name||s)||(s==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of ou)t.has(r.value)||n.push(r);return n.sort((r,s)=>r.value===s.value?0:r.value==="default"?-1:1)}}catch{}return ou}function Qk(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=o=>{if(!Array.isArray(o))return[];const i=[];for(const a of o)typeof a=="string"&&a.length>0&&!i.includes(a)&&i.push(a);return i},r=t.labels,s={};if(r&&typeof r=="object"&&!Array.isArray(r))for(const[o,i]of Object.entries(r))typeof o=="string"&&o.length>0&&typeof i=="string"&&(s[o]=i);return{order:n(t.order),labels:s,active:n(t.active)}}async function Ys(){const e=await fetch("/codex-api/workspace-roots-state"),t=await e.json();if(!e.ok)throw new Error("Failed to load workspace roots state");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{};return Qk(n.data)}async function Xk(e){const t=await fetch("/codex-api/worktree/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sourceCwd:e})}),n=await t.json();if(!t.ok||!n.data)throw new Error(n.error||"Failed to create worktree");return n.data}async function du(){const e=await fetch("/codex-api/home-directory"),t=await e.json();if(!e.ok)throw new Error("Failed to load home directory");const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return typeof r.path=="string"?r.path.trim():""}async function fu(e){if(!(await fetch("/codex-api/workspace-roots-state",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})).ok)throw new Error("Failed to save workspace roots state")}async function Zk(e,t){const n=await fetch("/codex-api/project-root",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e,createIfMissing:(t==null?void 0:t.createIfMissing)===!0,label:(t==null?void 0:t.label)??""})}),r=await n.json();if(!n.ok){const a=_l(r,"Failed to open project root");throw new Error(a)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return typeof o.path=="string"?o.path.trim():""}async function e0(e){const t=new URLSearchParams({basePath:e}),n=await fetch(`/codex-api/project-root-suggestion?${t.toString()}`),r=await n.json();if(!n.ok){const i=_l(r,"Failed to suggest project name");throw new Error(i)}const s=r&&typeof r=="object"&&!Array.isArray(r)?r:{},o=s.data&&typeof s.data=="object"&&!Array.isArray(s.data)?s.data:{};return{name:typeof o.name=="string"?o.name.trim():"",path:typeof o.path=="string"?o.path.trim():""}}async function t0(e,t,n=20){const r=e.trim();if(!r)return[];const s=await fetch("/codex-api/composer-file-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:r,query:t.trim(),limit:n})}),o=await s.json();if(!s.ok){const d=_l(o,"Failed to search files");throw new Error(d)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const d of a){if(!d||typeof d!="object"||Array.isArray(d))continue;const h=d.path,b=typeof h=="string"?h.trim():"";b&&l.push({path:b})}return l}async function n0(e,t=200){const n=await fetch("/codex-api/thread-search",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({query:e,limit:t})}),r=await n.json();if(!n.ok)throw new Error(r.error||"Failed to search threads");return r.data??{threadIds:[],indexedThreadCount:0}}function _l(e,t){const r=(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).error;return typeof r=="string"&&r.trim().length>0?r:t}async function r0(){try{const e=await fetch("/codex-api/thread-titles");return e.ok?(await e.json()).data??{titles:{},order:[]}:{titles:{},order:[]}}catch{return{titles:{},order:[]}}}async function ia(e,t){try{await fetch("/codex-api/thread-titles",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,title:t})})}catch{}}async function s0(e,t){var n;try{return((n=(await un("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function o0(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await un("skills/list",t),r=[],s=new Set;for(const o of n.data)for(const i of o.skills)!i.name||s.has(i.path)||(s.add(i.path),r.push({name:i.name,description:i.shortDescription||i.description||"",path:i.path,scope:i.scope,enabled:i.enabled}));return r}catch{return[]}}async function hu(e){try{const t=new FormData;t.append("file",e);const n=await fetch("/codex-api/upload-file",{method:"POST",body:t});return n.ok?(await n.json()).path??null:null}catch{return null}}const i0={},a0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function l0(e,t){return m(),w("svg",a0,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m12 5l0 14m-6-8l6-6l6 6"},null,-1)])])}const c0=ht(i0,[["render",l0]]),u0={},d0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function f0(e,t){return m(),w("svg",d0,[...t[0]||(t[0]=[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 2m0 3a3 3 0 0 1 3-3h0a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h0a3 3 0 0 1-3-3zM5 10a7 7 0 0 0 14 0M8 21h8M12 17v4"},null,-1)])])}const h0=ht(u0,[["render",f0]]),p0={},m0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function g0(e,t){return m(),w("svg",m0,[...t[0]||(t[0]=[y("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),y("path",{fill:"currentColor",d:"M8 5a3 3 0 0 0 -3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3 -3v-8a3 3 0 0 0 -3 -3h-8z"},null,-1)])])}const pu=ht(p0,[["render",g0]]),v0=["disabled"],y0={class:"composer-dropdown-value"},w0={class:"composer-dropdown-menu"},b0={key:0,class:"composer-dropdown-search-wrap"},_0=["placeholder","onKeydown"],k0={class:"composer-dropdown-options",role:"listbox"},T0=["onClick"],S0={key:0,class:"composer-dropdown-empty"},I0={key:1,class:"composer-dropdown-add-wrap"},E0=["placeholder","onKeydown"],C0=Xt({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},openDirection:{},enableSearch:{type:Boolean},searchPlaceholder:{},showAddAction:{type:Boolean},addActionLabel:{},defaultAddValue:{},addPlaceholder:{}},emits:["update:modelValue","add"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(null),a=D(!1),l=D(""),d=D(!1),c=D(""),h=pe(()=>{var le;const Q=n.options.find(ee=>ee.value===n.modelValue);return Q?Q.label:((le=n.placeholder)==null?void 0:le.trim())||""}),b=pe(()=>n.openDirection??"down"),T=pe(()=>n.enableSearch===!0),N=pe(()=>n.showAddAction===!0),O=pe(()=>{var Q;return((Q=n.searchPlaceholder)==null?void 0:Q.trim())||"Quick search projects"}),J=pe(()=>{var Q;return((Q=n.addActionLabel)==null?void 0:Q.trim())||"Add new project"}),oe=pe(()=>{var Q;return((Q=n.addPlaceholder)==null?void 0:Q.trim())||"Project name or absolute path"}),L=pe(()=>{const Q=l.value.trim().toLowerCase();return Q?n.options.filter(le=>le.label.toLowerCase().includes(Q)||le.value.toLowerCase().includes(Q)):n.options});function ne(){n.disabled||(a.value=!a.value)}function te(Q){r("update:modelValue",Q),a.value=!1,l.value=""}function be(){var Q;d.value=!0,c.value=((Q=n.defaultAddValue)==null?void 0:Q.trim())||"",Kt(()=>{var le;return(le=i.value)==null?void 0:le.focus()})}function ce(){if(l.value.length>0){l.value="";return}a.value=!1}function me(){const Q=c.value.trim();Q&&(r("add",Q),d.value=!1,c.value="",a.value=!1,l.value="")}function Oe(){d.value=!1,c.value="",a.value=!1,l.value=""}function ae(Q){if(!a.value)return;const le=s.value;if(!le)return;const ee=Q.target;ee instanceof Node&&(le.contains(ee)||(a.value=!1,l.value="",d.value=!1,c.value=""))}return gt(a,Q=>{if(!Q){d.value=!1,c.value="";return}T.value&&Kt(()=>{var le;return(le=o.value)==null?void 0:le.focus()})}),Nr(()=>{window.addEventListener("pointerdown",ae)}),Dr(()=>{window.removeEventListener("pointerdown",ae)}),(Q,le)=>(m(),w("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[y("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:ne},[y("span",y0,W(h.value),1),De(Pi,{class:"composer-dropdown-chevron"})],8,v0),a.value?(m(),w("div",{key:0,class:ft(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":b.value==="up","composer-dropdown-menu-wrap-down":b.value==="down"}])},[y("div",w0,[T.value?(m(),w("div",b0,[Pr(y("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":le[0]||(le[0]=ee=>l.value=ee),class:"composer-dropdown-search-input",type:"text",placeholder:O.value,onKeydown:yn(yt(ce,["prevent"]),["esc"])},null,40,_0),[[Rr,l.value]])])):ue("",!0),y("ul",k0,[(m(!0),w($e,null,dt(L.value,ee=>(m(),w("li",{key:ee.value},[y("button",{class:ft(["composer-dropdown-option",{"is-selected":ee.value===e.modelValue}]),type:"button",onClick:Pe=>te(ee.value)},W(ee.label),11,T0)]))),128)),L.value.length===0?(m(),w("li",S0," No matching projects ")):ue("",!0)]),N.value?(m(),w("div",I0,[d.value?(m(),w($e,{key:0},[Pr(y("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":le[1]||(le[1]=ee=>c.value=ee),class:"composer-dropdown-add-input",type:"text",placeholder:oe.value,onKeydown:[yn(yt(me,["prevent"]),["enter"]),yn(yt(Oe,["prevent"]),["esc"])]},null,40,E0),[[Rr,c.value]]),y("div",{class:"composer-dropdown-add-actions"},[y("button",{type:"button",class:"composer-dropdown-add-btn",onClick:me},"Open"),y("button",{type:"button",class:"composer-dropdown-add-btn",onClick:Oe},"Cancel")])],64)):(m(),w("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:be},W(J.value),1))])):ue("",!0)])],2)):ue("",!0)],512))}}),La=ht(C0,[["__scopeId","data-v-7cfa2012"]]),A0=["disabled"],x0={class:"search-dropdown-value"},P0={class:"search-dropdown-search-wrap"},R0=["placeholder","onKeydown"],M0={key:0,class:"search-dropdown-list",role:"listbox"},$0=["onClick","onPointerenter"],O0={class:"search-dropdown-option-check"},N0={class:"search-dropdown-option-label"},D0={key:0,class:"search-dropdown-option-desc"},L0={key:1,class:"search-dropdown-empty"},j0=Xt({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(!1),a=D(""),l=D(0),d=pe(()=>n.openDirection??"down"),c=pe(()=>new Set(n.selectedValues)),h=pe(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const L=n.options.find(ne=>ne.value===n.selectedValues[0]);return(L==null?void 0:L.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),b=pe(()=>{const L=a.value.toLowerCase().trim();return L?n.options.filter(ne=>{var te;return ne.label.toLowerCase().includes(L)||(((te=ne.description)==null?void 0:te.toLowerCase().includes(L))??!1)}):n.options});function T(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,Kt(()=>{var L;return(L=o.value)==null?void 0:L.focus()})))}function N(L){r("toggle",L.value,!c.value.has(L.value))}function O(L){b.value.length!==0&&(l.value=(l.value+L+b.value.length)%b.value.length)}function J(){const L=b.value[l.value];L&&N(L)}function oe(L){if(!i.value)return;const ne=s.value;if(!ne)return;const te=L.target;te instanceof Node&&(ne.contains(te)||(i.value=!1))}return gt(a,()=>{l.value=0}),Nr(()=>window.addEventListener("pointerdown",oe)),Dr(()=>window.removeEventListener("pointerdown",oe)),(L,ne)=>(m(),w("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[y("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:T},[y("span",x0,W(h.value),1),De(Pi,{class:"search-dropdown-chevron"})],8,A0),i.value?(m(),w("div",{key:0,class:ft(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":d.value==="up","search-dropdown-menu-wrap-down":d.value==="down"}])},[y("div",P0,[Pr(y("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":ne[0]||(ne[0]=te=>a.value=te),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[ne[1]||(ne[1]=yn(yt(te=>i.value=!1,["prevent"]),["escape"])),yn(yt(J,["prevent"]),["enter"]),ne[2]||(ne[2]=yn(yt(te=>O(1),["prevent"]),["arrow-down"])),ne[3]||(ne[3]=yn(yt(te=>O(-1),["prevent"]),["arrow-up"]))]},null,40,R0),[[Rr,a.value]])]),b.value.length>0?(m(),w("ul",M0,[(m(!0),w($e,null,dt(b.value,(te,be)=>(m(),w("li",{key:te.value},[y("button",{class:ft(["search-dropdown-option",{"is-selected":c.value.has(te.value),"is-highlighted":be===l.value}]),type:"button",onClick:ce=>N(te),onPointerenter:ce=>l.value=be},[y("span",O0,W(c.value.has(te.value)?"✓":""),1),y("span",N0,W(te.label),1),te.description?(m(),w("span",D0,W(te.description),1)):ue("",!0)],42,$0)]))),128))])):(m(),w("div",L0,"No results"))],2)):ue("",!0)],512))}}),B0=ht(j0,[["__scopeId","data-v-a0f2edd4"]]),F0={class:"skill-picker-header"},U0=["onKeydown"],H0={key:0,class:"skill-picker-list",role:"listbox"},V0=["onClick","onPointerenter"],W0={class:"skill-picker-name"},z0={key:0,class:"skill-picker-desc"},G0={key:1,class:"skill-picker-empty"},q0=Xt({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(null),i=D(""),a=D(0),l=pe(()=>{const b=i.value.toLowerCase().trim();return b?n.skills.filter(T=>T.name.toLowerCase().includes(b)||T.description.toLowerCase().includes(b)):n.skills}),d=pe(()=>{const b={};return n.anchorBottom!=null&&(b.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(b.left=`${n.anchorLeft}px`),b});function c(b){l.value.length!==0&&(a.value=(a.value+b+l.value.length)%l.value.length)}function h(){const b=l.value[a.value];b&&r("select",b)}return gt(()=>n.visible,b=>{b&&(i.value="",a.value=0,Kt(()=>{var T;return(T=o.value)==null?void 0:T.focus()}))}),gt(i,()=>{a.value=0}),(b,T)=>e.visible?(m(),w("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:qr(d.value)},[y("div",F0,[Pr(y("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":T[0]||(T[0]=N=>i.value=N),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[T[1]||(T[1]=yn(yt(N=>b.$emit("close"),["prevent"]),["escape"])),yn(yt(h,["prevent"]),["enter"]),T[2]||(T[2]=yn(yt(N=>c(1),["prevent"]),["arrow-down"])),T[3]||(T[3]=yn(yt(N=>c(-1),["prevent"]),["arrow-up"]))]},null,40,U0),[[Rr,i.value]])]),l.value.length>0?(m(),w("ul",H0,[(m(!0),w($e,null,dt(l.value,(N,O)=>(m(),w("li",{key:N.path},[y("button",{class:ft(["skill-picker-item",{"is-highlighted":O===a.value}]),type:"button",onClick:J=>b.$emit("select",N),onPointerenter:J=>a.value=O},[y("span",W0,W(N.name),1),N.description?(m(),w("span",z0,W(N.description),1)):ue("",!0)],42,V0)]))),128))])):(m(),w("div",G0,"No skills found"))],4)):ue("",!0)}}),K0=ht(q0,[["__scopeId","data-v-ff3fb7dc"]]),J0={key:0,class:"thread-composer-dictation-error"},Y0={key:0,class:"thread-composer-attachments"},Q0=["src","alt"],X0=["aria-label","disabled","onClick"],Z0={key:1,class:"thread-composer-folder-chips"},eT=["title"],tT={class:"thread-composer-folder-chip-meta"},nT=["aria-label","disabled","onClick"],rT={key:2,class:"thread-composer-file-chips"},sT=["title"],oT=["aria-label","disabled","onClick"],iT={key:3,class:"thread-composer-skill-chips"},aT={class:"thread-composer-skill-chip-name"},lT=["aria-label","onClick"],cT=["title"],uT={class:"thread-composer-rate-limit-row"},dT={class:"thread-composer-rate-limit-value"},fT={key:0,class:"thread-composer-rate-limit-refresh"},hT={class:"thread-composer-input-wrap"},pT={key:0,class:"thread-composer-file-mentions"},mT=["onMousedown"],gT={key:1,class:"thread-composer-file-mention-icon-markdown"},vT={class:"thread-composer-file-mention-text"},yT={class:"thread-composer-file-mention-name"},wT={key:0,class:"thread-composer-file-mention-dir"},bT={key:1,class:"thread-composer-file-mention-empty"},_T=["placeholder","disabled"],kT=["disabled"],TT={key:0,class:"thread-composer-attach-menu"},ST=["disabled"],IT=["disabled"],ET=["disabled"],CT=["aria-label","aria-pressed","disabled"],AT={class:"thread-composer-plan-toggle-state"},xT={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},PT={key:1,class:"thread-composer-dictation-timer"},RT=["aria-label","title","disabled"],MT={key:1,class:"thread-composer-mic-spinner","aria-hidden":"true"},$T=["disabled"],OT=["aria-label","title","disabled"],NT=["disabled"],DT=["disabled"],LT=["disabled"],jT=Xt({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},collaborationModes:{},selectedCollaborationMode:{},models:{},selectedModel:{},selectedReasoningEffort:{},skills:{},codexQuota:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean}},emits:["submit","interrupt","update:selected-collaboration-mode","update:selected-model","update:selected-reasoning-effort"],setup(e,{emit:t}){const n=e,r=t,s=D(""),o=D([]),i=D([]),a=D([]),l=D([]),d=D(""),{state:c,isSupported:h,recordingDurationMs:b,waveformCanvasRef:T,startRecording:N,stopRecording:O,toggleRecording:J}=ck({onTranscript:C=>{s.value=s.value?`${s.value}
51
- ${C}`:C,d.value="",Kt(()=>{var j;return(j=be.value)==null?void 0:j.focus()})},onEmpty:()=>{d.value=n.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:C=>{if(C instanceof DOMException&&C.name==="NotAllowedError"){d.value="Microphone access was denied.";return}d.value=C instanceof Error?C.message:"Dictation failed."}}),oe=D(null),L=D(null),ne=D(null),te=D(null),be=D(null),ce=D(!1),me=D(!1),Oe=D(null),ae=D(""),Q=D([]),le=D(!1),ee=D(0);let Pe=0,Ne=null,qe=!1;const He=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),Fe=[{value:"none",label:"None"},{value:"minimal",label:"Minimal"},{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"xhigh",label:"Extra high"}],Ae=pe(()=>n.models.map(C=>({value:C,label:C}))),rt=pe(()=>n.selectedCollaborationMode==="plan"),ze=pe(()=>n.selectedCollaborationMode==="plan"&&n.selectedModel.trim().length===0),Be=pe(()=>n.skills??[]),lt=pe(()=>i.value.map(C=>C.path)),Dt=pe(()=>(n.skills??[]).map(C=>({value:C.path,label:C.name,description:C.description}))),it=pe(()=>n.disabled||!n.activeThreadId||ze.value?!1:s.value.trim().length>0||o.value.length>0||a.value.length>0),ct=pe(()=>{const C=new Set;for(const j of l.value)for(const re of j.filePaths)C.add(re);return a.value.filter(j=>!C.has(j.fsPath))}),Ve=pe(()=>n.disabled||!n.activeThreadId),V=pe(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),we=pe(()=>c.value==="recording"),he=pe(()=>c.value==="recording"?"Stop dictation":c.value==="transcribing"?"Transcribing dictation":n.dictationClickToToggle?"Click to dictate":"Hold to dictate"),Ce=pe(()=>c.value==="idle"?d.value.trim():""),xe=pe(()=>{const C=Math.max(0,Math.floor(b.value/1e3)),j=Math.floor(C/60),re=C%60;return`${j}:${String(re).padStart(2,"0")}`}),k=pe(()=>n.activeThreadId?ze.value?"Loading models for plan mode...":"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),I=pe(()=>ve(n.codexQuota??null)),M=pe(()=>""),K=pe(()=>_e(n.codexQuota??null));function F(C){return!C||C==="unknown"?"":C==="edu"?"Education":`${C.slice(0,1).toUpperCase()}${C.slice(1)}`}function R(C){return typeof C!="number"||!Number.isFinite(C)||C<=0?"":C%1440===0?`${C/1440}d`:C%60===0?`${C/60}h`:`${C}m`}function H(C){if(typeof C!="number"||!Number.isFinite(C))return"";const re=C*1e3-Date.now();if(re<=0)return"resetting now";const je=Math.round(re/6e4);if(je<60)return`resets in ${Math.max(1,je)}m`;const g=Math.round(je/60);if(g<48)return`resets in ${Math.max(1,g)}h`;const p=Math.round(g/24);return`resets in ${Math.max(1,p)}d`}function U(C){return typeof C!="number"||!Number.isFinite(C)?"":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(C*1e3))}function z(C){if(typeof C!="number"||!Number.isFinite(C))return"";const j=new Date(C*1e3);return`${j.getMonth()+1}月${j.getDate()}日`}function G(C){const j=[C.primary,C.secondary].filter(g=>g!==null),re=j.find(g=>g.windowMinutes===10080);return re||(j.filter(g=>typeof g.windowMinutes=="number"&&g.windowMinutes>=10080).sort((g,p)=>(g.windowMinutes??0)-(p.windowMinutes??0))[0]??null)}function Te(C){const j=Math.max(0,Math.min(100,100-Math.round(C.usedPercent))),re=R(C.windowMinutes);return re?`${j}% / ${re}`:`${j}%`}function ve(C){var p,v;if(!C)return"";const j=[],re=F(C.planType);re&&j.push(re),C.primary&&j.push(Te(C.primary)),C.secondary&&j.push(Te(C.secondary));const je=G(C),g=z((je==null?void 0:je.resetsAt)??null);return g&&j.push(g),j.length===0&&((p=C.credits)!=null&&p.unlimited)?j.push("Unlimited credits"):j.length===0&&((v=C.credits)!=null&&v.hasCredits)&&C.credits.balance&&j.push(`${C.credits.balance} credits`),j.join(" · ")}function _e(C){var g,p;if(!C)return"";const j=[],re=F(C.planType);if(re&&j.push(`Plan: ${re}`),C.primary){const v=H(C.primary.resetsAt);j.push(`Primary window: ${Te(C.primary)}${v?`, ${v}`:""}`)}if(C.secondary){const v=H(C.secondary.resetsAt);j.push(`Secondary window: ${Te(C.secondary)}${v?`, ${v}`:""}`)}(g=C.credits)!=null&&g.unlimited?j.push("Credits: unlimited"):(p=C.credits)!=null&&p.hasCredits&&C.credits.balance&&j.push(`Credits: ${C.credits.balance}`);const je=G(C);if(je){const v=U(je.resetsAt);v&&j.push(`Weekly refresh: ${v}`)}return j.join(`
52
- `)}function Ie(C="steer"){var re;const j=s.value.trim();if(it.value){if(r("submit",{text:j,imageUrls:o.value.map(je=>je.url),fileAttachments:[...a.value],skills:i.value.map(je=>({name:je.name,path:je.path})),mode:C}),s.value="",o.value=[],i.value=[],a.value=[],l.value=[],ce.value=!1,me.value=!1,Le(),He){(re=be.value)==null||re.blur();return}Kt(()=>{var je;return(je=be.value)==null?void 0:je.focus()})}}function Ue(){r("interrupt")}function tt(C){r("update:selected-model",C)}function Qe(){r("update:selected-collaboration-mode",rt.value?"default":"plan")}function ut(C){r("update:selected-reasoning-effort",C)}function et(){n.dictationClickToToggle&&(d.value&&(d.value=""),J())}function pt(C){if(n.dictationClickToToggle||(C.preventDefault(),qe))return;qe=!0;const j=C.currentTarget;if(j)try{j.setPointerCapture(C.pointerId)}catch{}d.value&&(d.value=""),window.addEventListener("pointerup",Ke),window.addEventListener("pointercancel",Ke),window.addEventListener("blur",Ke),N()}function Ke(){n.dictationClickToToggle||qe&&(qe=!1,window.removeEventListener("pointerup",Ke),window.removeEventListener("pointercancel",Ke),window.removeEventListener("blur",Ke),O())}function Ot(){Ve.value||(ce.value=!ce.value)}function dn(){var C;(C=L.value)==null||C.click()}function st(){var C;(C=ne.value)==null||C.click()}function vt(){var C;(C=te.value)==null||C.click()}function at(C){o.value=o.value.filter(j=>j.id!==C)}function Vt(C){i.value=i.value.filter(j=>j.path!==C)}function Rt(C){a.value=a.value.filter(j=>j.fsPath!==C)}function Et(C){const j=l.value.find(je=>je.id===C);if(!j)return;const re=new Set(j.filePaths);a.value=a.value.filter(je=>!re.has(je.fsPath)),l.value=l.value.filter(je=>je.id!==C)}function Bn(C){return C.total<=0?0:Math.round(C.processed/C.total*100)}function _n(C,j){const re=C.replace(/\\/g,"/");if(a.value.some(p=>p.fsPath===re))return;const je=re.split("/").filter(Boolean),g=(j==null?void 0:j.trim())||je[je.length-1]||re;a.value=[...a.value,{label:g,path:re,fsPath:re}]}function kn(C){return C.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(C.name)}function jt(C){const j=new FileReader;j.onload=()=>{typeof j.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:C.name||`Pasted image ${o.value.length+1}`,url:j.result})},j.readAsDataURL(C)}function Wt(C){if(!(!C||C.length===0))for(const j of Array.from(C)){if(kn(j)){jt(j);continue}hu(j).then(re=>{re&&_n(re)}).catch(()=>{})}}function fn(C){var je,g;const j=(je=C.clipboardData)==null?void 0:je.items;if(j&&j.length>0){const p=[];for(const v of Array.from(j)){if(v.kind!=="file"||!v.type.startsWith("image/"))continue;const P=v.getAsFile();P&&p.push(P)}if(p.length>0)return p}const re=(g=C.clipboardData)==null?void 0:g.files;return!re||re.length===0?[]:Array.from(re).filter(p=>kn(p))}function Mn(C){if(Ve.value)return;const j=fn(C);j.length!==0&&(C.preventDefault(),Wt(j),ce.value=!1,d.value&&(d.value=""))}async function $n(C){if(!C||C.length===0)return;const j=Array.from(C),je=(j[0].webkitRelativePath||j[0].name).split("/").filter(Boolean)[0]||"Folder",g=`${Date.now()}-${Math.random().toString(36).slice(2)}`;l.value=[...l.value,{id:g,name:je,total:j.length,processed:0,filePaths:[],isUploading:!0}];const p=v=>{l.value=l.value.map(P=>P.id===g?v(P):P)};for(const v of j)try{const P=await hu(v);if(P){const B=v.webkitRelativePath||v.name;_n(P,B),p(q=>({...q,processed:q.processed+1,filePaths:[...q.filePaths,P]}));continue}p(B=>({...B,processed:B.processed+1}))}catch{p(P=>({...P,processed:P.processed+1}))}p(v=>({...v,isUploading:!1}))}function Fn(C){C&&(C.value="")}function tn(C){const j=C.target;Wt((j==null?void 0:j.files)??null),Fn(j),ce.value=!1}function Tn(C){const j=C.target;Wt((j==null?void 0:j.files)??null),Fn(j),ce.value=!1}function Un(C){const j=C.target;$n((j==null?void 0:j.files)??null),Fn(j),ce.value=!1}function pr(){d.value&&(d.value="");const j=s.value.startsWith("/");j!==me.value&&(me.value=j),Re()}function mr(C){if(le.value){if(C.key==="Escape"){C.preventDefault(),Le();return}if(C.key==="ArrowDown"){C.preventDefault(),Q.value.length>0&&(ee.value=(ee.value+1)%Q.value.length);return}if(C.key==="ArrowUp"){if(C.preventDefault(),Q.value.length>0){const re=Q.value.length;ee.value=(ee.value+re-1)%re}return}if(C.key==="Enter"||C.key==="Tab"){C.preventDefault();const re=Q.value[ee.value];re?Bt(re):Le();return}}if(n.sendWithEnter!==!1?C.key==="Enter"&&!C.shiftKey:C.key==="Enter"&&(C.metaKey||C.ctrlKey)){C.preventDefault(),Ie(n.isTurnInProgress?V.value:"steer");return}if(me.value){if(C.key==="Escape"){C.preventDefault(),Hn();return}if(C.key==="ArrowDown"||C.key==="ArrowUp"){C.preventDefault();return}}}function Hn(){var C;me.value=!1,(C=be.value)==null||C.focus()}function Le(){le.value=!1,Oe.value=null,ae.value="",Q.value=[],ee.value=0}function Re(){const C=be.value;if(!C){Le();return}const j=C.selectionStart??s.value.length,je=s.value.slice(0,j).match(/(^|\s)(@[^\s@]*)$/);if(!je){Le();return}const g=je[2]??"",p=g.length,v=j-p;Oe.value=v,ae.value=g.slice(1),le.value=!0,Sn()}async function Sn(){if(!le.value)return;const C=(n.cwd??"").trim();if(!C){Q.value=[];return}Ne&&clearTimeout(Ne);const j=++Pe;Ne=setTimeout(async()=>{try{const re=await t0(C,ae.value,20);if(!le.value||j!==Pe)return;Q.value=re,ee.value=0}catch{if(!le.value||j!==Pe)return;Q.value=[]}},120)}function Bt(C){const j=be.value,re=Oe.value;if(re!==null&&j){const je=j.selectionStart??s.value.length;s.value=`${s.value.slice(0,re)}${s.value.slice(je)}`.trimEnd()}_n(C.path),Le(),Kt(()=>j==null?void 0:j.focus())}function Cn(C){const j=C.lastIndexOf("/");return j<0?C:C.slice(j+1)}function On(C){const j=C.lastIndexOf("/");return j<=0?"":C.slice(0,j)}function hn(C){const j=Cn(C),re=j.lastIndexOf(".");return re<=0?"":j.slice(re+1).toLowerCase()}function zt(C){const j=hn(C);return j==="ts"?"TS":j==="tsx"?"TSX":j==="js"?"JS":j==="jsx"?"JSX":j==="json"?"{}":""}function Nn(C){const j=hn(C);return j.startsWith("ts")?"ts":j.startsWith("js")?"js":j==="json"?"json":"default"}function An(C){const j=hn(C);return j==="md"||j==="mdx"}function Zn(C){var j;i.value.some(re=>re.path===C.path)||(i.value=[...i.value,C]),s.value=s.value.startsWith("/")?"":s.value,me.value=!1,(j=be.value)==null||j.focus()}function xn(C,j){if(j){const re=(n.skills??[]).find(je=>je.path===C);re&&!i.value.some(je=>je.path===C)&&(i.value=[...i.value,re])}else i.value=i.value.filter(re=>re.path!==C)}function In(C){if(!ce.value)return;const j=oe.value;if(!j)return;const re=C.target;!re||j.contains(re)||(ce.value=!1)}return Nr(()=>{document.addEventListener("click",In)}),Dr(()=>{document.removeEventListener("click",In),window.removeEventListener("pointerup",Ke),window.removeEventListener("pointercancel",Ke),window.removeEventListener("blur",Ke),Ne&&clearTimeout(Ne)}),gt(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],a.value=[],l.value=[],d.value="",ce.value=!1,me.value=!1,Le()}),gt(()=>n.cwd,()=>{le.value&&Sn()}),(C,j)=>(m(),w("form",{class:"thread-composer",onSubmit:j[2]||(j[2]=yt(re=>Ie("steer"),["prevent"]))},[Ce.value?(m(),w("p",J0,W(Ce.value),1)):ue("",!0),y("div",{class:ft(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(m(),w("div",Y0,[(m(!0),w($e,null,dt(o.value,re=>(m(),w("div",{key:re.id,class:"thread-composer-attachment"},[y("img",{class:"thread-composer-attachment-image",src:re.url,alt:re.name||"Selected image"},null,8,Q0),y("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${re.name||"image"}`,disabled:Ve.value,onClick:je=>at(re.id)}," x ",8,X0)]))),128))])):ue("",!0),l.value.length>0?(m(),w("div",Z0,[(m(!0),w($e,null,dt(l.value,re=>(m(),w("span",{key:re.id,class:"thread-composer-folder-chip"},[De(yl,{class:"thread-composer-folder-chip-icon"}),y("span",{class:"thread-composer-folder-chip-name",title:re.name},W(re.name),9,eT),y("span",tT,[re.isUploading?(m(),w($e,{key:0},[mo(W(Bn(re))+"% uploading ("+W(re.processed)+"/"+W(re.total)+") ",1)],64)):(m(),w($e,{key:1},[mo(W(re.filePaths.length)+" file"+W(re.filePaths.length===1?"":"s"),1)],64))]),y("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${re.name}`,disabled:Ve.value,onClick:je=>Et(re.id)},"×",8,nT)]))),128))])):ue("",!0),ct.value.length>0?(m(),w("div",rT,[(m(!0),w($e,null,dt(ct.value,re=>(m(),w("span",{key:re.fsPath,class:"thread-composer-file-chip"},[De(li,{class:"thread-composer-file-chip-icon"}),y("span",{class:"thread-composer-file-chip-name",title:re.fsPath},W(re.label),9,sT),y("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${re.label}`,disabled:Ve.value,onClick:je=>Rt(re.fsPath)},"×",8,oT)]))),128))])):ue("",!0),i.value.length>0?(m(),w("div",iT,[(m(!0),w($e,null,dt(i.value,re=>(m(),w("span",{key:re.path,class:"thread-composer-skill-chip"},[y("span",aT,W(re.name),1),y("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${re.name}`,onClick:je=>Vt(re.path)},"×",8,lT)]))),128))])):ue("",!0),I.value?(m(),w("div",{key:4,class:"thread-composer-rate-limit",title:K.value,"aria-live":"polite"},[y("span",uT,[j[3]||(j[3]=y("span",{class:"thread-composer-rate-limit-label"},"Codex quota",-1)),y("span",dT,W(I.value),1)]),M.value?(m(),w("span",fT,W(M.value),1)):ue("",!0)],8,cT)):ue("",!0),y("div",hT,[le.value?(m(),w("div",pT,[Q.value.length>0?(m(!0),w($e,{key:0},dt(Q.value,(re,je)=>(m(),w("button",{key:re.path,class:ft(["thread-composer-file-mention-row",{"is-active":je===ee.value}]),type:"button",onMousedown:yt(g=>Bt(re),["prevent"])},[zt(re.path)?(m(),w("span",{key:0,class:ft(["thread-composer-file-mention-icon-badge",`is-${Nn(re.path)}`])},W(zt(re.path)),3)):An(re.path)?(m(),w("span",gT,"↓")):(m(),mt(li,{key:2,class:"thread-composer-file-mention-icon-file"})),y("span",vT,[y("span",yT,W(Cn(re.path)),1),On(re.path)?(m(),w("span",wT,W(On(re.path)),1)):ue("",!0)])],42,mT))),128)):(m(),w("div",bT,"No matching files"))])):ue("",!0),Pr(y("textarea",{ref_key:"inputRef",ref:be,"onUpdate:modelValue":j[0]||(j[0]=re=>s.value=re),class:"thread-composer-input",placeholder:k.value,disabled:Ve.value,onInput:pr,onKeydown:mr,onPaste:Mn},null,40,_T),[[Rr,s.value]]),De(K0,{skills:Be.value,visible:me.value,"anchor-bottom":44,"anchor-left":0,onSelect:Zn,onClose:Hn},null,8,["skills","visible"])]),y("div",{class:ft(["thread-composer-controls",{"thread-composer-controls--recording":we.value}])},[y("div",{ref_key:"attachMenuRootRef",ref:oe,class:"thread-composer-attach"},[y("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:Ve.value,onClick:Ot}," + ",8,kT),ce.value?(m(),w("div",TT,[y("button",{class:"thread-composer-attach-item",type:"button",disabled:Ve.value,onClick:dn}," Add photos & files ",8,ST),y("button",{class:"thread-composer-attach-item",type:"button",disabled:Ve.value,onClick:vt}," Add folder ",8,IT),y("button",{class:"thread-composer-attach-item",type:"button",disabled:Ve.value,onClick:st}," Take photo ",8,ET)])):ue("",!0)],512),we.value?ue("",!0):(m(),w($e,{key:0},[y("button",{class:ft(["thread-composer-plan-toggle",{"is-active":rt.value}]),type:"button","aria-label":rt.value?"Disable plan mode":"Enable plan mode","aria-pressed":rt.value,disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onClick:Qe},[j[4]||(j[4]=y("span",{class:"thread-composer-plan-toggle-label"},"Plan",-1)),y("span",AT,W(rt.value?"On":"Off"),1)],10,CT),De(La,{class:"thread-composer-control","model-value":e.selectedModel,options:Ae.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":tt},null,8,["model-value","options","disabled"]),De(B0,{class:"thread-composer-control",options:Dt.value,"selected-values":lt.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:xn},null,8,["options","selected-values","disabled"]),De(La,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Fe,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":ut},null,8,["model-value","disabled"])],64)),y("div",{class:ft(["thread-composer-actions",{"thread-composer-actions--recording":we.value}])},[ye(c)==="recording"?(m(),w("div",xT,[y("canvas",{ref_key:"dictationWaveformCanvasRef",ref:T,class:"thread-composer-dictation-waveform"},null,512)])):ue("",!0),ye(c)==="recording"?(m(),w("span",PT,W(xe.value),1)):ue("",!0),ye(h)&&!e.isTurnInProgress?(m(),w("button",{key:2,class:ft(["thread-composer-mic",{"thread-composer-mic--active":ye(c)==="recording","thread-composer-mic--transcribing":ye(c)==="transcribing"}]),type:"button","aria-label":he.value,title:he.value,disabled:Ve.value||ye(c)==="transcribing",onClick:et,onPointerdown:pt,onPointerup:Ke,onPointercancel:Ke},[ye(c)==="recording"?(m(),mt(pu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):ye(c)==="transcribing"?(m(),w("span",MT)):(m(),mt(h0,{key:2,class:"thread-composer-mic-icon"}))],42,RT)):ue("",!0),e.isTurnInProgress?(m(),w("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:Ue},[De(pu,{class:"thread-composer-stop-icon"})],8,$T)):ue("",!0),y("button",{class:ft(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&V.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&V.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${V.value}`:"Send",disabled:!it.value,onClick:j[1]||(j[1]=re=>Ie(e.isTurnInProgress?V.value:"steer"))},[De(c0,{class:"thread-composer-submit-icon"})],10,OT)],2)],2)],2),y("input",{ref_key:"photoLibraryInputRef",ref:L,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Ve.value,onChange:tn},null,40,NT),y("input",{ref_key:"cameraCaptureInputRef",ref:ne,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Ve.value,onChange:Tn},null,40,DT),y("input",{ref_key:"folderPickerInputRef",ref:te,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Ve.value,onChange:Un},null,40,LT)],32))}}),mu=ht(jT,[["__scopeId","data-v-5c9f8046"]]),BT={key:0,class:"queued-messages"},FT={class:"queued-messages-inner"},UT={class:"queued-row-text"},HT={class:"queued-row-actions"},VT=["onClick"],WT=["onClick"],zT=Xt({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(m(),w("div",BT,[y("div",FT,[(m(!0),w($e,null,dt(e.messages,r=>(m(),w("div",{key:r.id,class:"queued-row"},[n[1]||(n[1]=y("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})],-1)),y("span",UT,W(r.text),1),y("div",HT,[y("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,VT),y("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:s=>t.$emit("delete",r.id)},[...n[0]||(n[0]=[y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[y("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3"})],-1)])],8,WT)])]))),128))])])):ue("",!0)}}),GT=ht(zT,[["__scopeId","data-v-ea583733"]]),qT={class:"runtime-dropdown-trigger-label"},KT={key:0,class:"runtime-dropdown-menu-wrap"},JT={class:"runtime-dropdown-menu"},YT=["onClick"],QT={class:"runtime-dropdown-option-label"},XT={key:0,class:"runtime-dropdown-option-check"},ZT=Xt({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(!1),i=[{value:"local",label:"Local project",icon:yl},{value:"worktree",label:"New worktree",icon:Ko}],a=pe(()=>i.find(c=>c.value===n.modelValue)??i[0]);function l(c){r("update:modelValue",c),o.value=!1}function d(c){if(!o.value)return;const h=s.value;if(!h)return;const b=c.target;b instanceof Node&&(h.contains(b)||(o.value=!1))}return Nr(()=>{window.addEventListener("pointerdown",d)}),Dr(()=>{window.removeEventListener("pointerdown",d)}),(c,h)=>(m(),w("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[y("button",{class:"runtime-dropdown-trigger",type:"button",onClick:h[0]||(h[0]=b=>o.value=!o.value)},[(m(),mt(si(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),y("span",qT,W(a.value.label),1),De(Pi,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(m(),w("div",KT,[y("div",JT,[h[1]||(h[1]=y("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(m(),w($e,null,dt(i,b=>y("button",{key:b.value,class:ft(["runtime-dropdown-option",{"is-selected":e.modelValue===b.value}]),type:"button",onClick:T=>l(b.value)},[(m(),mt(si(b.icon),{class:"runtime-dropdown-option-icon"})),y("span",QT,W(b.label),1),e.modelValue===b.value?(m(),w("span",XT,"✓")):ue("",!0)],10,YT)),64))])])):ue("",!0)],512))}}),eS=ht(ZT,[["__scopeId","data-v-9c9b71e5"]]),tS={},nS={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function rS(e,t){return m(),w("svg",nS,[...t[0]||(t[0]=[y("circle",{cx:"11",cy:"11",r:"8"},null,-1),y("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const ja=ht(tS,[["render",rS]]),sS={class:"skill-card-top"},oS=["src","alt"],iS={key:1,class:"skill-card-avatar-fallback"},aS={class:"skill-card-info"},lS={class:"skill-card-header"},cS={class:"skill-card-name"},uS={key:0,class:"skill-card-badge-disabled"},dS={key:1,class:"skill-card-badge"},fS={class:"skill-card-owner"},hS={key:0,class:"skill-card-desc"},pS={key:1,class:"skill-card-date"},mS=Xt({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=pe(()=>{const s=t.skill.publishedAt;if(!s)return"";const o=new Date(s),a=Date.now()-s;return a<36e5?`${Math.floor(a/6e4)}m ago`:a<864e5?`${Math.floor(a/36e5)}h ago`:a<2592e6?`${Math.floor(a/864e5)}d ago`:o.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function r(s){const o=s.target;o.style.display="none"}return(s,o)=>(m(),w("button",{class:ft(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:o[0]||(o[0]=i=>s.$emit("select",e.skill))},[y("div",sS,[e.skill.avatarUrl?(m(),w("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,oS)):(m(),w("div",iS,W(e.skill.owner.charAt(0)),1)),y("div",aS,[y("div",lS,[y("span",cS,W(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(m(),w("span",uS,"Disabled")):e.skill.installed?(m(),w("span",dS,"Installed")):ue("",!0)]),y("span",fS,W(e.skill.owner),1)])]),e.skill.description?(m(),w("p",hS,W(e.skill.description),1)):ue("",!0),n.value?(m(),w("span",pS,W(n.value),1)):ue("",!0)],2))}}),gu=ht(mS,[["__scopeId","data-v-2a1e8196"]]),gS={class:"sdm-panel"},vS={class:"sdm-header"},yS={class:"sdm-title-area"},wS=["src","alt"],bS={class:"sdm-title-col"},_S={class:"sdm-title-row"},kS={class:"sdm-title"},TS={key:0,class:"sdm-badge-disabled"},SS={class:"sdm-owner"},IS={class:"sdm-body"},ES={key:0,class:"sdm-desc"},CS={key:1,class:"sdm-readme-loading"},AS=["innerHTML"],xS=["href"],PS={class:"sdm-footer"},RS={class:"sdm-footer-actions"},MS=["disabled"],$S=["disabled"],OS=["disabled"],NS=Xt({__name:"SkillDetailModal",props:{skill:{},visible:{type:Boolean},isInstalling:{type:Boolean},isUninstalling:{type:Boolean}},emits:["close","install","uninstall","toggle-enabled"],setup(e,{emit:t}){const n=e,r=t,s=D(null),o=D(""),i=D(!1),a=pe(()=>s.value??n.skill.enabled??!0),l=pe(()=>n.isInstalling===!0||n.isUninstalling===!0),d=pe(()=>{const O=o.value;if(!O)return"";const J=O.replace(/^---[\s\S]*?---\s*/,"");return c(J)});function c(O){return O.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/^### (.+)$/gm,"<h4>$1</h4>").replace(/^## (.+)$/gm,"<h3>$1</h3>").replace(/^# (.+)$/gm,"<h2>$1</h2>").replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>").replace(/`([^`]+)`/g,"<code>$1</code>").replace(/^- (.+)$/gm,"<li>$1</li>").replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>").replace(/\n{2,}/g,"<br/><br/>").replace(/\n/g,"<br/>")}async function h(){if(!(!n.skill.owner||!n.skill.name)){i.value=!0,o.value="";try{const O=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),J=await fetch(`/codex-api/skills-hub/readme?${O}`);if(!J.ok)return;const oe=await J.json();o.value=oe.content??""}catch{}finally{i.value=!1}}}gt(()=>n.visible,O=>{O&&(s.value=null,o.value="",h())});function b(){r("install",n.skill)}function T(){r("uninstall",n.skill)}function N(){const O=!a.value;s.value=O,r("toggle-enabled",n.skill,O)}return(O,J)=>(m(),mt(to,{to:"body"},[e.visible?(m(),w("div",{key:0,class:"sdm-overlay",onClick:J[1]||(J[1]=yt(oe=>O.$emit("close"),["self"]))},[y("div",gS,[y("div",vS,[y("div",yS,[e.skill.avatarUrl?(m(),w("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,wS)):ue("",!0),y("div",bS,[y("div",_S,[y("h3",kS,W(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(m(),w("span",TS,"Disabled")):ue("",!0)]),y("span",SS,W(e.skill.owner),1)])]),y("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:J[0]||(J[0]=oe=>O.$emit("close"))},[De(wl,{class:"sdm-close-icon"})])]),y("div",IS,[e.skill.description?(m(),w("p",ES,W(e.skill.description),1)):ue("",!0),i.value?(m(),w("div",CS,"Loading skill contents...")):o.value?(m(),w("div",{key:2,class:"sdm-readme",innerHTML:d.value},null,8,AS)):ue("",!0),y("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,xS)]),y("div",PS,[y("div",RS,[e.skill.installed?(m(),w("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:T},W(n.isUninstalling?"Uninstalling...":"Uninstall"),9,MS)):(m(),w("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:b},W(n.isInstalling?"Installing...":"Install"),9,$S)),e.skill.installed?(m(),w("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:N},W(a.value?"Disable":"Enable"),9,OS)):ue("",!0)])])])])):ue("",!0)]))}}),DS=ht(NS,[["__scopeId","data-v-19a385ca"]]),LS=()=>{};var vu={};/**
53
- * @license
54
- * Copyright 2017 Google LLC
55
- *
56
- * Licensed under the Apache License, Version 2.0 (the "License");
57
- * you may not use this file except in compliance with the License.
58
- * You may obtain a copy of the License at
59
- *
60
- * http://www.apache.org/licenses/LICENSE-2.0
61
- *
62
- * Unless required by applicable law or agreed to in writing, software
63
- * distributed under the License is distributed on an "AS IS" BASIS,
64
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65
- * See the License for the specific language governing permissions and
66
- * limitations under the License.
67
- */const Df=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=s&63|128):(s&64512)===55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=s&63|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=s&63|128)}return t},jS=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const o=e[n++];t[r++]=String.fromCharCode((s&31)<<6|o&63)}else if(s>239&&s<365){const o=e[n++],i=e[n++],a=e[n++],l=((s&7)<<18|(o&63)<<12|(i&63)<<6|a&63)-65536;t[r++]=String.fromCharCode(55296+(l>>10)),t[r++]=String.fromCharCode(56320+(l&1023))}else{const o=e[n++],i=e[n++];t[r++]=String.fromCharCode((s&15)<<12|(o&63)<<6|i&63)}}return t.join("")},Lf={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<e.length;s+=3){const o=e[s],i=s+1<e.length,a=i?e[s+1]:0,l=s+2<e.length,d=l?e[s+2]:0,c=o>>2,h=(o&3)<<4|a>>4;let b=(a&15)<<2|d>>6,T=d&63;l||(T=64,i||(b=64)),r.push(n[c],n[h],n[b],n[T])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Df(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):jS(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<e.length;){const o=n[e.charAt(s++)],a=s<e.length?n[e.charAt(s)]:0;++s;const d=s<e.length?n[e.charAt(s)]:64;++s;const h=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||d==null||h==null)throw new BS;const b=o<<2|a>>4;if(r.push(b),d!==64){const T=a<<4&240|d>>2;if(r.push(T),h!==64){const N=d<<6&192|h;r.push(N)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class BS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const FS=function(e){const t=Df(e);return Lf.encodeByteArray(t,!0)},jf=function(e){return FS(e).replace(/\./g,"")},Bf=function(e){try{return Lf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
68
- * @license
69
- * Copyright 2022 Google LLC
70
- *
71
- * Licensed under the Apache License, Version 2.0 (the "License");
72
- * you may not use this file except in compliance with the License.
73
- * You may obtain a copy of the License at
74
- *
75
- * http://www.apache.org/licenses/LICENSE-2.0
76
- *
77
- * Unless required by applicable law or agreed to in writing, software
78
- * distributed under the License is distributed on an "AS IS" BASIS,
79
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
80
- * See the License for the specific language governing permissions and
81
- * limitations under the License.
82
- */function US(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
83
- * @license
84
- * Copyright 2022 Google LLC
85
- *
86
- * Licensed under the Apache License, Version 2.0 (the "License");
87
- * you may not use this file except in compliance with the License.
88
- * You may obtain a copy of the License at
89
- *
90
- * http://www.apache.org/licenses/LICENSE-2.0
91
- *
92
- * Unless required by applicable law or agreed to in writing, software
93
- * distributed under the License is distributed on an "AS IS" BASIS,
94
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95
- * See the License for the specific language governing permissions and
96
- * limitations under the License.
97
- */const HS=()=>US().__FIREBASE_DEFAULTS__,VS=()=>{if(typeof process>"u"||typeof vu>"u")return;const e=vu.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},WS=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Bf(e[1]);return t&&JSON.parse(t)},kl=()=>{try{return LS()||HS()||VS()||WS()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},zS=e=>{var t,n;return(n=(t=kl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},Ff=()=>{var e;return(e=kl())==null?void 0:e.config},Uf=e=>{var t;return(t=kl())==null?void 0:t[`_${e}`]};/**
98
- * @license
99
- * Copyright 2017 Google LLC
100
- *
101
- * Licensed under the Apache License, Version 2.0 (the "License");
102
- * you may not use this file except in compliance with the License.
103
- * You may obtain a copy of the License at
104
- *
105
- * http://www.apache.org/licenses/LICENSE-2.0
106
- *
107
- * Unless required by applicable law or agreed to in writing, software
108
- * distributed under the License is distributed on an "AS IS" BASIS,
109
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
110
- * See the License for the specific language governing permissions and
111
- * limitations under the License.
112
- */class GS{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n})}wrapCallback(t){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof t=="function"&&(this.promise.catch(()=>{}),t.length===1?t(n):t(n,r))}}}/**
113
- * @license
114
- * Copyright 2017 Google LLC
115
- *
116
- * Licensed under the Apache License, Version 2.0 (the "License");
117
- * you may not use this file except in compliance with the License.
118
- * You may obtain a copy of the License at
119
- *
120
- * http://www.apache.org/licenses/LICENSE-2.0
121
- *
122
- * Unless required by applicable law or agreed to in writing, software
123
- * distributed under the License is distributed on an "AS IS" BASIS,
124
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
125
- * See the License for the specific language governing permissions and
126
- * limitations under the License.
127
- */function bn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function qS(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(bn())}function KS(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function JS(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function YS(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function QS(){const e=bn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function XS(){try{return typeof indexedDB=="object"}catch{return!1}}function ZS(){return new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var o;t(((o=s.error)==null?void 0:o.message)||"")}}catch(n){t(n)}})}/**
128
- * @license
129
- * Copyright 2017 Google LLC
130
- *
131
- * Licensed under the Apache License, Version 2.0 (the "License");
132
- * you may not use this file except in compliance with the License.
133
- * You may obtain a copy of the License at
134
- *
135
- * http://www.apache.org/licenses/LICENSE-2.0
136
- *
137
- * Unless required by applicable law or agreed to in writing, software
138
- * distributed under the License is distributed on an "AS IS" BASIS,
139
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
140
- * See the License for the specific language governing permissions and
141
- * limitations under the License.
142
- */const eI="FirebaseError";class Xr extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=eI,Object.setPrototypeOf(this,Xr.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Co.prototype.create)}}class Co{constructor(t,n,r){this.service=t,this.serviceName=n,this.errors=r}create(t,...n){const r=n[0]||{},s=`${this.service}/${t}`,o=this.errors[t],i=o?tI(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new Xr(s,a,r)}}function tI(e,t){return e.replace(nI,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const nI=/\{\$([^}]+)}/g;function rI(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Ds(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const o=e[s],i=t[s];if(yu(o)&&yu(i)){if(!Ds(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function yu(e){return e!==null&&typeof e=="object"}/**
143
- * @license
144
- * Copyright 2017 Google LLC
145
- *
146
- * Licensed under the Apache License, Version 2.0 (the "License");
147
- * you may not use this file except in compliance with the License.
148
- * You may obtain a copy of the License at
149
- *
150
- * http://www.apache.org/licenses/LICENSE-2.0
151
- *
152
- * Unless required by applicable law or agreed to in writing, software
153
- * distributed under the License is distributed on an "AS IS" BASIS,
154
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
155
- * See the License for the specific language governing permissions and
156
- * limitations under the License.
157
- */function Ao(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(s=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function sI(e,t){const n=new oI(e,t);return n.subscribe.bind(n)}class oI{constructor(t,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{t(this)}).catch(r=>{this.error(r)})}next(t){this.forEachObserver(n=>{n.next(t)})}error(t){this.forEachObserver(n=>{n.error(t)}),this.close(t)}complete(){this.forEachObserver(t=>{t.complete()}),this.close()}subscribe(t,n,r){let s;if(t===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");iI(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=aa),s.error===void 0&&(s.error=aa),s.complete===void 0&&(s.complete=aa);const o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),o}unsubscribeOne(t){this.observers===void 0||this.observers[t]===void 0||(delete this.observers[t],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,t)}sendOne(t,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[t]!==void 0)try{n(this.observers[t])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(t){this.finalized||(this.finalized=!0,t!==void 0&&(this.finalError=t),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function iI(e,t){if(typeof e!="object"||e===null)return!1;for(const n of t)if(n in e&&typeof e[n]=="function")return!0;return!1}function aa(){}/**
158
- * @license
159
- * Copyright 2021 Google LLC
160
- *
161
- * Licensed under the Apache License, Version 2.0 (the "License");
162
- * you may not use this file except in compliance with the License.
163
- * You may obtain a copy of the License at
164
- *
165
- * http://www.apache.org/licenses/LICENSE-2.0
166
- *
167
- * Unless required by applicable law or agreed to in writing, software
168
- * distributed under the License is distributed on an "AS IS" BASIS,
169
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
170
- * See the License for the specific language governing permissions and
171
- * limitations under the License.
172
- */function Bs(e){return e&&e._delegate?e._delegate:e}/**
173
- * @license
174
- * Copyright 2025 Google LLC
175
- *
176
- * Licensed under the Apache License, Version 2.0 (the "License");
177
- * you may not use this file except in compliance with the License.
178
- * You may obtain a copy of the License at
179
- *
180
- * http://www.apache.org/licenses/LICENSE-2.0
181
- *
182
- * Unless required by applicable law or agreed to in writing, software
183
- * distributed under the License is distributed on an "AS IS" BASIS,
184
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
185
- * See the License for the specific language governing permissions and
186
- * limitations under the License.
187
- */function Tl(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function aI(e){return(await fetch(e,{credentials:"include"})).ok}class Ls{constructor(t,n,r){this.name=t,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}/**
188
- * @license
189
- * Copyright 2019 Google LLC
190
- *
191
- * Licensed under the Apache License, Version 2.0 (the "License");
192
- * you may not use this file except in compliance with the License.
193
- * You may obtain a copy of the License at
194
- *
195
- * http://www.apache.org/licenses/LICENSE-2.0
196
- *
197
- * Unless required by applicable law or agreed to in writing, software
198
- * distributed under the License is distributed on an "AS IS" BASIS,
199
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- * See the License for the specific language governing permissions and
201
- * limitations under the License.
202
- */const as="[DEFAULT]";/**
203
- * @license
204
- * Copyright 2019 Google LLC
205
- *
206
- * Licensed under the Apache License, Version 2.0 (the "License");
207
- * you may not use this file except in compliance with the License.
208
- * You may obtain a copy of the License at
209
- *
210
- * http://www.apache.org/licenses/LICENSE-2.0
211
- *
212
- * Unless required by applicable law or agreed to in writing, software
213
- * distributed under the License is distributed on an "AS IS" BASIS,
214
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
215
- * See the License for the specific language governing permissions and
216
- * limitations under the License.
217
- */class lI{constructor(t,n){this.name=t,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const n=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(n)){const r=new GS;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(t){const n=this.normalizeInstanceIdentifier(t==null?void 0:t.identifier),r=(t==null?void 0:t.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,!!this.shouldAutoInitialize()){if(uI(t))try{this.getOrInitializeService({instanceIdentifier:as})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const o=this.getOrInitializeService({instanceIdentifier:s});r.resolve(o)}catch{}}}}clearInstance(t=as){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...t.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(t=as){return this.instances.has(t)}getOptions(t=as){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:n={}}=t,r=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[o,i]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(o);r===a&&i.resolve(s)}return s}onInit(t,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(t),this.onInitCallbacks.set(r,s);const o=this.instances.get(r);return o&&t(o,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(t,n)}catch{}}getOrInitializeService({instanceIdentifier:t,options:n={}}){let r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:cI(t),options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch{}return r||null}normalizeInstanceIdentifier(t=as){return this.component?this.component.multipleInstances?t:as:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function cI(e){return e===as?void 0:e}function uI(e){return e.instantiationMode==="EAGER"}/**
218
- * @license
219
- * Copyright 2019 Google LLC
220
- *
221
- * Licensed under the Apache License, Version 2.0 (the "License");
222
- * you may not use this file except in compliance with the License.
223
- * You may obtain a copy of the License at
224
- *
225
- * http://www.apache.org/licenses/LICENSE-2.0
226
- *
227
- * Unless required by applicable law or agreed to in writing, software
228
- * distributed under the License is distributed on an "AS IS" BASIS,
229
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
230
- * See the License for the specific language governing permissions and
231
- * limitations under the License.
232
- */class dI{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const n=this.getProvider(t.name);if(n.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);n.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const n=new lI(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
233
- * @license
234
- * Copyright 2017 Google LLC
235
- *
236
- * Licensed under the Apache License, Version 2.0 (the "License");
237
- * you may not use this file except in compliance with the License.
238
- * You may obtain a copy of the License at
239
- *
240
- * http://www.apache.org/licenses/LICENSE-2.0
241
- *
242
- * Unless required by applicable law or agreed to in writing, software
243
- * distributed under the License is distributed on an "AS IS" BASIS,
244
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
245
- * See the License for the specific language governing permissions and
246
- * limitations under the License.
247
- */var At;(function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"})(At||(At={}));const fI={debug:At.DEBUG,verbose:At.VERBOSE,info:At.INFO,warn:At.WARN,error:At.ERROR,silent:At.SILENT},hI=At.INFO,pI={[At.DEBUG]:"log",[At.VERBOSE]:"log",[At.INFO]:"info",[At.WARN]:"warn",[At.ERROR]:"error"},mI=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=pI[t];if(s)console[s](`[${r}] ${e.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class Hf{constructor(t){this.name=t,this._logLevel=hI,this._logHandler=mI,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in At))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?fI[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if(typeof t!="function")throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,At.DEBUG,...t),this._logHandler(this,At.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,At.VERBOSE,...t),this._logHandler(this,At.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,At.INFO,...t),this._logHandler(this,At.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,At.WARN,...t),this._logHandler(this,At.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,At.ERROR,...t),this._logHandler(this,At.ERROR,...t)}}const gI=(e,t)=>t.some(n=>e instanceof n);let wu,bu;function vI(){return wu||(wu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function yI(){return bu||(bu=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Vf=new WeakMap,Ba=new WeakMap,Wf=new WeakMap,la=new WeakMap,Sl=new WeakMap;function wI(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(Kr(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&Vf.set(n,e)}).catch(()=>{}),Sl.set(t,e),t}function bI(e){if(Ba.has(e))return;const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",i),e.removeEventListener("abort",i)},o=()=>{n(),s()},i=()=>{r(e.error||new DOMException("AbortError","AbortError")),s()};e.addEventListener("complete",o),e.addEventListener("error",i),e.addEventListener("abort",i)});Ba.set(e,t)}let Fa={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return Ba.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Wf.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Kr(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&(t==="done"||t==="store")?!0:t in e}};function _I(e){Fa=e(Fa)}function kI(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(ca(this),t,...n);return Wf.set(r,t.sort?t.sort():[t]),Kr(r)}:yI().includes(e)?function(...t){return e.apply(ca(this),t),Kr(Vf.get(this))}:function(...t){return Kr(e.apply(ca(this),t))}}function TI(e){return typeof e=="function"?kI(e):(e instanceof IDBTransaction&&bI(e),gI(e,vI())?new Proxy(e,Fa):e)}function Kr(e){if(e instanceof IDBRequest)return wI(e);if(la.has(e))return la.get(e);const t=TI(e);return t!==e&&(la.set(e,t),Sl.set(t,e)),t}const ca=e=>Sl.get(e);function SI(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=Kr(i);return r&&i.addEventListener("upgradeneeded",l=>{r(Kr(i.result),l.oldVersion,l.newVersion,Kr(i.transaction),l)}),n&&i.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),a.then(l=>{o&&l.addEventListener("close",()=>o()),s&&l.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),a}const II=["get","getKey","getAll","getAllKeys","count"],EI=["put","add","delete","clear"],ua=new Map;function _u(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(ua.get(t))return ua.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=EI.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||II.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(a.shift())),(await Promise.all([d[n](...a),s&&l.done]))[0]};return ua.set(t,o),o}_I(e=>({...e,get:(t,n,r)=>_u(t,n)||e.get(t,n,r),has:(t,n)=>!!_u(t,n)||e.has(t,n)}));/**
248
- * @license
249
- * Copyright 2019 Google LLC
250
- *
251
- * Licensed under the Apache License, Version 2.0 (the "License");
252
- * you may not use this file except in compliance with the License.
253
- * You may obtain a copy of the License at
254
- *
255
- * http://www.apache.org/licenses/LICENSE-2.0
256
- *
257
- * Unless required by applicable law or agreed to in writing, software
258
- * distributed under the License is distributed on an "AS IS" BASIS,
259
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
260
- * See the License for the specific language governing permissions and
261
- * limitations under the License.
262
- */class CI{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(AI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function AI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const Ua="@firebase/app",ku="0.14.10";/**
263
- * @license
264
- * Copyright 2019 Google LLC
265
- *
266
- * Licensed under the Apache License, Version 2.0 (the "License");
267
- * you may not use this file except in compliance with the License.
268
- * You may obtain a copy of the License at
269
- *
270
- * http://www.apache.org/licenses/LICENSE-2.0
271
- *
272
- * Unless required by applicable law or agreed to in writing, software
273
- * distributed under the License is distributed on an "AS IS" BASIS,
274
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
275
- * See the License for the specific language governing permissions and
276
- * limitations under the License.
277
- */const Mr=new Hf("@firebase/app"),xI="@firebase/app-compat",PI="@firebase/analytics-compat",RI="@firebase/analytics",MI="@firebase/app-check-compat",$I="@firebase/app-check",OI="@firebase/auth",NI="@firebase/auth-compat",DI="@firebase/database",LI="@firebase/data-connect",jI="@firebase/database-compat",BI="@firebase/functions",FI="@firebase/functions-compat",UI="@firebase/installations",HI="@firebase/installations-compat",VI="@firebase/messaging",WI="@firebase/messaging-compat",zI="@firebase/performance",GI="@firebase/performance-compat",qI="@firebase/remote-config",KI="@firebase/remote-config-compat",JI="@firebase/storage",YI="@firebase/storage-compat",QI="@firebase/firestore",XI="@firebase/ai",ZI="@firebase/firestore-compat",eE="firebase",tE="12.11.0";/**
278
- * @license
279
- * Copyright 2019 Google LLC
280
- *
281
- * Licensed under the Apache License, Version 2.0 (the "License");
282
- * you may not use this file except in compliance with the License.
283
- * You may obtain a copy of the License at
284
- *
285
- * http://www.apache.org/licenses/LICENSE-2.0
286
- *
287
- * Unless required by applicable law or agreed to in writing, software
288
- * distributed under the License is distributed on an "AS IS" BASIS,
289
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
290
- * See the License for the specific language governing permissions and
291
- * limitations under the License.
292
- */const Ha="[DEFAULT]",nE={[Ua]:"fire-core",[xI]:"fire-core-compat",[RI]:"fire-analytics",[PI]:"fire-analytics-compat",[$I]:"fire-app-check",[MI]:"fire-app-check-compat",[OI]:"fire-auth",[NI]:"fire-auth-compat",[DI]:"fire-rtdb",[LI]:"fire-data-connect",[jI]:"fire-rtdb-compat",[BI]:"fire-fn",[FI]:"fire-fn-compat",[UI]:"fire-iid",[HI]:"fire-iid-compat",[VI]:"fire-fcm",[WI]:"fire-fcm-compat",[zI]:"fire-perf",[GI]:"fire-perf-compat",[qI]:"fire-rc",[KI]:"fire-rc-compat",[JI]:"fire-gcs",[YI]:"fire-gcs-compat",[QI]:"fire-fst",[ZI]:"fire-fst-compat",[XI]:"fire-vertex","fire-js":"fire-js",[eE]:"fire-js-all"};/**
293
- * @license
294
- * Copyright 2019 Google LLC
295
- *
296
- * Licensed under the Apache License, Version 2.0 (the "License");
297
- * you may not use this file except in compliance with the License.
298
- * You may obtain a copy of the License at
299
- *
300
- * http://www.apache.org/licenses/LICENSE-2.0
301
- *
302
- * Unless required by applicable law or agreed to in writing, software
303
- * distributed under the License is distributed on an "AS IS" BASIS,
304
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
305
- * See the License for the specific language governing permissions and
306
- * limitations under the License.
307
- */const bo=new Map,rE=new Map,Va=new Map;function Tu(e,t){try{e.container.addComponent(t)}catch(n){Mr.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function _o(e){const t=e.name;if(Va.has(t))return Mr.debug(`There were multiple attempts to register component ${t}.`),!1;Va.set(t,e);for(const n of bo.values())Tu(n,e);for(const n of rE.values())Tu(n,e);return!0}function zf(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function lr(e){return e==null?!1:e.settings!==void 0}/**
308
- * @license
309
- * Copyright 2019 Google LLC
310
- *
311
- * Licensed under the Apache License, Version 2.0 (the "License");
312
- * you may not use this file except in compliance with the License.
313
- * You may obtain a copy of the License at
314
- *
315
- * http://www.apache.org/licenses/LICENSE-2.0
316
- *
317
- * Unless required by applicable law or agreed to in writing, software
318
- * distributed under the License is distributed on an "AS IS" BASIS,
319
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
320
- * See the License for the specific language governing permissions and
321
- * limitations under the License.
322
- */const sE={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},Jr=new Co("app","Firebase",sE);/**
323
- * @license
324
- * Copyright 2019 Google LLC
325
- *
326
- * Licensed under the Apache License, Version 2.0 (the "License");
327
- * you may not use this file except in compliance with the License.
328
- * You may obtain a copy of the License at
329
- *
330
- * http://www.apache.org/licenses/LICENSE-2.0
331
- *
332
- * Unless required by applicable law or agreed to in writing, software
333
- * distributed under the License is distributed on an "AS IS" BASIS,
334
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
335
- * See the License for the specific language governing permissions and
336
- * limitations under the License.
337
- */class oE{constructor(t,n,r){this._isDeleted=!1,this._options={...t},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Ls("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Jr.create("app-deleted",{appName:this._name})}}/**
338
- * @license
339
- * Copyright 2019 Google LLC
340
- *
341
- * Licensed under the Apache License, Version 2.0 (the "License");
342
- * you may not use this file except in compliance with the License.
343
- * You may obtain a copy of the License at
344
- *
345
- * http://www.apache.org/licenses/LICENSE-2.0
346
- *
347
- * Unless required by applicable law or agreed to in writing, software
348
- * distributed under the License is distributed on an "AS IS" BASIS,
349
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
350
- * See the License for the specific language governing permissions and
351
- * limitations under the License.
352
- */const xo=tE;function Gf(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:Ha,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw Jr.create("bad-app-name",{appName:String(s)});if(n||(n=Ff()),!n)throw Jr.create("no-options");const o=bo.get(s);if(o){if(Ds(n,o.options)&&Ds(r,o.config))return o;throw Jr.create("duplicate-app",{appName:s})}const i=new dI(s);for(const l of Va.values())i.addComponent(l);const a=new oE(n,r,i);return bo.set(s,a),a}function qf(e=Ha){const t=bo.get(e);if(!t&&e===Ha&&Ff())return Gf();if(!t)throw Jr.create("no-app",{appName:e});return t}function iE(){return Array.from(bo.values())}function xs(e,t,n){let r=nE[e]??e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const i=[`Unable to register library "${r}" with version "${t}":`];s&&i.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&i.push("and"),o&&i.push(`version name "${t}" contains illegal characters (whitespace or "/")`),Mr.warn(i.join(" "));return}_o(new Ls(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
353
- * @license
354
- * Copyright 2021 Google LLC
355
- *
356
- * Licensed under the Apache License, Version 2.0 (the "License");
357
- * you may not use this file except in compliance with the License.
358
- * You may obtain a copy of the License at
359
- *
360
- * http://www.apache.org/licenses/LICENSE-2.0
361
- *
362
- * Unless required by applicable law or agreed to in writing, software
363
- * distributed under the License is distributed on an "AS IS" BASIS,
364
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
365
- * See the License for the specific language governing permissions and
366
- * limitations under the License.
367
- */const aE="firebase-heartbeat-database",lE=1,ko="firebase-heartbeat-store";let da=null;function Kf(){return da||(da=SI(aE,lE,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(ko)}catch(n){console.warn(n)}}}}).catch(e=>{throw Jr.create("idb-open",{originalErrorMessage:e.message})})),da}async function cE(e){try{const n=(await Kf()).transaction(ko),r=await n.objectStore(ko).get(Jf(e));return await n.done,r}catch(t){if(t instanceof Xr)Mr.warn(t.message);else{const n=Jr.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Mr.warn(n.message)}}}async function Su(e,t){try{const r=(await Kf()).transaction(ko,"readwrite");await r.objectStore(ko).put(t,Jf(e)),await r.done}catch(n){if(n instanceof Xr)Mr.warn(n.message);else{const r=Jr.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Mr.warn(r.message)}}}function Jf(e){return`${e.name}!${e.options.appId}`}/**
368
- * @license
369
- * Copyright 2021 Google LLC
370
- *
371
- * Licensed under the Apache License, Version 2.0 (the "License");
372
- * you may not use this file except in compliance with the License.
373
- * You may obtain a copy of the License at
374
- *
375
- * http://www.apache.org/licenses/LICENSE-2.0
376
- *
377
- * Unless required by applicable law or agreed to in writing, software
378
- * distributed under the License is distributed on an "AS IS" BASIS,
379
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
380
- * See the License for the specific language governing permissions and
381
- * limitations under the License.
382
- */const uE=1024,dE=30;class fE{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new pE(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var t,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),o=Iu();if(((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===o||this._heartbeatsCache.heartbeats.some(i=>i.date===o))return;if(this._heartbeatsCache.heartbeats.push({date:o,agent:s}),this._heartbeatsCache.heartbeats.length>dE){const i=mE(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Mr.warn(r)}}async getHeartbeatsHeader(){var t;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((t=this._heartbeatsCache)==null?void 0:t.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=Iu(),{heartbeatsToSend:r,unsentEntries:s}=hE(this._heartbeatsCache.heartbeats),o=jf(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),o}catch(n){return Mr.warn(n),""}}}function Iu(){return new Date().toISOString().substring(0,10)}function hE(e,t=uE){const n=[];let r=e.slice();for(const s of e){const o=n.find(i=>i.agent===s.agent);if(o){if(o.dates.push(s.date),Eu(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Eu(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class pE{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return XS()?ZS().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await cE(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return Su(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:t.heartbeats})}else return}async add(t){if(await this._canUseIndexedDBPromise){const r=await this.read();return Su(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function Eu(e){return jf(JSON.stringify({version:2,heartbeats:e})).length}function mE(e){if(e.length===0)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}/**
383
- * @license
384
- * Copyright 2019 Google LLC
385
- *
386
- * Licensed under the Apache License, Version 2.0 (the "License");
387
- * you may not use this file except in compliance with the License.
388
- * You may obtain a copy of the License at
389
- *
390
- * http://www.apache.org/licenses/LICENSE-2.0
391
- *
392
- * Unless required by applicable law or agreed to in writing, software
393
- * distributed under the License is distributed on an "AS IS" BASIS,
394
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
395
- * See the License for the specific language governing permissions and
396
- * limitations under the License.
397
- */function gE(e){_o(new Ls("platform-logger",t=>new CI(t),"PRIVATE")),_o(new Ls("heartbeat",t=>new fE(t),"PRIVATE")),xs(Ua,ku,e),xs(Ua,ku,"esm2020"),xs("fire-js","")}gE("");var vE="firebase",yE="12.11.0";/**
398
- * @license
399
- * Copyright 2020 Google LLC
400
- *
401
- * Licensed under the Apache License, Version 2.0 (the "License");
402
- * you may not use this file except in compliance with the License.
403
- * You may obtain a copy of the License at
404
- *
405
- * http://www.apache.org/licenses/LICENSE-2.0
406
- *
407
- * Unless required by applicable law or agreed to in writing, software
408
- * distributed under the License is distributed on an "AS IS" BASIS,
409
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
410
- * See the License for the specific language governing permissions and
411
- * limitations under the License.
412
- */xs(vE,yE,"app");function Yf(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const wE=Yf,Qf=new Co("auth","Firebase",Yf());/**
413
- * @license
414
- * Copyright 2020 Google LLC
415
- *
416
- * Licensed under the Apache License, Version 2.0 (the "License");
417
- * you may not use this file except in compliance with the License.
418
- * You may obtain a copy of the License at
419
- *
420
- * http://www.apache.org/licenses/LICENSE-2.0
421
- *
422
- * Unless required by applicable law or agreed to in writing, software
423
- * distributed under the License is distributed on an "AS IS" BASIS,
424
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
425
- * See the License for the specific language governing permissions and
426
- * limitations under the License.
427
- */const ci=new Hf("@firebase/auth");function bE(e,...t){ci.logLevel<=At.WARN&&ci.warn(`Auth (${xo}): ${e}`,...t)}function Yo(e,...t){ci.logLevel<=At.ERROR&&ci.error(`Auth (${xo}): ${e}`,...t)}/**
428
- * @license
429
- * Copyright 2020 Google LLC
430
- *
431
- * Licensed under the Apache License, Version 2.0 (the "License");
432
- * you may not use this file except in compliance with the License.
433
- * You may obtain a copy of the License at
434
- *
435
- * http://www.apache.org/licenses/LICENSE-2.0
436
- *
437
- * Unless required by applicable law or agreed to in writing, software
438
- * distributed under the License is distributed on an "AS IS" BASIS,
439
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
440
- * See the License for the specific language governing permissions and
441
- * limitations under the License.
442
- */function hr(e,...t){throw El(e,...t)}function Kn(e,...t){return El(e,...t)}function Il(e,t,n){const r={...wE(),[t]:n};return new Co("auth","Firebase",r).create(t,{appName:e.name})}function ps(e){return Il(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function _E(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&hr(e,"argument-error"),Il(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function El(e,...t){if(typeof e!="string"){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return Qf.create(e,...t)}function Ye(e,t,...n){if(!e)throw El(t,...n)}function Sr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Yo(t),new Error(t)}function $r(e,t){e||Sr(t)}/**
443
- * @license
444
- * Copyright 2020 Google LLC
445
- *
446
- * Licensed under the Apache License, Version 2.0 (the "License");
447
- * you may not use this file except in compliance with the License.
448
- * You may obtain a copy of the License at
449
- *
450
- * http://www.apache.org/licenses/LICENSE-2.0
451
- *
452
- * Unless required by applicable law or agreed to in writing, software
453
- * distributed under the License is distributed on an "AS IS" BASIS,
454
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
455
- * See the License for the specific language governing permissions and
456
- * limitations under the License.
457
- */function Wa(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function kE(){return Cu()==="http:"||Cu()==="https:"}function Cu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
458
- * @license
459
- * Copyright 2020 Google LLC
460
- *
461
- * Licensed under the Apache License, Version 2.0 (the "License");
462
- * you may not use this file except in compliance with the License.
463
- * You may obtain a copy of the License at
464
- *
465
- * http://www.apache.org/licenses/LICENSE-2.0
466
- *
467
- * Unless required by applicable law or agreed to in writing, software
468
- * distributed under the License is distributed on an "AS IS" BASIS,
469
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
470
- * See the License for the specific language governing permissions and
471
- * limitations under the License.
472
- */function TE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(kE()||JS()||"connection"in navigator)?navigator.onLine:!0}function SE(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
473
- * @license
474
- * Copyright 2020 Google LLC
475
- *
476
- * Licensed under the Apache License, Version 2.0 (the "License");
477
- * you may not use this file except in compliance with the License.
478
- * You may obtain a copy of the License at
479
- *
480
- * http://www.apache.org/licenses/LICENSE-2.0
481
- *
482
- * Unless required by applicable law or agreed to in writing, software
483
- * distributed under the License is distributed on an "AS IS" BASIS,
484
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
485
- * See the License for the specific language governing permissions and
486
- * limitations under the License.
487
- */class Po{constructor(t,n){this.shortDelay=t,this.longDelay=n,$r(n>t,"Short delay should be less than long delay!"),this.isMobile=qS()||YS()}get(){return TE()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
488
- * @license
489
- * Copyright 2020 Google LLC
490
- *
491
- * Licensed under the Apache License, Version 2.0 (the "License");
492
- * you may not use this file except in compliance with the License.
493
- * You may obtain a copy of the License at
494
- *
495
- * http://www.apache.org/licenses/LICENSE-2.0
496
- *
497
- * Unless required by applicable law or agreed to in writing, software
498
- * distributed under the License is distributed on an "AS IS" BASIS,
499
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
500
- * See the License for the specific language governing permissions and
501
- * limitations under the License.
502
- */function Cl(e,t){$r(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
503
- * @license
504
- * Copyright 2020 Google LLC
505
- *
506
- * Licensed under the Apache License, Version 2.0 (the "License");
507
- * you may not use this file except in compliance with the License.
508
- * You may obtain a copy of the License at
509
- *
510
- * http://www.apache.org/licenses/LICENSE-2.0
511
- *
512
- * Unless required by applicable law or agreed to in writing, software
513
- * distributed under the License is distributed on an "AS IS" BASIS,
514
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
515
- * See the License for the specific language governing permissions and
516
- * limitations under the License.
517
- */class Xf{static initialize(t,n,r){this.fetchImpl=t,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Sr("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Sr("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Sr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
518
- * @license
519
- * Copyright 2020 Google LLC
520
- *
521
- * Licensed under the Apache License, Version 2.0 (the "License");
522
- * you may not use this file except in compliance with the License.
523
- * You may obtain a copy of the License at
524
- *
525
- * http://www.apache.org/licenses/LICENSE-2.0
526
- *
527
- * Unless required by applicable law or agreed to in writing, software
528
- * distributed under the License is distributed on an "AS IS" BASIS,
529
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
530
- * See the License for the specific language governing permissions and
531
- * limitations under the License.
532
- */const IE={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
533
- * @license
534
- * Copyright 2020 Google LLC
535
- *
536
- * Licensed under the Apache License, Version 2.0 (the "License");
537
- * you may not use this file except in compliance with the License.
538
- * You may obtain a copy of the License at
539
- *
540
- * http://www.apache.org/licenses/LICENSE-2.0
541
- *
542
- * Unless required by applicable law or agreed to in writing, software
543
- * distributed under the License is distributed on an "AS IS" BASIS,
544
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
545
- * See the License for the specific language governing permissions and
546
- * limitations under the License.
547
- */const EE=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],CE=new Po(3e4,6e4);function Al(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function Fs(e,t,n,r,s={}){return Zf(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Ao({key:e.config.apiKey,...i}).slice(1),l=await e._getAdditionalHeaders();l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode);const d={method:t,headers:l,...o};return KS()||(d.referrerPolicy="no-referrer"),e.emulatorConfig&&Tl(e.emulatorConfig.host)&&(d.credentials="include"),Xf.fetch()(await eh(e,e.config.apiHost,n,a),d)})}async function Zf(e,t,n){e._canInitEmulator=!1;const r={...IE,...t};try{const s=new xE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw jo(e,"account-exists-with-different-credential",i);if(o.ok&&!("errorMessage"in i))return i;{const a=o.ok?i.errorMessage:i.error.message,[l,d]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw jo(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw jo(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw jo(e,"user-disabled",i);const c=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw Il(e,c,d);hr(e,c)}}catch(s){if(s instanceof Xr)throw s;hr(e,"network-request-failed",{message:String(s)})}}async function AE(e,t,n,r,s={}){const o=await Fs(e,t,n,r,s);return"mfaPendingCredential"in o&&hr(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function eh(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Cl(e.config,s):`${e.config.apiScheme}://${s}`;return EE.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class xE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Kn(this.auth,"network-request-failed")),CE.get())})}}function jo(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Kn(e,t,r);return s.customData._tokenResponse=n,s}/**
548
- * @license
549
- * Copyright 2020 Google LLC
550
- *
551
- * Licensed under the Apache License, Version 2.0 (the "License");
552
- * you may not use this file except in compliance with the License.
553
- * You may obtain a copy of the License at
554
- *
555
- * http://www.apache.org/licenses/LICENSE-2.0
556
- *
557
- * Unless required by applicable law or agreed to in writing, software
558
- * distributed under the License is distributed on an "AS IS" BASIS,
559
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
560
- * See the License for the specific language governing permissions and
561
- * limitations under the License.
562
- */async function PE(e,t){return Fs(e,"POST","/v1/accounts:delete",t)}async function ui(e,t){return Fs(e,"POST","/v1/accounts:lookup",t)}/**
563
- * @license
564
- * Copyright 2020 Google LLC
565
- *
566
- * Licensed under the Apache License, Version 2.0 (the "License");
567
- * you may not use this file except in compliance with the License.
568
- * You may obtain a copy of the License at
569
- *
570
- * http://www.apache.org/licenses/LICENSE-2.0
571
- *
572
- * Unless required by applicable law or agreed to in writing, software
573
- * distributed under the License is distributed on an "AS IS" BASIS,
574
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
575
- * See the License for the specific language governing permissions and
576
- * limitations under the License.
577
- */function io(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function RE(e,t=!1){const n=Bs(e),r=await n.getIdToken(t),s=xl(r);Ye(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const o=typeof s.firebase=="object"?s.firebase:void 0,i=o==null?void 0:o.sign_in_provider;return{claims:s,token:r,authTime:io(fa(s.auth_time)),issuedAtTime:io(fa(s.iat)),expirationTime:io(fa(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function fa(e){return Number(e)*1e3}function xl(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return Yo("JWT malformed, contained fewer than 3 sections"),null;try{const s=Bf(n);return s?JSON.parse(s):(Yo("Failed to decode base64 JWT payload"),null)}catch(s){return Yo("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Au(e){const t=xl(e);return Ye(t,"internal-error"),Ye(typeof t.exp<"u","internal-error"),Ye(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
578
- * @license
579
- * Copyright 2020 Google LLC
580
- *
581
- * Licensed under the Apache License, Version 2.0 (the "License");
582
- * you may not use this file except in compliance with the License.
583
- * You may obtain a copy of the License at
584
- *
585
- * http://www.apache.org/licenses/LICENSE-2.0
586
- *
587
- * Unless required by applicable law or agreed to in writing, software
588
- * distributed under the License is distributed on an "AS IS" BASIS,
589
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
590
- * See the License for the specific language governing permissions and
591
- * limitations under the License.
592
- */async function To(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof Xr&&ME(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function ME({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
593
- * @license
594
- * Copyright 2020 Google LLC
595
- *
596
- * Licensed under the Apache License, Version 2.0 (the "License");
597
- * you may not use this file except in compliance with the License.
598
- * You may obtain a copy of the License at
599
- *
600
- * http://www.apache.org/licenses/LICENSE-2.0
601
- *
602
- * Unless required by applicable law or agreed to in writing, software
603
- * distributed under the License is distributed on an "AS IS" BASIS,
604
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
605
- * See the License for the specific language governing permissions and
606
- * limitations under the License.
607
- */class $E{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(t){if(t){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(t=!1){if(!this.isRunning)return;const n=this.getInterval(t);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){(t==null?void 0:t.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
608
- * @license
609
- * Copyright 2020 Google LLC
610
- *
611
- * Licensed under the Apache License, Version 2.0 (the "License");
612
- * you may not use this file except in compliance with the License.
613
- * You may obtain a copy of the License at
614
- *
615
- * http://www.apache.org/licenses/LICENSE-2.0
616
- *
617
- * Unless required by applicable law or agreed to in writing, software
618
- * distributed under the License is distributed on an "AS IS" BASIS,
619
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
620
- * See the License for the specific language governing permissions and
621
- * limitations under the License.
622
- */class za{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=io(this.lastLoginAt),this.creationTime=io(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
623
- * @license
624
- * Copyright 2019 Google LLC
625
- *
626
- * Licensed under the Apache License, Version 2.0 (the "License");
627
- * you may not use this file except in compliance with the License.
628
- * You may obtain a copy of the License at
629
- *
630
- * http://www.apache.org/licenses/LICENSE-2.0
631
- *
632
- * Unless required by applicable law or agreed to in writing, software
633
- * distributed under the License is distributed on an "AS IS" BASIS,
634
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
635
- * See the License for the specific language governing permissions and
636
- * limitations under the License.
637
- */async function di(e){var h;const t=e.auth,n=await e.getIdToken(),r=await To(e,ui(t,{idToken:n}));Ye(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(h=s.providerUserInfo)!=null&&h.length?th(s.providerUserInfo):[],i=NE(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),d=a?l:!1,c={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new za(s.createdAt,s.lastLoginAt),isAnonymous:d};Object.assign(e,c)}async function OE(e){const t=Bs(e);await di(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function NE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function th(e){return e.map(({providerId:t,...n})=>({providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
638
- * @license
639
- * Copyright 2020 Google LLC
640
- *
641
- * Licensed under the Apache License, Version 2.0 (the "License");
642
- * you may not use this file except in compliance with the License.
643
- * You may obtain a copy of the License at
644
- *
645
- * http://www.apache.org/licenses/LICENSE-2.0
646
- *
647
- * Unless required by applicable law or agreed to in writing, software
648
- * distributed under the License is distributed on an "AS IS" BASIS,
649
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
650
- * See the License for the specific language governing permissions and
651
- * limitations under the License.
652
- */async function DE(e,t){const n=await Zf(e,{},async()=>{const r=Ao({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await eh(e,s,"/v1/token",`key=${o}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";const l={method:"POST",headers:a,body:r};return e.emulatorConfig&&Tl(e.emulatorConfig.host)&&(l.credentials="include"),Xf.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function LE(e,t){return Fs(e,"POST","/v2/accounts:revokeToken",Al(e,t))}/**
653
- * @license
654
- * Copyright 2020 Google LLC
655
- *
656
- * Licensed under the Apache License, Version 2.0 (the "License");
657
- * you may not use this file except in compliance with the License.
658
- * You may obtain a copy of the License at
659
- *
660
- * http://www.apache.org/licenses/LICENSE-2.0
661
- *
662
- * Unless required by applicable law or agreed to in writing, software
663
- * distributed under the License is distributed on an "AS IS" BASIS,
664
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
665
- * See the License for the specific language governing permissions and
666
- * limitations under the License.
667
- */class Ps{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Ye(t.idToken,"internal-error"),Ye(typeof t.idToken<"u","internal-error"),Ye(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Au(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){Ye(t.length!==0,"internal-error");const n=Au(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Ye(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(t,n){const{accessToken:r,refreshToken:s,expiresIn:o}=await DE(t,n);this.updateTokensAndExpiration(r,s,Number(o))}updateTokensAndExpiration(t,n,r){this.refreshToken=n||null,this.accessToken=t||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(t,n){const{refreshToken:r,accessToken:s,expirationTime:o}=n,i=new Ps;return r&&(Ye(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(Ye(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(Ye(typeof o=="number","internal-error",{appName:t}),i.expirationTime=o),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Ps,this.toJSON())}_performRefresh(){return Sr("not implemented")}}/**
668
- * @license
669
- * Copyright 2020 Google LLC
670
- *
671
- * Licensed under the Apache License, Version 2.0 (the "License");
672
- * you may not use this file except in compliance with the License.
673
- * You may obtain a copy of the License at
674
- *
675
- * http://www.apache.org/licenses/LICENSE-2.0
676
- *
677
- * Unless required by applicable law or agreed to in writing, software
678
- * distributed under the License is distributed on an "AS IS" BASIS,
679
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
680
- * See the License for the specific language governing permissions and
681
- * limitations under the License.
682
- */function Br(e,t){Ye(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class zn{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new $E(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new za(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await To(this,this.stsTokenManager.getToken(this.auth,t));return Ye(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return RE(this,t)}reload(){return OE(this)}_assign(t){this!==t&&(Ye(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map(n=>({...n})),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const n=new zn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){Ye(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,n=!1){let r=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),r=!0),n&&await di(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(lr(this.auth.app))return Promise.reject(ps(this.auth));const t=await this.getIdToken();return await To(this,PE(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(t=>({...t})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,n){const r=n.displayName??void 0,s=n.email??void 0,o=n.phoneNumber??void 0,i=n.photoURL??void 0,a=n.tenantId??void 0,l=n._redirectEventId??void 0,d=n.createdAt??void 0,c=n.lastLoginAt??void 0,{uid:h,emailVerified:b,isAnonymous:T,providerData:N,stsTokenManager:O}=n;Ye(h&&O,t,"internal-error");const J=Ps.fromJSON(this.name,O);Ye(typeof h=="string",t,"internal-error"),Br(r,t.name),Br(s,t.name),Ye(typeof b=="boolean",t,"internal-error"),Ye(typeof T=="boolean",t,"internal-error"),Br(o,t.name),Br(i,t.name),Br(a,t.name),Br(l,t.name),Br(d,t.name),Br(c,t.name);const oe=new zn({uid:h,auth:t,email:s,emailVerified:b,displayName:r,isAnonymous:T,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:J,createdAt:d,lastLoginAt:c});return N&&Array.isArray(N)&&(oe.providerData=N.map(L=>({...L}))),l&&(oe._redirectEventId=l),oe}static async _fromIdTokenResponse(t,n,r=!1){const s=new Ps;s.updateFromServerResponse(n);const o=new zn({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await di(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];Ye(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?th(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new Ps;a.updateFromIdToken(r);const l=new zn({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:o,metadata:new za(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,d),l}}/**
683
- * @license
684
- * Copyright 2020 Google LLC
685
- *
686
- * Licensed under the Apache License, Version 2.0 (the "License");
687
- * you may not use this file except in compliance with the License.
688
- * You may obtain a copy of the License at
689
- *
690
- * http://www.apache.org/licenses/LICENSE-2.0
691
- *
692
- * Unless required by applicable law or agreed to in writing, software
693
- * distributed under the License is distributed on an "AS IS" BASIS,
694
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
695
- * See the License for the specific language governing permissions and
696
- * limitations under the License.
697
- */const xu=new Map;function Ir(e){$r(e instanceof Function,"Expected a class definition");let t=xu.get(e);return t?($r(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,xu.set(e,t),t)}/**
698
- * @license
699
- * Copyright 2019 Google LLC
700
- *
701
- * Licensed under the Apache License, Version 2.0 (the "License");
702
- * you may not use this file except in compliance with the License.
703
- * You may obtain a copy of the License at
704
- *
705
- * http://www.apache.org/licenses/LICENSE-2.0
706
- *
707
- * Unless required by applicable law or agreed to in writing, software
708
- * distributed under the License is distributed on an "AS IS" BASIS,
709
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
710
- * See the License for the specific language governing permissions and
711
- * limitations under the License.
712
- */class nh{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,n){this.storage[t]=n}async _get(t){const n=this.storage[t];return n===void 0?null:n}async _remove(t){delete this.storage[t]}_addListener(t,n){}_removeListener(t,n){}}nh.type="NONE";const Pu=nh;/**
713
- * @license
714
- * Copyright 2019 Google LLC
715
- *
716
- * Licensed under the Apache License, Version 2.0 (the "License");
717
- * you may not use this file except in compliance with the License.
718
- * You may obtain a copy of the License at
719
- *
720
- * http://www.apache.org/licenses/LICENSE-2.0
721
- *
722
- * Unless required by applicable law or agreed to in writing, software
723
- * distributed under the License is distributed on an "AS IS" BASIS,
724
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
725
- * See the License for the specific language governing permissions and
726
- * limitations under the License.
727
- */function Qo(e,t,n){return`firebase:${e}:${t}:${n}`}class Rs{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=Qo(this.userKey,s.apiKey,o),this.fullPersistenceKey=Qo("persistence",s.apiKey,o),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);if(!t)return null;if(typeof t=="string"){const n=await ui(this.auth,{idToken:t}).catch(()=>{});return n?zn._fromGetAccountInfoResponse(this.auth,n,t):null}return zn._fromJSON(this.auth,t)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=t,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,n,r="authUser"){if(!n.length)return new Rs(Ir(Pu),t,r);const s=(await Promise.all(n.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let o=s[0]||Ir(Pu);const i=Qo(r,t.config.apiKey,t.name);let a=null;for(const d of n)try{const c=await d._get(i);if(c){let h;if(typeof c=="string"){const b=await ui(t,{idToken:c}).catch(()=>{});if(!b)break;h=await zn._fromGetAccountInfoResponse(t,b,c)}else h=zn._fromJSON(t,c);d!==o&&(a=h),o=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new Rs(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async d=>{if(d!==o)try{await d._remove(i)}catch{}})),new Rs(o,t,r))}}/**
728
- * @license
729
- * Copyright 2020 Google LLC
730
- *
731
- * Licensed under the Apache License, Version 2.0 (the "License");
732
- * you may not use this file except in compliance with the License.
733
- * You may obtain a copy of the License at
734
- *
735
- * http://www.apache.org/licenses/LICENSE-2.0
736
- *
737
- * Unless required by applicable law or agreed to in writing, software
738
- * distributed under the License is distributed on an "AS IS" BASIS,
739
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
740
- * See the License for the specific language governing permissions and
741
- * limitations under the License.
742
- */function Ru(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(ih(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(rh(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(lh(t))return"Blackberry";if(ch(t))return"Webos";if(sh(t))return"Safari";if((t.includes("chrome/")||oh(t))&&!t.includes("edge/"))return"Chrome";if(ah(t))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=e.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function rh(e=bn()){return/firefox\//i.test(e)}function sh(e=bn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function oh(e=bn()){return/crios\//i.test(e)}function ih(e=bn()){return/iemobile/i.test(e)}function ah(e=bn()){return/android/i.test(e)}function lh(e=bn()){return/blackberry/i.test(e)}function ch(e=bn()){return/webos/i.test(e)}function Pl(e=bn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function jE(e=bn()){var t;return Pl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function BE(){return QS()&&document.documentMode===10}function uh(e=bn()){return Pl(e)||ah(e)||ch(e)||lh(e)||/windows phone/i.test(e)||ih(e)}/**
743
- * @license
744
- * Copyright 2020 Google LLC
745
- *
746
- * Licensed under the Apache License, Version 2.0 (the "License");
747
- * you may not use this file except in compliance with the License.
748
- * You may obtain a copy of the License at
749
- *
750
- * http://www.apache.org/licenses/LICENSE-2.0
751
- *
752
- * Unless required by applicable law or agreed to in writing, software
753
- * distributed under the License is distributed on an "AS IS" BASIS,
754
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
755
- * See the License for the specific language governing permissions and
756
- * limitations under the License.
757
- */function dh(e,t=[]){let n;switch(e){case"Browser":n=Ru(bn());break;case"Worker":n=`${Ru(bn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${xo}/${r}`}/**
758
- * @license
759
- * Copyright 2022 Google LLC
760
- *
761
- * Licensed under the Apache License, Version 2.0 (the "License");
762
- * you may not use this file except in compliance with the License.
763
- * You may obtain a copy of the License at
764
- *
765
- * http://www.apache.org/licenses/LICENSE-2.0
766
- *
767
- * Unless required by applicable law or agreed to in writing, software
768
- * distributed under the License is distributed on an "AS IS" BASIS,
769
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
770
- * See the License for the specific language governing permissions and
771
- * limitations under the License.
772
- */class FE{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,n){const r=o=>new Promise((i,a)=>{try{const l=t(o);i(l)}catch(l){a(l)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const n=[];try{for(const r of this.queue)await r(t),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
773
- * @license
774
- * Copyright 2023 Google LLC
775
- *
776
- * Licensed under the Apache License, Version 2.0 (the "License");
777
- * you may not use this file except in compliance with the License.
778
- * You may obtain a copy of the License at
779
- *
780
- * http://www.apache.org/licenses/LICENSE-2.0
781
- *
782
- * Unless required by applicable law or agreed to in writing, software
783
- * distributed under the License is distributed on an "AS IS" BASIS,
784
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
785
- * See the License for the specific language governing permissions and
786
- * limitations under the License.
787
- */async function UE(e,t={}){return Fs(e,"GET","/v2/passwordPolicy",Al(e,t))}/**
788
- * @license
789
- * Copyright 2023 Google LLC
790
- *
791
- * Licensed under the Apache License, Version 2.0 (the "License");
792
- * you may not use this file except in compliance with the License.
793
- * You may obtain a copy of the License at
794
- *
795
- * http://www.apache.org/licenses/LICENSE-2.0
796
- *
797
- * Unless required by applicable law or agreed to in writing, software
798
- * distributed under the License is distributed on an "AS IS" BASIS,
799
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
800
- * See the License for the specific language governing permissions and
801
- * limitations under the License.
802
- */const HE=6;class VE{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??HE,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=t.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=t.forceUpgradeOnSignin??!1,this.schemaVersion=t.schemaVersion}validatePassword(t){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,n),this.validatePasswordCharacterOptions(t,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(t,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=t.length>=r),s&&(n.meetsMaxPasswordLength=t.length<=s)}validatePasswordCharacterOptions(t,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<t.length;s++)r=t.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(t,n,r,s,o){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=o))}}/**
803
- * @license
804
- * Copyright 2020 Google LLC
805
- *
806
- * Licensed under the Apache License, Version 2.0 (the "License");
807
- * you may not use this file except in compliance with the License.
808
- * You may obtain a copy of the License at
809
- *
810
- * http://www.apache.org/licenses/LICENSE-2.0
811
- *
812
- * Unless required by applicable law or agreed to in writing, software
813
- * distributed under the License is distributed on an "AS IS" BASIS,
814
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
815
- * See the License for the specific language governing permissions and
816
- * limitations under the License.
817
- */class WE{constructor(t,n,r,s){this.app=t,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Mu(this),this.idTokenSubscription=new Mu(this),this.beforeStateQueue=new FE(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Qf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(o=>this._resolvePersistenceManagerAvailable=o)}_initializeWithPersistence(t,n){return n&&(this._popupRedirectResolver=Ir(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await Rs.create(this,t),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((o=this.currentUser)==null?void 0:o.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!t)){if(this.currentUser&&t&&this.currentUser.uid===t.uid){this._currentUser._assign(t),await this.currentUser.getIdToken();return}await this._updateCurrentUser(t,!0)}}async initializeCurrentUserFromIdToken(t){try{const n=await ui(this,{idToken:t}),r=await zn._fromGetAccountInfoResponse(this,n,t);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var o;if(lr(this.app)){const i=this.app.settings.authIdToken;return i?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(i).then(a,a))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const i=(o=this.redirectUser)==null?void 0:o._redirectEventId,a=r==null?void 0:r._redirectEventId,l=await this.tryRedirectSignIn(t);(!i||i===a)&&(l!=null&&l.user)&&(r=l.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(i){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(i))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Ye(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(t){try{await di(t)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=SE()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(lr(this.app))return Promise.reject(ps(this));const n=t?Bs(t):null;return n&&Ye(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(t,n=!1){if(!this._deleted)return t&&Ye(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(t),this.queue(async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()})}async signOut(){return lr(this.app)?Promise.reject(ps(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return lr(this.app)?Promise.reject(ps(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ir(t))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(t)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await UE(this),n=new VE(t);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new Co("auth","Firebase",t())}onAuthStateChanged(t,n,r){return this.registerStateListener(this.authStateSubscription,t,n,r)}beforeAuthStateChanged(t,n){return this.beforeStateQueue.pushCallback(t,n)}onIdTokenChanged(t,n,r){return this.registerStateListener(this.idTokenSubscription,t,n,r)}authStateReady(){return new Promise((t,n)=>{if(this.currentUser)t();else{const r=this.onAuthStateChanged(()=>{r(),t()},n)}})}async revokeAccessToken(t){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await LE(this,r)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(t=this._currentUser)==null?void 0:t.toJSON()}}async _setRedirectUser(t,n){const r=await this.getOrInitRedirectPersistenceManager(n);return t===null?r.removeCurrentUser():r.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const n=t&&Ir(t)||this._popupRedirectResolver;Ye(n,this,"argument-error"),this.redirectPersistenceManager=await Rs.create(this,[Ir(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===t?this._currentUser:((r=this.redirectUser)==null?void 0:r._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(t))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const t=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==t&&(this.lastNotifiedUid=t,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,n,r,s){if(this._deleted)return()=>{};const o=typeof n=="function"?n:n.next.bind(n);let i=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ye(a,this,"internal-error"),a.then(()=>{i||o(this.currentUser)}),typeof n=="function"){const l=t.addObserver(n,r,s);return()=>{i=!0,l()}}else{const l=t.addObserver(n);return()=>{i=!0,l()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Ye(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=dh(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var n;if(lr(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return t!=null&&t.error&&bE(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Ri(e){return Bs(e)}class Mu{constructor(t){this.auth=t,this.observer=null,this.addObserver=sI(n=>this.observer=n)}get next(){return Ye(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
818
- * @license
819
- * Copyright 2020 Google LLC
820
- *
821
- * Licensed under the Apache License, Version 2.0 (the "License");
822
- * you may not use this file except in compliance with the License.
823
- * You may obtain a copy of the License at
824
- *
825
- * http://www.apache.org/licenses/LICENSE-2.0
826
- *
827
- * Unless required by applicable law or agreed to in writing, software
828
- * distributed under the License is distributed on an "AS IS" BASIS,
829
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
830
- * See the License for the specific language governing permissions and
831
- * limitations under the License.
832
- */let Rl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function zE(e){Rl=e}function GE(e){return Rl.loadJS(e)}function qE(){return Rl.gapiScript}function KE(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
833
- * @license
834
- * Copyright 2020 Google LLC
835
- *
836
- * Licensed under the Apache License, Version 2.0 (the "License");
837
- * you may not use this file except in compliance with the License.
838
- * You may obtain a copy of the License at
839
- *
840
- * http://www.apache.org/licenses/LICENSE-2.0
841
- *
842
- * Unless required by applicable law or agreed to in writing, software
843
- * distributed under the License is distributed on an "AS IS" BASIS,
844
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
845
- * See the License for the specific language governing permissions and
846
- * limitations under the License.
847
- */function JE(e,t){const n=zf(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(Ds(o,t??{}))return s;hr(s,"already-initialized")}return n.initialize({options:t})}function YE(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Ir);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function QE(e,t,n){const r=Ri(e);Ye(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=fh(t),{host:i,port:a}=XE(t),l=a===null?"":`:${a}`,d={url:`${o}//${i}${l}/`},c=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Ye(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Ye(Ds(d,r.config.emulator)&&Ds(c,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=d,r.emulatorConfig=c,r.settings.appVerificationDisabledForTesting=!0,Tl(i)?aI(`${o}//${i}${l}`):ZE()}function fh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function XE(e){const t=fh(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const o=s[1];return{host:o,port:$u(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:$u(i)}}}function $u(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function ZE(){function e(){const t=document.createElement("p"),n=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",e):e())}/**
848
- * @license
849
- * Copyright 2020 Google LLC
850
- *
851
- * Licensed under the Apache License, Version 2.0 (the "License");
852
- * you may not use this file except in compliance with the License.
853
- * You may obtain a copy of the License at
854
- *
855
- * http://www.apache.org/licenses/LICENSE-2.0
856
- *
857
- * Unless required by applicable law or agreed to in writing, software
858
- * distributed under the License is distributed on an "AS IS" BASIS,
859
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
860
- * See the License for the specific language governing permissions and
861
- * limitations under the License.
862
- */class hh{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Sr("not implemented")}_getIdTokenResponse(t){return Sr("not implemented")}_linkToIdToken(t,n){return Sr("not implemented")}_getReauthenticationResolver(t){return Sr("not implemented")}}/**
863
- * @license
864
- * Copyright 2020 Google LLC
865
- *
866
- * Licensed under the Apache License, Version 2.0 (the "License");
867
- * you may not use this file except in compliance with the License.
868
- * You may obtain a copy of the License at
869
- *
870
- * http://www.apache.org/licenses/LICENSE-2.0
871
- *
872
- * Unless required by applicable law or agreed to in writing, software
873
- * distributed under the License is distributed on an "AS IS" BASIS,
874
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
875
- * See the License for the specific language governing permissions and
876
- * limitations under the License.
877
- */async function Ms(e,t){return AE(e,"POST","/v1/accounts:signInWithIdp",Al(e,t))}/**
878
- * @license
879
- * Copyright 2020 Google LLC
880
- *
881
- * Licensed under the Apache License, Version 2.0 (the "License");
882
- * you may not use this file except in compliance with the License.
883
- * You may obtain a copy of the License at
884
- *
885
- * http://www.apache.org/licenses/LICENSE-2.0
886
- *
887
- * Unless required by applicable law or agreed to in writing, software
888
- * distributed under the License is distributed on an "AS IS" BASIS,
889
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
890
- * See the License for the specific language governing permissions and
891
- * limitations under the License.
892
- */const e1="http://localhost";class ms extends hh{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new ms(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(n.idToken=t.idToken),t.accessToken&&(n.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(n.nonce=t.nonce),t.pendingToken&&(n.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(n.accessToken=t.oauthToken,n.secret=t.oauthTokenSecret):hr("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const n=typeof t=="string"?JSON.parse(t):t,{providerId:r,signInMethod:s,...o}=n;if(!r||!s)return null;const i=new ms(r,s);return i.idToken=o.idToken||void 0,i.accessToken=o.accessToken||void 0,i.secret=o.secret,i.nonce=o.nonce,i.pendingToken=o.pendingToken||null,i}_getIdTokenResponse(t){const n=this.buildRequest();return Ms(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,Ms(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,Ms(t,n)}buildRequest(){const t={requestUri:e1,returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),t.postBody=Ao(n)}return t}}/**
893
- * @license
894
- * Copyright 2020 Google LLC
895
- *
896
- * Licensed under the Apache License, Version 2.0 (the "License");
897
- * you may not use this file except in compliance with the License.
898
- * You may obtain a copy of the License at
899
- *
900
- * http://www.apache.org/licenses/LICENSE-2.0
901
- *
902
- * Unless required by applicable law or agreed to in writing, software
903
- * distributed under the License is distributed on an "AS IS" BASIS,
904
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
905
- * See the License for the specific language governing permissions and
906
- * limitations under the License.
907
- */class Ml{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}/**
908
- * @license
909
- * Copyright 2019 Google LLC
910
- *
911
- * Licensed under the Apache License, Version 2.0 (the "License");
912
- * you may not use this file except in compliance with the License.
913
- * You may obtain a copy of the License at
914
- *
915
- * http://www.apache.org/licenses/LICENSE-2.0
916
- *
917
- * Unless required by applicable law or agreed to in writing, software
918
- * distributed under the License is distributed on an "AS IS" BASIS,
919
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
920
- * See the License for the specific language governing permissions and
921
- * limitations under the License.
922
- */class Ro extends Ml{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
923
- * @license
924
- * Copyright 2020 Google LLC
925
- *
926
- * Licensed under the Apache License, Version 2.0 (the "License");
927
- * you may not use this file except in compliance with the License.
928
- * You may obtain a copy of the License at
929
- *
930
- * http://www.apache.org/licenses/LICENSE-2.0
931
- *
932
- * Unless required by applicable law or agreed to in writing, software
933
- * distributed under the License is distributed on an "AS IS" BASIS,
934
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
935
- * See the License for the specific language governing permissions and
936
- * limitations under the License.
937
- */class Wr extends Ro{constructor(){super("facebook.com")}static credential(t){return ms._fromParams({providerId:Wr.PROVIDER_ID,signInMethod:Wr.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Wr.credentialFromTaggedObject(t)}static credentialFromError(t){return Wr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Wr.credential(t.oauthAccessToken)}catch{return null}}}Wr.FACEBOOK_SIGN_IN_METHOD="facebook.com";Wr.PROVIDER_ID="facebook.com";/**
938
- * @license
939
- * Copyright 2020 Google LLC
940
- *
941
- * Licensed under the Apache License, Version 2.0 (the "License");
942
- * you may not use this file except in compliance with the License.
943
- * You may obtain a copy of the License at
944
- *
945
- * http://www.apache.org/licenses/LICENSE-2.0
946
- *
947
- * Unless required by applicable law or agreed to in writing, software
948
- * distributed under the License is distributed on an "AS IS" BASIS,
949
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
950
- * See the License for the specific language governing permissions and
951
- * limitations under the License.
952
- */class zr extends Ro{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return ms._fromParams({providerId:zr.PROVIDER_ID,signInMethod:zr.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return zr.credentialFromTaggedObject(t)}static credentialFromError(t){return zr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return zr.credential(n,r)}catch{return null}}}zr.GOOGLE_SIGN_IN_METHOD="google.com";zr.PROVIDER_ID="google.com";/**
953
- * @license
954
- * Copyright 2020 Google LLC
955
- *
956
- * Licensed under the Apache License, Version 2.0 (the "License");
957
- * you may not use this file except in compliance with the License.
958
- * You may obtain a copy of the License at
959
- *
960
- * http://www.apache.org/licenses/LICENSE-2.0
961
- *
962
- * Unless required by applicable law or agreed to in writing, software
963
- * distributed under the License is distributed on an "AS IS" BASIS,
964
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
965
- * See the License for the specific language governing permissions and
966
- * limitations under the License.
967
- */class cr extends Ro{constructor(){super("github.com")}static credential(t){return ms._fromParams({providerId:cr.PROVIDER_ID,signInMethod:cr.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return cr.credentialFromTaggedObject(t)}static credentialFromError(t){return cr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return cr.credential(t.oauthAccessToken)}catch{return null}}}cr.GITHUB_SIGN_IN_METHOD="github.com";cr.PROVIDER_ID="github.com";/**
968
- * @license
969
- * Copyright 2020 Google LLC
970
- *
971
- * Licensed under the Apache License, Version 2.0 (the "License");
972
- * you may not use this file except in compliance with the License.
973
- * You may obtain a copy of the License at
974
- *
975
- * http://www.apache.org/licenses/LICENSE-2.0
976
- *
977
- * Unless required by applicable law or agreed to in writing, software
978
- * distributed under the License is distributed on an "AS IS" BASIS,
979
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
980
- * See the License for the specific language governing permissions and
981
- * limitations under the License.
982
- */class Gr extends Ro{constructor(){super("twitter.com")}static credential(t,n){return ms._fromParams({providerId:Gr.PROVIDER_ID,signInMethod:Gr.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return Gr.credentialFromTaggedObject(t)}static credentialFromError(t){return Gr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return Gr.credential(n,r)}catch{return null}}}Gr.TWITTER_SIGN_IN_METHOD="twitter.com";Gr.PROVIDER_ID="twitter.com";/**
983
- * @license
984
- * Copyright 2020 Google LLC
985
- *
986
- * Licensed under the Apache License, Version 2.0 (the "License");
987
- * you may not use this file except in compliance with the License.
988
- * You may obtain a copy of the License at
989
- *
990
- * http://www.apache.org/licenses/LICENSE-2.0
991
- *
992
- * Unless required by applicable law or agreed to in writing, software
993
- * distributed under the License is distributed on an "AS IS" BASIS,
994
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
995
- * See the License for the specific language governing permissions and
996
- * limitations under the License.
997
- */class js{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,n,r,s=!1){const o=await zn._fromIdTokenResponse(t,r,s),i=Ou(r);return new js({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=Ou(r);return new js({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function Ou(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
998
- * @license
999
- * Copyright 2020 Google LLC
1000
- *
1001
- * Licensed under the Apache License, Version 2.0 (the "License");
1002
- * you may not use this file except in compliance with the License.
1003
- * You may obtain a copy of the License at
1004
- *
1005
- * http://www.apache.org/licenses/LICENSE-2.0
1006
- *
1007
- * Unless required by applicable law or agreed to in writing, software
1008
- * distributed under the License is distributed on an "AS IS" BASIS,
1009
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1010
- * See the License for the specific language governing permissions and
1011
- * limitations under the License.
1012
- */class fi extends Xr{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,fi.prototype),this.customData={appName:t.name,tenantId:t.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(t,n,r,s){return new fi(t,n,r,s)}}function ph(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?fi._fromErrorAndOperation(e,o,t,r):o})}async function t1(e,t,n=!1){const r=await To(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return js._forOperation(e,"link",r)}/**
1013
- * @license
1014
- * Copyright 2019 Google LLC
1015
- *
1016
- * Licensed under the Apache License, Version 2.0 (the "License");
1017
- * you may not use this file except in compliance with the License.
1018
- * You may obtain a copy of the License at
1019
- *
1020
- * http://www.apache.org/licenses/LICENSE-2.0
1021
- *
1022
- * Unless required by applicable law or agreed to in writing, software
1023
- * distributed under the License is distributed on an "AS IS" BASIS,
1024
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1025
- * See the License for the specific language governing permissions and
1026
- * limitations under the License.
1027
- */async function n1(e,t,n=!1){const{auth:r}=e;if(lr(r.app))return Promise.reject(ps(r));const s="reauthenticate";try{const o=await To(e,ph(r,s,t,e),n);Ye(o.idToken,r,"internal-error");const i=xl(o.idToken);Ye(i,r,"internal-error");const{sub:a}=i;return Ye(e.uid===a,r,"user-mismatch"),js._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&hr(r,"user-mismatch"),o}}/**
1028
- * @license
1029
- * Copyright 2020 Google LLC
1030
- *
1031
- * Licensed under the Apache License, Version 2.0 (the "License");
1032
- * you may not use this file except in compliance with the License.
1033
- * You may obtain a copy of the License at
1034
- *
1035
- * http://www.apache.org/licenses/LICENSE-2.0
1036
- *
1037
- * Unless required by applicable law or agreed to in writing, software
1038
- * distributed under the License is distributed on an "AS IS" BASIS,
1039
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1040
- * See the License for the specific language governing permissions and
1041
- * limitations under the License.
1042
- */async function r1(e,t,n=!1){if(lr(e.app))return Promise.reject(ps(e));const r="signIn",s=await ph(e,r,t),o=await js._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function s1(e,t,n,r){return Bs(e).onIdTokenChanged(t,n,r)}function o1(e,t,n){return Bs(e).beforeAuthStateChanged(t,n)}const hi="__sak";/**
1043
- * @license
1044
- * Copyright 2019 Google LLC
1045
- *
1046
- * Licensed under the Apache License, Version 2.0 (the "License");
1047
- * you may not use this file except in compliance with the License.
1048
- * You may obtain a copy of the License at
1049
- *
1050
- * http://www.apache.org/licenses/LICENSE-2.0
1051
- *
1052
- * Unless required by applicable law or agreed to in writing, software
1053
- * distributed under the License is distributed on an "AS IS" BASIS,
1054
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1055
- * See the License for the specific language governing permissions and
1056
- * limitations under the License.
1057
- */class mh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(hi,"1"),this.storage.removeItem(hi),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(t,n){return this.storage.setItem(t,JSON.stringify(n)),Promise.resolve()}_get(t){const n=this.storage.getItem(t);return Promise.resolve(n?JSON.parse(n):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
1058
- * @license
1059
- * Copyright 2020 Google LLC
1060
- *
1061
- * Licensed under the Apache License, Version 2.0 (the "License");
1062
- * you may not use this file except in compliance with the License.
1063
- * You may obtain a copy of the License at
1064
- *
1065
- * http://www.apache.org/licenses/LICENSE-2.0
1066
- *
1067
- * Unless required by applicable law or agreed to in writing, software
1068
- * distributed under the License is distributed on an "AS IS" BASIS,
1069
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1070
- * See the License for the specific language governing permissions and
1071
- * limitations under the License.
1072
- */const i1=1e3,a1=10;class gh extends mh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=uh(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&t(n,s,r)}}onStorageEvent(t,n=!1){if(!t.key){this.forAllChangedKeys((i,a,l)=>{this.notifyListeners(i,l)});return}const r=t.key;n?this.detachListener():this.stopPolling();const s=()=>{const i=this.storage.getItem(r);!n&&this.localCache[r]===i||this.notifyListeners(r,i)},o=this.storage.getItem(r);BE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,a1):s()}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((t,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:n,newValue:r}),!0)})},i1)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,n){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(n)}_removeListener(t,n){this.listeners[t]&&(this.listeners[t].delete(n),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(t,n){await super._set(t,n),this.localCache[t]=JSON.stringify(n)}async _get(t){const n=await super._get(t);return this.localCache[t]=JSON.stringify(n),n}async _remove(t){await super._remove(t),delete this.localCache[t]}}gh.type="LOCAL";const l1=gh;/**
1073
- * @license
1074
- * Copyright 2020 Google LLC
1075
- *
1076
- * Licensed under the Apache License, Version 2.0 (the "License");
1077
- * you may not use this file except in compliance with the License.
1078
- * You may obtain a copy of the License at
1079
- *
1080
- * http://www.apache.org/licenses/LICENSE-2.0
1081
- *
1082
- * Unless required by applicable law or agreed to in writing, software
1083
- * distributed under the License is distributed on an "AS IS" BASIS,
1084
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1085
- * See the License for the specific language governing permissions and
1086
- * limitations under the License.
1087
- */class vh extends mh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}vh.type="SESSION";const yh=vh;/**
1088
- * @license
1089
- * Copyright 2019 Google LLC
1090
- *
1091
- * Licensed under the Apache License, Version 2.0 (the "License");
1092
- * you may not use this file except in compliance with the License.
1093
- * You may obtain a copy of the License at
1094
- *
1095
- * http://www.apache.org/licenses/LICENSE-2.0
1096
- *
1097
- * Unless required by applicable law or agreed to in writing, software
1098
- * distributed under the License is distributed on an "AS IS" BASIS,
1099
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1100
- * See the License for the specific language governing permissions and
1101
- * limitations under the License.
1102
- */function c1(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1103
- * @license
1104
- * Copyright 2019 Google LLC
1105
- *
1106
- * Licensed under the Apache License, Version 2.0 (the "License");
1107
- * you may not use this file except in compliance with the License.
1108
- * You may obtain a copy of the License at
1109
- *
1110
- * http://www.apache.org/licenses/LICENSE-2.0
1111
- *
1112
- * Unless required by applicable law or agreed to in writing, software
1113
- * distributed under the License is distributed on an "AS IS" BASIS,
1114
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1115
- * See the License for the specific language governing permissions and
1116
- * limitations under the License.
1117
- */class Mi{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const n=this.receivers.find(s=>s.isListeningto(t));if(n)return n;const r=new Mi(t);return this.receivers.push(r),r}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const n=t,{eventId:r,eventType:s,data:o}=n.data,i=this.handlersMap[s];if(!(i!=null&&i.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(i).map(async d=>d(n.origin,o)),l=await c1(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(t,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(n)}_unsubscribe(t,n){this.handlersMap[t]&&n&&this.handlersMap[t].delete(n),(!n||this.handlersMap[t].size===0)&&delete this.handlersMap[t],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Mi.receivers=[];/**
1118
- * @license
1119
- * Copyright 2020 Google LLC
1120
- *
1121
- * Licensed under the Apache License, Version 2.0 (the "License");
1122
- * you may not use this file except in compliance with the License.
1123
- * You may obtain a copy of the License at
1124
- *
1125
- * http://www.apache.org/licenses/LICENSE-2.0
1126
- *
1127
- * Unless required by applicable law or agreed to in writing, software
1128
- * distributed under the License is distributed on an "AS IS" BASIS,
1129
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1130
- * See the License for the specific language governing permissions and
1131
- * limitations under the License.
1132
- */function $l(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
1133
- * @license
1134
- * Copyright 2019 Google LLC
1135
- *
1136
- * Licensed under the Apache License, Version 2.0 (the "License");
1137
- * you may not use this file except in compliance with the License.
1138
- * You may obtain a copy of the License at
1139
- *
1140
- * http://www.apache.org/licenses/LICENSE-2.0
1141
- *
1142
- * Unless required by applicable law or agreed to in writing, software
1143
- * distributed under the License is distributed on an "AS IS" BASIS,
1144
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1145
- * See the License for the specific language governing permissions and
1146
- * limitations under the License.
1147
- */class u1{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,n,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let o,i;return new Promise((a,l)=>{const d=$l("",20);s.port1.start();const c=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(h){const b=h;if(b.data.eventId===d)switch(b.data.status){case"ack":clearTimeout(c),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(b.data.response);break;default:clearTimeout(c),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:d,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
1148
- * @license
1149
- * Copyright 2020 Google LLC
1150
- *
1151
- * Licensed under the Apache License, Version 2.0 (the "License");
1152
- * you may not use this file except in compliance with the License.
1153
- * You may obtain a copy of the License at
1154
- *
1155
- * http://www.apache.org/licenses/LICENSE-2.0
1156
- *
1157
- * Unless required by applicable law or agreed to in writing, software
1158
- * distributed under the License is distributed on an "AS IS" BASIS,
1159
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1160
- * See the License for the specific language governing permissions and
1161
- * limitations under the License.
1162
- */function fr(){return window}function d1(e){fr().location.href=e}/**
1163
- * @license
1164
- * Copyright 2020 Google LLC.
1165
- *
1166
- * Licensed under the Apache License, Version 2.0 (the "License");
1167
- * you may not use this file except in compliance with the License.
1168
- * You may obtain a copy of the License at
1169
- *
1170
- * http://www.apache.org/licenses/LICENSE-2.0
1171
- *
1172
- * Unless required by applicable law or agreed to in writing, software
1173
- * distributed under the License is distributed on an "AS IS" BASIS,
1174
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1175
- * See the License for the specific language governing permissions and
1176
- * limitations under the License.
1177
- */function wh(){return typeof fr().WorkerGlobalScope<"u"&&typeof fr().importScripts=="function"}async function f1(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function h1(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function p1(){return wh()?self:null}/**
1178
- * @license
1179
- * Copyright 2019 Google LLC
1180
- *
1181
- * Licensed under the Apache License, Version 2.0 (the "License");
1182
- * you may not use this file except in compliance with the License.
1183
- * You may obtain a copy of the License at
1184
- *
1185
- * http://www.apache.org/licenses/LICENSE-2.0
1186
- *
1187
- * Unless required by applicable law or agreed to in writing, software
1188
- * distributed under the License is distributed on an "AS IS" BASIS,
1189
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1190
- * See the License for the specific language governing permissions and
1191
- * limitations under the License.
1192
- */const bh="firebaseLocalStorageDb",m1=1,pi="firebaseLocalStorage",_h="fbase_key";class Mo{constructor(t){this.request=t}toPromise(){return new Promise((t,n)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function $i(e,t){return e.transaction([pi],t?"readwrite":"readonly").objectStore(pi)}function g1(){const e=indexedDB.deleteDatabase(bh);return new Mo(e).toPromise()}function Ga(){const e=indexedDB.open(bh,m1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(pi,{keyPath:_h})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(pi)?t(r):(r.close(),await g1(),t(await Ga()))})})}async function Nu(e,t,n){const r=$i(e,!0).put({[_h]:t,value:n});return new Mo(r).toPromise()}async function v1(e,t){const n=$i(e,!1).get(t),r=await new Mo(n).toPromise();return r===void 0?null:r.value}function Du(e,t){const n=$i(e,!0).delete(t);return new Mo(n).toPromise()}const y1=800,w1=3;class kh{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db?this.db:(this.db=await Ga(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>w1)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return wh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Mi._getInstance(p1()),this.receiver._subscribe("keyChanged",async(t,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(t,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await f1(),!this.activeServiceWorker)return;this.sender=new u1(this.activeServiceWorker);const t=await this.sender._send("ping",{},800);t&&(n=t[0])!=null&&n.fulfilled&&(r=t[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(!(!this.sender||!this.activeServiceWorker||h1()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await Ga();return await Nu(t,hi,"1"),await Du(t,hi),!0}catch{}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>Nu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>v1(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Du(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=$i(s,!1).getAll();return new Mo(o).toPromise()});if(!t)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(t.length!==0)for(const{fbase_key:s,value:o}of t)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(o)&&(this.notifyListeners(s,o),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),y1)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(n)}_removeListener(t,n){this.listeners[t]&&(this.listeners[t].delete(n),this.listeners[t].size===0&&delete this.listeners[t]),Object.keys(this.listeners).length===0&&this.stopPolling()}}kh.type="LOCAL";const b1=kh;new Po(3e4,6e4);/**
1193
- * @license
1194
- * Copyright 2021 Google LLC
1195
- *
1196
- * Licensed under the Apache License, Version 2.0 (the "License");
1197
- * you may not use this file except in compliance with the License.
1198
- * You may obtain a copy of the License at
1199
- *
1200
- * http://www.apache.org/licenses/LICENSE-2.0
1201
- *
1202
- * Unless required by applicable law or agreed to in writing, software
1203
- * distributed under the License is distributed on an "AS IS" BASIS,
1204
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1205
- * See the License for the specific language governing permissions and
1206
- * limitations under the License.
1207
- */function Th(e,t){return t?Ir(t):(Ye(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
1208
- * @license
1209
- * Copyright 2019 Google LLC
1210
- *
1211
- * Licensed under the Apache License, Version 2.0 (the "License");
1212
- * you may not use this file except in compliance with the License.
1213
- * You may obtain a copy of the License at
1214
- *
1215
- * http://www.apache.org/licenses/LICENSE-2.0
1216
- *
1217
- * Unless required by applicable law or agreed to in writing, software
1218
- * distributed under the License is distributed on an "AS IS" BASIS,
1219
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1220
- * See the License for the specific language governing permissions and
1221
- * limitations under the License.
1222
- */class Ol extends hh{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Ms(t,this._buildIdpRequest())}_linkToIdToken(t,n){return Ms(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return Ms(t,this._buildIdpRequest())}_buildIdpRequest(t){const n={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(n.idToken=t),n}}function _1(e){return r1(e.auth,new Ol(e),e.bypassAuthState)}function k1(e){const{auth:t,user:n}=e;return Ye(n,t,"internal-error"),n1(n,new Ol(e),e.bypassAuthState)}async function T1(e){const{auth:t,user:n}=e;return Ye(n,t,"internal-error"),t1(n,new Ol(e),e.bypassAuthState)}/**
1223
- * @license
1224
- * Copyright 2020 Google LLC
1225
- *
1226
- * Licensed under the Apache License, Version 2.0 (the "License");
1227
- * you may not use this file except in compliance with the License.
1228
- * You may obtain a copy of the License at
1229
- *
1230
- * http://www.apache.org/licenses/LICENSE-2.0
1231
- *
1232
- * Unless required by applicable law or agreed to in writing, software
1233
- * distributed under the License is distributed on an "AS IS" BASIS,
1234
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1235
- * See the License for the specific language governing permissions and
1236
- * limitations under the License.
1237
- */class Sh{constructor(t,n,r,s,o=!1){this.auth=t,this.resolver=r,this.user=s,this.bypassAuthState=o,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(t,n)=>{this.pendingPromise={resolve:t,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(t){const{urlResponse:n,sessionId:r,postBody:s,tenantId:o,error:i,type:a}=t;if(i){this.reject(i);return}const l={auth:this.auth,requestUri:n,sessionId:r,tenantId:o||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(l))}catch(d){this.reject(d)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return _1;case"linkViaPopup":case"linkViaRedirect":return T1;case"reauthViaPopup":case"reauthViaRedirect":return k1;default:hr(this.auth,"internal-error")}}resolve(t){$r(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){$r(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}/**
1238
- * @license
1239
- * Copyright 2020 Google LLC
1240
- *
1241
- * Licensed under the Apache License, Version 2.0 (the "License");
1242
- * you may not use this file except in compliance with the License.
1243
- * You may obtain a copy of the License at
1244
- *
1245
- * http://www.apache.org/licenses/LICENSE-2.0
1246
- *
1247
- * Unless required by applicable law or agreed to in writing, software
1248
- * distributed under the License is distributed on an "AS IS" BASIS,
1249
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1250
- * See the License for the specific language governing permissions and
1251
- * limitations under the License.
1252
- */const S1=new Po(2e3,1e4);async function I1(e,t,n){if(lr(e.app))return Promise.reject(Kn(e,"operation-not-supported-in-this-environment"));const r=Ri(e);_E(e,t,Ml);const s=Th(r,n);return new ds(r,"signInViaPopup",t,s).executeNotNull()}class ds extends Sh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,ds.currentPopupAction&&ds.currentPopupAction.cancel(),ds.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Ye(t,this.auth,"internal-error"),t}async onExecution(){$r(this.filter.length===1,"Popup operations only handle one event");const t=$l();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(Kn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(Kn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ds.currentPopupAction=null}pollUserCancellation(){const t=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Kn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,S1.get())};t()}}ds.currentPopupAction=null;/**
1253
- * @license
1254
- * Copyright 2020 Google LLC
1255
- *
1256
- * Licensed under the Apache License, Version 2.0 (the "License");
1257
- * you may not use this file except in compliance with the License.
1258
- * You may obtain a copy of the License at
1259
- *
1260
- * http://www.apache.org/licenses/LICENSE-2.0
1261
- *
1262
- * Unless required by applicable law or agreed to in writing, software
1263
- * distributed under the License is distributed on an "AS IS" BASIS,
1264
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1265
- * See the License for the specific language governing permissions and
1266
- * limitations under the License.
1267
- */const E1="pendingRedirect",Xo=new Map;class C1 extends Sh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=Xo.get(this.auth._key());if(!t){try{const r=await A1(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}Xo.set(this.auth._key(),t)}return this.bypassAuthState||Xo.set(this.auth._key(),()=>Promise.resolve(null)),t()}async onAuthEvent(t){if(t.type==="signInViaRedirect")return super.onAuthEvent(t);if(t.type==="unknown"){this.resolve(null);return}if(t.eventId){const n=await this.auth._redirectUserForId(t.eventId);if(n)return this.user=n,super.onAuthEvent(t);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function A1(e,t){const n=R1(t),r=P1(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function x1(e,t){Xo.set(e._key(),t)}function P1(e){return Ir(e._redirectPersistence)}function R1(e){return Qo(E1,e.config.apiKey,e.name)}async function M1(e,t,n=!1){if(lr(e.app))return Promise.reject(ps(e));const r=Ri(e),s=Th(r,t),i=await new C1(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
1268
- * @license
1269
- * Copyright 2020 Google LLC
1270
- *
1271
- * Licensed under the Apache License, Version 2.0 (the "License");
1272
- * you may not use this file except in compliance with the License.
1273
- * You may obtain a copy of the License at
1274
- *
1275
- * http://www.apache.org/licenses/LICENSE-2.0
1276
- *
1277
- * Unless required by applicable law or agreed to in writing, software
1278
- * distributed under the License is distributed on an "AS IS" BASIS,
1279
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1280
- * See the License for the specific language governing permissions and
1281
- * limitations under the License.
1282
- */const $1=600*1e3;class O1{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(t,r)&&(n=!0,this.sendToConsumer(t,r),this.saveEventToCache(t))}),this.hasHandledPotentialRedirect||!N1(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Ih(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(Kn(this.auth,s))}else n.onAuthEvent(t)}isEventForConsumer(t,n){const r=n.eventId===null||!!t.eventId&&t.eventId===n.eventId;return n.filter.includes(t.type)&&r}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=$1&&this.cachedEventUids.clear(),this.cachedEventUids.has(Lu(t))}saveEventToCache(t){this.cachedEventUids.add(Lu(t)),this.lastProcessedEventTime=Date.now()}}function Lu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Ih({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function N1(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Ih(e);default:return!1}}/**
1283
- * @license
1284
- * Copyright 2020 Google LLC
1285
- *
1286
- * Licensed under the Apache License, Version 2.0 (the "License");
1287
- * you may not use this file except in compliance with the License.
1288
- * You may obtain a copy of the License at
1289
- *
1290
- * http://www.apache.org/licenses/LICENSE-2.0
1291
- *
1292
- * Unless required by applicable law or agreed to in writing, software
1293
- * distributed under the License is distributed on an "AS IS" BASIS,
1294
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1295
- * See the License for the specific language governing permissions and
1296
- * limitations under the License.
1297
- */async function D1(e,t={}){return Fs(e,"GET","/v1/projects",t)}/**
1298
- * @license
1299
- * Copyright 2020 Google LLC
1300
- *
1301
- * Licensed under the Apache License, Version 2.0 (the "License");
1302
- * you may not use this file except in compliance with the License.
1303
- * You may obtain a copy of the License at
1304
- *
1305
- * http://www.apache.org/licenses/LICENSE-2.0
1306
- *
1307
- * Unless required by applicable law or agreed to in writing, software
1308
- * distributed under the License is distributed on an "AS IS" BASIS,
1309
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1310
- * See the License for the specific language governing permissions and
1311
- * limitations under the License.
1312
- */const L1=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,j1=/^https?/;async function B1(e){if(e.config.emulator)return;const{authorizedDomains:t}=await D1(e);for(const n of t)try{if(F1(n))return}catch{}hr(e,"unauthorized-domain")}function F1(e){const t=Wa(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return i.hostname===""&&r===""?n==="chrome-extension:"&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):n==="chrome-extension:"&&i.hostname===r}if(!j1.test(n))return!1;if(L1.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1313
- * @license
1314
- * Copyright 2020 Google LLC.
1315
- *
1316
- * Licensed under the Apache License, Version 2.0 (the "License");
1317
- * you may not use this file except in compliance with the License.
1318
- * You may obtain a copy of the License at
1319
- *
1320
- * http://www.apache.org/licenses/LICENSE-2.0
1321
- *
1322
- * Unless required by applicable law or agreed to in writing, software
1323
- * distributed under the License is distributed on an "AS IS" BASIS,
1324
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1325
- * See the License for the specific language governing permissions and
1326
- * limitations under the License.
1327
- */const U1=new Po(3e4,6e4);function ju(){const e=fr().___jsl;if(e!=null&&e.H){for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let n=0;n<e.CP.length;n++)e.CP[n]=null}}function H1(e){return new Promise((t,n)=>{var s,o,i;function r(){ju(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{ju(),n(Kn(e,"network-request-failed"))},timeout:U1.get()})}if((o=(s=fr().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=fr().gapi)!=null&&i.load)r();else{const a=KE("iframefcb");return fr()[a]=()=>{gapi.load?r():n(Kn(e,"network-request-failed"))},GE(`${qE()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw Zo=null,t})}let Zo=null;function V1(e){return Zo=Zo||H1(e),Zo}/**
1328
- * @license
1329
- * Copyright 2020 Google LLC.
1330
- *
1331
- * Licensed under the Apache License, Version 2.0 (the "License");
1332
- * you may not use this file except in compliance with the License.
1333
- * You may obtain a copy of the License at
1334
- *
1335
- * http://www.apache.org/licenses/LICENSE-2.0
1336
- *
1337
- * Unless required by applicable law or agreed to in writing, software
1338
- * distributed under the License is distributed on an "AS IS" BASIS,
1339
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1340
- * See the License for the specific language governing permissions and
1341
- * limitations under the License.
1342
- */const W1=new Po(5e3,15e3),z1="__/auth/iframe",G1="emulator/auth/iframe",q1={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},K1=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function J1(e){const t=e.config;Ye(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Cl(t,G1):`https://${e.config.authDomain}/${z1}`,r={apiKey:t.apiKey,appName:e.name,v:xo},s=K1.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Ao(r).slice(1)}`}async function Y1(e){const t=await V1(e),n=fr().gapi;return Ye(n,e,"internal-error"),t.open({where:document.body,url:J1(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:q1,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=Kn(e,"network-request-failed"),a=fr().setTimeout(()=>{o(i)},W1.get());function l(){fr().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
1343
- * @license
1344
- * Copyright 2020 Google LLC.
1345
- *
1346
- * Licensed under the Apache License, Version 2.0 (the "License");
1347
- * you may not use this file except in compliance with the License.
1348
- * You may obtain a copy of the License at
1349
- *
1350
- * http://www.apache.org/licenses/LICENSE-2.0
1351
- *
1352
- * Unless required by applicable law or agreed to in writing, software
1353
- * distributed under the License is distributed on an "AS IS" BASIS,
1354
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1355
- * See the License for the specific language governing permissions and
1356
- * limitations under the License.
1357
- */const Q1={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},X1=500,Z1=600,eC="_blank",tC="http://localhost";class Bu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function nC(e,t,n,r=X1,s=Z1){const o=Math.max((window.screen.availHeight-s)/2,0).toString(),i=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const l={...Q1,width:r.toString(),height:s.toString(),top:o,left:i},d=bn().toLowerCase();n&&(a=oh(d)?eC:n),rh(d)&&(t=t||tC,l.scrollbars="yes");const c=Object.entries(l).reduce((b,[T,N])=>`${b}${T}=${N},`,"");if(jE(d)&&a!=="_self")return rC(t||"",a),new Bu(null);const h=window.open(t||"",a,c);Ye(h,e,"popup-blocked");try{h.focus()}catch{}return new Bu(h)}function rC(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
1358
- * @license
1359
- * Copyright 2021 Google LLC
1360
- *
1361
- * Licensed under the Apache License, Version 2.0 (the "License");
1362
- * you may not use this file except in compliance with the License.
1363
- * You may obtain a copy of the License at
1364
- *
1365
- * http://www.apache.org/licenses/LICENSE-2.0
1366
- *
1367
- * Unless required by applicable law or agreed to in writing, software
1368
- * distributed under the License is distributed on an "AS IS" BASIS,
1369
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1370
- * See the License for the specific language governing permissions and
1371
- * limitations under the License.
1372
- */const sC="__/auth/handler",oC="emulator/auth/handler",iC=encodeURIComponent("fac");async function Fu(e,t,n,r,s,o){Ye(e.config.authDomain,e,"auth-domain-config-required"),Ye(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:xo,eventId:s};if(t instanceof Ml){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",rI(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[c,h]of Object.entries({}))i[c]=h}if(t instanceof Ro){const c=t.getScopes().filter(h=>h!=="");c.length>0&&(i.scopes=c.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];const l=await e._getAppCheckToken(),d=l?`#${iC}=${encodeURIComponent(l)}`:"";return`${aC(e)}?${Ao(a).slice(1)}${d}`}function aC({config:e}){return e.emulator?Cl(e,oC):`https://${e.authDomain}/${sC}`}/**
1373
- * @license
1374
- * Copyright 2020 Google LLC
1375
- *
1376
- * Licensed under the Apache License, Version 2.0 (the "License");
1377
- * you may not use this file except in compliance with the License.
1378
- * You may obtain a copy of the License at
1379
- *
1380
- * http://www.apache.org/licenses/LICENSE-2.0
1381
- *
1382
- * Unless required by applicable law or agreed to in writing, software
1383
- * distributed under the License is distributed on an "AS IS" BASIS,
1384
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1385
- * See the License for the specific language governing permissions and
1386
- * limitations under the License.
1387
- */const ha="webStorageSupport";class lC{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=yh,this._completeRedirectFn=M1,this._overrideRedirectResult=x1}async _openPopup(t,n,r,s){var i;$r((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Fu(t,n,r,Wa(),s);return nC(t,o,$l())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Fu(t,n,r,Wa(),s);return d1(o),new Promise(()=>{})}_initialize(t){const n=t._key();if(this.eventManagers[n]){const{manager:s,promise:o}=this.eventManagers[n];return s?Promise.resolve(s):($r(o,"If manager is not set, promise should be"),o)}const r=this.initAndGetManager(t);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(t){const n=await Y1(t),r=new O1(t);return n.register("authEvent",s=>(Ye(s==null?void 0:s.authEvent,t,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:r},this.iframes[t._key()]=n,r}_isIframeWebStorageSupported(t,n){this.iframes[t._key()].send(ha,{type:ha},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[ha];o!==void 0&&n(!!o),hr(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=B1(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return uh()||sh()||Pl()}}const cC=lC;var Uu="@firebase/auth",Hu="1.12.2";/**
1388
- * @license
1389
- * Copyright 2020 Google LLC
1390
- *
1391
- * Licensed under the Apache License, Version 2.0 (the "License");
1392
- * you may not use this file except in compliance with the License.
1393
- * You may obtain a copy of the License at
1394
- *
1395
- * http://www.apache.org/licenses/LICENSE-2.0
1396
- *
1397
- * Unless required by applicable law or agreed to in writing, software
1398
- * distributed under the License is distributed on an "AS IS" BASIS,
1399
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1400
- * See the License for the specific language governing permissions and
1401
- * limitations under the License.
1402
- */class uC{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),((t=this.auth.currentUser)==null?void 0:t.uid)||null}async getToken(t){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(t)}:null}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const n=this.auth.onIdTokenChanged(r=>{t((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(t,n),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const n=this.internalListeners.get(t);n&&(this.internalListeners.delete(t),n(),this.updateProactiveRefresh())}assertAuthConfigured(){Ye(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1403
- * @license
1404
- * Copyright 2020 Google LLC
1405
- *
1406
- * Licensed under the Apache License, Version 2.0 (the "License");
1407
- * you may not use this file except in compliance with the License.
1408
- * You may obtain a copy of the License at
1409
- *
1410
- * http://www.apache.org/licenses/LICENSE-2.0
1411
- *
1412
- * Unless required by applicable law or agreed to in writing, software
1413
- * distributed under the License is distributed on an "AS IS" BASIS,
1414
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1415
- * See the License for the specific language governing permissions and
1416
- * limitations under the License.
1417
- */function dC(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function fC(e){_o(new Ls("auth",(t,{options:n})=>{const r=t.getProvider("app").getImmediate(),s=t.getProvider("heartbeat"),o=t.getProvider("app-check-internal"),{apiKey:i,authDomain:a}=r.options;Ye(i&&!i.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:i,authDomain:a,clientPlatform:e,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:dh(e)},d=new WE(r,s,o,l);return YE(d,n),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),_o(new Ls("auth-internal",t=>{const n=Ri(t.getProvider("auth").getImmediate());return(r=>new uC(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),xs(Uu,Hu,dC(e)),xs(Uu,Hu,"esm2020")}/**
1418
- * @license
1419
- * Copyright 2021 Google LLC
1420
- *
1421
- * Licensed under the Apache License, Version 2.0 (the "License");
1422
- * you may not use this file except in compliance with the License.
1423
- * You may obtain a copy of the License at
1424
- *
1425
- * http://www.apache.org/licenses/LICENSE-2.0
1426
- *
1427
- * Unless required by applicable law or agreed to in writing, software
1428
- * distributed under the License is distributed on an "AS IS" BASIS,
1429
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1430
- * See the License for the specific language governing permissions and
1431
- * limitations under the License.
1432
- */const hC=300,pC=Uf("authIdTokenMaxAge")||hC;let Vu=null;const mC=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>pC)return;const s=n==null?void 0:n.token;Vu!==s&&(Vu=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function gC(e=qf()){const t=zf(e,"auth");if(t.isInitialized())return t.getImmediate();const n=JE(e,{popupRedirectResolver:cC,persistence:[b1,l1,yh]}),r=Uf("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=mC(o.toString());o1(n,i,()=>i(n.currentUser)),s1(n,a=>i(a))}}const s=zS("auth");return s&&QE(n,`http://${s}`),n}function vC(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}zE({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=Kn("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",vC().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});fC("Browser");const yC={apiKey:"AIzaSyAf0CIHBZ-wEQJ8CCUUWo1Wl9P7typ_ZPI",authDomain:"gptcall-416910.firebaseapp.com",projectId:"gptcall-416910",storageBucket:"gptcall-416910.appspot.com",messagingSenderId:"99275526699",appId:"1:99275526699:web:3b623e1e2996108b52106e"};function wC(e){const t=D(null),n=D(""),r=D(""),s=D(""),o=D({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=pe(()=>s.value==="pull"),a=pe(()=>s.value==="push"),l=pe(()=>s.value!=="");async function d(){try{const O=await fetch("/codex-api/skills-sync/status");if(!O.ok)return;const J=await O.json();J.data&&(o.value=J.data)}catch{}}async function c(){try{const O=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),J=await O.json();if(!O.ok||!J.data)throw new Error("Failed to start GitHub login");t.value=J.data;const oe=30,L=Math.max((J.data.interval??5)*1e3,3e3);let ne=!1;for(let te=0;te<oe;te++){await new Promise(me=>setTimeout(me,L));const be=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:J.data.device_code})}),ce=await be.json();if(!be.ok)throw new Error(ce.error||"Failed to complete GitHub login");if(ce.ok){ne=!0;break}if(!ce.pending)throw new Error(ce.error||"Failed to complete GitHub login")}if(!ne)throw new Error("GitHub login timed out. Please retry.");t.value=null,await d(),e.showToast("GitHub login successful")}catch(O){e.showToast(O instanceof Error?O.message:"Failed GitHub login","error")}}async function h(){try{const O=iE().length>0?qf():Gf(yC),J=gC(O),oe=new cr;oe.addScope("repo");const L=await I1(J,oe),ne=cr.credentialFromResult(L),te=(ne==null?void 0:ne.accessToken)??"";if(!te)throw new Error("GitHub access token missing from Firebase login");const be=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:te})}),ce=await be.json();if(!be.ok||!ce.ok)throw new Error(ce.error||"Failed to login with GitHub token");await d(),e.showToast("GitHub login successful")}catch(O){const J=O instanceof Error?O.message:"Failed Firebase GitHub login";e.showToast(J,"error")}}async function b(){r.value="",n.value="pull-started",s.value="pull";try{const O=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),J=await O.json();if(!O.ok||!J.ok)throw new Error(J.error||"Failed to pull synced skills");await e.onPulled(),n.value="pull-success",e.showToast(o.value.loggedIn?"Pulled skills from private sync repo":"Pulled skills from upstream repo")}catch(O){const J=O instanceof Error?O.message:"Failed to pull sync";r.value=J,n.value="pull-failed",e.showToast(J,"error")}finally{s.value=""}}async function T(){r.value="",n.value="push-started",s.value="push";try{const O=await fetch("/codex-api/skills-sync/push",{method:"POST"}),J=await O.json();if(!O.ok||!J.ok)throw new Error(J.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(O){const J=O instanceof Error?O.message:"Failed to push sync";r.value=J,n.value="push-failed",e.showToast(J,"error")}finally{s.value=""}}async function N(){try{const O=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),J=await O.json();if(!O.ok||!J.ok)throw new Error(J.error||"Failed to logout GitHub");await d(),e.showToast("Logged out from GitHub")}catch(O){e.showToast(O instanceof Error?O.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:d,logoutGithub:N,pullSkillsSync:b,pushSkillsSync:T,startGithubFirebaseLogin:h,startGithubLogin:c,syncActionError:r,syncActionStatus:n,syncStatus:o}}const bC={class:"skills-hub"},_C={class:"skills-sync-panel"},kC={class:"skills-sync-header"},TC={key:0,class:"skills-sync-badge"},SC={key:1,class:"skills-sync-badge"},IC={key:2,class:"skills-sync-badge"},EC={class:"skills-sync-meta"},CC={key:0,class:"skills-sync-error"},AC={key:1,class:"skills-sync-meta"},xC={key:2,class:"skills-sync-error"},PC={key:3,class:"skills-sync-device"},RC=["href"],MC={class:"skills-sync-actions"},$C=["disabled"],OC=["disabled"],NC=["disabled"],DC={key:1,class:"skills-hub-section"},LC={class:"skills-hub-section-title"},jC={key:0,class:"skills-hub-grid"},BC={class:"skills-hub-toolbar"},FC={class:"skills-hub-search-wrap"},UC={key:0,class:"skills-hub-count"},HC={class:"skills-hub-section"},VC={key:0,class:"skills-hub-loading"},WC={key:1,class:"skills-hub-error"},zC={key:0,class:"skills-hub-grid"},GC={key:1,class:"skills-hub-empty"},Bo="codex-web-local.skills-hub.cache.v1",qC=Xt({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=D(null),s=D(""),o=D("date"),i=D([]),a=D([]),l=D(0),d=D(!1),c=D(""),h=D(!0),b=D(!1),T=D(n),N=D(null),O=D(""),J=D(!1),oe=D(!1);let L=null,ne=null;const te=t,be=pe(()=>o.value==="date"?"Newest":"A-Z"),ce=pe(()=>{var R;return((R=N.value)==null?void 0:R.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),me=pe(()=>`${T.value.owner}/${T.value.name}`),Oe=pe(()=>J.value&&O.value===me.value),ae=pe(()=>oe.value&&O.value===me.value),Q=pe(()=>{const R=s.value.toLowerCase().trim();return R?a.value.filter(H=>H.name.toLowerCase().includes(R)||H.owner.toLowerCase().includes(R)||(H.displayName??"").toLowerCase().includes(R)):a.value});function le(R,H="success"){N.value={text:R,type:H},ne&&clearTimeout(ne),ne=setTimeout(()=>{N.value=null},3e3)}function ee(){o.value=o.value==="date"?"name":"date",Ae(s.value)}function Pe(R){return`${o.value}::${R.trim().toLowerCase()}`}function Ne(R){var H;if(typeof window>"u")return null;try{const U=window.localStorage.getItem(Bo);return U?((H=JSON.parse(U).byKey)==null?void 0:H[R])??null:null}catch{return null}}function qe(R,H){if(!(typeof window>"u"))try{const U=window.localStorage.getItem(Bo),G=(U?JSON.parse(U):{}).byKey??{};G[R]=H,window.localStorage.setItem(Bo,JSON.stringify({byKey:G}))}catch{}}function He(){if(!(typeof window>"u"))try{window.localStorage.removeItem(Bo)}catch{}}function Fe(R){const H=R.installed??[];a.value=H;const U=new Set(H.map(z=>z.name));i.value=R.data.map(z=>{if(z.installed||U.has(z.name)){const G=H.find(Te=>Te.name===z.name);return{...z,installed:!0,path:(G==null?void 0:G.path)??z.path,enabled:(G==null?void 0:G.enabled)??z.enabled}}return z}).filter(z=>!z.installed),l.value=R.total}async function Ae(R){const H=Pe(R),U=Ne(H);U&&Fe(U),d.value=!U,c.value="";try{const z=new URLSearchParams;R.trim()&&z.set("q",R.trim()),z.set("limit","100"),z.set("sort",o.value);const G=await fetch(`/codex-api/skills-hub?${z}`);if(!G.ok)throw new Error(`HTTP ${G.status}`);const Te=await G.json();Fe(Te),qe(H,Te)}catch(z){c.value=z instanceof Error?z.message:"Failed to load skills"}finally{d.value=!1}}function rt(){L&&clearTimeout(L),L=setTimeout(()=>Ae(s.value),300)}function ze(R){T.value=R,b.value=!0}async function Be(R){O.value=`${R.owner}/${R.name}`,J.value=!0;try{const U=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:R.owner,name:R.name})})).json();if(!U.ok)throw new Error(U.error||"Install failed");const z={...R,installed:!0,path:U.path,enabled:!0};a.value=[...a.value,z],i.value=i.value.filter(G=>G.name!==R.name),T.value=z,le(`${R.displayName||R.name} skill installed`),b.value=!1,He(),te("skills-changed")}catch(H){le(H instanceof Error?H.message:"Failed to install skill","error")}finally{J.value=!1}}async function lt(R){O.value=`${R.owner}/${R.name}`,oe.value=!0;try{const U=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:R.name,path:R.path})})).json();if(!U.ok)throw new Error(U.error||"Uninstall failed");a.value=a.value.filter(z=>z.name!==R.name),R.owner!=="local"&&(i.value=[...i.value,{...R,installed:!1,path:void 0,enabled:void 0}]),le(`${R.displayName||R.name} skill uninstalled`),b.value=!1,He(),te("skills-changed")}catch(H){le(H instanceof Error?H.message:"Failed to uninstall skill","error")}finally{oe.value=!1}}async function Dt(R,H){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:R.path,enabled:H}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),le(`${R.displayName||R.name} skill ${H?"enabled":"disabled"}`),await Ae(s.value)}catch(U){le(U instanceof Error?U.message:"Failed to update skill","error")}}const{deviceLogin:it,isPullInFlight:ct,isPushInFlight:Ve,isSyncActionInFlight:V,loadSyncStatus:we,logoutGithub:he,pullSkillsSync:Ce,pushSkillsSync:xe,startGithubFirebaseLogin:k,startGithubLogin:I,syncActionError:M,syncActionStatus:K,syncStatus:F}=wC({showToast:le,onPulled:async()=>{await Ae(s.value),te("skills-changed")}});return Nr(()=>{Ae(""),we()}),(R,H)=>(m(),w("div",bC,[H[11]||(H[11]=y("div",{class:"skills-hub-header"},[y("h2",{class:"skills-hub-title"},"Skills Hub"),y("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),y("div",_C,[y("div",kC,[H[8]||(H[8]=y("strong",null,"Skills Sync (GitHub)",-1)),ye(F).configured?(m(),w("span",TC,"Connected: "+W(ye(F).repoOwner)+"/"+W(ye(F).repoName),1)):ye(F).loggedIn?(m(),w("span",SC,"Logged in as "+W(ye(F).githubUsername),1)):(m(),w("span",IC,"Not connected"))]),y("div",EC,[y("span",null,"Startup: "+W(ye(F).startup.mode),1),y("span",null,"Branch: "+W(ye(F).startup.branch),1),y("span",null,"Action: "+W(ye(F).startup.lastAction),1)]),ye(F).startup.lastError?(m(),w("div",CC,W(ye(F).startup.lastError),1)):ue("",!0),ye(K)?(m(),w("div",AC,[y("span",null,"Manual sync: "+W(ye(K)),1)])):ue("",!0),ye(M)?(m(),w("div",xC,W(ye(M)),1)):ue("",!0),ye(it)?(m(),w("div",PC,[y("span",null,[H[9]||(H[9]=mo("Open ",-1)),y("a",{href:ye(it).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,RC),H[10]||(H[10]=mo(" and enter code:",-1))]),y("code",null,W(ye(it).user_code),1)])):ue("",!0),y("div",MC,[ye(F).loggedIn?ue("",!0):(m(),w("button",{key:0,class:"skills-hub-sort",type:"button",onClick:H[0]||(H[0]=(...U)=>ye(k)&&ye(k)(...U))},"Login with GitHub")),ye(F).loggedIn?ue("",!0):(m(),w("button",{key:1,class:"skills-hub-sort",type:"button",onClick:H[1]||(H[1]=(...U)=>ye(I)&&ye(I)(...U))},"Device Login")),ye(F).loggedIn?(m(),w("button",{key:2,class:"skills-hub-sort",type:"button",onClick:H[2]||(H[2]=(...U)=>ye(he)&&ye(he)(...U)),disabled:ye(V)},"Logout GitHub",8,$C)):ue("",!0),y("button",{class:"skills-hub-sort",type:"button",onClick:H[3]||(H[3]=(...U)=>ye(Ce)&&ye(Ce)(...U)),disabled:ye(V)},W(ye(ct)?"Pulling...":"Pull"),9,OC),ye(F).loggedIn?(m(),w("button",{key:3,class:"skills-hub-sort",type:"button",onClick:H[4]||(H[4]=(...U)=>ye(xe)&&ye(xe)(...U)),disabled:!ye(F).configured||ye(V)},W(ye(Ve)?"Pushing...":"Push"),9,NC)):ue("",!0)])]),N.value?(m(),w("div",{key:0,class:ft(["skills-hub-toast",ce.value])},W(N.value.text),3)):ue("",!0),Q.value.length>0?(m(),w("div",DC,[y("button",{class:"skills-hub-section-toggle",type:"button",onClick:H[5]||(H[5]=U=>h.value=!h.value)},[y("span",LC,"Installed ("+W(Q.value.length)+")",1),De(xf,{class:ft(["skills-hub-section-chevron",{"is-open":h.value}])},null,8,["class"])]),h.value?(m(),w("div",jC,[(m(!0),w($e,null,dt(Q.value,U=>(m(),mt(gu,{key:U.name,skill:U,onSelect:z=>ze(z)},null,8,["skill","onSelect"]))),128))])):ue("",!0)])):ue("",!0),y("div",BC,[y("div",FC,[De(ja,{class:"skills-hub-search-icon"}),Pr(y("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":H[6]||(H[6]=U=>s.value=U),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:rt},null,544),[[Rr,s.value]]),l.value>0?(m(),w("span",UC,W(l.value)+" skills",1)):ue("",!0)]),y("button",{class:"skills-hub-sort",type:"button",onClick:ee},W(be.value),1)]),y("div",HC,[d.value?(m(),w("div",VC,"Loading skills...")):c.value?(m(),w("div",WC,W(c.value),1)):(m(),w($e,{key:2},[i.value.length>0?(m(),w("div",zC,[(m(!0),w($e,null,dt(i.value,U=>(m(),mt(gu,{key:U.url,skill:U,onSelect:z=>ze(z)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(m(),w("div",GC,'No skills found for "'+W(s.value)+'"',1)):ue("",!0)],64))]),De(DS,{skill:T.value,visible:b.value,"is-installing":Oe.value,"is-uninstalling":ae.value,onClose:H[7]||(H[7]=U=>b.value=!1),onInstall:Be,onUninstall:lt,onToggleEnabled:Dt},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),KC=ht(qC,[["__scopeId","data-v-2f6920be"]]),JC={},YC={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function QC(e,t){return m(),w("svg",YC,[...t[0]||(t[0]=[y("path",{d:"M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12"},null,-1),y("path",{d:"M9 4l0 16"},null,-1)])])}const XC=ht(JC,[["render",QC]]),ZC={},eA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function tA(e,t){return m(),w("svg",eA,[...t[0]||(t[0]=[y("path",{d:"M6 21a3 3 0 0 1 -3 -3v-12a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3zm12 -16h-8v14h8a1 1 0 0 0 1 -1v-12a1 1 0 0 0 -1 -1"},null,-1)])])}const nA=ht(ZC,[["render",tA]]),rA={class:"sidebar-thread-controls"},sA=["aria-label","title"],oA=Xt({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(m(),w("div",rA,[y("button",{class:"sidebar-thread-controls-button",type:"button","aria-label":e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",title:e.isSidebarCollapsed?"Expand sidebar":"Collapse sidebar",onClick:n[0]||(n[0]=r=>t.$emit("toggle-sidebar"))},[e.isSidebarCollapsed?(m(),mt(nA,{key:0,class:"sidebar-thread-controls-icon"})):(m(),mt(XC,{key:1,class:"sidebar-thread-controls-icon"}))],8,sA),ur(t.$slots,"default",{},void 0),e.showNewThreadButton?(m(),w("button",{key:0,class:"sidebar-thread-controls-button",type:"button","aria-label":"Start new thread",title:"Start new thread",onClick:n[1]||(n[1]=r=>t.$emit("start-new-thread"))},[De(li,{class:"sidebar-thread-controls-icon"})])):ue("",!0)]))}}),Wu=ht(oA,[["__scopeId","data-v-46a10052"]]),iA={},aA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function lA(e,t){return m(),w("svg",aA,[...t[0]||(t[0]=[y("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[y("path",{d:"M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 0 0-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 0 0-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 0 0-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 0 0-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 0 0 1.066-2.573c-.94-1.543.826-3.31 2.37-2.37c1 .608 2.296.07 2.572-1.065"}),y("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const cA=ht(iA,[["render",lA]]);function Vr(e){return e.flatMap(t=>t.threads)}const Eh="codex-web-local.thread-read-state.v1",Ch="codex-web-local.thread-scroll-state.v1",qa="codex-web-local.selected-thread-id.v1",Ah="codex-web-local.project-order.v1",xh="codex-web-local.project-display-name.v1",Ph="codex-web-local.collaboration-mode.v1",pa=220,zu=["none","minimal","low","medium","high","xhigh"],ys="__global__",Ln="gpt-5.2-codex";function uA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Eh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Gu(e){typeof window>"u"||window.localStorage.setItem(Eh,JSON.stringify(e))}function dA(){return typeof window>"u"?"default":window.localStorage.getItem(Ph)==="plan"?"plan":"default"}function fA(e){typeof window>"u"||window.localStorage.setItem(Ph,e)}function Rh(e,t,n){return Math.min(Math.max(e,t),n)}function hA(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e;if(typeof t.scrollTop!="number"||!Number.isFinite(t.scrollTop)||typeof t.isAtBottom!="boolean")return null;const n={scrollTop:Math.max(0,t.scrollTop),isAtBottom:t.isAtBottom};return typeof t.scrollRatio=="number"&&Number.isFinite(t.scrollRatio)&&(n.scrollRatio=Rh(t.scrollRatio,0,1)),n}function pA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Ch);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t)){if(!r)continue;const o=hA(s);o&&(n[r]=o)}return n}catch{return{}}}function qu(e){typeof window>"u"||window.localStorage.setItem(Ch,JSON.stringify(e))}function mA(){return typeof window>"u"?"":window.localStorage.getItem(qa)??""}function gA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(qa);return}window.localStorage.setItem(qa,e)}}function vA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Ah);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&!n.includes(r)&&n.push(r);return n}catch{return[]}}function ws(e){typeof window>"u"||window.localStorage.setItem(Ah,JSON.stringify(e))}function yA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(xh);if(!e)return{};const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))return{};const n={};for(const[r,s]of Object.entries(t))typeof r=="string"&&r.length>0&&typeof s=="string"&&(n[r]=s);return n}catch{return{}}}function ma(e){typeof window>"u"||window.localStorage.setItem(xh,JSON.stringify(e))}function Fo(e,t){const n=[];for(const r of e)n.includes(r)||n.push(r);for(const r of t)n.includes(r.projectName)||n.push(r.projectName);return cs(e,n)?e:n}function ga(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??{projectName:s,threads:[]});for(const s of e)t.includes(s.projectName)||r.push(s);return r}function cs(e,t){const n=Array.isArray(e)?e:[],r=Array.isArray(t)?t:[];if(n.length!==r.length)return!1;for(let s=0;s<n.length;s+=1)if(n[s]!==r[s])return!1;return!0}function wA(e,t,n){if(t<0||t>=e.length||n<0||n>=e.length||t===n)return e;const r=[...e],[s]=r.splice(t,1);return r.splice(n,0,s),r}function bA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function _A(e=[],t=[]){var n,r,s,o;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i+=1)if(((n=e[i])==null?void 0:n.step)!==((r=t[i])==null?void 0:r.step)||((s=e[i])==null?void 0:s.status)!==((o=t[i])==null?void 0:o.status))return!1;return!0}function kA(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&_A(e.steps,t.steps)}function Uo(e){if(!(e instanceof Error))return!1;const t=e.message.toLowerCase();return t.includes("not supported when using codex with a chatgpt account")||t.includes("model is not supported")}function Ka(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&cs(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&bA(e.commandExecution,t.commandExecution)&&kA(e.plan,t.plan)&&e.turnIndex===t.turnIndex}function ao(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function TA(e,t,n={}){const r=new Map(e.map(c=>[c.id,c])),s=new Map(t.map(c=>[c.id,c])),o=t.map(c=>{const h=r.get(c.id);return h&&Ka(h,c)?h:c});if(n.preserveMissing!==!0)return ao(e,o)?e:o;const i=e.map(c=>{const h=s.get(c.id);return!h||Ka(c,h)?c:h}),a=new Set(e.map(c=>c.id)),l=o.filter(c=>!a.has(c.id)),d=[...i,...l];return ao(e,d)?e:d}function Ja(e){return e.replace(/\s+/gu," ").trim()}function SA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>Ja(s.text)).filter(s=>s.length>0));if(n.size===0)return e;const r=e.filter(s=>{if(s.messageType!=="agentMessage.live")return!0;const o=Ja(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function va(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(Ka(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Mh="worked";function Fr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function IA(e){if(!Number.isFinite(e)||e<=0)return"<1s";const t=Math.max(1,Math.round(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),s=t%60,o=[];n>0&&o.push(`${n}h`),(r>0||n>0)&&o.push(`${r}m`);const i=s>0||o.length===0?s:0;return o.push(`${i}s`),o.join(" ")}function EA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function CA(e,t){if(!e&&!t)return!0;if(!e||!t||e.label!==t.label||e.details.length!==t.details.length)return!1;for(let n=0;n<e.details.length;n+=1)if(e.details[n]!==t.details[n])return!1;return!0}function AA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${IA(e.durationMs)}`,messageType:Mh}}function xA(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function PA(e,t){const n=AA(t),r=e.filter(i=>i.messageType!==Mh),s=xA(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Qt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function RA(e,t){if(t.size===0)return e;let n=!1;const r={};for(const[s,o]of Object.entries(e)){if(t.has(s)){n=!0;continue}r[s]=o}return n?r:e}function MA(e,t){return e.id===t.id&&e.title===t.title&&e.projectName===t.projectName&&e.cwd===t.cwd&&e.createdAtIso===t.createdAtIso&&e.updatedAtIso===t.updatedAtIso&&e.preview===t.preview&&e.unread===t.unread&&e.inProgress===t.inProgress}function $A(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function OA(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function rn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Ho(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>{const o=n.get(s.projectName),i=new Map((o==null?void 0:o.threads.map(l=>[l.id,l]))??[]),a=s.threads.map(l=>{const d=i.get(l.id);return d&&MA(d,l)?d:l});return o&&o.projectName===s.projectName&&$A(o.threads,a)?o:{projectName:s.projectName,threads:a}});return OA(e,r)?e:r}function NA(e,t,n){const r=new Set(Vr(t).map(a=>a.id)),s=Vr(e).filter(a=>n[a.id]===!0&&!r.has(a.id));if(s.length===0)return t;const o=new Map(t.map(a=>[a.projectName,a])),i=t.map(a=>({projectName:a.projectName,threads:[...a.threads]}));for(const a of s){if(o.get(a.projectName)){const d=i.findIndex(c=>c.projectName===a.projectName);d>=0&&(i[d]={projectName:i[d].projectName,threads:[a,...i[d].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function DA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function bs(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function LA(e){const t=e.split(`
1433
- `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function jA(){const e=D([]),t=D([]),n=D(mA()),r=D({}),s=D({}),o=D({}),i=D({}),a=D({}),l=D({}),d=D({}),c=D({}),h=D([]),b=D([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),T=D(dA()),N=D(""),O=D("medium"),J=D(uA()),oe=D(pA()),L=D(vA()),ne=D(yA()),te=D({}),be=D({}),ce=D({}),me=D({}),Oe=D({}),ae=D({}),Q=D({}),le=D({}),ee=D({}),Pe=D(null),Ne=D({}),qe=D([]),He=D(!1),Fe=D(!1),Ae=D(!1),rt=D(!1),ze=D(!1),Be=D(""),lt=D(!1),Dt=D(!1);let it=null,ct=null,Ve=!1;const V=new Set;let we=!1,he=!1;const Ce=new Map,xe=new Set,k=pe(()=>Vr(e.value)),I=pe(()=>k.value.find(u=>u.id===n.value)??null),M=pe(()=>oe.value[n.value]??null),K=pe(()=>{const u=[],f=n.value;return f&&Array.isArray(le.value[f])&&u.push(...le.value[f]),Array.isArray(le.value[ys])&&u.push(...le.value[ys]),u.sort((_,E)=>_.receivedAtIso.localeCompare(E.receivedAtIso))}),F=pe(()=>{var Y;const u=n.value;if(!u)return null;const f=Oe.value[u],_=(i.value[u]??"").trim(),E=(((Y=ae.value[u])==null?void 0:Y.message)??"").trim();return!f&&!_&&!E?null:{activityLabel:(f==null?void 0:f.label)||"Thinking",activityDetails:(f==null?void 0:f.details)??[],reasoningText:_,errorText:E}}),R=pe(()=>Pe.value),H=pe(()=>{const u=n.value;if(!u)return[];const f=r.value[u]??[],_=s.value[u]??[],E=o.value[u]??[],Y=a.value[u]??[],se=[...f,..._,...Y,...E],de=me.value[u];return de?PA(se,de):se});function U(u){n.value!==u&&(n.value=u,gA(u),he=!1)}function z(u){N.value=u.trim()}function G(u){const f=u==="plan"?"plan":"default";T.value!==f&&(T.value=f,fA(f))}function Te(u){Pe.value=u}async function ve(){N.value=Ln,h.value.includes(Ln)||(h.value=[...h.value,Ln]);try{await Kk(Ln)}catch{}}function _e(u,f){ee.value={...ee.value,[u]:f}}function Ie(u){ee.value[u]&&(ee.value=Qt(ee.value,u))}async function Ue(u){if(xe.has(u))return;const f=ee.value[u];if(!(!f||f.fallbackRetried)){xe.add(u),_e(u,{...f,fallbackRetried:!0});try{await ve();try{const _=await cu(u,1);kn(u,_),Tn(u),jt(u,[]),tn(u),a.value[u]&&(a.value=Qt(a.value,u))}catch{}Et(u,null),Be.value="",vt(u,null),Rt(u,{label:"Thinking",details:ut(Ln,f.effort,f.collaborationMode)}),at(u,!0),ce.value[u]!==!0&&await sa(u),await oa(u,f.text,f.imageUrls,Ln,f.effort||void 0,f.skills.length>0?f.skills:void 0,f.fileAttachments,f.collaborationMode),ce.value={...ce.value,[u]:!0},V.add(u),Ve=!0,await $t()}catch(_){const E=_ instanceof Error?_.message:"Unknown application error";Et(u,E),Be.value=E,at(u,!1),Rt(u,null)}finally{xe.delete(u)}}}function tt(u){u&&!zu.includes(u)||(O.value=u)}async function Qe(){try{const u=await Yk();b.value=u,u.some(f=>f.value===T.value)||G("default")}catch{}}function ut(u,f,_=T.value){const E=u.trim()||"default",Y=f||"default";return[`Mode: ${_==="plan"?"Plan":"Default"}`,`Model: ${E}`,`Thinking: ${Y}`]}async function et(){try{const[u,f]=await Promise.all([Of(),Nf()]);h.value=u,N.value.length>0&&u.includes(N.value)||(f.model&&u.includes(f.model)?N.value=f.model:u.length>0?N.value=u[0]:N.value=""),f.reasoningEffort&&zu.includes(f.reasoningEffort)&&(O.value=f.reasoningEffort)}catch{}}function pt(u){const f=Ne.value;return Object.keys(f).length===0?u:u.map(_=>({projectName:_.projectName,threads:_.threads.map(E=>{const Y=f[E.id];return Y?{...E,title:Y}:E})}))}function Ke(){const f=pt(t.value).map(_=>({projectName:_.projectName,threads:_.threads.map(E=>{const Y=l.value[E.id]===!0,se=n.value===E.id,de=J.value[E.id],Se=c.value[E.id]===!0,ge=!se&&!Y&&(Se||de!==E.updatedAtIso);return{...E,inProgress:Y,unread:ge}})}));e.value=Ho(e.value,f)}function Ot(u,f,_){const E=new Date().toISOString(),Y=f.trim(),se=DA(Y),de={id:u,title:LA(_),projectName:se,cwd:Y,hasWorktree:Y.includes("/.codex/worktrees/")||Y.includes("/.git/worktrees/"),createdAtIso:E,updatedAtIso:E,preview:_,unread:!1,inProgress:!1},Se=t.value.findIndex(ot=>ot.projectName===se);if(Se>=0){const Nt=t.value[Se].threads.filter(Zr=>Zr.id!==u),Yt={projectName:se,threads:[de,...Nt]},Wn=[...t.value];Wn.splice(Se,1,Yt),t.value=Wn}else t.value=[{projectName:se,threads:[de]},...t.value];const ge=Fo(L.value,t.value);cs(L.value,ge)||(L.value=ge,ws(L.value)),Ke()}function dn(u){const f=new Set(u.map(se=>se.id)),_=rn(J.value,f);_!==J.value&&(J.value=_,Gu(_));const E=rn(oe.value,f);E!==oe.value&&(oe.value=E,qu(E)),be.value=rn(be.value,f),te.value=rn(te.value,f),ce.value=rn(ce.value,f),r.value=rn(r.value,f),o.value=rn(o.value,f),i.value=rn(i.value,f),a.value=rn(a.value,f),me.value=rn(me.value,f),Oe.value=rn(Oe.value,f),ae.value=rn(ae.value,f),Q.value=rn(Q.value,f),c.value=rn(c.value,f),l.value=rn(l.value,f);const Y={};for(const[se,de]of Object.entries(le.value))(se===ys||f.has(se))&&(Y[se]=de);le.value=Y}function st(u){const f=Vr(t.value).find(_=>_.id===u);f&&(J.value={...J.value,[u]:f.updatedAtIso},Gu(J.value),c.value[u]&&(c.value=Qt(c.value,u)),Ke())}function vt(u,f){if(!u)return;const _=me.value[u];if(f){if(EA(_,f))return;me.value={...me.value,[u]:f}}else _&&(me.value=Qt(me.value,u))}function at(u,f){!u||l.value[u]===!0===f||(f?l.value={...l.value,[u]:!0}:l.value=Qt(l.value,u),Ke())}function Vt(u){u&&u!==n.value&&c.value[u]!==!0&&(c.value={...c.value,[u]:!0},Ke())}function Rt(u,f){if(!u)return;const _=Oe.value[u];if(!f){_&&(Oe.value=Qt(Oe.value,u));return}const E=xn(f.label)||"Thinking",Y=f.details.map(Se=>xn(Se)).filter(Se=>Se.length>0&&Se!==E),se=Array.from(new Set([...(_==null?void 0:_.details)??[],...Y])).slice(-3),de={label:E,details:se};CA(_,de)||(Oe.value={...Oe.value,[u]:de})}function Et(u,f){if(!u)return;const _=ae.value[u],E=f?Ja(f):"";if(!E){_&&(ae.value=Qt(ae.value,u));return}(_==null?void 0:_.message)!==E&&(ae.value={...ae.value,[u]:{message:E}})}function Bn(u){const f=Vr(t.value).find(_=>_.id===u);return(f==null?void 0:f.updatedAtIso)??""}function _n(u,f){if(!u)return;const _={scrollTop:Math.max(0,f.scrollTop),isAtBottom:f.isAtBottom===!0};typeof f.scrollRatio=="number"&&Number.isFinite(f.scrollRatio)&&(_.scrollRatio=Rh(f.scrollRatio,0,1));const E=oe.value[u];E&&E.scrollTop===_.scrollTop&&E.isAtBottom===_.isAtBottom&&E.scrollRatio===_.scrollRatio||(oe.value={...oe.value,[u]:_},qu(oe.value))}function kn(u,f){const _=r.value[u]??[];ao(_,f)||(r.value={...r.value,[u]:f})}function jt(u,f){const _=o.value[u]??[];ao(_,f)||(o.value={...o.value,[u]:f})}function Wt(u,f){const _=s.value[u]??[];ao(_,f)||(s.value={...s.value,[u]:f})}function fn(u,f){const _=s.value[u]??[],E=va(_,f);Wt(u,E)}function Mn(u,f){const _=o.value[u]??[],E=va(_,f);jt(u,E)}function $n(u,f){if(!u)return;const _=f.trim(),E=i.value[u]??"";if(_.length===0){if(!E)return;i.value=Qt(i.value,u);return}E!==_&&(i.value={...i.value,[u]:_})}function Fn(u,f){if(!u)return;const _=i.value[u]??"";$n(u,`${_}${f}`)}function tn(u){u&&u in i.value&&(i.value=Qt(i.value,u))}function Tn(u){u&&u in s.value&&(s.value=Qt(s.value,u))}function Un(u){return u==="completed"?"completed":u==="inProgress"||u==="in_progress"?"inProgress":"pending"}function pr(u){var _;const f=[];(_=u.explanation)!=null&&_.trim()&&f.push(u.explanation.trim());for(const E of u.steps){const Y=E.status==="completed"?"x":E.status==="inProgress"?"~":" ";f.push(`- [${Y}] ${E.step}`)}return f.join(`
1434
- `).trim()}function mr(u){if(u.method!=="turn/plan/updated")return null;const f=Le(u.params),_=Bt(u),E=Re(f==null?void 0:f.turnId)||Re(f==null?void 0:f.turn_id),se=(Array.isArray(f==null?void 0:f.plan)?f==null?void 0:f.plan:[]).map(ge=>Le(ge)).map(ge=>({step:Re(ge==null?void 0:ge.step),status:Un(ge==null?void 0:ge.status)})).filter(ge=>ge.step.length>0);if(!_||!E)return null;const Se={explanation:Re(f==null?void 0:f.explanation).trim()||void 0,steps:se,isStreaming:!0};return{threadId:_,message:{id:`${E}:plan`,role:"assistant",text:pr(Se),messageType:"plan.live",plan:Se}}}function Hn(u){if(u.method!=="item/plan/delta")return null;const f=Le(u.params),_=Bt(u),E=Re(f==null?void 0:f.turnId)||Re(f==null?void 0:f.turn_id),Y=Re(f==null?void 0:f.delta);if(!_||!E||!Y)return null;const se=`${E}:plan`,de=(s.value[_]??[]).find(ot=>ot.id===se),Se=`${(de==null?void 0:de.text)??""}${Y}`,ge=de!=null&&de.plan?{...de.plan,isStreaming:!0}:void 0;return{threadId:_,message:{id:se,role:"assistant",text:Se,messageType:"plan.live",plan:ge}}}function Le(u){return u!==null&&typeof u=="object"&&!Array.isArray(u)?u:null}function Re(u){return typeof u=="string"?u:""}function Sn(u){return typeof u=="number"&&Number.isFinite(u)?u:null}function Bt(u){const f=Le(u.params);if(!f)return"";const _=Re(f.threadId);if(_)return _;const E=Re(f.thread_id);if(E)return E;const Y=Re(f.conversationId);if(Y)return Y;const se=Re(f.conversation_id);if(se)return se;const de=Le(f.thread),Se=Re(de==null?void 0:de.id);if(Se)return Se;const ge=Le(f.turn),ot=Re(ge==null?void 0:ge.threadId);if(ot)return ot;const Nt=Re(ge==null?void 0:ge.thread_id);return Nt||""}function Cn(u){if(u.method!=="turn/completed")return"";const f=Le(u.params),_=Le(f==null?void 0:f.turn);if(!_||_.status!=="failed")return"";const E=Le(_.error);return Re(E==null?void 0:E.message)}function On(u){var _;if(u.method!=="error")return"";const f=Le(u.params);return Re(f==null?void 0:f.message)||Re((_=Le(f==null?void 0:f.error))==null?void 0:_.message)}function hn(u){const f=Le(u);if(!f)return null;const _=f.id,E=Re(f.method),Y=f.params;if(typeof _!="number"||!Number.isInteger(_)||!E)return null;const se=Le(Y),de=Re(se==null?void 0:se.threadId)||ys,Se=Re(se==null?void 0:se.turnId),ge=Re(se==null?void 0:se.itemId),ot=Re(f.receivedAtIso)||new Date().toISOString();return{id:_,method:E,threadId:de,turnId:Se,itemId:ge,receivedAtIso:ot,params:Y??null}}function zt(u){const f=u.threadId||ys,_=le.value[f]??[],E=_.findIndex(se=>se.id===u.id),Y=[..._];E>=0?Y.splice(E,1,u):Y.push(u),le.value={...le.value,[f]:Y.sort((se,de)=>se.receivedAtIso.localeCompare(de.receivedAtIso))}}function Nn(u){const f={};for(const[_,E]of Object.entries(le.value)){const Y=E.filter(se=>se.id!==u);Y.length>0&&(f[_]=Y)}le.value=f}function An(u){const f={};for(const _ of u){const E=_.threadId||ys,Y=f[E]??[];Y.push(_),f[E]=Y}for(const _ of Object.values(f))_.sort((E,Y)=>E.receivedAtIso.localeCompare(Y.receivedAtIso));le.value=f}function Zn(u){if(u.method==="server/request"){const f=hn(u.params);return f&&zt(f),!0}if(u.method==="server/request/resolved"){const f=Le(u.params),_=f==null?void 0:f.id;return typeof _=="number"&&Number.isInteger(_)&&Nn(_),!0}return!1}function xn(u){return u.replace(/\s+/gu," ").trim()}function In(u){const f=Bt(u);if(!f)return null;if(u.method==="turn/started")return{threadId:f,activity:{label:"Thinking",details:[]}};if(u.method==="item/started"){const _=Le(u.params),E=Le(_==null?void 0:_.item),Y=Re(E==null?void 0:E.type).toLowerCase();if(Y==="reasoning")return{threadId:f,activity:{label:"Thinking",details:[]}};if(Y==="agentmessage")return{threadId:f,activity:{label:"Writing response",details:[]}};if(Y==="commandexecution"){const se=Re(E==null?void 0:E.command);return{threadId:f,activity:{label:"Running command",details:se?[se]:[]}}}}return u.method==="item/commandExecution/outputDelta"?{threadId:f,activity:{label:"Running command",details:[]}}:u.method==="item/reasoning/summaryTextDelta"||u.method==="item/reasoning/summaryPartAdded"?{threadId:f,activity:{label:"Thinking",details:[]}}:u.method==="item/agentMessage/delta"?{threadId:f,activity:{label:"Writing response",details:[]}}:null}function C(u){if(u.method!=="turn/started")return null;const f=Le(u.params);if(!f)return null;const _=Bt(u);if(!_)return null;const E=Le(f.turn),Y=Re(E==null?void 0:E.id)||Re(f.turnId)||`${_}:unknown`;if(!Y)return null;const se=Fr(Re(E==null?void 0:E.startedAt))??Fr(Re(f.startedAt))??Fr(u.atIso)??Date.now();return{threadId:_,turnId:Y,startedAtMs:se}}function j(u){if(u.method!=="turn/completed")return null;const f=Le(u.params);if(!f)return null;const _=Bt(u);if(!_)return null;const E=Le(f.turn),Y=Re(E==null?void 0:E.id)||Re(f.turnId)||`${_}:unknown`;if(!Y)return null;const se=Fr(Re(E==null?void 0:E.completedAt))??Fr(Re(f.completedAt))??Fr(u.atIso)??Date.now(),de=Fr(Re(E==null?void 0:E.startedAt))??Fr(Re(f.startedAt))??void 0;return{threadId:_,turnId:Y,completedAtMs:se,startedAtMs:de}}function re(u){return`${u}:live-reasoning`}function je(u){const f=Le(u.params);if(!f)return"";if(u.method==="item/started"){const _=Le(f.item);return!_||_.type!=="reasoning"?"":Re(_.id)}return""}function g(u){const f=Le(u.params);if(!f)return null;if(u.method==="item/reasoning/summaryTextDelta"){const _=Re(f.itemId),E=Re(f.delta);return!_||!E?null:{messageId:re(_),delta:E}}return null}function p(u){const f=Le(u.params);if(!f)return"";if(u.method==="item/reasoning/summaryPartAdded"){const _=Re(f.itemId);return _?re(_):""}return""}function v(u){const f=Le(u.params);if(!f)return"";if(u.method==="item/completed"){const _=Le(f.item);return!_||_.type!=="reasoning"?"":re(Re(_.id))}return""}function P(u){const f=Le(u.params);if(!f)return"";if(u.method==="item/started"){const _=Le(f.item);return!_||_.type!=="agentMessage"?"":Re(_.id)}return""}function B(u){const f=Le(u.params);if(!f)return null;if(u.method==="item/agentMessage/delta"){const _=Re(f.itemId),E=Re(f.delta);return!_||!E?null:{messageId:_,delta:E}}return null}function q(u){const f=Le(u.params);if(!f)return null;if(u.method==="item/completed"){const _=Le(f.item);if(!_||_.type!=="agentMessage")return null;const E=Re(_.id),Y=Re(_.text);return!E||!Y?null:{id:E,role:"assistant",text:Y,messageType:"agentMessage.live"}}return null}function Ee(u){if(u.method!=="item/started")return null;const f=Le(u.params),_=Le(f==null?void 0:f.item);if(!_||_.type!=="commandExecution")return null;const E=Re(_.id),Y=Re(_.command);if(!E)return null;const se=typeof _.cwd=="string"?_.cwd:null;return{id:E,role:"system",text:Y,messageType:"commandExecution",commandExecution:{command:Y,cwd:se,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function X(u){if(u.method!=="item/commandExecution/outputDelta")return null;const f=Le(u.params);if(!f)return null;const _=Re(f.itemId),E=Re(f.delta);return!_||!E?null:{itemId:_,delta:E}}function ke(u){if(u.method!=="item/completed")return null;const f=Le(u.params),_=Le(f==null?void 0:f.item);if(!_||_.type!=="commandExecution")return null;const E=Re(_.id),Y=Re(_.command);if(!E)return null;const se=typeof _.cwd=="string"?_.cwd:null,de=Re(_.status),Se=de==="failed"?"failed":de==="declined"?"declined":de==="interrupted"?"interrupted":"completed",ge=typeof _.aggregatedOutput=="string"?_.aggregatedOutput:"",ot=typeof _.exitCode=="number"?_.exitCode:null;return{id:E,role:"system",text:Y,messageType:"commandExecution",commandExecution:{command:Y,cwd:se,status:Se,aggregatedOutput:ge,exitCode:ot}}}function fe(u,f){const _=a.value[u]??[],E=va(_,f);E!==_&&(a.value={...a.value,[u]:E})}function Je(u,f){const _=a.value[u];if(!_||_.length===0)return;const E=new Set(f.map(se=>se.id)),Y=_.filter(se=>!E.has(se.id));Y.length!==_.length&&(Y.length===0?a.value=Qt(a.value,u):a.value={...a.value,[u]:Y})}function Ft(u){if(u.method==="item/agentMessage/delta")return!0;const f=Le(u.params);if(!f)return!1;if(u.method==="item/completed"){const _=Le(f.item);return(_==null?void 0:_.type)==="agentMessage"}return!1}function Ht(u){var jl,Bl,Fl,Ul,Hl;if(Zn(u))return;if(u.method==="thread/name/updated"){const Xe=Le(u.params),tr=Re(Xe==null?void 0:Xe.threadId),es=Re(Xe==null?void 0:Xe.threadName);tr&&es&&(Ne.value={...Ne.value,[tr]:es},Ke(),ia(tr,es))}if(u.method==="account/rateLimits/updated"){Te($f(u.params));return}const f=In(u);f&&Rt(f.threadId,f.activity);const _=C(u);_&&(Ce.set(_.turnId,_),Q.value={...Q.value,[_.threadId]:_.turnId},Tn(_.threadId),vt(_.threadId,null),Et(_.threadId,null),at(_.threadId,!0),c.value[_.threadId]&&(c.value=Qt(c.value,_.threadId)));const E=j(u),Y=Cn(u),de=!!((E==null?void 0:E.threadId)??Bt(u))&&!!Y&&N.value!==Ln&&Uo(new Error(Y));if(E){const Xe=Ce.get(E.turnId);Xe&&Ce.delete(E.turnId);const tr=Sn((jl=Le(u.params))==null?void 0:jl.durationMs)??Sn((Fl=Le((Bl=Le(u.params))==null?void 0:Bl.turn))==null?void 0:Fl.durationMs)??(typeof E.startedAtMs=="number"?E.completedAtMs-E.startedAtMs:null)??(Xe?E.completedAtMs-Xe.startedAtMs:null),es=typeof tr=="number"?Math.max(0,tr):0;vt(E.threadId,{turnId:E.turnId,durationMs:es}),Q.value[E.threadId]&&(Q.value=Qt(Q.value,E.threadId)),at(E.threadId,!1),Rt(E.threadId,null),Vt(E.threadId),de||(Ie(E.threadId),Hs(E.threadId))}if(Y){const Xe=(E==null?void 0:E.threadId)||Bt(u);Xe&&Et(Xe,Y),Be.value=Y,Xe&&de&&Ue(Xe)}else E&&Et(E.threadId,null);const Se=On(u);if(Se){const Xe=Bt(u);Xe&&Et(Xe,Se),Be.value=Se,N.value!==Ln&&Uo(new Error(Se))&&(Xe?Ue(Xe):ve())}const ge=Bt(u),ot=mr(u);ot&&(fn(ot.threadId,ot.message),Rt(ot.threadId,{label:"Planning",details:((Ul=ot.message.plan)==null?void 0:Ul.steps.map(Xe=>Xe.step).slice(0,2))??[]}));const Nt=Hn(u);if(Nt&&(fn(Nt.threadId,Nt.message),Rt(Nt.threadId,{label:"Planning",details:[]})),!ge||ge!==n.value)return;P(u);const Yt=B(u);if(Yt){const Xe=(o.value[ge]??[]).find(es=>es.id===Yt.messageId),tr=`${(Xe==null?void 0:Xe.text)??""}${Yt.delta}`;Mn(ge,{id:Yt.messageId,role:"assistant",text:tr,messageType:"agentMessage.live"})}const Wn=q(u);Wn&&Mn(ge,Wn),je(u);const Zr=g(u);if(Zr&&Fn(ge,Zr.delta),p(u)){const Xe=i.value[ge]??"";Xe.trim().length>0&&!Xe.endsWith(`
1435
-
1436
- `)&&$n(ge,`${Xe}
1437
-
1438
- `)}v(u);const Ni=Ee(u);Ni&&(fe(ge,Ni),Rt(ge,{label:"Running command",details:[((Hl=Ni.commandExecution)==null?void 0:Hl.command)??""]}));const Di=X(u);if(Di){const Xe=(a.value[ge]??[]).find(tr=>tr.id===Di.itemId);Xe!=null&&Xe.commandExecution&&fe(ge,{...Xe,commandExecution:{...Xe.commandExecution,aggregatedOutput:`${Xe.commandExecution.aggregatedOutput}${Di.delta}`}})}const Ll=ke(u);if(Ll&&fe(ge,Ll),Ft(u)&&(he&&n.value&&_n(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),tn(ge)),u.method==="turn/completed"){he=!1,tn(ge),a.value[ge]&&(a.value=Qt(a.value,ge));const Xe=Bt(u);Xe&&(at(Xe,!1),Rt(Xe,null),Vt(Xe),de||(Ie(Xe),Hs(Xe)))}}function Ct(u){const f=Bt(u);f&&V.add(f);const _=u.method;(_.startsWith("thread/")||_.startsWith("turn/")||_.startsWith("item/"))&&(Ve=!0),!(ct!==null||typeof window>"u")&&(ct=window.setTimeout(()=>{ct=null,$t()},pa))}async function Gt(u){if(!we){we=!0;try{const f=await Ys(),_=[];for(const E of f.order){const Y=bs(E);_.includes(Y)||_.push(Y)}if(_.length>0){const E=Fo(_,u);cs(L.value,E)||(L.value=E,ws(L.value))}if(Object.keys(f.labels).length>0){const E={...ne.value};let Y=!1;for(const[se,de]of Object.entries(f.labels)){const Se=bs(se);E[Se]!==de&&(E[Se]=de,Y=!0)}Y&&(ne.value=E,ma(E))}}catch{}}}async function Us(){if(!(Object.keys(Ne.value).length>0))try{const u=await r0();Object.keys(u.titles).length>0&&(Ne.value=u.titles)}catch{}}async function S(u,f,_){if(Ne.value[u])return;const E=f.trim();if(!E)return;const Y=E.length>300?E.slice(0,300):E;try{const se=await s0(Y,_);if(!se||Ne.value[u])return;Ne.value={...Ne.value,[u]:se},Ke(),ia(u,se)}catch{}}async function x(){var u;Dt.value||(He.value=!0);try{const[f]=await Promise.all([Dk(),Us()]);await Gt(f);const _=Fo(L.value,f);cs(L.value,_)||(L.value=_,ws(L.value));const E=ga(f,L.value),Y=NA(t.value,E,l.value);t.value=Ho(t.value,Y),l.value=rn(l.value,new Set(Vr(t.value).map(Se=>Se.id))),Ke(),Dt.value=!0;const se=Vr(e.value);dn(se),se.some(Se=>Se.id===n.value)||U(((u=se[0])==null?void 0:u.id)??"")}finally{He.value=!1}}async function $(u,f={}){if(!u)return;const _=be.value[u]===!0,E=f.silent!==!0&&!_;E&&(Fe.value=!0);try{ce.value[u]!==!0&&(await sa(u),ce.value={...ce.value,[u]:!0});const{messages:Y,inProgress:se}=await Lk(u),de=r.value[u]??[],Se=TA(de,Y,{preserveMissing:f.silent===!0});kn(u,Se);const ge=o.value[u]??[],ot=SA(ge,Y);jt(u,ot),Je(u,Y),be.value={...be.value,[u]:!0};const Nt=Bn(u);Nt&&(te.value={...te.value,[u]:Nt}),at(u,se),se||Tn(u),st(u)}finally{E&&(Fe.value=!1)}}async function Z(u,f={}){u&&be.value[u]!==!0&&await $(u,f)}async function We(){try{const u=t.value.flatMap(f=>f.threads.map(_=>_.cwd)).filter(Boolean);qe.value=await o0(u.length>0?[...new Set(u)]:void 0)}catch{}}async function Mt(){try{Te(await Uk())}catch{}}async function Zt(u={}){Be.value="";const f=u.includeSelectedThreadMessages!==!1,_=u.awaitAncillaryRefreshes===!0;try{await x();const E=Promise.allSettled([et(),Qe(),We(),Mt()]).then(()=>{});f&&await $(n.value),_&&await E}catch(E){Be.value=E instanceof Error?E.message:"Unknown application error"}}async function Pn(u){U(u);try{await $(u)}catch(f){Be.value=f instanceof Error?f.message:"Unknown application error"}}async function nn(u){try{await Hk(u),await x(),n.value===u&&await $(n.value)}catch(f){Be.value=f instanceof Error?f.message:"Unknown application error"}}async function pn(u,f){const _=f.trim();if(!(!u||!_))try{await Vk(u,_),Ne.value={...Ne.value,[u]:_},Ke(),ia(u,_)}catch(E){Be.value=E instanceof Error?E.message:"Unknown application error"}}async function Vn(u,f=[],_=[],E="steer",Y=[]){const se=n.value,de=u.trim();if(!se||!de&&f.length===0&&Y.length===0)return;const Se=l.value[se]===!0;if(Se&&E==="queue"){const ge=d.value[se]??[],ot=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;d.value={...d.value,[se]:[...ge,{id:ot,text:de,imageUrls:f,skills:_,fileAttachments:Y,collaborationMode:T.value}]};return}if(Se){he=!0,er(se,de,f,_,Y).catch(ge=>{const ot=ge instanceof Error?ge.message:"Unknown application error";Et(se,ot),Be.value=ot});return}Be.value="",he=!0,vt(se,null),Rt(se,{label:"Thinking",details:ut(N.value,O.value,T.value)}),Et(se,null),at(se,!0);try{await er(se,de,f,_,Y)}catch(ge){he=!1,at(se,!1),Rt(se,null);const ot=ge instanceof Error?ge.message:"Unknown application error";throw Et(se,ot),Be.value=ot,ge}}async function gr(u,f,_=[],E=[],Y=[]){const se=u.trim(),de=f.trim(),Se=N.value.trim();if(!se&&_.length===0&&Y.length===0)return"";Ae.value=!0,Be.value="";let ge="";try{try{ge=await uu(de||void 0,Se||void 0)}catch(Wn){if(Se&&Se!==Ln&&Uo(Wn))await ve(),ge=await uu(de||void 0,Ln);else throw Wn}if(!ge)return"";Ot(ge,de,se||"[Image]"),ce.value={...ce.value,[ge]:!0},U(ge),he=!0,vt(ge,null),Rt(ge,{label:"Thinking",details:ut(N.value,O.value,T.value)}),Et(ge,null),at(ge,!0);const ot=ge,Nt=de||null,Yt=se;return er(ge,se,_,E,Y).catch(Wn=>{he=!1,at(ge,!1),Rt(ge,null);const Zr=Wn instanceof Error?Wn.message:"Unknown application error";Et(ge,Zr),Be.value=Zr}).finally(()=>{Ae.value=!1}),S(ot,Yt,Nt),ge}catch(ot){he=!1,ge&&(at(ge,!1),Rt(ge,null));const Nt=ot instanceof Error?ot.message:"Unknown application error";throw ge&&Et(ge,Nt),Be.value=Nt,Ae.value=!1,ot}}async function er(u,f,_=[],E=[],Y=[]){const se=N.value.trim(),de=O.value,Se=T.value,ge=f.trim(),ot=E.map(Yt=>({name:Yt.name,path:Yt.path})),Nt=Y.map(Yt=>({...Yt}));_e(u,{text:ge,imageUrls:[..._],skills:ot,fileAttachments:Nt,effort:de,collaborationMode:Se,fallbackRetried:!1});try{ce.value[u]!==!0&&await sa(u);try{await oa(u,f,_,se||void 0,de||void 0,E.length>0?E:void 0,Y,Se)}catch(Yt){if(se&&se!==Ln&&Uo(Yt))await ve(),_e(u,{text:ge,imageUrls:[..._],skills:ot,fileAttachments:Nt,effort:de,collaborationMode:Se,fallbackRetried:!0}),await oa(u,f,_,Ln,de||void 0,E.length>0?E:void 0,Y,Se);else throw Yt}ce.value={...ce.value,[u]:!0},V.add(u),Ve=!0,await $t()}catch(Yt){throw Yt}}async function Hs(u){const f=d.value[u];if(!f||f.length===0)return;const[_,...E]=f;d.value=E.length>0?{...d.value,[u]:E}:Qt(d.value,u),Ae.value=!0,Be.value="",he=!0,vt(u,null),Rt(u,{label:"Thinking",details:ut(N.value,O.value,_.collaborationMode)}),Et(u,null),at(u,!0);try{G(_.collaborationMode),await er(u,_.text,_.imageUrls,_.skills,_.fileAttachments)}catch{at(u,!1),Rt(u,null)}finally{Ae.value=!1}}async function Oi(){const u=n.value;if(!u||l.value[u]!==!0)return;const f=Q.value[u];rt.value=!0,Be.value="";try{await qk(u,f),at(u,!1),Rt(u,null),Et(u,null),Q.value[u]&&(Q.value=Qt(Q.value,u)),V.add(u),Ve=!0,await $t()}catch(_){const E=_ instanceof Error?_.message:"Failed to interrupt active turn";Et(u,E),Be.value=E}finally{rt.value=!1}}async function A(u){const f=n.value;if(!f||ze.value)return;const E=(r.value[f]??[]).reduce((se,de)=>typeof de.turnIndex=="number"&&de.turnIndex>se?de.turnIndex:se,-1);if(E<0||u>E)return;const Y=E-u+1;if(!(Y<1)){ze.value=!0,Be.value="";try{const se=await cu(f,Y);kn(f,se),Tn(f),jt(f,[]),tn(f),a.value[f]&&(a.value=Qt(a.value,f)),vt(f,null),Rt(f,null),Et(f,null),Ve=!0,await $t()}catch(se){Be.value=se instanceof Error?se.message:"Failed to rollback thread"}finally{ze.value=!1}}}function ie(u,f){u.length===0||(ne.value[u]??"")===f||(ne.value={...ne.value,[u]:f},ma(ne.value))}async function Me(u){var se;if(u.length===0)return;const f=L.value.filter(de=>de!==u);if(cs(L.value,f)||(L.value=f,ws(L.value)),t.value=t.value.filter(de=>de.projectName!==u),ne.value[u]!==void 0){const de={...ne.value};delete de[u],ne.value=de,ma(de)}Ke();const _=Vr(e.value);dn(_),_.some(de=>de.id===n.value)||U(((se=_[0])==null?void 0:se.id)??"");const Y=new Set;try{const de=await Ys();for(const Se of de.order)bs(Se)===u&&Y.add(Se);for(const Se of de.active)bs(Se)===u&&Y.add(Se);for(const Se of Object.keys(de.labels))bs(Se)===u&&Y.add(Se)}catch{}if(Y.size>0)try{const de=await Ys(),Se=de.order.filter(Nt=>!Y.has(Nt)),ge=de.active.filter(Nt=>!Y.has(Nt)),ot=ge.length===0&&Se.length>0?[Se[0]]:ge;await fu({order:Se,labels:RA(de.labels,Y),active:ot});return}catch{}await nt()}function St(u,f){if(u.length===0||t.value.length===0)return;const _=t.value.map(ge=>ge.projectName),E=_.indexOf(u);if(E===-1)return;const Y=Math.max(0,Math.min(f,_.length-1)),se=wA(_,E,Y);if(se===_)return;const de=Fo(se,t.value);L.value=de,ws(L.value);const Se=ga(t.value,L.value);t.value=Ho(t.value,Se),Ke(),nt()}function It(u){const f=u.trim();if(!f)return;const _=[f,...L.value.filter(Y=>Y!==f)];if(cs(L.value,_))return;L.value=_,ws(L.value);const E=ga(t.value,L.value);t.value=Ho(t.value,E),Ke(),nt()}async function nt(){var u,f;try{const _=await Ys(),E=new Map;for(const de of _.order){const Se=bs(de);E.has(Se)||E.set(Se,de)}for(const de of t.value){const Se=((f=(u=de.threads[0])==null?void 0:u.cwd)==null?void 0:f.trim())??"";Se&&E.set(de.projectName,Se)}const Y=[];for(const de of L.value){const Se=E.get(de);Se&&!Y.includes(Se)&&Y.push(Se)}for(const de of _.order)Y.includes(de)||Y.push(de);const se=_.active.filter(de=>Y.includes(de));se.length===0&&Y.length>0&&se.push(Y[0]),await fu({order:Y,labels:_.labels,active:se})}catch{}}async function $t(){if(lt.value){typeof window<"u"&&ct===null&&(ct=window.setTimeout(()=>{ct=null,$t()},pa));return}lt.value=!0;const u=Ve,f=new Set(V);Ve=!1,V.clear();try{u&&await x();const _=n.value;if(!_)return;const E=f.has(_),Y=l.value[_]===!0,se=Bn(_),de=te.value[_]??"",Se=se.length>0&&se!==de;(E||Y||Se||u)&&await $(_,{silent:!0})}catch{}finally{lt.value=!1,(Ve||V.size>0)&&typeof window<"u"&&ct===null&&(ct=window.setTimeout(()=>{ct=null,$t()},pa))}}async function $o(){await Nl(),Ve=!0,n.value&&V.add(n.value),await $t()}function Vs(){typeof window>"u"||it||(Nl(),it=jk(u=>{if(u.method==="ready"){$o();return}Ht(u),Ct(u)}))}async function Nl(){try{const f=(await Fk()).map(_=>hn(_)).filter(_=>_!==null);An(f)}catch{}}async function $h(u){try{await Bk(u.id,{result:u.result,error:u.error}),Nn(u.id)}catch(f){Be.value=f instanceof Error?f.message:"Failed to reply to server request"}}function Oh(){it&&(it(),it=null),Ve=!1,V.clear(),Ce.clear(),ct!==null&&typeof window<"u"&&(window.clearTimeout(ct),ct=null),he=!1,r.value={},s.value={},o.value={},i.value={},a.value={},Oe.value={},me.value={},ae.value={},Q.value={},d.value={},Pe.value=null}const Nh=pe(()=>{const u=n.value;return u?d.value[u]??[]:[]});function Dl(u){const f=n.value;if(!f)return;const _=d.value[f];if(!_)return;const E=_.filter(Y=>Y.id!==u);d.value=E.length>0?{...d.value,[f]:E}:Qt(d.value,f)}function Dh(u){const f=n.value;if(!f)return;const _=d.value[f];if(!_)return;const E=_.find(Y=>Y.id===u);E&&(Dl(u),G(E.collaborationMode),Vn(E.text,E.imageUrls,E.skills,"steer",E.fileAttachments))}function Lh(u){U(u)}return{projectGroups:e,projectDisplayNameById:ne,selectedThread:I,selectedThreadScrollState:M,selectedThreadServerRequests:K,selectedLiveOverlay:F,codexQuota:R,selectedThreadId:n,availableCollaborationModes:b,availableModelIds:h,selectedCollaborationMode:T,selectedModelId:N,selectedReasoningEffort:O,installedSkills:qe,messages:H,isLoadingThreads:He,isLoadingMessages:Fe,isSendingMessage:Ae,isInterruptingTurn:rt,error:Be,refreshAll:Zt,refreshSkills:We,selectThread:Pn,loadMessages:$,ensureThreadMessagesLoaded:Z,setThreadScrollState:_n,archiveThreadById:nn,renameThreadById:pn,sendMessageToSelectedThread:Vn,sendMessageToNewThread:gr,interruptSelectedThreadTurn:Oi,rollbackSelectedThread:A,isRollingBack:ze,selectedThreadQueuedMessages:Nh,removeQueuedMessage:Dl,steerQueuedMessage:Dh,setSelectedCollaborationMode:G,setSelectedModelId:z,setSelectedReasoningEffort:tt,respondToPendingServerRequest:$h,renameProject:ie,removeProject:Me,reorderProject:St,pinProjectToTop:It,startPolling:Vs,stopPolling:Oh,primeSelectedThread:Lh}}const BA={class:"sidebar-root"},FA={class:"sidebar-scrollable"},UA=["aria-pressed"],HA={key:1,class:"sidebar-search-bar"},VA={key:0,class:"sidebar-settings-area"},WA={key:0,class:"sidebar-settings-panel"},zA={class:"sidebar-settings-value"},GA={class:"sidebar-settings-value"},qA={class:"content-root"},KA={class:"content-body"},JA={key:1,class:"content-grid"},YA={class:"new-thread-empty"},QA={class:"worktree-init-status-title"},XA={class:"worktree-init-status-message"},ZA={key:2,class:"content-grid"},ex={class:"content-thread"},tx={class:"composer-with-queue"},nx={class:"build-badge","aria-label":"Author name, worktree name, and version"},Ku="codex-web-local.sidebar-collapsed.v1",Ju="codex-web-local.send-with-enter.v1",Yu="codex-web-local.in-progress-send-mode.v1",Qu="codex-web-local.dark-mode.v1",Xu="codex-web-local.dictation-click-to-toggle.v1",rx=400,sx=Xt({__name:"App",setup(e){const t="codexui",n="1.0.0",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:a,selectedLiveOverlay:l,codexQuota:d,selectedThreadId:c,availableCollaborationModes:h,availableModelIds:b,selectedCollaborationMode:T,selectedModelId:N,selectedReasoningEffort:O,installedSkills:J,messages:oe,isLoadingThreads:L,isLoadingMessages:ne,isInterruptingTurn:te,refreshAll:be,refreshSkills:ce,selectThread:me,ensureThreadMessagesLoaded:Oe,setThreadScrollState:ae,archiveThreadById:Q,renameThreadById:le,sendMessageToSelectedThread:ee,sendMessageToNewThread:Pe,interruptSelectedThreadTurn:Ne,rollbackSelectedThread:qe,isRollingBack:He,selectedThreadQueuedMessages:Fe,removeQueuedMessage:Ae,steerQueuedMessage:rt,setSelectedCollaborationMode:ze,setSelectedModelId:Be,setSelectedReasoningEffort:lt,respondToPendingServerRequest:Dt,renameProject:it,removeProject:ct,reorderProject:Ve,pinProjectToTop:V,startPolling:we,stopPolling:he,primeSelectedThread:Ce}=jA(),xe=bv(),k=wv(),{isMobile:I}=Af(),M=D(!1),K=D(!1),F=D(""),R=D("local"),H=D({order:[],labels:{}}),U=D({phase:"idle",title:"",message:""}),z=D(nn()),G=D(""),Te=D(!1),ve=D(null),_e=D(null);let Ie=null;const Ue=D("New Project (1)"),tt=D(""),Qe=D(!1),ut=D(S(Ju,!0)),et=D($()),pt=D(x()),Ke=D(S(Xu,!1)),Ot=D(null),dn=D(!1),st=pe(()=>{const A=xe.params.threadId;return typeof A=="string"?A:""}),vt=pe(()=>{const A=new Set;for(const ie of r.value)for(const Me of ie.threads)A.add(Me.id);return A}),at=pe(()=>xe.name==="home"),Vt=pe(()=>xe.name==="skills"),Rt=pe(()=>{var A;return Vt.value?"Skills":at.value?"New thread":((A=o.value)==null?void 0:A.title)??"Choose a thread"}),Et=pe(()=>oe.value.filter(A=>{const ie=Vn(A.messageType,A.role);return ie==="worked"?!0:!(ie==="turnActivity.live"||ie==="turnError.live"||ie==="agentReasoning.live")})),Bn=pe(()=>l.value),_n=pe(()=>at.value?"__new-thread__":c.value),kn=pe(()=>{var A,ie;return at.value?F.value.trim():((ie=(A=o.value)==null?void 0:A.cwd)==null?void 0:ie.trim())??""}),jt=pe(()=>{var A;return!at.value&&((A=o.value)==null?void 0:A.inProgress)===!0}),Wt=pe(()=>{var St,It;const A=[],ie=new Set;for(const nt of H.value.order){const $t=nt.trim();!$t||ie.has($t)||(ie.add($t),A.push({value:$t,label:H.value.labels[$t]||Ee($t)}))}for(const nt of r.value){const $t=((It=(St=nt.threads[0])==null?void 0:St.cwd)==null?void 0:It.trim())??"";!$t||ie.has($t)||(ie.add($t),A.push({value:$t,label:s.value[nt.projectName]??nt.projectName}))}const Me=F.value.trim();return Me&&!ie.has(Me)&&A.unshift({value:Me,label:Ee(Me)}),A}),fn=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;Nr(()=>{window.addEventListener("keydown",Nn),document.addEventListener("visibilitychange",An),window.addEventListener("pageshow",Zn),window.addEventListener("focus",xn),Pn(),fn==null||fn.addEventListener("change",Pn),er(),P(),B(),p()}),Si(()=>{window.removeEventListener("keydown",Nn),document.removeEventListener("visibilitychange",An),window.removeEventListener("pageshow",Zn),window.removeEventListener("focus",xn),fn==null||fn.removeEventListener("change",Pn),Ie&&(clearTimeout(Ie),Ie=null),he()}),gt(G,A=>{const ie=A.trim();if(Ie&&(clearTimeout(Ie),Ie=null),!ie){_e.value=null;return}Ie=setTimeout(()=>{n0(ie,1e3).then(Me=>{G.value.trim()===ie&&(_e.value=Me.threadIds)}).catch(()=>{G.value.trim()===ie&&(_e.value=null)})},220)});function Mn(){ce()}function $n(){Te.value=!Te.value,Te.value?Kt(()=>{var A;return(A=ve.value)==null?void 0:A.focus()}):G.value=""}function Fn(){var A;G.value="",(A=ve.value)==null||A.focus()}function tn(A){A.key==="Escape"&&(Te.value=!1,G.value="")}function Tn(A){A&&(xe.name==="thread"&&st.value===A||(k.push({name:"thread",params:{threadId:A}}),I.value&&zt(!0)))}async function Un(A){A&&(c.value!==A&&(await me(A),await k.push({name:"thread",params:{threadId:A}})),await Kt(),Ht())}function pr(A){Q(A)}function mr(A){var St,It;const ie=r.value.find(nt=>nt.projectName===A),Me=((It=(St=ie==null?void 0:ie.threads[0])==null?void 0:St.cwd)==null?void 0:It.trim())??"";Me&&(F.value=Me),I.value&&zt(!0),!at.value&&k.push({name:"home"})}function Hn(A){var St,It;const ie=r.value.find(nt=>nt.projectName===A),Me=((It=(St=ie==null?void 0:ie.threads[0])==null?void 0:St.cwd)==null?void 0:It.trim())??"";!Me||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(Me)}`,"_blank","noopener,noreferrer")}function Le(){var ie,Me;const A=((Me=(ie=o.value)==null?void 0:ie.cwd)==null?void 0:Me.trim())??"";A&&(F.value=A),I.value&&zt(!0),!at.value&&k.push({name:"home"})}function Re(A){it(A.projectName,A.displayName)}function Sn(A){le(A.threadId,A.title)}async function Bt(A){await ct(A),await B(),p()}function Cn(A){Ve(A.projectName,A.toIndex)}function On(A){ae(A.threadId,A.state)}function hn(A){Dt(A)}function zt(A){z.value!==A&&(z.value=A,pn(A))}function Nn(A){A.defaultPrevented||!A.ctrlKey&&!A.metaKey||A.shiftKey||A.altKey||A.key.toLowerCase()==="b"&&(A.preventDefault(),zt(!z.value))}function An(){if(!(typeof document>"u")&&I.value){if(document.visibilityState==="hidden"){Ot.value=Date.now(),dn.value=!1;return}In()}}function Zn(A){A.persisted&&In()}function xn(){In()}function In(){typeof window>"u"||typeof document>"u"||!I.value||document.visibilityState!=="visible"||dn.value||Ot.value===null||Date.now()-Ot.value<rx||(dn.value=!0,Ot.value=null,window.location.reload())}function C(A){const ie=A.text;if(at.value){Oi(ie,A.imageUrls,A.skills,A.fileAttachments);return}ee(ie,A.imageUrls,A.skills,A.mode,A.fileAttachments)}function j(A){F.value=A.trim()}async function re(A){const ie=A.trim();if(!ie)return;const Me=g(ie),St=await je(),It=Me?ie:X(St,ie);if(It)try{const nt=await Zk(It,{createIfMissing:!Me,label:Me?"":ie});nt&&(F.value=nt,V(Ee(nt)),B(),p())}catch{}}async function je(){const A=v();if(A)return A;try{const ie=await du();if(ie)return tt.value=ie,ie}catch{}return""}function g(A){return A?A.startsWith("~/")||A.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(A):!1}async function p(){const A=v();if(!A){Ue.value="New Project (1)";return}try{const ie=await e0(A);Ue.value=ie.name||"New Project (1)"}catch{Ue.value="New Project (1)"}}function v(){var Me,St;const A=F.value.trim();if(A)return q(A);const ie=((St=(Me=Wt.value[0])==null?void 0:Me.value)==null?void 0:St.trim())??"";return ie?q(ie):tt.value.trim()}async function P(){try{tt.value=await du()}catch{tt.value=""}}async function B(){try{const A=await Ys();H.value={order:[...A.order],labels:{...A.labels}}}catch{H.value={order:[],labels:{}}}}function q(A){const ie=A.trim().replace(/\/+$/,"");if(!ie)return"";const Me=ie.lastIndexOf("/");return Me<=0?"":ie.slice(0,Me)}function Ee(A){const ie=A.trim().replace(/\/+$/,"");if(!ie)return"";const Me=ie.lastIndexOf("/");return Me<0?ie:ie.slice(Me+1)}function X(A,ie){const Me=A.trim().replace(/\/+$/,""),St=ie.trim().replace(/^\/+/,"");return!Me||!St?"":`${Me}/${St}`}function ke(A){Be(A)}function fe(A){lt(A)}function Je(){Ne()}function Ft(A){qe(A.turnIndex)}function Ht(){if(at.value||Vt.value||typeof document>"u"||!o.value||Et.value.length===0)return;const A=Ct(),ie=Gt(),Me=new Blob([A],{type:"text/markdown;charset=utf-8"}),St=URL.createObjectURL(Me),It=document.createElement("a");It.href=St,It.download=ie,document.body.appendChild(It),It.click(),document.body.removeChild(It),window.setTimeout(()=>URL.revokeObjectURL(St),0)}function Ct(){var Me,St,It;const A=[],ie=((St=(Me=o.value)==null?void 0:Me.title)==null?void 0:St.trim())||"Untitled thread";A.push(`# ${Us(ie)}`),A.push(""),A.push(`- Exported: ${new Date().toISOString()}`),A.push(`- Thread ID: ${((It=o.value)==null?void 0:It.id)??""}`),A.push(""),A.push("---"),A.push("");for(const nt of Et.value){const $t=nt.role?nt.role.toUpperCase():"MESSAGE";A.push(`## ${$t}`),A.push("");const $o=nt.text.trim();if($o&&(A.push($o),A.push("")),nt.commandExecution&&(A.push("```text"),A.push(`command: ${nt.commandExecution.command}`),A.push(`status: ${nt.commandExecution.status}`),nt.commandExecution.cwd&&A.push(`cwd: ${nt.commandExecution.cwd}`),nt.commandExecution.exitCode!==null&&A.push(`exitCode: ${nt.commandExecution.exitCode}`),A.push(nt.commandExecution.aggregatedOutput||"(no output)"),A.push("```"),A.push("")),nt.fileAttachments&&nt.fileAttachments.length>0){A.push("Attachments:");for(const Vs of nt.fileAttachments)A.push(`- ${Vs.path}`);A.push("")}if(nt.images&&nt.images.length>0){A.push("Images:");for(const Vs of nt.images)A.push(`- ${Vs}`);A.push("")}}return`${A.join(`
1439
- `).trimEnd()}
1440
- `}function Gt(){var It,nt;const Me=(((nt=(It=o.value)==null?void 0:It.title)==null?void 0:nt.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",St=new Date().toISOString().replace(/[:.]/g,"-");return`${Me}-${St}.md`}function Us(A){return A.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function S(A,ie){if(typeof window>"u")return ie;const Me=window.localStorage.getItem(A);return Me===null?ie:Me==="1"}function x(){if(typeof window>"u")return"system";const A=window.localStorage.getItem(Qu);return A==="light"||A==="dark"?A:"system"}function $(){return typeof window>"u"?"queue":window.localStorage.getItem(Yu)==="steer"?"steer":"queue"}function Z(){ut.value=!ut.value,window.localStorage.setItem(Ju,ut.value?"1":"0")}function We(){et.value=et.value==="steer"?"queue":"steer",window.localStorage.setItem(Yu,et.value)}function Mt(){const A=["system","light","dark"],ie=A.indexOf(pt.value);pt.value=A[(ie+1)%A.length],window.localStorage.setItem(Qu,pt.value),Pn()}function Zt(){Ke.value=!Ke.value,window.localStorage.setItem(Xu,Ke.value?"1":"0")}function Pn(){const A=document.documentElement;if(pt.value==="dark")A.classList.add("dark");else if(pt.value==="light")A.classList.remove("dark");else{const ie=window.matchMedia("(prefers-color-scheme: dark)").matches;A.classList.toggle("dark",ie)}}function nn(){return typeof window>"u"?!1:window.localStorage.getItem(Ku)==="1"}function pn(A){typeof window>"u"||window.localStorage.setItem(Ku,A?"1":"0")}function Vn(A,ie){const Me=(A??"").trim();return Me.length>0?Me:ie.trim()||"message"}function gr(A){ze(A)}async function er(){await k.isReady(),xe.name==="thread"&&st.value&&Ce(st.value),we(),await be({includeSelectedThreadMessages:!0}),K.value=!0,await Hs()}async function Hs(){if(!M.value){M.value=!0;try{if(xe.name==="home"||xe.name==="skills"){c.value!==""&&await me("");return}if(xe.name==="thread"){const A=st.value;if(!A)return;if(!vt.value.has(A)){await k.replace({name:"home"});return}c.value!==A?await me(A):Oe(A,{silent:!0});return}}finally{M.value=!1}}}gt(()=>[xe.name,st.value,L.value,vt.value.has(st.value),c.value],async()=>{K.value&&await Hs()}),gt(()=>c.value,async A=>{if(K.value&&!M.value&&!(at.value||Vt.value)){if(!A){xe.name!=="home"&&await k.replace({name:"home"});return}xe.name==="thread"&&st.value===A||await k.replace({name:"thread",params:{threadId:A}})}}),gt(()=>[K.value,xe.name,c.value],([A,ie,Me])=>{A&&ie==="thread"&&Me&&Oe(Me,{silent:!0})}),gt(()=>Wt.value,A=>{if(A.length===0){F.value="";return}A.some(Me=>Me.value===F.value)||(F.value=A[0].value),p()},{immediate:!0}),gt(()=>F.value,()=>{U.value={phase:"idle",title:"",message:""},p()}),gt(()=>R.value,A=>{A==="local"&&(U.value={phase:"idle",title:"",message:""})}),gt(()=>xe.name,A=>{A!=="home"&&(U.value={phase:"idle",title:"",message:""})}),gt(()=>c.value,()=>{U.value={phase:"idle",title:"",message:""}}),gt(I,A=>{A&&!z.value&&zt(!0)});async function Oi(A,ie=[],Me=[],St=[]){try{U.value={phase:"idle",title:"",message:""};let It=F.value;if(R.value==="worktree"){U.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const $t=await Xk(F.value);It=$t.cwd,F.value=$t.cwd,U.value={phase:"idle",title:"",message:""}}catch{U.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const nt=await Pe(A,It,ie,Me,St);if(!nt)return;await k.replace({name:"thread",params:{threadId:nt}})}catch{}}return(A,ie)=>(m(),w($e,null,[De(Ev,{"is-sidebar-collapsed":z.value,onCloseSidebar:ie[6]||(ie[6]=Me=>zt(!0))},{sidebar:bt(()=>[y("section",BA,[y("div",FA,[z.value?ue("",!0):(m(),mt(Wu,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":z.value,"show-new-thread-button":!0,onToggleSidebar:ie[0]||(ie[0]=Me=>zt(!z.value)),onStartNewThread:Le},{default:bt(()=>[y("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Te.value,"aria-label":"Search threads",title:"Search threads",onClick:$n},[De(ja,{class:"sidebar-search-toggle-icon"})],8,UA)]),_:1},8,["is-sidebar-collapsed"])),!z.value&&Te.value?(m(),w("div",HA,[De(ja,{class:"sidebar-search-bar-icon"}),Pr(y("input",{ref_key:"sidebarSearchInputRef",ref:ve,"onUpdate:modelValue":ie[1]||(ie[1]=Me=>G.value=Me),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:tn},null,544),[[Rr,G.value]]),G.value.length>0?(m(),w("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Fn},[De(wl,{class:"sidebar-search-clear-icon"})])):ue("",!0)])):ue("",!0),z.value?ue("",!0):(m(),w("button",{key:2,class:ft(["sidebar-skills-link",{"is-active":Vt.value}]),type:"button",onClick:ie[2]||(ie[2]=Me=>{ye(k).push({name:"skills"}),ye(I)&&zt(!0)})}," Skills Hub ",2)),z.value?ue("",!0):(m(),mt(dw,{key:3,groups:ye(r),"project-display-name-by-id":ye(s),"selected-thread-id":ye(c),"is-loading":ye(L),"search-query":G.value,"search-matched-thread-ids":_e.value,onSelect:Tn,onArchive:pr,onStartNewThread:mr,onRenameProject:Re,onBrowseProjectFiles:Hn,onRenameThread:Sn,onRemoveProject:Bt,onReorderProject:Cn,onExportThread:Un},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),z.value?ue("",!0):(m(),w("div",VA,[De(mf,{name:"settings-panel"},{default:bt(()=>[Qe.value?(m(),w("div",WA,[y("button",{class:"sidebar-settings-row",type:"button",onClick:Z},[ie[7]||(ie[7]=y("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),y("span",{class:ft(["sidebar-settings-toggle",{"is-on":!ut.value}])},null,2)]),y("button",{class:"sidebar-settings-row",type:"button",onClick:We},[ie[8]||(ie[8]=y("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),y("span",zA,W(et.value==="steer"?"Steer":"Queue"),1)]),y("button",{class:"sidebar-settings-row",type:"button",onClick:Mt},[ie[9]||(ie[9]=y("span",{class:"sidebar-settings-label"},"Appearance",-1)),y("span",GA,W(pt.value==="system"?"System":pt.value==="dark"?"Dark":"Light"),1)]),y("button",{class:"sidebar-settings-row",type:"button",onClick:Zt},[ie[10]||(ie[10]=y("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),y("span",{class:ft(["sidebar-settings-toggle",{"is-on":Ke.value}])},null,2)])])):ue("",!0)]),_:1}),y("button",{class:"sidebar-settings-button",type:"button",onClick:ie[3]||(ie[3]=Me=>Qe.value=!Qe.value)},[De(cA,{class:"sidebar-settings-icon"}),ie[11]||(ie[11]=y("span",null,"Settings",-1))])]))])]),content:bt(()=>[y("section",qA,[De(vw,{title:Rt.value},{leading:bt(()=>[z.value||ye(I)?(m(),mt(Wu,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":z.value,"show-new-thread-button":!0,onToggleSidebar:ie[4]||(ie[4]=Me=>zt(!z.value)),onStartNewThread:Le},null,8,["is-sidebar-collapsed"])):ue("",!0)]),_:1},8,["title"]),y("section",KA,[Vt.value?(m(),mt(KC,{key:0,onSkillsChanged:Mn})):at.value?(m(),w("div",JA,[y("div",YA,[ie[12]||(ie[12]=y("p",{class:"new-thread-hero"},"Let's build",-1)),De(La,{class:"new-thread-folder-dropdown","model-value":F.value,options:Wt.value,placeholder:"Choose folder","enable-search":!0,"search-placeholder":"Quick search project","show-add-action":!0,"add-action-label":"+ Add new project","default-add-value":Ue.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":j,onAdd:re},null,8,["model-value","options","default-add-value"]),De(eS,{class:"new-thread-runtime-dropdown",modelValue:R.value,"onUpdate:modelValue":ie[5]||(ie[5]=Me=>R.value=Me)},null,8,["modelValue"]),U.value.phase!=="idle"?(m(),w("div",{key:0,class:ft(["worktree-init-status",{"is-running":U.value.phase==="running","is-error":U.value.phase==="error"}])},[y("strong",QA,W(U.value.title),1),y("span",XA,W(U.value.message),1)],2)):ue("",!0)]),De(mu,{"active-thread-id":_n.value,cwd:kn.value,"collaboration-modes":ye(h),"selected-collaboration-mode":ye(T),models:ye(b),"selected-model":ye(N),"selected-reasoning-effort":ye(O),skills:ye(J),"codex-quota":ye(d),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":ut.value,"in-progress-submit-mode":et.value,"dictation-click-to-toggle":Ke.value,onSubmit:C,"onUpdate:selectedCollaborationMode":gr,"onUpdate:selectedModel":ke,"onUpdate:selectedReasoningEffort":fe},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","skills","codex-quota","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle"])])):(m(),w("div",ZA,[y("div",ex,[De(ak,{messages:Et.value,"is-loading":ye(ne),"active-thread-id":_n.value,cwd:kn.value,"scroll-state":ye(i),"live-overlay":Bn.value,"pending-requests":ye(a),"is-turn-in-progress":jt.value,"is-rolling-back":ye(He),onUpdateScrollState:On,onRespondServerRequest:hn,onRollback:Ft},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),y("div",tx,[De(GT,{messages:ye(Fe),onSteer:ye(rt),onDelete:ye(Ae)},null,8,["messages","onSteer","onDelete"]),De(mu,{"active-thread-id":_n.value,cwd:kn.value,"collaboration-modes":ye(h),"selected-collaboration-mode":ye(T),models:ye(b),"selected-model":ye(N),"selected-reasoning-effort":ye(O),skills:ye(J),"codex-quota":ye(d),"is-turn-in-progress":jt.value,"is-interrupting-turn":ye(te),"has-queue-above":ye(Fe).length>0,"send-with-enter":ut.value,"in-progress-submit-mode":et.value,"dictation-click-to-toggle":Ke.value,"onUpdate:selectedCollaborationMode":gr,onSubmit:C,"onUpdate:selectedModel":ke,"onUpdate:selectedReasoningEffort":fe,onInterrupt:Je},null,8,["active-thread-id","cwd","collaboration-modes","selected-collaboration-mode","models","selected-model","selected-reasoning-effort","skills","codex-quota","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle"])])]))])])]),_:1},8,["is-sidebar-collapsed"]),y("div",nx," nervmor "+W(ye(t))+" · v"+W(ye(n)),1)],64))}}),ox=ht(sx,[["__scopeId","data-v-6dee4378"]]),ya={render:()=>null},ix=yv({history:Yg(),routes:[{path:"/",name:"home",component:ya},{path:"/thread/:threadId",name:"thread",component:ya},{path:"/skills",name:"skills",component:ya},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. npm: https://www.npmjs.com/package/@nervmor/codexui");cg(ox).use(ix).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error("Service worker registration failed.",e)})});