codexapp 0.1.57 → 0.1.58
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,1429 @@
|
|
|
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.31
|
|
3
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
|
+
* @license MIT
|
|
5
|
+
**/function hl(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const St={},bs=[],sr=()=>{},ld=()=>!1,Ti=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Si=e=>e.startsWith("onUpdate:"),Ht=Object.assign,pl=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},jh=Object.prototype.hasOwnProperty,vt=(e,t)=>jh.call(e,t),Ge=Array.isArray,_s=e=>ko(e)==="[object Map]",cd=e=>ko(e)==="[object Set]",Jl=e=>ko(e)==="[object Date]",Ke=e=>typeof e=="function",Ot=e=>typeof e=="string",Vn=e=>typeof e=="symbol",yt=e=>e!==null&&typeof e=="object",ud=e=>(yt(e)||Ke(e))&&Ke(e.then)&&Ke(e.catch),dd=Object.prototype.toString,ko=e=>dd.call(e),Uh=e=>ko(e).slice(8,-1),fd=e=>ko(e)==="[object Object]",ml=e=>Ot(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Xs=hl(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Ii=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Fh=/-\w/g,yn=Ii(e=>e.replace(Fh,t=>t.slice(1).toUpperCase())),Bh=/\B([A-Z])/g,Hr=Ii(e=>e.replace(Bh,"-$1").toLowerCase()),Ei=Ii(e=>e.charAt(0).toUpperCase()+e.slice(1)),Zi=Ii(e=>e?`on${Ei(e)}`:""),er=(e,t)=>!Object.is(e,t),Yo=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},hd=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},gl=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Hh=e=>{const t=Ot(e)?Number(e):NaN;return isNaN(t)?e:t};let Yl;const Ci=()=>Yl||(Yl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function Fr(e){if(Ge(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],s=Ot(r)?Gh(r):Fr(r);if(s)for(const o in s)t[o]=s[o]}return t}else if(Ot(e)||yt(e))return e}const Wh=/;(?![^(]*\))/g,Vh=/:([^]+)/,zh=/\/\*[^]*?\*\//g;function Gh(e){const t={};return e.replace(zh,"").split(Wh).forEach(n=>{if(n){const r=n.split(Vh);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function st(e){let t="";if(Ot(e))t=e;else if(Ge(e))for(let n=0;n<e.length;n++){const r=st(e[n]);r&&(t+=r+" ")}else if(yt(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}const qh="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Kh=hl(qh);function pd(e){return!!e||e===""}function Jh(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=vl(e[r],t[r]);return n}function vl(e,t){if(e===t)return!0;let n=Jl(e),r=Jl(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Vn(e),r=Vn(t),n||r)return e===t;if(n=Ge(e),r=Ge(t),n||r)return n&&r?Jh(e,t):!1;if(n=yt(e),r=yt(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||!vl(e[i],t[i]))return!1}}return String(e)===String(t)}const md=e=>!!(e&&e.__v_isRef===!0),le=e=>Ot(e)?e:e==null?"":Ge(e)||yt(e)&&(e.toString===dd||!Ke(e.toString))?md(e)?le(e.value):JSON.stringify(e,gd,2):String(e),gd=(e,t)=>md(t)?gd(e,t.value):_s(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,s],o)=>(n[ea(r,o)+" =>"]=s,n),{})}:cd(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>ea(n))}:Vn(t)?ea(t):yt(t)&&!Ge(t)&&!fd(t)?String(t):t,ea=(e,t="")=>{var n;return Vn(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};/**
|
|
6
|
+
* @vue/reactivity v3.5.31
|
|
7
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
8
|
+
* @license MIT
|
|
9
|
+
**/let Sn;class Yh{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=Sn,!t&&Sn&&(this.index=(Sn.scopes||(Sn.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=Sn;try{return Sn=this,t()}finally{Sn=n}}}on(){++this._on===1&&(this.prevScope=Sn,Sn=this)}off(){this._on>0&&--this._on===0&&(Sn=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 Xh(){return Sn}let Et;const ta=new WeakSet;class vd{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,Sn&&Sn.active&&Sn.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ta.has(this)&&(ta.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||wd(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Xl(this),bd(this);const t=Et,n=Bn;Et=this,Bn=!0;try{return this.fn()}finally{_d(this),Et=t,Bn=n,this.flags&=-3}}stop(){if(this.flags&1){for(let t=this.deps;t;t=t.nextDep)bl(t);this.deps=this.depsTail=void 0,Xl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ta.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Oa(this)&&this.run()}get dirty(){return Oa(this)}}let yd=0,Qs,Zs;function wd(e,t=!1){if(e.flags|=8,t){e.next=Zs,Zs=e;return}e.next=Qs,Qs=e}function yl(){yd++}function wl(){if(--yd>0)return;if(Zs){let t=Zs;for(Zs=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;Qs;){let t=Qs;for(Qs=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 bd(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function _d(e){let t,n=e.depsTail,r=n;for(;r;){const s=r.prevDep;r.version===-1?(r===n&&(n=s),bl(r),Qh(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=s}e.deps=t,e.depsTail=n}function Oa(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(kd(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function kd(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===ao)||(e.globalVersion=ao,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Oa(e))))return;e.flags|=2;const t=e.dep,n=Et,r=Bn;Et=e,Bn=!0;try{bd(e);const s=e.fn(e._value);(t.version===0||er(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{Et=n,Bn=r,_d(e),e.flags&=-3}}function bl(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)bl(o,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Qh(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}let Bn=!0;const Td=[];function br(){Td.push(Bn),Bn=!1}function _r(){const e=Td.pop();Bn=e===void 0?!0:e}function Xl(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Et;Et=void 0;try{t()}finally{Et=n}}}let ao=0;class Zh{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class _l{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(!Et||!Bn||Et===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Et)n=this.activeLink=new Zh(Et,this),Et.deps?(n.prevDep=Et.depsTail,Et.depsTail.nextDep=n,Et.depsTail=n):Et.deps=Et.depsTail=n,Sd(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=Et.depsTail,n.nextDep=void 0,Et.depsTail.nextDep=n,Et.depsTail=n,Et.deps===n&&(Et.deps=r)}return n}trigger(t){this.version++,ao++,this.notify(t)}notify(t){yl();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{wl()}}}function Sd(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)Sd(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const Na=new WeakMap,is=Symbol(""),Da=Symbol(""),lo=Symbol("");function on(e,t,n){if(Bn&&Et){let r=Na.get(e);r||Na.set(e,r=new Map);let s=r.get(n);s||(r.set(n,s=new _l),s.map=r,s.key=n),s.track()}}function mr(e,t,n,r,s,o){const i=Na.get(e);if(!i){ao++;return}const a=l=>{l&&l.trigger()};if(yl(),t==="clear")i.forEach(a);else{const l=Ge(e),u=l&&ml(n);if(l&&n==="length"){const c=Number(r);i.forEach((f,m)=>{(m==="length"||m===lo||!Vn(m)&&m>=c)&&a(f)})}else switch((n!==void 0||i.has(void 0))&&a(i.get(n)),u&&a(i.get(lo)),t){case"add":l?u&&a(i.get("length")):(a(i.get(is)),_s(e)&&a(i.get(Da)));break;case"delete":l||(a(i.get(is)),_s(e)&&a(i.get(Da)));break;case"set":_s(e)&&a(i.get(is));break}}wl()}function ps(e){const t=ht(e);return t===e?t:(on(t,"iterate",lo),jn(e)?t:t.map(zn))}function Ai(e){return on(e=ht(e),"iterate",lo),e}function Qn(e,t){return kr(e)?xs(as(e)?zn(t):t):zn(t)}const ep={__proto__:null,[Symbol.iterator](){return na(this,Symbol.iterator,e=>Qn(this,e))},concat(...e){return ps(this).concat(...e.map(t=>Ge(t)?ps(t):t))},entries(){return na(this,"entries",e=>(e[1]=Qn(this,e[1]),e))},every(e,t){return cr(this,"every",e,t,void 0,arguments)},filter(e,t){return cr(this,"filter",e,t,n=>n.map(r=>Qn(this,r)),arguments)},find(e,t){return cr(this,"find",e,t,n=>Qn(this,n),arguments)},findIndex(e,t){return cr(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return cr(this,"findLast",e,t,n=>Qn(this,n),arguments)},findLastIndex(e,t){return cr(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return cr(this,"forEach",e,t,void 0,arguments)},includes(...e){return ra(this,"includes",e)},indexOf(...e){return ra(this,"indexOf",e)},join(e){return ps(this).join(e)},lastIndexOf(...e){return ra(this,"lastIndexOf",e)},map(e,t){return cr(this,"map",e,t,void 0,arguments)},pop(){return Vs(this,"pop")},push(...e){return Vs(this,"push",e)},reduce(e,...t){return Ql(this,"reduce",e,t)},reduceRight(e,...t){return Ql(this,"reduceRight",e,t)},shift(){return Vs(this,"shift")},some(e,t){return cr(this,"some",e,t,void 0,arguments)},splice(...e){return Vs(this,"splice",e)},toReversed(){return ps(this).toReversed()},toSorted(e){return ps(this).toSorted(e)},toSpliced(...e){return ps(this).toSpliced(...e)},unshift(...e){return Vs(this,"unshift",e)},values(){return na(this,"values",e=>Qn(this,e))}};function na(e,t,n){const r=Ai(e),s=r[t]();return r!==e&&!jn(e)&&(s._next=s.next,s.next=()=>{const o=s._next();return o.done||(o.value=n(o.value)),o}),s}const tp=Array.prototype;function cr(e,t,n,r,s,o){const i=Ai(e),a=i!==e&&!jn(e),l=i[t];if(l!==tp[t]){const f=l.apply(e,o);return a?zn(f):f}let u=n;i!==e&&(a?u=function(f,m){return n.call(this,Qn(e,f),m,e)}:n.length>2&&(u=function(f,m){return n.call(this,f,m,e)}));const c=l.call(i,u,r);return a&&s?s(c):c}function Ql(e,t,n,r){const s=Ai(e),o=s!==e&&!jn(e);let i=n,a=!1;s!==e&&(o?(a=r.length===0,i=function(u,c,f){return a&&(a=!1,u=Qn(e,u)),n.call(this,u,Qn(e,c),f,e)}):n.length>3&&(i=function(u,c,f){return n.call(this,u,c,f,e)}));const l=s[t](i,...r);return a?Qn(e,l):l}function ra(e,t,n){const r=ht(e);on(r,"iterate",lo);const s=r[t](...n);return(s===-1||s===!1)&&Sl(n[0])?(n[0]=ht(n[0]),r[t](...n)):s}function Vs(e,t,n=[]){br(),yl();const r=ht(e)[t].apply(e,n);return wl(),_r(),r}const np=hl("__proto__,__v_isRef,__isVue"),Id=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Vn));function rp(e){Vn(e)||(e=String(e));const t=ht(this);return on(t,"has",e),t.hasOwnProperty(e)}class Ed{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,r){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,o=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return o;if(n==="__v_raw")return r===(s?o?hp:Rd:o?xd:Ad).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(r)?t:void 0;const i=Ge(t);if(!s){let l;if(i&&(l=ep[n]))return l;if(n==="hasOwnProperty")return rp}const a=Reflect.get(t,n,cn(t)?t:r);if((Vn(n)?Id.has(n):np(n))||(s||on(t,"get",n),o))return a;if(cn(a)){const l=i&&ml(n)?a:a.value;return s&&yt(l)?ja(l):l}return yt(a)?s?ja(a):xi(a):a}}class Cd extends Ed{constructor(t=!1){super(!1,t)}set(t,n,r,s){let o=t[n];const i=Ge(t)&&ml(n);if(!this._isShallow){const u=kr(o);if(!jn(r)&&!kr(r)&&(o=ht(o),r=ht(r)),!i&&cn(o)&&!cn(r))return u||(o.value=r),!0}const a=i?Number(n)<t.length:vt(t,n),l=Reflect.set(t,n,r,cn(t)?t:s);return t===ht(s)&&(a?er(r,o)&&mr(t,"set",n,r):mr(t,"add",n,r)),l}deleteProperty(t,n){const r=vt(t,n);t[n];const s=Reflect.deleteProperty(t,n);return s&&r&&mr(t,"delete",n,void 0),s}has(t,n){const r=Reflect.has(t,n);return(!Vn(n)||!Id.has(n))&&on(t,"has",n),r}ownKeys(t){return on(t,"iterate",Ge(t)?"length":is),Reflect.ownKeys(t)}}class sp extends Ed{constructor(t=!1){super(!0,t)}set(t,n){return!0}deleteProperty(t,n){return!0}}const op=new Cd,ip=new sp,ap=new Cd(!0);const La=e=>e,Bo=e=>Reflect.getPrototypeOf(e);function lp(e,t,n){return function(...r){const s=this.__v_raw,o=ht(s),i=_s(o),a=e==="entries"||e===Symbol.iterator&&i,l=e==="keys"&&i,u=s[e](...r),c=n?La:t?xs:zn;return!t&&on(o,"iterate",l?Da:is),Ht(Object.create(u),{next(){const{value:f,done:m}=u.next();return m?{value:f,done:m}:{value:a?[c(f[0]),c(f[1])]:c(f),done:m}}})}}function Ho(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function cp(e,t){const n={get(s){const o=this.__v_raw,i=ht(o),a=ht(s);e||(er(s,a)&&on(i,"get",s),on(i,"get",a));const{has:l}=Bo(i),u=t?La:e?xs:zn;if(l.call(i,s))return u(o.get(s));if(l.call(i,a))return u(o.get(a));o!==i&&o.get(s)},get size(){const s=this.__v_raw;return!e&&on(ht(s),"iterate",is),s.size},has(s){const o=this.__v_raw,i=ht(o),a=ht(s);return e||(er(s,a)&&on(i,"has",s),on(i,"has",a)),s===a?o.has(s):o.has(s)||o.has(a)},forEach(s,o){const i=this,a=i.__v_raw,l=ht(a),u=t?La:e?xs:zn;return!e&&on(l,"iterate",is),a.forEach((c,f)=>s.call(o,u(c),u(f),i))}};return Ht(n,e?{add:Ho("add"),set:Ho("set"),delete:Ho("delete"),clear:Ho("clear")}:{add(s){const o=ht(this),i=Bo(o),a=ht(s),l=!t&&!jn(s)&&!kr(s)?a:s;return i.has.call(o,l)||er(s,l)&&i.has.call(o,s)||er(a,l)&&i.has.call(o,a)||(o.add(l),mr(o,"add",l,l)),this},set(s,o){!t&&!jn(o)&&!kr(o)&&(o=ht(o));const i=ht(this),{has:a,get:l}=Bo(i);let u=a.call(i,s);u||(s=ht(s),u=a.call(i,s));const c=l.call(i,s);return i.set(s,o),u?er(o,c)&&mr(i,"set",s,o):mr(i,"add",s,o),this},delete(s){const o=ht(this),{has:i,get:a}=Bo(o);let l=i.call(o,s);l||(s=ht(s),l=i.call(o,s)),a&&a.call(o,s);const u=o.delete(s);return l&&mr(o,"delete",s,void 0),u},clear(){const s=ht(this),o=s.size!==0,i=s.clear();return o&&mr(s,"clear",void 0,void 0),i}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=lp(s,e,t)}),n}function kl(e,t){const n=cp(e,t);return(r,s,o)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?r:Reflect.get(vt(n,s)&&s in r?n:r,s,o)}const up={get:kl(!1,!1)},dp={get:kl(!1,!0)},fp={get:kl(!0,!1)};const Ad=new WeakMap,xd=new WeakMap,Rd=new WeakMap,hp=new WeakMap;function pp(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function mp(e){return e.__v_skip||!Object.isExtensible(e)?0:pp(Uh(e))}function xi(e){return kr(e)?e:Tl(e,!1,op,up,Ad)}function Pd(e){return Tl(e,!1,ap,dp,xd)}function ja(e){return Tl(e,!0,ip,fp,Rd)}function Tl(e,t,n,r,s){if(!yt(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 as(e){return kr(e)?as(e.__v_raw):!!(e&&e.__v_isReactive)}function kr(e){return!!(e&&e.__v_isReadonly)}function jn(e){return!!(e&&e.__v_isShallow)}function Sl(e){return e?!!e.__v_raw:!1}function ht(e){const t=e&&e.__v_raw;return t?ht(t):e}function gp(e){return!vt(e,"__v_skip")&&Object.isExtensible(e)&&hd(e,"__v_skip",!0),e}const zn=e=>yt(e)?xi(e):e,xs=e=>yt(e)?ja(e):e;function cn(e){return e?e.__v_isRef===!0:!1}function O(e){return Md(e,!1)}function vp(e){return Md(e,!0)}function Md(e,t){return cn(e)?e:new yp(e,t)}class yp{constructor(t,n){this.dep=new _l,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:ht(t),this._value=n?t:zn(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,r=this.__v_isShallow||jn(t)||kr(t);t=r?t:ht(t),er(t,n)&&(this._rawValue=t,this._value=r?t:zn(t),this.dep.trigger())}}function be(e){return cn(e)?e.value:e}const wp={get:(e,t,n)=>t==="__v_raw"?e:be(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const s=e[t];return cn(s)&&!cn(n)?(s.value=n,!0):Reflect.set(e,t,n,r)}};function $d(e){return as(e)?e:new Proxy(e,wp)}class bp{constructor(t,n,r){this.fn=t,this.setter=n,this._value=void 0,this.dep=new _l(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ao-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Et!==this)return wd(this,!0),!0}get value(){const t=this.dep.track();return kd(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function _p(e,t,n=!1){let r,s;return Ke(e)?r=e:(r=e.get,s=e.set),new bp(r,s,n)}const Wo={},ii=new WeakMap;let es;function kp(e,t=!1,n=es){if(n){let r=ii.get(n);r||ii.set(n,r=[]),r.push(e)}}function Tp(e,t,n=St){const{immediate:r,deep:s,once:o,scheduler:i,augmentJob:a,call:l}=n,u=F=>s?F:jn(F)||s===!1||s===0?gr(F,1):gr(F);let c,f,m,S,D=!1,H=!1;if(cn(e)?(f=()=>e.value,D=jn(e)):as(e)?(f=()=>u(e),D=!0):Ge(e)?(H=!0,D=e.some(F=>as(F)||jn(F)),f=()=>e.map(F=>{if(cn(F))return F.value;if(as(F))return u(F);if(Ke(F))return l?l(F,2):F()})):Ke(e)?t?f=l?()=>l(e,2):e:f=()=>{if(m){br();try{m()}finally{_r()}}const F=es;es=c;try{return l?l(e,3,[S]):e(S)}finally{es=F}}:f=sr,t&&s){const F=f,X=s===!0?1/0:s;f=()=>gr(F(),X)}const ee=Xh(),A=()=>{c.stop(),ee&&ee.active&&pl(ee.effects,c)};if(o&&t){const F=t;t=(...X)=>{F(...X),A()}}let R=H?new Array(e.length).fill(Wo):Wo;const B=F=>{if(!(!(c.flags&1)||!c.dirty&&!F))if(t){const X=c.run();if(s||D||(H?X.some((ae,ve)=>er(ae,R[ve])):er(X,R))){m&&m();const ae=es;es=c;try{const ve=[X,R===Wo?void 0:H&&R[0]===Wo?[]:R,S];R=X,l?l(t,3,ve):t(...ve)}finally{es=ae}}}else c.run()};return a&&a(B),c=new vd(f),c.scheduler=i?()=>i(B,!1):B,S=F=>kp(F,!1,c),m=c.onStop=()=>{const F=ii.get(c);if(F){if(l)l(F,4);else for(const X of F)X();ii.delete(c)}},t?r?B(!0):R=c.run():i?i(B.bind(null,!0),!0):c.run(),A.pause=c.pause.bind(c),A.resume=c.resume.bind(c),A.stop=A,A}function gr(e,t=1/0,n){if(t<=0||!yt(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,cn(e))gr(e.value,t,n);else if(Ge(e))for(let r=0;r<e.length;r++)gr(e[r],t,n);else if(cd(e)||_s(e))e.forEach(r=>{gr(r,t,n)});else if(fd(e)){for(const r in e)gr(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&gr(e[r],t,n)}return e}/**
|
|
10
|
+
* @vue/runtime-core v3.5.31
|
|
11
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
12
|
+
* @license MIT
|
|
13
|
+
**/function To(e,t,n,r){try{return r?e(...r):e()}catch(s){Ri(s,t,n)}}function Gn(e,t,n,r){if(Ke(e)){const s=To(e,t,n,r);return s&&ud(s)&&s.catch(o=>{Ri(o,t,n)}),s}if(Ge(e)){const s=[];for(let o=0;o<e.length;o++)s.push(Gn(e[o],t,n,r));return s}}function Ri(e,t,n,r=!0){const s=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:i}=t&&t.appContext.config||St;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let f=0;f<c.length;f++)if(c[f](e,l,u)===!1)return}a=a.parent}if(o){br(),To(o,null,10,[e,l,u]),_r();return}}Sp(e,n,s,r,i)}function Sp(e,t,n,r=!0,s=!1){if(s)throw e;console.error(e)}const gn=[];let Yn=-1;const ks=[];let $r=null,gs=0;const Od=Promise.resolve();let ai=null;function Xt(e){const t=ai||Od;return e?t.then(this?e.bind(this):e):t}function Ip(e){let t=Yn+1,n=gn.length;for(;t<n;){const r=t+n>>>1,s=gn[r],o=co(s);o<e||o===e&&s.flags&2?t=r+1:n=r}return t}function Il(e){if(!(e.flags&1)){const t=co(e),n=gn[gn.length-1];!n||!(e.flags&2)&&t>=co(n)?gn.push(e):gn.splice(Ip(t),0,e),e.flags|=1,Nd()}}function Nd(){ai||(ai=Od.then(Ld))}function Ep(e){Ge(e)?ks.push(...e):$r&&e.id===-1?$r.splice(gs+1,0,e):e.flags&1||(ks.push(e),e.flags|=1),Nd()}function Zl(e,t,n=Yn+1){for(;n<gn.length;n++){const r=gn[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;gn.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Dd(e){if(ks.length){const t=[...new Set(ks)].sort((n,r)=>co(n)-co(r));if(ks.length=0,$r){$r.push(...t);return}for($r=t,gs=0;gs<$r.length;gs++){const n=$r[gs];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}$r=null,gs=0}}const co=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Ld(e){try{for(Yn=0;Yn<gn.length;Yn++){const t=gn[Yn];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),To(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Yn<gn.length;Yn++){const t=gn[Yn];t&&(t.flags&=-2)}Yn=-1,gn.length=0,Dd(),ai=null,(gn.length||ks.length)&&Ld()}}let Qt=null,jd=null;function li(e){const t=Qt;return Qt=e,jd=e&&e.type.__scopeId||null,t}function bt(e,t=Qt,n){if(!t||e._n)return e;const r=(...s)=>{r._d&&hi(-1);const o=li(t);let i;try{i=e(...s)}finally{li(o),r._d&&hi(1)}return i};return r._n=!0,r._c=!0,r._d=!0,r}function Tr(e,t){if(Qt===null)return e;const n=Ni(Qt),r=e.dirs||(e.dirs=[]);for(let s=0;s<t.length;s++){let[o,i,a,l=St]=t[s];o&&(Ke(o)&&(o={mounted:o,updated:o}),o.deep&&gr(i),r.push({dir:o,instance:n,value:i,oldValue:void 0,arg:a,modifiers:l}))}return e}function Jr(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(),Gn(l,n,8,[e.el,a,e,t]),_r())}}function Xo(e,t){if(ln){let n=ln.provides;const r=ln.parent&&ln.parent.provides;r===n&&(n=ln.provides=Object.create(r)),n[e]=t}}function Hn(e,t,n=!1){const r=Rl();if(r||Ss){let s=Ss?Ss._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&&Ke(t)?t.call(r&&r.proxy):t}}const Cp=Symbol.for("v-scx"),Ap=()=>Hn(Cp);function at(e,t,n){return Ud(e,t,n)}function Ud(e,t,n=St){const{immediate:r,deep:s,flush:o,once:i}=n,a=Ht({},n),l=t&&r||!t&&o!=="post";let u;if(mo){if(o==="sync"){const S=Ap();u=S.__watcherHandles||(S.__watcherHandles=[])}else if(!l){const S=()=>{};return S.stop=sr,S.resume=sr,S.pause=sr,S}}const c=ln;a.call=(S,D,H)=>Gn(S,c,D,H);let f=!1;o==="post"?a.scheduler=S=>{sn(S,c&&c.suspense)}:o!=="sync"&&(f=!0,a.scheduler=(S,D)=>{D?S():Il(S)}),a.augmentJob=S=>{t&&(S.flags|=4),f&&(S.flags|=2,c&&(S.id=c.uid,S.i=c))};const m=Tp(e,t,a);return mo&&(u?u.push(m):l&&m()),m}function xp(e,t,n){const r=this.proxy,s=Ot(e)?e.includes(".")?Fd(r,e):()=>r[e]:e.bind(r,r);let o;Ke(t)?o=t:(o=t.handler,n=t);const i=Io(this),a=Ud(s,o.bind(r),n);return i(),a}function Fd(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 Bd=Symbol("_vte"),Hd=e=>e.__isTeleport,eo=e=>e&&(e.disabled||e.disabled===""),Rp=e=>e&&(e.defer||e.defer===""),ec=e=>typeof SVGElement<"u"&&e instanceof SVGElement,tc=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ua=(e,t)=>{const n=e&&e.to;return Ot(n)?t?t(n):null:n},Wd={name:"Teleport",__isTeleport:!0,process(e,t,n,r,s,o,i,a,l,u){const{mc:c,pc:f,pbc:m,o:{insert:S,querySelector:D,createText:H,createComment:ee}}=u,A=eo(t.props);let{shapeFlag:R,children:B,dynamicChildren:F}=t;if(e==null){const X=t.el=H(""),ae=t.anchor=H("");S(X,n,r),S(ae,n,r);const ve=(ue,fe)=>{R&16&&c(B,ue,fe,s,o,i,a,l)},ke=()=>{const ue=t.target=Ua(t.props,D),fe=Fa(ue,t,H,S);ue&&(i!=="svg"&&ec(ue)?i="svg":i!=="mathml"&&tc(ue)&&(i="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(ue),A||(ve(ue,fe),Qo(t,!1)))};A&&(ve(n,ae),Qo(t,!0)),Rp(t.props)||o&&o.pendingBranch?(t.el.__isMounted=!1,sn(()=>{t.el.__isMounted===!1&&(ke(),delete t.el.__isMounted)},o)):ke()}else{t.el=e.el,t.targetStart=e.targetStart;const X=t.anchor=e.anchor,ae=t.target=e.target,ve=t.targetAnchor=e.targetAnchor;if(e.el.__isMounted===!1){sn(()=>{Wd.process(e,t,n,r,s,o,i,a,l,u)},o);return}const ke=eo(e.props),ue=ke?n:ae,fe=ke?X:ve;if(i==="svg"||ec(ae)?i="svg":(i==="mathml"||tc(ae))&&(i="mathml"),F?(m(e.dynamicChildren,F,ue,s,o,i,a),Al(e,t,!0)):l||f(e,t,ue,fe,s,o,i,a,!1),A)ke?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):Vo(t,n,X,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const _e=t.target=Ua(t.props,D);_e&&Vo(t,_e,null,u,0)}else ke&&Vo(t,ae,ve,u,1);Qo(t,A)}},remove(e,t,n,{um:r,o:{remove:s}},o){const{shapeFlag:i,children:a,anchor:l,targetStart:u,targetAnchor:c,target:f,props:m}=e;if(f&&(s(u),s(c)),o&&s(l),i&16){const S=o||!eo(m);for(let D=0;D<a.length;D++){const H=a[D];r(H,t,n,S,!!H.dynamicChildren)}}},move:Vo,hydrate:Pp};function Vo(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:u,props:c}=e,f=o===2;if(f&&r(i,t,n),(!f||eo(c))&&l&16)for(let m=0;m<u.length;m++)s(u[m],t,n,2);f&&r(a,t,n)}function Pp(e,t,n,r,s,o,{o:{nextSibling:i,parentNode:a,querySelector:l,insert:u,createText:c}},f){function m(ee,A){let R=A;for(;R;){if(R&&R.nodeType===8){if(R.data==="teleport start anchor")t.targetStart=R;else if(R.data==="teleport anchor"){t.targetAnchor=R,ee._lpa=t.targetAnchor&&i(t.targetAnchor);break}}R=i(R)}}function S(ee,A){A.anchor=f(i(ee),A,a(ee),n,r,s,o)}const D=t.target=Ua(t.props,l),H=eo(t.props);if(D){const ee=D._lpa||D.firstChild;t.shapeFlag&16&&(H?(S(e,t),m(D,ee),t.targetAnchor||Fa(D,t,c,u,a(e)===D?e:null)):(t.anchor=i(e),m(D,ee),t.targetAnchor||Fa(D,t,c,u),f(ee&&i(ee),t,D,n,r,s,o))),Qo(t,H)}else H&&t.shapeFlag&16&&(S(e,t),t.targetStart=e,t.targetAnchor=i(e));return t.anchor&&i(t.anchor)}const ci=Wd;function Qo(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 Fa(e,t,n,r,s=null){const o=t.targetStart=n(""),i=t.targetAnchor=n("");return o[Bd]=i,e&&(r(o,e,s),r(i,e,s)),i}const Xn=Symbol("_leaveCb"),zs=Symbol("_enterCb");function Mp(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return ar(()=>{e.isMounted=!0}),Ar(()=>{e.isUnmounting=!0}),e}const Dn=[Function,Array],Vd={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Dn,onEnter:Dn,onAfterEnter:Dn,onEnterCancelled:Dn,onBeforeLeave:Dn,onLeave:Dn,onAfterLeave:Dn,onLeaveCancelled:Dn,onBeforeAppear:Dn,onAppear:Dn,onAfterAppear:Dn,onAppearCancelled:Dn},zd=e=>{const t=e.subTree;return t.component?zd(t.component):t},$p={name:"BaseTransition",props:Vd,setup(e,{slots:t}){const n=Rl(),r=Mp();return()=>{const s=t.default&&Kd(t.default(),!0);if(!s||!s.length)return;const o=Gd(s),i=ht(e),{mode:a}=i;if(r.isLeaving)return sa(o);const l=nc(o);if(!l)return sa(o);let u=Ba(l,i,r,n,f=>u=f);l.type!==an&&uo(l,u);let c=n.subTree&&nc(n.subTree);if(c&&c.type!==an&&!ns(c,l)&&zd(n).type!==an){let f=Ba(c,i,r,n);if(uo(c,f),a==="out-in"&&l.type!==an)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,c=void 0},sa(o);a==="in-out"&&l.type!==an?f.delayLeave=(m,S,D)=>{const H=qd(r,c);H[String(c.key)]=c,m[Xn]=()=>{S(),m[Xn]=void 0,delete u.delayedLeave,c=void 0},u.delayedLeave=()=>{D(),delete u.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return o}}};function Gd(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==an){t=n;break}}return t}const Op=$p;function qd(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 Ba(e,t,n,r,s){const{appear:o,mode:i,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:c,onEnterCancelled:f,onBeforeLeave:m,onLeave:S,onAfterLeave:D,onLeaveCancelled:H,onBeforeAppear:ee,onAppear:A,onAfterAppear:R,onAppearCancelled:B}=t,F=String(e.key),X=qd(n,e),ae=(ue,fe)=>{ue&&Gn(ue,r,9,fe)},ve=(ue,fe)=>{const _e=fe[1];ae(ue,fe),Ge(ue)?ue.every(z=>z.length<=1)&&_e():ue.length<=1&&_e()},ke={mode:i,persisted:a,beforeEnter(ue){let fe=l;if(!n.isMounted)if(o)fe=ee||l;else return;ue[Xn]&&ue[Xn](!0);const _e=X[F];_e&&ns(e,_e)&&_e.el[Xn]&&_e.el[Xn](),ae(fe,[ue])},enter(ue){if(X[F]===e)return;let fe=u,_e=c,z=f;if(!n.isMounted)if(o)fe=A||u,_e=R||c,z=B||f;else return;let Te=!1;ue[zs]=Ue=>{Te||(Te=!0,Ue?ae(z,[ue]):ae(_e,[ue]),ke.delayedLeave&&ke.delayedLeave(),ue[zs]=void 0)};const Ne=ue[zs].bind(null,!1);fe?ve(fe,[ue,Ne]):Ne()},leave(ue,fe){const _e=String(e.key);if(ue[zs]&&ue[zs](!0),n.isUnmounting)return fe();ae(m,[ue]);let z=!1;ue[Xn]=Ne=>{z||(z=!0,fe(),Ne?ae(H,[ue]):ae(D,[ue]),ue[Xn]=void 0,X[_e]===e&&delete X[_e])};const Te=ue[Xn].bind(null,!1);X[_e]=e,S?ve(S,[ue,Te]):Te()},clone(ue){const fe=Ba(ue,t,n,r,s);return s&&s(fe),fe}};return ke}function sa(e){if(Pi(e))return e=Br(e),e.children=null,e}function nc(e){if(!Pi(e))return Hd(e.type)&&e.children?Gd(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&&Ke(n.default))return n.default()}}function uo(e,t){e.shapeFlag&6&&e.component?(e.transition=t,uo(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 Kd(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===Ve?(i.patchFlag&128&&s++,r=r.concat(Kd(i.children,t,a))):(t||i.type!==an)&&r.push(a!=null?Br(i,{key:a}):i)}if(s>1)for(let o=0;o<r.length;o++)r[o].patchFlag=-2;return r}function Wt(e,t){return Ke(e)?Ht({name:e.name},t,{setup:e}):e}function Jd(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function rc(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const ui=new WeakMap;function to(e,t,n,r,s=!1){if(Ge(e)){e.forEach((H,ee)=>to(H,t&&(Ge(t)?t[ee]:t),n,r,s));return}if(Ts(r)&&!s){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&to(e,t,n,r.component.subTree);return}const o=r.shapeFlag&4?Ni(r.component):r.el,i=s?null:o,{i:a,r:l}=e,u=t&&t.r,c=a.refs===St?a.refs={}:a.refs,f=a.setupState,m=ht(f),S=f===St?ld:H=>rc(c,H)?!1:vt(m,H),D=(H,ee)=>!(ee&&rc(c,ee));if(u!=null&&u!==l){if(sc(t),Ot(u))c[u]=null,S(u)&&(f[u]=null);else if(cn(u)){const H=t;D(u,H.k)&&(u.value=null),H.k&&(c[H.k]=null)}}if(Ke(l))To(l,a,12,[i,c]);else{const H=Ot(l),ee=cn(l);if(H||ee){const A=()=>{if(e.f){const R=H?S(l)?f[l]:c[l]:D()||!e.k?l.value:c[e.k];if(s)Ge(R)&&pl(R,o);else if(Ge(R))R.includes(o)||R.push(o);else if(H)c[l]=[o],S(l)&&(f[l]=c[l]);else{const B=[o];D(l,e.k)&&(l.value=B),e.k&&(c[e.k]=B)}}else H?(c[l]=i,S(l)&&(f[l]=i)):ee&&(D(l,e.k)&&(l.value=i),e.k&&(c[e.k]=i))};if(i){const R=()=>{A(),ui.delete(e)};R.id=-1,ui.set(e,R),sn(R,n)}else sc(e),A()}}}function sc(e){const t=ui.get(e);t&&(t.flags|=8,ui.delete(e))}Ci().requestIdleCallback;Ci().cancelIdleCallback;const Ts=e=>!!e.type.__asyncLoader,Pi=e=>e.type.__isKeepAlive;function Np(e,t){Yd(e,"a",t)}function Dp(e,t){Yd(e,"da",t)}function Yd(e,t,n=ln){const r=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(Mi(t,r,n),n){let s=n.parent;for(;s&&s.parent;)Pi(s.parent.vnode)&&Lp(r,t,n,s),s=s.parent}}function Lp(e,t,n,r){const s=Mi(t,e,r,!0);So(()=>{pl(r[t],s)},n)}function Mi(e,t,n=ln,r=!1){if(n){const s=n[e]||(n[e]=[]),o=t.__weh||(t.__weh=(...i)=>{br();const a=Io(n),l=Gn(t,n,e,i);return a(),_r(),l});return r?s.unshift(o):s.push(o),o}}const Cr=e=>(t,n=ln)=>{(!mo||e==="sp")&&Mi(e,(...r)=>t(...r),n)},jp=Cr("bm"),ar=Cr("m"),Up=Cr("bu"),Fp=Cr("u"),Ar=Cr("bum"),So=Cr("um"),Bp=Cr("sp"),Hp=Cr("rtg"),Wp=Cr("rtc");function Vp(e,t=ln){Mi("ec",e,t)}const zp="components",Xd=Symbol.for("v-ndc");function di(e){return Ot(e)?Gp(zp,e,!1)||e:e||Xd}function Gp(e,t,n=!0,r=!1){const s=Qt||ln;if(s){const o=s.type;{const a=Rm(o,!1);if(a&&(a===t||a===yn(t)||a===Ei(yn(t))))return o}const i=oc(s[e]||o[e],t)||oc(s.appContext[e],t);return!i&&r?o:i}}function oc(e,t){return e&&(e[t]||e[yn(t)]||e[Ei(yn(t))])}function _t(e,t,n,r){let s;const o=n,i=Ge(e);if(i||Ot(e)){const a=i&&as(e);let l=!1,u=!1;a&&(l=!jn(e),u=kr(e),e=Ai(e)),s=new Array(e.length);for(let c=0,f=e.length;c<f;c++)s[c]=t(l?u?xs(zn(e[c])):zn(e[c]):e[c],c,void 0,o)}else if(typeof e=="number"){s=new Array(e);for(let a=0;a<e;a++)s[a]=t(a+1,a,void 0,o)}else if(yt(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,u=a.length;l<u;l++){const c=a[l];s[l]=t(e[c],c,l,o)}}else s=[];return s}function rr(e,t,n={},r,s){if(Qt.ce||Qt.parent&&Ts(Qt.parent)&&Qt.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),v(),dt(Ve,null,[Pe("slot",n,r)],u?-2:64)}let o=e[t];o&&o._c&&(o._d=!1),v();const i=o&&Qd(o(n)),a=n.key||i&&i.key,l=dt(Ve,{key:(a&&!Vn(a)?a:`_${t}`)+(!i&&r?"_fb":"")},i||[],i&&e._===1?64:-2);return o&&o._c&&(o._d=!0),l}function Qd(e){return e.some(t=>ho(t)?!(t.type===an||t.type===Ve&&!Qd(t.children)):!0)?e:null}const Ha=e=>e?wf(e)?Ni(e):Ha(e.parent):null,no=Ht(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=>Ha(e.parent),$root:e=>Ha(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>ef(e),$forceUpdate:e=>e.f||(e.f=()=>{Il(e.update)}),$nextTick:e=>e.n||(e.n=Xt.bind(e.proxy)),$watch:e=>xp.bind(e)}),oa=(e,t)=>e!==St&&!e.__isScriptSetup&&vt(e,t),qp={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 m=i[t];if(m!==void 0)switch(m){case 1:return r[t];case 2:return s[t];case 4:return n[t];case 3:return o[t]}else{if(oa(r,t))return i[t]=1,r[t];if(s!==St&&vt(s,t))return i[t]=2,s[t];if(vt(o,t))return i[t]=3,o[t];if(n!==St&&vt(n,t))return i[t]=4,n[t];Wa&&(i[t]=0)}}const u=no[t];let c,f;if(u)return t==="$attrs"&&on(e.attrs,"get",""),u(e);if((c=a.__cssModules)&&(c=c[t]))return c;if(n!==St&&vt(n,t))return i[t]=4,n[t];if(f=l.config.globalProperties,vt(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:s,ctx:o}=e;return oa(s,t)?(s[t]=n,!0):r!==St&&vt(r,t)?(r[t]=n,!0):vt(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!==St&&a[0]!=="$"&&vt(e,a)||oa(t,a)||vt(o,a)||vt(r,a)||vt(no,a)||vt(s.config.globalProperties,a)||(l=i.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:vt(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}};function Kp(){return Jp().slots}function Jp(e){const t=Rl();return t.setupContext||(t.setupContext=_f(t))}function ic(e){return Ge(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}let Wa=!0;function Yp(e){const t=ef(e),n=e.proxy,r=e.ctx;Wa=!1,t.beforeCreate&&ac(t.beforeCreate,e,"bc");const{data:s,computed:o,methods:i,watch:a,provide:l,inject:u,created:c,beforeMount:f,mounted:m,beforeUpdate:S,updated:D,activated:H,deactivated:ee,beforeDestroy:A,beforeUnmount:R,destroyed:B,unmounted:F,render:X,renderTracked:ae,renderTriggered:ve,errorCaptured:ke,serverPrefetch:ue,expose:fe,inheritAttrs:_e,components:z,directives:Te,filters:Ne}=t;if(u&&Xp(u,r,null),i)for(const $e in i){const De=i[$e];Ke(De)&&(r[$e]=De.bind(n))}if(s){const $e=s.call(n,n);yt($e)&&(e.data=xi($e))}if(Wa=!0,o)for(const $e in o){const De=o[$e],ze=Ke(De)?De.bind(n,n):Ke(De.get)?De.get.bind(n,n):sr,tt=!Ke(De)&&Ke(De.set)?De.set.bind(n):sr,Oe=ie({get:ze,set:tt});Object.defineProperty(r,$e,{enumerable:!0,configurable:!0,get:()=>Oe.value,set:Qe=>Oe.value=Qe})}if(a)for(const $e in a)Zd(a[$e],r,n,$e);if(l){const $e=Ke(l)?l.call(n):l;Reflect.ownKeys($e).forEach(De=>{Xo(De,$e[De])})}c&&ac(c,e,"c");function Ae($e,De){Ge(De)?De.forEach(ze=>$e(ze.bind(n))):De&&$e(De.bind(n))}if(Ae(jp,f),Ae(ar,m),Ae(Up,S),Ae(Fp,D),Ae(Np,H),Ae(Dp,ee),Ae(Vp,ke),Ae(Wp,ae),Ae(Hp,ve),Ae(Ar,R),Ae(So,F),Ae(Bp,ue),Ge(fe))if(fe.length){const $e=e.exposed||(e.exposed={});fe.forEach(De=>{Object.defineProperty($e,De,{get:()=>n[De],set:ze=>n[De]=ze,enumerable:!0})})}else e.exposed||(e.exposed={});X&&e.render===sr&&(e.render=X),_e!=null&&(e.inheritAttrs=_e),z&&(e.components=z),Te&&(e.directives=Te),ue&&Jd(e)}function Xp(e,t,n=sr){Ge(e)&&(e=Va(e));for(const r in e){const s=e[r];let o;yt(s)?"default"in s?o=Hn(s.from||r,s.default,!0):o=Hn(s.from||r):o=Hn(s),cn(o)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o.value,set:i=>o.value=i}):t[r]=o}}function ac(e,t,n){Gn(Ge(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Zd(e,t,n,r){let s=r.includes(".")?Fd(n,r):()=>n[r];if(Ot(e)){const o=t[e];Ke(o)&&at(s,o)}else if(Ke(e))at(s,e.bind(n));else if(yt(e))if(Ge(e))e.forEach(o=>Zd(o,t,n,r));else{const o=Ke(e.handler)?e.handler.bind(n):t[e.handler];Ke(o)&&at(s,o,e)}}function ef(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(u=>fi(l,u,i,!0)),fi(l,t,i)),yt(t)&&o.set(t,l),l}function fi(e,t,n,r=!1){const{mixins:s,extends:o}=t;o&&fi(e,o,n,!0),s&&s.forEach(i=>fi(e,i,n,!0));for(const i in t)if(!(r&&i==="expose")){const a=Qp[i]||n&&n[i];e[i]=a?a(e[i],t[i]):t[i]}return e}const Qp={data:lc,props:cc,emits:cc,methods:Ys,computed:Ys,beforeCreate:pn,created:pn,beforeMount:pn,mounted:pn,beforeUpdate:pn,updated:pn,beforeDestroy:pn,beforeUnmount:pn,destroyed:pn,unmounted:pn,activated:pn,deactivated:pn,errorCaptured:pn,serverPrefetch:pn,components:Ys,directives:Ys,watch:em,provide:lc,inject:Zp};function lc(e,t){return t?e?function(){return Ht(Ke(e)?e.call(this,this):e,Ke(t)?t.call(this,this):t)}:t:e}function Zp(e,t){return Ys(Va(e),Va(t))}function Va(e){if(Ge(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function pn(e,t){return e?[...new Set([].concat(e,t))]:t}function Ys(e,t){return e?Ht(Object.create(null),e,t):t}function cc(e,t){return e?Ge(e)&&Ge(t)?[...new Set([...e,...t])]:Ht(Object.create(null),ic(e),ic(t??{})):t}function em(e,t){if(!e)return t;if(!t)return e;const n=Ht(Object.create(null),e);for(const r in t)n[r]=pn(e[r],t[r]);return n}function tf(){return{app:null,config:{isNativeTag:ld,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 tm=0;function nm(e,t){return function(r,s=null){Ke(r)||(r=Ht({},r)),s!=null&&!yt(s)&&(s=null);const o=tf(),i=new WeakSet,a=[];let l=!1;const u=o.app={_uid:tm++,_component:r,_props:s,_container:null,_context:o,_instance:null,version:Mm,get config(){return o.config},set config(c){},use(c,...f){return i.has(c)||(c&&Ke(c.install)?(i.add(c),c.install(u,...f)):Ke(c)&&(i.add(c),c(u,...f))),u},mixin(c){return o.mixins.includes(c)||o.mixins.push(c),u},component(c,f){return f?(o.components[c]=f,u):o.components[c]},directive(c,f){return f?(o.directives[c]=f,u):o.directives[c]},mount(c,f,m){if(!l){const S=u._ceVNode||Pe(r,s);return S.appContext=o,m===!0?m="svg":m===!1&&(m=void 0),e(S,c,m),l=!0,u._container=c,c.__vue_app__=u,Ni(S.component)}},onUnmount(c){a.push(c)},unmount(){l&&(Gn(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(c,f){return o.provides[c]=f,u},runWithContext(c){const f=Ss;Ss=u;try{return c()}finally{Ss=f}}};return u}}let Ss=null;const rm=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${yn(t)}Modifiers`]||e[`${Hr(t)}Modifiers`];function sm(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||St;let s=n;const o=t.startsWith("update:"),i=o&&rm(r,t.slice(7));i&&(i.trim&&(s=n.map(c=>Ot(c)?c.trim():c)),i.number&&(s=n.map(gl)));let a,l=r[a=Zi(t)]||r[a=Zi(yn(t))];!l&&o&&(l=r[a=Zi(Hr(t))]),l&&Gn(l,e,6,s);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Gn(u,e,6,s)}}const om=new WeakMap;function nf(e,t,n=!1){const r=n?om:t.emitsCache,s=r.get(e);if(s!==void 0)return s;const o=e.emits;let i={},a=!1;if(!Ke(e)){const l=u=>{const c=nf(u,t,!0);c&&(a=!0,Ht(i,c))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!o&&!a?(yt(e)&&r.set(e,null),null):(Ge(o)?o.forEach(l=>i[l]=null):Ht(i,o),yt(e)&&r.set(e,i),i)}function $i(e,t){return!e||!Ti(t)?!1:(t=t.slice(2).replace(/Once$/,""),vt(e,t[0].toLowerCase()+t.slice(1))||vt(e,Hr(t))||vt(e,t))}function uc(e){const{type:t,vnode:n,proxy:r,withProxy:s,propsOptions:[o],slots:i,attrs:a,emit:l,render:u,renderCache:c,props:f,data:m,setupState:S,ctx:D,inheritAttrs:H}=e,ee=li(e);let A,R;try{if(n.shapeFlag&4){const F=s||r,X=F;A=Zn(u.call(X,F,c,f,S,m,D)),R=a}else{const F=t;A=Zn(F.length>1?F(f,{attrs:a,slots:i,emit:l}):F(f,null)),R=t.props?a:im(a)}}catch(F){ro.length=0,Ri(F,e,1),A=Pe(an)}let B=A;if(R&&H!==!1){const F=Object.keys(R),{shapeFlag:X}=B;F.length&&X&7&&(o&&F.some(Si)&&(R=am(R,o)),B=Br(B,R,!1,!0))}return n.dirs&&(B=Br(B,null,!1,!0),B.dirs=B.dirs?B.dirs.concat(n.dirs):n.dirs),n.transition&&uo(B,n.transition),A=B,li(ee),A}const im=e=>{let t;for(const n in e)(n==="class"||n==="style"||Ti(n))&&((t||(t={}))[n]=e[n]);return t},am=(e,t)=>{const n={};for(const r in e)(!Si(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function lm(e,t,n){const{props:r,children:s,component:o}=e,{props:i,children:a,patchFlag:l}=t,u=o.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?dc(r,i,u):!!i;if(l&8){const c=t.dynamicProps;for(let f=0;f<c.length;f++){const m=c[f];if(rf(i,r,m)&&!$i(u,m))return!0}}}else return(s||a)&&(!a||!a.$stable)?!0:r===i?!1:r?i?dc(r,i,u):!0:!!i;return!1}function dc(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(rf(t,e,o)&&!$i(n,o))return!0}return!1}function rf(e,t,n){const r=e[n],s=t[n];return n==="style"&&yt(r)&&yt(s)?!vl(r,s):r!==s}function cm({vnode:e,parent:t,suspense:n},r){for(;t;){const s=t.subTree;if(s.suspense&&s.suspense.activeBranch===e&&(s.suspense.vnode.el=s.el=r,e=s),s===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}const sf={},of=()=>Object.create(sf),af=e=>Object.getPrototypeOf(e)===sf;function um(e,t,n,r=!1){const s={},o=of();e.propsDefaults=Object.create(null),lf(e,t,s,o);for(const i in e.propsOptions[0])i in s||(s[i]=void 0);n?e.props=r?s:Pd(s):e.type.props?e.props=s:e.props=o,e.attrs=o}function dm(e,t,n,r){const{props:s,attrs:o,vnode:{patchFlag:i}}=e,a=ht(s),[l]=e.propsOptions;let u=!1;if((r||i>0)&&!(i&16)){if(i&8){const c=e.vnode.dynamicProps;for(let f=0;f<c.length;f++){let m=c[f];if($i(e.emitsOptions,m))continue;const S=t[m];if(l)if(vt(o,m))S!==o[m]&&(o[m]=S,u=!0);else{const D=yn(m);s[D]=za(l,a,D,S,e,!1)}else S!==o[m]&&(o[m]=S,u=!0)}}}else{lf(e,t,s,o)&&(u=!0);let c;for(const f in a)(!t||!vt(t,f)&&((c=Hr(f))===f||!vt(t,c)))&&(l?n&&(n[f]!==void 0||n[c]!==void 0)&&(s[f]=za(l,a,f,void 0,e,!0)):delete s[f]);if(o!==a)for(const f in o)(!t||!vt(t,f))&&(delete o[f],u=!0)}u&&mr(e.attrs,"set","")}function lf(e,t,n,r){const[s,o]=e.propsOptions;let i=!1,a;if(t)for(let l in t){if(Xs(l))continue;const u=t[l];let c;s&&vt(s,c=yn(l))?!o||!o.includes(c)?n[c]=u:(a||(a={}))[c]=u:$i(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,i=!0)}if(o){const l=ht(n),u=a||St;for(let c=0;c<o.length;c++){const f=o[c];n[f]=za(s,l,f,u[f],e,!vt(u,f))}}return i}function za(e,t,n,r,s,o){const i=e[n];if(i!=null){const a=vt(i,"default");if(a&&r===void 0){const l=i.default;if(i.type!==Function&&!i.skipFactory&&Ke(l)){const{propsDefaults:u}=s;if(n in u)r=u[n];else{const c=Io(s);r=u[n]=l.call(null,t),c()}}else r=l;s.ce&&s.ce._setProp(n,r)}i[0]&&(o&&!a?r=!1:i[1]&&(r===""||r===Hr(n))&&(r=!0))}return r}const fm=new WeakMap;function cf(e,t,n=!1){const r=n?fm:t.propsCache,s=r.get(e);if(s)return s;const o=e.props,i={},a=[];let l=!1;if(!Ke(e)){const c=f=>{l=!0;const[m,S]=cf(f,t,!0);Ht(i,m),S&&a.push(...S)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!o&&!l)return yt(e)&&r.set(e,bs),bs;if(Ge(o))for(let c=0;c<o.length;c++){const f=yn(o[c]);fc(f)&&(i[f]=St)}else if(o)for(const c in o){const f=yn(c);if(fc(f)){const m=o[c],S=i[f]=Ge(m)||Ke(m)?{type:m}:Ht({},m),D=S.type;let H=!1,ee=!0;if(Ge(D))for(let A=0;A<D.length;++A){const R=D[A],B=Ke(R)&&R.name;if(B==="Boolean"){H=!0;break}else B==="String"&&(ee=!1)}else H=Ke(D)&&D.name==="Boolean";S[0]=H,S[1]=ee,(H||vt(S,"default"))&&a.push(f)}}const u=[i,a];return yt(e)&&r.set(e,u),u}function fc(e){return e[0]!=="$"&&!Xs(e)}const El=e=>e==="_"||e==="_ctx"||e==="$stable",Cl=e=>Ge(e)?e.map(Zn):[Zn(e)],hm=(e,t,n)=>{if(t._n)return t;const r=bt((...s)=>Cl(t(...s)),n);return r._c=!1,r},uf=(e,t,n)=>{const r=e._ctx;for(const s in e){if(El(s))continue;const o=e[s];if(Ke(o))t[s]=hm(s,o,r);else if(o!=null){const i=Cl(o);t[s]=()=>i}}},df=(e,t)=>{const n=Cl(t);e.slots.default=()=>n},ff=(e,t,n)=>{for(const r in t)(n||!El(r))&&(e[r]=t[r])},pm=(e,t,n)=>{const r=e.slots=of();if(e.vnode.shapeFlag&32){const s=t._;s?(ff(r,t,n),n&&hd(r,"_",s,!0)):uf(t,r)}else t&&df(e,t)},mm=(e,t,n)=>{const{vnode:r,slots:s}=e;let o=!0,i=St;if(r.shapeFlag&32){const a=t._;a?n&&a===1?o=!1:ff(s,t,n):(o=!t.$stable,uf(t,s)),i=t}else t&&(df(e,t),i={default:1});if(o)for(const a in s)!El(a)&&i[a]==null&&delete s[a]},sn=bm;function gm(e){return vm(e)}function vm(e,t){const n=Ci();n.__VUE__=!0;const{insert:r,remove:s,patchProp:o,createElement:i,createText:a,createComment:l,setText:u,setElementText:c,parentNode:f,nextSibling:m,setScopeId:S=sr,insertStaticContent:D}=e,H=(b,T,M,q=null,Q=null,V=null,me=void 0,oe=null,W=!!T.dynamicChildren)=>{if(b===T)return;b&&!ns(b,T)&&(q=K(b),Qe(b,Q,V,!0),b=null),T.patchFlag===-2&&(W=!1,T.dynamicChildren=null);const{type:U,ref:te,shapeFlag:se}=T;switch(U){case Oi:ee(b,T,M,q);break;case an:A(b,T,M,q);break;case aa:b==null&&R(T,M,q,me);break;case Ve:z(b,T,M,q,Q,V,me,oe,W);break;default:se&1?X(b,T,M,q,Q,V,me,oe,W):se&6?Te(b,T,M,q,Q,V,me,oe,W):(se&64||se&128)&&U.process(b,T,M,q,Q,V,me,oe,W,Ee)}te!=null&&Q?to(te,b&&b.ref,V,T||b,!T):te==null&&b&&b.ref!=null&&to(b.ref,null,V,b,!0)},ee=(b,T,M,q)=>{if(b==null)r(T.el=a(T.children),M,q);else{const Q=T.el=b.el;T.children!==b.children&&u(Q,T.children)}},A=(b,T,M,q)=>{b==null?r(T.el=l(T.children||""),M,q):T.el=b.el},R=(b,T,M,q)=>{[b.el,b.anchor]=D(b.children,T,M,q,b.el,b.anchor)},B=({el:b,anchor:T},M,q)=>{let Q;for(;b&&b!==T;)Q=m(b),r(b,M,q),b=Q;r(T,M,q)},F=({el:b,anchor:T})=>{let M;for(;b&&b!==T;)M=m(b),s(b),b=M;s(T)},X=(b,T,M,q,Q,V,me,oe,W)=>{if(T.type==="svg"?me="svg":T.type==="math"&&(me="mathml"),b==null)ae(T,M,q,Q,V,me,oe,W);else{const U=b.el&&b.el._isVueCE?b.el:null;try{U&&U._beginPatch(),ue(b,T,Q,V,me,oe,W)}finally{U&&U._endPatch()}}},ae=(b,T,M,q,Q,V,me,oe)=>{let W,U;const{props:te,shapeFlag:se,transition:de,dirs:Ie}=b;if(W=b.el=i(b.type,V,te&&te.is,te),se&8?c(W,b.children):se&16&&ke(b.children,W,null,q,Q,ia(b,V),me,oe),Ie&&Jr(b,null,q,"created"),ve(W,b,b.scopeId,me,q),te){for(const Fe in te)Fe!=="value"&&!Xs(Fe)&&o(W,Fe,null,te[Fe],V,q);"value"in te&&o(W,"value",null,te.value,V),(U=te.onVnodeBeforeMount)&&Jn(U,q,b)}Ie&&Jr(b,null,q,"beforeMount");const We=ym(Q,de);We&&de.beforeEnter(W),r(W,T,M),((U=te&&te.onVnodeMounted)||We||Ie)&&sn(()=>{try{U&&Jn(U,q,b),We&&de.enter(W),Ie&&Jr(b,null,q,"mounted")}finally{}},Q)},ve=(b,T,M,q,Q)=>{if(M&&S(b,M),q)for(let V=0;V<q.length;V++)S(b,q[V]);if(Q){let V=Q.subTree;if(T===V||mf(V.type)&&(V.ssContent===T||V.ssFallback===T)){const me=Q.vnode;ve(b,me,me.scopeId,me.slotScopeIds,Q.parent)}}},ke=(b,T,M,q,Q,V,me,oe,W=0)=>{for(let U=W;U<b.length;U++){const te=b[U]=oe?pr(b[U]):Zn(b[U]);H(null,te,T,M,q,Q,V,me,oe)}},ue=(b,T,M,q,Q,V,me)=>{const oe=T.el=b.el;let{patchFlag:W,dynamicChildren:U,dirs:te}=T;W|=b.patchFlag&16;const se=b.props||St,de=T.props||St;let Ie;if(M&&Yr(M,!1),(Ie=de.onVnodeBeforeUpdate)&&Jn(Ie,M,T,b),te&&Jr(T,b,M,"beforeUpdate"),M&&Yr(M,!0),(se.innerHTML&&de.innerHTML==null||se.textContent&&de.textContent==null)&&c(oe,""),U?fe(b.dynamicChildren,U,oe,M,q,ia(T,Q),V):me||De(b,T,oe,null,M,q,ia(T,Q),V,!1),W>0){if(W&16)_e(oe,se,de,M,Q);else if(W&2&&se.class!==de.class&&o(oe,"class",null,de.class,Q),W&4&&o(oe,"style",se.style,de.style,Q),W&8){const We=T.dynamicProps;for(let Fe=0;Fe<We.length;Fe++){const Me=We[Fe],Ye=se[Me],et=de[Me];(et!==Ye||Me==="value")&&o(oe,Me,Ye,et,Q,M)}}W&1&&b.children!==T.children&&c(oe,T.children)}else!me&&U==null&&_e(oe,se,de,M,Q);((Ie=de.onVnodeUpdated)||te)&&sn(()=>{Ie&&Jn(Ie,M,T,b),te&&Jr(T,b,M,"updated")},q)},fe=(b,T,M,q,Q,V,me)=>{for(let oe=0;oe<T.length;oe++){const W=b[oe],U=T[oe],te=W.el&&(W.type===Ve||!ns(W,U)||W.shapeFlag&198)?f(W.el):M;H(W,U,te,null,q,Q,V,me,!0)}},_e=(b,T,M,q,Q)=>{if(T!==M){if(T!==St)for(const V in T)!Xs(V)&&!(V in M)&&o(b,V,T[V],null,Q,q);for(const V in M){if(Xs(V))continue;const me=M[V],oe=T[V];me!==oe&&V!=="value"&&o(b,V,oe,me,Q,q)}"value"in M&&o(b,"value",T.value,M.value,Q)}},z=(b,T,M,q,Q,V,me,oe,W)=>{const U=T.el=b?b.el:a(""),te=T.anchor=b?b.anchor:a("");let{patchFlag:se,dynamicChildren:de,slotScopeIds:Ie}=T;Ie&&(oe=oe?oe.concat(Ie):Ie),b==null?(r(U,M,q),r(te,M,q),ke(T.children||[],M,te,Q,V,me,oe,W)):se>0&&se&64&&de&&b.dynamicChildren&&b.dynamicChildren.length===de.length?(fe(b.dynamicChildren,de,M,Q,V,me,oe),(T.key!=null||Q&&T===Q.subTree)&&Al(b,T,!0)):De(b,T,M,te,Q,V,me,oe,W)},Te=(b,T,M,q,Q,V,me,oe,W)=>{T.slotScopeIds=oe,b==null?T.shapeFlag&512?Q.ctx.activate(T,M,q,me,W):Ne(T,M,q,Q,V,me,W):Ue(b,T,W)},Ne=(b,T,M,q,Q,V,me)=>{const oe=b.component=Em(b,q,Q);if(Pi(b)&&(oe.ctx.renderer=Ee),Cm(oe,!1,me),oe.asyncDep){if(Q&&Q.registerDep(oe,Ae,me),!b.el){const W=oe.subTree=Pe(an);A(null,W,T,M),b.placeholder=W.el}}else Ae(oe,b,T,M,Q,V,me)},Ue=(b,T,M)=>{const q=T.component=b.component;if(lm(b,T,M))if(q.asyncDep&&!q.asyncResolved){$e(q,T,M);return}else q.next=T,q.update();else T.el=b.el,q.vnode=T},Ae=(b,T,M,q,Q,V,me)=>{const oe=()=>{if(b.isMounted){let{next:se,bu:de,u:Ie,parent:We,vnode:Fe}=b;{const ft=hf(b);if(ft){se&&(se.el=Fe.el,$e(b,se,me)),ft.asyncDep.then(()=>{sn(()=>{b.isUnmounted||U()},Q)});return}}let Me=se,Ye;Yr(b,!1),se?(se.el=Fe.el,$e(b,se,me)):se=Fe,de&&Yo(de),(Ye=se.props&&se.props.onVnodeBeforeUpdate)&&Jn(Ye,We,se,Fe),Yr(b,!0);const et=uc(b),xt=b.subTree;b.subTree=et,H(xt,et,f(xt.el),K(xt),b,Q,V),se.el=et.el,Me===null&&cm(b,et.el),Ie&&sn(Ie,Q),(Ye=se.props&&se.props.onVnodeUpdated)&&sn(()=>Jn(Ye,We,se,Fe),Q)}else{let se;const{el:de,props:Ie}=T,{bm:We,m:Fe,parent:Me,root:Ye,type:et}=b,xt=Ts(T);Yr(b,!1),We&&Yo(We),!xt&&(se=Ie&&Ie.onVnodeBeforeMount)&&Jn(se,Me,T),Yr(b,!0);{Ye.ce&&Ye.ce._hasShadowRoot()&&Ye.ce._injectChildStyle(et,b.parent?b.parent.type:void 0);const ft=b.subTree=uc(b);H(null,ft,M,q,b,Q,V),T.el=ft.el}if(Fe&&sn(Fe,Q),!xt&&(se=Ie&&Ie.onVnodeMounted)){const ft=T;sn(()=>Jn(se,Me,ft),Q)}(T.shapeFlag&256||Me&&Ts(Me.vnode)&&Me.vnode.shapeFlag&256)&&b.a&&sn(b.a,Q),b.isMounted=!0,T=M=q=null}};b.scope.on();const W=b.effect=new vd(oe);b.scope.off();const U=b.update=W.run.bind(W),te=b.job=W.runIfDirty.bind(W);te.i=b,te.id=b.uid,W.scheduler=()=>Il(te),Yr(b,!0),U()},$e=(b,T,M)=>{T.component=b;const q=b.vnode.props;b.vnode=T,b.next=null,dm(b,T.props,q,M),mm(b,T.children,M),br(),Zl(b),_r()},De=(b,T,M,q,Q,V,me,oe,W=!1)=>{const U=b&&b.children,te=b?b.shapeFlag:0,se=T.children,{patchFlag:de,shapeFlag:Ie}=T;if(de>0){if(de&128){tt(U,se,M,q,Q,V,me,oe,W);return}else if(de&256){ze(U,se,M,q,Q,V,me,oe,W);return}}Ie&8?(te&16&&Je(U,Q,V),se!==U&&c(M,se)):te&16?Ie&16?tt(U,se,M,q,Q,V,me,oe,W):Je(U,Q,V,!0):(te&8&&c(M,""),Ie&16&&ke(se,M,q,Q,V,me,oe,W))},ze=(b,T,M,q,Q,V,me,oe,W)=>{b=b||bs,T=T||bs;const U=b.length,te=T.length,se=Math.min(U,te);let de;for(de=0;de<se;de++){const Ie=T[de]=W?pr(T[de]):Zn(T[de]);H(b[de],Ie,M,null,Q,V,me,oe,W)}U>te?Je(b,Q,V,!0,!1,se):ke(T,M,q,Q,V,me,oe,W,se)},tt=(b,T,M,q,Q,V,me,oe,W)=>{let U=0;const te=T.length;let se=b.length-1,de=te-1;for(;U<=se&&U<=de;){const Ie=b[U],We=T[U]=W?pr(T[U]):Zn(T[U]);if(ns(Ie,We))H(Ie,We,M,null,Q,V,me,oe,W);else break;U++}for(;U<=se&&U<=de;){const Ie=b[se],We=T[de]=W?pr(T[de]):Zn(T[de]);if(ns(Ie,We))H(Ie,We,M,null,Q,V,me,oe,W);else break;se--,de--}if(U>se){if(U<=de){const Ie=de+1,We=Ie<te?T[Ie].el:q;for(;U<=de;)H(null,T[U]=W?pr(T[U]):Zn(T[U]),M,We,Q,V,me,oe,W),U++}}else if(U>de)for(;U<=se;)Qe(b[U],Q,V,!0),U++;else{const Ie=U,We=U,Fe=new Map;for(U=We;U<=de;U++){const pt=T[U]=W?pr(T[U]):Zn(T[U]);pt.key!=null&&Fe.set(pt.key,U)}let Me,Ye=0;const et=de-We+1;let xt=!1,ft=0;const Ct=new Array(et);for(U=0;U<et;U++)Ct[U]=0;for(U=Ie;U<=se;U++){const pt=b[U];if(Ye>=et){Qe(pt,Q,V,!0);continue}let Pt;if(pt.key!=null)Pt=Fe.get(pt.key);else for(Me=We;Me<=de;Me++)if(Ct[Me-We]===0&&ns(pt,T[Me])){Pt=Me;break}Pt===void 0?Qe(pt,Q,V,!0):(Ct[Pt-We]=U+1,Pt>=ft?ft=Pt:xt=!0,H(pt,T[Pt],M,null,Q,V,me,oe,W),Ye++)}const Lt=xt?wm(Ct):bs;for(Me=Lt.length-1,U=et-1;U>=0;U--){const pt=We+U,Pt=T[pt],mt=T[pt+1],Vt=pt+1<te?mt.el||pf(mt):q;Ct[U]===0?H(null,Pt,M,Vt,Q,V,me,oe,W):xt&&(Me<0||U!==Lt[Me]?Oe(Pt,M,Vt,2):Me--)}}},Oe=(b,T,M,q,Q=null)=>{const{el:V,type:me,transition:oe,children:W,shapeFlag:U}=b;if(U&6){Oe(b.component.subTree,T,M,q);return}if(U&128){b.suspense.move(T,M,q);return}if(U&64){me.move(b,T,M,Ee);return}if(me===Ve){r(V,T,M);for(let se=0;se<W.length;se++)Oe(W[se],T,M,q);r(b.anchor,T,M);return}if(me===aa){B(b,T,M);return}if(q!==2&&U&1&&oe)if(q===0)oe.beforeEnter(V),r(V,T,M),sn(()=>oe.enter(V),Q);else{const{leave:se,delayLeave:de,afterLeave:Ie}=oe,We=()=>{b.ctx.isUnmounted?s(V):r(V,T,M)},Fe=()=>{V._isLeaving&&V[Xn](!0),se(V,()=>{We(),Ie&&Ie()})};de?de(V,We,Fe):Fe()}else r(V,T,M)},Qe=(b,T,M,q=!1,Q=!1)=>{const{type:V,props:me,ref:oe,children:W,dynamicChildren:U,shapeFlag:te,patchFlag:se,dirs:de,cacheIndex:Ie,memo:We}=b;if(se===-2&&(Q=!1),oe!=null&&(br(),to(oe,null,M,b,!0),_r()),Ie!=null&&(T.renderCache[Ie]=void 0),te&256){T.ctx.deactivate(b);return}const Fe=te&1&&de,Me=!Ts(b);let Ye;if(Me&&(Ye=me&&me.onVnodeBeforeUnmount)&&Jn(Ye,T,b),te&6)Ze(b.component,M,q);else{if(te&128){b.suspense.unmount(M,q);return}Fe&&Jr(b,null,T,"beforeUnmount"),te&64?b.type.remove(b,T,M,Ee,q):U&&!U.hasOnce&&(V!==Ve||se>0&&se&64)?Je(U,T,M,!1,!0):(V===Ve&&se&384||!Q&&te&16)&&Je(W,T,M),q&&wt(b)}const et=We!=null&&Ie==null;(Me&&(Ye=me&&me.onVnodeUnmounted)||Fe||et)&&sn(()=>{Ye&&Jn(Ye,T,b),Fe&&Jr(b,null,T,"unmounted"),et&&(b.el=null)},M)},wt=b=>{const{type:T,el:M,anchor:q,transition:Q}=b;if(T===Ve){ct(M,q);return}if(T===aa){F(b);return}const V=()=>{s(M),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(b.shapeFlag&1&&Q&&!Q.persisted){const{leave:me,delayLeave:oe}=Q,W=()=>me(M,V);oe?oe(b.el,V,W):W()}else V()},ct=(b,T)=>{let M;for(;b!==T;)M=m(b),s(b),b=M;s(T)},Ze=(b,T,M)=>{const{bum:q,scope:Q,job:V,subTree:me,um:oe,m:W,a:U}=b;hc(W),hc(U),q&&Yo(q),Q.stop(),V&&(V.flags|=8,Qe(me,b,T,M)),oe&&sn(oe,T),sn(()=>{b.isUnmounted=!0},T)},Je=(b,T,M,q=!1,Q=!1,V=0)=>{for(let me=V;me<b.length;me++)Qe(b[me],T,M,q,Q)},K=b=>{if(b.shapeFlag&6)return K(b.component.subTree);if(b.shapeFlag&128)return b.suspense.next();const T=m(b.anchor||b.el),M=T&&T[Bd];return M?m(M):T};let pe=!1;const he=(b,T,M)=>{let q;b==null?T._vnode&&(Qe(T._vnode,null,null,!0),q=T._vnode.component):H(T._vnode||null,b,T,null,null,null,M),T._vnode=b,pe||(pe=!0,Zl(q),Dd(),pe=!1)},Ee={p:H,um:Qe,m:Oe,r:wt,mt:Ne,mc:ke,pc:De,pbc:fe,n:K,o:e};return{render:he,hydrate:void 0,createApp:nm(he)}}function ia({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 Yr({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ym(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Al(e,t,n=!1){const r=e.children,s=t.children;if(Ge(r)&&Ge(s))for(let o=0;o<r.length;o++){const i=r[o];let a=s[o];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=s[o]=pr(s[o]),a.el=i.el),!n&&a.patchFlag!==-2&&Al(i,a)),a.type===Oi&&(a.patchFlag===-1&&(a=s[o]=pr(a)),a.el=i.el),a.type===an&&!a.el&&(a.el=i.el)}}function wm(e){const t=e.slice(),n=[0];let r,s,o,i,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(s=n[n.length-1],e[s]<u){t[r]=s,n.push(r);continue}for(o=0,i=n.length-1;o<i;)a=o+i>>1,e[n[a]]<u?o=a+1:i=a;u<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 hf(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:hf(t)}function hc(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function pf(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?pf(t.subTree):null}const mf=e=>e.__isSuspense;function bm(e,t){t&&t.pendingBranch?Ge(e)?t.effects.push(...e):t.effects.push(e):Ep(e)}const Ve=Symbol.for("v-fgt"),Oi=Symbol.for("v-txt"),an=Symbol.for("v-cmt"),aa=Symbol.for("v-stc"),ro=[];let xn=null;function v(e=!1){ro.push(xn=e?null:[])}function _m(){ro.pop(),xn=ro[ro.length-1]||null}let fo=1;function hi(e,t=!1){fo+=e,e<0&&xn&&t&&(xn.hasOnce=!0)}function gf(e){return e.dynamicChildren=fo>0?xn||bs:null,_m(),fo>0&&xn&&xn.push(e),e}function E(e,t,n,r,s,o){return gf(h(e,t,n,r,s,o,!0))}function dt(e,t,n,r,s){return gf(Pe(e,t,n,r,s,!0))}function ho(e){return e?e.__v_isVNode===!0:!1}function ns(e,t){return e.type===t.type&&e.key===t.key}const vf=({key:e})=>e??null,Zo=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Ot(e)||cn(e)||Ke(e)?{i:Qt,r:e,k:t,f:!!n}:e:null);function h(e,t=null,n=null,r=0,s=null,o=e===Ve?0:1,i=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&vf(t),ref:t&&Zo(t),scopeId:jd,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:Qt};return a?(xl(l,n),o&128&&e.normalize(l)):n&&(l.shapeFlag|=Ot(n)?8:16),fo>0&&!i&&xn&&(l.patchFlag>0||o&6)&&l.patchFlag!==32&&xn.push(l),l}const Pe=km;function km(e,t=null,n=null,r=0,s=null,o=!1){if((!e||e===Xd)&&(e=an),ho(e)){const a=Br(e,t,!0);return n&&xl(a,n),fo>0&&!o&&xn&&(a.shapeFlag&6?xn[xn.indexOf(e)]=a:xn.push(a)),a.patchFlag=-2,a}if(Pm(e)&&(e=e.__vccOpts),t){t=Tm(t);let{class:a,style:l}=t;a&&!Ot(a)&&(t.class=st(a)),yt(l)&&(Sl(l)&&!Ge(l)&&(l=Ht({},l)),t.style=Fr(l))}const i=Ot(e)?1:mf(e)?128:Hd(e)?64:yt(e)?4:Ke(e)?2:0;return h(e,t,n,r,s,i,o,!0)}function Tm(e){return e?Sl(e)||af(e)?Ht({},e):e:null}function Br(e,t,n=!1,r=!1){const{props:s,ref:o,patchFlag:i,children:a,transition:l}=e,u=t?yf(s||{},t):s,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&vf(u),ref:t&&t.ref?n&&o?Ge(o)?o.concat(Zo(t)):[o,Zo(t)]:Zo(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!==Ve?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&&Br(e.ssContent),ssFallback:e.ssFallback&&Br(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&uo(c,l.clone(c)),c}function po(e=" ",t=0){return Pe(Oi,null,e,t)}function ce(e="",t=!1){return t?(v(),dt(an,null,e)):Pe(an,null,e)}function Zn(e){return e==null||typeof e=="boolean"?Pe(an):Ge(e)?Pe(Ve,null,e.slice()):ho(e)?pr(e):Pe(Oi,null,String(e))}function pr(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Br(e)}function xl(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Ge(t))n=16;else if(typeof t=="object")if(r&65){const s=t.default;s&&(s._c&&(s._d=!1),xl(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!af(t)?t._ctx=Qt:s===3&&Qt&&(Qt.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Ke(t)?(t={default:t,_ctx:Qt},n=32):(t=String(t),r&64?(n=16,t=[po(t)]):n=8);e.children=t,e.shapeFlag|=n}function yf(...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=st([t.class,r.class]));else if(s==="style")t.style=Fr([t.style,r.style]);else if(Ti(s)){const o=t[s],i=r[s];i&&o!==i&&!(Ge(o)&&o.includes(i))?t[s]=o?[].concat(o,i):i:i==null&&o==null&&!Si(s)&&(t[s]=i)}else s!==""&&(t[s]=r[s])}return t}function Jn(e,t,n,r=null){Gn(e,t,7,[n,r])}const Sm=tf();let Im=0;function Em(e,t,n){const r=e.type,s=(t?t.appContext:e.appContext)||Sm,o={uid:Im++,vnode:e,type:r,parent:t,appContext:s,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Yh(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(s.provides),ids:t?t.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:cf(r,s),emitsOptions:nf(r,s),emit:null,emitted:null,propsDefaults:St,inheritAttrs:r.inheritAttrs,ctx:St,data:St,props:St,attrs:St,slots:St,refs:St,setupState:St,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=sm.bind(null,o),e.ce&&e.ce(o),o}let ln=null;const Rl=()=>ln||Qt;let pi,Ga;{const e=Ci(),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)}};pi=t("__VUE_INSTANCE_SETTERS__",n=>ln=n),Ga=t("__VUE_SSR_SETTERS__",n=>mo=n)}const Io=e=>{const t=ln;return pi(e),e.scope.on(),()=>{e.scope.off(),pi(t)}},pc=()=>{ln&&ln.scope.off(),pi(null)};function wf(e){return e.vnode.shapeFlag&4}let mo=!1;function Cm(e,t=!1,n=!1){t&&Ga(t);const{props:r,children:s}=e.vnode,o=wf(e);um(e,r,o,t),pm(e,s,n||t);const i=o?Am(e,t):void 0;return t&&Ga(!1),i}function Am(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,qp);const{setup:r}=n;if(r){br();const s=e.setupContext=r.length>1?_f(e):null,o=Io(e),i=To(r,e,0,[e.props,s]),a=ud(i);if(_r(),o(),(a||e.sp)&&!Ts(e)&&Jd(e),a){if(i.then(pc,pc),t)return i.then(l=>{mc(e,l)}).catch(l=>{Ri(l,e,0)});e.asyncDep=i}else mc(e,i)}else bf(e)}function mc(e,t,n){Ke(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:yt(t)&&(e.setupState=$d(t)),bf(e)}function bf(e,t,n){const r=e.type;e.render||(e.render=r.render||sr);{const s=Io(e);br();try{Yp(e)}finally{_r(),s()}}}const xm={get(e,t){return on(e,"get",""),e[t]}};function _f(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,xm),slots:e.slots,emit:e.emit,expose:t}}function Ni(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy($d(gp(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in no)return no[n](e)},has(t,n){return n in t||n in no}})):e.proxy}function Rm(e,t=!0){return Ke(e)?e.displayName||e.name:e.name||t&&e.__name}function Pm(e){return Ke(e)&&"__vccOpts"in e}const ie=(e,t)=>_p(e,t,mo);function Pl(e,t,n){try{hi(-1);const r=arguments.length;return r===2?yt(t)&&!Ge(t)?ho(t)?Pe(e,null,[t]):Pe(e,t):Pe(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&ho(n)&&(n=[n]),Pe(e,t,n))}finally{hi(1)}}const Mm="3.5.31";/**
|
|
14
|
+
* @vue/runtime-dom v3.5.31
|
|
15
|
+
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
16
|
+
* @license MIT
|
|
17
|
+
**/let qa;const gc=typeof window<"u"&&window.trustedTypes;if(gc)try{qa=gc.createPolicy("vue",{createHTML:e=>e})}catch{}const kf=qa?e=>qa.createHTML(e):e=>e,$m="http://www.w3.org/2000/svg",Om="http://www.w3.org/1998/Math/MathML",fr=typeof document<"u"?document:null,vc=fr&&fr.createElement("template"),Nm={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"?fr.createElementNS($m,e):t==="mathml"?fr.createElementNS(Om,e):n?fr.createElement(e,{is:n}):fr.createElement(e);return e==="select"&&r&&r.multiple!=null&&s.setAttribute("multiple",r.multiple),s},createText:e=>fr.createTextNode(e),createComment:e=>fr.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>fr.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{vc.innerHTML=kf(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=vc.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]}},xr="transition",Gs="animation",go=Symbol("_vtc"),Tf={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},Dm=Ht({},Vd,Tf),Lm=e=>(e.displayName="Transition",e.props=Dm,e),Sf=Lm((e,{slots:t})=>Pl(Op,jm(e),t)),Xr=(e,t=[])=>{Ge(e)?e.forEach(n=>n(...t)):e&&e(...t)},yc=e=>e?Ge(e)?e.some(t=>t.length>1):e.length>1:!1;function jm(e){const t={};for(const z in e)z in Tf||(t[z]=e[z]);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:u=i,appearToClass:c=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:m=`${n}-leave-active`,leaveToClass:S=`${n}-leave-to`}=e,D=Um(s),H=D&&D[0],ee=D&&D[1],{onBeforeEnter:A,onEnter:R,onEnterCancelled:B,onLeave:F,onLeaveCancelled:X,onBeforeAppear:ae=A,onAppear:ve=R,onAppearCancelled:ke=B}=t,ue=(z,Te,Ne,Ue)=>{z._enterCancelled=Ue,Qr(z,Te?c:a),Qr(z,Te?u:i),Ne&&Ne()},fe=(z,Te)=>{z._isLeaving=!1,Qr(z,f),Qr(z,S),Qr(z,m),Te&&Te()},_e=z=>(Te,Ne)=>{const Ue=z?ve:R,Ae=()=>ue(Te,z,Ne);Xr(Ue,[Te,Ae]),wc(()=>{Qr(Te,z?l:o),ur(Te,z?c:a),yc(Ue)||bc(Te,r,H,Ae)})};return Ht(t,{onBeforeEnter(z){Xr(A,[z]),ur(z,o),ur(z,i)},onBeforeAppear(z){Xr(ae,[z]),ur(z,l),ur(z,u)},onEnter:_e(!1),onAppear:_e(!0),onLeave(z,Te){z._isLeaving=!0;const Ne=()=>fe(z,Te);ur(z,f),z._enterCancelled?(ur(z,m),Tc(z)):(Tc(z),ur(z,m)),wc(()=>{z._isLeaving&&(Qr(z,f),ur(z,S),yc(F)||bc(z,r,ee,Ne))}),Xr(F,[z,Ne])},onEnterCancelled(z){ue(z,!1,void 0,!0),Xr(B,[z])},onAppearCancelled(z){ue(z,!0,void 0,!0),Xr(ke,[z])},onLeaveCancelled(z){fe(z),Xr(X,[z])}})}function Um(e){if(e==null)return null;if(yt(e))return[la(e.enter),la(e.leave)];{const t=la(e);return[t,t]}}function la(e){return Hh(e)}function ur(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[go]||(e[go]=new Set)).add(t)}function Qr(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[go];n&&(n.delete(t),n.size||(e[go]=void 0))}function wc(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let Fm=0;function bc(e,t,n,r){const s=e._endId=++Fm,o=()=>{s===e._endId&&r()};if(n!=null)return setTimeout(o,n);const{type:i,timeout:a,propCount:l}=Bm(e,t);if(!i)return r();const u=i+"end";let c=0;const f=()=>{e.removeEventListener(u,m),o()},m=S=>{S.target===e&&++c>=l&&f()};setTimeout(()=>{c<l&&f()},a+1),e.addEventListener(u,m)}function Bm(e,t){const n=window.getComputedStyle(e),r=D=>(n[D]||"").split(", "),s=r(`${xr}Delay`),o=r(`${xr}Duration`),i=_c(s,o),a=r(`${Gs}Delay`),l=r(`${Gs}Duration`),u=_c(a,l);let c=null,f=0,m=0;t===xr?i>0&&(c=xr,f=i,m=o.length):t===Gs?u>0&&(c=Gs,f=u,m=l.length):(f=Math.max(i,u),c=f>0?i>u?xr:Gs:null,m=c?c===xr?o.length:l.length:0);const S=c===xr&&/\b(?:transform|all)(?:,|$)/.test(r(`${xr}Property`).toString());return{type:c,timeout:f,propCount:m,hasTransform:S}}function _c(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>kc(n)+kc(e[r])))}function kc(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Tc(e){return(e?e.ownerDocument:document).body.offsetHeight}function Hm(e,t,n){const r=e[go];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Sc=Symbol("_vod"),Wm=Symbol("_vsh"),Vm=Symbol(""),zm=/(?:^|;)\s*display\s*:/;function Gm(e,t,n){const r=e.style,s=Ot(n);let o=!1;if(n&&!s){if(t)if(Ot(t))for(const i of t.split(";")){const a=i.slice(0,i.indexOf(":")).trim();n[a]==null&&ei(r,a,"")}else for(const i in t)n[i]==null&&ei(r,i,"");for(const i in n)i==="display"&&(o=!0),ei(r,i,n[i])}else if(s){if(t!==n){const i=r[Vm];i&&(n+=";"+i),r.cssText=n,o=zm.test(n)}}else t&&e.removeAttribute("style");Sc in e&&(e[Sc]=o?r.display:"",e[Wm]&&(r.display="none"))}const Ic=/\s*!important$/;function ei(e,t,n){if(Ge(n))n.forEach(r=>ei(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=qm(e,t);Ic.test(n)?e.setProperty(Hr(r),n.replace(Ic,""),"important"):e[r]=n}}const Ec=["Webkit","Moz","ms"],ca={};function qm(e,t){const n=ca[t];if(n)return n;let r=yn(t);if(r!=="filter"&&r in e)return ca[t]=r;r=Ei(r);for(let s=0;s<Ec.length;s++){const o=Ec[s]+r;if(o in e)return ca[t]=o}return t}const Cc="http://www.w3.org/1999/xlink";function Ac(e,t,n,r,s,o=Kh(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Cc,t.slice(6,t.length)):e.setAttributeNS(Cc,t,n):n==null||o&&!pd(n)?e.removeAttribute(t):e.setAttribute(t,o?"":Vn(n)?String(n):n)}function xc(e,t,n,r,s){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?kf(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=pd(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 vs(e,t,n,r){e.addEventListener(t,n,r)}function Km(e,t,n,r){e.removeEventListener(t,n,r)}const Rc=Symbol("_vei");function Jm(e,t,n,r,s=null){const o=e[Rc]||(e[Rc]={}),i=o[t];if(r&&i)i.value=r;else{const[a,l]=Ym(t);if(r){const u=o[t]=Zm(r,s);vs(e,a,u,l)}else i&&(Km(e,a,i,l),o[t]=void 0)}}const Pc=/(?:Once|Passive|Capture)$/;function Ym(e){let t;if(Pc.test(e)){t={};let r;for(;r=e.match(Pc);)e=e.slice(0,e.length-r[0].length),t[r[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Hr(e.slice(2)),t]}let ua=0;const Xm=Promise.resolve(),Qm=()=>ua||(Xm.then(()=>ua=0),ua=Date.now());function Zm(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Gn(eg(r,n.value),t,5,[r])};return n.value=e,n.attached=Qm(),n}function eg(e,t){if(Ge(t)){const n=e.stopImmediatePropagation;return e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0},t.map(r=>s=>!s._stopped&&r&&r(s))}else return t}const Mc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,tg=(e,t,n,r,s,o)=>{const i=s==="svg";t==="class"?Hm(e,r,i):t==="style"?Gm(e,n,r):Ti(t)?Si(t)||Jm(e,t,n,r,o):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):ng(e,t,r,i))?(xc(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Ac(e,t,r,i,o,t!=="value")):e._isVueCE&&(rg(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Ot(r)))?xc(e,yn(t),r,o,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Ac(e,t,r,i))};function ng(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Mc(t)&&Ke(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 Mc(t)&&Ot(n)?!1:t in e}function rg(e,t){const n=e._def.props;if(!n)return!1;const r=yn(t);return Array.isArray(n)?n.some(s=>yn(s)===r):Object.keys(n).some(s=>yn(s)===r)}const $c=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ge(t)?n=>Yo(t,n):t};function sg(e){e.target.composing=!0}function Oc(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const da=Symbol("_assign");function Nc(e,t,n){return t&&(e=e.trim()),n&&(e=gl(e)),e}const Sr={created(e,{modifiers:{lazy:t,trim:n,number:r}},s){e[da]=$c(s);const o=r||s.props&&s.props.type==="number";vs(e,t?"change":"input",i=>{i.target.composing||e[da](Nc(e.value,n,o))}),(n||o)&&vs(e,"change",()=>{e.value=Nc(e.value,n,o)}),t||(vs(e,"compositionstart",sg),vs(e,"compositionend",Oc),vs(e,"change",Oc))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:s,number:o}},i){if(e[da]=$c(i),e.composing)return;const a=(o||e.type==="number")&&!/^0\d/.test(e.value)?gl(e.value):e.value,l=t??"";if(a===l)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||s&&e.value.trim()===l)||(e.value=l)}},og=["ctrl","shift","alt","meta"],ig={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)=>og.some(n=>e[`${n}Key`]&&!t.includes(n))},rt=(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=ig[t[i]];if(a&&a(s,t))return}return e(s,...o)}))},ag={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},vn=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(s=>{if(!("key"in s))return;const o=Hr(s.key);if(t.some(i=>i===o||ag[i]===o))return e(s)}))},lg=Ht({patchProp:tg},Nm);let Dc;function cg(){return Dc||(Dc=gm(lg))}const ug=((...e)=>{const t=cg().createApp(...e),{mount:n}=t;return t.mount=r=>{const s=fg(r);if(!s)return;const o=t._component;!Ke(o)&&!o.render&&!o.template&&(o.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const i=n(s,!1,dg(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),i},t});function dg(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function fg(e){return Ot(e)?document.querySelector(e):e}/*!
|
|
18
|
+
* vue-router v4.6.4
|
|
19
|
+
* (c) 2025 Eduardo San Martin Morote
|
|
20
|
+
* @license MIT
|
|
21
|
+
*/const ys=typeof document<"u";function If(e){return typeof e=="object"||"displayName"in e||"props"in e||"__vccOpts"in e}function hg(e){return e.__esModule||e[Symbol.toStringTag]==="Module"||e.default&&If(e.default)}const gt=Object.assign;function fa(e,t){const n={};for(const r in t){const s=t[r];n[r]=qn(s)?s.map(e):e(s)}return n}const so=()=>{},qn=Array.isArray;function Lc(e,t){const n={};for(const r in e)n[r]=r in t?t[r]:e[r];return n}const Ef=/#/g,pg=/&/g,mg=/\//g,gg=/=/g,vg=/\?/g,Cf=/\+/g,yg=/%5B/g,wg=/%5D/g,Af=/%5E/g,bg=/%60/g,xf=/%7B/g,_g=/%7C/g,Rf=/%7D/g,kg=/%20/g;function Ml(e){return e==null?"":encodeURI(""+e).replace(_g,"|").replace(yg,"[").replace(wg,"]")}function Tg(e){return Ml(e).replace(xf,"{").replace(Rf,"}").replace(Af,"^")}function Ka(e){return Ml(e).replace(Cf,"%2B").replace(kg,"+").replace(Ef,"%23").replace(pg,"%26").replace(bg,"`").replace(xf,"{").replace(Rf,"}").replace(Af,"^")}function Sg(e){return Ka(e).replace(gg,"%3D")}function Ig(e){return Ml(e).replace(Ef,"%23").replace(vg,"%3F")}function Eg(e){return Ig(e).replace(mg,"%2F")}function vo(e){if(e==null)return null;try{return decodeURIComponent(""+e)}catch{}return""+e}const Cg=/\/$/,Ag=e=>e.replace(Cg,"");function ha(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=Mg(r??t,n),{fullPath:r+o+i,path:r,query:s,hash:vo(i)}}function xg(e,t){const n=t.query?e(t.query):"";return t.path+(n&&"?")+n+(t.hash||"")}function jc(e,t){return!t||!e.toLowerCase().startsWith(t.toLowerCase())?e:e.slice(t.length)||"/"}function Rg(e,t,n){const r=t.matched.length-1,s=n.matched.length-1;return r>-1&&r===s&&Rs(t.matched[r],n.matched[s])&&Pf(t.params,n.params)&&e(t.query)===e(n.query)&&t.hash===n.hash}function Rs(e,t){return(e.aliasOf||e)===(t.aliasOf||t)}function Pf(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(!Pg(e[n],t[n]))return!1;return!0}function Pg(e,t){return qn(e)?Uc(e,t):qn(t)?Uc(t,e):(e==null?void 0:e.valueOf())===(t==null?void 0:t.valueOf())}function Uc(e,t){return qn(t)?e.length===t.length&&e.every((n,r)=>n===t[r]):e.length===1&&e[0]===t}function Mg(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 Rr={path:"/",name:void 0,params:{},query:{},hash:"",fullPath:"/",matched:[],meta:{},redirectedFrom:void 0};let Ja=(function(e){return e.pop="pop",e.push="push",e})({}),pa=(function(e){return e.back="back",e.forward="forward",e.unknown="",e})({});function $g(e){if(!e)if(ys){const t=document.querySelector("base");e=t&&t.getAttribute("href")||"/",e=e.replace(/^\w+:\/\/[^\/]+/,"")}else e="/";return e[0]!=="/"&&e[0]!=="#"&&(e="/"+e),Ag(e)}const Og=/^[^#]+#/;function Ng(e,t){return e.replace(Og,"#")+t}function Dg(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 Di=()=>({left:window.scrollX,top:window.scrollY});function Lg(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=Dg(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 Fc(e,t){return(history.state?history.state.position-t:-1)+e}const Ya=new Map;function jg(e,t){Ya.set(e,t)}function Ug(e){const t=Ya.get(e);return Ya.delete(e),t}function Fg(e){return typeof e=="string"||e&&typeof e=="object"}function Mf(e){return typeof e=="string"||typeof e=="symbol"}let Dt=(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 $f=Symbol("");Dt.MATCHER_NOT_FOUND+"",Dt.NAVIGATION_GUARD_REDIRECT+"",Dt.NAVIGATION_ABORTED+"",Dt.NAVIGATION_CANCELLED+"",Dt.NAVIGATION_DUPLICATED+"";function Ps(e,t){return gt(new Error,{type:e,[$f]:!0},t)}function dr(e,t){return e instanceof Error&&$f in e&&(t==null||!!(e.type&t))}const Bg=["params","query","hash"];function Hg(e){if(typeof e=="string")return e;if(e.path!=null)return e.path;const t={};for(const n of Bg)n in e&&(t[n]=e[n]);return JSON.stringify(t,null,2)}function Wg(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(Cf," "),o=s.indexOf("="),i=vo(o<0?s:s.slice(0,o)),a=o<0?null:vo(s.slice(o+1));if(i in t){let l=t[i];qn(l)||(l=t[i]=[l]),l.push(a)}else t[i]=a}return t}function Bc(e){let t="";for(let n in e){const r=e[n];if(n=Sg(n),r==null){r!==void 0&&(t+=(t.length?"&":"")+n);continue}(qn(r)?r.map(s=>s&&Ka(s)):[r&&Ka(r)]).forEach(s=>{s!==void 0&&(t+=(t.length?"&":"")+n,s!=null&&(t+="="+s))})}return t}function Vg(e){const t={};for(const n in e){const r=e[n];r!==void 0&&(t[n]=qn(r)?r.map(s=>s==null?null:""+s):r==null?r:""+r)}return t}const zg=Symbol(""),Hc=Symbol(""),Li=Symbol(""),$l=Symbol(""),Xa=Symbol("");function qs(){let e=[];function t(r){return e.push(r),()=>{const s=e.indexOf(r);s>-1&&e.splice(s,1)}}function n(){e=[]}return{add:t,list:()=>e.slice(),reset:n}}function Or(e,t,n,r,s,o=i=>i()){const i=r&&(r.enterCallbacks[s]=r.enterCallbacks[s]||[]);return()=>new Promise((a,l)=>{const u=m=>{m===!1?l(Ps(Dt.NAVIGATION_ABORTED,{from:n,to:t})):m instanceof Error?l(m):Fg(m)?l(Ps(Dt.NAVIGATION_GUARD_REDIRECT,{from:t,to:m})):(i&&r.enterCallbacks[s]===i&&typeof m=="function"&&i.push(m),a())},c=o(()=>e.call(r&&r.instances[s],t,n,u));let f=Promise.resolve(c);e.length<3&&(f=f.then(u)),f.catch(m=>l(m))})}function ma(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(If(l)){const u=(l.__vccOpts||l)[t];u&&o.push(Or(u,n,r,i,a,s))}else{let u=l();o.push(()=>u.then(c=>{if(!c)throw new Error(`Couldn't resolve component "${a}" at "${i.path}"`);const f=hg(c)?c.default:c;i.mods[a]=c,i.components[a]=f;const m=(f.__vccOpts||f)[t];return m&&Or(m,n,r,i,a,s)()}))}}return o}function Gg(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(u=>Rs(u,a))?r.push(a):n.push(a));const l=e.matched[i];l&&(t.matched.find(u=>Rs(u,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 qg=()=>location.protocol+"//"+location.host;function Of(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),jc(a,"")}return jc(n,e)+r+s}function Kg(e,t,n,r){let s=[],o=[],i=null;const a=({state:m})=>{const S=Of(e,location),D=n.value,H=t.value;let ee=0;if(m){if(n.value=S,t.value=m,i&&i===D){i=null;return}ee=H?m.position-H.position:0}else r(S);s.forEach(A=>{A(n.value,D,{delta:ee,type:Ja.pop,direction:ee?ee>0?pa.forward:pa.back:pa.unknown})})};function l(){i=n.value}function u(m){s.push(m);const S=()=>{const D=s.indexOf(m);D>-1&&s.splice(D,1)};return o.push(S),S}function c(){if(document.visibilityState==="hidden"){const{history:m}=window;if(!m.state)return;m.replaceState(gt({},m.state,{scroll:Di()}),"")}}function f(){for(const m of o)m();o=[],window.removeEventListener("popstate",a),window.removeEventListener("pagehide",c),document.removeEventListener("visibilitychange",c)}return window.addEventListener("popstate",a),window.addEventListener("pagehide",c),document.addEventListener("visibilitychange",c),{pauseListeners:l,listen:u,destroy:f}}function Wc(e,t,n,r=!1,s=!1){return{back:e,current:t,forward:n,replaced:r,position:window.history.length,scroll:s?Di():null}}function Jg(e){const{history:t,location:n}=window,r={value:Of(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,u,c){const f=e.indexOf("#"),m=f>-1?(n.host&&document.querySelector("base")?e:e.slice(f))+l:qg()+e+l;try{t[c?"replaceState":"pushState"](u,"",m),s.value=u}catch(S){console.error(S),n[c?"replace":"assign"](m)}}function i(l,u){o(l,gt({},t.state,Wc(s.value.back,l,s.value.forward,!0),u,{position:s.value.position}),!0),r.value=l}function a(l,u){const c=gt({},s.value,t.state,{forward:l,scroll:Di()});o(c.current,c,!0),o(l,gt({},Wc(r.value,l,null),{position:c.position+1},u),!1),r.value=l}return{location:r,state:s,push:a,replace:i}}function Yg(e){e=$g(e);const t=Jg(e),n=Kg(e,t.state,t.location,t.replace);function r(o,i=!0){i||n.pauseListeners(),history.go(o)}const s=gt({location:"",base:e,go:r,createHref:Ng.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 Xg(e){return e=location.host?e||location.pathname+location.search:"",e.includes("#")||(e+="#"),Yg(e)}let ss=(function(e){return e[e.Static=0]="Static",e[e.Param=1]="Param",e[e.Group=2]="Group",e})({});var Bt=(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})(Bt||{});const Qg={type:ss.Static,value:""},Zg=/[a-zA-Z0-9_]/;function ev(e){if(!e)return[[]];if(e==="/")return[[Qg]];if(!e.startsWith("/"))throw new Error(`Invalid path "${e}"`);function t(S){throw new Error(`ERR (${n})/"${u}": ${S}`)}let n=Bt.Static,r=n;const s=[];let o;function i(){o&&s.push(o),o=[]}let a=0,l,u="",c="";function f(){u&&(n===Bt.Static?o.push({type:ss.Static,value:u}):n===Bt.Param||n===Bt.ParamRegExp||n===Bt.ParamRegExpEnd?(o.length>1&&(l==="*"||l==="+")&&t(`A repeatable param (${u}) must be alone in its segment. eg: '/:ids+.`),o.push({type:ss.Param,value:u,regexp:c,repeatable:l==="*"||l==="+",optional:l==="*"||l==="?"})):t("Invalid state to consume buffer"),u="")}function m(){u+=l}for(;a<e.length;){if(l=e[a++],l==="\\"&&n!==Bt.ParamRegExp){r=n,n=Bt.EscapeNext;continue}switch(n){case Bt.Static:l==="/"?(u&&f(),i()):l===":"?(f(),n=Bt.Param):m();break;case Bt.EscapeNext:m(),n=r;break;case Bt.Param:l==="("?n=Bt.ParamRegExp:Zg.test(l)?m():(f(),n=Bt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--);break;case Bt.ParamRegExp:l===")"?c[c.length-1]=="\\"?c=c.slice(0,-1)+l:n=Bt.ParamRegExpEnd:c+=l;break;case Bt.ParamRegExpEnd:f(),n=Bt.Static,l!=="*"&&l!=="?"&&l!=="+"&&a--,c="";break;default:t("Unknown state");break}}return n===Bt.ParamRegExp&&t(`Unfinished custom RegExp for param "${u}"`),f(),i(),s}const Vc="[^/]+?",tv={sensitive:!1,strict:!1,start:!0,end:!0};var mn=(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})(mn||{});const nv=/[.+*?^${}()[\]/\\]/g;function rv(e,t){const n=gt({},tv,t),r=[];let s=n.start?"^":"";const o=[];for(const u of e){const c=u.length?[]:[mn.Root];n.strict&&!u.length&&(s+="/");for(let f=0;f<u.length;f++){const m=u[f];let S=mn.Segment+(n.sensitive?mn.BonusCaseSensitive:0);if(m.type===ss.Static)f||(s+="/"),s+=m.value.replace(nv,"\\$&"),S+=mn.Static;else if(m.type===ss.Param){const{value:D,repeatable:H,optional:ee,regexp:A}=m;o.push({name:D,repeatable:H,optional:ee});const R=A||Vc;if(R!==Vc){S+=mn.BonusCustomRegExp;try{`${R}`}catch(F){throw new Error(`Invalid custom RegExp for param "${D}" (${R}): `+F.message)}}let B=H?`((?:${R})(?:/(?:${R}))*)`:`(${R})`;f||(B=ee&&u.length<2?`(?:/${B})`:"/"+B),ee&&(B+="?"),s+=B,S+=mn.Dynamic,ee&&(S+=mn.BonusOptional),H&&(S+=mn.BonusRepeatable),R===".*"&&(S+=mn.BonusWildcard)}c.push(S)}r.push(c)}if(n.strict&&n.end){const u=r.length-1;r[u][r[u].length-1]+=mn.BonusStrict}n.strict||(s+="/?"),n.end?s+="$":n.strict&&!s.endsWith("/")&&(s+="(?:/|$)");const i=new RegExp(s,n.sensitive?"":"i");function a(u){const c=u.match(i),f={};if(!c)return null;for(let m=1;m<c.length;m++){const S=c[m]||"",D=o[m-1];f[D.name]=S&&D.repeatable?S.split("/"):S}return f}function l(u){let c="",f=!1;for(const m of e){(!f||!c.endsWith("/"))&&(c+="/"),f=!1;for(const S of m)if(S.type===ss.Static)c+=S.value;else if(S.type===ss.Param){const{value:D,repeatable:H,optional:ee}=S,A=D in u?u[D]:"";if(qn(A)&&!H)throw new Error(`Provided param "${D}" is an array but it is not repeatable (* or + modifiers)`);const R=qn(A)?A.join("/"):A;if(!R)if(ee)m.length<2&&(c.endsWith("/")?c=c.slice(0,-1):f=!0);else throw new Error(`Missing required param "${D}"`);c+=R}}return c||"/"}return{re:i,score:r,keys:o,parse:a,stringify:l}}function sv(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]===mn.Static+mn.Segment?-1:1:e.length>t.length?t.length===1&&t[0]===mn.Static+mn.Segment?1:-1:0}function Nf(e,t){let n=0;const r=e.score,s=t.score;for(;n<r.length&&n<s.length;){const o=sv(r[n],s[n]);if(o)return o;n++}if(Math.abs(s.length-r.length)===1){if(zc(r))return 1;if(zc(s))return-1}return s.length-r.length}function zc(e){const t=e[e.length-1];return e.length>0&&t[t.length-1]<0}const ov={strict:!1,end:!0,sensitive:!1};function iv(e,t,n){const r=rv(ev(e.path),n),s=gt(r,{record:e,parent:t,children:[],alias:[]});return t&&!s.record.aliasOf==!t.record.aliasOf&&t.children.push(s),s}function av(e,t){const n=[],r=new Map;t=Lc(ov,t);function s(f){return r.get(f)}function o(f,m,S){const D=!S,H=qc(f);H.aliasOf=S&&S.record;const ee=Lc(t,f),A=[H];if("alias"in f){const F=typeof f.alias=="string"?[f.alias]:f.alias;for(const X of F)A.push(qc(gt({},H,{components:S?S.record.components:H.components,path:X,aliasOf:S?S.record:H})))}let R,B;for(const F of A){const{path:X}=F;if(m&&X[0]!=="/"){const ae=m.record.path,ve=ae[ae.length-1]==="/"?"":"/";F.path=m.record.path+(X&&ve+X)}if(R=iv(F,m,ee),S?S.alias.push(R):(B=B||R,B!==R&&B.alias.push(R),D&&f.name&&!Kc(R)&&i(f.name)),Df(R)&&l(R),H.children){const ae=H.children;for(let ve=0;ve<ae.length;ve++)o(ae[ve],R,S&&S.children[ve])}S=S||R}return B?()=>{i(B)}:so}function i(f){if(Mf(f)){const m=r.get(f);m&&(r.delete(f),n.splice(n.indexOf(m),1),m.children.forEach(i),m.alias.forEach(i))}else{const m=n.indexOf(f);m>-1&&(n.splice(m,1),f.record.name&&r.delete(f.record.name),f.children.forEach(i),f.alias.forEach(i))}}function a(){return n}function l(f){const m=uv(f,n);n.splice(m,0,f),f.record.name&&!Kc(f)&&r.set(f.record.name,f)}function u(f,m){let S,D={},H,ee;if("name"in f&&f.name){if(S=r.get(f.name),!S)throw Ps(Dt.MATCHER_NOT_FOUND,{location:f});ee=S.record.name,D=gt(Gc(m.params,S.keys.filter(B=>!B.optional).concat(S.parent?S.parent.keys.filter(B=>B.optional):[]).map(B=>B.name)),f.params&&Gc(f.params,S.keys.map(B=>B.name))),H=S.stringify(D)}else if(f.path!=null)H=f.path,S=n.find(B=>B.re.test(H)),S&&(D=S.parse(H),ee=S.record.name);else{if(S=m.name?r.get(m.name):n.find(B=>B.re.test(m.path)),!S)throw Ps(Dt.MATCHER_NOT_FOUND,{location:f,currentLocation:m});ee=S.record.name,D=gt({},m.params,f.params),H=S.stringify(D)}const A=[];let R=S;for(;R;)A.unshift(R.record),R=R.parent;return{name:ee,path:H,params:D,matched:A,meta:cv(A)}}e.forEach(f=>o(f));function c(){n.length=0,r.clear()}return{addRoute:o,resolve:u,removeRoute:i,clearRoutes:c,getRoutes:a,getRecordMatcher:s}}function Gc(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function qc(e){const t={path:e.path,redirect:e.redirect,name:e.name,meta:e.meta||{},aliasOf:e.aliasOf,beforeEnter:e.beforeEnter,props:lv(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 lv(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 Kc(e){for(;e;){if(e.record.aliasOf)return!0;e=e.parent}return!1}function cv(e){return e.reduce((t,n)=>gt(t,n.meta),{})}function uv(e,t){let n=0,r=t.length;for(;n!==r;){const o=n+r>>1;Nf(e,t[o])<0?r=o:n=o+1}const s=dv(e);return s&&(r=t.lastIndexOf(s,r-1)),r}function dv(e){let t=e;for(;t=t.parent;)if(Df(t)&&Nf(e,t)===0)return t}function Df({record:e}){return!!(e.name||e.components&&Object.keys(e.components).length||e.redirect)}function Jc(e){const t=Hn(Li),n=Hn($l),r=ie(()=>{const l=be(e.to);return t.resolve(l)}),s=ie(()=>{const{matched:l}=r.value,{length:u}=l,c=l[u-1],f=n.matched;if(!c||!f.length)return-1;const m=f.findIndex(Rs.bind(null,c));if(m>-1)return m;const S=Yc(l[u-2]);return u>1&&Yc(c)===S&&f[f.length-1].path!==S?f.findIndex(Rs.bind(null,l[u-2])):m}),o=ie(()=>s.value>-1&&gv(n.params,r.value.params)),i=ie(()=>s.value>-1&&s.value===n.matched.length-1&&Pf(n.params,r.value.params));function a(l={}){if(mv(l)){const u=t[be(e.replace)?"replace":"push"](be(e.to)).catch(so);return e.viewTransition&&typeof document<"u"&&"startViewTransition"in document&&document.startViewTransition(()=>u),u}return Promise.resolve()}return{route:r,href:ie(()=>r.value.href),isActive:o,isExactActive:i,navigate:a}}function fv(e){return e.length===1?e[0]:e}const hv=Wt({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:Jc,setup(e,{slots:t}){const n=xi(Jc(e)),{options:r}=Hn(Li),s=ie(()=>({[Xc(e.activeClass,r.linkActiveClass,"router-link-active")]:n.isActive,[Xc(e.exactActiveClass,r.linkExactActiveClass,"router-link-exact-active")]:n.isExactActive}));return()=>{const o=t.default&&fv(t.default(n));return e.custom?o:Pl("a",{"aria-current":n.isExactActive?e.ariaCurrentValue:null,href:n.href,onClick:n.navigate,class:s.value},o)}}}),pv=hv;function mv(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 gv(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(!qn(s)||s.length!==r.length||r.some((o,i)=>o.valueOf()!==s[i].valueOf()))return!1}return!0}function Yc(e){return e?e.aliasOf?e.aliasOf.path:e.path:""}const Xc=(e,t,n)=>e??t??n,vv=Wt({name:"RouterView",inheritAttrs:!1,props:{name:{type:String,default:"default"},route:Object},compatConfig:{MODE:3},setup(e,{attrs:t,slots:n}){const r=Hn(Xa),s=ie(()=>e.route||r.value),o=Hn(Hc,0),i=ie(()=>{let u=be(o);const{matched:c}=s.value;let f;for(;(f=c[u])&&!f.components;)u++;return u}),a=ie(()=>s.value.matched[i.value]);Xo(Hc,ie(()=>i.value+1)),Xo(zg,a),Xo(Xa,s);const l=O();return at(()=>[l.value,a.value,e.name],([u,c,f],[m,S,D])=>{c&&(c.instances[f]=u,S&&S!==c&&u&&u===m&&(c.leaveGuards.size||(c.leaveGuards=S.leaveGuards),c.updateGuards.size||(c.updateGuards=S.updateGuards))),u&&c&&(!S||!Rs(c,S)||!m)&&(c.enterCallbacks[f]||[]).forEach(H=>H(u))},{flush:"post"}),()=>{const u=s.value,c=e.name,f=a.value,m=f&&f.components[c];if(!m)return Qc(n.default,{Component:m,route:u});const S=f.props[c],D=S?S===!0?u.params:typeof S=="function"?S(u):S:null,ee=Pl(m,gt({},D,t,{onVnodeUnmounted:A=>{A.component.isUnmounted&&(f.instances[c]=null)},ref:l}));return Qc(n.default,{Component:ee,route:u})||ee}}});function Qc(e,t){if(!e)return null;const n=e(t);return n.length===1?n[0]:n}const yv=vv;function wv(e){const t=av(e.routes,e),n=e.parseQuery||Wg,r=e.stringifyQuery||Bc,s=e.history,o=qs(),i=qs(),a=qs(),l=vp(Rr);let u=Rr;ys&&e.scrollBehavior&&"scrollRestoration"in history&&(history.scrollRestoration="manual");const c=fa.bind(null,K=>""+K),f=fa.bind(null,Eg),m=fa.bind(null,vo);function S(K,pe){let he,Ee;return Mf(K)?(he=t.getRecordMatcher(K),Ee=pe):Ee=K,t.addRoute(Ee,he)}function D(K){const pe=t.getRecordMatcher(K);pe&&t.removeRoute(pe)}function H(){return t.getRoutes().map(K=>K.record)}function ee(K){return!!t.getRecordMatcher(K)}function A(K,pe){if(pe=gt({},pe||l.value),typeof K=="string"){const M=ha(n,K,pe.path),q=t.resolve({path:M.path},pe),Q=s.createHref(M.fullPath);return gt(M,q,{params:m(q.params),hash:vo(M.hash),redirectedFrom:void 0,href:Q})}let he;if(K.path!=null)he=gt({},K,{path:ha(n,K.path,pe.path).path});else{const M=gt({},K.params);for(const q in M)M[q]==null&&delete M[q];he=gt({},K,{params:f(M)}),pe.params=f(pe.params)}const Ee=t.resolve(he,pe),Se=K.hash||"";Ee.params=c(m(Ee.params));const b=xg(r,gt({},K,{hash:Tg(Se),path:Ee.path})),T=s.createHref(b);return gt({fullPath:b,hash:Se,query:r===Bc?Vg(K.query):K.query||{}},Ee,{redirectedFrom:void 0,href:T})}function R(K){return typeof K=="string"?ha(n,K,l.value.path):gt({},K)}function B(K,pe){if(u!==K)return Ps(Dt.NAVIGATION_CANCELLED,{from:pe,to:K})}function F(K){return ve(K)}function X(K){return F(gt(R(K),{replace:!0}))}function ae(K,pe){const he=K.matched[K.matched.length-1];if(he&&he.redirect){const{redirect:Ee}=he;let Se=typeof Ee=="function"?Ee(K,pe):Ee;return typeof Se=="string"&&(Se=Se.includes("?")||Se.includes("#")?Se=R(Se):{path:Se},Se.params={}),gt({query:K.query,hash:K.hash,params:Se.path!=null?{}:K.params},Se)}}function ve(K,pe){const he=u=A(K),Ee=l.value,Se=K.state,b=K.force,T=K.replace===!0,M=ae(he,Ee);if(M)return ve(gt(R(M),{state:typeof M=="object"?gt({},Se,M.state):Se,force:b,replace:T}),pe||he);const q=he;q.redirectedFrom=pe;let Q;return!b&&Rg(r,Ee,he)&&(Q=Ps(Dt.NAVIGATION_DUPLICATED,{to:q,from:Ee}),Oe(Ee,Ee,!0,!1)),(Q?Promise.resolve(Q):fe(q,Ee)).catch(V=>dr(V)?dr(V,Dt.NAVIGATION_GUARD_REDIRECT)?V:tt(V):De(V,q,Ee)).then(V=>{if(V){if(dr(V,Dt.NAVIGATION_GUARD_REDIRECT))return ve(gt({replace:T},R(V.to),{state:typeof V.to=="object"?gt({},Se,V.to.state):Se,force:b}),pe||q)}else V=z(q,Ee,!0,T,Se);return _e(q,Ee,V),V})}function ke(K,pe){const he=B(K,pe);return he?Promise.reject(he):Promise.resolve()}function ue(K){const pe=ct.values().next().value;return pe&&typeof pe.runWithContext=="function"?pe.runWithContext(K):K()}function fe(K,pe){let he;const[Ee,Se,b]=Gg(K,pe);he=ma(Ee.reverse(),"beforeRouteLeave",K,pe);for(const M of Ee)M.leaveGuards.forEach(q=>{he.push(Or(q,K,pe))});const T=ke.bind(null,K,pe);return he.push(T),Je(he).then(()=>{he=[];for(const M of o.list())he.push(Or(M,K,pe));return he.push(T),Je(he)}).then(()=>{he=ma(Se,"beforeRouteUpdate",K,pe);for(const M of Se)M.updateGuards.forEach(q=>{he.push(Or(q,K,pe))});return he.push(T),Je(he)}).then(()=>{he=[];for(const M of b)if(M.beforeEnter)if(qn(M.beforeEnter))for(const q of M.beforeEnter)he.push(Or(q,K,pe));else he.push(Or(M.beforeEnter,K,pe));return he.push(T),Je(he)}).then(()=>(K.matched.forEach(M=>M.enterCallbacks={}),he=ma(b,"beforeRouteEnter",K,pe,ue),he.push(T),Je(he))).then(()=>{he=[];for(const M of i.list())he.push(Or(M,K,pe));return he.push(T),Je(he)}).catch(M=>dr(M,Dt.NAVIGATION_CANCELLED)?M:Promise.reject(M))}function _e(K,pe,he){a.list().forEach(Ee=>ue(()=>Ee(K,pe,he)))}function z(K,pe,he,Ee,Se){const b=B(K,pe);if(b)return b;const T=pe===Rr,M=ys?history.state:{};he&&(Ee||T?s.replace(K.fullPath,gt({scroll:T&&M&&M.scroll},Se)):s.push(K.fullPath,Se)),l.value=K,Oe(K,pe,he,T),tt()}let Te;function Ne(){Te||(Te=s.listen((K,pe,he)=>{if(!Ze.listening)return;const Ee=A(K),Se=ae(Ee,Ze.currentRoute.value);if(Se){ve(gt(Se,{replace:!0,force:!0}),Ee).catch(so);return}u=Ee;const b=l.value;ys&&jg(Fc(b.fullPath,he.delta),Di()),fe(Ee,b).catch(T=>dr(T,Dt.NAVIGATION_ABORTED|Dt.NAVIGATION_CANCELLED)?T:dr(T,Dt.NAVIGATION_GUARD_REDIRECT)?(ve(gt(R(T.to),{force:!0}),Ee).then(M=>{dr(M,Dt.NAVIGATION_ABORTED|Dt.NAVIGATION_DUPLICATED)&&!he.delta&&he.type===Ja.pop&&s.go(-1,!1)}).catch(so),Promise.reject()):(he.delta&&s.go(-he.delta,!1),De(T,Ee,b))).then(T=>{T=T||z(Ee,b,!1),T&&(he.delta&&!dr(T,Dt.NAVIGATION_CANCELLED)?s.go(-he.delta,!1):he.type===Ja.pop&&dr(T,Dt.NAVIGATION_ABORTED|Dt.NAVIGATION_DUPLICATED)&&s.go(-1,!1)),_e(Ee,b,T)}).catch(so)}))}let Ue=qs(),Ae=qs(),$e;function De(K,pe,he){tt(K);const Ee=Ae.list();return Ee.length?Ee.forEach(Se=>Se(K,pe,he)):console.error(K),Promise.reject(K)}function ze(){return $e&&l.value!==Rr?Promise.resolve():new Promise((K,pe)=>{Ue.add([K,pe])})}function tt(K){return $e||($e=!K,Ne(),Ue.list().forEach(([pe,he])=>K?he(K):pe()),Ue.reset()),K}function Oe(K,pe,he,Ee){const{scrollBehavior:Se}=e;if(!ys||!Se)return Promise.resolve();const b=!he&&Ug(Fc(K.fullPath,0))||(Ee||!he)&&history.state&&history.state.scroll||null;return Xt().then(()=>Se(K,pe,b)).then(T=>T&&Lg(T)).catch(T=>De(T,K,pe))}const Qe=K=>s.go(K);let wt;const ct=new Set,Ze={currentRoute:l,listening:!0,addRoute:S,removeRoute:D,clearRoutes:t.clearRoutes,hasRoute:ee,getRoutes:H,resolve:A,options:e,push:F,replace:X,go:Qe,back:()=>Qe(-1),forward:()=>Qe(1),beforeEach:o.add,beforeResolve:i.add,afterEach:a.add,onError:Ae.add,isReady:ze,install(K){K.component("RouterLink",pv),K.component("RouterView",yv),K.config.globalProperties.$router=Ze,Object.defineProperty(K.config.globalProperties,"$route",{enumerable:!0,get:()=>be(l)}),ys&&!wt&&l.value===Rr&&(wt=!0,F(s.location).catch(Ee=>{}));const pe={};for(const Ee in Rr)Object.defineProperty(pe,Ee,{get:()=>l.value[Ee],enumerable:!0});K.provide(Li,Ze),K.provide($l,Pd(pe)),K.provide(Xa,l);const he=K.unmount;ct.add(K),K.unmount=function(){ct.delete(K),ct.size<1&&(u=Rr,Te&&Te(),Te=null,l.value=Rr,wt=!1,$e=!1),he()}}};function Je(K){return K.reduce((pe,he)=>pe.then(()=>ue(he)),Promise.resolve())}return Ze}function bv(){return Hn(Li)}function _v(e){return Hn($l)}const Zc=768;function Lf(){const e=O(typeof window<"u"?window.innerWidth<Zc:!1);let t=null;function n(r){e.value=r.matches}return ar(()=>{t=window.matchMedia(`(max-width: ${Zc-1}px)`),e.value=t.matches,t.addEventListener("change",n)}),So(()=>{t==null||t.removeEventListener("change",n)}),{isMobile:e}}const kv={key:0,class:"desktop-sidebar"},Tv={class:"desktop-main"},eu="codex-web-local.sidebar-width.v1",Sv=260,Iv=620,tu=320,nu="100dvh",Ev=Wt({__name:"DesktopLayout",props:{isSidebarCollapsed:{type:Boolean,default:!1}},emits:["close-sidebar"],setup(e){const t=e,{isMobile:n}=Lf();function r(D){return Math.min(Iv,Math.max(Sv,D))}function s(){if(typeof window>"u")return tu;const D=window.localStorage.getItem(eu),H=Number(D);return Number.isFinite(H)?r(H):tu}const o=O(s()),i=O(nu);function a(){var H;if(typeof window>"u")return nu;const D=((H=window.visualViewport)==null?void 0:H.height)??window.innerHeight;return`${Math.max(Math.round(D),0)}px`}let l=0;function u(){i.value=a()}function c(){l||(l=window.requestAnimationFrame(()=>{l=0,u()}))}const f=ie(()=>{const D={"--layout-height":i.value};return n.value||t.isSidebarCollapsed?{...D,"--sidebar-width":"0px","--layout-columns":"minmax(0, 1fr)"}:{...D,"--sidebar-width":`${o.value}px`,"--layout-columns":"var(--sidebar-width) 1px minmax(0, 1fr)"}});function m(D){typeof window>"u"||window.localStorage.setItem(eu,String(D))}function S(D){D.preventDefault();const H=D.clientX,ee=o.value,A=B=>{const F=B.clientX-H;o.value=r(ee+F)},R=()=>{m(o.value),window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",R)};window.addEventListener("mousemove",A),window.addEventListener("mouseup",R)}return ar(()=>{var D,H;u(),window.addEventListener("resize",c),(D=window.visualViewport)==null||D.addEventListener("resize",c),(H=window.visualViewport)==null||H.addEventListener("scroll",c)}),So(()=>{var D,H;l&&(cancelAnimationFrame(l),l=0),window.removeEventListener("resize",c),(D=window.visualViewport)==null||D.removeEventListener("resize",c),(H=window.visualViewport)==null||H.removeEventListener("scroll",c)}),(D,H)=>(v(),E("div",{class:st(["desktop-layout",{"is-mobile":be(n)}]),style:Fr(f.value)},[be(n)?(v(),dt(ci,{key:0,to:"body"},[Pe(Sf,{name:"drawer"},{default:bt(()=>[e.isSidebarCollapsed?ce("",!0):(v(),E("div",{key:0,class:"mobile-drawer-backdrop",onClick:H[1]||(H[1]=ee=>D.$emit("close-sidebar"))},[h("aside",{class:"mobile-drawer",onClick:H[0]||(H[0]=rt(()=>{},["stop"]))},[rr(D.$slots,"sidebar",{},void 0,!0)])]))]),_:3})])):ce("",!0),be(n)?ce("",!0):(v(),E(Ve,{key:1},[e.isSidebarCollapsed?ce("",!0):(v(),E("aside",kv,[rr(D.$slots,"sidebar",{},void 0)])),e.isSidebarCollapsed?ce("",!0):(v(),E("button",{key:1,class:"desktop-resize-handle",type:"button","aria-label":"Resize sidebar",onMousedown:S},null,32))],64)),h("section",Tv,[rr(D.$slots,"content",{},void 0)])],6))}}),lt=(e,t)=>{const n=e.__vccOpts||e;for(const[r,s]of t)n[r]=s;return n},Cv=lt(Ev,[["__scopeId","data-v-d24ef967"]]),Av={},xv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Rv(e,t){return v(),E("svg",xv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m6 9l6 6l6-6"},null,-1)])])}const ji=lt(Av,[["render",Rv]]),Pv={},Mv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $v(e,t){return v(),E("svg",Mv,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 6l6 6l-6 6"},null,-1)])])}const jf=lt(Pv,[["render",$v]]),Ov={},Nv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Dv(e,t){return v(),E("svg",Nv,[...t[0]||(t[0]=[h("path",{fill:"currentColor",d:"M6 12a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4m6 0a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const Ks=lt(Ov,[["render",Dv]]),Lv={},jv={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function Uv(e,t){return v(),E("svg",jv,[...t[0]||(t[0]=[h("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 mi=lt(Lv,[["render",Uv]]),Fv={},Bv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Hv(e,t){return v(),E("svg",Bv,[...t[0]||(t[0]=[h("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 Ui=lt(Fv,[["render",Hv]]),Wv={},Vv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function zv(e,t){return v(),E("svg",Vv,[...t[0]||(t[0]=[h("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 Gv=lt(Wv,[["render",zv]]),qv={},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 v(),E("svg",Kv,[...t[0]||(t[0]=[h("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 ti=lt(qv,[["render",Jv]]),Yv={},Xv={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Qv(e,t){return v(),E("svg",Xv,[...t[0]||(t[0]=[h("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 ga=lt(Yv,[["render",Qv]]),Zv={key:0,class:"sidebar-menu-row-left"},ey={class:"sidebar-menu-row-main"},ty={key:1,class:"sidebar-menu-row-right"},ny={key:0,class:"sidebar-menu-row-right-default"},ry={key:1,class:"sidebar-menu-row-right-hover"},sy=Wt({inheritAttrs:!1,__name:"SidebarMenuRow",props:{as:{default:"div"},forceRightHover:{type:Boolean,default:!1}},setup(e){const t=e,n=Kp(),r=ie(()=>!!n.left),s=ie(()=>!!n.right),o=ie(()=>!!n["right-hover"]),i=ie(()=>s.value||o.value);return(a,l)=>(v(),dt(di(t.as),yf({class:"sidebar-menu-row","data-has-left":r.value,"data-has-right":i.value,"data-has-right-hover":o.value,"data-force-right-hover":t.forceRightHover},a.$attrs),{default:bt(()=>[r.value?(v(),E("span",Zv,[rr(a.$slots,"left",{},void 0,!0)])):ce("",!0),h("span",ey,[rr(a.$slots,"default",{},void 0,!0)]),i.value?(v(),E("span",ty,[s.value?(v(),E("span",ny,[rr(a.$slots,"right",{},void 0,!0)])):ce("",!0),o.value?(v(),E("span",ry,[rr(a.$slots,"right-hover",{},void 0,!0)])):ce("",!0)])):ce("",!0)]),_:3},16,["data-has-left","data-has-right","data-has-right-hover","data-force-right-hover"]))}}),Zr=lt(sy,[["__scopeId","data-v-daeca4df"]]),oy={class:"thread-tree-root"},iy={key:0,class:"pinned-section"},ay={class:"thread-list"},ly={class:"thread-left-stack"},cy=["data-state"],uy=["onClick"],dy=["onClick"],fy={class:"thread-row-title-wrap"},hy={class:"thread-row-title"},py={class:"thread-row-time"},my=["onClick"],gy=["onClick"],vy=["onClick"],yy=["onClick"],wy=["onClick"],by=["onClick"],_y=["aria-expanded"],ky=["data-active"],Ty={key:0},Sy=["data-active"],Iy={key:0},Ey={key:1,class:"thread-tree-no-results"},Cy={key:2,class:"thread-tree-loading"},Ay={key:3,class:"thread-list thread-list-global"},xy={class:"thread-left-stack"},Ry=["data-state"],Py=["onClick"],My=["onClick"],$y={class:"thread-row-title-wrap"},Oy={class:"thread-row-title"},Ny={class:"thread-row-time"},Dy=["onClick"],Ly=["onClick"],jy=["onClick"],Uy=["onClick"],Fy=["onClick"],By=["onClick"],Hy=["data-project-name","data-expanded","data-dragging"],Wy={class:"project-icon-stack"},Vy={class:"project-icon-folder"},zy={class:"project-icon-chevron"},Gy=["data-dragging-handle","onMousedown"],qy={class:"project-title"},Ky={class:"project-hover-controls"},Jy=["onClick"],Yy=["onClick"],Xy=["onClick"],Qy=["onInput"],Zy=["aria-label","title","onClick"],ew={key:0,class:"thread-list"},tw={class:"thread-left-stack"},nw=["data-state"],rw=["onClick"],sw=["onClick"],ow={class:"thread-row-title-wrap"},iw={class:"thread-row-title"},aw={class:"thread-row-time"},lw=["onClick"],cw=["onClick"],uw=["onClick"],dw=["onClick"],fw=["onClick"],hw=["onClick"],pw=["onClick"],mw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Thread title"},gw=["onKeydown"],vw={class:"rename-thread-panel",role:"dialog","aria-modal":"true","aria-label":"Delete thread"},yw={class:"rename-thread-subtitle"},ww=4,ru=6,su="codex-web-local.thread-view-mode.v1",ou="codex-web-local.collapsed-projects.v1",bw=Wt({__name:"SidebarThreadTree",props:{groups:{},projectDisplayNameById:{},selectedThreadId:{},isLoading:{type:Boolean},searchQuery:{},searchMatchedThreadIds:{}},emits:["select","archive","start-new-thread","browse-thread-files","rename-project","rename-thread","remove-project","reorder-project","export-thread","fork-thread"],setup(e,{emit:t}){const n=e,r=t,s=O({}),o=O({}),i=O([]),a=O(""),l=O(""),u=O("actions"),c=O(""),f=O(!1),m=O(""),S=O(""),D=O(null),H=O(!1),ee=O(""),A=O(""),R=O(null),B=O(null),F=O(null);let X=null,ae=null;const ve=O(""),ke=O({}),ue=new Map,fe=new Map,_e=new Map,z=new WeakMap,Te=O(null),Ne=O(!1),Ue=O(De()),Ae=typeof window<"u"?new ResizeObserver(k=>{for(const $ of k){const N=$.target,J=z.get(N);J&&Ut(J,N)}}):null;function $e(){if(typeof window>"u")return{};try{const k=window.localStorage.getItem(ou);if(!k)return{};const $=JSON.parse(k);return!$||typeof $!="object"||Array.isArray($)?{}:$}catch{return{}}}function De(){return typeof window>"u"?"project":window.localStorage.getItem(su)==="chronological"?"chronological":"project"}o.value=$e(),at(o,k=>{typeof window>"u"||window.localStorage.setItem(ou,JSON.stringify(k))},{deep:!0}),at(Ue,k=>{typeof window>"u"||window.localStorage.setItem(su,k)});const ze=ie(()=>n.searchQuery.trim().toLowerCase()),tt=ie(()=>ze.value.length>0),Oe=ie(()=>n.searchMatchedThreadIds?new Set(n.searchMatchedThreadIds):null),Qe=ie(()=>new Set(i.value));function wt(k){if(!tt.value)return!0;if(Oe.value)return Oe.value.has(k.id);const $=ze.value;return k.title.toLowerCase().includes($)||k.preview.toLowerCase().includes($)}const ct=ie(()=>tt.value?n.groups.map(k=>({...k,threads:k.threads.filter(wt)})).filter(k=>k.threads.length>0):n.groups),Ze=ie(()=>Ue.value==="chronological"),Je=ie(()=>{const k=ct.value,$=[];for(const N of k)for(const J of N.threads)Qe.value.has(J.id)||$.push(J);return $.sort((N,J)=>{const je=new Date(N.updatedAtIso||N.createdAtIso).getTime();return new Date(J.updatedAtIso||J.createdAtIso).getTime()-je})}),K=ie(()=>{const k=new Map;for(const $ of n.groups)for(const N of $.threads)k.set(N.id,N);return k}),pe=ie(()=>{const k=new Map;for(const $ of n.groups)for(const N of $.threads)k.set(N.id,$.projectName);return k}),he=ie(()=>{const k=new Map;for(const $ of n.groups){const N=$.threads.filter(J=>!Qe.value.has(J.id));k.set($.projectName,N)}return k}),Ee=ie(()=>{const k=new Map;for(const $ of n.groups)for(const N of $.threads){const J=new Date(N.updatedAtIso||N.createdAtIso).getTime();k.set(N.id,J)}return k}),Se=ie(()=>i.value.map(k=>K.value.get(k)??null).filter(k=>k!==null).filter(wt)),b=ie(()=>{const k=F.value;if(!k||k.dropTargetIndexFull===null||n.groups.length===0)return null;const $=Math.max(0,Math.min(k.dropTargetIndexFull,n.groups.length)),N=$>k.fromIndex?$-1:$,J=Math.max(0,Math.min(N,n.groups.length-1));return J===k.fromIndex?null:J}),T=ie(()=>{const $=(tt.value?ct.value:n.groups).map(Tn=>Tn.projectName),N=F.value,J=b.value;if(!N||J===null)return $;const je=[...$],[Ft]=je.splice(N.fromIndex,1);return Ft?(je.splice(J,0,Ft),je):$}),M=ie(()=>{const k={};let $=0;for(const N of T.value)k[N]=$,$+=$t(N);return k}),q=ie(()=>{let k=0;for(const $ of T.value)k+=$t($);return{height:`${Math.max(0,k)}px`}});function Q(k){if(Number.isNaN(k))return"n/a";const $=Math.abs(Date.now()-k);if($<6e4)return"now";const N=Math.floor($/6e4);if(N<60)return`${N}m`;const J=Math.floor(N/60);return J<24?`${J}h`:`${Math.floor(J/24)}d`}function V(k){const $=Ee.value.get(k.id);return Q(typeof $=="number"?$:new Date(k.updatedAtIso||k.createdAtIso).getTime())}function me(k){return Qe.value.has(k)}function oe(k){if(me(k)){i.value=i.value.filter($=>$!==k);return}i.value=[k,...i.value]}function W(k){r("select",k)}function U(k){r("export-thread",k),Me()}function te(k){r("fork-thread",k),Me()}function se(k){return`start new thread ${mt(k)}`}function de(k){r("start-new-thread",k)}function Ie(k){r("browse-thread-files",k),Me()}function We(k){l.value===k&&Me()}function Fe(k){return l.value===k}function Me(){l.value=""}function Ye(k){if(l.value===k){Me();return}l.value=k}function et(k,$){k.preventDefault(),l.value=$}function xt(k,$){m.value=k,S.value=$,f.value=!0,Me(),Xt(()=>{var N,J;(N=D.value)==null||N.focus(),(J=D.value)==null||J.select()})}function ft(){f.value=!1,m.value="",S.value=""}function Ct(){const k=m.value,$=S.value.trim();!k||!$||(r("rename-thread",{threadId:k,title:$}),ft())}function Lt(k,$){ee.value=k,A.value=$,H.value=!0,Me()}function pt(){H.value=!1,ee.value="",A.value=""}function Pt(){const k=ee.value;k&&(i.value=i.value.filter($=>$!==k),r("archive",k),pt())}function mt(k){return n.projectDisplayNameById[k]??k}function Vt(k){return a.value===k}function nt(){a.value="",u.value="actions",c.value=""}function bn(){Ne.value=!Ne.value}function zt(k){Ue.value=k,Ne.value=!1}function Mt(k){if(a.value===k){nt();return}a.value=k,u.value="actions",c.value=mt(k)}function un(k){a.value=k,u.value="rename",c.value=mt(k)}function kt(k){r("rename-project",{projectName:k,displayName:c.value})}function It(k){r("remove-project",k),nt()}function en(k,$){if(!k.altKey||k.key!=="ArrowUp"&&k.key!=="ArrowDown")return;const N=n.groups.findIndex(Ft=>Ft.projectName===$);if(N<0)return;const J=k.key==="ArrowUp"?-1:1,je=Math.max(0,Math.min(N+J,n.groups.length-1));je!==N&&(k.preventDefault(),r("reorder-project",{projectName:$,toIndex:je}))}function jt(k){return s.value[k]===!0}function At(k){return o.value[k]===!0}function Gt(k){s.value={...s.value,[k]:!jt(k)}}function In(k){if(ve.value===k){ve.value="";return}o.value={...o.value,[k]:!At(k)}}function $t(k){const $=ke.value[k]??0,N=F.value,je=((N==null?void 0:N.projectName)===k?N.groupHeight:null)??$,Ft=At(k)?0:ru;return Math.max(0,je+Ft)}function En(k,$){const N=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(N){fe.set(k,N);return}fe.delete(k)}function Yt(k,$){const N=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(N){_e.set(k,N);return}_e.delete(k)}function He(k){const $=a.value;if(!$)return!1;const N=fe.get($);if(!N)return!1;if((typeof k.composedPath=="function"?k.composedPath():[]).includes(N))return!0;const je=k.target;return je instanceof Node?N.contains(je):!1}function Le(k){const $=l.value;if(!$)return!1;const N=_e.get($);if(!N)return!1;if((typeof k.composedPath=="function"?k.composedPath():[]).includes(N))return!0;const je=k.target;return je instanceof Node?N.contains(je):!1}function qt(k){if(Ne.value){const $=Te.value,N=typeof k.composedPath=="function"?k.composedPath():[];!!$&&(N.includes($)||k.target instanceof Node&&$.contains(k.target))||(Ne.value=!1)}a.value&&(He(k)||nt(),l.value&&(Le(k)||Me()))}function dn(k){a.value&&!He(k)&&nt(),l.value&&!Le(k)&&Me()}function Pn(){Ne.value&&(Ne.value=!1),a.value&&nt(),l.value&&Me()}function _n(){window.addEventListener("pointerdown",qt,{capture:!0}),window.addEventListener("focusin",dn,{capture:!0}),window.addEventListener("blur",Pn)}function Kt(){window.removeEventListener("pointerdown",qt,{capture:!0}),window.removeEventListener("focusin",dn,{capture:!0}),window.removeEventListener("blur",Pn)}function Ut(k,$){const N=$.getBoundingClientRect().height;if(!Number.isFinite(N)||N<=0)return;const J=ke.value[k];J!==void 0&&Math.abs(J-N)<.5||(ke.value={...ke.value,[k]:N})}function tn(k,$){const N=ue.get(k);N&&N!==$&&Ae&&Ae.unobserve(N);const J=$ instanceof HTMLElement?$:$&&"$el"in $&&$.$el instanceof HTMLElement?$.$el:null;if(J){ue.set(k,J),z.set(J,k),Ut(k,J),Ae==null||Ae.observe(J);return}N&&(Ae==null||Ae.unobserve(N)),ue.delete(k)}function fn(k,$){if(k.button!==0||B.value||F.value)return;const N=n.groups.findIndex(Tn=>Tn.projectName===$),J=ue.get($);if(N<0||!J)return;const je=J.getBoundingClientRect(),Ft=At($)?0:ru;B.value={projectName:$,fromIndex:N,startClientX:k.clientX,startClientY:k.clientY,pointerOffsetY:k.clientY-je.top,groupLeft:je.left,groupWidth:je.width,groupHeight:je.height,groupOuterHeight:je.height+Ft},k.preventDefault(),Un()}function Un(){window.addEventListener("mousemove",$n),window.addEventListener("mouseup",kn),window.addEventListener("keydown",Cn)}function Mn(){window.removeEventListener("mousemove",$n),window.removeEventListener("mouseup",kn),window.removeEventListener("keydown",Cn)}function $n(k){X={clientX:k.clientX,clientY:k.clientY},w()}function kn(k){I({clientX:k.clientX,clientY:k.clientY});const $=F.value;if($&&b.value!==null){const N=n.groups.findIndex(J=>J.projectName===$.projectName);if(N>=0){const J=b.value;J!==N&&r("reorder-project",{projectName:$.projectName,toIndex:J})}}On()}function Cn(k){k.key==="Escape"&&(!B.value&&!F.value||(k.preventDefault(),On()))}function On(){ae!==null&&(window.cancelAnimationFrame(ae),ae=null),X=null,B.value=null,F.value=null,ve.value="",Mn()}function w(){ae===null&&(ae=window.requestAnimationFrame(()=>{if(ae=null,!X)return;const k=X;X=null,I(k)}))}function I(k){const $=B.value;if(!F.value&&$){const N=k.clientX-$.startClientX,J=k.clientY-$.startClientY;if(Math.hypot(N,J)<ww)return;nt(),ve.value=$.projectName,F.value={projectName:$.projectName,fromIndex:$.fromIndex,pointerOffsetY:$.pointerOffsetY,groupLeft:$.groupLeft,groupWidth:$.groupWidth,groupHeight:$.groupHeight,groupOuterHeight:$.groupOuterHeight,ghostTop:k.clientY-$.pointerOffsetY,dropTargetIndexFull:null}}F.value&&x(k)}function x(k){const $=F.value;if(!$)return;if($.ghostTop=k.clientY-$.pointerOffsetY,!G(k)){$.dropTargetIndexFull=null;return}const N=k.clientY,J=R.value;if(!J){$.dropTargetIndexFull=null;return}const je=J.getBoundingClientRect(),Ft=new Map(n.groups.map((hn,Nn)=>[hn.projectName,Nn])),Tn=n.groups.map(hn=>hn.projectName).filter(hn=>hn!==$.projectName);let ds=0,fs=n.groups.length;for(const hn of Tn){const Nn=Ft.get(hn);if(Nn===void 0)continue;const Vr=$t(hn),js=je.top+ds+Vr/2;if(N<js){fs=Nn;break}ds+=Vr}$.dropTargetIndexFull=fs}function G(k){const $=R.value;if(!$)return!1;const N=$.getBoundingClientRect(),J=k.clientX>=N.left&&k.clientX<=N.right,je=k.clientY>=N.top-32&&k.clientY<=N.bottom+32;return J&&je}function y(k){var $;return(($=F.value)==null?void 0:$.projectName)===k}function C(k){const $=F.value,N=M.value[k]??0,J=l.value?pe.value.get(l.value)??"":"",je=a.value===k||J===k;return!$||$.projectName!==k?{position:"absolute",top:"0",left:"0",right:"0",zIndex:je?"40":"1",transform:`translate3d(0, ${N}px, 0)`,willChange:"transform",transition:"transform 180ms ease"}:{position:"fixed",top:"0",left:`${$.groupLeft}px`,width:`${$.groupWidth}px`,height:`${$.groupHeight}px`,zIndex:"50",pointerEvents:"none",transform:`translate3d(0, ${$.ghostTop}px, 0)`,willChange:"transform",transition:"transform 0ms linear"}}function L(k){return he.value.get(k.projectName)??[]}function Z(k){if(tt.value)return L(k);if(At(k.projectName))return[];const $=L(k);return jt(k.projectName)?$:$.slice(0,10)}function xe(k){return tt.value?!1:!At(k.projectName)&&L(k).length>10}function Xe(k){return L(k).length>0}function ut(k){return k.inProgress?"working":k.unread?"unread":"idle"}at(()=>n.groups.map(k=>k.projectName),k=>{var je,Ft;const $=((je=F.value)==null?void 0:je.projectName)??((Ft=B.value)==null?void 0:Ft.projectName)??"";$&&!n.groups.some(Tn=>Tn.projectName===$)&&On();const N=new Set(k),J=Object.fromEntries(Object.entries(ke.value).filter(([Tn])=>N.has(Tn)));Object.keys(J).length!==Object.keys(ke.value).length&&(ke.value=J)});const Rt=ie(()=>Ne.value||a.value!=="");return at(Rt,k=>{if(k){_n();return}Kt()}),Ar(()=>{for(const k of ue.values())Ae==null||Ae.unobserve(k);ue.clear(),fe.clear(),Kt(),On()}),(k,$)=>(v(),E("section",oy,[Se.value.length>0?(v(),E("section",iy,[h("ul",ay,[(v(!0),E(Ve,null,_t(Se.value,N=>(v(),E("li",{key:N.id,class:"thread-row-item"},[Pe(Zr,{class:"thread-row","data-active":N.id===e.selectedThreadId,"data-pinned":me(N.id),"force-right-hover":Fe(N.id),onMouseleave:J=>We(N.id),onContextmenu:J=>et(J,N.id)},{left:bt(()=>[h("span",ly,[N.inProgress||N.unread?(v(),E("span",{key:0,class:"thread-status-indicator","data-state":ut(N)},null,8,cy)):ce("",!0),h("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:J=>oe(N.id)},[Pe(ga,{class:"thread-icon"})],8,uy)])]),right:bt(()=>[h("span",py,le(V(N)),1)]),"right-hover":bt(()=>[h("div",{ref_for:!0,ref:J=>Yt(N.id,J),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(J=>Ye(N.id),["stop"])},[Pe(Ks,{class:"thread-icon"})],8,my),Fe(N.id)?(v(),E("div",{key:0,class:"thread-menu-panel",onClick:$[0]||($[0]=rt(()=>{},["stop"]))},[h("button",{class:"thread-menu-item",type:"button",onClick:J=>Ie(N.id)}," Browse files ",8,gy),h("button",{class:"thread-menu-item",type:"button",onClick:J=>U(N.id)}," Export chat ",8,vy),h("button",{class:"thread-menu-item",type:"button",onClick:J=>te(N.id)}," Create chat fork ",8,yy),h("button",{class:"thread-menu-item",type:"button",onClick:J=>xt(N.id,N.title)}," Rename thread ",8,wy),h("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:J=>Lt(N.id,N.title)}," Delete thread ",8,by)])):ce("",!0)],512)]),default:bt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:J=>W(N.id)},[h("span",fy,[h("span",hy,le(N.title),1),N.hasWorktree?(v(),dt(ti,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ce("",!0)])],8,dy)]),_:2},1032,["data-active","data-pinned","force-right-hover","onMouseleave","onContextmenu"])]))),128))])])):ce("",!0),Pe(Zr,{as:"header",class:"thread-tree-header-row"},{right:bt(()=>[h("div",{ref_key:"organizeMenuWrapRef",ref:Te,class:"organize-menu-wrap"},[h("button",{class:"organize-menu-trigger",type:"button","aria-expanded":Ne.value,"aria-label":"Organize threads",title:"Organize threads",onClick:bn},[Pe(Ks,{class:"thread-icon"})],8,_y),Ne.value?(v(),E("div",{key:0,class:"organize-menu-panel",onClick:$[3]||($[3]=rt(()=>{},["stop"]))},[$[11]||($[11]=h("p",{class:"organize-menu-title"},"Organize",-1)),h("button",{class:"organize-menu-item","data-active":Ue.value==="project",type:"button",onClick:$[1]||($[1]=N=>zt("project"))},[$[9]||($[9]=h("span",null,"By project",-1)),Ue.value==="project"?(v(),E("span",Ty,"✓")):ce("",!0)],8,ky),h("button",{class:"organize-menu-item","data-active":Ue.value==="chronological",type:"button",onClick:$[2]||($[2]=N=>zt("chronological"))},[$[10]||($[10]=h("span",null,"Chronological list",-1)),Ue.value==="chronological"?(v(),E("span",Iy,"✓")):ce("",!0)],8,Sy)])):ce("",!0)],512)]),default:bt(()=>[$[12]||($[12]=h("span",{class:"thread-tree-header"},"Threads",-1))]),_:1}),tt.value&&ct.value.length===0?(v(),E("p",Ey,"No matching threads")):e.isLoading&&e.groups.length===0?(v(),E("p",Cy,"Loading threads...")):Ze.value?(v(),E("ul",Ay,[(v(!0),E(Ve,null,_t(Je.value,N=>(v(),E("li",{key:N.id,class:"thread-row-item"},[Pe(Zr,{class:"thread-row","data-active":N.id===e.selectedThreadId,"data-pinned":me(N.id),"force-right-hover":Fe(N.id),onMouseleave:J=>We(N.id),onContextmenu:J=>et(J,N.id)},{left:bt(()=>[h("span",xy,[N.inProgress||N.unread?(v(),E("span",{key:0,class:"thread-status-indicator","data-state":ut(N)},null,8,Ry)):ce("",!0),h("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:J=>oe(N.id)},[Pe(ga,{class:"thread-icon"})],8,Py)])]),right:bt(()=>[h("span",Ny,le(V(N)),1)]),"right-hover":bt(()=>[h("div",{ref_for:!0,ref:J=>Yt(N.id,J),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(J=>Ye(N.id),["stop"])},[Pe(Ks,{class:"thread-icon"})],8,Dy),Fe(N.id)?(v(),E("div",{key:0,class:"thread-menu-panel",onClick:$[4]||($[4]=rt(()=>{},["stop"]))},[h("button",{class:"thread-menu-item",type:"button",onClick:J=>Ie(N.id)}," Browse files ",8,Ly),h("button",{class:"thread-menu-item",type:"button",onClick:J=>U(N.id)}," Export chat ",8,jy),h("button",{class:"thread-menu-item",type:"button",onClick:J=>te(N.id)}," Create chat fork ",8,Uy),h("button",{class:"thread-menu-item",type:"button",onClick:J=>xt(N.id,N.title)}," Rename thread ",8,Fy),h("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:J=>Lt(N.id,N.title)}," Delete thread ",8,By)])):ce("",!0)],512)]),default:bt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:J=>W(N.id)},[h("span",$y,[h("span",Oy,le(N.title),1),N.hasWorktree?(v(),dt(ti,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ce("",!0)])],8,My)]),_:2},1032,["data-active","data-pinned","force-right-hover","onMouseleave","onContextmenu"])]))),128))])):(v(),E("div",{key:4,ref_key:"groupsContainerRef",ref:R,class:"thread-tree-groups",style:Fr(q.value)},[(v(!0),E(Ve,null,_t(ct.value,N=>(v(),E("article",{key:N.projectName,ref_for:!0,ref:J=>tn(N.projectName,J),class:"project-group","data-project-name":N.projectName,"data-expanded":!At(N.projectName),"data-dragging":y(N.projectName),style:Fr(C(N.projectName))},[Pe(Zr,{as:"div",class:"project-header-row",role:"button",tabindex:"0",onClick:J=>In(N.projectName),onKeydown:[J=>en(J,N.projectName),vn(rt(J=>In(N.projectName),["prevent"]),["enter"]),vn(rt(J=>In(N.projectName),["prevent"]),["space"])]},{left:bt(()=>[h("span",Wy,[h("span",Vy,[At(N.projectName)?(v(),dt(Ui,{key:0,class:"thread-icon"})):(v(),dt(Gv,{key:1,class:"thread-icon"}))]),h("span",zy,[At(N.projectName)?(v(),dt(jf,{key:0,class:"thread-icon"})):(v(),dt(ji,{key:1,class:"thread-icon"}))])])]),right:bt(()=>[h("div",Ky,[h("div",{ref_for:!0,ref:J=>En(N.projectName,J),class:"project-menu-wrap"},[h("button",{class:"project-menu-trigger",type:"button",title:"project_menu",onClick:rt(J=>Mt(N.projectName),["stop"])},[Pe(Ks,{class:"thread-icon"})],8,Jy),Vt(N.projectName)?(v(),E("div",{key:0,class:"project-menu-panel",onClick:$[6]||($[6]=rt(()=>{},["stop"]))},[u.value==="actions"?(v(),E(Ve,{key:0},[h("button",{class:"project-menu-item",type:"button",onClick:J=>un(N.projectName)}," Edit name ",8,Yy),h("button",{class:"project-menu-item project-menu-item-danger",type:"button",onClick:J=>It(N.projectName)}," Remove ",8,Xy)],64)):(v(),E(Ve,{key:1},[$[13]||($[13]=h("label",{class:"project-menu-label"},"Project name",-1)),Tr(h("input",{"onUpdate:modelValue":$[5]||($[5]=J=>c.value=J),class:"project-menu-input",type:"text",onInput:J=>kt(N.projectName)},null,40,Qy),[[Sr,c.value]])],64))])):ce("",!0)],512),h("button",{class:"thread-start-button",type:"button","aria-label":se(N.projectName),title:se(N.projectName),onClick:rt(J=>de(N.projectName),["stop"])},[Pe(mi,{class:"thread-icon"})],8,Zy)])]),default:bt(()=>[h("span",{class:"project-main-button","data-dragging-handle":y(N.projectName),onMousedown:rt(J=>fn(J,N.projectName),["left"])},[h("span",qy,le(mt(N.projectName)),1)],40,Gy)]),_:2},1032,["onClick","onKeydown"]),Xe(N)?(v(),E("ul",ew,[(v(!0),E(Ve,null,_t(Z(N),J=>(v(),E("li",{key:J.id,class:"thread-row-item"},[Pe(Zr,{class:"thread-row","data-active":J.id===e.selectedThreadId,"data-pinned":me(J.id),"force-right-hover":Fe(J.id),onMouseleave:je=>We(J.id),onContextmenu:je=>et(je,J.id)},{left:bt(()=>[h("span",tw,[J.inProgress||J.unread?(v(),E("span",{key:0,class:"thread-status-indicator","data-state":ut(J)},null,8,nw)):ce("",!0),h("button",{class:"thread-pin-button",type:"button",title:"pin",onClick:je=>oe(J.id)},[Pe(ga,{class:"thread-icon"})],8,rw)])]),right:bt(()=>[h("span",aw,le(V(J)),1)]),"right-hover":bt(()=>[h("div",{ref_for:!0,ref:je=>Yt(J.id,je),class:"thread-menu-wrap"},[h("button",{class:"thread-menu-trigger",type:"button",title:"thread_menu",onClick:rt(je=>Ye(J.id),["stop"])},[Pe(Ks,{class:"thread-icon"})],8,lw),Fe(J.id)?(v(),E("div",{key:0,class:"thread-menu-panel",onClick:$[7]||($[7]=rt(()=>{},["stop"]))},[h("button",{class:"thread-menu-item",type:"button",onClick:je=>Ie(J.id)}," Browse files ",8,cw),h("button",{class:"thread-menu-item",type:"button",onClick:je=>U(J.id)}," Export chat ",8,uw),h("button",{class:"thread-menu-item",type:"button",onClick:je=>te(J.id)}," Create chat fork ",8,dw),h("button",{class:"thread-menu-item",type:"button",onClick:je=>xt(J.id,J.title)}," Rename thread ",8,fw),h("button",{class:"thread-menu-item thread-menu-item-danger",type:"button",onClick:je=>Lt(J.id,J.title)}," Delete thread ",8,hw)])):ce("",!0)],512)]),default:bt(()=>[h("button",{class:"thread-main-button",type:"button",onClick:je=>W(J.id)},[h("span",ow,[h("span",iw,le(J.title),1),J.hasWorktree?(v(),dt(ti,{key:0,class:"thread-row-worktree-icon",title:"Worktree thread"})):ce("",!0)])],8,sw)]),_:2},1032,["data-active","data-pinned","force-right-hover","onMouseleave","onContextmenu"])]))),128))])):(v(),dt(Zr,{key:1,as:"p",class:"project-empty-row"},{left:bt(()=>[...$[14]||($[14]=[h("span",{class:"project-empty-spacer"},null,-1)])]),default:bt(()=>[$[15]||($[15]=h("span",{class:"project-empty"},"No threads",-1))]),_:1})),xe(N)?(v(),dt(Zr,{key:2,class:"thread-show-more-row"},{left:bt(()=>[...$[16]||($[16]=[h("span",{class:"thread-show-more-spacer"},null,-1)])]),default:bt(()=>[h("button",{class:"thread-show-more-button",type:"button",onClick:J=>Gt(N.projectName)},le(jt(N.projectName)?"Show less":"Show more"),9,pw)]),_:2},1024)):ce("",!0)],12,Hy))),128))],4)),(v(),dt(ci,{to:"body"},[f.value?(v(),E("div",{key:0,class:"rename-thread-overlay",onClick:rt(ft,["self"])},[h("div",mw,[$[17]||($[17]=h("h3",{class:"rename-thread-title"},"Rename thread",-1)),$[18]||($[18]=h("p",{class:"rename-thread-subtitle"},"Make it short and recognizable.",-1)),Tr(h("input",{ref_key:"renameThreadInputRef",ref:D,"onUpdate:modelValue":$[8]||($[8]=N=>S.value=N),class:"rename-thread-input",type:"text",placeholder:"Add title...",onKeydown:[vn(rt(Ct,["prevent"]),["enter"]),vn(rt(ft,["prevent"]),["esc"])]},null,40,gw),[[Sr,S.value]]),h("div",{class:"rename-thread-actions"},[h("button",{class:"rename-thread-button",type:"button",onClick:ft},"Cancel"),h("button",{class:"rename-thread-button rename-thread-button-primary",type:"button",onClick:Ct},"Save")])])])):ce("",!0)])),(v(),dt(ci,{to:"body"},[H.value?(v(),E("div",{key:0,class:"rename-thread-overlay",onClick:rt(pt,["self"])},[h("div",vw,[$[19]||($[19]=h("h3",{class:"rename-thread-title"},"Delete thread?",-1)),h("p",yw,' This will archive the thread "'+le(A.value)+'". You can find it later in archived threads. ',1),h("div",{class:"rename-thread-actions"},[h("button",{class:"rename-thread-button",type:"button",onClick:pt},"Cancel"),h("button",{class:"rename-thread-button rename-thread-button-danger",type:"button",onClick:Pt},"Delete")])])])):ce("",!0)]))]))}}),_w=lt(bw,[["__scopeId","data-v-6c669cbd"]]),kw={class:"content-header"},Tw={class:"content-leading"},Sw={class:"content-title"},Iw={class:"content-actions"},Ew=Wt({__name:"ContentHeader",props:{title:{}},setup(e){return(t,n)=>(v(),E("header",kw,[h("div",Tw,[rr(t.$slots,"leading",{},void 0)]),h("h1",Sw,le(e.title),1),h("div",Iw,[rr(t.$slots,"actions",{},void 0)])]))}}),Cw=lt(Ew,[["__scopeId","data-v-66ee223c"]]),Aw={},xw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Rw(e,t){return v(),E("svg",xw,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"},null,-1)])])}const Ol=lt(Aw,[["render",Rw]]),Pw={},Mw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $w(e,t){return v(),E("svg",Mw,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const Ow=lt(Pw,[["render",$w]]),Nw={},Dw={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Lw(e,t){return v(),E("svg",Dw,[...t[0]||(t[0]=[h("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 jw=lt(Nw,[["render",Lw]]),Uw={class:"conversation-root"},Fw={key:0,class:"conversation-loading"},Bw={key:1,class:"conversation-empty"},Hw={class:"message-row"},Ww={class:"message-stack"},Vw={class:"request-card"},zw={class:"request-title"},Gw={class:"request-meta"},qw={key:0,class:"request-reason"},Kw={key:1,class:"request-actions"},Jw=["onClick"],Yw=["onClick"],Xw=["onClick"],Qw=["onClick"],Zw={key:2,class:"request-actions"},eb=["onClick"],tb=["onClick"],nb=["onClick"],rb=["onClick"],sb={key:3,class:"request-user-input"},ob={class:"request-question-title"},ib={key:0,class:"request-question-text"},ab=["value","onChange"],lb=["value"],cb=["value","onInput"],ub=["onClick"],db={key:4,class:"request-actions"},fb=["onClick"],hb=["onClick"],pb={key:5,class:"request-actions"},mb=["onClick"],gb=["onClick"],vb=["data-role","data-message-type"],yb={key:0,class:"message-row","data-role":"system"},wb={class:"message-stack","data-role":"system"},bb=["onClick"],_b={class:"cmd-status"},kb={class:"cmd-label"},Tb={class:"cmd-output-inner"},Sb={class:"cmd-output"},Ib=["data-role","data-message-type"],Eb=["data-role"],Cb=["data-role"],Ab=["data-role"],xb=["onClick"],Rb=["src"],Pb={key:1,class:"message-file-attachments"},Mb={class:"message-file-link-wrap"},$b=["href","title","onContextmenu"],Ob=["data-role"],Nb={key:0,class:"worked-separator-wrap","aria-live":"polite"},Db=["onClick"],Lb={class:"worked-separator-text"},jb={key:0,class:"worked-details"},Ub=["onClick"],Fb={class:"cmd-status"},Bb={class:"cmd-label"},Hb={class:"cmd-output-inner"},Wb={class:"cmd-output"},Vb={key:1,class:"message-text-flow"},zb={key:0,class:"message-text"},Gb={key:0},qb={key:1,class:"message-bold-text"},Kb={key:2,class:"message-file-link-wrap"},Jb=["href","title","onContextmenu"],Yb=["href","title","onContextmenu"],Xb={key:4,class:"message-inline-code"},Qb={key:1,class:"message-text"},Zb=["onClick"],e_=["src","alt","onError"],t_={key:0,class:"message-actions"},n_=["onClick"],r_=["onClick"],s_={key:0,class:"conversation-item conversation-item-overlay"},o_={class:"message-row"},i_={class:"message-stack"},a_={class:"live-overlay-inline","aria-live":"polite"},l_={class:"live-overlay-label"},c_={key:1,class:"live-overlay-error"},u_=["src"],d_=16,f_=Wt({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{},isTurnInProgress:{type:Boolean},isRollingBack:{type:Boolean}},emits:["updateScrollState","respondServerRequest","rollback"],setup(e,{emit:t}){const n=O(new Set),r=O(new Set),s=O(new Set),o=O({});function i(w){return w.messageType==="commandExecution"&&!!w.commandExecution}function a(w){var I;return((I=w.commandExecution)==null?void 0:I.status)==="inProgress"||r.value.has(w.id)?!0:n.value.has(w.id)}function l(w){return r.value.has(w.id)}function u(w){var x;if(((x=w.commandExecution)==null?void 0:x.status)==="inProgress")return;const I=new Set(n.value);I.has(w.id)?I.delete(w.id):I.add(w.id),n.value=I}function c(w){const I=new Set(s.value);I.has(w.id)?I.delete(w.id):I.add(w.id),s.value=I}function f(w){return s.value.has(w.id)}function m(w){const I=w.commandExecution;if(!I)return"";switch(I.status){case"inProgress":return"⟳ Running";case"completed":return I.exitCode===0?"✓ Completed":`✗ Exit ${I.exitCode??"?"}`;case"failed":return"✗ Failed";case"declined":return"⊘ Declined";case"interrupted":return"⊘ Interrupted";default:return""}}function S(w){var x,G;const I=(x=w.commandExecution)==null?void 0:x.status;return I==="inProgress"?"cmd-status-running":I==="completed"&&((G=w.commandExecution)==null?void 0:G.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function D(w){const I=new Set(r.value);I.add(w),r.value=I,setTimeout(()=>{const x=new Set(r.value);x.delete(w),r.value=x},1e3)}function H(w,I){const x=[];for(let G=I-1;G>=0;G--){const y=w[G];if(y.messageType==="commandExecution")x.unshift(y);else if(y.role==="user"||y.messageType==="worked")break}return x}const ee=e,A=t,R=O(null),B=O(null),F=O(null),X=O(""),ae=O(null),ve=O({}),ke=O({}),ue=O(null);let fe=0,_e=0,z=0,Te=!0;const Ne=new WeakSet,Ue=O(new Set),Ae=O(!1),$e=O(0),De=O(0),ze=O(""),tt=O("");function Oe(w){if(!w||w.endsWith("/")||w.endsWith("\\"))return!1;if(w.startsWith("file://"))return!0;if(/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(w))return!1;const I=w.startsWith("/"),x=/^[A-Za-z]:[\\/]/u.test(w),G=w.startsWith("./")||w.startsWith("../")||w.startsWith("~/"),y=w.includes("/")||w.includes("\\");return I||x||G||y}function Qe(w){return w.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||w}function wt(w){return w.replace(/\\/gu,"/")}function ct(w){if(!w.startsWith("file://"))return w;let I=w.replace(/^file:\/\//u,"");try{I=decodeURIComponent(I)}catch{}return/^\/[A-Za-z]:\//u.test(I)&&(I=I.slice(1)),I}function Ze(w){const I=wt(w),x=I.match(/^\/Users\/([^/]+)/u);if(x)return`/Users/${x[1]}`;const G=I.match(/^\/home\/([^/]+)/u);return G?`/home/${G[1]}`:""}function Je(w){const I=wt(w);if(!I)return I;let x="",G=I;const y=G.match(/^([A-Za-z]:)(\/.*)?$/u);y?(x=`${y[1]}/`,G=(y[2]??"").replace(/^\/+/u,"")):G.startsWith("/")&&(x="/",G=G.slice(1));const C=G.split("/").filter(Boolean),L=[];for(const xe of C)if(xe!=="."){if(xe===".."){L.length>0&&L.pop();continue}L.push(xe)}const Z=L.join("/");return x?`${x}${Z}`.replace(/\/+$/u,"")||x:Z||I}function K(w,I){const x=wt(ct(w.trim()));if(!x)return"";if(x.startsWith("/")||/^[A-Za-z]:\//u.test(x))return Je(x);if(x.startsWith("~/")){const C=Ze(I);if(C)return Je(`${C}/${x.slice(2)}`)}const y=wt(I.trim());return Je(y?`${y.replace(/\/+$/u,"")}/${x}`:x)}function pe(w){if(!w)return null;let I=w.trim();I=he(I).core.trim();let G=null;const y=I.match(/^(.*)#L(\d+)(?:C\d+)?$/u);if(y)I=y[1],G=Number(y[2]);else{const C=I.match(/^(.*):(\d+)(?::\d+)?$/u);C&&(I=C[1],G=Number(C[2]))}return I=ct(I),Oe(I)?{path:I,line:G}:null}function he(w){let I=w,x="",G="";for(;/^['"`“‘]/u.test(I);)x+=I[0],I=I.slice(1);for(;/['"`”’]$/u.test(I);)G=I.slice(-1)+G,I=I.slice(0,-1);return{core:I,leading:x,trailing:G}}function Ee(w){const I=w.trim(),x=Se(I,0);if(!x||x.end!==I.length)return null;const G=x.label.trim(),y=x.target.trim(),C=he(G).core.trim()||G,L=he(y).core.trim();return L?{label:C,target:L}:null}function Se(w,I){if(w[I]!=="[")return null;const x=w.indexOf("](",I+1);if(x<0)return null;const G=w.slice(I+1,x);if(!G||G.includes(`
|
|
26
|
+
`))return null;let y=x+2,C=1;for(;y<w.length;){const L=w[y];if(L===`
|
|
27
|
+
`)return null;if(L==="(")C+=1;else if(L===")"&&(C-=1,C===0)){const Z=w.slice(x+2,y);return Z.trim()?{label:G,target:Z,end:y+1}:null}y+=1}return null}function b(w){const I=[],x=/https?:\/\/\S+|file:\/\/\S+|\S*[\\/]\S+/gu;let G=0;for(const y of w.matchAll(x)){if(typeof y.index!="number")continue;const C=y.index,L=C+y[0].length;C>G&&I.push({kind:"text",value:w.slice(G,C)});let Z=y[0],xe="";for(;/[.,;:]$/u.test(Z);)xe=Z.slice(-1)+xe,Z=Z.slice(0,-1);const Xe=he(Z);Z=Xe.core;const ut=Xe.leading,Rt=Xe.trailing+xe;if(ut&&I.push({kind:"text",value:ut}),Z.startsWith("**")&&Z.endsWith("**")&&Z.length>4)I.push({kind:"bold",value:Z.slice(2,-2)}),Rt&&I.push({kind:"text",value:Rt});else if(/^https?:\/\//u.test(Z))I.push({kind:"url",value:Z,href:Z}),Rt&&I.push({kind:"text",value:Rt});else{const k=pe(Z);k?(I.push({kind:"file",value:Z,path:k.path,displayPath:Z,downloadName:Qe(k.path)}),Rt&&I.push({kind:"text",value:Rt})):I.push({kind:"text",value:y[0]})}G=L}return G<w.length&&I.push({kind:"text",value:w.slice(G)}),T(I)}function T(w){const I=[];let x=!1,G="";const y=C=>{C&&I.push({kind:"text",value:C})};for(const C of w){if(C.kind!=="text"){x&&(y(`**${G}`),x=!1,G=""),I.push(C);continue}let L=C.value;for(;L.length>0;){const Z=L.indexOf("**");if(Z<0){x?G+=L:y(L);break}const xe=L.slice(0,Z);x?G+=xe:y(xe),L=L.slice(Z+2),x?(G.length>0?I.push({kind:"bold",value:G}):y("****"),G="",x=!1):x=!0}}return x&&y(`**${G}`),I}function M(w){const I=[];let x=0;for(;x<w.length;){const G=w.indexOf("[",x);if(G<0)break;const y=Se(w,G);if(!y){x=G+1;continue}G>x&&I.push(...b(w.slice(x,G)));const C=he(y.label.trim()).core.trim()||y.label.trim(),L=he(y.target.trim()).core.trim();if(/^https?:\/\//u.test(L))I.push({kind:"url",value:C||L,href:L});else{const Z=pe(L);Z?I.push({kind:"file",value:L,path:Z.path,displayPath:C||L,downloadName:Qe(Z.path)}):I.push({kind:"text",value:w.slice(G,y.end)})}x=y.end}return x<w.length&&I.push(...b(w.slice(x))),I}function q(w){if(!w.includes("`"))return M(w);const I=[];let x=0,G=0;for(;x<w.length;){if(w[x]!=="`"){x+=1;continue}let y=1;for(;x+y<w.length&&w[x+y]==="`";)y+=1;const C="`".repeat(y);let L=x+y,Z=-1;for(;L<w.length;){const Xe=w.indexOf(C,L);if(Xe<0)break;const ut=Xe>0&&w[Xe-1]==="`",Rt=Xe+y<w.length&&w[Xe+y]==="`",k=w.slice(x+y,Xe).includes(`
|
|
28
|
+
`);if(!ut&&!Rt&&!k){Z=Xe;break}L=Xe+1}if(Z<0){x+=y;continue}x>G&&I.push(...M(w.slice(G,x)));const xe=w.slice(x+y,Z);if(xe.length>0){const Xe=Ee(xe);if(Xe)if(/^https?:\/\//u.test(Xe.target))I.push({kind:"url",value:Xe.label||Xe.target,href:Xe.target});else{const ut=pe(Xe.target);ut?I.push({kind:"file",value:Xe.target,path:ut.path,displayPath:Xe.label||Xe.target,downloadName:Qe(ut.path)}):I.push({kind:"code",value:xe})}else{const ut=pe(xe);if(ut){const Rt=ut.line?`${ut.path}:${String(ut.line)}`:ut.path;I.push({kind:"file",value:xe,path:ut.path,displayPath:Rt,downloadName:Qe(ut.path)})}else I.push({kind:"code",value:xe})}}else I.push({kind:"text",value:`${C}${C}`});x=Z+y,G=x}return G<w.length&&I.push(...M(w.slice(G))),I}function Q(w){const I=w.trim();if(!I)return"";if(I.startsWith("data:")||I.startsWith("blob:")||I.startsWith("http://")||I.startsWith("https://")||I.startsWith("/codex-local-image?"))return I;if(I.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(I)}`;const x=I.startsWith("/"),G=/^[A-Za-z]:[\\/]/u.test(I);return x||G?`/codex-local-image?path=${encodeURIComponent(I)}`:I}function V(w){const I=w.trim();if(!I)return"#";const x=L=>L.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(L),G=pe(I),y=(G==null?void 0:G.path)??I,C=K(y,ee.cwd);if(x(C)){const L=C.startsWith("/")?C:`/${C}`;return`/codex-local-browse${encodeURI(L)}`}return"#"}function me(w){const I=w.trim();if(!I)return"#";const x=pe(I),G=(x==null?void 0:x.path)??I,y=K(G,ee.cwd);if(!(Z=>Z.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(Z))(y))return"#";const L=y.startsWith("/")?y:`/${y}`;return`/codex-local-edit${encodeURI(L)}`}const oe=ie(()=>({left:`${String($e.value)}px`,top:`${String(De.value)}px`}));function W(w,I){const x=V(I);if(x==="#")return;ze.value=x;const G=me(I);tt.value=G==="#"?"":G,$e.value=w.clientX,De.value=w.clientY,Ae.value=!0}function U(w,I){const x=I.trim();x&&(ze.value=x,tt.value="",$e.value=w.clientX,De.value=w.clientY,Ae.value=!0)}function te(){Ae.value&&(Ae.value=!1)}function se(){const w=ze.value;te(),!(!w||w==="#")&&window.open(w,"_blank","noopener,noreferrer")}function de(){const w=tt.value;te(),!(!w||w==="#")&&window.open(w,"_blank","noopener,noreferrer")}async function Ie(){const w=ze.value;if(te(),!(!w||w==="#"))try{await navigator.clipboard.writeText(w)}catch{const I=document.createElement("textarea");I.value=w,I.setAttribute("readonly","true"),I.style.position="fixed",I.style.opacity="0",document.body.appendChild(I),I.select(),document.execCommand("copy"),document.body.removeChild(I)}}function We(w){if(!Ae.value)return;const I=ae.value;if(!I){te();return}const x=w.target;x instanceof Node&&I.contains(x)||te()}function Fe(){te()}function Me(w){w.key==="Escape"&&te()}function Ye(w){if(!w.includes(")return[{kind:"text",value:w}];const I=[],x=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let G=0;for(const y of w.matchAll(x)){const[C,L,Z]=y;if(typeof y.index!="number")continue;const xe=y.index,Xe=xe+C.length,ut=Q(Z.trim());ut&&(xe>G&&I.push({kind:"text",value:w.slice(G,xe)}),I.push({kind:"image",url:ut,alt:L.trim(),markdown:C}),G=Xe)}return G<w.length&&I.push({kind:"text",value:w.slice(G)}),I.length>0?I:[{kind:"text",value:w}]}function et(w){return w!==null&&typeof w=="object"&&!Array.isArray(w)?w:null}function xt(w){const I=new Date(w);return Number.isNaN(I.getTime())?w:I.toLocaleTimeString()}function ft(w){const I=et(w.params),x=I==null?void 0:I.reason;return typeof x=="string"?x.trim():""}function Ct(w,I){return`${String(w)}:${I}`}function Lt(w){const I=et(w.params),x=Array.isArray(I==null?void 0:I.questions)?I.questions:[],G=[];for(const y of x){const C=et(y);if(!C)continue;const L=typeof C.id=="string"?C.id:"";if(!L)continue;const Z=Array.isArray(C.options)?C.options.map(xe=>et(xe)).map(xe=>xe==null?void 0:xe.label).filter(xe=>typeof xe=="string"&&xe.length>0):[];G.push({id:L,header:typeof C.header=="string"?C.header:"",question:typeof C.question=="string"?C.question:"",isOther:C.isOther===!0,options:Z})}return G}function pt(w,I,x){const G=Ct(w,I),y=ve.value[G];return typeof y=="string"&&y.length>0?y:x}function Pt(w,I){const x=Ct(w,I);return ke.value[x]??""}function mt(w,I,x){const G=x.target;if(!(G instanceof HTMLSelectElement))return;const y=Ct(w,I);ve.value={...ve.value,[y]:G.value}}function Vt(w,I,x){const G=x.target;if(!(G instanceof HTMLInputElement))return;const y=Ct(w,I);ke.value={...ke.value,[y]:G.value}}function nt(w,I){A("respondServerRequest",{id:w,result:{decision:I}})}function bn(w){const I=Lt(w),x={};for(const G of I){const y=pt(w.id,G.id,G.options[0]||""),C=Pt(w.id,G.id).trim(),L=[y,C].map(Z=>Z.trim()).filter(Z=>Z.length>0);x[G.id]={answers:L}}A("respondServerRequest",{id:w.id,result:{answers:x}})}function zt(w){A("respondServerRequest",{id:w,result:{success:!1,contentItems:[{type:"inputText",text:"Tool call rejected from codex-web-local UI."}]}})}function Mt(w){A("respondServerRequest",{id:w,result:{success:!0,contentItems:[]}})}function un(w){A("respondServerRequest",{id:w,result:{}})}function kt(w){A("respondServerRequest",{id:w,error:{code:-32e3,message:"Rejected from codex-web-local UI."}})}function It(w){return!(w.role!=="user"&&w.role!=="assistant"||typeof w.turnIndex!="number"||ee.isTurnInProgress||ee.isRollingBack)}function en(w){return w.role!=="user"&&w.role!=="assistant"?!1:w.text.trim().length>0}function jt(w){return en(w)||It(w)}async function At(w){if(!en(w))return;const I=w.text.trim();try{await navigator.clipboard.writeText(I)}catch{const x=document.createElement("textarea");x.value=I,x.setAttribute("readonly","true"),x.style.position="fixed",x.style.opacity="0",document.body.appendChild(x),x.select(),document.execCommand("copy"),document.body.removeChild(x)}}function Gt(w){if(!It(w))return;const I=w.role==="user"?w.text.trim():"";A("rollback",{turnIndex:w.turnIndex,prependText:I.length>0?I:void 0})}function In(){const w=R.value,I=B.value;!w||!I||(w.scrollTop=w.scrollHeight,I.scrollIntoView({block:"end"}))}function $t(w){return w.scrollHeight-(w.scrollTop+w.clientHeight)<=d_}function En(w){const I=Math.max(w.scrollHeight-w.clientHeight,0),x=I>0?Math.min(Math.max(w.scrollTop/I,0),1):1;return{scrollTop:w.scrollTop,isAtBottom:$t(w),scrollRatio:x}}function Yt(){return ue.value??ee.scrollState}function He(w){const I=En(w);ue.value=I,ee.activeThreadId&&A("updateScrollState",{threadId:ee.activeThreadId,state:I})}function Le(){const w=R.value;if(!w)return;const I=Yt();if(!I||I.isAtBottom){qt();return}const x=Math.max(w.scrollHeight-w.clientHeight,0),G=I.scrollTop;w.scrollTop=Math.min(Math.max(G,0),x),He(w)}function qt(){const w=R.value;w&&(In(),He(w))}function dn(){const w=Yt();return!w||w.isAtBottom===!0}function Pn(){if(!dn()){z=0,_e=0;return}if(qt(),z-=1,z<=0){_e=0;return}_e=requestAnimationFrame(Pn)}function _n(w=6){dn()&&(_e&&(cancelAnimationFrame(_e),_e=0),z=Math.max(w,1),_e=requestAnimationFrame(Pn))}function Kt(){_n(3)}function Ut(){if(!dn())return;const w=R.value;if(!w)return;const I=w.querySelectorAll("img.message-image-preview");for(const x of I)x.complete||Ne.has(x)||(Ne.add(x),x.addEventListener("load",Kt,{once:!0}),x.addEventListener("error",Kt,{once:!0}))}async function tn(w={}){const I=w.restoreSavedState??Te;await Xt(),fe&&cancelAnimationFrame(fe),fe=requestAnimationFrame(()=>{fe=0;const x=R.value;I?(Le(),Te=!1):dn()?qt():x&&He(x),Ut(),_n()})}at(()=>ee.messages,async w=>{if(!ee.isLoading){for(const I of w){if(I.messageType!=="commandExecution"||!I.commandExecution)continue;const x=o.value[I.id],G=I.commandExecution.status;x==="inProgress"&&G!=="inProgress"&&D(I.id),o.value[I.id]=G}await tn()}}),at(()=>ee.liveOverlay,async w=>{if(!w){await tn();return}await tn()},{deep:!0}),at(()=>ee.isLoading,async w=>{w||await tn({restoreSavedState:!0})}),at(()=>ee.activeThreadId,async()=>{Te=!0,ue.value=null,X.value="",te(),Ue.value=new Set,await tn({restoreSavedState:!0})},{flush:"post"}),at(Ae,w=>{if(w){window.addEventListener("pointerdown",We,{capture:!0}),window.addEventListener("blur",Fe),window.addEventListener("keydown",Me);return}window.removeEventListener("pointerdown",We,{capture:!0}),window.removeEventListener("blur",Fe),window.removeEventListener("keydown",Me)});function fn(){const w=R.value;!w||ee.isLoading||He(w)}function Un(w){X.value=Q(w)}function Mn(w,I){return`${w}:${String(I)}`}function $n(w,I){const x=new Set(Ue.value);x.add(Mn(w,I)),Ue.value=x}function kn(w,I){return Ue.value.has(Mn(w,I))}function Cn(){X.value=""}function On(){const w=F.value;w&&(w.scrollTop=w.scrollHeight)}return at(()=>{var w;return(w=ee.liveOverlay)==null?void 0:w.reasoningText},async w=>{w&&(await Xt(),On())}),Ar(()=>{fe&&cancelAnimationFrame(fe),_e&&cancelAnimationFrame(_e),window.removeEventListener("pointerdown",We,{capture:!0}),window.removeEventListener("blur",Fe),window.removeEventListener("keydown",Me)}),(w,I)=>(v(),E("section",Uw,[e.isLoading?(v(),E("p",Fw,"Loading messages...")):e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay?(v(),E("p",Bw," No messages in this thread yet. ")):(v(),E("ul",{key:2,ref_key:"conversationListRef",ref:R,class:"conversation-list",onScroll:fn},[(v(!0),E(Ve,null,_t(e.pendingRequests,x=>(v(),E("li",{key:`server-request:${x.id}`,class:"conversation-item conversation-item-request"},[h("div",Hw,[h("div",Ww,[h("article",Vw,[h("p",zw,le(x.method),1),h("p",Gw,"Request #"+le(x.id)+" · "+le(xt(x.receivedAtIso)),1),ft(x)?(v(),E("p",qw,le(ft(x)),1)):ce("",!0),x.method==="item/commandExecution/requestApproval"?(v(),E("section",Kw,[h("button",{type:"button",class:"request-button request-button-primary",onClick:G=>nt(x.id,"accept")},"Accept",8,Jw),h("button",{type:"button",class:"request-button",onClick:G=>nt(x.id,"acceptForSession")},"Accept for Session",8,Yw),h("button",{type:"button",class:"request-button",onClick:G=>nt(x.id,"decline")},"Decline",8,Xw),h("button",{type:"button",class:"request-button",onClick:G=>nt(x.id,"cancel")},"Cancel",8,Qw)])):x.method==="item/fileChange/requestApproval"?(v(),E("section",Zw,[h("button",{type:"button",class:"request-button request-button-primary",onClick:G=>nt(x.id,"accept")},"Accept",8,eb),h("button",{type:"button",class:"request-button",onClick:G=>nt(x.id,"acceptForSession")},"Accept for Session",8,tb),h("button",{type:"button",class:"request-button",onClick:G=>nt(x.id,"decline")},"Decline",8,nb),h("button",{type:"button",class:"request-button",onClick:G=>nt(x.id,"cancel")},"Cancel",8,rb)])):x.method==="item/tool/requestUserInput"?(v(),E("section",sb,[(v(!0),E(Ve,null,_t(Lt(x),G=>(v(),E("div",{key:`${x.id}:${G.id}`,class:"request-question"},[h("p",ob,le(G.header||G.question),1),G.header&&G.question?(v(),E("p",ib,le(G.question),1)):ce("",!0),h("select",{class:"request-select",value:pt(x.id,G.id,G.options[0]||""),onChange:y=>mt(x.id,G.id,y)},[(v(!0),E(Ve,null,_t(G.options,y=>(v(),E("option",{key:`${x.id}:${G.id}:${y}`,value:y},le(y),9,lb))),128))],40,ab),G.isOther?(v(),E("input",{key:1,class:"request-input",type:"text",value:Pt(x.id,G.id),placeholder:"Other answer",onInput:y=>Vt(x.id,G.id,y)},null,40,cb)):ce("",!0)]))),128)),h("button",{type:"button",class:"request-button request-button-primary",onClick:G=>bn(x)}," Submit Answers ",8,ub)])):x.method==="item/tool/call"?(v(),E("section",db,[h("button",{type:"button",class:"request-button request-button-primary",onClick:G=>zt(x.id)},"Fail Tool Call",8,fb),h("button",{type:"button",class:"request-button",onClick:G=>Mt(x.id)},"Success (Empty)",8,hb)])):(v(),E("section",pb,[h("button",{type:"button",class:"request-button request-button-primary",onClick:G=>un(x.id)},"Return Empty Result",8,mb),h("button",{type:"button",class:"request-button",onClick:G=>kt(x.id)},"Reject Request",8,gb)]))])])])]))),128)),(v(!0),E(Ve,null,_t(e.messages,x=>{var G,y;return v(),E("li",{key:x.id,class:st(["conversation-item",{"conversation-item-actionable":jt(x)}]),"data-role":x.role,"data-message-type":x.messageType||""},[i(x)?(v(),E("div",yb,[h("div",wb,[h("button",{type:"button",class:st(["cmd-row",[S(x),{"cmd-expanded":a(x)}]]),onClick:C=>u(x)},[h("span",{class:st(["cmd-chevron",{"cmd-chevron-open":a(x)}])},"▶",2),h("span",_b,le(m(x)),1),h("code",kb,le(((G=x.commandExecution)==null?void 0:G.command)||"(command)"),1)],10,bb),h("div",{class:st(["cmd-output-wrap",{"cmd-output-visible":a(x),"cmd-output-collapsing":l(x)}])},[h("div",Tb,[h("pre",Sb,le(((y=x.commandExecution)==null?void 0:y.aggregatedOutput)||"(no output)"),1)])],2)])])):(v(),E("div",{key:1,class:"message-row","data-role":x.role,"data-message-type":x.messageType||""},[h("div",{class:"message-stack","data-role":x.role},[h("article",{class:"message-body","data-role":x.role},[x.images&&x.images.length>0?(v(),E("ul",{key:0,class:"message-image-list","data-role":x.role},[(v(!0),E(Ve,null,_t(x.images,C=>(v(),E("li",{key:C,class:"message-image-item"},[h("button",{class:"message-image-button",type:"button",onClick:L=>Un(C)},[h("img",{class:"message-image-preview",src:Q(C),alt:"Message image preview",loading:"lazy"},null,8,Rb)],8,xb)]))),128))],8,Ab)):ce("",!0),x.fileAttachments&&x.fileAttachments.length>0?(v(),E("div",Pb,[(v(!0),E(Ve,null,_t(x.fileAttachments,C=>(v(),E("span",{key:C.path,class:"message-file-chip"},[I[2]||(I[2]=h("span",{class:"message-file-chip-icon"},"📄",-1)),h("span",Mb,[h("a",{class:"message-file-link message-file-chip-name",href:V(C.path),target:"_blank",rel:"noopener noreferrer",title:C.path,onContextmenu:rt(L=>W(L,C.path),["prevent"])},le(C.path),41,$b)])]))),128))])):ce("",!0),x.text.length>0?(v(),E("article",{key:2,class:"message-card","data-role":x.role},[x.messageType==="worked"?(v(),E("div",Nb,[h("button",{type:"button",class:"worked-separator",onClick:C=>c(x)},[I[3]||(I[3]=h("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),h("span",{class:st(["worked-chevron",{"worked-chevron-open":f(x)}])},"▶",2),h("p",Lb,le(x.text),1),I[4]||(I[4]=h("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,Db),f(x)?(v(),E("div",jb,[(v(!0),E(Ve,null,_t(H(e.messages,e.messages.indexOf(x)),C=>{var L,Z;return v(),E("div",{key:`worked-cmd-${C.id}`,class:"worked-cmd-item"},[h("button",{type:"button",class:st(["cmd-row",[S(C),{"cmd-expanded":a(C)}]]),onClick:xe=>u(C)},[h("span",{class:st(["cmd-chevron",{"cmd-chevron-open":a(C)}])},"▶",2),h("span",Fb,le(m(C)),1),h("code",Bb,le(((L=C.commandExecution)==null?void 0:L.command)||"(command)"),1)],10,Ub),h("div",{class:st(["cmd-output-wrap",{"cmd-output-visible":a(C),"cmd-output-collapsing":l(C)}])},[h("div",Hb,[h("pre",Wb,le(((Z=C.commandExecution)==null?void 0:Z.aggregatedOutput)||"(no output)"),1)])],2)])}),128))])):ce("",!0)])):(v(),E("div",Vb,[(v(!0),E(Ve,null,_t(Ye(x.text),(C,L)=>(v(),E(Ve,{key:`block-${L}`},[C.kind==="text"?(v(),E("p",zb,[(v(!0),E(Ve,null,_t(q(C.value),(Z,xe)=>(v(),E(Ve,{key:`seg-${L}-${xe}`},[Z.kind==="text"?(v(),E("span",Gb,le(Z.value),1)):Z.kind==="bold"?(v(),E("strong",qb,le(Z.value),1)):Z.kind==="file"?(v(),E("span",Kb,[h("a",{class:"message-file-link",href:V(Z.path),target:"_blank",rel:"noopener noreferrer",title:Z.path,onContextmenu:rt(Xe=>W(Xe,Z.path),["prevent"])},le(Z.displayPath),41,Jb)])):Z.kind==="url"?(v(),E("a",{key:3,class:"message-file-link",href:Z.href,target:"_blank",rel:"noopener noreferrer",title:Z.href,onContextmenu:rt(Xe=>U(Xe,Z.href),["prevent"])},le(Z.value),41,Yb)):(v(),E("code",Xb,le(Z.value),1))],64))),128))])):kn(x.id,L)?(v(),E("p",Qb,le(C.markdown),1)):(v(),E("button",{key:2,class:"message-image-button",type:"button",onClick:Z=>Un(C.url)},[h("img",{class:"message-image-preview message-markdown-image",src:C.url,alt:C.alt||"Embedded message image",loading:"lazy",onError:Z=>$n(x.id,L)},null,40,e_)],8,Zb))],64))),128))]))],8,Ob)):ce("",!0)],8,Cb),jt(x)?(v(),E("div",t_,[en(x)?(v(),E("button",{key:0,class:"message-action-button",type:"button",title:"Copy message text",onClick:C=>At(x)},[Pe(jw,{class:"message-action-icon"}),I[5]||(I[5]=h("span",{class:"message-action-label"},"Copy",-1))],8,n_)):ce("",!0),It(x)?(v(),E("button",{key:1,class:"message-action-button",type:"button",title:"Rollback to this message (remove this turn and all after it)",onClick:C=>Gt(x)},[Pe(Ow,{class:"message-action-icon"}),I[6]||(I[6]=h("span",{class:"message-action-label"},"Rollback",-1))],8,r_)):ce("",!0)])):ce("",!0)],8,Eb)],8,Ib))],10,vb)}),128)),e.liveOverlay?(v(),E("li",s_,[h("div",o_,[h("div",i_,[h("article",a_,[h("p",l_,le(e.liveOverlay.activityLabel),1),e.liveOverlay.reasoningText?(v(),E("p",{key:0,class:"live-overlay-reasoning",ref_key:"liveOverlayReasoningRef",ref:F},le(e.liveOverlay.reasoningText),513)):ce("",!0),e.liveOverlay.errorText?(v(),E("p",c_,le(e.liveOverlay.errorText),1)):ce("",!0)])])])])):ce("",!0),h("li",{ref_key:"bottomAnchorRef",ref:B,class:"conversation-bottom-anchor"},null,512)],544)),X.value.length>0?(v(),E("div",{key:3,class:"image-modal-backdrop",onClick:Cn},[h("div",{class:"image-modal-content",onClick:I[0]||(I[0]=rt(()=>{},["stop"]))},[h("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Cn},[Pe(Ol,{class:"icon-svg"})]),h("img",{class:"image-modal-image",src:X.value,alt:"Expanded message image"},null,8,u_)])])):ce("",!0),Ae.value?(v(),E("div",{key:4,ref_key:"fileLinkContextMenuRef",ref:ae,class:"file-link-context-menu",style:Fr(oe.value),onClick:I[1]||(I[1]=rt(()=>{},["stop"]))},[h("button",{type:"button",class:"file-link-context-menu-item",onClick:se}," Open link "),h("button",{type:"button",class:"file-link-context-menu-item",onClick:Ie}," Copy link "),tt.value?(v(),E("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:de}," Edit file ")):ce("",!0)],4)):ce("",!0)]))}}),h_=lt(f_,[["__scopeId","data-v-323c3b9d"]]),iu=.0025,va=3,au=2,p_=256;function m_(e){var _e;const t=O("idle"),n=O(typeof navigator<"u"&&!!((_e=navigator.mediaDevices)!=null&&_e.getUserMedia)),r=O(0),s=O(null);let o=null,i=null,a=[],l=null,u=null,c=null,f=null,m=[],S=!1,D=!1,H=null;function ee(){H&&(H.abort(),H=null),t.value==="transcribing"&&(t.value="idle")}function A(){const z=s.value;if(!z||typeof window>"u")return;const Te=z.getContext("2d");if(!Te)return;const Ne=Math.max(1,Math.floor(z.clientWidth)),Ue=Math.max(1,Math.floor(z.clientHeight||36)),Ae=window.devicePixelRatio||1,$e=Math.max(1,Math.floor(Ne*Ae)),De=Math.max(1,Math.floor(Ue*Ae));(z.width!==$e||z.height!==De)&&(z.width=$e,z.height=De),Te.setTransform(Ae,0,0,Ae,0,0),Te.clearRect(0,0,Ne,Ue);const ze=Math.max(12,Math.floor(Ne/(va+au))),tt=m.slice(-ze),Oe=Math.max(0,ze-tt.length),Qe=Ue/2,wt=getComputedStyle(z).color||"#000000";for(let ct=0;ct<ze;ct+=1){const Ze=tt[ct-Oe]??0,K=Math.max(.08,Math.min(1,Ze*18))*Qe,pe=ct*(va+au);Te.globalAlpha=Ze<=iu?.35:1,Te.fillStyle=wt,Te.fillRect(pe,Qe-K,va,K*2)}Te.globalAlpha=1}function R(){m=[],r.value=0,A()}function B(){c&&(c.disconnect(),c.onaudioprocess=null,c=null),u&&(u.disconnect(),u=null),l&&(l.close(),l=null),f=null}function F(z){if(typeof window>"u")return;const Te=window.webkitAudioContext,Ne=window.AudioContext??Te;Ne&&(B(),R(),l=new Ne,u=l.createMediaStreamSource(z),c=l.createScriptProcessor(2048,1,1),f=performance.now(),c.onaudioprocess=Ue=>{const Ae=Ue.inputBuffer.getChannelData(0);let $e=0;for(let De=0;De<Ae.length;De+=1){const ze=Math.abs(Ae[De]??0);$e+=ze<iu?0:ze}m.push($e/Ae.length),m.length>p_&&m.shift(),f!==null&&(r.value=Math.max(0,performance.now()-f)),A()},u.connect(c),c.connect(l.destination),A())}async function X(){var z;if(t.value==="transcribing"&&ee(),!(t.value!=="idle"||!n.value||S)){S=!0,D=!1;try{i=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1}}),a=[],o=new MediaRecorder(i),o.ondataavailable=Te=>{Te.data.size>0&&a.push(Te.data)},o.onstop=()=>{var Ue;const Te=a,Ne=(o==null?void 0:o.mimeType)||((Ue=Te[0])==null?void 0:Ue.type)||"audio/webm";ue(),ke(Te,Ne)},F(i),o.start(250),t.value="recording",D&&ae()}catch(Te){ue(),t.value="idle",(z=e.onError)==null||z.call(e,Te)}finally{S=!1}}}function ae(){if(S&&t.value==="idle"){D=!0;return}if(!(t.value!=="recording"||!o)&&o.state!=="inactive"){t.value="transcribing";try{o.requestData()}catch{}o.stop()}}function ve(){D=!1,ee(),ue(),t.value="idle"}async function ke(z,Te){var Ae,$e,De,ze,tt;if(z.length===0){(Ae=e.onEmpty)==null||Ae.call(e),t.value="idle";return}const Ne=new Blob(z,{type:Te});t.value="transcribing";let Ue=null;try{const Oe=Te.split(/[/;]/)[1]??"webm",Qe=new FormData;Qe.append("file",Ne,`codex.${Oe}`);const wt=(($e=e.getLanguage)==null?void 0:$e.call(e).trim())??"";wt&&wt.toLowerCase()!=="auto"&&Qe.append("language",wt),Ue=new AbortController,H=Ue;const ct=await fetch("/codex-api/transcribe",{method:"POST",body:Qe,signal:Ue.signal}),Ze=await ct.text();let Je=null;try{Je=Ze.trim()?JSON.parse(Ze):null}catch{Je=null}if(!ct.ok){const pe=(De=Je==null?void 0:Je.error)==null?void 0:De.trim(),he=Ze.trim();throw new Error(pe||he||`Transcription failed: ${ct.status}`)}const K=((Je==null?void 0:Je.text)??"").trim();K.length>0?e.onTranscript(K):(ze=e.onEmpty)==null||ze.call(e)}catch(Oe){if(Oe instanceof DOMException&&Oe.name==="AbortError")return;(tt=e.onError)==null||tt.call(e,Oe)}finally{Ue&&H===Ue&&(H=null),t.value==="transcribing"&&(t.value="idle")}}function ue(){B(),R(),o&&(o.ondataavailable=null,o.onstop=null,o=null),i&&(i.getTracks().forEach(z=>z.stop()),i=null),a=[]}Ar(()=>{ve()});function fe(){if(t.value==="recording"){ae();return}(t.value==="idle"||t.value==="transcribing")&&X()}return{state:t,isSupported:n,recordingDurationMs:r,waveformCanvasRef:s,startRecording:X,stopRecording:ae,toggleRecording:fe,cancel:ve}}function lu(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}class wr extends Error{constructor(t,n){super(t),this.name="CodexApiError",this.code=n.code,this.method=n.method,this.status=n.status}}function Nl(e,t){const n=lu(e);if(!n)return t;const r=n.error;if(typeof r=="string"&&r.length>0)return r;const s=lu(r);return s&&typeof s.message=="string"&&s.message.length>0?s.message:t}function us(e,t,n){return e instanceof wr?e:e instanceof Error?new wr(e.message||t,{code:"unknown_error",method:n}):new wr(t,{code:"unknown_error",method:n})}function Uf(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)?e:null}async function g_(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 wr(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 wr(Nl(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 wr(`RPC ${e} returned malformed envelope`,{code:"invalid_response",method:e,status:r.status});return o.result}function cu(e){const t=Uf(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 v_(e){if(typeof window>"u")return()=>{};let t=null,n=!1;const r=()=>{if(typeof EventSource>"u"||n)return;const s=new EventSource("/codex-api/events");s.onmessage=o=>{try{const i=JSON.parse(o.data),a=cu(i);a&&e(a)}catch{}},t=()=>s.close()};if(typeof WebSocket<"u"){const s=window.location.protocol==="https:"?"wss:":"ws:",o=new WebSocket(`${s}//${window.location.host}/codex-api/ws`);let i=!1,a=window.setTimeout(()=>{i||n||(o.close(),r())},2500);o.onopen=()=>{i=!0,a!==null&&(window.clearTimeout(a),a=null)},o.onmessage=l=>{try{const u=JSON.parse(String(l.data)),c=cu(u);c&&e(c)}catch{}},o.onerror=()=>{!i&&!n&&r()},o.onclose=()=>{a!==null&&(window.clearTimeout(a),a=null),!i&&!n&&r()},t=()=>o.close()}else r();return()=>{n=!0,t==null||t()}}async function y_(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 wr(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 wr(Nl(n,`Server request reply failed with HTTP ${t.status}`),{code:"http_error",method:"server-requests/respond",status:t.status})}async function w_(){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 wr(Nl(t,`Pending server requests failed with HTTP ${e.status}`),{code:"http_error",method:"server-requests/pending",status:e.status});const n=Uf(t),r=n==null?void 0:n.data;return Array.isArray(r)?r:[]}function b_(e){const t=e.trim();return t?t.startsWith("\\\\?\\UNC\\")?`\\\\${t.slice(8)}`:t.startsWith("\\\\?\\")?t.slice(4):t:""}function Rn(e){return b_(e)}function __(e){return/^[a-z]:[\\/]/iu.test(e)||e.startsWith("\\\\")}function k_(e){const t=Rn(e).replace(/[\\/]+/gu,"/");return __(t)?t.toLowerCase():t}function ws(e){const t=Rn(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<0?t:t.slice(n+1)}function uu(e){const t=Rn(e).replace(/[\\/]+$/u,"");if(!t)return"";const n=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return n<=0?"":t.slice(0,n)}function Eo(e){return ws(e)||Rn(e)||"unknown-project"}function du(e){return new Date(e*1e3).toISOString()}function T_(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const S_=/^##\s+(.+?):\s+(.+?)\s*$/,I_=/^#\s*files mentioned by the user\s*:?\s*$/i;function E_(e){var s,o;const t=e.split(`
|
|
29
|
+
`).findIndex(i=>I_.test(i.trim()));if(t<0)return[];const n=e.split(`
|
|
30
|
+
`).slice(t+1),r=[];for(const i of n){const a=i.trim();if(!a)continue;const l=a.match(S_);if(!l)break;const u=(s=l[1])==null?void 0:s.trim(),c=(o=l[2])==null?void 0:o.trim().replace(/\s+\((?:lines?\s+\d+(?:-\d+)?)\)\s*$/,"");u&&c&&r.push({label:u,path:c})}return r}function C_(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 A_(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:T_(l),isUnhandled:!0});const o=n.join(`
|
|
31
|
+
`),i=E_(o);return{text:C_(o),images:r,fileAttachments:i,rawBlocks:s}}function x_(e){if(e.type==="agentMessage")return[{id:e.id,role:"assistant",text:e.text,messageType:e.type}];if(e.type==="userMessage"){const t=A_(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==="commandExecution"){const t=e,n=R_(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 R_(e){return e==="completed"||e==="failed"||e==="declined"||e==="interrupted"?e:e==="inProgress"||e==="in_progress"?"inProgress":"completed"}function P_(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 M_(e){const t=P_(e);return t.length>0?t:"Untitled thread"}function Ff(e){return(e==null?void 0:e.status)==="inProgress"}function $_(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 Ff(r)}function O_(e){const t=e,n=Rn(typeof t.cwd=="string"?t.cwd:e.cwd),r=k_(n),s=t.isWorktree===!0||t.worktree===!0||t.worktreeId!==void 0||t.worktreePath!==void 0||r.includes("/.codex/worktrees/")||r.includes("/.git/worktrees/");return{id:e.id,title:M_(e),projectName:Eo(n),cwd:n,hasWorktree:s,createdAtIso:du(e.createdAt),updatedAtIso:du(e.updatedAt),preview:e.preview,unread:!1,inProgress:$_(e)}}function N_(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 D_(e){const t=e.data.map(O_);return N_(t)}function Bf(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 x_(i))n.push({...a,turnIndex:r})}return n}function L_(e){const t=Array.isArray(e.thread.turns)?e.thread.turns:[];return Ff(t.at(-1))}function fu(e,t){const n=t.trim();if(!n)return"";const r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),[s="",o=""]=e.split("/",2),i=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),l=s&&o?`${i}\\s*/\\s*${a}`:r;return n.replace(/^[★☆*\s:|\-]+/u,"").replace(/^(sponsor|star)\s+/i,"").replace(new RegExp(`^${r}\\s*[-:|]*\\s*`,"i"),"").replace(new RegExp(`^${l}\\s*[-:|]*\\s*`,"i"),"").replace(/^(sponsor|star)\s+/i,"").trim()}async function Zt(e,t){try{return await g_(e,t)}catch(n){throw us(n,`RPC ${e} failed`,e)}}function j_(e){return typeof e=="string"&&["none","minimal","low","medium","high","xhigh"].includes(e)?e:""}function U_(e){return typeof e=="string"&&e.trim().toLowerCase()==="fast"?"fast":"standard"}async function F_(){const e=await Zt("thread/list",{archived:!1,limit:100,sortKey:"updated_at"});return D_(e)}async function B_(e){const t=await Zt("thread/read",{threadId:e,includeTurns:!0});return{messages:Bf(t),inProgress:L_(t)}}async function H_(){try{return await F_()}catch(e){throw us(e,"Failed to load thread groups","thread/list")}}async function W_(e){try{return await B_(e)}catch(t){throw us(t,`Failed to load thread ${e}`,"thread/read")}}function V_(e){return v_(e)}async function z_(e,t){await y_({id:e,...t})}async function G_(){return w_()}async function ya(e){await Zt("thread/resume",{threadId:e})}async function q_(e){await Zt("thread/archive",{threadId:e})}async function K_(e,t){await Zt("thread/name/set",{threadId:e,name:t})}async function hu(e,t){const n=await Zt("thread/rollback",{threadId:e,numTurns:t});return Bf(n)}function Hf(e){if(!e||typeof e!="object")return"";const n=e.thread;if(n&&typeof n=="object"){const r=n.id;if(typeof r=="string"&&r.length>0)return r}return""}async function pu(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 Zt("thread/start",n),s=Hf(r);if(!s)throw new Error("thread/start did not return a thread id");return s}catch(n){throw us(n,"Failed to start a new thread","thread/start")}}async function J_(e,t,n){try{const r=e.trim();if(!r)throw new Error("thread/fork requires threadId");const s={threadId:r};typeof t=="string"&&t.trim().length>0&&(s.cwd=t.trim()),typeof n=="string"&&n.trim().length>0&&(s.model=n.trim());const o=await Zt("thread/fork",s),i=Hf(o);if(!i)throw new Error("thread/fork did not return a thread id");return i}catch(r){throw us(r,`Failed to fork thread ${e}`,"thread/fork")}}function Y_(e,t){if(t.length===0)return e;let n=`# Files mentioned by the user:
|
|
32
|
+
`;for(const r of t)n+=`
|
|
33
|
+
## ${r.label}: ${r.path}
|
|
34
|
+
`;return`${n}
|
|
35
|
+
## My request for Codex:
|
|
36
|
+
|
|
37
|
+
${e}
|
|
38
|
+
`}async function wa(e,t,n=[],r,s,o,i=[]){try{const l=[{type:"text",text:Y_(t,i)}];for(const f of n){const m=f.trim();m&&l.push({type:"image",url:m,image_url:m})}if(o)for(const f of o)l.push({type:"skill",name:f.name,path:f.path});const u=i.map(f=>({label:f.label,path:f.path,fsPath:f.fsPath})),c={threadId:e,input:l};u.length>0&&(c.attachments=u),typeof r=="string"&&r.length>0&&(c.model=r),typeof s=="string"&&s.length>0&&(c.effort=s),await Zt("turn/start",c)}catch(a){throw us(a,`Failed to start turn for thread ${e}`,"turn/start")}}async function X_(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 Zt("turn/interrupt",{threadId:n,turnId:r})}catch(s){throw us(s,`Failed to interrupt turn for thread ${n}`,"turn/interrupt")}}async function Q_(e){await Zt("setDefaultModel",{model:e})}async function Z_(e){const t=e==="fast"?"fast":"standard";await Zt("config/batchWrite",{edits:[{keyPath:"features.fast_mode",value:!0,mergeStrategy:"upsert"},{keyPath:"service_tier",value:t==="fast"?"fast":null,mergeStrategy:t==="fast"?"upsert":"replace"}],filePath:null,expectedVersion:null})}async function ek(){const e=await Zt("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 tk(){const e=await Zt("config/read",{}),t=e.config.model??"",n=j_(e.config.model_reasoning_effort),r=U_(e.config.service_tier);return{model:t,reasoningEffort:n,speedMode:r}}async function nk(){return await Zt("account/rateLimits/read")}function rk(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)){const a=typeof o=="string"?Rn(o):"";a.length>0&&typeof i=="string"&&(s[a]=i)}return{order:n(t.order).map(o=>Rn(o)),labels:s,active:n(t.active).map(o=>Rn(o))}}async function Qa(){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 rk(n.data)}async function sk(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,cwd:Rn(n.data.cwd),gitRoot:Rn(n.data.gitRoot)}}async function ok(e,t){const n=await fetch("/codex-api/worktree/auto-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to auto-commit rollback changes");return r.data}async function ik(e,t){const n=await fetch("/codex-api/worktree/rollback-to-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e,message:t})}),r=await n.json();if(!n.ok||!r.data)throw new Error(r.error||"Failed to rollback project to message commit");return r.data}async function mu(){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 ak(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 gu(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=Ns(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"?Rn(o.path):""}async function lk(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=Ns(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"?Rn(o.path):""}}async function ck(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 u=Ns(o,"Failed to search files");throw new Error(u)}const i=o&&typeof o=="object"&&!Array.isArray(o)?o:{},a=Array.isArray(i.data)?i.data:[],l=[];for(const u of a){if(!u||typeof u!="object"||Array.isArray(u))continue;const f=u.path,m=typeof f=="string"?f.trim():"";m&&l.push({path:m})}return l}async function uk(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}}async function dk(e){const t=await fetch("/codex-api/telegram/configure-bot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({botToken:e})}),n=await t.json();if(!t.ok){const r=Ns(n,"Failed to connect Telegram bot");throw new Error(r)}}async function fk(){const e=await fetch("/codex-api/telegram/status"),t=await e.json();if(!e.ok){const s=Ns(t,"Failed to load Telegram status");throw new Error(s)}const n=t&&typeof t=="object"&&!Array.isArray(t)?t:{},r=n.data&&typeof n.data=="object"&&!Array.isArray(n.data)?n.data:{};return{configured:r.configured===!0,active:r.active===!0,mappedChats:typeof r.mappedChats=="number"?r.mappedChats:0,mappedThreads:typeof r.mappedThreads=="number"?r.mappedThreads:0,lastError:typeof r.lastError=="string"?r.lastError:""}}function hk(e){const t=e.getUTCFullYear(),n=String(e.getUTCMonth()+1).padStart(2,"0"),r=String(e.getUTCDate()).padStart(2,"0");return`${t}-${n}-${r}`}async function pk(e,t=6){const n=Math.min(10,Math.max(1,Math.floor(t)));if(e.startsWith("search-")){const c=new Date;e==="search-daily"?c.setUTCDate(c.getUTCDate()-1):e==="search-weekly"?c.setUTCDate(c.getUTCDate()-7):c.setUTCDate(c.getUTCDate()-30);const f=new URLSearchParams({q:`created:>=${hk(c)}`,sort:"stars",order:"desc",per_page:String(n)}),m=await fetch(`https://api.github.com/search/repositories?${f.toString()}`,{headers:{Accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}});if(!m.ok)throw new Error(`Failed to fetch GitHub search projects (${m.status})`);const S=await m.json(),D=S&&typeof S=="object"&&!Array.isArray(S)?S:{},H=Array.isArray(D.items)?D.items:[],ee=[];for(const A of H){if(!A||typeof A!="object"||Array.isArray(A))continue;const R=A,B=typeof R.id=="number"?R.id:0,F=typeof R.full_name=="string"?R.full_name.trim():"",X=typeof R.html_url=="string"?R.html_url.trim():"";if(!B||!F||!X)continue;const[ae="",ve=""]=F.split("/",2);ee.push({id:B,fullName:F,owner:ae,repo:ve,url:X,description:fu(F,typeof R.description=="string"?R.description:""),language:typeof R.language=="string"?R.language.trim():"",stars:typeof R.stargazers_count=="number"?R.stargazers_count:0})}return ee}const r=e==="trending-daily"?"daily":e==="trending-weekly"?"weekly":"monthly",s=new URLSearchParams({since:r,limit:String(n)}),o=await fetch(`/codex-api/github-trending?${s.toString()}`),i=await o.json();if(!o.ok){const c=Ns(i,"Failed to fetch GitHub trending projects");throw new Error(c)}const a=i&&typeof i=="object"&&!Array.isArray(i)?i:{},l=Array.isArray(a.data)?a.data:[],u=[];for(const c of l){if(!c||typeof c!="object"||Array.isArray(c))continue;const f=c,m=typeof f.id=="number"?f.id:0,S=typeof f.fullName=="string"?f.fullName.trim():"",D=typeof f.url=="string"?f.url.trim():"";if(!m||!S||!D)continue;const[H="",ee=""]=S.split("/",2);u.push({id:m,fullName:S,owner:H,repo:ee,url:D,description:fu(S,typeof f.description=="string"?f.description:""),language:typeof f.language=="string"?f.language.trim():"",stars:typeof f.stars=="number"?f.stars:0})}return u}function Ns(e,t){const r=(e&&typeof e=="object"&&!Array.isArray(e)?e:{}).error;return typeof r=="string"&&r.trim().length>0?r:t}async function mk(){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 ba(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 gk(e,t){var n;try{return((n=(await Zt("generate-thread-title",{prompt:e,cwd:t})).title)==null?void 0:n.trim())??""}catch{return""}}async function vk(e){try{const t={};e&&e.length>0&&(t.cwds=e);const n=await Zt("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 vu(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 yk={},wk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function bk(e,t){return v(),E("svg",wk,[...t[0]||(t[0]=[h("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 _k=lt(yk,[["render",bk]]),kk={},Tk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Sk(e,t){return v(),E("svg",Tk,[...t[0]||(t[0]=[h("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 3L4 14h6l-1 7l9-11h-6z"},null,-1)])])}const Ik=lt(kk,[["render",Sk]]),Ek={},Ck={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Ak(e,t){return v(),E("svg",Ck,[...t[0]||(t[0]=[h("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 xk=lt(Ek,[["render",Ak]]),Rk={},Pk={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function Mk(e,t){return v(),E("svg",Pk,[...t[0]||(t[0]=[h("path",{stroke:"none",fill:"none",d:"M0 0h24v24H0z"},null,-1),h("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 yu=lt(Rk,[["render",Mk]]),$k=["disabled"],Ok={class:"composer-dropdown-value"},Nk={class:"composer-dropdown-menu"},Dk={key:0,class:"composer-dropdown-search-wrap"},Lk=["placeholder","onKeydown"],jk={class:"composer-dropdown-options",role:"listbox"},Uk=["onClick"],Fk={key:0,class:"composer-dropdown-empty"},Bk={key:1,class:"composer-dropdown-add-wrap"},Hk=["placeholder","onKeydown"],Wk=Wt({__name:"ComposerDropdown",props:{modelValue:{},options:{},placeholder:{},disabled:{type:Boolean},selectedPrefixIcon:{},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=O(null),o=O(null),i=O(null),a=O(!1),l=O(""),u=O(!1),c=O(""),f=ie(()=>{var _e;const fe=n.options.find(z=>z.value===n.modelValue);return fe?fe.label:((_e=n.placeholder)==null?void 0:_e.trim())||""}),m=ie(()=>n.openDirection??"down"),S=ie(()=>n.enableSearch===!0),D=ie(()=>n.showAddAction===!0),H=ie(()=>{var fe;return((fe=n.searchPlaceholder)==null?void 0:fe.trim())||"Quick search projects"}),ee=ie(()=>{var fe;return((fe=n.addActionLabel)==null?void 0:fe.trim())||"Add new project"}),A=ie(()=>{var fe;return((fe=n.addPlaceholder)==null?void 0:fe.trim())||"Project name or absolute path"}),R=ie(()=>{const fe=l.value.trim().toLowerCase();return fe?n.options.filter(_e=>_e.label.toLowerCase().includes(fe)||_e.value.toLowerCase().includes(fe)):n.options});function B(){n.disabled||(a.value=!a.value)}function F(fe){r("update:modelValue",fe),a.value=!1,l.value=""}function X(){var fe;u.value=!0,c.value=((fe=n.defaultAddValue)==null?void 0:fe.trim())||"",Xt(()=>{var _e;return(_e=i.value)==null?void 0:_e.focus()})}function ae(){if(l.value.length>0){l.value="";return}a.value=!1}function ve(){const fe=c.value.trim();fe&&(r("add",fe),u.value=!1,c.value="",a.value=!1,l.value="")}function ke(){u.value=!1,c.value="",a.value=!1,l.value=""}function ue(fe){if(!a.value)return;const _e=s.value;if(!_e)return;const z=fe.target;z instanceof Node&&(_e.contains(z)||(a.value=!1,l.value="",u.value=!1,c.value=""))}return at(a,fe=>{if(!fe){u.value=!1,c.value="";return}S.value&&Xt(()=>{var _e;return(_e=o.value)==null?void 0:_e.focus()})}),ar(()=>{window.addEventListener("pointerdown",ue)}),Ar(()=>{window.removeEventListener("pointerdown",ue)}),(fe,_e)=>(v(),E("div",{ref_key:"rootRef",ref:s,class:"composer-dropdown"},[h("button",{class:"composer-dropdown-trigger",type:"button",disabled:e.disabled,onClick:B},[e.selectedPrefixIcon?(v(),dt(di(e.selectedPrefixIcon),{key:0,class:"composer-dropdown-prefix-icon"})):ce("",!0),h("span",Ok,le(f.value),1),Pe(ji,{class:"composer-dropdown-chevron"})],8,$k),a.value?(v(),E("div",{key:0,class:st(["composer-dropdown-menu-wrap",{"composer-dropdown-menu-wrap-up":m.value==="up","composer-dropdown-menu-wrap-down":m.value==="down"}])},[h("div",Nk,[S.value?(v(),E("div",Dk,[Tr(h("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":_e[0]||(_e[0]=z=>l.value=z),class:"composer-dropdown-search-input",type:"text",placeholder:H.value,onKeydown:vn(rt(ae,["prevent"]),["esc"])},null,40,Lk),[[Sr,l.value]])])):ce("",!0),h("ul",jk,[(v(!0),E(Ve,null,_t(R.value,z=>(v(),E("li",{key:z.value},[h("button",{class:st(["composer-dropdown-option",{"is-selected":z.value===e.modelValue}]),type:"button",onClick:Te=>F(z.value)},le(z.label),11,Uk)]))),128)),R.value.length===0?(v(),E("li",Fk," No matching projects ")):ce("",!0)]),D.value?(v(),E("div",Bk,[u.value?(v(),E(Ve,{key:0},[Tr(h("input",{ref_key:"addInputRef",ref:i,"onUpdate:modelValue":_e[1]||(_e[1]=z=>c.value=z),class:"composer-dropdown-add-input",type:"text",placeholder:A.value,onKeydown:[vn(rt(ve,["prevent"]),["enter"]),vn(rt(ke,["prevent"]),["esc"])]},null,40,Hk),[[Sr,c.value]]),h("div",{class:"composer-dropdown-add-actions"},[h("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ve},"Open"),h("button",{type:"button",class:"composer-dropdown-add-btn",onClick:ke},"Cancel")])],64)):(v(),E("button",{key:1,type:"button",class:"composer-dropdown-add",onClick:X},le(ee.value),1))])):ce("",!0)])],2)):ce("",!0)],512))}}),oo=lt(Wk,[["__scopeId","data-v-47426238"]]),Vk=["disabled"],zk={class:"search-dropdown-value"},Gk={class:"search-dropdown-search-wrap"},qk=["placeholder","onKeydown"],Kk={key:0,class:"search-dropdown-list",role:"listbox"},Jk=["onClick","onPointerenter"],Yk={class:"search-dropdown-option-check"},Xk={class:"search-dropdown-option-label"},Qk={key:0,class:"search-dropdown-option-desc"},Zk={key:1,class:"search-dropdown-empty"},e0=Wt({__name:"ComposerSearchDropdown",props:{options:{},selectedValues:{},placeholder:{},searchPlaceholder:{},disabled:{type:Boolean},openDirection:{}},emits:["toggle"],setup(e,{emit:t}){const n=e,r=t,s=O(null),o=O(null),i=O(null),a=O(!1),l=O(""),u=O(0),c=ie(()=>n.openDirection??"down"),f=ie(()=>new Set(n.selectedValues)),m=ie(()=>{if(n.selectedValues.length===0)return n.placeholder||"Select...";if(n.selectedValues.length===1){const F=n.options.find(X=>X.value===n.selectedValues[0]);return(F==null?void 0:F.label)||n.placeholder||"Select..."}return`${n.selectedValues.length} selected`}),S=ie(()=>{const F=l.value.toLowerCase().trim();return F?n.options.filter(X=>{var ae;return X.label.toLowerCase().includes(F)||(((ae=X.description)==null?void 0:ae.toLowerCase().includes(F))??!1)}):n.options});function D(){const F=o.value,X=s.value;if(!F||!X||window.innerWidth>=640)return;const ae=X.getBoundingClientRect();c.value==="up"?(F.style.setProperty("bottom",`${window.innerHeight-ae.top+8}px`,"important"),F.style.setProperty("top","auto","important")):(F.style.setProperty("top",`${ae.bottom+8}px`,"important"),F.style.setProperty("bottom","auto","important"))}function H(){n.disabled||(a.value=!a.value,a.value&&(l.value="",u.value=0,Xt(()=>{var F;Xt(()=>{D()}),(F=i.value)==null||F.focus()})))}function ee(F){r("toggle",F.value,!f.value.has(F.value))}function A(F){S.value.length!==0&&(u.value=(u.value+F+S.value.length)%S.value.length)}function R(){const F=S.value[u.value];F&&ee(F)}function B(F){if(!a.value)return;const X=s.value;if(!X)return;const ae=F.target;ae instanceof Node&&(X.contains(ae)||(a.value=!1))}return at(l,()=>{u.value=0}),ar(()=>window.addEventListener("pointerdown",B)),Ar(()=>window.removeEventListener("pointerdown",B)),(F,X)=>(v(),E("div",{ref_key:"rootRef",ref:s,class:"search-dropdown"},[h("button",{class:"search-dropdown-trigger",type:"button",disabled:e.disabled,onClick:H},[h("span",zk,le(m.value),1),Pe(ji,{class:"search-dropdown-chevron"})],8,Vk),a.value?(v(),E("div",{key:0,ref_key:"menuRef",ref:o,class:st(["search-dropdown-menu-wrap",{"search-dropdown-menu-wrap-up":c.value==="up","search-dropdown-menu-wrap-down":c.value==="down"}])},[h("div",Gk,[Tr(h("input",{ref_key:"searchRef",ref:i,"onUpdate:modelValue":X[0]||(X[0]=ae=>l.value=ae),class:"search-dropdown-search",type:"text",placeholder:e.searchPlaceholder,onKeydown:[X[1]||(X[1]=vn(rt(ae=>a.value=!1,["prevent"]),["escape"])),vn(rt(R,["prevent"]),["enter"]),X[2]||(X[2]=vn(rt(ae=>A(1),["prevent"]),["arrow-down"])),X[3]||(X[3]=vn(rt(ae=>A(-1),["prevent"]),["arrow-up"]))]},null,40,qk),[[Sr,l.value]])]),S.value.length>0?(v(),E("ul",Kk,[(v(!0),E(Ve,null,_t(S.value,(ae,ve)=>(v(),E("li",{key:ae.value},[h("button",{class:st(["search-dropdown-option",{"is-selected":f.value.has(ae.value),"is-highlighted":ve===u.value}]),type:"button",onClick:ke=>ee(ae),onPointerenter:ke=>u.value=ve},[h("span",Yk,le(f.value.has(ae.value)?"✓":""),1),h("span",Xk,le(ae.label),1),ae.description?(v(),E("span",Qk,le(ae.description),1)):ce("",!0)],42,Jk)]))),128))])):(v(),E("div",Zk,"No results"))],2)):ce("",!0)],512))}}),t0=lt(e0,[["__scopeId","data-v-22b6d035"]]),n0={class:"skill-picker-header"},r0=["onKeydown"],s0={key:0,class:"skill-picker-list",role:"listbox"},o0=["onClick","onPointerenter"],i0={class:"skill-picker-name"},a0={key:0,class:"skill-picker-desc"},l0={key:1,class:"skill-picker-empty"},c0=Wt({__name:"ComposerSkillPicker",props:{skills:{},visible:{type:Boolean},anchorBottom:{},anchorLeft:{}},emits:["select","close"],setup(e,{emit:t}){const n=e,r=t,s=O(null),o=O(null),i=O(""),a=O(0),l=ie(()=>{const m=i.value.toLowerCase().trim();return m?n.skills.filter(S=>S.name.toLowerCase().includes(m)||S.description.toLowerCase().includes(m)):n.skills}),u=ie(()=>{const m={};return n.anchorBottom!=null&&(m.bottom=`${n.anchorBottom}px`),n.anchorLeft!=null&&(m.left=`${n.anchorLeft}px`),m});function c(m){l.value.length!==0&&(a.value=(a.value+m+l.value.length)%l.value.length)}function f(){const m=l.value[a.value];m&&r("select",m)}return at(()=>n.visible,m=>{m&&(i.value="",a.value=0,Xt(()=>{var S;return(S=o.value)==null?void 0:S.focus()}))}),at(i,()=>{a.value=0}),(m,S)=>e.visible?(v(),E("div",{key:0,ref_key:"rootRef",ref:s,class:"skill-picker",style:Fr(u.value)},[h("div",n0,[Tr(h("input",{ref_key:"searchInputRef",ref:o,"onUpdate:modelValue":S[0]||(S[0]=D=>i.value=D),class:"skill-picker-search",type:"text",placeholder:"Search skills...",onKeydown:[S[1]||(S[1]=vn(rt(D=>m.$emit("close"),["prevent"]),["escape"])),vn(rt(f,["prevent"]),["enter"]),S[2]||(S[2]=vn(rt(D=>c(1),["prevent"]),["arrow-down"])),S[3]||(S[3]=vn(rt(D=>c(-1),["prevent"]),["arrow-up"]))]},null,40,r0),[[Sr,i.value]])]),l.value.length>0?(v(),E("ul",s0,[(v(!0),E(Ve,null,_t(l.value,(D,H)=>(v(),E("li",{key:D.path},[h("button",{class:st(["skill-picker-item",{"is-highlighted":H===a.value}]),type:"button",onClick:ee=>m.$emit("select",D),onPointerenter:ee=>a.value=H},[h("span",i0,le(D.name),1),D.description?(v(),E("span",a0,le(D.description),1)):ce("",!0)],42,o0)]))),128))])):(v(),E("div",l0,"No skills found"))],4)):ce("",!0)}}),u0=lt(c0,[["__scopeId","data-v-ff3fb7dc"]]),d0={key:0,class:"thread-composer-dictation-error"},f0={key:0,class:"thread-composer-attachments"},h0=["src","alt"],p0=["aria-label","disabled","onClick"],m0={key:1,class:"thread-composer-folder-chips"},g0=["title"],v0={class:"thread-composer-folder-chip-meta"},y0=["aria-label","disabled","onClick"],w0={key:2,class:"thread-composer-file-chips"},b0=["title"],_0=["aria-label","disabled","onClick"],k0={key:3,class:"thread-composer-skill-chips"},T0={class:"thread-composer-skill-chip-name"},S0=["aria-label","onClick"],I0={class:"thread-composer-input-wrap"},E0={key:0,class:"thread-composer-file-mentions"},C0=["onMousedown"],A0={key:1,class:"thread-composer-file-mention-icon-markdown"},x0={class:"thread-composer-file-mention-text"},R0={class:"thread-composer-file-mention-name"},P0={key:0,class:"thread-composer-file-mention-dir"},M0={key:1,class:"thread-composer-file-mention-empty"},$0=["placeholder","disabled"],O0=["disabled"],N0={key:0,class:"thread-composer-attach-menu"},D0=["disabled"],L0=["disabled"],j0=["disabled"],U0={class:"thread-composer-attach-mode"},F0={class:"thread-composer-attach-mode-buttons"},B0=["disabled"],H0=["disabled"],W0=["aria-checked","aria-label","disabled"],V0={class:"thread-composer-attach-setting-copy"},z0={class:"thread-composer-attach-setting-description"},G0={key:0,class:"thread-composer-dictation-waveform-wrap","aria-hidden":"true"},q0={key:1,class:"thread-composer-dictation-timer"},K0=["aria-label","title","disabled"],J0=["disabled"],Y0=["aria-label","title","disabled"],X0=["disabled"],Q0=["disabled"],Z0=["disabled"],eT="codex-web-local.thread-draft.v1.",tT=Wt({__name:"ThreadComposer",props:{activeThreadId:{},cwd:{},models:{},selectedModel:{},selectedReasoningEffort:{},selectedSpeedMode:{},skills:{},isTurnInProgress:{type:Boolean},isInterruptingTurn:{type:Boolean},isUpdatingSpeedMode:{type:Boolean},disabled:{type:Boolean},hasQueueAbove:{type:Boolean},sendWithEnter:{type:Boolean},inProgressSubmitMode:{},dictationClickToToggle:{type:Boolean},prependDraftRequest:{},dictationAutoSend:{type:Boolean},dictationLanguage:{}},emits:["submit","interrupt","update:selected-model","update:selected-reasoning-effort","update:selected-speed-mode"],setup(e,{expose:t,emit:n}){const r=e,s=n,o=O(""),i=O([]),a=O([]),l=O([]),u=O([]),c=O(""),{state:f,isSupported:m,recordingDurationMs:S,waveformCanvasRef:D,startRecording:H,stopRecording:ee,toggleRecording:A,cancel:R}=m_({getLanguage:()=>r.dictationLanguage??"auto",onTranscript:y=>{if(o.value=o.value?`${o.value}
|
|
39
|
+
${y}`:y,c.value="",r.dictationAutoSend!==!1){const C=r.isTurnInProgress?V.value:"steer";de(C,{rollbackLatestUserTurn:C==="steer"&&ze}),ze=!1;return}Xt(()=>{var C;return(C=ve.value)==null?void 0:C.focus()})},onEmpty:()=>{c.value=r.dictationClickToToggle?"No speech detected. Click again after speaking.":"No speech detected. Hold the mic and speak."},onError:y=>{if(y instanceof DOMException&&y.name==="NotAllowedError"){c.value="Microphone access was denied.";return}c.value=y instanceof Error?y.message:"Dictation failed."}}),B=O(null),F=O(null),X=O(null),ae=O(null),ve=O(null),ke=O(!1),ue=O(!1),fe=O(null),_e=O(""),z=O([]),Te=O(!1),Ne=O(0),Ue=O(0);let Ae=0,$e=null,De=!1,ze=!1;const tt=typeof navigator<"u"&&/Android/i.test(navigator.userAgent);let Oe="";const Qe=[{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"}];function wt(y){return y.trim().replace(/^gpt/i,"GPT")}const ct=ie(()=>r.models.map(y=>({value:y,label:wt(y)}))),Ze=ie(()=>r.skills??[]),Je=ie(()=>a.value.map(y=>y.path)),K=ie(()=>(r.skills??[]).map(y=>({value:y.path,label:y.name,description:y.description}))),pe=ie(()=>r.disabled||r.isUpdatingSpeedMode||!r.activeThreadId?!1:o.value.trim().length>0||i.value.length>0||l.value.length>0),he=ie(()=>o.value.trim().length>0||i.value.length>0||a.value.length>0||l.value.length>0||u.value.length>0),Ee=ie(()=>{const y=new Set;for(const C of u.value)for(const L of C.filePaths)y.add(L);return l.value.filter(C=>!y.has(C.fsPath))}),Se=ie(()=>r.disabled||!r.activeThreadId),b=ie(()=>r.selectedModel.trim()==="gpt-5.4"),T=ie(()=>r.selectedSpeedMode==="fast"&&b.value),M=ie(()=>Se.value||r.isUpdatingSpeedMode===!0),q=ie(()=>r.isUpdatingSpeedMode?"Saving speed setting...":r.selectedSpeedMode==="fast"?"About 1.5x faster, with credits used at 2x":"Default speed with normal credit usage"),Q=ie(()=>r.inProgressSubmitMode==="steer"?"steer":"queue"),V=O(Q.value),me=ie(()=>f.value==="recording"),oe=ie(()=>f.value==="recording"?"Stop dictation":r.dictationClickToToggle?"Click to dictate":"Hold to dictate"),W=ie(()=>f.value==="idle"?c.value.trim():""),U=ie(()=>{const y=Math.max(0,Math.floor(S.value/1e3)),C=Math.floor(y/60),L=y%60;return`${C}:${String(L).padStart(2,"0")}`}),te=ie(()=>r.activeThreadId?"Type a message... (@ for files, / for skills)":"Select a thread to send a message"),se=ie(()=>o.value.trim().length>0||i.value.length>0||l.value.length>0);function de(y="steer",C){var Z;const L=o.value.trim();if(pe.value){if(s("submit",{text:L,imageUrls:i.value.map(xe=>xe.url),fileAttachments:[...l.value],skills:a.value.map(xe=>({name:xe.name,path:xe.path})),mode:y,rollbackLatestUserTurn:(C==null?void 0:C.rollbackLatestUserTurn)===!0}),xt(r.activeThreadId),Fe(),tt){(Z=ve.value)==null||Z.blur();return}Xt(()=>{var xe;return(xe=ve.value)==null?void 0:xe.focus()})}}function Ie(y){V.value=y}function We(y){Ue.value+=1,o.value=y.text,i.value=y.imageUrls.map((C,L)=>({id:`queued-${Date.now()}-${L}-${Math.random().toString(36).slice(2,8)}`,name:`Image ${L+1}`,url:C})),a.value=y.skills.map(C=>(r.skills??[]).find(L=>L.path===C.path)??{name:C.name,description:"",path:C.path}),l.value=y.fileAttachments.map(C=>({...C})),u.value=[],c.value="",ke.value=!1,ue.value=!1,Kt()}function Fe(){We({text:"",imageUrls:[],fileAttachments:[],skills:[]})}function Me(y){return`${eT}${y}`}function Ye(y){if(typeof window>"u")return null;const C=y.trim();if(!C)return null;try{const L=window.localStorage.getItem(Me(C));if(!L)return null;const Z=JSON.parse(L);return typeof Z=="string"?{text:Z,imageUrls:[],fileAttachments:[],skills:[]}:{text:typeof Z.text=="string"?Z.text:"",imageUrls:Array.isArray(Z.imageUrls)?Z.imageUrls.filter(xe=>typeof xe=="string"):[],fileAttachments:Array.isArray(Z.fileAttachments)?Z.fileAttachments.filter(xe=>!!xe&&typeof xe.label=="string"&&typeof xe.path=="string"&&typeof xe.fsPath=="string"):[],skills:Array.isArray(Z.skills)?Z.skills.filter(xe=>!!xe&&typeof xe.name=="string"&&typeof xe.path=="string"):[]}}catch{return null}}function et(y,C){if(typeof window>"u")return;const L=y.trim();if(L)try{if(C.text.trim().length>0||C.imageUrls.length>0||C.fileAttachments.length>0||C.skills.length>0){window.localStorage.setItem(Me(L),JSON.stringify(C));return}window.localStorage.removeItem(Me(L))}catch{}}function xt(y){et(y,{text:"",imageUrls:[],fileAttachments:[],skills:[]})}function ft(){return{text:o.value,imageUrls:i.value.map(y=>y.url),fileAttachments:l.value.map(y=>({...y})),skills:a.value.map(y=>({name:y.name,path:y.path}))}}function Ct(){s("interrupt")}function Lt(y){s("update:selected-model",y)}function pt(y){s("update:selected-reasoning-effort",y)}function Pt(){M.value||s("update:selected-speed-mode",r.selectedSpeedMode==="fast"?"standard":"fast")}function mt(){r.dictationClickToToggle&&(c.value&&(c.value=""),f.value==="idle"&&(ze=r.isTurnInProgress===!0&&V.value==="steer"),A())}function Vt(y){if(r.dictationClickToToggle||(y.preventDefault(),De))return;De=!0;const C=y.currentTarget;if(C)try{C.setPointerCapture(y.pointerId)}catch{}c.value&&(c.value=""),ze=r.isTurnInProgress===!0&&V.value==="steer",window.addEventListener("pointerup",nt),window.addEventListener("pointercancel",nt),window.addEventListener("blur",nt),H()}function nt(){r.dictationClickToToggle||De&&(De=!1,window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),window.removeEventListener("blur",nt),ee())}function bn(){Se.value||(ke.value=!ke.value)}function zt(){var y;(y=F.value)==null||y.click()}function Mt(){var y;(y=X.value)==null||y.click()}function un(){var y;(y=ae.value)==null||y.click()}function kt(y){i.value=i.value.filter(C=>C.id!==y)}function It(y){a.value=a.value.filter(C=>C.path!==y)}function en(y){l.value=l.value.filter(C=>C.fsPath!==y)}function jt(y){const C=u.value.find(Z=>Z.id===y);if(!C)return;const L=new Set(C.filePaths);l.value=l.value.filter(Z=>!L.has(Z.fsPath)),u.value=u.value.filter(Z=>Z.id!==y)}function At(y){return y.total<=0?0:Math.round(y.processed/y.total*100)}function Gt(y,C){const L=y.replace(/\\/g,"/");if(l.value.some(Xe=>Xe.fsPath===L))return;const Z=L.split("/").filter(Boolean),xe=(C==null?void 0:C.trim())||Z[Z.length-1]||L;l.value=[...l.value,{label:xe,path:L,fsPath:L}]}function In(y){return y.type.startsWith("image/")?!0:/\.(png|jpe?g|gif|webp)$/i.test(y.name)}function $t(y){if(!y||y.length===0)return;const C=Ue.value;for(const L of Array.from(y))if(In(L)){const Z=new FileReader;Z.onload=()=>{C===Ue.value&&typeof Z.result=="string"&&i.value.push({id:`${Date.now()}-${Math.random().toString(36).slice(2)}`,name:L.name,url:Z.result})},Z.readAsDataURL(L)}else vu(L).then(Z=>{C===Ue.value&&Z&&Gt(Z)}).catch(()=>{})}async function En(y){if(!y||y.length===0)return;const C=Ue.value,L=Array.from(y),xe=(L[0].webkitRelativePath||L[0].name).split("/").filter(Boolean)[0]||"Folder",Xe=`${Date.now()}-${Math.random().toString(36).slice(2)}`;u.value=[...u.value,{id:Xe,name:xe,total:L.length,processed:0,filePaths:[],isUploading:!0}];const ut=Rt=>{C===Ue.value&&(u.value=u.value.map(k=>k.id===Xe?Rt(k):k))};for(const Rt of L)try{const k=await vu(Rt);if(C!==Ue.value)return;if(k){const $=Rt.webkitRelativePath||Rt.name;Gt(k,$),ut(N=>({...N,processed:N.processed+1,filePaths:[...N.filePaths,k]}));continue}ut($=>({...$,processed:$.processed+1}))}catch{ut(k=>({...k,processed:k.processed+1}))}ut(Rt=>({...Rt,isUploading:!1}))}function Yt(y){y&&(y.value="")}function He(y){const C=y.target;$t((C==null?void 0:C.files)??null),Yt(C),ke.value=!1}function Le(y){const C=y.target;$t((C==null?void 0:C.files)??null),Yt(C),ke.value=!1}function qt(y){const C=y.target;En((C==null?void 0:C.files)??null),Yt(C),ke.value=!1}function dn(){c.value&&(c.value="");const C=o.value.startsWith("/");C!==ue.value&&(ue.value=C),Ut()}function Pn(y){if(Te.value){if(y.key==="Escape"){y.preventDefault(),Kt();return}if(y.key==="ArrowDown"){y.preventDefault(),z.value.length>0&&(Ne.value=(Ne.value+1)%z.value.length);return}if(y.key==="ArrowUp"){if(y.preventDefault(),z.value.length>0){const L=z.value.length;Ne.value=(Ne.value+L-1)%L}return}if(y.key==="Enter"||y.key==="Tab"){y.preventDefault();const L=z.value[Ne.value];L?fn(L):Kt();return}}if(r.sendWithEnter!==!1?y.key==="Enter"&&!y.shiftKey:y.key==="Enter"&&(y.metaKey||y.ctrlKey)){y.preventDefault(),de(r.isTurnInProgress?V.value:"steer");return}if(ue.value){if(y.key==="Escape"){y.preventDefault(),_n();return}if(y.key==="ArrowDown"||y.key==="ArrowUp"){y.preventDefault();return}}}function _n(){var y;ue.value=!1,(y=ve.value)==null||y.focus()}function Kt(){Te.value=!1,fe.value=null,_e.value="",z.value=[],Ne.value=0}function Ut(){const y=ve.value;if(!y){Kt();return}const C=y.selectionStart??o.value.length,Z=o.value.slice(0,C).match(/(^|\s)(@[^\s@]*)$/);if(!Z){Kt();return}const xe=Z[2]??"",Xe=xe.length,ut=C-Xe;fe.value=ut,_e.value=xe.slice(1),Te.value=!0,tn()}async function tn(){if(!Te.value)return;const y=(r.cwd??"").trim();if(!y){z.value=[];return}$e&&clearTimeout($e);const C=++Ae;$e=setTimeout(async()=>{try{const L=await ck(y,_e.value,20);if(!Te.value||C!==Ae)return;z.value=L,Ne.value=0}catch{if(!Te.value||C!==Ae)return;z.value=[]}},120)}function fn(y){const C=ve.value,L=fe.value;if(L!==null&&C){const Z=C.selectionStart??o.value.length;o.value=`${o.value.slice(0,L)}${o.value.slice(Z)}`.trimEnd()}Gt(y.path),Kt(),Xt(()=>C==null?void 0:C.focus())}function Un(y){R(),We(y),Xt(()=>{var C;return(C=ve.value)==null?void 0:C.focus()})}function Mn(y){const C=y.lastIndexOf("/");return C<0?y:y.slice(C+1)}function $n(y){const C=y.lastIndexOf("/");return C<=0?"":y.slice(0,C)}function kn(y){const C=Mn(y),L=C.lastIndexOf(".");return L<=0?"":C.slice(L+1).toLowerCase()}function Cn(y){const C=kn(y);return C==="ts"?"TS":C==="tsx"?"TSX":C==="js"?"JS":C==="jsx"?"JSX":C==="json"?"{}":""}function On(y){const C=kn(y);return C.startsWith("ts")?"ts":C.startsWith("js")?"js":C==="json"?"json":"default"}function w(y){const C=kn(y);return C==="md"||C==="mdx"}function I(y){var C;a.value.some(L=>L.path===y.path)||(a.value=[...a.value,y]),o.value=o.value.startsWith("/")?"":o.value,ue.value=!1,(C=ve.value)==null||C.focus()}function x(y,C){if(C){const L=(r.skills??[]).find(Z=>Z.path===y);L&&!a.value.some(Z=>Z.path===y)&&(a.value=[...a.value,L])}else a.value=a.value.filter(L=>L.path!==y)}function G(y){if(!ke.value)return;const C=B.value;if(!C)return;const L=y.target;!L||C.contains(L)||(ke.value=!1)}return ar(()=>{document.addEventListener("click",G)}),t({hydrateDraft:Un,hasUnsavedDraft:()=>he.value}),Ar(()=>{document.removeEventListener("click",G),window.removeEventListener("pointerup",nt),window.removeEventListener("pointercancel",nt),window.removeEventListener("blur",nt),$e&&clearTimeout($e)}),at(()=>r.activeThreadId,y=>{R(),Oe&&et(Oe,ft()),Fe();const C=Ye(y);C&&(We(C),dn()),Oe=y.trim()},{immediate:!0}),at([o,i,l,a],()=>{Oe&&et(Oe,ft())},{deep:!0}),at(()=>r.cwd,()=>{Te.value&&tn()}),at(Q,y=>{V.value=y}),at(()=>{var y;return(y=r.prependDraftRequest)==null?void 0:y.id},()=>{var C,L;const y=((L=(C=r.prependDraftRequest)==null?void 0:C.text)==null?void 0:L.trim())??"";y&&(o.value=o.value?`${y}
|
|
40
|
+
${o.value}`:y,dn(),Xt(()=>{var Z;return(Z=ve.value)==null?void 0:Z.focus()}))}),(y,C)=>(v(),E("form",{class:"thread-composer",onSubmit:C[4]||(C[4]=rt(L=>de(e.isTurnInProgress?V.value:"steer"),["prevent"]))},[W.value?(v(),E("p",d0,le(W.value),1)):ce("",!0),h("div",{class:st(["thread-composer-shell",{"thread-composer-shell--no-top-radius":e.hasQueueAbove}])},[i.value.length>0?(v(),E("div",f0,[(v(!0),E(Ve,null,_t(i.value,L=>(v(),E("div",{key:L.id,class:"thread-composer-attachment"},[h("img",{class:"thread-composer-attachment-image",src:L.url,alt:L.name||"Selected image"},null,8,h0),h("button",{class:"thread-composer-attachment-remove",type:"button","aria-label":`Remove ${L.name||"image"}`,disabled:Se.value,onClick:Z=>kt(L.id)}," x ",8,p0)]))),128))])):ce("",!0),u.value.length>0?(v(),E("div",m0,[(v(!0),E(Ve,null,_t(u.value,L=>(v(),E("span",{key:L.id,class:"thread-composer-folder-chip"},[Pe(Ui,{class:"thread-composer-folder-chip-icon"}),h("span",{class:"thread-composer-folder-chip-name",title:L.name},le(L.name),9,g0),h("span",v0,[L.isUploading?(v(),E(Ve,{key:0},[po(le(At(L))+"% uploading ("+le(L.processed)+"/"+le(L.total)+") ",1)],64)):(v(),E(Ve,{key:1},[po(le(L.filePaths.length)+" file"+le(L.filePaths.length===1?"":"s"),1)],64))]),h("button",{class:"thread-composer-folder-chip-remove",type:"button","aria-label":`Remove folder ${L.name}`,disabled:Se.value,onClick:Z=>jt(L.id)},"×",8,y0)]))),128))])):ce("",!0),Ee.value.length>0?(v(),E("div",w0,[(v(!0),E(Ve,null,_t(Ee.value,L=>(v(),E("span",{key:L.fsPath,class:"thread-composer-file-chip"},[Pe(mi,{class:"thread-composer-file-chip-icon"}),h("span",{class:"thread-composer-file-chip-name",title:L.fsPath},le(L.label),9,b0),h("button",{class:"thread-composer-file-chip-remove",type:"button","aria-label":`Remove ${L.label}`,disabled:Se.value,onClick:Z=>en(L.fsPath)},"×",8,_0)]))),128))])):ce("",!0),a.value.length>0?(v(),E("div",k0,[(v(!0),E(Ve,null,_t(a.value,L=>(v(),E("span",{key:L.path,class:"thread-composer-skill-chip"},[h("span",T0,le(L.name),1),h("button",{class:"thread-composer-skill-chip-remove",type:"button","aria-label":`Remove skill ${L.name}`,onClick:Z=>It(L.path)},"×",8,S0)]))),128))])):ce("",!0),h("div",I0,[Te.value?(v(),E("div",E0,[z.value.length>0?(v(!0),E(Ve,{key:0},_t(z.value,(L,Z)=>(v(),E("button",{key:L.path,class:st(["thread-composer-file-mention-row",{"is-active":Z===Ne.value}]),type:"button",onMousedown:rt(xe=>fn(L),["prevent"])},[Cn(L.path)?(v(),E("span",{key:0,class:st(["thread-composer-file-mention-icon-badge",`is-${On(L.path)}`])},le(Cn(L.path)),3)):w(L.path)?(v(),E("span",A0,"↓")):(v(),dt(mi,{key:2,class:"thread-composer-file-mention-icon-file"})),h("span",x0,[h("span",R0,le(Mn(L.path)),1),$n(L.path)?(v(),E("span",P0,le($n(L.path)),1)):ce("",!0)])],42,C0))),128)):(v(),E("div",M0,"No matching files"))])):ce("",!0),Tr(h("textarea",{ref_key:"inputRef",ref:ve,"onUpdate:modelValue":C[0]||(C[0]=L=>o.value=L),class:"thread-composer-input",placeholder:te.value,disabled:Se.value,onInput:dn,onKeydown:Pn},null,40,$0),[[Sr,o.value]]),Pe(u0,{skills:Ze.value,visible:ue.value,"anchor-bottom":44,"anchor-left":0,onSelect:I,onClose:_n},null,8,["skills","visible"])]),h("div",{class:st(["thread-composer-controls",{"thread-composer-controls--recording":me.value}])},[h("div",{ref_key:"attachMenuRootRef",ref:B,class:"thread-composer-attach"},[h("button",{class:"thread-composer-attach-trigger",type:"button","aria-label":"Add photos & files",disabled:Se.value,onClick:bn}," + ",8,O0),ke.value?(v(),E("div",N0,[h("button",{class:"thread-composer-attach-item",type:"button",disabled:Se.value,onClick:zt}," Add photos & files ",8,D0),h("button",{class:"thread-composer-attach-item",type:"button",disabled:Se.value,onClick:un}," Add folder ",8,L0),h("button",{class:"thread-composer-attach-item",type:"button",disabled:Se.value,onClick:Mt}," Take photo ",8,j0),C[7]||(C[7]=h("div",{class:"thread-composer-attach-separator"},null,-1)),h("div",U0,[C[5]||(C[5]=h("span",{class:"thread-composer-attach-mode-label"},"In-progress send",-1)),h("div",F0,[h("button",{class:st(["thread-composer-attach-mode-button",{"is-active":V.value==="steer"}]),type:"button",disabled:Se.value,onClick:C[1]||(C[1]=L=>Ie("steer"))}," Steer ",10,B0),h("button",{class:st(["thread-composer-attach-mode-button",{"is-active":V.value==="queue"}]),type:"button",disabled:Se.value,onClick:C[2]||(C[2]=L=>Ie("queue"))}," Queue ",10,H0)])]),C[8]||(C[8]=h("div",{class:"thread-composer-attach-separator"},null,-1)),b.value?(v(),E("button",{key:0,class:"thread-composer-attach-setting",type:"button",role:"switch","aria-checked":e.selectedSpeedMode==="fast","aria-label":`Fast mode ${e.selectedSpeedMode==="fast"?"enabled":"disabled"}`,disabled:M.value,onClick:Pt},[h("span",V0,[C[6]||(C[6]=h("span",{class:"thread-composer-attach-setting-label"},"Fast mode",-1)),h("span",z0,le(q.value),1)]),h("span",{class:st(["thread-composer-attach-switch",{"is-on":e.selectedSpeedMode==="fast","is-busy":e.isUpdatingSpeedMode,"is-disabled":M.value}])},null,2)],8,W0)):ce("",!0)])):ce("",!0)],512),me.value?ce("",!0):(v(),E(Ve,{key:0},[Pe(oo,{class:"thread-composer-control","model-value":e.selectedModel,options:ct.value,"selected-prefix-icon":T.value?Ik:null,placeholder:"Model","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.models.length===0||e.isTurnInProgress,"onUpdate:modelValue":Lt},null,8,["model-value","options","selected-prefix-icon","disabled"]),Pe(t0,{class:"thread-composer-control",options:K.value,"selected-values":Je.value,placeholder:"Skills","search-placeholder":"Search skills...","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,onToggle:x},null,8,["options","selected-values","disabled"]),Pe(oo,{class:"thread-composer-control","model-value":e.selectedReasoningEffort,options:Qe,placeholder:"Thinking","open-direction":"up",disabled:e.disabled||!e.activeThreadId||e.isTurnInProgress,"onUpdate:modelValue":pt},null,8,["model-value","disabled"])],64)),h("div",{class:st(["thread-composer-actions",{"thread-composer-actions--recording":me.value}])},[be(f)==="recording"?(v(),E("div",G0,[h("canvas",{ref_key:"dictationWaveformCanvasRef",ref:D,class:"thread-composer-dictation-waveform"},null,512)])):ce("",!0),be(f)==="recording"?(v(),E("span",q0,le(U.value),1)):ce("",!0),be(m)?(v(),E("button",{key:2,class:st(["thread-composer-mic",{"thread-composer-mic--active":be(f)==="recording"}]),type:"button","aria-label":oe.value,title:oe.value,disabled:Se.value,onClick:mt,onPointerdown:Vt,onPointerup:nt,onPointercancel:nt},[be(f)==="recording"?(v(),dt(yu,{key:0,class:"thread-composer-mic-icon thread-composer-mic-icon--stop"})):(v(),dt(xk,{key:1,class:"thread-composer-mic-icon"}))],42,K0)):ce("",!0),e.isTurnInProgress&&!se.value?(v(),E("button",{key:3,class:"thread-composer-stop",type:"button","aria-label":"Stop",disabled:e.disabled||!e.activeThreadId||e.isInterruptingTurn,onClick:Ct},[Pe(yu,{class:"thread-composer-stop-icon"})],8,J0)):(v(),E("button",{key:4,class:st(["thread-composer-submit",{"thread-composer-submit--queue":e.isTurnInProgress&&V.value==="queue"}]),type:"button","aria-label":e.isTurnInProgress&&V.value==="queue"?"Queue message":"Send message",title:e.isTurnInProgress?`Send as ${V.value}`:"Send",disabled:!pe.value,onClick:C[3]||(C[3]=L=>de(e.isTurnInProgress?V.value:"steer"))},[Pe(_k,{class:"thread-composer-submit-icon"})],10,Y0))],2)],2)],2),h("input",{ref_key:"photoLibraryInputRef",ref:F,class:"thread-composer-hidden-input",type:"file",multiple:"",disabled:Se.value,onChange:He},null,40,X0),h("input",{ref_key:"cameraCaptureInputRef",ref:X,class:"thread-composer-hidden-input",type:"file",accept:"image/*",capture:"environment",disabled:Se.value,onChange:Le},null,40,Q0),h("input",{ref_key:"folderPickerInputRef",ref:ae,class:"thread-composer-hidden-input",type:"file",multiple:"",webkitdirectory:"",directory:"",disabled:Se.value,onChange:qt},null,40,Z0)],32))}}),wu=lt(tT,[["__scopeId","data-v-616f2541"]]),nT={key:0,class:"queued-messages"},rT={class:"queued-messages-inner"},sT={class:"queued-row-text"},oT={class:"queued-row-actions"},iT=["onClick"],aT=["onClick"],lT=["onClick"],cT=Wt({__name:"QueuedMessages",props:{messages:{}},emits:["edit","steer","delete"],setup(e){function t(n){var l,u,c;const r=n.text.trim();if(r)return r;const s=[],o=((l=n.imageUrls)==null?void 0:l.length)??0,i=((u=n.fileAttachments)==null?void 0:u.length)??0,a=((c=n.skills)==null?void 0:c.length)??0;return o>0&&s.push(`${o} image${o===1?"":"s"}`),i>0&&s.push(`${i} file${i===1?"":"s"}`),a>0&&s.push(`${a} skill${a===1?"":"s"}`),s.join(", ")||"(empty queued message)"}return(n,r)=>e.messages.length>0?(v(),E("div",nT,[h("div",rT,[(v(!0),E(Ve,null,_t(e.messages,s=>(v(),E("div",{key:s.id,class:"queued-row"},[r[1]||(r[1]=h("svg",{class:"queued-row-icon",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[h("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)),h("span",sT,le(t(s)),1),h("div",oT,[h("button",{class:"queued-row-edit",type:"button",title:"Edit queued message",onClick:o=>n.$emit("edit",s.id)},"Edit",8,iT),h("button",{class:"queued-row-steer",type:"button",title:"Send now without interrupting work",onClick:o=>n.$emit("steer",s.id)},"Steer",8,aT),h("button",{class:"queued-row-delete",type:"button","aria-label":"Delete queued message",title:"Delete queued message",onClick:o=>n.$emit("delete",s.id)},[...r[0]||(r[0]=[h("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"},[h("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,lT)])]))),128))])])):ce("",!0)}}),uT=lt(cT,[["__scopeId","data-v-1394d0f8"]]),dT={key:0,class:"rate-limit-status","aria-live":"polite"},fT=["title"],hT={class:"rate-limit-card-header"},pT={class:"rate-limit-card-title"},mT={key:0,class:"rate-limit-card-plan"},gT={class:"rate-limit-card-metrics"},vT={key:0,class:"rate-limit-card-footer"},yT=Wt({__name:"RateLimitStatus",props:{snapshots:{}},setup(e){function t(A){var R,B;return((R=A.limitId)==null?void 0:R.trim())||((B=A.limitName)==null?void 0:B.trim())||"__default__"}function n(A){var R,B;return((R=A.limitName)==null?void 0:R.trim())||((B=A.limitId)==null?void 0:B.trim())||"Rate limits"}function r(A){const R=A.trim();return R?R.replace(/[_-]+/g," ").replace(/\b\w/g,B=>B.toUpperCase()):""}function s(A){return!A||A<=0?"Window":A%1440===0?`${A/1440}d`:A%60===0?`${A/60}h`:A<60?`${A}m`:`${Math.round(A/60*10)/10}h`}function o(A){const R=Math.max(0,Math.min(100,100-A));return`${Math.round(R)}% left`}function i(A){return`${Math.round(A)}%`}function a(A,R){return{key:R,label:`${s(A.windowDurationMins)} ${o(A.usedPercent)}`}}function l(A){const R=[];return A.primary&&R.push(a(A.primary,"primary")),A.secondary&&R.push(a(A.secondary,"secondary")),R}function u(A){if(!A)return"";const R=new Date(A*1e3),B=R.getMonth()+1,F=String(R.getDate()).padStart(2,"0"),X=String(R.getHours()).padStart(2,"0"),ae=String(R.getMinutes()).padStart(2,"0");return`${B}.${F} ${X}:${ae}`}function c(A){if(!(A!=null&&A.resetsAt))return"";const R=A.resetsAt*1e3-Date.now();if(R<=0)return"Resetting now";const B=Math.round(R/6e4);if(B<60)return`Resets in ${B}m`;const F=Math.round(B/60);return F<24?`Resets in ${F}h`:`Resets in ${Math.round(F/24)}d`}function f(A){return[A.primary,A.secondary].filter(R=>R!==null)}function m(A){const R=f(A);return R.length===0?null:[...R].sort((B,F)=>{const X=B.windowDurationMins??Number.MAX_SAFE_INTEGER,ae=F.windowDurationMins??Number.MAX_SAFE_INTEGER;return X!==ae?X-ae:(B.resetsAt??Number.MAX_SAFE_INTEGER)-(F.resetsAt??Number.MAX_SAFE_INTEGER)})[0]}function S(A){const R=f(A);if(R.length===0)return"";const B=[...R].sort((X,ae)=>{const ve=X.windowDurationMins??-1,ke=ae.windowDurationMins??-1;return ve!==ke?ke-ve:(ae.resetsAt??-1)-(X.resetsAt??-1)})[0],F=u(B.resetsAt);return F||""}function D(A){const R=A.credits;return R?R.unlimited?"Unlimited credits":R.balance?`Credits ${R.balance}`:R.hasCredits?"Credits available":"":""}function H(A){return[c(m(A)),S(A),D(A)].filter(R=>R.length>0)}function ee(A){const R=[n(A)];for(const B of l(A))R.push(B.label);for(const B of f(A))R.push(`${s(B.windowDurationMins)} used ${i(B.usedPercent)}`);for(const B of H(A))R.push(B);return R.join(`
|
|
41
|
+
`)}return(A,R)=>e.snapshots.length>0?(v(),E("aside",dT,[(v(!0),E(Ve,null,_t(e.snapshots,B=>(v(),E("div",{key:t(B),class:"rate-limit-card",title:ee(B)},[h("div",hT,[h("span",pT,le(n(B)),1),B.planType?(v(),E("span",mT,le(r(B.planType)),1)):ce("",!0)]),h("div",gT,[(v(!0),E(Ve,null,_t(l(B),F=>(v(),E("span",{key:F.key,class:"rate-limit-card-metric"},le(F.label),1))),128))]),H(B).length>0?(v(),E("div",vT,le(H(B).join(" | ")),1)):ce("",!0)],8,fT))),128))])):ce("",!0)}}),wT=lt(yT,[["__scopeId","data-v-df88906b"]]),bT={class:"runtime-dropdown-trigger-label"},_T={key:0,class:"runtime-dropdown-menu-wrap"},kT={class:"runtime-dropdown-menu"},TT=["onClick"],ST={class:"runtime-dropdown-option-label"},IT={key:0,class:"runtime-dropdown-option-check"},ET=Wt({__name:"ComposerRuntimeDropdown",props:{modelValue:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,r=t,s=O(null),o=O(!1),i=[{value:"local",label:"Local project",icon:Ui},{value:"worktree",label:"New worktree",icon:ti}],a=ie(()=>i.find(c=>c.value===n.modelValue)??i[0]);function l(c){r("update:modelValue",c),o.value=!1}function u(c){if(!o.value)return;const f=s.value;if(!f)return;const m=c.target;m instanceof Node&&(f.contains(m)||(o.value=!1))}return ar(()=>{window.addEventListener("pointerdown",u)}),Ar(()=>{window.removeEventListener("pointerdown",u)}),(c,f)=>(v(),E("div",{ref_key:"rootRef",ref:s,class:"runtime-dropdown"},[h("button",{class:"runtime-dropdown-trigger",type:"button",onClick:f[0]||(f[0]=m=>o.value=!o.value)},[(v(),dt(di(a.value.icon),{class:"runtime-dropdown-trigger-icon"})),h("span",bT,le(a.value.label),1),Pe(ji,{class:"runtime-dropdown-trigger-chevron"})]),o.value?(v(),E("div",_T,[h("div",kT,[f[1]||(f[1]=h("div",{class:"runtime-dropdown-title"},"Continue in",-1)),(v(),E(Ve,null,_t(i,m=>h("button",{key:m.value,class:st(["runtime-dropdown-option",{"is-selected":e.modelValue===m.value}]),type:"button",onClick:S=>l(m.value)},[(v(),dt(di(m.icon),{class:"runtime-dropdown-option-icon"})),h("span",ST,le(m.label),1),e.modelValue===m.value?(v(),E("span",IT,"✓")):ce("",!0)],10,TT)),64))])])):ce("",!0)],512))}}),CT=lt(ET,[["__scopeId","data-v-9c9b71e5"]]),AT={},xT={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"};function RT(e,t){return v(),E("svg",xT,[...t[0]||(t[0]=[h("circle",{cx:"11",cy:"11",r:"8"},null,-1),h("path",{d:"m21 21-4.35-4.35"},null,-1)])])}const Za=lt(AT,[["render",RT]]),PT={class:"skill-card-top"},MT=["src","alt"],$T={key:1,class:"skill-card-avatar-fallback"},OT={class:"skill-card-info"},NT={class:"skill-card-header"},DT={class:"skill-card-name"},LT={key:0,class:"skill-card-badge-disabled"},jT={key:1,class:"skill-card-badge"},UT={class:"skill-card-owner"},FT={key:0,class:"skill-card-desc"},BT={key:1,class:"skill-card-date"},HT=Wt({__name:"SkillCard",props:{skill:{}},emits:["select"],setup(e){const t=e,n=ie(()=>{const i=t.skill.path;return i?i.endsWith("/SKILL.md")?i.slice(0,-9):i:""});function r(){const i=n.value;i&&window.open(`/codex-local-browse${encodeURI(i)}`,"_blank","noopener,noreferrer")}const s=ie(()=>{const i=t.skill.publishedAt;if(!i)return"";const a=new Date(i),u=Date.now()-i;return u<36e5?`${Math.floor(u/6e4)}m ago`:u<864e5?`${Math.floor(u/36e5)}h ago`:u<2592e6?`${Math.floor(u/864e5)}d ago`:a.toLocaleDateString("en-US",{month:"short",day:"numeric"})});function o(i){const a=i.target;a.style.display="none"}return(i,a)=>(v(),E("button",{class:st(["skill-card",{"is-disabled":e.skill.installed&&e.skill.enabled===!1}]),type:"button",onClick:a[0]||(a[0]=l=>i.$emit("select",e.skill))},[h("div",PT,[e.skill.avatarUrl?(v(),E("img",{key:0,class:"skill-card-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy",onError:o},null,40,MT)):(v(),E("div",$T,le(e.skill.owner.charAt(0)),1)),h("div",OT,[h("div",NT,[h("span",DT,le(e.skill.displayName||e.skill.name),1),e.skill.installed&&e.skill.enabled===!1?(v(),E("span",LT,"Disabled")):e.skill.installed?(v(),E("span",jT,"Installed")):ce("",!0)]),h("span",UT,le(e.skill.owner),1)]),e.skill.installed&&n.value?(v(),E("button",{key:2,class:"skill-card-browse",type:"button",title:"Browse files",onClick:rt(r,["stop"])},[Pe(Ui,{class:"skill-card-browse-icon"})])):ce("",!0)]),e.skill.description?(v(),E("p",FT,le(e.skill.description),1)):ce("",!0),s.value?(v(),E("span",BT,le(s.value),1)):ce("",!0)],2))}}),bu=lt(HT,[["__scopeId","data-v-49ed14e0"]]),WT={class:"sdm-panel"},VT={class:"sdm-header"},zT={class:"sdm-title-area"},GT=["src","alt"],qT={class:"sdm-title-col"},KT={class:"sdm-title-row"},JT={class:"sdm-title"},YT={key:0,class:"sdm-badge-disabled"},XT={class:"sdm-owner"},QT={class:"sdm-body"},ZT={key:0,class:"sdm-desc"},eS={key:1,class:"sdm-readme-loading"},tS=["innerHTML"],nS=["href"],rS={class:"sdm-footer"},sS={class:"sdm-footer-actions"},oS=["disabled"],iS=["disabled"],aS=["disabled"],lS=Wt({__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=O(null),o=O(""),i=O(""),a=O(!1),l=ie(()=>s.value??n.skill.enabled??!0),u=ie(()=>n.isInstalling===!0||n.isUninstalling===!0),c=ie(()=>o.value||n.skill.description),f=ie(()=>{const B=n.skill.path;return B?B.endsWith("/SKILL.md")?B.slice(0,-9):B:""}),m=ie(()=>{const B=i.value;if(!B)return"";const F=B.replace(/^---[\s\S]*?---\s*/,"");return S(F)});function S(B){return B.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").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 D(){if(!(!n.skill.owner||!n.skill.name)){a.value=!0,o.value="",i.value="";try{const B=new URLSearchParams({owner:n.skill.owner,name:n.skill.name});n.skill.installed&&B.set("installed","true"),n.skill.path&&B.set("path",n.skill.path);const F=await fetch(`/codex-api/skills-hub/readme?${B}`);if(!F.ok)return;const X=await F.json();i.value=X.content??"",o.value=X.description??""}catch{}finally{a.value=!1}}}at(()=>n.visible,B=>{B&&(s.value=null,o.value="",i.value="",D())});function H(){r("install",n.skill)}function ee(){r("uninstall",n.skill)}function A(){const B=!l.value;s.value=B,r("toggle-enabled",n.skill,B)}function R(){const B=f.value;B&&window.open(`/codex-local-browse${encodeURI(B)}`,"_blank","noopener,noreferrer")}return(B,F)=>(v(),dt(ci,{to:"body"},[e.visible?(v(),E("div",{key:0,class:"sdm-overlay",onClick:F[1]||(F[1]=rt(X=>B.$emit("close"),["self"]))},[h("div",WT,[h("div",VT,[h("div",zT,[e.skill.avatarUrl?(v(),E("img",{key:0,class:"sdm-avatar",src:e.skill.avatarUrl,alt:e.skill.owner,loading:"lazy"},null,8,GT)):ce("",!0),h("div",qT,[h("div",KT,[h("h3",JT,le(e.skill.displayName||e.skill.name),1),e.skill.installed&&!l.value?(v(),E("span",YT,"Disabled")):ce("",!0)]),h("span",XT,le(e.skill.owner),1)])]),h("button",{class:"sdm-close",type:"button","aria-label":"Close",onClick:F[0]||(F[0]=X=>B.$emit("close"))},[Pe(Ol,{class:"sdm-close-icon"})])]),h("div",QT,[c.value?(v(),E("p",ZT,le(c.value),1)):ce("",!0),a.value?(v(),E("div",eS,"Loading skill contents...")):i.value?(v(),E("div",{key:2,class:"sdm-readme",innerHTML:m.value},null,8,tS)):ce("",!0),h("a",{class:"sdm-link",href:e.skill.url,target:"_blank",rel:"noopener noreferrer"},"View on GitHub",8,nS)]),h("div",rS,[h("div",sS,[e.skill.installed?(v(),E("button",{key:0,class:"sdm-btn sdm-btn-danger",type:"button",disabled:u.value,onClick:ee},le(n.isUninstalling?"Uninstalling...":"Uninstall"),9,oS)):(v(),E("button",{key:1,class:"sdm-btn sdm-btn-primary",type:"button",disabled:u.value,onClick:H},le(n.isInstalling?"Installing...":"Install"),9,iS)),e.skill.installed?(v(),E("button",{key:2,class:"sdm-btn sdm-btn-secondary",type:"button",disabled:u.value,onClick:A},le(l.value?"Disable":"Enable"),9,aS)):ce("",!0),e.skill.installed&&f.value?(v(),E("button",{key:3,class:"sdm-btn sdm-btn-secondary",type:"button",onClick:R}," Browse files ")):ce("",!0)])])])])):ce("",!0)]))}}),cS=lt(lS,[["__scopeId","data-v-c758a719"]]),uS=()=>{};var _u={};/**
|
|
42
|
+
* @license
|
|
43
|
+
* Copyright 2017 Google LLC
|
|
44
|
+
*
|
|
45
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
46
|
+
* you may not use this file except in compliance with the License.
|
|
47
|
+
* You may obtain a copy of the License at
|
|
48
|
+
*
|
|
49
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
50
|
+
*
|
|
51
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
52
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
53
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
54
|
+
* See the License for the specific language governing permissions and
|
|
55
|
+
* limitations under the License.
|
|
56
|
+
*/const Wf=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},dS=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("")},Vf={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,u=l?e[s+2]:0,c=o>>2,f=(o&3)<<4|a>>4;let m=(a&15)<<2|u>>6,S=u&63;l||(S=64,i||(m=64)),r.push(n[c],n[f],n[m],n[S])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(Wf(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):dS(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 u=s<e.length?n[e.charAt(s)]:64;++s;const f=s<e.length?n[e.charAt(s)]:64;if(++s,o==null||a==null||u==null||f==null)throw new fS;const m=o<<2|a>>4;if(r.push(m),u!==64){const S=a<<4&240|u>>2;if(r.push(S),f!==64){const D=u<<6&192|f;r.push(D)}}}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 fS extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const hS=function(e){const t=Wf(e);return Vf.encodeByteArray(t,!0)},zf=function(e){return hS(e).replace(/\./g,"")},Gf=function(e){try{return Vf.decodeString(e,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};/**
|
|
57
|
+
* @license
|
|
58
|
+
* Copyright 2022 Google LLC
|
|
59
|
+
*
|
|
60
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
61
|
+
* you may not use this file except in compliance with the License.
|
|
62
|
+
* You may obtain a copy of the License at
|
|
63
|
+
*
|
|
64
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
65
|
+
*
|
|
66
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
67
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
68
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
69
|
+
* See the License for the specific language governing permissions and
|
|
70
|
+
* limitations under the License.
|
|
71
|
+
*/function pS(){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.")}/**
|
|
72
|
+
* @license
|
|
73
|
+
* Copyright 2022 Google LLC
|
|
74
|
+
*
|
|
75
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
76
|
+
* you may not use this file except in compliance with the License.
|
|
77
|
+
* You may obtain a copy of the License at
|
|
78
|
+
*
|
|
79
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
80
|
+
*
|
|
81
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
82
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
83
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
84
|
+
* See the License for the specific language governing permissions and
|
|
85
|
+
* limitations under the License.
|
|
86
|
+
*/const mS=()=>pS().__FIREBASE_DEFAULTS__,gS=()=>{if(typeof process>"u"||typeof _u>"u")return;const e=_u.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)},vS=()=>{if(typeof document>"u")return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const t=e&&Gf(e[1]);return t&&JSON.parse(t)},Dl=()=>{try{return uS()||mS()||gS()||vS()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},yS=e=>{var t,n;return(n=(t=Dl())==null?void 0:t.emulatorHosts)==null?void 0:n[e]},qf=()=>{var e;return(e=Dl())==null?void 0:e.config},Kf=e=>{var t;return(t=Dl())==null?void 0:t[`_${e}`]};/**
|
|
87
|
+
* @license
|
|
88
|
+
* Copyright 2017 Google LLC
|
|
89
|
+
*
|
|
90
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
91
|
+
* you may not use this file except in compliance with the License.
|
|
92
|
+
* You may obtain a copy of the License at
|
|
93
|
+
*
|
|
94
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
95
|
+
*
|
|
96
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
97
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
98
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
99
|
+
* See the License for the specific language governing permissions and
|
|
100
|
+
* limitations under the License.
|
|
101
|
+
*/class wS{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))}}}/**
|
|
102
|
+
* @license
|
|
103
|
+
* Copyright 2017 Google LLC
|
|
104
|
+
*
|
|
105
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
|
+
* you may not use this file except in compliance with the License.
|
|
107
|
+
* You may obtain a copy of the License at
|
|
108
|
+
*
|
|
109
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
110
|
+
*
|
|
111
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
112
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
113
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
114
|
+
* See the License for the specific language governing permissions and
|
|
115
|
+
* limitations under the License.
|
|
116
|
+
*/function wn(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function bS(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(wn())}function _S(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function kS(){const e=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof e=="object"&&e.id!==void 0}function TS(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function SS(){const e=wn();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function IS(){try{return typeof indexedDB=="object"}catch{return!1}}function ES(){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)}})}/**
|
|
117
|
+
* @license
|
|
118
|
+
* Copyright 2017 Google LLC
|
|
119
|
+
*
|
|
120
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
121
|
+
* you may not use this file except in compliance with the License.
|
|
122
|
+
* You may obtain a copy of the License at
|
|
123
|
+
*
|
|
124
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
125
|
+
*
|
|
126
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
127
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
128
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
129
|
+
* See the License for the specific language governing permissions and
|
|
130
|
+
* limitations under the License.
|
|
131
|
+
*/const CS="FirebaseError";class Wr extends Error{constructor(t,n,r){super(n),this.code=t,this.customData=r,this.name=CS,Object.setPrototypeOf(this,Wr.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Co.prototype.create)}}class Co{constructor(t,n,r){this.service=t,this.serviceName=n,this.errors=r}create(t,...n){const r=n[0]||{},s=`${this.service}/${t}`,o=this.errors[t],i=o?AS(o,r):"Error",a=`${this.serviceName}: ${i} (${s}).`;return new Wr(s,a,r)}}function AS(e,t){return e.replace(xS,(n,r)=>{const s=t[r];return s!=null?String(s):`<${r}?>`})}const xS=/\{\$([^}]+)}/g;function RS(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Ms(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(ku(o)&&ku(i)){if(!Ms(o,i))return!1}else if(o!==i)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function ku(e){return e!==null&&typeof e=="object"}/**
|
|
132
|
+
* @license
|
|
133
|
+
* Copyright 2017 Google LLC
|
|
134
|
+
*
|
|
135
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
136
|
+
* you may not use this file except in compliance with the License.
|
|
137
|
+
* You may obtain a copy of the License at
|
|
138
|
+
*
|
|
139
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
140
|
+
*
|
|
141
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
142
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
143
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
144
|
+
* See the License for the specific language governing permissions and
|
|
145
|
+
* limitations under the License.
|
|
146
|
+
*/function Ao(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(s=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function PS(e,t){const n=new MS(e,t);return n.subscribe.bind(n)}class MS{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.");$S(t,["next","error","complete"])?s=t:s={next:t,error:n,complete:r},s.next===void 0&&(s.next=_a),s.error===void 0&&(s.error=_a),s.complete===void 0&&(s.complete=_a);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 $S(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 _a(){}/**
|
|
147
|
+
* @license
|
|
148
|
+
* Copyright 2021 Google LLC
|
|
149
|
+
*
|
|
150
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
151
|
+
* you may not use this file except in compliance with the License.
|
|
152
|
+
* You may obtain a copy of the License at
|
|
153
|
+
*
|
|
154
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
155
|
+
*
|
|
156
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
157
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
158
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
159
|
+
* See the License for the specific language governing permissions and
|
|
160
|
+
* limitations under the License.
|
|
161
|
+
*/function Ds(e){return e&&e._delegate?e._delegate:e}/**
|
|
162
|
+
* @license
|
|
163
|
+
* Copyright 2025 Google LLC
|
|
164
|
+
*
|
|
165
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
166
|
+
* you may not use this file except in compliance with the License.
|
|
167
|
+
* You may obtain a copy of the License at
|
|
168
|
+
*
|
|
169
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
170
|
+
*
|
|
171
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
172
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
173
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
174
|
+
* See the License for the specific language governing permissions and
|
|
175
|
+
* limitations under the License.
|
|
176
|
+
*/function Ll(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function OS(e){return(await fetch(e,{credentials:"include"})).ok}class $s{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}}/**
|
|
177
|
+
* @license
|
|
178
|
+
* Copyright 2019 Google LLC
|
|
179
|
+
*
|
|
180
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
* you may not use this file except in compliance with the License.
|
|
182
|
+
* You may obtain a copy of the License at
|
|
183
|
+
*
|
|
184
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
*
|
|
186
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
* See the License for the specific language governing permissions and
|
|
190
|
+
* limitations under the License.
|
|
191
|
+
*/const ts="[DEFAULT]";/**
|
|
192
|
+
* @license
|
|
193
|
+
* Copyright 2019 Google LLC
|
|
194
|
+
*
|
|
195
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
+
* you may not use this file except in compliance with the License.
|
|
197
|
+
* You may obtain a copy of the License at
|
|
198
|
+
*
|
|
199
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
+
*
|
|
201
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
202
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
+
* See the License for the specific language governing permissions and
|
|
205
|
+
* limitations under the License.
|
|
206
|
+
*/class NS{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 wS;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(LS(t))try{this.getOrInitializeService({instanceIdentifier:ts})}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=ts){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=ts){return this.instances.has(t)}getOptions(t=ts){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:DS(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=ts){return this.component?this.component.multipleInstances?t:ts:t}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function DS(e){return e===ts?void 0:e}function LS(e){return e.instantiationMode==="EAGER"}/**
|
|
207
|
+
* @license
|
|
208
|
+
* Copyright 2019 Google LLC
|
|
209
|
+
*
|
|
210
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
211
|
+
* you may not use this file except in compliance with the License.
|
|
212
|
+
* You may obtain a copy of the License at
|
|
213
|
+
*
|
|
214
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
215
|
+
*
|
|
216
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
217
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
218
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
219
|
+
* See the License for the specific language governing permissions and
|
|
220
|
+
* limitations under the License.
|
|
221
|
+
*/class jS{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 NS(t,this);return this.providers.set(t,n),n}getProviders(){return Array.from(this.providers.values())}}/**
|
|
222
|
+
* @license
|
|
223
|
+
* Copyright 2017 Google LLC
|
|
224
|
+
*
|
|
225
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
226
|
+
* you may not use this file except in compliance with the License.
|
|
227
|
+
* You may obtain a copy of the License at
|
|
228
|
+
*
|
|
229
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
230
|
+
*
|
|
231
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
232
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
233
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
234
|
+
* See the License for the specific language governing permissions and
|
|
235
|
+
* limitations under the License.
|
|
236
|
+
*/var Tt;(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"})(Tt||(Tt={}));const US={debug:Tt.DEBUG,verbose:Tt.VERBOSE,info:Tt.INFO,warn:Tt.WARN,error:Tt.ERROR,silent:Tt.SILENT},FS=Tt.INFO,BS={[Tt.DEBUG]:"log",[Tt.VERBOSE]:"log",[Tt.INFO]:"info",[Tt.WARN]:"warn",[Tt.ERROR]:"error"},HS=(e,t,...n)=>{if(t<e.logLevel)return;const r=new Date().toISOString(),s=BS[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 Jf{constructor(t){this.name=t,this._logLevel=FS,this._logHandler=HS,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in Tt))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel=typeof t=="string"?US[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,Tt.DEBUG,...t),this._logHandler(this,Tt.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,Tt.VERBOSE,...t),this._logHandler(this,Tt.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,Tt.INFO,...t),this._logHandler(this,Tt.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,Tt.WARN,...t),this._logHandler(this,Tt.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,Tt.ERROR,...t),this._logHandler(this,Tt.ERROR,...t)}}const WS=(e,t)=>t.some(n=>e instanceof n);let Tu,Su;function VS(){return Tu||(Tu=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function zS(){return Su||(Su=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Yf=new WeakMap,el=new WeakMap,Xf=new WeakMap,ka=new WeakMap,jl=new WeakMap;function GS(e){const t=new Promise((n,r)=>{const s=()=>{e.removeEventListener("success",o),e.removeEventListener("error",i)},o=()=>{n(jr(e.result)),s()},i=()=>{r(e.error),s()};e.addEventListener("success",o),e.addEventListener("error",i)});return t.then(n=>{n instanceof IDBCursor&&Yf.set(n,e)}).catch(()=>{}),jl.set(t,e),t}function qS(e){if(el.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)});el.set(e,t)}let tl={get(e,t,n){if(e instanceof IDBTransaction){if(t==="done")return el.get(e);if(t==="objectStoreNames")return e.objectStoreNames||Xf.get(e);if(t==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return jr(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 KS(e){tl=e(tl)}function JS(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(t,...n){const r=e.call(Ta(this),t,...n);return Xf.set(r,t.sort?t.sort():[t]),jr(r)}:zS().includes(e)?function(...t){return e.apply(Ta(this),t),jr(Yf.get(this))}:function(...t){return jr(e.apply(Ta(this),t))}}function YS(e){return typeof e=="function"?JS(e):(e instanceof IDBTransaction&&qS(e),WS(e,VS())?new Proxy(e,tl):e)}function jr(e){if(e instanceof IDBRequest)return GS(e);if(ka.has(e))return ka.get(e);const t=YS(e);return t!==e&&(ka.set(e,t),jl.set(t,e)),t}const Ta=e=>jl.get(e);function XS(e,t,{blocked:n,upgrade:r,blocking:s,terminated:o}={}){const i=indexedDB.open(e,t),a=jr(i);return r&&i.addEventListener("upgradeneeded",l=>{r(jr(i.result),l.oldVersion,l.newVersion,jr(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",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const QS=["get","getKey","getAll","getAllKeys","count"],ZS=["put","add","delete","clear"],Sa=new Map;function Iu(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&typeof t=="string"))return;if(Sa.get(t))return Sa.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=ZS.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||QS.includes(n)))return;const o=async function(i,...a){const l=this.transaction(i,s?"readwrite":"readonly");let u=l.store;return r&&(u=u.index(a.shift())),(await Promise.all([u[n](...a),s&&l.done]))[0]};return Sa.set(t,o),o}KS(e=>({...e,get:(t,n,r)=>Iu(t,n)||e.get(t,n,r),has:(t,n)=>!!Iu(t,n)||e.has(t,n)}));/**
|
|
237
|
+
* @license
|
|
238
|
+
* Copyright 2019 Google LLC
|
|
239
|
+
*
|
|
240
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
241
|
+
* you may not use this file except in compliance with the License.
|
|
242
|
+
* You may obtain a copy of the License at
|
|
243
|
+
*
|
|
244
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
245
|
+
*
|
|
246
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
247
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
248
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
249
|
+
* See the License for the specific language governing permissions and
|
|
250
|
+
* limitations under the License.
|
|
251
|
+
*/class eI{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(tI(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function tI(e){const t=e.getComponent();return(t==null?void 0:t.type)==="VERSION"}const nl="@firebase/app",Eu="0.14.10";/**
|
|
252
|
+
* @license
|
|
253
|
+
* Copyright 2019 Google LLC
|
|
254
|
+
*
|
|
255
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
256
|
+
* you may not use this file except in compliance with the License.
|
|
257
|
+
* You may obtain a copy of the License at
|
|
258
|
+
*
|
|
259
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
260
|
+
*
|
|
261
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
262
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
263
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
264
|
+
* See the License for the specific language governing permissions and
|
|
265
|
+
* limitations under the License.
|
|
266
|
+
*/const Ir=new Jf("@firebase/app"),nI="@firebase/app-compat",rI="@firebase/analytics-compat",sI="@firebase/analytics",oI="@firebase/app-check-compat",iI="@firebase/app-check",aI="@firebase/auth",lI="@firebase/auth-compat",cI="@firebase/database",uI="@firebase/data-connect",dI="@firebase/database-compat",fI="@firebase/functions",hI="@firebase/functions-compat",pI="@firebase/installations",mI="@firebase/installations-compat",gI="@firebase/messaging",vI="@firebase/messaging-compat",yI="@firebase/performance",wI="@firebase/performance-compat",bI="@firebase/remote-config",_I="@firebase/remote-config-compat",kI="@firebase/storage",TI="@firebase/storage-compat",SI="@firebase/firestore",II="@firebase/ai",EI="@firebase/firestore-compat",CI="firebase",AI="12.11.0";/**
|
|
267
|
+
* @license
|
|
268
|
+
* Copyright 2019 Google LLC
|
|
269
|
+
*
|
|
270
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
271
|
+
* you may not use this file except in compliance with the License.
|
|
272
|
+
* You may obtain a copy of the License at
|
|
273
|
+
*
|
|
274
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
275
|
+
*
|
|
276
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
277
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
278
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
279
|
+
* See the License for the specific language governing permissions and
|
|
280
|
+
* limitations under the License.
|
|
281
|
+
*/const rl="[DEFAULT]",xI={[nl]:"fire-core",[nI]:"fire-core-compat",[sI]:"fire-analytics",[rI]:"fire-analytics-compat",[iI]:"fire-app-check",[oI]:"fire-app-check-compat",[aI]:"fire-auth",[lI]:"fire-auth-compat",[cI]:"fire-rtdb",[uI]:"fire-data-connect",[dI]:"fire-rtdb-compat",[fI]:"fire-fn",[hI]:"fire-fn-compat",[pI]:"fire-iid",[mI]:"fire-iid-compat",[gI]:"fire-fcm",[vI]:"fire-fcm-compat",[yI]:"fire-perf",[wI]:"fire-perf-compat",[bI]:"fire-rc",[_I]:"fire-rc-compat",[kI]:"fire-gcs",[TI]:"fire-gcs-compat",[SI]:"fire-fst",[EI]:"fire-fst-compat",[II]:"fire-vertex","fire-js":"fire-js",[CI]:"fire-js-all"};/**
|
|
282
|
+
* @license
|
|
283
|
+
* Copyright 2019 Google LLC
|
|
284
|
+
*
|
|
285
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
286
|
+
* you may not use this file except in compliance with the License.
|
|
287
|
+
* You may obtain a copy of the License at
|
|
288
|
+
*
|
|
289
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
290
|
+
*
|
|
291
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
292
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
293
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
294
|
+
* See the License for the specific language governing permissions and
|
|
295
|
+
* limitations under the License.
|
|
296
|
+
*/const yo=new Map,RI=new Map,sl=new Map;function Cu(e,t){try{e.container.addComponent(t)}catch(n){Ir.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function wo(e){const t=e.name;if(sl.has(t))return Ir.debug(`There were multiple attempts to register component ${t}.`),!1;sl.set(t,e);for(const n of yo.values())Cu(n,e);for(const n of RI.values())Cu(n,e);return!0}function Qf(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function tr(e){return e==null?!1:e.settings!==void 0}/**
|
|
297
|
+
* @license
|
|
298
|
+
* Copyright 2019 Google LLC
|
|
299
|
+
*
|
|
300
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
301
|
+
* you may not use this file except in compliance with the License.
|
|
302
|
+
* You may obtain a copy of the License at
|
|
303
|
+
*
|
|
304
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
305
|
+
*
|
|
306
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
307
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
308
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
309
|
+
* See the License for the specific language governing permissions and
|
|
310
|
+
* limitations under the License.
|
|
311
|
+
*/const PI={"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."},Ur=new Co("app","Firebase",PI);/**
|
|
312
|
+
* @license
|
|
313
|
+
* Copyright 2019 Google LLC
|
|
314
|
+
*
|
|
315
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
316
|
+
* you may not use this file except in compliance with the License.
|
|
317
|
+
* You may obtain a copy of the License at
|
|
318
|
+
*
|
|
319
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
320
|
+
*
|
|
321
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
322
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
323
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
324
|
+
* See the License for the specific language governing permissions and
|
|
325
|
+
* limitations under the License.
|
|
326
|
+
*/class MI{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 $s("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 Ur.create("app-deleted",{appName:this._name})}}/**
|
|
327
|
+
* @license
|
|
328
|
+
* Copyright 2019 Google LLC
|
|
329
|
+
*
|
|
330
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
331
|
+
* you may not use this file except in compliance with the License.
|
|
332
|
+
* You may obtain a copy of the License at
|
|
333
|
+
*
|
|
334
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
335
|
+
*
|
|
336
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
337
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
338
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
339
|
+
* See the License for the specific language governing permissions and
|
|
340
|
+
* limitations under the License.
|
|
341
|
+
*/const xo=AI;function Zf(e,t={}){let n=e;typeof t!="object"&&(t={name:t});const r={name:rl,automaticDataCollectionEnabled:!0,...t},s=r.name;if(typeof s!="string"||!s)throw Ur.create("bad-app-name",{appName:String(s)});if(n||(n=qf()),!n)throw Ur.create("no-options");const o=yo.get(s);if(o){if(Ms(n,o.options)&&Ms(r,o.config))return o;throw Ur.create("duplicate-app",{appName:s})}const i=new jS(s);for(const l of sl.values())i.addComponent(l);const a=new MI(n,r,i);return yo.set(s,a),a}function eh(e=rl){const t=yo.get(e);if(!t&&e===rl&&qf())return Zf();if(!t)throw Ur.create("no-app",{appName:e});return t}function $I(){return Array.from(yo.values())}function Is(e,t,n){let r=xI[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 "/")`),Ir.warn(i.join(" "));return}wo(new $s(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}/**
|
|
342
|
+
* @license
|
|
343
|
+
* Copyright 2021 Google LLC
|
|
344
|
+
*
|
|
345
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
346
|
+
* you may not use this file except in compliance with the License.
|
|
347
|
+
* You may obtain a copy of the License at
|
|
348
|
+
*
|
|
349
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
350
|
+
*
|
|
351
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
352
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
353
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
354
|
+
* See the License for the specific language governing permissions and
|
|
355
|
+
* limitations under the License.
|
|
356
|
+
*/const OI="firebase-heartbeat-database",NI=1,bo="firebase-heartbeat-store";let Ia=null;function th(){return Ia||(Ia=XS(OI,NI,{upgrade:(e,t)=>{switch(t){case 0:try{e.createObjectStore(bo)}catch(n){console.warn(n)}}}}).catch(e=>{throw Ur.create("idb-open",{originalErrorMessage:e.message})})),Ia}async function DI(e){try{const n=(await th()).transaction(bo),r=await n.objectStore(bo).get(nh(e));return await n.done,r}catch(t){if(t instanceof Wr)Ir.warn(t.message);else{const n=Ur.create("idb-get",{originalErrorMessage:t==null?void 0:t.message});Ir.warn(n.message)}}}async function Au(e,t){try{const r=(await th()).transaction(bo,"readwrite");await r.objectStore(bo).put(t,nh(e)),await r.done}catch(n){if(n instanceof Wr)Ir.warn(n.message);else{const r=Ur.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Ir.warn(r.message)}}}function nh(e){return`${e.name}!${e.options.appId}`}/**
|
|
357
|
+
* @license
|
|
358
|
+
* Copyright 2021 Google LLC
|
|
359
|
+
*
|
|
360
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
361
|
+
* you may not use this file except in compliance with the License.
|
|
362
|
+
* You may obtain a copy of the License at
|
|
363
|
+
*
|
|
364
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
365
|
+
*
|
|
366
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
367
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
368
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
369
|
+
* See the License for the specific language governing permissions and
|
|
370
|
+
* limitations under the License.
|
|
371
|
+
*/const LI=1024,jI=30;class UI{constructor(t){this.container=t,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new BI(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=xu();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>jI){const i=HI(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){Ir.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=xu(),{heartbeatsToSend:r,unsentEntries:s}=FI(this._heartbeatsCache.heartbeats),o=zf(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 Ir.warn(n),""}}}function xu(){return new Date().toISOString().substring(0,10)}function FI(e,t=LI){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),Ru(n)>t){o.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Ru(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class BI{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return IS()?ES().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await DI(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 Au(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 Au(this.app,{lastSentHeartbeatDate:t.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...t.heartbeats]})}else return}}function Ru(e){return zf(JSON.stringify({version:2,heartbeats:e})).length}function HI(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}/**
|
|
372
|
+
* @license
|
|
373
|
+
* Copyright 2019 Google LLC
|
|
374
|
+
*
|
|
375
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
376
|
+
* you may not use this file except in compliance with the License.
|
|
377
|
+
* You may obtain a copy of the License at
|
|
378
|
+
*
|
|
379
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
380
|
+
*
|
|
381
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
382
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
383
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
384
|
+
* See the License for the specific language governing permissions and
|
|
385
|
+
* limitations under the License.
|
|
386
|
+
*/function WI(e){wo(new $s("platform-logger",t=>new eI(t),"PRIVATE")),wo(new $s("heartbeat",t=>new UI(t),"PRIVATE")),Is(nl,Eu,e),Is(nl,Eu,"esm2020"),Is("fire-js","")}WI("");var VI="firebase",zI="12.11.0";/**
|
|
387
|
+
* @license
|
|
388
|
+
* Copyright 2020 Google LLC
|
|
389
|
+
*
|
|
390
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
391
|
+
* you may not use this file except in compliance with the License.
|
|
392
|
+
* You may obtain a copy of the License at
|
|
393
|
+
*
|
|
394
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
395
|
+
*
|
|
396
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
397
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
398
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
399
|
+
* See the License for the specific language governing permissions and
|
|
400
|
+
* limitations under the License.
|
|
401
|
+
*/Is(VI,zI,"app");function rh(){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 GI=rh,sh=new Co("auth","Firebase",rh());/**
|
|
402
|
+
* @license
|
|
403
|
+
* Copyright 2020 Google LLC
|
|
404
|
+
*
|
|
405
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
406
|
+
* you may not use this file except in compliance with the License.
|
|
407
|
+
* You may obtain a copy of the License at
|
|
408
|
+
*
|
|
409
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
410
|
+
*
|
|
411
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
412
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
413
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
414
|
+
* See the License for the specific language governing permissions and
|
|
415
|
+
* limitations under the License.
|
|
416
|
+
*/const gi=new Jf("@firebase/auth");function qI(e,...t){gi.logLevel<=Tt.WARN&&gi.warn(`Auth (${xo}): ${e}`,...t)}function ni(e,...t){gi.logLevel<=Tt.ERROR&&gi.error(`Auth (${xo}): ${e}`,...t)}/**
|
|
417
|
+
* @license
|
|
418
|
+
* Copyright 2020 Google LLC
|
|
419
|
+
*
|
|
420
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
421
|
+
* you may not use this file except in compliance with the License.
|
|
422
|
+
* You may obtain a copy of the License at
|
|
423
|
+
*
|
|
424
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
425
|
+
*
|
|
426
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
427
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
428
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
429
|
+
* See the License for the specific language governing permissions and
|
|
430
|
+
* limitations under the License.
|
|
431
|
+
*/function ir(e,...t){throw Fl(e,...t)}function Wn(e,...t){return Fl(e,...t)}function Ul(e,t,n){const r={...GI(),[t]:n};return new Co("auth","Firebase",r).create(t,{appName:e.name})}function ls(e){return Ul(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function KI(e,t,n){const r=n;if(!(t instanceof r))throw r.name!==t.constructor.name&&ir(e,"argument-error"),Ul(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Fl(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 sh.create(e,...t)}function qe(e,t,...n){if(!e)throw Fl(t,...n)}function vr(e){const t="INTERNAL ASSERTION FAILED: "+e;throw ni(t),new Error(t)}function Er(e,t){e||vr(t)}/**
|
|
432
|
+
* @license
|
|
433
|
+
* Copyright 2020 Google LLC
|
|
434
|
+
*
|
|
435
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
436
|
+
* you may not use this file except in compliance with the License.
|
|
437
|
+
* You may obtain a copy of the License at
|
|
438
|
+
*
|
|
439
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
440
|
+
*
|
|
441
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
442
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
443
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
444
|
+
* See the License for the specific language governing permissions and
|
|
445
|
+
* limitations under the License.
|
|
446
|
+
*/function ol(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.href)||""}function JI(){return Pu()==="http:"||Pu()==="https:"}function Pu(){var e;return typeof self<"u"&&((e=self.location)==null?void 0:e.protocol)||null}/**
|
|
447
|
+
* @license
|
|
448
|
+
* Copyright 2020 Google LLC
|
|
449
|
+
*
|
|
450
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
451
|
+
* you may not use this file except in compliance with the License.
|
|
452
|
+
* You may obtain a copy of the License at
|
|
453
|
+
*
|
|
454
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
455
|
+
*
|
|
456
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
457
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
458
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
459
|
+
* See the License for the specific language governing permissions and
|
|
460
|
+
* limitations under the License.
|
|
461
|
+
*/function YI(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(JI()||kS()||"connection"in navigator)?navigator.onLine:!0}function XI(){if(typeof navigator>"u")return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}/**
|
|
462
|
+
* @license
|
|
463
|
+
* Copyright 2020 Google LLC
|
|
464
|
+
*
|
|
465
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
466
|
+
* you may not use this file except in compliance with the License.
|
|
467
|
+
* You may obtain a copy of the License at
|
|
468
|
+
*
|
|
469
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
470
|
+
*
|
|
471
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
472
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
473
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
474
|
+
* See the License for the specific language governing permissions and
|
|
475
|
+
* limitations under the License.
|
|
476
|
+
*/class Ro{constructor(t,n){this.shortDelay=t,this.longDelay=n,Er(n>t,"Short delay should be less than long delay!"),this.isMobile=bS()||TS()}get(){return YI()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
|
477
|
+
* @license
|
|
478
|
+
* Copyright 2020 Google LLC
|
|
479
|
+
*
|
|
480
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
481
|
+
* you may not use this file except in compliance with the License.
|
|
482
|
+
* You may obtain a copy of the License at
|
|
483
|
+
*
|
|
484
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
485
|
+
*
|
|
486
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
487
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
488
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
489
|
+
* See the License for the specific language governing permissions and
|
|
490
|
+
* limitations under the License.
|
|
491
|
+
*/function Bl(e,t){Er(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}/**
|
|
492
|
+
* @license
|
|
493
|
+
* Copyright 2020 Google LLC
|
|
494
|
+
*
|
|
495
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
496
|
+
* you may not use this file except in compliance with the License.
|
|
497
|
+
* You may obtain a copy of the License at
|
|
498
|
+
*
|
|
499
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
500
|
+
*
|
|
501
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
502
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
503
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
504
|
+
* See the License for the specific language governing permissions and
|
|
505
|
+
* limitations under the License.
|
|
506
|
+
*/class oh{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;vr("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;vr("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;vr("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
|
507
|
+
* @license
|
|
508
|
+
* Copyright 2020 Google LLC
|
|
509
|
+
*
|
|
510
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
511
|
+
* you may not use this file except in compliance with the License.
|
|
512
|
+
* You may obtain a copy of the License at
|
|
513
|
+
*
|
|
514
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
515
|
+
*
|
|
516
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
517
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
518
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
519
|
+
* See the License for the specific language governing permissions and
|
|
520
|
+
* limitations under the License.
|
|
521
|
+
*/const QI={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"};/**
|
|
522
|
+
* @license
|
|
523
|
+
* Copyright 2020 Google LLC
|
|
524
|
+
*
|
|
525
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
526
|
+
* you may not use this file except in compliance with the License.
|
|
527
|
+
* You may obtain a copy of the License at
|
|
528
|
+
*
|
|
529
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
530
|
+
*
|
|
531
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
532
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
533
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
534
|
+
* See the License for the specific language governing permissions and
|
|
535
|
+
* limitations under the License.
|
|
536
|
+
*/const ZI=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],eE=new Ro(3e4,6e4);function Hl(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function Ls(e,t,n,r,s={}){return ih(e,s,async()=>{let o={},i={};r&&(t==="GET"?i=r:o={body:JSON.stringify(r)});const a=Ao({key:e.config.apiKey,...i}).slice(1),l=await e._getAdditionalHeaders();l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode);const u={method:t,headers:l,...o};return _S()||(u.referrerPolicy="no-referrer"),e.emulatorConfig&&Ll(e.emulatorConfig.host)&&(u.credentials="include"),oh.fetch()(await ah(e,e.config.apiHost,n,a),u)})}async function ih(e,t,n){e._canInitEmulator=!1;const r={...QI,...t};try{const s=new nE(e),o=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const i=await o.json();if("needConfirmation"in i)throw zo(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,u]=a.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw zo(e,"credential-already-in-use",i);if(l==="EMAIL_EXISTS")throw zo(e,"email-already-in-use",i);if(l==="USER_DISABLED")throw zo(e,"user-disabled",i);const c=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw Ul(e,c,u);ir(e,c)}}catch(s){if(s instanceof Wr)throw s;ir(e,"network-request-failed",{message:String(s)})}}async function tE(e,t,n,r,s={}){const o=await Ls(e,t,n,r,s);return"mfaPendingCredential"in o&&ir(e,"multi-factor-auth-required",{_serverResponse:o}),o}async function ah(e,t,n,r){const s=`${t}${n}?${r}`,o=e,i=o.config.emulator?Bl(e.config,s):`${e.config.apiScheme}://${s}`;return ZI.includes(n)&&(await o._persistenceManagerAvailable,o._getPersistenceType()==="COOKIE")?o._getPersistence()._getFinalTarget(i).toString():i}class nE{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(t){this.auth=t,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Wn(this.auth,"network-request-failed")),eE.get())})}}function zo(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Wn(e,t,r);return s.customData._tokenResponse=n,s}/**
|
|
537
|
+
* @license
|
|
538
|
+
* Copyright 2020 Google LLC
|
|
539
|
+
*
|
|
540
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
541
|
+
* you may not use this file except in compliance with the License.
|
|
542
|
+
* You may obtain a copy of the License at
|
|
543
|
+
*
|
|
544
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
545
|
+
*
|
|
546
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
547
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
548
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
549
|
+
* See the License for the specific language governing permissions and
|
|
550
|
+
* limitations under the License.
|
|
551
|
+
*/async function rE(e,t){return Ls(e,"POST","/v1/accounts:delete",t)}async function vi(e,t){return Ls(e,"POST","/v1/accounts:lookup",t)}/**
|
|
552
|
+
* @license
|
|
553
|
+
* Copyright 2020 Google LLC
|
|
554
|
+
*
|
|
555
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
556
|
+
* you may not use this file except in compliance with the License.
|
|
557
|
+
* You may obtain a copy of the License at
|
|
558
|
+
*
|
|
559
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
560
|
+
*
|
|
561
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
562
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
563
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
564
|
+
* See the License for the specific language governing permissions and
|
|
565
|
+
* limitations under the License.
|
|
566
|
+
*/function io(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch{}}async function sE(e,t=!1){const n=Ds(e),r=await n.getIdToken(t),s=Wl(r);qe(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const o=typeof s.firebase=="object"?s.firebase:void 0,i=o==null?void 0:o.sign_in_provider;return{claims:s,token:r,authTime:io(Ea(s.auth_time)),issuedAtTime:io(Ea(s.iat)),expirationTime:io(Ea(s.exp)),signInProvider:i||null,signInSecondFactor:(o==null?void 0:o.sign_in_second_factor)||null}}function Ea(e){return Number(e)*1e3}function Wl(e){const[t,n,r]=e.split(".");if(t===void 0||n===void 0||r===void 0)return ni("JWT malformed, contained fewer than 3 sections"),null;try{const s=Gf(n);return s?JSON.parse(s):(ni("Failed to decode base64 JWT payload"),null)}catch(s){return ni("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function Mu(e){const t=Wl(e);return qe(t,"internal-error"),qe(typeof t.exp<"u","internal-error"),qe(typeof t.iat<"u","internal-error"),Number(t.exp)-Number(t.iat)}/**
|
|
567
|
+
* @license
|
|
568
|
+
* Copyright 2020 Google LLC
|
|
569
|
+
*
|
|
570
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
571
|
+
* you may not use this file except in compliance with the License.
|
|
572
|
+
* You may obtain a copy of the License at
|
|
573
|
+
*
|
|
574
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
575
|
+
*
|
|
576
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
577
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
578
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
579
|
+
* See the License for the specific language governing permissions and
|
|
580
|
+
* limitations under the License.
|
|
581
|
+
*/async function _o(e,t,n=!1){if(n)return t;try{return await t}catch(r){throw r instanceof Wr&&oE(r)&&e.auth.currentUser===e&&await e.auth.signOut(),r}}function oE({code:e}){return e==="auth/user-disabled"||e==="auth/user-token-expired"}/**
|
|
582
|
+
* @license
|
|
583
|
+
* Copyright 2020 Google LLC
|
|
584
|
+
*
|
|
585
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
586
|
+
* you may not use this file except in compliance with the License.
|
|
587
|
+
* You may obtain a copy of the License at
|
|
588
|
+
*
|
|
589
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
590
|
+
*
|
|
591
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
592
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
593
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
594
|
+
* See the License for the specific language governing permissions and
|
|
595
|
+
* limitations under the License.
|
|
596
|
+
*/class iE{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()}}/**
|
|
597
|
+
* @license
|
|
598
|
+
* Copyright 2020 Google LLC
|
|
599
|
+
*
|
|
600
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
601
|
+
* you may not use this file except in compliance with the License.
|
|
602
|
+
* You may obtain a copy of the License at
|
|
603
|
+
*
|
|
604
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
605
|
+
*
|
|
606
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
607
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
608
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
609
|
+
* See the License for the specific language governing permissions and
|
|
610
|
+
* limitations under the License.
|
|
611
|
+
*/class il{constructor(t,n){this.createdAt=t,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=io(this.lastLoginAt),this.creationTime=io(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
|
612
|
+
* @license
|
|
613
|
+
* Copyright 2019 Google LLC
|
|
614
|
+
*
|
|
615
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
616
|
+
* you may not use this file except in compliance with the License.
|
|
617
|
+
* You may obtain a copy of the License at
|
|
618
|
+
*
|
|
619
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
620
|
+
*
|
|
621
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
622
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
623
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
624
|
+
* See the License for the specific language governing permissions and
|
|
625
|
+
* limitations under the License.
|
|
626
|
+
*/async function yi(e){var f;const t=e.auth,n=await e.getIdToken(),r=await _o(e,vi(t,{idToken:n}));qe(r==null?void 0:r.users.length,t,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(f=s.providerUserInfo)!=null&&f.length?lh(s.providerUserInfo):[],i=lE(e.providerData,o),a=e.isAnonymous,l=!(e.email&&s.passwordHash)&&!(i!=null&&i.length),u=a?l:!1,c={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new il(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(e,c)}async function aE(e){const t=Ds(e);await yi(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function lE(e,t){return[...e.filter(r=>!t.some(s=>s.providerId===r.providerId)),...t]}function lh(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}))}/**
|
|
627
|
+
* @license
|
|
628
|
+
* Copyright 2020 Google LLC
|
|
629
|
+
*
|
|
630
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
631
|
+
* you may not use this file except in compliance with the License.
|
|
632
|
+
* You may obtain a copy of the License at
|
|
633
|
+
*
|
|
634
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
635
|
+
*
|
|
636
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
637
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
638
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
639
|
+
* See the License for the specific language governing permissions and
|
|
640
|
+
* limitations under the License.
|
|
641
|
+
*/async function cE(e,t){const n=await ih(e,{},async()=>{const r=Ao({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:s,apiKey:o}=e.config,i=await ah(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&&Ll(e.emulatorConfig.host)&&(l.credentials="include"),oh.fetch()(i,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function uE(e,t){return Ls(e,"POST","/v2/accounts:revokeToken",Hl(e,t))}/**
|
|
642
|
+
* @license
|
|
643
|
+
* Copyright 2020 Google LLC
|
|
644
|
+
*
|
|
645
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
646
|
+
* you may not use this file except in compliance with the License.
|
|
647
|
+
* You may obtain a copy of the License at
|
|
648
|
+
*
|
|
649
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
650
|
+
*
|
|
651
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
652
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
653
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
654
|
+
* See the License for the specific language governing permissions and
|
|
655
|
+
* limitations under the License.
|
|
656
|
+
*/class Es{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){qe(t.idToken,"internal-error"),qe(typeof t.idToken<"u","internal-error"),qe(typeof t.refreshToken<"u","internal-error");const n="expiresIn"in t&&typeof t.expiresIn<"u"?Number(t.expiresIn):Mu(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,n)}updateFromIdToken(t){qe(t.length!==0,"internal-error");const n=Mu(t);this.updateTokensAndExpiration(t,null,n)}async getToken(t,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(qe(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 cE(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 Es;return r&&(qe(typeof r=="string","internal-error",{appName:t}),i.refreshToken=r),s&&(qe(typeof s=="string","internal-error",{appName:t}),i.accessToken=s),o&&(qe(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 Es,this.toJSON())}_performRefresh(){return vr("not implemented")}}/**
|
|
657
|
+
* @license
|
|
658
|
+
* Copyright 2020 Google LLC
|
|
659
|
+
*
|
|
660
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
661
|
+
* you may not use this file except in compliance with the License.
|
|
662
|
+
* You may obtain a copy of the License at
|
|
663
|
+
*
|
|
664
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
665
|
+
*
|
|
666
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
667
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
668
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
669
|
+
* See the License for the specific language governing permissions and
|
|
670
|
+
* limitations under the License.
|
|
671
|
+
*/function Pr(e,t){qe(typeof e=="string"||typeof e>"u","internal-error",{appName:t})}class Fn{constructor({uid:t,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new iE(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 il(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const n=await _o(this,this.stsTokenManager.getToken(this.auth,t));return qe(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(t){return sE(this,t)}reload(){return aE(this)}_assign(t){this!==t&&(qe(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 Fn({...this,auth:t,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(t){qe(!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 yi(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(tr(this.auth.app))return Promise.reject(ls(this.auth));const t=await this.getIdToken();return await _o(this,rE(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,u=n.createdAt??void 0,c=n.lastLoginAt??void 0,{uid:f,emailVerified:m,isAnonymous:S,providerData:D,stsTokenManager:H}=n;qe(f&&H,t,"internal-error");const ee=Es.fromJSON(this.name,H);qe(typeof f=="string",t,"internal-error"),Pr(r,t.name),Pr(s,t.name),qe(typeof m=="boolean",t,"internal-error"),qe(typeof S=="boolean",t,"internal-error"),Pr(o,t.name),Pr(i,t.name),Pr(a,t.name),Pr(l,t.name),Pr(u,t.name),Pr(c,t.name);const A=new Fn({uid:f,auth:t,email:s,emailVerified:m,displayName:r,isAnonymous:S,photoURL:i,phoneNumber:o,tenantId:a,stsTokenManager:ee,createdAt:u,lastLoginAt:c});return D&&Array.isArray(D)&&(A.providerData=D.map(R=>({...R}))),l&&(A._redirectEventId=l),A}static async _fromIdTokenResponse(t,n,r=!1){const s=new Es;s.updateFromServerResponse(n);const o=new Fn({uid:n.localId,auth:t,stsTokenManager:s,isAnonymous:r});return await yi(o),o}static async _fromGetAccountInfoResponse(t,n,r){const s=n.users[0];qe(s.localId!==void 0,"internal-error");const o=s.providerUserInfo!==void 0?lh(s.providerUserInfo):[],i=!(s.email&&s.passwordHash)&&!(o!=null&&o.length),a=new Es;a.updateFromIdToken(r);const l=new Fn({uid:s.localId,auth:t,stsTokenManager:a,isAnonymous:i}),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:o,metadata:new il(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(o!=null&&o.length)};return Object.assign(l,u),l}}/**
|
|
672
|
+
* @license
|
|
673
|
+
* Copyright 2020 Google LLC
|
|
674
|
+
*
|
|
675
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
676
|
+
* you may not use this file except in compliance with the License.
|
|
677
|
+
* You may obtain a copy of the License at
|
|
678
|
+
*
|
|
679
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
680
|
+
*
|
|
681
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
682
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
683
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
684
|
+
* See the License for the specific language governing permissions and
|
|
685
|
+
* limitations under the License.
|
|
686
|
+
*/const $u=new Map;function yr(e){Er(e instanceof Function,"Expected a class definition");let t=$u.get(e);return t?(Er(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,$u.set(e,t),t)}/**
|
|
687
|
+
* @license
|
|
688
|
+
* Copyright 2019 Google LLC
|
|
689
|
+
*
|
|
690
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
691
|
+
* you may not use this file except in compliance with the License.
|
|
692
|
+
* You may obtain a copy of the License at
|
|
693
|
+
*
|
|
694
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
695
|
+
*
|
|
696
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
697
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
698
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
699
|
+
* See the License for the specific language governing permissions and
|
|
700
|
+
* limitations under the License.
|
|
701
|
+
*/class ch{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){}}ch.type="NONE";const Ou=ch;/**
|
|
702
|
+
* @license
|
|
703
|
+
* Copyright 2019 Google LLC
|
|
704
|
+
*
|
|
705
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
706
|
+
* you may not use this file except in compliance with the License.
|
|
707
|
+
* You may obtain a copy of the License at
|
|
708
|
+
*
|
|
709
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
710
|
+
*
|
|
711
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
712
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
713
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
714
|
+
* See the License for the specific language governing permissions and
|
|
715
|
+
* limitations under the License.
|
|
716
|
+
*/function ri(e,t,n){return`firebase:${e}:${t}:${n}`}class Cs{constructor(t,n,r){this.persistence=t,this.auth=n,this.userKey=r;const{config:s,name:o}=this.auth;this.fullUserKey=ri(this.userKey,s.apiKey,o),this.fullPersistenceKey=ri("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 vi(this.auth,{idToken:t}).catch(()=>{});return n?Fn._fromGetAccountInfoResponse(this.auth,n,t):null}return Fn._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 Cs(yr(Ou),t,r);const s=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let o=s[0]||yr(Ou);const i=ri(r,t.config.apiKey,t.name);let a=null;for(const u of n)try{const c=await u._get(i);if(c){let f;if(typeof c=="string"){const m=await vi(t,{idToken:c}).catch(()=>{});if(!m)break;f=await Fn._fromGetAccountInfoResponse(t,m,c)}else f=Fn._fromJSON(t,c);u!==o&&(a=f),o=u;break}}catch{}const l=s.filter(u=>u._shouldAllowMigration);return!o._shouldAllowMigration||!l.length?new Cs(o,t,r):(o=l[0],a&&await o._set(i,a.toJSON()),await Promise.all(n.map(async u=>{if(u!==o)try{await u._remove(i)}catch{}})),new Cs(o,t,r))}}/**
|
|
717
|
+
* @license
|
|
718
|
+
* Copyright 2020 Google LLC
|
|
719
|
+
*
|
|
720
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
721
|
+
* you may not use this file except in compliance with the License.
|
|
722
|
+
* You may obtain a copy of the License at
|
|
723
|
+
*
|
|
724
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
725
|
+
*
|
|
726
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
727
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
728
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
729
|
+
* See the License for the specific language governing permissions and
|
|
730
|
+
* limitations under the License.
|
|
731
|
+
*/function Nu(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(hh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(uh(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(mh(t))return"Blackberry";if(gh(t))return"Webos";if(dh(t))return"Safari";if((t.includes("chrome/")||fh(t))&&!t.includes("edge/"))return"Chrome";if(ph(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 uh(e=wn()){return/firefox\//i.test(e)}function dh(e=wn()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function fh(e=wn()){return/crios\//i.test(e)}function hh(e=wn()){return/iemobile/i.test(e)}function ph(e=wn()){return/android/i.test(e)}function mh(e=wn()){return/blackberry/i.test(e)}function gh(e=wn()){return/webos/i.test(e)}function Vl(e=wn()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function dE(e=wn()){var t;return Vl(e)&&!!((t=window.navigator)!=null&&t.standalone)}function fE(){return SS()&&document.documentMode===10}function vh(e=wn()){return Vl(e)||ph(e)||gh(e)||mh(e)||/windows phone/i.test(e)||hh(e)}/**
|
|
732
|
+
* @license
|
|
733
|
+
* Copyright 2020 Google LLC
|
|
734
|
+
*
|
|
735
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
736
|
+
* you may not use this file except in compliance with the License.
|
|
737
|
+
* You may obtain a copy of the License at
|
|
738
|
+
*
|
|
739
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
740
|
+
*
|
|
741
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
742
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
743
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
744
|
+
* See the License for the specific language governing permissions and
|
|
745
|
+
* limitations under the License.
|
|
746
|
+
*/function yh(e,t=[]){let n;switch(e){case"Browser":n=Nu(wn());break;case"Worker":n=`${Nu(wn())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${xo}/${r}`}/**
|
|
747
|
+
* @license
|
|
748
|
+
* Copyright 2022 Google LLC
|
|
749
|
+
*
|
|
750
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
751
|
+
* you may not use this file except in compliance with the License.
|
|
752
|
+
* You may obtain a copy of the License at
|
|
753
|
+
*
|
|
754
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
755
|
+
*
|
|
756
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
757
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
758
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
759
|
+
* See the License for the specific language governing permissions and
|
|
760
|
+
* limitations under the License.
|
|
761
|
+
*/class hE{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})}}}/**
|
|
762
|
+
* @license
|
|
763
|
+
* Copyright 2023 Google LLC
|
|
764
|
+
*
|
|
765
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
766
|
+
* you may not use this file except in compliance with the License.
|
|
767
|
+
* You may obtain a copy of the License at
|
|
768
|
+
*
|
|
769
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
770
|
+
*
|
|
771
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
772
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
773
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
774
|
+
* See the License for the specific language governing permissions and
|
|
775
|
+
* limitations under the License.
|
|
776
|
+
*/async function pE(e,t={}){return Ls(e,"GET","/v2/passwordPolicy",Hl(e,t))}/**
|
|
777
|
+
* @license
|
|
778
|
+
* Copyright 2023 Google LLC
|
|
779
|
+
*
|
|
780
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
781
|
+
* you may not use this file except in compliance with the License.
|
|
782
|
+
* You may obtain a copy of the License at
|
|
783
|
+
*
|
|
784
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
785
|
+
*
|
|
786
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
787
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
788
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
789
|
+
* See the License for the specific language governing permissions and
|
|
790
|
+
* limitations under the License.
|
|
791
|
+
*/const mE=6;class gE{constructor(t){var r;const n=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??mE,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))}}/**
|
|
792
|
+
* @license
|
|
793
|
+
* Copyright 2020 Google LLC
|
|
794
|
+
*
|
|
795
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
796
|
+
* you may not use this file except in compliance with the License.
|
|
797
|
+
* You may obtain a copy of the License at
|
|
798
|
+
*
|
|
799
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
800
|
+
*
|
|
801
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
802
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
803
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
804
|
+
* See the License for the specific language governing permissions and
|
|
805
|
+
* limitations under the License.
|
|
806
|
+
*/class vE{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 Du(this),this.idTokenSubscription=new Du(this),this.beforeStateQueue=new hE(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=sh,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=yr(n)),this._initializationPromise=this.queue(async()=>{var r,s,o;if(!this._deleted&&(this.persistenceManager=await Cs.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 vi(this,{idToken:t}),r=await Fn._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(tr(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 qe(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 yi(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=XI()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(tr(this.app))return Promise.reject(ls(this));const n=t?Ds(t):null;return n&&qe(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&&qe(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 tr(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 tr(this.app)?Promise.reject(ls(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(yr(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 pE(this),n=new gE(t);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(t){this._errorFactory=new Co("auth","Firebase",t())}onAuthStateChanged(t,n,r){return this.registerStateListener(this.authStateSubscription,t,n,r)}beforeAuthStateChanged(t,n){return this.beforeStateQueue.pushCallback(t,n)}onIdTokenChanged(t,n,r){return this.registerStateListener(this.idTokenSubscription,t,n,r)}authStateReady(){return new Promise((t,n)=>{if(this.currentUser)t();else{const r=this.onAuthStateChanged(()=>{r(),t()},n)}})}async revokeAccessToken(t){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await uE(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&&yr(t)||this._popupRedirectResolver;qe(n,this,"argument-error"),this.redirectPersistenceManager=await Cs.create(this,[yr(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(qe(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 qe(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){!t||this.frameworks.includes(t)||(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=yh(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(tr(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&&qI(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function Fi(e){return Ds(e)}class Du{constructor(t){this.auth=t,this.observer=null,this.addObserver=PS(n=>this.observer=n)}get next(){return qe(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
|
807
|
+
* @license
|
|
808
|
+
* Copyright 2020 Google LLC
|
|
809
|
+
*
|
|
810
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
811
|
+
* you may not use this file except in compliance with the License.
|
|
812
|
+
* You may obtain a copy of the License at
|
|
813
|
+
*
|
|
814
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
815
|
+
*
|
|
816
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
817
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
818
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
819
|
+
* See the License for the specific language governing permissions and
|
|
820
|
+
* limitations under the License.
|
|
821
|
+
*/let zl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function yE(e){zl=e}function wE(e){return zl.loadJS(e)}function bE(){return zl.gapiScript}function _E(e){return`__${e}${Math.floor(Math.random()*1e6)}`}/**
|
|
822
|
+
* @license
|
|
823
|
+
* Copyright 2020 Google LLC
|
|
824
|
+
*
|
|
825
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
826
|
+
* you may not use this file except in compliance with the License.
|
|
827
|
+
* You may obtain a copy of the License at
|
|
828
|
+
*
|
|
829
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
830
|
+
*
|
|
831
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
832
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
833
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
834
|
+
* See the License for the specific language governing permissions and
|
|
835
|
+
* limitations under the License.
|
|
836
|
+
*/function kE(e,t){const n=Qf(e,"auth");if(n.isInitialized()){const s=n.getImmediate(),o=n.getOptions();if(Ms(o,t??{}))return s;ir(s,"already-initialized")}return n.initialize({options:t})}function TE(e,t){const n=(t==null?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(yr);t!=null&&t.errorMap&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,t==null?void 0:t.popupRedirectResolver)}function SE(e,t,n){const r=Fi(e);qe(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!1,o=wh(t),{host:i,port:a}=IE(t),l=a===null?"":`:${a}`,u={url:`${o}//${i}${l}/`},c=Object.freeze({host:i,port:a,protocol:o.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){qe(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),qe(Ms(u,r.config.emulator)&&Ms(c,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=u,r.emulatorConfig=c,r.settings.appVerificationDisabledForTesting=!0,Ll(i)?OS(`${o}//${i}${l}`):EE()}function wh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function IE(e){const t=wh(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:Lu(r.substr(o.length+1))}}else{const[o,i]=r.split(":");return{host:o,port:Lu(i)}}}function Lu(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}function EE(){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())}/**
|
|
837
|
+
* @license
|
|
838
|
+
* Copyright 2020 Google LLC
|
|
839
|
+
*
|
|
840
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
841
|
+
* you may not use this file except in compliance with the License.
|
|
842
|
+
* You may obtain a copy of the License at
|
|
843
|
+
*
|
|
844
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
845
|
+
*
|
|
846
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
847
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
848
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
849
|
+
* See the License for the specific language governing permissions and
|
|
850
|
+
* limitations under the License.
|
|
851
|
+
*/class bh{constructor(t,n){this.providerId=t,this.signInMethod=n}toJSON(){return vr("not implemented")}_getIdTokenResponse(t){return vr("not implemented")}_linkToIdToken(t,n){return vr("not implemented")}_getReauthenticationResolver(t){return vr("not implemented")}}/**
|
|
852
|
+
* @license
|
|
853
|
+
* Copyright 2020 Google LLC
|
|
854
|
+
*
|
|
855
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
856
|
+
* you may not use this file except in compliance with the License.
|
|
857
|
+
* You may obtain a copy of the License at
|
|
858
|
+
*
|
|
859
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
860
|
+
*
|
|
861
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
862
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
863
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
864
|
+
* See the License for the specific language governing permissions and
|
|
865
|
+
* limitations under the License.
|
|
866
|
+
*/async function As(e,t){return tE(e,"POST","/v1/accounts:signInWithIdp",Hl(e,t))}/**
|
|
867
|
+
* @license
|
|
868
|
+
* Copyright 2020 Google LLC
|
|
869
|
+
*
|
|
870
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
871
|
+
* you may not use this file except in compliance with the License.
|
|
872
|
+
* You may obtain a copy of the License at
|
|
873
|
+
*
|
|
874
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
875
|
+
*
|
|
876
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
877
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
878
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
879
|
+
* See the License for the specific language governing permissions and
|
|
880
|
+
* limitations under the License.
|
|
881
|
+
*/const CE="http://localhost";class cs extends bh{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const n=new cs(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):ir("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 cs(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 As(t,n)}_linkToIdToken(t,n){const r=this.buildRequest();return r.idToken=n,As(t,r)}_getReauthenticationResolver(t){const n=this.buildRequest();return n.autoCreate=!1,As(t,n)}buildRequest(){const t={requestUri:CE,returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),t.postBody=Ao(n)}return t}}/**
|
|
882
|
+
* @license
|
|
883
|
+
* Copyright 2020 Google LLC
|
|
884
|
+
*
|
|
885
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
886
|
+
* you may not use this file except in compliance with the License.
|
|
887
|
+
* You may obtain a copy of the License at
|
|
888
|
+
*
|
|
889
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
890
|
+
*
|
|
891
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
892
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
893
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
894
|
+
* See the License for the specific language governing permissions and
|
|
895
|
+
* limitations under the License.
|
|
896
|
+
*/class Gl{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}}/**
|
|
897
|
+
* @license
|
|
898
|
+
* Copyright 2019 Google LLC
|
|
899
|
+
*
|
|
900
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
901
|
+
* you may not use this file except in compliance with the License.
|
|
902
|
+
* You may obtain a copy of the License at
|
|
903
|
+
*
|
|
904
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
905
|
+
*
|
|
906
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
907
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
908
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
909
|
+
* See the License for the specific language governing permissions and
|
|
910
|
+
* limitations under the License.
|
|
911
|
+
*/class Po extends Gl{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}/**
|
|
912
|
+
* @license
|
|
913
|
+
* Copyright 2020 Google LLC
|
|
914
|
+
*
|
|
915
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
916
|
+
* you may not use this file except in compliance with the License.
|
|
917
|
+
* You may obtain a copy of the License at
|
|
918
|
+
*
|
|
919
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
920
|
+
*
|
|
921
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
922
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
923
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
924
|
+
* See the License for the specific language governing permissions and
|
|
925
|
+
* limitations under the License.
|
|
926
|
+
*/class Nr extends Po{constructor(){super("facebook.com")}static credential(t){return cs._fromParams({providerId:Nr.PROVIDER_ID,signInMethod:Nr.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Nr.credentialFromTaggedObject(t)}static credentialFromError(t){return Nr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return Nr.credential(t.oauthAccessToken)}catch{return null}}}Nr.FACEBOOK_SIGN_IN_METHOD="facebook.com";Nr.PROVIDER_ID="facebook.com";/**
|
|
927
|
+
* @license
|
|
928
|
+
* Copyright 2020 Google LLC
|
|
929
|
+
*
|
|
930
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
931
|
+
* you may not use this file except in compliance with the License.
|
|
932
|
+
* You may obtain a copy of the License at
|
|
933
|
+
*
|
|
934
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
935
|
+
*
|
|
936
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
937
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
938
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
939
|
+
* See the License for the specific language governing permissions and
|
|
940
|
+
* limitations under the License.
|
|
941
|
+
*/class Dr extends Po{constructor(){super("google.com"),this.addScope("profile")}static credential(t,n){return cs._fromParams({providerId:Dr.PROVIDER_ID,signInMethod:Dr.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:n})}static credentialFromResult(t){return Dr.credentialFromTaggedObject(t)}static credentialFromError(t){return Dr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:n,oauthAccessToken:r}=t;if(!n&&!r)return null;try{return Dr.credential(n,r)}catch{return null}}}Dr.GOOGLE_SIGN_IN_METHOD="google.com";Dr.PROVIDER_ID="google.com";/**
|
|
942
|
+
* @license
|
|
943
|
+
* Copyright 2020 Google LLC
|
|
944
|
+
*
|
|
945
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
946
|
+
* you may not use this file except in compliance with the License.
|
|
947
|
+
* You may obtain a copy of the License at
|
|
948
|
+
*
|
|
949
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
950
|
+
*
|
|
951
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
952
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
953
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
954
|
+
* See the License for the specific language governing permissions and
|
|
955
|
+
* limitations under the License.
|
|
956
|
+
*/class nr extends Po{constructor(){super("github.com")}static credential(t){return cs._fromParams({providerId:nr.PROVIDER_ID,signInMethod:nr.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return nr.credentialFromTaggedObject(t)}static credentialFromError(t){return nr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t)||!t.oauthAccessToken)return null;try{return nr.credential(t.oauthAccessToken)}catch{return null}}}nr.GITHUB_SIGN_IN_METHOD="github.com";nr.PROVIDER_ID="github.com";/**
|
|
957
|
+
* @license
|
|
958
|
+
* Copyright 2020 Google LLC
|
|
959
|
+
*
|
|
960
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
961
|
+
* you may not use this file except in compliance with the License.
|
|
962
|
+
* You may obtain a copy of the License at
|
|
963
|
+
*
|
|
964
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
965
|
+
*
|
|
966
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
967
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
968
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
969
|
+
* See the License for the specific language governing permissions and
|
|
970
|
+
* limitations under the License.
|
|
971
|
+
*/class Lr extends Po{constructor(){super("twitter.com")}static credential(t,n){return cs._fromParams({providerId:Lr.PROVIDER_ID,signInMethod:Lr.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:n})}static credentialFromResult(t){return Lr.credentialFromTaggedObject(t)}static credentialFromError(t){return Lr.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=t;if(!n||!r)return null;try{return Lr.credential(n,r)}catch{return null}}}Lr.TWITTER_SIGN_IN_METHOD="twitter.com";Lr.PROVIDER_ID="twitter.com";/**
|
|
972
|
+
* @license
|
|
973
|
+
* Copyright 2020 Google LLC
|
|
974
|
+
*
|
|
975
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
976
|
+
* you may not use this file except in compliance with the License.
|
|
977
|
+
* You may obtain a copy of the License at
|
|
978
|
+
*
|
|
979
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
980
|
+
*
|
|
981
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
982
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
983
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
984
|
+
* See the License for the specific language governing permissions and
|
|
985
|
+
* limitations under the License.
|
|
986
|
+
*/class Os{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 Fn._fromIdTokenResponse(t,r,s),i=ju(r);return new Os({user:o,providerId:i,_tokenResponse:r,operationType:n})}static async _forOperation(t,n,r){await t._updateTokensIfNecessary(r,!0);const s=ju(r);return new Os({user:t,providerId:s,_tokenResponse:r,operationType:n})}}function ju(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}/**
|
|
987
|
+
* @license
|
|
988
|
+
* Copyright 2020 Google LLC
|
|
989
|
+
*
|
|
990
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
991
|
+
* you may not use this file except in compliance with the License.
|
|
992
|
+
* You may obtain a copy of the License at
|
|
993
|
+
*
|
|
994
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
995
|
+
*
|
|
996
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
997
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
998
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
999
|
+
* See the License for the specific language governing permissions and
|
|
1000
|
+
* limitations under the License.
|
|
1001
|
+
*/class wi extends Wr{constructor(t,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,wi.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 wi(t,n,r,s)}}function _h(e,t,n,r){return(t==="reauthenticate"?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(o=>{throw o.code==="auth/multi-factor-auth-required"?wi._fromErrorAndOperation(e,o,t,r):o})}async function AE(e,t,n=!1){const r=await _o(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return Os._forOperation(e,"link",r)}/**
|
|
1002
|
+
* @license
|
|
1003
|
+
* Copyright 2019 Google LLC
|
|
1004
|
+
*
|
|
1005
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1006
|
+
* you may not use this file except in compliance with the License.
|
|
1007
|
+
* You may obtain a copy of the License at
|
|
1008
|
+
*
|
|
1009
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1010
|
+
*
|
|
1011
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1012
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1013
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1014
|
+
* See the License for the specific language governing permissions and
|
|
1015
|
+
* limitations under the License.
|
|
1016
|
+
*/async function xE(e,t,n=!1){const{auth:r}=e;if(tr(r.app))return Promise.reject(ls(r));const s="reauthenticate";try{const o=await _o(e,_h(r,s,t,e),n);qe(o.idToken,r,"internal-error");const i=Wl(o.idToken);qe(i,r,"internal-error");const{sub:a}=i;return qe(e.uid===a,r,"user-mismatch"),Os._forOperation(e,s,o)}catch(o){throw(o==null?void 0:o.code)==="auth/user-not-found"&&ir(r,"user-mismatch"),o}}/**
|
|
1017
|
+
* @license
|
|
1018
|
+
* Copyright 2020 Google LLC
|
|
1019
|
+
*
|
|
1020
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1021
|
+
* you may not use this file except in compliance with the License.
|
|
1022
|
+
* You may obtain a copy of the License at
|
|
1023
|
+
*
|
|
1024
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1025
|
+
*
|
|
1026
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1027
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1028
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1029
|
+
* See the License for the specific language governing permissions and
|
|
1030
|
+
* limitations under the License.
|
|
1031
|
+
*/async function RE(e,t,n=!1){if(tr(e.app))return Promise.reject(ls(e));const r="signIn",s=await _h(e,r,t),o=await Os._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(o.user),o}function PE(e,t,n,r){return Ds(e).onIdTokenChanged(t,n,r)}function ME(e,t,n){return Ds(e).beforeAuthStateChanged(t,n)}const bi="__sak";/**
|
|
1032
|
+
* @license
|
|
1033
|
+
* Copyright 2019 Google LLC
|
|
1034
|
+
*
|
|
1035
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1036
|
+
* you may not use this file except in compliance with the License.
|
|
1037
|
+
* You may obtain a copy of the License at
|
|
1038
|
+
*
|
|
1039
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1040
|
+
*
|
|
1041
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1042
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1043
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1044
|
+
* See the License for the specific language governing permissions and
|
|
1045
|
+
* limitations under the License.
|
|
1046
|
+
*/class kh{constructor(t,n){this.storageRetriever=t,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(bi,"1"),this.storage.removeItem(bi),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()}}/**
|
|
1047
|
+
* @license
|
|
1048
|
+
* Copyright 2020 Google LLC
|
|
1049
|
+
*
|
|
1050
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1051
|
+
* you may not use this file except in compliance with the License.
|
|
1052
|
+
* You may obtain a copy of the License at
|
|
1053
|
+
*
|
|
1054
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1055
|
+
*
|
|
1056
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1057
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1058
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1059
|
+
* See the License for the specific language governing permissions and
|
|
1060
|
+
* limitations under the License.
|
|
1061
|
+
*/const $E=1e3,OE=10;class Th extends kh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(t,n)=>this.onStorageEvent(t,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=vh(),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);fE()&&o!==t.newValue&&t.newValue!==t.oldValue?setTimeout(s,OE):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)})},$E)}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]}}Th.type="LOCAL";const NE=Th;/**
|
|
1062
|
+
* @license
|
|
1063
|
+
* Copyright 2020 Google LLC
|
|
1064
|
+
*
|
|
1065
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1066
|
+
* you may not use this file except in compliance with the License.
|
|
1067
|
+
* You may obtain a copy of the License at
|
|
1068
|
+
*
|
|
1069
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1070
|
+
*
|
|
1071
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1072
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1073
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1074
|
+
* See the License for the specific language governing permissions and
|
|
1075
|
+
* limitations under the License.
|
|
1076
|
+
*/class Sh extends kh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(t,n){}_removeListener(t,n){}}Sh.type="SESSION";const Ih=Sh;/**
|
|
1077
|
+
* @license
|
|
1078
|
+
* Copyright 2019 Google LLC
|
|
1079
|
+
*
|
|
1080
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1081
|
+
* you may not use this file except in compliance with the License.
|
|
1082
|
+
* You may obtain a copy of the License at
|
|
1083
|
+
*
|
|
1084
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1085
|
+
*
|
|
1086
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1087
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1088
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1089
|
+
* See the License for the specific language governing permissions and
|
|
1090
|
+
* limitations under the License.
|
|
1091
|
+
*/function DE(e){return Promise.all(e.map(async t=>{try{return{fulfilled:!0,value:await t}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
|
|
1092
|
+
* @license
|
|
1093
|
+
* Copyright 2019 Google LLC
|
|
1094
|
+
*
|
|
1095
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1096
|
+
* you may not use this file except in compliance with the License.
|
|
1097
|
+
* You may obtain a copy of the License at
|
|
1098
|
+
*
|
|
1099
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1100
|
+
*
|
|
1101
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1102
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1103
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1104
|
+
* See the License for the specific language governing permissions and
|
|
1105
|
+
* limitations under the License.
|
|
1106
|
+
*/class Bi{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 Bi(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 u=>u(n.origin,o)),l=await DE(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)}}Bi.receivers=[];/**
|
|
1107
|
+
* @license
|
|
1108
|
+
* Copyright 2020 Google LLC
|
|
1109
|
+
*
|
|
1110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1111
|
+
* you may not use this file except in compliance with the License.
|
|
1112
|
+
* You may obtain a copy of the License at
|
|
1113
|
+
*
|
|
1114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1115
|
+
*
|
|
1116
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1119
|
+
* See the License for the specific language governing permissions and
|
|
1120
|
+
* limitations under the License.
|
|
1121
|
+
*/function ql(e="",t=10){let n="";for(let r=0;r<t;r++)n+=Math.floor(Math.random()*10);return e+n}/**
|
|
1122
|
+
* @license
|
|
1123
|
+
* Copyright 2019 Google LLC
|
|
1124
|
+
*
|
|
1125
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1126
|
+
* you may not use this file except in compliance with the License.
|
|
1127
|
+
* You may obtain a copy of the License at
|
|
1128
|
+
*
|
|
1129
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1130
|
+
*
|
|
1131
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1132
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1133
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1134
|
+
* See the License for the specific language governing permissions and
|
|
1135
|
+
* limitations under the License.
|
|
1136
|
+
*/class LE{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 u=ql("",20);s.port1.start();const c=setTimeout(()=>{l(new Error("unsupported_event"))},r);i={messageChannel:s,onMessage(f){const m=f;if(m.data.eventId===u)switch(m.data.status){case"ack":clearTimeout(c),o=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(o),a(m.data.response);break;default:clearTimeout(c),clearTimeout(o),l(new Error("invalid_response"));break}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:u,data:n},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}/**
|
|
1137
|
+
* @license
|
|
1138
|
+
* Copyright 2020 Google LLC
|
|
1139
|
+
*
|
|
1140
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1141
|
+
* you may not use this file except in compliance with the License.
|
|
1142
|
+
* You may obtain a copy of the License at
|
|
1143
|
+
*
|
|
1144
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1145
|
+
*
|
|
1146
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1147
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1148
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1149
|
+
* See the License for the specific language governing permissions and
|
|
1150
|
+
* limitations under the License.
|
|
1151
|
+
*/function or(){return window}function jE(e){or().location.href=e}/**
|
|
1152
|
+
* @license
|
|
1153
|
+
* Copyright 2020 Google LLC.
|
|
1154
|
+
*
|
|
1155
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1156
|
+
* you may not use this file except in compliance with the License.
|
|
1157
|
+
* You may obtain a copy of the License at
|
|
1158
|
+
*
|
|
1159
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1160
|
+
*
|
|
1161
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1162
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1163
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1164
|
+
* See the License for the specific language governing permissions and
|
|
1165
|
+
* limitations under the License.
|
|
1166
|
+
*/function Eh(){return typeof or().WorkerGlobalScope<"u"&&typeof or().importScripts=="function"}async function UE(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function FE(){var e;return((e=navigator==null?void 0:navigator.serviceWorker)==null?void 0:e.controller)||null}function BE(){return Eh()?self:null}/**
|
|
1167
|
+
* @license
|
|
1168
|
+
* Copyright 2019 Google LLC
|
|
1169
|
+
*
|
|
1170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1171
|
+
* you may not use this file except in compliance with the License.
|
|
1172
|
+
* You may obtain a copy of the License at
|
|
1173
|
+
*
|
|
1174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1175
|
+
*
|
|
1176
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1177
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1179
|
+
* See the License for the specific language governing permissions and
|
|
1180
|
+
* limitations under the License.
|
|
1181
|
+
*/const Ch="firebaseLocalStorageDb",HE=1,_i="firebaseLocalStorage",Ah="fbase_key";class Mo{constructor(t){this.request=t}toPromise(){return new Promise((t,n)=>{this.request.addEventListener("success",()=>{t(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function Hi(e,t){return e.transaction([_i],t?"readwrite":"readonly").objectStore(_i)}function WE(){const e=indexedDB.deleteDatabase(Ch);return new Mo(e).toPromise()}function al(){const e=indexedDB.open(Ch,HE);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const r=e.result;try{r.createObjectStore(_i,{keyPath:Ah})}catch(s){n(s)}}),e.addEventListener("success",async()=>{const r=e.result;r.objectStoreNames.contains(_i)?t(r):(r.close(),await WE(),t(await al()))})})}async function Uu(e,t,n){const r=Hi(e,!0).put({[Ah]:t,value:n});return new Mo(r).toPromise()}async function VE(e,t){const n=Hi(e,!1).get(t),r=await new Mo(n).toPromise();return r===void 0?null:r.value}function Fu(e,t){const n=Hi(e,!0).delete(t);return new Mo(n).toPromise()}const zE=800,GE=3;class xh{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 al(),this.db)}async _withRetries(t){let n=0;for(;;)try{const r=await this._openDb();return await t(r)}catch(r){if(n++>GE)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Eh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Bi._getInstance(BE()),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 UE(),!this.activeServiceWorker)return;this.sender=new LE(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||FE()!==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 al();return await Uu(t,bi,"1"),await Fu(t,bi),!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=>Uu(r,t,n)),this.localCache[t]=n,this.notifyServiceWorker(t)))}async _get(t){const n=await this._withRetries(r=>VE(r,t));return this.localCache[t]=n,n}async _remove(t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Fu(n,t)),delete this.localCache[t],this.notifyServiceWorker(t)))}async _poll(){const t=await this._withRetries(s=>{const o=Hi(s,!1).getAll();return new Mo(o).toPromise()});if(!t)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(t.length!==0)for(const{fbase_key:s,value:o}of t)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(o)&&(this.notifyListeners(s,o),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(t,n){this.localCache[t]=n;const r=this.listeners[t];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),zE)}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()}}xh.type="LOCAL";const qE=xh;new Ro(3e4,6e4);/**
|
|
1182
|
+
* @license
|
|
1183
|
+
* Copyright 2021 Google LLC
|
|
1184
|
+
*
|
|
1185
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1186
|
+
* you may not use this file except in compliance with the License.
|
|
1187
|
+
* You may obtain a copy of the License at
|
|
1188
|
+
*
|
|
1189
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1190
|
+
*
|
|
1191
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1192
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1193
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1194
|
+
* See the License for the specific language governing permissions and
|
|
1195
|
+
* limitations under the License.
|
|
1196
|
+
*/function Rh(e,t){return t?yr(t):(qe(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}/**
|
|
1197
|
+
* @license
|
|
1198
|
+
* Copyright 2019 Google LLC
|
|
1199
|
+
*
|
|
1200
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1201
|
+
* you may not use this file except in compliance with the License.
|
|
1202
|
+
* You may obtain a copy of the License at
|
|
1203
|
+
*
|
|
1204
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1205
|
+
*
|
|
1206
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1207
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1208
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1209
|
+
* See the License for the specific language governing permissions and
|
|
1210
|
+
* limitations under the License.
|
|
1211
|
+
*/class Kl extends bh{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return As(t,this._buildIdpRequest())}_linkToIdToken(t,n){return As(t,this._buildIdpRequest(n))}_getReauthenticationResolver(t){return As(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 KE(e){return RE(e.auth,new Kl(e),e.bypassAuthState)}function JE(e){const{auth:t,user:n}=e;return qe(n,t,"internal-error"),xE(n,new Kl(e),e.bypassAuthState)}async function YE(e){const{auth:t,user:n}=e;return qe(n,t,"internal-error"),AE(n,new Kl(e),e.bypassAuthState)}/**
|
|
1212
|
+
* @license
|
|
1213
|
+
* Copyright 2020 Google LLC
|
|
1214
|
+
*
|
|
1215
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1216
|
+
* you may not use this file except in compliance with the License.
|
|
1217
|
+
* You may obtain a copy of the License at
|
|
1218
|
+
*
|
|
1219
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1220
|
+
*
|
|
1221
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1222
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1223
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1224
|
+
* See the License for the specific language governing permissions and
|
|
1225
|
+
* limitations under the License.
|
|
1226
|
+
*/class Ph{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(u){this.reject(u)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return KE;case"linkViaPopup":case"linkViaRedirect":return YE;case"reauthViaPopup":case"reauthViaRedirect":return JE;default:ir(this.auth,"internal-error")}}resolve(t){Er(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Er(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()}}/**
|
|
1227
|
+
* @license
|
|
1228
|
+
* Copyright 2020 Google LLC
|
|
1229
|
+
*
|
|
1230
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1231
|
+
* you may not use this file except in compliance with the License.
|
|
1232
|
+
* You may obtain a copy of the License at
|
|
1233
|
+
*
|
|
1234
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1235
|
+
*
|
|
1236
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1237
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1238
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1239
|
+
* See the License for the specific language governing permissions and
|
|
1240
|
+
* limitations under the License.
|
|
1241
|
+
*/const XE=new Ro(2e3,1e4);async function QE(e,t,n){if(tr(e.app))return Promise.reject(Wn(e,"operation-not-supported-in-this-environment"));const r=Fi(e);KI(e,t,Gl);const s=Rh(r,n);return new os(r,"signInViaPopup",t,s).executeNotNull()}class os extends Ph{constructor(t,n,r,s,o){super(t,n,s,o),this.provider=r,this.authWindow=null,this.pollId=null,os.currentPopupAction&&os.currentPopupAction.cancel(),os.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return qe(t,this.auth,"internal-error"),t}async onExecution(){Er(this.filter.length===1,"Popup operations only handle one event");const t=ql();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(Wn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var t;return((t=this.authWindow)==null?void 0:t.associatedEvent)||null}cancel(){this.reject(Wn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,os.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(Wn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(t,XE.get())};t()}}os.currentPopupAction=null;/**
|
|
1242
|
+
* @license
|
|
1243
|
+
* Copyright 2020 Google LLC
|
|
1244
|
+
*
|
|
1245
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1246
|
+
* you may not use this file except in compliance with the License.
|
|
1247
|
+
* You may obtain a copy of the License at
|
|
1248
|
+
*
|
|
1249
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1250
|
+
*
|
|
1251
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1252
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1253
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1254
|
+
* See the License for the specific language governing permissions and
|
|
1255
|
+
* limitations under the License.
|
|
1256
|
+
*/const ZE="pendingRedirect",si=new Map;class eC extends Ph{constructor(t,n,r=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let t=si.get(this.auth._key());if(!t){try{const r=await tC(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(r)}catch(n){t=()=>Promise.reject(n)}si.set(this.auth._key(),t)}return this.bypassAuthState||si.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 tC(e,t){const n=sC(t),r=rC(e);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function nC(e,t){si.set(e._key(),t)}function rC(e){return yr(e._redirectPersistence)}function sC(e){return ri(ZE,e.config.apiKey,e.name)}async function oC(e,t,n=!1){if(tr(e.app))return Promise.reject(ls(e));const r=Fi(e),s=Rh(r,t),i=await new eC(r,s,n).execute();return i&&!n&&(delete i.user._redirectEventId,await r._persistUserIfCurrent(i.user),await r._setRedirectUser(null,t)),i}/**
|
|
1257
|
+
* @license
|
|
1258
|
+
* Copyright 2020 Google LLC
|
|
1259
|
+
*
|
|
1260
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1261
|
+
* you may not use this file except in compliance with the License.
|
|
1262
|
+
* You may obtain a copy of the License at
|
|
1263
|
+
*
|
|
1264
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1265
|
+
*
|
|
1266
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1267
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1268
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1269
|
+
* See the License for the specific language governing permissions and
|
|
1270
|
+
* limitations under the License.
|
|
1271
|
+
*/const iC=600*1e3;class aC{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||!lC(t)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=t,n=!0)),n}sendToConsumer(t,n){var r;if(t.error&&!Mh(t)){const s=((r=t.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(Wn(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>=iC&&this.cachedEventUids.clear(),this.cachedEventUids.has(Bu(t))}saveEventToCache(t){this.cachedEventUids.add(Bu(t)),this.lastProcessedEventTime=Date.now()}}function Bu(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(t=>t).join("-")}function Mh({type:e,error:t}){return e==="unknown"&&(t==null?void 0:t.code)==="auth/no-auth-event"}function lC(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Mh(e);default:return!1}}/**
|
|
1272
|
+
* @license
|
|
1273
|
+
* Copyright 2020 Google LLC
|
|
1274
|
+
*
|
|
1275
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1276
|
+
* you may not use this file except in compliance with the License.
|
|
1277
|
+
* You may obtain a copy of the License at
|
|
1278
|
+
*
|
|
1279
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1280
|
+
*
|
|
1281
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1282
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1283
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1284
|
+
* See the License for the specific language governing permissions and
|
|
1285
|
+
* limitations under the License.
|
|
1286
|
+
*/async function cC(e,t={}){return Ls(e,"GET","/v1/projects",t)}/**
|
|
1287
|
+
* @license
|
|
1288
|
+
* Copyright 2020 Google LLC
|
|
1289
|
+
*
|
|
1290
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1291
|
+
* you may not use this file except in compliance with the License.
|
|
1292
|
+
* You may obtain a copy of the License at
|
|
1293
|
+
*
|
|
1294
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1295
|
+
*
|
|
1296
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1297
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1298
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1299
|
+
* See the License for the specific language governing permissions and
|
|
1300
|
+
* limitations under the License.
|
|
1301
|
+
*/const uC=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,dC=/^https?/;async function fC(e){if(e.config.emulator)return;const{authorizedDomains:t}=await cC(e);for(const n of t)try{if(hC(n))return}catch{}ir(e,"unauthorized-domain")}function hC(e){const t=ol(),{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(!dC.test(n))return!1;if(uC.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
|
|
1302
|
+
* @license
|
|
1303
|
+
* Copyright 2020 Google LLC.
|
|
1304
|
+
*
|
|
1305
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1306
|
+
* you may not use this file except in compliance with the License.
|
|
1307
|
+
* You may obtain a copy of the License at
|
|
1308
|
+
*
|
|
1309
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1310
|
+
*
|
|
1311
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1312
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1313
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1314
|
+
* See the License for the specific language governing permissions and
|
|
1315
|
+
* limitations under the License.
|
|
1316
|
+
*/const pC=new Ro(3e4,6e4);function Hu(){const e=or().___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 mC(e){return new Promise((t,n)=>{var s,o,i;function r(){Hu(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Hu(),n(Wn(e,"network-request-failed"))},timeout:pC.get()})}if((o=(s=or().gapi)==null?void 0:s.iframes)!=null&&o.Iframe)t(gapi.iframes.getContext());else if((i=or().gapi)!=null&&i.load)r();else{const a=_E("iframefcb");return or()[a]=()=>{gapi.load?r():n(Wn(e,"network-request-failed"))},wE(`${bE()}?onload=${a}`).catch(l=>n(l))}}).catch(t=>{throw oi=null,t})}let oi=null;function gC(e){return oi=oi||mC(e),oi}/**
|
|
1317
|
+
* @license
|
|
1318
|
+
* Copyright 2020 Google LLC.
|
|
1319
|
+
*
|
|
1320
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1321
|
+
* you may not use this file except in compliance with the License.
|
|
1322
|
+
* You may obtain a copy of the License at
|
|
1323
|
+
*
|
|
1324
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1325
|
+
*
|
|
1326
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1327
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1328
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1329
|
+
* See the License for the specific language governing permissions and
|
|
1330
|
+
* limitations under the License.
|
|
1331
|
+
*/const vC=new Ro(5e3,15e3),yC="__/auth/iframe",wC="emulator/auth/iframe",bC={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},_C=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function kC(e){const t=e.config;qe(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Bl(t,wC):`https://${e.config.authDomain}/${yC}`,r={apiKey:t.apiKey,appName:e.name,v:xo},s=_C.get(e.config.apiHost);s&&(r.eid=s);const o=e._getFrameworks();return o.length&&(r.fw=o.join(",")),`${n}?${Ao(r).slice(1)}`}async function TC(e){const t=await gC(e),n=or().gapi;return qe(n,e,"internal-error"),t.open({where:document.body,url:kC(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:bC,dontclear:!0},r=>new Promise(async(s,o)=>{await r.restyle({setHideOnLeave:!1});const i=Wn(e,"network-request-failed"),a=or().setTimeout(()=>{o(i)},vC.get());function l(){or().clearTimeout(a),s(r)}r.ping(l).then(l,()=>{o(i)})}))}/**
|
|
1332
|
+
* @license
|
|
1333
|
+
* Copyright 2020 Google LLC.
|
|
1334
|
+
*
|
|
1335
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1336
|
+
* you may not use this file except in compliance with the License.
|
|
1337
|
+
* You may obtain a copy of the License at
|
|
1338
|
+
*
|
|
1339
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1340
|
+
*
|
|
1341
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1342
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1343
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1344
|
+
* See the License for the specific language governing permissions and
|
|
1345
|
+
* limitations under the License.
|
|
1346
|
+
*/const SC={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},IC=500,EC=600,CC="_blank",AC="http://localhost";class Wu{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function xC(e,t,n,r=IC,s=EC){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={...SC,width:r.toString(),height:s.toString(),top:o,left:i},u=wn().toLowerCase();n&&(a=fh(u)?CC:n),uh(u)&&(t=t||AC,l.scrollbars="yes");const c=Object.entries(l).reduce((m,[S,D])=>`${m}${S}=${D},`,"");if(dE(u)&&a!=="_self")return RC(t||"",a),new Wu(null);const f=window.open(t||"",a,c);qe(f,e,"popup-blocked");try{f.focus()}catch{}return new Wu(f)}function RC(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
|
|
1347
|
+
* @license
|
|
1348
|
+
* Copyright 2021 Google LLC
|
|
1349
|
+
*
|
|
1350
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1351
|
+
* you may not use this file except in compliance with the License.
|
|
1352
|
+
* You may obtain a copy of the License at
|
|
1353
|
+
*
|
|
1354
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1355
|
+
*
|
|
1356
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1357
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1358
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1359
|
+
* See the License for the specific language governing permissions and
|
|
1360
|
+
* limitations under the License.
|
|
1361
|
+
*/const PC="__/auth/handler",MC="emulator/auth/handler",$C=encodeURIComponent("fac");async function Vu(e,t,n,r,s,o){qe(e.config.authDomain,e,"auth-domain-config-required"),qe(e.config.apiKey,e,"invalid-api-key");const i={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:xo,eventId:s};if(t instanceof Gl){t.setDefaultLanguage(e.languageCode),i.providerId=t.providerId||"",RS(t.getCustomParameters())||(i.customParameters=JSON.stringify(t.getCustomParameters()));for(const[c,f]of Object.entries({}))i[c]=f}if(t instanceof Po){const c=t.getScopes().filter(f=>f!=="");c.length>0&&(i.scopes=c.join(","))}e.tenantId&&(i.tid=e.tenantId);const a=i;for(const c of Object.keys(a))a[c]===void 0&&delete a[c];const l=await e._getAppCheckToken(),u=l?`#${$C}=${encodeURIComponent(l)}`:"";return`${OC(e)}?${Ao(a).slice(1)}${u}`}function OC({config:e}){return e.emulator?Bl(e,MC):`https://${e.authDomain}/${PC}`}/**
|
|
1362
|
+
* @license
|
|
1363
|
+
* Copyright 2020 Google LLC
|
|
1364
|
+
*
|
|
1365
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1366
|
+
* you may not use this file except in compliance with the License.
|
|
1367
|
+
* You may obtain a copy of the License at
|
|
1368
|
+
*
|
|
1369
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1370
|
+
*
|
|
1371
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1372
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1373
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1374
|
+
* See the License for the specific language governing permissions and
|
|
1375
|
+
* limitations under the License.
|
|
1376
|
+
*/const Ca="webStorageSupport";class NC{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Ih,this._completeRedirectFn=oC,this._overrideRedirectResult=nC}async _openPopup(t,n,r,s){var i;Er((i=this.eventManagers[t._key()])==null?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Vu(t,n,r,ol(),s);return xC(t,o,ql())}async _openRedirect(t,n,r,s){await this._originValidation(t);const o=await Vu(t,n,r,ol(),s);return jE(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):(Er(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 TC(t),r=new aC(t);return n.register("authEvent",s=>(qe(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(Ca,{type:Ca},s=>{var i;const o=(i=s==null?void 0:s[0])==null?void 0:i[Ca];o!==void 0&&n(!!o),ir(t,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const n=t._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=fC(t)),this.originValidationPromises[n]}get _shouldInitProactively(){return vh()||dh()||Vl()}}const DC=NC;var zu="@firebase/auth",Gu="1.12.2";/**
|
|
1377
|
+
* @license
|
|
1378
|
+
* Copyright 2020 Google LLC
|
|
1379
|
+
*
|
|
1380
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1381
|
+
* you may not use this file except in compliance with the License.
|
|
1382
|
+
* You may obtain a copy of the License at
|
|
1383
|
+
*
|
|
1384
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1385
|
+
*
|
|
1386
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1387
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1388
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1389
|
+
* See the License for the specific language governing permissions and
|
|
1390
|
+
* limitations under the License.
|
|
1391
|
+
*/class LC{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(){qe(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
|
1392
|
+
* @license
|
|
1393
|
+
* Copyright 2020 Google LLC
|
|
1394
|
+
*
|
|
1395
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1396
|
+
* you may not use this file except in compliance with the License.
|
|
1397
|
+
* You may obtain a copy of the License at
|
|
1398
|
+
*
|
|
1399
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1400
|
+
*
|
|
1401
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1402
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1403
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1404
|
+
* See the License for the specific language governing permissions and
|
|
1405
|
+
* limitations under the License.
|
|
1406
|
+
*/function jC(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 UC(e){wo(new $s("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;qe(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:yh(e)},u=new vE(r,s,o,l);return TE(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,n,r)=>{t.getProvider("auth-internal").initialize()})),wo(new $s("auth-internal",t=>{const n=Fi(t.getProvider("auth").getImmediate());return(r=>new LC(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Is(zu,Gu,jC(e)),Is(zu,Gu,"esm2020")}/**
|
|
1407
|
+
* @license
|
|
1408
|
+
* Copyright 2021 Google LLC
|
|
1409
|
+
*
|
|
1410
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1411
|
+
* you may not use this file except in compliance with the License.
|
|
1412
|
+
* You may obtain a copy of the License at
|
|
1413
|
+
*
|
|
1414
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1415
|
+
*
|
|
1416
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1417
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1418
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1419
|
+
* See the License for the specific language governing permissions and
|
|
1420
|
+
* limitations under the License.
|
|
1421
|
+
*/const FC=300,BC=Kf("authIdTokenMaxAge")||FC;let qu=null;const HC=e=>async t=>{const n=t&&await t.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>BC)return;const s=n==null?void 0:n.token;qu!==s&&(qu=s,await fetch(e,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function WC(e=eh()){const t=Qf(e,"auth");if(t.isInitialized())return t.getImmediate();const n=kE(e,{popupRedirectResolver:DC,persistence:[qE,NE,Ih]}),r=Kf("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const o=new URL(r,location.origin);if(location.origin===o.origin){const i=HC(o.toString());ME(n,i,()=>i(n.currentUser)),PE(n,a=>i(a))}}const s=yS("auth");return s&&SE(n,`http://${s}`),n}function VC(){var e;return((e=document.getElementsByTagName("head"))==null?void 0:e[0])??document}yE({loadJS(e){return new Promise((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=s=>{const o=Wn("internal-error");o.customData=s,n(o)},r.type="text/javascript",r.charset="UTF-8",VC().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});UC("Browser");const zC={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 GC(e){const t=O(null),n=O(""),r=O(""),s=O(""),o=O({loggedIn:!1,githubUsername:"",repoOwner:"",repoName:"",configured:!1,startup:{inProgress:!1,mode:"idle",branch:"main",lastAction:"not-started",lastRunAtIso:"",lastSuccessAtIso:"",lastError:""}}),i=ie(()=>s.value==="pull"),a=ie(()=>s.value==="push"),l=ie(()=>s.value==="startup-sync"),u=ie(()=>s.value!=="");async function c(){try{const A=await fetch("/codex-api/skills-sync/status");if(!A.ok)return;const R=await A.json();R.data&&(o.value=R.data)}catch{}}async function f(){try{const A=await fetch("/codex-api/skills-sync/github/start-login",{method:"POST"}),R=await A.json();if(!A.ok||!R.data)throw new Error("Failed to start GitHub login");t.value=R.data;const B=30,F=Math.max((R.data.interval??5)*1e3,3e3);let X=!1;for(let ae=0;ae<B;ae++){await new Promise(ue=>setTimeout(ue,F));const ve=await fetch("/codex-api/skills-sync/github/complete-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceCode:R.data.device_code})}),ke=await ve.json();if(!ve.ok)throw new Error(ke.error||"Failed to complete GitHub login");if(ke.ok){X=!0;break}if(!ke.pending)throw new Error(ke.error||"Failed to complete GitHub login")}if(!X)throw new Error("GitHub login timed out. Please retry.");t.value=null,await c(),e.showToast("GitHub login successful")}catch(A){e.showToast(A instanceof Error?A.message:"Failed GitHub login","error")}}async function m(){try{const A=$I().length>0?eh():Zf(zC),R=WC(A),B=new nr;B.addScope("repo");const F=await QE(R,B),X=nr.credentialFromResult(F),ae=(X==null?void 0:X.accessToken)??"";if(!ae)throw new Error("GitHub access token missing from Firebase login");const ve=await fetch("/codex-api/skills-sync/github/token-login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:ae})}),ke=await ve.json();if(!ve.ok||!ke.ok)throw new Error(ke.error||"Failed to login with GitHub token");await c(),e.showToast("GitHub login successful")}catch(A){const R=A instanceof Error?A.message:"Failed Firebase GitHub login";e.showToast(R,"error")}}async function S(){r.value="",n.value="pull-started",s.value="pull";try{const A=await fetch("/codex-api/skills-sync/pull",{method:"POST"}),R=await A.json();if(!A.ok||!R.ok)throw new Error(R.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(A){const R=A instanceof Error?A.message:"Failed to pull sync";r.value=R,n.value="pull-failed",e.showToast(R,"error")}finally{s.value=""}}async function D(){r.value="",n.value="push-started",s.value="push";try{const A=await fetch("/codex-api/skills-sync/push",{method:"POST"}),R=await A.json();if(!A.ok||!R.ok)throw new Error(R.error||"Failed to push synced skills");n.value="push-success",e.showToast("Pushed skills to private sync repo")}catch(A){const R=A instanceof Error?A.message:"Failed to push sync";r.value=R,n.value="push-failed",e.showToast(R,"error")}finally{s.value=""}}async function H(){r.value="",n.value="startup-sync-started",s.value="startup-sync";try{const A=await fetch("/codex-api/skills-sync/startup-sync",{method:"POST"}),R=await A.json();if(!A.ok||!R.ok)throw new Error(R.error||"Failed to run startup sync");await e.onPulled(),await c(),n.value="startup-sync-success",e.showToast("Startup sync completed")}catch(A){const R=A instanceof Error?A.message:"Failed startup sync";r.value=R,n.value="startup-sync-failed",e.showToast(R,"error")}finally{s.value=""}}async function ee(){try{const A=await fetch("/codex-api/skills-sync/github/logout",{method:"POST"}),R=await A.json();if(!A.ok||!R.ok)throw new Error(R.error||"Failed to logout GitHub");await c(),e.showToast("Logged out from GitHub")}catch(A){e.showToast(A instanceof Error?A.message:"Failed to logout GitHub","error")}}return{deviceLogin:t,isPullInFlight:i,isPushInFlight:a,isStartupSyncInFlight:l,isSyncActionInFlight:u,loadSyncStatus:c,logoutGithub:ee,pullSkillsSync:S,pushSkillsSync:D,startupSkillsSync:H,startGithubFirebaseLogin:m,startGithubLogin:f,syncActionError:r,syncActionStatus:n,syncStatus:o}}const qC={class:"skills-hub"},KC={class:"skills-sync-panel"},JC={class:"skills-sync-header"},YC=["href"],XC={key:1,class:"skills-sync-badge"},QC={key:2,class:"skills-sync-badge"},ZC={class:"skills-sync-meta"},eA={key:0,class:"skills-sync-error"},tA={key:1,class:"skills-sync-meta"},nA={key:2,class:"skills-sync-error"},rA={key:3,class:"skills-sync-device"},sA=["href"],oA={class:"skills-sync-actions"},iA=["disabled"],aA=["disabled"],lA=["disabled"],cA=["disabled"],uA={key:1,class:"skills-hub-section"},dA={class:"skills-hub-section-title"},fA={key:0,class:"skills-hub-grid"},hA={class:"skills-hub-toolbar"},pA={class:"skills-hub-search-wrap"},mA={key:0,class:"skills-hub-count"},gA={class:"skills-hub-section"},vA={key:0,class:"skills-hub-loading"},yA={key:1,class:"skills-hub-error"},wA={key:0,class:"skills-hub-grid"},bA={key:1,class:"skills-hub-empty"},Go="codex-web-local.skills-hub.cache.v1",_A=Wt({__name:"SkillsHub",emits:["skills-changed"],setup(e,{emit:t}){const n={name:"",owner:"",description:"",url:"",installed:!1},r=O(null),s=O(""),o=O("date"),i=O([]),a=O([]),l=O(0),u=O(!1),c=O(""),f=O(!0),m=O(!1),S=O(n),D=O(null),H=O(""),ee=O(!1),A=O(!1);let R=null,B=null;const F=t,X=ie(()=>o.value==="date"?"Newest":"A-Z"),ae=ie(()=>{var W;return((W=D.value)==null?void 0:W.type)==="error"?"skills-hub-toast-error":"skills-hub-toast-success"}),ve=ie(()=>`${S.value.owner}/${S.value.name}`),ke=ie(()=>ee.value&&H.value===ve.value),ue=ie(()=>A.value&&H.value===ve.value),fe=ie(()=>{if(!oe.value.configured)return"";const W=oe.value.repoOwner.trim(),U=oe.value.repoName.trim();return!W||!U?"":`https://github.com/${encodeURIComponent(W)}/${encodeURIComponent(U)}`}),_e=ie(()=>{const W=s.value.toLowerCase().trim();return W?a.value.filter(U=>U.name.toLowerCase().includes(W)||U.owner.toLowerCase().includes(W)||(U.displayName??"").toLowerCase().includes(W)):a.value});function z(W,U="success"){D.value={text:W,type:U},B&&clearTimeout(B),B=setTimeout(()=>{D.value=null},3e3)}function Te(){o.value=o.value==="date"?"name":"date",ze(s.value)}function Ne(W){return`${o.value}::${W.trim().toLowerCase()}`}function Ue(W){var U;if(typeof window>"u")return null;try{const te=window.localStorage.getItem(Go);return te?((U=JSON.parse(te).byKey)==null?void 0:U[W])??null:null}catch{return null}}function Ae(W,U){if(!(typeof window>"u"))try{const te=window.localStorage.getItem(Go),de=(te?JSON.parse(te):{}).byKey??{};de[W]=U,window.localStorage.setItem(Go,JSON.stringify({byKey:de}))}catch{}}function $e(){if(!(typeof window>"u"))try{window.localStorage.removeItem(Go)}catch{}}function De(W){const U=W.installed??[];a.value=U;const te=new Set(U.map(se=>se.name));i.value=W.data.map(se=>{if(se.installed||te.has(se.name)){const de=U.find(Ie=>Ie.name===se.name);return{...se,installed:!0,path:(de==null?void 0:de.path)??se.path,enabled:(de==null?void 0:de.enabled)??se.enabled}}return se}).filter(se=>!se.installed),l.value=W.total}async function ze(W){const U=Ne(W),te=Ue(U);te&&De(te),u.value=!te,c.value="";try{const se=new URLSearchParams;W.trim()&&se.set("q",W.trim()),se.set("limit","100"),se.set("sort",o.value);const de=await fetch(`/codex-api/skills-hub?${se}`);if(!de.ok)throw new Error(`HTTP ${de.status}`);const Ie=await de.json();De(Ie),Ae(U,Ie)}catch(se){c.value=se instanceof Error?se.message:"Failed to load skills"}finally{u.value=!1}}function tt(){R&&clearTimeout(R),R=setTimeout(()=>ze(s.value),300)}function Oe(W){S.value=W,m.value=!0}async function Qe(W){H.value=`${W.owner}/${W.name}`,ee.value=!0;try{const te=await(await fetch("/codex-api/skills-hub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({owner:W.owner,name:W.name})})).json();if(!te.ok)throw new Error(te.error||"Install failed");const se={...W,installed:!0,path:te.path,enabled:!0};a.value=[...a.value,se],i.value=i.value.filter(de=>de.name!==W.name),S.value=se,z(`${W.displayName||W.name} skill installed`),m.value=!1,$e(),F("skills-changed")}catch(U){z(U instanceof Error?U.message:"Failed to install skill","error")}finally{ee.value=!1}}async function wt(W){H.value=`${W.owner}/${W.name}`,A.value=!0;try{const te=await(await fetch("/codex-api/skills-hub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W.name,path:W.path})})).json();if(!te.ok)throw new Error(te.error||"Uninstall failed");a.value=a.value.filter(se=>se.name!==W.name),W.owner!=="local"&&(i.value=[...i.value,{...W,installed:!1,path:void 0,enabled:void 0}]),z(`${W.displayName||W.name} skill uninstalled`),m.value=!1,$e(),F("skills-changed")}catch(U){z(U instanceof Error?U.message:"Failed to uninstall skill","error")}finally{A.value=!1}}async function ct(W,U){try{if(!(await fetch("/codex-api/rpc",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({method:"skills/config/write",params:{path:W.path,enabled:U}})})).ok)throw new Error("Failed to update skill");await fetch("/codex-api/skills-sync/push",{method:"POST"}),z(`${W.displayName||W.name} skill ${U?"enabled":"disabled"}`),await ze(s.value)}catch(te){z(te instanceof Error?te.message:"Failed to update skill","error")}}const{deviceLogin:Ze,isPullInFlight:Je,isPushInFlight:K,isStartupSyncInFlight:pe,isSyncActionInFlight:he,loadSyncStatus:Ee,logoutGithub:Se,pullSkillsSync:b,pushSkillsSync:T,startupSkillsSync:M,startGithubFirebaseLogin:q,startGithubLogin:Q,syncActionError:V,syncActionStatus:me,syncStatus:oe}=GC({showToast:z,onPulled:async()=>{await ze(s.value),F("skills-changed")}});return ar(()=>{ze(""),Ee()}),(W,U)=>(v(),E("div",qC,[U[12]||(U[12]=h("div",{class:"skills-hub-header"},[h("h2",{class:"skills-hub-title"},"Skills Hub"),h("p",{class:"skills-hub-subtitle"},"Browse and discover skills from the OpenClaw community")],-1)),h("div",KC,[h("div",JC,[U[9]||(U[9]=h("strong",null,"Skills Sync (GitHub)",-1)),be(oe).configured&&fe.value?(v(),E("a",{key:0,class:"skills-sync-badge skills-sync-badge-link",href:fe.value,target:"_blank",rel:"noopener noreferrer"}," Connected: "+le(be(oe).repoOwner)+"/"+le(be(oe).repoName),9,YC)):be(oe).loggedIn?(v(),E("span",XC,"Logged in as "+le(be(oe).githubUsername),1)):(v(),E("span",QC,"Not connected"))]),h("div",ZC,[h("span",null,"Startup: "+le(be(oe).startup.mode),1),h("span",null,"Branch: "+le(be(oe).startup.branch),1),h("span",null,"Action: "+le(be(oe).startup.lastAction),1)]),be(oe).startup.lastError?(v(),E("div",eA,le(be(oe).startup.lastError),1)):ce("",!0),be(me)?(v(),E("div",tA,[h("span",null,"Manual sync: "+le(be(me)),1)])):ce("",!0),be(V)?(v(),E("div",nA,le(be(V)),1)):ce("",!0),be(Ze)?(v(),E("div",rA,[h("span",null,[U[10]||(U[10]=po("Open ",-1)),h("a",{href:be(Ze).verification_uri,target:"_blank",rel:"noreferrer"},"GitHub device login",8,sA),U[11]||(U[11]=po(" and enter code:",-1))]),h("code",null,le(be(Ze).user_code),1)])):ce("",!0),h("div",oA,[be(oe).loggedIn?ce("",!0):(v(),E("button",{key:0,class:"skills-hub-sort",type:"button",onClick:U[0]||(U[0]=(...te)=>be(q)&&be(q)(...te))},"Login with GitHub")),be(oe).loggedIn?ce("",!0):(v(),E("button",{key:1,class:"skills-hub-sort",type:"button",onClick:U[1]||(U[1]=(...te)=>be(Q)&&be(Q)(...te))},"Device Login")),be(oe).loggedIn?(v(),E("button",{key:2,class:"skills-hub-sort",type:"button",onClick:U[2]||(U[2]=(...te)=>be(Se)&&be(Se)(...te)),disabled:be(he)},"Logout GitHub",8,iA)):ce("",!0),h("button",{class:"skills-hub-sort",type:"button",onClick:U[3]||(U[3]=(...te)=>be(M)&&be(M)(...te)),disabled:be(he)},le(be(pe)?"Syncing...":"Startup Sync"),9,aA),h("button",{class:"skills-hub-sort",type:"button",onClick:U[4]||(U[4]=(...te)=>be(b)&&be(b)(...te)),disabled:be(he)},le(be(Je)?"Pulling...":"Pull"),9,lA),be(oe).loggedIn?(v(),E("button",{key:3,class:"skills-hub-sort",type:"button",onClick:U[5]||(U[5]=(...te)=>be(T)&&be(T)(...te)),disabled:!be(oe).configured||be(he)},le(be(K)?"Pushing...":"Push"),9,cA)):ce("",!0)])]),D.value?(v(),E("div",{key:0,class:st(["skills-hub-toast",ae.value])},le(D.value.text),3)):ce("",!0),_e.value.length>0?(v(),E("div",uA,[h("button",{class:"skills-hub-section-toggle",type:"button",onClick:U[6]||(U[6]=te=>f.value=!f.value)},[h("span",dA,"Installed ("+le(_e.value.length)+")",1),Pe(jf,{class:st(["skills-hub-section-chevron",{"is-open":f.value}])},null,8,["class"])]),f.value?(v(),E("div",fA,[(v(!0),E(Ve,null,_t(_e.value,te=>(v(),dt(bu,{key:te.name,skill:te,onSelect:se=>Oe(se)},null,8,["skill","onSelect"]))),128))])):ce("",!0)])):ce("",!0),h("div",hA,[h("div",pA,[Pe(Za,{class:"skills-hub-search-icon"}),Tr(h("input",{ref_key:"searchRef",ref:r,"onUpdate:modelValue":U[7]||(U[7]=te=>s.value=te),class:"skills-hub-search",type:"text",placeholder:"Search skills... (e.g. flight, docker, react)",onInput:tt},null,544),[[Sr,s.value]]),l.value>0?(v(),E("span",mA,le(l.value)+" skills",1)):ce("",!0)]),h("button",{class:"skills-hub-sort",type:"button",onClick:Te},le(X.value),1)]),h("div",gA,[u.value?(v(),E("div",vA,"Loading skills...")):c.value?(v(),E("div",yA,le(c.value),1)):(v(),E(Ve,{key:2},[i.value.length>0?(v(),E("div",wA,[(v(!0),E(Ve,null,_t(i.value,te=>(v(),dt(bu,{key:te.url,skill:te,onSelect:se=>Oe(se)},null,8,["skill","onSelect"]))),128))])):s.value.trim()?(v(),E("div",bA,'No skills found for "'+le(s.value)+'"',1)):ce("",!0)],64))]),Pe(cS,{skill:S.value,visible:m.value,"is-installing":ke.value,"is-uninstalling":ue.value,onClose:U[8]||(U[8]=te=>m.value=!1),onInstall:Qe,onUninstall:wt,onToggleEnabled:ct},null,8,["skill","visible","is-installing","is-uninstalling"])]))}}),kA=lt(_A,[["__scopeId","data-v-b7db90c3"]]),TA={},SA={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 IA(e,t){return v(),E("svg",SA,[...t[0]||(t[0]=[h("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),h("path",{d:"M9 4l0 16"},null,-1)])])}const EA=lt(TA,[["render",IA]]),CA={},AA={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true"};function xA(e,t){return v(),E("svg",AA,[...t[0]||(t[0]=[h("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 RA=lt(CA,[["render",xA]]),PA={class:"sidebar-thread-controls"},MA=["aria-label","title"],$A=Wt({__name:"SidebarThreadControls",props:{isSidebarCollapsed:{type:Boolean},showNewThreadButton:{type:Boolean}},emits:["toggle-sidebar","start-new-thread"],setup(e){return(t,n)=>(v(),E("div",PA,[h("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?(v(),dt(RA,{key:0,class:"sidebar-thread-controls-icon"})):(v(),dt(EA,{key:1,class:"sidebar-thread-controls-icon"}))],8,MA),rr(t.$slots,"default",{},void 0),e.showNewThreadButton?(v(),E("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"))},[Pe(mi,{class:"sidebar-thread-controls-icon"})])):ce("",!0)]))}}),Ku=lt($A,[["__scopeId","data-v-46a10052"]]),OA={},NA={xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 24 24"};function DA(e,t){return v(),E("svg",NA,[...t[0]||(t[0]=[h("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[h("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"}),h("path",{d:"M9 12a3 3 0 1 0 6 0a3 3 0 0 0-6 0"})],-1)])])}const LA=lt(OA,[["render",DA]]);function hr(e){return e.flatMap(t=>t.threads)}const $h="codex-web-local.thread-read-state.v1",Oh="codex-web-local.thread-scroll-state.v1",ll="codex-web-local.selected-thread-id.v1",cl="codex-web-local.selected-model-id.v1",Nh="codex-web-local.project-order.v1",Dh="codex-web-local.project-display-name.v1",Aa=220,jA=500,Ju=["none","minimal","low","medium","high","xhigh"],Js="__global__",Ln="gpt-5.2-codex",UA="Auto-commit from Codex rollback chat turn";function FA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem($h);if(!e)return{};const t=JSON.parse(e);return!t||typeof t!="object"||Array.isArray(t)?{}:t}catch{return{}}}function Yu(e){typeof window>"u"||window.localStorage.setItem($h,JSON.stringify(e))}function ul(e,t,n){return Math.min(Math.max(e,t),n)}function BA(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=ul(t.scrollRatio,0,1)),n}function HA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Oh);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=BA(s);o&&(n[r]=o)}return n}catch{return{}}}function Xu(e){typeof window>"u"||window.localStorage.setItem(Oh,JSON.stringify(e))}function WA(){return typeof window>"u"?"":window.localStorage.getItem(ll)??""}function VA(e){if(!(typeof window>"u")){if(!e){window.localStorage.removeItem(ll);return}window.localStorage.setItem(ll,e)}}function zA(){var e;return typeof window>"u"?"":((e=window.localStorage.getItem(cl))==null?void 0:e.trim())??""}function xa(e){if(typeof window>"u")return;const t=e.trim();if(!t){window.localStorage.removeItem(cl);return}window.localStorage.setItem(cl,t)}function GA(){if(typeof window>"u")return[];try{const e=window.localStorage.getItem(Nh);if(!e)return[];const t=JSON.parse(e);if(!Array.isArray(t))return[];const n=[];for(const r of t){if(typeof r!="string"||r.length===0)continue;const s=Eo(r);s.length>0&&!n.includes(s)&&n.push(s)}return n}catch{return[]}}function ms(e){typeof window>"u"||window.localStorage.setItem(Nh,JSON.stringify(e))}function qA(){if(typeof window>"u")return{};try{const e=window.localStorage.getItem(Dh);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)){const o=typeof r=="string"?Eo(r):"";o.length>0&&typeof s=="string"&&(n[o]=s)}return n}catch{return{}}}function Ra(e){typeof window>"u"||window.localStorage.setItem(Dh,JSON.stringify(e))}function qo(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 rs(e,n)?e:n}function Pa(e,t){const n=new Map(e.map(s=>[s.projectName,s])),r=t.map(s=>n.get(s)??null).filter(s=>s!==null&&s.threads.length>0);for(const s of e)t.includes(s.projectName)||r.push(s);return r}function rs(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 KA(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 JA(e,t){return!e&&!t?!0:!e||!t?!1:e.status===t.status&&e.aggregatedOutput===t.aggregatedOutput&&e.exitCode===t.exitCode}function Ko(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 dl(e,t){return e.id===t.id&&e.role===t.role&&e.text===t.text&&rs(e.images,t.images)&&e.messageType===t.messageType&&e.rawPayload===t.rawPayload&&e.isUnhandled===t.isUnhandled&&JA(e.commandExecution,t.commandExecution)&&e.turnIndex===t.turnIndex}function ki(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 YA(e,t,n={}){const r=new Map(e.map(c=>[c.id,c])),s=new Map(t.map(c=>[c.id,c])),o=t.map(c=>{const f=r.get(c.id);return f&&dl(f,c)?f:c});if(n.preserveMissing!==!0)return ki(e,o)?e:o;const i=e.map(c=>{const f=s.get(c.id);return!f||dl(c,f)?c:f}),a=new Set(e.map(c=>c.id)),l=o.filter(c=>!a.has(c.id)),u=[...i,...l];return ki(e,u)?e:u}function fl(e){return e.replace(/\s+/gu," ").trim()}function XA(e,t){const n=new Set(t.filter(s=>s.role==="assistant").map(s=>fl(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=fl(s.text);return o.length===0?!1:!n.has(o)});return r.length===e.length?e:r}function Qu(e,t){const n=e.findIndex(o=>o.id===t.id);if(n<0)return[...e,t];const r=e[n];if(dl(r,t))return e;const s=[...e];return s.splice(n,1,t),s}const Lh="worked";function Mr(e){if(!e)return null;const t=new Date(e).getTime();return Number.isNaN(t)?null:t}function QA(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 ZA(e,t){return!e&&!t?!0:!e||!t?!1:e.turnId===t.turnId&&e.durationMs===t.durationMs}function e1(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 t1(e){return{id:`turn-summary:${e.turnId}`,role:"system",text:`Worked for ${QA(e.durationMs)}`,messageType:Lh}}function n1(e){for(let t=e.length-1;t>=0;t-=1)if(e[t].role==="assistant")return t;return-1}function r1(e,t){const n=t1(t),r=e.filter(i=>i.messageType!==Lh),s=n1(r);if(s<0)return[...r,n];const o=[...r];return o.splice(s,0,n),o}function Jt(e,t){if(!(t in e))return e;const n={...e};return delete n[t],n}function s1(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 o1(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 i1(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(e[n]!==t[n])return!1;return!0}function rn(e,t){const n=Object.entries(e).filter(([r])=>t.has(r));return n.length===Object.keys(e).length?e:Object.fromEntries(n)}function Jo(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 u=i.get(l.id);return u&&s1(u,l)?u:l});return o&&o.projectName===s.projectName&&o1(o.threads,a)?o:{projectName:s.projectName,threads:a}});return i1(e,r)?e:r}function a1(e,t,n){const r=new Set(hr(t).map(a=>a.id)),s=hr(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 u=i.findIndex(c=>c.projectName===a.projectName);u>=0&&(i[u]={projectName:i[u].projectName,threads:[a,...i[u].threads]});continue}i.push({projectName:a.projectName,threads:[a]})}return i}function Ma(e){return Eo(e)}function l1(e){const t=e.split(`
|
|
1422
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.slice(0,80):"Untitled thread"}function c1(){const e=O([]),t=O([]),n=O(WA()),r=O({}),s=O({}),o=O({}),i=O({}),a=O({}),l=O({}),u=O({}),c=O({}),f=O([]),m=O(zA()),S=O("medium"),D=O("standard"),H=O(FA()),ee=O(HA()),A=O(GA()),R=O(qA()),B=O({}),F=O({}),X=O({}),ae=O({}),ve=O({}),ke=O({}),ue=O({}),fe=O({}),_e=O({}),z=O({}),Te=O([]),Ne=O([]),Ue=O(!1),Ae=O(!1),$e=O(!1),De=O(!1),ze=O(!1),tt=O(!1),Oe=O(""),Qe=O(!1),wt=O(!1);let ct=null,Ze=null,Je=null,K=null,pe=!1;const he=new Set;let Ee=!1,Se=!1;const b=new Map,T=new Set,M=O(!0),q=ie(()=>hr(e.value)),Q=ie(()=>q.value.find(d=>d.id===n.value)??null),V=ie(()=>ee.value[n.value]??null),me=ie(()=>{const d=[],p=n.value;return p&&Array.isArray(fe.value[p])&&d.push(...fe.value[p]),Array.isArray(fe.value[Js])&&d.push(...fe.value[Js]),d.sort((g,P)=>g.receivedAtIso.localeCompare(P.receivedAtIso))}),oe=ie(()=>{var Y;const d=n.value;if(!d)return null;const p=ve.value[d],g=(o.value[d]??"").trim(),P=(((Y=ke.value[d])==null?void 0:Y.message)??"").trim();return!p&&!g&&!P?null:{activityLabel:(p==null?void 0:p.label)||"Thinking",activityDetails:(p==null?void 0:p.details)??[],reasoningText:g,errorText:P}}),W=ie(()=>{const d=n.value;if(!d)return[];const p=r.value[d]??[],g=s.value[d]??[],P=i.value[d]??[],Y=[...p,...P,...g],ne=ae.value[d];return ne?r1(Y,ne):Y});function U(d){n.value!==d&&(n.value=d,VA(d),Se=!1)}function te(d){m.value=d.trim(),xa(m.value)}function se(d){M.value=d}async function de(){m.value=Ln,xa(m.value),f.value.includes(Ln)||(f.value=[...f.value,Ln]);try{await Q_(Ln)}catch{}}function Ie(d,p){_e.value={..._e.value,[d]:p}}function We(d){_e.value[d]&&(_e.value=Jt(_e.value,d))}async function Fe(d,p){if(!M.value)return;const g=p.trim();if(!g)return;const P=q.value.find(ne=>ne.id===d);if(!P)return;const Y=P.cwd.trim();Y&&(await ok(Y,g),pe=!0)}async function Me(d,p){var Ce;if(!M.value)return;const g=q.value.find(we=>we.id===d);if(!g)return;const P=g.cwd.trim();if(!P)return;const ne=(r.value[d]??[]).find(we=>we.role==="user"&&we.turnIndex===p),ge=((Ce=ne==null?void 0:ne.text)==null?void 0:Ce.trim())??"";if(ge){try{await ik(P,ge)}catch(we){if((we instanceof Error?we.message:"").includes("No matching commit found"))return;throw we}pe=!0}}async function Ye(d){if(T.has(d))return;const p=_e.value[d];if(!(!p||p.fallbackRetried)){T.add(d),Ie(d,{...p,fallbackRetried:!0});try{await de();try{const g=await hu(d,1);At(d,g),Gt(d,[]),Yt(d),i.value[d]&&(i.value=Jt(i.value,d))}catch{}It(d,null),Oe.value="",zt(d,null),kt(d,{label:"Thinking",details:ft(Ln,p.effort)}),Mt(d,!0),X.value[d]!==!0&&await ya(d),await wa(d,p.text,p.imageUrls,Ln,p.effort||void 0,p.skills.length>0?p.skills:void 0,p.fileAttachments),X.value={...X.value,[d]:!0},pt(),he.add(d),pe=!0,await lr()}catch(g){const P=g instanceof Error?g.message:"Unknown application error";It(d,P),Oe.value=P,Mt(d,!1),kt(d,null)}finally{T.delete(d)}}}function et(d){d&&!Ju.includes(d)||(S.value=d)}async function xt(d){const p=d==="fast"?"fast":"standard";if(ze.value||D.value===p)return;const g=D.value;D.value=p,ze.value=!0,Oe.value="";try{await Z_(p)}catch(P){D.value=g,Oe.value=P instanceof Error?P.message:"Failed to update Fast mode"}finally{ze.value=!1}}function ft(d,p){const g=d.trim()||"default",P=p||"default",Y=D.value==="fast"?"Fast":"Standard";return[`Model: ${g}`,`Thinking: ${P}`,`Speed: ${Y}`]}async function Ct(){try{const[d,p]=await Promise.all([ek(),tk()]);f.value=d,m.value.length>0&&d.includes(m.value)||(p.model&&d.includes(p.model)?m.value=p.model:d.length>0?m.value=d[0]:m.value="",xa(m.value)),p.reasoningEffort&&Ju.includes(p.reasoningEffort)&&(S.value=p.reasoningEffort),D.value=p.speedMode}catch{}}async function Lt(){if(K){await K;return}K=(async()=>{try{Ne.value=Kt(await nk())}catch{}finally{K=null}})(),await K}function pt(){if(typeof window>"u"){Lt();return}Je!==null&&window.clearTimeout(Je),Je=window.setTimeout(()=>{Je=null,Lt()},jA)}function Pt(d){const p=z.value;return Object.keys(p).length===0?d:d.map(g=>({projectName:g.projectName,threads:g.threads.map(P=>{const Y=p[P.id];return Y?{...P,title:Y}:P})}))}function mt(){const p=Pt(t.value).map(g=>({projectName:g.projectName,threads:g.threads.map(P=>{const Y=a.value[P.id]===!0,ne=n.value===P.id,ge=H.value[P.id],Ce=c.value[P.id]===!0,we=!ne&&!Y&&(Ce||ge!==P.updatedAtIso);return{...P,inProgress:Y,unread:we}})}));e.value=Jo(e.value,p)}function Vt(d,p,g){const P=new Date().toISOString(),Y=Rn(p),ne=Eo(Y),ge={id:d,title:l1(g),projectName:ne,cwd:Y,hasWorktree:Y.includes("/.codex/worktrees/")||Y.includes("/.git/worktrees/"),createdAtIso:P,updatedAtIso:P,preview:g,unread:!1,inProgress:!1},Ce=t.value.findIndex(ot=>ot.projectName===ne);if(Ce>=0){const it=t.value[Ce].threads.filter(Kn=>Kn.id!==d),nn={projectName:ne,threads:[ge,...it]},An=[...t.value];An.splice(Ce,1,nn),t.value=An}else t.value=[{projectName:ne,threads:[ge]},...t.value];const we=qo(A.value,t.value);rs(A.value,we)||(A.value=we,ms(A.value)),mt()}function nt(d){const p=new Set(d.map(ne=>ne.id)),g=rn(H.value,p);g!==H.value&&(H.value=g,Yu(g));const P=rn(ee.value,p);P!==ee.value&&(ee.value=P,Xu(P)),F.value=rn(F.value,p),B.value=rn(B.value,p),X.value=rn(X.value,p),r.value=rn(r.value,p),s.value=rn(s.value,p),o.value=rn(o.value,p),i.value=rn(i.value,p),ae.value=rn(ae.value,p),ve.value=rn(ve.value,p),ke.value=rn(ke.value,p),ue.value=rn(ue.value,p),c.value=rn(c.value,p),a.value=rn(a.value,p);const Y={};for(const[ne,ge]of Object.entries(fe.value))(ne===Js||p.has(ne))&&(Y[ne]=ge);fe.value=Y}function bn(d){const p=hr(t.value).find(g=>g.id===d);p&&(H.value={...H.value,[d]:p.updatedAtIso},Yu(H.value),c.value[d]&&(c.value=Jt(c.value,d)),mt())}function zt(d,p){if(!d)return;const g=ae.value[d];if(p){if(ZA(g,p))return;ae.value={...ae.value,[d]:p}}else g&&(ae.value=Jt(ae.value,d))}function Mt(d,p){!d||a.value[d]===!0===p||(p?a.value={...a.value,[d]:!0}:a.value=Jt(a.value,d),mt())}function un(d){d&&d!==n.value&&c.value[d]!==!0&&(c.value={...c.value,[d]:!0},mt())}function kt(d,p){if(!d)return;const g=ve.value[d];if(!p){g&&(ve.value=Jt(ve.value,d));return}const P=Cn(p.label)||"Thinking",Y=p.details.map(Ce=>Cn(Ce)).filter(Ce=>Ce.length>0&&Ce!==P),ne=Array.from(new Set([...(g==null?void 0:g.details)??[],...Y])).slice(-3),ge={label:P,details:ne};e1(g,ge)||(ve.value={...ve.value,[d]:ge})}function It(d,p){if(!d)return;const g=ke.value[d],P=p?fl(p):"";if(!P){g&&(ke.value=Jt(ke.value,d));return}(g==null?void 0:g.message)!==P&&(ke.value={...ke.value,[d]:{message:P}})}function en(d){const p=hr(t.value).find(g=>g.id===d);return(p==null?void 0:p.updatedAtIso)??""}function jt(d,p){if(!d)return;const g={scrollTop:Math.max(0,p.scrollTop),isAtBottom:p.isAtBottom===!0};typeof p.scrollRatio=="number"&&Number.isFinite(p.scrollRatio)&&(g.scrollRatio=ul(p.scrollRatio,0,1));const P=ee.value[d];P&&P.scrollTop===g.scrollTop&&P.isAtBottom===g.isAtBottom&&P.scrollRatio===g.scrollRatio||(ee.value={...ee.value,[d]:g},Xu(ee.value))}function At(d,p){const g=r.value[d]??[];ki(g,p)||(r.value={...r.value,[d]:p})}function Gt(d,p){const g=s.value[d]??[];ki(g,p)||(s.value={...s.value,[d]:p})}function In(d,p){const g=s.value[d]??[],P=Qu(g,p);Gt(d,P)}function $t(d,p){if(!d)return;const g=p.trim(),P=o.value[d]??"";if(g.length===0){if(!P)return;o.value=Jt(o.value,d);return}P!==g&&(o.value={...o.value,[d]:g})}function En(d,p){if(!d)return;const g=o.value[d]??"";$t(d,`${g}${p}`)}function Yt(d){d&&d in o.value&&(o.value=Jt(o.value,d))}function He(d){return d!==null&&typeof d=="object"&&!Array.isArray(d)?d:null}function Le(d){return typeof d=="string"?d:""}function qt(d){return typeof d=="number"&&Number.isFinite(d)?d:null}function dn(d){var p,g;return((p=d.limitId)==null?void 0:p.trim())||((g=d.limitName)==null?void 0:g.trim())||"__default__"}function Pn(d){const p=He(d);return p?{usedPercent:ul(qt(p.usedPercent)??0,0,100),windowDurationMins:qt(p.windowDurationMins),resetsAt:qt(p.resetsAt)}:null}function _n(d){const p=He(d);if(!p)return null;const g=He(p.credits);return{limitId:Le(p.limitId)||null,limitName:Le(p.limitName)||null,primary:Pn(p.primary),secondary:Pn(p.secondary),credits:g?{hasCredits:g.hasCredits===!0,unlimited:g.unlimited===!0,balance:Le(g.balance)||null}:null,planType:Le(p.planType)||null}}function Kt(d){const p=He(d);if(!p)return[];const g=[],P=new Set,Y=ge=>{if(!ge)return;const Ce=dn(ge);P.has(Ce)||(P.add(Ce),g.push(ge))};Y(_n(p.rateLimits));const ne=He(p.rateLimitsByLimitId);if(ne)for(const ge of Object.values(ne))Y(_n(ge));return g}function Ut(d){const p=He(d.params);if(!p)return"";const g=Le(p.threadId);if(g)return g;const P=Le(p.thread_id);if(P)return P;const Y=Le(p.conversationId);if(Y)return Y;const ne=Le(p.conversation_id);if(ne)return ne;const ge=He(p.thread),Ce=Le(ge==null?void 0:ge.id);if(Ce)return Ce;const we=He(p.turn),ot=Le(we==null?void 0:we.threadId);if(ot)return ot;const it=Le(we==null?void 0:we.thread_id);return it||""}function tn(d){if(d.method!=="turn/completed")return"";const p=He(d.params),g=He(p==null?void 0:p.turn);if(!g||g.status!=="failed")return"";const P=He(g.error);return Le(P==null?void 0:P.message)}function fn(d){var g;if(d.method!=="error")return"";const p=He(d.params);return Le(p==null?void 0:p.message)||Le((g=He(p==null?void 0:p.error))==null?void 0:g.message)}function Un(d){const p=He(d);if(!p)return null;const g=p.id,P=Le(p.method),Y=p.params;if(typeof g!="number"||!Number.isInteger(g)||!P)return null;const ne=He(Y),ge=Le(ne==null?void 0:ne.threadId)||Js,Ce=Le(ne==null?void 0:ne.turnId),we=Le(ne==null?void 0:ne.itemId),ot=Le(p.receivedAtIso)||new Date().toISOString();return{id:g,method:P,threadId:ge,turnId:Ce,itemId:we,receivedAtIso:ot,params:Y??null}}function Mn(d){const p=d.threadId||Js,g=fe.value[p]??[],P=g.findIndex(ne=>ne.id===d.id),Y=[...g];P>=0?Y.splice(P,1,d):Y.push(d),fe.value={...fe.value,[p]:Y.sort((ne,ge)=>ne.receivedAtIso.localeCompare(ge.receivedAtIso))}}function $n(d){const p={};for(const[g,P]of Object.entries(fe.value)){const Y=P.filter(ne=>ne.id!==d);Y.length>0&&(p[g]=Y)}fe.value=p}function kn(d){if(d.method==="server/request"){const p=Un(d.params);return p&&Mn(p),!0}if(d.method==="server/request/resolved"){const p=He(d.params),g=p==null?void 0:p.id;return typeof g=="number"&&Number.isInteger(g)&&$n(g),!0}return!1}function Cn(d){return d.replace(/\s+/gu," ").trim()}function On(d){const p=Ut(d);if(!p)return null;if(d.method==="turn/started")return{threadId:p,activity:{label:"Thinking",details:[]}};if(d.method==="item/started"){const g=He(d.params),P=He(g==null?void 0:g.item),Y=Le(P==null?void 0:P.type).toLowerCase();if(Y==="reasoning")return{threadId:p,activity:{label:"Thinking",details:[]}};if(Y==="agentmessage")return{threadId:p,activity:{label:"Writing response",details:[]}};if(Y==="commandexecution"){const ne=Le(P==null?void 0:P.command);return{threadId:p,activity:{label:"Running command",details:ne?[ne]:[]}}}}return d.method==="item/commandExecution/outputDelta"?{threadId:p,activity:{label:"Running command",details:[]}}:d.method==="item/reasoning/summaryTextDelta"||d.method==="item/reasoning/summaryPartAdded"?{threadId:p,activity:{label:"Thinking",details:[]}}:d.method==="item/agentMessage/delta"?{threadId:p,activity:{label:"Writing response",details:[]}}:null}function w(d){if(d.method!=="turn/started")return null;const p=He(d.params);if(!p)return null;const g=Ut(d);if(!g)return null;const P=He(p.turn),Y=Le(P==null?void 0:P.id)||Le(p.turnId)||`${g}:unknown`;if(!Y)return null;const ne=Mr(Le(P==null?void 0:P.startedAt))??Mr(Le(p.startedAt))??Mr(d.atIso)??Date.now();return{threadId:g,turnId:Y,startedAtMs:ne}}function I(d){if(d.method!=="turn/completed")return null;const p=He(d.params);if(!p)return null;const g=Ut(d);if(!g)return null;const P=He(p.turn),Y=Le(P==null?void 0:P.id)||Le(p.turnId)||`${g}:unknown`;if(!Y)return null;const ne=Mr(Le(P==null?void 0:P.completedAt))??Mr(Le(p.completedAt))??Mr(d.atIso)??Date.now(),ge=Mr(Le(P==null?void 0:P.startedAt))??Mr(Le(p.startedAt))??void 0;return{threadId:g,turnId:Y,completedAtMs:ne,startedAtMs:ge}}function x(d){return`${d}:live-reasoning`}function G(d){const p=He(d.params);if(!p)return"";if(d.method==="item/started"){const g=He(p.item);return!g||g.type!=="reasoning"?"":Le(g.id)}return""}function y(d){const p=He(d.params);if(!p)return null;if(d.method==="item/reasoning/summaryTextDelta"){const g=Le(p.itemId),P=Le(p.delta);return!g||!P?null:{messageId:x(g),delta:P}}return null}function C(d){const p=He(d.params);if(!p)return"";if(d.method==="item/reasoning/summaryPartAdded"){const g=Le(p.itemId);return g?x(g):""}return""}function L(d){const p=He(d.params);if(!p)return"";if(d.method==="item/completed"){const g=He(p.item);return!g||g.type!=="reasoning"?"":x(Le(g.id))}return""}function Z(d){const p=He(d.params);if(!p)return"";if(d.method==="item/started"){const g=He(p.item);return!g||g.type!=="agentMessage"?"":Le(g.id)}return""}function xe(d){const p=He(d.params);if(!p)return null;if(d.method==="item/agentMessage/delta"){const g=Le(p.itemId),P=Le(p.delta);return!g||!P?null:{messageId:g,delta:P}}return null}function Xe(d){const p=He(d.params);if(!p)return null;if(d.method==="item/completed"){const g=He(p.item);if(!g||g.type!=="agentMessage")return null;const P=Le(g.id),Y=Le(g.text);return!P||!Y?null:{id:P,role:"assistant",text:Y,messageType:"agentMessage.live"}}return null}function ut(d){if(d.method!=="item/started")return null;const p=He(d.params),g=He(p==null?void 0:p.item);if(!g||g.type!=="commandExecution")return null;const P=Le(g.id),Y=Le(g.command);if(!P)return null;const ne=typeof g.cwd=="string"?g.cwd:null;return{id:P,role:"system",text:Y,messageType:"commandExecution",commandExecution:{command:Y,cwd:ne,status:"inProgress",aggregatedOutput:"",exitCode:null}}}function Rt(d){if(d.method!=="item/commandExecution/outputDelta")return null;const p=He(d.params);if(!p)return null;const g=Le(p.itemId),P=Le(p.delta);return!g||!P?null:{itemId:g,delta:P}}function k(d){if(d.method!=="item/completed")return null;const p=He(d.params),g=He(p==null?void 0:p.item);if(!g||g.type!=="commandExecution")return null;const P=Le(g.id),Y=Le(g.command);if(!P)return null;const ne=typeof g.cwd=="string"?g.cwd:null,ge=Le(g.status),Ce=ge==="failed"?"failed":ge==="declined"?"declined":ge==="interrupted"?"interrupted":"completed",we=typeof g.aggregatedOutput=="string"?g.aggregatedOutput:"",ot=typeof g.exitCode=="number"?g.exitCode:null;return{id:P,role:"system",text:Y,messageType:"commandExecution",commandExecution:{command:Y,cwd:ne,status:Ce,aggregatedOutput:we,exitCode:ot}}}function $(d,p){const g=i.value[d]??[],P=Qu(g,p);P!==g&&(i.value={...i.value,[d]:P})}function N(d,p){const g=i.value[d];if(!g||g.length===0)return;const P=new Set(p.map(ne=>ne.id)),Y=g.filter(ne=>!P.has(ne.id));Y.length!==g.length&&(Y.length===0?i.value=Jt(i.value,d):i.value={...i.value,[d]:Y})}function J(d){if(d.method==="item/agentMessage/delta")return!0;const p=He(d.params);if(!p)return!1;if(d.method==="item/completed"){const g=He(p.item);return(g==null?void 0:g.type)==="agentMessage"}return!1}function je(d){var Ws,Fo,_,j,re;if(kn(d))return;if(d.method==="account/rateLimits/updated"&&pt(),d.method==="thread/name/updated"){const ye=He(d.params),Be=Le(ye==null?void 0:ye.threadId),Re=Le(ye==null?void 0:ye.threadName);Be&&Re&&(z.value={...z.value,[Be]:Re},mt(),ba(Be,Re))}const p=On(d);p&&kt(p.threadId,p.activity);const g=w(d);g&&(b.set(g.turnId,g),ue.value={...ue.value,[g.threadId]:g.turnId},zt(g.threadId,null),It(g.threadId,null),Mt(g.threadId,!0),c.value[g.threadId]&&(c.value=Jt(c.value,g.threadId)));const P=I(d),Y=tn(d),ge=!!((P==null?void 0:P.threadId)??Ut(d))&&!!Y&&m.value!==Ln&&Ko(new Error(Y));if(P){const ye=_e.value[P.threadId],Be=b.get(P.turnId);Be&&b.delete(P.turnId);const Re=qt((Ws=He(d.params))==null?void 0:Ws.durationMs)??qt((_=He((Fo=He(d.params))==null?void 0:Fo.turn))==null?void 0:_.durationMs)??(typeof P.startedAtMs=="number"?P.completedAtMs-P.startedAtMs:null)??(Be?P.completedAtMs-Be.startedAtMs:null),Nt=typeof Re=="number"?Math.max(0,Re):0;if(zt(P.threadId,{turnId:P.turnId,durationMs:Nt}),ue.value[P.threadId]&&(ue.value=Jt(ue.value,P.threadId)),Mt(P.threadId,!1),kt(P.threadId,null),un(P.threadId),ge||(We(P.threadId),Oo(P.threadId)),!Y&&!ge){const qr=((j=ye==null?void 0:ye.text)==null?void 0:j.trim())||UA;Fe(P.threadId,qr).catch(()=>{})}}if(Y){const ye=(P==null?void 0:P.threadId)||Ut(d);ye&&It(ye,Y),Oe.value=Y,ye&&ge&&Ye(ye)}else P&&It(P.threadId,null);const Ce=fn(d);if(Ce){const ye=Ut(d);ye&&It(ye,Ce),Oe.value=Ce,m.value!==Ln&&Ko(new Error(Ce))&&(ye?Ye(ye):de())}const we=Ut(d);if(!we||we!==n.value)return;Z(d);const ot=xe(d);if(ot){const ye=(s.value[we]??[]).find(Re=>Re.id===ot.messageId),Be=`${(ye==null?void 0:ye.text)??""}${ot.delta}`;In(we,{id:ot.messageId,role:"assistant",text:Be,messageType:"agentMessage.live"})}const it=Xe(d);it&&In(we,it),G(d);const nn=y(d);if(nn&&En(we,nn.delta),C(d)){const ye=o.value[we]??"";ye.trim().length>0&&!ye.endsWith(`
|
|
1423
|
+
|
|
1424
|
+
`)&&$t(we,`${ye}
|
|
1425
|
+
|
|
1426
|
+
`)}L(d);const Kn=ut(d);Kn&&($(we,Kn),kt(we,{label:"Running command",details:[((re=Kn.commandExecution)==null?void 0:re.command)??""]}));const Hs=Rt(d);if(Hs){const ye=(i.value[we]??[]).find(Be=>Be.id===Hs.itemId);ye!=null&&ye.commandExecution&&$(we,{...ye,commandExecution:{...ye.commandExecution,aggregatedOutput:`${ye.commandExecution.aggregatedOutput}${Hs.delta}`}})}const Uo=k(d);if(Uo&&$(we,Uo),J(d)&&(Se&&n.value&&jt(n.value,{scrollTop:0,isAtBottom:!0,scrollRatio:1}),Yt(we)),d.method==="turn/completed"){Se=!1,Yt(we),i.value[we]&&(i.value=Jt(i.value,we));const ye=Ut(d);ye&&(Mt(ye,!1),kt(ye,null),un(ye),ge||(We(ye),Oo(ye)))}}function Ft(d){const p=Ut(d);p&&he.add(p);const g=d.method;(g.startsWith("thread/")||g.startsWith("turn/")||g.startsWith("item/"))&&(pe=!0),!(Ze!==null||typeof window>"u")&&(Ze=window.setTimeout(()=>{Ze=null,lr()},Aa))}async function Tn(d){if(!Ee){Ee=!0;try{const p=await Qa(),g=[];for(const P of p.order){const Y=Ma(P);g.includes(Y)||g.push(Y)}if(g.length>0){const P=qo(g,d);rs(A.value,P)||(A.value=P,ms(A.value))}if(Object.keys(p.labels).length>0){const P={...R.value};let Y=!1;for(const[ne,ge]of Object.entries(p.labels)){const Ce=Ma(ne);P[Ce]!==ge&&(P[Ce]=ge,Y=!0)}Y&&(R.value=P,Ra(P))}}catch{}}}async function ds(){if(!(Object.keys(z.value).length>0))try{const d=await mk();Object.keys(d.titles).length>0&&(z.value=d.titles)}catch{}}async function fs(d,p,g){if(z.value[d])return;const P=p.trim();if(!P)return;const Y=P.length>300?P.slice(0,300):P;try{const ne=await gk(Y,g);if(!ne||z.value[d])return;z.value={...z.value,[d]:ne},mt(),ba(d,ne)}catch{}}async function hn(){var d;wt.value||(Ue.value=!0);try{const[p]=await Promise.all([H_(),ds()]);await Tn(p);const g=qo(A.value,p);rs(A.value,g)||(A.value=g,ms(A.value));const P=Pa(p,A.value),Y=a1(t.value,P,a.value);t.value=Jo(t.value,Y),a.value=rn(a.value,new Set(hr(t.value).map(Ce=>Ce.id))),mt(),wt.value=!0;const ne=hr(e.value);nt(ne),ne.some(Ce=>Ce.id===n.value)||U(((d=ne[0])==null?void 0:d.id)??"")}finally{Ue.value=!1}}async function Nn(d,p={}){if(!d)return;const g=F.value[d]===!0,P=p.silent!==!0&&!g;P&&(Ae.value=!0);try{X.value[d]!==!0&&(await ya(d),X.value={...X.value,[d]:!0});const{messages:Y,inProgress:ne}=await W_(d),ge=r.value[d]??[],Ce=YA(ge,Y,{preserveMissing:p.silent===!0});At(d,Ce);const we=s.value[d]??[],ot=XA(we,Y);Gt(d,ot),N(d,Y),F.value={...F.value,[d]:!0};const it=en(d);it&&(B.value={...B.value,[d]:it}),Mt(d,ne),bn(d)}finally{P&&(Ae.value=!1)}}async function Vr(){try{const d=t.value.flatMap(p=>p.threads.map(g=>g.cwd)).filter(Boolean);Te.value=await vk(d.length>0?[...new Set(d)]:void 0)}catch{}}async function js(){Oe.value="";try{await hn(),await Promise.all([Ct(),Lt(),Vr()]),await Nn(n.value)}catch(d){Oe.value=d instanceof Error?d.message:"Unknown application error"}}async function Wi(d){U(d);try{await Nn(d)}catch(p){Oe.value=p instanceof Error?p.message:"Unknown application error"}}async function Vi(d){try{await q_(d),await hn(),n.value===d&&await Nn(n.value)}catch(p){Oe.value=p instanceof Error?p.message:"Unknown application error"}}async function zi(d,p){const g=p.trim();if(!(!d||!g))try{await K_(d,g),z.value={...z.value,[d]:g},mt(),ba(d,g)}catch(P){Oe.value=P instanceof Error?P.message:"Unknown application error"}}async function Gi(d){var ge,Ce;const p=d.trim();if(!p)return"";const g=hr(t.value).find(we=>we.id===p),P=((ge=g==null?void 0:g.cwd)==null?void 0:ge.trim())??"",Y=((Ce=g==null?void 0:g.title)==null?void 0:Ce.trim())??"Forked chat",ne=m.value.trim();Oe.value="";try{const we=await J_(p,P||void 0,ne||void 0);return we?(Vt(we,P,Y),X.value={...X.value,[we]:!0},U(we),await hn(),await Nn(we),we):""}catch(we){return Oe.value=we instanceof Error?we.message:"Unknown application error",""}}async function $o(d,p=[],g=[],P="steer",Y=[],ne){if(ze.value)return;const ge=n.value,Ce=d.trim();if(!ge||!Ce&&p.length===0&&Y.length===0)return;const we=a.value[ge]===!0;if(we&&P==="queue"){const ot=l.value[ge]??[],it=`q-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,nn=[...ot],An=typeof ne=="number"?Math.max(0,Math.min(ne,nn.length)):nn.length;nn.splice(An,0,{id:it,text:Ce,imageUrls:p,skills:g,fileAttachments:Y}),l.value={...l.value,[ge]:nn};return}if(we){Se=!0,zr(ge,Ce,p,g,Y).catch(ot=>{const it=ot instanceof Error?ot.message:"Unknown application error";It(ge,it),Oe.value=it});return}Oe.value="",Se=!0,zt(ge,null),kt(ge,{label:"Thinking",details:ft(m.value,S.value)}),It(ge,null),Mt(ge,!0);try{await zr(ge,Ce,p,g,Y)}catch(ot){Se=!1,Mt(ge,!1),kt(ge,null);const it=ot instanceof Error?ot.message:"Unknown application error";throw It(ge,it),Oe.value=it,ot}}async function hs(d,p,g=[],P=[],Y=[]){if(ze.value)return"";const ne=d.trim(),ge=p.trim(),Ce=m.value.trim();if(!ne&&g.length===0&&Y.length===0)return"";$e.value=!0,Oe.value="";let we="";try{try{we=await pu(ge||void 0,Ce||void 0)}catch(An){if(Ce&&Ce!==Ln&&Ko(An))await de(),we=await pu(ge||void 0,Ln);else throw An}if(!we)return"";Vt(we,ge,ne||"[Image]"),X.value={...X.value,[we]:!0},U(we),Se=!0,zt(we,null),kt(we,{label:"Thinking",details:ft(m.value,S.value)}),It(we,null),Mt(we,!0);const ot=we,it=ge||null,nn=ne;return zr(we,ne,g,P,Y).catch(An=>{Se=!1,Mt(we,!1),kt(we,null);const Kn=An instanceof Error?An.message:"Unknown application error";It(we,Kn),Oe.value=Kn}).finally(()=>{$e.value=!1}),fs(ot,nn,it),we}catch(ot){Se=!1,we&&(Mt(we,!1),kt(we,null));const it=ot instanceof Error?ot.message:"Unknown application error";throw we&&It(we,it),Oe.value=it,$e.value=!1,ot}}async function zr(d,p,g=[],P=[],Y=[]){const ne=m.value.trim(),ge=S.value,Ce=p.trim(),we=P.map(it=>({name:it.name,path:it.path})),ot=Y.map(it=>({...it}));Ie(d,{text:Ce,imageUrls:[...g],skills:we,fileAttachments:ot,effort:ge,fallbackRetried:!1});try{X.value[d]!==!0&&await ya(d);try{await wa(d,p,g,ne||void 0,ge||void 0,P.length>0?P:void 0,Y)}catch(it){if(ne&&ne!==Ln&&Ko(it))await de(),Ie(d,{text:Ce,imageUrls:[...g],skills:we,fileAttachments:ot,effort:ge,fallbackRetried:!0}),await wa(d,p,g,Ln,ge||void 0,P.length>0?P:void 0,Y);else throw it}X.value={...X.value,[d]:!0},he.add(d),pe=!0,await lr()}catch(it){throw it}}async function Oo(d){if(u.value[d]===!0)return;const p=l.value[d];if(!p||p.length===0)return;u.value={...u.value,[d]:!0};const[g,...P]=p;l.value=P.length>0?{...l.value,[d]:P}:Jt(l.value,d),$e.value=!0,Oe.value="",Se=!0,zt(d,null),kt(d,{label:"Thinking",details:ft(m.value,S.value)}),It(d,null),Mt(d,!0);try{await zr(d,g.text,g.imageUrls,g.skills,g.fileAttachments)}catch{Mt(d,!1),kt(d,null)}finally{u.value=Jt(u.value,d),$e.value=!1}}async function Us(){const d=n.value;if(!d||a.value[d]!==!0)return;const p=ue.value[d];De.value=!0,Oe.value="";try{await X_(d,p),Mt(d,!1),kt(d,null),It(d,null),ue.value[d]&&(ue.value=Jt(ue.value,d)),he.add(d),pe=!0,await lr()}catch(g){const P=g instanceof Error?g.message:"Failed to interrupt active turn";It(d,P),Oe.value=P}finally{De.value=!1}}async function Fs(d){const p=n.value;if(!p||tt.value)return;const P=(r.value[p]??[]).reduce((ne,ge)=>typeof ge.turnIndex=="number"&&ge.turnIndex>ne?ge.turnIndex:ne,-1);if(P<0||d>P)return;const Y=P-d+1;if(!(Y<1)){tt.value=!0,Oe.value="";try{await Me(p,d);const ne=await hu(p,Y);At(p,ne),Gt(p,[]),Yt(p),i.value[p]&&(i.value=Jt(i.value,p)),zt(p,null),kt(p,null),It(p,null),pe=!0,await lr()}catch(ne){Oe.value=ne instanceof Error?ne.message:"Failed to rollback thread"}finally{tt.value=!1}}}function qi(d,p){d.length===0||(R.value[d]??"")===p||(R.value={...R.value,[d]:p},Ra(R.value))}function No(d){var Y;if(d.length===0)return;const p=A.value.filter(ne=>ne!==d);if(rs(A.value,p)||(A.value=p,ms(A.value)),t.value=t.value.filter(ne=>ne.projectName!==d),R.value[d]!==void 0){const ne={...R.value};delete ne[d],R.value=ne,Ra(ne)}mt();const g=hr(e.value);nt(g),g.some(ne=>ne.id===n.value)||U(((Y=g[0])==null?void 0:Y.id)??""),Bs()}function Do(d,p){if(d.length===0||t.value.length===0)return;const g=t.value.map(we=>we.projectName),P=g.indexOf(d);if(P===-1)return;const Y=Math.max(0,Math.min(p,g.length-1)),ne=KA(g,P,Y);if(ne===g)return;const ge=qo(ne,t.value);A.value=ge,ms(A.value);const Ce=Pa(t.value,A.value);t.value=Jo(t.value,Ce),mt(),Bs()}function Lo(d){const p=d.trim();if(!p)return;const g=[p,...A.value.filter(Y=>Y!==p)];if(rs(A.value,g))return;A.value=g,ms(A.value);const P=Pa(t.value,A.value);t.value=Jo(t.value,P),mt(),Bs()}async function Bs(){var d,p;try{const g=await Qa(),P=new Map;for(const ge of g.order){const Ce=Ma(ge);P.has(Ce)||P.set(Ce,ge)}for(const ge of t.value){const Ce=((p=(d=ge.threads[0])==null?void 0:d.cwd)==null?void 0:p.trim())??"";Ce&&P.set(ge.projectName,Ce)}const Y=[];for(const ge of A.value){const Ce=P.get(ge);Ce&&!Y.includes(Ce)&&Y.push(Ce)}for(const ge of g.order)Y.includes(ge)||Y.push(ge);const ne=g.active.filter(ge=>Y.includes(ge));ne.length===0&&Y.length>0&&ne.push(Y[0]),await ak({order:Y,labels:g.labels,active:ne})}catch{}}async function lr(){if(Qe.value){typeof window<"u"&&Ze===null&&(Ze=window.setTimeout(()=>{Ze=null,lr()},Aa));return}Qe.value=!0;const d=pe,p=new Set(he);pe=!1,he.clear();try{d&&await hn();const g=n.value;if(!g)return;const P=p.has(g),Y=a.value[g]===!0,ne=en(g),ge=B.value[g]??"",Ce=ne.length>0&&ne!==ge;(P||Y||Ce||d)&&await Nn(g,{silent:!0})}catch{}finally{Qe.value=!1,(pe||he.size>0)&&typeof window<"u"&&Ze===null&&(Ze=window.setTimeout(()=>{Ze=null,lr()},Aa))}}function Ki(){typeof window>"u"||ct||(Ji(),ct=V_(d=>{je(d),Ft(d)}))}async function Ji(){try{const d=await G_();for(const p of d){const g=Un(p);g&&Mn(g)}}catch{}}async function Yi(d){try{await z_(d.id,{result:d.result,error:d.error}),$n(d.id)}catch(p){Oe.value=p instanceof Error?p.message:"Failed to reply to server request"}}function Xi(){ct&&(ct(),ct=null),pe=!1,he.clear(),b.clear(),Ze!==null&&typeof window<"u"&&(window.clearTimeout(Ze),Ze=null),Je!==null&&typeof window<"u"&&(window.clearTimeout(Je),Je=null),Se=!1,r.value={},s.value={},o.value={},i.value={},ve.value={},ae.value={},ke.value={},ue.value={},l.value={},u.value={}}const Gr=ie(()=>{const d=n.value;return d?l.value[d]??[]:[]});function jo(d){const p=n.value;if(!p)return;const g=l.value[p];if(!g)return;const P=g.filter(Y=>Y.id!==d);l.value=P.length>0?{...l.value,[p]:P}:Jt(l.value,p)}function Qi(d){const p=n.value;if(!p)return;const g=l.value[p];if(!g)return;const P=g.find(Y=>Y.id===d);P&&(jo(d),$o(P.text,P.imageUrls,P.skills,"steer",P.fileAttachments))}return{projectGroups:e,projectDisplayNameById:R,selectedThread:Q,selectedThreadScrollState:V,selectedThreadServerRequests:me,selectedLiveOverlay:oe,selectedThreadId:n,availableModelIds:f,selectedModelId:m,selectedReasoningEffort:S,selectedSpeedMode:D,installedSkills:Te,accountRateLimitSnapshots:Ne,messages:W,isLoadingThreads:Ue,isLoadingMessages:Ae,isSendingMessage:$e,isInterruptingTurn:De,isUpdatingSpeedMode:ze,error:Oe,refreshAll:js,refreshSkills:Vr,selectThread:Wi,setThreadScrollState:jt,archiveThreadById:Vi,renameThreadById:zi,forkThreadById:Gi,sendMessageToSelectedThread:$o,sendMessageToNewThread:hs,interruptSelectedThreadTurn:Us,rollbackSelectedThread:Fs,isRollingBack:tt,selectedThreadQueuedMessages:Gr,removeQueuedMessage:jo,steerQueuedMessage:Qi,setSelectedModelId:te,setWorktreeGitAutomationEnabled:se,setSelectedReasoningEffort:et,updateSelectedSpeedMode:xt,respondToPendingServerRequest:Yi,renameProject:qi,removeProject:No,reorderProject:Do,pinProjectToTop:Lo,startPolling:Ki,stopPolling:Xi}}const u1={class:"sidebar-root"},d1={class:"sidebar-scrollable"},f1=["aria-pressed"],h1={key:1,class:"sidebar-search-bar"},p1={key:0,class:"sidebar-settings-area"},m1={key:0,class:"sidebar-settings-panel"},g1=["title"],v1=["title"],y1={class:"sidebar-settings-value"},w1=["title"],b1={class:"sidebar-settings-value"},_1=["title"],k1=["title"],T1=["title"],S1=["title"],I1=["title"],E1={class:"sidebar-settings-value"},C1={class:"sidebar-settings-rate-limits"},A1={class:"sidebar-settings-build-label","aria-label":"Worktree name and version"},x1={class:"content-root"},R1={class:"content-body"},P1={key:1,class:"content-grid"},M1={class:"new-thread-empty"},$1={class:"worktree-init-status-title"},O1={class:"worktree-init-status-message"},N1={key:1,class:"new-thread-trending"},D1={class:"new-thread-trending-header"},L1={key:0,class:"new-thread-trending-empty"},j1={key:1,class:"new-thread-trending-empty"},U1={key:2,class:"new-thread-trending-list"},F1=["onClick"],B1=["title"],H1={class:"new-thread-trending-tip-name-owner"},W1={class:"new-thread-trending-tip-name-repo"},V1={key:1,class:"new-thread-trending-tip-name-repo"},z1={class:"new-thread-trending-tip-meta"},G1={class:"new-thread-trending-tip-description"},q1={key:2,class:"content-grid"},K1={class:"content-thread"},J1={class:"composer-with-queue"},Zu="codex-web-local.sidebar-collapsed.v1",ed="codex-web-local.send-with-enter.v1",td="codex-web-local.in-progress-send-mode.v1",nd="codex-web-local.dark-mode.v1",rd="codex-web-local.dictation-click-to-toggle.v1",sd="codex-web-local.dictation-auto-send.v1",od="codex-web-local.dictation-language.v1",id="codex-web-local.worktree-git-automation.v1",ad="codex-web-local.github-trending-projects.v1",Y1=Wt({__name:"App",setup(e){const t="2a6c",n="0.1.58",r={sendWithEnter:"When enabled, press Enter to send. When disabled, use Command+Enter to send.",inProgressSendMode:"If a turn is still running, choose whether a new prompt should steer the current turn or be queued.",appearance:"Switch between system theme, light mode, and dark mode.",dictationClickToToggle:"Use click-to-start and click-to-stop dictation instead of hold-to-talk.",dictationAutoSend:"Automatically send transcribed dictation when recording stops.",rollbackCommits:"When enabled, each message creates a rollback Git commit. On rollback, it resets to the commit before that message.",githubTrendingProjects:"Show or hide GitHub trending project cards on the new thread screen.",dictationLanguage:"Choose transcription language or keep auto-detect."},s={en:"english",zh:"chinese",de:"german",es:"spanish",ru:"russian",ko:"korean",fr:"french",ja:"japanese",pt:"portuguese",tr:"turkish",pl:"polish",ca:"catalan",nl:"dutch",ar:"arabic",sv:"swedish",it:"italian",id:"indonesian",hi:"hindi",fi:"finnish",vi:"vietnamese",he:"hebrew",uk:"ukrainian",el:"greek",ms:"malay",cs:"czech",ro:"romanian",da:"danish",hu:"hungarian",ta:"tamil",no:"norwegian",th:"thai",ur:"urdu",hr:"croatian",bg:"bulgarian",lt:"lithuanian",la:"latin",mi:"maori",ml:"malayalam",cy:"welsh",sk:"slovak",te:"telugu",fa:"persian",lv:"latvian",bn:"bengali",sr:"serbian",az:"azerbaijani",sl:"slovenian",kn:"kannada",et:"estonian",mk:"macedonian",br:"breton",eu:"basque",is:"icelandic",hy:"armenian",ne:"nepali",mn:"mongolian",bs:"bosnian",kk:"kazakh",sq:"albanian",sw:"swahili",gl:"galician",mr:"marathi",pa:"punjabi",si:"sinhala",km:"khmer",sn:"shona",yo:"yoruba",so:"somali",af:"afrikaans",oc:"occitan",ka:"georgian",be:"belarusian",tg:"tajik",sd:"sindhi",gu:"gujarati",am:"amharic",yi:"yiddish",lo:"lao",uz:"uzbek",fo:"faroese",ht:"haitian creole",ps:"pashto",tk:"turkmen",nn:"nynorsk",mt:"maltese",sa:"sanskrit",lb:"luxembourgish",my:"myanmar",bo:"tibetan",tl:"tagalog",mg:"malagasy",as:"assamese",tt:"tatar",haw:"hawaiian",ln:"lingala",ha:"hausa",ba:"bashkir",jw:"javanese",su:"sundanese",yue:"cantonese"},{projectGroups:o,projectDisplayNameById:i,selectedThread:a,selectedThreadScrollState:l,selectedThreadServerRequests:u,selectedLiveOverlay:c,selectedThreadId:f,availableModelIds:m,selectedModelId:S,selectedReasoningEffort:D,selectedSpeedMode:H,installedSkills:ee,accountRateLimitSnapshots:A,messages:R,isLoadingThreads:B,isLoadingMessages:F,isInterruptingTurn:X,isUpdatingSpeedMode:ae,refreshAll:ve,refreshSkills:ke,selectThread:ue,setThreadScrollState:fe,archiveThreadById:_e,forkThreadById:z,renameThreadById:Te,sendMessageToSelectedThread:Ne,sendMessageToNewThread:Ue,interruptSelectedThreadTurn:Ae,rollbackSelectedThread:$e,isRollingBack:De,selectedThreadQueuedMessages:ze,removeQueuedMessage:tt,steerQueuedMessage:Oe,setSelectedModelId:Qe,setWorktreeGitAutomationEnabled:wt,setSelectedReasoningEffort:ct,updateSelectedSpeedMode:Ze,respondToPendingServerRequest:Je,renameProject:K,removeProject:pe,reorderProject:he,pinProjectToTop:Ee,startPolling:Se,stopPolling:b}=c1(),T=_v(),M=bv(),{isMobile:q}=Lf(),Q=O(null),V=O(null),me=O([]),oe=O(!1),W=O("trending-daily"),U=O(null),te=O(!1),se=O(!1),de=O(""),Ie=O("local"),We=O({order:[],labels:{}}),Fe=O({phase:"idle",title:"",message:""}),Me=O(An()),Ye=O(""),et=O(!1),xt=O(null),ft=O(null);let Ct=null;const Lt=O("New Project (1)"),pt=O(""),Pt=O(!1),mt=O(Gr(ed,!0)),Vt=O(Qi()),nt=O(jo()),bn=O(Gr(rd,!1)),zt=O(null);let Mt=0;const un=O(Gr(sd,!0)),kt=O(we()),It=ie(()=>ot()),en=O(Gr(id,!0)),jt=O(Gr(ad,!0)),At=O({configured:!1,active:!1,mappedChats:0,mappedThreads:0,lastError:""}),Gt=ie(()=>{const _=T.params.threadId;return typeof _=="string"?_:""}),In=ie(()=>{const _=new Set;for(const j of o.value)for(const re of j.threads)_.add(re.id);return _}),$t=ie(()=>T.name==="home"),En=ie(()=>T.name==="skills"),Yt=ie(()=>{var _;return En.value?"Skills":$t.value?"New thread":((_=a.value)==null?void 0:_.title)??"Choose a thread"}),He=typeof window<"u"&&(window.location.hostname||window.location.host)||"codexui",Le=ie(()=>{var j,re;return(((re=(j=a.value)==null?void 0:j.title)==null?void 0:re.trim())??"")||He}),qt=ie(()=>R.value.filter(_=>{const j=Hs(_.messageType,_.role);return j==="worked"?!0:!(j==="turnActivity.live"||j==="turnError.live"||j==="agentReasoning.live")})),dn=ie(()=>{let _=-1;for(const j of R.value)j.role==="user"&&typeof j.turnIndex=="number"&&j.turnIndex>_&&(_=j.turnIndex);return _}),Pn=ie(()=>c.value),_n=ie(()=>$t.value?"__new-thread__":f.value),Kt=ie(()=>{var _,j;return $t.value?de.value.trim():((j=(_=a.value)==null?void 0:_.cwd)==null?void 0:j.trim())??""}),Ut=ie(()=>{var _;return!$t.value&&((_=a.value)==null?void 0:_.inProgress)===!0}),tn=ie(()=>{var ye,Be;const _=[],j=new Set;for(const Re of We.value.order){const Nt=Re.trim();!Nt||j.has(Nt)||(j.add(Nt),_.push({value:Nt,label:We.value.labels[Nt]||ws(Nt)}))}for(const Re of o.value){const Nt=((Be=(ye=Re.threads[0])==null?void 0:ye.cwd)==null?void 0:Be.trim())??"";!Nt||j.has(Nt)||(j.add(Nt),_.push({value:Nt,label:i.value[Re.projectName]??Re.projectName}))}const re=de.value.trim();return re&&!j.has(re)&&_.unshift({value:re,label:ws(re)}),_}),fn=typeof window<"u"?window.matchMedia("(prefers-color-scheme: dark)"):null,Un=ie(()=>[{value:"search-daily",label:"Search daily"},{value:"search-weekly",label:"Search weekly"},{value:"search-monthly",label:"Search monthly"},{value:"trending-daily",label:"Trending daily"},{value:"trending-weekly",label:"Trending weekly"},{value:"trending-monthly",label:"Trending monthly"}]),Mn=ie(()=>{if(!At.value.configured)return"Not configured";const _=At.value.active?"Online":"Configured (offline)",j=`${At.value.mappedChats} chat(s), ${At.value.mappedThreads} thread(s)`,re=At.value.lastError?`, error: ${At.value.lastError}`:"";return`${_}, ${j}${re}`});ar(()=>{window.addEventListener("keydown",Ft),nn(),fn==null||fn.addEventListener("change",nn),Uo(),zi(),Oo(),Us(),hs(),kn(),jt.value&&Fs()}),So(()=>{window.removeEventListener("keydown",Ft),fn==null||fn.removeEventListener("change",nn),Ct&&(clearTimeout(Ct),Ct=null),b()}),at(Ye,_=>{const j=_.trim();if(Ct&&(clearTimeout(Ct),Ct=null),!j){ft.value=null;return}Ct=setTimeout(()=>{uk(j,1e3).then(re=>{Ye.value.trim()===j&&(ft.value=re.threadIds)}).catch(()=>{Ye.value.trim()===j&&(ft.value=null)})},220)});function $n(){ke()}async function kn(){try{At.value=await fk()}catch(_){const j=_ instanceof Error?_.message:"Failed to load Telegram status";At.value={configured:!1,active:!1,mappedChats:0,mappedThreads:0,lastError:j}}}function Cn(){et.value=!et.value,et.value?Xt(()=>{var _;return(_=xt.value)==null?void 0:_.focus()}):Ye.value=""}function On(){var _;Ye.value="",(_=xt.value)==null||_.focus()}function w(_){_.key==="Escape"&&(et.value=!1,Ye.value="")}function I(_){_&&(T.name==="thread"&&Gt.value===_||(M.push({name:"thread",params:{threadId:_}}),q.value&&je(!0)))}async function x(_){_&&(f.value!==_&&(await ue(_),await M.push({name:"thread",params:{threadId:_}})),await Xt(),Ki())}function G(_){_e(_)}async function y(_){const j=await z(_);j&&($t.value?await M.replace({name:"thread",params:{threadId:j}}):await M.push({name:"thread",params:{threadId:j}}),q.value&&je(!0))}function C(_){const j=_.trim().replace(/\\/gu,"/");return j?j.includes("/.codex/worktrees/")||j.includes("/.git/worktrees/"):!1}function L(_,j=""){var Re,Nt,qr;const re=o.value.find(Kr=>Kr.projectName===_);if(!re)return j.trim();const ye=re.threads.find(Kr=>!C(Kr.cwd));return(((Re=ye==null?void 0:ye.cwd)==null?void 0:Re.trim())??((qr=(Nt=re.threads[0])==null?void 0:Nt.cwd)==null?void 0:qr.trim())??"")||j.trim()}function Z(_){var ye,Be;const j=o.value.find(Re=>Re.projectName===_),re=L(_,((Be=(ye=j==null?void 0:j.threads[0])==null?void 0:ye.cwd)==null?void 0:Be.trim())??"");re&&(de.value=re),q.value&&je(!0),!$t.value&&M.push({name:"home"})}function xe(_){var re;let j="";for(const ye of o.value){const Be=ye.threads.find(Re=>Re.id===_);if((re=Be==null?void 0:Be.cwd)!=null&&re.trim()){j=Be.cwd.trim();break}}!j||typeof window>"u"||window.open(`/codex-local-browse${encodeURI(j)}`,"_blank","noopener,noreferrer")}function Xe(){var re;const _=a.value,j=_?L(_.projectName,((re=_.cwd)==null?void 0:re.trim())??""):"";j&&(de.value=j),q.value&&je(!0),!$t.value&&M.push({name:"home"})}function ut(_){K(_.projectName,_.displayName)}function Rt(_){Te(_.threadId,_.title)}function k(_){pe(_)}function $(_){he(_.projectName,_.toIndex)}function N(_){fe(_.threadId,_.state)}function J(_){Je(_)}function je(_){Me.value!==_&&(Me.value=_,Kn(_))}function Ft(_){_.defaultPrevented||!_.ctrlKey&&!_.metaKey||_.shiftKey||_.altKey||_.key.toLowerCase()==="b"&&(_.preventDefault(),je(!Me.value))}function Tn(_){const j=_.text,re=U.value,ye=_.mode==="queue"&&re&&re.threadId===f.value?re.queueIndex:void 0;if(U.value=null,$t.value){Fo(j,_.imageUrls,_.skills,_.fileAttachments);return}if(_.rollbackLatestUserTurn===!0){js(_);return}Ne(j,_.imageUrls,_.skills,_.mode,_.fileAttachments,ye)}function ds(_){const j=new Intl.NumberFormat().format(_.stars);return _.language?`${_.language} · ★ ${j}`:`★ ${j}`}function fs(_){const re=new Set(["search-daily","search-weekly","search-monthly","trending-daily","trending-weekly","trending-monthly"]).has(_)?_:"trending-daily";W.value!==re&&(W.value=re)}function hn(){if(typeof window>"u")return;const _=window.prompt("Telegram bot token");!_||!_.trim()||dk(_.trim()).then(()=>{window.alert("Telegram bot configured. Open the bot DM and send /start."),kn()}).catch(j=>{const re=j instanceof Error?j.message:"Failed to connect Telegram bot";window.alert(re),kn()})}function Nn(_){const j=Q.value;j&&j.hydrateDraft({text:`Clone this GitHub project and run it: ${_.url}
|
|
1427
|
+
Then explain what this project does in very simple words a 5th grader can understand.`,imageUrls:[],fileAttachments:[],skills:[]})}function Vr(_){const j=ze.value.findIndex(Re=>Re.id===_),re=j>=0?ze.value[j]:void 0,ye=V.value;if(!re||!ye||ye.hasUnsavedDraft()&&!window.confirm("Replace the current draft with this queued message for editing?"))return;U.value=f.value?{threadId:f.value,queueIndex:j}:null;const Be={text:re.text,imageUrls:[...re.imageUrls],fileAttachments:re.fileAttachments.map(Re=>({...Re})),skills:re.skills.map(Re=>({...Re}))};ye.hydrateDraft(Be),tt(_)}async function js(_){Ut.value&&await Ae();const j=dn.value;j>=0&&await $e(j),await Ne(_.text,_.imageUrls,_.skills,"steer",_.fileAttachments)}function Wi(_){de.value=_.trim()}async function Vi(_){const j=_.trim();if(!j)return;const re=$o(j),ye=await Gi(),Be=re?j:qi(ye,j);if(Be)try{const Re=await gu(Be,{createIfMissing:!re,label:re?"":j});Re&&(de.value=Re,Ee(ws(Re)),Us(),hs())}catch{}}async function zi(){var j;if(typeof window>"u")return;const _=((j=new URLSearchParams(window.location.search).get("openProjectPath"))==null?void 0:j.trim())??"";if(_)try{const re=await gu(_,{createIfMissing:!1,label:""});if(!re)return;de.value=re,Ee(ws(re)),await M.replace({name:"home"}),await Us();const ye=new URL(window.location.href);ye.searchParams.delete("openProjectPath"),window.history.replaceState({},"",ye.toString())}catch{}}async function Gi(){const _=zr();if(_)return _;try{const j=await mu();if(j)return pt.value=j,j}catch{}return""}function $o(_){return _?_.startsWith("~/")||_.startsWith("/")?!0:/^[a-zA-Z]:[\\/]/.test(_):!1}async function hs(){const _=zr();if(!_){Lt.value="New Project (1)";return}try{const j=await lk(_);Lt.value=j.name||"New Project (1)"}catch{Lt.value="New Project (1)"}}function zr(){var re,ye;const _=de.value.trim();if(_)return uu(_);const j=((ye=(re=tn.value[0])==null?void 0:re.value)==null?void 0:ye.trim())??"";return j?uu(j):pt.value.trim()}async function Oo(){try{pt.value=await mu()}catch{pt.value=""}}async function Us(){try{const _=await Qa();We.value={order:[..._.order],labels:{..._.labels}}}catch{We.value={order:[],labels:{}}}}async function Fs(){oe.value=!0;try{me.value=await pk(W.value,6)}catch{me.value=[]}finally{oe.value=!1}}function qi(_,j){const re=_.trim().replace(/\/+$/,""),ye=j.trim().replace(/^\/+/,"");return!re||!ye?"":`${re}/${ye}`}function No(_){Qe(_)}function Do(_){ct(_)}function Lo(_){Ze(_)}function Bs(){Ae()}function lr(_){var re;const j=((re=_.prependText)==null?void 0:re.trim())??"";j.length>0&&(Mt+=1,zt.value={id:Mt,text:j}),$e(_.turnIndex)}function Ki(){if($t.value||En.value||typeof document>"u"||!a.value||qt.value.length===0)return;const _=Ji(),j=Yi(),re=new Blob([_],{type:"text/markdown;charset=utf-8"}),ye=URL.createObjectURL(re),Be=document.createElement("a");Be.href=ye,Be.download=j,document.body.appendChild(Be),Be.click(),document.body.removeChild(Be),window.setTimeout(()=>URL.revokeObjectURL(ye),0)}function Ji(){var re,ye,Be;const _=[],j=((ye=(re=a.value)==null?void 0:re.title)==null?void 0:ye.trim())||"Untitled thread";_.push(`# ${Xi(j)}`),_.push(""),_.push(`- Exported: ${new Date().toISOString()}`),_.push(`- Thread ID: ${((Be=a.value)==null?void 0:Be.id)??""}`),_.push(""),_.push("---"),_.push("");for(const Re of qt.value){const Nt=Re.role?Re.role.toUpperCase():"MESSAGE";_.push(`## ${Nt}`),_.push("");const qr=Re.text.trim();if(qr&&(_.push(qr),_.push("")),Re.commandExecution&&(_.push("```text"),_.push(`command: ${Re.commandExecution.command}`),_.push(`status: ${Re.commandExecution.status}`),Re.commandExecution.cwd&&_.push(`cwd: ${Re.commandExecution.cwd}`),Re.commandExecution.exitCode!==null&&_.push(`exitCode: ${Re.commandExecution.exitCode}`),_.push(Re.commandExecution.aggregatedOutput||"(no output)"),_.push("```"),_.push("")),Re.fileAttachments&&Re.fileAttachments.length>0){_.push("Attachments:");for(const Kr of Re.fileAttachments)_.push(`- ${Kr.path}`);_.push("")}if(Re.images&&Re.images.length>0){_.push("Images:");for(const Kr of Re.images)_.push(`- ${Kr}`);_.push("")}}return`${_.join(`
|
|
1428
|
+
`).trimEnd()}
|
|
1429
|
+
`}function Yi(){var Be,Re;const re=(((Re=(Be=a.value)==null?void 0:Be.title)==null?void 0:Re.trim())||"chat").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"chat",ye=new Date().toISOString().replace(/[:.]/g,"-");return`${re}-${ye}.md`}function Xi(_){return _.replace(/([\\`*_{}\[\]()#+\-.!])/g,"\\$1")}function Gr(_,j){if(typeof window>"u")return j;const re=window.localStorage.getItem(_);return re===null?j:re==="1"}function jo(){if(typeof window>"u")return"system";const _=window.localStorage.getItem(nd);return _==="light"||_==="dark"?_:"system"}function Qi(){return typeof window>"u"?"steer":window.localStorage.getItem(td)==="queue"?"queue":"steer"}function d(){mt.value=!mt.value,window.localStorage.setItem(ed,mt.value?"1":"0")}function p(){Vt.value=Vt.value==="steer"?"queue":"steer",window.localStorage.setItem(td,Vt.value)}function g(){const _=["system","light","dark"],j=_.indexOf(nt.value);nt.value=_[(j+1)%_.length],window.localStorage.setItem(nd,nt.value),nn()}function P(){bn.value=!bn.value,window.localStorage.setItem(rd,bn.value?"1":"0")}function Y(){un.value=!un.value,window.localStorage.setItem(sd,un.value?"1":"0")}function ne(){en.value=!en.value,window.localStorage.setItem(id,en.value?"1":"0")}function ge(){jt.value=!jt.value,window.localStorage.setItem(ad,jt.value?"1":"0")}function Ce(_){const re=it(_.trim())||"auto";kt.value=re,window.localStorage.setItem(od,re)}function we(){var re;if(typeof window>"u")return"auto";const _=((re=window.localStorage.getItem(od))==null?void 0:re.trim())||"auto";return it(_)||"auto"}function ot(){const _=[{value:"auto",label:"Auto-detect"}],j=new Set(["auto"]);function re(Be){const Re=s[Be]||Be;return`${Re.charAt(0).toUpperCase()+Re.slice(1)} (${Be})`}for(const Be of typeof navigator<"u"?navigator.languages??[]:[]){const Re=it(Be);!Re||j.has(Re)||(j.add(Re),_.push({value:Re,label:`Preferred: ${re(Re)}`}))}for(const Be of Object.keys(s))j.has(Be)||(j.add(Be),_.push({value:Be,label:re(Be)}));const ye=kt.value.trim();return ye&&!j.has(ye)&&_.push({value:ye,label:re(ye)}),_}function it(_){const j=_.trim().toLowerCase();if(!j||j==="auto")return"";if(j in s)return j;const re=j.split("-")[0]??j;return re in s?re:""}function nn(){const _=document.documentElement;if(nt.value==="dark")_.classList.add("dark");else if(nt.value==="light")_.classList.remove("dark");else{const j=window.matchMedia("(prefers-color-scheme: dark)").matches;_.classList.toggle("dark",j)}}function An(){return typeof window>"u"?!1:window.localStorage.getItem(Zu)==="1"}function Kn(_){typeof window>"u"||window.localStorage.setItem(Zu,_?"1":"0")}function Hs(_,j){const re=(_??"").trim();return re.length>0?re:j.trim()||"message"}async function Uo(){await ve(),se.value=!0,await Ws(),Se()}async function Ws(){if(!te.value){te.value=!0;try{if(T.name==="home"||T.name==="skills"){f.value!==""&&await ue("");return}if(T.name==="thread"){const _=Gt.value;if(!_)return;if(!In.value.has(_)){await M.replace({name:"home"});return}f.value!==_&&await ue(_);return}}finally{te.value=!1}}}at(()=>[T.name,Gt.value,B.value,In.value.has(Gt.value),f.value],async()=>{se.value&&await Ws()}),at(()=>f.value,async _=>{if(se.value&&!te.value&&!($t.value||En.value)){if(!_){T.name!=="home"&&await M.replace({name:"home"});return}T.name==="thread"&&Gt.value===_||await M.replace({name:"thread",params:{threadId:_}})}}),at(()=>W.value,()=>{jt.value&&Fs()}),at(()=>jt.value,_=>{if(!_){me.value=[];return}Fs()}),at(()=>tn.value,_=>{if(_.length===0){de.value="";return}_.some(re=>re.value===de.value)||(de.value=_[0].value),hs()},{immediate:!0}),at(()=>de.value,()=>{Fe.value={phase:"idle",title:"",message:""},hs()}),at(()=>Ie.value,_=>{var j;if(_==="local"){Fe.value={phase:"idle",title:"",message:""};const re=de.value.trim();if(re&&C(re)){const ye=((j=a.value)==null?void 0:j.projectName)??ws(re),Be=L(ye,"");Be&&(de.value=Be)}}}),at(()=>T.name,_=>{_!=="home"&&(Fe.value={phase:"idle",title:"",message:""})}),at(()=>f.value,()=>{Fe.value={phase:"idle",title:"",message:""}}),at(Le,_=>{typeof document>"u"||(document.title=_)},{immediate:!0}),at(()=>en.value,_=>{wt(_)},{immediate:!0}),at(q,_=>{_&&!Me.value&&je(!0)});async function Fo(_,j=[],re=[],ye=[]){try{Fe.value={phase:"idle",title:"",message:""};let Be=de.value;if(Ie.value==="worktree"){Fe.value={phase:"running",title:"Creating worktree",message:"Creating a worktree and running setup."};try{const Nt=await sk(de.value);Be=Nt.cwd,de.value=Nt.cwd,Fe.value={phase:"idle",title:"",message:""}}catch{Fe.value={phase:"error",title:"Worktree setup failed",message:"Unable to create worktree. Try again or switch to Local project."};return}}const Re=await Ue(_,Be,j,re,ye);if(!Re)return;await M.replace({name:"thread",params:{threadId:Re}})}catch{}}return(_,j)=>(v(),dt(Cv,{"is-sidebar-collapsed":Me.value,onCloseSidebar:j[6]||(j[6]=re=>je(!0))},{sidebar:bt(()=>[h("section",u1,[h("div",d1,[Me.value?ce("",!0):(v(),dt(Ku,{key:0,class:"sidebar-thread-controls-host","is-sidebar-collapsed":Me.value,"show-new-thread-button":!0,onToggleSidebar:j[0]||(j[0]=re=>je(!Me.value)),onStartNewThread:Xe},{default:bt(()=>[h("button",{class:"sidebar-search-toggle",type:"button","aria-pressed":et.value,"aria-label":"Search threads",title:"Search threads",onClick:Cn},[Pe(Za,{class:"sidebar-search-toggle-icon"})],8,f1)]),_:1},8,["is-sidebar-collapsed"])),!Me.value&&et.value?(v(),E("div",h1,[Pe(Za,{class:"sidebar-search-bar-icon"}),Tr(h("input",{ref_key:"sidebarSearchInputRef",ref:xt,"onUpdate:modelValue":j[1]||(j[1]=re=>Ye.value=re),class:"sidebar-search-input",type:"text",placeholder:"Filter threads...",onKeydown:w},null,544),[[Sr,Ye.value]]),Ye.value.length>0?(v(),E("button",{key:0,class:"sidebar-search-clear",type:"button","aria-label":"Clear search",onClick:On},[Pe(Ol,{class:"sidebar-search-clear-icon"})])):ce("",!0)])):ce("",!0),Me.value?ce("",!0):(v(),E("button",{key:2,class:st(["sidebar-skills-link",{"is-active":En.value}]),type:"button",onClick:j[2]||(j[2]=re=>{be(M).push({name:"skills"}),be(q)&&je(!0)})}," Skills Hub ",2)),Me.value?ce("",!0):(v(),dt(_w,{key:3,groups:be(o),"project-display-name-by-id":be(i),"selected-thread-id":be(f),"is-loading":be(B),"search-query":Ye.value,"search-matched-thread-ids":ft.value,onSelect:I,onArchive:G,onStartNewThread:Z,onRenameProject:ut,onBrowseThreadFiles:xe,onRenameThread:Rt,onForkThread:y,onRemoveProject:k,onReorderProject:$,onExportThread:x},null,8,["groups","project-display-name-by-id","selected-thread-id","is-loading","search-query","search-matched-thread-ids"]))]),Me.value?ce("",!0):(v(),E("div",p1,[Pe(Sf,{name:"settings-panel"},{default:bt(()=>[Pt.value?(v(),E("div",m1,[h("button",{class:"sidebar-settings-row",type:"button",title:r.sendWithEnter,onClick:d},[j[7]||(j[7]=h("span",{class:"sidebar-settings-label"},"Require ⌘ + enter to send",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":!mt.value}])},null,2)],8,g1),h("button",{class:"sidebar-settings-row",type:"button",title:r.inProgressSendMode,onClick:p},[j[8]||(j[8]=h("span",{class:"sidebar-settings-label"},"When busy, send as",-1)),h("span",y1,le(Vt.value==="steer"?"Steer":"Queue"),1)],8,v1),h("button",{class:"sidebar-settings-row",type:"button",title:r.appearance,onClick:g},[j[9]||(j[9]=h("span",{class:"sidebar-settings-label"},"Appearance",-1)),h("span",b1,le(nt.value==="system"?"System":nt.value==="dark"?"Dark":"Light"),1)],8,w1),h("button",{class:"sidebar-settings-row",type:"button",title:r.dictationClickToToggle,onClick:P},[j[10]||(j[10]=h("span",{class:"sidebar-settings-label"},"Click to toggle dictation",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":bn.value}])},null,2)],8,_1),h("button",{class:"sidebar-settings-row",type:"button",title:r.dictationAutoSend,onClick:Y},[j[11]||(j[11]=h("span",{class:"sidebar-settings-label"},"Auto send dictation",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":un.value}])},null,2)],8,k1),h("button",{class:"sidebar-settings-row",type:"button",title:r.rollbackCommits,onClick:ne},[j[12]||(j[12]=h("span",{class:"sidebar-settings-label"},"Rollback commits",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":en.value}])},null,2)],8,T1),h("button",{class:"sidebar-settings-row",type:"button",title:r.githubTrendingProjects,onClick:ge},[j[13]||(j[13]=h("span",{class:"sidebar-settings-label"},"GitHub trending projects",-1)),h("span",{class:st(["sidebar-settings-toggle",{"is-on":jt.value}])},null,2)],8,S1),h("div",{class:"sidebar-settings-row sidebar-settings-row--select",title:r.dictationLanguage},[j[14]||(j[14]=h("span",{class:"sidebar-settings-label"},"Dictation language",-1)),Pe(oo,{class:"sidebar-settings-language-dropdown","model-value":kt.value,options:It.value,placeholder:"Auto-detect","open-direction":"up","enable-search":!0,"search-placeholder":"Search language...","onUpdate:modelValue":Ce},null,8,["model-value","options"])],8,I1),h("button",{class:"sidebar-settings-row",type:"button","aria-live":"polite",onClick:hn},[j[15]||(j[15]=h("span",{class:"sidebar-settings-label"},"Telegram",-1)),h("span",E1,le(Mn.value),1)]),h("div",C1,[Pe(wT,{snapshots:be(A)},null,8,["snapshots"])]),h("div",A1," WT "+le(be(t))+" · v"+le(be(n)),1)])):ce("",!0)]),_:1}),h("button",{class:"sidebar-settings-button",type:"button",onClick:j[3]||(j[3]=re=>Pt.value=!Pt.value)},[Pe(LA,{class:"sidebar-settings-icon"}),j[16]||(j[16]=h("span",null,"Settings",-1))])]))])]),content:bt(()=>[h("section",x1,[Pe(Cw,{title:Yt.value},{leading:bt(()=>[Me.value||be(q)?(v(),dt(Ku,{key:0,class:"sidebar-thread-controls-header-host","is-sidebar-collapsed":Me.value,"show-new-thread-button":!0,onToggleSidebar:j[4]||(j[4]=re=>je(!Me.value)),onStartNewThread:Xe},null,8,["is-sidebar-collapsed"])):ce("",!0)]),_:1},8,["title"]),h("section",R1,[En.value?(v(),dt(kA,{key:0,onSkillsChanged:$n})):$t.value?(v(),E("div",P1,[h("div",M1,[j[19]||(j[19]=h("p",{class:"new-thread-hero"},"Let's build",-1)),Pe(oo,{class:"new-thread-folder-dropdown","model-value":de.value,options:tn.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":Wi,onAdd:Vi},null,8,["model-value","options","default-add-value"]),Pe(CT,{class:"new-thread-runtime-dropdown",modelValue:Ie.value,"onUpdate:modelValue":j[5]||(j[5]=re=>Ie.value=re)},null,8,["modelValue"]),Fe.value.phase!=="idle"?(v(),E("div",{key:0,class:st(["worktree-init-status",{"is-running":Fe.value.phase==="running","is-error":Fe.value.phase==="error"}])},[h("strong",$1,le(Fe.value.title),1),h("span",O1,le(Fe.value.message),1)],2)):ce("",!0),jt.value?(v(),E("div",N1,[h("div",D1,[j[17]||(j[17]=h("p",{class:"new-thread-trending-title"},"Trending GitHub projects",-1)),Pe(oo,{class:"new-thread-trending-scope-dropdown","model-value":W.value,options:Un.value,"onUpdate:modelValue":fs},null,8,["model-value","options"])]),oe.value?(v(),E("p",L1,"Loading trending projects...")):me.value.length===0?(v(),E("p",j1," Trending repos are unavailable right now. ")):(v(),E("div",U1,[(v(!0),E(Ve,null,_t(me.value,re=>(v(),E("button",{key:re.id,type:"button",class:"new-thread-trending-tip",onClick:ye=>Nn(re)},[h("span",{class:"new-thread-trending-tip-name",title:re.fullName},[re.owner&&re.repo?(v(),E(Ve,{key:0},[h("span",H1,le(re.owner),1),j[18]||(j[18]=h("span",{class:"new-thread-trending-tip-name-slash"},"/",-1)),h("span",W1,le(re.repo),1)],64)):(v(),E("span",V1,le(re.fullName),1))],8,B1),h("span",z1,le(ds(re)),1),h("span",G1,le(re.description||"No description available."),1)],8,F1))),128))]))])):ce("",!0)]),Pe(wu,{ref_key:"homeThreadComposerRef",ref:Q,"active-thread-id":_n.value,cwd:Kt.value,models:be(m),"selected-model":be(S),"selected-reasoning-effort":be(D),"selected-speed-mode":be(H),"is-updating-speed-mode":be(ae),skills:be(ee),"is-turn-in-progress":!1,"is-interrupting-turn":!1,"send-with-enter":mt.value,"in-progress-submit-mode":Vt.value,"dictation-click-to-toggle":bn.value,"dictation-auto-send":un.value,"prepend-draft-request":zt.value,"dictation-language":kt.value,onSubmit:Tn,"onUpdate:selectedModel":No,"onUpdate:selectedReasoningEffort":Do,"onUpdate:selectedSpeedMode":Lo},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])):(v(),E("div",q1,[h("div",K1,[Pe(h_,{messages:qt.value,"is-loading":be(F),"active-thread-id":_n.value,cwd:Kt.value,"scroll-state":be(l),"live-overlay":Pn.value,"pending-requests":be(u),"is-turn-in-progress":Ut.value,"is-rolling-back":be(De),onUpdateScrollState:N,onRespondServerRequest:J,onRollback:lr},null,8,["messages","is-loading","active-thread-id","cwd","scroll-state","live-overlay","pending-requests","is-turn-in-progress","is-rolling-back"])]),h("div",J1,[Pe(uT,{messages:be(ze),onEdit:Vr,onSteer:be(Oe),onDelete:be(tt)},null,8,["messages","onSteer","onDelete"]),Pe(wu,{ref_key:"threadComposerRef",ref:V,"active-thread-id":_n.value,cwd:Kt.value,models:be(m),"selected-model":be(S),"selected-reasoning-effort":be(D),"selected-speed-mode":be(H),"is-updating-speed-mode":be(ae),skills:be(ee),"is-turn-in-progress":Ut.value,"is-interrupting-turn":be(X),"has-queue-above":be(ze).length>0,"send-with-enter":mt.value,"in-progress-submit-mode":Vt.value,"dictation-click-to-toggle":bn.value,"dictation-auto-send":un.value,"prepend-draft-request":zt.value,"dictation-language":kt.value,onSubmit:Tn,"onUpdate:selectedModel":No,"onUpdate:selectedReasoningEffort":Do,"onUpdate:selectedSpeedMode":Lo,onInterrupt:Bs},null,8,["active-thread-id","cwd","models","selected-model","selected-reasoning-effort","selected-speed-mode","is-updating-speed-mode","skills","is-turn-in-progress","is-interrupting-turn","has-queue-above","send-with-enter","in-progress-submit-mode","dictation-click-to-toggle","dictation-auto-send","prepend-draft-request","dictation-language"])])]))])])]),_:1},8,["is-sidebar-collapsed"]))}}),X1=lt(Y1,[["__scopeId","data-v-88ff0cc2"]]),$a={render:()=>null},Q1=wv({history:Xg(),routes:[{path:"/",name:"home",component:$a},{path:"/thread/:threadId",name:"thread",component:$a},{path:"/skills",name:"skills",component:$a},{path:"/new-thread",redirect:{name:"home"}},{path:"/:pathMatch(.*)*",redirect:{name:"home"}}]});console.log("Welcome to codexapp. GitHub: https://github.com/friuns2/codexui");ug(X1).use(Q1).mount("#app");
|