my-durable 0.0.19 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,80 +0,0 @@
1
- var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function n(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var r={},i=[],a=()=>{},o=()=>!1,s=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),c=e=>e.startsWith(`onUpdate:`),l=Object.assign,u=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},d=Object.prototype.hasOwnProperty,f=(e,t)=>d.call(e,t),p=Array.isArray,m=e=>x(e)===`[object Map]`,h=e=>x(e)===`[object Set]`,g=e=>x(e)===`[object Date]`,_=e=>typeof e==`function`,v=e=>typeof e==`string`,y=e=>typeof e==`symbol`,b=e=>typeof e==`object`&&!!e,ee=e=>(b(e)||_(e))&&_(e.then)&&_(e.catch),te=Object.prototype.toString,x=e=>te.call(e),ne=e=>x(e).slice(8,-1),re=e=>x(e)===`[object Object]`,ie=e=>v(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,ae=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),oe=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},se=/-\w/g,ce=oe(e=>e.replace(se,e=>e.slice(1).toUpperCase())),le=/\B([A-Z])/g,ue=oe(e=>e.replace(le,`-$1`).toLowerCase()),de=oe(e=>e.charAt(0).toUpperCase()+e.slice(1)),fe=oe(e=>e?`on${de(e)}`:``),S=(e,t)=>!Object.is(e,t),pe=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},me=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},he=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ge=e=>{let t=v(e)?Number(e):NaN;return isNaN(t)?e:t},_e,ve=()=>_e||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function ye(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=v(r)?Ce(r):ye(r);if(i)for(let e in i)t[e]=i[e]}return t}if(v(e)||b(e))return e}var be=/;(?![^(]*\))/g,xe=/:([^]+)/,Se=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function Ce(e){let t={};return e.replace(Se,e=>e.startsWith(`/*`)?``:e).split(be).forEach(e=>{if(e){let n=e.split(xe);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function C(e){let t=``;if(v(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=C(e[n]);r&&(t+=r+` `)}else if(b(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var we=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,Te=n(we);we+``;function Ee(e){return!!e||e===``}function De(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=Ae(e[i],t[i],n);return r}function w(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&Ae(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function Oe(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?w(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!Ae(e[r],t[r],n))return!1}return String(e)===String(t)}function ke(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function Ae(e,t,n){if(e===t)return!0;let r=g(e),i=g(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=y(e),i=y(t),r||i?e===t:(r=p(e),i=p(t),r||i?r&&i?ke(e,t,n,De):!1:(r=b(e),i=b(t),r||i?!r||!i?!1:ke(e,t,n,Oe):String(e)===String(t))))}function je(e,t){return e.findIndex(e=>Ae(e,t))}var Me=e=>!!(e&&e.__v_isRef===!0),T=e=>v(e)?e:e==null?``:p(e)||b(e)&&(e.toString===te||!_(e.toString))?Me(e)?T(e.value):JSON.stringify(e,Ne,2):String(e),Ne=(e,t)=>Me(t)?Ne(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Pe(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Pe(e))}:y(t)?Pe(t):b(t)&&!p(t)&&!re(t)?String(t):t,Pe=(e,t=``)=>y(e)?`Symbol(${e.description??t})`:e,Fe,Ie=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Fe&&(Fe.active?(this.parent=Fe,this.index=(Fe.scopes||(Fe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=Fe;try{return Fe=this,e()}finally{Fe=t}}}on(){++this._on===1&&(this.prevScope=Fe,Fe=this)}off(){if(this._on>0&&--this._on===0){if(Fe===this)Fe=this.prevScope;else{let e=Fe;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function Le(){return Fe}var E,Re=new WeakSet,ze=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Fe&&(Fe.active?Fe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Re.has(this)&&(Re.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ue(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nt(this),Ke(this);let e=E,t=Qe;E=this,Qe=!0;try{return this.fn()}finally{qe(this),E=e,Qe=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Xe(e);this.deps=this.depsTail=void 0,nt(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Re.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Je(this)&&this.run()}get dirty(){return Je(this)}},Be=0,Ve,He;function Ue(e,t=!1){if(e.flags|=8,t){e.next=He,He=e;return}e.next=Ve,Ve=e}function We(){Be++}function Ge(){if(--Be>0)return;if(He){let e=He;for(He=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Ve;){let t=Ve;for(Ve=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function Ke(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function qe(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Xe(r),Ze(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Je(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Ye(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Ye(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===rt)||(e.globalVersion=rt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Je(e))))return;e.flags|=2;let t=e.dep,n=E,r=Qe;E=e,Qe=!0;try{Ke(e);let n=e.fn(e._value);(t.version===0||S(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{E=n,Qe=r,qe(e),e.flags&=-3}}function Xe(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Xe(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Ze(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Qe=!0,$e=[];function et(){$e.push(Qe),Qe=!1}function tt(){let e=$e.pop();Qe=e===void 0||e}function nt(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=E;E=void 0;try{t()}finally{E=e}}}var rt=0,it=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},at=class{constructor(e){this.computed=e,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(e){if(!E||!Qe||E===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==E)t=this.activeLink=new it(E,this),E.deps?(t.prevDep=E.depsTail,E.depsTail.nextDep=t,E.depsTail=t):E.deps=E.depsTail=t,ot(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=E.depsTail,t.nextDep=void 0,E.depsTail.nextDep=t,E.depsTail=t,E.deps===t&&(E.deps=e)}return t}trigger(e){this.version++,rt++,this.notify(e)}notify(e){We();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ge()}}};function ot(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)ot(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var st=new WeakMap,ct=Symbol(``),lt=Symbol(``),ut=Symbol(``);function dt(e,t,n){if(Qe&&E){let t=st.get(e);t||st.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new at),r.map=t,r.key=n),r.track()}}function ft(e,t,n,r,i,a){let o=st.get(e);if(!o){rt++;return}let s=e=>{e&&e.trigger()};if(We(),t===`clear`)o.forEach(s);else{let i=p(e),a=i&&ie(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===ut||!y(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(ut)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(ct)),m(e)&&s(o.get(lt)));break;case`delete`:i||(s(o.get(ct)),m(e)&&s(o.get(lt)));break;case`set`:m(e)&&s(o.get(ct))}}Ge()}function pt(e){let t=D(e);return t===e||(dt(t,`iterate`,ut),Qt(e))?t:Zt(e)?Xt(e)?t.map(e=>nn(tn(e))):t.map(nn):t.map(tn)}function mt(e){return dt(e=D(e),`iterate`,ut),e}function ht(e,t){return Zt(e)?nn(Xt(e)?tn(t):t):tn(t)}var gt={__proto__:null,[Symbol.iterator](){return _t(this,Symbol.iterator,e=>ht(this,e))},concat(...e){return pt(this).concat(...e.map(e=>p(e)?pt(e):e))},entries(){return _t(this,`entries`,e=>(e[1]=ht(this,e[1]),e))},every(e,t){return yt(this,`every`,e,t,void 0,arguments)},filter(e,t){return yt(this,`filter`,e,t,e=>e.map(e=>ht(this,e)),arguments)},find(e,t){return yt(this,`find`,e,t,e=>ht(this,e),arguments)},findIndex(e,t){return yt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return yt(this,`findLast`,e,t,e=>ht(this,e),arguments)},findLastIndex(e,t){return yt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return yt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return xt(this,`includes`,e)},indexOf(...e){return xt(this,`indexOf`,e)},join(e){return pt(this).join(e)},lastIndexOf(...e){return xt(this,`lastIndexOf`,e)},map(e,t){return yt(this,`map`,e,t,void 0,arguments)},pop(){return St(this,`pop`)},push(...e){return St(this,`push`,e)},reduce(e,...t){return bt(this,`reduce`,e,t)},reduceRight(e,...t){return bt(this,`reduceRight`,e,t)},shift(){return St(this,`shift`)},some(e,t){return yt(this,`some`,e,t,void 0,arguments)},splice(...e){return St(this,`splice`,e)},toReversed(){return pt(this).toReversed()},toSorted(e){return pt(this).toSorted(e)},toSpliced(...e){return pt(this).toSpliced(...e)},unshift(...e){return St(this,`unshift`,e)},values(){return _t(this,`values`,e=>ht(this,e))}};function _t(e,t,n){let r=mt(e),i=r[t]();return r!==e&&!Qt(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var vt=Array.prototype;function yt(e,t,n,r,i,a){let o=mt(e),s=o!==e&&!Qt(e),c=o[t];if(c!==vt[t]){let t=c.apply(e,a);return s?tn(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,ht(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function bt(e,t,n,r){let i=mt(e),a=i!==e&&!Qt(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=ht(e,t)),n.call(this,t,ht(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?ht(e,c):c}function xt(e,t,n){let r=D(e);dt(r,`iterate`,ut);let i=r[t](...n);return(i===-1||i===!1)&&$t(n[0])?(n[0]=D(n[0]),r[t](...n)):i}function St(e,t,n=[]){et(),We();let r=D(e)[t].apply(e,n);return Ge(),tt(),r}var Ct=n(`__proto__,__v_isRef,__isVue`),wt=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(y));function Tt(e){y(e)||(e=String(e));let t=D(this);return dt(t,`has`,e),t.hasOwnProperty(e)}var Et=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Wt:Ut:i?Ht:Vt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=p(e);if(!r){let e;if(a&&(e=gt[t]))return e;if(t===`hasOwnProperty`)return Tt}let o=Reflect.get(e,t,rn(e)?e:n);if((y(t)?wt.has(t):Ct(t))||(r||dt(e,`get`,t),i))return o;if(rn(o)){let e=a&&ie(t)?o:o.value;return r&&b(e)?Jt(e):e}return b(o)?r?Jt(o):Kt(o):o}},Dt=class extends Et{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=p(e)&&ie(t);if(!this._isShallow){let e=Zt(i);if(!Qt(n)&&!Zt(n)&&(i=D(i),n=D(n)),!a&&rn(i)&&!rn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:f(e,t),s=Reflect.set(e,t,n,rn(e)?e:r);return e===D(r)&&s&&(o?S(n,i)&&ft(e,`set`,t,n,i):ft(e,`add`,t,n)),s}deleteProperty(e,t){let n=f(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&ft(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!y(t)||!wt.has(t))&&dt(e,`has`,t),n}ownKeys(e){return dt(e,`iterate`,p(e)?`length`:ct),Reflect.ownKeys(e)}},Ot=class extends Et{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},kt=new Dt,At=new Ot,jt=new Dt(!0),Mt=e=>e,Nt=e=>Reflect.getPrototypeOf(e);function Pt(e,t,n){return function(...r){let i=this.__v_raw,a=D(i),o=m(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,u=i[e](...r),d=n?Mt:t?nn:tn;return!t&&dt(a,`iterate`,c?lt:ct),l(Object.create(u),{next(){let{value:e,done:t}=u.next();return t?{value:e,done:t}:{value:s?[d(e[0]),d(e[1])]:d(e),done:t}}})}}function Ft(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function It(e,t){let n={get(n){let r=this.__v_raw,i=D(r),a=D(n);e||(S(n,a)&&dt(i,`get`,n),dt(i,`get`,a));let{has:o}=Nt(i),s=t?Mt:e?nn:tn;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&dt(D(t),`iterate`,ct),t.size},has(t){let n=this.__v_raw,r=D(n),i=D(t);return e||(S(t,i)&&dt(r,`has`,t),dt(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=D(a),s=t?Mt:e?nn:tn;return!e&&dt(o,`iterate`,ct),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return l(n,e?{add:Ft(`add`),set:Ft(`set`),delete:Ft(`delete`),clear:Ft(`clear`)}:{add(e){let n=D(this),r=Nt(n),i=D(e),a=!t&&!Qt(e)&&!Zt(e)?i:e;return r.has.call(n,a)||S(e,a)&&r.has.call(n,e)||S(i,a)&&r.has.call(n,i)||(n.add(a),ft(n,`add`,a,a)),this},set(e,n){!t&&!Qt(n)&&!Zt(n)&&(n=D(n));let r=D(this),{has:i,get:a}=Nt(r),o=i.call(r,e);o||=(e=D(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?S(n,s)&&ft(r,`set`,e,n,s):ft(r,`add`,e,n),this},delete(e){let t=D(this),{has:n,get:r}=Nt(t),i=n.call(t,e);i||=(e=D(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&ft(t,`delete`,e,void 0,a),o},clear(){let e=D(this),t=e.size!==0,n=e.clear();return t&&ft(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Pt(r,e,t)}),n}function Lt(e,t){let n=It(e,t);return(t,r,i)=>r===`__v_isReactive`?!e:r===`__v_isReadonly`?e:r===`__v_raw`?t:Reflect.get(f(n,r)&&r in t?n:t,r,i)}var Rt={get:Lt(!1,!1)},zt={get:Lt(!1,!0)},Bt={get:Lt(!0,!1)},Vt=new WeakMap,Ht=new WeakMap,Ut=new WeakMap,Wt=new WeakMap;function Gt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Kt(e){return Zt(e)?e:Yt(e,!1,kt,Rt,Vt)}function qt(e){return Yt(e,!1,jt,zt,Ht)}function Jt(e){return Yt(e,!0,At,Bt,Ut)}function Yt(e,t,n,r,i){if(!b(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=Gt(ne(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Xt(e){return Zt(e)?Xt(e.__v_raw):!!(e&&e.__v_isReactive)}function Zt(e){return!!(e&&e.__v_isReadonly)}function Qt(e){return!!(e&&e.__v_isShallow)}function $t(e){return e?!!e.__v_raw:!1}function D(e){let t=e&&e.__v_raw;return t?D(t):e}function en(e){return!f(e,`__v_skip`)&&Object.isExtensible(e)&&me(e,`__v_skip`,!0),e}var tn=e=>b(e)?Kt(e):e,nn=e=>b(e)?Jt(e):e;function rn(e){return e?e.__v_isRef===!0:!1}function O(e){return on(e,!1)}function an(e){return on(e,!0)}function on(e,t){return rn(e)?e:new sn(e,t)}var sn=class{constructor(e,t){this.dep=new at,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:D(e),this._value=t?e:tn(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Qt(e)||Zt(e);e=n?e:D(e),S(e,t)&&(this._rawValue=e,this._value=n?e:tn(e),this.dep.trigger())}};function k(e){return rn(e)?e.value:e}var cn={get:(e,t,n)=>t===`__v_raw`?e:k(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return rn(i)&&!rn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function ln(e){return Xt(e)?e:new Proxy(e,cn)}var un=class{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new at,{get:n,set:r}=e(t.track.bind(t),t.trigger.bind(t));this._get=n,this._set=r}get value(){return this._value=this._get()}set value(e){this._set(e)}};function dn(e){return new un(e)}var fn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new at(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=rt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&E!==this)return Ue(this,!0),!0}get value(){let e=this.dep.track();return Ye(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function pn(e,t,n=!1){let r,i;return _(e)?r=e:(r=e.get,i=e.set),new fn(r,i,n)}var mn={},hn=new WeakMap,gn=void 0;function _n(e,t=!1,n=gn){if(n){let t=hn.get(n);t||hn.set(n,t=[]),t.push(e)}}function vn(e,t,n=r){let{immediate:i,deep:o,once:s,scheduler:c,augmentJob:l,call:d}=n,f=e=>o?e:Qt(e)||o===!1||o===0?yn(e,1):yn(e),m,h,g,v,y=!1,b=!1;if(rn(e)?(h=()=>e.value,y=Qt(e)):Xt(e)?(h=()=>f(e),y=!0):p(e)?(b=!0,y=e.some(e=>Xt(e)||Qt(e)),h=()=>e.map(e=>{if(rn(e))return e.value;if(Xt(e))return f(e);if(_(e))return d?d(e,2):e()})):h=_(e)?t?d?()=>d(e,2):e:()=>{if(g){et();try{g()}finally{tt()}}let t=gn;gn=m;try{return d?d(e,3,[v]):e(v)}finally{gn=t}}:a,t&&o){let e=h,t=o===!0?1/0:o;h=()=>yn(e(),t)}let ee=Le(),te=()=>{m.stop(),ee&&ee.active&&u(ee.effects,m)};if(s&&t){let e=t;t=(...t)=>{let n=e(...t);return te(),n}}let x=b?Array(e.length).fill(mn):mn,ne=e=>{if(m.flags&1&&(m.dirty||e)){if(t){let n=m.run();if(e||o||y||(b?n.some((e,t)=>S(e,x[t])):S(n,x))){g&&g();let e=gn;gn=m;try{let e=[n,x===mn?void 0:b&&x[0]===mn?[]:x,v];x=n,d?d(t,3,e):t(...e)}finally{gn=e}}}else m.run()}};return l&&l(ne),m=new ze(h),m.scheduler=c?()=>c(ne,!1):ne,v=e=>_n(e,!1,m),g=m.onStop=()=>{let e=hn.get(m);if(e){if(d)d(e,4);else for(let t of e)t();hn.delete(m)}},t?i?ne(!0):x=m.run():c?c(ne.bind(null,!0),!0):m.run(),te.pause=m.pause.bind(m),te.resume=m.resume.bind(m),te.stop=te,te}function yn(e,t=1/0,n){if(t<=0||!b(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,rn(e))yn(e.value,t,n);else if(p(e))for(let r=0;r<e.length;r++)yn(e[r],t,n);else if(h(e)||m(e))e.forEach(e=>{yn(e,t,n)});else if(re(e)){for(let r in e)yn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&yn(e[r],t,n)}return e}function bn(e,t,n,r){try{return r?e(...r):e()}catch(e){Sn(e,t,n)}}function xn(e,t,n,r){if(_(e)){let i=bn(e,t,n,r);return i&&ee(i)&&i.catch(e=>{Sn(e,t,n)}),i}if(p(e)){let i=[];for(let a=0;a<e.length;a++)i.push(xn(e[a],t,n,r));return i}}function Sn(e,t,n,i=!0){let a=t?t.vnode:null,{errorHandler:o,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||r;if(t){let r=t.parent,i=t.proxy,a=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,a)===!1)return}r=r.parent}if(o){et(),bn(o,null,10,[e,i,a]),tt();return}}Cn(e,n,a,i,s)}function Cn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var wn=[],Tn=-1,En=[],Dn=null,On=0,kn=Promise.resolve(),An=null;function jn(e){let t=An||kn;return e?t.then(this?e.bind(this):e):t}function Mn(e){let t=Tn+1,n=wn.length;for(;t<n;){let r=t+n>>>1,i=wn[r],a=Rn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Nn(e){if(!(e.flags&1)){let t=Rn(e),n=wn[wn.length-1];!n||!(e.flags&2)&&t>=Rn(n)?wn.push(e):wn.splice(Mn(t),0,e),e.flags|=1,Pn()}}function Pn(){An||=kn.then(zn)}function Fn(e){if(!p(e))Dn&&e.id===-1?Dn.splice(On+1,0,e):e.flags&1||(En.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)En.push(e[t]);Pn()}function In(e,t,n=Tn+1){for(;n<wn.length;n++){let t=wn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;wn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function Ln(e){if(En.length){let e=[...new Set(En)].sort((e,t)=>Rn(e)-Rn(t));if(En.length=0,Dn){for(let t=0;t<e.length;t++)Dn.push(e[t]);return}for(Dn=e,On=0;On<Dn.length;On++){let e=Dn[On];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}Dn=null,On=0}}var Rn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function zn(e){try{for(Tn=0;Tn<wn.length;Tn++){let e=wn[Tn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),bn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Tn<wn.length;Tn++){let e=wn[Tn];e&&(e.flags&=-2)}Tn=-1,wn.length=0,Ln(e),An=null,(wn.length||En.length)&&zn(e)}}var Bn=null,Vn=null;function Hn(e){let t=Bn;return Bn=e,Vn=e&&e.type.__scopeId||null,t}function Un(e,t=Bn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&Oa(-1);let i=Hn(t),a=wa.length,o;try{o=e(...n)}finally{for(let e=wa.length;e>a;e--)Ea();Hn(i),r._d&&Oa(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Wn(e,t){if(Bn===null)return e;let n=ao(Bn),i=e.dirs||=[];for(let e=0;e<t.length;e++){let[a,o,s,c=r]=t[e];a&&(_(a)&&(a={mounted:a,updated:a}),a.deep&&yn(o),i.push({dir:a,instance:n,value:o,oldValue:void 0,arg:s,modifiers:c}))}return e}function Gn(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(et(),xn(c,n,8,[e.el,s,e,t]),tt())}}function Kn(e,t){if(Ga){let n=Ga.provides,r=Ga.parent&&Ga.parent.provides;r===n&&(n=Ga.provides=Object.create(r)),n[e]=t}}function qn(e,t,n=!1){let r=Ka();if(r||Ai){let i=Ai?Ai._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&_(t)?t.call(r&&r.proxy):t}}var Jn=Symbol.for(`v-scx`),Yn=()=>qn(Jn);function Xn(e,t){return Qn(e,null,{flush:`sync`})}function Zn(e,t,n){return Qn(e,t,n)}function Qn(e,t,n=r){let{immediate:i,deep:o,flush:s,once:c}=n,u=l({},n),d=t&&i||!t&&s!==`post`,f;if(Qa){if(s===`sync`){let e=Yn();f=e.__watcherHandles||=[]}else if(!d){let e=()=>{};return e.stop=a,e.resume=a,e.pause=a,e}}let p=Ga;u.call=(e,t,n)=>xn(e,p,t,n);let m=!1;s===`post`?u.scheduler=e=>{ca(e,p&&p.suspense)}:s!==`sync`&&(m=!0,u.scheduler=(e,t)=>{t?e():Nn(e)}),u.augmentJob=e=>{t&&(e.flags|=4),m&&(e.flags|=2,p&&(e.id=p.uid,e.i=p))};let h=vn(e,t,u);return Qa&&(f?f.push(h):d&&h()),h}function $n(e,t,n){let r=this.proxy,i=v(e)?e.includes(`.`)?er(r,e):()=>r[e]:e.bind(r,r),a;_(t)?a=t:(a=t.handler,n=t);let o=Ya(this),s=Qn(i,a.bind(r),n);return o(),s}function er(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var tr=new WeakMap,nr=Symbol(`_vte`),rr=e=>e.__isTeleport,ir=e=>e&&(e.disabled||e.disabled===``),ar=e=>e&&(e.defer||e.defer===``),or=e=>typeof SVGElement<`u`&&e instanceof SVGElement,sr=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,cr=(e,t)=>{let n=e&&e.to;return v(n)?t?t(n):null:n},lr={name:`Teleport`,__isTeleport:!0,process(e,t,n,r,i,a,o,s,c,l){let{mc:u,pc:d,pbc:f,o:{insert:p,querySelector:m,createText:h,createComment:g,parentNode:_}}=l,v=ir(t.props),{dynamicChildren:y}=t,b=(e,t,n)=>{e.shapeFlag&16&&u(e.children,t,n,i,a,o,s,c)},ee=(e=t)=>{let n=ir(e.props),r=e.target=cr(e.props,m),a=mr(r,e,h,p);r&&(o!==`svg`&&or(r)?o=`svg`:o!==`mathml`&&sr(r)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(r),n||(b(e,r,a),pr(e,!1)))},te=e=>{let t=()=>{if(tr.get(e)===t){if(tr.delete(e),ir(e.props)){let t=_(e.el)||n;b(e,t,e.anchor),pr(e,!0)}ee(e)}};tr.set(e,t),ca(t,a)};if(e==null){let e=t.el=h(``),i=t.anchor=h(``);if(p(e,n,r),p(i,n,r),ar(t.props)||a&&a.pendingBranch){te(t);return}v&&(b(t,n,i),pr(t,!0)),ee()}else{t.el=e.el;let r=t.anchor=e.anchor,u=tr.get(e);if(u){u.flags|=8,tr.delete(e),te(t);return}t.targetStart=e.targetStart;let p=t.target=e.target,h=t.targetAnchor=e.targetAnchor,g=ir(e.props),_=g?n:p,b=g?r:h;if(o===`svg`||or(p)?o=`svg`:(o===`mathml`||sr(p))&&(o=`mathml`),y?(f(e.dynamicChildren,y,_,i,a,o,s),ma(e,t,!0)):c||d(e,t,_,b,i,a,o,s,!1),v)g?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):ur(t,n,r,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=cr(t.props,m);e&&(t.target=e,ur(t,e,null,l,0))}else g&&ur(t,p,h,l,1);pr(t,v)}},remove(e,t,n,{um:r,o:{remove:i}},a){let{shapeFlag:o,children:s,anchor:c,targetStart:l,targetAnchor:u,target:d,props:f}=e,p=ir(f),m=a||!p,h=tr.get(e);if(h&&(h.flags|=8,tr.delete(e)),d&&(i(l),i(u)),a&&i(c),!h&&(p||d)&&o&16)for(let e=0;e<s.length;e++){let i=s[e];r(i,t,n,m,!!i.dynamicChildren)}},move:ur,hydrate:dr};function ur(e,t,n,{o:{insert:r},m:i},a=2){a===0&&r(e.targetAnchor,t,n);let{el:o,anchor:s,shapeFlag:c,children:l,props:u}=e,d=a===2;if(d&&r(o,t,n),!tr.has(e)&&(!d||ir(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function dr(e,t,n,r,i,a,{o:{nextSibling:o,parentNode:s,querySelector:c,insert:l,createText:u}},d){function f(e,n){let r=n;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,e._lpa=t.targetAnchor&&o(t.targetAnchor);break}}r=o(r)}}function p(e,t){t.anchor=d(o(e),t,s(e),n,r,i,a)}let m=t.target=cr(t.props,c),h=ir(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||mr(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||mr(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),pr(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var fr=lr;function pr(e,t){let n=e.ctx;if(n&&n.ut){let r,i;for(t?(r=e.el,i=e.anchor):(r=e.targetStart,i=e.targetAnchor);r&&r!==i;)r.nodeType===1&&r.setAttribute(`data-v-owner`,n.uid),r=r.nextSibling;n.ut()}}function mr(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[nr]=o,e&&(r(a,e,i),r(o,e,i)),o}var hr=Symbol(`_leaveCb`),gr=Symbol(`_enterCb`);function _r(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Wr(()=>{e.isMounted=!0}),qr(()=>{e.isUnmounting=!0}),e}var vr=[Function,Array],yr={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:vr,onEnter:vr,onAfterEnter:vr,onEnterCancelled:vr,onBeforeLeave:vr,onLeave:vr,onAfterLeave:vr,onLeaveCancelled:vr,onBeforeAppear:vr,onAppear:vr,onAfterAppear:vr,onAppearCancelled:vr},br=e=>{let t=e.subTree;return t.component?br(t.component):t},xr={name:`BaseTransition`,props:yr,setup(e,{slots:t}){let n=Ka(),r=_r();return()=>{let i=t.default&&kr(t.default(),!0),a=i&&i.length?Sr(i):n.subTree?z():void 0;if(!a)return;let o=D(e),{mode:s}=o;if(r.isLeaving)return Er(a);let c=Dr(a);if(!c)return Er(a);let l=Tr(c,o,r,n,e=>l=e);c.type!==Sa&&Or(c,l);let u=n.subTree&&Dr(n.subTree);if(u&&u.type!==Sa&&!ja(u,c)&&br(n).type!==Sa){let e=Tr(u,o,r,n);if(Or(u,e),s===`out-in`&&c.type!==Sa)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,u=void 0},Er(a);s===`in-out`&&c.type!==Sa?e.delayLeave=(e,t,n)=>{let i=wr(r,u);i[String(u.key)]=u,e[hr]=()=>{t(),e[hr]=void 0,delete l.delayedLeave,u=void 0},l.delayedLeave=()=>{n(),delete l.delayedLeave,u=void 0}}:u=void 0}else u&&=void 0;return a}}};function Sr(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Sa){t=n;break}}return t}var Cr=xr;function wr(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Tr(e,t,n,r,i){let{appear:a,mode:o,persisted:s=!1,onBeforeEnter:c,onEnter:l,onAfterEnter:u,onEnterCancelled:d,onBeforeLeave:f,onLeave:m,onAfterLeave:h,onLeaveCancelled:g,onBeforeAppear:_,onAppear:v,onAfterAppear:y,onAppearCancelled:b}=t,ee=String(e.key),te=wr(n,e),x=(e,t)=>{e&&xn(e,r,9,t)},ne=(e,t)=>{let n=t[1];x(e,t),p(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},re={mode:o,persisted:s,beforeEnter(t){let r=c;if(!n.isMounted){if(a)r=_||c;else return}t[hr]&&t[hr](!0);let i=te[ee];i&&ja(e,i)&&i.el[hr]&&i.el[hr](),x(r,[t])},enter(t){if(te[ee]===e)return;let r=l,i=u,o=d;if(!n.isMounted){if(a)r=v||l,i=y||u,o=b||d;else return}let s=!1;t[gr]=e=>{s||(s=!0,x(e?o:i,[t]),re.delayedLeave&&re.delayedLeave(),t[gr]=void 0)};let c=t[gr].bind(null,!1);r?ne(r,[t,c]):c()},leave(t,r){let i=String(e.key);if(t[gr]&&t[gr](!0),n.isUnmounting)return r();x(f,[t]);let a=!1;t[hr]=n=>{a||(a=!0,r(),x(n?g:h,[t]),t[hr]=void 0,te[i]===e&&delete te[i])};let o=t[hr].bind(null,!1);te[i]=e,m?ne(m,[t,o]):o()},clone(e){let a=Tr(e,t,n,r,i);return i&&i(a),a}};return re}function Er(e){if(Ir(e))return e=Ia(e),e.children=null,e}function Dr(e){if(!Ir(e))return rr(e.type)&&e.children?Sr(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&_(n.default))return n.default()}}function Or(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;Or(rr(n.type)&&Dr(n)||n,t)}else e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function kr(e,t=!1,n){let r=[],i=0;for(let a=0;a<e.length;a++){let o=e[a],s=n==null?o.key:String(n)+String(o.key==null?a:o.key);o.type===M?(o.patchFlag&128&&i++,r=r.concat(kr(o.children,t,s))):(t||o.type!==Sa)&&r.push(s==null?o:Ia(o,{key:s}))}if(i>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function A(e,t){return _(e)?l({name:e.name},t,{setup:e}):e}function Ar(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function jr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var Mr=new WeakMap;function Nr(e,t,n,i,a=!1){if(p(e)){e.forEach((e,r)=>Nr(e,t&&(p(t)?t[r]:t),n,i,a));return}if(Fr(i)&&!a){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Nr(e,t,n,i.component.subTree);return}let s=i.shapeFlag&4?ao(i.component):i.el,c=a?null:s,{i:l,r:d}=e,m=t&&t.r,h=l.refs===r?l.refs={}:l.refs,g=l.setupState,y=D(g),b=g===r?o:e=>!jr(h,e)&&f(y,e),ee=(e,t)=>!(t&&jr(h,t));if(m!=null&&m!==d){if(Pr(t),v(m))h[m]=null,b(m)&&(g[m]=null);else if(rn(m)){let e=t;ee(m,e.k)&&(m.value=null),e.k&&(h[e.k]=null)}}if(_(d))bn(d,l,12,[c,h]);else{let t=v(d),r=rn(d);if(t||r){let i=()=>{if(e.f){let n=t?b(d)?g[d]:h[d]:ee(d)||!e.k?d.value:h[e.k];if(a)p(n)&&u(n,s);else if(p(n))n.includes(s)||n.push(s);else if(t)h[d]=[s],b(d)&&(g[d]=h[d]);else{let t=[s];ee(d,e.k)&&(d.value=t),e.k&&(h[e.k]=t)}}else t?(h[d]=c,b(d)&&(g[d]=c)):r&&(ee(d,e.k)&&(d.value=c),e.k&&(h[e.k]=c))};if(c){let t=()=>{i(),Mr.delete(e)};t.id=-1,Mr.set(e,t),ca(t,n)}else Pr(e),i()}}}function Pr(e){let t=Mr.get(e);t&&(t.flags|=8,Mr.delete(e))}ve().requestIdleCallback,ve().cancelIdleCallback;var Fr=e=>!!e.type.__asyncLoader,Ir=e=>e.type.__isKeepAlive;function Lr(e,t){zr(e,`a`,t)}function Rr(e,t){zr(e,`da`,t)}function zr(e,t,n=Ga){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Vr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Ir(e.parent.vnode)&&Br(r,t,n,e),e=e.parent}}function Br(e,t,n,r){let i=Vr(t,e,r,!0);Jr(()=>{u(r[t],i)},n)}function Vr(e,t,n=Ga,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{et();let i=Ya(n),a=xn(t,n,e,r);return i(),tt(),a};return r?i.unshift(a):i.push(a),a}}var Hr=e=>(t,n=Ga)=>{(!Qa||e===`sp`)&&Vr(e,(...e)=>t(...e),n)},Ur=Hr(`bm`),Wr=Hr(`m`),Gr=Hr(`bu`),Kr=Hr(`u`),qr=Hr(`bum`),Jr=Hr(`um`),Yr=Hr(`sp`),Xr=Hr(`rtg`),Zr=Hr(`rtc`);function Qr(e,t=Ga){Vr(`ec`,e,t)}var $r=`components`;function ei(e,t){return ri($r,e,!0,t)||e}var ti=Symbol.for(`v-ndc`);function ni(e){return v(e)?ri($r,e,!1)||e:e||ti}function ri(e,t,n=!0,r=!1){let i=Bn||Ga;if(i){let n=i.type;if(e===$r){let e=oo(n,!1);if(e&&(e===t||e===ce(t)||e===de(ce(t))))return n}let a=ii(i[e]||n[e],t)||ii(i.appContext[e],t);return!a&&r?n:a}}function ii(e,t){return e&&(e[t]||e[ce(t)]||e[de(ce(t))])}function j(e,t,n,r){let i,a=n&&n[r],o=p(e);if(o||v(e)){let n=o&&Xt(e),r=!1,s=!1;n&&(r=!Qt(e),s=Zt(e),e=mt(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?nn(tn(e[n])):tn(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}else if(b(e)){if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}}else i=[];return n&&(n[r]=i),i}var ai=e=>e?Za(e)?ao(e):ai(e.parent):null,oi=l(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=>ai(e.parent),$root:e=>ai(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>_i(e),$forceUpdate:e=>e.f||=()=>{Nn(e.update)},$nextTick:e=>e.n||=jn.bind(e.proxy),$watch:e=>$n.bind(e)}),si=(e,t)=>e!==r&&!e.__isScriptSetup&&f(e,t),ci={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:i,data:a,props:o,accessCache:s,type:c,appContext:l}=e;if(t[0]!==`$`){let e=s[t];if(e!==void 0)switch(e){case 1:return i[t];case 2:return a[t];case 4:return n[t];case 3:return o[t]}else if(si(i,t))return s[t]=1,i[t];else if(a!==r&&f(a,t))return s[t]=2,a[t];else if(f(o,t))return s[t]=3,o[t];else if(n!==r&&f(n,t))return s[t]=4,n[t];else fi&&(s[t]=0)}let u=oi[t],d,p;if(u)return t===`$attrs`&&dt(e.attrs,`get`,``),u(e);if((d=c.__cssModules)&&(d=d[t]))return d;if(n!==r&&f(n,t))return s[t]=4,n[t];if(p=l.config.globalProperties,f(p,t))return p[t]},set({_:e},t,n){let{data:i,setupState:a,ctx:o}=e;return si(a,t)?(a[t]=n,!0):i!==r&&f(i,t)?(i[t]=n,!0):f(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(o[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:i,appContext:a,props:o,type:s}},c){let l;return!!(n[c]||e!==r&&c[0]!==`$`&&f(e,c)||si(t,c)||f(o,c)||f(i,c)||f(oi,c)||f(a.config.globalProperties,c)||(l=s.__cssModules)&&l[c])},defineProperty(e,t,n){return n.get==null?f(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function li(e){return p(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function ui(e,t){return!e||!t?e||t:p(e)&&p(t)?e.concat(t):l({},li(e),li(t))}function di(e){let t=Ka(),n=Qa,r=e();Xa(),n&&Ja(!1);let i=()=>{Ya(t),n&&Ja(!0)},a=()=>{Ka()!==t&&t.scope.off(),Xa(),n&&Ja(!1)};return ee(r)&&(r=r.catch(e=>{throw i(),Promise.resolve().then(()=>Promise.resolve().then(a)),e})),[r,()=>{i(),Promise.resolve().then(a)}]}var fi=!0;function pi(e){let t=_i(e),n=e.proxy,r=e.ctx;fi=!1,t.beforeCreate&&hi(t.beforeCreate,e,`bc`);let{data:i,computed:o,methods:s,watch:c,provide:l,inject:u,created:d,beforeMount:f,mounted:m,beforeUpdate:h,updated:g,activated:v,deactivated:y,beforeDestroy:ee,beforeUnmount:te,destroyed:x,unmounted:ne,render:re,renderTracked:ie,renderTriggered:ae,errorCaptured:oe,serverPrefetch:se,expose:ce,inheritAttrs:le,components:ue,directives:de,filters:fe}=t;if(u&&mi(u,r,null),s)for(let e in s){let t=s[e];_(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);b(t)&&(e.data=Kt(t))}if(fi=!0,o)for(let e in o){let t=o[e],i=B({get:_(t)?t.bind(n,n):_(t.get)?t.get.bind(n,n):a,set:!_(t)&&_(t.set)?t.set.bind(n):a});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(c)for(let e in c)gi(c[e],r,n,e);if(l){let e=_(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{Kn(t,e[t])})}d&&hi(d,e,`c`);function S(e,t){p(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(S(Ur,f),S(Wr,m),S(Gr,h),S(Kr,g),S(Lr,v),S(Rr,y),S(Qr,oe),S(Zr,ie),S(Xr,ae),S(qr,te),S(Jr,ne),S(Yr,se),p(ce)){if(ce.length){let t=e.exposed||={};ce.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}re&&e.render===a&&(e.render=re),le!=null&&(e.inheritAttrs=le),ue&&(e.components=ue),de&&(e.directives=de),se&&Ar(e)}function mi(e,t,n=a){p(e)&&(e=Si(e));for(let n in e){let r=e[n],i;i=b(r)?`default`in r?qn(r.from||n,r.default,!0):qn(r.from||n):qn(r),rn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function hi(e,t,n){xn(p(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function gi(e,t,n,r){let i=r.includes(`.`)?er(n,r):()=>n[r];if(v(e)){let n=t[e];_(n)&&Zn(i,n)}else if(_(e))Zn(i,e.bind(n));else if(b(e)){if(p(e))e.forEach(e=>gi(e,t,n,r));else{let r=_(e.handler)?e.handler.bind(n):t[e.handler];_(r)&&Zn(i,r,e)}}}function _i(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>vi(c,e,o,!0)),vi(c,t,o)),b(t)&&a.set(t,c),c}function vi(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&vi(e,a,n,!0),i&&i.forEach(t=>vi(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=yi[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var yi={data:bi,props:Ti,emits:Ti,methods:wi,computed:wi,beforeCreate:Ci,created:Ci,beforeMount:Ci,mounted:Ci,beforeUpdate:Ci,updated:Ci,beforeDestroy:Ci,beforeUnmount:Ci,destroyed:Ci,unmounted:Ci,activated:Ci,deactivated:Ci,errorCaptured:Ci,serverPrefetch:Ci,components:wi,directives:wi,watch:Ei,provide:bi,inject:xi};function bi(e,t){return t?e?function(){return l(_(e)?e.call(this,this):e,_(t)?t.call(this,this):t)}:t:e}function xi(e,t){return wi(Si(e),Si(t))}function Si(e){if(p(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ci(e,t){return e?[...new Set([].concat(e,t))]:t}function wi(e,t){return e?l(Object.create(null),e,t):t}function Ti(e,t){return e?p(e)&&p(t)?[...new Set([...e,...t])]:l(Object.create(null),li(e),li(t??{})):t}function Ei(e,t){if(!e)return t;if(!t)return e;let n=l(Object.create(null),e);for(let r in t)n[r]=Ci(e[r],t[r]);return n}function Di(){return{app:null,config:{isNativeTag:o,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}}var Oi=0;function ki(e,t){return function(n,r=null){_(n)||(n=l({},n)),r!=null&&!b(r)&&(r=null);let i=Di(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:Oi++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:lo,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&_(e.install)?(a.add(e),e.install(c,...t)):_(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||L(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,ao(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(xn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=Ai;Ai=c;try{return e()}finally{Ai=t}}};return c}}var Ai=null;function ji(e,t,n=r){let i=Ka(),a=ce(t),o=ue(t),s=Mi(e,a),c=dn((s,c)=>{let l,u=r,d;return Xn(()=>{let t=e[a];S(l,t)&&(l=t,c())}),{get(){return s(),n.get?n.get(l):l},set(e){let s=n.set?n.set(e):e;if(!S(s,l)&&!(u!==r&&S(e,u)))return;let f=i.vnode.props,p=!!(f&&(t in f||a in f||o in f)&&(`onUpdate:${t}`in f||`onUpdate:${a}`in f||`onUpdate:${o}`in f));p||(l=e,c()),i.emit(`update:${t}`,s),S(e,u)&&(S(e,s)&&!S(s,d)||p&&u!==r&&!S(s,l))&&c(),u=e,d=s}}});return c[Symbol.iterator]=()=>{let e=0;return{next(){return e<2?{value:e++?s||r:c,done:!1}:{done:!0}}}},c}var Mi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${ce(t)}Modifiers`]||e[`${ue(t)}Modifiers`];function Ni(e,t,...n){if(e.isUnmounted)return;let i=e.vnode.props||r,a=n,o=t.startsWith(`update:`),s=o&&Mi(i,t.slice(7));s&&(s.trim&&(a=n.map(e=>v(e)?e.trim():e)),s.number&&(a=a.map(he)));let c,l=i[c=fe(t)]||i[c=fe(ce(t))];!l&&o&&(l=i[c=fe(ue(t))]),l&&xn(l,e,6,a);let u=i[c+`Once`];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[c])return;e.emitted[c]=!0,xn(u,e,6,a)}}var Pi=new WeakMap;function Fi(e,t,n=!1){let r=n?Pi:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!_(e)){let r=e=>{let n=Fi(e,t,!0);n&&(s=!0,l(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(b(e)&&r.set(e,null),null):(p(a)?a.forEach(e=>o[e]=null):l(o,a),b(e)&&r.set(e,o),o)}function Ii(e,t){return!e||!s(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),f(e,t[0].toLowerCase()+t.slice(1))||f(e,ue(t))||f(e,t))}function Li(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:l,render:u,renderCache:d,props:f,data:p,setupState:m,ctx:h,inheritAttrs:g}=e,_=Hn(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=La(u.call(t,e,d,f,m,p,h)),y=s}else{let e=t;v=La(e.length>1?e(f,{attrs:s,slots:o,emit:l}):e(f,null)),y=t.props?s:Ri(s)}}catch(t){wa.length=0,Sn(t,e,1),v=L(Sa)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(c)&&(y=zi(y,a)),b=Ia(b,y,!1,!0))}return n.dirs&&(b=Ia(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Or(rr(b.type)&&Dr(b)||b,n.transition),v=b,Hn(_),v}var Ri=e=>{let t;for(let n in e)(n===`class`||n===`style`||s(n))&&((t||={})[n]=e[n]);return t},zi=(e,t)=>{let n={};for(let r in e)(!c(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Bi(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?Vi(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(Hi(o,r,n)&&!Ii(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||Vi(r,o,l):!!o;return!1}function Vi(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(Hi(t,e,a)&&!Ii(n,a))return!0}return!1}function Hi(e,t,n){let r=e[n],i=t[n];return n===`style`&&b(r)&&b(i)?!Ae(r,i):r!==i}function Ui({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var Wi={},Gi=()=>Object.create(Wi),Ki=e=>Object.getPrototypeOf(e)===Wi;function qi(e,t,n,r=!1){let i={},a=Gi();e.propsDefaults=Object.create(null),Yi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:qt(i):e.type.props?i:a,e.attrs=a}function Ji(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=D(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(Ii(e.emitsOptions,o))continue;let u=t[o];if(c){if(f(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=ce(o);i[t]=Xi(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{Yi(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!f(t,a)&&((r=ue(a))===a||!f(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Xi(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!f(t,e))&&(delete a[e],l=!0)}l&&ft(e.attrs,`set`,``)}function Yi(e,t,n,i){let[a,o]=e.propsOptions,s=!1,c;if(t)for(let r in t){if(ae(r))continue;let l=t[r],u;a&&f(a,u=ce(r))?!o||!o.includes(u)?n[u]=l:(c||={})[u]=l:Ii(e.emitsOptions,r)||(!(r in i)||l!==i[r])&&(i[r]=l,s=!0)}if(o){let t=D(n),i=c||r;for(let r=0;r<o.length;r++){let s=o[r];n[s]=Xi(a,t,s,i[s],e,!f(i,s))}}return s}function Xi(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=f(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&_(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=Ya(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===ue(n))&&(r=!0))}return r}var Zi=new WeakMap;function Qi(e,t,n=!1){let a=n?Zi:t.propsCache,o=a.get(e);if(o)return o;let s=e.props,c={},u=[],d=!1;if(!_(e)){let r=e=>{d=!0;let[n,r]=Qi(e,t,!0);l(c,n),r&&u.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!s&&!d)return b(e)&&a.set(e,i),i;if(p(s))for(let e=0;e<s.length;e++){let t=ce(s[e]);$i(t)&&(c[t]=r)}else if(s)for(let e in s){let t=ce(e);if($i(t)){let n=s[e],r=c[t]=p(n)||_(n)?{type:n}:l({},n),i=r.type,a=!1,o=!0;if(p(i))for(let e=0;e<i.length;++e){let t=i[e],n=_(t)&&t.name;if(n===`Boolean`){a=!0;break}n===`String`&&(o=!1)}else a=_(i)&&i.name===`Boolean`;r[0]=a,r[1]=o,(a||f(r,`default`))&&u.push(t)}}let m=[c,u];return b(e)&&a.set(e,m),m}function $i(e){return e[0]!==`$`&&!ae(e)}var ea=e=>e===`_`||e===`_ctx`||e===`$stable`,ta=e=>p(e)?e.map(La):[La(e)],na=(e,t,n)=>{if(t._n)return t;let r=Un((...e)=>ta(t(...e)),n);return r._c=!1,r},ra=(e,t,n)=>{let r=e._ctx;for(let n in e){if(ea(n))continue;let i=e[n];if(_(i))t[n]=na(n,i,r);else if(i!=null){let e=ta(i);t[n]=()=>e}}},ia=(e,t)=>{let n=ta(t);e.slots.default=()=>n},aa=(e,t,n)=>{for(let r in t)(n||!ea(r))&&(e[r]=t[r])},oa=(e,t,n)=>{let r=e.slots=Gi();if(e.vnode.shapeFlag&32){let e=t._;e?(aa(r,t,n),n&&me(r,`_`,e,!0)):ra(t,r)}else t&&ia(e,t)},sa=(e,t,n)=>{let{vnode:i,slots:a}=e,o=!0,s=r;if(i.shapeFlag&32){let e=t._;e?n&&e===1?o=!1:aa(a,t,n):(o=!t.$stable,ra(t,a)),s=t}else t&&(ia(e,t),s={default:1});if(o)for(let e in a)!ea(e)&&s[e]==null&&delete a[e]},ca=ba;function la(e){return ua(e)}function ua(e,t){let n=ve();n.__VUE__=!0;let{insert:o,remove:s,patchProp:c,createElement:l,createText:u,createComment:d,setText:f,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=a,insertStaticContent:_}=e,v=(e,t,n,r=null,a=null,o=null,s=void 0,c=null,l=!!t.dynamicChildren)=>{if(e===t)return;e&&!ja(e,t)&&(r=Te(e),xe(e,a,o,!0),e=null),t.patchFlag===-2&&(l=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===i&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);let{type:u,ref:d,shapeFlag:f}=t;switch(u){case xa:y(e,t,n,r);break;case Sa:b(e,t,n,r);break;case Ca:e??ee(t,n,r,s);break;case M:ue(e,t,n,r,a,o,s,c,l);break;default:f&1?ne(e,t,n,r,a,o,s,c,l):f&6?de(e,t,n,r,a,o,s,c,l):(f&64||f&128)&&u.process(e,t,n,r,a,o,s,c,l,w)}d!=null&&a?Nr(d,e&&e.ref,o,t||e,!t):d==null&&e&&e.ref!=null&&Nr(e.ref,null,o,e,!0)},y=(e,t,n,r)=>{if(e==null)o(t.el=u(t.children),n,r);else{let n=t.el=e.el;t.children!==e.children&&f(n,t.children)}},b=(e,t,n,r)=>{e==null?o(t.el=d(t.children||``),n,r):t.el=e.el},ee=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},te=({el:e,anchor:t},n,r)=>{let i;for(;e&&e!==t;)i=h(e),o(e,n,r),e=i;o(t,n,r)},x=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),s(e),e=n;s(t)},ne=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)re(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),se(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},re=(e,t,n,r,i,a,s,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=l(e.type,a,m&&m.is,m),h&8?p(d,e.children):h&16&&oe(e.children,d,null,r,i,da(e,a),s,u),_&&Gn(e,null,r,`created`),ie(d,e,e.scopeId,s,r),m){for(let e in m)e!==`value`&&!ae(e)&&c(d,e,null,m[e],a,r);`value`in m&&c(d,`value`,null,m.value,a),(f=m.onVnodeBeforeMount)&&Va(f,r,e)}_&&Gn(e,null,r,`beforeMount`);let v=pa(i,g);v&&g.beforeEnter(d),o(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&ca(()=>{try{f&&Va(f,r,e),v&&g.enter(d),_&&Gn(e,null,r,`mounted`)}finally{}},i)},ie=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||ya(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;ie(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},oe=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?Ra(e[l]):La(e[l]);v(null,c,t,n,r,i,a,o,s)}},se=(e,t,n,i,a,o,s)=>{let l=t.el=e.el,{patchFlag:u,dynamicChildren:d,dirs:f}=t;u|=e.patchFlag&16;let m=e.props||r,h=t.props||r,g;if(n&&fa(n,!1),(g=h.onVnodeBeforeUpdate)&&Va(g,n,t,e),f&&Gn(t,e,n,`beforeUpdate`),n&&fa(n,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(u=0,s=!1,d=null),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(l,``),d?ce(e.dynamicChildren,d,l,n,i,da(t,a),o):s||ge(e,t,l,null,n,i,da(t,a),o,!1),u>0){if(u&16)le(l,m,h,n,a);else if(u&2&&m.class!==h.class&&c(l,`class`,null,h.class,a),u&4&&c(l,`style`,m.style,h.style,a),u&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],i=m[r],o=h[r];(o!==i||r===`value`)&&c(l,r,i,o,a,n)}}u&1&&e.children!==t.children&&p(l,t.children)}else!s&&d==null&&le(l,m,h,n,a);((g=h.onVnodeUpdated)||f)&&ca(()=>{g&&Va(g,n,t,e),f&&Gn(t,e,n,`updated`)},i)},ce=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el&&(c.type===M||!ja(c,l)||c.shapeFlag&198)?m(c.el):n;v(c,l,u,null,r,i,a,o,!0)}},le=(e,t,n,i,a)=>{if(t!==n){if(t!==r)for(let r in t)!ae(r)&&!(r in n)&&c(e,r,t[r],null,a,i);for(let r in n){if(ae(r))continue;let o=n[r],s=t[r];o!==s&&r!==`value`&&c(e,r,s,o,a,i)}`value`in n&&c(e,`value`,t.value,n.value,a)}},ue=(e,t,n,r,i,a,s,c,l)=>{let d=t.el=e?e.el:u(``),f=t.anchor=e?e.anchor:u(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(c=c?c.concat(h):h),e==null?(o(d,n,r),o(f,n,r),oe(t.children||[],n,f,i,a,s,c,l)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(ce(e.dynamicChildren,m,n,i,a,s,c),(t.key!=null||i&&t===i.subTree)&&ma(e,t,!0)):ge(e,t,n,f,i,a,s,c,l)},de=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):fe(t,n,r,i,a,o,c):S(e,t,c)},fe=(e,t,n,r,i,a,o)=>{let s=e.component=Wa(e,r,i);if(Ir(e)&&(s.ctx.renderer=w),$a(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,me,o),!e.el){let r=s.subTree=L(Sa);b(null,r,t,n),e.placeholder=r.el}}else me(s,e,t,n,i,a,o)},S=(e,t,n)=>{let r=t.component=e.component;if(Bi(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,he(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},me=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=ga(e);if(n){t&&(t.el=c.el,he(e,t,o)),n.asyncDep.then(()=>{ca(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;fa(e,!1),t?(t.el=c.el,he(e,t,o)):t=c,n&&pe(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&Va(d,s,t,c),fa(e,!0);let f=Li(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),Te(p),e,i,a),t.el=f.el,u===null&&Ui(e,f.el),r&&ca(r,i),(d=t.props&&t.props.onVnodeUpdated)&&ca(()=>Va(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=Fr(t);if(fa(e,!1),l&&pe(l),!m&&(o=c&&c.onVnodeBeforeMount)&&Va(o,d,t),fa(e,!0),s&&ke){let t=()=>{e.subTree=Li(e),ke(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=Li(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&ca(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;ca(()=>Va(o,d,e),i)}(t.shapeFlag&256||d&&Fr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&ca(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new ze(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Nn(u),fa(e,!0),l()},he=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Ji(e,t.props,r,n),sa(e,t.children,n),et(),In(e),tt()},ge=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){ye(l,d,n,r,i,a,o,s,c);return}if(f&256){_e(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&we(l,i,a),d!==l&&p(n,d)):u&16?m&16?ye(l,d,n,r,i,a,o,s,c):we(l,i,a,!0):(u&8&&p(n,``),m&16&&oe(d,n,r,i,a,o,s,c))},_e=(e,t,n,r,a,o,s,c,l)=>{e||=i,t||=i;let u=e.length,d=t.length,f=Math.min(u,d),p=0;for(;p<f;p++){let r=t[p]=l?Ra(t[p]):La(t[p]);v(e[p],r,n,null,a,o,s,c,l)}u>d?we(e,a,o,!0,!1,f):oe(t,n,r,a,o,s,c,l,f)},ye=(e,t,n,r,a,o,s,c,l)=>{let u=0,d=t.length,f=e.length-1,p=d-1;for(;u<=f&&u<=p;){let r=e[u],i=t[u]=l?Ra(t[u]):La(t[u]);if(ja(r,i))v(r,i,n,null,a,o,s,c,l);else break;u++}for(;u<=f&&u<=p;){let r=e[f],i=t[p]=l?Ra(t[p]):La(t[p]);if(ja(r,i))v(r,i,n,null,a,o,s,c,l);else break;f--,p--}if(u>f){if(u<=p){let e=p+1,i=e<d?t[e].el:r;for(;u<=p;)v(null,t[u]=l?Ra(t[u]):La(t[u]),n,i,a,o,s,c,l),u++}}else if(u>p)for(;u<=f;)xe(e[u],a,o,!0),u++;else{let m=u,h=u,g=new Map;for(u=h;u<=p;u++){let e=t[u]=l?Ra(t[u]):La(t[u]);e.key!=null&&g.set(e.key,u)}let _,y=0,b=p-h+1,ee=!1,te=0,x=Array(b);for(u=0;u<b;u++)x[u]=0;for(u=m;u<=f;u++){let r=e[u];if(y>=b){xe(r,a,o,!0);continue}let i;if(r.key!=null)i=g.get(r.key);else for(_=h;_<=p;_++)if(x[_-h]===0&&ja(r,t[_])){i=_;break}i===void 0?xe(r,a,o,!0):(x[i-h]=u+1,i>=te?te=i:ee=!0,v(r,t[i],n,null,a,o,s,c,l),y++)}let ne=ee?ha(x):i;for(_=ne.length-1,u=b-1;u>=0;u--){let e=h+u,i=t[e],f=t[e+1],p=e+1<d?f.el||va(f):r;x[u]===0?v(null,i,n,p,a,o,s,c,l):ee&&(_<0||u!==ne[_]?be(i,n,p,2):_--)}}},be=(e,t,n,r,i=null)=>{let{el:a,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){be(e.component.subTree,t,n,r);return}if(d&128){e.suspense.move(t,n,r);return}if(d&64){c.move(e,t,n,w);return}if(c===M){o(a,t,n);for(let e=0;e<u.length;e++)be(u[e],t,n,r);o(e.anchor,t,n);return}if(c===Ca){te(e,t,n);return}if(r!==2&&d&1&&l){if(r===0)l.persisted&&!a[hr]?o(a,t,n):(l.beforeEnter(a),o(a,t,n),ca(()=>l.enter(a),i));else{let{leave:r,delayLeave:i,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?s(a):o(a,t,n)},d=()=>{let e=a._isLeaving||!!a[hr];a._isLeaving&&a[hr](!0),l.persisted&&!e?u():r(a,()=>{u(),c&&c()})};i?i(a,u,d):d()}}else o(a,t,n)},xe=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if((d===-2||l&&l.hasOnce)&&(i=!1),s!=null&&(et(),Nr(s,null,n,e,!0),tt()),p!=null&&(!e.ctx||e.ctx===t)&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!Fr(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&Va(_,t,e),u&6)C(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Gn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,w,r):l&&!l.hasOnce&&(a!==M||d>0&&d&64)?we(l,t,n,!1,!0):(a===M&&d&384||!i&&u&16)&&we(c,t,n),r&&Se(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&ca(()=>{_&&Va(_,t,e),h&&Gn(e,null,t,`unmounted`),v&&(e.el=null)},n)},Se=e=>{let{type:t,el:n,anchor:r,transition:i}=e;if(t===M){Ce(n,r);return}if(t===Ca){x(e),i&&!i.persisted&&i.afterLeave&&i.afterLeave();return}let a=()=>{s(n),i&&!i.persisted&&i.afterLeave&&i.afterLeave()};if(e.shapeFlag&1&&i&&!i.persisted){let{leave:t,delayLeave:r}=i,o=()=>t(n,a);r?r(e.el,a,o):o()}else a()},Ce=(e,t)=>{let n;for(;e!==t;)n=h(e),s(e),e=n;s(t)},C=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;_a(c),_a(l),r&&pe(r),i.stop(),a?(a.flags|=8,xe(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,xe(o,e,t,n)),s&&ca(s,t),ca(()=>{e.isUnmounted=!0},t)},we=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)xe(e[o],t,n,r,i)},Te=e=>{if(e.shapeFlag&6)return Te(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[nr];return n?h(n):t},Ee=!1,De=(e,t,n)=>{let r;e==null?t._vnode&&(xe(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,Ee||=(Ee=!0,In(r),Ln(),!1)},w={p:v,um:xe,m:be,r:Se,mt:fe,mc:oe,pc:ge,pbc:ce,n:Te,o:e},Oe,ke;return t&&([Oe,ke]=t(w)),{render:De,hydrate:Oe,createApp:ki(De,Oe)}}function da({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 fa({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function pa(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function ma(e,t,n=!1){let r=e.children,i=t.children;if(p(r)&&p(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=Ra(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&ma(t,a)),a.type===xa&&(a.patchFlag===-1&&(a=i[e]=Ra(a)),a.el=t.el),a.type===Sa&&!a.el&&(a.el=t.el)}}function ha(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function ga(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:ga(t)}function _a(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function va(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?va(t.subTree):null}var ya=e=>e.__isSuspense;function ba(e,t){t&&t.pendingBranch?p(e)?t.effects.push(...e):t.effects.push(e):Fn(e)}var M=Symbol.for(`v-fgt`),xa=Symbol.for(`v-txt`),Sa=Symbol.for(`v-cmt`),Ca=Symbol.for(`v-stc`),wa=[],Ta=null;function N(e=!1){wa.push(Ta=e?null:[])}function Ea(){wa.pop(),Ta=wa[wa.length-1]||null}var Da=1;function Oa(e,t=!1){Da+=e,e<0&&Ta&&t&&(Ta.hasOnce=!0)}function ka(e){return e.dynamicChildren=Da>0?Ta||i:null,Ea(),Da>0&&Ta&&Ta.push(e),e}function P(e,t,n,r,i,a){return ka(I(e,t,n,r,i,a,!0))}function F(e,t,n,r,i){return ka(L(e,t,n,r,i,!0))}function Aa(e){return e?e.__v_isVNode===!0:!1}function ja(e,t){return e.type===t.type&&e.key===t.key}var Ma=({key:e})=>e??null,Na=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:v(e)||rn(e)||_(e)?{i:Bn,r:e,k:t,f:!!n}:e);function I(e,t=null,n=null,r=0,i=null,a=e===M?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Ma(t),ref:t&&Na(t),scopeId:Vn,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:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Bn};return s?(za(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=v(n)?8:16),Da>0&&!o&&Ta&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&Ta.push(c),c}var L=Pa;function Pa(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===ti)&&(e=Sa),Aa(e)){let r=Ia(e,t,!0);return n&&za(r,n),Da>0&&!a&&Ta&&(r.shapeFlag&6?Ta[Ta.indexOf(e)]=r:Ta.push(r)),r.patchFlag=-2,r}if(so(e)&&(e=e.__vccOpts),t){t=Fa(t);let{class:e,style:n}=t;e&&!v(e)&&(t.class=C(e)),b(n)&&($t(n)&&!p(n)&&(n=l({},n)),t.style=ye(n))}let o=v(e)?1:ya(e)?128:rr(e)?64:b(e)?4:_(e)?2:0;return I(e,t,n,r,i,o,a,!0)}function Fa(e){return e?$t(e)||Ki(e)?l({},e):e:null}function Ia(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?Ba(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Ma(l),ref:t&&t.ref?n&&a?p(a)?a.concat(Na(t)):[a,Na(t)]:Na(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==M?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&Ia(e.ssContent),ssFallback:e.ssFallback&&Ia(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&Or(u,c.clone(u)),u}function R(e=` `,t=0){return L(xa,null,e,t)}function z(e=``,t=!1){return t?(N(),F(Sa,null,e)):L(Sa,null,e)}function La(e){return e==null||typeof e==`boolean`?L(Sa):p(e)?L(M,null,e.slice()):Aa(e)?Ra(e):L(xa,null,String(e))}function Ra(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ia(e)}function za(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(p(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),za(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!Ki(t)?t._ctx=Bn:r===3&&Bn&&(Bn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(_(t)){if(r&65){za(e,{default:t});return}t={default:t,_ctx:Bn},n=32}else t=String(t),r&64?(n=16,t=[R(t)]):n=8;e.children=t,e.shapeFlag|=n}function Ba(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=C([t.class,r.class]));else if(e===`style`)t.style=ye([t.style,r.style]);else if(s(e)){let n=t[e],i=r[e];i&&n!==i&&!(p(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!c(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function Va(e,t,n,r=null){xn(e,t,7,[n,r])}var Ha=Di(),Ua=0;function Wa(e,t,n){let i=e.type,a=(t?t.appContext:e.appContext)||Ha,o={uid:Ua++,vnode:e,type:i,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ie(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(a.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Qi(i,a),emitsOptions:Fi(i,a),emit:null,emitted:null,propsDefaults:r,inheritAttrs:i.inheritAttrs,ctx:r,data:r,props:r,attrs:r,slots:r,refs:r,setupState:r,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=Ni.bind(null,o),e.ce&&e.ce(o),o}var Ga=null,Ka=()=>Ga||Bn,qa,Ja;{let e=ve(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};qa=t(`__VUE_INSTANCE_SETTERS__`,e=>Ga=e),Ja=t(`__VUE_SSR_SETTERS__`,e=>Qa=e)}var Ya=e=>{let t=Ga;return qa(e),e.scope.on(),()=>{e.scope.off(),qa(t)}},Xa=()=>{Ga&&Ga.scope.off(),qa(null)};function Za(e){return e.vnode.shapeFlag&4}var Qa=!1;function $a(e,t=!1,n=!1){t&&Ja(t);let{props:r,children:i}=e.vnode,a=Za(e);qi(e,r,a,t),oa(e,i,n||t);let o=a?eo(e,t):void 0;return t&&Ja(!1),o}function eo(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,ci);let{setup:r}=n;if(r){et();let n=e.setupContext=r.length>1?io(e):null,i=Ya(e),a=bn(r,e,0,[e.props,n]),o=ee(a);if(tt(),i(),(o||e.sp)&&!Fr(e)&&Ar(e),o){if(a.then(Xa,Xa),t)return a.then(n=>{Ja(!0);try{to(e,n,t)}finally{Ja(!1)}}).catch(t=>{Sn(t,e,0)});e.asyncDep=a}else to(e,a,t)}else no(e,t)}function to(e,t,n){_(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:b(t)&&(e.setupState=ln(t)),no(e,n)}function no(e,t,n){let r=e.type;e.render||=r.render||a;{let t=Ya(e);et();try{pi(e)}finally{tt(),t()}}}var ro={get(e,t){return dt(e,`get`,``),e[t]}};function io(e){return{attrs:new Proxy(e.attrs,ro),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function ao(e){return e.exposed?e.exposeProxy||=new Proxy(ln(en(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in oi)return oi[n](e)},has(e,t){return t in e||t in oi}}):e.proxy}function oo(e,t=!0){return _(e)?e.displayName||e.name:e.name||t&&e.__name}function so(e){return _(e)&&`__vccOpts`in e}var B=(e,t)=>pn(e,t,Qa);function co(e,t,n){try{Oa(-1);let r=arguments.length;return r===2?b(t)&&!p(t)?Aa(t)?L(e,null,[t]):L(e,t):L(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Aa(n)&&(n=[n]),L(e,t,n))}finally{Oa(1)}}var lo=`3.5.43`,uo=void 0,fo=typeof window<`u`&&window.trustedTypes;if(fo)try{uo=fo.createPolicy(`vue`,{createHTML:e=>e})}catch{}var po=uo?e=>uo.createHTML(e):e=>e,mo=`http://www.w3.org/2000/svg`,ho=`http://www.w3.org/1998/Math/MathML`,go=typeof document<`u`?document:null,_o=go&&go.createElement(`template`),vo={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?go.createElementNS(mo,e):t===`mathml`?go.createElementNS(ho,e):n?go.createElement(e,{is:n}):go.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>go.createTextNode(e),createComment:e=>go.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>go.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{_o.innerHTML=po(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=_o.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},yo=`transition`,bo=`animation`,xo=Symbol(`_vtc`),So={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},Co=l({},yr,So),wo=(e=>(e.displayName=`Transition`,e.props=Co,e))((e,{slots:t})=>co(Cr,Do(e),t)),To=(e,t=[])=>{p(e)?e.forEach(e=>e(...t)):e&&e(...t)},Eo=e=>e?p(e)?e.some(e=>e.length>1):e.length>1:!1;function Do(e){let t={};for(let n in e)n in So||(t[n]=e[n]);if(e.css===!1)return t;let{name:n=`v`,type:r,duration:i,enterFromClass:a=`${n}-enter-from`,enterActiveClass:o=`${n}-enter-active`,enterToClass:s=`${n}-enter-to`,appearFromClass:c=a,appearActiveClass:u=o,appearToClass:d=s,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:m=`${n}-leave-to`}=e,h=Oo(i),g=h&&h[0],_=h&&h[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:b,onLeave:ee,onLeaveCancelled:te,onBeforeAppear:x=v,onAppear:ne=y,onAppearCancelled:re=b}=t,ie=(e,t,n,r)=>{e._enterCancelled=r,jo(e,t?d:s),jo(e,t?u:o),n&&n()},ae=(e,t)=>{e._isLeaving=!1,jo(e,f),jo(e,m),jo(e,p),t&&t()},oe=e=>(t,n)=>{let i=e?ne:y,o=()=>ie(t,e,n);To(i,[t,o]),Mo(()=>{jo(t,e?c:a),Ao(t,e?d:s),Eo(i)||Po(t,r,g,o)})};return l(t,{onBeforeEnter(e){To(v,[e]),Ao(e,a),Ao(e,o)},onBeforeAppear(e){To(x,[e]),Ao(e,c),Ao(e,u)},onEnter:oe(!1),onAppear:oe(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>ae(e,t);Ao(e,f),e._enterCancelled?(Ao(e,p),Ro(e)):(Ro(e),Ao(e,p)),Mo(()=>{e._isLeaving&&(jo(e,f),Ao(e,m),Eo(ee)||Po(e,r,_,n))}),To(ee,[e,n])},onEnterCancelled(e){ie(e,!1,void 0,!0),To(b,[e])},onAppearCancelled(e){ie(e,!0,void 0,!0),To(re,[e])},onLeaveCancelled(e){ae(e),To(te,[e])}})}function Oo(e){if(e==null)return null;if(b(e))return[ko(e.enter),ko(e.leave)];{let t=ko(e);return[t,t]}}function ko(e){return ge(e)}function Ao(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[xo]||(e[xo]=new Set)).add(t)}function jo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[xo];n&&(n.delete(t),n.size||(e[xo]=void 0))}function Mo(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var No=0;function Po(e,t,n,r){let i=e._endId=++No,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=Fo(e,t);if(!o)return r();let l=o+`end`,u=0,d=()=>{e.removeEventListener(l,f),a()},f=t=>{t.target===e&&++u>=c&&d()};setTimeout(()=>{u<c&&d()},s+1),e.addEventListener(l,f)}function Fo(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${yo}Delay`),a=r(`${yo}Duration`),o=Io(i,a),s=r(`${bo}Delay`),c=r(`${bo}Duration`),l=Io(s,c),u=null,d=0,f=0;t===yo?o>0&&(u=yo,d=o,f=a.length):t===bo?l>0&&(u=bo,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?yo:bo:null,f=u?u===yo?a.length:c.length:0);let p=u===yo&&/\b(?:transform|all)(?:,|$)/.test(r(`${yo}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function Io(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>Lo(t)+Lo(e[n])))}function Lo(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function Ro(e){return(e?e.ownerDocument:document).body.offsetHeight}function zo(e,t,n){let r=e[xo];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Bo=Symbol(`_vod`),Vo=Symbol(`_vsh`),Ho=Symbol(``),Uo=/(?:^|;)\s*display\s*:/;function Wo(e,t,n){let r=e.style,i=v(n),a=!1;if(n&&!i){if(t){if(v(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??Ko(r,t,``)}else for(let e in t)n[e]??Ko(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?Ko(r,i,``):Xo(e,i,!v(t)&&t?t[i]:void 0,o)||Ko(r,i,o)}}else if(i){if(t!==n){let e=r[Ho];e&&(n+=`;`+e),r.cssText=n,a=Uo.test(n)}}else t&&e.removeAttribute(`style`);Bo in e&&(e[Bo]=a?r.display:``,e[Vo]&&(r.display=`none`))}var Go=/\s*!important$/;function Ko(e,t,n){if(p(n))n.forEach(n=>Ko(e,t,n));else if(n??=``,t.startsWith(`--`))Go.test(n)?e.setProperty(t,n.replace(Go,``),`important`):e.setProperty(t,n);else{let r=Yo(e,t);Go.test(n)?e.setProperty(ue(r),n.replace(Go,``),`important`):e[r]=n}}var qo=[`Webkit`,`Moz`,`ms`],Jo={};function Yo(e,t){let n=Jo[t];if(n)return n;let r=ce(t);if(r!==`filter`&&r in e)return Jo[t]=r;r=de(r);for(let n=0;n<qo.length;n++){let i=qo[n]+r;if(i in e)return Jo[t]=i}return t}function Xo(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&v(r)&&n===r}var Zo=`http://www.w3.org/1999/xlink`;function Qo(e,t,n,r,i,a=Te(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(Zo,t.slice(6,t.length)):e.setAttributeNS(Zo,t,n):n==null||a&&!Ee(n)?e.removeAttribute(t):e.setAttribute(t,a?``:y(n)?String(n):n)}function $o(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?po(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=Ee(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function es(e,t,n,r){e.addEventListener(t,n,r)}function ts(e,t,n,r){e.removeEventListener(t,n,r)}var ns=Symbol(`_vei`);function rs(e,t,n,r,i=null){let a=e[ns]||(e[ns]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=os(t);r?es(e,n,a[t]=us(r,i),s):o&&(ts(e,n,o,s),a[t]=void 0)}}var is=/(Once|Passive|Capture)$/,as=/^on:?(?:Once|Passive|Capture)$/;function os(e){let t,n;for(;(n=e.match(is))&&!as.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):ue(e.slice(2)),t]}var ss=0,cs=Promise.resolve(),ls=()=>ss||=(cs.then(()=>ss=0),Date.now());function us(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(p(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&xn(e,t,5,a)}}else xn(r,t,5,[e])};return n.value=e,n.attached=ls(),n}var ds=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,fs=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?zo(e,r,o):t===`style`?Wo(e,n,r):s(t)?c(t)||rs(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):ps(e,t,r,o))?($o(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&Qo(e,t,r,o,a,t!==`value`)):e._isVueCE&&(ms(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!v(r)))?$o(e,ce(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),Qo(e,t,r,o))};function ps(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&ds(t)&&_(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`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return ds(t)&&v(n)?!1:t in e}function ms(e,t){let n=e._def.props;if(!n)return!1;let r=ce(t);return Array.isArray(n)?n.some(e=>ce(e)===r):Object.keys(n).some(e=>ce(e)===r)}var hs=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return p(t)?e=>pe(t,e):t};function gs(e){e.target.composing=!0}function _s(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var vs=Symbol(`_assign`),ys=Symbol(`_initialValue`);function bs(e,t,n){return t&&(e=e.trim()),n&&(e=he(e)),e}var xs={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e.parentNode&&(e.type===`text`?e[ys]=e.defaultValue.replace(/[\r\n]/g,``):e.type===`textarea`&&(e[ys]=e.defaultValue.replace(/\r\n?/g,`
2
- `))),e[vs]=hs(i);let a=r||i.props&&i.props.type===`number`;es(e,t?`change`:`input`,t=>{t.target.composing||e[vs](bs(e.value,n,a))}),(n||a)&&es(e,`change`,()=>{e.value=bs(e.value,n,a)}),t||(es(e,`compositionstart`,gs),es(e,`compositionend`,_s),es(e,`change`,_s))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[ys];delete e[ys],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[vs](bs(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[vs]=hs(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?he(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Ss={deep:!0,created(e,t,n){e[vs]=hs(n),es(e,`change`,()=>{let t=e._modelValue,n=Ds(e),r=e.checked,i=e[vs];if(p(t)){let e=je(t,n),a=e!==-1;if(r&&!a)i(t.concat(n));else if(!r&&a){let n=[...t];n.splice(e,1),i(n)}}else if(h(t)){let e=new Set(t);r?e.add(n):e.delete(n),i(e)}else i(Os(e,r))})},mounted:Cs,beforeUpdate(e,t,n){e[vs]=hs(n),Cs(e,t,n)}};function Cs(e,{value:t,oldValue:n},r){e._modelValue=t;let i;if(p(t))i=je(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=Ae(t,Os(e,!0))}e.checked!==i&&(e.checked=i)}var ws={deep:!0,created(e,{value:t,modifiers:{number:n}},r){e._modelValue=t,es(e,`change`,()=>{let t=Array.prototype.filter.call(e.options,e=>e.selected).map(e=>n?he(Ds(e)):Ds(e)),r=e.multiple,i=r?h(e._modelValue)?new Set(t):t:t[0],a=e._pendingValue=[r,r?p(i)?t.slice():t:i];try{e[vs](i)}finally{jn(()=>{e._pendingValue===a&&(e._pendingValue=void 0)})}}),e[vs]=hs(r)},mounted(e,{value:t}){Es(e,t)},beforeUpdate(e,{value:t},n){e._modelValue=t,e[vs]=hs(n)},updated(e,{value:t}){let n=e._pendingValue;e._pendingValue=void 0,(!n||n[0]!==e.multiple||!Ts(t,n[1],n[0]))&&Es(e,t)}};function Ts(e,t,n){if(!n||p(e))return Ae(e,t);if(h(e)){if(e.size!==t.length)return!1;for(let n of t)if(!e.has(n))return!1;return!0}return!1}function Es(e,t){let n=e.multiple,r=p(t);if(!n||r||h(t)){for(let i=0,a=e.options.length;i<a;i++){let a=e.options[i],o=Ds(a);if(n){if(r){let e=typeof o;a.selected=e===`string`||e===`number`?t.some(e=>String(e)===String(o)):je(t,o)>-1}else a.selected=t.has(o)}else if(Ae(Ds(a),t)){e.selectedIndex!==i&&(e.selectedIndex=i);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Ds(e){return`_value`in e?e._value:e.value}function Os(e,t){let n=t?`_trueValue`:`_falseValue`;return n in e?e[n]:t}var ks=[`ctrl`,`shift`,`alt`,`meta`],As={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)=>ks.some(n=>e[`${n}Key`]&&!t.includes(n))},js=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=As[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Ms={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Ns=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=ue(n.key);if(t.some(e=>e===r||Ms[e]===r))return e(n)}))},Ps=l({patchProp:fs},vo),Fs;function Is(){return Fs||=la(Ps)}var Ls=((...e)=>{let t=Is().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=zs(e);if(!r)return;let i=t._component;!_(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Rs(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function Rs(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function zs(e){return v(e)?document.querySelector(e):e}var Bs=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Vs={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Hs=({size:e,strokeWidth:t=2,absoluteStrokeWidth:n,color:r,iconNode:i,name:a,class:o,...s},{slots:c})=>co(`svg`,{...Vs,width:e||Vs.width,height:e||Vs.height,stroke:r||Vs.stroke,"stroke-width":n?Number(t)*24/Number(e):t,class:[`lucide`,`lucide-${Bs(a??`icon`)}`],...s},[...i.map(e=>co(...e)),...c.default?[c.default()]:[]]),V=(e,t)=>(n,{slots:r})=>co(Hs,{...n,iconNode:t,name:e},r),Us=V(`ActivityIcon`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ws=V(`ArchiveIcon`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),Gs=V(`ArrowUpRightIcon`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Ks=V(`ArrowUpIcon`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),qs=V(`BotIcon`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Js=V(`BracesIcon`,[[`path`,{d:`M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1`,key:`ezmyqa`}],[`path`,{d:`M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1`,key:`e1hn23`}]]),Ys=V(`CableIcon`,[[`path`,{d:`M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1`,key:`10bnsj`}],[`path`,{d:`M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9`,key:`1eqmu1`}],[`path`,{d:`M21 21v-2h-4`,key:`14zm7j`}],[`path`,{d:`M3 5h4V3`,key:`z442eg`}],[`path`,{d:`M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3`,key:`ebdjd7`}]]),Xs=V(`CheckIcon`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Zs=V(`ChevronDownIcon`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Qs=V(`ChevronRightIcon`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),$s=V(`CircleCheckIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ec=V(`CircleHelpIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),tc=V(`Clock3Icon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),nc=V(`CopyIcon`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),rc=V(`CornerDownRightIcon`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),ic=V(`CornerLeftUpIcon`,[[`polyline`,{points:`14 9 9 4 4 9`,key:`m9oyvo`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),ac=V(`DatabaseIcon`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),oc=V(`ExternalLinkIcon`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),sc=V(`FlagIcon`,[[`path`,{d:`M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z`,key:`i9b6wo`}],[`line`,{x1:`4`,x2:`4`,y1:`22`,y2:`15`,key:`1cm3nv`}]]),cc=V(`FolderOpenIcon`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),lc=V(`FolderIcon`,[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),uc=V(`GitBranchIcon`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),dc=V(`GitForkIcon`,[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]),fc=V(`HandIcon`,[[`path`,{d:`M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2`,key:`1fvzgz`}],[`path`,{d:`M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2`,key:`1kc0my`}],[`path`,{d:`M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8`,key:`10h0bg`}],[`path`,{d:`M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15`,key:`1s1gnw`}]]),pc=V(`HouseIcon`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),mc=V(`InfoIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),hc=V(`KeyRoundIcon`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),gc=V(`LaptopIcon`,[[`path`,{d:`M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16`,key:`tarvll`}]]),_c=V(`LayersIcon`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),vc=V(`Link2Icon`,[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7h2`,key:`8i5ue5`}],[`path`,{d:`M15 7h2a5 5 0 1 1 0 10h-2`,key:`1b9ql8`}],[`line`,{x1:`8`,x2:`16`,y1:`12`,y2:`12`,key:`1jonct`}]]),yc=V(`ListChecksIcon`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),bc=V(`LoaderCircleIcon`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),xc=V(`LoaderIcon`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Sc=V(`MessageSquareIcon`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),Cc=V(`MinusIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),wc=V(`MonitorSmartphoneIcon`,[[`path`,{d:`M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8`,key:`10dyio`}],[`path`,{d:`M10 19v-3.96 3.15`,key:`1irgej`}],[`path`,{d:`M7 19h5`,key:`qswx4l`}],[`rect`,{width:`6`,height:`10`,x:`16`,y:`12`,rx:`2`,key:`1egngj`}]]),Tc=V(`NetworkIcon`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),Ec=V(`OctagonIcon`,[[`path`,{d:`M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z`,key:`2d38gg`}]]),Dc=V(`PanelLeftCloseIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]]),Oc=V(`PanelLeftOpenIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]]),kc=V(`PanelLeftIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),Ac=V(`PanelRightIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),jc=V(`PencilIcon`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Mc=V(`PlayIcon`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Nc=V(`PlusIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Pc=V(`PuzzleIcon`,[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]),Fc=V(`RefreshCwIcon`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Ic=V(`RepeatIcon`,[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]),Lc=V(`ServerIcon`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Rc=V(`ShieldAlertIcon`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),zc=V(`ShieldCheckIcon`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Bc=V(`ShieldOffIcon`,[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]),Vc=V(`TerminalIcon`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),Hc=V(`Trash2Icon`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),Uc=V(`WaypointsIcon`,[[`circle`,{cx:`12`,cy:`4.5`,r:`2.5`,key:`r5ysbb`}],[`path`,{d:`m10.2 6.3-3.9 3.9`,key:`1nzqf6`}],[`circle`,{cx:`4.5`,cy:`12`,r:`2.5`,key:`jydg6v`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`circle`,{cx:`19.5`,cy:`12`,r:`2.5`,key:`1piiel`}],[`path`,{d:`m13.8 17.7 3.9-3.9`,key:`1wyg1y`}],[`circle`,{cx:`12`,cy:`19.5`,r:`2.5`,key:`13o1pw`}]]),Wc=V(`WifiOffIcon`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Gc=V(`WifiIcon`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),Kc=V(`WorkflowIcon`,[[`rect`,{width:`8`,height:`8`,x:`3`,y:`3`,rx:`2`,key:`by2w9f`}],[`path`,{d:`M7 11v4a2 2 0 0 0 2 2h4`,key:`xkn7yn`}],[`rect`,{width:`8`,height:`8`,x:`13`,y:`13`,rx:`2`,key:`1cgmvn`}]]),qc=V(`WrenchIcon`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,key:`cbrjhi`}]]),Jc=V(`XIcon`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Yc=e=>e.role===`assistant`,Xc=e=>e.role===`toolResult`;function Zc(e){let t=e.content;return typeof t==`string`?t:Array.isArray(t)?t.map(e=>e.type===`text`?e.text??``:``).join(``):``}function Qc(e){if(e.errorMessage)return e.errorMessage;if(e.stopReason===`aborted`)return`Interrupted. Partial response preserved.`;if(e.stopReason===`error`)return`Provider request failed.`}function $c(e){let t=e.data;return typeof t?.text==`string`?t.text:e.kind===`pi.reset`?`New context started. Earlier entries remain stored.`:e.kind===`pi.compaction`?`Context compacted. Earlier entries remain stored.`:e.kind}function el(e,t,n=new Map){let r=new Map,i=new Set;for(let t of e)for(let e of t.model??[])if(t.kind===`pi.tool-result`&&Xc(e)&&r.set(e.toolCallId,{entryId:t.id,message:e}),t.kind===`pi.assistant`&&Yc(e))for(let t of e.content)t.type===`toolCall`&&i.add(t.id);if(t)for(let e of t.content)e.type===`toolCall`&&i.add(e.id);let a=(e,t,i)=>{let a=r.get(e),o=n.get(e),s=o?.nested;return a?{callId:e,name:t,args:i,status:a.message.isError?`error`:`done`,result:Zc(a.message),resultEntryId:a.entryId,...s?{nested:s}:{}}:o?.result?{callId:e,name:t,args:i,status:o.result.isError?`error`:`done`,result:o.result.text,...s?{nested:s}:{},...o.summary?{summary:tl(o.summary)}:{}}:{callId:e,name:t,args:i,status:o?.status??`pending`,output:o?.output||void 0,...s?{nested:s}:{},...o?.summary?{summary:tl(o.summary)}:{}}},o=e=>e.content.flatMap(e=>e.type===`text`?e.text?[{type:`text`,text:e.text}]:[]:e.type===`thinking`?e.thinking?[{type:`thinking`,text:e.thinking}]:[]:[{type:`tool`,call:a(e.id,e.name,e.arguments)}]),s=[];for(let t of e)if(t.kind!==`pi.system`){if(t.kind===`pi.user`)s.push({kind:`user`,id:t.id,text:(t.model??[]).map(Zc).join(`
3
- `)});else if(t.kind===`pi.assistant`){let e=(t.model??[]).filter(Yc);s.push({kind:`assistant`,id:t.id,streaming:!1,blocks:e.flatMap(o),error:e.map(Qc).find(Boolean),model:e[0]?.model})}else if(t.kind===`pi.tool-result`)for(let e of(t.model??[]).filter(Xc))i.has(e.toolCallId)||s.push({kind:`tool-result`,id:t.id,name:e.toolName,text:Zc(e),isError:e.isError});else s.push({kind:`event`,id:t.id,entryKind:t.kind,text:$c(t),note:t.model?.length?(t.model??[]).map(Zc).join(`
4
- `):void 0,...t.data===void 0?{}:{data:t.data}})}t&&s.push({kind:`assistant`,id:`live`,streaming:!0,blocks:o(t),model:t.model});for(let[e,t]of n)(t.status!==`done`||t.result||t.nested)&&!i.has(e)&&s.push({kind:`tool`,id:e,call:a(e,t.name,t.args)});return s}function tl(e){let t=[];return e.durationMs!==void 0&&t.push(`${(e.durationMs/1e3).toFixed(1)}s`),e.error&&t.push(e.error),t.join(` · `)}function nl(e){let t={tokens:0,cost:0,input:0,output:0,cacheRead:0,cacheWrite:0,inputCost:0,outputCost:0,cacheReadCost:0,cacheWriteCost:0};for(let n of Object.values(e?.models??{}))t.tokens+=n.totalTokens??n.input+n.output+n.cacheRead+n.cacheWrite,t.cost+=n.cost?.total??0,t.input+=n.input??0,t.output+=n.output??0,t.cacheRead+=n.cacheRead??0,t.cacheWrite+=n.cacheWrite??0,t.inputCost+=n.cost?.input??0,t.outputCost+=n.cost?.output??0,t.cacheReadCost+=n.cost?.cacheRead??0,t.cacheWriteCost+=n.cost?.cacheWrite??0;return t}var rl=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>void this.listeners.delete(e)}emit(){for(let e of this.listeners)e()}},il=()=>({items:[],entries:[],running:!1,generating:!1,inbox:[],agent:{},usage:{models:{},tools:{}},compactions:[],notices:[],docs:{},ready:!1});function al(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];(typeof r[n]!=`object`||r[n]===null)&&(r[n]=typeof t[e+1]==`number`?[]:{}),r=r[n]}let i=t[t.length-1];r[i]=String(r[i]??``)+n}function ol(e,t){if(t.type===`message`)return structuredClone(t.message);let n=[...e.content],r=t.contentIndex;if(t.type===`block`||t.type.endsWith(`_start`))n[r]=structuredClone(t.block);else if(t.type===`text_delta`){let e=n[r];n[r]={type:`text`,text:(e?.type===`text`?e.text:``)+t.delta}}else if(t.type===`thinking_delta`){let e=n[r];n[r]={type:`thinking`,thinking:(e?.type===`thinking`?e.thinking:``)+t.delta}}else if(t.type===`toolcall_delta`){let e=structuredClone(n[r]??{type:`toolCall`,id:``,name:``,arguments:{}});al(e,t.path,t.delta),n[r]=e}return{...e,content:n}}var sl=class extends rl{state=il();entries=new Map;live;tools=new Map;apply(e){switch(e.type){case`snapshot`:this.reset(e.snapshot),this.state.inbox=e.inbox;break;case`batch`:for(let t of e.events)this.event(t);break;case`inbox`:this.state.inbox=e.items;break;case`doc`:this.state.docs={...this.state.docs,[e.kind]:e.value};break;default:return!1}return this.rebuild(),this.emit(),!0}touch(){this.emit()}clear(){this.entries.clear(),this.tools.clear(),this.live=void 0,this.state=il(),this.emit()}rebuild(){let e=[...this.entries.values()].sort((e,t)=>e.id-t.id);this.state.entries=e,this.state.generating=!!this.live,this.state.items=el(e,this.live,this.tools)}reset(e){this.entries=new Map(e.entries.map(e=>[e.id,e])),this.live=e.generation?.message?structuredClone(e.generation.message):void 0,this.tools=new Map(e.tools.map(e=>[e.callId,{name:e.name,status:e.status,output:e.output??``}]));for(let t of e.nestedTools){let e=this.tools.get(t.callId);this.tools.set(t.callId,{name:t.name,status:t.status,output:t.output??``,args:t.arguments,nested:{parentCallId:t.parentCallId,parentTaskId:t.parentTaskId,taskId:t.taskId},...t.summary?{summary:t.summary}:{},...e??{}})}this.state.running=!!e.run,this.state.agent=e.agent,this.state.usage=e.usage,this.state.retry=e.generation?.retry,this.state.compactions=e.compactions.map(e=>e.taskId),this.state.compactionFailure=e.compactionFailure,this.state.ready=!0}commit(e){if(this.entries.set(e.id,e),e.kind===`pi.reset`||e.kind===`pi.compaction`){let t=e.head??e.id;for(let e of this.entries.keys())e<t&&this.entries.delete(e)}}event(e){switch(e.type){case`snapshot`:return this.reset(e);case`run_start`:this.state.running=!0;return;case`run_end`:this.state.running=!1,this.live=void 0;return;case`message_start`:e.message.role===`assistant`&&(this.live=structuredClone(e.message));return;case`message_update`:this.live||={role:`assistant`,content:[],provider:``,model:``,usage:e.usage,stopReason:`pending`};for(let t of e.changes)this.live=ol(this.live,t);this.live={...this.live,usage:e.usage};return;case`message_end`:return this.live=void 0,this.commit(e.entry);case`entry_appended`:return this.commit(e.entry);case`tool_execution_start`:this.tools.set(e.toolCallId,{name:e.toolName,status:`running`,output:``,args:e.args,...e.parentToolCallId!==void 0&&e.parentTaskId!==void 0&&e.taskId!==void 0?{nested:{parentCallId:e.parentToolCallId,parentTaskId:e.parentTaskId,taskId:e.taskId}}:{}});return;case`tool_execution_update`:{let t=this.tools.get(e.toolCallId)??{name:e.toolName,status:`running`,output:``},n=e.output;n&&`set`in n?t.output=n.set:n&&(t.output=t.output.slice(n.trimStart??0)+(n.append??``)),t.status=`running`,this.tools.set(e.toolCallId,t);return}case`tool_execution_end`:if(e.entry){this.tools.delete(e.toolCallId),this.entries.set(e.entry.id,e.entry);return}if(e.result){let t=this.tools.get(e.toolCallId)??{name:e.toolName,status:`done`,output:``};t.status=`done`,t.result={text:gl(e.result),isError:e.result.isError},t.summary={isError:e.result.isError,durationMs:e.result.durationMs},this.tools.set(e.toolCallId,t);return}this.tools.delete(e.toolCallId);return;case`agent_changed`:this.state.agent=e.agent;return;case`usage_changed`:this.state.usage=e.usage;return;case`auto_retry_start`:this.state.retry={at:e.at,error:e.errorMessage};return;case`auto_retry_end`:this.state.retry=void 0;return;case`compaction_start`:this.state.compactions.includes(e.taskId)||this.state.compactions.push(e.taskId);return;case`compaction_end`:this.state.compactions=this.state.compactions.filter(t=>t!==e.taskId),this.state.compactionFailure=e.error?{taskId:e.taskId,reason:e.reason,error:e.error}:void 0;return;case`task_failed`:this.state.notices=[...this.state.notices.slice(-9),`${e.kind} failed: ${e.message}`];return;default:return}}},cl=class extends rl{state={agents:[],tasks:[],usage:{models:{},tools:{}},ready:!1};apply(e){if(e.type===`session`)this.state={agents:e.agents,tasks:e.tasks,usage:e.usage,ready:!0};else if(e.type===`agents`)this.state={...this.state,agents:e.agents};else if(e.type===`tasks`)this.state={...this.state,tasks:e.tasks};else if(e.type===`usage`)this.state={...this.state,usage:e.usage};else return!1;return this.emit(),!0}clear(){this.state={agents:[],tasks:[],usage:{models:{},tools:{}},ready:!1},this.emit()}agent(e){return this.state.agents.find(t=>t.id===e)}lineage(e){return ll(this.state.agents,e)}foregroundBusy(e){return this.state.tasks.some(t=>!t.background&&t.conversationId===e)}backgroundTasks(e){return this.state.tasks.filter(t=>t.background&&(e===void 0||t.conversationId===e))}};function ll(e,t){let n=new Map(e.map(e=>[e.id,e])),r=[],i=new Set,a=t;for(;a!==void 0&&!i.has(a);){i.add(a);let e=n.get(a);if(!e)break;r.unshift(e),a=e.parentId}return r}var ul=e=>e,dl=(e,t)=>`${e}/s/${t}`,fl=(e,t,n)=>`${e}/s/${t}/a/${n}`;function pl(e,t,n){let r=new Map;for(let i of t.agents)r.set(i.id,{type:`agent`,key:fl(e,t.id,i.id),deviceId:e,sessionId:t.id,agent:i,stale:n,children:[]});let i=[];for(let e of r.values()){let t=r.get(e.agent.parentId??e.agent.ownerAgentId??-1);t&&t!==e?t.children.push(e):i.push(e)}return i}function ml(e){return e.map(e=>{let t=e.status!==`online`;return{type:`device`,key:ul(e.id),device:e,status:e.status,stale:t,children:(e.tree?.sessions??[]).map(n=>({type:`session`,key:dl(e.id,n.id),deviceId:e.id,session:n,stale:t,children:pl(e.id,n,t)}))}})}var hl=class extends rl{devices=[];apply(e){return e.type===`network`&&(this.devices=e.devices,this.emit(),!0)}device(e){return this.devices.find(t=>t.id===e)}tree(){return ml(this.devices)}};function gl(e){let t=e.structuredOutput;if(t==null)return``;let n=typeof t==`string`?t:JSON.stringify(t);return n.length>4e3?`${n.slice(0,4e3)}…`:n}var _l=3e4;function vl(e,t){return t&&/^\d+$/.test(t.trim())?Math.min(_l,Math.max(1e3,Number(t)*1e3)):Math.min(_l,1e3*2**Math.min(e,10))}function yl(e){return Math.min(_l,2e3*2**Math.min(e,10))}var bl=class{state=`connecting`;source;streamId=``;slots=new Map;fresh=new Set;applied=[];routes=new Map;networkFns=new Set;stateFns=new Set;timer;reconnectTimer;reconnects=0;failures=0;flushing=Promise.resolve();start(){clearTimeout(this.reconnectTimer),this.source?.close(),this.streamId=``,this.source=new EventSource(`/api/stream`),this.source.onmessage=e=>this.receive(JSON.parse(e.data)),this.source.onerror=()=>{this.streamId=``,this.setState(this.source?.readyState===EventSource.CLOSED?`offline`:`connecting`),this.source?.readyState===EventSource.CLOSED&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>this.start(),yl(this.reconnects++)))}}stop(){clearTimeout(this.timer),clearTimeout(this.reconnectTimer),this.source?.close(),this.streamId=``}set(e,t){this.slots.get(e)!==t&&(t?(this.slots.set(e,t),this.fresh.add(t)):this.slots.delete(e),this.schedule())}reopen(e){let t=this.slots.get(e);t&&(this.fresh.add(t),this.schedule(0))}route(e,t){let n=this.routes.get(e)??new Set;return n.add(t),this.routes.set(e,n),()=>void n.delete(t)}onNetwork(e){return this.networkFns.add(e),()=>void this.networkFns.delete(e)}onState(e){return this.stateFns.add(e),()=>void this.stateFns.delete(e)}setState(e){if(e!==this.state){this.state=e;for(let t of this.stateFns)t(e)}}receive(e){let t=e.frame;if(t.type===`stream`){if(e.sub!==`hello`)return;this.streamId=t.streamId,this.applied=[],this.reconnects=0,this.failures=0,this.setState(`live`),this.schedule(0);return}if(t.type===`network`){if(e.sub!==`network`)return;for(let e of this.networkFns)e(t.devices);return}if(e.sub!==`hello`&&e.sub!==`network`){for(let[n,r]of this.slots)if(r===e.sub)for(let e of this.routes.get(n)??[])e(t)}}schedule(e=30){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.flushing=this.flushing.then(()=>this.flush())},e)}async flush(){let e=this.streamId;if(!e)return;let t=[...new Set(this.slots.values())],n=t.filter(e=>this.fresh.has(e)&&this.applied.includes(e));if(this.fresh.clear(),n.length&&!await this.put(e,t.filter(e=>!n.includes(e)))){for(let e of n)this.fresh.add(e);return}(t.join(`
5
- `)!==this.applied.join(`
6
- `)||n.length)&&await this.put(e,t)}async put(e,t){let n=null;try{let r=await fetch(`/api/stream/${e}`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({subs:t})});if(e!==this.streamId)return!1;if(r.ok)return this.applied=t,this.failures=0,!0;if(r.status===404)return this.start(),!1;console.warn(`subscription rejected`,r.status,await r.text()),n=r.headers.get(`retry-after`)}catch{if(e!==this.streamId)return!1}return this.schedule(vl(this.failures++,n)),!1}},xl=`lab.png`;function Sl(e){return`/icons/${typeof e==`string`&&/^[\w.-]+\.(png|svg)$/.test(e)&&!e.includes(`..`)?e:xl}`}var Cl=class extends Error{code;status;constructor(e,t,n=0,r){super(t,r),this.code=e,this.status=n,this.name=`DpiError`}},wl=16777216,Tl={initS:1,capS:15},El={codeCreate:{perMinute:5,capacity:5},start:{perMinute:20,capacity:20},verifyFails:{perWindow:100,windowMinutes:15},verifyTotal:{perMinute:300,capacity:300}},Dl={perMinute:60,capacity:120};Tl.initS,El.verifyFails.perWindow,El.verifyFails.windowMinutes,Dl.perMinute,Dl.capacity;function Ol(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t+=1:r<2048?t+=2:r>=55296&&r<=56319&&n+1<e.length&&(e.charCodeAt(n+1)&64512)==56320?(t+=4,n++):t+=3}return t}async function*kl(e,t=45e3,n=wl){let r=e.getReader(),i=new TextDecoder,a=()=>new Cl(`invalid`,`SSE event exceeds ${n} bytes`),o=[],s=0,c=``;try{for(;;){let e,l=new Promise((n,r)=>{e=setTimeout(()=>r(new Cl(`offline`,`No data for ${t/1e3}s`)),t)}),u;try{u=await Promise.race([r.read(),l])}finally{clearTimeout(e)}if(u.done)return;let d=i.decode(u.value,{stream:!0}).replaceAll(`\r
7
- `,`
8
- `);if(!d)continue;if(c===`\r`&&d.startsWith(`
9
- `)){let e=o.pop();if(e!==void 0){let t=e.slice(0,-1);t&&o.push(t),--s,c=o.length>0?o[o.length-1].slice(-1):``}}if(s+=Ol(d),!(c+d).includes(`
10
-
11
- `)){if(s>n)throw a();o.push(d),c=d.slice(-1);continue}let f=o.join(``)+d,p;for(;(p=f.indexOf(`
12
-
13
- `))>=0;){let e=f.slice(0,p),t=Ol(e);if(t>n)throw a();f=f.slice(p+2),s-=t+2;let r=Al(e);r&&(yield r)}if(s>n)throw a();o=f?[f]:[],c=f.slice(-1)}}finally{r.cancel().catch(()=>{})}}function Al(e){let t=`message`,n,r=[];for(let i of e.split(`
14
- `)){if(!i||i.startsWith(`:`))continue;let e=i.indexOf(`:`),a=e<0?i:i.slice(0,e),o=e<0?``:i.slice(e+1).replace(/^ /,``);a===`event`?t=o:a===`data`?r.push(o):a===`id`&&(n=o)}return r.length?{event:t,data:r.join(`
15
- `),id:n}:void 0}var jl=encodeURIComponent,Ml=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,Nl=class{token;baseUrl;constructor(e,t){this.token=t,this.baseUrl=e.replace(/\/+$/,``)}headers(e,t={}){return{...this.token?{authorization:`Bearer ${this.token}`,"x-dpi-token":this.token}:{},...e?{"content-type":`application/json`}:{},...t}}async request(e,t,n,r={}){let i=AbortSignal.timeout(r.timeoutMs??2e4),a=r.signal?AbortSignal.any([r.signal,i]):i,o;try{o=await fetch(this.baseUrl+t,{method:e,signal:a,headers:this.headers(n!==void 0,r.idempotencyKey?{"idempotency-key":r.idempotencyKey}:{}),body:n===void 0?void 0:JSON.stringify(n)})}catch(e){throw r.signal?.aborted?e:new Cl(`offline`,`Cannot reach ${this.baseUrl}`,0,{cause:e})}let s=await o.text(),c;try{c=s?JSON.parse(s):void 0}catch{c=void 0}if(!o.ok){let e=c?.error;throw new Cl(e?.code??(o.status===401?`unauthorized`:o.status===404?`not_found`:`internal`),e?.message??`${o.status} ${o.statusText}`,o.status)}return c}async*stream(e,t,n){let r;try{r=await fetch(this.baseUrl+e,{headers:{...this.headers(!1),accept:`text/event-stream`},signal:t})}catch(e){if(t.aborted)return;throw new Cl(`offline`,`Cannot reach ${this.baseUrl}`,0,{cause:e})}if(!r.ok||!r.body){let e=await r.json().catch(()=>void 0);throw new Cl(e?.error?.code??(r.status===401?`unauthorized`:`unavailable`),e?.error?.message??`Stream failed (${r.status})`,r.status)}try{for await(let e of kl(r.body,n))yield JSON.parse(e.data)}catch(e){if(t.aborted)return;throw e}}device(e){return this.request(`GET`,`/v1/device`,void 0,e)}tree(){return this.request(`GET`,`/v1/tree`)}dirs(e=``){return this.request(`GET`,`/v1/fs/dirs?path=${jl(e)}`)}deviceDoc(e){return this.request(`GET`,`/v1/docs/${jl(e)}`)}deviceEvents(e,t=[]){return this.stream(`/v1/events${t.length?`?docs=${t.map(jl).join(`,`)}`:``}`,e)}gitStatus(e){return this.request(`GET`,`/v1/git/status?path=${jl(e)}`)}gitOp(e,t,n={}){return this.request(`POST`,`/v1/git`,{path:e,op:t,...n})}sessions(){return this.request(`GET`,`/v1/sessions`)}createSession(e,t=Ml()){return this.request(`POST`,`/v1/sessions`,e,{idempotencyKey:t})}session(e){return new Pl(this,e)}agent(e,t){return new Fl(this,e,String(t))}},Pl=class{client;ref;constructor(e,t){this.client=e,this.ref=t}get base(){return`/v1/sessions/${jl(this.ref)}`}get(){return this.client.request(`GET`,this.base)}rename(e){return this.client.request(`PATCH`,this.base,{name:e})}archive(){return this.client.request(`DELETE`,this.base)}agents(){return this.client.request(`GET`,`${this.base}/agents`)}createAgent(e={},t=Ml()){return this.client.request(`POST`,`${this.base}/agents`,e,{idempotencyKey:t})}tasks(e=`terminal`,t=20){return this.client.request(`GET`,`${this.base}/tasks?status=${e}&limit=${t}`)}abortTask(e){return this.client.request(`POST`,`${this.base}/tasks/${e}/abort`,{})}inspect(){return this.client.request(`GET`,`${this.base}/inspect`)}compaction(){return this.client.request(`GET`,`${this.base}/compaction`)}setCompaction(e){return this.client.request(`PATCH`,`${this.base}/compaction`,e)}submission(e,t=0){return this.client.request(`GET`,`${this.base}/submissions/${e}?waitMs=${t}`,void 0,{timeoutMs:t+2e4})}events(e){return this.client.stream(`${this.base}/events`,e)}},Fl=class{client;session;agent;constructor(e,t,n){this.client=e,this.session=t,this.agent=n}get base(){return`/v1/sessions/${jl(this.session)}/agents/${jl(this.agent)}`}get(){return this.client.request(`GET`,this.base)}rename(e){return this.client.request(`PATCH`,this.base,{name:e})}send(e,t=`followUp`,n=Ml(),r){return this.client.request(`POST`,`${this.base}/messages`,{content:e,whenBusy:t,requestId:n,waitMs:r},{timeoutMs:(r??0)+2e4})}withdraw(e){return this.client.request(`DELETE`,`${this.base}/inbox/${e}`)}abort(e=!1){return this.client.request(`POST`,`${this.base}/abort`,{background:e})}fork(e,t=Ml()){return this.client.request(`POST`,`${this.base}/fork`,e,{idempotencyKey:t})}config(){return this.client.request(`GET`,`${this.base}/config`)}configure(e){return this.client.request(`PATCH`,`${this.base}/config`,e)}compact(e){return this.client.request(`POST`,`${this.base}/compact`,{instructions:e})}reset(e){return this.client.request(`POST`,`${this.base}/reset`,{note:e})}entries(e={}){let t=new URLSearchParams({scope:e.scope??`all`,limit:String(e.limit??500),...e.cursor?{cursor:e.cursor}:{}});return this.client.request(`GET`,`${this.base}/entries?${t}`)}transcript(e=`json`){return this.client.request(`GET`,`${this.base}/transcript?format=${e}`)}doc(e){return this.client.request(`GET`,`${this.base}/docs/${jl(e)}`)}extensions(){return this.client.request(`GET`,`${this.base}/extensions`)}setExtension(e){return this.client.request(`PATCH`,`${this.base}/extensions`,e)}demo(e,t,n=`POST`){return this.client.request(n,`${this.base}/demo/${e}`,t)}events(e,t=[]){return this.client.stream(`${this.base}/events${t.length?`?docs=${t.map(jl).join(`,`)}`:``}`,e)}},Il=e=>new Nl(`/api/devices/${encodeURIComponent(e)}`);async function Ll(e,t,n){let r=await fetch(`/api${t}`,{method:e,headers:n===void 0?{}:{"content-type":`application/json`},body:n===void 0?void 0:JSON.stringify(n)}),i=await r.json().catch(()=>void 0);if(!r.ok){let e=i?.error;throw new Cl(e?.code??`internal`,e?.message??`${r.status} ${r.statusText}`,r.status)}return i}var Rl={network:()=>Ll(`GET`,`/network`),check:e=>Ll(`POST`,`/devices/${encodeURIComponent(e)}/check`,{}),async uiGet(e){return(await Ll(`GET`,`/ui-state/${encodeURIComponent(e)}`)).value??void 0},uiSet:(e,t)=>Ll(`PUT`,`/ui-state/${encodeURIComponent(e)}`,{value:t})},zl=e=>e instanceof Error?e.message:String(e),Bl=[`demo.job-runs`,`demo.workspace`],Vl=e=>`${e.deviceId}/agent/${e.sessionId}/${e.agentId}?docs=${Bl.join(`,`)}`,Hl=e=>`${e.deviceId}/session/${e.sessionId}`,Ul=e=>`${e}/device?docs=app.shared-state`;function Wl(e,t,n,r=`hello`){let i=O(`idle`),a=O(``);return e.route(t,e=>{e.type===`hello`?(i.value=r===`hello`?`live`:`connecting`,r===`hello`&&(a.value=``)):e.type===`disconnected`?i.value=`reconnecting`:e.type===`fault`?(i.value=`fault`,a.value=e.error.message):(n(e),e.type===r&&(a.value=``,i.value=`live`))}),{status:i,fault:a,select:n=>{a.value=``,i.value=n?`connecting`:`idle`,e.set(t,n)},retry:()=>{i.value=`connecting`,e.reopen(t)}}}function Gl(e){let t=new hl,n=O(0);return t.subscribe(()=>n.value++),e.onNetwork(e=>t.apply({type:`network`,devices:e})),{model:t,devices:B(()=>(n.value,t.devices)),tree:B(()=>(n.value,t.tree()))}}function Kl(e,t){let n=an(),r=an([]),{status:i,select:a}=Wl(e,`device`,e=>{e.type===`doc`&&e.kind===`app.shared-state`?n.value={value:e.value,revision:e.revision??0}:e.type===`activity`&&(r.value=[...r.value,...e.items].slice(-50))});return Zn(t,e=>{n.value=void 0,a(e?Ul(e):void 0)},{immediate:!0}),{sharedState:n,activity:r,status:i}}function ql(e,t){let n=new cl,r=O(0);n.subscribe(()=>r.value++);let{status:i,fault:a,select:o}=Wl(e,`session`,e=>n.apply(e));return Zn(()=>t.value?Hl(t.value):void 0,e=>{n.clear(),o(e)},{immediate:!0}),{model:n,state:B(()=>(r.value,n.state)),status:i,fault:a}}function Jl(e,t){let n=new sl,r=O(0);n.subscribe(()=>r.value++);let{status:i,fault:a,select:o,retry:s}=Wl(e,`agent`,e=>n.apply(e),`snapshot`);return Zn(()=>t.value?Vl(t.value):void 0,e=>{n.clear(),o(e)},{immediate:!0}),{model:n,state:B(()=>(r.value,{...n.state})),status:i,fault:a,version:r,retry:s}}var Yl=new bl,Xl=O(Yl.state);Yl.onState(e=>Xl.value=e);var Zl=Gl(Yl),Ql=O(),H=O(),$l=O(new Set),eu=O(300),tu=Kt({tree:!0,inspector:!0}),nu=O(!1),ru=B(()=>H.value?.deviceId),iu=B(()=>Zl.devices.value.find(e=>e.id===ru.value)),au=B(()=>iu.value?.status===`online`),ou=ql(Yl,B(()=>H.value?{deviceId:H.value.deviceId,sessionId:H.value.sessionId}:void 0)),su=Jl(Yl,H),cu=Kl(Yl,ru),lu=B(()=>iu.value?.tree?.sessions.find(e=>e.id===H.value?.sessionId)),uu=B(()=>ru.value?Il(ru.value):void 0),du=B(()=>H.value&&uu.value?uu.value.agent(H.value.sessionId,H.value.agentId):void 0),fu=B(()=>H.value&&uu.value?uu.value.session(H.value.sessionId):void 0);function pu(e){H.value=e,U.drawer=!1,mu=!!e,hu()}var mu=!1;function hu(){let e=H.value;if(!mu||!e)return;let t=Zl.devices.value.find(t=>t.id===e.deviceId)?.tree?.sessions.find(t=>t.id===e.sessionId)?.agents,n=new Map((t??[]).map(e=>[e.id,e])),r=[e.deviceId,`${e.deviceId}/s/${e.sessionId}`,`${e.deviceId}/s/${e.sessionId}/a/${e.agentId}`],i=n.get(e.agentId),a=new Set;for(;i&&!a.has(i.id);){a.add(i.id);let t=i.parentId??i.ownerAgentId;if(t===void 0)break;r.push(`${e.deviceId}/s/${e.sessionId}/a/${t}`),i=n.get(t)}r.some(e=>!$l.value.has(e))&&($l.value=new Set([...$l.value,...r])),n.has(e.agentId)&&(mu=!1)}Zn(()=>Zl.devices.value,hu);function gu(e,t){let n=new Set($l.value);t??!n.has(e)?n.add(e):n.delete(e),$l.value=n}var _u=(()=>{let e=new Map;return(t,n)=>{clearTimeout(e.get(t)),e.set(t,setTimeout(()=>void Rl.uiSet(t,n).catch(()=>{}),300))}})();Zn(H,e=>nu.value&&void Rl.uiSet(`tree.selected`,e??null).catch(()=>{})),Zn(eu,e=>nu.value&&_u(`tree.width`,e)),Zn(tu,e=>nu.value&&_u(`layout.panels`,{...e}));async function vu(){Yl.start();try{let[e,t,n,r]=await Promise.all([Rl.network(),Rl.uiGet(`tree.selected`),Rl.uiGet(`tree.width`),Rl.uiGet(`layout.panels`)]);r&&Object.assign(tu,r),Ql.value=e.configFile,Zl.model.devices.length||Zl.model.apply({type:`network`,devices:e.devices}),$l.value=new Set,n&&(eu.value=n),t&&e.devices.some(e=>e.id===t.deviceId)?pu(t):yu(e.devices)}catch(e){U.error=zl(e)}finally{nu.value=!0}}function yu(e){for(let t of e){let e=t.status===`online`?t.tree?.sessions[0]:void 0,n=e?.agents.find(e=>e.kind===`root`)??e?.agents[0];if(e&&n)return pu({deviceId:t.id,sessionId:e.id,agentId:n.id})}}Zn(()=>[su.status.value,lu.value],([e,t])=>{e===`fault`&&!t&&au.value&&(W(`That session was archived on its device.`),pu(void 0))});var bu=B(()=>iu.value?.info?.models??[]),xu=su.state,Su=B(()=>ou.state.value.agents.length?ou.state.value.agents:lu.value?.agents??[]),Cu=B(()=>H.value?ll(Su.value,H.value.agentId):[]),wu=B(()=>{let e=H.value?.agentId;if(e===void 0)return[];let t=Su.value,n=new Set([e]);for(let e=!0;e;){e=!1;for(let r of t)r.ownerAgentId!==void 0&&n.has(r.ownerAgentId)&&!n.has(r.id)&&(n.add(r.id),e=!0)}let r=ou.state.value.tasks,i=new Map(r.map(e=>[e.id,e])),a=new Map(t.map(e=>[e.id,e.ownerTaskId]));return r.filter(e=>n.has(e.conversationId)).map(e=>{let t=e,n=!1,r=new Set;for(;t&&!r.has(t.id);){if(r.add(t.id),t.background){n=!0;break}let e=t.owner??a.get(t.conversationId);t=e===void 0?void 0:i.get(e)}return{...e,effectiveBackground:n}})}),Tu=B(()=>xu.value.running||wu.value.some(e=>!e.effectiveBackground&&e.conversationId===H.value?.agentId)),Eu=B(()=>nl(xu.value.usage)),Du=B(()=>{let e=xu.value.agent.model;return bu.value.find(t=>t.provider===e?.provider&&t.id===e?.modelId)}),Ou=an(),ku=0;async function Au(){let e=du.value,t=++ku;if(!e||!au.value)return void(Ou.value=void 0);try{let n=await e.get();t===ku&&(Ou.value=n)}catch{t===ku&&(Ou.value=void 0)}}Zn([du,au],()=>void Au(),{immediate:!0});var U=Kt({error:``,toast:``,drawer:!1,inspectorOverlay:!1,tab:`session`,composer:``,dialog:void 0}),ju;function W(e){U.toast=e,clearTimeout(ju),ju=setTimeout(()=>U.toast=``,4500)}async function Mu(e){U.error=``;try{return await e()}catch(e){U.error=zl(e);return}}function Nu(e){U.composer=e,setTimeout(()=>document.querySelector(`.composer textarea`)?.focus())}var Pu=e=>Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e),Fu=e=>JSON.stringify(e,null,2),Iu=(e=``)=>Sl(bu.value.find(t=>t.id===e)?.icon);function Lu(e){if(!e)return`never`;let t=Math.max(0,Math.round((Date.now()-e)/1e3));return t<60?`${t}s ago`:t<3600?`${Math.round(t/60)}m ago`:t<86400?`${Math.round(t/3600)}h ago`:`${Math.round(t/86400)}d ago`}var Ru=O(!1);async function zu(){Tu.value&&!Ru.value&&du.value&&(Ru.value=!0,await Mu(()=>du.value.abort(!1))&&W(`Foreground work interrupted. Background jobs continue.`),Ru.value=!1)}var Bu=window.matchMedia(`(max-width: 1100px)`),Vu=O(Bu.matches);Bu.addEventListener(`change`,e=>Vu.value=e.matches);var Hu=B(()=>Vu.value?U.inspectorOverlay:tu.inspector);function Uu(e){e&&(U.tab=e),Vu.value?(U.drawer=!1,U.inspectorOverlay=!0):tu.inspector=!0}function Wu(){Vu.value?U.inspectorOverlay=!1:tu.inspector=!1}function Gu(){Vu.value?(U.drawer=!U.drawer)&&(U.inspectorOverlay=!1,tu.tree=!0):tu.tree=!tu.tree}function Ku(){Hu.value?Wu():Uu()}var qu=/Mac|iPhone|iPad/.test(navigator.userAgent),Ju=qu?{tree:`Ctrl+N`,inspector:`Ctrl+T`}:{tree:`Alt+Shift+N`,inspector:`Alt+Shift+T`};function Yu(e){if(!(!(qu?e.ctrlKey&&!e.metaKey&&!e.altKey&&!e.shiftKey:e.altKey&&e.shiftKey&&!e.ctrlKey&&!e.metaKey)||e.repeat||e.isComposing)){if(e.code===`KeyN`)return`tree`;if(e.code===`KeyT`)return`inspector`}}var Xu={class:`topbar`},Zu={class:`brand`},Qu={class:`daemon`,"data-testid":`topbar-stats`},$u=[`title`],ed={class:`top-actions`},td=[`disabled`],nd=[`disabled`],rd=A({__name:`TopBar`,emits:[`newSession`],setup(e,{emit:t}){let n=B(()=>Zl.devices.value.filter(e=>e.status===`online`).length),r=B(()=>Zl.devices.value.reduce((e,t)=>e+(t.tree?.sessions.length??0),0)),i=B(()=>Zl.devices.value.reduce((e,t)=>e+(t.tree?.sessions.reduce((e,t)=>e+t.agents.length,0)??0),0)),a=O(!1);async function o(){let e=fu.value,t=H.value;if(!e||!t||a.value)return;a.value=!0;let n=await Mu(()=>e.createAgent({}));a.value=!1,n&&(pu({...t,agentId:n.id}),W(`New agent. Same session, same shared App State.`))}let s=t;return(e,t)=>(N(),P(`header`,Xu,[I(`div`,Zu,[I(`button`,{class:`icon-button tree-toggle`,"aria-label":`Toggle network`,title:`Network`,onClick:t[0]||=e=>k(U).drawer=!k(U).drawer},[L(k(kc),{size:19})]),t[4]||=I(`img`,{class:`brandmark`,src:`/icons/durable-pi.svg`,alt:`Durable Pi`},null,-1),t[5]||=I(`strong`,null,`Durable Pi`,-1)]),t[12]||=I(`span`,{class:`topbar-sep`,"aria-hidden":`true`},null,-1),I(`div`,Qu,[I(`span`,{class:C([`dot`,{off:!n.value}]),"aria-hidden":`true`},null,2),I(`span`,{class:`network-summary`,title:`${n.value} of ${k(Zl).devices.value.length} devices online`},[L(k(Tc),{size:16}),R(T(n.value)+` of `+T(k(Zl).devices.value.length)+` online`,1)],8,$u),t[8]||=I(`span`,{class:`sep`,"aria-hidden":`true`},`·`,-1),I(`span`,null,[I(`b`,null,T(r.value),1),t[6]||=R(` sessions`,-1)]),t[9]||=I(`span`,{class:`sep`,"aria-hidden":`true`},`·`,-1),I(`span`,null,[I(`b`,null,T(i.value),1),t[7]||=R(` agents`,-1)])]),I(`div`,ed,[I(`span`,{class:C([`chip connection`,{accent:k(Xl)===`live`}])},[I(`span`,{class:C([`dot`,{off:k(Xl)!==`live`}]),"aria-hidden":`true`},null,2),R(T(k(Xl)===`live`?`Connected`:`Reconnecting`),1)],2),I(`button`,{class:`icon-button`,title:`How this works`,"aria-label":`How this works`,onClick:t[1]||=e=>k(U).dialog={kind:`help`}},[L(k(ec),{size:19})]),I(`button`,{class:`secondary small new-agent-button`,disabled:!k(H)||!k(au)||a.value,title:`Start a fresh agent in this session`,onClick:o},[L(k(Nc),{size:18}),t[10]||=R(`New agent `,-1)],8,td),I(`button`,{class:`primary small`,onClick:t[2]||=e=>s(`newSession`)},[L(k(Nc),{size:18}),t[11]||=R(`New session `,-1)]),I(`button`,{class:`icon-button inspector-toggle`,"aria-label":`Toggle inspector`,title:`Inspector`,disabled:!k(H)||!k(au),onClick:t[3]||=e=>k(U).inspectorOverlay?k(Wu)():k(Uu)()},[L(k(Ac),{size:19})],8,nd)])]))}}),id={class:`mnav`,"aria-label":`Panels`},ad={key:0,class:`badge`},od=A({__name:`MobileNav`,setup(e){function t(){U.drawer=!1,U.inspectorOverlay=!1}return(e,n)=>(N(),P(`nav`,id,[I(`button`,{type:`button`,class:C({"is-on":!k(U).drawer&&!k(Hu)}),onClick:t},[L(k(Sc),{size:18}),n[2]||=R(`Chat `,-1)],2),I(`button`,{type:`button`,class:C({"is-on":k(Hu)}),onClick:n[0]||=e=>k(Hu)?k(Wu)():k(Uu)()},[L(k(Ac),{size:18}),n[3]||=R(`Details`,-1),k(wu).length?(N(),P(`span`,ad,T(k(wu).length),1)):z(``,!0)],2),I(`button`,{type:`button`,class:C({"is-on":k(U).drawer}),onClick:n[1]||=e=>k(Gu)()},[L(k(Uc),{size:18}),n[4]||=R(`Network `,-1)],2)]))}}),sd=[`width`,`height`,`aria-label`],cd=[`width`,`height`,`aria-label`],ld=A({__name:`DeviceIcon`,props:{device:{},size:{default:16}},setup(e){let t=e,n=B(()=>{let e=t.device;return e?.kind===`exe-dev`||e?.url?.includes(`.exe.xyz`)?`exe`:e?.info?.platform.startsWith(`darwin`)?`apple`:e?.kind===`local`?`laptop`:`server`}),r=B(()=>{let e={exe:`exe.dev VM`,apple:`macOS`,laptop:`This computer`,server:`Server`}[n.value];return t.device?.transport===`tunnel`?`${e} (tunnel)`:e});return(t,i)=>n.value===`exe`?(N(),P(`svg`,{key:0,class:`device-icon exe`,viewBox:`0 0 512 512`,width:e.size,height:e.size,role:`img`,"aria-label":r.value},[I(`title`,null,T(r.value),1),i[0]||=I(`path`,{fill:`currentColor`,"fill-rule":`evenodd`,d:`M8 332.2l.9 1.4 1.5 .5 38.5-4.1 3.1 .4 2.7 2.2 8.8 13.2 10.1 12.8 1.1 2.6-.3 3.2-16.4 35.6 0 1.7 1 1.2 2.2 0 33.8-18.2 3.1-.8 3.4 1 12.4 8.7 15.3 9.4 1.5 2.1 .5 2.5-3.1 38.9 .4 1.5 1.3 .9 2.3-.7 25.9-29.2 2.1-1.3 2.8-.4 16.3 4.4 15.7 3.2 3 1.8 1.6 2.8 9.8 37.1 1.5 1.6 1.7-.1 1.1-1.1 14.5-35.6 1.8-2.5 3.4-1.5 15.7-1.1 16.1-2.4 3.2 .5 2.3 1.8 22.4 32 2.2 .9 1.4-.7 .6-1.5 1.4-39 1-2.7 2.4-2.2 14.7-6.8 13.8-7.8 3.4-.7 3 1 32.4 21 2.3 0 1.1-1.1 0-1.6-13.4-36.6-.3-2.5 .7-2.4 12.2-13.9 8.8-12.1 2.8-2 3.1-.3 38.4 5.4 2.1-.9 .5-1.5-.6-1.4-27.5-27.4-1.6-2.7-.2-3.1 4.6-15.8 2.9-15.8 1.3-2.6 2.5-1.9 37.3-12.2 1.6-1.9-.3-1.5-1.1-1-36.8-12.5-2.4-1.4-1.8-3.3-3.1-17.7 0-2.2 .9-2.4 3.1-2.9 10.6-15.3 3.3-1.8 3.4 .3 3.8 3 4.5 6.8 8.9 11.2 12.5 12.5 6.2 4.8 7.3 4.3 6.3 2.4 3.8 .3 4-.3 5.1-2.4 6.5-7 4.8-10.6 3.3-11.9 2-14.1 1.3-3.4 0-66.6-.8-2.6-2-13.6-3.8-14.6-7.5-18.7-4.7-9.4-4-6-7.2-7.1-5-2.1-6.5 0-2.2 .7-6 3.5-12 12-13.1 17.8-11.7 18.2-3.7 1.6-11.8-.1-3.1-1.6-1.8-2.9-.3-8.8-2.8-12.7-1.5-4-7.1-13.3-5.9-7.8-10.7-9.3-8.6-4.7-5.9-2-4.1-.5-6.7-.5-4.1 .5-7 2-7.3 3.8-7.5 7-2.2 3.2-2.5 5.5-2.8 10.5-.5 3.6 .1 17.1-.3 2.2-1.1 1.9-1.7 1.5-3.7 1.5-2.6 .3-27.5-10.5-14.5-4-15.7-3.2-2.6-1.3-1.9-3-9.9-37.5-.9-1.2-1.4-.4-1.3 .4-.8 1-14.7 36.1-1.8 2.1-2.2 1.2-17.8 1.4-15 2.2-3.4-.7-2.4-2.1-22-31.5-2-.9-1.5 .5-.7 1.5-1.4 38.6-.9 3-2.5 2.5-14.7 6.8-13.8 7.8-2.8 .7-3.1-.7-32.9-21.3-2.3 0-1.1 1.1-.1 1.6 13.6 36.9 0 3.1-1.2 2.6-10.8 12-9.5 12.9-2.8 2-3.2 .3-38.4-5.4-1.5 .4-.9 1.4 .6 2.1 27.6 27.6 1.2 1.8 .5 2.2-3 10.6-1.5 2.4-2.4 1.6-5.8 1-4.4 1.8-3.8 3-3 3.8-1.7 4-.7 4.7 .4 4.7 1.5 4.2 .3 .5 30.7 0 1.7 .6 1.4 1.1 1.1 3-1.1 2.9-2.7 1.6-31.1 .1-.6 1.1-1.2 3.6-.4 4.1 .4 4.2 1.2 3.5 2.5 4 3.2 3.1 4.1 2.3 5.6 1.8 2.4 2.1 .9 2.1 5.1 21.2-.6 2.1-1.2 1.9-28.5 26.5zM283.6 189.4l6.6 .5 5.6 1.2 6.2 2.2 5.9 3.1 4.6 3.4 4.8 4.5 3.5 4.4 3.4 5.8 2.6 6.2 1.6 6.4 .6 5.6-.2 6.7-1.1 6.5-1.7 5.4-2.9 6-3.6 5.5-7.1 7.3-8.4 5.4-9.4 3.5-9.9 1.3-11-1-40.4-10.4-2.8-1.1-3.1-2.4-1.7-.6-.9-1.1-.1-2.2-1.4-2.2 1.6-6.3 18.1-38.5 4.7-7.5 7.1-7.3 8.4-5.4 9.4-3.5zM173.9 198l-1.1 5.9-2.3 5.5-3.4 5-4.2 4.3-5 3.3-5.5 2.3-5.9 1.2-6 0-5.9-1.2-5.6-2.3-5-3.3-4.2-4.3-3.3-5-2.3-5.5-1.2-5.9 0-6 1.2-5.9 2.3-5.5 3.3-5 4.2-4.3 5-3.3 5.6-2.3 5.9-1.2 6 0 5.9 1.2 5.5 2.3 5 3.3 4.2 4.3 3.4 5 2.3 5.5 1.1 5.9zM315.1 213.5l-63.1 37.7 69.5-12.9 0-6.2-1-6.5-2.1-6.1zM237.3 260l-2.6 1.5 40.6 10.5 7.4 .9 7.4-.5 5.4-1.4 5.2-2.1 8.5-5.8 3.8-4.1 3.2-4.5 2.6-5 1.6-4.9zM284.5 196.9l-7.4 .5-8.1 2.3-7.3 4.1-6.3 5.5-5.8 8.5-17.4 37.1 3-.6 76.1-45.5-5.8-5-6.5-3.7-7.1-2.3zM141.1 183.6l-1.1-2.9-2-2.3-2.8-1.3-3.1-.1-2.9 1-2.3 2.1-1.3 2.8-.1 3 1 2.9 2.1 2.3 2.7 1.3 3.1 .2 2.9-1.1 2.3-2 1.3-2.8z`},null,-1)],8,sd)):n.value===`apple`?(N(),P(`svg`,{key:1,class:`device-icon apple`,viewBox:`0 0 384 512`,width:e.size,height:e.size,role:`img`,"aria-label":r.value},[I(`title`,null,T(r.value),1),i[1]||=I(`path`,{fill:`currentColor`,d:`M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z`},null,-1)],8,cd)):n.value===`laptop`?(N(),F(k(gc),{key:2,class:`device-icon`,size:e.size,"aria-label":r.value},null,8,[`size`,`aria-label`])):(N(),F(k(Lc),{key:3,class:`device-icon`,size:e.size,"aria-label":r.value},null,8,[`size`,`aria-label`]))}}),ud=[`aria-level`,`aria-expanded`,`aria-selected`,`data-key`,`title`],dd=[`aria-label`],fd={key:1,class:`chev`},pd={class:`name`},md={class:`badge`},hd=[`aria-label`],gd=[`disabled`,`aria-label`],_d=[`aria-label`],vd={class:`name`},yd={class:`path`},bd={key:0,class:`dot work`,title:`Working`},xd=[`title`],Sd=[`disabled`,`aria-label`],Cd=[`disabled`,`aria-label`],wd=[`disabled`,`aria-label`],Td={class:`name`},Ed={key:3,class:`meta`},Dd={key:4,class:`dot work`,title:`Working`},Od=[`title`],kd=[`disabled`,`aria-label`],Ad=A({__name:`TreeRow`,props:{node:{},depth:{},open:{type:Boolean},selected:{type:Boolean},focused:{type:Boolean},online:{type:Boolean}},emits:[`toggle`,`activate`,`action`],setup(e,{emit:t}){let n=e,r=t,i=B(()=>n.node.children.length>0),a=B(()=>n.node.type===`device`?n.node.device:void 0),o=B(()=>n.node.type===`session`?n.node.session:void 0),s=B(()=>n.node.type===`agent`?n.node.agent:void 0),c=B(()=>o.value?o.value.agents.reduce((e,t)=>e+t.background,0):s.value?.background??0),l=B(()=>o.value?.busy||s.value?.busy),u=B(()=>{let e=a.value;if(!e)return``;let t=e.tree?.sessions.length??0;switch(e.status){case`online`:return`${t} session${t===1?``:`s`}`;case`checking`:return`checking…`;case`unauthorized`:return e.hasToken?`token rejected`:`no token`;case`mismatch`:return`identity changed`;case`incompatible`:return`incompatible`;default:return`offline · ${Lu(e.lastSeenAt)}`}}),d=B(()=>{let e=a.value?.status;return e===`online`?`on`:e===`checking`?`chk`:e===`offline`?`off`:`err`}),f=B(()=>a.value?.name??a.value?.id??o.value?.name??s.value?.name??``),p=B(()=>{if(a.value)return`${a.value.name} · ${a.value.url}${a.value.error?`\n${a.value.error}`:``}`;if(o.value)return`${o.value.name}\n${o.value.cwd}`;let e=s.value;return e.kind===`fork`?`Fork of agent #${e.parentId} at entry #${e.forkedAt}`:e.kind===`subagent`?`Subagent owned by agent #${e.ownerAgentId}`:`Root agent`});return(t,n)=>(N(),P(`div`,{class:C([`tree-row`,[e.node.type,{sel:e.selected,focus:e.focused,stale:e.node.stale}]]),style:ye({"--depth":e.depth}),role:`treeitem`,"aria-level":e.depth+1,"aria-expanded":i.value?e.open:void 0,"aria-selected":e.selected,"data-key":e.node.key,title:p.value,onClick:n[11]||=e=>r(`activate`)},[i.value?(N(),P(`button`,{key:0,class:`chev`,tabindex:`-1`,"aria-label":e.open?`Collapse ${f.value}`:`Expand ${f.value}`,onClick:n[0]||=js(e=>r(`toggle`),[`stop`])},[e.open?(N(),F(k(Zs),{key:0,size:16})):(N(),F(k(Qs),{key:1,size:16}))],8,dd)):(N(),P(`span`,fd)),a.value?(N(),P(M,{key:2},[I(`i`,{class:C([`dot`,d.value])},null,2),L(ld,{device:a.value,size:16},null,8,[`device`]),I(`b`,pd,T(f.value),1),I(`span`,md,T(a.value.kind),1),I(`span`,{class:C([`meta`,{err:d.value===`err`}])},T(u.value),3),I(`span`,{class:`acts`,onClick:n[4]||=js(()=>{},[`stop`])},[a.value.pairing?(N(),P(`button`,{key:0,class:`icon-button`,"aria-label":`Manage credentials for ${f.value}`,title:`Manage device credentials, including while offline`,onClick:n[1]||=e=>r(`action`,`credentials`)},[L(k(hc),{size:16})],8,hd)):z(``,!0),I(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New session on ${f.value}`,title:`New session on this device`,onClick:n[2]||=e=>r(`action`,`new-session`)},[L(k(Nc),{size:16})],8,gd),I(`button`,{class:`icon-button`,"aria-label":`Check ${f.value}`,title:`Check connection now`,onClick:n[3]||=e=>r(`action`,`check`)},[L(k(Fc),{size:16})],8,_d)])],64)):o.value?(N(),P(M,{key:3},[L(k(cc),{class:`ico`,size:16}),I(`b`,vd,T(f.value),1),I(`span`,yd,`…/`+T(o.value.cwd.split(`/`).filter(Boolean).at(-1)),1),l.value?(N(),P(`i`,bd)):z(``,!0),c.value?(N(),P(`span`,{key:1,class:`bg-count`,title:`${c.value} background task(s)`},[n[12]||=I(`i`,{class:`dot bg`},null,-1),R(T(c.value)+` bg`,1)],8,xd)):z(``,!0),I(`span`,{class:`acts`,onClick:n[8]||=js(()=>{},[`stop`])},[I(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New agent in ${f.value}`,title:`New agent in this session`,onClick:n[5]||=e=>r(`action`,`new-agent`)},[L(k(Nc),{size:16})],8,Sd),I(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Rename session ${f.value}`,title:`Rename session`,onClick:n[6]||=e=>r(`action`,`rename`)},[L(k(jc),{size:16})],8,Cd),I(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Archive session ${f.value}`,title:`Archive session`,onClick:n[7]||=e=>r(`action`,`archive`)},[L(k(Ws),{size:16})],8,wd)])],64)):s.value?(N(),P(M,{key:4},[s.value.kind===`fork`?(N(),F(k(dc),{key:0,class:`ico`,size:16})):s.value.kind===`subagent`?(N(),F(k(rc),{key:1,class:`ico`,size:16})):(N(),F(k(Sc),{key:2,class:`ico root`,size:16})),I(`span`,Td,T(f.value),1),s.value.kind===`fork`&&s.value.forkedAt!==void 0?(N(),P(`span`,Ed,`@ #`+T(s.value.forkedAt),1)):z(``,!0),l.value?(N(),P(`i`,Dd)):z(``,!0),c.value?(N(),P(`span`,{key:5,class:`bg-count`,title:`${c.value} background task(s)`},[n[13]||=I(`i`,{class:`dot bg`},null,-1),R(T(c.value),1)],8,Od)):z(``,!0),I(`span`,{class:`acts`,onClick:n[10]||=js(()=>{},[`stop`])},[I(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Rename agent ${f.value}`,title:`Rename agent`,onClick:n[9]||=e=>r(`action`,`rename`)},[L(k(jc),{size:16})],8,kd)])],64)):z(``,!0)],14,ud))}}),jd={class:`tree-head`},Md=[`title`],Nd={key:0,class:`hint tree-empty`,"data-testid":`tree-empty`},Pd={key:1,class:`panel-rail`,"aria-label":`Network (collapsed)`},Fd=[`title`],Id=[`title`,`aria-label`,`onClick`],Ld=A({__name:`NetworkSidebar`,setup(e){let t=B(()=>{let e=[],t=(n,r,i)=>{for(let a of n)e.push({node:a,depth:r,parent:i}),a.children.length&&$l.value.has(a.key)&&t(a.children,r+1,a.key)};return t(Zl.tree.value,0),e}),n=O(),r=O(),i=e=>Zl.devices.value.find(t=>t.id===(e.type===`device`?e.device.id:e.deviceId)),a=e=>i(e)?.status===`online`,o=e=>e.type===`agent`&&H.value?.deviceId===e.deviceId&&H.value.sessionId===e.sessionId&&H.value.agentId===e.agent.id;function s(e){if(n.value=e.key,e.type===`device`)return gu(e.key);if(e.type===`agent`)return pu({deviceId:e.deviceId,sessionId:e.sessionId,agentId:e.agent.id});let t=e.session.agents.find(e=>e.kind===`root`)??e.session.agents[0];gu(e.key,!0),t&&pu({deviceId:e.deviceId,sessionId:e.session.id,agentId:t.id})}async function c(e,t){let n=i(e);if(!n)return;let r=Il(n.id);if(e.type===`device`){t===`new-session`?U.dialog={kind:`new-session`,deviceId:n.id}:t===`check`?await Mu(()=>Rl.check(n.id)):t===`credentials`&&(U.dialog={kind:`credentials`,deviceId:n.id});return}if(e.type===`session`){let i=e.session;if(t===`new-agent`){let e=await Mu(()=>r.session(i.id).createAgent({}));e&&(pu({deviceId:n.id,sessionId:i.id,agentId:e.id}),W(`New agent. Same session, same shared App State.`))}else t===`rename`?U.dialog={kind:`prompt`,title:`Rename session`,label:`Session name`,value:i.name,submit:`Save name`,run:e=>r.session(i.id).rename(e)}:t===`archive`&&(U.dialog={kind:`prompt`,title:`Archive ${i.name}?`,hint:`Stops all of its work and moves its files to archive/ on ${n.id}. Nothing is deleted.`,submit:`Archive session`,danger:!0,run:async()=>{await r.session(i.id).archive(),H.value?.sessionId===i.id&&pu(void 0)}});return}let a=e.agent;t===`rename`&&(U.dialog={kind:`prompt`,title:`Rename agent`,label:`Agent name`,value:a.named?a.name:``,placeholder:a.name,submit:`Save name`,run:t=>r.agent(e.sessionId,a.id).rename(t)})}function l(e){let i=t.value.findIndex(e=>e.node.key===n.value),a=t.value[Math.max(0,Math.min(t.value.length-1,(i<0?0:i)+e))];a&&(n.value=a.node.key,jn(()=>r.value?.querySelector(`[data-key="${CSS.escape(a.node.key)}"]`)?.scrollIntoView({block:`nearest`})))}function u(){n.value??=t.value[0]?.node.key}function d(e){let r=t.value.find(e=>e.node.key===n.value);if(e.key===`ArrowDown`)l(1);else if(e.key===`ArrowUp`)l(-1);else if(e.key===`ArrowRight`&&r){if(!r.node.children.length)return;$l.value.has(r.node.key)?l(1):gu(r.node.key,!0)}else if(e.key===`ArrowLeft`&&r)r.node.children.length&&$l.value.has(r.node.key)?gu(r.node.key,!1):r.parent&&(n.value=r.parent);else if((e.key===`Enter`||e.key===` `)&&r)s(r.node);else return;e.preventDefault()}return(e,i)=>(N(),P(`aside`,{class:C([`network-sidebar`,{open:k(U).drawer,collapsed:!k(tu).tree&&!k(U).drawer}]),"aria-label":`Network`},[k(tu).tree||k(U).drawer?(N(),P(M,{key:0},[I(`header`,jd,[I(`span`,null,[L(k(Tc),{size:16}),i[3]||=R(`NETWORK`,-1)]),I(`button`,{class:`icon-button`,"aria-label":`Pair a device`,title:`Pair a device`,onClick:i[0]||=e=>k(U).dialog={kind:`pair`}},[L(k(vc),{size:15})]),I(`button`,{class:`icon-button panel-toggle`,"aria-label":`Collapse network`,title:`Collapse network (${k(Ju).tree})`,onClick:i[1]||=e=>(k(tu).tree=!1,k(U).drawer=!1)},[L(k(Dc),{size:18})],8,Md)]),I(`div`,{ref_key:`list`,ref:r,class:`tree-list`,role:`tree`,tabindex:`0`,"aria-label":`Devices, sessions and agents`,onKeydown:d,onFocus:u},[(N(!0),P(M,null,j(t.value,e=>(N(),F(Ad,{key:e.node.key,node:e.node,depth:e.depth,open:k($l).has(e.node.key),selected:o(e.node),focused:n.value===e.node.key,online:a(e.node),onToggle:t=>k(gu)(e.node.key),onActivate:t=>s(e.node),onAction:t=>c(e.node,t)},null,8,[`node`,`depth`,`open`,`selected`,`focused`,`online`,`onToggle`,`onActivate`,`onAction`]))),128)),t.value.length?z(``,!0):(N(),P(`p`,Nd,[...i[4]||=[R(` No devices yet. Declare them in `,-1),I(`code`,null,`dpi-network.yaml`,-1),R(` (start from `,-1),I(`code`,null,`dpi-network.example.yaml`,-1),R(`), then run `,-1),I(`code`,null,`just net up <id>`,-1),R(`. `,-1)]]))],544)],64)):(N(),P(`div`,Pd,[I(`button`,{class:`icon-button panel-toggle`,"aria-label":`Expand network`,title:`Expand network (${k(Ju).tree})`,onClick:i[2]||=e=>k(tu).tree=!0},[L(k(Oc),{size:18})],8,Fd),(N(!0),P(M,null,j(k(Zl).devices.value,e=>(N(),P(`button`,{key:e.id,class:`rail-device`,title:`${e.id} · ${e.status}`,"aria-label":`Show ${e.id}`,onClick:t=>(k(tu).tree=!0,k(gu)(e.id,!0))},[L(ld,{device:e,size:20},null,8,[`device`]),I(`i`,{class:C([`dot`,e.status===`online`?`on`:e.status===`checking`?`chk`:e.status===`offline`?`off`:`err`])},null,2)],8,Id))),128))]))],2))}});function Rd(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var zd=Rd();function Bd(e){zd=e}var Vd={exec:()=>null};function G(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Ud.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Hd=(()=>{try{return!0}catch{return!1}})(),Ud={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,`i`),blockquoteBeginRegex:e=>RegExp(`^ {0,${Math.min(3,e-1)}}>`)},Wd=/^(?:[ \t]*(?:\n|$))+/,Gd=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Kd=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qd=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Jd=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Yd=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Xd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Zd=G(Xd).replace(/bull/g,Yd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Qd=G(Xd).replace(/bull/g,Yd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),$d=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,ef=/^[^\n]+/,tf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,nf=G(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,tf).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),rf=G(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Yd).getRegex(),af=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,of=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,sf=G(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,of).replace(`tag`,af).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),cf=G($d).replace(`hr`,qd).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,af).getRegex(),lf={blockquote:G(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,cf).getRegex(),code:Gd,def:nf,fences:Kd,heading:Jd,hr:qd,html:sf,lheading:Zd,list:rf,newline:Wd,paragraph:cf,table:Vd,text:ef},uf=G(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,qd).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,af).getRegex(),df={...lf,lheading:Qd,table:uf,paragraph:G($d).replace(`hr`,qd).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,uf).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,af).getRegex()},ff={...lf,html:G(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,of).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Vd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:G($d).replace(`hr`,qd).replace(`heading`,` *#{1,6} *[^
16
- ]`).replace(`lheading`,Zd).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},pf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,mf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hf=/^( {2,}|\\)\n(?!\s*$)/,gf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,_f=/[\p{P}\p{S}]/u,vf=/[\s\p{P}\p{S}]/u,yf=/[^\s\p{P}\p{S}]/u,bf=G(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,vf).getRegex(),xf=/(?!~)[\p{P}\p{S}]/u,Sf=/(?!~)[\s\p{P}\p{S}]/u,Cf=/(?:[^\s\p{P}\p{S}]|~)/u,wf=G(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Hd?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Tf=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ef=G(Tf,`u`).replace(/punct/g,_f).getRegex(),Df=G(Tf,`u`).replace(/punct/g,xf).getRegex(),Of=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,kf=G(Of,`gu`).replace(/notPunctSpace/g,yf).replace(/punctSpace/g,vf).replace(/punct/g,_f).getRegex(),Af=G(Of,`gu`).replace(/notPunctSpace/g,Cf).replace(/punctSpace/g,Sf).replace(/punct/g,xf).getRegex(),jf=G(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,yf).replace(/punctSpace/g,vf).replace(/punct/g,_f).getRegex(),Mf=G(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,_f).getRegex(),Nf=G(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,yf).replace(/punctSpace/g,vf).replace(/punct/g,_f).getRegex(),Pf=G(/\\(punct)/,`gu`).replace(/punct/g,_f).getRegex(),Ff=G(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),If=G(of).replace(`(?:-->|$)`,`-->`).getRegex(),Lf=G(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,If).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Rf=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,zf=G(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Rf).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Bf=G(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Rf).replace(`ref`,tf).getRegex(),Vf=G(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,tf).getRegex(),Hf=G(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Bf).replace(`nolink`,Vf).getRegex(),Uf=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Wf={_backpedal:Vd,anyPunctuation:Pf,autolink:Ff,blockSkip:wf,br:hf,code:mf,del:Vd,delLDelim:Vd,delRDelim:Vd,emStrongLDelim:Ef,emStrongRDelimAst:kf,emStrongRDelimUnd:jf,escape:pf,link:zf,nolink:Vf,punctuation:bf,reflink:Bf,reflinkSearch:Hf,tag:Lf,text:gf,url:Vd},Gf={...Wf,link:G(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Rf).getRegex(),reflink:G(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Rf).getRegex()},Kf={...Wf,emStrongRDelimAst:Af,emStrongLDelim:Df,delLDelim:Mf,delRDelim:Nf,url:G(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Uf).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:G(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Uf).getRegex()},qf={...Kf,br:G(hf).replace(`{2,}`,`*`).getRegex(),text:G(Kf.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Jf={normal:lf,gfm:df,pedantic:ff},Yf={normal:Wf,gfm:Kf,breaks:qf,pedantic:Gf},Xf={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},Zf=e=>Xf[e];function Qf(e,t){if(t){if(Ud.escapeTest.test(e))return e.replace(Ud.escapeReplace,Zf)}else if(Ud.escapeTestNoEncode.test(e))return e.replace(Ud.escapeReplaceNoEncode,Zf);return e}function $f(e){try{e=encodeURI(e).replace(Ud.percentDecode,`%`)}catch{return null}return e}function ep(e,t){let n=e.replace(Ud.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Ud.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(Ud.slashPipe,`|`);return n}function tp(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function np(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function rp(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function ip(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function ap(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
17
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
18
- `)}var op=class{options;rules;lexer;constructor(e){this.options=e||zd}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:tp(e,`
19
- `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=ap(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=tp(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:tp(t[0],`
20
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=tp(t[0],`
21
- `).split(`
22
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
23
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
24
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
25
- ${s}`:s,r=r?`${r}
26
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
27
- `+e.join(`
28
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
29
- `+e.join(`
30
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
31
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=rp(t[2].split(`
32
- `,1)[0],t[1].length),l=e.split(`
33
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
34
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
35
- `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
36
- `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
37
- `+l}u=!l.trim(),r+=p+`
38
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),e.task){if(e.text=e.text.replace(this.rules.other.listReplaceTask,``),e.tokens[0]?.type===`text`||e.tokens[0]?.type===`paragraph`){e.tokens[0].raw=e.tokens[0].raw.replace(this.rules.other.listReplaceTask,``),e.tokens[0].text=e.tokens[0].text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}}let t=this.rules.other.listTaskCheckbox.exec(e.raw);if(t){let n={type:`checkbox`,raw:t[0]+` `,checked:t[0]!==`[ ]`};e.checked=n.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=n.raw+e.tokens[0].raw,e.tokens[0].text=n.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(n)):e.tokens.unshift({type:`paragraph`,raw:n.raw,text:n.raw,tokens:[n]}):e.tokens.unshift(n)}}if(!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=ep(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
39
- `):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(ep(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
40
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=tp(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=np(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),ip(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return ip(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},sp=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||zd,this.options.tokenizer=this.options.tokenizer||new op,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:Ud,block:Jf.normal,inline:Yf.normal};this.options.pedantic?(t.block=Jf.pedantic,t.inline=Yf.pedantic):this.options.gfm&&(t.block=Jf.gfm,t.inline=this.options.breaks?Yf.breaks:Yf.gfm),this.tokenizer.rules=t}static get rules(){return{block:Jf,inline:Yf}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Ud.carriageReturn,`
41
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){for(this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Ud.tabCharGlobal,` `).replace(Ud.spaceLine,``));e;){let r;if(this.options.extensions?.block?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.space(e)){e=e.substring(r.raw.length);let n=t.at(-1);r.raw.length===1&&n!==void 0?n.raw+=`
42
- `:t.push(r);continue}if(r=this.tokenizer.code(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
43
- `)?``:`
44
- `)+r.raw,n.text+=`
45
- `+r.text,this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(r=this.tokenizer.fences(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.heading(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.hr(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.blockquote(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.list(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.html(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.def(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
46
- `)?``:`
47
- `)+r.raw,n.text+=`
48
- `+r.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[r.tag]||(this.tokens.links[r.tag]={href:r.href,title:r.title},t.push(r));continue}if(r=this.tokenizer.table(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.lheading(e)){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(this.state.top&&(r=this.tokenizer.paragraph(i))){let a=t.at(-1);n&&a?.type===`paragraph`?(a.raw+=(a.raw.endsWith(`
49
- `)?``:`
50
- `)+r.raw,a.text+=`
51
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):t.push(r),n=i.length!==e.length,e=e.substring(r.raw.length);continue}if(r=this.tokenizer.text(e)){e=e.substring(r.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
52
- `)?``:`
53
- `)+r.raw,n.text+=`
54
- `+r.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e,r=null;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(n))!==null;)e.includes(r[0].slice(r[0].lastIndexOf(`[`)+1,-1))&&(n=n.slice(0,r.index)+`[`+`a`.repeat(r[0].length-2)+`]`+n.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.anyPunctuation.exec(n))!==null;)n=n.slice(0,r.index)+`++`+n.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let i;for(;(r=this.tokenizer.rules.inline.blockSkip.exec(n))!==null;)i=r[2]?r[2].length:0,n=n.slice(0,r.index+i)+`[`+`a`.repeat(r[0].length-i-2)+`]`+n.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let a=!1,o=``;for(;e;){a||(o=``),a=!1;let r;if(this.options.extensions?.inline?.some(n=>(r=n.call({lexer:this},e,t))?(e=e.substring(r.raw.length),t.push(r),!0):!1))continue;if(r=this.tokenizer.escape(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.tag(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.link(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(r.raw.length);let n=t.at(-1);r.type===`text`&&n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(r=this.tokenizer.emStrong(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.codespan(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.br(e)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.del(e,n,o)){e=e.substring(r.raw.length),t.push(r);continue}if(r=this.tokenizer.autolink(e)){e=e.substring(r.raw.length),t.push(r);continue}if(!this.state.inLink&&(r=this.tokenizer.url(e))){e=e.substring(r.raw.length),t.push(r);continue}let i=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(r=this.tokenizer.inlineText(i)){e=e.substring(r.raw.length),r.raw.slice(-1)!==`_`&&(o=r.raw.slice(-1)),a=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=r.raw,n.text+=r.text):t.push(r);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw Error(t)}}return t}},cp=class{options;parser;constructor(e){this.options=e||zd}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Ud.notSpaceStart)?.[0],i=e.replace(Ud.endingNewline,``)+`
55
- `;return r?`<pre><code class="language-`+Qf(r)+`">`+(n?i:Qf(i,!0))+`</code></pre>
56
- `:`<pre><code>`+(n?i:Qf(i,!0))+`</code></pre>
57
- `}blockquote({tokens:e}){return`<blockquote>
58
- ${this.parser.parse(e)}</blockquote>
59
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
60
- `}hr(e){return`<hr>
61
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
62
- `+r+`</`+i+`>
63
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
64
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
65
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
66
- <thead>
67
- `+t+`</thead>
68
- `+r+`</table>
69
- `}tablerow({text:e}){return`<tr>
70
- ${e}</tr>
71
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
72
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Qf(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=$f(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Qf(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=$f(e);if(i===null)return Qf(n);e=i;let a=`<img src="${e}" alt="${Qf(n)}"`;return t&&(a+=` title="${Qf(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Qf(e.text)}},lp=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},up=class e{options;renderer;textRenderer;constructor(e){this.options=e||zd,this.options.renderer=this.options.renderer||new cp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new lp}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},dp=class{options;block;constructor(e){this.options=e||zd}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?sp.lex:sp.lexInline}provideParser(e=this.block){return e?up.parse:up.parseInline}},fp=new class{defaults=Rd();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=up;Renderer=cp;TextRenderer=lp;Lexer=sp;Tokenizer=op;Hooks=dp;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new cp(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new op(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new dp;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=dp.passThroughHooks.has(n)?e=>{if(this.defaults.async&&dp.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return sp.lex(e,t??this.defaults)}parser(e,t){return up.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?sp.lex:sp.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?up.parse:up.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?sp.lex:sp.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?up.parse:up.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
73
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Qf(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function K(e,t){return fp.parse(e,t)}K.options=K.setOptions=function(e){return fp.setOptions(e),K.defaults=fp.defaults,Bd(K.defaults),K},K.getDefaults=Rd,K.defaults=zd,K.use=function(...e){return fp.use(...e),K.defaults=fp.defaults,Bd(K.defaults),K},K.walkTokens=function(e,t){return fp.walkTokens(e,t)},K.parseInline=fp.parseInline,K.Parser=up,K.parser=up.parse,K.Renderer=cp,K.TextRenderer=lp,K.Lexer=sp,K.lexer=sp.lex,K.Tokenizer=op,K.Hooks=dp,K.parse=K,K.options,K.setOptions,K.use,K.walkTokens,K.parseInline,up.parse,sp.lex;function pp(e,t){this.v=e,this.k=t}function mp(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function hp(e){if(Array.isArray(e))return e}function gp(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function _p(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
74
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vp(e,t){return hp(e)||gp(e,t)||yp(e,t)||_p()}function yp(e,t){if(e){if(typeof e==`string`)return mp(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mp(e,t):void 0}}function bp(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof pp;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}bp.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},bp.prototype.next=function(e){return this._invoke(`next`,e)},bp.prototype.throw=function(e){return this._invoke(`throw`,e)},bp.prototype.return=function(e){return this._invoke(`return`,e)};var xp=Object.entries,Sp=Object.setPrototypeOf,Cp=Object.isFrozen,wp=Object.getPrototypeOf,Tp=Object.getOwnPropertyDescriptor,Ep=Object.freeze,Dp=Object.seal,Op=Object.create,kp=typeof Reflect<`u`&&Reflect,Ap=kp.apply,jp=kp.construct;Ep||=function(e){return e},Dp||=function(e){return e},Ap||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},jp||=function(e){return new e(...[...arguments].slice(1))};var Mp=Qp(Array.prototype.forEach);Array.prototype.indexOf;var Np=Qp(Array.prototype.lastIndexOf),Pp=Qp(Array.prototype.pop),Fp=Qp(Array.prototype.push);Array.prototype.slice;var Ip=Qp(Array.prototype.splice),Lp=Array.isArray,Rp=Qp(String.prototype.toLowerCase),zp=Qp(String.prototype.toString),Bp=Qp(String.prototype.match),Vp=Qp(String.prototype.replace),Hp=Qp(String.prototype.indexOf),Up=Qp(String.prototype.trim),Wp=Qp(Number.prototype.toString),Gp=Qp(Boolean.prototype.toString),Kp=typeof BigInt>`u`?null:Qp(BigInt.prototype.toString),qp=typeof Symbol>`u`?null:Qp(Symbol.prototype.toString),Jp=Qp(Object.prototype.hasOwnProperty),Yp=Qp(Object.prototype.toString),Xp=Qp(RegExp.prototype.test),Zp=$p(TypeError);function Qp(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ap(e,t,n)}}function $p(e){return function(){return jp(e,[...arguments])}}function q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Rp;if(Sp&&Sp(e,null),!Lp(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Cp(t)||(t[r]=e),i=e)}e[i]=!0}return e}function em(e){for(let t=0;t<e.length;t++)Jp(e,t)||(e[t]=null);return e}function tm(e){let t=Op(null);for(let r of xp(e)){var n=vp(r,2);let i=n[0],a=n[1];Jp(e,i)&&(t[i]=Lp(a)?em(a):a&&typeof a==`object`&&a.constructor===Object?tm(a):a)}return t}function nm(e){switch(typeof e){case`string`:return e;case`number`:return Wp(e);case`boolean`:return Gp(e);case`bigint`:return Kp?Kp(e):`0`;case`symbol`:return qp?qp(e):`Symbol()`;case`undefined`:return Yp(e);case`function`:case`object`:{if(e===null)return Yp(e);let t=e,n=rm(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Yp(e)}return Yp(e)}default:return Yp(e)}}function rm(e,t){for(;e!==null;){let n=Tp(e,t);if(n){if(n.get)return Qp(n.get);if(typeof n.value==`function`)return Qp(n.value)}e=wp(e)}function n(){return null}return n}function im(e){try{return Xp(e,``),!0}catch{return!1}}var am=Ep(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),om=Ep(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),sm=Ep([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),cm=Ep([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),lm=Ep(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),um=Ep([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),dm=Ep([`#text`]),fm=Ep(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),pm=Ep(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),mm=Ep(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),hm=Ep([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),gm=Dp(/{{[\w\W]*|^[\w\W]*}}/g),_m=Dp(/<%[\w\W]*|^[\w\W]*%>/g),vm=Dp(/\${[\w\W]*/g),ym=Dp(/^data-[\-\w.\u00B7-\uFFFF]+$/),bm=Dp(/^aria-[\-\w]+$/),xm=Dp(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sm=Dp(/^(?:\w+script|data):/i),Cm=Dp(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),wm=Dp(/^html$/i),Tm=Dp(/^[a-z][.\w]*(-[.\w]+)+$/i),Em=Dp(/<[/\w!]/g),Dm=Dp(/<[/\w]/g),Om=Dp(/<\/no(script|embed|frames)/i),km=Dp(/\/>/i),Am={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},jm=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],Mm=Ep(q({},jm)),Nm=function(){let e={};return Mp(jm,t=>{e[t]=Dp(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),Ep(e)}(),Pm=function(){return typeof window>`u`?null:window},Fm=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Im=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Lm=function(e,t,n,r){return Jp(e,t)&&Lp(e[t])?q(r.base?tm(r.base):{},e[t],r.transform):n},Rm=function(e,t,n){let r=Jp(e,t)?e[t]:void 0;return r&&typeof r==`object`?tm(r):n()};function zm(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Pm(),t=e=>zm(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==Am.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=rm(d,`cloneNode`),p=rm(d,`remove`),m=rm(d,`removeAttributeNode`),h=rm(d,`nextSibling`),g=rm(d,`childNodes`),_=rm(d,`parentNode`),v=rm(d,`shadowRoot`),y=rm(d,`attributes`),b=o&&o.prototype?rm(o.prototype,`nodeType`):null,ee=o&&o.prototype?rm(o.prototype,`nodeName`):null,te=o&&o.prototype?rm(o.prototype,`ownerDocument`):null,x=function(e){return b?b(e):e.nodeType},ne=function(e){return ee?ee(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let re,ie=``,ae,oe=!1,se=0,ce=function(){if(se>0)throw Zp(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},le=function(e){ce(),se++;try{return re.createHTML(e)}finally{se--}},ue=function(e){ce(),se++;try{return re.createScriptURL(e)}finally{se--}},de=function(){return oe||=(ae=Fm(u,i),!0),ae},fe=n,S=fe.implementation,pe=fe.createNodeIterator,me=fe.createDocumentFragment,he=fe.getElementsByTagName,ge=r.importNode,_e=Im();t.isSupported=typeof xp==`function`&&typeof _==`function`&&S&&S.createHTMLDocument!==void 0;let ve=gm,ye=_m,be=vm,xe=ym,Se=bm,Ce=Sm,C=Cm,we=Tm,Te=xm,Ee=null,De=q({},[...am,...om,...sm,...lm,...dm]),w=null,Oe=q({},[...fm,...pm,...mm,...hm]),ke=Object.seal(Op(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ae=null,je=null,Me=Object.seal(Op(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),T=!0,Ne=!0,Pe=!1,Fe=!0,Ie=!1,Le=!0,E=!1,Re=!1,ze=null,Be=null,Ve=!1,He=!1,Ue=!1,We=!1,Ge=!0,Ke=!1,qe=`user-content-`,Je=!0,Ye=!1,Xe={},Ze=null,Qe=q({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),$e=null,et=q({},[`audio`,`video`,`img`,`source`,`image`,`track`]),tt=null,nt=q({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),rt=`http://www.w3.org/1998/Math/MathML`,it=`http://www.w3.org/2000/svg`,at=`http://www.w3.org/1999/xhtml`,ot=at,st=!1,ct=null,lt=q({},[rt,it,at],zp),ut=Ep([`mi`,`mo`,`mn`,`ms`,`mtext`]),dt=q({},ut),ft=Ep([`annotation-xml`]),pt=q({},ft),mt=q({},[`title`,`style`,`font`,`a`,`script`]),ht=null,gt=[`application/xhtml+xml`,`text/html`],_t=null,vt=null,yt=n.createElement(`form`),bt=function(e){return e instanceof RegExp||e instanceof Function},xt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(vt&&vt===e)return;(!e||typeof e!=`object`)&&(e={}),e=tm(e),ht=gt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,_t=ht===`application/xhtml+xml`?zp:Rp,Ee=Lm(e,`ALLOWED_TAGS`,De,{transform:_t}),w=Lm(e,`ALLOWED_ATTR`,Oe,{transform:_t}),ct=Lm(e,`ALLOWED_NAMESPACES`,lt,{transform:zp}),tt=Lm(e,`ADD_URI_SAFE_ATTR`,nt,{transform:_t,base:nt}),$e=Lm(e,`ADD_DATA_URI_TAGS`,et,{transform:_t,base:et}),Ze=Lm(e,`FORBID_CONTENTS`,Qe,{transform:_t}),Ae=Lm(e,`FORBID_TAGS`,tm({}),{transform:_t}),je=Lm(e,`FORBID_ATTR`,tm({}),{transform:_t}),Xe=Jp(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?tm(e.USE_PROFILES):e.USE_PROFILES:!1,T=e.ALLOW_ARIA_ATTR!==!1,Ne=e.ALLOW_DATA_ATTR!==!1,Pe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Fe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ie=e.SAFE_FOR_TEMPLATES||!1,Le=e.SAFE_FOR_XML!==!1,E=e.WHOLE_DOCUMENT||!1,He=e.RETURN_DOM||!1,Ue=e.RETURN_DOM_FRAGMENT||!1,We=e.RETURN_TRUSTED_TYPE||!1,Ve=e.FORCE_BODY||!1,Ge=e.SANITIZE_DOM!==!1,Ke=e.SANITIZE_NAMED_PROPS||!1,Je=e.KEEP_CONTENT!==!1,Ye=e.IN_PLACE||!1,Te=im(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:xm,ot=typeof e.NAMESPACE==`string`?e.NAMESPACE:at,dt=Rm(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>q({},ut)),pt=Rm(e,`HTML_INTEGRATION_POINTS`,()=>q({},ft));let t=Rm(e,`CUSTOM_ELEMENT_HANDLING`,()=>Op(null));if(ke=Op(null),Jp(t,`tagNameCheck`)&&bt(t.tagNameCheck)&&(ke.tagNameCheck=t.tagNameCheck),Jp(t,`attributeNameCheck`)&&bt(t.attributeNameCheck)&&(ke.attributeNameCheck=t.attributeNameCheck),Jp(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(ke.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Dp(ke),Ie&&(Ne=!1),Ue&&(He=!0),Xe&&(Ee=q({},dm),w=Op(null),Xe.html===!0&&(q(Ee,am),q(w,fm)),Xe.svg===!0&&(q(Ee,om),q(w,pm),q(w,hm)),Xe.svgFilters===!0&&(q(Ee,sm),q(w,pm),q(w,hm)),Xe.mathMl===!0&&(q(Ee,lm),q(w,mm),q(w,hm))),Me.tagCheck=null,Me.attributeCheck=null,Jp(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Me.tagCheck=e.ADD_TAGS:Lp(e.ADD_TAGS)&&(Ee===De&&(Ee=tm(Ee)),q(Ee,e.ADD_TAGS,_t))),Jp(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Me.attributeCheck=e.ADD_ATTR:Lp(e.ADD_ATTR)&&(w===Oe&&(w=tm(w)),q(w,e.ADD_ATTR,_t))),Jp(e,`ADD_FORBID_CONTENTS`)&&Lp(e.ADD_FORBID_CONTENTS)&&(Ze===Qe&&(Ze=tm(Ze)),q(Ze,e.ADD_FORBID_CONTENTS,_t)),Je&&(Ee[`#text`]=!0),E&&q(Ee,[`html`,`head`,`body`]),Ee.table&&(q(Ee,[`tbody`]),delete Ae.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Zp(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Zp(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=re;re=e.TRUSTED_TYPES_POLICY;try{ie=le(``)}catch(e){throw re=t,e}}else e.TRUSTED_TYPES_POLICY===null?(re=void 0,ie=``):(re===void 0&&(re=de()),re&&typeof ie==`string`&&(ie=le(``)));Ep&&Ep(e),vt=e},St=q({},[...om,...sm,...cm]),Ct=q({},[...lm,...um]),wt=function(e,t,n){return t.namespaceURI===at?e===`svg`:t.namespaceURI===rt?e===`svg`&&(n===`annotation-xml`||dt[n]):!!St[e]},Tt=function(e,t,n){return t.namespaceURI===at?e===`math`:t.namespaceURI===it?e===`math`&&pt[n]:!!Ct[e]},Et=function(e,t,n){return t.namespaceURI===it&&!pt[n]||t.namespaceURI===rt&&!dt[n]?!1:!Ct[e]&&(mt[e]||!St[e])},Dt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:ot,tagName:`template`});let n=Rp(e.tagName),r=Rp(t.tagName);return ct[e.namespaceURI]?e.namespaceURI===it?wt(n,t,r):e.namespaceURI===rt?Tt(n,t,r):e.namespaceURI===at?Et(n,t,r):!!(ht===`application/xhtml+xml`&&ct[e.namespaceURI]):!1},Ot=function(e){Fp(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Zp(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},kt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},At=function(e){Nt(e);let t=g(e);if(t){let e=[];Mp(t,t=>{Fp(e,t)}),Mp(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&kt(e,r,i)}},jt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Fp(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(He||Ue)try{Ot(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},Mt=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||w[_t(i)]||kt(e,r,i)}},Nt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();x(e)===Am.element&&Mt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Pt=function(e,t){return Le?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Ft=function(e){if(!Le)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=x(e);if(n===Am.processingInstruction||n===Am.comment&&Xp(Dm,e.data)){try{p(e)}catch{}continue}if(n===Am.element){let t=e,n=_t(ne(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Pt(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},It=function(e){let t=null,r=null;if(Ve)e=`<remove></remove>`+e;else{let t=Bp(e,/^[\r\n\t ]+/);r=t&&t[0]}ht===`application/xhtml+xml`&&ot===at&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=re?le(e):e;if(ot===at)try{t=new l().parseFromString(i,ht)}catch{}if(!t||!t.documentElement){t=S.createDocument(ot,`template`,null);try{t.documentElement.innerHTML=st?ie:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),ot===at?he.call(t,E?`html`:`body`)[0]:E?t.documentElement:a},Lt=function(e){let t=te?te(e):e.ownerDocument;return pe.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Rt=function(e){return e=Vp(e,ve,` `),e=Vp(e,ye,` `),e=Vp(e,be,` `),e},zt=function(e){e.normalize();let t=te?te(e):e.ownerDocument,n=pe.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Rt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&Mp(i,e=>{Vt(e.content)&&zt(e.content)})},Bt=function(e){let t=ee?ee(e):null;return typeof t!=`string`||_t(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Vt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Am.documentFragment}catch{return!1}},Ht=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Ut(e,n,r){e.length!==0&&Mp(e,e=>{e.call(t,n,r,vt)})}let Wt=function(e,t){return!!(Le&&e.hasChildNodes()&&!Ht(e.firstElementChild)&&Xp(Em,e.textContent)&&Xp(Em,e.innerHTML)||Le&&e.namespaceURI===at&&Mm[t]&&(Ht(e.firstElementChild)||typeof e.textContent==`string`&&Xp(Nm[t],e.textContent))||e.nodeType===Am.processingInstruction||Le&&e.nodeType===Am.comment&&Xp(Dm,e.data))},Gt=function(e,t){return e instanceof RegExp?Xp(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Kt=function(e,t,n){if(!Ae[t]&&Qt(t)&&Gt(ke.tagNameCheck,t))return!1;if(Je&&!Ze[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return Ot(e),!0},qt=function(e,t,n,r){return e.length===0?t:t===n||t===r?tm(t):t},Jt=function(e,t){return e===t||_(e)!==null?!1:(Ye&&Nt(e),!0)},Yt=function(e,n){if(Ut(_e.beforeSanitizeElements,e,null),Jt(e,n))return!0;if(Bt(e))return Ot(e),!0;let r=_t(ne(e));if(Ee=qt(_e.uponSanitizeElement,Ee,De,ze),Ut(_e.uponSanitizeElement,e,{tagName:r,allowedTags:Ee}),Jt(e,n))return!0;if(Wt(e,r))return Ot(e),!0;if(Ae[r]||!(Me.tagCheck instanceof Function&&Me.tagCheck(r))&&!Ee[r]){let t=Kt(e,r,n);return t===!1&&(Ut(_e.afterSanitizeElements,e,null),Jt(e,n))?!0:t}if(x(e)===Am.element&&!Dt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Xp(Om,e.innerHTML))return Ot(e),!0;if(Ie&&e.nodeType===Am.text){let n=Rt(e.textContent);e.textContent!==n&&(Fp(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Ut(_e.afterSanitizeElements,e,null),Jt(e,n)},Xt=function(e,t,r){if(je[t]||Pt(t,e)||Ge&&(t===`id`||t===`name`)&&(r in n||r in yt))return!1;let i=w[t]||Me.attributeCheck instanceof Function&&Me.attributeCheck(t,e);return Ne&&Xp(xe,t)||T&&Xp(Se,t)?!0:i?tt[t]||Xp(Te,Vp(r,C,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Hp(r,`data:`)===0&&$e[e]||Pe&&!Xp(Ce,Vp(r,C,``))?!0:!r:Qt(e)&&Gt(ke.tagNameCheck,e)&&Gt(ke.attributeNameCheck,t,e)||t===`is`&&ke.allowCustomizedBuiltInElements&&Gt(ke.tagNameCheck,r)},Zt=q({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Qt=function(e){return!Zt[Rp(e)]&&Xp(we,e)},$t=function(e,t,n,r){if(re&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return le(r);case`TrustedScriptURL`:return ue(r)}return r},D=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Bt(e)||(Ot(e),!1)}catch{return jt(t,e),!1}},en=function(e,n){if(Ut(_e.beforeSanitizeAttributes,e,null),Jt(e,n))return;let r=e.attributes;if(!r||Bt(e))return;w=qt(_e.uponSanitizeAttribute,w,Oe,Be);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:w,forceKeepAttr:void 0},a=r.length,o=_t(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=_t(s),d=l,f=s===`value`?d:Up(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Ut(_e.uponSanitizeAttribute,e,i),f=i.attrValue,Ke&&(u===`id`||u===`name`)&&Hp(f,qe)!==0&&(jt(s,e,n),f=qe+f,p=!0),Le&&Xp(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){jt(s,e,n);continue}if(u===`attributename`&&Bp(f,`href`)){jt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){jt(s,e,n);continue}if(!Fe&&Xp(km,f)){jt(s,e,n);continue}if(Ie&&(f=Rt(f)),!Xt(o,u,f)){jt(s,e,n);continue}f=$t(o,u,c,f),f!==d&&D(e,s,c,f)&&p&&Pp(t.removed)}}Ut(_e.afterSanitizeAttributes,e,null),Jt(e,n)},tn=function(e){let t=null,n=Lt(e);for(Ut(_e.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Ut(_e.uponSanitizeShadowNode,t,null),Yt(t,e),en(t,e),Vt(t.content)&&tn(t.content),x(t)===Am.element){let e=v(t);Vt(e)&&(nn(e),tn(e))}Ut(_e.afterSanitizeShadowDOM,e,null)},nn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){tn(e.shadow);continue}let n=e.node,r=x(n)===Am.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=ee?ee(n):null;if(typeof e==`string`&&_t(e)===`template`){let e=n.content;Vt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Vt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(st=!e,st&&(e=`<!-->`),typeof e!=`string`&&!Ht(e)&&(e=nm(e),typeof e!=`string`))throw Zp(`dirty is not a string, aborting`);if(!t.isSupported)return e;Re?(Ee=ze,w=Be):xt(n),(_e.uponSanitizeElement.length>0||_e.uponSanitizeAttribute.length>0)&&(Ee=tm(Ee)),_e.uponSanitizeAttribute.length>0&&(w=tm(w)),t.removed=[];let c=Ye&&typeof e!=`string`&&Ht(e);if(c){Ft(e);let t=ne(e);if(typeof t==`string`){let n=_t(t);if(!Ee[n]||Ae[n])throw At(e),Zp(`root node is forbidden and cannot be sanitized in-place`)}if(Bt(e))throw At(e),Zp(`root node is clobbered and cannot be sanitized in-place`);try{nn(e)}catch(t){throw At(e),t}}else if(Ht(e))i=It(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Am.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),nn(i);else{if(!He&&!Ie&&!E&&e.indexOf(`<`)===-1)return re&&We?le(e):e;if(i=It(e),!i)return He?null:We?ie:``}i&&Ve&&Ot(i.firstChild);let l=c?e:i;try{let e=Lt(l);for(;o=e.nextNode();)Yt(o,l),en(o,l),Vt(o.content)&&tn(o.content)}catch(n){throw c&&(At(e),Mp(t.removed,e=>{e.element&&Nt(e.element)})),n}if(c){let n=!1;if(Mp(t.removed,t=>{t.element&&(t.element===e&&(n=!0),Nt(t.element))}),n)throw Zp(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Ie&&zt(e),e}if(He){if(Ie&&zt(i),Ue)for(s=me.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(w.shadowroot||w.shadowrootmode)&&(s=ge.call(r,s,!0)),s}let u=E?i.outerHTML:i.innerHTML;return E&&Ee[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Xp(wm,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
75
- `+u),Ie&&(u=Rt(u)),re&&We?le(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xt(e),Re=!0,ze=Ee,Be=w},t.clearConfig=function(){vt=null,Re=!1,ze=null,Be=null,re=ae,ie=``},t.isValidAttribute=function(e,t,n){vt||xt({});let r=_t(e),i=_t(t);return Xt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Jp(_e,e)&&Fp(_e[e],t)},t.removeHook=function(e,t){if(Jp(_e,e)){if(t!==void 0){let n=Np(_e[e],t);return n===-1?void 0:Ip(_e[e],n,1)[0]}return Pp(_e[e])}},t.removeHooks=function(e){Jp(_e,e)&&(_e[e]=[])},t.removeAllHooks=function(){_e=Im()},t}var Bm=zm();function Vm(e,t){let n;try{n=new URL(e.trim())}catch{return null}return n.protocol!==`https:`&&n.protocol!==`http:`||n.origin===t?null:n.href}var Hm=`p.br.hr.strong.b.em.i.del.s.code.pre.blockquote.ul.ol.li.a.h1.h2.h3.h4.h5.h6.small.sub.sup.table.thead.tbody.tr.th.td.img.input`.split(`.`),Um=[`form`,`style`,`script`,`button`,`select`,`textarea`,`iframe`,`object`,`embed`,`svg`,`math`],Wm={a:[`href`,`title`],img:[`src`,`alt`,`title`],th:[`colspan`,`rowspan`,`align`],td:[`colspan`,`rowspan`,`align`],ol:[`start`],code:[`class`],input:[`type`,`checked`,`disabled`]},Gm=[...new Set(Object.values(Wm).flat())],Km=/^language-[\w-]+$/,qm=/^\d{1,4}$/,Jm=/^(left|right|center)$/i;function Ym(e,t,n){if(!Object.hasOwn(Wm,e)||!Wm[e].includes(t))return!1;switch(t){case`class`:return Km.test(n);case`type`:return n.toLowerCase()===`checkbox`;case`colspan`:case`rowspan`:case`start`:return qm.test(n);case`align`:return Jm.test(n);default:return!0}}var Xm=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/i,Zm=/^\/api(\/|$)/i;function Qm(e,t){if(Xm.test(e))return!0;if(!e.trim())return!1;let n;try{n=new URL(e,t)}catch{return!1}return(n.protocol===`https:`||n.protocol===`http:`)&&n.origin===t&&!Zm.test(n.pathname)}Bm.isSupported&&Bm.addHook(`afterSanitizeAttributes`,e=>{let t=e.nodeName.toLowerCase();for(let{name:n,value:r}of Array.from(e.attributes))Ym(t,n,r)||e.removeAttribute(n);if(t===`img`&&!Qm(e.getAttribute(`src`)??``,location.origin)){e.replaceWith(document.createTextNode(e.getAttribute(`alt`)??``));return}if(t===`input`){e.getAttribute(`type`)===null?e.remove():e.setAttribute(`disabled`,``);return}if(t!==`a`)return;let n=e.getAttribute(`href`),r=n===null?null:Vm(n,location.origin);r?(e.setAttribute(`href`,r),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):(e.removeAttribute(`href`),e.removeAttribute(`target`))});var $m={ALLOWED_TAGS:Hm,ALLOWED_ATTR:Gm,FORBID_TAGS:Um,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1},eh=new Map;function th(e){let t=eh.get(e);return t===void 0&&(t=Bm.sanitize(K.parse(e,{async:!1}),$m),eh.size>400&&eh.delete(eh.keys().next().value),eh.set(e,t)),t}var nh=`demo.job-runs`,rh=e=>e.status!==`running`&&e.status!==`waiting`,ih=B(()=>iu.value?.info?.jobs??[]),ah=e=>ih.value.find(t=>t.id===e),oh=B(()=>{let e=xu.value.docs[nh];return Object.values(e?.items??{}).sort((e,t)=>t.id-e.id)}),sh=e=>oh.value.find(t=>t.id===e),ch=e=>oh.value.find(t=>t.toolCallId===e),lh=O(Date.now());setInterval(()=>lh.value=Date.now(),1e3);var uh=e=>e<1e3?`${Math.max(0,Math.round(e))}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`,dh=O();async function fh(e,t){if(!dh.value){dh.value=e;try{return await Mu(t)}finally{dh.value=void 0}}}function ph(e){Vu.value&&Wu(),setTimeout(()=>document.querySelector(`[data-job-run="${e}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}))}async function mh(e){let t=await fh(`start:${e.id}`,()=>du.value.demo(`jobs`,{job:e.id}));t&&(W(`${e.title} started. It runs in the chat.`),ph(t.taskId))}var hh=(e,t)=>fh(`decide:${e.id}`,()=>du.value.demo(`jobs/${e.id}/approval`,{approved:t})),gh=e=>fh(`stop:${e.id}`,()=>fu.value.abortTask(e.id));function _h(e){H.value&&pu({...H.value,agentId:e})}var vh=[`data-job-run`,`aria-label`],yh={class:`job-run-head`},bh={class:`job-run-icon`},xh={class:`job-run-titles`},Sh={class:`job-run-eyebrow`},Ch={class:`job-run-repeat`},wh={key:0,class:`job-run-about`},Th={class:`job-run-meta`},Eh={key:0,class:`job-run-resumed`},Dh={class:`job-stepper`,"aria-label":`Phases`},Oh=[`aria-current`],kh={class:`job-chip`},Ah={class:`job-step-dot`},jh={class:`job-step-label`},Mh={key:0,class:`job-step-progress`},Nh={class:`job-phases`},Ph=[`open`],Fh={class:`job-phase-n`},Ih={class:`job-phase-summary`},Lh={class:`job-phase-time`},Rh={key:0,class:`job-phase-about`},zh={key:1,class:`job-steps`},Bh=[`open`],Vh={key:1,class:`job-step-line`},Hh=[`onClick`],Uh={key:2,class:`job-phase-empty`},Wh={key:1,class:`job-approval`,role:`group`,"aria-label":`Approval`},Gh={class:`job-approval-buttons`},Kh=[`disabled`],qh=[`disabled`],Jh={key:2,class:`message-error`},Yh={class:`job-run-foot`},Xh=[`disabled`],Zh=A({__name:`JobCard`,props:{run:{}},setup(e){let t=e,n=B(()=>ah(t.run.job)),r=B(()=>rh(t.run)),i=B(()=>uh((t.run.endedAt??lh.value)-t.run.startedAt)),a={running:`Running`,waiting:`Waiting for you`,completed:`Completed`,failed:`Failed`,aborted:`Stopped`,declined:`Declined`},o={command:Vc,tool:qc,agent:qs,state:Js,approval:zc,checkpoint:sc,note:yc},s=e=>e.kind===`tool`?`${e.label}: a subagent tool call, its own durable task`:e.label,c=e=>{let t=e.step,n=[`command`,`tool`,`state`].includes(t.kind)?co(`code`,{title:s(t)},t.label):co(`span`,{class:`job-step-text`},t.label),r=t.status===`running`?co(bc,{size:15,class:`spin`}):t.status===`done`?co(Xs,{size:15}):t.status===`waiting`?co(fc,{size:15}):co(Jc,{size:15});return[co(o[t.kind],{size:16,class:`job-step-kind`}),n,t.kind===`tool`&&t.detail?co(`span`,{class:`job-step-args`,title:t.detail},t.detail):null,co(`span`,{class:`job-step-state`},[r,t.ms!==void 0&&t.kind!==`note`?co(`span`,uh(t.ms)):null])]};c.props=[`step`];let l=e=>n.value?.phases.find(t=>t.id===e),u=e=>e.startedAt?uh((e.endedAt??(e.status===`running`||e.status===`waiting`?lh.value:e.startedAt))-e.startedAt):``,d=e=>e.status!==`pending`&&e.status!==`skipped`,f=B(()=>Object.entries(t.run.input)),p=B(()=>t.run.phases.find(e=>e.status===`waiting`));return(t,o)=>(N(),P(`article`,{class:C([`job-run`,`is-${e.run.status}`]),"data-job-run":e.run.id,"aria-label":`${e.run.title} run ${e.run.run}: ${a[e.run.status]}`},[I(`header`,yh,[I(`span`,bh,[L(k(Kc),{size:22})]),I(`div`,xh,[I(`div`,Sh,[o[3]||=I(`span`,null,`DURABLE JOB`,-1),I(`span`,Ch,[L(k(Ic),{size:15}),R(`Repeatable workflow, run #`+T(e.run.run),1)])]),I(`h3`,null,T(e.run.title),1)]),I(`span`,{class:C([`job-run-status`,e.run.status])},[o[4]||=I(`i`,null,null,-1),R(T(a[e.run.status]),1)],2)]),n.value?(N(),P(`p`,wh,T(n.value.summary),1)):z(``,!0),I(`div`,Th,[I(`span`,null,`task #`+T(e.run.id),1),I(`span`,null,T(e.run.startedBy===`agent`?`started by the agent`:`started by you`),1),I(`span`,null,T(i.value),1),(N(!0),P(M,null,j(f.value,([e,t])=>(N(),P(`span`,{key:e,class:`job-run-input`},T(e)+`=`+T(t),1))),128)),e.run.resumed?(N(),P(`span`,Eh,`resumed `+T(e.run.resumed)+`× after restart`,1)):z(``,!0)]),I(`ol`,Dh,[(N(!0),P(M,null,j(e.run.phases,(t,n)=>(N(),P(`li`,{key:t.id,class:C(`ph-${t.status}`),"aria-current":e.run.phase===t.id&&!r.value?`step`:void 0},[I(`span`,kh,[I(`span`,Ah,[t.status===`done`?(N(),F(k(Xs),{key:0,size:15})):t.status===`running`?(N(),F(k(bc),{key:1,size:15,class:`spin`})):t.status===`waiting`?(N(),F(k(fc),{key:2,size:15})):[`failed`,`aborted`].includes(t.status)?(N(),F(k(Jc),{key:3,size:15})):(N(),P(M,{key:4},[R(T(n+1),1)],64))]),I(`span`,jh,T(t.label),1),t.progress?(N(),P(`span`,Mh,T(t.progress.done)+`/`+T(t.progress.total),1)):z(``,!0)])],10,Oh))),128))]),I(`div`,Nh,[(N(!0),P(M,null,j(e.run.phases,(e,t)=>(N(),P(`details`,{key:e.id,class:C([`job-phase`,`ph-${e.status}`]),open:d(e)},[I(`summary`,null,[I(`span`,Fh,T(t+1),1),I(`strong`,null,T(e.label),1),I(`span`,Ih,T(e.summary??(e.status===`pending`?l(e.id)?.summary:e.status===`skipped`?`Skipped`:``)),1),I(`span`,Lh,T(u(e)),1)]),e.status===`done`?z(``,!0):(N(),P(`p`,Rh,T(l(e.id)?.summary),1)),e.steps.length?(N(),P(`ul`,zh,[(N(!0),P(M,null,j(e.steps,e=>(N(),P(`li`,{key:e.id,class:C([`k-${e.kind}`,`st-${e.status}`])},[e.detail&&e.kind!==`tool`?(N(),P(`details`,{key:0,open:e.status===`error`},[I(`summary`,null,[L(c,{step:e},null,8,[`step`])]),I(`pre`,null,T(e.detail),1)],8,Bh)):(N(),P(`div`,Vh,[L(c,{step:e},null,8,[`step`])])),e.kind===`agent`&&e.conversationId?(N(),P(`button`,{key:2,class:`text-button job-step-link`,onClick:t=>k(_h)(e.conversationId)},` Open subagent #`+T(e.conversationId),9,Hh)):z(``,!0)],2))),128))])):e.status===`pending`?(N(),P(`p`,Uh,`Not started yet.`)):z(``,!0)],10,Ph))),128))]),e.run.approval===`pending`?(N(),P(`div`,Wh,[I(`div`,null,[L(k(zc),{size:20}),o[5]||=I(`strong`,null,`Approve to continue`,-1)]),I(`p`,null,T(p.value?l(p.value.id)?.summary:`This run waits for you`)+`. It is paused on a saved checkpoint: close the browser or restart the device and the decision will still be waiting. `,1),I(`div`,Gh,[I(`button`,{class:`primary small`,disabled:!!k(dh),onClick:o[0]||=t=>k(hh)(e.run,!0)},[L(k(Xs),{size:18}),o[6]||=R(`Approve & continue `,-1)],8,Kh),I(`button`,{class:`secondary`,disabled:!!k(dh),onClick:o[1]||=t=>k(hh)(e.run,!1)},`Decline`,8,qh)])])):z(``,!0),e.run.error&&e.run.status!==`aborted`?(N(),P(`p`,Jh,T(e.run.error),1)):z(``,!0),I(`footer`,Yh,[I(`span`,null,T(e.run.background?`Runs in the background: the conversation owns it, so Interrupt leaves it running.`:`Owned by this tool call: Interrupt stops it.`)+` Each phase saves a checkpoint, so a restart resumes the current phase.`,1),r.value?z(``,!0):(N(),P(`button`,{key:0,class:`secondary danger`,disabled:!!k(dh),onClick:o[2]||=t=>k(gh)(e.run)},[L(k(Ec),{size:16}),o[7]||=R(`Stop `,-1)],8,Xh))])],10,vh))}}),Qh={class:`message-label`},$h={class:`user-message`},eg={class:`message-label`},tg={key:0,class:`streaming`},ng={key:1},rg=[`aria-label`],ig=[`innerHTML`],ag={key:1,class:`thinking`},og=[`data-call-id`],sg={class:`tool-status`},cg={class:`tool-section-label`},lg=[`aria-label`,`onClick`],ug={key:0,class:`typing`},dg={key:1,class:`message-error`},fg=[`aria-label`],pg={key:3,class:`live-tool`},mg={key:0},hg={class:`event-line`},gg=[`aria-label`],_g={key:0,class:`raw`},vg=A({__name:`TranscriptItem`,props:{item:{}},emits:[`fork`],setup(e,{emit:t}){let n=t,r=e=>e.status===`error`?`Error`:e.status===`done`?`Done`:e.status,i=e=>e.kind===`user`?`pi-user`:e.kind===`assistant`?e.streaming?`live-generation`:`pi-assistant`:e.kind===`tool-result`?`pi-tool-result`:e.kind===`tool`?`live-tool-entry`:e.entryKind.replaceAll(`.`,`-`);return(t,a)=>(N(),P(`article`,{class:C([`entry`,i(e.item)])},[e.item.kind===`user`?(N(),P(M,{key:0},[I(`div`,Qh,[a[3]||=R(` YOU `,-1),I(`span`,null,`#`+T(e.item.id),1)]),I(`div`,$h,T(e.item.text),1)],64)):e.item.kind===`assistant`?(N(),P(M,{key:1},[I(`div`,eg,[a[5]||=R(` AGENT `,-1),e.item.streaming?(N(),P(`span`,tg,`Working`)):(N(),P(`span`,ng,`#`+T(e.item.id),1)),e.item.streaming?z(``,!0):(N(),P(`button`,{key:2,class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,title:`Fork from this entry. App State stays shared.`,onClick:a[0]||=t=>n(`fork`,e.item.id)},[L(k(dc),{size:18}),a[4]||=R(`Fork `,-1)],8,rg))]),(N(!0),P(M,null,j(e.item.blocks,(e,t)=>(N(),P(M,{key:t},[e.type===`text`?(N(),P(`div`,{key:0,class:`markdown`,innerHTML:k(th)(e.text)},null,8,ig)):e.type===`thinking`?(N(),P(`details`,ag,[a[6]||=I(`summary`,null,`Thinking`,-1),I(`div`,null,T(e.text),1)])):(N(),P(`details`,{key:2,class:C([`tool-call`,{failed:e.call.status===`error`}]),"data-call-id":e.call.callId},[I(`summary`,null,[e.call.status===`error`?(N(),F(k(mc),{key:0,size:18})):e.call.status===`done`?(N(),F(k(Xs),{key:1,size:18})):e.call.status===`running`?(N(),F(k(Us),{key:2,size:18})):(N(),F(k(qc),{key:3,size:18})),I(`strong`,null,T(e.call.name),1),I(`code`,null,T(k(Fu)(e.call.args)?.slice(0,90)),1),I(`span`,sg,T(r(e.call)),1)]),a[10]||=I(`div`,{class:`tool-section-label`},`Input`,-1),I(`pre`,null,T(k(Fu)(e.call.args)),1),e.call.result===void 0?e.call.output?(N(),P(M,{key:1},[a[9]||=I(`div`,{class:`tool-section-label`},`Live output`,-1),I(`pre`,null,T(e.call.output),1)],64)):z(``,!0):(N(),P(M,{key:0},[I(`div`,cg,[a[8]||=I(`span`,null,`Result`,-1),e.call.resultEntryId===void 0?z(``,!0):(N(),P(`button`,{key:0,class:`fork-button`,"aria-label":`Fork at entry ${e.call.resultEntryId}`,title:`Fork after this result`,onClick:t=>n(`fork`,e.call.resultEntryId)},[L(k(dc),{size:18}),a[7]||=R(`Fork `,-1)],8,lg))]),I(`pre`,null,T(e.call.result),1)],64))],10,og)),e.type===`tool`&&e.call.name===`run_durable_job`&&k(ch)(e.call.callId)?(N(),F(Zh,{key:3,run:k(ch)(e.call.callId)},null,8,[`run`])):z(``,!0)],64))),128)),e.item.streaming&&!e.item.blocks.length?(N(),P(`div`,ug,[...a[11]||=[I(`i`,null,null,-1),I(`i`,null,null,-1),I(`i`,null,null,-1)]])):z(``,!0),e.item.error?(N(),P(`div`,dg,T(e.item.error),1)):z(``,!0)],64)):e.item.kind===`tool-result`?(N(),P(`details`,{key:2,class:C([`tool-result`,{failed:e.item.isError}])},[I(`summary`,null,[e.item.isError?(N(),F(k(mc),{key:1,size:18})):(N(),F(k(Xs),{key:0,size:18})),I(`strong`,null,T(e.item.name),1),I(`span`,null,T(e.item.isError?`error`:`result`),1),I(`button`,{class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,onClick:a[1]||=js(t=>n(`fork`,e.item.id),[`prevent`])},[L(k(dc),{size:18}),a[12]||=R(`Fork `,-1)],8,fg)]),I(`pre`,null,T(e.item.text),1)],2)):e.item.kind===`tool`?(N(),P(`div`,pg,[I(`div`,null,[L(k(Us),{size:18}),I(`strong`,null,T(e.item.call.name),1),I(`span`,null,T(e.item.call.status),1)]),e.item.call.output?(N(),P(`pre`,mg,T(e.item.call.output),1)):z(``,!0),e.item.call.name===`run_durable_job`&&k(ch)(e.item.call.callId)?(N(),F(Zh,{key:1,run:k(ch)(e.item.call.callId)},null,8,[`run`])):z(``,!0)])):e.item.entryKind===`demo.job`&&k(sh)(e.item.data.taskId)?(N(),F(Zh,{key:4,run:k(sh)(e.item.data.taskId)},null,8,[`run`])):(N(),P(M,{key:5},[I(`div`,hg,[e.item.entryKind===`demo.state-change`?(N(),F(k(Js),{key:0,size:18})):(N(),F(k(_c),{key:1,size:18})),I(`span`,null,T(e.item.text),1),I(`button`,{class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,onClick:a[2]||=t=>n(`fork`,e.item.id)},[L(k(dc),{size:18}),a[13]||=R(`Fork `,-1)],8,gg)]),e.item.note?(N(),P(`details`,_g,[a[14]||=I(`summary`,null,`Context note`,-1),I(`pre`,null,T(e.item.note),1)])):z(``,!0)],64))],2))}}),yg={key:0,class:`git-chip-wrap`},bg=[`title`],xg={class:`branch`},Sg={key:0,class:`dirty`},Cg={key:1,class:`ahead`},wg={key:2,class:`behind`},Tg=[`disabled`],Eg={class:`line`},Dg={title:`staged/unstaged/untracked`},Og={class:`line muted`},kg={key:0,class:`line wt-of`},Ag={class:`row`},jg=[`disabled`],Mg=[`disabled`],Ng=[`disabled`],Pg=[`disabled`],Fg={class:`row commit`},Ig=[`disabled`],Lg={class:`row wt`},Rg=[`disabled`],zg={key:1,class:`wts`},Bg={class:`muted`},Vg=[`disabled`,`onClick`],Hg={key:2,class:`log`},Ug=A({__name:`GitChip`,props:{deviceId:{},cwd:{}},async setup(e){let t,n,r=e,i=O(null),a=O(!1),o=O(``),s=O(``),c=O(``),l=O(``),u=B(()=>r.cwd??lu.value?.cwd??``),d=B(()=>r.deviceId??ru.value),f=B(()=>(i.value?.staged??0)+(i.value?.unstaged??0)+(i.value?.untracked??0)),p;async function m(){if(u.value&&d.value)try{i.value=await Il(d.value).gitStatus(u.value)}catch{i.value=null}}[t,n]=di(()=>m()),await t,n(),Zn(u,()=>void m()),Wr(()=>{p=setInterval(m,15e3)}),qr(()=>p&&clearInterval(p));async function h(e,t=!0){if(d.value&&u.value){o.value=e,s.value=``;try{let t=await Il(d.value).gitOp(u.value,e);e===`log`||e===`branch`?s.value=t.text:W(`git ${e}: ${t.text.split(`
76
- `)[0]??`ok`}`),await m()}catch(t){W(`git ${e} failed: ${t.message.slice(0,120)}`)}finally{o.value=``}}}async function g(){if(d.value&&u.value&&c.value.trim()){o.value=`commit`;try{W((await Il(d.value).gitOp(u.value,`commit`,{message:c.value.trim()})).text),c.value=``,await m()}catch(e){W(`commit failed: ${e.message.slice(0,120)}`)}finally{o.value=``}}}async function _(){if(!d.value||!u.value||!l.value.trim()||!i.value?.root)return;o.value=`wt`;let e=i.value.root,t=`${e.slice(0,e.lastIndexOf(`/`))}/${e.slice(e.lastIndexOf(`/`)+1)}-${l.value.trim()}`;try{W(`worktree: ${(await Il(d.value).gitOp(u.value,`worktree-add`,{branch:l.value.trim(),target:t})).text.split(`
77
- `)[0]??t}`),l.value=``,await m()}catch(e){W(`worktree failed: ${e.message.slice(0,120)}`)}finally{o.value=``}}async function v(e){if(d.value&&u.value&&confirm(`Remove worktree ${e}?`)){o.value=`wt`;try{await Il(d.value).gitOp(u.value,`worktree-remove`,{target:e}),await m()}catch(e){W(`remove failed: ${e.message.slice(0,120)}`)}finally{o.value=``}}}return(e,t)=>i.value?.repo?(N(),P(`span`,yg,[I(`button`,{class:`crumb git-chip`,title:`${i.value.root} · ${i.value.head??``} ${i.value.subject??``}`,onClick:t[0]||=e=>a.value=!a.value},[L(k(uc),{size:16,"aria-hidden":`true`}),I(`span`,xg,T(i.value.branch??i.value.head),1),f.value?(N(),P(`span`,Sg,`±`+T(f.value),1)):z(``,!0),i.value.ahead?(N(),P(`span`,Cg,`↑`+T(i.value.ahead),1)):z(``,!0),i.value.behind?(N(),P(`span`,wg,`↓`+T(i.value.behind),1)):z(``,!0),L(k(Zs),{size:14,"aria-hidden":`true`})],8,bg),a.value?(N(),P(`div`,{key:0,class:`git-panel`,onClick:t[8]||=js(()=>{},[`stop`])},[I(`header`,null,[I(`strong`,null,`git · `+T(i.value.root),1),I(`button`,{disabled:!!o.value,title:`refresh`,onClick:t[1]||=e=>m()},[L(k(Fc),{size:14})],8,Tg)]),I(`p`,Eg,[R(T(i.value.branch??`detached`),1),i.value.upstream?(N(),P(M,{key:0},[R(` → `+T(i.value.upstream),1)],64)):z(``,!0),t[9]||=R(` · `,-1),I(`span`,Dg,`+`+T(i.value.staged??0)+` ~`+T(i.value.unstaged??0)+` ?`+T(i.value.untracked??0),1)]),I(`p`,Og,T(i.value.head)+` `+T(i.value.subject),1),i.value.worktreeOf?(N(),P(`p`,kg,`worktree of `+T(i.value.worktreeOf),1)):z(``,!0),I(`div`,Ag,[I(`button`,{disabled:!!o.value,onClick:t[2]||=e=>h(`fetch`)},`fetch`,8,jg),I(`button`,{disabled:!!o.value,onClick:t[3]||=e=>h(`pull`)},`pull`,8,Mg),I(`button`,{disabled:!!o.value,onClick:t[4]||=e=>h(`log`)},`log`,8,Ng),I(`button`,{disabled:!!o.value,onClick:t[5]||=e=>h(`branch`)},`branches`,8,Pg)]),I(`div`,Fg,[Wn(I(`input`,{"onUpdate:modelValue":t[6]||=e=>c.value=e,placeholder:`commit message…`,onKeyup:Ns(g,[`enter`])},null,544),[[xs,c.value]]),I(`button`,{disabled:!!o.value||!c.value.trim(),onClick:g},`commit -am`,8,Ig)]),I(`div`,Lg,[Wn(I(`input`,{"onUpdate:modelValue":t[7]||=e=>l.value=e,placeholder:`branch name…`,onKeyup:Ns(_,[`enter`])},null,544),[[xs,l.value]]),I(`button`,{disabled:!!o.value||!l.value.trim(),onClick:_},`+ worktree`,8,Rg)]),(i.value.worktrees?.length??0)>1?(N(),P(`ul`,zg,[(N(!0),P(M,null,j(i.value.worktrees,e=>(N(),P(`li`,{key:e.path},[I(`code`,null,T(e.path),1),I(`span`,Bg,T(e.branch??e.head),1),e.path===i.value.root?z(``,!0):(N(),P(`button`,{key:0,disabled:!!o.value,onClick:t=>v(e.path)},`remove`,8,Vg))]))),128))])):z(``,!0),s.value?(N(),P(`pre`,Hg,T(s.value.slice(0,4e3)),1)):z(``,!0)])):z(``,!0)])):z(``,!0)}}),Wg=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Gg=Wg(Ug,[[`__scopeId`,`data-v-db961b7f`]]),Kg=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,qg=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],Jg={enabled:!0,reserveTokens:16384,backgroundTokens:32768,keepRecentTokens:2e3},Yg={auto:2e5,wait:25e4};function Xg(e){if(!(e>0))return{...Jg};let t=Math.min(Yg.wait,e-Jg.reserveTokens),n=Math.min(Yg.auto,t-Jg.backgroundTokens);return{...Jg,reserveTokens:e-t,backgroundTokens:t-n}}function Zg(e,t){let n=Math.max(0,e-t.reserveTokens);return{wait:n,auto:t.backgroundTokens>0?Math.max(0,n-t.backgroundTokens):void 0}}var Qg=(e,t)=>{if(e===void 0)throw Error(`No ${t} selected`);return e},$g=[{name:`compact`,args:`[instructions]`,description:`Summarize older context; stored entries stay`,run:async e=>{await Qg(du.value,`agent`).compact(e||void 0),W(`Compaction requested. /tasks shows its outcome.`)}},{name:`reset`,args:`[handoff note]`,description:`Start a fresh context; history stays stored`,run:async e=>{await Qg(du.value,`agent`).reset(e||void 0),W(`New context started.`)}},{name:`tasks`,description:`Open the Tasks panel`,run:()=>Uu(`tasks`)},{name:`new`,args:`[name]`,description:`New agent in this workspace`,run:async e=>{let t=Qg(H.value,`workspace`),n=await Qg(fu.value,`workspace`).createAgent(e?{name:e}:{});pu({...t,agentId:n.id}),W(`New agent ${n.name}.`)}},{name:`fork`,args:`[entryId] [name]`,description:`Fork at an entry (default: the last reply)`,run:async e=>{let[t,...n]=e.split(/\s+/).filter(Boolean),r=t&&/^\d+$/.test(t)?Number(t):void 0,i=(r===void 0?[t,...n]:n).filter(Boolean).join(` `),a=r??xu.value.entries.filter(e=>e.kind===`pi.assistant`).at(-1)?.id;if(a===void 0)throw Error(`Nothing to fork yet`);let o=Qg(H.value,`agent`),s=await Qg(du.value,`agent`).fork({entryId:a,name:i||void 0});pu({...o,agentId:s.id}),W(`Forked at entry #${a}. App State stays shared.`)}},{name:`name`,args:`<name>`,description:`Rename this agent`,run:async e=>{if(!e)throw Error(`Usage: /name <name>`);await Qg(du.value,`agent`).rename(e),W(`Agent renamed to ${e}.`)}},{name:`model`,description:`Choose this agent's model`,run:()=>U.dialog={kind:`models`}},{name:`thinking`,args:`<level>`,description:`Thinking level: ${qg.join(`, `)}`,run:async e=>{if(!qg.includes(e))throw Error(`Levels: ${qg.join(`, `)}`);await Qg(du.value,`agent`).configure({thinkingLevel:e}),await Au(),W(`Thinking ${e}. Used on the next turn.`)}},{name:`help`,description:`How this works, keys and commands`,run:()=>U.dialog={kind:`help`}}];function e_(e){let t=e.trim().match(/^\/(\S+)\s*([\s\S]*)$/),n=t&&$g.find(e=>e.name===t[1]);return n?{command:n,arg:t[2].trim()}:void 0}var t_={class:`composer-region`},n_={key:0,class:`queue`},r_=[`aria-label`,`onClick`],i_={class:`composer`},a_={key:0,class:`slash-menu`,role:`listbox`,"aria-label":`Slash commands`},o_=[`aria-selected`,`onMousedown`],s_={key:0,class:`slash-args`},c_={class:`slash-desc`},l_={class:`composer-toolbar`},u_={class:`composer-left`},d_={class:`queue-mode`},f_={class:`composer-right`},p_=[`disabled`],m_=[`disabled`],h_=A({__name:`Composer`,setup(e){let t=O(`followUp`),n=O(!1),r=B(()=>au.value&&xu.value.ready&&su.status.value===`live`&&Xl.value===`live`),i=O(0),a=O(!1),o=B(()=>{let e=U.composer.match(/^\/(\S*)$/);return e&&!a.value?$g.filter(t=>t.name.startsWith(e[1].toLowerCase())):[]});Zn(()=>U.composer,()=>{i.value=0,U.composer.startsWith(`/`)||(a.value=!1)});async function s(e,t=!1){!e.args||t&&e.args.startsWith(`[`)&&U.composer===`/${e.name}`?(U.composer=`/${e.name}`,await u()):U.composer=`/${e.name} `}function c(e){if(!o.value.length){e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),u());return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){let t=o.value.length;i.value=(i.value+(e.key===`ArrowDown`?1:t-1))%t}else if(e.key===`Tab`||e.key===`Enter`&&!e.shiftKey)s(o.value[i.value],e.key===`Enter`);else if(e.key===`Escape`)a.value=!0;else return;e.preventDefault(),e.stopPropagation()}async function l(e){let t=e_(e);return t?(n.value=!0,await Mu(async()=>{await t.command.run(t.arg),U.composer=``}),n.value=!1,!0):!1}async function u(){let e=U.composer.trim(),i=du.value;if(!e||n.value||!i||!r.value||e.startsWith(`/`)&&await l(e))return;n.value=!0;let a=H.value,o=`${a.deviceId}/${a.sessionId}/${a.agentId}`,s;try{s=JSON.parse(sessionStorage.getItem(`dpi.pending-send`)??`null`)}catch{}let c=s?.key===o&&s.content===e&&s.mode===t.value?s.requestId:Kg();sessionStorage.setItem(`dpi.pending-send`,JSON.stringify({key:o,content:e,mode:t.value,requestId:c})),await Mu(async()=>{await i.send(e,t.value,c),sessionStorage.removeItem(`dpi.pending-send`),U.composer=``}),n.value=!1}function d(e){Mu(()=>du.value.withdraw(e))}return(e,a)=>(N(),P(`div`,t_,[k(xu).inbox.length?(N(),P(`div`,n_,[(N(!0),P(M,null,j(k(xu).inbox,e=>(N(),P(`div`,{key:e.id},[L(k(tc),{size:18}),I(`span`,null,T(e.mode===`steer`?`Steer`:`Queued`)+`: `+T(e.content??`Context update`),1),I(`button`,{class:`icon-button`,"aria-label":`Withdraw submission ${e.id}`,title:`Withdraw queued input`,onClick:t=>d(e.id)},[L(k(Jc),{size:18})],8,r_)]))),128))])):z(``,!0),I(`div`,i_,[o.value.length?(N(),P(`ul`,a_,[(N(!0),P(M,null,j(o.value,(e,t)=>(N(),P(`li`,{key:e.name,role:`option`,"aria-selected":t===i.value,class:C({active:t===i.value}),onMousedown:js(t=>s(e),[`prevent`])},[I(`code`,null,`/`+T(e.name),1),e.args?(N(),P(`span`,s_,T(e.args),1)):z(``,!0),I(`span`,c_,T(e.description),1)],42,o_))),128))])):z(``,!0),Wn(I(`textarea`,{"onUpdate:modelValue":a[0]||=e=>k(U).composer=e,rows:`2`,placeholder:`Give your agent something to do, or type / for commands…`,"aria-label":`Message your agent`,onKeydown:c},null,544),[[xs,k(U).composer]]),I(`div`,l_,[I(`div`,u_,[I(`div`,d_,[Wn(I(`select`,{"onUpdate:modelValue":a[1]||=e=>t.value=e,"aria-label":`When busy`,title:`Follow-up waits for this run. Steer joins after a tool round.`},[...a[3]||=[I(`option`,{value:`followUp`},`Follow-up`,-1),I(`option`,{value:`steer`},`Steer`,-1),I(`option`,{value:`reject`},`Reject if busy`,-1)]],512),[[ws,t.value]]),L(k(Zs),{size:24,"aria-hidden":`true`})])]),I(`div`,f_,[I(`button`,{class:`interrupt`,disabled:!k(Tu)||k(Ru),title:`Stop foreground work and owned subagents (Escape). Background jobs continue.`,onClick:a[2]||=(...e)=>k(zu)&&k(zu)(...e)},[L(k(Ec),{size:24,class:`stop-sign`,fill:`currentColor`}),a[4]||=R(`Interrupt`,-1)],8,p_),I(`button`,{class:`send`,"aria-label":`Send message`,disabled:!k(U).composer.trim()||n.value||!r.value,onClick:u},[L(k(Ks),{size:20})],8,m_)])])]),a[5]||=I(`div`,{class:`composer-footnote`},[I(`span`,null,[I(`i`,{class:`live-dot`}),R(`Closing this window never interrupts your agent.`)])],-1)]))}}),g_={class:`chat-panel`},__={class:`chat-header`},v_={class:`lineage-picker`},y_={class:`lineage-toolbar`},b_=[`title`],x_={class:`crumb-main`},S_={class:`device-chip`},C_=[`title`],w_={class:`crumb-main`},T_={class:`crumb-name`},E_=[`aria-current`,`title`,`onClick`],D_={class:`crumb-kind`},O_={class:`crumb-main`},k_={class:`crumb-name`},A_=[`disabled`],j_=[`aria-expanded`],M_={key:0,class:`lineage-source`},N_={id:`conversation-picker`,class:`conversation-picker`,role:`dialog`,"aria-label":`Choose conversation`},P_=[`aria-label`,`aria-current`,`onClick`],F_={class:`conversation-choice-content`},I_={class:`choice-lineage`},L_={class:`choice-source`},R_={key:0,class:`agent-stream-status`,role:`alert`},z_=[`disabled`],B_={key:0,class:`chat-empty`},V_={key:0},H_={key:1},U_={key:0,class:`chat-empty`},W_={class:`starter-grid`},G_={key:1,class:`entry live-generation`},K_={class:`message-label`},q_={class:`streaming`},J_={key:2,class:`hint retry-note`},Y_=A({__name:`AgentView`,setup(e){let t=O(),n=O(),r=O(!1),i=B(()=>xu.value.items),a=B(()=>i.value.some(e=>e.kind===`assistant`&&e.streaming)),o=B(()=>i.value.some(e=>e.kind===`tool`&&e.call.status===`running`||e.kind===`assistant`&&e.blocks.some(e=>e.type===`tool`&&e.call.status===`running`))),s=e=>e.kind===`fork`?`Forked from agent #${e.parentId} at entry #${e.forkedAt}`:e.kind===`subagent`?`Owned by agent #${e.ownerAgentId}`:`Root agent`,c=B(()=>Su.value.map(e=>({...e,lineage:ll(Su.value,e.id)})).sort((e,t)=>{for(let n=0;n<Math.min(e.lineage.length,t.lineage.length);n++)if(e.lineage[n].id!==t.lineage[n].id)return e.lineage[n].id-t.lineage[n].id;return e.lineage.length-t.lineage.length})),l=B(()=>Cu.value.at(-1)),u=e=>e.kind===`root`?`agent`:e.kind;function d(){H.value&&(tu.tree=!0,gu(H.value.deviceId,!0))}function f(){let e=Su.value.find(e=>e.kind===`root`)??Su.value[0];e&&p(e.id)}function p(e){r.value=!1,H.value&&pu({...H.value,agentId:e})}function m(e){let t=du.value,n=H.value;t&&n&&(U.dialog={kind:`prompt`,title:`Fork conversation`,hint:`${l.value?.name??`Agent #${n.agentId}`} / entry #${e}. Leave the name blank to use Fork #ID.`,label:`Fork name`,optional:!0,placeholder:`e.g. Alternative approach`,submit:`Create fork`,run:async r=>{let i=await t.fork({entryId:e,name:r||void 0});pu({...n,agentId:i.id}),W(`Forked at entry #${e}. App State stays shared.`)}})}function h(){let e=du.value,t=l.value;e&&t&&(U.dialog={kind:`prompt`,title:`Rename agent`,label:`Agent name`,value:t.named?t.name:``,placeholder:t.name,submit:`Save name`,run:t=>e.rename(t)})}Zn(H,()=>{r.value=!1});let g=!0;return Zn(su.version,()=>{let e=t.value;g=!e||e.scrollHeight-e.scrollTop-e.clientHeight<120},{flush:`pre`}),Zn(su.version,()=>{g&&jn(()=>t.value?.scrollTo({top:t.value.scrollHeight,behavior:`instant`}))}),Zn(()=>Cu.value.length,()=>void jn(()=>n.value&&(n.value.scrollLeft=n.value.scrollWidth))),(e,g)=>(N(),P(`section`,g_,[I(`header`,__,[I(`div`,v_,[I(`div`,y_,[I(`nav`,{ref_key:`lineageNav`,ref:n,class:`crumbs conversation-lineage`,"aria-label":`Conversation lineage`},[I(`button`,{class:`crumb`,title:`${k(iu)?.name} · ${k(iu)?.url}`,onClick:d},[g[5]||=I(`span`,{class:`crumb-kind`},`device`,-1),I(`span`,x_,[L(ld,{device:k(iu),size:18},null,8,[`device`]),I(`span`,S_,T(k(iu)?.name??k(iu)?.id),1)])],8,b_),L(k(Qs),{class:`crumb-sep`,size:18,"aria-hidden":`true`}),I(`button`,{class:`crumb`,title:k(lu)?.cwd,onClick:f},[g[6]||=I(`span`,{class:`crumb-kind`},`workspace`,-1),I(`span`,w_,[L(k(cc),{size:18,"aria-hidden":`true`}),I(`span`,T_,T(k(lu)?.name),1)])],8,C_),k(lu)?.cwd?(N(),F(Gg,{key:0})):z(``,!0),(N(!0),P(M,null,j(k(Cu),e=>(N(),P(M,{key:e.id},[L(k(Qs),{class:`crumb-sep`,size:18,"aria-hidden":`true`}),I(`button`,{class:C([`crumb`,{current:e.id===k(H)?.agentId}]),"aria-current":e.id===k(H)?.agentId?`page`:void 0,title:s(e),onClick:t=>p(e.id)},[I(`span`,D_,T(u(e)),1),I(`span`,O_,[e.kind===`fork`?(N(),F(k(dc),{key:0,size:18,"aria-hidden":`true`})):e.kind===`subagent`?(N(),F(k(rc),{key:1,size:18,"aria-hidden":`true`})):(N(),F(k(Sc),{key:2,size:18,"aria-hidden":`true`})),I(`span`,k_,T(e.name),1)])],10,E_)],64))),128))],512),I(`button`,{class:`icon-button`,"aria-label":`Rename agent`,title:`Rename this agent`,disabled:!l.value,onClick:h},[L(k(jc),{size:18})],8,A_),I(`button`,{class:`icon-button conversation-menu-toggle`,"aria-label":`Browse conversations`,"aria-haspopup":`dialog`,"aria-expanded":r.value,"aria-controls":`conversation-picker`,title:`Browse roots and forks`,onClick:g[0]||=e=>r.value=!r.value},[L(k(Zs),{size:18})],8,j_)]),l.value&&l.value.kind!==`root`?(N(),P(`div`,M_,T(s(l.value)),1)):z(``,!0),r.value?(N(),P(M,{key:1},[I(`button`,{class:`conversation-menu-dismiss`,"aria-label":`Close conversation picker`,onClick:g[1]||=e=>r.value=!1}),I(`section`,N_,[g[7]||=I(`div`,{class:`conversation-picker-heading`},`Roots & forks`,-1),(N(!0),P(M,null,j(c.value,e=>(N(),P(`button`,{key:e.id,class:C([`conversation-choice`,{selected:e.id===k(H)?.agentId}]),"aria-label":e.lineage.map(e=>e.name).join(` → `),"aria-current":e.id===k(H)?.agentId?`page`:void 0,onClick:t=>p(e.id)},[I(`div`,F_,[I(`span`,I_,[(N(!0),P(M,null,j(e.lineage,(t,n)=>(N(),P(M,{key:t.id},[n?(N(),F(k(Qs),{key:0,size:18,"aria-hidden":`true`})):z(``,!0),I(`span`,{class:C({"choice-ancestor":n<e.lineage.length-1})},T(t.name),3)],64))),128))]),I(`span`,L_,T(s(e)),1)]),e.id===k(H)?.agentId?(N(),F(k(Xs),{key:0,size:18,"aria-hidden":`true`})):e.kind===`fork`?(N(),F(k(dc),{key:1,size:18,"aria-hidden":`true`})):(N(),F(k(Sc),{key:2,size:18,"aria-hidden":`true`}))],10,P_))),128))])],64)):z(``,!0)])]),k(su).fault.value||k(su).status.value===`fault`||k(su).status.value===`reconnecting`||k(xu).ready&&k(su).status.value===`connecting`?(N(),P(`div`,R_,[I(`div`,null,[I(`strong`,null,T(k(xu).ready?`Cached transcript is stale.`:`Agent stream unavailable.`),1),I(`p`,null,T(k(su).fault.value||`Updates are paused while the stream reconnects.`),1),g[8]||=I(`p`,null,`Sending is paused until a fresh snapshot arrives. Your draft is kept.`,-1)]),I(`button`,{disabled:k(su).status.value===`connecting`,onClick:g[2]||=(...e)=>k(su).retry&&k(su).retry(...e)},` Retry stream `,8,z_)])):z(``,!0),I(`div`,{ref_key:`chat`,ref:t,class:`chat-scroll`,"data-testid":`chat`},[k(xu).ready?(N(),P(M,{key:1},[i.value.length?z(``,!0):(N(),P(`div`,U_,[g[13]||=I(`div`,{class:`agent-orb`},[I(`img`,{src:`/icons/durable-pi.svg`,alt:`Durable Pi`}),I(`i`)],-1),g[14]||=I(`span`,{class:`eyebrow`},`YOUR DURABLE AGENT IS READY`,-1),g[15]||=I(`h2`,null,`A conversation with continuity.`,-1),I(`p`,null,`Messages, tools and state live on `+T(k(iu)?.id)+`, beyond this window.`,1),I(`div`,W_,[I(`button`,{onClick:g[3]||=e=>k(Nu)(`Inspect this directory using your tools and give me a brief overview. Do not modify any files.`)},[L(k(cc),{size:18}),g[9]||=I(`strong`,null,`Explore this directory`,-1),g[10]||=I(`span`,null,`See coding tools in action`,-1),L(k(Gs),{size:18})]),I(`button`,{onClick:g[4]||=e=>k(Nu)(`Use read_state, then update_state to add a field called progress with value 1 and a boolean called ready with value false.`)},[L(k(Js),{size:18}),g[11]||=I(`strong`,null,`Make a state change`,-1),g[12]||=I(`span`,null,`Watch the workspace update`,-1),L(k(Gs),{size:18})])])])),(N(!0),P(M,null,j(i.value,e=>(N(),F(vg,{key:e.id,item:e,onFork:m},null,8,[`item`]))),128)),k(xu).running&&!a.value&&!o.value?(N(),P(`div`,G_,[I(`div`,K_,[g[16]||=R(` AGENT `,-1),I(`span`,q_,T(k(xu).retry?`Retry scheduled`:`Working`),1)]),g[17]||=I(`div`,{class:`typing`},[I(`i`),I(`i`),I(`i`)],-1)])):z(``,!0),k(xu).retry?(N(),P(`p`,J_,` Retrying: `+T(k(xu).retry.error),1)):z(``,!0),(N(!0),P(M,null,j(k(xu).notices,(e,t)=>(N(),P(`p`,{key:t,class:`message-error`},T(e),1))),128))],64)):(N(),P(`div`,B_,[L(k(Us),{size:30}),k(su).status.value===`fault`?(N(),P(`h2`,V_,`This agent is unavailable.`)):(N(),P(`h2`,H_,`Connecting to the agent…`)),I(`p`,null,`The agent keeps working on `+T(k(iu)?.id)+` while this view connects.`,1)]))],512),L(h_)]))}});function X_(e,t){return`${e}/${t.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`}var Z_=[`data-state-path`],Q_={key:0,class:`state-field-heading`},$_=[`value`,`aria-label`,`disabled`],ev=[`value`],tv=[`aria-label`,`disabled`],nv=[`aria-label`,`disabled`],rv=[`aria-label`,`disabled`],iv=[`value`],av=[`disabled`],ov=[`disabled`,`aria-label`],sv={key:2,class:`state-number`},cv=[`aria-label`,`disabled`],lv=[`aria-label`,`disabled`],uv=[`aria-label`,`disabled`],dv={key:3,class:`state-boolean`},fv=[`aria-label`,`aria-checked`,`disabled`],pv=[`aria-label`,`disabled`],mv={key:5,class:`muted`},hv=A({__name:`StateEditor`,props:{value:{type:[String,Number,Boolean,null,Array,Object]},path:{default:``},label:{default:`App State`},disabled:{type:Boolean}},emits:[`change`],setup(e,{emit:t}){let n=e,r=t,i=B(()=>n.value===null?`null`:Array.isArray(n.value)?`array`:typeof n.value),a=B(()=>i.value===`object`||i.value===`array`),o=B(()=>a.value?Object.entries(n.value):[]),s=O(``),c=O(!1),l=O(``),u=O(`string`),d=O(!1),f=[`string`,`number`,`boolean`,`object`,`array`,`null`],p={string:()=>``,number:()=>0,boolean:()=>!1,object:()=>({}),array:()=>[],null:()=>null};Zn(()=>n.value,e=>{c.value||(s.value=String(e??``))},{immediate:!0});function m(e,t){r(`change`,{operation:e,path:n.path,value:t})}function h(){c.value=!1;let e=i.value===`number`?Number(s.value):s.value;if(i.value===`number`&&(!String(s.value).trim()||!Number.isFinite(e))){s.value=String(n.value);return}e!==n.value&&m(`update`,e)}function g(){let e=i.value===`array`?`-`:l.value.trim();e&&(r(`change`,{operation:`create`,path:X_(n.path,e),value:p[u.value]()}),l.value=``,d.value=!1)}return(t,n)=>{let _=ei(`StateEditor`,!0);return N(),P(`div`,{class:C([`state-field`,{"state-root":e.path===``}]),"data-state-path":e.path},[e.path===``?z(``,!0):(N(),P(`div`,Q_,[I(`strong`,null,T(e.label),1),I(`select`,{value:i.value,"aria-label":`Type of ${e.path}`,disabled:e.disabled,onChange:n[0]||=e=>m(`update`,p[e.target.value]())},[(N(),P(M,null,j(f,e=>I(`option`,{key:e,value:e},T(e),9,ev)),64))],40,$_),I(`button`,{class:`icon-button`,"aria-label":`Delete ${e.path}`,title:`Delete field`,disabled:e.disabled,onClick:n[1]||=e=>m(`delete`)},[L(k(Hc),{size:18})],8,tv)])),a.value?(N(),P(M,{key:1},[(N(!0),P(M,null,j(o.value,([t,i])=>(N(),F(_,{key:t,value:i,path:k(X_)(e.path,t),label:t,disabled:e.disabled,onChange:n[2]||=e=>r(`change`,e)},null,8,[`value`,`path`,`label`,`disabled`]))),128)),d.value&&i.value===`array`?(N(),P(`form`,{key:0,class:`state-add`,onSubmit:js(g,[`prevent`])},[i.value===`array`?z(``,!0):Wn((N(),P(`input`,{key:0,"onUpdate:modelValue":n[3]||=e=>l.value=e,placeholder:`Field name`,"aria-label":`New field name in ${e.path||`/`}`,required:``,disabled:e.disabled},null,8,nv)),[[xs,l.value]]),Wn(I(`select`,{"onUpdate:modelValue":n[4]||=e=>u.value=e,"aria-label":`New field type in ${e.path||`/`}`,disabled:e.disabled},[(N(),P(M,null,j(f,e=>I(`option`,{key:e,value:e},T(e),9,iv)),64))],8,rv),[[ws,u.value]]),I(`button`,{class:`secondary small`,disabled:e.disabled||i.value!==`array`&&!l.value.trim()},` Add `,8,av),I(`button`,{type:`button`,class:`text-button`,onClick:n[5]||=e=>d.value=!1},`Cancel`)],32)):i.value===`array`?(N(),P(`button`,{key:1,class:`text-button state-add-button`,disabled:e.disabled,"aria-label":`Add ${i.value===`array`?`item`:`field`} to ${e.path||`/`}`,onClick:n[6]||=e=>d.value=!0},[L(k(Nc),{size:18}),R(T(i.value===`array`?`Add item`:`Add field`),1)],8,ov)):z(``,!0)],64)):i.value===`number`?(N(),P(`div`,sv,[I(`button`,{class:`secondary`,"aria-label":`Decrement ${e.path}`,disabled:e.disabled,onClick:n[7]||=e=>m(`increment`,-1)},[L(k(Cc),{size:18})],8,cv),Wn(I(`input`,{"onUpdate:modelValue":n[8]||=e=>s.value=e,type:`number`,step:`any`,"aria-label":`Value of ${e.path}`,disabled:e.disabled,onFocus:n[9]||=e=>c.value=!0,onBlur:h,onKeydown:n[10]||=Ns(e=>e.target.blur(),[`enter`])},null,40,lv),[[xs,s.value]]),I(`button`,{class:`secondary`,"aria-label":`Increment ${e.path}`,disabled:e.disabled,onClick:n[11]||=e=>m(`increment`,1)},[L(k(Nc),{size:18})],8,uv)])):i.value===`boolean`?(N(),P(`div`,dv,[I(`button`,{class:C([`switch`,{on:e.value===!0}]),role:`switch`,"aria-label":`Value of ${e.path}`,"aria-checked":e.value===!0,disabled:e.disabled,onClick:n[12]||=t=>m(`update`,!e.value)},[...n[15]||=[I(`span`,null,null,-1)]],10,fv),I(`span`,null,T(e.value),1)])):i.value===`string`?Wn((N(),P(`textarea`,{key:4,"onUpdate:modelValue":n[13]||=e=>s.value=e,rows:`2`,"aria-label":`Value of ${e.path}`,disabled:e.disabled,onFocus:n[14]||=e=>c.value=!0,onBlur:h},null,40,pv)),[[xs,s.value]]):(N(),P(`span`,mv,`null`))],10,Z_)}}}),gv=[`data-status`],_v=[`title`],vv=[`title`],yv=[`href`],bv=[`title`],xv=A({__name:`TunnelStatusBar`,props:{device:{}},setup(e){let t=e,n=B(()=>t.device.status===`online`),r=B(()=>t.device.transport===`tunnel`),i=B(()=>n.value?r.value?`online · via tunnel`:`online · LAN`:r.value?`tunnel`:`LAN`),a=B(()=>t.device.tunnel?.state===`connected`);return(t,o)=>(N(),P(`span`,{class:`tunnel-status`,"data-status":e.device.status},[I(`span`,{class:`axis transport`,title:r.value?`Hub ⇄ device over the tunnel (WSS)`:`Hub → device over LAN`},[r.value?(N(),F(k(Ys),{key:0,size:13,class:C({live:a.value})},null,8,[`class`])):(N(),F(k(Gc),{key:1,size:13,class:C({live:n.value})},null,8,[`class`])),R(` `+T(i.value),1)],8,_v),I(`span`,{class:C([`axis monitor`,e.device.status])},[e.device.status===`offline`?(N(),F(k(Wc),{key:0,size:13})):(N(),P(M,{key:1},[R(T(e.device.status),1)],64))],2),r.value&&a.value&&e.device.tunnel?(N(),P(`span`,{key:0,class:`axis muted`,title:`tunnel last seen ${k(Lu)(e.device.tunnel.lastSeenAt)}`},T(e.device.tunnel.readerCount)+` reader`+T(e.device.tunnel.readerCount===1?``:`s`),9,vv)):z(``,!0),e.device.url?(N(),P(`a`,{key:1,class:`axis url`,href:e.device.url,target:`_blank`,rel:`noreferrer`},T(e.device.url),9,yv)):z(``,!0),e.device.lastSeenAt?(N(),P(`span`,{key:2,class:`axis muted`,title:`last probe ${k(Lu)(e.device.lastSeenAt)}`},T(k(Lu)(e.device.lastSeenAt)),9,bv)):z(``,!0)],8,gv))}});async function Sv(e,t,n,r,i){let a=await fetch(`/api${t}`,{method:e,headers:n===void 0?{}:{"content-type":`application/json`},body:n===void 0?void 0:JSON.stringify(n),signal:r,...i?{keepalive:i}:{}}),o=await a.json().catch(()=>void 0);if(!a.ok){let e=o?.error;throw new Cl(e?.code??`internal`,e?.message??`${a.status} ${a.statusText}`,a.status)}return o}function Cv(e){return e.offerUrl??e.pairUrl}var wv={pending:e=>Sv(`GET`,`/pair/codes`,void 0,e),pairings:e=>Sv(`GET`,`/pairings`,void 0,e),createCode:e=>Sv(`POST`,`/pair/code`,{},e),resolveCode:(e,t)=>Sv(`POST`,`/pair/resolve`,{code:e},t),codeState:(e,t)=>Sv(`GET`,`/pair/codes/${encodeURIComponent(e)}`,void 0,t),approve:(e,t,n)=>Sv(`POST`,`/pair/codes/${encodeURIComponent(e)}/approve`,t,n),cancel:(e,t,n)=>Sv(`POST`,`/pair/codes/${encodeURIComponent(e)}/cancel`,{},t,n),rotate:(e,t)=>Sv(`POST`,`/pairings/${encodeURIComponent(e)}/rotate`,{},t),revoke:(e,t=`user`,n)=>Sv(`POST`,`/pairings/${encodeURIComponent(e)}/revoke`,{reason:t},n)},Tv=0;function Ev(){let e=++Tv,t=!1;return{gen:e,close:()=>t=!0,closed:()=>t}}var Dv=class extends Error{codeId;constructor(e){super(`pairing poll timed out for ${e}`),this.codeId=e,this.name=`PollTimeout`}},Ov=e=>e===`issued`||e===`cancelled`||e===`expired`;async function kv(e,t,n={}){let r=n.intervalMs??1e3,i=Date.now()+(n.timeoutMs??33e4);for(;;){if(e.closed())return;if(n.signal?.aborted)throw new DOMException(`The operation was aborted.`,`AbortError`);if(Date.now()>i)throw new Dv(t);let a=await wv.codeState(t,n.signal);if(e.closed())return;if(e.state=a,n.onState?.(a),Ov(a.phase))return a;await new Promise(e=>setTimeout(e,r))}}var Av={key:0,class:`token-manager`,"aria-label":`Credential manager`},jv={class:`credential-fingerprint`},Mv=[`title`],Nv={key:0,class:`rotation-badge`,role:`status`},Pv={class:`token-actions`},Fv=[`disabled`],Iv=[`disabled`],Lv={key:1,class:`message-error`,role:`alert`},Rv=A({__name:`TokenManager`,props:{device:{}},setup(e){let t=e,n=O(!1),r=O(``),i=B(()=>t.device.pairing);async function a(){if(!n.value){n.value=!0,r.value=``;try{await wv.rotate(t.device.id),W(`Rotation queued — it completes when the device acknowledges the new credential.`)}catch(e){r.value=zl(e)}finally{n.value=!1}}}async function o(){n.value||(U.dialog={kind:`prompt`,title:`Revoke ${t.device.id}?`,hint:`Every tunnel credential for this device dies at commit and the live tunnel is cut within a second. The device cleans its own files the next time it talks to the hub.`,submit:`Revoke`,danger:!0,run:async()=>{await wv.revoke(t.device.id,`user`),W(`Revoke committed on the hub. The tunnel is cut; the device cleans up on its next contact.`)}})}return(e,t)=>i.value?(N(),P(`section`,Av,[I(`header`,null,[L(k(hc),{size:15}),t[0]||=I(`h3`,null,`Credential`,-1),I(`span`,{class:C([`pairing-status`,i.value.status])},T(i.value.status),3)]),I(`dl`,null,[t[1]||=I(`dt`,null,`Key fingerprint`,-1),I(`dd`,null,[I(`code`,jv,T(i.value.keyFingerprint),1)]),t[2]||=I(`dt`,null,`Paired`,-1),I(`dd`,{title:new Date(i.value.pairedAt).toISOString()},T(k(Lu)(i.value.pairedAt)),9,Mv),t[3]||=I(`dt`,null,`Generation`,-1),I(`dd`,null,T(i.value.credentialGeneration),1)]),i.value.rotationPending?(N(),P(`p`,Nv,[L(k(Fc),{size:13,class:`spin`}),t[4]||=R(` rotation queued — waiting for the device to ACK `,-1)])):z(``,!0),I(`div`,Pv,[i.value.status===`paired`?(N(),P(`button`,{key:0,class:`small`,disabled:n.value||i.value.rotationPending,onClick:a},[L(k(Fc),{size:14}),t[5]||=R(` Rotate credential `,-1)],8,Fv)):z(``,!0),i.value.status===`paired`?(N(),P(`button`,{key:1,class:`small danger`,disabled:n.value,onClick:o},[L(k(Bc),{size:14}),t[6]||=R(` Revoke `,-1)],8,Iv)):z(``,!0)]),r.value?(N(),P(`p`,Lv,T(r.value),1)):z(``,!0)])):z(``,!0)}}),zv={class:`tasks-panel`},Bv={class:`panel-heading`},Vv={class:`tag`},Hv={key:0,class:`message-error`,role:`alert`},Uv={class:`task-section`,"aria-label":`Durable jobs`},Wv={key:0,class:`task-empty`},Gv=[`data-job`],Kv={class:`job-def-head`},qv={key:0,class:`tag`},Jv={class:`tag`},Yv=[`aria-label`],Xv=[`title`],Zv={class:`job-def-meta`},Qv=[`title`],$v=[`title`],ey={key:0,class:`job-def-last`},ty=[`onClick`],ny=[`disabled`,`onClick`],ry=[`disabled`,`onClick`],iy=[`disabled`,`onClick`],ay={class:`task-section`,"aria-label":`Agent activity`},oy={class:`panel-heading`},sy={key:0,class:`task-empty`},cy={key:1,class:`task-tree`},ly=[`data-task-kind`],uy={class:`tag`},dy={key:0,class:`task-phase`},fy=[`onClick`],py=[`disabled`],my={class:`raw`},hy=A({__name:`TasksPanel`,setup(e){let t=O(``),n=O(!1),r=O([]),i=O(),a=e=>({running:`Running`,waiting:`Waiting`,completed:`Completed`,aborted:`Stopped`,declined:`Declined`,failed:`Failed`,pending:`Queued`,completing:`Finishing`,terminal:`Finished`})[e]??e,o=B(()=>new Map(ih.value.map(e=>[e.id,oh.value.find(t=>t.job===e.id)]))),s=B(()=>{let e=wu.value,t=new Set(e.map(e=>e.id)),n=new Map;for(let r of e){let e=r.owner!==void 0&&t.has(r.owner)?r.owner:void 0;n.set(e,[...n.get(e)??[],r])}let r=[],i=(e,t)=>{for(let a of(n.get(e)??[]).sort((e,t)=>e.id-t.id))r.push({task:a,depth:t}),i(a.id,t+1)};return i(void 0,0),r}),c=e=>e.kind===`pi.tool`?{icon:qc,name:e.label??`Tool call`,what:`tool call`}:e.kind===`pi.generation`?{icon:qs,name:`Model response`,what:`generation`}:e.kind===`pi.compaction`?{icon:_c,name:`Compaction`,what:`compaction`}:e.kind.startsWith(`demo.job.`)?{icon:Kc,name:e.label??ah(e.kind.slice(9))?.title??e.kind,what:`durable job`}:e.kind===`demo.job-approval`?{icon:zc,name:`Approval`,what:`waits for you`}:{icon:Us,name:e.label??e.kind,what:e.kind},l=e=>e.state.phase?e.kind.startsWith(`demo.job.`)?ah(e.kind.slice(9))?.phases.find(t=>t.id===e.state.phase)?.label??e.state.phase:e.state.phase:``;async function u(){if(!n.value&&du.value){n.value=!0,t.value=``;try{await du.value.abort(!0)}catch(e){t.value=zl(e)}finally{n.value=!1}}}async function d(e){let n=fu.value;if(e.target.open&&n)try{let[e,t]=await Promise.all([n.tasks(`terminal`,40),n.inspect()]);r.value=e,i.value=t}catch(e){t.value=zl(e)}}let f=B(()=>r.value.filter(e=>e.state.status===`terminal`).slice(-12).reverse());return(e,r)=>(N(),P(`div`,zv,[I(`div`,Bv,[r[0]||=I(`h2`,null,`Tasks`,-1),I(`span`,Vv,T(k(wu).length)+` active`,1)]),t.value?(N(),P(`p`,Hv,T(t.value),1)):z(``,!0),I(`section`,Uv,[I(`h3`,null,[L(k(Ic),{size:18}),r[1]||=R(`Durable jobs`,-1)]),r[2]||=I(`p`,{class:`hint`},[R(` Repeatable workflows with named phases. Every run follows the same phases and saves a checkpoint after each one. Start one here, or ask your agent: it finds these with `),I(`code`,null,`list_durable_jobs`),R(`, starts them with `),I(`code`,null,`run_durable_job`),R(` and checks them with `),I(`code`,null,`check_durable_job`),R(`. Runs play out live in the chat. `)],-1),k(ih).length?z(``,!0):(N(),P(`p`,Wv,` This device has no durable jobs. Deploy the latest backend to it. `)),(N(!0),P(M,null,j(k(ih),e=>(N(),P(`article`,{key:e.id,class:`job-def`,"data-job":e.id},[I(`div`,Kv,[L(k(Kc),{size:18}),I(`strong`,null,T(e.title),1),e.approval?(N(),P(`span`,qv,`needs approval`)):z(``,!0),I(`span`,Jv,`~`+T(e.seconds)+`s`,1)]),I(`p`,null,T(e.summary),1),I(`ol`,{class:`job-chain`,"aria-label":`${e.title} phases`},[(N(!0),P(M,null,j(e.phases,(e,t)=>(N(),P(`li`,{key:e.id,title:e.summary},[I(`span`,null,T(t+1),1),R(T(e.label),1),e.kind===`repeat`?(N(),F(k(Ic),{key:0,size:13})):z(``,!0),e.kind===`approval`?(N(),F(k(zc),{key:1,size:13})):z(``,!0)],8,Xv))),128))],8,Yv),I(`div`,Zv,[(N(!0),P(M,null,j(e.inputs,e=>(N(),P(`code`,{key:e.name,title:e.description},T(e.name)+`=`+T(e.default),9,Qv))),128)),I(`code`,{title:`Each run saves its result to App State ${e.resultPath}`},`→ `+T(e.resultPath),9,$v)]),o.value.get(e.id)?(N(),P(`div`,ey,[I(`span`,null,[R(`Run #`+T(o.value.get(e.id).run)+`: `,1),I(`strong`,null,T(a(o.value.get(e.id).status)),1),k(rh)(o.value.get(e.id))?z(``,!0):(N(),P(M,{key:0},[R(` in `+T(o.value.get(e.id).phases.find(t=>t.id===o.value.get(e.id).phase)?.label),1)],64))]),I(`button`,{class:`text-button`,onClick:t=>k(ph)(o.value.get(e.id).id)},` Show in chat `,8,ty),o.value.get(e.id).approval===`pending`?(N(),P(M,{key:0},[I(`button`,{class:`primary small`,disabled:!!k(dh),onClick:t=>k(hh)(o.value.get(e.id),!0)},` Approve `,8,ny),I(`button`,{class:`secondary`,disabled:!!k(dh),onClick:t=>k(hh)(o.value.get(e.id),!1)},` Decline `,8,ry)],64)):z(``,!0)])):z(``,!0),I(`button`,{class:`secondary job-def-run`,disabled:!!k(dh)||!k(du),onClick:t=>k(mh)(e)},[L(k(Mc),{size:16}),R(`Run `+T(e.title),1)],8,iy)],8,Gv))),128))]),I(`section`,ay,[I(`div`,oy,[r[3]||=I(`h3`,null,`Agent activity`,-1),L(k(Us),{size:18})]),r[5]||=I(`p`,{class:`hint`},` Every model response and every tool call is its own durable task with an id, an owner and a checkpoint. Follow them live here; after a restart each one resumes or reports how it ended. `,-1),s.value.length?(N(),P(`ul`,cy,[(N(!0),P(M,null,j(s.value,({task:e,depth:t})=>(N(),P(`li`,{key:e.id,class:`task-row`,style:ye({"--depth":t}),"data-task-kind":e.kind},[(N(),F(ni(c(e).icon),{size:16})),I(`strong`,null,T(c(e).name),1),I(`span`,uy,T(a(e.state.status)),1),l(e)?(N(),P(`span`,dy,T(l(e)),1)):z(``,!0),I(`small`,null,`#`+T(e.id)+` `+T(c(e).what)+`, agent #`+T(e.conversationId)+T(e.effectiveBackground?`, background`:``),1),(N(!0),P(M,null,j(e.conversations,e=>(N(),P(`button`,{key:e,class:`text-button`,onClick:t=>k(_h)(e)},` Open agent #`+T(e),9,fy))),128))],12,ly))),128))])):(N(),P(`p`,sy,`Nothing running. Send a message or run a job.`)),r[6]||=I(`p`,{class:`hint`},` Interrupt or Esc stops foreground work and what it owns. Stop all also stops background runs. `,-1),I(`button`,{class:`secondary danger`,disabled:!k(wu).length||n.value,onClick:u},[L(k(Ec),{size:18}),r[4]||=R(`Stop all `,-1)],8,py)]),I(`details`,{class:`raw task-section`,onToggle:d},[I(`summary`,null,[L(k(tc),{size:18}),r[7]||=R(`Runtime details`,-1)]),r[9]||=I(`p`,{class:`hint`},` Recent task results and recovery records, read from the device when opened. `,-1),(N(!0),P(M,null,j(f.value,e=>(N(),P(`details`,{key:e.id,class:`raw`},[I(`summary`,null,[R(T(e.kind)+` #`+T(e.id),1),I(`span`,null,T(a(e.state.outcome?.status??e.state.status)),1)]),I(`pre`,null,T(JSON.stringify(e.state.outcome,null,2)),1)]))),128)),I(`details`,my,[r[8]||=I(`summary`,null,`Recovery inspection`,-1),I(`pre`,null,T(JSON.stringify(i.value,null,2)),1)])],32)]))}}),gy={class:`git-tab`},_y={key:0,class:`empty`},vy={class:`git-head`},yy=[`title`],by=[`disabled`],xy={key:0,class:`error`},Sy={key:1,class:`empty`},Cy={class:`facts`},wy={key:0},Ty={key:1},Ey={key:2,class:`wt-of`},Dy={class:`row`},Oy=[`disabled`],ky=[`disabled`],Ay=[`disabled`],jy=[`disabled`],My=[`disabled`],Ny={class:`row`},Py=[`disabled`],Fy={class:`row`},Iy=[`disabled`],Ly={key:0,class:`wts`},Ry={class:`muted`},zy=[`disabled`,`onClick`],By={key:1,class:`out`},Vy=Wg(A({__name:`GitPanel`,props:{deviceId:{},cwd:{}},async setup(e){let t,n,r=e,i=O(null),a=O(``),o=O(``),s=O(``),c=O(``),l=O(``),u=B(()=>r.cwd??lu.value?.cwd??``),d=B(()=>r.deviceId??ru.value),f=()=>d.value?Il(d.value):null,p;async function m(){let e=f();if(e&&u.value)try{i.value=await e.gitStatus(u.value),a.value=``}catch(e){i.value=null,a.value=e.message.slice(0,160)}}[t,n]=di(()=>m()),await t,n(),Wr(()=>{p=setInterval(m,1e4)}),qr(()=>p&&clearInterval(p)),Zn(u,()=>void m());async function h(e){let t=f();if(t&&u.value){o.value=e,s.value=``;try{let n=await t.gitOp(u.value,e);s.value=n.text||`(empty)`,(e===`fetch`||e===`pull`)&&W(`git ${e} ✓`),await m()}catch(t){s.value=`${e} failed: ${t.message.slice(0,200)}`}finally{o.value=``}}}async function g(){let e=f();if(e&&u.value&&c.value.trim()){o.value=`commit`;try{W((await e.gitOp(u.value,`commit`,{message:c.value.trim()})).text),c.value=``,await m()}catch(e){W(`commit failed: ${e.message.slice(0,120)}`)}finally{o.value=``}}}async function _(){let e=f();if(!e||!u.value||!l.value.trim()||!i.value?.root)return;let t=i.value.root,n=t.slice(0,t.lastIndexOf(`/`)),r=t.slice(t.lastIndexOf(`/`)+1);o.value=`wt`;try{W((await e.gitOp(u.value,`worktree-add`,{branch:l.value.trim(),target:`${n}/${r}-${l.value.trim()}`})).text.split(`
78
- `)[0]??`worktree added`),l.value=``,await m()}catch(e){W(`worktree failed: ${e.message.slice(0,120)}`)}finally{o.value=``}}async function v(e){let t=f();if(t&&u.value&&confirm(`Remove worktree ${e}?`)){o.value=`wt`;try{await t.gitOp(u.value,`worktree-remove`,{target:e}),await m()}catch(e){W(`remove failed: ${e.message.slice(0,120)}`)}finally{o.value=``}}}return(e,t)=>(N(),P(`div`,gy,[u.value?(N(),P(M,{key:1},[I(`header`,vy,[t[8]||=I(`strong`,null,`git`,-1),I(`code`,{class:`cwd`,title:u.value},T(u.value),9,yy),I(`button`,{disabled:!!o.value,title:`refresh`,onClick:t[0]||=e=>m()},[L(k(Fc),{size:14})],8,by)]),a.value?(N(),P(`p`,xy,T(a.value),1)):z(``,!0),i.value&&!i.value.repo?(N(),P(`p`,Sy,[...t[9]||=[R(` Not a git repository — run `,-1),I(`code`,null,`git init`,-1),R(` (or open a session inside a repo) to see branch, status and worktrees here. `,-1)]])):i.value?(N(),P(M,{key:2},[I(`dl`,Cy,[I(`div`,null,[t[10]||=I(`dt`,null,`branch`,-1),I(`dd`,null,T(i.value.branch??`detached`),1)]),i.value.upstream?(N(),P(`div`,wy,[t[11]||=I(`dt`,null,`upstream`,-1),I(`dd`,null,T(i.value.upstream),1)])):z(``,!0),I(`div`,null,[t[12]||=I(`dt`,null,`changes`,-1),I(`dd`,null,`+`+T(i.value.staged??0)+` ~`+T(i.value.unstaged??0)+` ?`+T(i.value.untracked??0),1)]),i.value.ahead||i.value.behind?(N(),P(`div`,Ty,[t[13]||=I(`dt`,null,`sync`,-1),I(`dd`,null,`↑`+T(i.value.ahead??0)+` ↓`+T(i.value.behind??0),1)])):z(``,!0),I(`div`,null,[t[14]||=I(`dt`,null,`head`,-1),I(`dd`,null,T(i.value.head)+` `+T(i.value.subject),1)]),i.value.worktreeOf?(N(),P(`div`,Ey,[t[15]||=I(`dt`,null,`worktree of`,-1),I(`dd`,null,T(i.value.worktreeOf),1)])):z(``,!0)]),I(`div`,Dy,[I(`button`,{disabled:!!o.value,onClick:t[1]||=e=>h(`fetch`)},`fetch`,8,Oy),I(`button`,{disabled:!!o.value,onClick:t[2]||=e=>h(`pull`)},`pull`,8,ky),I(`button`,{disabled:!!o.value,onClick:t[3]||=e=>h(`log`)},`log`,8,Ay),I(`button`,{disabled:!!o.value,onClick:t[4]||=e=>h(`branch`)},`branches`,8,jy),I(`button`,{disabled:!!o.value,onClick:t[5]||=e=>h(`diff`)},`diff`,8,My)]),I(`div`,Ny,[Wn(I(`input`,{"onUpdate:modelValue":t[6]||=e=>c.value=e,placeholder:`commit message…`,onKeyup:Ns(g,[`enter`])},null,544),[[xs,c.value]]),I(`button`,{disabled:!!o.value||!c.value.trim(),onClick:g},`commit -am`,8,Py)]),I(`div`,Fy,[Wn(I(`input`,{"onUpdate:modelValue":t[7]||=e=>l.value=e,placeholder:`branch name…`,onKeyup:Ns(_,[`enter`])},null,544),[[xs,l.value]]),I(`button`,{disabled:!!o.value||!l.value.trim(),onClick:_},`+ worktree`,8,Iy)]),(i.value.worktrees?.length??0)>1?(N(),P(`ul`,Ly,[(N(!0),P(M,null,j(i.value.worktrees,e=>(N(),P(`li`,{key:e.path},[I(`code`,null,T(e.path),1),I(`span`,Ry,T(e.branch??e.head),1),e.path===i.value.root?z(``,!0):(N(),P(`button`,{key:0,disabled:!!o.value,onClick:t=>v(e.path)},`remove`,8,zy))]))),128))])):z(``,!0),s.value?(N(),P(`pre`,By,T(s.value.slice(0,6e3)),1)):z(``,!0)],64)):z(``,!0)],64)):(N(),P(`p`,_y,`No session selected — open a session to see its git.`))]))}}),[[`__scopeId`,`data-v-bd0a41b8`]]),Hy={class:`extensions-panel`},Uy={class:`panel-heading`},Wy={key:0,class:`task-empty`},Gy=[`data-extension`],Ky={class:`ext-head`},qy=[`aria-checked`,`aria-label`,`disabled`,`onClick`],Jy=[`checked`,`disabled`,`onChange`],Yy=A({__name:`ExtensionsPanel`,setup(e){let t=an(),n=O(!1);async function r(){let e=du.value;if(!e||!au.value)return void(t.value=void 0);t.value=await e.extensions().catch(()=>void 0)??t.value}Zn([du,au,()=>JSON.stringify(xu.value.agent.extensions??null)],r,{immediate:!0});async function i(e){let r=du.value;if(r&&!n.value){n.value=!0;try{let n=await Mu(()=>r.setExtension(e));n&&(t.value=n),Au()}finally{n.value=!1}}}return(e,r)=>(N(),P(`div`,Hy,[I(`div`,Uy,[r[0]||=I(`h2`,null,`Extensions`,-1),L(k(Pc),{size:18})]),r[3]||=I(`p`,{class:`hint`},` Custom harness capabilities for this agent. Turn one on and the next request uses it. The choice is stored with the agent, so it survives restarts. `,-1),t.value?z(``,!0):(N(),P(`p`,Wy,`Loading extensions…`)),(N(!0),P(M,null,j(t.value?.extensions??[],e=>(N(),P(`article`,{key:e.name,class:C([`ext-card`,{on:e.enabled}]),"data-extension":e.name},[I(`div`,Ky,[I(`div`,null,[I(`strong`,null,T(e.title),1),I(`code`,null,T(e.name),1)]),I(`button`,{class:C([`switch`,{on:e.enabled}]),role:`switch`,"aria-checked":e.enabled,"aria-label":e.title,disabled:n.value,onClick:t=>i({name:e.name,enabled:!e.enabled})},[...r[1]||=[I(`span`,null,null,-1)]],10,qy)]),I(`p`,null,T(e.description),1),e.prompts?(N(),P(`ul`,{key:0,class:C([`ext-prompts`,{off:!e.enabled}])},[(N(!0),P(M,null,j(e.prompts,e=>(N(),P(`li`,{key:e.id},[I(`label`,null,[I(`input`,{type:`checkbox`,checked:e.enabled,disabled:n.value,onChange:t=>i({prompt:e.id,enabled:t.target.checked})},null,40,Jy),I(`code`,null,T(e.id),1)]),I(`span`,null,T(e.description),1),I(`details`,null,[r[2]||=I(`summary`,null,`View prompt`,-1),I(`pre`,null,T(e.text),1)])]))),128))],2)):z(``,!0)],10,Gy))),128))]))}}),Xy={class:`context-section`,"aria-labelledby":`context-title`},Zy={class:`section-label`},Qy={key:0,class:`hint`},$y={class:`context-numbers`},eb={class:`context-pct`},tb={key:0,class:`context-compacting`},nb=[`aria-valuemax`,`aria-valuenow`,`aria-valuetext`],rb={class:`context-marker-label`},ib=[`aria-valuemin`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`],ab={class:`context-marker-label`},ob={class:`hint context-hint`},sb={class:`modal compaction-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`compaction-title`},cb={class:`context-toggle`},lb=[`checked`],ub=512,db=4096,fb=1024,pb=A({__name:`ContextBar`,setup(e){let t=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),n=B(()=>Du.value?.contextWindow??0),r=B(()=>{let e=xu.value.entries;for(let t=e.length-1;t>=0;t--){if(e[t].kind!==`pi.assistant`)continue;let n=e[t].model?.find(e=>e.role===`assistant`)?.usage;if(n)return n.totalTokens||n.input+n.output+n.cacheRead+n.cacheWrite}return 0}),i=B(()=>xu.value.compactions.length>0),a=O(),o=B(()=>a.value??lu.value?.compaction??Xg(n.value));Zn(()=>JSON.stringify(lu.value?.compaction),e=>{a.value&&e===JSON.stringify(a.value)&&(a.value=void 0)});let s=O(),c=B(()=>U.dialog?.kind===`compaction`),l=()=>void(U.dialog=void 0);Jr(()=>c.value&&l());let u=B(()=>s.value??Zg(n.value,o.value)),d=e=>`${Math.min(100,Math.max(0,100*e/(n.value||1)))}%`,f=B(()=>Math.round(100*r.value/(n.value||1))),p=e=>{let t=e/(n.value||1);return t<.35?`start`:t>.65?`end`:`center`},m=(e,t)=>Math.min(n.value-fb,Math.max((t??db)+fb,e)),h=(e,t)=>Math.min(t-fb,Math.max(db,e));function g(e,t){let n=u.value,r=Math.round(t/ub)*ub;s.value=e===`wait`?{auto:n.auto,wait:m(r,n.auto)}:{auto:h(r,n.wait),wait:n.wait}}async function _(e){let t=fu.value;if(!t)return;let n=await Mu(()=>t.setCompaction(e));n&&(a.value=n),s.value=void 0}function v(){let e=s.value;e&&_({reserveTokens:n.value-e.wait,...e.auto===void 0?{}:{backgroundTokens:e.wait-e.auto}})}let y=O(),b;function ee(e,t){b=e,t.currentTarget.setPointerCapture(t.pointerId)}function te(e){if(!b||!y.value)return;let t=y.value.getBoundingClientRect();g(b,(e.clientX-t.left)/t.width*n.value)}function x(){b&&(b=void 0,v())}function ne(e,t){let n=(t.shiftKey?8192:1024)*(t.key===`ArrowRight`||t.key===`ArrowUp`?1:t.key===`ArrowLeft`||t.key===`ArrowDown`?-1:0);if(!n)return;t.preventDefault();let r=u.value;g(e,(e===`auto`?r.auto??db:r.wait)+n)}return(e,a)=>(N(),P(M,null,[I(`section`,Xy,[I(`div`,Zy,[a[7]||=I(`span`,{id:`context-title`},`CONTEXT`,-1),n.value?(N(),P(`button`,{key:0,class:`context-details-toggle`,onClick:a[0]||=e=>k(U).dialog={kind:`compaction`}},[L(k(mc),{size:16}),a[6]||=R(`Details `,-1)])):z(``,!0)]),n.value?(N(),P(M,{key:1},[I(`div`,$y,[I(`strong`,null,T(t(r.value)),1),I(`span`,null,`of `+T(t(n.value))+` tokens`,1),I(`span`,eb,T(f.value)+`%`,1),i.value?(N(),P(`span`,tb,[...a[8]||=[I(`i`,null,null,-1),R(`Compacting`,-1)]])):z(``,!0)]),I(`div`,{ref_key:`bar`,ref:y,class:C([`context-bar`,{off:!o.value.enabled}]),onPointermove:te,onPointerup:x,onPointercancel:x},[I(`div`,{class:C([`context-fill`,{hot:u.value.auto!==void 0&&r.value>=u.value.auto}]),style:ye({width:d(r.value)})},null,6),I(`div`,{class:`context-reserve`,style:ye({left:d(u.value.wait)}),title:`Reserved for the answer`},null,4),u.value.auto===void 0?z(``,!0):(N(),P(`button`,{key:0,class:C([`context-marker auto`,`label-${p(u.value.auto)}`]),role:`slider`,"aria-label":`Automatic compaction starts at`,"aria-valuemin":db,"aria-valuemax":u.value.wait-fb,"aria-valuenow":u.value.auto,"aria-valuetext":`${t(u.value.auto)} tokens`,style:ye({left:d(u.value.auto)}),onPointerdown:a[1]||=e=>ee(`auto`,e),onKeydown:a[2]||=e=>ne(`auto`,e),onKeyup:v,onBlur:v},[I(`span`,rb,`Auto-compact at `+T(t(u.value.auto)),1)],46,nb)),I(`button`,{class:C([`context-marker wait`,`label-${p(u.value.wait)}`]),role:`slider`,"aria-label":`The next request waits for a summary at`,"aria-valuemin":(u.value.auto??db)+fb,"aria-valuemax":n.value-fb,"aria-valuenow":u.value.wait,"aria-valuetext":`${t(u.value.wait)} tokens, ${t(n.value-u.value.wait)} reserved`,style:ye({left:d(u.value.wait)}),onPointerdown:a[3]||=e=>ee(`wait`,e),onKeydown:a[4]||=e=>ne(`wait`,e),onKeyup:v,onBlur:v},[I(`span`,ab,`Reserve at `+T(t(u.value.wait)),1)],46,ib)],34),I(`p`,ob,[o.value.enabled?(N(),P(M,{key:0},[a[9]||=R(`Compacts in the background at `,-1),I(`strong`,null,T(t(u.value.auto??u.value.wait)),1),a[10]||=R(` and waits at `,-1),I(`strong`,null,T(t(u.value.wait)),1),a[11]||=R(`.`,-1)],64)):(N(),P(M,{key:1},[R(`Automatic compaction is off.`)],64))])],64)):(N(),P(`div`,Qy,`Pick a model to see its context window.`))]),(N(),F(fr,{to:`body`},[c.value?(N(),P(`div`,{key:0,class:`modal-backdrop`,onClick:js(l,[`self`])},[I(`section`,sb,[I(`header`,null,[a[12]||=I(`h2`,{id:`compaction-title`},`Context compaction`,-1),I(`button`,{class:`icon-button`,"aria-label":`Close context compaction`,onClick:l},[L(k(Jc),{size:18})])]),I(`p`,null,[a[13]||=R(` A summary starts in the background at `,-1),I(`strong`,null,T(t(u.value.auto??u.value.wait)),1),a[14]||=R(`. Above `,-1),I(`strong`,null,T(t(u.value.wait)),1),R(` the next request waits for it, keeping `+T(t(n.value-u.value.wait))+` free for the answer. Drag a marker on the bar to change either point. `,1)]),a[16]||=I(`p`,null,[R(`Older entries stay stored, and `),I(`code`,null,`search_history`),R(` still finds them.`)],-1),I(`label`,cb,[I(`input`,{type:`checkbox`,checked:o.value.enabled,onChange:a[5]||=e=>_({enabled:e.target.checked})},null,40,lb),a[15]||=R(` Automatic compaction `,-1)]),a[17]||=I(`p`,{class:`hint`},[R(` Applies to every agent in this session. `),I(`code`,null,`/compact`),R(` works either way. `)],-1),I(`footer`,null,[I(`button`,{class:`secondary`,onClick:l},`Close`)])])])):z(``,!0)]))],64))}}),mb=/^[A-Za-z_$][\w$]*$/,hb=e=>` `.repeat(e);function gb(e,t){let n=[],r=(e,t=`text`)=>n.push({text:e,kind:t});return r(`function`,`keyword`),r(` `),r(e,`function`),r(`(`,`punct`),r(`args`),r(`: `,`punct`),_b(t,0,r),r(`): `,`punct`),r(`Promise`,`type`),r(`<`,`punct`),r(`ToolResult`,`type`),r(`>;`,`punct`),n}function _b(e,t,n){if(!e||typeof e!=`object`)return n(`unknown`,`type`);if(`const`in e)return bb(e.const,n);if(e.enum)return yb(e.enum.map(e=>({const:e})),t,n);if(e.anyOf??e.oneOf)return yb(e.anyOf??e.oneOf,t,n);if(Array.isArray(e.type))return yb(e.type.map(t=>({...e,type:t})),t,n);switch(e.type){case`string`:case`boolean`:case`null`:return n(e.type,`type`);case`number`:case`integer`:return n(`number`,`type`);case`array`:{let r=!!(e.items?.anyOf??e.items?.oneOf??e.items?.enum);return r&&n(`(`,`punct`),_b(e.items,t,n),r&&n(`)`,`punct`),n(`[]`,`punct`)}case`object`:return vb(e,t,n);default:return n(`unknown`,`type`)}}function vb(e,t,n){let r=Object.entries(e.properties??{});if(!r.length)return e.additionalProperties&&typeof e.additionalProperties==`object`?(n(`Record`,`type`),n(`<`,`punct`),n(`string`,`type`),n(`, `,`punct`),_b(e.additionalProperties,t,n),n(`>`,`punct`)):n(`{}`,`punct`);let i=new Set(e.required??[]);n(`{`,`punct`),n(`
79
- `);for(let[e,a]of r){let r=xb(a);r&&n(`${hb(t+1)}${r}\n`,`comment`),n(hb(t+1)),n(mb.test(e)?e:JSON.stringify(e),`property`),n(i.has(e)?`: `:`?: `,`punct`),_b(a,t+1,n),n(`;`,`punct`),n(`
80
- `)}n(hb(t)),n(`}`,`punct`)}function yb(e,t,n){e.forEach((e,r)=>{r&&n(` | `,`punct`),_b(e,t,n)})}function bb(e,t){if(typeof e==`string`)return t(JSON.stringify(e),`string`);if(typeof e==`number`)return t(String(e),`number`);t(String(e),`type`)}function xb(e){let t=[e.description,e.minimum===void 0?``:`@minimum ${e.minimum}`,e.maximum===void 0?``:`@maximum ${e.maximum}`,e.default===void 0?``:`@default ${JSON.stringify(e.default)}`].filter(Boolean);return t.length?`/** ${t.join(` `)} */`:``}var Sb={key:0,class:`panel-rail`,"aria-label":`Inspector (collapsed)`},Cb=[`title`],wb=[`aria-label`,`title`,`onClick`],Tb={key:0,class:`count`},Eb={class:`inspector-tabs`,role:`tablist`,"aria-label":`Session details`},Db=[`id`,`aria-selected`,`onClick`],Ob={key:0,class:`count`},kb=[`title`],Ab=[`aria-labelledby`],jb={class:`session-heading`},Mb=[`title`],Nb={class:`cwd-trail`,dir:`rtl`},Pb={dir:`ltr`},Fb={class:`session-status`},Ib={key:0,class:`background-pill`},Lb=[`title`],Rb={class:`model-section`},zb=[`src`],Bb={class:`thinking-row`},Vb=[`value`],Hb={class:`stats-section`,"aria-labelledby":`stats-title`},Ub={class:`metrics`},Wb=[`title`],Gb={class:`usage-breakdown`,"aria-label":`Agent token and cost breakdown`},Kb={scope:`row`},qb={class:`panel-heading`},Jb={class:`hint app-state-description`},Yb=[`disabled`],Xb={class:`state-json-actions`},Zb={key:0,class:`hint`},Qb=[`disabled`],$b=[`disabled`],ex={key:0,class:`message-error`,role:`alert`},tx={class:`panel-heading`},nx={class:`tag`},rx={class:`hook-card`},ix=[`aria-checked`],ax={key:0,class:`tag tool-disabled`},ox={class:`tag`},sx=[`aria-label`],cx=A({__name:`Inspector`,setup(e){let t=B(()=>new Map(Ou.value?.tools.map(e=>[e.name,gb(e.name,e.parameters)]))),n=[{id:`session`,label:`Session`,icon:cc},{id:`git`,label:`Git`,icon:uc},{id:`state`,label:`State`,icon:Js},{id:`tasks`,label:`Tasks`,icon:Us},{id:`tools`,label:`Tools`,icon:qc},{id:`extensions`,label:`Extend`,icon:Pc}],r=B(()=>[{label:`Input`,tokens:Eu.value.input,cost:Eu.value.inputCost},{label:`Output`,tokens:Eu.value.output,cost:Eu.value.outputCost},{label:`Cache read`,tokens:Eu.value.cacheRead,cost:Eu.value.cacheReadCost},{label:`Cache write`,tokens:Eu.value.cacheWrite,cost:Eu.value.cacheWriteCost}]),i=B(()=>wu.value.filter(e=>e.background).length);function a(e,t){Mu(async()=>{await du.value.configure(e),await Au(),t&&W(t)})}function o(){let e=fu.value;e&&(U.dialog={kind:`prompt`,title:`Rename session`,label:`Session name`,value:lu.value?.name??``,submit:`Save name`,run:t=>e.rename(t)})}let s=cu.sharedState,c=O(``),l=O(``),u=O(0),d=O(!1),f=O(``),p=B(()=>c.value!==l.value),m=B(()=>p.value&&s.value?.revision!==u.value);function h(){c.value=Fu(s.value?.value??{}),l.value=c.value,u.value=s.value?.revision??0,f.value=``}Zn(s,()=>!p.value&&h(),{immediate:!0});async function g(e){if(!d.value&&du.value){d.value=!0,f.value=``;try{await du.value.demo(`state`,e)}catch(e){f.value=zl(e)}finally{d.value=!1}}}async function _(){if(!d.value&&du.value){f.value=``,d.value=!0;try{let e=JSON.parse(c.value);if(!e||Array.isArray(e)||typeof e!=`object`)throw Error(`App State must be a JSON object.`);let t=await du.value.demo(`state`,{operation:`update`,path:``,value:e,expectedRevision:u.value});c.value=Fu(t.value),l.value=c.value,u.value=t.revision,W(`Shared App State saved.`)}catch(e){f.value=zl(e)}finally{d.value=!1}}}let v=B(()=>Ou.value?.config.readOnly===!0),y=B(()=>Ou.value?.tools.filter(e=>e.offered).length??0);return(e,l)=>(N(),P(`aside`,{class:C([`inspector`,{collapsed:!k(Hu),overlay:k(U).inspectorOverlay}])},[k(Hu)?(N(),P(M,{key:1},[I(`div`,Eb,[(N(),P(M,null,j(n,e=>I(`button`,{id:`inspector-tab-${e.id}`,key:e.id,role:`tab`,"aria-controls":`inspector-panel`,"aria-selected":k(U).tab===e.id,class:C({active:k(U).tab===e.id}),onClick:t=>k(U).tab=e.id},[(N(),F(ni(e.icon),{size:18})),R(T(e.label),1),e.id===`tasks`&&k(wu).length?(N(),P(`span`,Ob,T(k(wu).length),1)):z(``,!0)],10,Db)),64)),I(`button`,{class:`icon-button panel-toggle`,"aria-label":`Collapse inspector`,title:`Collapse inspector (${k(Ju).inspector})`,onClick:l[1]||=e=>k(Wu)()},[L(k(Dc),{size:18})],8,kb)]),I(`div`,{id:`inspector-panel`,class:C([`inspector-body`,{"session-panel":k(U).tab===`session`}]),role:`tabpanel`,"aria-labelledby":`inspector-tab-${k(U).tab}`},[k(U).tab===`session`?(N(),P(M,{key:0},[I(`section`,jb,[I(`h1`,null,[I(`span`,null,T(k(lu)?.name??`Loading session`),1),I(`button`,{class:`icon-button`,title:`Rename session`,"aria-label":`Rename session`,onClick:o},[L(k(jc),{size:18})])]),I(`button`,{class:`path cwd-button`,title:k(lu)?.cwd,"aria-label":`Show full working directory`,onClick:l[2]||=e=>k(U).dialog={kind:`path`,path:k(lu)?.cwd??``}},[L(k(cc),{size:18}),I(`span`,Nb,[I(`bdi`,Pb,T(k(lu)?.cwd),1)])],8,Mb),I(`div`,Fb,[I(`span`,{class:C([`status-pill`,{working:k(Tu)}])},[l[7]||=I(`i`,null,null,-1),R(T(k(Tu)?`Working`:`Idle`),1)],2),i.value?(N(),P(`span`,Ib,T(i.value)+` background`,1)):z(``,!0),I(`span`,{class:`saved`,title:k(iu)?.id},[L(k(Lc),{size:18}),R(T(k(iu)?.name??k(iu)?.id),1)],8,Lb),k(iu)?(N(),F(xv,{key:1,device:k(iu)},null,8,[`device`])):z(``,!0)])]),k(iu)?(N(),F(Rv,{key:0,device:k(iu)},null,8,[`device`])):z(``,!0),I(`section`,Rb,[l[14]||=I(`div`,{class:`section-label`},[I(`span`,null,`AGENT`)],-1),I(`button`,{class:`model-button`,onClick:l[3]||=e=>k(U).dialog={kind:`models`}},[I(`img`,{src:k(Iu)(k(xu).agent.model?.modelId),alt:``},null,8,zb),I(`div`,null,[I(`strong`,null,T(k(Du)?.name??k(xu).agent.model?.modelId??`Loading…`),1),I(`small`,null,T(k(Du)?.tier??``)+` / `+T(k(xu).agent.model?.provider??``),1)]),L(k(Zs),{size:18})]),I(`div`,Bb,[l[8]||=I(`span`,null,`Thinking`,-1),I(`select`,{"aria-label":`Thinking level`,value:k(xu).agent.thinkingLevel??`low`,onChange:l[4]||=e=>a({thinkingLevel:e.target.value},`Thinking ${e.target.value}. Used on the next turn.`)},[(N(!0),P(M,null,j(k(qg),e=>(N(),P(`option`,{key:e},T(e),1))),128))],40,Vb)]),L(pb),I(`section`,Hb,[l[13]||=I(`div`,{class:`section-label`},[I(`span`,{id:`stats-title`},`STATS`)],-1),I(`div`,Ub,[I(`div`,{title:`${k(Eu).tokens.toLocaleString(`en-US`)} total tokens`},[I(`span`,null,T(k(Pu)(k(Eu).tokens)),1),l[9]||=I(`small`,null,`total tokens`,-1)],8,Wb),I(`div`,null,[I(`span`,null,`$`+T(k(Eu).cost.toFixed(4)),1),l[10]||=I(`small`,null,`agent cost`,-1)]),I(`div`,null,[I(`span`,null,T(k(Ou)?.tools.length??0),1),l[11]||=I(`small`,null,`tools`,-1)])]),I(`table`,Gb,[l[12]||=I(`thead`,null,[I(`tr`,null,[I(`th`,{scope:`col`},`Type`),I(`th`,{scope:`col`},`Tokens`),I(`th`,{scope:`col`},`Cost (USD)`)])],-1),I(`tbody`,null,[(N(!0),P(M,null,j(r.value,e=>(N(),P(`tr`,{key:e.label},[I(`th`,Kb,T(e.label),1),I(`td`,null,T(e.tokens.toLocaleString(`en-US`)),1),I(`td`,null,`$`+T(e.cost.toFixed(4)),1)]))),128))])])])])],64)):z(``,!0),k(U).tab===`state`?(N(),P(M,{key:1},[I(`div`,qb,[l[15]||=I(`h2`,null,`App State`,-1),L(k(Js),{size:18})]),I(`p`,Jb,` One shared JSON object for every agent, session and fork on `+T(k(iu)?.name??k(iu)?.id)+`. You and your agents can read, create, update or delete values and fields. Changes appear live and persist across closed browsers, interrupted agents and backend restarts. `,1),Wn(I(`textarea`,{"onUpdate:modelValue":l[5]||=e=>c.value=e,class:`app-state-json`,"aria-label":`App State JSON`,spellcheck:`false`,disabled:d.value||!k(s),rows:`12`},null,8,Yb),[[xs,c.value]]),I(`div`,Xb,[m.value?(N(),P(`span`,Zb,`State changed elsewhere. Load the latest JSON before saving.`)):z(``,!0),p.value?(N(),P(`button`,{key:1,class:`secondary`,disabled:d.value,onClick:h},T(m.value?`Load latest`:`Reset`),9,Qb)):z(``,!0),I(`button`,{class:`primary small`,disabled:!p.value||d.value||m.value,onClick:_},T(d.value?`Saving…`:`Save JSON`),9,$b)]),f.value?(N(),P(`p`,ex,T(f.value),1)):z(``,!0),L(hv,{value:k(s)?.value??{},disabled:d.value||p.value||!k(s),onChange:g},null,8,[`value`,`disabled`])],64)):z(``,!0),k(U).tab===`tasks`?(N(),F(hy,{key:2})):z(``,!0),k(U).tab===`git`?(N(),F(Vy,{key:3})):z(``,!0),k(U).tab===`extensions`?(N(),F(Yy,{key:4})):z(``,!0),k(U).tab===`tools`?(N(),P(M,{key:5},[I(`div`,tx,[l[16]||=I(`h2`,null,`Tools`,-1),I(`span`,nx,T(y.value)+` / `+T(k(Ou)?.tools.length??0),1)]),l[20]||=I(`p`,{class:`hint`},` Every tool this agent's extensions provide. Open one to see its definition. `,-1),I(`div`,rx,[I(`div`,null,[L(k(zc),{size:18}),l[18]||=I(`strong`,null,`Read only`,-1),I(`button`,{class:C([`switch`,{on:v.value}]),role:`switch`,"aria-checked":v.value,"aria-label":`Read only`,onClick:l[6]||=e=>a({readOnly:!v.value},v.value?`Read only off. Every tool is back.`:`Read only on. Tools that write are disabled.`)},[...l[17]||=[I(`span`,null,null,-1)]],10,ix)]),l[19]||=I(`p`,null,` Offers this agent only tools that read. Tools that create, update or delete leave its next request, and the choice is stored with the agent. `,-1)]),(N(!0),P(M,null,j(k(Ou)?.tools,e=>(N(),P(`details`,{key:e.name,class:C([`tool-row`,{disabled:!e.offered}])},[I(`summary`,null,[L(k(qc),{size:18}),I(`strong`,null,T(e.name),1),e.offered?z(``,!0):(N(),P(`span`,ax,`disabled`)),I(`span`,ox,T(e.replay===`safe`?`replay safe`:`interrupt on crash`),1)]),I(`p`,null,T(e.description),1),e.parameters?(N(),P(`pre`,{key:0,class:`tool-signature`,"aria-label":`${e.name} TypeScript definition`},[I(`code`,null,[(N(!0),P(M,null,j(t.value.get(e.name),(e,t)=>(N(),P(`span`,{key:t,class:C(`tk-${e.kind}`)},T(e.text),3))),128))])],8,sx)):z(``,!0),I(`small`,null,T(e.replay===`safe`?`An interrupted execution may run again after recovery.`:`A crash records an interrupted result instead of rerunning this effect.`),1)],2))),128))],64)):z(``,!0)],10,Ab)],64)):(N(),P(`div`,Sb,[I(`button`,{class:`icon-button panel-toggle`,"aria-label":`Expand inspector`,title:`Expand inspector (${k(Ju).inspector})`,onClick:l[0]||=e=>k(Uu)()},[L(k(Oc),{size:18})],8,Cb),(N(),P(M,null,j(n,e=>I(`button`,{key:e.id,class:C([`rail-tab`,{active:k(U).tab===e.id}]),"aria-label":`Open ${e.label}`,title:e.label,onClick:t=>k(Uu)(e.id)},[(N(),F(ni(e.icon),{size:20})),e.id===`tasks`&&k(wu).length?(N(),P(`span`,Tb,T(k(wu).length),1)):z(``,!0)],10,wb)),64))]))],2))}}),lx={class:`chat-empty`},ux={class:`eyebrow`},dx={key:3,class:`hint offline-error`},fx={key:4,class:`offline-command`},px={key:5,class:`hint`},mx={key:6,class:`hint`},hx={class:`offline-actions`},gx=[`disabled`],_x={key:7,class:`message-error`,role:`alert`},vx=A({__name:`OfflinePanel`,props:{device:{}},setup(e){let t=e,n=O(!1),r=O(``),i=B(()=>{let e=t.device,n=e.source===`config`;switch(e.status){case`checking`:return{title:`Checking ${e.id}…`,text:`Probing the device. This view fills in as soon as it answers.`};case`unauthorized`:return e.transport===`tunnel`?{title:`${e.id} tunnel credentials are not valid`,text:`Pair the device again — the hub will mint a fresh credential.`}:{title:e.hasToken?`${e.id} rejected its token`:`No token for ${e.id}`,text:e.hasToken?`The device's DPI_TOKEN changed (a rotate or a rebuilt device). Copy the current token into this hub's registry, then check again.`:`This hub has no token for the device yet. Register it, then check again.`,command:n&&e.kind!==`url`?`just net register ${e.id}`:`just net register ${e.id} --token <token>`};case`mismatch`:return{title:`${e.id} answers as a different device`,text:`The URL now reaches a backend with another identity (a rebuilt VM or a new data directory). If that is expected, register it again: that trusts the identity it answers with now.`,command:e.kind===`url`?`just net register ${e.id} --token <token>`:`just net register ${e.id}`};case`incompatible`:return{title:`${e.id} speaks another API version`,text:`Update the device's dpi-backend.`,command:n?`just net deploy ${e.id}`:void 0};default:return{title:`${e.id} is offline`,text:`Last seen ${Lu(e.lastSeenAt)}. Its agents keep their state on the device and resume when its backend starts again. The tree shows the last known sessions.`,command:n?e.kind===`local`?`just backend run`:e.kind===`url`?void 0:`just net restart ${e.id}`:void 0,alt:n&&e.kind!==`local`&&e.kind!==`url`?`just net up ${e.id}`:void 0}}});async function a(){n.value=!0,r.value=``;try{let e=await Rl.check(t.device.id);e.status===`online`&&W(`${e.id} is online.`)}catch(e){r.value=zl(e)}finally{n.value=!1}}async function o(e){try{await navigator.clipboard.writeText(e),W(`Copied.`)}catch{W(`Clipboard needs localhost or HTTPS. Select the text to copy.`)}}return(t,s)=>(N(),P(`section`,{class:C([`chat-panel offline-panel`,e.device.status]),"aria-live":`polite`},[I(`div`,lx,[e.device.status===`checking`?(N(),F(k(xc),{key:0,class:`spin`,size:30})):e.device.status===`mismatch`||e.device.status===`unauthorized`?(N(),F(k(Rc),{key:1,size:30})):(N(),F(k(Wc),{key:2,size:30})),I(`span`,ux,T(e.device.kind.toUpperCase())+` · `+T(e.device.url??(e.device.transport===`tunnel`?`tunnel`:`no endpoint`)),1),I(`h2`,null,T(i.value.title),1),I(`p`,null,T(i.value.text),1),e.device.error?(N(),P(`p`,dx,T(e.device.error),1)):z(``,!0),i.value.command?(N(),P(`div`,fx,[I(`code`,null,T(i.value.command),1),I(`button`,{class:`icon-button`,"aria-label":`Copy command`,onClick:s[0]||=e=>o(i.value.command)},[L(k(nc),{size:18})])])):z(``,!0),i.value.command?(N(),P(`p`,px,`Run it in this repo's terminal, then press Check now.`)):z(``,!0),i.value.alt?(N(),P(`p`,mx,[s[2]||=R(` Never deployed or rebuilt? `,-1),I(`code`,null,T(i.value.alt),1),s[3]||=R(` provisions it from scratch. `,-1)])):z(``,!0),I(`div`,hx,[I(`button`,{class:`secondary`,disabled:n.value,onClick:s[1]||=e=>a()},[L(k(Fc),{size:18}),R(T(n.value?`Checking…`:`Check now`),1)],8,gx)]),r.value?(N(),P(`p`,_x,T(r.value),1)):z(``,!0)])],2))}}),yx={class:`dir-browser`},bx={class:`dir-path`},xx=[`disabled`],Sx=[`aria-busy`],Cx=[`title`],wx=[`aria-selected`,`title`,`onClick`],Tx={key:1,class:`hint`},Ex={key:0,class:`message-error`,role:`alert`},Dx=A({__name:`DirBrowser`,props:ui({deviceId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=ji(e,`modelValue`),r=O(),i=O(!1),a=O(``),o=0;async function s(e){let s=++o,c=t.deviceId;i.value=!0,a.value=``;try{let t=await Il(c).dirs(e);return s===o?(r.value=t,t.path&&(n.value=t.path),t):void 0}catch(e){s===o&&(a.value=zl(e));return}finally{s===o&&(i.value=!1)}}return Zn(()=>t.deviceId,async()=>{r.value=void 0;let e=await s(``),t=e?.dirs[0];t&&!e.path&&await s(t.path)},{immediate:!0}),(e,t)=>(N(),P(`div`,yx,[I(`div`,bx,[Wn(I(`input`,{"onUpdate:modelValue":t[0]||=e=>n.value=e,"aria-label":`Working directory`,required:``,placeholder:`/path/to/project`,spellcheck:`false`,autocomplete:`off`,onKeydown:t[1]||=Ns(js(e=>s(n.value),[`prevent`]),[`enter`])},null,544),[[xs,n.value]]),I(`button`,{type:`button`,class:`secondary small`,disabled:i.value||!n.value,onClick:t[2]||=e=>s(n.value)},` Go `,8,xx)]),I(`div`,{class:`dir-list`,role:`listbox`,"aria-label":`Directories`,"aria-busy":i.value},[I(`button`,{type:`button`,class:`dir-item`,title:`Start directories`,onClick:t[3]||=e=>s(``)},[L(k(pc),{size:16}),t[5]||=I(`span`,null,`Start dirs`,-1)]),r.value?.parent?(N(),P(`button`,{key:0,type:`button`,class:`dir-item`,title:r.value.parent,onClick:t[4]||=e=>s(r.value.parent)},[L(k(ic),{size:16}),t[6]||=I(`span`,null,`..`,-1)],8,Cx)):z(``,!0),(N(!0),P(M,null,j(r.value?.dirs,e=>(N(),P(`button`,{key:e.path,type:`button`,class:`dir-item`,role:`option`,"aria-selected":e.path===n.value,title:e.path,onClick:t=>s(e.path)},[e.path===n.value?(N(),F(k(cc),{key:0,size:16})):(N(),F(k(lc),{key:1,size:16})),I(`span`,null,T(e.name),1)],8,wx))),128)),r.value&&!r.value.dirs.length?(N(),P(`p`,Tx,`No subdirectories.`)):z(``,!0)],8,Sx),a.value?(N(),P(`p`,Ex,T(a.value),1)):z(``,!0)]))}}),Ox={key:0,class:`message-error`},kx=[`value`],Ax={class:`field`},jx={key:0,class:`hint`,title:`The device has no provider key — it lists its built-in catalog, and chat needs OPENROUTER_API_KEY set in the device's env file`},Mx=[`value`],Nx={key:2,class:`message-error`,role:`alert`},Px=[`disabled`],Fx=A({__name:`NewSessionDialog`,props:{deviceId:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=B(()=>Zl.devices.value.filter(e=>e.status===`online`)),a=O(i.value.find(e=>e.id===n.deviceId)?.id??i.value[0]?.id??``),o=B(()=>i.value.find(e=>e.id===a.value)),s=B(()=>{let e=o.value?.info?.models??[];if(e.length)return e;let t=o.value?.info;return t?.defaultModel&&t.provider?[{id:t.defaultModel,provider:t.provider,name:`${t.defaultModel} (device default)`,tier:`—`,icon:`lab.png`,contextWindow:0,reasoning:!1,cost:{input:0,output:0}}]:[]}),c=B(()=>!s.value.length||(o.value?.info?.models?.length??0)===0),l=B(()=>!!o.value?.info?.providerKeyMissing),u=e=>`${e.provider}/${e.id}`,d=O({name:``,cwd:``,model:``}),f=O(!1),p=O(``);Zn(o,e=>{let t=s.value,n=t.find(t=>t.id===e?.info?.defaultModel)??t[0];d.value.model=n?u(n):``,d.value.cwd=``},{immediate:!0});async function m(){if(!f.value&&o.value){f.value=!0,p.value=``;try{let e=s.value.find(e=>u(e)===d.value.model)??s.value[0];if(!e)throw Error(`Choose a model`);let t=await Il(o.value.id).createSession({name:d.value.name.trim()||`New session`,cwd:d.value.cwd.trim(),model:{provider:e.provider,modelId:e.id}}),n=t.agents.find(e=>e.kind===`root`)??t.agents[0];pu({deviceId:o.value.id,sessionId:t.id,agentId:n?.id??1}),W(`Session created on ${o.value.id}.`),r(`close`)}catch(e){p.value=zl(e)}finally{f.value=!1}}}return(e,t)=>(N(),P(`div`,{class:`modal-backdrop`,onClick:t[6]||=js(e=>r(`close`),[`self`])},[I(`form`,{class:`modal session-modal`,onSubmit:js(m,[`prevent`])},[I(`header`,null,[t[7]||=I(`div`,null,[I(`span`,{class:`eyebrow`},`A PERSISTENT WORKSPACE`),I(`h2`,null,`New session`)],-1),I(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close new session`,onClick:t[0]||=e=>r(`close`)},[L(k(Jc),{size:18})])]),i.value.length?(N(),P(M,{key:1},[I(`label`,null,[t[8]||=R(`Device`,-1),Wn(I(`select`,{"onUpdate:modelValue":t[1]||=e=>a.value=e,"aria-label":`Device`},[(N(!0),P(M,null,j(i.value,e=>(N(),P(`option`,{key:e.id,value:e.id},T(e.name)+T(e.info?.hostname&&e.info.hostname!==e.name?` · ${e.info.hostname}`:``),9,kx))),128))],512),[[ws,a.value]])]),I(`label`,null,[t[9]||=R(`Session name`,-1),Wn(I(`input`,{"onUpdate:modelValue":t[2]||=e=>d.value.name=e,autofocus:``,placeholder:`My durable agent`,maxlength:`100`},null,512),[[xs,d.value.name]])]),I(`div`,Ax,[I(`span`,null,`Working directory on `+T(i.value.find(e=>e.id===a.value)?.name??a.value),1),L(Dx,{modelValue:d.value.cwd,"onUpdate:modelValue":t[3]||=e=>d.value.cwd=e,"device-id":a.value},null,8,[`modelValue`,`device-id`])]),I(`label`,null,[t[10]||=R(`Model`,-1),c.value||l.value?(N(),P(`span`,jx,`no API key on device — chat needs one`)):z(``,!0),Wn(I(`select`,{"onUpdate:modelValue":t[4]||=e=>d.value.model=e,"aria-label":`New session model`},[(N(!0),P(M,null,j(s.value,e=>(N(),P(`option`,{key:u(e),value:u(e)},T(e.tier)+` / `+T(e.name),9,Mx))),128))],512),[[ws,d.value.model]])])],64)):(N(),P(`p`,Ox,` No device is online. Start one with just backend run or just net up <id>, then try again. `)),p.value?(N(),P(`p`,Nx,T(p.value),1)):z(``,!0),I(`footer`,null,[I(`button`,{type:`button`,class:`secondary`,onClick:t[5]||=e=>r(`close`)},`Cancel`),I(`button`,{class:`primary`,disabled:f.value||!d.value.model||!d.value.cwd||!o.value},[L(k(Nc),{size:18}),R(T(f.value?`Creating…`:`Create session`),1)],8,Px)])],32)]))}}),Ix=new Uint8Array(512),Lx=new Uint8Array(256);(()=>{let e=1;for(let t=0;t<255;t++)Ix[t]=e,Lx[e]=t,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)Ix[e]=Ix[e-255]})();var Rx=(e,t)=>e===0||t===0?0:Ix[Lx[e]+Lx[t]];function zx(e){let t=[1];for(let n=0;n<e;n++){let e=Array(t.length+1).fill(0);for(let r=0;r<t.length;r++)e[r]^=t[r],e[r+1]^=Rx(t[r],Ix[n]);t=e}return t}function Bx(e,t){let n=zx(t),r=Array(t).fill(0);for(let i of e){let e=i^r[0];r.shift(),r.push(0);for(let i=0;i<t;i++)r[i]^=Rx(n[i+1],e)}return r}var Vx=[21,25,29,33,37,41,45,49,53,57,61,65],Hx=[19,34,55,80,108,136,156,194,232,274,324,370],Ux=[7,10,15,20,26,36,40,48,60,72,80,96],Wx=[7,10,15,20,26,18,20,24,30,18,20,24],Gx=[[[1,19]],[[1,34]],[[1,55]],[[1,80]],[[1,108]],[[2,68]],[[2,78]],[[2,97]],[[2,116]],[[2,68],[2,69]],[[4,81]],[[2,92],[2,93]]],Kx=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58]],qx=e=>e<=9?8:16;function Jx(e){for(let t=1;t<=Vx.length;t++)if(4+qx(t)+e*8<=Hx[t-1]*8)return t;throw Error(`qr: payload too long (${e} bytes; v12L max ${Hx[11]-3})`)}function Yx(e,t){let n=[...new TextEncoder().encode(e)],r=[],i=(e,t)=>{for(let n=t-1;n>=0;n--)r.push(e>>n&1)};i(4,4),i(n.length,qx(t));for(let e of n)i(e,8);let a=Hx[t-1],o=a*8;for(i(0,Math.min(4,o-r.length));r.length%8!=0;)r.push(0);let s=[236,17],c=0;for(;r.length<o;)i(s[c++%2],8);let l=[];for(let e=0;e<a;e++){let t=0;for(let n=0;n<8;n++)t=t<<1|r[e*8+n];l.push(t)}return l}function Xx(e,t){let n=Wx[e-1],r=[],i=0;for(let[n,a]of Gx[e-1])for(let e=0;e<n;e++)r.push(t.slice(i,i+=a));let a=[],o=Math.max(...r.map(e=>e.length));for(let e=0;e<o;e++)for(let t of r)e<t.length&&a.push(t[e]);let s=r.map(e=>Bx(e,n));for(let e=0;e<n;e++)for(let t of s)a.push(t[e]);return a}function Zx(e){return Array.from({length:e},()=>Array(e).fill(!1))}function Qx(e,t){let n=Vx[t-1],r=(t,r)=>{for(let i=-1;i<=7;i++)for(let a=-1;a<=7;a++){let o=t+i,s=r+a;if(o<0||o>=n||s<0||s>=n)continue;let c=i>=0&&i<=6&&a>=0&&a<=6&&(i===0||i===6||a===0||a===6),l=i>=2&&i<=4&&a>=2&&a<=4;e[o][s]=c||l}};r(0,0),r(0,n-7),r(n-7,0);for(let t=8;t<n-8;t++)e[6][t]=t%2==0,e[t][6]=t%2==0;let i=Kx[t-1];for(let t of i)for(let r of i)if(!(t<=8&&r<=8||t<=8&&r>=n-9||t>=n-9&&r<=8))for(let n=-2;n<=2;n++)for(let i=-2;i<=2;i++)e[t+n][r+i]=Math.max(Math.abs(n),Math.abs(i))!==1;if(e[n-8][8]=!0,t>=7){let r=t<<12;for(let e=17;e>=12;e--)r>>e&1&&(r^=7973<<e-12);let i=t<<12|r&4095;for(let t=0;t<18;t++){let r=(i>>t&1)==1,a=n-11+t%3,o=t/3|0;e[a][o]=r,e[o][a]=r}}}function $x(e){let t=8|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>9&1?1335:0);let r=(t<<10|n)^21522,i=[];for(let e=14;e>=0;e--)i.push((r>>e&1)==1);return i}function eS(e,t){let n=Vx[0]*0+e.length,r=$x(t);for(let t=0;t<=5;t++)e[8][t]=r[t];e[8][7]=r[6],e[8][8]=r[7],e[7][8]=r[8];for(let t=9;t<15;t++)e[14-t][8]=r[t];for(let t=0;t<7;t++)e[n-1-t][8]=r[t];e[8][n-8]=r[7];for(let t=8;t<15;t++)e[8][n-15+t]=r[t];e[n-8][8]=!0}function tS(e,t,n,r){let i=e.length;Vx[n-1]*Vx[n-1];let a=e=>((t[e>>3]??0)>>7-(e&7)&1)==1,o=0,s=!0;for(let t=i-1;t>0;t-=2){t===6&&t--;for(let c=0;c<i;c++){let l=s?i-1-c:c;for(let i of[t,t-1]){if(rS(l,i,n))continue;if(o>=(Hx[n-1]+Ux[n-1])*8){o++;continue}let t=a(o++);nS(l,i,r)&&(t=!t),e[l][i]=t}}s=!s}}function nS(e,t,n){switch(n){case 0:return(e+t)%2==0;case 1:return e%2==0;case 2:return t%3==0;case 3:return(e+t)%3==0;case 4:return(Math.floor(e/2)+Math.floor(t/3))%2==0;case 5:return e*t%2+e*t%3==0;case 6:return(e*t%2+e*t%3)%2==0;default:return((e+t)%2+e*t%3)%2==0}}function rS(e,t,n){let r=Vx[n-1];if(e<=8&&t<=8||e<=8&&t>=r-8||e>=r-8&&t<=8||e===6||t===6||n>=7&&(e>=r-11&&e<=r-9&&t<=5||t>=r-11&&t<=r-9&&e<=5))return!0;let i=Kx[n-1];for(let n of i)for(let a of i)if(!(n<=8&&a<=8||n<=8&&a>=r-9||n>=r-9&&a<=8)&&Math.abs(e-n)<=2&&Math.abs(t-a)<=2)return!0;return!1}function iS(e){let t=e.length,n=0;for(let r=0;r<2;r++)for(let i=0;i<t;i++){let a=1;for(let o=1;o<t;o++)(r===0?e[i][o]:e[o][i])===(r===0?e[i][o-1]:e[o-1][i])?(a++,o===t-1&&a>=5&&(n+=3+(a-5))):(a>=5&&(n+=3+(a-5)),a=1)}for(let r=0;r<t-1;r++)for(let i=0;i<t-1;i++){let t=e[r][i];e[r][i+1]===t&&e[r+1][i]===t&&e[r+1][i+1]===t&&(n+=3)}let r=[!0,!1,!0,!0,!0,!1,!0,!1,!1,!1,!1],i=(e,t)=>{for(let i=0;i+11<=t;i++){let t=!0;for(let n=0;n<11;n++)if(e(i+n)!==r[n]){t=!1;break}t&&(n+=40)}};for(let n=0;n<t;n++)i(t=>e[n][t],t);for(let n=0;n<t;n++)i(t=>e[t][n],t);let a=0;for(let t of e)for(let e of t)e&&a++;let o=a*100/(t*t);return n+=Math.floor(Math.abs(o-50)/5)*10,n}function aS(e,t){let n=Jx(new TextEncoder().encode(e).length),r=Vx[n-1],i=Xx(n,Yx(e,n)),a=Zx(r);return Qx(a,n),tS(a,i,n,t),eS(a,t),a}function oS(e,t){if(t!==void 0)return aS(e,t);let n;for(let t=0;t<8;t++){let r=aS(e,t),i=iS(r);(!n||i<n.score)&&(n={m:r,score:i})}return n.m}function sS(e,t=160){let n=oS(e),r=n.length,i=t/(r+8),a=``;for(let e=0;e<r;e++)for(let t=0;t<r;t++)n[e][t]&&(a+=`<rect x="${((t+4)*i).toFixed(2)}" y="${((e+4)*i).toFixed(2)}" width="${i.toFixed(3)}" height="${i.toFixed(3)}"/>`);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${t} ${t}" shape-rendering="crispEdges"><rect width="${t}" height="${t}" fill="#fff"/><g fill="#000">${a}</g></svg>`}var cS={class:`device-handoff`,"aria-label":`Pair this machine`},lS={class:`row`},uS=[`disabled`],dS=[`disabled`],fS={key:0,class:`target`,"data-testid":`device-url`},pS={key:1,class:`err`},mS=Wg(A({__name:`DeviceHandoff`,props:{offerFragment:{}},setup(e){let t=e,n=O(`4780`),r=O(!1),i=B(()=>{let e=/^\d{1,5}$/.test(n.value)?Number(n.value):0;if(!(!e||e<1||e>65535))return`http://127.0.0.1:${e}/pair#${t.offerFragment}`});function a(){let e=i.value;e&&window.open(e,`_blank`,`noopener`)}async function o(){let e=i.value;if(e)try{await navigator.clipboard.writeText(e),r.value=!0,setTimeout(()=>r.value=!1,1600)}catch{}}return(e,t)=>(N(),P(`section`,cS,[I(`header`,null,[L(k(wc),{size:18}),t[1]||=I(`h3`,null,`Pair THIS machine`,-1)]),t[4]||=I(`p`,{class:`what`},[R(` If this browser runs on the device itself, open its local pairing page — the offer is relayed inside the link, nothing is sent to the hub. Start `),I(`code`,null,`dpi device`),R(` there first. `)],-1),I(`div`,lS,[I(`label`,null,[t[2]||=R(` local port `,-1),Wn(I(`input`,{"onUpdate:modelValue":t[0]||=e=>n.value=e,inputmode:`numeric`,spellcheck:`false`,"aria-label":`Local dpi backend port`},null,512),[[xs,n.value]])]),I(`button`,{class:`primary`,type:`button`,disabled:!i.value,onClick:a},[L(k(oc),{size:15}),t[3]||=R(`Open the device page `,-1)],8,uS),I(`button`,{class:`secondary`,type:`button`,disabled:!i.value,onClick:o},[L(k(nc),{size:15}),R(T(r.value?`Copied`:`Copy link`),1)],8,dS)]),i.value?(N(),P(`p`,fS,T(i.value),1)):z(``,!0),i.value?z(``,!0):(N(),P(`p`,pS,`port must be 1–65535`))]))}}),[[`__scopeId`,`data-v-01884b7b`]]);function hS(e){return wS(e)&&!gS(e)&&!OS(e)&&Symbol.asyncIterator in e}function gS(e){return Array.isArray(e)}function _S(e){return typeof e==`bigint`}function vS(e){return typeof e==`boolean`}function yS(e){return e instanceof globalThis.Date}function bS(e){return typeof e==`function`}function xS(e){return wS(e)&&!gS(e)&&!OS(e)&&Symbol.iterator in e}function SS(e){return e===null}function CS(e){return typeof e==`number`}function wS(e){return typeof e==`object`&&!!e}function TS(e){return e instanceof globalThis.RegExp}function ES(e){return typeof e==`string`}function DS(e){return typeof e==`symbol`}function OS(e){return e instanceof globalThis.Uint8Array}function kS(e){return e===void 0}function AS(e){return e.map(e=>FS(e))}function jS(e){return new Date(e.getTime())}function MS(e){return new Uint8Array(e)}function NS(e){return new RegExp(e.source,e.flags)}function PS(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=FS(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=FS(e[n]);return t}function FS(e){return gS(e)?AS(e):yS(e)?jS(e):OS(e)?MS(e):TS(e)?NS(e):wS(e)?PS(e):e}function IS(e){return FS(e)}function LS(e,t){return IS(t===void 0?e:{...t,...e})}function RS(e){return typeof e==`object`&&!!e}function zS(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function BS(e){return e===void 0}function VS(e){return typeof e==`number`}var HS;(function(e){e.InstanceMode=`default`,e.ExactOptionalPropertyTypes=!1,e.AllowArrayObject=!1,e.AllowNaN=!1,e.AllowNullVoid=!1;function t(t,n){return e.ExactOptionalPropertyTypes?n in t:t[n]!==void 0}e.IsExactOptionalProperty=t;function n(t){let n=RS(t);return e.AllowArrayObject?n:n&&!zS(t)}e.IsObjectLike=n;function r(e){return n(e)&&!(e instanceof Date)&&!(e instanceof Uint8Array)}e.IsRecordLike=r;function i(t){return e.AllowNaN?VS(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=BS(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(HS||={});function US(e){return globalThis.Object.freeze(e).map(e=>JS(e))}function WS(e){return e}function GS(e){return e}function KS(e){return e}function qS(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=JS(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=JS(e[n]);return globalThis.Object.freeze(t)}function JS(e){return gS(e)?US(e):yS(e)?WS(e):OS(e)?GS(e):TS(e)?KS(e):wS(e)?qS(e):e}function J(e,t){let n=t===void 0?e:{...t,...e};switch(HS.InstanceMode){case`freeze`:return JS(n);case`clone`:return IS(n);default:return n}}var YS=class extends Error{constructor(e){super(e)}},XS=Symbol.for(`TypeBox.Transform`),ZS=Symbol.for(`TypeBox.Readonly`),QS=Symbol.for(`TypeBox.Optional`),$S=Symbol.for(`TypeBox.Hint`),Y=Symbol.for(`TypeBox.Kind`);function eC(e){return wS(e)&&e[ZS]===`Readonly`}function tC(e){return wS(e)&&e[QS]===`Optional`}function nC(e){return X(e,`Any`)}function rC(e){return X(e,`Argument`)}function iC(e){return X(e,`Array`)}function aC(e){return X(e,`AsyncIterator`)}function oC(e){return X(e,`BigInt`)}function sC(e){return X(e,`Boolean`)}function cC(e){return X(e,`Computed`)}function lC(e){return X(e,`Constructor`)}function uC(e){return X(e,`Date`)}function dC(e){return X(e,`Function`)}function fC(e){return X(e,`Integer`)}function pC(e){return X(e,`Intersect`)}function mC(e){return X(e,`Iterator`)}function X(e,t){return wS(e)&&Y in e&&e[Y]===t}function hC(e){return vS(e)||CS(e)||ES(e)}function gC(e){return X(e,`Literal`)}function _C(e){return X(e,`MappedKey`)}function vC(e){return X(e,`MappedResult`)}function yC(e){return X(e,`Never`)}function bC(e){return X(e,`Not`)}function xC(e){return X(e,`Null`)}function SC(e){return X(e,`Number`)}function CC(e){return X(e,`Object`)}function wC(e){return X(e,`Promise`)}function TC(e){return X(e,`Record`)}function EC(e){return X(e,`Ref`)}function DC(e){return X(e,`RegExp`)}function OC(e){return X(e,`String`)}function kC(e){return X(e,`Symbol`)}function AC(e){return X(e,`TemplateLiteral`)}function jC(e){return X(e,`This`)}function MC(e){return wS(e)&&XS in e}function NC(e){return X(e,`Tuple`)}function PC(e){return X(e,`Undefined`)}function FC(e){return X(e,`Union`)}function IC(e){return X(e,`Uint8Array`)}function LC(e){return X(e,`Unknown`)}function RC(e){return X(e,`Unsafe`)}function zC(e){return X(e,`Void`)}function BC(e){return wS(e)&&Y in e&&ES(e[Y])}function VC(e){return nC(e)||rC(e)||iC(e)||sC(e)||oC(e)||aC(e)||cC(e)||lC(e)||uC(e)||dC(e)||fC(e)||pC(e)||mC(e)||gC(e)||_C(e)||vC(e)||yC(e)||bC(e)||xC(e)||SC(e)||CC(e)||wC(e)||TC(e)||EC(e)||DC(e)||OC(e)||kC(e)||AC(e)||jC(e)||NC(e)||PC(e)||FC(e)||IC(e)||LC(e)||RC(e)||zC(e)||BC(e)}var HC=`Argument.Any.Array.AsyncIterator.BigInt.Boolean.Computed.Constructor.Date.Enum.Function.Integer.Intersect.Iterator.Literal.MappedKey.MappedResult.Not.Null.Number.Object.Promise.Record.Ref.RegExp.String.Symbol.TemplateLiteral.This.Tuple.Undefined.Union.Uint8Array.Unknown.Void`.split(`.`);function UC(e){try{return new RegExp(e),!0}catch{return!1}}function WC(e){if(!ES(e))return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n>=7&&n<=13||n===27||n===127)return!1}return!0}function GC(e){return JC(e)||Uw(e)}function KC(e){return kS(e)||_S(e)}function qC(e){return kS(e)||CS(e)}function JC(e){return kS(e)||vS(e)}function YC(e){return kS(e)||ES(e)}function XC(e){return kS(e)||ES(e)&&WC(e)&&UC(e)}function ZC(e){return kS(e)||ES(e)&&WC(e)}function QC(e){return kS(e)||Uw(e)}function $C(e){return wS(e)&&e[QS]===`Optional`}function ew(e){return Z(e,`Any`)&&YC(e.$id)}function tw(e){return Z(e,`Argument`)&&CS(e.index)}function nw(e){return Z(e,`Array`)&&e.type===`array`&&YC(e.$id)&&Uw(e.items)&&qC(e.minItems)&&qC(e.maxItems)&&JC(e.uniqueItems)&&QC(e.contains)&&qC(e.minContains)&&qC(e.maxContains)}function rw(e){return Z(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&YC(e.$id)&&Uw(e.items)}function iw(e){return Z(e,`BigInt`)&&e.type===`bigint`&&YC(e.$id)&&KC(e.exclusiveMaximum)&&KC(e.exclusiveMinimum)&&KC(e.maximum)&&KC(e.minimum)&&KC(e.multipleOf)}function aw(e){return Z(e,`Boolean`)&&e.type===`boolean`&&YC(e.$id)}function ow(e){return Z(e,`Computed`)&&ES(e.target)&&gS(e.parameters)&&e.parameters.every(e=>Uw(e))}function sw(e){return Z(e,`Constructor`)&&e.type===`Constructor`&&YC(e.$id)&&gS(e.parameters)&&e.parameters.every(e=>Uw(e))&&Uw(e.returns)}function cw(e){return Z(e,`Date`)&&e.type===`Date`&&YC(e.$id)&&qC(e.exclusiveMaximumTimestamp)&&qC(e.exclusiveMinimumTimestamp)&&qC(e.maximumTimestamp)&&qC(e.minimumTimestamp)&&qC(e.multipleOfTimestamp)}function lw(e){return Z(e,`Function`)&&e.type===`Function`&&YC(e.$id)&&gS(e.parameters)&&e.parameters.every(e=>Uw(e))&&Uw(e.returns)}function uw(e){return Z(e,`Integer`)&&e.type===`integer`&&YC(e.$id)&&qC(e.exclusiveMaximum)&&qC(e.exclusiveMinimum)&&qC(e.maximum)&&qC(e.minimum)&&qC(e.multipleOf)}function dw(e){return wS(e)&&Object.entries(e).every(([e,t])=>WC(e)&&Uw(t))}function fw(e){return Z(e,`Intersect`)&&!(ES(e.type)&&e.type!==`object`)&&gS(e.allOf)&&e.allOf.every(e=>Uw(e)&&!Pw(e))&&YC(e.type)&&(JC(e.unevaluatedProperties)||QC(e.unevaluatedProperties))&&YC(e.$id)}function pw(e){return Z(e,`Iterator`)&&e.type===`Iterator`&&YC(e.$id)&&Uw(e.items)}function Z(e,t){return wS(e)&&Y in e&&e[Y]===t}function mw(e){return _w(e)&&ES(e.const)}function hw(e){return _w(e)&&CS(e.const)}function gw(e){return _w(e)&&vS(e.const)}function _w(e){return Z(e,`Literal`)&&YC(e.$id)&&vw(e.const)}function vw(e){return vS(e)||CS(e)||ES(e)}function yw(e){return Z(e,`MappedKey`)&&gS(e.keys)&&e.keys.every(e=>CS(e)||ES(e))}function bw(e){return Z(e,`MappedResult`)&&dw(e.properties)}function xw(e){return Z(e,`Never`)&&wS(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function Sw(e){return Z(e,`Not`)&&Uw(e.not)}function Cw(e){return Z(e,`Null`)&&e.type===`null`&&YC(e.$id)}function ww(e){return Z(e,`Number`)&&e.type===`number`&&YC(e.$id)&&qC(e.exclusiveMaximum)&&qC(e.exclusiveMinimum)&&qC(e.maximum)&&qC(e.minimum)&&qC(e.multipleOf)}function Tw(e){return Z(e,`Object`)&&e.type===`object`&&YC(e.$id)&&dw(e.properties)&&GC(e.additionalProperties)&&qC(e.minProperties)&&qC(e.maxProperties)}function Ew(e){return Z(e,`Promise`)&&e.type===`Promise`&&YC(e.$id)&&Uw(e.item)}function Dw(e){return Z(e,`Record`)&&e.type===`object`&&YC(e.$id)&&GC(e.additionalProperties)&&wS(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&UC(t[0])&&wS(e.patternProperties)&&Uw(e.patternProperties[t[0]])})(e)}function Ow(e){return Z(e,`Ref`)&&YC(e.$id)&&ES(e.$ref)}function kw(e){return Z(e,`RegExp`)&&YC(e.$id)&&ES(e.source)&&ES(e.flags)&&qC(e.maxLength)&&qC(e.minLength)}function Aw(e){return Z(e,`String`)&&e.type===`string`&&YC(e.$id)&&qC(e.minLength)&&qC(e.maxLength)&&XC(e.pattern)&&ZC(e.format)}function jw(e){return Z(e,`Symbol`)&&e.type===`symbol`&&YC(e.$id)}function Mw(e){return Z(e,`TemplateLiteral`)&&e.type===`string`&&ES(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function Nw(e){return Z(e,`This`)&&YC(e.$id)&&ES(e.$ref)}function Pw(e){return wS(e)&&XS in e}function Fw(e){return Z(e,`Tuple`)&&e.type===`array`&&YC(e.$id)&&CS(e.minItems)&&CS(e.maxItems)&&e.minItems===e.maxItems&&(kS(e.items)&&kS(e.additionalItems)&&e.minItems===0||gS(e.items)&&e.items.every(e=>Uw(e)))}function Iw(e){return Z(e,`Undefined`)&&e.type===`undefined`&&YC(e.$id)}function Lw(e){return Z(e,`Union`)&&YC(e.$id)&&wS(e)&&gS(e.anyOf)&&e.anyOf.every(e=>Uw(e))}function Rw(e){return Z(e,`Uint8Array`)&&e.type===`Uint8Array`&&YC(e.$id)&&qC(e.minByteLength)&&qC(e.maxByteLength)}function zw(e){return Z(e,`Unknown`)&&YC(e.$id)}function Bw(e){return Z(e,`Unsafe`)}function Vw(e){return Z(e,`Void`)&&e.type===`void`&&YC(e.$id)}function Hw(e){return wS(e)&&Y in e&&ES(e[Y])&&!HC.includes(e[Y])}function Uw(e){return wS(e)&&(ew(e)||tw(e)||nw(e)||aw(e)||iw(e)||rw(e)||ow(e)||sw(e)||cw(e)||lw(e)||uw(e)||fw(e)||pw(e)||_w(e)||yw(e)||bw(e)||xw(e)||Sw(e)||Cw(e)||ww(e)||Tw(e)||Ew(e)||Dw(e)||Ow(e)||kw(e)||Aw(e)||jw(e)||Mw(e)||Nw(e)||Fw(e)||Iw(e)||Lw(e)||Rw(e)||zw(e)||Bw(e)||Vw(e)||Hw(e))}var Ww=`(true|false)`,Gw=`(0|[1-9][0-9]*)`,Kw=`(.*)`,qw=`(?!.*)`;`${Ww}`;var Jw=`^${Gw}$`,Yw=`^${Kw}$`,Xw=`^${qw}$`;function Zw(e,t){return e.includes(t)}function Qw(e){return[...new Set(e)]}function $w(e,t){return e.filter(e=>t.includes(e))}function eT(e,t){return e.reduce((e,t)=>$w(e,t),t)}function tT(e){return e.length===1?e[0]:e.length>1?eT(e.slice(1),e[0]):[]}function nT(e){let t=[];for(let n of e)t.push(...n);return t}function rT(e){return J({[Y]:`Any`},e)}function iT(e,t){return J({[Y]:`Array`,type:`array`,items:e},t)}function aT(e){return J({[Y]:`Argument`,index:e})}function oT(e,t){return J({[Y]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function sT(e,t,n){return J({[Y]:`Computed`,target:e,parameters:t},n)}function cT(e,t){let{[t]:n,...r}=e;return r}function lT(e,t){return t.reduce((e,t)=>cT(e,t),e)}function uT(e){return J({[Y]:`Never`,not:{}},e)}function dT(e){return J({[Y]:`MappedResult`,properties:e})}function fT(e,t,n){return J({[Y]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function pT(e,t,n){return J({[Y]:`Function`,type:`Function`,parameters:e,returns:t},n)}function mT(e,t){return J({[Y]:`Union`,anyOf:e},t)}function hT(e){return e.some(e=>tC(e))}function gT(e){return e.map(e=>tC(e)?_T(e):e)}function _T(e){return lT(e,[QS])}function vT(e,t){return hT(e)?iD(mT(gT(e),t)):mT(gT(e),t)}function yT(e,t){return e.length===1?J(e[0],t):e.length===0?uT(t):vT(e,t)}function bT(e,t){return e.length===0?uT(t):e.length===1?J(e[0],t):mT(e,t)}var xT=class extends YS{};function ST(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function CT(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function wT(e,t){return CT(e,t,`(`)}function TT(e,t){return CT(e,t,`)`)}function ET(e,t){return CT(e,t,`|`)}function DT(e){if(!(wT(e,0)&&TT(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(wT(e,n)&&(t+=1),TT(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function OT(e){return e.slice(1,e.length-1)}function kT(e){let t=0;for(let n=0;n<e.length;n++)if(wT(e,n)&&(t+=1),TT(e,n)&&--t,ET(e,n)&&t===0)return!0;return!1}function AT(e){for(let t=0;t<e.length;t++)if(wT(e,t))return!0;return!1}function jT(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(wT(e,i)&&(t+=1),TT(e,i)&&--t,ET(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(NT(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(NT(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function MT(e){function t(e,t){if(!wT(e,t))throw new xT(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(wT(e,r)&&(n+=1),TT(e,r)&&--n,n===0)return[t,r];throw new xT(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(wT(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(wT(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(NT(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(NT(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function NT(e){return DT(e)?NT(OT(e)):kT(e)?jT(e):AT(e)?MT(e):{type:`const`,const:ST(e)}}function PT(e){return NT(e.slice(1,e.length-1))}var FT=class extends YS{};function IT(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`0`&&e.expr[1].type===`const`&&e.expr[1].const===`[1-9][0-9]*`}function LT(e){return e.type===`or`&&e.expr.length===2&&e.expr[0].type===`const`&&e.expr[0].const===`true`&&e.expr[1].type===`const`&&e.expr[1].const===`false`}function RT(e){return e.type===`const`&&e.const===`.*`}function zT(e){return IT(e)||RT(e)?!1:LT(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>zT(e)):e.type===`const`||(()=>{throw new FT(`Unknown expression type`)})()}function BT(e){return zT(PT(e.pattern))}var VT=class extends YS{};function*HT(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of HT(e.slice(1)))yield`${t}${n}`}function*UT(e){return yield*HT(e.expr.map(e=>[...KT(e)]))}function*WT(e){for(let t of e.expr)yield*KT(t)}function*GT(e){return yield e.const}function*KT(e){return e.type===`and`?yield*UT(e):e.type===`or`?yield*WT(e):e.type===`const`?yield*GT(e):(()=>{throw new VT(`Unknown expression`)})()}function qT(e){let t=PT(e.pattern);return zT(t)?[...KT(t)]:[]}function JT(e,t){return J({[Y]:`Literal`,const:e,type:typeof e},t)}function YT(e){return J({[Y]:`Boolean`,type:`boolean`},e)}function XT(e){return J({[Y]:`BigInt`,type:`bigint`},e)}function ZT(e){return J({[Y]:`Number`,type:`number`},e)}function QT(e){return J({[Y]:`String`,type:`string`},e)}function*$T(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield YT():t===`number`?yield ZT():t===`bigint`?yield XT():t===`string`?yield QT():yield(()=>{let e=t.split(`|`).map(e=>JT(e.trim()));return e.length===0?uT():e.length===1?e[0]:yT(e)})()}function*eE(e){if(e[1]!==`{`)return yield*[JT(`$`),...tE(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=$T(e.slice(2,t)),r=tE(e.slice(t+1));return yield*[...n,...r]}yield JT(e)}function*tE(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[JT(e.slice(0,t)),...eE(e.slice(t))];yield JT(e)}function nE(e){return[...tE(e)]}var rE=class extends YS{};function iE(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function aE(e,t){return AC(e)?e.pattern.slice(1,e.pattern.length-1):FC(e)?`(${e.anyOf.map(e=>aE(e,t)).join(`|`)})`:SC(e)||fC(e)||oC(e)?`${t}${Gw}`:OC(e)?`${t}${Kw}`:gC(e)?`${t}${iE(e.const.toString())}`:sC(e)?`${t}${Ww}`:(()=>{throw new rE(`Unexpected Kind '${e[Y]}'`)})()}function oE(e){return`^${e.map(e=>aE(e,``)).join(``)}$`}function sE(e){return yT(qT(e).map(e=>JT(e)))}function cE(e,t){let n=ES(e)?oE(nE(e)):oE(e);return J({[Y]:`TemplateLiteral`,type:`string`,pattern:n},t)}function lE(e){return qT(e).map(e=>e.toString())}function uE(e){let t=[];for(let n of e)t.push(...fE(n));return t}function dE(e){return[e.toString()]}function fE(e){return[...new Set(AC(e)?lE(e):FC(e)?uE(e.anyOf):gC(e)?dE(e.const):SC(e)||fC(e)?[`[number]`]:[])]}function pE(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=DE(e,fE(t[i]),n);return r}function mE(e,t,n){return pE(e,t.properties,n)}function hE(e,t,n){return dT(mE(e,t,n))}function gE(e,t){return e.map(e=>wE(e,t))}function _E(e){return e.filter(e=>!yC(e))}function vE(e,t){return pD(_E(gE(e,t)))}function yE(e){return e.some(e=>yC(e))?[]:e}function bE(e,t){return yT(yE(gE(e,t)))}function xE(e,t){return t in e?e[t]:t===`[number]`?yT(e):uT()}function SE(e,t){return t===`[number]`?e:uT()}function CE(e,t){return t in e?e[t]:uT()}function wE(e,t){return pC(e)?vE(e.allOf,t):FC(e)?bE(e.anyOf,t):NC(e)?xE(e.items??[],t):iC(e)?SE(e.items,t):CC(e)?CE(e.properties,t):uT()}function TE(e,t){return t.map(t=>wE(e,t))}function EE(e,t){return yT(TE(e,t))}function DE(e,t,n){if(EC(e)||EC(t)){if(!VC(e)||!VC(t))throw new YS(`Index types using Ref parameters require both Type and Key to be of TSchema`);return sT(`Index`,[e,t])}return vC(t)?hE(e,t,n):_C(t)?jE(e,t,n):J(VC(t)?EE(e,fE(t)):EE(e,t),n)}function OE(e,t,n){return{[t]:DE(e,[t],IS(n))}}function kE(e,t,n){return t.reduce((t,r)=>({...t,...OE(e,r,n)}),{})}function AE(e,t,n){return kE(e,t.keys,n)}function jE(e,t,n){return dT(AE(e,t,n))}function ME(e,t){return J({[Y]:`Iterator`,type:`Iterator`,items:e},t)}function NE(e){return globalThis.Object.keys(e).filter(t=>!tC(e[t]))}function PE(e,t){let n=NE(e);return J(n.length>0?{[Y]:`Object`,type:`object`,required:n,properties:e}:{[Y]:`Object`,type:`object`,properties:e},t)}var FE=PE;function IE(e,t){return J({[Y]:`Promise`,type:`Promise`,item:e},t)}function LE(e){return J(lT(e,[ZS]))}function RE(e){return J({...e,[ZS]:`Readonly`})}function zE(e,t){return t===!1?LE(e):RE(e)}function BE(e,t){let n=t??!0;return vC(e)?UE(e,n):zE(e,n)}function VE(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=BE(e[r],t);return n}function HE(e,t){return VE(e.properties,t)}function UE(e,t){return dT(HE(e,t))}function WE(e,t){return J(e.length>0?{[Y]:`Tuple`,type:`array`,items:e,additionalItems:!1,minItems:e.length,maxItems:e.length}:{[Y]:`Tuple`,type:`array`,minItems:e.length,maxItems:e.length},t)}function GE(e,t){return e in t?QE(e,t[e]):dT(t)}function KE(e){return{[e]:JT(e)}}function qE(e){let t={};for(let n of e)t[n]=JT(n);return t}function JE(e,t){return Zw(t,e)?KE(e):qE(t)}function YE(e,t){return GE(e,JE(e,t))}function XE(e,t){return t.map(t=>QE(e,t))}function ZE(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=QE(e,t[r]);return n}function QE(e,t){let n={...t};return tC(t)?iD(QE(e,lT(t,[QS]))):eC(t)?BE(QE(e,lT(t,[ZS]))):vC(t)?GE(e,t.properties):_C(t)?YE(e,t.keys):lC(t)?fT(XE(e,t.parameters),QE(e,t.returns),n):dC(t)?pT(XE(e,t.parameters),QE(e,t.returns),n):aC(t)?oT(QE(e,t.items),n):mC(t)?ME(QE(e,t.items),n):pC(t)?mD(XE(e,t.allOf),n):FC(t)?bT(XE(e,t.anyOf),n):NC(t)?WE(XE(e,t.items??[]),n):CC(t)?FE(ZE(e,t.properties),n):iC(t)?iT(QE(e,t.items),n):wC(t)?IE(QE(e,t.item),n):t}function $E(e,t){let n={};for(let r of e)n[r]=QE(r,t);return n}function eD(e,t,n){let r=VC(e)?fE(e):e;return FE($E(r,t({[Y]:`MappedKey`,keys:r})),n)}function tD(e){return J(lT(e,[QS]))}function nD(e){return J({...e,[QS]:`Optional`})}function rD(e,t){return t===!1?tD(e):nD(e)}function iD(e,t){let n=t??!0;return vC(e)?sD(e,n):rD(e,n)}function aD(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=iD(e[r],t);return n}function oD(e,t){return aD(e.properties,t)}function sD(e,t){return dT(oD(e,t))}function cD(e,t={}){let n=e.every(e=>CC(e)),r=VC(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return J(t.unevaluatedProperties===!1||VC(t.unevaluatedProperties)||n?{...r,[Y]:`Intersect`,type:`object`,allOf:e}:{...r,[Y]:`Intersect`,allOf:e},t)}function lD(e){return e.every(e=>tC(e))}function uD(e){return lT(e,[QS])}function dD(e){return e.map(e=>tC(e)?uD(e):e)}function fD(e,t){return lD(e)?iD(cD(dD(e),t)):cD(dD(e),t)}function pD(e,t={}){if(e.length===1)return J(e[0],t);if(e.length===0)return uT(t);if(e.some(e=>MC(e)))throw Error(`Cannot intersect transform types`);return fD(e,t)}function mD(e,t){if(e.length===1)return J(e[0],t);if(e.length===0)return uT(t);if(e.some(e=>MC(e)))throw Error(`Cannot intersect transform types`);return cD(e,t)}function hD(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new YS(`Ref: $ref must be a string`);return J({[Y]:`Ref`,$ref:t},n)}function gD(e,t){return sT(`Awaited`,[sT(e,t)])}function _D(e){return sT(`Awaited`,[hD(e)])}function vD(e){return mD(xD(e))}function yD(e){return bT(xD(e))}function bD(e){return SD(e)}function xD(e){return e.map(e=>SD(e))}function SD(e,t){return J(cC(e)?gD(e.target,e.parameters):pC(e)?vD(e.allOf):FC(e)?yD(e.anyOf):wC(e)?bD(e.item):EC(e)?_D(e.$ref):e,t)}function CD(e){let t=[];for(let n of e)t.push(AD(n));return t}function wD(e){return nT(CD(e))}function TD(e){return tT(CD(e))}function ED(e){return e.map((e,t)=>t.toString())}function DD(e){return[`[number]`]}function OD(e){return globalThis.Object.getOwnPropertyNames(e)}function kD(e){return jD?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function AD(e){return pC(e)?wD(e.allOf):FC(e)?TD(e.anyOf):NC(e)?ED(e.items??[]):iC(e)?DD(e.items):CC(e)?OD(e.properties):TC(e)?kD(e.patternProperties):[]}var jD=!1;function MD(e,t){return sT(`KeyOf`,[sT(e,t)])}function ND(e){return sT(`KeyOf`,[hD(e)])}function PD(e,t){return J(yT(FD(AD(e))),t)}function FD(e){return e.map(e=>e===`[number]`?ZT():JT(e))}function ID(e,t){return cC(e)?MD(e.target,e.parameters):EC(e)?ND(e.$ref):vC(e)?zD(e,t):PD(e,t)}function LD(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=ID(e[r],IS(t));return n}function RD(e,t){return LD(e.properties,t)}function zD(e,t){return dT(RD(e,t))}function BD(e){let t=[];for(let n of e)t.push(...AD(n));return Qw(t)}function VD(e){return e.filter(e=>!yC(e))}function HD(e,t){let n=[];for(let r of e)n.push(...TE(r,[t]));return VD(n)}function UD(e,t){let n={};for(let r of t)n[r]=pD(HD(e,r));return n}function WD(e,t){return FE(UD(e,BD(e)),t)}function GD(e){return J({[Y]:`Date`,type:`Date`},e)}function KD(e){return J({[Y]:`Null`,type:`null`},e)}function qD(e){return J({[Y]:`Symbol`,type:`symbol`},e)}function JD(e){return J({[Y]:`Undefined`,type:`undefined`},e)}function YD(e){return J({[Y]:`Uint8Array`,type:`Uint8Array`},e)}function XD(e){return J({[Y]:`Unknown`},e)}function ZD(e){return e.map(e=>eO(e,!1))}function QD(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=BE(eO(e[n],!1));return t}function $D(e,t){return t===!0?e:BE(e)}function eO(e,t){return hS(e)||xS(e)?$D(rT(),t):gS(e)?BE(WE(ZD(e))):OS(e)?YD():yS(e)?GD():wS(e)?$D(FE(QD(e)),t):bS(e)?$D(pT([],XD()),t):kS(e)?JD():SS(e)?KD():DS(e)?qD():_S(e)?XT():CS(e)||vS(e)||ES(e)?JT(e):FE({})}function tO(e,t){return J(eO(e,!0),t)}function nO(e,t){return lC(e)?WE(e.parameters,t):uT(t)}function rO(e,t){if(kS(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return bT([...new Set(n)].map(e=>JT(e)),{...t,[$S]:`Enum`})}var iO=class extends YS{},Q;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(Q||={});function aO(e){return e===Q.False?e:Q.True}function oO(e){throw new iO(e)}function sO(e){return xw(e)||fw(e)||Lw(e)||zw(e)||ew(e)}function cO(e,t){return xw(t)?EO(e,t):fw(t)?SO(e,t):Lw(t)?lk(e,t):zw(t)?dk(e,t):ew(t)?lO(e,t):oO(`StructuralRight`)}function lO(e,t){return Q.True}function uO(e,t){return fw(t)?SO(e,t):Lw(t)&&t.anyOf.some(e=>ew(e)||zw(e))?Q.True:Lw(t)?Q.Union:zw(t)||ew(t)?Q.True:Q.Union}function dO(e,t){return zw(e)?Q.False:ew(e)?Q.Union:xw(e)?Q.True:Q.False}function fO(e,t){return Tw(t)&&UO(t)?Q.True:sO(t)?cO(e,t):nw(t)?aO(hk(e.items,t.items)):Q.False}function pO(e,t){return sO(t)?cO(e,t):rw(t)?aO(hk(e.items,t.items)):Q.False}function mO(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):iw(t)?Q.True:Q.False}function hO(e,t){return gw(e)||aw(e)?Q.True:Q.False}function gO(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):aw(t)?Q.True:Q.False}function _O(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):sw(t)?e.parameters.length>t.parameters.length?Q.False:e.parameters.every((e,n)=>aO(hk(t.parameters[n],e))===Q.True)?aO(hk(e.returns,t.returns)):Q.False:Q.False}function vO(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):cw(t)?Q.True:Q.False}function yO(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):lw(t)?e.parameters.length>t.parameters.length?Q.False:e.parameters.every((e,n)=>aO(hk(t.parameters[n],e))===Q.True)?aO(hk(e.returns,t.returns)):Q.False:Q.False}function bO(e,t){return _w(e)&&CS(e.const)||ww(e)||uw(e)?Q.True:Q.False}function xO(e,t){return uw(t)||ww(t)?Q.True:sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):Q.False}function SO(e,t){return t.allOf.every(t=>hk(e,t)===Q.True)?Q.True:Q.False}function CO(e,t){return e.allOf.some(e=>hk(e,t)===Q.True)?Q.True:Q.False}function wO(e,t){return sO(t)?cO(e,t):pw(t)?aO(hk(e.items,t.items)):Q.False}function TO(e,t){return _w(t)&&t.const===e.const?Q.True:sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):Aw(t)?ek(e,t):ww(t)?jO(e,t):uw(t)?bO(e,t):aw(t)?hO(e,t):Q.False}function EO(e,t){return Q.False}function DO(e,t){return Q.True}function OO(e){let[t,n]=[e,0];for(;Sw(t);)t=t.not,n+=1;return n%2==0?t:XD()}function kO(e,t){return Sw(e)?hk(OO(e),t):Sw(t)?hk(e,OO(t)):oO(`Invalid fallthrough for Not`)}function AO(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):Cw(t)?Q.True:Q.False}function jO(e,t){return hw(e)||ww(e)||uw(e)?Q.True:Q.False}function MO(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):uw(t)||ww(t)?Q.True:Q.False}function NO(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function PO(e){return UO(e)}function FO(e){return NO(e,0)||NO(e,1)&&`description`in e.properties&&Lw(e.properties.description)&&e.properties.description.anyOf.length===2&&(Aw(e.properties.description.anyOf[0])&&Iw(e.properties.description.anyOf[1])||Aw(e.properties.description.anyOf[1])&&Iw(e.properties.description.anyOf[0]))}function IO(e){return NO(e,0)}function LO(e){return NO(e,0)}function RO(e){return NO(e,0)}function zO(e){return NO(e,0)}function BO(e){return UO(e)}function VO(e){let t=ZT();return NO(e,0)||NO(e,1)&&`length`in e.properties&&aO(hk(e.properties.length,t))===Q.True}function HO(e){return NO(e,0)}function UO(e){let t=ZT();return NO(e,0)||NO(e,1)&&`length`in e.properties&&aO(hk(e.properties.length,t))===Q.True}function WO(e){let t=pT([rT()],rT());return NO(e,0)||NO(e,1)&&`then`in e.properties&&aO(hk(e.properties.then,t))===Q.True}function GO(e,t){return hk(e,t)===Q.False||$C(e)&&!$C(t)?Q.False:Q.True}function KO(e,t){return zw(e)?Q.False:ew(e)?Q.Union:xw(e)||mw(e)&&PO(t)||hw(e)&&IO(t)||gw(e)&&LO(t)||jw(e)&&FO(t)||iw(e)&&RO(t)||Aw(e)&&PO(t)||jw(e)&&FO(t)||ww(e)&&IO(t)||uw(e)&&IO(t)||aw(e)&&LO(t)||Rw(e)&&BO(t)||cw(e)&&zO(t)||sw(e)&&HO(t)||lw(e)&&VO(t)?Q.True:Dw(e)&&Aw(YO(e))?t[$S]===`Record`?Q.True:Q.False:Dw(e)&&ww(YO(e))&&NO(t,0)?Q.True:Q.False}function qO(e,t){return sO(t)?cO(e,t):Dw(t)?ZO(e,t):Tw(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!$C(t.properties[n]))return Q.False;if($C(t.properties[n]))return Q.True;if(GO(e.properties[n],t.properties[n])===Q.False)return Q.False}return Q.True})():Q.False}function JO(e,t){return sO(t)?cO(e,t):Tw(t)&&WO(t)?Q.True:Ew(t)?aO(hk(e.item,t.item)):Q.False}function YO(e){return Jw in e.patternProperties?ZT():Yw in e.patternProperties?QT():oO(`Unknown record key pattern`)}function XO(e){return Jw in e.patternProperties?e.patternProperties[Jw]:Yw in e.patternProperties?e.patternProperties[Yw]:oO(`Unable to get record value schema`)}function ZO(e,t){let[n,r]=[YO(t),XO(t)];return mw(e)&&ww(n)&&aO(hk(e,r))===Q.True?Q.True:Rw(e)&&ww(n)||Aw(e)&&ww(n)||nw(e)&&ww(n)?hk(e,r):Tw(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(GO(r,e.properties[t])===Q.False)return Q.False;return Q.True})():Q.False}function QO(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?hk(XO(e),XO(t)):Q.False}function $O(e,t){return hk(kw(e)?QT():e,kw(t)?QT():t)}function ek(e,t){return _w(e)&&ES(e.const)||Aw(e)?Q.True:Q.False}function tk(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):Aw(t)?Q.True:Q.False}function nk(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):jw(t)?Q.True:Q.False}function rk(e,t){return Mw(e)?hk(sE(e),t):Mw(t)?hk(e,sE(t)):oO(`Invalid fallthrough for TemplateLiteral`)}function ik(e,t){return nw(t)&&e.items!==void 0&&e.items.every(e=>hk(e,t.items)===Q.True)}function ak(e,t){return xw(e)?Q.True:zw(e)?Q.False:ew(e)?Q.Union:Q.False}function ok(e,t){return sO(t)?cO(e,t):Tw(t)&&UO(t)||nw(t)&&ik(e,t)?Q.True:Fw(t)?kS(e.items)&&!kS(t.items)||!kS(e.items)&&kS(t.items)?Q.False:kS(e.items)&&!kS(t.items)||e.items.every((e,n)=>hk(e,t.items[n])===Q.True)?Q.True:Q.False:Q.False}function sk(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):Rw(t)?Q.True:Q.False}function ck(e,t){return sO(t)?cO(e,t):Tw(t)?KO(e,t):Dw(t)?ZO(e,t):Vw(t)?pk(e,t):Iw(t)?Q.True:Q.False}function lk(e,t){return t.anyOf.some(t=>hk(e,t)===Q.True)?Q.True:Q.False}function uk(e,t){return e.anyOf.every(e=>hk(e,t)===Q.True)?Q.True:Q.False}function dk(e,t){return Q.True}function fk(e,t){return xw(t)?EO(e,t):fw(t)?SO(e,t):Lw(t)?lk(e,t):ew(t)?lO(e,t):Aw(t)?ek(e,t):ww(t)?jO(e,t):uw(t)?bO(e,t):aw(t)?hO(e,t):nw(t)?dO(e,t):Fw(t)?ak(e,t):Tw(t)?KO(e,t):zw(t)?Q.True:Q.False}function pk(e,t){return Iw(e)||Iw(e)?Q.True:Q.False}function mk(e,t){return fw(t)?SO(e,t):Lw(t)?lk(e,t):zw(t)?dk(e,t):ew(t)?lO(e,t):Tw(t)?KO(e,t):Vw(t)?Q.True:Q.False}function hk(e,t){return Mw(e)||Mw(t)?rk(e,t):kw(e)||kw(t)?$O(e,t):Sw(e)||Sw(t)?kO(e,t):ew(e)?uO(e,t):nw(e)?fO(e,t):iw(e)?mO(e,t):aw(e)?gO(e,t):rw(e)?pO(e,t):sw(e)?_O(e,t):cw(e)?vO(e,t):lw(e)?yO(e,t):uw(e)?xO(e,t):fw(e)?CO(e,t):pw(e)?wO(e,t):_w(e)?TO(e,t):xw(e)?DO(e,t):Cw(e)?AO(e,t):ww(e)?MO(e,t):Tw(e)?qO(e,t):Dw(e)?QO(e,t):Aw(e)?tk(e,t):jw(e)?nk(e,t):Fw(e)?ok(e,t):Ew(e)?JO(e,t):Rw(e)?sk(e,t):Iw(e)?ck(e,t):Lw(e)?uk(e,t):zw(e)?fk(e,t):Vw(e)?mk(e,t):oO(`Unknown left type operand '${e[Y]}'`)}function gk(e,t){return hk(e,t)}function _k(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=xk(e[o],t,n,r,IS(i));return a}function vk(e,t,n,r,i){return _k(e.properties,t,n,r,i)}function yk(e,t,n,r,i){return dT(vk(e,t,n,r,i))}function bk(e,t,n,r){let i=gk(e,t);return i===Q.Union?bT([n,r]):i===Q.True?n:r}function xk(e,t,n,r,i){return vC(e)?yk(e,t,n,r,i):_C(e)?J(Tk(e,t,n,r,i)):J(bk(e,t,n,r),i)}function Sk(e,t,n,r,i){return{[e]:xk(JT(e),t,n,r,IS(i))}}function Ck(e,t,n,r,i){return e.reduce((e,a)=>({...e,...Sk(a,t,n,r,i)}),{})}function wk(e,t,n,r,i){return Ck(e.keys,t,n,r,i)}function Tk(e,t,n,r,i){return dT(wk(e,t,n,r,i))}function Ek(e,t){return Ok(sE(e),t)}function Dk(e,t){let n=e.filter(e=>gk(e,t)===Q.False);return n.length===1?n[0]:bT(n)}function Ok(e,t,n={}){return AC(e)?J(Ek(e,t),n):vC(e)?J(jk(e,t),n):J(FC(e)?Dk(e.anyOf,t):gk(e,t)===Q.False?e:uT(),n)}function kk(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Ok(e[r],t);return n}function Ak(e,t){return kk(e.properties,t)}function jk(e,t){return dT(Ak(e,t))}function Mk(e,t){return Pk(sE(e),t)}function Nk(e,t){let n=e.filter(e=>gk(e,t)!==Q.False);return n.length===1?n[0]:bT(n)}function Pk(e,t,n){return AC(e)?J(Mk(e,t),n):vC(e)?J(Lk(e,t),n):J(FC(e)?Nk(e.anyOf,t):gk(e,t)===Q.False?uT():e,n)}function Fk(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Pk(e[r],t);return n}function Ik(e,t){return Fk(e.properties,t)}function Lk(e,t){return dT(Ik(e,t))}function Rk(e,t){return lC(e)?J(e.returns,t):uT(t)}function zk(e){return BE(iD(e))}function Bk(e,t,n){return J({[Y]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function Vk(e,t,n){let r={};for(let n of e)r[n]=t;return FE(r,{...n,[$S]:`Record`})}function Hk(e,t,n){return BT(e)?Vk(fE(e),t,n):Bk(e.pattern,t,n)}function Uk(e,t,n){return Vk(fE(bT(e)),t,n)}function Wk(e,t,n){return Vk([e.toString()],t,n)}function Gk(e,t,n){return Bk(e.source,t,n)}function Kk(e,t,n){return Bk(kS(e.pattern)?Yw:e.pattern,t,n)}function qk(e,t,n){return Bk(Yw,t,n)}function Jk(e,t,n){return Bk(Xw,t,n)}function Yk(e,t,n){return FE({true:t,false:t},n)}function Xk(e,t,n){return Bk(Jw,t,n)}function Zk(e,t,n){return Bk(Jw,t,n)}function Qk(e,t,n={}){return FC(e)?Uk(e.anyOf,t,n):AC(e)?Hk(e,t,n):gC(e)?Wk(e.const,t,n):sC(e)?Yk(e,t,n):fC(e)?Xk(e,t,n):SC(e)?Zk(e,t,n):DC(e)?Gk(e,t,n):OC(e)?Kk(e,t,n):nC(e)?qk(e,t,n):yC(e)?Jk(e,t,n):uT(n)}function $k(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function eA(e){let t=$k(e);return t===Yw?QT():t===Jw?ZT():QT({pattern:t})}function tA(e){return e.patternProperties[$k(e)]}function nA(e,t){return t.parameters=gA(e,t.parameters),t.returns=_A(e,t.returns),t}function rA(e,t){return t.parameters=gA(e,t.parameters),t.returns=_A(e,t.returns),t}function iA(e,t){return t.allOf=gA(e,t.allOf),t}function aA(e,t){return t.anyOf=gA(e,t.anyOf),t}function oA(e,t){return kS(t.items)||(t.items=gA(e,t.items)),t}function sA(e,t){return t.items=_A(e,t.items),t}function cA(e,t){return t.items=_A(e,t.items),t}function lA(e,t){return t.items=_A(e,t.items),t}function uA(e,t){return t.item=_A(e,t.item),t}function dA(e,t){let n=hA(e,t.properties);return{...t,...FE(n)}}function fA(e,t){let n=Qk(_A(e,eA(t)),_A(e,tA(t)));return{...t,...n}}function pA(e,t){return t.index in e?e[t.index]:XD()}function mA(e,t){let n=eC(t),r=tC(t),i=_A(e,t);return n&&r?zk(i):n&&!r?BE(i):!n&&r?iD(i):i}function hA(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:mA(e,t[r])}),{})}function gA(e,t){return t.map(t=>_A(e,t))}function _A(e,t){return lC(t)?nA(e,t):dC(t)?rA(e,t):pC(t)?iA(e,t):FC(t)?aA(e,t):NC(t)?oA(e,t):iC(t)?sA(e,t):aC(t)?cA(e,t):mC(t)?lA(e,t):wC(t)?uA(e,t):CC(t)?dA(e,t):TC(t)?fA(e,t):rC(t)?pA(e,t):t}function vA(e,t){return _A(t,LS(e))}function yA(e){return J({[Y]:`Integer`,type:`integer`},e)}function bA(e,t,n){return{[e]:jA(JT(e),t,IS(n))}}function xA(e,t,n){return e.reduce((e,r)=>({...e,...bA(r,t,n)}),{})}function SA(e,t,n){return xA(e.keys,t,n)}function CA(e,t,n){return dT(SA(e,t,n))}function wA(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function TA(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function EA(e){return e.toUpperCase()}function DA(e){return e.toLowerCase()}function OA(e,t,n){let r=PT(e.pattern);return zT(r)?cE([bT(AA([...KT(r)].map(e=>JT(e)),t))],n):{...e,pattern:kA(e.pattern,t)}}function kA(e,t){return typeof e==`string`?t===`Uncapitalize`?wA(e):t===`Capitalize`?TA(e):t===`Uppercase`?EA(e):t===`Lowercase`?DA(e):e:e.toString()}function AA(e,t){return e.map(e=>jA(e,t))}function jA(e,t,n={}){return _C(e)?CA(e,t,n):AC(e)?OA(e,t,n):FC(e)?bT(AA(e.anyOf,t),n):gC(e)?JT(kA(e.const,t),n):J(e,n)}function MA(e,t={}){return jA(e,`Capitalize`,t)}function NA(e,t={}){return jA(e,`Lowercase`,t)}function PA(e,t={}){return jA(e,`Uncapitalize`,t)}function FA(e,t={}){return jA(e,`Uppercase`,t)}function IA(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=KA(e[i],t,IS(n));return r}function LA(e,t,n){return IA(e.properties,t,n)}function RA(e,t,n){return dT(LA(e,t,n))}function zA(e,t){return e.map(e=>GA(e,t))}function BA(e,t){return e.map(e=>GA(e,t))}function VA(e,t){let{[t]:n,...r}=e;return r}function HA(e,t){return t.reduce((e,t)=>VA(e,t),e)}function UA(e,t,n){let r=lT(e,[XS,`$id`,`required`,`properties`]);return FE(HA(n,t),r)}function WA(e){return bT(e.reduce((e,t)=>hC(t)?[...e,JT(t)]:e,[]))}function GA(e,t){return pC(e)?mD(zA(e.allOf,t)):FC(e)?bT(BA(e.anyOf,t)):CC(e)?UA(e,t,e.properties):FE({})}function KA(e,t,n){let r=gS(t)?WA(t):t,i=VC(t)?fE(t):t,a=EC(e),o=EC(t);return vC(e)?RA(e,i,n):_C(t)?XA(e,t,n):a&&o||!a&&o||a&&!o?sT(`Omit`,[e,r],n):J({...GA(e,i),...n})}function qA(e,t,n){return{[t]:KA(e,[t],IS(n))}}function JA(e,t,n){return t.reduce((t,r)=>({...t,...qA(e,r,n)}),{})}function YA(e,t,n){return JA(e,t.keys,n)}function XA(e,t,n){return dT(YA(e,t,n))}function ZA(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=oj(e[i],t,IS(n));return r}function QA(e,t,n){return ZA(e.properties,t,n)}function $A(e,t,n){return dT(QA(e,t,n))}function ej(e,t){return e.map(e=>aj(e,t))}function tj(e,t){return e.map(e=>aj(e,t))}function nj(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function rj(e,t,n){let r=lT(e,[XS,`$id`,`required`,`properties`]);return FE(nj(n,t),r)}function ij(e){return bT(e.reduce((e,t)=>hC(t)?[...e,JT(t)]:e,[]))}function aj(e,t){return pC(e)?mD(ej(e.allOf,t)):FC(e)?bT(tj(e.anyOf,t)):CC(e)?rj(e,t,e.properties):FE({})}function oj(e,t,n){let r=gS(t)?ij(t):t,i=VC(t)?fE(t):t,a=EC(e),o=EC(t);return vC(e)?$A(e,i,n):_C(t)?uj(e,t,n):a&&o||!a&&o||a&&!o?sT(`Pick`,[e,r],n):J({...aj(e,i),...n})}function sj(e,t,n){return{[t]:oj(e,[t],IS(n))}}function cj(e,t,n){return t.reduce((t,r)=>({...t,...sj(e,r,n)}),{})}function lj(e,t,n){return cj(e,t.keys,n)}function uj(e,t,n){return dT(lj(e,t,n))}function dj(e,t){return sT(`Partial`,[sT(e,t)])}function fj(e){return sT(`Partial`,[hD(e)])}function pj(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=iD(e[n]);return t}function mj(e,t){let n=lT(e,[XS,`$id`,`required`,`properties`]);return FE(pj(t),n)}function hj(e){return e.map(e=>gj(e))}function gj(e){return cC(e)?dj(e.target,e.parameters):EC(e)?fj(e.$ref):pC(e)?mD(hj(e.allOf)):FC(e)?bT(hj(e.anyOf)):CC(e)?mj(e,e.properties):oC(e)||sC(e)||fC(e)||gC(e)||xC(e)||SC(e)||OC(e)||kC(e)||PC(e)?e:FE({})}function _j(e,t){return vC(e)?bj(e,t):J({...gj(e),...t})}function vj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=_j(e[r],IS(t));return n}function yj(e,t){return vj(e.properties,t)}function bj(e,t){return dT(yj(e,t))}function xj(e,t){return sT(`Required`,[sT(e,t)])}function Sj(e){return sT(`Required`,[hD(e)])}function Cj(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=lT(e[n],[QS]);return t}function wj(e,t){let n=lT(e,[XS,`$id`,`required`,`properties`]);return FE(Cj(t),n)}function Tj(e){return e.map(e=>Ej(e))}function Ej(e){return cC(e)?xj(e.target,e.parameters):EC(e)?Sj(e.$ref):pC(e)?mD(Tj(e.allOf)):FC(e)?bT(Tj(e.anyOf)):CC(e)?wj(e,e.properties):oC(e)||sC(e)||fC(e)||gC(e)||xC(e)||SC(e)||OC(e)||kC(e)||PC(e)?e:FE({})}function Dj(e,t){return vC(e)?Aj(e,t):J({...Ej(e),...t})}function Oj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Dj(e[r],t);return n}function kj(e,t){return Oj(e.properties,t)}function Aj(e,t){return dT(kj(e,t))}function jj(e,t){return t.map(t=>EC(t)?Mj(e,t.$ref):$j(e,t))}function Mj(e,t){return t in e?EC(e[t])?Mj(e,e[t].$ref):$j(e,e[t]):uT()}function Nj(e){return SD(e[0])}function Pj(e){return DE(e[0],e[1])}function Fj(e){return ID(e[0])}function Ij(e){return _j(e[0])}function Lj(e){return KA(e[0],e[1])}function Rj(e){return oj(e[0],e[1])}function zj(e){return Dj(e[0])}function Bj(e,t,n){let r=jj(e,n);return t===`Awaited`?Nj(r):t===`Index`?Pj(r):t===`KeyOf`?Fj(r):t===`Partial`?Ij(r):t===`Omit`?Lj(r):t===`Pick`?Rj(r):t===`Required`?zj(r):uT()}function Vj(e,t){return iT($j(e,t))}function Hj(e,t){return oT($j(e,t))}function Uj(e,t,n){return fT(Qj(e,t),$j(e,n))}function Wj(e,t,n){return pT(Qj(e,t),$j(e,n))}function Gj(e,t){return mD(Qj(e,t))}function Kj(e,t){return ME($j(e,t))}function qj(e,t){return FE(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:$j(e,t[r])}),{}))}function Jj(e,t){let[n,r]=[$j(e,tA(t)),$k(t)],i=LS(t);return i.patternProperties[r]=n,i}function Yj(e,t){return EC(t)?{...Mj(e,t.$ref),[XS]:t[XS]}:t}function Xj(e,t){return WE(Qj(e,t))}function Zj(e,t){return bT(Qj(e,t))}function Qj(e,t){return t.map(t=>$j(e,t))}function $j(e,t){return tC(t)?J($j(e,lT(t,[QS])),t):eC(t)?J($j(e,lT(t,[ZS])),t):MC(t)?J(Yj(e,t),t):iC(t)?J(Vj(e,t.items),t):aC(t)?J(Hj(e,t.items),t):cC(t)?J(Bj(e,t.target,t.parameters)):lC(t)?J(Uj(e,t.parameters,t.returns),t):dC(t)?J(Wj(e,t.parameters,t.returns),t):pC(t)?J(Gj(e,t.allOf),t):mC(t)?J(Kj(e,t.items),t):CC(t)?J(qj(e,t.properties),t):TC(t)?J(Jj(e,t)):NC(t)?J(Xj(e,t.items||[]),t):FC(t)?J(Zj(e,t.anyOf),t):t}function eM(e,t){return t in e?$j(e,e[t]):uT()}function tM(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:eM(e,n)}),{})}var nM=class{constructor(e){let t=tM(e),n=this.WithIdentifiers(t);this.$defs=n}Import(e,t){let n={...this.$defs,[e]:J(this.$defs[e],t)};return J({[Y]:`Import`,$defs:n,$ref:e})}WithIdentifiers(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:{...e[n],$id:n}}),{})}};function rM(e){return new nM(e)}function iM(e,t){return J({[Y]:`Not`,not:e},t)}function aM(e,t){return dC(e)?WE(e.parameters,t):uT()}var oM=0;function sM(e,t={}){kS(t.$id)&&(t.$id=`T${oM++}`);let n=LS(e({[Y]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,J({[$S]:`Recursive`,...n},t)}function cM(e,t){let n=ES(e)?new globalThis.RegExp(e):e;return J({[Y]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function lM(e){return pC(e)?e.allOf:FC(e)?e.anyOf:NC(e)?e.items??[]:[]}function uM(e){return lM(e)}function dM(e,t){return dC(e)?J(e.returns,t):uT(t)}var fM=class{constructor(e){this.schema=e}Decode(e){return new pM(this.schema,e)}},pM=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[XS].Encode(e(n)),Decode:e=>this.decode(t[XS].Decode(e))};return{...t,[XS]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[XS]:n}}Encode(e){return MC(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function mM(e){return new fM(e)}function hM(e={}){return J({[Y]:e[Y]??`Unsafe`},e)}function gM(e){return J({[Y]:`Void`,type:`void`},e)}var $=t({Any:()=>rT,Argument:()=>aT,Array:()=>iT,AsyncIterator:()=>oT,Awaited:()=>SD,BigInt:()=>XT,Boolean:()=>YT,Capitalize:()=>MA,Composite:()=>WD,Const:()=>tO,Constructor:()=>fT,ConstructorParameters:()=>nO,Date:()=>GD,Enum:()=>rO,Exclude:()=>Ok,Extends:()=>xk,Extract:()=>Pk,Function:()=>pT,Index:()=>DE,InstanceType:()=>Rk,Instantiate:()=>vA,Integer:()=>yA,Intersect:()=>mD,Iterator:()=>ME,KeyOf:()=>ID,Literal:()=>JT,Lowercase:()=>NA,Mapped:()=>eD,Module:()=>rM,Never:()=>uT,Not:()=>iM,Null:()=>KD,Number:()=>ZT,Object:()=>FE,Omit:()=>KA,Optional:()=>iD,Parameters:()=>aM,Partial:()=>_j,Pick:()=>oj,Promise:()=>IE,Readonly:()=>BE,ReadonlyOptional:()=>zk,Record:()=>Qk,Recursive:()=>sM,Ref:()=>hD,RegExp:()=>cM,Required:()=>Dj,Rest:()=>uM,ReturnType:()=>dM,String:()=>QT,Symbol:()=>qD,TemplateLiteral:()=>cE,Transform:()=>mM,Tuple:()=>WE,Uint8Array:()=>YD,Uncapitalize:()=>PA,Undefined:()=>JD,Union:()=>bT,Unknown:()=>XD,Unsafe:()=>hM,Uppercase:()=>FA,Void:()=>gM}),_M={additionalProperties:!1},vM=$.String({pattern:`^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`,minLength:36,maxLength:36}),yM=$.String({pattern:`^[a-z0-9][a-z0-9-]{0,31}(?![\\s\\S])`,minLength:1,maxLength:32}),bM=$.String({pattern:`^sha256:[0-9a-f]{64}$`,minLength:71,maxLength:71}),xM=$.String({pattern:`^[A-Za-z0-9_-]{43}$`,minLength:43,maxLength:43}),SM=$.String({pattern:`^dpt_[A-Za-z0-9_-]{43}$`,minLength:47,maxLength:47}),CM=`[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}`,wM=`^(?:${CM}|[A-Z2-7]{12}|[A-Z2-7]{8})(?![\\s\\S])`,TM=$.String({pattern:wM,minLength:8,maxLength:36}),EM=new RegExp(wM),DM=/^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/;function OM(e){return typeof e!=`string`||e.length>36?!1:EM.test(e)}function kM(e){if(typeof e!=`string`)return;if(DM.test(e)){let t=e.toLowerCase();return OM(t)?t:void 0}let t=e.replace(/[\s-]+/g,``).toUpperCase();if(OM(t)&&!(/[\s-]/.test(e)&&t.length!==12))return t}$.Object({type:$.Literal(`pair.request`),v:$.Literal(1),requestId:vM,code:TM,deviceUid:vM,deviceName:$.String({minLength:1,maxLength:64}),hostname:$.Optional($.String({minLength:1,maxLength:128})),platform:$.Optional($.String({minLength:1,maxLength:64})),publicKey:$.String({minLength:1,maxLength:256}),keyFingerprint:bM,clientTime:$.Integer(),hubNonce:$.Optional(xM)},_M),$.Object({type:$.Literal(`pair.device-request`),v:$.Literal(1),requestId:vM,deviceUid:vM,deviceName:$.String({minLength:1,maxLength:64}),hostname:$.Optional($.String({minLength:1,maxLength:128})),platform:$.Optional($.String({minLength:1,maxLength:64})),publicKey:$.String({minLength:1,maxLength:256}),keyFingerprint:bM,clientTime:$.Integer(),hubNonce:$.Optional(xM)},_M);var AM=$.Object({type:$.Literal(`pair.challenge`),v:$.Literal(1),enrollmentId:vM,nonce:xM,issuedAt:$.Integer(),hubId:vM,hubPublicKey:$.Optional($.String({minLength:1,maxLength:256})),hubKeyFingerprint:$.Optional(bM),hubSignature:$.Optional($.String({pattern:`^[A-Za-z0-9_-]{86}$`,minLength:86,maxLength:86}))},_M);$.Object({type:$.Literal(`pair.device-ack`),v:$.Literal(1),codeId:vM,code:TM,expiresAt:$.Integer(),hubOrigin:$.String(),hubId:vM,challenge:AM},_M),$.Object({type:$.Literal(`pair.response`),v:$.Literal(1),enrollmentId:vM,nonce:xM,signature:$.String({pattern:`^[A-Za-z0-9_-]{86}$`,minLength:86,maxLength:86})},_M),$.Object({type:$.Literal(`pair.pending`),v:$.Literal(1),enrollmentId:vM,state:$.Literal(`awaiting_approval`),expiresAt:$.Integer(),pollAfterMs:$.Integer({minimum:1})},_M),$.Object({type:$.Literal(`pair.token`),v:$.Literal(1),enrollmentId:vM,deviceUid:vM,deviceId:yM,pairingEpoch:vM,credentialId:vM,generation:$.Integer({minimum:1}),hubId:vM,hubOrigin:$.String(),hubUrl:$.String(),tunnelToken:SM,issuedAt:$.Integer(),expiresAt:$.Null(),hubKeyFingerprint:$.Optional(bM)},_M),$.Object({enrollmentId:vM,deviceUid:vM,keyFingerprint:bM,replaceKey:$.Optional($.Boolean())},_M),$.Object({type:$.Literal(`pair.revoke`),v:$.Literal(1),deviceId:yM,pairingEpoch:vM,reason:$.Union([$.Literal(`user`),$.Literal(`compromise`),$.Literal(`hub_migrated`)]),revokedAt:$.Integer()},_M);var jM=$.Object({type:$.Literal(`pair.error`),v:$.Literal(1),code:$.Union([$.Literal(`code_invalid`),$.Literal(`code_expired`),$.Literal(`code_used`),$.Literal(`code_in_use`),$.Literal(`rate_limited`),$.Literal(`signature_invalid`),$.Literal(`clock_skew`),$.Literal(`paired_elsewhere`),$.Literal(`hub_required`),$.Literal(`fingerprint_mismatch`),$.Literal(`identity_conflict`),$.Literal(`enrollment_lost`),$.Literal(`enrollment_cancelled`),$.Literal(`already_issued`),$.Literal(`challenge_expired`)]),message:$.String({maxLength:512}),retryAfterMs:$.Optional($.Integer({minimum:1}))},_M);$.Object({type:$.Literal(`pair.code`),v:$.Literal(1),codeId:vM,code:TM,expiresAt:$.Integer(),hubOrigin:$.String({maxLength:2048}),pairUrl:$.String({maxLength:4096}),offerUrl:$.Optional($.String({maxLength:2048}))},_M);var MM=$.Union([$.Literal(`open`),$.Literal(`awaiting_proof`),$.Literal(`awaiting_approval`),$.Literal(`approved`),$.Literal(`issued`),$.Literal(`connected`),$.Literal(`cancelled`),$.Literal(`expired`)]);$.Object({type:$.Literal(`pair.code-state`),v:$.Literal(1),codeId:vM,expiresAt:$.Integer(),phase:MM,enrollment:$.Optional($.Object({enrollmentId:vM,deviceUid:vM,deviceName:$.String({minLength:1,maxLength:64}),keyFingerprint:bM,proofVerified:$.Boolean(),keyChanged:$.Boolean()},_M)),deviceId:$.Optional(yM),error:$.Optional(jM)},_M);function NM(e){if(typeof e!=`string`||e.length===0||e.length>2048)return{ok:!1,error:`origin: empty or too long`};if(/\s|\n|\r|\t/.test(e))return{ok:!1,error:`origin: whitespace not allowed`};let t;try{t=new URL(e)}catch{return{ok:!1,error:`origin: not a valid URL`}}return t.protocol!==`https:`&&!(t.protocol===`http:`&&/^(127\.0\.0\.1|\[::1\]|localhost)$/.test(t.hostname))?{ok:!1,error:`origin: HTTPS origin required`}:t.username||t.password?{ok:!1,error:`origin: userinfo not allowed`}:t.search||t.hash?{ok:!1,error:`origin: query/fragment not allowed`}:t.pathname!==`/`&&t.pathname!==``?{ok:!1,error:`origin: base path not allowed`}:{ok:!0,origin:t.origin,tunnelUrl:`${t.origin}/api/tunnel`}}function PM(e){if(e!==``&&/^[A-Za-z0-9_-]+$/.test(e))try{let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}catch{return}}var FM=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,IM=RegExp(`^${CM}$`),LM=/^sha256:[0-9a-f]{64}$/;function RM(e){let t=PM(e);if(!t||t.length>1024)return;let n;try{n=JSON.parse(new TextDecoder().decode(t))}catch{return}if(!n||typeof n!=`object`||Array.isArray(n))return;let r=n;if(r.v!==2&&r.v!==3)return;let i=r.v===3?6:5;if(Object.keys(r).length!==i||typeof r.hub!=`string`)return;let a=NM(r.hub);if(a.ok&&a.origin===r.hub&&typeof r.id==`string`&&FM.test(r.id)&&typeof r.code==`string`&&IM.test(r.code)&&typeof r.exp==`number`&&Number.isSafeInteger(r.exp))return r.v===3?typeof r.kfp!=`string`||!LM.test(r.kfp)?void 0:{v:3,hub:r.hub,id:r.id,code:r.code,exp:r.exp,kfp:r.kfp}:{v:2,hub:r.hub,id:r.id,code:r.code,exp:r.exp}}function zM(e,t=Date.now()){let n=RM(e);if(n&&!(n.exp<t-3e4)&&!(n.exp>t+6e5))return n}function BM(e,t=Date.now()){let n;try{n=new URL(e)}catch{return}if(!/^\/pair\/?$/.test(n.pathname)||n.username||n.password||n.search||!n.hash.startsWith(`#offer=`))return;let r=zM(n.hash.slice(7),t);if(r&&r.hub===n.origin)return{offer:r,rest:`${n.origin}/pair`}}function VM(e){if(!/^\/pair\/?$/.test(e.pathname))return;if(e.hash.startsWith(`#offer=`)){let t=BM(e.href);if(t)return{code:t.offer.code,origin:e.origin,offerFragment:e.hash.slice(1)};let n=zM(e.hash.slice(7));return n&&n.hub!==e.origin?{error:`This pairing link does not belong to this hub. Open the original hub link instead.`}:{error:`Invalid pairing link. Use a complete link from the hub wizard.`}}let t=e.searchParams;if(!t.has(`code`)&&!t.has(`origin`)&&!t.has(`v`))return;let n=t.get(`code`),r=n===null?void 0:kM(n);if(e.username||e.password||e.hash||t.getAll(`code`).length!==1||!r||t.getAll(`v`).length!==1||t.get(`v`)!==`1`)return{error:`Invalid pairing link. Use a complete version 1 link from the hub wizard.`};if(t.has(`origin`))try{let n=new URL(t.get(`origin`));if(t.getAll(`origin`).length!==1||n.origin!==e.origin||n.pathname!==`/`||n.username||n.password||n.search||n.hash)throw Error(`origin mismatch`)}catch{return{error:`This pairing link does not belong to this hub. Open the original hub link instead.`}}return{code:r,origin:e.origin}}var HM=e=>/^\/pair\/?$/.test(e.pathname)?`/`:void 0,UM=e=>/^\/pair\/?$/.test(e.pathname)&&VM(e)===void 0?`/`:void 0,WM=4e3;async function GM(e){if(!e.needsCancel)return{closed:!0,confirmed:!0};let t,n=await Promise.race([e.cancel().catch(()=>`failed`),new Promise(n=>t=setTimeout(()=>n(`failed`),e.timeoutMs))]);return clearTimeout(t),{closed:n!==`issued`,confirmed:n===`cancelled`}}var KM={class:`modal pair-wizard`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pair-title`},qM={key:1,class:`pair-pending`,"aria-label":`Machines waiting for approval`},JM={class:`who`},YM={key:0,class:`muted`},XM={key:1,class:`muted`},ZM={class:`fp`},QM={class:`row`},$M={class:`phase`},eN=[`onClick`],tN={key:2,class:`hint`},nN={class:`pair-steps`,"aria-label":`Pairing progress`},rN={class:`pair-grid`},iN={class:`pair-code-box`},aN={class:`pair-code`,"aria-label":`Pairing code`},oN={class:`pair-copy-actions`},sN=[`innerHTML`],cN={class:`pair-side`},lN={key:0,class:`hint`},uN={class:`pair-fingerprint`},dN={class:`fp`},fN={class:`pair-confirm`},pN={key:0,class:`pair-confirm warn`},mN=[`disabled`],hN=[`disabled`],gN={class:`hint`},_N=[`disabled`],vN={key:5,class:`error`,role:`alert`},yN={key:4},bN={class:`error`,role:`alert`},xN=A({__name:`PairDeviceWizard`,props:{handoff:{}},emits:[`close`],setup(e,{expose:t,emit:n}){let r=n,i=e,a=O(`boot`),o=O(),s=O(),c=O(),l=O(``),u=O(!1),d=O(!1),f=O(!1),p=O(!1),m=O(!1),h=O(!1),g=O(),_=O([]),v=B(()=>{let e=s.value?.code??``;return!OM(e)||e.includes(`-`)?e:(e.match(/.{4}/g)??[]).join(`-`)}),y=B(()=>s.value?Cv(s.value):``),b=B(()=>y.value?sS(y.value,148):``),ee=B(()=>c.value?.enrollment?.keyFingerprint??``),te=B(()=>c.value?.deviceId??``);Zn(te,e=>{g.value?.(),e&&(g.value=Zn(()=>Zl.devices.value.find(t=>t.id===e)?.status,e=>{e===`online`&&(W(`Device paired and online.`),g.value?.(),g.value=void 0)},{immediate:!0}))});async function x(e){a.value=`boot`,l.value=``,f.value=!1,p.value=!1,c.value=void 0,s.value=void 0,o.value?.close();let t=Ev();o.value=t;try{let n=e?await wv.resolveCode(e):await wv.createCode();if(t.closed()){await wv.cancel(n.codeId).catch(()=>{W(`The late pairing code could not be cancelled. Check device credentials before retrying.`)});return}if(s.value=n,a.value=`code`,e){let e=HM(new URL(window.location.href));e&&window.history.replaceState(window.history.state,``,e)}kv(t,n.codeId,{intervalMs:1e3,onState:e=>{c.value=e,e.phase===`awaiting_proof`?a.value=`proof`:e.phase===`awaiting_approval`||e.phase===`approved`?a.value=`approve`:e.phase===`issued`||e.phase===`connected`?a.value=`issued`:e.phase===`cancelled`?a.value=`cancelled`:e.phase===`expired`&&(a.value=`expired`)}}).catch(e=>{t.closed()||(l.value=e instanceof Error?e.message:String(e),a.value=`expired`)})}catch(e){l.value=e instanceof Error?e.message:String(e),a.value=`expired`}}async function ne(){let e=c.value,t=o.value;if(e?.enrollment&&t&&!u.value){u.value=!0,l.value=``;try{let t=await wv.approve(s.value.codeId,{enrollmentId:e.enrollment.enrollmentId,deviceUid:e.enrollment.deviceUid,keyFingerprint:e.enrollment.keyFingerprint,...p.value?{replaceKey:!0}:{}});c.value=t,(t.phase===`issued`||t.phase===`connected`)&&(a.value=`issued`)}catch(e){l.value=e instanceof Error?e.message:String(e)}finally{u.value=!1}}}async function re(e){if(!s.value)return`cancelled`;try{let t=await wv.cancel(s.value.codeId,void 0,e);return c.value=t,o.value&&(o.value.state=t),a.value=t.phase===`expired`?`expired`:`cancelled`,o.value?.close(),`cancelled`}catch(e){if(e instanceof Cl&&e.status===409&&String(e.code)===`already_issued`){let e=await wv.codeState(s.value.codeId).catch(()=>void 0);return e&&(c.value=e,o.value&&(o.value.state=e)),a.value=`issued`,l.value=`Credential already issued. Closing does not revoke it; choose Revoke explicitly if needed.`,`issued`}return l.value=e instanceof Error?e.message:String(e),`failed`}}let ie=()=>re(!1),ae=()=>[`issued`,`connected`,`cancelled`,`expired`].includes(c.value?.phase??``);async function oe(){let e=te.value;if(e){u.value=!0;try{await wv.revoke(e,`user`),W(`Issued credential revoked.`),r(`close`)}catch(e){l.value=e instanceof Error?e.message:String(e)}finally{u.value=!1}}}async function se(){if(s.value)try{await navigator.clipboard.writeText(s.value.code),m.value=!0,setTimeout(()=>m.value=!1,1500)}catch{l.value=`Clipboard unavailable; copy the code manually.`}}async function ce(){if(s.value)try{await navigator.clipboard.writeText(s.value.offerUrl??s.value.pairUrl),h.value=!0,setTimeout(()=>h.value=!1,1500)}catch{l.value=`Clipboard unavailable; copy the link manually.`}}async function le(){if(!d.value){d.value=!0,u.value=!0;try{let e=await GM({needsCancel:!!s.value&&!ae(),cancel:ie,timeoutMs:WM});if(!e.closed)return;o.value?.close(),g.value?.(),e.confirmed||W(`Pairing cancellation was not confirmed. The code expires on its own; check device credentials before retrying.`),r(`close`)}finally{d.value=!1,u.value=!1}}}t({close:le});let ue;async function de(){try{_.value=(await wv.pending()).codes}catch{}}async function fe(e){s.value=void 0,c.value=void 0,l.value=``;let t=Ev();o.value=t,a.value=e.phase===`approved_ready`?`approve`:`proof`,kv(t,e.codeId,{intervalMs:1e3,onState:e=>{c.value=e,e.phase===`awaiting_proof`?a.value=`proof`:e.phase===`awaiting_approval`||e.phase===`approved`?a.value=`approve`:e.phase===`issued`||e.phase===`connected`?a.value=`issued`:e.phase===`cancelled`?a.value=`cancelled`:e.phase===`expired`&&(a.value=`expired`)}}).catch(e=>{l.value=e instanceof Error?e.message:String(e)})}return Wr(()=>{if(de(),ue=setInterval(()=>void de(),3e3),i.handoff&&`error`in i.handoff){l.value=i.handoff.error,a.value=`expired`;return}x(i.handoff?.code)}),qr(()=>{clearInterval(ue);let e=o.value;e&&!e.closed()&&s.value&&!ae()&&re(!0).then(e=>{e!==`cancelled`&&W(`Pairing cancellation was not confirmed. Check device credentials before retrying.`)}),e?.close(),g.value?.()}),(e,t)=>(N(),P(`div`,{class:`modal-backdrop`,onClick:js(le,[`self`])},[I(`div`,KM,[I(`header`,null,[t[5]||=I(`h2`,{id:`pair-title`},`Pair a device`,-1),I(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close dialog`,onClick:le},[L(k(Jc),{size:18})])]),i.handoff&&`offerFragment`in i.handoff&&i.handoff.offerFragment?(N(),F(mS,{key:0,"offer-fragment":i.handoff.offerFragment},null,8,[`offer-fragment`])):z(``,!0),_.value.length?(N(),P(`section`,qM,[t[6]||=I(`h3`,null,`Machines waiting for you`,-1),I(`ul`,null,[(N(!0),P(M,null,j(_.value,e=>(N(),P(`li`,{key:e.codeId},[I(`div`,JM,[I(`strong`,null,T(e.deviceName??`unnamed device`),1),e.hostname?(N(),P(`span`,YM,T(e.hostname),1)):z(``,!0),e.platform?(N(),P(`span`,XM,T(e.platform),1)):z(``,!0)]),I(`div`,ZM,T(e.keyFingerprint),1),I(`div`,QM,[I(`span`,$M,T(e.phase.replaceAll(`_`,` `)),1),I(`button`,{type:`button`,class:`small`,onClick:t=>fe(e)},`Review`,8,eN)])]))),128))]),t[7]||=I(`p`,{class:`hint`},` Compare each fingerprint with the machine's own terminal before approving. Codes are minted by the hub — nothing has to be copied to the machine. `,-1)])):z(``,!0),a.value===`boot`?(N(),P(`p`,tN,`Minting a pairing code…`)):s.value?(N(),P(M,{key:3},[I(`ol`,nN,[t[8]||=I(`li`,{class:C({on:!0})},`Code`,-1),I(`li`,{class:C({on:[`proof`,`approve`,`issued`].includes(a.value)})},`Proof`,2),I(`li`,{class:C({on:[`approve`,`issued`].includes(a.value)})},`Fingerprint`,2),I(`li`,{class:C({on:a.value===`issued`})},`Online`,2)]),I(`div`,rN,[I(`div`,iN,[I(`div`,aN,T(v.value),1),I(`div`,oN,[I(`button`,{type:`button`,class:`small`,onClick:se},[L(k(nc),{size:14}),R(` `+T(m.value?`Copied`:`Copy code`),1)]),I(`button`,{type:`button`,class:`small`,onClick:ce,title:`Self-contained link: hub, code and expiry all in the fragment — it never reaches server logs`},[L(k(nc),{size:14}),R(` `+T(h.value?`Copied link`:`Copy link`),1)])]),t[9]||=I(`p`,{class:`hint`},` Run the device pairing command and scan, or enter this code on the device. Expires in 5 minutes. `,-1),I(`div`,{class:`pair-qr`,"aria-label":`Pairing QR code`,title:`Same offer link as Copy link: hub, code and expiry all in the #offer= fragment — it never reaches server logs`,innerHTML:b.value},null,8,sN)]),I(`div`,cN,[a.value===`code`||a.value===`proof`?(N(),P(`p`,lN,[L(k(Fc),{size:14,class:`spin`}),t[10]||=R(` Waiting for the device to submit its signing proof… `,-1)])):a.value===`approve`?(N(),P(M,{key:1},[I(`div`,uN,[t[11]||=I(`h3`,null,`Device key fingerprint`,-1),I(`code`,dN,T(ee.value),1),t[12]||=I(`p`,{class:`hint`},` Compare ALL 64 hex characters with the fingerprint shown on the device screen. `,-1)]),I(`label`,fN,[Wn(I(`input`,{"onUpdate:modelValue":t[0]||=e=>f.value=e,type:`checkbox`},null,512),[[Ss,f.value]]),t[13]||=R(` The fingerprint matches the device display exactly `,-1)]),c.value?.enrollment?.keyChanged?(N(),P(`label`,pN,[Wn(I(`input`,{"onUpdate:modelValue":t[1]||=e=>p.value=e,type:`checkbox`},null,512),[[Ss,p.value]]),L(k(Rc),{size:14}),t[14]||=R(` Device is already paired with a DIFFERENT key — replace the stored key (replaceKey) `,-1)])):z(``,!0),I(`button`,{type:`button`,class:`primary`,disabled:!f.value||u.value||c.value?.enrollment?.keyChanged===!0&&!p.value,onClick:ne},` Approve device `,8,mN),I(`button`,{type:`button`,class:`small`,disabled:u.value,onClick:ie},` Cancel pairing `,8,hN)],64)):a.value===`issued`?(N(),P(M,{key:2},[I(`p`,gN,[L(k($s),{size:14}),t[15]||=R(` Credential issued. The device is connecting through the tunnel — you will get a toast once the monitor probe reports it online. `,-1)]),I(`button`,{type:`button`,class:`small`,onClick:le},`Close`),I(`button`,{type:`button`,class:`small danger`,disabled:!te.value||u.value,title:`Mistaken approval? Revoke the credential now.`,onClick:oe},` Revoke this credential `,8,_N)],64)):a.value===`cancelled`?(N(),P(M,{key:3},[t[16]||=I(`p`,{class:`hint`},`Pairing was cancelled (or the signature failed too many times).`,-1),I(`button`,{type:`button`,class:`small`,onClick:t[2]||=e=>x()},`Start over`)],64)):a.value===`expired`?(N(),P(M,{key:4},[t[17]||=I(`p`,{class:`hint`},`The pairing code expired.`,-1),I(`button`,{type:`button`,class:`small`,onClick:t[3]||=e=>x()},`New code`)],64)):z(``,!0),l.value?(N(),P(`p`,vN,T(l.value),1)):z(``,!0)])])],64)):(N(),P(`div`,yN,[I(`p`,bN,T(l.value||`This pairing link is unavailable.`),1),I(`button`,{type:`button`,class:`small`,onClick:t[4]||=e=>x()},`New code`)]))])]))}}),SN={class:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`device-credentials-title`},CN={class:`hint`},wN={key:1,class:`hint`},TN=A({__name:`DeviceCredentialsDialog`,props:{deviceId:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=B(()=>Zl.devices.value.find(e=>e.id===n.deviceId));return(e,t)=>(N(),P(`div`,{class:`modal-backdrop`,onClick:t[2]||=js(e=>r(`close`),[`self`])},[I(`section`,SN,[I(`header`,null,[t[3]||=I(`h2`,{id:`device-credentials-title`},`Device credentials`,-1),I(`button`,{class:`icon-button`,"aria-label":`Close device credentials`,onClick:t[0]||=e=>r(`close`)},[L(k(Jc),{size:18})])]),i.value?(N(),P(M,{key:0},[I(`p`,null,[R(T(i.value.name)+` `,1),I(`code`,null,T(i.value.id),1)]),I(`p`,CN,T(i.value.status)+` · tunnel `+T(i.value.tunnel?.state??`disconnected`)+` · `+T(i.value.tunnel?.readerCount??0)+` readers `,1),L(Rv,{device:i.value},null,8,[`device`])],64)):(N(),P(`p`,wN,`This device is no longer in the registry.`)),I(`footer`,null,[I(`button`,{class:`secondary`,onClick:t[1]||=e=>r(`close`)},`Close`)])])]))}}),EN={id:`prompt-title`},DN=[`disabled`],ON={key:0,class:`hint`},kN={key:1},AN={key:0,class:`muted`},jN=[`placeholder`,`disabled`],MN=[`required`,`placeholder`,`aria-label`,`disabled`],NN={key:2,class:`message-error`,role:`alert`},PN=[`disabled`],FN=[`disabled`],IN=A({__name:`PromptDialog`,props:{dialog:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=O(n.dialog.value??``),a=O(!1),o=O(``),s=O(),c=!!n.dialog.label;async function l(){if(!a.value&&(!c||n.dialog.optional||i.value.trim())){a.value=!0,o.value=``;try{await n.dialog.run(i.value.trim()),r(`close`)}catch(e){o.value=zl(e)}finally{a.value=!1}}}return Wr(()=>void jn(()=>(s.value?.focus(),s.value?.select()))),(t,n)=>(N(),P(`div`,{class:`modal-backdrop`,onClick:n[4]||=js(e=>!a.value&&r(`close`),[`self`])},[I(`form`,{class:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`prompt-title`,onSubmit:js(l,[`prevent`])},[I(`header`,null,[I(`h2`,EN,T(e.dialog.title),1),I(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close dialog`,disabled:a.value,onClick:n[0]||=e=>r(`close`)},[L(k(Jc),{size:18})],8,DN)]),e.dialog.hint?(N(),P(`p`,ON,T(e.dialog.hint),1)):z(``,!0),c?(N(),P(`label`,kN,[R(T(e.dialog.label)+` `,1),e.dialog.optional?(N(),P(`span`,AN,`(optional)`)):z(``,!0),e.dialog.multiline?Wn((N(),P(`textarea`,{key:1,ref_key:`input`,ref:s,"onUpdate:modelValue":n[1]||=e=>i.value=e,rows:`4`,placeholder:e.dialog.placeholder,disabled:a.value},null,8,jN)),[[xs,i.value]]):Wn((N(),P(`input`,{key:2,ref_key:`input`,ref:s,"onUpdate:modelValue":n[2]||=e=>i.value=e,maxlength:`100`,required:!e.dialog.optional,placeholder:e.dialog.placeholder,"aria-label":e.dialog.label,disabled:a.value},null,8,MN)),[[xs,i.value]])])):z(``,!0),o.value?(N(),P(`p`,NN,T(o.value),1)):z(``,!0),I(`footer`,null,[I(`button`,{type:`button`,class:`secondary`,disabled:a.value,onClick:n[3]||=e=>r(`close`)},` Cancel `,8,PN),I(`button`,{class:C([`primary`,{danger:e.dialog.danger}]),disabled:a.value||c&&!e.dialog.optional&&!i.value.trim()},T(a.value?`Working…`:e.dialog.submit),11,FN)])],32)]))}}),LN={class:`modal model-modal`},RN={class:`eyebrow`},zN={class:`model-list`},BN=[`onClick`],VN=[`src`],HN={class:`hint`},UN=A({__name:`ModelPicker`,emits:[`close`],setup(e,{emit:t}){let n=t,r=O(``),i=B(()=>bu.value.filter(e=>`${e.name} ${e.id} ${e.tier}`.toLowerCase().includes(r.value.toLowerCase()))),a=e=>e.id===xu.value.agent.model?.modelId&&e.provider===xu.value.agent.model?.provider;async function o(e){await Mu(()=>du.value.configure({model:{provider:e.provider,modelId:e.id}}))&&(await Au(),W(`Model saved. Used on the next turn.`),n(`close`))}return(e,t)=>(N(),P(`div`,{class:`modal-backdrop`,onClick:t[2]||=js(e=>n(`close`),[`self`])},[I(`section`,LN,[I(`header`,null,[I(`div`,null,[I(`span`,RN,`PER AGENT · `+T(k(iu)?.id),1),t[3]||=I(`h2`,null,`Choose a model`,-1)]),I(`button`,{class:`icon-button`,"aria-label":`Close model picker`,onClick:t[0]||=e=>n(`close`)},[L(k(Jc),{size:18})])]),Wn(I(`input`,{"onUpdate:modelValue":t[1]||=e=>r.value=e,placeholder:`Search models or tiers…`,"aria-label":`Search models`},null,512),[[xs,r.value]]),I(`div`,zN,[(N(!0),P(M,null,j(i.value,e=>(N(),P(`button`,{key:`${e.provider}/${e.id}`,class:C({selected:a(e)}),onClick:t=>o(e)},[I(`img`,{src:k(Iu)(e.id),alt:``},null,8,VN),I(`div`,null,[I(`strong`,null,T(e.name),1),I(`small`,null,T(e.tier)+` / `+T(e.provider)+` / `+T(k(Pu)(e.contextWindow))+` context`,1)]),a(e)?(N(),F(k(Xs),{key:0,size:18})):z(``,!0)],10,BN))),128))]),I(`p`,HN,`Models available on `+T(k(iu)?.id)+`. Provider keys stay on the device.`,1)])]))}}),WN={class:`dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`help-title`},GN={class:`dialog-head`},KN={class:`dialog-body`},qN={class:`n`},JN={class:`body`},YN={class:`help-callout`},XN={class:`dialog-foot`},ZN={class:`right`},QN=A({__name:`HelpDialog`,setup(e){let t=[{title:`Pick a device, start a session`,body:`Every device in the tree runs dpi-backend. A session gets its own SQLite database on that device, in the directory you choose.`},{title:`Send work, then close the browser`,body:`The device owns the run. Reopening restores committed messages, state and live progress.`},{title:`Change state and fork`,body:`Edit App State by hand or through the agent. Every session and fork on a device shares it.`},{title:`Interrupt deliberately`,body:`Interrupt stops foreground work and owned subagents. Background jobs continue. Stop all includes them.`},{title:`Explore the boundaries`,body:`Queue a follow-up, steer after tools, wait for approval, compact context, reset or inspect raw state.`},{title:`Restart a device`,body:`Its tree dims and shows the restart command. Checkpointed jobs recover on boot. Replay-safe tools may rerun. Other interrupted tools return an error.`}];return(e,n)=>(N(),P(`div`,{class:`scrim`,onClick:n[2]||=js(e=>k(U).dialog=void 0,[`self`])},[I(`section`,WN,[I(`div`,GN,[n[3]||=I(`div`,null,[I(`span`,{class:`dialog-eyebrow`},`LEARN BY DOING`),I(`h3`,{id:`help-title`},`What makes this durable?`)],-1),I(`button`,{class:`icon-button`,"aria-label":`Close help`,onClick:n[0]||=e=>k(U).dialog=void 0},[L(k(Jc),{size:18})])]),I(`div`,KN,[(N(),P(M,null,j(t,(e,t)=>I(`div`,{key:e.title,class:`help-step`},[I(`span`,qN,T(String(t+1).padStart(2,`0`)),1),I(`div`,null,[I(`b`,null,T(e.title),1),I(`div`,JN,T(e.body),1)])])),64)),I(`div`,YN,[L(k(mc),{size:18}),n[4]||=I(`span`,null,`Durable does not mean exactly-once external effects. Checkpoints protect progress. Tools still need their own idempotency.`,-1)])]),I(`div`,XN,[I(`div`,ZN,[I(`button`,{class:`secondary`,type:`button`,onClick:n[1]||=e=>k(U).dialog=void 0},`Close`)])])])]))}}),$N=Kt({needed:!1,busy:!1,error:``}),eP=new Set,tP=e=>{let t=[...eP];eP=new Set;for(let n of t)n(e)},nP=()=>new Promise(e=>eP.add(e));async function rP(e){if($N.busy||!e)return!1;$N.busy=!0,$N.error=``;try{let t=await fetch(`/api/session`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({token:e})});return await t.text().catch(()=>``),t.ok?($N.needed=!1,tP(!0),!0):($N.error=t.status===401?`That token was not accepted.`:t.status===429?`Too many attempts. Wait a minute and try again.`:`Login failed (${t.status}).`,!1)}catch{return $N.error=`Cannot reach the hub.`,!1}finally{$N.busy=!1}}var iP=e=>{try{return new URL(e,location.href).pathname===`/api/session`}catch{return e===`/api/session`}};function aP(e){return(async(t,n)=>{let r=()=>e(t,n),i=await r();if(i.status!==401||iP(typeof t==`string`?t:t instanceof URL?t.href:t.url)||n?.body instanceof ReadableStream)return i;$N.needed=!0;let a=await i.text().catch(()=>``);return await nP()?r():new Response(a,{status:i.status,headers:i.headers})})}function oP(){typeof window>`u`||window.__adminFetch||(window.__adminFetch=!0,window.fetch=aP(window.fetch.bind(window)))}var sP={class:`login-veil`,"data-testid":`login-card`},cP=[`disabled`],lP={key:0,class:`message-error`,role:`alert`},uP=[`disabled`],dP=A({__name:`LoginCard`,setup(e){let t=O(``),n=O();async function r(){if($N.busy||!t.value.trim())return;let e=await rP(t.value.trim());t.value=``,e&&n.value?.blur()}return Wr(()=>void jn(()=>n.value?.focus())),(e,i)=>(N(),P(`div`,sP,[I(`form`,{class:`modal login-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`login-title`,onSubmit:js(r,[`prevent`])},[i[2]||=I(`header`,null,[I(`h2`,{id:`login-title`},`Admin token`)],-1),i[3]||=I(`p`,{class:`hint`},[R(` This hub is locked. Sign in with the token from its `),I(`code`,null,`admin.token`),R(` file. `)],-1),i[4]||=I(`label`,{for:`admin-token`},`Admin token`,-1),Wn(I(`input`,{id:`admin-token`,ref_key:`input`,ref:n,"onUpdate:modelValue":i[0]||=e=>t.value=e,type:`password`,name:`admin-token`,autocomplete:`off`,spellcheck:`false`,placeholder:`adm_…`,"aria-label":`Admin token`,disabled:k($N).busy,onKeydown:i[1]||=Ns(e=>k($N).error=``,[`esc`])},null,40,cP),[[xs,t.value]]),k($N).error?(N(),P(`p`,lP,T(k($N).error),1)):z(``,!0),I(`footer`,null,[I(`button`,{class:`primary`,type:`submit`,disabled:k($N).busy||!t.value.trim()},T(k($N).busy?`Checking…`:`Sign in`),9,uP)])],32)]))}}),fP={key:0,class:`toast`,role:`status`},pP=A({__name:`Toast`,setup(e){return(e,t)=>(N(),F(wo,{name:`toast`},{default:Un(()=>[k(U).toast?(N(),P(`div`,fP,[L(k(Xs),{size:18}),R(T(k(U).toast),1)])):z(``,!0)]),_:1}))}}),mP={class:`shell`,"data-testid":`app-shell`},hP={key:0,class:`error-banner`,role:`alert`},gP={key:4,class:`welcome`,"data-testid":`welcome-empty`},_P=[`disabled`],vP={class:`welcome-features`},yP={class:`modal path-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`path-title`},bP={class:`full-directory`},xP=A({__name:`App`,setup(e){let t=()=>Zl.devices.value.filter(e=>e.status===`online`).length,n=O();function r(){U.dialog={kind:`new-session`,deviceId:H.value?.deviceId}}function i(e){let t=U.dialog?void 0:Yu(e);if(t)return e.preventDefault(),t===`tree`?Gu():Ku();if(e.key===`Escape`){if(U.dialog){U.dialog.kind===`pair`?n.value?.close():U.dialog=void 0;return}!e.repeat&&!e.isComposing&&Tu.value&&(e.preventDefault(),zu()),U.drawer=!1,U.inspectorOverlay=!1}}function a(e){let t=e.clientX,n=eu.value,r=e=>eu.value=Math.max(220,Math.min(560,n+e.clientX-t)),i=()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,i)};window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,i)}return Wr(()=>{document.addEventListener(`keydown`,i),vu()}),qr(()=>{Yl.stop(),document.removeEventListener(`keydown`,i)}),(e,i)=>(N(),P(`div`,mP,[L(rd,{onNewSession:r}),k(U).error?(N(),P(`div`,hP,[L(k(mc),{size:18}),I(`span`,null,T(k(U).error),1),I(`button`,{class:`icon-button`,"aria-label":`Dismiss error`,onClick:i[0]||=e=>k(U).error=``},`×`)])):z(``,!0),I(`main`,{class:`net-workspace`,style:ye({"--tree-w":`${k(eu)}px`})},[L(Ld),k(tu).tree?(N(),P(`div`,{key:0,class:`tree-resizer`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize network tree`,onPointerdown:js(a,[`prevent`])},null,32)):z(``,!0),k(U).drawer?(N(),P(`div`,{key:1,class:`tree-backdrop`,onClick:i[1]||=e=>k(U).drawer=!1})):z(``,!0),k(H)&&k(iu)&&k(au)?(N(),P(M,{key:2},[L(cx),k(U).inspectorOverlay?(N(),P(`div`,{key:0,class:`inspector-backdrop`,onClick:i[2]||=e=>k(Wu)()})):z(``,!0),(N(),F(Y_,{key:`${k(H).deviceId}/${k(H).sessionId}`}))],64)):k(H)&&k(iu)?(N(),F(vx,{key:3,device:k(iu)},null,8,[`device`])):(N(),P(`section`,gP,[i[14]||=I(`img`,{class:`welcome-symbol`,src:`/icons/durable-pi.svg`,alt:`Durable Pi`},null,-1),i[15]||=I(`span`,{class:`eyebrow`},`THE DURABLE AGENT NETWORK`,-1),i[16]||=I(`h1`,null,[R(`Close the tab.`),I(`br`),R(`The work continues.`)],-1),i[17]||=I(`p`,null,`Agents run on your devices. This page is only a window into them.`,-1),I(`button`,{class:`primary`,disabled:!t(),onClick:r},[L(k(Nc),{size:18}),R(T(k(Zl).devices.value.length?`Create a session`:`Add a device to dpi-network.yaml`),1)],8,_P),I(`div`,vP,[I(`span`,null,[L(k(ac),{size:18}),i[11]||=R(`SQLite on each device`,-1)]),I(`span`,null,[L(k(dc),{size:18}),i[12]||=R(`Branch any agent`,-1)]),I(`span`,null,[L(k(Us),{size:18}),i[13]||=R(`Watch from anywhere`,-1)])])]))],4),L(od),k(U).dialog?.kind===`pair`?(N(),F(xN,{key:1,ref_key:`pairWizard`,ref:n,handoff:k(U).dialog.handoff,onClose:i[3]||=e=>k(U).dialog=void 0},null,8,[`handoff`])):z(``,!0),k(U).dialog?.kind===`credentials`?(N(),F(TN,{key:2,"device-id":k(U).dialog.deviceId,onClose:i[4]||=e=>k(U).dialog=void 0},null,8,[`device-id`])):z(``,!0),k(U).dialog?.kind===`new-session`?(N(),F(Fx,{key:3,"device-id":k(U).dialog.deviceId,onClose:i[5]||=e=>k(U).dialog=void 0},null,8,[`device-id`])):k(U).dialog?.kind===`prompt`?(N(),F(IN,{key:4,dialog:k(U).dialog,onClose:i[6]||=e=>k(U).dialog=void 0},null,8,[`dialog`])):k(U).dialog?.kind===`models`?(N(),F(UN,{key:5,onClose:i[7]||=e=>k(U).dialog=void 0})):k(U).dialog?.kind===`path`?(N(),P(`div`,{key:6,class:`modal-backdrop`,onClick:i[10]||=js(e=>k(U).dialog=void 0,[`self`])},[I(`section`,yP,[I(`header`,null,[i[18]||=I(`h2`,{id:`path-title`},`Working directory`,-1),I(`button`,{class:`icon-button`,"aria-label":`Close working directory`,onClick:i[8]||=e=>k(U).dialog=void 0},[L(k(Jc),{size:18})])]),I(`code`,bP,T(k(U).dialog.path),1),I(`footer`,null,[I(`button`,{class:`secondary`,onClick:i[9]||=e=>k(U).dialog=void 0},`Close`)])])])):k(U).dialog?.kind===`help`?(N(),F(QN,{key:7})):z(``,!0),k($N).needed?(N(),F(dP,{key:8})):z(``,!0),L(pP)]))}});oP();var SP=new URL(window.location.href);if(/^\/pair\/?$/.test(SP.pathname)){let e=VM(SP);e?(SP.search=``,SP.hash=``,window.history.replaceState(window.history.state,``,SP),U.dialog={kind:`pair`,handoff:e}):window.history.replaceState(window.history.state,``,UM(SP))}Ls(xP).mount(`#app`);