gestalt-mobile 0.76.1 → 0.77.0
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.
- package/README.md +2 -1
- package/dist/client/assets/index-4TyJ2ZNL.css +1 -0
- package/dist/client/assets/index-DRAAJvJ4.js +184 -0
- package/dist/client/index.html +2 -2
- package/dist/server/server/features/files/read-session-link/endpoint.js +1 -1
- package/dist/server/server/platform/filesystem/filesystem-workspace-files.js +43 -12
- package/dist/server/shared/contracts/file-preview.js +6 -0
- package/package.json +1 -1
- package/dist/client/assets/index-BfJTnDRY.js +0 -184
- package/dist/client/assets/index-CNJK1Kvj.css +0 -1
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var l=Array.isArray,u=Array.prototype.indexOf,d=Array.prototype.includes,f=Array.from,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyDescriptors,g=Object.prototype,_=Array.prototype,v=Object.getPrototypeOf,y=Object.isExtensible,b=()=>{};function x(e){for(var t=0;t<e.length;t++)e[t]()}function S(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function C(e,t,n=!1){return e===void 0?n?t():t:e}function w(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}var T=1<<24,E=1024,D=2048,O=4096,k=8192,ee=16384,te=32768,ne=1<<25,re=65536,ie=1<<18,ae=1<<19,oe=1<<20,se=1<<25,ce=65536,le=1<<21,ue=1<<22,de=1<<23,A=Symbol(`$state`),fe=Symbol(`legacy props`),pe=Symbol(``),me=Symbol(`attributes`),he=Symbol(`class`),ge=Symbol(`style`),_e=Symbol(`text`),ve=Symbol(`form reset`),ye=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},be=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function xe(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Se(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function j(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ce(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function we(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function Te(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function Ee(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function De(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Oe(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function ke(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function Ae(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function je(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var Me={},Ne=Symbol(`uninitialized`),Pe=`http://www.w3.org/1999/xhtml`,Fe=`http://www.w3.org/2000/svg`,Ie=`http://www.w3.org/1998/Math/MathML`;function Le(){console.warn(`https://svelte.dev/e/derived_inert`)}function Re(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function ze(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function Be(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var M=!1;function Ve(e){M=e}var N;function He(e){if(e===null)throw Re(),Me;return N=e}function Ue(){return He(yn(N))}function P(e){if(M){if(yn(N)!==null)throw Re(),Me;N=e}}function F(e=1){if(M){for(var t=e,n=N;t--;)n=yn(n);N=n}}function We(e=!0){for(var t=0,n=N;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=yn(n);e&&n.remove(),n=i}}function Ge(e){if(!e||e.nodeType!==8)throw Re(),Me;return e.data}function Ke(e){return e===this.v}function qe(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Je(e){return!qe(e,this.v)}var Ye=!1;function Xe(){Ye=!0}var Ze=null;function Qe(e){Ze=e}function I(e,t=!1,n){Ze={p:Ze,i:!1,c:null,e:null,s:e,x:null,r:lr,l:Ye&&!t?{s:null,u:null,$:[]}:null}}function $e(e){var t=Ze,n=t.e;if(n!==null){t.e=null;for(var r of n)Fn(r)}return e!==void 0&&(t.x=e),t.i=!0,Ze=t.p,e??{}}function et(){return!Ye||Ze!==null&&Ze.l===null}var tt=[];function nt(){var e=tt;tt=[],x(e)}function rt(e){if(tt.length===0&&!It){var t=tt;queueMicrotask(()=>{t===tt&&nt()})}tt.push(e)}function it(){for(;tt.length>0;)nt()}function at(e){var t=lr;if(t===null)return or.f|=de,e;if(!(t.f&32768)&&!(t.f&4))throw e;ot(e,t)}function ot(e,t){if(!(t!==null&&t.f&16384)){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}}var st=~(D|O|E);function ct(e,t){e.f=e.f&st|t}function lt(e){e.f&512||e.deps===null?ct(e,E):ct(e,O)}function ut(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=ce,ut(t.deps))}function dt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),ut(e.deps),ct(e,E)}var ft=!1;function pt(e){var t=ft;try{return ft=!1,[e(),ft]}finally{ft=t}}function mt(e){let t=0,n=tn(0),r;return()=>{Mn()&&(W(n),Bn(()=>(t===0&&(r=jr(()=>e(()=>on(n)))),t+=1,()=>{rt(()=>{--t,t===0&&(r?.(),r=void 0,on(n))})})))}}var ht=re|ae;function gt(e,t,n,r){new _t(e,t,n,r)}var _t=class{parent;is_pending=!1;transform_error;#e;#t=M?N:null;#n;#r;#i;#a=null;#o=null;#s=null;#c=null;#l=0;#u=0;#d=!1;#f=new Set;#p=new Set;#m=null;#h=mt(()=>(this.#m=tn(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=lr;t.b=this,t.f|=128,n(e)},this.parent=lr.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Hn(()=>{if(M){let e=this.#t;Ue();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));this.#_(t)}else t?this.#v():this.#g()}else this.#y()},ht),M&&(this.#e=N)}#g(){try{this.#a=Wn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Wn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Wn(()=>e(this.#e)),rt(()=>{var e=this.#c=document.createDocumentFragment(),t=_n();e.append(t),this.#a=this.#x(()=>Wn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,Zn(this.#o,()=>{this.#o=null}),this.#b(Mt))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Wn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();tr(this.#a,e);let t=this.#n.pending;this.#o=Wn(()=>t(this.#e))}else this.#b(Mt)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){dt(e,this.#f,this.#p)}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!this.#n.pending}#x(e){var t=lr,n=or,r=Ze;ur(this.#i),cr(this.#i),Qe(this.#i.ctx);try{return Ht.ensure(),e()}catch(e){return at(e),null}finally{ur(t),cr(n),Qe(r)}}#S(e,t){if(!this.has_pending_snippet()){this.parent&&this.parent.#S(e,t);return}this.#u+=e,this.#u===0&&(this.#b(t),this.#o&&Zn(this.#o,()=>{this.#o=null}),this.#c&&=(this.#e.before(this.#c),null))}update_pending_count(e,t){this.#S(e,t),this.#l+=e,!(!this.#m||this.#d)&&(this.#d=!0,rt(()=>{this.#d=!1,this.#m&&rn(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),W(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;Mt?.is_fork?(this.#a&&Mt.skip_effect(this.#a),this.#o&&Mt.skip_effect(this.#o),this.#s&&Mt.skip_effect(this.#s),Mt.oncommit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(Jn(this.#a),null),this.#o&&=(Jn(this.#o),null),this.#s&&=(Jn(this.#s),null),M&&(He(this.#t),F(),He(We()));var t=this.#n.onerror;let n=this.#n.failed;var r=!1,i=!1;let a=()=>{if(r){Be();return}r=!0,i&&je(),this.#s!==null&&Zn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){ot(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Wn(()=>{var t=lr;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return ot(e,this.#i.parent),null}}))};rt(()=>{var t;try{t=this.transform_error(e)}catch(e){ot(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>ot(e,this.#i&&this.#i.parent)):o(t)})}};function vt(e,t,n,r){let i=et()?St:Tt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=lr,c=yt(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){ot(e,s)}bt()}}var d=xt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>wt(e))).then(u).catch(e=>ot(e,s)).finally(d)}l?l.then(()=>{c(),f(),bt()}):f()}function yt(){var e=lr,t=or,n=Ze,r=Mt;return function(i=!0){ur(e),cr(t),Qe(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function bt(e=!0){ur(null),cr(null),Qe(null),e&&Mt?.deactivate()}function xt(){var e=lr,t=e.b,n=Mt,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function St(e){var t=2|D;return lr!==null&&(lr.f|=ae),{ctx:Ze,deps:null,effects:null,equals:Ke,f:t,fn:e,reactions:null,rv:0,v:Ne,wv:0,parent:lr,ac:null}}var Ct=Symbol(`obsolete`);function wt(e,t,n){let r=lr;r===null&&Se();var i=void 0,a=tn(Ne),o=!or,s=new Set;return zn(()=>{var t=lr,n=S();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==ye&&n.reject(e)}).finally(bt)}catch(e){n.reject(e),bt()}var c=Mt;if(o){if(t.f&32768)var l=xt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(Ct);else for(let e of s.values())e.reject(Ct);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==Ct&&(c.activate(),t?(a.f|=de,rn(a,t)):(a.f&8388608&&(a.f^=de),rn(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),Nn(()=>{for(let e of s)e.reject(Ct)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function L(e){let t=St(e);return fr(t),t}function Tt(e){let t=St(e);return t.equals=Je,t}function Et(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Jn(t[n])}}function Dt(e){var t,n=lr,r=e.parent;if(!ir&&r!==null&&e.v!==Ne&&r.f&24576)return Le(),e.v;ur(r);try{e.f&=~ce,Et(e),t=wr(e)}finally{ur(n)}return t}function Ot(e){var t=Dt(e);if(!e.equals(t)&&(e.wv=xr(),(!Mt?.is_fork||e.deps===null)&&(Mt===null?e.v=t:(Mt.capture(e,t,!0),Nt?.capture(e,t,!0)),e.deps===null))){ct(e,E);return}ir||(Pt===null?lt(e):(Mn()||Mt?.is_fork)&&Pt.set(e,t))}function kt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(ye),t.fn!==null&&(t.teardown=b),t.ac=null,Er(t,0),Kn(t))}function At(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Dr(t)}var jt=null,Mt=null,Nt=null,Pt=null,Ft=null,It=!1,Lt=!1,Rt=null,zt=null,Bt=0,Vt=1,Ht=class e{id=Vt++;#e=!1;linked=!0;#t=null;#n=null;async_deriveds=new Map;current=new Map;previous=new Map;#r=new Set;#i=new Set;#a=0;#o=new Map;#s=null;#c=[];#l=[];#u=new Set;#d=new Set;#f=new Map;#p=new Set;is_fork=!1;#m=!1;constructor(){jt===null?jt=this:(jt.#n=this,this.#t=jt),jt=this}#h(){if(this.is_fork)return!0;for(let n of this.#o.keys()){for(var e=n,t=!1;e.parent!==null;){if(this.#f.has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}skip_effect(e){this.#f.has(e)||this.#f.set(e,{d:[],m:[]}),this.#p.delete(e)}unskip_effect(e,t=e=>this.schedule(e)){var n=this.#f.get(e);if(n){this.#f.delete(e);for(var r of n.d)ct(r,D),t(r);for(r of n.m)ct(r,O),t(r)}this.#p.add(e)}#g(){this.#e=!0,Bt++>1e3&&(this.#x(),Wt());for(let e of this.#u)this.#d.delete(e),ct(e,D),this.schedule(e);for(let e of this.#d)ct(e,O),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=Rt=[],r=[],i=zt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Zt(e),this.#h()||this.discard(),t}if(Mt=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(Rt=null,zt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Xt(e,t);i.length>0&&Mt.#g();return}let o=this.#v();if(o){this.#b(r),this.#b(n),o.#y(this);return}this.#u.clear(),this.#d.clear();for(let e of this.#r)e(this);this.#r.clear(),Nt=this,Kt(r),Kt(n),Nt=null,this.#s?.resolve();var s=Mt;if(this.#a===0&&(this.#c.length===0||s!==null)&&this.#x(),this.#c.length>0)if(s!==null){let e=s;e.#c.push(...this.#c.filter(t=>!e.#c.includes(t)))}else s=this;s!==null&&s.#g()}#_(e,t,n){e.f^=E;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||this.#f.has(r))&&r.fn!==null){a?r.f^=E:i&4?t.push(r):Sr(r)&&(i&16&&this.#d.add(r),Dr(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}#v(){for(var e=this.#t;e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=e.#t}return null}#y(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(e.#u,e.#d);let t=e=>{var n=e.reactions;if(n!==null)for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(this.#d.delete(i),ct(i,D),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),Mt=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)dt(e[t],this.#u,this.#d)}capture(e,t,n=!1){e.v!==Ne&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),Pt?.set(e,t)),this.is_fork||(e.v=t)}activate(){Mt=this}deactivate(){Mt=null,Pt=null}flush(){try{Lt=!0,Mt=this,this.#g()}finally{Bt=0,Ft=null,Rt=null,zt=null,Lt=!1,Mt=null,Pt=null,$t.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(Ct);this.#x(),this.#s?.resolve()}register_created_effect(e){this.#l.push(e)}increment(e,t){if(this.#a+=1,e){let e=this.#o.get(t)??0;this.#o.set(t,e+1)}}decrement(e,t){if(--this.#a,e){let e=this.#o.get(t)??0;e===1?this.#o.delete(t):this.#o.set(t,e-1)}this.#m||(this.#m=!0,rt(()=>{this.#m=!1,this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)this.#u.add(t);for(let e of t)this.#d.add(e);e.clear(),t.clear()}oncommit(e){this.#r.add(e)}ondiscard(e){this.#i.add(e)}settled(){return(this.#s??=S()).promise}static ensure(){if(Mt===null){let t=Mt=new e;!Lt&&!It&&rt(()=>{t.#e||t.flush()})}return Mt}apply(){Pt=null}schedule(e){if(Ft=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(Rt!==null&&t===lr&&(or===null||!(or.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=E}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?jt=e:t.#t=e,this.linked=!1}}};function Ut(e){var t=It;It=!0;try{var n;for(e&&(Mt!==null&&!Mt.is_fork&&Mt.flush(),n=e());;){if(it(),Mt===null)return n;Mt.flush()}}finally{It=t}}function Wt(){try{Ee()}catch(e){ot(e,Ft)}}var Gt=null;function Kt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Sr(r)&&(Gt=new Set,Dr(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Xn(r),Gt?.size>0)){$t.clear();for(let e of Gt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Gt.has(n)&&(Gt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Dr(n)}}Gt.clear()}}Gt=null}}function qt(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?qt(i,t,n,r):e&4194320&&!(e&2048)&&Jt(i,t,r)&&(ct(i,D),Yt(i))}}function Jt(e,t,n){let r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(let r of e.deps){if(d.call(t,r))return!0;if(r.f&2&&Jt(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function Yt(e){Mt.schedule(e)}function Xt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),ct(e,E);for(var n=e.first;n!==null;)Xt(n,t),n=n.next}}function Zt(e){ct(e,E);for(var t=e.first;t!==null;)Zt(t),t=t.next}var Qt=new Set,$t=new Map,en=!1;function tn(e,t){return{f:0,v:e,reactions:null,equals:Ke,rv:0,wv:0}}function R(e,t){let n=tn(e,t);return fr(n),n}function nn(e,t=!1,n=!0){let r=tn(e);return t||(r.equals=Je),Ye&&n&&Ze!==null&&Ze.l!==null&&(Ze.l.s??=[]).push(r),r}function z(e,t,n=!1){return or!==null&&(!sr||or.f&131072)&&et()&&or.f&4325394&&(dr===null||!dr.has(e))&&Ae(),rn(e,n?cn(t):t,zt)}function rn(e,t,n=null){if(!e.equals(t)){$t.set(e,ir?t:e.v);var r=Ht.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&Dt(t),Pt===null&<(t)}e.wv=xr(),sn(e,D,n),et()&&lr!==null&&lr.f&1024&&!(lr.f&96)&&(hr===null?gr([e]):hr.push(e)),!r.is_fork&&Qt.size>0&&!en&&an()}return t}function an(){en=!1;for(let e of Qt){e.f&1024&&ct(e,O);let t;try{t=Sr(e)}catch{t=!0}t&&Dr(e)}Qt.clear()}function on(e){z(e,e.v+1)}function sn(e,t,n){var r=e.reactions;if(r!==null)for(var i=et(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===lr)){var l=(c&D)===0;if(l&&ct(s,t),c&131072)Qt.add(s);else if(c&2){var u=s;Pt?.delete(u),c&65536||(c&512&&(lr===null||!(lr.f&2097152))&&(s.f|=ce),sn(u,O,n))}else if(l){var d=s;c&16&&Gt!==null&&Gt.add(d),n===null?Yt(d):n.push(d)}}}}function cn(e){if(typeof e!=`object`||!e||A in e)return e;let t=v(e);if(t!==g&&t!==_)return e;var n=new Map,r=l(e),i=R(0),a=null,o=yr,s=e=>{if(yr===o)return e();var t=or,n=yr;cr(null),br(o);var r=e();return cr(t),br(n),r};return r&&n.set(`length`,R(e.length,a)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&Oe();var i=n.get(t);return i===void 0?s(()=>{var e=R(r.value,a);return n.set(t,e),e}):z(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=s(()=>R(Ne,a));n.set(t,e),on(i)}}else z(r,Ne),on(i);return!0},get(t,r,i){if(r===A)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||m(t,r)?.writable)&&(o=s(()=>R(cn(c?t[r]:Ne),a)),n.set(r,o)),o!==void 0){var l=W(o);return l===Ne?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);if(r&&`value`in r){var i=n.get(t);i&&(r.value=W(i))}else if(r===void 0){var a=n.get(t),o=a?.v;if(a!==void 0&&o!==Ne)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return r},has(e,t){if(t===A)return!0;var r=n.get(t),i=r!==void 0&&r.v!==Ne||Reflect.has(e,t);return(r!==void 0||lr!==null&&(!i||m(e,t)?.writable))&&(r===void 0&&(r=s(()=>R(i?cn(e[t]):Ne,a)),n.set(t,r)),W(r)===Ne)?!1:i},set(e,t,o,c){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;d<l.v;d+=1){var f=n.get(d+``);f===void 0?d in e&&(f=s(()=>R(Ne,a)),n.set(d+``,f)):z(f,Ne)}if(l===void 0)(!u||m(e,t)?.writable)&&(l=s(()=>R(void 0,a)),z(l,cn(o)),n.set(t,l));else{u=l.v!==Ne;var p=s(()=>cn(o));z(l,p)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(c,o),!u){if(r&&typeof t==`string`){var g=n.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&z(g,_+1)}on(i)}return!0},ownKeys(e){W(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==Ne});for(var[r,a]of n)a.v!==Ne&&!(r in e)&&t.push(r);return t},setPrototypeOf(){ke()}})}function ln(e){try{if(typeof e==`object`&&e&&A in e)return e[A]}catch{}return e}function un(e,t){return Object.is(ln(e),ln(t))}var dn,fn,pn,mn,hn;function gn(){if(dn===void 0){dn=window,fn=document,pn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;mn=m(t,`firstChild`).get,hn=m(t,`nextSibling`).get,y(e)&&(e[he]=void 0,e[me]=null,e[ge]=void 0,e.__e=void 0),y(n)&&(n[_e]=void 0)}}function _n(e=``){return document.createTextNode(e)}function vn(e){return mn.call(e)}function yn(e){return hn.call(e)}function B(e,t){if(!M)return vn(e);var n=vn(N);if(n===null)n=N.appendChild(_n());else if(t&&n.nodeType!==3){var r=_n();return n?.before(r),He(r),r}return t&&Cn(n),He(n),n}function V(e,t=!1){if(!M){var n=vn(e);return n instanceof Comment&&n.data===``?yn(n):n}if(t){if(N?.nodeType!==3){var r=_n();return N?.before(r),He(r),r}Cn(N)}return N}function H(e,t=1,n=!1){let r=M?N:e;for(var i;t--;)i=r,r=yn(r);if(!M)return r;if(n){if(r?.nodeType!==3){var a=_n();return r===null?i?.after(a):r.before(a),He(a),a}Cn(r)}return He(r),r}function bn(e){e.textContent=``}function xn(){return!1}function Sn(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function Cn(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function wn(e){M&&vn(e)!==null&&bn(e)}var Tn=!1;function En(){Tn||(Tn=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[ve]?.()})},{capture:!0}))}function Dn(e){var t=or,n=lr;cr(null),ur(null);try{return e()}finally{cr(t),ur(n)}}function On(e,t,n,r=n){e.addEventListener(t,()=>Dn(n));let i=e[ve];i?e[ve]=()=>{i(),r(!0)}:e[ve]=()=>r(!0),En()}function kn(e){lr===null&&(or===null&&Te(e),we()),ir&&Ce(e)}function An(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function jn(e,t){var n=lr;n!==null&&n.f&8192&&(e|=k);var r={ctx:Ze,deps:null,nodes:null,f:e|D|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Mt?.register_created_effect(r);var i=r;if(e&4)Rt===null?Ht.ensure().schedule(r):Rt.push(r);else if(t!==null){try{Dr(r)}catch(e){throw Jn(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=re))}if(i!==null&&(i.parent=n,n!==null&&An(i,n),or!==null&&or.f&2&&!(e&64))){var a=or;(a.effects??=[]).push(i)}return r}function Mn(){return or!==null&&!sr}function Nn(e){let t=jn(8,null);return ct(t,E),t.teardown=e,t}function Pn(e){kn(`$effect`);var t=lr.f;if(!or&&t&32&&Ze!==null&&!Ze.i){var n=Ze;(n.e??=[]).push(e)}else return Fn(e)}function Fn(e){return jn(4|oe,e)}function In(e){return kn(`$effect.pre`),jn(8|oe,e)}function Ln(e){Ht.ensure();let t=jn(64|ae,e);return(e={})=>new Promise(n=>{e.outro?Zn(t,()=>{Jn(t),n(void 0)}):(Jn(t),n(void 0))})}function Rn(e){return jn(4,e)}function zn(e){return jn(ue|ae,e)}function Bn(e,t=0){return jn(8|t,e)}function U(e,t=[],n=[],r=[]){vt(r,t,n,t=>{jn(8,()=>{e(...t.map(W))})})}function Vn(e,t=[],n=[],r=[]){vt(r,t,n,t=>{jn(4,()=>e(...t.map(W)))})}function Hn(e,t=0){return jn(16|t,e)}function Un(e,t=0){return jn(T|t,e)}function Wn(e){return jn(32|ae,e)}function Gn(e){var t=e.teardown;if(t!==null){let e=ir,n=or;ar(!0),cr(null);try{t.call(null)}finally{ar(e),cr(n)}}}function Kn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Dn(()=>{e.abort(ye)});var r=n.next;n.f&64?n.parent=null:Jn(n,t),n=r}}function qn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Jn(t),t=n}}function Jn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Yn(e.nodes.start,e.nodes.end),n=!0),e.f|=ne,Kn(e,t&&!n),Er(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Gn(e),e.f^=ne,e.f|=ee;var i=e.parent;i!==null&&i.first!==null&&Xn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Yn(e,t){for(;e!==null;){var n=e===t?null:yn(e);e.remove(),e=n}}function Xn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Zn(e,t,n=!0){var r=[];Qn(e,r,!0);var i=()=>{n&&Jn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Qn(e,t,n){if(!(e.f&8192)){e.f^=k;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;Qn(i,t,o?n:!1)}i=a}}}function $n(e){er(e,!0)}function er(e,t){if(e.f&8192){e.f^=k,e.f&1024||(ct(e,D),Ht.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;er(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function tr(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:yn(n);t.append(n),n=i}}var nr=null,rr=!1,ir=!1;function ar(e){ir=e}var or=null,sr=!1;function cr(e){or=e}var lr=null;function ur(e){lr=e}var dr=null;function fr(e){or!==null&&(dr??=new Set).add(e)}var pr=null,mr=0,hr=null;function gr(e){hr=e}var _r=1,vr=0,yr=vr;function br(e){yr=e}function xr(){return++_r}function Sr(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~ce),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Sr(a)&&Ot(a),a.wv>e.wv)return!0}t&512&&Pt===null&&ct(e,E)}return!1}function Cr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(dr!==null&&dr.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?Cr(a,t,!1):t===a&&(n?ct(a,D):a.f&1024&&ct(a,O),Yt(a))}}function wr(e){var t=pr,n=mr,r=hr,i=or,a=dr,o=Ze,s=sr,c=yr,l=e.f;pr=null,mr=0,hr=null,or=l&96?null:e,dr=null,Qe(e.ctx),sr=!1,yr=++vr,e.ac!==null&&(Dn(()=>{e.ac.abort(ye)}),e.ac=null);try{e.f|=le;var u=e.fn,d=u();e.f|=te;var f=e.deps,p=Mt?.is_fork;if(pr!==null){var m;if(p||Er(e,mr),f!==null&&mr>0)for(f.length=mr+pr.length,m=0;m<pr.length;m++)f[mr+m]=pr[m];else e.deps=f=pr;if(Mn()&&e.f&512)for(m=mr;m<f.length;m++)(f[m].reactions??=[]).push(e)}else!p&&f!==null&&mr<f.length&&(Er(e,mr),f.length=mr);if(et()&&hr!==null&&!sr&&f!==null&&!(e.f&6146))for(m=0;m<hr.length;m++)Cr(hr[m],e);if(i!==null&&i!==e){if(vr++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=vr;if(t!==null)for(let e of t)e.rv=vr;hr!==null&&(r===null?r=hr:r.push(...hr))}return e.f&8388608&&(e.f^=de),d}catch(e){return at(e)}finally{e.f^=le,pr=t,mr=n,hr=r,or=i,dr=a,Qe(o),sr=s,yr=c}}function Tr(e,t){let n=t.reactions;if(n!==null){var r=u.call(n,e);if(r!==-1){var i=n.length-1;i===0?n=t.reactions=null:(n[r]=n[i],n.pop())}}if(n===null&&t.f&2&&(pr===null||!d.call(pr,t))){var a=t;a.f&512&&(a.f^=512,a.f&=~ce),a.v!==Ne&<(a),kt(a),Er(a,0)}}function Er(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Tr(e,n[r])}function Dr(e){var t=e.f;if(!(t&16384)){ct(e,E);var n=lr,r=rr;lr=e,rr=!0;try{t&16777232?qn(e):Kn(e),Gn(e);var i=wr(e);e.teardown=typeof i==`function`?i:null,e.wv=_r}finally{rr=r,lr=n}}}async function Or(){await Promise.resolve(),Ut()}function W(e){var t=(e.f&2)!=0;if(nr?.add(e),or!==null&&!sr&&!(lr!==null&&lr.f&16384)&&(dr===null||!dr.has(e))){var n=or.deps;if(or.f&2097152)e.rv<vr&&(e.rv=vr,pr===null&&n!==null&&n[mr]===e?mr++:pr===null?pr=[e]:pr.push(e));else{or.deps??=[],d.call(or.deps,e)||or.deps.push(e);var r=e.reactions;r===null?e.reactions=[or]:d.call(r,or)||r.push(or)}}if(ir&&$t.has(e))return $t.get(e);if(t){var i=e;if(ir){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||Ar(i))&&(a=Dt(i)),$t.set(i,a),a}var o=(i.f&512)==0&&!sr&&or!==null&&(rr||(or.f&512)!=0),s=(i.f&te)===0;Sr(i)&&(o&&(i.f|=512),Ot(i)),o&&!s&&(At(i),kr(i))}if(Pt?.has(e))return Pt.get(e);if(e.f&8388608)throw e.v;return e.v}function kr(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(At(t),kr(t))}function Ar(e){if(e.v===Ne)return!0;if(e.deps===null)return!1;for(let t of e.deps)if($t.has(t)||t.f&2&&Ar(t))return!0;return!1}function jr(e){var t=sr;try{return sr=!0,e()}finally{sr=t}}function Mr(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(A in e)Nr(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&A in n&&Nr(n)}}}function Nr(e,t=new Set){if(typeof e==`object`&&e&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{Nr(e[n],t)}catch{}let n=v(e);if(n!==Object.prototype&&n!==Array.prototype&&n!==Map.prototype&&n!==Set.prototype&&n!==Date.prototype){let t=h(n);for(let n in t){let r=t[n].get;if(r)try{r.call(e)}catch{}}}}}[...`allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback`.split(`.`)];var Pr=[`touchstart`,`touchmove`];function Fr(e){return Pr.includes(e)}var Ir=Symbol(`events`),Lr=new Set,Rr=new Set;function zr(e,t,n,r={}){function i(e){if(r.capture||Ur.call(t,e),!e.cancelBubble)return Dn(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?rt(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Br(e,t,n,r,i){var a={capture:r,passive:i},o=zr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Nn(()=>{t.removeEventListener(e,o,a)})}function G(e,t,n){(t[Ir]??={})[e]=n}function Vr(e){for(var t=0;t<e.length;t++)Lr.add(e[t]);for(var n of Rr)n(e)}var Hr=null;function Ur(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;Hr=e;var o=0,s=Hr===e&&e[Ir];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[Ir]=t;return}var l=i.indexOf(t);if(l===-1)return;c<=l&&(o=c)}if(a=i[o]||e.target,a!==t){p(e,`currentTarget`,{configurable:!0,get(){return a||n}});var u=or,d=lr;cr(null),ur(null);try{for(var f,m=[];a!==null&&a!==t;){try{var h=a[Ir]?.[r];h!=null&&(!a.disabled||e.target===a)&&h.call(a,e)}catch(e){f?m.push(e):f=e}if(e.cancelBubble)break;o++,a=o<i.length?i[o]:null}if(f){for(let e of m)queueMicrotask(()=>{throw e});throw f}}finally{e[Ir]=t,delete e.currentTarget,cr(u),ur(d)}}}var Wr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Gr(e){return Wr?.createHTML(e)??e}function Kr(e){var t=Sn(`template`);return t.innerHTML=Gr(e.replaceAll(`<!>`,`<!---->`)),t.content}function qr(e,t){var n=lr;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function K(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(`<!>`);return()=>{if(M)return qr(N,null),N;i===void 0&&(i=Kr(a?e:`<!>`+e),n||(i=vn(i)));var t=r||pn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=vn(t),s=t.lastChild;qr(o,s)}else qr(t,t);return t}}function Jr(e=``){if(!M){var t=_n(e+``);return qr(t,t),t}var n=N;return n.nodeType===3?Cn(n):(n.before(n=_n()),He(n)),qr(n,n),n}function Yr(){if(M)return qr(N,null),N;var e=document.createDocumentFragment(),t=document.createComment(``),n=_n();return e.append(t,n),qr(t,n),e}function q(e,t){if(M){var n=lr;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=N),Ue();return}e!==null&&e.before(t)}function Xr(){if(M&&N&&N.nodeType===8&&N.textContent?.startsWith(`$`)){let e=N.textContent.substring(1);return Ue(),e}return(window.__svelte??={}).uid??=1,`c${window.__svelte.uid++}`}function J(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[_e]??=e.nodeValue)&&(e[_e]=n,e.nodeValue=`${n}`)}function Zr(e,t){return $r(e,t)}var Qr=new Map;function $r(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){gn();var c=void 0,l=Ln(()=>{var o=n??t.appendChild(_n());gt(o,{pending:()=>{}},t=>{I({});var n=Ze;if(a&&(n.c=a),i&&(r.$$events=i),M&&qr(t,null),c=e(t,r)||{},M&&(lr.nodes.end=N,N===null||N.nodeType!==8||N.data!==`]`))throw Re(),Me;$e()},s);var l=new Set,u=e=>{for(var n=0;n<e.length;n++){var r=e[n];if(!l.has(r)){l.add(r);var i=Fr(r);for(let e of[t,document]){var a=Qr.get(e);a===void 0&&(a=new Map,Qr.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,Ur,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return u(f(Lr)),Rr.add(u),()=>{for(var e of l)for(let n of[t,document]){var r=Qr.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Ur),r.delete(e),r.size===0&&Qr.delete(n)):r.set(e,i)}Rr.delete(u),o!==n&&o.parentNode?.removeChild(o)}});return ei.set(c,l),c}var ei=new WeakMap,ti=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=e=>{if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)$n(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&($n(r.effect),this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(Jn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();tr(r,t),t.append(_n()),this.#n.set(e,{effect:r,fragment:t})}else Jn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Zn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(Jn(n.effect),this.#n.delete(e))};ensure(e,t){var n=Mt,r=xn();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=_n();i.append(a),this.#n.set(e,{effect:Wn(()=>t(a)),fragment:i})}else this.#t.set(e,Wn(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of this.#n)t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else M&&(this.anchor=N),this.#a(n)}};function Y(e,t,n=!1){var r;M&&(r=N,Ue());var i=new ti(e),a=n?re:0;function o(e,t){if(M){var n=Ge(r);if(e!==parseInt(n.substring(1))){var a=We();He(a),i.anchor=a,Ve(!1),i.ensure(e,t),Ve(!0);return}}i.ensure(e,t)}Hn(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var ni=Symbol(`NaN`);function ri(e,t,n){M&&Ue();var r=new ti(e),i=!et();Hn(()=>{var e=t();e!==e&&(e=ni),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function ii(e,t){return t}function ai(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let n=t[s];Zn(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;oi(e,f(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else--o},!1)}if(o===0){var c=r.length===0&&n!==null;if(c){var l=n,u=l.parentNode;bn(u),u.append(l),e.items.clear()}oi(e,t,!c)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function oi(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i<t.length;i++){var a=t[i];r?.has(a)?(a.f|=se,tr(a,document.createDocumentFragment())):Jn(t[i],n)}}var si;function X(e,t,n,r,i,a=null){var o=e,s=new Map;if(t&4){var c=e;o=M?He(vn(c)):c.appendChild(_n())}M&&Ue();var u=null,d=Tt(()=>{var e=n();return l(e)?e:e==null?[]:f(e)}),p,m=new Map,h=!0;function g(e){v.effect.f&16384||(v.pending.delete(e),v.fallback=u,li(v,p,o,t,r),u!==null&&(p.length===0?u.f&33554432?(u.f^=se,di(u,null,o)):$n(u):Zn(u,()=>{u=null})))}function _(e){v.pending.delete(e)}var v={effect:Hn(()=>{p=W(d);var e=p.length;let c=!1;M&&Ge(o)===`[!`!=(e===0)&&(o=We(),He(o),Ve(!1),c=!0);for(var l=new Set,f=Mt,v=xn(),y=0;y<e;y+=1){M&&N.nodeType===8&&N.data===`]`&&(o=N,c=!0,Ve(!1));var b=p[y],x=r(b,y),S=h?null:s.get(x);S?(S.v&&rn(S.v,b),S.i&&rn(S.i,y),v&&f.unskip_effect(S.e)):(S=ui(s,h?o:si??=_n(),b,x,y,i,t,n),h||(S.e.f|=se),s.set(x,S)),l.add(x)}if(e===0&&a&&!u&&(h?u=Wn(()=>a(o)):(u=Wn(()=>a(si??=_n())),u.f|=se)),e>l.size&&j(``,``,``),M&&e>0&&He(We()),!h)if(m.set(f,l),v){for(let[e,t]of s)l.has(e)||f.skip_effect(t.e);f.oncommit(g),f.ondiscard(_)}else g(f);c&&Ve(!0),W(d)}),flags:t,items:s,pending:m,outrogroups:null,fallback:u};h=!1,M&&(o=N)}function ci(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function li(e,t,n,r,i){var a=(r&8)!=0,o=t.length,s=e.items,c=ci(e.effect.first),l,u=null,d,p=[],m=[],h,g,_,v;if(a)for(v=0;v<o;v+=1)h=t[v],g=i(h,v),_=s.get(g).e,_.f&33554432||(_.nodes?.a?.measure(),(d??=new Set).add(_));for(v=0;v<o;v+=1){if(h=t[v],g=i(h,v),_=s.get(g).e,e.outrogroups!==null)for(let t of e.outrogroups)t.pending.delete(_),t.done.delete(_);if(_.f&8192&&($n(_),a&&(_.nodes?.a?.unfix(),(d??=new Set).delete(_))),_.f&33554432)if(_.f^=se,_===c)di(_,null,n);else{var y=u?u.next:c;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),fi(e,u,_),fi(e,_,y),di(_,y,n),u=_,p=[],m=[],c=ci(u.next);continue}if(_!==c){if(l!==void 0&&l.has(_)){if(p.length<m.length){var b=m[0],x;u=b.prev;var S=p[0],C=p[p.length-1];for(x=0;x<p.length;x+=1)di(p[x],b,n);for(x=0;x<m.length;x+=1)l.delete(m[x]);fi(e,S.prev,C.next),fi(e,u,S),fi(e,C,b),c=b,u=C,--v,p=[],m=[]}else l.delete(_),di(_,c,n),fi(e,_.prev,_.next),fi(e,_,u===null?e.effect.first:u.next),fi(e,u,_),u=_;continue}for(p=[],m=[];c!==null&&c!==_;)(l??=new Set).add(c),m.push(c),c=ci(c.next);if(c===null)continue}_.f&33554432||p.push(_),u=_,c=ci(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(oi(e,f(t.done)),e.outrogroups?.delete(t));e.outrogroups.size===0&&(e.outrogroups=null)}if(c!==null||l!==void 0){var w=[];if(l!==void 0)for(_ of l)_.f&8192||w.push(_);for(;c!==null;)!(c.f&8192)&&c!==e.fallback&&w.push(c),c=ci(c.next);var T=w.length;if(T>0){var E=r&4&&o===0?n:null;if(a){for(v=0;v<T;v+=1)w[v].nodes?.a?.measure();for(v=0;v<T;v+=1)w[v].nodes?.a?.fix()}ai(e,w,E)}}a&&rt(()=>{if(d!==void 0)for(_ of d)_.nodes?.a?.apply()})}function ui(e,t,n,r,i,a,o,s){var c=o&1?o&16?tn(n):nn(n,!1,!1):null,l=o&2?tn(i):null;return{v:c,i:l,e:Wn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function di(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=yn(r);if(a.before(r),r===i)return;r=o}}function fi(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function pi(e,t,n=!1,r=!1,i=!1,a=!1){var o=e,s=``;if(n){var c=e;M&&(o=He(vn(c)))}U(()=>{var e=lr;if(s===(s=t()??``)){M&&Ue();return}if(n&&!M){e.nodes=null,c.innerHTML=s,s!==``&&qr(vn(c),c.lastChild);return}if(e.nodes!==null&&(Yn(e.nodes.start,e.nodes.end),e.nodes=null),s!==``){if(M){for(var a=N.data,l=Ue(),u=l;l!==null&&(l.nodeType!==8||l.data!==``);)u=l,l=yn(l);if(l===null)throw Re(),Me;qr(N,u),o=He(l);return}var d=Sn(r?`svg`:i?`math`:`template`,r?Fe:i?Ie:void 0);d.innerHTML=s;var f=r||i?d:d.content;if(qr(vn(f),f.lastChild),r||i)for(;vn(f);)o.before(vn(f));else o.before(f)}})}function mi(e,t,...n){var r=new ti(e);Hn(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},re)}function hi(e,t){let n=null,r=M;var i;if(M){n=N;for(var a=vn(document.head);a!==null&&(a.nodeType!==8||a.data!==e);)a=yn(a);if(a===null)Ve(!1);else{var o=yn(a);a.remove(),He(o)}}M||(i=document.head.appendChild(_n()));try{Hn(()=>{var e=Wn(()=>t(i));e.f|=ie})}finally{r&&(Ve(!0),He(n))}}function gi(e,t,n){Rn(()=>{var r=jr(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};Bn(()=>{var e=n();Mr(e),i&&qe(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function _i(e,t){var n=void 0,r;Un(()=>{n!==(n=t())&&(r&&=(Jn(r),null),n&&(r=Wn(()=>{Rn(()=>n(e))})))})}function vi(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=vi(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function yi(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=vi(e))&&(r&&(r+=` `),r+=t);return r}function bi(e){return typeof e==`object`?yi(e):e??``}var xi=[...`
|
|
2
|
-
\r\f\xA0\v`];function Si(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||xi.includes(r[o-1]))&&(s===r.length||xi.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Ci(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function wi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Ti(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(wi)),i&&c.push(...Object.keys(i).map(wi));var l=0,u=-1;let t=e.length;for(var d=0;d<t;d++){var f=e[d];if(s?f===`/`&&e[d-1]===`*`&&(s=!1):a?a===f&&(a=!1):f===`/`&&e[d+1]===`*`?s=!0:f===`"`||f===`'`?a=f:f===`(`?o++:f===`)`&&o--,!s&&a===!1&&o===0){if(f===`:`&&u===-1)u=d;else if(f===`;`||d===t-1){if(u!==-1){var p=wi(e.substring(l,u).trim());if(!c.includes(p)){f!==`;`&&d++;var m=e.substring(l,d).trim();n+=` `+m+`;`}}l=d+1,u=-1}}}}return r&&(n+=Ci(r)),i&&(n+=Ci(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Ei(e,t,n,r,i,a){var o=e[he];if(M||o!==n||o===void 0){var s=Si(n,r,a);(!M||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[he]=n}else if(a&&i!==a)for(var c in a){var l=!!a[c];(i==null||l!==!!i[c])&&e.classList.toggle(c,l)}return a}function Di(e,t={},n,r){for(var i in n){var a=n[i];t[i]!==a&&(n[i]==null?e.style.removeProperty(i):e.style.setProperty(i,a,r))}}function Oi(e,t,n,r){var i=e[ge];if(M||i!==t){var a=Ti(t,r);(!M||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[ge]=t}else r&&(Array.isArray(r)?(Di(e,n?.[0],r[0]),Di(e,n?.[1],r[1],`important`)):Di(e,n,r));return r}function ki(e,t,n=!1){if(e.multiple){if(t==null)return;if(!l(t))return ze();for(var r of e.options)r.selected=t.includes(Mi(r));return}for(r of e.options)if(un(Mi(r),t)){r.selected=!0;return}(!n||t!==void 0)&&(e.selectedIndex=-1)}function Ai(e){var t=new MutationObserver(()=>{ki(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),Nn(()=>{t.disconnect()})}function ji(e,t,n=t){var r=new WeakSet,i=!0;On(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),Mi);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&Mi(o)}n(a),e.__value=a,Mt!==null&&r.add(Mt)}),Rn(()=>{var a=t();if(e===document.activeElement){var o=Mt;if(r.has(o))return}if(ki(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=Mi(s),n(a))}e.__value=a,i=!1}),Ai(e)}function Mi(e){return`__value`in e?e.__value:e.value}var Ni=Symbol(`is custom element`),Pi=Symbol(`is html`),Fi=be?`link`:`LINK`,Ii=be?`progress`:`PROGRESS`;function Li(e){if(M){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;Z(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;Z(e,`checked`,null),e.checked=r}}};e[ve]=n,rt(n),En()}}function Ri(e,t){var n=Bi(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==Ii)||(e.value=t??``)}function zi(e,t){var n=Bi(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Z(e,t,n,r){var i=Bi(e);M&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===Fi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[pe]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Hi(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Bi(e){return e[me]??={[Ni]:e.nodeName.includes(`-`),[Pi]:e.namespaceURI===Pe}}var Vi=new Map;function Hi(e){var t=e.getAttribute(`is`)||e.nodeName,n=Vi.get(t);if(n)return n;Vi.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=h(i),r)r[o].set&&o!==`innerHTML`&&o!==`textContent`&&o!==`innerText`&&n.push(o);i=v(i)}return n}function Ui(e,t,n=t){var r=new WeakSet;On(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Wi(e)?Gi(a):a,n(a),Mt!==null&&r.add(Mt),await Or(),a!==(a=t())){var o=e.selectionStart,s=e.selectionEnd,c=e.value.length;if(e.value=a??``,s!==null){var l=e.value.length;o===s&&s===c&&l>c?(e.selectionStart=l,e.selectionEnd=l):(e.selectionStart=o,e.selectionEnd=Math.min(s,l))}}}),(M&&e.defaultValue!==e.value||jr(t)==null&&e.value)&&(n(Wi(e)?Gi(e.value):e.value),Mt!==null&&r.add(Mt)),Bn(()=>{var n=t();if(e===document.activeElement){var i=Mt;if(r.has(i))return}Wi(e)&&n===Gi(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function Wi(e){var t=e.type;return t===`number`||t===`range`}function Gi(e){return e===``?null:+e}function Ki(e,t){return e===t||e?.[A]===t}function qi(e={},t,n,r){var i=Ze.r,a=lr;return Rn(()=>{var o,s;return Bn(()=>{o=s,s=r?.()||[],jr(()=>{Ki(n(...s),e)||(t(e,...s),o&&Ki(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Ki(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Ji(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?Bn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&Nn(()=>{n.removeEventListener(t,a)})}function Q(e,t,n,r){var i=!Ye||(n&2)!=0,a=(n&8)!=0,o=(n&16)!=0,s=r,c=!0,l=void 0,u=()=>o&&i?(l??=St(r),W(l)):(c&&(c=!1,s=o?jr(r):r),s);let d;if(a){var f=A in e||fe in e;d=m(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,h=!1;a?[p,h]=pt(()=>e[t]):p=e[t],p===void 0&&r!==void 0&&(p=u(),d&&(i&&De(t),d(p)));var g=i?()=>{var n=e[t];return n===void 0?u():(c=!0,n)}:()=>{var n=e[t];return n!==void 0&&(s=void 0),n===void 0?s:n};if(i&&!(n&4))return g;if(d){var _=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||_||h)&&d(t?g():e),e):g()})}var v=!1,y=(n&1?St:Tt)(()=>(v=!1,g()));a&&W(y);var b=lr;return(function(e,t){if(arguments.length>0){let n=t?W(y):i&&a?cn(e):e;return z(y,n),v=!0,s!==void 0&&(s=n),e}return ir&&v||b.f&16384?y.v:W(y)})}function Yi(e){Ze===null&&xe(`onMount`),Ye&&Ze.l!==null?Zi(Ze).m.push(e):Pn(()=>{let t=jr(e);if(typeof t==`function`)return t})}function Xi(e){Ze===null&&xe(`onDestroy`),Yi(()=>()=>jr(e))}function Zi(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`);var Qi=`gestalt-mobile.theme`,$i=`dyne-org`,ea=[{id:`dyne-org`,label:`Dyne.org`,colorScheme:`light`,logoTone:`dark`},{id:`minimal-light`,label:`Minimal light`,colorScheme:`light`,logoTone:`dark`},{id:`minimal-dark`,label:`Minimal dark`,colorScheme:`dark`,logoTone:`light`}];function ta(e){return typeof e==`string`&&ea.some(t=>t.id===e)}function na(e){return e===`light`?`minimal-light`:e===`dark`?`minimal-dark`:ta(e)?e:$i}function ra(e){return ea.find(t=>t.id===e)||ia(e)}function ia(e){throw Error(`Unknown theme ID: ${e}`)}function aa(e){try{return e?.getItem(`gestalt-mobile.theme`)??null}catch{return null}}function oa(e){if(`storage`in e)return e.storage??null;try{return window.localStorage}catch{return null}}function sa(e){return`meta`in e?e.meta??null:document.querySelector(`meta[name="color-scheme"]`)}function ca(e,t={}){let n=t.root??document.documentElement,r=sa(t),i=ra(e);return n.dataset.theme=i.id,n.dataset.logoTone=i.logoTone,n.style.colorScheme=i.colorScheme,r&&(r.content=i.colorScheme),i.id}function la(e={}){return ca(na(aa(oa(e))),e)}function ua(e,t={}){let n=ca(e,t);try{oa(t)?.setItem(Qi,n)}catch{}return n}function da(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function fa(e,t=`|`){return e.map(e=>Ra(e)).join(t)}function pa(e,t){return typeof t==`bigint`?t.toString():t}var ma=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function ha(e){return new ma(e)}function ga(e){return e==null}function _a(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function va(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function ya(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ba(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function xa(e){return ba(e._zod.def)??e._zod.def.shape}function Sa(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ya(this,t,e),e},enumerable:!0,configurable:!0})}function Ca(e,t,n){t in e?ya(e,t,n):e[t]=n}function wa(e,t,n,r){let i=xa(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Sa(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Ca(e,a,r?r(n.value,a):n.value))}}function Ta(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Sa(e,n,()=>t[n]):Ca(e,n,r.value))}}function Ea(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Da(e){return JSON.stringify(e)}function Oa(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ka=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Aa(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ja=ha(()=>{if(ko.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ma(e){if(Aa(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Aa(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Na(e){return Ma(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Pa=new Set([`string`,`number`,`symbol`]);function Fa(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ia(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function La(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Ra(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function za(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Ba={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Va={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Ha(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return wa(i,e,Ua(e,t)),Ia(e,Ea(n,{shape:i,checks:[]}))}function Ua(e,t){let n=xa(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Wa(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Ua(e,t)),a={};return wa(a,e,Reflect.ownKeys(xa(e)).filter(e=>!i.has(e))),Ia(e,Ea(n,{shape:a,checks:[]}))}function Ga(e,t){if(!Ma(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=xa(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ia(e,Ea(e._zod.def,{shape:Ka(e,t)}))}function Ka(e,t){let n={};return wa(n,e,Reflect.ownKeys(xa(e))),Ta(n,t),n}function qa(e,t){if(!Ma(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ia(e,Ea(e._zod.def,{shape:Ka(e,t)}))}function Ja(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return wa(n,e,Reflect.ownKeys(xa(e))),wa(n,t,Reflect.ownKeys(xa(t))),Ia(e,Ea(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Ya(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ua(t,n)):void 0,o={};return wa(o,t,Reflect.ownKeys(xa(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Ia(t,Ea(t._zod.def,{shape:o,checks:[]}))}function Xa(e,t,n){let r=n?new Set(Ua(t,n)):void 0,i={};return wa(i,t,Reflect.ownKeys(xa(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Ia(t,Ea(t._zod.def,{shape:i}))}function Za(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Qa(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function $a(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function eo(e){return typeof e==`string`?e:e?.message}function to(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function no(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function ro(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:eo(e.inst?._zod.def?.error?.(e))??eo(a?.(e))??eo(t?.error?.(e))??eo(n.customError?.(e))??eo(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t===`inst`||t===`schema`||t===`continue`||t===`input`||t===`__proto__`||(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var io=/[\uD800-\uDBFF]/;function ao(e){let t=e.length;if(!io.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function oo(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function so(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function co(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function lo(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):mo(e,n,r.value)}}function uo(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function fo(e,t,n){return uo(e,t,n,!1)}function po(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return uo(this,n,r(this))},set(e){uo(this,n,e)}})}return t}function mo(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:uo(this,t,n.bind(this))},set(e){uo(this,t,e)}})}function ho(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var go,_o=!1,vo={configurable:!0,get(){_o=!0}};function yo(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&go!==e._zod){go=void 0;return}go=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,vo);let e=_o;_o=!1;try{let r=n(this);return _o?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),_o||=e,r}catch(n){throw delete this[t],_o||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function bo(e,t,n,r){let i=ho(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var xo=`~constantCatch`;function So(e){let t=()=>e;return t[xo]=!0,t}var Co,wo={value:void 0,enumerable:!1},To=`captureStackTrace`in Error?Error:null;function Eo(e){let t=To;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return To=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function $(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){wo.value=new a(r);try{Object.defineProperty(n,"_zod",wo)}finally{wo.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),lo(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Eo(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Do=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Oo=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(Co=globalThis).__zod_globalConfig??(Co.__zod_globalConfig={});var ko=globalThis.__zod_globalConfig;function Ao(e){return e&&Object.assign(ko,e),ko}function jo(){let e=this._zod;return e.message??=JSON.stringify(e.def,pa,2),e.message}function Mo(e){this._zod.message=e}var No={get:jo,set:Mo,enumerable:!0,configurable:!0},Po={value:void 0,enumerable:!1},Fo=new WeakSet([Object.prototype,Error.prototype]),Io=(e,t)=>{e.name=`$ZodError`,Po.value=t,Object.defineProperty(e,"issues",Po),Po.value=void 0,Object.defineProperty(e,"message",No);let n=Object.getPrototypeOf(e);Fo.has(n)||(Fo.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Lo=$(`$ZodError`,Io);$(`$ZodError`,Io,void 0,{Parent:Error});function Ro(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function zo(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Ro(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Bo(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Vo(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Ho=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Do;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>ro(e,o,Ao())));throw ka(n,a?.callee??t),n}return s.value};return t},Uo=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>ro(e,o,Ao())));throw ka(n,a?.callee??t),n}return s.value};return t},Wo=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Do;return a.issues.length?Go(e,a.issues,i):{success:!0,data:a.value}};function Go(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>ro(e,n,Ao()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Ko=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Go(e,a.issues,i):{success:!0,data:a.value}},qo=Symbol.for(`zod.compile.invalid`),Jo=Symbol.for(`zod.compile.fallback`),Yo=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==qo)return!0;if(r.definite===!0&&n===void 0)return!1}return Xo(e,t,n)});function Xo(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Jo]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Do;return a.issues.length===0}var Zo=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Qo=e=>{let t=Ho(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Vo(n,a))};return n},$o=e=>{let t=Ho(e),n=(e,r,i,a)=>t(e,r,i,Vo(n,a));return n},es=e=>{let t=Uo(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Vo(n,a))};return n},ts=e=>{let t=Uo(e),n=async(e,r,i,a)=>await t(e,r,i,Vo(n,a));return n},ns=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wo(e)(t,n,i)},rs=e=>(t,n,r)=>Wo(e)(t,n,r),is=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ko(e)(t,n,i)},as=e=>async(t,n,r)=>Ko(e)(t,n,r),os=/^[cC][0-9a-z]{6,}$/,ss=/^[0-9a-z]+$/,cs=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ls=/^[0-9a-vA-V]{20}$/,us=/^[A-Za-z0-9]{27}$/,ds=/^[a-zA-Z0-9_-]{21}$/;function fs(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var ps=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ms=/^([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})$/,hs=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gs=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_s=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function vs(){return new RegExp(_s,`u`)}var ys=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bs=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xs=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Ss=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cs=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ws=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ts=/^https?$/,Es=/^\+[1-9]\d{6,14}$/,Ds=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Os(e){return RegExp(`^${e}$`)}var ks=Os(Ds);function As(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function js(e){return RegExp(`^${As(e)}$`)}function Ms(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${As({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${As({precision:e.precision})}`:n;return RegExp(`^${Ds}T(?:${r})$`)}var Ns=/^[\s\S]{0,}$/,Ps=/^-?\d+(?:\.\d+)?$/,Fs=/^(?:true|false)$/i,Is=/^[^A-Z]*$/,Ls=/^[^a-z]*$/,Rs=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),zs=e=>{let t=e.value;return!ga(t)&&t.length!==void 0},Bs={number:`number`,bigint:`bigint`,object:`date`},Vs=$(`$ZodCheckLessThan`,(e,t)=>{Rs.init(e,t);let n=Bs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Bs[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hs=$(`$ZodCheckGreaterThan`,(e,t)=>{Rs.init(e,t);let n=Bs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Bs[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Us=$(`$ZodCheckMultipleOf`,(e,t)=>{Rs.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):va(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Ws=$(`$ZodCheckNumberFormat`,(e,t)=>{Rs.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ba[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Gs=$(`$ZodCheckMaxLength`,(e,t)=>{var n;Rs.init(e,t),(n=e._zod.def).when??(n.when=zs),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?ao(r):i)<=t.maximum)return;let a=oo(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ks=$(`$ZodCheckMinLength`,(e,t)=>{var n;Rs.init(e,t),(n=e._zod.def).when??(n.when=zs),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?ao(r):i)>=t.minimum)return;let a=oo(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qs=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;Rs.init(e,t),(n=e._zod.def).when??(n.when=zs),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?ao(r):i;if(a===t.length)return;let o=oo(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Js=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Rs.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Ys=$(`$ZodCheckRegex`,(e,t)=>{Js.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xs=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Is,Js.init(e,t)}),Zs=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ls,Js.init(e,t)}),Qs=$(`$ZodCheckIncludes`,(e,t)=>{Rs.init(e,t);let n=Fa(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),$s=$(`$ZodCheckStartsWith`,(e,t)=>{Rs.init(e,t);let n=RegExp(`^${Fa(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ec=$(`$ZodCheckEndsWith`,(e,t)=>{Rs.init(e,t);let n=RegExp(`.*${Fa(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),tc=$(`$ZodCheckOverwrite`,(e,t)=>{Rs.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),nc=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
|
-
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
4
|
-
`)}\n};`)(...Object.values(this.closed))}},rc={major:4,minor:6,patch:7},ic=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=rc;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Za(t),a;for(let o of n){if(o._zod.def.when){if(Qa(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Do;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(no(t.issues,n,e),i||=Za(t,n))});else{if(t.issues.length===n)continue;no(t.issues,n,e),i||=Za(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Za(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Do;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Do;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return fo(this,`~standard`,sc(this))},set"~standard"(e){uo(this,`~standard`,e)}}),ac=(e,t)=>e.issues.length?{issues:e.issues.map(e=>ro(e,t,Ao()))}:{value:e.value};async function oc(e,t){let n={async:!0};return ac(await e._zod.run({value:t,issues:[]},n),n)}function sc(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ac(r,n)}catch{}return oc(e,t)},vendor:`zod`,version:1}}var cc=$(`$ZodString`,(e,t)=>{ic.init(e,t),e._zod.pattern=t.pattern??Ns,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),lc=$(`$ZodStringFormat`,(e,t)=>{Js.init(e,t),cc.init(e,t)}),uc=$(`$ZodGUID`,(e,t)=>{t.pattern??=ms,lc.init(e,t)}),dc=$(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=hs(e)}else t.pattern??=hs();lc.init(e,t)}),fc=$(`$ZodEmail`,(e,t)=>{t.pattern??=gs,lc.init(e,t)});function pc(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function mc(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?pc(e)||2:hc(e,t)}function hc(e,t){if(!t.normalize&&t.protocol?.source===Ts.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var gc=/[\t\n\r]/g;function _c(e){return e.replace(gc,``)}function vc(e,t){return t.lastIndex=0,t.test(e.hostname)}function yc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var bc=$(`$ZodURL`,(e,t)=>{lc.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=mc(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=_c(r);return}t.hostname&&!vc(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!yc(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:_c(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),xc=$(`$ZodEmoji`,(e,t)=>{t.pattern??=vs(),lc.init(e,t)}),Sc=$(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?ds:fs(t.length),lc.init(e,t)}),Cc=$(`$ZodCUID`,(e,t)=>{t.pattern??=os,lc.init(e,t)}),wc=$(`$ZodCUID2`,(e,t)=>{t.pattern??=ss,lc.init(e,t)}),Tc=$(`$ZodULID`,(e,t)=>{t.pattern??=cs,lc.init(e,t)}),Ec=$(`$ZodXID`,(e,t)=>{t.pattern??=ls,lc.init(e,t)}),Dc=$(`$ZodKSUID`,(e,t)=>{t.pattern??=us,lc.init(e,t)}),Oc=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=Ms(t),lc.init(e,t)}),kc=$(`$ZodISODate`,(e,t)=>{t.pattern??=ks,lc.init(e,t)}),Ac=$(`$ZodISOTime`,(e,t)=>{t.pattern??=js(t),lc.init(e,t)}),jc=$(`$ZodISODuration`,(e,t)=>{t.pattern??=ps,lc.init(e,t)}),Mc=$(`$ZodIPv4`,(e,t)=>{t.pattern??=ys,lc.init(e,t)}),Nc=/^[0-9a-fA-F:.]+$/;function Pc(e){return Nc.test(e)?pc(`http://[${e}]`):!1}var Fc=$(`$ZodIPv6`,(e,t)=>{t.pattern??=bs,lc.init(e,t),e._zod.check=n=>{Pc(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Ic=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=xs,lc.init(e,t)});function Lc(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Pc(n)}var Rc=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ss,lc.init(e,t),e._zod.check=n=>{Lc(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function zc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Bc=/^[0-9a-zA-Z+/]*={0,2}$/,Vc=$(`$ZodBase64`,(e,t)=>{t.pattern??=Bc,lc.init(e,t),e._zod.check=n=>{zc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Hc=/^[A-Za-z0-9_-]*$/;function Uc(e){if(!Hc.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return zc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Wc=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=Hc,lc.init(e,t),e._zod.check=n=>{Uc(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Gc=$(`$ZodE164`,(e,t)=>{t.pattern??=Es,lc.init(e,t)});function Kc(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var qc=$(`$ZodJWT`,(e,t)=>{lc.init(e,t),e._zod.check=n=>{Kc(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Jc=$(`$ZodNumber`,(e,t)=>{ic.init(e,t),e._zod.pattern=Ps,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Yc=$(`$ZodNumberFormat`,(e,t)=>{Ws.init(e,t),Jc.init(e,t)}),Xc=$(`$ZodBoolean`,(e,t)=>{ic.init(e,t),e._zod.pattern=Fs,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Zc=$(`$ZodUnknown`,(e,t)=>{ic.init(e,t),e._zod.parse=e=>e}),Qc=$(`$ZodNever`,(e,t)=>{ic.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function $c(e,t){let n=to(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of to(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,no(n.issues,t,e),n}}return i(n,a)}}var el=e=>Array.isArray(e)?e.length:-1;function tl(e,t,n){e.issues.length&&t.issues.push(...$a(n,e.issues)),t.value[n]=e.value}var nl=$(`$ZodArray`,(e,t)=>{ic.init(e,t);let n=ko.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>tl(t,r,e)));else if(tl(c,r,e),s&&c.issues.length!==0&&Za(c))break}return o.length?Promise.all(o).then(()=>r):r},$c(e,el)});function rl(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(!(!o&&s&&i===`optional`)){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...$a(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var il=[];function al(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:il,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=za(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function ol(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Za(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>rl(e,n,i,t,d,f))):rl(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var sl=$(`$ZodObject`,(e,t)=>{ic.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=ha(()=>al(t));yo(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||ya(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Aa,o=t.catchall,s,c=ko.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Za(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>rl(n,t,e,r,a,o))):rl(s,t,e,r,a,o)}return o?ol(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),cl=$(`$ZodObjectJIT`,(e,t)=>{sl.init(e,t);let n=e._zod.parse,r=ha(()=>al(t)),i=ko.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new nc([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
5
|
-
let ${e}_ab = false;
|
|
6
|
-
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
7
|
-
const iss = ${e}.issues[i];
|
|
8
|
-
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
9
|
-
payload.issues.push(iss);
|
|
10
|
-
if (iss.continue !== true) ${e}_ab = true;
|
|
11
|
-
}
|
|
12
|
-
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
13
|
-
payload.value = newResult;
|
|
14
|
-
return payload;
|
|
15
|
-
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Da(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
16
|
-
const ${n}_present = ${i};
|
|
17
|
-
if (!${n}.issues.length || ${n}_present) {
|
|
18
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (${e}) {
|
|
22
|
-
newResult[${r}] = ${n}.value;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
`)}else f?(o.write(`
|
|
27
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
28
|
-
}
|
|
29
|
-
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
30
|
-
if (${n}.value !== undefined || ${i}) {
|
|
31
|
-
newResult[${r}] = ${n}.value;
|
|
32
|
-
}
|
|
33
|
-
`)):o.write(`
|
|
34
|
-
const ${n}_present = ${i};
|
|
35
|
-
if (${n}.issues.length) {${c(n,r)}
|
|
36
|
-
}
|
|
37
|
-
if (!${n}_present && !${n}.issues.length) {
|
|
38
|
-
payload.issues.push({
|
|
39
|
-
code: "invalid_type",
|
|
40
|
-
expected: "nonoptional",
|
|
41
|
-
input: undefined,
|
|
42
|
-
path: [${r}]
|
|
43
|
-
});
|
|
44
|
-
if (ctx && ctx.abortEarly) {
|
|
45
|
-
payload.value = newResult;
|
|
46
|
-
return payload;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (${n}_present) {
|
|
51
|
-
newResult[${r}] = ${n}.value;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Aa,c=!ko.jitless,l=c&&ja.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?ol([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function ll(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Za(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>ro(e,r,Ao())))}),t)}var ul=$(`$ZodUnion`,(e,t)=>{ic.init(e,t),yo(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),yo(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),yo(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),yo(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>_a(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>ll(t,r,e,i)):ll(o,r,e,i)}});function dl(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var fl=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ul.init(e,t);let n=e._zod.parse;yo(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||ya(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=ba(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=ha(()=>dl(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Aa(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),pl=$(`$ZodIntersection`,(e,t)=>{ic.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>hl(e,t,n)):hl(e,i,a)}});function ml(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ma(e)&&Ma(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=ml(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ml(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function hl(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=ml(t.value,n.value);if(!c.valid){if(Za(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var gl=$(`$ZodEnum`,(e,t)=>{ic.init(e,t);let n=da(t.entries),r=new Set(n);e._zod.values=r,yo(e,`pattern`,e=>{let t=da(e.def.entries).filter(e=>Pa.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Fa(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),_l=$(`$ZodLiteral`,(e,t)=>{ic.init(e,t);let n=new Set(t.values);e._zod.values=n,yo(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Fa(e):e?Fa(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),vl=$(`$ZodTransform`,(e,t)=>{ic.init(e,t),e._zod.optin=`optional`,ko.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Oo(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new Do;return n.value=i,n}});function yl(e,t){return e.value=t.issues.length?void 0:t.value,e}var bl=$(`$ZodOptional`,(e,t)=>{ic.init(e,t),yo(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,yo(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),yo(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${_a(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>yl(e,t)):yl(e,r)}return t.innerType._zod.run(e,n)}}),xl=$(`$ZodExactOptional`,(e,t)=>{bl.init(e,t),yo(e,`values`,e=>e.def.innerType._zod.values),yo(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Sl=$(`$ZodNullable`,(e,t)=>{ic.init(e,t),yo(e,`optin`,e=>e.def.innerType._zod.optin),yo(e,`optout`,e=>e.def.innerType._zod.optout),yo(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${_a(t.source)}|null)$`):void 0}),yo(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Cl=$(`$ZodDefault`,(e,t)=>{ic.init(e,t),e._zod.optin=`defaulted`,yo(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wl(e,t)):wl(r,t)}});function wl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Tl=$(`$ZodPrefault`,(e,t)=>{ic.init(e,t),e._zod.optin=`defaulted`,yo(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),El=$(`$ZodNonOptional`,(e,t)=>{ic.init(e,t),yo(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Dl(t,e)):Dl(i,e)}});function Dl(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Ol(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>ro(e,r,Ao()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var kl=$(`$ZodCatch`,(e,t)=>{ic.init(e,t),yo(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),yo(e,`optout`,e=>e.def.innerType._zod.optout),yo(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Ol(e,r,t,n)):Ol(e,r,t,n)}}),Al=$(`$ZodPipe`,(e,t)=>{ic.init(e,t),yo(e,`values`,e=>e.def.in._zod.values),yo(e,`optin`,e=>e.def.in._zod.optin),yo(e,`optout`,e=>e.def.out._zod.optout),yo(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>jl(e,t.in,n)):jl(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>jl(e,t.out,n)):jl(r,t.out,n)}});function jl(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Ml=$(`$ZodReadonly`,(e,t)=>{ic.init(e,t),yo(e,`propValues`,e=>e.def.innerType._zod.propValues),yo(e,`values`,e=>e.def.innerType._zod.values),yo(e,`optin`,e=>e.def.innerType?._zod?.optin),yo(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Nl):Nl(r)}});function Nl(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Pl=$(`$ZodCustom`,(e,t)=>{Rs.init(e,t),ic.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Fl(t,n,r,e));Fl(i,n,r,e)}});function Fl(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(co(e))}}var Il=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Ll=`~memo`,Rl=[];function zl(e){return typeof e==`object`&&!!e}function Bl(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Vl=new WeakMap,Hl=0,Ul=1,Wl=2;function Gl(e,t,n){let r=Vl.get(e);if(r!==void 0)return r?Wl:Hl;if(t.has(e))return Wl;t.add(e);let i=Hl,a=e=>{if(i!==Wl&&e?._zod){let r=Gl(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Hl;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ul:o.value?._zod?Gl(o.value,t,n):Hl;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=ba(c);s(e?o(e,!0):Ul),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Gl(r,t,!1):Ul);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(!(!n||typeof n!=`object`)){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Kl(e,i)}function Kl(e,t){return t!==Ul&&Vl.set(e,t===Wl),t}function ql(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Jl,Yl=[],Xl={alloc(e,t,n){let r=Jl;if(!r)return n;Jl=void 0;let i={value:n,issues:null};return r.set(t.value,i),Yl.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Ql(n,e.value))throw new Il;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Gl(e,new Set,!1);if(i===Hl)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Wl||r?n=!0:r=!0}let l=s.value;if(!zl(l))return t(s,c);let u=c[Ll];u||(u={buckets:new WeakMap,backEdges:void 0},c[Ll]=u);let d;i===c?d=a:(d=ql(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Bl(f.issues)):(s.memo=!0,u.backEdges??=new WeakSet,u.backEdges.add(f.value)),s;Jl=d;let p=Yl.length,m=t(s,c);Jl=void 0;let h=Yl.length>p?Yl.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Bl(e.issues):Rl),e)):(h&&(h.issues=m.issues.length?Bl(m.issues):Rl),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Zl(){return Xl}function Ql(e,t){let n=e[Ll]?.backEdges;return n!==void 0&&zl(t)&&n.has(t)}var $l=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(so(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Ra(e.values[0])}`:`Invalid option: expected one of ${fa(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${fa(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function eu(){return{localeError:$l()}}var tu,nu=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function ru(){return new nu}(tu=globalThis).__zod_globalRegistry??(tu.__zod_globalRegistry=ru());var iu=globalThis.__zod_globalRegistry;function au(e){return e.checks&&=[...e.checks],e}function ou(e,t){return new e(au({type:`string`,...La(t)}))}function su(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...La(t)})}function cu(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...La(t)})}function lu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...La(t)})}function uu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...La(t)})}function du(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...La(t)})}function fu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...La(t)})}function pu(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...La(t)})}function mu(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...La(t)})}function hu(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...La(t)})}function gu(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...La(t)})}function _u(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...La(t)})}function vu(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...La(t)})}function yu(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...La(t)})}function bu(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...La(t)})}function xu(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...La(t)})}function Su(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...La(t)})}function Cu(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...La(t)})}function wu(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...La(t)})}function Tu(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...La(t)})}function Eu(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...La(t)})}function Du(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...La(t)})}function Ou(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...La(t)})}function ku(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...La(t)})}function Au(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...La(t)})}function ju(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...La(t)})}function Mu(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...La(t)})}function Nu(e,t){return new e(au({type:`number`,checks:[],...La(t)}))}function Pu(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...La(t)})}function Fu(e,t){return new e({type:`boolean`,...La(t)})}function Iu(e){return new e({type:`unknown`})}function Lu(e,t){return new e({type:`never`,...La(t)})}function Ru(e,t){return new Vs({check:`less_than`,...La(t),value:e,inclusive:!1})}function zu(e,t){return new Vs({check:`less_than`,...La(t),value:e,inclusive:!0})}function Bu(e,t){return new Hs({check:`greater_than`,...La(t),value:e,inclusive:!1})}function Vu(e,t){return new Hs({check:`greater_than`,...La(t),value:e,inclusive:!0})}function Hu(e,t){return new Us({check:`multiple_of`,...La(t),value:e})}function Uu(e,t){return new Gs({check:`max_length`,...La(t),maximum:e})}function Wu(e,t){return new Ks({check:`min_length`,...La(t),minimum:e})}function Gu(e,t){return new qs({check:`length_equals`,...La(t),length:e})}function Ku(e,t){return new Ys({check:`string_format`,format:`regex`,...La(t),pattern:e})}function qu(e){return new Xs({check:`string_format`,format:`lowercase`,...La(e)})}function Ju(e){return new Zs({check:`string_format`,format:`uppercase`,...La(e)})}function Yu(e,t){return new Qs({check:`string_format`,format:`includes`,...La(t),includes:e})}function Xu(e,t){return new $s({check:`string_format`,format:`starts_with`,...La(t),prefix:e})}function Zu(e,t){return new ec({check:`string_format`,format:`ends_with`,...La(t),suffix:e})}function Qu(e){return new tc({check:`overwrite`,tx:e})}function $u(e){return Qu(t=>t.normalize(e))}function ed(){return Qu(e=>e.trim())}function td(){return Qu(e=>e.toLowerCase())}function nd(){return Qu(e=>e.toUpperCase())}function rd(){return Qu(e=>Oa(e))}function id(e,t,n){return new e({type:`array`,element:t,...La(n)})}function ad(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...La(n)})}function od(e,t){let n=sd(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(co(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(co(r))}},e(t.value,t)),t);return n}function sd(e,t){let n=new Rs({check:`custom`,...La(t)});return n._zod.check=e,n}function cd(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&ya(e,t,n[t]);return e}function ld(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??iu,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function ud(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function dd(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,dd(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&cd(o.schema,c),t.io===`input`&&xd(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function fd(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function pd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${fd(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+fd(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
55
|
-
|
|
56
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function md(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;md(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var hd=new Set([`type`,`properties`,`required`,`additionalProperties`]),gd=[`oneOf`,`anyOf`];function _d(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function vd(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!hd.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??_d(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ya(n,r,e.length===1?e[0]:vd(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=_d(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function yd(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of hd)if(t in e)return;let n=t.filter(e=>gd.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=vd(t);else{let e=n[0],i=gd.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>vd([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,cd(e,r))}function bd(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):cd(i,s),cd(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())md(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])yd(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}cd(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,ya(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Cd(t,`input`,e.processors),output:Cd(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function xd(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return xd(r.element,n);if(r.type===`set`)return xd(r.valueType,n);if(r.type===`lazy`)return xd(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return xd(r.innerType,n);if(r.type===`intersection`)return xd(r.left,n)||xd(r.right,n);if(r.type===`record`||r.type===`map`)return xd(r.keyType,n)||xd(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:xd(r.in,n)||xd(r.out,n);if(r.type===`object`){for(let e in r.shape)if(xd(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(xd(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(xd(e,n))return!0;return!!(r.rest&&xd(r.rest,n))}return!1}var Sd=(e,t={})=>n=>{let r=ld({...n,processors:t});return dd(e,r),pd(r,e),bd(r,e)},Cd=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ld({...i??{},target:a,io:t,processors:n});return dd(e,o),pd(o,e),bd(o,e)},wd=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Td=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Ed=(e,t)=>{wd(e,`minimum`,t),Td(e,`maximum`,t)},Dd=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Od=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},kd=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Ad=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},jd=(e,t)=>wd(e,`minimum`,t.minimum),Md=(e,t)=>Td(e,`maximum`,t.maximum),Nd=e=>(t,n)=>{Ad(t,n.format);let[r,i]=e[n.format];wd(t,`minimum`,r),Td(t,`maximum`,i)},Pd={greater_than:(e,t)=>wd(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Td(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Dd(e,t.value),number_format:Nd(Ba),bigint_format:Nd(Va),min_length:jd,max_length:Md,length_equals:(e,t)=>Ed(e,t.length),min_size:jd,max_size:Md,size_equals:(e,t)=>Ed(e,t.size),string_format:(e,t)=>{Ad(e,t.format),t.pattern&&Od(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>kd(e,t.mime)};function Fd(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Pd[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&wd(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&wd(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Td(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Td(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Dd(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&kd(t,i.mime);for(let e of i.patterns??[])Od(t,e);return t}var Id={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Ld=new Map([[Bc,Cs],[Hc,ws]]),Rd=e=>Ld.get(e)??e,zd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Fd(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Id[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Rd);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Bd=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Fd(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):ud(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},Vd=(e,t,n,r)=>{n.type=`boolean`},Hd=(e,t,n,r)=>{n.not={}},Ud=(e,t,n,r)=>{let i=e._zod.def,a=da(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Wd=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(ud(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(ud(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},Gd=(e,t,n,r)=>{ud(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Kd=(e,t,n,r)=>{ud(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},qd=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Fd(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=dd(a.element,t,{...r,path:[...r.path,`items`]})};function Jd(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Jd(t.out):t.type===`catch`?Jd(t.innerType):e._zod.optin}var Yd=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&ud(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)ya(i.properties,e,dd(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Jd(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=dd(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Xd=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>dd(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Zd=(e,t,n,r)=>{let i=e._zod.def,a=dd(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=dd(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)},Qd=(e,t,n,r)=>{let i=e._zod.def,a=dd(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},$d=(e,t,n,r)=>{let i=e._zod.def;dd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ef=Symbol();function tf(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(ud(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),ef):JSON.parse(o)}var nf=(e,t,n,r)=>{let i=e._zod.def;dd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=tf(i.defaultValue,e,t,n,r);o!==ef&&(n.default=o)},rf=(e,t,n,r)=>{let i=e._zod.def;dd(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=tf(i.defaultValue,e,t,n,r);o!==ef&&(n._prefault=o)},af=(e,t,n,r)=>{let i=e._zod.def;dd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{ud(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},of=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;dd(o,t,r);let s=t.seen.get(e);s.ref=o},sf=(e,t,n,r)=>{let i=e._zod.def;dd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},cf=(e,t,n,r)=>{let i=e._zod.def;dd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},lf=new WeakSet([Object.prototype,Error.prototype]);function uf(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var df=$(`ZodError`,(e,t)=>{Lo.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);lf.has(n)||(lf.add(n),uf(n,`format`,e=>t=>Bo(e,t)),uf(n,`flatten`,e=>t=>zo(e,t)),uf(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,pa,2)}),uf(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,pa,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),ff=Ho(df),pf=Uo(df),mf=Wo(df),hf=Ko(df),gf=Qo(df),_f=$o(df),vf=es(df),yf=ts(df),bf=ns(df),xf=rs(df),Sf=is(df),Cf=as(df);function wf(){ko.localeError||Ao(eu())}function Tf(){ko.memoizer||Ao({memoizer:Zl()})}var Ef=$(`ZodType`,(e,t)=>(wf(),ic.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Ea(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ia(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Gp(e,t))},superRefine(e,t){return this.check(Kp(e,t))},overwrite(e){return this.check(Qu(e))},optional(){return Dp(this)},exactOptional(){return kp(this)},nullable(){return jp(this)},nullish(){return Dp(jp(this))},nonoptional(e){return Lp(this,e)},array(){return dp(this)},or(e){return hp([this,e])},and(e){return yp(this,e)},transform(e){return Vp(this,Tp(e))},default(e){return Np(this,e)},prefault(e){return Fp(this,e)},catch(e){return zp(this,e)},pipe(e){return Vp(this,e)},readonly(){return Up(this)},describe(e){let t=this.clone();return iu.add(t,{description:e}),t},meta(...e){if(e.length===0)return iu.get(this);let t=this.clone();return iu.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return fo(this,`~standard`,{...sc(this),jsonSchema:{input:Cd(this,`input`),output:Cd(this,`output`)}})},set"~standard"(e){uo(this,`~standard`,e)},parse:function e(t,n){return ff(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await pf(this,t,n,{callee:e})},safeParse(e,t){return mf(this,e,t)},async safeParseAsync(e,t){return hf(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){uo(this,`spa`,e)},validate(e,t){return Yo(this,e,t)},validateAsync(e,t){return Zo(this,e,t)},encode:function e(t,n){return gf(this,t,n,{callee:e})},decode:function e(t,n){return _f(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await vf(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await yf(this,t,n,{callee:e})},safeEncode(e,t){return bf(this,e,t)},safeDecode(e,t){return xf(this,e,t)},async safeEncodeAsync(e,t){return Sf(this,e,t)},async safeDecodeAsync(e,t){return Cf(this,e,t)},toJSONSchema(e){return Sd(this,{})(e)},get description(){return iu.get(this)?.description},get _def(){return this._zod.def}}),Df=$(`_ZodString`,(e,t)=>{cc.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zd(e,t,n,r)},po({format:e=>Fd(e).format??null,minLength:e=>Fd(e).minimum??null,maxLength:e=>Fd(e).maximum??null},{regex(...e){return this.check(Ku(...e))},includes(...e){return this.check(Yu(...e))},startsWith(...e){return this.check(Xu(...e))},endsWith(...e){return this.check(Zu(...e))},min(...e){return this.check(Wu(...e))},max(...e){return this.check(Uu(...e))},length(...e){return this.check(Gu(...e))},nonempty(...e){return this.check(Wu(1,...e))},lowercase(e){return this.check(qu(e))},uppercase(e){return this.check(Ju(e))},trim(){return this.check(ed())},normalize(...e){return this.check($u(...e))},toLowerCase(){return this.check(td())},toUpperCase(){return this.check(nd())},slugify(){return this.check(rd())}})),Of=$(`ZodString`,(e,t)=>{cc.init(e,t),Df.init(e,t)},{email(e){return this.check(su(Ff,e))},url(e){return this.check(pu(Rf,e))},jwt(e){return this.check(Ou($f,e))},emoji(e){return this.check(mu(zf,e))},guid(e){return this.check(cu(If,e))},uuid(e){return this.check(lu(Lf,e))},uuidv4(e){return this.check(uu(Lf,e))},uuidv6(e){return this.check(du(Lf,e))},uuidv7(e){return this.check(fu(Lf,e))},nanoid(e){return this.check(hu(Bf,e))},cuid(e){return this.check(gu(Vf,e))},cuid2(e){return this.check(_u(Hf,e))},ulid(e){return this.check(vu(Uf,e))},base64(e){return this.check(Tu(Xf,e))},base64url(e){return this.check(Eu(Zf,e))},xid(e){return this.check(yu(Wf,e))},ksuid(e){return this.check(bu(Gf,e))},ipv4(e){return this.check(xu(Kf,e))},ipv6(e){return this.check(Su(qf,e))},cidrv4(e){return this.check(Cu(Jf,e))},cidrv6(e){return this.check(wu(Yf,e))},e164(e){return this.check(Du(Qf,e))},datetime(e){return this.check(ku(jf,e))},date(e){return this.check(Au(Mf,e))},time(e){return this.check(ju(Nf,e))},duration(e){return this.check(Mu(Pf,e))}});function kf(e){return ou(Of,e)}var Af=$(`ZodStringFormat`,(e,t)=>{lc.init(e,t),Df.init(e,t)}),jf=$(`ZodISODateTime`,(e,t)=>{Oc.init(e,t),Af.init(e,t)}),Mf=$(`ZodISODate`,(e,t)=>{kc.init(e,t),Af.init(e,t)}),Nf=$(`ZodISOTime`,(e,t)=>{Ac.init(e,t),Af.init(e,t)}),Pf=$(`ZodISODuration`,(e,t)=>{jc.init(e,t),Af.init(e,t)}),Ff=$(`ZodEmail`,(e,t)=>{fc.init(e,t),Af.init(e,t)}),If=$(`ZodGUID`,(e,t)=>{uc.init(e,t),Af.init(e,t)}),Lf=$(`ZodUUID`,(e,t)=>{dc.init(e,t),Af.init(e,t)}),Rf=$(`ZodURL`,(e,t)=>{bc.init(e,t),Af.init(e,t)}),zf=$(`ZodEmoji`,(e,t)=>{xc.init(e,t),Af.init(e,t)}),Bf=$(`ZodNanoID`,(e,t)=>{Sc.init(e,t),Af.init(e,t)}),Vf=$(`ZodCUID`,(e,t)=>{Cc.init(e,t),Af.init(e,t)}),Hf=$(`ZodCUID2`,(e,t)=>{wc.init(e,t),Af.init(e,t)}),Uf=$(`ZodULID`,(e,t)=>{Tc.init(e,t),Af.init(e,t)}),Wf=$(`ZodXID`,(e,t)=>{Ec.init(e,t),Af.init(e,t)}),Gf=$(`ZodKSUID`,(e,t)=>{Dc.init(e,t),Af.init(e,t)}),Kf=$(`ZodIPv4`,(e,t)=>{Mc.init(e,t),Af.init(e,t)}),qf=$(`ZodIPv6`,(e,t)=>{Fc.init(e,t),Af.init(e,t)}),Jf=$(`ZodCIDRv4`,(e,t)=>{Ic.init(e,t),Af.init(e,t)}),Yf=$(`ZodCIDRv6`,(e,t)=>{Rc.init(e,t),Af.init(e,t)}),Xf=$(`ZodBase64`,(e,t)=>{Vc.init(e,t),Af.init(e,t)}),Zf=$(`ZodBase64URL`,(e,t)=>{Wc.init(e,t),Af.init(e,t)}),Qf=$(`ZodE164`,(e,t)=>{Gc.init(e,t),Af.init(e,t)}),$f=$(`ZodJWT`,(e,t)=>{qc.init(e,t),Af.init(e,t)}),ep=$(`ZodNumber`,(e,t)=>{Jc.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bd(e,t,n,r),e.isFinite=!0},po({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Fd(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Fd(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Fd(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Fd(e).format??null},{gt(e,t){return this.check(Bu(e,t))},gte(e,t){return this.check(Vu(e,t))},min(e,t){return this.check(Vu(e,t))},lt(e,t){return this.check(Ru(e,t))},lte(e,t){return this.check(zu(e,t))},max(e,t){return this.check(zu(e,t))},int(e){return this.check(rp(e))},safe(e){return this.check(rp(e))},positive(e){return this.check(Bu(0,e))},nonnegative(e){return this.check(Vu(0,e))},negative(e){return this.check(Ru(0,e))},nonpositive(e){return this.check(zu(0,e))},multipleOf(e,t){return this.check(Hu(e,t))},step(e,t){return this.check(Hu(e,t))},finite(){return this}}));function tp(e){return Nu(ep,e)}var np=$(`ZodNumberFormat`,(e,t)=>{Yc.init(e,t),ep.init(e,t)});function rp(e){return Pu(np,e)}var ip=$(`ZodBoolean`,(e,t)=>{Xc.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vd(e,t,n,r)});function ap(e){return Fu(ip,e)}var op=$(`ZodUnknown`,(e,t)=>{Zc.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sp(){return Iu(op)}var cp=$(`ZodNever`,(e,t)=>{Qc.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hd(e,t,n,r)});function lp(e){return Lu(cp,e)}var up=$(`ZodArray`,(e,t)=>{Tf(),nl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qd(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Wu(e,t))},nonempty(e){return this.check(Wu(1,e))},max(e,t){return this.check(Uu(e,t))},length(e,t){return this.check(Gu(e,t))},unwrap(){return this.element}});function dp(e,t){return id(up,e,t)}var fp=$(`ZodObject`,(e,t)=>{Tf(),cl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yd(e,t,n,r),bo(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return xp(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Ea(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Ea(this._zod.def,{catchall:sp()}))},loose(){return this.clone(Ea(this._zod.def,{catchall:sp()}))},strict(){return this.clone(Ea(this._zod.def,{catchall:lp()}))},strip(){return this.clone(Ea(this._zod.def,{catchall:void 0}))},extend(e){return Ga(this,e)},safeExtend(e){return qa(this,e)},merge(e){return Ja(this,e)},pick(e){return Ha(this,e)},omit(e){return Wa(this,e)},partial(...e){return Ya(Ep,this,e[0])},exactPartial(...e){return Ya(Op,this,e[0],`exactPartial`)},required(...e){return Xa(Ip,this,e[0])}});function pp(e,t){return new fp({type:`object`,shape:e??{},...La(t)})}var mp=$(`ZodUnion`,(e,t)=>{ul.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xd(e,t,n,r),e.options=t.options});function hp(e,t){return new mp({type:`union`,options:e,...La(t)})}var gp=$(`ZodDiscriminatedUnion`,(e,t)=>{mp.init(e,t),fl.init(e,t)});function _p(e,t,n){return new gp({type:`union`,options:t,discriminator:e,...La(n)})}var vp=$(`ZodIntersection`,(e,t)=>{pl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r)});function yp(e,t){return new vp({type:`intersection`,left:e,right:t})}var bp=$(`ZodEnum`,(e,t)=>{gl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ud(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new bp({...t,checks:[],...La(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new bp({...t,checks:[],...La(r),entries:i})}});function xp(e,t){return new bp({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...La(t)})}var Sp=$(`ZodLiteral`,(e,t)=>{_l.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wd(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Cp(e,t){return new Sp({type:`literal`,values:Array.isArray(e)?e:[e],...La(t)})}var wp=$(`ZodTransform`,(e,t)=>{Tf(),vl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kd(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Oo(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(co(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(co(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Tp(e){return new wp({type:`transform`,transform:e})}var Ep=$(`ZodOptional`,(e,t)=>{bl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dp(e){return new Ep({type:`optional`,innerType:e})}var Op=$(`ZodExactOptional`,(e,t)=>{xl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kp(e){return new Op({type:`optional`,innerType:e})}var Ap=$(`ZodNullable`,(e,t)=>{Sl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jp(e){return new Ap({type:`nullable`,innerType:e})}var Mp=$(`ZodDefault`,(e,t)=>{Cl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Np(e,t){return new Mp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Na(t)}})}var Pp=$(`ZodPrefault`,(e,t)=>{Tl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Fp(e,t){return new Pp({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Na(t)}})}var Ip=$(`ZodNonOptional`,(e,t)=>{El.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lp(e,t){return new Ip({type:`nonoptional`,innerType:e,...La(t)})}var Rp=$(`ZodCatch`,(e,t)=>{kl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>af(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function zp(e,t){return new Rp({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:So(t)})}var Bp=$(`ZodPipe`,(e,t)=>{Al.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),e.in=t.in,e.out=t.out});function Vp(e,t){return new Bp({type:`pipe`,in:e,out:t})}var Hp=$(`ZodReadonly`,(e,t)=>{Ml.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Up(e){return new Hp({type:`readonly`,innerType:e})}var Wp=$(`ZodCustom`,(e,t)=>{Pl.init(e,t),Ef.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gd(e,t,n,r)});function Gp(e,t={}){return ad(Wp,e,t)}function Kp(e,t){return od(e,t)}var qp=[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],Jp={model:`gpt-6.1-sol`,reasoningEffort:`medium`,executorModel:`gpt-5.6-terra`,executorReasoningEffort:`high`,sandbox:`workspace-git`,approvalPolicy:`never`};function Yp(e,t){return e===`codex`&&t.includes(Jp.model)?Jp.model:t[0]??(e===`codex`?Jp.model:``)}pp({workspaceId:kf().max(4096),skillProfile:kf().max(256),provider:xp([`codex`,`kimi`]),model:kf().min(1).max(256),reasoningEffort:xp(qp).default(Jp.reasoningEffort),executorModel:kf().trim().min(1).max(256).default(Jp.executorModel),executorReasoningEffort:xp(qp).default(Jp.executorReasoningEffort),sandbox:xp([`workspace-git`,`workspace-write`,`read-only`,`danger-full-access`]),approvalPolicy:xp([`untrusted`,`on-request`,`never`])}).strict();function Xp(e,t,n){return{workspaceId:e?.workspaceId??``,skillProfile:e?.skillProfile??``,provider:t,model:e?.provider===t?e.model:Yp(t,n),reasoningEffort:e?.reasoningEffort??Jp.reasoningEffort,executorModel:e?.executorModel??Jp.executorModel,executorReasoningEffort:e?.executorReasoningEffort??Jp.executorReasoningEffort,sandbox:e?.sandbox??Jp.sandbox,approvalPolicy:e?.approvalPolicy??Jp.approvalPolicy}}function Zp(e){return e===`ready`?`Ready`:e===`stale`?`Stale`:e===`unavailable`?`Degraded`:`Unverified`}function Qp(e){let t=[e.symbols?.state,e.references?.state];return t.includes(`unavailable`)?`unavailable`:t.includes(`stale`)?`stale`:t.every(e=>e===`ready`)?`ready`:`unknown`}function $p(e){return e.split(/[\\/]/).filter(Boolean).at(-1)?.replace(/[\u0000-\u001f\u007f]/g,``).slice(0,96)||`Repository`}var em=K(`<div class="svelte-1y2qpvc"><dt class="svelte-1y2qpvc">Serena connection</dt> <dd class="svelte-1y2qpvc"> </dd></div>`),tm=K(`<dl class="svelte-1y2qpvc"></dl>`),nm=K(`<small class="identity svelte-1y2qpvc">Observed <time> </time></small>`),rm=K(`<li class="svelte-1y2qpvc"><strong class="svelte-1y2qpvc"> </strong> <small class="identity svelte-1y2qpvc"> </small> <dl class="svelte-1y2qpvc"><div class="svelte-1y2qpvc"><dt class="svelte-1y2qpvc">Symbols</dt> <dd class="svelte-1y2qpvc"> </dd></div> <div class="svelte-1y2qpvc"><dt class="svelte-1y2qpvc">References</dt> <dd class="svelte-1y2qpvc"> </dd></div> <div class="svelte-1y2qpvc"><dt class="svelte-1y2qpvc">Repository index</dt> <dd class="svelte-1y2qpvc"> </dd></div></dl> <!></li>`),im=K(`<ul class="svelte-1y2qpvc"></ul> <p class="svelte-1y2qpvc">Symbol and reference results apply to the observed source only. Compiler selection is
|
|
57
|
-
unverified.</p>`,1),am=K(`<p class="svelte-1y2qpvc">No repository evidence yet. Read permissions may be unavailable in restricted profiles.
|
|
58
|
-
Compiler selection and repository index coverage are unverified.</p>`),om=K(`<section aria-labelledby="retrieval-readiness-title" class="tool-readiness svelte-1y2qpvc"><h2 id="retrieval-readiness-title" class="svelte-1y2qpvc">Repository tools</h2> <details><summary class="svelte-1y2qpvc"> </summary> <div class="readiness-details svelte-1y2qpvc"><!> <!> <p class="svelte-1y2qpvc">Connection alone does not verify semantic tools. Continue with current source when a check
|
|
59
|
-
is unverified.</p> <button type="button" class="svelte-1y2qpvc"> </button></div></details></section>`);function sm(e,t){I(t,!0);let n=Q(t,`status`,3,null),r=Q(t,`loading`,3,!1),i=Q(t,`onrefresh`,3,()=>{}),a=L(()=>Array.isArray(n()?.repositories)?n().repositories:[]),o=L(()=>Array.isArray(n()?.connections)?n().connections.filter(e=>e.serverName===`gestalt-serena`):[]),s=L(()=>W(a).map(e=>Qp(e.readiness))),c=L(()=>W(s).includes(`unavailable`)?`unavailable`:W(s).includes(`stale`)?`stale`:W(s).length&&W(s).every(e=>e===`ready`)?`ready`:`unknown`),l=L(()=>W(c)===`ready`?`Ready on observed source`:Zp(W(c)));var u=om(),d=H(B(u),2),f=B(d),p=B(f,!0);P(f);var m=H(f,2),h=B(m),g=e=>{var t=tm();X(t,21,()=>W(o),e=>e.serverName,(e,t)=>{var n=em(),r=H(B(n),2),i=B(r,!0);P(r),P(n),U(e=>J(i,e),[()=>Zp(W(t).readiness?.connection?.state)]),q(e,n)}),P(t),q(e,t)};Y(h,e=>{W(o).length&&e(g)});var _=H(h,2),v=e=>{var t=im(),n=V(t);X(n,21,()=>W(a),e=>`${e.threadId}:${e.readiness.repository?.id}`,(e,t)=>{let n=L(()=>[W(t).readiness.symbols?.observedAt,W(t).readiness.references?.observedAt].filter(e=>!!e).sort().at(-1));var r=rm(),i=B(r),a=B(i,!0);P(i);var o=H(i,2),s=B(o);P(o);var c=H(o,2),l=B(c),u=H(B(l),2),d=B(u,!0);P(u),P(l);var f=H(l,2),p=H(B(f),2),m=B(p,!0);P(p),P(f);var h=H(f,2),g=H(B(h),2),_=B(g,!0);P(g),P(h),P(c);var v=H(c,2),y=e=>{var t=nm(),r=H(B(t)),i=B(r,!0);P(r),P(t),U(e=>{Z(r,`datetime`,W(n)),J(i,e)},[()=>new Date(W(n)).toLocaleString()]),q(e,t)};Y(v,e=>{W(n)&&e(y)}),P(r),U((e,t,n,r,i,o,l)=>{J(a,e),J(s,`${t??``} · runtime ${n??``}`),Z(c,`aria-label`,r),J(d,i),J(m,o),J(_,l)},[()=>$p(W(t).readiness.repository?.label??`Repository`),()=>W(t).readiness.repository?.id.slice(0,8),()=>W(t).threadId.slice(0,8),()=>`${$p(W(t).readiness.repository?.label??`Repository`)} capability observations`,()=>Zp(W(t).readiness.symbols?.state),()=>Zp(W(t).readiness.references?.state),()=>Zp(W(t).readiness.coverage?.state)]),q(e,r)}),P(n),F(2),q(e,t)},y=e=>{q(e,am())};Y(_,e=>{W(a).length?e(v):e(y,-1)});var b=H(_,4),x=B(b,!0);P(b),P(m),P(d),P(u),U(()=>{Z(u,`aria-busy`,r()),Z(f,`aria-label`,`Repository tool readiness: ${W(l)}`),J(p,W(l)),b.disabled=r(),J(x,r()?`Checking readiness…`:`Refresh tool readiness`)}),G(`click`,b,function(...e){i()?.apply(this,e)}),q(e,u),$e()}Vr([`click`]);var cm=K(`<img class="brand-icon brand-icon-custom" alt=""/>`),lm=K(`<img class="brand-icon light-asset" src="/branding/p_glogo_grey.svg" alt=""/> <img class="brand-icon dark-asset" src="/branding/p_glogo_white.svg" alt=""/>`,1),um=K(`<span class="session-model svelte-t9laac"><small> </small></span>`),dm=K(`<p class="session-path svelte-t9laac"> <!></p>`),fm=K(`<span class="weekly-quota" aria-label="Weekly quota remaining"> </span>`),pm=K(`<button class="detach-chat svelte-t9laac" type="button" aria-label="Open Chat in a separate window" title="Open Chat in a separate window"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-t9laac"><path d="M14 5h5v5M19 5l-8 8"></path><path d="M18 13v5a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"></path></svg></button>`),mm=K(`<option> </option>`),hm=K(`<button type="button" popovertarget="configuration-panel" popovertargetaction="hide"> </button>`),gm=K(`<button type="button" popovertarget="configuration-panel" popovertargetaction="hide">Copy session to CLI</button>`),_m=K(`<button type="button" popovertarget="configuration-panel" popovertargetaction="hide">Authorized devices</button> <button type="button" class="lock-relay" popovertarget="configuration-panel" popovertargetaction="hide">Lock Gestalt Mobile</button>`,1),vm=K(`<small class="svelte-t9laac"> </small>`),ym=K(` <!>`,1),bm=K(`<div><dt class="svelte-t9laac"> </dt> <dd> <!></dd></div>`),xm=K(`<section class="component-versions svelte-t9laac" aria-labelledby="component-versions-title"><h2 id="component-versions-title" class="svelte-t9laac">Versions</h2> <dl class="svelte-t9laac"></dl></section>`),Sm=K(`<p id="clean-tmp-status" role="status">Cleaning temporary files…</p>`),Cm=K(`<p role="status" class="svelte-t9laac">Updating and waiting for Mobile to reconnect…</p>`),wm=K(`<header class="app-header"><a class="brand" href="/" aria-label="Gestalt Mobile"><!> <img class="brand-logotype light-asset" src="/branding/t_glogo_grey.svg" alt=""/> <img class="brand-logotype dark-asset" src="/branding/t_glogo_white.svg" alt=""/></a> <!> <div class="header-actions"><!> <!> <button class="menu-trigger" type="button" popovertarget="configuration-panel" aria-label="Open configuration"><span class="menu-lines" aria-hidden="true"><span></span><span></span><span></span></span></button></div></header> <div id="configuration-panel" class="configuration-panel" popover="auto"><div class="configuration-brand" aria-label="Dyne"><img class="configuration-logo light-asset" src="/branding/dyne-logotype-black.svg" alt=""/> <img class="configuration-logo dark-asset" src="/branding/dyne-logotype-white.svg" alt=""/></div> <label class="appearance-control" for="appearance"><span aria-hidden="true">aA</span> <select id="appearance" aria-label="Appearance"></select></label> <!> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide">Notifications</button> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide">Scratchpad</button> <!> <!> <!> <!> <div class="maintenance-actions svelte-t9laac"><button type="button" class="svelte-t9laac">Clean TMP</button> <!> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="svelte-t9laac">Upgrade</button> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="quit-relay svelte-t9laac">Quit</button></div></div> <dialog aria-labelledby="quit-title" aria-describedby="quit-description" class="svelte-t9laac"><h2 id="quit-title" class="svelte-t9laac">Quit Gestalt Mobile?</h2> <p id="quit-description" class="svelte-t9laac">This stops Gestalt Mobile and every session process it started, including work that is currently
|
|
60
|
-
running. Saved sessions remain available the next time Gestalt Mobile starts.</p> <div class="dialog-actions svelte-t9laac"><button type="button" class="svelte-t9laac">Cancel</button> <button class="confirm-quit svelte-t9laac" type="button"> </button></div></dialog> <dialog aria-labelledby="upgrade-title" aria-describedby="upgrade-description" class="svelte-t9laac"><h2 id="upgrade-title" class="svelte-t9laac">Upgrade Gestalt?</h2> <p id="upgrade-description" class="svelte-t9laac">Update Gestalt, Agents, Mobile, context-mode, and installed Serena components, then restart
|
|
61
|
-
Mobile with its current settings. Running work will be interrupted when Mobile restarts. Saved
|
|
62
|
-
sessions are preserved, and this page will reconnect automatically.</p> <!> <div class="dialog-actions svelte-t9laac"><button type="button" class="svelte-t9laac">Cancel</button> <button type="button" class="svelte-t9laac"> </button></div></dialog>`,1);function Tm(e,t){I(t,!0);let n=Q(t,`sessionPath`,3,null),r=Q(t,`sessionModel`,3,null),i=Q(t,`weeklyQuotaRemaining`,3,null),a=Q(t,`brandIconUrl`,3,null),o=Q(t,`passkeyAuthEnabled`,3,!0),s=Q(t,`componentVersions`,19,()=>[]),c=Q(t,`readinessLoading`,3,!1),l=Q(t,`onreadinessrefresh`,3,()=>{}),u=Q(t,`onconfigurationchange`,3,()=>{}),d=Q(t,`contextualActions`,19,()=>[]),f=Q(t,`onlock`,3,()=>{}),p=Q(t,`ondevices`,3,()=>{}),m=Q(t,`onnotifications`,3,()=>{}),h=Q(t,`onscratchpad`,3,()=>{}),g=Q(t,`oncleantmp`,3,async()=>{}),_=Q(t,`cleanTmpPending`,3,!1),v=Q(t,`onquit`,3,async()=>{}),y=Q(t,`onupgrade`,3,async()=>{}),b=Q(t,`copyToCliAvailable`,3,!0),x=R(null),S=R(null),C=R(null),w=R(null),T=R(!1),E=R(null),D=R(null),O=R(!1);async function k(){await g()(),W(S)?.hidePopover&&W(S).matches(`:popover-open`)&&(W(S).hidePopover(),W(x)?.focus())}function ee(){W(E)?.showModal(),queueMicrotask(()=>W(D)?.focus())}async function te(){if(!W(O)){z(O,!0);try{await y()()}catch{z(O,!1)}}}function ne(){W(C)?.showModal(),queueMicrotask(()=>W(w)?.focus())}async function re(){z(T,!0);try{await v()()}catch{z(T,!1)}}function ie(){W(T)||W(C)?.close()}function ae(){!W(T)&&!W(O)&&queueMicrotask(()=>W(x)?.focus())}var oe=wm(),se=V(oe),ce=B(se),le=B(ce),ue=e=>{var t=cm();U(()=>Z(t,`src`,a())),q(e,t)},de=e=>{var t=lm();F(2),q(e,t)};Y(le,e=>{a()?e(ue):e(de,-1)}),F(4),P(ce);var A=H(ce,2),fe=e=>{var t=dm(),i=B(t,!0),a=H(i),o=e=>{var t=um(),n=B(t),i=B(n);P(n),P(t),U(()=>J(i,`· ${r()??``}`)),q(e,t)};Y(a,e=>{r()&&e(o)}),P(t),U(()=>{Z(t,`title`,n()),J(i,n())}),q(e,t)};Y(A,e=>{n()&&e(fe)});var pe=H(A,2),me=B(pe),he=e=>{var t=fm(),n=B(t);P(t),U(()=>J(n,`${i()??``}% left`)),q(e,t)};Y(me,e=>{i()!==null&&e(he)});var ge=H(me,2),_e=e=>{var n=pm();G(`click`,n,function(...e){t.ondetach?.apply(this,e)}),q(e,n)};Y(ge,e=>{t.ondetach&&e(_e)}),qi(H(ge,2),e=>z(x,e),()=>W(x)),P(pe),P(se);var ve=H(se,2),ye=H(B(ve),2),be=H(B(ye),2);X(be,21,()=>ea,e=>e.id,(e,t)=>{var n=mm(),r=B(n,!0);P(n);var i={};U(()=>{J(r,W(t).label),i!==(i=W(t).id)&&(n.value=(n.__value=W(t).id)??``)}),q(e,n)}),P(be);var xe;Ai(be),P(ye);var Se=H(ye,2);X(Se,17,d,e=>e.id,(e,t)=>{var n=hm(),r=B(n,!0);P(n),U(()=>J(r,W(t).label)),G(`click`,n,function(...e){W(t).run?.apply(this,e)}),q(e,n)});var j=H(Se,2),Ce=H(j,2),we=H(Ce,2),Te=e=>{var n=gm();U(()=>n.disabled=!b()),G(`click`,n,function(...e){t.oncopytocli?.apply(this,e)}),q(e,n)};Y(we,e=>{t.oncopytocli&&e(Te)});var Ee=H(we,2),De=e=>{var t=_m(),n=V(t),r=H(n,2);G(`click`,n,e=>p()(e.currentTarget)),G(`click`,r,function(...e){f()?.apply(this,e)}),q(e,t)};Y(Ee,e=>{o()&&e(De)});var Oe=H(Ee,2),ke=e=>{sm(e,{get status(){return t.retrieval},get loading(){return c()},get onrefresh(){return l()}})};Y(Oe,e=>{t.retrieval!==void 0&&e(ke)});var Ae=H(Oe,2),je=e=>{var t=xm(),n=H(B(t),2);X(n,21,s,e=>e.id,(e,t)=>{var n=bm();let r;var i=B(n),a=B(i,!0);P(i);var o=H(i,2);let s;var c=B(o),l=H(c),u=e=>{var n=ym(),r=V(n),i=H(r),a=e=>{var n=vm(),r=B(n,!0);P(n),U(()=>J(r,W(t).detail)),q(e,n)};Y(i,e=>{W(t).detail&&e(a)}),U(()=>J(r,`· ${W(t).status===`working`?`Working`:W(t).status===`ready`?`Ready`:W(t).status===`unavailable`?`Unavailable`:`Unverified`} `)),q(e,n)};Y(l,e=>{W(t).status&&e(u)}),P(o),P(n),U(()=>{r=Ei(n,1,`svelte-t9laac`,null,r,{"with-status":W(t).status}),J(a,W(t).label),Z(o,`title`,W(t).detail??W(t).version??`Version unavailable`),s=Ei(o,1,`svelte-t9laac`,null,s,{"with-status":W(t).status}),J(c,`${W(t).version??`Unavailable`??``} `)}),q(e,n)}),P(n),P(t),q(e,t)};Y(Ae,e=>{s().length&&e(je)});var Me=H(Ae,2),Ne=B(Me),Pe=H(Ne,2),Fe=e=>{q(e,Sm())};Y(Pe,e=>{_()&&e(Fe)});var Ie=H(Pe,2),Le=H(Ie,2);P(Me),P(ve),qi(ve,e=>z(S,e),()=>W(S));var Re=H(ve,2),ze=H(B(Re),4),Be=B(ze);qi(Be,e=>z(w,e),()=>W(w));var M=H(Be,2),Ve=B(M,!0);P(M),P(ze),P(Re),qi(Re,e=>z(C,e),()=>W(C));var N=H(Re,2),He=H(B(N),4),Ue=e=>{q(e,Cm())};Y(He,e=>{W(O)&&e(Ue)});var We=H(He,2),Ge=B(We);qi(Ge,e=>z(D,e),()=>W(D));var Ke=H(Ge,2),qe=B(Ke,!0);P(Ke),P(We),P(N),qi(N,e=>z(E,e),()=>W(E)),U(()=>{xe!==(xe=t.theme)&&(be.value=(be.__value=t.theme)??``,ki(be,t.theme)),Ne.disabled=_()||W(O)||W(T),Z(Ne,`aria-busy`,_()),Z(Ne,`aria-describedby`,_()?`clean-tmp-status`:void 0),Ie.disabled=_()||W(O)||W(T),Le.disabled=_()||W(O),Z(Re,`aria-busy`,W(T)),Be.disabled=W(T),M.disabled=W(T),J(Ve,W(T)?`Quitting…`:`Quit`),Z(N,`aria-busy`,W(O)),Ge.disabled=W(O),Ke.disabled=W(O),J(qe,W(O)?`Upgrading…`:`Upgrade and restart`)}),Br(`toggle`,ve,e=>u()(e.newState===`open`)),G(`change`,be,e=>t.onthemechange(e.currentTarget.value)),G(`click`,j,function(...e){m()?.apply(this,e)}),G(`click`,Ce,function(...e){h()?.apply(this,e)}),G(`click`,Ne,()=>void k()),G(`click`,Ie,ee),G(`click`,Le,ne),Br(`cancel`,Re,e=>W(T)?e.preventDefault():ae()),Br(`close`,Re,ae),G(`click`,Be,ie),G(`click`,M,()=>void re()),Br(`cancel`,N,e=>W(O)?e.preventDefault():ae()),Br(`close`,N,ae),G(`click`,Ge,()=>W(E)?.close()),G(`click`,Ke,()=>void te()),q(e,oe),$e()}Vr([`click`,`change`]);var Em=K(`<summary><!></summary>`),Dm=K(`<button><!></button>`);function Om(e,t){let n=Q(t,`element`,3,`button`),r=Q(t,`type`,3,`button`),i=Q(t,`disabled`,3,!1),a=Q(t,`compact`,3,!1),o=Q(t,`full`,3,!1),s=Q(t,`primary`,3,!1),c=Q(t,`accentPressed`,3,!1);var l=Yr(),u=V(l),d=e=>{var n=Em();mi(B(n),()=>t.children),P(n),U(()=>{Z(n,`id`,t.id),Ei(n,1,bi([`app-control`,t.class,{compact:a(),full:o(),primary:s(),accentPressed:c()}]),`svelte-6ey372`),Z(n,`data-state`,t.state)}),q(e,n)},f=e=>{var n=Dm();mi(B(n),()=>t.children),P(n),U(()=>{Z(n,`id`,t.id),Z(n,`type`,r()),n.disabled=i(),Ei(n,1,bi([`app-control`,t.class,{compact:a(),full:o(),primary:s(),accentPressed:c()}]),`svelte-6ey372`),Z(n,`aria-label`,t.label),Z(n,`aria-current`,t.current),Z(n,`aria-pressed`,t.pressed),Z(n,`aria-describedby`,t.describedby),Z(n,`aria-disabled`,t.ariaDisabled)}),G(`click`,n,function(...e){t.onclick?.apply(this,e)}),q(e,n)};Y(u,e=>{n()===`summary`?e(d):e(f,-1)}),q(e,l)}Vr([`click`]);async function km(e,t,n,r=1e3,i=15*6e4){let a=Date.now()+i;for(;Date.now()<a;){n.throwIfAborted();let i;try{i=await t(AbortSignal.any([n,AbortSignal.timeout(5e3)]))}catch{n.throwIfAborted()}if(i&&i.instanceId!==e)return;if(i?.phase===`failed`)throw Error(i.message??`Upgrade failed. Check the Gestalt update log.`);await new Promise((e,t)=>{let i=setTimeout(()=>{n.removeEventListener(`abort`,a),e()},r),a=()=>{clearTimeout(i),n.removeEventListener(`abort`,a),t(n.reason)};n.addEventListener(`abort`,a,{once:!0})})}throw Error(`Mobile has not reconnected yet. Check the Gestalt update-restart.log and reload when it is ready.`)}function Am(e,t=e.length){let n=e.slice(0,3),r=t-n.length,i=r>0?` and ${r} other folder${r===1?``:`s`}`:``;return`${n.join(`, `)}${i}`}var jm=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Mm(e){let{folders:t,workspaces:n,reasons:r,failedFolders:i}=e,a=e.status===`partial`,o=[];a&&o.push(`Cleanup incomplete.`),t.removed?o.push(`Removed ${jm(t.removed,`temporary folder`)} in ${jm(n.removed,`workspace`)}.`):o.push(!a&&!t.skipped?`No temporary folders to remove.`:`No temporary folders removed.`),r.protected&&o.push(`Kept ${jm(r.protected,`protected folder`)}.`);let s=Math.max(0,t.skipped-r.protected);s&&o.push(`Skipped ${jm(s,`other folder`)}.`);let c=o.length;t.failed&&o.push(`Could not remove ${jm(t.failed,`folder`)}.`),n.unavailable&&o.push(`Could not check ${jm(n.unavailable,`workspace`)}.`),r.unavailable>n.unavailable&&o.push(`Some locations could not be checked.`),a&&o.push(`Try Clean TMP again.`);let l=a?`error`:`success`,u=o.join(` `);if(!t.failed||!i?.length)return{kind:l,message:u};let d=i.map(({workspaceName:e,relativePath:t})=>`“${t}” in “${e}”`);return o[c]=`Could not remove ${Am(d,t.failed)}.`,{kind:l,message:o.join(` `),history:{message:u,details:d}}}function Nm(e){return[[`Handoff trace`,e.handoffTrace??`Unavailable`],[`Control`,e.control??`Unavailable`],[`Mobile session`,e.mobileSession],[`Codex thread`,e.codexThread??`Unavailable`],...e.provider===`kimi`?[[`Kimi thread`,e.sourceThread??`Unavailable`]]:[]]}var Pm=K(`<div class="svelte-vx755z"><dt class="svelte-vx755z"> </dt> <dd class="svelte-vx755z"> </dd></div>`),Fm=K(`<div class="debug-identifiers svelte-vx755z"><h3 class="svelte-vx755z">Debug identifiers</h3> <dl class="svelte-vx755z"></dl> <h3 class="svelte-vx755z">Versions</h3> <dl class="svelte-vx755z"></dl></div>`);function Im(e,t){I(t,!0);var n=Fm(),r=H(B(n),2);X(r,21,()=>Nm(t.context),([e,t])=>e,(e,t)=>{var n=L(()=>w(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1];var a=Pm(),o=B(a),s=B(o,!0);P(o);var c=H(o,2),l=B(c,!0);P(c),P(a),U(()=>{J(s,r()),J(l,i())}),q(e,a)}),P(r);var i=H(r,4);X(i,21,()=>t.context.versions,e=>e.id,(e,t)=>{var n=Pm(),r=B(n),i=B(r,!0);P(r);var a=H(r,2),o=B(a,!0);P(a),P(n),U(()=>{J(i,W(t).label),J(o,W(t).version??`Unavailable`)}),q(e,n)}),P(i),P(n),q(e,n),$e()}var Lm=K(`<p class="report svelte-f06alb"> </p>`),Rm=K(`<section class="problem svelte-f06alb" aria-labelledby="debug-problem-title"><h3 id="debug-problem-title" class="svelte-f06alb">Reported blocker</h3> <p class="svelte-f06alb"> </p> <!> <p class="svelte-f06alb">This explanation will be shared with the new debug session. The blocked session stays
|
|
63
|
-
paused.</p></section>`),zm=K(`<dialog aria-labelledby="debug-title" aria-describedby="debug-description" class="svelte-f06alb"><h2 id="debug-title" class="svelte-f06alb">Confirm spawning a new Gestalt DEBUG session?</h2> <p id="debug-description" class="svelte-f06alb">Capture a redacted diagnostic trace and start an independent agent in ~/.gestalt/self-debug to
|
|
64
|
-
investigate and fix the error.</p> <!> <!> <div class="dialog-actions svelte-f06alb"><button type="button" class="svelte-f06alb">Cancel</button> <button type="button" class="svelte-f06alb"> </button></div></dialog>`);function Bm(e,t){I(t,!0);let n,r,i=R(!1);Yi(()=>{n.showModal(),r.focus()});async function a(){if(!W(i)){z(i,!0);try{await t.onconfirm()}catch{}finally{z(i,!1)}}}var o=zm(),s=H(B(o),4);Im(s,{get context(){return t.confirmation.context}});var c=H(s,2),l=e=>{var n=Rm(),r=H(B(n),2),i=B(r,!0);P(r);var a=H(r,2),o=e=>{var n=Lm(),r=B(n,!0);P(n),U(()=>J(r,t.confirmation.problem.supervisorReport)),q(e,n)};Y(a,e=>{t.confirmation.problem.supervisorReport&&e(o)}),F(2),P(n),U(()=>J(i,t.confirmation.problem.attention.summary)),q(e,n)};Y(c,e=>{t.confirmation.problem&&e(l)});var u=H(c,2),d=B(u);qi(d,e=>r=e,()=>r);var f=H(d,2),p=B(f,!0);P(f),P(u),P(o),qi(o,e=>n=e,()=>n),U(()=>{Z(o,`aria-busy`,W(i)),d.disabled=W(i),f.disabled=W(i),J(p,W(i)?`Preparing Self DEBUG…`:`Start Self DEBUG`)}),Br(`cancel`,o,e=>{W(i)&&e.preventDefault()}),Br(`close`,o,function(...e){t.onclose?.apply(this,e)}),G(`click`,d,()=>n.close()),G(`click`,f,()=>void a()),q(e,o),$e()}Vr([`click`]);function Vm(e,t,n){return n?e.filter(e=>e.tab===t&&e.available(n)):[]}var Hm=[`context-mode`,`gestalt-context-mode`,`gestalt-serena`],Um=[`artifact`,`spawn`,`initialize`,`startup`],Wm=[`artifact-unavailable`,`process-exited`,`protocol-rejected`,`timeout`,`reauthentication-required`,`startup-failed`,`cancelled`],Gm=[`SIGHUP`,`SIGINT`,`SIGQUIT`,`SIGABRT`,`SIGKILL`,`SIGSEGV`,`SIGTERM`];function Km(e){return typeof e==`string`&&/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(e)?e:null}function qm(e,t){return typeof t==`string`&&e.includes(t)}function Jm(e){return typeof e==`string`&&/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(e)&&Number.isFinite(Date.parse(e))&&new Date(e).toISOString()===e?e:void 0}function Ym(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=Km(t.failureId),r=Km(t.attemptId),i=Jm(t.occurredAt);if(!(t.schemaVersion!==1||!n||!r||!i||!qm(Hm,t.serverName)||!qm(Um,t.phase)||!qm(Wm,t.code)))return{schemaVersion:1,failureId:n,attemptId:r,occurredAt:i,threadId:Km(t.threadId),serverName:t.serverName,phase:t.phase,code:t.code,runtimeId:Km(t.runtimeId),artifactDigest:typeof t.artifactDigest==`string`&&/^sha256:[a-f0-9]{64}$/.test(t.artifactDigest)?t.artifactDigest:null,exitCode:typeof t.exitCode==`number`&&Number.isInteger(t.exitCode)&&t.exitCode>=0&&t.exitCode<=255?t.exitCode:null,signal:qm(Gm,t.signal)?t.signal:null}}function Xm(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=Km(t.runtimeId),r=Km(t.attemptId),i=t.threadId===null?null:Km(t.threadId),a=Jm(t.observedAt);if(t.schemaVersion!==1||!n||!r||!a||t.threadId!==null&&!i||!qm(Hm,t.serverName)||!qm([`starting`,`ready`,`failed`,`cancelled`],t.status))return;let o=Ym(t.failure);if(!(t.status===`failed`||t.status===`cancelled`?!o||o.runtimeId!==n||o.attemptId!==r||o.threadId!==i||o.serverName!==t.serverName||o.occurredAt!==t.observedAt||t.status===`cancelled`!=(o.code===`cancelled`):t.failure!==null))return{schemaVersion:1,runtimeId:n,attemptId:r,threadId:i,serverName:t.serverName,observedAt:a,status:t.status,failure:o??null}}function Zm(e){return e===`gestalt-serena`?`Serena`:`Context Mode`}function Qm(e){return{"artifact-unavailable":`A required runtime artifact was unavailable.`,"process-exited":`The child process exited before startup completed.`,"protocol-rejected":`The initialize request was rejected.`,timeout:`The initialize request timed out.`,"reauthentication-required":`Codex reported that authentication is required again.`,"startup-failed":`Codex reported a startup failure without a more specific reason.`,cancelled:`Startup was cancelled.`}[e]}function $m(e){return e===`gestalt-serena`?`Optional tool unavailable. Continue with native code tools. Operators can inspect it with gestalt serena doctor.`:`Required tool unavailable. The affected startup cannot continue until Context Mode is available. Operators can inspect it with ctx-doctor.`}function eh(e){return e.reduce((e,t)=>{let n=th(t);return n?.kind===`Command`?(n.status===`completed`&&(e.successful+=1),n.status===`failed`&&(e.failed+=1),e):e},{successful:0,failed:0})}function th(e){let t=Xm(e.mcpStartup);if(t)return{kind:Zm(t.serverName),status:t.status,content:``,startup:t};if(nh(e))return null;let[n,r]=e.label.split(` · `,2);return{kind:n,...r?{status:r}:{},content:rh(n,e.detail)}}function nh(e){return e.label.startsWith(`Tool`)&&(e.detail.includes(`context_mode`)||/(^|[_:])ctx_[a-z]/i.test(e.detail))}function rh(e,t){return e===`Command`?ih(t):e===`File change`||e===`fileChange`?t.split(`
|
|
65
|
-
`).filter(Boolean).join(`, `):t}function ih(e){let t=e.match(/^\/bin\/bash -lc "([\s\S]*)"$/);return t?t[1].replace(/\\"/g,`"`).replace(/\\\\/g,`\\`):e}var ah=K(`<p class="secondary svelte-18dzom7">Codex did not expose a finer startup phase. No underlying cause is established.</p>`),oh=K(`<p class="secondary svelte-18dzom7">Codex did not expose child exit or signal details.</p>`),sh=K(`<p class="svelte-18dzom7"> </p> <dl class="svelte-18dzom7"><div class="svelte-18dzom7"><dt class="svelte-18dzom7">Observed phase</dt> <dd class="svelte-18dzom7"> </dd></div> <div class="svelte-18dzom7"><dt class="svelte-18dzom7">Child process</dt> <dd class="svelte-18dzom7"> </dd></div></dl> <!> <!> <p class="svelte-18dzom7"> </p> <details class="trace-reference svelte-18dzom7"><summary class="svelte-18dzom7">Trace reference</summary> <dl class="svelte-18dzom7"><div class="svelte-18dzom7"><dt class="svelte-18dzom7">Thread</dt> <dd class="svelte-18dzom7"><code class="svelte-18dzom7"> </code></dd></div> <div class="svelte-18dzom7"><dt class="svelte-18dzom7">Failure</dt> <dd class="svelte-18dzom7"><code class="svelte-18dzom7"> </code></dd></div> <div class="svelte-18dzom7"><dt class="svelte-18dzom7">Observed at (UTC)</dt> <dd class="svelte-18dzom7"><time class="svelte-18dzom7"> </time></dd></div> <div class="svelte-18dzom7"><dt class="svelte-18dzom7">Attempt</dt> <dd class="svelte-18dzom7"><code class="svelte-18dzom7"> </code></dd></div> <div class="svelte-18dzom7"><dt class="svelte-18dzom7">Relay runtime</dt> <dd class="svelte-18dzom7"><code class="svelte-18dzom7"> </code></dd></div> <div class="svelte-18dzom7"><dt class="svelte-18dzom7">Artifact digest</dt> <dd class="svelte-18dzom7"><code class="svelte-18dzom7"> </code></dd></div></dl></details>`,1),ch=K(`<p class="svelte-18dzom7">Connection ready. Any earlier startup failures remain in the session trace and notification
|
|
66
|
-
history.</p> <p class="secondary svelte-18dzom7">Connection availability does not establish repository or language readiness.</p>`,1),lh=K(`<p class="svelte-18dzom7">Startup is in progress. Readiness has not been established.</p>`),uh=K(`<section class="startup-details svelte-18dzom7"><!></section>`);function dh(e,t){I(t,!0);var n=uh(),r=B(n),i=e=>{var n=sh(),r=V(n),i=B(r,!0);P(r);var a=H(r,2),o=B(a),s=H(B(o),2),c=B(s,!0);P(s),P(o);var l=H(o,2),u=H(B(l),2),d=B(u);P(u),P(l),P(a);var f=H(a,2),p=e=>{q(e,ah())};Y(f,e=>{t.startup.failure.phase===`startup`&&e(p)});var m=H(f,2),h=e=>{q(e,oh())};Y(m,e=>{t.startup.failure.exitCode===null&&t.startup.failure.signal===null&&e(h)});var g=H(m,2),_=B(g,!0);P(g);var v=H(g,2),y=H(B(v),2),b=B(y),x=H(B(b),2),S=B(x),C=B(S,!0);P(S),P(x),P(b);var w=H(b,2),T=H(B(w),2),E=B(T),D=B(E,!0);P(E),P(T),P(w);var O=H(w,2),k=H(B(O),2),ee=B(k),te=B(ee,!0);P(ee),P(k),P(O);var ne=H(O,2),re=H(B(ne),2),ie=B(re),ae=B(ie,!0);P(ie),P(re),P(ne);var oe=H(ne,2),se=H(B(oe),2),ce=B(se),le=B(ce,!0);P(ce),P(se),P(oe);var ue=H(oe,2),de=H(B(ue),2),A=B(de),fe=B(A,!0);P(A),P(de),P(ue),P(y),P(v),U((e,n)=>{J(i,e),J(c,t.startup.failure.phase),J(d,`Exit: ${t.startup.failure.exitCode??`Unavailable`??``}; signal: ${t.startup.failure.signal??`Unavailable`??``}.`),J(_,n),J(C,t.startup.threadId??`Unavailable; tool could not be attributed to a thread.`),J(D,t.startup.failure.failureId),Z(ee,`datetime`,t.startup.observedAt),J(te,t.startup.observedAt),J(ae,t.startup.attemptId),J(le,t.startup.runtimeId),J(fe,t.startup.failure.artifactDigest??`Unavailable`)},[()=>Qm(t.startup.failure.code),()=>$m(t.startup.serverName)]),q(e,n)},a=e=>{var t=ch();F(2),q(e,t)},o=e=>{q(e,lh())};Y(r,e=>{t.startup.failure?e(i):t.startup.status===`ready`?e(a,1):e(o,-1)}),P(n),U(e=>Z(n,`aria-label`,e),[()=>`${Zm(t.startup.serverName)} startup`]),q(e,n),$e()}var fh=K(`<dl class="command-counts svelte-thyolt"><div data-command-outcome="successful" class="svelte-thyolt"><dt class="svelte-thyolt">Successful commands</dt> <dd class="svelte-thyolt"> </dd></div> <div data-command-outcome="failed" class="svelte-thyolt"><dt class="svelte-thyolt">Failed commands</dt> <dd class="svelte-thyolt"> </dd></div></dl>`),ph=K(`<span class="activity-content svelte-thyolt"> </span>`),mh=K(`<li class="activity-row svelte-thyolt"><small class="activity-type svelte-thyolt"> </small> <!></li>`),hh=K(`<ul class="activity-list svelte-thyolt"></ul>`),gh=K(`<details class="chat-activity svelte-thyolt"><summary class="svelte-thyolt">activity</summary> <!> <!></details>`),_h=K(`<section class="live-activity svelte-thyolt" aria-label="Current activity"><strong class="svelte-thyolt">activity</strong> <!> <!></section>`);function vh(e,t){I(t,!0);let n=e=>{var t=fh(),n=B(t),r=H(B(n),2),i=B(r,!0);P(r),P(n);var a=H(n,2),o=H(B(a),2),c=B(o,!0);P(o),P(a),P(t),U(()=>{J(i,W(s).successful),J(c,W(s).failed)}),q(e,t)},r=e=>{var t=Yr(),n=V(t),r=e=>{var t=hh();X(t,21,()=>W(c),e=>e.id,(e,t)=>{var n=mh(),r=B(n),i=B(r);P(r);var a=H(r,2),o=e=>{dh(e,{get startup(){return W(t).startup}})},s=e=>{var n=ph(),r=B(n,!0);P(n),U(()=>J(r,W(t).content)),q(e,n)};Y(a,e=>{W(t).startup?e(o):e(s,-1)}),P(n),U(e=>{Z(n,`data-activity-kind`,e),Z(n,`data-activity-status`,W(t).status),J(i,`${W(t).kind??``}${W(t).status?` · ${W(t).status}`:``}`)},[()=>W(t).kind.toLowerCase().replaceAll(` `,`-`)]),q(e,n)}),P(t),q(e,t)};Y(n,e=>{W(c).length&&e(r)}),q(e,t)},i=Q(t,`variant`,3,`summary`),a=L(()=>t.activities.flatMap(e=>{let t=th(e);return t&&t.kind.toLowerCase().replaceAll(` `,``)!==`filechange`?[{id:e.id,...t}]:[]})),o=L(()=>W(a).some(e=>e.kind===`Command`)),s=L(()=>eh(t.activities)),c=L(()=>W(a).filter(e=>e.kind!==`Command`));var l=Yr(),u=V(l),d=e=>{var t=Yr(),a=V(t),s=e=>{var t=gh(),i=H(B(t),2),a=e=>{n(e)};Y(i,e=>{W(o)&&e(a)});var s=H(i,2);r(s),P(t),q(e,t)},c=e=>{var t=_h(),i=H(B(t),2),a=e=>{n(e)};Y(i,e=>{W(o)&&e(a)});var s=H(i,2);r(s),P(t),q(e,t)};Y(a,e=>{i()===`summary`?e(s):e(c,-1)}),q(e,t)};Y(u,e=>{(W(o)||W(c).length)&&e(d)}),q(e,l),$e()}var yh=e=>({working:`working`,idle:`idle`,awaitingAgent:`waiting for child`,awaitingHuman:`needs you`,blocked:`blocked`,disconnected:`disconnected`})[e];function bh(e,t){if(!t)return{polite:``,critical:``};let n=!e||e.root.state!==t.root.state||e.aggregateSubagents!==t.aggregateSubagents,r=t.root.state===`blocked`||t.root.state===`awaitingHuman`;return{polite:n?`l0 ${yh(t.root.state)}; subagents ${yh(t.aggregateSubagents)}.`:``,critical:r&&(!e||e.root.state!==t.root.state)?`l0 ${yh(t.root.state)}.`:``}}function xh(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`recently`;let r=Math.max(0,Math.floor((t-n)/1e3));if(r<60)return`<1m`;let i=Math.floor(r/60);if(i<60)return`${i}m`;let a=Math.floor(i/60);if(a<24)return`${a}h`;let o=Math.floor(a/24);if(o<7)return`${o}d`;let s=Math.floor(o/7);if(s<5)return`${s}w`;let c=Math.floor(o/30);return c<12?`${c}mo`:`${Math.floor(o/365)}y`}var Sh=K(`<p class="agent-progress svelte-d9jh4j"> </p>`),Ch=K(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j"> </strong> <span class="agent-metadata svelte-d9jh4j"> </span> <!> <time class="svelte-d9jh4j"> </time></li>`),wh=K(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j">l0</strong> <span class="agent-metadata svelte-d9jh4j"> </span> <span class="unavailable svelte-d9jh4j" role="status">activity unavailable</span></li>`),Th=K(`<details class="agents svelte-d9jh4j"><!> <ul class="svelte-d9jh4j"><!></ul></details>`),Eh=K(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j"> </strong> <!> <time class="svelte-d9jh4j"> </time></li>`),Dh=K(`<div class="chips svelte-d9jh4j"><span class="chip svelte-d9jh4j"><span aria-hidden="true" class="svelte-d9jh4j">●</span> </span> <details class="children svelte-d9jh4j"><summary class="chip svelte-d9jh4j"><span aria-hidden="true" class="svelte-d9jh4j">◆</span> </summary> <ul class="svelte-d9jh4j"></ul></details> <span class="freshness svelte-d9jh4j"> </span></div>`),Oh=K(`<p class="visually-hidden svelte-d9jh4j" role="alert"> </p>`),kh=K(`<p class="visually-hidden svelte-d9jh4j" aria-live="polite" aria-atomic="true"> </p> <!>`,1),Ah=K(`<section aria-label="Agent activity"><!> <!></section>`);function jh(e,t){I(t,!0);let n=Q(t,`compact`,3,!1),r=Q(t,`popupAlign`,3,`end`),i=Q(t,`popupPlacement`,3,`auto`),a=Q(t,`onopen`,3,()=>{}),o={working:`working`,idle:`idle`,awaitingAgent:`waiting for child`,awaitingHuman:`needs you`,blocked:`blocked`,disconnected:`disconnected`},s={working:0,awaitingAgent:1,awaitingHuman:1,blocked:1,idle:2,disconnected:3},c=R(``),l=R(``),u=null,d=R(cn(Date.now())),f=L(()=>t.activity?`${t.activity.sessionId}:${t.activity.root.state}:${t.activity.aggregateSubagents}`:``),p=L(()=>t.activity?[`blocked`,`awaitingHuman`,`disconnected`].includes(t.activity.root.state)?t.activity.root.state:t.activity.aggregateSubagents:`unavailable`);function m(e){return e.canonicalTaskName??e.canonicalPosition?.toLowerCase()??e.nickname??e.role??e.id}function h(){return`l0`}function g(e){return e===void 0?`(ctx: —)`:`(ctx: ${e}%)`}function _(e){let t=/^L([1-9]\d*)(?:\.([1-9]\d*))?$/.exec(e??``);return t?Number(t[1])*1e3+Number(t[2]??0):2**53-1}function v(e,t){return _(e.canonicalPosition)-_(t.canonicalPosition)||(e.continuationGeneration??1)-(t.continuationGeneration??1)||s[e.state]-s[t.state]||m(e).localeCompare(m(t))}let y=L(()=>t.activity?[{key:`root`,name:h(),planOrder:-1,generation:0,contextUsedPercent:t.activity.root.contextUsedPercent,role:`supervisor`,...t.rootModel?{model:t.rootModel}:{},state:t.activity.root.state,lastActivityAt:t.activity.root.lastActivityAt},...t.activity.subagents.map(e=>({key:`child:${e.id}`,name:m(e),planOrder:_(e.canonicalPosition),generation:e.continuationGeneration??1,contextUsedPercent:e.contextUsedPercent,...e.role?{role:e.role}:{},...e.model?{model:e.model}:{},state:e.state,lastActivityAt:e.lastActivityAt,...e.latestProgress?{latestProgress:e.latestProgress}:{}}))].sort((e,t)=>e.planOrder-t.planOrder||e.generation-t.generation||s[e.state]-s[t.state]||e.name.localeCompare(t.name)):[]),b=L(()=>t.activity?[...t.activity.subagents].sort(v):[]);function x(e){let t=e.parentElement,n=t.querySelector(`summary`),r=i(),a=window.visualViewport;function o(){if(!t.open)return;let i=n.getBoundingClientRect(),o=a?.offsetTop??0,s=o+(a?.height??window.innerHeight);for(let e=t.parentElement;e;e=e.parentElement)if([`auto`,`scroll`,`hidden`,`clip`].includes(getComputedStyle(e).overflowY)){let t=e.getBoundingClientRect();o=Math.max(o,t.top),s=Math.min(s,t.bottom)}let c=parseFloat(getComputedStyle(document.documentElement).fontSize)*.35,l=Math.max(0,i.top-o-c-8),u=Math.max(0,s-i.bottom-c-8),d=r===`auto`&&e.scrollHeight>u&&l>u;t.dataset.placement=d?`above`:`below`,e.style.setProperty(`--agents-popup-space`,`${d?l:u}px`)}let s=typeof ResizeObserver>`u`?null:new ResizeObserver(o);return s?.observe(n),s?.observe(e),t.addEventListener(`toggle`,o),window.addEventListener(`resize`,o),window.addEventListener(`scroll`,o,!0),a?.addEventListener(`resize`,o),a?.addEventListener(`scroll`,o),o(),()=>{s?.disconnect(),t.removeEventListener(`toggle`,o),window.removeEventListener(`resize`,o),window.removeEventListener(`scroll`,o,!0),a?.removeEventListener(`resize`,o),a?.removeEventListener(`scroll`,o)}}Yi(()=>{let e=window.setInterval(()=>z(d,Date.now(),!0),6e4);return()=>window.clearInterval(e)});function S(e,t){let n=xh(t,W(d));return e===`idle`||e===`disconnected`?`${o[e]} since ${n}`:`${o[e]} · active ${n} ago`}Pn(()=>{if(!W(f))return;let e=jr(()=>t.activity),n=jr(()=>u);if(!e)return;let r=bh(n?.sessionId===e.sessionId?n:null,e);r.polite&&z(c,r.polite,!0),r.critical?z(l,r.critical,!0):e.root.state!==`blocked`&&e.root.state!==`awaitingHuman`&&z(l,``),u=e});var C=Ah();let w;var T=B(C),E=e=>{var n=Th(),r=B(n);Om(r,{element:`summary`,compact:!0,full:!0,get state(){return W(p)},children:(e,n)=>{F();var r=Jr();U(()=>J(r,`Agents (${(t.activity?.subagents.length??0)+1})`)),q(e,r)},$$slots:{default:!0}});var i=H(r,2),o=B(i),s=e=>{var t=Yr();X(V(t),17,()=>W(y),e=>e.key,(e,t)=>{var n=Ch(),r=B(n),i=B(r,!0);P(r);var a=H(r,2),o=B(a,!0);P(a);var s=H(a,2),c=e=>{var n=Sh(),r=B(n,!0);P(n),U(()=>J(r,W(t).latestProgress.text)),q(e,n)};Y(s,e=>{W(t).latestProgress&&e(c)});var l=H(s,2),u=B(l,!0);P(l),P(n),U((e,n,r)=>{J(i,W(t).name),J(o,e),Z(l,`datetime`,W(t).lastActivityAt),Z(l,`title`,n),J(u,r)},[()=>[g(W(t).contextUsedPercent),W(t).role,W(t).model?`Model: ${W(t).model}`:`Model unavailable`].filter(Boolean).join(` · `),()=>new Date(W(t).lastActivityAt).toLocaleString(),()=>S(W(t).state,W(t).lastActivityAt)]),q(e,n)}),q(e,t)},c=e=>{var n=wh(),r=H(B(n),2),i=B(r,!0);P(r),F(2),P(n),U(e=>J(i,e),[()=>[`(ctx: —)`,`supervisor`,t.rootModel?`Model: ${t.rootModel}`:`Model unavailable`].filter(Boolean).join(` · `)]),q(e,n)};Y(o,e=>{t.activity?e(s):e(c,-1)}),P(i),_i(i,()=>x),P(n),Br(`toggle`,n,e=>e.currentTarget.open&&a()()),q(e,n)},D=e=>{var n=Dh(),r=B(n),i=H(B(r));P(r);var a=H(r,2),s=B(a),c=H(B(s));P(s);var l=H(s,2);X(l,21,()=>W(b),e=>e.id,(e,t)=>{var n=Eh(),r=B(n),i=B(r,!0);P(r);var a=H(r),s=H(a),c=e=>{var n=Sh(),r=B(n,!0);P(n),U(()=>J(r,W(t).latestProgress.text)),q(e,n)};Y(s,e=>{W(t).latestProgress&&e(c)});var l=H(s,2),u=B(l);P(l),P(n),U((e,n,r,s)=>{J(i,e),J(a,` · ${n??``}${W(t).role?` · ${W(t).role}`:``}${W(t).model?` · Model: ${W(t).model}`:``} —
|
|
67
|
-
${o[W(t).state]??``} `),Z(l,`datetime`,W(t).lastActivityAt),Z(l,`title`,r),J(u,`Last active ${s??``} ago`)},[()=>m(W(t)),()=>g(W(t).contextUsedPercent),()=>new Date(W(t).lastActivityAt).toLocaleString(),()=>xh(W(t).lastActivityAt,W(d))]),q(e,n)}),P(l),P(a);var u=H(a,2),f=B(u,!0);P(u),P(n),U(e=>{Z(r,`data-state`,t.activity.root.state),J(i,` l0: ${o[t.activity.root.state]??``}
|
|
68
|
-
${e??``}`),Z(s,`data-state`,t.activity.aggregateSubagents),J(c,` Subagents: ${o[t.activity.aggregateSubagents]??``} (${t.activity.subagents.length??``})`),J(f,t.activity.confidence===`fresh`?`Current`:t.activity.confidence===`reconciling`?`Checking updates`:`May be stale`)},[()=>g(t.activity.root.contextUsedPercent)]),q(e,n)};Y(T,e=>{n()?e(E):t.activity&&e(D,1)});var O=H(T,2),k=e=>{var t=kh(),n=V(t),r=B(n,!0);P(n);var i=H(n,2),a=e=>{var t=Oh(),n=B(t,!0);P(t),U(()=>J(n,W(l))),q(e,t)};Y(i,e=>{W(l)&&e(a)}),U(()=>J(r,W(c))),q(e,t)};Y(O,e=>{t.activity&&e(k)}),P(C),U(()=>w=Ei(C,1,`agent-activity svelte-d9jh4j`,null,w,{compact:n(),"align-start":r()===`start`})),q(e,C),$e()}var Mh=K(`<p class="svelte-1x1zevi">Some events could not be attributed to an agent and are excluded.</p>`),Nh=K(`<p class="svelte-1x1zevi">Observation retention is limited. Additional calls are excluded.</p>`),Ph=K(`<div class="svelte-1x1zevi"><dt class="svelte-1x1zevi"> </dt> <dd class="svelte-1x1zevi"> <small class="svelte-1x1zevi"> </small></dd></div>`),Fh=K(`<div class="svelte-1x1zevi"><dt class="svelte-1x1zevi"> </dt> <dd class="svelte-1x1zevi"> </dd></div>`),Ih=K(`<li class="svelte-1x1zevi"><h3 class="svelte-1x1zevi"> </h3> <p class="scope svelte-1x1zevi"> </p> <dl class="svelte-1x1zevi"><div class="svelte-1x1zevi"><dt class="svelte-1x1zevi">Duration</dt> <dd class="svelte-1x1zevi"><span> </span><small class="svelte-1x1zevi"> </small></dd></div> <div class="svelte-1x1zevi"><dt class="svelte-1x1zevi">Delivered bytes</dt> <dd class="svelte-1x1zevi"><span> </span><small class="svelte-1x1zevi"> </small></dd></div></dl> <details class="quality"><summary class="svelte-1x1zevi">Quality and counters</summary> <dl class="svelte-1x1zevi"></dl> <dl class="completeness svelte-1x1zevi"></dl></details></li>`),Lh=K(`<ul class="svelte-1x1zevi"></ul> <p class="svelte-1x1zevi">Byte scopes are separate. Wrapper and tool measurements can overlap; they are not added
|
|
69
|
-
together.</p>`,1),Rh=K(`<p class="svelte-1x1zevi">No measured tool calls yet. Older activity and calls without correlation may have no
|
|
70
|
-
measurements.</p>`),zh=K(`<p class="scope svelte-1x1zevi">Last observation <time> </time></p>`),Bh=K(`<section class="tool-efficiency svelte-1x1zevi" aria-label="Tool efficiency"><details><summary class="svelte-1x1zevi">Tool efficiency <span class="svelte-1x1zevi"> </span></summary> <div class="observations svelte-1x1zevi" role="region" aria-label="Tool efficiency observations" tabindex="0"><p class="svelte-1x1zevi">Observed calls only. Provider usage is tracked separately.</p> <!> <!> <!> <!></div></details></section>`);function Vh(e,t){I(t,!0);let n=Q(t,`snapshot`,3,null),r=Q(t,`activity`,3,null),i=L(()=>n()?.sessionId===t.sessionId?n():null),a={command:`Commands`,mcp:`MCP tools`,contextMode:`Context-mode`,executionWrapper:`Execution wrappers`,dynamic:`Dynamic tools`,collaboration:`Collaboration`},o=L(()=>[...new Set(W(i)?.groups.map(e=>e.runtimeId)??[])]);function s(e){if(e.actor===`root`)return`Root (l0)`;let n=r()?.sessionId===t.sessionId?r().subagents.find(t=>t.id===e.threadId):void 0;return e.actor===`child`?`Child (${n?.canonicalTaskName??n?.nickname??e.threadId})`:`Unknown actor`}function c(e,t=``){return e.value===null?`Unknown`:`${e.value.toLocaleString()}${t?` ${t}`:``}`}function l(e,t){return`${e.measuredCalls} of ${t} calls measured${e.coverage===`partial`?` · partial`:``}`}function u(e){return e.deliveredScope===`commandOutputUtf8`?`Command output, UTF-8`:e.deliveredScope===`serializedMcpContent`?`Serialized MCP content`:e.deliveredScope===`serializedDynamicContent`?`Serialized dynamic content`:`Result scope unknown`}function d(e){return`${e.complete} complete · ${e.partial} partial · ${e.unknown} unknown · ${e.missing} unmeasured`}var f=Bh(),p=B(f),m=B(p),h=H(B(m)),g=B(h,!0);P(h),P(m);var _=H(m,2),v=H(B(_),2),y=e=>{q(e,Mh())};Y(v,e=>{W(i)?.missingCorrelation&&e(y)});var b=H(v,2),x=e=>{q(e,Nh())};Y(b,e=>{W(i)?.retentionLimited&&e(x)});var S=H(b,2),C=e=>{var t=Lh(),n=V(t);X(n,21,()=>W(i).groups,e=>JSON.stringify([e.runtimeId,e.threadId,e.actor,e.family]),(e,t)=>{var n=Ih(),r=B(n),i=B(r);P(r);var f=H(r,2),p=B(f);P(f);var m=H(f,2),h=B(m),g=H(B(h),2),_=B(g),v=B(_,!0);P(_);var y=H(_),b=B(y,!0);P(y),P(g),P(h);var x=H(h,2),S=H(B(x),2),C=B(S),w=B(C,!0);P(C);var T=H(C),E=B(T);P(T),P(S),P(x),P(m);var D=H(m,2),O=H(B(D),2);X(O,21,()=>[{name:`Raw bytes`,total:W(t).rawBytes,unit:`B`},{name:`Processed bytes`,total:W(t).processedBytes,unit:`B`},{name:`Truncated calls`,total:W(t).truncatedCalls,unit:``},{name:`Retries`,total:W(t).retries,unit:``},{name:`Reused calls`,total:W(t).reusedCalls,unit:``}],e=>e.name,(e,n)=>{var r=Ph(),i=B(r),a=B(i,!0);P(i);var o=H(i,2),s=B(o,!0),u=H(s),d=B(u,!0);P(u),P(o),P(r),U((e,t)=>{J(a,W(n).name),J(s,e),J(d,t)},[()=>c(W(n).total,W(n).unit),()=>l(W(n).total,W(t).calls)]),q(e,r)}),P(O);var k=H(O,2);X(k,20,()=>[`capture`,`display`,`evidence`],e=>e,(e,n)=>{var r=Fh(),i=B(r),a=B(i);P(i);var o=H(i,2),s=B(o,!0);P(o),P(r),U((e,t)=>{J(a,`${e??``} completeness`),J(s,t)},[()=>n[0].toUpperCase()+n.slice(1),()=>d(W(t).completeness[n])]),q(e,r)}),P(k),P(D),P(n),U((e,n,r,o,s,c,l)=>{J(i,`${e??``} · ${a[W(t).family]??``}`),J(p,`Runtime ${n??``} · ${W(t).layer===`wrapper`?`Wrapper scope`:`Tool scope`} · ${W(t).calls??``} observed ${W(t).calls===1?`call`:`calls`} · ${W(t).completedCalls??``}
|
|
71
|
-
completed · ${W(t).failedCalls??``} failed`),J(v,r),J(b,o),J(w,s),J(E,`${c??``} · ${l??``}`)},[()=>s(W(t)),()=>W(o).indexOf(W(t).runtimeId)+1,()=>c(W(t).durationMs,`ms`),()=>l(W(t).durationMs,W(t).calls),()=>c(W(t).deliveredBytes,`B`),()=>u(W(t)),()=>l(W(t).deliveredBytes,W(t).calls)]),q(e,n)}),P(n),F(2),q(e,t)},w=e=>{q(e,Rh())};Y(S,e=>{W(i)?.groups.length?e(C):e(w,-1)});var T=H(S,2),E=e=>{var t=zh(),n=H(B(t)),r=B(n,!0);P(n),P(t),U(e=>{Z(n,`datetime`,W(i).observedAt),J(r,e)},[()=>new Date(W(i).observedAt).toLocaleString()]),q(e,t)};Y(T,e=>{W(i)?.observedAt&&e(E)}),P(_),P(p),P(f),U(()=>J(g,W(i)?.coverage===`partial`?`Partial coverage`:`No measurements yet`)),q(e,f),$e()}Xe();var Hh=K(`<main class="svelte-iw6wrs"><h1 class="svelte-iw6wrs">Activity evidence</h1> <!><!></main>`);function Uh(e){let t={sessionId:`evidence`,confidence:`reconciling`,aggregateSubagents:`working`,root:{state:`awaitingAgent`,observedAt:`2026-01-01T00:00:00.000Z`,lastActivityAt:`2026-01-01T00:00:00.000Z`},subagents:[{id:`α-worker`,nickname:`α worker`,role:`research`,state:`working`,observedAt:`2026-01-01T00:00:00.000Z`,lastActivityAt:`2026-01-01T00:00:00.000Z`,latestProgress:{text:`Checking the focused tests and reviewing the changed files before the next milestone report.`,occurredAt:`2026-01-01T00:00:00.000Z`}}]},n=[`working`,`awaitingAgent`,`awaitingHuman`,`blocked`,`idle`,`disconnected`];var r=Hh(),i=H(B(r),2);jh(i,{get activity(){return t}}),X(H(i),1,()=>n,e=>e,(e,n)=>{{let r=Tt(()=>({...t,sessionId:W(n),confidence:W(n)===`blocked`?`stale`:`fresh`,root:{...t.root,state:W(n)},aggregateSubagents:W(n)}));jh(e,{get activity(){return W(r)}})}}),P(r),q(e,r)}function Wh(e,t){if(!e||typeof e!=`object`)return!1;let n=e,r=new Set([`working`,`idle`,`awaitingAgent`,`awaitingHuman`,`blocked`,`disconnected`]),i=(e,t=256)=>typeof e==`string`&&e.length<=t,a=e=>Array.isArray(e)&&e.length<=64&&e.every(e=>{let t=e;return t&&typeof t==`object`&&[`running`,`detached-active`,`exited-awaiting-result`,`result-consumed`,`terminated-for-budget`].includes(t.state)&&[`executor`,`supervisor`].includes(t.ownership)&&i(t.observedAt,64)&&!Number.isNaN(Date.parse(t.observedAt))}),o=e=>{if(!e||typeof e!=`object`)return!1;let t=e;return i(t.state,32)&&r.has(t.state)&&i(t.observedAt,64)&&i(t.lastActivityAt,64)&&!Number.isNaN(Date.parse(t.observedAt))&&!Number.isNaN(Date.parse(t.lastActivityAt))&&(t.reason===void 0||i(t.reason,64))&&(t.latestProgress===void 0||t.latestProgress!==null&&typeof t.latestProgress==`object`&&i(t.latestProgress.text,512)&&!!t.latestProgress.text.trim()&&i(t.latestProgress.occurredAt,64)&&!Number.isNaN(Date.parse(t.latestProgress.occurredAt)))&&(t.contextUsedPercent===void 0||Number.isInteger(t.contextUsedPercent)&&t.contextUsedPercent>=0&&t.contextUsedPercent<=100)};return i(n.sessionId)&&(!t||n.sessionId===t)&&o(n.root)&&Array.isArray(n.subagents)&&n.subagents.length<=64&&n.subagents.every(e=>o(e)&&i(e.id)&&(e.nickname===void 0||i(e.nickname))&&(e.role===void 0||i(e.role))&&(e.model===void 0||i(e.model))&&(e.canonicalTaskName===void 0||i(e.canonicalTaskName))&&(e.canonicalPosition===void 0||i(e.canonicalPosition,32))&&(e.continuationGeneration===void 0||Number.isInteger(e.continuationGeneration)&&e.continuationGeneration>0)&&(e.outcome===void 0||[`partial`,`cancelled`,`failed`].includes(e.outcome))&&(e.ownedProcesses===void 0||a(e.ownedProcesses)))&&i(n.aggregateSubagents,32)&&r.has(n.aggregateSubagents)&&(n.confidence===`fresh`||n.confidence===`stale`||n.confidence===`reconciling`)}function Gh(e,t){let n=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:null,r=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0,i=e=>typeof e==`string`&&/^[a-zA-Z0-9_.:/-]{1,256}$/.test(e),a=n(e);if(!a||!i(a.sessionId)||a.sessionId!==t||!r(a.revision)||a.scope!==`observedCallsOnly`||![`partial`,`unknown`].includes(String(a.coverage))||typeof a.missingCorrelation!=`boolean`||typeof a.retentionLimited!=`boolean`||!Array.isArray(a.groups)||a.groups.length>64||!(a.observedAt===null||typeof a.observedAt==`string`&&a.observedAt.length<=64&&Number.isFinite(Date.parse(a.observedAt))))return null;let o=[],s=new Set;for(let e of a.groups){let t=n(e);if(!t||!i(t.runtimeId)||!i(t.threadId)||![`root`,`child`,`unknown`].includes(String(t.actor))||![`command`,`mcp`,`contextMode`,`executionWrapper`,`dynamic`,`collaboration`].includes(String(t.family))||t.layer!==(t.family===`executionWrapper`?`wrapper`:`tool`)||!r(t.calls)||t.calls<1||t.calls>1024||!r(t.completedCalls)||t.completedCalls>t.calls||!r(t.failedCalls)||t.failedCalls>t.calls||!(t.deliveredScope===null||typeof t.deliveredScope==`string`&&[`commandOutputUtf8`,`serializedMcpContent`,`serializedDynamicContent`].includes(t.deliveredScope)))return null;let a=JSON.stringify([t.runtimeId,t.threadId,t.actor,t.family]);if(s.has(a))return null;s.add(a);let c={};for(let e of[`durationMs`,`deliveredBytes`,`rawBytes`,`processedBytes`,`retries`,`reusedCalls`,`truncatedCalls`]){let i=n(t[e]);if(!i||!(i.value===null||r(i.value))||!r(i.measuredCalls)||i.measuredCalls>t.calls||i.value!==null&&i.measuredCalls===0||![`complete`,`partial`,`unknown`].includes(String(i.coverage))||i.coverage===`complete`&&(i.value===null||i.measuredCalls!==t.calls)||i.coverage===`unknown`&&(i.value!==null||i.measuredCalls!==0))return null;c[e]={value:i.value,measuredCalls:i.measuredCalls,coverage:i.coverage}}let l=n(t.completeness),u={};for(let e of[`capture`,`display`,`evidence`]){let i=n(l?.[e]);if(!i||!r(i.complete)||!r(i.partial)||!r(i.unknown)||!r(i.missing)||i.complete+i.partial+i.unknown+i.missing!==t.calls)return null;u[e]={complete:i.complete,partial:i.partial,unknown:i.unknown,missing:i.missing}}o.push({runtimeId:t.runtimeId,threadId:t.threadId,actor:t.actor,family:t.family,layer:t.layer,calls:t.calls,completedCalls:t.completedCalls,failedCalls:t.failedCalls,...c,deliveredScope:t.deliveredScope,completeness:u})}return o.reduce((e,t)=>e+t.calls,0)>1024?null:{sessionId:t,revision:a.revision,observedAt:a.observedAt,scope:`observedCallsOnly`,coverage:a.coverage,missingCorrelation:a.missingCorrelation,retentionLimited:a.retentionLimited,groups:o}}var Kh=class{#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=new Map;#a=new Map;#o=new Map;#s=new Map;#c=new Map;#l=null;#u=!1;#d;constructor(e){this.#d={...e,websocket:e.websocket??(e=>new WebSocket(e)),location:e.location??location,setTimeout:e.setTimeout??setTimeout,clearTimeout:e.clearTimeout??clearTimeout}}get(e){return e?this.#e.get(e)??null:null}getEfficiency(e){return e?this.#t.get(e)??null:null}bootstrap(e,t){for(let t of e)!this.#e.has(t.id)&&Wh(t.agentActivity,t.id)&&this.#m(t.id,this.#n.get(t.id)??0,t.agentActivity);this.sync(e.map(e=>e.id),t)}sync(e,t){if(!this.#u){this.#l=t,this.#r=new Set(e);for(let e of this.#r)this.#a.has(e)||this.#a.set(e,0);for(let e of[...this.#a.keys()])this.#r.has(e)||this.remove(e);for(let[e,n]of this.#i)(e===t||!this.#r.has(e))&&(n.close(),this.#i.delete(e));for(let e of this.#r)this.hydrate(e),e!==t&&!this.#i.has(e)&&this.#p(e)}}select(e){this.sync([...this.#r],e)}remove(e){this.#r.delete(e),this.#a.set(e,(this.#a.get(e)??0)+1),this.#i.get(e)?.close(),this.#i.delete(e);let t=this.#o.get(e);t&&this.#d.clearTimeout(t),this.#o.delete(e),this.#s.delete(e),this.#c.delete(e),this.#e.delete(e),this.#t.delete(e),this.#d.publishEfficiency?.(this.#t),this.#n.delete(e),this.#d.publish(this.#e)}observe(e,t){if(this.#u||!this.#r.has(e)||!Number.isSafeInteger(t.sequence)||t.sequence<1||t.sessionId!==void 0&&t.sessionId!==e)return;let n=this.#n.get(e)??0;t.sequence<=n||(t.sequence>n+1&&(this.#n.set(e,t.sequence-1),this.resync(e)),this.#n.set(e,t.sequence),this.#d.onEvent?.(e,t),t.type===`agent.activity.updated`&&Wh(t.payload,e)&&this.#m(e,t.sequence,t.payload),t.type===`tool.efficiency.updated`&&this.#h(e,t.payload))}async hydrate(e){let t=this.#a.get(e)??0,n=this.#n.get(e)??0;try{let r=await this.#d.relay.getSession(e);if(!this.#f(e,t))return;let i=this.#n.get(e)??0,a=r.currentSequence;if(Number.isSafeInteger(a)&&a>=0){if(a<i)return;this.#n.set(e,a),Wh(r.agentActivity,e)&&this.#m(e,a,r.agentActivity),this.#h(e,r.toolEfficiency),this.#d.onAuthoritativeSnapshot?.(e,r)}else i===n&&(Wh(r.agentActivity,e)&&(this.#m(e,i,r.agentActivity),this.#d.onAuthoritativeSnapshot?.(e,r)),this.#h(e,r.toolEfficiency))}catch{this.#g(e)}}async resync(e){let t=this.#s.get(e);if(t)return t;let n=this.#a.get(e)??0;this.#g(e);let r;return r=(async()=>{try{await this.#d.relay.refreshActivity(e),this.#f(e,n)&&await this.hydrate(e)}catch{}finally{this.#s.get(e)===r&&this.#s.delete(e)}})(),this.#s.set(e,r),r}dispose(){this.#u=!0;for(let e of[...this.#r])this.remove(e)}#f(e,t){return!this.#u&&this.#r.has(e)&&this.#a.get(e)===t}#p(e){let t=this.#a.get(e)??0,n=this.#d.location.protocol===`https:`?`wss:`:`ws:`,r=this.#d.websocket(`${n}//${this.#d.location.host}/api/sessions/${encodeURIComponent(e)}/events?after=${this.#n.get(e)??0}`);this.#i.set(e,r),r.onmessage=n=>{if(!(!this.#f(e,t)||this.#i.get(e)!==r))try{this.#c.delete(e);let t=JSON.parse(String(n.data));t.type===`relay.resyncRequired`?this.resync(e):t.type===`relay.event`&&t.event&&this.observe(e,t.event)}catch{}},r.onclose=()=>{if(!this.#f(e,t)||this.#l===e)return;this.#i.delete(e),this.#g(e);let n=this.#c.get(e)??0,r=(this.#d.reconnectDelaysMs??[250,1e3,5e3])[n];r!==void 0&&(this.#c.set(e,n+1),this.#o.set(e,this.#d.setTimeout(()=>{this.#o.delete(e),this.#f(e,t)&&e!==this.#l&&this.#p(e)},r)))}}#m(e,t,n){let r=this.#e.get(e);this.#n.set(e,Math.max(t,this.#n.get(e)??0)),JSON.stringify(r)!==JSON.stringify(n)&&(this.#e.set(e,n),this.#d.publish(this.#e))}#h(e,t){let n=Gh(t,e);!n||n.revision<=(this.#t.get(e)?.revision??-1)||(this.#t.set(e,n),this.#d.publishEfficiency?.(this.#t))}#g(e){let t=this.#e.get(e);t&&t.confidence===`fresh`&&(this.#e.set(e,{...t,confidence:`stale`}),this.#d.publish(this.#e))}};function qh(e=globalThis.crypto,t=Date.now,n=Math.random){return typeof e?.randomUUID==`function`?e.randomUUID():`k-${t().toString(36)}-${Math.floor(n()*4294967296).toString(36)}`}var Jh={contextWindowExceeded:`The conversation exceeds the model context window. Compact it or start a new session.`,sessionBudgetExceeded:`The Codex session budget is exhausted. Review its budget before continuing.`,usageLimitExceeded:`Codex usage limit reached. Restore available usage or wait for the limit to reset, then resume Autopilot.`,rateLimitExceeded:`The request rate limit was reached. Wait before retrying.`,flexUnavailable:`Flex processing is unavailable. Retry later or select another service tier.`,serverOverloaded:`The model service is overloaded. Retry later.`,cyberPolicy:`Codex blocked the request under its cybersecurity policy.`,misalignmentPolicyViolation:`Codex blocked the request under its safety policy.`,tooManyDenials:`Execution stopped after too many denied requests. Review the requested actions.`,httpConnectionFailed:`The provider HTTP connection failed. Check connectivity and provider availability.`,responseStreamConnectionFailed:`Codex could not connect to the response stream.`,responseStreamDisconnected:`The provider response stream disconnected before completion.`,responseTooManyFailedAttempts:`The provider response failed after repeated attempts.`,internalServerError:`Codex encountered an internal server error. Retry later.`,unauthorized:`Provider authorization failed. Check the account sign-in or credentials.`,badRequest:`The provider rejected the request. Check the selected model and request settings.`,threadRollbackFailed:`Codex could not roll back the thread.`,sandboxError:`Codex could not execute an action in its sandbox. Review the execution policy.`,activeTurnNotSteerable:`The active turn cannot accept steering. Wait for it to finish.`,other:`Codex reported an unclassified execution failure.`};function Yh(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let{code:t,httpStatusCode:n}=e;if(!(typeof t!=`string`||!/^[A-Za-z][A-Za-z0-9_]{0,79}$/.test(t))&&!(n!==void 0&&(typeof n!=`number`||!Number.isInteger(n)||n<100||n>599)))return{code:t,...n===void 0?{}:{httpStatusCode:n}}}function Xh(e){let t=Object.hasOwn(Jh,e.code)?Jh[e.code]:`Codex reported an execution failure with no known description.`;return`${e.code}${e.httpStatusCode?` (HTTP ${e.httpStatusCode})`:``}: ${t}`}function Zh(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e;if(!(typeof t.turnId!=`string`||!t.turnId||t.turnId.length>256||!Number.isInteger(t.attempt)||Number(t.attempt)<1||Number(t.attempt)>2||typeof t.notBefore!=`string`||!Number.isFinite(Date.parse(t.notBefore))||typeof t.settled!=`boolean`||typeof t.pending!=`boolean`||typeof t.resumeRoot!=`boolean`))return{turnId:t.turnId,attempt:t.attempt,notBefore:t.notBefore,settled:t.settled,pending:t.pending,resumeRoot:t.resumeRoot}}function Qh(e){if(typeof e!=`string`||!e.trim())return;let t=e.trim();return t.length<=4e3?t:`${t.slice(0,3999)}…`}var $h=`Checkpoint handoff failed. Autopilot is reconnecting this session automatically. If it cannot recover, restore or reopen the session.`,eg=`Autopilot is recovering after a continuation or agent status check failed. It will retry automatically. If recovery persists, retry Autopilot or restore the session.`;function tg(e){return!!(e?.enabled&&e.state===`monitoring`&&e.reason===`reconcileFailed`&&e.health?.healthy!==!0)}var ng=(e,t=600)=>typeof e==`string`&&e.length<=t,rg=e=>ng(e,64)&&!Number.isNaN(Date.parse(e));function ig(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.enabled==`boolean`&&typeof t.state==`string`&&[`disabled`,`monitoring`,`backoff`,`attentionRequired`,`completed`,`safetyPaused`].includes(t.state)&&!!t.retry&&typeof t.retry==`object`&&Number.isInteger(t.retry.position)&&Number.isInteger(t.retry.limit)&&ng(t.updatedAt,64)&&(t.reason===void 0||ng(t.reason,80))&&(t.providerFailure===void 0||!!Yh(t.providerFailure))&&(t.providerRetry===void 0||!!Zh(t.providerRetry))&&(t.nextEvaluationAt===void 0||ng(t.nextEvaluationAt,64))&&(t.health===void 0||ag(t.health))}function ag(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!t.wait||typeof t.wait!=`object`)return!1;let n=t.wait;return typeof t.healthy==`boolean`&&typeof t.phase==`string`&&[`off`,`rootWorking`,`continuationScheduled`,`waitingForAgentEvent`,`checkingState`,`needsYou`,`safetyPaused`,`complete`,`checkpointRecovery`,`degraded`].includes(t.phase)&&[`active`,`probeRequired`,`parked`,`retrying`,`attentionRequired`,`safetyPaused`,`none`].includes(t.supervision)&&typeof n.present==`boolean`&&Array.isArray(n.wakeCategories)&&n.wakeCategories.length<=9&&new Set(n.wakeCategories).size===n.wakeCategories.length&&n.wakeCategories.every(e=>[`planChanged`,`reviewChanged`,`checkpointChanged`,`interactionChanged`,`executorChanged`,`processExited`,`processResultAvailable`,`processLimitBreached`,`agentActivityChanged`].includes(e))&&(n.resumeAt===void 0||rg(n.resumeAt))&&rg(t.observedAt)&&rg(t.lastTransitionAt)&&ng(t.nextExpectedAction)&&(t.degradationReason===void 0||[`missingContinuation`,`invalidWaitLease`,`controllerUnavailable`,`staleTransition`,`planMismatch`].includes(t.degradationReason))}function og(e){if(!e||typeof e!=`object`)return!1;let t=e,n=t.attention;if(!n||typeof n!=`object`)return!1;let r=n;return ng(t.requestId,256)&&(t.turnId===null||ng(t.turnId,256))&&(t.requestedAt===null||ng(t.requestedAt,64))&&(t.supervisorReport===void 0||ng(t.supervisorReport,4e3))&&ng(r.reason,64)&&ng(r.summary)&&ng(r.requestedAction)&&ng(r.resumeCondition,64)&&(r.executorReplacement===void 0||sg(r.executorReplacement))}function sg(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return Object.keys(t).length===1&&typeof t.canonicalTaskName==`string`&&/^l[1-9][0-9]*$/.test(t.canonicalTaskName)}function cg(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`orgPlanAttention`&&og({requestId:t.requestId,turnId:t.turnId??null,requestedAt:t.requestedAt??null,attention:t.payload,supervisorReport:t.supervisorReport})}function lg(e){return{requestId:e.requestId,turnId:e.turnId,requestedAt:e.requestedAt,attention:e.payload,...e.supervisorReport?{supervisorReport:e.supervisorReport}:{}}}var ug=e=>{let t=e&&typeof e==`object`?e.code:void 0;return t===`AUTOPILOT_PLAN_REQUIRED`?`An incomplete supervised plan is required before Autopilot can start.`:t===`AUTOPILOT_PLAN_COMPLETE`?`This plan is complete, so Autopilot is unavailable.`:t===`AUTOPILOT_MODEL_POLICY_UNAVAILABLE`?`Autopilot cannot verify this plan’s executor settings. Automatic execution is unavailable; manual review and repair remain available.`:t===`AUTOPILOT_SESSION_UNAVAILABLE`?`This session is unavailable for Autopilot.`:e instanceof Error?e.message:`Could not update Autopilot.`},dg=class{relay;publish;createKey;#e=new Map;#t=new Map;#n=new Set;#r=new Map;#i=new Map;#a=new Map;#o=new Map;#s=new Map;#c=new Map;#l=new Map;#u=new Map;#d=new Map;#f=new Set;#p=!1;constructor(e,t,n=qh){this.relay=e,this.publish=t,this.createKey=n}bootstrap(e){if(this.#p)return;let t=new Set(e.map(e=>e.id));for(let e of this.#f)t.has(e)||this.remove(e);this.#f=t;for(let t of e){this.#a.has(t.id)||this.#a.set(t.id,0),this.#o.has(t.id)||this.#o.set(t.id,0);let e=this.#d.get(t.id)??0,n=typeof t.currentSequence==`number`&&Number.isInteger(t.currentSequence)?t.currentSequence:null,r=this.#l.get(t.id);!this.#n.has(t.id)&&(r===void 0||n!==null&&n>r)&&(n!==null&&n>e||!this.#e.has(t.id)&&e===0)&&(n!==null&&(this.#d.set(t.id,n),r!==void 0&&n>r&&this.#l.delete(t.id)),this.#_(t.id,t))}this.#v()}observe(e,t){if(this.#p||!this.#f.has(e)||!Number.isInteger(t.sequence))return;let n=this.#d.get(e)??0;if(!(t.sequence<=n)){if(this.#d.set(e,t.sequence),this.#o.set(e,(this.#o.get(e)??0)+1),t.type===`autopilot.updated`&&this.#h(e,t.payload),t.type===`org-plan.attention-required`&&this.#g(e,t.payload),t.type===`agentMessageCompleted`&&t.payload&&typeof t.payload==`object`){let n=t.payload,r=this.#t.get(e),i=Qh(n.text);r?.turnId&&r.turnId===n.turnId&&n.phase===`final_answer`&&i&&this.#t.set(e,{...r,supervisorReport:i})}t.type===`org-plan.attention-resolved`&&(t.payload&&typeof t.payload==`object`&&t.payload.outcome,this.#t.delete(e)),this.#v()}}async hydrate(e,t){let n=this.#a.get(e)??0,r=(this.#u.get(e)??0)+1;this.#u.set(e,r);let i=t??this.#d.get(e)??0,a=this.#s.get(e),o=this.#c.get(e)??0;try{let t=await this.relay.getSession(e);if(!this.#m(e,n)||this.#u.get(e)!==r||(this.#c.get(e)??0)!==o||this.#s.has(e)&&this.#s.get(e)!==a)return;let s=this.#d.get(e)??0,c=typeof t.currentSequence==`number`&&Number.isInteger(t.currentSequence)?t.currentSequence:null;c!==null&&c>s?(this.#d.set(e,c),this.#_(e,t)):c===null&&s===i&&this.#_(e,t),this.#v()}catch{}}async toggle(e,t){if(this.#p||!this.#f.has(e)||this.#n.has(e))return;let n=this.#a.get(e)??0,r=this.#o.get(e)??0;this.#s.set(e,(this.#s.get(e)??0)+1),this.#c.set(e,(this.#c.get(e)??0)+1),this.#n.add(e),this.#r.delete(e),this.#i.delete(e),this.#v();try{let i=await this.relay.setAutopilot(e,t,this.createKey());this.#m(e,n)&&this.#o.get(e)===r&&(this.#h(e,i.autopilot),this.#o.set(e,r+1),this.#l.set(e,this.#d.get(e)??0),ig(i.autopilot)&&!i.autopilot.enabled&&this.#t.delete(e))}catch(t){this.#m(e,n)&&this.#o.get(e)===r&&this.#r.set(e,ug(t))}finally{this.#m(e,n)&&(this.#n.delete(e),this.#c.set(e,(this.#c.get(e)??0)+1)),this.#v()}}async resolve(e,t,n){let r=this.#t.get(e);if(!r||this.#n.has(e)||this.#p)return;let i=n?.trim();if(i&&i.length>600){this.#r.set(e,`Guidance must be 600 characters or fewer.`),this.#v();return}let a=this.#a.get(e)??0,o=this.#o.get(e)??0;this.#c.set(e,(this.#c.get(e)??0)+1),this.#n.add(e),this.#r.delete(e),this.#v();try{await this.relay.resolveAttention(e,r.requestId,{operationKey:this.createKey(),action:t,...i?{guidance:i}:{}}),this.#m(e,a)&&this.#o.get(e)===o&&await this.hydrate(e)}catch(t){this.#m(e,a)&&this.#o.get(e)===o&&this.#r.set(e,t instanceof Error?t.message:`Could not resolve attention.`)}finally{this.#m(e,a)&&(this.#n.delete(e),this.#c.set(e,(this.#c.get(e)??0)+1)),this.#v()}}remove(e){this.#a.set(e,(this.#a.get(e)??0)+1),this.#f.delete(e),this.#e.delete(e),this.#i.delete(e),this.#t.delete(e),this.#n.delete(e),this.#r.delete(e),this.#d.delete(e),this.#o.delete(e),this.#s.delete(e),this.#c.delete(e),this.#l.delete(e),this.#u.delete(e),this.#v()}dispose(){this.#p=!0,this.#f.clear(),this.#e.clear(),this.#t.clear(),this.#n.clear(),this.#r.clear(),this.#i.clear(),this.#u.clear(),this.#o.clear(),this.#s.clear(),this.#c.clear(),this.#l.clear(),this.#v()}#m(e,t){return!this.#p&&this.#f.has(e)&&this.#a.get(e)===t}#h(e,t){ig(t)&&(this.#e.set(e,t),t.providerFailure?this.#i.set(e,Xh(t.providerFailure)):t.health?.phase===`checkpointRecovery`?this.#i.set(e,$h):tg(t)?this.#i.set(e,eg):t.state===`safetyPaused`&&t.reason===`usageLimitExceeded`?this.#i.set(e,`Codex usage limit reached. Restore available usage or wait for the limit to reset, then resume Autopilot.`):this.#i.delete(e))}#g(e,t){if(og(t))this.#t.set(e,t);else if(cg(t))this.#t.set(e,lg(t));else if(Array.isArray(t)){let n=t.find(cg);n?this.#t.set(e,lg(n)):this.#t.delete(e)}}applyAuthoritative(e,t){if(this.#p||!this.#f.has(e)||this.#n.has(e))return;let n=typeof t.currentSequence==`number`&&Number.isInteger(t.currentSequence)?t.currentSequence:null,r=this.#d.get(e)??0,i=this.#l.get(e);i!==void 0&&(n===null||n<=i)||n!==null&&n<r||(n!==null&&(this.#d.set(e,n),i!==void 0&&n>i&&this.#l.delete(e)),this.#_(e,t),this.#v())}#_(e,t){this.#o.set(e,(this.#o.get(e)??0)+1),this.#h(e,t.autopilot),this.#g(e,t.pendingInteractions)}#v(){this.publish({snapshots:new Map(this.#e),attention:new Map(this.#t),pending:new Set(this.#n),errors:new Map([...this.#r,...this.#i])})}},fg=K(`<span aria-hidden="true" class="svelte-1qf1ppf"> </span> `,1),pg=K(`<div class="control-row svelte-1qf1ppf"><span class="status svelte-1qf1ppf"><span aria-hidden="true" class="svelte-1qf1ppf"> </span> </span> <!></div>`),mg=K(`<section aria-label="Autopilot"><p class="visually-hidden svelte-1qf1ppf" data-testid="autopilot-live-status" aria-live="polite" aria-atomic="true"> </p> <!> <p> </p></section>`);function hg(e,t){I(t,!0);let n=Q(t,`controlId`,3,`autopilot-control`),r=Q(t,`compact`,3,!1),i=Q(t,`indicatorOnly`,3,!1),a=Q(t,`pending`,3,!1),o=Q(t,`ontoggle`,3,()=>{}),s={disabled:`Off`,monitoring:`Monitoring`,backoff:`Waiting to continue`,attentionRequired:`Paused for attention`,completed:`Complete`,safetyPaused:`Safety paused`},c={off:`Off`,rootWorking:`On · root working`,continuationScheduled:`On · continuation scheduled`,waitingForAgentEvent:`On · waiting for agent event`,checkingState:`On · checking state`,needsYou:`Paused · needs you`,safetyPaused:`Safety paused`,complete:`Complete`,checkpointRecovery:`Recovering checkpoint handoff`,degraded:`On · continuation unavailable`},l={planRequired:`An incomplete supervised plan is required before Autopilot can start.`,planComplete:`This plan is complete, so Autopilot is unavailable.`,sessionUnavailable:`This session is unavailable for Autopilot.`,attentionRequired:`Autopilot is paused because an agent is waiting for human input.`,noPlanProgress:`Autopilot paused because the plan did not make durable progress.`,reconcileFailed:`Autopilot paused because it could not safely confirm session state.`,startUnavailable:`Automatic continuation could not start because the session runtime is unavailable. Restore or reopen the session, then retry Autopilot.`,actionRateExceeded:`Autopilot paused after too many automatic actions in ten minutes. Wait for the safety window to clear, or continue manually.`,planRemoved:`The retained plan was removed.`,planReplaced:`The retained plan changed. Enable Autopilot again after reviewing it.`,sessionEnded:`This session ended.`,manualDisabled:`Autopilot is off.`,safetyPaused:`Autopilot paused after a repeated or invalid automatic continuation. Resume manually when ready.`,checkpointHandoffFailed:$h},u=L(()=>t.autopilot?t.autopilot.health?c[t.autopilot.health.phase]:s[t.autopilot.state]:`Unavailable`),d=L(()=>t.autopilot?.state===`backoff`&&t.autopilot.retry.position>0&&t.autopilot.retry.limit>0?`Retry ${t.autopilot.retry.position} of ${t.autopilot.retry.limit}.`:null),f=L(()=>(t.autopilot?.reason?l[t.autopilot.reason]:null)??W(d)??t.autopilot?.health?.nextExpectedAction??(t.autopilot?.state===`monitoring`?`Autopilot is monitoring this supervised plan.`:t.autopilot?.state===`attentionRequired`?`Autopilot is paused because human attention is required.`:`Autopilot state is loading from the relay.`)),p=L(()=>`Autopilot status: ${W(u)}. ${W(f)}`),m=L(()=>t.autopilot?.enabled??!1),h=L(()=>t.autopilot?.state===`safetyPaused`||t.autopilot?.health?.phase===`degraded`);var g=mg();let _;var v=B(g),y=B(v,!0);P(v);var b=H(v,2),x=e=>{{let t=L(()=>`${n()}-button`),r=L(()=>i()?`Autopilot: ${a()?`Updating`:W(u)}`:void 0),s=L(()=>`${n()}-help`);Om(e,{get id(){return W(t)},compact:!0,full:!0,get pressed(){return W(m)},get accentPressed(){return i()},get label(){return W(r)},get describedby(){return W(s)},get ariaDisabled(){return a()},onclick:()=>{a()||o()(!W(m))},children:(e,t)=>{var n=Yr(),r=V(n),o=e=>{q(e,Jr(`Autopilot`))},s=e=>{var t=fg(),n=V(t),r=B(n,!0);P(n);var i=H(n);U(()=>{J(r,W(m)?`●`:`○`),J(i,` Autopilot: ${(a()?`Updating…`:W(u))??``}`)}),q(e,t)};Y(r,e=>{i()?e(o):e(s,-1)}),q(e,n)},$$slots:{default:!0}})}},S=e=>{var r=pg(),i=B(r),s=B(i),c=B(s,!0);P(s);var l=H(s);P(i);var d=H(i,2);{let e=L(()=>`${n()}-button`),t=L(()=>`${n()}-help`);Om(d,{get id(){return W(e)},get pressed(){return W(m)},get describedby(){return W(t)},get ariaDisabled(){return a()},onclick:()=>{a()||o()(!W(m))},children:(e,t)=>{F();var n=Jr();U(()=>J(n,a()?`Updating…`:W(m)?`Pause`:`Enable`)),q(e,n)},$$slots:{default:!0}})}P(r),U(()=>{Z(i,`data-state`,t.autopilot?.state??`unavailable`),J(c,W(m)?`●`:`○`),J(l,` Autopilot: ${W(u)??``}`)}),q(e,r)};Y(b,e=>{r()?e(x):e(S,-1)});var C=H(b,2);let w;var T=B(C,!0);P(C),P(g),U(()=>{_=Ei(g,1,`autopilot-control svelte-1qf1ppf`,null,_,{compact:r(),"has-error":i()&&W(h)}),J(y,W(p)),Z(C,`id`,`${n()}-help`),w=Ei(C,1,`svelte-1qf1ppf`,null,w,{"visually-hidden":r()}),J(T,W(f))}),q(e,g),$e()}var gg=K(`<p class="svelte-yp6bgs"> </p>`),_g=K(`<p class="svelte-yp6bgs"> </p> <p class="svelte-yp6bgs"> </p>`,1),vg=K(`<button type="button" class="svelte-yp6bgs"> </button>`),yg=K(`<section role="alert"><h3 class="svelte-yp6bgs"> </h3> <!> <div class="actions svelte-yp6bgs"><!> <button type="button" class="svelte-yp6bgs"> </button></div></section>`);function bg(e,t){I(t,!0);let n=Q(t,`controlId`,3,`autopilot-safety-stop`),r=Q(t,`pending`,3,!1),i=Q(t,`onrecover`,3,()=>{}),a=Q(t,`ondisable`,3,()=>{}),o={attentionRequired:`The coordinator stopped because it needs a human safety decision, but no actionable agent request is available.`,noPlanProgress:`The coordinator stopped because recent automatic turns made no durable plan progress.`,reconcileFailed:`The coordinator stopped because it could not safely confirm the session state.`,startUnavailable:`The coordinator stopped because the session runtime was unavailable when it tried to start an automatic turn.`,actionRateExceeded:`The coordinator stopped because it reached the automatic-action safety limit.`},s=L(()=>t.autopilot?.providerFailure),c=L(()=>!!(W(s)&&[`disabled`,`completed`].includes(t.autopilot?.state??``))),l=L(()=>t.autopilot?.providerRetry?.pending??!1),u=L(()=>W(s)?Xh(W(s)):t.autopilot?.reason&&!t.attention?o[t.autopilot.reason]??null:null),d=L(()=>tg(t.autopilot)),f=L(()=>W(c)?`Automatic supervision was not running. Retry your message when the provider is available.`:W(l)?`A delayed retry is scheduled (attempt ${t.autopilot?.providerRetry?.attempt} of 2). It will proceed only after the failed turn has ended and the session is idle.`:W(s)?`Address this failure, then retry Autopilot when ready.`:t.autopilot?.reason===`startUnavailable`?`There is no pending agent attention request to answer. Restore or reopen this session, then retry Autopilot.`:t.autopilot?.reason===`actionRateExceeded`?`There is no pending agent attention request to answer. Wait for the ten-minute safety window to clear, or continue manually.`:`There is no pending agent attention request to answer. Retry the supported Autopilot coordinator after addressing the cause, or disable it.`);var p=Yr(),m=V(p),h=e=>{var t=yg();let o;var p=B(t),m=B(p,!0);P(p);var h=H(p,2),g=e=>{var t=gg(),n=B(t,!0);P(t),U(()=>J(n,eg)),q(e,t)},_=e=>{var t=_g(),n=V(t),r=B(n,!0);P(n);var i=H(n,2),a=B(i,!0);P(i),U(()=>{J(r,W(u)),J(a,W(f))}),q(e,t)};Y(h,e=>{W(d)?e(g):e(_,-1)});var v=H(h,2),y=B(v),b=e=>{var t=vg(),n=B(t,!0);P(t),U(()=>{t.disabled=r()||W(l),J(n,r()?`Updating…`:`Retry Autopilot`)}),G(`click`,t,function(...e){i()?.apply(this,e)}),q(e,t)};Y(y,e=>{W(c)||e(b)});var x=H(y,2),S=B(x,!0);P(x),P(v),P(t),U(e=>{o=Ei(t,1,`safety-stop svelte-yp6bgs`,null,o,e),Z(t,`aria-labelledby`,`${n()}-title`),Z(p,`id`,`${n()}-title`),J(m,W(s)?W(c)?`Codex request failed`:`Codex execution paused`:W(d)?`Autopilot recovery warning`:`Autopilot safety stop`),x.disabled=r(),J(S,W(c)?`Dismiss`:`Disable Autopilot`)},[()=>({recovering:W(d)||!!W(s)})]),G(`click`,x,function(...e){a()?.apply(this,e)}),q(e,t)};Y(m,e=>{!t.attention&&(W(s)||W(d)||t.autopilot?.state===`attentionRequired`&&W(u))&&e(h)}),q(e,p),$e()}Vr([`click`]);function xg(e,t=`gestalt-mobile.autopilot-attention-toasts.v1`,n=100){let r=Sg(e,t,n);return{claim(i){if(r.has(i))return!1;r=new Set([...r,i].slice(-n));try{e?.setItem(t,JSON.stringify([...r]))}catch{}return!0}}}function Sg(e,t,n){try{let r=JSON.parse(e?.getItem(t)??`[]`);return new Set(Array.isArray(r)?r.filter(e=>typeof e==`string`).slice(-n):[])}catch{return new Set}}var Cg=100*1024*1024,wg=[{name:`model`,description:`Choose the model for the next turn`,argumentPicker:`models`},{name:`reasoning`,description:`Choose reasoning effort for the next turn`,argumentPicker:`reasoning`}];function Tg(e){let t=e.match(/^\/([^\s]*)$/);return t?t[1].toLowerCase():null}function Eg(e){let t=Tg(e);return t===null?[]:wg.filter(e=>e.name.startsWith(t))}function Dg(e){let t=e.match(/^\/([^\s]+)\s*$/)?.[1]?.toLowerCase();return wg.find(e=>e.name===t)?.argumentPicker}function Og(e){return[...e].sort((e,t)=>kg(t,e)||t.localeCompare(e))}function kg(e,t){let n=e.match(/\d+(?:\.\d+)*/)?.[0].split(`.`).map(Number)??[],r=t.match(/\d+(?:\.\d+)*/)?.[0].split(`.`).map(Number)??[];for(let e=0;e<Math.max(n.length,r.length);e+=1){let t=(n[e]??0)-(r[e]??0);if(t)return t}return 0}var Ag=K(` <span class="block-cursor svelte-1264sfg" aria-hidden="true"></span>`,1),jg=K(`<input type="file" multiple="" hidden="" aria-label="Choose files to upload" class="svelte-1264sfg"/> <p class="upload-hint svelte-1264sfg" aria-live="polite" aria-atomic="true"><!></p> <p class="upload-hint svelte-1264sfg">Org files go to .gestalt/; other files go to the workspace root.</p>`,1),Mg=K(`<p id="writer-hint" class="writer-hint svelte-1264sfg"> </p>`),Ng=K(`<button type="button" class="svelte-1264sfg">Retry send</button>`),Pg=K(`<div class="writer-feedback svelte-1264sfg" role="alert" aria-atomic="true"><p class="svelte-1264sfg"> </p> <!></div>`),Fg=K(`<li><button type="button" class="svelte-1264sfg"><code class="svelte-1264sfg"> </code> <small class="svelte-1264sfg"> </small></button></li>`),Ig=K(`<ul id="chat-command-completion" class="command-menu svelte-1264sfg" aria-label="Chat commands"></ul>`),Lg=K(`<li class="svelte-1264sfg"><button type="button" class="svelte-1264sfg"><code class="svelte-1264sfg"> </code></button></li>`),Rg=K(`<ul class="command-menu svelte-1264sfg" aria-label="Available models"></ul>`),zg=K(`<ul class="command-menu svelte-1264sfg" aria-label="Reasoning efforts"></ul>`),Bg=K(`<button type="button" class="svelte-1264sfg">Upload files</button>`),Vg=K(`<button type="button" class="svelte-1264sfg">Queue message</button> <button type="button" class="svelte-1264sfg">Interrupt and send</button>`,1),Hg=K(`<button type="button" class="svelte-1264sfg">Interrupt</button>`),Ug=K(`<div id="prompt-action-panel" class="action-panel svelte-1264sfg" aria-label="Prompt actions"><!> <!></div>`),Wg=K(`<div class="prompt-action svelte-1264sfg"><button type="button" aria-label="Choose prompt action" aria-controls="prompt-action-panel" class="svelte-1264sfg"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-1264sfg"><circle cx="6" cy="12" r="1.5" class="svelte-1264sfg"></circle><circle cx="12" cy="12" r="1.5" class="svelte-1264sfg"></circle><circle cx="18" cy="12" r="1.5" class="svelte-1264sfg"></circle></svg></button> <!></div>`),Gg=K(`<button type="button" aria-label="Upload files" title="Upload files" class="svelte-1264sfg"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-1264sfg"><path d="M12 16V4m-4 4 4-4 4 4M4 16v4h16v-4" class="svelte-1264sfg"></path></svg></button>`),Kg=K(`<button type="button" class="svelte-1264sfg"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-1264sfg"><path d="M9 10 5 14l4 4M5 14h8a6 6 0 0 0 6-6V6" class="svelte-1264sfg"></path></svg></button>`),qg=K(`<form><p role="status" aria-live="polite" aria-atomic="true" class="svelte-1264sfg"><!></p> <!> <!> <!> <!> <!> <!> <div class="prompt-row svelte-1264sfg"><textarea id="message" aria-label="Prompt" placeholder="Prompt" rows="1" required=""></textarea> <!></div></form>`);function Jg(e,t){I(t,!0);let n=Q(t,`readySince`,3,null),r=Q(t,`newEmpty`,3,!1),i=Q(t,`detached`,3,!1),a=Q(t,`retryMessage`,3,null),o=Q(t,`retryable`,3,!1),s=Q(t,`models`,19,()=>[]),c=Q(t,`provider`,3,`codex`),l=Q(t,`onrevealprompt`,3,()=>{}),u=Q(t,`onmodelselect`,3,()=>{}),d=Q(t,`onqueue`,3,()=>{}),f=Q(t,`oninterruptsend`,3,()=>{}),p=Q(t,`onretry`,3,()=>{}),m=R(cn(Date.now())),h=R(!1),g=R(0),_=R(null);function v(){W(h)||!t.onuploadfiles||(z(k,!1),W(_)?.click())}function y(e){let t=e.currentTarget,n=Array.from(t.files??[]);t.value=``,b(n)}async function b(e){if(!(W(h)||!t.onuploadfiles||e.length===0)){z(h,!0);try{await t.onuploadfiles(e)}finally{z(h,!1)}}}function x(e){return!!(t.onuploadfiles&&e.dataTransfer?.types.includes(`Files`))}function S(e){x(e)&&(e.preventDefault(),W(h)||z(g,W(g)+1))}function C(e){x(e)&&(e.preventDefault(),e.dataTransfer.dropEffect=W(h)?`none`:`copy`)}function w(e){x(e)&&z(g,Math.max(0,W(g)-1),!0)}async function T(e){x(e)&&(e.preventDefault(),z(g,0),await b(Array.from(e.dataTransfer.files)))}let E=L(()=>{if(n()==null)return`Ready`;let e=Math.floor(Math.max(0,W(m)-n())/6e4);if(e===0)return`Ready since less than a minute ago`;let t=Math.floor(e/1440),r=Math.floor(e%1440/60),i=e%60,a=[];return t&&a.push(`${t} ${t===1?`day`:`days`}`),r&&a.push(`${r} ${r===1?`hour`:`hours`}`),i&&a.push(`${i} ${i===1?`minute`:`minutes`}`),`Ready since ${a.join(` `)} ago`});Yi(()=>{let e=setInterval(()=>{z(m,Date.now(),!0)},3e4);return()=>clearInterval(e)});let D=R(0),O=R(null),k=R(!1),ee=L(()=>Eg(t.message)),te=L(()=>Tg(t.message)),ne=L(()=>W(te)!==null&&W(te)!==W(O)&&W(ee).length>0),re=L(()=>Dg(t.message)),ie=L(()=>W(re)===`models`),ae=L(()=>Og(s())),oe=L(()=>W(re)===`reasoning`),se=L(()=>!t.activeTurnId&&!t.starting&&!W(h)&&!!t.message.trim()),ce=L(()=>!!t.message.trim()),le=L(()=>o()&&!a());function ue(e){t.starting||W(h)||(z(k,!1),e===`queue`?d()():e===`interrupt`?t.oninterrupt():f()())}function de(e,n=!1){z(O,null),z(D,0),t.onchange(e),n&&l()()}function A(e=W(D)){let t=W(ee)[e];t&&de(`/${t.name} `,!0)}function fe(e){if(e.key===`Enter`&&e.ctrlKey&&!e.isComposing){if(t.activeTurnId&&!t.starting&&W(ce)){e.preventDefault(),ue(`queue`);return}if(W(se)){e.preventDefault(),t.onsend();return}}if(W(ne)){if(e.key===`ArrowDown`){e.preventDefault(),z(D,(W(D)+1)%W(ee).length);return}if(e.key===`ArrowUp`){e.preventDefault(),z(D,(W(D)-1+W(ee).length)%W(ee).length);return}if(e.key===`Escape`){e.preventDefault(),z(O,W(te),!0);return}if(e.key===`Tab`){e.preventDefault(),A();return}}}var pe=qg();let me;var he=B(pe),ge=B(he),_e=e=>{var t=Ag(),n=V(t);F(),U(()=>J(n,`${W(E)??``} `)),q(e,t)},ve=e=>{var n=Jr();U(()=>J(n,t.status)),q(e,n)};Y(ge,e=>{t.status===`Ready.`?e(_e):e(ve,-1)}),P(he);var ye=H(he,2),be=e=>{var t=jg(),n=V(t);qi(n,e=>z(_,e),()=>W(_));var r=H(n,2),i=B(r),a=e=>{q(e,Jr(`Uploading files…`))},o=e=>{var t=Jr();U(()=>J(t,`Drop files to upload · ${Cg/1024/1024} MiB per file`)),q(e,t)},s=e=>{var t=Jr();U(()=>J(t,`Upload or drop files · ${Cg/1024/1024} MiB per file`)),q(e,t)};Y(i,e=>{W(h)?e(a):W(g)>0?e(o,1):e(s,-1)}),P(r),F(2),U(()=>n.disabled=W(h)),G(`change`,n,y),q(e,t)};Y(ye,e=>{t.onuploadfiles&&e(be)});var xe=H(ye,2),Se=e=>{var t=Mg(),n=B(t);P(t),U(()=>J(n,`You can read this conversation. Sending will connect to ${c()===`kimi`?`Kimi`:`Codex`}.`)),q(e,t)};Y(xe,e=>{i()&&e(Se)});var j=H(xe,2),Ce=e=>{var n=Pg(),r=B(n),i=B(r,!0);P(r);var s=H(r,2),c=e=>{var n=Ng();U(()=>n.disabled=t.starting||W(h)),G(`click`,n,function(...e){p()?.apply(this,e)}),q(e,n)};Y(s,e=>{o()&&e(c)}),P(n),U(()=>J(i,a())),q(e,n)};Y(j,e=>{a()&&e(Ce)});var we=H(j,2),Te=e=>{var t=Ig();X(t,23,()=>W(ee),e=>e.name,(e,t,n)=>{var r=Fg(),i=B(r),a=B(i),o=B(a);P(a);var s=H(a,2),c=B(s,!0);P(s),P(i),P(r),U(()=>{Ei(r,1,bi(W(n)===W(D)?`command-selected`:void 0),`svelte-1264sfg`),J(o,`/${W(t).name??``}`),J(c,W(t).description)}),G(`click`,i,()=>A(W(n))),q(e,r)}),P(t),q(e,t)};Y(we,e=>{W(ne)&&e(Te)});var Ee=H(we,2),De=e=>{var t=Rg();X(t,20,()=>W(ae),e=>e,(e,t)=>{var n=Lg(),r=B(n),i=B(r),a=B(i,!0);P(i),P(r),P(n),U(()=>J(a,t)),G(`click`,r,()=>{u()(t),l()()}),q(e,n)}),P(t),q(e,t)};Y(Ee,e=>{W(ie)&&e(De)});var Oe=H(Ee,2),ke=e=>{var t=zg();X(t,20,()=>[`low`,`medium`,`high`],e=>e,(e,t)=>{var n=Lg(),r=B(n),i=B(r),a=B(i,!0);P(i),P(r),P(n),U(()=>J(a,t)),G(`click`,r,()=>de(`/reasoning ${t} `,!0)),q(e,n)}),P(t),q(e,t)};Y(Oe,e=>{W(oe)&&e(ke)});var Ae=H(Oe,2),je=B(Ae);wn(je);let Me;var Ne=H(je,2),Pe=e=>{var n=Wg(),r=B(n),i=H(r,2),a=e=>{var n=Ug(),r=B(n),i=e=>{var t=Bg();U(()=>t.disabled=W(h)),G(`click`,t,v),q(e,t)};Y(r,e=>{t.onuploadfiles&&e(i)});var a=H(r,2),o=e=>{var n=Vg(),r=V(n),i=H(r,2);U(()=>{r.disabled=t.starting||W(h),i.disabled=t.starting||W(h)}),G(`click`,r,()=>ue(`queue`)),G(`click`,i,()=>ue(`interrupt-send`)),q(e,n)},s=e=>{var n=Hg();U(()=>n.disabled=t.starting||W(h)),G(`click`,n,()=>ue(`interrupt`)),q(e,n)};Y(a,e=>{W(ce)?e(o):e(s,-1)}),P(n),q(e,n)};Y(i,e=>{W(k)&&e(a)}),P(n),U(()=>{r.disabled=t.starting||W(h),Z(r,`aria-expanded`,W(k))}),G(`click`,r,()=>z(k,!W(k))),q(e,n)},Fe=e=>{var t=Gg();U(()=>t.disabled=W(h)),G(`click`,t,v),q(e,t)},Ie=e=>{var n=Kg();U(()=>{Z(n,`aria-label`,W(le)?`Retry send`:`Send prompt`),n.disabled=!W(se)}),G(`click`,n,function(...e){(W(le)?p():t.onsend)?.apply(this,e)}),q(e,n)};Y(Ne,e=>{t.activeTurnId?e(Pe):!W(ce)&&t.onuploadfiles?e(Fe,1):e(Ie,-1)}),P(Ae),P(pe),U(()=>{Z(pe,`aria-busy`,t.starting||W(h)),me=Ei(pe,1,`svelte-1264sfg`,null,me,{"drag-over":W(g)>0}),Z(he,`aria-label`,t.status===`Ready.`&&n()!=null?W(E):t.status),Ri(je,t.message),Z(je,`aria-describedby`,i()?`writer-hint`:void 0),Me=Ei(je,1,`svelte-1264sfg`,null,Me,{"new-empty":r()})}),Br(`dragenter`,pe,S),Br(`dragover`,pe,C),Br(`dragleave`,pe,w),Br(`drop`,pe,T),G(`input`,je,e=>de(e.currentTarget.value)),G(`keydown`,je,fe),q(e,pe),$e()}Vr([`change`,`click`,`input`,`keydown`]);function Yg(e){return[...e].map(e=>({file:e,status:e.size>104857600?`too-large`:`queued`}))}function Xg(e){return e.findIndex(e=>e.status===`queued`)}function Zg(e){let t=[],n=/```[^\n]*\n([\s\S]*?)```/g,r=0;for(let i of e.matchAll(n)){let n=e.slice(r,i.index);n&&t.push(...Qg(n)),t.push({kind:`code`,text:i[1]??``}),r=(i.index??0)+i[0].length}let i=e.slice(r);return(i||!t.length)&&t.push(...Qg(i)),t}function Qg(e){let t=[],n=e.split(`
|
|
72
|
-
`),r=0,i=e=>{let i=n.slice(r,e).join(`
|
|
73
|
-
`);i&&t.push({kind:`text`,parts:n_(i)})};for(let e=0;e<n.length;e+=1){let a=$g(n[e]??``);if(a){i(e),t.push({kind:`heading`,level:a.level,parts:n_(a.text)}),r=e+1;continue}if(e===n.length-1)continue;let o=e_(n[e]??``),s=e_(n[e+1]??``);if(!o||!s||o.length!==s.length||!s.every(t_))continue;i(e),e+=2;let c=[];for(;e<n.length;){let t=e_(n[e]??``);if(!t||t.length!==o.length)break;c.push(t),e+=1}t.push({kind:`table`,headers:o.map(n_),rows:c.map(e=>e.map(n_))}),r=e,--e}return i(n.length),t.length?t:[{kind:`text`,parts:n_(e)}]}function $g(e){let t=/^ {0,3}(#{1,6})[ \t]+(.+?)[ \t]*#*[ \t]*$/.exec(e);return t?{level:t[1].length,text:t[2]??``}:null}function e_(e){let t=e.trim();if(!t.includes(`|`))return null;let n=t.replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim());return n.length>1&&n.every(Boolean)?n:null}function t_(e){return/^:?-{3,}:?$/.test(e)}function n_(e){let t=[],n=/\[([^\]]+)\]\((https?:\/\/[^\s)]+|codex:\/\/[^\s)]+|file:\/\/[^\s)]+|\/[^\s)]+|\.{1,2}\/[^\s)]+|[^\s:()]+\.[a-zA-Z\d]+(?::\d+(?::\d+)?)?(?:#L\d+(?:C\d+)?)?|<(?:https?:\/\/|codex:\/\/|file:\/\/|\/|\.{1,2}\/)[^>\n]+>)\)|`([^`]+)`|\*\*([^*\n]+)\*\*/g,r=0;for(let i of e.matchAll(n)){let n=e.slice(r,i.index);n&&t.push({kind:`text`,text:n}),t.push(i[3]?{kind:`code`,text:i[3]}:i[4]?{kind:`strong`,parts:n_(i[4])}:{kind:`link`,text:i[1]??``,href:(i[2]??``).replace(/^<|>$/g,``)}),r=(i.index??0)+i[0].length}let i=e.slice(r);return i&&t.push({kind:`text`,text:i}),t}function r_(e){let t=/(?::(\d+)(?::\d+)?|#L(\d+)(?:C\d+)?)$/.exec(e);if(!t)return{path:e};let n=Number(t[1]??t[2]);return{path:e.slice(0,t.index),...Number.isSafeInteger(n)&&n>0?{line:n}:{}}}function i_(e,t=!0){let n;try{n=t?decodeURIComponent(e):e}catch{return null}if(n.startsWith(`file://`))try{let e=new URL(n);if(e.hostname&&e.hostname!==`localhost`)return null;n=decodeURIComponent(e.pathname+e.hash)}catch{return null}let r=r_(n);return n=r.path,/^[a-z][a-z\d+.-]*:/i.test(n)||n.startsWith(`//`)||/[\u0000-\u001f\\]/.test(n)||!n||n.startsWith(`#`)||n.includes(`?`)||n.includes(`#`)||!n.startsWith(`/`)&&!n.startsWith(`./`)&&!n.startsWith(`../`)&&!/\.[a-z\d]+$/i.test(n)?null:r}function a_(e,t=!0){return i_(e,t)?.path??null}var o_=/^(.*\.org)(?::\d+(?::\d+)?)?(?:#L\d+(?:C\d+)?)?$/;function s_(e){try{return decodeURIComponent(e)}catch{return null}}function c_(e){if(!e.startsWith(`/`)||e.includes(`\0`))return null;let t=[];for(let n of e.split(`/`))if(!(!n||n===`.`)){if(n===`..`){if(t.length===0)return null;t.pop();continue}t.push(n)}return t}function l_(e,t){let n=s_(e),r=s_(t),i=n?o_.exec(n):null;if(!i||!r)return null;let a=c_(i[1]??``),o=c_(r);if(!a||!o||a.length<=o.length||o.some((e,t)=>a[t]!==e))return null;let s=a.slice(o.length).join(`/`);return s.endsWith(`.org`)&&s!==`.org`?s:null}function u_(e){let t=s_(e);if(!t)return!1;let n=o_.exec(t);return!!(n&&c_(n[1]??``))}async function d_(e,t=globalThis.navigator?.clipboard,n=p_){if(!t)return f_(e,n);try{return await t.writeText(e),!0}catch{return f_(e,n)}}function f_(e,t){try{return t(e)}catch{return!1}}function p_(e){if(typeof document>`u`||!document.body)return!1;let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.cssText=`position:fixed;opacity:0`,document.body.append(t),t.select();let n=document.execCommand(`copy`);return t.remove(),n}var m_=K(`<a class="svelte-1p5tlta"> </a>`),h_=K(`<a target="_blank" rel="noreferrer" class="svelte-1p5tlta"> </a>`),g_=K(`<code class="svelte-1p5tlta"> </code>`),__=K(`<strong class="svelte-1p5tlta"><!></strong>`),v_=K(`<div class="code-block svelte-1p5tlta"><button class="code-copy svelte-1p5tlta" type="button" title="Copy code"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-1p5tlta"><rect x="9" y="9" width="10" height="10" rx="2"></rect><path d="M15 9V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2"></path></svg></button> <pre class="svelte-1p5tlta"><code class="svelte-1p5tlta"> </code></pre></div>`),y_=K(`<th scope="col" class="svelte-1p5tlta"><!></th>`),b_=K(`<td class="svelte-1p5tlta"><!></td>`),x_=K(`<tr></tr>`),S_=K(`<div class="table-scroll svelte-1p5tlta"><table class="svelte-1p5tlta"><thead><tr></tr></thead><tbody></tbody></table></div>`),C_=K(`<h1 class="svelte-1p5tlta"><!></h1>`),w_=K(`<h2 class="svelte-1p5tlta"><!></h2>`),T_=K(`<h3 class="svelte-1p5tlta"><!></h3>`),E_=K(`<h4 class="svelte-1p5tlta"><!></h4>`),D_=K(`<h5 class="svelte-1p5tlta"><!></h5>`),O_=K(`<h6 class="svelte-1p5tlta"><!></h6>`),k_=K(`<div class="svelte-1p5tlta"><!></div>`),A_=K(`<div class="message-content svelte-1p5tlta"></div>`);function j_(e,t){I(t,!0);let n=(e,r=b)=>{var i=Yr();X(V(i),17,r,ii,(e,r)=>{var i=Yr(),o=V(i),s=e=>{var n=Yr(),i=V(n),o=e=>{var t=m_(),n=B(t,!0);P(t),U(()=>{Z(t,`href`,W(r).href),J(n,W(r).text)}),G(`click`,t,e=>a(e,W(r).href)),q(e,t)},s=L(()=>t.onopenorg&&u_(W(r).href)),c=e=>{var n=m_(),i=B(n,!0);P(n),U(()=>{Z(n,`href`,W(r).href),J(i,W(r).text)}),G(`click`,n,e=>{e.preventDefault();let n=i_(W(r).href);n.line?t.onopenfile?.(n.path,n.line):t.onopenfile?.(n.path)}),q(e,n)},l=L(()=>t.onopenfile&&a_(W(r).href)),u=e=>{var t=h_(),n=B(t,!0);P(t),U(()=>{Z(t,`href`,W(r).href),J(n,W(r).text)}),q(e,t)};Y(i,e=>{W(s)?e(o):W(l)?e(c,1):e(u,-1)}),q(e,n)},c=e=>{var t=g_(),n=B(t,!0);P(t),U(()=>J(n,W(r).text)),q(e,t)},l=e=>{var t=__(),i=B(t);n(i,()=>W(r).parts),P(t),q(e,t)},u=e=>{var t=Jr();U(()=>J(t,W(r).text)),q(e,t)};Y(o,e=>{W(r).kind===`link`?e(s):W(r).kind===`code`?e(c,1):W(r).kind===`strong`?e(l,2):e(u,-1)}),q(e,i)}),q(e,i)},r=Q(t,`oncopyresult`,3,()=>{}),i=Q(t,`clipboard`,19,()=>globalThis.navigator?.clipboard);function a(e,n){!t.onopenorg||!u_(n)||(e.preventDefault(),t.onopenorg(n))}function o(e){return`Copy code block: ${(e.trim().split(`
|
|
74
|
-
`)[0]?.trim()||`empty block`).slice(0,48)}`}async function s(e){r()(await d_(e,i()))}var c=A_();X(c,21,()=>Zg(t.text),ii,(e,t)=>{var r=Yr(),i=V(r),a=e=>{var n=v_(),r=B(n),i=H(r,2),a=B(i),c=B(a,!0);P(a),P(i),P(n),U(e=>{Z(r,`aria-label`,e),J(c,W(t).text)},[()=>o(W(t).text)]),G(`click`,r,()=>void s(W(t).text)),q(e,n)},c=e=>{var r=S_(),i=B(r),a=B(i),o=B(a);X(o,21,()=>W(t).headers,ii,(e,t)=>{var r=y_(),i=B(r);n(i,()=>W(t)),P(r),q(e,r)}),P(o),P(a);var s=H(a);X(s,21,()=>W(t).rows,ii,(e,t)=>{var r=x_();X(r,21,()=>W(t),ii,(e,t)=>{var r=b_(),i=B(r);n(i,()=>W(t)),P(r),q(e,r)}),P(r),q(e,r)}),P(s),P(i),P(r),q(e,r)},l=e=>{var r=Yr(),i=V(r),a=e=>{var r=C_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},o=e=>{var r=w_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},s=e=>{var r=T_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},c=e=>{var r=E_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},l=e=>{var r=D_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},u=e=>{var r=O_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)};Y(i,e=>{W(t).level===1?e(a):W(t).level===2?e(o,1):W(t).level===3?e(s,2):W(t).level===4?e(c,3):W(t).level===5?e(l,4):e(u,-1)}),q(e,r)},u=e=>{var r=k_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)};Y(i,e=>{W(t).kind===`code`?e(a):W(t).kind===`table`?e(c,1):W(t).kind===`heading`?e(l,2):e(u,-1)}),q(e,r)}),P(c),q(e,c),$e()}Vr([`click`]);var M_=K(`<time> </time>`),N_=K(`<div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Supervisor explanation</dt> <dd class="supervisor-report svelte-1hnxk0w"><!></dd></div>`),P_=K(`<div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Supervisor explanation</dt> <dd class="svelte-1hnxk0w"> </dd></div>`),F_=K(`<button type="button" class="svelte-1hnxk0w"> </button>`),I_=K(`<label>Optional guidance for the resumed work</label> <textarea maxlength="600" class="svelte-1hnxk0w"></textarea> <p class="guidance-help svelte-1hnxk0w"> </p> <div class="actions svelte-1hnxk0w"><button type="button" class="svelte-1hnxk0w"> </button> <button type="button" class="svelte-1hnxk0w">Disable Autopilot</button> <!></div>`,1),L_=K(`<p>This request is no longer pending.</p>`),R_=K(`<section tabindex="-1" class="attention svelte-1hnxk0w"><h3 class="svelte-1hnxk0w"> </h3> <!> <dl class="svelte-1hnxk0w"><div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Reason</dt> <dd class="svelte-1hnxk0w"> </dd></div> <div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">What happened</dt> <dd class="svelte-1hnxk0w"><!></dd></div> <!> <div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Requested action</dt> <dd class="svelte-1hnxk0w"><!></dd></div> <div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Resume when</dt> <dd class="svelte-1hnxk0w"> </dd></div></dl> <!></section>`);function z_(e,t){I(t,!0);let n=Q(t,`controlId`,3,`autopilot-attention`),r=Q(t,`pending`,3,!1),i=Q(t,`historical`,3,!1),a=Q(t,`onresolve`,3,()=>{}),o=Q(t,`debugPending`,3,!1),s=R(``),c={planChange:`Plan change needs approval`,hardBlock:`Work is blocked`,missingDependency:`A required capability is missing`,permissionRequired:`Permission is needed`,externalState:`An external condition changed`,materialAmbiguity:`A decision is needed`},l={userGuidance:`You have provided the decision or guidance below.`,planRevision:`You have approved or revised the plan.`,dependencyInstalled:`The required capability is available.`,permissionGranted:`The required permission has been granted.`,externalStateChanged:`The blocker has been resolved, or you have provided a way forward below.`},u=L(()=>t.attention?.attention.summary.startsWith(`Supervised execution requires human attention (`)),d=L(()=>W(s).trim().length>600?`Guidance must be 600 characters or fewer.`:``);var f=Yr(),p=V(f),m=e=>{var f=R_(),p=B(f),m=B(p,!0);P(p);var h=H(p,2),g=e=>{var n=M_(),r=B(n);P(n),U((e,t)=>{Z(n,`datetime`,e),J(r,`Resolved ${t??``}`)},[()=>new Date(t.resolvedAt).toISOString(),()=>new Date(t.resolvedAt).toLocaleString()]),q(e,n)},_=e=>{var n=M_(),r=B(n,!0);P(n),U(e=>{Z(n,`datetime`,t.attention.requestedAt),J(r,e)},[()=>new Date(t.attention.requestedAt).toLocaleString()]),q(e,n)};Y(h,e=>{i()&&t.resolvedAt!==void 0?e(g):t.attention.requestedAt&&e(_,1)});var v=H(h,2),y=B(v),b=H(B(y),2),x=B(b,!0);P(b),P(y);var S=H(y,2),C=H(B(S),2),w=B(C);{let e=L(()=>W(u)?`The supervisor has paused work and needs your help to continue.`:t.attention.attention.summary);j_(w,{get text(){return W(e)},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult}})}P(C),P(S);var T=H(S,2),E=e=>{var n=N_(),r=H(B(n),2);j_(B(r),{get text(){return t.attention.supervisorReport},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult}}),P(r),P(n),q(e,n)},D=e=>{var t=P_(),n=H(B(t),2),r=B(n,!0);P(n),P(t),U(()=>J(r,i()?`No supervisor explanation was retained for this request.`:`The supervisor has not supplied an explanation yet. You can ask for details in the guidance below.`)),q(e,t)};Y(T,e=>{t.attention.supervisorReport?e(E):W(u)&&e(D,1)});var O=H(T,2),k=H(B(O),2),ee=B(k);{let e=L(()=>W(u)?`Resolve the blocker or describe a way forward below, then choose Resume. You can also disable Autopilot.`:t.attention.attention.requestedAction);j_(ee,{get text(){return W(e)},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult}})}P(k),P(O);var te=H(O,2),ne=H(B(te),2),re=B(ne,!0);P(ne),P(te),P(v);var ie=H(v,2),ae=e=>{var i=I_(),c=V(i),l=H(c,2);wn(l);var u=H(l,2),f=B(u,!0);P(u);var p=H(u,2),m=B(p),h=B(m,!0);P(m);var g=H(m,2),_=H(g,2),v=e=>{var n=F_(),i=B(n,!0);P(n),U(()=>{n.disabled=r()||o(),J(i,o()?`Preparing DEBUG…`:`DEBUG`)}),G(`click`,n,e=>t.ondebug?.(t.attention.requestId,e.currentTarget)),q(e,n)};Y(_,e=>{t.ondebug&&e(v)}),P(p),U((e,i)=>{Z(c,`for`,`${n()}-guidance`),Z(l,`id`,`${n()}-guidance`),Z(l,`aria-describedby`,`${n()}-guidance-help`),Z(l,`aria-invalid`,e),Z(u,`id`,`${n()}-guidance-help`),J(f,W(d)||`Up to 600 characters. Do not include secrets.`),m.disabled=i,J(h,r()?`Updating…`:t.attention.attention.executorReplacement?`Authorize replacement`:`Resume`),g.disabled=r()},[()=>!!W(d),()=>r()||!!W(d)]),Ui(l,()=>W(s),e=>z(s,e)),G(`click`,m,()=>W(s).trim()?a()(`resume`,W(s)):a()(`resume`)),G(`click`,g,()=>a()(`disableAutopilot`)),q(e,i)},oe=e=>{q(e,L_())};Y(ie,e=>{i()?e(oe,-1):e(ae)}),P(f),U(()=>{Z(f,`id`,n()),Z(f,`role`,i()?`region`:`alert`),Z(f,`aria-labelledby`,`${n()}-title`),Z(p,`id`,`${n()}-title`),J(m,i()?`Autopilot attention request`:`Autopilot needs your attention`),J(x,c[t.attention.attention.reason]??`Supervised work needs attention`),J(re,l[t.attention.attention.resumeCondition]??`You are ready for the supervisor to continue.`)}),q(e,f)};Y(p,e=>{t.attention&&e(m)}),q(e,f),$e()}Vr([`click`]);var B_=[`planChange`,`hardBlock`,`missingDependency`,`permissionRequired`,`externalState`,`materialAmbiguity`],V_=[`userGuidance`,`planRevision`,`dependencyInstalled`,`permissionGranted`,`externalStateChanged`],H_={planChange:`planRevision`,hardBlock:`externalStateChanged`,missingDependency:`dependencyInstalled`,permissionRequired:`permissionGranted`,externalState:`externalStateChanged`,materialAmbiguity:`userGuidance`};function U_(e){if(!J_(e))return null;let t=Object.keys(e);if(t.length===2&&t.every(e=>e===`reason`||e===`resumeCondition`)&&G_(e.reason)&&K_(e.resumeCondition)&&H_[e.reason]===e.resumeCondition)return{reason:e.reason,summary:`Supervised execution requires human attention (${e.reason}).`,requestedAction:`Satisfy the ${e.resumeCondition} resume condition, then resume or disable Autopilot.`,resumeCondition:e.resumeCondition};if(t.length!==4&&t.length!==5||t.some(e=>![`reason`,`summary`,`requestedAction`,`resumeCondition`,`executorReplacement`].includes(e)))return null;let n=W_(e.executorReplacement);return!G_(e.reason)||!q_(e.summary,600)||!q_(e.requestedAction,600)||!K_(e.resumeCondition)||H_[e.reason]!==e.resumeCondition||e.executorReplacement!==void 0&&!n||n&&e.reason!==`permissionRequired`?null:{reason:e.reason,summary:e.summary,requestedAction:e.requestedAction,resumeCondition:e.resumeCondition,...n?{executorReplacement:n}:{}}}function W_(e){return!J_(e)||Object.keys(e).length!==1?null:typeof e.canonicalTaskName==`string`&&/^l[1-9][0-9]*$/.test(e.canonicalTaskName)?{canonicalTaskName:e.canonicalTaskName}:null}function G_(e){return typeof e==`string`&&B_.includes(e)}function K_(e){return typeof e==`string`&&V_.includes(e)}function q_(e,t){return typeof e==`string`&&e.trim().length>0&&e.length<=t}function J_(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Y_(e){let t=new Map;for(let n of e){if(!n.label.toLowerCase().replaceAll(` `,``).startsWith(`filechange`))continue;let e=n.changes?.length?n.changes:n.detail.split(`
|
|
75
|
-
`).filter(Boolean).map(e=>({path:e,additions:null,deletions:null}));for(let r of e){let e=t.get(r.path),i=typeof r.additions==`number`&&typeof r.deletions==`number`;t.set(r.path,{path:r.path,additions:i&&e?.additions!==null?(e?.additions??0)+r.additions:null,deletions:i&&e?.deletions!==null?(e?.deletions??0)+r.deletions:null,...n.occurredAt===void 0?e?.touchedAt===void 0?{}:{touchedAt:e.touchedAt}:{touchedAt:Math.max(e?.touchedAt??0,n.occurredAt)}})}}return[...t.values()]}function X_(e){return{files:e.length,additions:e.every(e=>e.additions!==null)?e.reduce((e,t)=>e+t.additions,0):null,deletions:e.every(e=>e.deletions!==null)?e.reduce((e,t)=>e+t.deletions,0):null}}function Z_(e,t){if(e===void 0||t===void 0||!Number.isFinite(e)||!Number.isFinite(t))return null;let n=Math.floor(Math.max(0,t-e)/6e4);if(n<1)return`moments later`;if(n<60)return`${n} minute${n===1?``:`s`} later`;let r=Math.floor(n/60);if(r<24)return`${r} hour${r===1?``:`s`} later`;let i=Math.floor(r/24);return`${i} day${i===1?``:`s`} later`}function Q_(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(e)}function $_(e,t){let n=Math.floor(Math.max(0,t-e)/1e3);if(n<60)return`${n}s ago`;let r=Math.floor(n/60);if(r<60)return`${r}m ago`;let i=Math.floor(r/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}var ev=K(`<dl class="command-counts svelte-11ye6aj"><div class="svelte-11ye6aj"><dt class="svelte-11ye6aj">Successful commands</dt> <dd class="svelte-11ye6aj"> </dd></div> <div class="svelte-11ye6aj"><dt class="svelte-11ye6aj">Failed commands</dt> <dd class="svelte-11ye6aj"> </dd></div></dl>`),tv=K(`<li data-status="failed" class="svelte-11ye6aj"><code class="svelte-11ye6aj"> </code></li>`),nv=K(`<section aria-label="Failed commands"><strong>Failed commands</strong> <ul class="activity-list svelte-11ye6aj"></ul></section>`),rv=K(`<span class="svelte-11ye6aj"> </span>`),iv=K(`<li class="svelte-11ye6aj"><small class="svelte-11ye6aj"> </small> <!></li>`),av=K(`<ul class="activity-list svelte-11ye6aj" aria-label="Work activity"></ul>`),ov=K(`<time class="svelte-11ye6aj"> </time>`),sv=K(`<span class="svelte-11ye6aj">time unknown</span>`),cv=K(`<li class="svelte-11ye6aj"><code class="svelte-11ye6aj"> </code> <span class="file-counts svelte-11ye6aj" aria-label="Line changes"><span class="svelte-11ye6aj"> </span><span class="svelte-11ye6aj"> </span></span> <!></li>`),lv=K(`<section aria-label="Files changed"><strong>Files changed</strong> <ul class="file-list svelte-11ye6aj"></ul></section>`),uv=K(`<details class="work-details svelte-11ye6aj"><summary class="svelte-11ye6aj"> </summary> <div class="work-details-content svelte-11ye6aj"><!> <!> <!> <!></div></details>`);function dv(e,t){I(t,!0);let n=Q(t,`now`,19,()=>Date.now()),r=L(()=>eh(t.activities)),i=L(()=>t.activities.flatMap(e=>{let t=th(e);return t?.kind===`Command`&&t.status===`failed`?[{id:e.id,command:t.content}]:[]})),a=L(()=>Y_(t.activities)),o=L(()=>X_(W(a))),s=L(()=>t.activities.flatMap(e=>{let t=th(e);return t&&t.kind!==`Command`&&t.kind!==`File change`?[{id:e.id,...t}]:[]})),c=L(()=>t.activities.length),l=L(()=>W(a).length?`${W(o).files} ${W(o).files===1?`file`:`files`} changed · +${W(o).additions??`?`} −${W(o).deletions??`?`}`:`Work details · ${W(c)} ${W(c)===1?`activity`:`activities`}`);var u=Yr(),d=V(u),f=e=>{var t=uv(),o=B(t),c=B(o,!0);P(o);var u=H(o,2),d=B(u),f=e=>{var t=ev(),n=B(t),i=H(B(n),2),a=B(i,!0);P(i),P(n);var o=H(n,2),s=H(B(o),2),c=B(s,!0);P(s),P(o),P(t),U(()=>{J(a,W(r).successful),J(c,W(r).failed)}),q(e,t)};Y(d,e=>{(W(r).successful||W(r).failed)&&e(f)});var p=H(d,2),m=e=>{var t=nv(),n=H(B(t),2);X(n,21,()=>W(i),e=>e.id,(e,t)=>{var n=tv(),r=B(n),i=B(r,!0);P(r),P(n),U(()=>J(i,W(t).command)),q(e,n)}),P(n),P(t),q(e,t)};Y(p,e=>{W(i).length&&e(m)});var h=H(p,2),g=e=>{var t=av();X(t,21,()=>W(s),e=>e.id,(e,t)=>{var n=iv(),r=B(n),i=B(r);P(r);var a=H(r,2),o=e=>{dh(e,{get startup(){return W(t).startup}})},s=e=>{var n=rv(),r=B(n,!0);P(n),U(()=>J(r,W(t).content)),q(e,n)};Y(a,e=>{W(t).startup?e(o):e(s,-1)}),P(n),U(()=>{Z(n,`data-status`,W(t).status),J(i,`${W(t).kind??``}${W(t).status?` · ${W(t).status}`:``}`)}),q(e,n)}),P(t),q(e,t)};Y(h,e=>{W(s).length&&e(g)});var _=H(h,2),v=e=>{var t=lv(),r=H(B(t),2);X(r,21,()=>W(a),e=>e.path,(e,t)=>{var r=cv(),i=B(r),a=B(i,!0);P(i);var o=H(i,2),s=B(o),c=B(s);P(s);var l=H(s),u=B(l);P(l),P(o);var d=H(o,2),f=e=>{var r=ov(),i=B(r,!0);P(r),U((e,t)=>{Z(r,`datetime`,e),J(i,t)},[()=>new Date(W(t).touchedAt).toISOString(),()=>$_(W(t).touchedAt,n())]),q(e,r)},p=e=>{q(e,sv())};Y(d,e=>{W(t).touchedAt===void 0?e(p,-1):e(f)}),P(r),U(()=>{J(a,W(t).path),J(c,`+${W(t).additions??`?`??``}`),J(u,`-${W(t).deletions??`?`??``}`)}),q(e,r)}),P(r),P(t),q(e,t)};Y(_,e=>{W(a).length&&e(v)}),P(u),P(t),U(()=>J(c,W(l))),q(e,t)};Y(d,e=>{W(c)&&e(f)}),q(e,u),$e()}function fv(e){if(!e||typeof e!=`object`)return null;let t=e.command;return typeof t==`string`&&t.trim()?t:null}function pv(e){if(!mv(e))return null;let t=e.changes;if(!Array.isArray(t))return null;let n=t.map(e=>mv(e)&&typeof e.path==`string`&&e.path.trim()?e.path:null).filter(e=>e!==null);return n.length===t.length&&n.length>0?n:null}function mv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var hv=K(`<div class="choice svelte-77f3gb"><input type="radio" class="svelte-77f3gb"/> <label class="svelte-77f3gb"><strong> </strong></label> <div class="choice-description svelte-77f3gb"><!></div></div>`),gv=K(`<label class="custom svelte-77f3gb">Your custom answer <input required="" class="svelte-77f3gb"/></label>`),_v=K(`<div class="choice svelte-77f3gb"><input type="radio" class="svelte-77f3gb"/> <label class="svelte-77f3gb"><strong>Custom answer</strong><span class="svelte-77f3gb">Provide your own response.</span></label></div> <!>`,1),vv=K(`<fieldset class="svelte-77f3gb"><legend class="svelte-77f3gb"><strong> </strong></legend> <!> <div class="choices svelte-77f3gb"><!> <!></div></fieldset>`),yv=K(`<form class="quiz-form svelte-77f3gb"><fieldset class="questions svelte-77f3gb"></fieldset> <button type="submit">Send answers</button></form>`);function bv(e,t){I(t,!0);let n=Q(t,`disabled`,3,!1),r=cn({}),i=cn({}),a=L(()=>t.quiz.questions.every(e=>!!t.answers[e.id]?.trim()));async function o(e){i[e]=!0,t.onanswer(e,t.answers[e]??``),await Or(),r[e]?.focus()}var s=yv(),c=B(s);X(c,21,()=>t.quiz.questions,e=>e.id,(e,n)=>{let a=L(()=>`${t.requestId}-${W(n).id}-custom`),s=L(()=>W(n).choices.some(e=>e.label===t.answers[W(n).id]));var c=vv(),l=B(c),u=B(l),d=B(u,!0);P(u),P(l);var f=H(l,2);j_(f,{get text(){return W(n).question},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult}});var p=H(f,2),m=B(p);X(m,17,()=>W(n).choices,e=>`${W(n).id}-${e.label}`,(e,r)=>{let a=L(()=>`${t.requestId}-${W(n).id}-${W(r).label}`);var o=hv(),s=B(o);Li(s);var c=H(s,2),l=B(c),u=B(l,!0);P(l),P(c);var d=H(c,2);j_(B(d),{get text(){return W(r).description},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult}}),P(d),P(o),U(()=>{Z(s,`id`,W(a)),Z(s,`name`,`${t.requestId}-${W(n).id}`),Z(s,`aria-describedby`,`${W(a)}-description`),zi(s,t.answers[W(n).id]===W(r).label),Z(c,`for`,W(a)),J(u,W(r).label),Z(d,`id`,`${W(a)}-description`)}),G(`change`,s,()=>{i[W(n).id]=!1,t.onanswer(W(n).id,W(r).label)}),q(e,o)});var h=H(m,2),g=e=>{var c=_v(),l=V(c),u=B(l);Li(u);var d=H(u,2);P(l);var f=H(l,2),p=e=>{var i=gv(),o=H(B(i));Li(o),qi(o,(e,t)=>r[t.id]=e,e=>r?.[e.id],()=>[W(n)]),P(i),U(()=>{Z(i,`for`,`${W(a)}-text`),Z(o,`id`,`${W(a)}-text`),Z(o,`type`,W(n).isSecret?`password`:`text`),Ri(o,t.answers[W(n).id])}),G(`input`,o,e=>t.onanswer(W(n).id,e.currentTarget.value)),q(e,i)},m=L(()=>i[W(n).id]||!!t.answers[W(n).id]&&!W(s));Y(f,e=>{W(m)&&e(p)}),U(e=>{Z(u,`id`,W(a)),Z(u,`name`,`${t.requestId}-${W(n).id}`),zi(u,e),Z(d,`for`,W(a))},[()=>i[W(n).id]||!!t.answers[W(n).id]&&!W(s)]),G(`change`,u,()=>o(W(n).id)),G(`click`,u,()=>{i[W(n).id]&&o(W(n).id)}),q(e,c)};Y(h,e=>{W(n).allowCustom&&e(g)}),P(p),P(c),U(()=>J(d,W(n).header)),q(e,c)}),P(c);var l=H(c,2);P(s),U(()=>{c.disabled=n(),l.disabled=n()||!W(a)}),Br(`submit`,s,e=>{e.preventDefault(),W(a)&&t.onsubmit()}),q(e,s),$e()}Vr([`change`,`click`,`input`]);function xv(e,t=2){if(!Ov(e)||!Array.isArray(e.questions)||e.questions.length<1||e.questions.length>8)return null;let n=e.questions.map(e=>wv(e,t));if(n.some(e=>e===null))return null;let r=n;return new Set(r.map(e=>e.id)).size===r.length?{questions:r}:null}function Sv(e){return!Ov(e)||!Array.isArray(e.questions)||e.questions.length>3?null:xv({questions:e.questions.map(e=>Ov(e)?{id:e.id,header:e.header,question:e.question,choices:e.options,allowCustom:e.isOther===!0,isSecret:e.isSecret===!0}:e)},1)}function Cv(e){return{contentItems:[{type:`inputText`,text:JSON.stringify({answers:Object.fromEntries(e.filter(e=>e.answer.trim()).map(e=>[e.id,e.answer]))})}],success:!0}}function wv(e,t){if(!Ov(e)||!Array.isArray(e.choices)||e.choices.length<t||e.choices.length>5||!Ev(e.id)||!Dv(e.header,120)||!Dv(e.question,600)||typeof e.allowCustom!=`boolean`)return null;let n=e.choices.map(Tv);return n.some(e=>e===null)?null:{id:e.id,header:e.header,question:e.question,choices:n,allowCustom:e.allowCustom,isSecret:e.isSecret===!0}}function Tv(e){return!Ov(e)||!Dv(e.label,160)||!Dv(e.description,600)?null:{label:e.label,description:e.description}}function Ev(e){return typeof e==`string`&&/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(e)}function Dv(e,t){return typeof e==`string`&&e.trim().length>0&&e.length<=t}function Ov(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var kv=K(`<time> </time>`),Av=K(`<!> <p class="interaction-result svelte-ajsqcq" data-interaction-state="resolved" tabindex="-1"> </p> <!>`,1),jv=K(`<p class="interaction-submitting svelte-ajsqcq" data-interaction-state="submitting">Submitting…</p>`),Mv=K(`<p>Codex sent an invalid quiz request.</p>`),Nv=K(`<p>Grant the requested permissions for this turn only.</p> <button type="button">Approve</button>`,1),Pv=K(`<pre class="command-approval-command svelte-ajsqcq"><code> </code></pre>`),Fv=K(`<p class="command-approval-missing svelte-ajsqcq">Command details were not provided.</p>`),Iv=K(`<p>Approve this command?</p> <!> <div class="approval-actions svelte-ajsqcq"><button type="button">Approve</button> <button type="button">Deny</button></div>`,1),Lv=K(`<li><code> </code></li>`),Rv=K(`<ul class="file-change-approval-targets svelte-ajsqcq" aria-label="Files to change"></ul>`),zv=K(`<p class="file-change-approval-missing svelte-ajsqcq">File details were not provided.</p>`),Bv=K(`<p>Approve changes to these files?</p> <!> <div class="approval-actions svelte-ajsqcq"><button type="button">Approve</button> <button type="button">Deny</button></div>`,1),Vv=K(`<button type="button">Approve</button><button type="button">Deny</button>`,1),Hv=K(`<p class="interaction-failed svelte-ajsqcq" data-interaction-state="failed">Could not send. Try again.</p> <button type="button">Retry</button>`,1),Uv=K(`<!> <!> <!>`,1),Wv=K(`<li class="svelte-ajsqcq"><div class="submitted-question svelte-ajsqcq"><strong> </strong> <!></div> <div class="submitted-answer svelte-ajsqcq"><!></div></li>`),Gv=K(`<section class="submitted-answers svelte-ajsqcq" aria-label="Submitted answers" aria-live="polite"><p class="svelte-ajsqcq"><strong>Submitted answers</strong></p> <ol class="svelte-ajsqcq"></ol> <p class="submitted-note svelte-ajsqcq">Recorded in this chat view before delivery.</p></section>`),Kv=K(`<article tabindex="-1"><p class="interaction-kind svelte-ajsqcq"> </p> <!> <!></article>`);function qv(e,t){I(t,!0);let n=Q(t,`submittedAnswers`,19,()=>({})),r=Q(t,`onretry`,3,()=>{}),i=R(null),a=cn({}),o=e=>Object.fromEntries(Object.entries(t.answers).filter(([t])=>t.startsWith(`${e}:`)).map(([t,n])=>[t.slice(e.length+1),n]));function s(e,t){z(i,e.requestId,!0),t()}Pn(()=>{let e=t.interactions.find(e=>e.requestId===W(i));e?.state===`resolved`&&(Or().then(()=>a[e.requestId]?.focus()),z(i,null))});var c=Yr();X(V(c),17,()=>t.interactions,e=>e.key??e.requestId,(e,i)=>{let c=L(()=>W(i).state===`submitting`);var l=Kv();let u;var d=B(l),f=B(d,!0);P(d);var p=H(d,2),m=e=>{var r=Av(),o=V(r),s=e=>{var t=kv(),n=B(t);P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,`Resolved ${r??``}`)},[()=>new Date(W(i).resolvedAt).toISOString(),()=>new Date(W(i).resolvedAt).toLocaleString()]),q(e,t)};Y(o,e=>{W(i).resolvedAt!==void 0&&e(s)});var c=H(o,2),l=B(c,!0);P(c),qi(c,(e,t)=>a[t.requestId]=e,e=>a?.[e.requestId],()=>[W(i)]);var u=H(c,2),d=e=>{let n=L(()=>W(i).kind===`quiz`?xv(W(i).payload):W(i).kind===`userInput`?Sv(W(i).payload):null);var r=Yr();X(V(r),17,()=>W(n)?.questions??[],e=>e.id,(e,n)=>{j_(e,{get text(){return W(n).question},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult}})}),q(e,r)};Y(u,e=>{n()[W(i).requestId]?.length||e(d)}),U(()=>J(l,W(i).attemptedOutcome===`denied`?`Denied`:W(i).attemptedOutcome===`dismissed`?`No longer awaiting a response`:W(i).attemptedOutcome===`answered`?`Answers sent`:`Approved`)),q(e,r)},h=e=>{var a=Uv(),l=V(a),u=e=>{q(e,jv())};Y(l,e=>{W(c)&&e(u)});var d=H(l,2),f=e=>{let r=L(()=>W(i).kind===`quiz`?xv(W(i).payload):Sv(W(i).payload));var a=Yr(),l=V(a),u=e=>{},d=e=>{{let n=L(()=>o(W(i).requestId));bv(e,{get requestId(){return W(i).requestId},get quiz(){return W(r)},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult},get answers(){return W(n)},get disabled(){return W(c)},onanswer:(e,n)=>t.onanswer(W(i).requestId,e,n),onsubmit:()=>s(W(i),()=>t.onquiz(W(i)))})}},f=e=>{q(e,Mv())};Y(l,e=>{W(c)&&n()[W(i).requestId]?.length?e(u):W(r)?e(d,1):e(f,-1)}),q(e,a)},p=e=>{var n=Nv(),r=H(V(n),2);U(()=>r.disabled=W(c)),G(`click`,r,()=>s(W(i),()=>t.onpermission(W(i)))),q(e,n)},m=e=>{let n=L(()=>fv(W(i).payload));var r=Iv(),a=H(V(r),2),o=e=>{var t=Pv(),r=B(t),i=B(r,!0);P(r),P(t),U(()=>J(i,W(n))),q(e,t)},l=e=>{q(e,Fv())};Y(a,e=>{W(n)?e(o):e(l,-1)});var u=H(a,2),d=B(u),f=H(d,2);P(u),U(()=>{d.disabled=W(c),f.disabled=W(c)}),G(`click`,d,()=>s(W(i),()=>t.ondecision(W(i).requestId,`accept`))),G(`click`,f,()=>s(W(i),()=>t.ondecision(W(i).requestId,`decline`))),q(e,r)},h=e=>{let n=L(()=>pv(W(i).payload));var r=Bv(),a=H(V(r),2),o=e=>{var t=Rv();X(t,20,()=>W(n),e=>e,(e,t)=>{var n=Lv(),r=B(n),i=B(r,!0);P(r),P(n),U(()=>J(i,t)),q(e,n)}),P(t),q(e,t)},l=e=>{q(e,zv())};Y(a,e=>{W(n)?e(o):e(l,-1)});var u=H(a,2),d=B(u),f=H(d,2);P(u),U(()=>{d.disabled=W(c),f.disabled=W(c)}),G(`click`,d,()=>s(W(i),()=>t.ondecision(W(i).requestId,`accept`))),G(`click`,f,()=>s(W(i),()=>t.ondecision(W(i).requestId,`decline`))),q(e,r)},g=e=>{var n=Vv(),r=V(n),a=H(r);U(()=>{r.disabled=W(c),a.disabled=W(c)}),G(`click`,r,()=>s(W(i),()=>t.ondecision(W(i).requestId,`accept`))),G(`click`,a,()=>s(W(i),()=>t.ondecision(W(i).requestId,`decline`))),q(e,n)};Y(d,e=>{W(i).kind===`userInput`||W(i).kind===`quiz`?e(f):W(i).kind===`permissionsApproval`?e(p,1):W(i).kind===`commandApproval`?e(m,2):W(i).kind===`fileChangeApproval`?e(h,3):e(g,-1)});var _=H(d,2),v=e=>{var t=Hv();G(`click`,H(V(t),2),()=>r()(W(i))),q(e,t)};Y(_,e=>{W(i).state===`failed`&&e(v)}),q(e,a)};Y(p,e=>{W(i).state===`resolved`?e(m):e(h,-1)});var g=H(p,2),_=e=>{var r=Gv(),a=H(B(r),2);X(a,21,()=>n()[W(i).requestId],e=>e.id,(e,n)=>{var r=Wv(),i=B(r),a=B(i),o=B(a,!0);P(a),j_(H(a,2),{get text(){return W(n).question},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult}}),P(i);var s=H(i,2);j_(B(s),{get text(){return W(n).answer},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult}}),P(s),P(r),U(()=>J(o,W(n).header)),q(e,r)}),P(a),F(2),P(r),q(e,r)};Y(g,e=>{n()[W(i).requestId]?.length&&(W(c)||W(i).state===`resolved`)&&e(_)}),P(l),U(()=>{Z(l,`id`,`chat-request-${W(i).requestId}`),u=Ei(l,1,`svelte-ajsqcq`,null,u,{resolved:W(i).state===`resolved`}),J(f,W(i).kind)}),q(e,l)}),q(e,c),$e()}Vr([`click`]);var Jv=K(`<aside class="pending-requests pending-dialogues svelte-10cj0sh" aria-label="Pending chat requests"><!></aside>`);function Yv(e,t){var n=Jv();mi(B(n),()=>t.children),P(n),q(e,n)}function Xv(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.id===`gestalt-xerj-availability`||t.mcpStartup?.serverName===`gestalt-xerj`||typeof t.id==`string`&&t.id.startsWith(`mcp-startup:`)&&t.id.endsWith(`:gestalt-xerj`)}function Zv(e){return e.mcpStartup!==void 0||e.id.startsWith(`mcp-startup:`)||e.id===`gestalt-serena-availability`||e.id===`gestalt-xerj-availability`||e.id.startsWith(`gestalt-retrieval-`)}function Qv(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.path==`string`&&Number.isInteger(t.additions)&&t.additions>=0&&Number.isInteger(t.deletions)&&t.deletions>=0?[{path:t.path,additions:t.additions,deletions:t.deletions}]:[]}):[]}function $v(e){if(typeof e.id!=`string`)return null;let t={...typeof e.turnId==`string`?{turnId:e.turnId}:{},...typeof e.actorTurnId==`string`?{actorTurnId:e.actorTurnId}:{},...typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)?{occurredAt:e.occurredAt}:{}};if(e.kind===`reasoning`&&Array.isArray(e.summary)){let n=e.summary.filter(e=>typeof e==`string`).join(`
|
|
76
|
-
`);return n?{id:e.id,label:`Reasoning summary`,detail:n,...t}:null}if(e.kind===`plan`&&typeof e.text==`string`)return{id:e.id,label:`Plan`,detail:e.text,...t};if(e.kind===`command`&&typeof e.command==`string`)return{id:e.id,label:`Command · ${String(e.status??`unknown`)}`,detail:e.command,...t};if(e.kind===`fileChange`&&Array.isArray(e.paths)){let n=Qv(e.changes);return{id:e.id,label:`File change · ${String(e.status??`unknown`)}`,detail:e.paths.join(`
|
|
77
|
-
`),...n.length?{changes:n}:{},...t}}return e.kind===`tool`&&typeof e.name==`string`?{id:e.id,label:`Tool · ${String(e.status??`unknown`)}`,detail:e.name,...t}:null}function ey(e){return[`Submitted quiz answers:`,...e.map(e=>`- ${e.header} — ${e.question}\n ${e.answer.trim().replaceAll(`
|
|
78
|
-
`,`
|
|
79
|
-
`)}`)].join(`
|
|
80
|
-
`)}function ty(e){return![`orgPlanAttention`,`orgPlanCheckpoint`,`autopilotWaitLease`].includes(e.kind)}function ny(e,t,n,r={}){let i=new Map,a=e=>e.trim().replace(/\s+/g,` `),o=(e,t)=>{if(!e||!t?.trim())return;let n=i.get(e)??new Set;n.add(a(t)),i.set(e,n)};for(let e of n)o(e.turnId,e.supervisorReport),o(e.turnId,e.attention.summary),o(e.turnId,e.attention.requestedAction);for(let e of t){let t=e.kind===`quiz`?xv(e.payload):e.kind===`userInput`?Sv(e.payload):null;for(let n of t?.questions??[])o(e.turnId,n.question)}return e.flatMap(e=>{if(e.role===`user`&&t.some(t=>r[t.requestId]?.length&&a(e.text)===a(ey(r[t.requestId]))))return[];let n=e.turnId&&e.role===`assistant`?i.get(e.turnId):null;if(!n)return[e];let o=n.has(a(e.text))?``:e.text.split(/\n\s*\n/).filter(e=>!n.has(a(e))).join(`
|
|
81
|
-
|
|
82
|
-
`);return o.trim()?[{...e,text:o}]:[]})}function ry(e){let t=[],n=[],r=()=>{n.length&&(t.push({id:n[0].id,kind:`assistant`,commentary:n.map(e=>e.text).join(`
|
|
83
|
-
|
|
84
|
-
`),answer:null,...n.at(-1)?.turnId?{turnId:n.at(-1).turnId}:{},...n.at(-1)?.occurredAt===void 0?{}:{occurredAt:n.at(-1).occurredAt}}),n=[])};for(let i of e){if(i.role===`audit`){r(),t.push({id:i.id,kind:`audit`,text:i.text,...i.attention?{attention:i.attention}:{},...i.controlId?{controlId:i.controlId}:{},...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt},count:1,timestamps:i.occurredAt===void 0?[]:[i.occurredAt]});continue}if(i.role===`user`){r(),t.push({id:i.id,kind:`user`,text:i.text,...i.turnId?{turnId:i.turnId}:{},...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt}});continue}if(i.phase===`commentary`){n.push(i);continue}t.push({id:i.id,kind:`assistant`,commentary:n.length?n.map(e=>e.text).join(`
|
|
85
|
-
|
|
86
|
-
`):null,answer:i.text,...i.turnId?{turnId:i.turnId}:{},...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt}}),n=[]}return r(),t}function iy(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var ay=iy();function oy(e){ay=e}var sy={exec:()=>null};function cy(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function ly(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(dy.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var uy=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),dy={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,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,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,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:cy(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:cy(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:cy(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:cy(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:cy(e=>RegExp(`^ {0,${e}}(?:</?(?:${Ey})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:cy(e=>RegExp(`^ {0,${e}}>`))},fy=/^(?:[ \t]*(?:\n|$))+/,py=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,my=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hy=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,gy=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_y=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,vy=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,yy=ly(vy).replace(/bull/g,_y).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),by=ly(vy).replace(/bull/g,_y).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}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),xy=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Sy=/^[^\n]+/,Cy=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,wy=ly(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Cy).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ty=ly(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_y).getRegex(),Ey=`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`,Dy=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Oy=ly(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Dy).replace(`tag`,Ey).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ky=e=>ly(xy).replace(`hr`,hy).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ey).getRegex(),Ay=ky(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),jy=ky(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),My={blockquote:ly(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,jy).getRegex(),code:py,def:wy,fences:my,heading:gy,hr:hy,html:Oy,lheading:yy,list:Ty,newline:fy,paragraph:Ay,table:sy,text:Sy},Ny=ly(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,hy).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ey).getRegex(),Py={...My,lheading:by,table:Ny,paragraph:ly(xy).replace(`hr`,hy).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Ny).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Ey).getRegex()},Fy={...My,html:ly(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Dy).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:sy,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ly(xy).replace(`hr`,hy).replace(`heading`,` *#{1,6} *[^
|
|
87
|
-
]`).replace(`lheading`,yy).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Iy=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Ly=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ry=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,zy=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,By=/[\p{P}\p{S}]/u,Vy=/[\s\p{P}\p{S}]/u,Hy=/[^\s\p{P}\p{S}]/u,Uy=ly(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,Vy).getRegex(),Wy=/[\p{Pi}\p{Ps}"']/u,Gy=/(?!~)[\p{P}\p{S}]/u,Ky=/(?!~)[\s\p{P}\p{S}]/u,qy=/(?:[^\s\p{P}\p{S}]|~)/u,Jy=ly(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,uy?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Yy=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Xy=ly(Yy,`u`).replace(/punct/g,By).getRegex(),Zy=ly(Yy,`u`).replace(/punct/g,Gy).getRegex(),Qy=ly(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,Wy).replace(/punct/g,By).getRegex(),$y=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,eb=ly($y,`gu`).replace(/notPunctSpace/g,Hy).replace(/punctSpace/g,Vy).replace(/punct/g,By).getRegex(),tb=ly($y,`gu`).replace(/notPunctSpace/g,qy).replace(/punctSpace/g,Ky).replace(/punct/g,Gy).getRegex(),nb=ly(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Hy).replace(/punctSpace/g,Vy).replace(/punct/g,By).getRegex(),rb=ly(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Hy).replace(/punctSpace/g,Vy).replace(/punct/g,By).getRegex(),ib=ly(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Hy).replace(/punctSpace/g,Vy).replace(/punct/g,By).getRegex(),ab=ly(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,By).getRegex(),ob=ly(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Hy).replace(/punctSpace/g,Vy).replace(/punct/g,By).getRegex(),sb=ly(/\\(punct)/,`gu`).replace(/punct/g,By).getRegex(),cb=ly(/^<(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(),lb=ly(Dy).replace(`(?:-->|$)`,`-->`).getRegex(),ub=ly(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,lb).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),db=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,fb=ly(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,db).getRegex(),pb=ly(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,fb).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),mb=ly(/^!?\[(label)\]\[(ref)\]/).replace(`label`,fb).replace(`ref`,Cy).getRegex(),hb=ly(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Cy).getRegex(),gb=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,_b=ly(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,db).getRegex(),vb=ly(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,ly(/^!?\[(label)\]\[(ref)\]/).replace(`label`,_b).replace(`ref`,gb).getRegex()).replace(`nolink`,ly(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,gb).getRegex()).getRegex(),yb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,bb=ly(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),xb={_backpedal:sy,anyPunctuation:sb,autolink:cb,blockSkip:Jy,br:Ry,code:Ly,del:sy,delLDelim:sy,delRDelim:sy,emStrongLDelim:Xy,emStrongRDelimAst:eb,emStrongRDelimUnd:rb,escape:Iy,link:pb,nolink:hb,punctuation:Uy,reflink:mb,reflinkSearch:vb,tag:ub,text:zy,url:sy},Sb={...xb,emStrongLDelim:Qy,emStrongRDelimAst:nb,emStrongRDelimUnd:ib,link:ly(/^!?\[(label)\]\((.*?)\)/).replace(`label`,fb).getRegex(),reflink:ly(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,fb).getRegex()},Cb={...xb,emStrongRDelimAst:tb,emStrongLDelim:Zy,delLDelim:ab,delRDelim:ob,url:ly(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,bb).replace(`protocol`,yb).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:ly(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,yb).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},wb={...Cb,br:ly(Ry).replace(`{2,}`,`*`).getRegex(),text:ly(Cb.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Tb={normal:My,gfm:Py,pedantic:Fy},Eb={normal:xb,gfm:Cb,breaks:wb,pedantic:Sb},Db={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ob=e=>Db[e];function kb(e,t){if(t){if(dy.escapeTest.test(e))return e.replace(dy.escapeReplace,Ob)}else if(dy.escapeTestNoEncode.test(e))return e.replace(dy.escapeReplaceNoEncode,Ob);return e}function Ab(e){return e.replace(dy.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function jb(e){try{e=encodeURI(e).replace(dy.percentDecode,`%`)}catch{return null}return e}function Mb(e,t){let n=e.replace(dy.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(dy.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(dy.slashPipe,`|`);return n}function Nb(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 Pb(e){let t=e.split(`
|
|
88
|
-
`),n=t.length-1;for(;n>=0&&dy.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
89
|
-
`)}function Fb(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Ib(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 Lb(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 Rb(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function zb(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
90
|
-
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
91
|
-
`)}function Bb(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var Vb=class{options;rules;lexer;constructor(e){this.options=e||ay}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=this.options.pedantic?t[0]:Pb(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=zb(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=Nb(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Nb(t[0],`
|
|
92
|
-
`),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:Nb(t[0],`
|
|
93
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Nb(t[0],`
|
|
94
|
-
`).split(`
|
|
95
|
-
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;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(`
|
|
96
|
-
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
97
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
98
|
-
${s}`:s,r=r?`${r}
|
|
99
|
-
${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=e.join(`
|
|
100
|
-
`),o=t.raw+`
|
|
101
|
-
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
102
|
-
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
|
|
103
|
-
${d.join(`
|
|
104
|
-
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
|
|
105
|
-
`+e.join(`
|
|
106
|
-
`),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(`
|
|
107
|
-
`);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=t[2].split(`
|
|
108
|
-
`,1)[0],l=t[1].length,u=this.options.pedantic?Lb(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>Lb(e,l)),d=e.split(`
|
|
109
|
-
`,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
|
|
110
|
-
`,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
|
|
111
|
-
`,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
|
|
112
|
-
`+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
|
|
113
|
-
`+d}f=!d.trim(),r+=l+`
|
|
114
|
-
`,e=e.substring(l.length+1),u=m.slice(p)}}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,[]),!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))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.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 n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.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=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}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){let e=Pb(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=Fb(t[1]).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:Nb(t[0],`
|
|
115
|
-
`),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=Mb(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
116
|
-
`):[],a={type:`table`,raw:Nb(t[0],`
|
|
117
|
-
`),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(Mb(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:Nb(t[0],`
|
|
118
|
-
`),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)===`
|
|
119
|
-
`?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 n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Bb(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=Nb(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Ib(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 i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),Rb(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.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 r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Bb(e,n[1],r,this.rules))return;let i=t[Fb((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Rb(n,i,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 i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}else if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,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,autolink:!0,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,autolink:!0,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:e?t[0]:Ab(t[0]),escaped:e}}}},Hb=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ay,this.options.tokenizer=this.options.tokenizer||new Vb,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:dy,block:Tb.normal,inline:Eb.normal};this.options.pedantic?(t.block=Tb.pedantic,t.inline=Eb.pedantic):this.options.gfm&&(t.block=Tb.gfm,this.options.breaks?t.inline=Eb.breaks:t.inline=Eb.gfm),this.tokenizer.rules=t}static get rules(){return{block:Tb,inline:Eb}}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(dy.carriageReturn,`
|
|
120
|
-
`),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){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(dy.tabCharGlobal,` `).replace(dy.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
121
|
-
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
122
|
-
`)?``:`
|
|
123
|
-
`)+i.raw,n.text+=`
|
|
124
|
-
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
125
|
-
`)?``:`
|
|
126
|
-
`)+i.raw,n.text+=`
|
|
127
|
-
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=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&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
128
|
-
`)?``:`
|
|
129
|
-
`)+i.raw,r.text+=`
|
|
130
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
131
|
-
`)?``:`
|
|
132
|
-
`)+i.raw,n.text+=`
|
|
133
|
-
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,Fb(e.slice(n+1,-1))))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,Fb(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=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&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},Ub=class{options;parser;constructor(e){this.options=e||ay}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(dy.notSpaceStart)?.[0],i=e?e.replace(dy.endingNewline,``)+`
|
|
134
|
-
`:``;return r?`<pre><code class="language-`+kb(r)+`">`+(n?i:kb(i,!0))+`</code></pre>
|
|
135
|
-
`:`<pre><code>`+(n?i:kb(i,!0))+`</code></pre>
|
|
136
|
-
`}blockquote({tokens:e}){return`<blockquote>
|
|
137
|
-
${this.parser.parse(e)}</blockquote>
|
|
138
|
-
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
139
|
-
`}hr(e){return`<hr>
|
|
140
|
-
`}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+`>
|
|
141
|
-
`+r+`</`+i+`>
|
|
142
|
-
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
143
|
-
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
144
|
-
`}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>
|
|
145
|
-
<thead>
|
|
146
|
-
`+t+`</thead>
|
|
147
|
-
`+r+`</table>
|
|
148
|
-
`}tablerow({text:e}){return`<tr>
|
|
149
|
-
${e}</tr>
|
|
150
|
-
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
151
|
-
`}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>${kb(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?kb(n,!0):this.parser.parseInline(r),o=jb(e);if(o===null)return a;e=kb(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+kb(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=jb(e);if(i===null)return kb(n);e=i;let a=`<img src="${kb(e)}" alt="${kb(n)}"`;return t&&(a+=` title="${kb(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:kb(e.text)}},Wb=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}},Gb=class e{options;renderer;textRenderer;constructor(e){this.options=e||ay,this.options.renderer=this.options.renderer||new Ub,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Wb}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`,`checkbox`,`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`,`checkbox`,`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}},Kb=class{options;block;constructor(e){this.options=e||ay}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?Hb.lex:Hb.lexInline}provideParser(e=this.block){return e?Gb.parse:Gb.parseInline}},qb=new class{defaults=iy();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Gb;Renderer=Ub;TextRenderer=Wb;Lexer=Hb;Tokenizer=Vb;Hooks=Kb;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 Ub(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 Vb(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 Kb;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];Kb.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&Kb.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)}: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 Hb.lex(e,t??this.defaults)}parser(e,t){return Gb.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?Hb.lex:Hb.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?Gb.parse:Gb.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?Hb.lex:Hb.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?Gb.parse:Gb.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+=`
|
|
152
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+kb(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Jb(e,t){return qb.parse(e,t)}Jb.options=Jb.setOptions=function(e){return qb.setOptions(e),Jb.defaults=qb.defaults,oy(Jb.defaults),Jb},Jb.getDefaults=iy,Jb.defaults=ay;function Yb(...e){return qb.use(...e),Jb.defaults=qb.defaults,oy(Jb.defaults),Jb}Jb.use=Yb,Jb.walkTokens=function(e,t){return qb.walkTokens(e,t)},Jb.parseInline=qb.parseInline,Jb.Parser=Gb,Jb.parser=Gb.parse,Jb.Renderer=Ub,Jb.TextRenderer=Wb,Jb.Lexer=Hb,Jb.lexer=Hb.lex,Jb.Tokenizer=Vb,Jb.Hooks=Kb,Jb.parse=Jb,Jb.options,Jb.setOptions,Jb.walkTokens,Jb.parseInline,Gb.parse,Hb.lex;function Xb(e){let t=[],n=0,r=null;for(let i of Hb.lex(e)){let e=n;if(n+=i.raw.length,i.type===`space`){r&&(r.text+=i.raw);continue}if(i.type===`heading`){r?r.text+=i.raw:r={offset:e,text:i.raw};continue}t.push(r?{offset:r.offset,text:r.text+i.raw}:{offset:e,text:i.raw}),r=null}return r&&t.push(r),t.toReversed()}var Zb=K(`<div class="working-content svelte-1wpqicu"></div>`);function Qb(e,t){I(t,!0);let n=L(()=>Xb(t.text));var r=Zb();X(r,21,()=>W(n),e=>e.offset,(e,n)=>{j_(e,{get text(){return W(n).text},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return t.oncopyresult},get clipboard(){return t.clipboard}})}),P(r),q(e,r),$e()}var $b=K(`<time class="svelte-1im954t"> </time>`),ex=K(`<span class="touch-unknown svelte-1im954t">time unknown</span>`),tx=K(`<li class="svelte-1im954t"><code class="file-path svelte-1im954t"> </code> <span class="file-counts svelte-1im954t" aria-label="Line changes"><span class="additions svelte-1im954t"> </span> <span class="deletions svelte-1im954t"> </span></span> <!></li>`),nx=K(`<details class="file-changes svelte-1im954t"><summary class="svelte-1im954t"> <span class="additions svelte-1im954t"> </span> <span class="deletions svelte-1im954t"> </span></summary> <section aria-label="Files changed"><ul class="svelte-1im954t"></ul></section></details>`),rx=K(`<!> <!>`,1),ix=K(`<div class="entry-heading svelte-1im954t"><strong>working</strong></div> <!> <!>`,1),ax=K(`<li class="progress-item svelte-1im954t"><section><!></section></li>`),ox=K(`<li class="svelte-1im954t"><time class="svelte-1im954t"> </time></li>`),sx=K(`<details><summary class="svelte-1im954t"> </summary> <ul></ul></details>`),cx=K(`<aside class="autopilot-audit svelte-1im954t" aria-label="Autopilot audit entry"><strong>Autopilot</strong> <!> <!></aside>`),lx=K(`<time class="svelte-1im954t"> <!></time>`),ux=K(`<section><!></section>`),dx=K(`<div class="entry-heading svelte-1im954t"><strong>prompt</strong> <!></div> <div class="entry-content svelte-1im954t"><!></div> <!>`,1),fx=K(`<div class="commentary-content live-commentary svelte-1im954t"><!></div>`),px=K(`<div class="entry-content svelte-1im954t"><!></div> <!> <!> <!>`,1),mx=K(`<button class="commentary-toggle svelte-1im954t" type="button"><span aria-hidden="true"> </span> commentary</button>`),hx=K(`<div class="answer-history svelte-1im954t"><!></div>`),gx=K(`<div class="commentary-content svelte-1im954t"><!></div>`),_x=K(`<div class="entry-content svelte-1im954t"><!></div> <!>`,1),vx=K(`<section class="answer-turn svelte-1im954t"><div class="entry-heading svelte-1im954t"><strong> </strong> <!></div> <!> <!> <!></section>`),yx=K(`<div class="entry-content svelte-1im954t"><!></div>`),bx=K(`<section class="progress-turn svelte-1im954t"><div class="entry-heading svelte-1im954t"><strong>working</strong> <!></div> <!> <!> <!></section>`),xx=K(`<li><!></li>`),Sx=K(`<li class="audit-incomplete svelte-1im954t" role="status">Earlier Autopilot audit entries are not shown; this timeline contains the retained recent
|
|
153
|
-
audit.</li>`),Cx=K(`<!> <ol aria-label="Chat messages" class="svelte-1im954t"><!> <!> <!></ol> <!>`,1);function wx(e,t){I(t,!0);let n=(e,t=b)=>{let n=L(()=>Y_(t())),r=L(()=>X_(W(n)));var i=Yr(),a=V(i),o=e=>{var t=nx(),i=B(t),a=B(i),o=H(a),s=B(o);P(o);var c=H(o,2),l=B(c);P(c),P(i);var u=H(i,2),d=B(u);X(d,21,()=>W(n),e=>e.path,(e,t)=>{var n=tx(),r=B(n),i=B(r,!0);P(r);var a=H(r,2),o=B(a),s=B(o);P(o);var c=H(o,2),l=B(c);P(c),P(a);var u=H(a,2),d=e=>{var n=$b(),r=B(n,!0);P(n),U((e,t)=>{Z(n,`datetime`,e),J(r,t)},[()=>new Date(W(t).touchedAt).toISOString(),()=>$_(W(t).touchedAt,W(ee))]),q(e,n)},f=e=>{q(e,ex())};Y(u,e=>{W(t).touchedAt===void 0?e(f,-1):e(d)}),P(n),U(()=>{J(i,W(t).path),J(s,`+${W(t).additions??`?`??``}`),J(l,`−${W(t).deletions??`?`??``}`)}),q(e,n)}),P(d),P(u),P(t),U(()=>{J(a,`${W(r).files??``}
|
|
154
|
-
${W(r).files===1?`file`:`files`} changed · `),J(s,`+${W(r).additions??`?`??``}`),J(l,`−${W(r).deletions??`?`??``}`)}),q(e,t)};Y(a,e=>{W(n).length&&e(o)}),q(e,i)},r=(e,n=b)=>{j_(e,{get text(){return n()},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return x()},get clipboard(){return m()}})},i=(e,n=b)=>{Qb(e,{get text(){return n()},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return x()},get clipboard(){return m()}})},a=Q(t,`activeTurnId`,3,null),o=Q(t,`autopilotAuditTruncated`,3,!1),s=Q(t,`interactions`,19,()=>[]),c=Q(t,`attention`,3,null),l=Q(t,`attentionPending`,3,!1),u=Q(t,`onattentionresolve`,3,()=>{}),d=Q(t,`debugPending`,3,!1),f=Q(t,`answers`,19,()=>({})),p=Q(t,`submittedAnswers`,19,()=>({})),m=Q(t,`clipboard`,19,()=>globalThis.navigator?.clipboard),h=Q(t,`onanswer`,3,()=>{}),g=Q(t,`onquiz`,3,()=>{}),_=Q(t,`onpermission`,3,()=>{}),v=Q(t,`ondecision`,3,()=>{}),y=Q(t,`onretry`,3,()=>{}),x=Q(t,`oncopyresult`,3,()=>{}),S=L(()=>t.activities.filter(e=>!Zv(e))),C=L(()=>{let e=ry(t.messages);if(!c()||e.some(e=>e.kind===`audit`&&e.attention?.requestId===c().requestId))return e;let n=U_(c().attention);if(!n)return e;let r=c().requestedAt?Date.parse(c().requestedAt):void 0,i=r!==void 0&&Number.isFinite(r)?r:void 0,a=i===void 0?-1:e.findIndex(e=>e.occurredAt!==void 0&&e.occurredAt>i);return e.splice(a<0?e.length:a,0,{id:`attention:${c().requestId}`,kind:`audit`,text:`Needs attention`,attention:{...c(),attention:n},occurredAt:i,count:1,timestamps:i===void 0?[]:[i]}),e}),w=L(()=>W(C).flatMap(e=>e.kind===`audit`&&e.attention?[O(e.attention)]:[])),T=L(()=>s().filter(e=>ty(e)&&e.state!==`resolved`)),E=new Set;In(()=>{let e=new Set([...W(T).map(e=>`chat-request-${e.requestId}`),...c()?[`chat-attention-${c().requestId}`]:[]]);for(let t of E)!e.has(t)&&document.getElementById(t)?.contains(document.activeElement)&&Or().then(()=>document.getElementById(t)?.focus({preventScroll:!0}));E=e});let D=L(()=>{let e=ry(ny(t.messages,s(),W(w),p())).filter(e=>!c()||e.kind!==`audit`||e.attention?.requestId!==c().requestId).map(e=>{if(e.kind!==`audit`||!e.attention)return e;let t=s().find(t=>t.requestId===e.attention?.requestId)?.resolvedAt;return t===void 0?e:{...e,occurredAt:t}});for(let t of s().filter(e=>ty(e)&&e.state===`resolved`)){let n={id:t.key,kind:`interaction`,interaction:t,occurredAt:t.resolvedAt??t.occurredAt},r=n.occurredAt===void 0?-1:e.findIndex(e=>e.occurredAt!==void 0&&e.occurredAt>n.occurredAt);e.splice(r<0?e.length:r,0,n)}return e.map((e,t)=>({entry:e,index:t})).sort((e,t)=>e.entry.occurredAt!==void 0&&t.entry.occurredAt!==void 0&&e.entry.occurredAt-t.entry.occurredAt||e.index-t.index).map(({entry:e})=>e).toReversed()});function O(e){let n=e.requestedAt?Date.parse(e.requestedAt):NaN,r=t.messages.filter(t=>t.role===`assistant`&&t.turnId===e.turnId),i=r.findLast(e=>e.phase===`final_answer`&&e.occurredAt!==void 0&&e.occurredAt>=n),a=r.findLast(e=>e.phase===`commentary`&&e.occurredAt!==void 0&&e.occurredAt<=n),o=c()?.requestId===e.requestId&&c().supervisorReport?c().supervisorReport:Qh(i?.text??a?.text);return{...e,...o?{supervisorReport:o}:{}}}let k=cn({}),ee=R(cn(Date.now()));Yi(()=>{let e=globalThis.setInterval(()=>z(ee,Date.now(),!0),1e3);return()=>globalThis.clearInterval(e)});let te=L(()=>W(C).filter(e=>e.kind===`user`)),ne=L(()=>W(D).filter(e=>e.kind===`assistant`).toReversed()),re=L(()=>W(ne).at(-1)?.id),ie=L(()=>new Map(W(ne).filter(e=>e.turnId).map(e=>[e.turnId,e.id]))),ae=L(()=>new Map(W(te).filter(e=>e.turnId).map(e=>[e.turnId,e.id])));function oe(e){if(e.turnId){let t=W(ie).get(e.turnId);if(t)return t}return e.occurredAt===void 0?W(re)??null:W(ne).find(t=>t.answer!==null&&t.occurredAt!==void 0&&t.occurredAt>=e.occurredAt)?.id??null}function se(e){if(e.turnId){let t=W(ae).get(e.turnId);if(t)return t}return e.occurredAt===void 0?null:W(te).findLast(t=>t.occurredAt!==void 0&&t.occurredAt<=e.occurredAt)?.id??null}let ce=L(()=>{let e=new Map;for(let t of W(S)){let n=oe(t)??se(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return e}),le=L(()=>W(ce).get(null)??[]);function ue(e){return e.filter(e=>!e.label.toLowerCase().replaceAll(` `,``).startsWith(`filechange`))}function de(e){return!!(e.kind===`assistant`&&a()&&(e.turnId===a()||!e.turnId&&e.id===W(re)))}function A(e){return!!(e.kind===`user`&&a()&&(e.turnId===a()||!e.turnId))}function fe(e,t){return Z_(W(D)[e+1]?.occurredAt,t)}var pe=Cx(),me=V(pe),he=e=>{Yv(e,{children:(e,n)=>{var r=rx(),i=V(r),a=e=>{{let n=L(()=>O(c())),r=L(()=>`chat-attention-${c().requestId}`);z_(e,{get attention(){return W(n)},get pending(){return l()},get controlId(){return W(r)},get onresolve(){return u()},get ondebug(){return t.onattentiondebug},get debugPending(){return d()},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return x()}})}};Y(i,e=>{c()&&e(a)}),qv(H(i,2),{get interactions(){return W(T)},get answers(){return f()},get submittedAnswers(){return p()},get onanswer(){return h()},get onquiz(){return g()},get onpermission(){return _()},get ondecision(){return v()},get onretry(){return y()},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return x()}}),q(e,r)},$$slots:{default:!0}})};Y(me,e=>{(c()||W(T).length)&&e(he)});var ge=H(me,2),_e=B(ge),ve=e=>{var t=ax(),r=B(t),i=B(r),o=e=>{var t=ix(),r=H(V(t),2);{let e=L(()=>ue(W(le)));vh(r,{get activities(){return W(e)},variant:`live`})}var i=H(r,2);n(i,()=>W(le)),q(e,t)},s=e=>{dv(e,{get activities(){return W(le)},get now(){return W(ee)}})};Y(i,e=>{a()?e(o):e(s,-1)}),P(r),P(t),U(()=>Ei(r,1,bi(a()?`progress-turn`:`orphan-activity-turn`),`svelte-1im954t`)),q(e,t)};Y(_e,e=>{W(le).length&&e(ve)});var ye=H(_e,2);X(ye,19,()=>W(D),e=>e.id,(e,a,o)=>{var m=xx(),b=B(m),S=e=>{{let n=L(()=>[W(a).interaction]);qv(e,{get interactions(){return W(n)},get answers(){return f()},get submittedAnswers(){return p()},get onanswer(){return h()},get onquiz(){return g()},get onpermission(){return _()},get ondecision(){return v()},get onretry(){return y()},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return x()}})}},C=e=>{var n=Yr(),r=V(n),i=e=>{{let n=L(()=>O(W(a).attention)),r=L(()=>c()?.requestId!==W(a).attention.requestId),i=L(()=>s().find(e=>e.requestId===W(a).attention?.requestId)?.resolvedAt),o=L(()=>`chat-attention-${W(a).attention.requestId}`);z_(e,{get attention(){return W(n)},get historical(){return W(r)},get resolvedAt(){return W(i)},get pending(){return l()},get controlId(){return W(o)},get onresolve(){return u()},get ondebug(){return t.onattentiondebug},get debugPending(){return d()},get onopenorg(){return t.onopenorg},get onopenfile(){return t.onopenfile},get oncopyresult(){return x()}})}},o=e=>{var t=cx(),n=H(B(t)),r=H(n),i=e=>{var t=$b(),n=B(t,!0);P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,r)},[()=>new Date(W(a).occurredAt).toISOString(),()=>Q_(W(a).occurredAt)]),q(e,t)};Y(r,e=>{W(a).occurredAt&&e(i)});var o=H(r,2),s=e=>{var t=sx(),n=B(t),r=B(n);P(n);var i=H(n,2);X(i,21,()=>W(a).timestamps,e=>`${W(a).id}:${e}`,(e,t)=>{var n=ox(),r=B(n),i=B(r,!0);P(r),P(n),U((e,t)=>{Z(r,`datetime`,e),J(i,t)},[()=>new Date(W(t)).toISOString(),()=>Q_(W(t))]),q(e,n)}),P(i),P(t),U(()=>J(r,`Show ${W(a).count??``} timestamps`)),q(e,t)};Y(o,e=>{W(a).count>1&&e(s)}),P(t),U(()=>J(n,` ${W(a).text??``}${W(a).count>1?` · ${W(a).count} times`:``} `)),q(e,t)};Y(r,e=>{W(a).attention?e(i):e(o,-1)}),q(e,n)},w=e=>{let t=L(()=>W(ce).get(W(a).id)??[]);var i=dx(),s=V(i),c=H(B(s),2),l=e=>{var t=lx(),n=B(t),r=H(n),i=e=>{var t=Jr();U(e=>J(t,`· ${e??``}`),[()=>fe(W(o),W(a).occurredAt)]),q(e,t)},s=L(()=>fe(W(o),W(a).occurredAt));Y(r,e=>{W(s)&&e(i)}),P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,`${r??``} `)},[()=>new Date(W(a).occurredAt).toISOString(),()=>Q_(W(a).occurredAt)]),q(e,t)};Y(c,e=>{W(a).occurredAt&&e(l)}),P(s);var u=H(s,2),d=B(u);r(d,()=>W(a).text),P(u);var f=H(u,2),p=e=>{var r=ux(),i=B(r),o=e=>{var r=ix(),i=H(V(r),2);{let e=L(()=>ue(W(t)));vh(i,{get activities(){return W(e)},variant:`live`})}var a=H(i,2);n(a,()=>W(t)),q(e,r)},s=L(()=>A(W(a))),c=e=>{dv(e,{get activities(){return W(t)},get now(){return W(ee)}})};Y(i,e=>{W(s)?e(o):e(c,-1)}),P(r),U(e=>Ei(r,1,e,`svelte-1im954t`),[()=>bi(A(W(a))?`progress-turn`:`orphan-activity-turn`)]),q(e,r)};Y(f,e=>{W(t).length&&e(p)}),q(e,i)},T=e=>{let t=L(()=>W(ce).get(W(a).id)??[]);var s=vx(),c=B(s),l=B(c),u=B(l,!0);P(l);var d=H(l,2),f=e=>{var t=lx(),n=B(t),r=H(n),i=e=>{var t=Jr();U(e=>J(t,`· ${e??``}`),[()=>fe(W(o),W(a).occurredAt)]),q(e,t)},s=L(()=>fe(W(o),W(a).occurredAt));Y(r,e=>{W(s)&&e(i)}),P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,`${r??``} `)},[()=>new Date(W(a).occurredAt).toISOString(),()=>Q_(W(a).occurredAt)]),q(e,t)};Y(d,e=>{W(a).occurredAt&&e(f)}),P(c);var p=H(c,2),m=e=>{var r=px(),o=V(r),s=B(o);i(s,()=>W(a).answer),P(o);var c=H(o,2),l=e=>{var t=fx(),n=B(t);i(n,()=>W(a).commentary),P(t),q(e,t)};Y(c,e=>{W(a).commentary&&e(l)});var u=H(c,2);{let e=L(()=>ue(W(t)));vh(u,{get activities(){return W(e)},variant:`live`})}var d=H(u,2);n(d,()=>W(t)),q(e,r)},h=L(()=>de(W(a))),g=e=>{var t=hx(),n=B(t),r=e=>{var t=mx(),n=B(t),r=B(n,!0);P(n),F(),P(t),U(e=>{Z(t,`aria-expanded`,e),Z(t,`aria-controls`,`commentary-${W(a).id}`),J(r,k[W(a).id]?`⌄`:`›`)},[()=>!!k[W(a).id]]),G(`click`,t,()=>k[W(a).id]=!k[W(a).id]),q(e,t)};Y(n,e=>{W(a).commentary&&e(r)}),P(t),q(e,t)},_=L(()=>W(a).commentary||ue(W(t)).length);Y(p,e=>{W(h)?e(m):W(_)&&e(g,1)});var v=H(p,2),y=e=>{var t=gx(),n=B(t);r(n,()=>W(a).commentary),P(t),U(()=>Z(t,`id`,`commentary-${W(a).id}`)),q(e,t)},b=L(()=>!de(W(a))&&W(a).commentary&&k[W(a).id]);Y(v,e=>{W(b)&&e(y)});var x=H(v,2),S=e=>{var n=_x(),i=V(n),o=B(i);r(o,()=>W(a).answer),P(i),dv(H(i,2),{get activities(){return W(t)},get now(){return W(ee)}}),q(e,n)},C=L(()=>!de(W(a)));Y(x,e=>{W(C)&&e(S)}),P(s),U(e=>J(u,e),[()=>de(W(a))?`working`:`answer`]),q(e,s)},E=e=>{let t=L(()=>W(ce).get(W(a).id)??[]);var r=bx(),s=B(r),c=H(B(s),2),l=e=>{var t=lx(),n=B(t),r=H(n),i=e=>{var t=Jr();U(e=>J(t,`· ${e??``}`),[()=>fe(W(o),W(a).occurredAt)]),q(e,t)},s=L(()=>fe(W(o),W(a).occurredAt));Y(r,e=>{W(s)&&e(i)}),P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,`${r??``} `)},[()=>new Date(W(a).occurredAt).toISOString(),()=>Q_(W(a).occurredAt)]),q(e,t)};Y(c,e=>{W(a).occurredAt&&e(l)}),P(s);var u=H(s,2),d=e=>{var t=yx(),n=B(t);i(n,()=>W(a).commentary),P(t),q(e,t)};Y(u,e=>{W(a).commentary&&e(d)});var f=H(u,2),p=e=>{{let n=L(()=>ue(W(t)));vh(e,{get activities(){return W(n)},variant:`live`})}},m=L(()=>de(W(a))),h=e=>{dv(e,{get activities(){return W(t)},get now(){return W(ee)}})};Y(f,e=>{W(m)?e(p):e(h,-1)});var g=H(f,2),_=e=>{n(e,()=>W(t))},v=L(()=>de(W(a)));Y(g,e=>{W(v)&&e(_)}),P(r),q(e,r)};Y(b,e=>{W(a).kind===`interaction`?e(S):W(a).kind===`audit`?e(C,1):W(a).kind===`user`?e(w,2):W(a).answer===null?W(a).commentary!==null&&e(E,4):e(T,3)}),P(m),U(()=>Ei(m,1,bi(W(a).kind===`user`?`prompt-turn`:W(a).kind===`audit`?`audit-item`:`answer-item`),`svelte-1im954t`)),q(e,m)});var be=H(ye,2),xe=e=>{q(e,Sx())};Y(be,e=>{o()&&e(xe)}),P(ge),mi(H(ge,2),()=>t.footer??b),q(e,pe),$e()}Vr([`click`]);var Tx=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:void 0;function Ex(e,t){if(t.type!==`activity.updated`||!e?.runtimeId||!e.observedAt||!t.occurredAt||!Number.isFinite(Date.parse(e.observedAt))||!Number.isFinite(Date.parse(t.occurredAt))||Date.parse(t.occurredAt)<=Date.parse(e.observedAt))return e;let n=t.payload,r=n?.repositoryReadiness;if(n?.runtimeId!==e.runtimeId||!r?.readiness?.repository||typeof r.threadId!=`string`)return e;let i=e.repositories.find(e=>e.threadId===r.threadId&&e.readiness.repository?.id===r.readiness.repository?.id);if(!i&&e.repositories.length>=64)return e;let a=Tx(t.sequence),o=i?.activityOrder;if(o){let n=Date.parse(t.occurredAt),r=Date.parse(o.occurredAt);if(n<r||o.sequence!==void 0&&(a===void 0||a<=o.sequence)||n===r&&(o.sequence===void 0||a===void 0))return e}return{...e,repositories:[...e.repositories.filter(e=>e.threadId!==r.threadId||e.readiness.repository?.id!==r.readiness.repository?.id),{...r,activityOrder:{occurredAt:t.occurredAt,...a===void 0?{}:{sequence:a}}}]}}var Dx=[150,300,600];function Ox(e){return new Promise(t=>setTimeout(t,e))}function kx(e){return e.status===502||e.status===503||e.status===504}async function Ax(e=fetch){for(let t=0;t<=Dx.length;t+=1){let n;try{n=await e(`/api/bootstrap`)}catch(e){if(e instanceof Error&&e.name===`AbortError`)throw e;if(t===Dx.length)throw Error(`BOOTSTRAP_FAILED`);await Ox(Dx[t]);continue}if(n.ok){let e=await n.json();return{...e,versions:(e.versions??[]).filter(e=>e.id!==`xerj`)}}if(!kx(n)||t===Dx.length)throw Error(`BOOTSTRAP_FAILED`);await Ox(Dx[t])}throw Error(`BOOTSTRAP_FAILED`)}var jx=`gestalt-mobile`,Mx=3,Nx=[`settings`,`drafts`,`cursors`,`messages`,`chat-projections`];function Px(e){return new Promise((t,n)=>{let r=e.open(jx,Mx);r.onupgradeneeded=()=>{for(let e of Nx)r.result.objectStoreNames.contains(e)||r.result.createObjectStore(e)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)})}function Fx(e,t,n){return Rx(e.transaction(t,`readonly`).objectStore(t).get(n))}function Ix(e,t,n,r){return Rx(e.transaction(t,`readwrite`).objectStore(t).put(r,n))}function Lx(e,t,n){return Rx(e.transaction(t,`readwrite`).objectStore(t).delete(n))}function Rx(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var zx=`chat-projections`,Bx=e=>({version:1,cursor:e.cursor,lifecycle:e.lifecycle,activeTurnId:e.activeTurnId,messages:e.messages.filter(e=>e.role===`user`).slice(-200),activities:[],prompts:e.prompts.slice(-200),interactions:e.interactions.map(({requestId:e,key:t,kind:n,turnId:r,state:i,operationId:a,attemptedOutcome:o})=>({requestId:e,key:t,kind:n,...r?{turnId:r}:{},state:i,...a?{operationId:a}:{},...i===`resolved`&&(o===`approved`||o===`denied`||o===`answered`||o===`dismissed`)?{attemptedOutcome:o}:{},...typeof o==`object`&&o&&(o.decision===`accept`||o.decision===`decline`)?{attemptedOutcome:{decision:o.decision}}:{}})).slice(-200),buffered:[]});function Vx(e=globalThis.indexedDB){if(!e)return{read:async()=>null,write:async()=>{}};let t=Px(e);return t.catch(()=>{}),{read:async e=>{try{return await Fx(await t,zx,e)}catch{return null}},write:async(e,n)=>{try{await Ix(await t,zx,e,Bx(n))}catch{}}}}var Hx=`chat-session`;function Ux(e){return new URLSearchParams(e).get(`chat-session`)?.trim()||null}function Wx(e,t){let n=new URL(e);return n.search=``,n.hash=``,n.searchParams.set(Hx,t),n.toString()}function Gx(e){let t=2166136261;for(let n of e)t^=n.codePointAt(0)??0,t=Math.imul(t,16777619);return`gestalt-chat-${(t>>>0).toString(36)}`}function Kx(e){let t=Jx(e,`requestId`),n=U_(Jx(e,`payload`));if(typeof t!=`string`||t.length>256||!n)return;let r=Jx(e,`turnId`),i=Jx(e,`requestedAt`);return{requestId:t,turnId:typeof r==`string`?r:null,requestedAt:typeof i==`string`?i:null,attention:n}}function qx(e,t){if(e===`autopilot.turn-started`)return`Continued execution automatically`;if(e===`autopilot.final-rejected`)return`Kept incomplete supervised work active`;if(e===`autopilot.executor-resumed`)return`Resumed the assigned executor`;if(e===`autopilot.process-monitoring`)return`Monitoring executor background work`;if(e===`autopilot.process-result-consumed`)return`Consumed background work result`;if(e===`autopilot.process-terminated`)return Jx(t,`reason`)===`resourceBudget`?`Stopped background work at its resource limit`:`Stopped executor background work`;if(e===`autopilot.turn-failed`)return Jx(t,`code`)===`START_UNAVAILABLE`?`Automatic continuation could not start: session runtime unavailable`:`Automatic continuation failed`;if(e===`org-plan.attention-required`)return`Needs attention`;if(e===`org-plan.attention-resolved`)return Jx(t,`outcome`)===`failed`?`Attention resolution failed`:`Attention resolved`;if(e!==`autopilot.updated`)return null;let n=Jx(t,`state`),r=Jx(t,`reason`),i=Yh(Jx(t,`providerFailure`));return n===`safetyPaused`&&i?`Autopilot paused: ${Xh(i)}`:n===`safetyPaused`&&r===`usageLimitExceeded`?`Autopilot paused: Codex usage limit reached`:n===`completed`?`Completed the supervised plan`:n===`attentionRequired`&&r===`noPlanProgress`?`Automatic continuation stopped: no agent progress`:n===`attentionRequired`&&r===`reconcileFailed`?`Automatic continuation stopped: agent status unavailable`:n===`attentionRequired`&&r===`actionRateExceeded`?`Automatic continuation stopped: too many automatic actions`:null}function Jx(e,t){return e&&typeof e==`object`?e[t]:void 0}var Yx=()=>({sessionId:null,cursor:0,snapshotting:!1,lifecycle:`finished`,activeTurnId:null,messages:[],activities:[],prompts:[],interactions:[],autopilotAuditTruncated:!1,buffered:new Map}),Xx=(e=null)=>({...Yx(),sessionId:e});function Zx(e){return e.kind===`autopilot`?{id:`item:${e.id}`,role:`audit`,text:`Continued execution automatically`,...typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)?{occurredAt:e.occurredAt}:{},...typeof e.controlId==`string`?{controlId:e.controlId}:{},complete:!0}:e.kind!==`user`&&e.kind!==`agent`||typeof e.text!=`string`?null:{id:`item:${e.id}`,role:e.kind===`user`?`user`:`assistant`,text:e.text,...e.phase===`commentary`||e.phase===`final_answer`?{phase:e.phase}:{},...typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)?{occurredAt:e.occurredAt}:{},...typeof e.turnId==`string`?{turnId:e.turnId}:{},complete:!0}}function Qx(e){return{id:e.id,role:`audit`,text:e.label,occurredAt:e.occurredAt,...e.controlId?{controlId:e.controlId}:{},...e.attention?{attention:e.attention}:{},complete:!0}}function $x(e){let t=eS(e.occurredAt),n=qx(e.type,e.payload),r=e.payload&&typeof e.payload==`object`&&typeof e.payload.controlId==`string`?e.payload.controlId:void 0;return n&&t!==void 0?Qx({id:`audit:${e.sequence}`,label:n,occurredAt:t,...r?{controlId:r}:{},...e.type===`org-plan.attention-required`&&Kx(e.payload)?{attention:Kx(e.payload)}:{}}):null}function eS(e){if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function tS(e){let t=eS(e.requestedAt),n=eS(e.resolvedAt);return{requestId:e.requestId,key:`interaction:${e.requestId}`,kind:e.kind,turnId:e.turnId,payload:`payload`in e?e.payload:null,state:e.resolvedAt?e.outcome===`failed`?`failed`:`resolved`:`pending`,...e.resolvedAt?{attemptedOutcome:e.outcome}:{},...t===void 0?{}:{occurredAt:t},...n===void 0?{}:{resolvedAt:n}}}function nS(e,t){return t===`approved`||t===`denied`||t===`answered`||t===`dismissed`||t===`failed`?t:e?.kind===`quiz`||e?.kind===`userInput`?`answered`:typeof t==`object`&&t&&t.decision===`decline`?`denied`:e?`approved`:void 0}function rS(e,t){return e?t===`finished`||t===`interrupted`?t:`working`:t===`working`||t===`starting`||t===`recoverable`?`finished`:t}function iS(e){return[...new Map(e.map(e=>[e.key??e.id??``,e])).values()]}function aS(e,t){return e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?{...t,...t.occurredAt===void 0&&e.occurredAt!==void 0?{occurredAt:e.occurredAt}:{}}:e):[...e,t]}function oS(e,t,n){let r=new Map(n.map(e=>[e.id,e])),i=new Map(n.map((e,t)=>[e.id,t])),a=new Set(t.filter(e=>e.state!==`canonical`).map(e=>e.operationId)),o=new Set,s=e.flatMap(e=>{let i=Zx(e);if(!i)return[];if(e.kind===`user`){let n=t.find(t=>typeof e.operationId==`string`&&e.operationId===t.operationId||typeof e.turnId==`string`&&e.turnId===t.turnId),s=!n&&t.filter(t=>t.state!==`canonical`&&t.text===e.text).length===1?t.find(t=>t.state!==`canonical`&&t.text===e.text):void 0,c=n??s;if(c){a.delete(c.operationId);let e=r.get(c.key),t={...i,id:c.key,turnId:c.turnId??i.turnId,...i.occurredAt===void 0&&e?.occurredAt!==void 0?{occurredAt:e.occurredAt}:{}};return o.add(t.id),[e&&e.text===t.text&&e.turnId===t.turnId&&e.complete===t.complete&&e.occurredAt===t.occurredAt?e:t]}}if(e.kind===`agent`&&typeof e.turnId==`string`){let t=r.get(`assistant:${e.id}`)??n.find(t=>t.role===`assistant`&&t.turnId===e.turnId&&t.text===i.text&&(t.phase===i.phase||!t.complete));if(t){o.add(t.id);let e={...i,id:t.id,turnId:i.turnId??t.turnId,...i.occurredAt===void 0&&t.occurredAt!==void 0?{occurredAt:t.occurredAt}:{}};return[t.text===e.text&&t.phase===e.phase&&t.occurredAt===e.occurredAt?t:e]}}return o.add(i.id),[i]}),c=t.filter(e=>a.has(e.operationId)).map(e=>r.get(e.key)??{id:e.key,role:`user`,text:e.text,complete:e.state===`failed`,...e.turnId?{turnId:e.turnId}:{}}),l=n.filter(e=>e.role===`assistant`&&e.id.startsWith(`assistant:`)&&!o.has(e.id)),u=iS([...c,...l]),d=new Map(s.map((e,t)=>[e.id,t])),f=new Map;for(let e of u){let t=null;if(e.turnId){for(let n=s.length-1;n>=0;--n)if(s[n]?.turnId===e.turnId){t=n;break}}if(t===null){let r=i.get(e.id);if(r!==void 0){for(let e=r-1;e>=0;--e){let r=d.get(n[e].id);if(r!==void 0){t=r;break}}if(t===null)for(let e=r+1;e<n.length;e+=1){let r=d.get(n[e].id);if(r!==void 0){t=r-1;break}}}}let r=t??s.length-1;f.set(r,[...f.get(r)??[],e])}return iS([...f.get(-1)??[],...s.flatMap((e,t)=>[e,...f.get(t)??[]])])}function sS(e,t){if(!t||typeof t!=`object`)return Xx(e);let n=t;if(!Number.isInteger(n.cursor)||n.cursor<0||!Array.isArray(n.messages)||!Array.isArray(n.prompts)||!Array.isArray(n.interactions))return Xx(e);let r=[`submitting`,`accepted`,`failed`,`canonical`],i=[`pending`,`submitting`,`resolved`,`failed`],a=[`starting`,`working`,`finished`,`interrupted`,`recoverable`];return{...Xx(e),sessionId:e,cursor:n.cursor,lifecycle:a.includes(n.lifecycle)?n.lifecycle:`finished`,activeTurnId:typeof n.activeTurnId==`string`||n.activeTurnId===null?n.activeTurnId:null,snapshotting:!1,buffered:new Map,messages:n.messages.filter(e=>!!(e&&typeof e.id==`string`&&(e.role===`user`||e.role===`assistant`||e.role===`audit`)&&typeof e.text==`string`&&(e.attention===void 0||Kx({...e.attention,payload:e.attention.attention}))&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)))).slice(-200),activities:Array.isArray(n.activities)?n.activities.filter(e=>!!(e&&typeof e.id==`string`&&typeof e.label==`string`&&typeof e.detail==`string`&&(e.changes===void 0||Array.isArray(e.changes)&&e.changes.every(e=>{if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.path==`string`&&Number.isInteger(t.additions)&&t.additions>=0&&Number.isInteger(t.deletions)&&t.deletions>=0}))&&(e.turnId===void 0||typeof e.turnId==`string`))).filter(e=>!Xv(e)).map(e=>{let{mcpStartup:t,...n}=e,r=Xm(t);return{...n,...r?{mcpStartup:r}:{}}}).slice(-200):[],prompts:n.prompts.filter(e=>!!(e&&typeof e.operationId==`string`&&typeof e.key==`string`&&typeof e.text==`string`&&r.includes(e.state)&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)))).slice(-200),interactions:n.interactions.filter(e=>!!(e&&typeof e.requestId==`string`&&typeof e.key==`string`&&typeof e.kind==`string`&&(e.turnId===void 0||e.turnId===null||typeof e.turnId==`string`)&&i.includes(e.state)&&(e.resolvedAt===void 0||typeof e.resolvedAt==`number`&&Number.isFinite(e.resolvedAt))&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)))).slice(-200)}}function cS(e,t){if(!Number.isInteger(t.baseSequence)||t.baseSequence<0)return e;if(t.baseSequence<e.cursor)return bS({...e,snapshotting:!1});let n=t.items.filter(e=>e.kind===`user`),r=e.prompts.map(t=>{let r=n.some(e=>typeof e.turnId==`string`&&e.turnId===t.turnId||typeof e.operationId==`string`&&e.operationId===t.operationId),i=n.filter(e=>e.text===t.text),a=!t.turnId&&i.length===1&&e.prompts.filter(e=>e.state!==`canonical`&&e.text===t.text).length===1;return r||a?{...t,state:`canonical`}:t}),i=t.interactions.map(tS),a=new Map(e.interactions.map(e=>[e.requestId,e])),o=iS(i.map(e=>{let t=a.get(e.requestId);return t?.state===`resolved`?{...t,...e.occurredAt===void 0?{}:{occurredAt:e.occurredAt},...e.resolvedAt===void 0?{}:{resolvedAt:e.resolvedAt}}:{...e,...e.occurredAt===void 0&&t?.occurredAt!==void 0?{occurredAt:t.occurredAt}:{}}})),s=iS(t.items.flatMap(e=>{let t=$v(e);return t?[{...t,key:`activity:${t.id}`}]:[]}).concat((t.activities??[]).map(e=>({...e,key:`activity:${e.id}`})))).filter(e=>!Xv(e)).map(e=>({id:e.id,label:e.label,detail:e.detail,...e.turnId?{turnId:e.turnId}:{},...e.actorTurnId?{actorTurnId:e.actorTurnId}:{},...e.occurredAt===void 0?{}:{occurredAt:e.occurredAt},...e.changes?{changes:e.changes}:{},...Xm(e.mcpStartup)?{mcpStartup:Xm(e.mcpStartup)}:{}})).reduce(aS,[...e.activities]),c=new Map(t.turns.map(e=>[e.id,e])),l=t.items.map(e=>{if(typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt))return e;let t=typeof e.turnId==`string`?c.get(e.turnId):void 0,n=e.kind===`agent`?t?.completedAt??t?.startedAt:t?.startedAt??t?.completedAt;return typeof n==`number`&&Number.isFinite(n)?{...e,occurredAt:n}:e}),u=(t.autopilotAudit??[]).filter(e=>typeof e?.id==`string`&&typeof e.label==`string`&&typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)),d={...e,cursor:Math.max(e.cursor,t.baseSequence),snapshotting:!1,activeTurnId:t.activeTurnId,lifecycle:rS(t.activeTurnId,e.cursor===0&&e.lifecycle===`finished`?`working`:e.lifecycle),prompts:r,messages:iS(oS(l,r,e.messages).concat(u.map(Qx))).sort((e,t)=>(e.occurredAt??2**53-1)-(t.occurredAt??2**53-1)),activities:s,interactions:o,autopilotAuditTruncated:t.autopilotAuditTruncated===!0,buffered:new Map([...e.buffered].filter(([e])=>e>t.baseSequence))};return bS({...d,messages:lS(d.messages)})}function lS(e){let t=new Set;return e.filter(e=>e.role!==`audit`||!e.controlId?!0:t.has(e.controlId)?!1:(t.add(e.controlId),!0))}function uS(e){return{...e,snapshotting:!0}}function dS(e,t,n,r){if(!n.trim()||e.prompts.some(e=>e.operationId===t))return e;let i={operationId:t,key:`prompt:${t}`,text:n,state:`submitting`,turnId:null,...typeof r==`number`&&Number.isFinite(r)?{occurredAt:r}:{}};return{...e,lifecycle:`starting`,prompts:[...e.prompts,i],messages:[...e.messages,{id:i.key,role:`user`,text:n,...i.occurredAt===void 0?{}:{occurredAt:i.occurredAt},complete:!1}]}}function fS(e,t,n,r){let i=dS(e,t,n,r);return i===e?e:{...i,lifecycle:`working`}}function pS(e,t,n){return{...e,activeTurnId:n??e.activeTurnId,lifecycle:n?`working`:e.lifecycle,prompts:e.prompts.map(e=>e.operationId===t?{...e,state:`accepted`,turnId:n}:e),messages:e.messages.map(e=>e.id===`prompt:${t}`?{...e,complete:!0,...n?{turnId:n}:{}}:e)}}function mS(e,t){return{...e,lifecycle:`recoverable`,prompts:e.prompts.map(e=>e.operationId===t?{...e,state:`failed`}:e),messages:e.messages.map(e=>e.id===`prompt:${t}`?{...e,complete:!0}:e)}}function hS(e,t,n){return{...e,interactions:e.interactions.map(e=>e.requestId===t&&(e.state===`pending`||e.state===`failed`)?{...e,state:`submitting`,...n?{operationId:n}:{}}:e)}}function gS(e,t,n){return{...e,interactions:e.interactions.map(e=>e.requestId===t&&e.state!==`resolved`?{...e,state:`failed`,attemptedOutcome:n}:e)}}function _S(e,t,n,r){return{...e,interactions:e.interactions.map(e=>e.requestId===t?{...e,state:`resolved`,...r===void 0?{}:{resolvedAt:r},...nS(e,n)?{attemptedOutcome:nS(e,n)}:{}}:e)}}function vS(e,t){if(!Number.isInteger(t.sequence)||t.sequence<=e.cursor)return e;if(e.snapshotting||t.sequence>e.cursor+1){let n=new Map(e.buffered);return n.set(t.sequence,t),{...e,snapshotting:!0,buffered:n}}let n={...e,cursor:t.sequence},r=t.payload,i=eS(t.occurredAt);if(t.type===`agentMessageDelta`&&typeof r?.text==`string`){let e=typeof r.turnId==`string`?r.turnId:n.activeTurnId??void 0,t=`assistant:${typeof r.itemId==`string`?r.itemId:e??`live`}`,a=n.messages.find(e=>e.id===t);n={...n,lifecycle:n.activeTurnId?`working`:n.lifecycle,messages:a?n.messages.map(e=>e.id===t?{...e,text:e.text+r.text,...r.phase===`commentary`||r.phase===`final_answer`?{phase:r.phase}:{},complete:r.phase===`final_answer`||e.complete,...e.occurredAt===void 0&&i!==void 0?{occurredAt:i}:{}}:e):[...n.messages,{id:t,role:`assistant`,...r.phase===`commentary`||r.phase===`final_answer`?{phase:r.phase}:{},text:r.text,...e?{turnId:e}:{},...i===void 0?{}:{occurredAt:i},complete:r.phase===`final_answer`}]}}else if((t.type===`agentMessageStarted`||t.type===`agentMessageCompleted`)&&typeof r.text==`string`){let e=`assistant:${typeof r.itemId==`string`?r.itemId:n.activeTurnId??`live`}`,a=n.messages.find(t=>t.id===e),o=t.type===`agentMessageCompleted`,s={id:e,role:`assistant`,text:o&&r.text?r.text:a?.text??r.text,complete:o,...r.phase===`commentary`||r.phase===`final_answer`?{phase:r.phase}:a?.phase?{phase:a.phase}:{},...typeof r.turnId==`string`?{turnId:r.turnId}:a?.turnId?{turnId:a.turnId}:n.activeTurnId?{turnId:n.activeTurnId}:{},...a?.occurredAt===void 0?i===void 0?{}:{occurredAt:i}:{occurredAt:a.occurredAt}};n={...n,lifecycle:n.activeTurnId?`working`:n.lifecycle,messages:a?n.messages.map(t=>t.id===e?s:t):[...n.messages,s]}}else if(t.type===`turnCompleted`||t.type===`turnInterrupted`)n={...n,activeTurnId:null,lifecycle:t.type===`turnCompleted`||n.lifecycle===`finished`?`finished`:`interrupted`,messages:n.messages.map(e=>e.role===`assistant`?{...e,complete:!0}:e)};else if(t.type===`interaction.requested`&&typeof r?.requestId==`string`&&typeof r.kind==`string`){let e=n.interactions.find(e=>e.requestId===r.requestId);if(!e||e.state===`resolved`){let t={requestId:r.requestId,key:`interaction:${r.requestId}`,kind:r.kind,turnId:typeof r.turnId==`string`?r.turnId:n.activeTurnId,payload:r.payload,state:`pending`,...i===void 0?{}:{occurredAt:i}};n={...n,interactions:e?n.interactions.map(e=>e.requestId===r.requestId?t:e):[...n.interactions,t]}}}else if(t.type===`interaction.resolved`&&typeof r?.requestId==`string`)n=_S(n,r.requestId,r.outcome,i);else if(t.type===`activity.updated`&&!Xv(r)&&typeof r?.id==`string`&&typeof r.label==`string`&&typeof r.detail==`string`){let e=yS(r.changes),t=Xm(r.mcpStartup);n={...n,activities:aS(n.activities,{id:r.id,label:r.label,detail:r.detail,...i===void 0?{}:{occurredAt:i},...e.length?{changes:e}:{},...t?{mcpStartup:t}:{},...typeof r.turnId==`string`?{turnId:r.turnId}:n.activeTurnId?{turnId:n.activeTurnId}:{},...typeof r.actorTurnId==`string`?{actorTurnId:r.actorTurnId}:{}})}}else if(t.type===`session.updated`&&r?.activeTurnId!==void 0){let e=typeof r.activeTurnId==`string`?r.activeTurnId:null;n={...n,activeTurnId:e,lifecycle:e?`working`:rS(e,n.lifecycle)}}let a=$x(t);return a&&!n.messages.some(e=>e.id===a.id)&&(n={...n,messages:lS([...n.messages,a])}),n}function yS(e){return!Array.isArray(e)||e.length>1e3?[]:e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return typeof t.path==`string`&&Number.isInteger(t.additions)&&t.additions>=0&&Number.isInteger(t.deletions)&&t.deletions>=0?[{path:t.path,additions:t.additions,deletions:t.deletions}]:[]})}function bS(e){let t=new Map(e.buffered),n={...e,snapshotting:!1,buffered:t};for(;;){let e=t.get(n.cursor+1);if(!e)return{...n,buffered:t,snapshotting:t.size>0};t.delete(e.sequence),n=vS({...n,buffered:t},e),t=new Map(n.buffered)}}function xS(e){return e.sessionId?e.lifecycle===`recoverable`?`Connection interrupted. Reconnecting…`:e.lifecycle===`starting`?`Starting Codex turn…`:e.lifecycle===`working`?`Codex is working…`:e.lifecycle===`interrupted`?`Codex turn interrupted.`:`Ready.`:`Choose a workspace and start a session.`}var SS={read:async()=>null,write:async()=>{}},CS=[250,750,1500],wS=e=>!!e&&typeof e==`object`,TS=e=>wS(e)&&typeof e.path==`string`&&Number.isInteger(e.additions)&&e.additions>=0&&Number.isInteger(e.deletions)&&e.deletions>=0,ES=e=>wS(e)&&typeof e.id==`string`&&typeof e.kind==`string`,DS=e=>wS(e)&&typeof e.id==`string`&&Array.isArray(e.items)&&e.items.every(ES)&&(e.startedAt===null||typeof e.startedAt==`number`)&&(e.completedAt===null||typeof e.completedAt==`number`),OS=e=>!wS(e)||typeof e.requestId!=`string`||typeof e.kind!=`string`||!(e.turnId===null||typeof e.turnId==`string`)||!(e.requestedAt===null||typeof e.requestedAt==`string`)?!1:e.resolvedAt===null?Object.hasOwn(e,`payload`):typeof e.resolvedAt==`string`&&(e.outcome===`approved`||e.outcome===`denied`||e.outcome===`answered`||e.outcome===`dismissed`||e.outcome===`failed`)&&!Object.hasOwn(e,`payload`),kS=e=>wS(e)&&typeof e.id==`string`&&typeof e.label==`string`&&typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)&&(e.controlId===void 0||typeof e.controlId==`string`)&&(e.attention===void 0||wS(e.attention)&&!!Kx({...e.attention,payload:e.attention.attention})),AS=e=>wS(e)&&typeof e.id==`string`&&typeof e.label==`string`&&typeof e.detail==`string`&&(e.changes===void 0||Array.isArray(e.changes)&&e.changes.every(TS))&&(e.turnId===void 0||typeof e.turnId==`string`)&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)),jS=e=>!wS(e)||!Number.isInteger(e.baseSequence)||e.baseSequence<0||!(e.activeTurnId===null||typeof e.activeTurnId==`string`)||!Array.isArray(e.items)||!Array.isArray(e.turns)||!Array.isArray(e.interactions)||!e.items.every(ES)||!e.turns.every(DS)||!e.interactions.every(OS)||e.activities!==void 0&&(!Array.isArray(e.activities)||!e.activities.every(AS))||e.autopilotAudit!==void 0&&(!Array.isArray(e.autopilotAudit)||!e.autopilotAudit.every(kS))||e.autopilotAuditTruncated!==void 0&&typeof e.autopilotAuditTruncated!=`boolean`||e.currentSequence!==void 0&&(!Number.isInteger(e.currentSequence)||e.currentSequence<0)?null:e,MS=class{#e=Xx();#t={attempts:0,coalesced:0,resyncs:0,socketOpens:0};get transportDiagnostics(){return{...this.#t}}#n=null;#r=null;#i=0;#a=-1;#o=null;#s=!1;#c=!1;#l=null;#u=null;#d=null;#f=0;#p=!1;#m=!1;#h=new Set;#g=null;#_=0;#v=!1;#y=new Set;#b=new Set;#x;constructor(e){this.#x={...e,websocket:e.websocket??(e=>new WebSocket(e)),cache:e.cache??SS,location:e.location??location,document:e.document??document,window:e.window??window,setTimeout:e.setTimeout??((e,t)=>setTimeout(e,t)),clearTimeout:e.clearTimeout??(e=>clearTimeout(e)),createKey:e.createKey??qh,now:e.now??Date.now},this.#x.document.addEventListener(`visibilitychange`,this.#S),this.#x.window.addEventListener(`focus`,this.#S)}get view(){let e=this.#e.snapshotting&&this.#a!==this.#i&&!this.#m&&!NS(this.#e);return Object.freeze({...this.#e,status:this.#s?`Connection interrupted. Reconnecting…`:e?`Loading conversation…`:xS(this.#e),readySince:this.#r,starting:this.#e.lifecycle===`starting`,newEmpty:this.#m&&!NS(this.#e)})}canSubmit(e){return this.#n?e===`send`?!this.#e.activeTurnId:!!(this.#e.activeTurnId&&(e!==`queue`||this.#x.relay.queueTurnInput)):!1}select(e,t={}){if(this.#v||this.#n===e)return;this.#I(),this.#n=e,this.#r=null,e&&t.history===`empty`&&this.#h.add(e),this.#m=e!==null&&this.#h.has(e);let n=++this.#i;this.#e=Xx(e),this.#j(),e&&this.#C(e,n)}async send(e,t=this.#x.createKey()){let n=this.#n,r=this.#i,i=`${n}:${r}:${t}`;if(!(!n||!e.trim()||this.#e.activeTurnId||this.#y.has(i))){this.#y.add(i),this.#A(dS(this.#e,t,e.trim(),this.#x.now()));try{let i=await this.#x.relay.startTurn(n,e.trim(),t);this.#N(n,r)&&(this.#M(n),this.#A(pS(this.#e,t,i.activeTurnId??null))),this.#x.onSendAccepted?.(n,t)}catch(e){this.#N(n,r)&&(this.#A(mS(this.#e,t)),this.#x.onSendError?.(e,t))}finally{this.#y.delete(i)}}}async retryPrompt(e){let t=this.#e.prompts.find(t=>t.operationId===e);t?.state===`failed`&&await this.send(t.text,e)}async queue(e,t=this.#x.createKey()){let n=this.#n,r=this.#e.activeTurnId,i=this.#x.relay.queueTurnInput,a=this.#i,o=`${n}:${a}:${t}`;if(!(!n||!r||!i||!e.trim()||this.#y.has(o))){this.#y.add(o),this.#A(fS(this.#e,t,e.trim(),this.#x.now()));try{let o=await i(n,r,e.trim(),t);this.#N(n,a)&&this.#A(pS(this.#e,t,o.activeTurnId)),this.#x.onSendAccepted?.(n,t)}catch(e){this.#N(n,a)&&(this.#A(mS(this.#e,t)),this.#x.onSendError?.(e,t))}finally{this.#y.delete(o)}}}async interruptAndSend(e,t=this.#x.createKey()){let n=this.#n,r=this.#e.activeTurnId,i=this.#i,a=`${n}:${i}:${t}`;if(!(!n||!r||!e.trim()||this.#y.has(a))){this.#y.add(a),this.#A(dS(this.#e,t,e.trim(),this.#x.now()));try{await this.#x.relay.interruptTurn(n,r).catch(()=>void 0);let a=await this.#P(n,i,e.trim(),t);this.#N(n,i)&&this.#A(pS(this.#e,t,a.activeTurnId??null)),this.#x.onSendAccepted?.(n,t)}catch(e){this.#N(n,i)&&(this.#A(mS(this.#e,t)),this.#x.onSendError?.(e,t))}finally{this.#y.delete(a)}}}async interrupt(){let e=this.#n,t=this.#e.activeTurnId;if(!(!e||!t))try{await this.#x.relay.interruptTurn(e,t)}catch{}}async respond(e,t,n=this.#x.createKey()){let r=this.#n,i=this.#i,a=this.#e.interactions.find(t=>t.requestId===e),o=a?.operationId??n,s=`${r}:${i}:${o}`;if(!(!r||!a||a.state===`resolved`||a.state===`submitting`||this.#b.has(s))){this.#b.add(s),this.#A(hS(this.#e,e,o));try{let n=await this.#x.relay.respondInteraction(r,e,t,o),a=n&&(n.outcome===`approved`||n.outcome===`denied`||n.outcome===`answered`||n.outcome===`dismissed`||n.outcome===`failed`)?n.outcome:t;this.#N(r,i)&&this.#e.interactions.find(t=>t.requestId===e)?.state!==`resolved`&&this.#A(_S(this.#e,e,a,this.#x.now()))}catch{this.#N(r,i)&&this.#A(gS(this.#e,e,t))}finally{this.#b.delete(s)}}}async retryInteraction(e,t){let n=this.#e.interactions.find(t=>t.requestId===e);if(n?.state!==`failed`||!n.operationId)return;let r=t??n.attemptedOutcome,i=r===`approved`?{decision:`accept`}:r===`denied`?{decision:`decline`}:r;i!==void 0&&await this.respond(e,i,n.operationId)}refresh(){this.#n&&!this.#m&&this.#D(this.#n,this.#i)}dispose(){this.#v||(this.#v=!0,this.#I(),this.#x.document.removeEventListener(`visibilitychange`,this.#S),this.#x.window.removeEventListener(`focus`,this.#S))}#S=()=>{this.#x.document.visibilityState===`visible`&&this.refresh()};async#C(e,t){let n=this.#m;if(n||this.#D(e,t),this.#w(e,t,!1),n)return;let r=await this.#x.cache.read(e).catch(()=>null);!this.#N(e,t)||this.#a===t||!r||(this.#e={...sS(e,r),cursor:this.#e.cursor,snapshotting:this.#e.snapshotting,buffered:this.#e.buffered},this.#j())}#w(e,t,n=!0){if(!this.#N(e,t)||this.#o)return;let r=this.#x.location.protocol===`https:`?`wss:`:`ws:`,i;try{i=this.#x.websocket(`${r}//${this.#x.location.host}/api/sessions/${encodeURIComponent(e)}/events?after=${this.#e.cursor}`)}catch{this.#x.onConnectionChange?.(!1),this.#s=!0,this.#j(),this.#g=this.#x.setTimeout(()=>this.#w(e,t),Math.min(1e3*2**this.#_++,1e4));return}this.#t.socketOpens++,this.#o=i,i.onopen=()=>{if(this.#N(e,t)&&this.#o===i){this.#x.onConnectionChange?.(!0);let r=this.#s;this.#s=!1,this.#_=0,r&&this.#j(),n&&!this.#m&&this.#D(e,t)}},i.onmessage=n=>this.#T(e,t,String(n.data)),i.onclose=()=>{if(!(!this.#N(e,t)||this.#o!==i)){if(this.#o=null,this.#x.onConnectionChange?.(!1),this.#c){this.#D(e,t);return}this.#s=!0,this.#j(),this.#g=this.#x.setTimeout(()=>this.#w(e,t),Math.min(1e3*2**this.#_++,1e4))}}}#T(e,t,n){if(!this.#N(e,t))return;let r;try{r=JSON.parse(n)}catch{return}if(r.type===`relay.resyncRequired`){this.#t.resyncs++,this.#c=!0,typeof r.currentSequence==`number`&&Number.isSafeInteger(r.currentSequence)&&r.currentSequence>=0&&(this.#l=Math.max(this.#l??0,r.currentSequence)),this.#D(e,t);return}if(r.type!==`relay.event`||!r.event||typeof r.event!=`object`)return;let i=r.event;if(!Number.isInteger(i.sequence)||typeof i.type!=`string`||!this.#E(i))return;if(i.type===`tool.efficiency.updated`){let e=i.sessionId;if(e!==void 0&&e!==this.#e.sessionId)return;let t=Gh(i.payload,this.#e.sessionId??``);if(!t)return;i={sequence:i.sequence,type:i.type,payload:t}}([`agentMessageDelta`,`agentMessageStarted`,`agentMessageCompleted`,`interaction.requested`,`interaction.resolved`,`turnCompleted`,`turnInterrupted`].includes(i.type)||i.type===`activity.updated`&&PS(i.payload)||i.type===`session.updated`&&typeof i.payload.activeTurnId==`string`)&&this.#M(e);let a=vS(this.#e,i);this.#A(a),this.#x.onRelayEvent?.(i),(i.type===`session.updated`||i.type===`plan.updated`||i.type===`plan.closed`||i.type===`agent.activity.updated`||i.type===`session.status.updated`||i.type===`autopilot.updated`||i.type===`org-plan.attention-required`||i.type===`org-plan.attention-resolved`)&&this.#x.onSessionEvent?.(i),a.snapshotting&&this.#D(e,t)}#E(e){let t=e.payload;if(!t||typeof t!=`object`)return e.type===`turnCompleted`||e.type===`turnInterrupted`||e.type===`plan.closed`;let n=t;return e.type===`agentMessageDelta`||e.type===`agentMessageStarted`||e.type===`agentMessageCompleted`?typeof n.text==`string`:e.type===`interaction.requested`?typeof n.requestId==`string`&&typeof n.kind==`string`:e.type===`interaction.resolved`?typeof n.requestId==`string`:e.type===`session.updated`?n.activeTurnId===null||typeof n.activeTurnId==`string`:e.type===`activity.updated`?typeof n.id==`string`&&typeof n.label==`string`&&typeof n.detail==`string`:e.type===`agent.activity.updated`?typeof n.sessionId==`string`&&!!n.root&&Array.isArray(n.subagents):e.type===`session.status.updated`?typeof n.state==`string`&&typeof n.reason==`string`:e.type===`tool.efficiency.updated`?Gh(t,this.#e.sessionId??``)!==null:e.type===`plan.updated`||e.type===`plan.closed`||e.type.startsWith(`autopilot.`)||e.type.startsWith(`org-plan.`)}#D(e,t){if(this.#u?.id===e&&this.#u.generation===t)return this.#t.coalesced++,this.#u.promise;if(!this.#N(e,t))return Promise.resolve();let n=this.#e.snapshotting&&this.#e.buffered.size>0;this.#e=uS(this.#e),this.#j(),this.#t.attempts++;let r=this.#x.relay.getHistory(e,{attempts:this.#t.attempts,coalesced:this.#t.coalesced}).then(r=>{let i=jS(r);if(this.#N(e,t)){if(!i){this.#A({...this.#e,snapshotting:!1,lifecycle:`recoverable`});return}if(this.#l!==null&&i.baseSequence<this.#l)throw Error(`CHAT_SNAPSHOT_BEHIND_RESYNC`);this.#f=0,this.#p=!1,this.#d&&this.#x.clearTimeout(this.#d),this.#d=null,this.#a=t,this.#A(cS(this.#e,i));for(let t of i.items)t.kind===`user`&&typeof t.operationId==`string`&&this.#x.onHistoryPromptAccepted?.(e,t.operationId);(n||this.#c)&&(this.#c=!1,this.#l=null,this.#k(e,t))}}).catch(n=>{if(this.#N(e,t)){this.#A({...this.#e,snapshotting:!1,lifecycle:`recoverable`});let r=CS[this.#f++];r===void 0?!this.#m&&!this.#p&&(this.#p=!0,this.#x.onHistoryError?.(n)):this.#O(e,t,r)}}).finally(()=>{this.#u?.promise===r&&(this.#u=null,this.#N(e,t)&&this.#e.snapshotting&&this.#D(e,t))});return this.#u={id:e,generation:t,promise:r},r}#O(e,t,n){this.#d&&this.#x.clearTimeout(this.#d);let r=this.#x.setTimeout(()=>{this.#d===r&&(this.#d=null,this.#N(e,t)&&this.#D(e,t))},n);this.#d=r}#k(e,t){let n=this.#o;this.#o=null,this.#x.onConnectionChange?.(!1),n?.close(),this.#g&&this.#x.clearTimeout(this.#g),this.#g=null,this.#w(e,t,!1)}#A(e){this.#n&&NS(e)&&this.#M(this.#n),this.#e=e,this.#j(),this.#n&&this.#x.cache.write(this.#n,this.#e).catch(()=>{})}#j(){this.#e.sessionId&&this.#e.lifecycle===`finished`&&!this.#e.activeTurnId?this.#r??=this.#x.now():this.#r=null,this.#x.publish(this.view)}#M(e){this.#h.delete(e),this.#n===e&&(this.#m=!1)}#N(e,t){return!this.#v&&this.#n===e&&this.#i===t}async#P(e,t,n,r){let i;for(let a of[0,50,150,300]){if(!this.#N(e,t))throw Error(`SESSION_CHANGED`);a&&await this.#F(a);try{return await this.#x.relay.startTurn(e,n,r)}catch(e){if(!FS(e,`SESSION_TURN_ACTIVE`))throw e;i=e}}throw i}#F(e){return new Promise(t=>this.#x.setTimeout(t,e))}#I(){this.#x.onConnectionChange?.(!1),this.#s=!1,this.#t={attempts:0,coalesced:0,resyncs:0,socketOpens:0},this.#c=!1,this.#l=null,this.#g&&this.#x.clearTimeout(this.#g),this.#g=null,this.#d&&this.#x.clearTimeout(this.#d),this.#d=null,this.#f=0,this.#p=!1,this.#m=!1;let e=this.#o;this.#o=null,e?.close()}};function NS(e){return!!(e.activeTurnId||e.messages.length||e.activities.some(PS)||e.prompts.length||e.interactions.length)}function PS(e){if(Xv(e))return!1;let t=e;return!Xm(t.mcpStartup)||typeof t.turnId==`string`||typeof t.actorTurnId==`string`}function FS(e,t){return wS(e)&&e.code===t}function IS(e){if(!e||typeof e!=`object`)return!1;let t=e;return(t.state===`working`||t.state===`idle`)&&[`needsYou`,`complete`,`rootTurn`,`agent`,`process`,`autopilot`,`incompleteWithoutContinuation`,`stopped`,`disconnected`,`unknown`].includes(t.reason)&&[`fresh`,`stale`,`reconciling`].includes(t.confidence)&&typeof t.observedAt==`string`&&!Number.isNaN(Date.parse(t.observedAt))&&typeof t.nextExpectedAction==`string`&&t.nextExpectedAction.length>0&&t.nextExpectedAction.length<=240}function LS(e){return typeof e==`string`&&e.length<=200&&/^(?:tmp(?:\/sessions(?:\/(?:\.cleanup-)?[a-z0-9-]+)?)?|\.gestalt\/forgotten-tmp\/[0-9a-f-]{36})$/.test(e)}var RS={SESSION_WORKSPACE_BUSY:`A session is already running in this workspace. Open it or stop it first.`,SESSION_WORKSPACE_CLEANING:`This workspace is being forgotten. Retry when cleanup finishes.`,SESSION_NESTED_WORKSPACE:`Forget the session inside this temporary directory first, then retry.`,FILE_PREVIEW_NOT_FOUND:`This file or folder no longer exists. Check the path and try again.`,FILE_PREVIEW_UNREADABLE:`This path could not be read. It must be inside the workspace and accessible without symbolic links.`,FILE_PREVIEW_UNSUPPORTED:`Preview supports UTF-8 text files and folders. This item cannot be displayed.`,FILE_PREVIEW_TOO_LARGE:`This file exceeds the 1 MiB preview limit. Open it locally to view its contents.`,INVALID_FILE_PREVIEW:`This file reference is invalid. Check its path and try again.`,RELAY_UNAVAILABLE:`The relay is unavailable. Check the connection and try again.`,SESSION_HISTORY_UNAVAILABLE:`Session history is unavailable. Check the relay connection and try opening the session again.`,SESSION_HISTORY_READ_FAILED:`Session history could not be loaded from its provider. Try again shortly; reopen the session if this persists.`,SESSION_WRITER_BUSY:`This thread is active in another Codex client. Release it there, then retry sending here.`,SESSION_WORKSPACE_LOCKED:`An Org-plan supervisor reserves this workspace. Open its session to continue, or close it to release the reservation.`,SESSION_WORKSPACE_UNAVAILABLE:`This session workspace is unavailable. Your message remains in the conversation for copying; restore workspace access before sending again.`,SESSION_RUNTIME_DEPENDENCY_FAILED:`A required Codex runtime dependency is unavailable. Check Codex, then retry.`,CODEX_PROTOCOL_INCOMPATIBLE:`The installed Codex runtime is incompatible with this relay. Update Codex before retrying.`,SESSION_ROLLOUT_MISSING:`This stored thread is no longer available.`,SESSION_RUNTIME_UNAVAILABLE:`The Codex runtime is unavailable. Retry shortly.`,SESSION_START_FAILED:`The session could not be started. Try again.`,CODEX_MODEL_UNAVAILABLE:`The selected Codex model is unavailable. Choose an available model in New session settings and retry.`,KIMI_MODEL_UNAVAILABLE:`The selected Kimi model is unavailable. Choose an available model in New session settings and retry.`,CODEX_EXECUTOR_MODEL_UNAVAILABLE:`The executor model is unavailable. Choose an available executor model in New session settings and retry.`,WORKSPACE_NOT_FOUND:`The selected workspace is no longer available. Select an existing workspace and retry.`,PROFILE_NOT_FOUND:`The selected launcher profile is unavailable. Refresh New session settings and retry.`,LLM_RUNTIME_UNAVAILABLE:`The selected provider runtime is unavailable. Check the provider installation and authentication, then retry.`,ORG_EXECUTOR_PROFILE_UNAVAILABLE:`The Org-plan executor profile could not be read. Restore the installed Gestalt agent profile and try again.`,ORG_EXECUTOR_PROFILE_INVALID:`The Org-plan executor profile has invalid model settings. Repair the installed profile and try again.`,SESSION_CLOSE_FAILED:`The session could not be closed. Try again.`,SESSION_FORGET_FAILED:`The session could not be forgotten. It remains in Sessions; try Forget again.`,SESSION_FORGET_RECOVERY_UNAVAILABLE:`The cleanup operation changed. Refresh Sessions to see the available actions.`,SESSION_RELEASE_UNCONFIRMED:`Session work could not be stopped. The session is retained; try Forget again.`,SESSION_CLEANUP_FAILED:`Temporary files could not be removed. The session is retained; try Forget again.`,SESSION_COPY_FAILED:`The CLI resume command could not be copied. Check clipboard access and try again.`,SESSION_DEFAULTS_READ_FAILED:`Saved session defaults could not be loaded. Using built-in defaults; check the configuration file and reload.`,SESSION_DEFAULTS_SAVE_FAILED:`Session defaults could not be saved. Try again.`,SESSION_MODELS_READ_FAILED:`Models could not be loaded for this provider. Select another provider and try again.`,SESSION_REFRESH_FAILED:`Sessions could not be refreshed. Try again.`,MESSAGE_SEND_FAILED:`The message was not sent. Your draft is preserved.`,GIT_SUMMARY_FAILED:`Repository status could not be loaded. Select it again to retry.`,GIT_PULL_FAILED:`The branch could not be refreshed. Resolve any Git conflicts and try again.`,GIT_CHECKOUT_FAILED:`The branch could not be selected. Refresh Git status and try again.`,GIT_PUSH_FAILED:`The push failed. Refresh Git status and resolve remote divergence first.`,GIT_CLONE_FAILED:`Clone failed.`,WORKSPACE_FILES_READ_FAILED:`Files could not be read. Try again.`,WORKSPACE_FILES_UPLOAD_FAILED:`The file could not be uploaded. Try dropping it again.`,WORKSPACE_FOLDER_CREATE_FAILED:`The folder could not be created. Check the name and try again.`,WORKSPACE_FOLDER_EXISTS:`An item with that name already exists. Choose a different folder name.`,QUIT_FAILED:`Gestalt Mobile could not quit cleanly. Try again or stop it from the terminal.`,TMP_CLEANUP_UNAVAILABLE:`Temporary files could not be checked. Try Clean TMP again.`,UPGRADE_FAILED:`Gestalt could not complete the upgrade and reconnect. Check update-restart.log and reload when Mobile is ready.`,UPGRADE_UNAVAILABLE:`Start Mobile with gestalt mobile to enable upgrades.`,DEBUG_CONTEXT_FAILED:`Session diagnostics could not be read. Reopen DEBUG to try again.`,DEBUG_ATTENTION_CHANGED:`This blocker is no longer active. Refresh the session and try again.`,DEBUG_CONTEXT_INVALID:`Select a valid blocker to debug.`,DEBUG_START_FAILED:`Self DEBUG could not start. Check Sessions for a saved debug session before trying again.`,DEBUG_TRACE_FAILED:`The diagnostic trace could not be opened. Check that the saved JSON file is still available.`,DEBUG_CONFIRMATION_EXPIRED:`The debug confirmation expired. Reopen DEBUG to confirm current session details.`,DEBUG_SOURCE_CHANGED:`The source session changed. Reopen DEBUG to confirm current session details.`};function zS(e,t){let n=e instanceof Error?e.message:``,r=typeof e==`object`&&e&&`code`in e&&typeof e.code==`string`?e.code:``,i=Object.hasOwn(RS,r)?r:Object.hasOwn(RS,n)?n:t,a=typeof e==`object`&&e&&`retryable`in e?e.retryable===!0:!0,o=t===`SESSION_START_FAILED`&&i===`SESSION_WORKSPACE_UNAVAILABLE`?`The selected workspace is busy or its temporary ownership could not be confirmed. Retry shortly; if this persists, use Self DEBUG to inspect workspace ownership.`:RS[i];if(i===`SESSION_CLEANUP_FAILED`&&typeof e==`object`&&e){let t=`workspaceName`in e&&typeof e.workspaceName==`string`&&e.workspaceName.length>0&&e.workspaceName.length<=255&&!/[\\/\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(e.workspaceName)?` in “${e.workspaceName}”`:``,n=`cleanupFolders`in e&&Array.isArray(e.cleanupFolders)?e.cleanupFolders.filter(LS):[];if(o=`Temporary files could not be removed${t}. The session is retained. Try Forget again.`,n.length){let e=n.map(e=>`“${e}”${t}`);return{code:i,message:`Could not finish cleaning ${Am(e)}. The session is retained. Try Forget again.`,retryable:a,history:{message:o,details:e}}}}return{code:i,message:o,retryable:a}}var BS=K(`<li class="svelte-1izxxv2"> </li>`),VS=K(`<ul aria-label="Affected folders" class="svelte-1izxxv2"></ul>`),HS=K(`<small class="svelte-1izxxv2"> </small>`),US=K(`<li class="svelte-1izxxv2"><div class="notification-meta svelte-1izxxv2"><strong class="svelte-1izxxv2"> </strong> <time class="svelte-1izxxv2"> </time></div> <p class="svelte-1izxxv2"> </p> <!> <!></li>`),WS=K(`<ol aria-label="Recent notifications" class="svelte-1izxxv2"></ol>`),GS=K(`<p class="empty svelte-1izxxv2" role="status">No recent notifications.</p>`),KS=K(`<main class="notification-history svelte-1izxxv2" aria-labelledby="notification-history-title"><header class="svelte-1izxxv2"><button type="button" class="svelte-1izxxv2">Back</button> <div><h1 id="notification-history-title" tabindex="-1" class="svelte-1izxxv2">Recent notifications</h1> <p class="svelte-1izxxv2">The latest notifications saved in this browser.</p></div></header> <!></main>`);function qS(e,t){I(t,!0);let n=R([]),r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});Yi(()=>t.queue.subscribeHistory(e=>z(n,e)));function i(e){Or().then(()=>e.focus())}var a=KS(),o=B(a),s=B(o),c=H(s,2);_i(B(c),()=>i),F(2),P(c),P(o);var l=H(o,2),u=e=>{var t=WS();X(t,21,()=>W(n),e=>e.id,(e,t)=>{var n=US(),i=B(n),a=B(i),o=B(a,!0);P(a);var s=H(a,2),c=B(s,!0);P(s),P(i);var l=H(i,2),u=B(l,!0);P(l);var d=H(l,2),f=e=>{var n=VS();X(n,21,()=>W(t).details,ii,(e,t)=>{var n=BS(),r=B(n,!0);P(n),U(()=>J(r,W(t))),q(e,n)}),P(n),q(e,n)};Y(d,e=>{W(t).details?.length&&e(f)});var p=H(d,2),m=e=>{var n=HS(),r=B(n);P(n),U(()=>J(r,`Repeated ${W(t).occurrences??``} times.`)),q(e,n)};Y(p,e=>{W(t).occurrences>1&&e(m)}),P(n),U((e,r)=>{Z(n,`data-kind`,W(t).kind),J(o,W(t).kind),Z(s,`datetime`,e),J(c,r),J(u,W(t).message)},[()=>new Date(W(t).updatedAt).toISOString(),()=>r.format(W(t).updatedAt)]),q(e,n)}),P(t),q(e,t)},d=e=>{q(e,GS())};Y(l,e=>{W(n).length?e(u):e(d,-1)}),P(a),G(`click`,s,function(...e){t.onclose?.apply(this,e)}),q(e,a),$e()}Vr([`click`]);var JS=`gestalt-mobile.codex-auto-reset-last-seen`;function YS(e,t){function n(){try{let e=Number(t?.getItem(JS));return Number.isSafeInteger(e)&&e>=0?e:0}catch{return 0}}let r=n();return i=>{let a=new Set(e.historySnapshot().map(e=>e.code));for(let o of[...i].sort((e,t)=>e.occurredAt-t.occurredAt)){if(o.occurredAt<=r)continue;let i=`CODEX_WEEKLY_RESET_${o.id}`;a.has(i)||(e.enqueue({code:i,kind:`info`,message:`Gestalt used a reset credit for the Codex weekly allowance.`}),a.add(i)),r=o.occurredAt;try{t?.setItem(JS,String(Math.max(r,n())))}catch{}}}}var XS=pp({enabled:ap(),resets:dp(pp({id:kf().min(1).max(80),occurredAt:tp().int().positive().max(2**53-1)})).max(50)}),ZS={error:null,success:5e3,warning:1e4,info:7e3},QS=`gestalt-mobile.notification-history`;function $S(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}function eC(e,t){try{let n=JSON.parse(e?.getItem(`gestalt-mobile.notification-history`)??`[]`);return Array.isArray(n)?n.filter(e=>typeof e==`object`&&!!e&&typeof e.id==`string`&&[`error`,`success`,`warning`,`info`].includes(String(e.kind))&&typeof e.message==`string`&&(e.details===void 0||Array.isArray(e.details)&&e.details.every(e=>typeof e==`string`))&&typeof e.occurrences==`number`&&typeof e.createdAt==`number`&&typeof e.updatedAt==`number`).slice(-t):[]}catch{return[]}}function tC(e={}){let t=e.now??Date.now,n=e.setTimer??setTimeout,r=e.clearTimer??clearTimeout,i=new Set,a=new Set,o=new Map,s=[],c=e.historyLimit??50,l=eC(e.historyStorage,c),u=0,d=()=>s.map(e=>({...e})),f=()=>[...l].reverse().map(e=>({...e})),p=()=>i.forEach(e=>e(d())),m=()=>{try{e.historyStorage?.setItem(QS,JSON.stringify(l))}catch{}},h=()=>{m(),a.forEach(e=>e(f()))},g=e=>{let t=o.get(e);t?.handle&&r(t.handle),t&&(t.handle=null)},_=e=>{s.some(t=>t.id===e)&&(g(e),o.delete(e),s=s.filter(t=>t.id!==e),p())},v=e=>{let r=o.get(e);!r||r.pauseReasons.size>0||(r.startedAt=t(),r.handle=n(()=>_(e),r.remaining))};return{enqueue(e){if(e.code){let n=s.find(t=>t.kind===e.kind&&t.code===e.code);if(n)return s=s.map(e=>e.id===n.id?{...e,occurrences:e.occurrences+1}:e),l=l.map(e=>e.id===n.id?{...e,occurrences:e.occurrences+1,updatedAt:t()}:e),p(),h(),n.id}let n=t(),r=`toast-${n}-${++u}`,{history:i,...a}=e,d={...a,id:r,occurrences:1};s=[...s,d],l=[...l,{...d,...i,createdAt:n,updatedAt:n}].slice(-c);let f=ZS[e.kind];return f!==null&&(o.set(r,{handle:null,remaining:f,startedAt:t(),pauseReasons:new Set}),v(r)),p(),h(),r},dismiss:_,pause(e,n){let r=o.get(e);!r||r.pauseReasons.has(n)||(r.pauseReasons.add(n),r.handle&&(r.remaining=Math.max(0,r.remaining-(t()-r.startedAt)),g(e)))},resume(e,t){let n=o.get(e);!n||!n.pauseReasons.delete(t)||n.pauseReasons.size>0||v(e)},snapshot:d,historySnapshot:f,subscribe(e){return i.add(e),e(d()),()=>i.delete(e)},subscribeHistory(e){return a.add(e),e(f()),()=>a.delete(e)}}}function nC(e){if(e.type!==`activity.updated`||!e.payload||typeof e.payload!=`object`)return null;let t=e.payload;return t.id===`gestalt-serena-availability`&&t.label===`Serena unavailable`?{kind:`warning`,code:`SERENA_UNAVAILABLE`,message:`Serena is unavailable in this session. Use native code tools. Connection availability will be checked when the runtime resumes.`}:null}function rC(e){let t=new Map;return(n,r)=>{if(r.type!==`activity.updated`||!r.payload||typeof r.payload!=`object`)return;let i=Xm(r.payload.mcpStartup);if(!i)return;let a=JSON.stringify([n,i.threadId??i.runtimeId,i.serverName]),o=t.get(a);if(o&&(o.observedAt>i.observedAt||o.sequence!==void 0&&r.sequence!==void 0&&r.sequence<=o.sequence))return;if(t.size>=256&&!o){let n=t.entries().next().value;n&&(n[1].toastId&&e.dismiss(n[1].toastId),t.delete(n[0]))}if(i.status===`ready`){o?.toastId&&e.dismiss(o.toastId),t.set(a,{toastId:null,failureId:o?.failureId??null,observedAt:i.observedAt,sequence:r.sequence});return}if(!i.failure||o?.failureId===i.failure.failureId)return;o?.toastId&&e.dismiss(o.toastId);let s=e.enqueue({kind:`warning`,code:`MCP_STARTUP_${n}_${i.failure.failureId}`,message:`${Zm(i.serverName)} startup ${i.status}. ${$m(i.serverName)} Trace reference: ${i.failure.failureId}.`});t.set(a,{toastId:s,failureId:i.failure.failureId,observedAt:i.observedAt,sequence:r.sequence})}}var iC=K(`<small class="svelte-1a0rutm"> </small>`),aC=K(`<section aria-atomic="true"><span class="toast-symbol svelte-1a0rutm" aria-hidden="true"> </span> <span class="toast-copy svelte-1a0rutm"><strong class="svelte-1a0rutm"> </strong> <span> </span> <!></span> <button type="button" class="svelte-1a0rutm"><span aria-hidden="true">×</span></button></section>`),oC=K(`<div class="toast-viewport svelte-1a0rutm" aria-label="Notifications"></div>`);function sC(e,t){I(t,!0);let n=R([]),r=L(()=>W(n).slice(-3));Yi(()=>t.queue.subscribe(e=>z(n,e)));var i=oC();X(i,21,()=>W(r),e=>e.id,(e,n)=>{var r=aC();let i;var a=B(r),o=B(a,!0);P(a);var s=H(a,2),c=B(s),l=B(c,!0);P(c);var u=H(c,2),d=B(u,!0);P(u);var f=H(u,2),p=e=>{var t=iC(),r=B(t);P(t),U(()=>J(r,`Repeated ${W(n).occurrences??``} times.`)),q(e,t)};Y(f,e=>{W(n).occurrences>1&&e(p)}),P(s);var m=H(s,2);P(r),U(()=>{i=Ei(r,1,`toast svelte-1a0rutm`,null,i,{error:W(n).kind===`error`,success:W(n).kind===`success`,warning:W(n).kind===`warning`}),Z(r,`role`,W(n).kind===`error`?`alert`:`status`),Z(r,`aria-live`,W(n).kind===`error`?`assertive`:`polite`),J(o,W(n).kind===`error`||W(n).kind===`warning`?`!`:W(n).kind===`success`?`✓`:`i`),J(l,W(n).kind===`error`?`Error`:W(n).kind===`success`?`Success`:W(n).kind===`warning`?`Warning`:`Info`),J(d,W(n).message),Z(m,`aria-label`,`Dismiss ${W(n).kind} notification`)}),Br(`pointerenter`,r,()=>t.queue.pause(W(n).id,`hover`)),Br(`pointerleave`,r,()=>t.queue.resume(W(n).id,`hover`)),G(`focusin`,r,()=>t.queue.pause(W(n).id,`focus`)),G(`focusout`,r,()=>t.queue.resume(W(n).id,`focus`)),G(`click`,m,()=>t.queue.dismiss(W(n).id)),q(e,r)}),P(i),q(e,i),$e()}Vr([`focusin`,`focusout`,`click`]);var cC=K(`<main class="evidence-page svelte-1j55xyh"><h1 class="svelte-1j55xyh">Git repository</h1> <p>Choose a destination and clone a repository.</p> <div class="evidence-composer svelte-1j55xyh"><label for="evidence-prompt">Prompt</label> <textarea id="evidence-prompt" class="evidence-prompt svelte-1j55xyh" rows="1">Review repository status</textarea></div></main> <nav class="evidence-nav svelte-1j55xyh" aria-label="Primary evidence navigation"><button type="button" class="svelte-1j55xyh">Sessions</button> <button type="button" aria-pressed="true" class="svelte-1j55xyh">Git</button> <button type="button" class="svelte-1j55xyh">Chat</button></nav> <!>`,1);function lC(e,t){I(t,!0);let n=tC();Yi(()=>{t.variant===`stacked`&&n.enqueue({kind:`success`,message:`Cloned.`}),n.enqueue({kind:`error`,code:`GIT_CLONE_FAILED`,message:`Clone failed.`})});var r=cC();sC(H(V(r),4),{get queue(){return n}}),q(e,r),$e()}var uC={sessionBase:()=>!0,gitRepositoryTarget:e=>e.isGitRepository,cloneDestination:e=>!e.isGitRepository};function dC(e){let t=new Set,n=(e,r)=>{!e.isGitRepository&&r===1&&t.add(e.id),e.children.forEach(e=>n(e,r+1))};return e.forEach(e=>n(e,1)),t}function fC(e,t){let n=new Set(e);return t.isGitRepository||(n.has(t.id)?n.delete(t.id):n.add(t.id)),n}function pC(e,t){let n=[],r=(e,i,a)=>{n.push({node:e,level:i,parentId:a}),!e.isGitRepository&&t.has(e.id)&&e.children.forEach(t=>r(t,i+1,e.id))};return e.forEach(e=>r(e,1,null)),n}function mC(e,t){let n=(e,r)=>{if(e.id===t)return r;for(let t of e.children){let i=n(t,[...r,e.id]);if(i)return i}return null};for(let t of e){let e=n(t,[]);if(e)return e}return[]}function hC(e,t){for(let n of e){if(n.id===t)return n;let e=hC(n.children,t);if(e)return e}}function gC(e,t,n,r){if(e){let i=hC(n,e);if(i&&r(i))return i.id;let a=mC(t,e);for(let e of a.toReversed()){let t=hC(n,e);if(t&&r(t))return t.id}}return _C(n).find(r)?.id??null}function _C(e){let t=[],n=e=>{t.push(e),e.children.forEach(n)};return e.forEach(n),t}var vC=K(`<button class="disclosure svelte-6z3q4v" type="button" tabindex="-1"><span aria-hidden="true"> </span></button>`),yC=K(`<span class="disclosure-spacer svelte-6z3q4v" aria-hidden="true"></span>`),bC=K(`<span class="repository-badge svelte-6z3q4v">Git</span>`),xC=K(`<div class="tree-row svelte-6z3q4v"><!> <button type="button" role="treeitem"><span class="selection-mark svelte-6z3q4v" aria-hidden="true"> </span> <span class="node-copy svelte-6z3q4v"><span class="node-name svelte-6z3q4v"> </span> <span class="node-path svelte-6z3q4v"> </span></span> <!></button></div>`),SC=K(`<div class="filesystem-tree svelte-6z3q4v" role="tree"></div>`);function CC(e,t){I(t,!0);let n=Q(t,`isSelectable`,3,()=>!0),r=R(null),i=cn({}),a,o=L(()=>pC(t.roots,t.expandedIds)),s=L(()=>W(r)&&W(o).some(({node:e})=>e.id===W(r))?W(r):t.selectedId&&W(o).some(({node:e})=>e.id===t.selectedId)?t.selectedId:W(o)[0]?.node.id??null);Pn(()=>{let e=t.selectedId,n=e?hC(t.roots,e):void 0;if(!e||!n||n===a)return;a=n;let r=mC(t.roots,e);jr(()=>{let e=new Set(t.expandedIds);r.forEach(t=>e.add(t)),e.size!==t.expandedIds.size&&t.onexpandedchange(e)})}),Pn(()=>{let e=t.selectedId,n=e?i[e]:void 0;n&&jr(()=>{z(r,e,!0),n.focus({preventScroll:!0}),n.scrollIntoView?.({block:`nearest`,inline:`nearest`})})});function c(e){return!e.isGitRepository&&e.children.length>0}function l(e){return e===`.`?`~/`:`~/${e}`}function u(e){z(r,e,!0),i[e]?.focus()}function d(e,t){let n=Math.max(0,Math.min(W(o).length-1,t)),r=W(o)[n];r&&n!==e&&u(r.node.id)}function f(e){n()(e)&&t.onselect(e)}function p(e){c(e)&&t.onexpandedchange(fC(t.expandedIds,e))}function m(e,n,r){let{node:i,parentId:a}=n;switch(e.key){case`ArrowUp`:e.preventDefault(),d(r,r-1);break;case`ArrowDown`:e.preventDefault(),d(r,r+1);break;case`ArrowRight`:if(!c(i))return;e.preventDefault(),t.expandedIds.has(i.id)?W(o)[r+1]?.parentId===i.id&&d(r,r+1):p(i);break;case`ArrowLeft`:if(!t.expandedIds.has(i.id)&&!a)return;e.preventDefault(),c(i)&&t.expandedIds.has(i.id)?p(i):a&&u(a);break;case`Home`:e.preventDefault(),d(r,0);break;case`End`:e.preventDefault(),d(r,W(o).length-1);break;case`Enter`:case` `:e.preventDefault(),f(i);break}}var h=SC();X(h,23,()=>W(o),e=>e.node.id,(e,a,o)=>{let u=L(()=>W(a).node),d=L(()=>c(W(u)));var h=xC();let g;var _=B(h),v=e=>{var n=vC(),r=B(n),i=B(r,!0);P(r),P(n),U((e,t)=>{Z(n,`aria-label`,e),J(i,t)},[()=>`${t.expandedIds.has(W(u).id)?`Collapse`:`Expand`} ${W(u).name}`,()=>t.expandedIds.has(W(u).id)?`−`:`+`]),G(`click`,n,()=>p(W(u))),q(e,n)},y=e=>{q(e,yC())};Y(_,e=>{W(d)?e(v):e(y,-1)});var b=H(_,2);let x;var S=B(b),C=B(S,!0);P(S);var w=H(S,2),T=B(w),E=B(T,!0);P(T);var D=H(T,2),O=B(D,!0);P(D),P(w);var k=H(w,2),ee=e=>{q(e,bC())};Y(k,e=>{W(u).isGitRepository&&e(ee)}),P(b),qi(b,(e,t)=>i[t.id]=e,e=>i?.[e.id],()=>[W(u)]),P(h),U((e,n,r,i,o)=>{g=Oi(h,``,g,e),x=Ei(b,1,`tree-item svelte-6z3q4v`,null,x,{selected:t.selectedId===W(u).id,repository:W(u).isGitRepository}),Z(b,`aria-level`,W(a).level),Z(b,`aria-expanded`,n),Z(b,`aria-selected`,t.selectedId===W(u).id),Z(b,`aria-disabled`,r),Z(b,`tabindex`,W(s)===W(u).id?0:-1),Z(b,`title`,i),J(C,t.selectedId===W(u).id?`✓`:``),J(E,W(u).name),J(O,o)},[()=>({"--tree-level":Math.min(W(a).level-1,6)}),()=>W(d)?t.expandedIds.has(W(u).id):void 0,()=>!n()(W(u)),()=>l(W(u).relativePath),()=>l(W(u).relativePath)]),Br(`focus`,b,()=>z(r,W(u).id,!0)),G(`keydown`,b,e=>m(e,W(a),W(o))),G(`click`,b,()=>f(W(u))),q(e,h)}),P(h),U(()=>Z(h,`aria-label`,t.label)),q(e,h),$e()}Vr([`click`,`keydown`]);var wC=K(`<section class="evidence-shell svelte-1d6w4ti" aria-labelledby="evidence-title"><p class="eyebrow svelte-1d6w4ti"> </p> <h1 id="evidence-title" class="svelte-1d6w4ti"> </h1> <p class="instructions svelte-1d6w4ti"> </p> <!></section>`);function TC(e,t){I(t,!0);let n=(e,t)=>({id:e,name:t,relativePath:e,isGitRepository:!0,children:[]}),r=[{id:`.`,name:`development-workspace-with-a-long-name`,relativePath:`.`,isGitRepository:!1,children:[{id:`dyne`,name:`dyne`,relativePath:`dyne`,isGitRepository:!1,children:[{id:`dyne/mobile-applications`,name:`mobile-applications-and-experiments`,relativePath:`dyne/mobile-applications`,isGitRepository:!1,children:[n(`dyne/mobile-applications/gestalt-mobile`,`gestalt-mobile-with-an-extraordinarily-long-repository-name`)]},n(`dyne/zenroom`,`zenroom`),n(`dyne/zenflows`,`zenflows`),n(`dyne/did`,`did-toolkit`),n(`dyne/api`,`api-gateway`),n(`dyne/docs`,`documentation-portal`)]},{id:`personal`,name:`personal-projects`,relativePath:`personal`,isGitRepository:!1,children:[]}]}],i=R(cn(new Set([`.`,`dyne`,`dyne/mobile-applications`]))),a=R(null),o=L(()=>t.context===`sessions`?`dyne/mobile-applications`:`dyne/mobile-applications/gestalt-mobile`),s=L(()=>W(a)??W(o));var c=wC(),l=B(c),u=B(l,!0);P(l);var d=H(l,2),f=B(d,!0);P(d);var p=H(d,2),m=B(p,!0);P(p);var h=H(p,2);{let e=L(()=>t.context===`sessions`?`Session base`:`Git repository`),n=L(()=>t.context===`sessions`?uC.sessionBase:uC.gitRepositoryTarget);CC(h,{get roots(){return r},get expandedIds(){return W(i)},get selectedId(){return W(s)},get label(){return W(e)},get isSelectable(){return W(n)},onexpandedchange:e=>z(i,e,!0),onselect:e=>z(a,e.id,!0)})}P(c),U(()=>{J(u,t.context===`sessions`?`Sessions`:`Git`),J(f,t.context===`sessions`?`Session base`:`Git repository`),J(m,t.context===`sessions`?`Select the folder Codex should use as its working directory.`:`Select a repository for Git actions.`)}),q(e,c),$e()}var EC=`gestalt.filesystem-tree.selection`;function DC(e,t=null){try{let t=localStorage.getItem(EC);if(t&&hC(e,t))return t}catch{}return t&&hC(e,t)?t:null}function OC(e){try{e?localStorage.setItem(EC,e):localStorage.removeItem(EC)}catch{}}function kC(e){return e.branch===null?{enabled:!1,reason:`Select a local branch to push.`}:e.upstream?(e.behind??0)>0?{enabled:!1,reason:`Pull upstream changes before pushing.`}:e.ahead<1?{enabled:!1,reason:`There are no commits to push.`}:{enabled:!0,reason:null}:e.branch?e.originUrl?{enabled:!0,reason:null}:{enabled:!1,reason:`No origin remote is configured.`}:{enabled:!1,reason:`Select a local branch to push.`}}function AC(e,t=Date.now()){if(!e)return`Not fetched yet`;let n=Math.max(0,t-new Date(e).getTime()),r=Math.floor(n/6e4);if(r<1)return`Fetched just now`;if(r<60)return`Fetched ${r}m ago`;let i=Math.floor(r/60);return i<24?`Fetched ${i}h ago`:`Fetched ${Math.floor(i/24)}d ago`}function jC(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return`unknown time`;let r=Math.round((n-t)/1e3),i=[[`year`,31536e3],[`month`,2592e3],[`week`,604800],[`day`,86400],[`hour`,3600],[`minute`,60],[`second`,1]],[a,o]=i.find(([,e])=>Math.abs(r)>=e)??i.at(-1);return new Intl.RelativeTimeFormat(void 0,{numeric:`auto`}).format(Math.round(r/o),a)}var MC=K(`<p class="clone-status svelte-pudr3t" role="status"> </p>`),NC=K(`<option> </option>`),PC=K(`<p class="svelte-pudr3t"> </p>`),FC=K(`<p id="git-push-help" class="action-help svelte-pudr3t"> </p>`),IC=K(`<section aria-label="Confirm push"><p> </p> <button type="button"> </button> <button type="button">Cancel</button></section>`),LC=K(`<li class="commit-entry svelte-pudr3t"><div class="commit-subject svelte-pudr3t"><code class="svelte-pudr3t"> </code><span> </span></div> <div class="commit-meta svelte-pudr3t"><span> </span><time class="svelte-pudr3t"> </time></div></li>`),RC=K(`<section class="commit-history svelte-pudr3t" aria-labelledby="recent-commits-title"><h3 id="recent-commits-title" class="svelte-pudr3t">Recent commits</h3> <ol class="commit-list svelte-pudr3t" aria-label="Recent commits"></ol></section>`),zC=K(`<div class="git-overview svelte-pudr3t"><div class="git-status svelte-pudr3t"><label for="git-branch">Branch</label> <select id="git-branch"></select> <p class="svelte-pudr3t"> </p> <!> <p class="svelte-pudr3t"><time> </time></p> <p class="svelte-pudr3t"> </p></div> <div class="git-actions svelte-pudr3t"><button type="button" class="svelte-pudr3t"><span aria-hidden="true">↑</span> Push</button> <button type="button" class="svelte-pudr3t"><span aria-hidden="true">↓</span> </button> <!></div></div> <!> <!>`,1),BC=K(`<p>This workspace is not a Git repository.</p>`),VC=K(`<p role="status">Loading repository status…</p>`),HC=K(`<p><strong> </strong> is available as a Clone destination. Select a Git repository
|
|
155
|
-
to inspect branches and enable repository actions.</p> <div class="git-actions svelte-pudr3t" aria-label="Repository actions unavailable"><button type="button" disabled="" class="svelte-pudr3t"><span aria-hidden="true">↑</span> Push</button> <button type="button" disabled="" class="svelte-pudr3t"><span aria-hidden="true">↓</span> Pull</button></div>`,1),UC=K(`<p>Select a folder above to choose a Clone destination or inspect a Git repository.</p> <div class="git-actions svelte-pudr3t" aria-label="Repository actions unavailable"><button type="button" disabled="" class="svelte-pudr3t"><span aria-hidden="true">↑</span> Push</button> <button type="button" disabled="" class="svelte-pudr3t"><span aria-hidden="true">↓</span> Pull</button></div>`,1),WC=K(`<p role="alert"> </p>`),GC=K(`<section class="git-view svelte-pudr3t" aria-labelledby="git-title"><h2 id="git-title" class="visually-hidden">Git</h2> <section class="git-tree svelte-pudr3t" aria-labelledby="git-tree-title"><div class="section-heading svelte-pudr3t"><h3 id="git-tree-title" class="svelte-pudr3t">Repository and clone destination</h3> <p class="svelte-pudr3t">Select any folder. Git repositories enable repository actions; other folders are clone
|
|
156
|
-
destinations.</p></div> <!> <button id="browse-files" type="button" class="svelte-pudr3t">Browse files</button></section> <form class="clone-form svelte-pudr3t"><div class="clone-controls svelte-pudr3t"><div class="clone-field svelte-pudr3t"><label for="git-clone-address" class="svelte-pudr3t">Git address</label> <input id="git-clone-address" name="address" autocomplete="url" inputmode="url" enterkeyhint="done" aria-describedby="clone-help"/></div> <button type="submit" class="svelte-pudr3t"> </button></div> <p id="clone-help" class="svelte-pudr3t"> </p> <!></form> <section class="repository-details svelte-pudr3t" aria-labelledby="repository-details-title"><h3 id="repository-details-title" class="svelte-pudr3t">Repository details</h3> <!> <!></section></section>`);function KC(e,t){I(t,!0);let n=Q(t,`pushing`,3,!1),r=R(``),i=L(()=>t.selectedWorkspace&&!t.selectedWorkspace.isGitRepository?t.selectedWorkspace:null),a=L(()=>!!t.selectedWorkspace?.isGitRepository),o=L(()=>W(a)?t.summary?.originUrl??``:W(r)),s=L(()=>t.summary?kC(t.summary):{enabled:!1,reason:null});function c(e){e.preventDefault(),!(!W(i)||!W(r).trim()||t.cloning)&&t.onclone(W(r).trim())}var l=GC(),u=H(B(l),2),d=H(B(u),2);{let e=L(()=>t.selectedWorkspace?.id??null);CC(d,{get roots(){return t.workspaceTree},get expandedIds(){return t.expandedIds},get selectedId(){return W(e)},label:`Git repository and clone destination`,get onexpandedchange(){return t.onexpandedchange},get onselect(){return t.onselect}})}var f=H(d,2);P(u);var p=H(u,2),m=B(p),h=B(m),g=H(B(h),2);Li(g),P(h);var _=H(h,2),v=B(_,!0);P(_),P(m);var y=H(m,2),b=B(y,!0);P(y);var x=H(y,2),S=e=>{var n=MC(),r=B(n,!0);P(n),U(()=>J(r,t.cloneStatus)),q(e,n)};Y(x,e=>{t.cloneStatus&&e(S)}),P(p);var C=H(p,2),w=H(B(C),2),T=e=>{var r=Yr(),i=V(r),a=e=>{var r=Yr(),i=V(r),a=e=>{var r=zC(),i=V(r),a=B(i),o=H(B(a),2);X(o,20,()=>t.summary.branches??[],e=>e,(e,t)=>{var n=NC(),r=B(n,!0);P(n);var i={};U(()=>{J(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),q(e,n)}),P(o);var c;Ai(o);var l=H(o,2),u=B(l);P(l);var d=H(l,2),f=e=>{var n=PC(),r=B(n);P(n),U(()=>J(r,`Ahead ${t.summary.ahead??``}; behind ${t.summary.behind??``}.`)),q(e,n)};Y(d,e=>{t.summary.upstream&&e(f)});var p=H(d,2),m=B(p),h=B(m,!0);P(m),P(p);var g=H(p,2),_=B(g);P(g),P(a);var v=H(a,2),y=B(v),b=H(y,2),x=H(B(b));P(b);var S=H(b,2),C=e=>{var t=FC(),n=B(t,!0);P(t),U(()=>J(n,W(s).reason)),q(e,t)};Y(S,e=>{!W(s).enabled&&W(s).reason&&e(C)}),P(v),P(i);var w=H(i,2),T=e=>{var r=IC(),i=B(r),a=B(i,!0);P(i);var o=H(i,2),s=B(o,!0);P(o);var c=H(o,2);P(r),U(()=>{J(a,t.summary.upstream?`Push ${t.summary.branch??`HEAD`} to ${t.summary.upstream}?`:`Publish ${t.summary.branch} to origin and set its upstream?`),o.disabled=n(),J(s,n()?`Pushing…`:`Confirm push`),c.disabled=n()}),G(`click`,o,function(...e){t.onpush?.apply(this,e)}),G(`click`,c,function(...e){t.oncancelpush?.apply(this,e)}),q(e,r)};Y(w,e=>{t.confirmingPush&&e(T)});var E=H(w,2),D=e=>{var n=RC(),r=H(B(n),2);X(r,21,()=>t.summary.commits,e=>e.hash,(e,t)=>{var n=LC(),r=B(n),i=B(r),a=B(i,!0);P(i);var o=H(i),s=B(o,!0);P(o),P(r);var c=H(r,2),l=B(c),u=B(l,!0);P(l);var d=H(l),f=B(d,!0);P(d),P(c),P(n),U(e=>{Z(i,`title`,W(t).hash),J(a,W(t).shortHash),J(s,W(t).subject),J(u,W(t).author),Z(d,`datetime`,W(t).authoredAt),Z(d,`title`,W(t).authoredAt),J(f,e)},[()=>jC(W(t).authoredAt)]),q(e,n)}),P(r),P(n),q(e,n)};Y(E,e=>{t.summary.commits.length&&e(D)}),U(e=>{o.disabled=t.refreshing||t.checkingOut||!t.summary.branches?.length,c!==(c=t.summary.branch??``)&&(o.value=(o.__value=t.summary.branch??``)??``,ki(o,t.summary.branch??``)),J(u,`Upstream: ${t.summary.upstream??`not configured`??``}`),Z(m,`datetime`,t.summary.fetchedAt??void 0),J(h,e),J(_,`Changes: ${t.summary.dirty.staged??``} staged, ${t.summary.dirty.unstaged??``} unstaged, ${t.summary.dirty.untracked??``} untracked.`),y.disabled=t.refreshing||t.checkingOut||n()||!W(s).enabled,Z(y,`aria-describedby`,W(s).enabled?void 0:`git-push-help`),b.disabled=t.refreshing||t.checkingOut||n()||!t.summary.upstream,J(x,` ${t.refreshing?`Pulling…`:`Pull`}`)},[()=>AC(t.summary.fetchedAt)]),G(`change`,o,e=>t.oncheckout(e.currentTarget.value)),G(`click`,y,function(...e){t.onopenpushconfirmation?.apply(this,e)}),G(`click`,b,function(...e){t.onpull?.apply(this,e)}),q(e,r)},o=e=>{q(e,BC())};Y(i,e=>{t.summary.available?e(a):e(o,-1)}),q(e,r)},o=e=>{q(e,VC())};Y(i,e=>{t.summary?e(a):t.error||e(o,1)}),q(e,r)},E=e=>{var n=HC(),r=V(n),i=B(r),a=B(i,!0);P(i),F(),P(r),F(2),U(()=>J(a,t.selectedWorkspace.name)),q(e,n)},D=e=>{var t=UC();F(2),q(e,t)};Y(w,e=>{t.selectedWorkspace?.isGitRepository?e(T):t.selectedWorkspace?e(E,1):e(D,-1)});var O=H(w,2),k=e=>{var n=WC(),r=B(n,!0);P(n),U(()=>J(r,t.error)),q(e,n)};Y(O,e=>{t.error&&e(k)}),P(C),P(l),U(e=>{f.disabled=!t.selectedWorkspace,Ri(g,W(o)),g.readOnly=W(a),g.required=!W(a),Z(g,`placeholder`,W(a)?`No origin remote`:`https://example.com/owner/repository.git`),_.disabled=e,J(v,t.cloning?`Cloning…`:`Clone`),J(b,W(a)?t.summary?.originUrl?`Origin remote. Select a folder to clone another repository.`:`No origin remote is configured for this repository.`:t.selectedWorkspace?`Clone into ${t.selectedWorkspace.name}.`:`Select a folder to clone a repository.`)},[()=>t.cloning||!W(i)||!W(r).trim()]),G(`click`,f,e=>t.onbrowsefiles(e.currentTarget)),Br(`submit`,p,c),G(`input`,g,e=>z(r,e.currentTarget.value,!0)),q(e,l),$e()}Vr([`click`,`input`,`change`]);var qC=class{transport;isRepository;onChange;errorMessage;#e={workspaceId:null,summary:null,loading:!1,refreshing:!1,checkingOut:!1,error:null};#t=0;#n=null;#r=!1;constructor(e,t,n,r){this.transport=e,this.isRepository=t,this.onChange=n,this.errorMessage=r}get state(){return this.#e}select(e){this.#a();let t=e,n=!!(t&&this.isRepository(t));this.#s({workspaceId:t,summary:null,loading:n,refreshing:!1,checkingOut:!1,error:null}),n&&this.refresh()}async refresh(){let e=this.#e.workspaceId;if(!e||!this.isRepository(e))return;let t=this.#i(),n=this.#t;this.#s({...this.#e,loading:!0,error:null});try{let r=await this.transport.getSummary(e,t.signal);this.#o(n,e,t)&&this.#s({...this.#e,summary:r,loading:!1})}catch(r){this.#o(n,e,t)&&!t.signal.aborted&&this.#s({...this.#e,summary:null,loading:!1,error:this.errorMessage(r,`GIT_SUMMARY_FAILED`)})}}async pull(e){let t=this.#e.workspaceId;if(!t||this.#e.refreshing)return;let n=this.#i(),r=this.#t;this.#s({...this.#e,refreshing:!0,error:null});try{await this.transport.pull(t,e,n.signal),this.#o(r,t,n)&&(this.#s({...this.#e,refreshing:!1}),await this.refresh())}catch(e){this.#o(r,t,n)&&!n.signal.aborted&&this.#s({...this.#e,refreshing:!1,error:this.errorMessage(e,`GIT_PULL_FAILED`)})}}async checkout(e){let t=this.#e.workspaceId;if(!t||this.#e.checkingOut||e===this.#e.summary?.branch)return;let n=this.#i(),r=this.#t;this.#s({...this.#e,checkingOut:!0,error:null});try{await this.transport.checkout(t,e,n.signal),this.#o(r,t,n)&&(this.#s({...this.#e,checkingOut:!1}),await this.refresh())}catch(e){this.#o(r,t,n)&&!n.signal.aborted&&this.#s({...this.#e,checkingOut:!1,error:this.errorMessage(e,`GIT_CHECKOUT_FAILED`)})}}dispose(){this.#r=!0,this.#a()}#i(){return this.#a(),this.#n=new AbortController,++this.#t,this.#n}#a(){this.#n?.abort(),this.#n=null,++this.#t}#o(e,t,n){return!this.#r&&e===this.#t&&this.#e.workspaceId===t&&this.#n===n}#s(e){this.#r||(this.#e=e,this.onChange(e))}};function JC(e,t,n,r,i){let a=new Set(YC(e).filter(e=>e.isGitRepository).map(e=>e.id)),o=hC(t,n),s=o?YC(o.children).filter(e=>e.isGitRepository&&!a.has(e.id)):[],c=XC(r),l=s.find(e=>e.name===c)??(s.length===1?s[0]:void 0),u=l?.id??o?.id??null,d=new Set(i);return u&&mC(t,u).forEach(e=>d.add(e)),!l&&o&&d.add(o.id),{selectedId:u,expandedIds:d}}function YC(e){let t=[],n=e=>{t.push(e),e.children.forEach(n)};return e.forEach(n),t}function XC(e){return(e.trim().replace(/[?#].*$/,``).replace(/\/+$/,``).split(/[/:]/).at(-1)??``).replace(/\.git$/i,``)}function ZC(e){if(typeof e!=`object`||!e)return null;let t=e.permissions;if(typeof t!=`object`||!t)return null;let n=t;return{permissions:{...n.network===null||n.network===void 0?{}:{network:n.network},...n.fileSystem===null||n.fileSystem===void 0?{}:{fileSystem:n.fileSystem}},scope:`turn`}}function QC(e){return{answers:Object.fromEntries(e.filter(e=>e.answer.trim()).map(e=>[e.id,{answers:[e.answer]}]))}}var $C=kf().min(1).max(1024);pp({reference:_p(`kind`,[pp({kind:Cp(`workspace`),workspaceId:$C,planName:$C}).strict(),pp({kind:Cp(`session`),sessionId:$C,planName:$C}).strict(),pp({kind:Cp(`retained-session`),sessionId:$C}).strict()]),expectedRevision:$C,skillProfile:kf().max(256).optional(),replaceSessionId:$C.optional(),launchId:kf().min(1).max(256)}).strict();var ew=_p(`kind`,[pp({kind:Cp(`blocked`),code:xp([`CONTEXT_CHANGED`,`ACTIVE_SUPERVISION`,`WORKSPACE_BUSY`]),reason:kf().min(1),existingSessionId:$C.optional()}).strict(),pp({kind:Cp(`rejected`),code:Cp(`LAUNCH_CONFLICT`),reason:kf().min(1)}).strict()]),tw=pp({kind:Cp(`rejected`),code:Cp(`INVALID_LAUNCH_REQUEST`),reason:kf().min(1)}).strict();function nw(e=fetch){async function t(e){let t=await e.json().catch(()=>null),n=typeof t?.code==`string`&&/^[A-Z0-9_]+$/.test(t.code)?t.code:void 0,r=n?.startsWith(`AUTOPILOT_`)&&e.status===409?`Relay request failed (${e.status}).`:typeof t?.detail==`string`&&t.detail.length<=600?t.detail:typeof t?.title==`string`?t.title:`Relay request failed (${e.status}).`;return Object.assign(Error(r),{...n?{code:n}:{},...typeof t?.replaceAllowed==`boolean`?{replaceAllowed:t.replaceAllowed}:{},status:e.status,...typeof t?.sessionId==`string`?{sessionId:t.sessionId}:{}})}async function n(n,r,i={},a){let o=await e(n,{method:`POST`,headers:{"content-type":`application/json`,...i},body:JSON.stringify(r),signal:a});if(!o.ok)throw await t(o);return o.json()}async function r(n,r,i={}){let a=await e(n,{method:`PUT`,headers:{"content-type":`application/json`,...i},body:JSON.stringify(r)});if(!a.ok)throw await t(a);return a.json()}async function i(n,r,i,a){let o=await e(n,{method:`PUT`,headers:{"content-type":`application/octet-stream`,"idempotency-key":i},body:r,signal:a});if(!o.ok)throw await t(o);return o.json()}async function a(n,r,i){let a=await e(n,{method:`DELETE`,headers:{"content-type":`application/json`,"idempotency-key":i},body:JSON.stringify(r)});if(!a.ok)throw await t(a);return a.json()}async function o(n){let r=await e(n,{method:`DELETE`});if(!r.ok)throw await t(r)}async function s(n,r){let i=await e(n,r?{signal:r}:void 0);if(!i.ok)throw await t(i);return i.json()}async function c(n,r){let i=await e(n,{signal:r});if(i.status===204)return null;if(!i.ok)throw await t(i);return i.json()}return{debugConfirmation:(e,t)=>s(`/api/sessions/${encodeURIComponent(e)}/debug${t?`?attentionRequestId=${encodeURIComponent(t)}`:``}`),startSelfDebug:(e,t)=>n(`/api/sessions/${encodeURIComponent(e)}/debug`,{confirmationId:t}),readDebugTrace:(e,t)=>s(`/api/sessions/${encodeURIComponent(e)}/debug/trace`,t),quit:()=>n(`/api/maintenance/quit`,{}),upgrade:()=>n(`/api/maintenance/upgrade`,{}),cleanTmp:()=>n(`/api/maintenance/clean-tmp`,{}),upgradeStatus:e=>s(`/api/maintenance/upgrade`,e),listSessions:e=>s(`/api/sessions`,e),checkWorkspaceFileReferences:(e,t,r)=>n(`/api/workspaces/${encodeURIComponent(e)}/files/references`,{paths:t},{},r),getSessionFilePreview:(e,t,n)=>s(`/api/sessions/${encodeURIComponent(e)}/files/preview?${new URLSearchParams({path:t})}`,n),getWorkspaceFilePreview:(e,t,n)=>s(`/api/workspaces/${encodeURIComponent(e)}/files/preview?${new URLSearchParams({path:t})}`,n),listWorkspaceDirectory:(e,t={},n)=>{let r=new URLSearchParams;t.directory!==void 0&&r.set(`directory`,t.directory),t.cursor!==void 0&&r.set(`cursor`,t.cursor),t.limit!==void 0&&r.set(`limit`,String(t.limit));let i=r.size===0?``:`?${r}`;return s(`/api/workspaces/${encodeURIComponent(e)}/files${i}`,n)},copyWorkspaceEntry:(e,t,r)=>n(`/api/workspaces/${encodeURIComponent(e)}/files/copy`,t,{"idempotency-key":r}),moveWorkspaceEntry:(e,t,r)=>n(`/api/workspaces/${encodeURIComponent(e)}/files/move`,t,{"idempotency-key":r}),uploadWorkspaceFile:(e,t,n,r)=>{let a=new URLSearchParams({directory:t.directory,filename:t.filename,conflict:t.conflict});return i(`/api/workspaces/${encodeURIComponent(e)}/files/upload?${a}`,t.file,n,r)},createWorkspaceDirectory:(e,t,r)=>n(`/api/workspaces/${encodeURIComponent(e)}/files/directories`,t,{"idempotency-key":r}),deleteWorkspaceEntry:(e,t,n)=>a(`/api/workspaces/${encodeURIComponent(e)}/files`,{path:t,recursive:!0},n),getSession:e=>s(`/api/sessions/${encodeURIComponent(e)}`),refreshActivity:e=>n(`/api/sessions/${encodeURIComponent(e)}/activity/refresh`,{}),setAutopilot:(e,t,n)=>r(`/api/sessions/${encodeURIComponent(e)}/autopilot`,{enabled:t},n?{"idempotency-key":n}:{}),resolveAttention:(e,t,r)=>n(`/api/sessions/${encodeURIComponent(e)}/attention/${encodeURIComponent(t)}/resolve`,r),listRecentSessions:()=>s(`/api/sessions/recent-threads`),openRecentSession:(e,t,r=`codex`)=>n(`/api/sessions/recent-threads/open`,{threadId:e,cwd:t,provider:r}),listSessionModels:e=>n(`/api/session-models/${encodeURIComponent(e)}`,{}),startSession:(e,t={},r)=>n(`/api/sessions`,{workspaceId:e,profile:`default`,provider:`codex`,...t},r?{"idempotency-key":r}:{}),prepareOrgPlanSupervision:async(n,r,i,a)=>{let o=await e(`/api/plans/prepare`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({...n,expectedRevision:r,skillProfile:i}),signal:a});if(o.ok||o.status===409)return o.json();throw await t(o)},startOrgPlanSupervision:async n=>{let r=await e(`/api/plans/execute`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n)});if(r.ok)return r.json();if(r.status===409||r.status===400){let e=await r.clone().json().catch(()=>null),t=(r.status===409?ew:tw).safeParse(e);if(t.success)return t.data}throw await t(r)},startTurn:(e,t,r)=>n(`/api/sessions/${encodeURIComponent(e)}/turns`,{text:t},r?{"idempotency-key":r}:{}),selectModel:(e,t)=>n(`/api/sessions/${encodeURIComponent(e)}/model`,{model:t}),interruptTurn:(e,t)=>n(`/api/sessions/${encodeURIComponent(e)}/turns/${encodeURIComponent(t)}/interrupt`,{}),queueTurnInput:(e,t,r,i)=>n(`/api/sessions/${encodeURIComponent(e)}/turns/${encodeURIComponent(t)}/queue`,{text:r},i?{"idempotency-key":i}:{}),restoreSession:e=>n(`/api/sessions/${encodeURIComponent(e)}/restore`,{}),releaseSession:e=>n(`/api/sessions/${encodeURIComponent(e)}/release`,{}),forgetSession:(n,r)=>e(`/api/sessions/${encodeURIComponent(n)}${r?`/keep-temporary-files/`+encodeURIComponent(r):``}`,{method:`DELETE`}).then(async e=>{if(!e.ok)throw await t(e)}),getHistory:async(n,r)=>{let i=await e(`/api/sessions/${encodeURIComponent(n)}/history`,r?{headers:{"x-gestalt-history-attempts":String(r.attempts),"x-gestalt-history-coalesced":String(r.coalesced)}}:void 0);if(!i.ok)throw await t(i);return i.json()},downloadOrgPlan:async(n,r)=>{let i=await e(`/api/plans/download`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(n),signal:r});if(!i.ok)throw await t(i);let a=i.headers.get(`content-disposition`)?.match(/filename\*=UTF-8''([^;]+)/i)?.[1];if(!a)throw Error(`The Org file download did not include a filename.`);return{filename:decodeURIComponent(a),blob:await i.blob()}},getPlan:(e,t)=>c(`/api/sessions/${encodeURIComponent(e)}/plan`,t),closePlan:e=>o(`/api/sessions/${encodeURIComponent(e)}/plan`),listWorkspacePlans:(e,t)=>s(`/api/workspaces/${encodeURIComponent(e)}/plans`,t),archiveWorkspacePlan:(e,t)=>n(`/api/workspaces/${encodeURIComponent(e)}/plans/${encodeURIComponent(t)}/archive`,{}),getWorkspacePlan:(e,t,n)=>s(`/api/workspaces/${encodeURIComponent(e)}/plans/${encodeURIComponent(t)}`,n),openSessionPlan:(e,t)=>r(`/api/sessions/${encodeURIComponent(e)}/plan`,{planName:t}),getGitSummary:(e,t)=>s(`/api/git/repositories/${encodeURIComponent(e)}`,t),cloneGitRepository:(e,t)=>n(`/api/git/clone`,{workspaceId:e,address:t}),refreshGit:(e,t)=>n(`/api/git/repositories/${encodeURIComponent(e)}/refresh`,{},t?{"idempotency-key":t}:{}),pullGit:(e,t,r)=>n(`/api/git/repositories/${encodeURIComponent(e)}/pull`,{},t?{"idempotency-key":t}:{},r),checkoutGitBranch:(e,t,r)=>n(`/api/git/repositories/${encodeURIComponent(e)}/checkout`,{branch:t},{},r),pushGit:(e,t)=>n(`/api/git/repositories/${encodeURIComponent(e)}/push`,{},t?{"idempotency-key":t}:{}),listAvailableSkills:(e,t,n=!1,r)=>s(`/api/skills?${new URLSearchParams({workspaceId:e,profile:t,...n?{refresh:`true`}:{}}).toString()}`,r),listSkillProfiles:e=>s(`/api/skill-profiles`,e),replaceSkillProfile:(e,t)=>r(`/api/skill-profiles/${encodeURIComponent(e)}`,t),deleteSkillProfile:e=>o(`/api/skill-profiles/${encodeURIComponent(e)}`),respondInteraction:(e,t,r,i)=>n(`/api/sessions/${encodeURIComponent(e)}/interactions/${encodeURIComponent(t)}`,r,i?{"idempotency-key":i}:{})}}var rw=[`authoring-start`,`display-open`,`work-start`,`checkpoint`,`update`,`supervision-start`,`resync`];function iw(e){return typeof e==`string`&&(rw.includes(e)||/^review:[A-Za-z0-9._-]{1,128}:REVIEWED$/.test(e)||/^measure:(start|checkpoint|finish):[A-Za-z0-9._-]{1,128}$/.test(e)||/^l2:[A-Za-z0-9._-]{1,128}:(WIP|DONE)$/.test(e))}function aw(e){if(!e||typeof e!=`object`)return!1;let t=e;return ow(t.plan)&&(t.reason===null||iw(t.reason))}function ow(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.title==`string`&&Array.isArray(t.steps)&&typeof t.totalSteps==`number`&&typeof t.doneSteps==`number`&&typeof t.allDone==`boolean`&&typeof t.currentStepId==`string`}function sw(e){return e instanceof Error?e.message:`Could not load the plan.`}function cw(e){return{...e,...e.skills?{skills:[...e.skills]}:{},description:{...e.description},children:e.children.map(cw)}}function lw(e){return{...e,steps:e.steps.map(cw)}}function uw(e,t){return e.kind===`unavailable`&&e.sessionId===t}function dw(e,t){let n=null,r={kind:`unavailable`,sessionId:null},i=0,a=0,o=null,s=0,c=e=>{++a,r=e,t(e)},l=(t,r)=>{o?.abort(),o=new AbortController;let a=++i,l=s;r||c({kind:`loading`,sessionId:t}),e.getPlan(t,o.signal).then(e=>{a!==i||n!==t||s===l&&c(e?{kind:`ready`,sessionId:t,plan:lw(e)}:{kind:`unavailable`,sessionId:t})}).catch(e=>{o?.signal.aborted||a!==i||n!==t||c({kind:`error`,sessionId:t,error:sw(e),...r?{plan:r}:{}})})};return{select(e){if(o?.abort(),n=e,s=0,!e){++i,c({kind:`unavailable`,sessionId:null});return}l(e,void 0)},refresh(e){if(n!==e)return;let t=r.kind===`ready`||r.kind===`closing`||r.kind===`error`?r.plan:void 0;l(e,t)},applyEvent(e,t){if(!(n!==e||t.sequence<=s)){if(t.type===`plan.updated`&&(ow(t.payload)||aw(t.payload))){let n=aw(t.payload)?t.payload.plan:t.payload;s=t.sequence,c({kind:`ready`,sessionId:e,plan:lw(n)})}t.type===`plan.closed`&&(s=t.sequence,c({kind:`unavailable`,sessionId:e}))}},async close(){if(r.kind!==`ready`&&r.kind!==`error`||!r.plan?.allDone)return null;let{sessionId:t,plan:i}=r;c({kind:`closing`,sessionId:t,plan:i});let o=a;try{return await e.closePlan(t),n===t?a===o?(c({kind:`unavailable`,sessionId:t}),`chat`):uw(r,t)?`chat`:null:null}catch(e){return n===t?a===o?(c({kind:`error`,sessionId:t,plan:i,error:sw(e)}),null):uw(r,t)?`chat`:null:null}},dispose(){o?.abort(),o=null,n=null,++i,c({kind:`unavailable`,sessionId:null})}}}function fw(e){if(!e)return null;let t=pw(e.steps,e.currentStepId)?.measurement?.weeklyRemainingCurrent;return typeof t==`number`&&Number.isFinite(t)&&t>=0&&t<=100?Math.round(t):null}function pw(e,t){for(let n of e){if(n.id===t)return n;let e=pw(n.children,t);if(e)return e}}function mw(e){let t=new Set,n=e=>{for(let n of e.matchAll(/=([^=\n]+)=/g)){let e=n[1].trim();e&&t.add(e)}};if(e?.kind===`org-source`)n(e.source);else if(e&&`plan`in e&&e.plan){let t=[...e.plan.steps];for(;t.length;){let e=t.pop();Object.values(e.description).forEach(e=>{e&&n(e)}),t.push(...e.children)}}return[...t]}var hw=K(`<a class="svelte-nywawl"><code class="svelte-nywawl"> </code></a>`),gw=K(`<code class="svelte-nywawl"> </code>`),_w=K(`<span class="notes svelte-nywawl"></span>`);function vw(e,t){I(t,!0);let n=Q(t,`verifiedReferences`,19,()=>new Set),r=L(()=>t.text.split(/(=[^=\n]+=)/g));var i=_w();X(i,21,()=>W(r),ii,(e,r)=>{var i=Yr(),a=V(i),o=e=>{var i=Yr(),a=V(i),o=e=>{var n=hw(),i=B(n),a=B(i,!0);P(i),P(n),U((e,t)=>{Z(n,`href`,e),J(a,t)},[()=>`#file-preview=${encodeURIComponent(W(r).slice(1,-1).trim())}`,()=>W(r).slice(1,-1)]),G(`click`,n,e=>{e.preventDefault(),t.onreference?.(W(r).slice(1,-1).trim())}),q(e,n)},s=L(()=>t.onreference&&n().has(W(r).slice(1,-1).trim())),c=e=>{var t=gw(),n=B(t,!0);P(t),U(e=>J(n,e),[()=>W(r).slice(1,-1)]),q(e,t)};Y(a,e=>{W(s)?e(o):e(c,-1)}),q(e,i)},s=L(()=>W(r).startsWith(`=`)&&W(r).endsWith(`=`)&&W(r).length>2),c=e=>{var t=Jr();U(()=>J(t,W(r))),q(e,t)};Y(a,e=>{W(s)?e(o):e(c,-1)}),q(e,i)}),P(i),q(e,i),$e()}Vr([`click`]);function yw(e,t){return t===void 0?`L${e}`:`L${e}.${t}`}function bw(e){let t=e.steps.filter(e=>e.reviewStatus===`REVIEWED`).length,n=e.steps.length,r=xw(e),i=e.steps.find(e=>e.state===`DONE`&&e.reviewStatus===`UNREVIEWED`);return i?{phase:`awaiting review`,label:`Awaiting ${yw(e.steps.indexOf(i)+1)} review`,current:r,reviewedL1s:t,totalL1s:n}:n>0&&t===n?{phase:`terminal review`,label:`Terminal review`,current:r,reviewedL1s:t,totalL1s:n}:t>0&&!r?{phase:`milestone reported`,label:`Preparing milestone summary`,current:r,reviewedL1s:t,totalL1s:n}:r?.state===`SUSPENDED`?{phase:`suspended`,label:`Resume ${r.position} after dependency review`,current:r,reviewedL1s:t,totalL1s:n}:r?{phase:`implementing`,label:`Implementing ${r.position} ${r.title}`,current:r,reviewedL1s:t,totalL1s:n}:{phase:e.allDone?`terminal review`:`implementing`,label:e.allDone?`Terminal review`:`Implementing`,current:r,reviewedL1s:t,totalL1s:n}}function xw(e){for(let[t,n]of e.steps.entries()){if(n.id===e.currentStepId)return{id:n.id,position:yw(t+1),title:n.title,state:n.state};let r=n.children.findIndex(t=>t.id===e.currentStepId);if(r>=0){let e=n.children[r];return{id:e.id,position:yw(t+1,r+1),title:e.title,state:e.state}}}}var Sw=K(`<span class="wip-effort svelte-hmxg46"> </span>`),Cw=K(`<li class="svelte-hmxg46"><span class="wip-position svelte-hmxg46" aria-hidden="true"> </span> <span class="wip-title svelte-hmxg46"> </span> <!></li>`),ww=K(`<ol class="wip-steps svelte-hmxg46" aria-label="Work in progress plan steps"></ol>`),Tw=K(`<li class="svelte-hmxg46"><span aria-hidden="true" class="position svelte-hmxg46"> </span> <span aria-hidden="true" class="state"> </span></li>`),Ew=K(`<ol class="step-markers svelte-hmxg46" aria-label="Plan step progress"></ol>`),Dw=K(`<div><div class="progress-heading svelte-hmxg46"><span> </span> <span> </span></div> <progress class="svelte-hmxg46"> </progress> <span class="review-status"> </span> <!></div>`);function Ow(e,t){I(t,!0);let n=Q(t,`compact`,3,!1),r=Q(t,`label`,3,`Plan progress`),i=L(()=>t.plan.steps.flatMap((e,t)=>[{id:e.id,position:yw(t+1),state:e.state,level:e.level,title:e.title,...e.description.effort?{effort:e.description.effort}:{}},...e.children.map((e,n)=>({id:e.id,position:yw(t+1,n+1),state:e.state,level:e.level,title:e.title}))])),a=L(()=>W(i).filter(e=>e.state===`WIP`)),o=L(()=>bw(t.plan)),s=L(()=>Math.max(t.plan.totalSteps,1));var c=Dw(),l=B(c),u=B(l),d=B(u);P(u);var f=H(u,2),p=B(f);P(f),P(l);var m=H(l,2),h=B(m);P(m);var g=H(m,2),_=B(g,!0);P(g);var v=H(g,2),y=e=>{var n=ww();X(n,21,()=>W(a),e=>e.id,(e,n)=>{var r=Cw(),i=B(r),a=B(i);P(i);var o=H(i,2),s=B(o,!0);P(o);var c=H(o,2),l=e=>{var t=Sw(),r=B(t);P(t),U(()=>J(r,`Effort: ${W(n).effort??``}`)),q(e,t)};Y(c,e=>{W(n).level===1&&W(n).effort&&e(l)}),P(r),U(()=>{Z(r,`aria-current`,W(n).id===t.plan.currentStepId?`step`:void 0),Z(r,`aria-label`,`${W(n).position}: ${W(n).title}, WIP${W(n).level===1&&W(n).effort?`, effort ${W(n).effort}`:``}`),J(a,`${W(n).position??``} · WIP`),J(s,W(n).title)}),q(e,r)}),P(n),q(e,n)},b=e=>{var n=Ew();X(n,21,()=>W(i),e=>e.id,(e,n)=>{var r=Tw(),i=B(r),a=B(i,!0);P(i);var o=H(i,2),s=B(o,!0);P(o),P(r),U(()=>{Z(r,`data-state`,W(n).state),Z(r,`aria-current`,W(n).id===t.plan.currentStepId?`step`:void 0),Z(r,`aria-label`,`${W(n).position}: ${W(n).state}`),J(a,W(n).position),J(s,W(n).state)}),q(e,r)}),P(n),q(e,n)};Y(v,e=>{n()&&W(a).length?e(y):!n()&&W(i).length&&e(b,1)}),P(c),U(()=>{Ei(c,1,bi([`plan-progress`,{compact:n()}]),`svelte-hmxg46`),J(d,`${t.plan.doneSteps??``} / ${t.plan.totalSteps??``} work items done`),J(p,`· ${W(o).reviewedL1s??``} / ${W(o).totalL1s??``} reviewed`),Z(m,`aria-label`,r()),Ri(m,t.plan.doneSteps),Z(m,`max`,W(s)),J(h,`${t.plan.doneSteps??``} of ${t.plan.totalSteps??``} work items done`),Z(g,`data-phase`,W(o).phase),J(_,W(o).label)}),q(e,c),$e()}var kw=K(`<div class="plan-file-path svelte-ldui1o"><code class="svelte-ldui1o"> </code> <button type="button" aria-label="Copy Org file path" title="Copy Org file path" class="svelte-ldui1o"><svg aria-hidden="true" viewBox="0 0 24 24" class="svelte-ldui1o"><rect x="9" y="9" width="10" height="10" rx="2"></rect><path d="M15 9V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2"></path></svg></button></div>`);function Aw(e,t){I(t,!0);let n=Q(t,`oncopyresult`,3,()=>{});var r=kw(),i=B(r),a=B(i,!0);P(i);var o=H(i,2);P(r),U(()=>J(a,t.path)),G(`click`,o,async()=>n()(await d_(t.path))),q(e,r),$e()}Vr([`click`]);var jw=K(`<section class="svelte-3rmyvg"><h2 class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg">Loading plan…</p></section>`),Mw=K(`<section class="svelte-3rmyvg"><h2 class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg">No retained plan for this session.</p></section>`),Nw=K(`<section class="svelte-3rmyvg"><h2 class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg"> </p></section>`),Pw=K(`<div class="execute-slot svelte-3rmyvg"><!></div>`),Fw=K(`<button type="button" class="svelte-3rmyvg">Full plan</button>`),Iw=K(`<button class="close svelte-3rmyvg">×</button>`),Lw=K(`<p class="svelte-3rmyvg"> </p>`),Rw=K(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Subtitle</dt> <dd class="svelte-3rmyvg"> </dd></div>`),zw=K(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Date</dt> <dd class="svelte-3rmyvg"> </dd></div>`),Bw=K(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Keywords</dt> <dd class="svelte-3rmyvg"> </dd></div>`),Vw=K(`<dl class="metadata svelte-3rmyvg"><!> <!> <!></dl>`),Hw=K(`<p class="svelte-3rmyvg">No plan steps have been retained yet.</p>`),Uw=K(`<span class="svelte-3rmyvg"> </span>`),Ww=K(`<span class="measurement svelte-3rmyvg"> </span>`),Gw=K(`<p class="svelte-3rmyvg"><strong class="svelte-3rmyvg"> </strong> <!></p>`),Kw=K(`<p class="svelte-3rmyvg"><strong class="svelte-3rmyvg">Skills:</strong> </p>`),qw=K(`<li class="svelte-3rmyvg"><details class="svelte-3rmyvg"><summary class="svelte-3rmyvg"><strong class="svelte-3rmyvg"><span class="position svelte-3rmyvg"> </span> </strong> <span class="svelte-3rmyvg"> </span> <!></summary> <!> <!></details></li>`),Jw=K(`<ol class="svelte-3rmyvg"></ol>`),Yw=K(`<li class="svelte-3rmyvg"><details class="svelte-3rmyvg"><summary class="svelte-3rmyvg"><strong class="svelte-3rmyvg"><span class="position svelte-3rmyvg"> </span> </strong> <span class="svelte-3rmyvg"> </span> <!> <!></summary> <!> <!> <!></details></li>`),Xw=K(`<ol class="plan-steps svelte-3rmyvg"></ol>`),Zw=K(`<section><header class="svelte-3rmyvg"><div class="plan-heading svelte-3rmyvg"><h2 class="svelte-3rmyvg"> </h2> <!></div> <!> <!></header> <!> <!> <!> <!> <!></section>`),Qw=K(`<p class="visually-hidden svelte-3rmyvg" aria-live="polite" aria-atomic="true"> </p> <!>`,1);function $w(e,t){let n=Xr();I(t,!0);let r={effort:`Effort`,goal:`Goal`,notes:`Notes`,why:`Why`,change:`Change`,tests:`Tests`,doneWhen:`Done when`},i=Q(t,`onclose`,3,()=>{}),a=Q(t,`closeLabel`,3,`Close plan and return to list`),o=Q(t,`compact`,3,!1),s=Q(t,`verifiedReferences`,19,()=>new Set),c=cn({}),l=null,u=0,d=L(()=>t.state.kind===`ready`||t.state.kind===`closing`||t.state.kind===`error`?t.state.plan:void 0),f=L(()=>W(d)?_(W(d).steps,W(d).currentStepId):void 0),p=L(()=>W(d)?v(W(d).steps,W(d).currentStepId):void 0),m=L(()=>W(d)?bw(W(d)):void 0),h=L(()=>W(d)?y(W(d).steps,W(d).currentStepId):new Set),g=L(()=>t.state.kind===`loading`?`Loading plan.`:t.state.kind===`unavailable`?`No retained plan for this session.`:t.state.kind===`error`&&!W(d)?t.state.error:t.state.kind===`closing`?`Closing completed plan.`:W(d)?W(f)?`${W(m)?.label??`Current step: ${W(p)} ${W(f).title}`}. ${W(d).doneSteps} of ${W(d).totalSteps} work items done.${t.state.kind===`error`?` ${t.state.error}`:``}`:`${W(m)?.label??`Plan progress`}. ${W(d).doneSteps} of ${W(d).totalSteps} work items done.${t.state.kind===`error`?` ${t.state.error}`:``}`:``);Pn(()=>{let e=W(d)?.currentStepId||null;if(!e||l===e)return;let t=l===null;l=e;let n=++u;t||Or().then(()=>{if(!(n!==u||W(d)?.currentStepId!==e)){for(let e of W(h)){let t=c[e];t&&(t.open=!0)}o()||c[e]?.scrollIntoView({behavior:`auto`,block:`nearest`,inline:`nearest`})}})});function _(e,t){for(let n of e){if(n.id===t)return n;let e=_(n.children,t);if(e)return e}}function v(e,t){for(let[n,r]of e.entries()){if(r.id===t)return yw(n+1);let e=r.children.findIndex(e=>e.id===t);if(e>=0)return yw(n+1,e+1)}}function y(e,t,n=[]){for(let r of e){if(r.id===t)return new Set([...n,r.id]);let e=y(r.children,t,[...n,r.id]);if(e.size)return e}return new Set}function b(e){return c[e]?.open??W(h).has(e)}function x(e){return S(e.description.goal??e.description.why??e.title)}function S(e){if(!o())return e;let t=e.replace(/\s+/g,` `).trim();return t.length>120?`${t.slice(0,117)}…`:t}function C(e){let t=e.measurement;if(!t)return`Measurements unavailable`;let n=[];return t.elapsedSeconds!==void 0&&n.push(`${Math.floor(t.elapsedSeconds/60)}m ${t.elapsedSeconds%60}s elapsed`),t.weeklyPercentUsed!==void 0&&n.push(`${t.weeklyPercentUsed}% observed account-wide usage`),t.tokensUsed!==void 0&&n.push(`${t.tokensUsed.toLocaleString()} tokens used`),n.join(` · `)||`Measurements unavailable`}function T(e){return Object.keys(r).flatMap(t=>{let n=e.description[t];return n?[[r[t],n]]:[]})}var E=Qw(),D=V(E),O=B(D,!0);P(D);var k=H(D,2),ee=e=>{var t=jw(),r=B(t);F(2),P(t),U(()=>{Z(t,`aria-labelledby`,n),Z(r,`id`,n)}),q(e,t)},te=e=>{var t=Mw(),r=B(t);F(2),P(t),U(()=>{Z(t,`aria-labelledby`,n),Z(r,`id`,n)}),q(e,t)},ne=e=>{var r=Nw(),i=B(r),a=H(i,2),o=B(a,!0);P(a),P(r),U(()=>{Z(r,`aria-labelledby`,n),Z(i,`id`,n),J(o,t.state.error)}),q(e,r)},re=e=>{var r=Zw();let l;var u=B(r),h=B(u),g=B(h),_=B(g,!0);P(g);var v=H(g,2),y=e=>{{let n=L(()=>W(d).sourcePath||t.sourcePath);Aw(e,{get path(){return W(n)},get oncopyresult(){return t.oncopyresult}})}};Y(v,e=>{!o()&&(W(d).sourcePath||t.sourcePath)&&e(y)}),P(h);var E=H(h,2),D=e=>{var n=Pw();mi(B(n),()=>t.executeAction),P(n),q(e,n)};Y(E,e=>{!o()&&t.executeAction&&e(D)});var O=H(E,2),k=e=>{var n=Yr(),r=V(n),i=e=>{var n=Fw();G(`click`,n,function(...e){t.onopenfull?.apply(this,e)}),q(e,n)};Y(r,e=>{t.onopenfull&&e(i)}),q(e,n)},ee=e=>{var t=Iw();U(()=>Z(t,`aria-label`,a())),G(`click`,t,function(...e){i()?.apply(this,e)}),q(e,t)};Y(O,e=>{o()?e(k):e(ee,-1)}),P(u);var te=H(u,2);Ow(te,{get plan(){return W(d)},get compact(){return o()}});var ne=H(te,2),re=e=>{var t=Lw(),n=B(t);P(t),U(()=>J(n,`${W(m)?.label??``}. Current: ${W(f)?`${W(p)} ${W(f).title} (${W(f).state})`:`No current step`}`)),q(e,t)};Y(ne,e=>{o()||e(re)});var ie=H(ne,2),ae=e=>{var n=Lw(),r=B(n,!0);P(n),U(()=>J(r,t.state.error)),q(e,n)};Y(ie,e=>{t.state.kind===`error`&&e(ae)});var oe=H(ie,2),se=e=>{var t=Vw(),n=B(t),r=e=>{var t=Rw(),n=H(B(t),2),r=B(n,!0);P(n),P(t),U(()=>J(r,W(d).subtitle)),q(e,t)};Y(n,e=>{W(d).subtitle&&e(r)});var i=H(n,2),a=e=>{var t=zw(),n=H(B(t),2),r=B(n,!0);P(n),P(t),U(()=>J(r,W(d).date)),q(e,t)};Y(i,e=>{W(d).date&&e(a)});var o=H(i,2),s=e=>{var t=Bw(),n=H(B(t),2),r=B(n,!0);P(n),P(t),U(()=>J(r,W(d).keywords)),q(e,t)};Y(o,e=>{W(d).keywords&&e(s)}),P(t),q(e,t)};Y(oe,e=>{!o()&&(W(d).subtitle||W(d).date||W(d).keywords)&&e(se)});var ce=H(oe,2),le=e=>{q(e,Hw())},ue=e=>{var n=Xw();X(n,23,()=>W(d).steps,e=>e.id,(e,n,r)=>{var i=Yw(),a=B(i),l=B(a),u=B(l),d=B(u),f=B(d,!0);P(d);var p=H(d);P(u);var m=H(u,2),h=B(m);P(m);var g=H(m,2),_=e=>{var t=Uw(),r=B(t,!0);P(t),U(e=>J(r,e),[()=>x(W(n))]),q(e,t)};Y(g,e=>{o()||e(_)});var v=H(g,2),y=e=>{var t=Ww(),r=B(t,!0);P(t),U(e=>J(r,e),[()=>C(W(n))]),q(e,t)};Y(v,e=>{o()||e(y)}),P(l);var E=H(l,2);X(E,17,()=>T(W(n)),([e,t])=>e,(e,n)=>{var r=L(()=>w(W(n),2));let i=()=>W(r)[0],a=()=>W(r)[1];var o=Gw(),c=B(o),l=B(c);P(c);var u=H(c,2);{let e=L(()=>S(a()));vw(u,{get text(){return W(e)},get onreference(){return t.onreference},get verifiedReferences(){return s()}})}P(o),U(()=>J(l,`${i()??``}:`)),q(e,o)});var D=H(E,2),O=e=>{var t=Kw(),r=H(B(t));P(t),U(e=>J(r,` ${e??``}`),[()=>W(n).skills.join(`, `)]),q(e,t)};Y(D,e=>{W(n).skills?.length&&e(O)});var k=H(D,2),ee=e=>{var i=Jw();X(i,23,()=>W(n).children,e=>e.id,(e,n,i)=>{var a=qw(),l=B(a),u=B(l),d=B(u),f=B(d),p=B(f,!0);P(f);var m=H(f);P(d);var h=H(d,2),g=B(h);P(h);var _=H(h,2),v=e=>{var t=Uw(),r=B(t,!0);P(t),U(e=>J(r,e),[()=>x(W(n))]),q(e,t)};Y(_,e=>{o()||e(v)}),P(u);var y=H(u,2);X(y,17,()=>T(W(n)),([e,t])=>e,(e,n)=>{var r=L(()=>w(W(n),2));let i=()=>W(r)[0],a=()=>W(r)[1];var o=Gw(),c=B(o),l=B(c);P(c);var u=H(c,2);{let e=L(()=>S(a()));vw(u,{get text(){return W(e)},get onreference(){return t.onreference},get verifiedReferences(){return s()}})}P(o),U(()=>J(l,`${i()??``}:`)),q(e,o)});var C=H(y,2),E=e=>{var t=Kw(),r=H(B(t));P(t),U(e=>J(r,` ${e??``}`),[()=>W(n).skills.join(`, `)]),q(e,t)};Y(C,e=>{W(n).skills?.length&&e(E)}),P(l),qi(l,(e,t)=>c[t.id]=e,e=>c?.[e.id],()=>[W(n)]),P(a),U((e,t)=>{Z(l,`data-step-id`,W(n).id),l.open=e,J(p,t),J(m,` ${W(n).title??``}`),J(g,`${W(n).state??``} · Priority ${W(n).priority??``}${W(n).reviewStatus?` · ${W(n).reviewStatus}`:``}`)},[()=>b(W(n).id),()=>yw(W(r)+1,W(i)+1)]),q(e,a)}),P(i),q(e,i)};Y(k,e=>{W(n).children.length&&e(ee)}),P(a),qi(a,(e,t)=>c[t.id]=e,e=>c?.[e.id],()=>[W(n)]),P(i),U((e,t)=>{Z(a,`data-step-id`,W(n).id),a.open=e,J(f,t),J(p,` ${W(n).title??``}`),J(h,`${W(n).state??``} · Priority ${W(n).priority??``}${W(n).reviewStatus?` · ${W(n).reviewStatus}`:``}`)},[()=>b(W(n).id),()=>yw(W(r)+1)]),q(e,i)}),P(n),q(e,n)};Y(ce,e=>{W(d).steps.length===0?e(le):e(ue,-1)}),P(r),U(()=>{l=Ei(r,1,`plan svelte-3rmyvg`,null,l,{compact:o()}),Z(r,`aria-labelledby`,n),Z(g,`id`,n),J(_,W(d).title)}),q(e,r)};Y(k,e=>{t.state.kind===`loading`?e(ee):t.state.kind===`unavailable`?e(te,1):t.state.kind===`error`&&!W(d)?e(ne,2):W(d)&&e(re,3)}),U(()=>J(O,W(g))),q(e,E),$e()}Vr([`click`]);function eT(e,t){let n=e.find(e=>e.id===t);if(n?.workspacePath)return e.find(e=>e.id!==t&&e.workspacePath===n.workspacePath&&e.desiredState!==`stopped`&&[`starting`,`ready`,`turnActive`,`recovering`,`attentionRequired`].includes(e.state))}function tT(e){return!!(e?.plan||e?.lastOrgPlan?.attached)}function nT(e){let t=e.updatedAt?Date.parse(e.updatedAt):NaN;return{threadId:e.threadId??null,workspacePath:e.workspacePath??`Workspace unavailable`,updatedAt:Number.isFinite(t)?t:null}}function rT(e,t){if(!t?.threadId||!t.workspacePath||!t.resumeCommand||e.some(e=>e.id===t.threadId&&(e.provider??`codex`)===(t.provider??`codex`)))return e;let n=t.updatedAt?Date.parse(t.updatedAt)/1e3:NaN,r={id:t.threadId,cwd:t.workspacePath,recencyAt:Number.isFinite(n)?n:null,resumeCommand:t.resumeCommand,...t.provider===void 0?{}:{provider:t.provider},...t.model===void 0?{}:{model:t.model},...t.effectiveSkillSelection?.selectedProfileName===void 0?{}:{skillProfile:t.effectiveSkillSelection.selectedProfileName},...t.lastOrgPlan===void 0?{}:{orgPlanFilename:t.lastOrgPlan.filename}};return[...e,r].sort((e,t)=>(t.recencyAt??-1/0)-(e.recencyAt??-1/0))}function iT(e){let t=/^\/home\/[^/]+/.exec(e)?.[0];if(!t)return e;let n=e.slice(t.length);return n?`~${n}`:`~/`}var aT=K(`<details class="session-verdict svelte-15zupoi"><summary class="svelte-15zupoi"><span aria-hidden="true"></span> </summary> <p class="svelte-15zupoi"> </p></details>`);function oT(e,t){I(t,!0);let n=L(()=>IS(t.status)?t.status:null);var r=Yr(),i=V(r),a=e=>{let t=L(()=>W(n).state===`working`?`Working`:`Idle`);var r=aT(),i=B(r),a=B(i);let o;var s=H(a);P(i);var c=H(i,2),l=B(c);P(c),P(r),U(()=>{Z(r,`data-state`,W(n).state),Z(r,`aria-label`,`${W(t)}: ${W(n).reason}`),Z(i,`aria-label`,`${W(t)}: ${W(n).reason}`),o=Ei(a,1,`verdict-dot svelte-15zupoi`,null,o,{live:W(n).state===`working`&&W(n).confidence===`fresh`}),J(s,` ${W(t)??``}`),J(l,`${W(n).reason??``}. ${W(n).nextExpectedAction??``}
|
|
157
|
-
Evidence confidence: ${W(n).confidence??``}.`)}),q(e,r)};Y(i,e=>{W(n)&&e(a)}),q(e,r),$e()}var sT=class{transport;createId;onChange;#e={submitting:!1,error:null};#t=null;#n=null;#r=!1;constructor(e,t,n){this.transport=e,this.createId=t,this.onChange=n}get state(){return this.#e}async submit(e){if(this.#r||this.#e.submitting)return null;let t=e.reference,n=JSON.stringify([t.kind,t.kind===`workspace`?t.workspaceId:t.sessionId,t.kind===`retained-session`?null:t.planName,e.expectedRevision,e.skillProfile??null,e.replaceSessionId??null]);n!==this.#t&&(this.#t=n,this.#n=this.createId()),this.#i({submitting:!0,error:null});try{let t=await this.transport.startOrgPlanSupervision({...e,launchId:this.#n});return this.#r?null:t}catch(e){return this.#i({submitting:!1,error:e instanceof Error?e.message:`Could not start supervision.`}),null}finally{this.#i({...this.#e,submitting:!1})}}dispose(){this.#r=!0}#i(e){this.#r||(this.#e=e,this.onChange(e))}},cT=K(`<span class="reason svelte-15heric"> </span>`),lT=K(`<option disabled=""> </option>`),uT=K(`<option> </option>`),dT=K(`<p class="guidance svelte-15heric"> </p>`),fT=K(`<p class="svelte-15heric"> </p>`),pT=K(`<p class="svelte-15heric">The previous session is saved. Gestalt must confirm it has closed before starting the
|
|
158
|
-
supervisor.</p>`),mT=K(`<p class="svelte-15heric">Replace closes this idle session and starts the supervisor. The previous session and its
|
|
159
|
-
history stay saved.</p>`),hT=K(`<p class="svelte-15heric">Replacement requires a confirmed idle session. Refresh to check again.</p>`),gT=K(`<section class="workspace-conflict svelte-15heric"><h3 class="svelte-15heric">Session open in this workspace</h3> <p class="svelte-15heric"> </p> <!> <!> <!></section>`),_T=K(`<p class="guidance svelte-15heric" role="status"> </p>`),vT=K(`<p class="guidance svelte-15heric">Choose an available skill profile.</p>`),yT=K(`<p class="guidance svelte-15heric" role="status">Starting supervision. Closing this dialog does not cancel the launch; the session remains
|
|
160
|
-
available in Sessions.</p>`),bT=K(`<p class="guidance svelte-15heric" role="status">Checking plan and skill profiles…</p>`),xT=K(`<div class="execute-action svelte-15heric"><!> <!></div> <dialog class="svelte-15heric"><h2 class="svelte-15heric">Execute plan</h2> <p class="svelte-15heric">Start a supervisor session for this plan.</p> <label class="svelte-15heric">Supervisor Skill profile</label> <select class="svelte-15heric"><!><!><option>None</option></select> <!> <!> <!> <!> <!> <div class="dialog-actions svelte-15heric"><!> <!> <!></div></dialog>`,1);function ST(e,t){let n=Xr();I(t,!0);let r=R(null),i=R(!0),a=R(!1),o=R(!1),s=R(``),c=R(null),l=R(null),u=R(``),d=R(!1),f=R(void 0),p,m,h=!1,g=0,_=0,v=0,y=!1,b=new sT({startOrgPlanSupervision:e=>t.transport.startOrgPlanSupervision(e)},()=>crypto.randomUUID(),e=>{z(o,e.submitting,!0)}),x=L(()=>W(a)||W(o)),S=L(()=>IS(W(l)?.sessionStatus)?W(l).sessionStatus:void 0),C=L(()=>W(c)?.workspaceSession?.replaceAllowed&&W(l)?.id===W(c).workspaceSession.sessionId&&W(S)?.state===`idle`),w=L(()=>W(i)?`Checking whether this plan can be executed…`:W(r)?.kind===`blocked`?W(r).reason:W(r)?``:`Execution availability could not be verified.`),T=L(()=>W(s)===``||W(c)?.skillProfiles.some(e=>e.name===W(s)&&!e.error));function E(e,n=!1){z(d,n,!0),z(u,e,!0),t.onerror?.(e)}function D(e){e.code===`SKILL_PROFILE_UNAVAILABLE`&&W(s)&&W(c)?(z(c,{...W(c),skillProfiles:W(c).skillProfiles.filter(e=>e.name!==W(s))},!0),E(e.reason)):E(e.reason,!0)}async function O(e,t){if(e.kind!==`eligible`||!e.workspaceSession||!t.getSession)return null;let n=await t.getSession(e.workspaceSession.sessionId);return n.id===e.workspaceSession.sessionId?n:null}Pn(()=>{let e=t.reference,n=t.transport;return t.sourceVersion,jr(()=>{let t=++_,o=new AbortController;if(z(r,null),z(i,!0),++v,z(a,!1),h=!1,++g,z(c,null),z(l,null),z(d,!0),W(f)?.open&&W(f).close(),!e||!n){z(i,!1);return}return n.prepareOrgPlanSupervision(e,void 0,void 0,o.signal).then(async e=>{if(t!==_||y)return;let i=null;try{i=await O(e,n)}catch(e){t===_&&!y&&E(e instanceof Error?e.message:`Could not check session status.`)}t===_&&!y&&(z(r,e,!0),z(l,i,!0))}).catch(e=>{!o.signal.aborted&&t===_&&E(e instanceof Error?e.message:`Could not check plan execution.`)}).finally(()=>{t===_&&!y&&z(i,!1)}),()=>o.abort()})}),Xi(()=>{y=!0,++_,b.dispose()});async function k(e){if(W(r)?.kind!==`eligible`||W(x))return;p=e.currentTarget,z(c,W(r),!0),z(s,W(r).settings.skillProfile,!0),z(u,``),z(d,!1);let t=_,n=++g;h=!0,W(f)?.showModal(),await Or(),h&&n===g&&t===_&&!y&&W(f)?.open&&!W(x)&&m?.focus(),n===g&&(h=!1)}async function ee(){if(!W(f)?.open||!W(c)||!t.transport||W(x))return;let e=_,n=W(c),i=++v;z(a,!0);try{let a=await t.transport.prepareOrgPlanSupervision(n.reference,n.revision,W(s)),o=await O(a,t.transport);if(e!==_||i!==v||y||!W(f)?.open)return;a.kind===`blocked`?D(a):(z(r,a,!0),z(c,a,!0),z(l,o,!0),z(u,``),z(d,!1))}catch(t){e===_&&i===v&&!y&&W(f)?.open&&E(t instanceof Error?t.message:`Could not refresh plan execution.`,!0)}finally{!y&&e===_&&i===v&&z(a,!1)}}function te(){h=!1,++g,W(o)||(++v,z(a,!1)),W(f)?.open&&W(f).close()}async function ne(){await Or(),p?.isConnected&&p.focus()}async function re(e){if(W(x)||W(d)||!W(c)||!t.transport||!W(T))return;let n=W(c).workspaceSession;if(n&&(!W(C)||n.sessionId!==e))return;let r=_,i=W(c);try{let n=await b.submit({reference:i.reference,expectedRevision:i.revision,skillProfile:W(s),...e?{replaceSessionId:e}:{}});if(y||r!==_)return;if(!n){E(b.state.error??`The launch response was not received. Retry OK to recover the same launch.`);return}if(n.kind===`blocked`||n.kind===`rejected`){n.kind===`blocked`?D(n):E(n.reason,!0);return}n.kind===`partial`&&E(n.reason),W(f)?.open&&W(f).close(),t.onresult?.(n)}catch(e){!y&&r===_&&E(e instanceof Error?e.message:`Could not start supervision.`)}}var ie=xT();Br(`keydown`,dn,()=>{W(f)?.open&&(h=!1)});var ae=V(ie),oe=B(ae);{let e=L(()=>!W(w)),t=L(()=>!!W(w)||W(o)),r=L(()=>W(w)?`${n}-reason`:void 0);Om(oe,{compact:!0,class:`execute-trigger`,get primary(){return W(e)},get disabled(){return W(t)},get describedby(){return W(r)},onclick:k,children:(e,t)=>{F(),q(e,Jr(`Execute`))},$$slots:{default:!0}})}var se=H(oe,2),ce=e=>{var t=cT(),r=B(t,!0);P(t),U(()=>{Z(t,`id`,`${n}-reason`),J(r,W(w))}),q(e,t)};Y(se,e=>{W(w)&&e(ce)}),P(ae);var le=H(ae,2),ue=B(le),de=H(ue,2),A=H(de,2),fe=H(A,2),pe=B(fe),me=e=>{var t=lT(),n=B(t);P(t);var r={};U(()=>{J(n,`${W(s)??``} (unavailable)`),r!==(r=W(s))&&(t.value=(t.__value=W(s))??``)}),q(e,t)},he=L(()=>W(s)&&!W(c)?.skillProfiles.some(e=>e.name===W(s)&&!e.error));Y(pe,e=>{W(he)&&e(me)});var ge=H(pe);X(ge,17,()=>W(c)?.skillProfiles.filter(e=>!e.error)??[],e=>e.name,(e,t)=>{var n=uT(),r=B(n,!0);P(n);var i={};U(()=>{J(r,W(t).name),i!==(i=W(t).name)&&(n.value=(n.__value=W(t).name)??``)}),q(e,n)});var _e=H(ge);_e.value=_e.__value=``,P(fe),qi(fe,e=>m=e,()=>m);var ve=H(fe,2);X(ve,17,()=>W(c)&&W(c).settings.skillProfile===W(s)?W(c).warnings:[],ii,(e,t)=>{var n=dT(),r=B(n,!0);P(n),U(()=>J(r,W(t))),q(e,n)});var ye=H(ve,2),be=e=>{var t=gT(),r=B(t),i=H(r,2),o=B(i,!0);P(i);var s=H(i,2),u=e=>{var t=fT(),n=B(t);P(t),U(()=>J(n,`Model: ${W(l).model??``}`)),q(e,t)};Y(s,e=>{W(l)?.model&&e(u)});var d=H(s,2),f=e=>{oT(e,{get status(){return W(S)}})},p=e=>{var t=fT(),n=B(t,!0);P(t),U(()=>J(n,W(a)?`Checking session status…`:`Session status unavailable.`)),q(e,t)};Y(d,e=>{W(S)?e(f):e(p,-1)});var m=H(d,2),h=e=>{q(e,pT())},g=e=>{q(e,mT())},_=e=>{q(e,hT())};Y(m,e=>{W(c).workspaceSession.retryClose?e(h):W(C)?e(g,1):e(_,-1)}),P(t),U(e=>{Z(t,`aria-labelledby`,`${n}-workspace-conflict`),Z(r,`id`,`${n}-workspace-conflict`),J(o,e)},[()=>iT(W(l)?.workspacePath??W(c).workspace.path)]),q(e,t)};Y(ye,e=>{W(c)?.workspaceSession&&e(be)});var xe=H(ye,2),Se=e=>{var t=_T(),n=B(t,!0);P(t),U(()=>J(n,W(u))),q(e,t)};Y(xe,e=>{W(u)&&e(Se)});var j=H(xe,2),Ce=e=>{q(e,vT())};Y(j,e=>{W(T)||e(Ce)});var we=H(j,2),Te=e=>{q(e,yT())},Ee=e=>{q(e,bT())};Y(we,e=>{W(o)?e(Te):W(a)&&e(Ee,1)});var De=H(we,2),Oe=B(De);Om(Oe,{onclick:te,children:(e,t)=>{F();var n=Jr();U(()=>J(n,W(o)?`Close`:`Cancel`)),q(e,n)},$$slots:{default:!0}});var ke=H(Oe,2),Ae=e=>{Om(e,{get disabled(){return W(x)},onclick:()=>void ee(),children:(e,t)=>{F(),q(e,Jr(`Refresh`))},$$slots:{default:!0}})};Y(ke,e=>{(W(u)||W(c)?.workspaceSession&&!W(C))&&e(Ae)});var je=H(ke,2),Me=e=>{let t=L(()=>W(c).workspaceSession);{let n=L(()=>W(x)||W(d)||!W(T)||!W(C));Om(e,{primary:!0,get disabled(){return W(n)},onclick:()=>void re(W(t).sessionId),children:(e,t)=>{F();var n=Jr();U(()=>J(n,W(o)?`Starting…`:`Replace and execute`)),q(e,n)},$$slots:{default:!0}})}},Ne=e=>{{let t=L(()=>W(x)||W(d)||!W(T));Om(e,{primary:!0,get disabled(){return W(t)},onclick:()=>void re(),children:(e,t)=>{F();var n=Jr();U(()=>J(n,W(o)?`Starting…`:`OK`)),q(e,n)},$$slots:{default:!0}})}};Y(je,e=>{W(c)?.workspaceSession?e(Me):e(Ne,-1)}),P(De),P(le),qi(le,e=>z(f,e),()=>W(f)),U(()=>{Z(le,`aria-labelledby`,`${n}-title`),Z(le,`aria-describedby`,`${n}-description`),Z(ue,`id`,`${n}-title`),Z(de,`id`,`${n}-description`),Z(A,`for`,`${n}-profile`),Z(fe,`id`,`${n}-profile`),fe.disabled=W(x)}),Br(`close`,le,()=>void ne()),Br(`cancel`,le,te),G(`keydown`,le,()=>{h=!1}),G(`pointerdown`,le,()=>{h=!1}),G(`change`,fe,()=>{W(d)||z(u,``)}),ji(fe,()=>W(s),e=>z(s,e)),q(e,ie),$e()}Vr([`keydown`,`pointerdown`,`change`]);function CT(e,t){I(t,!0);let n=R(!1),r;Xi(()=>r?.abort());async function i(){if(W(n)||!t.reference||!t.transport)return;let e=new AbortController;r=e,z(n,!0);try{let n=await t.transport.downloadOrgPlan(t.reference,e.signal);if(e.signal.aborted)return;let r=URL.createObjectURL(n.blob),i=document.createElement(`a`);try{i.href=r,i.download=n.filename,document.body.append(i),i.click()}finally{i.remove(),setTimeout(()=>URL.revokeObjectURL(r),0)}}catch{e.signal.aborted||t.onerror?.(`Could not download the Org file. Try again.`)}finally{z(n,!1),r=void 0}}{let r=L(()=>W(n)||!t.reference||!t.transport);Om(e,{label:`Download Org file`,get disabled(){return W(r)},onclick:i,children:(e,t)=>{F();var r=Jr();U(()=>J(r,W(n)?`Downloading…`:`Download`)),q(e,r)},$$slots:{default:!0}})}$e()}var wT=/^(\*+)\s+(?:(TODO|WIP|DONE|SUSPENDED)\s+)?(?:\[#([ABC])\]\s+)?(.+)$/,TT=/^#\+([A-Z][A-Z0-9_-]*):\s*(.*)$/i,ET=/^:([A-Z][A-Z0-9_]*):\s*(.*)$/,DT=/^-\s+([^:]+?)\s+::\s*(.*)$/;function OT(e){let t=[],n=[],r=[],i=e.replace(/\r\n?/g,`
|
|
161
|
-
`).split(`
|
|
162
|
-
`),a=null,o=!1,s=null,c=0,l=()=>{a&&r.push({...a,properties:[...a.properties],descriptions:[...a.descriptions],body:kT(a.body)})};for(let e of i){let r=wT.exec(e);if(r){l(),a={level:r[1].length,title:r[4].trim(),...r[2]?{state:r[2]}:{},...r[3]?{priority:r[3]}:{},properties:[],descriptions:[],body:[]},o=!1,s=null,c=0;continue}if(!a){let r=TT.exec(e);r?t.push([r[1].toUpperCase(),r[2].trim()]):n.push(e);continue}if(e===`:PROPERTIES:`){o=!0;continue}if(o&&e===`:END:`){o=!1,s=null,c=0;continue}if(o){let t=ET.exec(e);t&&a.properties.push([t[1],t[2].trim()]);continue}let i=DT.exec(e);if(i)a.descriptions.push([i[1].trim(),i[2].trim()]),s=a.descriptions.length-1,c=0;else if(s!==null&&/^[ \t]+\S/.test(e)){let[t,n]=a.descriptions[s];a.descriptions[s]=[t,`${n}${`
|
|
163
|
-
`.repeat(c+1)}${e.replace(/^(?: |\t)/,``)}`],c=0}else s!==null&&!e.trim()?c+=1:(s=null,c=0,a.body.push(e))}return l(),{metadata:t,preamble:kT(n),sections:r}}function kT(e){let t=[...e];for(;t[0]?.trim()===``;)t.shift();for(;t.at(-1)?.trim()===``;)t.pop();return t}var AT=K(`<div class="execute-slot svelte-h7gaqo"><!></div>`),jT=K(`<div class="svelte-h7gaqo"><dt class="svelte-h7gaqo"> </dt> <dd class="svelte-h7gaqo"><!></dd></div>`),MT=K(`<dl class="metadata svelte-h7gaqo"></dl>`),NT=K(`<p class="svelte-h7gaqo"><!></p>`),PT=K(`<p class="svelte-h7gaqo">This Org document has no headings.</p>`),FT=K(`<h3 class="svelte-h7gaqo"> </h3>`),IT=K(`<h4 class="svelte-h7gaqo"> </h4>`),LT=K(`<span> </span>`),RT=K(`<span class="priority svelte-h7gaqo"> </span>`),zT=K(`<dl class="descriptions svelte-h7gaqo"></dl>`),BT=K(`<p><!></p>`),VT=K(`<details class="properties svelte-h7gaqo"><summary class="svelte-h7gaqo">Properties</summary> <dl class="svelte-h7gaqo"></dl></details>`),HT=K(`<section class="org-section svelte-h7gaqo"><div class="section-heading svelte-h7gaqo"><!> <!> <!></div> <!> <!> <!></section>`),UT=K(`<div class="sections svelte-h7gaqo"></div>`),WT=K(`<article class="org-document svelte-h7gaqo" aria-labelledby="org-document-title"><header class="svelte-h7gaqo"><div class="document-heading svelte-h7gaqo"><h2 id="org-document-title" class="svelte-h7gaqo"> </h2> <!></div> <!> <button class="close svelte-h7gaqo" type="button">×</button></header> <!> <!> <!></article>`);function GT(e,t){I(t,!0);let n=Q(t,`closeLabel`,3,`Close plan and return to list`),r=Q(t,`verifiedReferences`,19,()=>new Set),i=L(()=>OT(t.preview.source)),a=L(()=>W(i).metadata.filter(([e])=>e!==`TITLE`));var o=WT(),s=B(o),c=B(s),l=B(c),u=B(l,!0);P(l);var d=H(l,2);{let e=L(()=>t.preview.sourcePath||t.sourcePath||t.preview.planName);Aw(d,{get path(){return W(e)},get oncopyresult(){return t.oncopyresult}})}P(c);var f=H(c,2),p=e=>{var n=AT();mi(B(n),()=>t.executeAction),P(n),q(e,n)};Y(f,e=>{t.executeAction&&e(p)});var m=H(f,2);P(s);var h=H(s,2),g=e=>{var n=MT();X(n,21,()=>W(a),([e,t])=>`${e}:${t}`,(e,n)=>{var i=L(()=>w(W(n),2));let a=()=>W(i)[0],o=()=>W(i)[1];var s=jT(),c=B(s),l=B(c,!0);P(c);var u=H(c,2),d=B(u);{let e=L(()=>o()||`—`);vw(d,{get text(){return W(e)},get onreference(){return t.onreference},get verifiedReferences(){return r()}})}P(u),P(s),U(()=>J(l,a())),q(e,s)}),P(n),q(e,n)};Y(h,e=>{W(a).length&&e(g)});var _=H(h,2);X(_,19,()=>W(i).preamble,(e,t)=>`preamble:${t}:${e}`,(e,n)=>{var i=Yr(),a=V(i),o=e=>{var i=NT();vw(B(i),{get text(){return W(n)},get onreference(){return t.onreference},get verifiedReferences(){return r()}}),P(i),q(e,i)},s=L(()=>W(n).trim());Y(a,e=>{W(s)&&e(o)}),q(e,i)});var v=H(_,2),y=e=>{q(e,PT())},b=e=>{var n=UT();X(n,23,()=>W(i).sections,(e,t)=>`${t}:${e.level}:${e.title}`,(e,n)=>{var i=HT();let a;var o=B(i),s=B(o),c=e=>{var t=FT(),r=B(t,!0);P(t),U(()=>J(r,W(n).title)),q(e,t)},l=e=>{var t=IT(),r=B(t,!0);P(t),U(()=>J(r,W(n).title)),q(e,t)};Y(s,e=>{W(n).level===1?e(c):e(l,-1)});var u=H(s,2),d=e=>{var t=LT(),r=B(t,!0);P(t),U(e=>{Ei(t,1,e,`svelte-h7gaqo`),J(r,W(n).state)},[()=>`state state-${W(n).state.toLowerCase()}`]),q(e,t)};Y(u,e=>{W(n).state&&e(d)});var f=H(u,2),p=e=>{var t=RT(),r=B(t);P(t),U(()=>J(r,`Priority ${W(n).priority??``}`)),q(e,t)};Y(f,e=>{W(n).priority&&e(p)}),P(o);var m=H(o,2),h=e=>{var i=zT();X(i,21,()=>W(n).descriptions,([e,t])=>`${e}:${t}`,(e,n)=>{var i=L(()=>w(W(n),2));let a=()=>W(i)[0],o=()=>W(i)[1];var s=jT(),c=B(s),l=B(c,!0);P(c);var u=H(c,2),d=B(u);{let e=L(()=>o()||`—`);vw(d,{get text(){return W(e)},get onreference(){return t.onreference},get verifiedReferences(){return r()}})}P(u),P(s),U(()=>J(l,a())),q(e,s)}),P(i),q(e,i)};Y(m,e=>{W(n).descriptions.length&&e(h)});var g=H(m,2);X(g,19,()=>W(n).body,(e,t)=>`${t}:${e}`,(e,n)=>{var i=Yr(),a=V(i),o=e=>{var i=BT();let a;vw(B(i),{get text(){return W(n)},get onreference(){return t.onreference},get verifiedReferences(){return r()}}),P(i),U(e=>a=Ei(i,1,`svelte-h7gaqo`,null,a,e),[()=>({"list-item":W(n).trimStart().startsWith(`- `)})]),q(e,i)},s=L(()=>W(n).trim());Y(a,e=>{W(s)&&e(o)}),q(e,i)});var _=H(g,2),v=e=>{var i=VT(),a=H(B(i),2);X(a,21,()=>W(n).properties,([e,t])=>`${e}:${t}`,(e,n)=>{var i=L(()=>w(W(n),2));let a=()=>W(i)[0],o=()=>W(i)[1];var s=jT(),c=B(s),l=B(c,!0);P(c);var u=H(c,2),d=B(u);{let e=L(()=>o()||`—`);vw(d,{get text(){return W(e)},get onreference(){return t.onreference},get verifiedReferences(){return r()}})}P(u),P(s),U(()=>J(l,a())),q(e,s)}),P(a),P(i),q(e,i)};Y(_,e=>{W(n).properties.length&&e(v)}),P(i),U(e=>a=Oi(i,``,a,e),[()=>({"--org-depth":Math.max(0,W(n).level-1)})]),q(e,i)}),P(n),q(e,n)};Y(v,e=>{W(i).sections.length===0?e(y):e(b,-1)}),P(o),U(()=>{J(u,t.preview.title),Z(m,`aria-label`,n())}),G(`click`,m,function(...e){t.onclose?.apply(this,e)}),q(e,o),$e()}Vr([`click`]);var KT=K(`<span class="subtitle svelte-x2ko9l"> </span>`),qT=K(`<div class="catalog-progress svelte-x2ko9l"><progress class="svelte-x2ko9l"> </progress> <span class="svelte-x2ko9l"> </span></div> <!>`,1),JT=K(`<span class="subtitle svelte-x2ko9l">Org document</span>`),YT=K(`<span class="archive-tag svelte-x2ko9l">Archived</span>`),XT=K(`<li class="plan-row svelte-x2ko9l"><div class="plan-details svelte-x2ko9l"><strong> </strong> <div class="plan-path svelte-x2ko9l"> </div> <!> <!></div> <div class="plan-actions svelte-x2ko9l"><!> <!></div></li>`),ZT=K(`<div class="plan-controls svelte-x2ko9l"><!> <!></div>`),QT=K(`<p>Waiting for the application workspace…</p>`),$T=K(`<p>Finding Org plans…</p>`),eE=K(`<p> </p>`),tE=K(`<p>No .org files were found in .gestalt folders below the application workspace.</p>`),nE=K(`<ul aria-label="Unfinished plans" class="svelte-x2ko9l"></ul>`),rE=K(`<section class="completed svelte-x2ko9l" aria-labelledby="completed-plans-title"><h3 id="completed-plans-title" class="svelte-x2ko9l">Completed and archived</h3> <ul aria-label="Completed and archived plans" class="svelte-x2ko9l"></ul></section>`),iE=K(`<p class="scope svelte-x2ko9l">Org plans in .gestalt folders below the application workspace.</p> <!> <!>`,1),aE=K(`<section class="plans svelte-x2ko9l" aria-labelledby="plans-title"><div class="catalog-heading svelte-x2ko9l"><h2 id="plans-title" tabindex="-1" class="svelte-x2ko9l">ORG Plans</h2> <span role="status">(updating…)</span></div> <!></section>`);function oE(e,t){I(t,!0);let n=(e,n=b)=>{var r=XT(),a=B(r),o=B(a),c=B(o,!0);P(o);var l=H(o,2),u=B(l,!0);P(l);var d=H(l,2),f=e=>{var t=qT(),r=V(t),i=B(r),a=B(i);P(i);var o=H(i,2),s=B(o);P(o),P(r);var c=H(r,2),l=e=>{var t=KT(),r=B(t,!0);P(t),U(()=>J(r,n().subtitle)),q(e,t)};Y(c,e=>{n().subtitle&&e(l)}),U(e=>{Z(i,`aria-label`,`Completion for ${n().title}`),Ri(i,n().doneSteps),Z(i,`max`,e),J(a,`${n().doneSteps??``} of ${n().totalSteps??``} work items complete`),J(s,`${n().doneSteps??``} / ${n().totalSteps??``}`)},[()=>Math.max(1,n().totalSteps)]),q(e,t)},p=e=>{q(e,JT())};Y(d,e=>{n().previewAvailable!==!1&&n().totalSteps!==void 0&&n().doneSteps!==void 0?e(f):e(p,-1)});var m=H(d,2),_=e=>{q(e,YT())};Y(m,e=>{n().archived&&e(_)}),P(a);var v=H(a,2),y=B(v);{let e=L(()=>`${n().allDone||n().archived?`Reopen`:`Open`} ${n().title}`);Om(y,{get label(){return W(e)},onclick:()=>h(n().planName),children:(e,t)=>{F();var r=Jr();U(()=>J(r,n().allDone||n().archived?`Reopen`:`Open`)),q(e,r)},$$slots:{default:!0}})}var x=H(y,2),S=e=>{{let r=L(()=>`Archive ${n().title}`),a=L(()=>!t.onarchive||n().archived||i().includes(n().planName));Om(e,{get label(){return W(r)},get disabled(){return W(a)},onclick:()=>g(n().planName),children:(e,t)=>{F();var r=Jr();U(e=>J(r,e),[()=>i().includes(n().planName)?`Archiving…`:`Archive`]),q(e,r)},$$slots:{default:!0}})}};Y(x,e=>{!n().allDone&&!n().archived&&e(S)}),P(v),P(r),qi(r,e=>s[n().planName]=e,()=>s?.[n().planName]),U(()=>{Z(r,`aria-label`,`${n().title} (${n().planName})`),J(c,n().title),J(u,n().planName)}),q(e,r)},r=e=>{var n=ZT(),r=B(n);CT(r,{get reference(){return t.executeReference},get transport(){return t.downloadTransport},get onerror(){return t.ondownloaderror}}),ST(H(r,2),{get reference(){return t.executeReference},get sourceVersion(){return t.state},get transport(){return t.executeTransport},get onerror(){return t.onexecuteerror},get onresult(){return t.onexecuteresult}}),P(n),q(e,n)},i=Q(t,`archivingPlans`,19,()=>[]),a=R(cn(new Set));Pn(()=>{let e=mw(t.state),n=t.checkreferences,r=new AbortController;return z(a,new Set,!0),e.length&&n&&n(e,r.signal).then(e=>{r.signal.aborted||z(a,new Set(e),!0)}).catch(()=>{}),()=>r.abort()});let o=R(null),s=cn({}),c=R(null),l=R(null),u=!1,d=!1,f=L(()=>t.catalog.kind===`ready`?t.catalog.entries.filter(e=>e.allDone!==!0&&!e.archived):[]),p=L(()=>t.catalog.kind===`ready`?t.catalog.entries.filter(e=>e.allDone===!0||e.archived):[]);function m(){t.onclose()}function h(e){z(l,e,!0),t.onopen(e)}function g(e){z(c,e,!0),t.onarchive?.(e)}Pn(()=>{let e=W(c);if(e&&t.catalog.kind===`ready`&&t.catalog.entries.some(t=>t.planName===e&&t.archived)&&queueMicrotask(()=>{s[e]?.querySelector(`button`)?.focus(),z(c,null)}),t.state){u=!0;return}if(u&&(u=!1,d=!0),!d)return;let n=t.catalog.kind,r=W(l);queueMicrotask(()=>{let e=r?s[r]?.querySelector(`button`):void 0;e?.isConnected?(e.focus(),d=!1):n!==`loading`&&(W(o)?.focus(),d=!1)})});var _=Yr(),v=V(_),y=e=>{GT(e,{get preview(){return t.state},onclose:m,get closeLabel(){return t.closeLabel},get onreference(){return t.onreference},get verifiedReferences(){return W(a)},get sourcePath(){return t.sourcePath},get oncopyresult(){return t.oncopyresult},get executeAction(){return r}})},x=e=>{$w(e,{get state(){return t.state},onclose:m,get closeLabel(){return t.closeLabel},get onreference(){return t.onreference},get verifiedReferences(){return W(a)},get sourcePath(){return t.sourcePath},get oncopyresult(){return t.oncopyresult},get executeAction(){return r}})},S=e=>{var r=aE(),i=B(r),a=B(i);qi(a,e=>z(o,e),()=>W(o));var s=H(a,2);P(i);var c=H(i,2),l=e=>{q(e,QT())},u=e=>{q(e,$T())},d=e=>{var n=eE(),r=B(n,!0);P(n),U(()=>J(r,t.catalog.error)),q(e,n)},m=e=>{q(e,tE())},h=e=>{var t=iE(),r=H(V(t),2),i=e=>{var t=nE();X(t,21,()=>W(f),e=>e.planName,(e,t)=>{n(e,()=>W(t))}),P(t),q(e,t)};Y(r,e=>{W(f).length>0&&e(i)});var a=H(r,2),o=e=>{var t=rE(),r=H(B(t),2);X(r,21,()=>W(p),e=>e.planName,(e,t)=>{n(e,()=>W(t))}),P(r),P(t),q(e,t)};Y(a,e=>{W(p).length>0&&e(o)}),q(e,t)};Y(c,e=>{t.catalog.kind===`no-workspace`?e(l):t.catalog.kind===`loading`?e(u,1):t.catalog.kind===`error`?e(d,2):t.catalog.entries.length===0?e(m,3):e(h,-1)}),P(r),U(()=>{Ei(s,1,bi([`catalog-update`,{inactive:t.catalog.kind!==`ready`||!t.catalog.refreshing}]),`svelte-x2ko9l`),Z(s,`aria-hidden`,t.catalog.kind!==`ready`||!t.catalog.refreshing)}),q(e,r)};Y(v,e=>{t.state?.kind===`org-source`?e(y):t.state?e(x,1):e(S,-1)}),q(e,_),$e()}var sE=K(`<dialog class="plan-overlay svelte-wabv1" aria-label="Plan viewer"><!></dialog>`);function cE(e,t){I(t,!0);let n;Yi(()=>(n.showModal(),()=>n.close()));var r=sE();mi(B(r),()=>t.children),P(r),qi(r,e=>n=e,()=>n),Br(`cancel`,r,e=>{e.preventDefault(),t.onclose()}),q(e,r),$e()}async function lE(e,t,n){if(t.publish(e),!n.isCurrent())return await t.refreshRoster(),!1;for(let n of e.effectiveSkillSelection?.warnings??[])t.warn(n);if(t.select(e,n.history),await t.saveSelectedSession(e.id),await t.refreshRoster(),!n.isCurrent())return!1;let r=await t.readDraft(e.id);return n.isCurrent()?(t.restoreDraft(e.id,r),n.present?.(),!0):!1}var uE=class{openingChanged;#e=0;#t=null;#n=!1;constructor(e){this.openingChanged=e}invalidate(){++this.#e,this.#t=null,this.openingChanged(null)}begin(){this.invalidate();let e=this.#e;return()=>!this.#n&&e===this.#e}beginOpen(e){if(this.#n)return{isCurrent:()=>!1,finish:()=>{}};let t=this.begin(),n=Symbol(e);return this.#t=n,this.openingChanged(e),{isCurrent:t,finish:()=>{this.#t===n&&(this.#t=null,this.openingChanged(null))}}}dispose(){this.#n=!0,this.invalidate()}},dE=`settings`,fE=`drafts`,pE=`cursors`,mE=`selected-session`,hE={text:``,revision:0},gE=e=>{if(!e||typeof e!=`object`)return!1;let t=e,n=t.pending;return typeof t.text==`string`&&Number.isSafeInteger(t.revision)&&t.revision>=0&&(n===void 0||Array.isArray(n)&&n.every(e=>!!e&&typeof e.operationId==`string`&&typeof e.text==`string`&&Number.isSafeInteger(e.revision)&&e.revision>=0&&(e.kind===`send`||e.kind===`queue`||e.kind===`interrupt-send`)))};function _E(e=globalThis.indexedDB){if(!e)return vE;let t=Px(e),n=new Map,r=new Map,i=async(e,i)=>{let a=r.get(e);if(a&&a.revision>i.revision)return;r.set(e,i);let o=(n.get(e)??Promise.resolve()).catch(()=>void 0).then(async()=>{if(r.get(e)===i)try{await Ix(await t,fE,e,i)}catch{}});n.set(e,o),await o};return{async readSelectedSession(){try{return await Fx(await t,dE,mE)??null}catch{return null}},async saveSelectedSession(e){try{let n=await t;e?await Ix(n,dE,mE,e):await Lx(n,dE,mE)}catch{}},async readDraft(e){return(await this.readDraftEnvelope(e)).text},async saveDraft(e,t){let n=await this.readDraftEnvelope(e);await i(e,{text:t,revision:n.revision+1})},async readDraftEnvelope(e){try{let n=await Fx(await t,fE,e),i=gE(n)?n:typeof n==`string`?{text:n,revision:0}:hE,a=r.get(e);return a&&a.revision>=i.revision?a:(r.set(e,i),i)}catch{return r.get(e)??hE}},saveDraftEnvelope:i,replaceDraftText:async(e,t,n)=>{let a=r.get(e);await i(e,{text:t,revision:n,pending:a?.pending})},addPendingDraftOperation:async(e,t)=>{let n=r.get(e)??hE;await i(e,{...n,pending:[...(n.pending??[]).filter(e=>e.operationId!==t.operationId),t].slice(-8)})},consumeAcceptedDraft:async(e,i,a)=>{let o=n.get(e)??Promise.resolve(),s=null,c=o.catch(()=>void 0).then(async()=>{let n=r.get(e);if(!n)try{let r=await Fx(await t,fE,e);n=gE(r)?r:typeof r==`string`?{text:r,revision:0}:hE}catch{n=hE}if(!(n.revision!==i||!n.pending?.some(e=>e.operationId===a))){s={text:``,revision:n.revision+1,pending:n.pending.filter(e=>e.operationId!==a)},r.set(e,s);try{await Ix(await t,fE,e,s)}catch{r.get(e)===s&&r.set(e,n),s=null}}});return n.set(e,c),await c,s},async readCursor(e){try{let n=await Fx(await t,pE,e);return typeof n==`number`&&Number.isSafeInteger(n)&&n>=0?n:0}catch{return 0}},async saveCursor(e,n){try{await Ix(await t,pE,e,n)}catch{}}}}var vE={readSelectedSession:async()=>null,saveSelectedSession:async()=>{},readDraft:async()=>``,saveDraft:async()=>{},readDraftEnvelope:async()=>hE,saveDraftEnvelope:async()=>{},replaceDraftText:async()=>{},addPendingDraftOperation:async()=>{},consumeAcceptedDraft:async()=>null,readCursor:async()=>0,saveCursor:async()=>{}},yE=K(`<progress aria-label="Weekly allowance remaining" max="100" class="svelte-1wyi1so"></progress>`),bE=K(`<div class="empty-track svelte-1wyi1so" aria-hidden="true"></div>`),xE=K(`<label class="auto-reset svelte-1wyi1so"><input type="checkbox" class="svelte-1wyi1so"/> Use when over</label>`),SE=K(`<section class="allowance svelte-1wyi1so" aria-label="Codex allowance"><div class="weekly svelte-1wyi1so"><div class="summary svelte-1wyi1so"><span>Codex weekly allowance</span> <strong class="svelte-1wyi1so"> </strong></div> <!> <span class="detail svelte-1wyi1so"> </span></div> <div class="resets svelte-1wyi1so"><span class="detail svelte-1wyi1so">Reset credits</span> <strong class="svelte-1wyi1so"> </strong> <!></div></section>`);function CE(e,t){I(t,!0);let n=Q(t,`useWhenOver`,3,null),r=Q(t,`savingAutoReset`,3,!1),i=R(null),a=R(!0),o=R(cn(Date.now())),s=L(()=>{if(W(i)?.weeklyResetsAt==null)return`Reset date unavailable`;let e=W(i).weeklyResetsAt*1e3-W(o);if(e<=0)return`Reset due`;let t=Math.floor(e/6e4);if(t===0)return`Resets in less than 1 minute`;let n=Math.floor(t/1440),r=Math.floor(t%1440/60),a=[];if(n&&a.push(`${n} ${n===1?`day`:`days`}`),r&&a.push(`${r} ${r===1?`hour`:`hours`}`),!n&&t%60){let e=t%60;a.push(`${e} ${e===1?`minute`:`minutes`}`)}return`Resets in ${a.join(` `)}`});Yi(()=>{let e=new AbortController,n,r=!1,s=async()=>{try{let n=await t.fetcher(`/api/codex/allowance`,{signal:e.signal});if(!n.ok)throw Error(`Allowance unavailable`);let a=await n.json();e.signal.aborted||(z(i,a,!0),z(o,Date.now(),!0),r=!1)}catch{e.signal.aborted||(z(i,null),r||t.onerror(),r=!0)}finally{e.signal.aborted||(z(a,!1),n=setTimeout(()=>void s(),6e4))}};return s(),()=>{e.abort(),clearTimeout(n)}});var c=SE(),l=B(c),u=B(l),d=H(B(u),2),f=B(d,!0);P(d),P(u);var p=H(u,2),m=e=>{var t=yE();U(()=>Ri(t,W(i).weeklyRemainingPercent)),q(e,t)},h=e=>{q(e,bE())};Y(p,e=>{W(i)?.weeklyRemainingPercent==null?e(h,-1):e(m)});var g=H(p,2),_=B(g,!0);P(g),P(l);var v=H(l,2),y=H(B(v),2),b=B(y,!0);P(y);var x=H(y,2),S=e=>{var i=xE(),a=B(i);Li(a),F(),P(i),U(()=>{zi(a,n()===!0),a.disabled=n()===null||r()}),G(`change`,a,e=>{let r=e.currentTarget.checked;e.currentTarget.checked=n()===!0,t.onautoreset?.(r)}),q(e,i)};Y(x,e=>{t.onautoreset&&e(S)}),P(v),P(c),U(e=>{Z(c,`aria-busy`,W(a)),J(f,W(a)?`Loading…`:W(i)?.weeklyRemainingPercent==null?`Unavailable`:`${W(i).weeklyRemainingPercent}% left`),Z(g,`title`,e),J(_,W(a)?`Checking reset date…`:W(s)),J(b,W(a)?`Loading…`:W(i)?.resetsAvailable==null?`Unavailable`:`${W(i).resetsAvailable} available`)},[()=>W(i)?.weeklyResetsAt==null?void 0:new Date(W(i).weeklyResetsAt*1e3).toLocaleString()]),q(e,c),$e()}Vr([`change`]);function wE(e,t=Date.now()){if(e===null)return`Unknown activity time`;let n=Math.max(0,t-e),r=Math.floor(n/(3600*1e3));if(r<1)return`Less than an hour ago`;if(r<24)return`${r} hour${r===1?``:`s`} ago`;let i=Math.floor(r/24);return`${i} day${i===1?``:`s`} ago`}function TE(e){return e!==void 0&&e.phase!==`failed`&&e.phase!==`completed`}function EE(e,t){if(!e||typeof e!=`object`)return!1;let n=e;return n.sessionId===t&&typeof n.operationId==`string`&&typeof n.updatedAt==`string`&&[`stopping`,`cleaning`,`finalizing`,`failed`,`completed`].includes(n.phase)}var DE=class{options;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=new Set;#a=new Map;#o=!1;constructor(e){this.options=e}isBusy(e){return TE(this.#e.get(e))}reconcile(e){let t=e.filter(e=>!this.#r.has(e.id));for(let e of t)this.#t.set(e.id,e),e.forgetOperation&&this.observe(e.id,e.forgetOperation);for(let[e,n]of this.#e){let r=this.#t.get(e);TE(n)&&r&&!t.some(t=>t.id===e)&&t.push(r)}return t.filter(e=>!this.#r.has(e.id))}observe(e,t){if(this.#o||!EE(t,e)||this.#r.has(e))return;let n=this.#e.get(e)?.operation;if(!(n&&n.updatedAt>t.updatedAt)){if(t.phase===`completed`){this.#p(e);return}if(this.#c(e,{phase:t.phase,operation:t}),t.phase===`failed`){let n=this.#t.get(e)?.workspacePath?.split(/[/\\]/).filter(Boolean).at(-1),r=t.failureCode===`SESSION_CLEANUP_FAILED`?{code:t.failureCode,cleanupFolders:t.cleanupFolders,workspaceName:n}:t.failureCode;this.#f(e,r,`${t.operationId}:${t.updatedAt}`)}}}forget(e,t){if(this.#o||this.#r.has(e.id))return Promise.resolve();let n=this.#n.get(e.id);if(n)return n;if(this.isBusy(e.id))return Promise.resolve();this.#t.set(e.id,e),this.#i.delete(`${e.id}:request`),this.#c(e.id,{phase:`requesting`});let r=this.#s(e.id,t);return this.#n.set(e.id,r),r.finally(()=>this.#n.delete(e.id)),r}async#s(e,t){try{await this.options.relay.forgetSession(e,t),this.#p(e)}catch(t){if(this.#o||this.#r.has(e))return;try{let t=await this.options.relay.getSession(e);if(t.forgetOperation){this.observe(e,t.forgetOperation);return}}catch(n){if(this.#d(n)){this.#p(e);return}this.#f(e,t);return}this.#c(e,{phase:`failed`}),this.#f(e,t)}}#c(e,t){this.#o||(this.#e.set(e,t),this.options.publish(new Map(this.#e)),TE(t)?this.#l(e):this.#m(e))}#l(e){this.#a.has(e)||this.#o||this.#a.set(e,setTimeout(()=>{this.#a.delete(e),this.#u(e)},this.options.pollMs??1e3))}async#u(e){try{let t=await this.options.relay.getSession(e);!this.#o&&this.isBusy(e)&&t.forgetOperation?this.observe(e,t.forgetOperation):!this.#o&&this.isBusy(e)&&!this.#n.has(e)&&(this.#c(e,{phase:`failed`}),this.#f(e,Error(`SESSION_FORGET_FAILED`)))}catch(t){this.#d(t)&&this.#p(e)}finally{this.isBusy(e)&&this.#l(e)}}#d(e){return typeof e==`object`&&!!e&&`status`in e&&e.status===404}#f(e,t,n=`${e}:request`){this.#i.has(n)||(this.#i.add(n),this.options.onError(typeof t==`string`?Error(t):t))}#p(e){if(this.#o||this.#r.has(e))return;let t=this.#t.get(e);t&&(this.#r.add(e),this.#e.delete(e),this.#m(e),this.options.publish(new Map(this.#e)),this.options.onComplete(t))}#m(e){clearTimeout(this.#a.get(e)),this.#a.delete(e)}dispose(){this.#o=!0;for(let e of this.#a.keys())this.#m(e)}},OE=(e,t=b)=>{var n=Yr(),r=V(n),i=e=>{var n=jE(),r=B(n),i=e=>{q(e,AE())},a=L(()=>TE(t()));Y(r,e=>{W(a)&&e(i)});var o=H(r,2),s=B(o,!0);P(o),P(n),U(()=>J(s,t().phase===`failed`?`Could not forget this session. Try again.`:t().phase===`cleaning`?`Removing temporary files…`:t().phase===`finalizing`?`Finishing…`:`Forgetting session…`)),q(e,n)};Y(r,e=>{t()&&t().phase!==`completed`&&e(i)}),q(e,n)},kE=(e,t=b)=>{var n=FE(),r=V(n),i=e=>{q(e,ME())},a=L(()=>tT(t()));Y(r,e=>{W(a)&&e(i)});var o=H(r,2),s=e=>{var n=NE(),r=B(n),i=B(r,!0);P(r);var a=H(r,2),o=B(a,!0);P(a),P(n),U(()=>{J(i,t().lastOrgPlan.title),J(o,t().lastOrgPlan.filename)}),q(e,n)};Y(o,e=>{t().lastOrgPlan&&e(s)});var c=H(o,2),l=e=>{var n=PE(),r=B(n);{let e=L(()=>`Plan progress for ${t().plan.title}`);Ow(r,{compact:!0,get plan(){return t().plan},get label(){return W(e)}})}P(n),q(e,n)};Y(c,e=>{t().plan&&e(l)}),q(e,n)},AE=K(`<span class="forget-spinner svelte-hxb22h" aria-hidden="true"></span>`),jE=K(`<p class="session-forget-status svelte-hxb22h" role="status" aria-atomic="true"><!> <span> </span></p>`),ME=K(`<span class="profile-badge svelte-hxb22h">Org plan attached</span>`),NE=K(`<span class="org-plan-metadata svelte-hxb22h"><span class="org-plan-title svelte-hxb22h"> </span> <span class="org-plan-filename svelte-hxb22h"> </span></span>`),PE=K(`<div class="session-plan-progress svelte-hxb22h"><!></div>`),FE=K(`<!> <!> <!>`,1),IE=K(`<details class="self-debug-details"><summary class="svelte-hxb22h">Self DEBUG</summary> <!> <button type="button">Redacted diagnostic trace (JSON)</button></details>`),LE=K(`<!> <!>`,1),RE=K(`<time class="svelte-hxb22h"> </time>`),zE=K(`<div> </div>`),BE=K(`<span class="profile-badge svelte-hxb22h"> </span>`),VE=K(`<span class="profile-badge svelte-hxb22h">Kimi</span>`),HE=K(`<li><div class="session-actions svelte-hxb22h" aria-label="Session actions"><!> <!> <!> <!> <!> <!> <!> <!></div> <div class="session-details svelte-hxb22h"><!> <!> <div class="session-summary svelte-hxb22h"><!> <!> <div class="workspace-path svelte-hxb22h"> </div> <!> <!> <!> <!> <!></div> <!> <!></div></li>`),UE=K(`<section aria-labelledby="open-sessions-title"><h3 id="open-sessions-title">Open sessions</h3> <ul class="session-list svelte-hxb22h" aria-label="Open sessions"></ul></section>`),WE=K(`<li class="managed-session svelte-hxb22h"><div class="session-actions svelte-hxb22h"><!> <!> <!> <!> <!> <!></div> <div class="session-details svelte-hxb22h"><!> <!> <!> <div class="workspace-path svelte-hxb22h"> </div> <!> <!> <!> <!> <!></div></li>`),GE=K(`<ul class="session-list svelte-hxb22h" aria-label="Saved sessions"></ul>`),KE=K(`<p>No saved sessions yet.</p>`),qE=K(`<option> </option>`),JE=K(`<option>Loading models…</option>`),YE=K(`<option>Choose automatically</option>`),XE=K(`<p class="skills-profile-error svelte-hxb22h" role="alert"> </p>`),ZE=K(`<fieldset class="executor-settings svelte-hxb22h"><legend>Org-plan executor</legend> <label for="executor-model" class="svelte-hxb22h">Executor model <select id="executor-model" class="svelte-hxb22h"></select></label> <label for="executor-thinking" class="svelte-hxb22h">Executor thinking <select id="executor-thinking" class="svelte-hxb22h"></select></label></fieldset>`),QE=K(`<label for="model-thinking" class="svelte-hxb22h">Model thinking <select id="model-thinking" class="svelte-hxb22h"></select></label>`),$E=K(`<label for="sandbox" class="svelte-hxb22h">Sandbox</label> <label for="approval-policy" class="svelte-hxb22h">Approval policy</label>`,1),eD=K(`<select id="sandbox" class="svelte-hxb22h"><option>workspace-git (Git writable)</option><option>workspace-write</option><option>read-only</option><option>danger-full-access</option></select> <select id="approval-policy" class="svelte-hxb22h"><option>Ask on all commands</option><option>Ask out of workspace</option><option>Never ask for approval</option></select>`,1),tD=K(`<li class="recent-session svelte-hxb22h"><div class="session-details svelte-hxb22h"><!> <div class="workspace-path svelte-hxb22h"> </div> <!> <!> <!> <!></div> <div class="session-actions svelte-hxb22h"><!> <!> <!></div></li>`),nD=K(`<ul class="session-list recent-session-list svelte-hxb22h" aria-label="Recent sessions"></ul>`),rD=K(`<p>No other recent sessions found.</p>`),iD=K(`<form class="svelte-hxb22h"><h3 class="new-session-title svelte-hxb22h">New session</h3> <div class="session-base svelte-hxb22h"><!></div> <div class="essential-settings svelte-hxb22h"><label for="skills-profile" class="svelte-hxb22h">Skills profile <select id="skills-profile" class="svelte-hxb22h"><!><option>None</option></select></label> <label for="model" class="svelte-hxb22h">Model <select id="model" class="svelte-hxb22h"><!><!></select></label></div> <!> <details class="advanced-settings svelte-hxb22h"><summary class="svelte-hxb22h">Advanced settings</summary> <div class="advanced-content svelte-hxb22h"><section class="session-settings svelte-hxb22h" aria-label="New session settings"><div class="advanced-model-settings svelte-hxb22h"><!> <fieldset class="supervisor-settings svelte-hxb22h"><legend>Main supervisor</legend> <!> <div class="provider-control svelte-hxb22h"><label for="session-provider" class="svelte-hxb22h">Provider</label> <select id="session-provider" class="svelte-hxb22h"><option>Codex</option><option> </option></select></div></fieldset></div> <div class="session-setting-labels svelte-hxb22h"><!></div> <div class="session-setting-controls svelte-hxb22h"><!></div> <div class="session-secondary-actions svelte-hxb22h"><!> <!></div></section></div></details> <div class="create-session-actions svelte-hxb22h"><!> <!></div></form> <section aria-labelledby="recent-sessions-title"><h3 id="recent-sessions-title">Recent sessions</h3> <!></section>`,1),aD=K(`<dialog aria-labelledby="close-session-title" class="svelte-hxb22h"><h2 id="close-session-title" class="svelte-hxb22h">Close session?</h2> <p>You can reopen this session from the session list.</p> <div class="dialog-actions svelte-hxb22h"><!> <!></div></dialog> <section aria-labelledby="sessions-title"><h2 id="sessions-title" class="visually-hidden">Sessions</h2> <!> <!> <!> <!></section>`,1);function oD(e,t){I(t,!0);let n=(e,n=b)=>{let r=L(()=>s().get(n().id)),i=L(()=>W(r)?W(r).operation:n().forgetOperation);var a=Yr(),o=V(a),c=e=>{Om(e,{class:`keep-temporary-files`,compact:!0,full:!0,onclick:()=>t.onforget(n().id,W(i).operationId),children:(e,t)=>{F(),q(e,Jr(`Forget and keep temporary files`))},$$slots:{default:!0}})};Y(o,e=>{W(i)?.phase===`failed`&&W(i).failureCode===`SESSION_CLEANUP_FAILED`&&!W(i).blockingSessionId&&!W(i).keepFilesRequested&&e(c)}),q(e,a)},r=(e,n=b,r)=>{let i=Tt(()=>C(r?.(),!0));var a=Yr(),o=V(a),s=e=>{{let r=L(()=>`Plan for ${n().plan?.title??n().lastOrgPlan?.title??`session`}`);Om(e,{get compact(){return W(i)},get full(){return W(i)},get label(){return W(r)},onclick:()=>t.onplan?.(n().id),children:(e,t)=>{F(),q(e,Jr(`Plan`))},$$slots:{default:!0}})}},c=L(()=>n()&&t.onplan&&tT(n()));Y(o,e=>{W(c)&&e(s)}),q(e,a)},i=(e,t=b)=>{var n=Yr(),r=V(n),i=e=>{var n=IE(),r=H(B(n),2);Im(r,{get context(){return t().selfDebug.context}});var i=H(r,2);P(n),G(`click`,i,e=>ae()(t(),e.currentTarget)),q(e,n)};Y(r,e=>{t().selfDebug&&e(i)}),q(e,n)},a=Q(t,`rosterOnly`,3,!1),o=Q(t,`onallowanceerror`,3,()=>{}),s=Q(t,`forgettingStates`,19,()=>new Map),c=Q(t,`activitySnapshots`,19,()=>new Map),l=Q(t,`autopilotSnapshots`,19,()=>new Map),u=Q(t,`autopilotPending`,19,()=>new Set),d=Q(t,`autopilotAttention`,19,()=>new Map),f=Q(t,`models`,19,()=>[]),p=Q(t,`selectedModel`,3,``),m=Q(t,`reasoningEffort`,3,`medium`),h=Q(t,`executorModels`,19,()=>[]),g=Q(t,`executorModel`,3,`gpt-5.6-terra`),_=Q(t,`executorReasoningEffort`,3,`high`),v=Q(t,`onreasoningchange`,3,()=>{}),y=Q(t,`onexecutormodelchange`,3,()=>{}),x=Q(t,`onexecutorreasoningchange`,3,()=>{}),S=Q(t,`provider`,3,`codex`),w=Q(t,`kimiAvailable`,3,!1),T=Q(t,`modelsLoading`,3,!1),E=Q(t,`onmodelchange`,3,()=>{}),D=Q(t,`onproviderchange`,3,()=>{}),O=Q(t,`onautopilottoggle`,3,()=>{}),k=Q(t,`onactivityopen`,3,()=>{}),ee=Q(t,`onautopilotresolve`,3,()=>{}),te=Q(t,`debugPending`,3,!1),ne=Q(t,`savingDefaults`,3,!1),re=Q(t,`advancedExpanded`,15,!1),ie=Q(t,`onsavedefaults`,3,()=>{}),ae=Q(t,`ondebugtrace`,3,()=>{}),oe=L(()=>t.sessions.filter(e=>e.state===`ready`||e.state===`turnActive`)),se=L(()=>t.sessions.filter(e=>e.state!==`ready`&&e.state!==`turnActive`)),ce=L(()=>t.recentSessions.filter(e=>!t.sessions.some(t=>(t.state===`ready`||t.state===`turnActive`||s().has(t.id)||t.forgetOperation)&&t.threadId===e.id&&(t.provider??`codex`)===(e.provider??`codex`)))),le=L(()=>hC(t.workspaceTree,t.workspaceId)),ue=R(null),de=R(null);function A(e){TE(s().get(e))||(z(de,e,!0),W(ue)?.showModal())}var fe=aD(),pe=V(fe),me=H(B(pe),4),he=B(me);Om(he,{onclick:()=>W(ue)?.close(),children:(e,t)=>{F(),q(e,Jr(`Cancel`))},$$slots:{default:!0}}),Om(H(he,2),{primary:!0,onclick:()=>{W(de)&&t.onclose(W(de)),W(ue)?.close()},children:(e,t)=>{F(),q(e,Jr(`Close session`))},$$slots:{default:!0}}),P(me),P(pe),qi(pe,e=>z(ue,e),()=>W(ue));var ge=H(pe,2);let _e;var ve=H(B(ge),2),ye=e=>{CE(e,{get fetcher(){return t.allowanceFetcher},get onerror(){return o()},get useWhenOver(){return t.useWhenOver},get savingAutoReset(){return t.savingAutoReset},get onautoreset(){return t.onautoreset}})};Y(ve,e=>{t.allowanceFetcher&&e(ye)});var be=H(ve,2),xe=e=>{var o=UE(),p=H(B(o),2);X(p,21,()=>W(oe),e=>e.id,(e,o)=>{let p=L(()=>nT(W(o))),m=L(()=>s().get(W(o).id)??W(o).forgetOperation),h=L(()=>TE(W(m)));var g=HE();let _;var v=B(g),y=B(v);{let e=L(()=>W(o).id===t.selectedSessionId?`page`:void 0);Om(y,{compact:!0,full:!0,get current(){return W(e)},get disabled(){return W(h)},onclick:()=>t.onselectopen(W(o).id),children:(e,t)=>{F(),q(e,Jr(`Open`))},$$slots:{default:!0}})}var b=H(y,2);r(b,()=>W(o));var x=H(b,2),S=e=>{Om(e,{compact:!0,full:!0,onclick:()=>t.oncopyresume(W(o).resumeCommand),children:(e,t)=>{F(),q(e,Jr(`Copy CLI`))},$$slots:{default:!0}})};Y(x,e=>{W(o).resumeCommand&&W(o).provider!==`kimi`&&e(S)});var C=H(x,2),w=e=>{var t=LE(),n=V(t),r=e=>{{let t=L(()=>l().get(W(o).id)??W(o).autopilot??null),n=L(()=>`session-autopilot-${W(o).id}`),r=L(()=>W(h)||u().has(W(o).id));hg(e,{compact:!0,indicatorOnly:!0,get autopilot(){return W(t)},get controlId(){return W(n)},get pending(){return W(r)},ontoggle:e=>O()(W(o).id,e)})}};Y(n,e=>{W(o).provider!==`kimi`&&e(r)});var i=H(n,2);{let e=L(()=>a()?`start`:`end`),t=L(()=>c().get(W(o).id)??W(o).agentActivity??null),n=L(()=>W(o).model??f()?.[0]);jh(i,{compact:!0,get popupAlign(){return W(e)},get activity(){return W(t)},get rootModel(){return W(n)},get plan(){return W(o).plan},onopen:()=>k()(W(o).id)})}q(e,t)},T=L(()=>tT(W(o)));Y(C,e=>{W(T)&&e(w)});var E=H(C,2);Om(E,{compact:!0,full:!0,get disabled(){return W(h)},onclick:()=>A(W(o).id),children:(e,t)=>{F(),q(e,Jr(`Close`))},$$slots:{default:!0}});var D=H(E,2),ne=e=>{Om(e,{compact:!0,full:!0,get disabled(){return W(h)},onclick:()=>t.onforget(W(o).id),children:(e,t)=>{F();var n=Jr();U(()=>J(n,W(m).phase===`failed`?`Retry Forget`:`Forget`)),q(e,n)},$$slots:{default:!0}})};Y(D,e=>{W(m)&&e(ne)});var re=H(D,2);n(re,()=>W(o));var ie=H(re,2),ae=e=>{Om(e,{compact:!0,full:!0,onclick:()=>t.onopen(W(o).forgetOperation.blockingSessionId),children:(e,t)=>{F(),q(e,Jr(`Open blocking session`))},$$slots:{default:!0}})};Y(ie,e=>{W(o).forgetOperation?.blockingSessionId&&e(ae)}),P(v);var oe=H(v,2),se=B(oe);OE(se,()=>W(m));var ce=H(se,2);i(ce,()=>W(o));var le=H(ce,2),ue=B(le);oT(ue,{get status(){return W(o).sessionStatus}});var de=H(ue,2),fe=e=>{var t=RE(),n=B(t,!0);P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,r)},[()=>new Date(W(p).updatedAt).toISOString(),()=>wE(W(p).updatedAt)]),q(e,t)},pe=e=>{var t=zE(),n=B(t,!0);P(t),U(e=>J(n,e),[()=>wE(null)]),q(e,t)};Y(de,e=>{W(p).updatedAt===null?e(pe,-1):e(fe)});var me=H(de,2),he=B(me,!0);P(me);var ge=H(me,2),_e=e=>{var t=BE(),n=B(t);P(t),U(()=>J(n,`Model: ${W(o).model??``}`)),q(e,t)};Y(ge,e=>{W(o).model&&e(_e)});var ve=H(ge,2),ye=e=>{q(e,VE())};Y(ve,e=>{W(o).provider===`kimi`&&e(ye)});var be=H(ve,2),xe=e=>{var t=BE(),n=B(t);P(t),U(()=>J(n,`Branch: ${W(o).branch??``}`)),q(e,t)};Y(be,e=>{W(o).branch&&e(xe)});var Se=H(be,2),j=e=>{var t=BE(),n=B(t);P(t),U(()=>J(n,`Skills profile: ${W(o).effectiveSkillSelection.selectedProfileName??``}`)),q(e,t)};Y(Se,e=>{W(o).effectiveSkillSelection?.selectedProfileName&&e(j)}),kE(H(Se,2),()=>W(o)),P(le);var Ce=H(le,2);{let e=L(()=>d().get(W(o).id)??null),n=L(()=>`session-attention-${W(o).id}`),r=L(()=>W(h)||u().has(W(o).id)),i=L(()=>W(o).threadId&&t.onattentiondebug?(e,n)=>t.onattentiondebug?.(W(o).id,e,n):void 0);z_(Ce,{get attention(){return W(e)},get controlId(){return W(n)},get pending(){return W(r)},onresolve:(e,t)=>ee()(W(o).id,e,t),get ondebug(){return W(i)},get debugPending(){return te()}})}var we=H(Ce,2);{let e=L(()=>l().get(W(o).id)??W(o).autopilot??null),t=L(()=>d().get(W(o).id)??null),n=L(()=>`session-autopilot-safety-${W(o).id}`),r=L(()=>W(h)||u().has(W(o).id));bg(we,{get autopilot(){return W(e)},get attention(){return W(t)},get controlId(){return W(n)},get pending(){return W(r)},onrecover:()=>O()(W(o).id,!0),ondisable:()=>O()(W(o).id,!1)})}P(oe),P(g),U(e=>{_=Ei(g,1,`managed-session open-session svelte-hxb22h`,null,_,{"current-session":W(o).id===t.selectedSessionId}),Z(g,`aria-busy`,W(h)),Z(g,`data-session-id`,W(o).id),J(he,e)},[()=>iT(W(p).workspacePath)]),q(e,g)}),P(p),P(o),q(e,o)};Y(be,e=>{W(oe).length&&e(xe)});var Se=H(be,2),j=e=>{var a=GE();X(a,21,()=>W(se),e=>e.id,(e,a)=>{let o=L(()=>nT(W(a))),c=L(()=>s().get(W(a).id)??W(a).forgetOperation),l=L(()=>TE(W(c)));var u=WE(),d=B(u),f=B(d);{let e=L(()=>W(l)||t.openingSessionId===W(a).id);Om(f,{compact:!0,full:!0,get disabled(){return W(e)},onclick:()=>t.onopen(W(a).id),children:(e,n)=>{F();var r=Jr();U(()=>J(r,t.openingSessionId===W(a).id?`Opening…`:`Open`)),q(e,r)},$$slots:{default:!0}})}var p=H(f,2);r(p,()=>W(a));var m=H(p,2),h=e=>{Om(e,{compact:!0,full:!0,onclick:()=>t.oncopyresume(W(a).resumeCommand),children:(e,t)=>{F(),q(e,Jr(`Copy CLI`))},$$slots:{default:!0}})};Y(m,e=>{W(a).resumeCommand&&W(a).provider!==`kimi`&&e(h)});var g=H(m,2);Om(g,{compact:!0,full:!0,get disabled(){return W(l)},onclick:()=>t.onforget(W(a).id),children:(e,t)=>{F();var n=Jr();U(()=>J(n,W(c)?.phase===`failed`?`Retry Forget`:`Forget`)),q(e,n)},$$slots:{default:!0}});var _=H(g,2);n(_,()=>W(a));var v=H(_,2),y=e=>{Om(e,{compact:!0,full:!0,onclick:()=>t.onopen(W(a).forgetOperation.blockingSessionId),children:(e,t)=>{F(),q(e,Jr(`Open blocking session`))},$$slots:{default:!0}})};Y(v,e=>{W(a).forgetOperation?.blockingSessionId&&e(y)}),P(d);var b=H(d,2),x=B(b);OE(x,()=>W(c));var S=H(x,2);i(S,()=>W(a));var C=H(S,2),w=e=>{var t=RE(),n=B(t,!0);P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,r)},[()=>new Date(W(o).updatedAt).toISOString(),()=>wE(W(o).updatedAt)]),q(e,t)},T=e=>{var t=zE(),n=B(t,!0);P(t),U(e=>J(n,e),[()=>wE(null)]),q(e,t)};Y(C,e=>{W(o).updatedAt===null?e(T,-1):e(w)});var E=H(C,2),D=B(E,!0);P(E);var O=H(E,2),k=e=>{var t=BE(),n=B(t);P(t),U(()=>J(n,`Model: ${W(a).model??``}`)),q(e,t)};Y(O,e=>{W(a).model&&e(k)});var ee=H(O,2),te=e=>{q(e,VE())};Y(ee,e=>{W(a).provider===`kimi`&&e(te)});var ne=H(ee,2),re=e=>{var t=BE(),n=B(t);P(t),U(()=>J(n,`Branch: ${W(a).branch??``}`)),q(e,t)};Y(ne,e=>{W(a).branch&&e(re)});var ie=H(ne,2),ae=e=>{var t=BE(),n=B(t);P(t),U(()=>J(n,`Skills profile: ${W(a).effectiveSkillSelection.selectedProfileName??``}`)),q(e,t)};Y(ie,e=>{W(a).effectiveSkillSelection?.selectedProfileName&&e(ae)}),kE(H(ie,2),()=>W(a)),P(b),P(u),U(e=>{Z(u,`aria-busy`,W(l)),Z(u,`data-session-id`,W(a).id),J(D,e)},[()=>iT(W(o).workspacePath)]),q(e,u)}),P(a),q(e,a)},Ce=e=>{q(e,KE())};Y(Se,e=>{W(se).length?e(j):W(oe).length||e(Ce,1)});var we=H(Se,2),Te=e=>{var n=iD(),i=V(n),a=H(B(i),2),o=B(a);{let e=L(()=>W(le)?.id??null);CC(o,{get roots(){return t.workspaceTree},get expandedIds(){return t.expandedIds},get selectedId(){return W(e)},get isSelectable(){return uC.sessionBase},label:`Session base`,get onexpandedchange(){return t.onexpandedchange},onselect:e=>t.onworkspacechange(e.id)})}P(a);var s=H(a,2),c=B(s),l=H(B(c)),u=B(l);X(u,17,()=>t.skillProfiles,e=>e.name,(e,t)=>{var n=qE(),r=B(n,!0);P(n);var i={};U(()=>{J(r,W(t).name),i!==(i=W(t).name)&&(n.value=(n.__value=W(t).name)??``)}),q(e,n)});var d=H(u);d.value=d.__value=``,P(l);var b;Ai(l),P(c);var C=H(c,2),O=H(B(C)),k=B(O),ee=e=>{var t=JE();t.value=t.__value=``,q(e,t)},te=e=>{var t=YE();t.value=t.__value=``,q(e,t)};Y(k,e=>{T()?e(ee):f().length===0&&e(te,1)}),X(H(k),16,f,e=>e,(e,t)=>{var n=qE(),r=B(n,!0);P(n);var i={};U(()=>{J(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),q(e,n)}),P(O);var ae;Ai(O),P(C),P(s);var oe=H(s,2),ue=e=>{var n=XE(),r=B(n,!0);P(n),U(()=>J(r,t.skillProfileError)),q(e,n)};Y(oe,e=>{t.skillProfileError&&e(ue)});var de=H(oe,2),A=H(B(de),2),fe=B(A),pe=B(fe),me=B(pe),he=e=>{var t=ZE(),n=H(B(t),2),r=H(B(n));X(r,20,()=>[...new Set([g(),...h()])],e=>e,(e,t)=>{var n=qE(),r=B(n,!0);P(n);var i={};U(()=>{J(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),q(e,n)}),P(r);var i;Ai(r),P(n);var a=H(n,2),o=H(B(a));X(o,20,()=>qp,e=>e,(e,t)=>{var n=qE(),r=B(n,!0);P(n);var i={};U(()=>{J(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),q(e,n)}),P(o);var s;Ai(o),P(a),P(t),U(()=>{i!==(i=g())&&(r.value=(r.__value=g())??``,ki(r,g())),s!==(s=_())&&(o.value=(o.__value=_())??``,ki(o,_()))}),G(`change`,r,e=>y()(e.currentTarget.value)),G(`change`,o,e=>x()(e.currentTarget.value)),q(e,t)};Y(me,e=>{S()===`codex`&&e(he)});var ge=H(me,2),_e=H(B(ge),2),ve=e=>{var t=QE(),n=H(B(t));X(n,20,()=>qp,e=>e,(e,t)=>{var n=qE(),r=B(n,!0);P(n);var i={};U(()=>{J(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),q(e,n)}),P(n);var r;Ai(n),P(t),U(()=>{r!==(r=m())&&(n.value=(n.__value=m())??``,ki(n,m()))}),G(`change`,n,e=>v()(e.currentTarget.value)),q(e,t)};Y(_e,e=>{S()===`codex`&&e(ve)});var ye=H(_e,2),be=H(B(ye),2),xe=B(be);xe.value=xe.__value=`codex`;var Se=H(xe),j=B(Se);P(Se),Se.value=Se.__value=`kimi`,P(be);var Ce;Ai(be),P(ye),P(ge),P(pe);var we=H(pe,2);let Te;var Ee=B(we),De=e=>{var t=$E();F(2),q(e,t)};Y(Ee,e=>{S()!==`kimi`&&e(De)}),P(we);var Oe=H(we,2);let ke;var Ae=B(Oe),je=e=>{var n=eD(),r=V(n),i=B(r);i.value=i.__value=`workspace-git`;var a=H(i);a.value=a.__value=`workspace-write`;var o=H(a);o.value=o.__value=`read-only`;var s=H(o);s.value=s.__value=`danger-full-access`,P(r);var c;Ai(r);var l=H(r,2),u=B(l);u.value=u.__value=`untrusted`;var d=H(u);d.value=d.__value=`on-request`;var f=H(d);f.value=f.__value=`never`,P(l);var p;Ai(l),U(()=>{c!==(c=t.sandbox)&&(r.value=(r.__value=t.sandbox)??``,ki(r,t.sandbox)),p!==(p=t.approvalPolicy)&&(l.value=(l.__value=t.approvalPolicy)??``,ki(l,t.approvalPolicy))}),G(`change`,r,e=>t.onsandboxchange(e.currentTarget.value)),G(`change`,l,e=>t.onapprovalpolicychange(e.currentTarget.value)),q(e,n)};Y(Ae,e=>{S()!==`kimi`&&e(je)}),P(Oe);var Me=H(Oe,2),Ne=B(Me);Om(Ne,{class:`manage-profiles-button`,id:`manage-skill-profiles`,onclick:e=>t.onmanageprofiles(e.currentTarget),children:(e,t)=>{F(),q(e,Jr(`Manage skill profiles`))},$$slots:{default:!0}});var Pe=H(Ne,2);{let e=L(()=>ne()||T()||!p());Om(Pe,{class:`save-defaults-button`,get disabled(){return W(e)},get onclick(){return ie()},children:(e,t)=>{F();var n=Jr();U(()=>J(n,ne()?`Saving…`:`Save as defaults`)),q(e,n)},$$slots:{default:!0}})}P(Me),P(fe),P(A),P(de);var Fe=H(de,2),Ie=B(Fe),Le=e=>{Om(e,{type:`button`,onclick:()=>t.onopen(t.workspaceConflictSessionId),children:(e,t)=>{F(),q(e,Jr(`Open running session`))},$$slots:{default:!0}})};Y(Ie,e=>{t.workspaceConflictSessionId&&e(Le)});var Re=H(Ie,2);{let e=L(()=>!W(le)||t.startingSession||T()||f().length>0&&!p());Om(Re,{class:`new-session-button`,type:`submit`,full:!0,primary:!0,get disabled(){return W(e)},children:(e,n)=>{F();var r=Jr();U(()=>J(r,t.startingSession?`Creating…`:`Create session`)),q(e,r)},$$slots:{default:!0}})}P(Fe),P(i);var ze=H(i,2),Be=H(B(ze),2),M=e=>{var n=nD();X(n,21,()=>W(ce),e=>(e.provider??`codex`)+`:`+e.id,(e,n)=>{let i=L(()=>W(se).find(e=>e.threadId===W(n).id&&(e.provider??`codex`)===(W(n).provider??`codex`)&&tT(e)));var a=tD(),o=B(a),s=B(o),c=e=>{var t=RE(),r=B(t,!0);P(t),U((e,n)=>{Z(t,`datetime`,e),J(r,n)},[()=>new Date(W(n).recencyAt*1e3).toISOString(),()=>wE(W(n).recencyAt*1e3)]),q(e,t)},l=e=>{var t=zE(),n=B(t,!0);P(t),U(e=>J(n,e),[()=>wE(null)]),q(e,t)};Y(s,e=>{W(n).recencyAt===null?e(l,-1):e(c)});var u=H(s,2),d=B(u,!0);P(u);var f=H(u,2),p=e=>{var t=BE(),r=B(t);P(t),U(()=>J(r,`Model: ${W(n).model??``}`)),q(e,t)};Y(f,e=>{W(n).model&&e(p)});var m=H(f,2),h=e=>{q(e,VE())};Y(m,e=>{W(n).provider===`kimi`&&e(h)});var g=H(m,2),_=e=>{var t=BE(),r=B(t);P(t),U(()=>J(r,`Skills profile: ${W(n).skillProfile??``}`)),q(e,t)};Y(g,e=>{W(n).skillProfile&&e(_)});var v=H(g,2),y=e=>{var t=BE(),r=B(t);P(t),U(()=>J(r,`Org plan: ${W(n).orgPlanFilename??``}`)),q(e,t)};Y(v,e=>{W(n).orgPlanFilename&&e(y)}),P(o);var b=H(o,2),x=B(b);Om(x,{onclick:()=>t.onopenrecent(W(n)),children:(e,t)=>{F(),q(e,Jr(`Open`))},$$slots:{default:!0}});var S=H(x,2);r(S,()=>W(i),()=>!1);var C=H(S,2),w=e=>{Om(e,{onclick:()=>t.oncopyresume(W(n).resumeCommand),children:(e,t)=>{F(),q(e,Jr(`Copy to CLI`))},$$slots:{default:!0}})};Y(C,e=>{W(n).resumeCommand&&e(w)}),P(b),P(a),U(e=>J(d,e),[()=>iT(W(n).cwd)]),q(e,a)}),P(n),q(e,n)},Ve=e=>{q(e,rD())};Y(Be,e=>{W(ce).length?e(M):e(Ve,-1)}),P(ze),U(()=>{b!==(b=t.selectedSkillProfile)&&(l.value=(l.__value=t.selectedSkillProfile)??``,ki(l,t.selectedSkillProfile)),O.disabled=T()||f().length===0,ae!==(ae=p())&&(O.value=(O.__value=p())??``,ki(O,p())),Se.disabled=!w(),J(j,`Kimi${w()?``:` (unavailable)`}`),Ce!==(Ce=S())&&(be.value=(be.__value=S())??``,ki(be,S())),Te=Oi(we,``,Te,{"grid-template-columns":S()===`kimi`?`minmax(0, 1fr)`:`repeat(2, minmax(0, 1fr))`}),ke=Oi(Oe,``,ke,{"grid-template-columns":S()===`kimi`?`minmax(0, 1fr)`:`repeat(2, minmax(0, 1fr))`})}),Br(`submit`,i,e=>{e.preventDefault(),t.onstart()}),G(`change`,l,e=>t.onskillprofilechange(e.currentTarget.value)),G(`change`,O,e=>E()(e.currentTarget.value)),G(`change`,be,e=>D()(e.currentTarget.value)),Ji(`open`,`toggle`,de,re,re),q(e,n)};Y(we,e=>{a()||e(Te)}),P(ge),U(()=>_e=Ei(ge,1,`svelte-hxb22h`,null,_e,{"roster-only":a()})),Br(`close`,pe,()=>z(de,null)),q(e,fe),$e()}Vr([`click`,`change`]);function sD(e){let t={};return e.workspaceId||(t.workspaceId=`Choose a workspace.`),e.profile||(t.profile=`Choose a profile.`),e.profile&&e.profileState&&e.profileState!==`ok`&&(t.profile=`Sign in to this profile before starting Codex.`),t}var cD=class{transport;key;onChange;onFailure;#e={starting:!1,error:null};#t=0;#n=!1;#r=null;constructor(e,t,n,r){this.transport=e,this.key=t,this.onChange=n,this.onFailure=r}get state(){return this.#e}async start(e,t){if(this.#n||this.#e.starting||!e)return null;let n=++this.#t;this.#a({starting:!0,error:null});let r=this.#r??=this.key();try{let i=await this.transport.start(e,t,r);return this.#i(n)&&(this.#r=null),this.#i(n)?i:null}catch(t){return this.#i(n)&&(this.#a({starting:!1,error:t instanceof Error?t.message:`Could not start session.`,...t instanceof Error&&`code`in t&&t.code===`SESSION_WORKSPACE_BUSY`&&`sessionId`in t&&typeof t.sessionId==`string`?{conflict:{workspaceId:e,sessionId:t.sessionId}}:{}}),this.onFailure?.(t)),null}finally{this.#i(n)&&this.#a({...this.#e,starting:!1})}}dispose(){this.#n=!0,++this.#t}#i(e){return!this.#n&&e===this.#t}#a(e){this.#n||(this.#e=e,this.onChange(e))}};function lD({chatEnabled:e}){return[`sessions`,`git`,...e?[`chat`]:[],`plan`]}function uD(e,t,n={chatEnabled:!0}){let r=lD(n);return r[(r.indexOf(e)+t+r.length)%r.length]}var dD=K(`<nav class="bottom-navigation" aria-label="Primary"><button>Sessions</button> <button>Git</button> <button>Chat</button> <button>Plan</button></nav>`);function fD(e,t){I(t,!0);let n=Q(t,`focusTab`,3,null),r=cn({});Pn(()=>{n()&&r[n()]?.focus()});function i(e){let n=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:null;if(n===null)return;e.preventDefault();let i=uD(t.activeTab,n,{chatEnabled:t.chatEnabled});t.onselect(i),r[i]?.focus()}var a=dD(),o=B(a);qi(o,e=>r.sessions=e,()=>r?.sessions);var s=H(o,2);qi(s,e=>r.git=e,()=>r?.git);var c=H(s,2);qi(c,e=>r.chat=e,()=>r?.chat);var l=H(c,2);qi(l,e=>r.plan=e,()=>r?.plan),P(a),U(()=>{Z(o,`aria-pressed`,t.activeTab===`sessions`),Z(s,`aria-pressed`,t.activeTab===`git`),Z(c,`aria-pressed`,t.activeTab===`chat`),c.disabled=!t.chatEnabled,Z(l,`aria-pressed`,t.activeTab===`plan`)}),G(`keydown`,o,i),G(`click`,o,()=>t.onselect(`sessions`)),G(`keydown`,s,i),G(`click`,s,()=>t.onselect(`git`)),G(`keydown`,c,i),G(`click`,c,()=>t.onselect(`chat`)),G(`keydown`,l,i),G(`click`,l,()=>t.onselect(`plan`)),q(e,a),$e()}Vr([`keydown`,`click`]);var pD=K(`<option> </option>`),mD=K(`<p id="skills-status" aria-live="polite">Loading skills…</p>`),hD=K(`<p id="skills-status">No skills were discovered for this workspace and Codex profile.</p>`),gD=K(`<p id="skills-status" class="notice svelte-dg6sjj" role="status"> </p>`),_D=K(`<p id="skills-status" class="error svelte-dg6sjj" role="alert"> </p>`),vD=K(`<p id="skills-status" role="status" tabindex="-1"> </p>`),yD=K(`<p id="skills-status" role="status">Profile saved.</p>`),bD=K(`<p id="skills-status" role="status">Profile deleted.</p>`),xD=K(`<li class="svelte-dg6sjj"><div class="svelte-dg6sjj"><strong> </strong> <span class="missing-state svelte-dg6sjj">Missing · disabled</span> <span class="path svelte-dg6sjj"> </span></div> <button type="button" class="remove-missing svelte-dg6sjj">Remove</button></li>`),SD=K(`<section class="missing-skills svelte-dg6sjj" aria-labelledby="missing-skills-title"><h3 id="missing-skills-title" class="svelte-dg6sjj">Missing skills</h3> <p class="svelte-dg6sjj">These saved paths no longer exist. They are disabled for new sessions until restored or
|
|
164
|
-
removed from the profile.</p> <ul class="svelte-dg6sjj"></ul></section>`),CD=K(`<span class="verified-badge svelte-dg6sjj">Gestalt verified</span>`),wD=K(`<p class="svelte-dg6sjj"> </p>`),TD=K(`<li> </li>`),ED=K(`<dt class="svelte-dg6sjj">Tool dependencies</dt> <dd class="svelte-dg6sjj"><ul class="svelte-dg6sjj"></ul></dd>`,1),DD=K(`<li class="skill-card svelte-dg6sjj"><label class="skill-toggle svelte-dg6sjj"><input type="checkbox" class="svelte-dg6sjj"/> <span class="skill-name svelte-dg6sjj"><span class="svelte-dg6sjj"> </span> <!></span> <span class="state svelte-dg6sjj"> </span></label> <div class="skill-details svelte-dg6sjj"><!> <!> <dl class="svelte-dg6sjj"><dt class="svelte-dg6sjj">Path</dt> <dd class="path svelte-dg6sjj"> </dd> <!></dl></div></li>`),OD=K(`<div class="skills-toolbar svelte-dg6sjj"><button type="button" class="refresh-skills svelte-dg6sjj" aria-label="Refresh skills"><span aria-hidden="true" class="svelte-dg6sjj">↻</span><span class="svelte-dg6sjj">Refresh</span></button> <p class="summary svelte-dg6sjj"> </p></div> <!> <ul class="skill-list svelte-dg6sjj"></ul>`,1),kD=K(`<section class="skills-view svelte-dg6sjj" aria-labelledby="skills-title"><h2 id="skills-title"> </h2> <p class="intro svelte-dg6sjj">Create or edit a complete skills selection.</p> <form aria-describedby="skills-status" class="svelte-dg6sjj"><div class="field-grid svelte-dg6sjj"><label for="skills-existing-profile" class="svelte-dg6sjj">Skill profile</label> <select id="skills-existing-profile" class="svelte-dg6sjj"><option>New profile</option><!><option>None</option></select> <label for="skills-save-as" class="svelte-dg6sjj">Save as</label> <input id="skills-save-as" name="save-as" autocomplete="off" class="svelte-dg6sjj"/></div> <p class="save-intent svelte-dg6sjj" aria-live="polite"> </p> <fieldset class="browser-access svelte-dg6sjj" aria-describedby="browser-help browser-status"><legend class="svelte-dg6sjj">Browser access</legend> <label class="browser-toggle svelte-dg6sjj" for="skills-playwright"><input id="skills-playwright" type="checkbox" class="svelte-dg6sjj"/> <span class="svelte-dg6sjj">Browser access (Playwright)</span></label> <p id="browser-status" role="status" class="svelte-dg6sjj"> </p> <p id="browser-help" class="svelte-dg6sjj">Allow the Gestalt host to start Playwright when a Codex supervisor or active plan requests
|
|
165
|
-
it. Enabling this option does not start a browser immediately. Login state is stored in a
|
|
166
|
-
dedicated browser profile for this workspace, separate from your personal browser. Host
|
|
167
|
-
browser access follows MCP permissions, beyond the agent shell sandbox. Kimi cannot use this
|
|
168
|
-
capability.</p></fieldset> <div class="profile-actions svelte-dg6sjj"><button type="button" class="svelte-dg6sjj">Delete profile</button> <button type="submit" class="svelte-dg6sjj"> </button></div></form> <dialog aria-labelledby="delete-profile-title" class="svelte-dg6sjj"><h3 id="delete-profile-title">Delete skill profile?</h3> <p> </p> <div class="dialog-actions svelte-dg6sjj"><button type="button" class="svelte-dg6sjj">Cancel</button> <button type="button" class="svelte-dg6sjj">Delete profile</button></div></dialog> <!> <!></section>`);function AD(e,t){I(t,!0);let n=Q(t,`skillsState`,7),r=Q(t,`heading`,3,`Manage skill profiles`),i=R(0),a=R(null),o=R(null),s=R(null),c=R(null),l=R(`__new__`),u=L(()=>(W(i),n())),d=L(()=>W(u).profiles.filter(e=>!(`error`in e)));function f(){n(Object.assign(Object.create(Object.getPrototypeOf(n())),n())),z(i,W(i)+1)}async function p(){await t.onrefresh(W(u)),f()}function m(e){z(l,e.currentTarget.value,!0),W(l)===`__new__`||W(l)===`__none__`?W(u).selectDefaultProfile(W(l)===`__none__`):W(u).selectProfile(W(l)),f()}async function h(e){e.preventDefault(),await W(u).save(),f(),W(u).status.kind===`saved`&&(z(l,W(u).selectedProfileName,!0),t.onprofileschange()),W(u).status.kind===`save-failed`&&(await Or(),W(a)?.focus())}function g(){W(c)?.showModal()}async function _(){W(c)?.close(),await W(u).deleteSelectedProfile(),f(),W(u).status.kind===`deleted`&&(z(l,`__new__`),t.onprofileschange()),await Or(),W(o)?.focus()}async function v(){W(c)?.close(),await Or(),W(s)?.focus()}function y(e){return e&&/^#[0-9a-f]{3,8}$/i.test(e)?e:void 0}function b(e){return e.replace(/^\/(?:home|Users)\/[^/]+(?=\/|$)/,`~`)}function x(e){let t=e.currentTarget,n=t.closest(`.skill-card`);requestAnimationFrame(()=>{t.isConnected&&document.activeElement===t&&n?.scrollIntoView({block:`nearest`,inline:`nearest`})})}var S=kD(),C=B(S),w=B(C,!0);P(C);var T=H(C,4),E=B(T),D=H(B(E),2),O=B(D);O.value=O.__value=`__new__`;var k=H(O);X(k,17,()=>W(d),e=>e.name,(e,t)=>{var n=pD(),r=B(n,!0);P(n);var i={};U(()=>{J(r,W(t).name),i!==(i=W(t).name)&&(n.value=(n.__value=W(t).name)??``)}),q(e,n)});var ee=H(k);ee.value=ee.__value=`__none__`,P(D),qi(D,e=>z(o,e),()=>W(o));var te=H(D,4);Li(te),P(E);var ne=H(E,2),re=B(ne,!0);P(ne);var ie=H(ne,2),ae=H(B(ie),2),oe=B(ae);Li(oe),F(2),P(ae);var se=H(ae,2),ce=B(se,!0);P(se),F(2),P(ie);var le=H(ie,2),ue=B(le);qi(ue,e=>z(s,e),()=>W(s));var de=H(ue,2),A=B(de,!0);P(de),P(le),P(T);var fe=H(T,2),pe=H(B(fe),2),me=B(pe);P(pe);var he=H(pe,2),ge=B(he),_e=H(ge,2);P(he),P(fe),qi(fe,e=>z(c,e),()=>W(c));var ve=H(fe,2),ye=e=>{q(e,mD())},be=e=>{q(e,hD())},xe=e=>{var t=gD(),n=B(t);P(t),U(()=>J(n,`Discovery warning: ${W(u).status.message??``}`)),q(e,t)},Se=e=>{var t=_D(),n=B(t,!0);P(t),U(()=>J(n,W(u).status.message)),q(e,t)},j=e=>{var t=vD(),n=B(t,!0);P(t),qi(t,e=>z(a,e),()=>W(a)),U(()=>J(n,W(u).status.message)),q(e,t)},Ce=e=>{q(e,yD())},we=e=>{q(e,bD())},Te=e=>{var t=_D(),n=B(t,!0);P(t),U(()=>J(n,W(u).status.message)),q(e,t)};Y(ve,e=>{W(u).status.kind===`loading`?e(ye):W(u).status.kind===`empty`?e(be,1):W(u).status.kind===`warning`?e(xe,2):W(u).status.kind===`invalid-profile`||W(u).status.kind===`error`?e(Se,3):W(u).status.kind===`save-failed`?e(j,4):W(u).status.kind===`saved`?e(Ce,5):W(u).status.kind===`deleted`?e(we,6):W(u).status.kind===`delete-failed`&&e(Te,7)});var Ee=H(ve,2),De=e=>{var t=OD(),n=V(t),r=B(n),i=H(r,2),a=B(i);P(i),P(n);var o=H(n,2),s=e=>{var t=SD(),n=H(B(t),4);X(n,21,()=>W(u).missingSkills,e=>e.path,(e,t)=>{var n=xD(),r=B(n),i=B(r),a=B(i,!0);P(i);var o=H(i,4),s=B(o,!0);P(o),P(r);var c=H(r,2);P(n),U(e=>{J(a,W(t).name),J(s,e),Z(c,`aria-label`,`Remove missing skill ${W(t).name} from profile`)},[()=>b(W(t).path)]),G(`click`,c,()=>{W(u).removeMissingSkill(W(t).path),f()}),q(e,n)}),P(n),P(t),q(e,t)};Y(o,e=>{W(u).missingSkills.length>0&&e(s)});var c=H(o,2);X(c,21,()=>W(u).skills,e=>e.path,(e,t)=>{var n=DD();let r;var i=B(n),a=B(i);Li(a);var o=H(a,2),s=B(o),c=B(s,!0);P(s);var l=H(s,2),d=e=>{q(e,CD())};Y(l,e=>{W(t).provenance?.kind===`gestalt-verified`&&!W(t).alwaysAdvertised&&e(d)}),P(o);var p=H(o,2),m=B(p,!0);P(p),P(i);var h=H(i,2),g=B(h),_=e=>{var n=wD(),r=B(n,!0);P(n),U(()=>J(r,W(t).description)),q(e,n)};Y(g,e=>{W(t).description&&e(_)});var v=H(g,2),S=e=>{var n=wD(),r=B(n,!0);P(n),U(()=>J(r,W(t).shortDescription)),q(e,n)};Y(v,e=>{W(t).shortDescription&&e(S)});var C=H(v,2),w=H(B(C),2),T=B(w,!0);P(w);var E=H(w,2),D=e=>{var n=ED(),r=H(V(n),2),i=B(r);X(i,21,()=>W(t).dependencies.tools,e=>`${e.type}:${e.value}`,(e,t)=>{var n=TD(),r=B(n);P(n),U(()=>J(r,`${W(t).type??``}: ${W(t).value??``}${W(t).description?` — ${W(t).description}`:``}`)),q(e,n)}),P(i),P(r),q(e,n)};Y(E,e=>{W(t).dependencies?.tools?.length&&e(D)}),P(C),P(h),P(n),U((e,o)=>{r=Oi(n,``,r,e),Z(i,`for`,`skill-${W(t).path}`),Z(a,`id`,`skill-${W(t).path}`),zi(a,W(t).enabled),a.disabled=W(t).alwaysAdvertised,J(c,W(t).displayName??W(t).name),J(m,W(t).alwaysAdvertised?`Always advertised`:W(t).enabled?`Enabled`:`Disabled`),J(T,o)},[()=>({"--brand-color":y(W(t).brandColor)}),()=>b(W(t).path)]),Br(`focus`,a,x),G(`change`,a,e=>{W(u).toggle(W(t).path,e.currentTarget.checked),f()}),q(e,n)}),P(c),U(()=>J(a,`${W(u).enabledCount??``} of ${W(u).skills.length??``} skills enabled.`)),G(`click`,r,()=>void p()),q(e,t)};Y(Ee,e=>{(W(u).skills.length>0||W(u).missingSkills.length>0)&&e(De)}),P(S),U(()=>{J(w,r()),Ri(te,W(u).saveAsName),J(re,W(u).saveIntent===`replace`?`Saved the selected profile.`:`Creating a new saved profile.`),zi(oe,W(u).playwrightEnabled),J(ce,W(u).playwrightEnabled?`Configured · runtime unavailable`:`Off · browser access disabled`),ue.disabled=!W(u).selectedProfileName||W(u).status.kind===`deleting`,de.disabled=W(u).status.kind===`saving`,J(A,W(u).status.kind===`saving`?`Saving profile…`:`Save profile`),J(me,`Delete ${W(u).selectedProfileName??``}? Existing sessions keep their saved skill set.`)}),Br(`submit`,T,h),G(`change`,D,m),ji(D,()=>W(l),e=>z(l,e)),G(`input`,te,e=>{W(u).saveAsName=e.currentTarget.value,f()}),G(`change`,oe,e=>{W(u).setPlaywrightEnabled(e.currentTarget.checked),f()}),G(`click`,ue,g),G(`click`,ge,()=>void v()),G(`click`,_e,()=>void _()),q(e,S),$e()}Vr([`change`,`input`,`click`]);var jD=class{client;onerror;workspaceId=``;codexProfile=``;selectedProfileName=``;saveAsName=``;source=`native`;skills=[];missingSkills=[];profiles=[];status={kind:`idle`};playwrightEnabled=!1;explicitCapabilities=!1;browserBaseline=!1;capabilitiesBaseline=!1;defaultPlaywrightEnabled=!1;defaultExplicitCapabilities=!1;emptyDraft=!1;baseline=new Map;missingBaseline=new Map;removedMissingPaths=new Set;saving=!1;deleting=!1;request=null;generation=0;disposed=!1;constructor(e,t=()=>void 0){this.client=e,this.onerror=t}get enabledCount(){return this.skills.filter(e=>e.enabled).length}get dirty(){return this.playwrightEnabled!==this.browserBaseline||this.explicitCapabilities!==this.capabilitiesBaseline||this.skills.some(e=>this.baseline.get(e.path)!==e.enabled)||this.missingSkills.some(e=>this.missingBaseline.get(e.path)?.enabled!==e.enabled)||[...this.missingBaseline].some(([e])=>!this.missingSkills.some(t=>t.path===e)&&!this.skills.some(t=>t.path===e))}get saveIntent(){return this.profiles.some(e=>!(`error`in e)&&e.name===this.saveAsName.trim())?`replace`:`create`}async load(e,t){let n=this.beginRequest(),r=this.generation;this.workspaceId=e,this.codexProfile=t,this.status={kind:`loading`};try{let[i,a]=await Promise.all([this.client.listAvailableSkills(e,t,!0,n.signal),this.client.listSkillProfiles(n.signal)]);if(!this.current(r,n))return;this.applyAvailable(i),this.profiles=a.profiles.map(e=>`error`in e?e:{...e,skills:e.skills.filter(e=>!MD(e.name))});let o=a.profiles.find(e=>`error`in e);o&&`error`in o?this.status={kind:`invalid-profile`,message:o.error.message}:i.errors.length?this.status={kind:`warning`,message:i.errors.map(e=>e.message).join(` `)}:this.status=this.skills.length?{kind:`ready`}:{kind:`empty`}}catch(e){if(!this.current(r,n)||n.signal.aborted)return;this.status={kind:`error`,message:ND(e)},this.onerror(this.status.message)}}async refresh(){let e=this.beginRequest(),t=this.generation;this.status={kind:`loading`};try{let n=await this.client.listAvailableSkills(this.workspaceId,this.codexProfile,!0,e.signal);if(!this.current(t,e))return;this.applyAvailable(n),this.status=this.missingSkills.length?this.missingSkillsStatus():n.errors.length?{kind:`warning`,message:n.errors.map(e=>e.message).join(` `)}:this.skills.length?{kind:`ready`}:{kind:`empty`}}catch(n){if(!this.current(t,e)||e.signal.aborted)return;this.status={kind:`error`,message:ND(n)},this.onerror(this.status.message)}}selectProfile(e){let t=this.profiles.find(t=>!(`error`in t)&&t.name===e);if(!t||`error`in t){this.status={kind:`invalid-profile`,message:`Select a valid saved profile.`};return}this.selectedProfileName=t.name,this.emptyDraft=!1,this.removedMissingPaths.clear(),this.saveAsName=t.name,this.playwrightEnabled=t.capabilities?.playwright.enabled??!1,this.explicitCapabilities=t.capabilities!==void 0,this.browserBaseline=this.playwrightEnabled,this.capabilitiesBaseline=this.explicitCapabilities;let n=new Map(t.skills.map(e=>[e.path,e.enabled])),r=new Set(this.skills.map(e=>e.path)),i=t.skills.filter(e=>!r.has(e.path));this.skills=this.skills.map(e=>({...e,enabled:n.get(e.path)??!1})),this.missingSkills=i.map(e=>({...e,enabled:!1})),this.baseline=new Map(this.skills.map(e=>[e.path,e.enabled])),this.missingBaseline=new Map(i.map(e=>[e.path,{...e}])),this.status=this.missingSkills.length?this.missingSkillsStatus():this.skills.length?{kind:`ready`}:{kind:`empty`}}selectDefaultProfile(e=!1){this.removedMissingPaths.clear(),this.emptyDraft=e,this.selectedProfileName=``,this.saveAsName=``,this.playwrightEnabled=!e&&this.defaultPlaywrightEnabled,this.explicitCapabilities=!e&&this.defaultExplicitCapabilities,this.missingSkills=[],this.skills=this.skills.map(t=>({...t,enabled:!e&&t.effectiveEnabled})),this.captureBaseline(),this.status=this.skills.length?{kind:`ready`}:{kind:`empty`}}toggle(e,t){this.skills=this.skills.map(n=>n.path===e&&!n.alwaysAdvertised?{...n,enabled:t}:n)}setPlaywrightEnabled(e){this.playwrightEnabled=e,this.explicitCapabilities=!0}removeMissingSkill(e){this.missingSkills.some(t=>t.path===e)&&this.removedMissingPaths.add(e),this.missingSkills=this.missingSkills.filter(t=>t.path!==e),this.status=this.missingSkills.length?this.missingSkillsStatus():this.skills.length?{kind:`ready`}:{kind:`empty`}}reset(){this.removedMissingPaths.clear(),this.playwrightEnabled=this.browserBaseline,this.explicitCapabilities=this.capabilitiesBaseline,this.skills=this.skills.map(e=>({...e,enabled:this.baseline.get(e.path)??!1}));let e=new Set(this.skills.map(e=>e.path));this.missingSkills=[...this.missingBaseline.values()].filter(t=>!e.has(t.path)).map(e=>({...e,enabled:!1})),this.missingSkills.length&&(this.status=this.missingSkillsStatus())}async save(){let e=this.saveAsName.trim();if(this.saving||this.deleting)return;if(!e){this.status={kind:`save-failed`,message:`Enter a profile name before saving.`},this.onerror(this.status.message);return}this.saving=!0,this.status={kind:`saving`};let t=this.savePayload(e);try{let n=await this.client.replaceSkillProfile(e,t);this.profiles=[...this.profiles.filter(e=>`error`in e||e.name!==n.name),n].sort((e,t)=>e.name.localeCompare(t.name)),this.selectedProfileName=n.name,this.emptyDraft=!1,this.saveAsName=n.name,this.captureBaseline(),this.status={kind:`saved`}}catch(e){this.status={kind:`save-failed`,message:ND(e)},this.onerror(this.status.message)}finally{this.saving=!1}}async deleteSelectedProfile(){let e=this.selectedProfileName;if(!(this.saving||this.deleting)){if(!e){this.status={kind:`delete-failed`,message:`Select a saved profile before deleting.`},this.onerror(this.status.message);return}this.deleting=!0,this.status={kind:`deleting`};try{await this.client.deleteSkillProfile(e),this.profiles=this.profiles.filter(t=>`error`in t||t.name!==e),this.selectedProfileName=``,this.emptyDraft=!1,this.saveAsName=``,this.playwrightEnabled=this.defaultPlaywrightEnabled,this.explicitCapabilities=this.defaultExplicitCapabilities,this.missingSkills=[],this.captureBaseline(),this.status={kind:`deleted`}}catch(e){this.status={kind:`delete-failed`,message:ND(e)},this.onerror(this.status.message)}finally{this.deleting=!1}}}dispose(){this.disposed=!0,++this.generation,this.request?.abort(),this.request=null}beginRequest(){return this.request?.abort(),this.request=new AbortController,++this.generation,this.request}current(e,t){return!this.disposed&&e===this.generation&&this.request===t}savePayload(e=this.saveAsName.trim()){return{version:this.explicitCapabilities?2:1,...this.explicitCapabilities?{capabilities:{playwright:{enabled:this.playwrightEnabled}}}:{},name:e,skills:this.skills.map(({name:e,path:t,enabled:n})=>({name:e,path:t,enabled:n})).concat(this.missingSkills).sort((e,t)=>e.path.localeCompare(t.path))}}applyAvailable(e){let t=new Map(this.skills.filter(e=>this.baseline.get(e.path)!==e.enabled).map(e=>[e.path,e.enabled])),n=new Map(this.missingSkills.map(e=>[e.path,e.enabled])),r=this.profiles.find(e=>!(`error`in e)&&e.name===this.selectedProfileName),i=r&&!(`error`in r)?r.skills:void 0,a=i?new Map(i.map(e=>[e.path,e.enabled])):void 0;this.source=e.source,this.defaultPlaywrightEnabled=e.capabilities?.playwright.enabled??!1,this.defaultExplicitCapabilities=e.capabilities!==void 0,!this.selectedProfileName&&!this.emptyDraft&&this.playwrightEnabled===this.browserBaseline&&this.explicitCapabilities===this.capabilitiesBaseline&&(this.playwrightEnabled=this.defaultPlaywrightEnabled,this.explicitCapabilities=this.defaultExplicitCapabilities,this.browserBaseline=this.playwrightEnabled,this.capabilitiesBaseline=this.explicitCapabilities);let o=e.skills.filter(e=>!e.alwaysAdvertised&&!MD(e.name)).sort((e,t)=>Number(t.provenance?.kind===`gestalt-verified`)-Number(e.provenance?.kind===`gestalt-verified`));this.skills=o.map(e=>({...e,enabled:t.get(e.path)??n.get(e.path)??(this.removedMissingPaths.has(e.path)?!1:a?a.get(e.path)??!1:!this.emptyDraft&&e.effectiveEnabled)}));let s=new Set(o.map(e=>e.path));this.missingSkills=i?i.filter(e=>!s.has(e.path)&&!this.removedMissingPaths.has(e.path)).map(e=>({...e,enabled:!1})):this.missingSkills.filter(e=>!s.has(e.path));for(let e of i??[])!s.has(e.path)&&!this.missingBaseline.has(e.path)&&this.missingBaseline.set(e.path,{...e});this.baseline=new Map(o.map(e=>[e.path,this.baseline.get(e.path)??(a?a.get(e.path)??!1:!this.emptyDraft&&e.effectiveEnabled)]))}captureBaseline(){this.removedMissingPaths.clear(),this.browserBaseline=this.playwrightEnabled,this.capabilitiesBaseline=this.explicitCapabilities,this.baseline=new Map(this.skills.map(e=>[e.path,e.enabled])),this.missingBaseline=new Map(this.missingSkills.map(e=>[e.path,{...e}]))}missingSkillsStatus(){let e=this.missingSkills.length;return{kind:`warning`,message:`${e} saved ${e===1?`skill is`:`skills are`} missing and disabled. Remove ${e===1?`it`:`them`} from this profile, or restore the skill installation.`}}};function MD(e){return e.startsWith(`gestalt:`)}function ND(e){return e instanceof Error?e.message:`Unknown relay error.`}var PD=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),FD=o((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),ID=o((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),LD=o(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),RD=o(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),zD=o((e=>{var t=FD().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),BD=o((e=>{var t=FD().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),VD=o((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),HD=o((e=>{var t=ID(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),UD=o((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),WD=o((e=>{var t=UD();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),GD=o(((e,t)=>{var n=WD();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),KD=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),qD=o((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
|
|
169
|
-
]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),JD=o((e=>{var t=KD(),n=qD();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),YD=o((e=>{var t=FD(),n=HD(),r=ID(),i=JD(),a=KD(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),XD=o((e=>{var t=FD(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),ZD=o(((e,t)=>{var n=JD();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),QD=o(((e,t)=>{var n=JD(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),$D=o(((e,t)=>{var n=JD();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),eO=o(((e,t)=>{var n=JD(),r=FD();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
|
|
170
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),tO=o(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),nO=o((e=>{var t=JD(),n=ZD(),r=QD(),i=$D(),a=eO(),o=qD(),s=FD(),c=tO();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
|
|
171
|
-
Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),rO=o((e=>{var t=FD(),n=ID(),r=LD(),i=RD(),a=zD(),o=BD(),s=VD(),c=HD(),l=GD(),u=YD(),d=XD(),f=JD(),p=nO();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
|
|
172
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
173
|
-
Minimum version required to store current data is: `+c+`.
|
|
174
|
-
`);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),iO=o((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),aO=o((e=>{var t=iO();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),oO=o((e=>{var t=iO();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
|
|
175
|
-
`;return typeof a==`function`&&a(null,p),p}})),sO=c(o((e=>{var t=PD(),n=rO(),r=aO(),i=oO();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function cO(e){return`${e.replace(/\/$/,``)}/?bootstrap=1`}async function lO(e){return sO.toDataURL(cO(e),{errorCorrectionLevel:`M`,margin:1,width:256})}async function uO(e){return sO.toDataURL(e,{errorCorrectionLevel:`M`,margin:1,width:256})}var dO=K(`<p class="feedback svelte-1nygetn" role="status"> </p>`),fO=K(`<span class="svelte-1nygetn">At least one authorized device is required.</span>`),pO=K(`<li class="svelte-1nygetn"><form class="svelte-1nygetn"><label class="svelte-1nygetn">Nickname</label><input name="nickname" class="svelte-1nygetn"/> <p class="svelte-1nygetn"> <!><!></p> <button type="submit" class="svelte-1nygetn">Rename</button> <button type="button" class="svelte-1nygetn">Revoke</button> <!></form></li>`),mO=K(`<ul aria-label="Authorized devices" class="svelte-1nygetn"></ul>`),hO=K(`<p role="status" class="svelte-1nygetn">No authorized devices are available. Refresh this page before making changes.</p>`),gO=K(`<button type="button" class="svelte-1nygetn">Create enrollment link</button>`),_O=K(`<img alt="QR code for the enrollment link" class="svelte-1nygetn"/>`),vO=K(`<p role="status" class="svelte-1nygetn"> </p> <!> <label for="enrollment-link" class="svelte-1nygetn">Enrollment link</label><textarea id="enrollment-link" readonly="" rows="3" class="svelte-1nygetn"></textarea> <div class="actions svelte-1nygetn"><button type="button" class="svelte-1nygetn">Copy enrollment link</button><button type="button" class="svelte-1nygetn">Create passkey here</button><button type="button" class="svelte-1nygetn">Cancel link</button><button type="button" class="svelte-1nygetn">Replace link</button></div>`,1),yO=K(`<main class="devices svelte-1nygetn" aria-labelledby="devices-title"><header class="svelte-1nygetn"><button type="button" class="svelte-1nygetn">Back</button> <h1 id="devices-title" class="svelte-1nygetn">Authorized devices</h1></header> <!> <!> <section aria-labelledby="add-title" class="svelte-1nygetn"><h2 id="add-title" class="svelte-1nygetn">Authorize another device</h2> <!></section></main> <dialog aria-labelledby="revoke-title" class="svelte-1nygetn"><h2 id="revoke-title" class="svelte-1nygetn">Revoke authorized device?</h2> <p class="svelte-1nygetn">This immediately signs out sessions created by this passkey.</p> <form method="dialog" class="svelte-1nygetn"><button type="submit" class="svelte-1nygetn">Keep device</button><button type="button" class="svelte-1nygetn">Revoke device</button></form></dialog>`,1);function bO(e,t){I(t,!0);let n=Q(t,`oncreatepasskey`,3,()=>{}),r=R(cn([])),i=R(``),a=R(null),o=R(`none`),s=R(null),c=R(null),l=R(null),u=R(null),d=R(cn(Date.now())),f=L(()=>[...W(r)].sort((e,t)=>e.createdAt.localeCompare(t.createdAt))),p=L(()=>W(a)?Math.max(0,Math.ceil((Date.parse(W(a).expiresAt)-W(d))/1e3)):0),m=L(()=>`${Math.floor(W(p)/60)}:${String(W(p)%60).padStart(2,`0`)}`);function h(e){let t=e.trim();return[...t].length>=1&&[...t].length<=64}function g(){W(u)&&clearInterval(W(u)),z(u,null)}function _(){g(),z(u,setInterval(()=>void b(),15e3),!0)}function v(){return!!(W(a)&&W(o)===`pending`&&W(p)>0&&document.visibilityState===`visible`)}async function y(){try{z(r,(await t.client.list()).devices,!0)}catch{z(i,`Could not refresh authorized devices. Try again.`)}}async function b(){if(!v()){W(p)===0&&W(a)&&z(o,`expired`),g();return}try{z(o,(await t.client.ticketStatus()).status,!0),W(o)!==`pending`&&(g(),W(o)===`used`&&await y())}catch{g()}}async function x(){z(i,``);try{z(a,await t.client.createTicket(),!0),z(o,`pending`),z(s,await uO(W(a).url),!0),z(d,Date.now(),!0),_()}catch{z(i,`Could not create an enrollment link. Try again.`)}}async function S(){try{z(o,(await t.client.cancelTicket()).status,!0),z(a,null),z(s,null),g()}catch{z(i,`Could not cancel the enrollment link. Try again.`)}}async function C(){await S(),W(i)||await x()}async function w(e,n){if(!h(n)){z(i,`Device nicknames must be 1–64 characters.`);return}z(i,``);try{await t.client.rename(e.id,n.trim()),await y()}catch{z(i,`Could not rename this device. Try again.`)}}function T(e){W(f).length>1&&(z(l,e,!0),W(c)?.showModal())}async function E(){if(W(l))try{await t.client.revoke(W(l).id),W(c)?.close(),W(l).current?t.onlock():await y()}catch{z(i,`This device could not be revoked. Try again.`)}}async function D(){if(W(a))try{await navigator.clipboard.writeText(W(a).url)}catch{z(i,`Copy is unavailable here. Select the visible link instead.`)}}function O(){document.visibilityState===`visible`&&W(o)===`pending`&&W(p)>0?(b(),_()):g()}Yi(()=>{y(),document.addEventListener(`visibilitychange`,O);let e=setInterval(()=>z(d,Date.now(),!0),1e3);return()=>clearInterval(e)}),Xi(()=>{g(),document.removeEventListener(`visibilitychange`,O)});var k=yO(),ee=V(k),te=B(ee),ne=B(te);F(2),P(te);var re=H(te,2),ie=e=>{var t=dO(),n=B(t,!0);P(t),U(()=>J(n,W(i))),q(e,t)};Y(re,e=>{W(i)&&e(ie)});var ae=H(re,2),oe=e=>{var t=mO();X(t,21,()=>W(f),e=>e.id,(e,t)=>{var n=pO(),r=B(n),i=B(r),a=H(i);Li(a);var o=H(a,2),s=B(o),c=H(s),l=e=>{var n=Jr();U(e=>J(n,`· Last used ${e??``}`),[()=>new Date(W(t).lastUsedAt).toLocaleDateString()]),q(e,n)};Y(c,e=>{W(t).lastUsedAt&&e(l)});var u=H(c),d=e=>{q(e,Jr(`· This device`))};Y(u,e=>{W(t).current&&e(d)}),P(o);var p=H(o,4),m=H(p,2),h=e=>{var n=fO();U(()=>Z(n,`id`,`final-${W(t).id}`)),q(e,n)};Y(m,e=>{W(f).length===1&&e(h)}),P(r),P(n),U(e=>{Z(i,`for`,`nickname-${W(t).id}`),Z(a,`id`,`nickname-${W(t).id}`),Ri(a,W(t).nickname),Z(a,`aria-label`,`Nickname for ${W(t).nickname}`),J(s,`Added ${e??``}`),p.disabled=W(f).length===1,Z(p,`aria-describedby`,W(f).length===1?`final-${W(t).id}`:void 0)},[()=>new Date(W(t).createdAt).toLocaleDateString()]),Br(`submit`,r,e=>{e.preventDefault(),w(W(t),String(new FormData(e.currentTarget).get(`nickname`)??``))}),G(`click`,p,()=>T(W(t))),q(e,n)}),P(t),q(e,t)},se=e=>{q(e,hO())};Y(ae,e=>{W(f).length?e(oe):e(se,-1)});var ce=H(ae,2),le=H(B(ce),2),ue=e=>{var t=gO();G(`click`,t,()=>void x()),q(e,t)},de=e=>{var t=vO(),r=V(t),i=B(r,!0);P(r);var c=H(r,2),l=e=>{var t=_O();U(()=>Z(t,`src`,W(s))),q(e,t)};Y(c,e=>{W(s)&&e(l)});var u=H(c,3);wn(u);var d=H(u,2),f=B(d),p=H(f),h=H(p),g=H(h);P(d),U(()=>{J(i,W(o)===`pending`?`Enrollment link is active for ${W(m)}.`:`Enrollment link is ${W(o)}.`),Ri(u,W(a).url)}),G(`click`,f,()=>void D()),G(`click`,p,()=>n()(W(a).ticket)),G(`click`,h,()=>void S()),G(`click`,g,()=>void C()),q(e,t)};Y(le,e=>{W(a)?e(de,-1):e(ue)}),P(ce),P(ee);var A=H(ee,2),fe=H(B(A),4),pe=H(B(fe));P(fe),P(A),qi(A,e=>z(c,e),()=>W(c)),G(`click`,ne,function(...e){t.onclose?.apply(this,e)}),G(`click`,pe,()=>void E()),q(e,k),$e()}Vr([`click`]);async function xO(e){if(e=await e,!e.ok){let t;try{let n=await e.json();typeof n==`object`&&n&&`code`in n&&typeof n.code==`string`&&(t=n.code)}catch{}throw Error(t??`AUTH_REQUEST_FAILED_${e.status}`)}if(e.status!==204)return e.json()}function SO(e){return{list:()=>xO(e(`/api/auth/devices`,{credentials:`same-origin`})),rename:(t,n)=>xO(e(`/api/auth/devices/${encodeURIComponent(t)}`,{method:`PATCH`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({nickname:n})})),revoke:t=>xO(e(`/api/auth/devices/${encodeURIComponent(t)}`,{method:`DELETE`,credentials:`same-origin`})),createTicket:()=>xO(e(`/api/auth/enrollment-tickets`,{method:`POST`,credentials:`same-origin`})),ticketStatus:()=>xO(e(`/api/auth/enrollment-tickets/current`,{credentials:`same-origin`})),cancelTicket:()=>xO(e(`/api/auth/enrollment-tickets/current`,{method:`DELETE`,credentials:`same-origin`}))}}var CO=`gestalt-mobile.scratchpad`;function wO(){try{return window.localStorage}catch{return null}}function TO(e){try{return e?.getItem(`gestalt-mobile.scratchpad`)??``}catch{return``}}function EO(e,t){try{return e?(e.setItem(CO,t),!0):!1}catch{return!1}}function DO(e){try{return e?(e.removeItem(CO),!0):!1}catch{return!1}}var OO=K(`<p class="feedback svelte-eu5bnq" role="status"> </p>`),kO=K(`<section class="clear-confirmation svelte-eu5bnq" aria-labelledby="clear-scratchpad-title"><p id="clear-scratchpad-title" class="svelte-eu5bnq"><strong>Clear the entire scratchpad?</strong></p> <p class="svelte-eu5bnq">This cannot be undone.</p> <div class="actions svelte-eu5bnq"><button type="button" class="svelte-eu5bnq">Keep text</button> <button type="button" class="danger svelte-eu5bnq">Clear all</button></div></section>`),AO=K(`<footer class="actions svelte-eu5bnq"><button type="button" class="svelte-eu5bnq">Paste</button> <button type="button" class="svelte-eu5bnq">Select all</button> <button type="button" class="danger svelte-eu5bnq">Clear</button> <button type="button" class="svelte-eu5bnq">Close</button></footer>`),jO=K(`<dialog aria-labelledby="scratchpad-title" class="svelte-eu5bnq"><section class="scratchpad-shell svelte-eu5bnq"><header class="svelte-eu5bnq"><div><h2 id="scratchpad-title" class="svelte-eu5bnq">Scratchpad</h2> <p id="scratchpad-help" class="svelte-eu5bnq">Saved automatically in this browser.</p></div> <button type="button" class="close svelte-eu5bnq" aria-label="Close scratchpad">×</button></header> <label for="scratchpad-text" class="svelte-eu5bnq">Scratchpad text</label> <textarea id="scratchpad-text" aria-describedby="scratchpad-help" class="svelte-eu5bnq"></textarea> <!> <!></section></dialog>`);function MO(e,t){I(t,!0);let n=Q(t,`storage`,19,wO),r=Q(t,`clipboard`,19,()=>globalThis.navigator?.clipboard),i=R(null),a=R(null),o=R(null),s=R(null),c=R(``),l=R(!1),u=R(``);Yi(async()=>{z(c,TO(n()),!0),await Or(),W(i)?.showModal(),W(o)?.focus({preventScroll:!0})});function d(e){z(c,e,!0),z(u,EO(n(),e)?``:`This browser could not save the scratchpad. Keep this window open until you copy the text.`,!0)}async function f(){if(!r()?.readText){z(u,`Clipboard paste is unavailable here. Long-press the text field and choose Paste.`),W(a)?.focus();return}try{let e=await r().readText(),t=W(a)?.selectionStart??W(c).length,n=W(a)?.selectionEnd??W(c).length;d(`${W(c).slice(0,t)}${e}${W(c).slice(n)}`),await Or();let i=t+e.length;W(a)?.focus(),W(a)?.setSelectionRange(i,i)}catch{z(u,`Clipboard paste was not permitted. Long-press the text field and choose Paste.`),W(a)?.focus()}}async function p(){z(l,!0),z(u,``),await Or(),W(s)?.focus()}function m(){z(l,!1),W(a)?.focus()}function h(){if(!DO(n())){z(u,`This browser could not clear its saved scratchpad.`);return}z(c,``),z(l,!1),z(u,``),W(a)?.focus()}var g=jO(),_=B(g),v=B(_),y=H(B(v),2);qi(y,e=>z(o,e),()=>W(o)),P(v);var b=H(v,4);wn(b),qi(b,e=>z(a,e),()=>W(a));var x=H(b,2),S=e=>{var t=OO(),n=B(t,!0);P(t),U(()=>J(n,W(u))),q(e,t)};Y(x,e=>{W(u)&&e(S)});var C=H(x,2),w=e=>{var t=kO(),n=H(B(t),4),r=B(n);qi(r,e=>z(s,e),()=>W(s));var i=H(r,2);P(n),P(t),G(`click`,r,m),G(`click`,i,h),q(e,t)},T=e=>{var t=AO(),n=B(t),r=H(n,2),o=H(r,2),s=H(o,2);P(t),U(()=>o.disabled=!W(c)),G(`click`,n,()=>void f()),G(`click`,r,()=>W(a)?.select()),G(`click`,o,()=>void p()),G(`click`,s,()=>W(i)?.close()),q(e,t)};Y(C,e=>{W(l)?e(w):e(T,-1)}),P(_),P(g),qi(g,e=>z(i,e),()=>W(i)),U(()=>Ri(b,W(c))),Br(`close`,g,function(...e){t.onclose?.apply(this,e)}),G(`click`,y,()=>W(i)?.close()),G(`input`,b,e=>d(e.currentTarget.value)),q(e,g),$e()}Vr([`click`,`input`]);var NO=K(`<span><span class="line-number svelte-1xq0jc8" aria-hidden="true"></span><span class="line-text svelte-1xq0jc8"> </span></span>`),PO=K(`<pre aria-label="File source" class="svelte-1xq0jc8"><code></code></pre>`);function FO(e,t){I(t,!0);let n=L(()=>t.text.split(`
|
|
176
|
-
`));var r=PO(),i=B(r);X(i,21,()=>W(n),ii,(e,r,i,a)=>{var o=NO();let s;Z(o,`data-line`,i+1);var c=B(o);Z(c,`data-number`,i+1);var l=H(c),u=B(l);P(l),P(o),U(()=>{s=Ei(o,1,`source-line svelte-1xq0jc8`,null,s,{highlighted:i+1===t.line}),Z(o,`aria-label`,i+1===t.line?`Highlighted line ${t.line}`:void 0),J(u,`${W(r)??``}${i<W(n).length-1?`
|
|
177
|
-
`:``}`)}),q(e,o)}),P(i),P(r),q(e,r),$e()}var IO=e=>typeof e==`object`&&e?Object.entries(e):[],LO=(e,t)=>`${e}/${JSON.stringify(t)}`;function RO(e){let t=new Set,n=[{value:e,id:``}];for(;n.length;){let e=n.pop(),r=IO(e.value);if(r.length){t.add(e.id);for(let[t,i]of r)n.push({value:i,id:LO(e.id,t)})}}return t}function zO(e,t){let n=[{value:e,id:``,depth:0,prefix:``,comma:``,label:`JSON root`}],r=[];for(;n.length;){let e=n.pop();if(`closing`in e){r.push(e.closing);continue}let i=IO(e.value),a=e.value!==null&&typeof e.value==`object`,o=Array.isArray(e.value),s=o?`[`:`{`,c=o?`]`:`}`,l=i.length>0&&t.has(e.id);if(r.push({id:e.id,depth:e.depth,label:e.label,expandable:i.length>0,expanded:l,kind:a?`container`:e.value===null?`null`:typeof e.value,text:e.prefix+(a?s+(l?``:i.length?` … ${i.length} ${o?`items`:`keys`} ${c}`:c):JSON.stringify(e.value))+(l?``:e.comma)}),l){n.push({closing:{id:`${e.id}:close`,depth:e.depth,text:c+e.comma,expandable:!1,expanded:!1,label:e.label,kind:`container`}});for(let t=i.length-1;t>=0;t--){let[r,a]=i[t];n.push({value:a,id:LO(e.id,r),depth:e.depth+1,prefix:o?``:`${JSON.stringify(r)}: `,comma:t<i.length-1?`,`:``,label:`${e.label}${o?`[${r}]`:`.${r}`}`})}}}return r}var BO=K(`<button type="button" class="svelte-7x7m8l"> </button>`),VO=K(`<div class="json-row svelte-7x7m8l"><span class="fold-column svelte-7x7m8l"><!></span> <code class="svelte-7x7m8l"> </code></div>`),HO=K(`<div class="json-tree svelte-7x7m8l" aria-label="JSON contents"></div>`);function UO(e,t){I(t,!0);let n=Q(t,`unfolded`,3,!1),r=L(()=>JSON.parse(t.text)),i=L(()=>n()?RO(W(r)):new Set([``])),a=L(()=>zO(W(r),W(i)));function o(e){let t=new Set(W(i));if(t.has(e))t.delete(e);else{for(let n of t)n.startsWith(`${e}/`)&&t.delete(n);t.add(e)}z(i,t)}var s=HO();X(s,21,()=>W(a),e=>e.id,(e,t)=>{var n=VO(),r=B(n),i=B(r),a=e=>{var n=BO(),r=B(n,!0);P(n),U(()=>{Z(n,`aria-label`,`${W(t).expanded?`Fold`:`Unfold`} ${W(t).label}`),Z(n,`aria-expanded`,W(t).expanded),J(r,W(t).expanded?`−`:`+`)}),G(`click`,n,()=>o(W(t).id)),q(e,n)};Y(i,e=>{W(t).expandable&&e(a)}),P(r);var s=H(r,2);let c;var l=B(s,!0);P(s),P(n),U(()=>{Z(n,`data-kind`,W(t).kind),c=Oi(s,``,c,{"padding-inline-start":`${W(t).depth*1.2}em`}),J(l,W(t).text)}),q(e,n)}),P(s),q(e,s),$e()}Vr([`click`]);var WO=K(`<button class="disclosure svelte-am0nvt" type="button"> </button>`),GO=K(`<span class="disclosure svelte-am0nvt"></span>`),KO=K(`<span class="unsupported svelte-am0nvt">Files cannot be destinations</span>`),qO=K(`<span class="unsupported svelte-am0nvt">Unsupported link</span>`),JO=K(`<span role="status">Loading…</span>`),YO=K(`<button type="button" class="svelte-am0nvt"> </button>`),XO=K(`<div role="group"><!> <!> <!> <!></div>`),ZO=K(`<div role="treeitem"><div class="tree-row svelte-am0nvt" role="presentation"><!> <span class="tree-label svelte-am0nvt"> </span><!></div> <!></div>`),QO=K(`<p role="status">Loading files…</p>`),$O=K(`<button type="button" class="svelte-am0nvt">Retry loading files</button>`),ek=K(`<button type="button" class="svelte-am0nvt">Load more in root</button>`),tk=K(`<div class="file-tree svelte-am0nvt" role="tree" aria-label="Files"><!> <!> <!> <!></div>`);function nk(e,t){I(t,!0);let n=Q(t,`directory`,3,``),r=Q(t,`destinationMode`,3,!1),i=Q(t,`ondestinationselect`,3,()=>{}),a=Q(t,`onselectionchange`,3,()=>{}),o=cn({}),s=R(``),c=L(()=>t.revision<0?{entries:[],loading:!1,error:!1}:u(n())),l=L(()=>{if(t.revision<0)return[];let e=[],r=(t,n)=>{for(let i of u(t).entries)e.push({entry:i,level:n,parent:t}),i.kind===`directory`&&d(i.path)&&r(i.path,n+1)};return r(n(),1),e});function u(e){return t.revision,t.controller.state(e)}function d(e){return t.revision,t.controller.expanded.has(e)}function f(e){z(s,e,!0),o[e]?.focus()}function p(e){d(e.path)?t.controller.collapse(e.path):t.controller.expand(e.path)}function m(e,n,r){e.stopPropagation();let i=n.entry,a=n.parent,o=e=>{let t=W(l)[Math.max(0,Math.min(W(l).length-1,e))];t&&f(t.entry.path)};switch(e.key){case`ArrowDown`:e.preventDefault(),o(r+1);break;case`ArrowUp`:e.preventDefault(),o(r-1);break;case`Home`:e.preventDefault(),o(0);break;case`End`:e.preventDefault(),o(W(l).length-1);break;case`ArrowRight`:i.kind===`directory`&&(e.preventDefault(),d(i.path)?o(r+1):p(i));break;case`ArrowLeft`:e.preventDefault(),i.kind===`directory`&&d(i.path)?t.controller.collapse(i.path):a&&f(a);break;case`Enter`:case` `:e.preventDefault(),h(i);break}}function h(e){if(e.kind!==`symlink`){if(r()){e.kind===`directory`&&i()(e.path);return}t.controller.select(e.path),a()(e.path)}}var g=tk();{let e=(n,i=b,a=b)=>{var c=Yr();X(V(c),17,()=>u(i()).entries,e=>e.path,(n,i,c,f)=>{let g=L(()=>W(i).kind===`directory`),_=L(()=>W(l).find(e=>e.entry.path===W(i).path)),v=L(()=>W(l).findIndex(e=>e.entry.path===W(i).path));var y=ZO();let b;var x=B(y);let S;var C=B(x),w=e=>{var t=WO(),n=B(t,!0);P(t),U((e,r)=>{Z(t,`aria-label`,e),J(n,r)},[()=>`${d(W(i).path)?`Collapse`:`Expand`} ${W(i).name}`,()=>d(W(i).path)?`−`:`+`]),G(`click`,t,e=>{e.stopPropagation(),p(W(i))}),q(e,t)},T=e=>{q(e,GO())};Y(C,e=>{W(g)?e(w):e(T,-1)});var E=H(C,2),D=B(E,!0);P(E);var O=H(E),k=e=>{q(e,KO())},ee=e=>{var t=qO();U(()=>Z(t,`id`,`${W(i).path}-unsupported`)),q(e,t)};Y(O,e=>{r()&&!W(g)?e(k):W(i).kind===`symlink`&&e(ee,1)}),P(x);var te=H(x,2),ne=n=>{let r=L(()=>u(W(i).path));var o=XO(),s=B(o),c=e=>{q(e,JO())};Y(s,e=>{W(r).loading&&e(c)});var l=H(s,2),d=e=>{var n=YO(),r=B(n);P(n),U(()=>J(r,`Retry ${W(i).name??``}`)),G(`click`,n,()=>void t.controller.load(W(i).path)),q(e,n)};Y(l,e=>{W(r).error&&e(d)});var f=H(l,2);e(f,()=>W(i).path,()=>a()+1);var p=H(f,2),m=e=>{var n=YO(),r=B(n);P(n),U(()=>J(r,`Load more in ${W(i).name??``}`)),G(`click`,n,()=>void t.controller.load(W(i).path,!0)),q(e,n)};Y(p,e=>{W(r).cursor&&e(m)}),P(o),U(()=>Z(o,`aria-label`,`Contents of ${W(i).name}`)),q(n,o)},re=L(()=>W(g)&&d(W(i).path));Y(te,e=>{W(re)&&e(ne)}),P(y),qi(y,(e,t)=>o[t.path]=e,e=>o?.[e.path],()=>[W(i)]),U(e=>{b=Ei(y,1,`treeitem svelte-am0nvt`,null,b,{symlink:W(i).kind===`symlink`}),Z(y,`aria-level`,a()),Z(y,`aria-expanded`,e),Z(y,`aria-selected`,W(i).kind===`symlink`?`false`:t.controller.selectedPath===W(i).path),Z(y,`aria-disabled`,W(i).kind===`symlink`),Z(y,`aria-describedby`,W(i).kind===`symlink`?`${W(i).path}-unsupported`:void 0),Z(y,`tabindex`,W(s)===W(i).path||!W(s)&&W(v)===0?0:-1),S=Oi(x,``,S,{"--level":a()}),J(D,W(i).name)},[()=>W(g)?d(W(i).path):void 0]),Br(`focus`,y,()=>z(s,W(i).path,!0)),G(`keydown`,y,e=>m(e,W(_),W(v))),G(`click`,y,e=>{e.stopPropagation(),h(W(i))}),q(n,y)}),q(n,c)};var _=B(g),v=e=>{q(e,QO())};Y(_,e=>{W(c).loading&&e(v)});var y=H(_,2),x=e=>{var r=$O();G(`click`,r,()=>void t.controller.load(n())),q(e,r)};Y(y,e=>{W(c).error&&e(x)});var S=H(y,2);e(S,n,()=>1);var C=H(S,2),w=e=>{var r=ek();G(`click`,r,()=>void t.controller.load(n(),!0)),q(e,r)};Y(C,e=>{W(c).cursor&&e(w)}),P(g)}q(e,g),$e()}Vr([`keydown`,`click`]);var rk=class{workspaceId;read;changed;failed;expanded=new Set([``]);selectedPath=``;pages=new Map;generations=new Map;requests=new Map;version=0;constructor(e,t,n,r=()=>{}){this.workspaceId=e,this.read=t,this.changed=n,this.failed=r}state(e){return this.pages.get(e)??{entries:[],loading:!1,error:!1}}async load(e=``,t=!1){let n=this.state(e);if(n.loading||t&&!n.cursor)return;let r=(this.generations.get(e)??0)+1;this.generations.set(e,r),this.requests.get(e)?.abort();let i=new AbortController;this.requests.set(e,i),this.pages.set(e,{...n,loading:!0,error:!1}),this.publish();try{let a=await this.read(this.workspaceId,{directory:e,...t?{cursor:n.cursor}:{}},i.signal);if(i.signal.aborted||this.generations.get(e)!==r)return;let o=t?ik(n.entries,a.entries):a.entries;this.pages.set(e,{entries:o,cursor:a.nextCursor,loading:!1,error:!1})}catch(t){if(i.signal.aborted||this.generations.get(e)!==r)return;this.pages.set(e,{...n,loading:!1,error:!0}),this.failed(t)}finally{this.requests.get(e)===i&&this.requests.delete(e),this.publish()}}async expand(e){this.expanded.add(e),this.publish(),this.pages.has(e)||await this.load(e)}collapse(e){this.expanded.delete(e),this.generations.set(e,(this.generations.get(e)??0)+1),this.requests.get(e)?.abort(),this.publish()}async refresh(e=``){this.invalidateBranch(e),await this.load(e)}select(e){this.selectedPath=e,this.publish()}close(){this.requests.forEach(e=>e.abort()),this.requests.clear()}invalidateBranch(e){for(let t of[...this.pages.keys()])(t===e||t.startsWith(e?`${e}/`:``))&&(this.pages.delete(t),this.generations.set(t,(this.generations.get(t)??0)+1),this.requests.get(t)?.abort())}publish(){this.version+=1,this.changed()}};function ik(e,t){let n=new Set(e.map(e=>e.path));return[...e,...t.filter(e=>!n.has(e.path))]}function ak(e,t){this.v=e,this.k=t}function ok(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 sk(e){if(Array.isArray(e))return e}function ck(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 lk(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
178
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function uk(e,t){return sk(e)||ck(e,t)||dk(e,t)||lk()}function dk(e,t){if(e){if(typeof e==`string`)return ok(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)?ok(e,t):void 0}}function fk(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof ak;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)}fk.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},fk.prototype.next=function(e){return this._invoke(`next`,e)},fk.prototype.throw=function(e){return this._invoke(`throw`,e)},fk.prototype.return=function(e){return this._invoke(`return`,e)};var pk=Object.entries,mk=Object.setPrototypeOf,hk=Object.isFrozen,gk=Object.getPrototypeOf,_k=Object.getOwnPropertyDescriptor,vk=Object.freeze,yk=Object.seal,bk=Object.create,xk=typeof Reflect<`u`&&Reflect,Sk=xk.apply,Ck=xk.construct;vk||=function(e){return e},yk||=function(e){return e},Sk||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Ck||=function(e){return new e(...[...arguments].slice(1))};var wk=Jk(Array.prototype.forEach);Array.prototype.indexOf;var Tk=Jk(Array.prototype.lastIndexOf),Ek=Jk(Array.prototype.pop),Dk=Jk(Array.prototype.push),Ok=Jk(Array.prototype.slice),kk=Jk(Array.prototype.splice),Ak=Array.isArray,jk=Yk(Set),Mk=Jk(Set.prototype.add),Nk=Jk(Set.prototype.has),Pk=Jk(String.prototype.toLowerCase),Fk=Jk(String.prototype.toString),Ik=Jk(String.prototype.match),Lk=Jk(String.prototype.replace),Rk=Jk(String.prototype.indexOf),zk=Jk(String.prototype.trim),Bk=Jk(Number.prototype.toString),Vk=Jk(Boolean.prototype.toString),Hk=typeof BigInt>`u`?null:Jk(BigInt.prototype.toString),Uk=typeof Symbol>`u`?null:Jk(Symbol.prototype.toString),Wk=Jk(Object.prototype.hasOwnProperty),Gk=Jk(Object.prototype.toString),Kk=Jk(RegExp.prototype.test),qk=Yk(TypeError);function Jk(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Sk(e,t,n)}}function Yk(e){return function(){return Ck(e,[...arguments])}}function Xk(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Pk;if(mk&&mk(e,null),!Ak(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(hk(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Zk(e){for(let t=0;t<e.length;t++)Wk(e,t)||(e[t]=null);return e}function Qk(e){let t=bk(null);for(let r of pk(e)){var n=uk(r,2);let i=n[0],a=n[1];Wk(e,i)&&(Ak(a)?t[i]=Zk(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Qk(a):t[i]=a)}return t}function $k(e){switch(typeof e){case`string`:return e;case`number`:return Bk(e);case`boolean`:return Vk(e);case`bigint`:return Hk?Hk(e):`0`;case`symbol`:return Uk?Uk(e):`Symbol()`;case`undefined`:return Gk(e);case`function`:case`object`:{if(e===null)return Gk(e);let t=e,n=eA(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Gk(e)}return Gk(e)}default:return Gk(e)}}function eA(e,t){for(;e!==null;){let n=_k(e,t);if(n){if(n.get)return Jk(n.get);if(typeof n.value==`function`)return Jk(n.value)}e=gk(e)}function n(){return null}return n}function tA(e,t){for(;e!==null;){let n=_k(e,t);if(n)return n.get?Jk(n.get):null;e=gk(e)}return null}function nA(e){try{return Kk(e,``),!0}catch{return!1}}var rA=vk(`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(`.`)),iA=vk(`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(`.`)),aA=vk([`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`]),oA=vk([`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`]),sA=vk(`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(`.`)),cA=vk([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),lA=vk([`#text`]),uA=vk(`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(`.`)),dA=vk(`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(`.`)),fA=vk(`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(`.`)),pA=vk([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),mA=yk(/{{[\w\W]*|^[\w\W]*}}/g),hA=yk(/<%[\w\W]*|^[\w\W]*%>/g),gA=yk(/\${[\w\W]*/g),_A=yk(/^data-[\-\w.\u00B7-\uFFFF]+$/),vA=yk(/^aria-[\-\w]+$/),yA=yk(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),bA=yk(/^(?:\w+script|data):/i),xA=yk(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),SA=yk(/^html$/i),CA=yk(/^[a-z][.\w]*(-[.\w]+)+$/i),wA=yk(/<[/\w!]/g),TA=yk(/<[/\w]/g),EA=yk(/<\/no(script|embed|frames)/i),DA=yk(/\/>/i),OA={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},kA=vk(Xk({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),AA=function(){return typeof window>`u`?null:window},jA=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}},MA=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},NA=function(e,t,n,r){return Wk(e,t)&&Ak(e[t])?Xk(r.base?Qk(r.base):{},e[t],r.transform):n},PA=function(e,t,n){let r=Wk(e,t)?e[t]:void 0;return r&&typeof r==`object`?Qk(r):n()};function FA(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:AA(),t=e=>FA(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==OA.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=eA(d,`cloneNode`),p=eA(d,`remove`),m=eA(d,`removeAttributeNode`),h=eA(d,`nextSibling`),g=eA(d,`childNodes`),_=eA(d,`parentNode`),v=eA(d,`shadowRoot`),y=eA(d,`attributes`),b=o&&o.prototype?eA(o.prototype,`nodeType`):null,x=o&&o.prototype?eA(o.prototype,`nodeName`):null,S=o&&o.prototype?eA(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=tA(d,`namespaceURI`),E=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,k,ee=!1,te=0,ne=function(){if(te>0)throw qk(`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.`)},re=function(e){ne(),te++;try{return D.createHTML(e)}finally{te--}},ie=function(e){ne(),te++;try{return D.createScriptURL(e)}finally{te--}},ae=function(){return ee||=(k=jA(u,i),!0),k},oe=n,se=oe.implementation,ce=oe.createNodeIterator,le=oe.createDocumentFragment,ue=oe.getElementsByTagName,de=r.importNode,A=MA();t.isSupported=typeof pk==`function`&&typeof _==`function`&&se&&se.createHTMLDocument!==void 0;let fe=mA,pe=hA,me=gA,he=_A,ge=vA,_e=bA,ve=xA,ye=CA,be=yA,xe=null,Se=Xk({},[...rA,...iA,...aA,...sA,...lA]),j=null,Ce=Xk({},[...uA,...dA,...fA,...pA]),we=Object.seal(bk(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}})),Te=null,Ee=null,De=Object.seal(bk(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Oe=!0,ke=!0,Ae=!1,je=!0,Me=!1,Ne=!0,Pe=!1,Fe=!1,Ie=null,Le=null,Re=!1,ze=!1,Be=!1,M=!1,Ve=!0,N=!1,He=`user-content-`,Ue=!0,P=!1,F=null,We={},Ge=null,Ke=Xk({},`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,Je=Xk({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ye=null,Xe=Xk({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ze=`http://www.w3.org/1998/Math/MathML`,Qe=`http://www.w3.org/2000/svg`,I=`http://www.w3.org/1999/xhtml`,$e=I,et=!1,tt=null,nt=Xk({},[Ze,Qe,I],Fk),rt=vk([`mi`,`mo`,`mn`,`ms`,`mtext`]),it=Xk({},rt),at=vk([`annotation-xml`]),ot=Xk({},at),st=Xk({},[`title`,`style`,`font`,`a`,`script`]),ct=null,lt=[`application/xhtml+xml`,`text/html`],ut=null,dt=null,ft=n.createElement(`form`),pt=function(e){return e instanceof RegExp||e instanceof Function},mt=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(dt&&dt===e)return;(!e||typeof e!=`object`)&&(e={}),e=Qk(e),ct=lt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,ut=ct===`application/xhtml+xml`?Fk:Pk,xe=NA(e,`ALLOWED_TAGS`,Se,{transform:ut}),j=NA(e,`ALLOWED_ATTR`,Ce,{transform:ut}),tt=NA(e,`ALLOWED_NAMESPACES`,nt,{transform:Fk}),Ye=NA(e,`ADD_URI_SAFE_ATTR`,Xe,{transform:ut,base:Xe}),qe=NA(e,`ADD_DATA_URI_TAGS`,Je,{transform:ut,base:Je}),Ge=NA(e,`FORBID_CONTENTS`,Ke,{transform:ut}),Te=NA(e,`FORBID_TAGS`,Qk({}),{transform:ut}),Ee=NA(e,`FORBID_ATTR`,Qk({}),{transform:ut}),We=Wk(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Qk(e.USE_PROFILES):e.USE_PROFILES:!1,Oe=e.ALLOW_ARIA_ATTR!==!1,ke=e.ALLOW_DATA_ATTR!==!1,Ae=e.ALLOW_UNKNOWN_PROTOCOLS||!1,je=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Me=e.SAFE_FOR_TEMPLATES||!1,Ne=e.SAFE_FOR_XML!==!1,Pe=e.WHOLE_DOCUMENT||!1,ze=e.RETURN_DOM||!1,Be=e.RETURN_DOM_FRAGMENT||!1,M=e.RETURN_TRUSTED_TYPE||!1,Re=e.FORCE_BODY||!1,Ve=e.SANITIZE_DOM!==!1,N=e.SANITIZE_NAMED_PROPS||!1,Ue=e.KEEP_CONTENT!==!1,P=e.IN_PLACE||!1,be=nA(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:yA,$e=typeof e.NAMESPACE==`string`?e.NAMESPACE:I,it=PA(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>Xk({},rt)),ot=PA(e,`HTML_INTEGRATION_POINTS`,()=>Xk({},at));let t=PA(e,`CUSTOM_ELEMENT_HANDLING`,()=>bk(null));if(we=bk(null),Wk(t,`tagNameCheck`)&&pt(t.tagNameCheck)&&(we.tagNameCheck=t.tagNameCheck),Wk(t,`attributeNameCheck`)&&pt(t.attributeNameCheck)&&(we.attributeNameCheck=t.attributeNameCheck),Wk(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(we.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),yk(we),Me&&(ke=!1),Be&&(ze=!0),We&&(xe=Xk({},lA),j=bk(null),We.html===!0&&(Xk(xe,rA),Xk(j,uA)),We.svg===!0&&(Xk(xe,iA),Xk(j,dA),Xk(j,pA)),We.svgFilters===!0&&(Xk(xe,aA),Xk(j,dA),Xk(j,pA)),We.mathMl===!0&&(Xk(xe,sA),Xk(j,fA),Xk(j,pA))),De.tagCheck=null,De.attributeCheck=null,Wk(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?De.tagCheck=e.ADD_TAGS:Ak(e.ADD_TAGS)&&(xe===Se&&(xe=Qk(xe)),Xk(xe,e.ADD_TAGS,ut))),Wk(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?De.attributeCheck=e.ADD_ATTR:Ak(e.ADD_ATTR)&&(j===Ce&&(j=Qk(j)),Xk(j,e.ADD_ATTR,ut))),Wk(e,`ADD_FORBID_CONTENTS`)&&Ak(e.ADD_FORBID_CONTENTS)&&(Ge===Ke&&(Ge=Qk(Ge)),Xk(Ge,e.ADD_FORBID_CONTENTS,ut)),Ue&&(xe[`#text`]=!0),Pe&&Xk(xe,[`html`,`head`,`body`]),xe.table&&(Xk(xe,[`tbody`]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw qk(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw qk(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{O=re(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,O=``):(D===void 0&&(D=ae()),D&&typeof O==`string`&&(O=re(``)));vk&&vk(e),dt=e},ht=Xk({},[...iA,...aA,...oA]),gt=Xk({},[...sA,...cA]),_t=function(e,t,n){return t.namespaceURI===I?e===`svg`:t.namespaceURI===Ze?e===`svg`&&(n===`annotation-xml`||it[n]):!!ht[e]},vt=function(e,t,n){return t.namespaceURI===I?e===`math`:t.namespaceURI===Qe?e===`math`&&ot[n]:!!gt[e]},yt=function(e,t,n){return t.namespaceURI===Qe&&!ot[n]||t.namespaceURI===Ze&&!it[n]?!1:!gt[e]&&(st[e]||!ht[e])},bt=function(e){let t=E(e),n=Pk(w(e)),r=_(e),i,a;return r&&C(r)===OA.element?(i={namespaceURI:E(r)},a=Pk(w(r))):(i={namespaceURI:$e},a=`template`),tt[t]?t===Qe?_t(n,i,a):t===Ze?vt(n,i,a):t===I?yt(n,i,a):!!(ct===`application/xhtml+xml`&&tt[t]):!1},xt=function(e){Dk(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw qk(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},St=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},Ct=function(e){Et(e);let t=g(e);t&&wk(Ok(t),e=>{try{p(e)}catch{}});let n=C(e)===OA.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&St(e,r,i)}},wt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Dk(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(ze||Be)try{xt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},L=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`||j[ut(i)]||St(e,r,i)}},Tt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===OA.element){let t=v(e);Vt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Et=function(e){Tt(e,e=>{C(e)===OA.element&&L(e)})},Dt=function(e){let t=[];return Tt(e,e=>{t.push(e)},!0),t},Ot=function(e,t){let n=jk();wk(Dt(e),e=>{C(e)===OA.element&&Mk(n,e)}),wk(t,e=>{C(e)===OA.element&&!Nk(n,e)&&L(e)})},kt=function(e,n){let r=!1;return wk(t.removed,t=>{t.element&&(r||=t.element===e,Et(t.element))}),Ot(e,n),r},At=function(e,t){let n=F,r=null,i=()=>(r||(r=jk(),wk(t,e=>{Mk(r,e)})),r);for(let t=0;;t++){let r=Dt(e),a=[e],o=!1;if(wk(r,e=>{C(e)===OA.documentFragment?Dk(a,e):!o&&!Nk(n,e)&&(o=Nk(i(),e))}),!o)return;if(t>=8)throw qk(`the tree kept changing during in-place sanitization; refusing to return it`);wk(a,(t,n)=>{jt(t,n>0,e,i())})}},jt=function(e,t,n,r){let i=It(e),a;for(;a=i.nextNode();)!Nk(r,a)||Nk(F,a)||(t&&Ut(A.uponSanitizeShadowNode,a,null),Yt(a,n),R(a,n),Vt(a.content)&&nn(a.content))},Mt=function(e){F&&Mk(F,e)},Nt=function(e,t){return Ne?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Pt=function(e){Ne&&Tt(e,e=>{let t=C(e);if(t===OA.processingInstruction||t===OA.comment&&Kk(TA,e.data)){try{p(e)}catch{}return!1}if(t===OA.element){let t=e,n=ut(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Nt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Ft=function(e){let t=null,r=null;if(Re)e=`<remove></remove>`+e;else{let t=Ik(e,/^[\r\n\t ]+/);r=t&&t[0]}ct===`application/xhtml+xml`&&$e===I&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?re(e):e;if($e===I)try{t=new l().parseFromString(i,ct)}catch{}if(!t||!t.documentElement){t=se.createDocument($e,`template`,null);try{t.documentElement.innerHTML=et?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),$e===I?ue.call(t,Pe?`html`:`body`)[0]:Pe?t.documentElement:a},It=function(e){let t=S?S(e):e.ownerDocument;return ce.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=Lk(e,fe,` `),e=Lk(e,pe,` `),e=Lk(e,me,` `),e},Rt=function(e){zt(e);let t=e.querySelectorAll?.call(e,`template`);t&&wk(t,e=>{Vt(e.content)&&Rt(e.content)})},zt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ce.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()},Bt=function(e){let t=x?x(e):null;return typeof t!=`string`||ut(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Vt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===OA.documentFragment}catch{return!1}},Ht=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Ut(e,n,r){e.length!==0&&wk(e,e=>{e.call(t,n,r,dt)})}let Wt=function(e,t){return!!(Ne&&e.hasChildNodes()&&!Ht(e.firstElementChild)&&Kk(wA,e.textContent)&&Kk(wA,e.innerHTML)||Ne&&kA[t]&&C(e)===OA.element&&E(e)===I&&(Ht(e.firstElementChild)||typeof e.textContent==`string`&&Kk(wA,e.textContent))||e.nodeType===OA.processingInstruction||Ne&&e.nodeType===OA.comment&&Kk(TA,e.data))},Gt=function(e,t){return e instanceof RegExp?Kk(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Kt=function(e,t,n){if(!Te[t]&&Qt(t)&&Gt(we.tagNameCheck,t))return!1;if(Ue&&!Ge[t]&&!Ge[Pk(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 xt(e),!0},qt=function(e,t,n,r){return e.length===0?t:t===n||t===r?Qk(t):t},Jt=function(e,t){return e===t||_(e)!==null?!1:(P&&Et(e),!0)},Yt=function(e,n){if(Mt(e),Ut(A.beforeSanitizeElements,e,null),Jt(e,n))return!0;if(Bt(e))return xt(e),!0;let r=ut(w(e));if(xe=qt(A.uponSanitizeElement,xe,Se,Ie),Ut(A.uponSanitizeElement,e,{tagName:r,allowedTags:xe}),Jt(e,n))return!0;if(Wt(e,r))return xt(e),!0;if(Te[r]||!(De.tagCheck instanceof Function&&De.tagCheck(r))&&!xe[r]){let t=Kt(e,r,n);return t===!1&&(Ut(A.afterSanitizeElements,e,null),Jt(e,n))?!0:t}if(C(e)===OA.element&&!bt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Kk(EA,e.innerHTML))return xt(e),!0;if(Me&&e.nodeType===OA.text){let n=Lt(e.textContent);e.textContent!==n&&(Dk(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Ut(A.afterSanitizeElements,e,null),Jt(e,n)},Xt=function(e,t,r){if(Ee[t]||Nt(t,e)||Ve&&(t===`id`||t===`name`)&&(r in n||r in ft))return!1;let i=j[t]||De.attributeCheck instanceof Function&&De.attributeCheck(t,e);return ke&&Kk(he,t)||Oe&&Kk(ge,t)?!0:i?Ye[t]||Kk(be,Lk(r,ve,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Rk(r,`data:`)===0&&qe[e]||Ae&&!Kk(_e,Lk(r,ve,``))?!0:!r:Qt(e)&&Gt(we.tagNameCheck,e)&&Gt(we.attributeNameCheck,t,e)||t===`is`&&we.allowCustomizedBuiltInElements&&Gt(we.tagNameCheck,r)},Zt=Xk({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Qt=function(e){return!Zt[Pk(e)]&&Kk(ye,e)},$t=function(e,t,n,r){if(D&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return re(r);case`TrustedScriptURL`:return ie(r)}return r},en=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),Bt(e)?(xt(e),!1):!0}catch{return wt(t,e),!1}},tn=function(e,t){return Ne&&Kk(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Pk(e)===`attributename`&&Ik(t,`href`)!==null},R=function(e,n){if(Ut(A.beforeSanitizeAttributes,e,null),Jt(e,n))return;let r=e.attributes;if(!r||Bt(e))return;j=qt(A.uponSanitizeAttribute,j,Ce,Le);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0},a=r.length,o=ut(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=ut(s),d=l,f=s===`value`?d:zk(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Ut(A.uponSanitizeAttribute,e,i),f=i.attrValue,N&&(u===`id`||u===`name`)&&Rk(f,He)!==0&&(wt(s,e,n),f=He+f,p=!0),tn(s,f)){wt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){wt(s,e,n);continue}if(!je&&Kk(DA,f)){wt(s,e,n);continue}if(Me&&(f=Lt(f)),!Xt(o,u,f)){wt(s,e,n);continue}f=$t(o,u,c,f),f!==d&&en(e,s,c,f)&&p&&Ek(t.removed)}}Ut(A.afterSanitizeAttributes,e,null),Jt(e,n)},nn=function(e){let t=null,n=It(e);for(Ut(A.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Ut(A.uponSanitizeShadowNode,t,null),Yt(t,e),R(t,e),Vt(t.content)&&nn(t.content),C(t)===OA.element){let e=v(t);Vt(e)&&(z(e),nn(e))}Me&&zt(e),Ut(A.afterSanitizeShadowDOM,e,null)},z=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){nn(e.shadow);continue}let n=e.node,r=C(n)===OA.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=x?x(n):null;if(typeof e==`string`&&ut(e)===`template`){let e=n.content;Vt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Vt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(et=!e,et&&(e=`<!-->`),typeof e!=`string`&&!Ht(e)&&(e=$k(e),typeof e!=`string`))throw qk(`dirty is not a string, aborting`);if(!t.isSupported)return e;Fe?(xe=Ie,j=Le):mt(n),(A.uponSanitizeElement.length>0||A.uponSanitizeAttribute.length>0)&&(xe=Qk(xe)),A.uponSanitizeAttribute.length>0&&(j=Qk(j)),t.removed=[];let c=P&&typeof e!=`string`&&Ht(e),l=[],u=F;if(c){Pt(e);let t=w(e);if(typeof t==`string`){let n=ut(t);if(!xe[n]||Te[n])throw Ct(e),qk(`root node is forbidden and cannot be sanitized in-place`)}if(Bt(e))throw Ct(e),qk(`root node is clobbered and cannot be sanitized in-place`);l=Dt(e),F=jk()}else if(Ht(e))i=Ft(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===OA.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),z(i);else{if(!ze&&!Me&&!Pe&&e.indexOf(`<`)===-1)return D&&M?re(e):e;if(i=Ft(e),!i)return ze?null:M?O:``}i&&Re&&xt(i.firstChild);let d=c?e:i;try{c&&z(e);let t=It(d);for(;o=t.nextNode();)Yt(o,d),R(o,d),Vt(o.content)&&nn(o.content);c&&At(e,l)}catch(t){throw c&&(Ct(e),kt(e,l)),t}finally{F=u}if(c){if(kt(e,l))throw qk(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return Me&&Rt(e),e}if(ze){if(Me&&Rt(i),Be)for(s=le.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(j.shadowroot||j.shadowrootmode)&&(s=de.call(r,s,!0)),s}let f=Pe?i.outerHTML:i.innerHTML;return Pe&&xe[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Kk(SA,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
179
|
-
`+f),Me&&(f=Lt(f)),D&&M?re(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};mt(e),Fe=!0,Ie=xe,Le=j},t.clearConfig=function(){dt=null,Fe=!1,Ie=null,Le=null,D=k,O=``},t.isValidAttribute=function(e,t,n){dt||mt({});let r=ut(e),i=ut(t);return typeof n==`string`&&(tn(t,n)||!je&&Kk(DA,n))?!1:Xt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Wk(A,e)&&Dk(A[e],t)},t.removeHook=function(e,t){if(Wk(A,e)){if(t!==void 0){let n=Tk(A[e],t);return n===-1?void 0:kk(A[e],n,1)[0]}return Ek(A[e])}},t.removeHooks=function(e){Wk(A,e)&&(A[e]=[])},t.removeAllHooks=function(){A=MA()},t}var IA=FA();function LA(e){if(e.kind!==`file`)return{format:`text`,text:``};if(/\.(md|markdown)$/i.test(e.path))return{format:`markdown`,text:e.content};if(/\.json$/i.test(e.path))try{return{format:`json`,text:JSON.stringify(JSON.parse(e.content),null,2)}}catch{}return{format:`text`,text:e.content}}function RA(e){return IA.sanitize(Jb.parse(e,{async:!1,gfm:!0}),{ALLOWED_TAGS:[`p`,`br`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`strong`,`em`,`del`,`blockquote`,`ul`,`ol`,`li`,`pre`,`code`,`hr`,`table`,`thead`,`tbody`,`tr`,`th`,`td`,`a`],ALLOWED_ATTR:[`href`,`title`,`start`]})}function zA(e,t){let n=t.trim();if(n.startsWith(`/`))return n;let r=e.split(`/`),i=r.indexOf(`.gestalt`);return[...i<0?[]:r.slice(0,i),n].filter(Boolean).join(`/`)}function BA(e,t){return t.startsWith(`/`)?t:[...e.split(`/`).slice(0,-1),t].join(`/`)}var VA=K(`<span class="line-target svelte-14yf39v" role="status"> </span>`),HA=K(`<span class="format svelte-14yf39v"> </span>`),UA=K(`<p role="status">Loading preview…</p>`),WA=K(`<p>This item could not be opened.</p> <!>`,1),GA=K(`<p class="empty svelte-14yf39v">This folder is empty.</p>`),KA=K(`<!> <!>`,1),qA=K(`<div class="markdown svelte-14yf39v"></div>`),JA=K(`<dialog class="file-viewer svelte-14yf39v" aria-labelledby="file-viewer-title"><header class="svelte-14yf39v"><div class="title svelte-14yf39v"><h2 id="file-viewer-title" tabindex="-1" class="svelte-14yf39v"> </h2> <p class="svelte-14yf39v"> </p></div> <!></header> <nav aria-label="Preview controls" class="svelte-14yf39v"><!> <!> <!> <!> <!></nav> <div class="contents svelte-14yf39v"><!></div></dialog>`);function YA(e,t){I(t,!0);let n,r,i=R(null),a=R(!0),o=R(!1),s=R(!1),c=R(!1),l=R(0),u=R(null),d=R(cn([])),f=R(void 0),p=R(``),m=L(()=>W(i)?.kind===`file`?W(i).content.split(`
|
|
180
|
-
`).length:0),h=L(()=>W(i)?LA(W(i)):{format:`text`,text:``}),g=L(()=>W(h).format===`markdown`&&!W(s)?RA(W(h).text):``),_=null,v=null;async function y(e,n=!0,m){let h=r_(e),g=h.path;n&&W(i)&&z(d,[...W(d),{path:W(i).path,line:W(f)}],!0),z(f,Number.isSafeInteger(m)&&m>0?m:h.line,!0),_?.abort(),W(u)?.close(),z(u,null);let v=new AbortController;_=v,z(p,g,!0),z(a,!0),z(o,!1),z(i,null),z(s,!!W(f),!0),z(c,!1);try{let e=await t.readFile(t.target.workspaceId,g,v.signal);if(v.signal.aborted)return;if(z(i,e,!0),z(p,e.path,!0),e.kind===`directory`){let n=new rk(t.target.workspaceId,t.listDirectory,()=>{z(l,W(l)+1)},t.onerror);z(u,n,!0),await n.load(e.path)}}catch(e){if(v.signal.aborted)return;z(o,!0),t.onerror(e)}finally{v.signal.aborted||(z(a,!1),await Or(),r?.focus({preventScroll:!0}),b())}}function b(){!W(f)||!W(i)||W(i).kind!==`file`||n.querySelector(`[data-line="${W(f)}"]`)?.scrollIntoView({block:`center`,inline:`nearest`,behavior:`instant`})}async function x(){z(s,!W(s)),await Or(),W(s)&&b()}function S(){let e=W(d).at(-1);e!==void 0&&(z(d,W(d).slice(0,-1),!0),y(e.path,!1,e.line))}function C(e){let t=(e.target instanceof Element?e.target.closest(`a`):null)?.getAttribute(`href`);if(!t||/^(?:https?:|mailto:|#)/i.test(t))return;e.preventDefault();let n=i_(t)??r_(t);y(BA(W(p),n.path),!0,n.line)}function w(e){return e.addEventListener(`click`,C),{destroy:()=>e.removeEventListener(`click`,C)}}Yi(()=>(v=document.activeElement instanceof HTMLElement?document.activeElement:null,n.showModal(),y(t.target.path,!1,t.target.line),()=>{_?.abort(),W(u)?.close(),n.close(),v?.focus()}));var T=JA(),E=B(T),D=B(E),O=B(D),k=B(O,!0);P(O),qi(O,e=>r=e,()=>r);var ee=H(O,2),te=B(ee,!0);P(ee),P(D),Om(H(D,2),{get onclick(){return t.onclose},label:`Close file preview`,children:(e,t)=>{F(),q(e,Jr(`Close`))},$$slots:{default:!0}}),P(E);var ne=H(E,2),re=B(ne);{let e=L(()=>!W(d).length);Om(re,{onclick:S,get disabled(){return W(e)},children:(e,t)=>{F(),q(e,Jr(`Back`))},$$slots:{default:!0}})}var ie=H(re,2),ae=e=>{Om(e,{onclick:()=>void x(),get pressed(){return W(s)},children:(e,t)=>{F();var n=Jr();U(()=>J(n,W(s)?`Show formatted`:`Show source`)),q(e,n)},$$slots:{default:!0}})};Y(ie,e=>{W(i)?.kind===`file`&&W(h).format!==`text`&&e(ae)});var oe=H(ie,2),se=e=>{{let t=L(()=>W(c)?`Fold all JSON`:`Unfold all JSON`);Om(e,{onclick:()=>{z(c,!W(c))},get pressed(){return W(c)},get label(){return W(t)},children:(e,t)=>{F();var n=Jr();U(()=>J(n,W(c)?`Unfolded`:`Folded`)),q(e,n)},$$slots:{default:!0}})}};Y(oe,e=>{W(h).format===`json`&&!W(s)&&e(se)});var ce=H(oe,2),le=e=>{var t=VA(),n=B(t,!0);P(t),U(()=>J(n,W(f)<=W(m)?`Line ${W(f)}`:`Line ${W(f)} unavailable (${W(m)} lines)`)),q(e,t)};Y(ce,e=>{W(f)&&W(i)?.kind===`file`&&e(le)});var ue=H(ce,2),de=e=>{var t=HA(),n=B(t);P(t),U((e,t)=>J(n,`${e??``} · ${t??``} bytes`),[()=>W(h).format.toUpperCase(),()=>W(i).size.toLocaleString()]),q(e,t)};Y(ue,e=>{W(i)?.kind===`file`&&e(de)}),P(ne);var A=H(ne,2),fe=B(A),pe=e=>{q(e,UA())},me=e=>{var t=WA();Om(H(V(t),2),{onclick:()=>void y(W(p),!1,W(f)),children:(e,t)=>{F(),q(e,Jr(`Retry`))},$$slots:{default:!0}}),q(e,t)},he=e=>{var t=KA(),n=V(t);nk(n,{get controller(){return W(u)},get revision(){return W(l)},get directory(){return W(i).path},onselectionchange:e=>{let t=e.split(`/`).slice(0,-1).join(`/`),n=W(u)?.state(t).entries.find(t=>t.path===e);n?.kind===`file`?y(e):n?.kind===`directory`&&W(u)?.expand(e)}});var r=H(n,2),a=e=>{q(e,GA())},o=L(()=>!W(u).state(W(i).path).entries.length&&!W(u).state(W(i).path).error);Y(r,e=>{W(o)&&e(a)}),q(e,t)},ge=e=>{var t=Yr(),n=V(t),r=e=>{var t=qA();pi(t,()=>W(g),!0),P(t),gi(t,e=>w?.(e)),q(e,t)},a=e=>{UO(e,{get text(){return W(h).text},get unfolded(){return W(c)}})},o=e=>{{let t=L(()=>W(s)?W(i).content:W(h).text);FO(e,{get text(){return W(t)},get line(){return W(f)}})}};Y(n,e=>{W(g)?e(r):W(h).format===`json`&&!W(s)?e(a,1):e(o,-1)}),q(e,t)};Y(fe,e=>{W(a)?e(pe):W(o)?e(me,1):W(i)?.kind===`directory`&&W(u)?e(he,2):W(i)?.kind===`file`&&e(ge,3)}),P(A),P(T),qi(T,e=>n=e,()=>n),U(e=>{J(k,e),J(te,W(p)||`/`)},[()=>W(p).split(`/`).filter(Boolean).at(-1)||`Workspace files`]),Br(`cancel`,T,e=>{e.preventDefault(),t.onclose()}),q(e,T),$e()}var XA={phase:`idle`};function ZA(e,t){return{phase:`picking`,kind:e,source:t}}function QA(e,t){return e.phase===`picking`?{...e,destination:t}:e}function $A(e){return e.phase!==`picking`||e.destination===void 0?e:{...e,phase:`submitting`}}function ej(e,t){return e.phase===`submitting`?{...e,phase:`conflict`,replaceAllowed:t}:e}function tj(e){return e.phase===`submitting`?{...e,phase:`failed`}:e}function nj(e,t){return e.phase!==`picking`||!e.source||e.kind===`move`&&rj(e.source)===t?!1:!(t===e.source||t.startsWith(`${e.source}/`))}function rj(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}var ij=K(`<button type="button" class="svelte-qx7639">New folder</button>`),aj=K(`<form class="picker svelte-qx7639" aria-label="New folder"><p class="svelte-qx7639"> </p> <label for="new-folder-name">Folder name</label> <input id="new-folder-name" required="" maxlength="255"/> <div class="browser-actions svelte-qx7639"><button type="submit" class="svelte-qx7639"> </button> <button type="button" class="svelte-qx7639">Cancel</button></div></form>`),oj=K(`<li> </li>`),sj=K(`<button type="button" class="svelte-qx7639">Replace</button>`),cj=K(`<div class="browser-actions svelte-qx7639" aria-label="Upload conflict"><!> <button type="button" class="svelte-qx7639">Keep both</button> <button type="button" class="svelte-qx7639">Cancel remaining</button></div>`),lj=K(`<button type="button" class="svelte-qx7639">Cancel uploads</button>`),uj=K(`<section class="picker svelte-qx7639" aria-label="Upload queue" aria-live="polite"><p class="svelte-qx7639"> </p> <ul></ul> <!></section>`),dj=K(`<button type="button" class="svelte-qx7639">View</button>`),fj=K(`<div class="browser-actions svelte-qx7639" aria-label="Selected file actions"><!> <button type="button" class="svelte-qx7639">Copy</button> <button type="button" class="svelte-qx7639">Move</button> <button type="button" class="svelte-qx7639">Delete</button></div>`),pj=K(`<section class="picker svelte-qx7639" aria-label="Delete confirmation" aria-live="assertive"><h3> </h3> <p class="svelte-qx7639"> </p> <div class="browser-actions svelte-qx7639"><button type="button" class="svelte-qx7639">Cancel</button> <button type="button" class="svelte-qx7639"> </button></div></section>`),mj=K(`<section class="picker svelte-qx7639" aria-label="Choose destination folder" aria-live="polite"><p class="svelte-qx7639"><strong> </strong> </p> <p class="svelte-qx7639"> </p> <div class="browser-actions svelte-qx7639"><button type="button" class="svelte-qx7639">Use root folder</button> <button type="button" class="svelte-qx7639"> </button> <button type="button" class="svelte-qx7639">Cancel</button></div></section>`),hj=K(`<section class="picker svelte-qx7639" tabindex="-1" aria-label="File conflict" aria-live="assertive"><h3>Destination already contains this item</h3> <p class="svelte-qx7639"> </p> <div class="browser-actions svelte-qx7639"><!> <button type="button" class="svelte-qx7639">Keep both</button> <button type="button" class="svelte-qx7639">Cancel</button></div></section>`),gj=K(`<section class="picker svelte-qx7639" aria-label="Transfer failed"><p role="status" class="svelte-qx7639">Transfer could not be completed.</p> <div class="browser-actions svelte-qx7639"><button type="button" class="svelte-qx7639">Try again</button><button type="button" class="svelte-qx7639">Cancel</button></div></section>`),_j=K(`<section aria-label="File browser error"><p class="svelte-qx7639">Files could not be read. Try again.</p></section>`),vj=K(`<p role="status" class="svelte-qx7639">This folder is empty.</p>`),yj=K(`<dialog aria-labelledby="file-browser-title" class="svelte-qx7639"><section class="file-browser-shell svelte-qx7639"><header class="svelte-qx7639"><div class="svelte-qx7639"><h2 id="file-browser-title" tabindex="-1" class="svelte-qx7639"> </h2> <p class="svelte-qx7639"> </p></div> <button type="button" class="close svelte-qx7639" aria-label="Close file browser">×</button></header> <div class="browser-actions svelte-qx7639"><!> <button type="button" class="svelte-qx7639">Refresh</button></div> <!> <div class="upload-actions svelte-qx7639"><input class="visually-hidden svelte-qx7639" type="file" multiple="" aria-label="Choose files to upload"/> <p class="svelte-qx7639"> </p> <button type="button" class="svelte-qx7639">Upload files</button></div> <!> <!> <!> <!> <!> <!></section></dialog>`);function bj(e,t){I(t,!0);let n=Q(t,`onsuccess`,3,()=>{}),r=Q(t,`onmutation`,3,()=>{}),i=R(null),a=R(null),o=R(0),s=R(null),c=R(cn(XA)),l=R(null),u=R(``),d=R(null),f=R(``),p=R(!1),m=R(null),h=R(null),g=R(!1),_=R(!1),v=R(null),y=R(null),b=R(cn([])),x=R(!1),S=R(null),C=R(null),w=L(()=>W(o)<0?{entries:[],loading:!1,error:!1}:W(s)?.state(``)??{entries:[],loading:!0,error:!1}),T=L(()=>{if(!W(s)||!W(u))return;let e=W(u).includes(`/`)?W(u).slice(0,W(u).lastIndexOf(`/`)):``;return W(s).state(e).entries.find(e=>e.path===W(u))}),E=L(()=>`Files in ${t.root.relativePath===`.`?`~/`:`~/${t.root.relativePath}`}`);Yi(async()=>{z(s,new rk(t.root.id,t.listDirectory,()=>{z(o,W(o)+1)},t.onerror),!0),await Or(),W(i)?.showModal(),W(a)?.focus(),await W(s).load()}),Xi(()=>W(s)?.close());function D(){W(c).phase===`submitting`||W(_)||W(p)||(W(S)?.abort(),W(s)?.close(),W(i)?.close())}let O=L(()=>W(T)?.kind===`directory`||!W(u)?W(u):``),k=L(()=>W(O)||``);async function ee(){z(d,W(O),!0),z(f,``),await Or(),W(m)?.focus()}async function te(){W(p)||(z(d,null),await Or(),W(h)?.focus())}async function ne(e){if(e.preventDefault(),W(p)||W(d)===null||!t.createDirectory||!W(s))return;let i=W(d),a=W(f).trim();if(a){z(p,!0);try{let e=await t.createDirectory(t.root.id,{directory:i,name:a},qh());await W(s).refresh(i),await W(s).expand(i),W(s).select(e.path),z(u,e.path,!0),z(d,null),r()(),n()(`Created folder ${a}.`)}catch(e){t.onerror(Object.assign(Error(`WORKSPACE_FOLDER_CREATE_FAILED`),{code:e.status===409?`WORKSPACE_FOLDER_EXISTS`:`WORKSPACE_FOLDER_CREATE_FAILED`}))}finally{z(p,!1),await Or(),W(d)===null?W(h)?.focus():W(m)?.focus()}}}async function re(e=`reject`){if(!(W(x)||!W(s))){z(x,!0);try{for(;;){let n=W(C)?.index??Xg(W(b));if(z(C,null),n<0)break;let i=W(b)[n];if(!i||i.status===`too-large`)continue;z(b,W(b).map((e,t)=>t===n?{...e,status:`uploading`}:e),!0);let a=new AbortController;z(S,a,!0);try{let o=await t.uploadFile(t.root.id,{directory:W(k),filename:i.file.name,conflict:e,file:i.file},qh(),a.signal);z(b,W(b).map((e,t)=>t===n?{...e,status:`completed`,path:o.path}:e),!0),await W(s).refresh(W(k)),W(s).select(W(k)),z(u,W(k),!0),r()(),e=`reject`}catch(e){let r=e;if(r.status===409){z(b,W(b).map((e,t)=>t===n?{...e,status:`queued`}:e),!0),z(C,{index:n,replaceAllowed:r.replaceAllowed===!0},!0);break}z(b,W(b).map((e,t)=>t===n?{...e,status:a.signal.aborted?`cancelled`:`failed`}:e),!0),t.onerror(e)}finally{z(S,null)}}}finally{z(x,!1);let e=W(b).filter(e=>e.status===`completed`).length;e&&n()(`Uploaded ${e} file${e===1?``:`s`}.`)}}}function ie(e){!e||e.length===0||(z(b,Yg(e),!0),re())}function ae(){W(S)?.abort(),z(b,W(b).map(e=>e.status===`queued`||e.status===`uploading`?{...e,status:`cancelled`}:e),!0),z(C,null)}function oe(e){if(W(c).phase===`submitting`||W(_)||W(p)){e.preventDefault();return}if(e.preventDefault(),W(d)!==null){te();return}D()}async function se(){if(!(!W(u)||W(_))){z(_,!0);try{let e=W(u).includes(`/`)?W(u).slice(0,W(u).lastIndexOf(`/`)):``;await t.deleteEntry(t.root.id,W(u),qh()),await W(s)?.refresh(e),W(s)?.select(e),z(u,e,!0),n()(`Deleted item.`),r()(),z(g,!1)}catch(e){t.onerror(e)}finally{z(_,!1)}}}async function ce(){z(g,!0),await Or(),W(v)?.focus()}function le(e){W(u)&&z(c,ZA(e,W(u)),!0)}function ue(e){nj(W(c),e)&&z(c,QA(W(c),e),!0)}async function de(e=`reject`){if(!W(s)||W(c).phase!==`picking`&&W(c).phase!==`conflict`)return;let i=W(c).phase===`picking`?$A(W(c)):{...W(c),phase:`submitting`};if(!(!i.source||i.destination===void 0||!i.kind)){z(c,i,!0);try{let a=await(i.kind===`copy`?t.copyEntry:t.moveEntry)(t.root.id,{source:i.source,destinationDirectory:i.destination,conflict:e},qh()),o=i.source.includes(`/`)?i.source.slice(0,i.source.lastIndexOf(`/`)):``;i.kind===`copy`?await W(s).refresh(i.destination):await Promise.all([W(s).refresh(o),W(s).refresh(i.destination)]),W(s).select(a.path),n()(`${i.kind===`copy`?`Copied`:`Moved`} ${a.path}.`),r()(),z(c,XA,!0)}catch(e){let n=e;n.status===409?(z(c,ej(i,n.replaceAllowed===!0),!0),await Or(),W(l)?.focus()):(z(c,tj(i),!0),t.onerror(e))}}}var A=yj(),fe=B(A),pe=B(fe),me=B(pe),he=B(me),ge=B(he,!0);P(he),qi(he,e=>z(a,e),()=>W(a));var _e=H(he,2),ve=B(_e,!0);P(_e),P(me);var ye=H(me,2);P(pe);var be=H(pe,2),xe=B(be),Se=e=>{var t=ij();qi(t,e=>z(h,e),()=>W(h)),U(()=>t.disabled=W(w).loading||W(d)!==null||W(p)||W(x)||W(_)||W(c).phase!==`idle`||W(T)!==void 0&&W(T).kind!==`directory`),G(`click`,t,()=>void ee()),q(e,t)};Y(xe,e=>{t.createDirectory&&e(Se)});var j=H(xe,2);P(be);var Ce=H(be,2),we=e=>{var t=aj(),n=B(t),r=B(n);P(n);var i=H(n,4);Li(i),qi(i,e=>z(m,e),()=>W(m));var a=H(i,2),o=B(a),s=B(o,!0);P(o);var c=H(o,2);P(a),P(t),U(e=>{J(r,`Create in: ${(W(d)||`root folder`)??``}`),i.disabled=W(p),o.disabled=e,J(s,W(p)?`Creating…`:`Create folder`),c.disabled=W(p)},[()=>W(p)||!W(f).trim()]),Br(`submit`,t,ne),Ui(i,()=>W(f),e=>z(f,e)),G(`click`,c,()=>void te()),q(e,t)};Y(Ce,e=>{W(d)!==null&&e(we)});var Te=H(Ce,2),Ee=B(Te);qi(Ee,e=>z(y,e),()=>W(y));var De=H(Ee,2),Oe=B(De);P(De);var ke=H(De,2);P(Te);var Ae=H(Te,2),je=e=>{var t=uj(),n=B(t),r=B(n);P(n);var i=H(n,2);X(i,21,()=>W(b),e=>e.file,(e,t)=>{var n=oj(),r=B(n);P(n),U(()=>J(r,`${W(t).file.name??``}: ${W(t).path??W(t).status??``}${W(t).status===`too-large`?` (maximum ${Cg/1024/1024} MiB)`:``}`)),q(e,n)}),P(i);var a=H(i,2),o=e=>{var t=cj(),n=B(t),r=e=>{var t=sj();G(`click`,t,()=>void re(`replace`)),q(e,t)};Y(n,e=>{W(C).replaceAllowed&&e(r)});var i=H(n,2),a=H(i,2);P(t),G(`click`,i,()=>void re(`keep-both`)),G(`click`,a,ae),q(e,t)},s=e=>{var t=lj();G(`click`,t,ae),q(e,t)};Y(a,e=>{W(C)?e(o):W(x)&&e(s,1)}),P(t),U((e,t)=>J(r,`${e??``} queued, ${t??``} completed`),[()=>W(b).filter(e=>e.status===`queued`).length,()=>W(b).filter(e=>e.status===`completed`).length]),q(e,t)};Y(Ae,e=>{W(b).length&&e(je)});var Me=H(Ae,2),Ne=e=>{var n=fj(),r=B(n),i=e=>{var n=dj();G(`click`,n,()=>t.onview?.(W(u))),q(e,n)};Y(r,e=>{t.onview&&e(i)});var a=H(r,2),o=H(a,2),s=H(o,2);P(n),G(`click`,a,()=>le(`copy`)),G(`click`,o,()=>le(`move`)),G(`click`,s,()=>void ce()),q(e,n)};Y(Me,e=>{W(s)&&W(c).phase===`idle`&&W(T)&&W(T).kind!==`symlink`&&e(Ne)});var Pe=H(Me,2),Fe=e=>{var t=pj(),n=B(t),r=B(n,!0);P(n);var i=H(n,2),a=B(i,!0);P(i);var o=H(i,2),s=B(o);qi(s,e=>z(v,e),()=>W(v));var c=H(s,2),l=B(c,!0);P(c),P(o),P(t),U(()=>{J(r,W(T).kind===`directory`?`Delete folder and all contents`:`Delete file`),J(a,W(u)),s.disabled=W(_),c.disabled=W(_),J(l,W(_)?`Deleting…`:`Delete`)}),G(`click`,s,()=>z(g,!1)),G(`click`,c,()=>void se()),q(e,t)};Y(Pe,e=>{W(g)&&W(T)&&e(Fe)});var Ie=H(Pe,2),Le=e=>{var t=mj(),n=B(t),r=B(n),i=B(r);P(r);var a=H(r);P(n);var o=H(n,2),s=B(o);P(o);var l=H(o,2),u=B(l),d=H(u,2),f=B(d);P(d);var p=H(d,2);P(l),P(t),U(e=>{J(i,`${W(c).kind===`copy`?`Copy`:`Move`}:`),J(a,` ${W(c).source??``}`),J(s,`Destination: ${(W(c).destination===``?`root folder`:W(c).destination??`choose a folder`)??``}`),u.disabled=e,d.disabled=W(c).destination===void 0,J(f,`Confirm ${W(c).kind??``}`)},[()=>!nj(W(c),``)]),G(`click`,u,()=>ue(``)),G(`click`,d,()=>void de()),G(`click`,p,()=>z(c,XA,!0)),q(e,t)},Re=e=>{var t=hj(),n=H(B(t),2),r=B(n,!0);P(n);var i=H(n,2),a=B(i),o=e=>{var t=sj();G(`click`,t,()=>void de(`replace`)),q(e,t)};Y(a,e=>{W(c).replaceAllowed&&e(o)});var s=H(a,2),u=H(s,2);P(i),P(t),qi(t,e=>z(l,e),()=>W(l)),U(()=>J(r,W(c).destination)),G(`click`,s,()=>void de(`keep-both`)),G(`click`,u,()=>z(c,XA,!0)),q(e,t)},ze=e=>{var t=gj(),n=H(B(t),2),r=B(n),i=H(r);P(n),P(t),G(`click`,r,()=>z(c,{...W(c),phase:`picking`},!0)),G(`click`,i,()=>z(c,XA,!0)),q(e,t)};Y(Ie,e=>{W(c).phase===`picking`?e(Le):W(c).phase===`conflict`?e(Re,1):W(c).phase===`failed`&&e(ze,2)});var Be=H(Ie,2),M=e=>{q(e,_j())},Ve=e=>{q(e,vj())};Y(Be,e=>{W(s)&&!W(w).loading&&W(w).error?e(M):W(s)&&!W(w).loading&&W(w).entries.length===0&&e(Ve,1)});var N=H(Be,2),He=e=>{var n=Yr();ri(V(n),()=>W(o),e=>{{let n=L(()=>W(c).phase===`picking`);nk(e,{get controller(){return W(s)},get revision(){return W(o)},get destinationMode(){return W(n)},ondestinationselect:ue,onselectionchange:async e=>{z(u,e,!0);let n=e.split(`/`).slice(0,-1).join(`/`);W(s)?.state(n).entries.find(t=>t.path===e)?.kind!==`file`||!t.onview||W(g)||(await Or(),!(W(u)!==e||W(c).phase!==`idle`||!W(i)?.open)&&(W(i)?.querySelector(`[role="treeitem"][aria-selected="true"]`)?.focus(),t.onview(e)))}})}}),q(e,n)};Y(N,e=>{W(s)&&e(He)}),P(fe),P(A),qi(A,e=>z(i,e),()=>W(i)),U(()=>{J(ge,W(E)),J(ve,W(c).phase===`picking`?`Choose destination folder.`:`Browse folders and select a position.`),j.disabled=W(w).loading,J(Oe,`Upload destination: ${(W(T)?.kind===`file`?`Select a folder first`:W(u)||`root folder`)??``}`),ke.disabled=W(T)?.kind===`file`||W(x)}),Br(`close`,A,function(...e){t.onclose?.apply(this,e)}),Br(`cancel`,A,oe),G(`click`,ye,D),G(`click`,j,()=>void W(s)?.refresh()),G(`change`,Ee,e=>ie(e.currentTarget.files)),G(`click`,ke,()=>W(y)?.click()),q(e,A),$e()}Vr([`click`,`change`]);var xj=K(`<main class="evidence-mode svelte-1d2e8zz"><!></main>`),Sj=K(`<span class="detached-chat-model svelte-1d2e8zz"> </span>`),Cj=K(`<header class="detached-chat-header svelte-1d2e8zz"><div class="detached-chat-context svelte-1d2e8zz"><span class="svelte-1d2e8zz">Chat</span> <strong class="svelte-1d2e8zz"> </strong></div> <!> <!></header>`),wj=K(`<aside class="chat-context chat-sessions svelte-1d2e8zz" aria-label="Chat sessions and usage"><!></aside>`),Tj=K(`<div class="chat-controls svelte-1d2e8zz" aria-label="Chat controls"><!> <!> <!></div>`),Ej=K(`<div class="chat-composer svelte-1d2e8zz"><!> <!> <!></div> <!> <div class="chat-tail svelte-1d2e8zz" aria-hidden="true"></div>`,1),Dj=K(`<p> </p>`),Oj=K(`<aside class="chat-context chat-plan svelte-1d2e8zz" aria-label="Chat plan summary"><!></aside>`),kj=K(`<div><!> <section class="chat-view svelte-1d2e8zz" aria-labelledby="chat-title"><h2 id="chat-title" class="visually-hidden">Chat</h2> <p class="visually-hidden" aria-live="polite" aria-atomic="true"> </p> <!></section> <!></div>`),Aj=K(`<p>Loading skill profiles…</p>`),jj=K(`<section class="session-profile-manager" aria-labelledby="session-profile-manager-title"><div class="session-profile-manager-header svelte-1d2e8zz"><h2 id="session-profile-manager-title" tabindex="-1" class="svelte-1d2e8zz">Manage skill profiles</h2> <button type="button" class="close-profile-manager svelte-1d2e8zz" aria-label="Close skill profile editor">×</button></div> <!></section>`),Mj=K(`<!> <!> <!>`,1),Nj=K(`<!> <!> <!> <!> <!> <!> <!>`,1),Pj=K(`<main><!> <!> <!> <!></main> <!>`,1);function Fj(e,t){I(t,!0);let n=(e,t=b)=>{let n=L(()=>W(s)===`chat`?`Close plan and return to chat`:W(s)===`sessions`?`Close plan and return to sessions`:`Close plan and return to list`);{let r=L(()=>t()?W(St):W(Ct)),i=L(()=>t()?W(n):void 0),o=L(()=>t()&&W(Ke)?.sessionId?{kind:`retained-session`,sessionId:W(Ke).sessionId}:t()&&W(Qe)?W(ot)&&W(j)?{kind:`session`,sessionId:W(j),planName:W(Qe)}:W(ut)?{kind:`workspace`,workspaceId:W(ut),planName:W(Qe)}:void 0:W(j)?{kind:`retained-session`,sessionId:W(j)}:void 0),s=L(()=>a?void 0:zt),c=L(()=>t()&&W(Ke)?W(Ye)?.lastOrgPlan?.path:t()&&W(Ze)?void 0:W(ft)?.lastOrgPlan?.path),l=L(()=>t()?Cr:br);oE(e,{get catalog(){return W(Xe)},get state(){return W(r)},get closeLabel(){return W(i)},get executeReference(){return W(o)},get executeTransport(){return W(s)},get downloadTransport(){return zt},ondownloaderror:e=>Qt.enqueue({kind:`error`,message:e}),onexecuteerror:e=>Qt.enqueue({kind:`error`,message:e}),onexecuteresult:e=>void jn(e),get sourcePath(){return W(c)},oncopyresult:e=>Qt.enqueue(e?{kind:`success`,message:`Org file path copied.`}:{kind:`error`,message:`Org file path could not be copied. Select it and copy it manually.`}),onopen:vr,onarchive:Dr,get archivingPlans(){return W(st)},get onclose(){return W(l)},onreference:e=>Vr(e,t()),checkreferences:(e,n)=>zr(e,n,t())})}},r=(e,n)=>{let r=Tt(()=>C(n?.(),!1));{let n=L(()=>W(ue)===W(A));oD(e,{get rosterOnly(){return W(r)},get allowanceFetcher(){return t.authorizedFetch},get useWhenOver(){return W(tn)},get savingAutoReset(){return W(nn)},onautoreset:e=>void on(e),onallowanceerror:()=>Qt.enqueue({kind:`warning`,message:`Could not refresh Codex allowance. Retrying automatically.`}),get sessions(){return W(Ce)},get forgettingStates(){return W(we)},get recentSessions(){return W(Pe)},get selectedSessionId(){return W(j)},get activitySnapshots(){return W(Ee)},get autopilotSnapshots(){return W(Oe).snapshots},get autopilotPending(){return W(Oe).pending},get autopilotAttention(){return W(Oe).attention},get workspaceTree(){return W(w)},get workspaceId(){return W(ve)},get expandedIds(){return W(xe)},get sandbox(){return W(Fe)},get approvalPolicy(){return W(Ie)},get models(){return W(k)[W(A)]},get selectedModel(){return W(ce)[W(A)]},get reasoningEffort(){return W(E)},get executorModels(){return W(k).codex},get executorModel(){return W(D)},get executorReasoningEffort(){return W(O)},onreasoningchange:e=>z(E,e,!0),onexecutormodelchange:e=>z(D,e,!0),onexecutorreasoningchange:e=>z(O,e,!0),get provider(){return W(A)},get kimiAvailable(){return W(de)},get modelsLoading(){return W(n)},get skillProfiles(){return W(he)},get selectedSkillProfile(){return W(ge)},get skillProfileError(){return W(_e)},get startingSession(){return W(ze)},get workspaceConflictSessionId(){return W(Re)},get openingSessionId(){return W(Be)},get savingDefaults(){return W(ye)},onsavedefaults:()=>void Yn(),onworkspacechange:e=>{z(ve,e,!0),z(Re,void 0)},onexpandedchange:e=>z(xe,e,!0),onsandboxchange:e=>z(Fe,e,!0),onapprovalpolicychange:e=>z(Ie,e,!0),onmodelchange:e=>z(ce,{...W(ce),[W(A)]:e}),onproviderchange:e=>void Dn(e),onskillprofilechange:e=>z(ge,e,!0),onmanageprofiles:e=>void Mr(e),onopen:Kn,onselectopen:Kn,onplan:Tr,onclose:e=>void Jn(e),onautopilottoggle:Bn,onactivityopen:e=>void Ht.resync(e),onautopilotresolve:Un,onattentiondebug:(e,t,n)=>void Nn(t,e,n),get debugPending(){return W(p)},onopenrecent:e=>void qn(e),onforget:Xn,oncopyresume:e=>void Zn(e),onstart:()=>void On(),ondebugtrace:(e,t)=>void Ln(e,t),get advancedExpanded(){return W(be)},set advancedExpanded(e){z(be,e,!0)}})}},i=Q(t,`oncreatepasskey`,3,()=>{}),a=Ux(location.search),o=R(null),s=R(cn(a?`chat`:`sessions`)),c=R(!1),l=R(!1),u=R(!1),d=R(null),f=R(null),p=R(!1),m=R(null),h=null,g=0,_=R(null),v=R(null),y=!1,x=R(`Loading relay…`),S=R(cn(jr(()=>t.theme))),w=R(cn([])),T=Jp.model,E=R(cn(Jp.reasoningEffort)),D=R(cn(Jp.executorModel)),O=R(cn(Jp.executorReasoningEffort)),k=R({codex:[T],kimi:[]}),ee=R([]),te=R(!1),ne=R(null),re=R(!1),ie;async function ae(){ie?.abort();let e=new AbortController;ie=e;let n=W(j);if(!(!n||!W(pt))){z(re,!0),z(ne,null);try{let r=await t.authorizedFetch(`/api/sessions/${encodeURIComponent(n)}/retrieval-readiness`,{signal:e.signal});if(r.status===404)return;if(!r.ok)throw Error(`READINESS_UNAVAILABLE`);let i=await r.json();!e.signal.aborted&&n===W(j)&&z(ne,{runtimeId:typeof i?.runtimeId==`string`?i.runtimeId:null,observedAt:typeof i?.observedAt==`string`?i.observedAt:void 0,connections:Array.isArray(i?.connections)?i.connections:[],repositories:Array.isArray(i?.repositories)?i.repositories:[]})}catch{e.signal.aborted||Qt.enqueue({kind:`warning`,message:`Could not refresh tool readiness. Reopen configuration or refresh to retry.`})}finally{!e.signal.aborted&&n===W(j)&&z(re,!1)}}}Pn(()=>{if(!W(te)||!W(pt)||!W(j)){ie?.abort(),z(ne,null),z(re,!1);return}return ae(),()=>ie?.abort()});let oe=R(null),se=R(`codex`),ce=R({codex:T,kimi:``}),le=R(null),ue=R(null),de=L(()=>W(le)?.kimi.available??!1),A=L(()=>W(de)?W(se):`codex`),fe=R([]),pe=R(null),me=R(`list`),he=R([]),ge=R(``),_e=R(``),ve=R(``),ye=R(!1),be=R(!1),xe=R(cn(new Set)),Se=R(!1),j=R(null),Ce=R(cn([])),we=R(new Map),Te=L(()=>W(j)?W(we).get(W(j)):void 0),Ee=R(new Map),De=R(new Map),Oe=R({snapshots:new Map,attention:new Map,pending:new Set,errors:new Map}),ke=R(new Map),Ae=0,je=0,Me=null,Ne=L(()=>W(Ce).some(e=>e.id===W(j))),Pe=R(cn([])),Fe=R(cn(Jp.sandbox)),Ie=R(cn(Jp.approvalPolicy)),Le=R(cn({starting:!1,error:null})),Re=R(void 0),ze=L(()=>W(Le).starting),Be=R(null),M=new uE(e=>{z(Be,e,!0)}),Ve=R(null),N=R(null),He=R(``),Ue=0,We=new Map,Ge=R(cn({kind:`unavailable`,sessionId:null})),Ke=R(null),qe=R(null),Je=L(()=>W(qe)!==null),Ye=L(()=>W(Ce).find(e=>e.id===W(Ke)?.sessionId)??null),Xe=R({kind:`no-workspace`}),Ze=R(null),Qe=R(null),et=R(!1),tt=null,nt=null,rt=0,it=null,at=null,ot=R(!1),st=R(cn([])),ct=0,lt=R(null),ut=L(()=>W(w)[0]?.id??null),dt=L(()=>W(Ce).find(e=>e.id===W(j))?.workspacePath??null),ft=L(()=>W(Ce).find(e=>e.id===W(j))??null),pt=L(()=>!!(W(ft)&&W(ft).provider!==`kimi`&&[`ready`,`turnActive`].includes(W(ft).state))),mt=R(!1),ht=L(()=>W(mt)&&W(s)===`chat`&&!a);function gt(){let e=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;z(mt,document.documentElement.clientWidth>=88*e)}Yi(()=>{gt();let e=new MutationObserver(gt);return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`,`class`]}),()=>e.disconnect()});let _t=L(()=>Vm([{id:`debug`,label:`DEBUG`,tab:`chat`,available:e=>!!e.threadId,run:()=>void Nn()}],W(s),W(ft))),vt=L(()=>iT(W(ft)?.workspacePath??``)),yt=L(()=>W(ft)?`${W(ft).provider===`kimi`?`Kimi · `:``}${W(ft).model??T}`:T);function bt(e){return`kind`in e&&e.kind===`org-source`}function xt(e){return a?e.filter(e=>e.id===W(j)):e}let St=L(()=>W(Ke)?W(Ke):W(Ze)&&bt(W(Ze))?W(Ze):W(Ze)?{kind:`ready`,sessionId:`catalog`,plan:W(Ze)}:{kind:`loading`,sessionId:`catalog`}),Ct=L(()=>W(et)?null:W(Ge).kind===`ready`||W(Ge).kind===`closing`||W(Ge).kind===`error`&&W(Ge).plan?W(Ge):null),wt=L(()=>fw(W(Ge).kind===`ready`||W(Ge).kind===`closing`||W(Ge).kind===`error`?W(Ge).plan:void 0)),Et=R(cn({workspaceId:null,summary:null,loading:!1,refreshing:!1,checkingOut:!1,error:null})),Dt=L(()=>W(Et).workspaceId),Ot=R(cn(new Set)),kt=R(!1),At=R(!1),jt=R(!1),Mt=R(null),Nt=R(null),Pt=R(null),Ft=cn({}),It=R({}),Lt=R(null),Rt=L(()=>{let e=W(o)?.interactions.findLast(e=>e.state!==`pending`);return e?e.state===`submitting`?`Sending decision.`:e.state===`failed`?`Could not send decision. Retry is available.`:e.state===`resolved`?e.attemptedOutcome===`denied`?`Decision denied.`:e.attemptedOutcome===`dismissed`?`Request is no longer awaiting a response.`:e.attemptedOutcome===`answered`?`Answers sent.`:`Decision approved.`:``:``}),zt=nw((e,n)=>t.authorizedFetch(e,n)),Bt=new DE({relay:zt,publish:e=>z(we,e),onComplete:e=>{let t=e.id;z(Ce,W(Ce).filter(e=>e.id!==t),!0),je+=1,z(Pe,rT(W(Pe),e),!0),W(j)===t&&(M.invalidate(),Ut.select(null),Ht.select(null),z(j,null),z(s,`sessions`),Zt.saveSelectedSession(null),Yt.select(null)),Gn().then(()=>{z(Pe,rT(W(Pe),e),!0)})},onError:e=>{z(x,ii(e,`SESSION_FORGET_FAILED`,!1),!0)}}),Vt=new dg(zt,e=>z(Oe,e)),Ht=new Kh({relay:zt,publish:e=>z(Ee,new Map(e)),publishEfficiency:e=>z(De,new Map(e)),onEvent:(e,t)=>{Vt.observe(e,t),t.type===`session.forget.updated`&&Bt.observe(e,t.payload)},onAuthoritativeSnapshot:(e,t)=>Vt.applyAuthoritative(e,t)}),Ut=new MS({relay:zt,cache:Vx(),publish:e=>z(o,e,!0),onConnectionChange:e=>{e&&W(j)&&(Ht.hydrate(W(j)),Gn()),e?W(te)&&W(pt)&&!W(re)&&ae():(ie?.abort(),z(ne,null),z(re,!1))},onSessionEvent:e=>si(e),onRelayEvent:e=>{W(j)&&Ht.observe(W(j),e),W(j)&&sn(W(j),e);let t=e.payload?.id===`gestalt-serena-availability`?`gestalt-serena`:null,n=W(o)?.activities.some(e=>e.mcpStartup?.serverName===t&&e.mcpStartup.threadId===null&&e.mcpStartup.failure)?null:nC(e);n&&Qt.enqueue(n),e.type===`activity.updated`&&e.payload?.id===`gestalt-serena-availability`&&(ie?.abort(),z(ne,null),z(re,!1)),W(pt)&&z(ne,Ex(W(ne),e))},onHistoryError:e=>{z(x,ii(e,`SESSION_HISTORY_READ_FAILED`),!0)},onSendError:(e,t)=>{let n=zS(e,`MESSAGE_SEND_FAILED`);if(n.code===`SESSION_WORKSPACE_BUSY`&&e instanceof Error&&`sessionId`in e&&typeof e.sessionId==`string`&&(z(Re,e.sessionId,!0),z(s,`sessions`)),n.code===`SESSION_WORKSPACE_UNAVAILABLE`){z(Ve,null),z(N,null),Qt.enqueue({kind:`warning`,...n});return}z(Ve,n.message,!0),z(N,n.retryable?t:null,!0),z(x,ii(e,`MESSAGE_SEND_FAILED`),!0)},onSendAccepted:(e,t)=>{W(N)===t&&(z(Ve,null),z(N,null));let n=We.get(t);n&&n.sessionId===e&&rr(n)},onHistoryPromptAccepted:(e,t)=>{let n=We.get(t);n&&n.sessionId===e&&rr(n)}}),Wt=new cD({start:zt.startSession},qh,e=>{z(Le,e,!0),z(Re,e.conflict?.sessionId,!0)},e=>z(x,ii(e,`SESSION_START_FAILED`),!0)),Gt=new qC({getSummary:zt.getGitSummary,pull:zt.pullGit,checkout:zt.checkoutGitBranch},e=>!!hC(W(w),e)?.isGitRepository,e=>z(Et,e,!0),(e,t)=>ii(e,t)),Kt=SO((e,n)=>t.authorizedFetch(e,n));function qt(e){let t=W(ke).get(e.id);return t?{...e,plan:t.plan,...t.detached&&e.lastOrgPlan?{lastOrgPlan:{...e.lastOrgPlan,attached:!1}}:{}}:e}function Jt(e,t,n=!1){z(ke,new Map(W(ke)).set(e,{plan:t,detached:n})),z(Ce,W(Ce).map(t=>t.id===e?qt(t):t),!0)}let Yt=dw({getPlan:zt.getPlan,closePlan:zt.closePlan},e=>{z(Ge,e,!0),e.kind===`ready`||e.kind===`closing`?Jt(e.sessionId,e.plan):e.kind===`unavailable`&&e.sessionId&&Jt(e.sessionId,void 0,W(ke).get(e.sessionId)?.detached)}),Xt=dw({getPlan:zt.getPlan,closePlan:zt.closePlan},e=>{z(Ke,e.sessionId?e:null,!0),e.sessionId&&(e.kind===`unavailable`||e.kind===`error`)&&Qt.enqueue({kind:`error`,code:`SESSION_PLAN_VIEW_${e.sessionId}`,message:`The plan for this session could not be opened.`})}),Zt=_E(),Qt=tC({historyStorage:$S()}),$t=YS(Qt,$S()),en=`/api/codex/allowance/auto-reset`,tn=R(null),nn=R(!1),rn=0,an=new AbortController;async function on(e){if(!(W(nn)||W(tn)===null)){z(nn,!0),++rn;try{let n=await t.authorizedFetch(en,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e}),signal:an.signal});if(!n.ok)throw Error(`CODEX_AUTO_RESET_SAVE_FAILED`);let r=XS.parse(await n.json());an.signal.aborted||(z(tn,r.enabled,!0),$t(r.resets))}catch{an.signal.aborted||Qt.enqueue({kind:`error`,message:`Could not save the Codex reset credit preference.`})}finally{z(nn,!1)}}}Yi(()=>{let e,n=async()=>{let r=rn;try{let e=await t.authorizedFetch(en,{signal:an.signal});if(!e.ok)return;let n=XS.parse(await e.json());an.signal.aborted||(r===rn&&!W(nn)&&z(tn,n.enabled,!0),$t(n.resets))}catch{}finally{an.signal.aborted||(e=setTimeout(()=>void n(),15e3))}};return n(),()=>{an.abort(),clearTimeout(e)}});let sn=rC(Qt),ln=new URLSearchParams(location.search).get(`tree-evidence`),un=new URLSearchParams(location.search).get(`toast-evidence`),pn=new URLSearchParams(location.search).get(`activity-evidence`),mn=xg(window.sessionStorage),hn=new Set;Pn(()=>{for(let[e,t]of W(Oe).attention){let n=`${e}:${t.requestId}`;mn.claim(n)&&Qt.enqueue({kind:`error`,code:`AUTOPILOT_ATTENTION_${t.requestId}`,message:`Autopilot needs your attention.`})}}),Pn(()=>{let e=new Set;for(let[t,n]of W(Oe).errors){let r=`${t}:${n}`;e.add(r),!hn.has(r)&&(hn.add(r),Qt.enqueue({kind:n===`Autopilot is recovering after a continuation or agent status check failed. It will retry automatically. If recovery persists, retry Autopilot or restore the session.`?`warning`:`error`,message:n}))}for(let t of hn)e.has(t)||hn.delete(t)});function gn(){z(u,!0)}function _n(){z(u,!1),Or().then(()=>document.querySelector(`.menu-trigger`)?.focus())}function vn(){z(l,!1),Or().then(()=>document.querySelector(`.menu-trigger`)?.focus())}let yn=R(!1);async function bn(){if(!W(yn)){z(yn,!0);try{Qt.enqueue(Mm(await zt.cleanTmp()))}catch(e){ii(e,`TMP_CLEANUP_UNAVAILABLE`)}finally{z(yn,!1)}}}async function xn(){try{await zt.quit()}catch(e){throw ii(e,`QUIT_FAILED`),e}}let Sn=new AbortController;async function Cn(){try{await km((await zt.upgrade()).instanceId,zt.upgradeStatus,Sn.signal),window.location.reload()}catch(e){throw Sn.signal.aborted||ii(e,`UPGRADE_FAILED`),e}}Pn(()=>{W(Se)&&OC(W(ve)||null)}),Yi(async()=>{if(ln===`sessions`||ln===`git`||un===`error`||un===`stacked`)return;let e=je;try{let n=await Ax(t.authorizedFetch);je===e&&z(Ce,Bt.reconcile(n.sessions).map(qt),!0),z(ve,gC(W(ve)||null,W(w),n.workspaces,uC.sessionBase)??``,!0),z(w,n.workspaces,!0),z(fe,n.profiles),z(k,{codex:[...new Set(n.models?.codex??[T])],kimi:n.models?.kimi??[]}),z(ce,{...W(ce),kimi:W(ce).kimi||(n.models?.kimi?.[0]??``)}),z(le,n.capabilities?.providers??null);try{if(n.sessionDefaultsError)throw Error(`SESSION_DEFAULTS_READ_FAILED`);let e=n.sessionDefaults;if(e){let t=Xp(e,e?.provider??`codex`,W(k)[e?.provider??`codex`]);z(Fe,t.sandbox,!0),z(Ie,t.approvalPolicy,!0),z(ge,t.skillProfile,!0),z(se,t.provider,!0),z(E,t.reasoningEffort,!0),z(D,t.executorModel,!0),z(O,t.executorReasoningEffort,!0),z(ce,{codex:Xp(e,`codex`,W(k).codex).model,kimi:Xp(e,`kimi`,W(k).kimi).model}),hC(n.workspaces,t.workspaceId)&&z(ve,t.workspaceId,!0),W(k)[t.provider].includes(t.model)||z(k,{...W(k),[t.provider]:[t.model,...W(k)[t.provider]]})}else W(ce).codex===T&&z(ce,{...W(ce),codex:Xp(null,`codex`,W(k).codex).model})}catch(e){ii(e,`SESSION_DEFAULTS_READ_FAILED`)}z(ee,n.versions??[]),z(oe,n.branding?.headerIconUrl??null,!0),z(ve,DC(W(w),W(ve))??``,!0),z(Se,!0),W(s)===`git`&&Gt.select(W(ve)||null),a||Ar(),z(xe,dC(W(w)),!0),z(Ot,dC(W(w)),!0);let r=a?null:await Zt.readSelectedSession();W(j)||z(j,a?W(Ce).find(e=>e.id===a)?.id??null:W(Ce).some(e=>e.id===r)?r:W(Ce)[0]?.id??null,!0);let i=W(j);if(i){let e=await Zt.readDraftEnvelope(i);W(j)===i&&(z(He,e.text,!0),Ue=e.revision,ir(i,e.pending))}let o=xt(W(Ce).filter(e=>[`ready`,`turnActive`].includes(e.state)));Ht.bootstrap(o,W(j)),Vt.bootstrap(o),a||Wn(),Yt.select(W(j)),W(j)?Ut.select(W(j)):a&&z(x,`This session is no longer open in Gestalt Mobile.`)}catch(e){z(x,ii(e,`RELAY_UNAVAILABLE`),!0)}});function wn(){W(Je)&&xr(),z(s,`chat`),Fr(`chat`),Lr()}function Tn(e){z(S,ua(e),!0)}function En(){if(!W(j))return;let e=window.open(Wx(location.href,W(j)),Gx(W(j)),`popup,width=760,height=900`);if(!e){Qt.enqueue({kind:`error`,message:`The Chat window was blocked. Allow pop-ups for this site and try again.`});return}try{e.opener=null}catch{}e.focus()}Xi(()=>{M.dispose(),Sn.abort(),tt?.abort(),nt?.abort(),Ut.dispose(),Bt.dispose(),Ht.dispose(),Vt.dispose(),Yt.dispose(),Xt.dispose(),Gt.dispose(),Wt.dispose(),W(pe)?.dispose()});async function Dn(e){z(se,e,!0);let t=W(k)[e];if(!W(ce)[e]&&t[0]&&z(ce,{...W(ce),[e]:t[0]}),!(t.length>0)){z(ue,e,!0);try{let t=await zt.listSessionModels(e);z(k,{...W(k),[e]:t.models}),!W(ce)[e]&&t.models[0]&&z(ce,{...W(ce),[e]:t.models[0]})}catch(e){ii(e,`SESSION_MODELS_READ_FAILED`)}finally{W(ue)===e&&z(ue,null)}}}async function On(){if(!W(ve)||W(ze))return;let e=W(de)?W(se):`codex`,t=sD({workspaceId:W(ve),profile:`default`,profileState:`ok`});if(t.profile){z(x,t.profile,!0);return}let n=kn();z(x,`Starting session…`);let r=await Wt.start(W(ve),{provider:e,sandbox:W(Fe),approvalPolicy:W(Ie),model:W(ce)[e]||void 0,...e===`codex`?{reasoningEffort:W(E),executorModel:W(D),executorReasoningEffort:W(O)}:{},...W(ge)?{skillProfile:W(ge)}:{mandatorySkillsOnly:!0}});if(r)try{await An(r,`empty`,n)}catch(e){ii(e,`SESSION_START_FAILED`)}}function kn(){let e=M.begin(),t=W(s);return()=>e()&&W(s)===t}async function An(e,t,n){await lE(e,{publish:e=>{let t=W(Ce).find(t=>t.id===e.id);z(Ce,t?W(Ce).map(t=>t.id===e.id?{...t,...e}:t):[...W(Ce),e],!0),je+=1},warn:e=>Qt.enqueue({kind:`warning`,code:`SKILL_PROFILE_MISSING_SKILL`,message:e}),select:(e,t)=>{z(j,e.id,!0),z(Ve,null),z(N,null),z(He,``),Ue=0,Yt.select(e.id),Ut.select(e.id,t===`empty`?{history:`empty`}:{}),Ht.select(e.id)},saveSelectedSession:e=>Zt.saveSelectedSession(e),refreshRoster:async()=>{try{await zn()}catch(e){ii(e,`SESSION_REFRESH_FAILED`)}},readDraft:e=>Zt.readDraftEnvelope(e),restoreDraft:(e,t)=>{z(He,t.text,!0),Ue=t.revision,ir(e,t.pending)}},{history:t,isCurrent:n,present:()=>{wn(),z(x,`Session started.`)}})}async function jn(e){if(e.kind!==`started`&&e.kind!==`partial`)return;let t=kn();try{let n;try{n=await zt.getSession(e.session.id)}catch(t){ii(t,`SESSION_REFRESH_FAILED`),n=e.session}await An(n,`load`,t)}catch(e){ii(e,`SESSION_START_FAILED`),Gn()}}let Mn;async function Nn(e,t=W(ft)?.id,n){if(!t||W(p)||!e&&!W(ft)?.threadId)return;let r=W(j),i=W(s);Mn=n??document.querySelector(`.menu-trigger`)??void 0;let a=++g;z(p,!0);try{let n=await zt.debugConfirmation(t,e);a===g&&W(j)===r&&W(s)===i&&z(f,n)}catch(e){ii(e,`DEBUG_CONTEXT_FAILED`)}finally{a===g&&z(p,!1)}}function Fn(){z(f,null),queueMicrotask(()=>Mn?.focus())}async function In(){let e=W(f);if(e)try{let t=await zt.startSelfDebug(e.context.mobileSession,e.confirmationId);z(f,null),await zn(),await Kn(t.id)}catch(e){throw ii(e,`DEBUG_START_FAILED`),Gn(),e}}function Ln(e,t){h=t,z(m,e)}function Rn(){z(m,null),queueMicrotask(()=>h?.focus())}async function zn(){let e=++Ae;Me?.abort();let t=new AbortController;Me=t;try{let n=await zt.listSessions(t.signal);if(e!==Ae||t.signal.aborted)return;z(Ce,Bt.reconcile(n).map(qt),!0),je+=1;let r=xt(W(Ce).filter(e=>[`ready`,`turnActive`].includes(e.state)));Ht.bootstrap(r,W(j)),Vt.bootstrap(r)}catch(e){if(t.signal.aborted||oi(e))return;throw e}finally{Me===t&&(Me=null)}}async function Bn(e,t){Bt.isBusy(e)||(await Vt.toggle(e,t),e===W(j)&&zn().catch(()=>{}))}async function Hn(e){await Bn(e,!0),await Or(),e===W(j)&&document.getElementById(`chat-autopilot-${e}-button`)?.focus({preventScroll:!0})}async function Un(e,t,n){Bt.isBusy(e)||(await Vt.resolve(e,t,n),e===W(j)&&zn().catch(()=>{}))}async function Wn(){try{z(Pe,await zt.listRecentSessions(),!0)}catch{z(Pe,[],!0)}}async function Gn(){try{await Promise.all([zn(),Wn()])}catch(e){z(x,ii(e,`SESSION_REFRESH_FAILED`),!0)}}async function Kn(e){if(Bt.isBusy(e))return;let t=eT(W(Ce),e);if(t){z(Re,t.id,!0),z(s,`sessions`),z(x,ii(Object.assign(Error(`Workspace already running`),{code:`SESSION_WORKSPACE_BUSY`}),`SESSION_WORKSPACE_BUSY`),!0);return}z(x,`Opening session…`);let n=M.beginOpen(e);try{z(j,e,!0),z(Ve,null),z(N,null),Yt.select(e),Zt.saveSelectedSession(e),Ut.select(e),Ht.select(e),wn();let t=await Zt.readDraftEnvelope(e);n.isCurrent()&&W(j)===e&&(z(He,t.text,!0),Ue=t.revision,ir(e,t.pending))}catch(e){z(x,ii(e,`SESSION_HISTORY_READ_FAILED`),!0)}finally{n.finish()}}async function qn(e){z(x,`Opening recent session…`);try{let t=await zt.openRecentSession(e.id,e.cwd,e.provider??`codex`);W(Ce).some(e=>e.id===t.id)||(z(Ce,[...W(Ce),t],!0),je+=1),Gn(),await Kn(t.id)}catch(e){z(x,ii(e,`SESSION_HISTORY_READ_FAILED`),!0)}}async function Jn(e){if(!Bt.isBusy(e)){z(x,`Closing session…`);try{await zt.releaseSession(e),W(j)===e&&(M.invalidate(),z(j,null),z(s,`sessions`),Zt.saveSelectedSession(null),Ut.select(null),Ht.select(null),Yt.select(null)),await Gn(),z(x,`Session closed.`)}catch(e){z(x,ii(e,`SESSION_CLOSE_FAILED`),!0)}}}async function Yn(){z(ye,!0);try{if(!(await t.authorizedFetch(`/api/session-defaults`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({workspaceId:W(ve),skillProfile:W(ge),provider:W(A),model:W(ce)[W(A)],reasoningEffort:W(E),executorModel:W(D),executorReasoningEffort:W(O),sandbox:W(Fe),approvalPolicy:W(Ie)})})).ok)throw Error(`SESSION_DEFAULTS_SAVE_FAILED`);z(x,`Session defaults saved.`),Qt.enqueue({kind:`success`,message:`Session defaults saved.`})}catch(e){ii(e,`SESSION_DEFAULTS_SAVE_FAILED`)}finally{z(ye,!1)}}async function Xn(e,t){let n=W(Ce).find(t=>t.id===e);n&&await Bt.forget(n,t)}async function Zn(e){await d_(e)?(z(x,`Resume command copied.`),Qt.enqueue({kind:`success`,message:W(x)})):z(x,ii(Error(`SESSION_COPY_FAILED`),`SESSION_COPY_FAILED`),!0)}async function Qn(e){if(!(!W(j)||Bt.isBusy(W(j))||W(o)?.activeTurnId))try{let t=await zt.selectModel(W(j),e);z(Ce,W(Ce).map(e=>e.id===t.id?{...e,...t}:e),!0),z(He,``),z(x,`Model changed to ${e}; it applies to the next turn.`)}catch(e){z(x,`Could not change model: ${ni(e)}`)}}async function $n(e){if(!W(j)||Bt.isBusy(W(j))||!W(He).trim()||!Ut.canSubmit(e)||[...We.values()].some(e=>e.sessionId===W(j)&&e.revision===Ue))return;let t=qh(),n={sessionId:W(j),revision:Ue,text:W(He),operationId:t,kind:e};We.set(t,n),Zt.addPendingDraftOperation(W(j),n),e===`send`?Ut.send(n.text,t):e===`queue`?Ut.queue(n.text,t):Ut.interruptAndSend(n.text,t)}let er=()=>$n(`send`),tr=()=>$n(`queue`),nr=()=>$n(`interrupt-send`);async function rr(e){let t=await Zt.consumeAcceptedDraft(e.sessionId,e.revision,e.operationId);t&&We.delete(e.operationId),t&&e.sessionId===W(j)&&e.revision===Ue?(W(N)===e.operationId&&(z(N,null),z(Ve,null)),z(He,``),Ue=t.revision,Ir()):e.sessionId===W(j)&&e.revision===Ue&&(z(Ve,null),z(N,e.operationId,!0),Qt.enqueue({kind:`warning`,code:`PROMPT_LOCAL_RECOVERY_${e.operationId}`,message:`The accepted prompt could not be saved locally. Keep this text until recovery completes. Retry is available.`}))}function ir(e,t){for(let n of t??[])We.set(n.operationId,{sessionId:e,...n});e===W(j)&&(t?.length??0)>0&&(z(Ve,null),z(N,t[0].operationId,!0),Qt.enqueue({kind:`warning`,code:`PROMPT_RECOVERY_${W(N)}`,message:`A submitted prompt is being recovered. It will not be sent again automatically. Retry is available.`}))}async function ar(){if(!W(N))return;z(Ve,null);let e=We.get(W(N));if(!e){await Ut.retryPrompt(W(N));return}e.kind===`send`?await Ut.send(e.text,e.operationId):e.kind===`queue`?await Ut.queue(e.text,e.operationId):await Ut.interruptAndSend(e.text,e.operationId)}async function or(){await Ut.interrupt()}async function sr(e){let t=W(ft)?.workspaceId;if(!t){Qt.enqueue({kind:`error`,message:`Select a session workspace before uploading.`});return}for(let n of Yg(e)){if(n.status===`too-large`){Qt.enqueue({kind:`error`,message:`${n.file.name} exceeds the 100 MiB file limit.`});continue}try{let e=/\.org$/i.test(n.file.name)?`.gestalt`:``,r=await zt.uploadWorkspaceFile(t,{directory:e,filename:n.file.name,conflict:`keep-both`,file:n.file},qh());Qt.enqueue({kind:`success`,message:e?`Uploaded ${r.path}.`:`Uploaded ${r.path} to workspace root.`}),Wr()}catch(e){ii(e,`WORKSPACE_FILES_UPLOAD_FAILED`)}}}function cr(){W(s)===`chat`&&W(j)&&Ut.refresh()}function lr(e){if(a||e===`chat`&&!W(Ne))return;let t=W(s)!==e;t&&M.invalidate(),z(s,e,!0),Fr(e),e===`chat`&&(cr(),t&&Lr()),e===`git`&&(W(Dt)===(W(ve)||null)?W(Dt)&&Gt.refresh():(Gt.select(W(ve)||null),z(kt,!1))),e===`plan`&&(t?W(j)&&Yt.refresh(W(j)):Er()),e===`sessions`&&(W(me)===`profile-manager`&&Pr(!1),Gn(),W(j)&&Yt.refresh(W(j)))}Pn(()=>{let e=W(ut);W(s)!==`plan`||a||jr(()=>_r(e))});let ur=!1;function dr(){document.visibilityState!==`visible`||ur||(ur=!0,queueMicrotask(()=>{ur=!1,document.visibilityState===`visible`&&(W(s)===`git`&&W(Dt)&&Gt.refresh(),(W(s)===`sessions`||W(ht))&&(Gn(),W(j)&&Yt.refresh(W(j))))}))}let fr=null;function pr(e){return e instanceof Element&&e.closest(`button, input, textarea, select, a, summary, [contenteditable]`)!==null}function mr(e){e.pointerType!==`touch`||pr(e.target)||(fr={pointerId:e.pointerId,x:e.clientX,y:e.clientY})}function hr(e){if(!fr||e.pointerId!==fr.pointerId)return;let t=fr;fr=null;let n=e.clientX-t.x,r=e.clientY-t.y;Math.abs(n)<48||Math.abs(n)<=Math.abs(r)||lr(uD(W(s),n<0?1:-1,{chatEnabled:W(Ne)}))}function gr(e){fr?.pointerId===e.pointerId&&(fr=null)}function _r(e=W(ut)){if(tt&&at===e)return;if(tt?.abort(),!e){z(Xe,{kind:`no-workspace`});return}let t=new AbortController;tt=t,at=e;let n=++rt;z(Xe,it?.workspaceId===e?{...it,refreshing:!0}:{kind:`loading`,workspaceId:e}),zt.listWorkspacePlans(e,t.signal).then(r=>{n!==rt||t.signal.aborted||(it={kind:`ready`,workspaceId:e,entries:r},z(Xe,it))}).catch(r=>{n!==rt||t.signal.aborted||(!W(Je)&&!W(Ct)&&Qt.enqueue({kind:`error`,code:`WORKSPACE_PLANS_READ_FAILED`,message:`Workspace Org files could not be listed. Try opening the Plan tab again.`}),z(Xe,it?.workspaceId===e?it:{kind:`error`,workspaceId:e,error:r instanceof Error?r.message:`Could not load workspace plans.`}))}).finally(()=>{tt===t&&(tt=null)})}function vr(e,t=!1,n=!1){let r=t?W(ft)?.workspaceId:W(ut);if(!r)return;n||(M.invalidate(),W(s)===`plan`&&!t&&z(et,!0),z(Ze,null),z(Qe,e,!0),Sr()),W(Ke)&&Xt.select(null),nt?.abort();let i=new AbortController;nt=i;let a=++ct;z(ot,t,!0),(t&&W(j)?zt.openSessionPlan(W(j),e):zt.getWorkspacePlan(r,e,i.signal)).then(t=>{a!==ct||i.signal.aborted||(z(Ze,t),z(Qe,e,!0))}).catch(()=>{a!==ct||i.signal.aborted||(W(Ze)||xr(),Qt.enqueue({kind:`error`,code:`WORKSPACE_PLAN_OPEN_${e}`,message:`This Org file could not be opened. Check that it is readable and try again.`}))}).finally(()=>{nt===i&&(nt=null)})}function yr(e){let t=W(ft)?.workspaceId,n=W(dt),r=n?l_(e,n):null;if(!t||!r){Qt.enqueue({kind:`error`,code:`ORG_LINK_OUTSIDE_WORKSPACE`,message:`This Org file is not inside the selected workspace and cannot be opened.`});return}vr(r,!0)}function br(){M.invalidate(),z(et,!0),_r()}function xr(){z(qe,null),W(Ke)&&Xt.select(null),nt?.abort(),nt=null,++ct,z(Ze,null),z(Qe,null)}function Sr(){let e=document.activeElement;z(qe,W(qe)??{trigger:e instanceof HTMLElement?e:null,left:window.scrollX,top:window.scrollY})}function Cr(){let e=W(qe);M.invalidate(),xr(),Or().then(()=>{W(Je)||!e?.trigger?.isConnected||(e.trigger.focus({preventScroll:!0}),window.scrollTo({left:e.left,top:e.top,behavior:`instant`}))}),W(s)===`plan`&&_r()}function wr(){W(j)&&Tr(W(j))}function Tr(e){tT(W(Ce).find(t=>t.id===e))&&(M.invalidate(),nt?.abort(),++ct,z(Ze,null),z(Qe,null),Xt.select(e),Sr())}function Er(){W(Ke)?.sessionId&&Xt.refresh(W(Ke).sessionId),W(j)&&Yt.refresh(W(j)),W(Qe)&&vr(W(Qe),W(ot),!0),_r()}async function Dr(e){let t=W(ut);if(!(!t||W(st).includes(e))){z(st,[...W(st),e],!0);try{await zt.archiveWorkspacePlan(t,e),it?.workspaceId===t&&(tt?.abort(),tt=null,it={...it,entries:it.entries.map(t=>t.planName===e?{...t,archived:!0}:t)},z(Xe,it),_r(t)),Qt.enqueue({kind:`success`,message:`Plan archived.`})}catch{Qt.enqueue({kind:`error`,code:`PLAN_ARCHIVE_FAILED`,message:`The plan could not be archived. Check that it is writable and try again.`})}finally{z(st,W(st).filter(t=>t!==e),!0)}}}async function kr(e,t){let n=new jD(zt,e=>Qt.enqueue({kind:`error`,code:`SKILL_PROFILE_OPERATION_FAILED`,message:e}));await n.load(e,t),z(pe,n,!0)}async function Ar(){try{let e=await zt.listSkillProfiles();z(he,e.profiles.filter(e=>!(`error`in e)));let t=e.profiles.find(e=>`error`in e);z(_e,t&&`error`in t?t.error.message:``,!0),W(he).some(e=>e.name===W(ge))||z(ge,``)}catch(e){z(he,[]),z(_e,e instanceof Error?e.message:`Unable to load saved skill profiles.`,!0)}}async function Mr(e){let t=W(ve)||W(w)[0]?.id||``,n=W(fe).find(e=>e.state===`ok`)?.name??``;if(!t||!n){z(x,`Choose a workspace and available Codex profile before managing skill profiles.`);return}await kr(t,n),z(me,`profile-manager`)}function Nr(e){queueMicrotask(()=>e.focus())}async function Pr(e=!0){if(z(me,`list`),await Or(),e){let e=document.getElementById(`manage-skill-profiles`),t=e?.closest(`.advanced-settings`);t&&(t.open=!0),e?.focus()}}function Fr(e){requestAnimationFrame(()=>{W(s)===e&&window.scrollTo({top:0,behavior:`instant`})})}function Ir(){Fr(`chat`)}function Lr(){Or().then(()=>{W(s)===`chat`&&document.getElementById(`message`)?.focus({preventScroll:!0})})}function Rr(e){z(ve,e.id,!0),Gt.select(e.id),z(kt,!1)}async function zr(e,t,n){let r=!n||!W(Qe)||W(ot),i=n&&W(Ke)?W(Ye)?.workspaceId:r?W(ft)?.workspaceId:W(ut),a=W(Qe)??``;if(!i)return[];let o=e=>r?e:zA(a,e),s=new Set;try{for(let n=0;n<e.length;n+=64){if(t.aborted)return[];(await zt.checkWorkspaceFileReferences(i,e.slice(n,n+64).map(o),t)).paths.forEach(e=>s.add(e))}return e.filter(e=>s.has(o(e)))}catch(e){return t.aborted||ii(e,`WORKSPACE_FILES_READ_FAILED`),[]}}function Vr(e,t){let n=!t||!W(Qe)||W(ot),r=t&&W(Ke)?W(Ye)?.workspaceId:n?W(ft)?.workspaceId:W(ut);r&&z(d,{workspaceId:r,path:n?e:zA(W(Qe)??``,e)},!0)}function Hr(e){let t=W(Dt)?hC(W(w),W(Dt)):null;t&&(z(_,t,!0),z(v,e,!0))}async function Ur(){z(_,null),await Or(),W(v)?.focus({preventScroll:!0})}function Wr(){y||(y=!0,queueMicrotask(()=>{y=!1,W(Dt)&&Gt.refresh()}))}async function Gr(){let e=W(Dt);!e||!hC(W(w),e)?.isGitRepository||(z(Nt,W(Nt)??qh(),!0),await Gt.pull(W(Nt)),W(Et).error||z(Nt,null))}async function Kr(e){if(W(At))return;let n=W(Dt)?hC(W(w),W(Dt)):void 0;if(!n||n.isGitRepository){z(Mt,null),Qt.enqueue({kind:`error`,code:`INVALID_CLONE_DESTINATION`,message:`Select a non-repository folder before cloning.`});return}let r=n.id;z(At,!0),z(Mt,null);try{await zt.cloneGitRepository(r,e);let n=await Ax(t.authorizedFetch),i=JC(W(w),n.workspaces,r,e,W(Ot));z(ve,gC(W(ve)||null,W(w),n.workspaces,uC.sessionBase)??``,!0),z(w,n.workspaces,!0),z(ve,i.selectedId??W(ve),!0),Gt.select(i.selectedId),z(Ot,i.expandedIds,!0),z(Mt,`Repository cloned into the selected workspace.`),Qt.enqueue({kind:`success`,message:`Repository cloned.`})}catch(e){ii(e,`GIT_CLONE_FAILED`)}finally{z(At,!1)}}async function qr(e){W(Dt)&&await Gt.checkout(e)}async function K(){let e=W(Dt);if(!(!e||W(jt))){z(jt,!0),z(Pt,W(Pt)??qh(),!0);try{await zt.pushGit(e,W(Pt)),z(kt,!1),await Gt.refresh(),z(Pt,null)}catch(e){ii(e,`GIT_PUSH_FAILED`)}finally{z(jt,!1)}}}async function Xr(e,t){await Ut.respond(e,{decision:t})}async function Zr(e){let t=e.kind===`quiz`?xv(e.payload):Sv(e.payload);if(!t)return;let n=t.questions.map(t=>({id:t.id,answer:Ft[`${e.requestId}:${t.id}`]??``})),r=t.questions.map((e,t)=>({id:e.id,header:e.header,question:e.question,answer:n[t]?.answer??``}));z(It,{...W(It),[e.requestId]:r});let i=e.kind===`quiz`?Cv(n):QC(n);try{let t=`quiz-answer:${e.requestId}`,n=W(o)?.prompts.find(e=>e.operationId===t);if(!n||n.state===`failed`){let e=ey(r);W(o)?.activeTurnId?await Ut.queue(e,t):await Ut.send(e,t)}let a=Ut.view.prompts.find(e=>e.operationId===t);if(e.kind===`quiz`&&(!a||a.state===`failed`))return;await Ut.respond(e.requestId,i)}catch{z(x,`Could not send quiz answers. Please try again.`)}}async function Qr(e){let t=ZC(e.payload);if(!t){z(x,`Codex sent an invalid permission request.`);return}await Ut.respond(e.requestId,t)}function $r(e){e.kind===`quiz`||e.kind===`userInput`?Zr(e):e.kind===`permissionsApproval`?Qr(e):Ut.retryInteraction(e.requestId)}function ei(e,t,n){Ft[`${e}:${t}`]=n}function ti(e){z(He,e,!0),Ue+=1;let t=W(j);t&&Zt.replaceDraftText(t,e,Ue)}function ni(e){return e instanceof Error?e.message:`Unknown relay error.`}function ii(e,t,n=!0){let{code:r,...i}=zS(e,t);return Qt.enqueue({kind:`error`,...i,...n?{code:r}:{}}),i.message}function ai(e){Qt.enqueue(e?{kind:`success`,message:`Code copied.`}:{kind:`error`,message:`Code could not be copied. Select it and copy it manually.`})}function oi(e){return(e instanceof DOMException||e instanceof Error)&&e.name===`AbortError`}function si(e){let t=W(j);if(!t)return;if(e.type===`session.forget.updated`){Bt.observe(t,e.payload);return}if(e.type===`agent.activity.updated`)return;if(e.type===`session.status.updated`){let n=e.payload;IS(n)&&z(Ce,W(Ce).map(e=>e.id===t?{...e,sessionStatus:n}:e),!0);return}if(e.type===`session.updated`&&typeof e.payload==`object`&&e.payload!==null){let n=e.payload;n.id===t&&z(Ce,W(Ce).map(e=>e.id===t?{...e,...n}:e),!0);return}if(e.type!==`plan.updated`&&e.type!==`plan.closed`)return;let n=W(Ge);Yt.applyEvent(t,e),Xt.applyEvent(t,e),e.type===`plan.closed`&&W(Ge)!==n&&Jt(t,void 0,!0)}var X=Yr();hi(`1d2e8zz`,e=>{Vn(()=>{fn.title=a&&W(vt)?`Chat · ${W(vt)} · Gestalt Mobile`:`Gestalt Mobile`})}),Br(`focus`,dn,dr),Br(`resize`,dn,gt),Br(`visibilitychange`,fn,dr);var ci=V(X),li=e=>{Uh(e,{})},ui=e=>{lC(e,{get variant(){return un}})},di=e=>{var t=xj();TC(B(t),{get context(){return ln}}),P(t),q(e,t)},fi=e=>{var h=Pj(),g=V(h);let v;var y=B(g),b=e=>{{let n=L(()=>W(s)===`chat`?iT(W(Ce).find(e=>e.id===W(j))?.workspacePath??``):null),r=L(()=>W(s)===`chat`?W(yt):null),i=L(()=>W(ft)&&W(ft).provider!==`kimi`?W(ne):void 0),a=L(()=>W(s)===`chat`&&W(j)?En:void 0),o=L(()=>W(s)===`chat`&&W(ft)?()=>{W(ft)?.resumeCommand&&Zn(W(ft).resumeCommand)}:void 0),u=L(()=>!!W(ft)?.resumeCommand);Tm(e,{get theme(){return W(S)},get sessionPath(){return W(n)},get sessionModel(){return W(r)},get weeklyQuotaRemaining(){return W(wt)},get brandIconUrl(){return W(oe)},get componentVersions(){return W(ee)},get retrieval(){return W(i)},get readinessLoading(){return W(re)},onreadinessrefresh:()=>void ae(),onconfigurationchange:e=>z(te,e,!0),get contextualActions(){return W(_t)},get passkeyAuthEnabled(){return t.passkeyAuthEnabled},get onlock(){return t.onlock},ondevices:()=>z(c,!0),onnotifications:()=>z(l,!0),onscratchpad:gn,oncleantmp:bn,get cleanTmpPending(){return W(yn)},onquit:xn,onupgrade:Cn,onthemechange:Tn,get ondetach(){return W(a)},get oncopytocli(){return W(o)},get copyToCliAvailable(){return W(u)}})}};Y(y,e=>{!W(c)&&!W(l)&&!a&&e(b)});var C=H(y,2),E=e=>{var t=Cj(),n=B(t),r=H(B(n),2),i=B(r,!0);P(r),P(n);var o=H(n,2),s=e=>{var t=Sj(),n=B(t);P(t),U(()=>J(n,`${W(ft).provider===`kimi`?`Kimi · `:``}${W(ft).model??``}`)),q(e,t)};Y(o,e=>{W(ft)?.model&&e(s)});var c=H(o,2),l=e=>{Om(e,{compact:!0,label:`Plan for this session`,onclick:()=>Tr(W(ft).id),children:(e,t)=>{F(),q(e,Jr(`Plan`))},$$slots:{default:!0}})},u=L(()=>W(ft)&&tT(W(ft)));Y(c,e=>{W(u)&&e(l)}),P(t),U(()=>{Z(r,`title`,W(vt)||a),J(i,W(vt)||a)}),q(e,t)};Y(C,e=>{a&&e(E)});var D=H(C,2),O=e=>{sC(e,{get queue(){return Qt}})};Y(D,e=>{W(Je)||e(O)});var ie=H(D,2),se=e=>{bO(e,{get client(){return Kt},onclose:()=>{z(c,!1),Or().then(()=>document.querySelector(`.menu-trigger`)?.focus())},get onlock(){return t.onlock},oncreatepasskey:e=>i()(e)})},ce=e=>{qS(e,{get queue(){return Qt},onclose:vn})},le=e=>{var t=Nj(),i=V(t),c=e=>{var t=kj();let n;var i=B(t),s=e=>{var t=wj(),n=B(t);r(n,()=>!0),P(t),q(e,t)};Y(i,e=>{W(ht)&&e(s)});var c=H(i,2);{let e=e=>{{let t=L(()=>W(j)?W(Oe).snapshots.get(W(j))??null:null),n=L(()=>W(j)?W(Oe).attention.get(W(j))??null:null),r=L(()=>`chat-autopilot-safety-${W(j)??`none`}`),i=L(()=>W(j)?W(Oe).pending.has(W(j)):!1);bg(e,{get autopilot(){return W(t)},get attention(){return W(n)},get controlId(){return W(r)},get pending(){return W(i)},onrecover:()=>W(j)&&void Hn(W(j)),ondisable:()=>W(j)&&Bn(W(j),!1)})}};var l=H(B(c),2),u=B(l,!0);P(l);var f=H(l,2),m=t=>{var n=Ej(),r=V(n),i=B(r);{let e=L(()=>W(o)?.newEmpty??!1),t=L(()=>W(o)?.status??W(x)),n=L(()=>W(o)?.readySince??null),r=L(()=>W(o)?.activeTurnId??null),a=L(()=>W(o)?.starting??!1),s=L(()=>!!(W(Ce).find(e=>e.id===W(j))&&![`ready`,`turnActive`].includes(W(Ce).find(e=>e.id===W(j))?.state??``))),c=L(()=>W(N)!==null),l=L(()=>W(k)[W(Ce).find(e=>e.id===W(j))?.provider??`codex`]),u=L(()=>W(Ce).find(e=>e.id===W(j))?.provider??`codex`);Jg(i,{get newEmpty(){return W(e)},get status(){return W(t)},get readySince(){return W(n)},get message(){return W(He)},get activeTurnId(){return W(r)},get starting(){return W(a)},get detached(){return W(s)},get retryMessage(){return W(Ve)},get retryable(){return W(c)},get models(){return W(l)},get provider(){return W(u)},onchange:ti,onrevealprompt:Ir,onmodelselect:e=>void Qn(e),onsend:()=>void er(),onqueue:()=>void tr(),oninterruptsend:()=>void nr(),onretry:()=>void ar(),oninterrupt:()=>void or(),onuploadfiles:sr})}var s=H(i,2),c=e=>{var t=Tj(),n=B(t),r=e=>{Om(e,{compact:!0,label:`Plan for this session`,onclick:()=>Tr(W(j)),children:(e,t)=>{F(),q(e,Jr(`Plan`))},$$slots:{default:!0}})};Y(n,e=>{a||e(r)});var i=H(n,2),o=e=>{{let t=L(()=>W(Oe).snapshots.get(W(j))??null),n=L(()=>`chat-autopilot-${W(j)}`),r=L(()=>W(Oe).pending.has(W(j)));hg(e,{compact:!0,get autopilot(){return W(t)},get controlId(){return W(n)},get pending(){return W(r)},ontoggle:e=>W(j)&&Bn(W(j),e)})}};Y(i,e=>{W(ft)?.provider!==`kimi`&&e(o)});var s=H(i,2);{let e=L(()=>W(Ee).get(W(j))??null),t=L(()=>W(Ce).find(e=>e.id===W(j))?.model??T),n=L(()=>W(Ce).find(e=>e.id===W(j))?.plan);jh(s,{compact:!0,popupPlacement:`below`,get activity(){return W(e)},get rootModel(){return W(t)},get plan(){return W(n)},onopen:()=>W(j)&&void Ht.resync(W(j))})}P(t),q(e,t)},l=L(()=>tT(W(ft)));Y(s,e=>{W(l)&&e(c)});var u=H(s,2),f=e=>{var t=Yr();ri(V(t),()=>W(j),e=>{{let t=L(()=>W(De).get(W(j))??null),n=L(()=>W(Ee).get(W(j))??null);Vh(e,{get sessionId(){return W(j)},get snapshot(){return W(t)},get activity(){return W(n)}})}}),q(e,t)};Y(u,e=>{W(ft)?.provider!==`kimi`&&e(f)}),P(r);var m=H(r,2);{let t=L(()=>W(Oe).attention.get(W(j))??null),n=L(()=>W(Oe).pending.has(W(j))),r=L(()=>W(o)?[...W(o).messages]:[]),i=L(()=>W(o)?[...W(o).activities]:[]),a=L(()=>W(o)?.activeTurnId??null),s=L(()=>W(o)?.autopilotAuditTruncated??!1),c=L(()=>W(o)?[...W(o).interactions]:[]);wx(m,{get attention(){return W(t)},get attentionPending(){return W(n)},onattentionresolve:(e,t)=>Un(W(j),e,t),onattentiondebug:(e,t)=>void Nn(e,W(j),t),get debugPending(){return W(p)},get footer(){return e},get messages(){return W(r)},get activities(){return W(i)},get activeTurnId(){return W(a)},get autopilotAuditTruncated(){return W(s)},get interactions(){return W(c)},get answers(){return Ft},get submittedAnswers(){return W(It)},onanswer:ei,onquiz:e=>void Zr(e),onpermission:e=>void Qr(e),ondecision:(e,t)=>void Xr(e,t),onretry:$r,onopenorg:yr,onopenfile:(e,t)=>{W(ft)?.workspaceId&&z(d,{workspaceId:W(ft).workspaceId,sessionId:W(ft).id,path:e,line:t},!0)},oncopyresult:ai})}qi(H(m,2),e=>z(Lt,e),()=>W(Lt)),U(()=>r.inert=W(Te)!==void 0&&W(Te).phase!==`failed`),q(t,n)},h=e=>{var t=Dj(),n=B(t,!0);P(t),U(()=>J(n,a?W(x):W(de)?`Start a session from the Sessions tab to chat with Codex or Kimi.`:`Start a session from the Sessions tab to chat with Codex.`)),q(e,t)};Y(f,e=>{W(j)?e(m):e(h,-1)}),P(c),U(()=>J(u,W(Rt)))}var g=H(c,2),_=e=>{var t=Oj();$w(B(t),{get state(){return W(Ge)},compact:!0,onopenfull:wr}),P(t),q(e,t)};Y(g,e=>{W(ht)&&e(_)}),P(t),U(()=>n=Ei(t,1,`chat-layout svelte-1d2e8zz`,null,n,{"with-sidebars":W(ht)})),q(e,t)},l=e=>{n(e,()=>!1)},u=e=>{{let t=L(()=>W(Dt)?hC(W(w),W(Dt))??null:null);KC(e,{get workspaceTree(){return W(w)},get selectedWorkspace(){return W(t)},get expandedIds(){return W(Ot)},get summary(){return W(Et).summary},get refreshing(){return W(Et).refreshing},get checkingOut(){return W(Et).checkingOut},get cloning(){return W(At)},get pushing(){return W(jt)},get error(){return W(Et).error},get cloneStatus(){return W(Mt)},get confirmingPush(){return W(kt)},onpull:()=>void Gr(),oncheckout:e=>void qr(e),onopenpushconfirmation:()=>z(kt,!0),onpush:()=>void K(),oncancelpush:()=>z(kt,!1),onselect:Rr,onexpandedchange:e=>z(Ot,e,!0),onbrowsefiles:Hr,onclone:e=>void Kr(e)})}},h=e=>{var t=Yr(),n=V(t),i=e=>{var t=jj(),n=B(t),r=B(n);_i(r,()=>Nr);var i=H(r,2);P(n);var a=H(n,2),o=e=>{AD(e,{get skillsState(){return W(pe)},onrefresh:e=>e.refresh(),onprofileschange:()=>void Ar(),heading:`Skill profile editor`})},s=e=>{q(e,Aj())};Y(a,e=>{W(pe)?e(o):e(s,-1)}),P(t),G(`click`,i,()=>void Pr()),q(e,t)},a=e=>{r(e)};Y(n,e=>{W(me)===`profile-manager`?e(i):e(a,-1)}),q(e,t)};Y(i,e=>{W(s)===`chat`?e(c):W(s)===`plan`?e(l,1):W(s)===`git`?e(u,2):e(h,-1)});var g=H(i,2),v=e=>{Bm(e,{get confirmation(){return W(f)},onconfirm:In,onclose:Fn})};Y(g,e=>{W(f)&&e(v)});var y=H(g,2),b=e=>{let t=L(()=>W(m));{let n=L(()=>({workspaceId:W(t).workspaceId??W(t).id,path:W(t).selfDebug.tracePath}));YA(e,{get target(){return W(n)},readFile:async(e,n,r)=>{let i=JSON.stringify(await zt.readDebugTrace(W(t).id,r),null,2);return{kind:`file`,path:n,content:i,size:new TextEncoder().encode(i).byteLength}},get listDirectory(){return zt.listWorkspaceDirectory},onclose:Rn,onerror:e=>ii(e,`DEBUG_TRACE_FAILED`)})}};Y(y,e=>{W(m)?.selfDebug&&e(b)});var S=H(y,2),C=e=>{bj(e,{get root(){return W(_)},onview:e=>{W(_)&&z(d,{workspaceId:W(_).id,path:e},!0)},get listDirectory(){return zt.listWorkspaceDirectory},get copyEntry(){return zt.copyWorkspaceEntry},get moveEntry(){return zt.moveWorkspaceEntry},get deleteEntry(){return zt.deleteWorkspaceEntry},get uploadFile(){return zt.uploadWorkspaceFile},get createDirectory(){return zt.createWorkspaceDirectory},onclose:()=>void Ur(),onerror:e=>ii(e,`WORKSPACE_FILES_READ_FAILED`),onsuccess:e=>Qt.enqueue({kind:`success`,message:e}),onmutation:Wr})};Y(S,e=>{W(_)&&e(C)});var E=H(S,2),D=e=>{cE(e,{onclose:Cr,children:(e,t)=>{var r=Mj(),i=V(r);sC(i,{get queue(){return Qt}});var a=H(i,2),o=e=>{Om(e,{onclick:Cr,children:(e,t)=>{F(),q(e,Jr(`Close plan`))},$$slots:{default:!0}})};Y(a,e=>{(W(St).kind===`loading`||W(St).kind===`unavailable`||W(St).kind===`error`&&!W(St).plan)&&e(o)});var s=H(a,2);n(s,()=>!0),q(e,r)},$$slots:{default:!0}})};Y(E,e=>{W(qe)&&e(D)});var O=H(E,2),ee=e=>{YA(e,{get target(){return W(d)},readFile:(e,t,n)=>W(d)?.sessionId?zt.getSessionFilePreview(W(d).sessionId,t,n):zt.getWorkspaceFilePreview(e,t,n),get listDirectory(){return zt.listWorkspaceDirectory},onclose:()=>{z(d,null)},onerror:e=>ii(e,`WORKSPACE_FILES_READ_FAILED`)})};Y(O,e=>{W(d)&&e(ee)});var te=H(O,2),ne=e=>{fD(e,{get activeTab(){return W(s)},get chatEnabled(){return W(Ne)},get focusTab(){return W(lt)},onselect:lr})};Y(te,e=>{a||e(ne)}),q(e,t)};Y(ie,e=>{W(c)&&t.passkeyAuthEnabled?e(se):W(l)?e(ce,1):e(le,-1)}),P(g);var ue=H(g,2),A=e=>{MO(e,{onclose:_n})};Y(ue,e=>{W(u)&&e(A)}),U(()=>v=Ei(g,1,`swipe-surface svelte-1d2e8zz`,null,v,{"wide-chat":W(ht)&&!W(c)&&!W(l)})),G(`pointerdown`,g,mr),G(`pointerup`,g,hr),Br(`pointercancel`,g,gr),q(e,h)};Y(ci,e=>{pn===`true`?e(li):un===`error`||un===`stacked`?e(ui,1):ln===`sessions`||ln===`git`?e(di,2):e(fi,-1)}),q(e,X),$e()}Vr([`pointerdown`,`pointerup`,`click`]);function Ij(){throw Error(`AUTH_RESPONSE_INVALID`)}async function Lj(e){if(!e.ok){let t;try{let n=await e.json();typeof n==`object`&&n&&`code`in n&&typeof n.code==`string`&&(t=n.code)}catch{}throw Error(t??`AUTH_REQUEST_FAILED_${e.status}`)}return e.json()}function Rj(e){return!!e&&typeof e==`object`&&[`bootstrap`,`locked`,`authenticated`].includes(e.status)&&typeof e.publicOrigin==`string`&&(e.passkeyAuthEnabled===void 0||typeof e.passkeyAuthEnabled==`boolean`)}function zj(e){return!!e&&typeof e==`object`&&!!e.options&&typeof e.options.challenge==`string`}function Bj(e){return!!e&&typeof e==`object`&&e.status===`authenticated`}function Vj(e=fetch){async function t(){let t=await Lj(await e(`/api/auth/status`,{credentials:`same-origin`}));return Rj(t)||Ij(),t}async function n(t,n={}){let r=await Lj(await e(t,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}));return zj(r)||Ij(),r}async function r(t,n){let r=await Lj(await e(t,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}));return Bj(r)||Ij(),r}return{status:t,registrationOptions:e=>n(`/api/auth/register/options`,e?{enrollmentTicket:e}:{}),verifyRegistration:(e,t)=>r(`/api/auth/register/verify`,{response:e,nickname:t}),loginOptions:()=>n(`/api/auth/login/options`),verifyLogin:e=>r(`/api/auth/login/verify`,{response:e}),logout:async()=>{let t=await e(`/api/auth/logout`,{method:`POST`,credentials:`same-origin`});if(!t.ok)throw Error(`AUTH_REQUEST_FAILED_${t.status}`)}}}function Hj(e,t=fetch){return async(n,r)=>{let i=await t(n,{...r,credentials:`same-origin`});return i.status===401&&(await i.clone().json().catch(()=>null))?.code===`AUTH_REQUIRED`&&e(),i}}function Uj(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Wj(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function Gj(){return Kj.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var Kj={stubThis:e=>e};function qj(e){let{id:t}=e;return{...e,id:Wj(t),transports:e.transports}}function Jj(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var Yj=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function Xj({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Yj({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new Yj({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new Yj({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new Yj({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new Yj({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new Yj({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new Yj({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new Yj({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Jj(t))return new Yj({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new Yj({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new Yj({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new Yj({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var Zj=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},Qj=[`cross-platform`,`platform`];function $j(e){if(e&&!(Qj.indexOf(e)<0))return e}async function eM(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!Gj())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:Wj(t.challenge),user:{...t.user,id:Wj(t.user.id)},excludeCredentials:t.excludeCredentials?.map(qj)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=Zj.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw Xj({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){tM(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=Uj(e))}catch(e){tM(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=Uj(c.getAuthenticatorData())}catch(e){tM(`getAuthenticatorData()`,e)}return{id:o,rawId:Uj(s),response:{attestationObject:Uj(c.attestationObject),clientDataJSON:Uj(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:$j(a.authenticatorAttachment)}}function tM(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function nM(){if(!Gj())return rM.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?rM.stubThis(new Promise(e=>e(!1))):rM.stubThis(e.isConditionalMediationAvailable())}var rM={stubThis:e=>e};function iM({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Yj({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new Yj({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Jj(t))return new Yj({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new Yj({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new Yj({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function aM(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!Gj())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(qj));let a={...t,challenge:Wj(t.challenge),allowCredentials:i},o={};if(n){if(!await nM())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=Zj.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw iM({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=Uj(u.userHandle)),{id:c,rawId:Uj(l),response:{authenticatorData:Uj(u.authenticatorData),clientDataJSON:Uj(u.clientDataJSON),signature:Uj(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:$j(s.authenticatorAttachment)}}function oM(e){return typeof e==`object`&&e?e:{}}function sM(e){let t=oM(e),n=typeof t.code==`string`?t.code:``;switch(n){case`ERROR_CEREMONY_ABORTED`:return`The passkey request was cancelled. You can safely try again.`;case`ERROR_INVALID_DOMAIN`:case`ERROR_INVALID_RP_ID`:return`The passkey provider rejected this site’s domain identity. Open the canonical HTTPS address and try again.`;case`ERROR_INVALID_USER_ID_LENGTH`:case`ERROR_MALFORMED_PUBKEYCREDPARAMS`:return`The relay supplied passkey options this browser could not use (${n}).`;case`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`:return`This passkey provider does not support the discoverable credential required for sign-in. Try another passkey provider or browser.`;case`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`:case`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`:return`This passkey provider could not perform the required screen-lock verification. Check the device screen lock or try another provider.`;case`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`:return`This passkey is already registered on this device. Try signing in instead.`;case`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`:return`This passkey provider supports none of the relay’s allowed cryptographic algorithms. Try another provider or browser.`;case`ERROR_AUTHENTICATOR_GENERAL_ERROR`:return`The phone’s passkey provider accepted device verification but could not create the credential (ERROR_AUTHENTICATOR_GENERAL_ERROR). Try another browser or passkey provider on this phone.`;case`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`:return sM(t.cause)}switch(typeof t.message==`string`?t.message:``){case`INVALID_REGISTRATION_REQUEST`:return`The relay did not understand the passkey response from this browser. Refresh the page and try again.`;case`REGISTRATION_COOKIE_MISSING`:return`The registration session cookie was not returned by this browser. Allow site cookies, refresh, and try again.`;case`REGISTRATION_NOT_AVAILABLE`:return`This registration attempt expired or is no longer available. Refresh the page and start again.`;case`REGISTRATION_VERIFICATION_FAILED`:return`Your device created the passkey, but the relay could not verify it. Try again and check the relay diagnostics if it persists.`;case`ORIGIN_NOT_ALLOWED`:return`This page is not using the relay’s configured public address. Open the canonical HTTPS address and try again.`;case`ENROLLMENT_NOT_AUTHORIZED`:return`This relay is no longer accepting first-device registration.`;case`AUTHENTICATION_FAILED`:return`We could not complete sign-in. Please try again.`}let r=typeof t.name==`string`?t.name:``;switch(r){case`NotAllowedError`:return`The passkey request was cancelled or timed out. Try again when ready.`;case`InvalidStateError`:return`This passkey is already registered on this device. Try signing in instead.`;case`AbortError`:return`The passkey request was cancelled. You can safely try again.`;case`SecurityError`:return`Passkeys require this device to use the configured secure site.`;case`ConstraintError`:case`DataError`:case`EncodingError`:return`This browser could not use the passkey options supplied by the relay. Refresh the page and try again.`;case`NetworkError`:return`The connection was interrupted while completing the passkey request. Check the connection and try again.`;case`OperationError`:case`UnknownError`:return`This browser or passkey provider could not finish the passkey request after device verification. Try again or use another browser on this device.`;case`TypeError`:return`This browser rejected the passkey request data. Refresh the page and try again.`;default:return/^[A-Za-z]+Error$/.test(r)?`The passkey request failed inside this browser (${r}). Try another browser or passkey provider on this device.`:`We could not complete authentication. Please try again.`}}function cM(){return typeof window<`u`&&window.isSecureContext&&window.PublicKeyCredential!==void 0}function lM(e,t){async function n(n){t({kind:`checking`});try{let{status:r,publicOrigin:i,passkeyAuthEnabled:a=!0}=await e.status();if(!a){let e={kind:`authenticated`,passkeyAuthEnabled:!1};return t(e),e}if(!cM()){let e={kind:`unsupported`,message:`Passkeys require a secure browser on this device.`};return t(e),e}let o=r===`authenticated`?{kind:`authenticated`,passkeyAuthEnabled:!0}:r===`bootstrap`?{kind:`bootstrap`,publicOrigin:i}:n?{kind:`enrollment`,publicOrigin:i}:{kind:`locked`};return t(o),o}catch{let e={kind:`error`,message:`We could not check this device. Please try again.`};return t(e),e}}function r(){t({kind:`authenticated`,passkeyAuthEnabled:!0})}function i(e){t({kind:`locked`,...e?{message:e}:{}})}return{check:n,retry:n,authenticated:r,locked:i}}var uM=K(`<p class="warning svelte-1c5qcm6">This one-time link authorizes one new passkey. Choose a nickname and complete the passkey
|
|
181
|
-
prompt before it expires.</p>`),dM=K(`<p class="warning svelte-1c5qcm6"><strong class="svelte-1c5qcm6">Trust-on-first-use:</strong> anyone who can reach an empty relay instance could claim
|
|
182
|
-
first-device access. Enroll this device before exposing the instance, and confirm you are at the
|
|
183
|
-
canonical address before continuing.</p>`),fM=K(`<p class="error svelte-1c5qcm6">Passkeys require a secure browser on this device.</p>`),pM=K(`<p class="feedback svelte-1c5qcm6"> </p>`),mM=K(`<img alt="QR code for the first-device setup link" class="svelte-1c5qcm6"/>`),hM=K(`<div class="handoff svelte-1c5qcm6"><!> <div class="svelte-1c5qcm6"><h2 class="svelte-1c5qcm6">Continue on your phone</h2> <p class="svelte-1c5qcm6">Scanning opens this same setup page. You will still choose a nickname and explicitly
|
|
184
|
-
authorize that device.</p> <a class="svelte-1c5qcm6"> </a> <button type="button" class="copy svelte-1c5qcm6">Copy setup link</button></div></div>`),gM=K(`<main class="enrollment svelte-1c5qcm6" aria-live="polite"><section class="card svelte-1c5qcm6" aria-labelledby="enrollment-title"><p class="brand svelte-1c5qcm6">Gestalt / Dyne</p> <h1 id="enrollment-title" class="svelte-1c5qcm6"> </h1> <!> <label for="device-nickname" class="svelte-1c5qcm6">Device nickname</label> <input id="device-nickname" name="device-nickname" autocomplete="nickname" required="" enterkeyhint="done" class="svelte-1c5qcm6"/> <button class="authorize svelte-1c5qcm6" type="button"> </button> <!> <!> <!></section></main>`);function _M(e,t){I(t,!0);let n=R(``),r=R(null),i=R(!1),a=R(null),o=!0,s=!0,c=L(()=>cO(t.canonicalOrigin)),l=null;function u(){return window.isSecureContext&&window.PublicKeyCredential!==void 0}function d(){l&&clearInterval(l),l=null}function f(e){if(o=!1,d(),e===`authenticated`){t.onAuthenticated();return}t.onLocked(`Another device has already enrolled this relay. Sign in with that device’s passkey.`)}async function p(){if(document.visibilityState===`visible`)try{let e=await t.client.status();if(e.status!==`bootstrap`){if(!s)return;f(e.status)}}catch{}}Yi(()=>{t.enrollmentTicket||lO(t.canonicalOrigin).then(e=>{s&&z(a,e,!0)}).catch(()=>{s&&z(r,`Setup QR unavailable. Use the setup link below.`)});let e=window.matchMedia?.(`(min-width: 768px)`).matches??!1;!t.enrollmentTicket&&e&&(l=setInterval(()=>void p(),15e3))}),Xi(()=>{s=!1,o=!1,d()});async function m(){if(!navigator.clipboard?.writeText){z(r,`Copy is unavailable here. Select and copy the visible setup link.`);return}try{await navigator.clipboard.writeText(W(c)),z(r,`Setup link copied.`)}catch{z(r,`Copy is unavailable here. Select and copy the visible setup link.`)}}async function h(){let e=W(n).trim();if(!e){z(r,`Enter a device nickname before authorizing it.`);return}if(!u()){z(r,`Passkeys require a secure browser on this device.`);return}if(!(W(i)||!o)){z(i,!0),z(r,null);try{let{options:n}=await t.client.registrationOptions(t.enrollmentTicket);if(!s||!o)return;let r=await eM({optionsJSON:n});if(!s||!o||(await t.client.verifyRegistration(r,e),!s||!o))return;d(),t.onAuthenticated()}catch(e){if(e instanceof Error&&[`AUTH_REQUEST_FAILED_409`,`BOOTSTRAP_ALREADY_CLAIMED`].includes(e.message)){d(),t.onLocked(`Another device completed setup first. Sign in with that device’s passkey.`);return}z(r,sM(e),!0)}finally{z(i,!1)}}}var g=gM(),_=B(g),v=H(B(_),2),y=B(v,!0);P(v);var b=H(v,2),x=e=>{q(e,uM())},S=e=>{q(e,dM())};Y(b,e=>{t.enrollmentTicket?e(x):e(S,-1)});var C=H(b,4);Li(C);var w=H(C,2),T=B(w,!0);P(w);var E=H(w,2),D=e=>{q(e,fM())},O=L(()=>!u());Y(E,e=>{W(O)&&e(D)});var k=H(E,2),ee=e=>{var t=pM(),n=B(t,!0);P(t),U(()=>J(n,W(r))),q(e,t)};Y(k,e=>{W(r)&&e(ee)});var te=H(k,2),ne=e=>{var t=hM(),n=B(t),r=e=>{var t=mM();U(()=>Z(t,`src`,W(a))),q(e,t)};Y(n,e=>{W(a)&&e(r)});var i=H(n,2),o=H(B(i),4),s=B(o,!0);P(o);var l=H(o,2);P(i),P(t),U(()=>{Z(o,`href`,W(c)),J(s,W(c))}),G(`click`,l,()=>void m()),q(e,t)};Y(te,e=>{t.enrollmentTicket||e(ne)}),P(_),P(g),U(e=>{J(y,t.enrollmentTicket?`Authorize this device`:`Authorize the first device`),w.disabled=e,J(T,W(i)?`Authorizing device…`:`Authorize this device`)},[()=>W(i)||!u()]),Ui(C,()=>W(n),e=>z(n,e)),G(`click`,w,()=>void h()),q(e,g),$e()}Vr([`click`]);var vM=K(`<p class="error svelte-1byekj9">Passkeys require this relay to be opened over a secure connection.</p>`),yM=K(`<p class="error svelte-1byekj9">This browser does not support passkeys. Use an authorized browser or device.</p>`),bM=K(`<p class="svelte-1byekj9"> </p> <button class="sign-in svelte-1byekj9" type="button"> </button>`,1),xM=K(`<main class="login svelte-1byekj9" aria-live="polite"><section class="card svelte-1byekj9" aria-labelledby="login-title"><p class="brand svelte-1byekj9">Gestalt / Dyne</p> <h1 id="login-title" class="svelte-1byekj9">Unlock relay</h1> <!></section></main>`);function SM(e,t){I(t,!0);let n=R(``),r=R(!1),i=R(void 0);function a(){return window.isSecureContext&&window.PublicKeyCredential!==void 0}function o(e){return e instanceof Error&&[`NotAllowedError`,`AbortError`,`SecurityError`].includes(e.name)?sM(e):`We could not complete sign-in. Please try again.`}Yi(()=>{z(n,t.message??`Use a passkey from an authorized device to unlock this relay.`,!0),W(i)?.focus()});async function s(){if(!(W(r)||!a())){z(r,!0),z(n,``);try{let{options:e}=await t.client.loginOptions(),n=await aM({optionsJSON:e});await t.client.verifyLogin(n),t.onAuthenticated()}catch(e){z(n,o(e),!0)}finally{z(r,!1)}}}var c=xM(),l=B(c),u=H(B(l),4),d=e=>{q(e,vM())},f=e=>{q(e,yM())},p=e=>{var t=bM(),a=V(t),o=B(a,!0);P(a);var c=H(a,2),l=B(c,!0);P(c),qi(c,e=>z(i,e),()=>W(i)),U(()=>{J(o,W(n)),c.disabled=W(r),J(l,W(r)?`Waiting for passkey…`:`Sign in with a passkey`)}),G(`click`,c,()=>void s()),q(e,t)};Y(u,e=>{window.isSecureContext?window.PublicKeyCredential===void 0?e(f,1):e(p,-1):e(d)}),P(l),P(c),q(e,c),$e()}Vr([`click`]);var CM=K(`<p>Checking this device…</p>`),wM=K(`<h1 class="svelte-y74n0s">Passkey support is required</h1> <p> </p>`,1),TM=K(`<h1 class="svelte-y74n0s">Unable to check this device</h1> <p> </p> <button type="button" class="svelte-y74n0s">Try again</button>`,1),EM=K(`<main class="auth-gate svelte-y74n0s" aria-live="polite"><!></main>`);function DM(e,t){I(t,!0);let n=Q(t,`initialTheme`,3,`dyne-org`),r=R(void 0),i=L(()=>W(r)??t.enrollmentTicket),a=R(cn({kind:`checking`})),o=!1,s=Vj(),c=lM(s,e=>z(a,e,!0)),l=Hj(()=>c.locked(`Your session ended. Sign in with your passkey to continue.`));Yi(()=>{c.check(W(i))});function u(e){z(r,e,!0),z(a,{kind:`enrollment`,publicOrigin:W(a).kind===`authenticated`?``:`http://localhost`},!0)}async function d(){if(!(o||W(a).kind!==`authenticated`)){o=!0,c.locked(`Relay locked. Sign in with your passkey to continue.`);try{await s.logout()}catch{c.locked(`Relay locked locally. Recheck your connection before signing in again.`)}finally{o=!1}}}var f=Yr(),p=V(f),m=e=>{Fj(e,{get authorizedFetch(){return l},get theme(){return n()},get passkeyAuthEnabled(){return W(a).passkeyAuthEnabled},onlock:()=>void d(),oncreatepasskey:u})},h=e=>{_M(e,{get client(){return s},get canonicalOrigin(){return W(a).publicOrigin},get enrollmentTicket(){return W(i)},onAuthenticated:()=>c.authenticated(),onLocked:e=>c.locked(e)})},g=e=>{SM(e,{get client(){return s},get message(){return W(a).message},onAuthenticated:()=>c.authenticated()})},_=e=>{var t=EM(),n=B(t),r=e=>{q(e,CM())},i=e=>{var t=wM(),n=H(V(t),2),r=B(n,!0);P(n),U(()=>J(r,W(a).message)),q(e,t)},o=e=>{var t=TM(),n=H(V(t),2),r=B(n,!0);P(n);var i=H(n,2);U(()=>J(r,W(a).message)),G(`click`,i,()=>void c.retry()),q(e,t)};Y(n,e=>{W(a).kind===`checking`?e(r):W(a).kind===`unsupported`?e(i,1):W(a).kind===`error`&&e(o,2)}),P(t),q(e,t)};Y(p,e=>{W(a).kind===`authenticated`?e(m):W(a).kind===`bootstrap`||W(a).kind===`enrollment`?e(h,1):W(a).kind===`locked`?e(g,2):e(_,-1)}),q(e,f),$e()}Vr([`click`]);function OM(e,t){let n=e.hash;if(!n.startsWith(`#enroll=`))return;let r=/^#enroll=([^&]+)$/.exec(n);if(t.replaceState(t.state,``,`${e.pathname}${e.search}`),!(!r||!r[1]))try{return decodeURIComponent(r[1])||void 0}catch{return}}function kM(e,t,n,r=Zr,i={}){return r(DM,{target:e,props:{enrollmentTicket:OM(t,n),initialTheme:la(i)}})}function AM(){return{readyState:document.readyState,addLoadListener:e=>window.addEventListener(`load`,e,{once:!0}),serviceWorker:navigator.serviceWorker}}function jM(e=AM()){if(!e.serviceWorker)return;let t=()=>{e.serviceWorker?.register(`/service-worker.js`,{scope:`/`}).catch(()=>void 0)};if(e.readyState===`complete`){t();return}e.addLoadListener(t)}var MM=document.getElementById(`app`);if(!MM)throw Error(`Missing application mount target`);kM(MM,window.location,window.history),jM();
|