@spikonado/sprocket 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,71 +0,0 @@
1
- import{$ as e,A as t,B as n,C as r,D as i,E as a,F as o,G as s,H as c,J as l,K as u,L as d,M as f,N as p,O as m,Q as h,R as g,S as _,T as v,U as y,W as b,X as x,Y as S,Z as C,_ as w,a as T,at as E,b as D,c as ee,d as O,dt as k,et as te,f as ne,ft as re,g as ie,i as A,it as j,j as M,k as ae,l as oe,m as se,n as ce,o as N,p as P,pt as le,q as F,rt as I,s as ue,u as L,ut as de,v as R,w as z,x as fe,y as B,z as V}from"../chunks/BrZMY0Kx.js";import{c as pe}from"../chunks/CCtE5nm3.js";import"../chunks/xihTtKlq.js";import{a as me,d as he,f as ge,i as _e,l as ve,n as ye,p as H,r as be,s as xe,t as Se,u as Ce}from"../chunks/tqyHaQv_.js";import{a as we,i as Te,o as Ee,r as De}from"../chunks/YGmybFhl.js";import{a as U,i as W,n as Oe,r as ke,t as Ae}from"../chunks/CBOYsvSw.js";import{a as je,n as Me,o as Ne}from"../chunks/CmkNNjW7.js";var Pe=Object.defineProperty,Fe=(e,t,n)=>t in e?Pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t,n)=>Fe(e,typeof t==`symbol`?t:t+``,n),Ie=`https://docs.convex.dev/error#undefined-validator`;function Le(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${Ie} for details.`)}var K=class{constructor({isOptional:e}){G(this,`type`),G(this,`fieldPaths`),G(this,`isOptional`),G(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},q=class e extends K{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),G(this,`tableName`),G(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},Re=class e extends K{constructor(){super(...arguments),G(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},ze=class e extends K{constructor(){super(...arguments),G(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},Be=class e extends K{constructor(){super(...arguments),G(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Ve=class e extends K{constructor(){super(...arguments),G(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},He=class e extends K{constructor(){super(...arguments),G(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Ue=class e extends K{constructor(){super(...arguments),G(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},We=class e extends K{constructor(){super(...arguments),G(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},Ge=class e extends K{constructor({isOptional:e,fields:t}){super({isOptional:e}),G(this,`fields`),G(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&Le(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},J=class e extends K{constructor({isOptional:e,value:t}){if(super({isOptional:e}),G(this,`value`),G(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:Ee(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},Ke=class e extends K{constructor({isOptional:e,element:t}){super({isOptional:e}),G(this,`element`),G(this,`kind`,`array`),t===void 0&&Le(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},qe=class e extends K{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),G(this,`key`),G(this,`value`),G(this,`kind`,`record`),t===void 0&&Le(`v.record()`,`key`),n===void 0&&Le(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},Je=class e extends K{constructor({isOptional:e,members:t}){super({isOptional:e}),G(this,`members`),G(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&Le(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},Y={id:e=>new q({isOptional:`required`,tableName:e}),null:()=>new Ue({isOptional:`required`}),number:()=>new Re({isOptional:`required`}),float64:()=>new Re({isOptional:`required`}),bigint:()=>new ze({isOptional:`required`}),int64:()=>new ze({isOptional:`required`}),boolean:()=>new Be({isOptional:`required`}),string:()=>new He({isOptional:`required`}),bytes:()=>new Ve({isOptional:`required`}),literal:e=>new J({isOptional:`required`,value:e}),array:e=>new Ke({isOptional:`required`,element:e}),object:e=>new Ge({isOptional:`required`,fields:e}),record:(e,t)=>new qe({isOptional:`required`,key:e,value:t}),union:(...e)=>new Je({isOptional:`required`,members:e}),any:()=>new We({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>Y.union(e,Y.null())},Ye=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],Xe=[`difference`,`intersection`,`symmetricDifference`,`union`],Ze=!1,Qe=class e extends Set{#e=new Map;#t=x(0);#n=x(0);#r=d||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}Ze||this.#a()}#i(e){return d===this.#r?x(e):S(e)}#a(){Ze=!0;var t=e.prototype,n=Set.prototype;for(let e of Ye)t[e]=function(...t){return p(this.#t),n[e].apply(this,t)};for(let r of Xe)t[r]=function(...t){p(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 p(this.#t),!1;r=this.#i(!0),n.set(e,r)}return p(r),t}add(e){return super.has(e)||(super.add(e),l(this.#n,super.size),F(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),l(r,!1)),t&&(l(this.#n,super.size),F(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())l(t,!1);e.clear(),l(this.#n,0),F(this.#t)}}keys(){return this.values()}values(){return p(this.#t),super.values()}entries(){return p(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return p(this.#n)}},$e=class extends Map{#e=new Map;#t=x(0);#n=x(0);#r=d||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return d===this.#r?x(e):S(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else return p(this.#t),!1;return p(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.has(e))n=this.#i(0),t.set(e,n);else{p(this.#t);return}return p(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),l(this.#n,super.size),F(o);else if(i!==t){F(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&F(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),l(n,-1)),r&&(l(this.#n,super.size),F(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;l(this.#n,0);for(var t of e.values())l(t,-1);F(this.#t),e.clear()}}#a(){p(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)p(n)}keys(){return p(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return p(this.#n),super.size}},et=2e4,tt={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},nt=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},rt=Symbol(`lucide-context`),it=()=>I(rt),at=new Set([`$$slots`,`$$events`,`$$legacy`,`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`,`children`]),ot=m(`<svg><!><!></svg>`);function X(e,t){E(t,!0);let n=it()??{},r=A(t,`color`,19,()=>n.color??`currentColor`),i=A(t,`size`,19,()=>n.size??24),o=A(t,`strokeWidth`,19,()=>n.strokeWidth??2),c=A(t,`absoluteStrokeWidth`,19,()=>n.absoluteStrokeWidth??!1),l=A(t,`iconNode`,19,()=>[]),u=T(t,at),d=C(()=>c()?Number(o())*24/Number(i()):o());var f=ot();oe(f,e=>({...tt,...e,...u,width:i(),height:i(),stroke:r(),"stroke-width":p(d),class:[`lucide-icon lucide`,n.class,t.name&&`lucide-${t.name}`,t.class]}),[()=>!t.children&&!nt(u)&&{"aria-hidden":`true`}]);var m=y(f);fe(m,17,l,_,(e,t)=>{var n=C(()=>le(p(t),2));let r=()=>p(n)[0],i=()=>p(n)[1];var o=a();w(b(o),r,!0,(e,t)=>{oe(e,()=>({...i()}))}),v(e,o)}),B(s(m),()=>t.children??re),k(f),v(e,f),j()}var st=new Set([`$$slots`,`$$events`,`$$legacy`]);function ct(e,t){let n=T(t,st),r=[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`}],[`path`,{d:`M10 12h4`}]];X(e,N({name:`archive`},()=>n,{get iconNode(){return r}}))}var lt=new Set([`$$slots`,`$$events`,`$$legacy`]);function ut(e,t){let n=T(t,lt),r=[[`path`,{d:`m12 19-7-7 7-7`}],[`path`,{d:`M19 12H5`}]];X(e,N({name:`arrow-left`},()=>n,{get iconNode(){return r}}))}var dt=new Set([`$$slots`,`$$events`,`$$legacy`]);function ft(e,t){let n=T(t,dt),r=[[`path`,{d:`m5 12 7-7 7 7`}],[`path`,{d:`M12 19V5`}]];X(e,N({name:`arrow-up`},()=>n,{get iconNode(){return r}}))}var pt=new Set([`$$slots`,`$$events`,`$$legacy`]);function mt(e,t){let n=T(t,pt),r=[[`path`,{d:`M12 5v16`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`}]];X(e,N({name:`book-open`},()=>n,{get iconNode(){return r}}))}var ht=new Set([`$$slots`,`$$events`,`$$legacy`]);function gt(e,t){let n=T(t,ht),r=[[`path`,{d:`M12 18V5`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`}]];X(e,N({name:`brain`},()=>n,{get iconNode(){return r}}))}var _t=new Set([`$$slots`,`$$events`,`$$legacy`]);function vt(e,t){let n=T(t,_t),r=[[`path`,{d:`M5 21v-6`}],[`path`,{d:`M12 21V3`}],[`path`,{d:`M19 21V9`}]];X(e,N({name:`chart-no-axes-column`},()=>n,{get iconNode(){return r}}))}var yt=new Set([`$$slots`,`$$events`,`$$legacy`]);function bt(e,t){let n=T(t,yt),r=[[`path`,{d:`M20 6 9 17l-5-5`}]];X(e,N({name:`check`},()=>n,{get iconNode(){return r}}))}var xt=new Set([`$$slots`,`$$events`,`$$legacy`]);function St(e,t){let n=T(t,xt),r=[[`path`,{d:`m6 9 6 6 6-6`}]];X(e,N({name:`chevron-down`},()=>n,{get iconNode(){return r}}))}var Ct=new Set([`$$slots`,`$$events`,`$$legacy`]);function wt(e,t){let n=T(t,Ct),r=[[`path`,{d:`m9 18 6-6-6-6`}]];X(e,N({name:`chevron-right`},()=>n,{get iconNode(){return r}}))}var Tt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Et(e,t){let n=T(t,Tt),r=[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`}]];X(e,N({name:`copy`},()=>n,{get iconNode(){return r}}))}var Dt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ot(e,t){let n=T(t,Dt),r=[[`path`,{d:`M14 9 9 4 4 9`}],[`path`,{d:`M20 20h-7a4 4 0 0 1-4-4V4`}]];X(e,N({name:`corner-left-up`},()=>n,{get iconNode(){return r}}))}var kt=new Set([`$$slots`,`$$events`,`$$legacy`]);function At(e,t){let n=T(t,kt),r=[[`path`,{d:`M12 15V3`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}],[`path`,{d:`m7 10 5 5 5-5`}]];X(e,N({name:`download`},()=>n,{get iconNode(){return r}}))}var jt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Mt(e,t){let n=T(t,jt),r=[[`path`,{d:`M15 3h6v6`}],[`path`,{d:`M10 14 21 3`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}]];X(e,N({name:`external-link`},()=>n,{get iconNode(){return r}}))}var Nt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Pt(e,t){let n=T(t,Nt),r=[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`}],[`path`,{d:`M9 10h6`}],[`path`,{d:`M12 13V7`}],[`path`,{d:`M9 17h6`}]];X(e,N({name:`file-diff`},()=>n,{get iconNode(){return r}}))}var Ft=new Set([`$$slots`,`$$events`,`$$legacy`]);function It(e,t){let n=T(t,Ft),r=[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`}]];X(e,N({name:`folder-open`},()=>n,{get iconNode(){return r}}))}var Lt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Rt(e,t){let n=T(t,Lt),r=[[`path`,{d:`M12 10v6`}],[`path`,{d:`M9 13h6`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]];X(e,N({name:`folder-plus`},()=>n,{get iconNode(){return r}}))}var zt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Bt(e,t){let n=T(t,zt),r=[[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`}]];X(e,N({name:`folder`},()=>n,{get iconNode(){return r}}))}var Vt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Ht(e,t){let n=T(t,Vt),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`}],[`path`,{d:`M2 12h20`}]];X(e,N({name:`globe`},()=>n,{get iconNode(){return r}}))}var Ut=new Set([`$$slots`,`$$events`,`$$legacy`]);function Wt(e,t){let n=T(t,Ut),r=[[`path`,{d:`M16 5h6`}],[`path`,{d:`M19 2v6`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}]];X(e,N({name:`image-plus`},()=>n,{get iconNode(){return r}}))}var Gt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Kt(e,t){let n=T(t,Gt),r=[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`}]];X(e,N({name:`loader-circle`},()=>n,{get iconNode(){return r}}))}var qt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Jt(e,t){let n=T(t,qt),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]];X(e,N({name:`lock`},()=>n,{get iconNode(){return r}}))}var Yt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Xt(e,t){let n=T(t,Yt),r=[[`path`,{d:`m16 17 5-5-5-5`}],[`path`,{d:`M21 12H9`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}]];X(e,N({name:`log-out`},()=>n,{get iconNode(){return r}}))}var Zt=new Set([`$$slots`,`$$events`,`$$legacy`]);function Qt(e,t){let n=T(t,Zt),r=[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`}]];X(e,N({name:`moon`},()=>n,{get iconNode(){return r}}))}var $t=new Set([`$$slots`,`$$events`,`$$legacy`]);function en(e,t){let n=T(t,$t),r=[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`}],[`path`,{d:`M2 6h4`}],[`path`,{d:`M2 10h4`}],[`path`,{d:`M2 14h4`}],[`path`,{d:`M2 18h4`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`}]];X(e,N({name:`notebook-pen`},()=>n,{get iconNode(){return r}}))}var tn=new Set([`$$slots`,`$$events`,`$$legacy`]);function nn(e,t){let n=T(t,tn),r=[[`path`,{d:`M15 12h-5`}],[`path`,{d:`M15 8h-5`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`}]];X(e,N({name:`scroll-text`},()=>n,{get iconNode(){return r}}))}var rn=new Set([`$$slots`,`$$events`,`$$legacy`]);function an(e,t){let n=T(t,rn),r=[[`path`,{d:`m21 21-4.34-4.34`}],[`circle`,{cx:`11`,cy:`11`,r:`8`}]];X(e,N({name:`search`},()=>n,{get iconNode(){return r}}))}var on=new Set([`$$slots`,`$$events`,`$$legacy`]);function sn(e,t){let n=T(t,on),r=[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];X(e,N({name:`settings`},()=>n,{get iconNode(){return r}}))}var cn=new Set([`$$slots`,`$$events`,`$$legacy`]);function ln(e,t){let n=T(t,cn),r=[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`}]];X(e,N({name:`square-pen`},()=>n,{get iconNode(){return r}}))}var un=new Set([`$$slots`,`$$events`,`$$legacy`]);function dn(e,t){let n=T(t,un),r=[[`path`,{d:`m7 11 2-2-2-2`}],[`path`,{d:`M11 13h4`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}]];X(e,N({name:`square-terminal`},()=>n,{get iconNode(){return r}}))}var fn=new Set([`$$slots`,`$$events`,`$$legacy`]);function pn(e,t){let n=T(t,fn),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];X(e,N({name:`square`},()=>n,{get iconNode(){return r}}))}var mn=new Set([`$$slots`,`$$events`,`$$legacy`]);function hn(e,t){let n=T(t,mn),r=[[`circle`,{cx:`12`,cy:`12`,r:`4`}],[`path`,{d:`M12 2v2`}],[`path`,{d:`M12 20v2`}],[`path`,{d:`m4.93 4.93 1.41 1.41`}],[`path`,{d:`m17.66 17.66 1.41 1.41`}],[`path`,{d:`M2 12h2`}],[`path`,{d:`M20 12h2`}],[`path`,{d:`m6.34 17.66-1.41 1.41`}],[`path`,{d:`m19.07 4.93-1.41 1.41`}]];X(e,N({name:`sun`},()=>n,{get iconNode(){return r}}))}var gn=new Set([`$$slots`,`$$events`,`$$legacy`]);function _n(e,t){let n=T(t,gn),r=[[`path`,{d:`M12 19h8`}],[`path`,{d:`m4 17 6-6-6-6`}]];X(e,N({name:`terminal`},()=>n,{get iconNode(){return r}}))}var vn=new Set([`$$slots`,`$$events`,`$$legacy`]);function yn(e,t){let n=T(t,vn),r=[[`circle`,{cx:`12`,cy:`8`,r:`5`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`}]];X(e,N({name:`user-round`},()=>n,{get iconNode(){return r}}))}var bn=new Set([`$$slots`,`$$events`,`$$legacy`]);function xn(e,t){let n=T(t,bn),r=[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`}]];X(e,N({name:`wrench`},()=>n,{get iconNode(){return r}}))}var Sn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Cn(e,t){let n=T(t,Sn),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];X(e,N({name:`x`},()=>n,{get iconNode(){return r}}))}var wn=new Set([`$$slots`,`$$events`,`$$legacy`]);function Tn(e,t){let n=T(t,wn),r=[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`}]];X(e,N({name:`zap`},()=>n,{get iconNode(){return r}}))}var En=i(`<button><!></button>`);function Dn(e,t){E(t,!0);let n=A(t,`type`,3,`button`),r=A(t,`variant`,3,`default`),i=A(t,`className`,3,``),a=A(t,`disabled`,3,!1),o=C(()=>r()===`outline`?`border-border bg-surface/80 text-foreground hover:bg-[var(--hover-fill)]`:`bg-primary text-primary-foreground hover:opacity-90`);var s=En();B(y(s),()=>t.children??re),k(s),V(e=>{O(s,`type`,n()),s.disabled=a(),P(s,1,e)},[()=>se(U(`focus-visible:ring-ring/50 inline-flex h-10 items-center justify-center gap-2 rounded-full border border-transparent px-5 py-2 text-sm font-medium transition-opacity focus-visible:ring-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50`,p(o),i()))]),M(`click`,s,function(...e){t.onclick?.apply(this,e)}),v(e,s),j()}t([`click`]);var On=i(`<!> <!>`,1),kn=i(`<p class="text-destructive text-center text-sm" role="alert"> </p>`),An=i(`<div class="text-muted-foreground flex items-center justify-center gap-2 text-sm" aria-live="polite" aria-busy="true"><!> <span> </span></div>`),jn=i(`<div><!></div>`);function Mn(e,t){E(t,!0);let n=A(t,`overlayOpen`,3,!1),i=C(()=>t.authState.isAuthenticated&&(t.authState.isLoading||!t.authState.connectionFailed)),o=C(()=>!t.authState.isAuthenticated&&t.authState.isLoading),c=C(()=>t.authState.isConfigured?p(i)?`Confirming your session`:t.authState.connectionFailed?`Couldn’t connect your account`:p(o)?`Preparing sign-in`:`Sign in to continue`:`Sign-in unavailable`),l=C(()=>t.authState.isConfigured?p(i)?`Verifying your secure connection before opening your workspace.`:t.authState.connectionFailed?`You’re signed in, but the secure connection could not be confirmed. Retry or sign out and sign in again.`:p(o)?`Getting account sign-in ready. This usually takes a moment.`:`Sign in to sync your coding threads, streaming responses, and projects.`:`Account sign-in is not configured on this deployment, so account actions are disabled.`),u=C(()=>t.authState.isAuthenticated?`Almost there`:`One moment`),d=C(()=>!!(t.authState.isConfigured&&t.authState.error&&!n()));var f=jn();Ae(y(f),{get title(){return p(c)},get description(){return p(l)},actions:e=>{var n=a(),i=b(n),o=e=>{var n=On(),i=b(n),a=e=>{Dn(e,{get onclick(){return t.onRetry},get disabled(){return t.authState.isLoading},children:(e,t)=>{de(),v(e,ae(`Retry`))},$$slots:{default:!0}})};r(i,e=>{t.authState.connectionFailed&&e(a)}),Dn(s(i,2),{variant:`outline`,get onclick(){return t.onSignOut},children:(e,t)=>{de(),v(e,ae(`Sign Out`))},$$slots:{default:!0}}),v(e,n)},c=e=>{var n=On(),r=b(n);Dn(r,{get onclick(){return t.onSignIn},get disabled(){return t.authState.isLoading},children:(e,t)=>{de(),v(e,ae(`Sign In`))},$$slots:{default:!0}}),Dn(s(r,2),{variant:`outline`,get onclick(){return t.onSignUp},get disabled(){return t.authState.isLoading},children:(e,t)=>{de(),v(e,ae(`Create Account`))},$$slots:{default:!0}}),v(e,n)};r(i,e=>{t.authState.isAuthenticated?e(o):t.authState.isConfigured&&e(c,1)}),v(e,n)},children:(e,n)=>{var i=On(),a=b(i),o=e=>{var n=kn(),r=y(n,!0);k(n),V(()=>z(r,t.authState.error)),v(e,n)};r(a,e=>{p(d)&&e(o)});var c=s(a,2),l=e=>{var t=An(),n=y(t);Kt(n,{class:`size-3.5 animate-spin`,"aria-hidden":`true`});var r=s(n,2),i=y(r,!0);k(r),k(t),V(()=>z(i,p(u))),v(e,t)};r(c,e=>{t.authState.isLoading&&e(l)}),v(e,i)},$$slots:{actions:!0,default:!0}}),k(f),V(()=>{f.inert=n(),O(f,`aria-hidden`,n()?!0:void 0)}),v(e,f),j()}var Nn=i(`<div class="text-muted-foreground mb-4 flex justify-center" aria-hidden="true"><!></div>`),Pn=i(`<p class="text-muted-foreground mt-6 max-h-24 overflow-y-auto font-mono text-[11px] leading-5 break-all select-all"> </p>`),Fn=i(`<p class="text-destructive mt-4 text-sm" role="alert"> </p>`),In=i(`<p class="mt-4 text-sm text-amber-700" role="alert"> </p>`),Ln=i(`<!> Open browser`,1),Rn=i(`<!> Copied`,1),zn=i(`<!> Copy link`,1),Bn=i(`<!> <!>`,1),Vn=i(`<span class="text-muted-foreground border-border inline-flex h-10 items-center justify-center gap-2 rounded-full border px-4 text-sm">Preparing link…</span>`),Hn=i(`<div class="app-entry-shell fixed inset-0 z-50 flex items-center justify-center px-6" role="presentation"><div class="border-border/70 bg-surface relative z-10 w-full max-w-md rounded-2xl border p-8 text-center shadow-[0_18px_50px_-28px_oklch(0.2_0.02_260/0.45)] outline-none" role="dialog" aria-modal="true" aria-labelledby="browser-signin-title" aria-describedby="browser-signin-desc" tabindex="-1"><!> <h2 id="browser-signin-title" class="font-brand text-foreground text-[1.35rem] font-semibold tracking-tight"> </h2> <p id="browser-signin-desc" class="text-muted-foreground mt-3 text-sm leading-[1.55]"> </p> <!> <!> <!> <div class="mt-6 flex flex-wrap items-center justify-center gap-3"><!></div> <div class="mt-6"><button type="button" class="text-muted-foreground hover:text-foreground decoration-foreground/30 hover:decoration-foreground text-[13px] underline underline-offset-4 transition-colors">Cancel</button></div></div></div>`);function Un(e,t){E(t,!0);let i=A(t,`error`,3,null),c=x(!1),u=x(null),d=x(null),f=null;n(()=>{if(!t.open){l(c,!1),l(u,null);return}let e=document.activeElement instanceof HTMLElement?document.activeElement:null,n=!1;o().then(()=>{n||p(d)?.focus()});function r(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.onCancel();return}if(e.key!==`Tab`||!p(d))return;let n=Array.from(p(d).querySelectorAll(`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`)&&e.offsetParent!==null);if(n.length===0){e.preventDefault(),p(d).focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===p(d)||a===r||!p(d).contains(a))?(e.preventDefault(),i.focus()):!e.shiftKey&&(a===p(d)||a===i||!p(d).contains(a))&&(e.preventDefault(),r.focus())}return window.addEventListener(`keydown`,r,!0),()=>{n=!0,window.removeEventListener(`keydown`,r,!0),f!==null&&(window.clearTimeout(f),f=null),e?.isConnected&&e.focus()}});async function m(){if(t.signInUrl)try{await navigator.clipboard.writeText(t.signInUrl),l(c,!0),l(u,null),f!==null&&window.clearTimeout(f),f=window.setTimeout(()=>{l(c,!1),f=null},2e3)}catch{l(c,!1),l(u,`Could not copy the sign-in link. Select it above and copy manually.`)}}function h(){if(!t.signInUrl)return;let e=window.open(t.signInUrl,`_blank`);if(e){try{e.opener=null}catch{}t.onClearOpenError?.()}}let g=C(()=>t.signInUrl?i()?{title:`Open the sign-in link`,description:`Your browser didn’t open automatically. Continue with the options below.`}:{title:`Finish signing in`,description:`We opened your browser to complete sign-in. Waiting for you to finish there.`}:{title:`Preparing sign-in`,description:`Preparing a secure sign-in link. This usually takes a moment.`});var _=a(),S=b(_),w=e=>{var n=Hn(),o=y(n),f=y(o),_=e=>{var t=Nn();Kt(y(t),{class:`size-5 animate-spin`}),k(t),v(e,t)};r(f,e=>{t.signInUrl||e(_)});var x=s(f,2),S=y(x,!0);k(x);var C=s(x,2),w=y(C,!0);k(C);var T=s(C,2),E=e=>{var n=Pn(),r=y(n,!0);k(n),V(()=>{O(n,`title`,t.signInUrl),z(r,t.signInUrl)}),v(e,n)};r(T,e=>{t.signInUrl&&e(E)});var D=s(T,2),ee=e=>{var t=Fn(),n=y(t,!0);k(t),V(()=>z(n,i())),v(e,t)};r(D,e=>{i()&&e(ee)});var te=s(D,2),ne=e=>{var t=In(),n=y(t,!0);k(t),V(()=>z(n,p(u))),v(e,t)};r(te,e=>{p(u)&&e(ne)});var re=s(te,2),ie=y(re),A=e=>{var t=Bn(),n=b(t);Dn(n,{onclick:h,children:(e,t)=>{var n=Ln();Mt(b(n),{class:`size-4`,"aria-hidden":`true`}),de(),v(e,n)},$$slots:{default:!0}}),Dn(s(n,2),{variant:`outline`,onclick:()=>void m(),children:(e,t)=>{var n=a(),i=b(n),o=e=>{var t=Rn();bt(b(t),{class:`size-4`,"aria-hidden":`true`}),de(),v(e,t)},s=e=>{var t=zn();Et(b(t),{class:`size-4`,"aria-hidden":`true`}),de(),v(e,t)};r(i,e=>{p(c)?e(o):e(s,-1)}),v(e,n)},$$slots:{default:!0}}),v(e,t)},j=e=>{v(e,Vn())};r(ie,e=>{t.signInUrl?e(A):e(j,-1)}),k(re);var ae=s(re,2),oe=y(ae);k(ae),k(o),ue(o,e=>l(d,e),()=>p(d)),k(n),V(()=>{z(S,p(g).title),z(w,p(g).description)}),M(`click`,n,e=>{e.target===e.currentTarget&&t.onCancel()}),M(`click`,oe,function(...e){t.onCancel?.apply(this,e)}),v(e,n)};r(S,e=>{t.open&&e(w)}),v(e,_),j()}t([`click`]);var Wn=i(`<label class="text-muted-foreground flex h-10 items-center gap-2 border-b border-[var(--hairline)] px-2"><!> <span class="sr-only"> </span> <input class="text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent text-sm outline-none"/></label>`),Gn=i(`<p class="text-muted-foreground px-3 pt-1 pb-2 text-[11px] font-medium"> </p>`),Kn=i(`<span><!></span>`),qn=i(`<span class="text-muted-foreground shrink-0" aria-hidden="true"><!></span>`),Jn=i(`<button type="button"><!> <span> </span> <!></button>`),Yn=i(`<p class="text-muted-foreground px-3 py-5 text-center text-sm">No matches found</p>`),Xn=i(`<div class="bg-popover/96 absolute bottom-[calc(100%+0.75rem)] left-0 z-50 min-w-[19rem] rounded-[18px] border border-[var(--hairline)] p-2 shadow-[var(--composer-shadow)] backdrop-blur-xl" role="dialog"><!> <div><!> <!></div></div>`),Zn=i(`<div class="text-tooltip-foreground bg-tooltip ring-border pointer-events-none fixed z-100 -translate-x-1/2 -translate-y-full rounded-md px-2.5 py-1.5 text-[12px] leading-4 whitespace-nowrap shadow-lg ring-1" role="tooltip"> </div>`),Qn=i(`<div><button type="button" aria-haspopup="dialog"><!> <span class="truncate"> </span> <!></button> <!></div> <!>`,1);function $n(e,t){E(t,!0);let i=A(t,`value`,15,``),o=A(t,`disabled`,3,!1),c=A(t,`className`,3,``),u=A(t,`triggerClassName`,3,``),d=A(t,`searchable`,3,!1),m=x(!1),h=x(``),g=x(null),_=x(null),S=x(null),w=x(null),T=x(!1),D=null,te=C(()=>{let e=t.options.find(e=>e.id===i());return e&&!e.locked?e:t.options.find(e=>!e.locked)??e??t.options[0]??null}),re=C(()=>d()&&p(h).trim()?t.options.filter(e=>e.label.toLocaleLowerCase().includes(p(h).trim().toLocaleLowerCase())):t.options),ie=C(()=>p(re).filter(e=>!e.locked));function ae(){o()||(l(m,!p(m)),p(m)&&d()?queueMicrotask(()=>p(S)?.focus()):l(h,``))}function oe(e,n){let r=t.options.find(t=>t.id===e);if(r){if(r.locked){n&&r.lockTooltip&&le(n,r.lockTooltip,!0);return}e!==i()&&(i(e),t.onValueChange?.(e)),l(m,!1),l(h,``),F(!0),p(_)?.focus()}}function ce(e){e.key!==`Enter`||p(ie).length===0||(e.preventDefault(),oe(p(ie)[0].id))}function N(){D&&=(clearTimeout(D),null)}function le(e,t,n=!1){let r=e.currentTarget;if(!(r instanceof HTMLElement))return;let i=r.getBoundingClientRect();N(),l(T,n,!0),l(w,{top:i.top-8,left:i.left+i.width/2,label:t},!0),n&&(D=setTimeout(()=>{l(T,!1),D=null,l(w,null)},2500))}function F(e=!1){p(T)&&!e||(N(),l(T,!1),l(w,null))}n(()=>{if(!p(m)){l(h,``),F();return}function e(e){let t=e.target;t instanceof Node&&(p(g)?.contains(t)||l(m,!1))}function t(e){e.key===`Escape`&&(l(m,!1),p(_)?.focus())}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}}),n(()=>{o()&&l(m,!1)});var I=Qn(),de=b(I),R=y(de),pe=y(R),me=e=>{var n=a();B(b(n),()=>t.optionIcon,()=>p(te)),v(e,n)};r(pe,e=>{t.optionIcon&&p(te)&&e(me)});var he=s(pe,2),ge=y(he,!0);k(he);var _e=s(he,2);{let e=C(()=>U(`text-muted-foreground size-3 shrink-0 transition-transform`,p(m)&&`rotate-180`));St(_e,{get class(){return p(e)}})}k(R),ue(R,e=>l(_,e),()=>p(_));var ve=s(R,2),ye=e=>{var n=Xn(),a=y(n),o=e=>{var n=Wn(),r=y(n);an(r,{class:`size-4 shrink-0`});var i=s(r,2),a=y(i);k(i);var o=s(i,2);L(o),ue(o,e=>l(S,e),()=>p(S)),k(n),V((e,t)=>{z(a,`Search ${e??``}`),O(o,`placeholder`,t)},[()=>t.menuTitle.toLocaleLowerCase(),()=>`Search ${t.menuTitle.toLocaleLowerCase()}…`]),M(`keydown`,o,ce),ee(o,()=>p(h),e=>l(h,e)),v(e,n)},c=e=>{var n=Gn(),r=y(n,!0);k(n),V(()=>z(r,t.menuTitle)),v(e,n)};r(a,e=>{d()?e(o):e(c,-1)});var u=s(a,2),m=y(u);fe(m,17,()=>p(re),e=>e.id,(e,n)=>{let a=C(()=>!!p(n).locked);var o=Jn(),c=y(o),l=e=>{var r=Kn();B(y(r),()=>t.optionIcon,()=>p(n)),k(r),V(e=>P(r,1,e),[()=>se(U(`flex size-7 shrink-0 items-center justify-center`,(p(a),`text-muted-foreground`)))]),v(e,r)};r(c,e=>{t.optionIcon&&e(l)});var u=s(c,2),d=y(u,!0);k(u);var m=s(u,2),h=e=>{var t=qn();Jt(y(t),{class:`size-3.5`}),k(t),v(e,t)},g=e=>{{let t=C(()=>U(`text-accent-strong size-4 shrink-0 transition-opacity`,p(n).id===i()?`opacity-100`:`opacity-0`));bt(e,{get class(){return p(t)}})}};r(m,e=>{p(a)?e(h):e(g,-1)}),k(o),V((e,t)=>{P(o,1,e),O(o,`aria-pressed`,!p(a)&&p(n).id===i()),O(o,`aria-disabled`,p(a)),O(o,`aria-label`,p(a)&&p(n).lockTooltip?`${p(n).label}. ${p(n).lockTooltip}`:void 0),P(u,1,t),z(d,p(n).label)},[()=>se(U(`focus-visible:ring-ring/60 flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left outline-none focus-visible:ring-2`,p(a)?`cursor-not-allowed opacity-45`:`hover:bg-[var(--hover-fill)]`,!p(a)&&p(n).id===i()&&`bg-[var(--hover-fill)]`)),()=>se(U(`min-w-0 flex-1 truncate text-sm font-medium`,p(a)?`text-muted-foreground`:`text-foreground`))]),f(`mouseenter`,o,e=>{p(a)&&p(n).lockTooltip&&le(e,p(n).lockTooltip)}),f(`mouseleave`,o,()=>F()),f(`focus`,o,e=>{p(a)&&p(n).lockTooltip&&le(e,p(n).lockTooltip)}),f(`blur`,o,()=>F()),M(`click`,o,e=>{oe(p(n).id,e)}),v(e,o)});var g=s(m,2),_=e=>{v(e,Yn())};r(g,e=>{p(re).length===0&&e(_)}),k(u),k(n),V(e=>{O(n,`aria-label`,t.menuTitle),P(u,1,e)},[()=>se(U(`space-y-0.5`,d()&&`pt-1.5`))]),v(e,n)};r(ve,e=>{p(m)&&e(ye)}),k(de),ue(de,e=>l(g,e),()=>p(g));var H=s(de,2),be=e=>{var t=Zn(),n=y(t,!0);k(t),V(()=>{ne(t,`top: ${p(w).top}px; left: ${p(w).left}px;`),z(n,p(w).label)}),v(e,t)};r(H,e=>{p(w)&&e(be)}),V((e,n)=>{P(de,1,e),P(R,1,n),O(R,`aria-expanded`,p(m)),O(R,`aria-label`,t.ariaLabel),R.disabled=o(),z(ge,p(te)?.triggerLabel??p(te)?.label??i())},[()=>se(U(`relative`,c())),()=>se(U(`focus-visible:ring-ring/60 text-muted-foreground inline-flex h-8 shrink-0 items-center gap-2 rounded-lg border border-transparent bg-transparent px-2 text-sm font-medium transition outline-none hover:bg-[var(--hover-fill)] focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50`,!t.optionIcon&&`gap-1`,u()))]),M(`click`,R,ae),v(e,I),j()}t([`click`,`keydown`]);var er=m(`<title> </title>`),tr=m(`<svg viewBox="146.694 227.042 267.198 264.812" xmlns="http://www.w3.org/2000/svg" role="img" fill="none"><!><path d="M249.176 323.434V298.276C249.176 296.158 249.971 294.569 251.825 293.509L302.406 264.381C309.29 260.409 317.5 258.555 325.973 258.555C357.75 258.555 377.877 283.185 377.877 309.399C377.877 311.253 377.877 313.371 377.611 315.49L325.178 284.771C322.001 282.919 318.822 282.919 315.645 284.771L249.176 323.434ZM367.283 421.415V361.301C367.283 357.592 365.694 354.945 362.516 353.092L296.048 314.43L317.763 301.982C319.617 300.925 321.206 300.925 323.058 301.982L373.639 331.112C388.205 339.586 398.003 357.592 398.003 375.069C398.003 395.195 386.087 413.733 367.283 421.412V421.415ZM233.553 368.452L211.838 355.742C209.986 354.684 209.19 353.095 209.19 350.975V292.718C209.19 264.383 230.905 242.932 260.301 242.932C271.423 242.932 281.748 246.641 290.49 253.26L238.321 283.449C235.146 285.303 233.555 287.951 233.555 291.659V368.455L233.553 368.452ZM280.292 395.462L249.176 377.985V340.913L280.292 323.436L311.407 340.913V377.985L280.292 395.462ZM300.286 475.968C289.163 475.968 278.837 472.259 270.097 465.64L322.264 435.449C325.441 433.597 327.03 430.949 327.03 427.239V350.445L349.011 363.155C350.865 364.213 351.66 365.802 351.66 367.922V426.179C351.66 454.514 329.679 475.965 300.286 475.965V475.968ZM237.525 416.915L186.944 387.785C172.378 379.31 162.582 361.305 162.582 343.827C162.582 323.436 174.763 305.164 193.563 297.485V357.861C193.563 361.571 195.154 364.217 198.33 366.071L264.535 404.467L242.82 416.915C240.967 417.972 239.377 417.972 237.525 416.915ZM234.614 460.343C204.689 460.343 182.71 437.833 182.71 410.028C182.71 407.91 182.976 405.792 183.238 403.672L235.405 433.863C238.582 435.715 241.763 435.715 244.938 433.863L311.407 395.466V420.622C311.407 422.742 310.612 424.331 308.758 425.389L258.179 454.519C251.293 458.491 243.083 460.343 234.611 460.343H234.614ZM300.286 491.854C332.329 491.854 359.073 469.082 365.167 438.892C394.825 431.211 413.892 403.406 413.892 375.073C413.892 356.535 405.948 338.529 391.648 325.552C392.972 319.991 393.766 314.43 393.766 308.87C393.766 271.003 363.048 242.666 327.562 242.666C320.413 242.666 313.528 243.723 306.644 246.109C294.725 234.457 278.307 227.042 260.301 227.042C228.258 227.042 201.513 249.815 195.42 280.004C165.761 287.685 146.694 315.49 146.694 343.824C146.694 362.362 154.638 380.368 168.938 393.344C167.613 398.906 166.819 404.467 166.819 410.027C166.819 447.894 197.538 476.231 233.024 476.231C240.172 476.231 247.058 475.173 253.943 472.788C265.859 484.441 282.278 491.854 300.286 491.854Z" fill="currentColor"></path></svg>`);function nr(e,t){E(t,!0);let n=A(t,`className`,3,``),i=A(t,`title`,3,`OpenAI`);var a=tr(),o=y(a),s=e=>{var t=er(),n=y(t,!0);k(t),V(()=>z(n,i())),v(e,t)};r(o,e=>{i()&&e(s)}),de(),k(a),V(e=>{P(a,0,e),O(a,`aria-hidden`,!i()||void 0)},[()=>se(U(`size-4`,n()))]),v(e,a),j()}var rr=m(`<svg viewBox="0 0 24 24" role="img" aria-label="Anthropic" fill="currentColor"><path d="M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223 2.291-5.945 2.292 5.945Z"></path></svg>`),ir=m(`<svg viewBox="0 0 24 24" role="img" aria-label="xAI" fill="currentColor"><path d="M6.469 8.776 16.512 23h-4.464L2.005 8.776H6.47Zm-.004 7.9 2.233 3.164L6.467 23H2l4.465-6.324ZM22 2.582V23h-3.659V7.764L22 2.582ZM22 1l-9.952 14.095-2.233-3.163L17.533 1H22Z"></path></svg>`),ar=m(`<svg viewBox="0 0 24 24" role="img" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="12" cy="12" r="9"></circle><path d="M12 8v4l2.5 1.5" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);function or(e,t){E(t,!0);let n=A(t,`className`,3,``);var i=a(),o=b(i),s=e=>{{let t=C(()=>U(`size-4 text-foreground`,n()));nr(e,{get className(){return p(t)}})}},c=e=>{var t=rr();V(e=>P(t,0,e),[()=>se(U(`size-4 text-[#D97757]`,n()))]),v(e,t)},l=e=>{var t=ir();V(e=>P(t,0,e),[()=>se(U(`text-foreground size-4`,n()))]),v(e,t)},u=e=>{var r=ar();V(e=>{P(r,0,e),O(r,`aria-label`,t.provider||`Unknown provider`)},[()=>se(U(`text-muted-foreground size-4`,n()))]),v(e,r)};r(o,e=>{t.provider===`openai`?e(s):t.provider===`anthropic`?e(c,1):t.provider===`xai`?e(l,2):e(u,-1)}),v(e,i),j()}var sr=[`none`,`low`,`medium`,`high`,`xhigh`,`max`],cr=[`standard`,`fast`],lr=[`gpt-5.6-sol`,`gpt-5.6-terra`,`gpt-5.6-luna`,`claude-opus-5`,`claude-fable-5`,`grok-4.5`],ur=[{id:`gpt-5.6-sol`,label:`GPT-5.6 Sol`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:sr,defaultReasoningEffort:`medium`,serviceTiers:cr,usageWeights:{input:.005,cacheRead:5e-4,cacheWrite:.00625,output:.03,fastMultiplier:2}},{id:`gpt-5.6-terra`,label:`GPT-5.6 Terra`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:sr,defaultReasoningEffort:`medium`,serviceTiers:cr,usageWeights:{input:.0025,cacheRead:25e-5,cacheWrite:.003125,output:.015,fastMultiplier:2}},{id:`gpt-5.6-luna`,label:`GPT-5.6 Luna`,provider:`openai`,contextWindowTokens:258400,autoCompactTokenLimit:244800,reasoningEfforts:sr,defaultReasoningEffort:`medium`,serviceTiers:cr,usageWeights:{input:.001,cacheRead:1e-4,cacheWrite:.00125,output:.006,fastMultiplier:2}},{id:`claude-opus-5`,label:`Claude Opus 5`,provider:`anthropic`,contextWindowTokens:1e6,autoCompactTokenLimit:967e3,reasoningEfforts:[`low`,`medium`,`high`,`xhigh`,`max`],defaultReasoningEffort:`high`,serviceTiers:cr,usageWeights:{input:.005,cacheRead:5e-4,cacheWrite:.00625,output:.025,fastMultiplier:2}},{id:`claude-fable-5`,label:`Claude Fable 5`,provider:`anthropic`,contextWindowTokens:1e6,autoCompactTokenLimit:967e3,reasoningEfforts:[`low`,`medium`,`high`,`xhigh`,`max`],defaultReasoningEffort:`high`,serviceTiers:cr,usageWeights:{input:.01,cacheRead:.001,cacheWrite:.0125,output:.05,fastMultiplier:1}},{id:`grok-4.5`,label:`Grok 4.5`,provider:`xai`,contextWindowTokens:5e5,autoCompactTokenLimit:4e5,reasoningEfforts:[`low`,`medium`,`high`],defaultReasoningEffort:`high`,serviceTiers:cr,usageWeights:{input:.002,cacheRead:5e-4,cacheWrite:.002,output:.006,fastMultiplier:2}}],dr=`gpt-5.6-sol`,fr=mr(dr).defaultReasoningEffort,pr=`standard`;function mr(e){let t=ur.find(t=>t.id===e);if(!t)throw Error(`Unsupported model: ${e}`);return t}function hr(e){return e}function gr(e,t){return e.models.find(e=>e.id===t)}function _r(e,t,n){return(e.tierAllowedModels[t]??[]).includes(n)}function vr(e,t,n){return _r(e,t,n)?n:e.tierAllowedModels[t]?.[0]??e.defaultModelId}function yr(e,t){let n=[],r=[];for(let i of e.models){let a={id:i.id,label:i.label,provider:i.provider};_r(e,t,i.id)?n.push(a):r.push({...a,locked:!0,lockTooltip:e.modelLockUpgradeMessage})}return[...n,...r]}var br={none:`None`,low:`Low`,medium:`Medium`,high:`High`,xhigh:`Extra High`,max:`Max`},xr={standard:`Standard`,fast:`Fast`};function Sr(e){return br[e]??e}function Cr(e){return xr[e]??e}var wr=i(`<span class="text-muted-foreground ml-auto text-xs">Default</span>`),Tr=i(`<button type="button" class="focus-visible:ring-ring/60 text-foreground flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm outline-none hover:bg-[var(--hover-fill)] focus-visible:ring-2"><!> <span> </span> <!></button>`),Er=i(`<button type="button" class="focus-visible:ring-ring/60 text-foreground flex w-full items-center gap-3 rounded-xl px-3 py-2 text-left text-sm outline-none hover:bg-[var(--hover-fill)] focus-visible:ring-2"><!> <!> <span> </span> <!></button>`),Dr=i(`<div class="bg-popover/96 absolute bottom-[calc(100%+0.75rem)] left-0 z-50 min-w-[15rem] rounded-[18px] border border-[var(--hairline)] p-2 shadow-[var(--composer-shadow)] backdrop-blur-xl" role="dialog" aria-label="Reasoning and service tier"><p class="text-muted-foreground px-3 pt-1 pb-1.5 text-[11px] font-medium">Reasoning</p> <div class="space-y-0.5"></div> <div class="mx-2 my-2 h-px bg-[var(--hairline)]"></div> <p class="text-muted-foreground px-3 pb-1.5 text-[11px] font-medium">Service tier</p> <div class="space-y-0.5"></div></div>`),Or=i(`<div><button type="button" class="focus-visible:ring-ring/60 text-muted-foreground inline-flex h-9 shrink-0 items-center gap-1 rounded-lg px-2 text-[15px] transition outline-none hover:bg-[var(--hover-fill)] focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50" aria-haspopup="dialog" aria-label="Select reasoning effort and service tier"><span> </span> <!></button> <!></div>`);function kr(e,t){E(t,!0);let i=A(t,`reasoningEffort`,31,()=>u(fr)),a=A(t,`serviceTier`,31,()=>u(pr)),o=A(t,`disabled`,3,!1),c=A(t,`className`,3,``),d=x(!1),f=x(null),m=x(null);function h(e){i(e)}function g(e){t.model.serviceTiers.includes(e)&&a(e)}n(()=>{t.model.reasoningEfforts.includes(i())||i(t.model.defaultReasoningEffort),t.model.serviceTiers.includes(a())||a(t.model.serviceTiers[0]??`standard`)}),n(()=>{if(!p(d))return;function e(e){e.target instanceof Node&&!p(f)?.contains(e.target)&&l(d,!1)}function t(e){e.key===`Escape`&&(l(d,!1),p(m)?.focus())}return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}}),n(()=>{o()&&l(d,!1)});var _=Or(),b=y(_),S=y(b),w=y(S);k(S);var T=s(S,2);{let e=C(()=>U(`text-muted-foreground size-3 shrink-0 transition-transform`,p(d)&&`rotate-180`));St(T,{get class(){return p(e)}})}k(b),ue(b,e=>l(m,e),()=>p(m));var D=s(b,2),ee=e=>{var n=Dr(),o=s(y(n),2);fe(o,20,()=>t.model.reasoningEfforts,e=>e,(e,n)=>{var a=Tr(),o=y(a);{let e=C(()=>U(`size-4 shrink-0 transition-opacity`,n===i()?`opacity-100`:`opacity-0`));bt(o,{get class(){return p(e)}})}var c=s(o,2),l=y(c,!0);k(c);var u=s(c,2),d=e=>{v(e,wr())};r(u,e=>{n===t.model.defaultReasoningEffort&&e(d)}),k(a),V(e=>{O(a,`aria-pressed`,n===i()),z(l,e)},[()=>Sr(n)]),M(`click`,a,()=>h(n)),v(e,a)}),k(o);var c=s(o,6);fe(c,20,()=>t.model.serviceTiers,e=>e,(e,n)=>{var i=Er(),o=y(i);{let e=C(()=>U(`size-4 shrink-0 transition-opacity`,n===a()?`opacity-100`:`opacity-0`));bt(o,{get class(){return p(e)}})}var c=s(o,2),l=e=>{Tn(e,{class:`size-3.5 text-amber-400`})};r(c,e=>{n===`fast`&&e(l)});var u=s(c,2),d=y(u,!0);k(u);var f=s(u,2),m=e=>{v(e,wr())};r(f,e=>{n===t.model.serviceTiers[0]&&e(m)}),k(i),V(e=>{O(i,`aria-pressed`,n===a()),z(d,e)},[()=>Cr(n)]),M(`click`,i,()=>g(n)),v(e,i)}),k(c),k(n),v(e,n)};r(D,e=>{p(d)&&e(ee)}),k(_),ue(_,e=>l(f,e),()=>p(f)),V((e,t,n)=>{P(_,1,e),O(b,`aria-expanded`,p(d)),b.disabled=o(),z(w,`${t??``} · ${n??``}`)},[()=>se(U(`relative`,c())),()=>Sr(i()),()=>Cr(a())]),M(`click`,b,()=>{l(d,!p(d))}),v(e,_),j()}t([`click`]);function Ar(e){return e.key===`Enter`&&!e.shiftKey&&!e.isComposing}var jr=/(^|\s)\$([a-z0-9-]*)$/i;function Mr(e,t){if(t<0||t>e.length)return null;let n=e.slice(0,t).match(jr);return!n||n.index===void 0?null:{query:n[2].toLowerCase(),tokenStart:n.index+n[1].length}}function Nr(e,t){return Mr(e,t)?.query??null}function Pr(e,t){let n=t.toLowerCase(),r=[],i=[];for(let t of e){let e=t.name.toLowerCase();e.startsWith(n)?r.push(t):n.length>0&&e.includes(n)&&i.push(t)}return r.sort((e,t)=>e.name.localeCompare(t.name)),i.sort((e,t)=>e.name.localeCompare(t.name)),[...r,...i]}function Fr(e,t,n){let r=Mr(e,t);if(!r)return null;let i=t;for(;i<e.length&&/[a-z0-9-]/i.test(e[i]??``);)i+=1;e[i]===` `&&(i+=1);let a=`$${n} `;return{text:`${e.slice(0,r.tokenStart)}${a}${e.slice(i)}`,caret:r.tokenStart+a.length}}var Ir=[`free`,`pro`,`admin`],Lr={free:`Free`,pro:`Pro`,admin:`Admin`},Rr={modelUsage:{weekly:5e3,monthly:15e3},webTools:{weekly:500,monthly:1500}};Rr.modelUsage.weekly*5,Rr.modelUsage.monthly*5,Rr.webTools.weekly*5,Rr.webTools.monthly*5;function zr(e){return e.map(e=>Y.literal(e))}Y.union(...zr(sr)),Y.union(...zr(cr)),Y.union(...zr(lr)),Y.union(...zr(Ir)),Y.union(Y.literal(`active`),Y.literal(`on_hold`),Y.literal(`cancelled`),Y.literal(`expired`),Y.literal(`failed`));var Br=Y.object({path:Y.string(),directory:Y.string(),contents:Y.string(),truncated:Y.boolean()}),Vr=Y.object({patch:Y.string()}),Hr=Y.object({cmd:Y.string(),workdir:Y.optional(Y.string()),shell:Y.optional(Y.string()),timeoutMs:Y.optional(Y.number()),yieldTimeMs:Y.optional(Y.number()),maxOutputChars:Y.optional(Y.number())}),Ur=Y.object({url:Y.string()}),Wr=Y.object({query:Y.string(),numResults:Y.optional(Y.number())}),Gr=Y.object({sessionId:Y.string(),chars:Y.optional(Y.string()),terminate:Y.optional(Y.boolean()),yieldTimeMs:Y.optional(Y.number())}),Kr=Y.object({name:Y.string()});Y.union(Y.object({}),Vr,Hr,Kr,Ur,Wr,Gr);var qr=Y.object({changes:Y.array(Y.object({path:Y.string(),operation:Y.union(Y.literal(`created`),Y.literal(`updated`),Y.literal(`deleted`),Y.literal(`renamed`),Y.literal(`copied`))}))}),Jr=Y.object({command:Y.string(),cwd:Y.string(),sessionId:Y.optional(Y.string()),exitCode:Y.optional(Y.number()),success:Y.boolean(),running:Y.boolean(),timedOut:Y.boolean(),stdout:Y.string(),stderr:Y.string(),output:Y.string(),truncated:Y.boolean(),error:Y.optional(Y.string())}),Yr=Y.object({url:Y.string(),markdown:Y.string(),truncated:Y.boolean()}),Xr=Y.object({results:Y.array(Y.object({title:Y.optional(Y.string()),url:Y.string(),publishedDate:Y.optional(Y.string()),author:Y.optional(Y.string()),text:Y.optional(Y.string())}))}),Zr=Y.object({name:Y.string(),description:Y.string(),content:Y.string(),dir:Y.optional(Y.string()),truncated:Y.optional(Y.boolean())});Y.union(Y.string(),Y.array(Br),qr,Jr,Zr,Yr,Xr),Y.union(Y.literal(`disconnected`),Y.literal(`connected`)),Y.union(Y.literal(`queued`),Y.literal(`running`),Y.literal(`awaiting_executor`),Y.literal(`completed`),Y.literal(`failed`),Y.literal(`cancelled`));var Qr=[`cancelled`,`completed`,`failed`];Y.union(...zr(Qr));function $r(e){return Qr.includes(e)}Y.union(Y.literal(`apply_patch`),Y.literal(`exec_command`),Y.literal(`get_workspace_instructions`),Y.literal(`read_skill`),Y.literal(`scrape_url`),Y.literal(`web_search`),Y.literal(`write_stdin`)),Y.union(Y.literal(`pending`),Y.literal(`claimed`),Y.literal(`completed`),Y.literal(`failed`),Y.literal(`cancelled`)),Y.union(Y.literal(`prompt`),Y.literal(`response`));var ei=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`];Y.union(...zr(ei));var ti=`10 MiB`,ni=Y.object({type:Y.literal(`text`),id:Y.string(),text:Y.string(),turnId:Y.optional(Y.string()),providerMetadata:Y.optional(Y.any())}),ri=Y.object({type:Y.literal(`reasoning`),id:Y.string(),text:Y.string(),turnId:Y.optional(Y.string()),providerMetadata:Y.optional(Y.any())}),ii=Y.object({type:Y.literal(`tool-call`),partId:Y.optional(Y.string()),callId:Y.string(),name:Y.string(),input:Y.any(),turnId:Y.optional(Y.string()),providerMetadata:Y.optional(Y.any())}),ai=Y.union(...zr([`cancelled`,`failed`]));Y.object({error:Y.string(),status:ai});var oi=Y.object({type:Y.literal(`tool-result`),callId:Y.string(),name:Y.optional(Y.string()),output:Y.any()});Y.union(ni,ri,ii,oi);var si=Y.union(Y.literal(`system`),Y.literal(`user`),Y.literal(`assistant`)),ci=Y.union(Y.object({type:Y.literal(`text`),text:Y.string()}),Y.object({type:Y.literal(`image`),imageJson:Y.string()})),li=Y.union(Y.object({type:Y.literal(`text`),text:Y.string(),additionalParamsJson:Y.optional(Y.string())}),Y.object({type:Y.literal(`reasoning`),id:Y.optional(Y.string()),blocksJson:Y.string()}),Y.object({type:Y.literal(`toolCall`),id:Y.string(),callId:Y.optional(Y.string()),name:Y.string(),argumentsJson:Y.string(),signature:Y.optional(Y.string()),additionalParamsJson:Y.optional(Y.string())}),Y.object({type:Y.literal(`toolResult`),id:Y.string(),callId:Y.optional(Y.string()),items:Y.array(ci)}),Y.object({type:Y.literal(`image`),imageJson:Y.string()}),Y.object({type:Y.literal(`audio`),audioJson:Y.string()}),Y.object({type:Y.literal(`video`),videoJson:Y.string()}),Y.object({type:Y.literal(`document`),documentJson:Y.string()}));Y.object({role:si,assistantId:Y.optional(Y.string()),contents:Y.array(li)});function ui(e,t){let n=e??[],r=t??[];return n.length===r.length&&n.every((e,t)=>e===r[t])}var di=ei;function fi(e){return di.includes(e)}function pi(e,t){return e>=4?`You can attach up to 4 images.`:fi(t.type)?t.size>10485760?`${t.name||`This image`} is larger than ${ti}.`:null:`${t.name||`This file`} is not a supported image. Use JPEG, PNG, GIF, or WebP.`}var mi=i(`<div class="text-muted-foreground mb-3 flex items-center gap-2 px-4 text-[11px]"><span class="inline-flex items-center gap-0.75"><span class="bg-foreground/28 size-1 animate-pulse rounded-full"></span> <span class="bg-foreground/28 size-1 animate-pulse rounded-full [animation-delay:200ms]"></span> <span class="bg-foreground/28 size-1 animate-pulse rounded-full [animation-delay:400ms]"></span></span> <span> </span></div>`),hi=i(`<div class="text-muted-foreground mb-3 flex items-center gap-2 px-4 text-[11px]" role="status" aria-live="polite"><span class="bg-foreground/28 size-1.5 animate-pulse rounded-full"></span> <span> </span></div>`),gi=i(`<span class="absolute inset-0 flex items-center justify-center" role="status"><span class="border-border border-t-foreground/80 size-3.5 animate-spin rounded-full border-2"></span></span>`),_i=i(`<span class="text-destructive absolute inset-x-0 bottom-0 bg-rose-950/80 px-1 py-0.5 text-center text-[9px] leading-3" role="alert">Failed</span>`),vi=i(`<li><img/> <!> <button type="button" class="bg-foreground/70 text-background hover:bg-foreground/90 absolute top-1 right-1 flex size-4.5 cursor-pointer items-center justify-center rounded-full transition disabled:cursor-not-allowed disabled:opacity-40"><!></button></li>`),yi=i(`<ul class="mb-3 flex flex-wrap items-center gap-2" aria-label="Attached images"></ul>`),bi=i(`<p class="text-muted-foreground px-3 py-2 text-sm">Loading skills…</p>`),xi=i(`<div class="flex items-center justify-between gap-3 px-3 py-2"><p class="text-muted-foreground text-sm">Couldn’t load skills</p> <button type="button" class="text-muted-foreground hover:text-foreground text-sm underline-offset-2 hover:underline">Retry</button></div>`),Si=i(`<p class="text-muted-foreground px-3 py-2 text-sm">No matching skills</p>`),Ci=i(`<button type="button" role="option"><span class="text-sm font-medium"> </span> <span class="text-muted-foreground line-clamp-2 text-[12px]"> </span></button>`),wi=i(`<div class="border-border bg-popover absolute inset-x-0 bottom-full z-30 mb-2 max-h-56 overflow-y-auto rounded-xl border py-1 shadow-2xl" id="composer-skills-listbox" aria-label="Available skills"><!></div>`),Ti=i(`<button type="button" class="flex h-10 w-10 cursor-pointer items-center justify-center rounded-full bg-rose-500/90 text-white transition-all duration-150 hover:scale-105 hover:bg-rose-500 disabled:pointer-events-none disabled:opacity-60 disabled:hover:scale-100" aria-label="Stop generation" title="Stop"><!></button>`),Ei=i(`<button type="button" class="bg-primary/90 text-primary-foreground hover:bg-primary flex h-10 w-10 items-center justify-center rounded-full transition-all duration-150 hover:scale-105 enabled:cursor-pointer disabled:pointer-events-none disabled:opacity-30 disabled:hover:scale-100" aria-label="Send message"><!></button>`),Di=i(`<div class="bg-tooltip text-tooltip-foreground ring-border pointer-events-none fixed z-100 -translate-x-1/2 -translate-y-full rounded-md px-2.5 py-1.5 text-[12px] leading-4 whitespace-nowrap shadow-lg ring-1" role="tooltip"> </div>`),Oi=i(`<footer class="shrink-0 px-6 py-4"><div class="mx-auto max-w-336"><!> <div><div><div class="relative flex min-h-33 flex-col px-4 pt-4 pb-2.5"><!> <div class="relative min-h-0 flex-1"><!> <textarea rows="1" class="text-foreground placeholder:text-muted-foreground field-sizing-content max-h-40 min-h-17 w-full resize-none overflow-y-auto border-0 bg-transparent px-0 py-0 text-[14px] leading-6 outline-none" placeholder="Ask anything, @tag files/directories, or use $ to show available skills" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" autocomplete="off"></textarea></div> <div class="flex min-w-0 flex-nowrap items-center justify-between gap-3 overflow-visible px-0 pt-2.5 pb-0"><div class="-m-1 flex min-w-0 flex-1 items-center gap-1 overflow-visible p-1"><input type="file" class="hidden" multiple=""/> <button type="button" class="text-muted-foreground enabled:hover:text-foreground flex h-9 w-9 shrink-0 items-center justify-center rounded-lg transition enabled:cursor-pointer disabled:opacity-40"><!></button> <div class="mx-1 hidden h-4 w-px shrink-0 bg-[var(--hover-fill-strong)] sm:block"></div> <!> <div class="mx-1 hidden h-4 w-px shrink-0 bg-[var(--hover-fill-strong)] sm:block"></div> <!></div> <div class="flex shrink-0 flex-nowrap items-center justify-end gap-2.5"><div class="group/context relative"><button type="button" class="focus-visible:ring-ring/60 relative flex size-8 cursor-help items-center justify-center rounded-full focus-visible:ring-2 focus-visible:outline-none" aria-describedby="context-window-details"><span class="bg-muted size-5.5 rounded-full"></span></button> <div id="context-window-details" class="border-border bg-popover invisible absolute right-0 bottom-full z-50 mb-3 w-76 translate-y-1 rounded-xl border p-4 opacity-0 shadow-[var(--composer-shadow)] transition duration-150 group-focus-within/context:visible group-focus-within/context:translate-y-0 group-focus-within/context:opacity-100 group-hover/context:visible group-hover/context:translate-y-0 group-hover/context:opacity-100" role="tooltip"><div class="flex items-center justify-between gap-4 text-[13px]"><span class="text-foreground font-medium">Context window</span> <span class="text-muted-foreground"> </span></div> <div class="mt-3 h-1.5 overflow-hidden rounded-full bg-[var(--hover-fill)]"><div class="bg-accent h-full rounded-full transition-[width] duration-300"></div></div> <div class="text-muted-foreground mt-3 flex items-center justify-between text-[12px]"><span>Total processed</span> <span> </span></div> <p class="text-muted-foreground mt-4 text-[12px] leading-5"> </p></div></div> <!></div></div></div></div></div></div></footer> <!>`,1);function ki(e,t){E(t,!0);let i=A(t,`prompt`,15,``),o=A(t,`selectedModel`,31,()=>u(dr)),c=A(t,`selectedReasoningEffort`,31,()=>u(fr)),d=A(t,`selectedServiceTier`,31,()=>u(pr)),m=A(t,`workspaceSkills`,3,null),g=De(),_=we(H.billing.getMySubscription,()=>g.isAuthenticated&&!g.isLoading?{}:`skip`),S=C(()=>_.data?.tier),w=C(()=>!!_.error),T=C(()=>t.modelCatalog?yr(t.modelCatalog,p(S)??`free`):[]),D=C(()=>t.modelCatalog?gr(t.modelCatalog,o()):void 0),te=C(()=>p(D)!==void 0&&(p(w)||p(S)!==void 0&&t.modelCatalog!==void 0&&_r(t.modelCatalog,p(S),o()))),ie=x(null),ae=x(null),oe=x(null),ce=x(u([])),N=x(`idle`),le=x(!1),F=x(0),I=x(0),L=0,de,R=u([]),B=C(()=>!!i().trim()||t.attachments.length>0),pe=C(()=>t.attachments.some(e=>e.status!==`ready`)),me=C(()=>t.attachments.length<4&&!t.isRunning&&!t.isSubmitting),he=`Attach images (up to 4)`,ge=typeof CSS<`u`&&CSS.supports(`field-sizing`,`content`),_e=C(()=>t.contextUsage.contextWindowTokens>0?Math.min(100,Math.round(t.contextUsage.inputTokens/t.contextUsage.contextWindowTokens*100)):0),ve=C(()=>t.contextUsage.contextWindowTokens>0?Math.round(t.contextUsage.autoCompactTokenLimit/t.contextUsage.contextWindowTokens*100):0),ye=C(()=>Nr(i(),p(I))),be=C(()=>p(ye)!==null&&!p(le)),xe=C(()=>p(ye)===null?[]:Pr(p(ce),p(ye))),Se=C(()=>p(be)&&p(xe).length>0?`composer-skill-option-${p(F)}`:void 0);function Ce(){l(I,p(ie)?.selectionStart??i().length,!0)}function Te(){l(ce,[],!0),l(N,`idle`),l(le,!1),l(F,0),L+=1}async function Ee(e=!1){if(p(N)===`loading`||(p(N)===`ready`||p(N)===`error`)&&!e)return;if(!m()?.load){l(ce,[],!0),l(N,`ready`);return}let t=++L;l(N,`loading`);try{let e=await m().load();if(t!==L)return;l(ce,e,!0),l(N,`ready`)}catch{if(t!==L)return;l(ce,[],!0),l(N,`error`)}}function U(e){let t=Fr(i(),p(I),e.name);t&&(i(t.text),l(I,t.caret,!0),l(le,!0),queueMicrotask(()=>{p(ie)&&(p(ie).focus(),p(ie).setSelectionRange(t.caret,t.caret),je())}))}function W(e){let n=e.currentTarget,r=Array.from(n.files??[]);n.value=``,r.length>0&&t.onAttachFiles(r)}function Oe(e){let n=Array.from(e.clipboardData?.files??[]).filter(e=>e.type.startsWith(`image/`));n.length===0||t.isRunning||t.isSubmitting||(e.preventDefault(),t.onAttachFiles(n))}function ke(e){let t=e.currentTarget;if(!(t instanceof HTMLButtonElement)||t.disabled)return;let n=t.getBoundingClientRect();l(oe,{top:n.top-8,left:n.left+n.width/2},!0)}function Ae(){l(oe,null)}function je(){if(!p(ie)||ge)return;let e=p(ie);e.style.height=`68px`;let t=Math.min(Math.max(e.scrollHeight,68),160);e.style.height=`${t}px`,e.style.overflowY=e.scrollHeight>t?`auto`:`hidden`}function Me(e){if(p(be)){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),p(xe).length===0)return;let t=e.key===`ArrowDown`?1:-1;l(F,(p(F)+t+p(xe).length)%p(xe).length);return}if(e.key===`Escape`){e.preventDefault(),l(le,!0);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){e.preventDefault();let t=p(xe)[p(F)];t&&U(t);return}}!t.canSend||!p(te)||t.isSubmitting||t.isRunning||!p(B)||p(pe)||Ar(e)&&(e.preventDefault(),t.onSubmit())}function Ne(e){if(!t.modelCatalog)return;let n=gr(t.modelCatalog,e);n&&c(n.defaultReasoningEffort)}function Pe(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1).replace(/\.0$/,``)}m`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}n(()=>{t.modelCatalog&&(!o()||!gr(t.modelCatalog,o()))&&(o(t.modelCatalog.defaultModelId),c(t.modelCatalog.defaultReasoningEffort),d(t.modelCatalog.defaultServiceTier))}),n(()=>{if(!t.modelCatalog||!p(S))return;let e=vr(t.modelCatalog,p(S),o());e!==o()&&(o(e),c(gr(t.modelCatalog,e)?.defaultReasoningEffort??t.modelCatalog.defaultReasoningEffort))}),n(()=>{i(),je()}),n(()=>{let e=m()?.workspacePath??null;if(de!==e&&(de=e,Te()),p(ye)===null){l(le,!1);return}p(le)||Ee()}),n(()=>{p(xe),l(F,0)}),n(()=>{!p(be)||p(xe).length===0||R[p(F)]?.scrollIntoView({block:`nearest`})});var Fe=Oi(),G=b(Fe),Ie=y(G),Le=y(Ie),K=e=>{var n=mi(),r=s(y(n),2),i=y(r);k(r),k(n),V(()=>z(i,`Working for ${t.elapsedLabel??``}`)),v(e,n)},q=e=>{var n=hi(),r=s(y(n),2),i=y(r,!0);k(r),k(n),V(()=>z(i,t.isStarting?`Starting agent…`:`Sending request…`)),v(e,n)};r(Le,e=>{t.elapsedLabel?e(K):t.isSubmitting&&e(q,1)});var Re=s(Le,2);P(Re,1,se(`composer-shell mx-auto w-full max-w-[48rem] rounded-[28px] p-px transition-colors duration-200`));var ze=y(Re);P(ze,1,se(`composer-inner rounded-[27px] border border-[var(--hairline)] transition-colors duration-200`));var Be=y(ze),Ve=y(Be),He=e=>{var n=yi();fe(n,21,()=>t.attachments,e=>e.localId,(e,n)=>{var i=vi(),a=y(i),o=s(a,2),c=e=>{var t=gi();V(()=>O(t,`aria-label`,`Uploading ${p(n).name??``}`)),v(e,t)},l=e=>{v(e,_i())};r(o,e=>{p(n).status===`uploading`?e(c):p(n).status===`error`&&e(l,1)});var u=s(o,2);Cn(y(u),{class:`size-3`,"aria-hidden":`true`}),k(u),k(i),V(()=>{P(i,1,`group relative size-14 overflow-hidden rounded-xl border ${p(n).status===`error`?`border-rose-500/60`:`border-border`}`),O(i,`title`,p(n).error??p(n).name),O(a,`src`,p(n).previewUrl),O(a,`alt`,p(n).name),P(a,1,`size-full object-cover ${p(n).status===`uploading`?`opacity-50`:``}`),O(u,`aria-label`,`Remove ${p(n).name??``}`),u.disabled=t.isRunning||t.isSubmitting}),M(`click`,u,()=>t.onRemoveAttachment(p(n).localId)),v(e,i)}),k(n),v(e,n)};r(Ve,e=>{t.attachments.length>0&&e(He)});var Ue=s(Ve,2),We=y(Ue),Ge=e=>{var t=wi(),n=y(t),i=e=>{v(e,bi())},o=e=>{var t=xi(),n=s(y(t),2);k(t),M(`click`,n,()=>{Ee(!0)}),v(e,t)},c=e=>{v(e,Si())},u=e=>{var t=a();fe(b(t),19,()=>p(xe),e=>e.name,(e,t,n)=>{var r=Ci(),i=y(r),a=y(i);k(i);var o=s(i,2),c=y(o,!0);k(o),k(r),ue(r,(e,t)=>R[t]=e,e=>R?.[e],()=>[p(n)]),V(()=>{O(r,`id`,`composer-skill-option-${p(n)??``}`),P(r,1,`flex w-full flex-col gap-0.5 px-3 py-2 text-left transition ${p(F)===p(n)?`text-foreground bg-[var(--hover-fill-strong)]`:`text-muted-foreground hover:text-foreground hover:bg-[var(--hover-fill)]`}`),O(r,`aria-selected`,p(F)===p(n)),z(a,`$${p(t).name??``}`),z(c,p(t).description)}),f(`pointerenter`,r,()=>{l(F,p(n),!0)}),M(`click`,r,()=>{U(p(t))}),v(e,r)}),v(e,t)};r(n,e=>{p(N)===`loading`?e(i):p(N)===`error`?e(o,1):p(xe).length===0?e(c,2):e(u,-1)}),k(t),V(()=>O(t,`role`,p(N)===`ready`&&p(xe).length>0?`listbox`:`status`)),v(e,t)};r(We,e=>{p(be)&&e(Ge)});var J=s(We,2);h(J),ue(J,e=>l(ie,e),()=>p(ie)),k(Ue);var Ke=s(Ue,2),qe=y(Ke),Je=y(qe);ue(Je,e=>l(ae,e),()=>p(ae));var Y=s(Je,2);Wt(y(Y),{class:`size-4`,"aria-hidden":`true`}),k(Y);var Ye=s(Y,4);{let e=(e,t=re)=>{or(e,{get provider(){return t().provider},className:`size-4 shrink-0`})},n=C(()=>t.isRunning||t.modelCatalog===void 0);$n(Ye,{get options(){return p(T)},ariaLabel:`Select model`,menuTitle:`Model`,get disabled(){return p(n)},searchable:!0,onValueChange:Ne,className:`z-20 shrink-0`,triggerClassName:`h-9 border-0 bg-transparent px-2 text-[15px] text-foreground shadow-none hover:bg-transparent focus-visible:ring-0`,get value(){return o()},set value(e){o(e)},optionIcon:e,$$slots:{optionIcon:!0}})}var Xe=s(Ye,4),Ze=e=>{kr(e,{get model(){return p(D)},get disabled(){return t.isRunning},className:`z-20 shrink-0`,get reasoningEffort(){return c()},set reasoningEffort(e){c(e)},get serviceTier(){return d()},set serviceTier(e){d(e)}})};r(Xe,e=>{p(D)&&e(Ze)}),k(qe);var Qe=s(qe,2),$e=y(Qe),et=y($e),tt=s(et,2),nt=y(tt),rt=s(y(nt),2),it=y(rt);k(rt),k(nt);var at=s(nt,2),ot=y(at);k(at);var X=s(at,2),st=s(y(X),2),ct=y(st,!0);k(st),k(X);var lt=s(X,2),ut=y(lt);k(lt),k(tt),k($e);var dt=s($e,2),pt=e=>{var n=Ti();pn(y(n),{class:`size-3.5 fill-current`}),k(n),M(`click`,n,function(...e){t.onCancel?.apply(this,e)}),v(e,n)},mt=e=>{var n=Ei();ft(y(n),{class:`size-4`}),k(n),V(()=>n.disabled=!t.canSend||!p(te)||t.isSubmitting||!p(B)||p(pe)),M(`click`,n,function(...e){t.onSubmit?.apply(this,e)}),v(e,n)};r(dt,e=>{t.isRunning?e(pt):e(mt,-1)}),k(Qe),k(Ke),k(Be),k(ze),k(Re),k(Ie),k(G);var ht=s(G,2),gt=e=>{var t=Di(),n=y(t,!0);k(t),V(()=>{ne(t,`top: ${p(oe).top}px; left: ${p(oe).left}px;`),z(n,he)}),v(e,t)};r(ht,e=>{p(oe)&&e(gt)}),V((e,n,r,i)=>{J.disabled=t.isRunning||t.isSubmitting,O(J,`aria-expanded`,p(be)),O(J,`aria-controls`,p(be)?`composer-skills-listbox`:void 0),O(J,`aria-activedescendant`,p(Se)),O(Je,`accept`,e),O(Y,`aria-label`,he),Y.disabled=!p(me),O(et,`aria-label`,`Context window ${p(_e)}% full`),ne(et,`background: conic-gradient(var(--accent) ${p(_e)*3.6}deg, var(--hover-fill-strong) 0deg);`),z(it,`${p(_e)??``}% · ${n??``}/${r??``}`),ne(ot,`width: ${p(_e)}%`),z(ct,i),z(ut,`Sprocket automatically compacts context at about ${p(ve)??``}% so
2
- long-running work can continue.`)},[()=>di.join(`,`),()=>Pe(t.contextUsage.inputTokens),()=>Pe(t.contextUsage.contextWindowTokens),()=>Pe(t.contextUsage.totalTokensProcessed)]),M(`keydown`,J,Me),f(`paste`,J,Oe),f(`focus`,J,Ce),M(`input`,J,()=>{Ce(),je()}),M(`keyup`,J,Ce),M(`click`,J,Ce),f(`select`,J,Ce),ee(J,i),M(`change`,Je,W),f(`mouseenter`,Y,ke),f(`mouseleave`,Y,Ae),f(`focus`,Y,ke),f(`blur`,Y,Ae),M(`click`,Y,()=>{Ae(),p(ae)?.click()}),M(`keydown`,et,e=>{e.key===`Escape`&&e.currentTarget.blur()}),v(e,Fe),j()}t([`click`,`keydown`,`input`,`keyup`,`change`]);var Ai=i(`<p class="text-foreground text-[15px]"> </p>`),ji=i(`<button type="button" class="text-muted-foreground hover:text-foreground block text-left text-sm transition"><span> </span></button>`),Mi=i(`<div class="mt-3 space-y-1"><!> <!></div>`),Ni=i(`<p class="text-muted-foreground mt-3 text-sm">You’re signed in to Sprocket.</p>`),Pi=i(`<p class="text-foreground mt-3 text-[15px]"> </p>`),Fi=i(`<p class="text-muted-foreground mt-3 text-sm">Couldn’t load your subscription right now.</p>`),Ii=i(`<div class="mt-3.5 h-4 w-16 animate-pulse rounded bg-[var(--hover-fill)]" aria-hidden="true"></div>`),Li=i(`<!> Sign Out`,1),Ri=i(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Account</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-10"><div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Profile</p> <!></div> <div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Spikonado Subscription Tier</p> <!></div> <div><p class="text-muted-foreground font-mono text-[11px] tracking-[0.18em] uppercase">Session</p> <p class="text-muted-foreground mt-2 text-sm leading-6">Sign out of this device. You’ll need to authenticate again to open your workspace.</p> <div class="mt-4"><!></div></div></div></div></section>`);function zi(e,t){E(t,!0);let n=x(!1),i=De(),a=we(H.billing.getMySubscription,()=>i.isAuthenticated&&!i.isLoading?{}:`skip`),o=C(()=>[t.user?.firstName,t.user?.lastName].filter(Boolean).join(` `).trim()||null);var c=Ri(),u=s(y(c),2),d=y(u),f=y(d),m=s(y(f),2),h=e=>{var i=Mi(),a=y(i),c=e=>{var t=Ai(),n=y(t,!0);k(t),V(()=>z(n,p(o))),v(e,t)};r(a,e=>{p(o)&&e(c)});var u=s(a,2),d=e=>{var r=ji(),i=y(r),a=y(i,!0);k(i),k(r),V(()=>{O(r,`aria-pressed`,p(n)),O(r,`aria-label`,p(n)?`Hide email address`:`Show email address`),P(i,1,se(p(n)?void 0:`blur-[5px] select-none`)),z(a,t.user.email)}),M(`click`,r,()=>{l(n,!p(n))}),v(e,r)};r(u,e=>{t.user?.email&&e(d)}),k(i),v(e,i)},g=e=>{v(e,Ni())};r(m,e=>{p(o)||t.user?.email?e(h):e(g,-1)}),k(f);var _=s(f,2),S=s(y(_),2),w=e=>{var t=Pi(),n=y(t,!0);k(t),V(()=>z(n,Lr[a.data.tier])),v(e,t)},T=e=>{v(e,Fi())},D=e=>{v(e,Ii())};r(S,e=>{a.data?e(w):a.error?e(T,1):e(D,-1)}),k(_);var ee=s(_,2),te=s(y(ee),4);Dn(y(te),{variant:`outline`,get onclick(){return t.onSignOut},children:(e,t)=>{var n=Li();Xt(b(n),{class:`mr-2 size-4`,"aria-hidden":`true`}),de(),v(e,n)},$$slots:{default:!0}}),k(te),k(ee),k(d),k(u),k(c),v(e,c),j()}t([`click`]);function Bi(e,t){return e.find(e=>e.workspaceName===t)??null}function Vi(e){return e.threadStatus!==`archived`}function Hi(e,t){let n=new Map,r=t.filter(Vi);for(let e of r){let t=n.get(e.workspaceName);if(t){t.threads.push(e),t.latestThreadAt=Math.max(t.latestThreadAt,e.lastMessageAt);continue}n.set(e.workspaceName,{key:e.workspaceName,workspaceName:e.workspaceName,workspaceSessionId:e.workspaceSessionId,executorStatus:null,lastSeenAt:0,latestThreadAt:e.lastMessageAt,activeThreadCount:0,threads:[e]})}for(let t of e){let e=n.get(t.workspaceName);if(e){e.workspaceSessionId=t._id,e.executorStatus=t.executorStatus,e.lastSeenAt=t.lastSeenAt,e.localWorkspaceAvailability=t.localWorkspaceAvailability,e.localWorkspaceError=t.localWorkspaceError,e.workspacePath=t.workspacePath;continue}n.set(t.workspaceName,{key:t.workspaceName,workspaceName:t.workspaceName,workspaceSessionId:t._id,executorStatus:t.executorStatus,lastSeenAt:t.lastSeenAt,latestThreadAt:0,activeThreadCount:0,localWorkspaceAvailability:t.localWorkspaceAvailability,localWorkspaceError:t.localWorkspaceError,workspacePath:t.workspacePath,threads:[]})}return[...n.values()].map(e=>({...e,activeThreadCount:Wi(e.threads),threads:Ui(e.threads)})).sort((e,t)=>{let n=e.latestThreadAt||e.lastSeenAt,r=t.latestThreadAt||t.lastSeenAt;return r===n?e.workspaceName.localeCompare(t.workspaceName):r-n})}function Ui(e){return[...e].sort((e,t)=>e.hasActiveRun===t.hasActiveRun?t.lastMessageAt-e.lastMessageAt:Number(t.hasActiveRun)-Number(e.hasActiveRun))}function Wi(e){return e.filter(e=>e.hasActiveRun).length}function Gi(e,t){return t?e.find(e=>e.threadId===t)??null:null}function Ki(e,t){return t&&(e?.threadId??e?._id)===t?e:null}function qi(e){let{pendingCreatedThreadId:t,threads:n}=e;return!t||n.some(e=>e.threadId===t)?null:t}function Ji(e){return!e.threadId||e.threadId===e.pendingCreatedThreadId||e.hasLatestRunData}function Yi(e,t){return!!(t&&e[t])}function Xi(e,t,n){return{...e,[t]:n}}function Zi(e,t,n){let r=e[t];if(!r||n!==void 0&&r.launchId!==n)return e;let i={...e};return delete i[t],i}function Qi(e,t,n){return!!(t&&(t!==e.previousRunId||n!==e.previousClaimExpiresAt))}function $i(e,t,n,r){let i=e[t];return!i||!Qi(i,n,r)?e:Zi(e,t,i.launchId)}function ea(e,t){let n=e;for(let e of t)n=$i(n,e.threadId,e.latestRunId,e.latestRunClaimExpiresAt);return n}function ta(e,t,n,r,i,a){let o=e[t];return!o||o.launchId!==n||o.expiresAt>r?{pendingLaunches:e,shouldRecover:!1}:{pendingLaunches:Zi(e,t,n),shouldRecover:!Qi(o,i,a)}}function na(e){let{threads:t,currentThreadId:n,currentWorkspaceName:r,draftWorkspaceName:i,pendingCreatedThreadId:a=null}=e;return r&&i===r?null:n&&(t.some(e=>e.threadId===n)||a&&n===a)?n:t[0]?.threadId??null}var ra=i(`<p class="text-muted-foreground max-w-xl text-sm leading-6">No archived threads.</p>`),ia=i(`<li class="group flex items-center gap-3 py-2"><div class="min-w-0 flex-1"><p class="text-foreground truncate text-[14px]"> </p> <p class="text-muted-foreground truncate text-[12px]"> </p></div> <button type="button" class="text-muted-foreground hover:text-muted-foreground shrink-0 px-1 text-[12px] opacity-0 transition group-hover:opacity-100 focus-visible:opacity-100">Restore</button></li>`),aa=i(`<ul class="max-w-xl space-y-1"></ul>`),oa=i(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Archived Threads</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><p class="text-muted-foreground mb-6 max-w-xl text-sm leading-6">We may permanently delete archived threads from our database at any time.</p> <!></div></section>`);function sa(e,t){E(t,!0);let n=C(()=>[...t.threads].filter(e=>!Vi(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt));var i=oa(),a=s(y(i),2),o=s(y(a),2),c=e=>{v(e,ra())},l=e=>{var r=aa();fe(r,21,()=>p(n),e=>e.threadId,(e,n)=>{var r=ia(),i=y(r),a=y(i),o=y(a,!0);k(a);var c=s(a,2),l=y(c,!0);k(c),k(i);var u=s(i,2);k(r),V(()=>{z(o,p(n).title),z(l,p(n).workspaceName)}),M(`click`,u,()=>{t.onRestore(p(n).threadId)}),v(e,r)}),k(r),v(e,r)};r(o,e=>{p(n).length===0?e(c):e(l,-1)}),k(a),k(i),v(e,i),j()}t([`click`]);var ca=i(`<button type="button" class="text-muted-foreground hover:text-foreground inline-flex size-7 shrink-0 items-center justify-center rounded-md transition hover:bg-[var(--hover-fill)]"><!></button>`);function la(e,t){E(t,!0);var n=ca(),i=y(n),a=e=>{hn(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{Qt(e,{class:`size-3.5`,"aria-hidden":`true`})};r(i,e=>{t.theme===`dark`?e(a):e(o,-1)}),k(n),V(()=>{O(n,`aria-label`,t.theme===`dark`?`Switch to light mode`:`Switch to dark mode`),O(n,`title`,t.theme===`dark`?`Light mode`:`Dark mode`)}),M(`click`,n,()=>t.onThemeChange(t.theme===`dark`?`light`:`dark`)),v(e,n),j()}t([`click`]);var ua=i(`<button type="button"><!> <span class="truncate"> </span></button>`),da=i(`<aside class="app-sidebar-panel"><div class="flex h-full min-h-0 flex-col overflow-hidden"><div class="flex items-center justify-between gap-2 px-3.5 pt-3 pb-3"><button type="button" class="text-muted-foreground hover:text-foreground inline-flex h-8 items-center gap-2 rounded-lg px-2 text-[13px] transition hover:bg-[var(--hover-fill)]"><!> Back</button> <!></div> <nav class="hide-scrollbar min-h-0 flex-1 space-y-0.5 overflow-y-auto px-2.5 pb-4" aria-label="Settings"></nav></div></aside>`);function fa(e,t){E(t,!0);let n=[{id:`account`,label:`Account`,icon:yn},{id:`usage`,label:`Usage`,icon:vt},{id:`archived`,label:`Archived Threads`,icon:ct}];var r=da(),i=y(r),a=y(i),o=y(a);ut(y(o),{class:`size-3.5`,"aria-hidden":`true`}),de(),k(o),la(s(o,2),{get theme(){return t.theme},get onThemeChange(){return t.onThemeChange}}),k(a);var c=s(a,2);fe(c,21,()=>n,e=>e.id,(e,n)=>{var r=ua(),i=y(r);R(i,()=>p(n).icon,(e,t)=>{t(e,{class:`text-muted-foreground size-4 shrink-0`,"aria-hidden":`true`})});var a=s(i,2),o=y(a,!0);k(a),k(r),V(()=>{P(r,1,`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-left text-[13px] transition ${t.activePage===p(n).id?`bg-[var(--hover-fill-strong)] text-foreground`:`text-muted-foreground hover:bg-[var(--hover-fill)] hover:text-foreground`}`),O(r,`aria-current`,t.activePage===p(n).id?`page`:void 0),z(o,p(n).label)}),M(`click`,r,()=>{t.onNavigate(p(n).id)}),v(e,r)}),k(c),k(i),k(r),M(`click`,o,function(...e){t.onBack?.apply(this,e)}),v(e,r),j()}t([`click`]);var pa=[{id:`modelUsage`,label:`Model usage`,noun:`model usage`,description:`More expensive models use up more usage.`},{id:`webTools`,label:`Web tools`,noun:`web tools`,description:`Web search and URL scrape share this quota.`}],ma=[`weekly`,`monthly`],ha=i(`<p class="text-muted-foreground text-sm leading-6">Couldn’t load your usage right now. Try again in a moment.</p>`),ga=i(`<div class="space-y-2"><div class="h-3.5 w-full rounded bg-[var(--hover-fill)]"></div> <div class="h-1.5 w-full rounded-full bg-[var(--hover-fill)]"></div></div>`),_a=i(`<div class="space-y-5"><div class="h-3 w-28 rounded bg-[var(--hover-fill)]"></div> <!></div>`),va=i(`<div class="animate-pulse space-y-10" aria-hidden="true"><div class="h-4 w-24 rounded bg-[var(--hover-fill)]"></div> <!></div>`),ya=i(`<p class="text-muted-foreground mt-1 text-[12px]"> </p>`),ba=i(`<p> </p>`),xa=i(`<p class="text-muted-foreground mt-1.5 text-[12px]"> </p>`),Sa=i(`<div><div class="flex items-baseline justify-between gap-3"><p class="text-muted-foreground text-[13px]"> </p> <!></div> <p class="text-muted-foreground mt-0.5 text-[12px]"> </p> <div class="mt-2 h-1.5 overflow-hidden rounded-full bg-[var(--hover-fill)]" role="progressbar"><div></div></div> <!></div>`),Ca=i(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase"> </p> <!> <div class="mt-4 space-y-6"></div></div>`),wa=i(`<div><p class="text-muted-foreground text-[11px] tracking-[0.18em] uppercase">Subscription Tier</p> <p class="text-foreground mt-3 text-[15px]"> </p></div> <!>`,1),Ta=i(`<section class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex h-12 shrink-0 items-center px-6"><h1 class="text-foreground text-[1rem] font-medium tracking-[-0.03em]">Usage</h1></header> <div class="min-h-0 flex-1 overflow-y-auto px-6 py-8"><div class="max-w-xl space-y-10"><!></div></div></section>`);function Ea(e,t){E(t,!0);let i=De(),a=we(H.usage.getMyUsage,()=>i.isAuthenticated&&!i.isLoading?{}:`skip`),o=x(u(Date.now()));n(()=>{let e=setInterval(()=>{l(o,Date.now(),!0)},6e4);return()=>{clearInterval(e)}});let c=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),d={weekly:`Weekly`,monthly:`Monthly`};function f(e){let t=Math.max(0,e-p(o)),n=Math.ceil(t/36e5);if(n>=24){let e=Math.floor(n/24),t=n%24;return t>0?`${e}d ${t}h`:`${e}d`}return t>=36e5?`${n}h`:`${Math.max(1,Math.ceil(t/6e4))}m`}function m(e,t){return e?`bg-rose-400/90`:t?`bg-amber-400/90`:`bg-foreground/25`}var h=Ta(),g=s(y(h),2),_=y(g),S=y(_),w=e=>{v(e,ha())},T=e=>{var t=va();fe(s(y(t),2),17,()=>pa,e=>e.id,(e,t)=>{var n=_a();fe(s(y(n),2),16,()=>ma,e=>e,(e,t)=>{v(e,ga())}),k(n),v(e,n)}),k(t),v(e,t)},D=e=>{var t=wa(),n=b(t),i=s(y(n),2),o=y(i,!0);k(i),k(n),fe(s(n,2),17,()=>a.data.meters,e=>e.id,(e,t)=>{var n=Ca(),i=y(n),a=y(i,!0);k(i);var o=s(i,2),l=e=>{var n=ya(),r=y(n,!0);k(n),V(()=>z(r,p(t).description)),v(e,n)};r(o,e=>{p(t).description&&e(l)});var u=s(o,2);fe(u,21,()=>p(t).windows,e=>e.period,(e,n)=>{let i=C(()=>p(n).limit>0),a=C(()=>p(i)?Math.round(p(n).used/p(n).limit*100):0),o=C(()=>p(i)&&p(n).used>=p(n).limit),l=C(()=>p(i)&&p(n).used>=p(n).limit*.9);var u=Sa(),h=y(u),g=y(h),_=y(g,!0);k(g);var b=s(g,2),x=e=>{var t=ba(),n=y(t);k(t),V(()=>{P(t,1,`text-[12px] ${p(o)?`text-destructive`:p(l)?`text-amber-800 dark:text-amber-300`:`text-muted-foreground`}`),z(n,`${p(a)??``}% used`)}),v(e,t)};r(b,e=>{p(i)&&e(x)}),k(h);var S=s(h,2),w=y(S);k(S);var T=s(S,2);O(T,`aria-valuemin`,0);var E=y(T);k(T);var D=s(T,2),ee=e=>{var t=xa(),r=y(t);k(t),V(e=>z(r,`Resets in ${e??``}`),[()=>f(p(n).resetsAt)]),v(e,t)};r(D,e=>{p(n).resetsAt!==null&&e(ee)}),k(u),V((e,r,o,s,c)=>{z(_,d[p(n).period]),z(w,`${e??``} / ${r??``}`),O(T,`aria-label`,`${p(t).label} — ${d[p(n).period]}`),O(T,`aria-valuemax`,p(i)?p(n).limit:0),O(T,`aria-valuenow`,o),O(T,`aria-valuetext`,p(i)?`${p(a)}% used`:`0 / 0`),P(E,1,s),ne(E,c)},[()=>c.format(p(i)?p(n).used:0),()=>c.format(p(i)?p(n).limit:0),()=>p(i)?Math.min(p(n).used,p(n).limit):0,()=>`h-full rounded-full transition-[width] duration-300 ${m(p(o),p(l))}`,()=>`width: ${p(i)?Math.min(100,Math.max(0,p(a))):0}%`]),v(e,u)}),k(u),k(n),V(()=>z(a,p(t).label)),v(e,n)}),V(()=>z(o,Lr[a.data.tier])),v(e,t)};r(S,e=>{a.error?e(w):a.isLoading||a.data===void 0?e(T,1):e(D,-1)}),k(_),k(g),k(h),v(e,h),j()}function Da(e){return e!=null&&!Array.isArray(e)&&typeof e==`object`}function Oa(e){if(!(!Da(e)||typeof e.error!=`string`)&&!(e.status!==`cancelled`&&e.status!==`failed`))return{error:e.error,status:e.status}}function ka(e,t){let n=new Map,r=new Set,i=t.filter(t=>{if(!t.callId)return!0;let i=e.find(e=>e.callId===t.callId&&!r.has(e.callId));return i?(n.set(t.id,i.callId),r.add(i.callId),!1):!1}),a=t=>{let a=e.filter(e=>!r.has(e.callId)),o=new Map(i.filter(e=>!n.has(e.id)).map(e=>[e.id,a.filter(n=>t(n,e))]));for(let e of i){if(n.has(e.id))continue;let t=o.get(e.id)??[];if(t.length!==1)continue;let[a]=t;i.filter(e=>!n.has(e.id)&&(o.get(e.id)??[]).some(e=>e.callId===a.callId)).length===1&&(n.set(e.id,a.callId),r.add(a.callId))}};return a((e,t)=>e.name===t.kind&&Aa(e.input,t.payload)),a((e,t)=>e.name===t.kind),n}function Aa(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)&&e.length===t.length&&e.every((e,n)=>Aa(e,t[n]));if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.hasOwn(t,n)&&Aa(e[n],t[n]))}function ja(e){return e.name||e.job?.kind||`tool`}function Ma(e){let t=[];for(let n of e){if(n.type===`text`||n.type===`reasoning`){t.push(n);continue}let e=ja(n),r=t.at(-1);if(r?.type===`tool-group`&&r.toolKey===e){r.tools.push(n);continue}t.push({type:`tool-group`,toolKey:e,tools:[n]})}return t}function Na(e){return e.type===`reasoning`?e.id:e.tools[0]?.callId??e.toolKey}function Pa(e){let t=[];for(let n of e){if(n.type===`text`){t.push(n);continue}let e=t.at(-1);if(e?.type===`work`){e.blocks.push(n);continue}t.push({type:`work`,key:Na(n),blocks:[n]})}return t}function Fa(e,t){for(let n of e)if(n.type===`tool-group`)for(let e of n.tools)e.job&&t(e.job)}function Ia(e){let t;return Fa(e,e=>{let n=e.claimedAt??e.enqueuedAt;t=t===void 0?n:Math.min(t,n)}),t}function La(e){let t;return Fa(e,e=>{e.completedAt!==void 0&&(t=t===void 0?e.completedAt:Math.max(t,e.completedAt))}),t}function Ra(e){let t=[],n=[],r=0,i;for(let a of e){if(a.type!==`work`){t.push(void 0);continue}t.push(r),n.push(i);let e=La(a.blocks);e!==void 0&&(i=i===void 0?e:Math.max(i,e)),r+=1}return{workIndexBySectionIndex:t,priorCompletedAtByWorkIndex:n}}function za(e,t){let n=Ia(e.blocks),r=t.workSectionIndex===0?t.runStartedAt:n??t.priorWorkCompletedAtMs??t.runStartedAt;return t.inProgress?{startedAtMs:r}:{startedAtMs:r,completedAtMs:La(e.blocks)??t.runCompletedAt??r}}function Ba(e){return e.output===void 0?!e.job||e.job.status===`pending`||e.job.status===`claimed`:!1}function Va(e,t){return t&&Ba(e)}function Ha(e,t){return Da(e)&&typeof e[t]==`string`?e[t]:void 0}function Ua(e){return Ha(e.output,`sessionId`)??Ha(e.input,`sessionId`)??Ha(e.job?.payload,`sessionId`)}function Wa(e){let t=new Map;for(let n of e){let e=Ua(n);if(!e)continue;let r=Ha(n.output,`command`)??(ja(n)===`exec_command`?Ha(n.input,`cmd`)??Ha(n.job?.payload,`cmd`):void 0);r&&t.set(e,r)}return t}function Ga(e,t){let n=Ua(e);return Ha(e.output,`command`)??(n?t.get(n):void 0)}function Ka(e,t){if(!t)return new Set;let n=new Map,r=new Set;for(let t of e){let e=Ua(t);e&&(ja(t)===`exec_command`&&r.add(e),Da(t.output)&&typeof t.output.running==`boolean`&&n.set(e,t.output.running))}return new Set([...r].filter(e=>n.get(e)===!0))}function qa(e,t,n){let r=[],i=[];for(let a of e){if(a.type===`reasoning`){r.push(a);continue}let e=[];for(let r of a.tools){let a=ja(r),o=Ua(r),s=o!==void 0&&n.has(o),c=Va(r,t);if(a===`exec_command`&&s){i.push(r);continue}if(a===`write_stdin`){if(c){s||i.push(r);continue}e.push(r);continue}c?i.push(r):e.push(r)}e.length>0&&r.push({type:`tool-group`,toolKey:a.toolKey,tools:e})}return{settledBlocks:r,runningTools:i}}function Ja(e,t){return!t&&Ba(e)?`interrupted`:e.job?.status===`cancelled`||e.job?.status===`failed`?e.job.status:Oa(e.output)?.status}function Ya(e,t){if(!t&&Ba(e))return`The agent stopped before this tool call finished.`;let n=Oa(e.output)?.error;return e.job?e.job.status===`cancelled`?e.job.error??n??`Executor job cancelled before completion.`:e.job.status===`failed`?e.job.error??n??`Executor job failed.`:void 0:n}function Xa(e,t){let n=new Map(e.filter(e=>e.type===`tool-result`).map(e=>[e.callId,e])),r=ka(e.filter(e=>e.type===`tool-call`),t.map(e=>({id:e._id,kind:e.kind,...e.callId?{callId:e.callId}:{},payload:e.payload}))),i=new Map;for(let e of t){let t=r.get(e._id);t&&i.set(t,e)}let a=[],o=new Set;for(let t of e){if(t.type===`tool-result`)continue;if(t.type===`text`||t.type===`reasoning`){t.text.trim().length>0&&a.push(t);continue}let e=n.get(t.callId),r=i.get(t.callId);r&&o.add(r._id),a.push({type:`tool`,callId:t.callId,name:t.name,input:t.input,...e?{output:e.output}:r?.result===void 0?{}:{output:r.result},...r?{job:r}:{}})}for(let e of t)o.has(e._id)||a.push({type:`tool`,callId:e.callId??`executor-job:${e._id}`,name:e.kind,input:e.payload,...e.result===void 0?{}:{output:e.result},job:e});return a}var Za={apply_patch:Pt,check_docs:mt,exec_command:_n,get_workspace_instructions:nn,read_skill:en,scrape_url:Ht,web_search:an,write_stdin:dn};function Qa(e){return Za[e]??xn}function $a(e){return Qa(e.job?.kind??e.name)}function eo(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 to(e){if(Array.isArray(e))return e}function no(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)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 ro(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function io(e,t){return to(e)||no(e,t)||ao(e,t)||ro()}function ao(e,t){if(e){if(typeof e==`string`)return eo(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)?eo(e,t):void 0}}var oo=Object.entries,so=Object.setPrototypeOf,co=Object.isFrozen,lo=Object.getPrototypeOf,uo=Object.getOwnPropertyDescriptor,fo=Object.freeze,po=Object.seal,mo=Object.create,ho=typeof Reflect<`u`&&Reflect,go=ho.apply,_o=ho.construct;fo||=function(e){return e},po||=function(e){return e},go||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},_o||=function(e){return new e(...[...arguments].slice(1))};var vo=Ro(Array.prototype.forEach),yo=Ro(Array.prototype.lastIndexOf),bo=Ro(Array.prototype.pop),xo=Ro(Array.prototype.push),So=Ro(Array.prototype.splice),Co=Array.isArray,wo=Ro(String.prototype.toLowerCase),To=Ro(String.prototype.toString),Eo=Ro(String.prototype.match),Do=Ro(String.prototype.replace),Oo=Ro(String.prototype.indexOf),ko=Ro(String.prototype.trim),Ao=Ro(Number.prototype.toString),jo=Ro(Boolean.prototype.toString),Mo=typeof BigInt>`u`?null:Ro(BigInt.prototype.toString),No=typeof Symbol>`u`?null:Ro(Symbol.prototype.toString),Po=Ro(Object.prototype.hasOwnProperty),Fo=Ro(Object.prototype.toString),Io=Ro(RegExp.prototype.test),Lo=zo(TypeError);function Ro(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return go(e,t,n)}}function zo(e){return function(){return _o(e,[...arguments])}}function Z(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wo;if(so&&so(e,null),!Co(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(co(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Bo(e){for(let t=0;t<e.length;t++)Po(e,t)||(e[t]=null);return e}function Vo(e){let t=mo(null);for(let r of oo(e)){var n=io(r,2);let i=n[0],a=n[1];Po(e,i)&&(Co(a)?t[i]=Bo(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=Vo(a):t[i]=a)}return t}function Ho(e){switch(typeof e){case`string`:return e;case`number`:return Ao(e);case`boolean`:return jo(e);case`bigint`:return Mo?Mo(e):`0`;case`symbol`:return No?No(e):`Symbol()`;case`undefined`:return Fo(e);case`function`:case`object`:{if(e===null)return Fo(e);let t=e,n=Uo(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Fo(e)}return Fo(e)}default:return Fo(e)}}function Uo(e,t){for(;e!==null;){let n=uo(e,t);if(n){if(n.get)return Ro(n.get);if(typeof n.value==`function`)return Ro(n.value)}e=lo(e)}function n(){return null}return n}function Wo(e){try{return Io(e,``),!0}catch{return!1}}var Go=fo(`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(`.`)),Ko=fo(`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(`.`)),qo=fo([`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`]),Jo=fo([`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`]),Yo=fo(`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(`.`)),Xo=fo([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Zo=fo([`#text`]),Qo=fo(`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(`.`)),$o=fo(`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.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.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(`.`)),es=fo(`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(`.`)),ts=fo([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),ns=po(/{{[\w\W]*|^[\w\W]*}}/g),rs=po(/<%[\w\W]*|^[\w\W]*%>/g),is=po(/\${[\w\W]*/g),as=po(/^data-[\-\w.\u00B7-\uFFFF]+$/),os=po(/^aria-[\-\w]+$/),ss=po(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),cs=po(/^(?:\w+script|data):/i),ls=po(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),us=po(/^html$/i),ds=po(/^[a-z][.\w]*(-[.\w]+)+$/i),fs=po(/<[/\w!]/g),ps=po(/<[/\w]/g),ms=po(/<\/no(script|embed|frames)/i),hs=po(/\/>/i),gs={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},_s=function(){return typeof window>`u`?null:window},vs=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}},ys=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},bs=function(e,t,n,r){return Po(e,t)&&Co(e[t])?Z(r.base?Vo(r.base):{},e[t],r.transform):n};function xs(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_s(),t=e=>xs(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==gs.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=Uo(d,`cloneNode`),p=Uo(d,`remove`),m=Uo(d,`nextSibling`),h=Uo(d,`childNodes`),g=Uo(d,`parentNode`),_=Uo(d,`shadowRoot`),v=Uo(d,`attributes`),y=o&&o.prototype?Uo(o.prototype,`nodeType`):null,b=o&&o.prototype?Uo(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let x,S=``,C,w=!1,T=0,E=function(){if(T>0)throw Lo(`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.`)},D=function(e){E(),T++;try{return x.createHTML(e)}finally{T--}},ee=function(e){E(),T++;try{return x.createScriptURL(e)}finally{T--}},O=function(){return w||=(C=vs(u,i),!0),C},k=n,te=k.implementation,ne=k.createNodeIterator,re=k.createDocumentFragment,ie=k.getElementsByTagName,A=r.importNode,j=ys();t.isSupported=typeof oo==`function`&&typeof g==`function`&&te&&te.createHTMLDocument!==void 0;let M=ns,ae=rs,oe=is,se=as,ce=os,N=cs,P=ls,le=ds,F=ss,I=null,ue=Z({},[...Go,...Ko,...qo,...Yo,...Zo]),L=null,de=Z({},[...Qo,...$o,...es,...ts]),R=Object.seal(mo(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}})),z=null,fe=null,B=Object.seal(mo(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),V=!0,pe=!0,me=!1,he=!0,ge=!1,_e=!0,ve=!1,ye=!1,H=null,be=null,xe=!1,Se=!1,Ce=!1,we=!1,Te=!0,Ee=!1,De=`user-content-`,U=!0,W=!1,Oe={},ke=null,Ae=Z({},`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(`.`)),je=null,Me=Z({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ne=null,Pe=Z({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Fe=`http://www.w3.org/1998/Math/MathML`,G=`http://www.w3.org/2000/svg`,Ie=`http://www.w3.org/1999/xhtml`,Le=Ie,K=!1,q=null,Re=Z({},[Fe,G,Ie],To),ze=fo([`mi`,`mo`,`mn`,`ms`,`mtext`]),Be=Z({},ze),Ve=fo([`annotation-xml`]),He=Z({},Ve),Ue=Z({},[`title`,`style`,`font`,`a`,`script`]),We=null,Ge=[`application/xhtml+xml`,`text/html`],J=null,Ke=null,qe=n.createElement(`form`),Je=function(e){return e instanceof RegExp||e instanceof Function},Y=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Ke&&Ke===e)return;(!e||typeof e!=`object`)&&(e={}),e=Vo(e),We=Ge.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,J=We===`application/xhtml+xml`?To:wo,I=bs(e,`ALLOWED_TAGS`,ue,{transform:J}),L=bs(e,`ALLOWED_ATTR`,de,{transform:J}),q=bs(e,`ALLOWED_NAMESPACES`,Re,{transform:To}),Ne=bs(e,`ADD_URI_SAFE_ATTR`,Pe,{transform:J,base:Pe}),je=bs(e,`ADD_DATA_URI_TAGS`,Me,{transform:J,base:Me}),ke=bs(e,`FORBID_CONTENTS`,Ae,{transform:J}),z=bs(e,`FORBID_TAGS`,Vo({}),{transform:J}),fe=bs(e,`FORBID_ATTR`,Vo({}),{transform:J}),Oe=Po(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Vo(e.USE_PROFILES):e.USE_PROFILES:!1,V=e.ALLOW_ARIA_ATTR!==!1,pe=e.ALLOW_DATA_ATTR!==!1,me=e.ALLOW_UNKNOWN_PROTOCOLS||!1,he=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,ge=e.SAFE_FOR_TEMPLATES||!1,_e=e.SAFE_FOR_XML!==!1,ve=e.WHOLE_DOCUMENT||!1,Se=e.RETURN_DOM||!1,Ce=e.RETURN_DOM_FRAGMENT||!1,we=e.RETURN_TRUSTED_TYPE||!1,xe=e.FORCE_BODY||!1,Te=e.SANITIZE_DOM!==!1,Ee=e.SANITIZE_NAMED_PROPS||!1,U=e.KEEP_CONTENT!==!1,W=e.IN_PLACE||!1,F=Wo(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ss,Le=typeof e.NAMESPACE==`string`?e.NAMESPACE:Ie,Be=Po(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?Vo(e.MATHML_TEXT_INTEGRATION_POINTS):Z({},ze),He=Po(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?Vo(e.HTML_INTEGRATION_POINTS):Z({},Ve);let t=Po(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?Vo(e.CUSTOM_ELEMENT_HANDLING):mo(null);if(R=mo(null),Po(t,`tagNameCheck`)&&Je(t.tagNameCheck)&&(R.tagNameCheck=t.tagNameCheck),Po(t,`attributeNameCheck`)&&Je(t.attributeNameCheck)&&(R.attributeNameCheck=t.attributeNameCheck),Po(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(R.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),po(R),ge&&(pe=!1),Ce&&(Se=!0),Oe&&(I=Z({},Zo),L=mo(null),Oe.html===!0&&(Z(I,Go),Z(L,Qo)),Oe.svg===!0&&(Z(I,Ko),Z(L,$o),Z(L,ts)),Oe.svgFilters===!0&&(Z(I,qo),Z(L,$o),Z(L,ts)),Oe.mathMl===!0&&(Z(I,Yo),Z(L,es),Z(L,ts))),B.tagCheck=null,B.attributeCheck=null,Po(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?B.tagCheck=e.ADD_TAGS:Co(e.ADD_TAGS)&&(I===ue&&(I=Vo(I)),Z(I,e.ADD_TAGS,J))),Po(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?B.attributeCheck=e.ADD_ATTR:Co(e.ADD_ATTR)&&(L===de&&(L=Vo(L)),Z(L,e.ADD_ATTR,J))),Po(e,`ADD_URI_SAFE_ATTR`)&&Co(e.ADD_URI_SAFE_ATTR)&&Z(Ne,e.ADD_URI_SAFE_ATTR,J),Po(e,`FORBID_CONTENTS`)&&Co(e.FORBID_CONTENTS)&&(ke===Ae&&(ke=Vo(ke)),Z(ke,e.FORBID_CONTENTS,J)),Po(e,`ADD_FORBID_CONTENTS`)&&Co(e.ADD_FORBID_CONTENTS)&&(ke===Ae&&(ke=Vo(ke)),Z(ke,e.ADD_FORBID_CONTENTS,J)),U&&(I[`#text`]=!0),ve&&Z(I,[`html`,`head`,`body`]),I.table&&(Z(I,[`tbody`]),delete z.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw Lo(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw Lo(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=x;x=e.TRUSTED_TYPES_POLICY;try{S=D(``)}catch(e){throw x=t,e}}else e.TRUSTED_TYPES_POLICY===null?(x=void 0,S=``):(x===void 0&&(x=O()),x&&typeof S==`string`&&(S=D(``)));fo&&fo(e),Ke=e},Ye=Z({},[...Ko,...qo,...Jo]),Xe=Z({},[...Yo,...Xo]),Ze=function(e,t,n){return t.namespaceURI===Ie?e===`svg`:t.namespaceURI===Fe?e===`svg`&&(n===`annotation-xml`||Be[n]):!!Ye[e]},Qe=function(e,t,n){return t.namespaceURI===Ie?e===`math`:t.namespaceURI===G?e===`math`&&He[n]:!!Xe[e]},$e=function(e,t,n){return t.namespaceURI===G&&!He[n]||t.namespaceURI===Fe&&!Be[n]?!1:!Xe[e]&&(Ue[e]||!Ye[e])},et=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Le,tagName:`template`});let n=wo(e.tagName),r=wo(t.tagName);return q[e.namespaceURI]?e.namespaceURI===G?Ze(n,t,r):e.namespaceURI===Fe?Qe(n,t,r):e.namespaceURI===Ie?$e(n,t,r):!!(We===`application/xhtml+xml`&&q[e.namespaceURI]):!1},tt=function(e){xo(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw Lo(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},nt=function(e){at(e);let t=h(e);if(t){let e=[];vo(t,t=>{xo(e,t)}),vo(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},rt=function(e,n){try{xo(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{xo(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Se||Ce)try{tt(n)}catch{}else try{n.setAttribute(e,``)}catch{}},it=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||L[J(i)]))try{e.removeAttribute(i)}catch{}}},at=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(y?y(e):e.nodeType)===gs.element&&it(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ot=function(e){if(!_e)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=y?y(e):e.nodeType;if(n===gs.processingInstruction||n===gs.comment&&Io(ps,e.data)){try{p(e)}catch{}continue}if(n===gs.element){let t=e,n=J(b?b(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},X=function(e){let t=null,r=null;if(xe)e=`<remove></remove>`+e;else{let t=Eo(e,/^[\r\n\t ]+/);r=t&&t[0]}We===`application/xhtml+xml`&&Le===Ie&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=x?D(e):e;if(Le===Ie)try{t=new l().parseFromString(i,We)}catch{}if(!t||!t.documentElement){t=te.createDocument(Le,`template`,null);try{t.documentElement.innerHTML=K?S:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Le===Ie?ie.call(t,ve?`html`:`body`)[0]:ve?t.documentElement:a},st=function(e){return ne.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ct=function(e){return e=Do(e,M,` `),e=Do(e,ae,` `),e=Do(e,oe,` `),e},lt=function(e){e.normalize();let t=ne.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=ct(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&vo(r,e=>{dt(e.content)&&lt(e.content)})},ut=function(e){let t=b?b(e):null;return typeof t!=`string`||J(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},dt=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===gs.documentFragment}catch{return!1}},ft=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function pt(e,n,r){e.length!==0&&vo(e,e=>{e.call(t,n,r,Ke)})}let mt=function(e,t){return!!(_e&&e.hasChildNodes()&&!ft(e.firstElementChild)&&Io(fs,e.textContent)&&Io(fs,e.innerHTML)||_e&&e.namespaceURI===Ie&&t===`style`&&ft(e.firstElementChild)||e.nodeType===gs.processingInstruction||_e&&e.nodeType===gs.comment&&Io(ps,e.data))},ht=function(e,t){if(!z[t]&&yt(t)&&(R.tagNameCheck instanceof RegExp&&Io(R.tagNameCheck,t)||R.tagNameCheck instanceof Function&&R.tagNameCheck(t)))return!1;if(U&&!ke[t]){let t=g(e),n=h(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=W?n[i]:f(n[i],!0);t.insertBefore(r,m(e))}}}return tt(e),!0},gt=function(e,n){if(pt(j.beforeSanitizeElements,e,null),e!==n&&g(e)===null)return!0;if(ut(e))return tt(e),!0;let r=J(b?b(e):e.nodeName);if(pt(j.uponSanitizeElement,e,{tagName:r,allowedTags:I}),e!==n&&g(e)===null)return!0;if(mt(e,r))return tt(e),!0;if(z[r]||!(B.tagCheck instanceof Function&&B.tagCheck(r))&&!I[r]){let t=ht(e,r);return t===!1&&pt(j.afterSanitizeElements,e,null),t}if((y?y(e):e.nodeType)===gs.element&&!et(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Io(ms,e.innerHTML))return tt(e),!0;if(ge&&e.nodeType===gs.text){let n=ct(e.textContent);e.textContent!==n&&(xo(t.removed,{element:e.cloneNode()}),e.textContent=n)}return pt(j.afterSanitizeElements,e,null),!1},_t=function(e,t,r){if(fe[t]||_e&&t===`patchsrc`||_e&&t===`for`&&e!==`label`&&e!==`output`||Te&&(t===`id`||t===`name`)&&(r in n||r in qe))return!1;let i=L[t]||B.attributeCheck instanceof Function&&B.attributeCheck(t,e);if(!(pe&&Io(se,t))&&!(V&&Io(ce,t))){if(!i){if(!(yt(e)&&(R.tagNameCheck instanceof RegExp&&Io(R.tagNameCheck,e)||R.tagNameCheck instanceof Function&&R.tagNameCheck(e))&&(R.attributeNameCheck instanceof RegExp&&Io(R.attributeNameCheck,t)||R.attributeNameCheck instanceof Function&&R.attributeNameCheck(t,e))||t===`is`&&R.allowCustomizedBuiltInElements&&(R.tagNameCheck instanceof RegExp&&Io(R.tagNameCheck,r)||R.tagNameCheck instanceof Function&&R.tagNameCheck(r))))return!1}else if(!Ne[t]&&!Io(F,Do(r,P,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Oo(r,`data:`)===0&&je[e])&&!(me&&!Io(N,Do(r,P,``)))&&r)return!1}return!0},vt=Z({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),yt=function(e){return!vt[wo(e)]&&Io(le,e)},bt=function(e,t,n,r){if(x&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return D(r);case`TrustedScriptURL`:return ee(r)}return r},xt=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),ut(e)?tt(e):bo(t.removed)}catch{rt(n,e)}},St=function(e){pt(j.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||ut(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0},r=t.length,i=J(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=J(o),u=c,d=o===`value`?u:ko(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,pt(j.uponSanitizeAttribute,e,n),d=n.attrValue,Ee&&(l===`id`||l===`name`)&&Oo(d,De)!==0&&(rt(o,e),d=De+d),_e&&Io(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){rt(o,e);continue}if(l===`attributename`&&Eo(d,`href`)){rt(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){rt(o,e);continue}if(!he&&Io(hs,d)){rt(o,e);continue}if(ge&&(d=ct(d)),!_t(i,l,d)){rt(o,e);continue}d=bt(i,l,s,d),d!==u&&xt(e,o,s,d)}}pt(j.afterSanitizeAttributes,e,null)},Ct=function(e){let t=null,n=st(e);for(pt(j.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(pt(j.uponSanitizeShadowNode,t,null),gt(t,e),St(t),dt(t.content)&&Ct(t.content),(y?y(t):t.nodeType)===gs.element){let e=_(t);dt(e)&&(wt(e),Ct(e))}pt(j.afterSanitizeShadowDOM,e,null)},wt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Ct(e.shadow);continue}let n=e.node,r=(y?y(n):n.nodeType)===gs.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&J(e)===`template`){let e=n.content;dt(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);dt(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(K=!e,K&&(e=`<!-->`),typeof e!=`string`&&!ft(e)&&(e=Ho(e),typeof e!=`string`))throw Lo(`dirty is not a string, aborting`);if(!t.isSupported)return e;ye?(I=H,L=be):Y(n),(j.uponSanitizeElement.length>0||j.uponSanitizeAttribute.length>0)&&(I=Vo(I)),j.uponSanitizeAttribute.length>0&&(L=Vo(L)),t.removed=[];let c=W&&typeof e!=`string`&&ft(e);if(c){ot(e);let t=b?b(e):e.nodeName;if(typeof t==`string`){let n=J(t);if(!I[n]||z[n])throw nt(e),Lo(`root node is forbidden and cannot be sanitized in-place`)}if(ut(e))throw nt(e),Lo(`root node is clobbered and cannot be sanitized in-place`);try{wt(e)}catch(t){throw nt(e),t}}else if(ft(e))i=X(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===gs.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),wt(a);else{if(!Se&&!ge&&!ve&&e.indexOf(`<`)===-1)return x&&we?D(e):e;if(i=X(e),!i)return Se?null:we?S:``}i&&xe&&tt(i.firstChild);let l=c?e:i,u=st(l);try{for(;o=u.nextNode();)gt(o,l),St(o),dt(o.content)&&Ct(o.content)}catch(n){throw c&&(nt(e),vo(t.removed,e=>{e.element&&at(e.element)})),n}if(c)return vo(t.removed,e=>{e.element&&at(e.element)}),ge&&lt(e),e;if(Se){if(ge&&lt(i),Ce)for(s=re.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(L.shadowroot||L.shadowrootmode)&&(s=A.call(r,s,!0)),s}let d=ve?i.outerHTML:i.innerHTML;return ve&&I[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Io(us,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
4
- `+d),ge&&(d=ct(d)),x&&we?D(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Y(e),ye=!0,H=I,be=L},t.clearConfig=function(){Ke=null,ye=!1,H=null,be=null,x=C,S=``},t.isValidAttribute=function(e,t,n){Ke||Y({});let r=J(e),i=J(t);return _t(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Po(j,e)&&xo(j[e],t)},t.removeHook=function(e,t){if(Po(j,e)){if(t!==void 0){let n=yo(j[e],t);return n===-1?void 0:So(j[e],n,1)[0]}return bo(j[e])}},t.removeHooks=function(e){Po(j,e)&&(j[e]=[])},t.removeAllHooks=function(){j=ys()},t}var Ss=xs(),Cs=Ss;Ss.sanitize.bind(Ss),Ss.isSupported,Ss.addHook.bind(Ss),Ss.removeHook.bind(Ss),Ss.removeHooks.bind(Ss),Ss.removeAllHooks.bind(Ss),Ss.setConfig.bind(Ss),Ss.clearConfig.bind(Ss),Ss.isValidAttribute.bind(Ss),Ss.version,Ss.removed;function ws(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ts=ws();function Es(e){Ts=e}var Ds={exec:()=>null};function Os(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 Q(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(As.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var ks=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),As={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Os(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Os(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:Os(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Os(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Os(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:Os(e=>RegExp(`^ {0,${e}}>`))},js=/^(?:[ \t]*(?:\n|$))+/,Ms=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ns=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ps=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Fs=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Is=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Ls=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Rs=Q(Ls).replace(/bull/g,Is).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(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),zs=Q(Ls).replace(/bull/g,Is).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(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Bs=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Vs=/^[^\n]+/,Hs=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Us=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Hs).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ws=Q(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Is).getRegex(),Gs=`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`,Ks=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,qs=Q(`^ {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][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Ks).replace(`tag`,Gs).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Js=e=>Q(Bs).replace(`hr`,Ps).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`,Gs).getRegex(),Ys=Js(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Xs=Js(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Zs={blockquote:Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Xs).getRegex(),code:Ms,def:Us,fences:Ns,heading:Fs,hr:Ps,html:qs,lheading:Rs,list:Ws,newline:js,paragraph:Ys,table:Ds,text:Vs},Qs=Q(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ps).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`,Gs).getRegex(),$s={...Zs,lheading:zs,table:Qs,paragraph:Q(Bs).replace(`hr`,Ps).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,Qs).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`,Gs).getRegex()},ec={...Zs,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Ks).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:Ds,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(Bs).replace(`hr`,Ps).replace(`heading`,` *#{1,6} *[^
5
- ]`).replace(`lheading`,Rs).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},tc=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,nc=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,rc=/^( {2,}|\\)\n(?!\s*$)/,ic=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ac=/[\p{P}\p{S}]/u,oc=/[\s\p{P}\p{S}]/u,sc=/[^\s\p{P}\p{S}]/u,cc=Q(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,oc).getRegex(),lc=/(?!~)[\p{P}\p{S}]/u,uc=/(?!~)[\s\p{P}\p{S}]/u,dc=/(?:[^\s\p{P}\p{S}]|~)/u,fc=Q(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,ks?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),pc=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,mc=Q(pc,`u`).replace(/punct/g,ac).getRegex(),hc=Q(pc,`u`).replace(/punct/g,lc).getRegex(),gc=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,_c=Q(gc,`gu`).replace(/notPunctSpace/g,sc).replace(/punctSpace/g,oc).replace(/punct/g,ac).getRegex(),vc=Q(gc,`gu`).replace(/notPunctSpace/g,dc).replace(/punctSpace/g,uc).replace(/punct/g,lc).getRegex(),yc=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,sc).replace(/punctSpace/g,oc).replace(/punct/g,ac).getRegex(),bc=Q(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,ac).getRegex(),xc=Q(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,sc).replace(/punctSpace/g,oc).replace(/punct/g,ac).getRegex(),Sc=Q(/\\(punct)/,`gu`).replace(/punct/g,ac).getRegex(),Cc=Q(/^<(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(),wc=Q(Ks).replace(`(?:-->|$)`,`-->`).getRegex(),Tc=Q(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,wc).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Ec=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Dc=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Ec).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Oc=Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ec).replace(`ref`,Hs).getRegex(),kc=Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Hs).getRegex(),Ac=Q(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Oc).replace(`nolink`,kc).getRegex(),jc=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mc={_backpedal:Ds,anyPunctuation:Sc,autolink:Cc,blockSkip:fc,br:rc,code:nc,del:Ds,delLDelim:Ds,delRDelim:Ds,emStrongLDelim:mc,emStrongRDelimAst:_c,emStrongRDelimUnd:yc,escape:tc,link:Dc,nolink:kc,punctuation:cc,reflink:Oc,reflinkSearch:Ac,tag:Tc,text:ic,url:Ds},Nc={...Mc,link:Q(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Ec).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Ec).getRegex()},Pc={...Mc,emStrongRDelimAst:vc,emStrongLDelim:hc,delLDelim:bc,delRDelim:xc,url:Q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,jc).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Q(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,jc).getRegex()},Fc={...Pc,br:Q(rc).replace(`{2,}`,`*`).getRegex(),text:Q(Pc.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Ic={normal:Zs,gfm:$s,pedantic:ec},Lc={normal:Mc,gfm:Pc,breaks:Fc,pedantic:Nc},Rc={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},zc=e=>Rc[e];function Bc(e,t){if(t){if(As.escapeTest.test(e))return e.replace(As.escapeReplace,zc)}else if(As.escapeTestNoEncode.test(e))return e.replace(As.escapeReplaceNoEncode,zc);return e}function Vc(e){try{e=encodeURI(e).replace(As.percentDecode,`%`)}catch{return null}return e}function Hc(e,t){let n=e.replace(As.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(As.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(As.slashPipe,`|`);return n}function Uc(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 Wc(e){let t=e.split(`
6
- `),n=t.length-1;for(;n>=0&&As.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
7
- `)}function Gc(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 Kc(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 qc(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`);r.state.inLink=!0;let c={type:e[0].charAt(0)===`!`?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:r.inlineTokens(s)};return r.state.inLink=!1,c}function Jc(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
8
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return r.length>=i.length?e.slice(i.length):e}).join(`
9
- `)}var Yc=class{options;rules;lexer;constructor(e){this.options=e||Ts}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]:Wc(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=Jc(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=Uc(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:Uc(t[0],`
10
- `),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:Uc(t[0],`
11
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=Uc(t[0],`
12
- `).split(`
13
- `),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(`
14
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
15
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
16
- ${s}`:s,r=r?`${r}
17
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=t.raw+`
18
- `+e.join(`
19
- `),o=this.blockquote(a);i[i.length-1]=o,n=n.substring(0,n.length-t.raw.length)+o.raw,r=r.substring(0,r.length-t.text.length)+o.text;break}else if(u?.type===`list`){let t=u,a=t.raw+`
20
- `+e.join(`
21
- `),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(`
22
- `);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=Kc(t[2].split(`
23
- `,1)[0],t[1].length),l=e.split(`
24
- `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
25
- `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
26
- `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
27
- `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
28
- `+l}u=!l.trim(),r+=p+`
29
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);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){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Wc(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=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:Uc(t[0],`
30
- `),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=Hc(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
31
- `):[],a={type:`table`,raw:Uc(t[0],`
32
- `),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(Hc(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:Uc(t[0],`
33
- `),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)===`
34
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=Uc(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=Gc(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(n=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?n.slice(1):n.slice(1,-1)),qc(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return qc(n,e,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},Xc=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ts,this.options.tokenizer=this.options.tokenizer||new Yc,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:As,block:Ic.normal,inline:Lc.normal};this.options.pedantic?(t.block=Ic.pedantic,t.inline=Lc.pedantic):this.options.gfm&&(t.block=Ic.gfm,this.options.breaks?t.inline=Lc.breaks:t.inline=Lc.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ic,inline:Lc}}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(As.carriageReturn,`
35
- `),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(As.tabCharGlobal,` `).replace(As.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+=`
36
- `: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(`
37
- `)?``:`
38
- `)+i.raw,n.text+=`
39
- `+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(`
40
- `)?``:`
41
- `)+i.raw,n.text+=`
42
- `+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(`
43
- `)?``:`
44
- `)+i.raw,r.text+=`
45
- `+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(`
46
- `)?``:`
47
- `)+i.raw,n.text+=`
48
- `+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}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(n=n.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf(`[`)+1,-1))?`[`+`a`.repeat(t.length-2)+`]`:t))}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,`++`),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)}},Zc=class{options;parser;constructor(e){this.options=e||Ts}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(As.notSpaceStart)?.[0],i=e.replace(As.endingNewline,``)+`
49
- `;return r?`<pre><code class="language-`+Bc(r)+`">`+(n?i:Bc(i,!0))+`</code></pre>
50
- `:`<pre><code>`+(n?i:Bc(i,!0))+`</code></pre>
51
- `}blockquote({tokens:e}){return`<blockquote>
52
- ${this.parser.parse(e)}</blockquote>
53
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
54
- `}hr(e){return`<hr>
55
- `}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+`>
56
- `+r+`</`+i+`>
57
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
58
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
59
- `}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>
60
- <thead>
61
- `+t+`</thead>
62
- `+r+`</table>
63
- `}tablerow({text:e}){return`<tr>
64
- ${e}</tr>
65
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
66
- `}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>${Bc(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:n}){let r=this.parser.parseInline(n),i=Vc(e);if(i===null)return r;e=i;let a=`<a href="`+e+`"`;return t&&(a+=` title="`+Bc(t)+`"`),a+=`>`+r+`</a>`,a}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=Vc(e);if(i===null)return Bc(n);e=i;let a=`<img src="${e}" alt="${Bc(n)}"`;return t&&(a+=` title="${Bc(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Bc(e.text)}},Qc=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}},$c=class e{options;renderer;textRenderer;constructor(e){this.options=e||Ts,this.options.renderer=this.options.renderer||new Zc,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Qc}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},el=class{options;block;constructor(e){this.options=e||Ts}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?Xc.lex:Xc.lexInline}provideParser(e=this.block){return e?$c.parse:$c.parseInline}},tl=new class{defaults=ws();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=$c;Renderer=Zc;TextRenderer=Qc;Lexer=Xc;Tokenizer=Yc;Hooks=el;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 Zc(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 Yc(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 el;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];el.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async&&el.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 Xc.lex(e,t??this.defaults)}parser(e,t){return $c.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?Xc.lex:Xc.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?$c.parse:$c.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?Xc.lex:Xc.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?$c.parse:$c.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+=`
67
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Bc(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return tl.parse(e,t)}$.options=$.setOptions=function(e){return tl.setOptions(e),$.defaults=tl.defaults,Es($.defaults),$},$.getDefaults=ws,$.defaults=Ts,$.use=function(...e){return tl.use(...e),$.defaults=tl.defaults,Es($.defaults),$},$.walkTokens=function(e,t){return tl.walkTokens(e,t)},$.parseInline=tl.parseInline,$.Parser=$c,$.parser=$c.parse,$.Renderer=Zc,$.TextRenderer=Qc,$.Lexer=Xc,$.lexer=Xc.lex,$.Tokenizer=Yc,$.Hooks=el,$.parse=$,$.options,$.setOptions,$.use,$.walkTokens,$.parseInline,$c.parse,Xc.lex,$.setOptions({gfm:!0,breaks:!0});function nl(e){let t=$.parse(e,{async:!1});return Cs.sanitize(t,{ADD_ATTR:[`target`,`rel`]})}var rl=i(`<div></div>`);function il(e,t){E(t,!0);let n=A(t,`className`,3,``),r=C(()=>nl(t.content));var i=rl();D(i,()=>p(r),!0),k(i),V(e=>P(i,1,e),[()=>se(U(`chat-markdown`,n()))]),v(e,i),j()}var al=i(`<p class="border-border absolute right-3 bottom-14 max-w-[min(20rem,calc(100%-1.5rem))] rounded-lg border bg-black/80 px-3 py-2 text-xs text-amber-100 shadow-lg backdrop-blur-sm" role="alert"> </p>`),ol=i(`<div class="bg-background/92 fixed inset-0 z-50 flex items-center justify-center px-3 py-4 sm:px-6 sm:py-12" role="presentation"><div class="relative inline-flex max-h-full max-w-full outline-none" role="dialog" aria-modal="true" tabindex="-1"><img class="border-border block max-h-[calc(100dvh-2rem)] max-w-full rounded-2xl border object-contain sm:max-h-[calc(100dvh-6rem)]"/> <div class="absolute right-3 bottom-3 flex items-center gap-2"><button type="button"><!></button> <button type="button"><!></button></div> <span class="sr-only" aria-live="polite"> </span> <!></div></div>`);function sl(e,t){E(t,!0);let i=x(null),c=x(!1),u=x(!1),d=x(!1),f=x(null),m=x(null),h=null,g=0,_={"image/jpeg":`jpg`,"image/png":`png`,"image/gif":`gif`,"image/webp":`webp`};function S(e){let t=e.name.trim()||`image`,n=_[e.mediaType];if(!n)return t;let r=t.match(/\.([a-z0-9]{2,5})$/i);return r?(e.mediaType===`image/jpeg`?[`jpg`,`jpeg`]:[n]).includes(r[1].toLowerCase())?t:`${t.slice(0,-r[0].length)}.${n}`:`${t}.${n}`}n(()=>{if(g+=1,!t.image)return;l(c,!1),l(u,!1),l(d,!1),l(f,null),l(m,null);let e=document.activeElement instanceof HTMLElement?document.activeElement:null,n=!1;o().then(()=>{n||p(i)?.focus()});let r=document.body.style.overflow;document.body.style.overflow=`hidden`;function a(e){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),t.onClose();return}if(e.key!==`Tab`||!p(i))return;let n=Array.from(p(i).querySelectorAll(`button:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>!e.hasAttribute(`hidden`));if(n.length===0){e.preventDefault(),p(i).focus();return}let r=n[0],a=n[n.length-1],o=document.activeElement;e.shiftKey&&(o===p(i)||o===r||!p(i).contains(o))?(e.preventDefault(),a.focus()):!e.shiftKey&&(o===p(i)||o===a||!p(i).contains(o))&&(e.preventDefault(),r.focus())}return window.addEventListener(`keydown`,a,!0),()=>{n=!0,window.removeEventListener(`keydown`,a,!0),document.body.style.overflow=r,h!==null&&(window.clearTimeout(h),h=null),e?.isConnected&&e.focus()}});async function w(e){let t=await fetch(e.url);if(!t.ok)throw Error(`Fetch failed with status ${t.status}`);return t.blob()}async function T(e){if(e.type===`image/png`)return e;let t=await createImageBitmap(e);try{let e=document.createElement(`canvas`);e.width=t.width,e.height=t.height;let n=e.getContext(`2d`);if(!n)throw Error(`Canvas 2D context unavailable`);return n.drawImage(t,0,0),await new Promise((t,n)=>{e.toBlob(e=>e?t(e):n(Error(`PNG encoding failed`)),`image/png`)})}finally{t.close()}}async function D(e){if(p(u))return;let t=g;l(u,!0),l(f,null),l(m,null);try{if(typeof ClipboardItem>`u`)throw Error(`Clipboard images unsupported`);let n=w(e).then(T);if(await navigator.clipboard.write([new ClipboardItem({"image/png":n})]),t!==g)return;l(c,!0),h!==null&&window.clearTimeout(h),h=window.setTimeout(()=>{l(c,!1),h=null},2e3)}catch{t===g&&(l(c,!1),l(f,`Could not copy the image to the clipboard.`))}finally{t===g&&l(u,!1)}}async function ee(e){if(p(d))return;let t=g;l(d,!0),l(f,null),l(m,null);try{let n=await w(e);if(t!==g)return;let r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=S(e),document.body.append(i);try{i.click()}finally{i.remove(),window.setTimeout(()=>URL.revokeObjectURL(r),1e4)}}catch{t===g&&l(m,`Could not download the image.`)}finally{t===g&&l(d,!1)}}let te=`inline-flex size-9 items-center justify-center rounded-lg border border-white/15 bg-black/65 text-white shadow-lg backdrop-blur-sm transition hover:bg-black/80 focus-visible:ring-2 focus-visible:ring-white/50 focus-visible:outline-none aria-disabled:cursor-wait aria-disabled:opacity-60`;var ne=a(),re=b(ne),ie=e=>{let n=C(()=>t.image);var a=ol(),o=y(a),h=y(o),g=s(h,2),_=y(g);P(_,1,se(te));var b=y(_),x=e=>{Kt(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},S=e=>{bt(e,{class:`size-4`,"aria-hidden":`true`})},w=e=>{Et(e,{class:`size-4`,"aria-hidden":`true`})};r(b,e=>{p(u)?e(x):p(c)?e(S,1):e(w,-1)}),k(_);var T=s(_,2);P(T,1,se(te));var E=y(T),ne=e=>{Kt(e,{class:`size-4 animate-spin`,"aria-hidden":`true`})},re=e=>{At(e,{class:`size-4`,"aria-hidden":`true`})};r(E,e=>{p(d)?e(ne):e(re,-1)}),k(T),k(g);var ie=s(g,2),A=y(ie,!0);k(ie);var j=s(ie,2),ae=e=>{var t=al(),n=y(t,!0);k(t),V(()=>z(n,p(f)??p(m))),v(e,t)};r(j,e=>{(p(f)||p(m))&&e(ae)}),k(o),ue(o,e=>l(i,e),()=>p(i)),k(a),V(()=>{O(o,`aria-label`,`Image preview: ${p(n).name??``}`),O(h,`src`,p(n).url),O(h,`alt`,p(n).name),O(_,`aria-disabled`,p(u)),O(_,`aria-label`,p(u)?`Copying image`:p(c)?`Image copied`:`Copy image`),O(_,`title`,p(u)?`Copying image`:p(c)?`Image copied`:`Copy image`),O(T,`aria-disabled`,p(d)),O(T,`aria-label`,p(d)?`Downloading image`:`Download image`),O(T,`title`,p(d)?`Downloading image`:`Download image`),z(A,p(u)?`Copying image`:p(c)?`Image copied`:p(d)?`Downloading image`:``)}),M(`click`,a,e=>{e.target===e.currentTarget&&t.onClose()}),M(`click`,_,()=>void D(p(n))),M(`click`,T,()=>void ee(p(n))),v(e,a)};r(re,e=>{t.image&&e(ie)}),v(e,ne),j()}t([`click`]);var cl=i(`<div class="text-muted-foreground mt-1.5 text-[13px] leading-6 whitespace-pre-wrap"> </div>`),ll=i(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1.5 transition"><!> <span> </span> <!></button> <!></div>`);function ul(e,t){E(t,!0);let i=x(!1),a=x(!1);n(()=>{t.inProgress?l(a,!1):l(i,!1)});let o=C(()=>t.inProgress?!p(a):p(i)),c=C(()=>t.inProgress?`Reasoning`:`Reasoned`);function u(){t.inProgress?l(a,!p(a)):l(i,!p(i))}var d=ll(),f=y(d),m=y(f);gt(m,{class:`size-3.5 shrink-0`,"aria-hidden":`true`});var h=s(m,2),g=y(h,!0);k(h);var _=s(h,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${p(o)?`rotate-90`:``}`);wt(_,{get class(){return p(e)},"aria-hidden":`true`})}k(f);var b=s(f,2),S=e=>{var n=cl(),r=y(n,!0);k(n),V(()=>z(r,t.text)),v(e,n)};r(b,e=>{p(o)&&e(S)}),k(d),V(()=>{O(f,`aria-expanded`,p(o)),z(g,p(c))}),M(`click`,f,u),v(e,d),j()}t([`click`]);var dl=i(`<div class="text-muted-foreground mt-1.5 space-y-1.5 text-[13px] leading-6"></div>`),fl=i(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1.5 transition"><!> <span> </span> <!></button> <!></div>`);function pl(e,t){E(t,!0);let n=x(null),i=C(()=>p(n)??t.defaultExpanded??t.tools.length<=2);function o(){l(n,!p(i))}var c=fl(),u=y(c),d=y(u);{let e=C(()=>`size-3.5 shrink-0 ${t.iconClass??``}`);R(d,()=>t.icon,(t,n)=>{n(t,{get class(){return p(e)},"aria-hidden":`true`})})}var f=s(d,2),m=y(f,!0);k(f);var h=s(f,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${p(i)?`rotate-90`:``}`);wt(h,{get class(){return p(e)},"aria-hidden":`true`})}k(u);var g=s(u,2),_=e=>{var n=dl();fe(n,21,()=>t.tools,e=>e.callId,(e,n)=>{var r=a();B(b(r),()=>t.toolRow,()=>p(n)),v(e,r)}),k(n),v(e,n)};r(g,e=>{p(i)&&e(_)}),k(c),V(()=>{O(u,`aria-expanded`,p(i)),z(m,t.label)}),M(`click`,u,o),v(e,c),j()}t([`click`]);function ml(e){let t=Math.floor(e/60),n=e%60;return t===0?`${n}s`:`${t}m ${n}s`}var hl=i(`<div class="mt-1.5 space-y-2"><!></div>`),gl=i(`<div class="text-muted-foreground text-sm"><button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex items-center gap-1 transition"><span> </span> <!></button> <!></div>`);function _l(e,t){E(t,!0);let i=x(0),a=x(!1),o=x(!1);n(()=>{t.inProgress?l(o,!1):l(a,!1)}),n(()=>{let e=t.startedAtMs;if(t.inProgress){let t=()=>{l(i,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}let n=t.completedAtMs??Date.now();l(i,Math.max(0,Math.floor((n-e)/1e3)),!0)});let c=C(()=>t.inProgress?!p(o):p(a)),u=C(()=>t.inProgress?`Working for ${ml(p(i))}`:`Worked for ${ml(p(i))}`);function d(){t.inProgress?l(o,!p(o)):l(a,!p(a))}var f=gl(),m=y(f),h=y(m),g=y(h,!0);k(h);var _=s(h,2);{let e=C(()=>`size-3.5 shrink-0 transition-transform ${p(c)?`rotate-90`:``}`);wt(_,{get class(){return p(e)},"aria-hidden":`true`})}k(m);var b=s(m,2),S=e=>{var n=hl();B(y(n),()=>t.children),k(n),v(e,n)};r(b,e=>{p(c)&&e(S)}),k(f),V(()=>{O(m,`aria-expanded`,p(c)),z(g,p(u))}),M(`click`,m,d),v(e,f),j()}t([`click`]);var vl=i(`<div role="alert" class="text-destructive mb-6 rounded-2xl border border-rose-500/20 bg-rose-500/10 px-4 py-3 text-sm"> </div>`),yl=i(`<div role="alert" class="mb-6 rounded-2xl border border-amber-500/25 bg-amber-500/10 px-4 py-3 text-sm text-amber-800 dark:text-amber-200"> </div>`),bl=i(`<p class="text-muted-foreground mt-3 text-xs tracking-[0.16em] uppercase"> </p>`),xl=i(`<div class="flex flex-1 items-center justify-center"><div class="max-w-2xl text-center"><p class="text-muted-foreground text-sm leading-7"> </p> <!></div></div>`),Sl=i(`<button type="button" class="border-border hover:border-border focus-visible:ring-ring/40 block size-14 cursor-zoom-in overflow-hidden rounded-xl border transition focus-visible:ring-2 focus-visible:outline-none"><img alt="" loading="lazy" class="size-full object-cover"/></button>`),Cl=i(`<span class="text-muted-foreground inline-flex items-center rounded-xl border border-[var(--hairline)] bg-[var(--hover-fill)] px-3 py-2 text-xs"> </span>`),wl=i(`<li><!></li>`),Tl=i(`<ul class="flex max-w-132 flex-wrap justify-end gap-2" aria-label="Attached images"></ul>`),El=i(`<div><!></div>`),Dl=i(`<button type="button" class="text-muted-foreground hover:text-muted-foreground inline-flex size-6 items-center justify-center rounded-md transition"><!></button>`),Ol=i(`<div class="flex flex-col items-end gap-1.5"><!> <!> <!></div>`),kl=i(`<details class="min-w-0"><summary class="min-w-0 cursor-pointer text-left"><span> </span> <span> </span></summary> <p role="status"> </p></details>`),Al=i(`<p> </p>`),jl=i(`<p class="flex min-w-0 items-start gap-1.5"><!> <span> </span></p>`),Ml=i(`<!> <!>`,1),Nl=i(`<p class="text-muted-foreground text-sm"> </p>`),Pl=i(`<div class="w-full min-w-0" aria-atomic="false" aria-relevant="additions text"><div class="space-y-3"><!> <!> <!></div></div>`),Fl=i(`<div class="space-y-8 pb-14"></div>`),Il=i(`<div class="relative min-h-0 flex-1"><div class="hide-scrollbar h-full overflow-auto [overflow-anchor:none]"><div class="mx-auto flex min-h-full w-full max-w-5xl flex-col px-4 py-8"><!> <!> <!></div></div> <div class="transcript-fade pointer-events-none absolute inset-x-0 bottom-0 h-16"></div></div> <!>`,1);function Ll(e,t){E(t,!0);let i=A(t,`emptyStateMessage`,19,()=>t.workspaceSession?`Start a thread and ask Sprocket to inspect code, edit files, or run project commands.`:`Add a project to begin.`),c=A(t,`emptyStateHint`,3,null),u=x(null),d=x(!0);function m(){let e=p(u);if(!e)return;let t=e.scrollHeight-e.scrollTop-e.clientHeight;l(d,t<=28)}function h(e){return e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function g(e){switch(e){case`apply_patch`:return`Changed Files`;case`check_docs`:return`Checked Docs`;case`exec_command`:return`Ran Commands`;case`get_workspace_instructions`:return`Read Instructions`;case`read_skill`:return`Read Skill`;case`scrape_url`:return`Read Pages`;case`web_search`:return`Searched Web`;case`write_stdin`:return`Monitored Commands`;default:return h(e)}}function _(e){if(!Da(e))return``;let t=[];return typeof e.workdir==`string`&&e.workdir.trim().length>0&&e.workdir!==`.`&&t.push(`cwd ${e.workdir}`),t.length>0?` (${t.join(`, `)})`:``}function S(e,t){let n=Da(t)?t:void 0;switch(e){case`apply_patch`:return te(t)??`Patch`;case`check_docs`:return typeof n?.query==`string`?n.query:typeof n?.path==`string`?n.path:`Docs`;case`exec_command`:return typeof n?.cmd==`string`?`${n.cmd}${_(t)}`:`Command`;case`get_workspace_instructions`:return`Workspace instructions`;case`read_skill`:return typeof n?.name==`string`?`$${n.name}`:`Skill`;case`scrape_url`:return typeof n?.url==`string`?n.url:`Web page`;case`web_search`:return typeof n?.query==`string`?n.query:`Web search`;case`write_stdin`:return typeof n?.sessionId==`string`?`Session ${n.sessionId}`:`Command session`;default:return h(e)}}function w(e){return(e.job?.kind??e.name)===`apply_patch`?`whitespace-pre-wrap [overflow-wrap:anywhere]`:`truncate`}let T=[`*** Add File: `,`*** Copy File: `,`*** Delete File: `,`*** Update File: `],D=[`*** Copy to: `,`*** Move to: `];function ee(e){let t=e.lastIndexOf(` "b/`);if(t>=0)return e.slice(t+4).replace(/"$/,``);let n=e.lastIndexOf(` b/`);return n>=0?e.slice(n+3):null}function te(e){if(!Da(e)||typeof e.patch!=`string`)return null;let t=[];for(let n of e.patch.split(`
68
- `)){if(n.startsWith(`diff --git `)){let e=ee(n);e!==null&&t.push(e);continue}let e=T.find(e=>n.startsWith(e));if(e){t.push(n.slice(e.length).trim());continue}let r=D.find(e=>n.startsWith(e));r&&t.length>0&&(t[t.length-1]=n.slice(r.length).trim())}let n=[...new Set(t)];return n.length>0?n.join(`
69
- `):null}function ne(e){if(!Da(e)||!Array.isArray(e.changes))return null;let t=e.changes.flatMap(e=>Da(e)&&typeof e.path==`string`?[e.path]:[]);return t.length===0?null:[...new Set(t)].join(`
70
- `)}function ie(e){return e.job?.kind===`apply_patch`?ne(e.job.result)??te(e.job.payload):e.name===`apply_patch`?te(e.input):null}function ae(e){return new Set(e.flatMap(e=>ie(e)?.split(`
71
- `)??[])).size}function oe(e,t){if(e===`web_search`&&Da(t)&&Array.isArray(t.results)){let e=t.results.length;return` (${e} result${e===1?``:`s`})`}return e===`scrape_url`&&Da(t)&&t.truncated===!0?` (truncated)`:``}function ce(e,t){return(e.job?.kind??e.name)===`write_stdin`?Ga(e,t)??S(`write_stdin`,e.job?.payload??e.input):e.job?ie(e)||S(e.job.kind,e.job.payload)+oe(e.job.kind,e.job.result):S(e.name,e.input)}function N(e,t,n){let r=ce(e,n);if(Va(e,t))return`${r} (running)`;let i=Ya(e,t);return i?`${r} (${i})`:r}let le=x(null),F=x(null),I=null;async function L(e,t){try{await navigator.clipboard.writeText(t),l(F,e,!0),I!==null&&clearTimeout(I),I=setTimeout(()=>{p(F)===e&&l(F,null),I=null},1500)}catch{l(F,null)}}n(()=>()=>{I!==null&&clearTimeout(I)});function B(){let e=p(u);!e||!p(d)||(e.scrollTop=e.scrollHeight)}n(()=>{t.messages,t.actions,p(d)&&o().then(B)}),n(()=>{let e=p(u);if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{B()});return t.observe(e),()=>{t.disconnect()}});var pe=Il(),me=b(pe),he=y(me),ge=y(he),_e=y(ge),ve=e=>{var n=vl(),r=y(n,!0);k(n),V(()=>z(r,t.currentError)),v(e,n)};r(_e,e=>{t.currentError&&e(ve)});var ye=s(_e,2),H=e=>{var n=yl(),r=y(n,!0);k(n),V(()=>z(r,t.runError)),v(e,n)};r(ye,e=>{t.runError&&e(H)});var be=s(ye,2),xe=e=>{var t=xl(),n=y(t),a=y(n),o=y(a,!0);k(a);var l=s(a,2),u=e=>{var t=bl(),n=y(t,!0);k(t),V(()=>z(n,c())),v(e,t)};r(l,e=>{c()&&e(u)}),k(n),k(t),V(()=>z(o,i())),v(e,t)},Se=e=>{var n=Fl();fe(n,21,()=>t.messages,e=>e._id,(e,n)=>{var i=a(),o=b(i),c=e=>{var t=Ol(),i=y(t),a=e=>{var t=Tl();fe(t,21,()=>p(n).attachments,e=>e.imageUploadId,(e,t)=>{var n=wl(),i=y(n),a=e=>{let n=C(()=>p(t).url);var r=Sl(),i=y(r);k(r),V(()=>{O(r,`aria-label`,`View ${p(t).name??``}`),O(r,`title`,p(t).name),O(i,`src`,p(n))}),M(`click`,r,()=>{l(le,{url:p(n),name:p(t).name,mediaType:p(t).mediaType},!0)}),v(e,r)},o=e=>{var n=Cl(),r=y(n);k(n),V(()=>z(r,`${p(t).name??``} (unavailable)`)),v(e,n)};r(i,e=>{p(t).url?e(a):e(o,-1)}),k(n),v(e,n)}),k(t),v(e,t)};r(i,e=>{p(n).attachments.length&&e(a)});var o=s(i,2),c=e=>{var t=El();P(t,1,se(`user-bubble w-fit max-w-[33rem] rounded-xl border px-5 py-3.5 text-[15.5px] leading-7 text-foreground`));var r=y(t);{let e=C(()=>p(n).text||` `);il(r,{get content(){return p(e)},className:`text-foreground`})}k(t),v(e,t)};r(o,e=>{(p(n).text||!p(n).attachments.length)&&e(c)});var u=s(o,2),d=e=>{var t=Dl(),i=y(t),a=e=>{bt(e,{class:`size-3.5`,"aria-hidden":`true`})},o=e=>{Et(e,{class:`size-3.5`,"aria-hidden":`true`})};r(i,e=>{p(F)===p(n)._id?e(a):e(o,-1)}),k(t),V(()=>O(t,`aria-label`,p(F)===p(n)._id?`Copied`:`Copy message`)),M(`click`,t,()=>{L(p(n)._id,p(n).text)}),v(e,t)};r(u,e=>{p(n).text&&e(d)}),k(t),v(e,t)},u=e=>{let i=C(()=>t.actions.filter(e=>e.runId===p(n).runId)),o=C(()=>Xa(p(n).parts??[],p(i))),c=C(()=>p(o).filter(e=>e.type===`tool`)),l=C(()=>Wa(p(c))),u=C(()=>Ma(p(o))),d=C(()=>Pa(p(u))),f=C(()=>{let{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}=Ra(p(d));return{workIndexBySectionIndex:e,priorCompletedAtByWorkIndex:t}}),m=C(()=>p(n).runId===t.activeRunId&&p(n).runStatus!==`completed`&&p(n).runStatus!==`failed`&&p(n).runStatus!==`cancelled`),h=C(()=>Ka(p(c),p(m))),_=C(()=>p(o).some(e=>e.type===`text`||e.type===`reasoning`));var x=Pl(),S=y(x),T=y(S),E=e=>{{let t=C(()=>p(n).text||`...`);il(e,{get content(){return p(t)},className:`text-foreground`})}};r(T,e=>{!p(_)&&(p(n).text||p(m)&&p(o).length===0)&&e(E)});var D=s(T,2);fe(D,19,()=>p(d),(e,t)=>`${e.type}-${e.type===`work`?e.key:e.id}-${t}`,(e,t,i)=>{var o=a(),c=b(o),u=e=>{{let n=C(()=>p(t).text||` `);il(e,{get content(){return p(n)},className:`text-foreground`})}},_=e=>{let o=C(()=>{let{settledBlocks:e,runningTools:n}=qa(p(t).blocks,p(m),p(h));return{settledBlocks:e,runningTools:n}}),c=C(()=>p(m)&&(p(i)===p(d).length-1||p(o).runningTools.length>0)),u=C(()=>p(f).workIndexBySectionIndex[p(i)]??0),_=C(()=>za(p(t),{inProgress:p(c),workSectionIndex:p(u),runStartedAt:p(n).runStartedAt,runCompletedAt:p(n).runCompletedAt,priorWorkCompletedAtMs:p(f).priorCompletedAtByWorkIndex[p(u)]}));var x=Ml(),S=b(x),T=e=>{_l(e,{get inProgress(){return p(c)},get startedAtMs(){return p(_).startedAtMs},get completedAtMs(){return p(_).completedAtMs},children:(e,t)=>{var n=a();fe(b(n),19,()=>p(o).settledBlocks,(e,t)=>`${e.type}-${e.type===`tool-group`?e.tools.map(e=>e.callId).join(`,`):e.id}-${t}`,(e,t,n)=>{var i=a(),u=b(i),d=e=>{let r=C(()=>p(c)&&p(o).runningTools.length===0&&p(n)===p(o).settledBlocks.length-1);ul(e,{get text(){return p(t).text},get inProgress(){return p(r)}})},f=e=>{{let n=(e,t=re)=>{let n=C(()=>Ya(t(),p(m))),i=C(()=>Ja(t(),p(m))),o=C(()=>ce(t(),p(l)));var c=a(),u=b(c),d=e=>{var r=kl(),a=y(r),c=y(a),u=y(c,!0);k(c);var d=s(c,2),f=y(d);k(d),k(a);var h=s(a,2),g=y(h,!0);k(h),k(r),V((e,t)=>{O(a,`title`,e),P(c,1,t),z(u,p(o)),P(d,1,se(p(i)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`)),z(f,`(${p(i)??``})`),P(h,1,`mt-1.5 text-xs leading-5 wrap-break-word whitespace-pre-wrap ${p(i)===`failed`?`text-destructive`:`text-amber-800 dark:text-amber-200`}`),z(g,p(n))},[()=>N(t(),p(m),p(l)),()=>se(w(t()))]),v(e,r)},f=e=>{var n=Al(),r=y(n,!0);k(n),V((e,t)=>{P(n,1,e),O(n,`title`,t),z(r,p(o))},[()=>`min-w-0 ${w(t())}`,()=>N(t(),p(m),p(l))]),v(e,n)};r(u,e=>{p(n)&&p(i)?e(d):e(f,-1)}),v(e,c)},i=C(()=>g(p(t).toolKey)),o=C(()=>Qa(p(t).toolKey)),c=C(()=>p(t).toolKey===`apply_patch`?ae(p(t).tools)<=2:void 0);pl(e,{get label(){return p(i)},get icon(){return p(o)},get tools(){return p(t).tools},get defaultExpanded(){return p(c)},toolRow:n,$$slots:{toolRow:!0}})}};r(u,e=>{p(t).type===`reasoning`?e(d):e(f,-1)}),v(e,i)}),v(e,n)},$$slots:{default:!0}})};r(S,e=>{(p(o).settledBlocks.length>0||p(c)||p(o).runningTools.length>0)&&e(T)});var E=s(S,2),D=e=>{pl(e,{label:`Running`,get icon(){return Kt},iconClass:`animate-spin`,get tools(){return p(o).runningTools},defaultExpanded:!0,toolRow:(e,t=re)=>{let n=C(()=>$a(t())),r=C(()=>ce(t(),p(l)));var i=jl(),a=y(i);R(a,()=>p(n),(e,t)=>{t(e,{class:`text-muted-foreground mt-1.5 size-3 shrink-0`,"aria-hidden":`true`})});var o=s(a,2),c=y(o,!0);k(o),k(i),V(e=>{O(i,`title`,`${p(r)} (running)`),P(o,1,e),z(c,p(r))},[()=>se(w(t()))]),v(e,i)},$$slots:{toolRow:!0}})};r(E,e=>{p(o).runningTools.length>0&&e(D)}),v(e,x)};r(c,e=>{p(t).type===`text`?e(u):e(_,-1)}),v(e,o)});var ee=s(D,2),te=e=>{var t=Nl(),r=y(t);k(t),V(e=>z(r,`Worked for ${e??``}`),[()=>ml(Math.max(0,Math.floor((p(n).runCompletedAt-p(n).runStartedAt)/1e3)))]),v(e,t)};r(ee,e=>{!p(m)&&p(n).runCompletedAt!==void 0&&e(te)}),k(S),k(x),V(()=>{O(x,`role`,p(m)?`log`:void 0),O(x,`aria-live`,p(m)?`polite`:void 0)}),v(e,x)};r(o,e=>{p(n).type===`prompt`?e(c):e(u,-1)}),v(e,i)}),k(n),v(e,n)};r(be,e=>{t.messages.length===0?e(xe):e(Se,-1)}),k(ge),k(he),ue(he,e=>l(u,e),()=>p(u)),de(2),k(me),sl(s(me,2),{get image(){return p(le)},onClose:()=>{l(le,null)}}),f(`scroll`,he,m),v(e,pe),j()}t([`click`]);function Rl(e){return e.startsWith(`./`)||e.startsWith(`../`)||e.startsWith(`.\\`)||e.startsWith(`..\\`)||e.startsWith(`/`)||e.startsWith(`~/`)||e===`~`||/^[a-zA-Z]:[\\/]/.test(e)}function zl(e){if(e.endsWith(`/`)||e.endsWith(`\\`))return e;let t=e.lastIndexOf(`/`),n=e.lastIndexOf(`\\`),r=Math.max(t,n);return r<0?e:e.slice(0,r+1)}function Bl(e){let t=zl(e);return e.slice(t.length)}function Vl(e,t){let n=e.includes(`\\`)?`\\`:`/`;return`${zl(e)}${t}${n}`}function Hl(e){return/[\\/]$/.test(e)}function Ul(e){return e.replace(/[\\/]+$/,``)}function Wl(e){if(!e.leaf)return;let t=e.browseEntries.find(t=>t.name!==`..`&&t.name===e.leaf);if(t)return t.fullPath;if(e.browseParentPath){let t=e.browseParentPath.split(/[/\\]/).filter(Boolean).at(-1);if(t&&t.toLowerCase()===e.leaf.toLowerCase())return e.browseParentPath}}function Gl(e){let t=e.query.trim();return t?Hl(t)?e.browseParentPath||Ul(t):Wl({leaf:Bl(t),browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})??t:``}function Kl(e){let t=e.query.trim();if(!t||Hl(t))return!1;let n=Bl(t);return n?Wl({leaf:n,browseParentPath:e.browseParentPath,browseEntries:e.browseEntries})===void 0:!1}var ql=i(`<p class="text-muted-foreground px-2 pb-1 text-[11px]">Reconnect <span class="text-muted-foreground"> </span> to a local directory</p>`),Jl=i(`<button type="button" class="text-muted-foreground hover:text-foreground rounded-md px-2 py-0.5 text-[11px] transition hover:bg-[var(--hover-fill)]"> </button>`),Yl=i(`<div class="flex flex-wrap gap-1.5 border-b border-[var(--hairline)] px-3 py-2"></div>`),Xl=i(`<p class="text-muted-foreground px-3 py-8 text-center text-sm"> </p>`),Zl=i(`<button type="button" role="option"><!> <span class="truncate"> </span></button>`),Ql=i(`<p class="text-destructive border-t border-rose-500/20 bg-rose-500/10 px-3 py-2 text-sm"> </p>`),$l=i(`<div class="bg-overlay fixed inset-0 z-50 flex items-start justify-center px-4 pt-[10vh] backdrop-blur-[2px]" role="presentation"><div class="border-border bg-popover text-foreground flex max-h-[min(32rem,70vh)] w-full max-w-xl min-w-0 flex-col overflow-hidden rounded-2xl border shadow-2xl" role="dialog" aria-modal="true" aria-labelledby="workspace-picker-title" tabindex="-1"><div class="border-b border-[var(--hairline)] px-2.5 py-1.5"><div class="relative flex items-center"><div class="text-muted-foreground pointer-events-none flex items-center ps-2"><!></div> <input id="workspace-picker-title" class="text-foreground placeholder:text-muted-foreground min-w-0 flex-1 bg-transparent py-2 ps-2 pe-28 text-sm outline-none" placeholder="Enter project path (e.g. ~/projects/my-robot)" autocomplete="off"/> <!> <button type="button" class="border-border text-foreground absolute inset-e-2 top-1/2 -translate-y-1/2 rounded-md border bg-[var(--hover-fill)] px-2 py-1 text-[12px] transition hover:bg-[var(--hover-fill-strong)] disabled:cursor-not-allowed disabled:opacity-40"> </button></div> <!></div> <!> <div class="min-h-0 flex-1 overflow-y-auto py-1" role="listbox" aria-label="Directories"><!></div> <!> <footer class="text-muted-foreground flex items-center justify-between gap-3 border-t border-[var(--hairline)] px-3 py-2 text-[11px]"><div class="flex flex-wrap items-center gap-3"><span>↑↓ Navigate</span> <span> </span> <span>Esc Close</span></div> <button type="button" class="text-muted-foreground hover:text-foreground transition">Cancel</button></footer></div></div>`);function eu(e,t){E(t,!0);let i=A(t,`mode`,3,`add`),o=A(t,`recentWorkspaces`,19,()=>[]),c=x(`~/`),d=x(u([])),f=x(``),m=x(null),h=x(!1),g=x(!1),_=x(null),S=0,w=x(!1),T=C(()=>Bl(p(c)).toLowerCase()),D=C(()=>{let e=p(T).startsWith(`.`);return p(d).filter(t=>t.name.toLowerCase().startsWith(p(T))&&(e||!t.name.startsWith(`.`)))}),te=C(()=>p(c).trim()),ne=C(()=>Gl({query:p(c),browseParentPath:p(f),browseEntries:p(d)})),re=C(()=>Kl({query:p(c),browseParentPath:p(f),browseEntries:p(d)})),ie=C(()=>p(ne).length>0&&(Rl(p(te))||p(f).length>0)),ae=C(()=>p(re)?`Create & add`:`Add`),oe=C(()=>{if(p(D).length>0)return p(D);let e=Bl(p(c)).replace(/[\\/]+$/,``);if(!e||p(T).length===0)return p(D);let t=p(f).split(/[/\\]/).filter(Boolean).at(-1);return t&&t.toLowerCase()===e.toLowerCase()?[{name:t,fullPath:p(f)}]:p(D)}),se=C(()=>p(h)?`Loading directories…`:p(ne).length>0&&!p(re)?`Press Enter to add this directory.`:p(re)?`Press Enter to create and add this directory.`:`No matching directories in this path.`);n(()=>{if(!t.open){l(w,!1);return}p(w)||(l(w,!0),l(c,`~/`),l(m,null),l(_,null),ce(p(c)))}),n(()=>{if(!t.open||!p(w))return;let e=p(c),n=window.setTimeout(()=>{ce(e)},180);return()=>{window.clearTimeout(n)}});async function ce(e){let n=++S;l(h,!0);try{let r=await t.desktopApi.browseFilesystem({partialPath:e.trim().length>0?e:`~/`});if(n!==S)return;l(f,r.parentPath,!0),l(d,r.entries,!0),l(_,null)}catch(e){if(n!==S)return;l(_,e instanceof Error?e.message:`Failed to browse directories.`,!0)}finally{n===S&&l(h,!1)}}function N(e){if(e.name===`..`){l(c,`${e.fullPath}/`),l(m,e.fullPath,!0);return}l(c,Vl(p(f).endsWith(`/`)||p(f).endsWith(`\\`)?p(f):`${p(f)}/`,e.name),!0),l(m,e.fullPath,!0)}function le(e){l(c,`${e.workspacePath}/`),l(m,e.workspacePath,!0)}async function F(){let e=p(ne);if(!e){l(_,`Enter a project directory path.`);return}l(g,!0),l(_,null);try{let n=await t.desktopApi.resolveWorkspacePath({workspacePath:e,createIfMissing:p(re)});if(i()===`reconnect`&&t.expectedWorkspaceName&&n.workspaceName!==t.expectedWorkspaceName){l(_,`Selected project must be named "${t.expectedWorkspaceName}" to reconnect.`);return}await t.onSelect({workspacePath:n.workspacePath,workspaceName:n.workspaceName}),t.onClose()}catch(e){l(_,e instanceof Error?e.message:`Failed to open the selected project.`,!0)}finally{l(g,!1)}}function I(e){if(e.key===`Escape`){e.preventDefault(),t.onClose();return}e.key===`Enter`&&!e.shiftKey&&p(ie)&&!p(g)&&(e.preventDefault(),F())}var ue=a(),R=b(ue),B=e=>{var n=$l(),u=y(n),d=y(u),f=y(d),x=y(f);Rt(y(x),{class:`size-4`}),k(x);var S=s(x,2);L(S),O(S,`spellcheck`,!1);var C=s(S,2),w=e=>{Kt(e,{class:`text-muted-foreground pointer-events-none absolute inset-e-24 top-1/2 size-4 -translate-y-1/2 animate-spin`})};r(C,e=>{p(h)&&e(w)});var T=s(C,2),E=y(T,!0);k(T),k(f);var D=s(f,2),te=e=>{var n=ql(),r=s(y(n)),i=y(r,!0);k(r),de(),k(n),V(()=>z(i,t.expectedWorkspaceName)),v(e,n)};r(D,e=>{i()===`reconnect`&&t.expectedWorkspaceName&&e(te)}),k(d);var ne=s(d,2),re=e=>{var t=Yl();fe(t,21,o,e=>e.workspacePath,(e,t)=>{var n=Jl(),r=y(n,!0);k(n),V(()=>z(r,p(t).workspaceName)),M(`click`,n,()=>{le(p(t))}),v(e,n)}),k(t),v(e,t)};r(ne,e=>{o().length>0&&e(re)});var A=s(ne,2),j=y(A),ce=e=>{var t=Xl(),n=y(t,!0);k(t),V(()=>z(n,p(se))),v(e,t)},ue=e=>{var t=a();fe(b(t),17,()=>p(oe),e=>e.fullPath,(e,t)=>{var n=Zl(),i=y(n),a=e=>{Ot(e,{class:`text-muted-foreground size-4 shrink-0`})},o=e=>{Bt(e,{class:`text-muted-foreground size-4 shrink-0`})};r(i,e=>{p(t).name===`..`?e(a):e(o,-1)});var c=s(i,2),l=y(c,!0);k(c),k(n),V(()=>{P(n,1,`flex min-h-8 w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition ${p(m)===p(t).fullPath?`text-foreground bg-[var(--hover-fill-strong)]`:`text-muted-foreground hover:text-foreground hover:bg-[var(--hover-fill)]`}`),O(n,`aria-selected`,p(m)===p(t).fullPath),z(l,p(t).name)}),M(`click`,n,()=>{N(p(t))}),v(e,n)}),v(e,t)};r(j,e=>{p(oe).length===0?e(ce):e(ue,-1)}),k(A);var R=s(A,2),B=e=>{var t=Ql(),n=y(t,!0);k(t),V(()=>z(n,p(_))),v(e,t)};r(R,e=>{p(_)&&e(B)});var pe=s(R,2),me=y(pe),he=s(y(me),2),ge=y(he);k(he),de(2),k(me);var _e=s(me,2);k(pe),k(u),k(n),V(()=>{T.disabled=!p(ie)||p(g),z(E,p(g)?`Working…`:p(ae)),z(ge,`Enter ${p(ae)??``}`),_e.disabled=p(g)}),M(`click`,n,e=>{e.target===e.currentTarget&&t.onClose()}),M(`keydown`,u,I),ee(S,()=>p(c),e=>l(c,e)),M(`click`,T,()=>{F()}),M(`click`,_e,function(...e){t.onClose?.apply(this,e)}),v(e,n)};r(R,e=>{t.open&&e(B)}),v(e,ue),j()}t([`click`,`keydown`]);var tu=i(`<div class="text-muted-foreground rounded-3xl border border-dashed border-[var(--hairline)] bg-[var(--hover-fill)] px-4 py-4 text-sm leading-6">Choose a project to start organizing threads.</div>`),nu=i(`<span> </span>`),ru=i(`<span class="rounded-full border border-emerald-500/25 bg-emerald-500/10 px-1.5 py-0.5 text-[10px] text-emerald-800 dark:text-emerald-200"> </span>`),iu=i(`<p class="text-muted-foreground pb-2 text-[12px] leading-5"> </p>`),au=i(`<p class="text-muted-foreground py-1.5 text-[12px]">No threads yet</p>`),ou=i(`<form class="px-1"><input class="border-border text-foreground focus:border-ring h-9 w-full rounded-lg border bg-[var(--hover-fill)] px-2 text-[13px] outline-none" aria-label="Rename thread"/></form>`),su=i(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-amber-300" aria-label="Starting agent"></span>`),cu=i(`<span class="size-1.5 shrink-0 animate-pulse rounded-full bg-emerald-400" aria-label="Thread has an active run"></span>`),lu=i(`<div class="group/thread relative"><button type="button"><!> <span class="truncate"> </span></button> <button type="button"><!></button></div>`),uu=i(`<button type="button" class="text-muted-foreground hover:text-muted-foreground px-2 py-1 text-[12px] transition"> </button>`),du=i(`<div class="space-y-0.5"><!> <!></div>`),fu=i(`<div class="ml-5 border-l border-[var(--hairline)] pl-3"><!> <!></div>`),pu=i(`<section class="space-y-1.5"><div class="group relative flex items-center px-2"><button type="button"><!> <!> <p class="truncate text-[0.88rem] font-medium tracking-[-0.02em]"> </p> <!> <!></button> <button type="button" class="text-muted-foreground hover:text-foreground absolute top-0.5 right-1 inline-flex h-6 w-6 items-center justify-center rounded-md opacity-0 transition group-hover:opacity-100 hover:bg-[var(--hover-fill)] focus-visible:opacity-100 disabled:cursor-not-allowed disabled:opacity-40"><!></button></div> <!></section>`),mu=i(`<div class="space-y-4"></div>`),hu=i(`<div class="bg-tooltip text-tooltip-foreground ring-border pointer-events-none fixed z-100 max-w-64 -translate-y-1/2 rounded-md px-2.5 py-1.5 text-[12px] leading-4 shadow-lg ring-1" role="tooltip"> </div>`),gu=i(`<div data-thread-context-menu="" class="bg-popover text-popover-foreground fixed z-110 min-w-36 rounded-lg border border-[var(--hairline)] py-1 shadow-xl" role="menu"><button type="button" class="text-foreground hover:text-foreground flex w-full px-3 py-1.5 text-left text-[13px] transition hover:bg-[var(--hover-fill)]" role="menuitem">Rename</button></div>`),_u=i(`<aside class="app-sidebar-panel"><div class="flex h-full min-h-0 flex-col overflow-hidden"><header class="flex items-center justify-between gap-2 px-3.5 pt-3 pb-4"><!> <!></header> <div class="px-3.5 pb-1"><button type="button"><!> <span class="truncate">Add project</span></button></div> <div class="hide-scrollbar min-h-0 flex-1 overflow-y-auto px-2.5 py-3"><div class="mb-3 px-2"><p class="text-muted-foreground text-[10px] tracking-[0.24em] uppercase">Projects</p></div> <!></div> <div class="px-3.5 pt-2 pb-4"><button type="button"><!> Settings</button></div></div></aside> <!> <!>`,1);function vu(e,t){E(t,!0);let i=A(t,`pendingAgentLaunches`,19,()=>({})),o=`flex h-9 w-full min-w-0 items-center gap-2.5 rounded-lg px-2 text-[13px] font-medium tracking-[-0.02em] text-foreground transition hover:bg-[var(--hover-fill)] hover:text-foreground`,c=`size-4 shrink-0 text-muted-foreground`,d=x(u({})),m=x(u({})),h=x(null),g=x(null),_=x(null),S=x(``),w=x(``),T=x(null),D=x(null);n(()=>{!p(_)||!p(T)||(p(T).focus(),p(T).select())}),n(()=>{if(!p(D))return;function e(e){let t=e.target;t instanceof Element&&t.closest(`[data-thread-context-menu]`)||l(D,null)}function t(e){e.key===`Escape`&&l(D,null)}return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t,!0)}});function te(e,t){if(p(_))return;let n=e.currentTarget;if(!(n instanceof HTMLElement))return;let r=n.getBoundingClientRect();l(h,t,!0),l(g,{top:r.top+r.height/2,left:r.right+8},!0)}function re(){l(h,null),l(g,null)}function ie(e){return p(d)[e]??!1}function ae(e){l(d,{...p(d),[e]:!ie(e)},!0)}function oe(e){return p(m)[e]??!1}function ce(e){l(m,{...p(m),[e]:!oe(e)},!0)}function N(e){return e.localWorkspaceAvailability===`unavailable`?`Missing`:e.localWorkspaceAvailability===`unlinked`?`Link`:null}function le(e,t){l(D,null),re(),l(_,e,!0),l(S,t,!0),l(w,t,!0)}function F(){l(_,null),l(S,``),l(w,``)}function I(){let e=p(_);if(!e)return;let n=p(S).trim();l(_,null),l(S,``);let r=p(w);l(w,``),!(n.length===0||n===r)&&t.onRenameThread(e,n)}function R(e,t){e.preventDefault(),re(),l(D,{threadId:t.threadId,title:t.title,x:e.clientX,y:e.clientY},!0)}var B=_u(),pe=b(B),me=y(pe),he=y(me),ge=y(he);W(ge,{size:`sm`,class:`min-w-0`}),la(s(ge,2),{get theme(){return t.theme},get onThemeChange(){return t.onThemeChange}}),k(he);var _e=s(he,2),ve=y(_e);P(ve,1,se(o)),It(y(ve),{class:c,"aria-hidden":`true`}),de(2),k(ve),k(_e);var ye=s(_e,2),H=s(y(ye),2),be=e=>{v(e,tu())},xe=e=>{var n=mu();fe(n,21,()=>t.groups,e=>e.key,(e,n)=>{let c=C(()=>N(p(n)));var u=pu(),d=y(u),m=y(d),h=y(m);{let e=C(()=>`text-muted-foreground size-3 shrink-0 transition-transform ${oe(p(n).key)?``:`rotate-90`}`);wt(h,{get class(){return p(e)}})}var g=s(h,2);Bt(g,{class:`text-muted-foreground size-4 shrink-0`});var x=s(g,2),w=y(x,!0);k(x);var E=s(x,2),D=e=>{var t=nu(),r=y(t,!0);k(t),V(()=>{P(t,1,`rounded-full px-1.5 py-0.5 text-[10px] ${p(n).localWorkspaceAvailability===`unavailable`?`border border-amber-500/25 bg-amber-500/10 text-amber-800 dark:text-amber-200`:`border border-sky-500/25 bg-sky-500/10 text-sky-800 dark:text-sky-200`}`),z(r,p(c))}),v(e,t)};r(E,e=>{p(c)&&e(D)});var ne=s(E,2),A=e=>{var t=ru(),r=y(t,!0);k(t),V(()=>z(r,p(n).activeThreadCount)),v(e,t)};r(ne,e=>{p(n).activeThreadCount>0&&e(A)}),k(m);var j=s(m,2),se=y(j),le=e=>{ln(e,{class:`size-4`})},de=e=>{It(e,{class:`size-4`})};r(se,e=>{p(n).localWorkspaceAvailability===`available`?e(le):e(de,-1)}),k(j),k(d);var B=s(d,2),pe=e=>{var c=fu(),u=y(c),d=e=>{var t=iu(),r=y(t,!0);k(t),V(()=>z(r,p(n).localWorkspaceError??(p(n).localWorkspaceAvailability===`unlinked`?`This project needs a local directory attached before you can use it.`:`This project needs to be reconnected.`))),v(e,t)};r(u,e=>{(p(n).localWorkspaceAvailability===`unavailable`||p(n).localWorkspaceAvailability===`unlinked`)&&e(d)});var m=s(u,2),h=e=>{v(e,au())},g=e=>{let c=C(()=>ie(p(n).key)),u=C(()=>p(c)?p(n).threads:p(n).threads.slice(0,3)),d=C(()=>p(n).threads.length>3);var m=du(),h=y(m);fe(h,17,()=>p(u),e=>e.threadId,(e,n)=>{let c=C(()=>Yi(i(),p(n).threadId)),u=C(()=>p(n).threadId===t.currentThreadId),d=C(()=>p(_)===p(n).threadId);var m=a(),h=b(m),g=e=>{var t=ou(),n=y(t);L(n),ue(n,e=>l(T,e),()=>p(T)),k(t),f(`submit`,t,e=>{e.preventDefault(),I()}),M(`keydown`,n,e=>{e.key===`Escape`&&(e.preventDefault(),F())}),f(`blur`,n,()=>{I()}),ee(n,()=>p(S),e=>l(S,e)),v(e,t)},x=e=>{var i=lu(),a=y(i),l=y(a),d=e=>{v(e,su())},m=e=>{v(e,cu())};r(l,e=>{p(c)?e(d):p(n).hasActiveRun&&e(m,1)});var h=s(l,2),g=y(h,!0);k(h),k(a);var _=s(a,2);ct(y(_),{class:`size-3.5`,"aria-hidden":`true`}),k(_),k(i),V(()=>{P(a,1,`${o} pr-8 ${p(u)?`text-foreground bg-[var(--hover-fill)]`:`text-muted-foreground`}`),O(a,`aria-current`,p(u)?`page`:void 0),z(g,p(n).title),P(_,1,`text-muted-foreground hover:text-foreground absolute top-1.5 right-1 inline-flex h-6 w-6 items-center justify-center rounded-md transition hover:bg-[var(--hover-fill)] focus-visible:opacity-100 ${p(u)?`opacity-100`:`opacity-0 group-focus-within/thread:opacity-100 group-hover/thread:opacity-100`}`),O(_,`aria-label`,`Archive ${p(n).title}`)}),f(`mouseenter`,a,e=>{te(e,p(n).title)}),f(`mouseleave`,a,re),f(`focus`,a,e=>{te(e,p(n).title)}),f(`blur`,a,re),M(`contextmenu`,a,e=>{R(e,p(n))}),M(`click`,a,()=>{t.onSelectThread(p(n))}),M(`click`,_,e=>{e.stopPropagation(),re(),t.onArchiveThread(p(n).threadId)}),v(e,i)};r(h,e=>{p(d)?e(g):e(x,-1)}),v(e,m)});var g=s(h,2),x=e=>{var t=uu(),r=y(t,!0);k(t),V(()=>z(r,p(c)?`Show less`:`Show more`)),M(`click`,t,()=>{ae(p(n).key)}),v(e,t)};r(g,e=>{p(d)&&e(x)}),k(m),v(e,m)};r(m,e=>{p(n).threads.length===0?e(h):e(g,-1)}),k(c),v(e,c)},me=C(()=>!oe(p(n).key));r(B,e=>{p(me)&&e(pe)}),k(u),V(e=>{P(m,1,`flex min-w-0 flex-1 items-center gap-2 rounded-xl px-2 py-1 pr-8 text-left transition ${p(n).workspaceName===t.currentWorkspaceName?`text-foreground`:`text-muted-foreground hover:text-foreground`}`),O(m,`aria-label`,e),z(w,p(n).workspaceName),O(j,`aria-label`,p(n).localWorkspaceAvailability===`available`?`Create thread in ${p(n).workspaceName}`:`Reconnect ${p(n).workspaceName}`)},[()=>oe(p(n).key)?`Expand ${p(n).workspaceName} threads`:`Collapse ${p(n).workspaceName} threads`]),M(`click`,m,()=>{ce(p(n).key)}),M(`click`,j,()=>{if(p(n).localWorkspaceAvailability===`available`){t.onStartThreadDraft(p(n).workspaceName);return}p(n).workspaceSessionId&&t.onReconnectWorkspace(p(n).workspaceSessionId)}),v(e,u)}),k(n),v(e,n)};r(H,e=>{t.groups.length===0?e(be):e(xe,-1)}),k(ye);var Se=s(ye,2),Ce=y(Se);P(Ce,1,se(o)),sn(y(Ce),{class:c,"aria-hidden":`true`}),de(),k(Ce),k(Se),k(me),k(pe);var we=s(pe,2),Te=e=>{var t=hu(),n=y(t,!0);k(t),V(()=>{ne(t,`top: ${p(g).top}px; left: ${p(g).left}px;`),z(n,p(h))}),v(e,t)};r(we,e=>{p(h)&&p(g)&&!p(D)&&!p(_)&&e(Te)});var Ee=s(we,2),De=e=>{var t=gu(),n=y(t);k(t),V(()=>ne(t,`top: ${p(D).y}px; left: ${p(D).x}px;`)),M(`click`,n,()=>{le(p(D).threadId,p(D).title)}),v(e,t)};r(Ee,e=>{p(D)&&e(De)}),M(`click`,ve,function(...e){t.onChooseWorkspace?.apply(this,e)}),M(`click`,Ce,function(...e){t.onOpenSettings?.apply(this,e)}),v(e,B),j()}t([`click`,`keydown`,`contextmenu`]);function yu(e){return e===`running`||e===`awaiting_executor`}function bu(e,t){return yu(e.status)?e.claimExpiresAt!==void 0&&e.claimExpiresAt>t:!1}function xu(e){let t=e.recoveredSubmission,n=e.latestRun;return(n===null||n.submissionId===t?.submissionId&&!$r(n.status))&&t?.prompt===e.prompt&&t.selectedModel===e.selectedModel&&t.reasoningEffort===e.reasoningEffort&&t.serviceTier===e.serviceTier&&ui(t.imageUploadIds,e.imageUploadIds)?t.submissionId:e.newSubmissionId}function Su(e){return e.submissionRunStatus&&$r(e.submissionRunStatus)?e.freshSubmissionId:e.threadSubmissionId}function Cu(e,t){return e?e.status===`queued`||bu(e,t):!1}function wu(e){e.desktopApi.runAgent({authToken:e.authToken,threadId:e.threadId,prompt:e.prompt,imageUploadIds:e.imageUploadIds,selectedModel:e.selectedModel,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,submissionId:e.submissionId,workspaceSessionId:e.workspaceSessionId}).then(({runId:t})=>{e.onStarted(t)}).catch(t=>{console.error(`Failed to run agent`,t),e.onError(t)})}function Tu(e){return Object.fromEntries(e.map(e=>[e.workspaceSessionId,e]))}async function Eu(e){return e?Tu(await e.listWorkspaceSessions()):{}}async function Du(e){return await e.desktopApi.attachWorkspaceSession({workspaceSessionId:e.workspaceSessionId,workspacePath:e.workspacePath})}function Ou(e,t){let n=new Set(t);return e.filter(e=>e.availability===`available`&&n.has(e.workspaceSessionId)).map(e=>e.workspaceSessionId)}var ku=class extends Error{constructor(){super(`Pending task was canceled.`),this.name=`LatestTaskQueueCancelledError`}};function Au(e){let t=null,n=!1;async function r(){if(!n){n=!0;try{for(;t;){let n=t;t=null;try{await e(n.value),n.resolve()}catch(e){n.reject(e)}}}finally{n=!1,t&&r()}}}return{enqueue(e){if(t)return t.value=e,t.promise;let n,i,a=new Promise((e,t)=>{n=e,i=t});return t={value:e,promise:a,resolve:n,reject:i},r(),a},cancelPending(){if(!t)return;let e=t;t=null,e.reject(new ku)}}}async function ju(e){if(e.desktopApi)try{let t=(await e.desktopApi.listWorkspaceSessions()).find(t=>t.workspaceSessionId===e.workspaceSessionId);if(!t||t.availability!==`available`)throw Error(t?.unavailableReason??`Workspace path is unavailable.`);await e.refreshDesktopWorkspaceSessions()}catch(t){throw await e.refreshDesktopWorkspaceSessions(),t}}function Mu(e,t){if(e.runStartedAt!==t.runStartedAt)return e.runStartedAt-t.runStartedAt;let n=e._creationTime??0,r=t._creationTime??0;return n===r?e.type===t.type?e._id.localeCompare(t._id):e.type===`prompt`?-1:1:n-r}function Nu(e,t=40){if(e.length<=t)return e;let n=0;for(;e.length-n>t;){let t=e[n]?.runId;if(!t){n+=1;continue}for(;n<e.length&&e[n]?.runId===t;)n+=1}let r=e.slice(n);return r.length>t?r.slice(-t):r}function Pu(e){let t=new Map;for(let n of e.historyMessages??[])t.set(n._id,n);for(let n of e.liveMessages??[])t.set(n._id,n);return Nu([...t.values()].sort(Mu))}var Fu=i(`<a class="bg-primary text-primary-foreground inline-flex h-10 items-center justify-center rounded-full px-5 text-sm font-medium transition hover:opacity-90">Open pairing</a>`),Iu=i(`<div class="bg-background h-screen overflow-hidden"><!> <!></div>`),Lu=i(`<!> <!>`,1),Ru=i(`<div class="h-screen overflow-hidden"><div class="app-workspace-shell grid h-screen grid-cols-[292px_minmax(0,1fr)] overflow-hidden"><!> <main class="flex h-screen min-h-0 min-w-0 flex-col overflow-hidden"><!></main></div> <!></div>`);function zu(t,i){E(i,!0);let o=()=>te(ye,`$authState`,f),d=()=>te(me,`$convexAuthRetryPending`,f),[f,m]=e(),h=De(),_=x(!1),S=C(()=>!!o().user),w=C(d),T=C(()=>o().isReady&&!o().isLoading&&p(S)&&!h.isLoading&&h.isAuthenticated),D=C(()=>p(S)&&o().isReady&&!o().isLoading&&!p(w)&&!h.isLoading&&!h.isAuthenticated);n(()=>{let e=Se({retryPending:p(w),isAuthenticated:h.isAuthenticated,isLoading:h.isLoading,sawLoadingDuringRetry:p(_)});p(_)!==e.sawLoadingDuringRetry&&l(_,e.sawLoadingDuringRetry,!0),e.clearPending&&me.set(!1)});let ee=Te(H.workspaceSessions.upsertSelected),ne=Te(H.threads.create),re=Te(H.threads.rename),A=Te(H.threads.archive),M=Te(H.threads.restore),ae=Te(H.agentRuntime.finalizeRun),oe=Te(H.uiPreferences.setLastThread),se=Te(H.uiPreferences.setTheme),N=Te(H.imageUploads.generateUploadUrl),P=Te(H.imageUploads.register),le=Te(H.imageUploads.discard),F=Te(H.workspaceSessions.heartbeatAttached),I=Te(H.billing.ensureMySubscription),ue=we(H.modelCatalog.get,()=>({})),L=C(()=>ue.data),de=null;n(()=>{if(!p(T))return;let e=ht();!e||de===e||(de=e,I({}).catch(()=>{}))});let R=`Connect to a running Sprocket server to use this workspace.`,z=3e4,fe=Au(async e=>{await F({clientId:e.clientId,workspaceSessionIds:e.workspaceSessionIds})}),B=x(null),Ee=x(!1),U=x(null),W=x(null),Pe=x(null),Fe=x(u(dr)),G=x(u(fr)),Ie=x(u(pr)),Le=x(``),K=x(u([])),q=x(null),Re=x(null),ze=x(0),Be=new $e,Ve=new $e,He=new $e,Ue=new $e,We=new Qe,Ge=x(u({})),J=x(0),Ke=x(null),qe=0,Je=0,Y=x(!1),Ye=x(null),Xe=x(null),Ze=null,tt=x(0),nt=x(null),rt=x(u({})),it=x(!1),at=0,ot=x(null),X=x(!1),st=x(`add`),ct=x(void 0),lt=x(null),ut=x(!1),dt=x(`account`),ft=x(u([])),pt=x(!1),mt=x(!1);function ht(){return o().user?.id??null}let gt=new $e,_t=null;function vt(e,t){return p(K).find(t=>t.localId===e)?(l(K,p(K).map(n=>n.localId===e?{...n,...t}:n),!0),!0):!1}async function yt(e,t,n){try{let r=await N({}),i=await fetch(r,{method:`POST`,headers:{"Content-Type":t.type},body:t});if(!i.ok)throw Error(`Upload failed (${i.status}).`);let{storageId:a}=await i.json(),o=await P({storageId:a,name:n});if(`error`in o)throw Error(o.error);let s=p(K).find(t=>t.localId===e);s&&URL.revokeObjectURL(s.previewUrl),vt(e,{status:`ready`,imageUploadId:o.imageUploadId,previewUrl:o.url})||le({imageUploadId:o.imageUploadId}).catch(()=>{})}catch(t){let n=t instanceof Error?t.message:`Upload failed.`;vt(e,{status:`error`,error:n}),l(q,n,!0)}}function bt(e){for(let t of e){let e=pi(p(K).length,t);if(e){l(q,e,!0);continue}let n=crypto.randomUUID(),r=t.name||`Pasted image`;l(K,[...p(K),{localId:n,name:r,mediaType:t.type,size:t.size,previewUrl:URL.createObjectURL(t),status:`uploading`}],!0),yt(n,t,r)}}function xt(e){let t=p(K).find(t=>t.localId===e);t&&(URL.revokeObjectURL(t.previewUrl),l(K,p(K).filter(t=>t.localId!==e),!0),t.imageUploadId&&le({imageUploadId:t.imageUploadId}).catch(()=>{}))}function St(e){for(let t of p(K))URL.revokeObjectURL(t.previewUrl),e.discard&&t.imageUploadId&&le({imageUploadId:t.imageUploadId}).catch(()=>{});l(K,[],!0)}function Ct(e,t){return e?`thread:${e}`:t?`draft:${t}`:null}function wt(e,t){Be.get(e)===t&&Be.delete(e)}function Tt(e,t){return`${e}\0${t}`}function Et(e,t,n){Ve.set(Tt(e,t),n)}function Dt(e,t){let n=Tt(e,t);Ve.delete(n),He.delete(n)}function Ot(){return o().user&&h.isAuthenticated&&!h.isLoading?{}:`skip`}let kt=we(H.workspaceSessions.listMine,Ot),At=we(H.threads.listMine,Ot),jt=we(H.uiPreferences.getMine,Ot),Mt=x(u(ke(null))),Nt=!1,Pt,Ft=null,It=0;n(()=>{if(!p(T)){Nt=!1,Pt=void 0,Ft=null,It=0;return}let e=jt.data;if(e===void 0||Ft!==null)return;let t=e?.theme;if(Nt&&t===Pt)return;Nt=!0,Pt=t;let n=ke(t);l(Mt,n,!0),Oe(n)});async function Lt(e){let t=p(Mt),n=++It;Ft=e,l(Mt,e,!0),Oe(e);try{if(await se({theme:e}),n!==It)return;Pt=e}catch(e){if(n!==It)return;l(Mt,t,!0),Oe(t),l(q,e instanceof Error?e.message:`Failed to save theme preference.`,!0)}finally{n===It&&(Ft=null)}}let Rt=()=>p(W)&&Ot()!==`skip`?{threadId:p(W)}:`skip`,zt=we(H.threads.getByThreadId,Rt),Bt=we(H.messages.listHistoryForThread,Rt),Vt=we(H.messages.listLiveForThread,Rt),Ht=we(H.chat.latestRunForThread,Rt),Ut=C(()=>{for(let e of[ue,kt,At,jt,zt,Bt,Vt,Ht])if(e.error)return e.error;return null}),Wt=C(()=>(kt.data??[]).map(e=>{let t=p(rt)[e._id];return{...e,workspacePath:t?.workspacePath,localWorkspaceAvailability:t?t.availability:`unlinked`,localWorkspaceError:t?.unavailableReason}}));n(()=>{let e=ht();if(_t!==e&&(gt.clear(),_t=e),kt.data!==void 0){gt.clear();for(let e of p(Wt))gt.set(e._id,e.workspaceName)}});let Gt=C(()=>{let e=new Map(p(Wt).map(e=>[e._id,e.workspaceName]));return(At.data??[]).map(t=>{let n=e.get(t.workspaceSessionId)??(kt.data===void 0?gt.get(t.workspaceSessionId):void 0)??`Unknown workspace`;return{...t,workspaceName:n}})}),Kt=C(()=>Ki(zt.data,p(W))),qt=C(()=>{let e=p(L)?gr(p(L),p(Fe))??gr(p(L),p(L).defaultModelId):void 0;return{inputTokens:p(Kt)?.contextTokens??0,totalTokensProcessed:p(Kt)?.totalTokensProcessed??0,contextWindowTokens:e?.contextWindowTokens??0,autoCompactTokenLimit:e?.autoCompactTokenLimit??0}}),Jt=C(()=>Ki(Ht.data,p(W))),Yt=C(()=>Ki(Bt.data,p(W))),Xt=C(()=>Ki(Vt.data,p(W))),Zt=C(()=>!p(Yt)||!p(Xt)?[]:Pu({historyMessages:p(Yt).messages,liveMessages:p(Xt).messages})),Qt=C(()=>p(U)?Bi(p(Wt),p(U)):null),$t=C(()=>p(Qt)?._id??null),en=C(()=>{let e=p(Qt)?.workspacePath??null,t=p(B);return{workspacePath:e,load:async()=>{if(!t||!e)return[];let n=await t.listWorkspaceSkills({workspacePath:e});for(let e of n.warnings)console.warn(`sprocket skills: ${e}`);return n.skills}}}),tn=C(()=>p(U)?p(Gt).filter(e=>e.workspaceName===p(U)&&Vi(e)).sort((e,t)=>t.lastMessageAt-e.lastMessageAt):[]),nn=C(()=>Hi(p(Wt),p(Gt))),rn=C(()=>p(Jt)?.run??null),an=C(()=>(p(Jt)?.jobs??[]).slice(-60)),on=C(()=>Ct(p(W),p($t))),sn=C(()=>p(Ke)&&p(Ke).runId===(p(rn)?._id??null)?p(Ke).serverNow+Math.max(0,p(J)-p(Ke).localObservedAt):p(Jt)?.serverNow??Date.now()),cn=C(()=>{let e=ht();if(!(!e||!p(on)))return He.get(Tt(e,p(on)))}),ln=C(()=>p(rn)?.status===`queued`&&p(cn)?.submissionId===p(rn).submissionId),un=C(()=>Cu(p(rn),p(sn))&&!p(ln)),dn=C(()=>Yi(p(Ge),p(W))),fn=C(()=>Ji({threadId:p(W),pendingCreatedThreadId:p(nt),hasLatestRunData:!!p(Jt)})),pn=C(()=>!!(p(on)&&Be.has(p(on)))),mn=C(()=>!!(p($t)&&p(Qt)?.localWorkspaceAvailability===`available`&&!p(un)&&!p(pn)&&!p(dn)&&p(fn))),hn=C(()=>Ou(Object.values(p(rt)),p(Wt).map(e=>e._id))),gn=C(()=>[...p(hn)].sort().join(`\0`)),_n=C(()=>{let e=new Qe,t=[];for(let n of Object.values(p(rt))){if(n.availability!==`available`||e.has(n.workspacePath))continue;e.add(n.workspacePath);let r=n.workspacePath.split(/[/\\]/).filter(Boolean).at(-1)??n.workspacePath;t.push({workspacePath:n.workspacePath,workspaceName:r})}return t.sort((e,t)=>t.workspaceName.localeCompare(e.workspaceName))});async function vn(){let e=++at,t=await Eu(p(B));e===at&&(l(rt,t,!0),l(it,!0))}function yn(e,t=null,n=!1){l(U,e,!0),l(W,t,!0),l(Pe,n?e:null,!0),t!==p(nt)&&l(nt,null)}function bn(e,t=null,n=!1,r=!1){l(tt,p(tt)+1),r||l(q,null),yn(e,t,n)}async function xn(e,t){if(!p(B))throw Error(R);let n=await Du({desktopApi:p(B),workspaceSessionId:e,workspacePath:t});return at+=1,l(rt,{...p(rt),[n.workspaceSessionId]:n},!0),l(it,!0),n}function Sn(e,t={}){let n=Bi(p(Wt),e);if(!n){l(q,`Choose a workspace first.`);return}bn(e,t.threadId,t.draft);let r=p(tt);kn(n._id).catch(e=>{r===p(tt)&&l(q,e instanceof Error?e.message:`Failed to attach workspace.`,!0)})}function Cn(e=`add`,t=null){if(!p(B)||!p(Re)){l(q,R);return}l(st,e,!0),l(lt,t,!0),l(ct,e===`reconnect`&&t?p(Wt).find(e=>e._id===t)?.workspaceName:void 0,!0),l(X,!0),l(q,null)}async function wn(e){if(!p(B)||!p(Re)){l(q,R);return}let t=ht(),n=p(Re);if(!t){l(q,`User session is not ready.`);return}try{if(p(st)===`reconnect`&&p(lt)){let n=p(Wt).find(e=>e._id===p(lt));if(!n){l(q,`Workspace session not found.`);return}if(await xn(p(lt),e.workspacePath),ht()!==t)return;bn(n.workspaceName,p(W)),l(q,null);return}await Tn(e,t,n)}catch(e){if(ht()!==t)return;throw l(q,e instanceof Error?e.message:`Failed to attach workspace.`,!0),e}}async function Tn(e,t,n){let r=await ee({workspaceName:e.workspaceName,connectedClientId:n});if(!r)throw Error(`Failed to create or update the workspace session.`);ht()===t&&(await xn(r._id,e.workspacePath),ht()===t&&(bn(r.workspaceName,null,!0),l(q,null)))}function En(e){let t=e?.trim();t&&l(ft,[...p(ft),t],!0)}async function Dn(){let e=window.sprocketDesktopBridge;if(e?.takeWorkspaceLaunch)for(;;){let t=await e.takeWorkspaceLaunch();if(!t)return;En(t)}}async function On(e,t,n,r){let i=await t.resolveWorkspacePath({workspacePath:e});ht()===n&&await Tn(i,n,r)}async function kn(e){await ju({desktopApi:p(B),refreshDesktopWorkspaceSessions:vn,workspaceSessionId:e})}function An(e){Cn(`reconnect`,e)}function jn(e){window.setTimeout(()=>{if(ht()!==e.userId||p(nt)!==e.threadId||p(W)!==e.threadId||p(U)!==e.workspaceName||p(Gt).some(t=>t.threadId===e.threadId))return;l(nt,null),bn(e.workspaceName,null,!0);let t=Ct(null,e.workspaceSessionId);t&&Et(e.userId,t,{message:`The new thread did not appear. Review your prompt and try sending it again.`,prompt:e.prompt,attachments:e.attachments,imageUploadIds:e.imageUploadIds,reasoningEffort:e.reasoningEffort,serviceTier:e.serviceTier,selectedModel:e.selectedModel,submissionId:e.submissionId})},z)}async function Nn(e){let t=await ne({submissionId:e.submissionId,workspaceSessionId:e.workspaceSessionId,selectedModel:hr(e.selectedModel),reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier});return e.isSubmissionCurrent()?(e.userId===ht()&&e.selectionGeneration===p(tt)&&(l(nt,t.threadId,!0),l(tt,p(tt)+1),l(W,t.threadId,!0),l(Pe,null),jn({prompt:e.prompt,attachments:e.attachments,imageUploadIds:e.imageUploadIds,reasoningEffort:e.selectedReasoningEffort,serviceTier:e.selectedServiceTier,selectedModel:e.selectedModel,submissionId:e.submissionId,threadId:t.threadId,userId:e.userId,workspaceName:e.workspaceName,workspaceSessionId:e.workspaceSessionId})),t):null}function Pn(e){Sn(e,{draft:!0})}function Fn(e){Sn(e.workspaceName,{threadId:e.threadId})}async function In(e,t){try{await re({threadId:e,title:t})}catch(e){l(q,e instanceof Error?e.message:`Failed to rename thread.`,!0)}}async function Ln(e){let t=ht();try{await A({threadId:e}),t&&Dt(t,`thread:${e}`),ht()===t&&(p(W)===e&&(l(W,null),l(nt,null),l(tt,p(tt)+1)),p(Xe)===e&&l(Xe,null),l(q,null))}catch(e){if(ht()!==t)return;l(q,e instanceof Error?e.message:`Failed to archive thread.`,!0)}}async function Rn(e){try{await M({threadId:e})}catch(e){l(q,e instanceof Error?e.message:`Failed to restore thread.`,!0)}}async function zn(){if(p(pn)||!p(Le).trim()&&p(K).length===0)return;if(p(K).some(e=>e.status!==`ready`)){l(q,`Wait for image uploads to finish, or remove failed images before sending.`);return}let e=p($t);if(!e){l(q,`Choose a workspace first.`);return}if(!p(B)){l(q,R);return}if(p(W)&&!p(fn)){l(q,`Loading thread state before sending.`);return}if(!p(mn)){l(q,p(un)||p(dn)||p(pn)?`Wait for the current agent launch or run to finish.`:p(Qt)?.localWorkspaceAvailability===`available`?`You need an active workspace session before sending.`:`This workspace needs to be attached before sending.`,!0);return}l(ze,0);let t=p(tt),n=p(W),r=p(U);if(!r){l(q,`Choose a workspace first.`);return}let i=ht();if(!i){l(q,`User session is not ready.`);return}let a=()=>ht()===i,o=p(Le).trim(),s=p(K).map(e=>({...e})),c=s.flatMap(e=>e.imageUploadId?[e.imageUploadId]:[]),u=p(Fe),d=p(G),f=p(Ie),m=n?p(rn)?._id??null:null,h=n?`thread:${n}`:`draft:${e}`,g=h,_=g,v=Tt(i,g),y=He.get(v),b=crypto.randomUUID(),x=xu({latestRun:n?p(rn):null,newSubmissionId:b,prompt:o,imageUploadIds:c,reasoningEffort:d,serviceTier:f,recoveredSubmission:y?{...y,selectedModel:hr(y.selectedModel)}:void 0,selectedModel:hr(u)}),S=x;Dt(i,g);let C=null,w=null,T=++Je,E=Tt(i,g);Ue.set(E,T);let D=()=>Ue.get(E)===T,ee=`Your session changed before the agent started. Return to this account and send the prompt again.`,O=`This request is still preparing. Wait for it to finish before trying again.`,k=e=>{Et(i,_,{message:e,prompt:o,attachments:s,imageUploadIds:c,reasoningEffort:d,serviceTier:f,selectedModel:u,submissionId:!n&&_===g?x:S})},te=()=>{Dt(i,_),a()&&p(q)===O&&l(q,null)},ne=window.setTimeout(()=>{Ue.get(E)===T&&Et(i,_,{message:O,prompt:``})},z);l(Le,``),l(q,null),Be.set(h,T);try{let g=n?null:await Nn({isSubmissionCurrent:D,prompt:o,attachments:s,imageUploadIds:c,selectionGeneration:t,selectedModel:u,selectedReasoningEffort:d,selectedServiceTier:f,submissionId:x,userId:i,workspaceName:r,workspaceSessionId:e}),v=n??g?.threadId??null;if(!v||!D())return;if(g&&(S=Su({freshSubmissionId:b,submissionRunStatus:g.submissionRunStatus,threadSubmissionId:x})),!a()){k(ee);return}C=v,n||(wt(h,T),h=`thread:${v}`,Be.set(h,T),te(),Ue.get(E)===T&&Ue.delete(E),_=`thread:${v}`,E=Tt(i,_),Ue.set(E,T));let y=await xe({forceRefreshToken:!0});if(!y){k(`Your session ended before the agent started. Sign in again.`);return}if(!D())return;if(!a()){k(ee);return}te();let O=++qe;w=O,l(Ge,Xi(p(Ge),v,{expiresAt:Date.now()+z,launchId:O,...p(rn)?.claimExpiresAt?{previousClaimExpiresAt:p(rn).claimExpiresAt}:{},previousRunId:m}),!0),window.setTimeout(()=>{let e=p(Gt).find(e=>e.threadId===v)?.latestRunId??null,t=p(W)===v?p(rn)?._id??null:null,n=[e,t].find(e=>e&&e!==m)??e??t,r=p(W)===v&&p(rn)?._id===n?p(rn).claimExpiresAt:p(Gt).find(e=>e.threadId===v)?.latestRunClaimExpiresAt,i=ta(p(Ge),v,O,Date.now(),n,r);i.pendingLaunches!==p(Ge)&&(l(Ge,i.pendingLaunches,!0),i.shouldRecover&&k(`The local agent did not start. Please try again.`))},z),wu({authToken:y,desktopApi:p(B),onError:e=>{if(!D()||!a())return;let t=Zi(p(Ge),v,O);t!==p(Ge)&&l(Ge,t,!0),k(e instanceof Error?e.message:`Failed to start the local agent run.`)},onStarted:e=>{!D()||!a()||(l(Ge,$i(p(Ge),v,e),!0),St({discard:!1}))},threadId:v,prompt:o,imageUploadIds:c,selectedModel:hr(u),submissionId:S,reasoningEffort:d,serviceTier:f,workspaceSessionId:e})}catch(e){if(C&&w!==null&&l(Ge,Zi(p(Ge),C,w),!0),!D())return;if(!a()){k(ee);return}k(e instanceof Error?e.message:`Failed to send prompt.`),vn().catch(()=>{})}finally{window.clearTimeout(ne),wt(h,T),w===null&&Ue.get(E)===T&&Ue.delete(E)}}async function Bn(){if(!(!p(rn)?._id||!p(un)))try{await ae({runId:p(rn)._id,text:``,status:`cancelled`})}catch(e){l(q,e instanceof Error?e.message:`Failed to cancel run.`,!0)}}n(()=>{let e=p(Jt);if(!e){l(Ke,null);return}p(Ke)?.serverNow===e.serverNow&&p(Ke).runId===(e.run?._id??null)||l(Ke,{localObservedAt:window.performance.now(),runId:e.run?._id??null,serverNow:e.serverNow},!0)}),n(()=>{if(!p(rn)||!yu(p(rn).status))return;let e=()=>{l(J,window.performance.now(),!0)};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)}),n(()=>{let e=ht(),t=Ct(p(W),p($t)),n=p(rn);if(!e||!t||!n||!yu(n.status)||p(un)||p(pn)||p(dn)||p(Le)!==``||p(K).length>0||!p(Jt)||!p(Jt).prompt&&!p(Jt).imageUploadIds?.length)return;let r=p(Jt).imageUploadIds??[],i=p(Jt).prompt??``,a=p(Zt).find(e=>e.runId===n._id&&e.type===`prompt`),o=r.flatMap(e=>{let t=a?.attachments.find(t=>t.imageUploadId===e);return t?.url?[t]:[]}),s=r.length-o.length,c=`${e}\0${n._id}\0${n.claimExpiresAt??`none`}`;if(We.has(c))return;We.add(c);let l=o.map(e=>({localId:e.imageUploadId,name:e.name,mediaType:e.mediaType,size:e.size,previewUrl:e.url,status:`ready`,imageUploadId:e.imageUploadId}));Et(e,t,{message:s>0?`The previous agent stopped responding. ${s} image attachment${s===1?` is`:`s are`} unavailable; review and retry this submission.`:`The previous agent stopped responding. Retry to continue this submission.`,prompt:i,attachments:l,imageUploadIds:r,reasoningEffort:n.reasoningEffort,serviceTier:n.serviceTier,selectedModel:n.selectedModel,submissionId:n.submissionId})}),n(()=>{let e=ht();p(ot)!==e&&(l(ot,e,!0),l(Y,!1),l(U,null),l(W,null),l(Pe,null),l(nt,null),l(Ge,{},!0),l(Ye,null),l(Xe,null),de=null,Ze=null,l(tt,p(tt)+1),l(Le,``),St({discard:!0}),l(q,null),l(ze,0),l(Fe,p(L)?.defaultModelId??`gpt-5.6-sol`,!0),l(G,p(L)?.defaultReasoningEffort??fr,!0),l(Ie,p(L)?.defaultServiceTier??`standard`,!0),l(X,!1),l(lt,null),l(ct,void 0))}),n(()=>{let e=p(ft)[0],t=p(B),n=ht(),r=p(Re);!e||p(pt)||!p(T)||!t||!n||!r||kt.data===void 0||(l(ft,p(ft).slice(1),!0),l(pt,!0),l(Y,!0),l(Ye,null),l(X,!1),l(ut,!1),l(q,null),On(e,t,n,r).catch(e=>{ht()===n&&(l(Y,!1),l(q,e instanceof Error?e.message:`Failed to open the requested workspace.`,!0))}).finally(()=>{l(pt,!1)}))}),n(()=>{let e=p(Kt),t=e?._id??null;t!==Ze&&(Ze=t,e&&(l(Fe,e.selectedModel,!0),l(G,e.reasoningEffort,!0),l(Ie,e.serviceTier,!0)))}),n(()=>{let e=ht(),t=Ct(p(W),p($t));if(!e||!t)return;let n=Tt(e,t),r=Ve.get(n);if(!r)return;Ve.delete(n);let i=p(Le)===``;i&&l(Le,r.prompt,!0),p(K).length===0&&r.attachments?.length&&(i||p(Le)===r.prompt)&&l(K,r.attachments.map(e=>({...e})),!0),p(Le)===r.prompt&&r.submissionId&&(r.prompt||r.imageUploadIds?.length)&&r.reasoningEffort&&r.selectedModel&&He.set(n,{prompt:r.prompt,imageUploadIds:r.imageUploadIds??[],reasoningEffort:r.reasoningEffort,serviceTier:r.serviceTier??p(L)?.defaultServiceTier??`standard`,selectedModel:r.selectedModel,submissionId:r.submissionId}),l(q,r.message,!0)}),n(()=>{if(!p(nt))return;let e=qi({pendingCreatedThreadId:p(nt),threads:p(Gt)});e!==p(nt)&&l(nt,e,!0)}),n(()=>{let e=jt.data;if(p(Y)||!p(mt)||p(ft).length>0||p(pt)||!kt.data||!At.data||e===void 0)return;l(Y,!0);let t=Gi(p(Gt),e?.lastThreadId??null);if(t&&Vi(t)){bn(t.workspaceName,t.threadId,!1,!0),l(Ye,Bi(p(Wt),t.workspaceName)?._id??t.workspaceSessionId,!0),l(Xe,t.threadId,!0);return}p(Wt)[0]&&(bn(p(Wt)[0].workspaceName,null,!1,!0),l(Ye,p(Wt)[0]._id,!0))}),n(()=>{let e=p(Ye);if(!e||!p(B)||!p(it))return;if(!p(Wt).find(t=>t._id===e)){l(Ye,null);return}l(Ye,null);let t=p(tt);kn(e).catch(e=>{t===p(tt)&&l(q,e instanceof Error?e.message:`Failed to attach workspace.`,!0)})}),n(()=>{let e=p(W)?Gi(p(Gt),p(W)):null;e?.workspaceName&&e.workspaceName!==p(U)&&bn(e.workspaceName,p(W),p(Pe)===e.workspaceName)}),n(()=>{let e=p(tn);if(!p(Y)||!p(U))return;let t=na({threads:e,currentThreadId:p(W),currentWorkspaceName:p(U),draftWorkspaceName:p(Pe),pendingCreatedThreadId:p(nt)});t!==p(W)&&bn(p(U),t,p(Pe)===p(U),!0)}),n(()=>{!p(Y)||!p(W)||p(W)!==p(Xe)&&(l(Xe,p(W),!0),oe({threadId:p(W)}))}),n(()=>{let e=ea(p(Ge),p(Gt));p(W)&&p(rn)?._id&&(e=$i(e,p(W),p(rn)._id,p(rn).claimExpiresAt)),e!==p(Ge)&&l(Ge,e,!0)}),n(()=>{let e=p(rn)?.startedAt;if(!p(un)||!e){l(ze,0);return}let t=()=>{l(ze,Math.max(0,Math.floor((Date.now()-e)/1e3)),!0)};t();let n=window.setInterval(t,1e3);return()=>{window.clearInterval(n)}}),n(()=>{let e=p(Re),t=p(gn);if(!e||!p(B)||!p(it)||kt.data===void 0||Ot()===`skip`)return;let n={clientId:e,workspaceSessionIds:t?t.split(`\0`):[]};fe.enqueue(n).catch(()=>{});let r=window.setInterval(()=>{fe.enqueue(n).catch(()=>{})},et);return()=>{window.clearInterval(r),fe.cancelPending()}}),ce(()=>{l(Re,crypto.randomUUID(),!0);let e=window.sprocketDesktopBridge,t=e?.onWorkspaceLaunch?e.onWorkspaceLaunch(()=>{Dn()}):void 0,n=je();return n&&(En(n),Me()),e?.takeWorkspaceLaunch?Dn().finally(()=>{l(mt,!0)}):l(mt,!0),Ne().then(e=>{l(B,e,!0),l(Ee,!0),vn().catch(e=>{l(q,e instanceof Error?e.message:`Failed to load local workspace sessions.`,!0)})}).catch(e=>{l(q,e instanceof Error?e.message:`Failed to connect to the Sprocket server.`,!0),l(Ee,!0)}),()=>t?.()});var Vn=a();ie(`1uha8ag`,e=>{g(()=>{c.title=`Sprocket`})});var Hn=b(Vn),Wn=e=>{Ae(e,{title:`Connecting to Sprocket…`,description:`Looking for a running Sprocket server on this machine.`,busy:!0})},Gn=e=>{{let t=e=>{var t=Fu();V(e=>O(t,`href`,e),[()=>pe(`/pair`)]),v(e,t)},n=C(()=>p(q)??`Connect to your Sprocket server to continue.`);Ae(e,{title:`Connect to Sprocket`,get description(){return p(n)},actions:t,$$slots:{actions:!0}})}},Kn=e=>{var t=Iu(),n=y(t);{let e=C(()=>({isLoading:!o().isReady||o().isLoading||p(w)||p(S)&&h.isLoading,isConfigured:o().isConfigured,isAuthenticated:p(S),connectionFailed:p(D),error:o().error}));Mn(n,{get authState(){return p(e)},get overlayOpen(){return o().isWaitingForBrowserSignIn},onSignIn:()=>void Ce(),onSignOut:()=>void he(),onRetry:()=>void ve(),onSignUp:()=>void ge()})}Un(s(n,2),{get open(){return o().isWaitingForBrowserSignIn},get signInUrl(){return o().browserSignInUrl},get error(){return o().error},get onCancel(){return be},get onClearOpenError(){return _e}}),k(t),v(e,t)},qn=e=>{var t=Ru(),n=y(t),i=y(n),c=e=>{fa(e,{get activePage(){return p(dt)},get theme(){return p(Mt)},onThemeChange:e=>void Lt(e),onBack:()=>{l(ut,!1),l(dt,`account`)},onNavigate:e=>{l(dt,e,!0)}})},u=e=>{vu(e,{get currentWorkspaceName(){return p(U)},get currentThreadId(){return p(W)},get groups(){return p(nn)},get pendingAgentLaunches(){return p(Ge)},get theme(){return p(Mt)},onThemeChange:e=>void Lt(e),onChooseWorkspace:()=>{Cn(`add`)},onReconnectWorkspace:e=>{An(e)},onOpenSettings:()=>{l(dt,`account`),l(ut,!0)},onStartThreadDraft:Pn,onSelectThread:Fn,onRenameThread:(e,t)=>{In(e,t)},onArchiveThread:e=>{Ln(e)}})};r(i,e=>{p(ut)?e(c):e(u,-1)});var d=s(i,2),f=y(d),m=e=>{var t=a(),n=b(t),i=e=>{sa(e,{get threads(){return p(Gt)},onRestore:e=>{Rn(e)}})},s=e=>{Ea(e,{})},c=e=>{zi(e,{get user(){return o().user},onSignOut:()=>void he()})};r(n,e=>{p(dt)===`archived`?e(i):p(dt)===`usage`?e(s,1):e(c,-1)}),v(e,t)},h=e=>{var t=Lu(),n=b(t);{let e=C(()=>p(q)??o().error??p(Ut)?.message??null),t=C(()=>p(rn)?.lastError??null),r=C(()=>p(un)?p(rn)?._id??null:null);Ll(n,{get currentError(){return p(e)},get runError(){return p(t)},get messages(){return p(Zt)},get actions(){return p(an)},get activeRunId(){return p(r)},get workspaceSession(){return p(Qt)}})}var r=s(n,2);{let e=C(()=>p(pn)||p(dn)),t=C(()=>p(un)?ml(p(ze)):null);ki(r,{get attachments(){return p(K)},onAttachFiles:bt,onRemoveAttachment:xt,get modelCatalog(){return p(L)},get canSend(){return p(mn)},get isSubmitting(){return p(e)},get isStarting(){return p(dn)},get isRunning(){return p(un)},get elapsedLabel(){return p(t)},get contextUsage(){return p(qt)},get workspaceSkills(){return p(en)},onSubmit:()=>{zn()},onCancel:()=>{Bn()},get prompt(){return p(Le)},set prompt(e){l(Le,e,!0)},get selectedModel(){return p(Fe)},set selectedModel(e){l(Fe,e,!0)},get selectedReasoningEffort(){return p(G)},set selectedReasoningEffort(e){l(G,e,!0)},get selectedServiceTier(){return p(Ie)},set selectedServiceTier(e){l(Ie,e,!0)}})}v(e,t)};r(f,e=>{p(ut)?e(m):e(h,-1)}),k(d),k(n);var g=s(n,2),_=e=>{eu(e,{get open(){return p(X)},get desktopApi(){return p(B)},get mode(){return p(st)},get expectedWorkspaceName(){return p(ct)},get recentWorkspaces(){return p(_n)},onClose:()=>{l(X,!1),l(lt,null),l(ct,void 0)},onSelect:async e=>{try{await wn(e)}catch{await vn()}}})};r(g,e=>{p(B)&&p(X)&&e(_)}),k(t),v(e,t)};r(Hn,e=>{p(Ee)?p(B)?p(T)?e(qn,-1):e(Kn,2):e(Gn,1):e(Wn)}),v(t,Vn),j(),m()}export{zu as component};