gestalt-mobile 0.78.0 → 0.78.1
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/dist/client/assets/index-C1RSPAku.js +184 -0
- package/dist/client/assets/index-DRiZTklh.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/server/composition.js +66 -63
- package/dist/server/server/features/sessions/list-recent-threads/endpoint.js +14 -6
- package/dist/server/server/features/sessions/register-routes.js +1 -16
- package/dist/server/server/platform/plans/filesystem-org-plan-context.js +14 -0
- package/package.json +1 -1
- package/dist/client/assets/index-D7oz0ApM.css +0 -1
- package/dist/client/assets/index-DDtx1aeG.js +0 -184
|
@@ -0,0 +1,184 @@
|
|
|
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){return e()}function S(e){for(var t=0;t<e.length;t++)e[t]()}function C(){var e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function w(e,t,n=!1){return e===void 0?n?t():t:e}function T(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 E=1<<24,D=1024,O=2048,k=4096,ee=8192,te=16384,ne=32768,re=1<<25,ie=65536,ae=1<<18,oe=1<<19,se=1<<20,ce=1<<25,le=65536,ue=1<<21,de=1<<22,A=1<<23,fe=Symbol(`$state`),pe=Symbol(`legacy props`),me=Symbol(``),he=Symbol(`attributes`),ge=Symbol(`class`),_e=Symbol(`style`),ve=Symbol(`text`),ye=Symbol(`form reset`),be=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"},xe=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function Se(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function j(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function M(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 N=!1;function Ve(e){N=e}var He;function Ue(e){if(e===null)throw Re(),Me;return He=e}function We(){return Ue(bn(He))}function P(e){if(N){if(bn(He)!==null)throw Re(),Me;He=e}}function F(e=1){if(N){for(var t=e,n=He;t--;)n=bn(n);He=n}}function Ge(e=!0){for(var t=0,n=He;;){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=bn(n);e&&n.remove(),n=i}}function Ke(e){if(!e||e.nodeType!==8)throw Re(),Me;return e.data}function qe(e){return e===this.v}function Je(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ye(e){return!Je(e,this.v)}var Xe=!1;function Ze(){Xe=!0}var Qe=null;function $e(e){Qe=e}function et(e,t=!1,n){Qe={p:Qe,i:!1,c:null,e:null,s:e,x:null,r:ur,l:Xe&&!t?{s:null,u:null,$:[]}:null}}function tt(e){var t=Qe,n=t.e;if(n!==null){t.e=null;for(var r of n)In(r)}return e!==void 0&&(t.x=e),t.i=!0,Qe=t.p,e??{}}function nt(){return!Xe||Qe!==null&&Qe.l===null}var rt=[];function it(){var e=rt;rt=[],S(e)}function at(e){if(rt.length===0&&!Rt){var t=rt;queueMicrotask(()=>{t===rt&&it()})}rt.push(e)}function ot(){for(;rt.length>0;)it()}function st(e){var t=ur;if(t===null)return sr.f|=A,e;if(!(t.f&32768)&&!(t.f&4))throw e;ct(e,t)}function ct(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 lt=~(O|k|D);function ut(e,t){e.f=e.f<|t}function dt(e){e.f&512||e.deps===null?ut(e,D):ut(e,k)}function ft(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=le,ft(t.deps))}function pt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),ft(e.deps),ut(e,D)}var mt=!1;function ht(e){var t=mt;try{return mt=!1,[e(),mt]}finally{mt=t}}function gt(e){let t=0,n=nn(0),r;return()=>{Nn()&&(W(n),Vn(()=>(t===0&&(r=Mr(()=>e(()=>sn(n)))),t+=1,()=>{at(()=>{--t,t===0&&(r?.(),r=void 0,sn(n))})})))}}var _t=ie|oe;function vt(e,t,n,r){new yt(e,t,n,r)}var yt=class{parent;is_pending=!1;transform_error;#e;#t=N?He: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=gt(()=>(this.#m=nn(this.#l),()=>{this.#m=null}));constructor(e,t,n,r){this.#e=e,this.#n=t,this.#r=e=>{var t=ur;t.b=this,t.f|=128,n(e)},this.parent=ur.b,this.transform_error=r??this.parent?.transform_error??(e=>e),this.#i=Un(()=>{if(N){let e=this.#t;We();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()},_t),N&&(this.#e=He)}#g(){try{this.#a=Gn(()=>this.#r(this.#e))}catch(e){this.error(e)}}#_(e){let t=this.#n.failed;t&&(this.#s=Gn(()=>{t(this.#e,()=>e,()=>()=>{})}))}#v(){let e=this.#n.pending;e&&(this.is_pending=!0,this.#o=Gn(()=>e(this.#e)),at(()=>{var e=this.#c=document.createDocumentFragment(),t=vn();e.append(t),this.#a=this.#x(()=>Gn(()=>this.#r(t))),this.#u===0&&(this.#e.before(e),this.#c=null,Qn(this.#o,()=>{this.#o=null}),this.#b(Pt))}))}#y(){try{if(this.is_pending=this.has_pending_snippet(),this.#u=0,this.#l=0,this.#a=Gn(()=>{this.#r(this.#e)}),this.#u>0){var e=this.#c=document.createDocumentFragment();nr(this.#a,e);let t=this.#n.pending;this.#o=Gn(()=>t(this.#e))}else this.#b(Pt)}catch(e){this.error(e)}}#b(e){this.is_pending=!1,e.transfer_effects(this.#f,this.#p)}defer_effect(e){pt(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=ur,n=sr,r=Qe;dr(this.#i),lr(this.#i),$e(this.#i.ctx);try{return L.ensure(),e()}catch(e){return st(e),null}finally{dr(t),lr(n),$e(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&&Qn(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,at(()=>{this.#d=!1,this.#m&&an(this.#m,this.#l)}))}get_effect_pending(){return this.#h(),W(this.#m)}error(e){if(!this.#n.onerror&&!this.#n.failed)throw e;Pt?.is_fork?(this.#a&&Pt.skip_effect(this.#a),this.#o&&Pt.skip_effect(this.#o),this.#s&&Pt.skip_effect(this.#s),Pt.oncommit(()=>{this.#C(e)})):this.#C(e)}#C(e){this.#a&&=(Yn(this.#a),null),this.#o&&=(Yn(this.#o),null),this.#s&&=(Yn(this.#s),null),N&&(Ue(this.#t),F(),Ue(Ge()));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&&Qn(this.#s,()=>{this.#s=null}),this.#x(()=>{this.#y()})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){ct(e,this.#i&&this.#i.parent)}n&&(this.#s=this.#x(()=>{try{return Gn(()=>{var t=ur;t.b=this,t.f|=128,n(this.#e,()=>e,()=>a)})}catch(e){return ct(e,this.#i.parent),null}}))};at(()=>{var t;try{t=this.transform_error(e)}catch(e){ct(e,this.#i&&this.#i.parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>ct(e,this.#i&&this.#i.parent)):o(t)})}};function bt(e,t,n,r){let i=nt()?wt:Dt;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=ur,c=xt(),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){ct(e,s)}St()}}var d=Ct();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>Et(e))).then(u).catch(e=>ct(e,s)).finally(d)}l?l.then(()=>{c(),f(),St()}):f()}function xt(){var e=ur,t=sr,n=Qe,r=Pt;return function(i=!0){dr(e),lr(t),$e(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function St(e=!0){dr(null),lr(null),$e(null),e&&Pt?.deactivate()}function Ct(){var e=ur,t=e.b,n=Pt,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 wt(e){var t=2|O;return ur!==null&&(ur.f|=oe),{ctx:Qe,deps:null,effects:null,equals:qe,f:t,fn:e,reactions:null,rv:0,v:Ne,wv:0,parent:ur,ac:null}}var Tt=Symbol(`obsolete`);function Et(e,t,n){let r=ur;r===null&&j();var i=void 0,a=nn(Ne),o=!sr,s=new Set;return Bn(()=>{var t=ur,n=C();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==be&&n.reject(e)}).finally(St)}catch(e){n.reject(e),St()}var c=Pt;if(o){if(t.f&32768)var l=Ct();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(Tt);else for(let e of s.values())e.reject(Tt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==Tt&&(c.activate(),t?(a.f|=A,an(a,t)):(a.f&8388608&&(a.f^=A),an(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),Pn(()=>{for(let e of s)e.reject(Tt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function I(e){let t=wt(e);return pr(t),t}function Dt(e){let t=wt(e);return t.equals=Ye,t}function Ot(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)Yn(t[n])}}function kt(e){var t,n=ur,r=e.parent;if(!ar&&r!==null&&e.v!==Ne&&r.f&24576)return Le(),e.v;dr(r);try{e.f&=~le,Ot(e),t=Tr(e)}finally{dr(n)}return t}function At(e){var t=kt(e);if(!e.equals(t)&&(e.wv=Sr(),(!Pt?.is_fork||e.deps===null)&&(Pt===null?e.v=t:(Pt.capture(e,t,!0),Ft?.capture(e,t,!0)),e.deps===null))){ut(e,D);return}ar||(It===null?dt(e):(Nn()||Pt?.is_fork)&&It.set(e,t))}function jt(e){if(e.effects!==null)for(let t of e.effects)(t.teardown||t.ac)&&(t.teardown?.(),t.ac?.abort(be),t.fn!==null&&(t.teardown=b),t.ac=null,Dr(t,0),qn(t))}function Mt(e){if(e.effects!==null)for(let t of e.effects)t.teardown&&t.fn!==null&&Or(t)}var Nt=null,Pt=null,Ft=null,It=null,Lt=null,Rt=!1,zt=!1,Bt=null,Vt=null,Ht=0,Ut=1,L=class e{id=Ut++;#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(){Nt===null?Nt=this:(Nt.#n=this,this.#t=Nt),Nt=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)ut(r,O),t(r);for(r of n.m)ut(r,k),t(r)}this.#p.add(e)}#g(){this.#e=!0,Ht++>1e3&&(this.#x(),Gt());for(let e of this.#u)this.#d.delete(e),ut(e,O),this.schedule(e);for(let e of this.#d)ut(e,k),this.schedule(e);let t=this.#c;this.#c=[],this.apply();var n=Bt=[],r=[],i=Vt=[];for(let e of t)try{this.#_(e,n,r)}catch(t){throw Qt(e),this.#h()||this.discard(),t}if(Pt=null,i.length>0){var a=e.ensure();for(let e of i)a.schedule(e)}if(Bt=null,Vt=null,this.#h()){this.#b(r),this.#b(n);for(let[e,t]of this.#f)Zt(e,t);i.length>0&&Pt.#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(),Ft=this,qt(r),qt(n),Ft=null,this.#s?.resolve();var s=Pt;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^=D;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^=D:i&4?t.push(r):Cr(r)&&(i&16&&this.#d.add(r),Or(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),ut(i,O),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),e.#x(),Pt=this,this.#g()}#b(e){for(var t=0;t<e.length;t+=1)pt(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]),It?.set(e,t)),this.is_fork||(e.v=t)}activate(){Pt=this}deactivate(){Pt=null,It=null}flush(){try{zt=!0,Pt=this,this.#g()}finally{Ht=0,Lt=null,Bt=null,Vt=null,zt=!1,Pt=null,It=null,en.clear()}}discard(){for(let e of this.#i)e(this);this.#i.clear();for(let e of this.async_deriveds.values())e.reject(Tt);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,at(()=>{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??=C()).promise}static ensure(){if(Pt===null){let t=Pt=new e;!zt&&!Rt&&at(()=>{t.#e||t.flush()})}return Pt}apply(){It=null}schedule(e){if(Lt=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(Bt!==null&&t===ur&&(sr===null||!(sr.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=D}}this.#c.push(t)}#x(){if(this.linked){var e=this.#t,t=this.#n;e===null||(e.#n=t),t===null?Nt=e:t.#t=e,this.linked=!1}}};function Wt(e){var t=Rt;Rt=!0;try{var n;for(e&&(Pt!==null&&!Pt.is_fork&&Pt.flush(),n=e());;){if(ot(),Pt===null)return n;Pt.flush()}}finally{Rt=t}}function Gt(){try{Ee()}catch(e){ct(e,Lt)}}var Kt=null;function qt(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if(!(r.f&24576)&&Cr(r)&&(Kt=new Set,Or(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&Zn(r),Kt?.size>0)){en.clear();for(let e of Kt){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Kt.has(n)&&(Kt.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||Or(n)}}Kt.clear()}}Kt=null}}function Jt(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?Jt(i,t,n,r):e&4194320&&!(e&2048)&&Yt(i,t,r)&&(ut(i,O),Xt(i))}}function Yt(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&&Yt(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function Xt(e){Pt.schedule(e)}function Zt(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),ut(e,D);for(var n=e.first;n!==null;)Zt(n,t),n=n.next}}function Qt(e){ut(e,D);for(var t=e.first;t!==null;)Qt(t),t=t.next}var $t=new Set,en=new Map,tn=!1;function nn(e,t){return{f:0,v:e,reactions:null,equals:qe,rv:0,wv:0}}function R(e,t){let n=nn(e,t);return pr(n),n}function rn(e,t=!1,n=!0){let r=nn(e);return t||(r.equals=Ye),Xe&&n&&Qe!==null&&Qe.l!==null&&(Qe.l.s??=[]).push(r),r}function z(e,t,n=!1){return sr!==null&&(!cr||sr.f&131072)&&nt()&&sr.f&4325394&&(fr===null||!fr.has(e))&&Ae(),an(e,n?ln(t):t,Vt)}function an(e,t,n=null){if(!e.equals(t)){en.set(e,ar?t:e.v);var r=L.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&kt(t),It===null&&dt(t)}e.wv=Sr(),cn(e,O,n),nt()&&ur!==null&&ur.f&1024&&!(ur.f&96)&&(gr===null?_r([e]):gr.push(e)),!r.is_fork&&$t.size>0&&!tn&&on()}return t}function on(){tn=!1;for(let e of $t){e.f&1024&&ut(e,k);let t;try{t=Cr(e)}catch{t=!0}t&&Or(e)}$t.clear()}function sn(e){z(e,e.v+1)}function cn(e,t,n){var r=e.reactions;if(r!==null)for(var i=nt(),a=r.length,o=0;o<a;o++){var s=r[o],c=s.f;if(!(!i&&s===ur)){var l=(c&O)===0;if(l&&ut(s,t),c&131072)$t.add(s);else if(c&2){var u=s;It?.delete(u),c&65536||(c&512&&(ur===null||!(ur.f&2097152))&&(s.f|=le),cn(u,k,n))}else if(l){var d=s;c&16&&Kt!==null&&Kt.add(d),n===null?Xt(d):n.push(d)}}}}function ln(e){if(typeof e!=`object`||!e||fe 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=br,s=e=>{if(br===o)return e();var t=sr,n=br;lr(null),xr(o);var r=e();return lr(t),xr(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),sn(i)}}else z(r,Ne),sn(i);return!0},get(t,r,i){if(r===fe)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||m(t,r)?.writable)&&(o=s(()=>R(ln(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===fe)return!0;var r=n.get(t),i=r!==void 0&&r.v!==Ne||Reflect.has(e,t);return(r!==void 0||ur!==null&&(!i||m(e,t)?.writable))&&(r===void 0&&(r=s(()=>R(i?ln(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,ln(o)),n.set(t,l));else{u=l.v!==Ne;var p=s(()=>ln(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)}sn(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 un(e){try{if(typeof e==`object`&&e&&fe in e)return e[fe]}catch{}return e}function dn(e,t){return Object.is(un(e),un(t))}var fn,pn,mn,hn,gn;function _n(){if(fn===void 0){fn=window,pn=document,mn=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;hn=m(t,`firstChild`).get,gn=m(t,`nextSibling`).get,y(e)&&(e[ge]=void 0,e[he]=null,e[_e]=void 0,e.__e=void 0),y(n)&&(n[ve]=void 0)}}function vn(e=``){return document.createTextNode(e)}function yn(e){return hn.call(e)}function bn(e){return gn.call(e)}function B(e,t){if(!N)return yn(e);var n=yn(He);if(n===null)n=He.appendChild(vn());else if(t&&n.nodeType!==3){var r=vn();return n?.before(r),Ue(r),r}return t&&wn(n),Ue(n),n}function V(e,t=!1){if(!N){var n=yn(e);return n instanceof Comment&&n.data===``?bn(n):n}if(t){if(He?.nodeType!==3){var r=vn();return He?.before(r),Ue(r),r}wn(He)}return He}function H(e,t=1,n=!1){let r=N?He:e;for(var i;t--;)i=r,r=bn(r);if(!N)return r;if(n){if(r?.nodeType!==3){var a=vn();return r===null?i?.after(a):r.before(a),Ue(a),a}wn(r)}return Ue(r),r}function xn(e){e.textContent=``}function Sn(){return!1}function Cn(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 wn(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 Tn(e){N&&yn(e)!==null&&xn(e)}var En=!1;function Dn(){En||(En=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t[ye]?.()})},{capture:!0}))}function On(e){var t=sr,n=ur;lr(null),dr(null);try{return e()}finally{lr(t),dr(n)}}function kn(e,t,n,r=n){e.addEventListener(t,()=>On(n));let i=e[ye];i?e[ye]=()=>{i(),r(!0)}:e[ye]=()=>r(!0),Dn()}function An(e){ur===null&&(sr===null&&Te(e),we()),ar&&Ce(e)}function jn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Mn(e,t){var n=ur;n!==null&&n.f&8192&&(e|=ee);var r={ctx:Qe,deps:null,nodes:null,f:e|O|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};Pt?.register_created_effect(r);var i=r;if(e&4)Bt===null?L.ensure().schedule(r):Bt.push(r);else if(t!==null){try{Or(r)}catch(e){throw Yn(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|=ie))}if(i!==null&&(i.parent=n,n!==null&&jn(i,n),sr!==null&&sr.f&2&&!(e&64))){var a=sr;(a.effects??=[]).push(i)}return r}function Nn(){return sr!==null&&!cr}function Pn(e){let t=Mn(8,null);return ut(t,D),t.teardown=e,t}function Fn(e){An(`$effect`);var t=ur.f;if(!sr&&t&32&&Qe!==null&&!Qe.i){var n=Qe;(n.e??=[]).push(e)}else return In(e)}function In(e){return Mn(4|se,e)}function Ln(e){return An(`$effect.pre`),Mn(8|se,e)}function Rn(e){L.ensure();let t=Mn(64|oe,e);return(e={})=>new Promise(n=>{e.outro?Qn(t,()=>{Yn(t),n(void 0)}):(Yn(t),n(void 0))})}function zn(e){return Mn(4,e)}function Bn(e){return Mn(de|oe,e)}function Vn(e,t=0){return Mn(8|t,e)}function U(e,t=[],n=[],r=[]){bt(r,t,n,t=>{Mn(8,()=>{e(...t.map(W))})})}function Hn(e,t=[],n=[],r=[]){bt(r,t,n,t=>{Mn(4,()=>e(...t.map(W)))})}function Un(e,t=0){return Mn(16|t,e)}function Wn(e,t=0){return Mn(E|t,e)}function Gn(e){return Mn(32|oe,e)}function Kn(e){var t=e.teardown;if(t!==null){let e=ar,n=sr;or(!0),lr(null);try{t.call(null)}finally{or(e),lr(n)}}}function qn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&On(()=>{e.abort(be)});var r=n.next;n.f&64?n.parent=null:Yn(n,t),n=r}}function Jn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Yn(t),t=n}}function Yn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Xn(e.nodes.start,e.nodes.end),n=!0),e.f|=re,qn(e,t&&!n),Dr(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Kn(e),e.f^=re,e.f|=te;var i=e.parent;i!==null&&i.first!==null&&Zn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Xn(e,t){for(;e!==null;){var n=e===t?null:bn(e);e.remove(),e=n}}function Zn(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 Qn(e,t,n=!0){var r=[];$n(e,r,!0);var i=()=>{n&&Yn(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function $n(e,t,n){if(!(e.f&8192)){e.f^=ee;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;$n(i,t,o?n:!1)}i=a}}}function er(e){tr(e,!0)}function tr(e,t){if(e.f&8192){e.f^=ee,e.f&1024||(ut(e,O),L.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;tr(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 nr(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:bn(n);t.append(n),n=i}}var rr=null,ir=!1,ar=!1;function or(e){ar=e}var sr=null,cr=!1;function lr(e){sr=e}var ur=null;function dr(e){ur=e}var fr=null;function pr(e){sr!==null&&(fr??=new Set).add(e)}var mr=null,hr=0,gr=null;function _r(e){gr=e}var vr=1,yr=0,br=yr;function xr(e){br=e}function Sr(){return++vr}function Cr(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~le),t&4096){for(var n=e.deps,r=n.length,i=0;i<r;i++){var a=n[i];if(Cr(a)&&At(a),a.wv>e.wv)return!0}t&512&&It===null&&ut(e,D)}return!1}function wr(e,t,n=!0){var r=e.reactions;if(r!==null&&!(fr!==null&&fr.has(e)))for(var i=0;i<r.length;i++){var a=r[i];a.f&2?wr(a,t,!1):t===a&&(n?ut(a,O):a.f&1024&&ut(a,k),Xt(a))}}function Tr(e){var t=mr,n=hr,r=gr,i=sr,a=fr,o=Qe,s=cr,c=br,l=e.f;mr=null,hr=0,gr=null,sr=l&96?null:e,fr=null,$e(e.ctx),cr=!1,br=++yr,e.ac!==null&&(On(()=>{e.ac.abort(be)}),e.ac=null);try{e.f|=ue;var u=e.fn,d=u();e.f|=ne;var f=e.deps,p=Pt?.is_fork;if(mr!==null){var m;if(p||Dr(e,hr),f!==null&&hr>0)for(f.length=hr+mr.length,m=0;m<mr.length;m++)f[hr+m]=mr[m];else e.deps=f=mr;if(Nn()&&e.f&512)for(m=hr;m<f.length;m++)(f[m].reactions??=[]).push(e)}else!p&&f!==null&&hr<f.length&&(Dr(e,hr),f.length=hr);if(nt()&&gr!==null&&!cr&&f!==null&&!(e.f&6146))for(m=0;m<gr.length;m++)wr(gr[m],e);if(i!==null&&i!==e){if(yr++,i.deps!==null)for(let e=0;e<n;e+=1)i.deps[e].rv=yr;if(t!==null)for(let e of t)e.rv=yr;gr!==null&&(r===null?r=gr:r.push(...gr))}return e.f&8388608&&(e.f^=A),d}catch(e){return st(e)}finally{e.f^=ue,mr=t,hr=n,gr=r,sr=i,fr=a,$e(o),cr=s,br=c}}function Er(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&&(mr===null||!d.call(mr,t))){var a=t;a.f&512&&(a.f^=512,a.f&=~le),a.v!==Ne&&dt(a),jt(a),Dr(a,0)}}function Dr(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)Er(e,n[r])}function Or(e){var t=e.f;if(!(t&16384)){ut(e,D);var n=ur,r=ir;ur=e,ir=!0;try{t&16777232?Jn(e):qn(e),Kn(e);var i=Tr(e);e.teardown=typeof i==`function`?i:null,e.wv=vr}finally{ir=r,ur=n}}}async function kr(){await Promise.resolve(),Wt()}function W(e){var t=(e.f&2)!=0;if(rr?.add(e),sr!==null&&!cr&&!(ur!==null&&ur.f&16384)&&(fr===null||!fr.has(e))){var n=sr.deps;if(sr.f&2097152)e.rv<yr&&(e.rv=yr,mr===null&&n!==null&&n[hr]===e?hr++:mr===null?mr=[e]:mr.push(e));else{sr.deps??=[],d.call(sr.deps,e)||sr.deps.push(e);var r=e.reactions;r===null?e.reactions=[sr]:d.call(r,sr)||r.push(sr)}}if(ar&&en.has(e))return en.get(e);if(t){var i=e;if(ar){var a=i.v;return(!(i.f&1024)&&i.reactions!==null||jr(i))&&(a=kt(i)),en.set(i,a),a}var o=(i.f&512)==0&&!cr&&sr!==null&&(ir||(sr.f&512)!=0),s=(i.f&ne)===0;Cr(i)&&(o&&(i.f|=512),At(i)),o&&!s&&(Mt(i),Ar(i))}if(It?.has(e))return It.get(e);if(e.f&8388608)throw e.v;return e.v}function Ar(e){if(e.f|=512,e.deps!==null)for(let t of e.deps)(t.reactions??=[]).push(e),t.f&2&&!(t.f&512)&&(Mt(t),Ar(t))}function jr(e){if(e.v===Ne)return!0;if(e.deps===null)return!1;for(let t of e.deps)if(en.has(t)||t.f&2&&jr(t))return!0;return!1}function Mr(e){var t=cr;try{return cr=!0,e()}finally{cr=t}}function Nr(e){if(!(typeof e!=`object`||!e||e instanceof EventTarget)){if(fe in e)Pr(e);else if(!Array.isArray(e))for(let t in e){let n=e[t];typeof n==`object`&&n&&fe in n&&Pr(n)}}}function Pr(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{Pr(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 Fr=[`touchstart`,`touchmove`];function Ir(e){return Fr.includes(e)}var Lr=Symbol(`events`),Rr=new Set,zr=new Set;function Br(e){if(!N)return;e.removeAttribute(`onload`),e.removeAttribute(`onerror`);let t=e.__e;t!==void 0&&(e.__e=void 0,queueMicrotask(()=>{e.isConnected&&e.dispatchEvent(t)}))}function Vr(e,t,n,r={}){function i(e){if(r.capture||Gr.call(t,e),!e.cancelBubble)return On(()=>n?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?at(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function Hr(e,t,n,r,i){var a={capture:r,passive:i},o=Vr(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&Pn(()=>{t.removeEventListener(e,o,a)})}function G(e,t,n){(t[Lr]??={})[e]=n}function Ur(e){for(var t=0;t<e.length;t++)Rr.add(e[t]);for(var n of zr)n(e)}var Wr=null;function Gr(e){var t=this,n=t.ownerDocument,r=e.type,i=e.composedPath?.()||[],a=i[0]||e.target;Wr=e;var o=0,s=Wr===e&&e[Lr];if(s){var c=i.indexOf(s);if(c!==-1&&(t===document||t===window)){e[Lr]=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=sr,d=ur;lr(null),dr(null);try{for(var f,m=[];a!==null&&a!==t;){try{var h=a[Lr]?.[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[Lr]=t,delete e.currentTarget,lr(u),dr(d)}}}var Kr=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function qr(e){return Kr?.createHTML(e)??e}function Jr(e){var t=Cn(`template`);return t.innerHTML=qr(e.replaceAll(`<!>`,`<!---->`)),t.content}function Yr(e,t){var n=ur;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(N)return Yr(He,null),He;i===void 0&&(i=Jr(a?e:`<!>`+e),n||(i=yn(i)));var t=r||mn?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=yn(t),s=t.lastChild;Yr(o,s)}else Yr(t,t);return t}}function Xr(e,t,n=`svg`){var r=!e.startsWith(`<!>`),i=(t&1)!=0,a=`<${n}>${r?e:`<!>`+e}</${n}>`,o;return()=>{if(N)return Yr(He,null),He;if(!o){var e=yn(Jr(a));if(i)for(o=document.createDocumentFragment();yn(e);)o.appendChild(yn(e));else o=yn(e)}var t=o.cloneNode(!0);if(i){var n=yn(t),r=t.lastChild;Yr(n,r)}else Yr(t,t);return t}}function Zr(e,t){return Xr(e,t,`svg`)}function Qr(e=``){if(!N){var t=vn(e+``);return Yr(t,t),t}var n=He;return n.nodeType===3?wn(n):(n.before(n=vn()),Ue(n)),Yr(n,n),n}function $r(){if(N)return Yr(He,null),He;var e=document.createDocumentFragment(),t=document.createComment(``),n=vn();return e.append(t,n),Yr(t,n),e}function q(e,t){if(N){var n=ur;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=He),We();return}e!==null&&e.before(t)}function ei(){if(N&&He&&He.nodeType===8&&He.textContent?.startsWith(`$`)){let e=He.textContent.substring(1);return We(),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[ve]??=e.nodeValue)&&(e[ve]=n,e.nodeValue=`${n}`)}function ti(e,t){return ri(e,t)}var ni=new Map;function ri(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){_n();var c=void 0,l=Rn(()=>{var o=n??t.appendChild(vn());vt(o,{pending:()=>{}},t=>{et({});var n=Qe;if(a&&(n.c=a),i&&(r.$$events=i),N&&Yr(t,null),c=e(t,r)||{},N&&(ur.nodes.end=He,He===null||He.nodeType!==8||He.data!==`]`))throw Re(),Me;tt()},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=Ir(r);for(let e of[t,document]){var a=ni.get(e);a===void 0&&(a=new Map,ni.set(e,a));var o=a.get(r);o===void 0?(e.addEventListener(r,Gr,{passive:i}),a.set(r,1)):a.set(r,o+1)}}}};return u(f(Rr)),zr.add(u),()=>{for(var e of l)for(let n of[t,document]){var r=ni.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Gr),r.delete(e),r.size===0&&ni.delete(n)):r.set(e,i)}zr.delete(u),o!==n&&o.parentNode?.removeChild(o)}});return ii.set(c,l),c}var ii=new WeakMap,ai=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)er(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(er(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&&(Yn(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();nr(r,t),t.append(vn()),this.#n.set(e,{effect:r,fragment:t})}else Yn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Qn(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)||(Yn(n.effect),this.#n.delete(e))};ensure(e,t){var n=Pt,r=Sn();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=vn();i.append(a),this.#n.set(e,{effect:Gn(()=>t(a)),fragment:i})}else this.#t.set(e,Gn(()=>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 N&&(this.anchor=He),this.#a(n)}};function Y(e,t,n=!1){var r;N&&(r=He,We());var i=new ai(e),a=n?ie:0;function o(e,t){if(N){var n=Ke(r);if(e!==parseInt(n.substring(1))){var a=Ge();Ue(a),i.anchor=a,Ve(!1),i.ensure(e,t),Ve(!0);return}}i.ensure(e,t)}Un(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}var oi=Symbol(`NaN`);function si(e,t,n){N&&We();var r=new ai(e),i=!nt();Un(()=>{var e=t();e!==e&&(e=oi),i&&typeof e==`object`&&e&&(e={}),r.ensure(e,n)})}function ci(e,t){return t}function li(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s<i;s++){let n=t[s];Qn(n,()=>{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;ui(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;xn(u),u.append(l),e.items.clear()}ui(e,t,!c)}else a={pending:new Set(t),done:new Set},(e.outrogroups??=new Set).add(a)}function ui(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|=ce,nr(a,document.createDocumentFragment())):Yn(t[i],n)}}var di;function X(e,t,n,r,i,a=null){var o=e,s=new Map;if(t&4){var c=e;o=N?Ue(yn(c)):c.appendChild(vn())}N&&We();var u=null,d=Dt(()=>{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,pi(v,p,o,t,r),u!==null&&(p.length===0?u.f&33554432?(u.f^=ce,hi(u,null,o)):er(u):Qn(u,()=>{u=null})))}function _(e){v.pending.delete(e)}var v={effect:Un(()=>{p=W(d);var e=p.length;let c=!1;N&&Ke(o)===`[!`!=(e===0)&&(o=Ge(),Ue(o),Ve(!1),c=!0);for(var l=new Set,f=Pt,v=Sn(),y=0;y<e;y+=1){N&&He.nodeType===8&&He.data===`]`&&(o=He,c=!0,Ve(!1));var b=p[y],x=r(b,y),S=h?null:s.get(x);S?(S.v&&an(S.v,b),S.i&&an(S.i,y),v&&f.unskip_effect(S.e)):(S=mi(s,h?o:di??=vn(),b,x,y,i,t,n),h||(S.e.f|=ce),s.set(x,S)),l.add(x)}if(e===0&&a&&!u&&(h?u=Gn(()=>a(o)):(u=Gn(()=>a(di??=vn())),u.f|=ce)),e>l.size&&M(``,``,``),N&&e>0&&Ue(Ge()),!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,N&&(o=He)}function fi(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function pi(e,t,n,r,i){var a=(r&8)!=0,o=t.length,s=e.items,c=fi(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&&(er(_),a&&(_.nodes?.a?.unfix(),(d??=new Set).delete(_))),_.f&33554432)if(_.f^=ce,_===c)hi(_,null,n);else{var y=u?u.next:c;_===e.effect.last&&(e.effect.last=_.prev),_.prev&&(_.prev.next=_.next),_.next&&(_.next.prev=_.prev),gi(e,u,_),gi(e,_,y),hi(_,y,n),u=_,p=[],m=[],c=fi(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)hi(p[x],b,n);for(x=0;x<m.length;x+=1)l.delete(m[x]);gi(e,S.prev,C.next),gi(e,u,S),gi(e,C,b),c=b,u=C,--v,p=[],m=[]}else l.delete(_),hi(_,c,n),gi(e,_.prev,_.next),gi(e,_,u===null?e.effect.first:u.next),gi(e,u,_),u=_;continue}for(p=[],m=[];c!==null&&c!==_;)(l??=new Set).add(c),m.push(c),c=fi(c.next);if(c===null)continue}_.f&33554432||p.push(_),u=_,c=fi(_.next)}if(e.outrogroups!==null){for(let t of e.outrogroups)t.pending.size===0&&(ui(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=fi(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()}li(e,w,E)}}a&&at(()=>{if(d!==void 0)for(_ of d)_.nodes?.a?.apply()})}function mi(e,t,n,r,i,a,o,s){var c=o&1?o&16?nn(n):rn(n,!1,!1):null,l=o&2?nn(i):null;return{v:c,i:l,e:Gn(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function hi(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=bn(r);if(a.before(r),r===i)return;r=o}}function gi(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function _i(e,t,n=!1,r=!1,i=!1,a=!1){var o=e,s=``;if(n){var c=e;N&&(o=Ue(yn(c)))}U(()=>{var e=ur;if(s===(s=t()??``)){N&&We();return}if(n&&!N){e.nodes=null,c.innerHTML=s,s!==``&&Yr(yn(c),c.lastChild);return}if(e.nodes!==null&&(Xn(e.nodes.start,e.nodes.end),e.nodes=null),s!==``){if(N){for(var a=He.data,l=We(),u=l;l!==null&&(l.nodeType!==8||l.data!==``);)u=l,l=bn(l);if(l===null)throw Re(),Me;Yr(He,u),o=Ue(l);return}var d=Cn(r?`svg`:i?`math`:`template`,r?Fe:i?Ie:void 0);d.innerHTML=s;var f=r||i?d:d.content;if(Yr(yn(f),f.lastChild),r||i)for(;yn(f);)o.before(yn(f));else o.before(f)}})}function vi(e,t,...n){var r=new ai(e);Un(()=>{let e=t()??null;r.ensure(e,e&&(t=>e(t,...n)))},ie)}function yi(e,t){let n=null,r=N;var i;if(N){n=He;for(var a=yn(document.head);a!==null&&(a.nodeType!==8||a.data!==e);)a=bn(a);if(a===null)Ve(!1);else{var o=bn(a);a.remove(),Ue(o)}}N||(i=document.head.appendChild(vn()));try{Un(()=>{var e=Gn(()=>t(i));e.f|=ae})}finally{r&&(Ve(!0),Ue(n))}}function bi(e,t,n){zn(()=>{var r=Mr(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};Vn(()=>{var e=n();Nr(e),i&&Je(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}function xi(e,t){var n=void 0,r;Wn(()=>{n!==(n=t())&&(r&&=(Yn(r),null),n&&(r=Gn(()=>{zn(()=>n(e))})))})}function Si(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=Si(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Ci(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Si(e))&&(r&&(r+=` `),r+=t);return r}function wi(e){return typeof e==`object`?Ci(e):e??``}var Ti=[...`
|
|
2
|
+
\r\f\xA0\v`];function Ei(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||Ti.includes(r[o-1]))&&(s===r.length||Ti.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Di(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 Oi(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function ki(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(Oi)),i&&c.push(...Object.keys(i).map(Oi));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=Oi(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+=Di(r)),i&&(n+=Di(i,!0)),n=n.trim(),n===``?null:n}return e==null?null:String(e)}function Ai(e,t,n,r,i,a){var o=e[ge];if(N||o!==n||o===void 0){var s=Ei(n,r,a);(!N||s!==e.getAttribute(`class`))&&(s==null?e.removeAttribute(`class`):t?e.className=s:e.setAttribute(`class`,s)),e[ge]=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 ji(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 Mi(e,t,n,r){var i=e[_e];if(N||i!==t){var a=ki(t,r);(!N||a!==e.getAttribute(`style`))&&(a==null?e.removeAttribute(`style`):e.style.cssText=a),e[_e]=t}else r&&(Array.isArray(r)?(ji(e,n?.[0],r[0]),ji(e,n?.[1],r[1],`important`)):ji(e,n,r));return r}function Ni(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(Ii(r));return}for(r of e.options)if(dn(Ii(r),t)){r.selected=!0;return}(!n||t!==void 0)&&(e.selectedIndex=-1)}function Pi(e){var t=new MutationObserver(()=>{Ni(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),Pn(()=>{t.disconnect()})}function Fi(e,t,n=t){var r=new WeakSet,i=!0;kn(e,`change`,t=>{var i=t?`[selected]`:`:checked`,a;if(e.multiple)a=[].map.call(e.querySelectorAll(i),Ii);else{var o=e.querySelector(i)??e.querySelector(`option:not([disabled])`);a=o&&Ii(o)}n(a),e.__value=a,Pt!==null&&r.add(Pt)}),zn(()=>{var a=t();if(e===document.activeElement){var o=Pt;if(r.has(o))return}if(Ni(e,a,i),i&&a===void 0){var s=e.querySelector(`:checked`);s!==null&&(a=Ii(s),n(a))}e.__value=a,i=!1}),Pi(e)}function Ii(e){return`__value`in e?e.__value:e.value}var Li=Symbol(`is custom element`),Ri=Symbol(`is html`),zi=xe?`link`:`LINK`,Bi=xe?`progress`:`PROGRESS`;function Vi(e){if(N){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[ye]=n,at(n),Dn()}}function Hi(e,t){var n=Wi(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==Bi)||(e.value=t??``)}function Ui(e,t){var n=Wi(e);n.checked!==(n.checked=t??void 0)&&(e.checked=t)}function Z(e,t,n,r){var i=Wi(e);N&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===zi)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[me]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&Ki(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function Wi(e){return e[he]??={[Li]:e.nodeName.includes(`-`),[Ri]:e.namespaceURI===Pe}}var Gi=new Map;function Ki(e){var t=e.getAttribute(`is`)||e.nodeName,n=Gi.get(t);if(n)return n;Gi.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 qi(e,t,n=t){var r=new WeakSet;kn(e,`input`,async i=>{var a=i?e.defaultValue:e.value;if(a=Ji(e)?Yi(a):a,n(a),Pt!==null&&r.add(Pt),await kr(),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))}}}),(N&&e.defaultValue!==e.value||Mr(t)==null&&e.value)&&(n(Ji(e)?Yi(e.value):e.value),Pt!==null&&r.add(Pt)),Vn(()=>{var n=t();if(e===document.activeElement){var i=Pt;if(r.has(i))return}Ji(e)&&n===Yi(e.value)||e.type===`date`&&!n&&!e.value||n!==e.value&&(e.value=n??``)})}function Ji(e){var t=e.type;return t===`number`||t===`range`}function Yi(e){return e===``?null:+e}function Xi(e,t){return e===t||e?.[fe]===t}function Zi(e={},t,n,r){var i=Qe.r,a=ur;return zn(()=>{var o,s;return Vn(()=>{o=s,s=r?.()||[],Mr(()=>{Xi(n(...s),e)||(t(e,...s),o&&Xi(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&&Xi(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Qi(e,t,n,r,i){var a=()=>{r(n[e])};n.addEventListener(t,a),i?Vn(()=>{n[e]=i()}):a(),(n===document.body||n===window||n===document)&&Pn(()=>{n.removeEventListener(t,a)})}function $i(e=!1){let t=Qe,n=t.l.u;if(!n)return;let r=()=>Nr(t.s);if(e){let e=0,n={},i=wt(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>W(i)}n.b.length&&Ln(()=>{ea(t,r),S(n.b)}),Fn(()=>{let e=Mr(()=>n.m.map(x));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&Fn(()=>{ea(t,r),S(n.a)})}function ea(e,t){if(e.l.s)for(let t of e.l.s)W(t);t()}function Q(e,t,n,r){var i=!Xe||(n&2)!=0,a=(n&8)!=0,o=(n&16)!=0,s=r,c=!0,l=void 0,u=()=>o&&i?(l??=wt(r),W(l)):(c&&(c=!1,s=o?Mr(r):r),s);let d;if(a){var f=fe in e||pe in e;d=m(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,h=!1;a?[p,h]=ht(()=>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?wt:Dt)(()=>(v=!1,g()));a&&W(y);var b=ur;return(function(e,t){if(arguments.length>0){let n=t?W(y):i&&a?ln(e):e;return z(y,n),v=!0,s!==void 0&&(s=n),e}return ar&&v||b.f&16384?y.v:W(y)})}function ta(e){Qe===null&&Se(`onMount`),Xe&&Qe.l!==null?ra(Qe).m.push(e):Fn(()=>{let t=Mr(e);if(typeof t==`function`)return t})}function na(e){Qe===null&&Se(`onDestroy`),ta(()=>()=>Mr(e))}function ra(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`),Ze();function ia(e,t){et(t,!1);let n=null,r,i=rn(null),a=rn(null);function o(){clearTimeout(r),z(a,null)}na(s);function s(){o(),n?.remove(),n=null}function c(e){let t=e instanceof Element?e.closest(`button[title]`):null;return t instanceof HTMLButtonElement&&t.querySelector(`.ui-icon`)?t:null}function l(e){if(!e.isConnected)return;n?.remove(),n=document.createElement(`div`),n.className=`icon-tooltip`,n.setAttribute(`aria-hidden`,`true`),(e.closest(`dialog[open], [popover]:popover-open`)??document.body).append(n),n.textContent=e.title;let{left:t,width:r,top:i,bottom:a}=e.getBoundingClientRect();n.style.left=Math.max(4,Math.min(t+(r-n.offsetWidth)/2,document.documentElement.clientWidth-n.offsetWidth-4))+`px`,n.style.top=(i>=n.offsetHeight+6?i-n.offsetHeight-4:a+4)+`px`}function u(e){let t=c(e.target);t&&requestAnimationFrame(()=>{document.activeElement===t&&t.matches(`:focus-visible`)&&l(t)})}function d(e){s(),z(i,null);let t=c(e.target);e.pointerType!==`touch`||!e.isPrimary||!t||(z(a,{x:e.clientX,y:e.clientY}),r=setTimeout(()=>{t.isConnected&&(z(i,t),l(t))},500))}function f(e){W(a)&&Math.hypot(e.clientX-W(a).x,e.clientY-W(a).y)>10&&s()}function p(e){W(i)&&e.detail&&W(i)===c(e.target)&&(e.preventDefault(),e.stopImmediatePropagation()),z(i,null),s()}$i(),Hr(`focusin`,pn,u),Hr(`pointerdown`,pn,d,!0),Hr(`pointermove`,pn,f,!0),Hr(`pointerup`,pn,o,!0),Hr(`pointercancel`,pn,s,!0),Hr(`contextmenu`,pn,e=>{(W(a)||W(i))&&c(e.target)&&e.preventDefault()}),Hr(`click`,pn,p,!0),Hr(`focusout`,pn,s),Hr(`keydown`,pn,e=>{e.key===`Escape`&&s()}),Hr(`scroll`,pn,s,!0),Hr(`resize`,fn,s),tt()}var aa=`/assets/ui-icons-BIEuwBEr.svg`,oa=Zr(`<svg class="ui-icon svelte-14wiad3" aria-hidden="true" focusable="false"><use></use></svg>`);function sa(e,t){var n=oa();let r;var i=B(n);P(n),U(()=>{r=Mi(n,``,r,{"--icon-size":t.size}),Z(i,`href`,`${aa}#${t.name}`)}),q(e,n)}var ca=`gestalt-mobile.theme`,la=`dyne-org`,ua=[{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 da(e){return typeof e==`string`&&ua.some(t=>t.id===e)}function fa(e){return e===`light`?`minimal-light`:e===`dark`?`minimal-dark`:da(e)?e:la}function pa(e){return ua.find(t=>t.id===e)||ma(e)}function ma(e){throw Error(`Unknown theme ID: ${e}`)}function ha(e){try{return e?.getItem(`gestalt-mobile.theme`)??null}catch{return null}}function ga(e){if(`storage`in e)return e.storage??null;try{return window.localStorage}catch{return null}}function _a(e){return`meta`in e?e.meta??null:document.querySelector(`meta[name="color-scheme"]`)}function va(e,t={}){let n=t.root??document.documentElement,r=_a(t),i=pa(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 ya(e={}){return va(fa(ha(ga(e))),e)}function ba(e,t={}){let n=va(e,t);try{ga(t)?.setItem(ca,n)}catch{}return n}function xa(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 Sa(e,t=`|`){return e.map(e=>Ja(e)).join(t)}function Ca(e,t){return typeof t==`bigint`?t.toString():t}var wa=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 Ta(e){return new wa(e)}function Ea(e){return e==null}function Da(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Oa(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 ka(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Aa(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function ja(e){return Aa(e._zod.def)??e._zod.def.shape}function Ma(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ka(this,t,e),e},enumerable:!0,configurable:!0})}function Na(e,t,n){t in e?ka(e,t,n):e[t]=n}function Pa(e,t,n,r){let i=ja(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?Ma(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):Na(e,a,r?r(n.value,a):n.value))}}function Fa(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?Ma(e,n,()=>t[n]):Na(e,n,r.value))}}function Ia(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function La(e){return JSON.stringify(e)}function Ra(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var za=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ba(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Va=Ta(()=>{if(zo.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ha(e){if(Ba(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(Ba(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function Ua(e){return Ha(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Wa=new Set([`string`,`number`,`symbol`]);function Ga(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ka(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function qa(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 Ja(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Ya(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Xa={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Za={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Qa(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 Pa(i,e,$a(e,t)),Ka(e,Ia(n,{shape:i,checks:[]}))}function $a(e,t){let n=ja(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 eo(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($a(e,t)),a={};return Pa(a,e,Reflect.ownKeys(ja(e)).filter(e=>!i.has(e))),Ka(e,Ia(n,{shape:a,checks:[]}))}function to(e,t){if(!Ha(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=ja(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 Ka(e,Ia(e._zod.def,{shape:no(e,t)}))}function no(e,t){let n={};return Pa(n,e,Reflect.ownKeys(ja(e))),Fa(n,t),n}function ro(e,t){if(!Ha(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Ka(e,Ia(e._zod.def,{shape:no(e,t)}))}function io(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 Pa(n,e,Reflect.ownKeys(ja(e))),Pa(n,t,Reflect.ownKeys(ja(t))),Ka(e,Ia(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ao(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($a(t,n)):void 0,o={};return Pa(o,t,Reflect.ownKeys(ja(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Ka(t,Ia(t._zod.def,{shape:o,checks:[]}))}function oo(e,t,n){let r=n?new Set($a(t,n)):void 0,i={};return Pa(i,t,Reflect.ownKeys(ja(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Ka(t,Ia(t._zod.def,{shape:i}))}function so(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 co(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 lo(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function uo(e){return typeof e==`string`?e:e?.message}function fo(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 po(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function mo(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:uo(e.inst?._zod.def?.error?.(e))??uo(a?.(e))??uo(t?.error?.(e))??uo(n.customError?.(e))??uo(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 ho=/[\uD800-\uDBFF]/;function go(e){let t=e.length;if(!ho.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 _o(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function vo(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 yo(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function bo(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):wo(e,n,r.value)}}function xo(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function So(e,t,n){return xo(e,t,n,!1)}function Co(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return xo(this,n,r(this))},set(e){xo(this,n,e)}})}return t}function wo(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:xo(this,t,n.bind(this))},set(e){xo(this,t,e)}})}function To(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var Eo,Do=!1,Oo={configurable:!0,get(){Do=!0}};function ko(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&Eo!==e._zod){Eo=void 0;return}Eo=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Oo);let e=Do;Do=!1;try{let r=n(this);return Do?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Do||=e,r}catch(n){throw delete this[t],Do||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Ao(e,t,n,r){let i=To(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 jo=`~constantCatch`;function Mo(e){let t=()=>e;return t[jo]=!0,t}var No,Po={value:void 0,enumerable:!1},Fo=`captureStackTrace`in Error?Error:null;function Io(e){let t=Fo;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Fo=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){Po.value=new a(r);try{Object.defineProperty(n,"_zod",Po)}finally{Po.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),bo(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?Io(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 Lo=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ro=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(No=globalThis).__zod_globalConfig??(No.__zod_globalConfig={});var zo=globalThis.__zod_globalConfig;function Bo(e){return e&&Object.assign(zo,e),zo}function Vo(){let e=this._zod;return e.message??=JSON.stringify(e.def,Ca,2),e.message}function Ho(e){this._zod.message=e}var Uo={get:Vo,set:Ho,enumerable:!0,configurable:!0},Wo={value:void 0,enumerable:!1},Go=new WeakSet([Object.prototype,Error.prototype]),Ko=(e,t)=>{e.name=`$ZodError`,Wo.value=t,Object.defineProperty(e,"issues",Wo),Wo.value=void 0,Object.defineProperty(e,"message",Uo);let n=Object.getPrototypeOf(e);Go.has(n)||(Go.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})}}))},qo=$(`$ZodError`,Ko);$(`$ZodError`,Ko,void 0,{Parent:Error});function Jo(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 Yo(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Jo(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Xo(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 Zo(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Qo=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 Lo;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>mo(e,o,Bo())));throw za(n,a?.callee??t),n}return s.value};return t},$o=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=>mo(e,o,Bo())));throw za(n,a?.callee??t),n}return s.value};return t},es=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 Lo;return a.issues.length?ts(e,a.issues,i):{success:!0,data:a.value}};function ts(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>mo(e,n,Bo()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var ns=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?ts(e,a.issues,i):{success:!0,data:a.value}},rs=Symbol.for(`zod.compile.invalid`),is=Symbol.for(`zod.compile.fallback`),as=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==rs)return!0;if(r.definite===!0&&n===void 0)return!1}return os(e,t,n)});function os(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[is]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Lo;return a.issues.length===0}var ss=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},cs=e=>{let t=Qo(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Zo(n,a))};return n},ls=e=>{let t=Qo(e),n=(e,r,i,a)=>t(e,r,i,Zo(n,a));return n},us=e=>{let t=$o(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Zo(n,a))};return n},ds=e=>{let t=$o(e),n=async(e,r,i,a)=>await t(e,r,i,Zo(n,a));return n},fs=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return es(e)(t,n,i)},ps=e=>(t,n,r)=>es(e)(t,n,r),ms=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ns(e)(t,n,i)},hs=e=>async(t,n,r)=>ns(e)(t,n,r),gs=/^[cC][0-9a-z]{6,}$/,_s=/^[0-9a-z]+$/,vs=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,ys=/^[0-9a-vA-V]{20}$/,bs=/^[A-Za-z0-9]{27}$/,xs=/^[a-zA-Z0-9_-]{21}$/;function Ss(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Cs=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ws=/^([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})$/,Ts=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)$/,Es=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ds=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function Os(){return new RegExp(Ds,`u`)}var ks=/^(?:(?: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])$/,As=/^(([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}|:))$/,js=/^((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])$/,Ms=/^(([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])$/,Ns=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ps=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Fs=/^https?$/,Is=/^\+[1-9]\d{6,14}$/,Ls=`(?:(?:\\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 Rs(e){return RegExp(`^${e}$`)}var zs=Rs(Ls);function Bs(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 Vs(e){return RegExp(`^${Bs(e)}$`)}function Hs(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Bs({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Bs({precision:e.precision})}`:n;return RegExp(`^${Ls}T(?:${r})$`)}var Us=/^[\s\S]{0,}$/,Ws=/^-?\d+(?:\.\d+)?$/,Gs=/^(?:true|false)$/i,Ks=/^[^A-Z]*$/,qs=/^[^a-z]*$/,Js=$(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Ys=e=>{let t=e.value;return!Ea(t)&&t.length!==void 0},Xs={number:`number`,bigint:`bigint`,object:`date`},Zs=$(`$ZodCheckLessThan`,(e,t)=>{Js.init(e,t);let n=Xs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Xs[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})}}),Qs=$(`$ZodCheckGreaterThan`,(e,t)=>{Js.init(e,t);let n=Xs[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Xs[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})}}),$s=$(`$ZodCheckMultipleOf`,(e,t)=>{Js.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):Oa(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})}}),ec=$(`$ZodCheckNumberFormat`,(e,t)=>{Js.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Xa[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})}}),tc=$(`$ZodCheckMaxLength`,(e,t)=>{var n;Js.init(e,t),(n=e._zod.def).when??(n.when=Ys),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?go(r):i)<=t.maximum)return;let a=_o(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),nc=$(`$ZodCheckMinLength`,(e,t)=>{var n;Js.init(e,t),(n=e._zod.def).when??(n.when=Ys),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?go(r):i)>=t.minimum)return;let a=_o(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),rc=$(`$ZodCheckLengthEquals`,(e,t)=>{var n;Js.init(e,t),(n=e._zod.def).when??(n.when=Ys),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?go(r):i;if(a===t.length)return;let o=_o(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})}}),ic=$(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Js.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=()=>{})}),ac=$(`$ZodCheckRegex`,(e,t)=>{ic.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})}}),oc=$(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Ks,ic.init(e,t)}),sc=$(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=qs,ic.init(e,t)}),cc=$(`$ZodCheckIncludes`,(e,t)=>{Js.init(e,t);let n=Ga(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})}}),lc=$(`$ZodCheckStartsWith`,(e,t)=>{Js.init(e,t);let n=RegExp(`^${Ga(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})}}),uc=$(`$ZodCheckEndsWith`,(e,t)=>{Js.init(e,t);let n=RegExp(`.*${Ga(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})}}),dc=$(`$ZodCheckOverwrite`,(e,t)=>{Js.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),fc=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))}},pc={major:4,minor:6,patch:7},mc=$(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=pc;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=so(t),a;for(let o of n){if(o._zod.def.when){if(co(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 Lo;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(po(t.issues,n,e),i||=so(t,n))});else{if(t.issues.length===n)continue;po(t.issues,n,e),i||=so(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(so(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Lo;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 Lo;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return So(this,`~standard`,_c(this))},set"~standard"(e){xo(this,`~standard`,e)}}),hc=(e,t)=>e.issues.length?{issues:e.issues.map(e=>mo(e,t,Bo()))}:{value:e.value};async function gc(e,t){let n={async:!0};return hc(await e._zod.run({value:t,issues:[]},n),n)}function _c(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return hc(r,n)}catch{}return gc(e,t)},vendor:`zod`,version:1}}var vc=$(`$ZodString`,(e,t)=>{mc.init(e,t),e._zod.pattern=t.pattern??Us,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}}),yc=$(`$ZodStringFormat`,(e,t)=>{ic.init(e,t),vc.init(e,t)}),bc=$(`$ZodGUID`,(e,t)=>{t.pattern??=ws,yc.init(e,t)}),xc=$(`$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??=Ts(e)}else t.pattern??=Ts();yc.init(e,t)}),Sc=$(`$ZodEmail`,(e,t)=>{t.pattern??=Es,yc.init(e,t)});function Cc(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function wc(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Cc(e)||2:Tc(e,t)}function Tc(e,t){if(!t.normalize&&t.protocol?.source===Fs.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 Ec=/[\t\n\r]/g;function Dc(e){return e.replace(Ec,``)}function Oc(e,t){return t.lastIndex=0,t.test(e.hostname)}function kc(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Ac=$(`$ZodURL`,(e,t)=>{yc.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=wc(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=Dc(r);return}t.hostname&&!Oc(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&&!kc(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:Dc(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),jc=$(`$ZodEmoji`,(e,t)=>{t.pattern??=Os(),yc.init(e,t)}),Mc=$(`$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?xs:Ss(t.length),yc.init(e,t)}),Nc=$(`$ZodCUID`,(e,t)=>{t.pattern??=gs,yc.init(e,t)}),Pc=$(`$ZodCUID2`,(e,t)=>{t.pattern??=_s,yc.init(e,t)}),Fc=$(`$ZodULID`,(e,t)=>{t.pattern??=vs,yc.init(e,t)}),Ic=$(`$ZodXID`,(e,t)=>{t.pattern??=ys,yc.init(e,t)}),Lc=$(`$ZodKSUID`,(e,t)=>{t.pattern??=bs,yc.init(e,t)}),Rc=$(`$ZodISODateTime`,(e,t)=>{t.pattern??=Hs(t),yc.init(e,t)}),zc=$(`$ZodISODate`,(e,t)=>{t.pattern??=zs,yc.init(e,t)}),Bc=$(`$ZodISOTime`,(e,t)=>{t.pattern??=Vs(t),yc.init(e,t)}),Vc=$(`$ZodISODuration`,(e,t)=>{t.pattern??=Cs,yc.init(e,t)}),Hc=$(`$ZodIPv4`,(e,t)=>{t.pattern??=ks,yc.init(e,t)}),Uc=/^[0-9a-fA-F:.]+$/;function Wc(e){return Uc.test(e)?Cc(`http://[${e}]`):!1}var Gc=$(`$ZodIPv6`,(e,t)=>{t.pattern??=As,yc.init(e,t),e._zod.check=n=>{Wc(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Kc=$(`$ZodCIDRv4`,(e,t)=>{t.pattern??=js,yc.init(e,t)});function qc(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:Wc(n)}var Jc=$(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Ms,yc.init(e,t),e._zod.check=n=>{qc(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Yc(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Xc=/^[0-9a-zA-Z+/]*={0,2}$/,Zc=$(`$ZodBase64`,(e,t)=>{t.pattern??=Xc,yc.init(e,t),e._zod.check=n=>{Yc(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Qc=/^[A-Za-z0-9_-]*$/;function $c(e){if(!Qc.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Yc(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var el=$(`$ZodBase64URL`,(e,t)=>{t.pattern??=Qc,yc.init(e,t),e._zod.check=n=>{$c(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),tl=$(`$ZodE164`,(e,t)=>{t.pattern??=Is,yc.init(e,t)});function nl(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 rl=$(`$ZodJWT`,(e,t)=>{yc.init(e,t),e._zod.check=n=>{nl(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),il=$(`$ZodNumber`,(e,t)=>{mc.init(e,t),e._zod.pattern=Ws,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}}),al=$(`$ZodNumberFormat`,(e,t)=>{ec.init(e,t),il.init(e,t)}),ol=$(`$ZodBoolean`,(e,t)=>{mc.init(e,t),e._zod.pattern=Gs,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}}),sl=$(`$ZodUnknown`,(e,t)=>{mc.init(e,t),e._zod.parse=e=>e}),cl=$(`$ZodNever`,(e,t)=>{mc.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function ll(e,t){let n=fo(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 fo(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,po(n.issues,t,e),n}}return i(n,a)}}var ul=e=>Array.isArray(e)?e.length:-1;function dl(e,t,n){e.issues.length&&t.issues.push(...lo(n,e.issues)),t.value[n]=e.value}var fl=$(`$ZodArray`,(e,t)=>{mc.init(e,t);let n=zo.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=>dl(t,r,e)));else if(dl(c,r,e),s&&c.issues.length!==0&&so(c))break}return o.length?Promise.all(o).then(()=>r):r},ll(e,ul)});function pl(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(...lo(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 ml=[];function hl(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:ml,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=Ya(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function gl(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(so(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=>pl(e,n,i,t,d,f))):pl(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 _l=$(`$ZodObject`,(e,t)=>{mc.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=Ta(()=>hl(t));ko(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)||ka(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=Ba,o=t.catchall,s,c=zo.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(so(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=>pl(n,t,e,r,a,o))):pl(s,t,e,r,a,o)}return o?gl(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),vl=$(`$ZodObjectJIT`,(e,t)=>{_l.init(e,t);let n=e._zod.parse,r=Ta(()=>hl(t)),i=zo.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new fc([`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)}]`:La(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=Ba,c=!zo.jitless,l=c&&Va.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?gl([],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 yl(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=>!so(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=>mo(e,r,Bo())))}),t)}var bl=$(`$ZodUnion`,(e,t)=>{mc.init(e,t),ko(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),ko(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),ko(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)))}),ko(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=>Da(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=>yl(t,r,e,i)):yl(o,r,e,i)}});function xl(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 Sl=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,bl.init(e,t);let n=e._zod.parse;ko(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)||ka(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=Aa(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Ta(()=>xl(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Ba(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)}}),Cl=$(`$ZodIntersection`,(e,t)=>{mc.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])=>Tl(e,t,n)):Tl(e,i,a)}});function wl(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ha(e)&&Ha(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=wl(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=wl(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 Tl(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=wl(t.value,n.value);if(!c.valid){if(so(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var El=$(`$ZodEnum`,(e,t)=>{mc.init(e,t);let n=xa(t.entries),r=new Set(n);e._zod.values=r,ko(e,`pattern`,e=>{let t=xa(e.def.entries).filter(e=>Wa.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Ga(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}}),Dl=$(`$ZodLiteral`,(e,t)=>{mc.init(e,t);let n=new Set(t.values);e._zod.values=n,ko(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Ga(e):e?Ga(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}}),Ol=$(`$ZodTransform`,(e,t)=>{mc.init(e,t),e._zod.optin=`optional`,zo.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ro(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 Lo;return n.value=i,n}});function kl(e,t){return e.value=t.issues.length?void 0:t.value,e}var Al=$(`$ZodOptional`,(e,t)=>{mc.init(e,t),ko(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,ko(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),ko(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Da(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=>kl(e,t)):kl(e,r)}return t.innerType._zod.run(e,n)}}),jl=$(`$ZodExactOptional`,(e,t)=>{Al.init(e,t),ko(e,`values`,e=>e.def.innerType._zod.values),ko(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ml=$(`$ZodNullable`,(e,t)=>{mc.init(e,t),ko(e,`optin`,e=>e.def.innerType._zod.optin),ko(e,`optout`,e=>e.def.innerType._zod.optout),ko(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Da(t.source)}|null)$`):void 0}),ko(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)}),Nl=$(`$ZodDefault`,(e,t)=>{mc.init(e,t),e._zod.optin=`defaulted`,ko(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=>Pl(e,t)):Pl(r,t)}});function Pl(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Fl=$(`$ZodPrefault`,(e,t)=>{mc.init(e,t),e._zod.optin=`defaulted`,ko(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))}),Il=$(`$ZodNonOptional`,(e,t)=>{mc.init(e,t),ko(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=>Ll(t,e)):Ll(i,e)}});function Ll(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 Rl(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>mo(e,r,Bo()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var zl=$(`$ZodCatch`,(e,t)=>{mc.init(e,t),ko(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),ko(e,`optout`,e=>e.def.innerType._zod.optout),ko(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=>Rl(e,r,t,n)):Rl(e,r,t,n)}}),Bl=$(`$ZodPipe`,(e,t)=>{mc.init(e,t),ko(e,`values`,e=>e.def.in._zod.values),ko(e,`optin`,e=>e.def.in._zod.optin),ko(e,`optout`,e=>e.def.out._zod.optout),ko(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=>Vl(e,t.in,n)):Vl(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Vl(e,t.out,n)):Vl(r,t.out,n)}});function Vl(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 Hl=$(`$ZodReadonly`,(e,t)=>{mc.init(e,t),ko(e,`propValues`,e=>e.def.innerType._zod.propValues),ko(e,`values`,e=>e.def.innerType._zod.values),ko(e,`optin`,e=>e.def.innerType?._zod?.optin),ko(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(Ul):Ul(r)}});function Ul(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Wl=$(`$ZodCustom`,(e,t)=>{Js.init(e,t),mc.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=>Gl(t,n,r,e));Gl(i,n,r,e)}});function Gl(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(yo(e))}}var Kl=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},ql=`~memo`,Jl=[];function Yl(e){return typeof e==`object`&&!!e}function Xl(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Zl=new WeakMap,Ql=0,$l=1,eu=2;function tu(e,t,n){let r=Zl.get(e);if(r!==void 0)return r?eu:Ql;if(t.has(e))return eu;t.add(e);let i=Ql,a=e=>{if(i!==eu&&e?._zod){let r=tu(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Ql;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?$l:o.value?._zod?tu(o.value,t,n):Ql;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Aa(c);s(e?o(e,!0):$l),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?tu(r,t,!1):$l);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),nu(e,i)}function nu(e,t){return t!==$l&&Zl.set(e,t===eu),t}function ru(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var iu,au=[],ou={alloc(e,t,n){let r=iu;if(!r)return n;iu=void 0;let i={value:n,issues:null};return r.set(t.value,i),au.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`&&cu(n,e.value))throw new Kl;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=tu(e,new Set,!1);if(i===Ql)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===eu||r?n=!0:r=!0}let l=s.value;if(!Yl(l))return t(s,c);let u=c[ql];u||(u={buckets:new WeakMap,backEdges:void 0},c[ql]=u);let d;i===c?d=a:(d=ru(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(...Xl(f.issues)):(s.memo=!0,u.backEdges??=new WeakSet,u.backEdges.add(f.value)),s;iu=d;let p=au.length,m=t(s,c);iu=void 0;let h=au.length>p?au.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Xl(e.issues):Jl),e)):(h&&(h.issues=m.issues.length?Xl(m.issues):Jl),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function su(){return ou}function cu(e,t){let n=e[ql]?.backEdges;return n!==void 0&&Yl(t)&&n.has(t)}var lu=()=>{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(vo(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Ja(e.values[0])}`:`Invalid option: expected one of ${Sa(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`:``}: ${Sa(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 uu(){return{localeError:lu()}}var du,fu=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 pu(){return new fu}(du=globalThis).__zod_globalRegistry??(du.__zod_globalRegistry=pu());var mu=globalThis.__zod_globalRegistry;function hu(e){return e.checks&&=[...e.checks],e}function gu(e,t){return new e(hu({type:`string`,...qa(t)}))}function _u(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...qa(t)})}function vu(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...qa(t)})}function yu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...qa(t)})}function bu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...qa(t)})}function xu(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...qa(t)})}function Su(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...qa(t)})}function Cu(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...qa(t)})}function wu(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...qa(t)})}function Tu(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...qa(t)})}function Eu(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...qa(t)})}function Du(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...qa(t)})}function Ou(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...qa(t)})}function ku(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...qa(t)})}function Au(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...qa(t)})}function ju(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...qa(t)})}function Mu(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...qa(t)})}function Nu(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...qa(t)})}function Pu(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...qa(t)})}function Fu(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...qa(t)})}function Iu(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...qa(t)})}function Lu(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...qa(t)})}function Ru(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...qa(t)})}function zu(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...qa(t)})}function Bu(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...qa(t)})}function Vu(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...qa(t)})}function Hu(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...qa(t)})}function Uu(e,t){return new e(hu({type:`number`,checks:[],...qa(t)}))}function Wu(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...qa(t)})}function Gu(e,t){return new e({type:`boolean`,...qa(t)})}function Ku(e){return new e({type:`unknown`})}function qu(e,t){return new e({type:`never`,...qa(t)})}function Ju(e,t){return new Zs({check:`less_than`,...qa(t),value:e,inclusive:!1})}function Yu(e,t){return new Zs({check:`less_than`,...qa(t),value:e,inclusive:!0})}function Xu(e,t){return new Qs({check:`greater_than`,...qa(t),value:e,inclusive:!1})}function Zu(e,t){return new Qs({check:`greater_than`,...qa(t),value:e,inclusive:!0})}function Qu(e,t){return new $s({check:`multiple_of`,...qa(t),value:e})}function $u(e,t){return new tc({check:`max_length`,...qa(t),maximum:e})}function ed(e,t){return new nc({check:`min_length`,...qa(t),minimum:e})}function td(e,t){return new rc({check:`length_equals`,...qa(t),length:e})}function nd(e,t){return new ac({check:`string_format`,format:`regex`,...qa(t),pattern:e})}function rd(e){return new oc({check:`string_format`,format:`lowercase`,...qa(e)})}function id(e){return new sc({check:`string_format`,format:`uppercase`,...qa(e)})}function ad(e,t){return new cc({check:`string_format`,format:`includes`,...qa(t),includes:e})}function od(e,t){return new lc({check:`string_format`,format:`starts_with`,...qa(t),prefix:e})}function sd(e,t){return new uc({check:`string_format`,format:`ends_with`,...qa(t),suffix:e})}function cd(e){return new dc({check:`overwrite`,tx:e})}function ld(e){return cd(t=>t.normalize(e))}function ud(){return cd(e=>e.trim())}function dd(){return cd(e=>e.toLowerCase())}function fd(){return cd(e=>e.toUpperCase())}function pd(){return cd(e=>Ra(e))}function md(e,t,n){return new e({type:`array`,element:t,...qa(n)})}function hd(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...qa(n)})}function gd(e,t){let n=_d(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(yo(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(yo(r))}},e(t.value,t)),t);return n}function _d(e,t){let n=new Js({check:`custom`,...qa(t)});return n._zod.check=e,n}function vd(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&ka(e,t,n[t]);return e}function yd(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??mu,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 bd(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 xd(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,xd(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&vd(o.schema,c),t.io===`input`&&jd(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 Sd(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Cd(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}/${Sd(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+Sd(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 wd(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;wd(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 Td=new Set([`type`,`properties`,`required`,`additionalProperties`]),Ed=[`oneOf`,`anyOf`];function Dd(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function Od(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Td.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]??Dd(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ka(n,r,e.length===1?e[0]:Od(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=Dd(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 kd(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Td)if(t in e)return;let n=t.filter(e=>Ed.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=Od(t);else{let e=n[0],i=Ed.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=>Od([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,vd(e,r))}function Ad(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)):vd(i,s),vd(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())wd(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)??[])kd(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)}vd(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,ka(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:Nd(t,`input`,e.processors),output:Nd(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function jd(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 jd(r.element,n);if(r.type===`set`)return jd(r.valueType,n);if(r.type===`lazy`)return jd(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 jd(r.innerType,n);if(r.type===`intersection`)return jd(r.left,n)||jd(r.right,n);if(r.type===`record`||r.type===`map`)return jd(r.keyType,n)||jd(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:jd(r.in,n)||jd(r.out,n);if(r.type===`object`){for(let e in r.shape)if(jd(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(jd(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(jd(e,n))return!0;return!!(r.rest&&jd(r.rest,n))}return!1}var Md=(e,t={})=>n=>{let r=yd({...n,processors:t});return xd(e,r),Cd(r,e),Ad(r,e)},Nd=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=yd({...i??{},target:a,io:t,processors:n});return xd(e,o),Cd(o,e),Ad(o,e)},Pd=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Fd=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Id=(e,t)=>{Pd(e,`minimum`,t),Fd(e,`maximum`,t)},Ld=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Rd=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},zd=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Bd=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Vd=(e,t)=>Pd(e,`minimum`,t.minimum),Hd=(e,t)=>Fd(e,`maximum`,t.maximum),Ud=e=>(t,n)=>{Bd(t,n.format);let[r,i]=e[n.format];Pd(t,`minimum`,r),Fd(t,`maximum`,i)},Wd={greater_than:(e,t)=>Pd(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Fd(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ld(e,t.value),number_format:Ud(Xa),bigint_format:Ud(Za),min_length:Vd,max_length:Hd,length_equals:(e,t)=>Id(e,t.length),min_size:Vd,max_size:Hd,size_equals:(e,t)=>Id(e,t.size),string_format:(e,t)=>{Bd(e,t.format),t.pattern&&Rd(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)=>zd(e,t.mime)};function Gd(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Wd[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Pd(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Pd(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Fd(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Fd(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ld(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&zd(t,i.mime);for(let e of i.patterns??[])Rd(t,e);return t}var Kd={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},qd=new Map([[Xc,Ns],[Qc,Ps]]),Jd=e=>qd.get(e)??e,Yd=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Gd(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Kd[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(Jd);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}))])}},Xd=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Gd(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)):bd(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}))])}},Zd=(e,t,n,r)=>{n.type=`boolean`},Qd=(e,t,n,r)=>{n.not={}},$d=(e,t,n,r)=>{let i=e._zod.def,a=xa(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},ef=(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(bd(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(bd(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},tf=(e,t,n,r)=>{bd(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},nf=(e,t,n,r)=>{bd(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},rf=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Gd(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=xd(a.element,t,{...r,path:[...r.path,`items`]})};function af(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?af(t.out):t.type===`catch`?af(t.innerType):e._zod.optin}var of=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&bd(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)ka(i.properties,e,xd(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`?af(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=xd(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},sf=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>xd(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},cf=(e,t,n,r)=>{let i=e._zod.def,a=xd(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=xd(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)},lf=(e,t,n,r)=>{let i=e._zod.def,a=xd(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`}]},uf=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},df=Symbol();function ff(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(bd(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),df):JSON.parse(o)}var pf=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=ff(i.defaultValue,e,t,n,r);o!==df&&(n.default=o)},mf=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=ff(i.defaultValue,e,t,n,r);o!==df&&(n._prefault=o)},hf=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{bd(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},gf=(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;xd(o,t,r);let s=t.seen.get(e);s.ref=o},_f=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},vf=(e,t,n,r)=>{let i=e._zod.def;xd(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},yf=new WeakSet([Object.prototype,Error.prototype]);function bf(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 xf=$(`ZodError`,(e,t)=>{qo.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);yf.has(n)||(yf.add(n),bf(n,`format`,e=>t=>Xo(e,t)),bf(n,`flatten`,e=>t=>Yo(e,t)),bf(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ca,2)}),bf(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ca,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Sf=Qo(xf),Cf=$o(xf),wf=es(xf),Tf=ns(xf),Ef=cs(xf),Df=ls(xf),Of=us(xf),kf=ds(xf),Af=fs(xf),jf=ps(xf),Mf=ms(xf),Nf=hs(xf);function Pf(){zo.localeError||Bo(uu())}function Ff(){zo.memoizer||Bo({memoizer:su()})}var If=$(`ZodType`,(e,t)=>(Pf(),mc.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(Ia(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 Ka(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(tm(e,t))},superRefine(e,t){return this.check(nm(e,t))},overwrite(e){return this.check(cd(e))},optional(){return Lp(this)},exactOptional(){return zp(this)},nullable(){return Vp(this)},nullish(){return Lp(Vp(this))},nonoptional(e){return qp(this,e)},array(){return xp(this)},or(e){return Tp([this,e])},and(e){return kp(this,e)},transform(e){return Zp(this,Fp(e))},default(e){return Up(this,e)},prefault(e){return Gp(this,e)},catch(e){return Yp(this,e)},pipe(e){return Zp(this,e)},readonly(){return $p(this)},describe(e){let t=this.clone();return mu.add(t,{description:e}),t},meta(...e){if(e.length===0)return mu.get(this);let t=this.clone();return mu.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 So(this,`~standard`,{..._c(this),jsonSchema:{input:Nd(this,`input`),output:Nd(this,`output`)}})},set"~standard"(e){xo(this,`~standard`,e)},parse:function e(t,n){return Sf(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Cf(this,t,n,{callee:e})},safeParse(e,t){return wf(this,e,t)},async safeParseAsync(e,t){return Tf(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){xo(this,`spa`,e)},validate(e,t){return as(this,e,t)},validateAsync(e,t){return ss(this,e,t)},encode:function e(t,n){return Ef(this,t,n,{callee:e})},decode:function e(t,n){return Df(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Of(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await kf(this,t,n,{callee:e})},safeEncode(e,t){return Af(this,e,t)},safeDecode(e,t){return jf(this,e,t)},async safeEncodeAsync(e,t){return Mf(this,e,t)},async safeDecodeAsync(e,t){return Nf(this,e,t)},toJSONSchema(e){return Md(this,{})(e)},get description(){return mu.get(this)?.description},get _def(){return this._zod.def}}),Lf=$(`_ZodString`,(e,t)=>{vc.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yd(e,t,n,r)},Co({format:e=>Gd(e).format??null,minLength:e=>Gd(e).minimum??null,maxLength:e=>Gd(e).maximum??null},{regex(...e){return this.check(nd(...e))},includes(...e){return this.check(ad(...e))},startsWith(...e){return this.check(od(...e))},endsWith(...e){return this.check(sd(...e))},min(...e){return this.check(ed(...e))},max(...e){return this.check($u(...e))},length(...e){return this.check(td(...e))},nonempty(...e){return this.check(ed(1,...e))},lowercase(e){return this.check(rd(e))},uppercase(e){return this.check(id(e))},trim(){return this.check(ud())},normalize(...e){return this.check(ld(...e))},toLowerCase(){return this.check(dd())},toUpperCase(){return this.check(fd())},slugify(){return this.check(pd())}})),Rf=$(`ZodString`,(e,t)=>{vc.init(e,t),Lf.init(e,t)},{email(e){return this.check(_u(Gf,e))},url(e){return this.check(Cu(Jf,e))},jwt(e){return this.check(Ru(lp,e))},emoji(e){return this.check(wu(Yf,e))},guid(e){return this.check(vu(Kf,e))},uuid(e){return this.check(yu(qf,e))},uuidv4(e){return this.check(bu(qf,e))},uuidv6(e){return this.check(xu(qf,e))},uuidv7(e){return this.check(Su(qf,e))},nanoid(e){return this.check(Tu(Xf,e))},cuid(e){return this.check(Eu(Zf,e))},cuid2(e){return this.check(Du(Qf,e))},ulid(e){return this.check(Ou($f,e))},base64(e){return this.check(Fu(op,e))},base64url(e){return this.check(Iu(sp,e))},xid(e){return this.check(ku(ep,e))},ksuid(e){return this.check(Au(tp,e))},ipv4(e){return this.check(ju(np,e))},ipv6(e){return this.check(Mu(rp,e))},cidrv4(e){return this.check(Nu(ip,e))},cidrv6(e){return this.check(Pu(ap,e))},e164(e){return this.check(Lu(cp,e))},datetime(e){return this.check(zu(Vf,e))},date(e){return this.check(Bu(Hf,e))},time(e){return this.check(Vu(Uf,e))},duration(e){return this.check(Hu(Wf,e))}});function zf(e){return gu(Rf,e)}var Bf=$(`ZodStringFormat`,(e,t)=>{yc.init(e,t),Lf.init(e,t)}),Vf=$(`ZodISODateTime`,(e,t)=>{Rc.init(e,t),Bf.init(e,t)}),Hf=$(`ZodISODate`,(e,t)=>{zc.init(e,t),Bf.init(e,t)}),Uf=$(`ZodISOTime`,(e,t)=>{Bc.init(e,t),Bf.init(e,t)}),Wf=$(`ZodISODuration`,(e,t)=>{Vc.init(e,t),Bf.init(e,t)}),Gf=$(`ZodEmail`,(e,t)=>{Sc.init(e,t),Bf.init(e,t)}),Kf=$(`ZodGUID`,(e,t)=>{bc.init(e,t),Bf.init(e,t)}),qf=$(`ZodUUID`,(e,t)=>{xc.init(e,t),Bf.init(e,t)}),Jf=$(`ZodURL`,(e,t)=>{Ac.init(e,t),Bf.init(e,t)}),Yf=$(`ZodEmoji`,(e,t)=>{jc.init(e,t),Bf.init(e,t)}),Xf=$(`ZodNanoID`,(e,t)=>{Mc.init(e,t),Bf.init(e,t)}),Zf=$(`ZodCUID`,(e,t)=>{Nc.init(e,t),Bf.init(e,t)}),Qf=$(`ZodCUID2`,(e,t)=>{Pc.init(e,t),Bf.init(e,t)}),$f=$(`ZodULID`,(e,t)=>{Fc.init(e,t),Bf.init(e,t)}),ep=$(`ZodXID`,(e,t)=>{Ic.init(e,t),Bf.init(e,t)}),tp=$(`ZodKSUID`,(e,t)=>{Lc.init(e,t),Bf.init(e,t)}),np=$(`ZodIPv4`,(e,t)=>{Hc.init(e,t),Bf.init(e,t)}),rp=$(`ZodIPv6`,(e,t)=>{Gc.init(e,t),Bf.init(e,t)}),ip=$(`ZodCIDRv4`,(e,t)=>{Kc.init(e,t),Bf.init(e,t)}),ap=$(`ZodCIDRv6`,(e,t)=>{Jc.init(e,t),Bf.init(e,t)}),op=$(`ZodBase64`,(e,t)=>{Zc.init(e,t),Bf.init(e,t)}),sp=$(`ZodBase64URL`,(e,t)=>{el.init(e,t),Bf.init(e,t)}),cp=$(`ZodE164`,(e,t)=>{tl.init(e,t),Bf.init(e,t)}),lp=$(`ZodJWT`,(e,t)=>{rl.init(e,t),Bf.init(e,t)}),up=$(`ZodNumber`,(e,t)=>{il.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xd(e,t,n,r),e.isFinite=!0},Co({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Gd(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Gd(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Gd(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Gd(e).format??null},{gt(e,t){return this.check(Xu(e,t))},gte(e,t){return this.check(Zu(e,t))},min(e,t){return this.check(Zu(e,t))},lt(e,t){return this.check(Ju(e,t))},lte(e,t){return this.check(Yu(e,t))},max(e,t){return this.check(Yu(e,t))},int(e){return this.check(pp(e))},safe(e){return this.check(pp(e))},positive(e){return this.check(Xu(0,e))},nonnegative(e){return this.check(Zu(0,e))},negative(e){return this.check(Ju(0,e))},nonpositive(e){return this.check(Yu(0,e))},multipleOf(e,t){return this.check(Qu(e,t))},step(e,t){return this.check(Qu(e,t))},finite(){return this}}));function dp(e){return Uu(up,e)}var fp=$(`ZodNumberFormat`,(e,t)=>{al.init(e,t),up.init(e,t)});function pp(e){return Wu(fp,e)}var mp=$(`ZodBoolean`,(e,t)=>{ol.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zd(e,t,n,r)});function hp(e){return Gu(mp,e)}var gp=$(`ZodUnknown`,(e,t)=>{sl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function _p(){return Ku(gp)}var vp=$(`ZodNever`,(e,t)=>{cl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qd(e,t,n,r)});function yp(e){return qu(vp,e)}var bp=$(`ZodArray`,(e,t)=>{Ff(),fl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rf(e,t,n,r),e.element=t.element},{min(e,t){return this.check(ed(e,t))},nonempty(e){return this.check(ed(1,e))},max(e,t){return this.check($u(e,t))},length(e,t){return this.check(td(e,t))},unwrap(){return this.element}});function xp(e,t){return md(bp,e,t)}var Sp=$(`ZodObject`,(e,t)=>{Ff(),vl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>of(e,t,n,r),Ao(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return jp(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(Ia(this._zod.def,{catchall:e}))},passthrough(){return this.clone(Ia(this._zod.def,{catchall:_p()}))},loose(){return this.clone(Ia(this._zod.def,{catchall:_p()}))},strict(){return this.clone(Ia(this._zod.def,{catchall:yp()}))},strip(){return this.clone(Ia(this._zod.def,{catchall:void 0}))},extend(e){return to(this,e)},safeExtend(e){return ro(this,e)},merge(e){return io(this,e)},pick(e){return Qa(this,e)},omit(e){return eo(this,e)},partial(...e){return ao(Ip,this,e[0])},exactPartial(...e){return ao(Rp,this,e[0],`exactPartial`)},required(...e){return oo(Kp,this,e[0])}});function Cp(e,t){return new Sp({type:`object`,shape:e??{},...qa(t)})}var wp=$(`ZodUnion`,(e,t)=>{bl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sf(e,t,n,r),e.options=t.options});function Tp(e,t){return new wp({type:`union`,options:e,...qa(t)})}var Ep=$(`ZodDiscriminatedUnion`,(e,t)=>{wp.init(e,t),Sl.init(e,t)});function Dp(e,t,n){return new Ep({type:`union`,options:t,discriminator:e,...qa(n)})}var Op=$(`ZodIntersection`,(e,t)=>{Cl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cf(e,t,n,r)});function kp(e,t){return new Op({type:`intersection`,left:e,right:t})}var Ap=$(`ZodEnum`,(e,t)=>{El.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$d(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 Ap({...t,checks:[],...qa(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 Ap({...t,checks:[],...qa(r),entries:i})}});function jp(e,t){return new Ap({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...qa(t)})}var Mp=$(`ZodLiteral`,(e,t)=>{Dl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ef(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 Np(e,t){return new Mp({type:`literal`,values:Array.isArray(e)?e:[e],...qa(t)})}var Pp=$(`ZodTransform`,(e,t)=>{Ff(),Ol.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nf(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ro(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(yo(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(yo(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Fp(e){return new Pp({type:`transform`,transform:e})}var Ip=$(`ZodOptional`,(e,t)=>{Al.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lp(e){return new Ip({type:`optional`,innerType:e})}var Rp=$(`ZodExactOptional`,(e,t)=>{jl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zp(e){return new Rp({type:`optional`,innerType:e})}var Bp=$(`ZodNullable`,(e,t)=>{Ml.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Vp(e){return new Bp({type:`nullable`,innerType:e})}var Hp=$(`ZodDefault`,(e,t)=>{Nl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Up(e,t){return new Hp({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ua(t)}})}var Wp=$(`ZodPrefault`,(e,t)=>{Fl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gp(e,t){return new Wp({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Ua(t)}})}var Kp=$(`ZodNonOptional`,(e,t)=>{Il.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qp(e,t){return new Kp({type:`nonoptional`,innerType:e,...qa(t)})}var Jp=$(`ZodCatch`,(e,t)=>{zl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hf(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Yp(e,t){return new Jp({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Mo(t)})}var Xp=$(`ZodPipe`,(e,t)=>{Bl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gf(e,t,n,r),e.in=t.in,e.out=t.out});function Zp(e,t){return new Xp({type:`pipe`,in:e,out:t})}var Qp=$(`ZodReadonly`,(e,t)=>{Hl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_f(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $p(e){return new Qp({type:`readonly`,innerType:e})}var em=$(`ZodCustom`,(e,t)=>{Wl.init(e,t),If.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tf(e,t,n,r)});function tm(e,t={}){return hd(em,e,t)}function nm(e,t){return gd(e,t)}var rm=[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`],im={model:`gpt-6.1-sol`,reasoningEffort:`medium`,executorModel:`gpt-5.6-terra`,executorReasoningEffort:`high`,sandbox:`workspace-git`,approvalPolicy:`never`};function am(e,t){return e===`codex`&&t.includes(im.model)?im.model:t[0]??(e===`codex`?im.model:``)}Cp({workspaceId:zf().max(4096),skillProfile:zf().max(256),provider:jp([`codex`,`kimi`]),model:zf().min(1).max(256),reasoningEffort:jp(rm).default(im.reasoningEffort),executorModel:zf().trim().min(1).max(256).default(im.executorModel),executorReasoningEffort:jp(rm).default(im.executorReasoningEffort),sandbox:jp([`workspace-git`,`workspace-write`,`read-only`,`danger-full-access`]),approvalPolicy:jp([`untrusted`,`on-request`,`never`])}).strict();function om(e,t,n){return{workspaceId:e?.workspaceId??``,skillProfile:e?.skillProfile??``,provider:t,model:e?.provider===t?e.model:am(t,n),reasoningEffort:e?.reasoningEffort??im.reasoningEffort,executorModel:e?.executorModel??im.executorModel,executorReasoningEffort:e?.executorReasoningEffort??im.executorReasoningEffort,sandbox:e?.sandbox??im.sandbox,approvalPolicy:e?.approvalPolicy??im.approvalPolicy}}function sm(e){return e===`ready`?`Ready`:e===`stale`?`Stale`:e===`unavailable`?`Degraded`:`Unverified`}function cm(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 lm(e){return e.split(/[\\/]/).filter(Boolean).at(-1)?.replace(/[\u0000-\u001f\u007f]/g,``).slice(0,96)||`Repository`}var um=K(`<div class="svelte-1y2qpvc"><dt class="svelte-1y2qpvc">Serena connection</dt> <dd class="svelte-1y2qpvc"> </dd></div>`),dm=K(`<dl class="svelte-1y2qpvc"></dl>`),fm=K(`<small class="identity svelte-1y2qpvc">Observed <time> </time></small>`),pm=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>`),mm=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),hm=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>`),gm=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 _m(e,t){et(t,!0);let n=Q(t,`status`,3,null),r=Q(t,`loading`,3,!1),i=Q(t,`onrefresh`,3,()=>{}),a=I(()=>Array.isArray(n()?.repositories)?n().repositories:[]),o=I(()=>Array.isArray(n()?.connections)?n().connections.filter(e=>e.serverName===`gestalt-serena`):[]),s=I(()=>W(a).map(e=>cm(e.readiness))),c=I(()=>W(s).includes(`unavailable`)?`unavailable`:W(s).includes(`stale`)?`stale`:W(s).length&&W(s).every(e=>e===`ready`)?`ready`:`unknown`),l=I(()=>W(c)===`ready`?`Ready on observed source`:sm(W(c)));var u=gm(),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=dm();X(t,21,()=>W(o),e=>e.serverName,(e,t)=>{var n=um(),r=H(B(n),2),i=B(r,!0);P(r),P(n),U(e=>J(i,e),[()=>sm(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=mm(),n=V(t);X(n,21,()=>W(a),e=>`${e.threadId}:${e.readiness.repository?.id}`,(e,t)=>{let n=I(()=>[W(t).readiness.symbols?.observedAt,W(t).readiness.references?.observedAt].filter(e=>!!e).sort().at(-1));var r=pm(),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=fm(),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)},[()=>lm(W(t).readiness.repository?.label??`Repository`),()=>W(t).readiness.repository?.id.slice(0,8),()=>W(t).threadId.slice(0,8),()=>`${lm(W(t).readiness.repository?.label??`Repository`)} capability observations`,()=>sm(W(t).readiness.symbols?.state),()=>sm(W(t).readiness.references?.state),()=>sm(W(t).readiness.coverage?.state)]),q(e,r)}),P(n),F(2),q(e,t)},y=e=>{q(e,hm())};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),tt()}Ur([`click`]);var vm=K(`<img class="brand-icon brand-icon-custom" alt=""/>`),ym=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),bm=K(`<span class="session-model svelte-t9laac"><small> </small></span>`),xm=K(`<p class="session-path svelte-t9laac"> <!></p>`),Sm=K(`<span class="weekly-quota" aria-label="Weekly quota remaining"> </span>`),Cm=K(`<button class="detach-chat svelte-t9laac" type="button" aria-label="Open Chat in a separate window" title="Open Chat in a separate window"><!></button>`),wm=K(`<option> </option>`),Tm=K(`<button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="svelte-t9laac"><!> </button>`),Em=K(`<button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="svelte-t9laac"><!>Copy session to CLI</button>`),Dm=K(`<section class="menu-group svelte-t9laac"><h3 class="svelte-t9laac">Access</h3> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="svelte-t9laac"><!>Authorized devices</button> <button type="button" class="lock-relay svelte-t9laac" popovertarget="configuration-panel" popovertargetaction="hide"><!>Lock Gestalt Mobile</button></section>`),Om=K(`<small class="svelte-t9laac"> </small>`),km=K(` <!>`,1),Am=K(`<div><dt class="svelte-t9laac"> </dt> <dd> <!></dd></div>`),jm=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>`),Mm=K(`<p id="clean-tmp-status" role="status" class="svelte-t9laac">Cleaning temporary files…</p>`),Nm=K(`<p role="status" class="svelte-t9laac">Updating and waiting for Mobile to reconnect…</p>`),Pm=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" title="Open configuration"><!></button></div></header> <div id="configuration-panel" class="configuration-panel" popover="auto"><div class="configuration-brand svelte-t9laac"><h2 class="svelte-t9laac">Configuration</h2> <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>Appearance</span> <select id="appearance" aria-label="Appearance"></select></label> <section class="menu-group svelte-t9laac"><h3 class="svelte-t9laac">Workspace</h3> <!> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="svelte-t9laac"><!>Notifications</button> <button type="button" popovertarget="configuration-panel" popovertargetaction="hide" class="svelte-t9laac"><!>Scratchpad</button> <!></section> <!> <!> <!> <div class="maintenance-actions svelte-t9laac"><h3 class="svelte-t9laac">Maintenance</h3> <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 Fm(e,t){et(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=Pm(),se=V(oe),ce=B(se),le=B(ce),ue=e=>{var t=vm();U(()=>Z(t,`src`,a())),q(e,t)},de=e=>{var t=ym();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=xm(),i=B(t,!0),a=H(i),o=e=>{var t=bm(),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=Sm(),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=Cm();sa(B(n),{name:`external`}),P(n),G(`click`,n,function(...e){t.ondetach?.apply(this,e)}),q(e,n)};Y(ge,e=>{t.ondetach&&e(_e)});var ve=H(ge,2);sa(B(ve),{name:`menu`}),P(ve),Zi(ve,e=>z(x,e),()=>W(x)),P(pe),P(se);var ye=H(se,2),be=H(B(ye),2),xe=H(B(be),2);X(xe,21,()=>ua,e=>e.id,(e,t)=>{var n=wm(),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(xe);var Se;Pi(xe),P(be);var j=H(be,2),M=H(B(j),2);X(M,17,d,e=>e.id,(e,t)=>{var n=Tm(),r=B(n),i=e=>{sa(e,{name:`debug`})};Y(r,e=>{W(t).id===`debug`&&e(i)});var a=H(r,1,!0);P(n),U(()=>J(a,W(t).label)),G(`click`,n,function(...e){W(t).run?.apply(this,e)}),q(e,n)});var Ce=H(M,2);sa(B(Ce),{name:`bell`}),F(),P(Ce);var we=H(Ce,2);sa(B(we),{name:`note`}),F(),P(we);var Te=H(we,2),Ee=e=>{var n=Em();sa(B(n),{name:`cli`}),F(),P(n),U(()=>n.disabled=!b()),G(`click`,n,function(...e){t.oncopytocli?.apply(this,e)}),q(e,n)};Y(Te,e=>{t.oncopytocli&&e(Ee)}),P(j);var De=H(j,2),Oe=e=>{var t=Dm(),n=H(B(t),2);sa(B(n),{name:`devices`}),F(),P(n);var r=H(n,2);sa(B(r),{name:`lock`}),F(),P(r),P(t),G(`click`,n,e=>p()(e.currentTarget)),G(`click`,r,function(...e){f()?.apply(this,e)}),q(e,t)};Y(De,e=>{o()&&e(Oe)});var ke=H(De,2),Ae=e=>{_m(e,{get status(){return t.retrieval},get loading(){return c()},get onrefresh(){return l()}})};Y(ke,e=>{t.retrieval!==void 0&&e(Ae)});var je=H(ke,2),Me=e=>{var t=jm(),n=H(B(t),2);X(n,21,s,e=>e.id,(e,t)=>{var n=Am();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=km(),r=V(n),i=H(r),a=e=>{var n=Om(),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=Ai(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=Ai(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(je,e=>{s().length&&e(Me)});var Ne=H(je,2),Pe=H(B(Ne),2);sa(B(Pe),{name:`clean`}),F(),P(Pe);var Fe=H(Pe,2),Ie=e=>{q(e,Mm())};Y(Fe,e=>{_()&&e(Ie)});var Le=H(Fe,2);sa(B(Le),{name:`upgrade`}),F(),P(Le);var Re=H(Le,2);sa(B(Re),{name:`power`}),F(),P(Re),P(Ne),P(ye),Zi(ye,e=>z(S,e),()=>W(S));var ze=H(ye,2),Be=H(B(ze),4),N=B(Be);Zi(N,e=>z(w,e),()=>W(w));var Ve=H(N,2),He=B(Ve,!0);P(Ve),P(Be),P(ze),Zi(ze,e=>z(C,e),()=>W(C));var Ue=H(ze,2),We=H(B(Ue),4),Ge=e=>{q(e,Nm())};Y(We,e=>{W(O)&&e(Ge)});var Ke=H(We,2),qe=B(Ke);Zi(qe,e=>z(D,e),()=>W(D));var Je=H(qe,2),Ye=B(Je,!0);P(Je),P(Ke),P(Ue),Zi(Ue,e=>z(E,e),()=>W(E)),U(()=>{Se!==(Se=t.theme)&&(xe.value=(xe.__value=t.theme)??``,Ni(xe,t.theme)),Pe.disabled=_()||W(O)||W(T),Z(Pe,`aria-busy`,_()),Z(Pe,`aria-describedby`,_()?`clean-tmp-status`:void 0),Le.disabled=_()||W(O)||W(T),Re.disabled=_()||W(O),Z(ze,`aria-busy`,W(T)),N.disabled=W(T),Ve.disabled=W(T),J(He,W(T)?`Quitting…`:`Quit`),Z(Ue,`aria-busy`,W(O)),qe.disabled=W(O),Je.disabled=W(O),J(Ye,W(O)?`Upgrading…`:`Upgrade and restart`)}),Hr(`toggle`,ye,e=>u()(e.newState===`open`)),G(`change`,xe,e=>t.onthemechange(e.currentTarget.value)),G(`click`,Ce,function(...e){m()?.apply(this,e)}),G(`click`,we,function(...e){h()?.apply(this,e)}),G(`click`,Pe,()=>void k()),G(`click`,Le,ee),G(`click`,Re,ne),Hr(`cancel`,ze,e=>W(T)?e.preventDefault():ae()),Hr(`close`,ze,ae),G(`click`,N,ie),G(`click`,Ve,()=>void re()),Hr(`cancel`,Ue,e=>W(O)?e.preventDefault():ae()),Hr(`close`,Ue,ae),G(`click`,qe,()=>W(E)?.close()),G(`click`,Je,()=>void te()),q(e,oe),tt()}Ur([`click`,`change`]);var Im=K(`<summary><!></summary>`),Lm=K(`<button><!> <!></button>`);function Rm(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=$r(),u=V(l),d=e=>{var n=Im();vi(B(n),()=>t.children??b),P(n),U(()=>{Z(n,`id`,t.id),Ai(n,1,wi([`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=Lm();let l;var u=B(n),d=e=>{sa(e,{get name(){return t.icon}})};Y(u,e=>{t.icon&&e(d)}),vi(H(u,2),()=>t.children??b),P(n),U(e=>{Z(n,`id`,t.id),Z(n,`type`,r()),n.disabled=i(),l=Ai(n,1,wi([`app-control`,t.class,{compact:a(),full:o(),primary:s(),accentPressed:c()}]),`svelte-6ey372`,l,e),Z(n,`title`,t.tooltip??(t.icon?t.label:void 0)),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)},[()=>({"icon-only":!!t.icon})]),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)}Ur([`click`]);async function zm(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 Bm(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 Vm=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Hm(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 ${Vm(t.removed,`temporary folder`)} in ${Vm(n.removed,`workspace`)}.`):o.push(!a&&!t.skipped?`No temporary folders to remove.`:`No temporary folders removed.`),r.protected&&o.push(`Kept ${Vm(r.protected,`protected folder`)}.`);let s=Math.max(0,t.skipped-r.protected);s&&o.push(`Skipped ${Vm(s,`other folder`)}.`);let c=o.length;t.failed&&o.push(`Could not remove ${Vm(t.failed,`folder`)}.`),n.unavailable&&o.push(`Could not check ${Vm(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 ${Bm(d,t.failed)}.`,{kind:l,message:o.join(` `),history:{message:u,details:d}}}function Um(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 Wm=K(`<div class="svelte-vx755z"><dt class="svelte-vx755z"> </dt> <dd class="svelte-vx755z"> </dd></div>`),Gm=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 Km(e,t){et(t,!0);var n=Gm(),r=H(B(n),2);X(r,21,()=>Um(t.context),([e,t])=>e,(e,t)=>{var n=I(()=>T(W(t),2));let r=()=>W(n)[0],i=()=>W(n)[1];var a=Wm(),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=Wm(),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),tt()}var qm=K(`<p class="report svelte-f06alb"> </p>`),Jm=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>`),Ym=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 Xm(e,t){et(t,!0);let n,r,i=R(!1);ta(()=>{n.showModal(),r.focus()});async function a(){if(!W(i)){z(i,!0);try{await t.onconfirm()}catch{}finally{z(i,!1)}}}var o=Ym(),s=H(B(o),4);Km(s,{get context(){return t.confirmation.context}});var c=H(s,2),l=e=>{var n=Jm(),r=H(B(n),2),i=B(r,!0);P(r);var a=H(r,2),o=e=>{var n=qm(),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);Zi(d,e=>r=e,()=>r);var f=H(d,2),p=B(f,!0);P(f),P(u),P(o),Zi(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`)}),Hr(`cancel`,o,e=>{W(i)&&e.preventDefault()}),Hr(`close`,o,function(...e){t.onclose?.apply(this,e)}),G(`click`,d,()=>n.close()),G(`click`,f,()=>void a()),q(e,o),tt()}Ur([`click`]);function Zm(e,t,n){return n?e.filter(e=>e.tab===t&&e.available(n)):[]}var Qm=[`context-mode`,`gestalt-context-mode`,`gestalt-serena`],$m=[`artifact`,`spawn`,`initialize`,`startup`],eh=[`artifact-unavailable`,`process-exited`,`protocol-rejected`,`timeout`,`reauthentication-required`,`startup-failed`,`cancelled`],th=[`SIGHUP`,`SIGINT`,`SIGQUIT`,`SIGABRT`,`SIGKILL`,`SIGSEGV`,`SIGTERM`];function nh(e){return typeof e==`string`&&/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/.test(e)?e:null}function rh(e,t){return typeof t==`string`&&e.includes(t)}function ih(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 ah(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=nh(t.failureId),r=nh(t.attemptId),i=ih(t.occurredAt);if(!(t.schemaVersion!==1||!n||!r||!i||!rh(Qm,t.serverName)||!rh($m,t.phase)||!rh(eh,t.code)))return{schemaVersion:1,failureId:n,attemptId:r,occurredAt:i,threadId:nh(t.threadId),serverName:t.serverName,phase:t.phase,code:t.code,runtimeId:nh(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:rh(th,t.signal)?t.signal:null}}function oh(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=e,n=nh(t.runtimeId),r=nh(t.attemptId),i=t.threadId===null?null:nh(t.threadId),a=ih(t.observedAt);if(t.schemaVersion!==1||!n||!r||!a||t.threadId!==null&&!i||!rh(Qm,t.serverName)||!rh([`starting`,`ready`,`failed`,`cancelled`],t.status))return;let o=ah(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 sh(e){return e===`gestalt-serena`?`Serena`:`Context Mode`}function ch(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 lh(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 uh(e){return e.reduce((e,t)=>{let n=dh(t);return n?.kind===`Command`?(n.status===`completed`&&(e.successful+=1),n.status===`failed`&&(e.failed+=1),e):e},{successful:0,failed:0})}function dh(e){let t=oh(e.mcpStartup);if(t)return{kind:sh(t.serverName),status:t.status,content:``,startup:t};if(fh(e))return null;let[n,r]=e.label.split(` · `,2);return{kind:n,...r?{status:r}:{},content:ph(n,e.detail)}}function fh(e){return e.label.startsWith(`Tool`)&&(e.detail.includes(`context_mode`)||/(^|[_:])ctx_[a-z]/i.test(e.detail))}function ph(e,t){return e===`Command`?mh(t):e===`File change`||e===`fileChange`?t.split(`
|
|
65
|
+
`).filter(Boolean).join(`, `):t}function mh(e){let t=e.match(/^\/bin\/bash -lc "([\s\S]*)"$/);return t?t[1].replace(/\\"/g,`"`).replace(/\\\\/g,`\\`):e}var hh=K(`<p class="secondary svelte-18dzom7">Codex did not expose a finer startup phase. No underlying cause is established.</p>`),gh=K(`<p class="secondary svelte-18dzom7">Codex did not expose child exit or signal details.</p>`),_h=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),vh=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),yh=K(`<p class="svelte-18dzom7">Startup is in progress. Readiness has not been established.</p>`),bh=K(`<section class="startup-details svelte-18dzom7"><!></section>`);function xh(e,t){et(t,!0);var n=bh(),r=B(n),i=e=>{var n=_h(),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,hh())};Y(f,e=>{t.startup.failure.phase===`startup`&&e(p)});var m=H(f,2),h=e=>{q(e,gh())};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`)},[()=>ch(t.startup.failure.code),()=>lh(t.startup.serverName)]),q(e,n)},a=e=>{var t=vh();F(2),q(e,t)},o=e=>{q(e,yh())};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),[()=>`${sh(t.startup.serverName)} startup`]),q(e,n),tt()}var Sh=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>`),Ch=K(`<span class="activity-content svelte-thyolt"> </span>`),wh=K(`<li class="activity-row svelte-thyolt"><small class="activity-type svelte-thyolt"> </small> <!></li>`),Th=K(`<ul class="activity-list svelte-thyolt"></ul>`),Eh=K(`<details class="chat-activity svelte-thyolt"><summary class="svelte-thyolt">activity</summary> <!> <!></details>`),Dh=K(`<section class="live-activity svelte-thyolt" aria-label="Current activity"><strong class="svelte-thyolt">activity</strong> <!> <!></section>`);function Oh(e,t){et(t,!0);let n=e=>{var t=Sh(),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=$r(),n=V(t),r=e=>{var t=Th();X(t,21,()=>W(c),e=>e.id,(e,t)=>{var n=wh(),r=B(n),i=B(r);P(r);var a=H(r,2),o=e=>{xh(e,{get startup(){return W(t).startup}})},s=e=>{var n=Ch(),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=I(()=>t.activities.flatMap(e=>{let t=dh(e);return t&&t.kind.toLowerCase().replaceAll(` `,``)!==`filechange`?[{id:e.id,...t}]:[]})),o=I(()=>W(a).some(e=>e.kind===`Command`)),s=I(()=>uh(t.activities)),c=I(()=>W(a).filter(e=>e.kind!==`Command`));var l=$r(),u=V(l),d=e=>{var t=$r(),a=V(t),s=e=>{var t=Eh(),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=Dh(),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),tt()}var kh=e=>({working:`working`,idle:`idle`,awaitingAgent:`waiting for child`,awaitingHuman:`needs you`,blocked:`blocked`,disconnected:`disconnected`})[e];function Ah(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 ${kh(t.root.state)}; subagents ${kh(t.aggregateSubagents)}.`:``,critical:r&&(!e||e.root.state!==t.root.state)?`l0 ${kh(t.root.state)}.`:``}}function jh(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 Mh=K(`<p class="agent-progress svelte-d9jh4j"> </p>`),Nh=K(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j"> </strong> <span class="agent-metadata svelte-d9jh4j"> </span> <!> <time class="svelte-d9jh4j"> </time></li>`),Ph=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>`),Fh=K(`<details class="agents svelte-d9jh4j"><!> <ul class="svelte-d9jh4j"><!></ul></details>`),Ih=K(`<li class="svelte-d9jh4j"><strong class="svelte-d9jh4j"> </strong> <!> <time class="svelte-d9jh4j"> </time></li>`),Lh=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>`),Rh=K(`<p class="visually-hidden svelte-d9jh4j" role="alert"> </p>`),zh=K(`<p class="visually-hidden svelte-d9jh4j" aria-live="polite" aria-atomic="true"> </p> <!>`,1),Bh=K(`<section aria-label="Agent activity"><!> <!></section>`);function Vh(e,t){et(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(ln(Date.now())),f=I(()=>t.activity?`${t.activity.sessionId}:${t.activity.root.state}:${t.activity.aggregateSubagents}`:``),p=I(()=>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=I(()=>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=I(()=>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)}}ta(()=>{let e=window.setInterval(()=>z(d,Date.now(),!0),6e4);return()=>window.clearInterval(e)});function S(e,t){let n=jh(t,W(d));return e===`idle`||e===`disconnected`?`${o[e]} since ${n}`:`${o[e]} · active ${n} ago`}Fn(()=>{if(!W(f))return;let e=Mr(()=>t.activity),n=Mr(()=>u);if(!e)return;let r=Ah(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=Bh();let w;var T=B(C),E=e=>{var n=Fh(),r=B(n);Rm(r,{element:`summary`,compact:!0,full:!0,get state(){return W(p)},children:(e,n)=>{F();var r=Qr();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=$r();X(V(t),17,()=>W(y),e=>e.key,(e,t)=>{var n=Nh(),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=Mh(),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=Ph(),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),xi(i,()=>x),P(n),Hr(`toggle`,n,e=>e.currentTarget.open&&a()()),q(e,n)},D=e=>{var n=Lh(),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=Ih(),r=B(n),i=B(r,!0);P(r);var a=H(r),s=H(a),c=e=>{var n=Mh(),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(),()=>jh(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=zh(),n=V(t),r=B(n,!0);P(n);var i=H(n,2),a=e=>{var t=Rh(),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=Ai(C,1,`agent-activity svelte-d9jh4j`,null,w,{compact:n(),"align-start":r()===`start`})),q(e,C),tt()}var Hh=K(`<p class="svelte-1x1zevi">Some events could not be attributed to an agent and are excluded.</p>`),Uh=K(`<p class="svelte-1x1zevi">Observation retention is limited. Additional calls are excluded.</p>`),Wh=K(`<div class="svelte-1x1zevi"><dt class="svelte-1x1zevi"> </dt> <dd class="svelte-1x1zevi"> <small class="svelte-1x1zevi"> </small></dd></div>`),Gh=K(`<div class="svelte-1x1zevi"><dt class="svelte-1x1zevi"> </dt> <dd class="svelte-1x1zevi"> </dd></div>`),Kh=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>`),qh=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),Jh=K(`<p class="svelte-1x1zevi">No measured tool calls yet. Older activity and calls without correlation may have no
|
|
70
|
+
measurements.</p>`),Yh=K(`<p class="scope svelte-1x1zevi">Last observation <time> </time></p>`),Xh=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 Zh(e,t){et(t,!0);let n=Q(t,`snapshot`,3,null),r=Q(t,`activity`,3,null),i=I(()=>n()?.sessionId===t.sessionId?n():null),a={command:`Commands`,mcp:`MCP tools`,contextMode:`Context-mode`,executionWrapper:`Execution wrappers`,dynamic:`Dynamic tools`,collaboration:`Collaboration`},o=I(()=>[...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=Xh(),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,Hh())};Y(v,e=>{W(i)?.missingCorrelation&&e(y)});var b=H(v,2),x=e=>{q(e,Uh())};Y(b,e=>{W(i)?.retentionLimited&&e(x)});var S=H(b,2),C=e=>{var t=qh(),n=V(t);X(n,21,()=>W(i).groups,e=>JSON.stringify([e.runtimeId,e.threadId,e.actor,e.family]),(e,t)=>{var n=Kh(),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=Wh(),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=Gh(),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,Jh())};Y(S,e=>{W(i)?.groups.length?e(C):e(w,-1)});var T=H(S,2),E=e=>{var t=Yh(),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),tt()}var Qh=K(`<main class="svelte-iw6wrs"><h1 class="svelte-iw6wrs">Activity evidence</h1> <!><!></main>`);function $h(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=Qh(),i=H(B(r),2);Vh(i,{get activity(){return t}}),X(H(i),1,()=>n,e=>e,(e,n)=>{{let r=Dt(()=>({...t,sessionId:W(n),confidence:W(n)===`blocked`?`stale`:`fresh`,root:{...t.root,state:W(n)},aggregateSubagents:W(n)}));Vh(e,{get activity(){return W(r)}})}}),P(r),q(e,r)}function eg(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 tg(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 ng=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)&&eg(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`&&eg(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),eg(r.agentActivity,e)&&this.#m(e,a,r.agentActivity),this.#h(e,r.toolEfficiency),this.#d.onAuthoritativeSnapshot?.(e,r)}else i===n&&(eg(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=tg(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 rg(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 ig={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 ag(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 og(e){let t=Object.hasOwn(ig,e.code)?ig[e.code]:`Codex reported an execution failure with no known description.`;return`${e.code}${e.httpStatusCode?` (HTTP ${e.httpStatusCode})`:``}: ${t}`}function sg(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 cg(e){if(typeof e!=`string`||!e.trim())return;let t=e.trim();return t.length<=4e3?t:`${t.slice(0,3999)}…`}var lg=`Checkpoint handoff failed. Autopilot is reconnecting this session automatically. If it cannot recover, restore or reopen the session.`,ug=`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 dg(e){return!!(e?.enabled&&e.state===`monitoring`&&e.reason===`reconcileFailed`&&e.health?.healthy!==!0)}var fg=(e,t=600)=>typeof e==`string`&&e.length<=t,pg=e=>fg(e,64)&&!Number.isNaN(Date.parse(e));function mg(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)&&fg(t.updatedAt,64)&&(t.reason===void 0||fg(t.reason,80))&&(t.providerFailure===void 0||!!ag(t.providerFailure))&&(t.providerRetry===void 0||!!sg(t.providerRetry))&&(t.nextEvaluationAt===void 0||fg(t.nextEvaluationAt,64))&&(t.health===void 0||hg(t.health))}function hg(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||pg(n.resumeAt))&&pg(t.observedAt)&&pg(t.lastTransitionAt)&&fg(t.nextExpectedAction)&&(t.degradationReason===void 0||[`missingContinuation`,`invalidWaitLease`,`controllerUnavailable`,`staleTransition`,`planMismatch`].includes(t.degradationReason))}function gg(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 fg(t.requestId,256)&&(t.turnId===null||fg(t.turnId,256))&&(t.requestedAt===null||fg(t.requestedAt,64))&&(t.supervisorReport===void 0||fg(t.supervisorReport,4e3))&&fg(r.reason,64)&&fg(r.summary)&&fg(r.requestedAction)&&fg(r.resumeCondition,64)&&(r.executorReplacement===void 0||_g(r.executorReplacement))}function _g(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 vg(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.kind===`orgPlanAttention`&&gg({requestId:t.requestId,turnId:t.turnId??null,requestedAt:t.requestedAt??null,attention:t.payload,supervisorReport:t.supervisorReport})}function yg(e){return{requestId:e.requestId,turnId:e.turnId,requestedAt:e.requestedAt,attention:e.payload,...e.supervisorReport?{supervisorReport:e.supervisorReport}:{}}}var bg=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.`},xg=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=rg){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=cg(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),mg(i.autopilot)&&!i.autopilot.enabled&&this.#t.delete(e))}catch(t){this.#m(e,n)&&this.#o.get(e)===r&&this.#r.set(e,bg(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){mg(t)&&(this.#e.set(e,t),t.providerFailure?this.#i.set(e,og(t.providerFailure)):t.health?.phase===`checkpointRecovery`?this.#i.set(e,lg):dg(t)?this.#i.set(e,ug):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(gg(t))this.#t.set(e,t);else if(vg(t))this.#t.set(e,yg(t));else if(Array.isArray(t)){let n=t.find(vg);n?this.#t.set(e,yg(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])})}},Sg=K(`<span class="state-mark svelte-1qf1ppf" aria-hidden="true">!</span>`),Cg=K(`<span class="enabled-mark svelte-1qf1ppf" aria-hidden="true"></span>`),wg=K(`<div class="control-row svelte-1qf1ppf"><span class="status svelte-1qf1ppf"><span aria-hidden="true" class="svelte-1qf1ppf"> </span> </span> <!></div>`),Tg=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 Eg(e,t){et(t,!0);let n=Q(t,`controlId`,3,`autopilot-control`),r=Q(t,`compact`,3,!1),i=Q(t,`pending`,3,!1),a=Q(t,`ontoggle`,3,()=>{}),o={disabled:`Off`,monitoring:`Monitoring`,backoff:`Waiting to continue`,attentionRequired:`Paused for attention`,completed:`Complete`,safetyPaused:`Safety paused`},s={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`},c={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:lg},l=I(()=>t.autopilot?t.autopilot.health?s[t.autopilot.health.phase]:o[t.autopilot.state]:`Unavailable`),u=I(()=>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),d=I(()=>(t.autopilot?.reason?c[t.autopilot.reason]:null)??W(u)??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.`)),f=I(()=>`Autopilot status: ${W(l)}. ${W(d)}`),p=I(()=>t.autopilot?.enabled??!1),m=I(()=>t.autopilot?.state===`safetyPaused`||t.autopilot?.health?.phase===`degraded`);var h=Tg();let g;var _=B(h),v=B(_,!0);P(_);var y=H(_,2),b=e=>{{let r=I(()=>`${n()}-button`),o=I(()=>i()||t.autopilot?.state===`backoff`?`waiting`:`autopilot`),s=I(()=>`Autopilot: ${i()?`Updating`:W(l)}`),c=I(()=>`${n()}-help`);Rm(e,{get id(){return W(r)},compact:!0,get icon(){return W(o)},get pressed(){return W(p)},accentPressed:!0,get label(){return W(s)},get describedby(){return W(c)},get ariaDisabled(){return i()},onclick:()=>{i()||a()(!W(p))},children:(e,n)=>{var r=$r(),i=V(r),a=e=>{q(e,Sg())},o=e=>{q(e,Cg())};Y(i,e=>{W(m)||t.autopilot?.state===`attentionRequired`?e(a):W(p)&&e(o,1)}),q(e,r)},$$slots:{default:!0}})}},x=e=>{var r=wg(),o=B(r),s=B(o),c=B(s,!0);P(s);var u=H(s);P(o);var d=H(o,2);{let e=I(()=>`${n()}-button`),t=I(()=>`${n()}-help`);Rm(d,{get id(){return W(e)},get pressed(){return W(p)},get describedby(){return W(t)},get ariaDisabled(){return i()},onclick:()=>{i()||a()(!W(p))},children:(e,t)=>{F();var n=Qr();U(()=>J(n,i()?`Updating…`:W(p)?`Pause`:`Enable`)),q(e,n)},$$slots:{default:!0}})}P(r),U(()=>{Z(o,`data-state`,t.autopilot?.state??`unavailable`),J(c,W(p)?`●`:`○`),J(u,` Autopilot: ${W(l)??``}`)}),q(e,r)};Y(y,e=>{r()?e(b):e(x,-1)});var S=H(y,2);let C;var w=B(S,!0);P(S),P(h),U(()=>{g=Ai(h,1,`autopilot-control svelte-1qf1ppf`,null,g,{compact:r(),"has-error":r()&&W(m)}),J(v,W(f)),Z(S,`id`,`${n()}-help`),C=Ai(S,1,`svelte-1qf1ppf`,null,C,{"visually-hidden":r()}),J(w,W(d))}),q(e,h),tt()}var Dg=K(`<p class="svelte-yp6bgs"> </p>`),Og=K(`<p class="svelte-yp6bgs"> </p> <p class="svelte-yp6bgs"> </p>`,1),kg=K(`<button type="button" class="svelte-yp6bgs"> </button>`),Ag=K(`<section role="alert"><h3 class="svelte-yp6bgs"> </h3> <!> <div class="actions svelte-yp6bgs"><!> <button type="button" class="svelte-yp6bgs"> </button></div></section>`);function jg(e,t){et(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=I(()=>t.autopilot?.providerFailure),c=I(()=>!!(W(s)&&[`disabled`,`completed`].includes(t.autopilot?.state??``))),l=I(()=>t.autopilot?.providerRetry?.pending??!1),u=I(()=>W(s)?og(W(s)):t.autopilot?.reason&&!t.attention?o[t.autopilot.reason]??null:null),d=I(()=>dg(t.autopilot)),f=I(()=>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=$r(),m=V(p),h=e=>{var t=Ag();let o;var p=B(t),m=B(p,!0);P(p);var h=H(p,2),g=e=>{var t=Dg(),n=B(t,!0);P(t),U(()=>J(n,ug)),q(e,t)},_=e=>{var t=Og(),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=kg(),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=Ai(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),tt()}Ur([`click`]);function Mg(e,t=`gestalt-mobile.autopilot-attention-toasts.v1`,n=100){let r=Ng(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 Ng(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 Pg=100*1024*1024,Fg=[{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 Ig(e){let t=e.match(/^\/([^\s]*)$/);return t?t[1].toLowerCase():null}function Lg(e){let t=Ig(e);return t===null?[]:Fg.filter(e=>e.name.startsWith(t))}function Rg(e){let t=e.match(/^\/([^\s]+)\s*$/)?.[1]?.toLowerCase();return Fg.find(e=>e.name===t)?.argumentPicker}function zg(e){return[...e].sort((e,t)=>Bg(t,e)||t.localeCompare(e))}function Bg(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 Vg=K(` <span class="block-cursor svelte-1264sfg" aria-hidden="true"></span>`,1),Hg=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),Ug=K(`<p id="writer-hint" class="writer-hint svelte-1264sfg"> </p>`),Wg=K(`<button type="button" class="svelte-1264sfg">Retry send</button>`),Gg=K(`<div class="writer-feedback svelte-1264sfg" role="alert" aria-atomic="true"><p class="svelte-1264sfg"> </p> <!></div>`),Kg=K(`<li><button type="button" class="svelte-1264sfg"><code class="svelte-1264sfg"> </code> <small class="svelte-1264sfg"> </small></button></li>`),qg=K(`<ul id="chat-command-completion" class="command-menu svelte-1264sfg" aria-label="Chat commands"></ul>`),Jg=K(`<li class="svelte-1264sfg"><button type="button" class="svelte-1264sfg"><code class="svelte-1264sfg"> </code></button></li>`),Yg=K(`<ul class="command-menu svelte-1264sfg" aria-label="Available models"></ul>`),Xg=K(`<ul class="command-menu svelte-1264sfg" aria-label="Reasoning efforts"></ul>`),Zg=K(`<button type="button" class="svelte-1264sfg">Upload files</button>`),Qg=K(`<button type="button" class="svelte-1264sfg">Queue message</button> <button type="button" class="svelte-1264sfg">Interrupt and send</button>`,1),$g=K(`<button type="button" class="svelte-1264sfg">Interrupt</button>`),e_=K(`<div id="prompt-action-panel" class="action-panel svelte-1264sfg" aria-label="Prompt actions"><!> <!></div>`),t_=K(`<div class="prompt-action svelte-1264sfg"><button type="button" aria-label="Choose prompt action" aria-controls="prompt-action-panel" class="svelte-1264sfg"><!></button> <!></div>`),n_=K(`<button type="button" aria-label="Upload files" title="Upload files" class="svelte-1264sfg"><!></button>`),r_=K(`<button type="button" class="svelte-1264sfg"><!></button>`),i_=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 a_(e,t){et(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(ln(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=I(()=>{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`});ta(()=>{let e=setInterval(()=>{z(m,Date.now(),!0)},3e4);return()=>clearInterval(e)});let D=R(0),O=R(null),k=R(!1),ee=I(()=>Lg(t.message)),te=I(()=>Ig(t.message)),ne=I(()=>W(te)!==null&&W(te)!==W(O)&&W(ee).length>0),re=I(()=>Rg(t.message)),ie=I(()=>W(re)===`models`),ae=I(()=>zg(s())),oe=I(()=>W(re)===`reasoning`),se=I(()=>!t.activeTurnId&&!t.starting&&!W(h)&&!!t.message.trim()),ce=I(()=>!!t.message.trim()),le=I(()=>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=i_();let me;var he=B(pe),ge=B(he),_e=e=>{var t=Vg(),n=V(t);F(),U(()=>J(n,`${W(E)??``} `)),q(e,t)},ve=e=>{var n=Qr();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=Hg(),n=V(t);Zi(n,e=>z(_,e),()=>W(_));var r=H(n,2),i=B(r),a=e=>{q(e,Qr(`Uploading files…`))},o=e=>{var t=Qr();U(()=>J(t,`Drop files to upload · ${Pg/1024/1024} MiB per file`)),q(e,t)},s=e=>{var t=Qr();U(()=>J(t,`Upload or drop files · ${Pg/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=Ug(),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),M=e=>{var n=Gg(),r=B(n),i=B(r,!0);P(r);var s=H(r,2),c=e=>{var n=Wg();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(M)});var Ce=H(j,2),we=e=>{var t=qg();X(t,23,()=>W(ee),e=>e.name,(e,t,n)=>{var r=Kg(),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(()=>{Ai(r,1,wi(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(Ce,e=>{W(ne)&&e(we)});var Te=H(Ce,2),Ee=e=>{var t=Yg();X(t,20,()=>W(ae),e=>e,(e,t)=>{var n=Jg(),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(Te,e=>{W(ie)&&e(Ee)});var De=H(Te,2),Oe=e=>{var t=Xg();X(t,20,()=>[`low`,`medium`,`high`],e=>e,(e,t)=>{var n=Jg(),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(De,e=>{W(oe)&&e(Oe)});var ke=H(De,2),Ae=B(ke);Tn(Ae);let je;var Me=H(Ae,2),Ne=e=>{var n=t_(),r=B(n);sa(B(r),{name:`more`,size:`1.35rem`}),P(r);var i=H(r,2),a=e=>{var n=e_(),r=B(n),i=e=>{var t=Zg();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=Qg(),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=$g();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)},Pe=e=>{var t=n_();sa(B(t),{name:`upload`,size:`1.35rem`}),P(t),U(()=>t.disabled=W(h)),G(`click`,t,v),q(e,t)},Fe=e=>{var n=r_();sa(B(n),{name:`send`,size:`1.35rem`}),P(n),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(Me,e=>{t.activeTurnId?e(Ne):!W(ce)&&t.onuploadfiles?e(Pe,1):e(Fe,-1)}),P(ke),P(pe),U(()=>{Z(pe,`aria-busy`,t.starting||W(h)),me=Ai(pe,1,`svelte-1264sfg`,null,me,{"drag-over":W(g)>0}),Z(he,`aria-label`,t.status===`Ready.`&&n()!=null?W(E):t.status),Hi(Ae,t.message),Z(Ae,`aria-describedby`,i()?`writer-hint`:void 0),je=Ai(Ae,1,`svelte-1264sfg`,null,je,{"new-empty":r()})}),Hr(`dragenter`,pe,S),Hr(`dragover`,pe,C),Hr(`dragleave`,pe,w),Hr(`drop`,pe,T),G(`input`,Ae,e=>de(e.currentTarget.value)),G(`keydown`,Ae,fe),q(e,pe),tt()}Ur([`change`,`click`,`input`,`keydown`]);function o_(e){return[...e].map(e=>({file:e,status:e.size>104857600?`too-large`:`queued`}))}function s_(e){return e.findIndex(e=>e.status===`queued`)}var c_=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],l_=[`difference`,`intersection`,`symmetricDifference`,`union`],u_=!1,d_=class e extends Set{#e=new Map;#t=R(0);#n=R(0);#r=br||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}u_||this.#a()}#i(e){return br===this.#r?R(e):nn(e)}#a(){u_=!0;var t=e.prototype,n=Set.prototype;for(let e of c_)t[e]=function(...t){return W(this.#t),n[e].apply(this,t)};for(let r of l_)t[r]=function(...t){W(this.#t);var i=n[r].apply(this,t);return new e(i)}}has(e){var t=super.has(e),n=this.#e,r=n.get(e);if(r===void 0){if(!t)return W(this.#t),!1;r=this.#i(!0),n.set(e,r)}return W(r),t}add(e){return super.has(e)||(super.add(e),z(this.#n,super.size),sn(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),z(r,!1)),t&&(z(this.#n,super.size),sn(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())z(t,!1);e.clear(),z(this.#n,0),sn(this.#t)}}keys(){return this.values()}values(){return W(this.#t),super.values()}entries(){return W(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return W(this.#n)}};function f_(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(...p_(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(...p_(i)),t}function p_(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:__(i)})};for(let e=0;e<n.length;e+=1){let a=m_(n[e]??``);if(a){i(e),t.push({kind:`heading`,level:a.level,parts:__(a.text)}),r=e+1;continue}if(e===n.length-1)continue;let o=h_(n[e]??``),s=h_(n[e+1]??``);if(!o||!s||o.length!==s.length||!s.every(g_))continue;i(e),e+=2;let c=[];for(;e<n.length;){let t=h_(n[e]??``);if(!t||t.length!==o.length)break;c.push(t),e+=1}t.push({kind:`table`,headers:o.map(__),rows:c.map(e=>e.map(__))}),r=e,--e}return i(n.length),t.length?t:[{kind:`text`,parts:__(e)}]}function m_(e){let t=/^ {0,3}(#{1,6})[ \t]+(.+?)[ \t]*#*[ \t]*$/.exec(e);return t?{level:t[1].length,text:t[2]??``}:null}function h_(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 g_(e){return/^:?-{3,}:?$/.test(e)}function __(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:__(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 v_(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 y_(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=v_(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 b_(e,t=!0){return y_(e,t)?.path??null}var x_=/^(.*\.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 w_(e,t){let n=S_(e),r=S_(t),i=n?x_.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 T_(e){let t=S_(e);if(!t)return!1;let n=x_.exec(t);return!!(n&&C_(n[1]??``))}async function E_(e,t=globalThis.navigator?.clipboard,n=O_){if(!t)return D_(e,n);try{return await t.writeText(e),!0}catch{return D_(e,n)}}function D_(e,t){try{return t(e)}catch{return!1}}function O_(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 k_=K(`<a class="svelte-1p5tlta"> </a>`),A_=K(`<a target="_blank" rel="noreferrer" class="svelte-1p5tlta"> </a>`),j_=K(`<code class="svelte-1p5tlta"> </code>`),M_=K(`<strong class="svelte-1p5tlta"><!></strong>`),N_=K(`<div class="code-block svelte-1p5tlta"><button class="code-copy svelte-1p5tlta" type="button" title="Copy code"><!></button> <pre class="svelte-1p5tlta"><code class="svelte-1p5tlta"> </code></pre></div>`),P_=K(`<th scope="col" class="svelte-1p5tlta"><!></th>`),F_=K(`<td class="svelte-1p5tlta"><!></td>`),I_=K(`<tr></tr>`),L_=K(`<div class="table-scroll svelte-1p5tlta"><table class="svelte-1p5tlta"><thead><tr></tr></thead><tbody></tbody></table></div>`),R_=K(`<h1 class="svelte-1p5tlta"><!></h1>`),z_=K(`<h2 class="svelte-1p5tlta"><!></h2>`),B_=K(`<h3 class="svelte-1p5tlta"><!></h3>`),V_=K(`<h4 class="svelte-1p5tlta"><!></h4>`),H_=K(`<h5 class="svelte-1p5tlta"><!></h5>`),U_=K(`<h6 class="svelte-1p5tlta"><!></h6>`),W_=K(`<div class="svelte-1p5tlta"><!></div>`),G_=K(`<div class="message-content svelte-1p5tlta"></div>`);function K_(e,t){et(t,!0);let n=(e,r=b)=>{var i=$r();X(V(i),17,r,ci,(e,r)=>{var i=$r(),o=V(i),s=e=>{var n=$r(),i=V(n),o=e=>{var t=k_(),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=I(()=>t.onopenorg&&T_(W(r).href)),c=e=>{var n=k_(),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=y_(W(r).href);n.line?t.onopenfile?.(n.path,n.line):t.onopenfile?.(n.path)}),q(e,n)},l=I(()=>t.onopenfile&&b_(W(r).href)),u=e=>{var t=A_(),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=j_(),n=B(t,!0);P(t),U(()=>J(n,W(r).text)),q(e,t)},l=e=>{var t=M_(),i=B(t);n(i,()=>W(r).parts),P(t),q(e,t)},u=e=>{var t=Qr();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||!T_(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 E_(e,i()))}var c=G_();X(c,21,()=>f_(t.text),ci,(e,t)=>{var r=$r(),i=V(r),a=e=>{var n=N_(),r=B(n);sa(B(r),{name:`copy`,size:`1rem`}),P(r);var 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=L_(),i=B(r),a=B(i),o=B(a);X(o,21,()=>W(t).headers,ci,(e,t)=>{var r=P_(),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,ci,(e,t)=>{var r=I_();X(r,21,()=>W(t),ci,(e,t)=>{var r=F_(),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=$r(),i=V(r),a=e=>{var r=R_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},o=e=>{var r=z_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},s=e=>{var r=B_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},c=e=>{var r=V_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},l=e=>{var r=H_(),i=B(r);n(i,()=>W(t).parts),P(r),q(e,r)},u=e=>{var r=U_(),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=W_(),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),tt()}Ur([`click`]);var q_=K(`<time> </time>`),J_=K(`<div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Supervisor explanation</dt> <dd class="supervisor-report svelte-1hnxk0w"><!></dd></div>`),Y_=K(`<div class="svelte-1hnxk0w"><dt class="svelte-1hnxk0w">Supervisor explanation</dt> <dd class="svelte-1hnxk0w"> </dd></div>`),X_=K(`<button type="button" class="svelte-1hnxk0w"> </button>`),Z_=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),Q_=K(`<p>This request is no longer pending.</p>`),$_=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 ev(e,t){et(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=I(()=>t.attention?.attention.summary.startsWith(`Supervised execution requires human attention (`)),d=I(()=>W(s).trim().length>600?`Guidance must be 600 characters or fewer.`:``);var f=$r(),p=V(f),m=e=>{var f=$_(),p=B(f),m=B(p,!0);P(p);var h=H(p,2),g=e=>{var n=q_(),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=q_(),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=I(()=>W(u)?`The supervisor has paused work and needs your help to continue.`:t.attention.attention.summary);K_(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=J_(),r=H(B(n),2);K_(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=Y_(),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=I(()=>W(u)?`Resolve the blocker or describe a way forward below, then choose Resume. You can also disable Autopilot.`:t.attention.attention.requestedAction);K_(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=Z_(),c=V(i),l=H(c,2);Tn(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=X_(),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)]),qi(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,Q_())};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),tt()}Ur([`click`]);var tv=[`planChange`,`hardBlock`,`missingDependency`,`permissionRequired`,`externalState`,`materialAmbiguity`],nv=[`userGuidance`,`planRevision`,`dependencyInstalled`,`permissionGranted`,`externalStateChanged`],rv={planChange:`planRevision`,hardBlock:`externalStateChanged`,missingDependency:`dependencyInstalled`,permissionRequired:`permissionGranted`,externalState:`externalStateChanged`,materialAmbiguity:`userGuidance`};function iv(e){if(!lv(e))return null;let t=Object.keys(e);if(t.length===2&&t.every(e=>e===`reason`||e===`resumeCondition`)&&ov(e.reason)&&sv(e.resumeCondition)&&rv[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=av(e.executorReplacement);return!ov(e.reason)||!cv(e.summary,600)||!cv(e.requestedAction,600)||!sv(e.resumeCondition)||rv[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 av(e){return!lv(e)||Object.keys(e).length!==1?null:typeof e.canonicalTaskName==`string`&&/^l[1-9][0-9]*$/.test(e.canonicalTaskName)?{canonicalTaskName:e.canonicalTaskName}:null}function ov(e){return typeof e==`string`&&tv.includes(e)}function sv(e){return typeof e==`string`&&nv.includes(e)}function cv(e,t){return typeof e==`string`&&e.trim().length>0&&e.length<=t}function lv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uv(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 dv(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 fv(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 pv(e){return new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`}).format(e)}function mv(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 hv=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>`),gv=K(`<li data-status="failed" class="svelte-11ye6aj"><code class="svelte-11ye6aj"> </code></li>`),_v=K(`<section aria-label="Failed commands"><strong>Failed commands</strong> <ul class="activity-list svelte-11ye6aj"></ul></section>`),vv=K(`<span class="svelte-11ye6aj"> </span>`),yv=K(`<li class="svelte-11ye6aj"><small class="svelte-11ye6aj"> </small> <!></li>`),bv=K(`<ul class="activity-list svelte-11ye6aj" aria-label="Work activity"></ul>`),xv=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>`),wv=K(`<section aria-label="Files changed"><strong>Files changed</strong> <ul class="file-list svelte-11ye6aj"></ul></section>`),Tv=K(`<details class="work-details svelte-11ye6aj"><summary class="svelte-11ye6aj"> </summary> <div class="work-details-content svelte-11ye6aj"><!> <!> <!> <!></div></details>`);function Ev(e,t){et(t,!0);let n=Q(t,`now`,19,()=>Date.now()),r=I(()=>uh(t.activities)),i=I(()=>t.activities.flatMap(e=>{let t=dh(e);return t?.kind===`Command`&&t.status===`failed`?[{id:e.id,command:t.content}]:[]})),a=I(()=>uv(t.activities)),o=I(()=>dv(W(a))),s=I(()=>t.activities.flatMap(e=>{let t=dh(e);return t&&t.kind!==`Command`&&t.kind!==`File change`?[{id:e.id,...t}]:[]})),c=I(()=>t.activities.length),l=I(()=>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=$r(),d=V(u),f=e=>{var t=Tv(),o=B(t),c=B(o,!0);P(o);var u=H(o,2),d=B(u),f=e=>{var t=hv(),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=_v(),n=H(B(t),2);X(n,21,()=>W(i),e=>e.id,(e,t)=>{var n=gv(),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=bv();X(t,21,()=>W(s),e=>e.id,(e,t)=>{var n=yv(),r=B(n),i=B(r);P(r);var a=H(r,2),o=e=>{xh(e,{get startup(){return W(t).startup}})},s=e=>{var n=vv(),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=wv(),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=xv(),i=B(r,!0);P(r),U((e,t)=>{Z(r,`datetime`,e),J(i,t)},[()=>new Date(W(t).touchedAt).toISOString(),()=>mv(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),tt()}function Dv(e){if(!e||typeof e!=`object`)return null;let t=e.command;return typeof t==`string`&&t.trim()?t:null}function Ov(e){if(!kv(e))return null;let t=e.changes;if(!Array.isArray(t))return null;let n=t.map(e=>kv(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 kv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Av=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>`),jv=K(`<label class="custom svelte-77f3gb">Your custom answer <input required="" class="svelte-77f3gb"/></label>`),Mv=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),Nv=K(`<fieldset class="svelte-77f3gb"><legend class="svelte-77f3gb"><strong> </strong></legend> <!> <div class="choices svelte-77f3gb"><!> <!></div></fieldset>`),Pv=K(`<form class="quiz-form svelte-77f3gb"><fieldset class="questions svelte-77f3gb"></fieldset> <button type="submit">Send answers</button></form>`);function Fv(e,t){et(t,!0);let n=Q(t,`disabled`,3,!1),r=ln({}),i=ln({}),a=I(()=>t.quiz.questions.every(e=>!!t.answers[e.id]?.trim()));async function o(e){i[e]=!0,t.onanswer(e,t.answers[e]??``),await kr(),r[e]?.focus()}var s=Pv(),c=B(s);X(c,21,()=>t.quiz.questions,e=>e.id,(e,n)=>{let a=I(()=>`${t.requestId}-${W(n).id}-custom`),s=I(()=>W(n).choices.some(e=>e.label===t.answers[W(n).id]));var c=Nv(),l=B(c),u=B(l),d=B(u,!0);P(u),P(l);var f=H(l,2);K_(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=I(()=>`${t.requestId}-${W(n).id}-${W(r).label}`);var o=Av(),s=B(o);Vi(s);var c=H(s,2),l=B(c),u=B(l,!0);P(l),P(c);var d=H(c,2);K_(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`),Ui(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=Mv(),l=V(c),u=B(l);Vi(u);var d=H(u,2);P(l);var f=H(l,2),p=e=>{var i=jv(),o=H(B(i));Vi(o),Zi(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`),Hi(o,t.answers[W(n).id])}),G(`input`,o,e=>t.onanswer(W(n).id,e.currentTarget.value)),q(e,i)},m=I(()=>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}`),Ui(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)}),Hr(`submit`,s,e=>{e.preventDefault(),W(a)&&t.onsubmit()}),q(e,s),tt()}Ur([`change`,`click`,`input`]);function Iv(e,t=2){if(!Uv(e)||!Array.isArray(e.questions)||e.questions.length<1||e.questions.length>8)return null;let n=e.questions.map(e=>zv(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 Lv(e){return!Uv(e)||!Array.isArray(e.questions)||e.questions.length>3?null:Iv({questions:e.questions.map(e=>Uv(e)?{id:e.id,header:e.header,question:e.question,choices:e.options,allowCustom:e.isOther===!0,isSecret:e.isSecret===!0}:e)},1)}function Rv(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 zv(e,t){if(!Uv(e)||!Array.isArray(e.choices)||e.choices.length<t||e.choices.length>5||!Vv(e.id)||!Hv(e.header,120)||!Hv(e.question,600)||typeof e.allowCustom!=`boolean`)return null;let n=e.choices.map(Bv);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 Bv(e){return!Uv(e)||!Hv(e.label,160)||!Hv(e.description,600)?null:{label:e.label,description:e.description}}function Vv(e){return typeof e==`string`&&/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(e)}function Hv(e,t){return typeof e==`string`&&e.trim().length>0&&e.length<=t}function Uv(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Wv=K(`<time> </time>`),Gv=K(`<!> <p class="interaction-result svelte-ajsqcq" data-interaction-state="resolved" tabindex="-1"> </p> <!>`,1),Kv=K(`<p class="interaction-submitting svelte-ajsqcq" data-interaction-state="submitting">Submitting…</p>`),qv=K(`<p>Codex sent an invalid quiz request.</p>`),Jv=K(`<p>Grant the requested permissions for this turn only.</p> <button type="button">Approve</button>`,1),Yv=K(`<pre class="command-approval-command svelte-ajsqcq"><code> </code></pre>`),Xv=K(`<p class="command-approval-missing svelte-ajsqcq">Command details were not provided.</p>`),Zv=K(`<p>Approve this command?</p> <!> <div class="approval-actions svelte-ajsqcq"><button type="button">Approve</button> <button type="button">Deny</button></div>`,1),Qv=K(`<li><code> </code></li>`),$v=K(`<ul class="file-change-approval-targets svelte-ajsqcq" aria-label="Files to change"></ul>`),ey=K(`<p class="file-change-approval-missing svelte-ajsqcq">File details were not provided.</p>`),ty=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),ny=K(`<button type="button">Approve</button><button type="button">Deny</button>`,1),ry=K(`<p class="interaction-failed svelte-ajsqcq" data-interaction-state="failed">Could not send. Try again.</p> <button type="button">Retry</button>`,1),iy=K(`<!> <!> <!>`,1),ay=K(`<li class="svelte-ajsqcq"><div class="submitted-question svelte-ajsqcq"><strong> </strong> <!></div> <div class="submitted-answer svelte-ajsqcq"><!></div></li>`),oy=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>`),sy=K(`<article tabindex="-1"><p class="interaction-kind svelte-ajsqcq"> </p> <!> <!></article>`);function cy(e,t){et(t,!0);let n=Q(t,`submittedAnswers`,19,()=>({})),r=Q(t,`onretry`,3,()=>{}),i=R(null),a=ln({}),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()}Fn(()=>{let e=t.interactions.find(e=>e.requestId===W(i));e?.state===`resolved`&&(kr().then(()=>a[e.requestId]?.focus()),z(i,null))});var c=$r();X(V(c),17,()=>t.interactions,e=>e.key??e.requestId,(e,i)=>{let c=I(()=>W(i).state===`submitting`);var l=sy();let u;var d=B(l),f=B(d,!0);P(d);var p=H(d,2),m=e=>{var r=Gv(),o=V(r),s=e=>{var t=Wv(),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),Zi(c,(e,t)=>a[t.requestId]=e,e=>a?.[e.requestId],()=>[W(i)]);var u=H(c,2),d=e=>{let n=I(()=>W(i).kind===`quiz`?Iv(W(i).payload):W(i).kind===`userInput`?Lv(W(i).payload):null);var r=$r();X(V(r),17,()=>W(n)?.questions??[],e=>e.id,(e,n)=>{K_(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=iy(),l=V(a),u=e=>{q(e,Kv())};Y(l,e=>{W(c)&&e(u)});var d=H(l,2),f=e=>{let r=I(()=>W(i).kind===`quiz`?Iv(W(i).payload):Lv(W(i).payload));var a=$r(),l=V(a),u=e=>{},d=e=>{{let n=I(()=>o(W(i).requestId));Fv(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,qv())};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=Jv(),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=I(()=>Dv(W(i).payload));var r=Zv(),a=H(V(r),2),o=e=>{var t=Yv(),r=B(t),i=B(r,!0);P(r),P(t),U(()=>J(i,W(n))),q(e,t)},l=e=>{q(e,Xv())};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=I(()=>Ov(W(i).payload));var r=ty(),a=H(V(r),2),o=e=>{var t=$v();X(t,20,()=>W(n),e=>e,(e,t)=>{var n=Qv(),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,ey())};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=ny(),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=ry();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=oy(),a=H(B(r),2);X(a,21,()=>n()[W(i).requestId],e=>e.id,(e,n)=>{var r=ay(),i=B(r),a=B(i),o=B(a,!0);P(a),K_(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);K_(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=Ai(l,1,`svelte-ajsqcq`,null,u,{resolved:W(i).state===`resolved`}),J(f,W(i).kind)}),q(e,l)}),q(e,c),tt()}Ur([`click`]);var ly=K(`<aside class="pending-requests pending-dialogues svelte-10cj0sh" aria-label="Pending chat requests"><!></aside>`);function uy(e,t){var n=ly();vi(B(n),()=>t.children),P(n),q(e,n)}function dy(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 fy(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 py(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 my(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=py(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 hy(e){return[`Submitted quiz answers:`,...e.map(e=>`- ${e.header} — ${e.question}\n ${e.answer.trim().replaceAll(`
|
|
78
|
+
`,`
|
|
79
|
+
`)}`)].join(`
|
|
80
|
+
`)}function gy(e){return![`orgPlanAttention`,`orgPlanCheckpoint`,`autopilotWaitLease`].includes(e.kind)}function _y(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`?Iv(e.payload):e.kind===`userInput`?Lv(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(hy(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 vy(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 yy(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var by=yy();function xy(e){by=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 wy(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(Ey.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Ty=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Ey={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}}(?:</?(?:${Vy})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:Cy(e=>RegExp(`^ {0,${e}}>`))},Dy=/^(?:[ \t]*(?:\n|$))+/,Oy=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,ky=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ay=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,jy=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,My=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ny=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Py=wy(Ny).replace(/bull/g,My).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(),Fy=wy(Ny).replace(/bull/g,My).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(),Iy=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Ly=/^[^\n]+/,Ry=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,zy=wy(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Ry).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),By=wy(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,My).getRegex(),Vy=`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`,Hy=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Uy=wy(`^ {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`,Hy).replace(`tag`,Vy).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Wy=e=>wy(Iy).replace(`hr`,Ay).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`,Vy).getRegex(),Gy=Wy(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Ky=Wy(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),qy={blockquote:wy(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Ky).getRegex(),code:Oy,def:zy,fences:ky,heading:jy,hr:Ay,html:Uy,lheading:Py,list:By,newline:Dy,paragraph:Gy,table:Sy,text:Ly},Jy=wy(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ay).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`,Vy).getRegex(),Yy={...qy,lheading:Fy,table:Jy,paragraph:wy(Iy).replace(`hr`,Ay).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Jy).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`,Vy).getRegex()},Xy={...qy,html:wy(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Hy).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:wy(Iy).replace(`hr`,Ay).replace(`heading`,` *#{1,6} *[^
|
|
87
|
+
]`).replace(`lheading`,Py).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},Zy=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Qy=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,$y=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,eb=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,tb=/[\p{P}\p{S}]/u,nb=/[\s\p{P}\p{S}]/u,rb=/[^\s\p{P}\p{S}]/u,ib=wy(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,nb).getRegex(),ab=/[\p{Pi}\p{Ps}"']/u,ob=/(?!~)[\p{P}\p{S}]/u,sb=/(?!~)[\s\p{P}\p{S}]/u,cb=/(?:[^\s\p{P}\p{S}]|~)/u,lb=wy(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Ty?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),ub=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,db=wy(ub,`u`).replace(/punct/g,tb).getRegex(),fb=wy(ub,`u`).replace(/punct/g,ob).getRegex(),pb=wy(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,ab).replace(/punct/g,tb).getRegex(),mb=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,hb=wy(mb,`gu`).replace(/notPunctSpace/g,rb).replace(/punctSpace/g,nb).replace(/punct/g,tb).getRegex(),gb=wy(mb,`gu`).replace(/notPunctSpace/g,cb).replace(/punctSpace/g,sb).replace(/punct/g,ob).getRegex(),_b=wy(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,rb).replace(/punctSpace/g,nb).replace(/punct/g,tb).getRegex(),vb=wy(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,rb).replace(/punctSpace/g,nb).replace(/punct/g,tb).getRegex(),yb=wy(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,rb).replace(/punctSpace/g,nb).replace(/punct/g,tb).getRegex(),bb=wy(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,tb).getRegex(),xb=wy(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,rb).replace(/punctSpace/g,nb).replace(/punct/g,tb).getRegex(),Sb=wy(/\\(punct)/,`gu`).replace(/punct/g,tb).getRegex(),Cb=wy(/^<(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(),wb=wy(Hy).replace(`(?:-->|$)`,`-->`).getRegex(),Tb=wy(`^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`,wb).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Eb=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Db=wy(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Eb).getRegex(),Ob=wy(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Db).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),kb=wy(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Db).replace(`ref`,Ry).getRegex(),Ab=wy(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ry).getRegex(),jb=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Mb=wy(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Eb).getRegex(),Nb=wy(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,wy(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Mb).replace(`ref`,jb).getRegex()).replace(`nolink`,wy(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,jb).getRegex()).getRegex(),Pb=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Fb=wy(/(?: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(),Ib={_backpedal:Sy,anyPunctuation:Sb,autolink:Cb,blockSkip:lb,br:$y,code:Qy,del:Sy,delLDelim:Sy,delRDelim:Sy,emStrongLDelim:db,emStrongRDelimAst:hb,emStrongRDelimUnd:vb,escape:Zy,link:Ob,nolink:Ab,punctuation:ib,reflink:kb,reflinkSearch:Nb,tag:Tb,text:eb,url:Sy},Lb={...Ib,emStrongLDelim:pb,emStrongRDelimAst:_b,emStrongRDelimUnd:yb,link:wy(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Db).getRegex(),reflink:wy(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Db).getRegex()},Rb={...Ib,emStrongRDelimAst:gb,emStrongLDelim:fb,delLDelim:bb,delRDelim:xb,url:wy(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Fb).replace(`protocol`,Pb).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:wy(/^(?:[^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`,Pb).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},zb={...Rb,br:wy($y).replace(`{2,}`,`*`).getRegex(),text:wy(Rb.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Bb={normal:qy,gfm:Yy,pedantic:Xy},Vb={normal:Ib,gfm:Rb,breaks:zb,pedantic:Lb},Hb={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ub=e=>Hb[e];function Wb(e,t){if(t){if(Ey.escapeTest.test(e))return e.replace(Ey.escapeReplace,Ub)}else if(Ey.escapeTestNoEncode.test(e))return e.replace(Ey.escapeReplaceNoEncode,Ub);return e}function Gb(e){return e.replace(Ey.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 Kb(e){try{e=encodeURI(e).replace(Ey.percentDecode,`%`)}catch{return null}return e}function qb(e,t){let n=e.replace(Ey.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Ey.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(Ey.slashPipe,`|`);return n}function Jb(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 Yb(e){let t=e.split(`
|
|
88
|
+
`),n=t.length-1;for(;n>=0&&Ey.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
89
|
+
`)}function Xb(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function Zb(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 Qb(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 $b(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 ex(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 tx(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 nx=class{options;rules;lexer;constructor(e){this.options=e||by}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]:Yb(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=ex(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=Jb(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Jb(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:Jb(t[0],`
|
|
93
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Jb(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?Qb(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>Qb(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=Yb(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=Xb(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:Jb(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=qb(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:Jb(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(qb(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:Jb(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&&tx(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=Jb(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=Zb(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)),$b(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&&tx(e,n[1],r,this.rules))return;let i=t[Xb((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 $b(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]:Gb(t[0]),escaped:e}}}},rx=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||by,this.options.tokenizer=this.options.tokenizer||new nx,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:Ey,block:Bb.normal,inline:Vb.normal};this.options.pedantic?(t.block=Bb.pedantic,t.inline=Vb.pedantic):this.options.gfm&&(t.block=Bb.gfm,this.options.breaks?t.inline=Vb.breaks:t.inline=Vb.gfm),this.tokenizer.rules=t}static get rules(){return{block:Bb,inline:Vb}}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(Ey.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(Ey.tabCharGlobal,` `).replace(Ey.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,Xb(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,Xb(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)}},ix=class{options;parser;constructor(e){this.options=e||by}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Ey.notSpaceStart)?.[0],i=e?e.replace(Ey.endingNewline,``)+`
|
|
134
|
+
`:``;return r?`<pre><code class="language-`+Wb(r)+`">`+(n?i:Wb(i,!0))+`</code></pre>
|
|
135
|
+
`:`<pre><code>`+(n?i:Wb(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>${Wb(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?Wb(n,!0):this.parser.parseInline(r),o=Kb(e);if(o===null)return a;e=Wb(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Wb(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=Kb(e);if(i===null)return Wb(n);e=i;let a=`<img src="${Wb(e)}" alt="${Wb(n)}"`;return t&&(a+=` title="${Wb(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Wb(e.text)}},ax=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}},ox=class e{options;renderer;textRenderer;constructor(e){this.options=e||by,this.options.renderer=this.options.renderer||new ix,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new ax}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}},sx=class{options;block;constructor(e){this.options=e||by}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?rx.lex:rx.lexInline}provideParser(e=this.block){return e?ox.parse:ox.parseInline}},cx=new class{defaults=yy();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ox;Renderer=ix;TextRenderer=ax;Lexer=rx;Tokenizer=nx;Hooks=sx;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 ix(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 nx(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 sx;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];sx.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&sx.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 rx.lex(e,t??this.defaults)}parser(e,t){return ox.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?rx.lex:rx.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?ox.parse:ox.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?rx.lex:rx.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?ox.parse:ox.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>`+Wb(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function lx(e,t){return cx.parse(e,t)}lx.options=lx.setOptions=function(e){return cx.setOptions(e),lx.defaults=cx.defaults,xy(lx.defaults),lx},lx.getDefaults=yy,lx.defaults=by;function ux(...e){return cx.use(...e),lx.defaults=cx.defaults,xy(lx.defaults),lx}lx.use=ux,lx.walkTokens=function(e,t){return cx.walkTokens(e,t)},lx.parseInline=cx.parseInline,lx.Parser=ox,lx.parser=ox.parse,lx.Renderer=ix,lx.TextRenderer=ax,lx.Lexer=rx,lx.lexer=rx.lex,lx.Tokenizer=nx,lx.Hooks=sx,lx.parse=lx,lx.options,lx.setOptions,lx.walkTokens,lx.parseInline,ox.parse,rx.lex;function dx(e){let t=[],n=0,r=null;for(let i of rx.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 fx=K(`<div class="working-content svelte-1wpqicu"></div>`);function px(e,t){et(t,!0);let n=I(()=>dx(t.text));var r=fx();X(r,21,()=>W(n),e=>e.offset,(e,n)=>{K_(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),tt()}var mx=K(`<time class="svelte-1im954t"> </time>`),hx=K(`<span class="touch-unknown svelte-1im954t">time unknown</span>`),gx=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>`),_x=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>`),vx=K(`<!> <!>`,1),yx=K(`<div class="entry-heading svelte-1im954t"><strong>working</strong></div> <!> <!>`,1),bx=K(`<li class="progress-item svelte-1im954t"><section><!></section></li>`),xx=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>`),wx=K(`<time class="svelte-1im954t"> <!></time>`),Tx=K(`<section><!></section>`),Ex=K(`<div class="entry-heading svelte-1im954t"><strong>prompt</strong> <!></div> <div class="entry-content svelte-1im954t"><!></div> <!>`,1),Dx=K(`<div class="answer-tools svelte-1im954t"><button type="button" class="mode-switch svelte-1im954t" role="switch" aria-label="Raw answer text"><span class="mode-track svelte-1im954t" aria-hidden="true"><span>View</span><span>Raw</span></span></button> <button type="button" class="copy-answer svelte-1im954t" aria-label="Copy answer" title="Copy answer"><!></button></div>`),Ox=K(`<div class="commentary-content live-commentary svelte-1im954t" data-reading-order="newest-first"><!></div>`),kx=K(`<div class="entry-content svelte-1im954t"><!></div> <!> <!> <!>`,1),Ax=K(`<button class="commentary-toggle svelte-1im954t" type="button"><span aria-hidden="true"> </span> commentary</button>`),jx=K(`<div class="answer-history svelte-1im954t"><!></div>`),Mx=K(`<div class="commentary-content svelte-1im954t" data-reading-order="top-down"><!></div>`),Nx=K(`<pre class="raw-answer svelte-1im954t"><code> </code></pre>`),Px=K(`<div class="entry-content svelte-1im954t"><!></div> <!>`,1),Fx=K(`<section class="answer-turn svelte-1im954t"><div><strong> </strong> <!> <!></div> <!> <!> <!></section>`),Ix=K(`<div class="entry-content svelte-1im954t"><!></div>`),Lx=K(`<section class="progress-turn svelte-1im954t" data-reading-order="newest-first" aria-label="Working, newest paragraphs first"><div class="entry-heading svelte-1im954t"><strong>working</strong> <!></div> <!> <!> <!></section>`),Rx=K(`<li><!></li>`),zx=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>`),Bx=K(`<!> <ol aria-label="Chat messages" class="svelte-1im954t"><!> <!> <!></ol> <!>`,1);function Vx(e,t){et(t,!0);let n=(e,t=b)=>{let n=I(()=>uv(t())),r=I(()=>dv(W(n)));var i=$r(),a=V(i),o=e=>{var t=_x(),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=gx(),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=mx(),r=B(n,!0);P(n),U((e,t)=>{Z(n,`datetime`,e),J(r,t)},[()=>new Date(W(t).touchedAt).toISOString(),()=>mv(W(t).touchedAt,W(te))]),q(e,n)},f=e=>{q(e,hx())};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)=>{K_(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)=>{px(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=I(()=>t.activities.filter(e=>!fy(e))),C=I(()=>{let e=vy(t.messages);if(!c()||e.some(e=>e.kind===`audit`&&e.attention?.requestId===c().requestId))return e;let n=iv(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=I(()=>W(C).flatMap(e=>e.kind===`audit`&&e.attention?[O(e.attention)]:[])),T=I(()=>s().filter(e=>gy(e)&&e.state!==`resolved`)),E=new Set;Ln(()=>{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)&&kr().then(()=>document.getElementById(t)?.focus({preventScroll:!0}));E=e});let D=I(()=>{let e=vy(_y(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=>gy(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:cg(i?.text??a?.text);return{...e,...o?{supervisorReport:o}:{}}}let k=ln({}),ee=new d_,te=R(ln(Date.now()));ta(()=>{let e=globalThis.setInterval(()=>z(te,Date.now(),!0),1e3);return()=>globalThis.clearInterval(e)});let ne=I(()=>W(C).filter(e=>e.kind===`user`)),re=I(()=>W(D).filter(e=>e.kind===`assistant`).toReversed()),ie=I(()=>W(re).at(-1)?.id),ae=I(()=>new Map(W(re).filter(e=>e.turnId).map(e=>[e.turnId,e.id]))),oe=I(()=>new Map(W(ne).filter(e=>e.turnId).map(e=>[e.turnId,e.id])));function se(e){if(e.turnId){let t=W(ae).get(e.turnId);if(t)return t}return e.occurredAt===void 0?W(ie)??null:W(re).find(t=>t.answer!==null&&t.occurredAt!==void 0&&t.occurredAt>=e.occurredAt)?.id??null}function ce(e){if(e.turnId){let t=W(oe).get(e.turnId);if(t)return t}return e.occurredAt===void 0?null:W(ne).findLast(t=>t.occurredAt!==void 0&&t.occurredAt<=e.occurredAt)?.id??null}let le=I(()=>{let e=new Map;for(let t of W(S)){let n=se(t)??ce(t),r=e.get(n);r?r.push(t):e.set(n,[t])}return e}),ue=I(()=>W(le).get(null)??[]);function de(e){return e.filter(e=>!e.label.toLowerCase().replaceAll(` `,``).startsWith(`filechange`))}function A(e){return!!(e.kind===`assistant`&&a()&&(e.turnId===a()||!e.turnId&&e.id===W(ie)))}function fe(e){return!!(e.kind===`user`&&a()&&(e.turnId===a()||!e.turnId))}function pe(e,t){return fv(W(D)[e+1]?.occurredAt,t)}var me=Bx(),he=V(me),ge=e=>{uy(e,{children:(e,n)=>{var r=vx(),i=V(r),a=e=>{{let n=I(()=>O(c())),r=I(()=>`chat-attention-${c().requestId}`);ev(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)}),cy(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(he,e=>{(c()||W(T).length)&&e(ge)});var _e=H(he,2),ve=B(_e),ye=e=>{var t=bx(),r=B(t),i=B(r),o=e=>{var t=yx(),r=H(V(t),2);{let e=I(()=>de(W(ue)));Oh(r,{get activities(){return W(e)},variant:`live`})}var i=H(r,2);n(i,()=>W(ue)),q(e,t)},s=e=>{Ev(e,{get activities(){return W(ue)},get now(){return W(te)}})};Y(i,e=>{a()?e(o):e(s,-1)}),P(r),P(t),U(()=>Ai(r,1,wi(a()?`progress-turn`:`orphan-activity-turn`),`svelte-1im954t`)),q(e,t)};Y(ve,e=>{W(ue).length&&e(ye)});var be=H(ve,2);X(be,19,()=>W(D),e=>e.id,(e,a,o)=>{var b=Rx(),S=B(b),C=e=>{{let n=I(()=>[W(a).interaction]);cy(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()}})}},w=e=>{var n=$r(),r=V(n),i=e=>{{let n=I(()=>O(W(a).attention)),r=I(()=>c()?.requestId!==W(a).attention.requestId),i=I(()=>s().find(e=>e.requestId===W(a).attention?.requestId)?.resolvedAt),o=I(()=>`chat-attention-${W(a).attention.requestId}`);ev(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=mx(),n=B(t,!0);P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,r)},[()=>new Date(W(a).occurredAt).toISOString(),()=>pv(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=xx(),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(),()=>pv(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)},T=e=>{let t=I(()=>W(le).get(W(a).id)??[]);var i=Ex(),s=V(i),c=H(B(s),2),l=e=>{var t=wx(),n=B(t),r=H(n),i=e=>{var t=Qr();U(e=>J(t,`· ${e??``}`),[()=>pe(W(o),W(a).occurredAt)]),q(e,t)},s=I(()=>pe(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(),()=>pv(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=Tx(),i=B(r),o=e=>{var r=yx(),i=H(V(r),2);{let e=I(()=>de(W(t)));Oh(i,{get activities(){return W(e)},variant:`live`})}var a=H(i,2);n(a,()=>W(t)),q(e,r)},s=I(()=>fe(W(a))),c=e=>{Ev(e,{get activities(){return W(t)},get now(){return W(te)}})};Y(i,e=>{W(s)?e(o):e(c,-1)}),P(r),U(e=>Ai(r,1,e,`svelte-1im954t`),[()=>wi(fe(W(a))?`progress-turn`:`orphan-activity-turn`)]),q(e,r)};Y(f,e=>{W(t).length&&e(p)}),q(e,i)},E=e=>{let t=I(()=>W(le).get(W(a).id)??[]),s=I(()=>A(W(a))),c=I(()=>W(a).answer),l=I(()=>ee.has(W(a).id));var u=Fx(),d=B(u);let f;var p=B(d),h=B(p,!0);P(p);var g=H(p,2),_=e=>{var t=Dx(),n=B(t),r=B(n),i=B(r);let o;var s=H(i);let u;P(r),P(n);var d=H(n,2);sa(B(d),{name:`copy`,size:`1rem`}),P(d),P(t),U(()=>{Z(n,`aria-checked`,W(l)),o=Ai(i,1,`svelte-1im954t`,null,o,{selected:!W(l)}),u=Ai(s,1,`svelte-1im954t`,null,u,{selected:W(l)})}),G(`click`,n,()=>{W(l)?ee.delete(W(a).id):ee.add(W(a).id)}),G(`click`,d,async()=>x()(await E_(W(c),m()),`answer`)),q(e,t)};Y(g,e=>{W(s)||e(_)});var v=H(g,2),y=e=>{var t=wx(),n=B(t),r=H(n),i=e=>{var t=Qr();U(e=>J(t,`· ${e??``}`),[()=>pe(W(o),W(a).occurredAt)]),q(e,t)},s=I(()=>pe(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(),()=>pv(W(a).occurredAt)]),q(e,t)};Y(v,e=>{W(a).occurredAt&&e(y)}),P(d);var b=H(d,2),S=e=>{var r=kx(),o=V(r),s=B(o);i(s,()=>W(a).answer),P(o);var c=H(o,2),l=e=>{var t=Ox(),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=I(()=>de(W(t)));Oh(u,{get activities(){return W(e)},variant:`live`})}var d=H(u,2);n(d,()=>W(t)),q(e,r)},C=e=>{var t=jx(),n=B(t),r=e=>{var t=Ax(),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)},w=I(()=>W(a).commentary||de(W(t)).length);Y(b,e=>{W(s)?e(S):W(w)&&e(C,1)});var T=H(b,2),E=e=>{var t=Mx(),n=B(t);r(n,()=>W(a).commentary),P(t),U(()=>Z(t,`id`,`commentary-${W(a).id}`)),q(e,t)};Y(T,e=>{!W(s)&&W(a).commentary&&k[W(a).id]&&e(E)});var D=H(T,2),O=e=>{var n=Px(),i=V(n),a=B(i),o=e=>{var t=Nx(),n=B(t),r=B(n,!0);P(n),P(t),U(()=>J(r,W(c))),q(e,t)},s=e=>{r(e,()=>W(c))};Y(a,e=>{W(l)?e(o):e(s,-1)}),P(i),Ev(H(i,2),{get activities(){return W(t)},get now(){return W(te)}}),q(e,n)};Y(D,e=>{W(s)||e(O)}),P(u),U(()=>{Z(u,`data-reading-order`,W(s)?`newest-first`:`top-down`),Z(u,`aria-label`,W(s)?`Working, newest paragraphs first`:`Answer, read from top to bottom`),f=Ai(d,1,`entry-heading svelte-1im954t`,null,f,{"finished-heading":!W(s)}),J(h,W(s)?`working`:`answer`)}),q(e,u)},D=e=>{let t=I(()=>W(le).get(W(a).id)??[]);var r=Lx(),s=B(r),c=H(B(s),2),l=e=>{var t=wx(),n=B(t),r=H(n),i=e=>{var t=Qr();U(e=>J(t,`· ${e??``}`),[()=>pe(W(o),W(a).occurredAt)]),q(e,t)},s=I(()=>pe(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(),()=>pv(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=Ix(),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=I(()=>de(W(t)));Oh(e,{get activities(){return W(n)},variant:`live`})}},m=I(()=>A(W(a))),h=e=>{Ev(e,{get activities(){return W(t)},get now(){return W(te)}})};Y(f,e=>{W(m)?e(p):e(h,-1)});var g=H(f,2),_=e=>{n(e,()=>W(t))},v=I(()=>A(W(a)));Y(g,e=>{W(v)&&e(_)}),P(r),q(e,r)};Y(S,e=>{W(a).kind===`interaction`?e(C):W(a).kind===`audit`?e(w,1):W(a).kind===`user`?e(T,2):W(a).answer===null?W(a).commentary!==null&&e(D,4):e(E,3)}),P(b),U(()=>Ai(b,1,wi(W(a).kind===`user`?`prompt-turn`:W(a).kind===`audit`?`audit-item`:`answer-item`),`svelte-1im954t`)),q(e,b)});var xe=H(be,2),Se=e=>{q(e,zx())};Y(xe,e=>{o()&&e(Se)}),P(_e),vi(H(_e,2),()=>t.footer??b),q(e,me),tt()}Ur([`click`]);var Hx=e=>typeof e==`number`&&Number.isSafeInteger(e)&&e>=0?e:void 0;function Ux(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=Hx(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 Wx=[150,300,600];function Gx(e){return new Promise(t=>setTimeout(t,e))}function Kx(e){return e.status===502||e.status===503||e.status===504}async function qx(e=fetch){for(let t=0;t<=Wx.length;t+=1){let n;try{n=await e(`/api/bootstrap`)}catch(e){if(e instanceof Error&&e.name===`AbortError`)throw e;if(t===Wx.length)throw Error(`BOOTSTRAP_FAILED`);await Gx(Wx[t]);continue}if(n.ok){let e=await n.json();return{...e,versions:(e.versions??[]).filter(e=>e.id!==`xerj`)}}if(!Kx(n)||t===Wx.length)throw Error(`BOOTSTRAP_FAILED`);await Gx(Wx[t])}throw Error(`BOOTSTRAP_FAILED`)}var Jx=`gestalt-mobile`,Yx=3,Xx=[`settings`,`drafts`,`cursors`,`messages`,`chat-projections`];function Zx(e){return new Promise((t,n)=>{let r=e.open(Jx,Yx);r.onupgradeneeded=()=>{for(let e of Xx)r.result.objectStoreNames.contains(e)||r.result.createObjectStore(e)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error)})}function Qx(e,t,n){return tS(e.transaction(t,`readonly`).objectStore(t).get(n))}function $x(e,t,n,r){return tS(e.transaction(t,`readwrite`).objectStore(t).put(r,n))}function eS(e,t,n){return tS(e.transaction(t,`readwrite`).objectStore(t).delete(n))}function tS(e){return new Promise((t,n)=>{e.onsuccess=()=>t(e.result),e.onerror=()=>n(e.error)})}var nS=`chat-projections`,rS=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 iS(e=globalThis.indexedDB){if(!e)return{read:async()=>null,write:async()=>{}};let t=Zx(e);return t.catch(()=>{}),{read:async e=>{try{return await Qx(await t,nS,e)}catch{return null}},write:async(e,n)=>{try{await $x(await t,nS,e,rS(n))}catch{}}}}var aS=`chat-session`;function oS(e){return new URLSearchParams(e).get(`chat-session`)?.trim()||null}function sS(e,t){let n=new URL(e);return n.search=``,n.hash=``,n.searchParams.set(aS,t),n.toString()}function cS(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 lS(e){let t=dS(e,`requestId`),n=iv(dS(e,`payload`));if(typeof t!=`string`||t.length>256||!n)return;let r=dS(e,`turnId`),i=dS(e,`requestedAt`);return{requestId:t,turnId:typeof r==`string`?r:null,requestedAt:typeof i==`string`?i:null,attention:n}}function uS(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 dS(t,`reason`)===`resourceBudget`?`Stopped background work at its resource limit`:`Stopped executor background work`;if(e===`autopilot.turn-failed`)return dS(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 dS(t,`outcome`)===`failed`?`Attention resolution failed`:`Attention resolved`;if(e!==`autopilot.updated`)return null;let n=dS(t,`state`),r=dS(t,`reason`),i=ag(dS(t,`providerFailure`));return n===`safetyPaused`&&i?`Autopilot paused: ${og(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 dS(e,t){return e&&typeof e==`object`?e[t]:void 0}var fS=()=>({sessionId:null,cursor:0,snapshotting:!1,lifecycle:`finished`,activeTurnId:null,messages:[],activities:[],prompts:[],interactions:[],autopilotAuditTruncated:!1,buffered:new Map}),pS=(e=null)=>({...fS(),sessionId:e});function mS(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 hS(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 gS(e){let t=_S(e.occurredAt),n=uS(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?hS({id:`audit:${e.sequence}`,label:n,occurredAt:t,...r?{controlId:r}:{},...e.type===`org-plan.attention-required`&&lS(e.payload)?{attention:lS(e.payload)}:{}}):null}function _S(e){if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function vS(e){let t=_S(e.requestedAt),n=_S(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 yS(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 bS(e,t){return e?t===`finished`||t===`interrupted`?t:`working`:t===`working`||t===`starting`||t===`recoverable`?`finished`:t}function xS(e){return[...new Map(e.map(e=>[e.key??e.id??``,e])).values()]}function SS(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 CS(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=mS(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=xS([...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 xS([...f.get(-1)??[],...s.flatMap((e,t)=>[e,...f.get(t)??[]])])}function wS(e,t){if(!t||typeof t!=`object`)return pS(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 pS(e);let r=[`submitting`,`accepted`,`failed`,`canonical`],i=[`pending`,`submitting`,`resolved`,`failed`],a=[`starting`,`working`,`finished`,`interrupted`,`recoverable`];return{...pS(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||lS({...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=>!dy(e)).map(e=>{let{mcpStartup:t,...n}=e,r=oh(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 TS(e,t){if(!Number.isInteger(t.baseSequence)||t.baseSequence<0)return e;if(t.baseSequence<e.cursor)return LS({...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(vS),a=new Map(e.interactions.map(e=>[e.requestId,e])),o=xS(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=xS(t.items.flatMap(e=>{let t=my(e);return t?[{...t,key:`activity:${t.id}`}]:[]}).concat((t.activities??[]).map(e=>({...e,key:`activity:${e.id}`})))).filter(e=>!dy(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}:{},...oh(e.mcpStartup)?{mcpStartup:oh(e.mcpStartup)}:{}})).reduce(SS,[...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:bS(t.activeTurnId,e.cursor===0&&e.lifecycle===`finished`?`working`:e.lifecycle),prompts:r,messages:xS(CS(l,r,e.messages).concat(u.map(hS))).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 LS({...d,messages:ES(d.messages)})}function ES(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 DS(e){return{...e,snapshotting:!0}}function OS(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 kS(e,t,n,r){let i=OS(e,t,n,r);return i===e?e:{...i,lifecycle:`working`}}function AS(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 jS(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 MS(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 NS(e,t,n){return{...e,interactions:e.interactions.map(e=>e.requestId===t&&e.state!==`resolved`?{...e,state:`failed`,attemptedOutcome:n}:e)}}function PS(e,t,n,r){return{...e,interactions:e.interactions.map(e=>e.requestId===t?{...e,state:`resolved`,...r===void 0?{}:{resolvedAt:r},...yS(e,n)?{attemptedOutcome:yS(e,n)}:{}}:e)}}function FS(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=_S(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=PS(n,r.requestId,r.outcome,i);else if(t.type===`activity.updated`&&!dy(r)&&typeof r?.id==`string`&&typeof r.label==`string`&&typeof r.detail==`string`){let e=IS(r.changes),t=oh(r.mcpStartup);n={...n,activities:SS(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`:bS(e,n.lifecycle)}}let a=gS(t);return a&&!n.messages.some(e=>e.id===a.id)&&(n={...n,messages:ES([...n.messages,a])}),n}function IS(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 LS(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=FS({...n,buffered:t},e),t=new Map(n.buffered)}}function RS(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 zS={read:async()=>null,write:async()=>{}},BS=[250,750,1500],VS=e=>!!e&&typeof e==`object`,HS=e=>VS(e)&&typeof e.path==`string`&&Number.isInteger(e.additions)&&e.additions>=0&&Number.isInteger(e.deletions)&&e.deletions>=0,US=e=>VS(e)&&typeof e.id==`string`&&typeof e.kind==`string`,WS=e=>VS(e)&&typeof e.id==`string`&&Array.isArray(e.items)&&e.items.every(US)&&(e.startedAt===null||typeof e.startedAt==`number`)&&(e.completedAt===null||typeof e.completedAt==`number`),GS=e=>!VS(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=>VS(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||VS(e.attention)&&!!lS({...e.attention,payload:e.attention.attention})),qS=e=>VS(e)&&typeof e.id==`string`&&typeof e.label==`string`&&typeof e.detail==`string`&&(e.changes===void 0||Array.isArray(e.changes)&&e.changes.every(HS))&&(e.turnId===void 0||typeof e.turnId==`string`)&&(e.occurredAt===void 0||typeof e.occurredAt==`number`&&Number.isFinite(e.occurredAt)),JS=e=>!VS(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(US)||!e.turns.every(WS)||!e.interactions.every(GS)||e.activities!==void 0&&(!Array.isArray(e.activities)||!e.activities.every(qS))||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,YS=class{#e=pS();#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??zS,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??rg,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&&!XS(this.#e);return Object.freeze({...this.#e,status:this.#s?`Connection interrupted. Reconnecting…`:e?`Loading conversation…`:RS(this.#e),readySince:this.#r,starting:this.#e.lifecycle===`starting`,newEmpty:this.#m&&!XS(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=pS(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(OS(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(AS(this.#e,t,i.activeTurnId??null))),this.#x.onSendAccepted?.(n,t)}catch(e){this.#N(n,r)&&(this.#A(jS(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(kS(this.#e,t,e.trim(),this.#x.now()));try{let o=await i(n,r,e.trim(),t);this.#N(n,a)&&this.#A(AS(this.#e,t,o.activeTurnId)),this.#x.onSendAccepted?.(n,t)}catch(e){this.#N(n,a)&&(this.#A(jS(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(OS(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(AS(this.#e,t,a.activeTurnId??null)),this.#x.onSendAccepted?.(n,t)}catch(e){this.#N(n,i)&&(this.#A(jS(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(MS(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(PS(this.#e,e,a,this.#x.now()))}catch{this.#N(r,i)&&this.#A(NS(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={...wS(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=tg(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`&&ZS(i.payload)||i.type===`session.updated`&&typeof i.payload.activeTurnId==`string`)&&this.#M(e);let a=FS(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`?tg(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=DS(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(TS(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=BS[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&&XS(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(!QS(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 XS(e){return!!(e.activeTurnId||e.messages.length||e.activities.some(ZS)||e.prompts.length||e.interactions.length)}function ZS(e){if(dy(e))return!1;let t=e;return!oh(t.mcpStartup)||typeof t.turnId==`string`||typeof t.actorTurnId==`string`}function QS(e,t){return VS(e)&&e.code===t}function $S(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 eC(e){return typeof e==`string`&&e.length<=200&&/^(?:tmp(?:\/sessions(?:\/(?:\.cleanup-)?[a-z0-9-]+)?)?|\.gestalt\/forgotten-tmp\/[0-9a-f-]{36})$/.test(e)}var tC={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 PNG and JPEG images, UTF-8 text files, and folders.`,FILE_PREVIEW_IMAGE_INVALID:`This image could not be decoded. Check that the file is complete and try again.`,FILE_PREVIEW_TOO_LARGE:`This file is too large to preview. The limit is 10 MiB for PNG and JPEG images and 1 MiB for text.`,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 nC(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(tC,r)?r:Object.hasOwn(tC,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.`:tC[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(eC):[];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 ${Bm(e)}. The session is retained. Try Forget again.`,retryable:a,history:{message:o,details:e}}}}return{code:i,message:o,retryable:a}}var rC=K(`<li class="svelte-1izxxv2"> </li>`),iC=K(`<ul aria-label="Affected folders" class="svelte-1izxxv2"></ul>`),aC=K(`<small class="svelte-1izxxv2"> </small>`),oC=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>`),sC=K(`<ol aria-label="Recent notifications" class="svelte-1izxxv2"></ol>`),cC=K(`<p class="empty svelte-1izxxv2" role="status">No recent notifications.</p>`),lC=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 uC(e,t){et(t,!0);let n=R([]),r=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});ta(()=>t.queue.subscribeHistory(e=>z(n,e)));function i(e){kr().then(()=>e.focus())}var a=lC(),o=B(a),s=B(o),c=H(s,2);xi(B(c),()=>i),F(2),P(c),P(o);var l=H(o,2),u=e=>{var t=sC();X(t,21,()=>W(n),e=>e.id,(e,t)=>{var n=oC(),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=iC();X(n,21,()=>W(t).details,ci,(e,t)=>{var n=rC(),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=aC(),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,cC())};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),tt()}Ur([`click`]);var dC=`gestalt-mobile.codex-auto-reset-last-seen`;function fC(e,t){function n(){try{let e=Number(t?.getItem(dC));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(dC,String(Math.max(r,n())))}catch{}}}}var pC=Cp({enabled:hp(),resets:xp(Cp({id:zf().min(1).max(80),occurredAt:dp().int().positive().max(2**53-1)})).max(50)}),mC={error:null,success:5e3,warning:1e4,info:7e3},hC=`gestalt-mobile.notification-history`;function gC(){try{return typeof window>`u`?null:window.localStorage}catch{return null}}function _C(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 vC(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=_C(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(hC,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=mC[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 yC(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 bC(e){let t=new Map;return(n,r)=>{if(r.type!==`activity.updated`||!r.payload||typeof r.payload!=`object`)return;let i=oh(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:`${sh(i.serverName)} startup ${i.status}. ${lh(i.serverName)} Trace reference: ${i.failure.failureId}.`});t.set(a,{toastId:s,failureId:i.failure.failureId,observedAt:i.observedAt,sequence:r.sequence})}}var xC=K(`<small class="svelte-1a0rutm"> </small>`),SC=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>`),CC=K(`<div class="toast-viewport svelte-1a0rutm" aria-label="Notifications"></div>`);function wC(e,t){et(t,!0);let n=R([]),r=I(()=>W(n).slice(-3));ta(()=>t.queue.subscribe(e=>z(n,e)));var i=CC();X(i,21,()=>W(r),e=>e.id,(e,n)=>{var r=SC();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=xC(),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=Ai(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`)}),Hr(`pointerenter`,r,()=>t.queue.pause(W(n).id,`hover`)),Hr(`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),tt()}Ur([`focusin`,`focusout`,`click`]);var TC=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 EC(e,t){et(t,!0);let n=vC();ta(()=>{t.variant===`stacked`&&n.enqueue({kind:`success`,message:`Cloned.`}),n.enqueue({kind:`error`,code:`GIT_CLONE_FAILED`,message:`Clone failed.`})});var r=TC();wC(H(V(r),4),{get queue(){return n}}),q(e,r),tt()}var DC={sessionBase:()=>!0,gitRepositoryTarget:e=>e.isGitRepository,cloneDestination:e=>!e.isGitRepository};function OC(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 kC(e,t){let n=new Set(e);return t.isGitRepository||(n.has(t.id)?n.delete(t.id):n.add(t.id)),n}function AC(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 jC(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 MC(e,t){for(let n of e){if(n.id===t)return n;let e=MC(n.children,t);if(e)return e}}function NC(e,t,n,r){if(e){let i=MC(n,e);if(i&&r(i))return i.id;let a=jC(t,e);for(let e of a.toReversed()){let t=MC(n,e);if(t&&r(t))return t.id}}return PC(n).find(r)?.id??null}function PC(e){let t=[],n=e=>{t.push(e),e.children.forEach(n)};return e.forEach(n),t}var FC=K(`<button class="disclosure svelte-6z3q4v" type="button" tabindex="-1"><span aria-hidden="true"> </span></button>`),IC=K(`<span class="disclosure-spacer svelte-6z3q4v" aria-hidden="true"></span>`),LC=K(`<span class="repository-badge svelte-6z3q4v">Git</span>`),RC=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>`),zC=K(`<div class="filesystem-tree svelte-6z3q4v" role="tree"></div>`);function BC(e,t){et(t,!0);let n=Q(t,`isSelectable`,3,()=>!0),r=R(null),i=ln({}),a,o=I(()=>AC(t.roots,t.expandedIds)),s=I(()=>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);Fn(()=>{let e=t.selectedId,n=e?MC(t.roots,e):void 0;if(!e||!n||n===a)return;a=n;let r=jC(t.roots,e);Mr(()=>{let e=new Set(t.expandedIds);r.forEach(t=>e.add(t)),e.size!==t.expandedIds.size&&t.onexpandedchange(e)})}),Fn(()=>{let e=t.selectedId,n=e?i[e]:void 0;n&&Mr(()=>{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(kC(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=zC();X(h,23,()=>W(o),e=>e.node.id,(e,a,o)=>{let u=I(()=>W(a).node),d=I(()=>c(W(u)));var h=RC();let g;var _=B(h),v=e=>{var n=FC(),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,IC())};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,LC())};Y(k,e=>{W(u).isGitRepository&&e(ee)}),P(b),Zi(b,(e,t)=>i[t.id]=e,e=>i?.[e.id],()=>[W(u)]),P(h),U((e,n,r,i,o)=>{g=Mi(h,``,g,e),x=Ai(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)]),Hr(`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),tt()}Ur([`click`,`keydown`]);var VC=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 HC(e,t){et(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(ln(new Set([`.`,`dyne`,`dyne/mobile-applications`]))),a=R(null),o=I(()=>t.context===`sessions`?`dyne/mobile-applications`:`dyne/mobile-applications/gestalt-mobile`),s=I(()=>W(a)??W(o));var c=VC(),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=I(()=>t.context===`sessions`?`Session base`:`Git repository`),n=I(()=>t.context===`sessions`?DC.sessionBase:DC.gitRepositoryTarget);BC(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),tt()}var UC=`gestalt.filesystem-tree.selection`;function WC(e,t=null){try{let t=localStorage.getItem(UC);if(t&&MC(e,t))return t}catch{}return t&&MC(e,t)?t:null}function GC(e){try{e?localStorage.setItem(UC,e):localStorage.removeItem(UC)}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 qC(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 YC=K(`<p class="clone-status svelte-pudr3t" role="status"> </p>`),XC=K(`<option> </option>`),ZC=K(`<p class="svelte-pudr3t"> </p>`),QC=K(`<p id="git-push-help" class="action-help svelte-pudr3t"> </p>`),$C=K(`<section aria-label="Confirm push"><p> </p> <button type="button"> </button> <button type="button">Cancel</button></section>`),ew=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>`),tw=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>`),nw=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),rw=K(`<p>This workspace is not a Git repository.</p>`),iw=K(`<p role="status">Loading repository status…</p>`),aw=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),ow=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),sw=K(`<p role="alert"> </p>`),cw=K(`<section class="git-view svelte-pudr3t" aria-labelledby="git-title"><h2 id="git-title" class="view-title svelte-pudr3t">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 lw(e,t){et(t,!0);let n=Q(t,`pushing`,3,!1),r=R(``),i=I(()=>t.selectedWorkspace&&!t.selectedWorkspace.isGitRepository?t.selectedWorkspace:null),a=I(()=>!!t.selectedWorkspace?.isGitRepository),o=I(()=>W(a)?t.summary?.originUrl??``:W(r)),s=I(()=>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=cw(),u=H(B(l),2),d=H(B(u),2);{let e=I(()=>t.selectedWorkspace?.id??null);BC(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);Vi(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=YC(),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=$r(),i=V(r),a=e=>{var r=$r(),i=V(r),a=e=>{var r=nw(),i=V(r),a=B(i),o=H(B(a),2);X(o,20,()=>t.summary.branches??[],e=>e,(e,t)=>{var n=XC(),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;Pi(o);var l=H(o,2),u=B(l);P(l);var d=H(l,2),f=e=>{var n=ZC(),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=QC(),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=$C(),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=tw(),r=H(B(n),2);X(r,21,()=>t.summary.commits,e=>e.hash,(e,t)=>{var n=ew(),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??``)??``,Ni(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`}`)},[()=>qC(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,rw())};Y(i,e=>{t.summary.available?e(a):e(o,-1)}),q(e,r)},o=e=>{q(e,iw())};Y(i,e=>{t.summary?e(a):t.error||e(o,1)}),q(e,r)},E=e=>{var n=aw(),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=ow();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=sw(),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,Hi(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)),Hr(`submit`,p,c),G(`input`,g,e=>z(r,e.currentTarget.value,!0)),q(e,l),tt()}Ur([`click`,`input`,`change`]);var uw=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 dw(e,t,n,r,i){let a=new Set(fw(e).filter(e=>e.isGitRepository).map(e=>e.id)),o=MC(t,n),s=o?fw(o.children).filter(e=>e.isGitRepository&&!a.has(e.id)):[],c=pw(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&&jC(t,u).forEach(e=>d.add(e)),!l&&o&&d.add(o.id),{selectedId:u,expandedIds:d}}function fw(e){let t=[],n=e=>{t.push(e),e.children.forEach(n)};return e.forEach(n),t}function pw(e){return(e.trim().replace(/[?#].*$/,``).replace(/\/+$/,``).split(/[/:]/).at(-1)??``).replace(/\.git$/i,``)}function mw(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 hw(e){return{answers:Object.fromEntries(e.filter(e=>e.answer.trim()).map(e=>[e.id,{answers:[e.answer]}]))}}var gw=zf().min(1).max(1024);Cp({reference:Dp(`kind`,[Cp({kind:Np(`workspace`),workspaceId:gw,planName:gw}).strict(),Cp({kind:Np(`session`),sessionId:gw,planName:gw}).strict(),Cp({kind:Np(`retained-session`),sessionId:gw}).strict()]),expectedRevision:gw,skillProfile:zf().max(256).optional(),replaceSessionId:gw.optional(),launchId:zf().min(1).max(256)}).strict();var _w=Dp(`kind`,[Cp({kind:Np(`blocked`),code:jp([`CONTEXT_CHANGED`,`ACTIVE_SUPERVISION`,`WORKSPACE_BUSY`]),reason:zf().min(1),existingSessionId:gw.optional()}).strict(),Cp({kind:Np(`rejected`),code:Np(`LAUNCH_CONFLICT`),reason:zf().min(1)}).strict()]),vw=Cp({kind:Np(`rejected`),code:Np(`INVALID_LAUNCH_REQUEST`),reason:zf().min(1)}).strict();function yw(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?_w:vw).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 bw=[`authoring-start`,`display-open`,`work-start`,`checkpoint`,`update`,`supervision-start`,`resync`];function xw(e){return typeof e==`string`&&(bw.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 Sw(e){if(!e||typeof e!=`object`)return!1;let t=e;return Cw(t.plan)&&(t.reason===null||xw(t.reason))}function Cw(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 ww(e){return e instanceof Error?e.message:`Could not load the plan.`}function Tw(e){return{...e,...e.skills?{skills:[...e.skills]}:{},description:{...e.description},children:e.children.map(Tw)}}function Ew(e){return{...e,steps:e.steps.map(Tw)}}function Dw(e,t){return e.kind===`unavailable`&&e.sessionId===t}function Ow(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:Ew(e)}:{kind:`unavailable`,sessionId:t})}).catch(e=>{o?.signal.aborted||a!==i||n!==t||c({kind:`error`,sessionId:t,error:ww(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`&&(Cw(t.payload)||Sw(t.payload))){let n=Sw(t.payload)?t.payload.plan:t.payload;s=t.sequence,c({kind:`ready`,sessionId:e,plan:Ew(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`):Dw(r,t)?`chat`:null:null}catch(e){return n===t?a===o?(c({kind:`error`,sessionId:t,plan:i,error:ww(e)}),null):Dw(r,t)?`chat`:null:null}},dispose(){o?.abort(),o=null,n=null,++i,c({kind:`unavailable`,sessionId:null})}}}function kw(e){if(!e)return null;let t=Aw(e.steps,e.currentStepId)?.measurement?.weeklyRemainingCurrent;return typeof t==`number`&&Number.isFinite(t)&&t>=0&&t<=100?Math.round(t):null}function Aw(e,t){for(let n of e){if(n.id===t)return n;let e=Aw(n.children,t);if(e)return e}}function jw(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 Mw=K(`<a class="svelte-nywawl"><code class="svelte-nywawl"> </code></a>`),Nw=K(`<code class="svelte-nywawl"> </code>`),Pw=K(`<span class="notes svelte-nywawl"></span>`);function Fw(e,t){et(t,!0);let n=Q(t,`verifiedReferences`,19,()=>new Set),r=I(()=>t.text.split(/(=[^=\n]+=)/g));var i=Pw();X(i,21,()=>W(r),ci,(e,r)=>{var i=$r(),a=V(i),o=e=>{var i=$r(),a=V(i),o=e=>{var n=Mw(),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=I(()=>t.onreference&&n().has(W(r).slice(1,-1).trim())),c=e=>{var t=Nw(),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=I(()=>W(r).startsWith(`=`)&&W(r).endsWith(`=`)&&W(r).length>2),c=e=>{var t=Qr();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),tt()}Ur([`click`]);function Iw(e,t){return t===void 0?`L${e}`:`L${e}.${t}`}function Lw(e){let t=e.steps.filter(e=>e.reviewStatus===`REVIEWED`).length,n=e.steps.length,r=Rw(e),i=e.steps.find(e=>e.state===`DONE`&&e.reviewStatus===`UNREVIEWED`);return i?{phase:`awaiting review`,label:`Awaiting ${Iw(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 Rw(e){for(let[t,n]of e.steps.entries()){if(n.id===e.currentStepId)return{id:n.id,position:Iw(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:Iw(t+1,r+1),title:e.title,state:e.state}}}}var zw=K(`<span class="wip-effort svelte-hmxg46"> </span>`),Bw=K(`<li class="svelte-hmxg46"><span class="wip-position svelte-hmxg46" aria-hidden="true"> </span> <span class="wip-title svelte-hmxg46"> </span> <!></li>`),Vw=K(`<ol class="wip-steps svelte-hmxg46" aria-label="Work in progress plan steps"></ol>`),Hw=K(`<li class="svelte-hmxg46"><span aria-hidden="true" class="position svelte-hmxg46"> </span> <span aria-hidden="true" class="state"> </span></li>`),Uw=K(`<ol class="step-markers svelte-hmxg46" aria-label="Plan step progress"></ol>`),Ww=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 Gw(e,t){et(t,!0);let n=Q(t,`compact`,3,!1),r=Q(t,`label`,3,`Plan progress`),i=I(()=>t.plan.steps.flatMap((e,t)=>[{id:e.id,position:Iw(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:Iw(t+1,n+1),state:e.state,level:e.level,title:e.title}))])),a=I(()=>W(i).filter(e=>e.state===`WIP`)),o=I(()=>Lw(t.plan)),s=I(()=>Math.max(t.plan.totalSteps,1));var c=Ww(),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=Vw();X(n,21,()=>W(a),e=>e.id,(e,n)=>{var r=Bw(),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=zw(),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=Uw();X(n,21,()=>W(i),e=>e.id,(e,n)=>{var r=Hw(),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(()=>{Ai(c,1,wi([`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()),Hi(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),tt()}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"><!></button></div>`);function qw(e,t){et(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);sa(B(o),{name:`copy`,size:`1rem`}),P(o),P(r),U(()=>J(a,t.path)),G(`click`,o,async()=>n()(await E_(t.path))),q(e,r),tt()}Ur([`click`]);var Jw=K(`<div class="actions svelte-gna0d9"><!></div>`),Yw=K(`<header class="svelte-gna0d9"><h2 class="svelte-gna0d9"> </h2> <button class="close svelte-gna0d9" type="button"><!></button> <!> <!></header>`);function Xw(e,t){var n=Yw(),r=B(n),i=B(r,!0);P(r);var a=H(r,2);sa(B(a),{name:`close`}),P(a);var o=H(a,2),s=e=>{qw(e,{get path(){return t.sourcePath},get oncopyresult(){return t.oncopyresult}})};Y(o,e=>{t.sourcePath&&e(s)});var c=H(o,2),l=e=>{var n=Jw();vi(B(n),()=>t.executeAction),P(n),q(e,n)};Y(c,e=>{t.executeAction&&e(l)}),P(n),U(()=>{Z(r,`id`,t.titleId),J(i,t.title),Z(a,`aria-label`,t.closeLabel),Z(a,`title`,t.closeLabel)}),G(`click`,a,function(...e){t.onclose?.apply(this,e)}),q(e,n)}Ur([`click`]);var Zw=K(`<section class="svelte-3rmyvg"><h2 class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg">Loading plan…</p></section>`),Qw=K(`<section class="svelte-3rmyvg"><h2 class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg">No retained plan for this session.</p></section>`),$w=K(`<section class="svelte-3rmyvg"><h2 class="svelte-3rmyvg">Plan</h2> <p class="svelte-3rmyvg"> </p></section>`),eT=K(`<button type="button" class="svelte-3rmyvg">Full plan</button>`),tT=K(`<header class="svelte-3rmyvg"><h2 class="svelte-3rmyvg"> </h2> <!></header>`),nT=K(`<p class="svelte-3rmyvg"> </p>`),rT=K(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Subtitle</dt> <dd class="svelte-3rmyvg"> </dd></div>`),iT=K(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Date</dt> <dd class="svelte-3rmyvg"> </dd></div>`),aT=K(`<div class="svelte-3rmyvg"><dt class="svelte-3rmyvg">Keywords</dt> <dd class="svelte-3rmyvg"> </dd></div>`),oT=K(`<dl class="metadata svelte-3rmyvg"><!> <!> <!></dl>`),sT=K(`<p class="svelte-3rmyvg">No plan steps have been retained yet.</p>`),cT=K(`<span class="svelte-3rmyvg"> </span>`),lT=K(`<span class="measurement svelte-3rmyvg"> </span>`),uT=K(`<p class="svelte-3rmyvg"><strong class="svelte-3rmyvg"> </strong> <!></p>`),dT=K(`<p class="svelte-3rmyvg"><strong class="svelte-3rmyvg">Skills:</strong> </p>`),fT=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>`),pT=K(`<ol class="svelte-3rmyvg"></ol>`),mT=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>`),hT=K(`<ol class="plan-steps svelte-3rmyvg"></ol>`),gT=K(`<section><!> <!> <!> <!> <!> <!></section>`),_T=K(`<p class="visually-hidden svelte-3rmyvg" aria-live="polite" aria-atomic="true"> </p> <!>`,1);function vT(e,t){let n=ei();et(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=ln({}),l=null,u=0,d=I(()=>t.state.kind===`ready`||t.state.kind===`closing`||t.state.kind===`error`?t.state.plan:void 0),f=I(()=>W(d)?_(W(d).steps,W(d).currentStepId):void 0),p=I(()=>W(d)?v(W(d).steps,W(d).currentStepId):void 0),m=I(()=>W(d)?Lw(W(d)):void 0),h=I(()=>W(d)?y(W(d).steps,W(d).currentStepId):new Set),g=I(()=>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}`:``}`:``);Fn(()=>{let e=W(d)?.currentStepId||null;if(!e||l===e)return;let t=l===null;l=e;let n=++u;t||kr().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 Iw(n+1);let e=r.children.findIndex(e=>e.id===t);if(e>=0)return Iw(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 w(e){return Object.keys(r).flatMap(t=>{let n=e.description[t];return n?[[r[t],n]]:[]})}var E=_T(),D=V(E),O=B(D,!0);P(D);var k=H(D,2),ee=e=>{var t=Zw(),r=B(t);F(2),P(t),U(()=>{Z(t,`aria-labelledby`,n),Z(r,`id`,n)}),q(e,t)},te=e=>{var t=Qw(),r=B(t);F(2),P(t),U(()=>{Z(t,`aria-labelledby`,n),Z(r,`id`,n)}),q(e,t)},ne=e=>{var r=$w(),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=gT();let l;var u=B(r),h=e=>{var r=tT(),i=B(r),a=B(i,!0);P(i);var o=H(i,2),s=e=>{var n=eT();G(`click`,n,function(...e){t.onopenfull?.apply(this,e)}),q(e,n)};Y(o,e=>{t.onopenfull&&e(s)}),P(r),U(()=>{Z(i,`id`,n),J(a,W(d).title)}),q(e,r)},g=e=>{{let r=I(()=>W(d).sourcePath||t.sourcePath);Xw(e,{get title(){return W(d).title},get titleId(){return n},get sourcePath(){return W(r)},get oncopyresult(){return t.oncopyresult},get executeAction(){return t.executeAction},get closeLabel(){return a()},get onclose(){return i()}})}};Y(u,e=>{o()?e(h):e(g,-1)});var _=H(u,2);Gw(_,{get plan(){return W(d)},get compact(){return o()}});var v=H(_,2),y=e=>{var t=nT(),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(v,e=>{o()||e(y)});var E=H(v,2),D=e=>{var n=nT(),r=B(n,!0);P(n),U(()=>J(r,t.state.error)),q(e,n)};Y(E,e=>{t.state.kind===`error`&&e(D)});var O=H(E,2),k=e=>{var t=oT(),n=B(t),r=e=>{var t=rT(),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=iT(),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=aT(),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(O,e=>{!o()&&(W(d).subtitle||W(d).date||W(d).keywords)&&e(k)});var ee=H(O,2),te=e=>{q(e,sT())},ne=e=>{var n=hT();X(n,23,()=>W(d).steps,e=>e.id,(e,n,r)=>{var i=mT(),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=cT(),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=lT(),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,()=>w(W(n)),([e,t])=>e,(e,n)=>{var r=I(()=>T(W(n),2));let i=()=>W(r)[0],a=()=>W(r)[1];var o=uT(),c=B(o),l=B(c);P(c);var u=H(c,2);{let e=I(()=>S(a()));Fw(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=dT(),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=pT();X(i,23,()=>W(n).children,e=>e.id,(e,n,i)=>{var a=fT(),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=cT(),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,()=>w(W(n)),([e,t])=>e,(e,n)=>{var r=I(()=>T(W(n),2));let i=()=>W(r)[0],a=()=>W(r)[1];var o=uT(),c=B(o),l=B(c);P(c);var u=H(c,2);{let e=I(()=>S(a()));Fw(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=dT(),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),Zi(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),()=>Iw(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),Zi(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),()=>Iw(W(r)+1)]),q(e,i)}),P(n),q(e,n)};Y(ee,e=>{W(d).steps.length===0?e(te):e(ne,-1)}),P(r),U(()=>{l=Ai(r,1,`plan svelte-3rmyvg`,null,l,{compact:o()}),Z(r,`aria-labelledby`,n)}),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),tt()}Ur([`click`]);function yT(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 bT(e){return!!(e?.plan||e?.lastOrgPlan?.attached)}function xT(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 ST(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 CT(e){let t=/^\/home\/[^/]+/.exec(e)?.[0];if(!t)return e;let n=e.slice(t.length);return n?`~${n}`:`~/`}var wT=K(`<details class="session-verdict svelte-15zupoi"><summary class="svelte-15zupoi"><span aria-hidden="true"></span> </summary> <p class="svelte-15zupoi"> </p></details>`);function TT(e,t){et(t,!0);let n=I(()=>$S(t.status)?t.status:null);var r=$r(),i=V(r),a=e=>{let t=I(()=>W(n).state===`working`?`Working`:`Idle`);var r=wT(),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=Ai(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),tt()}var ET=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))}},DT=K(`<span role="status"> </span>`),OT=K(`<option disabled=""> </option>`),kT=K(`<option> </option>`),AT=K(`<p class="guidance svelte-15heric"> </p>`),jT=K(`<p class="svelte-15heric"> </p>`),MT=K(`<p role="status"> </p>`),NT=K(`<p class="svelte-15heric">The previous session is saved. Gestalt must confirm it has closed before starting the
|
|
158
|
+
supervisor.</p>`),PT=K(`<p class="svelte-15heric">Replace closes this idle session and starts the supervisor. The previous session and its
|
|
159
|
+
history stay saved.</p>`),FT=K(`<p class="svelte-15heric">Replacement requires a confirmed idle session. Refresh to check again.</p>`),IT=K(`<section class="workspace-conflict svelte-15heric"><h3 class="svelte-15heric">Session open in this workspace</h3> <p class="svelte-15heric"> </p> <!> <!> <!></section>`),LT=K(`<p class="guidance svelte-15heric" role="status"> </p>`),RT=K(`<p class="guidance svelte-15heric">Choose an available skill profile.</p>`),zT=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>`),VT=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 HT(e,t){let n=ei();et(t,!0);let r=R(null),i=R(!0),a=R(!1),o=R(!1),s=R(!1),c=R(``),l=R(null),u=R(null),d=R(``),f=R(!1),p=R(void 0),m,h,g=!1,_=0,v=0,y=0,b=!1,x=new ET({startOrgPlanSupervision:e=>t.transport.startOrgPlanSupervision(e)},()=>crypto.randomUUID(),e=>{z(s,e.submitting,!0)}),S=I(()=>W(o)||W(s)),C=I(()=>$S(W(u)?.sessionStatus)?W(u).sessionStatus:void 0),w=I(()=>W(l)?.workspaceSession?.replaceAllowed&&W(u)?.id===W(l).workspaceSession.sessionId&&W(C)?.state===`idle`),T=I(()=>W(i)?`Checking whether this plan can be executed…`:W(r)?.kind===`blocked`?W(r).reason:W(r)?``:`Execution availability could not be verified.`),E=I(()=>W(c)===``||W(l)?.skillProfiles.some(e=>e.name===W(c)&&!e.error));function D(e,n=!1){z(f,n,!0),z(d,e,!0),t.onerror?.(e)}function O(e){e.code===`SKILL_PROFILE_UNAVAILABLE`&&W(c)&&W(l)?(z(l,{...W(l),skillProfiles:W(l).skillProfiles.filter(e=>e.name!==W(c))},!0),D(e.reason)):D(e.reason,!0)}async function k(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}Fn(()=>{let e=t.reference,n=t.transport;return t.sourceVersion,Mr(()=>{let t=++v,s=new AbortController;if(z(r,null),z(i,!0),z(a,!1),++y,z(o,!1),g=!1,++_,z(l,null),z(u,null),z(f,!0),W(p)?.open&&W(p).close(),!e||!n){z(i,!1);return}return n.prepareOrgPlanSupervision(e,void 0,void 0,s.signal).then(async e=>{if(!(t!==v||b)&&(z(r,e,!0),z(i,!1),!(e.kind!==`eligible`||!e.workspaceSession||!n.getSession))){z(a,!0);try{let r=await k(e,n);t===v&&!b&&z(u,r,!0)}catch(e){t===v&&!b&&D(e instanceof Error?e.message:`Could not check session status.`)}finally{t===v&&!b&&z(a,!1)}}}).catch(e=>{!s.signal.aborted&&t===v&&D(e instanceof Error?e.message:`Could not check plan execution.`)}).finally(()=>{t===v&&!b&&z(i,!1)}),()=>s.abort()})}),na(()=>{b=!0,++v,x.dispose()});async function ee(e){if(W(r)?.kind!==`eligible`||W(S))return;m=e.currentTarget,z(l,W(r),!0),z(c,W(r).settings.skillProfile,!0),z(d,``),z(f,!1);let t=v,n=++_;g=!0,W(p)?.showModal(),await kr(),g&&n===_&&t===v&&!b&&W(p)?.open&&!W(S)&&h?.focus(),n===_&&(g=!1)}async function te(){if(!W(p)?.open||!W(l)||!t.transport||W(S))return;let e=v,n=W(l),i=++y;z(o,!0);try{let a=await t.transport.prepareOrgPlanSupervision(n.reference,n.revision,W(c)),o=await k(a,t.transport);if(e!==v||i!==y||b||!W(p)?.open)return;a.kind===`blocked`?O(a):(z(r,a,!0),z(l,a,!0),z(u,o,!0),z(d,``),z(f,!1))}catch(t){e===v&&i===y&&!b&&W(p)?.open&&D(t instanceof Error?t.message:`Could not refresh plan execution.`,!0)}finally{!b&&e===v&&i===y&&z(o,!1)}}function ne(){g=!1,++_,W(s)||(++y,z(o,!1)),W(p)?.open&&W(p).close()}async function re(){await kr(),m?.isConnected&&m.focus()}async function ie(e){if(W(S)||W(f)||!W(l)||!t.transport||!W(E))return;let n=W(l).workspaceSession;if(n&&(!W(w)||n.sessionId!==e))return;let r=v,i=W(l);try{let n=await x.submit({reference:i.reference,expectedRevision:i.revision,skillProfile:W(c),...e?{replaceSessionId:e}:{}});if(b||r!==v)return;if(!n){D(x.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`?O(n):D(n.reason,!0);return}n.kind===`partial`&&D(n.reason),W(p)?.open&&W(p).close(),t.onresult?.(n)}catch(e){!b&&r===v&&D(e instanceof Error?e.message:`Could not start supervision.`)}}var ae=VT();Hr(`keydown`,fn,()=>{W(p)?.open&&(g=!1)});var oe=V(ae),se=B(oe);{let e=I(()=>!W(T)),t=I(()=>!!W(T)||W(s)),r=I(()=>W(T)?`${n}-reason`:void 0);Rm(se,{compact:!0,class:`execute-trigger`,get primary(){return W(e)},get disabled(){return W(t)},get describedby(){return W(r)},onclick:ee,children:(e,t)=>{F(),q(e,Qr(`Execute`))},$$slots:{default:!0}})}var ce=H(se,2),le=e=>{var t=DT();let r;var a=B(t,!0);P(t),U(()=>{Z(t,`id`,`${n}-reason`),r=Ai(t,1,`reason svelte-15heric`,null,r,{checking:W(i)}),J(a,W(T))}),q(e,t)};Y(ce,e=>{W(T)&&e(le)}),P(oe);var ue=H(oe,2),de=B(ue),A=H(de,2),fe=H(A,2),pe=H(fe,2),me=B(pe),he=e=>{var t=OT(),n=B(t);P(t);var r={};U(()=>{J(n,`${W(c)??``} (unavailable)`),r!==(r=W(c))&&(t.value=(t.__value=W(c))??``)}),q(e,t)},ge=I(()=>W(c)&&!W(l)?.skillProfiles.some(e=>e.name===W(c)&&!e.error));Y(me,e=>{W(ge)&&e(he)});var _e=H(me);X(_e,17,()=>W(l)?.skillProfiles.filter(e=>!e.error)??[],e=>e.name,(e,t)=>{var n=kT(),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 ve=H(_e);ve.value=ve.__value=``,P(pe),Zi(pe,e=>h=e,()=>h);var ye=H(pe,2);X(ye,17,()=>W(l)&&W(l).settings.skillProfile===W(c)?W(l).warnings:[],ci,(e,t)=>{var n=AT(),r=B(n,!0);P(n),U(()=>J(r,W(t))),q(e,n)});var be=H(ye,2),xe=e=>{var t=IT(),r=B(t),i=H(r,2),s=B(i,!0);P(i);var c=H(i,2),d=e=>{var t=jT(),n=B(t);P(t),U(()=>J(n,`Model: ${W(u).model??``}`)),q(e,t)};Y(c,e=>{W(u)?.model&&e(d)});var f=H(c,2),p=e=>{TT(e,{get status(){return W(C)}})},m=e=>{var t=MT();let n;var r=B(t,!0);P(t),U(()=>{n=Ai(t,1,`svelte-15heric`,null,n,{checking:W(a)||W(o)}),J(r,W(a)||W(o)?`Checking session status…`:`Session status unavailable.`)}),q(e,t)};Y(f,e=>{W(C)?e(p):e(m,-1)});var h=H(f,2),g=e=>{q(e,NT())},_=e=>{q(e,PT())},v=e=>{q(e,FT())};Y(h,e=>{W(l).workspaceSession.retryClose?e(g):W(w)?e(_,1):!W(a)&&!W(o)&&e(v,2)}),P(t),U(e=>{Z(t,`aria-labelledby`,`${n}-workspace-conflict`),Z(r,`id`,`${n}-workspace-conflict`),J(s,e)},[()=>CT(W(u)?.workspacePath??W(l).workspace.path)]),q(e,t)};Y(be,e=>{W(l)?.workspaceSession&&e(xe)});var Se=H(be,2),j=e=>{var t=LT(),n=B(t,!0);P(t),U(()=>J(n,W(d))),q(e,t)};Y(Se,e=>{W(d)&&e(j)});var M=H(Se,2),Ce=e=>{q(e,RT())};Y(M,e=>{W(E)||e(Ce)});var we=H(M,2),Te=e=>{q(e,zT())},Ee=e=>{q(e,BT())};Y(we,e=>{W(s)?e(Te):W(o)&&e(Ee,1)});var De=H(we,2),Oe=B(De);Rm(Oe,{onclick:ne,children:(e,t)=>{F();var n=Qr();U(()=>J(n,W(s)?`Close`:`Cancel`)),q(e,n)},$$slots:{default:!0}});var ke=H(Oe,2),Ae=e=>{{let t=I(()=>W(S)||W(a));Rm(e,{get disabled(){return W(t)},icon:`refresh`,label:`Refresh`,onclick:()=>void te()})}};Y(ke,e=>{(W(d)||W(l)?.workspaceSession&&!W(w))&&e(Ae)});var je=H(ke,2),Me=e=>{let t=I(()=>W(l).workspaceSession);{let n=I(()=>W(S)||W(f)||!W(E)||!W(w));Rm(e,{primary:!0,get disabled(){return W(n)},onclick:()=>void ie(W(t).sessionId),children:(e,t)=>{F();var n=Qr();U(()=>J(n,W(s)?`Starting…`:`Replace and execute`)),q(e,n)},$$slots:{default:!0}})}},Ne=e=>{{let t=I(()=>W(S)||W(f)||!W(E));Rm(e,{primary:!0,get disabled(){return W(t)},onclick:()=>void ie(),children:(e,t)=>{F();var n=Qr();U(()=>J(n,W(s)?`Starting…`:`OK`)),q(e,n)},$$slots:{default:!0}})}};Y(je,e=>{W(l)?.workspaceSession?e(Me):e(Ne,-1)}),P(De),P(ue),Zi(ue,e=>z(p,e),()=>W(p)),U(()=>{Z(ue,`aria-labelledby`,`${n}-title`),Z(ue,`aria-describedby`,`${n}-description`),Z(de,`id`,`${n}-title`),Z(A,`id`,`${n}-description`),Z(fe,`for`,`${n}-profile`),Z(pe,`id`,`${n}-profile`),pe.disabled=W(S)}),Hr(`close`,ue,()=>void re()),Hr(`cancel`,ue,ne),G(`keydown`,ue,()=>{g=!1}),G(`pointerdown`,ue,()=>{g=!1}),G(`change`,pe,()=>{W(f)||z(d,``)}),Fi(pe,()=>W(c),e=>z(c,e)),q(e,ae),tt()}Ur([`keydown`,`pointerdown`,`change`]);function UT(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);try{r.href=n,r.download=t,document.body.append(r),r.click()}finally{r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0)}}function WT(e,t){et(t,!0);let n=R(!1),r;na(()=>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;UT(n.blob,n.filename)}catch{e.signal.aborted||t.onerror?.(`Could not download the Org file. Try again.`)}finally{z(n,!1),r=void 0}}{let r=I(()=>W(n)?`waiting`:`download`),a=I(()=>W(n)?`Downloading…`:`Download Org file`),o=I(()=>W(n)||!t.reference||!t.transport);Rm(e,{get icon(){return W(r)},label:`Download Org file`,get tooltip(){return W(a)},get disabled(){return W(o)},onclick:i})}tt()}var GT=/^(\*+)\s+(?:(TODO|WIP|DONE|SUSPENDED)\s+)?(?:\[#([ABC])\]\s+)?(.+)$/,KT=/^#\+([A-Z][A-Z0-9_-]*):\s*(.*)$/i,qT=/^:([A-Z][A-Z0-9_]*):\s*(.*)$/,JT=/^-\s+([^:]+?)\s+::\s*(.*)$/;function YT(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:XT(a.body)})};for(let e of i){let r=GT.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=KT.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=qT.exec(e);t&&a.properties.push([t[1],t[2].trim()]);continue}let i=JT.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:XT(n),sections:r}}function XT(e){let t=[...e];for(;t[0]?.trim()===``;)t.shift();for(;t.at(-1)?.trim()===``;)t.pop();return t}var ZT=K(`<div class="svelte-h7gaqo"><dt class="svelte-h7gaqo"> </dt> <dd class="svelte-h7gaqo"><!></dd></div>`),QT=K(`<dl class="metadata svelte-h7gaqo"></dl>`),$T=K(`<p class="svelte-h7gaqo"><!></p>`),eE=K(`<p class="svelte-h7gaqo">This Org document has no headings.</p>`),tE=K(`<h3 class="svelte-h7gaqo"> </h3>`),nE=K(`<h4 class="svelte-h7gaqo"> </h4>`),rE=K(`<span> </span>`),iE=K(`<span class="priority svelte-h7gaqo"> </span>`),aE=K(`<dl class="descriptions svelte-h7gaqo"></dl>`),oE=K(`<p><!></p>`),sE=K(`<details class="properties svelte-h7gaqo"><summary class="svelte-h7gaqo">Properties</summary> <dl class="svelte-h7gaqo"></dl></details>`),cE=K(`<section class="org-section svelte-h7gaqo"><div class="section-heading svelte-h7gaqo"><!> <!> <!></div> <!> <!> <!></section>`),lE=K(`<div class="sections svelte-h7gaqo"></div>`),uE=K(`<article class="org-document svelte-h7gaqo" aria-labelledby="org-document-title"><!> <!> <!> <!></article>`);function dE(e,t){et(t,!0);let n=Q(t,`closeLabel`,3,`Close plan and return to list`),r=Q(t,`verifiedReferences`,19,()=>new Set),i=I(()=>YT(t.preview.source)),a=I(()=>W(i).metadata.filter(([e])=>e!==`TITLE`));var o=uE(),s=B(o);{let e=I(()=>t.preview.sourcePath||t.sourcePath||t.preview.planName);Xw(s,{get title(){return t.preview.title},titleId:`org-document-title`,get sourcePath(){return W(e)},get oncopyresult(){return t.oncopyresult},get executeAction(){return t.executeAction},get closeLabel(){return n()},get onclose(){return t.onclose}})}var c=H(s,2),l=e=>{var n=QT();X(n,21,()=>W(a),([e,t])=>`${e}:${t}`,(e,n)=>{var i=I(()=>T(W(n),2));let a=()=>W(i)[0],o=()=>W(i)[1];var s=ZT(),c=B(s),l=B(c,!0);P(c);var u=H(c,2),d=B(u);{let e=I(()=>o()||`—`);Fw(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(c,e=>{W(a).length&&e(l)});var u=H(c,2);X(u,19,()=>W(i).preamble,(e,t)=>`preamble:${t}:${e}`,(e,n)=>{var i=$r(),a=V(i),o=e=>{var i=$T();Fw(B(i),{get text(){return W(n)},get onreference(){return t.onreference},get verifiedReferences(){return r()}}),P(i),q(e,i)},s=I(()=>W(n).trim());Y(a,e=>{W(s)&&e(o)}),q(e,i)});var d=H(u,2),f=e=>{q(e,eE())},p=e=>{var n=lE();X(n,23,()=>W(i).sections,(e,t)=>`${t}:${e.level}:${e.title}`,(e,n)=>{var i=cE();let a;var o=B(i),s=B(o),c=e=>{var t=tE(),r=B(t,!0);P(t),U(()=>J(r,W(n).title)),q(e,t)},l=e=>{var t=nE(),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=rE(),r=B(t,!0);P(t),U(e=>{Ai(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=iE(),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=aE();X(i,21,()=>W(n).descriptions,([e,t])=>`${e}:${t}`,(e,n)=>{var i=I(()=>T(W(n),2));let a=()=>W(i)[0],o=()=>W(i)[1];var s=ZT(),c=B(s),l=B(c,!0);P(c);var u=H(c,2),d=B(u);{let e=I(()=>o()||`—`);Fw(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=$r(),a=V(i),o=e=>{var i=oE();let a;Fw(B(i),{get text(){return W(n)},get onreference(){return t.onreference},get verifiedReferences(){return r()}}),P(i),U(e=>a=Ai(i,1,`svelte-h7gaqo`,null,a,e),[()=>({"list-item":W(n).trimStart().startsWith(`- `)})]),q(e,i)},s=I(()=>W(n).trim());Y(a,e=>{W(s)&&e(o)}),q(e,i)});var _=H(g,2),v=e=>{var i=sE(),a=H(B(i),2);X(a,21,()=>W(n).properties,([e,t])=>`${e}:${t}`,(e,n)=>{var i=I(()=>T(W(n),2));let a=()=>W(i)[0],o=()=>W(i)[1];var s=ZT(),c=B(s),l=B(c,!0);P(c);var u=H(c,2),d=B(u);{let e=I(()=>o()||`—`);Fw(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=Mi(i,``,a,e),[()=>({"--org-depth":Math.max(0,W(n).level-1)})]),q(e,i)}),P(n),q(e,n)};Y(d,e=>{W(i).sections.length===0?e(f):e(p,-1)}),P(o),q(e,o),tt()}var fE=K(`<span class="subtitle svelte-x2ko9l"> </span>`),pE=K(`<div class="catalog-progress svelte-x2ko9l"><progress class="svelte-x2ko9l"> </progress> <span class="svelte-x2ko9l"> </span></div> <!>`,1),mE=K(`<span class="subtitle svelte-x2ko9l">Org document</span>`),hE=K(`<span class="archive-tag svelte-x2ko9l">Archived</span>`),gE=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>`),_E=K(`<div class="plan-controls svelte-x2ko9l"><!> <!></div>`),vE=K(`<p>Waiting for the application workspace…</p>`),yE=K(`<p>Finding Org plans…</p>`),bE=K(`<p> </p>`),xE=K(`<p>No .org files were found in .gestalt folders below the application workspace.</p>`),SE=K(`<ul aria-label="Unfinished plans" class="svelte-x2ko9l"></ul>`),CE=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>`),wE=K(`<p class="scope svelte-x2ko9l">Org plans in .gestalt folders below the application workspace.</p> <!> <!>`,1),TE=K(`<section class="plans svelte-x2ko9l" aria-labelledby="plans-title"><div class="catalog-heading svelte-x2ko9l"><h2 id="plans-title" class="view-title svelte-x2ko9l" tabindex="-1">ORG Plans</h2> <span role="status">(updating…)</span></div> <!></section>`);function EE(e,t){et(t,!0);let n=(e,n=b)=>{var r=gE(),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=pE(),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=fE(),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}`),Hi(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,mE())};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,hE())};Y(m,e=>{n().archived&&e(_)}),P(a);var v=H(a,2),y=B(v);{let e=I(()=>`${n().allDone||n().archived?`Reopen`:`Open`} ${n().title}`);Rm(y,{icon:`open`,get label(){return W(e)},onclick:()=>h(n().planName)})}var x=H(y,2),S=e=>{{let r=I(()=>`Archive ${n().title}`),a=I(()=>!t.onarchive||n().archived||i().includes(n().planName));Rm(e,{get label(){return W(r)},get disabled(){return W(a)},onclick:()=>g(n().planName),children:(e,t)=>{F();var r=Qr();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),Zi(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=_E(),r=B(n);WT(r,{get reference(){return t.executeReference},get transport(){return t.downloadTransport},get onerror(){return t.ondownloaderror}}),HT(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(ln(new Set));Fn(()=>{let e=jw(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=ln({}),c=R(null),l=R(null),u=!1,d=!1,f=I(()=>t.catalog.kind===`ready`?t.catalog.entries.filter(e=>e.allDone!==!0&&!e.archived):[]),p=I(()=>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)}Fn(()=>{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 _=$r(),v=V(_),y=e=>{dE(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=>{vT(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=TE(),i=B(r),a=B(i);Zi(a,e=>z(o,e),()=>W(o));var s=H(a,2);P(i);var c=H(i,2),l=e=>{q(e,vE())},u=e=>{q(e,yE())},d=e=>{var n=bE(),r=B(n,!0);P(n),U(()=>J(r,t.catalog.error)),q(e,n)},m=e=>{q(e,xE())},h=e=>{var t=wE(),r=H(V(t),2),i=e=>{var t=SE();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=CE(),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(()=>{Ai(s,1,wi([`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,_),tt()}var DE=K(`<dialog class="plan-overlay svelte-wabv1" aria-label="Plan viewer"><!></dialog>`);function OE(e,t){et(t,!0);let n;ta(()=>(n.showModal(),()=>n.close()));var r=DE();vi(B(r),()=>t.children),P(r),Zi(r,e=>n=e,()=>n),Hr(`cancel`,r,e=>{e.preventDefault(),t.onclose()}),q(e,r),tt()}async function kE(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 AE=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()}},jE=`settings`,ME=`drafts`,NE=`cursors`,PE=`selected-session`,FE={text:``,revision:0},IE=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 LE(e=globalThis.indexedDB){if(!e)return RE;let t=Zx(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 $x(await t,ME,e,i)}catch{}});n.set(e,o),await o};return{async readSelectedSession(){try{return await Qx(await t,jE,PE)??null}catch{return null}},async saveSelectedSession(e){try{let n=await t;e?await $x(n,jE,PE,e):await eS(n,jE,PE)}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 Qx(await t,ME,e),i=IE(n)?n:typeof n==`string`?{text:n,revision:0}:FE,a=r.get(e);return a&&a.revision>=i.revision?a:(r.set(e,i),i)}catch{return r.get(e)??FE}},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)??FE;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 Qx(await t,ME,e);n=IE(r)?r:typeof r==`string`?{text:r,revision:0}:FE}catch{n=FE}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 $x(await t,ME,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 Qx(await t,NE,e);return typeof n==`number`&&Number.isSafeInteger(n)&&n>=0?n:0}catch{return 0}},async saveCursor(e,n){try{await $x(await t,NE,e,n)}catch{}}}}var RE={readSelectedSession:async()=>null,saveSelectedSession:async()=>{},readDraft:async()=>``,saveDraft:async()=>{},readDraftEnvelope:async()=>FE,saveDraftEnvelope:async()=>{},replaceDraftText:async()=>{},addPendingDraftOperation:async()=>{},consumeAcceptedDraft:async()=>null,readCursor:async()=>0,saveCursor:async()=>{}},zE=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>`),VE=K(`<label class="auto-reset svelte-1wyi1so"><input type="checkbox" class="svelte-1wyi1so"/> Use when over</label>`),HE=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 UE(e,t){et(t,!0);let n=Q(t,`useWhenOver`,3,null),r=Q(t,`savingAutoReset`,3,!1),i=R(null),a=R(!0),o=R(ln(Date.now())),s=I(()=>{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(` `)}`});ta(()=>{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=HE(),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=zE();U(()=>Hi(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=VE(),a=B(i);Vi(a),F(),P(i),U(()=>{Ui(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),tt()}Ur([`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 GE(e){return e!==void 0&&e.phase!==`failed`&&e.phase!==`completed`}function KE(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 qE=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 GE(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);GE(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||!KE(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)),GE(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)}},JE=(e,t=b)=>{var n=ZE(),r=H(B(n),1,!0);P(n),U(()=>J(r,t())),q(e,n)},YE=(e,t=b)=>{var n=$r(),r=V(n),i=e=>{var n=$E(),r=B(n),i=e=>{q(e,QE())},a=I(()=>GE(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)},XE=(e,t=b)=>{var n=rD(),r=V(n),i=e=>{q(e,eD())},a=I(()=>bT(t()));Y(r,e=>{W(a)&&e(i)});var o=H(r,2),s=e=>{var n=tD(),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=nD(),r=B(n);{let e=I(()=>`Plan progress for ${t().plan.title}`);Gw(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)},ZE=K(`<p class="loading-sessions svelte-hxb22h" role="status"><span class="session-spinner svelte-hxb22h" aria-hidden="true"></span> </p>`),QE=K(`<span class="session-spinner forget-spinner svelte-hxb22h" aria-hidden="true"></span>`),$E=K(`<p class="session-forget-status svelte-hxb22h" role="status" aria-atomic="true"><!> <span> </span></p>`),eD=K(`<span class="profile-badge svelte-hxb22h">Org plan attached</span>`),tD=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>`),nD=K(`<div class="session-plan-progress svelte-hxb22h"><!></div>`),rD=K(`<!> <!> <!>`,1),iD=K(`<details class="self-debug-details"><summary class="svelte-hxb22h">Self DEBUG</summary> <!> <button type="button">Redacted diagnostic trace (JSON)</button></details>`),aD=K(`<time class="svelte-hxb22h"> </time>`),oD=K(`<div> </div>`),sD=K(`<span class="profile-badge svelte-hxb22h"> </span>`),cD=K(`<span class="profile-badge svelte-hxb22h">Kimi</span>`),lD=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>`),uD=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>`),dD=K(`<li><div class="session-actions svelte-hxb22h"><!> <!> <!> <!> <!> <!></div> <div class="session-details svelte-hxb22h"><!> <!> <!> <div class="workspace-path svelte-hxb22h"> </div> <!> <!> <!> <!> <!></div></li>`),fD=K(`<h3>Saved sessions</h3> <ul class="session-list svelte-hxb22h" aria-label="Saved sessions"></ul>`,1),pD=K(`<p class="empty-sessions svelte-hxb22h"> </p>`),mD=K(`<option> </option>`),hD=K(`<option>Loading models…</option>`),gD=K(`<option>Choose automatically</option>`),_D=K(`<p class="skills-profile-error svelte-hxb22h" role="alert"> </p>`),vD=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>`),yD=K(`<label for="model-thinking" class="svelte-hxb22h">Model thinking <select id="model-thinking" class="svelte-hxb22h"></select></label>`),bD=K(`<label for="sandbox" class="svelte-hxb22h">Sandbox</label> <label for="approval-policy" class="svelte-hxb22h">Approval policy</label>`,1),xD=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),SD=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>`),CD=K(`<ul class="session-list recent-session-list svelte-hxb22h" aria-label="Recent sessions"></ul>`),wD=K(`<p> </p>`),TD=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),ED=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">Sessions</h2> <!> <!> <!> <!></section>`,1);function DD(e,t){et(t,!0);let n=(e,n=b)=>{let r=I(()=>l().get(n().id)),i=I(()=>W(r)?W(r).operation:n().forgetOperation);var a=$r(),o=V(a),s=e=>{Rm(e,{class:`keep-temporary-files`,compact:!0,full:!0,onclick:()=>t.onforget(n().id,W(i).operationId),children:(e,t)=>{F(),q(e,Qr(`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(s)}),q(e,a)},r=(e,n=b)=>{var r=$r(),i=V(r),a=e=>{{let r=I(()=>`Plan for ${n().plan?.title??n().lastOrgPlan?.title??`session`}`);Rm(e,{icon:`plan`,get label(){return W(r)},onclick:()=>t.onplan?.(n().id)})}},o=I(()=>n()&&t.onplan&&bT(n()));Y(i,e=>{W(o)&&e(a)}),q(e,r)},i=(e,t=b)=>{var n=$r(),r=V(n),i=e=>{var n=iD(),r=H(B(n),2);Km(r,{get context(){return t().selfDebug.context}});var i=H(r,2);P(n),G(`click`,i,e=>oe()(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,`rosterState`,3,`ready`),c=Q(t,`recentListState`,3,`ready`),l=Q(t,`forgettingStates`,19,()=>new Map),u=Q(t,`activitySnapshots`,19,()=>new Map),d=Q(t,`autopilotSnapshots`,19,()=>new Map),f=Q(t,`autopilotPending`,19,()=>new Set),p=Q(t,`autopilotAttention`,19,()=>new Map),m=Q(t,`models`,19,()=>[]),h=Q(t,`selectedModel`,3,``),g=Q(t,`reasoningEffort`,3,`medium`),_=Q(t,`executorModels`,19,()=>[]),v=Q(t,`executorModel`,3,`gpt-5.6-terra`),y=Q(t,`executorReasoningEffort`,3,`high`),x=Q(t,`onreasoningchange`,3,()=>{}),S=Q(t,`onexecutormodelchange`,3,()=>{}),C=Q(t,`onexecutorreasoningchange`,3,()=>{}),w=Q(t,`provider`,3,`codex`),T=Q(t,`kimiAvailable`,3,!1),E=Q(t,`modelsLoading`,3,!1),D=Q(t,`onmodelchange`,3,()=>{}),O=Q(t,`onproviderchange`,3,()=>{}),k=Q(t,`onautopilottoggle`,3,()=>{}),ee=Q(t,`onactivityopen`,3,()=>{}),te=Q(t,`onautopilotresolve`,3,()=>{}),ne=Q(t,`debugPending`,3,!1),re=Q(t,`savingDefaults`,3,!1),ie=Q(t,`advancedExpanded`,15,!1),ae=Q(t,`onsavedefaults`,3,()=>{}),oe=Q(t,`ondebugtrace`,3,()=>{}),se=I(()=>t.sessions.filter(e=>e.state===`ready`||e.state===`turnActive`)),ce=I(()=>t.sessions.filter(e=>e.state!==`ready`&&e.state!==`turnActive`)),le=I(()=>t.recentSessions.filter(e=>!t.sessions.some(t=>(t.state===`ready`||t.state===`turnActive`||l().has(t.id)||t.forgetOperation)&&t.threadId===e.id&&(t.provider??`codex`)===(e.provider??`codex`)))),ue=I(()=>MC(t.workspaceTree,t.workspaceId)),de=R(null),A=R(null);function fe(e){GE(l().get(e))||(z(A,e,!0),W(de)?.showModal())}var pe=ED(),me=V(pe),he=H(B(me),4),ge=B(he);Rm(ge,{onclick:()=>W(de)?.close(),children:(e,t)=>{F(),q(e,Qr(`Cancel`))},$$slots:{default:!0}}),Rm(H(ge,2),{primary:!0,onclick:()=>{W(A)&&t.onclose(W(A)),W(de)?.close()},children:(e,t)=>{F(),q(e,Qr(`Close session`))},$$slots:{default:!0}}),P(he),P(me),Zi(me,e=>z(de,e),()=>W(de));var _e=H(me,2);let ve;var ye=B(_e);let be;var xe=H(ye,2),Se=e=>{UE(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(xe,e=>{t.allowanceFetcher&&e(Se)});var j=H(xe,2),M=e=>{var o=uD(),s=H(B(o),2);X(s,21,()=>W(se),e=>e.id,(e,o)=>{let s=I(()=>xT(W(o))),c=I(()=>l().get(W(o).id)??W(o).forgetOperation),h=I(()=>GE(W(c)));var g=lD();let _;var v=B(g),y=B(v);{let e=I(()=>W(o).id===t.selectedSessionId?`page`:void 0);Rm(y,{compact:!0,icon:`open`,label:`Open`,get current(){return W(e)},get disabled(){return W(h)},onclick:()=>t.onselectopen(W(o).id)})}var b=H(y,2);r(b,()=>W(o));var x=H(b,2),S=e=>{Rm(e,{icon:`cli`,label:`Copy CLI`,onclick:()=>t.oncopyresume(W(o).resumeCommand)})};Y(x,e=>{W(o).resumeCommand&&W(o).provider!==`kimi`&&e(S)});var C=H(x,2),w=e=>{{let t=I(()=>d().get(W(o).id)??W(o).autopilot??null),n=I(()=>`session-autopilot-${W(o).id}`),r=I(()=>W(h)||f().has(W(o).id));Eg(e,{compact:!0,get autopilot(){return W(t)},get controlId(){return W(n)},get pending(){return W(r)},ontoggle:e=>k()(W(o).id,e)})}},T=I(()=>bT(W(o))&&W(o).provider!==`kimi`);Y(C,e=>{W(T)&&e(w)});var E=H(C,2);Rm(E,{icon:`close`,label:`Close`,get disabled(){return W(h)},onclick:()=>fe(W(o).id)});var D=H(E,2),O=e=>{{let t=I(()=>a()?`start`:`end`),n=I(()=>u().get(W(o).id)??W(o).agentActivity??null),r=I(()=>W(o).model??m()?.[0]);Vh(e,{compact:!0,get popupAlign(){return W(t)},get activity(){return W(n)},get rootModel(){return W(r)},get plan(){return W(o).plan},onopen:()=>ee()(W(o).id)})}},re=I(()=>bT(W(o)));Y(D,e=>{W(re)&&e(O)});var ie=H(D,2),ae=e=>{Rm(e,{compact:!0,full:!0,get disabled(){return W(h)},onclick:()=>t.onforget(W(o).id),children:(e,t)=>{F();var n=Qr();U(()=>J(n,W(c).phase===`failed`?`Retry Forget`:`Forget`)),q(e,n)},$$slots:{default:!0}})};Y(ie,e=>{W(c)&&e(ae)});var oe=H(ie,2);n(oe,()=>W(o));var se=H(oe,2),ce=e=>{Rm(e,{compact:!0,full:!0,onclick:()=>t.onopen(W(o).forgetOperation.blockingSessionId),children:(e,t)=>{F(),q(e,Qr(`Open blocking session`))},$$slots:{default:!0}})};Y(se,e=>{W(o).forgetOperation?.blockingSessionId&&e(ce)}),P(v);var le=H(v,2),ue=B(le);YE(ue,()=>W(c));var de=H(ue,2);i(de,()=>W(o));var A=H(de,2),pe=B(A);TT(pe,{get status(){return W(o).sessionStatus}});var me=H(pe,2),he=e=>{var t=aD(),n=B(t,!0);P(t),U((e,r)=>{Z(t,`datetime`,e),J(n,r)},[()=>new Date(W(s).updatedAt).toISOString(),()=>WE(W(s).updatedAt)]),q(e,t)},ge=e=>{var t=oD(),n=B(t,!0);P(t),U(e=>J(n,e),[()=>WE(null)]),q(e,t)};Y(me,e=>{W(s).updatedAt===null?e(ge,-1):e(he)});var _e=H(me,2),ve=B(_e,!0);P(_e);var ye=H(_e,2),be=e=>{var t=sD(),n=B(t);P(t),U(()=>J(n,`Model: ${W(o).model??``}`)),q(e,t)};Y(ye,e=>{W(o).model&&e(be)});var xe=H(ye,2),Se=e=>{q(e,cD())};Y(xe,e=>{W(o).provider===`kimi`&&e(Se)});var j=H(xe,2),M=e=>{var t=sD(),n=B(t);P(t),U(()=>J(n,`Branch: ${W(o).branch??``}`)),q(e,t)};Y(j,e=>{W(o).branch&&e(M)});var Ce=H(j,2),we=e=>{var t=sD(),n=B(t);P(t),U(()=>J(n,`Skills profile: ${W(o).effectiveSkillSelection.selectedProfileName??``}`)),q(e,t)};Y(Ce,e=>{W(o).effectiveSkillSelection?.selectedProfileName&&e(we)}),XE(H(Ce,2),()=>W(o)),P(A);var Te=H(A,2);{let e=I(()=>p().get(W(o).id)??null),n=I(()=>`session-attention-${W(o).id}`),r=I(()=>W(h)||f().has(W(o).id)),i=I(()=>W(o).threadId&&t.onattentiondebug?(e,n)=>t.onattentiondebug?.(W(o).id,e,n):void 0);ev(Te,{get attention(){return W(e)},get controlId(){return W(n)},get pending(){return W(r)},onresolve:(e,t)=>te()(W(o).id,e,t),get ondebug(){return W(i)},get debugPending(){return ne()}})}var Ee=H(Te,2);{let e=I(()=>d().get(W(o).id)??W(o).autopilot??null),t=I(()=>p().get(W(o).id)??null),n=I(()=>`session-autopilot-safety-${W(o).id}`),r=I(()=>W(h)||f().has(W(o).id));jg(Ee,{get autopilot(){return W(e)},get attention(){return W(t)},get controlId(){return W(n)},get pending(){return W(r)},onrecover:()=>k()(W(o).id,!0),ondisable:()=>k()(W(o).id,!1)})}P(le),P(g),U((e,t)=>{_=Ai(g,1,`managed-session open-session svelte-hxb22h`,null,_,e),Z(g,`aria-busy`,W(h)),Z(g,`data-session-id`,W(o).id),J(ve,t)},[()=>({"current-session":W(o).id===t.selectedSessionId,"plan-session":bT(W(o))}),()=>CT(W(s).workspacePath)]),q(e,g)}),P(s),P(o),q(e,o)};Y(j,e=>{W(se).length&&e(M)});var Ce=H(j,2),we=e=>{var a=fD(),o=H(V(a),2);X(o,21,()=>W(ce),e=>e.id,(e,a)=>{let o=I(()=>xT(W(a))),s=I(()=>l().get(W(a).id)??W(a).forgetOperation),c=I(()=>GE(W(s)));var u=dD();let d;var f=B(u),p=B(f);{let e=I(()=>t.openingSessionId===W(a).id?`waiting`:`open`),n=I(()=>t.openingSessionId===W(a).id?`Opening…`:`Open`),r=I(()=>W(c)||t.openingSessionId===W(a).id);Rm(p,{get icon(){return W(e)},get label(){return W(n)},get disabled(){return W(r)},onclick:()=>t.onopen(W(a).id)})}var m=H(p,2);r(m,()=>W(a));var h=H(m,2),g=e=>{Rm(e,{icon:`cli`,label:`Copy CLI`,onclick:()=>t.oncopyresume(W(a).resumeCommand)})};Y(h,e=>{W(a).resumeCommand&&W(a).provider!==`kimi`&&e(g)});var _=H(h,2);Rm(_,{compact:!0,full:!0,get disabled(){return W(c)},onclick:()=>t.onforget(W(a).id),children:(e,t)=>{F();var n=Qr();U(()=>J(n,W(s)?.phase===`failed`?`Retry Forget`:`Forget`)),q(e,n)},$$slots:{default:!0}});var v=H(_,2);n(v,()=>W(a));var y=H(v,2),b=e=>{Rm(e,{compact:!0,full:!0,onclick:()=>t.onopen(W(a).forgetOperation.blockingSessionId),children:(e,t)=>{F(),q(e,Qr(`Open blocking session`))},$$slots:{default:!0}})};Y(y,e=>{W(a).forgetOperation?.blockingSessionId&&e(b)}),P(f);var x=H(f,2),S=B(x);YE(S,()=>W(s));var C=H(S,2);i(C,()=>W(a));var w=H(C,2),T=e=>{var t=aD(),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)},E=e=>{var t=oD(),n=B(t,!0);P(t),U(e=>J(n,e),[()=>WE(null)]),q(e,t)};Y(w,e=>{W(o).updatedAt===null?e(E,-1):e(T)});var D=H(w,2),O=B(D,!0);P(D);var k=H(D,2),ee=e=>{var t=sD(),n=B(t);P(t),U(()=>J(n,`Model: ${W(a).model??``}`)),q(e,t)};Y(k,e=>{W(a).model&&e(ee)});var te=H(k,2),ne=e=>{q(e,cD())};Y(te,e=>{W(a).provider===`kimi`&&e(ne)});var re=H(te,2),ie=e=>{var t=sD(),n=B(t);P(t),U(()=>J(n,`Branch: ${W(a).branch??``}`)),q(e,t)};Y(re,e=>{W(a).branch&&e(ie)});var ae=H(re,2),oe=e=>{var t=sD(),n=B(t);P(t),U(()=>J(n,`Skills profile: ${W(a).effectiveSkillSelection.selectedProfileName??``}`)),q(e,t)};Y(ae,e=>{W(a).effectiveSkillSelection?.selectedProfileName&&e(oe)}),XE(H(ae,2),()=>W(a)),P(x),P(u),U((e,t)=>{d=Ai(u,1,`managed-session svelte-hxb22h`,null,d,e),Z(u,`aria-busy`,W(c)),Z(u,`data-session-id`,W(a).id),J(O,t)},[()=>({"plan-session":bT(W(a))}),()=>CT(W(o).workspacePath)]),q(e,u)}),P(o),q(e,a)},Te=e=>{var t=$r(),n=V(t),r=e=>{JE(e,()=>`Loading sessions…`)},i=e=>{var t=pD(),n=B(t,!0);P(t),U(()=>J(n,s()===`error`?`Sessions could not be loaded.`:`No saved sessions yet.`)),q(e,t)};Y(n,e=>{s()===`loading`?e(r):e(i,-1)}),q(e,t)};Y(Ce,e=>{W(ce).length?e(we):W(se).length||e(Te,1)});var Ee=H(Ce,2),De=e=>{var n=TD(),i=V(n),a=H(B(i),2),o=B(a);{let e=I(()=>W(ue)?.id??null);BC(o,{get roots(){return t.workspaceTree},get expandedIds(){return t.expandedIds},get selectedId(){return W(e)},get isSelectable(){return DC.sessionBase},label:`Session base`,get onexpandedchange(){return t.onexpandedchange},onselect:e=>t.onworkspacechange(e.id)})}P(a);var l=H(a,2),u=B(l),d=H(B(u)),f=B(d);X(f,17,()=>t.skillProfiles,e=>e.name,(e,t)=>{var n=mD(),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 p=H(f);p.value=p.__value=``,P(d);var b;Pi(d),P(u);var k=H(u,2),ee=H(B(k)),te=B(ee),ne=e=>{var t=hD();t.value=t.__value=``,q(e,t)},oe=e=>{var t=gD();t.value=t.__value=``,q(e,t)};Y(te,e=>{E()?e(ne):m().length===0&&e(oe,1)}),X(H(te),16,m,e=>e,(e,t)=>{var n=mD(),r=B(n,!0);P(n);var i={};U(()=>{J(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),q(e,n)}),P(ee);var se;Pi(ee),P(k),P(l);var de=H(l,2),A=e=>{var n=_D(),r=B(n,!0);P(n),U(()=>J(r,t.skillProfileError)),q(e,n)};Y(de,e=>{t.skillProfileError&&e(A)});var fe=H(de,2),pe=H(B(fe),2),me=B(pe),he=B(me),ge=B(he),_e=e=>{var t=vD(),n=H(B(t),2),r=H(B(n));X(r,20,()=>[...new Set([v(),..._()])],e=>e,(e,t)=>{var n=mD(),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;Pi(r),P(n);var a=H(n,2),o=H(B(a));X(o,20,()=>rm,e=>e,(e,t)=>{var n=mD(),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;Pi(o),P(a),P(t),U(()=>{i!==(i=v())&&(r.value=(r.__value=v())??``,Ni(r,v())),s!==(s=y())&&(o.value=(o.__value=y())??``,Ni(o,y()))}),G(`change`,r,e=>S()(e.currentTarget.value)),G(`change`,o,e=>C()(e.currentTarget.value)),q(e,t)};Y(ge,e=>{w()===`codex`&&e(_e)});var ve=H(ge,2),ye=H(B(ve),2),be=e=>{var t=yD(),n=H(B(t));X(n,20,()=>rm,e=>e,(e,t)=>{var n=mD(),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;Pi(n),P(t),U(()=>{r!==(r=g())&&(n.value=(n.__value=g())??``,Ni(n,g()))}),G(`change`,n,e=>x()(e.currentTarget.value)),q(e,t)};Y(ye,e=>{w()===`codex`&&e(be)});var xe=H(ye,2),Se=H(B(xe),2),j=B(Se);j.value=j.__value=`codex`;var M=H(j),Ce=B(M);P(M),M.value=M.__value=`kimi`,P(Se);var we;Pi(Se),P(xe),P(ve),P(he);var Te=H(he,2);let Ee;var De=B(Te),Oe=e=>{var t=bD();F(2),q(e,t)};Y(De,e=>{w()!==`kimi`&&e(Oe)}),P(Te);var ke=H(Te,2);let Ae;var je=B(ke),Me=e=>{var n=xD(),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;Pi(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;Pi(l),U(()=>{c!==(c=t.sandbox)&&(r.value=(r.__value=t.sandbox)??``,Ni(r,t.sandbox)),p!==(p=t.approvalPolicy)&&(l.value=(l.__value=t.approvalPolicy)??``,Ni(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(je,e=>{w()!==`kimi`&&e(Me)}),P(ke);var Ne=H(ke,2),Pe=B(Ne);Rm(Pe,{class:`manage-profiles-button`,id:`manage-skill-profiles`,onclick:e=>t.onmanageprofiles(e.currentTarget),children:(e,t)=>{F(),q(e,Qr(`Manage skill profiles`))},$$slots:{default:!0}});var Fe=H(Pe,2);{let e=I(()=>re()||E()||!h());Rm(Fe,{class:`save-defaults-button`,get disabled(){return W(e)},get onclick(){return ae()},children:(e,t)=>{F();var n=Qr();U(()=>J(n,re()?`Saving…`:`Save as defaults`)),q(e,n)},$$slots:{default:!0}})}P(Ne),P(me),P(pe),P(fe);var Ie=H(fe,2),Le=B(Ie),Re=e=>{Rm(e,{type:`button`,onclick:()=>t.onopen(t.workspaceConflictSessionId),children:(e,t)=>{F(),q(e,Qr(`Open running session`))},$$slots:{default:!0}})};Y(Le,e=>{t.workspaceConflictSessionId&&e(Re)});var ze=H(Le,2);{let e=I(()=>!W(ue)||t.startingSession||E()||m().length>0&&!h());Rm(ze,{class:`new-session-button`,type:`submit`,full:!0,primary:!0,get disabled(){return W(e)},children:(e,n)=>{F();var r=Qr();U(()=>J(r,t.startingSession?`Creating…`:`Create session`)),q(e,r)},$$slots:{default:!0}})}P(Ie),P(i);var Be=H(i,2),N=H(B(Be),2),Ve=e=>{JE(e,()=>`Loading recent sessions…`)},He=e=>{var n=CD();X(n,21,()=>W(le),e=>(e.provider??`codex`)+`:`+e.id,(e,n)=>{let i=I(()=>W(ce).find(e=>e.threadId===W(n).id&&(e.provider??`codex`)===(W(n).provider??`codex`)&&bT(e)));var a=SD(),o=B(a),s=B(o),c=e=>{var t=aD(),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=oD(),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=sD(),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,cD())};Y(m,e=>{W(n).provider===`kimi`&&e(h)});var g=H(m,2),_=e=>{var t=sD(),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=sD(),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);Rm(x,{icon:`open`,label:`Open`,onclick:()=>t.onopenrecent(W(n))});var S=H(x,2);r(S,()=>W(i));var C=H(S,2),w=e=>{Rm(e,{icon:`cli`,label:`Copy to CLI`,onclick:()=>t.oncopyresume(W(n).resumeCommand)})};Y(C,e=>{W(n).resumeCommand&&e(w)}),P(b),P(a),U(e=>J(d,e),[()=>CT(W(n).cwd)]),q(e,a)}),P(n),q(e,n)},Ue=e=>{var t=wD(),n=B(t,!0);P(t),U(()=>J(n,c()===`error`?`Recent sessions could not be loaded.`:`No other recent sessions found.`)),q(e,t)};Y(N,e=>{c()===`loading`||s()===`loading`&&t.recentSessions.length>0?e(Ve):W(le).length?e(He,1):e(Ue,-1)}),P(Be),U(()=>{b!==(b=t.selectedSkillProfile)&&(d.value=(d.__value=t.selectedSkillProfile)??``,Ni(d,t.selectedSkillProfile)),ee.disabled=E()||m().length===0,se!==(se=h())&&(ee.value=(ee.__value=h())??``,Ni(ee,h())),M.disabled=!T(),J(Ce,`Kimi${T()?``:` (unavailable)`}`),we!==(we=w())&&(Se.value=(Se.__value=w())??``,Ni(Se,w())),Ee=Mi(Te,``,Ee,{"grid-template-columns":w()===`kimi`?`minmax(0, 1fr)`:`repeat(2, minmax(0, 1fr))`}),Ae=Mi(ke,``,Ae,{"grid-template-columns":w()===`kimi`?`minmax(0, 1fr)`:`repeat(2, minmax(0, 1fr))`})}),Hr(`submit`,i,e=>{e.preventDefault(),t.onstart()}),G(`change`,d,e=>t.onskillprofilechange(e.currentTarget.value)),G(`change`,ee,e=>D()(e.currentTarget.value)),G(`change`,Se,e=>O()(e.currentTarget.value)),Qi(`open`,`toggle`,fe,ie,ie),q(e,n)};Y(Ee,e=>{a()||e(De)}),P(_e),U(()=>{ve=Ai(_e,1,`svelte-hxb22h`,null,ve,{"roster-only":a()}),be=Ai(ye,1,`view-title`,null,be,{"visually-hidden":a()})}),Hr(`close`,me,()=>z(A,null)),q(e,pe),tt()}Ur([`click`,`change`]);function OD(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 kD=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 AD({chatEnabled:e}){return[`sessions`,`git`,...e?[`chat`]:[],`plan`]}function jD(e,t,n={chatEnabled:!0}){let r=AD(n);return r[(r.indexOf(e)+t+r.length)%r.length]}var MD=K(`<button><!> </button>`),ND=K(`<nav class="bottom-navigation" aria-label="Primary"></nav>`);function PD(e,t){et(t,!0);let n=[{tab:`sessions`,label:`Sessions`},{tab:`git`,label:`Git`},{tab:`chat`,label:`Chat`},{tab:`plan`,label:`Plan`}],r=Q(t,`focusTab`,3,null),i=ln({});Fn(()=>{r()&&i[r()]?.focus()});function a(e){let n=e.key===`ArrowRight`?1:e.key===`ArrowLeft`?-1:null;if(n===null)return;e.preventDefault();let r=jD(t.activeTab,n,{chatEnabled:t.chatEnabled});t.onselect(r),i[r]?.focus()}var o=ND();X(o,21,()=>n,({tab:e,label:t})=>e,(e,n)=>{let r=()=>W(n).tab,o=()=>W(n).label;var s=MD(),c=B(s);sa(c,{get name(){return r()},size:`18px`});var l=H(c);P(s),Zi(s,(e,t)=>i[t]=e,e=>i?.[e],()=>[r()]),U(()=>{Z(s,`aria-pressed`,t.activeTab===r()),s.disabled=r()===`chat`&&!t.chatEnabled,J(l,` ${o()??``}`)}),G(`keydown`,s,a),G(`click`,s,()=>t.onselect(r())),q(e,s)}),P(o),q(e,o),tt()}Ur([`keydown`,`click`]);var FD=K(`<option> </option>`),ID=K(`<p id="skills-status" aria-live="polite">Loading skills…</p>`),LD=K(`<p id="skills-status">No skills were discovered for this workspace and Codex profile.</p>`),RD=K(`<p id="skills-status" class="notice svelte-dg6sjj" role="status"> </p>`),zD=K(`<p id="skills-status" class="error svelte-dg6sjj" role="alert"> </p>`),BD=K(`<p id="skills-status" role="status" tabindex="-1"> </p>`),VD=K(`<p id="skills-status" role="status">Profile saved.</p>`),HD=K(`<p id="skills-status" role="status">Profile deleted.</p>`),UD=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>`),WD=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>`),GD=K(`<span class="verified-badge svelte-dg6sjj">Gestalt verified</span>`),KD=K(`<p class="svelte-dg6sjj"> </p>`),qD=K(`<li> </li>`),JD=K(`<dt class="svelte-dg6sjj">Tool dependencies</dt> <dd class="svelte-dg6sjj"><ul class="svelte-dg6sjj"></ul></dd>`,1),YD=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>`),XD=K(`<div class="skills-toolbar svelte-dg6sjj"><button type="button" class="refresh-skills svelte-dg6sjj" aria-label="Refresh skills" title="Refresh skills"><!></button> <p class="summary svelte-dg6sjj"> </p></div> <!> <ul class="skill-list svelte-dg6sjj"></ul>`,1),ZD=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 QD(e,t){et(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=I(()=>(W(i),n())),d=I(()=>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 kr(),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 kr(),W(o)?.focus()}async function v(){W(c)?.close(),await kr(),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=ZD(),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=FD(),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),Zi(D,e=>z(o,e),()=>W(o));var te=H(D,4);Vi(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);Vi(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);Zi(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),Zi(fe,e=>z(c,e),()=>W(c));var ve=H(fe,2),ye=e=>{q(e,ID())},be=e=>{q(e,LD())},xe=e=>{var t=RD(),n=B(t);P(t),U(()=>J(n,`Discovery warning: ${W(u).status.message??``}`)),q(e,t)},Se=e=>{var t=zD(),n=B(t,!0);P(t),U(()=>J(n,W(u).status.message)),q(e,t)},j=e=>{var t=BD(),n=B(t,!0);P(t),Zi(t,e=>z(a,e),()=>W(a)),U(()=>J(n,W(u).status.message)),q(e,t)},M=e=>{q(e,VD())},Ce=e=>{q(e,HD())},we=e=>{var t=zD(),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(M,5):W(u).status.kind===`deleted`?e(Ce,6):W(u).status.kind===`delete-failed`&&e(we,7)});var Te=H(ve,2),Ee=e=>{var t=XD(),n=V(t),r=B(n);sa(B(r),{name:`refresh`}),P(r);var i=H(r,2),a=B(i);P(i),P(n);var o=H(n,2),s=e=>{var t=WD(),n=H(B(t),4);X(n,21,()=>W(u).missingSkills,e=>e.path,(e,t)=>{var n=UD(),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=YD();let r;var i=B(n),a=B(i);Vi(a);var o=H(a,2),s=B(o),c=B(s,!0);P(s);var l=H(s,2),d=e=>{q(e,GD())};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=KD(),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=KD(),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=JD(),r=H(V(n),2),i=B(r);X(i,21,()=>W(t).dependencies.tools,e=>`${e.type}:${e.value}`,(e,t)=>{var n=qD(),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=Mi(n,``,r,e),Z(i,`for`,`skill-${W(t).path}`),Z(a,`id`,`skill-${W(t).path}`),Ui(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)]),Hr(`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(Te,e=>{(W(u).skills.length>0||W(u).missingSkills.length>0)&&e(Ee)}),P(S),U(()=>{J(w,r()),Hi(te,W(u).saveAsName),J(re,W(u).saveIntent===`replace`?`Saved the selected profile.`:`Creating a new saved profile.`),Ui(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.`)}),Hr(`submit`,T,h),G(`change`,D,m),Fi(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),tt()}Ur([`change`,`input`,`click`]);var $D=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=>!eO(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:tO(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:tO(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:tO(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:tO(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&&!eO(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 eO(e){return e.startsWith(`gestalt:`)}function tO(e){return e instanceof Error?e.message:`Unknown relay error.`}var nO=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),rO=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)}})),iO=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}}})),aO=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})),oO=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})),sO=o((e=>{var t=rO().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}})),cO=o((e=>{var t=rO().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),lO=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}})),uO=o((e=>{var t=iO(),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}}})),dO=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]]}})),fO=o((e=>{var t=dO();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}})),pO=o(((e,t)=>{var n=fO();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})),mO=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),hO=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)}})),gO=o((e=>{var t=mO(),n=hO();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}}})),_O=o((e=>{var t=rO(),n=uO(),r=iO(),i=gO(),a=mO(),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}})),vO=o((e=>{var t=rO(),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}})),yO=o(((e,t)=>{var n=gO();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})),bO=o(((e,t)=>{var n=gO(),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})),xO=o(((e,t)=>{var n=gO();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})),SO=o(((e,t)=>{var n=gO(),r=rO();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})),CO=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)})),wO=o((e=>{var t=gO(),n=yO(),r=bO(),i=xO(),a=SO(),o=hO(),s=rO(),c=CO();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()))}})),TO=o((e=>{var t=rO(),n=iO(),r=aO(),i=oO(),a=sO(),o=cO(),s=lO(),c=uO(),l=pO(),u=_O(),d=vO(),f=gO(),p=wO();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)}})),EO=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}}})),DO=o((e=>{var t=EO();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=EO();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}})),kO=c(o((e=>{var t=nO(),n=TO(),r=DO(),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 AO(e){return`${e.replace(/\/$/,``)}/?bootstrap=1`}async function jO(e){return kO.toDataURL(AO(e),{errorCorrectionLevel:`M`,margin:1,width:256})}async function MO(e){return kO.toDataURL(e,{errorCorrectionLevel:`M`,margin:1,width:256})}var NO=K(`<p class="feedback svelte-1nygetn" role="status"> </p>`),PO=K(`<span class="svelte-1nygetn">At least one authorized device is required.</span>`),FO=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>`),IO=K(`<ul aria-label="Authorized devices" class="svelte-1nygetn"></ul>`),LO=K(`<p role="status" class="svelte-1nygetn">No authorized devices are available. Refresh this page before making changes.</p>`),RO=K(`<button type="button" class="svelte-1nygetn">Create enrollment link</button>`),zO=K(`<img alt="QR code for the enrollment link" class="svelte-1nygetn"/>`),BO=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),VO=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 HO(e,t){et(t,!0);let n=Q(t,`oncreatepasskey`,3,()=>{}),r=R(ln([])),i=R(``),a=R(null),o=R(`none`),s=R(null),c=R(null),l=R(null),u=R(null),d=R(ln(Date.now())),f=I(()=>[...W(r)].sort((e,t)=>e.createdAt.localeCompare(t.createdAt))),p=I(()=>W(a)?Math.max(0,Math.ceil((Date.parse(W(a).expiresAt)-W(d))/1e3)):0),m=I(()=>`${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 MO(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()}ta(()=>{y(),document.addEventListener(`visibilitychange`,O);let e=setInterval(()=>z(d,Date.now(),!0),1e3);return()=>clearInterval(e)}),na(()=>{g(),document.removeEventListener(`visibilitychange`,O)});var k=VO(),ee=V(k),te=B(ee),ne=B(te);F(2),P(te);var re=H(te,2),ie=e=>{var t=NO(),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=IO();X(t,21,()=>W(f),e=>e.id,(e,t)=>{var n=FO(),r=B(n),i=B(r),a=H(i);Vi(a);var o=H(a,2),s=B(o),c=H(s),l=e=>{var n=Qr();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,Qr(`· 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=PO();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}`),Hi(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()]),Hr(`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,LO())};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=RO();G(`click`,t,()=>void x()),q(e,t)},de=e=>{var t=BO(),r=V(t),i=B(r,!0);P(r);var c=H(r,2),l=e=>{var t=zO();U(()=>Z(t,`src`,W(s))),q(e,t)};Y(c,e=>{W(s)&&e(l)});var u=H(c,3);Tn(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)}.`),Hi(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),Zi(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),tt()}Ur([`click`]);async function UO(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 WO(e){return{list:()=>UO(e(`/api/auth/devices`,{credentials:`same-origin`})),rename:(t,n)=>UO(e(`/api/auth/devices/${encodeURIComponent(t)}`,{method:`PATCH`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify({nickname:n})})),revoke:t=>UO(e(`/api/auth/devices/${encodeURIComponent(t)}`,{method:`DELETE`,credentials:`same-origin`})),createTicket:()=>UO(e(`/api/auth/enrollment-tickets`,{method:`POST`,credentials:`same-origin`})),ticketStatus:()=>UO(e(`/api/auth/enrollment-tickets/current`,{credentials:`same-origin`})),cancelTicket:()=>UO(e(`/api/auth/enrollment-tickets/current`,{method:`DELETE`,credentials:`same-origin`}))}}var GO=`gestalt-mobile.scratchpad`;function KO(){try{return window.localStorage}catch{return null}}function qO(e){try{return e?.getItem(`gestalt-mobile.scratchpad`)??``}catch{return``}}function JO(e,t){try{return e?(e.setItem(GO,t),!0):!1}catch{return!1}}function YO(e){try{return e?(e.removeItem(GO),!0):!1}catch{return!1}}var XO=K(`<p class="feedback svelte-eu5bnq" role="status"> </p>`),ZO=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>`),QO=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" aria-label="Close" title="Close" class="svelte-eu5bnq"><!></button></footer>`),$O=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" title="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 ek(e,t){et(t,!0);let n=Q(t,`storage`,19,KO),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(``);ta(async()=>{z(c,qO(n()),!0),await kr(),W(i)?.showModal(),W(o)?.focus({preventScroll:!0})});function d(e){z(c,e,!0),z(u,JO(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 kr();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 kr(),W(s)?.focus()}function m(){z(l,!1),W(a)?.focus()}function h(){if(!YO(n())){z(u,`This browser could not clear its saved scratchpad.`);return}z(c,``),z(l,!1),z(u,``),W(a)?.focus()}var g=$O(),_=B(g),v=B(_),y=H(B(v),2);sa(B(y),{name:`close`}),P(y),Zi(y,e=>z(o,e),()=>W(o)),P(v);var b=H(v,4);Tn(b),Zi(b,e=>z(a,e),()=>W(a));var x=H(b,2),S=e=>{var t=XO(),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=ZO(),n=H(B(t),4),r=B(n);Zi(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=QO(),n=B(t),r=H(n,2),o=H(r,2),s=H(o,2);sa(B(s),{name:`close`}),P(s),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),Zi(g,e=>z(i,e),()=>W(i)),U(()=>Hi(b,W(c))),Hr(`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),tt()}Ur([`click`,`input`]);var tk=K(`<span><span class="line-number svelte-1xq0jc8" aria-hidden="true"></span><span class="line-text svelte-1xq0jc8"> </span></span>`),nk=K(`<pre aria-label="File source" class="svelte-1xq0jc8"><code></code></pre>`);function rk(e,t){et(t,!0);let n=I(()=>t.text.split(`
|
|
176
|
+
`));var r=nk(),i=B(r);X(i,21,()=>W(n),ci,(e,r,i,a)=>{var o=tk();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=Ai(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),tt()}var ik=e=>typeof e==`object`&&e?Object.entries(e):[],ak=(e,t)=>`${e}/${JSON.stringify(t)}`;function ok(e){let t=new Set,n=[{value:e,id:``}];for(;n.length;){let e=n.pop(),r=ik(e.value);if(r.length){t.add(e.id);for(let[t,i]of r)n.push({value:i,id:ak(e.id,t)})}}return t}function sk(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=ik(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:ak(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 ck=K(`<button type="button" class="svelte-7x7m8l"> </button>`),lk=K(`<div class="json-row svelte-7x7m8l"><span class="fold-column svelte-7x7m8l"><!></span> <code class="svelte-7x7m8l"> </code></div>`),uk=K(`<div class="json-tree svelte-7x7m8l" aria-label="JSON contents"></div>`);function dk(e,t){et(t,!0);let n=Q(t,`unfolded`,3,!1),r=I(()=>JSON.parse(t.text)),i=I(()=>n()?ok(W(r)):new Set([``])),a=I(()=>sk(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=uk();X(s,21,()=>W(a),e=>e.id,(e,t)=>{var n=lk(),r=B(n),i=B(r),a=e=>{var n=ck(),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=Mi(s,``,c,{"padding-inline-start":`${W(t).depth*1.2}em`}),J(l,W(t).text)}),q(e,n)}),P(s),q(e,s),tt()}Ur([`click`]);var fk=K(`<button class="disclosure svelte-am0nvt" type="button"><span><!></span></button>`),pk=K(`<span class="unsupported svelte-am0nvt">Files cannot be destinations</span>`),mk=K(`<span class="unsupported svelte-am0nvt">Unsupported link</span>`),hk=K(`<button class="item-menu svelte-am0nvt" type="button"><!></button>`),gk=K(`<span role="status">Loading…</span>`),_k=K(`<button type="button"> </button>`),vk=K(`<div role="group"><!> <!> <!> <!></div>`),yk=K(`<div role="treeitem"><div class="tree-row svelte-am0nvt" role="presentation"><!> <span><!></span> <span class="tree-label svelte-am0nvt"> </span><!> <!></div> <!></div>`),bk=K(`<p role="status">Loading files…</p>`),xk=K(`<button type="button">Retry loading files</button>`),Sk=K(`<button type="button">Load more in root</button>`),Ck=K(`<div class="file-tree svelte-am0nvt" role="tree" aria-label="Files"><!> <!> <!> <!></div>`);function wk(e,t){et(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=ln({}),s=R(``),c=I(()=>t.revision<0?{entries:[],loading:!1,error:!1}:u(n())),l=I(()=>{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){if(e.target!==e.currentTarget)return;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(),g(i);break}}function h(e){return t.revision,(r()?t.destination:t.controller.selectedPath)===e}function g(e){if(e.kind!==`symlink`){if(r()){e.kind===`directory`&&i()(e.path);return}t.controller.select(e.path),a()(e.path)}}var _=Ck();{let e=(n,i=b,a=b)=>{var c=$r();X(V(c),17,()=>u(i()).entries,e=>e.path,(n,i,c,f)=>{let _=I(()=>W(i).kind===`directory`),v=I(()=>W(l).find(e=>e.entry.path===W(i).path)),y=I(()=>W(l).findIndex(e=>e.entry.path===W(i).path));var b=yk();let x;var S=B(b);let C;var w=B(S),T=e=>{var t=fk(),n=B(t);let r;sa(B(n),{name:`chevron`,size:`.85rem`}),P(n),P(t),U((e,i)=>{Z(t,`aria-label`,e),r=Ai(n,1,`svelte-am0nvt`,null,r,i)},[()=>`${d(W(i).path)?`Collapse`:`Expand`} ${W(i).name}`,()=>({expanded:d(W(i).path)})]),G(`click`,t,e=>{e.stopPropagation(),p(W(i))}),q(e,t)};Y(w,e=>{W(_)&&e(T)});var E=H(w,2);let D;var O=B(E);{let e=I(()=>W(_)?`sessions`:`document`);sa(O,{get name(){return W(e)}})}P(E);var k=H(E,2),ee=B(k,!0);P(k);var te=H(k),ne=e=>{q(e,pk())},re=e=>{var t=mk();U(()=>Z(t,`id`,`${W(i).path}-unsupported`)),q(e,t)};Y(te,e=>{r()&&!W(_)?e(ne):W(i).kind===`symlink`&&e(re,1)});var ie=H(te,2),ae=e=>{var n=hk();sa(B(n),{name:`more`,size:`1.1rem`}),P(n),U(()=>{Z(n,`aria-label`,`Actions for ${W(i).name}`),Z(n,`title`,`Actions for ${W(i).name}`)}),G(`click`,n,e=>{e.stopPropagation(),t.controller.select(W(i).path),t.onmanage?.(W(i).path)}),q(e,n)};Y(ie,e=>{t.onmanage&&!r()&&W(i).kind!==`symlink`&&e(ae)}),P(S);var oe=H(S,2),se=n=>{let r=I(()=>u(W(i).path));var o=vk(),s=B(o),c=e=>{q(e,gk())};Y(s,e=>{W(r).loading&&e(c)});var l=H(s,2),d=e=>{var n=_k(),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=_k(),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)},ce=I(()=>W(_)&&d(W(i).path));Y(oe,e=>{W(ce)&&e(se)}),P(b),Zi(b,(e,t)=>o[t.path]=e,e=>o?.[e.path],()=>[W(i)]),U((e,t)=>{x=Ai(b,1,`treeitem svelte-am0nvt`,null,x,{symlink:W(i).kind===`symlink`}),Z(b,`aria-level`,a()),Z(b,`aria-expanded`,e),Z(b,`aria-selected`,t),Z(b,`aria-disabled`,W(i).kind===`symlink`||r()&&!W(_)),Z(b,`aria-describedby`,W(i).kind===`symlink`?`${W(i).path}-unsupported`:void 0),Z(b,`tabindex`,W(s)===W(i).path||!W(s)&&W(y)===0?0:-1),C=Mi(S,``,C,{"--level":a()}),D=Ai(E,1,`kind-icon svelte-am0nvt`,null,D,{folder:W(_)}),J(ee,W(i).name)},[()=>W(_)?d(W(i).path):void 0,()=>W(i).kind===`symlink`?`false`:h(W(i).path)]),Hr(`focus`,b,()=>z(s,W(i).path,!0)),G(`keydown`,b,e=>m(e,W(v),W(y))),G(`click`,b,e=>{e.stopPropagation(),g(W(i))}),q(n,b)}),q(n,c)};var v=B(_),y=e=>{q(e,bk())};Y(v,e=>{W(c).loading&&e(y)});var x=H(v,2),S=e=>{var r=xk();G(`click`,r,()=>void t.controller.load(n())),q(e,r)};Y(x,e=>{W(c).error&&e(S)});var C=H(x,2);e(C,n,()=>1);var w=H(C,2),T=e=>{var r=Sk();G(`click`,r,()=>void t.controller.load(n(),!0)),q(e,r)};Y(w,e=>{W(c).cursor&&e(T)}),P(_)}q(e,_),tt()}Ur([`keydown`,`click`]);var Tk=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?Ek(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.reloadExpanded(e)}async reloadExpanded(e){if(await this.load(e),!this.expanded.has(e))return;let t=this.state(e).entries.filter(e=>e.kind===`directory`&&this.expanded.has(e.path));await Promise.all(t.map(e=>this.reloadExpanded(e.path)))}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 Ek(e,t){let n=new Set(e.map(e=>e.path));return[...e,...t.filter(e=>!n.has(e.path))]}function Dk(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 kk(e){if(Array.isArray(e))return e}function Ak(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 jk(){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 Mk(e,t){return kk(e)||Ak(e,t)||Nk(e,t)||jk()}function Nk(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 Pk(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof Dk;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)}Pk.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},Pk.prototype.next=function(e){return this._invoke(`next`,e)},Pk.prototype.throw=function(e){return this._invoke(`throw`,e)},Pk.prototype.return=function(e){return this._invoke(`return`,e)};var Fk=Object.entries,Ik=Object.setPrototypeOf,Lk=Object.isFrozen,Rk=Object.getPrototypeOf,zk=Object.getOwnPropertyDescriptor,Bk=Object.freeze,Vk=Object.seal,Hk=Object.create,Uk=typeof Reflect<`u`&&Reflect,Wk=Uk.apply,Gk=Uk.construct;Bk||=function(e){return e},Vk||=function(e){return e},Wk||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Gk||=function(e){return new e(...[...arguments].slice(1))};var Kk=gA(Array.prototype.forEach);Array.prototype.indexOf;var qk=gA(Array.prototype.lastIndexOf),Jk=gA(Array.prototype.pop),Yk=gA(Array.prototype.push),Xk=gA(Array.prototype.slice),Zk=gA(Array.prototype.splice),Qk=Array.isArray,$k=_A(Set),eA=gA(Set.prototype.add),tA=gA(Set.prototype.has),nA=gA(String.prototype.toLowerCase),rA=gA(String.prototype.toString),iA=gA(String.prototype.match),aA=gA(String.prototype.replace),oA=gA(String.prototype.indexOf),sA=gA(String.prototype.trim),cA=gA(Number.prototype.toString),lA=gA(Boolean.prototype.toString),uA=typeof BigInt>`u`?null:gA(BigInt.prototype.toString),dA=typeof Symbol>`u`?null:gA(Symbol.prototype.toString),fA=gA(Object.prototype.hasOwnProperty),pA=gA(Object.prototype.toString),mA=gA(RegExp.prototype.test),hA=_A(TypeError);function gA(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Wk(e,t,n)}}function _A(e){return function(){return Gk(e,[...arguments])}}function vA(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nA;if(Ik&&Ik(e,null),!Qk(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(Lk(t)||(t[r]=e),i=e)}e[i]=!0}return e}function yA(e){for(let t=0;t<e.length;t++)fA(e,t)||(e[t]=null);return e}function bA(e){let t=Hk(null);for(let r of Fk(e)){var n=Mk(r,2);let i=n[0],a=n[1];fA(e,i)&&(Qk(a)?t[i]=yA(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=bA(a):t[i]=a)}return t}function xA(e){switch(typeof e){case`string`:return e;case`number`:return cA(e);case`boolean`:return lA(e);case`bigint`:return uA?uA(e):`0`;case`symbol`:return dA?dA(e):`Symbol()`;case`undefined`:return pA(e);case`function`:case`object`:{if(e===null)return pA(e);let t=e,n=SA(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:pA(e)}return pA(e)}default:return pA(e)}}function SA(e,t){for(;e!==null;){let n=zk(e,t);if(n){if(n.get)return gA(n.get);if(typeof n.value==`function`)return gA(n.value)}e=Rk(e)}function n(){return null}return n}function CA(e,t){for(;e!==null;){let n=zk(e,t);if(n)return n.get?gA(n.get):null;e=Rk(e)}return null}function wA(e){try{return mA(e,``),!0}catch{return!1}}var TA=Bk(`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(`.`)),EA=Bk(`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(`.`)),DA=Bk([`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=Bk([`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`]),kA=Bk(`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(`.`)),AA=Bk([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),jA=Bk([`#text`]),MA=Bk(`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(`.`)),NA=Bk(`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(`.`)),PA=Bk(`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(`.`)),FA=Bk([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),IA=Vk(/{{[\w\W]*|^[\w\W]*}}/g),LA=Vk(/<%[\w\W]*|^[\w\W]*%>/g),RA=Vk(/\${[\w\W]*/g),zA=Vk(/^data-[\-\w.\u00B7-\uFFFF]+$/),BA=Vk(/^aria-[\-\w]+$/),VA=Vk(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),HA=Vk(/^(?:\w+script|data):/i),UA=Vk(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),WA=Vk(/^html$/i),GA=Vk(/^[a-z][.\w]*(-[.\w]+)+$/i),KA=Vk(/<[/\w!]/g),qA=Vk(/<[/\w]/g),JA=Vk(/<\/no(script|embed|frames)/i),YA=Vk(/\/>/i),XA={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},ZA=Bk(vA({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),QA=function(){return typeof window>`u`?null:window},$A=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}},ej=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},tj=function(e,t,n,r){return fA(e,t)&&Qk(e[t])?vA(r.base?bA(r.base):{},e[t],r.transform):n},nj=function(e,t,n){let r=fA(e,t)?e[t]:void 0;return r&&typeof r==`object`?bA(r):n()};function rj(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:QA(),t=e=>rj(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==XA.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=SA(d,`cloneNode`),p=SA(d,`remove`),m=SA(d,`removeAttributeNode`),h=SA(d,`nextSibling`),g=SA(d,`childNodes`),_=SA(d,`parentNode`),v=SA(d,`shadowRoot`),y=SA(d,`attributes`),b=o&&o.prototype?SA(o.prototype,`nodeType`):null,x=o&&o.prototype?SA(o.prototype,`nodeName`):null,S=o&&o.prototype?SA(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=CA(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 hA(`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=$A(u,i),!0),k},oe=n,se=oe.implementation,ce=oe.createNodeIterator,le=oe.createDocumentFragment,ue=oe.getElementsByTagName,de=r.importNode,A=ej();t.isSupported=typeof Fk==`function`&&typeof _==`function`&&se&&se.createHTMLDocument!==void 0;let fe=IA,pe=LA,me=RA,he=zA,ge=BA,_e=HA,ve=UA,ye=GA,be=VA,xe=null,Se=vA({},[...TA,...EA,...DA,...kA,...jA]),j=null,M=vA({},[...MA,...NA,...PA,...FA]),Ce=Object.seal(Hk(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}})),we=null,Te=null,Ee=Object.seal(Hk(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),De=!0,Oe=!0,ke=!1,Ae=!0,je=!1,Me=!0,Ne=!1,Pe=!1,Fe=null,Ie=null,Le=!1,Re=!1,ze=!1,Be=!1,N=!0,Ve=!1,He=`user-content-`,Ue=!0,We=!1,P=null,F={},Ge=null,Ke=vA({},`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=vA({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ye=null,Xe=vA({},[`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`,$e=`http://www.w3.org/1999/xhtml`,et=$e,tt=!1,nt=null,rt=vA({},[Ze,Qe,$e],rA),it=Bk([`mi`,`mo`,`mn`,`ms`,`mtext`]),at=vA({},it),ot=Bk([`annotation-xml`]),st=vA({},ot),ct=vA({},[`title`,`style`,`font`,`a`,`script`]),lt=null,ut=[`application/xhtml+xml`,`text/html`],dt=null,ft=null,pt=n.createElement(`form`),mt=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ft&&ft===e)return;(!e||typeof e!=`object`)&&(e={}),e=bA(e),lt=ut.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,dt=lt===`application/xhtml+xml`?rA:nA,xe=tj(e,`ALLOWED_TAGS`,Se,{transform:dt}),j=tj(e,`ALLOWED_ATTR`,M,{transform:dt}),nt=tj(e,`ALLOWED_NAMESPACES`,rt,{transform:rA}),Ye=tj(e,`ADD_URI_SAFE_ATTR`,Xe,{transform:dt,base:Xe}),qe=tj(e,`ADD_DATA_URI_TAGS`,Je,{transform:dt,base:Je}),Ge=tj(e,`FORBID_CONTENTS`,Ke,{transform:dt}),we=tj(e,`FORBID_TAGS`,bA({}),{transform:dt}),Te=tj(e,`FORBID_ATTR`,bA({}),{transform:dt}),F=fA(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?bA(e.USE_PROFILES):e.USE_PROFILES:!1,De=e.ALLOW_ARIA_ATTR!==!1,Oe=e.ALLOW_DATA_ATTR!==!1,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,Re=e.RETURN_DOM||!1,ze=e.RETURN_DOM_FRAGMENT||!1,Be=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,N=e.SANITIZE_DOM!==!1,Ve=e.SANITIZE_NAMED_PROPS||!1,Ue=e.KEEP_CONTENT!==!1,We=e.IN_PLACE||!1,be=wA(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:VA,et=typeof e.NAMESPACE==`string`?e.NAMESPACE:$e,at=nj(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>vA({},it)),st=nj(e,`HTML_INTEGRATION_POINTS`,()=>vA({},ot));let t=nj(e,`CUSTOM_ELEMENT_HANDLING`,()=>Hk(null));if(Ce=Hk(null),fA(t,`tagNameCheck`)&&mt(t.tagNameCheck)&&(Ce.tagNameCheck=t.tagNameCheck),fA(t,`attributeNameCheck`)&&mt(t.attributeNameCheck)&&(Ce.attributeNameCheck=t.attributeNameCheck),fA(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(Ce.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Vk(Ce),je&&(Oe=!1),ze&&(Re=!0),F&&(xe=vA({},jA),j=Hk(null),F.html===!0&&(vA(xe,TA),vA(j,MA)),F.svg===!0&&(vA(xe,EA),vA(j,NA),vA(j,FA)),F.svgFilters===!0&&(vA(xe,DA),vA(j,NA),vA(j,FA)),F.mathMl===!0&&(vA(xe,kA),vA(j,PA),vA(j,FA))),Ee.tagCheck=null,Ee.attributeCheck=null,fA(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Ee.tagCheck=e.ADD_TAGS:Qk(e.ADD_TAGS)&&(xe===Se&&(xe=bA(xe)),vA(xe,e.ADD_TAGS,dt))),fA(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Ee.attributeCheck=e.ADD_ATTR:Qk(e.ADD_ATTR)&&(j===M&&(j=bA(j)),vA(j,e.ADD_ATTR,dt))),fA(e,`ADD_FORBID_CONTENTS`)&&Qk(e.ADD_FORBID_CONTENTS)&&(Ge===Ke&&(Ge=bA(Ge)),vA(Ge,e.ADD_FORBID_CONTENTS,dt)),Ue&&(xe[`#text`]=!0),Ne&&vA(xe,[`html`,`head`,`body`]),xe.table&&(vA(xe,[`tbody`]),delete we.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw hA(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw hA(`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(``)));Bk&&Bk(e),ft=e},gt=vA({},[...EA,...DA,...OA]),_t=vA({},[...kA,...AA]),vt=function(e,t,n){return t.namespaceURI===$e?e===`svg`:t.namespaceURI===Ze?e===`svg`&&(n===`annotation-xml`||at[n]):!!gt[e]},yt=function(e,t,n){return t.namespaceURI===$e?e===`math`:t.namespaceURI===Qe?e===`math`&&st[n]:!!_t[e]},bt=function(e,t,n){return t.namespaceURI===Qe&&!st[n]||t.namespaceURI===Ze&&!at[n]?!1:!_t[e]&&(ct[e]||!gt[e])},xt=function(e){let t=E(e),n=nA(w(e)),r=_(e),i,a;return r&&C(r)===XA.element?(i={namespaceURI:E(r)},a=nA(w(r))):(i={namespaceURI:et},a=`template`),nt[t]?t===Qe?vt(n,i,a):t===Ze?yt(n,i,a):t===$e?bt(n,i,a):!!(lt===`application/xhtml+xml`&&nt[t]):!1},St=function(e){Yk(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw hA(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Ct=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},wt=function(e){Dt(e);let t=g(e);t&&Kk(Xk(t),e=>{try{p(e)}catch{}});let n=C(e)===XA.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`&&Ct(e,r,i)}},Tt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Yk(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(Re||ze)try{St(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Et=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[dt(i)]||Ct(e,r,i)}},I=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)===XA.element){let t=v(e);Ht(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Dt=function(e){I(e,e=>{C(e)===XA.element&&Et(e)})},Ot=function(e){let t=[];return I(e,e=>{t.push(e)},!0),t},kt=function(e,t){let n=$k();Kk(Ot(e),e=>{C(e)===XA.element&&eA(n,e)}),Kk(t,e=>{C(e)===XA.element&&!tA(n,e)&&Et(e)})},At=function(e,n){let r=!1;return Kk(t.removed,t=>{t.element&&(r||=t.element===e,Dt(t.element))}),kt(e,n),r},jt=function(e,t){let n=P,r=null,i=()=>(r||(r=$k(),Kk(t,e=>{eA(r,e)})),r);for(let t=0;;t++){let r=Ot(e),a=[e],o=!1;if(Kk(r,e=>{C(e)===XA.documentFragment?Yk(a,e):!o&&!tA(n,e)&&(o=tA(i(),e))}),!o)return;if(t>=8)throw hA(`the tree kept changing during in-place sanitization; refusing to return it`);Kk(a,(t,n)=>{Mt(t,n>0,e,i())})}},Mt=function(e,t,n,r){let i=Lt(e),a;for(;a=i.nextNode();)!tA(r,a)||tA(P,a)||(t&&L(A.uponSanitizeShadowNode,a,null),Yt(a,n),nn(a,n),Ht(a.content)&&R(a.content))},Nt=function(e){P&&eA(P,e)},Pt=function(e,t){return Me?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Ft=function(e){Me&&I(e,e=>{let t=C(e);if(t===XA.processingInstruction||t===XA.comment&&mA(qA,e.data)){try{p(e)}catch{}return!1}if(t===XA.element){let t=e,n=dt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Pt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},It=function(e){let t=null,r=null;if(Le)e=`<remove></remove>`+e;else{let t=iA(e,/^[\r\n\t ]+/);r=t&&t[0]}lt===`application/xhtml+xml`&&et===$e&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?re(e):e;if(et===$e)try{t=new l().parseFromString(i,lt)}catch{}if(!t||!t.documentElement){t=se.createDocument(et,`template`,null);try{t.documentElement.innerHTML=tt?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),et===$e?ue.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},Lt=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)},Rt=function(e){return e=aA(e,fe,` `),e=aA(e,pe,` `),e=aA(e,me,` `),e},zt=function(e){Bt(e);let t=e.querySelectorAll?.call(e,`template`);t&&Kk(t,e=>{Ht(e.content)&&zt(e.content)})},Bt=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=Rt(r.data),r=n.nextNode()},Vt=function(e){let t=x?x(e):null;return typeof t!=`string`||dt(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)},Ht=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===XA.documentFragment}catch{return!1}},Ut=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function L(e,n,r){e.length!==0&&Kk(e,e=>{e.call(t,n,r,ft)})}let Wt=function(e,t){return!!(Me&&e.hasChildNodes()&&!Ut(e.firstElementChild)&&mA(KA,e.textContent)&&mA(KA,e.innerHTML)||Me&&ZA[t]&&C(e)===XA.element&&E(e)===$e&&(Ut(e.firstElementChild)||typeof e.textContent==`string`&&mA(KA,e.textContent))||e.nodeType===XA.processingInstruction||Me&&e.nodeType===XA.comment&&mA(qA,e.data))},Gt=function(e,t){return e instanceof RegExp?mA(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Kt=function(e,t,n){if(!we[t]&&Qt(t)&&Gt(Ce.tagNameCheck,t))return!1;if(Ue&&!Ge[t]&&!Ge[nA(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 St(e),!0},qt=function(e,t,n,r){return e.length===0?t:t===n||t===r?bA(t):t},Jt=function(e,t){return e===t||_(e)!==null?!1:(We&&Dt(e),!0)},Yt=function(e,n){if(Nt(e),L(A.beforeSanitizeElements,e,null),Jt(e,n))return!0;if(Vt(e))return St(e),!0;let r=dt(w(e));if(xe=qt(A.uponSanitizeElement,xe,Se,Fe),L(A.uponSanitizeElement,e,{tagName:r,allowedTags:xe}),Jt(e,n))return!0;if(Wt(e,r))return St(e),!0;if(we[r]||!(Ee.tagCheck instanceof Function&&Ee.tagCheck(r))&&!xe[r]){let t=Kt(e,r,n);return t===!1&&(L(A.afterSanitizeElements,e,null),Jt(e,n))?!0:t}if(C(e)===XA.element&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&mA(JA,e.innerHTML))return St(e),!0;if(je&&e.nodeType===XA.text){let n=Rt(e.textContent);e.textContent!==n&&(Yk(t.removed,{element:e.cloneNode()}),e.textContent=n)}return L(A.afterSanitizeElements,e,null),Jt(e,n)},Xt=function(e,t,r){if(Te[t]||Pt(t,e)||N&&(t===`id`||t===`name`)&&(r in n||r in pt))return!1;let i=j[t]||Ee.attributeCheck instanceof Function&&Ee.attributeCheck(t,e);return Oe&&mA(he,t)||De&&mA(ge,t)?!0:i?Ye[t]||mA(be,aA(r,ve,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&oA(r,`data:`)===0&&qe[e]||ke&&!mA(_e,aA(r,ve,``))?!0:!r:Qt(e)&&Gt(Ce.tagNameCheck,e)&&Gt(Ce.attributeNameCheck,t,e)||t===`is`&&Ce.allowCustomizedBuiltInElements&&Gt(Ce.tagNameCheck,r)},Zt=vA({},[`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[nA(e)]&&mA(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),Vt(e)?(St(e),!1):!0}catch{return Tt(t,e),!1}},tn=function(e,t){return Me&&mA(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:nA(e)===`attributename`&&iA(t,`href`)!==null},nn=function(e,n){if(L(A.beforeSanitizeAttributes,e,null),Jt(e,n))return;let r=e.attributes;if(!r||Vt(e))return;j=qt(A.uponSanitizeAttribute,j,M,Ie);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:j,forceKeepAttr:void 0},a=r.length,o=dt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=dt(s),d=l,f=s===`value`?d:sA(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,L(A.uponSanitizeAttribute,e,i),f=i.attrValue,Ve&&(u===`id`||u===`name`)&&oA(f,He)!==0&&(Tt(s,e,n),f=He+f,p=!0),tn(s,f)){Tt(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){Tt(s,e,n);continue}if(!Ae&&mA(YA,f)){Tt(s,e,n);continue}if(je&&(f=Rt(f)),!Xt(o,u,f)){Tt(s,e,n);continue}f=$t(o,u,c,f),f!==d&&en(e,s,c,f)&&p&&Jk(t.removed)}}L(A.afterSanitizeAttributes,e,null),Jt(e,n)},R=function(e){let t=null,n=Lt(e);for(L(A.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(L(A.uponSanitizeShadowNode,t,null),Yt(t,e),nn(t,e),Ht(t.content)&&R(t.content),C(t)===XA.element){let e=v(t);Ht(e)&&(rn(e),R(e))}je&&Bt(e),L(A.afterSanitizeShadowDOM,e,null)},rn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){R(e.shadow);continue}let n=e.node,r=C(n)===XA.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`&&dt(e)===`template`){let e=n.content;Ht(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Ht(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(tt=!e,tt&&(e=`<!-->`),typeof e!=`string`&&!Ut(e)&&(e=xA(e),typeof e!=`string`))throw hA(`dirty is not a string, aborting`);if(!t.isSupported)return e;Pe?(xe=Fe,j=Ie):ht(n),(A.uponSanitizeElement.length>0||A.uponSanitizeAttribute.length>0)&&(xe=bA(xe)),A.uponSanitizeAttribute.length>0&&(j=bA(j)),t.removed=[];let c=We&&typeof e!=`string`&&Ut(e),l=[],u=P;if(c){Ft(e);let t=w(e);if(typeof t==`string`){let n=dt(t);if(!xe[n]||we[n])throw wt(e),hA(`root node is forbidden and cannot be sanitized in-place`)}if(Vt(e))throw wt(e),hA(`root node is clobbered and cannot be sanitized in-place`);l=Ot(e),P=$k()}else if(Ut(e))i=It(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===XA.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),rn(i);else{if(!Re&&!je&&!Ne&&e.indexOf(`<`)===-1)return D&&Be?re(e):e;if(i=It(e),!i)return Re?null:Be?O:``}i&&Le&&St(i.firstChild);let d=c?e:i;try{c&&rn(e);let t=Lt(d);for(;o=t.nextNode();)Yt(o,d),nn(o,d),Ht(o.content)&&R(o.content);c&&jt(e,l)}catch(t){throw c&&(wt(e),At(e,l)),t}finally{P=u}if(c){if(At(e,l))throw hA(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return je&&zt(e),e}if(Re){if(je&&zt(i),ze)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=Ne?i.outerHTML:i.innerHTML;return Ne&&xe[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&mA(WA,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
179
|
+
`+f),je&&(f=Rt(f)),D&&Be?re(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ht(e),Pe=!0,Fe=xe,Ie=j},t.clearConfig=function(){ft=null,Pe=!1,Fe=null,Ie=null,D=k,O=``},t.isValidAttribute=function(e,t,n){ft||ht({});let r=dt(e),i=dt(t);return typeof n==`string`&&(tn(t,n)||!Ae&&mA(YA,n))?!1:Xt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&fA(A,e)&&Yk(A[e],t)},t.removeHook=function(e,t){if(fA(A,e)){if(t!==void 0){let n=qk(A[e],t);return n===-1?void 0:Zk(A[e],n,1)[0]}return Jk(A[e])}},t.removeHooks=function(e){fA(A,e)&&(A[e]=[])},t.removeAllHooks=function(){A=ej()},t}var ij=rj();function aj(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 oj(e){return ij.sanitize(lx.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 sj(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 cj(e,t){return t.startsWith(`/`)?t:[...e.split(`/`).slice(0,-1),t].join(`/`)}var lj=K(`<span class="line-target svelte-14yf39v" role="status"> </span>`),uj=K(`<span class="format svelte-14yf39v"> </span>`),dj=K(`<p role="status">Loading preview…</p>`),fj=K(`<p>This item could not be opened.</p> <!>`,1),pj=K(`<p class="empty svelte-14yf39v">This folder is empty.</p>`),mj=K(`<!> <!>`,1),hj=K(`<img class="image-preview svelte-14yf39v"/>`),gj=K(`<div class="markdown svelte-14yf39v"></div>`),_j=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> <div class="header-actions"><!> <!></div></header> <nav aria-label="Preview controls" class="svelte-14yf39v"><!> <!> <!> <!> <!> <!></nav> <div class="contents svelte-14yf39v"><!></div></dialog>`);function vj(e,t){et(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(ln([])),f=R(void 0),p=R(``),m=I(()=>W(p).split(`/`).filter(Boolean).at(-1));function h(){W(i)?.kind!==`file`||!W(m)||UT(new Blob([W(i).hasUtf8Bom?``:``,W(i).content],{type:`text/plain;charset=utf-8`}),W(m))}let g=I(()=>W(i)?.kind===`file`?W(i).content.split(`
|
|
180
|
+
`).length:0),_=I(()=>W(i)?aj(W(i)):{format:`text`,text:``}),v=I(()=>W(_).format===`markdown`&&!W(s)?oj(W(_).text):``),y=null,b=null;async function x(e,n=!0,m){let h=v_(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),y?.abort(),W(u)?.close(),z(u,null);let _=new AbortController;y=_,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,_.signal);if(_.signal.aborted)return;if(z(i,e,!0),z(p,e.path,!0),e.kind===`directory`){let n=new Tk(t.target.workspaceId,t.listDirectory,()=>{z(l,W(l)+1)},t.onerror);z(u,n,!0),await n.load(e.path)}}catch(e){if(_.signal.aborted)return;z(o,!0),t.onerror(e)}finally{_.signal.aborted||(z(a,!1),await kr(),r?.focus({preventScroll:!0}),S())}}function S(){!W(f)||!W(i)||W(i).kind!==`file`||n.querySelector(`[data-line="${W(f)}"]`)?.scrollIntoView({block:`center`,inline:`nearest`,behavior:`instant`})}async function C(){z(s,!W(s)),await kr(),W(s)&&S()}function w(){let e=W(d).at(-1);e!==void 0&&(z(d,W(d).slice(0,-1),!0),x(e.path,!1,e.line))}function T(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=y_(t)??v_(t);x(cj(W(p),n.path),!0,n.line)}function E(e){return e.addEventListener(`click`,T),{destroy:()=>e.removeEventListener(`click`,T)}}ta(()=>(b=document.activeElement instanceof HTMLElement?document.activeElement:null,n.showModal(),x(t.target.path,!1,t.target.line),()=>{y?.abort(),W(u)?.close(),n.close(),b?.focus()}));var D=_j(),O=B(D),k=B(O),ee=B(k),te=B(ee,!0);P(ee),Zi(ee,e=>r=e,()=>r);var ne=H(ee,2),re=B(ne,!0);P(ne),P(k);var ie=H(k,2),ae=B(ie),oe=e=>{{let t=I(()=>`Download ${W(m)}`);Rm(e,{icon:`download`,label:`Download file`,get tooltip(){return W(t)},onclick:h})}};Y(ae,e=>{W(i)?.kind===`file`&&e(oe)}),Rm(H(ae,2),{icon:`close`,get onclick(){return t.onclose},label:`Close file preview`}),P(ie),P(O);var se=H(O,2),ce=B(se);{let e=I(()=>!W(d).length);Rm(ce,{onclick:w,get disabled(){return W(e)},children:(e,t)=>{F(),q(e,Qr(`Back`))},$$slots:{default:!0}})}var le=H(ce,2),ue=e=>{Rm(e,{onclick:()=>void C(),get pressed(){return W(s)},children:(e,t)=>{F();var n=Qr();U(()=>J(n,W(s)?`Show formatted`:`Show source`)),q(e,n)},$$slots:{default:!0}})};Y(le,e=>{W(i)?.kind===`file`&&W(_).format!==`text`&&e(ue)});var de=H(le,2),A=e=>{{let t=I(()=>W(c)?`Fold all JSON`:`Unfold all JSON`);Rm(e,{onclick:()=>{z(c,!W(c))},get pressed(){return W(c)},get label(){return W(t)},children:(e,t)=>{F();var n=Qr();U(()=>J(n,W(c)?`Unfolded`:`Folded`)),q(e,n)},$$slots:{default:!0}})}};Y(de,e=>{W(_).format===`json`&&!W(s)&&e(A)});var fe=H(de,2),pe=e=>{var t=lj(),n=B(t,!0);P(t),U(()=>J(n,W(f)<=W(g)?`Line ${W(f)}`:`Line ${W(f)} unavailable (${W(g)} lines)`)),q(e,t)};Y(fe,e=>{W(f)&&W(i)?.kind===`file`&&e(pe)});var me=H(fe,2),he=e=>{var t=uj(),n=B(t);P(t),U((e,t)=>J(n,`${e??``} · ${t??``} bytes`),[()=>W(_).format.toUpperCase(),()=>W(i).size.toLocaleString()]),q(e,t)};Y(me,e=>{W(i)?.kind===`file`&&e(he)});var ge=H(me,2),_e=e=>{var t=uj(),n=B(t);P(t),U(e=>J(n,`${W(i).mediaType===`image/png`?`PNG`:`JPEG`} · ${e??``} bytes`),[()=>W(i).size.toLocaleString()]),q(e,t)};Y(ge,e=>{W(i)?.kind===`image`&&e(_e)}),P(se);var ve=H(se,2),ye=B(ve),be=e=>{q(e,dj())},xe=e=>{var t=fj();Rm(H(V(t),2),{onclick:()=>void x(W(p),!1,W(f)),children:(e,t)=>{F(),q(e,Qr(`Retry`))},$$slots:{default:!0}}),q(e,t)},Se=e=>{var t=mj(),n=V(t);wk(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`?x(e):n?.kind===`directory`&&W(u)?.expand(e)}});var r=H(n,2),a=e=>{q(e,pj())},o=I(()=>!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)},j=e=>{var n=hj();U(e=>{Z(n,`src`,`data:${W(i).mediaType};base64,${W(i).base64}`),Z(n,`alt`,e)},[()=>W(i).path.split(`/`).at(-1)]),Hr(`error`,n,()=>{z(o,!0),t.onerror(Error(`FILE_PREVIEW_IMAGE_INVALID`))}),Br(n),q(e,n)},M=e=>{var t=$r(),n=V(t),r=e=>{var t=gj();_i(t,()=>W(v),!0),P(t),bi(t,e=>E?.(e)),q(e,t)},a=e=>{dk(e,{get text(){return W(_).text},get unfolded(){return W(c)}})},o=e=>{{let t=I(()=>W(s)?W(i).content:W(_).text);rk(e,{get text(){return W(t)},get line(){return W(f)}})}};Y(n,e=>{W(v)?e(r):W(_).format===`json`&&!W(s)?e(a,1):e(o,-1)}),q(e,t)};Y(ye,e=>{W(a)?e(be):W(o)?e(xe,1):W(i)?.kind===`directory`&&W(u)?e(Se,2):W(i)?.kind===`image`?e(j,3):W(i)?.kind===`file`&&e(M,4)}),P(ve),P(D),Zi(D,e=>n=e,()=>n),U(()=>{J(te,W(m)||`Workspace files`),J(re,W(p)||`/`)}),Hr(`cancel`,D,e=>{e.preventDefault(),t.onclose()}),q(e,D),tt()}var yj={phase:`idle`};function bj(e,t){return{phase:`picking`,kind:e,source:t}}function xj(e,t){return e.phase===`picking`?{...e,destination:t}:e}function Sj(e){return e.phase!==`picking`||e.destination===void 0?e:{...e,phase:`submitting`}}function Cj(e,t){return e.phase===`submitting`?{...e,phase:`conflict`,replaceAllowed:t}:e}function wj(e){return e.phase===`submitting`?{...e,phase:`failed`}:e}function Tj(e,t){return e.phase!==`picking`||!e.source||e.kind===`move`&&Ej(e.source)===t?!1:!(t===e.source||t.startsWith(`${e.source}/`))}function Ej(e){let t=e.lastIndexOf(`/`);return t<0?``:e.slice(0,t)}var Dj=K(`<button type="button" class="svelte-qx7639"><!>New folder</button>`),Oj=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" class="svelte-qx7639"/> <div class="browser-actions svelte-qx7639"><button type="submit" class="svelte-qx7639"> </button> <button type="button" class="svelte-qx7639">Cancel</button></div></form>`),kj=K(`<li> </li>`),Aj=K(`<button type="button" class="svelte-qx7639">Replace</button>`),jj=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>`),Mj=K(`<button type="button" class="svelte-qx7639">Cancel uploads</button>`),Nj=K(`<section class="picker svelte-qx7639" aria-label="Upload queue" aria-live="polite"><p class="svelte-qx7639"> </p> <ul></ul> <!></section>`),Pj=K(`<button type="button" class="svelte-qx7639"><!>View</button>`),Fj=K(`<section class="selection svelte-qx7639" tabindex="-1" aria-label="Selected file actions"><div class="selection-title svelte-qx7639"><strong> </strong> <button aria-label="Clear selection" title="Clear selection" class="svelte-qx7639"><!></button></div> <div class="browser-actions item-tools svelte-qx7639"><!> <button type="button" class="svelte-qx7639"><!>Copy</button> <button type="button" class="svelte-qx7639"><!>Move</button> <button type="button" class="svelte-qx7639"><!>Rename</button> <button class="danger svelte-qx7639" type="button"><!>Delete</button></div></section>`),Ij=K(`<p id="rename-error" role="alert" class="svelte-qx7639"> </p>`),Lj=K(`<form class="picker svelte-qx7639" aria-label="Rename item"><label for="rename-file">New name</label> <input id="rename-file" required="" maxlength="255" class="svelte-qx7639"/> <!> <div class="browser-actions svelte-qx7639"><button class="primary svelte-qx7639" type="submit"> </button> <button type="button" class="svelte-qx7639">Cancel</button></div></form>`),Rj=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>`),zj=K(`<p class="copy-note svelte-qx7639">Skips temporary folders, caches, dependencies and build output.</p>`),Bj=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>`),Vj=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>`),Hj=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>`),Uj=K(`<section aria-label="File browser error" class="svelte-qx7639"><p class="svelte-qx7639">Files could not be read. Try again.</p></section>`),Wj=K(`<p role="status" class="svelte-qx7639">This folder is empty.</p>`),Gj=K(`<div class="listing svelte-qx7639"><!></div>`),Kj=K(`<dialog aria-labelledby="file-browser-title" class="svelte-qx7639"><section class="file-browser-shell svelte-qx7639"><header class="svelte-qx7639"><div class="workspace-heading svelte-qx7639"><span class="workspace-icon svelte-qx7639"><!></span> <div class="svelte-qx7639"><h2 id="file-browser-title" tabindex="-1" class="svelte-qx7639">Files</h2> <p class="workspace-path svelte-qx7639"> </p></div></div> <div class="header-tools svelte-qx7639"><button type="button" class="refresh svelte-qx7639" aria-label="Refresh" title="Refresh"><!></button> <button type="button" class="close svelte-qx7639" aria-label="Close file browser" title="Close file browser"><!></button></div></header> <div class="browser-actions toolbar svelte-qx7639"><!> <input class="visually-hidden svelte-qx7639" type="file" multiple="" aria-label="Choose files to upload"/> <button class="upload svelte-qx7639" type="button"><!>Upload files</button></div> <!> <!> <!> <!> <!> <!> <!> <!></section></dialog>`);function qj(e,t){et(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(ln(yj)),l=R(null),u=R(``),d=R(null),f=R(``),p=R(null),m=R(``),h=R(``),g=R(!1),_=R(void 0),v=R(void 0),y=R(!1),b=R(null),x=R(null),S=R(!1),C=I(()=>W(p)!==null||W(d)!==null||W(S)),w=R(!1),T=R(null),E=R(null),D=R(ln([])),O=R(!1),k=R(null),ee=R(null),te=I(()=>W(o)<0?{entries:[],loading:!1,error:!1}:W(s)?.state(``)??{entries:[],loading:!0,error:!1}),ne=I(()=>{if(W(o),!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))}),re=I(()=>`Files in ${t.root.relativePath===`.`?`~/`:`~/${t.root.relativePath}`}`);ta(async()=>{z(s,new Tk(t.root.id,t.listDirectory,()=>{z(o,W(o)+1)},t.onerror),!0),await kr(),W(i)?.showModal(),W(a)?.focus(),await W(s).load()}),na(()=>W(s)?.close());function ie(){W(c).phase===`submitting`||W(w)||W(y)||W(g)||(W(k)?.abort(),W(s)?.close(),W(i)?.close())}let ae=I(()=>W(ne)?.kind===`directory`||!W(u)?W(u):``),oe=I(()=>W(ae)||``);async function se(){z(d,W(ae),!0),z(f,``),await kr(),W(b)?.focus()}async function ce(){W(y)||(z(d,null),await kr(),W(x)?.focus())}async function le(e){if(e.preventDefault(),W(y)||W(d)===null||!t.createDirectory||!W(s))return;let i=W(d),a=W(f).trim();if(a){z(y,!0);try{let e=await t.createDirectory(t.root.id,{directory:i,name:a},rg());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(y,!1),await kr(),W(d)===null?W(x)?.focus():W(b)?.focus()}}}async function ue(e=`reject`){if(!(W(O)||!W(s))){z(O,!0);try{for(;;){let n=W(ee)?.index??s_(W(D));if(z(ee,null),n<0)break;let i=W(D)[n];if(!i||i.status===`too-large`)continue;z(D,W(D).map((e,t)=>t===n?{...e,status:`uploading`}:e),!0);let a=new AbortController;z(k,a,!0);try{let o=await t.uploadFile(t.root.id,{directory:W(oe),filename:i.file.name,conflict:e,file:i.file},rg(),a.signal);z(D,W(D).map((e,t)=>t===n?{...e,status:`completed`,path:o.path}:e),!0),await W(s).refresh(W(oe)),W(s).select(W(oe)),z(u,W(oe),!0),r()(),e=`reject`}catch(e){let r=e;if(r.status===409){z(D,W(D).map((e,t)=>t===n?{...e,status:`queued`}:e),!0),z(ee,{index:n,replaceAllowed:r.replaceAllowed===!0},!0);break}z(D,W(D).map((e,t)=>t===n?{...e,status:a.signal.aborted?`cancelled`:`failed`}:e),!0),t.onerror(e)}finally{z(k,null)}}}finally{z(O,!1);let e=W(D).filter(e=>e.status===`completed`).length;e&&n()(`Uploaded ${e} file${e===1?``:`s`}.`)}}}function de(e){!e||e.length===0||(z(D,o_(e),!0),ue())}function A(){W(k)?.abort(),z(D,W(D).map(e=>e.status===`queued`||e.status===`uploading`?{...e,status:`cancelled`}:e),!0),z(ee,null)}function fe(e){if(W(c).phase===`submitting`||W(w)||W(y)||W(g)){e.preventDefault();return}if(e.preventDefault(),W(p)!==null){_e();return}if(W(d)!==null){ce();return}ie()}async function pe(){if(!(!W(u)||W(w))){z(w,!0);try{let e=W(u).includes(`/`)?W(u).slice(0,W(u).lastIndexOf(`/`)):``;await t.deleteEntry(t.root.id,W(u),rg()),await W(s)?.refresh(e),W(s)?.select(e),z(u,e,!0),n()(`Deleted item.`),r()(),z(S,!1)}catch(e){t.onerror(e)}finally{z(w,!1)}}}async function me(){z(S,!0),await kr(),W(T)?.focus()}async function he(e){z(u,e,!0),await kr(),W(v)?.focus()}async function ge(){W(ne)&&(z(p,W(u),!0),z(m,W(ne).name,!0),z(h,``),await kr(),W(_)?.focus(),W(_)?.select())}async function _e(){W(g)||(z(p,null),await kr(),W(v)?.focus())}async function ve(e){if(e.preventDefault(),W(g)||!W(p)||!W(s)||!W(m).trim())return;let i=W(p),a=Ej(i);z(g,!0),z(h,``);try{let e=await t.moveEntry(t.root.id,{source:i,destinationDirectory:a,newName:W(m),conflict:`reject`},rg());await W(s).refresh(a),z(u,e.path,!0),W(s).select(e.path),z(p,null),r()(),n()(`Renamed to ${W(m)}.`)}catch(e){let t=e.code;z(h,t===`FILE_CONFLICT`||t===`SYMLINK_UNSUPPORTED`?`That name is already in use. Choose another name.`:`Could not rename this item. Check the name and try again.`,!0)}finally{z(g,!1),await kr(),W(p)===null?W(v)?.focus():W(_)?.focus()}}function ye(e){W(u)&&z(c,bj(e,W(u)),!0)}function be(e){Tj(W(c),e)&&z(c,xj(W(c),e),!0)}async function xe(e=`reject`){if(!W(s)||W(c).phase!==`picking`&&W(c).phase!==`conflict`)return;let i=W(c).phase===`picking`?Sj(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},rg()),o=Ej(i.source);i.kind===`move`&&o!==i.destination&&await W(s).refresh(o),await W(s).refresh(i.destination),await W(s).expand(i.destination),z(u,a.path,!0),W(s).select(a.path),n()(`${i.kind===`copy`?`Copied`:`Moved`} ${a.path}.`),r()(),z(c,yj,!0)}catch(e){let n=e;n.status===409?(z(c,Cj(i,n.replaceAllowed===!0),!0),await kr(),W(l)?.focus()):(z(c,wj(i),!0),t.onerror(e))}}}var Se=Kj(),j=B(Se),M=B(j),Ce=B(M),we=B(Ce);sa(B(we),{name:`sessions`,size:`1.5rem`}),P(we);var Te=H(we,2),Ee=B(Te);Zi(Ee,e=>z(a,e),()=>W(a));var De=H(Ee,2),Oe=B(De,!0);P(De),P(Te),P(Ce);var ke=H(Ce,2),Ae=B(ke);sa(B(Ae),{name:`refresh`}),P(Ae);var je=H(Ae,2);sa(B(je),{name:`close`}),P(je),P(ke),P(M);var Me=H(M,2),Ne=B(Me),Pe=e=>{var t=Dj();sa(B(t),{name:`folder-add`}),F(),P(t),Zi(t,e=>z(x,e),()=>W(x)),U(()=>t.disabled=W(te).loading||W(d)!==null||W(y)||W(O)||W(w)||W(c).phase!==`idle`||W(ne)!==void 0&&W(ne).kind!==`directory`),G(`click`,t,()=>void se()),q(e,t)};Y(Ne,e=>{t.createDirectory&&e(Pe)});var Fe=H(Ne,2);Zi(Fe,e=>z(E,e),()=>W(E));var Ie=H(Fe,2);sa(B(Ie),{name:`upload`}),F(),P(Ie),P(Me);var Le=H(Me,2),Re=e=>{var t=Oj(),n=B(t),r=B(n);P(n);var i=H(n,4);Vi(i),Zi(i,e=>z(b,e),()=>W(b));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(y),o.disabled=e,J(s,W(y)?`Creating…`:`Create folder`),c.disabled=W(y)},[()=>W(y)||!W(f).trim()]),Hr(`submit`,t,le),qi(i,()=>W(f),e=>z(f,e)),G(`click`,c,()=>void ce()),q(e,t)};Y(Le,e=>{W(d)!==null&&e(Re)});var ze=H(Le,2),Be=e=>{var t=Nj(),n=B(t),r=B(n);P(n);var i=H(n,2);X(i,21,()=>W(D),e=>e.file,(e,t)=>{var n=kj(),r=B(n);P(n),U(()=>J(r,`${W(t).file.name??``}: ${W(t).path??W(t).status??``}${W(t).status===`too-large`?` (maximum ${Pg/1024/1024} MiB)`:``}`)),q(e,n)}),P(i);var a=H(i,2),o=e=>{var t=jj(),n=B(t),r=e=>{var t=Aj();G(`click`,t,()=>void ue(`replace`)),q(e,t)};Y(n,e=>{W(ee).replaceAllowed&&e(r)});var i=H(n,2),a=H(i,2);P(t),G(`click`,i,()=>void ue(`keep-both`)),G(`click`,a,A),q(e,t)},s=e=>{var t=Mj();G(`click`,t,A),q(e,t)};Y(a,e=>{W(ee)?e(o):W(O)&&e(s,1)}),P(t),U((e,t)=>J(r,`${e??``} queued, ${t??``} completed`),[()=>W(D).filter(e=>e.status===`queued`).length,()=>W(D).filter(e=>e.status===`completed`).length]),q(e,t)};Y(ze,e=>{W(D).length&&e(Be)});var N=H(ze,2),Ve=e=>{var n=Fj(),r=B(n),i=B(r),o=B(i,!0);P(i);var c=H(i,2);sa(B(c),{name:`close`,size:`1rem`}),P(c),P(r);var l=H(r,2),d=B(l),f=e=>{var n=Pj();sa(B(n),{name:`open`}),F(),P(n),G(`click`,n,()=>t.onview?.(W(u))),q(e,n)};Y(d,e=>{t.onview&&e(f)});var p=H(d,2);sa(B(p),{name:`copy`}),F(),P(p);var m=H(p,2);sa(B(m),{name:`move`}),F(),P(m);var h=H(m,2);sa(B(h),{name:`rename`}),F(),P(h);var g=H(h,2);sa(B(g),{name:`clean`}),F(),P(g),P(l),P(n),Zi(n,e=>z(v,e),()=>W(v)),U(()=>{n.inert=W(O)||W(ee)!==null,J(o,W(u))}),G(`click`,c,()=>{z(u,``),W(s)?.select(``),W(a)?.focus()}),G(`click`,p,()=>ye(`copy`)),G(`click`,m,()=>ye(`move`)),G(`click`,h,()=>void ge()),G(`click`,g,()=>void me()),q(e,n)};Y(N,e=>{W(s)&&W(c).phase===`idle`&&W(ne)&&W(ne).kind!==`symlink`&&!W(C)&&e(Ve)});var He=H(N,2),Ue=e=>{var t=Lj(),n=H(B(t),2);Vi(n),Zi(n,e=>z(_,e),()=>W(_));var r=H(n,2),i=e=>{var t=Ij(),n=B(t,!0);P(t),U(()=>J(n,W(h))),q(e,t)};Y(r,e=>{W(h)&&e(i)});var a=H(r,2),o=B(a),s=B(o,!0);P(o);var c=H(o,2);P(a),P(t),U(e=>{n.disabled=W(g),Z(n,`aria-describedby`,W(h)?`rename-error`:void 0),o.disabled=e,J(s,W(g)?`Renaming…`:`Rename`),c.disabled=W(g)},[()=>W(g)||!W(m).trim()||W(m)===W(p).split(`/`).at(-1)||/[/\\]/.test(W(m))]),Hr(`submit`,t,ve),G(`input`,n,()=>z(h,``)),qi(n,()=>W(m),e=>z(m,e)),G(`click`,c,()=>void _e()),q(e,t)};Y(He,e=>{W(p)!==null&&e(Ue)});var We=H(He,2),Ge=e=>{var t=Rj(),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);Zi(s,e=>z(T,e),()=>W(T));var c=H(s,2),l=B(c,!0);P(c),P(o),P(t),U(()=>{J(r,W(ne).kind===`directory`?`Delete folder and all contents`:`Delete file`),J(a,W(u)),s.disabled=W(w),c.disabled=W(w),J(l,W(w)?`Deleting…`:`Delete`)}),G(`click`,s,()=>z(S,!1)),G(`click`,c,()=>void pe()),q(e,t)};Y(We,e=>{W(S)&&W(ne)&&e(Ge)});var Ke=H(We,2),qe=e=>{var t=Bj(),n=B(t),r=B(n),i=B(r);P(r);var a=H(r);P(n);var o=H(n,2),s=e=>{q(e,zj())};Y(o,e=>{W(c).kind===`copy`&&W(ne)?.kind===`directory`&&e(s)});var l=H(o,2),u=B(l);P(l);var d=H(l,2),f=B(d),p=H(f,2),m=B(p);P(p);var h=H(p,2);P(d),P(t),U(e=>{J(i,`${W(c).kind===`copy`?`Copy`:`Move`}:`),J(a,` ${W(c).source??``}`),J(u,`Destination: ${(W(c).destination===``?`root folder`:W(c).destination??`choose a folder`)??``}`),f.disabled=e,p.disabled=W(c).destination===void 0,J(m,`Confirm ${W(c).kind??``}`)},[()=>!Tj(W(c),``)]),G(`click`,f,()=>be(``)),G(`click`,p,()=>void xe()),G(`click`,h,()=>z(c,yj,!0)),q(e,t)},Je=e=>{var t=Vj(),n=H(B(t),2),r=B(n,!0);P(n);var i=H(n,2),a=B(i),o=e=>{var t=Aj();G(`click`,t,()=>void xe(`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),Zi(t,e=>z(l,e),()=>W(l)),U(()=>J(r,W(c).destination)),G(`click`,s,()=>void xe(`keep-both`)),G(`click`,u,()=>z(c,yj,!0)),q(e,t)},Ye=e=>{var t=Hj(),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,yj,!0)),q(e,t)};Y(Ke,e=>{W(c).phase===`picking`?e(qe):W(c).phase===`conflict`?e(Je,1):W(c).phase===`failed`&&e(Ye,2)});var Xe=H(Ke,2),Ze=e=>{q(e,Uj())},Qe=e=>{q(e,Wj())};Y(Xe,e=>{W(s)&&!W(te).loading&&W(te).error?e(Ze):W(s)&&!W(te).loading&&W(te).entries.length===0&&e(Qe,1)});var $e=H(Xe,2),nt=e=>{var n=Gj(),r=B(n);{let e=I(()=>W(c).phase===`picking`);wk(r,{get controller(){return W(s)},get revision(){return W(o)},get destinationMode(){return W(e)},get destination(){return W(c).destination},onmanage:he,ondestinationselect:be,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(S)||(await kr(),!(W(u)!==e||W(c).phase!==`idle`||!W(i)?.open)&&(W(i)?.querySelector(`[role="treeitem"][aria-selected="true"]`)?.focus(),t.onview(e)))}})}P(n),U(()=>n.inert=W(C)||W(O)||W(ee)!==null||W(c).phase===`submitting`||W(c).phase===`conflict`),q(e,n)};Y($e,e=>{W(s)&&e(nt)}),P(j),P(Se),Zi(Se,e=>z(i,e),()=>W(i)),U(()=>{Z(Ee,`aria-label`,W(re)),J(Oe,t.root.relativePath===`.`?`~/`:`~/${t.root.relativePath}`),Ae.disabled=W(te).loading||W(C)||W(O)||W(ee)!==null||W(c).phase!==`idle`,Me.inert=W(C)||W(O)||W(ee)!==null||W(c).phase!==`idle`,Ie.disabled=W(ne)?.kind===`file`||W(O)}),Hr(`close`,Se,function(...e){t.onclose?.apply(this,e)}),Hr(`cancel`,Se,fe),G(`click`,Ae,()=>void W(s)?.refresh()),G(`click`,je,ie),G(`change`,Fe,e=>de(e.currentTarget.files)),G(`click`,Ie,()=>W(E)?.click()),q(e,Se),tt()}Ur([`click`,`change`,`input`]);var Jj=K(`<main class="evidence-mode svelte-1d2e8zz"><!></main>`),Yj=K(`<span class="detached-chat-model svelte-1d2e8zz"> </span>`),Xj=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>`),Zj=K(`<aside class="chat-context chat-sessions svelte-1d2e8zz" aria-label="Chat sessions and usage"><!></aside>`),Qj=K(`<div class="chat-controls svelte-1d2e8zz" aria-label="Chat controls"><!> <!> <!></div>`),$j=K(`<div class="chat-composer svelte-1d2e8zz"><!> <!> <!></div> <!> <div class="chat-tail svelte-1d2e8zz" aria-hidden="true"></div>`,1),eM=K(`<p> </p>`),tM=K(`<aside class="chat-context chat-plan svelte-1d2e8zz" aria-label="Chat plan summary"><!></aside>`),nM=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>`),rM=K(`<p>Loading skill profiles…</p>`),iM=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" title="Close skill profile editor"><!></button></div> <!></section>`),aM=K(`<!> <!> <!>`,1),oM=K(`<!> <!> <!> <!> <!> <!> <!>`,1),sM=K(`<main><!> <!> <!> <!></main> <!>`,1),cM=K(`<!> <!>`,1);function lM(e,t){et(t,!0);let n=(e,t=b)=>{let n=I(()=>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=I(()=>t()?W(Ot):W(kt)),i=I(()=>t()?W(n):void 0),o=I(()=>t()&&W(Xe)?.sessionId?{kind:`retained-session`,sessionId:W(Xe).sessionId}:t()&&W(it)?W(dt)&&W(j)?{kind:`session`,sessionId:W(j),planName:W(it)}:W(ht)?{kind:`workspace`,workspaceId:W(ht),planName:W(it)}:void 0:W(j)?{kind:`retained-session`,sessionId:W(j)}:void 0),s=I(()=>a?void 0:L),c=I(()=>t()&&W(Xe)?W($e)?.lastOrgPlan?.path:t()&&W(rt)?void 0:W(_t)?.lastOrgPlan?.path),l=I(()=>t()?Or:Tr);EE(e,{get catalog(){return W(nt)},get state(){return W(r)},get closeLabel(){return W(i)},get executeReference(){return W(o)},get executeTransport(){return W(s)},get downloadTransport(){return L},ondownloaderror:e=>nn.enqueue({kind:`error`,message:e}),onexecuteerror:e=>nn.enqueue({kind:`error`,message:e}),onexecuteresult:e=>void Ln(e),get sourcePath(){return W(c)},oncopyresult:e=>nn.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:Cr,onarchive:Pr,get archivingPlans(){return W(ft)},get onclose(){return W(l)},onreference:e=>Kr(e,t()),checkreferences:(e,n)=>Gr(e,n,t())})}},r=(e,n)=>{let r=Dt(()=>w(n?.(),!1));{let n=I(()=>W(Me)?`ready`:W(je)||W(Ne)?`loading`:`error`),i=I(()=>W(ue)===W(A));DD(e,{get rosterOnly(){return W(r)},get allowanceFetcher(){return t.authorizedFetch},get useWhenOver(){return W(on)},get savingAutoReset(){return W(sn)},onautoreset:e=>void dn(e),onallowanceerror:()=>nn.enqueue({kind:`warning`,message:`Could not refresh Codex allowance. Retrying automatically.`}),get sessions(){return W(M)},get rosterState(){return W(n)},get recentListState(){return W(Pe)},get forgettingStates(){return W(Ce)},get recentSessions(){return W(Le)},get selectedSessionId(){return W(j)},get activitySnapshots(){return W(Te)},get autopilotSnapshots(){return W(De).snapshots},get autopilotPending(){return W(De).pending},get autopilotAttention(){return W(De).attention},get workspaceTree(){return W(C)},get workspaceId(){return W(ve)},get expandedIds(){return W(xe)},get sandbox(){return W(Re)},get approvalPolicy(){return W(ze)},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(i)},get skillProfiles(){return W(he)},get selectedSkillProfile(){return W(ge)},get skillProfileError(){return W(_e)},get startingSession(){return W(Ve)},get workspaceConflictSessionId(){return W(N)},get openingSessionId(){return W(He)},get savingDefaults(){return W(ye)},onsavedefaults:()=>void er(),onworkspacechange:e=>{z(ve,e,!0),z(N,void 0)},onexpandedchange:e=>z(xe,e,!0),onsandboxchange:e=>z(Re,e,!0),onapprovalpolicychange:e=>z(ze,e,!0),onmodelchange:e=>z(ce,{...W(ce),[W(A)]:e}),onproviderchange:e=>void Mn(e),onskillprofilechange:e=>z(ge,e,!0),onmanageprofiles:e=>void Lr(e),onopen:Zn,onselectopen:Zn,onplan:jr,onclose:e=>void $n(e),onautopilottoggle:Kn,onactivityopen:e=>void Kt.resync(e),onautopilotresolve:Jn,onattentiondebug:(e,t,n)=>void zn(t,e,n),get debugPending(){return W(p)},onopenrecent:e=>void Qn(e),onforget:tr,oncopyresume:e=>void nr(e),onstart:()=>void Nn(),ondebugtrace:(e,t)=>void Un(e,t),get advancedExpanded(){return W(be)},set advancedExpanded(e){z(be,e,!0)}})}},i=Q(t,`oncreatepasskey`,3,()=>{}),a=oS(location.search),o=R(null),s=R(ln(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(ln(Mr(()=>t.theme))),C=R(ln([])),T=im.model,E=R(ln(im.reasoningEffort)),D=R(ln(im.executorModel)),O=R(ln(im.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(vt))){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||nn.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)}}}Fn(()=>{if(!W(te)||!W(vt)||!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=I(()=>W(le)?.kimi.available??!1),A=I(()=>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(ln(new Set)),Se=R(!1),j=R(null),M=R(ln([])),Ce=R(new Map),we=I(()=>W(j)?W(Ce).get(W(j)):void 0),Te=R(new Map),Ee=R(new Map),De=R({snapshots:new Map,attention:new Map,pending:new Set,errors:new Map}),Oe=R(new Map),ke=0,Ae=0,je=R(!0),Me=R(!1),Ne=R(null),Pe=R(`loading`),Fe=null,Ie=I(()=>W(M).some(e=>e.id===W(j))),Le=R(ln([])),Re=R(ln(im.sandbox)),ze=R(ln(im.approvalPolicy)),Be=R(ln({starting:!1,error:null})),N=R(void 0),Ve=I(()=>W(Be).starting),He=R(null),Ue=new AE(e=>{z(He,e,!0)}),We=R(null),Ge=R(null),Ke=R(``),qe=0,Je=new Map,Ye=R(ln({kind:`unavailable`,sessionId:null})),Xe=R(null),Ze=R(null),Qe=I(()=>W(Ze)!==null),$e=I(()=>W(M).find(e=>e.id===W(Xe)?.sessionId)??null),nt=R({kind:`no-workspace`}),rt=R(null),it=R(null),at=R(!1),ot=null,st=null,ct=0,lt=null,ut=null,dt=R(!1),ft=R(ln([])),pt=0,mt=R(null),ht=I(()=>W(C)[0]?.id??null),gt=I(()=>W(M).find(e=>e.id===W(j))?.workspacePath??null),_t=I(()=>W(M).find(e=>e.id===W(j))??null),vt=I(()=>!!(W(_t)&&W(_t).provider!==`kimi`&&[`ready`,`turnActive`].includes(W(_t).state))),yt=R(!1),bt=I(()=>W(yt)&&W(s)===`chat`&&!a);function xt(){let e=parseFloat(getComputedStyle(document.documentElement).fontSize)||16;z(yt,document.documentElement.clientWidth>=88*e)}ta(()=>{xt();let e=new MutationObserver(xt);return e.observe(document.documentElement,{attributes:!0,attributeFilter:[`style`,`class`]}),()=>e.disconnect()});let St=I(()=>Zm([{id:`debug`,label:`DEBUG`,tab:`chat`,available:e=>!!e.threadId,run:()=>void zn()}],W(s),W(_t))),Ct=I(()=>CT(W(_t)?.workspacePath??``)),wt=I(()=>W(_t)?`${W(_t).provider===`kimi`?`Kimi · `:``}${W(_t).model??T}`:T);function Tt(e){return`kind`in e&&e.kind===`org-source`}function Et(e){return a?e.filter(e=>e.id===W(j)):e}let Ot=I(()=>W(Xe)?W(Xe):W(rt)&&Tt(W(rt))?W(rt):W(rt)?{kind:`ready`,sessionId:`catalog`,plan:W(rt)}:{kind:`loading`,sessionId:`catalog`}),kt=I(()=>W(at)?null:W(Ye).kind===`ready`||W(Ye).kind===`closing`||W(Ye).kind===`error`&&W(Ye).plan?W(Ye):null),At=I(()=>kw(W(Ye).kind===`ready`||W(Ye).kind===`closing`||W(Ye).kind===`error`?W(Ye).plan:void 0)),jt=R(ln({workspaceId:null,summary:null,loading:!1,refreshing:!1,checkingOut:!1,error:null})),Mt=I(()=>W(jt).workspaceId),Nt=R(ln(new Set)),Pt=R(!1),Ft=R(!1),It=R(!1),Lt=R(null),Rt=R(null),zt=R(null),Bt=ln({}),Vt=R({}),Ht=R(null),Ut=I(()=>{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.`:``:``}),L=yw((e,n)=>t.authorizedFetch(e,n)),Wt=new qE({relay:L,publish:e=>z(Ce,e),onComplete:e=>{let t=e.id;z(M,W(M).filter(e=>e.id!==t),!0),Ae+=1,z(Le,ST(W(Le),e),!0),W(j)===t&&(Ue.invalidate(),qt.select(null),Kt.select(null),z(j,null),z(s,`sessions`),tn.saveSelectedSession(null),$t.select(null)),Xn(!0).then(()=>{z(Le,ST(W(Le),e),!0)})},onError:e=>{z(x,li(e,`SESSION_FORGET_FAILED`,!1),!0)}}),Gt=new xg(L,e=>z(De,e)),Kt=new ng({relay:L,publish:e=>z(Te,new Map(e)),publishEfficiency:e=>z(Ee,new Map(e)),onEvent:(e,t)=>{if(Gt.observe(e,t),t.type===`session.forget.updated`&&Wt.observe(e,t.payload),e!==W(j)&&(t.type===`plan.closed`&&Qt(e,void 0,!0),t.type===`plan.updated`)){let n=Sw(t.payload)?t.payload.plan:t.payload;Cw(n)&&Qt(e,n)}},onAuthoritativeSnapshot:(e,t)=>{Gt.applyAuthoritative(e,t),!(e===W(j)||t.currentSequence===void 0)&&(Cw(t.plan)?Qt(e,t.plan):t.plan===void 0&&Qt(e,void 0,!t.lastOrgPlan?.attached))}}),qt=new YS({relay:L,cache:iS(),publish:e=>z(o,e,!0),onConnectionChange:e=>{e&&W(j)&&(Kt.hydrate(W(j)),Xn()),e?W(te)&&W(vt)&&!W(re)&&ae():(ie?.abort(),z(ne,null),z(re,!1))},onSessionEvent:e=>X(e),onRelayEvent:e=>{W(j)&&Kt.observe(W(j),e),W(j)&&mn(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:yC(e);n&&nn.enqueue(n),e.type===`activity.updated`&&e.payload?.id===`gestalt-serena-availability`&&(ie?.abort(),z(ne,null),z(re,!1)),W(vt)&&z(ne,Ux(W(ne),e))},onHistoryError:e=>{z(x,li(e,`SESSION_HISTORY_READ_FAILED`),!0)},onSendError:(e,t)=>{let n=nC(e,`MESSAGE_SEND_FAILED`);if(n.code===`SESSION_WORKSPACE_BUSY`&&e instanceof Error&&`sessionId`in e&&typeof e.sessionId==`string`&&(z(N,e.sessionId,!0),z(s,`sessions`)),n.code===`SESSION_WORKSPACE_UNAVAILABLE`){z(We,null),z(Ge,null),nn.enqueue({kind:`warning`,...n});return}z(We,n.message,!0),z(Ge,n.retryable?t:null,!0),z(x,li(e,`MESSAGE_SEND_FAILED`),!0)},onSendAccepted:(e,t)=>{W(Ge)===t&&(z(We,null),z(Ge,null));let n=Je.get(t);n&&n.sessionId===e&&cr(n)},onHistoryPromptAccepted:(e,t)=>{let n=Je.get(t);n&&n.sessionId===e&&cr(n)}}),Jt=new kD({start:L.startSession},rg,e=>{z(Be,e,!0),z(N,e.conflict?.sessionId,!0)},e=>z(x,li(e,`SESSION_START_FAILED`),!0)),Yt=new uw({getSummary:L.getGitSummary,pull:L.pullGit,checkout:L.checkoutGitBranch},e=>!!MC(W(C),e)?.isGitRepository,e=>z(jt,e,!0),(e,t)=>li(e,t)),Xt=WO((e,n)=>t.authorizedFetch(e,n));function Zt(e){let t=W(Oe).get(e.id);return t?{...e,plan:t.plan,...t.detached&&e.lastOrgPlan?{lastOrgPlan:{...e.lastOrgPlan,attached:!1}}:{}}:e}function Qt(e,t,n=!1){z(Oe,new Map(W(Oe)).set(e,{plan:t,detached:n})),z(M,W(M).map(t=>t.id===e?Zt(t):t),!0)}let $t=Ow({getPlan:L.getPlan,closePlan:L.closePlan},e=>{z(Ye,e,!0),e.kind===`ready`||e.kind===`closing`?Qt(e.sessionId,e.plan):e.kind===`unavailable`&&e.sessionId&&Qt(e.sessionId,void 0,W(Oe).get(e.sessionId)?.detached)}),en=Ow({getPlan:L.getPlan,closePlan:L.closePlan},e=>{z(Xe,e.sessionId?e:null,!0),e.sessionId&&(e.kind===`unavailable`||e.kind===`error`)&&nn.enqueue({kind:`error`,code:`SESSION_PLAN_VIEW_${e.sessionId}`,message:`The plan for this session could not be opened.`})}),tn=LE(),nn=vC({historyStorage:gC()}),rn=fC(nn,gC()),an=`/api/codex/allowance/auto-reset`,on=R(null),sn=R(!1),cn=0,un=new AbortController;async function dn(e){if(!(W(sn)||W(on)===null)){z(sn,!0),++cn;try{let n=await t.authorizedFetch(an,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:e}),signal:un.signal});if(!n.ok)throw Error(`CODEX_AUTO_RESET_SAVE_FAILED`);let r=pC.parse(await n.json());un.signal.aborted||(z(on,r.enabled,!0),rn(r.resets))}catch{un.signal.aborted||nn.enqueue({kind:`error`,message:`Could not save the Codex reset credit preference.`})}finally{z(sn,!1)}}}ta(()=>{let e,n=async()=>{let r=cn;try{let e=await t.authorizedFetch(an,{signal:un.signal});if(!e.ok)return;let n=pC.parse(await e.json());un.signal.aborted||(r===cn&&!W(sn)&&z(on,n.enabled,!0),rn(n.resets))}catch{}finally{un.signal.aborted||(e=setTimeout(()=>void n(),15e3))}};return n(),()=>{un.abort(),clearTimeout(e)}});let mn=bC(nn),hn=new URLSearchParams(location.search).get(`tree-evidence`),gn=new URLSearchParams(location.search).get(`toast-evidence`),_n=new URLSearchParams(location.search).get(`activity-evidence`),vn=Mg(window.sessionStorage),yn=new Set;Fn(()=>{for(let[e,t]of W(De).attention){let n=`${e}:${t.requestId}`;vn.claim(n)&&nn.enqueue({kind:`error`,code:`AUTOPILOT_ATTENTION_${t.requestId}`,message:`Autopilot needs your attention.`})}}),Fn(()=>{let e=new Set;for(let[t,n]of W(De).errors){let r=`${t}:${n}`;e.add(r),!yn.has(r)&&(yn.add(r),nn.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 yn)e.has(t)||yn.delete(t)});function bn(){z(u,!0)}function xn(){z(u,!1),kr().then(()=>document.querySelector(`.menu-trigger`)?.focus())}function Sn(){z(l,!1),kr().then(()=>document.querySelector(`.menu-trigger`)?.focus())}let Cn=R(!1);async function wn(){if(!W(Cn)){z(Cn,!0);try{nn.enqueue(Hm(await L.cleanTmp()))}catch(e){li(e,`TMP_CLEANUP_UNAVAILABLE`)}finally{z(Cn,!1)}}}async function Tn(){try{await L.quit()}catch(e){throw li(e,`QUIT_FAILED`),e}}let En=new AbortController;async function Dn(){try{await zm((await L.upgrade()).instanceId,L.upgradeStatus,En.signal),window.location.reload()}catch(e){throw En.signal.aborted||li(e,`UPGRADE_FAILED`),e}}Fn(()=>{W(Se)&&GC(W(ve)||null)}),ta(()=>{if(hn===`sessions`||hn===`git`||gn===`error`||gn===`stacked`)return;a||Yn();let e=setTimeout(()=>{!a&&W(je)&&!W(Me)&&!W(Ne)&&Gn(!0).catch(()=>{})},150);return On(),()=>{clearTimeout(e),W(Ne)?.abort(),Fe=null}});async function On(){let e=Ae;try{let n=await qx(t.authorizedFetch);Ae===e&&z(M,Wt.reconcile(n.sessions).map(Zt),!0),z(Me,!0),z(je,!1),z(ve,NC(W(ve)||null,W(C),n.workspaces,DC.sessionBase)??``,!0),z(C,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=om(e,e?.provider??`codex`,W(k)[e?.provider??`codex`]);z(Re,t.sandbox,!0),z(ze,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:om(e,`codex`,W(k).codex).model,kimi:om(e,`kimi`,W(k).kimi).model}),MC(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:om(null,`codex`,W(k).codex).model})}catch(e){li(e,`SESSION_DEFAULTS_READ_FAILED`)}z(ee,n.versions??[]),z(oe,n.branding?.headerIconUrl??null,!0),z(ve,WC(W(C),W(ve))??``,!0),z(Se,!0),W(s)===`git`&&Yt.select(W(ve)||null),a||Ir(),z(xe,OC(W(C)),!0),z(Nt,OC(W(C)),!0);let r=a?null:await tn.readSelectedSession();W(j)||z(j,a?W(M).find(e=>e.id===a)?.id??null:W(M).some(e=>e.id===r)?r:W(M)[0]?.id??null,!0);let i=W(j);if(i){let e=await tn.readDraftEnvelope(i);W(j)===i&&(z(Ke,e.text,!0),qe=e.revision,lr(i,e.pending))}let o=Et(W(M).filter(e=>[`ready`,`turnActive`].includes(e.state)));Kt.bootstrap(o,W(j)),Gt.bootstrap(o),$t.select(W(j)),W(j)?qt.select(W(j)):a&&z(x,`This session is no longer open in Gestalt Mobile.`)}catch(e){z(je,!1),z(x,li(e,`RELAY_UNAVAILABLE`),!0)}}function kn(){W(Qe)&&Er(),z(s,`chat`),Br(`chat`),Ur()}function An(e){z(S,ba(e),!0)}function jn(){if(!W(j))return;let e=window.open(sS(location.href,W(j)),cS(W(j)),`popup,width=760,height=900`);if(!e){nn.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()}na(()=>{Ue.dispose(),En.abort(),ot?.abort(),st?.abort(),qt.dispose(),Wt.dispose(),Kt.dispose(),Gt.dispose(),$t.dispose(),en.dispose(),Yt.dispose(),Jt.dispose(),W(pe)?.dispose()});async function Mn(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 L.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){li(e,`SESSION_MODELS_READ_FAILED`)}finally{W(ue)===e&&z(ue,null)}}}async function Nn(){if(!W(ve)||W(Ve))return;let e=W(de)?W(se):`codex`,t=OD({workspaceId:W(ve),profile:`default`,profileState:`ok`});if(t.profile){z(x,t.profile,!0);return}let n=Pn();z(x,`Starting session…`);let r=await Jt.start(W(ve),{provider:e,sandbox:W(Re),approvalPolicy:W(ze),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 In(r,`empty`,n)}catch(e){li(e,`SESSION_START_FAILED`)}}function Pn(){let e=Ue.begin(),t=W(s);return()=>e()&&W(s)===t}async function In(e,t,n){await kE(e,{publish:e=>{let t=W(M).find(t=>t.id===e.id);z(M,t?W(M).map(t=>t.id===e.id?{...t,...e}:t):[...W(M),e],!0),Ae+=1},warn:e=>nn.enqueue({kind:`warning`,code:`SKILL_PROFILE_MISSING_SKILL`,message:e}),select:(e,t)=>{z(j,e.id,!0),z(We,null),z(Ge,null),z(Ke,``),qe=0,$t.select(e.id),qt.select(e.id,t===`empty`?{history:`empty`}:{}),Kt.select(e.id)},saveSelectedSession:e=>tn.saveSelectedSession(e),refreshRoster:async()=>{try{await Gn()}catch(e){li(e,`SESSION_REFRESH_FAILED`)}},readDraft:e=>tn.readDraftEnvelope(e),restoreDraft:(e,t)=>{z(Ke,t.text,!0),qe=t.revision,lr(e,t.pending)}},{history:t,isCurrent:n,present:()=>{kn(),z(x,`Session started.`)}})}async function Ln(e){if(e.kind!==`started`&&e.kind!==`partial`)return;let t=Pn();try{let n;try{n=await L.getSession(e.session.id)}catch(t){li(t,`SESSION_REFRESH_FAILED`),n=e.session}await In(n,`load`,t)}catch(e){li(e,`SESSION_START_FAILED`),Xn()}}let Rn;async function zn(e,t=W(_t)?.id,n){if(!t||W(p)||!e&&!W(_t)?.threadId)return;let r=W(j),i=W(s);Rn=n??document.querySelector(`.menu-trigger`)??void 0;let a=++g;z(p,!0);try{let n=await L.debugConfirmation(t,e);a===g&&W(j)===r&&W(s)===i&&z(f,n)}catch(e){li(e,`DEBUG_CONTEXT_FAILED`)}finally{a===g&&z(p,!1)}}function Bn(){z(f,null),queueMicrotask(()=>Rn?.focus())}async function Vn(){let e=W(f);if(e)try{let t=await L.startSelfDebug(e.context.mobileSession,e.confirmationId);z(f,null),await Gn(),await Zn(t.id)}catch(e){throw li(e,`DEBUG_START_FAILED`),Xn(),e}}function Un(e,t){h=t,z(m,e)}function Wn(){z(m,null),queueMicrotask(()=>h?.focus())}async function Gn(e=!1){let t=++ke,n=Ae;W(Ne)?.abort();let r=new AbortController;z(Ne,r);try{let i=await L.listSessions(r.signal);if(t!==ke||r.signal.aborted||e&&(W(Me)||n!==Ae))return;z(M,Wt.reconcile(i).map(Zt),!0),z(Me,!0),Ae+=1;let a=Et(W(M).filter(e=>[`ready`,`turnActive`].includes(e.state)));Kt.bootstrap(a,W(j)),Gt.bootstrap(a)}catch(e){if(r.signal.aborted||di(e))return;throw e}finally{W(Ne)===r&&z(Ne,null)}}async function Kn(e,t){Wt.isBusy(e)||(await Gt.toggle(e,t),e===W(j)&&Gn().catch(()=>{}))}async function qn(e){await Kn(e,!0),await kr(),e===W(j)&&document.getElementById(`chat-autopilot-${e}-button`)?.focus({preventScroll:!0})}async function Jn(e,t,n){Wt.isBusy(e)||(await Gt.resolve(e,t,n),e===W(j)&&Gn().catch(()=>{}))}function Yn(e=!1){if(Fe&&!e)return Fe;W(Pe)===`error`&&z(Pe,`loading`);let t=L.listRecentSessions().then(e=>{Fe===t&&(z(Le,e,!0),z(Pe,`ready`))},()=>{Fe===t&&(W(Pe)!==`ready`&&z(Pe,`error`),nn.enqueue({kind:`warning`,code:`RECENT_SESSIONS_READ_FAILED`,message:`Recent sessions could not be refreshed.`}))}).finally(()=>{Fe===t&&(Fe=null)});return Fe=t,t}async function Xn(e=!1){try{await Promise.all([Gn(),Yn(e)])}catch(e){z(x,li(e,`SESSION_REFRESH_FAILED`),!0)}}async function Zn(e){if(Wt.isBusy(e))return;let t=yT(W(M),e);if(t){z(N,t.id,!0),z(s,`sessions`),z(x,li(Object.assign(Error(`Workspace already running`),{code:`SESSION_WORKSPACE_BUSY`}),`SESSION_WORKSPACE_BUSY`),!0);return}z(x,`Opening session…`);let n=Ue.beginOpen(e);try{z(j,e,!0),z(We,null),z(Ge,null),$t.select(e),tn.saveSelectedSession(e),qt.select(e),Kt.select(e),kn();let t=await tn.readDraftEnvelope(e);n.isCurrent()&&W(j)===e&&(z(Ke,t.text,!0),qe=t.revision,lr(e,t.pending))}catch(e){z(x,li(e,`SESSION_HISTORY_READ_FAILED`),!0)}finally{n.finish()}}async function Qn(e){z(x,`Opening recent session…`);try{let t=await L.openRecentSession(e.id,e.cwd,e.provider??`codex`);W(M).some(e=>e.id===t.id)||(z(M,[...W(M),t],!0),Ae+=1),Xn(!0),await Zn(t.id)}catch(e){z(x,li(e,`SESSION_HISTORY_READ_FAILED`),!0)}}async function $n(e){if(!Wt.isBusy(e)){z(x,`Closing session…`);try{await L.releaseSession(e),W(j)===e&&(Ue.invalidate(),z(j,null),z(s,`sessions`),tn.saveSelectedSession(null),qt.select(null),Kt.select(null),$t.select(null)),await Xn(!0),z(x,`Session closed.`)}catch(e){z(x,li(e,`SESSION_CLOSE_FAILED`),!0)}}}async function er(){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(Re),approvalPolicy:W(ze)})})).ok)throw Error(`SESSION_DEFAULTS_SAVE_FAILED`);z(x,`Session defaults saved.`),nn.enqueue({kind:`success`,message:`Session defaults saved.`})}catch(e){li(e,`SESSION_DEFAULTS_SAVE_FAILED`)}finally{z(ye,!1)}}async function tr(e,t){let n=W(M).find(t=>t.id===e);n&&await Wt.forget(n,t)}async function nr(e){await E_(e)?(z(x,`Resume command copied.`),nn.enqueue({kind:`success`,message:W(x)})):z(x,li(Error(`SESSION_COPY_FAILED`),`SESSION_COPY_FAILED`),!0)}async function rr(e){if(!(!W(j)||Wt.isBusy(W(j))||W(o)?.activeTurnId))try{let t=await L.selectModel(W(j),e);z(M,W(M).map(e=>e.id===t.id?{...e,...t}:e),!0),z(Ke,``),z(x,`Model changed to ${e}; it applies to the next turn.`)}catch(e){z(x,`Could not change model: ${ci(e)}`)}}async function ir(e){if(!W(j)||Wt.isBusy(W(j))||!W(Ke).trim()||!qt.canSubmit(e)||[...Je.values()].some(e=>e.sessionId===W(j)&&e.revision===qe))return;let t=rg(),n={sessionId:W(j),revision:qe,text:W(Ke),operationId:t,kind:e};Je.set(t,n),tn.addPendingDraftOperation(W(j),n),e===`send`?qt.send(n.text,t):e===`queue`?qt.queue(n.text,t):qt.interruptAndSend(n.text,t)}let ar=()=>ir(`send`),or=()=>ir(`queue`),sr=()=>ir(`interrupt-send`);async function cr(e){let t=await tn.consumeAcceptedDraft(e.sessionId,e.revision,e.operationId);t&&Je.delete(e.operationId),t&&e.sessionId===W(j)&&e.revision===qe?(W(Ge)===e.operationId&&(z(Ge,null),z(We,null)),z(Ke,``),qe=t.revision,Vr()):e.sessionId===W(j)&&e.revision===qe&&(z(We,null),z(Ge,e.operationId,!0),nn.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 lr(e,t){for(let n of t??[])Je.set(n.operationId,{sessionId:e,...n});e===W(j)&&(t?.length??0)>0&&(z(We,null),z(Ge,t[0].operationId,!0),nn.enqueue({kind:`warning`,code:`PROMPT_RECOVERY_${W(Ge)}`,message:`A submitted prompt is being recovered. It will not be sent again automatically. Retry is available.`}))}async function ur(){if(!W(Ge))return;z(We,null);let e=Je.get(W(Ge));if(!e){await qt.retryPrompt(W(Ge));return}e.kind===`send`?await qt.send(e.text,e.operationId):e.kind===`queue`?await qt.queue(e.text,e.operationId):await qt.interruptAndSend(e.text,e.operationId)}async function dr(){await qt.interrupt()}async function fr(e){let t=W(_t)?.workspaceId;if(!t){nn.enqueue({kind:`error`,message:`Select a session workspace before uploading.`});return}for(let n of o_(e)){if(n.status===`too-large`){nn.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 L.uploadWorkspaceFile(t,{directory:e,filename:n.file.name,conflict:`keep-both`,file:n.file},rg());nn.enqueue({kind:`success`,message:e?`Uploaded ${r.path}.`:`Uploaded ${r.path} to workspace root.`}),Yr()}catch(e){li(e,`WORKSPACE_FILES_UPLOAD_FAILED`)}}}function pr(){W(s)===`chat`&&W(j)&&qt.refresh()}function mr(e){if(a||e===`chat`&&!W(Ie))return;let t=W(s)!==e;t&&Ue.invalidate(),z(s,e,!0),Br(e),e===`chat`&&(pr(),t&&Ur()),e===`git`&&(W(Mt)===(W(ve)||null)?W(Mt)&&Yt.refresh():(Yt.select(W(ve)||null),z(Pt,!1))),e===`plan`&&(t?W(j)&&$t.refresh(W(j)):Nr()),e===`sessions`&&(W(me)===`profile-manager`&&zr(!1),Xn(),W(j)&&$t.refresh(W(j)))}Fn(()=>{let e=W(ht);W(s)!==`plan`||a||Mr(()=>Sr(e))});let hr=!1;function gr(){document.visibilityState!==`visible`||hr||(hr=!0,queueMicrotask(()=>{hr=!1,document.visibilityState===`visible`&&(W(s)===`git`&&W(Mt)&&Yt.refresh(),(W(s)===`sessions`||W(bt))&&(Xn(),W(j)&&$t.refresh(W(j))))}))}let _r=null;function vr(e){return e instanceof Element&&e.closest(`button, input, textarea, select, a, summary, [contenteditable]`)!==null}function yr(e){e.pointerType!==`touch`||vr(e.target)||(_r={pointerId:e.pointerId,x:e.clientX,y:e.clientY})}function br(e){if(!_r||e.pointerId!==_r.pointerId)return;let t=_r;_r=null;let n=e.clientX-t.x,r=e.clientY-t.y;Math.abs(n)<48||Math.abs(n)<=Math.abs(r)||mr(jD(W(s),n<0?1:-1,{chatEnabled:W(Ie)}))}function xr(e){_r?.pointerId===e.pointerId&&(_r=null)}function Sr(e=W(ht)){if(ot&&ut===e)return;if(ot?.abort(),!e){z(nt,{kind:`no-workspace`});return}let t=new AbortController;ot=t,ut=e;let n=++ct;z(nt,lt?.workspaceId===e?{...lt,refreshing:!0}:{kind:`loading`,workspaceId:e}),L.listWorkspacePlans(e,t.signal).then(r=>{n!==ct||t.signal.aborted||(lt={kind:`ready`,workspaceId:e,entries:r},z(nt,lt))}).catch(r=>{n!==ct||t.signal.aborted||(!W(Qe)&&!W(kt)&&nn.enqueue({kind:`error`,code:`WORKSPACE_PLANS_READ_FAILED`,message:`Workspace Org files could not be listed. Try opening the Plan tab again.`}),z(nt,lt?.workspaceId===e?lt:{kind:`error`,workspaceId:e,error:r instanceof Error?r.message:`Could not load workspace plans.`}))}).finally(()=>{ot===t&&(ot=null)})}function Cr(e,t=!1,n=!1){let r=t?W(_t)?.workspaceId:W(ht);if(!r)return;n||(Ue.invalidate(),W(s)===`plan`&&!t&&z(at,!0),z(rt,null),z(it,e,!0),Dr()),W(Xe)&&en.select(null),st?.abort();let i=new AbortController;st=i;let a=++pt;z(dt,t,!0),(t&&W(j)?L.openSessionPlan(W(j),e):L.getWorkspacePlan(r,e,i.signal)).then(t=>{a!==pt||i.signal.aborted||(z(rt,t),z(it,e,!0))}).catch(()=>{a!==pt||i.signal.aborted||(W(rt)||Er(),nn.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(()=>{st===i&&(st=null)})}function wr(e){let t=W(_t)?.workspaceId,n=W(gt),r=n?w_(e,n):null;if(!t||!r){nn.enqueue({kind:`error`,code:`ORG_LINK_OUTSIDE_WORKSPACE`,message:`This Org file is not inside the selected workspace and cannot be opened.`});return}Cr(r,!0)}function Tr(){Ue.invalidate(),z(at,!0),Sr()}function Er(){z(Ze,null),W(Xe)&&en.select(null),st?.abort(),st=null,++pt,z(rt,null),z(it,null)}function Dr(){let e=document.activeElement;z(Ze,W(Ze)??{trigger:e instanceof HTMLElement?e:null,left:window.scrollX,top:window.scrollY})}function Or(){let e=W(Ze);Ue.invalidate(),Er(),kr().then(()=>{W(Qe)||!e?.trigger?.isConnected||(e.trigger.focus({preventScroll:!0}),window.scrollTo({left:e.left,top:e.top,behavior:`instant`}))}),W(s)===`plan`&&Sr()}function Ar(){W(j)&&jr(W(j))}function jr(e){bT(W(M).find(t=>t.id===e))&&(Ue.invalidate(),st?.abort(),++pt,z(rt,null),z(it,null),en.select(e),Dr())}function Nr(){W(Xe)?.sessionId&&en.refresh(W(Xe).sessionId),W(j)&&$t.refresh(W(j)),W(it)&&Cr(W(it),W(dt),!0),Sr()}async function Pr(e){let t=W(ht);if(!(!t||W(ft).includes(e))){z(ft,[...W(ft),e],!0);try{await L.archiveWorkspacePlan(t,e),lt?.workspaceId===t&&(ot?.abort(),ot=null,lt={...lt,entries:lt.entries.map(t=>t.planName===e?{...t,archived:!0}:t)},z(nt,lt),Sr(t)),nn.enqueue({kind:`success`,message:`Plan archived.`})}catch{nn.enqueue({kind:`error`,code:`PLAN_ARCHIVE_FAILED`,message:`The plan could not be archived. Check that it is writable and try again.`})}finally{z(ft,W(ft).filter(t=>t!==e),!0)}}}async function Fr(e,t){let n=new $D(L,e=>nn.enqueue({kind:`error`,code:`SKILL_PROFILE_OPERATION_FAILED`,message:e}));await n.load(e,t),z(pe,n,!0)}async function Ir(){try{let e=await L.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 Lr(e){let t=W(ve)||W(C)[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 Fr(t,n),z(me,`profile-manager`)}function Rr(e){queueMicrotask(()=>e.focus())}async function zr(e=!0){if(z(me,`list`),await kr(),e){let e=document.getElementById(`manage-skill-profiles`),t=e?.closest(`.advanced-settings`);t&&(t.open=!0),e?.focus()}}function Br(e){requestAnimationFrame(()=>{W(s)===e&&window.scrollTo({top:0,behavior:`instant`})})}function Vr(){Br(`chat`)}function Ur(){kr().then(()=>{W(s)===`chat`&&document.getElementById(`message`)?.focus({preventScroll:!0})})}function Wr(e){z(ve,e.id,!0),Yt.select(e.id),z(Pt,!1)}async function Gr(e,t,n){let r=!n||!W(it)||W(dt),i=n&&W(Xe)?W($e)?.workspaceId:r?W(_t)?.workspaceId:W(ht),a=W(it)??``;if(!i)return[];let o=e=>r?e:sj(a,e),s=new Set;try{for(let n=0;n<e.length;n+=64){if(t.aborted)return[];(await L.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||li(e,`WORKSPACE_FILES_READ_FAILED`),[]}}function Kr(e,t){let n=!t||!W(it)||W(dt),r=t&&W(Xe)?W($e)?.workspaceId:n?W(_t)?.workspaceId:W(ht);r&&z(d,{workspaceId:r,path:n?e:sj(W(it)??``,e)},!0)}function qr(e){let t=W(Mt)?MC(W(C),W(Mt)):null;t&&(z(_,t,!0),z(v,e,!0))}async function Jr(){z(_,null),await kr(),W(v)?.focus({preventScroll:!0})}function Yr(){y||(y=!0,queueMicrotask(()=>{y=!1,W(Mt)&&Yt.refresh()}))}async function K(){let e=W(Mt);!e||!MC(W(C),e)?.isGitRepository||(z(Rt,W(Rt)??rg(),!0),await Yt.pull(W(Rt)),W(jt).error||z(Rt,null))}async function Xr(e){if(W(Ft))return;let n=W(Mt)?MC(W(C),W(Mt)):void 0;if(!n||n.isGitRepository){z(Lt,null),nn.enqueue({kind:`error`,code:`INVALID_CLONE_DESTINATION`,message:`Select a non-repository folder before cloning.`});return}let r=n.id;z(Ft,!0),z(Lt,null);try{await L.cloneGitRepository(r,e);let n=await qx(t.authorizedFetch),i=dw(W(C),n.workspaces,r,e,W(Nt));z(ve,NC(W(ve)||null,W(C),n.workspaces,DC.sessionBase)??``,!0),z(C,n.workspaces,!0),z(ve,i.selectedId??W(ve),!0),Yt.select(i.selectedId),z(Nt,i.expandedIds,!0),z(Lt,`Repository cloned into the selected workspace.`),nn.enqueue({kind:`success`,message:`Repository cloned.`})}catch(e){li(e,`GIT_CLONE_FAILED`)}finally{z(Ft,!1)}}async function Zr(e){W(Mt)&&await Yt.checkout(e)}async function ei(){let e=W(Mt);if(!(!e||W(It))){z(It,!0),z(zt,W(zt)??rg(),!0);try{await L.pushGit(e,W(zt)),z(Pt,!1),await Yt.refresh(),z(zt,null)}catch(e){li(e,`GIT_PUSH_FAILED`)}finally{z(It,!1)}}}async function ti(e,t){await qt.respond(e,{decision:t})}async function ni(e){let t=e.kind===`quiz`?Iv(e.payload):Lv(e.payload);if(!t)return;let n=t.questions.map(t=>({id:t.id,answer:Bt[`${e.requestId}:${t.id}`]??``})),r=t.questions.map((e,t)=>({id:e.id,header:e.header,question:e.question,answer:n[t]?.answer??``}));z(Vt,{...W(Vt),[e.requestId]:r});let i=e.kind===`quiz`?Rv(n):hw(n);try{let t=`quiz-answer:${e.requestId}`,n=W(o)?.prompts.find(e=>e.operationId===t);if(!n||n.state===`failed`){let e=hy(r);W(o)?.activeTurnId?await qt.queue(e,t):await qt.send(e,t)}let a=qt.view.prompts.find(e=>e.operationId===t);if(e.kind===`quiz`&&(!a||a.state===`failed`))return;await qt.respond(e.requestId,i)}catch{z(x,`Could not send quiz answers. Please try again.`)}}async function ri(e){let t=mw(e.payload);if(!t){z(x,`Codex sent an invalid permission request.`);return}await qt.respond(e.requestId,t)}function ii(e){e.kind===`quiz`||e.kind===`userInput`?ni(e):e.kind===`permissionsApproval`?ri(e):qt.retryInteraction(e.requestId)}function ai(e,t,n){Bt[`${e}:${t}`]=n}function oi(e){z(Ke,e,!0),qe+=1;let t=W(j);t&&tn.replaceDraftText(t,e,qe)}function ci(e){return e instanceof Error?e.message:`Unknown relay error.`}function li(e,t,n=!0){let{code:r,...i}=nC(e,t);return nn.enqueue({kind:`error`,...i,...n?{code:r}:{}}),i.message}function ui(e,t=`code`){let n=t===`answer`?`Answer`:`Code`;nn.enqueue(e?{kind:`success`,message:`${n} copied.`}:{kind:`error`,message:`${n} could not be copied. Select it and copy it manually.`})}function di(e){return(e instanceof DOMException||e instanceof Error)&&e.name===`AbortError`}function X(e){let t=W(j);if(!t)return;if(e.type===`session.forget.updated`){Wt.observe(t,e.payload);return}if(e.type===`agent.activity.updated`)return;if(e.type===`session.status.updated`){let n=e.payload;$S(n)&&z(M,W(M).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(M,W(M).map(e=>e.id===t?{...e,...n}:e),!0);return}if(e.type!==`plan.updated`&&e.type!==`plan.closed`)return;let n=W(Ye);$t.applyEvent(t,e),en.applyEvent(t,e),e.type===`plan.closed`&&W(Ye)!==n&&Qt(t,void 0,!0)}var fi=cM();yi(`1d2e8zz`,e=>{Hn(()=>{pn.title=a&&W(Ct)?`Chat · ${W(Ct)} · Gestalt Mobile`:`Gestalt Mobile`})}),Hr(`focus`,fn,gr),Hr(`resize`,fn,xt),Hr(`visibilitychange`,pn,gr);var pi=V(fi);ia(pi,{});var mi=H(pi,2),hi=e=>{$h(e,{})},gi=e=>{EC(e,{get variant(){return gn}})},_i=e=>{var t=Jj();HC(B(t),{get context(){return hn}}),P(t),q(e,t)},vi=e=>{var h=sM(),g=V(h);let v;var y=B(g),b=e=>{{let n=I(()=>W(s)===`chat`?CT(W(M).find(e=>e.id===W(j))?.workspacePath??``):null),r=I(()=>W(s)===`chat`?W(wt):null),i=I(()=>W(_t)&&W(_t).provider!==`kimi`?W(ne):void 0),a=I(()=>W(s)===`chat`&&W(j)?jn:void 0),o=I(()=>W(s)===`chat`&&W(_t)?()=>{W(_t)?.resumeCommand&&nr(W(_t).resumeCommand)}:void 0),u=I(()=>!!W(_t)?.resumeCommand);Fm(e,{get theme(){return W(S)},get sessionPath(){return W(n)},get sessionModel(){return W(r)},get weeklyQuotaRemaining(){return W(At)},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(St)},get passkeyAuthEnabled(){return t.passkeyAuthEnabled},get onlock(){return t.onlock},ondevices:()=>z(c,!0),onnotifications:()=>z(l,!0),onscratchpad:bn,oncleantmp:wn,get cleanTmpPending(){return W(Cn)},onquit:Tn,onupgrade:Dn,onthemechange:An,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 w=H(y,2),E=e=>{var t=Xj(),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=Yj(),n=B(t);P(t),U(()=>J(n,`${W(_t).provider===`kimi`?`Kimi · `:``}${W(_t).model??``}`)),q(e,t)};Y(o,e=>{W(_t)?.model&&e(s)});var c=H(o,2),l=e=>{Rm(e,{compact:!0,icon:`plan`,label:`Plan for this session`,onclick:()=>jr(W(_t).id)})},u=I(()=>W(_t)&&bT(W(_t)));Y(c,e=>{W(u)&&e(l)}),P(t),U(()=>{Z(r,`title`,W(Ct)||a),J(i,W(Ct)||a)}),q(e,t)};Y(w,e=>{a&&e(E)});var D=H(w,2),O=e=>{wC(e,{get queue(){return nn}})};Y(D,e=>{W(Qe)||e(O)});var ie=H(D,2),se=e=>{HO(e,{get client(){return Xt},onclose:()=>{z(c,!1),kr().then(()=>document.querySelector(`.menu-trigger`)?.focus())},get onlock(){return t.onlock},oncreatepasskey:e=>i()(e)})},ce=e=>{uC(e,{get queue(){return nn},onclose:Sn})},le=e=>{var t=oM(),i=V(t),c=e=>{var t=nM();let n;var i=B(t),s=e=>{var t=Zj(),n=B(t);r(n,()=>!0),P(t),q(e,t)};Y(i,e=>{W(bt)&&e(s)});var c=H(i,2);{let e=e=>{{let t=I(()=>W(j)?W(De).snapshots.get(W(j))??null:null),n=I(()=>W(j)?W(De).attention.get(W(j))??null:null),r=I(()=>`chat-autopilot-safety-${W(j)??`none`}`),i=I(()=>W(j)?W(De).pending.has(W(j)):!1);jg(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 qn(W(j)),ondisable:()=>W(j)&&Kn(W(j),!1)})}};var l=H(B(c),2),u=B(l,!0);P(l);var f=H(l,2),m=t=>{var n=$j(),r=V(n),i=B(r);{let e=I(()=>W(o)?.newEmpty??!1),t=I(()=>W(o)?.status??W(x)),n=I(()=>W(o)?.readySince??null),r=I(()=>W(o)?.activeTurnId??null),a=I(()=>W(o)?.starting??!1),s=I(()=>!!(W(M).find(e=>e.id===W(j))&&![`ready`,`turnActive`].includes(W(M).find(e=>e.id===W(j))?.state??``))),c=I(()=>W(Ge)!==null),l=I(()=>W(k)[W(M).find(e=>e.id===W(j))?.provider??`codex`]),u=I(()=>W(M).find(e=>e.id===W(j))?.provider??`codex`);a_(i,{get newEmpty(){return W(e)},get status(){return W(t)},get readySince(){return W(n)},get message(){return W(Ke)},get activeTurnId(){return W(r)},get starting(){return W(a)},get detached(){return W(s)},get retryMessage(){return W(We)},get retryable(){return W(c)},get models(){return W(l)},get provider(){return W(u)},onchange:oi,onrevealprompt:Vr,onmodelselect:e=>void rr(e),onsend:()=>void ar(),onqueue:()=>void or(),oninterruptsend:()=>void sr(),onretry:()=>void ur(),oninterrupt:()=>void dr(),onuploadfiles:fr})}var s=H(i,2),c=e=>{var t=Qj(),n=B(t),r=e=>{Rm(e,{compact:!0,icon:`plan`,label:`Plan for this session`,onclick:()=>jr(W(j))})};Y(n,e=>{a||e(r)});var i=H(n,2),o=e=>{{let t=I(()=>W(De).snapshots.get(W(j))??null),n=I(()=>`chat-autopilot-${W(j)}`),r=I(()=>W(De).pending.has(W(j)));Eg(e,{compact:!0,get autopilot(){return W(t)},get controlId(){return W(n)},get pending(){return W(r)},ontoggle:e=>W(j)&&Kn(W(j),e)})}};Y(i,e=>{W(_t)?.provider!==`kimi`&&e(o)});var s=H(i,2);{let e=I(()=>W(Te).get(W(j))??null),t=I(()=>W(M).find(e=>e.id===W(j))?.model??T),n=I(()=>W(M).find(e=>e.id===W(j))?.plan);Vh(s,{compact:!0,popupPlacement:`below`,get activity(){return W(e)},get rootModel(){return W(t)},get plan(){return W(n)},onopen:()=>W(j)&&void Kt.resync(W(j))})}P(t),q(e,t)},l=I(()=>bT(W(_t)));Y(s,e=>{W(l)&&e(c)});var u=H(s,2),f=e=>{var t=$r();si(V(t),()=>W(j),e=>{{let t=I(()=>W(Ee).get(W(j))??null),n=I(()=>W(Te).get(W(j))??null);Zh(e,{get sessionId(){return W(j)},get snapshot(){return W(t)},get activity(){return W(n)}})}}),q(e,t)};Y(u,e=>{W(_t)?.provider!==`kimi`&&e(f)}),P(r);var m=H(r,2);{let t=I(()=>W(De).attention.get(W(j))??null),n=I(()=>W(De).pending.has(W(j))),r=I(()=>W(o)?[...W(o).messages]:[]),i=I(()=>W(o)?[...W(o).activities]:[]),a=I(()=>W(o)?.activeTurnId??null),s=I(()=>W(o)?.autopilotAuditTruncated??!1),c=I(()=>W(o)?[...W(o).interactions]:[]);Vx(m,{get attention(){return W(t)},get attentionPending(){return W(n)},onattentionresolve:(e,t)=>Jn(W(j),e,t),onattentiondebug:(e,t)=>void zn(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 Bt},get submittedAnswers(){return W(Vt)},onanswer:ai,onquiz:e=>void ni(e),onpermission:e=>void ri(e),ondecision:(e,t)=>void ti(e,t),onretry:ii,onopenorg:wr,onopenfile:(e,t)=>{W(_t)?.workspaceId&&z(d,{workspaceId:W(_t).workspaceId,sessionId:W(_t).id,path:e,line:t},!0)},oncopyresult:ui})}Zi(H(m,2),e=>z(Ht,e),()=>W(Ht)),U(()=>r.inert=W(we)!==void 0&&W(we).phase!==`failed`),q(t,n)},h=e=>{var t=eM(),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(Ut)))}var g=H(c,2),_=e=>{var t=tM();vT(B(t),{get state(){return W(Ye)},compact:!0,onopenfull:Ar}),P(t),q(e,t)};Y(g,e=>{W(bt)&&e(_)}),P(t),U(()=>n=Ai(t,1,`chat-layout svelte-1d2e8zz`,null,n,{"with-sidebars":W(bt)})),q(e,t)},l=e=>{n(e,()=>!1)},u=e=>{{let t=I(()=>W(Mt)?MC(W(C),W(Mt))??null:null);lw(e,{get workspaceTree(){return W(C)},get selectedWorkspace(){return W(t)},get expandedIds(){return W(Nt)},get summary(){return W(jt).summary},get refreshing(){return W(jt).refreshing},get checkingOut(){return W(jt).checkingOut},get cloning(){return W(Ft)},get pushing(){return W(It)},get error(){return W(jt).error},get cloneStatus(){return W(Lt)},get confirmingPush(){return W(Pt)},onpull:()=>void K(),oncheckout:e=>void Zr(e),onopenpushconfirmation:()=>z(Pt,!0),onpush:()=>void ei(),oncancelpush:()=>z(Pt,!1),onselect:Wr,onexpandedchange:e=>z(Nt,e,!0),onbrowsefiles:qr,onclone:e=>void Xr(e)})}},h=e=>{var t=$r(),n=V(t),i=e=>{var t=iM(),n=B(t),r=B(n);xi(r,()=>Rr);var i=H(r,2);sa(B(i),{name:`close`}),P(i),P(n);var a=H(n,2),o=e=>{QD(e,{get skillsState(){return W(pe)},onrefresh:e=>e.refresh(),onprofileschange:()=>void Ir(),heading:`Skill profile editor`})},s=e=>{q(e,rM())};Y(a,e=>{W(pe)?e(o):e(s,-1)}),P(t),G(`click`,i,()=>void zr()),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=>{Xm(e,{get confirmation(){return W(f)},onconfirm:Vn,onclose:Bn})};Y(g,e=>{W(f)&&e(v)});var y=H(g,2),b=e=>{let t=I(()=>W(m));{let n=I(()=>({workspaceId:W(t).workspaceId??W(t).id,path:W(t).selfDebug.tracePath}));vj(e,{get target(){return W(n)},readFile:async(e,n,r)=>{let i=JSON.stringify(await L.readDebugTrace(W(t).id,r),null,2);return{kind:`file`,path:n,content:i,size:new TextEncoder().encode(i).byteLength}},get listDirectory(){return L.listWorkspaceDirectory},onclose:Wn,onerror:e=>li(e,`DEBUG_TRACE_FAILED`)})}};Y(y,e=>{W(m)?.selfDebug&&e(b)});var S=H(y,2),w=e=>{qj(e,{get root(){return W(_)},onview:e=>{W(_)&&z(d,{workspaceId:W(_).id,path:e},!0)},get listDirectory(){return L.listWorkspaceDirectory},get copyEntry(){return L.copyWorkspaceEntry},get moveEntry(){return L.moveWorkspaceEntry},get deleteEntry(){return L.deleteWorkspaceEntry},get uploadFile(){return L.uploadWorkspaceFile},get createDirectory(){return L.createWorkspaceDirectory},onclose:()=>void Jr(),onerror:e=>li(e,`WORKSPACE_FILES_READ_FAILED`),onsuccess:e=>nn.enqueue({kind:`success`,message:e}),onmutation:Yr})};Y(S,e=>{W(_)&&e(w)});var E=H(S,2),D=e=>{OE(e,{onclose:Or,children:(e,t)=>{var r=aM(),i=V(r);wC(i,{get queue(){return nn}});var a=H(i,2),o=e=>{Rm(e,{onclick:Or,children:(e,t)=>{F(),q(e,Qr(`Close plan`))},$$slots:{default:!0}})};Y(a,e=>{(W(Ot).kind===`loading`||W(Ot).kind===`unavailable`||W(Ot).kind===`error`&&!W(Ot).plan)&&e(o)});var s=H(a,2);n(s,()=>!0),q(e,r)},$$slots:{default:!0}})};Y(E,e=>{W(Ze)&&e(D)});var O=H(E,2),ee=e=>{vj(e,{get target(){return W(d)},readFile:(e,t,n)=>W(d)?.sessionId?L.getSessionFilePreview(W(d).sessionId,t,n):L.getWorkspaceFilePreview(e,t,n),get listDirectory(){return L.listWorkspaceDirectory},onclose:()=>{z(d,null)},onerror:e=>li(e,`WORKSPACE_FILES_READ_FAILED`)})};Y(O,e=>{W(d)&&e(ee)});var te=H(O,2),ne=e=>{PD(e,{get activeTab(){return W(s)},get chatEnabled(){return W(Ie)},get focusTab(){return W(mt)},onselect:mr})};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=>{ek(e,{onclose:xn})};Y(ue,e=>{W(u)&&e(A)}),U(()=>v=Ai(g,1,`swipe-surface svelte-1d2e8zz`,null,v,{"wide-chat":W(bt)&&!W(c)&&!W(l)})),G(`pointerdown`,g,yr),G(`pointerup`,g,br),Hr(`pointercancel`,g,xr),q(e,h)};Y(mi,e=>{_n===`true`?e(hi):gn===`error`||gn===`stacked`?e(gi,1):hn===`sessions`||hn===`git`?e(_i,2):e(vi,-1)}),q(e,fi),tt()}Ur([`pointerdown`,`pointerup`,`click`]);function uM(){throw Error(`AUTH_RESPONSE_INVALID`)}async function dM(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 fM(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 pM(e){return!!e&&typeof e==`object`&&!!e.options&&typeof e.options.challenge==`string`}function mM(e){return!!e&&typeof e==`object`&&e.status===`authenticated`}function hM(e=fetch){async function t(){let t=await dM(await e(`/api/auth/status`,{credentials:`same-origin`}));return fM(t)||uM(),t}async function n(t,n={}){let r=await dM(await e(t,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}));return pM(r)||uM(),r}async function r(t,n){let r=await dM(await e(t,{method:`POST`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:JSON.stringify(n)}));return mM(r)||uM(),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 gM(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 _M(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 vM(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 yM(){return bM.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var bM={stubThis:e=>e};function xM(e){let{id:t}=e;return{...e,id:vM(t),transports:e.transports}}function SM(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 CM=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 wM({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 CM({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 CM({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 CM({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 CM({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 CM({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new CM({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 CM({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new CM({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(!SM(t))return new CM({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new CM({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 CM({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 CM({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 TM=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}}},EM=[`cross-platform`,`platform`];function DM(e){if(e&&!(EM.indexOf(e)<0))return e}async function OM(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(!yM())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:vM(t.challenge),user:{...t.user,id:vM(t.user.id)},excludeCredentials:t.excludeCredentials?.map(xM)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=TM.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw wM({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){kM(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=_M(e))}catch(e){kM(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=_M(c.getAuthenticatorData())}catch(e){kM(`getAuthenticatorData()`,e)}return{id:o,rawId:_M(s),response:{attestationObject:_M(c.attestationObject),clientDataJSON:_M(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:DM(a.authenticatorAttachment)}}function kM(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 AM(){if(!yM())return jM.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?jM.stubThis(new Promise(e=>e(!1))):jM.stubThis(e.isConditionalMediationAvailable())}var jM={stubThis:e=>e};function MM({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 CM({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new CM({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!SM(t))return new CM({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new CM({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 CM({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 NM(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(!yM())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(xM));let a={...t,challenge:vM(t.challenge),allowCredentials:i},o={};if(n){if(!await AM())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=TM.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw MM({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=_M(u.userHandle)),{id:c,rawId:_M(l),response:{authenticatorData:_M(u.authenticatorData),clientDataJSON:_M(u.clientDataJSON),signature:_M(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:DM(s.authenticatorAttachment)}}function PM(e){return typeof e==`object`&&e?e:{}}function FM(e){let t=PM(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 FM(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 IM(){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(!IM()){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 RM=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>`),zM=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>`),BM=K(`<p class="error svelte-1c5qcm6">Passkeys require a secure browser on this device.</p>`),VM=K(`<p class="feedback svelte-1c5qcm6"> </p>`),HM=K(`<img alt="QR code for the first-device setup link" class="svelte-1c5qcm6"/>`),UM=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>`),WM=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 GM(e,t){et(t,!0);let n=R(``),r=R(null),i=R(!1),a=R(null),o=!0,s=!0,c=I(()=>AO(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{}}ta(()=>{t.enrollmentTicket||jO(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))}),na(()=>{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 OM({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,FM(e),!0)}finally{z(i,!1)}}}var g=WM(),_=B(g),v=H(B(_),2),y=B(v,!0);P(v);var b=H(v,2),x=e=>{q(e,RM())},S=e=>{q(e,zM())};Y(b,e=>{t.enrollmentTicket?e(x):e(S,-1)});var C=H(b,4);Vi(C);var w=H(C,2),T=B(w,!0);P(w);var E=H(w,2),D=e=>{q(e,BM())},O=I(()=>!u());Y(E,e=>{W(O)&&e(D)});var k=H(E,2),ee=e=>{var t=VM(),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=UM(),n=B(t),r=e=>{var t=HM();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()]),qi(C,()=>W(n),e=>z(n,e)),G(`click`,w,()=>void h()),q(e,g),tt()}Ur([`click`]);var KM=K(`<p class="error svelte-1byekj9">Passkeys require this relay to be opened over a secure connection.</p>`),qM=K(`<p class="error svelte-1byekj9">This browser does not support passkeys. Use an authorized browser or device.</p>`),JM=K(`<p class="svelte-1byekj9"> </p> <button class="sign-in svelte-1byekj9" type="button"> </button>`,1),YM=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 XM(e,t){et(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)?FM(e):`We could not complete sign-in. Please try again.`}ta(()=>{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 NM({optionsJSON:e});await t.client.verifyLogin(n),t.onAuthenticated()}catch(e){z(n,o(e),!0)}finally{z(r,!1)}}}var c=YM(),l=B(c),u=H(B(l),4),d=e=>{q(e,KM())},f=e=>{q(e,qM())},p=e=>{var t=JM(),a=V(t),o=B(a,!0);P(a);var c=H(a,2),l=B(c,!0);P(c),Zi(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),tt()}Ur([`click`]);var ZM=K(`<p>Checking this device…</p>`),QM=K(`<h1 class="svelte-y74n0s">Passkey support is required</h1> <p> </p>`,1),$M=K(`<h1 class="svelte-y74n0s">Unable to check this device</h1> <p> </p> <button type="button" class="svelte-y74n0s">Try again</button>`,1),eN=K(`<main class="auth-gate svelte-y74n0s" aria-live="polite"><!></main>`);function tN(e,t){et(t,!0);let n=Q(t,`initialTheme`,3,`dyne-org`),r=R(void 0),i=I(()=>W(r)??t.enrollmentTicket),a=R(ln({kind:`checking`})),o=!1,s=hM(),c=LM(s,e=>z(a,e,!0)),l=gM(()=>c.locked(`Your session ended. Sign in with your passkey to continue.`));ta(()=>{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=$r(),p=V(f),m=e=>{lM(e,{get authorizedFetch(){return l},get theme(){return n()},get passkeyAuthEnabled(){return W(a).passkeyAuthEnabled},onlock:()=>void d(),oncreatepasskey:u})},h=e=>{GM(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=>{XM(e,{get client(){return s},get message(){return W(a).message},onAuthenticated:()=>c.authenticated()})},_=e=>{var t=eN(),n=B(t),r=e=>{q(e,ZM())},i=e=>{var t=QM(),n=H(V(t),2),r=B(n,!0);P(n),U(()=>J(r,W(a).message)),q(e,t)},o=e=>{var t=$M(),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),tt()}Ur([`click`]);function nN(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 rN(e,t,n,r=ti,i={}){return r(tN,{target:e,props:{enrollmentTicket:nN(t,n),initialTheme:ya(i)}})}function iN(){return{readyState:document.readyState,addLoadListener:e=>window.addEventListener(`load`,e,{once:!0}),serviceWorker:navigator.serviceWorker}}function aN(e=iN()){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 oN=document.getElementById(`app`);if(!oN)throw Error(`Missing application mount target`);rN(oN,window.location,window.history),aN();
|