@nervmor/codexui 1.0.5 → 1.0.7

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.
@@ -0,0 +1,1455 @@
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 bl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Lt={},Gs=[],_r=()=>{},md=()=>!1,Oi=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),_l=e=>e.startsWith("onUpdate:"),en=Object.assign,kl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Zh=Object.prototype.hasOwnProperty,At=(e,t)=>Zh.call(e,t),Ye=Array.isArray,Ks=e=>qo(e)==="[object Map]",gd=e=>qo(e)==="[object Set]",ic=e=>qo(e)==="[object Date]",nt=e=>typeof e=="function",Ht=e=>typeof e=="string",ir=e=>typeof e=="symbol",xt=e=>e!==null&&typeof e=="object",vd=e=>(xt(e)||nt(e))&&nt(e.then)&&nt(e.catch),yd=Object.prototype.toString,qo=e=>yd.call(e),ep=e=>qo(e).slice(8,-1),wd=e=>qo(e)==="[object Object]",Tl=e=>Ht(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,bo=bl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ni=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},tp=/-\w/g,An=Ni(e=>e.replace(tp,t=>t.slice(1).toUpperCase())),np=/\B([A-Z])/g,hs=Ni(e=>e.replace(np,"-$1").toLowerCase()),Li=Ni(e=>e.charAt(0).toUpperCase()+e.slice(1)),ea=Ni(e=>e?`on${Li(e)}`:""),vr=(e,t)=>!Object.is(e,t),ui=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},bd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Sl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},rp=e=>{const t=Ht(e)?Number(e):NaN;return isNaN(t)?e:t};let ac;const Di=()=>ac||(ac=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function cs(e){if(Ye(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Ht(r)?ap(r):cs(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Ht(e)||xt(e))return e}const sp=/;(?![^(]*\))/g,op=/:([^]+)/,ip=/\/\*[^]*?\*\//g;function ap(e){const t={};return e.replace(ip,"").split(sp).forEach(n=>{if(n){const r=n.split(op);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function tt(e){let t="";if(Ht(e))t=e;else if(Ye(e))for(let n=0;n<e.length;n++){const r=tt(e[n]);r&&(t+=r+" ")}else if(xt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const lp="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",cp=bl(lp);function _d(e){return!!e||e===""}function up(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Il(e[r],t[r]);return n}function Il(e,t){if(e===t)return!0;let n=ic(e),r=ic(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=ir(e),r=ir(t),n||r)return e===t;if(n=Ye(e),r=Ye(t),n||r)return n&&r?up(e,t):!1;if(n=xt(e),r=xt(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||!Il(e[i],t[i]))return!1}}return String(e)===String(t)}const kd=e=>!!(e&&e.__v_isRef===!0),J=e=>Ht(e)?e:e==null?"":Ye(e)||xt(e)&&(e.toString===yd||!nt(e.toString))?kd(e)?J(e.value):JSON.stringify(e,Td,2):String(e),Td=(e,t)=>kd(t)?Td(e,t.value):Ks(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ta(r,o)+" =>"]=s,n),{})}:gd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ta(n))}:ir(t)?ta(t):xt(t)&&!Ye(t)&&!wd(t)?String(t):t,ta=(e,t="")=>{var n;return ir(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 Ln;class dp{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=Ln,!t&&Ln&&(this.index=(Ln.scopes||(Ln.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=Ln;try{return Ln=this,t()}finally{Ln=n}}}on(){++this._on===1&&(this.prevScope=Ln,Ln=this)}off(){this._on>0&&--this._on===0&&(Ln=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 fp(){return Ln}let Dt;const na=new WeakSet;class Sd{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,Ln&&Ln.active&&Ln.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,na.has(this)&&(na.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ed(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,lc(this),Cd(this);const t=Dt,n=rr;Dt=this,rr=!0;try{return this.fn()}finally{Ad(this),Dt=t,rr=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Al(t);this.deps=this.depsTail=void 0,lc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?na.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Fa(this)&&this.run()}get dirty(){return Fa(this)}}let Id=0,_o,ko;function Ed(e,t=!1){if(e.flags|=8,t){e.next=ko,ko=e;return}e.next=_o,_o=e}function El(){Id++}function Cl(){if(--Id>0)return;if(ko){let t=ko;for(ko=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;_o;){let t=_o;for(_o=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 Cd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ad(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),Al(r),hp(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Fa(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(xd(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function xd(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Mo)||(e.globalVersion=Mo,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Fa(e))))return;e.flags|=2;const t=e.dep,n=Dt,r=rr;Dt=e,rr=!0;try{Cd(e);const s=e.fn(e._value);(t.version===0||vr(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Dt=n,rr=r,Ad(e),e.flags&=-3}}function Al(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)Al(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function hp(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let rr=!0;const Rd=[];function Fr(){Rd.push(rr),rr=!1}function Br(){const e=Rd.pop();rr=e===void 0?!0:e}function lc(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Dt;Dt=void 0;try{t()}finally{Dt=n}}}let Mo=0;class pp{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 xl{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(!Dt||!rr||Dt===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Dt)n=this.activeLink=new pp(Dt,this),Dt.deps?(n.prevDep=Dt.depsTail,Dt.depsTail.nextDep=n,Dt.depsTail=n):Dt.deps=Dt.depsTail=n,Pd(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=Dt.depsTail,n.nextDep=void 0,Dt.depsTail.nextDep=n,Dt.depsTail=n,Dt.deps===n&&(Dt.deps=r)}return n}trigger(t){this.version++,Mo++,this.notify(t)}notify(t){El();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{Cl()}}}function Pd(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)Pd(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Ba=new WeakMap,Ms=Symbol(""),Ua=Symbol(""),$o=Symbol("");function gn(e,t,n){if(rr&&Dt){let r=Ba.get(e);r||Ba.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new xl),s.map=r,s.key=n),s.track()}}function Or(e,t,n,r,s,o){const i=Ba.get(e);if(!i){Mo++;return}const a=l=>{l&&l.trigger()};if(El(),t==="clear")i.forEach(a);else{const l=Ye(e),f=l&&Tl(n);if(l&&n==="length"){const u=Number(r);i.forEach((g,_)=>{(_==="length"||_===$o||!ir(_)&&_>=u)&&a(g)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),f&&a(i.get($o)),t){case"add":l?f&&a(i.get("length")):(a(i.get(Ms)),Ks(e)&&a(i.get(Ua)));break;case"delete":l||(a(i.get(Ms)),Ks(e)&&a(i.get(Ua)));break;case"set":Ks(e)&&a(i.get(Ms));break}}Cl()}function Bs(e){const t=St(e);return t===e?t:(gn(t,"iterate",$o),Yn(e)?t:t.map(ar))}function ji(e){return gn(e=St(e),"iterate",$o),e}function mr(e,t){return Ur(e)?no($s(e)?ar(t):t):ar(t)}const mp={__proto__:null,[Symbol.iterator](){return ra(this,Symbol.iterator,e=>mr(this,e))},concat(...e){return Bs(this).concat(...e.map(t=>Ye(t)?Bs(t):t))},entries(){return ra(this,"entries",e=>(e[1]=mr(this,e[1]),e))},every(e,t){return Ar(this,"every",e,t,void 0,arguments)},filter(e,t){return Ar(this,"filter",e,t,n=>n.map(r=>mr(this,r)),arguments)},find(e,t){return Ar(this,"find",e,t,n=>mr(this,n),arguments)},findIndex(e,t){return Ar(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Ar(this,"findLast",e,t,n=>mr(this,n),arguments)},findLastIndex(e,t){return Ar(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Ar(this,"forEach",e,t,void 0,arguments)},includes(...e){return sa(this,"includes",e)},indexOf(...e){return sa(this,"indexOf",e)},join(e){return Bs(this).join(e)},lastIndexOf(...e){return sa(this,"lastIndexOf",e)},map(e,t){return Ar(this,"map",e,t,void 0,arguments)},pop(){return ho(this,"pop")},push(...e){return ho(this,"push",e)},reduce(e,...t){return cc(this,"reduce",e,t)},reduceRight(e,...t){return cc(this,"reduceRight",e,t)},shift(){return ho(this,"shift")},some(e,t){return Ar(this,"some",e,t,void 0,arguments)},splice(...e){return ho(this,"splice",e)},toReversed(){return Bs(this).toReversed()},toSorted(e){return Bs(this).toSorted(e)},toSpliced(...e){return Bs(this).toSpliced(...e)},unshift(...e){return ho(this,"unshift",e)},values(){return ra(this,"values",e=>mr(this,e))}};function ra(e,t,n){const r=ji(e),s=r[t]();return r!==e&&!Yn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const gp=Array.prototype;function Ar(e,t,n,r,s,o){const i=ji(e),a=i!==e&&!Yn(e),l=i[t];if(l!==gp[t]){const g=l.apply(e,o);return a?ar(g):g}let f=n;i!==e&&(a?f=function(g,_){return n.call(this,mr(e,g),_,e)}:n.length>2&&(f=function(g,_){return n.call(this,g,_,e)}));const u=l.call(i,f,r);return a&&s?s(u):u}function cc(e,t,n,r){const s=ji(e),o=s!==e&&!Yn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(f,u,g){return a&&(a=!1,f=mr(e,f)),n.call(this,f,mr(e,u),g,e)}):n.length>3&&(i=function(f,u,g){return n.call(this,f,u,g,e)}));const l=s[t](i,...r);return a?mr(e,l):l}function sa(e,t,n){const r=St(e);gn(r,"iterate",$o);const s=r[t](...n);return(s===-1||s===!1)&&Ml(n[0])?(n[0]=St(n[0]),r[t](...n)):s}function ho(e,t,n=[]){Fr(),El();const r=St(e)[t].apply(e,n);return Cl(),Br(),r}const vp=bl("__proto__,__v_isRef,__isVue"),Md=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ir));function yp(e){ir(e)||(e=String(e));const t=St(this);return gn(t,"has",e),t.hasOwnProperty(e)}class $d{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?Ap:Dd:o?Ld:Nd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Ye(t);if(!s){let l;if(i&&(l=mp[n]))return l;if(n==="hasOwnProperty")return yp}const a=Reflect.get(t,n,wn(t)?t:r);if((ir(n)?Md.has(n):vp(n))||(s||gn(t,"get",n),o))return a;if(wn(a)){const l=i&&Tl(n)?a:a.value;return s&&xt(l)?Wa(l):l}return xt(a)?s?Wa(a):Fi(a):a}}class Od extends $d{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Ye(t)&&Tl(n);if(!this._isShallow){const f=Ur(o);if(!Yn(r)&&!Ur(r)&&(o=St(o),r=St(r)),!i&&wn(o)&&!wn(r))return f||(o.value=r),!0}const a=i?Number(n)<t.length:At(t,n),l=Reflect.set(t,n,r,wn(t)?t:s);return t===St(s)&&(a?vr(r,o)&&Or(t,"set",n,r):Or(t,"add",n,r)),l}deleteProperty(t,n){const r=At(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Or(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!ir(n)||!Md.has(n))&&gn(t,"has",n),r}ownKeys(t){return gn(t,"iterate",Ye(t)?"length":Ms),Reflect.ownKeys(t)}}class wp extends $d{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const bp=new Od,_p=new wp,kp=new Od(!0);const Ha=e=>e,ti=e=>Reflect.getPrototypeOf(e);function Tp(e,t,n){return function(...r){const s=this.__v_raw,o=St(s),i=Ks(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,f=s[e](...r),u=n?Ha:t?no:ar;return!t&&gn(o,"iterate",l?Ua:Ms),en(Object.create(f),{next(){const{value:g,done:_}=f.next();return _?{value:g,done:_}:{value:a?[u(g[0]),u(g[1])]:u(g),done:_}}})}}function ni(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Sp(e,t){const n={get(s){const o=this.__v_raw,i=St(o),a=St(s);e||(vr(s,a)&&gn(i,"get",s),gn(i,"get",a));const{has:l}=ti(i),f=t?Ha:e?no:ar;if(l.call(i,s))return f(o.get(s));if(l.call(i,a))return f(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&gn(St(s),"iterate",Ms),s.size},has(s){const o=this.__v_raw,i=St(o),a=St(s);return e||(vr(s,a)&&gn(i,"has",s),gn(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=St(a),f=t?Ha:e?no:ar;return!e&&gn(l,"iterate",Ms),a.forEach((u,g)=>s.call(o,f(u),f(g),i))}};return en(n,e?{add:ni("add"),set:ni("set"),delete:ni("delete"),clear:ni("clear")}:{add(s){const o=St(this),i=ti(o),a=St(s),l=!t&&!Yn(s)&&!Ur(s)?a:s;return i.has.call(o,l)||vr(s,l)&&i.has.call(o,s)||vr(a,l)&&i.has.call(o,a)||(o.add(l),Or(o,"add",l,l)),this},set(s,o){!t&&!Yn(o)&&!Ur(o)&&(o=St(o));const i=St(this),{has:a,get:l}=ti(i);let f=a.call(i,s);f||(s=St(s),f=a.call(i,s));const u=l.call(i,s);return i.set(s,o),f?vr(o,u)&&Or(i,"set",s,o):Or(i,"add",s,o),this},delete(s){const o=St(this),{has:i,get:a}=ti(o);let l=i.call(o,s);l||(s=St(s),l=i.call(o,s)),a&&a.call(o,s);const f=o.delete(s);return l&&Or(o,"delete",s,void 0),f},clear(){const s=St(this),o=s.size!==0,i=s.clear();return o&&Or(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Tp(s,e,t)}),n}function Rl(e,t){const n=Sp(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(At(n,s)&&s in r?n:r,s,o)}const Ip={get:Rl(!1,!1)},Ep={get:Rl(!1,!0)},Cp={get:Rl(!0,!1)};const Nd=new WeakMap,Ld=new WeakMap,Dd=new WeakMap,Ap=new WeakMap;function xp(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Rp(e){return e.__v_skip||!Object.isExtensible(e)?0:xp(ep(e))}function Fi(e){return Ur(e)?e:Pl(e,!1,bp,Ip,Nd)}function jd(e){return Pl(e,!1,kp,Ep,Ld)}function Wa(e){return Pl(e,!0,_p,Cp,Dd)}function Pl(e,t,n,r,s){if(!xt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Rp(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 $s(e){return Ur(e)?$s(e.__v_raw):!!(e&&e.__v_isReactive)}function Ur(e){return!!(e&&e.__v_isReadonly)}function Yn(e){return!!(e&&e.__v_isShallow)}function Ml(e){return e?!!e.__v_raw:!1}function St(e){const t=e&&e.__v_raw;return t?St(t):e}function Pp(e){return!At(e,"__v_skip")&&Object.isExtensible(e)&&bd(e,"__v_skip",!0),e}const ar=e=>xt(e)?Fi(e):e,no=e=>xt(e)?Wa(e):e;function wn(e){return e?e.__v_isRef===!0:!1}function j(e){return Fd(e,!1)}function Mp(e){return Fd(e,!0)}function Fd(e,t){return wn(e)?e:new $p(e,t)}class $p{constructor(t,n){this.dep=new xl,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:St(t),this._value=n?t:ar(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Yn(t)||Ur(t);t=r?t:St(t),vr(t,n)&&(this._rawValue=t,this._value=r?t:ar(t),this.dep.trigger())}}function we(e){return wn(e)?e.value:e}const Op={get:(e,t,n)=>t==="__v_raw"?e:we(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return wn(s)&&!wn(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function Bd(e){return $s(e)?e:new Proxy(e,Op)}class Np{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new xl(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Mo-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Dt!==this)return Ed(this,!0),!0}get value(){const t=this.dep.track();return xd(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function Lp(e,t,n=!1){let r,s;return nt(e)?r=e:(r=e.get,s=e.set),new Np(r,s,n)}const ri={},wi=new WeakMap;let Es;function Dp(e,t=!1,n=Es){if(n){let r=wi.get(n);r||wi.set(n,r=[]),r.push(e)}}function jp(e,t,n=Lt){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,f=ne=>s?ne:Yn(ne)||s===!1||s===0?Nr(ne,1):Nr(ne);let u,g,_,E,B=!1,M=!1;if(wn(e)?(g=()=>e.value,B=Yn(e)):$s(e)?(g=()=>f(e),B=!0):Ye(e)?(M=!0,B=e.some(ne=>$s(ne)||Yn(ne)),g=()=>e.map(ne=>{if(wn(ne))return ne.value;if($s(ne))return f(ne);if(nt(ne))return l?l(ne,2):ne()})):nt(e)?t?g=l?()=>l(e,2):e:g=()=>{if(_){Fr();try{_()}finally{Br()}}const ne=Es;Es=u;try{return l?l(e,3,[E]):e(E)}finally{Es=ne}}:g=_r,t&&s){const ne=g,ke=s===!0?1/0:s;g=()=>Nr(ne(),ke)}const Z=fp(),ce=()=>{u.stop(),Z&&Z.active&&kl(Z.effects,u)};if(o&&t){const ne=t;t=(...ke)=>{ne(...ke),ce()}}let K=M?new Array(e.length).fill(ri):ri;const te=ne=>{if(!(!(u.flags&1)||!u.dirty&&!ne))if(t){const ke=u.run();if(s||B||(M?ke.some((ge,ye)=>vr(ge,K[ye])):vr(ke,K))){_&&_();const ge=Es;Es=u;try{const ye=[ke,K===ri?void 0:M&&K[0]===ri?[]:K,E];K=ke,l?l(t,3,ye):t(...ye)}finally{Es=ge}}}else u.run()};return a&&a(te),u=new Sd(g),u.scheduler=i?()=>i(te,!1):te,E=ne=>Dp(ne,!1,u),_=u.onStop=()=>{const ne=wi.get(u);if(ne){if(l)l(ne,4);else for(const ke of ne)ke();wi.delete(u)}},t?r?te(!0):K=u.run():i?i(te.bind(null,!0),!0):u.run(),ce.pause=u.pause.bind(u),ce.resume=u.resume.bind(u),ce.stop=ce,ce}function Nr(e,t=1/0,n){if(t<=0||!xt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,wn(e))Nr(e.value,t,n);else if(Ye(e))for(let r=0;r<e.length;r++)Nr(e[r],t,n);else if(gd(e)||Ks(e))e.forEach(r=>{Nr(r,t,n)});else if(wd(e)){for(const r in e)Nr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Nr(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 Go(e,t,n,r){try{return r?e(...r):e()}catch(s){Bi(s,t,n)}}function lr(e,t,n,r){if(nt(e)){const s=Go(e,t,n,r);return s&&vd(s)&&s.catch(o=>{Bi(o,t,n)}),s}if(Ye(e)){const s=[];for(let o=0;o<e.length;o++)s.push(lr(e[o],t,n,r));return s}}function Bi(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Lt;if(t){let a=t.parent;const l=t.proxy,f=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let g=0;g<u.length;g++)if(u[g](e,l,f)===!1)return}a=a.parent}if(o){Fr(),Go(o,null,10,[e,l,f]),Br();return}}Fp(e,n,s,r,i)}function Fp(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const En=[];let hr=-1;const Js=[];let ss=null,Vs=0;const Ud=Promise.resolve();let bi=null;function Zt(e){const t=bi||Ud;return e?t.then(this?e.bind(this):e):t}function Bp(e){let t=hr+1,n=En.length;for(;t<n;){const r=t+n>>>1,s=En[r],o=Oo(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function $l(e){if(!(e.flags&1)){const t=Oo(e),n=En[En.length-1];!n||!(e.flags&2)&&t>=Oo(n)?En.push(e):En.splice(Bp(t),0,e),e.flags|=1,Hd()}}function Hd(){bi||(bi=Ud.then(Vd))}function Up(e){Ye(e)?Js.push(...e):ss&&e.id===-1?ss.splice(Vs+1,0,e):e.flags&1||(Js.push(e),e.flags|=1),Hd()}function uc(e,t,n=hr+1){for(;n<En.length;n++){const r=En[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;En.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Wd(e){if(Js.length){const t=[...new Set(Js)].sort((n,r)=>Oo(n)-Oo(r));if(Js.length=0,ss){ss.push(...t);return}for(ss=t,Vs=0;Vs<ss.length;Vs++){const n=ss[Vs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}ss=null,Vs=0}}const Oo=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Vd(e){try{for(hr=0;hr<En.length;hr++){const t=En[hr];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Go(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;hr<En.length;hr++){const t=En[hr];t&&(t.flags&=-2)}hr=-1,En.length=0,Wd(),bi=null,(En.length||Js.length)&&Vd()}}let ln=null,zd=null;function _i(e){const t=ln;return ln=e,zd=e&&e.type.__scopeId||null,t}function Et(e,t=ln,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Ii(-1);const o=_i(t);let i;try{i=e(...s)}finally{_i(o),r._d&&Ii(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Hr(e,t){if(ln===null)return e;const n=qi(ln),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=Lt]=t[s];o&&(nt(o)&&(o={mounted:o,updated:o}),o.deep&&Nr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function _s(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&&(Fr(),lr(l,n,8,[e.el,a,e,t]),Br())}}function di(e,t){if(yn){let n=yn.provides;const r=yn.parent&&yn.parent.provides;r===n&&(n=yn.provides=Object.create(r)),n[e]=t}}function sr(e,t,n=!1){const r=jl();if(r||Qs){let s=Qs?Qs._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&&nt(t)?t.call(r&&r.proxy):t}}const Hp=Symbol.for("v-scx"),Wp=()=>sr(Hp);function ft(e,t,n){return qd(e,t,n)}function qd(e,t,n=Lt){const{immediate:r,deep:s,flush:o,once:i}=n,a=en({},n),l=t&&r||!t&&o!=="post";let f;if(Fo){if(o==="sync"){const E=Wp();f=E.__watcherHandles||(E.__watcherHandles=[])}else if(!l){const E=()=>{};return E.stop=_r,E.resume=_r,E.pause=_r,E}}const u=yn;a.call=(E,B,M)=>lr(E,u,B,M);let g=!1;o==="post"?a.scheduler=E=>{mn(E,u&&u.suspense)}:o!=="sync"&&(g=!0,a.scheduler=(E,B)=>{B?E():$l(E)}),a.augmentJob=E=>{t&&(E.flags|=4),g&&(E.flags|=2,u&&(E.id=u.uid,E.i=u))};const _=jp(e,t,a);return Fo&&(f?f.push(_):l&&_()),_}function Vp(e,t,n){const r=this.proxy,s=Ht(e)?e.includes(".")?Gd(r,e):()=>r[e]:e.bind(r,r);let o;nt(t)?o=t:(o=t.handler,n=t);const i=Ko(this),a=qd(s,o.bind(r),n);return i(),a}function Gd(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 Kd=Symbol("_vte"),Jd=e=>e.__isTeleport,To=e=>e&&(e.disabled||e.disabled===""),dc=e=>e&&(e.defer||e.defer===""),fc=e=>typeof SVGElement<"u"&&e instanceof SVGElement,hc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Va=(e,t)=>{const n=e&&e.to;return Ht(n)?t?t(n):null:n},Yd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,f){const{mc:u,pc:g,pbc:_,o:{insert:E,querySelector:B,createText:M,createComment:Z}}=f,ce=To(t.props);let{shapeFlag:K,children:te,dynamicChildren:ne}=t;if(e==null){const ke=t.el=M(""),ge=t.anchor=M("");E(ke,n,r),E(ge,n,r);const ye=(ue,se)=>{K&16&&u(te,ue,se,s,o,i,a,l)},je=()=>{const ue=t.target=Va(t.props,B),se=za(ue,t,M,E);ue&&(i!=="svg"&&fc(ue)?i="svg":i!=="mathml"&&hc(ue)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(ue),ce||(ye(ue,se),fi(t,!1)))};ce&&(ye(n,ge),fi(t,!0)),dc(t.props)?(t.el.__isMounted=!1,mn(()=>{je(),delete t.el.__isMounted},o)):je()}else{if(dc(t.props)&&e.el.__isMounted===!1){mn(()=>{Yd.process(e,t,n,r,s,o,i,a,l,f)},o);return}t.el=e.el,t.targetStart=e.targetStart;const ke=t.anchor=e.anchor,ge=t.target=e.target,ye=t.targetAnchor=e.targetAnchor,je=To(e.props),ue=je?n:ge,se=je?ke:ye;if(i==="svg"||fc(ge)?i="svg":(i==="mathml"||hc(ge))&&(i="mathml"),ne?(_(e.dynamicChildren,ne,ue,s,o,i,a),Ll(e,t,!0)):l||g(e,t,ue,se,s,o,i,a,!1),ce)je?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):si(t,n,ke,f,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const de=t.target=Va(t.props,B);de&&si(t,de,null,f,0)}else je&&si(t,ge,ye,f,1);fi(t,ce)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:f,targetAnchor:u,target:g,props:_}=e;if(g&&(s(f),s(u)),o&&s(l),i&16){const E=o||!To(_);for(let B=0;B<a.length;B++){const M=a[B];r(M,t,n,E,!!M.dynamicChildren)}}},move:si,hydrate:zp};function si(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:f,props:u}=e,g=o===2;if(g&&r(i,t,n),(!g||To(u))&&l&16)for(let _=0;_<f.length;_++)s(f[_],t,n,2);g&&r(a,t,n)}function zp(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:f,createText:u}},g){function _(Z,ce){let K=ce;for(;K;){if(K&&K.nodeType===8){if(K.data==="teleport start anchor")t.targetStart=K;else if(K.data==="teleport anchor"){t.targetAnchor=K,Z._lpa=t.targetAnchor&&i(t.targetAnchor);break}}K=i(K)}}function E(Z,ce){ce.anchor=g(i(Z),ce,a(Z),n,r,s,o)}const B=t.target=Va(t.props,l),M=To(t.props);if(B){const Z=B._lpa||B.firstChild;t.shapeFlag&16&&(M?(E(e,t),_(B,Z),t.targetAnchor||za(B,t,u,f,a(e)===B?e:null)):(t.anchor=i(e),_(B,Z),t.targetAnchor||za(B,t,u,f),g(Z&&i(Z),t,B,n,r,s,o))),fi(t,M)}else M&&t.shapeFlag&16&&(E(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const So=Yd;function fi(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 za(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[Kd]=i,e&&(r(o,e,s),r(i,e,s)),i}const pr=Symbol("_leaveCb"),po=Symbol("_enterCb");function qp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Gr(()=>{e.isMounted=!0}),Kr(()=>{e.isUnmounting=!0}),e}const Kn=[Function,Array],Qd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Kn,onEnter:Kn,onAfterEnter:Kn,onEnterCancelled:Kn,onBeforeLeave:Kn,onLeave:Kn,onAfterLeave:Kn,onLeaveCancelled:Kn,onBeforeAppear:Kn,onAppear:Kn,onAfterAppear:Kn,onAppearCancelled:Kn},Xd=e=>{const t=e.subTree;return t.component?Xd(t.component):t},Gp={name:"BaseTransition",props:Qd,setup(e,{slots:t}){const n=jl(),r=qp();return()=>{const s=t.default&&tf(t.default(),!0);if(!s||!s.length)return;const o=Zd(s),i=St(e),{mode:a}=i;if(r.isLeaving)return oa(o);const l=pc(o);if(!l)return oa(o);let f=qa(l,i,r,n,g=>f=g);l.type!==vn&&No(l,f);let u=n.subTree&&pc(n.subTree);if(u&&u.type!==vn&&!As(u,l)&&Xd(n).type!==vn){let g=qa(u,i,r,n);if(No(u,g),a==="out-in"&&l.type!==vn)return r.isLeaving=!0,g.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete g.afterLeave,u=void 0},oa(o);a==="in-out"&&l.type!==vn?g.delayLeave=(_,E,B)=>{const M=ef(r,u);M[String(u.key)]=u,_[pr]=()=>{E(),_[pr]=void 0,delete f.delayedLeave,u=void 0},f.delayedLeave=()=>{B(),delete f.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return o}}};function Zd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==vn){t=n;break}}return t}const Kp=Gp;function ef(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 qa(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:f,onAfterEnter:u,onEnterCancelled:g,onBeforeLeave:_,onLeave:E,onAfterLeave:B,onLeaveCancelled:M,onBeforeAppear:Z,onAppear:ce,onAfterAppear:K,onAppearCancelled:te}=t,ne=String(e.key),ke=ef(n,e),ge=(ue,se)=>{ue&&lr(ue,r,9,se)},ye=(ue,se)=>{const de=se[1];ge(ue,se),Ye(ue)?ue.every(re=>re.length<=1)&&de():ue.length<=1&&de()},je={mode:i,persisted:a,beforeEnter(ue){let se=l;if(!n.isMounted)if(o)se=Z||l;else return;ue[pr]&&ue[pr](!0);const de=ke[ne];de&&As(e,de)&&de.el[pr]&&de.el[pr](),ge(se,[ue])},enter(ue){if(ke[ne]===e)return;let se=f,de=u,re=g;if(!n.isMounted)if(o)se=ce||f,de=K||u,re=te||g;else return;let Me=!1;ue[po]=qe=>{Me||(Me=!0,qe?ge(re,[ue]):ge(de,[ue]),je.delayedLeave&&je.delayedLeave(),ue[po]=void 0)};const Je=ue[po].bind(null,!1);se?ye(se,[ue,Je]):Je()},leave(ue,se){const de=String(e.key);if(ue[po]&&ue[po](!0),n.isUnmounting)return se();ge(_,[ue]);let re=!1;ue[pr]=Je=>{re||(re=!0,se(),Je?ge(M,[ue]):ge(B,[ue]),ue[pr]=void 0,ke[de]===e&&delete ke[de])};const Me=ue[pr].bind(null,!1);ke[de]=e,E?ye(E,[ue,Me]):Me()},clone(ue){const se=qa(ue,t,n,r,s);return s&&s(se),se}};return je}function oa(e){if(Ui(e))return e=fs(e),e.children=null,e}function pc(e){if(!Ui(e))return Jd(e.type)&&e.children?Zd(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&&nt(n.default))return n.default()}}function No(e,t){e.shapeFlag&6&&e.component?(e.transition=t,No(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 tf(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===De?(i.patchFlag&128&&s++,r=r.concat(tf(i.children,t,a))):(t||i.type!==vn)&&r.push(a!=null?fs(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function sn(e,t){return nt(e)?en({name:e.name},t,{setup:e}):e}function nf(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function mc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const ki=new WeakMap;function Io(e,t,n,r,s=!1){if(Ye(e)){e.forEach((M,Z)=>Io(M,t&&(Ye(t)?t[Z]:t),n,r,s));return}if(Ys(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Io(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?qi(r.component):r.el,i=s?null:o,{i:a,r:l}=e,f=t&&t.r,u=a.refs===Lt?a.refs={}:a.refs,g=a.setupState,_=St(g),E=g===Lt?md:M=>mc(u,M)?!1:At(_,M),B=(M,Z)=>!(Z&&mc(u,Z));if(f!=null&&f!==l){if(gc(t),Ht(f))u[f]=null,E(f)&&(g[f]=null);else if(wn(f)){const M=t;B(f,M.k)&&(f.value=null),M.k&&(u[M.k]=null)}}if(nt(l))Go(l,a,12,[i,u]);else{const M=Ht(l),Z=wn(l);if(M||Z){const ce=()=>{if(e.f){const K=M?E(l)?g[l]:u[l]:B()||!e.k?l.value:u[e.k];if(s)Ye(K)&&kl(K,o);else if(Ye(K))K.includes(o)||K.push(o);else if(M)u[l]=[o],E(l)&&(g[l]=u[l]);else{const te=[o];B(l,e.k)&&(l.value=te),e.k&&(u[e.k]=te)}}else M?(u[l]=i,E(l)&&(g[l]=i)):Z&&(B(l,e.k)&&(l.value=i),e.k&&(u[e.k]=i))};if(i){const K=()=>{ce(),ki.delete(e)};K.id=-1,ki.set(e,K),mn(K,n)}else gc(e),ce()}}}function gc(e){const t=ki.get(e);t&&(t.flags|=8,ki.delete(e))}Di().requestIdleCallback;Di().cancelIdleCallback;const Ys=e=>!!e.type.__asyncLoader,Ui=e=>e.type.__isKeepAlive;function Jp(e,t){rf(e,"a",t)}function Yp(e,t){rf(e,"da",t)}function rf(e,t,n=yn){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Hi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Ui(s.parent.vnode)&&Qp(r,t,n,s),s=s.parent}}function Qp(e,t,n,r){const s=Hi(t,e,r,!0);Wi(()=>{kl(r[t],s)},n)}function Hi(e,t,n=yn,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Fr();const a=Ko(n),l=lr(t,n,e,i);return a(),Br(),l});return r?s.unshift(o):s.push(o),o}}const qr=e=>(t,n=yn)=>{(!Fo||e==="sp")&&Hi(e,(...r)=>t(...r),n)},Xp=qr("bm"),Gr=qr("m"),Zp=qr("bu"),em=qr("u"),Kr=qr("bum"),Wi=qr("um"),tm=qr("sp"),nm=qr("rtg"),rm=qr("rtc");function sm(e,t=yn){Hi("ec",e,t)}const om="components",sf=Symbol.for("v-ndc");function Ti(e){return Ht(e)?im(om,e,!1)||e:e||sf}function im(e,t,n=!0,r=!1){const s=ln||yn;if(s){const o=s.type;{const a=Vm(o,!1);if(a&&(a===t||a===An(t)||a===Li(An(t))))return o}const i=vc(s[e]||o[e],t)||vc(s.appContext[e],t);return!i&&r?o:i}}function vc(e,t){return e&&(e[t]||e[An(t)]||e[Li(An(t))])}function mt(e,t,n,r){let s;const o=n,i=Ye(e);if(i||Ht(e)){const a=i&&$s(e);let l=!1,f=!1;a&&(l=!Yn(e),f=Ur(e),e=ji(e)),s=new Array(e.length);for(let u=0,g=e.length;u<g;u++)s[u]=t(l?f?no(ar(e[u])):ar(e[u]):e[u],u,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(xt(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,f=a.length;l<f;l++){const u=a[l];s[l]=t(e[u],u,l,o)}}else s=[];return s}function br(e,t,n={},r,s){if(ln.ce||ln.parent&&Ys(ln.parent)&&ln.parent.ce){const f=Object.keys(n).length>0;return t!=="default"&&(n.name=t),y(),wt(De,null,[Be("slot",n,r)],f?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),y();const i=o&&of(o(n)),a=n.key||i&&i.key,l=wt(De,{key:(a&&!ir(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function of(e){return e.some(t=>Do(t)?!(t.type===vn||t.type===De&&!of(t.children)):!0)?e:null}const Ga=e=>e?Ef(e)?qi(e):Ga(e.parent):null,Eo=en(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=>Ga(e.parent),$root:e=>Ga(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>lf(e),$forceUpdate:e=>e.f||(e.f=()=>{$l(e.update)}),$nextTick:e=>e.n||(e.n=Zt.bind(e.proxy)),$watch:e=>Vp.bind(e)}),ia=(e,t)=>e!==Lt&&!e.__isScriptSetup&&At(e,t),am={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 _=i[t];if(_!==void 0)switch(_){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(ia(r,t))return i[t]=1,r[t];if(s!==Lt&&At(s,t))return i[t]=2,s[t];if(At(o,t))return i[t]=3,o[t];if(n!==Lt&&At(n,t))return i[t]=4,n[t];Ka&&(i[t]=0)}}const f=Eo[t];let u,g;if(f)return t==="$attrs"&&gn(e.attrs,"get",""),f(e);if((u=a.__cssModules)&&(u=u[t]))return u;if(n!==Lt&&At(n,t))return i[t]=4,n[t];if(g=l.config.globalProperties,At(g,t))return g[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return ia(s,t)?(s[t]=n,!0):r!==Lt&&At(r,t)?(r[t]=n,!0):At(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!==Lt&&a[0]!=="$"&&At(e,a)||ia(t,a)||At(o,a)||At(r,a)||At(Eo,a)||At(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:At(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function lm(){return cm().slots}function cm(e){const t=jl();return t.setupContext||(t.setupContext=Af(t))}function yc(e){return Ye(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ka=!0;function um(e){const t=lf(e),n=e.proxy,r=e.ctx;Ka=!1,t.beforeCreate&&wc(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:f,created:u,beforeMount:g,mounted:_,beforeUpdate:E,updated:B,activated:M,deactivated:Z,beforeDestroy:ce,beforeUnmount:K,destroyed:te,unmounted:ne,render:ke,renderTracked:ge,renderTriggered:ye,errorCaptured:je,serverPrefetch:ue,expose:se,inheritAttrs:de,components:re,directives:Me,filters:Je}=t;if(f&&dm(f,r,null),i)for(const He in i){const Pe=i[He];nt(Pe)&&(r[He]=Pe.bind(n))}if(s){const He=s.call(n,n);xt(He)&&(e.data=Fi(He))}if(Ka=!0,o)for(const He in o){const Pe=o[He],rt=nt(Pe)?Pe.bind(n,n):nt(Pe.get)?Pe.get.bind(n,n):_r,Ce=!nt(Pe)&&nt(Pe.set)?Pe.set.bind(n):_r,Ue=he({get:rt,set:Ce});Object.defineProperty(r,He,{enumerable:!0,configurable:!0,get:()=>Ue.value,set:lt=>Ue.value=lt})}if(a)for(const He in a)af(a[He],r,n,He);if(l){const He=nt(l)?l.call(n):l;Reflect.ownKeys(He).forEach(Pe=>{di(Pe,He[Pe])})}u&&wc(u,e,"c");function Ge(He,Pe){Ye(Pe)?Pe.forEach(rt=>He(rt.bind(n))):Pe&&He(Pe.bind(n))}if(Ge(Xp,g),Ge(Gr,_),Ge(Zp,E),Ge(em,B),Ge(Jp,M),Ge(Yp,Z),Ge(sm,je),Ge(rm,ge),Ge(nm,ye),Ge(Kr,K),Ge(Wi,ne),Ge(tm,ue),Ye(se))if(se.length){const He=e.exposed||(e.exposed={});se.forEach(Pe=>{Object.defineProperty(He,Pe,{get:()=>n[Pe],set:rt=>n[Pe]=rt,enumerable:!0})})}else e.exposed||(e.exposed={});ke&&e.render===_r&&(e.render=ke),de!=null&&(e.inheritAttrs=de),re&&(e.components=re),Me&&(e.directives=Me),ue&&nf(e)}function dm(e,t,n=_r){Ye(e)&&(e=Ja(e));for(const r in e){const s=e[r];let o;xt(s)?"default"in s?o=sr(s.from||r,s.default,!0):o=sr(s.from||r):o=sr(s),wn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function wc(e,t,n){lr(Ye(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function af(e,t,n,r){let s=r.includes(".")?Gd(n,r):()=>n[r];if(Ht(e)){const o=t[e];nt(o)&&ft(s,o)}else if(nt(e))ft(s,e.bind(n));else if(xt(e))if(Ye(e))e.forEach(o=>af(o,t,n,r));else{const o=nt(e.handler)?e.handler.bind(n):t[e.handler];nt(o)&&ft(s,o,e)}}function lf(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(f=>Si(l,f,i,!0)),Si(l,t,i)),xt(t)&&o.set(t,l),l}function Si(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&Si(e,o,n,!0),s&&s.forEach(i=>Si(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=fm[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const fm={data:bc,props:_c,emits:_c,methods:yo,computed:yo,beforeCreate:Sn,created:Sn,beforeMount:Sn,mounted:Sn,beforeUpdate:Sn,updated:Sn,beforeDestroy:Sn,beforeUnmount:Sn,destroyed:Sn,unmounted:Sn,activated:Sn,deactivated:Sn,errorCaptured:Sn,serverPrefetch:Sn,components:yo,directives:yo,watch:pm,provide:bc,inject:hm};function bc(e,t){return t?e?function(){return en(nt(e)?e.call(this,this):e,nt(t)?t.call(this,this):t)}:t:e}function hm(e,t){return yo(Ja(e),Ja(t))}function Ja(e){if(Ye(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Sn(e,t){return e?[...new Set([].concat(e,t))]:t}function yo(e,t){return e?en(Object.create(null),e,t):t}function _c(e,t){return e?Ye(e)&&Ye(t)?[...new Set([...e,...t])]:en(Object.create(null),yc(e),yc(t??{})):t}function pm(e,t){if(!e)return t;if(!t)return e;const n=en(Object.create(null),e);for(const r in t)n[r]=Sn(e[r],t[r]);return n}function cf(){return{app:null,config:{isNativeTag:md,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 mm=0;function gm(e,t){return function(r,s=null){nt(r)||(r=en({},r)),s!=null&&!xt(s)&&(s=null);const o=cf(),i=new WeakSet,a=[];let l=!1;const f=o.app={_uid:mm++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:qm,get config(){return o.config},set config(u){},use(u,...g){return i.has(u)||(u&&nt(u.install)?(i.add(u),u.install(f,...g)):nt(u)&&(i.add(u),u(f,...g))),f},mixin(u){return o.mixins.includes(u)||o.mixins.push(u),f},component(u,g){return g?(o.components[u]=g,f):o.components[u]},directive(u,g){return g?(o.directives[u]=g,f):o.directives[u]},mount(u,g,_){if(!l){const E=f._ceVNode||Be(r,s);return E.appContext=o,_===!0?_="svg":_===!1&&(_=void 0),e(E,u,_),l=!0,f._container=u,u.__vue_app__=f,qi(E.component)}},onUnmount(u){a.push(u)},unmount(){l&&(lr(a,f._instance,16),e(null,f._container),delete f._container.__vue_app__)},provide(u,g){return o.provides[u]=g,f},runWithContext(u){const g=Qs;Qs=f;try{return u()}finally{Qs=g}}};return f}}let Qs=null;const vm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${An(t)}Modifiers`]||e[`${hs(t)}Modifiers`];function ym(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Lt;let s=n;const o=t.startsWith("update:"),i=o&&vm(r,t.slice(7));i&&(i.trim&&(s=n.map(u=>Ht(u)?u.trim():u)),i.number&&(s=n.map(Sl)));let a,l=r[a=ea(t)]||r[a=ea(An(t))];!l&&o&&(l=r[a=ea(hs(t))]),l&&lr(l,e,6,s);const f=r[a+"Once"];if(f){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,lr(f,e,6,s)}}const wm=new WeakMap;function uf(e,t,n=!1){const r=n?wm:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!nt(e)){const l=f=>{const u=uf(f,t,!0);u&&(a=!0,en(i,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(xt(e)&&r.set(e,null),null):(Ye(o)?o.forEach(l=>i[l]=null):en(i,o),xt(e)&&r.set(e,i),i)}function Vi(e,t){return!e||!Oi(t)?!1:(t=t.slice(2).replace(/Once$/,""),At(e,t[0].toLowerCase()+t.slice(1))||At(e,hs(t))||At(e,t))}function kc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:f,renderCache:u,props:g,data:_,setupState:E,ctx:B,inheritAttrs:M}=e,Z=_i(e);let ce,K;try{if(n.shapeFlag&4){const ne=s||r,ke=ne;ce=gr(f.call(ke,ne,u,g,E,_,B)),K=a}else{const ne=t;ce=gr(ne.length>1?ne(g,{attrs:a,slots:i,emit:l}):ne(g,null)),K=t.props?a:bm(a)}}catch(ne){Co.length=0,Bi(ne,e,1),ce=Be(vn)}let te=ce;if(K&&M!==!1){const ne=Object.keys(K),{shapeFlag:ke}=te;ne.length&&ke&7&&(o&&ne.some(_l)&&(K=_m(K,o)),te=fs(te,K,!1,!0))}return n.dirs&&(te=fs(te,null,!1,!0),te.dirs=te.dirs?te.dirs.concat(n.dirs):n.dirs),n.transition&&No(te,n.transition),ce=te,_i(Z),ce}const bm=e=>{let t;for(const n in e)(n==="class"||n==="style"||Oi(n))&&((t||(t={}))[n]=e[n]);return t},_m=(e,t)=>{const n={};for(const r in e)(!_l(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function km(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,f=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?Tc(r,i,f):!!i;if(l&8){const u=t.dynamicProps;for(let g=0;g<u.length;g++){const _=u[g];if(df(i,r,_)&&!Vi(f,_))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?Tc(r,i,f):!0:!!i;return!1}function Tc(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(df(t,e,o)&&!Vi(n,o))return!0}return!1}function df(e,t,n){const r=e[n],s=t[n];return n==="style"&&xt(r)&&xt(s)?!Il(r,s):r!==s}function Tm({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 ff={},hf=()=>Object.create(ff),pf=e=>Object.getPrototypeOf(e)===ff;function Sm(e,t,n,r=!1){const s={},o=hf();e.propsDefaults=Object.create(null),mf(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:jd(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function Im(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=St(s),[l]=e.propsOptions;let f=!1;if((r||i>0)&&!(i&16)){if(i&8){const u=e.vnode.dynamicProps;for(let g=0;g<u.length;g++){let _=u[g];if(Vi(e.emitsOptions,_))continue;const E=t[_];if(l)if(At(o,_))E!==o[_]&&(o[_]=E,f=!0);else{const B=An(_);s[B]=Ya(l,a,B,E,e,!1)}else E!==o[_]&&(o[_]=E,f=!0)}}}else{mf(e,t,s,o)&&(f=!0);let u;for(const g in a)(!t||!At(t,g)&&((u=hs(g))===g||!At(t,u)))&&(l?n&&(n[g]!==void 0||n[u]!==void 0)&&(s[g]=Ya(l,a,g,void 0,e,!0)):delete s[g]);if(o!==a)for(const g in o)(!t||!At(t,g))&&(delete o[g],f=!0)}f&&Or(e.attrs,"set","")}function mf(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(bo(l))continue;const f=t[l];let u;s&&At(s,u=An(l))?!o||!o.includes(u)?n[u]=f:(a||(a={}))[u]=f:Vi(e.emitsOptions,l)||(!(l in r)||f!==r[l])&&(r[l]=f,i=!0)}if(o){const l=St(n),f=a||Lt;for(let u=0;u<o.length;u++){const g=o[u];n[g]=Ya(s,l,g,f[g],e,!At(f,g))}}return i}function Ya(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=At(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&nt(l)){const{propsDefaults:f}=s;if(n in f)r=f[n];else{const u=Ko(s);r=f[n]=l.call(null,t),u()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===hs(n))&&(r=!0))}return r}const Em=new WeakMap;function gf(e,t,n=!1){const r=n?Em:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!nt(e)){const u=g=>{l=!0;const[_,E]=gf(g,t,!0);en(i,_),E&&a.push(...E)};!n&&t.mixins.length&&t.mixins.forEach(u),e.extends&&u(e.extends),e.mixins&&e.mixins.forEach(u)}if(!o&&!l)return xt(e)&&r.set(e,Gs),Gs;if(Ye(o))for(let u=0;u<o.length;u++){const g=An(o[u]);Sc(g)&&(i[g]=Lt)}else if(o)for(const u in o){const g=An(u);if(Sc(g)){const _=o[u],E=i[g]=Ye(_)||nt(_)?{type:_}:en({},_),B=E.type;let M=!1,Z=!0;if(Ye(B))for(let ce=0;ce<B.length;++ce){const K=B[ce],te=nt(K)&&K.name;if(te==="Boolean"){M=!0;break}else te==="String"&&(Z=!1)}else M=nt(B)&&B.name==="Boolean";E[0]=M,E[1]=Z,(M||At(E,"default"))&&a.push(g)}}const f=[i,a];return xt(e)&&r.set(e,f),f}function Sc(e){return e[0]!=="$"&&!bo(e)}const Ol=e=>e==="_"||e==="_ctx"||e==="$stable",Nl=e=>Ye(e)?e.map(gr):[gr(e)],Cm=(e,t,n)=>{if(t._n)return t;const r=Et((...s)=>Nl(t(...s)),n);return r._c=!1,r},vf=(e,t,n)=>{const r=e._ctx;for(const s in e){if(Ol(s))continue;const o=e[s];if(nt(o))t[s]=Cm(s,o,r);else if(o!=null){const i=Nl(o);t[s]=()=>i}}},yf=(e,t)=>{const n=Nl(t);e.slots.default=()=>n},wf=(e,t,n)=>{for(const r in t)(n||!Ol(r))&&(e[r]=t[r])},Am=(e,t,n)=>{const r=e.slots=hf();if(e.vnode.shapeFlag&32){const s=t._;s?(wf(r,t,n),n&&bd(r,"_",s,!0)):vf(t,r)}else t&&yf(e,t)},xm=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=Lt;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:wf(s,t,n):(o=!t.$stable,vf(t,s)),i=t}else t&&(yf(e,t),i={default:1});if(o)for(const a in s)!Ol(a)&&i[a]==null&&delete s[a]},mn=Om;function Rm(e){return Pm(e)}function Pm(e,t){const n=Di();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:f,setElementText:u,parentNode:g,nextSibling:_,setScopeId:E=_r,insertStaticContent:B}=e,M=(T,S,O,X=null,V=null,L=null,W=void 0,H=null,Y=!!S.dynamicChildren)=>{if(T===S)return;T&&!As(T,S)&&(X=G(T),lt(T,V,L,!0),T=null),S.patchFlag===-2&&(Y=!1,S.dynamicChildren=null);const{type:Q,ref:Ie,shapeFlag:_e}=S;switch(Q){case zi:Z(T,S,O,X);break;case vn:ce(T,S,O,X);break;case la:T==null&&K(S,O,X,W);break;case De:re(T,S,O,X,V,L,W,H,Y);break;default:_e&1?ke(T,S,O,X,V,L,W,H,Y):_e&6?Me(T,S,O,X,V,L,W,H,Y):(_e&64||_e&128)&&Q.process(T,S,O,X,V,L,W,H,Y,Ae)}Ie!=null&&V?Io(Ie,T&&T.ref,L,S||T,!S):Ie==null&&T&&T.ref!=null&&Io(T.ref,null,L,T,!0)},Z=(T,S,O,X)=>{if(T==null)r(S.el=a(S.children),O,X);else{const V=S.el=T.el;S.children!==T.children&&f(V,S.children)}},ce=(T,S,O,X)=>{T==null?r(S.el=l(S.children||""),O,X):S.el=T.el},K=(T,S,O,X)=>{[T.el,T.anchor]=B(T.children,S,O,X,T.el,T.anchor)},te=({el:T,anchor:S},O,X)=>{let V;for(;T&&T!==S;)V=_(T),r(T,O,X),T=V;r(S,O,X)},ne=({el:T,anchor:S})=>{let O;for(;T&&T!==S;)O=_(T),s(T),T=O;s(S)},ke=(T,S,O,X,V,L,W,H,Y)=>{if(S.type==="svg"?W="svg":S.type==="math"&&(W="mathml"),T==null)ge(S,O,X,V,L,W,H,Y);else{const Q=T.el&&T.el._isVueCE?T.el:null;try{Q&&Q._beginPatch(),ue(T,S,V,L,W,H,Y)}finally{Q&&Q._endPatch()}}},ge=(T,S,O,X,V,L,W,H)=>{let Y,Q;const{props:Ie,shapeFlag:_e,transition:Se,dirs:xe}=T;if(Y=T.el=i(T.type,L,Ie&&Ie.is,Ie),_e&8?u(Y,T.children):_e&16&&je(T.children,Y,null,X,V,aa(T,L),W,H),xe&&_s(T,null,X,"created"),ye(Y,T,T.scopeId,W,X),Ie){for(const ot in Ie)ot!=="value"&&!bo(ot)&&o(Y,ot,null,Ie[ot],L,X);"value"in Ie&&o(Y,"value",null,Ie.value,L),(Q=Ie.onVnodeBeforeMount)&&fr(Q,X,T)}xe&&_s(T,null,X,"beforeMount");const Ve=Mm(V,Se);Ve&&Se.beforeEnter(Y),r(Y,S,O),((Q=Ie&&Ie.onVnodeMounted)||Ve||xe)&&mn(()=>{Q&&fr(Q,X,T),Ve&&Se.enter(Y),xe&&_s(T,null,X,"mounted")},V)},ye=(T,S,O,X,V)=>{if(O&&E(T,O),X)for(let L=0;L<X.length;L++)E(T,X[L]);if(V){let L=V.subTree;if(S===L||kf(L.type)&&(L.ssContent===S||L.ssFallback===S)){const W=V.vnode;ye(T,W,W.scopeId,W.slotScopeIds,V.parent)}}},je=(T,S,O,X,V,L,W,H,Y=0)=>{for(let Q=Y;Q<T.length;Q++){const Ie=T[Q]=H?$r(T[Q]):gr(T[Q]);M(null,Ie,S,O,X,V,L,W,H)}},ue=(T,S,O,X,V,L,W)=>{const H=S.el=T.el;let{patchFlag:Y,dynamicChildren:Q,dirs:Ie}=S;Y|=T.patchFlag&16;const _e=T.props||Lt,Se=S.props||Lt;let xe;if(O&&ks(O,!1),(xe=Se.onVnodeBeforeUpdate)&&fr(xe,O,S,T),Ie&&_s(S,T,O,"beforeUpdate"),O&&ks(O,!0),(_e.innerHTML&&Se.innerHTML==null||_e.textContent&&Se.textContent==null)&&u(H,""),Q?se(T.dynamicChildren,Q,H,O,X,aa(S,V),L):W||Pe(T,S,H,null,O,X,aa(S,V),L,!1),Y>0){if(Y&16)de(H,_e,Se,O,V);else if(Y&2&&_e.class!==Se.class&&o(H,"class",null,Se.class,V),Y&4&&o(H,"style",_e.style,Se.style,V),Y&8){const Ve=S.dynamicProps;for(let ot=0;ot<Ve.length;ot++){const Ze=Ve[ot],ut=_e[Ze],bt=Se[Ze];(bt!==ut||Ze==="value")&&o(H,Ze,ut,bt,V,O)}}Y&1&&T.children!==S.children&&u(H,S.children)}else!W&&Q==null&&de(H,_e,Se,O,V);((xe=Se.onVnodeUpdated)||Ie)&&mn(()=>{xe&&fr(xe,O,S,T),Ie&&_s(S,T,O,"updated")},X)},se=(T,S,O,X,V,L,W)=>{for(let H=0;H<S.length;H++){const Y=T[H],Q=S[H],Ie=Y.el&&(Y.type===De||!As(Y,Q)||Y.shapeFlag&198)?g(Y.el):O;M(Y,Q,Ie,null,X,V,L,W,!0)}},de=(T,S,O,X,V)=>{if(S!==O){if(S!==Lt)for(const L in S)!bo(L)&&!(L in O)&&o(T,L,S[L],null,V,X);for(const L in O){if(bo(L))continue;const W=O[L],H=S[L];W!==H&&L!=="value"&&o(T,L,H,W,V,X)}"value"in O&&o(T,"value",S.value,O.value,V)}},re=(T,S,O,X,V,L,W,H,Y)=>{const Q=S.el=T?T.el:a(""),Ie=S.anchor=T?T.anchor:a("");let{patchFlag:_e,dynamicChildren:Se,slotScopeIds:xe}=S;xe&&(H=H?H.concat(xe):xe),T==null?(r(Q,O,X),r(Ie,O,X),je(S.children||[],O,Ie,V,L,W,H,Y)):_e>0&&_e&64&&Se&&T.dynamicChildren&&T.dynamicChildren.length===Se.length?(se(T.dynamicChildren,Se,O,V,L,W,H),(S.key!=null||V&&S===V.subTree)&&Ll(T,S,!0)):Pe(T,S,O,Ie,V,L,W,H,Y)},Me=(T,S,O,X,V,L,W,H,Y)=>{S.slotScopeIds=H,T==null?S.shapeFlag&512?V.ctx.activate(S,O,X,W,Y):Je(S,O,X,V,L,W,Y):qe(T,S,Y)},Je=(T,S,O,X,V,L,W)=>{const H=T.component=Bm(T,X,V);if(Ui(T)&&(H.ctx.renderer=Ae),Um(H,!1,W),H.asyncDep){if(V&&V.registerDep(H,Ge,W),!T.el){const Y=H.subTree=Be(vn);ce(null,Y,S,O),T.placeholder=Y.el}}else Ge(H,T,S,O,V,L,W)},qe=(T,S,O)=>{const X=S.component=T.component;if(km(T,S,O))if(X.asyncDep&&!X.asyncResolved){He(X,S,O);return}else X.next=S,X.update();else S.el=T.el,X.vnode=S},Ge=(T,S,O,X,V,L,W)=>{const H=()=>{if(T.isMounted){let{next:_e,bu:Se,u:xe,parent:Ve,vnode:ot}=T;{const Qe=bf(T);if(Qe){_e&&(_e.el=ot.el,He(T,_e,W)),Qe.asyncDep.then(()=>{mn(()=>{T.isUnmounted||Q()},V)});return}}let Ze=_e,ut;ks(T,!1),_e?(_e.el=ot.el,He(T,_e,W)):_e=ot,Se&&ui(Se),(ut=_e.props&&_e.props.onVnodeBeforeUpdate)&&fr(ut,Ve,_e,ot),ks(T,!0);const bt=kc(T),Rt=T.subTree;T.subTree=bt,M(Rt,bt,g(Rt.el),G(Rt),T,V,L),_e.el=bt.el,Ze===null&&Tm(T,bt.el),xe&&mn(xe,V),(ut=_e.props&&_e.props.onVnodeUpdated)&&mn(()=>fr(ut,Ve,_e,ot),V)}else{let _e;const{el:Se,props:xe}=S,{bm:Ve,m:ot,parent:Ze,root:ut,type:bt}=T,Rt=Ys(S);ks(T,!1),Ve&&ui(Ve),!Rt&&(_e=xe&&xe.onVnodeBeforeMount)&&fr(_e,Ze,S),ks(T,!0);{ut.ce&&ut.ce._hasShadowRoot()&&ut.ce._injectChildStyle(bt,T.parent?T.parent.type:void 0);const Qe=T.subTree=kc(T);M(null,Qe,O,X,T,V,L),S.el=Qe.el}if(ot&&mn(ot,V),!Rt&&(_e=xe&&xe.onVnodeMounted)){const Qe=S;mn(()=>fr(_e,Ze,Qe),V)}(S.shapeFlag&256||Ze&&Ys(Ze.vnode)&&Ze.vnode.shapeFlag&256)&&T.a&&mn(T.a,V),T.isMounted=!0,S=O=X=null}};T.scope.on();const Y=T.effect=new Sd(H);T.scope.off();const Q=T.update=Y.run.bind(Y),Ie=T.job=Y.runIfDirty.bind(Y);Ie.i=T,Ie.id=T.uid,Y.scheduler=()=>$l(Ie),ks(T,!0),Q()},He=(T,S,O)=>{S.component=T;const X=T.vnode.props;T.vnode=S,T.next=null,Im(T,S.props,X,O),xm(T,S.children,O),Fr(),uc(T),Br()},Pe=(T,S,O,X,V,L,W,H,Y=!1)=>{const Q=T&&T.children,Ie=T?T.shapeFlag:0,_e=S.children,{patchFlag:Se,shapeFlag:xe}=S;if(Se>0){if(Se&128){Ce(Q,_e,O,X,V,L,W,H,Y);return}else if(Se&256){rt(Q,_e,O,X,V,L,W,H,Y);return}}xe&8?(Ie&16&&We(Q,V,L),_e!==Q&&u(O,_e)):Ie&16?xe&16?Ce(Q,_e,O,X,V,L,W,H,Y):We(Q,V,L,!0):(Ie&8&&u(O,""),xe&16&&je(_e,O,X,V,L,W,H,Y))},rt=(T,S,O,X,V,L,W,H,Y)=>{T=T||Gs,S=S||Gs;const Q=T.length,Ie=S.length,_e=Math.min(Q,Ie);let Se;for(Se=0;Se<_e;Se++){const xe=S[Se]=Y?$r(S[Se]):gr(S[Se]);M(T[Se],xe,O,null,V,L,W,H,Y)}Q>Ie?We(T,V,L,!0,!1,_e):je(S,O,X,V,L,W,H,Y,_e)},Ce=(T,S,O,X,V,L,W,H,Y)=>{let Q=0;const Ie=S.length;let _e=T.length-1,Se=Ie-1;for(;Q<=_e&&Q<=Se;){const xe=T[Q],Ve=S[Q]=Y?$r(S[Q]):gr(S[Q]);if(As(xe,Ve))M(xe,Ve,O,null,V,L,W,H,Y);else break;Q++}for(;Q<=_e&&Q<=Se;){const xe=T[_e],Ve=S[Se]=Y?$r(S[Se]):gr(S[Se]);if(As(xe,Ve))M(xe,Ve,O,null,V,L,W,H,Y);else break;_e--,Se--}if(Q>_e){if(Q<=Se){const xe=Se+1,Ve=xe<Ie?S[xe].el:X;for(;Q<=Se;)M(null,S[Q]=Y?$r(S[Q]):gr(S[Q]),O,Ve,V,L,W,H,Y),Q++}}else if(Q>Se)for(;Q<=_e;)lt(T[Q],V,L,!0),Q++;else{const xe=Q,Ve=Q,ot=new Map;for(Q=Ve;Q<=Se;Q++){const st=S[Q]=Y?$r(S[Q]):gr(S[Q]);st.key!=null&&ot.set(st.key,Q)}let Ze,ut=0;const bt=Se-Ve+1;let Rt=!1,Qe=0;const Pt=new Array(bt);for(Q=0;Q<bt;Q++)Pt[Q]=0;for(Q=xe;Q<=_e;Q++){const st=T[Q];if(ut>=bt){lt(st,V,L,!0);continue}let _t;if(st.key!=null)_t=ot.get(st.key);else for(Ze=Ve;Ze<=Se;Ze++)if(Pt[Ze-Ve]===0&&As(st,S[Ze])){_t=Ze;break}_t===void 0?lt(st,V,L,!0):(Pt[_t-Ve]=Q+1,_t>=Qe?Qe=_t:Rt=!0,M(st,S[_t],O,null,V,L,W,H,Y),ut++)}const zt=Rt?$m(Pt):Gs;for(Ze=zt.length-1,Q=bt-1;Q>=0;Q--){const st=Ve+Q,_t=S[st],vt=S[st+1],Jt=st+1<Ie?vt.el||_f(vt):X;Pt[Q]===0?M(null,_t,O,Jt,V,L,W,H,Y):Rt&&(Ze<0||Q!==zt[Ze]?Ue(_t,O,Jt,2):Ze--)}}},Ue=(T,S,O,X,V=null)=>{const{el:L,type:W,transition:H,children:Y,shapeFlag:Q}=T;if(Q&6){Ue(T.component.subTree,S,O,X);return}if(Q&128){T.suspense.move(S,O,X);return}if(Q&64){W.move(T,S,O,Ae);return}if(W===De){r(L,S,O);for(let _e=0;_e<Y.length;_e++)Ue(Y[_e],S,O,X);r(T.anchor,S,O);return}if(W===la){te(T,S,O);return}if(X!==2&&Q&1&&H)if(X===0)H.beforeEnter(L),r(L,S,O),mn(()=>H.enter(L),V);else{const{leave:_e,delayLeave:Se,afterLeave:xe}=H,Ve=()=>{T.ctx.isUnmounted?s(L):r(L,S,O)},ot=()=>{L._isLeaving&&L[pr](!0),_e(L,()=>{Ve(),xe&&xe()})};Se?Se(L,Ve,ot):ot()}else r(L,S,O)},lt=(T,S,O,X=!1,V=!1)=>{const{type:L,props:W,ref:H,children:Y,dynamicChildren:Q,shapeFlag:Ie,patchFlag:_e,dirs:Se,cacheIndex:xe}=T;if(_e===-2&&(V=!1),H!=null&&(Fr(),Io(H,null,O,T,!0),Br()),xe!=null&&(S.renderCache[xe]=void 0),Ie&256){S.ctx.deactivate(T);return}const Ve=Ie&1&&Se,ot=!Ys(T);let Ze;if(ot&&(Ze=W&&W.onVnodeBeforeUnmount)&&fr(Ze,S,T),Ie&6)ct(T.component,O,X);else{if(Ie&128){T.suspense.unmount(O,X);return}Ve&&_s(T,null,S,"beforeUnmount"),Ie&64?T.type.remove(T,S,O,Ae,X):Q&&!Q.hasOnce&&(L!==De||_e>0&&_e&64)?We(Q,S,O,!1,!0):(L===De&&_e&384||!V&&Ie&16)&&We(Y,S,O),X&&Ft(T)}(ot&&(Ze=W&&W.onVnodeUnmounted)||Ve)&&mn(()=>{Ze&&fr(Ze,S,T),Ve&&_s(T,null,S,"unmounted")},O)},Ft=T=>{const{type:S,el:O,anchor:X,transition:V}=T;if(S===De){pt(O,X);return}if(S===la){ne(T);return}const L=()=>{s(O),V&&!V.persisted&&V.afterLeave&&V.afterLeave()};if(T.shapeFlag&1&&V&&!V.persisted){const{leave:W,delayLeave:H}=V,Y=()=>W(O,L);H?H(T.el,L,Y):Y()}else L()},pt=(T,S)=>{let O;for(;T!==S;)O=_(T),s(T),T=O;s(S)},ct=(T,S,O)=>{const{bum:X,scope:V,job:L,subTree:W,um:H,m:Y,a:Q}=T;Ic(Y),Ic(Q),X&&ui(X),V.stop(),L&&(L.flags|=8,lt(W,T,S,O)),H&&mn(H,S),mn(()=>{T.isUnmounted=!0},S)},We=(T,S,O,X=!1,V=!1,L=0)=>{for(let W=L;W<T.length;W++)lt(T[W],S,O,X,V)},G=T=>{if(T.shapeFlag&6)return G(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const S=_(T.anchor||T.el),O=S&&S[Kd];return O?_(O):S};let be=!1;const fe=(T,S,O)=>{let X;T==null?S._vnode&&(lt(S._vnode,null,null,!0),X=S._vnode.component):M(S._vnode||null,T,S,null,null,null,O),S._vnode=T,be||(be=!0,uc(X),Wd(),be=!1)},Ae={p:M,um:lt,m:Ue,r:Ft,mt:Je,mc:je,pc:Pe,pbc:se,n:G,o:e};return{render:fe,hydrate:void 0,createApp:gm(fe)}}function aa({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 ks({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Mm(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ll(e,t,n=!1){const r=e.children,s=t.children;if(Ye(r)&&Ye(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&&Ll(i,a)),a.type===zi&&(a.patchFlag===-1&&(a=s[o]=$r(a)),a.el=i.el),a.type===vn&&!a.el&&(a.el=i.el)}}function $m(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const f=e[r];if(f!==0){if(s=n[n.length-1],e[s]<f){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<f?o=a+1:i=a;f<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 bf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:bf(t)}function Ic(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function _f(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?_f(t.subTree):null}const kf=e=>e.__isSuspense;function Om(e,t){t&&t.pendingBranch?Ye(e)?t.effects.push(...e):t.effects.push(e):Up(e)}const De=Symbol.for("v-fgt"),zi=Symbol.for("v-txt"),vn=Symbol.for("v-cmt"),la=Symbol.for("v-stc"),Co=[];let Un=null;function y(e=!1){Co.push(Un=e?null:[])}function Nm(){Co.pop(),Un=Co[Co.length-1]||null}let Lo=1;function Ii(e,t=!1){Lo+=e,e<0&&Un&&t&&(Un.hasOnce=!0)}function Tf(e){return e.dynamicChildren=Lo>0?Un||Gs:null,Nm(),Lo>0&&Un&&Un.push(e),e}function k(e,t,n,r,s,o){return Tf(v(e,t,n,r,s,o,!0))}function wt(e,t,n,r,s){return Tf(Be(e,t,n,r,s,!0))}function Do(e){return e?e.__v_isVNode===!0:!1}function As(e,t){return e.type===t.type&&e.key===t.key}const Sf=({key:e})=>e??null,hi=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Ht(e)||wn(e)||nt(e)?{i:ln,r:e,k:t,f:!!n}:e:null);function v(e,t=null,n=null,r=0,s=null,o=e===De?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Sf(t),ref:t&&hi(t),scopeId:zd,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:ln};return a?(Dl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Ht(n)?8:16),Lo>0&&!i&&Un&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&Un.push(l),l}const Be=Lm;function Lm(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===sf)&&(e=vn),Do(e)){const a=fs(e,t,!0);return n&&Dl(a,n),Lo>0&&!o&&Un&&(a.shapeFlag&6?Un[Un.indexOf(e)]=a:Un.push(a)),a.patchFlag=-2,a}if(zm(e)&&(e=e.__vccOpts),t){t=Dm(t);let{class:a,style:l}=t;a&&!Ht(a)&&(t.class=tt(a)),xt(l)&&(Ml(l)&&!Ye(l)&&(l=en({},l)),t.style=cs(l))}const i=Ht(e)?1:kf(e)?128:Jd(e)?64:xt(e)?4:nt(e)?2:0;return v(e,t,n,r,s,i,o,!0)}function Dm(e){return e?Ml(e)||pf(e)?en({},e):e:null}function fs(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,f=t?If(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&Sf(f),ref:t&&t.ref?n&&o?Ye(o)?o.concat(hi(t)):[o,hi(t)]:hi(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!==De?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&&fs(e.ssContent),ssFallback:e.ssFallback&&fs(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&No(u,l.clone(u)),u}function jo(e=" ",t=0){return Be(zi,null,e,t)}function pe(e="",t=!1){return t?(y(),wt(vn,null,e)):Be(vn,null,e)}function gr(e){return e==null||typeof e=="boolean"?Be(vn):Ye(e)?Be(De,null,e.slice()):Do(e)?$r(e):Be(zi,null,String(e))}function $r(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:fs(e)}function Dl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Ye(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),Dl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!pf(t)?t._ctx=ln:s===3&&ln&&(ln.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else nt(t)?(t={default:t,_ctx:ln},n=32):(t=String(t),r&64?(n=16,t=[jo(t)]):n=8);e.children=t,e.shapeFlag|=n}function If(...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=tt([t.class,r.class]));else if(s==="style")t.style=cs([t.style,r.style]);else if(Oi(s)){const o=t[s],i=r[s];i&&o!==i&&!(Ye(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function fr(e,t,n,r=null){lr(e,t,7,[n,r])}const jm=cf();let Fm=0;function Bm(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||jm,o={uid:Fm++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new dp(!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:gf(r,s),emitsOptions:uf(r,s),emit:null,emitted:null,propsDefaults:Lt,inheritAttrs:r.inheritAttrs,ctx:Lt,data:Lt,props:Lt,attrs:Lt,slots:Lt,refs:Lt,setupState:Lt,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=ym.bind(null,o),e.ce&&e.ce(o),o}let yn=null;const jl=()=>yn||ln;let Ei,Qa;{const e=Di(),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)}};Ei=t("__VUE_INSTANCE_SETTERS__",n=>yn=n),Qa=t("__VUE_SSR_SETTERS__",n=>Fo=n)}const Ko=e=>{const t=yn;return Ei(e),e.scope.on(),()=>{e.scope.off(),Ei(t)}},Ec=()=>{yn&&yn.scope.off(),Ei(null)};function Ef(e){return e.vnode.shapeFlag&4}let Fo=!1;function Um(e,t=!1,n=!1){t&&Qa(t);const{props:r,children:s}=e.vnode,o=Ef(e);Sm(e,r,o,t),Am(e,s,n||t);const i=o?Hm(e,t):void 0;return t&&Qa(!1),i}function Hm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,am);const{setup:r}=n;if(r){Fr();const s=e.setupContext=r.length>1?Af(e):null,o=Ko(e),i=Go(r,e,0,[e.props,s]),a=vd(i);if(Br(),o(),(a||e.sp)&&!Ys(e)&&nf(e),a){if(i.then(Ec,Ec),t)return i.then(l=>{Cc(e,l)}).catch(l=>{Bi(l,e,0)});e.asyncDep=i}else Cc(e,i)}else Cf(e)}function Cc(e,t,n){nt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:xt(t)&&(e.setupState=Bd(t)),Cf(e)}function Cf(e,t,n){const r=e.type;e.render||(e.render=r.render||_r);{const s=Ko(e);Fr();try{um(e)}finally{Br(),s()}}}const Wm={get(e,t){return gn(e,"get",""),e[t]}};function Af(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Wm),slots:e.slots,emit:e.emit,expose:t}}function qi(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Bd(Pp(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Eo)return Eo[n](e)},has(t,n){return n in t||n in Eo}})):e.proxy}function Vm(e,t=!0){return nt(e)?e.displayName||e.name:e.name||t&&e.__name}function zm(e){return nt(e)&&"__vccOpts"in e}const he=(e,t)=>Lp(e,t,Fo);function Fl(e,t,n){try{Ii(-1);const r=arguments.length;return r===2?xt(t)&&!Ye(t)?Do(t)?Be(e,null,[t]):Be(e,t):Be(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Do(n)&&(n=[n]),Be(e,t,n))}finally{Ii(1)}}const qm="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 Xa;const Ac=typeof window<"u"&&window.trustedTypes;if(Ac)try{Xa=Ac.createPolicy("vue",{createHTML:e=>e})}catch{}const xf=Xa?e=>Xa.createHTML(e):e=>e,Gm="http://www.w3.org/2000/svg",Km="http://www.w3.org/1998/Math/MathML",Pr=typeof document<"u"?document:null,xc=Pr&&Pr.createElement("template"),Jm={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"?Pr.createElementNS(Gm,e):t==="mathml"?Pr.createElementNS(Km,e):n?Pr.createElement(e,{is:n}):Pr.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Pr.createTextNode(e),createComment:e=>Pr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Pr.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{xc.innerHTML=xf(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=xc.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]}},es="transition",mo="animation",Bo=Symbol("_vtc"),Rf={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},Ym=en({},Qd,Rf),Qm=e=>(e.displayName="Transition",e.props=Ym,e),Pf=Qm((e,{slots:t})=>Fl(Kp,Xm(e),t)),Ts=(e,t=[])=>{Ye(e)?e.forEach(n=>n(...t)):e&&e(...t)},Rc=e=>e?Ye(e)?e.some(t=>t.length>1):e.length>1:!1;function Xm(e){const t={};for(const re in e)re in Rf||(t[re]=e[re]);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:f=i,appearToClass:u=a,leaveFromClass:g=`${n}-leave-from`,leaveActiveClass:_=`${n}-leave-active`,leaveToClass:E=`${n}-leave-to`}=e,B=Zm(s),M=B&&B[0],Z=B&&B[1],{onBeforeEnter:ce,onEnter:K,onEnterCancelled:te,onLeave:ne,onLeaveCancelled:ke,onBeforeAppear:ge=ce,onAppear:ye=K,onAppearCancelled:je=te}=t,ue=(re,Me,Je,qe)=>{re._enterCancelled=qe,Ss(re,Me?u:a),Ss(re,Me?f:i),Je&&Je()},se=(re,Me)=>{re._isLeaving=!1,Ss(re,g),Ss(re,E),Ss(re,_),Me&&Me()},de=re=>(Me,Je)=>{const qe=re?ye:K,Ge=()=>ue(Me,re,Je);Ts(qe,[Me,Ge]),Pc(()=>{Ss(Me,re?l:o),xr(Me,re?u:a),Rc(qe)||Mc(Me,r,M,Ge)})};return en(t,{onBeforeEnter(re){Ts(ce,[re]),xr(re,o),xr(re,i)},onBeforeAppear(re){Ts(ge,[re]),xr(re,l),xr(re,f)},onEnter:de(!1),onAppear:de(!0),onLeave(re,Me){re._isLeaving=!0;const Je=()=>se(re,Me);xr(re,g),re._enterCancelled?(xr(re,_),Nc(re)):(Nc(re),xr(re,_)),Pc(()=>{re._isLeaving&&(Ss(re,g),xr(re,E),Rc(ne)||Mc(re,r,Z,Je))}),Ts(ne,[re,Je])},onEnterCancelled(re){ue(re,!1,void 0,!0),Ts(te,[re])},onAppearCancelled(re){ue(re,!0,void 0,!0),Ts(je,[re])},onLeaveCancelled(re){se(re),Ts(ke,[re])}})}function Zm(e){if(e==null)return null;if(xt(e))return[ca(e.enter),ca(e.leave)];{const t=ca(e);return[t,t]}}function ca(e){return rp(e)}function xr(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Bo]||(e[Bo]=new Set)).add(t)}function Ss(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Bo];n&&(n.delete(t),n.size||(e[Bo]=void 0))}function Pc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let eg=0;function Mc(e,t,n,r){const s=e._endId=++eg,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=tg(e,t);if(!i)return r();const f=i+"end";let u=0;const g=()=>{e.removeEventListener(f,_),o()},_=E=>{E.target===e&&++u>=l&&g()};setTimeout(()=>{u<l&&g()},a+1),e.addEventListener(f,_)}function tg(e,t){const n=window.getComputedStyle(e),r=B=>(n[B]||"").split(", "),s=r(`${es}Delay`),o=r(`${es}Duration`),i=$c(s,o),a=r(`${mo}Delay`),l=r(`${mo}Duration`),f=$c(a,l);let u=null,g=0,_=0;t===es?i>0&&(u=es,g=i,_=o.length):t===mo?f>0&&(u=mo,g=f,_=l.length):(g=Math.max(i,f),u=g>0?i>f?es:mo:null,_=u?u===es?o.length:l.length:0);const E=u===es&&/\b(?:transform|all)(?:,|$)/.test(r(`${es}Property`).toString());return{type:u,timeout:g,propCount:_,hasTransform:E}}function $c(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Oc(n)+Oc(e[r])))}function Oc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Nc(e){return(e?e.ownerDocument:document).body.offsetHeight}function ng(e,t,n){const r=e[Bo];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Lc=Symbol("_vod"),rg=Symbol("_vsh"),sg=Symbol(""),og=/(?:^|;)\s*display\s*:/;function ig(e,t,n){const r=e.style,s=Ht(n);let o=!1;if(n&&!s){if(t)if(Ht(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&pi(r,a,"")}else for(const i in t)n[i]==null&&pi(r,i,"");for(const i in n)i==="display"&&(o=!0),pi(r,i,n[i])}else if(s){if(t!==n){const i=r[sg];i&&(n+=";"+i),r.cssText=n,o=og.test(n)}}else t&&e.removeAttribute("style");Lc in e&&(e[Lc]=o?r.display:"",e[rg]&&(r.display="none"))}const Dc=/\s*!important$/;function pi(e,t,n){if(Ye(n))n.forEach(r=>pi(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=ag(e,t);Dc.test(n)?e.setProperty(hs(r),n.replace(Dc,""),"important"):e[r]=n}}const jc=["Webkit","Moz","ms"],ua={};function ag(e,t){const n=ua[t];if(n)return n;let r=An(t);if(r!=="filter"&&r in e)return ua[t]=r;r=Li(r);for(let s=0;s<jc.length;s++){const o=jc[s]+r;if(o in e)return ua[t]=o}return t}const Fc="http://www.w3.org/1999/xlink";function Bc(e,t,n,r,s,o=cp(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Fc,t.slice(6,t.length)):e.setAttributeNS(Fc,t,n):n==null||o&&!_d(n)?e.removeAttribute(t):e.setAttribute(t,o?"":ir(n)?String(n):n)}function Uc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?xf(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=_d(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 zs(e,t,n,r){e.addEventListener(t,n,r)}function lg(e,t,n,r){e.removeEventListener(t,n,r)}const Hc=Symbol("_vei");function cg(e,t,n,r,s=null){const o=e[Hc]||(e[Hc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=ug(t);if(r){const f=o[t]=hg(r,s);zs(e,a,f,l)}else i&&(lg(e,a,i,l),o[t]=void 0)}}const Wc=/(?:Once|Passive|Capture)$/;function ug(e){let t;if(Wc.test(e)){t={};let r;for(;r=e.match(Wc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):hs(e.slice(2)),t]}let da=0;const dg=Promise.resolve(),fg=()=>da||(dg.then(()=>da=0),da=Date.now());function hg(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;lr(pg(r,n.value),t,5,[r])};return n.value=e,n.attached=fg(),n}function pg(e,t){if(Ye(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 Vc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,mg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?ng(e,r,i):t==="style"?ig(e,n,r):Oi(t)?_l(t)||cg(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):gg(e,t,r,i))?(Uc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Bc(e,t,r,i,o,t!=="value")):e._isVueCE&&(vg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Ht(r)))?Uc(e,An(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Bc(e,t,r,i))};function gg(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Vc(t)&&nt(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 Vc(t)&&Ht(n)?!1:t in e}function vg(e,t){const n=e._def.props;if(!n)return!1;const r=An(t);return Array.isArray(n)?n.some(s=>An(s)===r):Object.keys(n).some(s=>An(s)===r)}const zc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ye(t)?n=>ui(t,n):t};function yg(e){e.target.composing=!0}function qc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const fa=Symbol("_assign");function Gc(e,t,n){return t&&(e=e.trim()),n&&(e=Sl(e)),e}const Wr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[fa]=zc(s);const o=r||s.props&&s.props.type==="number";zs(e,t?"change":"input",i=>{i.target.composing||e[fa](Gc(e.value,n,o))}),(n||o)&&zs(e,"change",()=>{e.value=Gc(e.value,n,o)}),t||(zs(e,"compositionstart",yg),zs(e,"compositionend",qc),zs(e,"change",qc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[fa]=zc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?Sl(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))}},wg=["ctrl","shift","alt","meta"],bg={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)=>wg.some(n=>e[`${n}Key`]&&!t.includes(n))},Tt=(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=bg[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},_g={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Cn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=hs(s.key);if(t.some(i=>i===o||_g[i]===o))return e(s)}))},kg=en({patchProp:mg},Jm);let Kc;function Tg(){return Kc||(Kc=Rm(kg))}const Sg=((...e)=>{const t=Tg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=Eg(r);if(!s)return;const o=t._component;!nt(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,Ig(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function Ig(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Eg(e){return Ht(e)?document.querySelector(e):e}/*!
18
+ * vue-router v4.6.4
19
+ * (c) 2025 Eduardo San Martin Morote
20
+ * @license MIT
21
+ */const qs=typeof document<"u";function Mf(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function Cg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Mf(e.default)}const Ct=Object.assign;function ha(e,t){const n={};for(const r in t){const s=t[r];n[r]=cr(s)?s.map(e):e(s)}return n}const Ao=()=>{},cr=Array.isArray;function Jc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const $f=/#/g,Ag=/&/g,xg=/\//g,Rg=/=/g,Pg=/\?/g,Of=/\+/g,Mg=/%5B/g,$g=/%5D/g,Nf=/%5E/g,Og=/%60/g,Lf=/%7B/g,Ng=/%7C/g,Df=/%7D/g,Lg=/%20/g;function Bl(e){return e==null?"":encodeURI(""+e).replace(Ng,"|").replace(Mg,"[").replace($g,"]")}function Dg(e){return Bl(e).replace(Lf,"{").replace(Df,"}").replace(Nf,"^")}function Za(e){return Bl(e).replace(Of,"%2B").replace(Lg,"+").replace($f,"%23").replace(Ag,"%26").replace(Og,"`").replace(Lf,"{").replace(Df,"}").replace(Nf,"^")}function jg(e){return Za(e).replace(Rg,"%3D")}function Fg(e){return Bl(e).replace($f,"%23").replace(Pg,"%3F")}function Bg(e){return Fg(e).replace(xg,"%2F")}function Uo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Ug=/\/$/,Hg=e=>e.replace(Ug,"");function pa(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=qg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:Uo(i)}}function Wg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Yc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Vg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&ro(t.matched[r],n.matched[s])&&jf(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function ro(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function jf(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!zg(e[n],t[n]))return!1;return!0}function zg(e,t){return cr(e)?Qc(e,t):cr(t)?Qc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Qc(e,t){return cr(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function qg(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 ts={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let el=(function(e){return e.pop="pop",e.push="push",e})({}),ma=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Gg(e){if(!e)if(qs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Hg(e)}const Kg=/^[^#]+#/;function Jg(e,t){return e.replace(Kg,"#")+t}function Yg(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 Gi=()=>({left:window.scrollX,top:window.scrollY});function Qg(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=Yg(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 Xc(e,t){return(history.state?history.state.position-t:-1)+e}const tl=new Map;function Xg(e,t){tl.set(e,t)}function Zg(e){const t=tl.get(e);return tl.delete(e),t}function ev(e){return typeof e=="string"||e&&typeof e=="object"}function Ff(e){return typeof e=="string"||typeof e=="symbol"}let Vt=(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 Bf=Symbol("");Vt.MATCHER_NOT_FOUND+"",Vt.NAVIGATION_GUARD_REDIRECT+"",Vt.NAVIGATION_ABORTED+"",Vt.NAVIGATION_CANCELLED+"",Vt.NAVIGATION_DUPLICATED+"";function so(e,t){return Ct(new Error,{type:e,[Bf]:!0},t)}function Rr(e,t){return e instanceof Error&&Bf in e&&(t==null||!!(e.type&t))}const tv=["params","query","hash"];function nv(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of tv)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function rv(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(Of," "),o=s.indexOf("="),i=Uo(o<0?s:s.slice(0,o)),a=o<0?null:Uo(s.slice(o+1));if(i in t){let l=t[i];cr(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Zc(e){let t="";for(let n in e){const r=e[n];if(n=jg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(cr(r)?r.map(s=>s&&Za(s)):[r&&Za(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function sv(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=cr(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const ov=Symbol(""),eu=Symbol(""),Ki=Symbol(""),Ul=Symbol(""),nl=Symbol("");function go(){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 os(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const f=_=>{_===!1?l(so(Vt.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?l(_):ev(_)?l(so(Vt.NAVIGATION_GUARD_REDIRECT,{from:t,to:_})):(i&&r.enterCallbacks[s]===i&&typeof _=="function"&&i.push(_),a())},u=o(()=>e.call(r&&r.instances[s],t,n,f));let g=Promise.resolve(u);e.length<3&&(g=g.then(f)),g.catch(_=>l(_))})}function ga(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(Mf(l)){const f=(l.__vccOpts||l)[t];f&&o.push(os(f,n,r,i,a,s))}else{let f=l();o.push(()=>f.then(u=>{if(!u)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const g=Cg(u)?u.default:u;i.mods[a]=u,i.components[a]=g;const _=(g.__vccOpts||g)[t];return _&&os(_,n,r,i,a,s)()}))}}return o}function iv(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(f=>ro(f,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(f=>ro(f,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 av=()=>location.protocol+"//"+location.host;function Uf(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),Yc(a,"")}return Yc(n,e)+r+s}function lv(e,t,n,r){let s=[],o=[],i=null;const a=({state:_})=>{const E=Uf(e,location),B=n.value,M=t.value;let Z=0;if(_){if(n.value=E,t.value=_,i&&i===B){i=null;return}Z=M?_.position-M.position:0}else r(E);s.forEach(ce=>{ce(n.value,B,{delta:Z,type:el.pop,direction:Z?Z>0?ma.forward:ma.back:ma.unknown})})};function l(){i=n.value}function f(_){s.push(_);const E=()=>{const B=s.indexOf(_);B>-1&&s.splice(B,1)};return o.push(E),E}function u(){if(document.visibilityState==="hidden"){const{history:_}=window;if(!_.state)return;_.replaceState(Ct({},_.state,{scroll:Gi()}),"")}}function g(){for(const _ of o)_();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",u),document.removeEventListener("visibilitychange",u)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",u),document.addEventListener("visibilitychange",u),{pauseListeners:l,listen:f,destroy:g}}function tu(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Gi():null}}function cv(e){const{history:t,location:n}=window,r={value:Uf(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,f,u){const g=e.indexOf("#"),_=g>-1?(n.host&&document.querySelector("base")?e:e.slice(g))+l:av()+e+l;try{t[u?"replaceState":"pushState"](f,"",_),s.value=f}catch(E){console.error(E),n[u?"replace":"assign"](_)}}function i(l,f){o(l,Ct({},t.state,tu(s.value.back,l,s.value.forward,!0),f,{position:s.value.position}),!0),r.value=l}function a(l,f){const u=Ct({},s.value,t.state,{forward:l,scroll:Gi()});o(u.current,u,!0),o(l,Ct({},tu(r.value,l,null),{position:u.position+1},f),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function uv(e){e=Gg(e);const t=cv(e),n=lv(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=Ct({location:"",base:e,go:r,createHref:Jg.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 dv(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),uv(e)}let Rs=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Xt=(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})(Xt||{});const fv={type:Rs.Static,value:""},hv=/[a-zA-Z0-9_]/;function pv(e){if(!e)return[[]];if(e==="/")return[[fv]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(E){throw new Error(`ERR (${n})/"${f}": ${E}`)}let n=Xt.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,f="",u="";function g(){f&&(n===Xt.Static?o.push({type:Rs.Static,value:f}):n===Xt.Param||n===Xt.ParamRegExp||n===Xt.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${f}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Rs.Param,value:f,regexp:u,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),f="")}function _(){f+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Xt.ParamRegExp){r=n,n=Xt.EscapeNext;continue}switch(n){case Xt.Static:l==="/"?(f&&g(),i()):l===":"?(g(),n=Xt.Param):_();break;case Xt.EscapeNext:_(),n=r;break;case Xt.Param:l==="("?n=Xt.ParamRegExp:hv.test(l)?_():(g(),n=Xt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Xt.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=Xt.ParamRegExpEnd:u+=l;break;case Xt.ParamRegExpEnd:g(),n=Xt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===Xt.ParamRegExp&&t(`Unfinished custom RegExp for param "${f}"`),g(),i(),s}const nu="[^/]+?",mv={sensitive:!1,strict:!1,start:!0,end:!0};var In=(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})(In||{});const gv=/[.+*?^${}()[\]/\\]/g;function vv(e,t){const n=Ct({},mv,t),r=[];let s=n.start?"^":"";const o=[];for(const f of e){const u=f.length?[]:[In.Root];n.strict&&!f.length&&(s+="/");for(let g=0;g<f.length;g++){const _=f[g];let E=In.Segment+(n.sensitive?In.BonusCaseSensitive:0);if(_.type===Rs.Static)g||(s+="/"),s+=_.value.replace(gv,"\\$&"),E+=In.Static;else if(_.type===Rs.Param){const{value:B,repeatable:M,optional:Z,regexp:ce}=_;o.push({name:B,repeatable:M,optional:Z});const K=ce||nu;if(K!==nu){E+=In.BonusCustomRegExp;try{`${K}`}catch(ne){throw new Error(`Invalid custom RegExp for param "${B}" (${K}): `+ne.message)}}let te=M?`((?:${K})(?:/(?:${K}))*)`:`(${K})`;g||(te=Z&&f.length<2?`(?:/${te})`:"/"+te),Z&&(te+="?"),s+=te,E+=In.Dynamic,Z&&(E+=In.BonusOptional),M&&(E+=In.BonusRepeatable),K===".*"&&(E+=In.BonusWildcard)}u.push(E)}r.push(u)}if(n.strict&&n.end){const f=r.length-1;r[f][r[f].length-1]+=In.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(f){const u=f.match(i),g={};if(!u)return null;for(let _=1;_<u.length;_++){const E=u[_]||"",B=o[_-1];g[B.name]=E&&B.repeatable?E.split("/"):E}return g}function l(f){let u="",g=!1;for(const _ of e){(!g||!u.endsWith("/"))&&(u+="/"),g=!1;for(const E of _)if(E.type===Rs.Static)u+=E.value;else if(E.type===Rs.Param){const{value:B,repeatable:M,optional:Z}=E,ce=B in f?f[B]:"";if(cr(ce)&&!M)throw new Error(`Provided param "${B}" is an array but it is not repeatable (* or + modifiers)`);const K=cr(ce)?ce.join("/"):ce;if(!K)if(Z)_.length<2&&(u.endsWith("/")?u=u.slice(0,-1):g=!0);else throw new Error(`Missing required param "${B}"`);u+=K}}return u||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function yv(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]===In.Static+In.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===In.Static+In.Segment?1:-1:0}function Hf(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=yv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(ru(r))return 1;if(ru(s))return-1}return s.length-r.length}function ru(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const wv={strict:!1,end:!0,sensitive:!1};function bv(e,t,n){const r=vv(pv(e.path),n),s=Ct(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function _v(e,t){const n=[],r=new Map;t=Jc(wv,t);function s(g){return r.get(g)}function o(g,_,E){const B=!E,M=ou(g);M.aliasOf=E&&E.record;const Z=Jc(t,g),ce=[M];if("alias"in g){const ne=typeof g.alias=="string"?[g.alias]:g.alias;for(const ke of ne)ce.push(ou(Ct({},M,{components:E?E.record.components:M.components,path:ke,aliasOf:E?E.record:M})))}let K,te;for(const ne of ce){const{path:ke}=ne;if(_&&ke[0]!=="/"){const ge=_.record.path,ye=ge[ge.length-1]==="/"?"":"/";ne.path=_.record.path+(ke&&ye+ke)}if(K=bv(ne,_,Z),E?E.alias.push(K):(te=te||K,te!==K&&te.alias.push(K),B&&g.name&&!iu(K)&&i(g.name)),Wf(K)&&l(K),M.children){const ge=M.children;for(let ye=0;ye<ge.length;ye++)o(ge[ye],K,E&&E.children[ye])}E=E||K}return te?()=>{i(te)}:Ao}function i(g){if(Ff(g)){const _=r.get(g);_&&(r.delete(g),n.splice(n.indexOf(_),1),_.children.forEach(i),_.alias.forEach(i))}else{const _=n.indexOf(g);_>-1&&(n.splice(_,1),g.record.name&&r.delete(g.record.name),g.children.forEach(i),g.alias.forEach(i))}}function a(){return n}function l(g){const _=Sv(g,n);n.splice(_,0,g),g.record.name&&!iu(g)&&r.set(g.record.name,g)}function f(g,_){let E,B={},M,Z;if("name"in g&&g.name){if(E=r.get(g.name),!E)throw so(Vt.MATCHER_NOT_FOUND,{location:g});Z=E.record.name,B=Ct(su(_.params,E.keys.filter(te=>!te.optional).concat(E.parent?E.parent.keys.filter(te=>te.optional):[]).map(te=>te.name)),g.params&&su(g.params,E.keys.map(te=>te.name))),M=E.stringify(B)}else if(g.path!=null)M=g.path,E=n.find(te=>te.re.test(M)),E&&(B=E.parse(M),Z=E.record.name);else{if(E=_.name?r.get(_.name):n.find(te=>te.re.test(_.path)),!E)throw so(Vt.MATCHER_NOT_FOUND,{location:g,currentLocation:_});Z=E.record.name,B=Ct({},_.params,g.params),M=E.stringify(B)}const ce=[];let K=E;for(;K;)ce.unshift(K.record),K=K.parent;return{name:Z,path:M,params:B,matched:ce,meta:Tv(ce)}}e.forEach(g=>o(g));function u(){n.length=0,r.clear()}return{addRoute:o,resolve:f,removeRoute:i,clearRoutes:u,getRoutes:a,getRecordMatcher:s}}function su(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function ou(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:kv(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 kv(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 iu(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Tv(e){return e.reduce((t,n)=>Ct(t,n.meta),{})}function Sv(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;Hf(e,t[o])<0?r=o:n=o+1}const s=Iv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function Iv(e){let t=e;for(;t=t.parent;)if(Wf(t)&&Hf(e,t)===0)return t}function Wf({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function au(e){const t=sr(Ki),n=sr(Ul),r=he(()=>{const l=we(e.to);return t.resolve(l)}),s=he(()=>{const{matched:l}=r.value,{length:f}=l,u=l[f-1],g=n.matched;if(!u||!g.length)return-1;const _=g.findIndex(ro.bind(null,u));if(_>-1)return _;const E=lu(l[f-2]);return f>1&&lu(u)===E&&g[g.length-1].path!==E?g.findIndex(ro.bind(null,l[f-2])):_}),o=he(()=>s.value>-1&&Rv(n.params,r.value.params)),i=he(()=>s.value>-1&&s.value===n.matched.length-1&&jf(n.params,r.value.params));function a(l={}){if(xv(l)){const f=t[we(e.replace)?"replace":"push"](we(e.to)).catch(Ao);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>f),f}return Promise.resolve()}return{route:r,href:he(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function Ev(e){return e.length===1?e[0]:e}const Cv=sn({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:au,setup(e,{slots:t}){const n=Fi(au(e)),{options:r}=sr(Ki),s=he(()=>({[cu(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[cu(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&Ev(t.default(n));return e.custom?o:Fl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Av=Cv;function xv(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 Rv(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(!cr(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function lu(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const cu=(e,t,n)=>e??t??n,Pv=sn({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=sr(nl),s=he(()=>e.route||r.value),o=sr(eu,0),i=he(()=>{let f=we(o);const{matched:u}=s.value;let g;for(;(g=u[f])&&!g.components;)f++;return f}),a=he(()=>s.value.matched[i.value]);di(eu,he(()=>i.value+1)),di(ov,a),di(nl,s);const l=j();return ft(()=>[l.value,a.value,e.name],([f,u,g],[_,E,B])=>{u&&(u.instances[g]=f,E&&E!==u&&f&&f===_&&(u.leaveGuards.size||(u.leaveGuards=E.leaveGuards),u.updateGuards.size||(u.updateGuards=E.updateGuards))),f&&u&&(!E||!ro(u,E)||!_)&&(u.enterCallbacks[g]||[]).forEach(M=>M(f))},{flush:"post"}),()=>{const f=s.value,u=e.name,g=a.value,_=g&&g.components[u];if(!_)return uu(n.default,{Component:_,route:f});const E=g.props[u],B=E?E===!0?f.params:typeof E=="function"?E(f):E:null,Z=Fl(_,Ct({},B,t,{onVnodeUnmounted:ce=>{ce.component.isUnmounted&&(g.instances[u]=null)},ref:l}));return uu(n.default,{Component:Z,route:f})||Z}}});function uu(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Mv=Pv;function $v(e){const t=_v(e.routes,e),n=e.parseQuery||rv,r=e.stringifyQuery||Zc,s=e.history,o=go(),i=go(),a=go(),l=Mp(ts);let f=ts;qs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=ha.bind(null,G=>""+G),g=ha.bind(null,Bg),_=ha.bind(null,Uo);function E(G,be){let fe,Ae;return Ff(G)?(fe=t.getRecordMatcher(G),Ae=be):Ae=G,t.addRoute(Ae,fe)}function B(G){const be=t.getRecordMatcher(G);be&&t.removeRoute(be)}function M(){return t.getRoutes().map(G=>G.record)}function Z(G){return!!t.getRecordMatcher(G)}function ce(G,be){if(be=Ct({},be||l.value),typeof G=="string"){const O=pa(n,G,be.path),X=t.resolve({path:O.path},be),V=s.createHref(O.fullPath);return Ct(O,X,{params:_(X.params),hash:Uo(O.hash),redirectedFrom:void 0,href:V})}let fe;if(G.path!=null)fe=Ct({},G,{path:pa(n,G.path,be.path).path});else{const O=Ct({},G.params);for(const X in O)O[X]==null&&delete O[X];fe=Ct({},G,{params:g(O)}),be.params=g(be.params)}const Ae=t.resolve(fe,be),Ee=G.hash||"";Ae.params=u(_(Ae.params));const T=Wg(r,Ct({},G,{hash:Dg(Ee),path:Ae.path})),S=s.createHref(T);return Ct({fullPath:T,hash:Ee,query:r===Zc?sv(G.query):G.query||{}},Ae,{redirectedFrom:void 0,href:S})}function K(G){return typeof G=="string"?pa(n,G,l.value.path):Ct({},G)}function te(G,be){if(f!==G)return so(Vt.NAVIGATION_CANCELLED,{from:be,to:G})}function ne(G){return ye(G)}function ke(G){return ne(Ct(K(G),{replace:!0}))}function ge(G,be){const fe=G.matched[G.matched.length-1];if(fe&&fe.redirect){const{redirect:Ae}=fe;let Ee=typeof Ae=="function"?Ae(G,be):Ae;return typeof Ee=="string"&&(Ee=Ee.includes("?")||Ee.includes("#")?Ee=K(Ee):{path:Ee},Ee.params={}),Ct({query:G.query,hash:G.hash,params:Ee.path!=null?{}:G.params},Ee)}}function ye(G,be){const fe=f=ce(G),Ae=l.value,Ee=G.state,T=G.force,S=G.replace===!0,O=ge(fe,Ae);if(O)return ye(Ct(K(O),{state:typeof O=="object"?Ct({},Ee,O.state):Ee,force:T,replace:S}),be||fe);const X=fe;X.redirectedFrom=be;let V;return!T&&Vg(r,Ae,fe)&&(V=so(Vt.NAVIGATION_DUPLICATED,{to:X,from:Ae}),Ue(Ae,Ae,!0,!1)),(V?Promise.resolve(V):se(X,Ae)).catch(L=>Rr(L)?Rr(L,Vt.NAVIGATION_GUARD_REDIRECT)?L:Ce(L):Pe(L,X,Ae)).then(L=>{if(L){if(Rr(L,Vt.NAVIGATION_GUARD_REDIRECT))return ye(Ct({replace:S},K(L.to),{state:typeof L.to=="object"?Ct({},Ee,L.to.state):Ee,force:T}),be||X)}else L=re(X,Ae,!0,S,Ee);return de(X,Ae,L),L})}function je(G,be){const fe=te(G,be);return fe?Promise.reject(fe):Promise.resolve()}function ue(G){const be=pt.values().next().value;return be&&typeof be.runWithContext=="function"?be.runWithContext(G):G()}function se(G,be){let fe;const[Ae,Ee,T]=iv(G,be);fe=ga(Ae.reverse(),"beforeRouteLeave",G,be);for(const O of Ae)O.leaveGuards.forEach(X=>{fe.push(os(X,G,be))});const S=je.bind(null,G,be);return fe.push(S),We(fe).then(()=>{fe=[];for(const O of o.list())fe.push(os(O,G,be));return fe.push(S),We(fe)}).then(()=>{fe=ga(Ee,"beforeRouteUpdate",G,be);for(const O of Ee)O.updateGuards.forEach(X=>{fe.push(os(X,G,be))});return fe.push(S),We(fe)}).then(()=>{fe=[];for(const O of T)if(O.beforeEnter)if(cr(O.beforeEnter))for(const X of O.beforeEnter)fe.push(os(X,G,be));else fe.push(os(O.beforeEnter,G,be));return fe.push(S),We(fe)}).then(()=>(G.matched.forEach(O=>O.enterCallbacks={}),fe=ga(T,"beforeRouteEnter",G,be,ue),fe.push(S),We(fe))).then(()=>{fe=[];for(const O of i.list())fe.push(os(O,G,be));return fe.push(S),We(fe)}).catch(O=>Rr(O,Vt.NAVIGATION_CANCELLED)?O:Promise.reject(O))}function de(G,be,fe){a.list().forEach(Ae=>ue(()=>Ae(G,be,fe)))}function re(G,be,fe,Ae,Ee){const T=te(G,be);if(T)return T;const S=be===ts,O=qs?history.state:{};fe&&(Ae||S?s.replace(G.fullPath,Ct({scroll:S&&O&&O.scroll},Ee)):s.push(G.fullPath,Ee)),l.value=G,Ue(G,be,fe,S),Ce()}let Me;function Je(){Me||(Me=s.listen((G,be,fe)=>{if(!ct.listening)return;const Ae=ce(G),Ee=ge(Ae,ct.currentRoute.value);if(Ee){ye(Ct(Ee,{replace:!0,force:!0}),Ae).catch(Ao);return}f=Ae;const T=l.value;qs&&Xg(Xc(T.fullPath,fe.delta),Gi()),se(Ae,T).catch(S=>Rr(S,Vt.NAVIGATION_ABORTED|Vt.NAVIGATION_CANCELLED)?S:Rr(S,Vt.NAVIGATION_GUARD_REDIRECT)?(ye(Ct(K(S.to),{force:!0}),Ae).then(O=>{Rr(O,Vt.NAVIGATION_ABORTED|Vt.NAVIGATION_DUPLICATED)&&!fe.delta&&fe.type===el.pop&&s.go(-1,!1)}).catch(Ao),Promise.reject()):(fe.delta&&s.go(-fe.delta,!1),Pe(S,Ae,T))).then(S=>{S=S||re(Ae,T,!1),S&&(fe.delta&&!Rr(S,Vt.NAVIGATION_CANCELLED)?s.go(-fe.delta,!1):fe.type===el.pop&&Rr(S,Vt.NAVIGATION_ABORTED|Vt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),de(Ae,T,S)}).catch(Ao)}))}let qe=go(),Ge=go(),He;function Pe(G,be,fe){Ce(G);const Ae=Ge.list();return Ae.length?Ae.forEach(Ee=>Ee(G,be,fe)):console.error(G),Promise.reject(G)}function rt(){return He&&l.value!==ts?Promise.resolve():new Promise((G,be)=>{qe.add([G,be])})}function Ce(G){return He||(He=!G,Je(),qe.list().forEach(([be,fe])=>G?fe(G):be()),qe.reset()),G}function Ue(G,be,fe,Ae){const{scrollBehavior:Ee}=e;if(!qs||!Ee)return Promise.resolve();const T=!fe&&Zg(Xc(G.fullPath,0))||(Ae||!fe)&&history.state&&history.state.scroll||null;return Zt().then(()=>Ee(G,be,T)).then(S=>S&&Qg(S)).catch(S=>Pe(S,G,be))}const lt=G=>s.go(G);let Ft;const pt=new Set,ct={currentRoute:l,listening:!0,addRoute:E,removeRoute:B,clearRoutes:t.clearRoutes,hasRoute:Z,getRoutes:M,resolve:ce,options:e,push:ne,replace:ke,go:lt,back:()=>lt(-1),forward:()=>lt(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Ge.add,isReady:rt,install(G){G.component("RouterLink",Av),G.component("RouterView",Mv),G.config.globalProperties.$router=ct,Object.defineProperty(G.config.globalProperties,"$route",{enumerable:!0,get:()=>we(l)}),qs&&!Ft&&l.value===ts&&(Ft=!0,ne(s.location).catch(Ae=>{}));const be={};for(const Ae in ts)Object.defineProperty(be,Ae,{get:()=>l.value[Ae],enumerable:!0});G.provide(Ki,ct),G.provide(Ul,jd(be)),G.provide(nl,l);const fe=G.unmount;pt.add(G),G.unmount=function(){pt.delete(G),pt.size<1&&(f=ts,Me&&Me(),Me=null,l.value=ts,Ft=!1,He=!1),fe()}}};function We(G){return G.reduce((be,fe)=>be.then(()=>ue(fe)),Promise.resolve())}return ct}function Ov(){return sr(Ki)}function Nv(e){return sr(Ul)}const du=768;function Vf(){const e=j(typeof window<"u"?window.innerWidth<du:!1);let t=null;function n(r){e.value=r.matches}return Gr(()=>{t=window.matchMedia(`(max-width: ${du-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),Wi(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const Lv={key:0,class:"desktop-sidebar"},Dv={class:"desktop-main"},fu="codex-web-local.sidebar-width.v1",jv=260,Fv=620,hu=320,Bv=sn({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Vf();function r(f){return Math.min(Fv,Math.max(jv,f))}function s(){if(typeof window>"u")return hu;const f=window.localStorage.getItem(fu),u=Number(f);return Number.isFinite(u)?r(u):hu}const o=j(s()),i=he(()=>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(f){typeof window>"u"||window.localStorage.setItem(fu,String(f))}function l(f){f.preventDefault();const u=f.clientX,g=o.value,_=B=>{const M=B.clientX-u;o.value=r(g+M)},E=()=>{a(o.value),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",E)}return(f,u)=>(y(),k("div",{class:tt(["desktop-layout",{"is-mobile":we(n)}]),style:cs(i.value)},[we(n)?(y(),wt(So,{key:0,to:"body"},[Be(Pf,{name:"drawer"},{default:Et(()=>[e.isSidebarCollapsed?pe("",!0):(y(),k("div",{key:0,class:"mobile-drawer-backdrop",onClick:u[1]||(u[1]=g=>f.$emit("close-sidebar"))},[v("aside",{class:"mobile-drawer",onClick:u[0]||(u[0]=Tt(()=>{},["stop"]))},[br(f.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):pe("",!0),we(n)?pe("",!0):(y(),k(De,{key:1},[e.isSidebarCollapsed?pe("",!0):(y(),k("aside",Lv,[br(f.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?pe("",!0):(y(),k("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),v("section",Dv,[br(f.$slots,"content",{},void 0)])],6))}}),gt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Uv=gt(Bv,[["__scopeId","data-v-068d06c5"]]),Hv={},Wv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Vv(e,t){return y(),k("svg",Wv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const Ji=gt(Hv,[["render",Vv]]),zv={},qv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Gv(e,t){return y(),k("svg",qv,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const zf=gt(zv,[["render",Gv]]),Kv={},Jv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Yv(e,t){return y(),k("svg",Jv,[...t[0]||(t[0]=[v("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 vo=gt(Kv,[["render",Yv]]),Qv={},Xv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Zv(e,t){return y(),k("svg",Xv,[...t[0]||(t[0]=[v("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 Ci=gt(Qv,[["render",Zv]]),ey={},ty={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ny(e,t){return y(),k("svg",ty,[...t[0]||(t[0]=[v("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 Hl=gt(ey,[["render",ny]]),ry={},sy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function oy(e,t){return y(),k("svg",sy,[...t[0]||(t[0]=[v("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 iy=gt(ry,[["render",oy]]),ay={},ly={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function cy(e,t){return y(),k("svg",ly,[...t[0]||(t[0]=[v("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 xo=gt(ay,[["render",cy]]),uy={},dy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function fy(e,t){return y(),k("svg",dy,[...t[0]||(t[0]=[v("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 va=gt(uy,[["render",fy]]),hy={key:0,class:"sidebar-menu-row-left"},py={class:"sidebar-menu-row-main"},my={key:1,class:"sidebar-menu-row-right"},gy={key:0,class:"sidebar-menu-row-right-default"},vy={key:1,class:"sidebar-menu-row-right-hover"},yy=sn({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=lm(),r=he(()=>!!n.left),s=he(()=>!!n.right),o=he(()=>!!n["right-hover"]),i=he(()=>s.value||o.value);return(a,l)=>(y(),wt(Ti(t.as),If({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:Et(()=>[r.value?(y(),k("span",hy,[br(a.$slots,"left",{},void 0,!0)])):pe("",!0),v("span",py,[br(a.$slots,"default",{},void 0,!0)]),i.value?(y(),k("span",my,[s.value?(y(),k("span",gy,[br(a.$slots,"right",{},void 0,!0)])):pe("",!0),o.value?(y(),k("span",vy,[br(a.$slots,"right-hover",{},void 0,!0)])):pe("",!0)])):pe("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Is=gt(yy,[["__scopeId","data-v-36239f39"]]),wy={class:"thread-tree-root"},by={key:0,class:"pinned-section"},_y={class:"thread-list"},ky=["data-menu-open"],Ty={class:"thread-left-stack"},Sy=["data-state"],Iy=["onClick"],Ey=["onClick"],Cy={class:"thread-row-title-wrap"},Ay={class:"thread-row-title"},xy={class:"thread-row-time"},Ry=["onClick"],Py=["aria-expanded"],My=["data-active"],$y={key:0},Oy=["data-active"],Ny={key:0},Ly={key:1,class:"thread-tree-no-results"},Dy={key:2,class:"thread-tree-loading"},jy={key:3,class:"thread-list thread-list-global"},Fy=["data-menu-open"],By={class:"thread-left-stack"},Uy=["data-state"],Hy=["onClick"],Wy=["onClick"],Vy={class:"thread-row-title-wrap"},zy={class:"thread-row-title"},qy={class:"thread-row-time"},Gy=["onClick"],Ky=["data-project-name","data-expanded","data-dragging"],Jy={class:"project-icon-stack"},Yy={class:"project-icon-folder"},Qy={class:"project-icon-chevron"},Xy=["data-dragging-handle","onMousedown"],Zy={class:"project-title"},ew={class:"project-hover-controls"},tw=["onClick"],nw=["data-open-direction"],rw=["onClick"],sw=["onClick"],ow=["onClick"],iw=["onInput"],aw=["aria-label","title","onClick"],lw={key:0,class:"thread-list"},cw=["data-menu-open"],uw={class:"thread-left-stack"},dw=["data-state"],fw=["onClick"],hw=["onClick"],pw={class:"thread-row-title-wrap"},mw={class:"thread-row-title"},gw={class:"thread-row-time"},vw=["onClick"],yw=["onClick"],ww=["data-open-direction"],bw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},_w=["onKeydown"],kw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},Tw={class:"rename-thread-subtitle"},Sw=4,pu=6,mu="codex-web-local.thread-view-mode.v1",gu="codex-web-local.collapsed-projects.v1",Iw=sn({__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=j({}),o=j({}),i=j([]),a=j(""),l=j(""),f=j({}),u=j({}),g=j({}),_=j("actions"),E=j(""),B=j(!1),M=j(""),Z=j(""),ce=j(null),K=j(!1),te=j(""),ne=j(""),ke=j(null),ge=j(null),ye=j(null);let je=null,ue=null;const se=j(""),de=j({}),re=new Map,Me=new Map,Je=new Map,qe=new WeakMap,Ge=j(null),He=j(null),Pe=j(!1),rt=j(lt()),Ce=typeof window<"u"?new ResizeObserver(I=>{for(const R of I){const $=R.target,ee=qe.get($);ee&&On(ee,$)}}):null;function Ue(){if(typeof window>"u")return{};try{const I=window.localStorage.getItem(gu);if(!I)return{};const R=JSON.parse(I);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function lt(){return typeof window>"u"?"project":window.localStorage.getItem(mu)==="chronological"?"chronological":"project"}o.value=Ue(),ft(o,I=>{typeof window>"u"||window.localStorage.setItem(gu,JSON.stringify(I))},{deep:!0}),ft(rt,I=>{typeof window>"u"||window.localStorage.setItem(mu,I)});const Ft=he(()=>n.searchQuery.trim().toLowerCase()),pt=he(()=>Ft.value.length>0),ct=he(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function We(I){if(!pt.value)return!0;if(ct.value)return ct.value.has(I.id);const R=Ft.value;return I.title.toLowerCase().includes(R)||I.preview.toLowerCase().includes(R)}const G=he(()=>pt.value?n.groups.map(I=>({...I,threads:I.threads.filter(We)})).filter(I=>I.threads.length>0):n.groups),be=he(()=>rt.value==="chronological"),fe=he(()=>{const I=G.value,R=[];for(const $ of I)for(const ee of $.threads)W(ee.id)||R.push(ee);return R.sort(($,ee)=>{const Fe=new Date($.updatedAtIso||$.createdAtIso).getTime();return new Date(ee.updatedAtIso||ee.createdAtIso).getTime()-Fe})}),Ae=he(()=>{const I=new Map;for(const R of n.groups)for(const $ of R.threads)I.set($.id,$);return I}),Ee=he(()=>{const I=l.value;return I?Ae.value.get(I)??null:null}),T=he(()=>i.value.map(I=>Ae.value.get(I)??null).filter(I=>I!==null).filter(We)),S=he(()=>{const I=ye.value;if(!I||I.dropTargetIndexFull===null||n.groups.length===0)return null;const R=Math.max(0,Math.min(I.dropTargetIndexFull,n.groups.length)),$=R>I.fromIndex?R-1:R,ee=Math.max(0,Math.min($,n.groups.length-1));return ee===I.fromIndex?null:ee}),O=he(()=>{const R=(pt.value?G.value:n.groups).map(Gt=>Gt.projectName),$=ye.value,ee=S.value;if(!$||ee===null)return R;const Fe=[...R],[yt]=Fe.splice($.fromIndex,1);return yt?(Fe.splice(ee,0,yt),Fe):R}),X=he(()=>{const I={};let R=0;for(const $ of O.value)I[$]=R,R+=on($);return I}),V=he(()=>{let I=0;for(const R of O.value)I+=on(R);return{height:`${Math.max(0,I)}px`}});function L(I){const R=new Date(I).getTime();if(Number.isNaN(R))return"n/a";const $=Math.abs(Date.now()-R);if($<6e4)return"now";const ee=Math.floor($/6e4);if(ee<60)return`${ee}m`;const Fe=Math.floor(ee/60);return Fe<24?`${Fe}h`:`${Math.floor(Fe/24)}d`}function W(I){return i.value.includes(I)}function H(I){if(W(I)){i.value=i.value.filter(R=>R!==I);return}i.value=[I,...i.value]}function Y(I){r("select",I)}function Q(I){r("export-thread",I),xe()}function Ie(I){return`start new thread ${Pt(I)}`}function _e(I){r("start-new-thread",I)}function Se(I){return l.value===I}function xe(){l.value="",g.value={}}function Ve(I){if(l.value===I){xe();return}st(),Pe.value=!1,l.value=I,Zt(()=>{Re(I)})}function ot(I,R){M.value=I,Z.value=R,B.value=!0,xe(),Zt(()=>{var $,ee;($=ce.value)==null||$.focus(),(ee=ce.value)==null||ee.select()})}function Ze(){B.value=!1,M.value="",Z.value=""}function ut(){const I=M.value,R=Z.value.trim();!I||!R||(r("rename-thread",{threadId:I,title:R}),Ze())}function bt(I,R){te.value=I,ne.value=R,K.value=!0,xe()}function Rt(){K.value=!1,te.value="",ne.value=""}function Qe(){const I=te.value;I&&(i.value=i.value.filter(R=>R!==I),r("archive",I),Rt())}function Pt(I){return n.projectDisplayNameById[I]??I}function zt(I){return a.value===I}function st(){a.value="",_.value="actions",E.value=""}function _t(){const I=!Pe.value;I&&(st(),xe()),Pe.value=I}function vt(I){rt.value=I,Pe.value=!1}function Jt(I){if(a.value===I){st();return}xe(),Pe.value=!1,a.value=I,_.value="actions",E.value=Pt(I),Zt(()=>{Mn(I)})}function kt(I){xe(),a.value=I,_.value="rename",E.value=Pt(I),Zt(()=>{Mn(I)})}function Mt(I){r("rename-project",{projectName:I,displayName:E.value})}function Hn(I){r("remove-project",I),st()}function un(I){r("browse-project-files",I),st()}function Bt(I,R){if(!I.altKey||I.key!=="ArrowUp"&&I.key!=="ArrowDown")return;const $=n.groups.findIndex(yt=>yt.projectName===R);if($<0)return;const ee=I.key==="ArrowUp"?-1:1,Fe=Math.max(0,Math.min($+ee,n.groups.length-1));Fe!==$&&(I.preventDefault(),r("reorder-project",{projectName:R,toIndex:Fe}))}function tn(I){return s.value[I]===!0}function It(I){return o.value[I]===!0}function Rn(I){s.value={...s.value,[I]:!tn(I)}}function $t(I){if(se.value===I){se.value="";return}o.value={...o.value,[I]:!It(I)}}function on(I){const R=de.value[I]??0,$=ye.value,Fe=(($==null?void 0:$.projectName)===I?$.groupHeight:null)??R,yt=It(I)?0:pu;return Math.max(0,Fe+yt)}function nn(I,R){const $=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if($){Me.set(I,$);return}Me.delete(I)}function rn(I,R){const $=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if($){Je.set(I,$);return}Je.delete(I)}function bn(I){let R=I.parentElement;for(;R;){const $=window.getComputedStyle(R),ee=$.overflowY||$.overflow;if(ee==="auto"||ee==="scroll"||ee==="hidden"||ee==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function dn(I,R){const $=I.getBoundingClientRect(),ee=bn(I),Fe=6,yt=ee.bottom-$.bottom,Gt=$.top-ee.top;return yt>=R+Fe?"down":Gt>yt?"up":"down"}function Xn(I,R){const $=Je.get(I);if(!$)return"down";const ee=dn($,R);return u.value={...u.value,[I]:ee},ee}function Pn(I){return u.value[I]??"down"}function Mn(I){const R=Me.get(I);R&&(f.value={...f.value,[I]:dn(R,112)})}function $e(I,R,$){return Math.min(Math.max(I,R),$)}function Re(I){const R=Je.get(I);if(!R)return;const $=He.value,ee=$==null?void 0:$.getBoundingClientRect(),Fe=(ee==null?void 0:ee.height)||($==null?void 0:$.offsetHeight)||112,yt=(ee==null?void 0:ee.width)||($==null?void 0:$.offsetWidth)||160,Gt=Xn(I,Fe),fn=R.getBoundingClientRect(),Wt=8,Kt=4,hn=Math.max(Wt,window.innerWidth-yt-Wt),Gn=$e(fn.right-yt,Wt,hn),Ir=$e(Gt==="up"?fn.top-Fe-Kt:fn.bottom+Kt,Wt,Math.max(Wt,window.innerHeight-Fe-Wt));g.value={left:`${Math.round(Gn)}px`,top:`${Math.round(Ir)}px`}}function _n(){const I=l.value;I&&Re(I)}function qt(){window.addEventListener("resize",_n),document.addEventListener("scroll",_n,!0)}function Zn(){window.removeEventListener("resize",_n),document.removeEventListener("scroll",_n,!0)}function Wn(I){const R=a.value;if(!R)return!1;const $=Me.get(R);if(!$)return!1;if((typeof I.composedPath=="function"?I.composedPath():[]).includes($))return!0;const Fe=I.target;return Fe instanceof Node?$.contains(Fe):!1}function Dn(I){const R=l.value;if(!R)return!1;const $=Je.get(R);if(!$)return!1;if((typeof I.composedPath=="function"?I.composedPath():[]).includes($))return!0;const Fe=I.target;return Fe instanceof Node?$.contains(Fe):!1}function Vn(I){if(Pe.value){const R=Ge.value,$=typeof I.composedPath=="function"?I.composedPath():[];!!R&&($.includes(R)||I.target instanceof Node&&R.contains(I.target))||(Pe.value=!1)}a.value&&(Wn(I)||st(),l.value&&(Dn(I)||xe()))}function zn(I){a.value&&!Wn(I)&&st(),l.value&&!Dn(I)&&xe()}function kn(){Pe.value&&(Pe.value=!1),a.value&&st(),l.value&&xe()}function qn(){window.addEventListener("pointerdown",Vn,{capture:!0}),window.addEventListener("focusin",zn,{capture:!0}),window.addEventListener("blur",kn)}function $n(){window.removeEventListener("pointerdown",Vn,{capture:!0}),window.removeEventListener("focusin",zn,{capture:!0}),window.removeEventListener("blur",kn)}function On(I,R){const $=R.getBoundingClientRect().height;if(!Number.isFinite($)||$<=0)return;const ee=de.value[I];ee!==void 0&&Math.abs(ee-$)<.5||(de.value={...de.value,[I]:$})}function A(I,R){const $=re.get(I);$&&$!==R&&Ce&&Ce.unobserve($);const ee=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(ee){re.set(I,ee),qe.set(ee,I),On(I,ee),Ce==null||Ce.observe(ee);return}$&&(Ce==null||Ce.unobserve($)),re.delete(I)}function U(I,R){if(I.button!==0||ge.value||ye.value)return;const $=n.groups.findIndex(Gt=>Gt.projectName===R),ee=re.get(R);if($<0||!ee)return;const Fe=ee.getBoundingClientRect(),yt=It(R)?0:pu;ge.value={projectName:R,fromIndex:$,startClientX:I.clientX,startClientY:I.clientY,pointerOffsetY:I.clientY-Fe.top,groupLeft:Fe.left,groupWidth:Fe.width,groupHeight:Fe.height,groupOuterHeight:Fe.height+yt},I.preventDefault(),ae()}function ae(){window.addEventListener("mousemove",it),window.addEventListener("mouseup",ht),window.addEventListener("keydown",dt)}function Oe(){window.removeEventListener("mousemove",it),window.removeEventListener("mouseup",ht),window.removeEventListener("keydown",dt)}function it(I){je={clientX:I.clientX,clientY:I.clientY},jn()}function ht(I){Yt({clientX:I.clientX,clientY:I.clientY});const R=ye.value;if(R&&S.value!==null){const $=n.groups.findIndex(ee=>ee.projectName===R.projectName);if($>=0){const ee=S.value;ee!==$&&r("reorder-project",{projectName:R.projectName,toIndex:ee})}}jt()}function dt(I){I.key==="Escape"&&(!ge.value&&!ye.value||(I.preventDefault(),jt()))}function jt(){ue!==null&&(window.cancelAnimationFrame(ue),ue=null),je=null,ge.value=null,ye.value=null,se.value="",Oe()}function jn(){ue===null&&(ue=window.requestAnimationFrame(()=>{if(ue=null,!je)return;const I=je;je=null,Yt(I)}))}function Yt(I){const R=ge.value;if(!ye.value&&R){const $=I.clientX-R.startClientX,ee=I.clientY-R.startClientY;if(Math.hypot($,ee)<Sw)return;st(),se.value=R.projectName,ye.value={projectName:R.projectName,fromIndex:R.fromIndex,pointerOffsetY:R.pointerOffsetY,groupLeft:R.groupLeft,groupWidth:R.groupWidth,groupHeight:R.groupHeight,groupOuterHeight:R.groupOuterHeight,ghostTop:I.clientY-R.pointerOffsetY,dropTargetIndexFull:null}}ye.value&&Jr(I)}function Jr(I){const R=ye.value;if(!R)return;if(R.ghostTop=I.clientY-R.pointerOffsetY,!ur(I)){R.dropTargetIndexFull=null;return}const $=I.clientY,ee=ke.value;if(!ee){R.dropTargetIndexFull=null;return}const Fe=ee.getBoundingClientRect(),yt=new Map(n.groups.map((Kt,hn)=>[Kt.projectName,hn])),Gt=n.groups.map(Kt=>Kt.projectName).filter(Kt=>Kt!==R.projectName);let fn=0,Wt=n.groups.length;for(const Kt of Gt){const hn=yt.get(Kt);if(hn===void 0)continue;const Gn=on(Kt),Ir=Fe.top+fn+Gn/2;if($<Ir){Wt=hn;break}fn+=Gn}R.dropTargetIndexFull=Wt}function ur(I){const R=ke.value;if(!R)return!1;const $=R.getBoundingClientRect(),ee=I.clientX>=$.left&&I.clientX<=$.right,Fe=I.clientY>=$.top-32&&I.clientY<=$.bottom+32;return ee&&Fe}function Yr(I){var R;return((R=ye.value)==null?void 0:R.projectName)===I}function Qr(I){const R=ye.value,$=X.value[I]??0,ee=a.value===I;return!R||R.projectName!==I?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ee?"40":"1",transform:`translate3d(0, ${$}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${R.groupLeft}px`,width:`${R.groupWidth}px`,height:`${R.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${R.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function Fn(I){return I.threads.filter(R=>!W(R.id))}function gs(I){if(pt.value)return Fn(I);if(It(I.projectName))return[];const R=Fn(I);return tn(I.projectName)?R:R.slice(0,10)}function Xr(I){return pt.value?!1:!It(I.projectName)&&Fn(I).length>10}function Nn(I){return Fn(I).length>0}function Sr(I){return I.inProgress?"working":I.unread?"unread":"idle"}ft(()=>n.groups.map(I=>I.projectName),I=>{var Fe,yt;const R=((Fe=ye.value)==null?void 0:Fe.projectName)??((yt=ge.value)==null?void 0:yt.projectName)??"";R&&!n.groups.some(Gt=>Gt.projectName===R)&&jt();const $=new Set(I),ee=Object.fromEntries(Object.entries(de.value).filter(([Gt])=>$.has(Gt)));Object.keys(ee).length!==Object.keys(de.value).length&&(de.value=ee)});const vs=he(()=>Pe.value||a.value!==""||l.value!=="");return ft(vs,I=>{if(I){qn();return}$n()}),ft(l,I=>{if(!I){Zn();return}qt(),Zt(()=>{Re(I)})}),Kr(()=>{for(const I of re.values())Ce==null||Ce.unobserve(I);re.clear(),Me.clear(),Zn(),$n(),jt()}),(I,R)=>(y(),k("section",wy,[T.value.length>0?(y(),k("section",by,[v("ul",_y,[(y(!0),k(De,null,mt(T.value,$=>(y(),k("li",{key:$.id,class:"thread-row-item","data-menu-open":Se($.id)?"true":"false"},[Be(Is,{class:"thread-row","data-active":$.id===e.selectedThreadId,"data-pinned":W($.id),"data-menu-open":Se($.id)?"true":"false","force-right-hover":Se($.id)},{left:Et(()=>[v("span",Ty,[$.inProgress||$.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Sr($)},null,8,Sy)):pe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ee=>H($.id)},[Be(va,{class:"thread-icon"})],8,Iy)])]),right:Et(()=>[v("span",xy,J(L($.createdAtIso||$.updatedAtIso)),1)]),"right-hover":Et(()=>[v("div",{ref_for:!0,ref:ee=>rn($.id,ee),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Tt(ee=>Ve($.id),["stop"])},[Be(vo,{class:"thread-icon"})],8,Ry)],512)]),default:Et(()=>[v("button",{class:"thread-main-button",type:"button",onClick:ee=>Y($.id)},[v("span",Cy,[v("span",Ay,J($.title),1),$.hasWorktree?(y(),wt(xo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):pe("",!0)])],8,Ey)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,ky))),128))])])):pe("",!0),Be(Is,{as:"header",class:"thread-tree-header-row"},{right:Et(()=>[v("div",{ref_key:"organizeMenuWrapRef",ref:Ge,class:"organize-menu-wrap"},[v("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Pe.value,"aria-label":"Organize threads",title:"Organize threads",onClick:_t},[Be(vo,{class:"thread-icon"})],8,Py),Pe.value?(y(),k("div",{key:0,class:"organize-menu-panel",onClick:R[2]||(R[2]=Tt(()=>{},["stop"]))},[R[12]||(R[12]=v("p",{class:"organize-menu-title"},"Organize",-1)),v("button",{class:"organize-menu-item","data-active":rt.value==="project",type:"button",onClick:R[0]||(R[0]=$=>vt("project"))},[R[10]||(R[10]=v("span",null,"By project",-1)),rt.value==="project"?(y(),k("span",$y,"✓")):pe("",!0)],8,My),v("button",{class:"organize-menu-item","data-active":rt.value==="chronological",type:"button",onClick:R[1]||(R[1]=$=>vt("chronological"))},[R[11]||(R[11]=v("span",null,"Chronological list",-1)),rt.value==="chronological"?(y(),k("span",Ny,"✓")):pe("",!0)],8,Oy)])):pe("",!0)],512)]),default:Et(()=>[R[13]||(R[13]=v("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),pt.value&&G.value.length===0?(y(),k("p",Ly,"No matching threads")):e.isLoading&&e.groups.length===0?(y(),k("p",Dy,"Loading threads...")):be.value?(y(),k("ul",jy,[(y(!0),k(De,null,mt(fe.value,$=>(y(),k("li",{key:$.id,class:"thread-row-item","data-menu-open":Se($.id)?"true":"false"},[Be(Is,{class:"thread-row","data-active":$.id===e.selectedThreadId,"data-pinned":W($.id),"data-menu-open":Se($.id)?"true":"false","force-right-hover":Se($.id)},{left:Et(()=>[v("span",By,[$.inProgress||$.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Sr($)},null,8,Uy)):pe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ee=>H($.id)},[Be(va,{class:"thread-icon"})],8,Hy)])]),right:Et(()=>[v("span",qy,J(L($.createdAtIso||$.updatedAtIso)),1)]),"right-hover":Et(()=>[v("div",{ref_for:!0,ref:ee=>rn($.id,ee),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Tt(ee=>Ve($.id),["stop"])},[Be(vo,{class:"thread-icon"})],8,Gy)],512)]),default:Et(()=>[v("button",{class:"thread-main-button",type:"button",onClick:ee=>Y($.id)},[v("span",Vy,[v("span",zy,J($.title),1),$.hasWorktree?(y(),wt(xo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):pe("",!0)])],8,Wy)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,Fy))),128))])):(y(),k("div",{key:4,ref_key:"groupsContainerRef",ref:ke,class:"thread-tree-groups",style:cs(V.value)},[(y(!0),k(De,null,mt(G.value,$=>(y(),k("article",{key:$.projectName,ref_for:!0,ref:ee=>A($.projectName,ee),class:"project-group","data-project-name":$.projectName,"data-expanded":!It($.projectName),"data-dragging":Yr($.projectName),style:cs(Qr($.projectName))},[Be(Is,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:ee=>$t($.projectName),onKeydown:[ee=>Bt(ee,$.projectName),Cn(Tt(ee=>$t($.projectName),["prevent"]),["enter"]),Cn(Tt(ee=>$t($.projectName),["prevent"]),["space"])]},{left:Et(()=>[v("span",Jy,[v("span",Yy,[It($.projectName)?(y(),wt(Hl,{key:0,class:"thread-icon"})):(y(),wt(iy,{key:1,class:"thread-icon"}))]),v("span",Qy,[It($.projectName)?(y(),wt(zf,{key:0,class:"thread-icon"})):(y(),wt(Ji,{key:1,class:"thread-icon"}))])])]),right:Et(()=>[v("div",ew,[v("div",{ref_for:!0,ref:ee=>nn($.projectName,ee),class:"project-menu-wrap"},[v("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:Tt(ee=>Jt($.projectName),["stop"])},[Be(vo,{class:"thread-icon"})],8,tw),zt($.projectName)?(y(),k("div",{key:0,class:"project-menu-panel","data-open-direction":f.value[$.projectName]??"down",onClick:R[4]||(R[4]=Tt(()=>{},["stop"]))},[_.value==="actions"?(y(),k(De,{key:0},[v("button",{class:"project-menu-item",type:"button",onClick:ee=>un($.projectName)}," Browse files ",8,rw),v("button",{class:"project-menu-item",type:"button",onClick:ee=>kt($.projectName)}," Edit name ",8,sw),v("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:ee=>Hn($.projectName)}," Remove ",8,ow)],64)):(y(),k(De,{key:1},[R[14]||(R[14]=v("label",{class:"project-menu-label"},"Project name",-1)),Hr(v("input",{"onUpdate:modelValue":R[3]||(R[3]=ee=>E.value=ee),class:"project-menu-input",type:"text",onInput:ee=>Mt($.projectName)},null,40,iw),[[Wr,E.value]])],64))],8,nw)):pe("",!0)],512),v("button",{class:"thread-start-button",type:"button","aria-label":Ie($.projectName),title:Ie($.projectName),onClick:Tt(ee=>_e($.projectName),["stop"])},[Be(Ci,{class:"thread-icon"})],8,aw)])]),default:Et(()=>[v("span",{class:"project-main-button","data-dragging-handle":Yr($.projectName),onMousedown:Tt(ee=>U(ee,$.projectName),["left"])},[v("span",Zy,J(Pt($.projectName)),1)],40,Xy)]),_:2},1032,["onClick","onKeydown"]),Nn($)?(y(),k("ul",lw,[(y(!0),k(De,null,mt(gs($),ee=>(y(),k("li",{key:ee.id,class:"thread-row-item","data-menu-open":Se(ee.id)?"true":"false"},[Be(Is,{class:"thread-row","data-active":ee.id===e.selectedThreadId,"data-pinned":W(ee.id),"data-menu-open":Se(ee.id)?"true":"false","force-right-hover":Se(ee.id)},{left:Et(()=>[v("span",uw,[ee.inProgress||ee.unread?(y(),k("span",{key:0,class:"thread-status-indicator","data-state":Sr(ee)},null,8,dw)):pe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Fe=>H(ee.id)},[Be(va,{class:"thread-icon"})],8,fw)])]),right:Et(()=>[v("span",gw,J(L(ee.createdAtIso||ee.updatedAtIso)),1)]),"right-hover":Et(()=>[v("div",{ref_for:!0,ref:Fe=>rn(ee.id,Fe),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:Tt(Fe=>Ve(ee.id),["stop"])},[Be(vo,{class:"thread-icon"})],8,vw)],512)]),default:Et(()=>[v("button",{class:"thread-main-button",type:"button",onClick:Fe=>Y(ee.id)},[v("span",pw,[v("span",mw,J(ee.title),1),ee.hasWorktree?(y(),wt(xo,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):pe("",!0)])],8,hw)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,cw))),128))])):(y(),wt(Is,{key:1,as:"p",class:"project-empty-row"},{left:Et(()=>[...R[15]||(R[15]=[v("span",{class:"project-empty-spacer"},null,-1)])]),default:Et(()=>[R[16]||(R[16]=v("span",{class:"project-empty"},"No threads",-1))]),_:1})),Xr($)?(y(),wt(Is,{key:2,class:"thread-show-more-row"},{left:Et(()=>[...R[17]||(R[17]=[v("span",{class:"thread-show-more-spacer"},null,-1)])]),default:Et(()=>[v("button",{class:"thread-show-more-button",type:"button",onClick:ee=>Rn($.projectName)},J(tn($.projectName)?"Show less":"Show more"),9,yw)]),_:2},1024)):pe("",!0)],12,Ky))),128))],4)),(y(),wt(So,{to:"body"},[Ee.value?(y(),k("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:He,class:"thread-menu-panel thread-menu-panel-fixed",style:cs(g.value),"data-open-direction":Pn(Ee.value.id),onClick:R[8]||(R[8]=Tt(()=>{},["stop"]))},[v("button",{class:"thread-menu-item",type:"button",onClick:R[5]||(R[5]=$=>Q(Ee.value.id))}," Export chat "),v("button",{class:"thread-menu-item",type:"button",onClick:R[6]||(R[6]=$=>ot(Ee.value.id,Ee.value.title))}," Rename thread "),v("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[7]||(R[7]=$=>bt(Ee.value.id,Ee.value.title))}," Delete thread ")],12,ww)):pe("",!0)])),(y(),wt(So,{to:"body"},[B.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:Tt(Ze,["self"])},[v("div",bw,[R[18]||(R[18]=v("h3",{class:"rename-thread-title"},"Rename thread",-1)),R[19]||(R[19]=v("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Hr(v("input",{ref_key:"renameThreadInputRef",ref:ce,"onUpdate:modelValue":R[9]||(R[9]=$=>Z.value=$),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[Cn(Tt(ut,["prevent"]),["enter"]),Cn(Tt(Ze,["prevent"]),["esc"])]},null,40,_w),[[Wr,Z.value]]),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:Ze},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:ut},"Save")])])])):pe("",!0)])),(y(),wt(So,{to:"body"},[K.value?(y(),k("div",{key:0,class:"rename-thread-overlay",onClick:Tt(Rt,["self"])},[v("div",kw,[R[20]||(R[20]=v("h3",{class:"rename-thread-title"},"Delete thread?",-1)),v("p",Tw,' This will archive the thread "'+J(ne.value)+'". You can find it later in archived threads. ',1),v("div",{class:"rename-thread-actions"},[v("button",{class:"rename-thread-button",type:"button",onClick:Rt},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Qe},"Delete")])])])):pe("",!0)]))]))}}),Ew=gt(Iw,[["__scopeId","data-v-2e1439c4"]]),Cw={class:"content-header"},Aw={class:"content-leading"},xw={class:"content-title"},Rw={class:"content-actions"},Pw=sn({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(y(),k("header",Cw,[v("div",Aw,[br(t.$slots,"leading",{},void 0)]),v("h1",xw,J(e.title),1),v("div",Rw,[br(t.$slots,"actions",{},void 0)])]))}}),Mw=gt(Pw,[["__scopeId","data-v-66ee223c"]]),$w={},Ow={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Nw(e,t){return y(),k("svg",Ow,[...t[0]||(t[0]=[v("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 qf=gt($w,[["render",Nw]]),Lw={},Dw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function jw(e,t){return y(),k("svg",Dw,[...t[0]||(t[0]=[v("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 Fw=gt(Lw,[["render",jw]]),Bw={},Uw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Hw(e,t){return y(),k("svg",Uw,[...t[0]||(t[0]=[v("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Wl=gt(Bw,[["render",Hw]]),Ww={class:"conversation-root"},Vw={key:0,class:"conversation-loading"},zw={key:1,class:"conversation-empty"},qw=["data-role","data-message-type"],Gw={key:0,class:"message-row","data-role":"system"},Kw={class:"message-stack","data-role":"system"},Jw=["onClick"],Yw={class:"cmd-group-label"},Qw={class:"cmd-status"},Xw={class:"cmd-group-inner"},Zw=["onClick"],eb={class:"cmd-label"},tb={class:"cmd-status"},nb={class:"cmd-output-inner"},rb=["textContent"],sb=["onClick"],ob={class:"cmd-label"},ib={class:"cmd-status"},ab={class:"cmd-output-inner"},lb=["textContent"],cb=["data-role","data-message-type"],ub=["data-role"],db=["data-role"],fb=["data-role"],hb=["onClick"],pb=["src"],mb={key:1,class:"message-file-attachments"},gb=["href","title"],vb=["data-role"],yb={key:0,class:"worked-separator-wrap","aria-live":"polite"},wb=["onClick"],bb={class:"worked-separator-text"},_b={key:0,class:"worked-details"},kb=["onClick"],Tb={class:"cmd-label"},Sb={class:"cmd-status"},Ib={class:"cmd-output-inner"},Eb=["textContent"],Cb=["data-streaming"],Ab={class:"plan-card-header"},xb={key:0,class:"plan-card-badge"},Rb=["innerHTML"],Pb={key:1,class:"plan-step-list"},Mb=["data-status"],$b=["data-status"],Ob=["innerHTML"],Nb=["innerHTML"],Lb={key:2,class:"message-text-flow"},Db={key:0,class:"message-text"},jb={key:0},Fb={key:1,class:"message-bold-text"},Bb={key:2,class:"message-italic-text"},Ub={key:3,class:"message-strikethrough-text"},Hb=["href","title"],Wb=["href","title"],Vb={key:6,class:"message-inline-code"},zb={key:0},qb={key:1,class:"message-bold-text"},Gb={key:2,class:"message-italic-text"},Kb={key:3,class:"message-strikethrough-text"},Jb=["href","title"],Yb=["href","title"],Qb={key:6,class:"message-inline-code"},Xb={key:2,class:"message-blockquote"},Zb={key:0},e_={key:1,class:"message-bold-text"},t_={key:2,class:"message-italic-text"},n_={key:3,class:"message-strikethrough-text"},r_=["href","title"],s_=["href","title"],o_={key:6,class:"message-inline-code"},i_={key:3,class:"message-list message-list-unordered"},a_=["innerHTML"],l_={key:4,class:"message-list message-task-list"},c_=["data-checked"],u_={class:"message-list-item-text"},d_={key:0},f_={key:1,class:"message-bold-text"},h_={key:2,class:"message-italic-text"},p_={key:3,class:"message-strikethrough-text"},m_=["href","title"],g_=["href","title"],v_={key:6,class:"message-inline-code"},y_=["start"],w_=["innerHTML"],b_={key:6,class:"message-code-block"},__={key:0,class:"message-code-language"},k_={class:"message-code-pre"},T_={key:7,class:"message-divider"},S_={key:8,class:"message-text"},I_=["onClick"],E_=["src","alt","onError"],C_=["data-role"],A_=["onClick"],x_=["data-copied","aria-label","title","onClick"],R_={class:"message-copy-label"},P_={key:0,class:"conversation-item conversation-item-overlay"},M_={class:"message-row"},$_={class:"message-stack"},O_={class:"live-overlay-inline","aria-live":"polite"},N_={class:"live-overlay-label"},L_={key:1,class:"live-overlay-error"},D_={class:"message-row"},j_={class:"message-stack"},F_={class:"request-card"},B_={class:"request-title"},U_={class:"request-meta"},H_={key:0,class:"request-reason"},W_={key:1,class:"request-actions"},V_=["onClick"],z_=["onClick"],q_=["onClick"],G_=["onClick"],K_={key:2,class:"request-actions"},J_=["onClick"],Y_=["onClick"],Q_=["onClick"],X_=["onClick"],Z_={key:3,class:"request-user-input"},ek={class:"request-question-title"},tk={key:0,class:"request-question-text"},nk=["value","onChange"],rk=["value"],sk={key:2,class:"request-question-option-description"},ok=["type","value","placeholder","onInput"],ik=["type","value","onInput"],ak=["onClick"],lk={key:4,class:"request-actions"},ck=["onClick"],uk=["onClick"],dk={key:5,class:"request-actions"},fk=["onClick"],hk=["onClick"],pk=["src"],mk=16,gk=sn({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{}},emits:["updateScrollState","forkThread","respondServerRequest"],setup(e,{emit:t}){var er;const n=j(new Set),r=j(new Set),s=j(new Set),o=j(new Set);function i(d){var N;const m=d.replace(/\r\n/g,`
26
+ `).trim();if(!m)return null;const h=[],x=[];for(const P of m.split(`
27
+ `)){const ve=P.trim();if(!ve){h.length===0&&x.push("");continue}const z=ve.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(z){const Te=(z[1]??" ").toLowerCase();let Ne="pending";Te==="x"&&(Ne="completed"),(Te==="~"||Te===">"||Te==="-")&&(Ne="inProgress"),h.push({step:((N=z[2])==null?void 0:N.trim())??"",status:Ne});continue}x.push(ve)}return h.length===0?null:{explanation:x.join(`
28
+ `).trim(),steps:h.filter(P=>P.step.length>0)}}function a(d){var m;return d.plan&&d.plan.steps.length>0?{explanation:((m=d.plan.explanation)==null?void 0:m.trim())??"",steps:d.plan.steps}:i(d.text)}function l(d){return d.messageType==="commandExecution"&&!!d.commandExecution}function f(d){return d.messageType==="plan"||d.messageType==="plan.live"}function u(d){return d.role==="assistant"&&!l(d)&&d.messageType!=="worked"&&!(d.messageType??"").endsWith(".live")}const g=he(()=>{var d;for(let m=Ce.messages.length-1;m>=0;m-=1){const h=Ce.messages[m];if(h.messageType==="commandExecution"&&((d=h.commandExecution)==null?void 0:d.status)==="inProgress")return h.id}return""}),_=he(()=>Ce.messages.some(d=>d.role==="assistant"&&d.messageType==="agentMessage.live"&&d.text.trim().length>0)),E=he(()=>!!Ce.liveOverlay||g.value.length>0||_.value),B=he(()=>{const d={};for(let m=0;m<Ce.messages.length;){const h=Ce.messages[m];if(!l(h)){m+=1;continue}const x=[];for(;m<Ce.messages.length&&l(Ce.messages[m]);)x.push(Ce.messages[m]),m+=1;if(x.length<=1)continue;const N=x[x.length-1];d[N.id]=x.slice(0,-1)}return d}),M=he(()=>{const d=new Set;for(const m of Object.values(B.value))for(const h of m)d.add(h.id);return d});function Z(d){var m;return((m=a(d))==null?void 0:m.explanation)??""}function ce(d){var m;return((m=a(d))==null?void 0:m.steps)??[]}function K(d){switch(d){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function te(d){return!_.value&&d.id===g.value}function ne(d){return l(d)?n.value.has(d.id)||!r.value.has(d.id)&&te(d):!1}function ke(d){return l(d)&&E.value}function ge(d){var m;return l(d)&&(E.value||((m=d.commandExecution)==null?void 0:m.status)==="inProgress")}function ye(d){if(!l(d))return;const m=new Set(n.value),h=new Set(r.value),x=te(d);m.has(d.id)?(m.delete(d.id),x&&h.add(d.id)):x&&!h.has(d.id)?h.add(d.id):(m.add(d.id),h.delete(d.id)),n.value=m,r.value=h}function je(d){return B.value[d.id]??[]}function ue(d){return l(d)?[...je(d),d]:[]}function se(d){if(je(d).length===0)return;const h=new Set(s.value);h.has(d.id)?h.delete(d.id):h.add(d.id),s.value=h}function de(d){return s.value.has(d.id)}function re(d){var P,ve;const h=ue(d).length,x=((ve=(P=d.commandExecution)==null?void 0:P.command)==null?void 0:ve.trim())||"(command)";return`${h===1?"1 command":`${h} commands`} · latest: ${x}`}function Me(d){return Ge(d)}function Je(d){const m=new Set(o.value);m.has(d.id)?m.delete(d.id):m.add(d.id),o.value=m}function qe(d){return o.value.has(d.id)}function Ge(d){const m=d.commandExecution;if(!m)return"";const h=ke(d);switch(m.status){case"inProgress":return h?"Running":"⟳ Running";case"completed":return m.exitCode===0?h?"Done":"✓ Completed":`Exit ${m.exitCode??"?"}`;case"failed":return h?"Failed":"✗ Failed";case"declined":return h?"Declined":"⊘ Declined";case"interrupted":return h?"Stopped":"⊘ Interrupted";default:return""}}function He(d){var h,x;const m=(h=d.commandExecution)==null?void 0:h.status;return m==="inProgress"?"cmd-status-running":m==="completed"&&((x=d.commandExecution)==null?void 0:x.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function Pe(d,m){if(d.size===0)return d;const h=new Set;for(const x of d)m.has(x)&&h.add(x);return h.size===d.size?d:h}function rt(d,m){const h=[];for(let x=m-1;x>=0;x--){const N=d[x];if(N.messageType==="commandExecution")h.unshift(N);else if(N.role==="user"||N.messageType==="worked")break}return h}const Ce=e,Ue=t,lt=j(null),Ft=j(null),pt=j(null),ct=j(""),We=j(""),G=j({}),be=j({}),fe=j(((er=Ce.scrollState)==null?void 0:er.isAtBottom)!==!1);let Ae=0,Ee=0,T=0,S=null;const O=new WeakSet,X=j(new Set),V=he(()=>!fe.value&&(Ce.messages.length>0||Ce.pendingRequests.length>0||!!Ce.liveOverlay));function L(d){if(!d||/\s/u.test(d)||d.endsWith("/")||d.endsWith("\\"))return!1;if(d.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(d))return!1;const m=d.startsWith("/"),h=/^[A-Za-z]:[\\/]/u.test(d),x=d.startsWith("./")||d.startsWith("../")||d.startsWith("~/"),N=d.includes("/")||d.includes("\\");return m||h||x||N}function W(d){return d.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||d}function H(d){return d.replace(/\\/gu,"/")}function Y(d){if(!d.startsWith("file://"))return d;let m=d.replace(/^file:\/\//u,"");try{m=decodeURIComponent(m)}catch{}return/^\/[A-Za-z]:\//u.test(m)&&(m=m.slice(1)),m}function Q(d){const m=H(d),h=m.match(/^\/Users\/([^/]+)/u);if(h)return`/Users/${h[1]}`;const x=m.match(/^\/home\/([^/]+)/u);return x?`/home/${x[1]}`:""}function Ie(d){const m=H(d);if(!m)return m;let h="",x=m;const N=x.match(/^([A-Za-z]:)(\/.*)?$/u);N?(h=`${N[1]}/`,x=(N[2]??"").replace(/^\/+/u,"")):x.startsWith("/")&&(h="/",x=x.slice(1));const P=x.split("/").filter(Boolean),ve=[];for(const Te of P)if(Te!=="."){if(Te===".."){ve.length>0&&ve.pop();continue}ve.push(Te)}const z=ve.join("/");return h?`${h}${z}`.replace(/\/+$/u,"")||h:z||m}function _e(d,m){const h=H(Y(d.trim()));if(!h)return"";if(h.startsWith("/")||/^[A-Za-z]:\//u.test(h))return Ie(h);if(h.startsWith("~/")){const P=Q(m);if(P)return Ie(`${P}/${h.slice(2)}`)}const N=H(m.trim());return Ie(N?`${N.replace(/\/+$/u,"")}/${h}`:h)}function Se(d){if(!d)return null;let m=d.trim();m=xe(m).core.trim();let x=null;const N=m.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(N)m=N[1],x=Number(N[2]);else{const P=m.match(/^(.*):(\d+)(?::\d+)?$/u);P&&(m=P[1],x=Number(P[2]))}return m=Y(m),L(m)?{path:m,line:x}:null}function xe(d){let m=d,h="",x="";for(;/^[('"`[{<“‘]/u.test(m);)h+=m[0],m=m.slice(1);for(;/[)"'`\]}>”’]$/u.test(m);)x=m.slice(-1)+x,m=m.slice(0,-1);return{core:m,leading:h,trailing:x}}function Ve(d){const h=d.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!h)return null;const x=(h[1]??"").trim(),N=(h[2]??"").trim(),P=xe(x).core.trim()||x,ve=xe(N).core.trim();return ve?{label:P,target:ve}:null}function ot(d){const m=Math.min(6,Math.max(1,Math.trunc(d)));return`h${String(m)}`}function Ze(d){switch(Math.min(6,Math.max(1,Math.trunc(d)))){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 ut(d){switch(d){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function bt(d){var x;const m=a(d);if(!m)return"";const h=[];return(x=m.explanation)!=null&&x.trim()&&h.push(m.explanation.trim()),m.steps.length>0&&h.push(m.steps.map(N=>`- ${ut(N.status)} ${N.step}`.trim()).join(`
29
+ `)),h.join(`
30
+
31
+ `).trim()}function Rt(d){const m=[],h=d.text.trim()||bt(d),x=f(d)&&h?`Plan
32
+ ${h}`:h;x&&m.push(x);const N=(d.fileAttachments??[]).map(ve=>ve.path.trim()).filter(ve=>ve.length>0);N.length>0&&m.push(`Files:
33
+ ${N.join(`
34
+ `)}`);const P=(d.images??[]).map(ve=>ve.trim()).filter(ve=>ve.length>0);return P.length>0&&m.push(`Images:
35
+ ${P.join(`
36
+ `)}`),m.join(`
37
+
38
+ `).trim()}const Qe=he(()=>{const d=new Map;for(const h of Ce.messages){if(!u(h))continue;const x=Rt(h);if(!x)continue;const N=typeof h.turnIndex=="number"?`turn:${h.turnIndex}`:`message:${h.id}`,P=d.get(N);if(P){P.anchorMessageId=h.id,P.parts.push(x);continue}d.set(N,{anchorMessageId:h.id,parts:[x]})}const m={};for(const h of d.values()){const x=h.parts.join(`
39
+
40
+ `).trim();x&&(m[h.anchorMessageId]=x)}return m}),Pt=he(()=>{const d=new Map;for(const h of Ce.messages){if(!u(h)||typeof h.turnIndex!="number")continue;const x=`turn:${h.turnIndex}`,N=d.get(x);if(N){N.anchorMessageId=h.id,N.turnIndex=h.turnIndex;continue}d.set(x,{anchorMessageId:h.id,turnIndex:h.turnIndex})}const m={};for(const h of d.values())m[h.anchorMessageId]=h.turnIndex;return m});function zt(d){return typeof Qe.value[d.id]=="string"}function st(d){return typeof Pt.value[d.id]=="number"}function _t(d){if(typeof document>"u")return!1;const m=document.createElement("textarea");m.value=d,m.setAttribute("readonly","true"),m.style.position="fixed",m.style.left="-9999px",m.style.opacity="0",m.style.pointerEvents="none",document.body.appendChild(m),m.focus(),m.select(),m.setSelectionRange(0,d.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(m)}}async function vt(d){var x;const m=Qe.value[d]??"";if(!m)return;let h=!1;if(typeof navigator<"u"&&((x=navigator.clipboard)!=null&&x.writeText))try{await navigator.clipboard.writeText(m),h=!0}catch{h=!1}h||(h=_t(m)),h&&(We.value=d,S&&clearTimeout(S),S=setTimeout(()=>{We.value===d&&(We.value=""),S=null},1800))}function Jt(d){const m=Pt.value[d];typeof m=="number"&&Ce.activeThreadId&&Ue("forkThread",{threadId:Ce.activeThreadId,turnIndex:m})}function kt(d){const m=[],h=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let x=0;for(const N of d.matchAll(h)){if(typeof N.index!="number")continue;const P=N.index,ve=P+N[0].length;P>x&&m.push({kind:"text",value:d.slice(x,P)});let z=N[0],Te="";for(;/[.,;:]$/u.test(z);)Te=z.slice(-1)+Te,z=z.slice(0,-1);const Ne=xe(z);z=Ne.core;const c=Ne.leading,p=Ne.trailing+Te;if(c&&m.push({kind:"text",value:c}),z.startsWith("**")&&z.endsWith("**")&&z.length>4)m.push({kind:"bold",value:z.slice(2,-2)}),p&&m.push({kind:"text",value:p});else if(/^https?:\/\//u.test(z))m.push({kind:"url",value:z,href:z}),p&&m.push({kind:"text",value:p});else{const w=Se(z);w?(m.push({kind:"file",value:z,path:w.path,displayPath:z,downloadName:W(w.path)}),p&&m.push({kind:"text",value:p})):m.push({kind:"text",value:N[0]})}x=ve}return x<d.length&&m.push({kind:"text",value:d.slice(x)}),Hn(m)}function Mt(d,m){const h=[];let x=!1,N="";const P=ve=>{ve&&h.push({kind:"text",value:ve})};for(const ve of d){if(ve.kind!=="text"){x&&(P(`${m.marker}${N}`),x=!1,N=""),h.push(ve);continue}let z=ve.value;for(;z.length>0;){const Te=z.indexOf(m.marker);if(Te<0){x?N+=z:P(z);break}const Ne=z.slice(0,Te);if(x?N+=Ne:P(Ne),z=z.slice(Te+m.marker.length),x){const c=N;c.length>0&&(!m.isValidContent||m.isValidContent(c))?h.push({kind:m.kind,value:c}):P(`${m.marker}${c}${m.marker}`),N="",x=!1}else x=!0}}return x&&P(`${m.marker}${N}`),h}function Hn(d){const m=x=>x.trim().length>0&&!/^\s/u.test(x)&&!/\s$/u.test(x);let h=Mt(d,{marker:"**",kind:"bold",isValidContent:m});return h=Mt(h,{marker:"~~",kind:"strikethrough",isValidContent:m}),h=Mt(h,{marker:"*",kind:"italic",isValidContent:m}),h}function un(d){const m=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,h=[];let x=0;for(const N of d.matchAll(m)){if(typeof N.index!="number")continue;const[P,ve,z]=N,Te=N.index,Ne=Te+P.length;Te>x&&h.push(...kt(d.slice(x,Te)));const c=Ve(`[${ve??""}](${z??""})`),p=(c==null?void 0:c.label)??(ve??"").trim(),w=(c==null?void 0:c.target)??(z??"").trim();if(/^https?:\/\//u.test(w))h.push({kind:"url",value:p||w,href:w});else{const C=Se(w);C?h.push({kind:"file",value:w,path:C.path,displayPath:p||w,downloadName:W(C.path)}):h.push({kind:"text",value:P})}x=Ne}return x<d.length&&h.push(...kt(d.slice(x))),h}function Bt(d){if(!d.includes("`"))return un(d);const m=[];let h=0,x=0;for(;h<d.length;){if(d[h]!=="`"){h+=1;continue}let N=1;for(;h+N<d.length&&d[h+N]==="`";)N+=1;const P="`".repeat(N);let ve=h+N,z=-1;for(;ve<d.length;){const Ne=d.indexOf(P,ve);if(Ne<0)break;const c=Ne>0&&d[Ne-1]==="`",p=Ne+N<d.length&&d[Ne+N]==="`",w=d.slice(h+N,Ne).includes(`
41
+ `);if(!c&&!p&&!w){z=Ne;break}ve=Ne+1}if(z<0){h+=N;continue}h>x&&m.push(...un(d.slice(x,h)));const Te=d.slice(h+N,z);if(Te.length>0){const Ne=Ve(Te);if(Ne)if(/^https?:\/\//u.test(Ne.target))m.push({kind:"url",value:Ne.label||Ne.target,href:Ne.target});else{const c=Se(Ne.target);c?m.push({kind:"file",value:Ne.target,path:c.path,displayPath:Ne.label||Ne.target,downloadName:W(c.path)}):m.push({kind:"code",value:Te})}else{const c=Se(Te);if(c){const p=c.line?`${c.path}:${String(c.line)}`:c.path;m.push({kind:"file",value:Te,path:c.path,displayPath:p,downloadName:W(c.path)})}else m.push({kind:"code",value:Te})}}else m.push({kind:"text",value:`${P}${P}`});h=z+N,x=h}return x<d.length&&m.push(...un(d.slice(x))),m}function tn(d){const m=d.trim();if(!m)return"";if(m.startsWith("data:")||m.startsWith("blob:")||m.startsWith("http://")||m.startsWith("https://")||m.startsWith("/codex-local-image?"))return m;if(m.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(m)}`;const h=m.startsWith("/"),x=/^[A-Za-z]:[\\/]/u.test(m);return h||x?`/codex-local-image?path=${encodeURIComponent(m)}`:m}function It(d){const m=d.trim();if(!m)return"#";const h=ve=>ve.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(ve),x=Se(m),N=(x==null?void 0:x.path)??m,P=_e(N,Ce.cwd);if(h(P)){const ve=P.startsWith("/")?P:`/${P}`;return`/codex-local-browse${encodeURI(ve)}`}return"#"}function Rn(d){return d.replace(/\r\n/gu,`
42
+ `)}function $t(d){var h;return(((h=d.match(/^\s*/u))==null?void 0:h[0])??"").replace(/\t/gu," ").length}function on(d,m){if(m<=0)return d.trimStart();let h=0,x=0;for(;h<d.length&&x<m;){const N=d[h];x+=N===" "?4:1,h+=1}return d.slice(h)}function nn(d){return d.trim().length===0}function rn(d){const m=d.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return m?{level:m[1].length,value:m[2].trim()}:null}function bn(d){const m=d.match(/^\s{0,3}>\s?(.*)$/u);return m?m[1]??"":null}function dn(d){var h;const m=d.match(/^\s*[-*+]\s+(.+)$/u);return((h=m==null?void 0:m[1])==null?void 0:h.trim())??null}function Xn(d){var h;const m=d.match(/^(\s*)[-*+]\s+(.+)$/u);return m?{indent:$t(m[1]??""),text:((h=m[2])==null?void 0:h.trim())??""}:null}function Pn(d){var h;const m=d.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return m?{checked:(m[1]??" ").toLowerCase()==="x",text:((h=m[2])==null?void 0:h.trim())??""}:null}function Mn(d){var h;const m=d.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return m?{indent:$t(m[1]??""),item:{checked:(m[2]??" ").toLowerCase()==="x",text:((h=m[3])==null?void 0:h.trim())??""}}:null}function $e(d){var h;const m=d.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return m?{indent:$t(m[1]??""),start:Number.parseInt(m[2]??"1",10)||1,text:((h=m[3])==null?void 0:h.trim())??""}:null}function Re(d){var m;return((m=$e(d))==null?void 0:m.text)??null}function _n(d){return $e(d)}function qt(d){return nn(d)||kn(d)!==null||zn(d)||rn(d)!==null||bn(d)!==null||Pn(d)!==null||dn(d)!==null||Re(d)!==null}function Zn(d,m,h=-1){const x=[];let N=m;for(;N<d.length&&!(qt(d[N])||h>=0&&$t(d[N])<=h);)x.push(h>=0?on(d[N],h+1):d[N]),N+=1;const P=x.join(`
43
+ `).trim();return P?{value:P,nextIndex:N}:null}function Wn(d,m){for(let h=m;h<d.length;h+=1)if(!nn(d[h]))return h;return-1}function Dn(d,m,h,x=null,N=!1){const P=[];let ve=m;for(;ve<d.length;){const z=d[ve];if(nn(z)){const p=Wn(d,ve+1);if(p===-1){P.push(""),ve=d.length;break}const w=x==null?void 0:x(d[p]);if(w&&w.indent===h||$t(d[p])<=h)break;P.push(""),ve+=1;continue}const Te=x==null?void 0:x(z);if(Te&&Te.indent===h)break;const Ne=$t(z),c=N&&(Pn(z)!==null||dn(z)!==null);if(Ne<=h&&!c)break;P.push(Ne>h?on(z,h+1):z.trimStart()),ve+=1}for(;P.length>0&&nn(P[0]);)P.shift();for(;P.length>0&&nn(P[P.length-1]);)P.pop();return P.length===0?null:{blocks:qn(P.join(`
44
+ `)),nextIndex:ve}}function Vn(d,m,h,x=!1){const N=[];let P=m;const ve=h(d[m]);if(!ve)return null;const z=ve.indent;for(;P<d.length;){const Te=h(d[P]);if(Te===null||Te.indent!==z)break;const Ne=[Te.text],c=[];for(P+=1;P<d.length;){if(nn(d[P])){const q=Wn(d,P+1);if(q===-1){P=d.length;break}const ie=h(d[q]);if(ie&&ie.indent===z){P=q;break}if($t(d[q])<=z){P=q;break}P+=1;continue}const p=h(d[P]);if(p&&p.indent===z)break;const w=$t(d[P])>z,C=x&&(Pn(d[P])!==null||dn(d[P])!==null);if(w||C){const q=Dn(d,P,z,h,x);if(q){c.push(...q.blocks),P=q.nextIndex;continue}}if($t(d[P])<=z)break;const F=Zn(d,P,z);if(!F)break;Ne.push(F.value),P=F.nextIndex}N.push(c.length>0?{paragraphs:Ne,children:c}:{paragraphs:Ne})}return N.length>0?{items:N,nextIndex:P}:null}function zn(d){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(d.trim())}function kn(d){const m=d.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return m?{marker:m[1],language:(m[2]??"").trim()}:null}function qn(d){var P;const h=Rn(d).split(`
45
+ `),x=[];let N=0;for(;N<h.length;){if(nn(h[N])){N+=1;continue}const ve=kn(h[N]);if(ve){N+=1;const F=[];for(;N<h.length;){if(h[N].trim()===ve.marker){N+=1;break}F.push(h[N]),N+=1}x.push({kind:"codeBlock",language:ve.language,value:F.join(`
46
+ `)});continue}if(zn(h[N])){x.push({kind:"thematicBreak"}),N+=1;continue}const z=rn(h[N]);if(z){x.push({kind:"heading",level:z.level,value:z.value}),N+=1;continue}if(bn(h[N])!==null){const F=[];for(;N<h.length;){const q=bn(h[N]);if(q===null)break;F.push(q),N+=1}x.push({kind:"blockquote",value:F.join(`
47
+ `).trim()});continue}if(Pn(h[N])!==null){const F=[],q=((P=Mn(h[N]))==null?void 0:P.indent)??0;for(;N<h.length;){const ie=Mn(h[N]);if(ie===null||ie.indent!==q)break;F.push(ie.item),N+=1}if(F.length>0){x.push({kind:"taskList",items:F});continue}}const c=dn(h[N]);if(c!==null){const F=Vn(h,N,Xn);if(F){x.push({kind:"unorderedList",items:F.items}),N=F.nextIndex;continue}if(c.length>0){x.push({kind:"unorderedList",items:[{paragraphs:[c]}]}),N+=1;continue}}const p=Re(h[N]);if(p!==null){const F=_n(h[N]),q=Vn(h,N,_n,!0);if(q){x.push({kind:"orderedList",items:q.items,start:(F==null?void 0:F.start)??1}),N=q.nextIndex;continue}if(p.length>0){x.push({kind:"orderedList",items:[{paragraphs:[p]}],start:(F==null?void 0:F.start)??1}),N+=1;continue}}const w=[];for(;N<h.length&&!(nn(h[N])||kn(h[N])||zn(h[N])||rn(h[N])||bn(h[N])!==null||Pn(h[N])!==null||dn(h[N])!==null||Re(h[N])!==null);)w.push(h[N]),N+=1;const C=w.join(`
48
+ `).trim();C&&x.push({kind:"paragraph",value:C})}return x}function $n(d){if(!d.includes("![")||!d.includes("]("))return qn(d);const m=[],h=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let x=0;for(const N of d.matchAll(h)){const[P,ve,z]=N;if(typeof N.index!="number")continue;const Te=N.index,Ne=Te+P.length,c=tn(z.trim());c&&(Te>x&&m.push(...qn(d.slice(x,Te))),m.push({kind:"image",url:c,alt:ve.trim(),markdown:P}),x=Ne)}return x<d.length&&m.push(...qn(d.slice(x))),m}function On(d){const h=Rn(d).split(`
49
+ `),x=[];let N=0,P=0;const ve=z=>{if(z<=P)return;const Te=h.slice(P,z).join(`
50
+ `);x.push(...$n(Te))};for(;N<h.length;){const z=kn(h[N]);if(!z){N+=1;continue}ve(N),N+=1;const Te=[];for(;N<h.length;){if(h[N].trim()===z.marker){N+=1;break}Te.push(h[N]),N+=1}x.push({kind:"codeBlock",language:z.language,value:Te.join(`
51
+ `)}),P=N}return ve(h.length),x.length>0?x:[{kind:"paragraph",value:d}]}function A(d){return d.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function U(d){return Bt(d).map(m=>m.kind==="text"?A(m.value):m.kind==="bold"?`<strong class="message-bold-text">${A(m.value)}</strong>`:m.kind==="italic"?`<em class="message-italic-text">${A(m.value)}</em>`:m.kind==="strikethrough"?`<s class="message-strikethrough-text">${A(m.value)}</s>`:m.kind==="file"?`<a class="message-file-link" href="${A(It(m.path))}" target="_blank" rel="noopener noreferrer" title="${A(m.path)}">${A(m.displayPath)}</a>`:m.kind==="url"?`<a class="message-file-link" href="${A(m.href)}" target="_blank" rel="noopener noreferrer" title="${A(m.href)}">${A(m.value)}</a>`:`<code class="message-inline-code">${A(m.value)}</code>`).join("")}function ae(d){return d.paragraphs.map(m=>`<div class="message-list-item-text message-list-item-paragraph">${U(m)}</div>`).join("")}function Oe(d){var x;const m=ae(d),h=((x=d.children)==null?void 0:x.map(N=>it(N)).join(""))??"";return m+h}function it(d){if(d.kind==="paragraph")return`<p class="message-text">${U(d.value)}</p>`;if(d.kind==="heading"){const m=Math.min(6,Math.max(1,Math.trunc(d.level))),h=ot(m),x=`message-heading ${Ze(m)}`;return`<${h} class="${x}">${U(d.value)}</${h}>`}if(d.kind==="blockquote")return`<blockquote class="message-blockquote">${U(d.value)}</blockquote>`;if(d.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${d.items.map(h=>`<li class="message-list-item"><div class="message-list-item-content">${Oe(h)}</div></li>`).join("")}</ul>`;if(d.kind==="taskList")return`<ul class="message-list message-task-list">${d.items.map(h=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${h.checked?"true":"false"}">${h.checked?"☑":"☐"}</span><div class="message-list-item-text">${U(h.text)}</div></li>`).join("")}</ul>`;if(d.kind==="orderedList"){const m=d.items.map(h=>`<li class="message-list-item"><div class="message-list-item-content">${Oe(h)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${d.start}">${m}</ol>`}return d.kind==="codeBlock"?`<div class="message-code-block">${d.language?`<div class="message-code-language">${A(d.language)}</div>`:""}<pre class="message-code-pre"><code>${A(d.value)}</code></pre></div>`:d.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${A(d.url)}" alt="${A(d.alt||"Embedded message image")}" loading="lazy">`}function ht(d){return On(d).map(m=>it(m)).join("")}function dt(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)?d:null}function jt(d){const m=new Date(d);return Number.isNaN(m.getTime())?d:m.toLocaleTimeString()}function jn(d){const m=dt(d.params),h=m==null?void 0:m.reason;return typeof h=="string"?h.trim():""}function Yt(d,m){return`${String(d)}:${m}`}function Jr(d){const m=dt(d.params),h=Array.isArray(m==null?void 0:m.questions)?m.questions:[],x=[];for(const N of h){const P=dt(N);if(!P)continue;const ve=typeof P.id=="string"?P.id:"";if(!ve)continue;const z=Array.isArray(P.options)?P.options.map(Te=>dt(Te)).map(Te=>({label:typeof(Te==null?void 0:Te.label)=="string"?Te.label:"",description:typeof(Te==null?void 0:Te.description)=="string"?Te.description:""})).filter(Te=>Te.label.length>0):[];x.push({id:ve,header:typeof P.header=="string"?P.header:"",question:typeof P.question=="string"?P.question:"",isSecret:P.isSecret===!0,isOther:P.isOther===!0,options:z})}return x}function ur(d,m,h){const x=Yt(d,m),N=G.value[x];return typeof N=="string"&&N.length>0?N:h}function Yr(d,m,h){const x=h.target;if(!(x instanceof HTMLInputElement))return;const N=Yt(d,m);G.value={...G.value,[N]:x.value}}function Qr(d,m){var N;const h=ur(d,m.id,((N=m.options[0])==null?void 0:N.label)||""),x=m.options.find(P=>P.label===h);return(x==null?void 0:x.description)??""}function Fn(d,m){const h=Yt(d,m);return be.value[h]??""}function gs(d,m,h){const x=h.target;if(!(x instanceof HTMLSelectElement))return;const N=Yt(d,m);G.value={...G.value,[N]:x.value}}function Xr(d,m,h){const x=h.target;if(!(x instanceof HTMLInputElement))return;const N=Yt(d,m);be.value={...be.value,[N]:x.value}}function Nn(d,m){Ue("respondServerRequest",{id:d,result:{decision:m}})}function Sr(d){var x;const m=Jr(d),h={};for(const N of m){const P=ur(d.id,N.id,((x=N.options[0])==null?void 0:x.label)||""),ve=Fn(d.id,N.id).trim(),z=[P,ve].map(Te=>Te.trim()).filter(Te=>Te.length>0);h[N.id]={answers:z}}Ue("respondServerRequest",{id:d.id,result:{answers:h}})}function vs(d){Ue("respondServerRequest",{id:d,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function I(d){Ue("respondServerRequest",{id:d,result:{success:!0,contentItems:[]}})}function R(d){Ue("respondServerRequest",{id:d,result:{}})}function $(d){Ue("respondServerRequest",{id:d,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function ee(){const d=lt.value,m=Ft.value;!d||!m||(d.scrollTop=d.scrollHeight,m.scrollIntoView({block:"end"}))}function Fe(d){return d.scrollHeight-(d.scrollTop+d.clientHeight)<=mk}function yt(d){if(!Ce.activeThreadId)return;const m=Math.max(d.scrollHeight-d.clientHeight,0),h=m>0?Math.min(Math.max(d.scrollTop/m,0),1):1;Ue("updateScrollState",{threadId:Ce.activeThreadId,state:{scrollTop:d.scrollTop,isAtBottom:Fe(d),scrollRatio:h}})}function Gt(){const d=lt.value;if(!d)return;const m=Ce.scrollState;if(fe.value){fn();return}if(!m||m.isAtBottom){yt(d);return}const h=Math.max(d.scrollHeight-d.clientHeight,0),x=typeof m.scrollRatio=="number"?m.scrollRatio*h:m.scrollTop;d.scrollTop=Math.min(Math.max(x,0),h),yt(d)}function fn(){const d=lt.value;d&&(ee(),yt(d))}function Wt(){return fe.value}function Kt(){if(!Wt()){T=0,Ee=0;return}if(fn(),T-=1,T<=0){Ee=0;return}Ee=requestAnimationFrame(Kt)}function hn(d=6){Wt()&&(Ee&&(cancelAnimationFrame(Ee),Ee=0),T=Math.max(d,1),Ee=requestAnimationFrame(Kt))}function Gn(){hn(3)}function Ir(){fe.value=!0,fn(),hn(4)}function Ds(){if(!Wt())return;const d=lt.value;if(!d)return;const m=d.querySelectorAll("img.message-image-preview");for(const h of m)h.complete||O.has(h)||(O.add(h),h.addEventListener("load",Gn,{once:!0}),h.addEventListener("error",Gn,{once:!0}))}async function ys(){await Zt(),Ae&&cancelAnimationFrame(Ae),Ae=requestAnimationFrame(()=>{Ae=0,Gt(),Ds(),hn()})}ft(()=>Ce.messages,async d=>{if(Ce.isLoading)return;const m=new Set(d.filter(h=>h.messageType==="commandExecution"&&h.commandExecution).map(h=>h.id));n.value=Pe(n.value,m),r.value=Pe(r.value,m),s.value=Pe(s.value,new Set(Object.keys(B.value))),await ys()}),ft(g,(d,m)=>{if(!m||m===d||!r.value.has(m))return;const h=new Set(r.value);h.delete(m),r.value=h}),ft(()=>Ce.pendingRequests,async()=>{Ce.isLoading||await ys()},{deep:!0}),ft(()=>Ce.liveOverlay,async d=>{d&&(await Zt(),Wt()&&(fn(),hn(8)))},{deep:!0}),ft(()=>Ce.isLoading,async d=>{d||await ys()}),ft(()=>Ce.activeThreadId,()=>{var d;fe.value=((d=Ce.scrollState)==null?void 0:d.isAtBottom)!==!1,ct.value="",X.value=new Set},{flush:"post"}),ft(()=>{var d;return(d=Ce.scrollState)==null?void 0:d.isAtBottom},d=>{fe.value=d!==!1});function Zr(){const d=lt.value;!d||Ce.isLoading||(fe.value=Fe(d),yt(d))}function ws(d){ct.value=tn(d)}function dr(d,m){return`${d}:${String(m)}`}function js(d,m){const h=new Set(X.value);h.add(dr(d,m)),X.value=h}function uo(d,m){return X.value.has(dr(d,m))}function Er(){ct.value=""}function Fs(){const d=pt.value;d&&(d.scrollTop=d.scrollHeight)}return ft(()=>{var d;return(d=Ce.liveOverlay)==null?void 0:d.reasoningText},async d=>{d&&(await Zt(),Fs())}),Kr(()=>{Ae&&cancelAnimationFrame(Ae),Ee&&cancelAnimationFrame(Ee),S&&clearTimeout(S)}),(d,m)=>(y(),k("section",Ww,[e.isLoading?(y(),k("p",Vw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(y(),k("p",zw," No messages in this thread yet. ")):(y(),k("ul",{key:2,ref_key:"conversationListRef",ref:lt,class:"conversation-list",onScroll:Zr},[(y(!0),k(De,null,mt(e.messages,h=>{var x,N;return y(),k(De,{key:h.id},[M.value.has(h.id)?pe("",!0):(y(),k("li",{key:0,class:"conversation-item","data-role":h.role,"data-message-type":h.messageType||""},[l(h)?(y(),k("div",Gw,[v("div",Kw,[je(h).length>0?(y(),k("button",{key:0,type:"button",class:tt(["cmd-row cmd-row-group cmd-compact",[He(h),{"cmd-expanded":de(h)}]]),onClick:P=>se(h)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":de(h)}])},"▶",2),v("span",Yw,J(re(h)),1),v("span",Qw,J(Me(h)),1)],10,Jw)):pe("",!0),je(h).length>0?(y(),k("div",{key:1,class:tt(["cmd-group-wrap",{"cmd-group-visible":de(h)}])},[v("div",Xw,[(y(!0),k(De,null,mt(ue(h),P=>{var ve,z;return y(),k("div",{key:`grouped-cmd-${P.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:tt(["cmd-row",[He(P),{"cmd-expanded":ne(P),"cmd-compact":!0}]]),onClick:Te=>ye(P)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":ne(P)}])},"▶",2),v("code",eb,J(((ve=P.commandExecution)==null?void 0:ve.command)||"(command)"),1),v("span",tb,J(Ge(P)),1)],10,Zw),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":ne(P)}])},[v("div",nb,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ge(P)}]),textContent:J(((z=P.commandExecution)==null?void 0:z.aggregatedOutput)||"(no output)")},null,10,rb)])],2)])}),128))])],2)):(y(),k(De,{key:2},[v("button",{type:"button",class:tt(["cmd-row",[He(h),{"cmd-expanded":ne(h),"cmd-compact":ke(h)}]]),onClick:P=>ye(h)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":ne(h)}])},"▶",2),v("code",ob,J(((x=h.commandExecution)==null?void 0:x.command)||"(command)"),1),v("span",ib,J(Ge(h)),1)],10,sb),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":ne(h)}])},[v("div",ab,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ge(h)}]),textContent:J(((N=h.commandExecution)==null?void 0:N.aggregatedOutput)||"(no output)")},null,10,lb)])],2)],64))])])):(y(),k("div",{key:1,class:"message-row","data-role":h.role,"data-message-type":h.messageType||""},[v("div",{class:"message-stack","data-role":h.role},[v("article",{class:"message-body","data-role":h.role},[h.images&&h.images.length>0?(y(),k("ul",{key:0,class:"message-image-list","data-role":h.role},[(y(!0),k(De,null,mt(h.images,P=>(y(),k("li",{key:P,class:"message-image-item"},[v("button",{class:"message-image-button",type:"button",onClick:ve=>ws(P)},[v("img",{class:"message-image-preview",src:tn(P),alt:"Message image preview",loading:"lazy"},null,8,pb)],8,hb)]))),128))],8,fb)):pe("",!0),h.fileAttachments&&h.fileAttachments.length>0?(y(),k("div",mb,[(y(!0),k(De,null,mt(h.fileAttachments,P=>(y(),k("span",{key:P.path,class:"message-file-chip"},[m[1]||(m[1]=v("span",{class:"message-file-chip-icon"},"📄",-1)),v("a",{class:"message-file-link message-file-chip-name",href:It(P.path),target:"_blank",rel:"noopener noreferrer",title:P.path},J(P.path),9,gb)]))),128))])):pe("",!0),h.text.length>0?(y(),k("article",{key:2,class:"message-card","data-role":h.role},[h.messageType==="worked"?(y(),k("div",yb,[v("button",{type:"button",class:"worked-separator",onClick:P=>Je(h)},[m[2]||(m[2]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),v("span",{class:tt(["worked-chevron",{"worked-chevron-open":qe(h)}])},"▶",2),v("p",bb,J(h.text),1),m[3]||(m[3]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,wb),qe(h)?(y(),k("div",_b,[(y(!0),k(De,null,mt(rt(e.messages,e.messages.indexOf(h)),P=>{var ve,z;return y(),k("div",{key:`worked-cmd-${P.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:tt(["cmd-row",[He(P),{"cmd-expanded":ne(P),"cmd-compact":ke(P)}]]),onClick:Te=>ye(P)},[v("span",{class:tt(["cmd-chevron",{"cmd-chevron-open":ne(P)}])},"▶",2),v("code",Tb,J(((ve=P.commandExecution)==null?void 0:ve.command)||"(command)"),1),v("span",Sb,J(Ge(P)),1)],10,kb),v("div",{class:tt(["cmd-output-wrap",{"cmd-output-visible":ne(P)}])},[v("div",Ib,[v("pre",{class:tt(["cmd-output",{"cmd-output-condensed":ge(P)}]),textContent:J(((z=P.commandExecution)==null?void 0:z.aggregatedOutput)||"(no output)")},null,10,Eb)])],2)])}),128))])):pe("",!0)])):f(h)?(y(),k("div",{key:1,class:"plan-card","data-streaming":h.messageType==="plan.live"},[v("div",Ab,[m[4]||(m[4]=v("p",{class:"plan-card-title"},"Plan",-1)),h.messageType==="plan.live"?(y(),k("span",xb,"Updating")):pe("",!0)]),Z(h)?(y(),k("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:ht(Z(h))},null,8,Rb)):pe("",!0),ce(h).length>0?(y(),k("ol",Pb,[(y(!0),k(De,null,mt(ce(h),(P,ve)=>(y(),k("li",{key:`${h.id}:plan-step:${ve}`,class:"plan-step-item","data-status":P.status},[v("span",{class:"plan-step-status","data-status":P.status},J(K(P.status)),9,$b),v("div",{class:"plan-step-text plan-card-markdown",innerHTML:ht(P.step)},null,8,Ob)],8,Mb))),128))])):(y(),k("div",{key:2,class:"plan-card-markdown",innerHTML:ht(h.text)},null,8,Nb))],8,Cb)):(y(),k("div",Lb,[(y(!0),k(De,null,mt(On(h.text),(P,ve)=>(y(),k(De,{key:`block-${ve}`},[P.kind==="paragraph"?(y(),k("p",Db,[(y(!0),k(De,null,mt(Bt(P.value),(z,Te)=>(y(),k(De,{key:`seg-${ve}-${Te}`},[z.kind==="text"?(y(),k("span",jb,J(z.value),1)):z.kind==="bold"?(y(),k("strong",Fb,J(z.value),1)):z.kind==="italic"?(y(),k("em",Bb,J(z.value),1)):z.kind==="strikethrough"?(y(),k("s",Ub,J(z.value),1)):z.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:It(z.path),target:"_blank",rel:"noopener noreferrer",title:z.path},J(z.displayPath),9,Hb)):z.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:z.href,target:"_blank",rel:"noopener noreferrer",title:z.href},J(z.value),9,Wb)):(y(),k("code",Vb,J(z.value),1))],64))),128))])):P.kind==="heading"?(y(),wt(Ti(ot(P.level)),{key:1,class:tt(["message-heading",Ze(P.level)])},{default:Et(()=>[(y(!0),k(De,null,mt(Bt(P.value),(z,Te)=>(y(),k(De,{key:`heading-seg-${ve}-${Te}`},[z.kind==="text"?(y(),k("span",zb,J(z.value),1)):z.kind==="bold"?(y(),k("strong",qb,J(z.value),1)):z.kind==="italic"?(y(),k("em",Gb,J(z.value),1)):z.kind==="strikethrough"?(y(),k("s",Kb,J(z.value),1)):z.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:It(z.path),target:"_blank",rel:"noopener noreferrer",title:z.path},J(z.displayPath),9,Jb)):z.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:z.href,target:"_blank",rel:"noopener noreferrer",title:z.href},J(z.value),9,Yb)):(y(),k("code",Qb,J(z.value),1))],64))),128))]),_:2},1032,["class"])):P.kind==="blockquote"?(y(),k("blockquote",Xb,[(y(!0),k(De,null,mt(Bt(P.value),(z,Te)=>(y(),k(De,{key:`quote-seg-${ve}-${Te}`},[z.kind==="text"?(y(),k("span",Zb,J(z.value),1)):z.kind==="bold"?(y(),k("strong",e_,J(z.value),1)):z.kind==="italic"?(y(),k("em",t_,J(z.value),1)):z.kind==="strikethrough"?(y(),k("s",n_,J(z.value),1)):z.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:It(z.path),target:"_blank",rel:"noopener noreferrer",title:z.path},J(z.displayPath),9,r_)):z.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:z.href,target:"_blank",rel:"noopener noreferrer",title:z.href},J(z.value),9,s_)):(y(),k("code",o_,J(z.value),1))],64))),128))])):P.kind==="unorderedList"?(y(),k("ul",i_,[(y(!0),k(De,null,mt(P.items,(z,Te)=>(y(),k("li",{key:`ul-${ve}-${Te}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:Oe(z)},null,8,a_)]))),128))])):P.kind==="taskList"?(y(),k("ul",l_,[(y(!0),k(De,null,mt(P.items,(z,Te)=>(y(),k("li",{key:`task-${ve}-${Te}`,class:"message-task-item"},[v("span",{class:"message-task-checkbox","data-checked":z.checked},J(z.checked?"☑":"☐"),9,c_),v("div",u_,[(y(!0),k(De,null,mt(Bt(z.text),(Ne,c)=>(y(),k(De,{key:`task-seg-${ve}-${Te}-${c}`},[Ne.kind==="text"?(y(),k("span",d_,J(Ne.value),1)):Ne.kind==="bold"?(y(),k("strong",f_,J(Ne.value),1)):Ne.kind==="italic"?(y(),k("em",h_,J(Ne.value),1)):Ne.kind==="strikethrough"?(y(),k("s",p_,J(Ne.value),1)):Ne.kind==="file"?(y(),k("a",{key:4,class:"message-file-link",href:It(Ne.path),target:"_blank",rel:"noopener noreferrer",title:Ne.path},J(Ne.displayPath),9,m_)):Ne.kind==="url"?(y(),k("a",{key:5,class:"message-file-link",href:Ne.href,target:"_blank",rel:"noopener noreferrer",title:Ne.href},J(Ne.value),9,g_)):(y(),k("code",v_,J(Ne.value),1))],64))),128))])]))),128))])):P.kind==="orderedList"?(y(),k("ol",{key:5,class:"message-list message-list-ordered",start:P.start},[(y(!0),k(De,null,mt(P.items,(z,Te)=>(y(),k("li",{key:`ol-${ve}-${Te}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:Oe(z)},null,8,w_)]))),128))],8,y_)):P.kind==="codeBlock"?(y(),k("div",b_,[P.language?(y(),k("div",__,J(P.language),1)):pe("",!0),v("pre",k_,[v("code",null,J(P.value),1)])])):P.kind==="thematicBreak"?(y(),k("hr",T_)):uo(h.id,ve)?(y(),k("p",S_,J(P.markdown),1)):(y(),k("button",{key:9,class:"message-image-button",type:"button",onClick:z=>ws(P.url)},[v("img",{class:"message-image-preview message-markdown-image",src:P.url,alt:P.alt||"Embedded message image",loading:"lazy",onError:z=>js(h.id,ve)},null,40,E_)],8,I_))],64))),128))]))],8,vb)):pe("",!0),zt(h)?(y(),k("div",{key:3,class:"message-toolbar","data-role":h.role},[st(h)?(y(),k("button",{key:0,type:"button",class:"message-fork-button","aria-label":"Fork thread from this response",title:"Fork thread from this response",onClick:P=>Jt(h.id)},[Be(xo,{class:"icon-svg message-fork-icon"}),m[5]||(m[5]=v("span",{class:"message-fork-label"},"Fork",-1))],8,A_)):pe("",!0),v("button",{type:"button",class:"message-copy-button","data-copied":We.value===h.id,"aria-label":We.value===h.id?"Response copied":"Copy response",title:We.value===h.id?"Response copied":"Copy response",onClick:P=>vt(h.id)},[Be(Fw,{class:"icon-svg message-copy-icon"}),v("span",R_,J(We.value===h.id?"Copied":"Copy"),1)],8,x_)],8,C_)):pe("",!0)],8,db)],8,ub)],8,cb))],8,qw))],64)}),128)),e.liveOverlay?(y(),k("li",P_,[v("div",M_,[v("div",$_,[v("article",O_,[v("p",N_,J(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(y(),k("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:pt},J(e.liveOverlay.reasoningText),513)):pe("",!0),e.liveOverlay.errorText?(y(),k("p",L_,J(e.liveOverlay.errorText),1)):pe("",!0)])])])])):pe("",!0),(y(!0),k(De,null,mt(e.pendingRequests,h=>(y(),k("li",{key:`server-request:${h.id}`,class:"conversation-item conversation-item-request"},[v("div",D_,[v("div",j_,[v("article",F_,[v("p",B_,J(h.method),1),v("p",U_,"Request #"+J(h.id)+" · "+J(jt(h.receivedAtIso)),1),jn(h)?(y(),k("p",H_,J(jn(h)),1)):pe("",!0),h.method==="item/commandExecution/requestApproval"?(y(),k("section",W_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>Nn(h.id,"accept")},"Accept",8,V_),v("button",{type:"button",class:"request-button",onClick:x=>Nn(h.id,"acceptForSession")},"Accept for Session",8,z_),v("button",{type:"button",class:"request-button",onClick:x=>Nn(h.id,"decline")},"Decline",8,q_),v("button",{type:"button",class:"request-button",onClick:x=>Nn(h.id,"cancel")},"Cancel",8,G_)])):h.method==="item/fileChange/requestApproval"?(y(),k("section",K_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>Nn(h.id,"accept")},"Accept",8,J_),v("button",{type:"button",class:"request-button",onClick:x=>Nn(h.id,"acceptForSession")},"Accept for Session",8,Y_),v("button",{type:"button",class:"request-button",onClick:x=>Nn(h.id,"decline")},"Decline",8,Q_),v("button",{type:"button",class:"request-button",onClick:x=>Nn(h.id,"cancel")},"Cancel",8,X_)])):h.method==="item/tool/requestUserInput"?(y(),k("section",Z_,[(y(!0),k(De,null,mt(Jr(h),x=>{var N;return y(),k("div",{key:`${h.id}:${x.id}`,class:"request-question"},[v("p",ek,J(x.header||x.question),1),x.header&&x.question?(y(),k("p",tk,J(x.question),1)):pe("",!0),x.options.length>0?(y(),k("select",{key:1,class:"request-select",value:ur(h.id,x.id,((N=x.options[0])==null?void 0:N.label)||""),onChange:P=>gs(h.id,x.id,P)},[(y(!0),k(De,null,mt(x.options,P=>(y(),k("option",{key:`${h.id}:${x.id}:${P.label}`,value:P.label},J(P.label),9,rk))),128))],40,nk)):pe("",!0),x.options.length>0&&Qr(h.id,x)?(y(),k("p",sk,J(Qr(h.id,x)),1)):(y(),k("input",{key:3,class:"request-input",type:x.isSecret?"password":"text",value:ur(h.id,x.id,""),placeholder:x.isSecret?"Enter secret answer":"Enter answer",onInput:P=>Yr(h.id,x.id,P)},null,40,ok)),x.isOther?(y(),k("input",{key:4,class:"request-input",type:x.isSecret?"password":"text",value:Fn(h.id,x.id),placeholder:"Other answer",onInput:P=>Xr(h.id,x.id,P)},null,40,ik)):pe("",!0)])}),128)),v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>Sr(h)}," Submit Answers ",8,ak)])):h.method==="item/tool/call"?(y(),k("section",lk,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>vs(h.id)},"Fail Tool Call",8,ck),v("button",{type:"button",class:"request-button",onClick:x=>I(h.id)},"Success (Empty)",8,uk)])):(y(),k("section",dk,[v("button",{type:"button",class:"request-button request-button-primary",onClick:x=>R(h.id)},"Return Empty Result",8,fk),v("button",{type:"button",class:"request-button",onClick:x=>$(h.id)},"Reject Request",8,hk)]))])])])]))),128)),v("li",{ref_key:"bottomAnchorRef",ref:Ft,class:"conversation-bottom-anchor"},null,512)],544)),V.value?(y(),k("button",{key:3,type:"button",class:"jump-to-latest-button",title:"Jump to latest","aria-label":"Jump to latest output",onClick:Ir},[Be(qf,{class:"icon-svg jump-to-latest-icon"})])):pe("",!0),ct.value.length>0?(y(),k("div",{key:4,class:"image-modal-backdrop",onClick:Er},[v("div",{class:"image-modal-content",onClick:m[0]||(m[0]=Tt(()=>{},["stop"]))},[v("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Er},[Be(Wl,{class:"icon-svg"})]),v("img",{class:"image-modal-image",src:ct.value,alt:"Expanded message image"},null,8,pk)])])):pe("",!0)]))}}),vk=gt(gk,[["__scopeId","data-v-998c3e48"]]),vu=.0025,ya=3,yu=2,yk=256;function wk(e){var je;const t=j("idle"),n=j(typeof navigator<"u"&&!!((je=navigator.mediaDevices)!=null&&je.getUserMedia)),r=j(0),s=j(null);let o=null,i=null,a=[],l=null,f=null,u=null,g=null,_=[],E=!1,B=!1;function M(){const ue=s.value;if(!ue||typeof window>"u")return;const se=ue.getContext("2d");if(!se)return;const de=Math.max(1,Math.floor(ue.clientWidth)),re=Math.max(1,Math.floor(ue.clientHeight||36)),Me=window.devicePixelRatio||1,Je=Math.max(1,Math.floor(de*Me)),qe=Math.max(1,Math.floor(re*Me));(ue.width!==Je||ue.height!==qe)&&(ue.width=Je,ue.height=qe),se.setTransform(Me,0,0,Me,0,0),se.clearRect(0,0,de,re);const Ge=Math.max(12,Math.floor(de/(ya+yu))),He=_.slice(-Ge),Pe=Math.max(0,Ge-He.length),rt=re/2,Ce=getComputedStyle(ue).color||"#000000";for(let Ue=0;Ue<Ge;Ue+=1){const lt=He[Ue-Pe]??0,pt=Math.max(.08,Math.min(1,lt*18))*rt,ct=Ue*(ya+yu);se.globalAlpha=lt<=vu?.35:1,se.fillStyle=Ce,se.fillRect(ct,rt-pt,ya,pt*2)}se.globalAlpha=1}function Z(){_=[],r.value=0,M()}function ce(){u&&(u.disconnect(),u.onaudioprocess=null,u=null),f&&(f.disconnect(),f=null),l&&(l.close(),l=null),g=null}function K(ue){if(typeof window>"u")return;const se=window.webkitAudioContext,de=window.AudioContext??se;de&&(ce(),Z(),l=new de,f=l.createMediaStreamSource(ue),u=l.createScriptProcessor(2048,1,1),g=performance.now(),u.onaudioprocess=re=>{const Me=re.inputBuffer.getChannelData(0);let Je=0;for(let qe=0;qe<Me.length;qe+=1){const Ge=Math.abs(Me[qe]??0);Je+=Ge<vu?0:Ge}_.push(Je/Me.length),_.length>yk&&_.shift(),g!==null&&(r.value=Math.max(0,performance.now()-g)),M()},f.connect(u),u.connect(l.destination),M())}async function te(){var ue;if(!(t.value!=="idle"||!n.value||E)){E=!0,B=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=se=>{se.data.size>0&&a.push(se.data)},o.onstop=()=>{var re;const se=a,de=(o==null?void 0:o.mimeType)||((re=se[0])==null?void 0:re.type)||"audio/webm";ge(),ke(se,de)},K(i),o.start(250),t.value="recording",B&&ne()}catch(se){ge(),t.value="idle",(ue=e.onError)==null||ue.call(e,se)}finally{E=!1}}}function ne(){if(E&&t.value==="idle"){B=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}async function ke(ue,se){var re,Me,Je,qe;if(ue.length===0){(re=e.onEmpty)==null||re.call(e),t.value="idle";return}const de=new Blob(ue,{type:se});t.value="transcribing";try{const Ge=se.split(/[/;]/)[1]??"webm",He=new FormData;He.append("file",de,`codex.${Ge}`);const Pe=await fetch("/codex-api/transcribe",{method:"POST",body:He}),rt=await Pe.text();let Ce=null;try{Ce=rt.trim()?JSON.parse(rt):null}catch{Ce=null}if(!Pe.ok){const lt=(Me=Ce==null?void 0:Ce.error)==null?void 0:Me.trim(),Ft=rt.trim();throw new Error(lt||Ft||`Transcription failed: ${Pe.status}`)}const Ue=((Ce==null?void 0:Ce.text)??"").trim();Ue.length>0?e.onTranscript(Ue):(Je=e.onEmpty)==null||Je.call(e)}catch(Ge){(qe=e.onError)==null||qe.call(e,Ge)}finally{t.value="idle"}}function ge(){ce(),Z(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(ue=>ue.stop()),i=null),a=[]}Kr(ge);function ye(){if(t.value==="recording"){ne();return}t.value==="idle"&&te()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:te,stopRecording:ne,toggleRecording:ye}}function wu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class jr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Vl(e,t){const n=wu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=wu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function ps(e,t,n){return e instanceof jr?e:e instanceof Error?new jr(e.message||t,{code:"unknown_error",method:n}):new jr(t,{code:"unknown_error",method:n})}function Gf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function bk(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 jr(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 jr(Vl(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 jr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function _k(e){const t=Gf(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 bu(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function kk(e){if(typeof window>"u")return()=>{};let t=null,n=!1,r=null;const s=()=>{r!==null&&(window.clearTimeout(r),r=null)},o=(f,u)=>{if(n||r!==null)return;const g=Math.min(1e3*2**u,1e4);r=window.setTimeout(()=>{r=null,!n&&f()},g)},i=f=>{const u=_k(f);u&&e(u)},a=(f=0)=>{if(typeof EventSource>"u"||n)return;t==null||t();const u=new EventSource("/codex-api/events");let g=!1;u.onmessage=_=>{try{i(JSON.parse(_.data))}catch{}},u.addEventListener("ready",_=>{try{const E=_.data?JSON.parse(_.data):{ok:!0};bu(e,E)}catch{bu(e)}}),u.onerror=()=>{n||g||u.readyState===EventSource.CLOSED&&(g=!0,u.close(),o(()=>a(f+1),f))},t=()=>{g=!0,u.close()}},l=(f=0)=>{if(typeof WebSocket>"u"||n){a();return}t==null||t();const u=window.location.protocol==="https:"?"wss:":"ws:",g=new WebSocket(`${u}//${window.location.host}/codex-api/ws`);let _=!1,E=!1,B=window.setTimeout(()=>{_||n||E||(E=!0,g.close(),a())},2500);g.onopen=()=>{_=!0,s(),B!==null&&(window.clearTimeout(B),B=null)},g.onmessage=M=>{try{i(JSON.parse(String(M.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(B!==null&&(window.clearTimeout(B),B=null),!(n||E)){if(!_){a();return}o(()=>l(f+1),f)}},t=()=>{E=!0,B!==null&&(window.clearTimeout(B),B=null),g.close()}};return typeof WebSocket<"u"?l():a(),()=>{n=!0,s(),t==null||t()}}async function Tk(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 jr(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 jr(Vl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function Sk(){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 jr(Vl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Gf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function _u(e){return new Date(e*1e3).toISOString()}function Ik(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Ek(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Ck=/^##\s+(.+?):\s+(.+?)\s*$/,Ak=/^#\s*files mentioned by the user\s*:?\s*$/i;function xk(e){var s,o;const t=e.split(`
52
+ `).findIndex(i=>Ak.test(i.trim()));if(t<0)return[];const n=e.split(`
53
+ `).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(Ck);if(!l)break;const f=(s=l[1])==null?void 0:s.trim(),u=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");f&&u&&r.push({label:f,path:u})}return r}function Rk(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 Pk(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:Ek(l),isUnhandled:!0});const o=n.join(`
54
+ `),i=xk(o);return{text:Rk(o),images:r,fileAttachments:i,rawBlocks:s}}function Mk(e){var o;const t=e.replace(/\r\n/g,`
55
+ `).trim();if(!t)return null;const n=t.split(`
56
+ `),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 f=(l[1]??" ").toLowerCase(),u=(o=l[2])==null?void 0:o.trim();if(!u)continue;let g="pending";f==="x"&&(g="completed"),(f==="~"||f===">"||f==="-")&&(g="inProgress"),r.push({step:u,status:g});continue}s.push(a)}return r.length===0?null:{explanation:s.join(`
57
+ `).trim()||void 0,steps:r}}function $k(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=Pk(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:Mk(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=Ok(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 Ok(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Nk(e){const t=e,n=[t.name,t.title,e.preview];for(const r of n)if(typeof r=="string"&&r.trim().length>0)return r.trim();return""}function Lk(e){const t=Nk(e);return t.length>0?t:"Untitled thread"}function Kf(e){return(e==null?void 0:e.status)==="inProgress"}function Dk(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 Kf(r)}function jk(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:Lk(e),projectName:Ik(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:_u(e.createdAt),updatedAtIso:_u(e.updatedAt),preview:e.preview,unread:!1,inProgress:Dk(e)}}function Fk(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 Bk(e){const t=e.data.map(jk);return Fk(t)}function zl(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 $k(i))n.push({...a,turnIndex:r})}return n}function Uk(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Kf(t.at(-1))}function wa(e){return e&&e.length>0?e:null}function ba(e){return e&&e.length>0?e:null}const ku=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Qn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function an(e){return typeof e=="string"&&e.length>0?e:null}function _a(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function rl(e){return typeof e=="boolean"?e:null}function Hk(e){return e==="payment_required"?e:null}function Wk(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Tu(e){const t=Qn(e);if(!t)return null;const n=_a(t.usedPercent??t.used_percent);return n===null?null:{usedPercent:n,windowMinutes:_a(t.windowDurationMins??t.window_minutes),resetsAt:_a(t.resetsAt??t.resets_at)}}function Vk(e){const t=Qn(e);if(!t)return null;const n=rl(t.hasCredits??t.has_credits),r=rl(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:an(t.balance)}}function sl(e){const t=Qn(e);if(!t)return null;const n=Tu(t.primary),r=Tu(t.secondary),s=Vk(t.credits);return!n&&!r&&!s?null:{limitId:an(t.limitId??t.limit_id),limitName:an(t.limitName??t.limit_name),primary:n,secondary:r,credits:s,planType:an(t.planType??t.plan_type)}}function Jf(e,t=null){const n=Qn(e);if(!n)return null;const r=an(n.accountId),s=an(n.quotaStatus),o=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,authMode:an(n.authMode),email:an(n.email),planType:an(n.planType),lastRefreshedAtIso:an(n.lastRefreshedAtIso)??"",lastActivatedAtIso:an(n.lastActivatedAtIso),quotaSnapshot:sl(n.quotaSnapshot),quotaUpdatedAtIso:an(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:an(n.quotaError),unavailableReason:Hk(n.unavailableReason)??(Wk(an(n.quotaError))?"payment_required":null),isActive:rl(n.isActive)??r===t}:null}function Yf(e){const t=Qn(e);if(!t)return null;const n=Qn(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=sl(n==null?void 0:n.codex);return r||sl(t.rateLimits??t.rate_limits)}async function cn(e,t){try{return await bk(e,t)}catch(n){throw ps(n,`RPC ${e} failed`,e)}}function zk(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function qk(){const e=await cn("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return Bk(e)}async function Gk(e){const t=await cn("thread/read",{threadId:e,includeTurns:!0});return{messages:zl(t),inProgress:Uk(t)}}async function Kk(){try{return await qk()}catch(e){throw ps(e,"Failed to load thread groups","thread/list")}}async function Jk(e){try{return await Gk(e)}catch(t){throw ps(t,`Failed to load thread ${e}`,"thread/read")}}function Yk(e){return kk(e)}async function Qk(e,t){await Tk({id:e,...t})}async function Xk(){return Sk()}async function Zk(){try{const e=await cn("account/rateLimits/read");return Yf(e)}catch(e){throw ps(e,"Failed to load account rate limits","account/rateLimits/read")}}function ql(e){const t=Qn(e),n=an(t==null?void 0:t.activeAccountId),r=Array.isArray(t==null?void 0:t.accounts)?t==null?void 0:t.accounts:[];return{activeAccountId:n,importedAccountId:an(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(s=>Jf(s,n)).filter(s=>s!==null)}}async function e0(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(Ls(t,"Failed to load accounts"));const n=Qn(t);return ql(n==null?void 0:n.data)}async function t0(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(Ls(t,"Failed to refresh accounts"));const n=Qn(t);return ql(n==null?void 0:n.data)}async function n0(e){const t=await fetch("/codex-api/accounts/switch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Ls(n,"Failed to switch account"));const r=Qn(n),s=Qn(r==null?void 0:r.data),o=Jf(s==null?void 0:s.account,an(s==null?void 0:s.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function r0(e){const t=await fetch("/codex-api/accounts/remove",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({accountId:e})}),n=await t.json();if(!t.ok)throw new Error(Ls(n,"Failed to remove account"));const r=Qn(n);return ql(r==null?void 0:r.data)}async function ka(e){await cn("thread/resume",{threadId:e})}async function s0(e){await cn("thread/archive",{threadId:e})}async function o0(e,t){await cn("thread/name/set",{threadId:e,name:t})}async function Su(e,t){const n=await cn("thread/rollback",{threadId:e,numTurns:t});return zl(n)}function Qf(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""}function i0(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.cwd;if(typeof r=="string"&&r.length>0)return r}return""}async function Iu(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 cn("thread/start",n),s=Qf(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw ps(n,"Failed to start a new thread","thread/start")}}async function a0(e){try{const t=await cn("thread/fork",{threadId:e,persistExtendedHistory:!0}),n=Qf(t);if(!n)throw new Error("thread/fork did not return a thread id");return{threadId:n,cwd:i0(t),messages:zl(t)}}catch(t){throw ps(t,`Failed to fork thread ${e}`,"thread/fork")}}function l0(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
58
+ `;for(const r of t)n+=`
59
+ ## ${r.label}: ${r.path}
60
+ `;return`${n}
61
+ ## My request for Codex:
62
+
63
+ ${e}
64
+ `}async function c0(e,t,n){var l;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?wa(n):ba(n)};let s=null;try{s=await Zf()}catch{s=null}const o=(s==null?void 0:s.model.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?wa(n??(s==null?void 0:s.reasoningEffort)):ba(n??(s==null?void 0:s.reasoningEffort))};let i=[];try{i=await Xf()}catch{i=[]}const a=((l=i.find(f=>f.trim().length>0))==null?void 0:l.trim())??"";if(a)return{model:a,reasoningEffort:e==="plan"?wa(n??(s==null?void 0:s.reasoningEffort)):ba(n??(s==null?void 0:s.reasoningEffort))};throw new Error(`${e==="plan"?"Plan":"Default"} mode requires an available model. Wait for models to load and try again.`)}async function Ta(e,t,n=[],r,s,o,i=[],a){try{const l=(r==null?void 0:r.trim())??"",u=[{type:"text",text:l0(t,i)}];for(const E of n){const B=E.trim();B&&u.push({type:"image",url:B,image_url:B})}if(o)for(const E of o)u.push({type:"skill",name:E.name,path:E.path});const g=i.map(E=>({label:E.label,path:E.path,fsPath:E.fsPath})),_={threadId:e,input:u};if(g.length>0&&(_.attachments=g),l&&(_.model=l),typeof s=="string"&&s.length>0&&(_.effort=s),a){const E=await c0(a,l,s);_.collaborationMode={mode:a,settings:{model:E.model,reasoning_effort:E.reasoningEffort,developer_instructions:null}}}await cn("turn/start",_)}catch(l){throw ps(l,`Failed to start turn for thread ${e}`,"turn/start")}}async function u0(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 cn("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw ps(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function d0(e){await cn("setDefaultModel",{model:e})}async function Xf(){const e=await cn("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 Zf(){const e=await cn("config/read",{}),t=e.config.model??"",n=zk(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function f0(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function h0(){try{const e=await cn("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:f0(r.name||s)||(s==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of ku)t.has(r.value)||n.push(r);return n.sort((r,s)=>r.value===s.value?0:r.value==="default"?-1:1)}}catch{}return ku}function p0(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 wo(){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 p0(n.data)}async function m0(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 Eu(){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 Cu(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 Au(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=Ls(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 g0(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=Ls(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 v0(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 f=Ls(o,"Failed to search files");throw new Error(f)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const f of a){if(!f||typeof f!="object"||Array.isArray(f))continue;const g=f.path,_=typeof g=="string"?g.trim():"";_&&l.push({path:_})}return l}async function y0(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 Ls(e,t){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.message;if(typeof r=="string"&&r.trim().length>0)return r;const s=n.error;return typeof s=="string"&&s.trim().length>0?s:t}async function w0(){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 Sa(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 b0(e,t){var n;try{return((n=(await cn("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function _0(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await cn("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 xu(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 k0={},T0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function S0(e,t){return y(),k("svg",T0,[...t[0]||(t[0]=[v("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 I0=gt(k0,[["render",S0]]),E0={},C0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function A0(e,t){return y(),k("svg",C0,[...t[0]||(t[0]=[v("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),v("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 Ru=gt(E0,[["render",A0]]),x0=["disabled"],R0={class:"composer-dropdown-value"},P0={class:"composer-dropdown-menu"},M0={key:0,class:"composer-dropdown-search-wrap"},$0=["placeholder","onKeydown"],O0={class:"composer-dropdown-options",role:"listbox"},N0=["onClick"],L0={key:0,class:"composer-dropdown-empty"},D0={key:1,class:"composer-dropdown-add-wrap"},j0=["placeholder","onKeydown"],F0=sn({__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=j(null),o=j(null),i=j(null),a=j(!1),l=j(""),f=j(!1),u=j(""),g=he(()=>{var de;const se=n.options.find(re=>re.value===n.modelValue);return se?se.label:((de=n.placeholder)==null?void 0:de.trim())||""}),_=he(()=>n.openDirection??"down"),E=he(()=>n.enableSearch===!0),B=he(()=>n.showAddAction===!0),M=he(()=>{var se;return((se=n.searchPlaceholder)==null?void 0:se.trim())||"Quick search projects"}),Z=he(()=>{var se;return((se=n.addActionLabel)==null?void 0:se.trim())||"Add new project"}),ce=he(()=>{var se;return((se=n.addPlaceholder)==null?void 0:se.trim())||"Project name or absolute path"}),K=he(()=>{const se=l.value.trim().toLowerCase();return se?n.options.filter(de=>de.label.toLowerCase().includes(se)||de.value.toLowerCase().includes(se)):n.options});function te(){n.disabled||(a.value=!a.value)}function ne(se){r("update:modelValue",se),a.value=!1,l.value=""}function ke(){var se;f.value=!0,u.value=((se=n.defaultAddValue)==null?void 0:se.trim())||"",Zt(()=>{var de;return(de=i.value)==null?void 0:de.focus()})}function ge(){if(l.value.length>0){l.value="";return}a.value=!1}function ye(){const se=u.value.trim();se&&(r("add",se),f.value=!1,u.value="",a.value=!1,l.value="")}function je(){f.value=!1,u.value="",a.value=!1,l.value=""}function ue(se){if(!a.value)return;const de=s.value;if(!de)return;const re=se.target;re instanceof Node&&(de.contains(re)||(a.value=!1,l.value="",f.value=!1,u.value=""))}return ft(a,se=>{if(!se){f.value=!1,u.value="";return}E.value&&Zt(()=>{var de;return(de=o.value)==null?void 0:de.focus()})}),Gr(()=>{window.addEventListener("pointerdown",ue)}),Kr(()=>{window.removeEventListener("pointerdown",ue)}),(se,de)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[v("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:te},[v("span",R0,J(g.value),1),Be(Ji,{class:"composer-dropdown-chevron"})],8,x0),a.value?(y(),k("div",{key:0,class:tt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":_.value==="up","composer-dropdown-menu-wrap-down":_.value==="down"}])},[v("div",P0,[E.value?(y(),k("div",M0,[Hr(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":de[0]||(de[0]=re=>l.value=re),class:"composer-dropdown-search-input",type:"text",placeholder:M.value,onKeydown:Cn(Tt(ge,["prevent"]),["esc"])},null,40,$0),[[Wr,l.value]])])):pe("",!0),v("ul",O0,[(y(!0),k(De,null,mt(K.value,re=>(y(),k("li",{key:re.value},[v("button",{class:tt(["composer-dropdown-option",{"is-selected":re.value===e.modelValue}]),type:"button",onClick:Me=>ne(re.value)},J(re.label),11,N0)]))),128)),K.value.length===0?(y(),k("li",L0," No matching projects ")):pe("",!0)]),B.value?(y(),k("div",D0,[f.value?(y(),k(De,{key:0},[Hr(v("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":de[1]||(de[1]=re=>u.value=re),class:"composer-dropdown-add-input",type:"text",placeholder:ce.value,onKeydown:[Cn(Tt(ye,["prevent"]),["enter"]),Cn(Tt(je,["prevent"]),["esc"])]},null,40,j0),[[Wr,u.value]]),v("div",{class:"composer-dropdown-add-actions"},[v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ye},"Open"),v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:je},"Cancel")])],64)):(y(),k("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:ke},J(Z.value),1))])):pe("",!0)])],2)):pe("",!0)],512))}}),ol=gt(F0,[["__scopeId","data-v-7cfa2012"]]),B0=["disabled"],U0={class:"search-dropdown-value"},H0={class:"search-dropdown-search-wrap"},W0=["placeholder","onKeydown"],V0={key:0,class:"search-dropdown-list",role:"listbox"},z0=["onClick","onPointerenter"],q0={class:"search-dropdown-option-check"},G0={class:"search-dropdown-option-label"},K0={key:0,class:"search-dropdown-option-desc"},J0={key:1,class:"search-dropdown-empty"},Y0=sn({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(null),i=j(!1),a=j(""),l=j(0),f=he(()=>n.openDirection??"down"),u=he(()=>new Set(n.selectedValues)),g=he(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const K=n.options.find(te=>te.value===n.selectedValues[0]);return(K==null?void 0:K.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),_=he(()=>{const K=a.value.toLowerCase().trim();return K?n.options.filter(te=>{var ne;return te.label.toLowerCase().includes(K)||(((ne=te.description)==null?void 0:ne.toLowerCase().includes(K))??!1)}):n.options});function E(){n.disabled||(i.value=!i.value,i.value&&(a.value="",l.value=0,Zt(()=>{var K;return(K=o.value)==null?void 0:K.focus()})))}function B(K){r("toggle",K.value,!u.value.has(K.value))}function M(K){_.value.length!==0&&(l.value=(l.value+K+_.value.length)%_.value.length)}function Z(){const K=_.value[l.value];K&&B(K)}function ce(K){if(!i.value)return;const te=s.value;if(!te)return;const ne=K.target;ne instanceof Node&&(te.contains(ne)||(i.value=!1))}return ft(a,()=>{l.value=0}),Gr(()=>window.addEventListener("pointerdown",ce)),Kr(()=>window.removeEventListener("pointerdown",ce)),(K,te)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[v("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:E},[v("span",U0,J(g.value),1),Be(Ji,{class:"search-dropdown-chevron"})],8,B0),i.value?(y(),k("div",{key:0,class:tt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":f.value==="up","search-dropdown-menu-wrap-down":f.value==="down"}])},[v("div",H0,[Hr(v("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":te[0]||(te[0]=ne=>a.value=ne),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[te[1]||(te[1]=Cn(Tt(ne=>i.value=!1,["prevent"]),["escape"])),Cn(Tt(Z,["prevent"]),["enter"]),te[2]||(te[2]=Cn(Tt(ne=>M(1),["prevent"]),["arrow-down"])),te[3]||(te[3]=Cn(Tt(ne=>M(-1),["prevent"]),["arrow-up"]))]},null,40,W0),[[Wr,a.value]])]),_.value.length>0?(y(),k("ul",V0,[(y(!0),k(De,null,mt(_.value,(ne,ke)=>(y(),k("li",{key:ne.value},[v("button",{class:tt(["search-dropdown-option",{"is-selected":u.value.has(ne.value),"is-highlighted":ke===l.value}]),type:"button",onClick:ge=>B(ne),onPointerenter:ge=>l.value=ke},[v("span",q0,J(u.value.has(ne.value)?"✓":""),1),v("span",G0,J(ne.label),1),ne.description?(y(),k("span",K0,J(ne.description),1)):pe("",!0)],42,z0)]))),128))])):(y(),k("div",J0,"No results"))],2)):pe("",!0)],512))}}),Q0=gt(Y0,[["__scopeId","data-v-a0f2edd4"]]),X0={class:"skill-picker-header"},Z0=["onKeydown"],eT={key:0,class:"skill-picker-list",role:"listbox"},tT=["onClick","onPointerenter"],nT={class:"skill-picker-name"},rT={key:0,class:"skill-picker-desc"},sT={key:1,class:"skill-picker-empty"},oT=sn({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(null),i=j(""),a=j(0),l=he(()=>{const _=i.value.toLowerCase().trim();return _?n.skills.filter(E=>E.name.toLowerCase().includes(_)||E.description.toLowerCase().includes(_)):n.skills}),f=he(()=>{const _={};return n.anchorBottom!=null&&(_.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(_.left=`${n.anchorLeft}px`),_});function u(_){l.value.length!==0&&(a.value=(a.value+_+l.value.length)%l.value.length)}function g(){const _=l.value[a.value];_&&r("select",_)}return ft(()=>n.visible,_=>{_&&(i.value="",a.value=0,Zt(()=>{var E;return(E=o.value)==null?void 0:E.focus()}))}),ft(i,()=>{a.value=0}),(_,E)=>e.visible?(y(),k("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:cs(f.value)},[v("div",X0,[Hr(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":E[0]||(E[0]=B=>i.value=B),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[E[1]||(E[1]=Cn(Tt(B=>_.$emit("close"),["prevent"]),["escape"])),Cn(Tt(g,["prevent"]),["enter"]),E[2]||(E[2]=Cn(Tt(B=>u(1),["prevent"]),["arrow-down"])),E[3]||(E[3]=Cn(Tt(B=>u(-1),["prevent"]),["arrow-up"]))]},null,40,Z0),[[Wr,i.value]])]),l.value.length>0?(y(),k("ul",eT,[(y(!0),k(De,null,mt(l.value,(B,M)=>(y(),k("li",{key:B.path},[v("button",{class:tt(["skill-picker-item",{"is-highlighted":M===a.value}]),type:"button",onClick:Z=>_.$emit("select",B),onPointerenter:Z=>a.value=M},[v("span",nT,J(B.name),1),B.description?(y(),k("span",rT,J(B.description),1)):pe("",!0)],42,tT)]))),128))])):(y(),k("div",sT,"No skills found"))],4)):pe("",!0)}}),iT=gt(oT,[["__scopeId","data-v-ff3fb7dc"]]),aT={key:0,class:"thread-composer-dictation-error"},lT={key:0,class:"thread-composer-attachments"},cT=["src","alt"],uT=["aria-label","disabled","onClick"],dT={key:1,class:"thread-composer-folder-chips"},fT=["title"],hT={class:"thread-composer-folder-chip-meta"},pT=["aria-label","disabled","onClick"],mT={key:2,class:"thread-composer-file-chips"},gT=["title"],vT=["aria-label","disabled","onClick"],yT={key:3,class:"thread-composer-skill-chips"},wT={class:"thread-composer-skill-chip-name"},bT=["aria-label","onClick"],_T=["title"],kT={class:"thread-composer-rate-limit-row"},TT={class:"thread-composer-rate-limit-value"},ST={key:0,class:"thread-composer-rate-limit-refresh"},IT={class:"thread-composer-input-wrap"},ET={key:0,class:"thread-composer-file-mentions"},CT=["onMousedown"],AT={key:1,class:"thread-composer-file-mention-icon-markdown"},xT={class:"thread-composer-file-mention-text"},RT={class:"thread-composer-file-mention-name"},PT={key:0,class:"thread-composer-file-mention-dir"},MT={key:1,class:"thread-composer-file-mention-empty"},$T=["placeholder","disabled"],OT=["disabled"],NT={key:0,class:"thread-composer-attach-menu"},LT=["disabled"],DT=["disabled"],jT=["disabled"],FT=["aria-label","aria-pressed","disabled"],BT={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},UT={key:1,class:"thread-composer-dictation-timer"},HT=["aria-label","title","disabled"],WT={key:1,class:"thread-composer-mic-spinner","aria-hidden":"true"},VT=["disabled"],zT=["aria-label","title","disabled"],qT=["disabled"],GT=["disabled"],KT=["disabled"],JT=sn({__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=j(""),o=j([]),i=j([]),a=j([]),l=j([]),f=j(""),{state:u,isSupported:g,recordingDurationMs:_,waveformCanvasRef:E,startRecording:B,stopRecording:M,toggleRecording:Z}=wk({onTranscript:A=>{s.value=s.value?`${s.value}
65
+ ${A}`:A,f.value="",Zt(()=>{var U;return(U=ke.value)==null?void 0:U.focus()})},onEmpty:()=>{f.value=n.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:A=>{if(A instanceof DOMException&&A.name==="NotAllowedError"){f.value="Microphone access was denied.";return}f.value=A instanceof Error?A.message:"Dictation failed."}}),ce=j(null),K=j(null),te=j(null),ne=j(null),ke=j(null),ge=j(!1),ye=j(!1),je=j(null),ue=j(""),se=j([]),de=j(!1),re=j(0);let Me=0,Je=null,qe=!1;const Ge=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),He=[{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"}],Pe=he(()=>n.models.map(A=>({value:A,label:A}))),rt=he(()=>n.selectedCollaborationMode==="plan"),Ce=he(()=>n.selectedCollaborationMode==="plan"&&n.selectedModel.trim().length===0),Ue=he(()=>n.skills??[]),lt=he(()=>i.value.map(A=>A.path)),Ft=he(()=>(n.skills??[]).map(A=>({value:A.path,label:A.name,description:A.description}))),pt=he(()=>n.disabled||!n.activeThreadId||Ce.value?!1:s.value.trim().length>0||o.value.length>0||a.value.length>0),ct=he(()=>{const A=new Set;for(const U of l.value)for(const ae of U.filePaths)A.add(ae);return a.value.filter(U=>!A.has(U.fsPath))}),We=he(()=>n.disabled||!n.activeThreadId),G=he(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),be=he(()=>u.value==="recording"),fe=he(()=>u.value==="recording"?"Stop dictation":u.value==="transcribing"?"Transcribing dictation":n.dictationClickToToggle?"Click to dictate":"Hold to dictate"),Ae=he(()=>u.value==="idle"?f.value.trim():""),Ee=he(()=>{const A=Math.max(0,Math.floor(_.value/1e3)),U=Math.floor(A/60),ae=A%60;return`${U}:${String(ae).padStart(2,"0")}`}),T=he(()=>n.activeThreadId?Ce.value?"Loading models for plan mode...":"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),S=he(()=>_e(n.codexQuota??null)),O=he(()=>""),X=he(()=>Se(n.codexQuota??null));function V(A){return!A||A==="unknown"?"":A==="edu"?"Education":`${A.slice(0,1).toUpperCase()}${A.slice(1)}`}function L(A){return typeof A!="number"||!Number.isFinite(A)||A<=0?"":A%1440===0?`${A/1440}d`:A%60===0?`${A/60}h`:`${A}m`}function W(A){if(typeof A!="number"||!Number.isFinite(A))return"";const ae=A*1e3-Date.now();if(ae<=0)return"resetting now";const Oe=Math.round(ae/6e4);if(Oe<60)return`resets in ${Math.max(1,Oe)}m`;const it=Math.round(Oe/60);if(it<48)return`resets in ${Math.max(1,it)}h`;const ht=Math.round(it/24);return`resets in ${Math.max(1,ht)}d`}function H(A){return typeof A!="number"||!Number.isFinite(A)?"":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(A*1e3))}function Y(A){if(typeof A!="number"||!Number.isFinite(A))return"";const U=new Date(A*1e3);return`${U.getMonth()+1}月${U.getDate()}日`}function Q(A){const U=[A.primary,A.secondary].filter(it=>it!==null),ae=U.find(it=>it.windowMinutes===10080);if(ae)return ae;const Oe=U.filter(it=>typeof it.windowMinutes=="number"&&it.windowMinutes>=10080).sort((it,ht)=>(it.windowMinutes??0)-(ht.windowMinutes??0));return Oe[0]?Oe[0]:A.secondary??null}function Ie(A){const U=Math.max(0,Math.min(100,100-Math.round(A.usedPercent))),ae=L(A.windowMinutes);return ae?`${U}% / ${ae}`:`${U}%`}function _e(A){var ht,dt;if(!A)return"";const U=[],ae=V(A.planType);ae&&U.push(ae),A.primary&&U.push(Ie(A.primary)),A.secondary&&U.push(Ie(A.secondary));const Oe=Q(A),it=Y((Oe==null?void 0:Oe.resetsAt)??null);return it&&U.push(it),U.length===0&&((ht=A.credits)!=null&&ht.unlimited)?U.push("Unlimited credits"):U.length===0&&((dt=A.credits)!=null&&dt.hasCredits)&&A.credits.balance&&U.push(`${A.credits.balance} credits`),U.join(" · ")}function Se(A){var it,ht;if(!A)return"";const U=[],ae=V(A.planType);if(ae&&U.push(`Plan: ${ae}`),A.primary){const dt=W(A.primary.resetsAt);U.push(`Primary window: ${Ie(A.primary)}${dt?`, ${dt}`:""}`)}if(A.secondary){const dt=W(A.secondary.resetsAt);U.push(`Secondary window: ${Ie(A.secondary)}${dt?`, ${dt}`:""}`)}(it=A.credits)!=null&&it.unlimited?U.push("Credits: unlimited"):(ht=A.credits)!=null&&ht.hasCredits&&A.credits.balance&&U.push(`Credits: ${A.credits.balance}`);const Oe=Q(A);if(Oe){const dt=H(Oe.resetsAt);dt&&U.push(`Weekly refresh: ${dt}`)}return U.join(`
66
+ `)}function xe(A="steer"){var ae;const U=s.value.trim();if(pt.value){if(r("submit",{text:U,imageUrls:o.value.map(Oe=>Oe.url),fileAttachments:[...a.value],skills:i.value.map(Oe=>({name:Oe.name,path:Oe.path})),mode:A}),s.value="",o.value=[],i.value=[],a.value=[],l.value=[],ge.value=!1,ye.value=!1,$e(),Ge){(ae=ke.value)==null||ae.blur();return}Zt(()=>{var Oe;return(Oe=ke.value)==null?void 0:Oe.focus()})}}function Ve(){r("interrupt")}function ot(A){r("update:selected-model",A)}function Ze(){r("update:selected-collaboration-mode",rt.value?"default":"plan")}function ut(A){r("update:selected-reasoning-effort",A)}function bt(){n.dictationClickToToggle&&(f.value&&(f.value=""),Z())}function Rt(A){if(n.dictationClickToToggle||(A.preventDefault(),qe))return;qe=!0;const U=A.currentTarget;if(U)try{U.setPointerCapture(A.pointerId)}catch{}f.value&&(f.value=""),window.addEventListener("pointerup",Qe),window.addEventListener("pointercancel",Qe),window.addEventListener("blur",Qe),B()}function Qe(){n.dictationClickToToggle||qe&&(qe=!1,window.removeEventListener("pointerup",Qe),window.removeEventListener("pointercancel",Qe),window.removeEventListener("blur",Qe),M())}function Pt(){We.value||(ge.value=!ge.value)}function zt(){var A;(A=K.value)==null||A.click()}function st(){var A;(A=te.value)==null||A.click()}function _t(){var A;(A=ne.value)==null||A.click()}function vt(A){o.value=o.value.filter(U=>U.id!==A)}function Jt(A){i.value=i.value.filter(U=>U.path!==A)}function kt(A){a.value=a.value.filter(U=>U.fsPath!==A)}function Mt(A){const U=l.value.find(Oe=>Oe.id===A);if(!U)return;const ae=new Set(U.filePaths);a.value=a.value.filter(Oe=>!ae.has(Oe.fsPath)),l.value=l.value.filter(Oe=>Oe.id!==A)}function Hn(A){return A.total<=0?0:Math.round(A.processed/A.total*100)}function un(A,U){const ae=A.replace(/\\/g,"/");if(a.value.some(ht=>ht.fsPath===ae))return;const Oe=ae.split("/").filter(Boolean),it=(U==null?void 0:U.trim())||Oe[Oe.length-1]||ae;a.value=[...a.value,{label:it,path:ae,fsPath:ae}]}function Bt(A){return A.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(A.name)}function tn(A){const U=new FileReader;U.onload=()=>{typeof U.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:A.name||`Pasted image ${o.value.length+1}`,url:U.result})},U.readAsDataURL(A)}function It(A){if(!(!A||A.length===0))for(const U of Array.from(A)){if(Bt(U)){tn(U);continue}xu(U).then(ae=>{ae&&un(ae)}).catch(()=>{})}}function Rn(A){var Oe,it;const U=(Oe=A.clipboardData)==null?void 0:Oe.items;if(U&&U.length>0){const ht=[];for(const dt of Array.from(U)){if(dt.kind!=="file"||!dt.type.startsWith("image/"))continue;const jt=dt.getAsFile();jt&&ht.push(jt)}if(ht.length>0)return ht}const ae=(it=A.clipboardData)==null?void 0:it.files;return!ae||ae.length===0?[]:Array.from(ae).filter(ht=>Bt(ht))}function $t(A){if(We.value)return;const U=Rn(A);U.length!==0&&(A.preventDefault(),It(U),ge.value=!1,f.value&&(f.value=""))}async function on(A){if(!A||A.length===0)return;const U=Array.from(A),Oe=(U[0].webkitRelativePath||U[0].name).split("/").filter(Boolean)[0]||"Folder",it=`${Date.now()}-${Math.random().toString(36).slice(2)}`;l.value=[...l.value,{id:it,name:Oe,total:U.length,processed:0,filePaths:[],isUploading:!0}];const ht=dt=>{l.value=l.value.map(jt=>jt.id===it?dt(jt):jt)};for(const dt of U)try{const jt=await xu(dt);if(jt){const jn=dt.webkitRelativePath||dt.name;un(jt,jn),ht(Yt=>({...Yt,processed:Yt.processed+1,filePaths:[...Yt.filePaths,jt]}));continue}ht(jn=>({...jn,processed:jn.processed+1}))}catch{ht(jt=>({...jt,processed:jt.processed+1}))}ht(dt=>({...dt,isUploading:!1}))}function nn(A){A&&(A.value="")}function rn(A){const U=A.target;It((U==null?void 0:U.files)??null),nn(U),ge.value=!1}function bn(A){const U=A.target;It((U==null?void 0:U.files)??null),nn(U),ge.value=!1}function dn(A){const U=A.target;on((U==null?void 0:U.files)??null),nn(U),ge.value=!1}function Xn(){f.value&&(f.value="");const U=s.value.startsWith("/");U!==ye.value&&(ye.value=U),Re()}function Pn(A){if(de.value){if(A.key==="Escape"){A.preventDefault(),$e();return}if(A.key==="ArrowDown"){A.preventDefault(),se.value.length>0&&(re.value=(re.value+1)%se.value.length);return}if(A.key==="ArrowUp"){if(A.preventDefault(),se.value.length>0){const ae=se.value.length;re.value=(re.value+ae-1)%ae}return}if(A.key==="Enter"||A.key==="Tab"){A.preventDefault();const ae=se.value[re.value];ae?qt(ae):$e();return}}if(n.sendWithEnter!==!1?A.key==="Enter"&&!A.shiftKey:A.key==="Enter"&&(A.metaKey||A.ctrlKey)){A.preventDefault(),xe(n.isTurnInProgress?G.value:"steer");return}if(ye.value){if(A.key==="Escape"){A.preventDefault(),Mn();return}if(A.key==="ArrowDown"||A.key==="ArrowUp"){A.preventDefault();return}}}function Mn(){var A;ye.value=!1,(A=ke.value)==null||A.focus()}function $e(){de.value=!1,je.value=null,ue.value="",se.value=[],re.value=0}function Re(){const A=ke.value;if(!A){$e();return}const U=A.selectionStart??s.value.length,Oe=s.value.slice(0,U).match(/(^|\s)(@[^\s@]*)$/);if(!Oe){$e();return}const it=Oe[2]??"",ht=it.length,dt=U-ht;je.value=dt,ue.value=it.slice(1),de.value=!0,_n()}async function _n(){if(!de.value)return;const A=(n.cwd??"").trim();if(!A){se.value=[];return}Je&&clearTimeout(Je);const U=++Me;Je=setTimeout(async()=>{try{const ae=await v0(A,ue.value,20);if(!de.value||U!==Me)return;se.value=ae,re.value=0}catch{if(!de.value||U!==Me)return;se.value=[]}},120)}function qt(A){const U=ke.value,ae=je.value;if(ae!==null&&U){const Oe=U.selectionStart??s.value.length;s.value=`${s.value.slice(0,ae)}${s.value.slice(Oe)}`.trimEnd()}un(A.path),$e(),Zt(()=>U==null?void 0:U.focus())}function Zn(A){const U=A.lastIndexOf("/");return U<0?A:A.slice(U+1)}function Wn(A){const U=A.lastIndexOf("/");return U<=0?"":A.slice(0,U)}function Dn(A){const U=Zn(A),ae=U.lastIndexOf(".");return ae<=0?"":U.slice(ae+1).toLowerCase()}function Vn(A){const U=Dn(A);return U==="ts"?"TS":U==="tsx"?"TSX":U==="js"?"JS":U==="jsx"?"JSX":U==="json"?"{}":""}function zn(A){const U=Dn(A);return U.startsWith("ts")?"ts":U.startsWith("js")?"js":U==="json"?"json":"default"}function kn(A){const U=Dn(A);return U==="md"||U==="mdx"}function qn(A){var U;i.value.some(ae=>ae.path===A.path)||(i.value=[...i.value,A]),s.value=s.value.startsWith("/")?"":s.value,ye.value=!1,(U=ke.value)==null||U.focus()}function $n(A,U){if(U){const ae=(n.skills??[]).find(Oe=>Oe.path===A);ae&&!i.value.some(Oe=>Oe.path===A)&&(i.value=[...i.value,ae])}else i.value=i.value.filter(ae=>ae.path!==A)}function On(A){if(!ge.value)return;const U=ce.value;if(!U)return;const ae=A.target;!ae||U.contains(ae)||(ge.value=!1)}return Gr(()=>{document.addEventListener("click",On)}),Kr(()=>{document.removeEventListener("click",On),window.removeEventListener("pointerup",Qe),window.removeEventListener("pointercancel",Qe),window.removeEventListener("blur",Qe),Je&&clearTimeout(Je)}),ft(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],a.value=[],l.value=[],f.value="",ge.value=!1,ye.value=!1,$e()}),ft(()=>n.cwd,()=>{de.value&&_n()}),(A,U)=>(y(),k("form",{class:"thread-composer",onSubmit:U[2]||(U[2]=Tt(ae=>xe("steer"),["prevent"]))},[Ae.value?(y(),k("p",aT,J(Ae.value),1)):pe("",!0),v("div",{class:tt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(y(),k("div",lT,[(y(!0),k(De,null,mt(o.value,ae=>(y(),k("div",{key:ae.id,class:"thread-composer-attachment"},[v("img",{class:"thread-composer-attachment-image",src:ae.url,alt:ae.name||"Selected image"},null,8,cT),v("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${ae.name||"image"}`,disabled:We.value,onClick:Oe=>vt(ae.id)}," x ",8,uT)]))),128))])):pe("",!0),l.value.length>0?(y(),k("div",dT,[(y(!0),k(De,null,mt(l.value,ae=>(y(),k("span",{key:ae.id,class:"thread-composer-folder-chip"},[Be(Hl,{class:"thread-composer-folder-chip-icon"}),v("span",{class:"thread-composer-folder-chip-name",title:ae.name},J(ae.name),9,fT),v("span",hT,[ae.isUploading?(y(),k(De,{key:0},[jo(J(Hn(ae))+"% uploading ("+J(ae.processed)+"/"+J(ae.total)+") ",1)],64)):(y(),k(De,{key:1},[jo(J(ae.filePaths.length)+" file"+J(ae.filePaths.length===1?"":"s"),1)],64))]),v("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${ae.name}`,disabled:We.value,onClick:Oe=>Mt(ae.id)},"×",8,pT)]))),128))])):pe("",!0),ct.value.length>0?(y(),k("div",mT,[(y(!0),k(De,null,mt(ct.value,ae=>(y(),k("span",{key:ae.fsPath,class:"thread-composer-file-chip"},[Be(Ci,{class:"thread-composer-file-chip-icon"}),v("span",{class:"thread-composer-file-chip-name",title:ae.fsPath},J(ae.label),9,gT),v("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${ae.label}`,disabled:We.value,onClick:Oe=>kt(ae.fsPath)},"×",8,vT)]))),128))])):pe("",!0),i.value.length>0?(y(),k("div",yT,[(y(!0),k(De,null,mt(i.value,ae=>(y(),k("span",{key:ae.path,class:"thread-composer-skill-chip"},[v("span",wT,J(ae.name),1),v("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${ae.name}`,onClick:Oe=>Jt(ae.path)},"×",8,bT)]))),128))])):pe("",!0),S.value?(y(),k("div",{key:4,class:"thread-composer-rate-limit",title:X.value,"aria-live":"polite"},[v("span",kT,[v("span",TT,J(S.value),1)]),O.value?(y(),k("span",ST,J(O.value),1)):pe("",!0)],8,_T)):pe("",!0),v("div",IT,[de.value?(y(),k("div",ET,[se.value.length>0?(y(!0),k(De,{key:0},mt(se.value,(ae,Oe)=>(y(),k("button",{key:ae.path,class:tt(["thread-composer-file-mention-row",{"is-active":Oe===re.value}]),type:"button",onMousedown:Tt(it=>qt(ae),["prevent"])},[Vn(ae.path)?(y(),k("span",{key:0,class:tt(["thread-composer-file-mention-icon-badge",`is-${zn(ae.path)}`])},J(Vn(ae.path)),3)):kn(ae.path)?(y(),k("span",AT,"↓")):(y(),wt(Ci,{key:2,class:"thread-composer-file-mention-icon-file"})),v("span",xT,[v("span",RT,J(Zn(ae.path)),1),Wn(ae.path)?(y(),k("span",PT,J(Wn(ae.path)),1)):pe("",!0)])],42,CT))),128)):(y(),k("div",MT,"No matching files"))])):pe("",!0),Hr(v("textarea",{ref_key:"inputRef",ref:ke,"onUpdate:modelValue":U[0]||(U[0]=ae=>s.value=ae),class:"thread-composer-input",placeholder:T.value,disabled:We.value,onInput:Xn,onKeydown:Pn,onPaste:$t},null,40,$T),[[Wr,s.value]]),Be(iT,{skills:Ue.value,visible:ye.value,"anchor-bottom":44,"anchor-left":0,onSelect:qn,onClose:Mn},null,8,["skills","visible"])]),v("div",{class:tt(["thread-composer-controls",{"thread-composer-controls--recording":be.value}])},[v("div",{ref_key:"attachMenuRootRef",ref:ce,class:"thread-composer-attach"},[v("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:We.value,onClick:Pt}," + ",8,OT),ge.value?(y(),k("div",NT,[v("button",{class:"thread-composer-attach-item",type:"button",disabled:We.value,onClick:zt}," Add photos & files ",8,LT),v("button",{class:"thread-composer-attach-item",type:"button",disabled:We.value,onClick:_t}," Add folder ",8,DT),v("button",{class:"thread-composer-attach-item",type:"button",disabled:We.value,onClick:st}," Take photo ",8,jT)])):pe("",!0)],512),be.value?pe("",!0):(y(),k(De,{key:0},[v("button",{class:tt(["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:Ze},[...U[3]||(U[3]=[v("span",{class:"thread-composer-plan-toggle-label"},"Plan",-1),v("span",{class:"thread-composer-plan-toggle-switch","aria-hidden":"true"},[v("span",{class:"thread-composer-plan-toggle-switch-thumb"})],-1)])],10,FT),Be(ol,{class:"thread-composer-control","model-value":e.selectedModel,options:Pe.value,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":ot},null,8,["model-value","options","disabled"]),Be(Q0,{class:"thread-composer-control",options:Ft.value,"selected-values":lt.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:$n},null,8,["options","selected-values","disabled"]),Be(ol,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:He,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":ut},null,8,["model-value","disabled"])],64)),v("div",{class:tt(["thread-composer-actions",{"thread-composer-actions--recording":be.value}])},[we(u)==="recording"?(y(),k("div",BT,[v("canvas",{ref_key:"dictationWaveformCanvasRef",ref:E,class:"thread-composer-dictation-waveform"},null,512)])):pe("",!0),we(u)==="recording"?(y(),k("span",UT,J(Ee.value),1)):pe("",!0),we(g)&&!e.isTurnInProgress?(y(),k("button",{key:2,class:tt(["thread-composer-mic",{"thread-composer-mic--active":we(u)==="recording","thread-composer-mic--transcribing":we(u)==="transcribing"}]),type:"button","aria-label":fe.value,title:fe.value,disabled:We.value||we(u)==="transcribing",onClick:bt,onPointerdown:Rt,onPointerup:Qe,onPointercancel:Qe},[we(u)==="recording"?(y(),wt(Ru,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):we(u)==="transcribing"?(y(),k("span",WT)):(y(),wt(I0,{key:2,class:"thread-composer-mic-icon"}))],42,HT)):pe("",!0),e.isTurnInProgress?(y(),k("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:Ve},[Be(Ru,{class:"thread-composer-stop-icon"})],8,VT)):pe("",!0),v("button",{class:tt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&G.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&G.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${G.value}`:"Send",disabled:!pt.value,onClick:U[1]||(U[1]=ae=>xe(e.isTurnInProgress?G.value:"steer"))},[Be(qf,{class:"thread-composer-submit-icon"})],10,zT)],2)],2)],2),v("input",{ref_key:"photoLibraryInputRef",ref:K,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:We.value,onChange:rn},null,40,qT),v("input",{ref_key:"cameraCaptureInputRef",ref:te,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:We.value,onChange:bn},null,40,GT),v("input",{ref_key:"folderPickerInputRef",ref:ne,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:We.value,onChange:dn},null,40,KT)],32))}}),Pu=gt(JT,[["__scopeId","data-v-dc703024"]]),YT={key:0,class:"queued-messages"},QT={class:"queued-messages-inner"},XT={class:"queued-row-text"},ZT={class:"queued-row-actions"},eS=["onClick"],tS=["onClick"],nS=sn({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(y(),k("div",YT,[v("div",QT,[(y(!0),k(De,null,mt(e.messages,r=>(y(),k("div",{key:r.id,class:"queued-row"},[n[1]||(n[1]=v("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[v("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)),v("span",XT,J(r.text),1),v("div",ZT,[v("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,eS),v("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]=[v("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[v("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,tS)])]))),128))])])):pe("",!0)}}),rS=gt(nS,[["__scopeId","data-v-ea583733"]]),sS={class:"runtime-dropdown-trigger-label"},oS={key:0,class:"runtime-dropdown-menu-wrap"},iS={class:"runtime-dropdown-menu"},aS=["onClick"],lS={class:"runtime-dropdown-option-label"},cS={key:0,class:"runtime-dropdown-option-check"},uS=sn({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=j(null),o=j(!1),i=[{value:"local",label:"Local project",icon:Hl},{value:"worktree",label:"New worktree",icon:xo}],a=he(()=>i.find(u=>u.value===n.modelValue)??i[0]);function l(u){r("update:modelValue",u),o.value=!1}function f(u){if(!o.value)return;const g=s.value;if(!g)return;const _=u.target;_ instanceof Node&&(g.contains(_)||(o.value=!1))}return Gr(()=>{window.addEventListener("pointerdown",f)}),Kr(()=>{window.removeEventListener("pointerdown",f)}),(u,g)=>(y(),k("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[v("button",{class:"runtime-dropdown-trigger",type:"button",onClick:g[0]||(g[0]=_=>o.value=!o.value)},[(y(),wt(Ti(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),v("span",sS,J(a.value.label),1),Be(Ji,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(y(),k("div",oS,[v("div",iS,[g[1]||(g[1]=v("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(y(),k(De,null,mt(i,_=>v("button",{key:_.value,class:tt(["runtime-dropdown-option",{"is-selected":e.modelValue===_.value}]),type:"button",onClick:E=>l(_.value)},[(y(),wt(Ti(_.icon),{class:"runtime-dropdown-option-icon"})),v("span",lS,J(_.label),1),e.modelValue===_.value?(y(),k("span",cS,"✓")):pe("",!0)],10,aS)),64))])])):pe("",!0)],512))}}),dS=gt(uS,[["__scopeId","data-v-9c9b71e5"]]),fS={},hS={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function pS(e,t){return y(),k("svg",hS,[...t[0]||(t[0]=[v("circle",{cx:"11",cy:"11",r:"8"},null,-1),v("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const il=gt(fS,[["render",pS]]),mS={class:"skill-card-top"},gS=["src","alt"],vS={key:1,class:"skill-card-avatar-fallback"},yS={class:"skill-card-info"},wS={class:"skill-card-header"},bS={class:"skill-card-name"},_S={key:0,class:"skill-card-badge-disabled"},kS={key:1,class:"skill-card-badge"},TS={class:"skill-card-owner"},SS={key:0,class:"skill-card-desc"},IS={key:1,class:"skill-card-date"},ES=sn({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=he(()=>{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)=>(y(),k("button",{class:tt(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:o[0]||(o[0]=i=>s.$emit("select",e.skill))},[v("div",mS,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,gS)):(y(),k("div",vS,J(e.skill.owner.charAt(0)),1)),v("div",yS,[v("div",wS,[v("span",bS,J(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(y(),k("span",_S,"Disabled")):e.skill.installed?(y(),k("span",kS,"Installed")):pe("",!0)]),v("span",TS,J(e.skill.owner),1)])]),e.skill.description?(y(),k("p",SS,J(e.skill.description),1)):pe("",!0),n.value?(y(),k("span",IS,J(n.value),1)):pe("",!0)],2))}}),Mu=gt(ES,[["__scopeId","data-v-2a1e8196"]]),CS={class:"sdm-panel"},AS={class:"sdm-header"},xS={class:"sdm-title-area"},RS=["src","alt"],PS={class:"sdm-title-col"},MS={class:"sdm-title-row"},$S={class:"sdm-title"},OS={key:0,class:"sdm-badge-disabled"},NS={class:"sdm-owner"},LS={class:"sdm-body"},DS={key:0,class:"sdm-desc"},jS={key:1,class:"sdm-readme-loading"},FS=["innerHTML"],BS=["href"],US={class:"sdm-footer"},HS={class:"sdm-footer-actions"},WS=["disabled"],VS=["disabled"],zS=["disabled"],qS=sn({__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=j(null),o=j(""),i=j(!1),a=he(()=>s.value??n.skill.enabled??!0),l=he(()=>n.isInstalling===!0||n.isUninstalling===!0),f=he(()=>{const M=o.value;if(!M)return"";const Z=M.replace(/^---[\s\S]*?---\s*/,"");return u(Z)});function u(M){return M.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 g(){if(!(!n.skill.owner||!n.skill.name)){i.value=!0,o.value="";try{const M=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),Z=await fetch(`/codex-api/skills-hub/readme?${M}`);if(!Z.ok)return;const ce=await Z.json();o.value=ce.content??""}catch{}finally{i.value=!1}}}ft(()=>n.visible,M=>{M&&(s.value=null,o.value="",g())});function _(){r("install",n.skill)}function E(){r("uninstall",n.skill)}function B(){const M=!a.value;s.value=M,r("toggle-enabled",n.skill,M)}return(M,Z)=>(y(),wt(So,{to:"body"},[e.visible?(y(),k("div",{key:0,class:"sdm-overlay",onClick:Z[1]||(Z[1]=Tt(ce=>M.$emit("close"),["self"]))},[v("div",CS,[v("div",AS,[v("div",xS,[e.skill.avatarUrl?(y(),k("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,RS)):pe("",!0),v("div",PS,[v("div",MS,[v("h3",$S,J(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(y(),k("span",OS,"Disabled")):pe("",!0)]),v("span",NS,J(e.skill.owner),1)])]),v("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:Z[0]||(Z[0]=ce=>M.$emit("close"))},[Be(Wl,{class:"sdm-close-icon"})])]),v("div",LS,[e.skill.description?(y(),k("p",DS,J(e.skill.description),1)):pe("",!0),i.value?(y(),k("div",jS,"Loading skill contents...")):o.value?(y(),k("div",{key:2,class:"sdm-readme",innerHTML:f.value},null,8,FS)):pe("",!0),v("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,BS)]),v("div",US,[v("div",HS,[e.skill.installed?(y(),k("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:E},J(n.isUninstalling?"Uninstalling...":"Uninstall"),9,WS)):(y(),k("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:_},J(n.isInstalling?"Installing...":"Install"),9,VS)),e.skill.installed?(y(),k("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:B},J(a.value?"Disable":"Enable"),9,zS)):pe("",!0)])])])])):pe("",!0)]))}}),GS=gt(qS,[["__scopeId","data-v-19a385ca"]]),KS=()=>{};var $u={};/**
67
+ * @license
68
+ * Copyright 2017 Google LLC
69
+ *
70
+ * Licensed under the Apache License, Version 2.0 (the "License");
71
+ * you may not use this file except in compliance with the License.
72
+ * You may obtain a copy of the License at
73
+ *
74
+ * http://www.apache.org/licenses/LICENSE-2.0
75
+ *
76
+ * Unless required by applicable law or agreed to in writing, software
77
+ * distributed under the License is distributed on an "AS IS" BASIS,
78
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
79
+ * See the License for the specific language governing permissions and
80
+ * limitations under the License.
81
+ */const eh=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("")},th={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,f=l?e[s+2]:0,u=o>>2,g=(o&3)<<4|a>>4;let _=(a&15)<<2|f>>6,E=f&63;l||(E=64,i||(_=64)),r.push(n[u],n[g],n[_],n[E])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(eh(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 f=s<e.length?n[e.charAt(s)]:64;++s;const g=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||f==null||g==null)throw new YS;const _=o<<2|a>>4;if(r.push(_),f!==64){const E=a<<4&240|f>>2;if(r.push(E),g!==64){const B=f<<6&192|g;r.push(B)}}}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 YS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const QS=function(e){const t=eh(e);return th.encodeByteArray(t,!0)},nh=function(e){return QS(e).replace(/\./g,"")},rh=function(e){try{return th.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
82
+ * @license
83
+ * Copyright 2022 Google LLC
84
+ *
85
+ * Licensed under the Apache License, Version 2.0 (the "License");
86
+ * you may not use this file except in compliance with the License.
87
+ * You may obtain a copy of the License at
88
+ *
89
+ * http://www.apache.org/licenses/LICENSE-2.0
90
+ *
91
+ * Unless required by applicable law or agreed to in writing, software
92
+ * distributed under the License is distributed on an "AS IS" BASIS,
93
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94
+ * See the License for the specific language governing permissions and
95
+ * limitations under the License.
96
+ */function XS(){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.")}/**
97
+ * @license
98
+ * Copyright 2022 Google LLC
99
+ *
100
+ * Licensed under the Apache License, Version 2.0 (the "License");
101
+ * you may not use this file except in compliance with the License.
102
+ * You may obtain a copy of the License at
103
+ *
104
+ * http://www.apache.org/licenses/LICENSE-2.0
105
+ *
106
+ * Unless required by applicable law or agreed to in writing, software
107
+ * distributed under the License is distributed on an "AS IS" BASIS,
108
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
109
+ * See the License for the specific language governing permissions and
110
+ * limitations under the License.
111
+ */const ZS=()=>XS().__FIREBASE_DEFAULTS__,eI=()=>{if(typeof process>"u"||typeof $u>"u")return;const e=$u.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},tI=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&rh(e[1]);return t&&JSON.parse(t)},Gl=()=>{try{return KS()||ZS()||eI()||tI()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},nI=e=>{var t,n;return(n=(t=Gl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},sh=()=>{var e;return(e=Gl())==null?void 0:e.config},oh=e=>{var t;return(t=Gl())==null?void 0:t[`_${e}`]};/**
112
+ * @license
113
+ * Copyright 2017 Google LLC
114
+ *
115
+ * Licensed under the Apache License, Version 2.0 (the "License");
116
+ * you may not use this file except in compliance with the License.
117
+ * You may obtain a copy of the License at
118
+ *
119
+ * http://www.apache.org/licenses/LICENSE-2.0
120
+ *
121
+ * Unless required by applicable law or agreed to in writing, software
122
+ * distributed under the License is distributed on an "AS IS" BASIS,
123
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124
+ * See the License for the specific language governing permissions and
125
+ * limitations under the License.
126
+ */class rI{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))}}}/**
127
+ * @license
128
+ * Copyright 2017 Google LLC
129
+ *
130
+ * Licensed under the Apache License, Version 2.0 (the "License");
131
+ * you may not use this file except in compliance with the License.
132
+ * You may obtain a copy of the License at
133
+ *
134
+ * http://www.apache.org/licenses/LICENSE-2.0
135
+ *
136
+ * Unless required by applicable law or agreed to in writing, software
137
+ * distributed under the License is distributed on an "AS IS" BASIS,
138
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139
+ * See the License for the specific language governing permissions and
140
+ * limitations under the License.
141
+ */function xn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function sI(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(xn())}function oI(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function iI(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function aI(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function lI(){const e=xn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function cI(){try{return typeof indexedDB=="object"}catch{return!1}}function uI(){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)}})}/**
142
+ * @license
143
+ * Copyright 2017 Google LLC
144
+ *
145
+ * Licensed under the Apache License, Version 2.0 (the "License");
146
+ * you may not use this file except in compliance with the License.
147
+ * You may obtain a copy of the License at
148
+ *
149
+ * http://www.apache.org/licenses/LICENSE-2.0
150
+ *
151
+ * Unless required by applicable law or agreed to in writing, software
152
+ * distributed under the License is distributed on an "AS IS" BASIS,
153
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
154
+ * See the License for the specific language governing permissions and
155
+ * limitations under the License.
156
+ */const dI="FirebaseError";class ms extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=dI,Object.setPrototypeOf(this,ms.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Jo.prototype.create)}}class Jo{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?fI(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new ms(s,a,r)}}function fI(e,t){return e.replace(hI,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const hI=/\{\$([^}]+)}/g;function pI(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function oo(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(Ou(o)&&Ou(i)){if(!oo(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Ou(e){return e!==null&&typeof e=="object"}/**
157
+ * @license
158
+ * Copyright 2017 Google LLC
159
+ *
160
+ * Licensed under the Apache License, Version 2.0 (the "License");
161
+ * you may not use this file except in compliance with the License.
162
+ * You may obtain a copy of the License at
163
+ *
164
+ * http://www.apache.org/licenses/LICENSE-2.0
165
+ *
166
+ * Unless required by applicable law or agreed to in writing, software
167
+ * distributed under the License is distributed on an "AS IS" BASIS,
168
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
169
+ * See the License for the specific language governing permissions and
170
+ * limitations under the License.
171
+ */function Yo(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 mI(e,t){const n=new gI(e,t);return n.subscribe.bind(n)}class gI{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.");vI(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=Ia),s.error===void 0&&(s.error=Ia),s.complete===void 0&&(s.complete=Ia);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 vI(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 Ia(){}/**
172
+ * @license
173
+ * Copyright 2021 Google LLC
174
+ *
175
+ * Licensed under the Apache License, Version 2.0 (the "License");
176
+ * you may not use this file except in compliance with the License.
177
+ * You may obtain a copy of the License at
178
+ *
179
+ * http://www.apache.org/licenses/LICENSE-2.0
180
+ *
181
+ * Unless required by applicable law or agreed to in writing, software
182
+ * distributed under the License is distributed on an "AS IS" BASIS,
183
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
184
+ * See the License for the specific language governing permissions and
185
+ * limitations under the License.
186
+ */function lo(e){return e&&e._delegate?e._delegate:e}/**
187
+ * @license
188
+ * Copyright 2025 Google LLC
189
+ *
190
+ * Licensed under the Apache License, Version 2.0 (the "License");
191
+ * you may not use this file except in compliance with the License.
192
+ * You may obtain a copy of the License at
193
+ *
194
+ * http://www.apache.org/licenses/LICENSE-2.0
195
+ *
196
+ * Unless required by applicable law or agreed to in writing, software
197
+ * distributed under the License is distributed on an "AS IS" BASIS,
198
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ * See the License for the specific language governing permissions and
200
+ * limitations under the License.
201
+ */function Kl(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function yI(e){return(await fetch(e,{credentials:"include"})).ok}class io{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}}/**
202
+ * @license
203
+ * Copyright 2019 Google LLC
204
+ *
205
+ * Licensed under the Apache License, Version 2.0 (the "License");
206
+ * you may not use this file except in compliance with the License.
207
+ * You may obtain a copy of the License at
208
+ *
209
+ * http://www.apache.org/licenses/LICENSE-2.0
210
+ *
211
+ * Unless required by applicable law or agreed to in writing, software
212
+ * distributed under the License is distributed on an "AS IS" BASIS,
213
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214
+ * See the License for the specific language governing permissions and
215
+ * limitations under the License.
216
+ */const Cs="[DEFAULT]";/**
217
+ * @license
218
+ * Copyright 2019 Google LLC
219
+ *
220
+ * Licensed under the Apache License, Version 2.0 (the "License");
221
+ * you may not use this file except in compliance with the License.
222
+ * You may obtain a copy of the License at
223
+ *
224
+ * http://www.apache.org/licenses/LICENSE-2.0
225
+ *
226
+ * Unless required by applicable law or agreed to in writing, software
227
+ * distributed under the License is distributed on an "AS IS" BASIS,
228
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
229
+ * See the License for the specific language governing permissions and
230
+ * limitations under the License.
231
+ */class wI{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 rI;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(_I(t))try{this.getOrInitializeService({instanceIdentifier:Cs})}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=Cs){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=Cs){return this.instances.has(t)}getOptions(t=Cs){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:bI(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=Cs){return this.component?this.component.multipleInstances?t:Cs:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function bI(e){return e===Cs?void 0:e}function _I(e){return e.instantiationMode==="EAGER"}/**
232
+ * @license
233
+ * Copyright 2019 Google LLC
234
+ *
235
+ * Licensed under the Apache License, Version 2.0 (the "License");
236
+ * you may not use this file except in compliance with the License.
237
+ * You may obtain a copy of the License at
238
+ *
239
+ * http://www.apache.org/licenses/LICENSE-2.0
240
+ *
241
+ * Unless required by applicable law or agreed to in writing, software
242
+ * distributed under the License is distributed on an "AS IS" BASIS,
243
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
244
+ * See the License for the specific language governing permissions and
245
+ * limitations under the License.
246
+ */class kI{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 wI(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
247
+ * @license
248
+ * Copyright 2017 Google LLC
249
+ *
250
+ * Licensed under the Apache License, Version 2.0 (the "License");
251
+ * you may not use this file except in compliance with the License.
252
+ * You may obtain a copy of the License at
253
+ *
254
+ * http://www.apache.org/licenses/LICENSE-2.0
255
+ *
256
+ * Unless required by applicable law or agreed to in writing, software
257
+ * distributed under the License is distributed on an "AS IS" BASIS,
258
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
259
+ * See the License for the specific language governing permissions and
260
+ * limitations under the License.
261
+ */var Nt;(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"})(Nt||(Nt={}));const TI={debug:Nt.DEBUG,verbose:Nt.VERBOSE,info:Nt.INFO,warn:Nt.WARN,error:Nt.ERROR,silent:Nt.SILENT},SI=Nt.INFO,II={[Nt.DEBUG]:"log",[Nt.VERBOSE]:"log",[Nt.INFO]:"info",[Nt.WARN]:"warn",[Nt.ERROR]:"error"},EI=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=II[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 ih{constructor(t){this.name=t,this._logLevel=SI,this._logHandler=EI,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Nt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?TI[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,Nt.DEBUG,...t),this._logHandler(this,Nt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Nt.VERBOSE,...t),this._logHandler(this,Nt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Nt.INFO,...t),this._logHandler(this,Nt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Nt.WARN,...t),this._logHandler(this,Nt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Nt.ERROR,...t),this._logHandler(this,Nt.ERROR,...t)}}const CI=(e,t)=>t.some(n=>e instanceof n);let Nu,Lu;function AI(){return Nu||(Nu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function xI(){return Lu||(Lu=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const ah=new WeakMap,al=new WeakMap,lh=new WeakMap,Ea=new WeakMap,Jl=new WeakMap;function RI(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(us(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&ah.set(n,e)}).catch(()=>{}),Jl.set(t,e),t}function PI(e){if(al.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)});al.set(e,t)}let ll={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return al.get(e);if(t==="objectStoreNames")return e.objectStoreNames||lh.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return us(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 MI(e){ll=e(ll)}function $I(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Ca(this),t,...n);return lh.set(r,t.sort?t.sort():[t]),us(r)}:xI().includes(e)?function(...t){return e.apply(Ca(this),t),us(ah.get(this))}:function(...t){return us(e.apply(Ca(this),t))}}function OI(e){return typeof e=="function"?$I(e):(e instanceof IDBTransaction&&PI(e),CI(e,AI())?new Proxy(e,ll):e)}function us(e){if(e instanceof IDBRequest)return RI(e);if(Ea.has(e))return Ea.get(e);const t=OI(e);return t!==e&&(Ea.set(e,t),Jl.set(t,e)),t}const Ca=e=>Jl.get(e);function NI(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=us(i);return r&&i.addEventListener("upgradeneeded",l=>{r(us(i.result),l.oldVersion,l.newVersion,us(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",f=>s(f.oldVersion,f.newVersion,f))}).catch(()=>{}),a}const LI=["get","getKey","getAll","getAllKeys","count"],DI=["put","add","delete","clear"],Aa=new Map;function Du(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Aa.get(t))return Aa.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=DI.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||LI.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let f=l.store;return r&&(f=f.index(a.shift())),(await Promise.all([f[n](...a),s&&l.done]))[0]};return Aa.set(t,o),o}MI(e=>({...e,get:(t,n,r)=>Du(t,n)||e.get(t,n,r),has:(t,n)=>!!Du(t,n)||e.has(t,n)}));/**
262
+ * @license
263
+ * Copyright 2019 Google LLC
264
+ *
265
+ * Licensed under the Apache License, Version 2.0 (the "License");
266
+ * you may not use this file except in compliance with the License.
267
+ * You may obtain a copy of the License at
268
+ *
269
+ * http://www.apache.org/licenses/LICENSE-2.0
270
+ *
271
+ * Unless required by applicable law or agreed to in writing, software
272
+ * distributed under the License is distributed on an "AS IS" BASIS,
273
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
274
+ * See the License for the specific language governing permissions and
275
+ * limitations under the License.
276
+ */class jI{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(FI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function FI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const cl="@firebase/app",ju="0.14.10";/**
277
+ * @license
278
+ * Copyright 2019 Google LLC
279
+ *
280
+ * Licensed under the Apache License, Version 2.0 (the "License");
281
+ * you may not use this file except in compliance with the License.
282
+ * You may obtain a copy of the License at
283
+ *
284
+ * http://www.apache.org/licenses/LICENSE-2.0
285
+ *
286
+ * Unless required by applicable law or agreed to in writing, software
287
+ * distributed under the License is distributed on an "AS IS" BASIS,
288
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
289
+ * See the License for the specific language governing permissions and
290
+ * limitations under the License.
291
+ */const Vr=new ih("@firebase/app"),BI="@firebase/app-compat",UI="@firebase/analytics-compat",HI="@firebase/analytics",WI="@firebase/app-check-compat",VI="@firebase/app-check",zI="@firebase/auth",qI="@firebase/auth-compat",GI="@firebase/database",KI="@firebase/data-connect",JI="@firebase/database-compat",YI="@firebase/functions",QI="@firebase/functions-compat",XI="@firebase/installations",ZI="@firebase/installations-compat",eE="@firebase/messaging",tE="@firebase/messaging-compat",nE="@firebase/performance",rE="@firebase/performance-compat",sE="@firebase/remote-config",oE="@firebase/remote-config-compat",iE="@firebase/storage",aE="@firebase/storage-compat",lE="@firebase/firestore",cE="@firebase/ai",uE="@firebase/firestore-compat",dE="firebase",fE="12.11.0";/**
292
+ * @license
293
+ * Copyright 2019 Google LLC
294
+ *
295
+ * Licensed under the Apache License, Version 2.0 (the "License");
296
+ * you may not use this file except in compliance with the License.
297
+ * You may obtain a copy of the License at
298
+ *
299
+ * http://www.apache.org/licenses/LICENSE-2.0
300
+ *
301
+ * Unless required by applicable law or agreed to in writing, software
302
+ * distributed under the License is distributed on an "AS IS" BASIS,
303
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
304
+ * See the License for the specific language governing permissions and
305
+ * limitations under the License.
306
+ */const ul="[DEFAULT]",hE={[cl]:"fire-core",[BI]:"fire-core-compat",[HI]:"fire-analytics",[UI]:"fire-analytics-compat",[VI]:"fire-app-check",[WI]:"fire-app-check-compat",[zI]:"fire-auth",[qI]:"fire-auth-compat",[GI]:"fire-rtdb",[KI]:"fire-data-connect",[JI]:"fire-rtdb-compat",[YI]:"fire-fn",[QI]:"fire-fn-compat",[XI]:"fire-iid",[ZI]:"fire-iid-compat",[eE]:"fire-fcm",[tE]:"fire-fcm-compat",[nE]:"fire-perf",[rE]:"fire-perf-compat",[sE]:"fire-rc",[oE]:"fire-rc-compat",[iE]:"fire-gcs",[aE]:"fire-gcs-compat",[lE]:"fire-fst",[uE]:"fire-fst-compat",[cE]:"fire-vertex","fire-js":"fire-js",[dE]:"fire-js-all"};/**
307
+ * @license
308
+ * Copyright 2019 Google LLC
309
+ *
310
+ * Licensed under the Apache License, Version 2.0 (the "License");
311
+ * you may not use this file except in compliance with the License.
312
+ * You may obtain a copy of the License at
313
+ *
314
+ * http://www.apache.org/licenses/LICENSE-2.0
315
+ *
316
+ * Unless required by applicable law or agreed to in writing, software
317
+ * distributed under the License is distributed on an "AS IS" BASIS,
318
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
319
+ * See the License for the specific language governing permissions and
320
+ * limitations under the License.
321
+ */const Ho=new Map,pE=new Map,dl=new Map;function Fu(e,t){try{e.container.addComponent(t)}catch(n){Vr.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Wo(e){const t=e.name;if(dl.has(t))return Vr.debug(`There were multiple attempts to register component ${t}.`),!1;dl.set(t,e);for(const n of Ho.values())Fu(n,e);for(const n of pE.values())Fu(n,e);return!0}function ch(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function yr(e){return e==null?!1:e.settings!==void 0}/**
322
+ * @license
323
+ * Copyright 2019 Google LLC
324
+ *
325
+ * Licensed under the Apache License, Version 2.0 (the "License");
326
+ * you may not use this file except in compliance with the License.
327
+ * You may obtain a copy of the License at
328
+ *
329
+ * http://www.apache.org/licenses/LICENSE-2.0
330
+ *
331
+ * Unless required by applicable law or agreed to in writing, software
332
+ * distributed under the License is distributed on an "AS IS" BASIS,
333
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334
+ * See the License for the specific language governing permissions and
335
+ * limitations under the License.
336
+ */const mE={"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."},ds=new Jo("app","Firebase",mE);/**
337
+ * @license
338
+ * Copyright 2019 Google LLC
339
+ *
340
+ * Licensed under the Apache License, Version 2.0 (the "License");
341
+ * you may not use this file except in compliance with the License.
342
+ * You may obtain a copy of the License at
343
+ *
344
+ * http://www.apache.org/licenses/LICENSE-2.0
345
+ *
346
+ * Unless required by applicable law or agreed to in writing, software
347
+ * distributed under the License is distributed on an "AS IS" BASIS,
348
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
349
+ * See the License for the specific language governing permissions and
350
+ * limitations under the License.
351
+ */class gE{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 io("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 ds.create("app-deleted",{appName:this._name})}}/**
352
+ * @license
353
+ * Copyright 2019 Google LLC
354
+ *
355
+ * Licensed under the Apache License, Version 2.0 (the "License");
356
+ * you may not use this file except in compliance with the License.
357
+ * You may obtain a copy of the License at
358
+ *
359
+ * http://www.apache.org/licenses/LICENSE-2.0
360
+ *
361
+ * Unless required by applicable law or agreed to in writing, software
362
+ * distributed under the License is distributed on an "AS IS" BASIS,
363
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
364
+ * See the License for the specific language governing permissions and
365
+ * limitations under the License.
366
+ */const Qo=fE;function uh(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:ul,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw ds.create("bad-app-name",{appName:String(s)});if(n||(n=sh()),!n)throw ds.create("no-options");const o=Ho.get(s);if(o){if(oo(n,o.options)&&oo(r,o.config))return o;throw ds.create("duplicate-app",{appName:s})}const i=new kI(s);for(const l of dl.values())i.addComponent(l);const a=new gE(n,r,i);return Ho.set(s,a),a}function dh(e=ul){const t=Ho.get(e);if(!t&&e===ul&&sh())return uh();if(!t)throw ds.create("no-app",{appName:e});return t}function vE(){return Array.from(Ho.values())}function Xs(e,t,n){let r=hE[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 "/")`),Vr.warn(i.join(" "));return}Wo(new io(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
367
+ * @license
368
+ * Copyright 2021 Google LLC
369
+ *
370
+ * Licensed under the Apache License, Version 2.0 (the "License");
371
+ * you may not use this file except in compliance with the License.
372
+ * You may obtain a copy of the License at
373
+ *
374
+ * http://www.apache.org/licenses/LICENSE-2.0
375
+ *
376
+ * Unless required by applicable law or agreed to in writing, software
377
+ * distributed under the License is distributed on an "AS IS" BASIS,
378
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
379
+ * See the License for the specific language governing permissions and
380
+ * limitations under the License.
381
+ */const yE="firebase-heartbeat-database",wE=1,Vo="firebase-heartbeat-store";let xa=null;function fh(){return xa||(xa=NI(yE,wE,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(Vo)}catch(n){console.warn(n)}}}}).catch(e=>{throw ds.create("idb-open",{originalErrorMessage:e.message})})),xa}async function bE(e){try{const n=(await fh()).transaction(Vo),r=await n.objectStore(Vo).get(hh(e));return await n.done,r}catch(t){if(t instanceof ms)Vr.warn(t.message);else{const n=ds.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Vr.warn(n.message)}}}async function Bu(e,t){try{const r=(await fh()).transaction(Vo,"readwrite");await r.objectStore(Vo).put(t,hh(e)),await r.done}catch(n){if(n instanceof ms)Vr.warn(n.message);else{const r=ds.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Vr.warn(r.message)}}}function hh(e){return`${e.name}!${e.options.appId}`}/**
382
+ * @license
383
+ * Copyright 2021 Google LLC
384
+ *
385
+ * Licensed under the Apache License, Version 2.0 (the "License");
386
+ * you may not use this file except in compliance with the License.
387
+ * You may obtain a copy of the License at
388
+ *
389
+ * http://www.apache.org/licenses/LICENSE-2.0
390
+ *
391
+ * Unless required by applicable law or agreed to in writing, software
392
+ * distributed under the License is distributed on an "AS IS" BASIS,
393
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
394
+ * See the License for the specific language governing permissions and
395
+ * limitations under the License.
396
+ */const _E=1024,kE=30;class TE{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new IE(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=Uu();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>kE){const i=EE(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Vr.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=Uu(),{heartbeatsToSend:r,unsentEntries:s}=SE(this._heartbeatsCache.heartbeats),o=nh(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 Vr.warn(n),""}}}function Uu(){return new Date().toISOString().substring(0,10)}function SE(e,t=_E){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),Hu(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Hu(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class IE{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return cI()?uI().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await bE(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 Bu(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 Bu(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function Hu(e){return nh(JSON.stringify({version:2,heartbeats:e})).length}function EE(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}/**
397
+ * @license
398
+ * Copyright 2019 Google LLC
399
+ *
400
+ * Licensed under the Apache License, Version 2.0 (the "License");
401
+ * you may not use this file except in compliance with the License.
402
+ * You may obtain a copy of the License at
403
+ *
404
+ * http://www.apache.org/licenses/LICENSE-2.0
405
+ *
406
+ * Unless required by applicable law or agreed to in writing, software
407
+ * distributed under the License is distributed on an "AS IS" BASIS,
408
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
409
+ * See the License for the specific language governing permissions and
410
+ * limitations under the License.
411
+ */function CE(e){Wo(new io("platform-logger",t=>new jI(t),"PRIVATE")),Wo(new io("heartbeat",t=>new TE(t),"PRIVATE")),Xs(cl,ju,e),Xs(cl,ju,"esm2020"),Xs("fire-js","")}CE("");var AE="firebase",xE="12.11.0";/**
412
+ * @license
413
+ * Copyright 2020 Google LLC
414
+ *
415
+ * Licensed under the Apache License, Version 2.0 (the "License");
416
+ * you may not use this file except in compliance with the License.
417
+ * You may obtain a copy of the License at
418
+ *
419
+ * http://www.apache.org/licenses/LICENSE-2.0
420
+ *
421
+ * Unless required by applicable law or agreed to in writing, software
422
+ * distributed under the License is distributed on an "AS IS" BASIS,
423
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
424
+ * See the License for the specific language governing permissions and
425
+ * limitations under the License.
426
+ */Xs(AE,xE,"app");function ph(){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 RE=ph,mh=new Jo("auth","Firebase",ph());/**
427
+ * @license
428
+ * Copyright 2020 Google LLC
429
+ *
430
+ * Licensed under the Apache License, Version 2.0 (the "License");
431
+ * you may not use this file except in compliance with the License.
432
+ * You may obtain a copy of the License at
433
+ *
434
+ * http://www.apache.org/licenses/LICENSE-2.0
435
+ *
436
+ * Unless required by applicable law or agreed to in writing, software
437
+ * distributed under the License is distributed on an "AS IS" BASIS,
438
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
439
+ * See the License for the specific language governing permissions and
440
+ * limitations under the License.
441
+ */const Ai=new ih("@firebase/auth");function PE(e,...t){Ai.logLevel<=Nt.WARN&&Ai.warn(`Auth (${Qo}): ${e}`,...t)}function mi(e,...t){Ai.logLevel<=Nt.ERROR&&Ai.error(`Auth (${Qo}): ${e}`,...t)}/**
442
+ * @license
443
+ * Copyright 2020 Google LLC
444
+ *
445
+ * Licensed under the Apache License, Version 2.0 (the "License");
446
+ * you may not use this file except in compliance with the License.
447
+ * You may obtain a copy of the License at
448
+ *
449
+ * http://www.apache.org/licenses/LICENSE-2.0
450
+ *
451
+ * Unless required by applicable law or agreed to in writing, software
452
+ * distributed under the License is distributed on an "AS IS" BASIS,
453
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
454
+ * See the License for the specific language governing permissions and
455
+ * limitations under the License.
456
+ */function Tr(e,...t){throw Ql(e,...t)}function or(e,...t){return Ql(e,...t)}function Yl(e,t,n){const r={...RE(),[t]:n};return new Jo("auth","Firebase",r).create(t,{appName:e.name})}function Os(e){return Yl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function ME(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Tr(e,"argument-error"),Yl(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Ql(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 mh.create(e,...t)}function Xe(e,t,...n){if(!e)throw Ql(t,...n)}function Lr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw mi(t),new Error(t)}function zr(e,t){e||Lr(t)}/**
457
+ * @license
458
+ * Copyright 2020 Google LLC
459
+ *
460
+ * Licensed under the Apache License, Version 2.0 (the "License");
461
+ * you may not use this file except in compliance with the License.
462
+ * You may obtain a copy of the License at
463
+ *
464
+ * http://www.apache.org/licenses/LICENSE-2.0
465
+ *
466
+ * Unless required by applicable law or agreed to in writing, software
467
+ * distributed under the License is distributed on an "AS IS" BASIS,
468
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
469
+ * See the License for the specific language governing permissions and
470
+ * limitations under the License.
471
+ */function fl(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function $E(){return Wu()==="http:"||Wu()==="https:"}function Wu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
472
+ * @license
473
+ * Copyright 2020 Google LLC
474
+ *
475
+ * Licensed under the Apache License, Version 2.0 (the "License");
476
+ * you may not use this file except in compliance with the License.
477
+ * You may obtain a copy of the License at
478
+ *
479
+ * http://www.apache.org/licenses/LICENSE-2.0
480
+ *
481
+ * Unless required by applicable law or agreed to in writing, software
482
+ * distributed under the License is distributed on an "AS IS" BASIS,
483
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
484
+ * See the License for the specific language governing permissions and
485
+ * limitations under the License.
486
+ */function OE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&($E()||iI()||"connection"in navigator)?navigator.onLine:!0}function NE(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
487
+ * @license
488
+ * Copyright 2020 Google LLC
489
+ *
490
+ * Licensed under the Apache License, Version 2.0 (the "License");
491
+ * you may not use this file except in compliance with the License.
492
+ * You may obtain a copy of the License at
493
+ *
494
+ * http://www.apache.org/licenses/LICENSE-2.0
495
+ *
496
+ * Unless required by applicable law or agreed to in writing, software
497
+ * distributed under the License is distributed on an "AS IS" BASIS,
498
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
499
+ * See the License for the specific language governing permissions and
500
+ * limitations under the License.
501
+ */class Xo{constructor(t,n){this.shortDelay=t,this.longDelay=n,zr(n>t,"Short delay should be less than long delay!"),this.isMobile=sI()||aI()}get(){return OE()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
502
+ * @license
503
+ * Copyright 2020 Google LLC
504
+ *
505
+ * Licensed under the Apache License, Version 2.0 (the "License");
506
+ * you may not use this file except in compliance with the License.
507
+ * You may obtain a copy of the License at
508
+ *
509
+ * http://www.apache.org/licenses/LICENSE-2.0
510
+ *
511
+ * Unless required by applicable law or agreed to in writing, software
512
+ * distributed under the License is distributed on an "AS IS" BASIS,
513
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
514
+ * See the License for the specific language governing permissions and
515
+ * limitations under the License.
516
+ */function Xl(e,t){zr(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
517
+ * @license
518
+ * Copyright 2020 Google LLC
519
+ *
520
+ * Licensed under the Apache License, Version 2.0 (the "License");
521
+ * you may not use this file except in compliance with the License.
522
+ * You may obtain a copy of the License at
523
+ *
524
+ * http://www.apache.org/licenses/LICENSE-2.0
525
+ *
526
+ * Unless required by applicable law or agreed to in writing, software
527
+ * distributed under the License is distributed on an "AS IS" BASIS,
528
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
529
+ * See the License for the specific language governing permissions and
530
+ * limitations under the License.
531
+ */class gh{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;Lr("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;Lr("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;Lr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
532
+ * @license
533
+ * Copyright 2020 Google LLC
534
+ *
535
+ * Licensed under the Apache License, Version 2.0 (the "License");
536
+ * you may not use this file except in compliance with the License.
537
+ * You may obtain a copy of the License at
538
+ *
539
+ * http://www.apache.org/licenses/LICENSE-2.0
540
+ *
541
+ * Unless required by applicable law or agreed to in writing, software
542
+ * distributed under the License is distributed on an "AS IS" BASIS,
543
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
544
+ * See the License for the specific language governing permissions and
545
+ * limitations under the License.
546
+ */const LE={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"};/**
547
+ * @license
548
+ * Copyright 2020 Google LLC
549
+ *
550
+ * Licensed under the Apache License, Version 2.0 (the "License");
551
+ * you may not use this file except in compliance with the License.
552
+ * You may obtain a copy of the License at
553
+ *
554
+ * http://www.apache.org/licenses/LICENSE-2.0
555
+ *
556
+ * Unless required by applicable law or agreed to in writing, software
557
+ * distributed under the License is distributed on an "AS IS" BASIS,
558
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
559
+ * See the License for the specific language governing permissions and
560
+ * limitations under the License.
561
+ */const DE=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],jE=new Xo(3e4,6e4);function Zl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function co(e,t,n,r,s={}){return vh(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Yo({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 f={method:t,headers:l,...o};return oI()||(f.referrerPolicy="no-referrer"),e.emulatorConfig&&Kl(e.emulatorConfig.host)&&(f.credentials="include"),gh.fetch()(await yh(e,e.config.apiHost,n,a),f)})}async function vh(e,t,n){e._canInitEmulator=!1;const r={...LE,...t};try{const s=new BE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw oi(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,f]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw oi(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw oi(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw oi(e,"user-disabled",i);const u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw Yl(e,u,f);Tr(e,u)}}catch(s){if(s instanceof ms)throw s;Tr(e,"network-request-failed",{message:String(s)})}}async function FE(e,t,n,r,s={}){const o=await co(e,t,n,r,s);return"mfaPendingCredential"in o&&Tr(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function yh(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Xl(e.config,s):`${e.config.apiScheme}://${s}`;return DE.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class BE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(or(this.auth,"network-request-failed")),jE.get())})}}function oi(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=or(e,t,r);return s.customData._tokenResponse=n,s}/**
562
+ * @license
563
+ * Copyright 2020 Google LLC
564
+ *
565
+ * Licensed under the Apache License, Version 2.0 (the "License");
566
+ * you may not use this file except in compliance with the License.
567
+ * You may obtain a copy of the License at
568
+ *
569
+ * http://www.apache.org/licenses/LICENSE-2.0
570
+ *
571
+ * Unless required by applicable law or agreed to in writing, software
572
+ * distributed under the License is distributed on an "AS IS" BASIS,
573
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
574
+ * See the License for the specific language governing permissions and
575
+ * limitations under the License.
576
+ */async function UE(e,t){return co(e,"POST","/v1/accounts:delete",t)}async function xi(e,t){return co(e,"POST","/v1/accounts:lookup",t)}/**
577
+ * @license
578
+ * Copyright 2020 Google LLC
579
+ *
580
+ * Licensed under the Apache License, Version 2.0 (the "License");
581
+ * you may not use this file except in compliance with the License.
582
+ * You may obtain a copy of the License at
583
+ *
584
+ * http://www.apache.org/licenses/LICENSE-2.0
585
+ *
586
+ * Unless required by applicable law or agreed to in writing, software
587
+ * distributed under the License is distributed on an "AS IS" BASIS,
588
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
589
+ * See the License for the specific language governing permissions and
590
+ * limitations under the License.
591
+ */function Ro(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function HE(e,t=!1){const n=lo(e),r=await n.getIdToken(t),s=ec(r);Xe(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:Ro(Ra(s.auth_time)),issuedAtTime:Ro(Ra(s.iat)),expirationTime:Ro(Ra(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function Ra(e){return Number(e)*1e3}function ec(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return mi("JWT malformed, contained fewer than 3 sections"),null;try{const s=rh(n);return s?JSON.parse(s):(mi("Failed to decode base64 JWT payload"),null)}catch(s){return mi("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Vu(e){const t=ec(e);return Xe(t,"internal-error"),Xe(typeof t.exp<"u","internal-error"),Xe(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
592
+ * @license
593
+ * Copyright 2020 Google LLC
594
+ *
595
+ * Licensed under the Apache License, Version 2.0 (the "License");
596
+ * you may not use this file except in compliance with the License.
597
+ * You may obtain a copy of the License at
598
+ *
599
+ * http://www.apache.org/licenses/LICENSE-2.0
600
+ *
601
+ * Unless required by applicable law or agreed to in writing, software
602
+ * distributed under the License is distributed on an "AS IS" BASIS,
603
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
604
+ * See the License for the specific language governing permissions and
605
+ * limitations under the License.
606
+ */async function zo(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof ms&&WE(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function WE({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
607
+ * @license
608
+ * Copyright 2020 Google LLC
609
+ *
610
+ * Licensed under the Apache License, Version 2.0 (the "License");
611
+ * you may not use this file except in compliance with the License.
612
+ * You may obtain a copy of the License at
613
+ *
614
+ * http://www.apache.org/licenses/LICENSE-2.0
615
+ *
616
+ * Unless required by applicable law or agreed to in writing, software
617
+ * distributed under the License is distributed on an "AS IS" BASIS,
618
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
619
+ * See the License for the specific language governing permissions and
620
+ * limitations under the License.
621
+ */class VE{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()}}/**
622
+ * @license
623
+ * Copyright 2020 Google LLC
624
+ *
625
+ * Licensed under the Apache License, Version 2.0 (the "License");
626
+ * you may not use this file except in compliance with the License.
627
+ * You may obtain a copy of the License at
628
+ *
629
+ * http://www.apache.org/licenses/LICENSE-2.0
630
+ *
631
+ * Unless required by applicable law or agreed to in writing, software
632
+ * distributed under the License is distributed on an "AS IS" BASIS,
633
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
634
+ * See the License for the specific language governing permissions and
635
+ * limitations under the License.
636
+ */class hl{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ro(this.lastLoginAt),this.creationTime=Ro(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
637
+ * @license
638
+ * Copyright 2019 Google LLC
639
+ *
640
+ * Licensed under the Apache License, Version 2.0 (the "License");
641
+ * you may not use this file except in compliance with the License.
642
+ * You may obtain a copy of the License at
643
+ *
644
+ * http://www.apache.org/licenses/LICENSE-2.0
645
+ *
646
+ * Unless required by applicable law or agreed to in writing, software
647
+ * distributed under the License is distributed on an "AS IS" BASIS,
648
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
649
+ * See the License for the specific language governing permissions and
650
+ * limitations under the License.
651
+ */async function Ri(e){var g;const t=e.auth,n=await e.getIdToken(),r=await zo(e,xi(t,{idToken:n}));Xe(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(g=s.providerUserInfo)!=null&&g.length?wh(s.providerUserInfo):[],i=qE(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),f=a?l:!1,u={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 hl(s.createdAt,s.lastLoginAt),isAnonymous:f};Object.assign(e,u)}async function zE(e){const t=lo(e);await Ri(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function qE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function wh(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}))}/**
652
+ * @license
653
+ * Copyright 2020 Google LLC
654
+ *
655
+ * Licensed under the Apache License, Version 2.0 (the "License");
656
+ * you may not use this file except in compliance with the License.
657
+ * You may obtain a copy of the License at
658
+ *
659
+ * http://www.apache.org/licenses/LICENSE-2.0
660
+ *
661
+ * Unless required by applicable law or agreed to in writing, software
662
+ * distributed under the License is distributed on an "AS IS" BASIS,
663
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
664
+ * See the License for the specific language governing permissions and
665
+ * limitations under the License.
666
+ */async function GE(e,t){const n=await vh(e,{},async()=>{const r=Yo({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await yh(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&&Kl(e.emulatorConfig.host)&&(l.credentials="include"),gh.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function KE(e,t){return co(e,"POST","/v2/accounts:revokeToken",Zl(e,t))}/**
667
+ * @license
668
+ * Copyright 2020 Google LLC
669
+ *
670
+ * Licensed under the Apache License, Version 2.0 (the "License");
671
+ * you may not use this file except in compliance with the License.
672
+ * You may obtain a copy of the License at
673
+ *
674
+ * http://www.apache.org/licenses/LICENSE-2.0
675
+ *
676
+ * Unless required by applicable law or agreed to in writing, software
677
+ * distributed under the License is distributed on an "AS IS" BASIS,
678
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
679
+ * See the License for the specific language governing permissions and
680
+ * limitations under the License.
681
+ */class Zs{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Xe(t.idToken,"internal-error"),Xe(typeof t.idToken<"u","internal-error"),Xe(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Vu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){Xe(t.length!==0,"internal-error");const n=Vu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Xe(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 GE(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 Zs;return r&&(Xe(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(Xe(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(Xe(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 Zs,this.toJSON())}_performRefresh(){return Lr("not implemented")}}/**
682
+ * @license
683
+ * Copyright 2020 Google LLC
684
+ *
685
+ * Licensed under the Apache License, Version 2.0 (the "License");
686
+ * you may not use this file except in compliance with the License.
687
+ * You may obtain a copy of the License at
688
+ *
689
+ * http://www.apache.org/licenses/LICENSE-2.0
690
+ *
691
+ * Unless required by applicable law or agreed to in writing, software
692
+ * distributed under the License is distributed on an "AS IS" BASIS,
693
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
694
+ * See the License for the specific language governing permissions and
695
+ * limitations under the License.
696
+ */function ns(e,t){Xe(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class nr{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new VE(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 hl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await zo(this,this.stsTokenManager.getToken(this.auth,t));return Xe(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return HE(this,t)}reload(){return zE(this)}_assign(t){this!==t&&(Xe(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 nr({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){Xe(!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 Ri(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(yr(this.auth.app))return Promise.reject(Os(this.auth));const t=await this.getIdToken();return await zo(this,UE(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,f=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:g,emailVerified:_,isAnonymous:E,providerData:B,stsTokenManager:M}=n;Xe(g&&M,t,"internal-error");const Z=Zs.fromJSON(this.name,M);Xe(typeof g=="string",t,"internal-error"),ns(r,t.name),ns(s,t.name),Xe(typeof _=="boolean",t,"internal-error"),Xe(typeof E=="boolean",t,"internal-error"),ns(o,t.name),ns(i,t.name),ns(a,t.name),ns(l,t.name),ns(f,t.name),ns(u,t.name);const ce=new nr({uid:g,auth:t,email:s,emailVerified:_,displayName:r,isAnonymous:E,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:Z,createdAt:f,lastLoginAt:u});return B&&Array.isArray(B)&&(ce.providerData=B.map(K=>({...K}))),l&&(ce._redirectEventId=l),ce}static async _fromIdTokenResponse(t,n,r=!1){const s=new Zs;s.updateFromServerResponse(n);const o=new nr({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await Ri(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];Xe(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?wh(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new Zs;a.updateFromIdToken(r);const l=new nr({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),f={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 hl(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,f),l}}/**
697
+ * @license
698
+ * Copyright 2020 Google LLC
699
+ *
700
+ * Licensed under the Apache License, Version 2.0 (the "License");
701
+ * you may not use this file except in compliance with the License.
702
+ * You may obtain a copy of the License at
703
+ *
704
+ * http://www.apache.org/licenses/LICENSE-2.0
705
+ *
706
+ * Unless required by applicable law or agreed to in writing, software
707
+ * distributed under the License is distributed on an "AS IS" BASIS,
708
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
709
+ * See the License for the specific language governing permissions and
710
+ * limitations under the License.
711
+ */const zu=new Map;function Dr(e){zr(e instanceof Function,"Expected a class definition");let t=zu.get(e);return t?(zr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,zu.set(e,t),t)}/**
712
+ * @license
713
+ * Copyright 2019 Google LLC
714
+ *
715
+ * Licensed under the Apache License, Version 2.0 (the "License");
716
+ * you may not use this file except in compliance with the License.
717
+ * You may obtain a copy of the License at
718
+ *
719
+ * http://www.apache.org/licenses/LICENSE-2.0
720
+ *
721
+ * Unless required by applicable law or agreed to in writing, software
722
+ * distributed under the License is distributed on an "AS IS" BASIS,
723
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
724
+ * See the License for the specific language governing permissions and
725
+ * limitations under the License.
726
+ */class bh{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){}}bh.type="NONE";const qu=bh;/**
727
+ * @license
728
+ * Copyright 2019 Google LLC
729
+ *
730
+ * Licensed under the Apache License, Version 2.0 (the "License");
731
+ * you may not use this file except in compliance with the License.
732
+ * You may obtain a copy of the License at
733
+ *
734
+ * http://www.apache.org/licenses/LICENSE-2.0
735
+ *
736
+ * Unless required by applicable law or agreed to in writing, software
737
+ * distributed under the License is distributed on an "AS IS" BASIS,
738
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
739
+ * See the License for the specific language governing permissions and
740
+ * limitations under the License.
741
+ */function gi(e,t,n){return`firebase:${e}:${t}:${n}`}class eo{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=gi(this.userKey,s.apiKey,o),this.fullPersistenceKey=gi("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 xi(this.auth,{idToken:t}).catch(()=>{});return n?nr._fromGetAccountInfoResponse(this.auth,n,t):null}return nr._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 eo(Dr(qu),t,r);const s=(await Promise.all(n.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let o=s[0]||Dr(qu);const i=gi(r,t.config.apiKey,t.name);let a=null;for(const f of n)try{const u=await f._get(i);if(u){let g;if(typeof u=="string"){const _=await xi(t,{idToken:u}).catch(()=>{});if(!_)break;g=await nr._fromGetAccountInfoResponse(t,_,u)}else g=nr._fromJSON(t,u);f!==o&&(a=g),o=f;break}}catch{}const l=s.filter(f=>f._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new eo(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async f=>{if(f!==o)try{await f._remove(i)}catch{}})),new eo(o,t,r))}}/**
742
+ * @license
743
+ * Copyright 2020 Google LLC
744
+ *
745
+ * Licensed under the Apache License, Version 2.0 (the "License");
746
+ * you may not use this file except in compliance with the License.
747
+ * You may obtain a copy of the License at
748
+ *
749
+ * http://www.apache.org/licenses/LICENSE-2.0
750
+ *
751
+ * Unless required by applicable law or agreed to in writing, software
752
+ * distributed under the License is distributed on an "AS IS" BASIS,
753
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
754
+ * See the License for the specific language governing permissions and
755
+ * limitations under the License.
756
+ */function Gu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Sh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(_h(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Eh(t))return"Blackberry";if(Ch(t))return"Webos";if(kh(t))return"Safari";if((t.includes("chrome/")||Th(t))&&!t.includes("edge/"))return"Chrome";if(Ih(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 _h(e=xn()){return/firefox\//i.test(e)}function kh(e=xn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Th(e=xn()){return/crios\//i.test(e)}function Sh(e=xn()){return/iemobile/i.test(e)}function Ih(e=xn()){return/android/i.test(e)}function Eh(e=xn()){return/blackberry/i.test(e)}function Ch(e=xn()){return/webos/i.test(e)}function tc(e=xn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function JE(e=xn()){var t;return tc(e)&&!!((t=window.navigator)!=null&&t.standalone)}function YE(){return lI()&&document.documentMode===10}function Ah(e=xn()){return tc(e)||Ih(e)||Ch(e)||Eh(e)||/windows phone/i.test(e)||Sh(e)}/**
757
+ * @license
758
+ * Copyright 2020 Google LLC
759
+ *
760
+ * Licensed under the Apache License, Version 2.0 (the "License");
761
+ * you may not use this file except in compliance with the License.
762
+ * You may obtain a copy of the License at
763
+ *
764
+ * http://www.apache.org/licenses/LICENSE-2.0
765
+ *
766
+ * Unless required by applicable law or agreed to in writing, software
767
+ * distributed under the License is distributed on an "AS IS" BASIS,
768
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
769
+ * See the License for the specific language governing permissions and
770
+ * limitations under the License.
771
+ */function xh(e,t=[]){let n;switch(e){case"Browser":n=Gu(xn());break;case"Worker":n=`${Gu(xn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Qo}/${r}`}/**
772
+ * @license
773
+ * Copyright 2022 Google LLC
774
+ *
775
+ * Licensed under the Apache License, Version 2.0 (the "License");
776
+ * you may not use this file except in compliance with the License.
777
+ * You may obtain a copy of the License at
778
+ *
779
+ * http://www.apache.org/licenses/LICENSE-2.0
780
+ *
781
+ * Unless required by applicable law or agreed to in writing, software
782
+ * distributed under the License is distributed on an "AS IS" BASIS,
783
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
784
+ * See the License for the specific language governing permissions and
785
+ * limitations under the License.
786
+ */class QE{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})}}}/**
787
+ * @license
788
+ * Copyright 2023 Google LLC
789
+ *
790
+ * Licensed under the Apache License, Version 2.0 (the "License");
791
+ * you may not use this file except in compliance with the License.
792
+ * You may obtain a copy of the License at
793
+ *
794
+ * http://www.apache.org/licenses/LICENSE-2.0
795
+ *
796
+ * Unless required by applicable law or agreed to in writing, software
797
+ * distributed under the License is distributed on an "AS IS" BASIS,
798
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
799
+ * See the License for the specific language governing permissions and
800
+ * limitations under the License.
801
+ */async function XE(e,t={}){return co(e,"GET","/v2/passwordPolicy",Zl(e,t))}/**
802
+ * @license
803
+ * Copyright 2023 Google LLC
804
+ *
805
+ * Licensed under the Apache License, Version 2.0 (the "License");
806
+ * you may not use this file except in compliance with the License.
807
+ * You may obtain a copy of the License at
808
+ *
809
+ * http://www.apache.org/licenses/LICENSE-2.0
810
+ *
811
+ * Unless required by applicable law or agreed to in writing, software
812
+ * distributed under the License is distributed on an "AS IS" BASIS,
813
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
814
+ * See the License for the specific language governing permissions and
815
+ * limitations under the License.
816
+ */const ZE=6;class eC{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??ZE,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))}}/**
817
+ * @license
818
+ * Copyright 2020 Google LLC
819
+ *
820
+ * Licensed under the Apache License, Version 2.0 (the "License");
821
+ * you may not use this file except in compliance with the License.
822
+ * You may obtain a copy of the License at
823
+ *
824
+ * http://www.apache.org/licenses/LICENSE-2.0
825
+ *
826
+ * Unless required by applicable law or agreed to in writing, software
827
+ * distributed under the License is distributed on an "AS IS" BASIS,
828
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
829
+ * See the License for the specific language governing permissions and
830
+ * limitations under the License.
831
+ */class tC{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 Ku(this),this.idTokenSubscription=new Ku(this),this.beforeStateQueue=new QE(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=mh,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=Dr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await eo.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 xi(this,{idToken:t}),r=await nr._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(yr(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 Xe(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 Ri(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=NE()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(yr(this.app))return Promise.reject(Os(this));const n=t?lo(t):null;return n&&Xe(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&&Xe(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 yr(this.app)?Promise.reject(Os(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return yr(this.app)?Promise.reject(Os(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Dr(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 XE(this),n=new eC(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 Jo("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 KE(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&&Dr(t)||this._popupRedirectResolver;Xe(n,this,"argument-error"),this.redirectPersistenceManager=await eo.create(this,[Dr(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(Xe(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 Xe(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=xh(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(yr(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&&PE(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Yi(e){return lo(e)}class Ku{constructor(t){this.auth=t,this.observer=null,this.addObserver=mI(n=>this.observer=n)}get next(){return Xe(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
832
+ * @license
833
+ * Copyright 2020 Google LLC
834
+ *
835
+ * Licensed under the Apache License, Version 2.0 (the "License");
836
+ * you may not use this file except in compliance with the License.
837
+ * You may obtain a copy of the License at
838
+ *
839
+ * http://www.apache.org/licenses/LICENSE-2.0
840
+ *
841
+ * Unless required by applicable law or agreed to in writing, software
842
+ * distributed under the License is distributed on an "AS IS" BASIS,
843
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
844
+ * See the License for the specific language governing permissions and
845
+ * limitations under the License.
846
+ */let nc={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function nC(e){nc=e}function rC(e){return nc.loadJS(e)}function sC(){return nc.gapiScript}function oC(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
847
+ * @license
848
+ * Copyright 2020 Google LLC
849
+ *
850
+ * Licensed under the Apache License, Version 2.0 (the "License");
851
+ * you may not use this file except in compliance with the License.
852
+ * You may obtain a copy of the License at
853
+ *
854
+ * http://www.apache.org/licenses/LICENSE-2.0
855
+ *
856
+ * Unless required by applicable law or agreed to in writing, software
857
+ * distributed under the License is distributed on an "AS IS" BASIS,
858
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
859
+ * See the License for the specific language governing permissions and
860
+ * limitations under the License.
861
+ */function iC(e,t){const n=ch(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(oo(o,t??{}))return s;Tr(s,"already-initialized")}return n.initialize({options:t})}function aC(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Dr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function lC(e,t,n){const r=Yi(e);Xe(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=Rh(t),{host:i,port:a}=cC(t),l=a===null?"":`:${a}`,f={url:`${o}//${i}${l}/`},u=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){Xe(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),Xe(oo(f,r.config.emulator)&&oo(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=f,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,Kl(i)?yI(`${o}//${i}${l}`):uC()}function Rh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function cC(e){const t=Rh(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:Ju(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:Ju(i)}}}function Ju(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function uC(){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())}/**
862
+ * @license
863
+ * Copyright 2020 Google LLC
864
+ *
865
+ * Licensed under the Apache License, Version 2.0 (the "License");
866
+ * you may not use this file except in compliance with the License.
867
+ * You may obtain a copy of the License at
868
+ *
869
+ * http://www.apache.org/licenses/LICENSE-2.0
870
+ *
871
+ * Unless required by applicable law or agreed to in writing, software
872
+ * distributed under the License is distributed on an "AS IS" BASIS,
873
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
874
+ * See the License for the specific language governing permissions and
875
+ * limitations under the License.
876
+ */class Ph{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Lr("not implemented")}_getIdTokenResponse(t){return Lr("not implemented")}_linkToIdToken(t,n){return Lr("not implemented")}_getReauthenticationResolver(t){return Lr("not implemented")}}/**
877
+ * @license
878
+ * Copyright 2020 Google LLC
879
+ *
880
+ * Licensed under the Apache License, Version 2.0 (the "License");
881
+ * you may not use this file except in compliance with the License.
882
+ * You may obtain a copy of the License at
883
+ *
884
+ * http://www.apache.org/licenses/LICENSE-2.0
885
+ *
886
+ * Unless required by applicable law or agreed to in writing, software
887
+ * distributed under the License is distributed on an "AS IS" BASIS,
888
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
889
+ * See the License for the specific language governing permissions and
890
+ * limitations under the License.
891
+ */async function to(e,t){return FE(e,"POST","/v1/accounts:signInWithIdp",Zl(e,t))}/**
892
+ * @license
893
+ * Copyright 2020 Google LLC
894
+ *
895
+ * Licensed under the Apache License, Version 2.0 (the "License");
896
+ * you may not use this file except in compliance with the License.
897
+ * You may obtain a copy of the License at
898
+ *
899
+ * http://www.apache.org/licenses/LICENSE-2.0
900
+ *
901
+ * Unless required by applicable law or agreed to in writing, software
902
+ * distributed under the License is distributed on an "AS IS" BASIS,
903
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
904
+ * See the License for the specific language governing permissions and
905
+ * limitations under the License.
906
+ */const dC="http://localhost";class Ns extends Ph{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Ns(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):Tr("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 Ns(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 to(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,to(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,to(t,n)}buildRequest(){const t={requestUri:dC,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=Yo(n)}return t}}/**
907
+ * @license
908
+ * Copyright 2020 Google LLC
909
+ *
910
+ * Licensed under the Apache License, Version 2.0 (the "License");
911
+ * you may not use this file except in compliance with the License.
912
+ * You may obtain a copy of the License at
913
+ *
914
+ * http://www.apache.org/licenses/LICENSE-2.0
915
+ *
916
+ * Unless required by applicable law or agreed to in writing, software
917
+ * distributed under the License is distributed on an "AS IS" BASIS,
918
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
919
+ * See the License for the specific language governing permissions and
920
+ * limitations under the License.
921
+ */class rc{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}}/**
922
+ * @license
923
+ * Copyright 2019 Google LLC
924
+ *
925
+ * Licensed under the Apache License, Version 2.0 (the "License");
926
+ * you may not use this file except in compliance with the License.
927
+ * You may obtain a copy of the License at
928
+ *
929
+ * http://www.apache.org/licenses/LICENSE-2.0
930
+ *
931
+ * Unless required by applicable law or agreed to in writing, software
932
+ * distributed under the License is distributed on an "AS IS" BASIS,
933
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
934
+ * See the License for the specific language governing permissions and
935
+ * limitations under the License.
936
+ */class Zo extends rc{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
937
+ * @license
938
+ * Copyright 2020 Google LLC
939
+ *
940
+ * Licensed under the Apache License, Version 2.0 (the "License");
941
+ * you may not use this file except in compliance with the License.
942
+ * You may obtain a copy of the License at
943
+ *
944
+ * http://www.apache.org/licenses/LICENSE-2.0
945
+ *
946
+ * Unless required by applicable law or agreed to in writing, software
947
+ * distributed under the License is distributed on an "AS IS" BASIS,
948
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
949
+ * See the License for the specific language governing permissions and
950
+ * limitations under the License.
951
+ */class is extends Zo{constructor(){super("facebook.com")}static credential(t){return Ns._fromParams({providerId:is.PROVIDER_ID,signInMethod:is.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return is.credentialFromTaggedObject(t)}static credentialFromError(t){return is.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return is.credential(t.oauthAccessToken)}catch{return null}}}is.FACEBOOK_SIGN_IN_METHOD="facebook.com";is.PROVIDER_ID="facebook.com";/**
952
+ * @license
953
+ * Copyright 2020 Google LLC
954
+ *
955
+ * Licensed under the Apache License, Version 2.0 (the "License");
956
+ * you may not use this file except in compliance with the License.
957
+ * You may obtain a copy of the License at
958
+ *
959
+ * http://www.apache.org/licenses/LICENSE-2.0
960
+ *
961
+ * Unless required by applicable law or agreed to in writing, software
962
+ * distributed under the License is distributed on an "AS IS" BASIS,
963
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
964
+ * See the License for the specific language governing permissions and
965
+ * limitations under the License.
966
+ */class as extends Zo{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Ns._fromParams({providerId:as.PROVIDER_ID,signInMethod:as.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return as.credentialFromTaggedObject(t)}static credentialFromError(t){return as.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return as.credential(n,r)}catch{return null}}}as.GOOGLE_SIGN_IN_METHOD="google.com";as.PROVIDER_ID="google.com";/**
967
+ * @license
968
+ * Copyright 2020 Google LLC
969
+ *
970
+ * Licensed under the Apache License, Version 2.0 (the "License");
971
+ * you may not use this file except in compliance with the License.
972
+ * You may obtain a copy of the License at
973
+ *
974
+ * http://www.apache.org/licenses/LICENSE-2.0
975
+ *
976
+ * Unless required by applicable law or agreed to in writing, software
977
+ * distributed under the License is distributed on an "AS IS" BASIS,
978
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
979
+ * See the License for the specific language governing permissions and
980
+ * limitations under the License.
981
+ */class wr extends Zo{constructor(){super("github.com")}static credential(t){return Ns._fromParams({providerId:wr.PROVIDER_ID,signInMethod:wr.GITHUB_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.GITHUB_SIGN_IN_METHOD="github.com";wr.PROVIDER_ID="github.com";/**
982
+ * @license
983
+ * Copyright 2020 Google LLC
984
+ *
985
+ * Licensed under the Apache License, Version 2.0 (the "License");
986
+ * you may not use this file except in compliance with the License.
987
+ * You may obtain a copy of the License at
988
+ *
989
+ * http://www.apache.org/licenses/LICENSE-2.0
990
+ *
991
+ * Unless required by applicable law or agreed to in writing, software
992
+ * distributed under the License is distributed on an "AS IS" BASIS,
993
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
994
+ * See the License for the specific language governing permissions and
995
+ * limitations under the License.
996
+ */class ls extends Zo{constructor(){super("twitter.com")}static credential(t,n){return Ns._fromParams({providerId:ls.PROVIDER_ID,signInMethod:ls.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return ls.credentialFromTaggedObject(t)}static credentialFromError(t){return ls.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return ls.credential(n,r)}catch{return null}}}ls.TWITTER_SIGN_IN_METHOD="twitter.com";ls.PROVIDER_ID="twitter.com";/**
997
+ * @license
998
+ * Copyright 2020 Google LLC
999
+ *
1000
+ * Licensed under the Apache License, Version 2.0 (the "License");
1001
+ * you may not use this file except in compliance with the License.
1002
+ * You may obtain a copy of the License at
1003
+ *
1004
+ * http://www.apache.org/licenses/LICENSE-2.0
1005
+ *
1006
+ * Unless required by applicable law or agreed to in writing, software
1007
+ * distributed under the License is distributed on an "AS IS" BASIS,
1008
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1009
+ * See the License for the specific language governing permissions and
1010
+ * limitations under the License.
1011
+ */class ao{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 nr._fromIdTokenResponse(t,r,s),i=Yu(r);return new ao({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=Yu(r);return new ao({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function Yu(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
1012
+ * @license
1013
+ * Copyright 2020 Google LLC
1014
+ *
1015
+ * Licensed under the Apache License, Version 2.0 (the "License");
1016
+ * you may not use this file except in compliance with the License.
1017
+ * You may obtain a copy of the License at
1018
+ *
1019
+ * http://www.apache.org/licenses/LICENSE-2.0
1020
+ *
1021
+ * Unless required by applicable law or agreed to in writing, software
1022
+ * distributed under the License is distributed on an "AS IS" BASIS,
1023
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1024
+ * See the License for the specific language governing permissions and
1025
+ * limitations under the License.
1026
+ */class Pi extends ms{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Pi.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 Pi(t,n,r,s)}}function Mh(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?Pi._fromErrorAndOperation(e,o,t,r):o})}async function fC(e,t,n=!1){const r=await zo(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return ao._forOperation(e,"link",r)}/**
1027
+ * @license
1028
+ * Copyright 2019 Google LLC
1029
+ *
1030
+ * Licensed under the Apache License, Version 2.0 (the "License");
1031
+ * you may not use this file except in compliance with the License.
1032
+ * You may obtain a copy of the License at
1033
+ *
1034
+ * http://www.apache.org/licenses/LICENSE-2.0
1035
+ *
1036
+ * Unless required by applicable law or agreed to in writing, software
1037
+ * distributed under the License is distributed on an "AS IS" BASIS,
1038
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1039
+ * See the License for the specific language governing permissions and
1040
+ * limitations under the License.
1041
+ */async function hC(e,t,n=!1){const{auth:r}=e;if(yr(r.app))return Promise.reject(Os(r));const s="reauthenticate";try{const o=await zo(e,Mh(r,s,t,e),n);Xe(o.idToken,r,"internal-error");const i=ec(o.idToken);Xe(i,r,"internal-error");const{sub:a}=i;return Xe(e.uid===a,r,"user-mismatch"),ao._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Tr(r,"user-mismatch"),o}}/**
1042
+ * @license
1043
+ * Copyright 2020 Google LLC
1044
+ *
1045
+ * Licensed under the Apache License, Version 2.0 (the "License");
1046
+ * you may not use this file except in compliance with the License.
1047
+ * You may obtain a copy of the License at
1048
+ *
1049
+ * http://www.apache.org/licenses/LICENSE-2.0
1050
+ *
1051
+ * Unless required by applicable law or agreed to in writing, software
1052
+ * distributed under the License is distributed on an "AS IS" BASIS,
1053
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1054
+ * See the License for the specific language governing permissions and
1055
+ * limitations under the License.
1056
+ */async function pC(e,t,n=!1){if(yr(e.app))return Promise.reject(Os(e));const r="signIn",s=await Mh(e,r,t),o=await ao._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function mC(e,t,n,r){return lo(e).onIdTokenChanged(t,n,r)}function gC(e,t,n){return lo(e).beforeAuthStateChanged(t,n)}const Mi="__sak";/**
1057
+ * @license
1058
+ * Copyright 2019 Google LLC
1059
+ *
1060
+ * Licensed under the Apache License, Version 2.0 (the "License");
1061
+ * you may not use this file except in compliance with the License.
1062
+ * You may obtain a copy of the License at
1063
+ *
1064
+ * http://www.apache.org/licenses/LICENSE-2.0
1065
+ *
1066
+ * Unless required by applicable law or agreed to in writing, software
1067
+ * distributed under the License is distributed on an "AS IS" BASIS,
1068
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1069
+ * See the License for the specific language governing permissions and
1070
+ * limitations under the License.
1071
+ */class $h{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Mi,"1"),this.storage.removeItem(Mi),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()}}/**
1072
+ * @license
1073
+ * Copyright 2020 Google LLC
1074
+ *
1075
+ * Licensed under the Apache License, Version 2.0 (the "License");
1076
+ * you may not use this file except in compliance with the License.
1077
+ * You may obtain a copy of the License at
1078
+ *
1079
+ * http://www.apache.org/licenses/LICENSE-2.0
1080
+ *
1081
+ * Unless required by applicable law or agreed to in writing, software
1082
+ * distributed under the License is distributed on an "AS IS" BASIS,
1083
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1084
+ * See the License for the specific language governing permissions and
1085
+ * limitations under the License.
1086
+ */const vC=1e3,yC=10;class Oh extends $h{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ah(),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);YE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,yC):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)})},vC)}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]}}Oh.type="LOCAL";const wC=Oh;/**
1087
+ * @license
1088
+ * Copyright 2020 Google LLC
1089
+ *
1090
+ * Licensed under the Apache License, Version 2.0 (the "License");
1091
+ * you may not use this file except in compliance with the License.
1092
+ * You may obtain a copy of the License at
1093
+ *
1094
+ * http://www.apache.org/licenses/LICENSE-2.0
1095
+ *
1096
+ * Unless required by applicable law or agreed to in writing, software
1097
+ * distributed under the License is distributed on an "AS IS" BASIS,
1098
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1099
+ * See the License for the specific language governing permissions and
1100
+ * limitations under the License.
1101
+ */class Nh extends $h{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Nh.type="SESSION";const Lh=Nh;/**
1102
+ * @license
1103
+ * Copyright 2019 Google LLC
1104
+ *
1105
+ * Licensed under the Apache License, Version 2.0 (the "License");
1106
+ * you may not use this file except in compliance with the License.
1107
+ * You may obtain a copy of the License at
1108
+ *
1109
+ * http://www.apache.org/licenses/LICENSE-2.0
1110
+ *
1111
+ * Unless required by applicable law or agreed to in writing, software
1112
+ * distributed under the License is distributed on an "AS IS" BASIS,
1113
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1114
+ * See the License for the specific language governing permissions and
1115
+ * limitations under the License.
1116
+ */function bC(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1117
+ * @license
1118
+ * Copyright 2019 Google LLC
1119
+ *
1120
+ * Licensed under the Apache License, Version 2.0 (the "License");
1121
+ * you may not use this file except in compliance with the License.
1122
+ * You may obtain a copy of the License at
1123
+ *
1124
+ * http://www.apache.org/licenses/LICENSE-2.0
1125
+ *
1126
+ * Unless required by applicable law or agreed to in writing, software
1127
+ * distributed under the License is distributed on an "AS IS" BASIS,
1128
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1129
+ * See the License for the specific language governing permissions and
1130
+ * limitations under the License.
1131
+ */class Qi{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 Qi(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 f=>f(n.origin,o)),l=await bC(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)}}Qi.receivers=[];/**
1132
+ * @license
1133
+ * Copyright 2020 Google LLC
1134
+ *
1135
+ * Licensed under the Apache License, Version 2.0 (the "License");
1136
+ * you may not use this file except in compliance with the License.
1137
+ * You may obtain a copy of the License at
1138
+ *
1139
+ * http://www.apache.org/licenses/LICENSE-2.0
1140
+ *
1141
+ * Unless required by applicable law or agreed to in writing, software
1142
+ * distributed under the License is distributed on an "AS IS" BASIS,
1143
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1144
+ * See the License for the specific language governing permissions and
1145
+ * limitations under the License.
1146
+ */function sc(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
1147
+ * @license
1148
+ * Copyright 2019 Google LLC
1149
+ *
1150
+ * Licensed under the Apache License, Version 2.0 (the "License");
1151
+ * you may not use this file except in compliance with the License.
1152
+ * You may obtain a copy of the License at
1153
+ *
1154
+ * http://www.apache.org/licenses/LICENSE-2.0
1155
+ *
1156
+ * Unless required by applicable law or agreed to in writing, software
1157
+ * distributed under the License is distributed on an "AS IS" BASIS,
1158
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1159
+ * See the License for the specific language governing permissions and
1160
+ * limitations under the License.
1161
+ */class _C{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 f=sc("",20);s.port1.start();const u=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(g){const _=g;if(_.data.eventId===f)switch(_.data.status){case"ack":clearTimeout(u),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(_.data.response);break;default:clearTimeout(u),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:f,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
1162
+ * @license
1163
+ * Copyright 2020 Google LLC
1164
+ *
1165
+ * Licensed under the Apache License, Version 2.0 (the "License");
1166
+ * you may not use this file except in compliance with the License.
1167
+ * You may obtain a copy of the License at
1168
+ *
1169
+ * http://www.apache.org/licenses/LICENSE-2.0
1170
+ *
1171
+ * Unless required by applicable law or agreed to in writing, software
1172
+ * distributed under the License is distributed on an "AS IS" BASIS,
1173
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1174
+ * See the License for the specific language governing permissions and
1175
+ * limitations under the License.
1176
+ */function kr(){return window}function kC(e){kr().location.href=e}/**
1177
+ * @license
1178
+ * Copyright 2020 Google LLC.
1179
+ *
1180
+ * Licensed under the Apache License, Version 2.0 (the "License");
1181
+ * you may not use this file except in compliance with the License.
1182
+ * You may obtain a copy of the License at
1183
+ *
1184
+ * http://www.apache.org/licenses/LICENSE-2.0
1185
+ *
1186
+ * Unless required by applicable law or agreed to in writing, software
1187
+ * distributed under the License is distributed on an "AS IS" BASIS,
1188
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1189
+ * See the License for the specific language governing permissions and
1190
+ * limitations under the License.
1191
+ */function Dh(){return typeof kr().WorkerGlobalScope<"u"&&typeof kr().importScripts=="function"}async function TC(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function SC(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function IC(){return Dh()?self:null}/**
1192
+ * @license
1193
+ * Copyright 2019 Google LLC
1194
+ *
1195
+ * Licensed under the Apache License, Version 2.0 (the "License");
1196
+ * you may not use this file except in compliance with the License.
1197
+ * You may obtain a copy of the License at
1198
+ *
1199
+ * http://www.apache.org/licenses/LICENSE-2.0
1200
+ *
1201
+ * Unless required by applicable law or agreed to in writing, software
1202
+ * distributed under the License is distributed on an "AS IS" BASIS,
1203
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1204
+ * See the License for the specific language governing permissions and
1205
+ * limitations under the License.
1206
+ */const jh="firebaseLocalStorageDb",EC=1,$i="firebaseLocalStorage",Fh="fbase_key";class ei{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 Xi(e,t){return e.transaction([$i],t?"readwrite":"readonly").objectStore($i)}function CC(){const e=indexedDB.deleteDatabase(jh);return new ei(e).toPromise()}function pl(){const e=indexedDB.open(jh,EC);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore($i,{keyPath:Fh})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains($i)?t(r):(r.close(),await CC(),t(await pl()))})})}async function Qu(e,t,n){const r=Xi(e,!0).put({[Fh]:t,value:n});return new ei(r).toPromise()}async function AC(e,t){const n=Xi(e,!1).get(t),r=await new ei(n).toPromise();return r===void 0?null:r.value}function Xu(e,t){const n=Xi(e,!0).delete(t);return new ei(n).toPromise()}const xC=800,RC=3;class Bh{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 pl(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>RC)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Dh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Qi._getInstance(IC()),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 TC(),!this.activeServiceWorker)return;this.sender=new _C(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||SC()!==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 pl();return await Qu(t,Mi,"1"),await Xu(t,Mi),!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=>Qu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>AC(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Xu(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Xi(s,!1).getAll();return new ei(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(),xC)}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()}}Bh.type="LOCAL";const PC=Bh;new Xo(3e4,6e4);/**
1207
+ * @license
1208
+ * Copyright 2021 Google LLC
1209
+ *
1210
+ * Licensed under the Apache License, Version 2.0 (the "License");
1211
+ * you may not use this file except in compliance with the License.
1212
+ * You may obtain a copy of the License at
1213
+ *
1214
+ * http://www.apache.org/licenses/LICENSE-2.0
1215
+ *
1216
+ * Unless required by applicable law or agreed to in writing, software
1217
+ * distributed under the License is distributed on an "AS IS" BASIS,
1218
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1219
+ * See the License for the specific language governing permissions and
1220
+ * limitations under the License.
1221
+ */function Uh(e,t){return t?Dr(t):(Xe(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
1222
+ * @license
1223
+ * Copyright 2019 Google LLC
1224
+ *
1225
+ * Licensed under the Apache License, Version 2.0 (the "License");
1226
+ * you may not use this file except in compliance with the License.
1227
+ * You may obtain a copy of the License at
1228
+ *
1229
+ * http://www.apache.org/licenses/LICENSE-2.0
1230
+ *
1231
+ * Unless required by applicable law or agreed to in writing, software
1232
+ * distributed under the License is distributed on an "AS IS" BASIS,
1233
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1234
+ * See the License for the specific language governing permissions and
1235
+ * limitations under the License.
1236
+ */class oc extends Ph{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return to(t,this._buildIdpRequest())}_linkToIdToken(t,n){return to(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return to(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 MC(e){return pC(e.auth,new oc(e),e.bypassAuthState)}function $C(e){const{auth:t,user:n}=e;return Xe(n,t,"internal-error"),hC(n,new oc(e),e.bypassAuthState)}async function OC(e){const{auth:t,user:n}=e;return Xe(n,t,"internal-error"),fC(n,new oc(e),e.bypassAuthState)}/**
1237
+ * @license
1238
+ * Copyright 2020 Google LLC
1239
+ *
1240
+ * Licensed under the Apache License, Version 2.0 (the "License");
1241
+ * you may not use this file except in compliance with the License.
1242
+ * You may obtain a copy of the License at
1243
+ *
1244
+ * http://www.apache.org/licenses/LICENSE-2.0
1245
+ *
1246
+ * Unless required by applicable law or agreed to in writing, software
1247
+ * distributed under the License is distributed on an "AS IS" BASIS,
1248
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1249
+ * See the License for the specific language governing permissions and
1250
+ * limitations under the License.
1251
+ */class Hh{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(f){this.reject(f)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return MC;case"linkViaPopup":case"linkViaRedirect":return OC;case"reauthViaPopup":case"reauthViaRedirect":return $C;default:Tr(this.auth,"internal-error")}}resolve(t){zr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){zr(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()}}/**
1252
+ * @license
1253
+ * Copyright 2020 Google LLC
1254
+ *
1255
+ * Licensed under the Apache License, Version 2.0 (the "License");
1256
+ * you may not use this file except in compliance with the License.
1257
+ * You may obtain a copy of the License at
1258
+ *
1259
+ * http://www.apache.org/licenses/LICENSE-2.0
1260
+ *
1261
+ * Unless required by applicable law or agreed to in writing, software
1262
+ * distributed under the License is distributed on an "AS IS" BASIS,
1263
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1264
+ * See the License for the specific language governing permissions and
1265
+ * limitations under the License.
1266
+ */const NC=new Xo(2e3,1e4);async function LC(e,t,n){if(yr(e.app))return Promise.reject(or(e,"operation-not-supported-in-this-environment"));const r=Yi(e);ME(e,t,rc);const s=Uh(r,n);return new Ps(r,"signInViaPopup",t,s).executeNotNull()}class Ps extends Hh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,Ps.currentPopupAction&&Ps.currentPopupAction.cancel(),Ps.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Xe(t,this.auth,"internal-error"),t}async onExecution(){zr(this.filter.length===1,"Popup operations only handle one event");const t=sc();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(or(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(or(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ps.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(or(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,NC.get())};t()}}Ps.currentPopupAction=null;/**
1267
+ * @license
1268
+ * Copyright 2020 Google LLC
1269
+ *
1270
+ * Licensed under the Apache License, Version 2.0 (the "License");
1271
+ * you may not use this file except in compliance with the License.
1272
+ * You may obtain a copy of the License at
1273
+ *
1274
+ * http://www.apache.org/licenses/LICENSE-2.0
1275
+ *
1276
+ * Unless required by applicable law or agreed to in writing, software
1277
+ * distributed under the License is distributed on an "AS IS" BASIS,
1278
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1279
+ * See the License for the specific language governing permissions and
1280
+ * limitations under the License.
1281
+ */const DC="pendingRedirect",vi=new Map;class jC extends Hh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=vi.get(this.auth._key());if(!t){try{const r=await FC(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}vi.set(this.auth._key(),t)}return this.bypassAuthState||vi.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 FC(e,t){const n=HC(t),r=UC(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function BC(e,t){vi.set(e._key(),t)}function UC(e){return Dr(e._redirectPersistence)}function HC(e){return gi(DC,e.config.apiKey,e.name)}async function WC(e,t,n=!1){if(yr(e.app))return Promise.reject(Os(e));const r=Yi(e),s=Uh(r,t),i=await new jC(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
1282
+ * @license
1283
+ * Copyright 2020 Google LLC
1284
+ *
1285
+ * Licensed under the Apache License, Version 2.0 (the "License");
1286
+ * you may not use this file except in compliance with the License.
1287
+ * You may obtain a copy of the License at
1288
+ *
1289
+ * http://www.apache.org/licenses/LICENSE-2.0
1290
+ *
1291
+ * Unless required by applicable law or agreed to in writing, software
1292
+ * distributed under the License is distributed on an "AS IS" BASIS,
1293
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1294
+ * See the License for the specific language governing permissions and
1295
+ * limitations under the License.
1296
+ */const VC=600*1e3;class zC{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||!qC(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Wh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(or(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>=VC&&this.cachedEventUids.clear(),this.cachedEventUids.has(Zu(t))}saveEventToCache(t){this.cachedEventUids.add(Zu(t)),this.lastProcessedEventTime=Date.now()}}function Zu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Wh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function qC(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Wh(e);default:return!1}}/**
1297
+ * @license
1298
+ * Copyright 2020 Google LLC
1299
+ *
1300
+ * Licensed under the Apache License, Version 2.0 (the "License");
1301
+ * you may not use this file except in compliance with the License.
1302
+ * You may obtain a copy of the License at
1303
+ *
1304
+ * http://www.apache.org/licenses/LICENSE-2.0
1305
+ *
1306
+ * Unless required by applicable law or agreed to in writing, software
1307
+ * distributed under the License is distributed on an "AS IS" BASIS,
1308
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1309
+ * See the License for the specific language governing permissions and
1310
+ * limitations under the License.
1311
+ */async function GC(e,t={}){return co(e,"GET","/v1/projects",t)}/**
1312
+ * @license
1313
+ * Copyright 2020 Google LLC
1314
+ *
1315
+ * Licensed under the Apache License, Version 2.0 (the "License");
1316
+ * you may not use this file except in compliance with the License.
1317
+ * You may obtain a copy of the License at
1318
+ *
1319
+ * http://www.apache.org/licenses/LICENSE-2.0
1320
+ *
1321
+ * Unless required by applicable law or agreed to in writing, software
1322
+ * distributed under the License is distributed on an "AS IS" BASIS,
1323
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1324
+ * See the License for the specific language governing permissions and
1325
+ * limitations under the License.
1326
+ */const KC=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,JC=/^https?/;async function YC(e){if(e.config.emulator)return;const{authorizedDomains:t}=await GC(e);for(const n of t)try{if(QC(n))return}catch{}Tr(e,"unauthorized-domain")}function QC(e){const t=fl(),{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(!JC.test(n))return!1;if(KC.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1327
+ * @license
1328
+ * Copyright 2020 Google LLC.
1329
+ *
1330
+ * Licensed under the Apache License, Version 2.0 (the "License");
1331
+ * you may not use this file except in compliance with the License.
1332
+ * You may obtain a copy of the License at
1333
+ *
1334
+ * http://www.apache.org/licenses/LICENSE-2.0
1335
+ *
1336
+ * Unless required by applicable law or agreed to in writing, software
1337
+ * distributed under the License is distributed on an "AS IS" BASIS,
1338
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1339
+ * See the License for the specific language governing permissions and
1340
+ * limitations under the License.
1341
+ */const XC=new Xo(3e4,6e4);function ed(){const e=kr().___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 ZC(e){return new Promise((t,n)=>{var s,o,i;function r(){ed(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{ed(),n(or(e,"network-request-failed"))},timeout:XC.get()})}if((o=(s=kr().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=kr().gapi)!=null&&i.load)r();else{const a=oC("iframefcb");return kr()[a]=()=>{gapi.load?r():n(or(e,"network-request-failed"))},rC(`${sC()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw yi=null,t})}let yi=null;function e1(e){return yi=yi||ZC(e),yi}/**
1342
+ * @license
1343
+ * Copyright 2020 Google LLC.
1344
+ *
1345
+ * Licensed under the Apache License, Version 2.0 (the "License");
1346
+ * you may not use this file except in compliance with the License.
1347
+ * You may obtain a copy of the License at
1348
+ *
1349
+ * http://www.apache.org/licenses/LICENSE-2.0
1350
+ *
1351
+ * Unless required by applicable law or agreed to in writing, software
1352
+ * distributed under the License is distributed on an "AS IS" BASIS,
1353
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1354
+ * See the License for the specific language governing permissions and
1355
+ * limitations under the License.
1356
+ */const t1=new Xo(5e3,15e3),n1="__/auth/iframe",r1="emulator/auth/iframe",s1={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},o1=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function i1(e){const t=e.config;Xe(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Xl(t,r1):`https://${e.config.authDomain}/${n1}`,r={apiKey:t.apiKey,appName:e.name,v:Qo},s=o1.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Yo(r).slice(1)}`}async function a1(e){const t=await e1(e),n=kr().gapi;return Xe(n,e,"internal-error"),t.open({where:document.body,url:i1(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:s1,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=or(e,"network-request-failed"),a=kr().setTimeout(()=>{o(i)},t1.get());function l(){kr().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
1357
+ * @license
1358
+ * Copyright 2020 Google LLC.
1359
+ *
1360
+ * Licensed under the Apache License, Version 2.0 (the "License");
1361
+ * you may not use this file except in compliance with the License.
1362
+ * You may obtain a copy of the License at
1363
+ *
1364
+ * http://www.apache.org/licenses/LICENSE-2.0
1365
+ *
1366
+ * Unless required by applicable law or agreed to in writing, software
1367
+ * distributed under the License is distributed on an "AS IS" BASIS,
1368
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1369
+ * See the License for the specific language governing permissions and
1370
+ * limitations under the License.
1371
+ */const l1={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},c1=500,u1=600,d1="_blank",f1="http://localhost";class td{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function h1(e,t,n,r=c1,s=u1){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={...l1,width:r.toString(),height:s.toString(),top:o,left:i},f=xn().toLowerCase();n&&(a=Th(f)?d1:n),_h(f)&&(t=t||f1,l.scrollbars="yes");const u=Object.entries(l).reduce((_,[E,B])=>`${_}${E}=${B},`,"");if(JE(f)&&a!=="_self")return p1(t||"",a),new td(null);const g=window.open(t||"",a,u);Xe(g,e,"popup-blocked");try{g.focus()}catch{}return new td(g)}function p1(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)}/**
1372
+ * @license
1373
+ * Copyright 2021 Google LLC
1374
+ *
1375
+ * Licensed under the Apache License, Version 2.0 (the "License");
1376
+ * you may not use this file except in compliance with the License.
1377
+ * You may obtain a copy of the License at
1378
+ *
1379
+ * http://www.apache.org/licenses/LICENSE-2.0
1380
+ *
1381
+ * Unless required by applicable law or agreed to in writing, software
1382
+ * distributed under the License is distributed on an "AS IS" BASIS,
1383
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1384
+ * See the License for the specific language governing permissions and
1385
+ * limitations under the License.
1386
+ */const m1="__/auth/handler",g1="emulator/auth/handler",v1=encodeURIComponent("fac");async function nd(e,t,n,r,s,o){Xe(e.config.authDomain,e,"auth-domain-config-required"),Xe(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:Qo,eventId:s};if(t instanceof rc){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",pI(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[u,g]of Object.entries({}))i[u]=g}if(t instanceof Zo){const u=t.getScopes().filter(g=>g!=="");u.length>0&&(i.scopes=u.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const u of Object.keys(a))a[u]===void 0&&delete a[u];const l=await e._getAppCheckToken(),f=l?`#${v1}=${encodeURIComponent(l)}`:"";return`${y1(e)}?${Yo(a).slice(1)}${f}`}function y1({config:e}){return e.emulator?Xl(e,g1):`https://${e.authDomain}/${m1}`}/**
1387
+ * @license
1388
+ * Copyright 2020 Google LLC
1389
+ *
1390
+ * Licensed under the Apache License, Version 2.0 (the "License");
1391
+ * you may not use this file except in compliance with the License.
1392
+ * You may obtain a copy of the License at
1393
+ *
1394
+ * http://www.apache.org/licenses/LICENSE-2.0
1395
+ *
1396
+ * Unless required by applicable law or agreed to in writing, software
1397
+ * distributed under the License is distributed on an "AS IS" BASIS,
1398
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1399
+ * See the License for the specific language governing permissions and
1400
+ * limitations under the License.
1401
+ */const Pa="webStorageSupport";class w1{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Lh,this._completeRedirectFn=WC,this._overrideRedirectResult=BC}async _openPopup(t,n,r,s){var i;zr((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await nd(t,n,r,fl(),s);return h1(t,o,sc())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await nd(t,n,r,fl(),s);return kC(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):(zr(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 a1(t),r=new zC(t);return n.register("authEvent",s=>(Xe(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(Pa,{type:Pa},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[Pa];o!==void 0&&n(!!o),Tr(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=YC(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return Ah()||kh()||tc()}}const b1=w1;var rd="@firebase/auth",sd="1.12.2";/**
1402
+ * @license
1403
+ * Copyright 2020 Google LLC
1404
+ *
1405
+ * Licensed under the Apache License, Version 2.0 (the "License");
1406
+ * you may not use this file except in compliance with the License.
1407
+ * You may obtain a copy of the License at
1408
+ *
1409
+ * http://www.apache.org/licenses/LICENSE-2.0
1410
+ *
1411
+ * Unless required by applicable law or agreed to in writing, software
1412
+ * distributed under the License is distributed on an "AS IS" BASIS,
1413
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
+ * See the License for the specific language governing permissions and
1415
+ * limitations under the License.
1416
+ */class _1{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(){Xe(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1417
+ * @license
1418
+ * Copyright 2020 Google LLC
1419
+ *
1420
+ * Licensed under the Apache License, Version 2.0 (the "License");
1421
+ * you may not use this file except in compliance with the License.
1422
+ * You may obtain a copy of the License at
1423
+ *
1424
+ * http://www.apache.org/licenses/LICENSE-2.0
1425
+ *
1426
+ * Unless required by applicable law or agreed to in writing, software
1427
+ * distributed under the License is distributed on an "AS IS" BASIS,
1428
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1429
+ * See the License for the specific language governing permissions and
1430
+ * limitations under the License.
1431
+ */function k1(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 T1(e){Wo(new io("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;Xe(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:xh(e)},f=new tC(r,s,o,l);return aC(f,n),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),Wo(new io("auth-internal",t=>{const n=Yi(t.getProvider("auth").getImmediate());return(r=>new _1(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Xs(rd,sd,k1(e)),Xs(rd,sd,"esm2020")}/**
1432
+ * @license
1433
+ * Copyright 2021 Google LLC
1434
+ *
1435
+ * Licensed under the Apache License, Version 2.0 (the "License");
1436
+ * you may not use this file except in compliance with the License.
1437
+ * You may obtain a copy of the License at
1438
+ *
1439
+ * http://www.apache.org/licenses/LICENSE-2.0
1440
+ *
1441
+ * Unless required by applicable law or agreed to in writing, software
1442
+ * distributed under the License is distributed on an "AS IS" BASIS,
1443
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1444
+ * See the License for the specific language governing permissions and
1445
+ * limitations under the License.
1446
+ */const S1=300,I1=oh("authIdTokenMaxAge")||S1;let od=null;const E1=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>I1)return;const s=n==null?void 0:n.token;od!==s&&(od=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function C1(e=dh()){const t=ch(e,"auth");if(t.isInitialized())return t.getImmediate();const n=iC(e,{popupRedirectResolver:b1,persistence:[PC,wC,Lh]}),r=oh("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=E1(o.toString());gC(n,i,()=>i(n.currentUser)),mC(n,a=>i(a))}}const s=nI("auth");return s&&lC(n,`http://${s}`),n}function A1(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}nC({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=or("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",A1().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="});T1("Browser");const x1={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 R1(e){const t=j(null),n=j(""),r=j(""),s=j(""),o=j({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=he(()=>s.value==="pull"),a=he(()=>s.value==="push"),l=he(()=>s.value!=="");async function f(){try{const M=await fetch("/codex-api/skills-sync/status");if(!M.ok)return;const Z=await M.json();Z.data&&(o.value=Z.data)}catch{}}async function u(){try{const M=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),Z=await M.json();if(!M.ok||!Z.data)throw new Error("Failed to start GitHub login");t.value=Z.data;const ce=30,K=Math.max((Z.data.interval??5)*1e3,3e3);let te=!1;for(let ne=0;ne<ce;ne++){await new Promise(ye=>setTimeout(ye,K));const ke=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:Z.data.device_code})}),ge=await ke.json();if(!ke.ok)throw new Error(ge.error||"Failed to complete GitHub login");if(ge.ok){te=!0;break}if(!ge.pending)throw new Error(ge.error||"Failed to complete GitHub login")}if(!te)throw new Error("GitHub login timed out. Please retry.");t.value=null,await f(),e.showToast("GitHub login successful")}catch(M){e.showToast(M instanceof Error?M.message:"Failed GitHub login","error")}}async function g(){try{const M=vE().length>0?dh():uh(x1),Z=C1(M),ce=new wr;ce.addScope("repo");const K=await LC(Z,ce),te=wr.credentialFromResult(K),ne=(te==null?void 0:te.accessToken)??"";if(!ne)throw new Error("GitHub access token missing from Firebase login");const ke=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:ne})}),ge=await ke.json();if(!ke.ok||!ge.ok)throw new Error(ge.error||"Failed to login with GitHub token");await f(),e.showToast("GitHub login successful")}catch(M){const Z=M instanceof Error?M.message:"Failed Firebase GitHub login";e.showToast(Z,"error")}}async function _(){r.value="",n.value="pull-started",s.value="pull";try{const M=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),Z=await M.json();if(!M.ok||!Z.ok)throw new Error(Z.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(M){const Z=M instanceof Error?M.message:"Failed to pull sync";r.value=Z,n.value="pull-failed",e.showToast(Z,"error")}finally{s.value=""}}async function E(){r.value="",n.value="push-started",s.value="push";try{const M=await fetch("/codex-api/skills-sync/push",{method:"POST"}),Z=await M.json();if(!M.ok||!Z.ok)throw new Error(Z.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(M){const Z=M instanceof Error?M.message:"Failed to push sync";r.value=Z,n.value="push-failed",e.showToast(Z,"error")}finally{s.value=""}}async function B(){try{const M=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),Z=await M.json();if(!M.ok||!Z.ok)throw new Error(Z.error||"Failed to logout GitHub");await f(),e.showToast("Logged out from GitHub")}catch(M){e.showToast(M instanceof Error?M.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:f,logoutGithub:B,pullSkillsSync:_,pushSkillsSync:E,startGithubFirebaseLogin:g,startGithubLogin:u,syncActionError:r,syncActionStatus:n,syncStatus:o}}const P1={class:"skills-hub"},M1={class:"skills-sync-panel"},$1={class:"skills-sync-header"},O1={key:0,class:"skills-sync-badge"},N1={key:1,class:"skills-sync-badge"},L1={key:2,class:"skills-sync-badge"},D1={class:"skills-sync-meta"},j1={key:0,class:"skills-sync-error"},F1={key:1,class:"skills-sync-meta"},B1={key:2,class:"skills-sync-error"},U1={key:3,class:"skills-sync-device"},H1=["href"],W1={class:"skills-sync-actions"},V1=["disabled"],z1=["disabled"],q1=["disabled"],G1={key:1,class:"skills-hub-section"},K1={class:"skills-hub-section-title"},J1={key:0,class:"skills-hub-grid"},Y1={class:"skills-hub-toolbar"},Q1={class:"skills-hub-search-wrap"},X1={key:0,class:"skills-hub-count"},Z1={class:"skills-hub-section"},eA={key:0,class:"skills-hub-loading"},tA={key:1,class:"skills-hub-error"},nA={key:0,class:"skills-hub-grid"},rA={key:1,class:"skills-hub-empty"},ii="codex-web-local.skills-hub.cache.v1",sA=sn({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=j(null),s=j(""),o=j("date"),i=j([]),a=j([]),l=j(0),f=j(!1),u=j(""),g=j(!0),_=j(!1),E=j(n),B=j(null),M=j(""),Z=j(!1),ce=j(!1);let K=null,te=null;const ne=t,ke=he(()=>o.value==="date"?"Newest":"A-Z"),ge=he(()=>{var L;return((L=B.value)==null?void 0:L.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),ye=he(()=>`${E.value.owner}/${E.value.name}`),je=he(()=>Z.value&&M.value===ye.value),ue=he(()=>ce.value&&M.value===ye.value),se=he(()=>{const L=s.value.toLowerCase().trim();return L?a.value.filter(W=>W.name.toLowerCase().includes(L)||W.owner.toLowerCase().includes(L)||(W.displayName??"").toLowerCase().includes(L)):a.value});function de(L,W="success"){B.value={text:L,type:W},te&&clearTimeout(te),te=setTimeout(()=>{B.value=null},3e3)}function re(){o.value=o.value==="date"?"name":"date",Pe(s.value)}function Me(L){return`${o.value}::${L.trim().toLowerCase()}`}function Je(L){var W;if(typeof window>"u")return null;try{const H=window.localStorage.getItem(ii);return H?((W=JSON.parse(H).byKey)==null?void 0:W[L])??null:null}catch{return null}}function qe(L,W){if(!(typeof window>"u"))try{const H=window.localStorage.getItem(ii),Q=(H?JSON.parse(H):{}).byKey??{};Q[L]=W,window.localStorage.setItem(ii,JSON.stringify({byKey:Q}))}catch{}}function Ge(){if(!(typeof window>"u"))try{window.localStorage.removeItem(ii)}catch{}}function He(L){const W=L.installed??[];a.value=W;const H=new Set(W.map(Y=>Y.name));i.value=L.data.map(Y=>{if(Y.installed||H.has(Y.name)){const Q=W.find(Ie=>Ie.name===Y.name);return{...Y,installed:!0,path:(Q==null?void 0:Q.path)??Y.path,enabled:(Q==null?void 0:Q.enabled)??Y.enabled}}return Y}).filter(Y=>!Y.installed),l.value=L.total}async function Pe(L){const W=Me(L),H=Je(W);H&&He(H),f.value=!H,u.value="";try{const Y=new URLSearchParams;L.trim()&&Y.set("q",L.trim()),Y.set("limit","100"),Y.set("sort",o.value);const Q=await fetch(`/codex-api/skills-hub?${Y}`);if(!Q.ok)throw new Error(`HTTP ${Q.status}`);const Ie=await Q.json();He(Ie),qe(W,Ie)}catch(Y){u.value=Y instanceof Error?Y.message:"Failed to load skills"}finally{f.value=!1}}function rt(){K&&clearTimeout(K),K=setTimeout(()=>Pe(s.value),300)}function Ce(L){E.value=L,_.value=!0}async function Ue(L){M.value=`${L.owner}/${L.name}`,Z.value=!0;try{const H=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:L.owner,name:L.name})})).json();if(!H.ok)throw new Error(H.error||"Install failed");const Y={...L,installed:!0,path:H.path,enabled:!0};a.value=[...a.value,Y],i.value=i.value.filter(Q=>Q.name!==L.name),E.value=Y,de(`${L.displayName||L.name} skill installed`),_.value=!1,Ge(),ne("skills-changed")}catch(W){de(W instanceof Error?W.message:"Failed to install skill","error")}finally{Z.value=!1}}async function lt(L){M.value=`${L.owner}/${L.name}`,ce.value=!0;try{const H=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:L.name,path:L.path})})).json();if(!H.ok)throw new Error(H.error||"Uninstall failed");a.value=a.value.filter(Y=>Y.name!==L.name),L.owner!=="local"&&(i.value=[...i.value,{...L,installed:!1,path:void 0,enabled:void 0}]),de(`${L.displayName||L.name} skill uninstalled`),_.value=!1,Ge(),ne("skills-changed")}catch(W){de(W instanceof Error?W.message:"Failed to uninstall skill","error")}finally{ce.value=!1}}async function Ft(L,W){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:L.path,enabled:W}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),de(`${L.displayName||L.name} skill ${W?"enabled":"disabled"}`),await Pe(s.value)}catch(H){de(H instanceof Error?H.message:"Failed to update skill","error")}}const{deviceLogin:pt,isPullInFlight:ct,isPushInFlight:We,isSyncActionInFlight:G,loadSyncStatus:be,logoutGithub:fe,pullSkillsSync:Ae,pushSkillsSync:Ee,startGithubFirebaseLogin:T,startGithubLogin:S,syncActionError:O,syncActionStatus:X,syncStatus:V}=R1({showToast:de,onPulled:async()=>{await Pe(s.value),ne("skills-changed")}});return Gr(()=>{Pe(""),be()}),(L,W)=>(y(),k("div",P1,[W[11]||(W[11]=v("div",{class:"skills-hub-header"},[v("h2",{class:"skills-hub-title"},"Skills Hub"),v("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),v("div",M1,[v("div",$1,[W[8]||(W[8]=v("strong",null,"Skills Sync (GitHub)",-1)),we(V).configured?(y(),k("span",O1,"Connected: "+J(we(V).repoOwner)+"/"+J(we(V).repoName),1)):we(V).loggedIn?(y(),k("span",N1,"Logged in as "+J(we(V).githubUsername),1)):(y(),k("span",L1,"Not connected"))]),v("div",D1,[v("span",null,"Startup: "+J(we(V).startup.mode),1),v("span",null,"Branch: "+J(we(V).startup.branch),1),v("span",null,"Action: "+J(we(V).startup.lastAction),1)]),we(V).startup.lastError?(y(),k("div",j1,J(we(V).startup.lastError),1)):pe("",!0),we(X)?(y(),k("div",F1,[v("span",null,"Manual sync: "+J(we(X)),1)])):pe("",!0),we(O)?(y(),k("div",B1,J(we(O)),1)):pe("",!0),we(pt)?(y(),k("div",U1,[v("span",null,[W[9]||(W[9]=jo("Open ",-1)),v("a",{href:we(pt).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,H1),W[10]||(W[10]=jo(" and enter code:",-1))]),v("code",null,J(we(pt).user_code),1)])):pe("",!0),v("div",W1,[we(V).loggedIn?pe("",!0):(y(),k("button",{key:0,class:"skills-hub-sort",type:"button",onClick:W[0]||(W[0]=(...H)=>we(T)&&we(T)(...H))},"Login with GitHub")),we(V).loggedIn?pe("",!0):(y(),k("button",{key:1,class:"skills-hub-sort",type:"button",onClick:W[1]||(W[1]=(...H)=>we(S)&&we(S)(...H))},"Device Login")),we(V).loggedIn?(y(),k("button",{key:2,class:"skills-hub-sort",type:"button",onClick:W[2]||(W[2]=(...H)=>we(fe)&&we(fe)(...H)),disabled:we(G)},"Logout GitHub",8,V1)):pe("",!0),v("button",{class:"skills-hub-sort",type:"button",onClick:W[3]||(W[3]=(...H)=>we(Ae)&&we(Ae)(...H)),disabled:we(G)},J(we(ct)?"Pulling...":"Pull"),9,z1),we(V).loggedIn?(y(),k("button",{key:3,class:"skills-hub-sort",type:"button",onClick:W[4]||(W[4]=(...H)=>we(Ee)&&we(Ee)(...H)),disabled:!we(V).configured||we(G)},J(we(We)?"Pushing...":"Push"),9,q1)):pe("",!0)])]),B.value?(y(),k("div",{key:0,class:tt(["skills-hub-toast",ge.value])},J(B.value.text),3)):pe("",!0),se.value.length>0?(y(),k("div",G1,[v("button",{class:"skills-hub-section-toggle",type:"button",onClick:W[5]||(W[5]=H=>g.value=!g.value)},[v("span",K1,"Installed ("+J(se.value.length)+")",1),Be(zf,{class:tt(["skills-hub-section-chevron",{"is-open":g.value}])},null,8,["class"])]),g.value?(y(),k("div",J1,[(y(!0),k(De,null,mt(se.value,H=>(y(),wt(Mu,{key:H.name,skill:H,onSelect:Y=>Ce(Y)},null,8,["skill","onSelect"]))),128))])):pe("",!0)])):pe("",!0),v("div",Y1,[v("div",Q1,[Be(il,{class:"skills-hub-search-icon"}),Hr(v("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":W[6]||(W[6]=H=>s.value=H),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:rt},null,544),[[Wr,s.value]]),l.value>0?(y(),k("span",X1,J(l.value)+" skills",1)):pe("",!0)]),v("button",{class:"skills-hub-sort",type:"button",onClick:re},J(ke.value),1)]),v("div",Z1,[f.value?(y(),k("div",eA,"Loading skills...")):u.value?(y(),k("div",tA,J(u.value),1)):(y(),k(De,{key:2},[i.value.length>0?(y(),k("div",nA,[(y(!0),k(De,null,mt(i.value,H=>(y(),wt(Mu,{key:H.url,skill:H,onSelect:Y=>Ce(Y)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(y(),k("div",rA,'No skills found for "'+J(s.value)+'"',1)):pe("",!0)],64))]),Be(GS,{skill:E.value,visible:_.value,"is-installing":je.value,"is-uninstalling":ue.value,onClose:W[7]||(W[7]=H=>_.value=!1),onInstall:Ue,onUninstall:lt,onToggleEnabled:Ft},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),oA=gt(sA,[["__scopeId","data-v-2f6920be"]]),iA={},aA={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 lA(e,t){return y(),k("svg",aA,[...t[0]||(t[0]=[v("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),v("path",{d:"M9 4l0 16"},null,-1)])])}const cA=gt(iA,[["render",lA]]),uA={},dA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function fA(e,t){return y(),k("svg",dA,[...t[0]||(t[0]=[v("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 hA=gt(uA,[["render",fA]]),pA={class:"sidebar-thread-controls"},mA=["aria-label","title"],gA=sn({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(y(),k("div",pA,[v("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?(y(),wt(hA,{key:0,class:"sidebar-thread-controls-icon"})):(y(),wt(cA,{key:1,class:"sidebar-thread-controls-icon"}))],8,mA),br(t.$slots,"default",{},void 0),e.showNewThreadButton?(y(),k("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"))},[Be(Ci,{class:"sidebar-thread-controls-icon"})])):pe("",!0)]))}}),id=gt(gA,[["__scopeId","data-v-46a10052"]]),vA={},yA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function wA(e,t){return y(),k("svg",yA,[...t[0]||(t[0]=[v("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[v("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"}),v("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const bA=gt(vA,[["render",wA]]);function Mr(e){return e.flatMap(t=>t.threads)}const Vh="codex-web-local.thread-read-state.v1",zh="codex-web-local.thread-scroll-state.v1",ml="codex-web-local.selected-thread-id.v1",qh="codex-web-local.project-order.v1",Gh="codex-web-local.project-display-name.v1",gl="codex-web-local.collaboration-mode-by-context.v1",Kh="codex-web-local.collaboration-mode.v1",Jh="__new-thread__",Ma=220,ad=["none","minimal","low","medium","high","xhigh"],Us="__global__",Jn="gpt-5.2-codex";function _A(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Vh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function ld(e){typeof window>"u"||window.localStorage.setItem(Vh,JSON.stringify(e))}function vl(e){return e==="plan"?"plan":"default"}function Yh(e){return e.trim()||Jh}function kA(){if(typeof window>"u")return{};try{const t=window.localStorage.getItem(gl);if(t){const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const r={};for(const[s,o]of Object.entries(n)){if(typeof s!="string"||s.length===0)continue;const i=vl(o);i==="plan"&&(r[s]=i)}return r}}catch{}return vl(window.localStorage.getItem(Kh))==="plan"?{[Jh]:"plan"}:{}}function $a(e,t){const n=Yh(t);return vl(e[n])}function TA(e){typeof window>"u"||(Object.keys(e).length===0?window.localStorage.removeItem(gl):window.localStorage.setItem(gl,JSON.stringify(e)),window.localStorage.removeItem(Kh))}function Qh(e,t,n){return Math.min(Math.max(e,t),n)}function SA(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=Qh(t.scrollRatio,0,1)),n}function IA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(zh);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=SA(s);o&&(n[r]=o)}return n}catch{return{}}}function cd(e){typeof window>"u"||window.localStorage.setItem(zh,JSON.stringify(e))}function EA(){return typeof window>"u"?"":window.localStorage.getItem(ml)??""}function CA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(ml);return}window.localStorage.setItem(ml,e)}}function AA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(qh);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 Hs(e){typeof window>"u"||window.localStorage.setItem(qh,JSON.stringify(e))}function xA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Gh);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 Oa(e){typeof window>"u"||window.localStorage.setItem(Gh,JSON.stringify(e))}function ai(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 xs(e,n)?e:n}function Na(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 xs(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 RA(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 PA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function MA(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 $A(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&MA(e.steps,t.steps)}function li(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 yl(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&xs(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&PA(e.commandExecution,t.commandExecution)&&$A(e.plan,t.plan)&&e.turnIndex===t.turnIndex}function Po(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,n={}){const r=new Map(e.map(u=>[u.id,u])),s=new Map(t.map(u=>[u.id,u])),o=t.map(u=>{const g=r.get(u.id);return g&&yl(g,u)?g:u});if(n.preserveMissing!==!0)return Po(e,o)?e:o;const i=e.map(u=>{const g=s.get(u.id);return!g||yl(u,g)?u:g}),a=new Set(e.map(u=>u.id)),l=o.filter(u=>!a.has(u.id)),f=[...i,...l];return Po(e,f)?e:f}function wl(e){return e.replace(/\s+/gu," ").trim()}function NA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>wl(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=wl(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function La(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(yl(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Xh="worked";function rs(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function LA(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 DA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function jA(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 FA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${LA(e.durationMs)}`,messageType:Xh}}function BA(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function UA(e,t){const n=FA(t),r=e.filter(i=>i.messageType!==Xh),s=BA(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 HA(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 WA(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 VA(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 zA(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 pn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function ci(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 f=i.get(l.id);return f&&WA(f,l)?f:l});return o&&o.projectName===s.projectName&&VA(o.threads,a)?o:{projectName:s.projectName,threads:a}});return zA(e,r)?e:r}function qA(e,t,n){const r=new Set(Mr(t).map(a=>a.id)),s=Mr(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 f=i.findIndex(u=>u.projectName===a.projectName);f>=0&&(i[f]={projectName:i[f].projectName,threads:[a,...i[f].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function GA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Ws(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function KA(e){const t=e.split(`
1447
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function JA(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function YA(){const e=j([]),t=j([]),n=j(EA()),r=j({}),s=j({}),o=j({}),i=j({}),a=j({}),l=j({}),f=j({}),u=j({}),g=j([]),_=j([{value:"default",label:"Default"},{value:"plan",label:"Plan"}]),E=j(kA()),B=j($a(E.value,n.value)),M=j(""),Z=j("medium"),ce=j(_A()),K=j(IA()),te=j(AA()),ne=j(xA()),ke=j({}),ge=j({}),ye=j({}),je=j({}),ue=j({}),se=j({}),de=j({}),re=j({}),Me=j({}),Je=j(null),qe=j({}),Ge=j([]),He=j(!1),Pe=j(!1),rt=j(!1),Ce=j(!1),Ue=j(""),lt=j(!1),Ft=j(!1);let pt=null,ct=null,We=!1;const G=new Set;let be=!1,fe=!1;const Ae=new Map,Ee=new Set,T=he(()=>Mr(e.value)),S=he(()=>T.value.find(c=>c.id===n.value)??null),O=he(()=>K.value[n.value]??null),X=he(()=>{const c=[],p=n.value;return p&&Array.isArray(re.value[p])&&c.push(...re.value[p]),Array.isArray(re.value[Us])&&c.push(...re.value[Us]),c.sort((w,C)=>w.receivedAtIso.localeCompare(C.receivedAtIso))}),V=he(()=>{var F;const c=n.value;if(!c)return null;const p=ue.value[c],w=(i.value[c]??"").trim(),C=(((F=se.value[c])==null?void 0:F.message)??"").trim();return!p&&!w&&!C?null:{activityLabel:(p==null?void 0:p.label)||"Thinking",activityDetails:(p==null?void 0:p.details)??[],reasoningText:w,errorText:C}}),L=he(()=>Je.value),W=he(()=>{const c=n.value;if(!c)return[];const p=r.value[c]??[],w=s.value[c]??[],C=o.value[c]??[],F=a.value[c]??[],q=[...p,...w,...F,...C],ie=je.value[c];return ie?UA(q,ie):q});function H(c){n.value!==c&&(n.value=c,CA(c),B.value=$a(E.value,c),fe=!1)}function Y(c){M.value=c.trim()}function Q(c){const p=c==="plan"?"plan":"default",w=Yh(n.value);$a(E.value,n.value)===p&&B.value===p||(B.value=p,E.value=p==="plan"?{...E.value,[w]:p}:Qt(E.value,w),TA(E.value))}function Ie(c){Je.value=c}async function _e(){M.value=Jn,g.value.includes(Jn)||(g.value=[...g.value,Jn]);try{await d0(Jn)}catch{}}function Se(c,p){Me.value={...Me.value,[c]:p}}function xe(c){Me.value[c]&&(Me.value=Qt(Me.value,c))}async function Ve(c){if(Ee.has(c))return;const p=Me.value[c];if(!(!p||p.fallbackRetried)){Ee.add(c),Se(c,{...p,fallbackRetried:!0});try{await _e();try{const w=await Su(c,1);Bt(c,w),bn(c),tn(c,[]),rn(c),a.value[c]&&(a.value=Qt(a.value,c))}catch{}Mt(c,null),Ue.value="",_t(c,null),kt(c,{label:"Thinking",details:ut(Jn,p.effort,p.collaborationMode)}),vt(c,!0),ye.value[c]!==!0&&await ka(c),await Ta(c,p.text,p.imageUrls,Jn,p.effort||void 0,p.skills.length>0?p.skills:void 0,p.fileAttachments,p.collaborationMode),ye.value={...ye.value,[c]:!0},G.add(c),We=!0,await d()}catch(w){const C=w instanceof Error?w.message:"Unknown application error";Mt(c,C),Ue.value=C,vt(c,!1),kt(c,null)}finally{Ee.delete(c)}}}function ot(c){c&&!ad.includes(c)||(Z.value=c)}async function Ze(){try{const c=await h0();_.value=c,c.some(p=>p.value===B.value)||Q("default")}catch{}}function ut(c,p,w=B.value){const C=c.trim()||"default",F=p||"default";return[`Mode: ${w==="plan"?"Plan":"Default"}`,`Model: ${C}`,`Thinking: ${F}`]}async function bt(){try{const[c,p]=await Promise.all([Xf(),Zf()]);g.value=c,M.value.length>0&&c.includes(M.value)||(p.model&&c.includes(p.model)?M.value=p.model:c.length>0?M.value=c[0]:M.value=""),p.reasoningEffort&&ad.includes(p.reasoningEffort)&&(Z.value=p.reasoningEffort)}catch{}}function Rt(c){const p=qe.value;return Object.keys(p).length===0?c:c.map(w=>({projectName:w.projectName,threads:w.threads.map(C=>{const F=p[C.id];return F?{...C,title:F}:C})}))}function Qe(){const p=Rt(t.value).map(w=>({projectName:w.projectName,threads:w.threads.map(C=>{const F=l.value[C.id]===!0,q=n.value===C.id,ie=ce.value[C.id],me=u.value[C.id]===!0,le=!q&&!F&&(me||ie!==C.updatedAtIso);return{...C,inProgress:F,unread:le}})}));e.value=ci(e.value,p)}function Pt(c,p,w){const C=new Date().toISOString(),F=p.trim(),q=GA(F),ie={id:c,title:KA(w),projectName:q,cwd:F,hasWorktree:F.includes("/.codex/worktrees/")||F.includes("/.git/worktrees/"),createdAtIso:C,updatedAtIso:C,preview:w,unread:!1,inProgress:!1},me=t.value.findIndex(et=>et.projectName===q);if(me>=0){const Ot=t.value[me].threads.filter(Cr=>Cr.id!==c),Ut={projectName:q,threads:[ie,...Ot]},Tn=[...t.value];Tn.splice(me,1,Ut),t.value=Tn}else t.value=[{projectName:q,threads:[ie]},...t.value];const le=ai(te.value,t.value);xs(te.value,le)||(te.value=le,Hs(te.value)),Qe()}function zt(c){const p=new Set(c.map(q=>q.id)),w=pn(ce.value,p);w!==ce.value&&(ce.value=w,ld(w));const C=pn(K.value,p);C!==K.value&&(K.value=C,cd(C)),ge.value=pn(ge.value,p),ke.value=pn(ke.value,p),ye.value=pn(ye.value,p),r.value=pn(r.value,p),o.value=pn(o.value,p),i.value=pn(i.value,p),a.value=pn(a.value,p),je.value=pn(je.value,p),ue.value=pn(ue.value,p),se.value=pn(se.value,p),de.value=pn(de.value,p),u.value=pn(u.value,p),l.value=pn(l.value,p);const F={};for(const[q,ie]of Object.entries(re.value))(q===Us||p.has(q))&&(F[q]=ie);re.value=F}function st(c){const p=Mr(t.value).find(w=>w.id===c);p&&(ce.value={...ce.value,[c]:p.updatedAtIso},ld(ce.value),u.value[c]&&(u.value=Qt(u.value,c)),Qe())}function _t(c,p){if(!c)return;const w=je.value[c];if(p){if(DA(w,p))return;je.value={...je.value,[c]:p}}else w&&(je.value=Qt(je.value,c))}function vt(c,p){!c||l.value[c]===!0===p||(p?l.value={...l.value,[c]:!0}:l.value=Qt(l.value,c),Qe())}function Jt(c){c&&c!==n.value&&u.value[c]!==!0&&(u.value={...u.value,[c]:!0},Qe())}function kt(c,p){if(!c)return;const w=ue.value[c];if(!p){w&&(ue.value=Qt(ue.value,c));return}const C=On(p.label)||"Thinking",F=p.details.map(me=>On(me)).filter(me=>me.length>0&&me!==C),q=Array.from(new Set([...(w==null?void 0:w.details)??[],...F])).slice(-3),ie={label:C,details:q};jA(w,ie)||(ue.value={...ue.value,[c]:ie})}function Mt(c,p){if(!c)return;const w=se.value[c],C=p?wl(p):"";if(!C){w&&(se.value=Qt(se.value,c));return}(w==null?void 0:w.message)!==C&&(se.value={...se.value,[c]:{message:C}})}function Hn(c){const p=Mr(t.value).find(w=>w.id===c);return(p==null?void 0:p.updatedAtIso)??""}function un(c,p){if(!c)return;const w={scrollTop:Math.max(0,p.scrollTop),isAtBottom:p.isAtBottom===!0};typeof p.scrollRatio=="number"&&Number.isFinite(p.scrollRatio)&&(w.scrollRatio=Qh(p.scrollRatio,0,1));const C=K.value[c];C&&C.scrollTop===w.scrollTop&&C.isAtBottom===w.isAtBottom&&C.scrollRatio===w.scrollRatio||(K.value={...K.value,[c]:w},cd(K.value))}function Bt(c,p){const w=r.value[c]??[];Po(w,p)||(r.value={...r.value,[c]:p})}function tn(c,p){const w=o.value[c]??[];Po(w,p)||(o.value={...o.value,[c]:p})}function It(c,p){const w=s.value[c]??[];Po(w,p)||(s.value={...s.value,[c]:p})}function Rn(c,p){const w=s.value[c]??[],C=La(w,p);It(c,C)}function $t(c,p){const w=o.value[c]??[],C=La(w,p);tn(c,C)}function on(c,p){if(!c)return;const w=p.trim(),C=i.value[c]??"";if(w.length===0){if(!C)return;i.value=Qt(i.value,c);return}C!==w&&(i.value={...i.value,[c]:w})}function nn(c,p){if(!c)return;const w=i.value[c]??"";on(c,`${w}${p}`)}function rn(c){c&&c in i.value&&(i.value=Qt(i.value,c))}function bn(c){c&&c in s.value&&(s.value=Qt(s.value,c))}function dn(c){return c==="completed"?"completed":c==="inProgress"||c==="in_progress"?"inProgress":"pending"}function Xn(c){var w;const p=[];(w=c.explanation)!=null&&w.trim()&&p.push(c.explanation.trim());for(const C of c.steps){const F=C.status==="completed"?"x":C.status==="inProgress"?"~":" ";p.push(`- [${F}] ${C.step}`)}return p.join(`
1448
+ `).trim()}function Pn(c){if(c.method!=="turn/plan/updated")return null;const p=$e(c.params),w=qt(c),C=Re(p==null?void 0:p.turnId)||Re(p==null?void 0:p.turn_id),q=(Array.isArray(p==null?void 0:p.plan)?p==null?void 0:p.plan:[]).map(le=>$e(le)).map(le=>({step:Re(le==null?void 0:le.step),status:dn(le==null?void 0:le.status)})).filter(le=>le.step.length>0);if(!w||!C)return null;const me={explanation:Re(p==null?void 0:p.explanation).trim()||void 0,steps:q,isStreaming:!0};return{threadId:w,message:{id:`${C}:plan`,role:"assistant",text:Xn(me),messageType:"plan.live",plan:me}}}function Mn(c){if(c.method!=="item/plan/delta")return null;const p=$e(c.params),w=qt(c),C=Re(p==null?void 0:p.turnId)||Re(p==null?void 0:p.turn_id),F=Re(p==null?void 0:p.delta);if(!w||!C||!F)return null;const q=`${C}:plan`,ie=(s.value[w]??[]).find(et=>et.id===q),me=`${(ie==null?void 0:ie.text)??""}${F}`,le=ie!=null&&ie.plan?{...ie.plan,isStreaming:!0}:void 0;return{threadId:w,message:{id:q,role:"assistant",text:me,messageType:"plan.live",plan:le}}}function $e(c){return c!==null&&typeof c=="object"&&!Array.isArray(c)?c:null}function Re(c){return typeof c=="string"?c:""}function _n(c){return typeof c=="number"&&Number.isFinite(c)?c:null}function qt(c){const p=$e(c.params);if(!p)return"";const w=Re(p.threadId);if(w)return w;const C=Re(p.thread_id);if(C)return C;const F=Re(p.conversationId);if(F)return F;const q=Re(p.conversation_id);if(q)return q;const ie=$e(p.thread),me=Re(ie==null?void 0:ie.id);if(me)return me;const le=$e(p.turn),et=Re(le==null?void 0:le.threadId);if(et)return et;const Ot=Re(le==null?void 0:le.thread_id);return Ot||""}function Zn(c){if(c.method!=="turn/completed")return"";const p=$e(c.params),w=$e(p==null?void 0:p.turn);if(!w||w.status!=="failed")return"";const C=$e(w.error);return Re(C==null?void 0:C.message)}function Wn(c){var w;if(c.method!=="error")return"";const p=$e(c.params);return Re(p==null?void 0:p.message)||Re((w=$e(p==null?void 0:p.error))==null?void 0:w.message)}function Dn(c){const p=$e(c);if(!p)return null;const w=p.id,C=Re(p.method),F=p.params;if(typeof w!="number"||!Number.isInteger(w)||!C)return null;const q=$e(F),ie=Re(q==null?void 0:q.threadId)||Us,me=Re(q==null?void 0:q.turnId),le=Re(q==null?void 0:q.itemId),et=Re(p.receivedAtIso)||new Date().toISOString();return{id:w,method:C,threadId:ie,turnId:me,itemId:le,receivedAtIso:et,params:F??null}}function Vn(c){if(c.method!=="item/tool/requestUserInput")return[];const p=$e(c.params),w=Array.isArray(p==null?void 0:p.questions)?p.questions:[],C=[];for(const F of w){const q=$e(F),ie=Re(q==null?void 0:q.id).trim();ie&&C.push(ie)}return C}function zn(c){const p=c.threadId||Us,w=re.value[p]??[],C=w.findIndex(q=>q.id===c.id),F=[...w];C>=0?F.splice(C,1,c):F.push(c),re.value={...re.value,[p]:F.sort((q,ie)=>q.receivedAtIso.localeCompare(ie.receivedAtIso))}}function kn(c){const p={};for(const[w,C]of Object.entries(re.value)){const F=C.filter(q=>q.id!==c);F.length>0&&(p[w]=F)}re.value=p}function qn(c){const p={};for(const w of c){const C=w.threadId||Us,F=p[C]??[];F.push(w),p[C]=F}for(const w of Object.values(p))w.sort((C,F)=>C.receivedAtIso.localeCompare(F.receivedAtIso));re.value=p}function $n(c){if(c.method==="server/request"){const p=Dn(c.params);return p&&zn(p),!0}if(c.method==="server/request/resolved"){const p=$e(c.params),w=p==null?void 0:p.id;return typeof w=="number"&&Number.isInteger(w)&&kn(w),!0}return!1}function On(c){return c.replace(/\s+/gu," ").trim()}function A(c){const p=qt(c);if(!p)return null;if(c.method==="turn/started")return{threadId:p,activity:{label:"Thinking",details:[]}};if(c.method==="item/started"){const w=$e(c.params),C=$e(w==null?void 0:w.item),F=Re(C==null?void 0:C.type).toLowerCase();if(F==="reasoning")return{threadId:p,activity:{label:"Thinking",details:[]}};if(F==="agentmessage")return{threadId:p,activity:{label:"Writing response",details:[]}};if(F==="commandexecution"){const q=Re(C==null?void 0:C.command);return{threadId:p,activity:{label:"Running command",details:q?[q]:[]}}}}return c.method==="item/commandExecution/outputDelta"?{threadId:p,activity:{label:"Running command",details:[]}}:c.method==="item/reasoning/summaryTextDelta"||c.method==="item/reasoning/summaryPartAdded"?{threadId:p,activity:{label:"Thinking",details:[]}}:c.method==="item/agentMessage/delta"?{threadId:p,activity:{label:"Writing response",details:[]}}:null}function U(c){if(c.method!=="turn/started")return null;const p=$e(c.params);if(!p)return null;const w=qt(c);if(!w)return null;const C=$e(p.turn),F=Re(C==null?void 0:C.id)||Re(p.turnId)||`${w}:unknown`;if(!F)return null;const q=rs(Re(C==null?void 0:C.startedAt))??rs(Re(p.startedAt))??rs(c.atIso)??Date.now();return{threadId:w,turnId:F,startedAtMs:q}}function ae(c){if(c.method!=="turn/completed")return null;const p=$e(c.params);if(!p)return null;const w=qt(c);if(!w)return null;const C=$e(p.turn),F=Re(C==null?void 0:C.id)||Re(p.turnId)||`${w}:unknown`;if(!F)return null;const q=rs(Re(C==null?void 0:C.completedAt))??rs(Re(p.completedAt))??rs(c.atIso)??Date.now(),ie=rs(Re(C==null?void 0:C.startedAt))??rs(Re(p.startedAt))??void 0;return{threadId:w,turnId:F,completedAtMs:q,startedAtMs:ie}}function Oe(c){return`${c}:live-reasoning`}function it(c){const p=$e(c.params);if(!p)return"";if(c.method==="item/started"){const w=$e(p.item);return!w||w.type!=="reasoning"?"":Re(w.id)}return""}function ht(c){const p=$e(c.params);if(!p)return null;if(c.method==="item/reasoning/summaryTextDelta"){const w=Re(p.itemId),C=Re(p.delta);return!w||!C?null:{messageId:Oe(w),delta:C}}return null}function dt(c){const p=$e(c.params);if(!p)return"";if(c.method==="item/reasoning/summaryPartAdded"){const w=Re(p.itemId);return w?Oe(w):""}return""}function jt(c){const p=$e(c.params);if(!p)return"";if(c.method==="item/completed"){const w=$e(p.item);return!w||w.type!=="reasoning"?"":Oe(Re(w.id))}return""}function jn(c){const p=$e(c.params);if(!p)return"";if(c.method==="item/started"){const w=$e(p.item);return!w||w.type!=="agentMessage"?"":Re(w.id)}return""}function Yt(c){const p=$e(c.params);if(!p)return null;if(c.method==="item/agentMessage/delta"){const w=Re(p.itemId),C=Re(p.delta);return!w||!C?null:{messageId:w,delta:C}}return null}function Jr(c){const p=$e(c.params);if(!p)return null;if(c.method==="item/completed"){const w=$e(p.item);if(!w||w.type!=="agentMessage")return null;const C=Re(w.id),F=Re(w.text);return!C||!F?null:{id:C,role:"assistant",text:F,messageType:"agentMessage.live"}}return null}function ur(c){if(c.method!=="item/started")return null;const p=$e(c.params),w=$e(p==null?void 0:p.item);if(!w||w.type!=="commandExecution")return null;const C=Re(w.id),F=Re(w.command);if(!C)return null;const q=typeof w.cwd=="string"?w.cwd:null;return{id:C,role:"system",text:F,messageType:"commandExecution",commandExecution:{command:F,cwd:q,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Yr(c){if(c.method!=="item/commandExecution/outputDelta")return null;const p=$e(c.params);if(!p)return null;const w=Re(p.itemId),C=Re(p.delta);return!w||!C?null:{itemId:w,delta:C}}function Qr(c){if(c.method!=="item/completed")return null;const p=$e(c.params),w=$e(p==null?void 0:p.item);if(!w||w.type!=="commandExecution")return null;const C=Re(w.id),F=Re(w.command);if(!C)return null;const q=typeof w.cwd=="string"?w.cwd:null,ie=Re(w.status),me=ie==="failed"?"failed":ie==="declined"?"declined":ie==="interrupted"?"interrupted":"completed",le=typeof w.aggregatedOutput=="string"?w.aggregatedOutput:"",et=typeof w.exitCode=="number"?w.exitCode:null;return{id:C,role:"system",text:F,messageType:"commandExecution",commandExecution:{command:F,cwd:q,status:me,aggregatedOutput:le,exitCode:et}}}function Fn(c,p){const w=a.value[c]??[],C=La(w,p);C!==w&&(a.value={...a.value,[c]:C})}function gs(c,p){const w=a.value[c];if(!w||w.length===0)return;const C=new Set(p.map(q=>q.id)),F=w.filter(q=>!C.has(q.id));F.length!==w.length&&(F.length===0?a.value=Qt(a.value,c):a.value={...a.value,[c]:F})}function Xr(c){if(c.method==="item/agentMessage/delta")return!0;const p=$e(c.params);if(!p)return!1;if(c.method==="item/completed"){const w=$e(p.item);return(w==null?void 0:w.type)==="agentMessage"}return!1}function Nn(c){var D,oe,ze,at,Ke;if($n(c))return;if(c.method==="thread/name/updated"){const Le=$e(c.params),Bn=Re(Le==null?void 0:Le.threadId),tr=Re(Le==null?void 0:Le.threadName);Bn&&tr&&(qe.value={...qe.value,[Bn]:tr},Qe(),Sa(Bn,tr))}if(c.method==="account/rateLimits/updated"){Ie(Yf(c.params));return}const p=A(c);p&&kt(p.threadId,p.activity);const w=U(c);w&&(Ae.set(w.turnId,w),de.value={...de.value,[w.threadId]:w.turnId},bn(w.threadId),_t(w.threadId,null),Mt(w.threadId,null),vt(w.threadId,!0),u.value[w.threadId]&&(u.value=Qt(u.value,w.threadId)));const C=ae(c),F=Zn(c),ie=!!((C==null?void 0:C.threadId)??qt(c))&&!!F&&M.value!==Jn&&li(new Error(F));if(C){const Le=Ae.get(C.turnId);Le&&Ae.delete(C.turnId);const Bn=_n((D=$e(c.params))==null?void 0:D.durationMs)??_n((ze=$e((oe=$e(c.params))==null?void 0:oe.turn))==null?void 0:ze.durationMs)??(typeof C.startedAtMs=="number"?C.completedAtMs-C.startedAtMs:null)??(Le?C.completedAtMs-Le.startedAtMs:null),tr=typeof Bn=="number"?Math.max(0,Bn):0;_t(C.threadId,{turnId:C.turnId,durationMs:tr}),de.value[C.threadId]&&(de.value=Qt(de.value,C.threadId)),vt(C.threadId,!1),kt(C.threadId,null),Jt(C.threadId),ie||(xe(C.threadId),ws(C.threadId))}if(F){const Le=(C==null?void 0:C.threadId)||qt(c);Le&&Mt(Le,F),Ue.value=F,Le&&ie&&Ve(Le)}else C&&Mt(C.threadId,null);const me=Wn(c);if(me){const Le=qt(c);Le&&Mt(Le,me),Ue.value=me,M.value!==Jn&&li(new Error(me))&&(Le?Ve(Le):_e())}const le=qt(c),et=Pn(c);et&&(Rn(et.threadId,et.message),kt(et.threadId,{label:"Planning",details:((at=et.message.plan)==null?void 0:at.steps.map(Le=>Le.step).slice(0,2))??[]}));const Ot=Mn(c);if(Ot&&(Rn(Ot.threadId,Ot.message),kt(Ot.threadId,{label:"Planning",details:[]})),!le||le!==n.value)return;jn(c);const Ut=Yt(c);if(Ut){const Le=(o.value[le]??[]).find(tr=>tr.id===Ut.messageId),Bn=`${(Le==null?void 0:Le.text)??""}${Ut.delta}`;$t(le,{id:Ut.messageId,role:"assistant",text:Bn,messageType:"agentMessage.live"})}const Tn=Jr(c);Tn&&$t(le,Tn),it(c);const Cr=ht(c);if(Cr&&nn(le,Cr.delta),dt(c)){const Le=i.value[le]??"";Le.trim().length>0&&!Le.endsWith(`
1449
+
1450
+ `)&&on(le,`${Le}
1451
+
1452
+ `)}jt(c);const bs=ur(c);bs&&(Fn(le,bs),kt(le,{label:"Running command",details:[((Ke=bs.commandExecution)==null?void 0:Ke.command)??""]}));const fo=Yr(c);if(fo){const Le=(a.value[le]??[]).find(Bn=>Bn.id===fo.itemId);Le!=null&&Le.commandExecution&&Fn(le,{...Le,commandExecution:{...Le.commandExecution,aggregatedOutput:`${Le.commandExecution.aggregatedOutput}${fo.delta}`}})}const b=Qr(c);if(b&&Fn(le,b),Xr(c)&&(fe&&n.value&&un(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),rn(le)),c.method==="turn/completed"){fe=!1,rn(le),a.value[le]&&(a.value=Qt(a.value,le));const Le=qt(c);Le&&(vt(Le,!1),kt(Le,null),Jt(Le),ie||(xe(Le),ws(Le)))}}function Sr(c){const p=qt(c);p&&G.add(p);const w=c.method;(w.startsWith("thread/")||w.startsWith("turn/")||w.startsWith("item/"))&&(We=!0),!(ct!==null||typeof window>"u")&&(ct=window.setTimeout(()=>{ct=null,d()},Ma))}async function vs(c){if(!be){be=!0;try{const p=await wo(),w=[];for(const C of p.order){const F=Ws(C);w.includes(F)||w.push(F)}if(w.length>0){const C=ai(w,c);xs(te.value,C)||(te.value=C,Hs(te.value))}if(Object.keys(p.labels).length>0){const C={...ne.value};let F=!1;for(const[q,ie]of Object.entries(p.labels)){const me=Ws(q);C[me]!==ie&&(C[me]=ie,F=!0)}F&&(ne.value=C,Oa(C))}}catch{}}}async function I(){if(!(Object.keys(qe.value).length>0))try{const c=await w0();Object.keys(c.titles).length>0&&(qe.value=c.titles)}catch{}}async function R(c,p,w){if(qe.value[c])return;const C=p.trim();if(!C)return;const F=C.length>300?C.slice(0,300):C;try{const q=await b0(F,w);if(!q||qe.value[c])return;qe.value={...qe.value,[c]:q},Qe(),Sa(c,q)}catch{}}async function $(){var c;Ft.value||(He.value=!0);try{const[p]=await Promise.all([Kk(),I()]);await vs(p);const w=ai(te.value,p);xs(te.value,w)||(te.value=w,Hs(te.value));const C=Na(p,te.value),F=qA(t.value,C,l.value);t.value=ci(t.value,F),l.value=pn(l.value,new Set(Mr(t.value).map(me=>me.id))),Qe(),Ft.value=!0;const q=Mr(e.value);zt(q),q.some(me=>me.id===n.value)||H(((c=q[0])==null?void 0:c.id)??"")}finally{He.value=!1}}async function ee(c,p={}){if(!c)return;const w=ge.value[c]===!0,C=p.silent!==!0&&!w;C&&(Pe.value=!0);try{ye.value[c]!==!0&&(await ka(c),ye.value={...ye.value,[c]:!0});const{messages:F,inProgress:q}=await Jk(c),ie=r.value[c]??[],me=OA(ie,F,{preserveMissing:p.silent===!0});Bt(c,me);const le=o.value[c]??[],et=NA(le,F);tn(c,et),gs(c,F),ge.value={...ge.value,[c]:!0};const Ot=Hn(c);Ot&&(ke.value={...ke.value,[c]:Ot}),vt(c,q),q||bn(c),st(c)}finally{C&&(Pe.value=!1)}}async function Fe(c,p={}){c&&ge.value[c]!==!0&&await ee(c,p)}async function yt(){try{const c=t.value.flatMap(p=>p.threads.map(w=>w.cwd)).filter(Boolean);Ge.value=await _0(c.length>0?[...new Set(c)]:void 0)}catch{}}async function Gt(){try{Ie(await Zk())}catch{}}async function fn(c={}){Ue.value="";const p=c.includeSelectedThreadMessages!==!1,w=c.awaitAncillaryRefreshes===!0;try{await $();const C=Promise.allSettled([bt(),Ze(),yt(),Gt()]).then(()=>{});p&&await ee(n.value),w&&await C}catch(C){Ue.value=C instanceof Error?C.message:"Unknown application error"}}async function Wt(c){H(c);try{await ee(c)}catch(p){Ue.value=p instanceof Error?p.message:"Unknown application error"}}async function Kt(c){try{await s0(c),await $(),n.value===c&&await ee(n.value)}catch(p){Ue.value=p instanceof Error?p.message:"Unknown application error"}}async function hn(c,p){const w=p.trim();if(!(!c||!w))try{await o0(c,w),qe.value={...qe.value,[c]:w},Qe(),Sa(c,w)}catch(C){Ue.value=C instanceof Error?C.message:"Unknown application error"}}async function Gn(c,p){var ie;const w=c.trim();if(!w||!Number.isInteger(p)||p<0)return"";if(l.value[w]===!0)return Ue.value="Finish the current turn before forking from a response.","";if(ge.value[w]!==!0)try{await ee(w)}catch(me){return Ue.value=me instanceof Error?me.message:"Unknown application error",""}const C=r.value[w]??[];let F=-1;for(const me of C)typeof me.turnIndex=="number"&&Number.isFinite(me.turnIndex)&&(F=Math.max(F,me.turnIndex));if(F>=0&&p>F)return"";const q=Mr(t.value).find(me=>me.id===w)??null;try{Ue.value="";const me=await a0(w),le=me.threadId.trim();if(!le)return"";const et=me.cwd.trim()||((ie=q==null?void 0:q.cwd)==null?void 0:ie.trim())||"",Ot=JA((q==null?void 0:q.title)||(q==null?void 0:q.preview)||"Untitled thread");Pt(le,et,Ot),Bt(le,me.messages),ge.value={...ge.value,[le]:!0},ye.value={...ye.value,[le]:!0},bn(le),tn(le,[]),rn(le),a.value[le]&&(a.value=Qt(a.value,le)),_t(le,null),kt(le,null),Mt(le,null),vt(le,!1);const Ut=F-p;if(Ut>0){const Tn=await Su(le,Ut);Bt(le,Tn)}return await hn(le,Ot),H(le),$().catch(()=>{}),le}catch(me){return Ue.value=me instanceof Error?me.message:"Unknown application error",""}}async function Ir(c,p,w=[],C=[],F=[]){if(!c||!p.trim()||w.length>0||C.length>0||F.length>0)return!1;const ie=(re.value[c]??[]).filter(et=>et.method==="item/tool/requestUserInput");if(ie.length!==1)return!1;const[me]=ie,le=Vn(me);return le.length!==1?!1:N({id:me.id,result:{answers:{[le[0]]:{answers:[p.trim()]}}}})}async function Ds(c,p=[],w=[],C="steer",F=[]){const q=n.value,ie=c.trim();if(!q||!ie&&p.length===0&&F.length===0||await Ir(q,ie,p,w,F))return;const me=l.value[q]===!0;if(me&&C==="queue"){const le=f.value[q]??[],et=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;f.value={...f.value,[q]:[...le,{id:et,text:ie,imageUrls:p,skills:w,fileAttachments:F,collaborationMode:B.value}]};return}if(me){fe=!0,Zr(q,ie,p,w,F).catch(le=>{const et=le instanceof Error?le.message:"Unknown application error";Mt(q,et),Ue.value=et});return}Ue.value="",fe=!0,_t(q,null),kt(q,{label:"Thinking",details:ut(M.value,Z.value,B.value)}),Mt(q,null),vt(q,!0);try{await Zr(q,ie,p,w,F)}catch(le){fe=!1,vt(q,!1),kt(q,null);const et=le instanceof Error?le.message:"Unknown application error";throw Mt(q,et),Ue.value=et,le}}async function ys(c,p,w=[],C=[],F=[]){const q=c.trim(),ie=p.trim(),me=M.value.trim();if(!q&&w.length===0&&F.length===0)return"";rt.value=!0,Ue.value="";let le="";try{try{le=await Iu(ie||void 0,me||void 0)}catch(Tn){if(me&&me!==Jn&&li(Tn))await _e(),le=await Iu(ie||void 0,Jn);else throw Tn}if(!le)return"";Pt(le,ie,q||"[Image]"),ye.value={...ye.value,[le]:!0},H(le),fe=!0,_t(le,null),kt(le,{label:"Thinking",details:ut(M.value,Z.value,B.value)}),Mt(le,null),vt(le,!0);const et=le,Ot=ie||null,Ut=q;return Zr(le,q,w,C,F).catch(Tn=>{fe=!1,vt(le,!1),kt(le,null);const Cr=Tn instanceof Error?Tn.message:"Unknown application error";Mt(le,Cr),Ue.value=Cr}).finally(()=>{rt.value=!1}),R(et,Ut,Ot),le}catch(et){fe=!1,le&&(vt(le,!1),kt(le,null));const Ot=et instanceof Error?et.message:"Unknown application error";throw le&&Mt(le,Ot),Ue.value=Ot,rt.value=!1,et}}async function Zr(c,p,w=[],C=[],F=[]){const q=M.value.trim(),ie=Z.value,me=B.value,le=p.trim(),et=C.map(Ut=>({name:Ut.name,path:Ut.path})),Ot=F.map(Ut=>({...Ut}));Se(c,{text:le,imageUrls:[...w],skills:et,fileAttachments:Ot,effort:ie,collaborationMode:me,fallbackRetried:!1});try{ye.value[c]!==!0&&await ka(c);try{await Ta(c,p,w,q||void 0,ie||void 0,C.length>0?C:void 0,F,me)}catch(Ut){if(q&&q!==Jn&&li(Ut))await _e(),Se(c,{text:le,imageUrls:[...w],skills:et,fileAttachments:Ot,effort:ie,collaborationMode:me,fallbackRetried:!0}),await Ta(c,p,w,Jn,ie||void 0,C.length>0?C:void 0,F,me);else throw Ut}ye.value={...ye.value,[c]:!0},G.add(c),We=!0,await d()}catch(Ut){throw Ut}}async function ws(c){const p=f.value[c];if(!p||p.length===0)return;const[w,...C]=p;f.value=C.length>0?{...f.value,[c]:C}:Qt(f.value,c),rt.value=!0,Ue.value="",fe=!0,_t(c,null),kt(c,{label:"Thinking",details:ut(M.value,Z.value,w.collaborationMode)}),Mt(c,null),vt(c,!0);try{Q(w.collaborationMode),await Zr(c,w.text,w.imageUrls,w.skills,w.fileAttachments)}catch{vt(c,!1),kt(c,null)}finally{rt.value=!1}}async function dr(){const c=n.value;if(!c||l.value[c]!==!0)return;const p=de.value[c];Ce.value=!0,Ue.value="";try{await u0(c,p),vt(c,!1),kt(c,null),Mt(c,null),de.value[c]&&(de.value=Qt(de.value,c)),G.add(c),We=!0,await d()}catch(w){const C=w instanceof Error?w.message:"Failed to interrupt active turn";Mt(c,C),Ue.value=C}finally{Ce.value=!1}}function js(c,p){c.length===0||(ne.value[c]??"")===p||(ne.value={...ne.value,[c]:p},Oa(ne.value))}async function uo(c){var q;if(c.length===0)return;const p=te.value.filter(ie=>ie!==c);if(xs(te.value,p)||(te.value=p,Hs(te.value)),t.value=t.value.filter(ie=>ie.projectName!==c),ne.value[c]!==void 0){const ie={...ne.value};delete ie[c],ne.value=ie,Oa(ie)}Qe();const w=Mr(e.value);zt(w),w.some(ie=>ie.id===n.value)||H(((q=w[0])==null?void 0:q.id)??"");const F=new Set;try{const ie=await wo();for(const me of ie.order)Ws(me)===c&&F.add(me);for(const me of ie.active)Ws(me)===c&&F.add(me);for(const me of Object.keys(ie.labels))Ws(me)===c&&F.add(me)}catch{}if(F.size>0)try{const ie=await wo(),me=ie.order.filter(Ot=>!F.has(Ot)),le=ie.active.filter(Ot=>!F.has(Ot)),et=le.length===0&&me.length>0?[me[0]]:le;await Cu({order:me,labels:HA(ie.labels,F),active:et});return}catch{}await er()}function Er(c,p){if(c.length===0||t.value.length===0)return;const w=t.value.map(le=>le.projectName),C=w.indexOf(c);if(C===-1)return;const F=Math.max(0,Math.min(p,w.length-1)),q=RA(w,C,F);if(q===w)return;const ie=ai(q,t.value);te.value=ie,Hs(te.value);const me=Na(t.value,te.value);t.value=ci(t.value,me),Qe(),er()}function Fs(c){const p=c.trim();if(!p)return;const w=[p,...te.value.filter(F=>F!==p)];if(xs(te.value,w))return;te.value=w,Hs(te.value);const C=Na(t.value,te.value);t.value=ci(t.value,C),Qe(),er()}async function er(){var c,p;try{const w=await wo(),C=new Map;for(const ie of w.order){const me=Ws(ie);C.has(me)||C.set(me,ie)}for(const ie of t.value){const me=((p=(c=ie.threads[0])==null?void 0:c.cwd)==null?void 0:p.trim())??"";me&&C.set(ie.projectName,me)}const F=[];for(const ie of te.value){const me=C.get(ie);me&&!F.includes(me)&&F.push(me)}for(const ie of w.order)F.includes(ie)||F.push(ie);const q=w.active.filter(ie=>F.includes(ie));q.length===0&&F.length>0&&q.push(F[0]),await Cu({order:F,labels:w.labels,active:q})}catch{}}async function d(){if(lt.value){typeof window<"u"&&ct===null&&(ct=window.setTimeout(()=>{ct=null,d()},Ma));return}lt.value=!0;const c=We,p=new Set(G);We=!1,G.clear();try{c&&await $();const w=n.value;if(!w)return;const C=p.has(w),F=l.value[w]===!0,q=Hn(w),ie=ke.value[w]??"",me=q.length>0&&q!==ie;(C||F||me||c)&&await ee(w,{silent:!0})}catch{}finally{lt.value=!1,(We||G.size>0)&&typeof window<"u"&&ct===null&&(ct=window.setTimeout(()=>{ct=null,d()},Ma))}}async function m(){await x(),We=!0,n.value&&G.add(n.value),await d()}function h(){typeof window>"u"||pt||(x(),pt=Yk(c=>{if(c.method==="ready"){m();return}Nn(c),Sr(c)}))}async function x(){try{const p=(await Xk()).map(w=>Dn(w)).filter(w=>w!==null);qn(p)}catch{}}async function N(c){try{return await Qk(c.id,{result:c.result,error:c.error}),kn(c.id),!0}catch(p){return Ue.value=p instanceof Error?p.message:"Failed to reply to server request",!1}}function P(){pt&&(pt(),pt=null),We=!1,G.clear(),Ae.clear(),ct!==null&&typeof window<"u"&&(window.clearTimeout(ct),ct=null),fe=!1,r.value={},s.value={},o.value={},i.value={},a.value={},ue.value={},je.value={},se.value={},de.value={},f.value={},Je.value=null}const ve=he(()=>{const c=n.value;return c?f.value[c]??[]:[]});function z(c){const p=n.value;if(!p)return;const w=f.value[p];if(!w)return;const C=w.filter(F=>F.id!==c);f.value=C.length>0?{...f.value,[p]:C}:Qt(f.value,p)}function Te(c){const p=n.value;if(!p)return;const w=f.value[p];if(!w)return;const C=w.find(F=>F.id===c);C&&(z(c),Q(C.collaborationMode),Ds(C.text,C.imageUrls,C.skills,"steer",C.fileAttachments))}function Ne(c){H(c)}return{projectGroups:e,projectDisplayNameById:ne,selectedThread:S,selectedThreadScrollState:O,selectedThreadServerRequests:X,selectedLiveOverlay:V,codexQuota:L,selectedThreadId:n,availableCollaborationModes:_,availableModelIds:g,selectedCollaborationMode:B,selectedModelId:M,selectedReasoningEffort:Z,installedSkills:Ge,messages:W,isLoadingThreads:He,isLoadingMessages:Pe,isSendingMessage:rt,isInterruptingTurn:Ce,error:Ue,refreshAll:fn,refreshSkills:yt,selectThread:Wt,loadMessages:ee,ensureThreadMessagesLoaded:Fe,setThreadScrollState:un,archiveThreadById:Kt,renameThreadById:hn,forkThreadFromTurn:Gn,sendMessageToSelectedThread:Ds,sendMessageToNewThread:ys,interruptSelectedThreadTurn:dr,selectedThreadQueuedMessages:ve,removeQueuedMessage:z,steerQueuedMessage:Te,setSelectedCollaborationMode:Q,setSelectedModelId:Y,setSelectedReasoningEffort:ot,respondToPendingServerRequest:N,renameProject:js,removeProject:uo,reorderProject:Er,pinProjectToTop:Fs,startPolling:h,stopPolling:P,primeSelectedThread:Ne}}const QA={class:"sidebar-root"},XA={class:"sidebar-scrollable"},ZA=["aria-pressed"],ex={key:1,class:"sidebar-search-bar"},tx={key:0,class:"sidebar-settings-area"},nx={key:0,class:"sidebar-settings-panel"},rx={class:"sidebar-settings-account-section"},sx={class:"sidebar-settings-account-header"},ox={class:"sidebar-settings-account-header-main"},ix={class:"sidebar-settings-account-count"},ax=["disabled"],lx={key:0,class:"sidebar-settings-account-error"},cx={key:1,class:"sidebar-settings-account-empty"},ux={key:2,class:"sidebar-settings-account-list"},dx=["title","onMouseenter","onMouseleave"],fx={class:"sidebar-settings-account-main"},hx={class:"sidebar-settings-account-email"},px={class:"sidebar-settings-account-meta"},mx={class:"sidebar-settings-account-quota"},gx={class:"sidebar-settings-account-id"},vx={class:"sidebar-settings-account-actions"},yx=["disabled","onClick"],wx=["disabled","onClick"],bx={class:"sidebar-settings-value"},_x={class:"sidebar-settings-value"},kx={class:"content-root"},Tx={class:"content-body"},Sx={key:1,class:"content-grid"},Ix={class:"new-thread-empty"},Ex={class:"worktree-init-status-title"},Cx={class:"worktree-init-status-message"},Ax={key:2,class:"content-grid"},xx={class:"content-thread"},Rx={class:"composer-with-queue"},Px={class:"build-badge","aria-label":"Author name, worktree name, and version"},ud="codex-web-local.sidebar-collapsed.v1",Da="codex-web-local.last-active-thread-route.v1",dd="codex-web-local.send-with-enter.v1",fd="codex-web-local.in-progress-send-mode.v1",hd="codex-web-local.dark-mode.v1",pd="codex-web-local.dictation-click-to-toggle.v1",Mx=400,$x=sn({__name:"App",setup(e){const t="codexui",n="1.0.7",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:a,selectedLiveOverlay:l,codexQuota:f,selectedThreadId:u,availableCollaborationModes:g,availableModelIds:_,selectedCollaborationMode:E,selectedModelId:B,selectedReasoningEffort:M,installedSkills:Z,messages:ce,isLoadingThreads:K,isLoadingMessages:te,isSendingMessage:ne,isInterruptingTurn:ke,refreshAll:ge,refreshSkills:ye,selectThread:je,ensureThreadMessagesLoaded:ue,setThreadScrollState:se,archiveThreadById:de,renameThreadById:re,forkThreadFromTurn:Me,sendMessageToSelectedThread:Je,sendMessageToNewThread:qe,interruptSelectedThreadTurn:Ge,selectedThreadQueuedMessages:He,removeQueuedMessage:Pe,steerQueuedMessage:rt,setSelectedCollaborationMode:Ce,setSelectedModelId:Ue,setSelectedReasoningEffort:lt,respondToPendingServerRequest:Ft,renameProject:pt,removeProject:ct,reorderProject:We,pinProjectToTop:G,startPolling:be,stopPolling:fe,primeSelectedThread:Ae}=YA(),Ee=Nv(),T=Ov(),{isMobile:S}=Vf(),O=j(!1),X=j(!1),V=j(""),L=j("local"),W=j({order:[],labels:{}}),H=j({phase:"idle",title:"",message:""}),Y=j(ie()),Q=j(""),Ie=j(!1),_e=j(null),Se=j(null);let xe=null;const Ve=j("New Project (1)"),ot=j(""),Ze=j(!1),ut=j([]),bt=j(!1),Rt=j(!1),Qe=j(""),Pt=j(""),zt=j(""),st=j(""),_t=j(Te(dd,!0)),vt=j(c()),Jt=j(Ne()),kt=j(Te(pd,!1)),Mt=j(null),Hn=j(!1),un=j(!1);let Bt=null,tn=!1;const It=he(()=>{const b=Ee.params.threadId;return typeof b=="string"?b:""}),Rn=he(()=>{const b=new Set;for(const D of r.value)for(const oe of D.threads)b.add(oe.id);return b}),$t=he(()=>Ee.name==="home"),on=he(()=>Ee.name==="skills"),nn=he(()=>{var b;return on.value?"Skills":$t.value?"New thread":((b=o.value)==null?void 0:b.title)??"Choose a thread"}),rn=he(()=>ce.value.filter(b=>{const D=le(b.messageType,b.role);return D==="worked"?!0:!(D==="turnActivity.live"||D==="turnError.live"||D==="agentReasoning.live")})),bn=he(()=>l.value),dn=he(()=>$t.value?"__new-thread__":u.value),Xn=he(()=>{var b,D;return $t.value?V.value.trim():((D=(b=o.value)==null?void 0:b.cwd)==null?void 0:D.trim())??""}),Pn=he(()=>{var b;return!$t.value&&((b=o.value)==null?void 0:b.inProgress)===!0}),Mn=he(()=>ne.value||ke.value||Pn.value||a.value.length>0),$e=he(()=>{var ze,at;const b=[],D=new Set;for(const Ke of W.value.order){const Le=Ke.trim();!Le||D.has(Le)||(D.add(Le),b.push({value:Le,label:W.value.labels[Le]||er(Le)}))}for(const Ke of r.value){const Le=((at=(ze=Ke.threads[0])==null?void 0:ze.cwd)==null?void 0:at.trim())??"";!Le||D.has(Le)||(D.add(Le),b.push({value:Le,label:s.value[Ke.projectName]??Ke.projectName}))}const oe=V.value.trim();return oe&&!D.has(oe)&&b.unshift({value:oe,label:er(oe)}),b}),Re=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;Gr(()=>{window.addEventListener("keydown",yt),document.addEventListener("visibilitychange",Gt),window.addEventListener("pageshow",fn),window.addEventListener("focus",Wt),q(),Re==null||Re.addEventListener("change",q),Ot(),ys(),uo(),Er(),dr()}),Wi(()=>{window.removeEventListener("keydown",yt),document.removeEventListener("visibilitychange",Gt),window.removeEventListener("pageshow",fn),window.removeEventListener("focus",Wt),Re==null||Re.removeEventListener("change",q),Bt!==null&&(window.clearInterval(Bt),Bt=null),xe&&(clearTimeout(xe),xe=null),fe()}),ft(Q,b=>{const D=b.trim();if(xe&&(clearTimeout(xe),xe=null),!D){Se.value=null;return}xe=setTimeout(()=>{y0(D,1e3).then(oe=>{Q.value.trim()===D&&(Se.value=oe.threadIds)}).catch(()=>{Q.value.trim()===D&&(Se.value=null)})},220)}),ft(ut,()=>{if(typeof window>"u")return;if(!ut.value.some(D=>D.quotaStatus==="loading")){Bt!==null&&(window.clearInterval(Bt),Bt=null);return}Bt===null&&(Bt=window.setInterval(()=>{tn||(tn=!0,Yt({silent:!0}).finally(()=>{tn=!1}))},1500))},{deep:!0});function _n(){ye()}function qt(){Ie.value=!Ie.value,Ie.value?Zt(()=>{var b;return(b=_e.value)==null?void 0:b.focus()}):Q.value=""}function Zn(){var b;Q.value="",(b=_e.value)==null||b.focus()}function Wn(b){b.key==="Escape"&&(Ie.value=!1,Q.value="")}function Dn(b){b&&(Ee.name==="thread"&&It.value===b||(T.push({name:"thread",params:{threadId:b}}),S.value&&Fe(!0)))}async function Vn(b){b&&(u.value!==b&&(await je(b),await T.push({name:"thread",params:{threadId:b}})),await Zt(),N())}function zn(b){return b.length>8?b.slice(-8):b}function kn(b){const D=[b.planType||"unknown"];return b.authMode&&D.unshift(b.authMode),D.join(" · ")}function qn(b){if(!b)return!1;const D=b.toLowerCase();return D.includes("payment required")||/\b402\b/.test(D)}function $n(b){return b.unavailableReason==="payment_required"||qn(b.quotaError)}function On(b){return bt.value||Rt.value||Qe.value.length>0||b.isActive&&Qe.value!==b.accountId&&Mn.value}function A(b){return Pt.value===b.accountId}function U(b){return zt.value===b.accountId||A(b)}function ae(b){return $n(b)?"Unavailable":b.isActive?"Active":Rt.value?"Switching…":"Switch"}function Oe(b){return Qe.value===b.accountId?"Removing…":A(b)?"Click again to remove":"Remove"}function it(b){zt.value=b}function ht(b){zt.value===b&&(zt.value=""),Qe.value!==b&&Pt.value===b&&(Pt.value="")}function dt(b){const D=b.quotaSnapshot;if(!D)return null;const oe=[D==null?void 0:D.primary,D==null?void 0:D.secondary].filter(Ke=>Ke!==null),ze=oe.find(Ke=>Ke.windowMinutes===10080);if(ze)return ze;const at=oe.filter(Ke=>typeof Ke.windowMinutes=="number"&&Ke.windowMinutes>=10080).sort((Ke,Le)=>(Ke.windowMinutes??0)-(Le.windowMinutes??0))[0]??null;return at||(D.secondary??null)}function jt(b){var ze,at;if($n(b))return b.quotaError||"402 Payment Required";const D=b.quotaSnapshot,oe=dt(b);return oe?`${Math.max(0,Math.min(100,100-Math.round(oe.usedPercent)))}% weekly remaining`:(ze=D==null?void 0:D.credits)!=null&&ze.unlimited?"Unlimited credits":(at=D==null?void 0:D.credits)!=null&&at.hasCredits&&D.credits.balance?`${D.credits.balance} credits`:b.quotaStatus==="loading"?"Loading quota…":b.quotaStatus==="error"?b.quotaError||"Quota unavailable":"Fetching account details…"}function jn(b){return[b.email||"Account",kn(b),$n(b)?"Unavailable account":null,jt(b),`Workspace ${b.accountId}`].filter(Boolean).join(`
1453
+ `)}async function Yt(b={}){try{const D=await e0();ut.value=D.accounts,D.accounts.some(oe=>oe.accountId===zt.value)||(zt.value=""),D.accounts.some(oe=>oe.accountId===Pt.value)||(Pt.value="")}catch(D){if(b.silent===!0)return;st.value=D instanceof Error?D.message:"Failed to load accounts"}}async function Jr(){if(!(bt.value||Rt.value)){st.value="",zt.value="",Pt.value="",bt.value=!0;try{const b=await t0();ut.value=b.accounts,fe(),be(),ge({includeSelectedThreadMessages:!0})}catch(b){st.value=b instanceof Error?b.message:"Failed to refresh accounts"}finally{bt.value=!1}}}async function ur(b){if(!(Rt.value||bt.value)){if(Mn.value){st.value="Finish the current turn and pending requests before switching accounts.";return}st.value="",zt.value="",Pt.value="",Rt.value=!0;try{const D=await n0(b);ut.value=ut.value.map(oe=>oe.accountId===b?D:{...oe,isActive:!1}),fe(),be(),ge({includeSelectedThreadMessages:!0}),Yt({silent:!0})}catch(D){st.value=D instanceof Error?D.message:"Failed to switch account"}finally{Rt.value=!1}}}async function Yr(b){if(bt.value||Rt.value||Qe.value.length>0)return;const D=ut.value.find(ze=>ze.accountId===b)??null;if(!D)return;if(Pt.value!==b){Pt.value=b;return}if(D.isActive&&Mn.value){st.value="Finish the current turn and pending requests before removing the active account.";return}const oe=D.isActive;st.value="",Pt.value="",Qe.value=b;try{const ze=await r0(b);ut.value=ze.accounts,fe(),be(),oe&&ge({includeSelectedThreadMessages:!0}),Yt({silent:!0})}catch(ze){st.value=ze instanceof Error?ze.message:"Failed to remove account"}finally{Qe.value=""}}function Qr(b){de(b)}function Fn(b){var ze,at;const D=r.value.find(Ke=>Ke.projectName===b),oe=((at=(ze=D==null?void 0:D.threads[0])==null?void 0:ze.cwd)==null?void 0:at.trim())??"";oe&&(V.value=oe),S.value&&Fe(!0),!$t.value&&T.push({name:"home"})}function gs(b){var ze,at;const D=r.value.find(Ke=>Ke.projectName===b),oe=((at=(ze=D==null?void 0:D.threads[0])==null?void 0:ze.cwd)==null?void 0:at.trim())??"";!oe||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(oe)}`,"_blank","noopener,noreferrer")}function Xr(){var D,oe;const b=((oe=(D=o.value)==null?void 0:D.cwd)==null?void 0:oe.trim())??"";b&&(V.value=b),S.value&&Fe(!0),!$t.value&&T.push({name:"home"})}function Nn(b){pt(b.projectName,b.displayName)}function Sr(b){re(b.threadId,b.title)}async function vs(b){await ct(b),await Er(),dr()}function I(b){We(b.projectName,b.toIndex)}function R(b){se(b.threadId,b.state)}function $(b){Ft(b)}async function ee(b){const D=await Me(b.threadId,b.turnIndex);D&&(await T.push({name:"thread",params:{threadId:D}}),u.value!==D&&await je(D),S.value&&Fe(!0))}function Fe(b){Y.value!==b&&(Y.value=b,me(b))}function yt(b){b.defaultPrevented||!b.ctrlKey&&!b.metaKey||b.shiftKey||b.altKey||b.key.toLowerCase()==="b"&&(b.preventDefault(),Fe(!Y.value))}function Gt(){if(!(typeof document>"u")&&S.value){if(document.visibilityState==="hidden"){Mt.value=Date.now(),Hn.value=!1;return}Kt()}}function fn(b){b.persisted&&Kt()}function Wt(){Kt()}function Kt(){typeof window>"u"||typeof document>"u"||!S.value||document.visibilityState!=="visible"||Hn.value||Mt.value===null||Date.now()-Mt.value<Mx||(Hn.value=!0,Mt.value=null,hn())}async function hn(){if(!un.value){un.value=!0;try{await ge({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await Zi(),await bs()}finally{un.value=!1}}}function Gn(b){const D=b.text;if($t.value){fo(D,b.imageUrls,b.skills,b.fileAttachments);return}Je(D,b.imageUrls,b.skills,b.mode,b.fileAttachments)}function Ir(b){V.value=b.trim()}async function Ds(b){const D=b.trim();if(!D)return;const oe=ws(D),ze=await Zr(),at=oe?D:d(ze,D);if(at)try{const Ke=await Au(at,{createIfMissing:!oe,label:oe?"":D});Ke&&(V.value=Ke,G(er(Ke)),Er(),dr())}catch{}}async function ys(){var D;if(typeof window>"u")return;const b=((D=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:D.trim())??"";if(b)try{const oe=await Au(b,{createIfMissing:!1,label:""});if(!oe)return;V.value=oe,G(er(oe)),await T.replace({name:"home"}),await Er();const ze=new URL(window.location.href);ze.searchParams.delete("openProjectPath"),window.history.replaceState({},"",ze.toString())}catch{}}async function Zr(){const b=js();if(b)return b;try{const D=await Eu();if(D)return ot.value=D,D}catch{}return""}function ws(b){return b?b.startsWith("~/")||b.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(b):!1}async function dr(){const b=js();if(!b){Ve.value="New Project (1)";return}try{const D=await g0(b);Ve.value=D.name||"New Project (1)"}catch{Ve.value="New Project (1)"}}function js(){var oe,ze;const b=V.value.trim();if(b)return Fs(b);const D=((ze=(oe=$e.value[0])==null?void 0:oe.value)==null?void 0:ze.trim())??"";return D?Fs(D):ot.value.trim()}async function uo(){try{ot.value=await Eu()}catch{ot.value=""}}async function Er(){try{const b=await wo();W.value={order:[...b.order],labels:{...b.labels}}}catch{W.value={order:[],labels:{}}}}function Fs(b){const D=b.trim().replace(/\/+$/,"");if(!D)return"";const oe=D.lastIndexOf("/");return oe<=0?"":D.slice(0,oe)}function er(b){const D=b.trim().replace(/\/+$/,"");if(!D)return"";const oe=D.lastIndexOf("/");return oe<0?D:D.slice(oe+1)}function d(b,D){const oe=b.trim().replace(/\/+$/,""),ze=D.trim().replace(/^\/+/,"");return!oe||!ze?"":`${oe}/${ze}`}function m(b){Ue(b)}function h(b){lt(b)}function x(){Ge()}function N(){if($t.value||on.value||typeof document>"u"||!o.value||rn.value.length===0)return;const b=P(),D=ve(),oe=new Blob([b],{type:"text/markdown;charset=utf-8"}),ze=URL.createObjectURL(oe),at=document.createElement("a");at.href=ze,at.download=D,document.body.appendChild(at),at.click(),document.body.removeChild(at),window.setTimeout(()=>URL.revokeObjectURL(ze),0)}function P(){var oe,ze,at;const b=[],D=((ze=(oe=o.value)==null?void 0:oe.title)==null?void 0:ze.trim())||"Untitled thread";b.push(`# ${z(D)}`),b.push(""),b.push(`- Exported: ${new Date().toISOString()}`),b.push(`- Thread ID: ${((at=o.value)==null?void 0:at.id)??""}`),b.push(""),b.push("---"),b.push("");for(const Ke of rn.value){const Le=Ke.role?Ke.role.toUpperCase():"MESSAGE";b.push(`## ${Le}`),b.push("");const Bn=Ke.text.trim();if(Bn&&(b.push(Bn),b.push("")),Ke.commandExecution&&(b.push("```text"),b.push(`command: ${Ke.commandExecution.command}`),b.push(`status: ${Ke.commandExecution.status}`),Ke.commandExecution.cwd&&b.push(`cwd: ${Ke.commandExecution.cwd}`),Ke.commandExecution.exitCode!==null&&b.push(`exitCode: ${Ke.commandExecution.exitCode}`),b.push(Ke.commandExecution.aggregatedOutput||"(no output)"),b.push("```"),b.push("")),Ke.fileAttachments&&Ke.fileAttachments.length>0){b.push("Attachments:");for(const tr of Ke.fileAttachments)b.push(`- ${tr.path}`);b.push("")}if(Ke.images&&Ke.images.length>0){b.push("Images:");for(const tr of Ke.images)b.push(`- ${tr}`);b.push("")}}return`${b.join(`
1454
+ `).trimEnd()}
1455
+ `}function ve(){var at,Ke;const oe=(((Ke=(at=o.value)==null?void 0:at.title)==null?void 0:Ke.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",ze=new Date().toISOString().replace(/[:.]/g,"-");return`${oe}-${ze}.md`}function z(b){return b.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Te(b,D){if(typeof window>"u")return D;const oe=window.localStorage.getItem(b);return oe===null?D:oe==="1"}function Ne(){if(typeof window>"u")return"system";const b=window.localStorage.getItem(hd);return b==="light"||b==="dark"?b:"system"}function c(){return typeof window>"u"?"queue":window.localStorage.getItem(fd)==="steer"?"steer":"queue"}function p(){_t.value=!_t.value,window.localStorage.setItem(dd,_t.value?"1":"0")}function w(){vt.value=vt.value==="steer"?"queue":"steer",window.localStorage.setItem(fd,vt.value)}function C(){const b=["system","light","dark"],D=b.indexOf(Jt.value);Jt.value=b[(D+1)%b.length],window.localStorage.setItem(hd,Jt.value),q()}function F(){kt.value=!kt.value,window.localStorage.setItem(pd,kt.value?"1":"0")}function q(){const b=document.documentElement;if(Jt.value==="dark")b.classList.add("dark");else if(Jt.value==="light")b.classList.remove("dark");else{const D=window.matchMedia("(prefers-color-scheme: dark)").matches;b.classList.toggle("dark",D)}}function ie(){return typeof window>"u"?!1:window.localStorage.getItem(ud)==="1"}function me(b){typeof window>"u"||window.localStorage.setItem(ud,b?"1":"0")}function le(b,D){const oe=(b??"").trim();return oe.length>0?oe:D.trim()||"message"}function et(b){Ce(b)}async function Ot(){await T.isReady(),Ee.name==="thread"&&It.value&&Ae(It.value),be(),await ge({includeSelectedThreadMessages:!0}),Yt({silent:!0}),await Zi(),X.value=!0,await bs()}function Ut(){if(typeof window>"u")return null;try{const b=window.localStorage.getItem(Da);if(!b)return null;const D=JSON.parse(b);return!D||D.routeName!=="thread"||typeof D.threadId!="string"||D.threadId.trim().length===0||typeof D.updatedAtIso!="string"||D.updatedAtIso.trim().length===0?null:{routeName:"thread",threadId:D.threadId.trim(),updatedAtIso:D.updatedAtIso}}catch{return null}}function Tn(b){if(typeof window>"u")return;const D=b.trim();if(!D)return;const oe={routeName:"thread",threadId:D,updatedAtIso:new Date().toISOString()};window.localStorage.setItem(Da,JSON.stringify(oe))}function Cr(){typeof window>"u"||window.localStorage.removeItem(Da)}async function Zi(){if(Ee.name!=="home")return!1;const b=Ut(),D=u.value.trim(),oe=(b==null?void 0:b.threadId)??D;return oe?Rn.value.has(oe)?(await T.replace({name:"thread",params:{threadId:oe}}),!0):((b==null?void 0:b.threadId)===oe&&Cr(),!1):!1}async function bs(){if(!O.value){O.value=!0;try{if(Ee.name==="home"||Ee.name==="skills"){u.value!==""&&await je("");return}if(Ee.name==="thread"){const b=It.value;if(!b)return;if(!Rn.value.has(b)){await T.replace({name:"home"});return}u.value!==b?await je(b):ue(b,{silent:!0});return}}finally{O.value=!1}}}ft(()=>[Ee.name,It.value,u.value,X.value],([b,D,oe,ze])=>{if(!ze||b!=="thread")return;const at=(D||oe).trim();at&&Rn.value.has(at)&&Tn(at)}),ft(()=>[Ee.name,It.value,K.value,Rn.value.has(It.value),u.value],async()=>{X.value&&await bs()}),ft(()=>u.value,async b=>{if(X.value&&!O.value&&!($t.value||on.value)){if(!b){Ee.name!=="home"&&await T.replace({name:"home"});return}Ee.name==="thread"&&It.value===b||await T.replace({name:"thread",params:{threadId:b}})}}),ft(()=>[X.value,Ee.name,u.value],([b,D,oe])=>{b&&D==="thread"&&oe&&ue(oe,{silent:!0})}),ft(()=>$e.value,b=>{if(b.length===0){V.value="";return}b.some(oe=>oe.value===V.value)||(V.value=b[0].value),dr()},{immediate:!0}),ft(()=>V.value,()=>{H.value={phase:"idle",title:"",message:""},dr()}),ft(()=>L.value,b=>{b==="local"&&(H.value={phase:"idle",title:"",message:""})}),ft(()=>Ee.name,b=>{b!=="home"&&(H.value={phase:"idle",title:"",message:""})}),ft(()=>u.value,()=>{H.value={phase:"idle",title:"",message:""}}),ft(S,b=>{b&&!Y.value&&Fe(!0)});async function fo(b,D=[],oe=[],ze=[]){try{H.value={phase:"idle",title:"",message:""};let at=V.value;if(L.value==="worktree"){H.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Le=await m0(V.value);at=Le.cwd,V.value=Le.cwd,H.value={phase:"idle",title:"",message:""}}catch{H.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const Ke=await qe(b,at,D,oe,ze);if(!Ke)return;await T.replace({name:"thread",params:{threadId:Ke}})}catch{}}return(b,D)=>(y(),k(De,null,[Be(Uv,{"is-sidebar-collapsed":Y.value,onCloseSidebar:D[6]||(D[6]=oe=>Fe(!0))},{sidebar:Et(()=>[v("section",QA,[v("div",XA,[Y.value?pe("",!0):(y(),wt(id,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Y.value,"show-new-thread-button":!0,onToggleSidebar:D[0]||(D[0]=oe=>Fe(!Y.value)),onStartNewThread:Xr},{default:Et(()=>[v("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":Ie.value,"aria-label":"Search threads",title:"Search threads",onClick:qt},[Be(il,{class:"sidebar-search-toggle-icon"})],8,ZA)]),_:1},8,["is-sidebar-collapsed"])),!Y.value&&Ie.value?(y(),k("div",ex,[Be(il,{class:"sidebar-search-bar-icon"}),Hr(v("input",{ref_key:"sidebarSearchInputRef",ref:_e,"onUpdate:modelValue":D[1]||(D[1]=oe=>Q.value=oe),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:Wn},null,544),[[Wr,Q.value]]),Q.value.length>0?(y(),k("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Zn},[Be(Wl,{class:"sidebar-search-clear-icon"})])):pe("",!0)])):pe("",!0),Y.value?pe("",!0):(y(),k("button",{key:2,class:tt(["sidebar-skills-link",{"is-active":on.value}]),type:"button",onClick:D[2]||(D[2]=oe=>{we(T).push({name:"skills"}),we(S)&&Fe(!0)})}," Skills Hub ",2)),Y.value?pe("",!0):(y(),wt(Ew,{key:3,groups:we(r),"project-display-name-by-id":we(s),"selected-thread-id":we(u),"is-loading":we(K),"search-query":Q.value,"search-matched-thread-ids":Se.value,onSelect:Dn,onArchive:Qr,onStartNewThread:Fn,onRenameProject:Nn,onBrowseProjectFiles:gs,onRenameThread:Sr,onRemoveProject:vs,onReorderProject:I,onExportThread:Vn},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),Y.value?pe("",!0):(y(),k("div",tx,[Be(Pf,{name:"settings-panel"},{default:Et(()=>[Ze.value?(y(),k("div",nx,[v("div",rx,[v("div",sx,[v("div",ox,[D[7]||(D[7]=v("span",{class:"sidebar-settings-account-title"},"Accounts",-1)),v("span",ix,J(ut.value.length),1)]),v("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:bt.value||Rt.value,onClick:Jr},J(bt.value?"Reloading…":"Reload"),9,ax)]),st.value?(y(),k("p",lx,J(st.value),1)):pe("",!0),ut.value.length===0?(y(),k("p",cx," Run `codex login`, then click reload. ")):(y(),k("div",ux,[(y(!0),k(De,null,mt(ut.value,oe=>(y(),k("article",{key:oe.accountId,class:tt(["sidebar-settings-account-item",{"is-active":oe.isActive,"is-unavailable":$n(oe),"is-confirming-remove":A(oe),"is-remove-visible":U(oe)}]),title:jn(oe),onMouseenter:ze=>it(oe.accountId),onMouseleave:ze=>ht(oe.accountId)},[v("div",fx,[v("p",hx,J(oe.email||"Account"),1),v("p",px,J(kn(oe)),1),v("p",mx,J(jt(oe)),1),v("p",gx," Workspace "+J(zn(oe.accountId)),1)]),v("div",vx,[v("button",{class:"sidebar-settings-account-switch",type:"button",disabled:On(oe)||oe.isActive||$n(oe),onClick:ze=>ur(oe.accountId)},J(ae(oe)),9,yx),v("button",{class:tt(["sidebar-settings-account-remove",{"is-visible":U(oe),"is-confirming":A(oe)}]),type:"button",disabled:On(oe),onClick:ze=>Yr(oe.accountId)},J(Oe(oe)),11,wx)])],42,dx))),128))]))]),v("button",{class:"sidebar-settings-row",type:"button",onClick:p},[D[8]||(D[8]=v("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),v("span",{class:tt(["sidebar-settings-toggle",{"is-on":!_t.value}])},null,2)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:w},[D[9]||(D[9]=v("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),v("span",bx,J(vt.value==="steer"?"Steer":"Queue"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:C},[D[10]||(D[10]=v("span",{class:"sidebar-settings-label"},"Appearance",-1)),v("span",_x,J(Jt.value==="system"?"System":Jt.value==="dark"?"Dark":"Light"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:F},[D[11]||(D[11]=v("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),v("span",{class:tt(["sidebar-settings-toggle",{"is-on":kt.value}])},null,2)])])):pe("",!0)]),_:1}),v("button",{class:"sidebar-settings-button",type:"button",onClick:D[3]||(D[3]=oe=>Ze.value=!Ze.value)},[Be(bA,{class:"sidebar-settings-icon"}),D[12]||(D[12]=v("span",null,"Settings",-1))])]))])]),content:Et(()=>[v("section",kx,[Be(Mw,{title:nn.value},{leading:Et(()=>[Y.value||we(S)?(y(),wt(id,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Y.value,"show-new-thread-button":!0,onToggleSidebar:D[4]||(D[4]=oe=>Fe(!Y.value)),onStartNewThread:Xr},null,8,["is-sidebar-collapsed"])):pe("",!0)]),_:1},8,["title"]),v("section",Tx,[on.value?(y(),wt(oA,{key:0,onSkillsChanged:_n})):$t.value?(y(),k("div",Sx,[v("div",Ix,[D[13]||(D[13]=v("p",{class:"new-thread-hero"},"Let's build",-1)),Be(ol,{class:"new-thread-folder-dropdown","model-value":V.value,options:$e.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":Ve.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":Ir,onAdd:Ds},null,8,["model-value","options","default-add-value"]),Be(dS,{class:"new-thread-runtime-dropdown",modelValue:L.value,"onUpdate:modelValue":D[5]||(D[5]=oe=>L.value=oe)},null,8,["modelValue"]),H.value.phase!=="idle"?(y(),k("div",{key:0,class:tt(["worktree-init-status",{"is-running":H.value.phase==="running","is-error":H.value.phase==="error"}])},[v("strong",Ex,J(H.value.title),1),v("span",Cx,J(H.value.message),1)],2)):pe("",!0)]),Be(Pu,{"active-thread-id":dn.value,cwd:Xn.value,"collaboration-modes":we(g),"selected-collaboration-mode":we(E),models:we(_),"selected-model":we(B),"selected-reasoning-effort":we(M),skills:we(Z),"codex-quota":we(f),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":_t.value,"in-progress-submit-mode":vt.value,"dictation-click-to-toggle":kt.value,onSubmit:Gn,"onUpdate:selectedCollaborationMode":et,"onUpdate:selectedModel":m,"onUpdate:selectedReasoningEffort":h},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"])])):(y(),k("div",Ax,[v("div",xx,[Be(vk,{messages:rn.value,"is-loading":we(te),"active-thread-id":dn.value,cwd:Xn.value,"scroll-state":we(i),"live-overlay":bn.value,"pending-requests":we(a),onUpdateScrollState:R,onForkThread:ee,onRespondServerRequest:$},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests"])]),v("div",Rx,[Be(rS,{messages:we(He),onSteer:we(rt),onDelete:we(Pe)},null,8,["messages","onSteer","onDelete"]),Be(Pu,{"active-thread-id":dn.value,cwd:Xn.value,"collaboration-modes":we(g),"selected-collaboration-mode":we(E),models:we(_),"selected-model":we(B),"selected-reasoning-effort":we(M),skills:we(Z),"codex-quota":we(f),"is-turn-in-progress":Pn.value,"is-interrupting-turn":we(ke),"has-queue-above":we(He).length>0,"send-with-enter":_t.value,"in-progress-submit-mode":vt.value,"dictation-click-to-toggle":kt.value,"onUpdate:selectedCollaborationMode":et,onSubmit:Gn,"onUpdate:selectedModel":m,"onUpdate:selectedReasoningEffort":h,onInterrupt:x},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"]),v("div",Px," nervmor "+J(we(t))+" · v"+J(we(n)),1)],64))}}),Ox=gt($x,[["__scopeId","data-v-ad4e9a4f"]]),ja={render:()=>null},Nx=$v({history:dv(),routes:[{path:"/",name:"home",component:ja},{path:"/thread/:threadId",name:"thread",component:ja},{path:"/skills",name:"skills",component:ja},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. npm: https://www.npmjs.com/package/@nervmor/codexui");Sg(Ox).use(Nx).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error("Service worker registration failed.",e)})});