@nervmor/codexui 1.0.7 → 1.0.8

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 kl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const Dt={},Ks=[],kr=()=>{},yd=()=>!1,Li=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Tl=e=>e.startsWith("onUpdate:"),nn=Object.assign,Sl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},tp=Object.prototype.hasOwnProperty,Rt=(e,t)=>tp.call(e,t),Ke=Array.isArray,Js=e=>Ko(e)==="[object Map]",wd=e=>Ko(e)==="[object Set]",cc=e=>Ko(e)==="[object Date]",st=e=>typeof e=="function",qt=e=>typeof e=="string",cr=e=>typeof e=="symbol",Pt=e=>e!==null&&typeof e=="object",bd=e=>(Pt(e)||st(e))&&st(e.then)&&st(e.catch),_d=Object.prototype.toString,Ko=e=>_d.call(e),np=e=>Ko(e).slice(8,-1),kd=e=>Ko(e)==="[object Object]",Il=e=>qt(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,ko=kl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Di=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},rp=/-\w/g,xn=Di(e=>e.replace(rp,t=>t.slice(1).toUpperCase())),sp=/\B([A-Z])/g,ps=Di(e=>e.replace(sp,"-$1").toLowerCase()),ji=Di(e=>e.charAt(0).toUpperCase()+e.slice(1)),na=Di(e=>e?`on${ji(e)}`:""),yr=(e,t)=>!Object.is(e,t),fi=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Td=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},El=e=>{const t=parseFloat(e);return isNaN(t)?e:t},op=e=>{const t=qt(e)?Number(e):NaN;return isNaN(t)?e:t};let uc;const Fi=()=>uc||(uc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function us(e){if(Ke(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=qt(r)?cp(r):us(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(qt(e)||Pt(e))return e}const ip=/;(?![^(]*\))/g,ap=/:([^]+)/,lp=/\/\*[^]*?\*\//g;function cp(e){const t={};return e.replace(lp,"").split(ip).forEach(n=>{if(n){const r=n.split(ap);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function rt(e){let t="";if(qt(e))t=e;else if(Ke(e))for(let n=0;n<e.length;n++){const r=rt(e[n]);r&&(t+=r+" ")}else if(Pt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const up="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",dp=kl(up);function Sd(e){return!!e||e===""}function fp(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Cl(e[r],t[r]);return n}function Cl(e,t){if(e===t)return!0;let n=cc(e),r=cc(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=cr(e),r=cr(t),n||r)return e===t;if(n=Ke(e),r=Ke(t),n||r)return n&&r?fp(e,t):!1;if(n=Pt(e),r=Pt(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||!Cl(e[i],t[i]))return!1}}return String(e)===String(t)}const Id=e=>!!(e&&e.__v_isRef===!0),Y=e=>qt(e)?e:e==null?"":Ke(e)||Pt(e)&&(e.toString===_d||!st(e.toString))?Id(e)?Y(e.value):JSON.stringify(e,Ed,2):String(e),Ed=(e,t)=>Id(t)?Ed(e,t.value):Js(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ra(r,o)+" =>"]=s,n),{})}:wd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ra(n))}:cr(t)?ra(t):Pt(t)&&!Ke(t)&&!kd(t)?String(t):t,ra=(e,t="")=>{var n;return cr(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 hp{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 pp(){return Ln}let Ft;const sa=new WeakSet;class Cd{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,sa.has(this)&&(sa.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||xd(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,dc(this),Rd(this);const t=Ft,n=ir;Ft=this,ir=!0;try{return this.fn()}finally{Pd(this),Ft=t,ir=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)Rl(t);this.deps=this.depsTail=void 0,dc(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?sa.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ua(this)&&this.run()}get dirty(){return Ua(this)}}let Ad=0,To,So;function xd(e,t=!1){if(e.flags|=8,t){e.next=So,So=e;return}e.next=To,To=e}function Al(){Ad++}function xl(){if(--Ad>0)return;if(So){let t=So;for(So=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;To;){let t=To;for(To=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 Rd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Pd(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),Rl(r),mp(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Ua(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Md(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Md(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Oo)||(e.globalVersion=Oo,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ua(e))))return;e.flags|=2;const t=e.dep,n=Ft,r=ir;Ft=e,ir=!0;try{Rd(e);const s=e.fn(e._value);(t.version===0||yr(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Ft=n,ir=r,Pd(e),e.flags&=-3}}function Rl(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)Rl(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function mp(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let ir=!0;const $d=[];function Br(){$d.push(ir),ir=!1}function Ur(){const e=$d.pop();ir=e===void 0?!0:e}function dc(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ft;Ft=void 0;try{t()}finally{Ft=n}}}let Oo=0;class gp{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 Pl{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(!Ft||!ir||Ft===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Ft)n=this.activeLink=new gp(Ft,this),Ft.deps?(n.prevDep=Ft.depsTail,Ft.depsTail.nextDep=n,Ft.depsTail=n):Ft.deps=Ft.depsTail=n,Od(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=Ft.depsTail,n.nextDep=void 0,Ft.depsTail.nextDep=n,Ft.depsTail=n,Ft.deps===n&&(Ft.deps=r)}return n}trigger(t){this.version++,Oo++,this.notify(t)}notify(t){Al();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{xl()}}}function Od(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)Od(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Ha=new WeakMap,Os=Symbol(""),Wa=Symbol(""),No=Symbol("");function gn(e,t,n){if(ir&&Ft){let r=Ha.get(e);r||Ha.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new Pl),s.map=r,s.key=n),s.track()}}function Nr(e,t,n,r,s,o){const i=Ha.get(e);if(!i){Oo++;return}const a=l=>{l&&l.trigger()};if(Al(),t==="clear")i.forEach(a);else{const l=Ke(e),f=l&&Il(n);if(l&&n==="length"){const u=Number(r);i.forEach((g,_)=>{(_==="length"||_===No||!cr(_)&&_>=u)&&a(g)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),f&&a(i.get(No)),t){case"add":l?f&&a(i.get("length")):(a(i.get(Os)),Js(e)&&a(i.get(Wa)));break;case"delete":l||(a(i.get(Os)),Js(e)&&a(i.get(Wa)));break;case"set":Js(e)&&a(i.get(Os));break}}xl()}function Us(e){const t=Et(e);return t===e?t:(gn(t,"iterate",No),Xn(e)?t:t.map(ur))}function Bi(e){return gn(e=Et(e),"iterate",No),e}function gr(e,t){return Hr(e)?ro(Ns(e)?ur(t):t):ur(t)}const vp={__proto__:null,[Symbol.iterator](){return oa(this,Symbol.iterator,e=>gr(this,e))},concat(...e){return Us(this).concat(...e.map(t=>Ke(t)?Us(t):t))},entries(){return oa(this,"entries",e=>(e[1]=gr(this,e[1]),e))},every(e,t){return xr(this,"every",e,t,void 0,arguments)},filter(e,t){return xr(this,"filter",e,t,n=>n.map(r=>gr(this,r)),arguments)},find(e,t){return xr(this,"find",e,t,n=>gr(this,n),arguments)},findIndex(e,t){return xr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return xr(this,"findLast",e,t,n=>gr(this,n),arguments)},findLastIndex(e,t){return xr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return xr(this,"forEach",e,t,void 0,arguments)},includes(...e){return ia(this,"includes",e)},indexOf(...e){return ia(this,"indexOf",e)},join(e){return Us(this).join(e)},lastIndexOf(...e){return ia(this,"lastIndexOf",e)},map(e,t){return xr(this,"map",e,t,void 0,arguments)},pop(){return mo(this,"pop")},push(...e){return mo(this,"push",e)},reduce(e,...t){return fc(this,"reduce",e,t)},reduceRight(e,...t){return fc(this,"reduceRight",e,t)},shift(){return mo(this,"shift")},some(e,t){return xr(this,"some",e,t,void 0,arguments)},splice(...e){return mo(this,"splice",e)},toReversed(){return Us(this).toReversed()},toSorted(e){return Us(this).toSorted(e)},toSpliced(...e){return Us(this).toSpliced(...e)},unshift(...e){return mo(this,"unshift",e)},values(){return oa(this,"values",e=>gr(this,e))}};function oa(e,t,n){const r=Bi(e),s=r[t]();return r!==e&&!Xn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const yp=Array.prototype;function xr(e,t,n,r,s,o){const i=Bi(e),a=i!==e&&!Xn(e),l=i[t];if(l!==yp[t]){const g=l.apply(e,o);return a?ur(g):g}let f=n;i!==e&&(a?f=function(g,_){return n.call(this,gr(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 fc(e,t,n,r){const s=Bi(e),o=s!==e&&!Xn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(f,u,g){return a&&(a=!1,f=gr(e,f)),n.call(this,f,gr(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?gr(e,l):l}function ia(e,t,n){const r=Et(e);gn(r,"iterate",No);const s=r[t](...n);return(s===-1||s===!1)&&Ol(n[0])?(n[0]=Et(n[0]),r[t](...n)):s}function mo(e,t,n=[]){Br(),Al();const r=Et(e)[t].apply(e,n);return xl(),Ur(),r}const wp=kl("__proto__,__v_isRef,__isVue"),Nd=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(cr));function bp(e){cr(e)||(e=String(e));const t=Et(this);return gn(t,"has",e),t.hasOwnProperty(e)}class Ld{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?Rp:Bd:o?Fd:jd).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Ke(t);if(!s){let l;if(i&&(l=vp[n]))return l;if(n==="hasOwnProperty")return bp}const a=Reflect.get(t,n,wn(t)?t:r);if((cr(n)?Nd.has(n):wp(n))||(s||gn(t,"get",n),o))return a;if(wn(a)){const l=i&&Il(n)?a:a.value;return s&&Pt(l)?za(l):l}return Pt(a)?s?za(a):Ui(a):a}}class Dd extends Ld{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Ke(t)&&Il(n);if(!this._isShallow){const f=Hr(o);if(!Xn(r)&&!Hr(r)&&(o=Et(o),r=Et(r)),!i&&wn(o)&&!wn(r))return f||(o.value=r),!0}const a=i?Number(n)<t.length:Rt(t,n),l=Reflect.set(t,n,r,wn(t)?t:s);return t===Et(s)&&(a?yr(r,o)&&Nr(t,"set",n,r):Nr(t,"add",n,r)),l}deleteProperty(t,n){const r=Rt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&Nr(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!cr(n)||!Nd.has(n))&&gn(t,"has",n),r}ownKeys(t){return gn(t,"iterate",Ke(t)?"length":Os),Reflect.ownKeys(t)}}class _p extends Ld{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const kp=new Dd,Tp=new _p,Sp=new Dd(!0);const Va=e=>e,ri=e=>Reflect.getPrototypeOf(e);function Ip(e,t,n){return function(...r){const s=this.__v_raw,o=Et(s),i=Js(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,f=s[e](...r),u=n?Va:t?ro:ur;return!t&&gn(o,"iterate",l?Wa:Os),nn(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 si(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function Ep(e,t){const n={get(s){const o=this.__v_raw,i=Et(o),a=Et(s);e||(yr(s,a)&&gn(i,"get",s),gn(i,"get",a));const{has:l}=ri(i),f=t?Va:e?ro:ur;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(Et(s),"iterate",Os),s.size},has(s){const o=this.__v_raw,i=Et(o),a=Et(s);return e||(yr(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=Et(a),f=t?Va:e?ro:ur;return!e&&gn(l,"iterate",Os),a.forEach((u,g)=>s.call(o,f(u),f(g),i))}};return nn(n,e?{add:si("add"),set:si("set"),delete:si("delete"),clear:si("clear")}:{add(s){const o=Et(this),i=ri(o),a=Et(s),l=!t&&!Xn(s)&&!Hr(s)?a:s;return i.has.call(o,l)||yr(s,l)&&i.has.call(o,s)||yr(a,l)&&i.has.call(o,a)||(o.add(l),Nr(o,"add",l,l)),this},set(s,o){!t&&!Xn(o)&&!Hr(o)&&(o=Et(o));const i=Et(this),{has:a,get:l}=ri(i);let f=a.call(i,s);f||(s=Et(s),f=a.call(i,s));const u=l.call(i,s);return i.set(s,o),f?yr(o,u)&&Nr(i,"set",s,o):Nr(i,"add",s,o),this},delete(s){const o=Et(this),{has:i,get:a}=ri(o);let l=i.call(o,s);l||(s=Et(s),l=i.call(o,s)),a&&a.call(o,s);const f=o.delete(s);return l&&Nr(o,"delete",s,void 0),f},clear(){const s=Et(this),o=s.size!==0,i=s.clear();return o&&Nr(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Ip(s,e,t)}),n}function Ml(e,t){const n=Ep(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(Rt(n,s)&&s in r?n:r,s,o)}const Cp={get:Ml(!1,!1)},Ap={get:Ml(!1,!0)},xp={get:Ml(!0,!1)};const jd=new WeakMap,Fd=new WeakMap,Bd=new WeakMap,Rp=new WeakMap;function Pp(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Mp(e){return e.__v_skip||!Object.isExtensible(e)?0:Pp(np(e))}function Ui(e){return Hr(e)?e:$l(e,!1,kp,Cp,jd)}function Ud(e){return $l(e,!1,Sp,Ap,Fd)}function za(e){return $l(e,!0,Tp,xp,Bd)}function $l(e,t,n,r,s){if(!Pt(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const o=Mp(e);if(o===0)return e;const i=s.get(e);if(i)return i;const a=new Proxy(e,o===2?r:n);return s.set(e,a),a}function Ns(e){return Hr(e)?Ns(e.__v_raw):!!(e&&e.__v_isReactive)}function Hr(e){return!!(e&&e.__v_isReadonly)}function Xn(e){return!!(e&&e.__v_isShallow)}function Ol(e){return e?!!e.__v_raw:!1}function Et(e){const t=e&&e.__v_raw;return t?Et(t):e}function $p(e){return!Rt(e,"__v_skip")&&Object.isExtensible(e)&&Td(e,"__v_skip",!0),e}const ur=e=>Pt(e)?Ui(e):e,ro=e=>Pt(e)?za(e):e;function wn(e){return e?e.__v_isRef===!0:!1}function j(e){return Hd(e,!1)}function Op(e){return Hd(e,!0)}function Hd(e,t){return wn(e)?e:new Np(e,t)}class Np{constructor(t,n){this.dep=new Pl,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Et(t),this._value=n?t:ur(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||Xn(t)||Hr(t);t=r?t:Et(t),yr(t,n)&&(this._rawValue=t,this._value=r?t:ur(t),this.dep.trigger())}}function _e(e){return wn(e)?e.value:e}const Lp={get:(e,t,n)=>t==="__v_raw"?e:_e(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 Wd(e){return Ns(e)?e:new Proxy(e,Lp)}class Dp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Pl(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Oo-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Ft!==this)return xd(this,!0),!0}get value(){const t=this.dep.track();return Md(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function jp(e,t,n=!1){let r,s;return st(e)?r=e:(r=e.get,s=e.set),new Dp(r,s,n)}const oi={},_i=new WeakMap;let As;function Fp(e,t=!1,n=As){if(n){let r=_i.get(n);r||_i.set(n,r=[]),r.push(e)}}function Bp(e,t,n=Dt){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,f=re=>s?re:Xn(re)||s===!1||s===0?Lr(re,1):Lr(re);let u,g,_,E,U=!1,$=!1;if(wn(e)?(g=()=>e.value,U=Xn(e)):Ns(e)?(g=()=>f(e),U=!0):Ke(e)?($=!0,U=e.some(re=>Ns(re)||Xn(re)),g=()=>e.map(re=>{if(wn(re))return re.value;if(Ns(re))return f(re);if(st(re))return l?l(re,2):re()})):st(e)?t?g=l?()=>l(e,2):e:g=()=>{if(_){Br();try{_()}finally{Ur()}}const re=As;As=u;try{return l?l(e,3,[E]):e(E)}finally{As=re}}:g=kr,t&&s){const re=g,we=s===!0?1/0:s;g=()=>Lr(re(),we)}const X=pp(),ce=()=>{u.stop(),X&&X.active&&Sl(X.effects,u)};if(o&&t){const re=t;t=(...we)=>{re(...we),ce()}}let K=$?new Array(e.length).fill(oi):oi;const ee=re=>{if(!(!(u.flags&1)||!u.dirty&&!re))if(t){const we=u.run();if(s||U||($?we.some((Te,me)=>yr(Te,K[me])):yr(we,K))){_&&_();const Te=As;As=u;try{const me=[we,K===oi?void 0:$&&K[0]===oi?[]:K,E];K=we,l?l(t,3,me):t(...me)}finally{As=Te}}}else u.run()};return a&&a(ee),u=new Cd(g),u.scheduler=i?()=>i(ee,!1):ee,E=re=>Fp(re,!1,u),_=u.onStop=()=>{const re=_i.get(u);if(re){if(l)l(re,4);else for(const we of re)we();_i.delete(u)}},t?r?ee(!0):K=u.run():i?i(ee.bind(null,!0),!0):u.run(),ce.pause=u.pause.bind(u),ce.resume=u.resume.bind(u),ce.stop=ce,ce}function Lr(e,t=1/0,n){if(t<=0||!Pt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,wn(e))Lr(e.value,t,n);else if(Ke(e))for(let r=0;r<e.length;r++)Lr(e[r],t,n);else if(wd(e)||Js(e))e.forEach(r=>{Lr(r,t,n)});else if(kd(e)){for(const r in e)Lr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Lr(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 Jo(e,t,n,r){try{return r?e(...r):e()}catch(s){Hi(s,t,n)}}function dr(e,t,n,r){if(st(e)){const s=Jo(e,t,n,r);return s&&bd(s)&&s.catch(o=>{Hi(o,t,n)}),s}if(Ke(e)){const s=[];for(let o=0;o<e.length;o++)s.push(dr(e[o],t,n,r));return s}}function Hi(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||Dt;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){Br(),Jo(o,null,10,[e,l,f]),Ur();return}}Up(e,n,s,r,i)}function Up(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const Cn=[];let pr=-1;const Ys=[];let os=null,zs=0;const Vd=Promise.resolve();let ki=null;function Zt(e){const t=ki||Vd;return e?t.then(this?e.bind(this):e):t}function Hp(e){let t=pr+1,n=Cn.length;for(;t<n;){const r=t+n>>>1,s=Cn[r],o=Lo(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Nl(e){if(!(e.flags&1)){const t=Lo(e),n=Cn[Cn.length-1];!n||!(e.flags&2)&&t>=Lo(n)?Cn.push(e):Cn.splice(Hp(t),0,e),e.flags|=1,zd()}}function zd(){ki||(ki=Vd.then(Gd))}function Wp(e){Ke(e)?Ys.push(...e):os&&e.id===-1?os.splice(zs+1,0,e):e.flags&1||(Ys.push(e),e.flags|=1),zd()}function hc(e,t,n=pr+1){for(;n<Cn.length;n++){const r=Cn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Cn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function qd(e){if(Ys.length){const t=[...new Set(Ys)].sort((n,r)=>Lo(n)-Lo(r));if(Ys.length=0,os){os.push(...t);return}for(os=t,zs=0;zs<os.length;zs++){const n=os[zs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}os=null,zs=0}}const Lo=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Gd(e){try{for(pr=0;pr<Cn.length;pr++){const t=Cn[pr];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Jo(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;pr<Cn.length;pr++){const t=Cn[pr];t&&(t.flags&=-2)}pr=-1,Cn.length=0,qd(),ki=null,(Cn.length||Ys.length)&&Gd()}}let cn=null,Kd=null;function Ti(e){const t=cn;return cn=e,Kd=e&&e.type.__scopeId||null,t}function At(e,t=cn,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&Ci(-1);const o=Ti(t);let i;try{i=e(...s)}finally{Ti(o),r._d&&Ci(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Wr(e,t){if(cn===null)return e;const n=Ki(cn),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=Dt]=t[s];o&&(st(o)&&(o={mounted:o,updated:o}),o.deep&&Lr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function Ts(e,t,n,r){const s=e.dirs,o=t&&t.dirs;for(let i=0;i<s.length;i++){const a=s[i];o&&(a.oldValue=o[i].value);let l=a.dir[r];l&&(Br(),dr(l,n,8,[e.el,a,e,t]),Ur())}}function hi(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 ar(e,t,n=!1){const r=Bl();if(r||Xs){let s=Xs?Xs._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&&st(t)?t.call(r&&r.proxy):t}}const Vp=Symbol.for("v-scx"),zp=()=>ar(Vp);function pt(e,t,n){return Jd(e,t,n)}function Jd(e,t,n=Dt){const{immediate:r,deep:s,flush:o,once:i}=n,a=nn({},n),l=t&&r||!t&&o!=="post";let f;if(Uo){if(o==="sync"){const E=zp();f=E.__watcherHandles||(E.__watcherHandles=[])}else if(!l){const E=()=>{};return E.stop=kr,E.resume=kr,E.pause=kr,E}}const u=yn;a.call=(E,U,$)=>dr(E,u,U,$);let g=!1;o==="post"?a.scheduler=E=>{mn(E,u&&u.suspense)}:o!=="sync"&&(g=!0,a.scheduler=(E,U)=>{U?E():Nl(E)}),a.augmentJob=E=>{t&&(E.flags|=4),g&&(E.flags|=2,u&&(E.id=u.uid,E.i=u))};const _=Bp(e,t,a);return Uo&&(f?f.push(_):l&&_()),_}function qp(e,t,n){const r=this.proxy,s=qt(e)?e.includes(".")?Yd(r,e):()=>r[e]:e.bind(r,r);let o;st(t)?o=t:(o=t.handler,n=t);const i=Yo(this),a=Jd(s,o.bind(r),n);return i(),a}function Yd(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 Qd=Symbol("_vte"),Xd=e=>e.__isTeleport,Io=e=>e&&(e.disabled||e.disabled===""),pc=e=>e&&(e.defer||e.defer===""),mc=e=>typeof SVGElement<"u"&&e instanceof SVGElement,gc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,qa=(e,t)=>{const n=e&&e.to;return qt(n)?t?t(n):null:n},Zd={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:U,createText:$,createComment:X}}=f,ce=Io(t.props);let{shapeFlag:K,children:ee,dynamicChildren:re}=t;if(e==null){const we=t.el=$(""),Te=t.anchor=$("");E(we,n,r),E(Te,n,r);const me=(ae,se)=>{K&16&&u(ee,ae,se,s,o,i,a,l)},Me=()=>{const ae=t.target=qa(t.props,U),se=Ga(ae,t,$,E);ae&&(i!=="svg"&&mc(ae)?i="svg":i!=="mathml"&&gc(ae)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(ae),ce||(me(ae,se),pi(t,!1)))};ce&&(me(n,Te),pi(t,!0)),pc(t.props)?(t.el.__isMounted=!1,mn(()=>{Me(),delete t.el.__isMounted},o)):Me()}else{if(pc(t.props)&&e.el.__isMounted===!1){mn(()=>{Zd.process(e,t,n,r,s,o,i,a,l,f)},o);return}t.el=e.el,t.targetStart=e.targetStart;const we=t.anchor=e.anchor,Te=t.target=e.target,me=t.targetAnchor=e.targetAnchor,Me=Io(e.props),ae=Me?n:Te,se=Me?we:me;if(i==="svg"||mc(Te)?i="svg":(i==="mathml"||gc(Te))&&(i="mathml"),re?(_(e.dynamicChildren,re,ae,s,o,i,a),jl(e,t,!0)):l||g(e,t,ae,se,s,o,i,a,!1),ce)Me?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ii(t,n,we,f,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const ue=t.target=qa(t.props,U);ue&&ii(t,ue,null,f,0)}else Me&&ii(t,Te,me,f,1);pi(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||!Io(_);for(let U=0;U<a.length;U++){const $=a[U];r($,t,n,E,!!$.dynamicChildren)}}},move:ii,hydrate:Gp};function ii(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||Io(u))&&l&16)for(let _=0;_<f.length;_++)s(f[_],t,n,2);g&&r(a,t,n)}function Gp(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:f,createText:u}},g){function _(X,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,X._lpa=t.targetAnchor&&i(t.targetAnchor);break}}K=i(K)}}function E(X,ce){ce.anchor=g(i(X),ce,a(X),n,r,s,o)}const U=t.target=qa(t.props,l),$=Io(t.props);if(U){const X=U._lpa||U.firstChild;t.shapeFlag&16&&($?(E(e,t),_(U,X),t.targetAnchor||Ga(U,t,u,f,a(e)===U?e:null)):(t.anchor=i(e),_(U,X),t.targetAnchor||Ga(U,t,u,f),g(X&&i(X),t,U,n,r,s,o))),pi(t,$)}else $&&t.shapeFlag&16&&(E(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const Eo=Zd;function pi(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 Ga(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[Qd]=i,e&&(r(o,e,s),r(i,e,s)),i}const mr=Symbol("_leaveCb"),go=Symbol("_enterCb");function Kp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Kr(()=>{e.isMounted=!0}),Jr(()=>{e.isUnmounting=!0}),e}const Yn=[Function,Array],ef={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Yn,onEnter:Yn,onAfterEnter:Yn,onEnterCancelled:Yn,onBeforeLeave:Yn,onLeave:Yn,onAfterLeave:Yn,onLeaveCancelled:Yn,onBeforeAppear:Yn,onAppear:Yn,onAfterAppear:Yn,onAppearCancelled:Yn},tf=e=>{const t=e.subTree;return t.component?tf(t.component):t},Jp={name:"BaseTransition",props:ef,setup(e,{slots:t}){const n=Bl(),r=Kp();return()=>{const s=t.default&&sf(t.default(),!0);if(!s||!s.length)return;const o=nf(s),i=Et(e),{mode:a}=i;if(r.isLeaving)return aa(o);const l=vc(o);if(!l)return aa(o);let f=Ka(l,i,r,n,g=>f=g);l.type!==vn&&Do(l,f);let u=n.subTree&&vc(n.subTree);if(u&&u.type!==vn&&!Rs(u,l)&&tf(n).type!==vn){let g=Ka(u,i,r,n);if(Do(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},aa(o);a==="in-out"&&l.type!==vn?g.delayLeave=(_,E,U)=>{const $=rf(r,u);$[String(u.key)]=u,_[mr]=()=>{E(),_[mr]=void 0,delete f.delayedLeave,u=void 0},f.delayedLeave=()=>{U(),delete f.delayedLeave,u=void 0}}:u=void 0}else u&&(u=void 0);return o}}};function nf(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==vn){t=n;break}}return t}const Yp=Jp;function rf(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 Ka(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:U,onLeaveCancelled:$,onBeforeAppear:X,onAppear:ce,onAfterAppear:K,onAppearCancelled:ee}=t,re=String(e.key),we=rf(n,e),Te=(ae,se)=>{ae&&dr(ae,r,9,se)},me=(ae,se)=>{const ue=se[1];Te(ae,se),Ke(ae)?ae.every(te=>te.length<=1)&&ue():ae.length<=1&&ue()},Me={mode:i,persisted:a,beforeEnter(ae){let se=l;if(!n.isMounted)if(o)se=X||l;else return;ae[mr]&&ae[mr](!0);const ue=we[re];ue&&Rs(e,ue)&&ue.el[mr]&&ue.el[mr](),Te(se,[ae])},enter(ae){if(we[re]===e)return;let se=f,ue=u,te=g;if(!n.isMounted)if(o)se=ce||f,ue=K||u,te=ee||g;else return;let Re=!1;ae[go]=ze=>{Re||(Re=!0,ze?Te(te,[ae]):Te(ue,[ae]),Me.delayedLeave&&Me.delayedLeave(),ae[go]=void 0)};const Je=ae[go].bind(null,!1);se?me(se,[ae,Je]):Je()},leave(ae,se){const ue=String(e.key);if(ae[go]&&ae[go](!0),n.isUnmounting)return se();Te(_,[ae]);let te=!1;ae[mr]=Je=>{te||(te=!0,se(),Je?Te($,[ae]):Te(U,[ae]),ae[mr]=void 0,we[ue]===e&&delete we[ue])};const Re=ae[mr].bind(null,!1);we[ue]=e,E?me(E,[ae,Re]):Re()},clone(ae){const se=Ka(ae,t,n,r,s);return s&&s(se),se}};return Me}function aa(e){if(Wi(e))return e=hs(e),e.children=null,e}function vc(e){if(!Wi(e))return Xd(e.type)&&e.children?nf(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&&st(n.default))return n.default()}}function Do(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Do(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 sf(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(sf(i.children,t,a))):(t||i.type!==vn)&&r.push(a!=null?hs(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function on(e,t){return st(e)?nn({name:e.name},t,{setup:e}):e}function of(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function yc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const Si=new WeakMap;function Co(e,t,n,r,s=!1){if(Ke(e)){e.forEach(($,X)=>Co($,t&&(Ke(t)?t[X]:t),n,r,s));return}if(Qs(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Co(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Ki(r.component):r.el,i=s?null:o,{i:a,r:l}=e,f=t&&t.r,u=a.refs===Dt?a.refs={}:a.refs,g=a.setupState,_=Et(g),E=g===Dt?yd:$=>yc(u,$)?!1:Rt(_,$),U=($,X)=>!(X&&yc(u,X));if(f!=null&&f!==l){if(wc(t),qt(f))u[f]=null,E(f)&&(g[f]=null);else if(wn(f)){const $=t;U(f,$.k)&&(f.value=null),$.k&&(u[$.k]=null)}}if(st(l))Jo(l,a,12,[i,u]);else{const $=qt(l),X=wn(l);if($||X){const ce=()=>{if(e.f){const K=$?E(l)?g[l]:u[l]:U()||!e.k?l.value:u[e.k];if(s)Ke(K)&&Sl(K,o);else if(Ke(K))K.includes(o)||K.push(o);else if($)u[l]=[o],E(l)&&(g[l]=u[l]);else{const ee=[o];U(l,e.k)&&(l.value=ee),e.k&&(u[e.k]=ee)}}else $?(u[l]=i,E(l)&&(g[l]=i)):X&&(U(l,e.k)&&(l.value=i),e.k&&(u[e.k]=i))};if(i){const K=()=>{ce(),Si.delete(e)};K.id=-1,Si.set(e,K),mn(K,n)}else wc(e),ce()}}}function wc(e){const t=Si.get(e);t&&(t.flags|=8,Si.delete(e))}Fi().requestIdleCallback;Fi().cancelIdleCallback;const Qs=e=>!!e.type.__asyncLoader,Wi=e=>e.type.__isKeepAlive;function Qp(e,t){af(e,"a",t)}function Xp(e,t){af(e,"da",t)}function af(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(Vi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Wi(s.parent.vnode)&&Zp(r,t,n,s),s=s.parent}}function Zp(e,t,n,r){const s=Vi(t,e,r,!0);zi(()=>{Sl(r[t],s)},n)}function Vi(e,t,n=yn,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{Br();const a=Yo(n),l=dr(t,n,e,i);return a(),Ur(),l});return r?s.unshift(o):s.push(o),o}}const Gr=e=>(t,n=yn)=>{(!Uo||e==="sp")&&Vi(e,(...r)=>t(...r),n)},em=Gr("bm"),Kr=Gr("m"),tm=Gr("bu"),nm=Gr("u"),Jr=Gr("bum"),zi=Gr("um"),rm=Gr("sp"),sm=Gr("rtg"),om=Gr("rtc");function im(e,t=yn){Vi("ec",e,t)}const am="components",lf=Symbol.for("v-ndc");function Ii(e){return qt(e)?lm(am,e,!1)||e:e||lf}function lm(e,t,n=!0,r=!1){const s=cn||yn;if(s){const o=s.type;{const a=qm(o,!1);if(a&&(a===t||a===xn(t)||a===ji(xn(t))))return o}const i=bc(s[e]||o[e],t)||bc(s.appContext[e],t);return!i&&r?o:i}}function bc(e,t){return e&&(e[t]||e[xn(t)]||e[ji(xn(t))])}function yt(e,t,n,r){let s;const o=n,i=Ke(e);if(i||qt(e)){const a=i&&Ns(e);let l=!1,f=!1;a&&(l=!Xn(e),f=Hr(e),e=Bi(e)),s=new Array(e.length);for(let u=0,g=e.length;u<g;u++)s[u]=t(l?f?ro(ur(e[u])):ur(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(Pt(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 _r(e,t,n={},r,s){if(cn.ce||cn.parent&&Qs(cn.parent)&&cn.parent.ce){const f=Object.keys(n).length>0;return t!=="default"&&(n.name=t),w(),_t(De,null,[je("slot",n,r)],f?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),w();const i=o&&cf(o(n)),a=n.key||i&&i.key,l=_t(De,{key:(a&&!cr(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function cf(e){return e.some(t=>Fo(t)?!(t.type===vn||t.type===De&&!cf(t.children)):!0)?e:null}const Ja=e=>e?xf(e)?Ki(e):Ja(e.parent):null,Ao=nn(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=>Ja(e.parent),$root:e=>Ja(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>df(e),$forceUpdate:e=>e.f||(e.f=()=>{Nl(e.update)}),$nextTick:e=>e.n||(e.n=Zt.bind(e.proxy)),$watch:e=>qp.bind(e)}),la=(e,t)=>e!==Dt&&!e.__isScriptSetup&&Rt(e,t),cm={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(la(r,t))return i[t]=1,r[t];if(s!==Dt&&Rt(s,t))return i[t]=2,s[t];if(Rt(o,t))return i[t]=3,o[t];if(n!==Dt&&Rt(n,t))return i[t]=4,n[t];Ya&&(i[t]=0)}}const f=Ao[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!==Dt&&Rt(n,t))return i[t]=4,n[t];if(g=l.config.globalProperties,Rt(g,t))return g[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return la(s,t)?(s[t]=n,!0):r!==Dt&&Rt(r,t)?(r[t]=n,!0):Rt(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!==Dt&&a[0]!=="$"&&Rt(e,a)||la(t,a)||Rt(o,a)||Rt(r,a)||Rt(Ao,a)||Rt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Rt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function um(){return dm().slots}function dm(e){const t=Bl();return t.setupContext||(t.setupContext=Pf(t))}function _c(e){return Ke(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Ya=!0;function fm(e){const t=df(e),n=e.proxy,r=e.ctx;Ya=!1,t.beforeCreate&&kc(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:U,activated:$,deactivated:X,beforeDestroy:ce,beforeUnmount:K,destroyed:ee,unmounted:re,render:we,renderTracked:Te,renderTriggered:me,errorCaptured:Me,serverPrefetch:ae,expose:se,inheritAttrs:ue,components:te,directives:Re,filters:Je}=t;if(f&&hm(f,r,null),i)for(const He in i){const Pe=i[He];st(Pe)&&(r[He]=Pe.bind(n))}if(s){const He=s.call(n,n);Pt(He)&&(e.data=Ui(He))}if(Ya=!0,o)for(const He in o){const Pe=o[He],nt=st(Pe)?Pe.bind(n,n):st(Pe.get)?Pe.get.bind(n,n):kr,et=!st(Pe)&&st(Pe.set)?Pe.set.bind(n):kr,ke=de({get:nt,set:et});Object.defineProperty(r,He,{enumerable:!0,configurable:!0,get:()=>ke.value,set:at=>ke.value=at})}if(a)for(const He in a)uf(a[He],r,n,He);if(l){const He=st(l)?l.call(n):l;Reflect.ownKeys(He).forEach(Pe=>{hi(Pe,He[Pe])})}u&&kc(u,e,"c");function We(He,Pe){Ke(Pe)?Pe.forEach(nt=>He(nt.bind(n))):Pe&&He(Pe.bind(n))}if(We(em,g),We(Kr,_),We(tm,E),We(nm,U),We(Qp,$),We(Xp,X),We(im,Me),We(om,Te),We(sm,me),We(Jr,K),We(zi,re),We(rm,ae),Ke(se))if(se.length){const He=e.exposed||(e.exposed={});se.forEach(Pe=>{Object.defineProperty(He,Pe,{get:()=>n[Pe],set:nt=>n[Pe]=nt,enumerable:!0})})}else e.exposed||(e.exposed={});we&&e.render===kr&&(e.render=we),ue!=null&&(e.inheritAttrs=ue),te&&(e.components=te),Re&&(e.directives=Re),ae&&of(e)}function hm(e,t,n=kr){Ke(e)&&(e=Qa(e));for(const r in e){const s=e[r];let o;Pt(s)?"default"in s?o=ar(s.from||r,s.default,!0):o=ar(s.from||r):o=ar(s),wn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function kc(e,t,n){dr(Ke(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function uf(e,t,n,r){let s=r.includes(".")?Yd(n,r):()=>n[r];if(qt(e)){const o=t[e];st(o)&&pt(s,o)}else if(st(e))pt(s,e.bind(n));else if(Pt(e))if(Ke(e))e.forEach(o=>uf(o,t,n,r));else{const o=st(e.handler)?e.handler.bind(n):t[e.handler];st(o)&&pt(s,o,e)}}function df(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=>Ei(l,f,i,!0)),Ei(l,t,i)),Pt(t)&&o.set(t,l),l}function Ei(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&Ei(e,o,n,!0),s&&s.forEach(i=>Ei(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=pm[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const pm={data:Tc,props:Sc,emits:Sc,methods:bo,computed:bo,beforeCreate:In,created:In,beforeMount:In,mounted:In,beforeUpdate:In,updated:In,beforeDestroy:In,beforeUnmount:In,destroyed:In,unmounted:In,activated:In,deactivated:In,errorCaptured:In,serverPrefetch:In,components:bo,directives:bo,watch:gm,provide:Tc,inject:mm};function Tc(e,t){return t?e?function(){return nn(st(e)?e.call(this,this):e,st(t)?t.call(this,this):t)}:t:e}function mm(e,t){return bo(Qa(e),Qa(t))}function Qa(e){if(Ke(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function In(e,t){return e?[...new Set([].concat(e,t))]:t}function bo(e,t){return e?nn(Object.create(null),e,t):t}function Sc(e,t){return e?Ke(e)&&Ke(t)?[...new Set([...e,...t])]:nn(Object.create(null),_c(e),_c(t??{})):t}function gm(e,t){if(!e)return t;if(!t)return e;const n=nn(Object.create(null),e);for(const r in t)n[r]=In(e[r],t[r]);return n}function ff(){return{app:null,config:{isNativeTag:yd,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 vm=0;function ym(e,t){return function(r,s=null){st(r)||(r=nn({},r)),s!=null&&!Pt(s)&&(s=null);const o=ff(),i=new WeakSet,a=[];let l=!1;const f=o.app={_uid:vm++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Km,get config(){return o.config},set config(u){},use(u,...g){return i.has(u)||(u&&st(u.install)?(i.add(u),u.install(f,...g)):st(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||je(r,s);return E.appContext=o,_===!0?_="svg":_===!1&&(_=void 0),e(E,u,_),l=!0,f._container=u,u.__vue_app__=f,Ki(E.component)}},onUnmount(u){a.push(u)},unmount(){l&&(dr(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=Xs;Xs=f;try{return u()}finally{Xs=g}}};return f}}let Xs=null;const wm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${xn(t)}Modifiers`]||e[`${ps(t)}Modifiers`];function bm(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Dt;let s=n;const o=t.startsWith("update:"),i=o&&wm(r,t.slice(7));i&&(i.trim&&(s=n.map(u=>qt(u)?u.trim():u)),i.number&&(s=n.map(El)));let a,l=r[a=na(t)]||r[a=na(xn(t))];!l&&o&&(l=r[a=na(ps(t))]),l&&dr(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,dr(f,e,6,s)}}const _m=new WeakMap;function hf(e,t,n=!1){const r=n?_m:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!st(e)){const l=f=>{const u=hf(f,t,!0);u&&(a=!0,nn(i,u))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(Pt(e)&&r.set(e,null),null):(Ke(o)?o.forEach(l=>i[l]=null):nn(i,o),Pt(e)&&r.set(e,i),i)}function qi(e,t){return!e||!Li(t)?!1:(t=t.slice(2).replace(/Once$/,""),Rt(e,t[0].toLowerCase()+t.slice(1))||Rt(e,ps(t))||Rt(e,t))}function Ic(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:U,inheritAttrs:$}=e,X=Ti(e);let ce,K;try{if(n.shapeFlag&4){const re=s||r,we=re;ce=vr(f.call(we,re,u,g,E,_,U)),K=a}else{const re=t;ce=vr(re.length>1?re(g,{attrs:a,slots:i,emit:l}):re(g,null)),K=t.props?a:km(a)}}catch(re){xo.length=0,Hi(re,e,1),ce=je(vn)}let ee=ce;if(K&&$!==!1){const re=Object.keys(K),{shapeFlag:we}=ee;re.length&&we&7&&(o&&re.some(Tl)&&(K=Tm(K,o)),ee=hs(ee,K,!1,!0))}return n.dirs&&(ee=hs(ee,null,!1,!0),ee.dirs=ee.dirs?ee.dirs.concat(n.dirs):n.dirs),n.transition&&Do(ee,n.transition),ce=ee,Ti(X),ce}const km=e=>{let t;for(const n in e)(n==="class"||n==="style"||Li(n))&&((t||(t={}))[n]=e[n]);return t},Tm=(e,t)=>{const n={};for(const r in e)(!Tl(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Sm(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?Ec(r,i,f):!!i;if(l&8){const u=t.dynamicProps;for(let g=0;g<u.length;g++){const _=u[g];if(pf(i,r,_)&&!qi(f,_))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?Ec(r,i,f):!0:!!i;return!1}function Ec(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(pf(t,e,o)&&!qi(n,o))return!0}return!1}function pf(e,t,n){const r=e[n],s=t[n];return n==="style"&&Pt(r)&&Pt(s)?!Cl(r,s):r!==s}function Im({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 mf={},gf=()=>Object.create(mf),vf=e=>Object.getPrototypeOf(e)===mf;function Em(e,t,n,r=!1){const s={},o=gf();e.propsDefaults=Object.create(null),yf(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Ud(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function Cm(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=Et(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(qi(e.emitsOptions,_))continue;const E=t[_];if(l)if(Rt(o,_))E!==o[_]&&(o[_]=E,f=!0);else{const U=xn(_);s[U]=Xa(l,a,U,E,e,!1)}else E!==o[_]&&(o[_]=E,f=!0)}}}else{yf(e,t,s,o)&&(f=!0);let u;for(const g in a)(!t||!Rt(t,g)&&((u=ps(g))===g||!Rt(t,u)))&&(l?n&&(n[g]!==void 0||n[u]!==void 0)&&(s[g]=Xa(l,a,g,void 0,e,!0)):delete s[g]);if(o!==a)for(const g in o)(!t||!Rt(t,g))&&(delete o[g],f=!0)}f&&Nr(e.attrs,"set","")}function yf(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(ko(l))continue;const f=t[l];let u;s&&Rt(s,u=xn(l))?!o||!o.includes(u)?n[u]=f:(a||(a={}))[u]=f:qi(e.emitsOptions,l)||(!(l in r)||f!==r[l])&&(r[l]=f,i=!0)}if(o){const l=Et(n),f=a||Dt;for(let u=0;u<o.length;u++){const g=o[u];n[g]=Xa(s,l,g,f[g],e,!Rt(f,g))}}return i}function Xa(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=Rt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&st(l)){const{propsDefaults:f}=s;if(n in f)r=f[n];else{const u=Yo(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===ps(n))&&(r=!0))}return r}const Am=new WeakMap;function wf(e,t,n=!1){const r=n?Am:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!st(e)){const u=g=>{l=!0;const[_,E]=wf(g,t,!0);nn(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 Pt(e)&&r.set(e,Ks),Ks;if(Ke(o))for(let u=0;u<o.length;u++){const g=xn(o[u]);Cc(g)&&(i[g]=Dt)}else if(o)for(const u in o){const g=xn(u);if(Cc(g)){const _=o[u],E=i[g]=Ke(_)||st(_)?{type:_}:nn({},_),U=E.type;let $=!1,X=!0;if(Ke(U))for(let ce=0;ce<U.length;++ce){const K=U[ce],ee=st(K)&&K.name;if(ee==="Boolean"){$=!0;break}else ee==="String"&&(X=!1)}else $=st(U)&&U.name==="Boolean";E[0]=$,E[1]=X,($||Rt(E,"default"))&&a.push(g)}}const f=[i,a];return Pt(e)&&r.set(e,f),f}function Cc(e){return e[0]!=="$"&&!ko(e)}const Ll=e=>e==="_"||e==="_ctx"||e==="$stable",Dl=e=>Ke(e)?e.map(vr):[vr(e)],xm=(e,t,n)=>{if(t._n)return t;const r=At((...s)=>Dl(t(...s)),n);return r._c=!1,r},bf=(e,t,n)=>{const r=e._ctx;for(const s in e){if(Ll(s))continue;const o=e[s];if(st(o))t[s]=xm(s,o,r);else if(o!=null){const i=Dl(o);t[s]=()=>i}}},_f=(e,t)=>{const n=Dl(t);e.slots.default=()=>n},kf=(e,t,n)=>{for(const r in t)(n||!Ll(r))&&(e[r]=t[r])},Rm=(e,t,n)=>{const r=e.slots=gf();if(e.vnode.shapeFlag&32){const s=t._;s?(kf(r,t,n),n&&Td(r,"_",s,!0)):bf(t,r)}else t&&_f(e,t)},Pm=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=Dt;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:kf(s,t,n):(o=!t.$stable,bf(t,s)),i=t}else t&&(_f(e,t),i={default:1});if(o)for(const a in s)!Ll(a)&&i[a]==null&&delete s[a]},mn=Lm;function Mm(e){return $m(e)}function $m(e,t){const n=Fi();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=kr,insertStaticContent:U}=e,$=(T,S,O,Z=null,J=null,M=null,z=void 0,q=null,Q=!!S.dynamicChildren)=>{if(T===S)return;T&&!Rs(T,S)&&(Z=W(T),at(T,J,M,!0),T=null),S.patchFlag===-2&&(Q=!1,S.dynamicChildren=null);const{type:G,ref:Ie,shapeFlag:ye}=S;switch(G){case Gi:X(T,S,O,Z);break;case vn:ce(T,S,O,Z);break;case ua:T==null&&K(S,O,Z,z);break;case De:te(T,S,O,Z,J,M,z,q,Q);break;default:ye&1?we(T,S,O,Z,J,M,z,q,Q):ye&6?Re(T,S,O,Z,J,M,z,q,Q):(ye&64||ye&128)&&G.process(T,S,O,Z,J,M,z,q,Q,Ee)}Ie!=null&&J?Co(Ie,T&&T.ref,M,S||T,!S):Ie==null&&T&&T.ref!=null&&Co(T.ref,null,M,T,!0)},X=(T,S,O,Z)=>{if(T==null)r(S.el=a(S.children),O,Z);else{const J=S.el=T.el;S.children!==T.children&&f(J,S.children)}},ce=(T,S,O,Z)=>{T==null?r(S.el=l(S.children||""),O,Z):S.el=T.el},K=(T,S,O,Z)=>{[T.el,T.anchor]=U(T.children,S,O,Z,T.el,T.anchor)},ee=({el:T,anchor:S},O,Z)=>{let J;for(;T&&T!==S;)J=_(T),r(T,O,Z),T=J;r(S,O,Z)},re=({el:T,anchor:S})=>{let O;for(;T&&T!==S;)O=_(T),s(T),T=O;s(S)},we=(T,S,O,Z,J,M,z,q,Q)=>{if(S.type==="svg"?z="svg":S.type==="math"&&(z="mathml"),T==null)Te(S,O,Z,J,M,z,q,Q);else{const G=T.el&&T.el._isVueCE?T.el:null;try{G&&G._beginPatch(),ae(T,S,J,M,z,q,Q)}finally{G&&G._endPatch()}}},Te=(T,S,O,Z,J,M,z,q)=>{let Q,G;const{props:Ie,shapeFlag:ye,transition:Ce,dirs:xe}=T;if(Q=T.el=i(T.type,M,Ie&&Ie.is,Ie),ye&8?u(Q,T.children):ye&16&&Me(T.children,Q,null,Z,J,ca(T,M),z,q),xe&&Ts(T,null,Z,"created"),me(Q,T,T.scopeId,z,Z),Ie){for(const lt in Ie)lt!=="value"&&!ko(lt)&&o(Q,lt,null,Ie[lt],M,Z);"value"in Ie&&o(Q,"value",null,Ie.value,M),(G=Ie.onVnodeBeforeMount)&&hr(G,Z,T)}xe&&Ts(T,null,Z,"beforeMount");const Be=Om(J,Ce);Be&&Ce.beforeEnter(Q),r(Q,S,O),((G=Ie&&Ie.onVnodeMounted)||Be||xe)&&mn(()=>{G&&hr(G,Z,T),Be&&Ce.enter(Q),xe&&Ts(T,null,Z,"mounted")},J)},me=(T,S,O,Z,J)=>{if(O&&E(T,O),Z)for(let M=0;M<Z.length;M++)E(T,Z[M]);if(J){let M=J.subTree;if(S===M||If(M.type)&&(M.ssContent===S||M.ssFallback===S)){const z=J.vnode;me(T,z,z.scopeId,z.slotScopeIds,J.parent)}}},Me=(T,S,O,Z,J,M,z,q,Q=0)=>{for(let G=Q;G<T.length;G++){const Ie=T[G]=q?Or(T[G]):vr(T[G]);$(null,Ie,S,O,Z,J,M,z,q)}},ae=(T,S,O,Z,J,M,z)=>{const q=S.el=T.el;let{patchFlag:Q,dynamicChildren:G,dirs:Ie}=S;Q|=T.patchFlag&16;const ye=T.props||Dt,Ce=S.props||Dt;let xe;if(O&&Ss(O,!1),(xe=Ce.onVnodeBeforeUpdate)&&hr(xe,O,S,T),Ie&&Ts(S,T,O,"beforeUpdate"),O&&Ss(O,!0),(ye.innerHTML&&Ce.innerHTML==null||ye.textContent&&Ce.textContent==null)&&u(q,""),G?se(T.dynamicChildren,G,q,O,Z,ca(S,J),M):z||Pe(T,S,q,null,O,Z,ca(S,J),M,!1),Q>0){if(Q&16)ue(q,ye,Ce,O,J);else if(Q&2&&ye.class!==Ce.class&&o(q,"class",null,Ce.class,J),Q&4&&o(q,"style",ye.style,Ce.style,J),Q&8){const Be=S.dynamicProps;for(let lt=0;lt<Be.length;lt++){const Ze=Be[lt],kt=ye[Ze],vt=Ce[Ze];(vt!==kt||Ze==="value")&&o(q,Ze,kt,vt,J,O)}}Q&1&&T.children!==S.children&&u(q,S.children)}else!z&&G==null&&ue(q,ye,Ce,O,J);((xe=Ce.onVnodeUpdated)||Ie)&&mn(()=>{xe&&hr(xe,O,S,T),Ie&&Ts(S,T,O,"updated")},Z)},se=(T,S,O,Z,J,M,z)=>{for(let q=0;q<S.length;q++){const Q=T[q],G=S[q],Ie=Q.el&&(Q.type===De||!Rs(Q,G)||Q.shapeFlag&198)?g(Q.el):O;$(Q,G,Ie,null,Z,J,M,z,!0)}},ue=(T,S,O,Z,J)=>{if(S!==O){if(S!==Dt)for(const M in S)!ko(M)&&!(M in O)&&o(T,M,S[M],null,J,Z);for(const M in O){if(ko(M))continue;const z=O[M],q=S[M];z!==q&&M!=="value"&&o(T,M,q,z,J,Z)}"value"in O&&o(T,"value",S.value,O.value,J)}},te=(T,S,O,Z,J,M,z,q,Q)=>{const G=S.el=T?T.el:a(""),Ie=S.anchor=T?T.anchor:a("");let{patchFlag:ye,dynamicChildren:Ce,slotScopeIds:xe}=S;xe&&(q=q?q.concat(xe):xe),T==null?(r(G,O,Z),r(Ie,O,Z),Me(S.children||[],O,Ie,J,M,z,q,Q)):ye>0&&ye&64&&Ce&&T.dynamicChildren&&T.dynamicChildren.length===Ce.length?(se(T.dynamicChildren,Ce,O,J,M,z,q),(S.key!=null||J&&S===J.subTree)&&jl(T,S,!0)):Pe(T,S,O,Ie,J,M,z,q,Q)},Re=(T,S,O,Z,J,M,z,q,Q)=>{S.slotScopeIds=q,T==null?S.shapeFlag&512?J.ctx.activate(S,O,Z,z,Q):Je(S,O,Z,J,M,z,Q):ze(T,S,Q)},Je=(T,S,O,Z,J,M,z)=>{const q=T.component=Hm(T,Z,J);if(Wi(T)&&(q.ctx.renderer=Ee),Wm(q,!1,z),q.asyncDep){if(J&&J.registerDep(q,We,z),!T.el){const Q=q.subTree=je(vn);ce(null,Q,S,O),T.placeholder=Q.el}}else We(q,T,S,O,J,M,z)},ze=(T,S,O)=>{const Z=S.component=T.component;if(Sm(T,S,O))if(Z.asyncDep&&!Z.asyncResolved){He(Z,S,O);return}else Z.next=S,Z.update();else S.el=T.el,Z.vnode=S},We=(T,S,O,Z,J,M,z)=>{const q=()=>{if(T.isMounted){let{next:ye,bu:Ce,u:xe,parent:Be,vnode:lt}=T;{const Ye=Tf(T);if(Ye){ye&&(ye.el=lt.el,He(T,ye,z)),Ye.asyncDep.then(()=>{mn(()=>{T.isUnmounted||G()},J)});return}}let Ze=ye,kt;Ss(T,!1),ye?(ye.el=lt.el,He(T,ye,z)):ye=lt,Ce&&fi(Ce),(kt=ye.props&&ye.props.onVnodeBeforeUpdate)&&hr(kt,Be,ye,lt),Ss(T,!0);const vt=Ic(T),Mt=T.subTree;T.subTree=vt,$(Mt,vt,g(Mt.el),W(Mt),T,J,M),ye.el=vt.el,Ze===null&&Im(T,vt.el),xe&&mn(xe,J),(kt=ye.props&&ye.props.onVnodeUpdated)&&mn(()=>hr(kt,Be,ye,lt),J)}else{let ye;const{el:Ce,props:xe}=S,{bm:Be,m:lt,parent:Ze,root:kt,type:vt}=T,Mt=Qs(S);Ss(T,!1),Be&&fi(Be),!Mt&&(ye=xe&&xe.onVnodeBeforeMount)&&hr(ye,Ze,S),Ss(T,!0);{kt.ce&&kt.ce._hasShadowRoot()&&kt.ce._injectChildStyle(vt,T.parent?T.parent.type:void 0);const Ye=T.subTree=Ic(T);$(null,Ye,O,Z,T,J,M),S.el=Ye.el}if(lt&&mn(lt,J),!Mt&&(ye=xe&&xe.onVnodeMounted)){const Ye=S;mn(()=>hr(ye,Ze,Ye),J)}(S.shapeFlag&256||Ze&&Qs(Ze.vnode)&&Ze.vnode.shapeFlag&256)&&T.a&&mn(T.a,J),T.isMounted=!0,S=O=Z=null}};T.scope.on();const Q=T.effect=new Cd(q);T.scope.off();const G=T.update=Q.run.bind(Q),Ie=T.job=Q.runIfDirty.bind(Q);Ie.i=T,Ie.id=T.uid,Q.scheduler=()=>Nl(Ie),Ss(T,!0),G()},He=(T,S,O)=>{S.component=T;const Z=T.vnode.props;T.vnode=S,T.next=null,Cm(T,S.props,Z,O),Pm(T,S.children,O),Br(),hc(T),Ur()},Pe=(T,S,O,Z,J,M,z,q,Q=!1)=>{const G=T&&T.children,Ie=T?T.shapeFlag:0,ye=S.children,{patchFlag:Ce,shapeFlag:xe}=S;if(Ce>0){if(Ce&128){et(G,ye,O,Z,J,M,z,q,Q);return}else if(Ce&256){nt(G,ye,O,Z,J,M,z,q,Q);return}}xe&8?(Ie&16&&qe(G,J,M),ye!==G&&u(O,ye)):Ie&16?xe&16?et(G,ye,O,Z,J,M,z,q,Q):qe(G,J,M,!0):(Ie&8&&u(O,""),xe&16&&Me(ye,O,Z,J,M,z,q,Q))},nt=(T,S,O,Z,J,M,z,q,Q)=>{T=T||Ks,S=S||Ks;const G=T.length,Ie=S.length,ye=Math.min(G,Ie);let Ce;for(Ce=0;Ce<ye;Ce++){const xe=S[Ce]=Q?Or(S[Ce]):vr(S[Ce]);$(T[Ce],xe,O,null,J,M,z,q,Q)}G>Ie?qe(T,J,M,!0,!1,ye):Me(S,O,Z,J,M,z,q,Q,ye)},et=(T,S,O,Z,J,M,z,q,Q)=>{let G=0;const Ie=S.length;let ye=T.length-1,Ce=Ie-1;for(;G<=ye&&G<=Ce;){const xe=T[G],Be=S[G]=Q?Or(S[G]):vr(S[G]);if(Rs(xe,Be))$(xe,Be,O,null,J,M,z,q,Q);else break;G++}for(;G<=ye&&G<=Ce;){const xe=T[ye],Be=S[Ce]=Q?Or(S[Ce]):vr(S[Ce]);if(Rs(xe,Be))$(xe,Be,O,null,J,M,z,q,Q);else break;ye--,Ce--}if(G>ye){if(G<=Ce){const xe=Ce+1,Be=xe<Ie?S[xe].el:Z;for(;G<=Ce;)$(null,S[G]=Q?Or(S[G]):vr(S[G]),O,Be,J,M,z,q,Q),G++}}else if(G>Ce)for(;G<=ye;)at(T[G],J,M,!0),G++;else{const xe=G,Be=G,lt=new Map;for(G=Be;G<=Ce;G++){const ut=S[G]=Q?Or(S[G]):vr(S[G]);ut.key!=null&&lt.set(ut.key,G)}let Ze,kt=0;const vt=Ce-Be+1;let Mt=!1,Ye=0;const jt=new Array(vt);for(G=0;G<vt;G++)jt[G]=0;for(G=xe;G<=ye;G++){const ut=T[G];if(kt>=vt){at(ut,J,M,!0);continue}let dt;if(ut.key!=null)dt=lt.get(ut.key);else for(Ze=Be;Ze<=Ce;Ze++)if(jt[Ze-Be]===0&&Rs(ut,S[Ze])){dt=Ze;break}dt===void 0?at(ut,J,M,!0):(jt[dt-Be]=G+1,dt>=Ye?Ye=dt:Mt=!0,$(ut,S[dt],O,null,J,M,z,q,Q),kt++)}const Ht=Mt?Nm(jt):Ks;for(Ze=Ht.length-1,G=vt-1;G>=0;G--){const ut=Be+G,dt=S[ut],bt=S[ut+1],rn=ut+1<Ie?bt.el||Sf(bt):Z;jt[G]===0?$(null,dt,O,rn,J,M,z,q,Q):Mt&&(Ze<0||G!==Ht[Ze]?ke(dt,O,rn,2):Ze--)}}},ke=(T,S,O,Z,J=null)=>{const{el:M,type:z,transition:q,children:Q,shapeFlag:G}=T;if(G&6){ke(T.component.subTree,S,O,Z);return}if(G&128){T.suspense.move(S,O,Z);return}if(G&64){z.move(T,S,O,Ee);return}if(z===De){r(M,S,O);for(let ye=0;ye<Q.length;ye++)ke(Q[ye],S,O,Z);r(T.anchor,S,O);return}if(z===ua){ee(T,S,O);return}if(Z!==2&&G&1&&q)if(Z===0)q.beforeEnter(M),r(M,S,O),mn(()=>q.enter(M),J);else{const{leave:ye,delayLeave:Ce,afterLeave:xe}=q,Be=()=>{T.ctx.isUnmounted?s(M):r(M,S,O)},lt=()=>{M._isLeaving&&M[mr](!0),ye(M,()=>{Be(),xe&&xe()})};Ce?Ce(M,Be,lt):lt()}else r(M,S,O)},at=(T,S,O,Z=!1,J=!1)=>{const{type:M,props:z,ref:q,children:Q,dynamicChildren:G,shapeFlag:Ie,patchFlag:ye,dirs:Ce,cacheIndex:xe}=T;if(ye===-2&&(J=!1),q!=null&&(Br(),Co(q,null,O,T,!0),Ur()),xe!=null&&(S.renderCache[xe]=void 0),Ie&256){S.ctx.deactivate(T);return}const Be=Ie&1&&Ce,lt=!Qs(T);let Ze;if(lt&&(Ze=z&&z.onVnodeBeforeUnmount)&&hr(Ze,S,T),Ie&6)mt(T.component,O,Z);else{if(Ie&128){T.suspense.unmount(O,Z);return}Be&&Ts(T,null,S,"beforeUnmount"),Ie&64?T.type.remove(T,S,O,Ee,Z):G&&!G.hasOnce&&(M!==De||ye>0&&ye&64)?qe(G,S,O,!1,!0):(M===De&&ye&384||!J&&Ie&16)&&qe(Q,S,O),Z&&Ot(T)}(lt&&(Ze=z&&z.onVnodeUnmounted)||Be)&&mn(()=>{Ze&&hr(Ze,S,T),Be&&Ts(T,null,S,"unmounted")},O)},Ot=T=>{const{type:S,el:O,anchor:Z,transition:J}=T;if(S===De){gt(O,Z);return}if(S===ua){re(T);return}const M=()=>{s(O),J&&!J.persisted&&J.afterLeave&&J.afterLeave()};if(T.shapeFlag&1&&J&&!J.persisted){const{leave:z,delayLeave:q}=J,Q=()=>z(O,M);q?q(T.el,M,Q):Q()}else M()},gt=(T,S)=>{let O;for(;T!==S;)O=_(T),s(T),T=O;s(S)},mt=(T,S,O)=>{const{bum:Z,scope:J,job:M,subTree:z,um:q,m:Q,a:G}=T;Ac(Q),Ac(G),Z&&fi(Z),J.stop(),M&&(M.flags|=8,at(z,T,S,O)),q&&mn(q,S),mn(()=>{T.isUnmounted=!0},S)},qe=(T,S,O,Z=!1,J=!1,M=0)=>{for(let z=M;z<T.length;z++)at(T[z],S,O,Z,J)},W=T=>{if(T.shapeFlag&6)return W(T.component.subTree);if(T.shapeFlag&128)return T.suspense.next();const S=_(T.anchor||T.el),O=S&&S[Qd];return O?_(O):S};let be=!1;const he=(T,S,O)=>{let Z;T==null?S._vnode&&(at(S._vnode,null,null,!0),Z=S._vnode.component):$(S._vnode||null,T,S,null,null,null,O),S._vnode=T,be||(be=!0,hc(Z),qd(),be=!1)},Ee={p:$,um:at,m:ke,r:Ot,mt:Je,mc:Me,pc:Pe,pbc:se,n:W,o:e};return{render:he,hydrate:void 0,createApp:ym(he)}}function ca({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 Ss({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Om(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function jl(e,t,n=!1){const r=e.children,s=t.children;if(Ke(r)&&Ke(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]=Or(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&jl(i,a)),a.type===Gi&&(a.patchFlag===-1&&(a=s[o]=Or(a)),a.el=i.el),a.type===vn&&!a.el&&(a.el=i.el)}}function Nm(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 Tf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Tf(t)}function Ac(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function Sf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?Sf(t.subTree):null}const If=e=>e.__isSuspense;function Lm(e,t){t&&t.pendingBranch?Ke(e)?t.effects.push(...e):t.effects.push(e):Wp(e)}const De=Symbol.for("v-fgt"),Gi=Symbol.for("v-txt"),vn=Symbol.for("v-cmt"),ua=Symbol.for("v-stc"),xo=[];let zn=null;function w(e=!1){xo.push(zn=e?null:[])}function Dm(){xo.pop(),zn=xo[xo.length-1]||null}let jo=1;function Ci(e,t=!1){jo+=e,e<0&&zn&&t&&(zn.hasOnce=!0)}function Ef(e){return e.dynamicChildren=jo>0?zn||Ks:null,Dm(),jo>0&&zn&&zn.push(e),e}function k(e,t,n,r,s,o){return Ef(v(e,t,n,r,s,o,!0))}function _t(e,t,n,r,s){return Ef(je(e,t,n,r,s,!0))}function Fo(e){return e?e.__v_isVNode===!0:!1}function Rs(e,t){return e.type===t.type&&e.key===t.key}const Cf=({key:e})=>e??null,mi=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?qt(e)||wn(e)||st(e)?{i:cn,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&&Cf(t),ref:t&&mi(t),scopeId:Kd,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:cn};return a?(Fl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=qt(n)?8:16),jo>0&&!i&&zn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&zn.push(l),l}const je=jm;function jm(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===lf)&&(e=vn),Fo(e)){const a=hs(e,t,!0);return n&&Fl(a,n),jo>0&&!o&&zn&&(a.shapeFlag&6?zn[zn.indexOf(e)]=a:zn.push(a)),a.patchFlag=-2,a}if(Gm(e)&&(e=e.__vccOpts),t){t=Fm(t);let{class:a,style:l}=t;a&&!qt(a)&&(t.class=rt(a)),Pt(l)&&(Ol(l)&&!Ke(l)&&(l=nn({},l)),t.style=us(l))}const i=qt(e)?1:If(e)?128:Xd(e)?64:Pt(e)?4:st(e)?2:0;return v(e,t,n,r,s,i,o,!0)}function Fm(e){return e?Ol(e)||vf(e)?nn({},e):e:null}function hs(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,f=t?Af(s||{},t):s,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:f,key:f&&Cf(f),ref:t&&t.ref?n&&o?Ke(o)?o.concat(mi(t)):[o,mi(t)]:mi(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&&hs(e.ssContent),ssFallback:e.ssFallback&&hs(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Do(u,l.clone(u)),u}function Bo(e=" ",t=0){return je(Gi,null,e,t)}function fe(e="",t=!1){return t?(w(),_t(vn,null,e)):je(vn,null,e)}function vr(e){return e==null||typeof e=="boolean"?je(vn):Ke(e)?je(De,null,e.slice()):Fo(e)?Or(e):je(Gi,null,String(e))}function Or(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:hs(e)}function Fl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Ke(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),Fl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!vf(t)?t._ctx=cn:s===3&&cn&&(cn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else st(t)?(t={default:t,_ctx:cn},n=32):(t=String(t),r&64?(n=16,t=[Bo(t)]):n=8);e.children=t,e.shapeFlag|=n}function Af(...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=rt([t.class,r.class]));else if(s==="style")t.style=us([t.style,r.style]);else if(Li(s)){const o=t[s],i=r[s];i&&o!==i&&!(Ke(o)&&o.includes(i))&&(t[s]=o?[].concat(o,i):i)}else s!==""&&(t[s]=r[s])}return t}function hr(e,t,n,r=null){dr(e,t,7,[n,r])}const Bm=ff();let Um=0;function Hm(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Bm,o={uid:Um++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new hp(!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:wf(r,s),emitsOptions:hf(r,s),emit:null,emitted:null,propsDefaults:Dt,inheritAttrs:r.inheritAttrs,ctx:Dt,data:Dt,props:Dt,attrs:Dt,slots:Dt,refs:Dt,setupState:Dt,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=bm.bind(null,o),e.ce&&e.ce(o),o}let yn=null;const Bl=()=>yn||cn;let Ai,Za;{const e=Fi(),t=(n,r)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(r),o=>{s.length>1?s.forEach(i=>i(o)):s[0](o)}};Ai=t("__VUE_INSTANCE_SETTERS__",n=>yn=n),Za=t("__VUE_SSR_SETTERS__",n=>Uo=n)}const Yo=e=>{const t=yn;return Ai(e),e.scope.on(),()=>{e.scope.off(),Ai(t)}},xc=()=>{yn&&yn.scope.off(),Ai(null)};function xf(e){return e.vnode.shapeFlag&4}let Uo=!1;function Wm(e,t=!1,n=!1){t&&Za(t);const{props:r,children:s}=e.vnode,o=xf(e);Em(e,r,o,t),Rm(e,s,n||t);const i=o?Vm(e,t):void 0;return t&&Za(!1),i}function Vm(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,cm);const{setup:r}=n;if(r){Br();const s=e.setupContext=r.length>1?Pf(e):null,o=Yo(e),i=Jo(r,e,0,[e.props,s]),a=bd(i);if(Ur(),o(),(a||e.sp)&&!Qs(e)&&of(e),a){if(i.then(xc,xc),t)return i.then(l=>{Rc(e,l)}).catch(l=>{Hi(l,e,0)});e.asyncDep=i}else Rc(e,i)}else Rf(e)}function Rc(e,t,n){st(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Pt(t)&&(e.setupState=Wd(t)),Rf(e)}function Rf(e,t,n){const r=e.type;e.render||(e.render=r.render||kr);{const s=Yo(e);Br();try{fm(e)}finally{Ur(),s()}}}const zm={get(e,t){return gn(e,"get",""),e[t]}};function Pf(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,zm),slots:e.slots,emit:e.emit,expose:t}}function Ki(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Wd($p(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ao)return Ao[n](e)},has(t,n){return n in t||n in Ao}})):e.proxy}function qm(e,t=!0){return st(e)?e.displayName||e.name:e.name||t&&e.__name}function Gm(e){return st(e)&&"__vccOpts"in e}const de=(e,t)=>jp(e,t,Uo);function Ul(e,t,n){try{Ci(-1);const r=arguments.length;return r===2?Pt(t)&&!Ke(t)?Fo(t)?je(e,null,[t]):je(e,t):je(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Fo(n)&&(n=[n]),je(e,t,n))}finally{Ci(1)}}const Km="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 el;const Pc=typeof window<"u"&&window.trustedTypes;if(Pc)try{el=Pc.createPolicy("vue",{createHTML:e=>e})}catch{}const Mf=el?e=>el.createHTML(e):e=>e,Jm="http://www.w3.org/2000/svg",Ym="http://www.w3.org/1998/Math/MathML",Mr=typeof document<"u"?document:null,Mc=Mr&&Mr.createElement("template"),Qm={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"?Mr.createElementNS(Jm,e):t==="mathml"?Mr.createElementNS(Ym,e):n?Mr.createElement(e,{is:n}):Mr.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>Mr.createTextNode(e),createComment:e=>Mr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Mr.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{Mc.innerHTML=Mf(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=Mc.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]}},ts="transition",vo="animation",Ho=Symbol("_vtc"),$f={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},Xm=nn({},ef,$f),Zm=e=>(e.displayName="Transition",e.props=Xm,e),Of=Zm((e,{slots:t})=>Ul(Yp,eg(e),t)),Is=(e,t=[])=>{Ke(e)?e.forEach(n=>n(...t)):e&&e(...t)},$c=e=>e?Ke(e)?e.some(t=>t.length>1):e.length>1:!1;function eg(e){const t={};for(const te in e)te in $f||(t[te]=e[te]);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,U=tg(s),$=U&&U[0],X=U&&U[1],{onBeforeEnter:ce,onEnter:K,onEnterCancelled:ee,onLeave:re,onLeaveCancelled:we,onBeforeAppear:Te=ce,onAppear:me=K,onAppearCancelled:Me=ee}=t,ae=(te,Re,Je,ze)=>{te._enterCancelled=ze,Es(te,Re?u:a),Es(te,Re?f:i),Je&&Je()},se=(te,Re)=>{te._isLeaving=!1,Es(te,g),Es(te,E),Es(te,_),Re&&Re()},ue=te=>(Re,Je)=>{const ze=te?me:K,We=()=>ae(Re,te,Je);Is(ze,[Re,We]),Oc(()=>{Es(Re,te?l:o),Rr(Re,te?u:a),$c(ze)||Nc(Re,r,$,We)})};return nn(t,{onBeforeEnter(te){Is(ce,[te]),Rr(te,o),Rr(te,i)},onBeforeAppear(te){Is(Te,[te]),Rr(te,l),Rr(te,f)},onEnter:ue(!1),onAppear:ue(!0),onLeave(te,Re){te._isLeaving=!0;const Je=()=>se(te,Re);Rr(te,g),te._enterCancelled?(Rr(te,_),jc(te)):(jc(te),Rr(te,_)),Oc(()=>{te._isLeaving&&(Es(te,g),Rr(te,E),$c(re)||Nc(te,r,X,Je))}),Is(re,[te,Je])},onEnterCancelled(te){ae(te,!1,void 0,!0),Is(ee,[te])},onAppearCancelled(te){ae(te,!0,void 0,!0),Is(Me,[te])},onLeaveCancelled(te){se(te),Is(we,[te])}})}function tg(e){if(e==null)return null;if(Pt(e))return[da(e.enter),da(e.leave)];{const t=da(e);return[t,t]}}function da(e){return op(e)}function Rr(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Ho]||(e[Ho]=new Set)).add(t)}function Es(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Ho];n&&(n.delete(t),n.size||(e[Ho]=void 0))}function Oc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let ng=0;function Nc(e,t,n,r){const s=e._endId=++ng,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=rg(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 rg(e,t){const n=window.getComputedStyle(e),r=U=>(n[U]||"").split(", "),s=r(`${ts}Delay`),o=r(`${ts}Duration`),i=Lc(s,o),a=r(`${vo}Delay`),l=r(`${vo}Duration`),f=Lc(a,l);let u=null,g=0,_=0;t===ts?i>0&&(u=ts,g=i,_=o.length):t===vo?f>0&&(u=vo,g=f,_=l.length):(g=Math.max(i,f),u=g>0?i>f?ts:vo:null,_=u?u===ts?o.length:l.length:0);const E=u===ts&&/\b(?:transform|all)(?:,|$)/.test(r(`${ts}Property`).toString());return{type:u,timeout:g,propCount:_,hasTransform:E}}function Lc(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Dc(n)+Dc(e[r])))}function Dc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function jc(e){return(e?e.ownerDocument:document).body.offsetHeight}function sg(e,t,n){const r=e[Ho];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Fc=Symbol("_vod"),og=Symbol("_vsh"),ig=Symbol(""),ag=/(?:^|;)\s*display\s*:/;function lg(e,t,n){const r=e.style,s=qt(n);let o=!1;if(n&&!s){if(t)if(qt(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&gi(r,a,"")}else for(const i in t)n[i]==null&&gi(r,i,"");for(const i in n)i==="display"&&(o=!0),gi(r,i,n[i])}else if(s){if(t!==n){const i=r[ig];i&&(n+=";"+i),r.cssText=n,o=ag.test(n)}}else t&&e.removeAttribute("style");Fc in e&&(e[Fc]=o?r.display:"",e[og]&&(r.display="none"))}const Bc=/\s*!important$/;function gi(e,t,n){if(Ke(n))n.forEach(r=>gi(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=cg(e,t);Bc.test(n)?e.setProperty(ps(r),n.replace(Bc,""),"important"):e[r]=n}}const Uc=["Webkit","Moz","ms"],fa={};function cg(e,t){const n=fa[t];if(n)return n;let r=xn(t);if(r!=="filter"&&r in e)return fa[t]=r;r=ji(r);for(let s=0;s<Uc.length;s++){const o=Uc[s]+r;if(o in e)return fa[t]=o}return t}const Hc="http://www.w3.org/1999/xlink";function Wc(e,t,n,r,s,o=dp(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Hc,t.slice(6,t.length)):e.setAttributeNS(Hc,t,n):n==null||o&&!Sd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":cr(n)?String(n):n)}function Vc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Mf(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=Sd(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 qs(e,t,n,r){e.addEventListener(t,n,r)}function ug(e,t,n,r){e.removeEventListener(t,n,r)}const zc=Symbol("_vei");function dg(e,t,n,r,s=null){const o=e[zc]||(e[zc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=fg(t);if(r){const f=o[t]=mg(r,s);qs(e,a,f,l)}else i&&(ug(e,a,i,l),o[t]=void 0)}}const qc=/(?:Once|Passive|Capture)$/;function fg(e){let t;if(qc.test(e)){t={};let r;for(;r=e.match(qc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):ps(e.slice(2)),t]}let ha=0;const hg=Promise.resolve(),pg=()=>ha||(hg.then(()=>ha=0),ha=Date.now());function mg(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;dr(gg(r,n.value),t,5,[r])};return n.value=e,n.attached=pg(),n}function gg(e,t){if(Ke(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 Gc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,vg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?sg(e,r,i):t==="style"?lg(e,n,r):Li(t)?Tl(t)||dg(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):yg(e,t,r,i))?(Vc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Wc(e,t,r,i,o,t!=="value")):e._isVueCE&&(wg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!qt(r)))?Vc(e,xn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Wc(e,t,r,i))};function yg(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Gc(t)&&st(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 Gc(t)&&qt(n)?!1:t in e}function wg(e,t){const n=e._def.props;if(!n)return!1;const r=xn(t);return Array.isArray(n)?n.some(s=>xn(s)===r):Object.keys(n).some(s=>xn(s)===r)}const Kc=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ke(t)?n=>fi(t,n):t};function bg(e){e.target.composing=!0}function Jc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const pa=Symbol("_assign");function Yc(e,t,n){return t&&(e=e.trim()),n&&(e=El(e)),e}const Vr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[pa]=Kc(s);const o=r||s.props&&s.props.type==="number";qs(e,t?"change":"input",i=>{i.target.composing||e[pa](Yc(e.value,n,o))}),(n||o)&&qs(e,"change",()=>{e.value=Yc(e.value,n,o)}),t||(qs(e,"compositionstart",bg),qs(e,"compositionend",Jc),qs(e,"change",Jc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[pa]=Kc(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?El(e.value):e.value,l=t??"";a!==l&&(document.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l))}},_g=["ctrl","shift","alt","meta"],kg={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)=>_g.some(n=>e[`${n}Key`]&&!t.includes(n))},It=(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=kg[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},Tg={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},An=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=ps(s.key);if(t.some(i=>i===o||Tg[i]===o))return e(s)}))},Sg=nn({patchProp:vg},Qm);let Qc;function Ig(){return Qc||(Qc=Mm(Sg))}const Eg=((...e)=>{const t=Ig().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=Ag(r);if(!s)return;const o=t._component;!st(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,Cg(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function Cg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Ag(e){return qt(e)?document.querySelector(e):e}/*!
18
+ * vue-router v4.6.4
19
+ * (c) 2025 Eduardo San Martin Morote
20
+ * @license MIT
21
+ */const Gs=typeof document<"u";function Nf(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function xg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&Nf(e.default)}const xt=Object.assign;function ma(e,t){const n={};for(const r in t){const s=t[r];n[r]=fr(s)?s.map(e):e(s)}return n}const Ro=()=>{},fr=Array.isArray;function Xc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Lf=/#/g,Rg=/&/g,Pg=/\//g,Mg=/=/g,$g=/\?/g,Df=/\+/g,Og=/%5B/g,Ng=/%5D/g,jf=/%5E/g,Lg=/%60/g,Ff=/%7B/g,Dg=/%7C/g,Bf=/%7D/g,jg=/%20/g;function Hl(e){return e==null?"":encodeURI(""+e).replace(Dg,"|").replace(Og,"[").replace(Ng,"]")}function Fg(e){return Hl(e).replace(Ff,"{").replace(Bf,"}").replace(jf,"^")}function tl(e){return Hl(e).replace(Df,"%2B").replace(jg,"+").replace(Lf,"%23").replace(Rg,"%26").replace(Lg,"`").replace(Ff,"{").replace(Bf,"}").replace(jf,"^")}function Bg(e){return tl(e).replace(Mg,"%3D")}function Ug(e){return Hl(e).replace(Lf,"%23").replace($g,"%3F")}function Hg(e){return Ug(e).replace(Pg,"%2F")}function Wo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Wg=/\/$/,Vg=e=>e.replace(Wg,"");function ga(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=Kg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:Wo(i)}}function zg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function Zc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function qg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&so(t.matched[r],n.matched[s])&&Uf(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function so(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Uf(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Gg(e[n],t[n]))return!1;return!0}function Gg(e,t){return fr(e)?eu(e,t):fr(t)?eu(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function eu(e,t){return fr(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Kg(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 ns={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let nl=(function(e){return e.pop="pop",e.push="push",e})({}),va=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function Jg(e){if(!e)if(Gs){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Vg(e)}const Yg=/^[^#]+#/;function Qg(e,t){return e.replace(Yg,"#")+t}function Xg(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 Ji=()=>({left:window.scrollX,top:window.scrollY});function Zg(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=Xg(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 tu(e,t){return(history.state?history.state.position-t:-1)+e}const rl=new Map;function ev(e,t){rl.set(e,t)}function tv(e){const t=rl.get(e);return rl.delete(e),t}function nv(e){return typeof e=="string"||e&&typeof e=="object"}function Hf(e){return typeof e=="string"||typeof e=="symbol"}let Kt=(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 Wf=Symbol("");Kt.MATCHER_NOT_FOUND+"",Kt.NAVIGATION_GUARD_REDIRECT+"",Kt.NAVIGATION_ABORTED+"",Kt.NAVIGATION_CANCELLED+"",Kt.NAVIGATION_DUPLICATED+"";function oo(e,t){return xt(new Error,{type:e,[Wf]:!0},t)}function Pr(e,t){return e instanceof Error&&Wf in e&&(t==null||!!(e.type&t))}const rv=["params","query","hash"];function sv(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of rv)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function ov(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(Df," "),o=s.indexOf("="),i=Wo(o<0?s:s.slice(0,o)),a=o<0?null:Wo(s.slice(o+1));if(i in t){let l=t[i];fr(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function nu(e){let t="";for(let n in e){const r=e[n];if(n=Bg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(fr(r)?r.map(s=>s&&tl(s)):[r&&tl(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function iv(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=fr(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const av=Symbol(""),ru=Symbol(""),Yi=Symbol(""),Wl=Symbol(""),sl=Symbol("");function yo(){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 is(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(oo(Kt.NAVIGATION_ABORTED,{from:n,to:t})):_ instanceof Error?l(_):nv(_)?l(oo(Kt.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 ya(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(Nf(l)){const f=(l.__vccOpts||l)[t];f&&o.push(is(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=xg(u)?u.default:u;i.mods[a]=u,i.components[a]=g;const _=(g.__vccOpts||g)[t];return _&&is(_,n,r,i,a,s)()}))}}return o}function lv(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=>so(f,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(f=>so(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 cv=()=>location.protocol+"//"+location.host;function Vf(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),Zc(a,"")}return Zc(n,e)+r+s}function uv(e,t,n,r){let s=[],o=[],i=null;const a=({state:_})=>{const E=Vf(e,location),U=n.value,$=t.value;let X=0;if(_){if(n.value=E,t.value=_,i&&i===U){i=null;return}X=$?_.position-$.position:0}else r(E);s.forEach(ce=>{ce(n.value,U,{delta:X,type:nl.pop,direction:X?X>0?va.forward:va.back:va.unknown})})};function l(){i=n.value}function f(_){s.push(_);const E=()=>{const U=s.indexOf(_);U>-1&&s.splice(U,1)};return o.push(E),E}function u(){if(document.visibilityState==="hidden"){const{history:_}=window;if(!_.state)return;_.replaceState(xt({},_.state,{scroll:Ji()}),"")}}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 su(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Ji():null}}function dv(e){const{history:t,location:n}=window,r={value:Vf(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:cv()+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,xt({},t.state,su(s.value.back,l,s.value.forward,!0),f,{position:s.value.position}),!0),r.value=l}function a(l,f){const u=xt({},s.value,t.state,{forward:l,scroll:Ji()});o(u.current,u,!0),o(l,xt({},su(r.value,l,null),{position:u.position+1},f),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function fv(e){e=Jg(e);const t=dv(e),n=uv(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=xt({location:"",base:e,go:r,createHref:Qg.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 hv(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),fv(e)}let Ms=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var tn=(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})(tn||{});const pv={type:Ms.Static,value:""},mv=/[a-zA-Z0-9_]/;function gv(e){if(!e)return[[]];if(e==="/")return[[pv]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(E){throw new Error(`ERR (${n})/"${f}": ${E}`)}let n=tn.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,f="",u="";function g(){f&&(n===tn.Static?o.push({type:Ms.Static,value:f}):n===tn.Param||n===tn.ParamRegExp||n===tn.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${f}) must be alone in its segment. eg: '/:ids+.`),o.push({type:Ms.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!==tn.ParamRegExp){r=n,n=tn.EscapeNext;continue}switch(n){case tn.Static:l==="/"?(f&&g(),i()):l===":"?(g(),n=tn.Param):_();break;case tn.EscapeNext:_(),n=r;break;case tn.Param:l==="("?n=tn.ParamRegExp:mv.test(l)?_():(g(),n=tn.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case tn.ParamRegExp:l===")"?u[u.length-1]=="\\"?u=u.slice(0,-1)+l:n=tn.ParamRegExpEnd:u+=l;break;case tn.ParamRegExpEnd:g(),n=tn.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,u="";break;default:t("Unknown state");break}}return n===tn.ParamRegExp&&t(`Unfinished custom RegExp for param "${f}"`),g(),i(),s}const ou="[^/]+?",vv={sensitive:!1,strict:!1,start:!0,end:!0};var En=(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})(En||{});const yv=/[.+*?^${}()[\]/\\]/g;function wv(e,t){const n=xt({},vv,t),r=[];let s=n.start?"^":"";const o=[];for(const f of e){const u=f.length?[]:[En.Root];n.strict&&!f.length&&(s+="/");for(let g=0;g<f.length;g++){const _=f[g];let E=En.Segment+(n.sensitive?En.BonusCaseSensitive:0);if(_.type===Ms.Static)g||(s+="/"),s+=_.value.replace(yv,"\\$&"),E+=En.Static;else if(_.type===Ms.Param){const{value:U,repeatable:$,optional:X,regexp:ce}=_;o.push({name:U,repeatable:$,optional:X});const K=ce||ou;if(K!==ou){E+=En.BonusCustomRegExp;try{`${K}`}catch(re){throw new Error(`Invalid custom RegExp for param "${U}" (${K}): `+re.message)}}let ee=$?`((?:${K})(?:/(?:${K}))*)`:`(${K})`;g||(ee=X&&f.length<2?`(?:/${ee})`:"/"+ee),X&&(ee+="?"),s+=ee,E+=En.Dynamic,X&&(E+=En.BonusOptional),$&&(E+=En.BonusRepeatable),K===".*"&&(E+=En.BonusWildcard)}u.push(E)}r.push(u)}if(n.strict&&n.end){const f=r.length-1;r[f][r[f].length-1]+=En.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[_]||"",U=o[_-1];g[U.name]=E&&U.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===Ms.Static)u+=E.value;else if(E.type===Ms.Param){const{value:U,repeatable:$,optional:X}=E,ce=U in f?f[U]:"";if(fr(ce)&&!$)throw new Error(`Provided param "${U}" is an array but it is not repeatable (* or + modifiers)`);const K=fr(ce)?ce.join("/"):ce;if(!K)if(X)_.length<2&&(u.endsWith("/")?u=u.slice(0,-1):g=!0);else throw new Error(`Missing required param "${U}"`);u+=K}}return u||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function bv(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]===En.Static+En.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===En.Static+En.Segment?1:-1:0}function zf(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=bv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(iu(r))return 1;if(iu(s))return-1}return s.length-r.length}function iu(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const _v={strict:!1,end:!0,sensitive:!1};function kv(e,t,n){const r=wv(gv(e.path),n),s=xt(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function Tv(e,t){const n=[],r=new Map;t=Xc(_v,t);function s(g){return r.get(g)}function o(g,_,E){const U=!E,$=lu(g);$.aliasOf=E&&E.record;const X=Xc(t,g),ce=[$];if("alias"in g){const re=typeof g.alias=="string"?[g.alias]:g.alias;for(const we of re)ce.push(lu(xt({},$,{components:E?E.record.components:$.components,path:we,aliasOf:E?E.record:$})))}let K,ee;for(const re of ce){const{path:we}=re;if(_&&we[0]!=="/"){const Te=_.record.path,me=Te[Te.length-1]==="/"?"":"/";re.path=_.record.path+(we&&me+we)}if(K=kv(re,_,X),E?E.alias.push(K):(ee=ee||K,ee!==K&&ee.alias.push(K),U&&g.name&&!cu(K)&&i(g.name)),qf(K)&&l(K),$.children){const Te=$.children;for(let me=0;me<Te.length;me++)o(Te[me],K,E&&E.children[me])}E=E||K}return ee?()=>{i(ee)}:Ro}function i(g){if(Hf(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 _=Ev(g,n);n.splice(_,0,g),g.record.name&&!cu(g)&&r.set(g.record.name,g)}function f(g,_){let E,U={},$,X;if("name"in g&&g.name){if(E=r.get(g.name),!E)throw oo(Kt.MATCHER_NOT_FOUND,{location:g});X=E.record.name,U=xt(au(_.params,E.keys.filter(ee=>!ee.optional).concat(E.parent?E.parent.keys.filter(ee=>ee.optional):[]).map(ee=>ee.name)),g.params&&au(g.params,E.keys.map(ee=>ee.name))),$=E.stringify(U)}else if(g.path!=null)$=g.path,E=n.find(ee=>ee.re.test($)),E&&(U=E.parse($),X=E.record.name);else{if(E=_.name?r.get(_.name):n.find(ee=>ee.re.test(_.path)),!E)throw oo(Kt.MATCHER_NOT_FOUND,{location:g,currentLocation:_});X=E.record.name,U=xt({},_.params,g.params),$=E.stringify(U)}const ce=[];let K=E;for(;K;)ce.unshift(K.record),K=K.parent;return{name:X,path:$,params:U,matched:ce,meta:Iv(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 au(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function lu(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:Sv(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 Sv(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 cu(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function Iv(e){return e.reduce((t,n)=>xt(t,n.meta),{})}function Ev(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;zf(e,t[o])<0?r=o:n=o+1}const s=Cv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function Cv(e){let t=e;for(;t=t.parent;)if(qf(t)&&zf(e,t)===0)return t}function qf({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function uu(e){const t=ar(Yi),n=ar(Wl),r=de(()=>{const l=_e(e.to);return t.resolve(l)}),s=de(()=>{const{matched:l}=r.value,{length:f}=l,u=l[f-1],g=n.matched;if(!u||!g.length)return-1;const _=g.findIndex(so.bind(null,u));if(_>-1)return _;const E=du(l[f-2]);return f>1&&du(u)===E&&g[g.length-1].path!==E?g.findIndex(so.bind(null,l[f-2])):_}),o=de(()=>s.value>-1&&Mv(n.params,r.value.params)),i=de(()=>s.value>-1&&s.value===n.matched.length-1&&Uf(n.params,r.value.params));function a(l={}){if(Pv(l)){const f=t[_e(e.replace)?"replace":"push"](_e(e.to)).catch(Ro);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>f),f}return Promise.resolve()}return{route:r,href:de(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function Av(e){return e.length===1?e[0]:e}const xv=on({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:uu,setup(e,{slots:t}){const n=Ui(uu(e)),{options:r}=ar(Yi),s=de(()=>({[fu(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[fu(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&Av(t.default(n));return e.custom?o:Ul("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),Rv=xv;function Pv(e){if(!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&!(e.button!==void 0&&e.button!==0)){if(e.currentTarget&&e.currentTarget.getAttribute){const t=e.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(t))return}return e.preventDefault&&e.preventDefault(),!0}}function Mv(e,t){for(const n in t){const r=t[n],s=e[n];if(typeof r=="string"){if(r!==s)return!1}else if(!fr(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function du(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const fu=(e,t,n)=>e??t??n,$v=on({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=ar(sl),s=de(()=>e.route||r.value),o=ar(ru,0),i=de(()=>{let f=_e(o);const{matched:u}=s.value;let g;for(;(g=u[f])&&!g.components;)f++;return f}),a=de(()=>s.value.matched[i.value]);hi(ru,de(()=>i.value+1)),hi(av,a),hi(sl,s);const l=j();return pt(()=>[l.value,a.value,e.name],([f,u,g],[_,E,U])=>{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||!so(u,E)||!_)&&(u.enterCallbacks[g]||[]).forEach($=>$(f))},{flush:"post"}),()=>{const f=s.value,u=e.name,g=a.value,_=g&&g.components[u];if(!_)return hu(n.default,{Component:_,route:f});const E=g.props[u],U=E?E===!0?f.params:typeof E=="function"?E(f):E:null,X=Ul(_,xt({},U,t,{onVnodeUnmounted:ce=>{ce.component.isUnmounted&&(g.instances[u]=null)},ref:l}));return hu(n.default,{Component:X,route:f})||X}}});function hu(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const Ov=$v;function Nv(e){const t=Tv(e.routes,e),n=e.parseQuery||ov,r=e.stringifyQuery||nu,s=e.history,o=yo(),i=yo(),a=yo(),l=Op(ns);let f=ns;Gs&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const u=ma.bind(null,W=>""+W),g=ma.bind(null,Hg),_=ma.bind(null,Wo);function E(W,be){let he,Ee;return Hf(W)?(he=t.getRecordMatcher(W),Ee=be):Ee=W,t.addRoute(Ee,he)}function U(W){const be=t.getRecordMatcher(W);be&&t.removeRoute(be)}function $(){return t.getRoutes().map(W=>W.record)}function X(W){return!!t.getRecordMatcher(W)}function ce(W,be){if(be=xt({},be||l.value),typeof W=="string"){const O=ga(n,W,be.path),Z=t.resolve({path:O.path},be),J=s.createHref(O.fullPath);return xt(O,Z,{params:_(Z.params),hash:Wo(O.hash),redirectedFrom:void 0,href:J})}let he;if(W.path!=null)he=xt({},W,{path:ga(n,W.path,be.path).path});else{const O=xt({},W.params);for(const Z in O)O[Z]==null&&delete O[Z];he=xt({},W,{params:g(O)}),be.params=g(be.params)}const Ee=t.resolve(he,be),Ae=W.hash||"";Ee.params=u(_(Ee.params));const T=zg(r,xt({},W,{hash:Fg(Ae),path:Ee.path})),S=s.createHref(T);return xt({fullPath:T,hash:Ae,query:r===nu?iv(W.query):W.query||{}},Ee,{redirectedFrom:void 0,href:S})}function K(W){return typeof W=="string"?ga(n,W,l.value.path):xt({},W)}function ee(W,be){if(f!==W)return oo(Kt.NAVIGATION_CANCELLED,{from:be,to:W})}function re(W){return me(W)}function we(W){return re(xt(K(W),{replace:!0}))}function Te(W,be){const he=W.matched[W.matched.length-1];if(he&&he.redirect){const{redirect:Ee}=he;let Ae=typeof Ee=="function"?Ee(W,be):Ee;return typeof Ae=="string"&&(Ae=Ae.includes("?")||Ae.includes("#")?Ae=K(Ae):{path:Ae},Ae.params={}),xt({query:W.query,hash:W.hash,params:Ae.path!=null?{}:W.params},Ae)}}function me(W,be){const he=f=ce(W),Ee=l.value,Ae=W.state,T=W.force,S=W.replace===!0,O=Te(he,Ee);if(O)return me(xt(K(O),{state:typeof O=="object"?xt({},Ae,O.state):Ae,force:T,replace:S}),be||he);const Z=he;Z.redirectedFrom=be;let J;return!T&&qg(r,Ee,he)&&(J=oo(Kt.NAVIGATION_DUPLICATED,{to:Z,from:Ee}),ke(Ee,Ee,!0,!1)),(J?Promise.resolve(J):se(Z,Ee)).catch(M=>Pr(M)?Pr(M,Kt.NAVIGATION_GUARD_REDIRECT)?M:et(M):Pe(M,Z,Ee)).then(M=>{if(M){if(Pr(M,Kt.NAVIGATION_GUARD_REDIRECT))return me(xt({replace:S},K(M.to),{state:typeof M.to=="object"?xt({},Ae,M.to.state):Ae,force:T}),be||Z)}else M=te(Z,Ee,!0,S,Ae);return ue(Z,Ee,M),M})}function Me(W,be){const he=ee(W,be);return he?Promise.reject(he):Promise.resolve()}function ae(W){const be=gt.values().next().value;return be&&typeof be.runWithContext=="function"?be.runWithContext(W):W()}function se(W,be){let he;const[Ee,Ae,T]=lv(W,be);he=ya(Ee.reverse(),"beforeRouteLeave",W,be);for(const O of Ee)O.leaveGuards.forEach(Z=>{he.push(is(Z,W,be))});const S=Me.bind(null,W,be);return he.push(S),qe(he).then(()=>{he=[];for(const O of o.list())he.push(is(O,W,be));return he.push(S),qe(he)}).then(()=>{he=ya(Ae,"beforeRouteUpdate",W,be);for(const O of Ae)O.updateGuards.forEach(Z=>{he.push(is(Z,W,be))});return he.push(S),qe(he)}).then(()=>{he=[];for(const O of T)if(O.beforeEnter)if(fr(O.beforeEnter))for(const Z of O.beforeEnter)he.push(is(Z,W,be));else he.push(is(O.beforeEnter,W,be));return he.push(S),qe(he)}).then(()=>(W.matched.forEach(O=>O.enterCallbacks={}),he=ya(T,"beforeRouteEnter",W,be,ae),he.push(S),qe(he))).then(()=>{he=[];for(const O of i.list())he.push(is(O,W,be));return he.push(S),qe(he)}).catch(O=>Pr(O,Kt.NAVIGATION_CANCELLED)?O:Promise.reject(O))}function ue(W,be,he){a.list().forEach(Ee=>ae(()=>Ee(W,be,he)))}function te(W,be,he,Ee,Ae){const T=ee(W,be);if(T)return T;const S=be===ns,O=Gs?history.state:{};he&&(Ee||S?s.replace(W.fullPath,xt({scroll:S&&O&&O.scroll},Ae)):s.push(W.fullPath,Ae)),l.value=W,ke(W,be,he,S),et()}let Re;function Je(){Re||(Re=s.listen((W,be,he)=>{if(!mt.listening)return;const Ee=ce(W),Ae=Te(Ee,mt.currentRoute.value);if(Ae){me(xt(Ae,{replace:!0,force:!0}),Ee).catch(Ro);return}f=Ee;const T=l.value;Gs&&ev(tu(T.fullPath,he.delta),Ji()),se(Ee,T).catch(S=>Pr(S,Kt.NAVIGATION_ABORTED|Kt.NAVIGATION_CANCELLED)?S:Pr(S,Kt.NAVIGATION_GUARD_REDIRECT)?(me(xt(K(S.to),{force:!0}),Ee).then(O=>{Pr(O,Kt.NAVIGATION_ABORTED|Kt.NAVIGATION_DUPLICATED)&&!he.delta&&he.type===nl.pop&&s.go(-1,!1)}).catch(Ro),Promise.reject()):(he.delta&&s.go(-he.delta,!1),Pe(S,Ee,T))).then(S=>{S=S||te(Ee,T,!1),S&&(he.delta&&!Pr(S,Kt.NAVIGATION_CANCELLED)?s.go(-he.delta,!1):he.type===nl.pop&&Pr(S,Kt.NAVIGATION_ABORTED|Kt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),ue(Ee,T,S)}).catch(Ro)}))}let ze=yo(),We=yo(),He;function Pe(W,be,he){et(W);const Ee=We.list();return Ee.length?Ee.forEach(Ae=>Ae(W,be,he)):console.error(W),Promise.reject(W)}function nt(){return He&&l.value!==ns?Promise.resolve():new Promise((W,be)=>{ze.add([W,be])})}function et(W){return He||(He=!W,Je(),ze.list().forEach(([be,he])=>W?he(W):be()),ze.reset()),W}function ke(W,be,he,Ee){const{scrollBehavior:Ae}=e;if(!Gs||!Ae)return Promise.resolve();const T=!he&&tv(tu(W.fullPath,0))||(Ee||!he)&&history.state&&history.state.scroll||null;return Zt().then(()=>Ae(W,be,T)).then(S=>S&&Zg(S)).catch(S=>Pe(S,W,be))}const at=W=>s.go(W);let Ot;const gt=new Set,mt={currentRoute:l,listening:!0,addRoute:E,removeRoute:U,clearRoutes:t.clearRoutes,hasRoute:X,getRoutes:$,resolve:ce,options:e,push:re,replace:we,go:at,back:()=>at(-1),forward:()=>at(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:We.add,isReady:nt,install(W){W.component("RouterLink",Rv),W.component("RouterView",Ov),W.config.globalProperties.$router=mt,Object.defineProperty(W.config.globalProperties,"$route",{enumerable:!0,get:()=>_e(l)}),Gs&&!Ot&&l.value===ns&&(Ot=!0,re(s.location).catch(Ee=>{}));const be={};for(const Ee in ns)Object.defineProperty(be,Ee,{get:()=>l.value[Ee],enumerable:!0});W.provide(Yi,mt),W.provide(Wl,Ud(be)),W.provide(sl,l);const he=W.unmount;gt.add(W),W.unmount=function(){gt.delete(W),gt.size<1&&(f=ns,Re&&Re(),Re=null,l.value=ns,Ot=!1,He=!1),he()}}};function qe(W){return W.reduce((be,he)=>be.then(()=>ae(he)),Promise.resolve())}return mt}function Lv(){return ar(Yi)}function Dv(e){return ar(Wl)}const pu=768;function Vl(){const e=j(typeof window<"u"?window.innerWidth<pu:!1);let t=null;function n(r){e.value=r.matches}return Kr(()=>{t=window.matchMedia(`(max-width: ${pu-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),zi(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const jv={key:0,class:"desktop-sidebar"},Fv={class:"desktop-main"},mu="codex-web-local.sidebar-width.v1",Bv=260,Uv=620,gu=320,Hv=on({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Vl();function r(f){return Math.min(Uv,Math.max(Bv,f))}function s(){if(typeof window>"u")return gu;const f=window.localStorage.getItem(mu),u=Number(f);return Number.isFinite(u)?r(u):gu}const o=j(s()),i=de(()=>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(mu,String(f))}function l(f){f.preventDefault();const u=f.clientX,g=o.value,_=U=>{const $=U.clientX-u;o.value=r(g+$)},E=()=>{a(o.value),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",E)}return(f,u)=>(w(),k("div",{class:rt(["desktop-layout",{"is-mobile":_e(n)}]),style:us(i.value)},[_e(n)?(w(),_t(Eo,{key:0,to:"body"},[je(Of,{name:"drawer"},{default:At(()=>[e.isSidebarCollapsed?fe("",!0):(w(),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]=It(()=>{},["stop"]))},[_r(f.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):fe("",!0),_e(n)?fe("",!0):(w(),k(De,{key:1},[e.isSidebarCollapsed?fe("",!0):(w(),k("aside",jv,[_r(f.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?fe("",!0):(w(),k("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:l},null,32))],64)),v("section",Fv,[_r(f.$slots,"content",{},void 0)])],6))}}),wt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Wv=wt(Hv,[["__scopeId","data-v-068d06c5"]]),Vv={},zv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function qv(e,t){return w(),k("svg",zv,[...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 Qi=wt(Vv,[["render",qv]]),Gv={},Kv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Jv(e,t){return w(),k("svg",Kv,[...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 Gf=wt(Gv,[["render",Jv]]),Yv={},Qv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Xv(e,t){return w(),k("svg",Qv,[...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 wo=wt(Yv,[["render",Xv]]),Zv={},ey={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function ty(e,t){return w(),k("svg",ey,[...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 xi=wt(Zv,[["render",ty]]),ny={},ry={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function sy(e,t){return w(),k("svg",ry,[...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 zl=wt(ny,[["render",sy]]),oy={},iy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ay(e,t){return w(),k("svg",iy,[...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 ly=wt(oy,[["render",ay]]),cy={},uy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function dy(e,t){return w(),k("svg",uy,[...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 Po=wt(cy,[["render",dy]]),fy={},hy={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function py(e,t){return w(),k("svg",hy,[...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 wa=wt(fy,[["render",py]]),my={key:0,class:"sidebar-menu-row-left"},gy={class:"sidebar-menu-row-main"},vy={key:1,class:"sidebar-menu-row-right"},yy={key:0,class:"sidebar-menu-row-right-default"},wy={key:1,class:"sidebar-menu-row-right-hover"},by=on({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=um(),r=de(()=>!!n.left),s=de(()=>!!n.right),o=de(()=>!!n["right-hover"]),i=de(()=>s.value||o.value);return(a,l)=>(w(),_t(Ii(t.as),Af({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:At(()=>[r.value?(w(),k("span",my,[_r(a.$slots,"left",{},void 0,!0)])):fe("",!0),v("span",gy,[_r(a.$slots,"default",{},void 0,!0)]),i.value?(w(),k("span",vy,[s.value?(w(),k("span",yy,[_r(a.$slots,"right",{},void 0,!0)])):fe("",!0),o.value?(w(),k("span",wy,[_r(a.$slots,"right-hover",{},void 0,!0)])):fe("",!0)])):fe("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Cs=wt(by,[["__scopeId","data-v-36239f39"]]),_y={class:"thread-tree-root"},ky={key:0,class:"pinned-section"},Ty={class:"thread-list"},Sy=["data-menu-open"],Iy={class:"thread-left-stack"},Ey=["data-state"],Cy=["onClick"],Ay=["onClick"],xy={class:"thread-row-title-wrap"},Ry={class:"thread-row-title"},Py={class:"thread-row-time"},My=["onClick"],$y=["aria-expanded"],Oy=["data-active"],Ny={key:0},Ly=["data-active"],Dy={key:0},jy={key:1,class:"thread-tree-no-results"},Fy={key:2,class:"thread-tree-loading"},By={key:3,class:"thread-list thread-list-global"},Uy=["data-menu-open"],Hy={class:"thread-left-stack"},Wy=["data-state"],Vy=["onClick"],zy=["onClick"],qy={class:"thread-row-title-wrap"},Gy={class:"thread-row-title"},Ky={class:"thread-row-time"},Jy=["onClick"],Yy=["data-project-name","data-expanded","data-dragging"],Qy={class:"project-icon-stack"},Xy={class:"project-icon-folder"},Zy={class:"project-icon-chevron"},ew=["data-dragging-handle","onMousedown"],tw={class:"project-title"},nw={class:"project-hover-controls"},rw=["onClick"],sw=["data-open-direction"],ow=["onClick"],iw=["onClick"],aw=["onClick"],lw=["onInput"],cw=["aria-label","title","onClick"],uw={key:0,class:"thread-list"},dw=["data-menu-open"],fw={class:"thread-left-stack"},hw=["data-state"],pw=["onClick"],mw=["onClick"],gw={class:"thread-row-title-wrap"},vw={class:"thread-row-title"},yw={class:"thread-row-time"},ww=["onClick"],bw=["onClick"],_w=["data-open-direction"],kw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},Tw=["onKeydown"],Sw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},Iw={class:"rename-thread-subtitle"},Ew=4,vu=6,yu="codex-web-local.thread-view-mode.v1",wu="codex-web-local.collapsed-projects.v1",Cw=on({__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(""),U=j(!1),$=j(""),X=j(""),ce=j(null),K=j(!1),ee=j(""),re=j(""),we=j(null),Te=j(null),me=j(null);let Me=null,ae=null;const se=j(""),ue=j({}),te=new Map,Re=new Map,Je=new Map,ze=new WeakMap,We=j(null),He=j(null),Pe=j(!1),nt=j(at()),et=typeof window<"u"?new ResizeObserver(I=>{for(const R of I){const N=R.target,ne=ze.get(N);ne&&kn(ne,N)}}):null;function ke(){if(typeof window>"u")return{};try{const I=window.localStorage.getItem(wu);if(!I)return{};const R=JSON.parse(I);return!R||typeof R!="object"||Array.isArray(R)?{}:R}catch{return{}}}function at(){return typeof window>"u"?"project":window.localStorage.getItem(yu)==="chronological"?"chronological":"project"}o.value=ke(),pt(o,I=>{typeof window>"u"||window.localStorage.setItem(wu,JSON.stringify(I))},{deep:!0}),pt(nt,I=>{typeof window>"u"||window.localStorage.setItem(yu,I)});const Ot=de(()=>n.searchQuery.trim().toLowerCase()),gt=de(()=>Ot.value.length>0),mt=de(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null);function qe(I){if(!gt.value)return!0;if(mt.value)return mt.value.has(I.id);const R=Ot.value;return I.title.toLowerCase().includes(R)||I.preview.toLowerCase().includes(R)}const W=de(()=>gt.value?n.groups.map(I=>({...I,threads:I.threads.filter(qe)})).filter(I=>I.threads.length>0):n.groups),be=de(()=>nt.value==="chronological"),he=de(()=>{const I=W.value,R=[];for(const N of I)for(const ne of N.threads)z(ne.id)||R.push(ne);return R.sort((N,ne)=>{const Ue=new Date(N.updatedAtIso||N.createdAtIso).getTime();return new Date(ne.updatedAtIso||ne.createdAtIso).getTime()-Ue})}),Ee=de(()=>{const I=new Map;for(const R of n.groups)for(const N of R.threads)I.set(N.id,N);return I}),Ae=de(()=>{const I=l.value;return I?Ee.value.get(I)??null:null}),T=de(()=>i.value.map(I=>Ee.value.get(I)??null).filter(I=>I!==null).filter(qe)),S=de(()=>{const I=me.value;if(!I||I.dropTargetIndexFull===null||n.groups.length===0)return null;const R=Math.max(0,Math.min(I.dropTargetIndexFull,n.groups.length)),N=R>I.fromIndex?R-1:R,ne=Math.max(0,Math.min(N,n.groups.length-1));return ne===I.fromIndex?null:ne}),O=de(()=>{const R=(gt.value?W.value:n.groups).map(Vt=>Vt.projectName),N=me.value,ne=S.value;if(!N||ne===null)return R;const Ue=[...R],[ot]=Ue.splice(N.fromIndex,1);return ot?(Ue.splice(ne,0,ot),Ue):R}),Z=de(()=>{const I={};let R=0;for(const N of O.value)I[N]=R,R+=Ct(N);return I}),J=de(()=>{let I=0;for(const R of O.value)I+=Ct(R);return{height:`${Math.max(0,I)}px`}});function M(I){const R=new Date(I).getTime();if(Number.isNaN(R))return"n/a";const N=Math.abs(Date.now()-R);if(N<6e4)return"now";const ne=Math.floor(N/6e4);if(ne<60)return`${ne}m`;const Ue=Math.floor(ne/60);return Ue<24?`${Ue}h`:`${Math.floor(Ue/24)}d`}function z(I){return i.value.includes(I)}function q(I){if(z(I)){i.value=i.value.filter(R=>R!==I);return}i.value=[I,...i.value]}function Q(I){r("select",I)}function G(I){r("export-thread",I),xe()}function Ie(I){return`start new thread ${jt(I)}`}function ye(I){r("start-new-thread",I)}function Ce(I){return l.value===I}function xe(){l.value="",g.value={}}function Be(I){if(l.value===I){xe();return}ut(),Pe.value=!1,l.value=I,Zt(()=>{Mn(I)})}function lt(I,R){$.value=I,X.value=R,U.value=!0,xe(),Zt(()=>{var N,ne;(N=ce.value)==null||N.focus(),(ne=ce.value)==null||ne.select()})}function Ze(){U.value=!1,$.value="",X.value=""}function kt(){const I=$.value,R=X.value.trim();!I||!R||(r("rename-thread",{threadId:I,title:R}),Ze())}function vt(I,R){ee.value=I,re.value=R,K.value=!0,xe()}function Mt(){K.value=!1,ee.value="",re.value=""}function Ye(){const I=ee.value;I&&(i.value=i.value.filter(R=>R!==I),r("archive",I),Mt())}function jt(I){return n.projectDisplayNameById[I]??I}function Ht(I){return a.value===I}function ut(){a.value="",_.value="actions",E.value=""}function dt(){const I=!Pe.value;I&&(ut(),xe()),Pe.value=I}function bt(I){nt.value=I,Pe.value=!1}function rn(I){if(a.value===I){ut();return}xe(),Pe.value=!1,a.value=I,_.value="actions",E.value=jt(I),Zt(()=>{fn(I)})}function Tt(I){xe(),a.value=I,_.value="rename",E.value=jt(I),Zt(()=>{fn(I)})}function St(I){r("rename-project",{projectName:I,displayName:E.value})}function Pn(I){r("remove-project",I),ut()}function Dn(I){r("browse-project-files",I),ut()}function bn(I,R){if(!I.altKey||I.key!=="ArrowUp"&&I.key!=="ArrowDown")return;const N=n.groups.findIndex(ot=>ot.projectName===R);if(N<0)return;const ne=I.key==="ArrowUp"?-1:1,Ue=Math.max(0,Math.min(N+ne,n.groups.length-1));Ue!==N&&(I.preventDefault(),r("reorder-project",{projectName:R,toIndex:Ue}))}function Wt(I){return s.value[I]===!0}function Bt(I){return o.value[I]===!0}function Ut(I){s.value={...s.value,[I]:!Wt(I)}}function _n(I){if(se.value===I){se.value="";return}o.value={...o.value,[I]:!Bt(I)}}function Ct(I){const R=ue.value[I]??0,N=me.value,Ue=((N==null?void 0:N.projectName)===I?N.groupHeight:null)??R,ot=Bt(I)?0:vu;return Math.max(0,Ue+ot)}function an(I,R){const N=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(N){Re.set(I,N);return}Re.delete(I)}function en(I,R){const N=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(N){Je.set(I,N);return}Je.delete(I)}function jn(I){let R=I.parentElement;for(;R;){const N=window.getComputedStyle(R),ne=N.overflowY||N.overflow;if(ne==="auto"||ne==="scroll"||ne==="hidden"||ne==="clip")return R.getBoundingClientRect();R=R.parentElement}return new DOMRect(0,0,window.innerWidth,window.innerHeight)}function dn(I,R){const N=I.getBoundingClientRect(),ne=jn(I),Ue=6,ot=ne.bottom-N.bottom,Vt=N.top-ne.top;return ot>=R+Ue?"down":Vt>ot?"up":"down"}function sn(I,R){const N=Je.get(I);if(!N)return"down";const ne=dn(N,R);return u.value={...u.value,[I]:ne},ne}function er(I){return u.value[I]??"down"}function fn(I){const R=Re.get(I);R&&(f.value={...f.value,[I]:dn(R,112)})}function Yt(I,R,N){return Math.min(Math.max(I,R),N)}function Mn(I){const R=Je.get(I);if(!R)return;const N=He.value,ne=N==null?void 0:N.getBoundingClientRect(),Ue=(ne==null?void 0:ne.height)||(N==null?void 0:N.offsetHeight)||112,ot=(ne==null?void 0:ne.width)||(N==null?void 0:N.offsetWidth)||160,Vt=sn(I,Ue),Nn=R.getBoundingClientRect(),Gt=8,Jt=4,Tn=Math.max(Gt,window.innerWidth-ot-Gt),Wn=Yt(Nn.right-ot,Gt,Tn),Jn=Yt(Vt==="up"?Nn.top-Ue-Jt:Nn.bottom+Jt,Gt,Math.max(Gt,window.innerHeight-Ue-Gt));g.value={left:`${Math.round(Wn)}px`,top:`${Math.round(Jn)}px`}}function Ne(){const I=l.value;I&&Mn(I)}function $e(){window.addEventListener("resize",Ne),document.addEventListener("scroll",Ne,!0)}function qn(){window.removeEventListener("resize",Ne),document.removeEventListener("scroll",Ne,!0)}function Qt(I){const R=a.value;if(!R)return!1;const N=Re.get(R);if(!N)return!1;if((typeof I.composedPath=="function"?I.composedPath():[]).includes(N))return!0;const Ue=I.target;return Ue instanceof Node?N.contains(Ue):!1}function Fn(I){const R=l.value;if(!R)return!1;const N=Je.get(R);if(!N)return!1;if((typeof I.composedPath=="function"?I.composedPath():[]).includes(N))return!0;const Ue=I.target;return Ue instanceof Node?N.contains(Ue):!1}function tr(I){if(Pe.value){const R=We.value,N=typeof I.composedPath=="function"?I.composedPath():[];!!R&&(N.includes(R)||I.target instanceof Node&&R.contains(I.target))||(Pe.value=!1)}a.value&&(Qt(I)||ut(),l.value&&(Fn(I)||xe()))}function Gn(I){a.value&&!Qt(I)&&ut(),l.value&&!Fn(I)&&xe()}function Kn(){Pe.value&&(Pe.value=!1),a.value&&ut(),l.value&&xe()}function Bn(){window.addEventListener("pointerdown",tr,{capture:!0}),window.addEventListener("focusin",Gn,{capture:!0}),window.addEventListener("blur",Kn)}function $n(){window.removeEventListener("pointerdown",tr,{capture:!0}),window.removeEventListener("focusin",Gn,{capture:!0}),window.removeEventListener("blur",Kn)}function kn(I,R){const N=R.getBoundingClientRect().height;if(!Number.isFinite(N)||N<=0)return;const ne=ue.value[I];ne!==void 0&&Math.abs(ne-N)<.5||(ue.value={...ue.value,[I]:N})}function x(I,R){const N=te.get(I);N&&N!==R&&et&&et.unobserve(N);const ne=R instanceof HTMLElement?R:R&&"$el"in R&&R.$el instanceof HTMLElement?R.$el:null;if(ne){te.set(I,ne),ze.set(ne,I),kn(I,ne),et==null||et.observe(ne);return}N&&(et==null||et.unobserve(N)),te.delete(I)}function F(I,R){if(I.button!==0||Te.value||me.value)return;const N=n.groups.findIndex(Vt=>Vt.projectName===R),ne=te.get(R);if(N<0||!ne)return;const Ue=ne.getBoundingClientRect(),ot=Bt(R)?0:vu;Te.value={projectName:R,fromIndex:N,startClientX:I.clientX,startClientY:I.clientY,pointerOffsetY:I.clientY-Ue.top,groupLeft:Ue.left,groupWidth:Ue.width,groupHeight:Ue.height,groupOuterHeight:Ue.height+ot},I.preventDefault(),oe()}function oe(){window.addEventListener("mousemove",it),window.addEventListener("mouseup",ft),window.addEventListener("keydown",ht)}function Fe(){window.removeEventListener("mousemove",it),window.removeEventListener("mouseup",ft),window.removeEventListener("keydown",ht)}function it(I){Me={clientX:I.clientX,clientY:I.clientY},Un()}function ft(I){Hn({clientX:I.clientX,clientY:I.clientY});const R=me.value;if(R&&S.value!==null){const N=n.groups.findIndex(ne=>ne.projectName===R.projectName);if(N>=0){const ne=S.value;ne!==N&&r("reorder-project",{projectName:R.projectName,toIndex:ne})}}Nt()}function ht(I){I.key==="Escape"&&(!Te.value&&!me.value||(I.preventDefault(),Nt()))}function Nt(){ae!==null&&(window.cancelAnimationFrame(ae),ae=null),Me=null,Te.value=null,me.value=null,se.value="",Fe()}function Un(){ae===null&&(ae=window.requestAnimationFrame(()=>{if(ae=null,!Me)return;const I=Me;Me=null,Hn(I)}))}function Hn(I){const R=Te.value;if(!me.value&&R){const N=I.clientX-R.startClientX,ne=I.clientY-R.startClientY;if(Math.hypot(N,ne)<Ew)return;ut(),se.value=R.projectName,me.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}}me.value&&On(I)}function On(I){const R=me.value;if(!R)return;if(R.ghostTop=I.clientY-R.pointerOffsetY,!Yr(I)){R.dropTargetIndexFull=null;return}const N=I.clientY,ne=we.value;if(!ne){R.dropTargetIndexFull=null;return}const Ue=ne.getBoundingClientRect(),ot=new Map(n.groups.map((Jt,Tn)=>[Jt.projectName,Tn])),Vt=n.groups.map(Jt=>Jt.projectName).filter(Jt=>Jt!==R.projectName);let Nn=0,Gt=n.groups.length;for(const Jt of Vt){const Tn=ot.get(Jt);if(Tn===void 0)continue;const Wn=Ct(Jt),Jn=Ue.top+Nn+Wn/2;if(N<Jn){Gt=Tn;break}Nn+=Wn}R.dropTargetIndexFull=Gt}function Yr(I){const R=we.value;if(!R)return!1;const N=R.getBoundingClientRect(),ne=I.clientX>=N.left&&I.clientX<=N.right,Ue=I.clientY>=N.top-32&&I.clientY<=N.bottom+32;return ne&&Ue}function nr(I){var R;return((R=me.value)==null?void 0:R.projectName)===I}function vs(I){const R=me.value,N=Z.value[I]??0,ne=a.value===I;return!R||R.projectName!==I?{position:"absolute",top:"0",left:"0",right:"0",zIndex:ne?"40":"1",transform:`translate3d(0, ${N}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 rr(I){return I.threads.filter(R=>!z(R.id))}function Qr(I){if(gt.value)return rr(I);if(Bt(I.projectName))return[];const R=rr(I);return Wt(I.projectName)?R:R.slice(0,10)}function Ir(I){return gt.value?!1:!Bt(I.projectName)&&rr(I).length>10}function Xr(I){return rr(I).length>0}function hn(I){return I.inProgress?"working":I.unread?"unread":"idle"}pt(()=>n.groups.map(I=>I.projectName),I=>{var Ue,ot;const R=((Ue=me.value)==null?void 0:Ue.projectName)??((ot=Te.value)==null?void 0:ot.projectName)??"";R&&!n.groups.some(Vt=>Vt.projectName===R)&&Nt();const N=new Set(I),ne=Object.fromEntries(Object.entries(ue.value).filter(([Vt])=>N.has(Vt)));Object.keys(ne).length!==Object.keys(ue.value).length&&(ue.value=ne)});const ys=de(()=>Pe.value||a.value!==""||l.value!=="");return pt(ys,I=>{if(I){Bn();return}$n()}),pt(l,I=>{if(!I){qn();return}$e(),Zt(()=>{Mn(I)})}),Jr(()=>{for(const I of te.values())et==null||et.unobserve(I);te.clear(),Re.clear(),qn(),$n(),Nt()}),(I,R)=>(w(),k("section",_y,[T.value.length>0?(w(),k("section",ky,[v("ul",Ty,[(w(!0),k(De,null,yt(T.value,N=>(w(),k("li",{key:N.id,class:"thread-row-item","data-menu-open":Ce(N.id)?"true":"false"},[je(Cs,{class:"thread-row","data-active":N.id===e.selectedThreadId,"data-pinned":z(N.id),"data-menu-open":Ce(N.id)?"true":"false","force-right-hover":Ce(N.id)},{left:At(()=>[v("span",Iy,[N.inProgress||N.unread?(w(),k("span",{key:0,class:"thread-status-indicator","data-state":hn(N)},null,8,Ey)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ne=>q(N.id)},[je(wa,{class:"thread-icon"})],8,Cy)])]),right:At(()=>[v("span",Py,Y(M(N.createdAtIso||N.updatedAtIso)),1)]),"right-hover":At(()=>[v("div",{ref_for:!0,ref:ne=>en(N.id,ne),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:It(ne=>Be(N.id),["stop"])},[je(wo,{class:"thread-icon"})],8,My)],512)]),default:At(()=>[v("button",{class:"thread-main-button",type:"button",onClick:ne=>Q(N.id)},[v("span",xy,[v("span",Ry,Y(N.title),1),N.hasWorktree?(w(),_t(Po,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,Ay)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,Sy))),128))])])):fe("",!0),je(Cs,{as:"header",class:"thread-tree-header-row"},{right:At(()=>[v("div",{ref_key:"organizeMenuWrapRef",ref:We,class:"organize-menu-wrap"},[v("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Pe.value,"aria-label":"Organize threads",title:"Organize threads",onClick:dt},[je(wo,{class:"thread-icon"})],8,$y),Pe.value?(w(),k("div",{key:0,class:"organize-menu-panel",onClick:R[2]||(R[2]=It(()=>{},["stop"]))},[R[12]||(R[12]=v("p",{class:"organize-menu-title"},"Organize",-1)),v("button",{class:"organize-menu-item","data-active":nt.value==="project",type:"button",onClick:R[0]||(R[0]=N=>bt("project"))},[R[10]||(R[10]=v("span",null,"By project",-1)),nt.value==="project"?(w(),k("span",Ny,"✓")):fe("",!0)],8,Oy),v("button",{class:"organize-menu-item","data-active":nt.value==="chronological",type:"button",onClick:R[1]||(R[1]=N=>bt("chronological"))},[R[11]||(R[11]=v("span",null,"Chronological list",-1)),nt.value==="chronological"?(w(),k("span",Dy,"✓")):fe("",!0)],8,Ly)])):fe("",!0)],512)]),default:At(()=>[R[13]||(R[13]=v("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),gt.value&&W.value.length===0?(w(),k("p",jy,"No matching threads")):e.isLoading&&e.groups.length===0?(w(),k("p",Fy,"Loading threads...")):be.value?(w(),k("ul",By,[(w(!0),k(De,null,yt(he.value,N=>(w(),k("li",{key:N.id,class:"thread-row-item","data-menu-open":Ce(N.id)?"true":"false"},[je(Cs,{class:"thread-row","data-active":N.id===e.selectedThreadId,"data-pinned":z(N.id),"data-menu-open":Ce(N.id)?"true":"false","force-right-hover":Ce(N.id)},{left:At(()=>[v("span",Hy,[N.inProgress||N.unread?(w(),k("span",{key:0,class:"thread-status-indicator","data-state":hn(N)},null,8,Wy)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:ne=>q(N.id)},[je(wa,{class:"thread-icon"})],8,Vy)])]),right:At(()=>[v("span",Ky,Y(M(N.createdAtIso||N.updatedAtIso)),1)]),"right-hover":At(()=>[v("div",{ref_for:!0,ref:ne=>en(N.id,ne),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:It(ne=>Be(N.id),["stop"])},[je(wo,{class:"thread-icon"})],8,Jy)],512)]),default:At(()=>[v("button",{class:"thread-main-button",type:"button",onClick:ne=>Q(N.id)},[v("span",qy,[v("span",Gy,Y(N.title),1),N.hasWorktree?(w(),_t(Po,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,zy)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,Uy))),128))])):(w(),k("div",{key:4,ref_key:"groupsContainerRef",ref:we,class:"thread-tree-groups",style:us(J.value)},[(w(!0),k(De,null,yt(W.value,N=>(w(),k("article",{key:N.projectName,ref_for:!0,ref:ne=>x(N.projectName,ne),class:"project-group","data-project-name":N.projectName,"data-expanded":!Bt(N.projectName),"data-dragging":nr(N.projectName),style:us(vs(N.projectName))},[je(Cs,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:ne=>_n(N.projectName),onKeydown:[ne=>bn(ne,N.projectName),An(It(ne=>_n(N.projectName),["prevent"]),["enter"]),An(It(ne=>_n(N.projectName),["prevent"]),["space"])]},{left:At(()=>[v("span",Qy,[v("span",Xy,[Bt(N.projectName)?(w(),_t(zl,{key:0,class:"thread-icon"})):(w(),_t(ly,{key:1,class:"thread-icon"}))]),v("span",Zy,[Bt(N.projectName)?(w(),_t(Gf,{key:0,class:"thread-icon"})):(w(),_t(Qi,{key:1,class:"thread-icon"}))])])]),right:At(()=>[v("div",nw,[v("div",{ref_for:!0,ref:ne=>an(N.projectName,ne),class:"project-menu-wrap"},[v("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:It(ne=>rn(N.projectName),["stop"])},[je(wo,{class:"thread-icon"})],8,rw),Ht(N.projectName)?(w(),k("div",{key:0,class:"project-menu-panel","data-open-direction":f.value[N.projectName]??"down",onClick:R[4]||(R[4]=It(()=>{},["stop"]))},[_.value==="actions"?(w(),k(De,{key:0},[v("button",{class:"project-menu-item",type:"button",onClick:ne=>Dn(N.projectName)}," Browse files ",8,ow),v("button",{class:"project-menu-item",type:"button",onClick:ne=>Tt(N.projectName)}," Edit name ",8,iw),v("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:ne=>Pn(N.projectName)}," Remove ",8,aw)],64)):(w(),k(De,{key:1},[R[14]||(R[14]=v("label",{class:"project-menu-label"},"Project name",-1)),Wr(v("input",{"onUpdate:modelValue":R[3]||(R[3]=ne=>E.value=ne),class:"project-menu-input",type:"text",onInput:ne=>St(N.projectName)},null,40,lw),[[Vr,E.value]])],64))],8,sw)):fe("",!0)],512),v("button",{class:"thread-start-button",type:"button","aria-label":Ie(N.projectName),title:Ie(N.projectName),onClick:It(ne=>ye(N.projectName),["stop"])},[je(xi,{class:"thread-icon"})],8,cw)])]),default:At(()=>[v("span",{class:"project-main-button","data-dragging-handle":nr(N.projectName),onMousedown:It(ne=>F(ne,N.projectName),["left"])},[v("span",tw,Y(jt(N.projectName)),1)],40,ew)]),_:2},1032,["onClick","onKeydown"]),Xr(N)?(w(),k("ul",uw,[(w(!0),k(De,null,yt(Qr(N),ne=>(w(),k("li",{key:ne.id,class:"thread-row-item","data-menu-open":Ce(ne.id)?"true":"false"},[je(Cs,{class:"thread-row","data-active":ne.id===e.selectedThreadId,"data-pinned":z(ne.id),"data-menu-open":Ce(ne.id)?"true":"false","force-right-hover":Ce(ne.id)},{left:At(()=>[v("span",fw,[ne.inProgress||ne.unread?(w(),k("span",{key:0,class:"thread-status-indicator","data-state":hn(ne)},null,8,hw)):fe("",!0),v("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:Ue=>q(ne.id)},[je(wa,{class:"thread-icon"})],8,pw)])]),right:At(()=>[v("span",yw,Y(M(ne.createdAtIso||ne.updatedAtIso)),1)]),"right-hover":At(()=>[v("div",{ref_for:!0,ref:Ue=>en(ne.id,Ue),class:"thread-menu-wrap"},[v("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:It(Ue=>Be(ne.id),["stop"])},[je(wo,{class:"thread-icon"})],8,ww)],512)]),default:At(()=>[v("button",{class:"thread-main-button",type:"button",onClick:Ue=>Q(ne.id)},[v("span",gw,[v("span",vw,Y(ne.title),1),ne.hasWorktree?(w(),_t(Po,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):fe("",!0)])],8,mw)]),_:2},1032,["data-active","data-pinned","data-menu-open","force-right-hover"])],8,dw))),128))])):(w(),_t(Cs,{key:1,as:"p",class:"project-empty-row"},{left:At(()=>[...R[15]||(R[15]=[v("span",{class:"project-empty-spacer"},null,-1)])]),default:At(()=>[R[16]||(R[16]=v("span",{class:"project-empty"},"No threads",-1))]),_:1})),Ir(N)?(w(),_t(Cs,{key:2,class:"thread-show-more-row"},{left:At(()=>[...R[17]||(R[17]=[v("span",{class:"thread-show-more-spacer"},null,-1)])]),default:At(()=>[v("button",{class:"thread-show-more-button",type:"button",onClick:ne=>Ut(N.projectName)},Y(Wt(N.projectName)?"Show less":"Show more"),9,bw)]),_:2},1024)):fe("",!0)],12,Yy))),128))],4)),(w(),_t(Eo,{to:"body"},[Ae.value?(w(),k("div",{key:0,ref_key:"openThreadMenuPanelRef",ref:He,class:"thread-menu-panel thread-menu-panel-fixed",style:us(g.value),"data-open-direction":er(Ae.value.id),onClick:R[8]||(R[8]=It(()=>{},["stop"]))},[v("button",{class:"thread-menu-item",type:"button",onClick:R[5]||(R[5]=N=>G(Ae.value.id))}," Export chat "),v("button",{class:"thread-menu-item",type:"button",onClick:R[6]||(R[6]=N=>lt(Ae.value.id,Ae.value.title))}," Rename thread "),v("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:R[7]||(R[7]=N=>vt(Ae.value.id,Ae.value.title))}," Delete thread ")],12,_w)):fe("",!0)])),(w(),_t(Eo,{to:"body"},[U.value?(w(),k("div",{key:0,class:"rename-thread-overlay",onClick:It(Ze,["self"])},[v("div",kw,[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)),Wr(v("input",{ref_key:"renameThreadInputRef",ref:ce,"onUpdate:modelValue":R[9]||(R[9]=N=>X.value=N),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[An(It(kt,["prevent"]),["enter"]),An(It(Ze,["prevent"]),["esc"])]},null,40,Tw),[[Vr,X.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:kt},"Save")])])])):fe("",!0)])),(w(),_t(Eo,{to:"body"},[K.value?(w(),k("div",{key:0,class:"rename-thread-overlay",onClick:It(Mt,["self"])},[v("div",Sw,[R[20]||(R[20]=v("h3",{class:"rename-thread-title"},"Delete thread?",-1)),v("p",Iw,' This will archive the thread "'+Y(re.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:Mt},"Cancel"),v("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Ye},"Delete")])])])):fe("",!0)]))]))}}),Aw=wt(Cw,[["__scopeId","data-v-2e1439c4"]]),xw={class:"content-header"},Rw={class:"content-leading"},Pw={class:"content-title"},Mw={class:"content-actions"},$w=on({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(w(),k("header",xw,[v("div",Rw,[_r(t.$slots,"leading",{},void 0)]),v("h1",Pw,Y(e.title),1),v("div",Mw,[_r(t.$slots,"actions",{},void 0)])]))}}),Ow=wt($w,[["__scopeId","data-v-66ee223c"]]),Nw={},Lw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Dw(e,t){return w(),k("svg",Lw,[...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 Kf=wt(Nw,[["render",Dw]]),jw={},Fw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Bw(e,t){return w(),k("svg",Fw,[...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 Uw=wt(jw,[["render",Bw]]),Hw={},Ww={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Vw(e,t){return w(),k("svg",Ww,[...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 ql=wt(Hw,[["render",Vw]]),zw={class:"conversation-root"},qw={key:0,class:"conversation-loading"},Gw={key:1,class:"conversation-empty"},Kw=["data-role","data-message-type"],Jw={key:0,class:"message-row","data-role":"system"},Yw={class:"message-stack","data-role":"system"},Qw=["onClick"],Xw={class:"cmd-group-label"},Zw={class:"cmd-status"},eb={class:"cmd-group-inner"},tb=["onClick"],nb={class:"cmd-label"},rb={class:"cmd-status"},sb={class:"cmd-output-inner"},ob=["textContent"],ib=["onClick"],ab={class:"cmd-label"},lb={class:"cmd-status"},cb={class:"cmd-output-inner"},ub=["textContent"],db=["data-role","data-message-type"],fb=["data-role"],hb=["data-role"],pb=["data-role"],mb=["onClick"],gb=["src"],vb={key:1,class:"message-file-attachments"},yb=["href","title"],wb=["data-role"],bb={key:0,class:"worked-separator-wrap","aria-live":"polite"},_b=["onClick"],kb={class:"worked-separator-text"},Tb={key:0,class:"worked-details"},Sb=["onClick"],Ib={class:"cmd-label"},Eb={class:"cmd-status"},Cb={class:"cmd-output-inner"},Ab=["textContent"],xb=["data-streaming"],Rb={class:"plan-card-header"},Pb={key:0,class:"plan-card-badge"},Mb=["innerHTML"],$b={key:1,class:"plan-step-list"},Ob=["data-status"],Nb=["data-status"],Lb=["innerHTML"],Db=["innerHTML"],jb={key:2,class:"message-text-flow"},Fb={key:0,class:"message-text"},Bb={key:0},Ub={key:1,class:"message-bold-text"},Hb={key:2,class:"message-italic-text"},Wb={key:3,class:"message-strikethrough-text"},Vb=["href","title"],zb=["href","title"],qb={key:6,class:"message-inline-code"},Gb={key:0},Kb={key:1,class:"message-bold-text"},Jb={key:2,class:"message-italic-text"},Yb={key:3,class:"message-strikethrough-text"},Qb=["href","title"],Xb=["href","title"],Zb={key:6,class:"message-inline-code"},e_={key:2,class:"message-blockquote"},t_={key:0},n_={key:1,class:"message-bold-text"},r_={key:2,class:"message-italic-text"},s_={key:3,class:"message-strikethrough-text"},o_=["href","title"],i_=["href","title"],a_={key:6,class:"message-inline-code"},l_={key:3,class:"message-list message-list-unordered"},c_=["innerHTML"],u_={key:4,class:"message-list message-task-list"},d_=["data-checked"],f_={class:"message-list-item-text"},h_={key:0},p_={key:1,class:"message-bold-text"},m_={key:2,class:"message-italic-text"},g_={key:3,class:"message-strikethrough-text"},v_=["href","title"],y_=["href","title"],w_={key:6,class:"message-inline-code"},b_=["start"],__=["innerHTML"],k_={key:6,class:"message-code-block"},T_={key:0,class:"message-code-language"},S_={class:"message-code-pre"},I_={key:7,class:"message-divider"},E_={key:8,class:"message-text"},C_=["onClick"],A_=["src","alt","onError"],x_=["data-role"],R_=["onClick"],P_=["data-copied","aria-label","title","onClick"],M_={class:"message-copy-label"},$_={key:0,class:"conversation-item conversation-item-overlay"},O_={class:"message-row"},N_={class:"message-stack"},L_={class:"live-overlay-inline","aria-live":"polite"},D_={class:"live-overlay-label"},j_={key:1,class:"live-overlay-error"},F_={class:"message-row"},B_={class:"message-stack"},U_={class:"request-card"},H_={class:"request-title"},W_={class:"request-meta"},V_={key:0,class:"request-reason"},z_={key:1,class:"request-actions"},q_=["onClick"],G_=["onClick"],K_=["onClick"],J_=["onClick"],Y_={key:2,class:"request-actions"},Q_=["onClick"],X_=["onClick"],Z_=["onClick"],ek=["onClick"],tk={key:3,class:"request-user-input"},nk={class:"request-question-title"},rk={key:0,class:"request-question-text"},sk=["value","onChange"],ok=["value"],ik={key:2,class:"request-question-option-description"},ak=["type","value","placeholder","onInput"],lk=["type","value","onInput"],ck=["onClick"],uk={key:4,class:"request-actions"},dk=["onClick"],fk=["onClick"],hk={key:5,class:"request-actions"},pk=["onClick"],mk=["onClick"],gk=["src"],vk=16,yk=on({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{}},emits:["updateScrollState","forkThread","respondServerRequest"],setup(e,{expose:t,emit:n}){var _s;const r=j(new Set),s=j(new Set),o=j(new Set),i=j(new Set);function a(d){var L;const m=d.replace(/\r\n/g,`
26
+ `).trim();if(!m)return null;const h=[],A=[];for(const P of m.split(`
27
+ `)){const ge=P.trim();if(!ge){h.length===0&&A.push("");continue}const V=ge.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(V){const Se=(V[1]??" ").toLowerCase();let Oe="pending";Se==="x"&&(Oe="completed"),(Se==="~"||Se===">"||Se==="-")&&(Oe="inProgress"),h.push({step:((L=V[2])==null?void 0:L.trim())??"",status:Oe});continue}A.push(ge)}return h.length===0?null:{explanation:A.join(`
28
+ `).trim(),steps:h.filter(P=>P.step.length>0)}}function l(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}:a(d.text)}function f(d){return d.messageType==="commandExecution"&&!!d.commandExecution}function u(d){return d.messageType==="plan"||d.messageType==="plan.live"}function g(d){return d.role==="assistant"&&!f(d)&&d.messageType!=="worked"&&!(d.messageType??"").endsWith(".live")}const _=de(()=>{var d;for(let m=ke.messages.length-1;m>=0;m-=1){const h=ke.messages[m];if(h.messageType==="commandExecution"&&((d=h.commandExecution)==null?void 0:d.status)==="inProgress")return h.id}return""}),E=de(()=>ke.messages.some(d=>d.role==="assistant"&&d.messageType==="agentMessage.live"&&d.text.trim().length>0)),U=de(()=>!!ke.liveOverlay||_.value.length>0||E.value),$=de(()=>{const d={};for(let m=0;m<ke.messages.length;){const h=ke.messages[m];if(!f(h)){m+=1;continue}const A=[];for(;m<ke.messages.length&&f(ke.messages[m]);)A.push(ke.messages[m]),m+=1;if(A.length<=1)continue;const L=A[A.length-1];d[L.id]=A.slice(0,-1)}return d}),X=de(()=>{const d=new Set;for(const m of Object.values($.value))for(const h of m)d.add(h.id);return d});function ce(d){var m;return((m=l(d))==null?void 0:m.explanation)??""}function K(d){var m;return((m=l(d))==null?void 0:m.steps)??[]}function ee(d){switch(d){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function re(d){return!E.value&&d.id===_.value}function we(d){return f(d)?r.value.has(d.id)||!s.value.has(d.id)&&re(d):!1}function Te(d){return f(d)&&U.value}function me(d){var m;return f(d)&&(U.value||((m=d.commandExecution)==null?void 0:m.status)==="inProgress")}function Me(d){if(!f(d))return;const m=new Set(r.value),h=new Set(s.value),A=re(d);m.has(d.id)?(m.delete(d.id),A&&h.add(d.id)):A&&!h.has(d.id)?h.add(d.id):(m.add(d.id),h.delete(d.id)),r.value=m,s.value=h}function ae(d){return $.value[d.id]??[]}function se(d){return f(d)?[...ae(d),d]:[]}function ue(d){if(ae(d).length===0)return;const h=new Set(o.value);h.has(d.id)?h.delete(d.id):h.add(d.id),o.value=h}function te(d){return o.value.has(d.id)}function Re(d){var P,ge;const h=se(d).length,A=((ge=(P=d.commandExecution)==null?void 0:P.command)==null?void 0:ge.trim())||"(command)";return`${h===1?"1 command":`${h} commands`} · latest: ${A}`}function Je(d){return He(d)}function ze(d){const m=new Set(i.value);m.has(d.id)?m.delete(d.id):m.add(d.id),i.value=m}function We(d){return i.value.has(d.id)}function He(d){const m=d.commandExecution;if(!m)return"";const h=Te(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 Pe(d){var h,A;const m=(h=d.commandExecution)==null?void 0:h.status;return m==="inProgress"?"cmd-status-running":m==="completed"&&((A=d.commandExecution)==null?void 0:A.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function nt(d,m){if(d.size===0)return d;const h=new Set;for(const A of d)m.has(A)&&h.add(A);return h.size===d.size?d:h}function et(d,m){const h=[];for(let A=m-1;A>=0;A--){const L=d[A];if(L.messageType==="commandExecution")h.unshift(L);else if(L.role==="user"||L.messageType==="worked")break}return h}const ke=e,at=n,Ot=j(null),gt=j(null),mt=j(null),qe=j(""),W=j(""),be=j({}),he=j({}),Ee=j(((_s=ke.scrollState)==null?void 0:_s.isAtBottom)!==!1);let Ae=0,T=0,S=0,O=null;const Z=new WeakSet,J=j(new Set),M=de(()=>!Ee.value&&(ke.messages.length>0||ke.pendingRequests.length>0||!!ke.liveOverlay));function z(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),A=d.startsWith("./")||d.startsWith("../")||d.startsWith("~/"),L=d.includes("/")||d.includes("\\");return m||h||A||L}function q(d){return d.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||d}function Q(d){return d.replace(/\\/gu,"/")}function G(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 Ie(d){const m=Q(d),h=m.match(/^\/Users\/([^/]+)/u);if(h)return`/Users/${h[1]}`;const A=m.match(/^\/home\/([^/]+)/u);return A?`/home/${A[1]}`:""}function ye(d){const m=Q(d);if(!m)return m;let h="",A=m;const L=A.match(/^([A-Za-z]:)(\/.*)?$/u);L?(h=`${L[1]}/`,A=(L[2]??"").replace(/^\/+/u,"")):A.startsWith("/")&&(h="/",A=A.slice(1));const P=A.split("/").filter(Boolean),ge=[];for(const Se of P)if(Se!=="."){if(Se===".."){ge.length>0&&ge.pop();continue}ge.push(Se)}const V=ge.join("/");return h?`${h}${V}`.replace(/\/+$/u,"")||h:V||m}function Ce(d,m){const h=Q(G(d.trim()));if(!h)return"";if(h.startsWith("/")||/^[A-Za-z]:\//u.test(h))return ye(h);if(h.startsWith("~/")){const P=Ie(m);if(P)return ye(`${P}/${h.slice(2)}`)}const L=Q(m.trim());return ye(L?`${L.replace(/\/+$/u,"")}/${h}`:h)}function xe(d){if(!d)return null;let m=d.trim();m=Be(m).core.trim();let A=null;const L=m.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(L)m=L[1],A=Number(L[2]);else{const P=m.match(/^(.*):(\d+)(?::\d+)?$/u);P&&(m=P[1],A=Number(P[2]))}return m=G(m),z(m)?{path:m,line:A}:null}function Be(d){let m=d,h="",A="";for(;/^[('"`[{<“‘]/u.test(m);)h+=m[0],m=m.slice(1);for(;/[)"'`\]}>”’]$/u.test(m);)A=m.slice(-1)+A,m=m.slice(0,-1);return{core:m,leading:h,trailing:A}}function lt(d){const h=d.trim().match(/^\[([^\]\n]+)\]\(([^)\n]+)\)$/u);if(!h)return null;const A=(h[1]??"").trim(),L=(h[2]??"").trim(),P=Be(A).core.trim()||A,ge=Be(L).core.trim();return ge?{label:P,target:ge}:null}function Ze(d){const m=Math.min(6,Math.max(1,Math.trunc(d)));return`h${String(m)}`}function kt(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 vt(d){switch(d){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function Mt(d){var A;const m=l(d);if(!m)return"";const h=[];return(A=m.explanation)!=null&&A.trim()&&h.push(m.explanation.trim()),m.steps.length>0&&h.push(m.steps.map(L=>`- ${vt(L.status)} ${L.step}`.trim()).join(`
29
+ `)),h.join(`
30
+
31
+ `).trim()}function Ye(d){const m=[],h=d.text.trim()||Mt(d),A=u(d)&&h?`Plan
32
+ ${h}`:h;A&&m.push(A);const L=(d.fileAttachments??[]).map(ge=>ge.path.trim()).filter(ge=>ge.length>0);L.length>0&&m.push(`Files:
33
+ ${L.join(`
34
+ `)}`);const P=(d.images??[]).map(ge=>ge.trim()).filter(ge=>ge.length>0);return P.length>0&&m.push(`Images:
35
+ ${P.join(`
36
+ `)}`),m.join(`
37
+
38
+ `).trim()}const jt=de(()=>{const d=new Map;for(const h of ke.messages){if(!g(h))continue;const A=Ye(h);if(!A)continue;const L=typeof h.turnIndex=="number"?`turn:${h.turnIndex}`:`message:${h.id}`,P=d.get(L);if(P){P.anchorMessageId=h.id,P.parts.push(A);continue}d.set(L,{anchorMessageId:h.id,parts:[A]})}const m={};for(const h of d.values()){const A=h.parts.join(`
39
+
40
+ `).trim();A&&(m[h.anchorMessageId]=A)}return m}),Ht=de(()=>{const d=new Map;for(const h of ke.messages){if(!g(h)||typeof h.turnIndex!="number")continue;const A=`turn:${h.turnIndex}`,L=d.get(A);if(L){L.anchorMessageId=h.id,L.turnIndex=h.turnIndex;continue}d.set(A,{anchorMessageId:h.id,turnIndex:h.turnIndex})}const m={};for(const h of d.values())m[h.anchorMessageId]=h.turnIndex;return m});function ut(d){return typeof jt.value[d.id]=="string"}function dt(d){return typeof Ht.value[d.id]=="number"}function bt(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 rn(d){var A;const m=jt.value[d]??"";if(!m)return;let h=!1;if(typeof navigator<"u"&&((A=navigator.clipboard)!=null&&A.writeText))try{await navigator.clipboard.writeText(m),h=!0}catch{h=!1}h||(h=bt(m)),h&&(W.value=d,O&&clearTimeout(O),O=setTimeout(()=>{W.value===d&&(W.value=""),O=null},1800))}function Tt(d){const m=Ht.value[d];typeof m=="number"&&ke.activeThreadId&&at("forkThread",{threadId:ke.activeThreadId,turnIndex:m})}function St(d){const m=[],h=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let A=0;for(const L of d.matchAll(h)){if(typeof L.index!="number")continue;const P=L.index,ge=P+L[0].length;P>A&&m.push({kind:"text",value:d.slice(A,P)});let V=L[0],Se="";for(;/[.,;:]$/u.test(V);)Se=V.slice(-1)+Se,V=V.slice(0,-1);const Oe=Be(V);V=Oe.core;const Qe=Oe.leading,c=Oe.trailing+Se;if(Qe&&m.push({kind:"text",value:Qe}),V.startsWith("**")&&V.endsWith("**")&&V.length>4)m.push({kind:"bold",value:V.slice(2,-2)}),c&&m.push({kind:"text",value:c});else if(/^https?:\/\//u.test(V))m.push({kind:"url",value:V,href:V}),c&&m.push({kind:"text",value:c});else{const p=xe(V);p?(m.push({kind:"file",value:V,path:p.path,displayPath:V,downloadName:q(p.path)}),c&&m.push({kind:"text",value:c})):m.push({kind:"text",value:L[0]})}A=ge}return A<d.length&&m.push({kind:"text",value:d.slice(A)}),Dn(m)}function Pn(d,m){const h=[];let A=!1,L="";const P=ge=>{ge&&h.push({kind:"text",value:ge})};for(const ge of d){if(ge.kind!=="text"){A&&(P(`${m.marker}${L}`),A=!1,L=""),h.push(ge);continue}let V=ge.value;for(;V.length>0;){const Se=V.indexOf(m.marker);if(Se<0){A?L+=V:P(V);break}const Oe=V.slice(0,Se);if(A?L+=Oe:P(Oe),V=V.slice(Se+m.marker.length),A){const Qe=L;Qe.length>0&&(!m.isValidContent||m.isValidContent(Qe))?h.push({kind:m.kind,value:Qe}):P(`${m.marker}${Qe}${m.marker}`),L="",A=!1}else A=!0}}return A&&P(`${m.marker}${L}`),h}function Dn(d){const m=A=>A.trim().length>0&&!/^\s/u.test(A)&&!/\s$/u.test(A);let h=Pn(d,{marker:"**",kind:"bold",isValidContent:m});return h=Pn(h,{marker:"~~",kind:"strikethrough",isValidContent:m}),h=Pn(h,{marker:"*",kind:"italic",isValidContent:m}),h}function bn(d){const m=/\[([^\]\n]+)\]\(([^)\n]+)\)/gu,h=[];let A=0;for(const L of d.matchAll(m)){if(typeof L.index!="number")continue;const[P,ge,V]=L,Se=L.index,Oe=Se+P.length;Se>A&&h.push(...St(d.slice(A,Se)));const Qe=lt(`[${ge??""}](${V??""})`),c=(Qe==null?void 0:Qe.label)??(ge??"").trim(),p=(Qe==null?void 0:Qe.target)??(V??"").trim();if(/^https?:\/\//u.test(p))h.push({kind:"url",value:c||p,href:p});else{const y=xe(p);y?h.push({kind:"file",value:p,path:y.path,displayPath:c||p,downloadName:q(y.path)}):h.push({kind:"text",value:P})}A=Oe}return A<d.length&&h.push(...St(d.slice(A))),h}function Wt(d){if(!d.includes("`"))return bn(d);const m=[];let h=0,A=0;for(;h<d.length;){if(d[h]!=="`"){h+=1;continue}let L=1;for(;h+L<d.length&&d[h+L]==="`";)L+=1;const P="`".repeat(L);let ge=h+L,V=-1;for(;ge<d.length;){const Oe=d.indexOf(P,ge);if(Oe<0)break;const Qe=Oe>0&&d[Oe-1]==="`",c=Oe+L<d.length&&d[Oe+L]==="`",p=d.slice(h+L,Oe).includes(`
41
+ `);if(!Qe&&!c&&!p){V=Oe;break}ge=Oe+1}if(V<0){h+=L;continue}h>A&&m.push(...bn(d.slice(A,h)));const Se=d.slice(h+L,V);if(Se.length>0){const Oe=lt(Se);if(Oe)if(/^https?:\/\//u.test(Oe.target))m.push({kind:"url",value:Oe.label||Oe.target,href:Oe.target});else{const Qe=xe(Oe.target);Qe?m.push({kind:"file",value:Oe.target,path:Qe.path,displayPath:Oe.label||Oe.target,downloadName:q(Qe.path)}):m.push({kind:"code",value:Se})}else{const Qe=xe(Se);if(Qe){const c=Qe.line?`${Qe.path}:${String(Qe.line)}`:Qe.path;m.push({kind:"file",value:Se,path:Qe.path,displayPath:c,downloadName:q(Qe.path)})}else m.push({kind:"code",value:Se})}}else m.push({kind:"text",value:`${P}${P}`});h=V+L,A=h}return A<d.length&&m.push(...bn(d.slice(A))),m}function Bt(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("/"),A=/^[A-Za-z]:[\\/]/u.test(m);return h||A?`/codex-local-image?path=${encodeURIComponent(m)}`:m}function Ut(d){const m=d.trim();if(!m)return"#";const h=ge=>ge.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(ge),A=xe(m),L=(A==null?void 0:A.path)??m,P=Ce(L,ke.cwd);if(h(P)){const ge=P.startsWith("/")?P:`/${P}`;return`/codex-local-browse${encodeURI(ge)}`}return"#"}function _n(d){return d.replace(/\r\n/gu,`
42
+ `)}function Ct(d){var h;return(((h=d.match(/^\s*/u))==null?void 0:h[0])??"").replace(/\t/gu," ").length}function an(d,m){if(m<=0)return d.trimStart();let h=0,A=0;for(;h<d.length&&A<m;){const L=d[h];A+=L===" "?4:1,h+=1}return d.slice(h)}function en(d){return d.trim().length===0}function jn(d){const m=d.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return m?{level:m[1].length,value:m[2].trim()}:null}function dn(d){const m=d.match(/^\s{0,3}>\s?(.*)$/u);return m?m[1]??"":null}function sn(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 er(d){var h;const m=d.match(/^(\s*)[-*+]\s+(.+)$/u);return m?{indent:Ct(m[1]??""),text:((h=m[2])==null?void 0:h.trim())??""}:null}function fn(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 Yt(d){var h;const m=d.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return m?{indent:Ct(m[1]??""),item:{checked:(m[2]??" ").toLowerCase()==="x",text:((h=m[3])==null?void 0:h.trim())??""}}:null}function Mn(d){var h;const m=d.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return m?{indent:Ct(m[1]??""),start:Number.parseInt(m[2]??"1",10)||1,text:((h=m[3])==null?void 0:h.trim())??""}:null}function Ne(d){var m;return((m=Mn(d))==null?void 0:m.text)??null}function $e(d){return Mn(d)}function qn(d){return en(d)||Bn(d)!==null||Kn(d)||jn(d)!==null||dn(d)!==null||fn(d)!==null||sn(d)!==null||Ne(d)!==null}function Qt(d,m,h=-1){const A=[];let L=m;for(;L<d.length&&!(qn(d[L])||h>=0&&Ct(d[L])<=h);)A.push(h>=0?an(d[L],h+1):d[L]),L+=1;const P=A.join(`
43
+ `).trim();return P?{value:P,nextIndex:L}:null}function Fn(d,m){for(let h=m;h<d.length;h+=1)if(!en(d[h]))return h;return-1}function tr(d,m,h,A=null,L=!1){const P=[];let ge=m;for(;ge<d.length;){const V=d[ge];if(en(V)){const c=Fn(d,ge+1);if(c===-1){P.push(""),ge=d.length;break}const p=A==null?void 0:A(d[c]);if(p&&p.indent===h||Ct(d[c])<=h)break;P.push(""),ge+=1;continue}const Se=A==null?void 0:A(V);if(Se&&Se.indent===h)break;const Oe=Ct(V),Qe=L&&(fn(V)!==null||sn(V)!==null);if(Oe<=h&&!Qe)break;P.push(Oe>h?an(V,h+1):V.trimStart()),ge+=1}for(;P.length>0&&en(P[0]);)P.shift();for(;P.length>0&&en(P[P.length-1]);)P.pop();return P.length===0?null:{blocks:$n(P.join(`
44
+ `)),nextIndex:ge}}function Gn(d,m,h,A=!1){const L=[];let P=m;const ge=h(d[m]);if(!ge)return null;const V=ge.indent;for(;P<d.length;){const Se=h(d[P]);if(Se===null||Se.indent!==V)break;const Oe=[Se.text],Qe=[];for(P+=1;P<d.length;){if(en(d[P])){const B=Fn(d,P+1);if(B===-1){P=d.length;break}const H=h(d[B]);if(H&&H.indent===V){P=B;break}if(Ct(d[B])<=V){P=B;break}P+=1;continue}const c=h(d[P]);if(c&&c.indent===V)break;const p=Ct(d[P])>V,y=A&&(fn(d[P])!==null||sn(d[P])!==null);if(p||y){const B=tr(d,P,V,h,A);if(B){Qe.push(...B.blocks),P=B.nextIndex;continue}}if(Ct(d[P])<=V)break;const C=Qt(d,P,V);if(!C)break;Oe.push(C.value),P=C.nextIndex}L.push(Qe.length>0?{paragraphs:Oe,children:Qe}:{paragraphs:Oe})}return L.length>0?{items:L,nextIndex:P}:null}function Kn(d){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(d.trim())}function Bn(d){const m=d.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return m?{marker:m[1],language:(m[2]??"").trim()}:null}function $n(d){var P;const h=_n(d).split(`
45
+ `),A=[];let L=0;for(;L<h.length;){if(en(h[L])){L+=1;continue}const ge=Bn(h[L]);if(ge){L+=1;const C=[];for(;L<h.length;){if(h[L].trim()===ge.marker){L+=1;break}C.push(h[L]),L+=1}A.push({kind:"codeBlock",language:ge.language,value:C.join(`
46
+ `)});continue}if(Kn(h[L])){A.push({kind:"thematicBreak"}),L+=1;continue}const V=jn(h[L]);if(V){A.push({kind:"heading",level:V.level,value:V.value}),L+=1;continue}if(dn(h[L])!==null){const C=[];for(;L<h.length;){const B=dn(h[L]);if(B===null)break;C.push(B),L+=1}A.push({kind:"blockquote",value:C.join(`
47
+ `).trim()});continue}if(fn(h[L])!==null){const C=[],B=((P=Yt(h[L]))==null?void 0:P.indent)??0;for(;L<h.length;){const H=Yt(h[L]);if(H===null||H.indent!==B)break;C.push(H.item),L+=1}if(C.length>0){A.push({kind:"taskList",items:C});continue}}const Qe=sn(h[L]);if(Qe!==null){const C=Gn(h,L,er);if(C){A.push({kind:"unorderedList",items:C.items}),L=C.nextIndex;continue}if(Qe.length>0){A.push({kind:"unorderedList",items:[{paragraphs:[Qe]}]}),L+=1;continue}}const c=Ne(h[L]);if(c!==null){const C=$e(h[L]),B=Gn(h,L,$e,!0);if(B){A.push({kind:"orderedList",items:B.items,start:(C==null?void 0:C.start)??1}),L=B.nextIndex;continue}if(c.length>0){A.push({kind:"orderedList",items:[{paragraphs:[c]}],start:(C==null?void 0:C.start)??1}),L+=1;continue}}const p=[];for(;L<h.length&&!(en(h[L])||Bn(h[L])||Kn(h[L])||jn(h[L])||dn(h[L])!==null||fn(h[L])!==null||sn(h[L])!==null||Ne(h[L])!==null);)p.push(h[L]),L+=1;const y=p.join(`
48
+ `).trim();y&&A.push({kind:"paragraph",value:y})}return A}function kn(d){if(!d.includes("![")||!d.includes("]("))return $n(d);const m=[],h=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let A=0;for(const L of d.matchAll(h)){const[P,ge,V]=L;if(typeof L.index!="number")continue;const Se=L.index,Oe=Se+P.length,Qe=Bt(V.trim());Qe&&(Se>A&&m.push(...$n(d.slice(A,Se))),m.push({kind:"image",url:Qe,alt:ge.trim(),markdown:P}),A=Oe)}return A<d.length&&m.push(...$n(d.slice(A))),m}function x(d){const h=_n(d).split(`
49
+ `),A=[];let L=0,P=0;const ge=V=>{if(V<=P)return;const Se=h.slice(P,V).join(`
50
+ `);A.push(...kn(Se))};for(;L<h.length;){const V=Bn(h[L]);if(!V){L+=1;continue}ge(L),L+=1;const Se=[];for(;L<h.length;){if(h[L].trim()===V.marker){L+=1;break}Se.push(h[L]),L+=1}A.push({kind:"codeBlock",language:V.language,value:Se.join(`
51
+ `)}),P=L}return ge(h.length),A.length>0?A:[{kind:"paragraph",value:d}]}function F(d){return d.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function oe(d){return Wt(d).map(m=>m.kind==="text"?F(m.value):m.kind==="bold"?`<strong class="message-bold-text">${F(m.value)}</strong>`:m.kind==="italic"?`<em class="message-italic-text">${F(m.value)}</em>`:m.kind==="strikethrough"?`<s class="message-strikethrough-text">${F(m.value)}</s>`:m.kind==="file"?`<a class="message-file-link" href="${F(Ut(m.path))}" target="_blank" rel="noopener noreferrer" title="${F(m.path)}">${F(m.displayPath)}</a>`:m.kind==="url"?`<a class="message-file-link" href="${F(m.href)}" target="_blank" rel="noopener noreferrer" title="${F(m.href)}">${F(m.value)}</a>`:`<code class="message-inline-code">${F(m.value)}</code>`).join("")}function Fe(d){return d.paragraphs.map(m=>`<div class="message-list-item-text message-list-item-paragraph">${oe(m)}</div>`).join("")}function it(d){var A;const m=Fe(d),h=((A=d.children)==null?void 0:A.map(L=>ft(L)).join(""))??"";return m+h}function ft(d){if(d.kind==="paragraph")return`<p class="message-text">${oe(d.value)}</p>`;if(d.kind==="heading"){const m=Math.min(6,Math.max(1,Math.trunc(d.level))),h=Ze(m),A=`message-heading ${kt(m)}`;return`<${h} class="${A}">${oe(d.value)}</${h}>`}if(d.kind==="blockquote")return`<blockquote class="message-blockquote">${oe(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">${it(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">${oe(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">${it(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">${F(d.language)}</div>`:""}<pre class="message-code-pre"><code>${F(d.value)}</code></pre></div>`:d.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${F(d.url)}" alt="${F(d.alt||"Embedded message image")}" loading="lazy">`}function ht(d){return x(d).map(m=>ft(m)).join("")}function Nt(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)?d:null}function Un(d){const m=new Date(d);return Number.isNaN(m.getTime())?d:m.toLocaleTimeString()}function Hn(d){const m=Nt(d.params),h=m==null?void 0:m.reason;return typeof h=="string"?h.trim():""}function On(d,m){return`${String(d)}:${m}`}function Yr(d){const m=Nt(d.params),h=Array.isArray(m==null?void 0:m.questions)?m.questions:[],A=[];for(const L of h){const P=Nt(L);if(!P)continue;const ge=typeof P.id=="string"?P.id:"";if(!ge)continue;const V=Array.isArray(P.options)?P.options.map(Se=>Nt(Se)).map(Se=>({label:typeof(Se==null?void 0:Se.label)=="string"?Se.label:"",description:typeof(Se==null?void 0:Se.description)=="string"?Se.description:""})).filter(Se=>Se.label.length>0):[];A.push({id:ge,header:typeof P.header=="string"?P.header:"",question:typeof P.question=="string"?P.question:"",isSecret:P.isSecret===!0,isOther:P.isOther===!0,options:V})}return A}function nr(d,m,h){const A=On(d,m),L=be.value[A];return typeof L=="string"&&L.length>0?L:h}function vs(d,m,h){const A=h.target;if(!(A instanceof HTMLInputElement))return;const L=On(d,m);be.value={...be.value,[L]:A.value}}function rr(d,m){var L;const h=nr(d,m.id,((L=m.options[0])==null?void 0:L.label)||""),A=m.options.find(P=>P.label===h);return(A==null?void 0:A.description)??""}function Qr(d,m){const h=On(d,m);return he.value[h]??""}function Ir(d,m,h){const A=h.target;if(!(A instanceof HTMLSelectElement))return;const L=On(d,m);be.value={...be.value,[L]:A.value}}function Xr(d,m,h){const A=h.target;if(!(A instanceof HTMLInputElement))return;const L=On(d,m);he.value={...he.value,[L]:A.value}}function hn(d,m){at("respondServerRequest",{id:d,result:{decision:m}})}function ys(d){var A;const m=Yr(d),h={};for(const L of m){const P=nr(d.id,L.id,((A=L.options[0])==null?void 0:A.label)||""),ge=Qr(d.id,L.id).trim(),V=[P,ge].map(Se=>Se.trim()).filter(Se=>Se.length>0);h[L.id]={answers:V}}at("respondServerRequest",{id:d.id,result:{answers:h}})}function I(d){at("respondServerRequest",{id:d,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function R(d){at("respondServerRequest",{id:d,result:{success:!0,contentItems:[]}})}function N(d){at("respondServerRequest",{id:d,result:{}})}function ne(d){at("respondServerRequest",{id:d,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function Ue(){const d=Ot.value,m=gt.value;!d||!m||(d.scrollTop=d.scrollHeight,m.scrollIntoView({block:"end"}))}function ot(d){return d.scrollHeight-(d.scrollTop+d.clientHeight)<=vk}function Vt(d){if(!ke.activeThreadId)return;const m=Math.max(d.scrollHeight-d.clientHeight,0),h=m>0?Math.min(Math.max(d.scrollTop/m,0),1):1;at("updateScrollState",{threadId:ke.activeThreadId,state:{scrollTop:d.scrollTop,isAtBottom:ot(d),scrollRatio:h}})}function Nn(){const d=Ot.value;if(!d)return;const m=ke.scrollState;if(Ee.value){Gt();return}if(!m||m.isAtBottom){Vt(d);return}const h=Math.max(d.scrollHeight-d.clientHeight,0),A=typeof m.scrollRatio=="number"?m.scrollRatio*h:m.scrollTop;d.scrollTop=Math.min(Math.max(A,0),h),Vt(d)}function Gt(){const d=Ot.value;d&&(Ue(),Vt(d))}function Jt(){return Ee.value}function Tn(){if(!Jt()){S=0,T=0;return}if(Gt(),S-=1,S<=0){T=0;return}T=requestAnimationFrame(Tn)}function Wn(d=6){Jt()&&(T&&(cancelAnimationFrame(T),T=0),S=Math.max(d,1),T=requestAnimationFrame(Tn))}function Jn(){Wn(3)}function ws(){Ee.value=!0,Gt(),Wn(4)}t({jumpToLatest:ws});function fo(){if(!Jt())return;const d=Ot.value;if(!d)return;const m=d.querySelectorAll("img.message-image-preview");for(const h of m)h.complete||Z.has(h)||(Z.add(h),h.addEventListener("load",Jn,{once:!0}),h.addEventListener("error",Jn,{once:!0}))}async function Zr(){await Zt(),Ae&&cancelAnimationFrame(Ae),Ae=requestAnimationFrame(()=>{Ae=0,Nn(),fo(),Wn()})}pt(()=>ke.messages,async d=>{if(ke.isLoading)return;const m=new Set(d.filter(h=>h.messageType==="commandExecution"&&h.commandExecution).map(h=>h.id));r.value=nt(r.value,m),s.value=nt(s.value,m),o.value=nt(o.value,new Set(Object.keys($.value))),await Zr()}),pt(_,(d,m)=>{if(!m||m===d||!s.value.has(m))return;const h=new Set(s.value);h.delete(m),s.value=h}),pt(()=>ke.pendingRequests,async()=>{ke.isLoading||await Zr()},{deep:!0}),pt(()=>ke.liveOverlay,async d=>{d&&(await Zt(),Jt()&&(Gt(),Wn(8)))},{deep:!0}),pt(()=>ke.isLoading,async d=>{d||await Zr()}),pt(()=>ke.activeThreadId,()=>{var d;Ee.value=((d=ke.scrollState)==null?void 0:d.isAtBottom)!==!1,qe.value="",J.value=new Set},{flush:"post"}),pt(()=>{var d;return(d=ke.scrollState)==null?void 0:d.isAtBottom},d=>{Ee.value=d!==!1});function ho(){const d=Ot.value;!d||ke.isLoading||(Ee.value=ot(d),Vt(d))}function Er(d){qe.value=Bt(d)}function bs(d,m){return`${d}:${String(m)}`}function Cr(d,m){const h=new Set(J.value);h.add(bs(d,m)),J.value=h}function Fs(d,m){return J.value.has(bs(d,m))}function Bs(){qe.value=""}function es(){const d=mt.value;d&&(d.scrollTop=d.scrollHeight)}return pt(()=>{var d;return(d=ke.liveOverlay)==null?void 0:d.reasoningText},async d=>{d&&(await Zt(),es())}),Jr(()=>{Ae&&cancelAnimationFrame(Ae),T&&cancelAnimationFrame(T),O&&clearTimeout(O)}),(d,m)=>(w(),k("section",zw,[e.isLoading?(w(),k("p",qw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(w(),k("p",Gw," No messages in this thread yet. ")):(w(),k("ul",{key:2,ref_key:"conversationListRef",ref:Ot,class:"conversation-list",onScroll:ho},[(w(!0),k(De,null,yt(e.messages,h=>{var A,L;return w(),k(De,{key:h.id},[X.value.has(h.id)?fe("",!0):(w(),k("li",{key:0,class:"conversation-item","data-role":h.role,"data-message-type":h.messageType||""},[f(h)?(w(),k("div",Jw,[v("div",Yw,[ae(h).length>0?(w(),k("button",{key:0,type:"button",class:rt(["cmd-row cmd-row-group cmd-compact",[Pe(h),{"cmd-expanded":te(h)}]]),onClick:P=>ue(h)},[v("span",{class:rt(["cmd-chevron",{"cmd-chevron-open":te(h)}])},"▶",2),v("span",Xw,Y(Re(h)),1),v("span",Zw,Y(Je(h)),1)],10,Qw)):fe("",!0),ae(h).length>0?(w(),k("div",{key:1,class:rt(["cmd-group-wrap",{"cmd-group-visible":te(h)}])},[v("div",eb,[(w(!0),k(De,null,yt(se(h),P=>{var ge,V;return w(),k("div",{key:`grouped-cmd-${P.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:rt(["cmd-row",[Pe(P),{"cmd-expanded":we(P),"cmd-compact":!0}]]),onClick:Se=>Me(P)},[v("span",{class:rt(["cmd-chevron",{"cmd-chevron-open":we(P)}])},"▶",2),v("code",nb,Y(((ge=P.commandExecution)==null?void 0:ge.command)||"(command)"),1),v("span",rb,Y(He(P)),1)],10,tb),v("div",{class:rt(["cmd-output-wrap",{"cmd-output-visible":we(P)}])},[v("div",sb,[v("pre",{class:rt(["cmd-output",{"cmd-output-condensed":me(P)}]),textContent:Y(((V=P.commandExecution)==null?void 0:V.aggregatedOutput)||"(no output)")},null,10,ob)])],2)])}),128))])],2)):(w(),k(De,{key:2},[v("button",{type:"button",class:rt(["cmd-row",[Pe(h),{"cmd-expanded":we(h),"cmd-compact":Te(h)}]]),onClick:P=>Me(h)},[v("span",{class:rt(["cmd-chevron",{"cmd-chevron-open":we(h)}])},"▶",2),v("code",ab,Y(((A=h.commandExecution)==null?void 0:A.command)||"(command)"),1),v("span",lb,Y(He(h)),1)],10,ib),v("div",{class:rt(["cmd-output-wrap",{"cmd-output-visible":we(h)}])},[v("div",cb,[v("pre",{class:rt(["cmd-output",{"cmd-output-condensed":me(h)}]),textContent:Y(((L=h.commandExecution)==null?void 0:L.aggregatedOutput)||"(no output)")},null,10,ub)])],2)],64))])])):(w(),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?(w(),k("ul",{key:0,class:"message-image-list","data-role":h.role},[(w(!0),k(De,null,yt(h.images,P=>(w(),k("li",{key:P,class:"message-image-item"},[v("button",{class:"message-image-button",type:"button",onClick:ge=>Er(P)},[v("img",{class:"message-image-preview",src:Bt(P),alt:"Message image preview",loading:"lazy"},null,8,gb)],8,mb)]))),128))],8,pb)):fe("",!0),h.fileAttachments&&h.fileAttachments.length>0?(w(),k("div",vb,[(w(!0),k(De,null,yt(h.fileAttachments,P=>(w(),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:Ut(P.path),target:"_blank",rel:"noopener noreferrer",title:P.path},Y(P.path),9,yb)]))),128))])):fe("",!0),h.text.length>0?(w(),k("article",{key:2,class:"message-card","data-role":h.role},[h.messageType==="worked"?(w(),k("div",bb,[v("button",{type:"button",class:"worked-separator",onClick:P=>ze(h)},[m[2]||(m[2]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),v("span",{class:rt(["worked-chevron",{"worked-chevron-open":We(h)}])},"▶",2),v("p",kb,Y(h.text),1),m[3]||(m[3]=v("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,_b),We(h)?(w(),k("div",Tb,[(w(!0),k(De,null,yt(et(e.messages,e.messages.indexOf(h)),P=>{var ge,V;return w(),k("div",{key:`worked-cmd-${P.id}`,class:"worked-cmd-item"},[v("button",{type:"button",class:rt(["cmd-row",[Pe(P),{"cmd-expanded":we(P),"cmd-compact":Te(P)}]]),onClick:Se=>Me(P)},[v("span",{class:rt(["cmd-chevron",{"cmd-chevron-open":we(P)}])},"▶",2),v("code",Ib,Y(((ge=P.commandExecution)==null?void 0:ge.command)||"(command)"),1),v("span",Eb,Y(He(P)),1)],10,Sb),v("div",{class:rt(["cmd-output-wrap",{"cmd-output-visible":we(P)}])},[v("div",Cb,[v("pre",{class:rt(["cmd-output",{"cmd-output-condensed":me(P)}]),textContent:Y(((V=P.commandExecution)==null?void 0:V.aggregatedOutput)||"(no output)")},null,10,Ab)])],2)])}),128))])):fe("",!0)])):u(h)?(w(),k("div",{key:1,class:"plan-card","data-streaming":h.messageType==="plan.live"},[v("div",Rb,[m[4]||(m[4]=v("p",{class:"plan-card-title"},"Plan",-1)),h.messageType==="plan.live"?(w(),k("span",Pb,"Updating")):fe("",!0)]),ce(h)?(w(),k("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:ht(ce(h))},null,8,Mb)):fe("",!0),K(h).length>0?(w(),k("ol",$b,[(w(!0),k(De,null,yt(K(h),(P,ge)=>(w(),k("li",{key:`${h.id}:plan-step:${ge}`,class:"plan-step-item","data-status":P.status},[v("span",{class:"plan-step-status","data-status":P.status},Y(ee(P.status)),9,Nb),v("div",{class:"plan-step-text plan-card-markdown",innerHTML:ht(P.step)},null,8,Lb)],8,Ob))),128))])):(w(),k("div",{key:2,class:"plan-card-markdown",innerHTML:ht(h.text)},null,8,Db))],8,xb)):(w(),k("div",jb,[(w(!0),k(De,null,yt(x(h.text),(P,ge)=>(w(),k(De,{key:`block-${ge}`},[P.kind==="paragraph"?(w(),k("p",Fb,[(w(!0),k(De,null,yt(Wt(P.value),(V,Se)=>(w(),k(De,{key:`seg-${ge}-${Se}`},[V.kind==="text"?(w(),k("span",Bb,Y(V.value),1)):V.kind==="bold"?(w(),k("strong",Ub,Y(V.value),1)):V.kind==="italic"?(w(),k("em",Hb,Y(V.value),1)):V.kind==="strikethrough"?(w(),k("s",Wb,Y(V.value),1)):V.kind==="file"?(w(),k("a",{key:4,class:"message-file-link",href:Ut(V.path),target:"_blank",rel:"noopener noreferrer",title:V.path},Y(V.displayPath),9,Vb)):V.kind==="url"?(w(),k("a",{key:5,class:"message-file-link",href:V.href,target:"_blank",rel:"noopener noreferrer",title:V.href},Y(V.value),9,zb)):(w(),k("code",qb,Y(V.value),1))],64))),128))])):P.kind==="heading"?(w(),_t(Ii(Ze(P.level)),{key:1,class:rt(["message-heading",kt(P.level)])},{default:At(()=>[(w(!0),k(De,null,yt(Wt(P.value),(V,Se)=>(w(),k(De,{key:`heading-seg-${ge}-${Se}`},[V.kind==="text"?(w(),k("span",Gb,Y(V.value),1)):V.kind==="bold"?(w(),k("strong",Kb,Y(V.value),1)):V.kind==="italic"?(w(),k("em",Jb,Y(V.value),1)):V.kind==="strikethrough"?(w(),k("s",Yb,Y(V.value),1)):V.kind==="file"?(w(),k("a",{key:4,class:"message-file-link",href:Ut(V.path),target:"_blank",rel:"noopener noreferrer",title:V.path},Y(V.displayPath),9,Qb)):V.kind==="url"?(w(),k("a",{key:5,class:"message-file-link",href:V.href,target:"_blank",rel:"noopener noreferrer",title:V.href},Y(V.value),9,Xb)):(w(),k("code",Zb,Y(V.value),1))],64))),128))]),_:2},1032,["class"])):P.kind==="blockquote"?(w(),k("blockquote",e_,[(w(!0),k(De,null,yt(Wt(P.value),(V,Se)=>(w(),k(De,{key:`quote-seg-${ge}-${Se}`},[V.kind==="text"?(w(),k("span",t_,Y(V.value),1)):V.kind==="bold"?(w(),k("strong",n_,Y(V.value),1)):V.kind==="italic"?(w(),k("em",r_,Y(V.value),1)):V.kind==="strikethrough"?(w(),k("s",s_,Y(V.value),1)):V.kind==="file"?(w(),k("a",{key:4,class:"message-file-link",href:Ut(V.path),target:"_blank",rel:"noopener noreferrer",title:V.path},Y(V.displayPath),9,o_)):V.kind==="url"?(w(),k("a",{key:5,class:"message-file-link",href:V.href,target:"_blank",rel:"noopener noreferrer",title:V.href},Y(V.value),9,i_)):(w(),k("code",a_,Y(V.value),1))],64))),128))])):P.kind==="unorderedList"?(w(),k("ul",l_,[(w(!0),k(De,null,yt(P.items,(V,Se)=>(w(),k("li",{key:`ul-${ge}-${Se}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:it(V)},null,8,c_)]))),128))])):P.kind==="taskList"?(w(),k("ul",u_,[(w(!0),k(De,null,yt(P.items,(V,Se)=>(w(),k("li",{key:`task-${ge}-${Se}`,class:"message-task-item"},[v("span",{class:"message-task-checkbox","data-checked":V.checked},Y(V.checked?"☑":"☐"),9,d_),v("div",f_,[(w(!0),k(De,null,yt(Wt(V.text),(Oe,Qe)=>(w(),k(De,{key:`task-seg-${ge}-${Se}-${Qe}`},[Oe.kind==="text"?(w(),k("span",h_,Y(Oe.value),1)):Oe.kind==="bold"?(w(),k("strong",p_,Y(Oe.value),1)):Oe.kind==="italic"?(w(),k("em",m_,Y(Oe.value),1)):Oe.kind==="strikethrough"?(w(),k("s",g_,Y(Oe.value),1)):Oe.kind==="file"?(w(),k("a",{key:4,class:"message-file-link",href:Ut(Oe.path),target:"_blank",rel:"noopener noreferrer",title:Oe.path},Y(Oe.displayPath),9,v_)):Oe.kind==="url"?(w(),k("a",{key:5,class:"message-file-link",href:Oe.href,target:"_blank",rel:"noopener noreferrer",title:Oe.href},Y(Oe.value),9,y_)):(w(),k("code",w_,Y(Oe.value),1))],64))),128))])]))),128))])):P.kind==="orderedList"?(w(),k("ol",{key:5,class:"message-list message-list-ordered",start:P.start},[(w(!0),k(De,null,yt(P.items,(V,Se)=>(w(),k("li",{key:`ol-${ge}-${Se}`,class:"message-list-item"},[v("div",{class:"message-list-item-content",innerHTML:it(V)},null,8,__)]))),128))],8,b_)):P.kind==="codeBlock"?(w(),k("div",k_,[P.language?(w(),k("div",T_,Y(P.language),1)):fe("",!0),v("pre",S_,[v("code",null,Y(P.value),1)])])):P.kind==="thematicBreak"?(w(),k("hr",I_)):Fs(h.id,ge)?(w(),k("p",E_,Y(P.markdown),1)):(w(),k("button",{key:9,class:"message-image-button",type:"button",onClick:V=>Er(P.url)},[v("img",{class:"message-image-preview message-markdown-image",src:P.url,alt:P.alt||"Embedded message image",loading:"lazy",onError:V=>Cr(h.id,ge)},null,40,A_)],8,C_))],64))),128))]))],8,wb)):fe("",!0),ut(h)?(w(),k("div",{key:3,class:"message-toolbar","data-role":h.role},[dt(h)?(w(),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=>Tt(h.id)},[je(Po,{class:"icon-svg message-fork-icon"}),m[5]||(m[5]=v("span",{class:"message-fork-label"},"Fork",-1))],8,R_)):fe("",!0),v("button",{type:"button",class:"message-copy-button","data-copied":W.value===h.id,"aria-label":W.value===h.id?"Response copied":"Copy response",title:W.value===h.id?"Response copied":"Copy response",onClick:P=>rn(h.id)},[je(Uw,{class:"icon-svg message-copy-icon"}),v("span",M_,Y(W.value===h.id?"Copied":"Copy"),1)],8,P_)],8,x_)):fe("",!0)],8,hb)],8,fb)],8,db))],8,Kw))],64)}),128)),e.liveOverlay?(w(),k("li",$_,[v("div",O_,[v("div",N_,[v("article",L_,[v("p",D_,Y(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(w(),k("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:mt},Y(e.liveOverlay.reasoningText),513)):fe("",!0),e.liveOverlay.errorText?(w(),k("p",j_,Y(e.liveOverlay.errorText),1)):fe("",!0)])])])])):fe("",!0),(w(!0),k(De,null,yt(e.pendingRequests,h=>(w(),k("li",{key:`server-request:${h.id}`,class:"conversation-item conversation-item-request"},[v("div",F_,[v("div",B_,[v("article",U_,[v("p",H_,Y(h.method),1),v("p",W_,"Request #"+Y(h.id)+" · "+Y(Un(h.receivedAtIso)),1),Hn(h)?(w(),k("p",V_,Y(Hn(h)),1)):fe("",!0),h.method==="item/commandExecution/requestApproval"?(w(),k("section",z_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>hn(h.id,"accept")},"Accept",8,q_),v("button",{type:"button",class:"request-button",onClick:A=>hn(h.id,"acceptForSession")},"Accept for Session",8,G_),v("button",{type:"button",class:"request-button",onClick:A=>hn(h.id,"decline")},"Decline",8,K_),v("button",{type:"button",class:"request-button",onClick:A=>hn(h.id,"cancel")},"Cancel",8,J_)])):h.method==="item/fileChange/requestApproval"?(w(),k("section",Y_,[v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>hn(h.id,"accept")},"Accept",8,Q_),v("button",{type:"button",class:"request-button",onClick:A=>hn(h.id,"acceptForSession")},"Accept for Session",8,X_),v("button",{type:"button",class:"request-button",onClick:A=>hn(h.id,"decline")},"Decline",8,Z_),v("button",{type:"button",class:"request-button",onClick:A=>hn(h.id,"cancel")},"Cancel",8,ek)])):h.method==="item/tool/requestUserInput"?(w(),k("section",tk,[(w(!0),k(De,null,yt(Yr(h),A=>{var L;return w(),k("div",{key:`${h.id}:${A.id}`,class:"request-question"},[v("p",nk,Y(A.header||A.question),1),A.header&&A.question?(w(),k("p",rk,Y(A.question),1)):fe("",!0),A.options.length>0?(w(),k("select",{key:1,class:"request-select",value:nr(h.id,A.id,((L=A.options[0])==null?void 0:L.label)||""),onChange:P=>Ir(h.id,A.id,P)},[(w(!0),k(De,null,yt(A.options,P=>(w(),k("option",{key:`${h.id}:${A.id}:${P.label}`,value:P.label},Y(P.label),9,ok))),128))],40,sk)):fe("",!0),A.options.length>0&&rr(h.id,A)?(w(),k("p",ik,Y(rr(h.id,A)),1)):(w(),k("input",{key:3,class:"request-input",type:A.isSecret?"password":"text",value:nr(h.id,A.id,""),placeholder:A.isSecret?"Enter secret answer":"Enter answer",onInput:P=>vs(h.id,A.id,P)},null,40,ak)),A.isOther?(w(),k("input",{key:4,class:"request-input",type:A.isSecret?"password":"text",value:Qr(h.id,A.id),placeholder:"Other answer",onInput:P=>Xr(h.id,A.id,P)},null,40,lk)):fe("",!0)])}),128)),v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>ys(h)}," Submit Answers ",8,ck)])):h.method==="item/tool/call"?(w(),k("section",uk,[v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>I(h.id)},"Fail Tool Call",8,dk),v("button",{type:"button",class:"request-button",onClick:A=>R(h.id)},"Success (Empty)",8,fk)])):(w(),k("section",hk,[v("button",{type:"button",class:"request-button request-button-primary",onClick:A=>N(h.id)},"Return Empty Result",8,pk),v("button",{type:"button",class:"request-button",onClick:A=>ne(h.id)},"Reject Request",8,mk)]))])])])]))),128)),v("li",{ref_key:"bottomAnchorRef",ref:gt,class:"conversation-bottom-anchor"},null,512)],544)),M.value?(w(),k("button",{key:3,type:"button",class:"jump-to-latest-button",title:"Jump to latest","aria-label":"Jump to latest output",onClick:ws},[je(Kf,{class:"icon-svg jump-to-latest-icon"})])):fe("",!0),qe.value.length>0?(w(),k("div",{key:4,class:"image-modal-backdrop",onClick:Bs},[v("div",{class:"image-modal-content",onClick:m[0]||(m[0]=It(()=>{},["stop"]))},[v("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Bs},[je(ql,{class:"icon-svg"})]),v("img",{class:"image-modal-image",src:qe.value,alt:"Expanded message image"},null,8,gk)])])):fe("",!0)]))}}),wk=wt(yk,[["__scopeId","data-v-2a153243"]]),bu=.0025,ba=3,_u=2,bk=256;function _k(e){var Me;const t=j("idle"),n=j(typeof navigator<"u"&&!!((Me=navigator.mediaDevices)!=null&&Me.getUserMedia)),r=j(0),s=j(null);let o=null,i=null,a=[],l=null,f=null,u=null,g=null,_=[],E=!1,U=!1;function $(){const ae=s.value;if(!ae||typeof window>"u")return;const se=ae.getContext("2d");if(!se)return;const ue=Math.max(1,Math.floor(ae.clientWidth)),te=Math.max(1,Math.floor(ae.clientHeight||36)),Re=window.devicePixelRatio||1,Je=Math.max(1,Math.floor(ue*Re)),ze=Math.max(1,Math.floor(te*Re));(ae.width!==Je||ae.height!==ze)&&(ae.width=Je,ae.height=ze),se.setTransform(Re,0,0,Re,0,0),se.clearRect(0,0,ue,te);const We=Math.max(12,Math.floor(ue/(ba+_u))),He=_.slice(-We),Pe=Math.max(0,We-He.length),nt=te/2,et=getComputedStyle(ae).color||"#000000";for(let ke=0;ke<We;ke+=1){const at=He[ke-Pe]??0,gt=Math.max(.08,Math.min(1,at*18))*nt,mt=ke*(ba+_u);se.globalAlpha=at<=bu?.35:1,se.fillStyle=et,se.fillRect(mt,nt-gt,ba,gt*2)}se.globalAlpha=1}function X(){_=[],r.value=0,$()}function ce(){u&&(u.disconnect(),u.onaudioprocess=null,u=null),f&&(f.disconnect(),f=null),l&&(l.close(),l=null),g=null}function K(ae){if(typeof window>"u")return;const se=window.webkitAudioContext,ue=window.AudioContext??se;ue&&(ce(),X(),l=new ue,f=l.createMediaStreamSource(ae),u=l.createScriptProcessor(2048,1,1),g=performance.now(),u.onaudioprocess=te=>{const Re=te.inputBuffer.getChannelData(0);let Je=0;for(let ze=0;ze<Re.length;ze+=1){const We=Math.abs(Re[ze]??0);Je+=We<bu?0:We}_.push(Je/Re.length),_.length>bk&&_.shift(),g!==null&&(r.value=Math.max(0,performance.now()-g)),$()},f.connect(u),u.connect(l.destination),$())}async function ee(){var ae;if(!(t.value!=="idle"||!n.value||E)){E=!0,U=!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 te;const se=a,ue=(o==null?void 0:o.mimeType)||((te=se[0])==null?void 0:te.type)||"audio/webm";Te(),we(se,ue)},K(i),o.start(250),t.value="recording",U&&re()}catch(se){Te(),t.value="idle",(ae=e.onError)==null||ae.call(e,se)}finally{E=!1}}}function re(){if(E&&t.value==="idle"){U=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}async function we(ae,se){var te,Re,Je,ze;if(ae.length===0){(te=e.onEmpty)==null||te.call(e),t.value="idle";return}const ue=new Blob(ae,{type:se});t.value="transcribing";try{const We=se.split(/[/;]/)[1]??"webm",He=new FormData;He.append("file",ue,`codex.${We}`);const Pe=await fetch("/codex-api/transcribe",{method:"POST",body:He}),nt=await Pe.text();let et=null;try{et=nt.trim()?JSON.parse(nt):null}catch{et=null}if(!Pe.ok){const at=(Re=et==null?void 0:et.error)==null?void 0:Re.trim(),Ot=nt.trim();throw new Error(at||Ot||`Transcription failed: ${Pe.status}`)}const ke=((et==null?void 0:et.text)??"").trim();ke.length>0?e.onTranscript(ke):(Je=e.onEmpty)==null||Je.call(e)}catch(We){(ze=e.onError)==null||ze.call(e,We)}finally{t.value="idle"}}function Te(){ce(),X(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(ae=>ae.stop()),i=null),a=[]}Jr(Te);function me(){if(t.value==="recording"){re();return}t.value==="idle"&&ee()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:ee,stopRecording:re,toggleRecording:me}}function ku(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class Fr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Gl(e,t){const n=ku(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=ku(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function ms(e,t,n){return e instanceof Fr?e:e instanceof Error?new Fr(e.message||t,{code:"unknown_error",method:n}):new Fr(t,{code:"unknown_error",method:n})}function Jf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function kk(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 Fr(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 Fr(Gl(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 Fr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function Tk(e){const t=Jf(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 Tu(e,t={ok:!0}){e({method:"ready",params:t,atIso:new Date().toISOString()})}function Sk(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=Tk(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};Tu(e,E)}catch{Tu(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,U=window.setTimeout(()=>{_||n||E||(E=!0,g.close(),a())},2500);g.onopen=()=>{_=!0,s(),U!==null&&(window.clearTimeout(U),U=null)},g.onmessage=$=>{try{i(JSON.parse(String($.data)))}catch{}},g.onerror=()=>{},g.onclose=()=>{if(U!==null&&(window.clearTimeout(U),U=null),!(n||E)){if(!_){a();return}o(()=>l(f+1),f)}},t=()=>{E=!0,U!==null&&(window.clearTimeout(U),U=null),g.close()}};return typeof WebSocket<"u"?l():a(),()=>{n=!0,s(),t==null||t()}}async function Ik(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 Fr(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 Fr(Gl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function Ek(){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 Fr(Gl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Jf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function Su(e){return new Date(e*1e3).toISOString()}function Ck(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Ak(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const xk=/^##\s+(.+?):\s+(.+?)\s*$/,Rk=/^#\s*files mentioned by the user\s*:?\s*$/i;function Pk(e){var s,o;const t=e.split(`
52
+ `).findIndex(i=>Rk.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(xk);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 Mk(e){const t=/(?:^|\n)\s{0,3}#{0,6}\s*my request for codex\s*:?\s*/giu,n=Array.from(e.matchAll(t));if(n.length===0)return e.trim();const r=n.at(-1);if(!r||typeof r.index!="number")return e.trim();const s=r.index+r[0].length;return e.slice(s).trim()}function $k(e,t){if(!Array.isArray(t))return{text:"",images:[],fileAttachments:[],rawBlocks:[]};const n=[],r=[],s=[];for(const[a,l]of t.entries())l.type==="text"&&typeof l.text=="string"&&l.text.length>0&&n.push(l.text),l.type==="image"&&typeof l.url=="string"&&l.url.trim().length>0&&r.push(l.url.trim()),l.type!=="text"&&l.type!=="image"&&s.push({id:`${e}:user-content:${a}`,role:"user",text:"",messageType:`userContent.${l.type}`,rawPayload:Ak(l),isUnhandled:!0});const o=n.join(`
54
+ `),i=Pk(o);return{text:Mk(o),images:r,fileAttachments:i,rawBlocks:s}}function Ok(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 Nk(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=$k(e.id,e.content),n=[];return(t.text.length>0||t.images.length>0||t.fileAttachments.length>0)&&n.push({id:e.id,role:"user",text:t.text,images:t.images,fileAttachments:t.fileAttachments.length>0?t.fileAttachments:void 0,messageType:e.type}),n.push(...t.rawBlocks),n.length===0?[]:n}if(e.type==="reasoning")return[];if(e.type==="plan"){const t=typeof e.text=="string"?e.text:"";return[{id:e.id,role:"assistant",text:t,messageType:"plan",plan:Ok(t)??void 0}]}if(e.type==="commandExecution"){const t=e,n=Lk(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 Lk(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function Dk(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 jk(e){const t=Dk(e);return t.length>0?t:"Untitled thread"}function Yf(e){return(e==null?void 0:e.status)==="inProgress"}function Fk(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 Yf(r)}function Bk(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:jk(e),projectName:Ck(e.cwd),cwd:e.cwd,hasWorktree:r,createdAtIso:Su(e.createdAt),updatedAtIso:Su(e.updatedAt),preview:e.preview,unread:!1,inProgress:Fk(e)}}function Uk(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 Hk(e){const t=e.data.map(Bk);return Uk(t)}function Kl(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 Nk(i))n.push({...a,turnIndex:r})}return n}function Wk(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Yf(t.at(-1))}function _a(e){return e&&e.length>0?e:null}function ka(e){return e&&e.length>0?e:null}const Iu=[{value:"default",label:"Default"},{value:"plan",label:"Plan"}];function Zn(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}function ln(e){return typeof e=="string"&&e.length>0?e:null}function Ta(e){return typeof e=="number"&&Number.isFinite(e)?e:null}function ol(e){return typeof e=="boolean"?e:null}function Vk(e){return e==="payment_required"?e:null}function zk(e){if(!e)return!1;const t=e.toLowerCase();return t.includes("payment required")||/\b402\b/.test(t)}function Eu(e){const t=Zn(e);if(!t)return null;const n=Ta(t.usedPercent??t.used_percent);return n===null?null:{usedPercent:n,windowMinutes:Ta(t.windowDurationMins??t.window_minutes),resetsAt:Ta(t.resetsAt??t.resets_at)}}function qk(e){const t=Zn(e);if(!t)return null;const n=ol(t.hasCredits??t.has_credits),r=ol(t.unlimited);return n===null||r===null?null:{hasCredits:n,unlimited:r,balance:ln(t.balance)}}function il(e){const t=Zn(e);if(!t)return null;const n=Eu(t.primary),r=Eu(t.secondary),s=qk(t.credits);return!n&&!r&&!s?null:{limitId:ln(t.limitId??t.limit_id),limitName:ln(t.limitName??t.limit_name),primary:n,secondary:r,credits:s,planType:ln(t.planType??t.plan_type)}}function Qf(e,t=null){const n=Zn(e);if(!n)return null;const r=ln(n.accountId),s=ln(n.quotaStatus),o=s==="loading"||s==="ready"||s==="error"?s:"idle";return r?{accountId:r,authMode:ln(n.authMode),email:ln(n.email),planType:ln(n.planType),lastRefreshedAtIso:ln(n.lastRefreshedAtIso)??"",lastActivatedAtIso:ln(n.lastActivatedAtIso),quotaSnapshot:il(n.quotaSnapshot),quotaUpdatedAtIso:ln(n.quotaUpdatedAtIso),quotaStatus:o,quotaError:ln(n.quotaError),unavailableReason:Vk(n.unavailableReason)??(zk(ln(n.quotaError))?"payment_required":null),isActive:ol(n.isActive)??r===t}:null}function Xf(e){const t=Zn(e);if(!t)return null;const n=Zn(t.rateLimitsByLimitId??t.rate_limits_by_limit_id),r=il(n==null?void 0:n.codex);return r||il(t.rateLimits??t.rate_limits)}async function un(e,t){try{return await kk(e,t)}catch(n){throw ms(n,`RPC ${e} failed`,e)}}function Gk(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}async function Kk(){const e=await un("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return Hk(e)}async function Jk(e){const t=await un("thread/read",{threadId:e,includeTurns:!0});return{messages:Kl(t),inProgress:Wk(t)}}async function Yk(){try{return await Kk()}catch(e){throw ms(e,"Failed to load thread groups","thread/list")}}async function Qk(e){try{return await Jk(e)}catch(t){throw ms(t,`Failed to load thread ${e}`,"thread/read")}}function Xk(e){return Sk(e)}async function Zk(e,t){await Ik({id:e,...t})}async function e0(){return Ek()}async function t0(){try{const e=await un("account/rateLimits/read");return Xf(e)}catch(e){throw ms(e,"Failed to load account rate limits","account/rateLimits/read")}}function Jl(e){const t=Zn(e),n=ln(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:ln(t==null?void 0:t.importedAccountId)??void 0,accounts:r.map(s=>Qf(s,n)).filter(s=>s!==null)}}async function n0(){const e=await fetch("/codex-api/accounts"),t=await e.json();if(!e.ok)throw new Error(js(t,"Failed to load accounts"));const n=Zn(t);return Jl(n==null?void 0:n.data)}async function r0(){const e=await fetch("/codex-api/accounts/refresh",{method:"POST"}),t=await e.json();if(!e.ok)throw new Error(js(t,"Failed to refresh accounts"));const n=Zn(t);return Jl(n==null?void 0:n.data)}async function s0(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(js(n,"Failed to switch account"));const r=Zn(n),s=Zn(r==null?void 0:r.data),o=Qf(s==null?void 0:s.account,ln(s==null?void 0:s.activeAccountId));if(!o)throw new Error("Failed to switch account");return o}async function o0(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(js(n,"Failed to remove account"));const r=Zn(n);return Jl(r==null?void 0:r.data)}async function Sa(e){await un("thread/resume",{threadId:e})}async function i0(e){await un("thread/archive",{threadId:e})}async function a0(e,t){await un("thread/name/set",{threadId:e,name:t})}async function Cu(e,t){const n=await un("thread/rollback",{threadId:e,numTurns:t});return Kl(n)}function Zf(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 l0(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 Au(e,t){try{const n={};typeof e=="string"&&e.trim().length>0&&(n.cwd=e.trim()),typeof t=="string"&&t.trim().length>0&&(n.model=t.trim());const r=await un("thread/start",n),s=Zf(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw ms(n,"Failed to start a new thread","thread/start")}}async function c0(e){try{const t=await un("thread/fork",{threadId:e,persistExtendedHistory:!0}),n=Zf(t);if(!n)throw new Error("thread/fork did not return a thread id");return{threadId:n,cwd:l0(t),messages:Kl(t)}}catch(t){throw ms(t,`Failed to fork thread ${e}`,"thread/fork")}}function u0(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 d0(e,t,n){var l;const r=(t==null?void 0:t.trim())??"";if(r)return{model:r,reasoningEffort:e==="plan"?_a(n):ka(n)};let s=null;try{s=await th()}catch{s=null}const o=(s==null?void 0:s.model.trim())??"";if(o)return{model:o,reasoningEffort:e==="plan"?_a(n??(s==null?void 0:s.reasoningEffort)):ka(n??(s==null?void 0:s.reasoningEffort))};let i=[];try{i=await eh()}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"?_a(n??(s==null?void 0:s.reasoningEffort)):ka(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 Ia(e,t,n=[],r,s,o,i=[],a){try{const l=(r==null?void 0:r.trim())??"",u=[{type:"text",text:u0(t,i)}];for(const E of n){const U=E.trim();U&&u.push({type:"image",url:U,image_url:U})}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 d0(a,l,s);_.collaborationMode={mode:a,settings:{model:E.model,reasoning_effort:E.reasoningEffort,developer_instructions:null}}}await un("turn/start",_)}catch(l){throw ms(l,`Failed to start turn for thread ${e}`,"turn/start")}}async function f0(e,t){const n=e.trim(),r=(t==null?void 0:t.trim())||"";if(n)try{if(!r)throw new Error("turn/interrupt requires turnId");await un("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw ms(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function h0(e){await un("setDefaultModel",{model:e})}async function eh(){const e=await un("model/list",{}),t=[];for(const n of e.data){const r=n.id||n.model;!r||t.includes(r)||t.push(r)}return t}async function th(){const e=await un("config/read",{}),t=e.config.model??"",n=Gk(e.config.model_reasoning_effort);return{model:t,reasoningEffort:n}}function p0(e){const t=e.trim();return t?t.replace(/[_-]+/g," ").replace(/\b\w/g,n=>n.toUpperCase()):""}async function m0(){try{const e=await un("collaborationMode/list",{}),t=new Set,n=[];for(const r of e.data){const s=r.mode;s!=="default"&&s!=="plan"||t.has(s)||(t.add(s),n.push({value:s,label:p0(r.name||s)||(s==="plan"?"Plan":"Default")}))}if(n.length>0){for(const r of Iu)t.has(r.value)||n.push(r);return n.sort((r,s)=>r.value===s.value?0:r.value==="default"?-1:1)}}catch{}return Iu}function g0(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 _o(){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 g0(n.data)}async function v0(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 xu(){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 Ru(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 Pu(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=js(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 y0(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=js(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 w0(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=js(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 b0(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 js(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 _0(){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 Ea(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 k0(e,t){var n;try{return((n=(await un("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function T0(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await un("skills/list",t),r=[],s=new Set;for(const o of n.data)for(const i of o.skills)!i.name||s.has(i.path)||(s.add(i.path),r.push({name:i.name,description:i.shortDescription||i.description||"",path:i.path,scope:i.scope,enabled:i.enabled}));return r}catch{return[]}}async function Mu(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 S0={},I0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function E0(e,t){return w(),k("svg",I0,[...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 C0=wt(S0,[["render",E0]]),A0={},x0={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function R0(e,t){return w(),k("svg",x0,[...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 $u=wt(A0,[["render",R0]]),P0=["disabled"],M0={class:"composer-dropdown-value"},$0={class:"composer-dropdown-menu"},O0={key:0,class:"composer-dropdown-search-wrap"},N0=["placeholder","onKeydown"],L0={class:"composer-dropdown-options",role:"listbox"},D0=["onClick"],j0={key:0,class:"composer-dropdown-empty"},F0={key:1,class:"composer-dropdown-add-wrap"},B0=["placeholder","onKeydown"],U0=on({__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=de(()=>{var ue;const se=n.options.find(te=>te.value===n.modelValue);return se?se.label:((ue=n.placeholder)==null?void 0:ue.trim())||""}),_=de(()=>n.openDirection??"down"),E=de(()=>n.enableSearch===!0),U=de(()=>n.showAddAction===!0),$=de(()=>{var se;return((se=n.searchPlaceholder)==null?void 0:se.trim())||"Quick search projects"}),X=de(()=>{var se;return((se=n.addActionLabel)==null?void 0:se.trim())||"Add new project"}),ce=de(()=>{var se;return((se=n.addPlaceholder)==null?void 0:se.trim())||"Project name or absolute path"}),K=de(()=>{const se=l.value.trim().toLowerCase();return se?n.options.filter(ue=>ue.label.toLowerCase().includes(se)||ue.value.toLowerCase().includes(se)):n.options});function ee(){n.disabled||(a.value=!a.value)}function re(se){r("update:modelValue",se),a.value=!1,l.value=""}function we(){var se;f.value=!0,u.value=((se=n.defaultAddValue)==null?void 0:se.trim())||"",Zt(()=>{var ue;return(ue=i.value)==null?void 0:ue.focus()})}function Te(){if(l.value.length>0){l.value="";return}a.value=!1}function me(){const se=u.value.trim();se&&(r("add",se),f.value=!1,u.value="",a.value=!1,l.value="")}function Me(){f.value=!1,u.value="",a.value=!1,l.value=""}function ae(se){if(!a.value)return;const ue=s.value;if(!ue)return;const te=se.target;te instanceof Node&&(ue.contains(te)||(a.value=!1,l.value="",f.value=!1,u.value=""))}return pt(a,se=>{if(!se){f.value=!1,u.value="";return}E.value&&Zt(()=>{var ue;return(ue=o.value)==null?void 0:ue.focus()})}),Kr(()=>{window.addEventListener("pointerdown",ae)}),Jr(()=>{window.removeEventListener("pointerdown",ae)}),(se,ue)=>(w(),k("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[v("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:ee},[v("span",M0,Y(g.value),1),je(Qi,{class:"composer-dropdown-chevron"})],8,P0),a.value?(w(),k("div",{key:0,class:rt(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":_.value==="up","composer-dropdown-menu-wrap-down":_.value==="down"}])},[v("div",$0,[E.value?(w(),k("div",O0,[Wr(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":ue[0]||(ue[0]=te=>l.value=te),class:"composer-dropdown-search-input",type:"text",placeholder:$.value,onKeydown:An(It(Te,["prevent"]),["esc"])},null,40,N0),[[Vr,l.value]])])):fe("",!0),v("ul",L0,[(w(!0),k(De,null,yt(K.value,te=>(w(),k("li",{key:te.value},[v("button",{class:rt(["composer-dropdown-option",{"is-selected":te.value===e.modelValue}]),type:"button",onClick:Re=>re(te.value)},Y(te.label),11,D0)]))),128)),K.value.length===0?(w(),k("li",j0," No matching projects ")):fe("",!0)]),U.value?(w(),k("div",F0,[f.value?(w(),k(De,{key:0},[Wr(v("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":ue[1]||(ue[1]=te=>u.value=te),class:"composer-dropdown-add-input",type:"text",placeholder:ce.value,onKeydown:[An(It(me,["prevent"]),["enter"]),An(It(Me,["prevent"]),["esc"])]},null,40,B0),[[Vr,u.value]]),v("div",{class:"composer-dropdown-add-actions"},[v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:me},"Open"),v("button",{type:"button",class:"composer-dropdown-add-btn",onClick:Me},"Cancel")])],64)):(w(),k("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:we},Y(X.value),1))])):fe("",!0)])],2)):fe("",!0)],512))}}),al=wt(U0,[["__scopeId","data-v-7cfa2012"]]),H0=["disabled"],W0={class:"search-dropdown-value"},V0={class:"search-dropdown-search-wrap"},z0=["placeholder","onKeydown"],q0={key:0,class:"search-dropdown-list",role:"listbox"},G0=["onClick","onPointerenter"],K0={class:"search-dropdown-option-check"},J0={class:"search-dropdown-option-label"},Y0={key:0,class:"search-dropdown-option-desc"},Q0={key:1,class:"search-dropdown-empty"},X0=on({__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=de(()=>n.openDirection??"down"),u=de(()=>new Set(n.selectedValues)),g=de(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const K=n.options.find(ee=>ee.value===n.selectedValues[0]);return(K==null?void 0:K.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),_=de(()=>{const K=a.value.toLowerCase().trim();return K?n.options.filter(ee=>{var re;return ee.label.toLowerCase().includes(K)||(((re=ee.description)==null?void 0:re.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 U(K){r("toggle",K.value,!u.value.has(K.value))}function $(K){_.value.length!==0&&(l.value=(l.value+K+_.value.length)%_.value.length)}function X(){const K=_.value[l.value];K&&U(K)}function ce(K){if(!i.value)return;const ee=s.value;if(!ee)return;const re=K.target;re instanceof Node&&(ee.contains(re)||(i.value=!1))}return pt(a,()=>{l.value=0}),Kr(()=>window.addEventListener("pointerdown",ce)),Jr(()=>window.removeEventListener("pointerdown",ce)),(K,ee)=>(w(),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",W0,Y(g.value),1),je(Qi,{class:"search-dropdown-chevron"})],8,H0),i.value?(w(),k("div",{key:0,class:rt(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":f.value==="up","search-dropdown-menu-wrap-down":f.value==="down"}])},[v("div",V0,[Wr(v("input",{ref_key:"searchRef",ref:o,"onUpdate:modelValue":ee[0]||(ee[0]=re=>a.value=re),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[ee[1]||(ee[1]=An(It(re=>i.value=!1,["prevent"]),["escape"])),An(It(X,["prevent"]),["enter"]),ee[2]||(ee[2]=An(It(re=>$(1),["prevent"]),["arrow-down"])),ee[3]||(ee[3]=An(It(re=>$(-1),["prevent"]),["arrow-up"]))]},null,40,z0),[[Vr,a.value]])]),_.value.length>0?(w(),k("ul",q0,[(w(!0),k(De,null,yt(_.value,(re,we)=>(w(),k("li",{key:re.value},[v("button",{class:rt(["search-dropdown-option",{"is-selected":u.value.has(re.value),"is-highlighted":we===l.value}]),type:"button",onClick:Te=>U(re),onPointerenter:Te=>l.value=we},[v("span",K0,Y(u.value.has(re.value)?"✓":""),1),v("span",J0,Y(re.label),1),re.description?(w(),k("span",Y0,Y(re.description),1)):fe("",!0)],42,G0)]))),128))])):(w(),k("div",Q0,"No results"))],2)):fe("",!0)],512))}}),Z0=wt(X0,[["__scopeId","data-v-a0f2edd4"]]),eT={class:"skill-picker-header"},tT=["onKeydown"],nT={key:0,class:"skill-picker-list",role:"listbox"},rT=["onClick","onPointerenter"],sT={class:"skill-picker-name"},oT={key:0,class:"skill-picker-desc"},iT={key:1,class:"skill-picker-empty"},aT=on({__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=de(()=>{const _=i.value.toLowerCase().trim();return _?n.skills.filter(E=>E.name.toLowerCase().includes(_)||E.description.toLowerCase().includes(_)):n.skills}),f=de(()=>{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 pt(()=>n.visible,_=>{_&&(i.value="",a.value=0,Zt(()=>{var E;return(E=o.value)==null?void 0:E.focus()}))}),pt(i,()=>{a.value=0}),(_,E)=>e.visible?(w(),k("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:us(f.value)},[v("div",eT,[Wr(v("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":E[0]||(E[0]=U=>i.value=U),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[E[1]||(E[1]=An(It(U=>_.$emit("close"),["prevent"]),["escape"])),An(It(g,["prevent"]),["enter"]),E[2]||(E[2]=An(It(U=>u(1),["prevent"]),["arrow-down"])),E[3]||(E[3]=An(It(U=>u(-1),["prevent"]),["arrow-up"]))]},null,40,tT),[[Vr,i.value]])]),l.value.length>0?(w(),k("ul",nT,[(w(!0),k(De,null,yt(l.value,(U,$)=>(w(),k("li",{key:U.path},[v("button",{class:rt(["skill-picker-item",{"is-highlighted":$===a.value}]),type:"button",onClick:X=>_.$emit("select",U),onPointerenter:X=>a.value=$},[v("span",sT,Y(U.name),1),U.description?(w(),k("span",oT,Y(U.description),1)):fe("",!0)],42,rT)]))),128))])):(w(),k("div",iT,"No skills found"))],4)):fe("",!0)}}),lT=wt(aT,[["__scopeId","data-v-ff3fb7dc"]]),cT={key:0,class:"thread-composer-dictation-error"},uT={key:0,class:"thread-composer-attachments"},dT=["src","alt"],fT=["aria-label","disabled","onClick"],hT={key:1,class:"thread-composer-folder-chips"},pT=["title"],mT={class:"thread-composer-folder-chip-meta"},gT=["aria-label","disabled","onClick"],vT={key:2,class:"thread-composer-file-chips"},yT=["title"],wT=["aria-label","disabled","onClick"],bT={key:3,class:"thread-composer-skill-chips"},_T={class:"thread-composer-skill-chip-name"},kT=["aria-label","onClick"],TT=["title"],ST={class:"thread-composer-rate-limit-row"},IT={class:"thread-composer-rate-limit-value"},ET={key:0,class:"thread-composer-rate-limit-refresh"},CT={class:"thread-composer-input-wrap"},AT={key:0,class:"thread-composer-file-mentions"},xT=["onMousedown"],RT={key:1,class:"thread-composer-file-mention-icon-markdown"},PT={class:"thread-composer-file-mention-text"},MT={class:"thread-composer-file-mention-name"},$T={key:0,class:"thread-composer-file-mention-dir"},OT={key:1,class:"thread-composer-file-mention-empty"},NT=["placeholder","disabled"],LT=["disabled"],DT={key:0,class:"thread-composer-attach-menu"},jT=["disabled"],FT=["disabled"],BT=["disabled"],UT=["aria-label","aria-pressed","disabled"],HT={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},WT={key:1,class:"thread-composer-dictation-timer"},VT=["aria-label","title","disabled"],zT={key:1,class:"thread-composer-mic-spinner","aria-hidden":"true"},qT=["disabled"],GT=["aria-label","title","disabled"],KT=["disabled"],JT=["disabled"],YT=["disabled"],QT=on({__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:U,stopRecording:$,toggleRecording:X}=_k({onTranscript:x=>{s.value=s.value?`${s.value}
65
+ ${x}`:x,f.value="",Zt(()=>{var F;return(F=we.value)==null?void 0:F.focus()})},onEmpty:()=>{f.value=n.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:x=>{if(x instanceof DOMException&&x.name==="NotAllowedError"){f.value="Microphone access was denied.";return}f.value=x instanceof Error?x.message:"Dictation failed."}}),ce=j(null),K=j(null),ee=j(null),re=j(null),we=j(null),{isMobile:Te}=Vl(),me=j(!1),Me=j(!1),ae=j(null),se=j(""),ue=j([]),te=j(!1),Re=j(0);let Je=0,ze=null,We=!1;const 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=de(()=>n.models.map(x=>({value:x,label:x}))),nt=de(()=>n.selectedCollaborationMode==="plan"),et=de(()=>n.selectedCollaborationMode==="plan"&&n.selectedModel.trim().length===0),ke=de(()=>n.skills??[]),at=de(()=>i.value.map(x=>x.path)),Ot=de(()=>(n.skills??[]).map(x=>({value:x.path,label:x.name,description:x.description}))),gt=de(()=>n.disabled||!n.activeThreadId||et.value?!1:s.value.trim().length>0||o.value.length>0||a.value.length>0),mt=de(()=>{const x=new Set;for(const F of l.value)for(const oe of F.filePaths)x.add(oe);return a.value.filter(F=>!x.has(F.fsPath))}),qe=de(()=>n.disabled||!n.activeThreadId),W=de(()=>n.inProgressSubmitMode==="steer"?"steer":"queue"),be=de(()=>u.value==="recording"),he=de(()=>u.value==="recording"?"Stop dictation":u.value==="transcribing"?"Transcribing dictation":n.dictationClickToToggle?"Click to dictate":"Hold to dictate"),Ee=de(()=>u.value==="idle"?f.value.trim():""),Ae=de(()=>{const x=Math.max(0,Math.floor(_.value/1e3)),F=Math.floor(x/60),oe=x%60;return`${F}:${String(oe).padStart(2,"0")}`}),T=de(()=>n.activeThreadId?et.value?"Loading models for plan mode...":"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),S=de(()=>ye(n.codexQuota??null)),O=de(()=>""),Z=de(()=>Ce(n.codexQuota??null));function J(x){return!x||x==="unknown"?"":x==="edu"?"Education":`${x.slice(0,1).toUpperCase()}${x.slice(1)}`}function M(x){return typeof x!="number"||!Number.isFinite(x)||x<=0?"":x%1440===0?`${x/1440}d`:x%60===0?`${x/60}h`:`${x}m`}function z(x){if(typeof x!="number"||!Number.isFinite(x))return"";const oe=x*1e3-Date.now();if(oe<=0)return"resetting now";const Fe=Math.round(oe/6e4);if(Fe<60)return`resets in ${Math.max(1,Fe)}m`;const it=Math.round(Fe/60);if(it<48)return`resets in ${Math.max(1,it)}h`;const ft=Math.round(it/24);return`resets in ${Math.max(1,ft)}d`}function q(x){return typeof x!="number"||!Number.isFinite(x)?"":new Intl.DateTimeFormat(void 0,{weekday:"short",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(new Date(x*1e3))}function Q(x){if(typeof x!="number"||!Number.isFinite(x))return"";const F=new Date(x*1e3);return`${F.getMonth()+1}月${F.getDate()}日`}function G(x){const F=[x.primary,x.secondary].filter(it=>it!==null),oe=F.find(it=>it.windowMinutes===10080);if(oe)return oe;const Fe=F.filter(it=>typeof it.windowMinutes=="number"&&it.windowMinutes>=10080).sort((it,ft)=>(it.windowMinutes??0)-(ft.windowMinutes??0));return Fe[0]?Fe[0]:x.secondary??null}function Ie(x){const F=Math.max(0,Math.min(100,100-Math.round(x.usedPercent))),oe=M(x.windowMinutes);return oe?`${F}% / ${oe}`:`${F}%`}function ye(x){var ft,ht;if(!x)return"";const F=[],oe=J(x.planType);oe&&F.push(oe),x.primary&&F.push(Ie(x.primary)),x.secondary&&F.push(Ie(x.secondary));const Fe=G(x),it=Q((Fe==null?void 0:Fe.resetsAt)??null);return it&&F.push(it),F.length===0&&((ft=x.credits)!=null&&ft.unlimited)?F.push("Unlimited credits"):F.length===0&&((ht=x.credits)!=null&&ht.hasCredits)&&x.credits.balance&&F.push(`${x.credits.balance} credits`),F.join(" · ")}function Ce(x){var it,ft;if(!x)return"";const F=[],oe=J(x.planType);if(oe&&F.push(`Plan: ${oe}`),x.primary){const ht=z(x.primary.resetsAt);F.push(`Primary window: ${Ie(x.primary)}${ht?`, ${ht}`:""}`)}if(x.secondary){const ht=z(x.secondary.resetsAt);F.push(`Secondary window: ${Ie(x.secondary)}${ht?`, ${ht}`:""}`)}(it=x.credits)!=null&&it.unlimited?F.push("Credits: unlimited"):(ft=x.credits)!=null&&ft.hasCredits&&x.credits.balance&&F.push(`Credits: ${x.credits.balance}`);const Fe=G(x);if(Fe){const ht=q(Fe.resetsAt);ht&&F.push(`Weekly refresh: ${ht}`)}return F.join(`
66
+ `)}function xe(x="steer"){var oe;const F=s.value.trim();if(gt.value){if(r("submit",{text:F,imageUrls:o.value.map(Fe=>Fe.url),fileAttachments:[...a.value],skills:i.value.map(Fe=>({name:Fe.name,path:Fe.path})),mode:x}),s.value="",o.value=[],i.value=[],a.value=[],l.value=[],me.value=!1,Me.value=!1,Yt(),Te.value){(oe=we.value)==null||oe.blur();return}Zt(()=>{var Fe;return(Fe=we.value)==null?void 0:Fe.focus()})}}function Be(){r("interrupt")}function lt(x){r("update:selected-model",x)}function Ze(){r("update:selected-collaboration-mode",nt.value?"default":"plan")}function kt(x){r("update:selected-reasoning-effort",x)}function vt(){n.dictationClickToToggle&&(f.value&&(f.value=""),X())}function Mt(x){if(n.dictationClickToToggle||(x.preventDefault(),We))return;We=!0;const F=x.currentTarget;if(F)try{F.setPointerCapture(x.pointerId)}catch{}f.value&&(f.value=""),window.addEventListener("pointerup",Ye),window.addEventListener("pointercancel",Ye),window.addEventListener("blur",Ye),U()}function Ye(){n.dictationClickToToggle||We&&(We=!1,window.removeEventListener("pointerup",Ye),window.removeEventListener("pointercancel",Ye),window.removeEventListener("blur",Ye),$())}function jt(){qe.value||(me.value=!me.value)}function Ht(){var x;(x=K.value)==null||x.click()}function ut(){var x;(x=ee.value)==null||x.click()}function dt(){var x;(x=re.value)==null||x.click()}function bt(x){o.value=o.value.filter(F=>F.id!==x)}function rn(x){i.value=i.value.filter(F=>F.path!==x)}function Tt(x){a.value=a.value.filter(F=>F.fsPath!==x)}function St(x){const F=l.value.find(Fe=>Fe.id===x);if(!F)return;const oe=new Set(F.filePaths);a.value=a.value.filter(Fe=>!oe.has(Fe.fsPath)),l.value=l.value.filter(Fe=>Fe.id!==x)}function Pn(x){return x.total<=0?0:Math.round(x.processed/x.total*100)}function Dn(x,F){const oe=x.replace(/\\/g,"/");if(a.value.some(ft=>ft.fsPath===oe))return;const Fe=oe.split("/").filter(Boolean),it=(F==null?void 0:F.trim())||Fe[Fe.length-1]||oe;a.value=[...a.value,{label:it,path:oe,fsPath:oe}]}function bn(x){return x.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(x.name)}function Wt(x){const F=new FileReader;F.onload=()=>{typeof F.result=="string"&&o.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:x.name||`Pasted image ${o.value.length+1}`,url:F.result})},F.readAsDataURL(x)}function Bt(x){if(!(!x||x.length===0))for(const F of Array.from(x)){if(bn(F)){Wt(F);continue}Mu(F).then(oe=>{oe&&Dn(oe)}).catch(()=>{})}}function Ut(x){var Fe,it;const F=(Fe=x.clipboardData)==null?void 0:Fe.items;if(F&&F.length>0){const ft=[];for(const ht of Array.from(F)){if(ht.kind!=="file"||!ht.type.startsWith("image/"))continue;const Nt=ht.getAsFile();Nt&&ft.push(Nt)}if(ft.length>0)return ft}const oe=(it=x.clipboardData)==null?void 0:it.files;return!oe||oe.length===0?[]:Array.from(oe).filter(ft=>bn(ft))}function _n(x){if(qe.value)return;const F=Ut(x);F.length!==0&&(x.preventDefault(),Bt(F),me.value=!1,f.value&&(f.value=""))}async function Ct(x){if(!x||x.length===0)return;const F=Array.from(x),Fe=(F[0].webkitRelativePath||F[0].name).split("/").filter(Boolean)[0]||"Folder",it=`${Date.now()}-${Math.random().toString(36).slice(2)}`;l.value=[...l.value,{id:it,name:Fe,total:F.length,processed:0,filePaths:[],isUploading:!0}];const ft=ht=>{l.value=l.value.map(Nt=>Nt.id===it?ht(Nt):Nt)};for(const ht of F)try{const Nt=await Mu(ht);if(Nt){const Un=ht.webkitRelativePath||ht.name;Dn(Nt,Un),ft(Hn=>({...Hn,processed:Hn.processed+1,filePaths:[...Hn.filePaths,Nt]}));continue}ft(Un=>({...Un,processed:Un.processed+1}))}catch{ft(Nt=>({...Nt,processed:Nt.processed+1}))}ft(ht=>({...ht,isUploading:!1}))}function an(x){x&&(x.value="")}function en(x){const F=x.target;Bt((F==null?void 0:F.files)??null),an(F),me.value=!1}function jn(x){const F=x.target;Bt((F==null?void 0:F.files)??null),an(F),me.value=!1}function dn(x){const F=x.target;Ct((F==null?void 0:F.files)??null),an(F),me.value=!1}function sn(){f.value&&(f.value="");const F=s.value.startsWith("/");F!==Me.value&&(Me.value=F),Mn()}function er(x){if(te.value){if(x.key==="Escape"){x.preventDefault(),Yt();return}if(x.key==="ArrowDown"){x.preventDefault(),ue.value.length>0&&(Re.value=(Re.value+1)%ue.value.length);return}if(x.key==="ArrowUp"){if(x.preventDefault(),ue.value.length>0){const oe=ue.value.length;Re.value=(Re.value+oe-1)%oe}return}if(x.key==="Enter"||x.key==="Tab"){x.preventDefault();const oe=ue.value[Re.value];oe?$e(oe):Yt();return}}if(n.sendWithEnter!==!1?x.key==="Enter"&&!x.shiftKey:x.key==="Enter"&&(x.metaKey||x.ctrlKey)){x.preventDefault(),xe(n.isTurnInProgress?W.value:"steer");return}if(Me.value){if(x.key==="Escape"){x.preventDefault(),fn();return}if(x.key==="ArrowDown"||x.key==="ArrowUp"){x.preventDefault();return}}}function fn(){var x;Me.value=!1,(x=we.value)==null||x.focus()}function Yt(){te.value=!1,ae.value=null,se.value="",ue.value=[],Re.value=0}function Mn(){const x=we.value;if(!x){Yt();return}const F=x.selectionStart??s.value.length,Fe=s.value.slice(0,F).match(/(^|\s)(@[^\s@]*)$/);if(!Fe){Yt();return}const it=Fe[2]??"",ft=it.length,ht=F-ft;ae.value=ht,se.value=it.slice(1),te.value=!0,Ne()}async function Ne(){if(!te.value)return;const x=(n.cwd??"").trim();if(!x){ue.value=[];return}ze&&clearTimeout(ze);const F=++Je;ze=setTimeout(async()=>{try{const oe=await w0(x,se.value,20);if(!te.value||F!==Je)return;ue.value=oe,Re.value=0}catch{if(!te.value||F!==Je)return;ue.value=[]}},120)}function $e(x){const F=we.value,oe=ae.value;if(oe!==null&&F){const Fe=F.selectionStart??s.value.length;s.value=`${s.value.slice(0,oe)}${s.value.slice(Fe)}`.trimEnd()}Dn(x.path),Yt(),Zt(()=>F==null?void 0:F.focus())}function qn(x){const F=x.lastIndexOf("/");return F<0?x:x.slice(F+1)}function Qt(x){const F=x.lastIndexOf("/");return F<=0?"":x.slice(0,F)}function Fn(x){const F=qn(x),oe=F.lastIndexOf(".");return oe<=0?"":F.slice(oe+1).toLowerCase()}function tr(x){const F=Fn(x);return F==="ts"?"TS":F==="tsx"?"TSX":F==="js"?"JS":F==="jsx"?"JSX":F==="json"?"{}":""}function Gn(x){const F=Fn(x);return F.startsWith("ts")?"ts":F.startsWith("js")?"js":F==="json"?"json":"default"}function Kn(x){const F=Fn(x);return F==="md"||F==="mdx"}function Bn(x){var F;i.value.some(oe=>oe.path===x.path)||(i.value=[...i.value,x]),s.value=s.value.startsWith("/")?"":s.value,Me.value=!1,(F=we.value)==null||F.focus()}function $n(x,F){if(F){const oe=(n.skills??[]).find(Fe=>Fe.path===x);oe&&!i.value.some(Fe=>Fe.path===x)&&(i.value=[...i.value,oe])}else i.value=i.value.filter(oe=>oe.path!==x)}function kn(x){if(!me.value)return;const F=ce.value;if(!F)return;const oe=x.target;!oe||F.contains(oe)||(me.value=!1)}return Kr(()=>{document.addEventListener("click",kn)}),Jr(()=>{document.removeEventListener("click",kn),window.removeEventListener("pointerup",Ye),window.removeEventListener("pointercancel",Ye),window.removeEventListener("blur",Ye),ze&&clearTimeout(ze)}),pt(()=>n.activeThreadId,()=>{s.value="",o.value=[],i.value=[],a.value=[],l.value=[],f.value="",me.value=!1,Me.value=!1,Yt()}),pt(()=>n.cwd,()=>{te.value&&Ne()}),(x,F)=>(w(),k("form",{class:"thread-composer",onSubmit:F[2]||(F[2]=It(oe=>xe("steer"),["prevent"]))},[Ee.value?(w(),k("p",cT,Y(Ee.value),1)):fe("",!0),v("div",{class:rt(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[o.value.length>0?(w(),k("div",uT,[(w(!0),k(De,null,yt(o.value,oe=>(w(),k("div",{key:oe.id,class:"thread-composer-attachment"},[v("img",{class:"thread-composer-attachment-image",src:oe.url,alt:oe.name||"Selected image"},null,8,dT),v("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${oe.name||"image"}`,disabled:qe.value,onClick:Fe=>bt(oe.id)}," x ",8,fT)]))),128))])):fe("",!0),l.value.length>0?(w(),k("div",hT,[(w(!0),k(De,null,yt(l.value,oe=>(w(),k("span",{key:oe.id,class:"thread-composer-folder-chip"},[je(zl,{class:"thread-composer-folder-chip-icon"}),v("span",{class:"thread-composer-folder-chip-name",title:oe.name},Y(oe.name),9,pT),v("span",mT,[oe.isUploading?(w(),k(De,{key:0},[Bo(Y(Pn(oe))+"% uploading ("+Y(oe.processed)+"/"+Y(oe.total)+") ",1)],64)):(w(),k(De,{key:1},[Bo(Y(oe.filePaths.length)+" file"+Y(oe.filePaths.length===1?"":"s"),1)],64))]),v("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${oe.name}`,disabled:qe.value,onClick:Fe=>St(oe.id)},"×",8,gT)]))),128))])):fe("",!0),mt.value.length>0?(w(),k("div",vT,[(w(!0),k(De,null,yt(mt.value,oe=>(w(),k("span",{key:oe.fsPath,class:"thread-composer-file-chip"},[je(xi,{class:"thread-composer-file-chip-icon"}),v("span",{class:"thread-composer-file-chip-name",title:oe.fsPath},Y(oe.label),9,yT),v("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${oe.label}`,disabled:qe.value,onClick:Fe=>Tt(oe.fsPath)},"×",8,wT)]))),128))])):fe("",!0),i.value.length>0?(w(),k("div",bT,[(w(!0),k(De,null,yt(i.value,oe=>(w(),k("span",{key:oe.path,class:"thread-composer-skill-chip"},[v("span",_T,Y(oe.name),1),v("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${oe.name}`,onClick:Fe=>rn(oe.path)},"×",8,kT)]))),128))])):fe("",!0),S.value?(w(),k("div",{key:4,class:"thread-composer-rate-limit",title:Z.value,"aria-live":"polite"},[v("span",ST,[v("span",IT,Y(S.value),1)]),O.value?(w(),k("span",ET,Y(O.value),1)):fe("",!0)],8,TT)):fe("",!0),v("div",CT,[te.value?(w(),k("div",AT,[ue.value.length>0?(w(!0),k(De,{key:0},yt(ue.value,(oe,Fe)=>(w(),k("button",{key:oe.path,class:rt(["thread-composer-file-mention-row",{"is-active":Fe===Re.value}]),type:"button",onMousedown:It(it=>$e(oe),["prevent"])},[tr(oe.path)?(w(),k("span",{key:0,class:rt(["thread-composer-file-mention-icon-badge",`is-${Gn(oe.path)}`])},Y(tr(oe.path)),3)):Kn(oe.path)?(w(),k("span",RT,"↓")):(w(),_t(xi,{key:2,class:"thread-composer-file-mention-icon-file"})),v("span",PT,[v("span",MT,Y(qn(oe.path)),1),Qt(oe.path)?(w(),k("span",$T,Y(Qt(oe.path)),1)):fe("",!0)])],42,xT))),128)):(w(),k("div",OT,"No matching files"))])):fe("",!0),Wr(v("textarea",{ref_key:"inputRef",ref:we,"onUpdate:modelValue":F[0]||(F[0]=oe=>s.value=oe),class:"thread-composer-input",placeholder:T.value,disabled:qe.value,onInput:sn,onKeydown:er,onPaste:_n},null,40,NT),[[Vr,s.value]]),je(lT,{skills:ke.value,visible:Me.value,"anchor-bottom":44,"anchor-left":0,onSelect:Bn,onClose:fn},null,8,["skills","visible"])]),v("div",{class:rt(["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:qe.value,onClick:jt}," + ",8,LT),me.value?(w(),k("div",DT,[v("button",{class:"thread-composer-attach-item",type:"button",disabled:qe.value,onClick:Ht}," Add photos & files ",8,jT),v("button",{class:"thread-composer-attach-item",type:"button",disabled:qe.value,onClick:dt}," Add folder ",8,FT),v("button",{class:"thread-composer-attach-item",type:"button",disabled:qe.value,onClick:ut}," Take photo ",8,BT)])):fe("",!0)],512),be.value?fe("",!0):(w(),k(De,{key:0},[v("button",{class:rt(["thread-composer-plan-toggle",{"is-active":nt.value}]),type:"button","aria-label":nt.value?"Disable plan mode":"Enable plan mode","aria-pressed":nt.value,disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onClick:Ze},[...F[3]||(F[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,UT),je(al,{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":lt},null,8,["model-value","options","disabled"]),je(Z0,{class:"thread-composer-control",options:Ot.value,"selected-values":at.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"]),je(al,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:He,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":kt},null,8,["model-value","disabled"])],64)),v("div",{class:rt(["thread-composer-actions",{"thread-composer-actions--recording":be.value}])},[_e(u)==="recording"?(w(),k("div",HT,[v("canvas",{ref_key:"dictationWaveformCanvasRef",ref:E,class:"thread-composer-dictation-waveform"},null,512)])):fe("",!0),_e(u)==="recording"?(w(),k("span",WT,Y(Ae.value),1)):fe("",!0),_e(g)&&!e.isTurnInProgress?(w(),k("button",{key:2,class:rt(["thread-composer-mic",{"thread-composer-mic--active":_e(u)==="recording","thread-composer-mic--transcribing":_e(u)==="transcribing"}]),type:"button","aria-label":he.value,title:he.value,disabled:qe.value||_e(u)==="transcribing",onClick:vt,onPointerdown:Mt,onPointerup:Ye,onPointercancel:Ye},[_e(u)==="recording"?(w(),_t($u,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):_e(u)==="transcribing"?(w(),k("span",zT)):(w(),_t(C0,{key:2,class:"thread-composer-mic-icon"}))],42,VT)):fe("",!0),e.isTurnInProgress?(w(),k("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:Be},[je($u,{class:"thread-composer-stop-icon"})],8,qT)):fe("",!0),v("button",{class:rt(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&W.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&W.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${W.value}`:"Send",disabled:!gt.value,onClick:F[1]||(F[1]=oe=>xe(e.isTurnInProgress?W.value:"steer"))},[je(Kf,{class:"thread-composer-submit-icon"})],10,GT)],2)],2)],2),v("input",{ref_key:"photoLibraryInputRef",ref:K,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:qe.value,onChange:en},null,40,KT),v("input",{ref_key:"cameraCaptureInputRef",ref:ee,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:qe.value,onChange:jn},null,40,JT),v("input",{ref_key:"folderPickerInputRef",ref:re,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:qe.value,onChange:dn},null,40,YT)],32))}}),Ou=wt(QT,[["__scopeId","data-v-cb8737c8"]]),XT={key:0,class:"queued-messages"},ZT={class:"queued-messages-inner"},eS={class:"queued-row-text"},tS={class:"queued-row-actions"},nS=["onClick"],rS=["onClick"],sS=on({__name:"QueuedMessages",props:{messages:{}},emits:["steer","delete"],setup(e){return(t,n)=>e.messages.length>0?(w(),k("div",XT,[v("div",ZT,[(w(!0),k(De,null,yt(e.messages,r=>(w(),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",eS,Y(r.text),1),v("div",tS,[v("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:s=>t.$emit("steer",r.id)},"Steer",8,nS),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,rS)])]))),128))])])):fe("",!0)}}),oS=wt(sS,[["__scopeId","data-v-ea583733"]]),iS={class:"runtime-dropdown-trigger-label"},aS={key:0,class:"runtime-dropdown-menu-wrap"},lS={class:"runtime-dropdown-menu"},cS=["onClick"],uS={class:"runtime-dropdown-option-label"},dS={key:0,class:"runtime-dropdown-option-check"},fS=on({__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:zl},{value:"worktree",label:"New worktree",icon:Po}],a=de(()=>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 Kr(()=>{window.addEventListener("pointerdown",f)}),Jr(()=>{window.removeEventListener("pointerdown",f)}),(u,g)=>(w(),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)},[(w(),_t(Ii(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),v("span",iS,Y(a.value.label),1),je(Qi,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(w(),k("div",aS,[v("div",lS,[g[1]||(g[1]=v("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(w(),k(De,null,yt(i,_=>v("button",{key:_.value,class:rt(["runtime-dropdown-option",{"is-selected":e.modelValue===_.value}]),type:"button",onClick:E=>l(_.value)},[(w(),_t(Ii(_.icon),{class:"runtime-dropdown-option-icon"})),v("span",uS,Y(_.label),1),e.modelValue===_.value?(w(),k("span",dS,"✓")):fe("",!0)],10,cS)),64))])])):fe("",!0)],512))}}),hS=wt(fS,[["__scopeId","data-v-9c9b71e5"]]),pS={},mS={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function gS(e,t){return w(),k("svg",mS,[...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 ll=wt(pS,[["render",gS]]),vS={class:"skill-card-top"},yS=["src","alt"],wS={key:1,class:"skill-card-avatar-fallback"},bS={class:"skill-card-info"},_S={class:"skill-card-header"},kS={class:"skill-card-name"},TS={key:0,class:"skill-card-badge-disabled"},SS={key:1,class:"skill-card-badge"},IS={class:"skill-card-owner"},ES={key:0,class:"skill-card-desc"},CS={key:1,class:"skill-card-date"},AS=on({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=de(()=>{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)=>(w(),k("button",{class:rt(["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",vS,[e.skill.avatarUrl?(w(),k("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:r},null,40,yS)):(w(),k("div",wS,Y(e.skill.owner.charAt(0)),1)),v("div",bS,[v("div",_S,[v("span",kS,Y(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(w(),k("span",TS,"Disabled")):e.skill.installed?(w(),k("span",SS,"Installed")):fe("",!0)]),v("span",IS,Y(e.skill.owner),1)])]),e.skill.description?(w(),k("p",ES,Y(e.skill.description),1)):fe("",!0),n.value?(w(),k("span",CS,Y(n.value),1)):fe("",!0)],2))}}),Nu=wt(AS,[["__scopeId","data-v-2a1e8196"]]),xS={class:"sdm-panel"},RS={class:"sdm-header"},PS={class:"sdm-title-area"},MS=["src","alt"],$S={class:"sdm-title-col"},OS={class:"sdm-title-row"},NS={class:"sdm-title"},LS={key:0,class:"sdm-badge-disabled"},DS={class:"sdm-owner"},jS={class:"sdm-body"},FS={key:0,class:"sdm-desc"},BS={key:1,class:"sdm-readme-loading"},US=["innerHTML"],HS=["href"],WS={class:"sdm-footer"},VS={class:"sdm-footer-actions"},zS=["disabled"],qS=["disabled"],GS=["disabled"],KS=on({__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=de(()=>s.value??n.skill.enabled??!0),l=de(()=>n.isInstalling===!0||n.isUninstalling===!0),f=de(()=>{const $=o.value;if(!$)return"";const X=$.replace(/^---[\s\S]*?---\s*/,"");return u(X)});function u($){return $.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 $=new URLSearchParams({owner:n.skill.owner,name:n.skill.name}),X=await fetch(`/codex-api/skills-hub/readme?${$}`);if(!X.ok)return;const ce=await X.json();o.value=ce.content??""}catch{}finally{i.value=!1}}}pt(()=>n.visible,$=>{$&&(s.value=null,o.value="",g())});function _(){r("install",n.skill)}function E(){r("uninstall",n.skill)}function U(){const $=!a.value;s.value=$,r("toggle-enabled",n.skill,$)}return($,X)=>(w(),_t(Eo,{to:"body"},[e.visible?(w(),k("div",{key:0,class:"sdm-overlay",onClick:X[1]||(X[1]=It(ce=>$.$emit("close"),["self"]))},[v("div",xS,[v("div",RS,[v("div",PS,[e.skill.avatarUrl?(w(),k("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,MS)):fe("",!0),v("div",$S,[v("div",OS,[v("h3",NS,Y(e.skill.displayName||e.skill.name),1),e.skill.installed&&!a.value?(w(),k("span",LS,"Disabled")):fe("",!0)]),v("span",DS,Y(e.skill.owner),1)])]),v("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:X[0]||(X[0]=ce=>$.$emit("close"))},[je(ql,{class:"sdm-close-icon"})])]),v("div",jS,[e.skill.description?(w(),k("p",FS,Y(e.skill.description),1)):fe("",!0),i.value?(w(),k("div",BS,"Loading skill contents...")):o.value?(w(),k("div",{key:2,class:"sdm-readme",innerHTML:f.value},null,8,US)):fe("",!0),v("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,HS)]),v("div",WS,[v("div",VS,[e.skill.installed?(w(),k("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:l.value,onClick:E},Y(n.isUninstalling?"Uninstalling...":"Uninstall"),9,zS)):(w(),k("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:l.value,onClick:_},Y(n.isInstalling?"Installing...":"Install"),9,qS)),e.skill.installed?(w(),k("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:l.value,onClick:U},Y(a.value?"Disable":"Enable"),9,GS)):fe("",!0)])])])])):fe("",!0)]))}}),JS=wt(KS,[["__scopeId","data-v-19a385ca"]]),YS=()=>{};var Lu={};/**
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 nh=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},QS=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("")},rh={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(nh(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):QS(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 XS;const _=o<<2|a>>4;if(r.push(_),f!==64){const E=a<<4&240|f>>2;if(r.push(E),g!==64){const U=f<<6&192|g;r.push(U)}}}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 XS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ZS=function(e){const t=nh(e);return rh.encodeByteArray(t,!0)},sh=function(e){return ZS(e).replace(/\./g,"")},oh=function(e){try{return rh.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 eI(){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 tI=()=>eI().__FIREBASE_DEFAULTS__,nI=()=>{if(typeof process>"u"||typeof Lu>"u")return;const e=Lu.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},rI=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&oh(e[1]);return t&&JSON.parse(t)},Yl=()=>{try{return YS()||tI()||nI()||rI()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},sI=e=>{var t,n;return(n=(t=Yl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},ih=()=>{var e;return(e=Yl())==null?void 0:e.config},ah=e=>{var t;return(t=Yl())==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 oI{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 Rn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function iI(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Rn())}function aI(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function lI(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function cI(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function uI(){const e=Rn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function dI(){try{return typeof indexedDB=="object"}catch{return!1}}function fI(){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 hI="FirebaseError";class gs extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=hI,Object.setPrototypeOf(this,gs.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Qo.prototype.create)}}class Qo{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?pI(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new gs(s,a,r)}}function pI(e,t){return e.replace(mI,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const mI=/\{\$([^}]+)}/g;function gI(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function io(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(Du(o)&&Du(i)){if(!io(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function Du(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 Xo(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 vI(e,t){const n=new yI(e,t);return n.subscribe.bind(n)}class yI{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.");wI(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=Ca),s.error===void 0&&(s.error=Ca),s.complete===void 0&&(s.complete=Ca);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 wI(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 Ca(){}/**
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 co(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 Ql(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function bI(e){return(await fetch(e,{credentials:"include"})).ok}class ao{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 xs="[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 _I{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 oI;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(TI(t))try{this.getOrInitializeService({instanceIdentifier:xs})}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=xs){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=xs){return this.instances.has(t)}getOptions(t=xs){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:kI(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=xs){return this.component?this.component.multipleInstances?t:xs:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function kI(e){return e===xs?void 0:e}function TI(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 SI{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 _I(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 Lt;(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"})(Lt||(Lt={}));const II={debug:Lt.DEBUG,verbose:Lt.VERBOSE,info:Lt.INFO,warn:Lt.WARN,error:Lt.ERROR,silent:Lt.SILENT},EI=Lt.INFO,CI={[Lt.DEBUG]:"log",[Lt.VERBOSE]:"log",[Lt.INFO]:"info",[Lt.WARN]:"warn",[Lt.ERROR]:"error"},AI=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=CI[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 lh{constructor(t){this.name=t,this._logLevel=EI,this._logHandler=AI,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Lt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?II[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,Lt.DEBUG,...t),this._logHandler(this,Lt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Lt.VERBOSE,...t),this._logHandler(this,Lt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Lt.INFO,...t),this._logHandler(this,Lt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Lt.WARN,...t),this._logHandler(this,Lt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Lt.ERROR,...t),this._logHandler(this,Lt.ERROR,...t)}}const xI=(e,t)=>t.some(n=>e instanceof n);let ju,Fu;function RI(){return ju||(ju=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function PI(){return Fu||(Fu=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const ch=new WeakMap,cl=new WeakMap,uh=new WeakMap,Aa=new WeakMap,Xl=new WeakMap;function MI(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(ds(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&ch.set(n,e)}).catch(()=>{}),Xl.set(t,e),t}function $I(e){if(cl.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)});cl.set(e,t)}let ul={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return cl.get(e);if(t==="objectStoreNames")return e.objectStoreNames||uh.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return ds(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 OI(e){ul=e(ul)}function NI(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(xa(this),t,...n);return uh.set(r,t.sort?t.sort():[t]),ds(r)}:PI().includes(e)?function(...t){return e.apply(xa(this),t),ds(ch.get(this))}:function(...t){return ds(e.apply(xa(this),t))}}function LI(e){return typeof e=="function"?NI(e):(e instanceof IDBTransaction&&$I(e),xI(e,RI())?new Proxy(e,ul):e)}function ds(e){if(e instanceof IDBRequest)return MI(e);if(Aa.has(e))return Aa.get(e);const t=LI(e);return t!==e&&(Aa.set(e,t),Xl.set(t,e)),t}const xa=e=>Xl.get(e);function DI(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=ds(i);return r&&i.addEventListener("upgradeneeded",l=>{r(ds(i.result),l.oldVersion,l.newVersion,ds(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 jI=["get","getKey","getAll","getAllKeys","count"],FI=["put","add","delete","clear"],Ra=new Map;function Bu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Ra.get(t))return Ra.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=FI.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||jI.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 Ra.set(t,o),o}OI(e=>({...e,get:(t,n,r)=>Bu(t,n)||e.get(t,n,r),has:(t,n)=>!!Bu(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 BI{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(UI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function UI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const dl="@firebase/app",Uu="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 zr=new lh("@firebase/app"),HI="@firebase/app-compat",WI="@firebase/analytics-compat",VI="@firebase/analytics",zI="@firebase/app-check-compat",qI="@firebase/app-check",GI="@firebase/auth",KI="@firebase/auth-compat",JI="@firebase/database",YI="@firebase/data-connect",QI="@firebase/database-compat",XI="@firebase/functions",ZI="@firebase/functions-compat",eE="@firebase/installations",tE="@firebase/installations-compat",nE="@firebase/messaging",rE="@firebase/messaging-compat",sE="@firebase/performance",oE="@firebase/performance-compat",iE="@firebase/remote-config",aE="@firebase/remote-config-compat",lE="@firebase/storage",cE="@firebase/storage-compat",uE="@firebase/firestore",dE="@firebase/ai",fE="@firebase/firestore-compat",hE="firebase",pE="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 fl="[DEFAULT]",mE={[dl]:"fire-core",[HI]:"fire-core-compat",[VI]:"fire-analytics",[WI]:"fire-analytics-compat",[qI]:"fire-app-check",[zI]:"fire-app-check-compat",[GI]:"fire-auth",[KI]:"fire-auth-compat",[JI]:"fire-rtdb",[YI]:"fire-data-connect",[QI]:"fire-rtdb-compat",[XI]:"fire-fn",[ZI]:"fire-fn-compat",[eE]:"fire-iid",[tE]:"fire-iid-compat",[nE]:"fire-fcm",[rE]:"fire-fcm-compat",[sE]:"fire-perf",[oE]:"fire-perf-compat",[iE]:"fire-rc",[aE]:"fire-rc-compat",[lE]:"fire-gcs",[cE]:"fire-gcs-compat",[uE]:"fire-fst",[fE]:"fire-fst-compat",[dE]:"fire-vertex","fire-js":"fire-js",[hE]:"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 Vo=new Map,gE=new Map,hl=new Map;function Hu(e,t){try{e.container.addComponent(t)}catch(n){zr.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function zo(e){const t=e.name;if(hl.has(t))return zr.debug(`There were multiple attempts to register component ${t}.`),!1;hl.set(t,e);for(const n of Vo.values())Hu(n,e);for(const n of gE.values())Hu(n,e);return!0}function dh(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function wr(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 vE={"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."},fs=new Qo("app","Firebase",vE);/**
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 yE{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 ao("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 fs.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 Zo=pE;function fh(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:fl,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw fs.create("bad-app-name",{appName:String(s)});if(n||(n=ih()),!n)throw fs.create("no-options");const o=Vo.get(s);if(o){if(io(n,o.options)&&io(r,o.config))return o;throw fs.create("duplicate-app",{appName:s})}const i=new SI(s);for(const l of hl.values())i.addComponent(l);const a=new yE(n,r,i);return Vo.set(s,a),a}function hh(e=fl){const t=Vo.get(e);if(!t&&e===fl&&ih())return fh();if(!t)throw fs.create("no-app",{appName:e});return t}function wE(){return Array.from(Vo.values())}function Zs(e,t,n){let r=mE[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 "/")`),zr.warn(i.join(" "));return}zo(new ao(`${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 bE="firebase-heartbeat-database",_E=1,qo="firebase-heartbeat-store";let Pa=null;function ph(){return Pa||(Pa=DI(bE,_E,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(qo)}catch(n){console.warn(n)}}}}).catch(e=>{throw fs.create("idb-open",{originalErrorMessage:e.message})})),Pa}async function kE(e){try{const n=(await ph()).transaction(qo),r=await n.objectStore(qo).get(mh(e));return await n.done,r}catch(t){if(t instanceof gs)zr.warn(t.message);else{const n=fs.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});zr.warn(n.message)}}}async function Wu(e,t){try{const r=(await ph()).transaction(qo,"readwrite");await r.objectStore(qo).put(t,mh(e)),await r.done}catch(n){if(n instanceof gs)zr.warn(n.message);else{const r=fs.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});zr.warn(r.message)}}}function mh(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 TE=1024,SE=30;class IE{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new CE(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=Vu();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>SE){const i=AE(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){zr.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=Vu(),{heartbeatsToSend:r,unsentEntries:s}=EE(this._heartbeatsCache.heartbeats),o=sh(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 zr.warn(n),""}}}function Vu(){return new Date().toISOString().substring(0,10)}function EE(e,t=TE){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),zu(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),zu(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class CE{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return dI()?fI().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await kE(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 Wu(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 Wu(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function zu(e){return sh(JSON.stringify({version:2,heartbeats:e})).length}function AE(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 xE(e){zo(new ao("platform-logger",t=>new BI(t),"PRIVATE")),zo(new ao("heartbeat",t=>new IE(t),"PRIVATE")),Zs(dl,Uu,e),Zs(dl,Uu,"esm2020"),Zs("fire-js","")}xE("");var RE="firebase",PE="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
+ */Zs(RE,PE,"app");function gh(){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 ME=gh,vh=new Qo("auth","Firebase",gh());/**
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 Ri=new lh("@firebase/auth");function $E(e,...t){Ri.logLevel<=Lt.WARN&&Ri.warn(`Auth (${Zo}): ${e}`,...t)}function vi(e,...t){Ri.logLevel<=Lt.ERROR&&Ri.error(`Auth (${Zo}): ${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 Sr(e,...t){throw ec(e,...t)}function lr(e,...t){return ec(e,...t)}function Zl(e,t,n){const r={...ME(),[t]:n};return new Qo("auth","Firebase",r).create(t,{appName:e.name})}function Ls(e){return Zl(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function OE(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&Sr(e,"argument-error"),Zl(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function ec(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 vh.create(e,...t)}function Xe(e,t,...n){if(!e)throw ec(t,...n)}function Dr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw vi(t),new Error(t)}function qr(e,t){e||Dr(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 pl(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function NE(){return qu()==="http:"||qu()==="https:"}function qu(){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 LE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(NE()||lI()||"connection"in navigator)?navigator.onLine:!0}function DE(){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 ei{constructor(t,n){this.shortDelay=t,this.longDelay=n,qr(n>t,"Short delay should be less than long delay!"),this.isMobile=iI()||cI()}get(){return LE()?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 tc(e,t){qr(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 yh{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;Dr("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;Dr("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;Dr("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 jE={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 FE=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],BE=new ei(3e4,6e4);function nc(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function uo(e,t,n,r,s={}){return wh(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Xo({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 aI()||(f.referrerPolicy="no-referrer"),e.emulatorConfig&&Ql(e.emulatorConfig.host)&&(f.credentials="include"),yh.fetch()(await bh(e,e.config.apiHost,n,a),f)})}async function wh(e,t,n){e._canInitEmulator=!1;const r={...jE,...t};try{const s=new HE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw ai(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 ai(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw ai(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw ai(e,"user-disabled",i);const u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(f)throw Zl(e,u,f);Sr(e,u)}}catch(s){if(s instanceof gs)throw s;Sr(e,"network-request-failed",{message:String(s)})}}async function UE(e,t,n,r,s={}){const o=await uo(e,t,n,r,s);return"mfaPendingCredential"in o&&Sr(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function bh(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?tc(e.config,s):`${e.config.apiScheme}://${s}`;return FE.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class HE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(lr(this.auth,"network-request-failed")),BE.get())})}}function ai(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=lr(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 WE(e,t){return uo(e,"POST","/v1/accounts:delete",t)}async function Pi(e,t){return uo(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 Mo(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function VE(e,t=!1){const n=co(e),r=await n.getIdToken(t),s=rc(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:Mo(Ma(s.auth_time)),issuedAtTime:Mo(Ma(s.iat)),expirationTime:Mo(Ma(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function Ma(e){return Number(e)*1e3}function rc(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return vi("JWT malformed, contained fewer than 3 sections"),null;try{const s=oh(n);return s?JSON.parse(s):(vi("Failed to decode base64 JWT payload"),null)}catch(s){return vi("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Gu(e){const t=rc(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 Go(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof gs&&zE(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function zE({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 qE{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 ml{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Mo(this.lastLoginAt),this.creationTime=Mo(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 Mi(e){var g;const t=e.auth,n=await e.getIdToken(),r=await Go(e,Pi(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?_h(s.providerUserInfo):[],i=KE(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 ml(s.createdAt,s.lastLoginAt),isAnonymous:f};Object.assign(e,u)}async function GE(e){const t=co(e);await Mi(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function KE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function _h(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 JE(e,t){const n=await wh(e,{},async()=>{const r=Xo({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await bh(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&&Ql(e.emulatorConfig.host)&&(l.credentials="include"),yh.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function YE(e,t){return uo(e,"POST","/v2/accounts:revokeToken",nc(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 eo{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):Gu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){Xe(t.length!==0,"internal-error");const n=Gu(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 JE(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 eo;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 eo,this.toJSON())}_performRefresh(){return Dr("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 rs(e,t){Xe(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class or{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new qE(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 ml(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await Go(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 VE(this,t)}reload(){return GE(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 or({...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 Mi(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(wr(this.auth.app))return Promise.reject(Ls(this.auth));const t=await this.getIdToken();return await Go(this,WE(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:U,stsTokenManager:$}=n;Xe(g&&$,t,"internal-error");const X=eo.fromJSON(this.name,$);Xe(typeof g=="string",t,"internal-error"),rs(r,t.name),rs(s,t.name),Xe(typeof _=="boolean",t,"internal-error"),Xe(typeof E=="boolean",t,"internal-error"),rs(o,t.name),rs(i,t.name),rs(a,t.name),rs(l,t.name),rs(f,t.name),rs(u,t.name);const ce=new or({uid:g,auth:t,email:s,emailVerified:_,displayName:r,isAnonymous:E,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:X,createdAt:f,lastLoginAt:u});return U&&Array.isArray(U)&&(ce.providerData=U.map(K=>({...K}))),l&&(ce._redirectEventId=l),ce}static async _fromIdTokenResponse(t,n,r=!1){const s=new eo;s.updateFromServerResponse(n);const o=new or({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await Mi(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?_h(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new eo;a.updateFromIdToken(r);const l=new or({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 ml(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 Ku=new Map;function jr(e){qr(e instanceof Function,"Expected a class definition");let t=Ku.get(e);return t?(qr(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Ku.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 kh{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){}}kh.type="NONE";const Ju=kh;/**
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 yi(e,t,n){return`firebase:${e}:${t}:${n}`}class to{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=yi(this.userKey,s.apiKey,o),this.fullPersistenceKey=yi("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 Pi(this.auth,{idToken:t}).catch(()=>{});return n?or._fromGetAccountInfoResponse(this.auth,n,t):null}return or._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 to(jr(Ju),t,r);const s=(await Promise.all(n.map(async f=>{if(await f._isAvailable())return f}))).filter(f=>f);let o=s[0]||jr(Ju);const i=yi(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 Pi(t,{idToken:u}).catch(()=>{});if(!_)break;g=await or._fromGetAccountInfoResponse(t,_,u)}else g=or._fromJSON(t,u);f!==o&&(a=g),o=f;break}}catch{}const l=s.filter(f=>f._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new to(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 to(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 Yu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Eh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Th(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Ah(t))return"Blackberry";if(xh(t))return"Webos";if(Sh(t))return"Safari";if((t.includes("chrome/")||Ih(t))&&!t.includes("edge/"))return"Chrome";if(Ch(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 Th(e=Rn()){return/firefox\//i.test(e)}function Sh(e=Rn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Ih(e=Rn()){return/crios\//i.test(e)}function Eh(e=Rn()){return/iemobile/i.test(e)}function Ch(e=Rn()){return/android/i.test(e)}function Ah(e=Rn()){return/blackberry/i.test(e)}function xh(e=Rn()){return/webos/i.test(e)}function sc(e=Rn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function QE(e=Rn()){var t;return sc(e)&&!!((t=window.navigator)!=null&&t.standalone)}function XE(){return uI()&&document.documentMode===10}function Rh(e=Rn()){return sc(e)||Ch(e)||xh(e)||Ah(e)||/windows phone/i.test(e)||Eh(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 Ph(e,t=[]){let n;switch(e){case"Browser":n=Yu(Rn());break;case"Worker":n=`${Yu(Rn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${Zo}/${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 ZE{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 eC(e,t={}){return uo(e,"GET","/v2/passwordPolicy",nc(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 tC=6;class nC{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??tC,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 rC{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 Qu(this),this.idTokenSubscription=new Qu(this),this.beforeStateQueue=new ZE(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=vh,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=jr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await to.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 Pi(this,{idToken:t}),r=await or._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(wr(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 Mi(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=DE()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(wr(this.app))return Promise.reject(Ls(this));const n=t?co(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 wr(this.app)?Promise.reject(Ls(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return wr(this.app)?Promise.reject(Ls(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(jr(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 eC(this),n=new nC(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 Qo("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 YE(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&&jr(t)||this._popupRedirectResolver;Xe(n,this,"argument-error"),this.redirectPersistenceManager=await to.create(this,[jr(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=Ph(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(wr(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&&$E(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Xi(e){return co(e)}class Qu{constructor(t){this.auth=t,this.observer=null,this.addObserver=vI(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 oc={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function sC(e){oc=e}function oC(e){return oc.loadJS(e)}function iC(){return oc.gapiScript}function aC(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 lC(e,t){const n=dh(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(io(o,t??{}))return s;Sr(s,"already-initialized")}return n.initialize({options:t})}function cC(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(jr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function uC(e,t,n){const r=Xi(e);Xe(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=Mh(t),{host:i,port:a}=dC(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(io(f,r.config.emulator)&&io(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=f,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,Ql(i)?bI(`${o}//${i}${l}`):fC()}function Mh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function dC(e){const t=Mh(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:Xu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:Xu(i)}}}function Xu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function fC(){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 $h{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return Dr("not implemented")}_getIdTokenResponse(t){return Dr("not implemented")}_linkToIdToken(t,n){return Dr("not implemented")}_getReauthenticationResolver(t){return Dr("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 no(e,t){return UE(e,"POST","/v1/accounts:signInWithIdp",nc(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 hC="http://localhost";class Ds extends $h{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new Ds(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):Sr("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 Ds(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 no(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,no(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,no(t,n)}buildRequest(){const t={requestUri:hC,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=Xo(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 ic{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 ti extends ic{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 as extends ti{constructor(){super("facebook.com")}static credential(t){return Ds._fromParams({providerId:as.PROVIDER_ID,signInMethod:as.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return as.credentialFromTaggedObject(t)}static credentialFromError(t){return as.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return as.credential(t.oauthAccessToken)}catch{return null}}}as.FACEBOOK_SIGN_IN_METHOD="facebook.com";as.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 ls extends ti{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return Ds._fromParams({providerId:ls.PROVIDER_ID,signInMethod:ls.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken: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{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return ls.credential(n,r)}catch{return null}}}ls.GOOGLE_SIGN_IN_METHOD="google.com";ls.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 br extends ti{constructor(){super("github.com")}static credential(t){return Ds._fromParams({providerId:br.PROVIDER_ID,signInMethod:br.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return br.credentialFromTaggedObject(t)}static credentialFromError(t){return br.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return br.credential(t.oauthAccessToken)}catch{return null}}}br.GITHUB_SIGN_IN_METHOD="github.com";br.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 cs extends ti{constructor(){super("twitter.com")}static credential(t,n){return Ds._fromParams({providerId:cs.PROVIDER_ID,signInMethod:cs.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return cs.credentialFromTaggedObject(t)}static credentialFromError(t){return cs.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return cs.credential(n,r)}catch{return null}}}cs.TWITTER_SIGN_IN_METHOD="twitter.com";cs.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 lo{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 or._fromIdTokenResponse(t,r,s),i=Zu(r);return new lo({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=Zu(r);return new lo({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function Zu(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 $i extends gs{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,$i.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 $i(t,n,r,s)}}function Oh(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?$i._fromErrorAndOperation(e,o,t,r):o})}async function pC(e,t,n=!1){const r=await Go(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return lo._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 mC(e,t,n=!1){const{auth:r}=e;if(wr(r.app))return Promise.reject(Ls(r));const s="reauthenticate";try{const o=await Go(e,Oh(r,s,t,e),n);Xe(o.idToken,r,"internal-error");const i=rc(o.idToken);Xe(i,r,"internal-error");const{sub:a}=i;return Xe(e.uid===a,r,"user-mismatch"),lo._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&Sr(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 gC(e,t,n=!1){if(wr(e.app))return Promise.reject(Ls(e));const r="signIn",s=await Oh(e,r,t),o=await lo._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function vC(e,t,n,r){return co(e).onIdTokenChanged(t,n,r)}function yC(e,t,n){return co(e).beforeAuthStateChanged(t,n)}const Oi="__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 Nh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Oi,"1"),this.storage.removeItem(Oi),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 wC=1e3,bC=10;class Lh extends Nh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Rh(),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);XE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,bC):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)})},wC)}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]}}Lh.type="LOCAL";const _C=Lh;/**
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 Dh extends Nh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Dh.type="SESSION";const jh=Dh;/**
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 kC(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 Zi{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 Zi(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 kC(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)}}Zi.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 ac(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 TC{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=ac("",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 Tr(){return window}function SC(e){Tr().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 Fh(){return typeof Tr().WorkerGlobalScope<"u"&&typeof Tr().importScripts=="function"}async function IC(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function EC(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function CC(){return Fh()?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 Bh="firebaseLocalStorageDb",AC=1,Ni="firebaseLocalStorage",Uh="fbase_key";class ni{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 ea(e,t){return e.transaction([Ni],t?"readwrite":"readonly").objectStore(Ni)}function xC(){const e=indexedDB.deleteDatabase(Bh);return new ni(e).toPromise()}function gl(){const e=indexedDB.open(Bh,AC);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(Ni,{keyPath:Uh})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(Ni)?t(r):(r.close(),await xC(),t(await gl()))})})}async function ed(e,t,n){const r=ea(e,!0).put({[Uh]:t,value:n});return new ni(r).toPromise()}async function RC(e,t){const n=ea(e,!1).get(t),r=await new ni(n).toPromise();return r===void 0?null:r.value}function td(e,t){const n=ea(e,!0).delete(t);return new ni(n).toPromise()}const PC=800,MC=3;class Hh{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 gl(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>MC)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Fh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Zi._getInstance(CC()),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 IC(),!this.activeServiceWorker)return;this.sender=new TC(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||EC()!==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 gl();return await ed(t,Oi,"1"),await td(t,Oi),!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=>ed(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>RC(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>td(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=ea(s,!1).getAll();return new ni(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(),PC)}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()}}Hh.type="LOCAL";const $C=Hh;new ei(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 Wh(e,t){return t?jr(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 lc extends $h{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return no(t,this._buildIdpRequest())}_linkToIdToken(t,n){return no(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return no(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 OC(e){return gC(e.auth,new lc(e),e.bypassAuthState)}function NC(e){const{auth:t,user:n}=e;return Xe(n,t,"internal-error"),mC(n,new lc(e),e.bypassAuthState)}async function LC(e){const{auth:t,user:n}=e;return Xe(n,t,"internal-error"),pC(n,new lc(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 Vh{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 OC;case"linkViaPopup":case"linkViaRedirect":return LC;case"reauthViaPopup":case"reauthViaRedirect":return NC;default:Sr(this.auth,"internal-error")}}resolve(t){qr(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){qr(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 DC=new ei(2e3,1e4);async function jC(e,t,n){if(wr(e.app))return Promise.reject(lr(e,"operation-not-supported-in-this-environment"));const r=Xi(e);OE(e,t,ic);const s=Wh(r,n);return new $s(r,"signInViaPopup",t,s).executeNotNull()}class $s extends Vh{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,$s.currentPopupAction&&$s.currentPopupAction.cancel(),$s.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Xe(t,this.auth,"internal-error"),t}async onExecution(){qr(this.filter.length===1,"Popup operations only handle one event");const t=ac();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(lr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(lr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,$s.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(lr(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,DC.get())};t()}}$s.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 FC="pendingRedirect",wi=new Map;class BC extends Vh{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=wi.get(this.auth._key());if(!t){try{const r=await UC(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}wi.set(this.auth._key(),t)}return this.bypassAuthState||wi.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 UC(e,t){const n=VC(t),r=WC(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function HC(e,t){wi.set(e._key(),t)}function WC(e){return jr(e._redirectPersistence)}function VC(e){return yi(FC,e.config.apiKey,e.name)}async function zC(e,t,n=!1){if(wr(e.app))return Promise.reject(Ls(e));const r=Xi(e),s=Wh(r,t),i=await new BC(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 qC=600*1e3;class GC{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||!KC(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!zh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(lr(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>=qC&&this.cachedEventUids.clear(),this.cachedEventUids.has(nd(t))}saveEventToCache(t){this.cachedEventUids.add(nd(t)),this.lastProcessedEventTime=Date.now()}}function nd(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function zh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function KC(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return zh(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 JC(e,t={}){return uo(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 YC=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,QC=/^https?/;async function XC(e){if(e.config.emulator)return;const{authorizedDomains:t}=await JC(e);for(const n of t)try{if(ZC(n))return}catch{}Sr(e,"unauthorized-domain")}function ZC(e){const t=pl(),{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(!QC.test(n))return!1;if(YC.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 e1=new ei(3e4,6e4);function rd(){const e=Tr().___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 t1(e){return new Promise((t,n)=>{var s,o,i;function r(){rd(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{rd(),n(lr(e,"network-request-failed"))},timeout:e1.get()})}if((o=(s=Tr().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=Tr().gapi)!=null&&i.load)r();else{const a=aC("iframefcb");return Tr()[a]=()=>{gapi.load?r():n(lr(e,"network-request-failed"))},oC(`${iC()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw bi=null,t})}let bi=null;function n1(e){return bi=bi||t1(e),bi}/**
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 r1=new ei(5e3,15e3),s1="__/auth/iframe",o1="emulator/auth/iframe",i1={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},a1=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function l1(e){const t=e.config;Xe(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?tc(t,o1):`https://${e.config.authDomain}/${s1}`,r={apiKey:t.apiKey,appName:e.name,v:Zo},s=a1.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Xo(r).slice(1)}`}async function c1(e){const t=await n1(e),n=Tr().gapi;return Xe(n,e,"internal-error"),t.open({where:document.body,url:l1(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:i1,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=lr(e,"network-request-failed"),a=Tr().setTimeout(()=>{o(i)},r1.get());function l(){Tr().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 u1={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},d1=500,f1=600,h1="_blank",p1="http://localhost";class sd{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function m1(e,t,n,r=d1,s=f1){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={...u1,width:r.toString(),height:s.toString(),top:o,left:i},f=Rn().toLowerCase();n&&(a=Ih(f)?h1:n),Th(f)&&(t=t||p1,l.scrollbars="yes");const u=Object.entries(l).reduce((_,[E,U])=>`${_}${E}=${U},`,"");if(QE(f)&&a!=="_self")return g1(t||"",a),new sd(null);const g=window.open(t||"",a,u);Xe(g,e,"popup-blocked");try{g.focus()}catch{}return new sd(g)}function g1(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 v1="__/auth/handler",y1="emulator/auth/handler",w1=encodeURIComponent("fac");async function od(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:Zo,eventId:s};if(t instanceof ic){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",gI(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[u,g]of Object.entries({}))i[u]=g}if(t instanceof ti){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?`#${w1}=${encodeURIComponent(l)}`:"";return`${b1(e)}?${Xo(a).slice(1)}${f}`}function b1({config:e}){return e.emulator?tc(e,y1):`https://${e.authDomain}/${v1}`}/**
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 $a="webStorageSupport";class _1{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=jh,this._completeRedirectFn=zC,this._overrideRedirectResult=HC}async _openPopup(t,n,r,s){var i;qr((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await od(t,n,r,pl(),s);return m1(t,o,ac())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await od(t,n,r,pl(),s);return SC(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):(qr(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 c1(t),r=new GC(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($a,{type:$a},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[$a];o!==void 0&&n(!!o),Sr(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=XC(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return Rh()||Sh()||sc()}}const k1=_1;var id="@firebase/auth",ad="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 T1{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 S1(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 I1(e){zo(new ao("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:Ph(e)},f=new rC(r,s,o,l);return cC(f,n),f},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),zo(new ao("auth-internal",t=>{const n=Xi(t.getProvider("auth").getImmediate());return(r=>new T1(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Zs(id,ad,S1(e)),Zs(id,ad,"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 E1=300,C1=ah("authIdTokenMaxAge")||E1;let ld=null;const A1=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>C1)return;const s=n==null?void 0:n.token;ld!==s&&(ld=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function x1(e=hh()){const t=dh(e,"auth");if(t.isInitialized())return t.getImmediate();const n=lC(e,{popupRedirectResolver:k1,persistence:[$C,_C,jh]}),r=ah("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=A1(o.toString());yC(n,i,()=>i(n.currentUser)),vC(n,a=>i(a))}}const s=sI("auth");return s&&uC(n,`http://${s}`),n}function R1(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}sC({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=lr("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",R1().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="});I1("Browser");const P1={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 M1(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=de(()=>s.value==="pull"),a=de(()=>s.value==="push"),l=de(()=>s.value!=="");async function f(){try{const $=await fetch("/codex-api/skills-sync/status");if(!$.ok)return;const X=await $.json();X.data&&(o.value=X.data)}catch{}}async function u(){try{const $=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),X=await $.json();if(!$.ok||!X.data)throw new Error("Failed to start GitHub login");t.value=X.data;const ce=30,K=Math.max((X.data.interval??5)*1e3,3e3);let ee=!1;for(let re=0;re<ce;re++){await new Promise(me=>setTimeout(me,K));const we=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:X.data.device_code})}),Te=await we.json();if(!we.ok)throw new Error(Te.error||"Failed to complete GitHub login");if(Te.ok){ee=!0;break}if(!Te.pending)throw new Error(Te.error||"Failed to complete GitHub login")}if(!ee)throw new Error("GitHub login timed out. Please retry.");t.value=null,await f(),e.showToast("GitHub login successful")}catch($){e.showToast($ instanceof Error?$.message:"Failed GitHub login","error")}}async function g(){try{const $=wE().length>0?hh():fh(P1),X=x1($),ce=new br;ce.addScope("repo");const K=await jC(X,ce),ee=br.credentialFromResult(K),re=(ee==null?void 0:ee.accessToken)??"";if(!re)throw new Error("GitHub access token missing from Firebase login");const we=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:re})}),Te=await we.json();if(!we.ok||!Te.ok)throw new Error(Te.error||"Failed to login with GitHub token");await f(),e.showToast("GitHub login successful")}catch($){const X=$ instanceof Error?$.message:"Failed Firebase GitHub login";e.showToast(X,"error")}}async function _(){r.value="",n.value="pull-started",s.value="pull";try{const $=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),X=await $.json();if(!$.ok||!X.ok)throw new Error(X.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($){const X=$ instanceof Error?$.message:"Failed to pull sync";r.value=X,n.value="pull-failed",e.showToast(X,"error")}finally{s.value=""}}async function E(){r.value="",n.value="push-started",s.value="push";try{const $=await fetch("/codex-api/skills-sync/push",{method:"POST"}),X=await $.json();if(!$.ok||!X.ok)throw new Error(X.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch($){const X=$ instanceof Error?$.message:"Failed to push sync";r.value=X,n.value="push-failed",e.showToast(X,"error")}finally{s.value=""}}async function U(){try{const $=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),X=await $.json();if(!$.ok||!X.ok)throw new Error(X.error||"Failed to logout GitHub");await f(),e.showToast("Logged out from GitHub")}catch($){e.showToast($ instanceof Error?$.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isSyncActionInFlight:l,loadSyncStatus:f,logoutGithub:U,pullSkillsSync:_,pushSkillsSync:E,startGithubFirebaseLogin:g,startGithubLogin:u,syncActionError:r,syncActionStatus:n,syncStatus:o}}const $1={class:"skills-hub"},O1={class:"skills-sync-panel"},N1={class:"skills-sync-header"},L1={key:0,class:"skills-sync-badge"},D1={key:1,class:"skills-sync-badge"},j1={key:2,class:"skills-sync-badge"},F1={class:"skills-sync-meta"},B1={key:0,class:"skills-sync-error"},U1={key:1,class:"skills-sync-meta"},H1={key:2,class:"skills-sync-error"},W1={key:3,class:"skills-sync-device"},V1=["href"],z1={class:"skills-sync-actions"},q1=["disabled"],G1=["disabled"],K1=["disabled"],J1={key:1,class:"skills-hub-section"},Y1={class:"skills-hub-section-title"},Q1={key:0,class:"skills-hub-grid"},X1={class:"skills-hub-toolbar"},Z1={class:"skills-hub-search-wrap"},eA={key:0,class:"skills-hub-count"},tA={class:"skills-hub-section"},nA={key:0,class:"skills-hub-loading"},rA={key:1,class:"skills-hub-error"},sA={key:0,class:"skills-hub-grid"},oA={key:1,class:"skills-hub-empty"},li="codex-web-local.skills-hub.cache.v1",iA=on({__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),U=j(null),$=j(""),X=j(!1),ce=j(!1);let K=null,ee=null;const re=t,we=de(()=>o.value==="date"?"Newest":"A-Z"),Te=de(()=>{var M;return((M=U.value)==null?void 0:M.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),me=de(()=>`${E.value.owner}/${E.value.name}`),Me=de(()=>X.value&&$.value===me.value),ae=de(()=>ce.value&&$.value===me.value),se=de(()=>{const M=s.value.toLowerCase().trim();return M?a.value.filter(z=>z.name.toLowerCase().includes(M)||z.owner.toLowerCase().includes(M)||(z.displayName??"").toLowerCase().includes(M)):a.value});function ue(M,z="success"){U.value={text:M,type:z},ee&&clearTimeout(ee),ee=setTimeout(()=>{U.value=null},3e3)}function te(){o.value=o.value==="date"?"name":"date",Pe(s.value)}function Re(M){return`${o.value}::${M.trim().toLowerCase()}`}function Je(M){var z;if(typeof window>"u")return null;try{const q=window.localStorage.getItem(li);return q?((z=JSON.parse(q).byKey)==null?void 0:z[M])??null:null}catch{return null}}function ze(M,z){if(!(typeof window>"u"))try{const q=window.localStorage.getItem(li),G=(q?JSON.parse(q):{}).byKey??{};G[M]=z,window.localStorage.setItem(li,JSON.stringify({byKey:G}))}catch{}}function We(){if(!(typeof window>"u"))try{window.localStorage.removeItem(li)}catch{}}function He(M){const z=M.installed??[];a.value=z;const q=new Set(z.map(Q=>Q.name));i.value=M.data.map(Q=>{if(Q.installed||q.has(Q.name)){const G=z.find(Ie=>Ie.name===Q.name);return{...Q,installed:!0,path:(G==null?void 0:G.path)??Q.path,enabled:(G==null?void 0:G.enabled)??Q.enabled}}return Q}).filter(Q=>!Q.installed),l.value=M.total}async function Pe(M){const z=Re(M),q=Je(z);q&&He(q),f.value=!q,u.value="";try{const Q=new URLSearchParams;M.trim()&&Q.set("q",M.trim()),Q.set("limit","100"),Q.set("sort",o.value);const G=await fetch(`/codex-api/skills-hub?${Q}`);if(!G.ok)throw new Error(`HTTP ${G.status}`);const Ie=await G.json();He(Ie),ze(z,Ie)}catch(Q){u.value=Q instanceof Error?Q.message:"Failed to load skills"}finally{f.value=!1}}function nt(){K&&clearTimeout(K),K=setTimeout(()=>Pe(s.value),300)}function et(M){E.value=M,_.value=!0}async function ke(M){$.value=`${M.owner}/${M.name}`,X.value=!0;try{const q=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:M.owner,name:M.name})})).json();if(!q.ok)throw new Error(q.error||"Install failed");const Q={...M,installed:!0,path:q.path,enabled:!0};a.value=[...a.value,Q],i.value=i.value.filter(G=>G.name!==M.name),E.value=Q,ue(`${M.displayName||M.name} skill installed`),_.value=!1,We(),re("skills-changed")}catch(z){ue(z instanceof Error?z.message:"Failed to install skill","error")}finally{X.value=!1}}async function at(M){$.value=`${M.owner}/${M.name}`,ce.value=!0;try{const q=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:M.name,path:M.path})})).json();if(!q.ok)throw new Error(q.error||"Uninstall failed");a.value=a.value.filter(Q=>Q.name!==M.name),M.owner!=="local"&&(i.value=[...i.value,{...M,installed:!1,path:void 0,enabled:void 0}]),ue(`${M.displayName||M.name} skill uninstalled`),_.value=!1,We(),re("skills-changed")}catch(z){ue(z instanceof Error?z.message:"Failed to uninstall skill","error")}finally{ce.value=!1}}async function Ot(M,z){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:M.path,enabled:z}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),ue(`${M.displayName||M.name} skill ${z?"enabled":"disabled"}`),await Pe(s.value)}catch(q){ue(q instanceof Error?q.message:"Failed to update skill","error")}}const{deviceLogin:gt,isPullInFlight:mt,isPushInFlight:qe,isSyncActionInFlight:W,loadSyncStatus:be,logoutGithub:he,pullSkillsSync:Ee,pushSkillsSync:Ae,startGithubFirebaseLogin:T,startGithubLogin:S,syncActionError:O,syncActionStatus:Z,syncStatus:J}=M1({showToast:ue,onPulled:async()=>{await Pe(s.value),re("skills-changed")}});return Kr(()=>{Pe(""),be()}),(M,z)=>(w(),k("div",$1,[z[11]||(z[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",O1,[v("div",N1,[z[8]||(z[8]=v("strong",null,"Skills Sync (GitHub)",-1)),_e(J).configured?(w(),k("span",L1,"Connected: "+Y(_e(J).repoOwner)+"/"+Y(_e(J).repoName),1)):_e(J).loggedIn?(w(),k("span",D1,"Logged in as "+Y(_e(J).githubUsername),1)):(w(),k("span",j1,"Not connected"))]),v("div",F1,[v("span",null,"Startup: "+Y(_e(J).startup.mode),1),v("span",null,"Branch: "+Y(_e(J).startup.branch),1),v("span",null,"Action: "+Y(_e(J).startup.lastAction),1)]),_e(J).startup.lastError?(w(),k("div",B1,Y(_e(J).startup.lastError),1)):fe("",!0),_e(Z)?(w(),k("div",U1,[v("span",null,"Manual sync: "+Y(_e(Z)),1)])):fe("",!0),_e(O)?(w(),k("div",H1,Y(_e(O)),1)):fe("",!0),_e(gt)?(w(),k("div",W1,[v("span",null,[z[9]||(z[9]=Bo("Open ",-1)),v("a",{href:_e(gt).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,V1),z[10]||(z[10]=Bo(" and enter code:",-1))]),v("code",null,Y(_e(gt).user_code),1)])):fe("",!0),v("div",z1,[_e(J).loggedIn?fe("",!0):(w(),k("button",{key:0,class:"skills-hub-sort",type:"button",onClick:z[0]||(z[0]=(...q)=>_e(T)&&_e(T)(...q))},"Login with GitHub")),_e(J).loggedIn?fe("",!0):(w(),k("button",{key:1,class:"skills-hub-sort",type:"button",onClick:z[1]||(z[1]=(...q)=>_e(S)&&_e(S)(...q))},"Device Login")),_e(J).loggedIn?(w(),k("button",{key:2,class:"skills-hub-sort",type:"button",onClick:z[2]||(z[2]=(...q)=>_e(he)&&_e(he)(...q)),disabled:_e(W)},"Logout GitHub",8,q1)):fe("",!0),v("button",{class:"skills-hub-sort",type:"button",onClick:z[3]||(z[3]=(...q)=>_e(Ee)&&_e(Ee)(...q)),disabled:_e(W)},Y(_e(mt)?"Pulling...":"Pull"),9,G1),_e(J).loggedIn?(w(),k("button",{key:3,class:"skills-hub-sort",type:"button",onClick:z[4]||(z[4]=(...q)=>_e(Ae)&&_e(Ae)(...q)),disabled:!_e(J).configured||_e(W)},Y(_e(qe)?"Pushing...":"Push"),9,K1)):fe("",!0)])]),U.value?(w(),k("div",{key:0,class:rt(["skills-hub-toast",Te.value])},Y(U.value.text),3)):fe("",!0),se.value.length>0?(w(),k("div",J1,[v("button",{class:"skills-hub-section-toggle",type:"button",onClick:z[5]||(z[5]=q=>g.value=!g.value)},[v("span",Y1,"Installed ("+Y(se.value.length)+")",1),je(Gf,{class:rt(["skills-hub-section-chevron",{"is-open":g.value}])},null,8,["class"])]),g.value?(w(),k("div",Q1,[(w(!0),k(De,null,yt(se.value,q=>(w(),_t(Nu,{key:q.name,skill:q,onSelect:Q=>et(Q)},null,8,["skill","onSelect"]))),128))])):fe("",!0)])):fe("",!0),v("div",X1,[v("div",Z1,[je(ll,{class:"skills-hub-search-icon"}),Wr(v("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":z[6]||(z[6]=q=>s.value=q),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:nt},null,544),[[Vr,s.value]]),l.value>0?(w(),k("span",eA,Y(l.value)+" skills",1)):fe("",!0)]),v("button",{class:"skills-hub-sort",type:"button",onClick:te},Y(we.value),1)]),v("div",tA,[f.value?(w(),k("div",nA,"Loading skills...")):u.value?(w(),k("div",rA,Y(u.value),1)):(w(),k(De,{key:2},[i.value.length>0?(w(),k("div",sA,[(w(!0),k(De,null,yt(i.value,q=>(w(),_t(Nu,{key:q.url,skill:q,onSelect:Q=>et(Q)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(w(),k("div",oA,'No skills found for "'+Y(s.value)+'"',1)):fe("",!0)],64))]),je(JS,{skill:E.value,visible:_.value,"is-installing":Me.value,"is-uninstalling":ae.value,onClose:z[7]||(z[7]=q=>_.value=!1),onInstall:ke,onUninstall:at,onToggleEnabled:Ot},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),aA=wt(iA,[["__scopeId","data-v-2f6920be"]]),lA={},cA={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 uA(e,t){return w(),k("svg",cA,[...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 dA=wt(lA,[["render",uA]]),fA={},hA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function pA(e,t){return w(),k("svg",hA,[...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 mA=wt(fA,[["render",pA]]),gA={class:"sidebar-thread-controls"},vA=["aria-label","title"],yA=on({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(w(),k("div",gA,[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?(w(),_t(mA,{key:0,class:"sidebar-thread-controls-icon"})):(w(),_t(dA,{key:1,class:"sidebar-thread-controls-icon"}))],8,vA),_r(t.$slots,"default",{},void 0),e.showNewThreadButton?(w(),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"))},[je(xi,{class:"sidebar-thread-controls-icon"})])):fe("",!0)]))}}),cd=wt(yA,[["__scopeId","data-v-46a10052"]]),wA={},bA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function _A(e,t){return w(),k("svg",bA,[...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 kA=wt(wA,[["render",_A]]);function $r(e){return e.flatMap(t=>t.threads)}const qh="codex-web-local.thread-read-state.v1",Gh="codex-web-local.thread-scroll-state.v1",vl="codex-web-local.selected-thread-id.v1",Kh="codex-web-local.project-order.v1",Jh="codex-web-local.project-display-name.v1",yl="codex-web-local.collaboration-mode-by-context.v1",Yh="codex-web-local.collaboration-mode.v1",Qh="__new-thread__",Oa=220,ud=["none","minimal","low","medium","high","xhigh"],Hs="__global__",Qn="gpt-5.2-codex";function TA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(qh);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function dd(e){typeof window>"u"||window.localStorage.setItem(qh,JSON.stringify(e))}function wl(e){return e==="plan"?"plan":"default"}function Xh(e){return e.trim()||Qh}function SA(){if(typeof window>"u")return{};try{const t=window.localStorage.getItem(yl);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=wl(o);i==="plan"&&(r[s]=i)}return r}}catch{}return wl(window.localStorage.getItem(Yh))==="plan"?{[Qh]:"plan"}:{}}function Na(e,t){const n=Xh(t);return wl(e[n])}function IA(e){typeof window>"u"||(Object.keys(e).length===0?window.localStorage.removeItem(yl):window.localStorage.setItem(yl,JSON.stringify(e)),window.localStorage.removeItem(Yh))}function Zh(e,t,n){return Math.min(Math.max(e,t),n)}function EA(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=Zh(t.scrollRatio,0,1)),n}function CA(){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)){if(!r)continue;const o=EA(s);o&&(n[r]=o)}return n}catch{return{}}}function fd(e){typeof window>"u"||window.localStorage.setItem(Gh,JSON.stringify(e))}function AA(){return typeof window>"u"?"":window.localStorage.getItem(vl)??""}function xA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(vl);return}window.localStorage.setItem(vl,e)}}function RA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Kh);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t)typeof r=="string"&&r.length>0&&!n.includes(r)&&n.push(r);return n}catch{return[]}}function Ws(e){typeof window>"u"||window.localStorage.setItem(Kh,JSON.stringify(e))}function PA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Jh);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 La(e){typeof window>"u"||window.localStorage.setItem(Jh,JSON.stringify(e))}function ci(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 Ps(e,n)?e:n}function Da(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 Ps(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 MA(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 $A(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function OA(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 NA(e,t){return!e&&!t?!0:!e||!t?!1:e.explanation===t.explanation&&e.isStreaming===t.isStreaming&&OA(e.steps,t.steps)}function ui(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 bl(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&Ps(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&$A(e.commandExecution,t.commandExecution)&&NA(e.plan,t.plan)&&e.turnIndex===t.turnIndex}function $o(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 LA(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&&bl(g,u)?g:u});if(n.preserveMissing!==!0)return $o(e,o)?e:o;const i=e.map(u=>{const g=s.get(u.id);return!g||bl(u,g)?u:g}),a=new Set(e.map(u=>u.id)),l=o.filter(u=>!a.has(u.id)),f=[...i,...l];return $o(e,f)?e:f}function _l(e){return e.replace(/\s+/gu," ").trim()}function DA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>_l(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=_l(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function ja(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(bl(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const ep="worked";function ss(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function jA(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 FA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function BA(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 UA(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${jA(e.durationMs)}`,messageType:ep}}function HA(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function WA(e,t){const n=UA(t),r=e.filter(i=>i.messageType!==ep),s=HA(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Xt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function VA(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 zA(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 qA(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 GA(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 di(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&&zA(f,l)?f:l});return o&&o.projectName===s.projectName&&qA(o.threads,a)?o:{projectName:s.projectName,threads:a}});return GA(e,r)?e:r}function KA(e,t,n){const r=new Set($r(t).map(a=>a.id)),s=$r(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 JA(e){return e.split("/").filter(Boolean).at(-1)||e||"unknown-project"}function Vs(e){const t=e.replace(/\\/gu,"/");return t.split("/").filter(Boolean).at(-1)||t}function YA(e){const t=e.split(`
1447
+ `).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function QA(e){const t=e.trim()||"Untitled thread";return/^fork:\s+/iu.test(t)?t:`Fork: ${t}`}function XA(){const e=j([]),t=j([]),n=j(AA()),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(SA()),U=j(Na(E.value,n.value)),$=j(""),X=j("medium"),ce=j(TA()),K=j(CA()),ee=j(RA()),re=j(PA()),we=j({}),Te=j({}),me=j({}),Me=j({}),ae=j({}),se=j({}),ue=j({}),te=j({}),Re=j({}),Je=j(null),ze=j({}),We=j([]),He=j(!1),Pe=j(!1),nt=j(!1),et=j(!1),ke=j(""),at=j(!1),Ot=j(!1);let gt=null,mt=null,qe=!1;const W=new Set;let be=!1,he=!1;const Ee=new Map,Ae=new Set,T=de(()=>$r(e.value)),S=de(()=>T.value.find(c=>c.id===n.value)??null),O=de(()=>K.value[n.value]??null),Z=de(()=>{const c=[],p=n.value;return p&&Array.isArray(te.value[p])&&c.push(...te.value[p]),Array.isArray(te.value[Hs])&&c.push(...te.value[Hs]),c.sort((y,C)=>y.receivedAtIso.localeCompare(C.receivedAtIso))}),J=de(()=>{var B;const c=n.value;if(!c)return null;const p=ae.value[c],y=(i.value[c]??"").trim(),C=(((B=se.value[c])==null?void 0:B.message)??"").trim();return!p&&!y&&!C?null:{activityLabel:(p==null?void 0:p.label)||"Thinking",activityDetails:(p==null?void 0:p.details)??[],reasoningText:y,errorText:C}}),M=de(()=>Je.value),z=de(()=>{const c=n.value;if(!c)return[];const p=r.value[c]??[],y=s.value[c]??[],C=o.value[c]??[],B=a.value[c]??[],H=[...p,...y,...B,...C],le=Me.value[c];return le?WA(H,le):H});function q(c){n.value!==c&&(n.value=c,xA(c),U.value=Na(E.value,c),he=!1)}function Q(c){$.value=c.trim()}function G(c){const p=c==="plan"?"plan":"default",y=Xh(n.value);Na(E.value,n.value)===p&&U.value===p||(U.value=p,E.value=p==="plan"?{...E.value,[y]:p}:Xt(E.value,y),IA(E.value))}function Ie(c){Je.value=c}async function ye(){$.value=Qn,g.value.includes(Qn)||(g.value=[...g.value,Qn]);try{await h0(Qn)}catch{}}function Ce(c,p){Re.value={...Re.value,[c]:p}}function xe(c){Re.value[c]&&(Re.value=Xt(Re.value,c))}async function Be(c){if(Ae.has(c))return;const p=Re.value[c];if(!(!p||p.fallbackRetried)){Ae.add(c),Ce(c,{...p,fallbackRetried:!0});try{await ye();try{const y=await Cu(c,1);Bt(c,y),sn(c),Ut(c,[]),dn(c),a.value[c]&&(a.value=Xt(a.value,c))}catch{}St(c,null),ke.value="",dt(c,null),Tt(c,{label:"Thinking",details:kt(Qn,p.effort,p.collaborationMode)}),bt(c,!0),me.value[c]!==!0&&await Sa(c),await Ia(c,p.text,p.imageUrls,Qn,p.effort||void 0,p.skills.length>0?p.skills:void 0,p.fileAttachments,p.collaborationMode),me.value={...me.value,[c]:!0},W.add(c),qe=!0,await m()}catch(y){const C=y instanceof Error?y.message:"Unknown application error";St(c,C),ke.value=C,bt(c,!1),Tt(c,null)}finally{Ae.delete(c)}}}function lt(c){c&&!ud.includes(c)||(X.value=c)}async function Ze(){try{const c=await m0();_.value=c,c.some(p=>p.value===U.value)||G("default")}catch{}}function kt(c,p,y=U.value){const C=c.trim()||"default",B=p||"default";return[`Mode: ${y==="plan"?"Plan":"Default"}`,`Model: ${C}`,`Thinking: ${B}`]}async function vt(){try{const[c,p]=await Promise.all([eh(),th()]);g.value=c,$.value.length>0&&c.includes($.value)||(p.model&&c.includes(p.model)?$.value=p.model:c.length>0?$.value=c[0]:$.value=""),p.reasoningEffort&&ud.includes(p.reasoningEffort)&&(X.value=p.reasoningEffort)}catch{}}function Mt(c){const p=ze.value;return Object.keys(p).length===0?c:c.map(y=>({projectName:y.projectName,threads:y.threads.map(C=>{const B=p[C.id];return B?{...C,title:B}:C})}))}function Ye(){const p=Mt(t.value).map(y=>({projectName:y.projectName,threads:y.threads.map(C=>{const B=l.value[C.id]===!0,H=n.value===C.id,le=ce.value[C.id],ve=u.value[C.id]===!0,pe=!H&&!B&&(ve||le!==C.updatedAtIso);return{...C,inProgress:B,unread:pe}})}));e.value=di(e.value,p)}function jt(c,p,y){const C=new Date().toISOString(),B=p.trim(),H=JA(B),le={id:c,title:YA(y),projectName:H,cwd:B,hasWorktree:B.includes("/.codex/worktrees/")||B.includes("/.git/worktrees/"),createdAtIso:C,updatedAtIso:C,preview:y,unread:!1,inProgress:!1},ve=t.value.findIndex(tt=>tt.projectName===H);if(ve>=0){const $t=t.value[ve].threads.filter(Ar=>Ar.id!==c),zt={projectName:H,threads:[le,...$t]},Sn=[...t.value];Sn.splice(ve,1,zt),t.value=Sn}else t.value=[{projectName:H,threads:[le]},...t.value];const pe=ci(ee.value,t.value);Ps(ee.value,pe)||(ee.value=pe,Ws(ee.value)),Ye()}function Ht(c){const p=new Set(c.map(H=>H.id)),y=pn(ce.value,p);y!==ce.value&&(ce.value=y,dd(y));const C=pn(K.value,p);C!==K.value&&(K.value=C,fd(C)),Te.value=pn(Te.value,p),we.value=pn(we.value,p),me.value=pn(me.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),Me.value=pn(Me.value,p),ae.value=pn(ae.value,p),se.value=pn(se.value,p),ue.value=pn(ue.value,p),u.value=pn(u.value,p),l.value=pn(l.value,p);const B={};for(const[H,le]of Object.entries(te.value))(H===Hs||p.has(H))&&(B[H]=le);te.value=B}function ut(c){const p=$r(t.value).find(y=>y.id===c);p&&(ce.value={...ce.value,[c]:p.updatedAtIso},dd(ce.value),u.value[c]&&(u.value=Xt(u.value,c)),Ye())}function dt(c,p){if(!c)return;const y=Me.value[c];if(p){if(FA(y,p))return;Me.value={...Me.value,[c]:p}}else y&&(Me.value=Xt(Me.value,c))}function bt(c,p){!c||l.value[c]===!0===p||(p?l.value={...l.value,[c]:!0}:l.value=Xt(l.value,c),Ye())}function rn(c){c&&c!==n.value&&u.value[c]!==!0&&(u.value={...u.value,[c]:!0},Ye())}function Tt(c,p){if(!c)return;const y=ae.value[c];if(!p){y&&(ae.value=Xt(ae.value,c));return}const C=F(p.label)||"Thinking",B=p.details.map(ve=>F(ve)).filter(ve=>ve.length>0&&ve!==C),H=Array.from(new Set([...(y==null?void 0:y.details)??[],...B])).slice(-3),le={label:C,details:H};BA(y,le)||(ae.value={...ae.value,[c]:le})}function St(c,p,y={}){if(!c)return;const C=se.value[c],B=p?_l(p):"";if(!B){C&&(se.value=Xt(se.value,c));return}const H=y.transient===!0;(C==null?void 0:C.message)===B&&C.transient===H||(se.value={...se.value,[c]:{message:B,transient:H}})}function Pn(c){var p;c&&(p=se.value[c])!=null&&p.transient&&St(c,null)}function Dn(){const c=Object.entries(se.value).filter(([,y])=>y==null?void 0:y.transient).map(([y])=>y);if(c.length===0)return;let p=se.value;for(const y of c)p=Xt(p,y);se.value=p}function bn(c){const p=$r(t.value).find(y=>y.id===c);return(p==null?void 0:p.updatedAtIso)??""}function Wt(c,p){if(!c)return;const y={scrollTop:Math.max(0,p.scrollTop),isAtBottom:p.isAtBottom===!0};typeof p.scrollRatio=="number"&&Number.isFinite(p.scrollRatio)&&(y.scrollRatio=Zh(p.scrollRatio,0,1));const C=K.value[c];C&&C.scrollTop===y.scrollTop&&C.isAtBottom===y.isAtBottom&&C.scrollRatio===y.scrollRatio||(K.value={...K.value,[c]:y},fd(K.value))}function Bt(c,p){const y=r.value[c]??[];$o(y,p)||(r.value={...r.value,[c]:p})}function Ut(c,p){const y=o.value[c]??[];$o(y,p)||(o.value={...o.value,[c]:p})}function _n(c,p){const y=s.value[c]??[];$o(y,p)||(s.value={...s.value,[c]:p})}function Ct(c,p){const y=s.value[c]??[],C=ja(y,p);_n(c,C)}function an(c,p){const y=o.value[c]??[],C=ja(y,p);Ut(c,C)}function en(c,p){if(!c)return;const y=p.trim(),C=i.value[c]??"";if(y.length===0){if(!C)return;i.value=Xt(i.value,c);return}C!==y&&(i.value={...i.value,[c]:y})}function jn(c,p){if(!c)return;const y=i.value[c]??"";en(c,`${y}${p}`)}function dn(c){c&&c in i.value&&(i.value=Xt(i.value,c))}function sn(c){c&&c in s.value&&(s.value=Xt(s.value,c))}function er(c){return c==="completed"?"completed":c==="inProgress"||c==="in_progress"?"inProgress":"pending"}function fn(c){var y;const p=[];(y=c.explanation)!=null&&y.trim()&&p.push(c.explanation.trim());for(const C of c.steps){const B=C.status==="completed"?"x":C.status==="inProgress"?"~":" ";p.push(`- [${B}] ${C.step}`)}return p.join(`
1448
+ `).trim()}function Yt(c){if(c.method!=="turn/plan/updated")return null;const p=Ne(c.params),y=Qt(c),C=$e(p==null?void 0:p.turnId)||$e(p==null?void 0:p.turn_id),H=(Array.isArray(p==null?void 0:p.plan)?p==null?void 0:p.plan:[]).map(pe=>Ne(pe)).map(pe=>({step:$e(pe==null?void 0:pe.step),status:er(pe==null?void 0:pe.status)})).filter(pe=>pe.step.length>0);if(!y||!C)return null;const ve={explanation:$e(p==null?void 0:p.explanation).trim()||void 0,steps:H,isStreaming:!0};return{threadId:y,message:{id:`${C}:plan`,role:"assistant",text:fn(ve),messageType:"plan.live",plan:ve}}}function Mn(c){if(c.method!=="item/plan/delta")return null;const p=Ne(c.params),y=Qt(c),C=$e(p==null?void 0:p.turnId)||$e(p==null?void 0:p.turn_id),B=$e(p==null?void 0:p.delta);if(!y||!C||!B)return null;const H=`${C}:plan`,le=(s.value[y]??[]).find(tt=>tt.id===H),ve=`${(le==null?void 0:le.text)??""}${B}`,pe=le!=null&&le.plan?{...le.plan,isStreaming:!0}:void 0;return{threadId:y,message:{id:H,role:"assistant",text:ve,messageType:"plan.live",plan:pe}}}function Ne(c){return c!==null&&typeof c=="object"&&!Array.isArray(c)?c:null}function $e(c){return typeof c=="string"?c:""}function qn(c){return typeof c=="number"&&Number.isFinite(c)?c:null}function Qt(c){const p=Ne(c.params);if(!p)return"";const y=$e(p.threadId);if(y)return y;const C=$e(p.thread_id);if(C)return C;const B=$e(p.conversationId);if(B)return B;const H=$e(p.conversation_id);if(H)return H;const le=Ne(p.thread),ve=$e(le==null?void 0:le.id);if(ve)return ve;const pe=Ne(p.turn),tt=$e(pe==null?void 0:pe.threadId);if(tt)return tt;const $t=$e(pe==null?void 0:pe.thread_id);return $t||""}function Fn(c){if(c.method!=="turn/completed")return"";const p=Ne(c.params),y=Ne(p==null?void 0:p.turn);if(!y||y.status!=="failed")return"";const C=Ne(y.error);return $e(C==null?void 0:C.message)}function tr(c){var C;if(c.method!=="error")return null;const p=Ne(c.params),y=$e(p==null?void 0:p.message)||$e((C=Ne(p==null?void 0:p.error))==null?void 0:C.message);return y?{message:y,transient:(p==null?void 0:p.willRetry)===!0}:null}function Gn(c){const p=Ne(c);if(!p)return null;const y=p.id,C=$e(p.method),B=p.params;if(typeof y!="number"||!Number.isInteger(y)||!C)return null;const H=Ne(B),le=$e(H==null?void 0:H.threadId)||Hs,ve=$e(H==null?void 0:H.turnId),pe=$e(H==null?void 0:H.itemId),tt=$e(p.receivedAtIso)||new Date().toISOString();return{id:y,method:C,threadId:le,turnId:ve,itemId:pe,receivedAtIso:tt,params:B??null}}function Kn(c){if(c.method!=="item/tool/requestUserInput")return[];const p=Ne(c.params),y=Array.isArray(p==null?void 0:p.questions)?p.questions:[],C=[];for(const B of y){const H=Ne(B),le=$e(H==null?void 0:H.id).trim();le&&C.push(le)}return C}function Bn(c){const p=c.threadId||Hs,y=te.value[p]??[],C=y.findIndex(H=>H.id===c.id),B=[...y];C>=0?B.splice(C,1,c):B.push(c),te.value={...te.value,[p]:B.sort((H,le)=>H.receivedAtIso.localeCompare(le.receivedAtIso))}}function $n(c){const p={};for(const[y,C]of Object.entries(te.value)){const B=C.filter(H=>H.id!==c);B.length>0&&(p[y]=B)}te.value=p}function kn(c){const p={};for(const y of c){const C=y.threadId||Hs,B=p[C]??[];B.push(y),p[C]=B}for(const y of Object.values(p))y.sort((C,B)=>C.receivedAtIso.localeCompare(B.receivedAtIso));te.value=p}function x(c){if(c.method==="server/request"){const p=Gn(c.params);return p&&Bn(p),!0}if(c.method==="server/request/resolved"){const p=Ne(c.params),y=p==null?void 0:p.id;return typeof y=="number"&&Number.isInteger(y)&&$n(y),!0}return!1}function F(c){return c.replace(/\s+/gu," ").trim()}function oe(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 y=Ne(c.params),C=Ne(y==null?void 0:y.item),B=$e(C==null?void 0:C.type).toLowerCase();if(B==="reasoning")return{threadId:p,activity:{label:"Thinking",details:[]}};if(B==="agentmessage")return{threadId:p,activity:{label:"Writing response",details:[]}};if(B==="commandexecution"){const H=$e(C==null?void 0:C.command);return{threadId:p,activity:{label:"Running command",details:H?[H]:[]}}}}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 Fe(c){if(c.method!=="turn/started")return null;const p=Ne(c.params);if(!p)return null;const y=Qt(c);if(!y)return null;const C=Ne(p.turn),B=$e(C==null?void 0:C.id)||$e(p.turnId)||`${y}:unknown`;if(!B)return null;const H=ss($e(C==null?void 0:C.startedAt))??ss($e(p.startedAt))??ss(c.atIso)??Date.now();return{threadId:y,turnId:B,startedAtMs:H}}function it(c){if(c.method!=="turn/completed")return null;const p=Ne(c.params);if(!p)return null;const y=Qt(c);if(!y)return null;const C=Ne(p.turn),B=$e(C==null?void 0:C.id)||$e(p.turnId)||`${y}:unknown`;if(!B)return null;const H=ss($e(C==null?void 0:C.completedAt))??ss($e(p.completedAt))??ss(c.atIso)??Date.now(),le=ss($e(C==null?void 0:C.startedAt))??ss($e(p.startedAt))??void 0;return{threadId:y,turnId:B,completedAtMs:H,startedAtMs:le}}function ft(c){return`${c}:live-reasoning`}function ht(c){const p=Ne(c.params);if(!p)return"";if(c.method==="item/started"){const y=Ne(p.item);return!y||y.type!=="reasoning"?"":$e(y.id)}return""}function Nt(c){const p=Ne(c.params);if(!p)return null;if(c.method==="item/reasoning/summaryTextDelta"){const y=$e(p.itemId),C=$e(p.delta);return!y||!C?null:{messageId:ft(y),delta:C}}return null}function Un(c){const p=Ne(c.params);if(!p)return"";if(c.method==="item/reasoning/summaryPartAdded"){const y=$e(p.itemId);return y?ft(y):""}return""}function Hn(c){const p=Ne(c.params);if(!p)return"";if(c.method==="item/completed"){const y=Ne(p.item);return!y||y.type!=="reasoning"?"":ft($e(y.id))}return""}function On(c){const p=Ne(c.params);if(!p)return"";if(c.method==="item/started"){const y=Ne(p.item);return!y||y.type!=="agentMessage"?"":$e(y.id)}return""}function Yr(c){const p=Ne(c.params);if(!p)return null;if(c.method==="item/agentMessage/delta"){const y=$e(p.itemId),C=$e(p.delta);return!y||!C?null:{messageId:y,delta:C}}return null}function nr(c){const p=Ne(c.params);if(!p)return null;if(c.method==="item/completed"){const y=Ne(p.item);if(!y||y.type!=="agentMessage")return null;const C=$e(y.id),B=$e(y.text);return!C||!B?null:{id:C,role:"assistant",text:B,messageType:"agentMessage.live"}}return null}function vs(c){if(c.method!=="item/started")return null;const p=Ne(c.params),y=Ne(p==null?void 0:p.item);if(!y||y.type!=="commandExecution")return null;const C=$e(y.id),B=$e(y.command);if(!C)return null;const H=typeof y.cwd=="string"?y.cwd:null;return{id:C,role:"system",text:B,messageType:"commandExecution",commandExecution:{command:B,cwd:H,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function rr(c){if(c.method!=="item/commandExecution/outputDelta")return null;const p=Ne(c.params);if(!p)return null;const y=$e(p.itemId),C=$e(p.delta);return!y||!C?null:{itemId:y,delta:C}}function Qr(c){if(c.method!=="item/completed")return null;const p=Ne(c.params),y=Ne(p==null?void 0:p.item);if(!y||y.type!=="commandExecution")return null;const C=$e(y.id),B=$e(y.command);if(!C)return null;const H=typeof y.cwd=="string"?y.cwd:null,le=$e(y.status),ve=le==="failed"?"failed":le==="declined"?"declined":le==="interrupted"?"interrupted":"completed",pe=typeof y.aggregatedOutput=="string"?y.aggregatedOutput:"",tt=typeof y.exitCode=="number"?y.exitCode:null;return{id:C,role:"system",text:B,messageType:"commandExecution",commandExecution:{command:B,cwd:H,status:ve,aggregatedOutput:pe,exitCode:tt}}}function Ir(c,p){const y=a.value[c]??[],C=ja(y,p);C!==y&&(a.value={...a.value,[c]:C})}function Xr(c,p){const y=a.value[c];if(!y||y.length===0)return;const C=new Set(p.map(H=>H.id)),B=y.filter(H=>!C.has(H.id));B.length!==y.length&&(B.length===0?a.value=Xt(a.value,c):a.value={...a.value,[c]:B})}function hn(c){if(c.method==="item/agentMessage/delta")return!0;const p=Ne(c.params);if(!p)return!1;if(c.method==="item/completed"){const y=Ne(p.item);return(y==null?void 0:y.type)==="agentMessage"}return!1}function ys(c){var D,ie,Ve,ct,Ge;if(x(c))return;if(c.method==="thread/name/updated"){const Le=Ne(c.params),Vn=$e(Le==null?void 0:Le.threadId),sr=$e(Le==null?void 0:Le.threadName);Vn&&sr&&(ze.value={...ze.value,[Vn]:sr},Ye(),Ea(Vn,sr))}if(c.method==="account/rateLimits/updated"){Ie(Xf(c.params));return}const p=oe(c);p&&Tt(p.threadId,p.activity);const y=Qt(c),C=tr(c);!C&&y&&Pn(y);const B=Fe(c);B&&(Ee.set(B.turnId,B),ue.value={...ue.value,[B.threadId]:B.turnId},sn(B.threadId),dt(B.threadId,null),St(B.threadId,null),bt(B.threadId,!0),u.value[B.threadId]&&(u.value=Xt(u.value,B.threadId)));const H=it(c),le=Fn(c),pe=!!((H==null?void 0:H.threadId)??Qt(c))&&!!le&&$.value!==Qn&&ui(new Error(le));if(H){const Le=Ee.get(H.turnId);Le&&Ee.delete(H.turnId);const Vn=qn((D=Ne(c.params))==null?void 0:D.durationMs)??qn((Ve=Ne((ie=Ne(c.params))==null?void 0:ie.turn))==null?void 0:Ve.durationMs)??(typeof H.startedAtMs=="number"?H.completedAtMs-H.startedAtMs:null)??(Le?H.completedAtMs-Le.startedAtMs:null),sr=typeof Vn=="number"?Math.max(0,Vn):0;dt(H.threadId,{turnId:H.turnId,durationMs:sr}),ue.value[H.threadId]&&(ue.value=Xt(ue.value,H.threadId)),bt(H.threadId,!1),Tt(H.threadId,null),rn(H.threadId),pe||(xe(H.threadId),bs(H.threadId))}if(le){const Le=(H==null?void 0:H.threadId)||Qt(c);Le&&St(Le,le),ke.value=le,Le&&pe&&Be(Le)}else H&&St(H.threadId,null);if(C){const Le=y;Le&&St(Le,C.message,{transient:C.transient}),ke.value=C.message,$.value!==Qn&&ui(new Error(C.message))&&(Le?Be(Le):ye())}const tt=Yt(c);tt&&(Ct(tt.threadId,tt.message),Tt(tt.threadId,{label:"Planning",details:((ct=tt.message.plan)==null?void 0:ct.steps.map(Le=>Le.step).slice(0,2))??[]}));const $t=Mn(c);if($t&&(Ct($t.threadId,$t.message),Tt($t.threadId,{label:"Planning",details:[]})),!y||y!==n.value)return;On(c);const zt=Yr(c);if(zt){const Le=(o.value[y]??[]).find(sr=>sr.id===zt.messageId),Vn=`${(Le==null?void 0:Le.text)??""}${zt.delta}`;an(y,{id:zt.messageId,role:"assistant",text:Vn,messageType:"agentMessage.live"})}const Sn=nr(c);Sn&&an(y,Sn),ht(c);const Ar=Nt(c);if(Ar&&jn(y,Ar.delta),Un(c)){const Le=i.value[y]??"";Le.trim().length>0&&!Le.endsWith(`
1449
+
1450
+ `)&&en(y,`${Le}
1451
+
1452
+ `)}Hn(c);const ks=vs(c);ks&&(Ir(y,ks),Tt(y,{label:"Running command",details:[((Ge=ks.commandExecution)==null?void 0:Ge.command)??""]}));const po=rr(c);if(po){const Le=(a.value[y]??[]).find(Vn=>Vn.id===po.itemId);Le!=null&&Le.commandExecution&&Ir(y,{...Le,commandExecution:{...Le.commandExecution,aggregatedOutput:`${Le.commandExecution.aggregatedOutput}${po.delta}`}})}const b=Qr(c);if(b&&Ir(y,b),hn(c)&&(he&&n.value&&Wt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),dn(y)),c.method==="turn/completed"){he=!1,dn(y),a.value[y]&&(a.value=Xt(a.value,y));const Le=Qt(c);Le&&(bt(Le,!1),Tt(Le,null),rn(Le),pe||(xe(Le),bs(Le)))}}function I(c){const p=Qt(c);p&&W.add(p);const y=c.method;(y.startsWith("thread/")||y.startsWith("turn/")||y.startsWith("item/"))&&(qe=!0),!(mt!==null||typeof window>"u")&&(mt=window.setTimeout(()=>{mt=null,m()},Oa))}async function R(c){if(!be){be=!0;try{const p=await _o(),y=[];for(const C of p.order){const B=Vs(C);y.includes(B)||y.push(B)}if(y.length>0){const C=ci(y,c);Ps(ee.value,C)||(ee.value=C,Ws(ee.value))}if(Object.keys(p.labels).length>0){const C={...re.value};let B=!1;for(const[H,le]of Object.entries(p.labels)){const ve=Vs(H);C[ve]!==le&&(C[ve]=le,B=!0)}B&&(re.value=C,La(C))}}catch{}}}async function N(){if(!(Object.keys(ze.value).length>0))try{const c=await _0();Object.keys(c.titles).length>0&&(ze.value=c.titles)}catch{}}async function ne(c,p,y){if(ze.value[c])return;const C=p.trim();if(!C)return;const B=C.length>300?C.slice(0,300):C;try{const H=await k0(B,y);if(!H||ze.value[c])return;ze.value={...ze.value,[c]:H},Ye(),Ea(c,H)}catch{}}async function Ue(){var c;Ot.value||(He.value=!0);try{const[p]=await Promise.all([Yk(),N()]);await R(p);const y=ci(ee.value,p);Ps(ee.value,y)||(ee.value=y,Ws(ee.value));const C=Da(p,ee.value),B=KA(t.value,C,l.value);t.value=di(t.value,B),l.value=pn(l.value,new Set($r(t.value).map(ve=>ve.id))),Ye(),Ot.value=!0;const H=$r(e.value);Ht(H),H.some(ve=>ve.id===n.value)||q(((c=H[0])==null?void 0:c.id)??"")}finally{He.value=!1}}async function ot(c,p={}){if(!c)return;const y=Te.value[c]===!0,C=p.silent!==!0&&!y;C&&(Pe.value=!0);try{me.value[c]!==!0&&(await Sa(c),me.value={...me.value,[c]:!0});const{messages:B,inProgress:H}=await Qk(c),le=r.value[c]??[],ve=LA(le,B,{preserveMissing:p.silent===!0});Bt(c,ve);const pe=o.value[c]??[],tt=DA(pe,B);Ut(c,tt),Xr(c,B),Te.value={...Te.value,[c]:!0};const $t=bn(c);$t&&(we.value={...we.value,[c]:$t}),bt(c,H),H||sn(c),ut(c)}finally{C&&(Pe.value=!1)}}async function Vt(c,p={}){c&&Te.value[c]!==!0&&await ot(c,p)}async function Nn(){try{const c=t.value.flatMap(p=>p.threads.map(y=>y.cwd)).filter(Boolean);We.value=await T0(c.length>0?[...new Set(c)]:void 0)}catch{}}async function Gt(){try{Ie(await t0())}catch{}}async function Jt(c={}){ke.value="";const p=c.includeSelectedThreadMessages!==!1,y=c.awaitAncillaryRefreshes===!0;try{await Ue();const C=Promise.allSettled([vt(),Ze(),Nn(),Gt()]).then(()=>{});p&&await ot(n.value),y&&await C}catch(C){ke.value=C instanceof Error?C.message:"Unknown application error"}}async function Tn(c){q(c);try{await ot(c)}catch(p){ke.value=p instanceof Error?p.message:"Unknown application error"}}async function Wn(c){try{await i0(c),await Ue(),n.value===c&&await ot(n.value)}catch(p){ke.value=p instanceof Error?p.message:"Unknown application error"}}async function Jn(c,p){const y=p.trim();if(!(!c||!y))try{await a0(c,y),ze.value={...ze.value,[c]:y},Ye(),Ea(c,y)}catch(C){ke.value=C instanceof Error?C.message:"Unknown application error"}}async function ws(c,p){var le;const y=c.trim();if(!y||!Number.isInteger(p)||p<0)return"";if(l.value[y]===!0)return ke.value="Finish the current turn before forking from a response.","";if(Te.value[y]!==!0)try{await ot(y)}catch(ve){return ke.value=ve instanceof Error?ve.message:"Unknown application error",""}const C=r.value[y]??[];let B=-1;for(const ve of C)typeof ve.turnIndex=="number"&&Number.isFinite(ve.turnIndex)&&(B=Math.max(B,ve.turnIndex));if(B>=0&&p>B)return"";const H=$r(t.value).find(ve=>ve.id===y)??null;try{ke.value="";const ve=await c0(y),pe=ve.threadId.trim();if(!pe)return"";const tt=ve.cwd.trim()||((le=H==null?void 0:H.cwd)==null?void 0:le.trim())||"",$t=QA((H==null?void 0:H.title)||(H==null?void 0:H.preview)||"Untitled thread");jt(pe,tt,$t),Bt(pe,ve.messages),Te.value={...Te.value,[pe]:!0},me.value={...me.value,[pe]:!0},sn(pe),Ut(pe,[]),dn(pe),a.value[pe]&&(a.value=Xt(a.value,pe)),dt(pe,null),Tt(pe,null),St(pe,null),bt(pe,!1);const zt=B-p;if(zt>0){const Sn=await Cu(pe,zt);Bt(pe,Sn)}return await Jn(pe,$t),q(pe),Ue().catch(()=>{}),pe}catch(ve){return ke.value=ve instanceof Error?ve.message:"Unknown application error",""}}async function fo(c,p,y=[],C=[],B=[]){if(!c||!p.trim()||y.length>0||C.length>0||B.length>0)return!1;const le=(te.value[c]??[]).filter(tt=>tt.method==="item/tool/requestUserInput");if(le.length!==1)return!1;const[ve]=le,pe=Kn(ve);return pe.length!==1?!1:P({id:ve.id,result:{answers:{[pe[0]]:{answers:[p.trim()]}}}})}async function Zr(c,p=[],y=[],C="steer",B=[]){const H=n.value,le=c.trim();if(!H||!le&&p.length===0&&B.length===0||await fo(H,le,p,y,B))return;const ve=l.value[H]===!0;if(ve&&C==="queue"){const pe=f.value[H]??[],tt=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`;f.value={...f.value,[H]:[...pe,{id:tt,text:le,imageUrls:p,skills:y,fileAttachments:B,collaborationMode:U.value}]};return}if(ve){he=!0,Er(H,le,p,y,B).catch(pe=>{const tt=pe instanceof Error?pe.message:"Unknown application error";St(H,tt),ke.value=tt});return}ke.value="",he=!0,dt(H,null),Tt(H,{label:"Thinking",details:kt($.value,X.value,U.value)}),St(H,null),bt(H,!0);try{await Er(H,le,p,y,B)}catch(pe){he=!1,bt(H,!1),Tt(H,null);const tt=pe instanceof Error?pe.message:"Unknown application error";throw St(H,tt),ke.value=tt,pe}}async function ho(c,p,y=[],C=[],B=[]){const H=c.trim(),le=p.trim(),ve=$.value.trim();if(!H&&y.length===0&&B.length===0)return"";nt.value=!0,ke.value="";let pe="";try{try{pe=await Au(le||void 0,ve||void 0)}catch(Sn){if(ve&&ve!==Qn&&ui(Sn))await ye(),pe=await Au(le||void 0,Qn);else throw Sn}if(!pe)return"";jt(pe,le,H||"[Image]"),me.value={...me.value,[pe]:!0},q(pe),he=!0,dt(pe,null),Tt(pe,{label:"Thinking",details:kt($.value,X.value,U.value)}),St(pe,null),bt(pe,!0);const tt=pe,$t=le||null,zt=H;return Er(pe,H,y,C,B).catch(Sn=>{he=!1,bt(pe,!1),Tt(pe,null);const Ar=Sn instanceof Error?Sn.message:"Unknown application error";St(pe,Ar),ke.value=Ar}).finally(()=>{nt.value=!1}),ne(tt,zt,$t),pe}catch(tt){he=!1,pe&&(bt(pe,!1),Tt(pe,null));const $t=tt instanceof Error?tt.message:"Unknown application error";throw pe&&St(pe,$t),ke.value=$t,nt.value=!1,tt}}async function Er(c,p,y=[],C=[],B=[]){const H=$.value.trim(),le=X.value,ve=U.value,pe=p.trim(),tt=C.map(zt=>({name:zt.name,path:zt.path})),$t=B.map(zt=>({...zt}));Ce(c,{text:pe,imageUrls:[...y],skills:tt,fileAttachments:$t,effort:le,collaborationMode:ve,fallbackRetried:!1});try{me.value[c]!==!0&&await Sa(c);try{await Ia(c,p,y,H||void 0,le||void 0,C.length>0?C:void 0,B,ve)}catch(zt){if(H&&H!==Qn&&ui(zt))await ye(),Ce(c,{text:pe,imageUrls:[...y],skills:tt,fileAttachments:$t,effort:le,collaborationMode:ve,fallbackRetried:!0}),await Ia(c,p,y,Qn,le||void 0,C.length>0?C:void 0,B,ve);else throw zt}me.value={...me.value,[c]:!0},W.add(c),qe=!0,await m()}catch(zt){throw zt}}async function bs(c){const p=f.value[c];if(!p||p.length===0)return;const[y,...C]=p;f.value=C.length>0?{...f.value,[c]:C}:Xt(f.value,c),nt.value=!0,ke.value="",he=!0,dt(c,null),Tt(c,{label:"Thinking",details:kt($.value,X.value,y.collaborationMode)}),St(c,null),bt(c,!0);try{G(y.collaborationMode),await Er(c,y.text,y.imageUrls,y.skills,y.fileAttachments)}catch{bt(c,!1),Tt(c,null)}finally{nt.value=!1}}async function Cr(){const c=n.value;if(!c||l.value[c]!==!0)return;const p=ue.value[c];et.value=!0,ke.value="";try{await f0(c,p),bt(c,!1),Tt(c,null),St(c,null),ue.value[c]&&(ue.value=Xt(ue.value,c)),W.add(c),qe=!0,await m()}catch(y){const C=y instanceof Error?y.message:"Failed to interrupt active turn";St(c,C),ke.value=C}finally{et.value=!1}}function Fs(c,p){c.length===0||(re.value[c]??"")===p||(re.value={...re.value,[c]:p},La(re.value))}async function Bs(c){var H;if(c.length===0)return;const p=ee.value.filter(le=>le!==c);if(Ps(ee.value,p)||(ee.value=p,Ws(ee.value)),t.value=t.value.filter(le=>le.projectName!==c),re.value[c]!==void 0){const le={...re.value};delete le[c],re.value=le,La(le)}Ye();const y=$r(e.value);Ht(y),y.some(le=>le.id===n.value)||q(((H=y[0])==null?void 0:H.id)??"");const B=new Set;try{const le=await _o();for(const ve of le.order)Vs(ve)===c&&B.add(ve);for(const ve of le.active)Vs(ve)===c&&B.add(ve);for(const ve of Object.keys(le.labels))Vs(ve)===c&&B.add(ve)}catch{}if(B.size>0)try{const le=await _o(),ve=le.order.filter($t=>!B.has($t)),pe=le.active.filter($t=>!B.has($t)),tt=pe.length===0&&ve.length>0?[ve[0]]:pe;await Ru({order:ve,labels:VA(le.labels,B),active:tt});return}catch{}await d()}function es(c,p){if(c.length===0||t.value.length===0)return;const y=t.value.map(pe=>pe.projectName),C=y.indexOf(c);if(C===-1)return;const B=Math.max(0,Math.min(p,y.length-1)),H=MA(y,C,B);if(H===y)return;const le=ci(H,t.value);ee.value=le,Ws(ee.value);const ve=Da(t.value,ee.value);t.value=di(t.value,ve),Ye(),d()}function _s(c){const p=c.trim();if(!p)return;const y=[p,...ee.value.filter(B=>B!==p)];if(Ps(ee.value,y))return;ee.value=y,Ws(ee.value);const C=Da(t.value,ee.value);t.value=di(t.value,C),Ye(),d()}async function d(){var c,p;try{const y=await _o(),C=new Map;for(const le of y.order){const ve=Vs(le);C.has(ve)||C.set(ve,le)}for(const le of t.value){const ve=((p=(c=le.threads[0])==null?void 0:c.cwd)==null?void 0:p.trim())??"";ve&&C.set(le.projectName,ve)}const B=[];for(const le of ee.value){const ve=C.get(le);ve&&!B.includes(ve)&&B.push(ve)}for(const le of y.order)B.includes(le)||B.push(le);const H=y.active.filter(le=>B.includes(le));H.length===0&&B.length>0&&H.push(B[0]),await Ru({order:B,labels:y.labels,active:H})}catch{}}async function m(){if(at.value){typeof window<"u"&&mt===null&&(mt=window.setTimeout(()=>{mt=null,m()},Oa));return}at.value=!0;const c=qe,p=new Set(W);qe=!1,W.clear();try{c&&await Ue();const y=n.value;if(!y)return;const C=p.has(y),B=l.value[y]===!0,H=bn(y),le=we.value[y]??"",ve=H.length>0&&H!==le;(C||B||ve||c)&&await ot(y,{silent:!0})}catch{}finally{at.value=!1,(qe||W.size>0)&&typeof window<"u"&&mt===null&&(mt=window.setTimeout(()=>{mt=null,m()},Oa))}}async function h(){await L(),qe=!0,n.value&&W.add(n.value),await m()}function A(){typeof window>"u"||gt||(L(),gt=Xk(c=>{if(c.method==="ready"){Dn(),h();return}ys(c),I(c)}))}async function L(){try{const p=(await e0()).map(y=>Gn(y)).filter(y=>y!==null);kn(p)}catch{}}async function P(c){try{return await Zk(c.id,{result:c.result,error:c.error}),$n(c.id),!0}catch(p){return ke.value=p instanceof Error?p.message:"Failed to reply to server request",!1}}function ge(){gt&&(gt(),gt=null),qe=!1,W.clear(),Ee.clear(),mt!==null&&typeof window<"u"&&(window.clearTimeout(mt),mt=null),he=!1,r.value={},s.value={},o.value={},i.value={},a.value={},ae.value={},Me.value={},se.value={},ue.value={},f.value={},Je.value=null}const V=de(()=>{const c=n.value;return c?f.value[c]??[]:[]});function Se(c){const p=n.value;if(!p)return;const y=f.value[p];if(!y)return;const C=y.filter(B=>B.id!==c);f.value=C.length>0?{...f.value,[p]:C}:Xt(f.value,p)}function Oe(c){const p=n.value;if(!p)return;const y=f.value[p];if(!y)return;const C=y.find(B=>B.id===c);C&&(Se(c),G(C.collaborationMode),Zr(C.text,C.imageUrls,C.skills,"steer",C.fileAttachments))}function Qe(c){q(c)}return{projectGroups:e,projectDisplayNameById:re,selectedThread:S,selectedThreadScrollState:O,selectedThreadServerRequests:Z,selectedLiveOverlay:J,codexQuota:M,selectedThreadId:n,availableCollaborationModes:_,availableModelIds:g,selectedCollaborationMode:U,selectedModelId:$,selectedReasoningEffort:X,installedSkills:We,messages:z,isLoadingThreads:He,isLoadingMessages:Pe,isSendingMessage:nt,isInterruptingTurn:et,error:ke,refreshAll:Jt,refreshSkills:Nn,selectThread:Tn,loadMessages:ot,ensureThreadMessagesLoaded:Vt,setThreadScrollState:Wt,archiveThreadById:Wn,renameThreadById:Jn,forkThreadFromTurn:ws,sendMessageToSelectedThread:Zr,sendMessageToNewThread:ho,interruptSelectedThreadTurn:Cr,selectedThreadQueuedMessages:V,removeQueuedMessage:Se,steerQueuedMessage:Oe,setSelectedCollaborationMode:G,setSelectedModelId:Q,setSelectedReasoningEffort:lt,respondToPendingServerRequest:P,renameProject:Fs,removeProject:Bs,reorderProject:es,pinProjectToTop:_s,startPolling:A,stopPolling:ge,primeSelectedThread:Qe}}const ZA={class:"sidebar-root"},ex={class:"sidebar-scrollable"},tx=["aria-pressed"],nx={key:1,class:"sidebar-search-bar"},rx={key:0,class:"sidebar-settings-area"},sx={key:0,class:"sidebar-settings-panel"},ox={class:"sidebar-settings-account-section"},ix={class:"sidebar-settings-account-header"},ax={class:"sidebar-settings-account-header-main"},lx={class:"sidebar-settings-account-count"},cx=["disabled"],ux={key:0,class:"sidebar-settings-account-error"},dx={key:1,class:"sidebar-settings-account-empty"},fx={key:2,class:"sidebar-settings-account-list"},hx=["title","onMouseenter","onMouseleave"],px={class:"sidebar-settings-account-main"},mx={class:"sidebar-settings-account-email"},gx={class:"sidebar-settings-account-meta"},vx={class:"sidebar-settings-account-quota"},yx={class:"sidebar-settings-account-id"},wx={class:"sidebar-settings-account-actions"},bx=["disabled","onClick"],_x=["disabled","onClick"],kx={class:"sidebar-settings-value"},Tx={class:"sidebar-settings-value"},Sx={class:"content-root"},Ix={class:"content-body"},Ex={key:1,class:"content-grid"},Cx={class:"new-thread-empty"},Ax={class:"worktree-init-status-title"},xx={class:"worktree-init-status-message"},Rx={key:2,class:"content-grid"},Px={class:"content-thread"},Mx={class:"composer-with-queue"},$x={class:"build-badge","aria-label":"Author name, worktree name, and version"},hd="codex-web-local.sidebar-collapsed.v1",Fa="codex-web-local.last-active-thread-route.v1",pd="codex-web-local.send-with-enter.v1",md="codex-web-local.in-progress-send-mode.v1",gd="codex-web-local.dark-mode.v1",vd="codex-web-local.dictation-click-to-toggle.v1",Ox=400,Nx=on({__name:"App",setup(e){const t="codexui",n="1.0.8",{projectGroups:r,projectDisplayNameById:s,selectedThread:o,selectedThreadScrollState:i,selectedThreadServerRequests:a,selectedLiveOverlay:l,codexQuota:f,selectedThreadId:u,availableCollaborationModes:g,availableModelIds:_,selectedCollaborationMode:E,selectedModelId:U,selectedReasoningEffort:$,installedSkills:X,messages:ce,isLoadingThreads:K,isLoadingMessages:ee,isSendingMessage:re,isInterruptingTurn:we,refreshAll:Te,refreshSkills:me,selectThread:Me,ensureThreadMessagesLoaded:ae,setThreadScrollState:se,archiveThreadById:ue,renameThreadById:te,forkThreadFromTurn:Re,sendMessageToSelectedThread:Je,sendMessageToNewThread:ze,interruptSelectedThreadTurn:We,selectedThreadQueuedMessages:He,removeQueuedMessage:Pe,steerQueuedMessage:nt,setSelectedCollaborationMode:et,setSelectedModelId:ke,setSelectedReasoningEffort:at,respondToPendingServerRequest:Ot,renameProject:gt,removeProject:mt,reorderProject:qe,pinProjectToTop:W,startPolling:be,stopPolling:he,primeSelectedThread:Ee}=XA(),Ae=Dv(),T=Lv(),{isMobile:S}=Vl(),O=j(null),Z=j(!1),J=j(!1),M=j(""),z=j("local"),q=j({order:[],labels:{}}),Q=j({phase:"idle",title:"",message:""}),G=j(le()),Ie=j(""),ye=j(!1),Ce=j(null),xe=j(null);let Be=null;const lt=j("New Project (1)"),Ze=j(""),kt=j(!1),vt=j([]),Mt=j(!1),Ye=j(!1),jt=j(""),Ht=j(""),ut=j(""),dt=j(""),bt=j(Oe(pd,!0)),rn=j(c()),Tt=j(Qe()),St=j(Oe(vd,!1)),Pn=j(null),Dn=j(!1),bn=j(!1);let Wt=null,Bt=!1;const Ut=de(()=>{const b=Ae.params.threadId;return typeof b=="string"?b:""}),_n=de(()=>{const b=new Set;for(const D of r.value)for(const ie of D.threads)b.add(ie.id);return b}),Ct=de(()=>Ae.name==="home"),an=de(()=>Ae.name==="skills"),en=de(()=>{var b;return an.value?"Skills":Ct.value?"New thread":((b=o.value)==null?void 0:b.title)??"Choose a thread"}),jn=de(()=>ce.value.filter(b=>{const D=pe(b.messageType,b.role);return D==="worked"?!0:!(D==="turnActivity.live"||D==="turnError.live"||D==="agentReasoning.live")})),dn=de(()=>l.value),sn=de(()=>Ct.value?"__new-thread__":u.value),er=de(()=>{var b,D;return Ct.value?M.value.trim():((D=(b=o.value)==null?void 0:b.cwd)==null?void 0:D.trim())??""}),fn=de(()=>{var b;return!Ct.value&&((b=o.value)==null?void 0:b.inProgress)===!0}),Yt=de(()=>re.value||we.value||fn.value||a.value.length>0),Mn=de(()=>{var Ve,ct;const b=[],D=new Set;for(const Ge of q.value.order){const Le=Ge.trim();!Le||D.has(Le)||(D.add(Le),b.push({value:Le,label:q.value.labels[Le]||d(Le)}))}for(const Ge of r.value){const Le=((ct=(Ve=Ge.threads[0])==null?void 0:Ve.cwd)==null?void 0:ct.trim())??"";!Le||D.has(Le)||(D.add(Le),b.push({value:Le,label:s.value[Ge.projectName]??Ge.projectName}))}const ie=M.value.trim();return ie&&!D.has(ie)&&b.unshift({value:ie,label:d(ie)}),b}),Ne=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null;Kr(()=>{window.addEventListener("keydown",Vt),document.addEventListener("visibilitychange",Nn),window.addEventListener("pageshow",Gt),window.addEventListener("focus",Jt),H(),Ne==null||Ne.addEventListener("change",H),$t(),ho(),Bs(),es(),Cr()}),zi(()=>{window.removeEventListener("keydown",Vt),document.removeEventListener("visibilitychange",Nn),window.removeEventListener("pageshow",Gt),window.removeEventListener("focus",Jt),Ne==null||Ne.removeEventListener("change",H),Wt!==null&&(window.clearInterval(Wt),Wt=null),Be&&(clearTimeout(Be),Be=null),he()}),pt(Ie,b=>{const D=b.trim();if(Be&&(clearTimeout(Be),Be=null),!D){xe.value=null;return}Be=setTimeout(()=>{b0(D,1e3).then(ie=>{Ie.value.trim()===D&&(xe.value=ie.threadIds)}).catch(()=>{Ie.value.trim()===D&&(xe.value=null)})},220)}),pt(vt,()=>{if(typeof window>"u")return;if(!vt.value.some(D=>D.quotaStatus==="loading")){Wt!==null&&(window.clearInterval(Wt),Wt=null);return}Wt===null&&(Wt=window.setInterval(()=>{Bt||(Bt=!0,On({silent:!0}).finally(()=>{Bt=!1}))},1500))},{deep:!0});function $e(){me()}function qn(){ye.value=!ye.value,ye.value?Zt(()=>{var b;return(b=Ce.value)==null?void 0:b.focus()}):Ie.value=""}function Qt(){var b;Ie.value="",(b=Ce.value)==null||b.focus()}function Fn(b){b.key==="Escape"&&(ye.value=!1,Ie.value="")}function tr(b){b&&(Ae.name==="thread"&&Ut.value===b||(T.push({name:"thread",params:{threadId:b}}),S.value&&ot(!0)))}async function Gn(b){b&&(u.value!==b&&(await Me(b),await T.push({name:"thread",params:{threadId:b}})),await Zt(),P())}function Kn(b){return b.length>8?b.slice(-8):b}function Bn(b){const D=[b.planType||"unknown"];return b.authMode&&D.unshift(b.authMode),D.join(" · ")}function $n(b){if(!b)return!1;const D=b.toLowerCase();return D.includes("payment required")||/\b402\b/.test(D)}function kn(b){return b.unavailableReason==="payment_required"||$n(b.quotaError)}function x(b){return Mt.value||Ye.value||jt.value.length>0||b.isActive&&jt.value!==b.accountId&&Yt.value}function F(b){return Ht.value===b.accountId}function oe(b){return ut.value===b.accountId||F(b)}function Fe(b){return kn(b)?"Unavailable":b.isActive?"Active":Ye.value?"Switching…":"Switch"}function it(b){return jt.value===b.accountId?"Removing…":F(b)?"Click again to remove":"Remove"}function ft(b){ut.value=b}function ht(b){ut.value===b&&(ut.value=""),jt.value!==b&&Ht.value===b&&(Ht.value="")}function Nt(b){const D=b.quotaSnapshot;if(!D)return null;const ie=[D==null?void 0:D.primary,D==null?void 0:D.secondary].filter(Ge=>Ge!==null),Ve=ie.find(Ge=>Ge.windowMinutes===10080);if(Ve)return Ve;const ct=ie.filter(Ge=>typeof Ge.windowMinutes=="number"&&Ge.windowMinutes>=10080).sort((Ge,Le)=>(Ge.windowMinutes??0)-(Le.windowMinutes??0))[0]??null;return ct||(D.secondary??null)}function Un(b){var Ve,ct;if(kn(b))return b.quotaError||"402 Payment Required";const D=b.quotaSnapshot,ie=Nt(b);return ie?`${Math.max(0,Math.min(100,100-Math.round(ie.usedPercent)))}% weekly remaining`:(Ve=D==null?void 0:D.credits)!=null&&Ve.unlimited?"Unlimited credits":(ct=D==null?void 0:D.credits)!=null&&ct.hasCredits&&D.credits.balance?`${D.credits.balance} credits`:b.quotaStatus==="loading"?"Loading quota…":b.quotaStatus==="error"?b.quotaError||"Quota unavailable":"Fetching account details…"}function Hn(b){return[b.email||"Account",Bn(b),kn(b)?"Unavailable account":null,Un(b),`Workspace ${b.accountId}`].filter(Boolean).join(`
1453
+ `)}async function On(b={}){try{const D=await n0();vt.value=D.accounts,D.accounts.some(ie=>ie.accountId===ut.value)||(ut.value=""),D.accounts.some(ie=>ie.accountId===Ht.value)||(Ht.value="")}catch(D){if(b.silent===!0)return;dt.value=D instanceof Error?D.message:"Failed to load accounts"}}async function Yr(){if(!(Mt.value||Ye.value)){dt.value="",ut.value="",Ht.value="",Mt.value=!0;try{const b=await r0();vt.value=b.accounts,he(),be(),Te({includeSelectedThreadMessages:!0})}catch(b){dt.value=b instanceof Error?b.message:"Failed to refresh accounts"}finally{Mt.value=!1}}}async function nr(b){if(!(Ye.value||Mt.value)){if(Yt.value){dt.value="Finish the current turn and pending requests before switching accounts.";return}dt.value="",ut.value="",Ht.value="",Ye.value=!0;try{const D=await s0(b);vt.value=vt.value.map(ie=>ie.accountId===b?D:{...ie,isActive:!1}),he(),be(),Te({includeSelectedThreadMessages:!0}),On({silent:!0})}catch(D){dt.value=D instanceof Error?D.message:"Failed to switch account"}finally{Ye.value=!1}}}async function vs(b){if(Mt.value||Ye.value||jt.value.length>0)return;const D=vt.value.find(Ve=>Ve.accountId===b)??null;if(!D)return;if(Ht.value!==b){Ht.value=b;return}if(D.isActive&&Yt.value){dt.value="Finish the current turn and pending requests before removing the active account.";return}const ie=D.isActive;dt.value="",Ht.value="",jt.value=b;try{const Ve=await o0(b);vt.value=Ve.accounts,he(),be(),ie&&Te({includeSelectedThreadMessages:!0}),On({silent:!0})}catch(Ve){dt.value=Ve instanceof Error?Ve.message:"Failed to remove account"}finally{jt.value=""}}function rr(b){ue(b)}function Qr(b){var Ve,ct;const D=r.value.find(Ge=>Ge.projectName===b),ie=((ct=(Ve=D==null?void 0:D.threads[0])==null?void 0:Ve.cwd)==null?void 0:ct.trim())??"";ie&&(M.value=ie),S.value&&ot(!0),!Ct.value&&T.push({name:"home"})}function Ir(b){var Ve,ct;const D=r.value.find(Ge=>Ge.projectName===b),ie=((ct=(Ve=D==null?void 0:D.threads[0])==null?void 0:Ve.cwd)==null?void 0:ct.trim())??"";!ie||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(ie)}`,"_blank","noopener,noreferrer")}function Xr(){var D,ie;const b=((ie=(D=o.value)==null?void 0:D.cwd)==null?void 0:ie.trim())??"";b&&(M.value=b),S.value&&ot(!0),!Ct.value&&T.push({name:"home"})}function hn(b){gt(b.projectName,b.displayName)}function ys(b){te(b.threadId,b.title)}async function I(b){await mt(b),await es(),Cr()}function R(b){qe(b.projectName,b.toIndex)}function N(b){se(b.threadId,b.state)}function ne(b){Ot(b)}async function Ue(b){const D=await Re(b.threadId,b.turnIndex);D&&(await T.push({name:"thread",params:{threadId:D}}),u.value!==D&&await Me(D),S.value&&ot(!0))}function ot(b){G.value!==b&&(G.value=b,ve(b))}function Vt(b){b.defaultPrevented||!b.ctrlKey&&!b.metaKey||b.shiftKey||b.altKey||b.key.toLowerCase()==="b"&&(b.preventDefault(),ot(!G.value))}function Nn(){if(!(typeof document>"u")&&S.value){if(document.visibilityState==="hidden"){Pn.value=Date.now(),Dn.value=!1;return}Tn()}}function Gt(b){b.persisted&&Tn()}function Jt(){Tn()}function Tn(){typeof window>"u"||typeof document>"u"||!S.value||document.visibilityState!=="visible"||Dn.value||Pn.value===null||Date.now()-Pn.value<Ox||(Dn.value=!0,Pn.value=null,Wn())}async function Wn(){if(!bn.value){bn.value=!0;try{await Te({includeSelectedThreadMessages:!0,awaitAncillaryRefreshes:!0}),await ta(),await ks()}finally{bn.value=!1}}}function Jn(b){const D=b.text;if(ws(),Ct.value){po(D,b.imageUrls,b.skills,b.fileAttachments);return}Je(D,b.imageUrls,b.skills,b.mode,b.fileAttachments)}function ws(){if(!S.value||Ct.value)return;const b=()=>{var D;(D=O.value)==null||D.jumpToLatest()};b(),Zt(()=>{b(),!(typeof window>"u")&&window.requestAnimationFrame(()=>{b(),window.requestAnimationFrame(b)})})}function fo(b){M.value=b.trim()}async function Zr(b){const D=b.trim();if(!D)return;const ie=bs(D),Ve=await Er(),ct=ie?D:m(Ve,D);if(ct)try{const Ge=await Pu(ct,{createIfMissing:!ie,label:ie?"":D});Ge&&(M.value=Ge,W(d(Ge)),es(),Cr())}catch{}}async function ho(){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 ie=await Pu(b,{createIfMissing:!1,label:""});if(!ie)return;M.value=ie,W(d(ie)),await T.replace({name:"home"}),await es();const Ve=new URL(window.location.href);Ve.searchParams.delete("openProjectPath"),window.history.replaceState({},"",Ve.toString())}catch{}}async function Er(){const b=Fs();if(b)return b;try{const D=await xu();if(D)return Ze.value=D,D}catch{}return""}function bs(b){return b?b.startsWith("~/")||b.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(b):!1}async function Cr(){const b=Fs();if(!b){lt.value="New Project (1)";return}try{const D=await y0(b);lt.value=D.name||"New Project (1)"}catch{lt.value="New Project (1)"}}function Fs(){var ie,Ve;const b=M.value.trim();if(b)return _s(b);const D=((Ve=(ie=Mn.value[0])==null?void 0:ie.value)==null?void 0:Ve.trim())??"";return D?_s(D):Ze.value.trim()}async function Bs(){try{Ze.value=await xu()}catch{Ze.value=""}}async function es(){try{const b=await _o();q.value={order:[...b.order],labels:{...b.labels}}}catch{q.value={order:[],labels:{}}}}function _s(b){const D=b.trim().replace(/\/+$/,"");if(!D)return"";const ie=D.lastIndexOf("/");return ie<=0?"":D.slice(0,ie)}function d(b){const D=b.trim().replace(/\/+$/,"");if(!D)return"";const ie=D.lastIndexOf("/");return ie<0?D:D.slice(ie+1)}function m(b,D){const ie=b.trim().replace(/\/+$/,""),Ve=D.trim().replace(/^\/+/,"");return!ie||!Ve?"":`${ie}/${Ve}`}function h(b){ke(b)}function A(b){at(b)}function L(){We()}function P(){if(Ct.value||an.value||typeof document>"u"||!o.value||jn.value.length===0)return;const b=ge(),D=V(),ie=new Blob([b],{type:"text/markdown;charset=utf-8"}),Ve=URL.createObjectURL(ie),ct=document.createElement("a");ct.href=Ve,ct.download=D,document.body.appendChild(ct),ct.click(),document.body.removeChild(ct),window.setTimeout(()=>URL.revokeObjectURL(Ve),0)}function ge(){var ie,Ve,ct;const b=[],D=((Ve=(ie=o.value)==null?void 0:ie.title)==null?void 0:Ve.trim())||"Untitled thread";b.push(`# ${Se(D)}`),b.push(""),b.push(`- Exported: ${new Date().toISOString()}`),b.push(`- Thread ID: ${((ct=o.value)==null?void 0:ct.id)??""}`),b.push(""),b.push("---"),b.push("");for(const Ge of jn.value){const Le=Ge.role?Ge.role.toUpperCase():"MESSAGE";b.push(`## ${Le}`),b.push("");const Vn=Ge.text.trim();if(Vn&&(b.push(Vn),b.push("")),Ge.commandExecution&&(b.push("```text"),b.push(`command: ${Ge.commandExecution.command}`),b.push(`status: ${Ge.commandExecution.status}`),Ge.commandExecution.cwd&&b.push(`cwd: ${Ge.commandExecution.cwd}`),Ge.commandExecution.exitCode!==null&&b.push(`exitCode: ${Ge.commandExecution.exitCode}`),b.push(Ge.commandExecution.aggregatedOutput||"(no output)"),b.push("```"),b.push("")),Ge.fileAttachments&&Ge.fileAttachments.length>0){b.push("Attachments:");for(const sr of Ge.fileAttachments)b.push(`- ${sr.path}`);b.push("")}if(Ge.images&&Ge.images.length>0){b.push("Images:");for(const sr of Ge.images)b.push(`- ${sr}`);b.push("")}}return`${b.join(`
1454
+ `).trimEnd()}
1455
+ `}function V(){var ct,Ge;const ie=(((Ge=(ct=o.value)==null?void 0:ct.title)==null?void 0:Ge.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",Ve=new Date().toISOString().replace(/[:.]/g,"-");return`${ie}-${Ve}.md`}function Se(b){return b.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Oe(b,D){if(typeof window>"u")return D;const ie=window.localStorage.getItem(b);return ie===null?D:ie==="1"}function Qe(){if(typeof window>"u")return"system";const b=window.localStorage.getItem(gd);return b==="light"||b==="dark"?b:"system"}function c(){return typeof window>"u"?"queue":window.localStorage.getItem(md)==="steer"?"steer":"queue"}function p(){bt.value=!bt.value,window.localStorage.setItem(pd,bt.value?"1":"0")}function y(){rn.value=rn.value==="steer"?"queue":"steer",window.localStorage.setItem(md,rn.value)}function C(){const b=["system","light","dark"],D=b.indexOf(Tt.value);Tt.value=b[(D+1)%b.length],window.localStorage.setItem(gd,Tt.value),H()}function B(){St.value=!St.value,window.localStorage.setItem(vd,St.value?"1":"0")}function H(){const b=document.documentElement;if(Tt.value==="dark")b.classList.add("dark");else if(Tt.value==="light")b.classList.remove("dark");else{const D=window.matchMedia("(prefers-color-scheme: dark)").matches;b.classList.toggle("dark",D)}}function le(){return typeof window>"u"?!1:window.localStorage.getItem(hd)==="1"}function ve(b){typeof window>"u"||window.localStorage.setItem(hd,b?"1":"0")}function pe(b,D){const ie=(b??"").trim();return ie.length>0?ie:D.trim()||"message"}function tt(b){et(b)}async function $t(){await T.isReady(),Ae.name==="thread"&&Ut.value&&Ee(Ut.value),be(),await Te({includeSelectedThreadMessages:!0}),On({silent:!0}),await ta(),J.value=!0,await ks()}function zt(){if(typeof window>"u")return null;try{const b=window.localStorage.getItem(Fa);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 Sn(b){if(typeof window>"u")return;const D=b.trim();if(!D)return;const ie={routeName:"thread",threadId:D,updatedAtIso:new Date().toISOString()};window.localStorage.setItem(Fa,JSON.stringify(ie))}function Ar(){typeof window>"u"||window.localStorage.removeItem(Fa)}async function ta(){if(Ae.name!=="home")return!1;const b=zt(),D=u.value.trim(),ie=(b==null?void 0:b.threadId)??D;return ie?_n.value.has(ie)?(await T.replace({name:"thread",params:{threadId:ie}}),!0):((b==null?void 0:b.threadId)===ie&&Ar(),!1):!1}async function ks(){if(!Z.value){Z.value=!0;try{if(Ae.name==="home"||Ae.name==="skills"){u.value!==""&&await Me("");return}if(Ae.name==="thread"){const b=Ut.value;if(!b)return;if(!_n.value.has(b)){await T.replace({name:"home"});return}u.value!==b?await Me(b):ae(b,{silent:!0});return}}finally{Z.value=!1}}}pt(()=>[Ae.name,Ut.value,u.value,J.value],([b,D,ie,Ve])=>{if(!Ve||b!=="thread")return;const ct=(D||ie).trim();ct&&_n.value.has(ct)&&Sn(ct)}),pt(()=>[Ae.name,Ut.value,K.value,_n.value.has(Ut.value),u.value],async()=>{J.value&&await ks()}),pt(()=>u.value,async b=>{if(J.value&&!Z.value&&!(Ct.value||an.value)){if(!b){Ae.name!=="home"&&await T.replace({name:"home"});return}Ae.name==="thread"&&Ut.value===b||await T.replace({name:"thread",params:{threadId:b}})}}),pt(()=>[J.value,Ae.name,u.value],([b,D,ie])=>{b&&D==="thread"&&ie&&ae(ie,{silent:!0})}),pt(()=>Mn.value,b=>{if(b.length===0){M.value="";return}b.some(ie=>ie.value===M.value)||(M.value=b[0].value),Cr()},{immediate:!0}),pt(()=>M.value,()=>{Q.value={phase:"idle",title:"",message:""},Cr()}),pt(()=>z.value,b=>{b==="local"&&(Q.value={phase:"idle",title:"",message:""})}),pt(()=>Ae.name,b=>{b!=="home"&&(Q.value={phase:"idle",title:"",message:""})}),pt(()=>u.value,()=>{Q.value={phase:"idle",title:"",message:""}}),pt(S,b=>{b&&!G.value&&ot(!0)});async function po(b,D=[],ie=[],Ve=[]){try{Q.value={phase:"idle",title:"",message:""};let ct=M.value;if(z.value==="worktree"){Q.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Le=await v0(M.value);ct=Le.cwd,M.value=Le.cwd,Q.value={phase:"idle",title:"",message:""}}catch{Q.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const Ge=await ze(b,ct,D,ie,Ve);if(!Ge)return;await T.replace({name:"thread",params:{threadId:Ge}}),ws()}catch{}}return(b,D)=>(w(),k(De,null,[je(Wv,{"is-sidebar-collapsed":G.value,onCloseSidebar:D[6]||(D[6]=ie=>ot(!0))},{sidebar:At(()=>[v("section",ZA,[v("div",ex,[G.value?fe("",!0):(w(),_t(cd,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":G.value,"show-new-thread-button":!0,onToggleSidebar:D[0]||(D[0]=ie=>ot(!G.value)),onStartNewThread:Xr},{default:At(()=>[v("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":ye.value,"aria-label":"Search threads",title:"Search threads",onClick:qn},[je(ll,{class:"sidebar-search-toggle-icon"})],8,tx)]),_:1},8,["is-sidebar-collapsed"])),!G.value&&ye.value?(w(),k("div",nx,[je(ll,{class:"sidebar-search-bar-icon"}),Wr(v("input",{ref_key:"sidebarSearchInputRef",ref:Ce,"onUpdate:modelValue":D[1]||(D[1]=ie=>Ie.value=ie),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:Fn},null,544),[[Vr,Ie.value]]),Ie.value.length>0?(w(),k("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:Qt},[je(ql,{class:"sidebar-search-clear-icon"})])):fe("",!0)])):fe("",!0),G.value?fe("",!0):(w(),k("button",{key:2,class:rt(["sidebar-skills-link",{"is-active":an.value}]),type:"button",onClick:D[2]||(D[2]=ie=>{_e(T).push({name:"skills"}),_e(S)&&ot(!0)})}," Skills Hub ",2)),G.value?fe("",!0):(w(),_t(Aw,{key:3,groups:_e(r),"project-display-name-by-id":_e(s),"selected-thread-id":_e(u),"is-loading":_e(K),"search-query":Ie.value,"search-matched-thread-ids":xe.value,onSelect:tr,onArchive:rr,onStartNewThread:Qr,onRenameProject:hn,onBrowseProjectFiles:Ir,onRenameThread:ys,onRemoveProject:I,onReorderProject:R,onExportThread:Gn},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),G.value?fe("",!0):(w(),k("div",rx,[je(Of,{name:"settings-panel"},{default:At(()=>[kt.value?(w(),k("div",sx,[v("div",ox,[v("div",ix,[v("div",ax,[D[7]||(D[7]=v("span",{class:"sidebar-settings-account-title"},"Accounts",-1)),v("span",lx,Y(vt.value.length),1)]),v("button",{class:"sidebar-settings-account-refresh",type:"button",disabled:Mt.value||Ye.value,onClick:Yr},Y(Mt.value?"Reloading…":"Reload"),9,cx)]),dt.value?(w(),k("p",ux,Y(dt.value),1)):fe("",!0),vt.value.length===0?(w(),k("p",dx," Run `codex login`, then click reload. ")):(w(),k("div",fx,[(w(!0),k(De,null,yt(vt.value,ie=>(w(),k("article",{key:ie.accountId,class:rt(["sidebar-settings-account-item",{"is-active":ie.isActive,"is-unavailable":kn(ie),"is-confirming-remove":F(ie),"is-remove-visible":oe(ie)}]),title:Hn(ie),onMouseenter:Ve=>ft(ie.accountId),onMouseleave:Ve=>ht(ie.accountId)},[v("div",px,[v("p",mx,Y(ie.email||"Account"),1),v("p",gx,Y(Bn(ie)),1),v("p",vx,Y(Un(ie)),1),v("p",yx," Workspace "+Y(Kn(ie.accountId)),1)]),v("div",wx,[v("button",{class:"sidebar-settings-account-switch",type:"button",disabled:x(ie)||ie.isActive||kn(ie),onClick:Ve=>nr(ie.accountId)},Y(Fe(ie)),9,bx),v("button",{class:rt(["sidebar-settings-account-remove",{"is-visible":oe(ie),"is-confirming":F(ie)}]),type:"button",disabled:x(ie),onClick:Ve=>vs(ie.accountId)},Y(it(ie)),11,_x)])],42,hx))),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:rt(["sidebar-settings-toggle",{"is-on":!bt.value}])},null,2)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:y},[D[9]||(D[9]=v("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),v("span",kx,Y(rn.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",Tx,Y(Tt.value==="system"?"System":Tt.value==="dark"?"Dark":"Light"),1)]),v("button",{class:"sidebar-settings-row",type:"button",onClick:B},[D[11]||(D[11]=v("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),v("span",{class:rt(["sidebar-settings-toggle",{"is-on":St.value}])},null,2)])])):fe("",!0)]),_:1}),v("button",{class:"sidebar-settings-button",type:"button",onClick:D[3]||(D[3]=ie=>kt.value=!kt.value)},[je(kA,{class:"sidebar-settings-icon"}),D[12]||(D[12]=v("span",null,"Settings",-1))])]))])]),content:At(()=>[v("section",Sx,[je(Ow,{title:en.value},{leading:At(()=>[G.value||_e(S)?(w(),_t(cd,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":G.value,"show-new-thread-button":!0,onToggleSidebar:D[4]||(D[4]=ie=>ot(!G.value)),onStartNewThread:Xr},null,8,["is-sidebar-collapsed"])):fe("",!0)]),_:1},8,["title"]),v("section",Ix,[an.value?(w(),_t(aA,{key:0,onSkillsChanged:$e})):Ct.value?(w(),k("div",Ex,[v("div",Cx,[D[13]||(D[13]=v("p",{class:"new-thread-hero"},"Let's build",-1)),je(al,{class:"new-thread-folder-dropdown","model-value":M.value,options:Mn.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":lt.value,"add-placeholder":"Project name or absolute path",disabled:!1,"onUpdate:modelValue":fo,onAdd:Zr},null,8,["model-value","options","default-add-value"]),je(hS,{class:"new-thread-runtime-dropdown",modelValue:z.value,"onUpdate:modelValue":D[5]||(D[5]=ie=>z.value=ie)},null,8,["modelValue"]),Q.value.phase!=="idle"?(w(),k("div",{key:0,class:rt(["worktree-init-status",{"is-running":Q.value.phase==="running","is-error":Q.value.phase==="error"}])},[v("strong",Ax,Y(Q.value.title),1),v("span",xx,Y(Q.value.message),1)],2)):fe("",!0)]),je(Ou,{"active-thread-id":sn.value,cwd:er.value,"collaboration-modes":_e(g),"selected-collaboration-mode":_e(E),models:_e(_),"selected-model":_e(U),"selected-reasoning-effort":_e($),skills:_e(X),"codex-quota":_e(f),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":bt.value,"in-progress-submit-mode":rn.value,"dictation-click-to-toggle":St.value,onSubmit:Jn,"onUpdate:selectedCollaborationMode":tt,"onUpdate:selectedModel":h,"onUpdate:selectedReasoningEffort":A},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"])])):(w(),k("div",Rx,[v("div",Px,[je(wk,{ref_key:"threadConversationRef",ref:O,messages:jn.value,"is-loading":_e(ee),"active-thread-id":sn.value,cwd:er.value,"scroll-state":_e(i),"live-overlay":dn.value,"pending-requests":_e(a),onUpdateScrollState:N,onForkThread:Ue,onRespondServerRequest:ne},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests"])]),v("div",Mx,[je(oS,{messages:_e(He),onSteer:_e(nt),onDelete:_e(Pe)},null,8,["messages","onSteer","onDelete"]),je(Ou,{"active-thread-id":sn.value,cwd:er.value,"collaboration-modes":_e(g),"selected-collaboration-mode":_e(E),models:_e(_),"selected-model":_e(U),"selected-reasoning-effort":_e($),skills:_e(X),"codex-quota":_e(f),"is-turn-in-progress":fn.value,"is-interrupting-turn":_e(we),"has-queue-above":_e(He).length>0,"send-with-enter":bt.value,"in-progress-submit-mode":rn.value,"dictation-click-to-toggle":St.value,"onUpdate:selectedCollaborationMode":tt,onSubmit:Jn,"onUpdate:selectedModel":h,"onUpdate:selectedReasoningEffort":A,onInterrupt:L},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",$x," nervmor "+Y(_e(t))+" · v"+Y(_e(n)),1)],64))}}),Lx=wt(Nx,[["__scopeId","data-v-0dfb0d19"]]),Ba={render:()=>null},Dx=Nv({history:hv(),routes:[{path:"/",name:"home",component:Ba},{path:"/thread/:threadId",name:"thread",component:Ba},{path:"/skills",name:"skills",component:Ba},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexui. npm: https://www.npmjs.com/package/@nervmor/codexui");Eg(Lx).use(Dx).mount("#app");"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/sw.js").catch(e=>{console.error("Service worker registration failed.",e)})});