my-durable 0.0.30 → 0.0.32

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,79 +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=>S(e)===`[object Map]`,h=e=>S(e)===`[object Set]`,g=e=>S(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),x=Object.prototype.toString,S=e=>x.call(e),te=e=>S(e).slice(8,-1),ne=e=>S(e)===`[object Object]`,re=e=>v(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,ie=n(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),ae=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},oe=/-\w/g,se=ae(e=>e.replace(oe,e=>e.slice(1).toUpperCase())),ce=/\B([A-Z])/g,le=ae(e=>e.replace(ce,`-$1`).toLowerCase()),ue=ae(e=>e.charAt(0).toUpperCase()+e.slice(1)),de=ae(e=>e?`on${ue(e)}`:``),C=(e,t)=>!Object.is(e,t),fe=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},pe=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},me=e=>{let t=parseFloat(e);return isNaN(t)?e:t},he=e=>{let t=v(e)?Number(e):NaN;return isNaN(t)?e:t},ge,_e=()=>ge||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function ve(e){if(p(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=v(r)?Se(r):ve(r);if(i)for(let e in i)t[e]=i[e]}return t}if(v(e)||b(e))return e}var ye=/;(?![^(]*\))/g,be=/:([^]+)/,xe=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function Se(e){let t={};return e.replace(xe,e=>e.startsWith(`/*`)?``:e).split(ye).forEach(e=>{if(e){let n=e.split(be);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function w(e){let t=``;if(v(e))t=e;else if(p(e))for(let n=0;n<e.length;n++){let r=w(e[n]);r&&(t+=r+` `)}else if(b(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var Ce=`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`,we=n(Ce);Ce+``;function T(e){return!!e||e===``}function Te(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=ke(e[i],t[i],n);return r}function Ee(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]&&ke(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function De(e,t,n){let r=m(e),i=m(t);if(r||i||(r=h(e),i=h(t),r||i))return r&&i?Ee(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||!ke(e[r],t[r],n))return!1}return String(e)===String(t)}function Oe(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 ke(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?Oe(e,t,n,Te):!1:(r=b(e),i=b(t),r||i?!r||!i?!1:Oe(e,t,n,De):String(e)===String(t))))}function Ae(e,t){return e.findIndex(e=>ke(e,t))}var je=e=>!!(e&&e.__v_isRef===!0),E=e=>v(e)?e:e==null?``:p(e)||b(e)&&(e.toString===x||!_(e.toString))?je(e)?E(e.value):JSON.stringify(e,Me,2):String(e),Me=(e,t)=>je(t)?Me(e,t.value):m(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Ne(t,r)+` =>`]=n,e),{})}:h(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Ne(e))}:y(t)?Ne(t):b(t)&&!p(t)&&!ne(t)?String(t):t,Ne=(e,t=``)=>y(e)?`Symbol(${e.description??t})`:e,Pe,Fe=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&&Pe&&(Pe.active?(this.parent=Pe,this.index=(Pe.scopes||(Pe.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=Pe;try{return Pe=this,e()}finally{Pe=t}}}on(){++this._on===1&&(this.prevScope=Pe,Pe=this)}off(){if(this._on>0&&--this._on===0){if(Pe===this)Pe=this.prevScope;else{let e=Pe;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 Ie(){return Pe}var D,Le=new WeakSet,Re=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,Pe&&(Pe.active?Pe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Le.has(this)&&(Le.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||He(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,tt(this),Ge(this);let e=D,t=Ze;D=this,Ze=!0;try{return this.fn()}finally{Ke(this),D=e,Ze=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ye(e);this.deps=this.depsTail=void 0,tt(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Le.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){qe(this)&&this.run()}get dirty(){return qe(this)}},ze=0,Be,Ve;function He(e,t=!1){if(e.flags|=8,t){e.next=Ve,Ve=e;return}e.next=Be,Be=e}function Ue(){ze++}function We(){if(--ze>0)return;if(Ve){let e=Ve;for(Ve=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;Be;){let t=Be;for(Be=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 Ge(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Ke(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ye(r),Xe(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function qe(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Je(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Je(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===nt)||(e.globalVersion=nt,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!qe(e))))return;e.flags|=2;let t=e.dep,n=D,r=Ze;D=e,Ze=!0;try{Ge(e);let n=e.fn(e._value);(t.version===0||C(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{D=n,Ze=r,Ke(e),e.flags&=-3}}function Ye(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)Ye(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Xe(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var Ze=!0,Qe=[];function $e(){Qe.push(Ze),Ze=!1}function et(){let e=Qe.pop();Ze=e===void 0||e}function tt(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=D;D=void 0;try{t()}finally{D=e}}}var nt=0,rt=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}},it=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(!D||!Ze||D===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==D)t=this.activeLink=new rt(D,this),D.deps?(t.prevDep=D.depsTail,D.depsTail.nextDep=t,D.depsTail=t):D.deps=D.depsTail=t,at(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=D.depsTail,t.nextDep=void 0,D.depsTail.nextDep=t,D.depsTail=t,D.deps===t&&(D.deps=e)}return t}trigger(e){this.version++,nt++,this.notify(e)}notify(e){Ue();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{We()}}};function at(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)at(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var ot=new WeakMap,st=Symbol(``),ct=Symbol(``),lt=Symbol(``);function ut(e,t,n){if(Ze&&D){let t=ot.get(e);t||ot.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new it),r.map=t,r.key=n),r.track()}}function dt(e,t,n,r,i,a){let o=ot.get(e);if(!o){nt++;return}let s=e=>{e&&e.trigger()};if(Ue(),t===`clear`)o.forEach(s);else{let i=p(e),a=i&&re(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===lt||!y(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(lt)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(st)),m(e)&&s(o.get(ct)));break;case`delete`:i||(s(o.get(st)),m(e)&&s(o.get(ct)));break;case`set`:m(e)&&s(o.get(st))}}We()}function ft(e){let t=O(e);return t===e||(ut(t,`iterate`,lt),Zt(e))?t:Xt(e)?Yt(e)?t.map(e=>tn(en(e))):t.map(tn):t.map(en)}function pt(e){return ut(e=O(e),`iterate`,lt),e}function mt(e,t){return Xt(e)?tn(Yt(e)?en(t):t):en(t)}var ht={__proto__:null,[Symbol.iterator](){return gt(this,Symbol.iterator,e=>mt(this,e))},concat(...e){return ft(this).concat(...e.map(e=>p(e)?ft(e):e))},entries(){return gt(this,`entries`,e=>(e[1]=mt(this,e[1]),e))},every(e,t){return vt(this,`every`,e,t,void 0,arguments)},filter(e,t){return vt(this,`filter`,e,t,e=>e.map(e=>mt(this,e)),arguments)},find(e,t){return vt(this,`find`,e,t,e=>mt(this,e),arguments)},findIndex(e,t){return vt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return vt(this,`findLast`,e,t,e=>mt(this,e),arguments)},findLastIndex(e,t){return vt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return vt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return bt(this,`includes`,e)},indexOf(...e){return bt(this,`indexOf`,e)},join(e){return ft(this).join(e)},lastIndexOf(...e){return bt(this,`lastIndexOf`,e)},map(e,t){return vt(this,`map`,e,t,void 0,arguments)},pop(){return xt(this,`pop`)},push(...e){return xt(this,`push`,e)},reduce(e,...t){return yt(this,`reduce`,e,t)},reduceRight(e,...t){return yt(this,`reduceRight`,e,t)},shift(){return xt(this,`shift`)},some(e,t){return vt(this,`some`,e,t,void 0,arguments)},splice(...e){return xt(this,`splice`,e)},toReversed(){return ft(this).toReversed()},toSorted(e){return ft(this).toSorted(e)},toSpliced(...e){return ft(this).toSpliced(...e)},unshift(...e){return xt(this,`unshift`,e)},values(){return gt(this,`values`,e=>mt(this,e))}};function gt(e,t,n){let r=pt(e),i=r[t]();return r!==e&&!Zt(e)&&(i._next=i.next,i.next=()=>{let e=i._next();return e.done||(e.value=n(e.value)),e}),i}var _t=Array.prototype;function vt(e,t,n,r,i,a){let o=pt(e),s=o!==e&&!Zt(e),c=o[t];if(c!==_t[t]){let t=c.apply(e,a);return s?en(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,mt(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 yt(e,t,n,r){let i=pt(e),a=i!==e&&!Zt(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=mt(e,t)),n.call(this,t,mt(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?mt(e,c):c}function bt(e,t,n){let r=O(e);ut(r,`iterate`,lt);let i=r[t](...n);return(i===-1||i===!1)&&Qt(n[0])?(n[0]=O(n[0]),r[t](...n)):i}function xt(e,t,n=[]){$e(),Ue();let r=O(e)[t].apply(e,n);return We(),et(),r}var St=n(`__proto__,__v_isRef,__isVue`),Ct=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(y));function wt(e){y(e)||(e=String(e));let t=O(this);return ut(t,`has`,e),t.hasOwnProperty(e)}var Tt=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?Ut:Ht:i?Vt:Bt).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=p(e);if(!r){let e;if(a&&(e=ht[t]))return e;if(t===`hasOwnProperty`)return wt}let o=Reflect.get(e,t,nn(e)?e:n);if((y(t)?Ct.has(t):St(t))||(r||ut(e,`get`,t),i))return o;if(nn(o)){let e=a&&re(t)?o:o.value;return r&&b(e)?qt(e):e}return b(o)?r?qt(o):Gt(o):o}},Et=class extends Tt{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=p(e)&&re(t);if(!this._isShallow){let e=Xt(i);if(!Zt(n)&&!Xt(n)&&(i=O(i),n=O(n)),!a&&nn(i)&&!nn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:f(e,t),s=Reflect.set(e,t,n,nn(e)?e:r);return e===O(r)&&s&&(o?C(n,i)&&dt(e,`set`,t,n,i):dt(e,`add`,t,n)),s}deleteProperty(e,t){let n=f(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&dt(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!y(t)||!Ct.has(t))&&ut(e,`has`,t),n}ownKeys(e){return ut(e,`iterate`,p(e)?`length`:st),Reflect.ownKeys(e)}},Dt=class extends Tt{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Ot=new Et,kt=new Dt,At=new Et(!0),jt=e=>e,Mt=e=>Reflect.getPrototypeOf(e);function Nt(e,t,n){return function(...r){let i=this.__v_raw,a=O(i),o=m(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,u=i[e](...r),d=n?jt:t?tn:en;return!t&&ut(a,`iterate`,c?ct:st),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 Pt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Ft(e,t){let n={get(n){let r=this.__v_raw,i=O(r),a=O(n);e||(C(n,a)&&ut(i,`get`,n),ut(i,`get`,a));let{has:o}=Mt(i),s=t?jt:e?tn:en;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&&ut(O(t),`iterate`,st),t.size},has(t){let n=this.__v_raw,r=O(n),i=O(t);return e||(C(t,i)&&ut(r,`has`,t),ut(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=O(a),s=t?jt:e?tn:en;return!e&&ut(o,`iterate`,st),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return l(n,e?{add:Pt(`add`),set:Pt(`set`),delete:Pt(`delete`),clear:Pt(`clear`)}:{add(e){let n=O(this),r=Mt(n),i=O(e),a=!t&&!Zt(e)&&!Xt(e)?i:e;return r.has.call(n,a)||C(e,a)&&r.has.call(n,e)||C(i,a)&&r.has.call(n,i)||(n.add(a),dt(n,`add`,a,a)),this},set(e,n){!t&&!Zt(n)&&!Xt(n)&&(n=O(n));let r=O(this),{has:i,get:a}=Mt(r),o=i.call(r,e);o||=(e=O(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?C(n,s)&&dt(r,`set`,e,n,s):dt(r,`add`,e,n),this},delete(e){let t=O(this),{has:n,get:r}=Mt(t),i=n.call(t,e);i||=(e=O(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&dt(t,`delete`,e,void 0,a),o},clear(){let e=O(this),t=e.size!==0,n=e.clear();return t&&dt(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=Nt(r,e,t)}),n}function It(e,t){let n=Ft(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 Lt={get:It(!1,!1)},Rt={get:It(!1,!0)},zt={get:It(!0,!1)},Bt=new WeakMap,Vt=new WeakMap,Ht=new WeakMap,Ut=new WeakMap;function Wt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Gt(e){return Xt(e)?e:Jt(e,!1,Ot,Lt,Bt)}function Kt(e){return Jt(e,!1,At,Rt,Vt)}function qt(e){return Jt(e,!0,kt,zt,Ht)}function Jt(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=Wt(te(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Yt(e){return Xt(e)?Yt(e.__v_raw):!!(e&&e.__v_isReactive)}function Xt(e){return!!(e&&e.__v_isReadonly)}function Zt(e){return!!(e&&e.__v_isShallow)}function Qt(e){return e?!!e.__v_raw:!1}function O(e){let t=e&&e.__v_raw;return t?O(t):e}function $t(e){return!f(e,`__v_skip`)&&Object.isExtensible(e)&&pe(e,`__v_skip`,!0),e}var en=e=>b(e)?Gt(e):e,tn=e=>b(e)?qt(e):e;function nn(e){return e?e.__v_isRef===!0:!1}function k(e){return an(e,!1)}function rn(e){return an(e,!0)}function an(e,t){return nn(e)?e:new on(e,t)}var on=class{constructor(e,t){this.dep=new it,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:O(e),this._value=t?e:en(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||Zt(e)||Xt(e);e=n?e:O(e),C(e,t)&&(this._rawValue=e,this._value=n?e:en(e),this.dep.trigger())}};function A(e){return nn(e)?e.value:e}var sn={get:(e,t,n)=>t===`__v_raw`?e:A(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return nn(i)&&!nn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function cn(e){return Yt(e)?e:new Proxy(e,sn)}var ln=class{constructor(e){this.__v_isRef=!0,this._value=void 0;let t=this.dep=new it,{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 un(e){return new ln(e)}var dn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new it(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=nt-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&D!==this)return He(this,!0),!0}get value(){let e=this.dep.track();return Je(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function fn(e,t,n=!1){let r,i;return _(e)?r=e:(r=e.get,i=e.set),new dn(r,i,n)}var pn={},mn=new WeakMap,hn=void 0;function gn(e,t=!1,n=hn){if(n){let t=mn.get(n);t||mn.set(n,t=[]),t.push(e)}}function _n(e,t,n=r){let{immediate:i,deep:o,once:s,scheduler:c,augmentJob:l,call:d}=n,f=e=>o?e:Zt(e)||o===!1||o===0?vn(e,1):vn(e),m,h,g,v,y=!1,b=!1;if(nn(e)?(h=()=>e.value,y=Zt(e)):Yt(e)?(h=()=>f(e),y=!0):p(e)?(b=!0,y=e.some(e=>Yt(e)||Zt(e)),h=()=>e.map(e=>{if(nn(e))return e.value;if(Yt(e))return f(e);if(_(e))return d?d(e,2):e()})):h=_(e)?t?d?()=>d(e,2):e:()=>{if(g){$e();try{g()}finally{et()}}let t=hn;hn=m;try{return d?d(e,3,[v]):e(v)}finally{hn=t}}:a,t&&o){let e=h,t=o===!0?1/0:o;h=()=>vn(e(),t)}let ee=Ie(),x=()=>{m.stop(),ee&&ee.active&&u(ee.effects,m)};if(s&&t){let e=t;t=(...t)=>{let n=e(...t);return x(),n}}let S=b?Array(e.length).fill(pn):pn,te=e=>{if(m.flags&1&&(m.dirty||e)){if(t){let n=m.run();if(e||o||y||(b?n.some((e,t)=>C(e,S[t])):C(n,S))){g&&g();let e=hn;hn=m;try{let e=[n,S===pn?void 0:b&&S[0]===pn?[]:S,v];S=n,d?d(t,3,e):t(...e)}finally{hn=e}}}else m.run()}};return l&&l(te),m=new Re(h),m.scheduler=c?()=>c(te,!1):te,v=e=>gn(e,!1,m),g=m.onStop=()=>{let e=mn.get(m);if(e){if(d)d(e,4);else for(let t of e)t();mn.delete(m)}},t?i?te(!0):S=m.run():c?c(te.bind(null,!0),!0):m.run(),x.pause=m.pause.bind(m),x.resume=m.resume.bind(m),x.stop=x,x}function vn(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--,nn(e))vn(e.value,t,n);else if(p(e))for(let r=0;r<e.length;r++)vn(e[r],t,n);else if(h(e)||m(e))e.forEach(e=>{vn(e,t,n)});else if(ne(e)){for(let r in e)vn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&vn(e[r],t,n)}return e}function yn(e,t,n,r){try{return r?e(...r):e()}catch(e){xn(e,t,n)}}function bn(e,t,n,r){if(_(e)){let i=yn(e,t,n,r);return i&&ee(i)&&i.catch(e=>{xn(e,t,n)}),i}if(p(e)){let i=[];for(let a=0;a<e.length;a++)i.push(bn(e[a],t,n,r));return i}}function xn(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){$e(),yn(o,null,10,[e,i,a]),et();return}}Sn(e,n,a,i,s)}function Sn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var Cn=[],wn=-1,Tn=[],En=null,Dn=0,On=Promise.resolve(),kn=null;function An(e){let t=kn||On;return e?t.then(this?e.bind(this):e):t}function jn(e){let t=wn+1,n=Cn.length;for(;t<n;){let r=t+n>>>1,i=Cn[r],a=Ln(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Mn(e){if(!(e.flags&1)){let t=Ln(e),n=Cn[Cn.length-1];!n||!(e.flags&2)&&t>=Ln(n)?Cn.push(e):Cn.splice(jn(t),0,e),e.flags|=1,Nn()}}function Nn(){kn||=On.then(Rn)}function Pn(e){if(!p(e))En&&e.id===-1?En.splice(Dn+1,0,e):e.flags&1||(Tn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Tn.push(e[t]);Nn()}function Fn(e,t,n=wn+1){for(;n<Cn.length;n++){let t=Cn[n];if(t&&t.flags&2){if(e&&t.id!==e.uid)continue;Cn.splice(n,1),n--,t.flags&4&&(t.flags&=-2),t(),t.flags&4||(t.flags&=-2)}}}function In(e){if(Tn.length){let e=[...new Set(Tn)].sort((e,t)=>Ln(e)-Ln(t));if(Tn.length=0,En){for(let t=0;t<e.length;t++)En.push(e[t]);return}for(En=e,Dn=0;Dn<En.length;Dn++){let e=En[Dn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}En=null,Dn=0}}var Ln=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Rn(e){try{for(wn=0;wn<Cn.length;wn++){let e=Cn[wn];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),yn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;wn<Cn.length;wn++){let e=Cn[wn];e&&(e.flags&=-2)}wn=-1,Cn.length=0,In(e),kn=null,(Cn.length||Tn.length)&&Rn(e)}}var zn=null,Bn=null;function Vn(e){let t=zn;return zn=e,Bn=e&&e.type.__scopeId||null,t}function Hn(e,t=zn,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&Ea(-1);let i=Vn(t),a=Sa.length,o;try{o=e(...n)}finally{for(let e=Sa.length;e>a;e--)wa();Vn(i),r._d&&Ea(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Un(e,t){if(zn===null)return e;let n=ro(zn),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&&vn(o),i.push({dir:a,instance:n,value:o,oldValue:void 0,arg:s,modifiers:c}))}return e}function Wn(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&&($e(),bn(c,n,8,[e.el,s,e,t]),et())}}function Gn(e,t){if(Ua){let n=Ua.provides,r=Ua.parent&&Ua.parent.provides;r===n&&(n=Ua.provides=Object.create(r)),n[e]=t}}function Kn(e,t,n=!1){let r=Wa();if(r||Oi){let i=Oi?Oi._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 qn=Symbol.for(`v-scx`),Jn=()=>Kn(qn);function Yn(e,t){return Xn(e,null,{flush:`sync`})}function j(e,t,n){return Xn(e,t,n)}function Xn(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(Xa){if(s===`sync`){let e=Jn();f=e.__watcherHandles||=[]}else if(!d){let e=()=>{};return e.stop=a,e.resume=a,e.pause=a,e}}let p=Ua;u.call=(e,t,n)=>bn(e,p,t,n);let m=!1;s===`post`?u.scheduler=e=>{oa(e,p&&p.suspense)}:s!==`sync`&&(m=!0,u.scheduler=(e,t)=>{t?e():Mn(e)}),u.augmentJob=e=>{t&&(e.flags|=4),m&&(e.flags|=2,p&&(e.id=p.uid,e.i=p))};let h=_n(e,t,u);return Xa&&(f?f.push(h):d&&h()),h}function Zn(e,t,n){let r=this.proxy,i=v(e)?e.includes(`.`)?Qn(r,e):()=>r[e]:e.bind(r,r),a;_(t)?a=t:(a=t.handler,n=t);let o=qa(this),s=Xn(i,a.bind(r),n);return o(),s}function Qn(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 $n=new WeakMap,er=Symbol(`_vte`),tr=e=>e.__isTeleport,nr=e=>e&&(e.disabled||e.disabled===``),rr=e=>e&&(e.defer||e.defer===``),ir=e=>typeof SVGElement<`u`&&e instanceof SVGElement,ar=e=>typeof MathMLElement==`function`&&e instanceof MathMLElement,or=(e,t)=>{let n=e&&e.to;return v(n)?t?t(n):null:n},sr={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=nr(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=nr(e.props),r=e.target=or(e.props,m),a=fr(r,e,h,p);r&&(o!==`svg`&&ir(r)?o=`svg`:o!==`mathml`&&ar(r)&&(o=`mathml`),i&&i.isCE&&(i.ce._teleportTargets||(i.ce._teleportTargets=new Set)).add(r),n||(b(e,r,a),dr(e,!1)))},x=e=>{let t=()=>{if($n.get(e)===t){if($n.delete(e),nr(e.props)){let t=_(e.el)||n;b(e,t,e.anchor),dr(e,!0)}ee(e)}};$n.set(e,t),oa(t,a)};if(e==null){let e=t.el=h(``),i=t.anchor=h(``);if(p(e,n,r),p(i,n,r),rr(t.props)||a&&a.pendingBranch){x(t);return}v&&(b(t,n,i),dr(t,!0)),ee()}else{t.el=e.el;let r=t.anchor=e.anchor,u=$n.get(e);if(u){u.flags|=8,$n.delete(e),x(t);return}t.targetStart=e.targetStart;let p=t.target=e.target,h=t.targetAnchor=e.targetAnchor,g=nr(e.props),_=g?n:p,b=g?r:h;if(o===`svg`||ir(p)?o=`svg`:(o===`mathml`||ar(p))&&(o=`mathml`),y?(f(e.dynamicChildren,y,_,i,a,o,s),fa(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):cr(t,n,r,l,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){let e=or(t.props,m);e&&(t.target=e,cr(t,e,null,l,0))}else g&&cr(t,p,h,l,1);dr(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=nr(f),m=a||!p,h=$n.get(e);if(h&&(h.flags|=8,$n.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:cr,hydrate:lr};function cr(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),!$n.has(e)&&(!d||nr(u))&&c&16)for(let e=0;e<l.length;e++)i(l[e],t,n,2);d&&r(s,t,n)}function lr(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=or(t.props,c),h=nr(t.props);if(m){let c=m._lpa||m.firstChild;t.shapeFlag&16&&(h?(p(e,t),f(m,c),t.targetAnchor||fr(m,t,u,l,s(e)===m?e:null)):(t.anchor=o(e),f(m,c),t.targetAnchor||fr(m,t,u,l),d(c&&o(c),t,m,n,r,i,a))),dr(t,h)}else h&&t.shapeFlag&16&&(p(e,t),t.targetStart=e,t.targetAnchor=o(e));return t.anchor&&o(t.anchor)}var ur=sr;function dr(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 fr(e,t,n,r,i=null){let a=t.targetStart=n(``),o=t.targetAnchor=n(``);return a[er]=o,e&&(r(a,e,i),r(o,e,i)),o}var pr=Symbol(`_leaveCb`),mr=Symbol(`_enterCb`);function hr(){let e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Ur(()=>{e.isMounted=!0}),Kr(()=>{e.isUnmounting=!0}),e}var gr=[Function,Array],_r={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:gr,onEnter:gr,onAfterEnter:gr,onEnterCancelled:gr,onBeforeLeave:gr,onLeave:gr,onAfterLeave:gr,onLeaveCancelled:gr,onBeforeAppear:gr,onAppear:gr,onAfterAppear:gr,onAppearCancelled:gr},vr=e=>{let t=e.subTree;return t.component?vr(t.component):t},yr={name:`BaseTransition`,props:_r,setup(e,{slots:t}){let n=Wa(),r=hr();return()=>{let i=t.default&&Dr(t.default(),!0),a=i&&i.length?br(i):n.subTree?B():void 0;if(!a)return;let o=O(e),{mode:s}=o;if(r.isLeaving)return wr(a);let c=Tr(a);if(!c)return wr(a);let l=Cr(c,o,r,n,e=>l=e);c.type!==ba&&Er(c,l);let u=n.subTree&&Tr(n.subTree);if(u&&u.type!==ba&&!ka(u,c)&&vr(n).type!==ba){let e=Cr(u,o,r,n);if(Er(u,e),s===`out-in`&&c.type!==ba)return r.isLeaving=!0,e.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete e.afterLeave,u=void 0},wr(a);s===`in-out`&&c.type!==ba?e.delayLeave=(e,t,n)=>{let i=Sr(r,u);i[String(u.key)]=u,e[pr]=()=>{t(),e[pr]=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 br(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==ba){t=n;break}}return t}var xr=yr;function Sr(e,t){let{leavingVNodes:n}=e,r=n.get(t.type);return r||(r=Object.create(null),n.set(t.type,r)),r}function Cr(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),x=Sr(n,e),S=(e,t)=>{e&&bn(e,r,9,t)},te=(e,t)=>{let n=t[1];S(e,t),p(e)?e.every(e=>e.length<=1)&&n():e.length<=1&&n()},ne={mode:o,persisted:s,beforeEnter(t){let r=c;if(!n.isMounted){if(a)r=_||c;else return}t[pr]&&t[pr](!0);let i=x[ee];i&&ka(e,i)&&i.el[pr]&&i.el[pr](),S(r,[t])},enter(t){if(x[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[mr]=e=>{s||(s=!0,S(e?o:i,[t]),ne.delayedLeave&&ne.delayedLeave(),t[mr]=void 0)};let c=t[mr].bind(null,!1);r?te(r,[t,c]):c()},leave(t,r){let i=String(e.key);if(t[mr]&&t[mr](!0),n.isUnmounting)return r();S(f,[t]);let a=!1;t[pr]=n=>{a||(a=!0,r(),S(n?g:h,[t]),t[pr]=void 0,x[i]===e&&delete x[i])};let o=t[pr].bind(null,!1);x[i]=e,m?te(m,[t,o]):o()},clone(e){let a=Cr(e,t,n,r,i);return i&&i(a),a}};return ne}function wr(e){if(Fr(e))return e=Pa(e),e.children=null,e}function Tr(e){if(!Fr(e))return tr(e.type)&&e.children?br(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 Er(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;Er(tr(n.type)&&Tr(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 Dr(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===N?(o.patchFlag&128&&i++,r=r.concat(Dr(o.children,t,s))):(t||o.type!==ba)&&r.push(s==null?o:Pa(o,{key:s}))}if(i>1)for(let e=0;e<r.length;e++)r[e].patchFlag=-2;return r}function Or(e,t){return _(e)?l({name:e.name},t,{setup:e}):e}function kr(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function Ar(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var jr=new WeakMap;function Mr(e,t,n,i,a=!1){if(p(e)){e.forEach((e,r)=>Mr(e,t&&(p(t)?t[r]:t),n,i,a));return}if(Pr(i)&&!a){i.shapeFlag&512&&i.type.__asyncResolved&&i.component.subTree.component&&Mr(e,t,n,i.component.subTree);return}let s=i.shapeFlag&4?ro(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=O(g),b=g===r?o:e=>!Ar(h,e)&&f(y,e),ee=(e,t)=>!(t&&Ar(h,t));if(m!=null&&m!==d){if(Nr(t),v(m))h[m]=null,b(m)&&(g[m]=null);else if(nn(m)){let e=t;ee(m,e.k)&&(m.value=null),e.k&&(h[e.k]=null)}}if(_(d))yn(d,l,12,[c,h]);else{let t=v(d),r=nn(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(),jr.delete(e)};t.id=-1,jr.set(e,t),oa(t,n)}else Nr(e),i()}}}function Nr(e){let t=jr.get(e);t&&(t.flags|=8,jr.delete(e))}_e().requestIdleCallback,_e().cancelIdleCallback;var Pr=e=>!!e.type.__asyncLoader,Fr=e=>e.type.__isKeepAlive;function Ir(e,t){Rr(e,`a`,t)}function Lr(e,t){Rr(e,`da`,t)}function Rr(e,t,n=Ua){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Br(t,r,n),n){let e=n.parent;for(;e&&e.parent;)Fr(e.parent.vnode)&&zr(r,t,n,e),e=e.parent}}function zr(e,t,n,r){let i=Br(t,e,r,!0);qr(()=>{u(r[t],i)},n)}function Br(e,t,n=Ua,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{$e();let i=qa(n),a=bn(t,n,e,r);return i(),et(),a};return r?i.unshift(a):i.push(a),a}}var Vr=e=>(t,n=Ua)=>{(!Xa||e===`sp`)&&Br(e,(...e)=>t(...e),n)},Hr=Vr(`bm`),Ur=Vr(`m`),Wr=Vr(`bu`),Gr=Vr(`u`),Kr=Vr(`bum`),qr=Vr(`um`),Jr=Vr(`sp`),Yr=Vr(`rtg`),Xr=Vr(`rtc`);function Zr(e,t=Ua){Br(`ec`,e,t)}var Qr=`components`;function $r(e,t){return ni(Qr,e,!0,t)||e}var ei=Symbol.for(`v-ndc`);function ti(e){return v(e)?ni(Qr,e,!1)||e:e||ei}function ni(e,t,n=!0,r=!1){let i=zn||Ua;if(i){let n=i.type;if(e===Qr){let e=io(n,!1);if(e&&(e===t||e===se(t)||e===ue(se(t))))return n}let a=ri(i[e]||n[e],t)||ri(i.appContext[e],t);return!a&&r?n:a}}function ri(e,t){return e&&(e[t]||e[se(t)]||e[ue(se(t))])}function M(e,t,n,r){let i,a=n&&n[r],o=p(e);if(o||v(e)){let n=o&&Yt(e),r=!1,s=!1;n&&(r=!Zt(e),s=Xt(e),e=pt(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?tn(en(e[n])):en(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 ii=e=>e?Ya(e)?ro(e):ii(e.parent):null,ai=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=>ii(e.parent),$root:e=>ii(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>hi(e),$forceUpdate:e=>e.f||=()=>{Mn(e.update)},$nextTick:e=>e.n||=An.bind(e.proxy),$watch:e=>Zn.bind(e)}),oi=(e,t)=>e!==r&&!e.__isScriptSetup&&f(e,t),si={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(oi(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 ui&&(s[t]=0)}let u=ai[t],d,p;if(u)return t===`$attrs`&&ut(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 oi(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)||oi(t,c)||f(o,c)||f(i,c)||f(ai,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 ci(e){return p(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}function li(e,t){return!e||!t?e||t:p(e)&&p(t)?e.concat(t):l({},ci(e),ci(t))}var ui=!0;function di(e){let t=hi(e),n=e.proxy,r=e.ctx;ui=!1,t.beforeCreate&&pi(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:x,destroyed:S,unmounted:te,render:ne,renderTracked:re,renderTriggered:ie,errorCaptured:ae,serverPrefetch:oe,expose:se,inheritAttrs:ce,components:le,directives:ue,filters:de}=t;if(u&&fi(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=Gt(t))}if(ui=!0,o)for(let e in o){let t=o[e],i=V({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)mi(c[e],r,n,e);if(l){let e=_(l)?l.call(n):l;Reflect.ownKeys(e).forEach(t=>{Gn(t,e[t])})}d&&pi(d,e,`c`);function C(e,t){p(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(C(Hr,f),C(Ur,m),C(Wr,h),C(Gr,g),C(Ir,v),C(Lr,y),C(Zr,ae),C(Xr,re),C(Yr,ie),C(Kr,x),C(qr,te),C(Jr,oe),p(se)){if(se.length){let t=e.exposed||={};se.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}ne&&e.render===a&&(e.render=ne),ce!=null&&(e.inheritAttrs=ce),le&&(e.components=le),ue&&(e.directives=ue),oe&&kr(e)}function fi(e,t,n=a){p(e)&&(e=bi(e));for(let n in e){let r=e[n],i;i=b(r)?`default`in r?Kn(r.from||n,r.default,!0):Kn(r.from||n):Kn(r),nn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function pi(e,t,n){bn(p(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function mi(e,t,n,r){let i=r.includes(`.`)?Qn(n,r):()=>n[r];if(v(e)){let n=t[e];_(n)&&j(i,n)}else if(_(e))j(i,e.bind(n));else if(b(e)){if(p(e))e.forEach(e=>mi(e,t,n,r));else{let r=_(e.handler)?e.handler.bind(n):t[e.handler];_(r)&&j(i,r,e)}}}function hi(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=>gi(c,e,o,!0)),gi(c,t,o)),b(t)&&a.set(t,c),c}function gi(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&gi(e,a,n,!0),i&&i.forEach(t=>gi(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=_i[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var _i={data:vi,props:Ci,emits:Ci,methods:Si,computed:Si,beforeCreate:xi,created:xi,beforeMount:xi,mounted:xi,beforeUpdate:xi,updated:xi,beforeDestroy:xi,beforeUnmount:xi,destroyed:xi,unmounted:xi,activated:xi,deactivated:xi,errorCaptured:xi,serverPrefetch:xi,components:Si,directives:Si,watch:wi,provide:vi,inject:yi};function vi(e,t){return t?e?function(){return l(_(e)?e.call(this,this):e,_(t)?t.call(this,this):t)}:t:e}function yi(e,t){return Si(bi(e),bi(t))}function bi(e){if(p(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function xi(e,t){return e?[...new Set([].concat(e,t))]:t}function Si(e,t){return e?l(Object.create(null),e,t):t}function Ci(e,t){return e?p(e)&&p(t)?[...new Set([...e,...t])]:l(Object.create(null),ci(e),ci(t??{})):t}function wi(e,t){if(!e)return t;if(!t)return e;let n=l(Object.create(null),e);for(let r in t)n[r]=xi(e[r],t[r]);return n}function Ti(){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 Ei=0;function Di(e,t){return function(n,r=null){_(n)||(n=l({},n)),r!=null&&!b(r)&&(r=null);let i=Ti(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:Ei++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:so,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||R(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,ro(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(bn(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=Oi;Oi=c;try{return e()}finally{Oi=t}}};return c}}var Oi=null;function ki(e,t,n=r){let i=Wa(),a=se(t),o=le(t),s=Ai(e,a),c=un((s,c)=>{let l,u=r,d;return Yn(()=>{let t=e[a];C(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(!C(s,l)&&!(u!==r&&C(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),C(e,u)&&(C(e,s)&&!C(s,d)||p&&u!==r&&!C(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 Ai=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${se(t)}Modifiers`]||e[`${le(t)}Modifiers`];function ji(e,t,...n){if(e.isUnmounted)return;let i=e.vnode.props||r,a=n,o=t.startsWith(`update:`),s=o&&Ai(i,t.slice(7));s&&(s.trim&&(a=n.map(e=>v(e)?e.trim():e)),s.number&&(a=a.map(me)));let c,l=i[c=de(t)]||i[c=de(se(t))];!l&&o&&(l=i[c=de(le(t))]),l&&bn(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,bn(u,e,6,a)}}var Mi=new WeakMap;function Ni(e,t,n=!1){let r=n?Mi: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=Ni(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 Pi(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,le(t))||f(e,t))}function Fi(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,_=Vn(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=Fa(u.call(t,e,d,f,m,p,h)),y=s}else{let e=t;v=Fa(e.length>1?e(f,{attrs:s,slots:o,emit:l}):e(f,null)),y=t.props?s:Ii(s)}}catch(t){Sa.length=0,xn(t,e,1),v=R(ba)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(c)&&(y=Li(y,a)),b=Pa(b,y,!1,!0))}return n.dirs&&(b=Pa(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&Er(tr(b.type)&&Tr(b)||b,n.transition),v=b,Vn(_),v}var Ii=e=>{let t;for(let n in e)(n===`class`||n===`style`||s(n))&&((t||={})[n]=e[n]);return t},Li=(e,t)=>{let n={};for(let r in e)(!c(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function Ri(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?zi(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(Bi(o,r,n)&&!Pi(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||zi(r,o,l):!!o;return!1}function zi(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(Bi(t,e,a)&&!Pi(n,a))return!0}return!1}function Bi(e,t,n){let r=e[n],i=t[n];return n===`style`&&b(r)&&b(i)?!ke(r,i):r!==i}function Vi({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 Hi={},Ui=()=>Object.create(Hi),Wi=e=>Object.getPrototypeOf(e)===Hi;function Gi(e,t,n,r=!1){let i={},a=Ui();e.propsDefaults=Object.create(null),qi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:Kt(i):e.type.props?i:a,e.attrs=a}function Ki(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=O(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(Pi(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=se(o);i[t]=Ji(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{qi(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!f(t,a)&&((r=le(a))===a||!f(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Ji(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&&dt(e.attrs,`set`,``)}function qi(e,t,n,i){let[a,o]=e.propsOptions,s=!1,c;if(t)for(let r in t){if(ie(r))continue;let l=t[r],u;a&&f(a,u=se(r))?!o||!o.includes(u)?n[u]=l:(c||={})[u]=l:Pi(e.emitsOptions,r)||(!(r in i)||l!==i[r])&&(i[r]=l,s=!0)}if(o){let t=O(n),i=c||r;for(let r=0;r<o.length;r++){let s=o[r];n[s]=Ji(a,t,s,i[s],e,!f(i,s))}}return s}function Ji(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=qa(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===le(n))&&(r=!0))}return r}var Yi=new WeakMap;function Xi(e,t,n=!1){let a=n?Yi: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]=Xi(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=se(s[e]);Zi(t)&&(c[t]=r)}else if(s)for(let e in s){let t=se(e);if(Zi(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 Zi(e){return e[0]!==`$`&&!ie(e)}var Qi=e=>e===`_`||e===`_ctx`||e===`$stable`,$i=e=>p(e)?e.map(Fa):[Fa(e)],ea=(e,t,n)=>{if(t._n)return t;let r=Hn((...e)=>$i(t(...e)),n);return r._c=!1,r},ta=(e,t,n)=>{let r=e._ctx;for(let n in e){if(Qi(n))continue;let i=e[n];if(_(i))t[n]=ea(n,i,r);else if(i!=null){let e=$i(i);t[n]=()=>e}}},na=(e,t)=>{let n=$i(t);e.slots.default=()=>n},ra=(e,t,n)=>{for(let r in t)(n||!Qi(r))&&(e[r]=t[r])},ia=(e,t,n)=>{let r=e.slots=Ui();if(e.vnode.shapeFlag&32){let e=t._;e?(ra(r,t,n),n&&pe(r,`_`,e,!0)):ta(t,r)}else t&&na(e,t)},aa=(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:ra(a,t,n):(o=!t.$stable,ta(t,a)),s=t}else t&&(na(e,t),s={default:1});if(o)for(let e in a)!Qi(e)&&s[e]==null&&delete a[e]},oa=va;function sa(e){return ca(e)}function ca(e,t){let n=_e();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&&!ka(e,t)&&(r=we(e),be(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 ya:y(e,t,n,r);break;case ba:b(e,t,n,r);break;case xa:e??ee(t,n,r,s);break;case N:le(e,t,n,r,a,o,s,c,l);break;default:f&1?te(e,t,n,r,a,o,s,c,l):f&6?ue(e,t,n,r,a,o,s,c,l):(f&64||f&128)&&u.process(e,t,n,r,a,o,s,c,l,Ee)}d!=null&&a?Mr(d,e&&e.ref,o,t||e,!t):d==null&&e&&e.ref!=null&&Mr(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)},x=({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)},S=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),s(e),e=n;s(t)},te=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)ne(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),oe(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},ne=(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&&ae(e.children,d,null,r,i,la(e,a),s,u),_&&Wn(e,null,r,`created`),re(d,e,e.scopeId,s,r),m){for(let e in m)e!==`value`&&!ie(e)&&c(d,e,null,m[e],a,r);`value`in m&&c(d,`value`,null,m.value,a),(f=m.onVnodeBeforeMount)&&za(f,r,e)}_&&Wn(e,null,r,`beforeMount`);let v=da(i,g);v&&g.beforeEnter(d),o(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&oa(()=>{try{f&&za(f,r,e),v&&g.enter(d),_&&Wn(e,null,r,`mounted`)}finally{}},i)},re=(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||_a(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;re(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},ae=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?Ia(e[l]):Fa(e[l]);v(null,c,t,n,r,i,a,o,s)}},oe=(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&&ua(n,!1),(g=h.onVnodeBeforeUpdate)&&za(g,n,t,e),f&&Wn(t,e,n,`beforeUpdate`),n&&ua(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?se(e.dynamicChildren,d,l,n,i,la(t,a),o):s||he(e,t,l,null,n,i,la(t,a),o,!1),u>0){if(u&16)ce(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&&ce(l,m,h,n,a);((g=h.onVnodeUpdated)||f)&&oa(()=>{g&&za(g,n,t,e),f&&Wn(t,e,n,`updated`)},i)},se=(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===N||!ka(c,l)||c.shapeFlag&198)?m(c.el):n;v(c,l,u,null,r,i,a,o,!0)}},ce=(e,t,n,i,a)=>{if(t!==n){if(t!==r)for(let r in t)!ie(r)&&!(r in n)&&c(e,r,t[r],null,a,i);for(let r in n){if(ie(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)}},le=(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),ae(t.children||[],n,f,i,a,s,c,l)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(se(e.dynamicChildren,m,n,i,a,s,c),(t.key!=null||i&&t===i.subTree)&&fa(e,t,!0)):he(e,t,n,f,i,a,s,c,l)},ue=(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):de(t,n,r,i,a,o,c):C(e,t,c)},de=(e,t,n,r,i,a,o)=>{let s=e.component=Ha(e,r,i);if(Fr(e)&&(s.ctx.renderer=Ee),Za(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,pe,o),!e.el){let r=s.subTree=R(ba);b(null,r,t,n),e.placeholder=r.el}}else pe(s,e,t,n,i,a,o)},C=(e,t,n)=>{let r=t.component=e.component;if(Ri(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,me(r,t,n);return}r.next=t,r.update()}else t.el=e.el,r.vnode=t},pe=(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=ma(e);if(n){t&&(t.el=c.el,me(e,t,o)),n.asyncDep.then(()=>{oa(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;ua(e,!1),t?(t.el=c.el,me(e,t,o)):t=c,n&&fe(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&za(d,s,t,c),ua(e,!0);let f=Fi(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),we(p),e,i,a),t.el=f.el,u===null&&Vi(e,f.el),r&&oa(r,i),(d=t.props&&t.props.onVnodeUpdated)&&oa(()=>za(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=Pr(t);if(ua(e,!1),l&&fe(l),!m&&(o=c&&c.onVnodeBeforeMount)&&za(o,d,t),ua(e,!0),s&&Oe){let t=()=>{e.subTree=Fi(e),Oe(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=Fi(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&oa(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;oa(()=>za(o,d,e),i)}(t.shapeFlag&256||d&&Pr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&oa(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Re(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=()=>Mn(u),ua(e,!0),l()},me=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Ki(e,t.props,r,n),aa(e,t.children,n),$e(),Fn(e),et()},he=(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){ve(l,d,n,r,i,a,o,s,c);return}if(f&256){ge(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&Ce(l,i,a),d!==l&&p(n,d)):u&16?m&16?ve(l,d,n,r,i,a,o,s,c):Ce(l,i,a,!0):(u&8&&p(n,``),m&16&&ae(d,n,r,i,a,o,s,c))},ge=(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?Ia(t[p]):Fa(t[p]);v(e[p],r,n,null,a,o,s,c,l)}u>d?Ce(e,a,o,!0,!1,f):ae(t,n,r,a,o,s,c,l,f)},ve=(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?Ia(t[u]):Fa(t[u]);if(ka(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?Ia(t[p]):Fa(t[p]);if(ka(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?Ia(t[u]):Fa(t[u]),n,i,a,o,s,c,l),u++}}else if(u>p)for(;u<=f;)be(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?Ia(t[u]):Fa(t[u]);e.key!=null&&g.set(e.key,u)}let _,y=0,b=p-h+1,ee=!1,x=0,S=Array(b);for(u=0;u<b;u++)S[u]=0;for(u=m;u<=f;u++){let r=e[u];if(y>=b){be(r,a,o,!0);continue}let i;if(r.key!=null)i=g.get(r.key);else for(_=h;_<=p;_++)if(S[_-h]===0&&ka(r,t[_])){i=_;break}i===void 0?be(r,a,o,!0):(S[i-h]=u+1,i>=x?x=i:ee=!0,v(r,t[i],n,null,a,o,s,c,l),y++)}let te=ee?pa(S):i;for(_=te.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||ga(f):r;S[u]===0?v(null,i,n,p,a,o,s,c,l):ee&&(_<0||u!==te[_]?ye(i,n,p,2):_--)}}},ye=(e,t,n,r,i=null)=>{let{el:a,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6){ye(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,Ee);return}if(c===N){o(a,t,n);for(let e=0;e<u.length;e++)ye(u[e],t,n,r);o(e.anchor,t,n);return}if(c===xa){x(e,t,n);return}if(r!==2&&d&1&&l){if(r===0)l.persisted&&!a[pr]?o(a,t,n):(l.beforeEnter(a),o(a,t,n),oa(()=>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[pr];a._isLeaving&&a[pr](!0),l.persisted&&!e?u():r(a,()=>{u(),c&&c()})};i?i(a,u,d):d()}}else o(a,t,n)},be=(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&&($e(),Mr(s,null,n,e,!0),et()),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=!Pr(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&za(_,t,e),u&6)w(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Wn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,Ee,r):l&&!l.hasOnce&&(a!==N||d>0&&d&64)?Ce(l,t,n,!1,!0):(a===N&&d&384||!i&&u&16)&&Ce(c,t,n),r&&xe(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&oa(()=>{_&&za(_,t,e),h&&Wn(e,null,t,`unmounted`),v&&(e.el=null)},n)},xe=e=>{let{type:t,el:n,anchor:r,transition:i}=e;if(t===N){Se(n,r);return}if(t===xa){S(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()},Se=(e,t)=>{let n;for(;e!==t;)n=h(e),s(e),e=n;s(t)},w=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;ha(c),ha(l),r&&fe(r),i.stop(),a?(a.flags|=8,be(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,be(o,e,t,n)),s&&oa(s,t),oa(()=>{e.isUnmounted=!0},t)},Ce=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)be(e[o],t,n,r,i)},we=e=>{if(e.shapeFlag&6)return we(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[er];return n?h(n):t},T=!1,Te=(e,t,n)=>{let r;e==null?t._vnode&&(be(t._vnode,null,null,!0),r=t._vnode.component):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e,T||=(T=!0,Fn(r),In(),!1)},Ee={p:v,um:be,m:ye,r:xe,mt:de,mc:ae,pc:he,pbc:se,n:we,o:e},De,Oe;return t&&([De,Oe]=t(Ee)),{render:Te,hydrate:De,createApp:Di(Te,De)}}function la({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 ua({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function da(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function fa(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]=Ia(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&fa(t,a)),a.type===ya&&(a.patchFlag===-1&&(a=i[e]=Ia(a)),a.el=t.el),a.type===ba&&!a.el&&(a.el=t.el)}}function pa(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 ma(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:ma(t)}function ha(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function ga(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?ga(t.subTree):null}var _a=e=>e.__isSuspense;function va(e,t){t&&t.pendingBranch?p(e)?t.effects.push(...e):t.effects.push(e):Pn(e)}var N=Symbol.for(`v-fgt`),ya=Symbol.for(`v-txt`),ba=Symbol.for(`v-cmt`),xa=Symbol.for(`v-stc`),Sa=[],Ca=null;function P(e=!1){Sa.push(Ca=e?null:[])}function wa(){Sa.pop(),Ca=Sa[Sa.length-1]||null}var Ta=1;function Ea(e,t=!1){Ta+=e,e<0&&Ca&&t&&(Ca.hasOnce=!0)}function Da(e){return e.dynamicChildren=Ta>0?Ca||i:null,wa(),Ta>0&&Ca&&Ca.push(e),e}function F(e,t,n,r,i,a){return Da(L(e,t,n,r,i,a,!0))}function I(e,t,n,r,i){return Da(R(e,t,n,r,i,!0))}function Oa(e){return e?e.__v_isVNode===!0:!1}function ka(e,t){return e.type===t.type&&e.key===t.key}var Aa=({key:e})=>e??null,ja=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:v(e)||nn(e)||_(e)?{i:zn,r:e,k:t,f:!!n}:e);function L(e,t=null,n=null,r=0,i=null,a=e===N?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Aa(t),ref:t&&ja(t),scopeId:Bn,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:zn};return s?(La(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=v(n)?8:16),Ta>0&&!o&&Ca&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&Ca.push(c),c}var R=Ma;function Ma(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===ei)&&(e=ba),Oa(e)){let r=Pa(e,t,!0);return n&&La(r,n),Ta>0&&!a&&Ca&&(r.shapeFlag&6?Ca[Ca.indexOf(e)]=r:Ca.push(r)),r.patchFlag=-2,r}if(ao(e)&&(e=e.__vccOpts),t){t=Na(t);let{class:e,style:n}=t;e&&!v(e)&&(t.class=w(e)),b(n)&&(Qt(n)&&!p(n)&&(n=l({},n)),t.style=ve(n))}let o=v(e)?1:_a(e)?128:tr(e)?64:b(e)?4:_(e)?2:0;return L(e,t,n,r,i,o,a,!0)}function Na(e){return e?Qt(e)||Wi(e)?l({},e):e:null}function Pa(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?Ra(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&Aa(l),ref:t&&t.ref?n&&a?p(a)?a.concat(ja(t)):[a,ja(t)]:ja(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!==N?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&&Pa(e.ssContent),ssFallback:e.ssFallback&&Pa(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&Er(u,c.clone(u)),u}function z(e=` `,t=0){return R(ya,null,e,t)}function B(e=``,t=!1){return t?(P(),I(ba,null,e)):R(ba,null,e)}function Fa(e){return e==null||typeof e==`boolean`?R(ba):p(e)?R(N,null,e.slice()):Oa(e)?Ia(e):R(ya,null,String(e))}function Ia(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Pa(e)}function La(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),La(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!Wi(t)?t._ctx=zn:r===3&&zn&&(zn.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(_(t)){if(r&65){La(e,{default:t});return}t={default:t,_ctx:zn},n=32}else t=String(t),r&64?(n=16,t=[z(t)]):n=8;e.children=t,e.shapeFlag|=n}function Ra(...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=w([t.class,r.class]));else if(e===`style`)t.style=ve([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 za(e,t,n,r=null){bn(e,t,7,[n,r])}var Ba=Ti(),Va=0;function Ha(e,t,n){let i=e.type,a=(t?t.appContext:e.appContext)||Ba,o={uid:Va++,vnode:e,type:i,parent:t,appContext:a,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Fe(!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:Xi(i,a),emitsOptions:Ni(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=ji.bind(null,o),e.ce&&e.ce(o),o}var Ua=null,Wa=()=>Ua||zn,Ga,Ka;{let e=_e(),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)}};Ga=t(`__VUE_INSTANCE_SETTERS__`,e=>Ua=e),Ka=t(`__VUE_SSR_SETTERS__`,e=>Xa=e)}var qa=e=>{let t=Ua;return Ga(e),e.scope.on(),()=>{e.scope.off(),Ga(t)}},Ja=()=>{Ua&&Ua.scope.off(),Ga(null)};function Ya(e){return e.vnode.shapeFlag&4}var Xa=!1;function Za(e,t=!1,n=!1){t&&Ka(t);let{props:r,children:i}=e.vnode,a=Ya(e);Gi(e,r,a,t),ia(e,i,n||t);let o=a?Qa(e,t):void 0;return t&&Ka(!1),o}function Qa(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,si);let{setup:r}=n;if(r){$e();let n=e.setupContext=r.length>1?no(e):null,i=qa(e),a=yn(r,e,0,[e.props,n]),o=ee(a);if(et(),i(),(o||e.sp)&&!Pr(e)&&kr(e),o){if(a.then(Ja,Ja),t)return a.then(n=>{Ka(!0);try{$a(e,n,t)}finally{Ka(!1)}}).catch(t=>{xn(t,e,0)});e.asyncDep=a}else $a(e,a,t)}else eo(e,t)}function $a(e,t,n){_(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:b(t)&&(e.setupState=cn(t)),eo(e,n)}function eo(e,t,n){let r=e.type;e.render||=r.render||a;{let t=qa(e);$e();try{di(e)}finally{et(),t()}}}var to={get(e,t){return ut(e,`get`,``),e[t]}};function no(e){return{attrs:new Proxy(e.attrs,to),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function ro(e){return e.exposed?e.exposeProxy||=new Proxy(cn($t(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in ai)return ai[n](e)},has(e,t){return t in e||t in ai}}):e.proxy}function io(e,t=!0){return _(e)?e.displayName||e.name:e.name||t&&e.__name}function ao(e){return _(e)&&`__vccOpts`in e}var V=(e,t)=>fn(e,t,Xa);function oo(e,t,n){try{Ea(-1);let r=arguments.length;return r===2?b(t)&&!p(t)?Oa(t)?R(e,null,[t]):R(e,t):R(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Oa(n)&&(n=[n]),R(e,t,n))}finally{Ea(1)}}var so=`3.5.43`,co=void 0,lo=typeof window<`u`&&window.trustedTypes;if(lo)try{co=lo.createPolicy(`vue`,{createHTML:e=>e})}catch{}var uo=co?e=>co.createHTML(e):e=>e,fo=`http://www.w3.org/2000/svg`,po=`http://www.w3.org/1998/Math/MathML`,mo=typeof document<`u`?document:null,ho=mo&&mo.createElement(`template`),go={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`?mo.createElementNS(fo,e):t===`mathml`?mo.createElementNS(po,e):n?mo.createElement(e,{is:n}):mo.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>mo.createTextNode(e),createComment:e=>mo.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>mo.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{ho.innerHTML=uo(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=ho.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]}},_o=`transition`,vo=`animation`,yo=Symbol(`_vtc`),bo={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},xo=l({},_r,bo),So=(e=>(e.displayName=`Transition`,e.props=xo,e))((e,{slots:t})=>oo(xr,To(e),t)),Co=(e,t=[])=>{p(e)?e.forEach(e=>e(...t)):e&&e(...t)},wo=e=>e?p(e)?e.some(e=>e.length>1):e.length>1:!1;function To(e){let t={};for(let n in e)n in bo||(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=Eo(i),g=h&&h[0],_=h&&h[1],{onBeforeEnter:v,onEnter:y,onEnterCancelled:b,onLeave:ee,onLeaveCancelled:x,onBeforeAppear:S=v,onAppear:te=y,onAppearCancelled:ne=b}=t,re=(e,t,n,r)=>{e._enterCancelled=r,ko(e,t?d:s),ko(e,t?u:o),n&&n()},ie=(e,t)=>{e._isLeaving=!1,ko(e,f),ko(e,m),ko(e,p),t&&t()},ae=e=>(t,n)=>{let i=e?te:y,o=()=>re(t,e,n);Co(i,[t,o]),Ao(()=>{ko(t,e?c:a),Oo(t,e?d:s),wo(i)||Mo(t,r,g,o)})};return l(t,{onBeforeEnter(e){Co(v,[e]),Oo(e,a),Oo(e,o)},onBeforeAppear(e){Co(S,[e]),Oo(e,c),Oo(e,u)},onEnter:ae(!1),onAppear:ae(!0),onLeave(e,t){e._isLeaving=!0;let n=()=>ie(e,t);Oo(e,f),e._enterCancelled?(Oo(e,p),Io(e)):(Io(e),Oo(e,p)),Ao(()=>{e._isLeaving&&(ko(e,f),Oo(e,m),wo(ee)||Mo(e,r,_,n))}),Co(ee,[e,n])},onEnterCancelled(e){re(e,!1,void 0,!0),Co(b,[e])},onAppearCancelled(e){re(e,!0,void 0,!0),Co(ne,[e])},onLeaveCancelled(e){ie(e),Co(x,[e])}})}function Eo(e){if(e==null)return null;if(b(e))return[Do(e.enter),Do(e.leave)];{let t=Do(e);return[t,t]}}function Do(e){return he(e)}function Oo(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.add(t)),(e[yo]||(e[yo]=new Set)).add(t)}function ko(e,t){t.split(/\s+/).forEach(t=>t&&e.classList.remove(t));let n=e[yo];n&&(n.delete(t),n.size||(e[yo]=void 0))}function Ao(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}var jo=0;function Mo(e,t,n,r){let i=e._endId=++jo,a=()=>{i===e._endId&&r()};if(n!=null)return setTimeout(a,n);let{type:o,timeout:s,propCount:c}=No(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 No(e,t){let n=window.getComputedStyle(e),r=e=>(n[e]||``).split(`, `),i=r(`${_o}Delay`),a=r(`${_o}Duration`),o=Po(i,a),s=r(`${vo}Delay`),c=r(`${vo}Duration`),l=Po(s,c),u=null,d=0,f=0;t===_o?o>0&&(u=_o,d=o,f=a.length):t===vo?l>0&&(u=vo,d=l,f=c.length):(d=Math.max(o,l),u=d>0?o>l?_o:vo:null,f=u?u===_o?a.length:c.length:0);let p=u===_o&&/\b(?:transform|all)(?:,|$)/.test(r(`${_o}Property`).toString());return{type:u,timeout:d,propCount:f,hasTransform:p}}function Po(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((t,n)=>Fo(t)+Fo(e[n])))}function Fo(e){return e===`auto`?0:Number(e.slice(0,-1).replace(`,`,`.`))*1e3}function Io(e){return(e?e.ownerDocument:document).body.offsetHeight}function Lo(e,t,n){let r=e[yo];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Ro=Symbol(`_vod`),zo=Symbol(`_vsh`),Bo={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Ro]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):Vo(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),Vo(e,!0),r.enter(e)):r.leave(e,()=>{Vo(e,!1)}):Vo(e,t))},beforeUnmount(e,{value:t}){Vo(e,t)}};function Vo(e,t){e.style.display=t?e[Ro]:`none`,e[zo]=!t}var 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`);Ro in e&&(e[Ro]=a?r.display:``,e[zo]&&(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(le(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=se(t);if(r!==`filter`&&r in e)return Jo[t]=r;r=ue(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=we(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(Zo,t.slice(6,t.length)):e.setAttributeNS(Zo,t,n):n==null||a&&!T(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`?uo(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=T(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):le(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&&bn(e,t,5,a)}}else bn(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`?Lo(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,se(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=se(t);return Array.isArray(n)?n.some(e=>se(e)===r):Object.keys(n).some(e=>se(e)===r)}var hs=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return p(t)?e=>fe(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=me(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)?me(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=Ae(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=Ae(t,r.props.value)>-1;else if(h(t))i=t.has(r.props.value);else{if(t===n)return;i=ke(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?me(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{An(()=>{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 ke(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)):Ae(t,o)>-1}else a.selected=t.has(o)}else if(ke(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=le(n.key);if(t.some(e=>e===r||Ms[e]===r))return e(n)}))},Ps=l({patchProp:fs},go),Fs;function Is(){return Fs||=sa(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})=>oo(`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=>oo(...e)),...c.default?[c.default()]:[]]),H=(e,t)=>(n,{slots:r})=>oo(Hs,{...n,iconNode:t,name:e},r),Us=H(`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=H(`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=H(`ArrowDownToLineIcon`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),Ks=H(`ArrowRightIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),qs=H(`ArrowUpFromLineIcon`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Js=H(`ArrowUpRightIcon`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),Ys=H(`ArrowUpIcon`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),Xs=H(`BanIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.9 4.9 14.2 14.2`,key:`1m5liu`}]]),Zs=H(`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`}]]),Qs=H(`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`}]]),$s=H(`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`}]]),ec=H(`CheckIcon`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),tc=H(`ChevronDownIcon`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),nc=H(`ChevronRightIcon`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),rc=H(`CircleCheckIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ic=H(`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`}]]),ac=H(`Clock3Icon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),oc=H(`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`}]]),sc=H(`CornerDownRightIcon`,[[`polyline`,{points:`15 10 20 15 15 20`,key:`1q7qjw`}],[`path`,{d:`M4 4v7a4 4 0 0 0 4 4h12`,key:`z08zvw`}]]),cc=H(`CornerLeftUpIcon`,[[`polyline`,{points:`14 9 9 4 4 9`,key:`m9oyvo`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`,key:`1blwi3`}]]),lc=H(`CornerUpLeftIcon`,[[`polyline`,{points:`9 14 4 9 9 4`,key:`881910`}],[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}]]),uc=H(`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`}]]),dc=H(`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`}]]),fc=H(`EyeIcon`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),pc=H(`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`}]]),mc=H(`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`}]]),hc=H(`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`}]]),gc=H(`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`}]]),_c=H(`GitCompareIcon`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`path`,{d:`M11 18H8a2 2 0 0 1-2-2V9`,key:`19pyzm`}]]),vc=H(`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`}]]),yc=H(`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`}]]),bc=H(`HistoryIcon`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),xc=H(`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`}]]),Sc=H(`InfoIcon`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Cc=H(`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`}]]),wc=H(`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`}]]),Tc=H(`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`}]]),Ec=H(`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`}]]),Dc=H(`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`}]]),Oc=H(`LoaderCircleIcon`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),kc=H(`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`}]]),Ac=H(`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`}]]),jc=H(`MinusIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Mc=H(`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`}]]),Nc=H(`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`}]]),Pc=H(`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`}]]),Fc=H(`PackageOpenIcon`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),Ic=H(`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`}]]),Lc=H(`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`}]]),Rc=H(`PanelLeftIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),zc=H(`PanelRightIcon`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Bc=H(`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`}]]),Vc=H(`PlayIcon`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Hc=H(`PlusIcon`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Uc=H(`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`}]]),Wc=H(`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`}]]),Gc=H(`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`}]]),Kc=H(`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`}]]),qc=H(`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`}]]),Jc=H(`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`}]]),Yc=H(`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`}]]),Xc=H(`SparklesIcon`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Zc=H(`SquareStackIcon`,[[`path`,{d:`M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2`,key:`4i38lg`}],[`path`,{d:`M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2`,key:`mlte4a`}],[`rect`,{width:`8`,height:`8`,x:`14`,y:`14`,rx:`2`,key:`1fa9i4`}]]),Qc=H(`TerminalIcon`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),$c=H(`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`}]]),el=H(`Undo2Icon`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),tl=H(`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`}]]),nl=H(`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`}]]),rl=H(`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`}]]),il=H(`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`}]]),al=H(`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`}]]),ol=H(`XIcon`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),sl=e=>e.role===`assistant`,cl=e=>e.role===`toolResult`;function ll(e){let t=e.content;return typeof t==`string`?t:Array.isArray(t)?t.map(e=>e.type===`text`?e.text??``:``).join(``):``}function ul(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 dl(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 fl(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`&&cl(e)&&r.set(e.toolCallId,{entryId:t.id,message:e}),t.kind===`pi.assistant`&&sl(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:ll(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:pl(o.summary)}:{}}:{callId:e,name:t,args:i,status:o?.status??`pending`,output:o?.output||void 0,...s?{nested:s}:{},...o?.summary?{summary:pl(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(ll).join(`
3
- `)});else if(t.kind===`pi.assistant`){let e=(t.model??[]).filter(sl);s.push({kind:`assistant`,id:t.id,streaming:!1,blocks:e.flatMap(o),error:e.map(ul).find(Boolean),model:e[0]?.model})}else if(t.kind===`pi.tool-result`)for(let e of(t.model??[]).filter(cl))i.has(e.toolCallId)||s.push({kind:`tool-result`,id:t.id,name:e.toolName,text:ll(e),isError:e.isError});else s.push({kind:`event`,id:t.id,entryKind:t.kind,text:dl(t),note:t.model?.length?(t.model??[]).map(ll).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 pl(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 ml(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 hl=class{listeners=new Set;subscribe(e){return this.listeners.add(e),()=>void this.listeners.delete(e)}emit(){for(let e of this.listeners)e()}},gl=()=>({items:[],entries:[],running:!1,generating:!1,inbox:[],agent:{},usage:{models:{},tools:{}},compactions:[],notices:[],docs:{},ready:!1});function _l(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 vl(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:{}});_l(e,t.path,t.delta),n[r]=e}return{...e,content:n}}var yl=class extends hl{state=gl();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=gl(),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=fl(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=vl(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:Ol(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}}},bl=class extends hl{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 xl(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 xl(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 Sl=e=>e,Cl=(e,t)=>`${e}/s/${t}`,wl=(e,t,n)=>`${e}/s/${t}/a/${n}`;function Tl(e,t,n){let r=new Map;for(let i of t.agents)r.set(i.id,{type:`agent`,key:wl(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 El(e){return e.map(e=>{let t=e.status!==`online`;return{type:`device`,key:Sl(e.id),device:e,status:e.status,stale:t,children:(e.tree?.sessions??[]).map(n=>({type:`session`,key:Cl(e.id,n.id),deviceId:e.id,session:n,stale:t,children:Tl(e.id,n,t)}))}})}var Dl=class extends hl{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 El(this.devices)}};function Ol(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 kl=3e4;function Al(e,t){return t&&/^\d+$/.test(t.trim())?Math.min(kl,Math.max(1e3,Number(t)*1e3)):Math.min(kl,1e3*2**Math.min(e,10))}function jl(e){return Math.min(kl,2e3*2**Math.min(e,10))}var Ml=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(),jl(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(Al(this.failures++,n)),!1}},Nl=`lab.png`;function Pl(e){return`/icons/${typeof e==`string`&&/^[\w.-]+\.(png|svg)$/.test(e)&&!e.includes(`..`)?e:Nl}`}var Fl=class extends Error{code;status;constructor(e,t,n=0,r){super(t,r),this.code=e,this.status=n,this.name=`DpiError`}},Il=16777216,Ll={initS:1,capS:15},Rl={codeCreate:{perMinute:5,capacity:5},start:{perMinute:20,capacity:20},verifyFails:{perWindow:100,windowMinutes:15},verifyTotal:{perMinute:300,capacity:300}},zl={perMinute:60,capacity:120};Ll.initS,Rl.verifyFails.perWindow,Rl.verifyFails.windowMinutes,zl.perMinute,zl.capacity;function Bl(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*Vl(e,t=45e3,n=Il){let r=e.getReader(),i=new TextDecoder,a=()=>new Fl(`invalid`,`SSE event exceeds ${n} bytes`),o=[],s=0,c=``;try{for(;;){let e,l=new Promise((n,r)=>{e=setTimeout(()=>r(new Fl(`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+=Bl(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=Bl(e);if(t>n)throw a();f=f.slice(p+2),s-=t+2;let r=Hl(e);r&&(yield r)}if(s>n)throw a();o=f?[f]:[],c=f.slice(-1)}}finally{r.cancel().catch(()=>{})}}function Hl(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 Ul=encodeURIComponent,Wl=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,Gl=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 Fl(`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 Fl(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 Fl(`offline`,`Cannot reach ${this.baseUrl}`,0,{cause:e})}if(!r.ok||!r.body){let e=await r.json().catch(()=>void 0);throw new Fl(e?.error?.code??(r.status===401?`unauthorized`:`unavailable`),e?.error?.message??`Stream failed (${r.status})`,r.status)}try{for await(let e of Vl(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=${Ul(e)}`)}deviceDoc(e){return this.request(`GET`,`/v1/docs/${Ul(e)}`)}deviceEvents(e,t=[]){return this.stream(`/v1/events${t.length?`?docs=${t.map(Ul).join(`,`)}`:``}`,e)}gitStatus(e,t={}){return this.request(`GET`,`/v1/git/status?path=${Ul(e)}`,void 0,t)}gitOp(e,t,n={}){return this.request(`POST`,`/v1/git`,{path:e,op:t,...n})}sessionGitFiles(e){return this.request(`GET`,`/v1/sessions/${Ul(e)}/git-files`)}gitStatusBatch(e,t={}){return this.request(`POST`,`/v1/git/status-batch`,{paths:e},t)}sessions(){return this.request(`GET`,`/v1/sessions`)}createSession(e,t=Wl()){return this.request(`POST`,`/v1/sessions`,e,{idempotencyKey:t})}session(e){return new Kl(this,e)}agent(e,t){return new ql(this,e,String(t))}},Kl=class{client;ref;constructor(e,t){this.client=e,this.ref=t}get base(){return`/v1/sessions/${Ul(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=Wl()){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)}},ql=class{client;session;agent;constructor(e,t,n){this.client=e,this.session=t,this.agent=n}get base(){return`/v1/sessions/${Ul(this.session)}/agents/${Ul(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=Wl(),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=Wl()){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/${Ul(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(Ul).join(`,`)}`:``}`,e)}},Jl=e=>new Gl(`/api/devices/${encodeURIComponent(e)}`);async function Yl(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 Fl(e?.code??`internal`,e?.message??`${r.status} ${r.statusText}`,r.status)}return i}var Xl={network:()=>Yl(`GET`,`/network`),check:e=>Yl(`POST`,`/devices/${encodeURIComponent(e)}/check`,{}),async uiGet(e){return(await Yl(`GET`,`/ui-state/${encodeURIComponent(e)}`)).value??void 0},uiSet:(e,t)=>Yl(`PUT`,`/ui-state/${encodeURIComponent(e)}`,{value:t})},Zl=e=>e instanceof Error?e.message:String(e),Ql=[`demo.job-runs`,`demo.workspace`],$l=e=>`${e.deviceId}/agent/${e.sessionId}/${e.agentId}?docs=${Ql.join(`,`)}`,eu=e=>`${e.deviceId}/session/${e.sessionId}`,tu=e=>`${e}/device?docs=app.shared-state`;function nu(e,t,n,r=`hello`){let i=k(`idle`),a=k(``);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 ru(e){let t=new Dl,n=k(0);return t.subscribe(()=>n.value++),e.onNetwork(e=>t.apply({type:`network`,devices:e})),{model:t,devices:V(()=>(n.value,t.devices)),tree:V(()=>(n.value,t.tree()))}}function iu(e,t){let n=rn(),r=rn([]),{status:i,select:a}=nu(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 j(t,e=>{n.value=void 0,a(e?tu(e):void 0)},{immediate:!0}),{sharedState:n,activity:r,status:i}}function au(e,t){let n=new bl,r=k(0);n.subscribe(()=>r.value++);let{status:i,fault:a,select:o}=nu(e,`session`,e=>n.apply(e));return j(()=>t.value?eu(t.value):void 0,e=>{n.clear(),o(e)},{immediate:!0}),{model:n,state:V(()=>(r.value,n.state)),status:i,fault:a}}function ou(e,t){let n=new yl,r=k(0);n.subscribe(()=>r.value++);let{status:i,fault:a,select:o,retry:s}=nu(e,`agent`,e=>n.apply(e),`snapshot`);return j(()=>t.value?$l(t.value):void 0,e=>{n.clear(),o(e)},{immediate:!0}),{model:n,state:V(()=>(r.value,{...n.state})),status:i,fault:a,version:r,retry:s}}var su=new Ml,cu=k(su.state);su.onState(e=>cu.value=e);var lu=ru(su),uu=k(),U=k(),du=k(new Set),fu=k(300),pu=Gt({tree:!0,inspector:!0}),mu=k(!1),hu=V(()=>U.value?.deviceId),gu=V(()=>lu.devices.value.find(e=>e.id===hu.value)),_u=V(()=>gu.value?.status===`online`),vu=au(su,V(()=>U.value?{deviceId:U.value.deviceId,sessionId:U.value.sessionId}:void 0)),yu=ou(su,U),bu=iu(su,hu),xu=V(()=>gu.value?.tree?.sessions.find(e=>e.id===U.value?.sessionId)),Su=V(()=>hu.value?Jl(hu.value):void 0),Cu=V(()=>U.value&&Su.value?Su.value.agent(U.value.sessionId,U.value.agentId):void 0),wu=V(()=>U.value&&Su.value?Su.value.session(U.value.sessionId):void 0);function Tu(e){U.value=e,W.drawer=!1,Eu=!!e,Du()}var Eu=!1;function Du(){let e=U.value;if(!Eu||!e)return;let t=lu.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=>!du.value.has(e))&&(du.value=new Set([...du.value,...r])),n.has(e.agentId)&&(Eu=!1)}j(()=>lu.devices.value,Du);function Ou(e,t){let n=new Set(du.value);t??!n.has(e)?n.add(e):n.delete(e),du.value=n}var ku=(()=>{let e=new Map;return(t,n)=>{clearTimeout(e.get(t)),e.set(t,setTimeout(()=>void Xl.uiSet(t,n).catch(()=>{}),300))}})();j(U,e=>mu.value&&void Xl.uiSet(`tree.selected`,e??null).catch(()=>{})),j(fu,e=>mu.value&&ku(`tree.width`,e)),j(pu,e=>mu.value&&ku(`layout.panels`,{...e}));async function Au(){su.start();try{let[e,t,n,r]=await Promise.all([Xl.network(),Xl.uiGet(`tree.selected`),Xl.uiGet(`tree.width`),Xl.uiGet(`layout.panels`)]);r&&Object.assign(pu,r),uu.value=e.configFile,lu.model.devices.length||lu.model.apply({type:`network`,devices:e.devices}),du.value=new Set,n&&(fu.value=n),t&&e.devices.some(e=>e.id===t.deviceId)?Tu(t):ju(e.devices)}catch(e){W.error=Zl(e)}finally{mu.value=!0}}function ju(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 Tu({deviceId:t.id,sessionId:e.id,agentId:n.id})}}j(()=>[yu.status.value,xu.value],([e,t])=>{e===`fault`&&!t&&_u.value&&(G(`That session was archived on its device.`),Tu(void 0))});var Mu=V(()=>gu.value?.info?.models??[]),Nu=yu.state,Pu=V(()=>vu.state.value.agents.length?vu.state.value.agents:xu.value?.agents??[]),Fu=V(()=>U.value?xl(Pu.value,U.value.agentId):[]),Iu=V(()=>{let e=U.value?.agentId;if(e===void 0)return[];let t=Pu.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=vu.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}})}),Lu=V(()=>Nu.value.running||Iu.value.some(e=>!e.effectiveBackground&&e.conversationId===U.value?.agentId)),Ru=V(()=>ml(Nu.value.usage)),zu=V(()=>{let e=Nu.value.agent.model;return Mu.value.find(t=>t.provider===e?.provider&&t.id===e?.modelId)}),Bu=rn(),Vu=0;async function Hu(){let e=Cu.value,t=++Vu;if(!e||!_u.value)return void(Bu.value=void 0);try{let n=await e.get();t===Vu&&(Bu.value=n)}catch{t===Vu&&(Bu.value=void 0)}}j([Cu,_u],()=>void Hu(),{immediate:!0});var W=Gt({error:``,toast:``,drawer:!1,inspectorOverlay:!1,tab:`session`,composer:``,dialog:void 0}),Uu;function G(e){W.toast=e,clearTimeout(Uu),Uu=setTimeout(()=>W.toast=``,4500)}async function Wu(e){W.error=``;try{return await e()}catch(e){W.error=Zl(e);return}}function Gu(e){W.composer=e,setTimeout(()=>document.querySelector(`.composer textarea`)?.focus())}var Ku=e=>Intl.NumberFormat(`en`,{notation:`compact`,maximumFractionDigits:1}).format(e),qu=e=>JSON.stringify(e,null,2),Ju=(e=``)=>Pl(Mu.value.find(t=>t.id===e)?.icon);function Yu(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 Xu=k(!1);async function Zu(){Lu.value&&!Xu.value&&Cu.value&&(Xu.value=!0,await Wu(()=>Cu.value.abort(!1))&&G(`Foreground work interrupted. Background jobs continue.`),Xu.value=!1)}var Qu=window.matchMedia(`(max-width: 1100px)`),$u=k(Qu.matches);Qu.addEventListener(`change`,e=>$u.value=e.matches);var ed=V(()=>$u.value?W.inspectorOverlay:pu.inspector);function td(e){e&&(W.tab=e),$u.value?(W.drawer=!1,W.inspectorOverlay=!0):pu.inspector=!0}function nd(){$u.value?W.inspectorOverlay=!1:pu.inspector=!1}function rd(){$u.value?(W.drawer=!W.drawer)&&(W.inspectorOverlay=!1,pu.tree=!0):pu.tree=!pu.tree}function id(){ed.value?nd():td()}var ad=/Mac|iPhone|iPad/.test(navigator.userAgent),od=ad?{tree:`Ctrl+N`,inspector:`Ctrl+T`}:{tree:`Alt+Shift+N`,inspector:`Alt+Shift+T`};function sd(e){if(!(!(ad?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 cd={class:`topbar`},ld={class:`brand`},ud={class:`daemon`,"data-testid":`topbar-stats`},dd=[`title`],fd={class:`top-actions`},pd=[`disabled`],md=[`disabled`],hd=Or({__name:`TopBar`,emits:[`newSession`],setup(e,{emit:t}){let n=V(()=>lu.devices.value.filter(e=>e.status===`online`).length),r=V(()=>lu.devices.value.reduce((e,t)=>e+(t.tree?.sessions.length??0),0)),i=V(()=>lu.devices.value.reduce((e,t)=>e+(t.tree?.sessions.reduce((e,t)=>e+t.agents.length,0)??0),0)),a=k(!1);async function o(){let e=wu.value,t=U.value;if(!e||!t||a.value)return;a.value=!0;let n=await Wu(()=>e.createAgent({}));a.value=!1,n&&(Tu({...t,agentId:n.id}),G(`New agent. Same session, same shared App State.`))}let s=t;return(e,t)=>(P(),F(`header`,cd,[L(`div`,ld,[L(`button`,{class:`icon-button tree-toggle`,"aria-label":`Toggle network`,title:`Network`,onClick:t[0]||=e=>A(W).drawer=!A(W).drawer},[R(A(Rc),{size:19})]),t[4]||=L(`img`,{class:`brandmark`,src:`/icons/durable-pi.svg`,alt:`Durable Pi`},null,-1),t[5]||=L(`strong`,null,`Durable Pi`,-1)]),t[12]||=L(`span`,{class:`topbar-sep`,"aria-hidden":`true`},null,-1),L(`div`,ud,[L(`span`,{class:w([`dot`,{off:!n.value}]),"aria-hidden":`true`},null,2),L(`span`,{class:`network-summary`,title:`${n.value} of ${A(lu).devices.value.length} devices online`},[R(A(Nc),{size:16}),z(E(n.value)+` of `+E(A(lu).devices.value.length)+` online`,1)],8,dd),t[8]||=L(`span`,{class:`sep`,"aria-hidden":`true`},`·`,-1),L(`span`,null,[L(`b`,null,E(r.value),1),t[6]||=z(` sessions`,-1)]),t[9]||=L(`span`,{class:`sep`,"aria-hidden":`true`},`·`,-1),L(`span`,null,[L(`b`,null,E(i.value),1),t[7]||=z(` agents`,-1)])]),L(`div`,fd,[L(`span`,{class:w([`chip connection`,{accent:A(cu)===`live`}])},[L(`span`,{class:w([`dot`,{off:A(cu)!==`live`}]),"aria-hidden":`true`},null,2),z(E(A(cu)===`live`?`Connected`:`Reconnecting`),1)],2),L(`button`,{class:`icon-button`,title:`How this works`,"aria-label":`How this works`,onClick:t[1]||=e=>A(W).dialog={kind:`help`}},[R(A(ic),{size:19})]),L(`button`,{class:`secondary small new-agent-button`,disabled:!A(U)||!A(_u)||a.value,title:`Start a fresh agent in this session`,onClick:o},[R(A(Hc),{size:18}),t[10]||=z(`New agent `,-1)],8,pd),L(`button`,{class:`primary small`,onClick:t[2]||=e=>s(`newSession`)},[R(A(Hc),{size:18}),t[11]||=z(`New session `,-1)]),L(`button`,{class:`icon-button inspector-toggle`,"aria-label":`Toggle inspector`,title:`Inspector`,disabled:!A(U)||!A(_u),onClick:t[3]||=e=>A(W).inspectorOverlay?A(nd)():A(td)()},[R(A(zc),{size:19})],8,md)])]))}}),gd={class:`mnav`,"aria-label":`Panels`},_d={key:0,class:`badge`},vd=Or({__name:`MobileNav`,setup(e){function t(){W.drawer=!1,W.inspectorOverlay=!1}return(e,n)=>(P(),F(`nav`,gd,[L(`button`,{type:`button`,class:w({"is-on":!A(W).drawer&&!A(ed)}),onClick:t},[R(A(Ac),{size:18}),n[2]||=z(`Chat `,-1)],2),L(`button`,{type:`button`,class:w({"is-on":A(ed)}),onClick:n[0]||=e=>A(ed)?A(nd)():A(td)()},[R(A(zc),{size:18}),n[3]||=z(`Details`,-1),A(Iu).length?(P(),F(`span`,_d,E(A(Iu).length),1)):B(``,!0)],2),L(`button`,{type:`button`,class:w({"is-on":A(W).drawer}),onClick:n[1]||=e=>A(rd)()},[R(A(tl),{size:18}),n[4]||=z(`Network `,-1)],2)]))}}),yd=[`width`,`height`,`aria-label`],bd=[`width`,`height`,`aria-label`],xd=Or({__name:`DeviceIcon`,props:{device:{},size:{default:16}},setup(e){let t=e,n=V(()=>{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=V(()=>{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`?(P(),F(`svg`,{key:0,class:`device-icon exe`,viewBox:`0 0 512 512`,width:e.size,height:e.size,role:`img`,"aria-label":r.value},[L(`title`,null,E(r.value),1),i[0]||=L(`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,yd)):n.value===`apple`?(P(),F(`svg`,{key:1,class:`device-icon apple`,viewBox:`0 0 384 512`,width:e.size,height:e.size,role:`img`,"aria-label":r.value},[L(`title`,null,E(r.value),1),i[1]||=L(`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,bd)):n.value===`laptop`?(P(),I(A(wc),{key:2,class:`device-icon`,size:e.size,"aria-label":r.value},null,8,[`size`,`aria-label`])):(P(),I(A(Kc),{key:3,class:`device-icon`,size:e.size,"aria-label":r.value},null,8,[`size`,`aria-label`]))}}),Sd=new Map,Cd=new Map;async function wd(e,t){let n=t.filter(t=>!Od(Dd(e,t),Td));if(n.length)try{let t=await Jl(e).gitStatusBatch(n,{timeoutMs:6e4});for(let[n,r]of Object.entries(t)){let t=Dd(e,n);t.status=r,t.at=Date.now(),t.error=``}}catch{}}var Td=6e4,Ed=(e,t)=>`${e}::${t}`;function Dd(e,t){let n=Ed(e,t),r=Sd.get(n);return r||(r=Gt({at:0,status:null,error:``,loading:!1,refreshing:!1}),Sd.set(n,r)),r}var Od=(e,t)=>e.at>0&&Date.now()-e.at<t&&(e.status!==null||e.error);async function kd(e,t,n={}){let{staleMs:r=6e4,force:i=!1,timeoutMs:a=6e4}=n;if(!e||!t)return;let o=Ed(e,t),s=Dd(e,t);if(!i&&Od(s,r))return;let c=Cd.get(o);if(c)return c;s.status===null&&!s.error?s.loading=!0:s.refreshing=!0,s.error=``;let l=(async()=>{try{s.status=await Jl(e).gitStatus(t,{timeoutMs:a}),s.at=Date.now()}catch(e){let t=e.message??``;s.error=/fetch failed|Cannot reach|Failed to fetch|NetworkError|abort/i.test(t)?`device unreachable — check that it is online, then retry (${t.slice(0,80)})`:t.slice(0,160),s.at=Date.now()}finally{s.loading=!1,s.refreshing=!1,Cd.delete(o)}})();return Cd.set(o,l),l}var Ad=new Map;function jd(){j(()=>lu.devices.value.map(e=>`${e.id}:${e.status}:${e.tree?.sessions.length??0}:${e.tree?.sessions.map(e=>e.cwd).join(`|`)}`).join(`;`),()=>{for(let e of lu.devices.value){if(e.status!==`online`||!e.tree?.sessions.length)continue;let t=Date.now();t-(Ad.get(e.id)??0)<6e4||(Ad.set(e.id,t),wd(e.id,e.tree.sessions.map(e=>e.cwd)))}},{immediate:!0})}var Md=(e,t)=>Dd(e,t).status?.branch,Nd=[`aria-level`,`aria-expanded`,`aria-selected`,`data-key`,`title`],Pd=[`aria-label`],Fd={key:1,class:`chev`},Id={class:`name`},Ld={class:`badge`},Rd=[`aria-label`],zd=[`disabled`,`aria-label`],Bd=[`aria-label`],Vd={class:`name`},Hd={class:`path`},Ud=[`title`],Wd={key:1,class:`dot work`,title:`Working`},Gd=[`title`],Kd=[`disabled`,`aria-label`],qd=[`disabled`,`aria-label`],Jd=[`disabled`,`aria-label`],Yd={class:`name`},Xd={key:3,class:`meta`},Zd={key:4,class:`dot work`,title:`Working`},Qd=[`title`],$d=[`disabled`,`aria-label`],ef=Or({__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=V(()=>n.node.children.length>0),a=V(()=>n.node.type===`device`?n.node.device:void 0),o=V(()=>n.node.type===`session`?n.node.session:void 0),s=V(()=>n.node.type===`agent`?n.node.agent:void 0),c=V(()=>o.value?o.value.agents.reduce((e,t)=>e+t.background,0):s.value?.background??0),l=V(()=>o.value?.busy||s.value?.busy),u=V(()=>{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 · ${Yu(e.lastSeenAt)}`}}),d=V(()=>{let e=a.value?.status;return e===`online`?`on`:e===`checking`?`chk`:e===`offline`?`off`:`err`}),f=V(()=>{let e=n.node;return e.type===`session`?Md(e.deviceId,e.session.cwd):void 0}),p=V(()=>a.value?.name??a.value?.id??o.value?.name??s.value?.name??``),m=V(()=>{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)=>(P(),F(`div`,{class:w([`tree-row`,[e.node.type,{sel:e.selected,focus:e.focused,stale:e.node.stale}]]),style:ve({"--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:m.value,onClick:n[11]||=e=>r(`activate`)},[i.value?(P(),F(`button`,{key:0,class:`chev`,tabindex:`-1`,"aria-label":e.open?`Collapse ${p.value}`:`Expand ${p.value}`,onClick:n[0]||=js(e=>r(`toggle`),[`stop`])},[e.open?(P(),I(A(tc),{key:0,size:16})):(P(),I(A(nc),{key:1,size:16}))],8,Pd)):(P(),F(`span`,Fd)),a.value?(P(),F(N,{key:2},[L(`i`,{class:w([`dot`,d.value])},null,2),R(xd,{device:a.value,size:16},null,8,[`device`]),L(`b`,Id,E(p.value),1),L(`span`,Ld,E(a.value.kind),1),L(`span`,{class:w([`meta`,{err:d.value===`err`}])},E(u.value),3),L(`span`,{class:`acts`,onClick:n[4]||=js(()=>{},[`stop`])},[a.value.pairing?(P(),F(`button`,{key:0,class:`icon-button`,"aria-label":`Manage credentials for ${p.value}`,title:`Manage device credentials, including while offline`,onClick:n[1]||=e=>r(`action`,`credentials`)},[R(A(Cc),{size:16})],8,Rd)):B(``,!0),L(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New session on ${p.value}`,title:`New session on this device`,onClick:n[2]||=e=>r(`action`,`new-session`)},[R(A(Hc),{size:16})],8,zd),L(`button`,{class:`icon-button`,"aria-label":`Check ${p.value}`,title:`Check connection now`,onClick:n[3]||=e=>r(`action`,`check`)},[R(A(Wc),{size:16})],8,Bd)])],64)):o.value?(P(),F(N,{key:3},[R(A(mc),{class:`ico`,size:16}),L(`b`,Vd,E(p.value),1),L(`span`,Hd,`…/`+E(o.value.cwd.split(`/`).filter(Boolean).at(-1)),1),f.value?(P(),F(`span`,{key:0,class:`branch`,title:`git branch of ${o.value.cwd}`},`⎇ `+E(f.value),9,Ud)):B(``,!0),l.value?(P(),F(`i`,Wd)):B(``,!0),c.value?(P(),F(`span`,{key:2,class:`bg-count`,title:`${c.value} background task(s)`},[n[12]||=L(`i`,{class:`dot bg`},null,-1),z(E(c.value)+` bg`,1)],8,Gd)):B(``,!0),L(`span`,{class:`acts`,onClick:n[8]||=js(()=>{},[`stop`])},[L(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`New agent in ${p.value}`,title:`New agent in this session`,onClick:n[5]||=e=>r(`action`,`new-agent`)},[R(A(Hc),{size:16})],8,Kd),L(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Rename session ${p.value}`,title:`Rename session`,onClick:n[6]||=e=>r(`action`,`rename`)},[R(A(Bc),{size:16})],8,qd),L(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Archive session ${p.value}`,title:`Archive session`,onClick:n[7]||=e=>r(`action`,`archive`)},[R(A(Ws),{size:16})],8,Jd)])],64)):s.value?(P(),F(N,{key:4},[s.value.kind===`fork`?(P(),I(A(vc),{key:0,class:`ico`,size:16})):s.value.kind===`subagent`?(P(),I(A(sc),{key:1,class:`ico`,size:16})):(P(),I(A(Ac),{key:2,class:`ico root`,size:16})),L(`span`,Yd,E(p.value),1),s.value.kind===`fork`&&s.value.forkedAt!==void 0?(P(),F(`span`,Xd,`@ #`+E(s.value.forkedAt),1)):B(``,!0),l.value?(P(),F(`i`,Zd)):B(``,!0),c.value?(P(),F(`span`,{key:5,class:`bg-count`,title:`${c.value} background task(s)`},[n[13]||=L(`i`,{class:`dot bg`},null,-1),z(E(c.value),1)],8,Qd)):B(``,!0),L(`span`,{class:`acts`,onClick:n[10]||=js(()=>{},[`stop`])},[L(`button`,{class:`icon-button`,disabled:!e.online,"aria-label":`Rename agent ${p.value}`,title:`Rename agent`,onClick:n[9]||=e=>r(`action`,`rename`)},[R(A(Bc),{size:16})],8,$d)])],64)):B(``,!0)],14,Nd))}}),tf={class:`tree-head`},nf=[`title`],rf={key:0,class:`hint tree-empty`,"data-testid":`tree-empty`},af={key:1,class:`panel-rail`,"aria-label":`Network (collapsed)`},of=[`title`],sf=[`title`,`aria-label`,`onClick`],cf=Or({__name:`NetworkSidebar`,setup(e){let t=V(()=>{let e=[],t=(n,r,i)=>{for(let a of n)e.push({node:a,depth:r,parent:i}),a.children.length&&du.value.has(a.key)&&t(a.children,r+1,a.key)};return t(lu.tree.value,0),e}),n=k(),r=k(),i=e=>lu.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`&&U.value?.deviceId===e.deviceId&&U.value.sessionId===e.sessionId&&U.value.agentId===e.agent.id;function s(e){if(n.value=e.key,e.type===`device`)return Ou(e.key);if(e.type===`agent`)return Tu({deviceId:e.deviceId,sessionId:e.sessionId,agentId:e.agent.id});let t=e.session.agents.find(e=>e.kind===`root`)??e.session.agents[0];Ou(e.key,!0),t&&Tu({deviceId:e.deviceId,sessionId:e.session.id,agentId:t.id})}async function c(e,t){let n=i(e);if(!n)return;let r=Jl(n.id);if(e.type===`device`){t===`new-session`?W.dialog={kind:`new-session`,deviceId:n.id}:t===`check`?await Wu(()=>Xl.check(n.id)):t===`credentials`&&(W.dialog={kind:`credentials`,deviceId:n.id});return}if(e.type===`session`){let i=e.session;if(t===`new-agent`){let e=await Wu(()=>r.session(i.id).createAgent({}));e&&(Tu({deviceId:n.id,sessionId:i.id,agentId:e.id}),G(`New agent. Same session, same shared App State.`))}else t===`rename`?W.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`&&(W.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(),U.value?.sessionId===i.id&&Tu(void 0)}});return}let a=e.agent;t===`rename`&&(W.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,An(()=>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;du.value.has(r.node.key)?l(1):Ou(r.node.key,!0)}else if(e.key===`ArrowLeft`&&r)r.node.children.length&&du.value.has(r.node.key)?Ou(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)=>(P(),F(`aside`,{class:w([`network-sidebar`,{open:A(W).drawer,collapsed:!A(pu).tree&&!A(W).drawer}]),"aria-label":`Network`},[A(pu).tree||A(W).drawer?(P(),F(N,{key:0},[L(`header`,tf,[L(`span`,null,[R(A(Nc),{size:16}),i[3]||=z(`NETWORK`,-1)]),L(`button`,{class:`icon-button`,"aria-label":`Pair a device`,title:`Pair a device`,onClick:i[0]||=e=>A(W).dialog={kind:`pair`}},[R(A(Ec),{size:15})]),L(`button`,{class:`icon-button panel-toggle`,"aria-label":`Collapse network`,title:`Collapse network (${A(od).tree})`,onClick:i[1]||=e=>(A(pu).tree=!1,A(W).drawer=!1)},[R(A(Ic),{size:18})],8,nf)]),L(`div`,{ref_key:`list`,ref:r,class:`tree-list`,role:`tree`,tabindex:`0`,"aria-label":`Devices, sessions and agents`,onKeydown:d,onFocus:u},[(P(!0),F(N,null,M(t.value,e=>(P(),I(ef,{key:e.node.key,node:e.node,depth:e.depth,open:A(du).has(e.node.key),selected:o(e.node),focused:n.value===e.node.key,online:a(e.node),onToggle:t=>A(Ou)(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?B(``,!0):(P(),F(`p`,rf,[...i[4]||=[z(` No devices yet. Declare them in `,-1),L(`code`,null,`dpi-network.yaml`,-1),z(` (start from `,-1),L(`code`,null,`dpi-network.example.yaml`,-1),z(`), then run `,-1),L(`code`,null,`just net up <id>`,-1),z(`. `,-1)]]))],544)],64)):(P(),F(`div`,af,[L(`button`,{class:`icon-button panel-toggle`,"aria-label":`Expand network`,title:`Expand network (${A(od).tree})`,onClick:i[2]||=e=>A(pu).tree=!0},[R(A(Lc),{size:18})],8,of),(P(!0),F(N,null,M(A(lu).devices.value,e=>(P(),F(`button`,{key:e.id,class:`rail-device`,title:`${e.id} · ${e.status}`,"aria-label":`Show ${e.id}`,onClick:t=>(A(pu).tree=!0,A(Ou)(e.id,!0))},[R(xd,{device:e,size:20},null,8,[`device`]),L(`i`,{class:w([`dot`,e.status===`online`?`on`:e.status===`checking`?`chk`:e.status===`offline`?`off`:`err`])},null,2)],8,sf))),128))]))],2))}});function lf(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var uf=lf();function df(e){uf=e}var ff={exec:()=>null};function K(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(mf.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var pf=(()=>{try{return!0}catch{return!1}})(),mf={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)}}>`)},hf=/^(?:[ \t]*(?:\n|$))+/,gf=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,_f=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,vf=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,yf=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,bf=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,xf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Sf=K(xf).replace(/bull/g,bf).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(),Cf=K(xf).replace(/bull/g,bf).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(),wf=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Tf=/^[^\n]+/,Ef=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Df=K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Ef).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Of=K(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,bf).getRegex(),kf=`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`,Af=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,jf=K(`^ {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`,Af).replace(`tag`,kf).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mf=K(wf).replace(`hr`,vf).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`,kf).getRegex(),Nf={blockquote:K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Mf).getRegex(),code:gf,def:Df,fences:_f,heading:yf,hr:vf,html:jf,lheading:Sf,list:Of,newline:hf,paragraph:Mf,table:ff,text:Tf},Pf=K(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,vf).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`,kf).getRegex(),Ff={...Nf,lheading:Cf,table:Pf,paragraph:K(wf).replace(`hr`,vf).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Pf).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`,kf).getRegex()},If={...Nf,html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Af).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:ff,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(wf).replace(`hr`,vf).replace(`heading`,` *#{1,6} *[^
16
- ]`).replace(`lheading`,Sf).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Lf=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Rf=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,zf=/^( {2,}|\\)\n(?!\s*$)/,Bf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Vf=/[\p{P}\p{S}]/u,Hf=/[\s\p{P}\p{S}]/u,Uf=/[^\s\p{P}\p{S}]/u,Wf=K(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Hf).getRegex(),Gf=/(?!~)[\p{P}\p{S}]/u,Kf=/(?!~)[\s\p{P}\p{S}]/u,qf=/(?:[^\s\p{P}\p{S}]|~)/u,Jf=K(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,pf?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Yf=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Xf=K(Yf,`u`).replace(/punct/g,Vf).getRegex(),Zf=K(Yf,`u`).replace(/punct/g,Gf).getRegex(),Qf=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,$f=K(Qf,`gu`).replace(/notPunctSpace/g,Uf).replace(/punctSpace/g,Hf).replace(/punct/g,Vf).getRegex(),ep=K(Qf,`gu`).replace(/notPunctSpace/g,qf).replace(/punctSpace/g,Kf).replace(/punct/g,Gf).getRegex(),tp=K(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Uf).replace(/punctSpace/g,Hf).replace(/punct/g,Vf).getRegex(),np=K(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Vf).getRegex(),rp=K(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Uf).replace(/punctSpace/g,Hf).replace(/punct/g,Vf).getRegex(),ip=K(/\\(punct)/,`gu`).replace(/punct/g,Vf).getRegex(),ap=K(/^<(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(),op=K(Af).replace(`(?:-->|$)`,`-->`).getRegex(),sp=K(`^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`,op).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),cp=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,lp=K(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,cp).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),up=K(/^!?\[(label)\]\[(ref)\]/).replace(`label`,cp).replace(`ref`,Ef).getRegex(),dp=K(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ef).getRegex(),fp=K(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,up).replace(`nolink`,dp).getRegex(),pp=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,mp={_backpedal:ff,anyPunctuation:ip,autolink:ap,blockSkip:Jf,br:zf,code:Rf,del:ff,delLDelim:ff,delRDelim:ff,emStrongLDelim:Xf,emStrongRDelimAst:$f,emStrongRDelimUnd:tp,escape:Lf,link:lp,nolink:dp,punctuation:Wf,reflink:up,reflinkSearch:fp,tag:sp,text:Bf,url:ff},hp={...mp,link:K(/^!?\[(label)\]\((.*?)\)/).replace(`label`,cp).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,cp).getRegex()},gp={...mp,emStrongRDelimAst:ep,emStrongLDelim:Zf,delLDelim:np,delRDelim:rp,url:K(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,pp).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:K(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,pp).getRegex()},_p={...gp,br:K(zf).replace(`{2,}`,`*`).getRegex(),text:K(gp.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},vp={normal:Nf,gfm:Ff,pedantic:If},yp={normal:mp,gfm:gp,breaks:_p,pedantic:hp},bp={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},xp=e=>bp[e];function Sp(e,t){if(t){if(mf.escapeTest.test(e))return e.replace(mf.escapeReplace,xp)}else if(mf.escapeTestNoEncode.test(e))return e.replace(mf.escapeReplaceNoEncode,xp);return e}function Cp(e){try{e=encodeURI(e).replace(mf.percentDecode,`%`)}catch{return null}return e}function wp(e,t){let n=e.replace(mf.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(mf.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(mf.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 Ep(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 Dp(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 Op(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 kp(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 Ap=class{options;rules;lexer;constructor(e){this.options=e||uf}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=kp(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=Dp(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=wp(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(wp(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=Ep(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)),Op(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 Op(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}}}},jp=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||uf,this.options.tokenizer=this.options.tokenizer||new Ap,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:mf,block:vp.normal,inline:yp.normal};this.options.pedantic?(t.block=vp.pedantic,t.inline=yp.pedantic):this.options.gfm&&(t.block=vp.gfm,t.inline=this.options.breaks?yp.breaks:yp.gfm),this.tokenizer.rules=t}static get rules(){return{block:vp,inline:yp}}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(mf.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(mf.tabCharGlobal,` `).replace(mf.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}},Mp=class{options;parser;constructor(e){this.options=e||uf}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(mf.notSpaceStart)?.[0],i=e.replace(mf.endingNewline,``)+`
55
- `;return r?`<pre><code class="language-`+Sp(r)+`">`+(n?i:Sp(i,!0))+`</code></pre>
56
- `:`<pre><code>`+(n?i:Sp(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>${Sp(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=Cp(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Sp(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=Cp(e);if(i===null)return Sp(n);e=i;let a=`<img src="${e}" alt="${Sp(n)}"`;return t&&(a+=` title="${Sp(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Sp(e.text)}},Np=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}},Pp=class e{options;renderer;textRenderer;constructor(e){this.options=e||uf,this.options.renderer=this.options.renderer||new Mp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Np}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}},Fp=class{options;block;constructor(e){this.options=e||uf}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?jp.lex:jp.lexInline}provideParser(e=this.block){return e?Pp.parse:Pp.parseInline}},Ip=new class{defaults=lf();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Pp;Renderer=Mp;TextRenderer=Np;Lexer=jp;Tokenizer=Ap;Hooks=Fp;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 Mp(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 Ap(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 Fp;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]=Fp.passThroughHooks.has(n)?e=>{if(this.defaults.async&&Fp.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 jp.lex(e,t??this.defaults)}parser(e,t){return Pp.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?jp.lex:jp.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?Pp.parse:Pp.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?jp.lex:jp.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?Pp.parse:Pp.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>`+Sp(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Lp(e,t){return Ip.parse(e,t)}Lp.options=Lp.setOptions=function(e){return Ip.setOptions(e),Lp.defaults=Ip.defaults,df(Lp.defaults),Lp},Lp.getDefaults=lf,Lp.defaults=uf,Lp.use=function(...e){return Ip.use(...e),Lp.defaults=Ip.defaults,df(Lp.defaults),Lp},Lp.walkTokens=function(e,t){return Ip.walkTokens(e,t)},Lp.parseInline=Ip.parseInline,Lp.Parser=Pp,Lp.parser=Pp.parse,Lp.Renderer=Mp,Lp.TextRenderer=Np,Lp.Lexer=jp,Lp.lexer=jp.lex,Lp.Tokenizer=Ap,Lp.Hooks=Fp,Lp.parse=Lp,Lp.options,Lp.setOptions,Lp.use,Lp.walkTokens,Lp.parseInline,Pp.parse,jp.lex;function Rp(e,t){this.v=e,this.k=t}function zp(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 Bp(e){if(Array.isArray(e))return e}function Vp(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 Hp(){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 Up(e,t){return Bp(e)||Vp(e,t)||Wp(e,t)||Hp()}function Wp(e,t){if(e){if(typeof e==`string`)return zp(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)?zp(e,t):void 0}}function Gp(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Rp;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)}Gp.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Gp.prototype.next=function(e){return this._invoke(`next`,e)},Gp.prototype.throw=function(e){return this._invoke(`throw`,e)},Gp.prototype.return=function(e){return this._invoke(`return`,e)};var Kp=Object.entries,qp=Object.setPrototypeOf,Jp=Object.isFrozen,Yp=Object.getPrototypeOf,Xp=Object.getOwnPropertyDescriptor,Zp=Object.freeze,Qp=Object.seal,$p=Object.create,em=typeof Reflect<`u`&&Reflect,tm=em.apply,nm=em.construct;Zp||=function(e){return e},Qp||=function(e){return e},tm||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},nm||=function(e){return new e(...[...arguments].slice(1))};var rm=Cm(Array.prototype.forEach);Array.prototype.indexOf;var im=Cm(Array.prototype.lastIndexOf),am=Cm(Array.prototype.pop),om=Cm(Array.prototype.push);Array.prototype.slice;var sm=Cm(Array.prototype.splice),cm=Array.isArray,lm=Cm(String.prototype.toLowerCase),um=Cm(String.prototype.toString),dm=Cm(String.prototype.match),fm=Cm(String.prototype.replace),pm=Cm(String.prototype.indexOf),mm=Cm(String.prototype.trim),hm=Cm(Number.prototype.toString),gm=Cm(Boolean.prototype.toString),_m=typeof BigInt>`u`?null:Cm(BigInt.prototype.toString),vm=typeof Symbol>`u`?null:Cm(Symbol.prototype.toString),ym=Cm(Object.prototype.hasOwnProperty),bm=Cm(Object.prototype.toString),xm=Cm(RegExp.prototype.test),Sm=wm(TypeError);function Cm(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return tm(e,t,n)}}function wm(e){return function(){return nm(e,[...arguments])}}function q(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:lm;if(qp&&qp(e,null),!cm(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Jp(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Tm(e){for(let t=0;t<e.length;t++)ym(e,t)||(e[t]=null);return e}function Em(e){let t=$p(null);for(let r of Kp(e)){var n=Up(r,2);let i=n[0],a=n[1];ym(e,i)&&(t[i]=cm(a)?Tm(a):a&&typeof a==`object`&&a.constructor===Object?Em(a):a)}return t}function Dm(e){switch(typeof e){case`string`:return e;case`number`:return hm(e);case`boolean`:return gm(e);case`bigint`:return _m?_m(e):`0`;case`symbol`:return vm?vm(e):`Symbol()`;case`undefined`:return bm(e);case`function`:case`object`:{if(e===null)return bm(e);let t=e,n=Om(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:bm(e)}return bm(e)}default:return bm(e)}}function Om(e,t){for(;e!==null;){let n=Xp(e,t);if(n){if(n.get)return Cm(n.get);if(typeof n.value==`function`)return Cm(n.value)}e=Yp(e)}function n(){return null}return n}function km(e){try{return xm(e,``),!0}catch{return!1}}var Am=Zp(`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(`.`)),jm=Zp(`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(`.`)),Mm=Zp([`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`]),Nm=Zp([`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`]),Pm=Zp(`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(`.`)),Fm=Zp([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Im=Zp([`#text`]),Lm=Zp(`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(`.`)),Rm=Zp(`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(`.`)),zm=Zp(`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(`.`)),Bm=Zp([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Vm=Qp(/{{[\w\W]*|^[\w\W]*}}/g),Hm=Qp(/<%[\w\W]*|^[\w\W]*%>/g),Um=Qp(/\${[\w\W]*/g),Wm=Qp(/^data-[\-\w.\u00B7-\uFFFF]+$/),Gm=Qp(/^aria-[\-\w]+$/),Km=Qp(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qm=Qp(/^(?:\w+script|data):/i),Jm=Qp(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ym=Qp(/^html$/i),Xm=Qp(/^[a-z][.\w]*(-[.\w]+)+$/i),Zm=Qp(/<[/\w!]/g),Qm=Qp(/<[/\w]/g),$m=Qp(/<\/no(script|embed|frames)/i),eh=Qp(/\/>/i),th={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},nh=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],rh=Zp(q({},nh)),ih=function(){let e={};return rm(nh,t=>{e[t]=Qp(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),Zp(e)}(),ah=function(){return typeof window>`u`?null:window},oh=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}},sh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},ch=function(e,t,n,r){return ym(e,t)&&cm(e[t])?q(r.base?Em(r.base):{},e[t],r.transform):n},lh=function(e,t,n){let r=ym(e,t)?e[t]:void 0;return r&&typeof r==`object`?Em(r):n()};function uh(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:ah(),t=e=>uh(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==th.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=Om(d,`cloneNode`),p=Om(d,`remove`),m=Om(d,`removeAttributeNode`),h=Om(d,`nextSibling`),g=Om(d,`childNodes`),_=Om(d,`parentNode`),v=Om(d,`shadowRoot`),y=Om(d,`attributes`),b=o&&o.prototype?Om(o.prototype,`nodeType`):null,ee=o&&o.prototype?Om(o.prototype,`nodeName`):null,x=o&&o.prototype?Om(o.prototype,`ownerDocument`):null,S=function(e){return b?b(e):e.nodeType},te=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 ne,re=``,ie,ae=!1,oe=0,se=function(){if(oe>0)throw Sm(`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.`)},ce=function(e){se(),oe++;try{return ne.createHTML(e)}finally{oe--}},le=function(e){se(),oe++;try{return ne.createScriptURL(e)}finally{oe--}},ue=function(){return ae||=(ie=oh(u,i),!0),ie},de=n,C=de.implementation,fe=de.createNodeIterator,pe=de.createDocumentFragment,me=de.getElementsByTagName,he=r.importNode,ge=sh();t.isSupported=typeof Kp==`function`&&typeof _==`function`&&C&&C.createHTMLDocument!==void 0;let _e=Vm,ve=Hm,ye=Um,be=Wm,xe=Gm,Se=qm,w=Jm,Ce=Xm,we=Km,T=null,Te=q({},[...Am,...jm,...Mm,...Pm,...Im]),Ee=null,De=q({},[...Lm,...Rm,...zm,...Bm]),Oe=Object.seal($p(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}})),ke=null,Ae=null,je=Object.seal($p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),E=!0,Me=!0,Ne=!1,Pe=!0,Fe=!1,Ie=!0,D=!1,Le=!1,Re=null,ze=null,Be=!1,Ve=!1,He=!1,Ue=!1,We=!0,Ge=!1,Ke=`user-content-`,qe=!0,Je=!1,Ye={},Xe=null,Ze=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(`.`)),Qe=null,$e=q({},[`audio`,`video`,`img`,`source`,`image`,`track`]),et=null,tt=q({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),nt=`http://www.w3.org/1998/Math/MathML`,rt=`http://www.w3.org/2000/svg`,it=`http://www.w3.org/1999/xhtml`,at=it,ot=!1,st=null,ct=q({},[nt,rt,it],um),lt=Zp([`mi`,`mo`,`mn`,`ms`,`mtext`]),ut=q({},lt),dt=Zp([`annotation-xml`]),ft=q({},dt),pt=q({},[`title`,`style`,`font`,`a`,`script`]),mt=null,ht=[`application/xhtml+xml`,`text/html`],gt=null,_t=null,vt=n.createElement(`form`),yt=function(e){return e instanceof RegExp||e instanceof Function},bt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(_t&&_t===e)return;(!e||typeof e!=`object`)&&(e={}),e=Em(e),mt=ht.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,gt=mt===`application/xhtml+xml`?um:lm,T=ch(e,`ALLOWED_TAGS`,Te,{transform:gt}),Ee=ch(e,`ALLOWED_ATTR`,De,{transform:gt}),st=ch(e,`ALLOWED_NAMESPACES`,ct,{transform:um}),et=ch(e,`ADD_URI_SAFE_ATTR`,tt,{transform:gt,base:tt}),Qe=ch(e,`ADD_DATA_URI_TAGS`,$e,{transform:gt,base:$e}),Xe=ch(e,`FORBID_CONTENTS`,Ze,{transform:gt}),ke=ch(e,`FORBID_TAGS`,Em({}),{transform:gt}),Ae=ch(e,`FORBID_ATTR`,Em({}),{transform:gt}),Ye=ym(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Em(e.USE_PROFILES):e.USE_PROFILES:!1,E=e.ALLOW_ARIA_ATTR!==!1,Me=e.ALLOW_DATA_ATTR!==!1,Ne=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Pe=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Fe=e.SAFE_FOR_TEMPLATES||!1,Ie=e.SAFE_FOR_XML!==!1,D=e.WHOLE_DOCUMENT||!1,Ve=e.RETURN_DOM||!1,He=e.RETURN_DOM_FRAGMENT||!1,Ue=e.RETURN_TRUSTED_TYPE||!1,Be=e.FORCE_BODY||!1,We=e.SANITIZE_DOM!==!1,Ge=e.SANITIZE_NAMED_PROPS||!1,qe=e.KEEP_CONTENT!==!1,Je=e.IN_PLACE||!1,we=km(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Km,at=typeof e.NAMESPACE==`string`?e.NAMESPACE:it,ut=lh(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>q({},lt)),ft=lh(e,`HTML_INTEGRATION_POINTS`,()=>q({},dt));let t=lh(e,`CUSTOM_ELEMENT_HANDLING`,()=>$p(null));if(Oe=$p(null),ym(t,`tagNameCheck`)&&yt(t.tagNameCheck)&&(Oe.tagNameCheck=t.tagNameCheck),ym(t,`attributeNameCheck`)&&yt(t.attributeNameCheck)&&(Oe.attributeNameCheck=t.attributeNameCheck),ym(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Oe.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Qp(Oe),Fe&&(Me=!1),He&&(Ve=!0),Ye&&(T=q({},Im),Ee=$p(null),Ye.html===!0&&(q(T,Am),q(Ee,Lm)),Ye.svg===!0&&(q(T,jm),q(Ee,Rm),q(Ee,Bm)),Ye.svgFilters===!0&&(q(T,Mm),q(Ee,Rm),q(Ee,Bm)),Ye.mathMl===!0&&(q(T,Pm),q(Ee,zm),q(Ee,Bm))),je.tagCheck=null,je.attributeCheck=null,ym(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?je.tagCheck=e.ADD_TAGS:cm(e.ADD_TAGS)&&(T===Te&&(T=Em(T)),q(T,e.ADD_TAGS,gt))),ym(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?je.attributeCheck=e.ADD_ATTR:cm(e.ADD_ATTR)&&(Ee===De&&(Ee=Em(Ee)),q(Ee,e.ADD_ATTR,gt))),ym(e,`ADD_FORBID_CONTENTS`)&&cm(e.ADD_FORBID_CONTENTS)&&(Xe===Ze&&(Xe=Em(Xe)),q(Xe,e.ADD_FORBID_CONTENTS,gt)),qe&&(T[`#text`]=!0),D&&q(T,[`html`,`head`,`body`]),T.table&&(q(T,[`tbody`]),delete ke.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Sm(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Sm(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=ne;ne=e.TRUSTED_TYPES_POLICY;try{re=ce(``)}catch(e){throw ne=t,e}}else e.TRUSTED_TYPES_POLICY===null?(ne=void 0,re=``):(ne===void 0&&(ne=ue()),ne&&typeof re==`string`&&(re=ce(``)));Zp&&Zp(e),_t=e},xt=q({},[...jm,...Mm,...Nm]),St=q({},[...Pm,...Fm]),Ct=function(e,t,n){return t.namespaceURI===it?e===`svg`:t.namespaceURI===nt?e===`svg`&&(n===`annotation-xml`||ut[n]):!!xt[e]},wt=function(e,t,n){return t.namespaceURI===it?e===`math`:t.namespaceURI===rt?e===`math`&&ft[n]:!!St[e]},Tt=function(e,t,n){return t.namespaceURI===rt&&!ft[n]||t.namespaceURI===nt&&!ut[n]?!1:!St[e]&&(pt[e]||!xt[e])},Et=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:at,tagName:`template`});let n=lm(e.tagName),r=lm(t.tagName);return st[e.namespaceURI]?e.namespaceURI===rt?Ct(n,t,r):e.namespaceURI===nt?wt(n,t,r):e.namespaceURI===it?Tt(n,t,r):!!(mt===`application/xhtml+xml`&&st[e.namespaceURI]):!1},Dt=function(e){om(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw Sm(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Ot=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},kt=function(e){Mt(e);let t=g(e);if(t){let e=[];rm(t,t=>{om(e,t)}),rm(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`&&Ot(e,r,i)}},At=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}om(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(Ve||He)try{Dt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},jt=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`||Ee[gt(i)]||Ot(e,r,i)}},Mt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();S(e)===th.element&&jt(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Nt=function(e,t){return Ie?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Pt=function(e){if(!Ie)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=S(e);if(n===th.processingInstruction||n===th.comment&&xm(Qm,e.data)){try{p(e)}catch{}continue}if(n===th.element){let t=e,n=gt(te(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Nt(`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])}},Ft=function(e){let t=null,r=null;if(Be)e=`<remove></remove>`+e;else{let t=dm(e,/^[\r\n\t ]+/);r=t&&t[0]}mt===`application/xhtml+xml`&&at===it&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=ne?ce(e):e;if(at===it)try{t=new l().parseFromString(i,mt)}catch{}if(!t||!t.documentElement){t=C.createDocument(at,`template`,null);try{t.documentElement.innerHTML=ot?re:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),at===it?me.call(t,D?`html`:`body`)[0]:D?t.documentElement:a},It=function(e){let t=x?x(e):e.ownerDocument;return fe.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Lt=function(e){return e=fm(e,_e,` `),e=fm(e,ve,` `),e=fm(e,ye,` `),e},Rt=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=fe.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=Lt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&rm(i,e=>{Bt(e.content)&&Rt(e.content)})},zt=function(e){let t=ee?ee(e):null;return typeof t!=`string`||gt(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)},Bt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===th.documentFragment}catch{return!1}},Vt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Ht(e,n,r){e.length!==0&&rm(e,e=>{e.call(t,n,r,_t)})}let Ut=function(e,t){return!!(Ie&&e.hasChildNodes()&&!Vt(e.firstElementChild)&&xm(Zm,e.textContent)&&xm(Zm,e.innerHTML)||Ie&&e.namespaceURI===it&&rh[t]&&(Vt(e.firstElementChild)||typeof e.textContent==`string`&&xm(ih[t],e.textContent))||e.nodeType===th.processingInstruction||Ie&&e.nodeType===th.comment&&xm(Qm,e.data))},Wt=function(e,t){return e instanceof RegExp?xm(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Gt=function(e,t,n){if(!ke[t]&&Zt(t)&&Wt(Oe.tagNameCheck,t))return!1;if(qe&&!Xe[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 Dt(e),!0},Kt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Em(t):t},qt=function(e,t){return e===t||_(e)!==null?!1:(Je&&Mt(e),!0)},Jt=function(e,n){if(Ht(ge.beforeSanitizeElements,e,null),qt(e,n))return!0;if(zt(e))return Dt(e),!0;let r=gt(te(e));if(T=Kt(ge.uponSanitizeElement,T,Te,Re),Ht(ge.uponSanitizeElement,e,{tagName:r,allowedTags:T}),qt(e,n))return!0;if(Ut(e,r))return Dt(e),!0;if(ke[r]||!(je.tagCheck instanceof Function&&je.tagCheck(r))&&!T[r]){let t=Gt(e,r,n);return t===!1&&(Ht(ge.afterSanitizeElements,e,null),qt(e,n))?!0:t}if(S(e)===th.element&&!Et(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&xm($m,e.innerHTML))return Dt(e),!0;if(Fe&&e.nodeType===th.text){let n=Lt(e.textContent);e.textContent!==n&&(om(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Ht(ge.afterSanitizeElements,e,null),qt(e,n)},Yt=function(e,t,r){if(Ae[t]||Nt(t,e)||We&&(t===`id`||t===`name`)&&(r in n||r in vt))return!1;let i=Ee[t]||je.attributeCheck instanceof Function&&je.attributeCheck(t,e);return Me&&xm(be,t)||E&&xm(xe,t)?!0:i?et[t]||xm(we,fm(r,w,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&pm(r,`data:`)===0&&Qe[e]||Ne&&!xm(Se,fm(r,w,``))?!0:!r:Zt(e)&&Wt(Oe.tagNameCheck,e)&&Wt(Oe.attributeNameCheck,t,e)||t===`is`&&Oe.allowCustomizedBuiltInElements&&Wt(Oe.tagNameCheck,r)},Xt=q({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Zt=function(e){return!Xt[lm(e)]&&xm(Ce,e)},Qt=function(e,t,n,r){if(ne&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return ce(r);case`TrustedScriptURL`:return le(r)}return r},O=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!zt(e)||(Dt(e),!1)}catch{return At(t,e),!1}},$t=function(e,n){if(Ht(ge.beforeSanitizeAttributes,e,null),qt(e,n))return;let r=e.attributes;if(!r||zt(e))return;Ee=Kt(ge.uponSanitizeAttribute,Ee,De,ze);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:Ee,forceKeepAttr:void 0},a=r.length,o=gt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=gt(s),d=l,f=s===`value`?d:mm(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Ht(ge.uponSanitizeAttribute,e,i),f=i.attrValue,Ge&&(u===`id`||u===`name`)&&pm(f,Ke)!==0&&(At(s,e,n),f=Ke+f,p=!0),Ie&&xm(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){At(s,e,n);continue}if(u===`attributename`&&dm(f,`href`)){At(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){At(s,e,n);continue}if(!Pe&&xm(eh,f)){At(s,e,n);continue}if(Fe&&(f=Lt(f)),!Yt(o,u,f)){At(s,e,n);continue}f=Qt(o,u,c,f),f!==d&&O(e,s,c,f)&&p&&am(t.removed)}}Ht(ge.afterSanitizeAttributes,e,null),qt(e,n)},en=function(e){let t=null,n=It(e);for(Ht(ge.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Ht(ge.uponSanitizeShadowNode,t,null),Jt(t,e),$t(t,e),Bt(t.content)&&en(t.content),S(t)===th.element){let e=v(t);Bt(e)&&(tn(e),en(e))}Ht(ge.afterSanitizeShadowDOM,e,null)},tn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){en(e.shadow);continue}let n=e.node,r=S(n)===th.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`&&gt(e)===`template`){let e=n.content;Bt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Bt(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(ot=!e,ot&&(e=`<!-->`),typeof e!=`string`&&!Vt(e)&&(e=Dm(e),typeof e!=`string`))throw Sm(`dirty is not a string, aborting`);if(!t.isSupported)return e;Le?(T=Re,Ee=ze):bt(n),(ge.uponSanitizeElement.length>0||ge.uponSanitizeAttribute.length>0)&&(T=Em(T)),ge.uponSanitizeAttribute.length>0&&(Ee=Em(Ee)),t.removed=[];let c=Je&&typeof e!=`string`&&Vt(e);if(c){Pt(e);let t=te(e);if(typeof t==`string`){let n=gt(t);if(!T[n]||ke[n])throw kt(e),Sm(`root node is forbidden and cannot be sanitized in-place`)}if(zt(e))throw kt(e),Sm(`root node is clobbered and cannot be sanitized in-place`);try{tn(e)}catch(t){throw kt(e),t}}else if(Vt(e))i=Ft(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===th.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),tn(i);else{if(!Ve&&!Fe&&!D&&e.indexOf(`<`)===-1)return ne&&Ue?ce(e):e;if(i=Ft(e),!i)return Ve?null:Ue?re:``}i&&Be&&Dt(i.firstChild);let l=c?e:i;try{let e=It(l);for(;o=e.nextNode();)Jt(o,l),$t(o,l),Bt(o.content)&&en(o.content)}catch(n){throw c&&(kt(e),rm(t.removed,e=>{e.element&&Mt(e.element)})),n}if(c){let n=!1;if(rm(t.removed,t=>{t.element&&(t.element===e&&(n=!0),Mt(t.element))}),n)throw Sm(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Fe&&Rt(e),e}if(Ve){if(Fe&&Rt(i),He)for(s=pe.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(Ee.shadowroot||Ee.shadowrootmode)&&(s=he.call(r,s,!0)),s}let u=D?i.outerHTML:i.innerHTML;return D&&T[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&xm(Ym,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
75
- `+u),Fe&&(u=Lt(u)),ne&&Ue?ce(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};bt(e),Le=!0,Re=T,ze=Ee},t.clearConfig=function(){_t=null,Le=!1,Re=null,ze=null,ne=ie,re=``},t.isValidAttribute=function(e,t,n){_t||bt({});let r=gt(e),i=gt(t);return Yt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&ym(ge,e)&&om(ge[e],t)},t.removeHook=function(e,t){if(ym(ge,e)){if(t!==void 0){let n=im(ge[e],t);return n===-1?void 0:sm(ge[e],n,1)[0]}return am(ge[e])}},t.removeHooks=function(e){ym(ge,e)&&(ge[e]=[])},t.removeAllHooks=function(){ge=sh()},t}var dh=uh();function fh(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 ph=`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(`.`),mh=[`form`,`style`,`script`,`button`,`select`,`textarea`,`iframe`,`object`,`embed`,`svg`,`math`],hh={a:[`href`,`title`],img:[`src`,`alt`,`title`],th:[`colspan`,`rowspan`,`align`],td:[`colspan`,`rowspan`,`align`],ol:[`start`],code:[`class`],input:[`type`,`checked`,`disabled`]},gh=[...new Set(Object.values(hh).flat())],_h=/^language-[\w-]+$/,vh=/^\d{1,4}$/,yh=/^(left|right|center)$/i;function bh(e,t,n){if(!Object.hasOwn(hh,e)||!hh[e].includes(t))return!1;switch(t){case`class`:return _h.test(n);case`type`:return n.toLowerCase()===`checkbox`;case`colspan`:case`rowspan`:case`start`:return vh.test(n);case`align`:return yh.test(n);default:return!0}}var xh=/^data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/]+={0,2}$/i,Sh=/^\/api(\/|$)/i;function Ch(e,t){if(xh.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&&!Sh.test(n.pathname)}dh.isSupported&&dh.addHook(`afterSanitizeAttributes`,e=>{let t=e.nodeName.toLowerCase();for(let{name:n,value:r}of Array.from(e.attributes))bh(t,n,r)||e.removeAttribute(n);if(t===`img`&&!Ch(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:fh(n,location.origin);r?(e.setAttribute(`href`,r),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):(e.removeAttribute(`href`),e.removeAttribute(`target`))});var wh={ALLOWED_TAGS:ph,ALLOWED_ATTR:gh,FORBID_TAGS:mh,ALLOW_DATA_ATTR:!1,ALLOW_ARIA_ATTR:!1},Th=new Map;function Eh(e){let t=Th.get(e);return t===void 0&&(t=dh.sanitize(Lp.parse(e,{async:!1}),wh),Th.size>400&&Th.delete(Th.keys().next().value),Th.set(e,t)),t}var Dh=`demo.job-runs`,Oh=e=>e.status!==`running`&&e.status!==`waiting`,kh=V(()=>gu.value?.info?.jobs??[]),Ah=e=>kh.value.find(t=>t.id===e),jh=V(()=>{let e=Nu.value.docs[Dh];return Object.values(e?.items??{}).sort((e,t)=>t.id-e.id)}),Mh=e=>jh.value.find(t=>t.id===e),Nh=e=>jh.value.find(t=>t.toolCallId===e),Ph=k(Date.now());setInterval(()=>Ph.value=Date.now(),1e3);var Fh=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`,Ih=k();async function Lh(e,t){if(!Ih.value){Ih.value=e;try{return await Wu(t)}finally{Ih.value=void 0}}}function Rh(e){$u.value&&nd(),setTimeout(()=>document.querySelector(`[data-job-run="${e}"]`)?.scrollIntoView({behavior:`smooth`,block:`center`}))}async function zh(e){let t=await Lh(`start:${e.id}`,()=>Cu.value.demo(`jobs`,{job:e.id}));t&&(G(`${e.title} started. It runs in the chat.`),Rh(t.taskId))}var Bh=(e,t)=>Lh(`decide:${e.id}`,()=>Cu.value.demo(`jobs/${e.id}/approval`,{approved:t})),Vh=e=>Lh(`stop:${e.id}`,()=>wu.value.abortTask(e.id));function Hh(e){U.value&&Tu({...U.value,agentId:e})}var Uh=[`data-job-run`,`aria-label`],Wh={class:`job-run-head`},Gh={class:`job-run-icon`},Kh={class:`job-run-titles`},qh={class:`job-run-eyebrow`},Jh={class:`job-run-repeat`},Yh={key:0,class:`job-run-about`},Xh={class:`job-run-meta`},Zh={key:0,class:`job-run-resumed`},Qh={class:`job-stepper`,"aria-label":`Phases`},$h=[`aria-current`],eg={class:`job-chip`},tg={class:`job-step-dot`},ng={class:`job-step-label`},rg={key:0,class:`job-step-progress`},ig={class:`job-phases`},ag=[`open`],og={class:`job-phase-n`},sg={class:`job-phase-summary`},cg={class:`job-phase-time`},lg={key:0,class:`job-phase-about`},ug={key:1,class:`job-steps`},dg=[`open`],fg={key:1,class:`job-step-line`},pg=[`onClick`],mg={key:2,class:`job-phase-empty`},hg={key:1,class:`job-approval`,role:`group`,"aria-label":`Approval`},gg={class:`job-approval-buttons`},_g=[`disabled`],vg=[`disabled`],yg={key:2,class:`message-error`},bg={class:`job-run-foot`},xg=[`disabled`],Sg=Or({__name:`JobCard`,props:{run:{}},setup(e){let t=e,n=V(()=>Ah(t.run.job)),r=V(()=>Oh(t.run)),i=V(()=>Fh((t.run.endedAt??Ph.value)-t.run.startedAt)),a={running:`Running`,waiting:`Waiting for you`,completed:`Completed`,failed:`Failed`,aborted:`Stopped`,declined:`Declined`},o={command:Qc,tool:al,agent:Zs,state:Qs,approval:Jc,checkpoint:pc,note:Dc},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)?oo(`code`,{title:s(t)},t.label):oo(`span`,{class:`job-step-text`},t.label),r=t.status===`running`?oo(Oc,{size:15,class:`spin`}):t.status===`done`?oo(ec,{size:15}):t.status===`waiting`?oo(yc,{size:15}):oo(ol,{size:15});return[oo(o[t.kind],{size:16,class:`job-step-kind`}),n,t.kind===`tool`&&t.detail?oo(`span`,{class:`job-step-args`,title:t.detail},t.detail):null,oo(`span`,{class:`job-step-state`},[r,t.ms!==void 0&&t.kind!==`note`?oo(`span`,Fh(t.ms)):null])]};c.props=[`step`];let l=e=>n.value?.phases.find(t=>t.id===e),u=e=>e.startedAt?Fh((e.endedAt??(e.status===`running`||e.status===`waiting`?Ph.value:e.startedAt))-e.startedAt):``,d=e=>e.status!==`pending`&&e.status!==`skipped`,f=V(()=>Object.entries(t.run.input)),p=V(()=>t.run.phases.find(e=>e.status===`waiting`));return(t,o)=>(P(),F(`article`,{class:w([`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]}`},[L(`header`,Wh,[L(`span`,Gh,[R(A(il),{size:22})]),L(`div`,Kh,[L(`div`,qh,[o[3]||=L(`span`,null,`DURABLE JOB`,-1),L(`span`,Jh,[R(A(Gc),{size:15}),z(`Repeatable workflow, run #`+E(e.run.run),1)])]),L(`h3`,null,E(e.run.title),1)]),L(`span`,{class:w([`job-run-status`,e.run.status])},[o[4]||=L(`i`,null,null,-1),z(E(a[e.run.status]),1)],2)]),n.value?(P(),F(`p`,Yh,E(n.value.summary),1)):B(``,!0),L(`div`,Xh,[L(`span`,null,`task #`+E(e.run.id),1),L(`span`,null,E(e.run.startedBy===`agent`?`started by the agent`:`started by you`),1),L(`span`,null,E(i.value),1),(P(!0),F(N,null,M(f.value,([e,t])=>(P(),F(`span`,{key:e,class:`job-run-input`},E(e)+`=`+E(t),1))),128)),e.run.resumed?(P(),F(`span`,Zh,`resumed `+E(e.run.resumed)+`× after restart`,1)):B(``,!0)]),L(`ol`,Qh,[(P(!0),F(N,null,M(e.run.phases,(t,n)=>(P(),F(`li`,{key:t.id,class:w(`ph-${t.status}`),"aria-current":e.run.phase===t.id&&!r.value?`step`:void 0},[L(`span`,eg,[L(`span`,tg,[t.status===`done`?(P(),I(A(ec),{key:0,size:15})):t.status===`running`?(P(),I(A(Oc),{key:1,size:15,class:`spin`})):t.status===`waiting`?(P(),I(A(yc),{key:2,size:15})):[`failed`,`aborted`].includes(t.status)?(P(),I(A(ol),{key:3,size:15})):(P(),F(N,{key:4},[z(E(n+1),1)],64))]),L(`span`,ng,E(t.label),1),t.progress?(P(),F(`span`,rg,E(t.progress.done)+`/`+E(t.progress.total),1)):B(``,!0)])],10,$h))),128))]),L(`div`,ig,[(P(!0),F(N,null,M(e.run.phases,(e,t)=>(P(),F(`details`,{key:e.id,class:w([`job-phase`,`ph-${e.status}`]),open:d(e)},[L(`summary`,null,[L(`span`,og,E(t+1),1),L(`strong`,null,E(e.label),1),L(`span`,sg,E(e.summary??(e.status===`pending`?l(e.id)?.summary:e.status===`skipped`?`Skipped`:``)),1),L(`span`,cg,E(u(e)),1)]),e.status===`done`?B(``,!0):(P(),F(`p`,lg,E(l(e.id)?.summary),1)),e.steps.length?(P(),F(`ul`,ug,[(P(!0),F(N,null,M(e.steps,e=>(P(),F(`li`,{key:e.id,class:w([`k-${e.kind}`,`st-${e.status}`])},[e.detail&&e.kind!==`tool`?(P(),F(`details`,{key:0,open:e.status===`error`},[L(`summary`,null,[R(c,{step:e},null,8,[`step`])]),L(`pre`,null,E(e.detail),1)],8,dg)):(P(),F(`div`,fg,[R(c,{step:e},null,8,[`step`])])),e.kind===`agent`&&e.conversationId?(P(),F(`button`,{key:2,class:`text-button job-step-link`,onClick:t=>A(Hh)(e.conversationId)},` Open subagent #`+E(e.conversationId),9,pg)):B(``,!0)],2))),128))])):e.status===`pending`?(P(),F(`p`,mg,`Not started yet.`)):B(``,!0)],10,ag))),128))]),e.run.approval===`pending`?(P(),F(`div`,hg,[L(`div`,null,[R(A(Jc),{size:20}),o[5]||=L(`strong`,null,`Approve to continue`,-1)]),L(`p`,null,E(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),L(`div`,gg,[L(`button`,{class:`primary small`,disabled:!!A(Ih),onClick:o[0]||=t=>A(Bh)(e.run,!0)},[R(A(ec),{size:18}),o[6]||=z(`Approve & continue `,-1)],8,_g),L(`button`,{class:`secondary`,disabled:!!A(Ih),onClick:o[1]||=t=>A(Bh)(e.run,!1)},`Decline`,8,vg)])])):B(``,!0),e.run.error&&e.run.status!==`aborted`?(P(),F(`p`,yg,E(e.run.error),1)):B(``,!0),L(`footer`,bg,[L(`span`,null,E(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?B(``,!0):(P(),F(`button`,{key:0,class:`secondary danger`,disabled:!!A(Ih),onClick:o[2]||=t=>A(Vh)(e.run)},[R(A(Pc),{size:16}),o[7]||=z(`Stop `,-1)],8,xg))])],10,Uh))}}),Cg={class:`message-label`},wg={class:`user-message`},Tg={class:`message-label`},Eg={key:0,class:`streaming`},Dg={key:1},Og=[`aria-label`],kg=[`innerHTML`],Ag={key:1,class:`thinking`},jg=[`data-call-id`],Mg={class:`tool-status`},Ng={class:`tool-section-label`},Pg=[`aria-label`,`onClick`],Fg={key:0,class:`typing`},Ig={key:1,class:`message-error`},Lg=[`aria-label`],Rg={key:3,class:`live-tool`},zg={key:0},Bg={class:`event-line`},Vg=[`aria-label`],Hg={key:0,class:`raw`},Ug=Or({__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)=>(P(),F(`article`,{class:w([`entry`,i(e.item)])},[e.item.kind===`user`?(P(),F(N,{key:0},[L(`div`,Cg,[a[3]||=z(` YOU `,-1),L(`span`,null,`#`+E(e.item.id),1)]),L(`div`,wg,E(e.item.text),1)],64)):e.item.kind===`assistant`?(P(),F(N,{key:1},[L(`div`,Tg,[a[5]||=z(` AGENT `,-1),e.item.streaming?(P(),F(`span`,Eg,`Working`)):(P(),F(`span`,Dg,`#`+E(e.item.id),1)),e.item.streaming?B(``,!0):(P(),F(`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)},[R(A(vc),{size:18}),a[4]||=z(`Fork `,-1)],8,Og))]),(P(!0),F(N,null,M(e.item.blocks,(e,t)=>(P(),F(N,{key:t},[e.type===`text`?(P(),F(`div`,{key:0,class:`markdown`,innerHTML:A(Eh)(e.text)},null,8,kg)):e.type===`thinking`?(P(),F(`details`,Ag,[a[6]||=L(`summary`,null,`Thinking`,-1),L(`div`,null,E(e.text),1)])):(P(),F(`details`,{key:2,class:w([`tool-call`,{failed:e.call.status===`error`}]),"data-call-id":e.call.callId},[L(`summary`,null,[e.call.status===`error`?(P(),I(A(Sc),{key:0,size:18})):e.call.status===`done`?(P(),I(A(ec),{key:1,size:18})):e.call.status===`running`?(P(),I(A(Us),{key:2,size:18})):(P(),I(A(al),{key:3,size:18})),L(`strong`,null,E(e.call.name),1),L(`code`,null,E(A(qu)(e.call.args)?.slice(0,90)),1),L(`span`,Mg,E(r(e.call)),1)]),a[10]||=L(`div`,{class:`tool-section-label`},`Input`,-1),L(`pre`,null,E(A(qu)(e.call.args)),1),e.call.result===void 0?e.call.output?(P(),F(N,{key:1},[a[9]||=L(`div`,{class:`tool-section-label`},`Live output`,-1),L(`pre`,null,E(e.call.output),1)],64)):B(``,!0):(P(),F(N,{key:0},[L(`div`,Ng,[a[8]||=L(`span`,null,`Result`,-1),e.call.resultEntryId===void 0?B(``,!0):(P(),F(`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)},[R(A(vc),{size:18}),a[7]||=z(`Fork `,-1)],8,Pg))]),L(`pre`,null,E(e.call.result),1)],64))],10,jg)),e.type===`tool`&&e.call.name===`run_durable_job`&&A(Nh)(e.call.callId)?(P(),I(Sg,{key:3,run:A(Nh)(e.call.callId)},null,8,[`run`])):B(``,!0)],64))),128)),e.item.streaming&&!e.item.blocks.length?(P(),F(`div`,Fg,[...a[11]||=[L(`i`,null,null,-1),L(`i`,null,null,-1),L(`i`,null,null,-1)]])):B(``,!0),e.item.error?(P(),F(`div`,Ig,E(e.item.error),1)):B(``,!0)],64)):e.item.kind===`tool-result`?(P(),F(`details`,{key:2,class:w([`tool-result`,{failed:e.item.isError}])},[L(`summary`,null,[e.item.isError?(P(),I(A(Sc),{key:1,size:18})):(P(),I(A(ec),{key:0,size:18})),L(`strong`,null,E(e.item.name),1),L(`span`,null,E(e.item.isError?`error`:`result`),1),L(`button`,{class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,onClick:a[1]||=js(t=>n(`fork`,e.item.id),[`prevent`])},[R(A(vc),{size:18}),a[12]||=z(`Fork `,-1)],8,Lg)]),L(`pre`,null,E(e.item.text),1)],2)):e.item.kind===`tool`?(P(),F(`div`,Rg,[L(`div`,null,[R(A(Us),{size:18}),L(`strong`,null,E(e.item.call.name),1),L(`span`,null,E(e.item.call.status),1)]),e.item.call.output?(P(),F(`pre`,zg,E(e.item.call.output),1)):B(``,!0),e.item.call.name===`run_durable_job`&&A(Nh)(e.item.call.callId)?(P(),I(Sg,{key:1,run:A(Nh)(e.item.call.callId)},null,8,[`run`])):B(``,!0)])):e.item.entryKind===`demo.job`&&A(Mh)(e.item.data.taskId)?(P(),I(Sg,{key:4,run:A(Mh)(e.item.data.taskId)},null,8,[`run`])):(P(),F(N,{key:5},[L(`div`,Bg,[e.item.entryKind===`demo.state-change`?(P(),I(A(Qs),{key:0,size:18})):(P(),I(A(Tc),{key:1,size:18})),L(`span`,null,E(e.item.text),1),L(`button`,{class:`fork-button`,"aria-label":`Fork at entry ${e.item.id}`,onClick:a[2]||=t=>n(`fork`,e.item.id)},[R(A(vc),{size:18}),a[13]||=z(`Fork `,-1)],8,Vg)]),e.item.note?(P(),F(`details`,Hg,[a[14]||=L(`summary`,null,`Context note`,-1),L(`pre`,null,E(e.item.note),1)])):B(``,!0)],64))],2))}}),Wg={key:0,class:`git-chip-wrap`},Gg=[`title`],Kg={class:`branch`},qg={key:0,class:`dirty`},Jg={key:1,class:`ahead`},Yg={key:2,class:`behind`},Xg=Or({__name:`GitChip`,props:{deviceId:{},cwd:{}},setup(e){let t=e,n=V(()=>t.cwd??xu.value?.cwd??``),r=V(()=>t.deviceId??hu.value),i=V(()=>Dd(r.value||`?`,n.value||`?`)),a=V(()=>i.value.status),o=V(()=>i.value.loading),s=V(()=>(a.value?.staged??0)+(a.value?.unstaged??0)+(a.value?.untracked??0));return kd(r.value||`?`,n.value||`?`),Jr(()=>kd(r.value||`?`,n.value||`?`)),j([r,n],()=>void kd(r.value||`?`,n.value||`?`)),(e,t)=>a.value?.repo||o.value?(P(),F(`span`,Wg,[L(`button`,{class:`crumb git-chip`,title:a.value?`${a.value.root} · ${a.value.head??``} ${a.value.subject??``} — opens the Git tab`:`loading git…`,onClick:t[0]||=e=>A(td)(`git`)},[R(A(gc),{size:16,"aria-hidden":`true`}),L(`span`,Kg,E(a.value?.branch??a.value?.head??`…`),1),s.value?(P(),F(`span`,qg,`±`+E(s.value),1)):B(``,!0),a.value?.ahead?(P(),F(`span`,Jg,`↑`+E(a.value.ahead),1)):B(``,!0),a.value?.behind?(P(),F(`span`,Yg,`↓`+E(a.value.behind),1)):B(``,!0),R(A(tc),{size:14,"aria-hidden":`true`})],8,Gg)])):B(``,!0)}}),Zg=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Qg=Zg(Xg,[[`__scopeId`,`data-v-c0fb9e98`]]),$g=()=>globalThis.crypto?.randomUUID?.()??`${Date.now()}-${Math.random().toString(36).slice(2)}`,e_=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`],t_={enabled:!0,reserveTokens:16384,backgroundTokens:32768,keepRecentTokens:2e3},n_={auto:2e5,wait:25e4};function r_(e){if(!(e>0))return{...t_};let t=Math.min(n_.wait,e-t_.reserveTokens),n=Math.min(n_.auto,t-t_.backgroundTokens);return{...t_,reserveTokens:e-t,backgroundTokens:t-n}}function i_(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 a_=(e,t)=>{if(e===void 0)throw Error(`No ${t} selected`);return e},o_=[{name:`compact`,args:`[instructions]`,description:`Summarize older context; stored entries stay`,run:async e=>{await a_(Cu.value,`agent`).compact(e||void 0),G(`Compaction requested. /tasks shows its outcome.`)}},{name:`reset`,args:`[handoff note]`,description:`Start a fresh context; history stays stored`,run:async e=>{await a_(Cu.value,`agent`).reset(e||void 0),G(`New context started.`)}},{name:`tasks`,description:`Open the Tasks panel`,run:()=>td(`tasks`)},{name:`new`,args:`[name]`,description:`New agent in this workspace`,run:async e=>{let t=a_(U.value,`workspace`),n=await a_(wu.value,`workspace`).createAgent(e?{name:e}:{});Tu({...t,agentId:n.id}),G(`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??Nu.value.entries.filter(e=>e.kind===`pi.assistant`).at(-1)?.id;if(a===void 0)throw Error(`Nothing to fork yet`);let o=a_(U.value,`agent`),s=await a_(Cu.value,`agent`).fork({entryId:a,name:i||void 0});Tu({...o,agentId:s.id}),G(`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 a_(Cu.value,`agent`).rename(e),G(`Agent renamed to ${e}.`)}},{name:`model`,description:`Choose this agent's model`,run:()=>W.dialog={kind:`models`}},{name:`thinking`,args:`<level>`,description:`Thinking level: ${e_.join(`, `)}`,run:async e=>{if(!e_.includes(e))throw Error(`Levels: ${e_.join(`, `)}`);await a_(Cu.value,`agent`).configure({thinkingLevel:e}),await Hu(),G(`Thinking ${e}. Used on the next turn.`)}},{name:`help`,description:`How this works, keys and commands`,run:()=>W.dialog={kind:`help`}}];function s_(e){let t=e.trim().match(/^\/(\S+)\s*([\s\S]*)$/),n=t&&o_.find(e=>e.name===t[1]);return n?{command:n,arg:t[2].trim()}:void 0}var c_={class:`composer-region`},l_={key:0,class:`queue`},u_=[`aria-label`,`onClick`],d_={class:`composer`},f_={key:0,class:`slash-menu`,role:`listbox`,"aria-label":`Slash commands`},p_=[`aria-selected`,`onMousedown`],m_={key:0,class:`slash-args`},h_={class:`slash-desc`},g_={class:`composer-toolbar`},__={class:`composer-left`},v_={class:`queue-mode`},y_={class:`composer-right`},b_=[`disabled`],x_=[`disabled`],S_=Or({__name:`Composer`,setup(e){let t=k(`followUp`),n=k(!1),r=V(()=>_u.value&&Nu.value.ready&&yu.status.value===`live`&&cu.value===`live`),i=k(0),a=k(!1),o=V(()=>{let e=W.composer.match(/^\/(\S*)$/);return e&&!a.value?o_.filter(t=>t.name.startsWith(e[1].toLowerCase())):[]});j(()=>W.composer,()=>{i.value=0,W.composer.startsWith(`/`)||(a.value=!1)});async function s(e,t=!1){!e.args||t&&e.args.startsWith(`[`)&&W.composer===`/${e.name}`?(W.composer=`/${e.name}`,await u()):W.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=s_(e);return t?(n.value=!0,await Wu(async()=>{await t.command.run(t.arg),W.composer=``}),n.value=!1,!0):!1}async function u(){let e=W.composer.trim(),i=Cu.value;if(!e||n.value||!i||!r.value||e.startsWith(`/`)&&await l(e))return;n.value=!0;let a=U.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:$g();sessionStorage.setItem(`dpi.pending-send`,JSON.stringify({key:o,content:e,mode:t.value,requestId:c})),await Wu(async()=>{await i.send(e,t.value,c),sessionStorage.removeItem(`dpi.pending-send`),W.composer=``}),n.value=!1}function d(e){Wu(()=>Cu.value.withdraw(e))}return(e,a)=>(P(),F(`div`,c_,[A(Nu).inbox.length?(P(),F(`div`,l_,[(P(!0),F(N,null,M(A(Nu).inbox,e=>(P(),F(`div`,{key:e.id},[R(A(ac),{size:18}),L(`span`,null,E(e.mode===`steer`?`Steer`:`Queued`)+`: `+E(e.content??`Context update`),1),L(`button`,{class:`icon-button`,"aria-label":`Withdraw submission ${e.id}`,title:`Withdraw queued input`,onClick:t=>d(e.id)},[R(A(ol),{size:18})],8,u_)]))),128))])):B(``,!0),L(`div`,d_,[o.value.length?(P(),F(`ul`,f_,[(P(!0),F(N,null,M(o.value,(e,t)=>(P(),F(`li`,{key:e.name,role:`option`,"aria-selected":t===i.value,class:w({active:t===i.value}),onMousedown:js(t=>s(e),[`prevent`])},[L(`code`,null,`/`+E(e.name),1),e.args?(P(),F(`span`,m_,E(e.args),1)):B(``,!0),L(`span`,h_,E(e.description),1)],42,p_))),128))])):B(``,!0),Un(L(`textarea`,{"onUpdate:modelValue":a[0]||=e=>A(W).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,A(W).composer]]),L(`div`,g_,[L(`div`,__,[L(`div`,v_,[Un(L(`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]||=[L(`option`,{value:`followUp`},`Follow-up`,-1),L(`option`,{value:`steer`},`Steer`,-1),L(`option`,{value:`reject`},`Reject if busy`,-1)]],512),[[ws,t.value]]),R(A(tc),{size:24,"aria-hidden":`true`})])]),L(`div`,y_,[L(`button`,{class:`interrupt`,disabled:!A(Lu)||A(Xu),title:`Stop foreground work and owned subagents (Escape). Background jobs continue.`,onClick:a[2]||=(...e)=>A(Zu)&&A(Zu)(...e)},[R(A(Pc),{size:24,class:`stop-sign`,fill:`currentColor`}),a[4]||=z(`Interrupt`,-1)],8,b_),L(`button`,{class:`send`,"aria-label":`Send message`,disabled:!A(W).composer.trim()||n.value||!r.value,onClick:u},[R(A(Ys),{size:20})],8,x_)])])]),a[5]||=L(`div`,{class:`composer-footnote`},[L(`span`,null,[L(`i`,{class:`live-dot`}),z(`Closing this window never interrupts your agent.`)])],-1)]))}}),C_={class:`chat-panel`},w_={class:`chat-header`},T_={class:`lineage-picker`},E_={class:`lineage-toolbar`},D_=[`title`],O_={class:`crumb-main`},k_={class:`device-chip`},A_=[`title`],j_={class:`crumb-main`},M_={class:`crumb-name`},N_=[`aria-current`,`title`,`onClick`],P_={class:`crumb-kind`},F_={class:`crumb-main`},I_={class:`crumb-name`},L_=[`disabled`],R_=[`aria-expanded`],z_={key:0,class:`lineage-source`},B_={id:`conversation-picker`,class:`conversation-picker`,role:`dialog`,"aria-label":`Choose conversation`},V_=[`aria-label`,`aria-current`,`onClick`],H_={class:`conversation-choice-content`},U_={class:`choice-lineage`},W_={class:`choice-source`},G_={key:0,class:`agent-stream-status`,role:`alert`},K_=[`disabled`],q_={key:0,class:`chat-empty`},J_={key:0},Y_={key:1},X_={key:0,class:`chat-empty`},Z_={class:`starter-grid`},Q_={key:1,class:`entry live-generation`},$_={class:`message-label`},ev={class:`streaming`},tv={key:2,class:`hint retry-note`},nv=Or({__name:`AgentView`,setup(e){let t=k(),n=k(),r=k(!1),i=V(()=>Nu.value.items),a=V(()=>i.value.some(e=>e.kind===`assistant`&&e.streaming)),o=V(()=>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=V(()=>Pu.value.map(e=>({...e,lineage:xl(Pu.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=V(()=>Fu.value.at(-1)),u=e=>e.kind===`root`?`agent`:e.kind;function d(){U.value&&(pu.tree=!0,Ou(U.value.deviceId,!0))}function f(){let e=Pu.value.find(e=>e.kind===`root`)??Pu.value[0];e&&p(e.id)}function p(e){r.value=!1,U.value&&Tu({...U.value,agentId:e})}function m(e){let t=Cu.value,n=U.value;t&&n&&(W.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});Tu({...n,agentId:i.id}),G(`Forked at entry #${e}. App State stays shared.`)}})}function h(){let e=Cu.value,t=l.value;e&&t&&(W.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)})}j(U,()=>{r.value=!1});let g=!0;return j(yu.version,()=>{let e=t.value;g=!e||e.scrollHeight-e.scrollTop-e.clientHeight<120},{flush:`pre`}),j(yu.version,()=>{g&&An(()=>t.value?.scrollTo({top:t.value.scrollHeight,behavior:`instant`}))}),j(()=>Fu.value.length,()=>void An(()=>n.value&&(n.value.scrollLeft=n.value.scrollWidth))),(e,g)=>(P(),F(`section`,C_,[L(`header`,w_,[L(`div`,T_,[L(`div`,E_,[L(`nav`,{ref_key:`lineageNav`,ref:n,class:`crumbs conversation-lineage`,"aria-label":`Conversation lineage`},[L(`button`,{class:`crumb`,title:`${A(gu)?.name} · ${A(gu)?.url}`,onClick:d},[g[5]||=L(`span`,{class:`crumb-kind`},`device`,-1),L(`span`,O_,[R(xd,{device:A(gu),size:18},null,8,[`device`]),L(`span`,k_,E(A(gu)?.name??A(gu)?.id),1)])],8,D_),R(A(nc),{class:`crumb-sep`,size:18,"aria-hidden":`true`}),L(`button`,{class:`crumb`,title:A(xu)?.cwd,onClick:f},[g[6]||=L(`span`,{class:`crumb-kind`},`workspace`,-1),L(`span`,j_,[R(A(mc),{size:18,"aria-hidden":`true`}),L(`span`,M_,E(A(xu)?.name),1)])],8,A_),A(xu)?.cwd?(P(),I(Qg,{key:0})):B(``,!0),(P(!0),F(N,null,M(A(Fu),e=>(P(),F(N,{key:e.id},[R(A(nc),{class:`crumb-sep`,size:18,"aria-hidden":`true`}),L(`button`,{class:w([`crumb`,{current:e.id===A(U)?.agentId}]),"aria-current":e.id===A(U)?.agentId?`page`:void 0,title:s(e),onClick:t=>p(e.id)},[L(`span`,P_,E(u(e)),1),L(`span`,F_,[e.kind===`fork`?(P(),I(A(vc),{key:0,size:18,"aria-hidden":`true`})):e.kind===`subagent`?(P(),I(A(sc),{key:1,size:18,"aria-hidden":`true`})):(P(),I(A(Ac),{key:2,size:18,"aria-hidden":`true`})),L(`span`,I_,E(e.name),1)])],10,N_)],64))),128))],512),L(`button`,{class:`icon-button`,"aria-label":`Rename agent`,title:`Rename this agent`,disabled:!l.value,onClick:h},[R(A(Bc),{size:18})],8,L_),L(`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},[R(A(tc),{size:18})],8,R_)]),l.value&&l.value.kind!==`root`?(P(),F(`div`,z_,E(s(l.value)),1)):B(``,!0),r.value?(P(),F(N,{key:1},[L(`button`,{class:`conversation-menu-dismiss`,"aria-label":`Close conversation picker`,onClick:g[1]||=e=>r.value=!1}),L(`section`,B_,[g[7]||=L(`div`,{class:`conversation-picker-heading`},`Roots & forks`,-1),(P(!0),F(N,null,M(c.value,e=>(P(),F(`button`,{key:e.id,class:w([`conversation-choice`,{selected:e.id===A(U)?.agentId}]),"aria-label":e.lineage.map(e=>e.name).join(` → `),"aria-current":e.id===A(U)?.agentId?`page`:void 0,onClick:t=>p(e.id)},[L(`div`,H_,[L(`span`,U_,[(P(!0),F(N,null,M(e.lineage,(t,n)=>(P(),F(N,{key:t.id},[n?(P(),I(A(nc),{key:0,size:18,"aria-hidden":`true`})):B(``,!0),L(`span`,{class:w({"choice-ancestor":n<e.lineage.length-1})},E(t.name),3)],64))),128))]),L(`span`,W_,E(s(e)),1)]),e.id===A(U)?.agentId?(P(),I(A(ec),{key:0,size:18,"aria-hidden":`true`})):e.kind===`fork`?(P(),I(A(vc),{key:1,size:18,"aria-hidden":`true`})):(P(),I(A(Ac),{key:2,size:18,"aria-hidden":`true`}))],10,V_))),128))])],64)):B(``,!0)])]),A(yu).fault.value||A(yu).status.value===`fault`||A(yu).status.value===`reconnecting`||A(Nu).ready&&A(yu).status.value===`connecting`?(P(),F(`div`,G_,[L(`div`,null,[L(`strong`,null,E(A(Nu).ready?`Cached transcript is stale.`:`Agent stream unavailable.`),1),L(`p`,null,E(A(yu).fault.value||`Updates are paused while the stream reconnects.`),1),g[8]||=L(`p`,null,`Sending is paused until a fresh snapshot arrives. Your draft is kept.`,-1)]),L(`button`,{disabled:A(yu).status.value===`connecting`,onClick:g[2]||=(...e)=>A(yu).retry&&A(yu).retry(...e)},` Retry stream `,8,K_)])):B(``,!0),L(`div`,{ref_key:`chat`,ref:t,class:`chat-scroll`,"data-testid":`chat`},[A(Nu).ready?(P(),F(N,{key:1},[i.value.length?B(``,!0):(P(),F(`div`,X_,[g[13]||=L(`div`,{class:`agent-orb`},[L(`img`,{src:`/icons/durable-pi.svg`,alt:`Durable Pi`}),L(`i`)],-1),g[14]||=L(`span`,{class:`eyebrow`},`YOUR DURABLE AGENT IS READY`,-1),g[15]||=L(`h2`,null,`A conversation with continuity.`,-1),L(`p`,null,`Messages, tools and state live on `+E(A(gu)?.id)+`, beyond this window.`,1),L(`div`,Z_,[L(`button`,{onClick:g[3]||=e=>A(Gu)(`Inspect this directory using your tools and give me a brief overview. Do not modify any files.`)},[R(A(mc),{size:18}),g[9]||=L(`strong`,null,`Explore this directory`,-1),g[10]||=L(`span`,null,`See coding tools in action`,-1),R(A(Js),{size:18})]),L(`button`,{onClick:g[4]||=e=>A(Gu)(`Use read_state, then update_state to add a field called progress with value 1 and a boolean called ready with value false.`)},[R(A(Qs),{size:18}),g[11]||=L(`strong`,null,`Make a state change`,-1),g[12]||=L(`span`,null,`Watch the workspace update`,-1),R(A(Js),{size:18})])])])),(P(!0),F(N,null,M(i.value,e=>(P(),I(Ug,{key:e.id,item:e,onFork:m},null,8,[`item`]))),128)),A(Nu).running&&!a.value&&!o.value?(P(),F(`div`,Q_,[L(`div`,$_,[g[16]||=z(` AGENT `,-1),L(`span`,ev,E(A(Nu).retry?`Retry scheduled`:`Working`),1)]),g[17]||=L(`div`,{class:`typing`},[L(`i`),L(`i`),L(`i`)],-1)])):B(``,!0),A(Nu).retry?(P(),F(`p`,tv,` Retrying: `+E(A(Nu).retry.error),1)):B(``,!0),(P(!0),F(N,null,M(A(Nu).notices,(e,t)=>(P(),F(`p`,{key:t,class:`message-error`},E(e),1))),128))],64)):(P(),F(`div`,q_,[R(A(Us),{size:30}),A(yu).status.value===`fault`?(P(),F(`h2`,J_,`This agent is unavailable.`)):(P(),F(`h2`,Y_,`Connecting to the agent…`)),L(`p`,null,`The agent keeps working on `+E(A(gu)?.id)+` while this view connects.`,1)]))],512),R(S_)]))}});function rv(e,t){return`${e}/${t.replaceAll(`~`,`~0`).replaceAll(`/`,`~1`)}`}var iv=[`data-state-path`],av={key:0,class:`state-field-heading`},ov=[`value`,`aria-label`,`disabled`],sv=[`value`],cv=[`aria-label`,`disabled`],lv=[`aria-label`,`disabled`],uv=[`aria-label`,`disabled`],dv=[`value`],fv=[`disabled`],pv=[`disabled`,`aria-label`],mv={key:2,class:`state-number`},hv=[`aria-label`,`disabled`],gv=[`aria-label`,`disabled`],_v=[`aria-label`,`disabled`],vv={key:3,class:`state-boolean`},yv=[`aria-label`,`aria-checked`,`disabled`],bv=[`aria-label`,`disabled`],xv={key:5,class:`muted`},Sv=Or({__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=V(()=>n.value===null?`null`:Array.isArray(n.value)?`array`:typeof n.value),a=V(()=>i.value===`object`||i.value===`array`),o=V(()=>a.value?Object.entries(n.value):[]),s=k(``),c=k(!1),l=k(``),u=k(`string`),d=k(!1),f=[`string`,`number`,`boolean`,`object`,`array`,`null`],p={string:()=>``,number:()=>0,boolean:()=>!1,object:()=>({}),array:()=>[],null:()=>null};j(()=>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:rv(n.path,e),value:p[u.value]()}),l.value=``,d.value=!1)}return(t,n)=>{let _=$r(`StateEditor`,!0);return P(),F(`div`,{class:w([`state-field`,{"state-root":e.path===``}]),"data-state-path":e.path},[e.path===``?B(``,!0):(P(),F(`div`,av,[L(`strong`,null,E(e.label),1),L(`select`,{value:i.value,"aria-label":`Type of ${e.path}`,disabled:e.disabled,onChange:n[0]||=e=>m(`update`,p[e.target.value]())},[(P(),F(N,null,M(f,e=>L(`option`,{key:e,value:e},E(e),9,sv)),64))],40,ov),L(`button`,{class:`icon-button`,"aria-label":`Delete ${e.path}`,title:`Delete field`,disabled:e.disabled,onClick:n[1]||=e=>m(`delete`)},[R(A($c),{size:18})],8,cv)])),a.value?(P(),F(N,{key:1},[(P(!0),F(N,null,M(o.value,([t,i])=>(P(),I(_,{key:t,value:i,path:A(rv)(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`?(P(),F(`form`,{key:0,class:`state-add`,onSubmit:js(g,[`prevent`])},[i.value===`array`?B(``,!0):Un((P(),F(`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,lv)),[[xs,l.value]]),Un(L(`select`,{"onUpdate:modelValue":n[4]||=e=>u.value=e,"aria-label":`New field type in ${e.path||`/`}`,disabled:e.disabled},[(P(),F(N,null,M(f,e=>L(`option`,{key:e,value:e},E(e),9,dv)),64))],8,uv),[[ws,u.value]]),L(`button`,{class:`secondary small`,disabled:e.disabled||i.value!==`array`&&!l.value.trim()},` Add `,8,fv),L(`button`,{type:`button`,class:`text-button`,onClick:n[5]||=e=>d.value=!1},`Cancel`)],32)):i.value===`array`?(P(),F(`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},[R(A(Hc),{size:18}),z(E(i.value===`array`?`Add item`:`Add field`),1)],8,pv)):B(``,!0)],64)):i.value===`number`?(P(),F(`div`,mv,[L(`button`,{class:`secondary`,"aria-label":`Decrement ${e.path}`,disabled:e.disabled,onClick:n[7]||=e=>m(`increment`,-1)},[R(A(jc),{size:18})],8,hv),Un(L(`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,gv),[[xs,s.value]]),L(`button`,{class:`secondary`,"aria-label":`Increment ${e.path}`,disabled:e.disabled,onClick:n[11]||=e=>m(`increment`,1)},[R(A(Hc),{size:18})],8,_v)])):i.value===`boolean`?(P(),F(`div`,vv,[L(`button`,{class:w([`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]||=[L(`span`,null,null,-1)]],10,yv),L(`span`,null,E(e.value),1)])):i.value===`string`?Un((P(),F(`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,bv)),[[xs,s.value]]):(P(),F(`span`,xv,`null`))],10,iv)}}}),Cv=[`data-status`],wv=[`title`],Tv=[`title`],Ev=[`href`],Dv=[`title`],Ov=Or({__name:`TunnelStatusBar`,props:{device:{}},setup(e){let t=e,n=V(()=>t.device.status===`online`),r=V(()=>t.device.transport===`tunnel`),i=V(()=>n.value?r.value?`online · via tunnel`:`online · LAN`:r.value?`tunnel`:`LAN`),a=V(()=>t.device.tunnel?.state===`connected`);return(t,o)=>(P(),F(`span`,{class:`tunnel-status`,"data-status":e.device.status},[L(`span`,{class:`axis transport`,title:r.value?`Hub ⇄ device over the tunnel (WSS)`:`Hub → device over LAN`},[r.value?(P(),I(A($s),{key:0,size:13,class:w({live:a.value})},null,8,[`class`])):(P(),I(A(rl),{key:1,size:13,class:w({live:n.value})},null,8,[`class`])),z(` `+E(i.value),1)],8,wv),L(`span`,{class:w([`axis monitor`,e.device.status])},[e.device.status===`offline`?(P(),I(A(nl),{key:0,size:13})):(P(),F(N,{key:1},[z(E(e.device.status),1)],64))],2),r.value&&a.value&&e.device.tunnel?(P(),F(`span`,{key:0,class:`axis muted`,title:`tunnel last seen ${A(Yu)(e.device.tunnel.lastSeenAt)}`},E(e.device.tunnel.readerCount)+` reader`+E(e.device.tunnel.readerCount===1?``:`s`),9,Tv)):B(``,!0),e.device.url?(P(),F(`a`,{key:1,class:`axis url`,href:e.device.url,target:`_blank`,rel:`noreferrer`},E(e.device.url),9,Ev)):B(``,!0),e.device.lastSeenAt?(P(),F(`span`,{key:2,class:`axis muted`,title:`last probe ${A(Yu)(e.device.lastSeenAt)}`},E(A(Yu)(e.device.lastSeenAt)),9,Dv)):B(``,!0)],8,Cv))}});async function kv(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 Fl(e?.code??`internal`,e?.message??`${a.status} ${a.statusText}`,a.status)}return o}function Av(e){return e.offerUrl??e.pairUrl}var jv={pending:e=>kv(`GET`,`/pair/codes`,void 0,e),pairings:e=>kv(`GET`,`/pairings`,void 0,e),createCode:e=>kv(`POST`,`/pair/code`,{},e),resolveCode:(e,t)=>kv(`POST`,`/pair/resolve`,{code:e},t),codeState:(e,t)=>kv(`GET`,`/pair/codes/${encodeURIComponent(e)}`,void 0,t),approve:(e,t,n)=>kv(`POST`,`/pair/codes/${encodeURIComponent(e)}/approve`,t,n),cancel:(e,t,n)=>kv(`POST`,`/pair/codes/${encodeURIComponent(e)}/cancel`,{},t,n),rotate:(e,t)=>kv(`POST`,`/pairings/${encodeURIComponent(e)}/rotate`,{},t),revoke:(e,t=`user`,n)=>kv(`POST`,`/pairings/${encodeURIComponent(e)}/revoke`,{reason:t},n)},Mv=0;function Nv(){let e=++Mv,t=!1;return{gen:e,close:()=>t=!0,closed:()=>t}}var Pv=class extends Error{codeId;constructor(e){super(`pairing poll timed out for ${e}`),this.codeId=e,this.name=`PollTimeout`}},Fv=e=>e===`issued`||e===`cancelled`||e===`expired`;async function Iv(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 Pv(t);let a=await jv.codeState(t,n.signal);if(e.closed())return;if(e.state=a,n.onState?.(a),Fv(a.phase))return a;await new Promise(e=>setTimeout(e,r))}}var Lv={key:0,class:`token-manager`,"aria-label":`Credential manager`},Rv={class:`credential-fingerprint`},zv=[`title`],Bv={key:0,class:`rotation-badge`,role:`status`},Vv={class:`token-actions`},Hv=[`disabled`],Uv=[`disabled`],Wv={key:1,class:`message-error`,role:`alert`},Gv=Or({__name:`TokenManager`,props:{device:{}},setup(e){let t=e,n=k(!1),r=k(``),i=V(()=>t.device.pairing);async function a(){if(!n.value){n.value=!0,r.value=``;try{await jv.rotate(t.device.id),G(`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||(W.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 jv.revoke(t.device.id,`user`),G(`Revoke committed on the hub. The tunnel is cut; the device cleans up on its next contact.`)}})}return(e,t)=>i.value?(P(),F(`section`,Lv,[L(`header`,null,[R(A(Cc),{size:15}),t[0]||=L(`h3`,null,`Credential`,-1),L(`span`,{class:w([`pairing-status`,i.value.status])},E(i.value.status),3)]),L(`dl`,null,[t[1]||=L(`dt`,null,`Key fingerprint`,-1),L(`dd`,null,[L(`code`,Rv,E(i.value.keyFingerprint),1)]),t[2]||=L(`dt`,null,`Paired`,-1),L(`dd`,{title:new Date(i.value.pairedAt).toISOString()},E(A(Yu)(i.value.pairedAt)),9,zv),t[3]||=L(`dt`,null,`Generation`,-1),L(`dd`,null,E(i.value.credentialGeneration),1)]),i.value.rotationPending?(P(),F(`p`,Bv,[R(A(Wc),{size:13,class:`spin`}),t[4]||=z(` rotation queued — waiting for the device to ACK `,-1)])):B(``,!0),L(`div`,Vv,[i.value.status===`paired`?(P(),F(`button`,{key:0,class:`small`,disabled:n.value||i.value.rotationPending,onClick:a},[R(A(Wc),{size:14}),t[5]||=z(` Rotate credential `,-1)],8,Hv)):B(``,!0),i.value.status===`paired`?(P(),F(`button`,{key:1,class:`small danger`,disabled:n.value,onClick:o},[R(A(Yc),{size:14}),t[6]||=z(` Revoke `,-1)],8,Uv)):B(``,!0)]),r.value?(P(),F(`p`,Wv,E(r.value),1)):B(``,!0)])):B(``,!0)}}),Kv={class:`tasks-panel`},qv={class:`panel-heading`},Jv={class:`tag`},Yv={key:0,class:`message-error`,role:`alert`},Xv={class:`task-section`,"aria-label":`Durable jobs`},Zv={key:0,class:`task-empty`},Qv=[`data-job`],$v={class:`job-def-head`},ey={key:0,class:`tag`},ty={class:`tag`},ny=[`aria-label`],ry=[`title`],iy={class:`job-def-meta`},ay=[`title`],oy=[`title`],sy={key:0,class:`job-def-last`},cy=[`onClick`],ly=[`disabled`,`onClick`],uy=[`disabled`,`onClick`],dy=[`disabled`,`onClick`],fy={class:`task-section`,"aria-label":`Agent activity`},py={class:`panel-heading`},my={key:0,class:`task-empty`},hy={key:1,class:`task-tree`},gy=[`data-task-kind`],_y={class:`tag`},vy={key:0,class:`task-phase`},yy=[`onClick`],by=[`disabled`],xy={class:`raw`},Sy=Or({__name:`TasksPanel`,setup(e){let t=k(``),n=k(!1),r=k([]),i=k(),a=e=>({running:`Running`,waiting:`Waiting`,completed:`Completed`,aborted:`Stopped`,declined:`Declined`,failed:`Failed`,pending:`Queued`,completing:`Finishing`,terminal:`Finished`})[e]??e,o=V(()=>new Map(kh.value.map(e=>[e.id,jh.value.find(t=>t.job===e.id)]))),s=V(()=>{let e=Iu.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:al,name:e.label??`Tool call`,what:`tool call`}:e.kind===`pi.generation`?{icon:Zs,name:`Model response`,what:`generation`}:e.kind===`pi.compaction`?{icon:Tc,name:`Compaction`,what:`compaction`}:e.kind.startsWith(`demo.job.`)?{icon:il,name:e.label??Ah(e.kind.slice(9))?.title??e.kind,what:`durable job`}:e.kind===`demo.job-approval`?{icon:Jc,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&&Cu.value){n.value=!0,t.value=``;try{await Cu.value.abort(!0)}catch(e){t.value=Zl(e)}finally{n.value=!1}}}async function d(e){let n=wu.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=V(()=>r.value.filter(e=>e.state.status===`terminal`).slice(-12).reverse());return(e,r)=>(P(),F(`div`,Kv,[L(`div`,qv,[r[0]||=L(`h2`,null,`Tasks`,-1),L(`span`,Jv,E(A(Iu).length)+` active`,1)]),t.value?(P(),F(`p`,Yv,E(t.value),1)):B(``,!0),L(`section`,Xv,[L(`h3`,null,[R(A(Gc),{size:18}),r[1]||=z(`Durable jobs`,-1)]),r[2]||=L(`p`,{class:`hint`},[z(` 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 `),L(`code`,null,`list_durable_jobs`),z(`, starts them with `),L(`code`,null,`run_durable_job`),z(` and checks them with `),L(`code`,null,`check_durable_job`),z(`. Runs play out live in the chat. `)],-1),A(kh).length?B(``,!0):(P(),F(`p`,Zv,` This device has no durable jobs. Deploy the latest backend to it. `)),(P(!0),F(N,null,M(A(kh),e=>(P(),F(`article`,{key:e.id,class:`job-def`,"data-job":e.id},[L(`div`,$v,[R(A(il),{size:18}),L(`strong`,null,E(e.title),1),e.approval?(P(),F(`span`,ey,`needs approval`)):B(``,!0),L(`span`,ty,`~`+E(e.seconds)+`s`,1)]),L(`p`,null,E(e.summary),1),L(`ol`,{class:`job-chain`,"aria-label":`${e.title} phases`},[(P(!0),F(N,null,M(e.phases,(e,t)=>(P(),F(`li`,{key:e.id,title:e.summary},[L(`span`,null,E(t+1),1),z(E(e.label),1),e.kind===`repeat`?(P(),I(A(Gc),{key:0,size:13})):B(``,!0),e.kind===`approval`?(P(),I(A(Jc),{key:1,size:13})):B(``,!0)],8,ry))),128))],8,ny),L(`div`,iy,[(P(!0),F(N,null,M(e.inputs,e=>(P(),F(`code`,{key:e.name,title:e.description},E(e.name)+`=`+E(e.default),9,ay))),128)),L(`code`,{title:`Each run saves its result to App State ${e.resultPath}`},`→ `+E(e.resultPath),9,oy)]),o.value.get(e.id)?(P(),F(`div`,sy,[L(`span`,null,[z(`Run #`+E(o.value.get(e.id).run)+`: `,1),L(`strong`,null,E(a(o.value.get(e.id).status)),1),A(Oh)(o.value.get(e.id))?B(``,!0):(P(),F(N,{key:0},[z(` in `+E(o.value.get(e.id).phases.find(t=>t.id===o.value.get(e.id).phase)?.label),1)],64))]),L(`button`,{class:`text-button`,onClick:t=>A(Rh)(o.value.get(e.id).id)},` Show in chat `,8,cy),o.value.get(e.id).approval===`pending`?(P(),F(N,{key:0},[L(`button`,{class:`primary small`,disabled:!!A(Ih),onClick:t=>A(Bh)(o.value.get(e.id),!0)},` Approve `,8,ly),L(`button`,{class:`secondary`,disabled:!!A(Ih),onClick:t=>A(Bh)(o.value.get(e.id),!1)},` Decline `,8,uy)],64)):B(``,!0)])):B(``,!0),L(`button`,{class:`secondary job-def-run`,disabled:!!A(Ih)||!A(Cu),onClick:t=>A(zh)(e)},[R(A(Vc),{size:16}),z(`Run `+E(e.title),1)],8,dy)],8,Qv))),128))]),L(`section`,fy,[L(`div`,py,[r[3]||=L(`h3`,null,`Agent activity`,-1),R(A(Us),{size:18})]),r[5]||=L(`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?(P(),F(`ul`,hy,[(P(!0),F(N,null,M(s.value,({task:e,depth:t})=>(P(),F(`li`,{key:e.id,class:`task-row`,style:ve({"--depth":t}),"data-task-kind":e.kind},[(P(),I(ti(c(e).icon),{size:16})),L(`strong`,null,E(c(e).name),1),L(`span`,_y,E(a(e.state.status)),1),l(e)?(P(),F(`span`,vy,E(l(e)),1)):B(``,!0),L(`small`,null,`#`+E(e.id)+` `+E(c(e).what)+`, agent #`+E(e.conversationId)+E(e.effectiveBackground?`, background`:``),1),(P(!0),F(N,null,M(e.conversations,e=>(P(),F(`button`,{key:e,class:`text-button`,onClick:t=>A(Hh)(e)},` Open agent #`+E(e),9,yy))),128))],12,gy))),128))])):(P(),F(`p`,my,`Nothing running. Send a message or run a job.`)),r[6]||=L(`p`,{class:`hint`},` Interrupt or Esc stops foreground work and what it owns. Stop all also stops background runs. `,-1),L(`button`,{class:`secondary danger`,disabled:!A(Iu).length||n.value,onClick:u},[R(A(Pc),{size:18}),r[4]||=z(`Stop all `,-1)],8,by)]),L(`details`,{class:`raw task-section`,onToggle:d},[L(`summary`,null,[R(A(ac),{size:18}),r[7]||=z(`Runtime details`,-1)]),r[9]||=L(`p`,{class:`hint`},` Recent task results and recovery records, read from the device when opened. `,-1),(P(!0),F(N,null,M(f.value,e=>(P(),F(`details`,{key:e.id,class:`raw`},[L(`summary`,null,[z(E(e.kind)+` #`+E(e.id),1),L(`span`,null,E(a(e.state.outcome?.status??e.state.status)),1)]),L(`pre`,null,E(JSON.stringify(e.state.outcome,null,2)),1)]))),128)),L(`details`,xy,[r[8]||=L(`summary`,null,`Recovery inspection`,-1),L(`pre`,null,E(JSON.stringify(i.value,null,2)),1)])],32)]))}}),Cy={class:`git-pane`},wy={key:0,class:`hint`},Ty={key:0,class:`hint`},Ey={key:1,class:`muted-line`},Dy={key:2,class:`message-error`},Oy={key:0,class:`hint`},ky={key:0,class:`message-error merge-banner`},Ay=[`disabled`],jy={class:`panel-heading git-top`},My={class:`branch-wrap`},Ny=[`disabled`],Py={key:0,class:`menu`},Fy=[`onClick`],Iy={class:`muted-line`},Ly={class:`new-branch`},Ry=[`disabled`],zy={class:`auto-stash`},By={class:`tag`},Vy={key:0,class:`tag`},Hy={key:1,class:`tag`},Uy={key:2,class:`tag`,title:`vs the picked base`},Wy={class:`tag`},Gy=[`href`],Ky=[`disabled`],qy={class:`row ops`},Jy=[`disabled`],Yy=[`disabled`],Xy=[`disabled`],Zy=[`disabled`],Qy=[`disabled`],$y={key:1,class:`message-error hintbox`},eb=[`disabled`],tb=[`disabled`],nb={key:2,class:`message-error hintbox`},rb=[`disabled`],ib={class:`task-section`,"aria-label":`Commit`},ab={class:`panel-heading`},ob={class:`tag`},sb=[`disabled`],cb={key:0,class:`hintbox warn`},lb={key:1,class:`muted-line cap`},ub={key:2,class:`files`},db={class:`file all`},fb=[`checked`],pb={class:`muted-line`},mb=[`onClick`],hb={class:`muted-line`},gb={class:`file-label`},_b=[`checked`,`onChange`],vb=[`title`],yb=[`title`],bb={class:`file-acts`},xb=[`onClick`],Sb=[`onClick`],Cb=[`onClick`],wb={key:3,class:`files`},Tb={class:`file all`},Eb=[`checked`],Db={class:`muted-line`},Ob=[`onClick`],kb={class:`muted-line`},Ab={class:`file-label`},jb=[`checked`,`onChange`],Mb=[`title`],Nb=[`title`],Pb={class:`file-acts`},Fb=[`onClick`],Ib=[`onClick`],Lb=[`onClick`],Rb=[`onClick`],zb=[`onClick`],Bb={key:4,class:`file-diff`},Vb={class:`mode-chips`},Hb={key:0,class:`nums bin`},Ub={key:1,class:`nums`},Wb={key:2},Gb={class:`row`},Kb=[`disabled`],qb=[`disabled`],Jb=[`disabled`],Yb={class:`task-section`,"aria-label":`Log`},Xb={class:`panel-heading`},Zb=[`disabled`],Qb=[`disabled`],$b=[`disabled`],ex={key:0,class:`cps`},tx={key:0,class:`hint`},nx={class:`muted-line`},rx={class:`cp-subj`},ix=[`disabled`,`onClick`],ax={key:1,class:`hint`},ox={key:2,class:`commits`},sx=[`title`],cx=[`width`],lx=[`x1`,`x2`],ux=[`x1`,`x2`,`stroke`],dx=[`cx`,`fill`],fx=[`onClick`],px={class:`hash`},mx=[`href`],hx={key:1,class:`refs`},gx={class:`subject`},_x={class:`muted-line who`},vx={key:0,class:`commit-files`},yx=[`data-s`],bx={class:`path`},xx={key:0,class:`hint`},Sx={key:3,class:`message-error`},Cx={key:4,class:`hint`},wx={class:`task-section`,"aria-label":`Worktrees`},Tx={class:`panel-heading`},Ex={class:`branch-wrap`},Dx=[`disabled`],Ox={key:0,class:`menu`},kx=[`onClick`],Ax={class:`new-branch`},jx=[`disabled`],Mx=[`title`],Nx={class:`muted-line`},Px=[`disabled`,`onClick`],Fx=[`disabled`,`onClick`],Ix=[`disabled`,`onClick`],Lx={key:3,class:`op-out`},Rx=Zg(Or({__name:`GitPanel`,props:{deviceId:{},cwd:{}},setup(e){let t=e,n=V(()=>t.cwd??xu.value?.cwd??``),r=V(()=>t.deviceId??hu.value),i=V(()=>Dd(r.value||`?`,n.value||`?`)),a=V(()=>i.value.status),o=V(()=>i.value.loading),s=V(()=>i.value.refreshing),c=V(()=>i.value.error),l=V(()=>{let e=xu.value;return e&&e.cwd===n.value&&!t.deviceId?e.id:void 0}),u=k(``),d=k(``),f=k(``),p=k(new Set),m=k(!1),h=k(!1),g=k(``),_=k(null),v=k(`working`),y=V(()=>`dpi-git-draft:${r.value}:${n.value}`),b=k(null),ee=k(!0),x=k(``),S=k(!1),te=k([]),ne=V(()=>{if(!te.value.length||!n.value)return null;let e=e=>e.startsWith(`/`)||e.includes(`:\\`)?e:`${n.value}/${e}`,t=new Set(te.value);return{changed:(a.value?.files??[]).filter(n=>t.has(e(n.path))).length,total:te.value.length}}),re=k([]),ie=k(!1),ae=k(new Map),oe=k(new Set),se=()=>{typeof localStorage<`u`&&(f.value=localStorage.getItem(y.value)??``)};kd(r.value||`?`,n.value||`?`),se(),Jr(()=>kd(r.value||`?`,n.value||`?`)),j(f,e=>{typeof localStorage<`u`&&(e?localStorage.setItem(y.value,e):localStorage.removeItem(y.value))}),j([r,n],()=>{m.value=!1,h.value=!1,_.value=null,b.value=null,x.value=``,S.value=!1,te.value=[],ae.value=new Map,oe.value=new Set,kd(r.value||`?`,n.value||`?`),se()});let ce=()=>(p.value=new Set,_.value=null,kd(r.value||`?`,n.value||`?`,{force:!0})),le=V(()=>a.value?.files??[]);j(le,e=>{let t=new Set;for(let n of e)n.x!==`?`&&n.y!==`?`&&t.add(n.path);p.value=t},{immediate:!0});let ue=V(()=>le.value.some(e=>p.value.has(e.path))),de=V(()=>le.value.filter(e=>e.x!==` `&&e.x!==`?`)),C=V(()=>le.value.filter(e=>e.x===` `||e.x===`?`)),fe=V(()=>le.value.filter(e=>/U|A|D/.test(e.x)&&/U|A|D/.test(e.y))),pe=V(()=>le.value.length>=500),me=V(()=>(a.value?.staged??0)+(a.value?.unstaged??0)+(a.value?.untracked??0)>0),he=V(()=>!a.value?.identity?.name||!a.value?.identity?.email),ge=V(()=>{let e=a.value?.remoteUrl??``,t=e.match(/git@([^:]+):(.+?)(?:\.git)?$/)??e.match(/^https?:\/\/([^/]+)\/(.+?)(?:\.git)?$/);return t?`https://${t[1]}/${t[2]}`:``}),_e=e=>{let t=new Set(p.value);t.has(e)?t.delete(e):t.add(e),p.value=t},ve=e=>{let t=e.every(e=>p.value.has(e.path)),n=new Set(p.value);for(let r of e)t?n.delete(r.path):n.add(r.path);p.value=n},ye=e=>{let t=e.lastIndexOf(`/`);return t===-1?`.`:e.slice(0,t)},be=e=>{let t=new Map;for(let n of e){let e=ye(n.path);t.has(e)||t.set(e,[]),t.get(e).push(n)}return[...t.entries()].map(([e,t])=>({dir:e,files:t,open:!oe.value.has(e)}))},xe=e=>{let t=new Set(oe.value);t.has(e)?t.delete(e):t.add(e),oe.value=t},Se=e=>e.a===void 0&&e.d===void 0?``:e.a===-1||e.d===-1?`bin`:`+${e.a??0} −${e.d??0}`,Ce=e=>{navigator.clipboard?.writeText(e).then(()=>G(`copied ${e}`))};async function we(e,t={}){if(r.value&&n.value){u.value=e,d.value=``;try{let i=await Jl(r.value).gitOp(n.value,e,t);d.value=i.text||`(empty)`,e===`push`&&(x.value=``),e===`pull`&&(S.value=!1),[`fetch`,`pull`,`push`,`stash-push`,`stash-pop`].includes(e)&&G(`git ${e} ✓`),await ce(),Je(!0)}catch(t){let n=t.message;e===`push`&&(/no upstream|has no upstream|upstream is gone/i.test(n)?x.value=`no upstream — set it while pushing?`:/fetch first|non-fast-forward|rejected.*fetch|behind/i.test(n)?x.value=`the remote has work you lack — pull first`:/authentication|permission|could not read|403|denied/i.test(n)?x.value=`credentials rejected on the device — check its git login`:x.value=``),e===`pull`&&/not possible to fast-forward|divergent|unrelated histories/i.test(n)&&(S.value=!0),G(`git ${e}: ${n.slice(0,160)}`)}finally{u.value=``}}}async function T(e,t){if(!r.value||!n.value||!t&&e!==`stage`||e===`discard`&&t&&!confirm(`Roll back ${t} to HEAD? Uncommitted changes are lost.`))return;u.value=e;let i=t?[t]:le.value.filter(e=>e.x===` `||e.x===`M`).map(e=>e.path);try{G((await Jl(r.value).gitOp(n.value,e,{files:i})).text),await ce()}catch(t){G(`${e} failed: ${t.message.slice(0,140)}`)}finally{u.value=``}}async function Te(e){if(r.value&&n.value&&e.length){u.value=`unstage`;try{G((await Jl(r.value).gitOp(n.value,`unstage`,{files:e})).text),await ce()}catch(e){G(`unstage failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}async function Ee(e){if(r.value&&n.value&&e.length){u.value=`ignore`;try{G((await Jl(r.value).gitOp(n.value,`ignore`,{lines:e})).text),await ce()}catch(e){G(`ignore failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}async function De(e){if(r.value&&n.value){if(_.value?.path===e)return _.value=null;u.value=`diff`;try{let t=await Jl(r.value).gitOp(n.value,`diff-file`,{target:e,staged:v.value===`staged`});_.value={path:e,text:t.text}}catch(e){G(`diff failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}let Oe=async()=>{let e=_.value?.path;_.value=null,e&&await De(e)},ke=V(()=>/Binary files .* differ/i.test(_.value?.text??``));async function Ae(){if(r.value&&n.value){u.value=`abort`;try{G((await Jl(r.value).gitOp(n.value,`merge-abort`)).text),await ce()}catch(e){G(`abort failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}}async function je(e){if(m.value=!1,r.value&&n.value){u.value=`compare`;try{let t=await Jl(r.value).gitOp(n.value,`compare`,{ref:e});b.value={ref:e,ahead:t.ahead??0,behind:t.behind??0}}catch(e){G(`compare failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}}async function Me(e,t=!1){if(m.value=!1,!r.value||!n.value||e===a.value?.branch&&!t)return;u.value=`switch`;let i=Jl(r.value),o=!1;try{if(ee.value&&!t&&me.value&&(await i.gitOp(n.value,`stash-push`,{message:`dpi auto-stash before ${e}`}),o=!0),G((await i.gitOp(n.value,`switch`,{ref:e,create:t})).text||`switched to ${e}`),o)try{let e=await i.gitOp(n.value,`stash-pop`);/conflict/i.test(e.text)&&G(`stash popped WITH CONFLICTS — resolve in the file list`)}catch{G(`switched, but the stash did not pop — resolve manually (git stash list)`)}await ce(),Je(!0)}catch(e){if(G(`switch failed: ${e.message.slice(0,140)}`),o)try{await i.gitOp(n.value,`stash-pop`)}catch{}}finally{u.value=``}}async function Ne(e=!1){if(!r.value||!n.value||!f.value.trim())return;u.value=`commit`;let t=le.value.filter(e=>p.value.has(e.path)).map(e=>e.path);if(!t.length)return G(`check the files to commit — nothing is selected`);let i=Jl(r.value);try{if(G((await i.gitOp(n.value,`commit`,{message:f.value.trim(),files:t})).text),f.value=``,e)try{G(`pushed: ${(await i.gitOp(n.value,`push`)).text.slice(0,80)}`)}catch(e){G(`committed, but push failed: ${e.message.slice(0,120)}`)}await ce(),Je(!0)}catch(e){G(`commit failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}function Pe(e){let t=e?.models??[],n=t.find(t=>`${t.provider}/${t.id}`===e?.defaultModel),r=new Map;for(let e of t)r.has(e.provider)||r.set(e.provider,e);let i=[...r.values()].filter(e=>e!==n).slice(0,3);return(n?[n,...i]:i).slice(0,4)}async function Fe(){if(!r.value||!n.value)return;let e=le.value.filter(e=>p.value.has(e.path)).map(e=>e.path);if(!e.length)return G(`check files first — the model summarises THOSE`);u.value=`ai`;let t=Jl(r.value),i=``;for(let r of e.slice(0,5)){let e=await t.gitOp(n.value,`diff-file`,{target:r});if(i+=`${e.text}\n`,i.length>4e3)break}i=i.slice(0,4e3);let a=`Write ONE concise git commit message (under 72 chars, imperative, no quotes, no backticks) for these changes:\n\n${i}`,o=lu.devices.value.find(e=>e.id===r.value)?.info,s=Pe(o);if(!s.length)return u.value=``,G(`no model on the device`);let c=[];try{for(let e of s){let r=await t.createSession({name:`git-msg`,cwd:n.value,model:{provider:e.provider,modelId:e.id}}).then(e=>e.id).catch(()=>``);if(!r){c.push(`${e.provider}: no session`);continue}try{let n=await t.agent(r,1).send(a,`followUp`,void 0,12e4),i=n.status===`done`?n.answer.text.trim().split(`
76
- `)[0]?.slice(0,100):``;if(i){f.value=i;return}c.push(`${e.provider}/${e.id}: ${n.status===`unanswered`?n.reason:`empty answer`}`)}finally{t.session(r).archive().catch(()=>{})}}G(`ai message failed on every model — ${c.join(`; `).slice(0,140)}`)}catch(e){G(`ai message failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}async function Ie(){if(r.value&&l.value){u.value=`session-files`;try{let e=await Jl(r.value).sessionGitFiles(l.value);te.value=e.files;let t=e=>e.startsWith(`/`)||e.includes(`:\\`)?e:`${n.value}/${e}`,i=new Set(e.files.map(t)),a=le.value.filter(e=>i.has(t(e.path)));p.value=new Set(a.map(e=>e.path)),G(a.length?`${a.length} session file(s) still changed — checked`:`the session touched nothing that is still changed`)}catch(e){G(`session files failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}}async function D(e){if(ae.value.has(e)){ae.value.delete(e),ae.value=new Map(ae.value);return}if(r.value&&n.value)try{let t=await Jl(r.value).gitOp(n.value,`show-files`,{target:e});ae.value=new Map(ae.value).set(e,t.changed??[])}catch(e){G(`commit files failed: ${e.message.slice(0,120)}`)}}async function Le(){if(!r.value||!n.value)return;let e=`cp-${new Date().toISOString().slice(0,16).replace(/[-:T]/g,``)}`;u.value=`checkpoint`;try{G((await Jl(r.value).gitOp(n.value,`checkpoint`,{name:e})).text),ie.value=!0,await Re()}catch(e){G(`checkpoint failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}async function Re(){if(r.value&&n.value)try{let e=await Jl(r.value).gitOp(n.value,`checkpoints`);re.value=e.checkpoints??[]}catch{re.value=[]}}async function ze(e){if(r.value&&n.value&&confirm(`Rewind this worktree to checkpoint "${e}"? reset --hard — ALL uncommitted changes here are LOST.`)){u.value=`rewind`;try{G((await Jl(r.value).gitOp(n.value,`rewind`,{name:e})).text),await ce(),Je(!0)}catch(e){G(`rewind failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}}j(ie,e=>{e&&Re()});async function Be(e){if(h.value=!1,!r.value||!n.value||!a.value?.root)return;let t=a.value.root,i=`${t.slice(0,t.lastIndexOf(`/`))}/${t.slice(t.lastIndexOf(`/`)+1)}-${e.replace(/[/\\]+/g,`-`)}`;u.value=`wt`;try{G((await Jl(r.value).gitOp(n.value,`worktree-add`,{branch:e,target:i})).text.split(`
77
- `)[0]??`worktree ${i}`),g.value=``,await ce()}catch(e){G(`worktree failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}async function Ve(e,t){if(r.value){u.value=`session`;try{let n=lu.devices.value.find(e=>e.id===r.value)?.info,i=Pe(n)[0];if(!i)return G(`no model available on ${r.value} — cannot create a session`);let a=await Jl(r.value).createSession({name:t??e.slice(e.lastIndexOf(`/`)+1),cwd:e,model:{provider:i.provider,modelId:i.id}});Tu({deviceId:r.value,sessionId:a.id,agentId:1}),G(`session "${a.name}" on ${e}`)}catch(e){G(`session failed: ${e.message.slice(0,160)}`)}finally{u.value=``}}}async function He(e){if(r.value){u.value=`go`;try{let t=(await Jl(r.value).sessions()).find(t=>t.cwd===e);t?(Tu({deviceId:r.value,sessionId:t.id,agentId:1}),G(`switched to session "${t.name}"`)):await Ve(e,null)}catch(e){G(`switch failed: ${e.message.slice(0,120)}`)}finally{u.value=``}}}async function Ue(e){if(!r.value||!n.value)return;u.value=`wt`;let t=`Uncommitted changes in it will be LOST.`;try{let n=(await Jl(r.value).gitStatusBatch([e],{timeoutMs:6e4}))[e];t=(n?.staged??0)+(n?.unstaged??0)+(n?.untracked??0)>0?`It CONTAINS uncommitted changes — they will be LOST.`:`Its checkout is clean.`}catch{}if(confirm(`Remove worktree ${e}? ${t}`))try{await Jl(r.value).gitOp(n.value,`worktree-remove`,{target:e}),await ce()}catch(e){G(`remove failed: ${e.message.slice(0,140)}`)}finally{u.value=``}}let We=k([]),Ge=k(!1),Ke=k(``),qe=0;async function Je(e=!1){if(r.value&&n.value&&!(!e&&We.value.length&&Date.now()-qe<12e4)){Ge.value=!0;try{let e=await Jl(r.value).gitOp(n.value,`log-list`);We.value=e.commits??[],Ke.value=``,qe=Date.now()}catch(e){Ke.value=e.message.slice(0,120)}finally{Ge.value=!1}}}Je(),j([r,n],()=>{We.value=[],qe=0,Je()});let Ye=V(()=>(a.value?.worktrees??[]).filter(e=>e.path)),Xe=[`#4f8cc9`,`#b8860b`,`#7aa25c`,`#a061ba`,`#c96f6f`,`#5fa8a0`],Ze=V(()=>{let e=new Map,t=[],n=[];for(let r of We.value){let i=e.get(r.hash);i===void 0&&(i=n.indexOf(null),i===-1&&(n.push(null),i=n.length-1),e.set(r.hash,i)),n[i]=null;let a=[];r.parents.forEach((t,r)=>{let o=e.get(t);(o===void 0||n[o]===t)&&(o=n.indexOf(null),o===-1&&(n.push(null),o=n.length-1),e.set(t,o)),n[o]=t,r===0&&(n[i]=t),a.push(o)}),t.push({lane:i,parents:a,width:Math.max(1,n.length)})}return t}),Qe=e=>e*12+7;return(e,t)=>(P(),F(`div`,Cy,[n.value?(P(),F(N,{key:1},[o.value?(P(),F(`p`,Ty,`loading git…`)):s.value?(P(),F(`p`,Ey,`refreshing…`)):B(``,!0),c.value?(P(),F(`p`,Dy,[z(E(c.value)+` `,1),L(`button`,{onClick:t[0]||=e=>ce()},`retry`)])):B(``,!0),a.value?(P(),F(`div`,{key:3,class:w({stale:!!c.value||!!s.value})},[a.value.repo?(P(),F(N,{key:1},[a.value.merge?(P(),F(`p`,ky,[z(` merge in progress — `+E(a.value.conflicts??fe.value.length)+` unmerged path(s). Resolve them in the lists above, or `,1),L(`button`,{class:`small`,disabled:!!u.value,onClick:t[1]||=e=>Ae()},`abort merge`,8,Ay)])):B(``,!0),L(`div`,jy,[L(`div`,My,[L(`button`,{class:`branch-btn`,disabled:!!u.value,onClick:t[2]||=e=>m.value=!m.value},[R(A(gc),{size:16}),L(`strong`,null,E(a.value.branch??`detached`),1),R(A(tc),{size:14})],8,Ny),m.value?(P(),F(`div`,Py,[(P(!0),F(N,null,M(a.value.branches??[],e=>(P(),F(`button`,{key:e.name,class:w({cur:e.current}),onClick:t=>Me(e.name)},[R(A(gc),{size:13}),L(`span`,null,E(e.name),1),L(`span`,Iy,E(e.current?`current`:e.upstream?`→ ${e.upstream}`:``),1),t[37]||=L(`span`,{class:`grow`},null,-1),e.current?B(``,!0):(P(),I(A(_c),{key:0,size:13,title:`compare with this base`,onClick:js(t=>je(e.name),[`stop`])},null,8,[`onClick`]))],10,Fy))),128)),L(`div`,Ly,[Un(L(`input`,{"onUpdate:modelValue":t[3]||=e=>g.value=e,placeholder:`new branch…`,onKeyup:t[4]||=Ns(e=>g.value.trim()&&Me(g.value.trim(),!0),[`enter`])},null,544),[[xs,g.value]]),L(`button`,{disabled:!g.value.trim(),onClick:t[5]||=e=>Me(g.value.trim(),!0)},[R(A(Hc),{size:13})],8,Ry)]),L(`label`,zy,[Un(L(`input`,{type:`checkbox`,"onUpdate:modelValue":t[6]||=e=>ee.value=e},null,512),[[Ss,ee.value]]),t[38]||=z(` auto-stash on switch`,-1)])])):B(``,!0)]),L(`span`,By,E(a.value.upstream??`no upstream`),1),a.value.ahead?(P(),F(`span`,Vy,`↑`+E(a.value.ahead),1)):B(``,!0),a.value.behind?(P(),F(`span`,Hy,`↓`+E(a.value.behind),1)):B(``,!0),b.value?(P(),F(`span`,Uy,[z(` vs `+E(b.value.ref)+`: ↑`+E(b.value.ahead)+` ↓`+E(b.value.behind)+` `,1),L(`button`,{class:`tag-x`,onClick:t[7]||=e=>b.value=null},[R(A(ol),{size:11})])])):B(``,!0),L(`span`,Wy,`+`+E(a.value.staged??0)+` ~`+E(a.value.unstaged??0)+` ?`+E(a.value.untracked??0),1),ge.value?(P(),F(`a`,{key:3,class:`icon-button`,href:`${ge.value}/tree/${a.value.branch??``}`,target:`_blank`,rel:`noopener`,title:`open on the remote`},[R(A(qs),{size:15,style:{transform:`rotate(45deg)`}})],8,Gy)):B(``,!0),L(`button`,{class:`icon-button`,disabled:!!u.value||o.value||s.value,title:`refresh`,onClick:t[8]||=e=>ce()},[R(A(Wc),{size:16})],8,Ky)]),L(`div`,qy,[L(`button`,{class:`small`,disabled:!!u.value,onClick:t[9]||=e=>we(`fetch`)},[R(A(Gs),{size:14}),t[39]||=z(`fetch`,-1)],8,Jy),L(`button`,{class:`small`,disabled:!!u.value,onClick:t[10]||=e=>we(`pull`)},[R(A(Gs),{size:14}),t[40]||=z(`pull`,-1)],8,Yy),L(`button`,{class:`small primary`,disabled:!!u.value,title:`push`,onClick:t[11]||=e=>we(`push`)},[R(A(qs),{size:14}),t[41]||=z(`push`,-1)],8,Xy),L(`button`,{class:`small`,disabled:!!u.value,title:`stash changes`,onClick:t[12]||=e=>we(`stash-push`,{message:f.value.trim()||void 0})},[R(A(Zc),{size:14}),t[42]||=z(`stash`,-1)],8,Zy),L(`button`,{class:`small`,disabled:!!u.value,title:`pop the newest stash`,onClick:t[13]||=e=>we(`stash-pop`)},[R(A(Fc),{size:14}),t[43]||=z(`unstash`,-1)],8,Qy)]),x.value?(P(),F(`p`,$y,[z(E(x.value)+` `,1),x.value.includes(`upstream`)?(P(),F(`button`,{key:0,class:`small primary`,disabled:!!u.value,onClick:t[14]||=e=>we(`push`,{setUpstream:!0,ref:a.value.branch})},`push -u origin `+E(a.value.branch),9,eb)):x.value.includes(`remote has work`)?(P(),F(`button`,{key:1,class:`small primary`,disabled:!!u.value,onClick:t[15]||=e=>we(`pull`)},`pull now`,8,tb)):B(``,!0)])):B(``,!0),S.value?(P(),F(`p`,nb,[t[44]||=z(` fast-forward is not possible — branches diverged. `,-1),L(`button`,{class:`small primary`,disabled:!!u.value,onClick:t[16]||=e=>we(`pull`,{rebase:!0})},`pull --rebase`,8,rb)])):B(``,!0),L(`section`,ib,[L(`div`,ab,[t[45]||=L(`h4`,null,`Commit`,-1),L(`span`,ob,E(le.value.length?`${p.value.size}/${le.value.length} files`:`no changes`),1),t[46]||=L(`span`,{class:`grow`},null,-1),l.value?(P(),F(`button`,{key:0,class:`small`,disabled:!!u.value,title:`check the files this session's agent touched`,onClick:Ie},[R(A(pc),{size:13}),z(` session files`+E(ne.value?` (${ne.value.changed}/${ne.value.total})`:``),1)],8,sb)):B(``,!0)]),he.value?(P(),F(`p`,cb,[...t[47]||=[z(`git user.name/user.email is not set on the device — `,-1),L(`code`,null,`dpi device config`,-1),z(` or `,-1),L(`code`,null,`git config --global`,-1),z(` before committing.`,-1)]])):B(``,!0),pe.value?(P(),F(`p`,lb,`showing the first 500 changed files — commit in smaller batches`)):B(``,!0),de.value.length?(P(),F(`div`,ub,[L(`label`,db,[L(`input`,{type:`checkbox`,checked:de.value.every(e=>p.value.has(e.path)),onChange:t[17]||=e=>ve(de.value)},null,40,fb),L(`span`,pb,`Staged · `+E(de.value.length),1),t[50]||=L(`span`,{class:`grow`},null,-1),L(`button`,{class:`icon-button`,title:`stage every changed file`,onClick:t[18]||=e=>T(`stage`)},[R(A(Hc),{size:13}),t[48]||=z(` all`,-1)]),L(`button`,{class:`icon-button`,title:`unstage all (git reset HEAD)`,onClick:t[19]||=e=>Te(de.value.map(e=>e.path))},[R(A(jc),{size:13}),t[49]||=z(` none`,-1)])]),(P(!0),F(N,null,M(be(de.value),e=>(P(),F(N,{key:e.dir},[e.dir===`.`?B(``,!0):(P(),F(`button`,{key:0,class:`dir-row`,onClick:t=>xe(e.dir)},[R(A(nc),{size:12,class:w({open:e.open})},null,8,[`class`]),z(E(e.dir),1),L(`span`,hb,`· `+E(e.files.length),1)],8,mb)),(P(!0),F(N,null,M(e.files,t=>Un((P(),F(`div`,{key:t.path,class:`file`},[L(`label`,gb,[L(`input`,{type:`checkbox`,checked:p.value.has(t.path),onChange:e=>_e(t.path)},null,40,_b),L(`code`,{class:`xy`,title:`index ${t.x} · worktree ${t.y}`},E(t.x)+E(t.y),9,vb),L(`span`,{class:`path`,title:t.path},E(t.path),9,yb),Se(t)?(P(),F(`span`,{key:0,class:w([`nums`,{bin:Se(t)===`bin`}])},E(Se(t)),3)):B(``,!0)]),L(`span`,bb,[L(`button`,{class:`icon-button`,title:`view diff`,onClick:e=>De(t.path)},[R(A(fc),{size:13})],8,xb),L(`button`,{class:`icon-button`,title:`unstage (git reset HEAD)`,onClick:e=>Te([t.path])},[R(A(jc),{size:13})],8,Sb),L(`button`,{class:`icon-button`,title:`roll back to HEAD`,onClick:e=>T(`discard`,t.path)},[R(A(lc),{size:13})],8,Cb)])])),[[Bo,e.open]])),128))],64))),128))])):B(``,!0),C.value.length?(P(),F(`div`,wb,[L(`label`,Tb,[L(`input`,{type:`checkbox`,checked:C.value.every(e=>p.value.has(e.path)),onChange:t[20]||=e=>ve(C.value)},null,40,Eb),L(`span`,Db,`Unstaged · `+E(C.value.length),1)]),(P(!0),F(N,null,M(be(C.value),e=>(P(),F(N,{key:e.dir},[e.dir===`.`?B(``,!0):(P(),F(`button`,{key:0,class:`dir-row`,onClick:t=>xe(e.dir)},[R(A(nc),{size:12,class:w({open:e.open})},null,8,[`class`]),z(E(e.dir),1),L(`span`,kb,`· `+E(e.files.length),1)],8,Ob)),(P(!0),F(N,null,M(e.files,t=>Un((P(),F(`div`,{key:t.path,class:`file`},[L(`label`,Ab,[L(`input`,{type:`checkbox`,checked:p.value.has(t.path),onChange:e=>_e(t.path)},null,40,jb),L(`code`,{class:`xy`,title:`index ${t.x} · worktree ${t.y}`},E(t.x)+E(t.y),9,Mb),L(`span`,{class:`path`,title:t.path},E(t.path),9,Nb),Se(t)?(P(),F(`span`,{key:0,class:w([`nums`,{bin:Se(t)===`bin`}])},E(Se(t)),3)):B(``,!0)]),L(`span`,Pb,[L(`button`,{class:`icon-button`,title:`view diff`,onClick:e=>De(t.path)},[R(A(fc),{size:13})],8,Fb),t.x===`?`?(P(),F(`button`,{key:0,class:`icon-button`,title:`add to .gitignore`,onClick:e=>Ee([t.path])},[R(A(Xs),{size:13})],8,Ib)):(P(),F(`button`,{key:1,class:`icon-button`,title:`stage (git add)`,onClick:e=>T(`stage`,t.path)},[R(A(Hc),{size:13})],8,Lb)),t.x===`?`?B(``,!0):(P(),F(`button`,{key:2,class:`icon-button`,title:`roll back to HEAD`,onClick:e=>T(`discard`,t.path)},[R(A(lc),{size:13})],8,Rb)),L(`button`,{class:`icon-button`,title:`copy path`,onClick:e=>Ce(t.path)},[R(A(oc),{size:13})],8,zb)])])),[[Bo,e.open]])),128))],64))),128))])):B(``,!0),_.value?(P(),F(`p`,Bb,[L(`strong`,null,E(_.value.path),1),L(`span`,Vb,[L(`button`,{class:w({on:v.value===`working`}),onClick:t[21]||=e=>{v.value=`working`,Oe()}},`working`,2),L(`button`,{class:w({on:v.value===`staged`}),onClick:t[22]||=e=>{v.value=`staged`,Oe()}},`staged`,2)]),ke.value?(P(),F(`span`,Hb,`binary file`)):_.value.text.length>8e3?(P(),F(`span`,Ub,`truncated at 8000 chars`)):B(``,!0),L(`button`,{class:`icon-button`,title:`close diff`,onClick:t[23]||=e=>_.value=null},[R(A(ol),{size:13})]),ke.value?B(``,!0):(P(),F(`pre`,Wb,E(_.value.text.slice(0,8e3)),1))])):B(``,!0),Un(L(`textarea`,{"onUpdate:modelValue":t[24]||=e=>f.value=e,rows:`4`,placeholder:`Commit message… (Ctrl+Enter to commit)`,onKeydown:[t[25]||=Ns(js(e=>Ne(),[`exact`,`prevent`]),[`enter`]),t[26]||=Ns(js(e=>Ne(),[`meta`,`prevent`]),[`enter`]),t[27]||=Ns(js(e=>Ne(),[`ctrl`,`prevent`]),[`enter`])]},null,544),[[xs,f.value]]),L(`div`,Gb,[L(`button`,{class:`small`,disabled:!!u.value||!p.value.size,title:`ask the device's model for a message`,onClick:Fe},[R(A(Xc),{size:14}),t[51]||=z(` ai message`,-1)],8,Kb),t[53]||=L(`span`,{class:`grow`},null,-1),L(`button`,{class:`primary small`,disabled:!!u.value||!f.value.trim()||!ue.value,onClick:t[28]||=e=>Ne(!1)},[R(A(ec),{size:14}),z(` Commit`+E(p.value.size?` ${p.value.size} file${p.value.size>1?`s`:``}`:``),1)],8,qb),a.value.upstream?(P(),F(`button`,{key:0,class:`primary small`,disabled:!!u.value||!f.value.trim()||!ue.value,title:`commit, then push`,onClick:t[29]||=e=>Ne(!0)},[R(A(ec),{size:14}),t[52]||=z(` Commit & push `,-1)],8,Jb)):B(``,!0)])]),L(`section`,Yb,[L(`div`,Xb,[L(`h4`,null,[R(A(bc),{size:16}),t[54]||=z(` Log`,-1)]),t[56]||=L(`span`,{class:`grow`},null,-1),L(`button`,{class:`small`,disabled:!!u.value,title:`save a checkpoint ref of HEAD`,onClick:Le},[R(A(pc),{size:13}),t[55]||=z(` checkpoint`,-1)],8,Zb),L(`button`,{class:`small`,disabled:!!u.value,onClick:t[30]||=e=>ie.value=!ie.value},`checkpoints `+E(re.value.length?`(${re.value.length})`:``),9,Qb),L(`button`,{class:`icon-button`,disabled:Ge.value,title:`refresh log`,onClick:t[31]||=e=>Je(!0)},[R(A(Wc),{size:14})],8,$b)]),ie.value?(P(),F(`div`,ex,[re.value.length?B(``,!0):(P(),F(`p`,tx,`no checkpoints yet — one click saves a named ref of HEAD.`)),(P(!0),F(N,null,M(re.value,e=>(P(),F(`div`,{key:e.name,class:`cp-row`},[L(`code`,null,E(e.name),1),L(`span`,nx,E(e.hash)+` · `+E(e.date),1),L(`span`,rx,E(e.subject),1),t[58]||=L(`span`,{class:`grow`},null,-1),L(`button`,{class:`small`,disabled:!!u.value,title:`reset --hard to this checkpoint (this worktree)`,onClick:t=>ze(e.name)},[R(A(el),{size:13}),t[57]||=z(` rewind`,-1)],8,ix)]))),128))])):B(``,!0),Ge.value&&!We.value.length?(P(),F(`p`,ax,`loading log…`)):We.value.length?(P(),F(`div`,ox,[(P(!0),F(N,null,M(We.value,(e,t)=>(P(),F(N,{key:e.hash},[L(`div`,{class:`commit-row`,title:e.refs},[Ze.value[t]?(P(),F(`svg`,{key:0,class:`lane`,width:Ze.value[t].width*12+4,height:`24`,"aria-hidden":`true`},[(P(!0),F(N,null,M(Ze.value[t].width,e=>(P(),F(`line`,{key:e,x1:Qe(e-1),x2:Qe(e-1),y1:`0`,y2:`24`,stroke:`#3a3134`,"stroke-width":`2`},null,8,lx))),128)),(P(!0),F(N,null,M(Ze.value[t].parents,(e,n)=>(P(),F(`line`,{key:`p`+n,x1:Qe(Ze.value[t].lane),x2:Qe(e),y1:`12`,y2:`24`,stroke:Xe[e%Xe.length],"stroke-width":`2`},null,8,ux))),128)),L(`circle`,{cx:Qe(Ze.value[t].lane),cy:`12`,r:`4`,fill:Xe[Ze.value[t].lane%Xe.length]},null,8,dx)],8,cx)):B(``,!0),L(`button`,{class:`icon-button hash-btn`,title:`files in this commit`,onClick:t=>D(e.hash)},[R(A(nc),{size:12,class:w({open:ae.value.has(e.hash)})},null,8,[`class`])],8,fx),L(`code`,px,[ge.value?(P(),F(`a`,{key:0,href:`${ge.value}/commit/${e.hash}`,target:`_blank`,rel:`noopener`,title:`on the remote`},E(e.hash),9,mx)):(P(),F(N,{key:1},[z(E(e.hash),1)],64))]),e.refs?(P(),F(`span`,hx,E(e.refs.split(`,`)[0]),1)):B(``,!0),L(`span`,gx,E(e.subject),1),L(`span`,_x,E(e.author)+` · `+E(e.date),1)],8,sx),ae.value.has(e.hash)?(P(),F(`div`,vx,[(P(!0),F(N,null,M(ae.value.get(e.hash),e=>(P(),F(`div`,{key:e.path,class:`cf`},[L(`code`,{class:`cf-status`,"data-s":e.status},E(e.status),9,yx),L(`span`,bx,E(e.path),1)]))),128)),ae.value.get(e.hash)?.length?B(``,!0):(P(),F(`p`,xx,`no files (merge/empty commit)`))])):B(``,!0)],64))),128))])):Ke.value?(P(),F(`p`,Sx,`log failed: `+E(Ke.value),1)):(P(),F(`p`,Cx,`no commits`))]),L(`section`,wx,[L(`div`,Tx,[L(`h4`,null,[R(A(Fc),{size:16}),t[59]||=z(` Worktrees`,-1)]),L(`div`,Ex,[L(`button`,{class:`small`,disabled:!!u.value,onClick:t[32]||=e=>h.value=!h.value},[R(A(Hc),{size:13}),t[60]||=z(` worktree`,-1)],8,Dx),h.value?(P(),F(`div`,Ox,[(P(!0),F(N,null,M((a.value.branches??[]).filter(e=>!e.current),e=>(P(),F(`button`,{key:e.name,onClick:t=>Be(e.name)},[R(A(gc),{size:13}),L(`span`,null,E(e.name),1),t[61]||=L(`span`,{class:`muted-line`},`existing`,-1)],8,kx))),128)),L(`div`,Ax,[Un(L(`input`,{"onUpdate:modelValue":t[33]||=e=>g.value=e,placeholder:`or a NEW branch…`,onKeyup:t[34]||=Ns(e=>g.value.trim()&&Be(g.value.trim()),[`enter`])},null,544),[[xs,g.value]]),L(`button`,{disabled:!g.value.trim(),onClick:t[35]||=e=>Be(g.value.trim())},`create`,8,jx)])])):B(``,!0)])]),(P(!0),F(N,null,M(Ye.value,e=>(P(),F(`div`,{key:e.path,class:w([`wt`,{main:e.path===a.value.root}])},[L(`code`,{title:e.path},E(e.path),9,Mx),L(`span`,Nx,E(e.branch??e.head),1),t[62]||=L(`span`,{class:`grow`},null,-1),L(`button`,{class:`icon-button`,disabled:!!u.value,title:`jump to this worktree (session or new)`,onClick:t=>He(e.path)},[R(A(Ks),{size:13})],8,Px),L(`button`,{class:`small`,disabled:!!u.value,title:`create a session on this worktree`,onClick:t=>Ve(e.path,e.branch)},`session`,8,Fx),e.path===a.value.root?B(``,!0):(P(),F(`button`,{key:0,class:`icon-button`,disabled:!!u.value,onClick:t=>Ue(e.path)},[R(A(ol),{size:13})],8,Ix)),e.path===a.value.root?(P(),I(A(ec),{key:1,size:13,class:`muted-line`})):B(``,!0)],2))),128))]),d.value?(P(),F(`pre`,Lx,E(d.value.slice(0,6e3)),1)):B(``,!0)],64)):(P(),F(`p`,Oy,[...t[36]||=[z(`Not a git repository — run `,-1),L(`code`,null,`git init`,-1),z(` (or open a session inside a repo).`,-1)]]))],2)):B(``,!0)],64)):(P(),F(`p`,wy,`No session selected — open a session to see its git.`))]))}}),[[`__scopeId`,`data-v-8d79d513`]]),zx={class:`extensions-panel`},Bx={class:`panel-heading`},Vx={key:0,class:`task-empty`},Hx=[`data-extension`],Ux={class:`ext-head`},Wx=[`aria-checked`,`aria-label`,`disabled`,`onClick`],Gx=[`checked`,`disabled`,`onChange`],Kx=Or({__name:`ExtensionsPanel`,setup(e){let t=rn(),n=k(!1);async function r(){let e=Cu.value;if(!e||!_u.value)return void(t.value=void 0);t.value=await e.extensions().catch(()=>void 0)??t.value}j([Cu,_u,()=>JSON.stringify(Nu.value.agent.extensions??null)],r,{immediate:!0});async function i(e){let r=Cu.value;if(r&&!n.value){n.value=!0;try{let n=await Wu(()=>r.setExtension(e));n&&(t.value=n),Hu()}finally{n.value=!1}}}return(e,r)=>(P(),F(`div`,zx,[L(`div`,Bx,[r[0]||=L(`h2`,null,`Extensions`,-1),R(A(Uc),{size:18})]),r[3]||=L(`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?B(``,!0):(P(),F(`p`,Vx,`Loading extensions…`)),(P(!0),F(N,null,M(t.value?.extensions??[],e=>(P(),F(`article`,{key:e.name,class:w([`ext-card`,{on:e.enabled}]),"data-extension":e.name},[L(`div`,Ux,[L(`div`,null,[L(`strong`,null,E(e.title),1),L(`code`,null,E(e.name),1)]),L(`button`,{class:w([`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]||=[L(`span`,null,null,-1)]],10,Wx)]),L(`p`,null,E(e.description),1),e.prompts?(P(),F(`ul`,{key:0,class:w([`ext-prompts`,{off:!e.enabled}])},[(P(!0),F(N,null,M(e.prompts,e=>(P(),F(`li`,{key:e.id},[L(`label`,null,[L(`input`,{type:`checkbox`,checked:e.enabled,disabled:n.value,onChange:t=>i({prompt:e.id,enabled:t.target.checked})},null,40,Gx),L(`code`,null,E(e.id),1)]),L(`span`,null,E(e.description),1),L(`details`,null,[r[2]||=L(`summary`,null,`View prompt`,-1),L(`pre`,null,E(e.text),1)])]))),128))],2)):B(``,!0)],10,Hx))),128))]))}}),qx={class:`context-section`,"aria-labelledby":`context-title`},Jx={class:`section-label`},Yx={key:0,class:`hint`},Xx={class:`context-numbers`},Zx={class:`context-pct`},Qx={key:0,class:`context-compacting`},$x=[`aria-valuemax`,`aria-valuenow`,`aria-valuetext`],eS={class:`context-marker-label`},tS=[`aria-valuemin`,`aria-valuemax`,`aria-valuenow`,`aria-valuetext`],nS={class:`context-marker-label`},rS={class:`hint context-hint`},iS={class:`modal compaction-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`compaction-title`},aS={class:`context-toggle`},oS=[`checked`],sS=512,cS=4096,lS=1024,uS=Or({__name:`ContextBar`,setup(e){let t=e=>e>=1e6?`${(e/1e6).toFixed(2)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),n=V(()=>zu.value?.contextWindow??0),r=V(()=>{let e=Nu.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=V(()=>Nu.value.compactions.length>0),a=k(),o=V(()=>a.value??xu.value?.compaction??r_(n.value));j(()=>JSON.stringify(xu.value?.compaction),e=>{a.value&&e===JSON.stringify(a.value)&&(a.value=void 0)});let s=k(),c=V(()=>W.dialog?.kind===`compaction`),l=()=>void(W.dialog=void 0);qr(()=>c.value&&l());let u=V(()=>s.value??i_(n.value,o.value)),d=e=>`${Math.min(100,Math.max(0,100*e/(n.value||1)))}%`,f=V(()=>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-lS,Math.max((t??cS)+lS,e)),h=(e,t)=>Math.min(t-lS,Math.max(cS,e));function g(e,t){let n=u.value,r=Math.round(t/sS)*sS;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=wu.value;if(!t)return;let n=await Wu(()=>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=k(),b;function ee(e,t){b=e,t.currentTarget.setPointerCapture(t.pointerId)}function x(e){if(!b||!y.value)return;let t=y.value.getBoundingClientRect();g(b,(e.clientX-t.left)/t.width*n.value)}function S(){b&&(b=void 0,v())}function te(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??cS:r.wait)+n)}return(e,a)=>(P(),F(N,null,[L(`section`,qx,[L(`div`,Jx,[a[7]||=L(`span`,{id:`context-title`},`CONTEXT`,-1),n.value?(P(),F(`button`,{key:0,class:`context-details-toggle`,onClick:a[0]||=e=>A(W).dialog={kind:`compaction`}},[R(A(Sc),{size:16}),a[6]||=z(`Details `,-1)])):B(``,!0)]),n.value?(P(),F(N,{key:1},[L(`div`,Xx,[L(`strong`,null,E(t(r.value)),1),L(`span`,null,`of `+E(t(n.value))+` tokens`,1),L(`span`,Zx,E(f.value)+`%`,1),i.value?(P(),F(`span`,Qx,[...a[8]||=[L(`i`,null,null,-1),z(`Compacting`,-1)]])):B(``,!0)]),L(`div`,{ref_key:`bar`,ref:y,class:w([`context-bar`,{off:!o.value.enabled}]),onPointermove:x,onPointerup:S,onPointercancel:S},[L(`div`,{class:w([`context-fill`,{hot:u.value.auto!==void 0&&r.value>=u.value.auto}]),style:ve({width:d(r.value)})},null,6),L(`div`,{class:`context-reserve`,style:ve({left:d(u.value.wait)}),title:`Reserved for the answer`},null,4),u.value.auto===void 0?B(``,!0):(P(),F(`button`,{key:0,class:w([`context-marker auto`,`label-${p(u.value.auto)}`]),role:`slider`,"aria-label":`Automatic compaction starts at`,"aria-valuemin":cS,"aria-valuemax":u.value.wait-lS,"aria-valuenow":u.value.auto,"aria-valuetext":`${t(u.value.auto)} tokens`,style:ve({left:d(u.value.auto)}),onPointerdown:a[1]||=e=>ee(`auto`,e),onKeydown:a[2]||=e=>te(`auto`,e),onKeyup:v,onBlur:v},[L(`span`,eS,`Auto-compact at `+E(t(u.value.auto)),1)],46,$x)),L(`button`,{class:w([`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??cS)+lS,"aria-valuemax":n.value-lS,"aria-valuenow":u.value.wait,"aria-valuetext":`${t(u.value.wait)} tokens, ${t(n.value-u.value.wait)} reserved`,style:ve({left:d(u.value.wait)}),onPointerdown:a[3]||=e=>ee(`wait`,e),onKeydown:a[4]||=e=>te(`wait`,e),onKeyup:v,onBlur:v},[L(`span`,nS,`Reserve at `+E(t(u.value.wait)),1)],46,tS)],34),L(`p`,rS,[o.value.enabled?(P(),F(N,{key:0},[a[9]||=z(`Compacts in the background at `,-1),L(`strong`,null,E(t(u.value.auto??u.value.wait)),1),a[10]||=z(` and waits at `,-1),L(`strong`,null,E(t(u.value.wait)),1),a[11]||=z(`.`,-1)],64)):(P(),F(N,{key:1},[z(`Automatic compaction is off.`)],64))])],64)):(P(),F(`div`,Yx,`Pick a model to see its context window.`))]),(P(),I(ur,{to:`body`},[c.value?(P(),F(`div`,{key:0,class:`modal-backdrop`,onClick:js(l,[`self`])},[L(`section`,iS,[L(`header`,null,[a[12]||=L(`h2`,{id:`compaction-title`},`Context compaction`,-1),L(`button`,{class:`icon-button`,"aria-label":`Close context compaction`,onClick:l},[R(A(ol),{size:18})])]),L(`p`,null,[a[13]||=z(` A summary starts in the background at `,-1),L(`strong`,null,E(t(u.value.auto??u.value.wait)),1),a[14]||=z(`. Above `,-1),L(`strong`,null,E(t(u.value.wait)),1),z(` the next request waits for it, keeping `+E(t(n.value-u.value.wait))+` free for the answer. Drag a marker on the bar to change either point. `,1)]),a[16]||=L(`p`,null,[z(`Older entries stay stored, and `),L(`code`,null,`search_history`),z(` still finds them.`)],-1),L(`label`,aS,[L(`input`,{type:`checkbox`,checked:o.value.enabled,onChange:a[5]||=e=>_({enabled:e.target.checked})},null,40,oS),a[15]||=z(` Automatic compaction `,-1)]),a[17]||=L(`p`,{class:`hint`},[z(` Applies to every agent in this session. `),L(`code`,null,`/compact`),z(` works either way. `)],-1),L(`footer`,null,[L(`button`,{class:`secondary`,onClick:l},`Close`)])])])):B(``,!0)]))],64))}}),dS=/^[A-Za-z_$][\w$]*$/,fS=e=>` `.repeat(e);function pS(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`),mS(t,0,r),r(`): `,`punct`),r(`Promise`,`type`),r(`<`,`punct`),r(`ToolResult`,`type`),r(`>;`,`punct`),n}function mS(e,t,n){if(!e||typeof e!=`object`)return n(`unknown`,`type`);if(`const`in e)return _S(e.const,n);if(e.enum)return gS(e.enum.map(e=>({const:e})),t,n);if(e.anyOf??e.oneOf)return gS(e.anyOf??e.oneOf,t,n);if(Array.isArray(e.type))return gS(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`),mS(e.items,t,n),r&&n(`)`,`punct`),n(`[]`,`punct`)}case`object`:return hS(e,t,n);default:return n(`unknown`,`type`)}}function hS(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`),mS(e.additionalProperties,t,n),n(`>`,`punct`)):n(`{}`,`punct`);let i=new Set(e.required??[]);n(`{`,`punct`),n(`
78
- `);for(let[e,a]of r){let r=vS(a);r&&n(`${fS(t+1)}${r}\n`,`comment`),n(fS(t+1)),n(dS.test(e)?e:JSON.stringify(e),`property`),n(i.has(e)?`: `:`?: `,`punct`),mS(a,t+1,n),n(`;`,`punct`),n(`
79
- `)}n(fS(t)),n(`}`,`punct`)}function gS(e,t,n){e.forEach((e,r)=>{r&&n(` | `,`punct`),mS(e,t,n)})}function _S(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 vS(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 yS={key:0,class:`panel-rail`,"aria-label":`Inspector (collapsed)`},bS=[`title`],xS=[`aria-label`,`title`,`onClick`],SS={key:0,class:`count`},CS={class:`inspector-tabs`,role:`tablist`,"aria-label":`Session details`},wS=[`id`,`aria-selected`,`onClick`],TS={key:0,class:`count`},ES=[`title`],DS=[`aria-labelledby`],OS={class:`session-heading`},kS=[`title`],AS={class:`cwd-trail`,dir:`rtl`},jS={dir:`ltr`},MS={class:`session-status`},NS={key:0,class:`background-pill`},PS=[`title`],FS={class:`model-section`},IS=[`src`],LS={class:`thinking-row`},RS=[`value`],zS={class:`stats-section`,"aria-labelledby":`stats-title`},BS={class:`metrics`},VS=[`title`],HS={class:`usage-breakdown`,"aria-label":`Agent token and cost breakdown`},US={scope:`row`},WS={class:`panel-heading`},GS={class:`hint app-state-description`},KS=[`disabled`],qS={class:`state-json-actions`},JS={key:0,class:`hint`},YS=[`disabled`],XS=[`disabled`],ZS={key:0,class:`message-error`,role:`alert`},QS={class:`panel-heading`},$S={class:`tag`},eC={class:`hook-card`},tC=[`aria-checked`],nC={key:0,class:`tag tool-disabled`},rC={class:`tag`},iC=[`aria-label`],aC=Or({__name:`Inspector`,setup(e){let t=V(()=>new Map(Bu.value?.tools.map(e=>[e.name,pS(e.name,e.parameters)]))),n=[{id:`session`,label:`Session`,icon:mc},{id:`git`,label:`Git`,icon:gc},{id:`state`,label:`State`,icon:Qs},{id:`tasks`,label:`Tasks`,icon:Us},{id:`tools`,label:`Tools`,icon:al},{id:`extensions`,label:`Extend`,icon:Uc}],r=V(()=>[{label:`Input`,tokens:Ru.value.input,cost:Ru.value.inputCost},{label:`Output`,tokens:Ru.value.output,cost:Ru.value.outputCost},{label:`Cache read`,tokens:Ru.value.cacheRead,cost:Ru.value.cacheReadCost},{label:`Cache write`,tokens:Ru.value.cacheWrite,cost:Ru.value.cacheWriteCost}]),i=V(()=>Iu.value.filter(e=>e.background).length);function a(e,t){Wu(async()=>{await Cu.value.configure(e),await Hu(),t&&G(t)})}function o(){let e=wu.value;e&&(W.dialog={kind:`prompt`,title:`Rename session`,label:`Session name`,value:xu.value?.name??``,submit:`Save name`,run:t=>e.rename(t)})}let s=bu.sharedState,c=k(``),l=k(``),u=k(0),d=k(!1),f=k(``),p=V(()=>c.value!==l.value),m=V(()=>p.value&&s.value?.revision!==u.value);function h(){c.value=qu(s.value?.value??{}),l.value=c.value,u.value=s.value?.revision??0,f.value=``}j(s,()=>!p.value&&h(),{immediate:!0});async function g(e){if(!d.value&&Cu.value){d.value=!0,f.value=``;try{await Cu.value.demo(`state`,e)}catch(e){f.value=Zl(e)}finally{d.value=!1}}}async function _(){if(!d.value&&Cu.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 Cu.value.demo(`state`,{operation:`update`,path:``,value:e,expectedRevision:u.value});c.value=qu(t.value),l.value=c.value,u.value=t.revision,G(`Shared App State saved.`)}catch(e){f.value=Zl(e)}finally{d.value=!1}}}let v=V(()=>Bu.value?.config.readOnly===!0),y=V(()=>Bu.value?.tools.filter(e=>e.offered).length??0);return(e,l)=>(P(),F(`aside`,{class:w([`inspector`,{collapsed:!A(ed),overlay:A(W).inspectorOverlay}])},[A(ed)?(P(),F(N,{key:1},[L(`div`,CS,[(P(),F(N,null,M(n,e=>L(`button`,{id:`inspector-tab-${e.id}`,key:e.id,role:`tab`,"aria-controls":`inspector-panel`,"aria-selected":A(W).tab===e.id,class:w({active:A(W).tab===e.id}),onClick:t=>A(W).tab=e.id},[(P(),I(ti(e.icon),{size:18})),z(E(e.label),1),e.id===`tasks`&&A(Iu).length?(P(),F(`span`,TS,E(A(Iu).length),1)):B(``,!0)],10,wS)),64)),L(`button`,{class:`icon-button panel-toggle`,"aria-label":`Collapse inspector`,title:`Collapse inspector (${A(od).inspector})`,onClick:l[1]||=e=>A(nd)()},[R(A(Ic),{size:18})],8,ES)]),L(`div`,{id:`inspector-panel`,class:w([`inspector-body`,{"session-panel":A(W).tab===`session`}]),role:`tabpanel`,"aria-labelledby":`inspector-tab-${A(W).tab}`},[A(W).tab===`session`?(P(),F(N,{key:0},[L(`section`,OS,[L(`h1`,null,[L(`span`,null,E(A(xu)?.name??`Loading session`),1),L(`button`,{class:`icon-button`,title:`Rename session`,"aria-label":`Rename session`,onClick:o},[R(A(Bc),{size:18})])]),L(`button`,{class:`path cwd-button`,title:A(xu)?.cwd,"aria-label":`Show full working directory`,onClick:l[2]||=e=>A(W).dialog={kind:`path`,path:A(xu)?.cwd??``}},[R(A(mc),{size:18}),L(`span`,AS,[L(`bdi`,jS,E(A(xu)?.cwd),1)])],8,kS),L(`div`,MS,[L(`span`,{class:w([`status-pill`,{working:A(Lu)}])},[l[7]||=L(`i`,null,null,-1),z(E(A(Lu)?`Working`:`Idle`),1)],2),i.value?(P(),F(`span`,NS,E(i.value)+` background`,1)):B(``,!0),L(`span`,{class:`saved`,title:A(gu)?.id},[R(A(Kc),{size:18}),z(E(A(gu)?.name??A(gu)?.id),1)],8,PS),A(gu)?(P(),I(Ov,{key:1,device:A(gu)},null,8,[`device`])):B(``,!0)])]),A(gu)?(P(),I(Gv,{key:0,device:A(gu)},null,8,[`device`])):B(``,!0),L(`section`,FS,[l[14]||=L(`div`,{class:`section-label`},[L(`span`,null,`AGENT`)],-1),L(`button`,{class:`model-button`,onClick:l[3]||=e=>A(W).dialog={kind:`models`}},[L(`img`,{src:A(Ju)(A(Nu).agent.model?.modelId),alt:``},null,8,IS),L(`div`,null,[L(`strong`,null,E(A(zu)?.name??A(Nu).agent.model?.modelId??`Loading…`),1),L(`small`,null,E(A(zu)?.tier??``)+` / `+E(A(Nu).agent.model?.provider??``),1)]),R(A(tc),{size:18})]),L(`div`,LS,[l[8]||=L(`span`,null,`Thinking`,-1),L(`select`,{"aria-label":`Thinking level`,value:A(Nu).agent.thinkingLevel??`low`,onChange:l[4]||=e=>a({thinkingLevel:e.target.value},`Thinking ${e.target.value}. Used on the next turn.`)},[(P(!0),F(N,null,M(A(e_),e=>(P(),F(`option`,{key:e},E(e),1))),128))],40,RS)]),R(uS),L(`section`,zS,[l[13]||=L(`div`,{class:`section-label`},[L(`span`,{id:`stats-title`},`STATS`)],-1),L(`div`,BS,[L(`div`,{title:`${A(Ru).tokens.toLocaleString(`en-US`)} total tokens`},[L(`span`,null,E(A(Ku)(A(Ru).tokens)),1),l[9]||=L(`small`,null,`total tokens`,-1)],8,VS),L(`div`,null,[L(`span`,null,`$`+E(A(Ru).cost.toFixed(4)),1),l[10]||=L(`small`,null,`agent cost`,-1)]),L(`div`,null,[L(`span`,null,E(A(Bu)?.tools.length??0),1),l[11]||=L(`small`,null,`tools`,-1)])]),L(`table`,HS,[l[12]||=L(`thead`,null,[L(`tr`,null,[L(`th`,{scope:`col`},`Type`),L(`th`,{scope:`col`},`Tokens`),L(`th`,{scope:`col`},`Cost (USD)`)])],-1),L(`tbody`,null,[(P(!0),F(N,null,M(r.value,e=>(P(),F(`tr`,{key:e.label},[L(`th`,US,E(e.label),1),L(`td`,null,E(e.tokens.toLocaleString(`en-US`)),1),L(`td`,null,`$`+E(e.cost.toFixed(4)),1)]))),128))])])])])],64)):B(``,!0),A(W).tab===`state`?(P(),F(N,{key:1},[L(`div`,WS,[l[15]||=L(`h2`,null,`App State`,-1),R(A(Qs),{size:18})]),L(`p`,GS,` One shared JSON object for every agent, session and fork on `+E(A(gu)?.name??A(gu)?.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),Un(L(`textarea`,{"onUpdate:modelValue":l[5]||=e=>c.value=e,class:`app-state-json`,"aria-label":`App State JSON`,spellcheck:`false`,disabled:d.value||!A(s),rows:`12`},null,8,KS),[[xs,c.value]]),L(`div`,qS,[m.value?(P(),F(`span`,JS,`State changed elsewhere. Load the latest JSON before saving.`)):B(``,!0),p.value?(P(),F(`button`,{key:1,class:`secondary`,disabled:d.value,onClick:h},E(m.value?`Load latest`:`Reset`),9,YS)):B(``,!0),L(`button`,{class:`primary small`,disabled:!p.value||d.value||m.value,onClick:_},E(d.value?`Saving…`:`Save JSON`),9,XS)]),f.value?(P(),F(`p`,ZS,E(f.value),1)):B(``,!0),R(Sv,{value:A(s)?.value??{},disabled:d.value||p.value||!A(s),onChange:g},null,8,[`value`,`disabled`])],64)):B(``,!0),A(W).tab===`tasks`?(P(),I(Sy,{key:2})):B(``,!0),A(W).tab===`git`?(P(),I(Rx,{key:3})):B(``,!0),A(W).tab===`extensions`?(P(),I(Kx,{key:4})):B(``,!0),A(W).tab===`tools`?(P(),F(N,{key:5},[L(`div`,QS,[l[16]||=L(`h2`,null,`Tools`,-1),L(`span`,$S,E(y.value)+` / `+E(A(Bu)?.tools.length??0),1)]),l[20]||=L(`p`,{class:`hint`},` Every tool this agent's extensions provide. Open one to see its definition. `,-1),L(`div`,eC,[L(`div`,null,[R(A(Jc),{size:18}),l[18]||=L(`strong`,null,`Read only`,-1),L(`button`,{class:w([`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]||=[L(`span`,null,null,-1)]],10,tC)]),l[19]||=L(`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)]),(P(!0),F(N,null,M(A(Bu)?.tools,e=>(P(),F(`details`,{key:e.name,class:w([`tool-row`,{disabled:!e.offered}])},[L(`summary`,null,[R(A(al),{size:18}),L(`strong`,null,E(e.name),1),e.offered?B(``,!0):(P(),F(`span`,nC,`disabled`)),L(`span`,rC,E(e.replay===`safe`?`replay safe`:`interrupt on crash`),1)]),L(`p`,null,E(e.description),1),e.parameters?(P(),F(`pre`,{key:0,class:`tool-signature`,"aria-label":`${e.name} TypeScript definition`},[L(`code`,null,[(P(!0),F(N,null,M(t.value.get(e.name),(e,t)=>(P(),F(`span`,{key:t,class:w(`tk-${e.kind}`)},E(e.text),3))),128))])],8,iC)):B(``,!0),L(`small`,null,E(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)):B(``,!0)],10,DS)],64)):(P(),F(`div`,yS,[L(`button`,{class:`icon-button panel-toggle`,"aria-label":`Expand inspector`,title:`Expand inspector (${A(od).inspector})`,onClick:l[0]||=e=>A(td)()},[R(A(Lc),{size:18})],8,bS),(P(),F(N,null,M(n,e=>L(`button`,{key:e.id,class:w([`rail-tab`,{active:A(W).tab===e.id}]),"aria-label":`Open ${e.label}`,title:e.label,onClick:t=>A(td)(e.id)},[(P(),I(ti(e.icon),{size:20})),e.id===`tasks`&&A(Iu).length?(P(),F(`span`,SS,E(A(Iu).length),1)):B(``,!0)],10,xS)),64))]))],2))}}),oC={class:`chat-empty`},sC={class:`eyebrow`},cC={key:3,class:`hint offline-error`},lC={key:4,class:`offline-command`},uC={key:5,class:`hint`},dC={key:6,class:`hint`},fC={class:`offline-actions`},pC=[`disabled`],mC={key:7,class:`message-error`,role:`alert`},hC=Or({__name:`OfflinePanel`,props:{device:{}},setup(e){let t=e,n=k(!1),r=k(``),i=V(()=>{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 ${Yu(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 Xl.check(t.device.id);e.status===`online`&&G(`${e.id} is online.`)}catch(e){r.value=Zl(e)}finally{n.value=!1}}async function o(e){try{await navigator.clipboard.writeText(e),G(`Copied.`)}catch{G(`Clipboard needs localhost or HTTPS. Select the text to copy.`)}}return(t,s)=>(P(),F(`section`,{class:w([`chat-panel offline-panel`,e.device.status]),"aria-live":`polite`},[L(`div`,oC,[e.device.status===`checking`?(P(),I(A(kc),{key:0,class:`spin`,size:30})):e.device.status===`mismatch`||e.device.status===`unauthorized`?(P(),I(A(qc),{key:1,size:30})):(P(),I(A(nl),{key:2,size:30})),L(`span`,sC,E(e.device.kind.toUpperCase())+` · `+E(e.device.url??(e.device.transport===`tunnel`?`tunnel`:`no endpoint`)),1),L(`h2`,null,E(i.value.title),1),L(`p`,null,E(i.value.text),1),e.device.error?(P(),F(`p`,cC,E(e.device.error),1)):B(``,!0),i.value.command?(P(),F(`div`,lC,[L(`code`,null,E(i.value.command),1),L(`button`,{class:`icon-button`,"aria-label":`Copy command`,onClick:s[0]||=e=>o(i.value.command)},[R(A(oc),{size:18})])])):B(``,!0),i.value.command?(P(),F(`p`,uC,`Run it in this repo's terminal, then press Check now.`)):B(``,!0),i.value.alt?(P(),F(`p`,dC,[s[2]||=z(` Never deployed or rebuilt? `,-1),L(`code`,null,E(i.value.alt),1),s[3]||=z(` provisions it from scratch. `,-1)])):B(``,!0),L(`div`,fC,[L(`button`,{class:`secondary`,disabled:n.value,onClick:s[1]||=e=>a()},[R(A(Wc),{size:18}),z(E(n.value?`Checking…`:`Check now`),1)],8,pC)]),r.value?(P(),F(`p`,mC,E(r.value),1)):B(``,!0)])],2))}}),gC={class:`dir-browser`},_C={class:`dir-path`},vC=[`disabled`],yC=[`aria-busy`],bC=[`title`],xC=[`aria-selected`,`title`,`onClick`],SC={key:1,class:`hint`},CC={key:0,class:`message-error`,role:`alert`},wC=Or({__name:`DirBrowser`,props:li({deviceId:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=ki(e,`modelValue`),r=k(),i=k(!1),a=k(``),o=0;async function s(e){let s=++o,c=t.deviceId;i.value=!0,a.value=``;try{let t=await Jl(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 j(()=>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)=>(P(),F(`div`,gC,[L(`div`,_C,[Un(L(`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]]),L(`button`,{type:`button`,class:`secondary small`,disabled:i.value||!n.value,onClick:t[2]||=e=>s(n.value)},` Go `,8,vC)]),L(`div`,{class:`dir-list`,role:`listbox`,"aria-label":`Directories`,"aria-busy":i.value},[L(`button`,{type:`button`,class:`dir-item`,title:`Start directories`,onClick:t[3]||=e=>s(``)},[R(A(xc),{size:16}),t[5]||=L(`span`,null,`Start dirs`,-1)]),r.value?.parent?(P(),F(`button`,{key:0,type:`button`,class:`dir-item`,title:r.value.parent,onClick:t[4]||=e=>s(r.value.parent)},[R(A(cc),{size:16}),t[6]||=L(`span`,null,`..`,-1)],8,bC)):B(``,!0),(P(!0),F(N,null,M(r.value?.dirs,e=>(P(),F(`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?(P(),I(A(mc),{key:0,size:16})):(P(),I(A(hc),{key:1,size:16})),L(`span`,null,E(e.name),1)],8,xC))),128)),r.value&&!r.value.dirs.length?(P(),F(`p`,SC,`No subdirectories.`)):B(``,!0)],8,yC),a.value?(P(),F(`p`,CC,E(a.value),1)):B(``,!0)]))}}),TC={key:0,class:`message-error`},EC=[`value`],DC={class:`field`},OC={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`},kC=[`value`],AC={key:2,class:`message-error`,role:`alert`},jC=[`disabled`],MC=Or({__name:`NewSessionDialog`,props:{deviceId:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=V(()=>lu.devices.value.filter(e=>e.status===`online`)),a=k(i.value.find(e=>e.id===n.deviceId)?.id??i.value[0]?.id??``),o=V(()=>i.value.find(e=>e.id===a.value)),s=V(()=>{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=V(()=>!s.value.length||(o.value?.info?.models?.length??0)===0),l=V(()=>!!o.value?.info?.providerKeyMissing),u=e=>`${e.provider}/${e.id}`,d=k({name:``,cwd:``,model:``}),f=k(!1),p=k(``);j(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 Jl(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];Tu({deviceId:o.value.id,sessionId:t.id,agentId:n?.id??1}),G(`Session created on ${o.value.id}.`),r(`close`)}catch(e){p.value=Zl(e)}finally{f.value=!1}}}return(e,t)=>(P(),F(`div`,{class:`modal-backdrop`,onClick:t[6]||=js(e=>r(`close`),[`self`])},[L(`form`,{class:`modal session-modal`,onSubmit:js(m,[`prevent`])},[L(`header`,null,[t[7]||=L(`div`,null,[L(`span`,{class:`eyebrow`},`A PERSISTENT WORKSPACE`),L(`h2`,null,`New session`)],-1),L(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close new session`,onClick:t[0]||=e=>r(`close`)},[R(A(ol),{size:18})])]),i.value.length?(P(),F(N,{key:1},[L(`label`,null,[t[8]||=z(`Device`,-1),Un(L(`select`,{"onUpdate:modelValue":t[1]||=e=>a.value=e,"aria-label":`Device`},[(P(!0),F(N,null,M(i.value,e=>(P(),F(`option`,{key:e.id,value:e.id},E(e.name)+E(e.info?.hostname&&e.info.hostname!==e.name?` · ${e.info.hostname}`:``),9,EC))),128))],512),[[ws,a.value]])]),L(`label`,null,[t[9]||=z(`Session name`,-1),Un(L(`input`,{"onUpdate:modelValue":t[2]||=e=>d.value.name=e,autofocus:``,placeholder:`My durable agent`,maxlength:`100`},null,512),[[xs,d.value.name]])]),L(`div`,DC,[L(`span`,null,`Working directory on `+E(i.value.find(e=>e.id===a.value)?.name??a.value),1),R(wC,{modelValue:d.value.cwd,"onUpdate:modelValue":t[3]||=e=>d.value.cwd=e,"device-id":a.value},null,8,[`modelValue`,`device-id`])]),L(`label`,null,[t[10]||=z(`Model`,-1),c.value||l.value?(P(),F(`span`,OC,`no API key on device — chat needs one`)):B(``,!0),Un(L(`select`,{"onUpdate:modelValue":t[4]||=e=>d.value.model=e,"aria-label":`New session model`},[(P(!0),F(N,null,M(s.value,e=>(P(),F(`option`,{key:u(e),value:u(e)},E(e.tier)+` / `+E(e.name),9,kC))),128))],512),[[ws,d.value.model]])])],64)):(P(),F(`p`,TC,` No device is online. Start one with just backend run or just net up <id>, then try again. `)),p.value?(P(),F(`p`,AC,E(p.value),1)):B(``,!0),L(`footer`,null,[L(`button`,{type:`button`,class:`secondary`,onClick:t[5]||=e=>r(`close`)},`Cancel`),L(`button`,{class:`primary`,disabled:f.value||!d.value.model||!d.value.cwd||!o.value},[R(A(Hc),{size:18}),z(E(f.value?`Creating…`:`Create session`),1)],8,jC)])],32)]))}}),NC=new Uint8Array(512),PC=new Uint8Array(256);(()=>{let e=1;for(let t=0;t<255;t++)NC[t]=e,PC[e]=t,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)NC[e]=NC[e-255]})();var FC=(e,t)=>e===0||t===0?0:NC[PC[e]+PC[t]];function IC(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]^=FC(t[r],NC[n]);t=e}return t}function LC(e,t){let n=IC(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]^=FC(n[i+1],e)}return r}var RC=[21,25,29,33,37,41,45,49,53,57,61,65],zC=[19,34,55,80,108,136,156,194,232,274,324,370],BC=[7,10,15,20,26,36,40,48,60,72,80,96],VC=[7,10,15,20,26,18,20,24,30,18,20,24],HC=[[[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]]],UC=[[],[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]],WC=e=>e<=9?8:16;function GC(e){for(let t=1;t<=RC.length;t++)if(4+WC(t)+e*8<=zC[t-1]*8)return t;throw Error(`qr: payload too long (${e} bytes; v12L max ${zC[11]-3})`)}function KC(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,WC(t));for(let e of n)i(e,8);let a=zC[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 qC(e,t){let n=VC[e-1],r=[],i=0;for(let[n,a]of HC[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=>LC(e,n));for(let e=0;e<n;e++)for(let t of s)a.push(t[e]);return a}function JC(e){return Array.from({length:e},()=>Array(e).fill(!1))}function YC(e,t){let n=RC[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=UC[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 XC(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 ZC(e,t){let n=RC[0]*0+e.length,r=XC(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 QC(e,t,n,r){let i=e.length;RC[n-1]*RC[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(ew(l,i,n))continue;if(o>=(zC[n-1]+BC[n-1])*8){o++;continue}let t=a(o++);$C(l,i,r)&&(t=!t),e[l][i]=t}}s=!s}}function $C(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 ew(e,t,n){let r=RC[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=UC[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 tw(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 nw(e,t){let n=GC(new TextEncoder().encode(e).length),r=RC[n-1],i=qC(n,KC(e,n)),a=JC(r);return YC(a,n),QC(a,i,n,t),ZC(a,t),a}function rw(e,t){if(t!==void 0)return nw(e,t);let n;for(let t=0;t<8;t++){let r=nw(e,t),i=tw(r);(!n||i<n.score)&&(n={m:r,score:i})}return n.m}function iw(e,t=160){let n=rw(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 aw={class:`device-handoff`,"aria-label":`Pair this machine`},ow={class:`row`},sw=[`disabled`],cw=[`disabled`],lw={key:0,class:`target`,"data-testid":`device-url`},uw={key:1,class:`err`},dw=Zg(Or({__name:`DeviceHandoff`,props:{offerFragment:{}},setup(e){let t=e,n=k(`4780`),r=k(!1),i=V(()=>{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)=>(P(),F(`section`,aw,[L(`header`,null,[R(A(Mc),{size:18}),t[1]||=L(`h3`,null,`Pair THIS machine`,-1)]),t[4]||=L(`p`,{class:`what`},[z(` 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 `),L(`code`,null,`dpi device`),z(` there first. `)],-1),L(`div`,ow,[L(`label`,null,[t[2]||=z(` local port `,-1),Un(L(`input`,{"onUpdate:modelValue":t[0]||=e=>n.value=e,inputmode:`numeric`,spellcheck:`false`,"aria-label":`Local dpi backend port`},null,512),[[xs,n.value]])]),L(`button`,{class:`primary`,type:`button`,disabled:!i.value,onClick:a},[R(A(dc),{size:15}),t[3]||=z(`Open the device page `,-1)],8,sw),L(`button`,{class:`secondary`,type:`button`,disabled:!i.value,onClick:o},[R(A(oc),{size:15}),z(E(r.value?`Copied`:`Copy link`),1)],8,cw)]),i.value?(P(),F(`p`,lw,E(i.value),1)):B(``,!0),i.value?B(``,!0):(P(),F(`p`,uw,`port must be 1–65535`))]))}}),[[`__scopeId`,`data-v-01884b7b`]]);function fw(e){return xw(e)&&!pw(e)&&!Tw(e)&&Symbol.asyncIterator in e}function pw(e){return Array.isArray(e)}function mw(e){return typeof e==`bigint`}function hw(e){return typeof e==`boolean`}function gw(e){return e instanceof globalThis.Date}function _w(e){return typeof e==`function`}function vw(e){return xw(e)&&!pw(e)&&!Tw(e)&&Symbol.iterator in e}function yw(e){return e===null}function bw(e){return typeof e==`number`}function xw(e){return typeof e==`object`&&!!e}function Sw(e){return e instanceof globalThis.RegExp}function Cw(e){return typeof e==`string`}function ww(e){return typeof e==`symbol`}function Tw(e){return e instanceof globalThis.Uint8Array}function Ew(e){return e===void 0}function Dw(e){return e.map(e=>Mw(e))}function Ow(e){return new Date(e.getTime())}function kw(e){return new Uint8Array(e)}function Aw(e){return new RegExp(e.source,e.flags)}function jw(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Mw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Mw(e[n]);return t}function Mw(e){return pw(e)?Dw(e):gw(e)?Ow(e):Tw(e)?kw(e):Sw(e)?Aw(e):xw(e)?jw(e):e}function Nw(e){return Mw(e)}function Pw(e,t){return Nw(t===void 0?e:{...t,...e})}function Fw(e){return typeof e==`object`&&!!e}function Iw(e){return globalThis.Array.isArray(e)&&!globalThis.ArrayBuffer.isView(e)}function Lw(e){return e===void 0}function Rw(e){return typeof e==`number`}var zw;(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=Fw(t);return e.AllowArrayObject?n:n&&!Iw(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?Rw(t):Number.isFinite(t)}e.IsNumberLike=i;function a(t){let n=Lw(t);return e.AllowNullVoid?n||t===null:n}e.IsVoidLike=a})(zw||={});function Bw(e){return globalThis.Object.freeze(e).map(e=>Gw(e))}function Vw(e){return e}function Hw(e){return e}function Uw(e){return e}function Ww(e){let t={};for(let n of Object.getOwnPropertyNames(e))t[n]=Gw(e[n]);for(let n of Object.getOwnPropertySymbols(e))t[n]=Gw(e[n]);return globalThis.Object.freeze(t)}function Gw(e){return pw(e)?Bw(e):gw(e)?Vw(e):Tw(e)?Hw(e):Sw(e)?Uw(e):xw(e)?Ww(e):e}function J(e,t){let n=t===void 0?e:{...t,...e};switch(zw.InstanceMode){case`freeze`:return Gw(n);case`clone`:return Nw(n);default:return n}}var Kw=class extends Error{constructor(e){super(e)}},qw=Symbol.for(`TypeBox.Transform`),Jw=Symbol.for(`TypeBox.Readonly`),Yw=Symbol.for(`TypeBox.Optional`),Xw=Symbol.for(`TypeBox.Hint`),Y=Symbol.for(`TypeBox.Kind`);function Zw(e){return xw(e)&&e[Jw]===`Readonly`}function Qw(e){return xw(e)&&e[Yw]===`Optional`}function $w(e){return X(e,`Any`)}function eT(e){return X(e,`Argument`)}function tT(e){return X(e,`Array`)}function nT(e){return X(e,`AsyncIterator`)}function rT(e){return X(e,`BigInt`)}function iT(e){return X(e,`Boolean`)}function aT(e){return X(e,`Computed`)}function oT(e){return X(e,`Constructor`)}function sT(e){return X(e,`Date`)}function cT(e){return X(e,`Function`)}function lT(e){return X(e,`Integer`)}function uT(e){return X(e,`Intersect`)}function dT(e){return X(e,`Iterator`)}function X(e,t){return xw(e)&&Y in e&&e[Y]===t}function fT(e){return hw(e)||bw(e)||Cw(e)}function pT(e){return X(e,`Literal`)}function mT(e){return X(e,`MappedKey`)}function hT(e){return X(e,`MappedResult`)}function gT(e){return X(e,`Never`)}function _T(e){return X(e,`Not`)}function vT(e){return X(e,`Null`)}function yT(e){return X(e,`Number`)}function bT(e){return X(e,`Object`)}function xT(e){return X(e,`Promise`)}function ST(e){return X(e,`Record`)}function CT(e){return X(e,`Ref`)}function wT(e){return X(e,`RegExp`)}function TT(e){return X(e,`String`)}function ET(e){return X(e,`Symbol`)}function DT(e){return X(e,`TemplateLiteral`)}function OT(e){return X(e,`This`)}function kT(e){return xw(e)&&qw in e}function AT(e){return X(e,`Tuple`)}function jT(e){return X(e,`Undefined`)}function MT(e){return X(e,`Union`)}function NT(e){return X(e,`Uint8Array`)}function PT(e){return X(e,`Unknown`)}function FT(e){return X(e,`Unsafe`)}function IT(e){return X(e,`Void`)}function LT(e){return xw(e)&&Y in e&&Cw(e[Y])}function RT(e){return $w(e)||eT(e)||tT(e)||iT(e)||rT(e)||nT(e)||aT(e)||oT(e)||sT(e)||cT(e)||lT(e)||uT(e)||dT(e)||pT(e)||mT(e)||hT(e)||gT(e)||_T(e)||vT(e)||yT(e)||bT(e)||xT(e)||ST(e)||CT(e)||wT(e)||TT(e)||ET(e)||DT(e)||OT(e)||AT(e)||jT(e)||MT(e)||NT(e)||PT(e)||FT(e)||IT(e)||LT(e)}var zT=`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 BT(e){try{return new RegExp(e),!0}catch{return!1}}function VT(e){if(!Cw(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 HT(e){return GT(e)||BE(e)}function UT(e){return Ew(e)||mw(e)}function WT(e){return Ew(e)||bw(e)}function GT(e){return Ew(e)||hw(e)}function KT(e){return Ew(e)||Cw(e)}function qT(e){return Ew(e)||Cw(e)&&VT(e)&&BT(e)}function JT(e){return Ew(e)||Cw(e)&&VT(e)}function YT(e){return Ew(e)||BE(e)}function XT(e){return xw(e)&&e[Yw]===`Optional`}function ZT(e){return Z(e,`Any`)&&KT(e.$id)}function QT(e){return Z(e,`Argument`)&&bw(e.index)}function $T(e){return Z(e,`Array`)&&e.type===`array`&&KT(e.$id)&&BE(e.items)&&WT(e.minItems)&&WT(e.maxItems)&&GT(e.uniqueItems)&&YT(e.contains)&&WT(e.minContains)&&WT(e.maxContains)}function eE(e){return Z(e,`AsyncIterator`)&&e.type===`AsyncIterator`&&KT(e.$id)&&BE(e.items)}function tE(e){return Z(e,`BigInt`)&&e.type===`bigint`&&KT(e.$id)&&UT(e.exclusiveMaximum)&&UT(e.exclusiveMinimum)&&UT(e.maximum)&&UT(e.minimum)&&UT(e.multipleOf)}function nE(e){return Z(e,`Boolean`)&&e.type===`boolean`&&KT(e.$id)}function rE(e){return Z(e,`Computed`)&&Cw(e.target)&&pw(e.parameters)&&e.parameters.every(e=>BE(e))}function iE(e){return Z(e,`Constructor`)&&e.type===`Constructor`&&KT(e.$id)&&pw(e.parameters)&&e.parameters.every(e=>BE(e))&&BE(e.returns)}function aE(e){return Z(e,`Date`)&&e.type===`Date`&&KT(e.$id)&&WT(e.exclusiveMaximumTimestamp)&&WT(e.exclusiveMinimumTimestamp)&&WT(e.maximumTimestamp)&&WT(e.minimumTimestamp)&&WT(e.multipleOfTimestamp)}function oE(e){return Z(e,`Function`)&&e.type===`Function`&&KT(e.$id)&&pw(e.parameters)&&e.parameters.every(e=>BE(e))&&BE(e.returns)}function sE(e){return Z(e,`Integer`)&&e.type===`integer`&&KT(e.$id)&&WT(e.exclusiveMaximum)&&WT(e.exclusiveMinimum)&&WT(e.maximum)&&WT(e.minimum)&&WT(e.multipleOf)}function cE(e){return xw(e)&&Object.entries(e).every(([e,t])=>VT(e)&&BE(t))}function lE(e){return Z(e,`Intersect`)&&!(Cw(e.type)&&e.type!==`object`)&&pw(e.allOf)&&e.allOf.every(e=>BE(e)&&!jE(e))&&KT(e.type)&&(GT(e.unevaluatedProperties)||YT(e.unevaluatedProperties))&&KT(e.$id)}function uE(e){return Z(e,`Iterator`)&&e.type===`Iterator`&&KT(e.$id)&&BE(e.items)}function Z(e,t){return xw(e)&&Y in e&&e[Y]===t}function dE(e){return mE(e)&&Cw(e.const)}function fE(e){return mE(e)&&bw(e.const)}function pE(e){return mE(e)&&hw(e.const)}function mE(e){return Z(e,`Literal`)&&KT(e.$id)&&hE(e.const)}function hE(e){return hw(e)||bw(e)||Cw(e)}function gE(e){return Z(e,`MappedKey`)&&pw(e.keys)&&e.keys.every(e=>bw(e)||Cw(e))}function _E(e){return Z(e,`MappedResult`)&&cE(e.properties)}function vE(e){return Z(e,`Never`)&&xw(e.not)&&Object.getOwnPropertyNames(e.not).length===0}function yE(e){return Z(e,`Not`)&&BE(e.not)}function bE(e){return Z(e,`Null`)&&e.type===`null`&&KT(e.$id)}function xE(e){return Z(e,`Number`)&&e.type===`number`&&KT(e.$id)&&WT(e.exclusiveMaximum)&&WT(e.exclusiveMinimum)&&WT(e.maximum)&&WT(e.minimum)&&WT(e.multipleOf)}function SE(e){return Z(e,`Object`)&&e.type===`object`&&KT(e.$id)&&cE(e.properties)&&HT(e.additionalProperties)&&WT(e.minProperties)&&WT(e.maxProperties)}function CE(e){return Z(e,`Promise`)&&e.type===`Promise`&&KT(e.$id)&&BE(e.item)}function wE(e){return Z(e,`Record`)&&e.type===`object`&&KT(e.$id)&&HT(e.additionalProperties)&&xw(e.patternProperties)&&(e=>{let t=Object.getOwnPropertyNames(e.patternProperties);return t.length===1&&BT(t[0])&&xw(e.patternProperties)&&BE(e.patternProperties[t[0]])})(e)}function TE(e){return Z(e,`Ref`)&&KT(e.$id)&&Cw(e.$ref)}function EE(e){return Z(e,`RegExp`)&&KT(e.$id)&&Cw(e.source)&&Cw(e.flags)&&WT(e.maxLength)&&WT(e.minLength)}function DE(e){return Z(e,`String`)&&e.type===`string`&&KT(e.$id)&&WT(e.minLength)&&WT(e.maxLength)&&qT(e.pattern)&&JT(e.format)}function OE(e){return Z(e,`Symbol`)&&e.type===`symbol`&&KT(e.$id)}function kE(e){return Z(e,`TemplateLiteral`)&&e.type===`string`&&Cw(e.pattern)&&e.pattern[0]===`^`&&e.pattern[e.pattern.length-1]===`$`}function AE(e){return Z(e,`This`)&&KT(e.$id)&&Cw(e.$ref)}function jE(e){return xw(e)&&qw in e}function ME(e){return Z(e,`Tuple`)&&e.type===`array`&&KT(e.$id)&&bw(e.minItems)&&bw(e.maxItems)&&e.minItems===e.maxItems&&(Ew(e.items)&&Ew(e.additionalItems)&&e.minItems===0||pw(e.items)&&e.items.every(e=>BE(e)))}function NE(e){return Z(e,`Undefined`)&&e.type===`undefined`&&KT(e.$id)}function PE(e){return Z(e,`Union`)&&KT(e.$id)&&xw(e)&&pw(e.anyOf)&&e.anyOf.every(e=>BE(e))}function FE(e){return Z(e,`Uint8Array`)&&e.type===`Uint8Array`&&KT(e.$id)&&WT(e.minByteLength)&&WT(e.maxByteLength)}function IE(e){return Z(e,`Unknown`)&&KT(e.$id)}function LE(e){return Z(e,`Unsafe`)}function RE(e){return Z(e,`Void`)&&e.type===`void`&&KT(e.$id)}function zE(e){return xw(e)&&Y in e&&Cw(e[Y])&&!zT.includes(e[Y])}function BE(e){return xw(e)&&(ZT(e)||QT(e)||$T(e)||nE(e)||tE(e)||eE(e)||rE(e)||iE(e)||aE(e)||oE(e)||sE(e)||lE(e)||uE(e)||mE(e)||gE(e)||_E(e)||vE(e)||yE(e)||bE(e)||xE(e)||SE(e)||CE(e)||wE(e)||TE(e)||EE(e)||DE(e)||OE(e)||kE(e)||AE(e)||ME(e)||NE(e)||PE(e)||FE(e)||IE(e)||LE(e)||RE(e)||zE(e))}var VE=`(true|false)`,HE=`(0|[1-9][0-9]*)`,UE=`(.*)`,WE=`(?!.*)`;`${VE}`;var GE=`^${HE}$`,KE=`^${UE}$`,qE=`^${WE}$`;function JE(e,t){return e.includes(t)}function YE(e){return[...new Set(e)]}function XE(e,t){return e.filter(e=>t.includes(e))}function ZE(e,t){return e.reduce((e,t)=>XE(e,t),t)}function QE(e){return e.length===1?e[0]:e.length>1?ZE(e.slice(1),e[0]):[]}function $E(e){let t=[];for(let n of e)t.push(...n);return t}function eD(e){return J({[Y]:`Any`},e)}function tD(e,t){return J({[Y]:`Array`,type:`array`,items:e},t)}function nD(e){return J({[Y]:`Argument`,index:e})}function rD(e,t){return J({[Y]:`AsyncIterator`,type:`AsyncIterator`,items:e},t)}function iD(e,t,n){return J({[Y]:`Computed`,target:e,parameters:t},n)}function aD(e,t){let{[t]:n,...r}=e;return r}function oD(e,t){return t.reduce((e,t)=>aD(e,t),e)}function sD(e){return J({[Y]:`Never`,not:{}},e)}function cD(e){return J({[Y]:`MappedResult`,properties:e})}function lD(e,t,n){return J({[Y]:`Constructor`,type:`Constructor`,parameters:e,returns:t},n)}function uD(e,t,n){return J({[Y]:`Function`,type:`Function`,parameters:e,returns:t},n)}function dD(e,t){return J({[Y]:`Union`,anyOf:e},t)}function fD(e){return e.some(e=>Qw(e))}function pD(e){return e.map(e=>Qw(e)?mD(e):e)}function mD(e){return oD(e,[Yw])}function hD(e,t){return fD(e)?tk(dD(pD(e),t)):dD(pD(e),t)}function gD(e,t){return e.length===1?J(e[0],t):e.length===0?sD(t):hD(e,t)}function _D(e,t){return e.length===0?sD(t):e.length===1?J(e[0],t):dD(e,t)}var vD=class extends Kw{};function yD(e){return e.replace(/\\\$/g,`$`).replace(/\\\*/g,`*`).replace(/\\\^/g,`^`).replace(/\\\|/g,`|`).replace(/\\\(/g,`(`).replace(/\\\)/g,`)`)}function bD(e,t,n){return e[t]===n&&e.charCodeAt(t-1)!==92}function xD(e,t){return bD(e,t,`(`)}function SD(e,t){return bD(e,t,`)`)}function CD(e,t){return bD(e,t,`|`)}function wD(e){if(!(xD(e,0)&&SD(e,e.length-1)))return!1;let t=0;for(let n=0;n<e.length;n++)if(xD(e,n)&&(t+=1),SD(e,n)&&--t,t===0&&n!==e.length-1)return!1;return!0}function TD(e){return e.slice(1,e.length-1)}function ED(e){let t=0;for(let n=0;n<e.length;n++)if(xD(e,n)&&(t+=1),SD(e,n)&&--t,CD(e,n)&&t===0)return!0;return!1}function DD(e){for(let t=0;t<e.length;t++)if(xD(e,t))return!0;return!1}function OD(e){let[t,n]=[0,0],r=[];for(let i=0;i<e.length;i++)if(xD(e,i)&&(t+=1),SD(e,i)&&--t,CD(e,i)&&t===0){let t=e.slice(n,i);t.length>0&&r.push(AD(t)),n=i+1}let i=e.slice(n);return i.length>0&&r.push(AD(i)),r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`or`,expr:r}}function kD(e){function t(e,t){if(!xD(e,t))throw new vD(`TemplateLiteralParser: Index must point to open parens`);let n=0;for(let r=t;r<e.length;r++)if(xD(e,r)&&(n+=1),SD(e,r)&&--n,n===0)return[t,r];throw new vD(`TemplateLiteralParser: Unclosed group parens in expression`)}function n(e,t){for(let n=t;n<e.length;n++)if(xD(e,n))return[t,n];return[t,e.length]}let r=[];for(let i=0;i<e.length;i++)if(xD(e,i)){let[n,a]=t(e,i),o=e.slice(n,a+1);r.push(AD(o)),i=a}else{let[t,a]=n(e,i),o=e.slice(t,a);o.length>0&&r.push(AD(o)),i=a-1}return r.length===0?{type:`const`,const:``}:r.length===1?r[0]:{type:`and`,expr:r}}function AD(e){return wD(e)?AD(TD(e)):ED(e)?OD(e):DD(e)?kD(e):{type:`const`,const:yD(e)}}function jD(e){return AD(e.slice(1,e.length-1))}var MD=class extends Kw{};function ND(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 PD(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 FD(e){return e.type===`const`&&e.const===`.*`}function ID(e){return ND(e)||FD(e)?!1:PD(e)?!0:e.type===`and`||e.type===`or`?e.expr.every(e=>ID(e)):e.type===`const`||(()=>{throw new MD(`Unknown expression type`)})()}function LD(e){return ID(jD(e.pattern))}var RD=class extends Kw{};function*zD(e){if(e.length===1)return yield*e[0];for(let t of e[0])for(let n of zD(e.slice(1)))yield`${t}${n}`}function*BD(e){return yield*zD(e.expr.map(e=>[...UD(e)]))}function*VD(e){for(let t of e.expr)yield*UD(t)}function*HD(e){return yield e.const}function*UD(e){return e.type===`and`?yield*BD(e):e.type===`or`?yield*VD(e):e.type===`const`?yield*HD(e):(()=>{throw new RD(`Unknown expression`)})()}function WD(e){let t=jD(e.pattern);return ID(t)?[...UD(t)]:[]}function GD(e,t){return J({[Y]:`Literal`,const:e,type:typeof e},t)}function KD(e){return J({[Y]:`Boolean`,type:`boolean`},e)}function qD(e){return J({[Y]:`BigInt`,type:`bigint`},e)}function JD(e){return J({[Y]:`Number`,type:`number`},e)}function YD(e){return J({[Y]:`String`,type:`string`},e)}function*XD(e){let t=e.trim().replace(/"|'/g,``);return t===`boolean`?yield KD():t===`number`?yield JD():t===`bigint`?yield qD():t===`string`?yield YD():yield(()=>{let e=t.split(`|`).map(e=>GD(e.trim()));return e.length===0?sD():e.length===1?e[0]:gD(e)})()}function*ZD(e){if(e[1]!==`{`)return yield*[GD(`$`),...QD(e.slice(1))];for(let t=2;t<e.length;t++)if(e[t]===`}`){let n=XD(e.slice(2,t)),r=QD(e.slice(t+1));return yield*[...n,...r]}yield GD(e)}function*QD(e){for(let t=0;t<e.length;t++)if(e[t]===`$`)return yield*[GD(e.slice(0,t)),...ZD(e.slice(t))];yield GD(e)}function $D(e){return[...QD(e)]}var eO=class extends Kw{};function tO(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function nO(e,t){return DT(e)?e.pattern.slice(1,e.pattern.length-1):MT(e)?`(${e.anyOf.map(e=>nO(e,t)).join(`|`)})`:yT(e)||lT(e)||rT(e)?`${t}${HE}`:TT(e)?`${t}${UE}`:pT(e)?`${t}${tO(e.const.toString())}`:iT(e)?`${t}${VE}`:(()=>{throw new eO(`Unexpected Kind '${e[Y]}'`)})()}function rO(e){return`^${e.map(e=>nO(e,``)).join(``)}$`}function iO(e){return gD(WD(e).map(e=>GD(e)))}function aO(e,t){let n=Cw(e)?rO($D(e)):rO(e);return J({[Y]:`TemplateLiteral`,type:`string`,pattern:n},t)}function oO(e){return WD(e).map(e=>e.toString())}function sO(e){let t=[];for(let n of e)t.push(...lO(n));return t}function cO(e){return[e.toString()]}function lO(e){return[...new Set(DT(e)?oO(e):MT(e)?sO(e.anyOf):pT(e)?cO(e.const):yT(e)||lT(e)?[`[number]`]:[])]}function uO(e,t,n){let r={};for(let i of Object.getOwnPropertyNames(t))r[i]=wO(e,lO(t[i]),n);return r}function dO(e,t,n){return uO(e,t.properties,n)}function fO(e,t,n){return cD(dO(e,t,n))}function pO(e,t){return e.map(e=>xO(e,t))}function mO(e){return e.filter(e=>!gT(e))}function hO(e,t){return uk(mO(pO(e,t)))}function gO(e){return e.some(e=>gT(e))?[]:e}function _O(e,t){return gD(gO(pO(e,t)))}function vO(e,t){return t in e?e[t]:t===`[number]`?gD(e):sD()}function yO(e,t){return t===`[number]`?e:sD()}function bO(e,t){return t in e?e[t]:sD()}function xO(e,t){return uT(e)?hO(e.allOf,t):MT(e)?_O(e.anyOf,t):AT(e)?vO(e.items??[],t):tT(e)?yO(e.items,t):bT(e)?bO(e.properties,t):sD()}function SO(e,t){return t.map(t=>xO(e,t))}function CO(e,t){return gD(SO(e,t))}function wO(e,t,n){if(CT(e)||CT(t)){if(!RT(e)||!RT(t))throw new Kw(`Index types using Ref parameters require both Type and Key to be of TSchema`);return iD(`Index`,[e,t])}return hT(t)?fO(e,t,n):mT(t)?OO(e,t,n):J(RT(t)?CO(e,lO(t)):CO(e,t),n)}function TO(e,t,n){return{[t]:wO(e,[t],Nw(n))}}function EO(e,t,n){return t.reduce((t,r)=>({...t,...TO(e,r,n)}),{})}function DO(e,t,n){return EO(e,t.keys,n)}function OO(e,t,n){return cD(DO(e,t,n))}function kO(e,t){return J({[Y]:`Iterator`,type:`Iterator`,items:e},t)}function AO(e){return globalThis.Object.keys(e).filter(t=>!Qw(e[t]))}function jO(e,t){let n=AO(e);return J(n.length>0?{[Y]:`Object`,type:`object`,required:n,properties:e}:{[Y]:`Object`,type:`object`,properties:e},t)}var MO=jO;function NO(e,t){return J({[Y]:`Promise`,type:`Promise`,item:e},t)}function PO(e){return J(oD(e,[Jw]))}function FO(e){return J({...e,[Jw]:`Readonly`})}function IO(e,t){return t===!1?PO(e):FO(e)}function LO(e,t){let n=t??!0;return hT(e)?BO(e,n):IO(e,n)}function RO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=LO(e[r],t);return n}function zO(e,t){return RO(e.properties,t)}function BO(e,t){return cD(zO(e,t))}function VO(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 HO(e,t){return e in t?YO(e,t[e]):cD(t)}function UO(e){return{[e]:GD(e)}}function WO(e){let t={};for(let n of e)t[n]=GD(n);return t}function GO(e,t){return JE(t,e)?UO(e):WO(t)}function KO(e,t){return HO(e,GO(e,t))}function qO(e,t){return t.map(t=>YO(e,t))}function JO(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(t))n[r]=YO(e,t[r]);return n}function YO(e,t){let n={...t};return Qw(t)?tk(YO(e,oD(t,[Yw]))):Zw(t)?LO(YO(e,oD(t,[Jw]))):hT(t)?HO(e,t.properties):mT(t)?KO(e,t.keys):oT(t)?lD(qO(e,t.parameters),YO(e,t.returns),n):cT(t)?uD(qO(e,t.parameters),YO(e,t.returns),n):nT(t)?rD(YO(e,t.items),n):dT(t)?kO(YO(e,t.items),n):uT(t)?dk(qO(e,t.allOf),n):MT(t)?_D(qO(e,t.anyOf),n):AT(t)?VO(qO(e,t.items??[]),n):bT(t)?MO(JO(e,t.properties),n):tT(t)?tD(YO(e,t.items),n):xT(t)?NO(YO(e,t.item),n):t}function XO(e,t){let n={};for(let r of e)n[r]=YO(r,t);return n}function ZO(e,t,n){let r=RT(e)?lO(e):e;return MO(XO(r,t({[Y]:`MappedKey`,keys:r})),n)}function QO(e){return J(oD(e,[Yw]))}function $O(e){return J({...e,[Yw]:`Optional`})}function ek(e,t){return t===!1?QO(e):$O(e)}function tk(e,t){let n=t??!0;return hT(e)?ik(e,n):ek(e,n)}function nk(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=tk(e[r],t);return n}function rk(e,t){return nk(e.properties,t)}function ik(e,t){return cD(rk(e,t))}function ak(e,t={}){let n=e.every(e=>bT(e)),r=RT(t.unevaluatedProperties)?{unevaluatedProperties:t.unevaluatedProperties}:{};return J(t.unevaluatedProperties===!1||RT(t.unevaluatedProperties)||n?{...r,[Y]:`Intersect`,type:`object`,allOf:e}:{...r,[Y]:`Intersect`,allOf:e},t)}function ok(e){return e.every(e=>Qw(e))}function sk(e){return oD(e,[Yw])}function ck(e){return e.map(e=>Qw(e)?sk(e):e)}function lk(e,t){return ok(e)?tk(ak(ck(e),t)):ak(ck(e),t)}function uk(e,t={}){if(e.length===1)return J(e[0],t);if(e.length===0)return sD(t);if(e.some(e=>kT(e)))throw Error(`Cannot intersect transform types`);return lk(e,t)}function dk(e,t){if(e.length===1)return J(e[0],t);if(e.length===0)return sD(t);if(e.some(e=>kT(e)))throw Error(`Cannot intersect transform types`);return ak(e,t)}function fk(...e){let[t,n]=typeof e[0]==`string`?[e[0],e[1]]:[e[0].$id,e[1]];if(typeof t!=`string`)throw new Kw(`Ref: $ref must be a string`);return J({[Y]:`Ref`,$ref:t},n)}function pk(e,t){return iD(`Awaited`,[iD(e,t)])}function mk(e){return iD(`Awaited`,[fk(e)])}function hk(e){return dk(vk(e))}function gk(e){return _D(vk(e))}function _k(e){return yk(e)}function vk(e){return e.map(e=>yk(e))}function yk(e,t){return J(aT(e)?pk(e.target,e.parameters):uT(e)?hk(e.allOf):MT(e)?gk(e.anyOf):xT(e)?_k(e.item):CT(e)?mk(e.$ref):e,t)}function bk(e){let t=[];for(let n of e)t.push(Dk(n));return t}function xk(e){return $E(bk(e))}function Sk(e){return QE(bk(e))}function Ck(e){return e.map((e,t)=>t.toString())}function wk(e){return[`[number]`]}function Tk(e){return globalThis.Object.getOwnPropertyNames(e)}function Ek(e){return Ok?globalThis.Object.getOwnPropertyNames(e).map(e=>e[0]===`^`&&e[e.length-1]===`$`?e.slice(1,e.length-1):e):[]}function Dk(e){return uT(e)?xk(e.allOf):MT(e)?Sk(e.anyOf):AT(e)?Ck(e.items??[]):tT(e)?wk(e.items):bT(e)?Tk(e.properties):ST(e)?Ek(e.patternProperties):[]}var Ok=!1;function kk(e,t){return iD(`KeyOf`,[iD(e,t)])}function Ak(e){return iD(`KeyOf`,[fk(e)])}function jk(e,t){return J(gD(Mk(Dk(e))),t)}function Mk(e){return e.map(e=>e===`[number]`?JD():GD(e))}function Nk(e,t){return aT(e)?kk(e.target,e.parameters):CT(e)?Ak(e.$ref):hT(e)?Ik(e,t):jk(e,t)}function Pk(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Nk(e[r],Nw(t));return n}function Fk(e,t){return Pk(e.properties,t)}function Ik(e,t){return cD(Fk(e,t))}function Lk(e){let t=[];for(let n of e)t.push(...Dk(n));return YE(t)}function Rk(e){return e.filter(e=>!gT(e))}function zk(e,t){let n=[];for(let r of e)n.push(...SO(r,[t]));return Rk(n)}function Bk(e,t){let n={};for(let r of t)n[r]=uk(zk(e,r));return n}function Vk(e,t){return MO(Bk(e,Lk(e)),t)}function Hk(e){return J({[Y]:`Date`,type:`Date`},e)}function Uk(e){return J({[Y]:`Null`,type:`null`},e)}function Wk(e){return J({[Y]:`Symbol`,type:`symbol`},e)}function Gk(e){return J({[Y]:`Undefined`,type:`undefined`},e)}function Kk(e){return J({[Y]:`Uint8Array`,type:`Uint8Array`},e)}function qk(e){return J({[Y]:`Unknown`},e)}function Jk(e){return e.map(e=>Zk(e,!1))}function Yk(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=LO(Zk(e[n],!1));return t}function Xk(e,t){return t===!0?e:LO(e)}function Zk(e,t){return fw(e)||vw(e)?Xk(eD(),t):pw(e)?LO(VO(Jk(e))):Tw(e)?Kk():gw(e)?Hk():xw(e)?Xk(MO(Yk(e)),t):_w(e)?Xk(uD([],qk()),t):Ew(e)?Gk():yw(e)?Uk():ww(e)?Wk():mw(e)?qD():bw(e)||hw(e)||Cw(e)?GD(e):MO({})}function Qk(e,t){return J(Zk(e,!0),t)}function $k(e,t){return oT(e)?VO(e.parameters,t):sD(t)}function eA(e,t){if(Ew(e))throw Error(`Enum undefined or empty`);let n=globalThis.Object.getOwnPropertyNames(e).filter(e=>isNaN(e)).map(t=>e[t]);return _D([...new Set(n)].map(e=>GD(e)),{...t,[Xw]:`Enum`})}var tA=class extends Kw{},Q;(function(e){e[e.Union=0]=`Union`,e[e.True=1]=`True`,e[e.False=2]=`False`})(Q||={});function nA(e){return e===Q.False?e:Q.True}function rA(e){throw new tA(e)}function iA(e){return vE(e)||lE(e)||PE(e)||IE(e)||ZT(e)}function aA(e,t){return vE(t)?CA(e,t):lE(t)?yA(e,t):PE(t)?oj(e,t):IE(t)?cj(e,t):ZT(t)?oA(e,t):rA(`StructuralRight`)}function oA(e,t){return Q.True}function sA(e,t){return lE(t)?yA(e,t):PE(t)&&t.anyOf.some(e=>ZT(e)||IE(e))?Q.True:PE(t)?Q.Union:IE(t)||ZT(t)?Q.True:Q.Union}function cA(e,t){return IE(e)?Q.False:ZT(e)?Q.Union:vE(e)?Q.True:Q.False}function lA(e,t){return SE(t)&&BA(t)?Q.True:iA(t)?aA(e,t):$T(t)?nA(fj(e.items,t.items)):Q.False}function uA(e,t){return iA(t)?aA(e,t):eE(t)?nA(fj(e.items,t.items)):Q.False}function dA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):tE(t)?Q.True:Q.False}function fA(e,t){return pE(e)||nE(e)?Q.True:Q.False}function pA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):nE(t)?Q.True:Q.False}function mA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):iE(t)?e.parameters.length>t.parameters.length?Q.False:e.parameters.every((e,n)=>nA(fj(t.parameters[n],e))===Q.True)?nA(fj(e.returns,t.returns)):Q.False:Q.False}function hA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):aE(t)?Q.True:Q.False}function gA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):oE(t)?e.parameters.length>t.parameters.length?Q.False:e.parameters.every((e,n)=>nA(fj(t.parameters[n],e))===Q.True)?nA(fj(e.returns,t.returns)):Q.False:Q.False}function _A(e,t){return mE(e)&&bw(e.const)||xE(e)||sE(e)?Q.True:Q.False}function vA(e,t){return sE(t)||xE(t)?Q.True:iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):Q.False}function yA(e,t){return t.allOf.every(t=>fj(e,t)===Q.True)?Q.True:Q.False}function bA(e,t){return e.allOf.some(e=>fj(e,t)===Q.True)?Q.True:Q.False}function xA(e,t){return iA(t)?aA(e,t):uE(t)?nA(fj(e.items,t.items)):Q.False}function SA(e,t){return mE(t)&&t.const===e.const?Q.True:iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):DE(t)?ZA(e,t):xE(t)?OA(e,t):sE(t)?_A(e,t):nE(t)?fA(e,t):Q.False}function CA(e,t){return Q.False}function wA(e,t){return Q.True}function TA(e){let[t,n]=[e,0];for(;yE(t);)t=t.not,n+=1;return n%2==0?t:qk()}function EA(e,t){return yE(e)?fj(TA(e),t):yE(t)?fj(e,TA(t)):rA(`Invalid fallthrough for Not`)}function DA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):bE(t)?Q.True:Q.False}function OA(e,t){return fE(e)||xE(e)||sE(e)?Q.True:Q.False}function kA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):sE(t)||xE(t)?Q.True:Q.False}function AA(e,t){return Object.getOwnPropertyNames(e.properties).length===t}function jA(e){return BA(e)}function MA(e){return AA(e,0)||AA(e,1)&&`description`in e.properties&&PE(e.properties.description)&&e.properties.description.anyOf.length===2&&(DE(e.properties.description.anyOf[0])&&NE(e.properties.description.anyOf[1])||DE(e.properties.description.anyOf[1])&&NE(e.properties.description.anyOf[0]))}function NA(e){return AA(e,0)}function PA(e){return AA(e,0)}function FA(e){return AA(e,0)}function IA(e){return AA(e,0)}function LA(e){return BA(e)}function RA(e){let t=JD();return AA(e,0)||AA(e,1)&&`length`in e.properties&&nA(fj(e.properties.length,t))===Q.True}function zA(e){return AA(e,0)}function BA(e){let t=JD();return AA(e,0)||AA(e,1)&&`length`in e.properties&&nA(fj(e.properties.length,t))===Q.True}function VA(e){let t=uD([eD()],eD());return AA(e,0)||AA(e,1)&&`then`in e.properties&&nA(fj(e.properties.then,t))===Q.True}function HA(e,t){return fj(e,t)===Q.False||XT(e)&&!XT(t)?Q.False:Q.True}function UA(e,t){return IE(e)?Q.False:ZT(e)?Q.Union:vE(e)||dE(e)&&jA(t)||fE(e)&&NA(t)||pE(e)&&PA(t)||OE(e)&&MA(t)||tE(e)&&FA(t)||DE(e)&&jA(t)||OE(e)&&MA(t)||xE(e)&&NA(t)||sE(e)&&NA(t)||nE(e)&&PA(t)||FE(e)&&LA(t)||aE(e)&&IA(t)||iE(e)&&zA(t)||oE(e)&&RA(t)?Q.True:wE(e)&&DE(KA(e))?t[Xw]===`Record`?Q.True:Q.False:wE(e)&&xE(KA(e))&&AA(t,0)?Q.True:Q.False}function WA(e,t){return iA(t)?aA(e,t):wE(t)?JA(e,t):SE(t)?(()=>{for(let n of Object.getOwnPropertyNames(t.properties)){if(!(n in e.properties)&&!XT(t.properties[n]))return Q.False;if(XT(t.properties[n]))return Q.True;if(HA(e.properties[n],t.properties[n])===Q.False)return Q.False}return Q.True})():Q.False}function GA(e,t){return iA(t)?aA(e,t):SE(t)&&VA(t)?Q.True:CE(t)?nA(fj(e.item,t.item)):Q.False}function KA(e){return GE in e.patternProperties?JD():KE in e.patternProperties?YD():rA(`Unknown record key pattern`)}function qA(e){return GE in e.patternProperties?e.patternProperties[GE]:KE in e.patternProperties?e.patternProperties[KE]:rA(`Unable to get record value schema`)}function JA(e,t){let[n,r]=[KA(t),qA(t)];return dE(e)&&xE(n)&&nA(fj(e,r))===Q.True?Q.True:FE(e)&&xE(n)||DE(e)&&xE(n)||$T(e)&&xE(n)?fj(e,r):SE(e)?(()=>{for(let t of Object.getOwnPropertyNames(e.properties))if(HA(r,e.properties[t])===Q.False)return Q.False;return Q.True})():Q.False}function YA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?fj(qA(e),qA(t)):Q.False}function XA(e,t){return fj(EE(e)?YD():e,EE(t)?YD():t)}function ZA(e,t){return mE(e)&&Cw(e.const)||DE(e)?Q.True:Q.False}function QA(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):DE(t)?Q.True:Q.False}function $A(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):OE(t)?Q.True:Q.False}function ej(e,t){return kE(e)?fj(iO(e),t):kE(t)?fj(e,iO(t)):rA(`Invalid fallthrough for TemplateLiteral`)}function tj(e,t){return $T(t)&&e.items!==void 0&&e.items.every(e=>fj(e,t.items)===Q.True)}function nj(e,t){return vE(e)?Q.True:IE(e)?Q.False:ZT(e)?Q.Union:Q.False}function rj(e,t){return iA(t)?aA(e,t):SE(t)&&BA(t)||$T(t)&&tj(e,t)?Q.True:ME(t)?Ew(e.items)&&!Ew(t.items)||!Ew(e.items)&&Ew(t.items)?Q.False:Ew(e.items)&&!Ew(t.items)||e.items.every((e,n)=>fj(e,t.items[n])===Q.True)?Q.True:Q.False:Q.False}function ij(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):FE(t)?Q.True:Q.False}function aj(e,t){return iA(t)?aA(e,t):SE(t)?UA(e,t):wE(t)?JA(e,t):RE(t)?uj(e,t):NE(t)?Q.True:Q.False}function oj(e,t){return t.anyOf.some(t=>fj(e,t)===Q.True)?Q.True:Q.False}function sj(e,t){return e.anyOf.every(e=>fj(e,t)===Q.True)?Q.True:Q.False}function cj(e,t){return Q.True}function lj(e,t){return vE(t)?CA(e,t):lE(t)?yA(e,t):PE(t)?oj(e,t):ZT(t)?oA(e,t):DE(t)?ZA(e,t):xE(t)?OA(e,t):sE(t)?_A(e,t):nE(t)?fA(e,t):$T(t)?cA(e,t):ME(t)?nj(e,t):SE(t)?UA(e,t):IE(t)?Q.True:Q.False}function uj(e,t){return NE(e)||NE(e)?Q.True:Q.False}function dj(e,t){return lE(t)?yA(e,t):PE(t)?oj(e,t):IE(t)?cj(e,t):ZT(t)?oA(e,t):SE(t)?UA(e,t):RE(t)?Q.True:Q.False}function fj(e,t){return kE(e)||kE(t)?ej(e,t):EE(e)||EE(t)?XA(e,t):yE(e)||yE(t)?EA(e,t):ZT(e)?sA(e,t):$T(e)?lA(e,t):tE(e)?dA(e,t):nE(e)?pA(e,t):eE(e)?uA(e,t):iE(e)?mA(e,t):aE(e)?hA(e,t):oE(e)?gA(e,t):sE(e)?vA(e,t):lE(e)?bA(e,t):uE(e)?xA(e,t):mE(e)?SA(e,t):vE(e)?wA(e,t):bE(e)?DA(e,t):xE(e)?kA(e,t):SE(e)?WA(e,t):wE(e)?YA(e,t):DE(e)?QA(e,t):OE(e)?$A(e,t):ME(e)?rj(e,t):CE(e)?GA(e,t):FE(e)?ij(e,t):NE(e)?aj(e,t):PE(e)?sj(e,t):IE(e)?lj(e,t):RE(e)?dj(e,t):rA(`Unknown left type operand '${e[Y]}'`)}function pj(e,t){return fj(e,t)}function mj(e,t,n,r,i){let a={};for(let o of globalThis.Object.getOwnPropertyNames(e))a[o]=vj(e[o],t,n,r,Nw(i));return a}function hj(e,t,n,r,i){return mj(e.properties,t,n,r,i)}function gj(e,t,n,r,i){return cD(hj(e,t,n,r,i))}function _j(e,t,n,r){let i=pj(e,t);return i===Q.Union?_D([n,r]):i===Q.True?n:r}function vj(e,t,n,r,i){return hT(e)?gj(e,t,n,r,i):mT(e)?J(Sj(e,t,n,r,i)):J(_j(e,t,n,r),i)}function yj(e,t,n,r,i){return{[e]:vj(GD(e),t,n,r,Nw(i))}}function bj(e,t,n,r,i){return e.reduce((e,a)=>({...e,...yj(a,t,n,r,i)}),{})}function xj(e,t,n,r,i){return bj(e.keys,t,n,r,i)}function Sj(e,t,n,r,i){return cD(xj(e,t,n,r,i))}function Cj(e,t){return Tj(iO(e),t)}function wj(e,t){let n=e.filter(e=>pj(e,t)===Q.False);return n.length===1?n[0]:_D(n)}function Tj(e,t,n={}){return DT(e)?J(Cj(e,t),n):hT(e)?J(Oj(e,t),n):J(MT(e)?wj(e.anyOf,t):pj(e,t)===Q.False?e:sD(),n)}function Ej(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=Tj(e[r],t);return n}function Dj(e,t){return Ej(e.properties,t)}function Oj(e,t){return cD(Dj(e,t))}function kj(e,t){return jj(iO(e),t)}function Aj(e,t){let n=e.filter(e=>pj(e,t)!==Q.False);return n.length===1?n[0]:_D(n)}function jj(e,t,n){return DT(e)?J(kj(e,t),n):hT(e)?J(Pj(e,t),n):J(MT(e)?Aj(e.anyOf,t):pj(e,t)===Q.False?sD():e,n)}function Mj(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=jj(e[r],t);return n}function Nj(e,t){return Mj(e.properties,t)}function Pj(e,t){return cD(Nj(e,t))}function Fj(e,t){return oT(e)?J(e.returns,t):sD(t)}function Ij(e){return LO(tk(e))}function Lj(e,t,n){return J({[Y]:`Record`,type:`object`,patternProperties:{[e]:t}},n)}function Rj(e,t,n){let r={};for(let n of e)r[n]=t;return MO(r,{...n,[Xw]:`Record`})}function zj(e,t,n){return LD(e)?Rj(lO(e),t,n):Lj(e.pattern,t,n)}function Bj(e,t,n){return Rj(lO(_D(e)),t,n)}function Vj(e,t,n){return Rj([e.toString()],t,n)}function Hj(e,t,n){return Lj(e.source,t,n)}function Uj(e,t,n){return Lj(Ew(e.pattern)?KE:e.pattern,t,n)}function Wj(e,t,n){return Lj(KE,t,n)}function Gj(e,t,n){return Lj(qE,t,n)}function Kj(e,t,n){return MO({true:t,false:t},n)}function qj(e,t,n){return Lj(GE,t,n)}function Jj(e,t,n){return Lj(GE,t,n)}function Yj(e,t,n={}){return MT(e)?Bj(e.anyOf,t,n):DT(e)?zj(e,t,n):pT(e)?Vj(e.const,t,n):iT(e)?Kj(e,t,n):lT(e)?qj(e,t,n):yT(e)?Jj(e,t,n):wT(e)?Hj(e,t,n):TT(e)?Uj(e,t,n):$w(e)?Wj(e,t,n):gT(e)?Gj(e,t,n):sD(n)}function Xj(e){return globalThis.Object.getOwnPropertyNames(e.patternProperties)[0]}function Zj(e){let t=Xj(e);return t===KE?YD():t===GE?JD():YD({pattern:t})}function Qj(e){return e.patternProperties[Xj(e)]}function $j(e,t){return t.parameters=pM(e,t.parameters),t.returns=mM(e,t.returns),t}function eM(e,t){return t.parameters=pM(e,t.parameters),t.returns=mM(e,t.returns),t}function tM(e,t){return t.allOf=pM(e,t.allOf),t}function nM(e,t){return t.anyOf=pM(e,t.anyOf),t}function rM(e,t){return Ew(t.items)||(t.items=pM(e,t.items)),t}function iM(e,t){return t.items=mM(e,t.items),t}function aM(e,t){return t.items=mM(e,t.items),t}function oM(e,t){return t.items=mM(e,t.items),t}function sM(e,t){return t.item=mM(e,t.item),t}function cM(e,t){let n=fM(e,t.properties);return{...t,...MO(n)}}function lM(e,t){let n=Yj(mM(e,Zj(t)),mM(e,Qj(t)));return{...t,...n}}function uM(e,t){return t.index in e?e[t.index]:qk()}function dM(e,t){let n=Zw(t),r=Qw(t),i=mM(e,t);return n&&r?Ij(i):n&&!r?LO(i):!n&&r?tk(i):i}function fM(e,t){return globalThis.Object.getOwnPropertyNames(t).reduce((n,r)=>({...n,[r]:dM(e,t[r])}),{})}function pM(e,t){return t.map(t=>mM(e,t))}function mM(e,t){return oT(t)?$j(e,t):cT(t)?eM(e,t):uT(t)?tM(e,t):MT(t)?nM(e,t):AT(t)?rM(e,t):tT(t)?iM(e,t):nT(t)?aM(e,t):dT(t)?oM(e,t):xT(t)?sM(e,t):bT(t)?cM(e,t):ST(t)?lM(e,t):eT(t)?uM(e,t):t}function hM(e,t){return mM(t,Pw(e))}function gM(e){return J({[Y]:`Integer`,type:`integer`},e)}function _M(e,t,n){return{[e]:OM(GD(e),t,Nw(n))}}function vM(e,t,n){return e.reduce((e,r)=>({...e,..._M(r,t,n)}),{})}function yM(e,t,n){return vM(e.keys,t,n)}function bM(e,t,n){return cD(yM(e,t,n))}function xM(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toLowerCase(),n].join(``)}function SM(e){let[t,n]=[e.slice(0,1),e.slice(1)];return[t.toUpperCase(),n].join(``)}function CM(e){return e.toUpperCase()}function wM(e){return e.toLowerCase()}function TM(e,t,n){let r=jD(e.pattern);return ID(r)?aO([_D(DM([...UD(r)].map(e=>GD(e)),t))],n):{...e,pattern:EM(e.pattern,t)}}function EM(e,t){return typeof e==`string`?t===`Uncapitalize`?xM(e):t===`Capitalize`?SM(e):t===`Uppercase`?CM(e):t===`Lowercase`?wM(e):e:e.toString()}function DM(e,t){return e.map(e=>OM(e,t))}function OM(e,t,n={}){return mT(e)?bM(e,t,n):DT(e)?TM(e,t,n):MT(e)?_D(DM(e.anyOf,t),n):pT(e)?GD(EM(e.const,t),n):J(e,n)}function kM(e,t={}){return OM(e,`Capitalize`,t)}function AM(e,t={}){return OM(e,`Lowercase`,t)}function jM(e,t={}){return OM(e,`Uncapitalize`,t)}function MM(e,t={}){return OM(e,`Uppercase`,t)}function NM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=UM(e[i],t,Nw(n));return r}function PM(e,t,n){return NM(e.properties,t,n)}function FM(e,t,n){return cD(PM(e,t,n))}function IM(e,t){return e.map(e=>HM(e,t))}function LM(e,t){return e.map(e=>HM(e,t))}function RM(e,t){let{[t]:n,...r}=e;return r}function zM(e,t){return t.reduce((e,t)=>RM(e,t),e)}function BM(e,t,n){let r=oD(e,[qw,`$id`,`required`,`properties`]);return MO(zM(n,t),r)}function VM(e){return _D(e.reduce((e,t)=>fT(t)?[...e,GD(t)]:e,[]))}function HM(e,t){return uT(e)?dk(IM(e.allOf,t)):MT(e)?_D(LM(e.anyOf,t)):bT(e)?BM(e,t,e.properties):MO({})}function UM(e,t,n){let r=pw(t)?VM(t):t,i=RT(t)?lO(t):t,a=CT(e),o=CT(t);return hT(e)?FM(e,i,n):mT(t)?qM(e,t,n):a&&o||!a&&o||a&&!o?iD(`Omit`,[e,r],n):J({...HM(e,i),...n})}function WM(e,t,n){return{[t]:UM(e,[t],Nw(n))}}function GM(e,t,n){return t.reduce((t,r)=>({...t,...WM(e,r,n)}),{})}function KM(e,t,n){return GM(e,t.keys,n)}function qM(e,t,n){return cD(KM(e,t,n))}function JM(e,t,n){let r={};for(let i of globalThis.Object.getOwnPropertyNames(e))r[i]=rN(e[i],t,Nw(n));return r}function YM(e,t,n){return JM(e.properties,t,n)}function XM(e,t,n){return cD(YM(e,t,n))}function ZM(e,t){return e.map(e=>nN(e,t))}function QM(e,t){return e.map(e=>nN(e,t))}function $M(e,t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function eN(e,t,n){let r=oD(e,[qw,`$id`,`required`,`properties`]);return MO($M(n,t),r)}function tN(e){return _D(e.reduce((e,t)=>fT(t)?[...e,GD(t)]:e,[]))}function nN(e,t){return uT(e)?dk(ZM(e.allOf,t)):MT(e)?_D(QM(e.anyOf,t)):bT(e)?eN(e,t,e.properties):MO({})}function rN(e,t,n){let r=pw(t)?tN(t):t,i=RT(t)?lO(t):t,a=CT(e),o=CT(t);return hT(e)?XM(e,i,n):mT(t)?sN(e,t,n):a&&o||!a&&o||a&&!o?iD(`Pick`,[e,r],n):J({...nN(e,i),...n})}function iN(e,t,n){return{[t]:rN(e,[t],Nw(n))}}function aN(e,t,n){return t.reduce((t,r)=>({...t,...iN(e,r,n)}),{})}function oN(e,t,n){return aN(e,t.keys,n)}function sN(e,t,n){return cD(oN(e,t,n))}function cN(e,t){return iD(`Partial`,[iD(e,t)])}function lN(e){return iD(`Partial`,[fk(e)])}function uN(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=tk(e[n]);return t}function dN(e,t){let n=oD(e,[qw,`$id`,`required`,`properties`]);return MO(uN(t),n)}function fN(e){return e.map(e=>pN(e))}function pN(e){return aT(e)?cN(e.target,e.parameters):CT(e)?lN(e.$ref):uT(e)?dk(fN(e.allOf)):MT(e)?_D(fN(e.anyOf)):bT(e)?dN(e,e.properties):rT(e)||iT(e)||lT(e)||pT(e)||vT(e)||yT(e)||TT(e)||ET(e)||jT(e)?e:MO({})}function mN(e,t){return hT(e)?_N(e,t):J({...pN(e),...t})}function hN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=mN(e[r],Nw(t));return n}function gN(e,t){return hN(e.properties,t)}function _N(e,t){return cD(gN(e,t))}function vN(e,t){return iD(`Required`,[iD(e,t)])}function yN(e){return iD(`Required`,[fk(e)])}function bN(e){let t={};for(let n of globalThis.Object.getOwnPropertyNames(e))t[n]=oD(e[n],[Yw]);return t}function xN(e,t){let n=oD(e,[qw,`$id`,`required`,`properties`]);return MO(bN(t),n)}function SN(e){return e.map(e=>CN(e))}function CN(e){return aT(e)?vN(e.target,e.parameters):CT(e)?yN(e.$ref):uT(e)?dk(SN(e.allOf)):MT(e)?_D(SN(e.anyOf)):bT(e)?xN(e,e.properties):rT(e)||iT(e)||lT(e)||pT(e)||vT(e)||yT(e)||TT(e)||ET(e)||jT(e)?e:MO({})}function wN(e,t){return hT(e)?DN(e,t):J({...CN(e),...t})}function TN(e,t){let n={};for(let r of globalThis.Object.getOwnPropertyNames(e))n[r]=wN(e[r],t);return n}function EN(e,t){return TN(e.properties,t)}function DN(e,t){return cD(EN(e,t))}function ON(e,t){return t.map(t=>CT(t)?kN(e,t.$ref):XN(e,t))}function kN(e,t){return t in e?CT(e[t])?kN(e,e[t].$ref):XN(e,e[t]):sD()}function AN(e){return yk(e[0])}function jN(e){return wO(e[0],e[1])}function MN(e){return Nk(e[0])}function NN(e){return mN(e[0])}function PN(e){return UM(e[0],e[1])}function FN(e){return rN(e[0],e[1])}function IN(e){return wN(e[0])}function LN(e,t,n){let r=ON(e,n);return t===`Awaited`?AN(r):t===`Index`?jN(r):t===`KeyOf`?MN(r):t===`Partial`?NN(r):t===`Omit`?PN(r):t===`Pick`?FN(r):t===`Required`?IN(r):sD()}function RN(e,t){return tD(XN(e,t))}function zN(e,t){return rD(XN(e,t))}function BN(e,t,n){return lD(YN(e,t),XN(e,n))}function VN(e,t,n){return uD(YN(e,t),XN(e,n))}function HN(e,t){return dk(YN(e,t))}function UN(e,t){return kO(XN(e,t))}function WN(e,t){return MO(globalThis.Object.keys(t).reduce((n,r)=>({...n,[r]:XN(e,t[r])}),{}))}function GN(e,t){let[n,r]=[XN(e,Qj(t)),Xj(t)],i=Pw(t);return i.patternProperties[r]=n,i}function KN(e,t){return CT(t)?{...kN(e,t.$ref),[qw]:t[qw]}:t}function qN(e,t){return VO(YN(e,t))}function JN(e,t){return _D(YN(e,t))}function YN(e,t){return t.map(t=>XN(e,t))}function XN(e,t){return Qw(t)?J(XN(e,oD(t,[Yw])),t):Zw(t)?J(XN(e,oD(t,[Jw])),t):kT(t)?J(KN(e,t),t):tT(t)?J(RN(e,t.items),t):nT(t)?J(zN(e,t.items),t):aT(t)?J(LN(e,t.target,t.parameters)):oT(t)?J(BN(e,t.parameters,t.returns),t):cT(t)?J(VN(e,t.parameters,t.returns),t):uT(t)?J(HN(e,t.allOf),t):dT(t)?J(UN(e,t.items),t):bT(t)?J(WN(e,t.properties),t):ST(t)?J(GN(e,t)):AT(t)?J(qN(e,t.items||[]),t):MT(t)?J(JN(e,t.anyOf),t):t}function ZN(e,t){return t in e?XN(e,e[t]):sD()}function QN(e){return globalThis.Object.getOwnPropertyNames(e).reduce((t,n)=>({...t,[n]:ZN(e,n)}),{})}var $N=class{constructor(e){let t=QN(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 eP(e){return new $N(e)}function tP(e,t){return J({[Y]:`Not`,not:e},t)}function nP(e,t){return cT(e)?VO(e.parameters,t):sD()}var rP=0;function iP(e,t={}){Ew(t.$id)&&(t.$id=`T${rP++}`);let n=Pw(e({[Y]:`This`,$ref:`${t.$id}`}));return n.$id=t.$id,J({[Xw]:`Recursive`,...n},t)}function aP(e,t){let n=Cw(e)?new globalThis.RegExp(e):e;return J({[Y]:`RegExp`,type:`RegExp`,source:n.source,flags:n.flags},t)}function oP(e){return uT(e)?e.allOf:MT(e)?e.anyOf:AT(e)?e.items??[]:[]}function sP(e){return oP(e)}function cP(e,t){return cT(e)?J(e.returns,t):sD(t)}var lP=class{constructor(e){this.schema=e}Decode(e){return new uP(this.schema,e)}},uP=class{constructor(e,t){this.schema=e,this.decode=t}EncodeTransform(e,t){let n={Encode:n=>t[qw].Encode(e(n)),Decode:e=>this.decode(t[qw].Decode(e))};return{...t,[qw]:n}}EncodeSchema(e,t){let n={Decode:this.decode,Encode:e};return{...t,[qw]:n}}Encode(e){return kT(this.schema)?this.EncodeTransform(e,this.schema):this.EncodeSchema(e,this.schema)}};function dP(e){return new lP(e)}function fP(e={}){return J({[Y]:e[Y]??`Unsafe`},e)}function pP(e){return J({[Y]:`Void`,type:`void`},e)}var $=t({Any:()=>eD,Argument:()=>nD,Array:()=>tD,AsyncIterator:()=>rD,Awaited:()=>yk,BigInt:()=>qD,Boolean:()=>KD,Capitalize:()=>kM,Composite:()=>Vk,Const:()=>Qk,Constructor:()=>lD,ConstructorParameters:()=>$k,Date:()=>Hk,Enum:()=>eA,Exclude:()=>Tj,Extends:()=>vj,Extract:()=>jj,Function:()=>uD,Index:()=>wO,InstanceType:()=>Fj,Instantiate:()=>hM,Integer:()=>gM,Intersect:()=>dk,Iterator:()=>kO,KeyOf:()=>Nk,Literal:()=>GD,Lowercase:()=>AM,Mapped:()=>ZO,Module:()=>eP,Never:()=>sD,Not:()=>tP,Null:()=>Uk,Number:()=>JD,Object:()=>MO,Omit:()=>UM,Optional:()=>tk,Parameters:()=>nP,Partial:()=>mN,Pick:()=>rN,Promise:()=>NO,Readonly:()=>LO,ReadonlyOptional:()=>Ij,Record:()=>Yj,Recursive:()=>iP,Ref:()=>fk,RegExp:()=>aP,Required:()=>wN,Rest:()=>sP,ReturnType:()=>cP,String:()=>YD,Symbol:()=>Wk,TemplateLiteral:()=>aO,Transform:()=>dP,Tuple:()=>VO,Uint8Array:()=>Kk,Uncapitalize:()=>jM,Undefined:()=>Gk,Union:()=>_D,Unknown:()=>qk,Unsafe:()=>fP,Uppercase:()=>MM,Void:()=>pP}),mP={additionalProperties:!1},hP=$.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}),gP=$.String({pattern:`^[a-z0-9][a-z0-9-]{0,31}(?![\\s\\S])`,minLength:1,maxLength:32}),_P=$.String({pattern:`^sha256:[0-9a-f]{64}$`,minLength:71,maxLength:71}),vP=$.String({pattern:`^[A-Za-z0-9_-]{43}$`,minLength:43,maxLength:43}),yP=$.String({pattern:`^dpt_[A-Za-z0-9_-]{43}$`,minLength:47,maxLength:47}),bP=`[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}`,xP=`^(?:${bP}|[A-Z2-7]{12}|[A-Z2-7]{8})(?![\\s\\S])`,SP=$.String({pattern:xP,minLength:8,maxLength:36}),CP=new RegExp(xP),wP=/^[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 TP(e){return typeof e!=`string`||e.length>36?!1:CP.test(e)}function EP(e){if(typeof e!=`string`)return;if(wP.test(e)){let t=e.toLowerCase();return TP(t)?t:void 0}let t=e.replace(/[\s-]+/g,``).toUpperCase();if(TP(t)&&!(/[\s-]/.test(e)&&t.length!==12))return t}$.Object({type:$.Literal(`pair.request`),v:$.Literal(1),requestId:hP,code:SP,deviceUid:hP,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:_P,clientTime:$.Integer(),hubNonce:$.Optional(vP)},mP),$.Object({type:$.Literal(`pair.device-request`),v:$.Literal(1),requestId:hP,deviceUid:hP,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:_P,clientTime:$.Integer(),hubNonce:$.Optional(vP)},mP);var DP=$.Object({type:$.Literal(`pair.challenge`),v:$.Literal(1),enrollmentId:hP,nonce:vP,issuedAt:$.Integer(),hubId:hP,hubPublicKey:$.Optional($.String({minLength:1,maxLength:256})),hubKeyFingerprint:$.Optional(_P),hubSignature:$.Optional($.String({pattern:`^[A-Za-z0-9_-]{86}$`,minLength:86,maxLength:86}))},mP);$.Object({type:$.Literal(`pair.device-ack`),v:$.Literal(1),codeId:hP,code:SP,expiresAt:$.Integer(),hubOrigin:$.String(),hubId:hP,challenge:DP},mP),$.Object({type:$.Literal(`pair.response`),v:$.Literal(1),enrollmentId:hP,nonce:vP,signature:$.String({pattern:`^[A-Za-z0-9_-]{86}$`,minLength:86,maxLength:86})},mP),$.Object({type:$.Literal(`pair.pending`),v:$.Literal(1),enrollmentId:hP,state:$.Literal(`awaiting_approval`),expiresAt:$.Integer(),pollAfterMs:$.Integer({minimum:1})},mP),$.Object({type:$.Literal(`pair.token`),v:$.Literal(1),enrollmentId:hP,deviceUid:hP,deviceId:gP,pairingEpoch:hP,credentialId:hP,generation:$.Integer({minimum:1}),hubId:hP,hubOrigin:$.String(),hubUrl:$.String(),tunnelToken:yP,issuedAt:$.Integer(),expiresAt:$.Null(),hubKeyFingerprint:$.Optional(_P)},mP),$.Object({enrollmentId:hP,deviceUid:hP,keyFingerprint:_P,replaceKey:$.Optional($.Boolean())},mP),$.Object({type:$.Literal(`pair.revoke`),v:$.Literal(1),deviceId:gP,pairingEpoch:hP,reason:$.Union([$.Literal(`user`),$.Literal(`compromise`),$.Literal(`hub_migrated`)]),revokedAt:$.Integer()},mP);var OP=$.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}))},mP);$.Object({type:$.Literal(`pair.code`),v:$.Literal(1),codeId:hP,code:SP,expiresAt:$.Integer(),hubOrigin:$.String({maxLength:2048}),pairUrl:$.String({maxLength:4096}),offerUrl:$.Optional($.String({maxLength:2048}))},mP);var kP=$.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:hP,expiresAt:$.Integer(),phase:kP,enrollment:$.Optional($.Object({enrollmentId:hP,deviceUid:hP,deviceName:$.String({minLength:1,maxLength:64}),keyFingerprint:_P,proofVerified:$.Boolean(),keyChanged:$.Boolean()},mP)),deviceId:$.Optional(gP),error:$.Optional(OP)},mP);function AP(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 jP(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 MP=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,NP=RegExp(`^${bP}$`),PP=/^sha256:[0-9a-f]{64}$/;function FP(e){let t=jP(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=AP(r.hub);if(a.ok&&a.origin===r.hub&&typeof r.id==`string`&&MP.test(r.id)&&typeof r.code==`string`&&NP.test(r.code)&&typeof r.exp==`number`&&Number.isSafeInteger(r.exp))return r.v===3?typeof r.kfp!=`string`||!PP.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 IP(e,t=Date.now()){let n=FP(e);if(n&&!(n.exp<t-3e4)&&!(n.exp>t+6e5))return n}function LP(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=IP(n.hash.slice(7),t);if(r&&r.hub===n.origin)return{offer:r,rest:`${n.origin}/pair`}}function RP(e){if(!/^\/pair\/?$/.test(e.pathname))return;if(e.hash.startsWith(`#offer=`)){let t=LP(e.href);if(t)return{code:t.offer.code,origin:e.origin,offerFragment:e.hash.slice(1)};let n=IP(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:EP(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 zP=e=>/^\/pair\/?$/.test(e.pathname)?`/`:void 0,BP=e=>/^\/pair\/?$/.test(e.pathname)&&RP(e)===void 0?`/`:void 0,VP=4e3;async function HP(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 UP={class:`modal pair-wizard`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`pair-title`},WP={key:1,class:`pair-pending`,"aria-label":`Machines waiting for approval`},GP={class:`who`},KP={key:0,class:`muted`},qP={key:1,class:`muted`},JP={class:`fp`},YP={class:`row`},XP={class:`phase`},ZP=[`onClick`],QP={key:2,class:`hint`},$P={class:`pair-steps`,"aria-label":`Pairing progress`},eF={class:`pair-grid`},tF={class:`pair-code-box`},nF={class:`pair-code`,"aria-label":`Pairing code`},rF={class:`pair-copy-actions`},iF=[`innerHTML`],aF={class:`pair-side`},oF={key:0,class:`hint`},sF={class:`pair-fingerprint`},cF={class:`fp`},lF={class:`pair-confirm`},uF={key:0,class:`pair-confirm warn`},dF=[`disabled`],fF=[`disabled`],pF={class:`hint`},mF=[`disabled`],hF={key:5,class:`error`,role:`alert`},gF={key:4},_F={class:`error`,role:`alert`},vF=Or({__name:`PairDeviceWizard`,props:{handoff:{}},emits:[`close`],setup(e,{expose:t,emit:n}){let r=n,i=e,a=k(`boot`),o=k(),s=k(),c=k(),l=k(``),u=k(!1),d=k(!1),f=k(!1),p=k(!1),m=k(!1),h=k(!1),g=k(),_=k([]),v=V(()=>{let e=s.value?.code??``;return!TP(e)||e.includes(`-`)?e:(e.match(/.{4}/g)??[]).join(`-`)}),y=V(()=>s.value?Av(s.value):``),b=V(()=>y.value?iw(y.value,148):``),ee=V(()=>c.value?.enrollment?.keyFingerprint??``),x=V(()=>c.value?.deviceId??``);j(x,e=>{g.value?.(),e&&(g.value=j(()=>lu.devices.value.find(t=>t.id===e)?.status,e=>{e===`online`&&(G(`Device paired and online.`),g.value?.(),g.value=void 0)},{immediate:!0}))});async function S(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=Nv();o.value=t;try{let n=e?await jv.resolveCode(e):await jv.createCode();if(t.closed()){await jv.cancel(n.codeId).catch(()=>{G(`The late pairing code could not be cancelled. Check device credentials before retrying.`)});return}if(s.value=n,a.value=`code`,e){let e=zP(new URL(window.location.href));e&&window.history.replaceState(window.history.state,``,e)}Iv(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 te(){let e=c.value,t=o.value;if(e?.enrollment&&t&&!u.value){u.value=!0,l.value=``;try{let t=await jv.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 ne(e){if(!s.value)return`cancelled`;try{let t=await jv.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 Fl&&e.status===409&&String(e.code)===`already_issued`){let e=await jv.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 re=()=>ne(!1),ie=()=>[`issued`,`connected`,`cancelled`,`expired`].includes(c.value?.phase??``);async function ae(){let e=x.value;if(e){u.value=!0;try{await jv.revoke(e,`user`),G(`Issued credential revoked.`),r(`close`)}catch(e){l.value=e instanceof Error?e.message:String(e)}finally{u.value=!1}}}async function oe(){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 se(){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 ce(){if(!d.value){d.value=!0,u.value=!0;try{let e=await HP({needsCancel:!!s.value&&!ie(),cancel:re,timeoutMs:VP});if(!e.closed)return;o.value?.close(),g.value?.(),e.confirmed||G(`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:ce});let le;async function ue(){try{_.value=(await jv.pending()).codes}catch{}}async function de(e){s.value=void 0,c.value=void 0,l.value=``;let t=Nv();o.value=t,a.value=e.phase===`approved_ready`?`approve`:`proof`,Iv(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 Ur(()=>{if(ue(),le=setInterval(()=>void ue(),3e3),i.handoff&&`error`in i.handoff){l.value=i.handoff.error,a.value=`expired`;return}S(i.handoff?.code)}),Kr(()=>{clearInterval(le);let e=o.value;e&&!e.closed()&&s.value&&!ie()&&ne(!0).then(e=>{e!==`cancelled`&&G(`Pairing cancellation was not confirmed. Check device credentials before retrying.`)}),e?.close(),g.value?.()}),(e,t)=>(P(),F(`div`,{class:`modal-backdrop`,onClick:js(ce,[`self`])},[L(`div`,UP,[L(`header`,null,[t[5]||=L(`h2`,{id:`pair-title`},`Pair a device`,-1),L(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close dialog`,onClick:ce},[R(A(ol),{size:18})])]),i.handoff&&`offerFragment`in i.handoff&&i.handoff.offerFragment?(P(),I(dw,{key:0,"offer-fragment":i.handoff.offerFragment},null,8,[`offer-fragment`])):B(``,!0),_.value.length?(P(),F(`section`,WP,[t[6]||=L(`h3`,null,`Machines waiting for you`,-1),L(`ul`,null,[(P(!0),F(N,null,M(_.value,e=>(P(),F(`li`,{key:e.codeId},[L(`div`,GP,[L(`strong`,null,E(e.deviceName??`unnamed device`),1),e.hostname?(P(),F(`span`,KP,E(e.hostname),1)):B(``,!0),e.platform?(P(),F(`span`,qP,E(e.platform),1)):B(``,!0)]),L(`div`,JP,E(e.keyFingerprint),1),L(`div`,YP,[L(`span`,XP,E(e.phase.replaceAll(`_`,` `)),1),L(`button`,{type:`button`,class:`small`,onClick:t=>de(e)},`Review`,8,ZP)])]))),128))]),t[7]||=L(`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)])):B(``,!0),a.value===`boot`?(P(),F(`p`,QP,`Minting a pairing code…`)):s.value?(P(),F(N,{key:3},[L(`ol`,$P,[t[8]||=L(`li`,{class:w({on:!0})},`Code`,-1),L(`li`,{class:w({on:[`proof`,`approve`,`issued`].includes(a.value)})},`Proof`,2),L(`li`,{class:w({on:[`approve`,`issued`].includes(a.value)})},`Fingerprint`,2),L(`li`,{class:w({on:a.value===`issued`})},`Online`,2)]),L(`div`,eF,[L(`div`,tF,[L(`div`,nF,E(v.value),1),L(`div`,rF,[L(`button`,{type:`button`,class:`small`,onClick:oe},[R(A(oc),{size:14}),z(` `+E(m.value?`Copied`:`Copy code`),1)]),L(`button`,{type:`button`,class:`small`,onClick:se,title:`Self-contained link: hub, code and expiry all in the fragment — it never reaches server logs`},[R(A(oc),{size:14}),z(` `+E(h.value?`Copied link`:`Copy link`),1)])]),t[9]||=L(`p`,{class:`hint`},` Run the device pairing command and scan, or enter this code on the device. Expires in 5 minutes. `,-1),L(`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,iF)]),L(`div`,aF,[a.value===`code`||a.value===`proof`?(P(),F(`p`,oF,[R(A(Wc),{size:14,class:`spin`}),t[10]||=z(` Waiting for the device to submit its signing proof… `,-1)])):a.value===`approve`?(P(),F(N,{key:1},[L(`div`,sF,[t[11]||=L(`h3`,null,`Device key fingerprint`,-1),L(`code`,cF,E(ee.value),1),t[12]||=L(`p`,{class:`hint`},` Compare ALL 64 hex characters with the fingerprint shown on the device screen. `,-1)]),L(`label`,lF,[Un(L(`input`,{"onUpdate:modelValue":t[0]||=e=>f.value=e,type:`checkbox`},null,512),[[Ss,f.value]]),t[13]||=z(` The fingerprint matches the device display exactly `,-1)]),c.value?.enrollment?.keyChanged?(P(),F(`label`,uF,[Un(L(`input`,{"onUpdate:modelValue":t[1]||=e=>p.value=e,type:`checkbox`},null,512),[[Ss,p.value]]),R(A(qc),{size:14}),t[14]||=z(` Device is already paired with a DIFFERENT key — replace the stored key (replaceKey) `,-1)])):B(``,!0),L(`button`,{type:`button`,class:`primary`,disabled:!f.value||u.value||c.value?.enrollment?.keyChanged===!0&&!p.value,onClick:te},` Approve device `,8,dF),L(`button`,{type:`button`,class:`small`,disabled:u.value,onClick:re},` Cancel pairing `,8,fF)],64)):a.value===`issued`?(P(),F(N,{key:2},[L(`p`,pF,[R(A(rc),{size:14}),t[15]||=z(` Credential issued. The device is connecting through the tunnel — you will get a toast once the monitor probe reports it online. `,-1)]),L(`button`,{type:`button`,class:`small`,onClick:ce},`Close`),L(`button`,{type:`button`,class:`small danger`,disabled:!x.value||u.value,title:`Mistaken approval? Revoke the credential now.`,onClick:ae},` Revoke this credential `,8,mF)],64)):a.value===`cancelled`?(P(),F(N,{key:3},[t[16]||=L(`p`,{class:`hint`},`Pairing was cancelled (or the signature failed too many times).`,-1),L(`button`,{type:`button`,class:`small`,onClick:t[2]||=e=>S()},`Start over`)],64)):a.value===`expired`?(P(),F(N,{key:4},[t[17]||=L(`p`,{class:`hint`},`The pairing code expired.`,-1),L(`button`,{type:`button`,class:`small`,onClick:t[3]||=e=>S()},`New code`)],64)):B(``,!0),l.value?(P(),F(`p`,hF,E(l.value),1)):B(``,!0)])])],64)):(P(),F(`div`,gF,[L(`p`,_F,E(l.value||`This pairing link is unavailable.`),1),L(`button`,{type:`button`,class:`small`,onClick:t[4]||=e=>S()},`New code`)]))])]))}}),yF={class:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`device-credentials-title`},bF={class:`hint`},xF={key:1,class:`hint`},SF=Or({__name:`DeviceCredentialsDialog`,props:{deviceId:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=V(()=>lu.devices.value.find(e=>e.id===n.deviceId));return(e,t)=>(P(),F(`div`,{class:`modal-backdrop`,onClick:t[2]||=js(e=>r(`close`),[`self`])},[L(`section`,yF,[L(`header`,null,[t[3]||=L(`h2`,{id:`device-credentials-title`},`Device credentials`,-1),L(`button`,{class:`icon-button`,"aria-label":`Close device credentials`,onClick:t[0]||=e=>r(`close`)},[R(A(ol),{size:18})])]),i.value?(P(),F(N,{key:0},[L(`p`,null,[z(E(i.value.name)+` `,1),L(`code`,null,E(i.value.id),1)]),L(`p`,bF,E(i.value.status)+` · tunnel `+E(i.value.tunnel?.state??`disconnected`)+` · `+E(i.value.tunnel?.readerCount??0)+` readers `,1),R(Gv,{device:i.value},null,8,[`device`])],64)):(P(),F(`p`,xF,`This device is no longer in the registry.`)),L(`footer`,null,[L(`button`,{class:`secondary`,onClick:t[1]||=e=>r(`close`)},`Close`)])])]))}}),CF={id:`prompt-title`},wF=[`disabled`],TF={key:0,class:`hint`},EF={key:1},DF={key:0,class:`muted`},OF=[`placeholder`,`disabled`],kF=[`required`,`placeholder`,`aria-label`,`disabled`],AF={key:2,class:`message-error`,role:`alert`},jF=[`disabled`],MF=[`disabled`],NF=Or({__name:`PromptDialog`,props:{dialog:{}},emits:[`close`],setup(e,{emit:t}){let n=e,r=t,i=k(n.dialog.value??``),a=k(!1),o=k(``),s=k(),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 Ur(()=>void An(()=>(s.value?.focus(),s.value?.select()))),(t,n)=>(P(),F(`div`,{class:`modal-backdrop`,onClick:n[4]||=js(e=>!a.value&&r(`close`),[`self`])},[L(`form`,{class:`modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`prompt-title`,onSubmit:js(l,[`prevent`])},[L(`header`,null,[L(`h2`,CF,E(e.dialog.title),1),L(`button`,{type:`button`,class:`icon-button`,"aria-label":`Close dialog`,disabled:a.value,onClick:n[0]||=e=>r(`close`)},[R(A(ol),{size:18})],8,wF)]),e.dialog.hint?(P(),F(`p`,TF,E(e.dialog.hint),1)):B(``,!0),c?(P(),F(`label`,EF,[z(E(e.dialog.label)+` `,1),e.dialog.optional?(P(),F(`span`,DF,`(optional)`)):B(``,!0),e.dialog.multiline?Un((P(),F(`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,OF)),[[xs,i.value]]):Un((P(),F(`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,kF)),[[xs,i.value]])])):B(``,!0),o.value?(P(),F(`p`,AF,E(o.value),1)):B(``,!0),L(`footer`,null,[L(`button`,{type:`button`,class:`secondary`,disabled:a.value,onClick:n[3]||=e=>r(`close`)},` Cancel `,8,jF),L(`button`,{class:w([`primary`,{danger:e.dialog.danger}]),disabled:a.value||c&&!e.dialog.optional&&!i.value.trim()},E(a.value?`Working…`:e.dialog.submit),11,MF)])],32)]))}}),PF={class:`modal model-modal`},FF={class:`eyebrow`},IF={class:`model-list`},LF=[`onClick`],RF=[`src`],zF={class:`hint`},BF=Or({__name:`ModelPicker`,emits:[`close`],setup(e,{emit:t}){let n=t,r=k(``),i=V(()=>Mu.value.filter(e=>`${e.name} ${e.id} ${e.tier}`.toLowerCase().includes(r.value.toLowerCase()))),a=e=>e.id===Nu.value.agent.model?.modelId&&e.provider===Nu.value.agent.model?.provider;async function o(e){await Wu(()=>Cu.value.configure({model:{provider:e.provider,modelId:e.id}}))&&(await Hu(),G(`Model saved. Used on the next turn.`),n(`close`))}return(e,t)=>(P(),F(`div`,{class:`modal-backdrop`,onClick:t[2]||=js(e=>n(`close`),[`self`])},[L(`section`,PF,[L(`header`,null,[L(`div`,null,[L(`span`,FF,`PER AGENT · `+E(A(gu)?.id),1),t[3]||=L(`h2`,null,`Choose a model`,-1)]),L(`button`,{class:`icon-button`,"aria-label":`Close model picker`,onClick:t[0]||=e=>n(`close`)},[R(A(ol),{size:18})])]),Un(L(`input`,{"onUpdate:modelValue":t[1]||=e=>r.value=e,placeholder:`Search models or tiers…`,"aria-label":`Search models`},null,512),[[xs,r.value]]),L(`div`,IF,[(P(!0),F(N,null,M(i.value,e=>(P(),F(`button`,{key:`${e.provider}/${e.id}`,class:w({selected:a(e)}),onClick:t=>o(e)},[L(`img`,{src:A(Ju)(e.id),alt:``},null,8,RF),L(`div`,null,[L(`strong`,null,E(e.name),1),L(`small`,null,E(e.tier)+` / `+E(e.provider)+` / `+E(A(Ku)(e.contextWindow))+` context`,1)]),a(e)?(P(),I(A(ec),{key:0,size:18})):B(``,!0)],10,LF))),128))]),L(`p`,zF,`Models available on `+E(A(gu)?.id)+`. Provider keys stay on the device.`,1)])]))}}),VF={class:`dialog`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`help-title`},HF={class:`dialog-head`},UF={class:`dialog-body`},WF={class:`n`},GF={class:`body`},KF={class:`help-callout`},qF={class:`dialog-foot`},JF={class:`right`},YF=Or({__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)=>(P(),F(`div`,{class:`scrim`,onClick:n[2]||=js(e=>A(W).dialog=void 0,[`self`])},[L(`section`,VF,[L(`div`,HF,[n[3]||=L(`div`,null,[L(`span`,{class:`dialog-eyebrow`},`LEARN BY DOING`),L(`h3`,{id:`help-title`},`What makes this durable?`)],-1),L(`button`,{class:`icon-button`,"aria-label":`Close help`,onClick:n[0]||=e=>A(W).dialog=void 0},[R(A(ol),{size:18})])]),L(`div`,UF,[(P(),F(N,null,M(t,(e,t)=>L(`div`,{key:e.title,class:`help-step`},[L(`span`,WF,E(String(t+1).padStart(2,`0`)),1),L(`div`,null,[L(`b`,null,E(e.title),1),L(`div`,GF,E(e.body),1)])])),64)),L(`div`,KF,[R(A(Sc),{size:18}),n[4]||=L(`span`,null,`Durable does not mean exactly-once external effects. Checkpoints protect progress. Tools still need their own idempotency.`,-1)])]),L(`div`,qF,[L(`div`,JF,[L(`button`,{class:`secondary`,type:`button`,onClick:n[1]||=e=>A(W).dialog=void 0},`Close`)])])])]))}}),XF=Gt({needed:!1,busy:!1,error:``}),ZF=new Set,QF=e=>{let t=[...ZF];ZF=new Set;for(let n of t)n(e)},$F=()=>new Promise(e=>ZF.add(e));async function eI(e){if(XF.busy||!e)return!1;XF.busy=!0,XF.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?(XF.needed=!1,QF(!0),!0):(XF.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 XF.error=`Cannot reach the hub.`,!1}finally{XF.busy=!1}}var tI=e=>{try{return new URL(e,location.href).pathname===`/api/session`}catch{return e===`/api/session`}};function nI(e){return(async(t,n)=>{let r=()=>e(t,n),i=await r();if(i.status!==401||tI(typeof t==`string`?t:t instanceof URL?t.href:t.url)||n?.body instanceof ReadableStream)return i;XF.needed=!0;let a=await i.text().catch(()=>``);return await $F()?r():new Response(a,{status:i.status,headers:i.headers})})}function rI(){typeof window>`u`||window.__adminFetch||(window.__adminFetch=!0,window.fetch=nI(window.fetch.bind(window)))}var iI={class:`login-veil`,"data-testid":`login-card`},aI=[`disabled`],oI={key:0,class:`message-error`,role:`alert`},sI=[`disabled`],cI=Or({__name:`LoginCard`,setup(e){let t=k(``),n=k();async function r(){if(XF.busy||!t.value.trim())return;let e=await eI(t.value.trim());t.value=``,e&&n.value?.blur()}return Ur(()=>void An(()=>n.value?.focus())),(e,i)=>(P(),F(`div`,iI,[L(`form`,{class:`modal login-card`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`login-title`,onSubmit:js(r,[`prevent`])},[i[2]||=L(`header`,null,[L(`h2`,{id:`login-title`},`Admin token`)],-1),i[3]||=L(`p`,{class:`hint`},[z(` This hub is locked. Sign in with the token from its `),L(`code`,null,`admin.token`),z(` file. `)],-1),i[4]||=L(`label`,{for:`admin-token`},`Admin token`,-1),Un(L(`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:A(XF).busy,onKeydown:i[1]||=Ns(e=>A(XF).error=``,[`esc`])},null,40,aI),[[xs,t.value]]),A(XF).error?(P(),F(`p`,oI,E(A(XF).error),1)):B(``,!0),L(`footer`,null,[L(`button`,{class:`primary`,type:`submit`,disabled:A(XF).busy||!t.value.trim()},E(A(XF).busy?`Checking…`:`Sign in`),9,sI)])],32)]))}}),lI={key:0,class:`toast`,role:`status`},uI=Or({__name:`Toast`,setup(e){return(e,t)=>(P(),I(So,{name:`toast`},{default:Hn(()=>[A(W).toast?(P(),F(`div`,lI,[R(A(ec),{size:18}),z(E(A(W).toast),1)])):B(``,!0)]),_:1}))}}),dI={class:`shell`,"data-testid":`app-shell`},fI={key:0,class:`error-banner`,role:`alert`},pI={key:4,class:`welcome`,"data-testid":`welcome-empty`},mI=[`disabled`],hI={class:`welcome-features`},gI={class:`modal path-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`path-title`},_I={class:`full-directory`},vI=Or({__name:`App`,setup(e){let t=()=>lu.devices.value.filter(e=>e.status===`online`).length,n=k();function r(){W.dialog={kind:`new-session`,deviceId:U.value?.deviceId}}function i(e){let t=W.dialog?void 0:sd(e);if(t)return e.preventDefault(),t===`tree`?rd():id();if(e.key===`Escape`){if(W.dialog){W.dialog.kind===`pair`?n.value?.close():W.dialog=void 0;return}!e.repeat&&!e.isComposing&&Lu.value&&(e.preventDefault(),Zu()),W.drawer=!1,W.inspectorOverlay=!1}}function a(e){let t=e.clientX,n=fu.value,r=e=>fu.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 Ur(()=>jd()),Ur(()=>{document.addEventListener(`keydown`,i),Au()}),Kr(()=>{su.stop(),document.removeEventListener(`keydown`,i)}),(e,i)=>(P(),F(`div`,dI,[R(hd,{onNewSession:r}),A(W).error?(P(),F(`div`,fI,[R(A(Sc),{size:18}),L(`span`,null,E(A(W).error),1),L(`button`,{class:`icon-button`,"aria-label":`Dismiss error`,onClick:i[0]||=e=>A(W).error=``},`×`)])):B(``,!0),L(`main`,{class:`net-workspace`,style:ve({"--tree-w":`${A(fu)}px`})},[R(cf),A(pu).tree?(P(),F(`div`,{key:0,class:`tree-resizer`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize network tree`,onPointerdown:js(a,[`prevent`])},null,32)):B(``,!0),A(W).drawer?(P(),F(`div`,{key:1,class:`tree-backdrop`,onClick:i[1]||=e=>A(W).drawer=!1})):B(``,!0),A(U)&&A(gu)&&A(_u)?(P(),F(N,{key:2},[R(aC),A(W).inspectorOverlay?(P(),F(`div`,{key:0,class:`inspector-backdrop`,onClick:i[2]||=e=>A(nd)()})):B(``,!0),(P(),I(nv,{key:`${A(U).deviceId}/${A(U).sessionId}`}))],64)):A(U)&&A(gu)?(P(),I(hC,{key:3,device:A(gu)},null,8,[`device`])):(P(),F(`section`,pI,[i[14]||=L(`img`,{class:`welcome-symbol`,src:`/icons/durable-pi.svg`,alt:`Durable Pi`},null,-1),i[15]||=L(`span`,{class:`eyebrow`},`THE DURABLE AGENT NETWORK`,-1),i[16]||=L(`h1`,null,[z(`Close the tab.`),L(`br`),z(`The work continues.`)],-1),i[17]||=L(`p`,null,`Agents run on your devices. This page is only a window into them.`,-1),L(`button`,{class:`primary`,disabled:!t(),onClick:r},[R(A(Hc),{size:18}),z(E(A(lu).devices.value.length?`Create a session`:`Add a device to dpi-network.yaml`),1)],8,mI),L(`div`,hI,[L(`span`,null,[R(A(uc),{size:18}),i[11]||=z(`SQLite on each device`,-1)]),L(`span`,null,[R(A(vc),{size:18}),i[12]||=z(`Branch any agent`,-1)]),L(`span`,null,[R(A(Us),{size:18}),i[13]||=z(`Watch from anywhere`,-1)])])]))],4),R(vd),A(W).dialog?.kind===`pair`?(P(),I(vF,{key:1,ref_key:`pairWizard`,ref:n,handoff:A(W).dialog.handoff,onClose:i[3]||=e=>A(W).dialog=void 0},null,8,[`handoff`])):B(``,!0),A(W).dialog?.kind===`credentials`?(P(),I(SF,{key:2,"device-id":A(W).dialog.deviceId,onClose:i[4]||=e=>A(W).dialog=void 0},null,8,[`device-id`])):B(``,!0),A(W).dialog?.kind===`new-session`?(P(),I(MC,{key:3,"device-id":A(W).dialog.deviceId,onClose:i[5]||=e=>A(W).dialog=void 0},null,8,[`device-id`])):A(W).dialog?.kind===`prompt`?(P(),I(NF,{key:4,dialog:A(W).dialog,onClose:i[6]||=e=>A(W).dialog=void 0},null,8,[`dialog`])):A(W).dialog?.kind===`models`?(P(),I(BF,{key:5,onClose:i[7]||=e=>A(W).dialog=void 0})):A(W).dialog?.kind===`path`?(P(),F(`div`,{key:6,class:`modal-backdrop`,onClick:i[10]||=js(e=>A(W).dialog=void 0,[`self`])},[L(`section`,gI,[L(`header`,null,[i[18]||=L(`h2`,{id:`path-title`},`Working directory`,-1),L(`button`,{class:`icon-button`,"aria-label":`Close working directory`,onClick:i[8]||=e=>A(W).dialog=void 0},[R(A(ol),{size:18})])]),L(`code`,_I,E(A(W).dialog.path),1),L(`footer`,null,[L(`button`,{class:`secondary`,onClick:i[9]||=e=>A(W).dialog=void 0},`Close`)])])])):A(W).dialog?.kind===`help`?(P(),I(YF,{key:7})):B(``,!0),A(XF).needed?(P(),I(cI,{key:8})):B(``,!0),R(uI)]))}});rI();var yI=new URL(window.location.href);if(/^\/pair\/?$/.test(yI.pathname)){let e=RP(yI);e?(yI.search=``,yI.hash=``,window.history.replaceState(window.history.state,``,yI),W.dialog={kind:`pair`,handoff:e}):window.history.replaceState(window.history.state,``,BP(yI))}Ls(vI).mount(`#app`);