litepaseo 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +6 -0
- package/dist/server/cli.mjs +2 -2
- package/dist/server/{worker-CVzQyHuc.mjs → worker-c_aPO7b7.mjs} +46 -23
- package/dist/web/assets/{ChangesPanel-CLaeJXXw.js → ChangesPanel-CCv89MWn.js} +1 -1
- package/dist/web/assets/ChangesPanel-CCv89MWn.js.br +0 -0
- package/dist/web/assets/ChangesPanel-CCv89MWn.js.gz +0 -0
- package/dist/web/assets/{CodeBlockNode-XaHrqBvK.js → CodeBlockNode-DkSodxjo.js} +1 -1
- package/dist/web/assets/CodeBlockNode-DkSodxjo.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-DkSodxjo.js.gz +0 -0
- package/dist/web/assets/{ConversationSearch-ftx4GXv9.js → ConversationSearch-BjpeqUQD.js} +1 -1
- package/dist/web/assets/ConversationSearch-BjpeqUQD.js.br +0 -0
- package/dist/web/assets/ConversationSearch-BjpeqUQD.js.gz +0 -0
- package/dist/web/assets/{FileViewer-5kwZorzK.js → FileViewer-DZoA4W84.js} +1 -1
- package/dist/web/assets/FileViewer-DZoA4W84.js.br +0 -0
- package/dist/web/assets/FileViewer-DZoA4W84.js.gz +0 -0
- package/dist/web/assets/{FilesPanel-B8dM9wUZ.js → FilesPanel-DIQsDIqh.js} +1 -1
- package/dist/web/assets/FilesPanel-DIQsDIqh.js.br +0 -0
- package/dist/web/assets/FilesPanel-DIQsDIqh.js.gz +0 -0
- package/dist/web/assets/{HostSettings-CM5zbQ-Z.js → HostSettings-Bv5JZpp-.js} +1 -1
- package/dist/web/assets/HostSettings-Bv5JZpp-.js.br +0 -0
- package/dist/web/assets/HostSettings-Bv5JZpp-.js.gz +0 -0
- package/dist/web/assets/{MarkdownMessage-8rgYH5TV.js → MarkdownMessage-EN9nVzPY.js} +5 -5
- package/dist/web/assets/MarkdownMessage-EN9nVzPY.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-EN9nVzPY.js.gz +0 -0
- package/dist/web/assets/{PreCodeBlock-D5UN7dQA.js → PreCodeBlock-BQT0wORf.js} +1 -1
- package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-C5J4PTcm.js → PreCodeBlock.vue_vue_type_style_index_0_lang-DfarDC-F.js} +1 -1
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-DfarDC-F.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-DfarDC-F.js.gz +0 -0
- package/dist/web/assets/{TerminalPanel-BvvKX0GR.js → TerminalPanel-K_XWJJCf.js} +1 -1
- package/dist/web/assets/TerminalPanel-K_XWJJCf.js.br +0 -0
- package/dist/web/assets/TerminalPanel-K_XWJJCf.js.gz +0 -0
- package/dist/web/assets/{Tooltip-CH6B-8OL.js → Tooltip-DlJP942e.js} +1 -1
- package/dist/web/assets/Tooltip-DlJP942e.js.br +0 -0
- package/dist/web/assets/Tooltip-DlJP942e.js.gz +0 -0
- package/dist/web/assets/index-BL9bqeXR.js +34 -0
- package/dist/web/assets/index-BL9bqeXR.js.br +0 -0
- package/dist/web/assets/index-BL9bqeXR.js.gz +0 -0
- package/dist/web/assets/{index10-BKIBVN5Z.js → index10-CvxEEYMU.js} +1 -1
- package/dist/web/assets/index10-CvxEEYMU.js.br +0 -0
- package/dist/web/assets/index10-CvxEEYMU.js.gz +0 -0
- package/dist/web/assets/index3-c_9QIzHt.js +1 -0
- package/dist/web/assets/index4-Bgk1S4Rt.js +1 -0
- package/dist/web/assets/{index5-GzgYlIYX.js → index5-CXyDTPhW.js} +1 -1
- package/dist/web/assets/index5-CXyDTPhW.js.br +0 -0
- package/dist/web/assets/index5-CXyDTPhW.js.gz +0 -0
- package/dist/web/assets/{index6-Bg_likgg.js → index6-jpDV1ZAC.js} +1 -1
- package/dist/web/assets/index6-jpDV1ZAC.js.br +0 -0
- package/dist/web/assets/index6-jpDV1ZAC.js.gz +0 -0
- package/dist/web/assets/{index7-R2quNxga.js → index7-1uZFrok-.js} +1 -1
- package/dist/web/assets/index7-1uZFrok-.js.br +0 -0
- package/dist/web/assets/index7-1uZFrok-.js.gz +0 -0
- package/dist/web/assets/{index8-DpYGQbb_.js → index8-CMMJJO04.js} +1 -1
- package/dist/web/assets/index8-CMMJJO04.js.br +0 -0
- package/dist/web/assets/index8-CMMJJO04.js.gz +0 -0
- package/dist/web/assets/{index9-fVOIt8g8.js → index9--HlVDjgo.js} +1 -1
- package/dist/web/assets/index9--HlVDjgo.js.br +0 -0
- package/dist/web/assets/index9--HlVDjgo.js.gz +0 -0
- package/dist/web/index.html +1 -1
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/package.json +1 -1
- package/dist/web/assets/ChangesPanel-CLaeJXXw.js.br +0 -0
- package/dist/web/assets/ChangesPanel-CLaeJXXw.js.gz +0 -0
- package/dist/web/assets/CodeBlockNode-XaHrqBvK.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-XaHrqBvK.js.gz +0 -0
- package/dist/web/assets/ConversationSearch-ftx4GXv9.js.br +0 -0
- package/dist/web/assets/ConversationSearch-ftx4GXv9.js.gz +0 -0
- package/dist/web/assets/FileViewer-5kwZorzK.js.br +0 -0
- package/dist/web/assets/FileViewer-5kwZorzK.js.gz +0 -0
- package/dist/web/assets/FilesPanel-B8dM9wUZ.js.br +0 -8
- package/dist/web/assets/FilesPanel-B8dM9wUZ.js.gz +0 -0
- package/dist/web/assets/HostSettings-CM5zbQ-Z.js.br +0 -0
- package/dist/web/assets/HostSettings-CM5zbQ-Z.js.gz +0 -0
- package/dist/web/assets/MarkdownMessage-8rgYH5TV.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-8rgYH5TV.js.gz +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-C5J4PTcm.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-C5J4PTcm.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-BvvKX0GR.js.br +0 -0
- package/dist/web/assets/TerminalPanel-BvvKX0GR.js.gz +0 -0
- package/dist/web/assets/Tooltip-CH6B-8OL.js.br +0 -0
- package/dist/web/assets/Tooltip-CH6B-8OL.js.gz +0 -0
- package/dist/web/assets/index-C1LEv69l.js +0 -34
- package/dist/web/assets/index-C1LEv69l.js.br +0 -0
- package/dist/web/assets/index-C1LEv69l.js.gz +0 -0
- package/dist/web/assets/index10-BKIBVN5Z.js.br +0 -0
- package/dist/web/assets/index10-BKIBVN5Z.js.gz +0 -0
- package/dist/web/assets/index3-cddVwm0b.js +0 -1
- package/dist/web/assets/index4-DvLS0hKE.js +0 -1
- package/dist/web/assets/index5-GzgYlIYX.js.br +0 -0
- package/dist/web/assets/index5-GzgYlIYX.js.gz +0 -0
- package/dist/web/assets/index6-Bg_likgg.js.br +0 -0
- package/dist/web/assets/index6-Bg_likgg.js.gz +0 -0
- package/dist/web/assets/index7-R2quNxga.js.br +0 -0
- package/dist/web/assets/index7-R2quNxga.js.gz +0 -0
- package/dist/web/assets/index8-DpYGQbb_.js.br +0 -0
- package/dist/web/assets/index8-DpYGQbb_.js.gz +0 -0
- package/dist/web/assets/index9-fVOIt8g8.js.br +0 -0
- package/dist/web/assets/index9-fVOIt8g8.js.gz +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownMessage-EN9nVzPY.js","assets/vue.runtime.esm-bundler-DwGo9CTz.js","assets/rolldown-runtime-XKyaHtl9.js","assets/highlight-BnTrj1LT.js","assets/MarkdownMessage-bqphU8I9.css","assets/HostSettings-Bv5JZpp-.js","assets/HostSettings-Buiqtp3W.css","assets/ChangesPanel-CCv89MWn.js","assets/ChangesPanel-BlAOBntI.css","assets/ConversationSearch-BjpeqUQD.js","assets/ConversationSearch-BD_oQkce.css","assets/FilesPanel-DIQsDIqh.js","assets/FilesPanel-CY9yMixJ.css","assets/FileViewer-DZoA4W84.js","assets/FileViewer-T756VVq4.css","assets/TerminalPanel-K_XWJJCf.js","assets/TerminalPanel-BzfVCEVB.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{$ as e,C as t,G as n,H as r,I as i,J as a,L as o,M as s,N as c,P as l,Q as u,S as d,T as f,X as p,_ as m,a as h,at as g,c as _,d as v,et as y,f as b,g as x,h as S,j as C,k as w,l as T,m as E,nt as D,o as O,ot as k,p as A,r as j,rt as M,s as N,u as P,v as F,w as I,x as L,y as R,z}from"./vue.runtime.esm-bundler-DwGo9CTz.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function B(e,t){let r=crypto.randomUUID(),i=0,a=null,o;function s(n=!1){let c=!n&&!document.hidden&&document.hasFocus()?e():null;clearInterval(o),t()?((c||a)&&fetch(`/api/presence`,{method:`PUT`,credentials:`same-origin`,keepalive:!0,headers:{"content-type":`application/json`,"x-litepaseo":`1`},body:JSON.stringify({tab:r,seq:++i,key:c}),signal:AbortSignal.timeout(1e4)}).catch(()=>{}),a=c,c&&(o=setInterval(s,15e3))):a=null}let c=()=>s(),u=()=>s(!0);n(e,c,{immediate:!0,flush:`post`}),document.addEventListener(`visibilitychange`,c),window.addEventListener(`resize`,c),window.addEventListener(`focus`,c),window.addEventListener(`blur`,c),window.addEventListener(`pagehide`,u),window.addEventListener(`pageshow`,c),l(()=>{u(),clearInterval(o),document.removeEventListener(`visibilitychange`,c),window.removeEventListener(`resize`,c),window.removeEventListener(`focus`,c),window.removeEventListener(`blur`,c),window.removeEventListener(`pagehide`,u),window.removeEventListener(`pageshow`,c)})}var V=e=>e?e.size:0,H=e=>(e.size=1+V(e.left)+V(e.right),e),U=class{root=null;compare;constructor(e){this.compare=e}get size(){return V(this.root)}clear(){this.root=null}insert(e){let[t,n]=this.split(this.root,e,!1),r={item:e,priority:Math.random(),size:1,left:null,right:null};this.root=this.merge(this.merge(t,r),n)}remove(e){let[t,n]=this.split(this.root,e,!1),[r,i]=this.split(n,e,!0);return this.root=this.merge(t,i),r!==null}at(e){let t=this.root;for(;t;){let n=V(t.left);if(e<n)t=t.left;else if(e===n)return t.item;else e-=n+1,t=t.right}}rank(e){let t=this.root,n=0;for(;t;){let r=this.compare(e,t.item);if(r<0)t=t.left;else if(r>0)n+=V(t.left)+1,t=t.right;else return n+V(t.left)}return-1}range(e,t){let n=[],r=Math.min(this.size,e+t);if(e=Math.max(0,e),e>=r)return n;let i=[],a=this.root,o=e;for(;a;){let e=V(a.left);if(o<e)i.push(a),a=a.left;else if(o===e){i.push(a);break}else o-=e+1,a=a.right}for(;n.length<r-e&&i.length;){let e=i.pop();n.push(e.item);let t=e.right;for(;t;)i.push(t),t=t.left}return n}split(e,t,n){if(!e)return[null,null];let r=this.compare(e.item,t);if(r<0||n&&r===0){let[r,i]=this.split(e.right,t,n);return e.right=r,[H(e),i]}let[i,a]=this.split(e.left,t,n);return e.left=a,[i,H(e)]}merge(e,t){return e?t?e.priority>t.priority?(e.right=this.merge(e.right,t),H(e)):(t.left=this.merge(e,t.left),H(t)):e:t}},W=e=>e?e.size:0,G=e=>e?e.sum:0,K=e=>(e.size=1+W(e.left)+W(e.right),e.sum=e.weight+G(e.left)+G(e.right),e),q=class{root=null;compare;constructor(e){this.compare=e}get size(){return W(this.root)}get total(){return G(this.root)}clear(){this.root=null}insert(e,t){let[n,r]=this.split(this.root,e,!1),i={item:e,weight:t,priority:Math.random(),size:1,sum:t,left:null,right:null};this.root=this.merge(this.merge(n,i),r)}remove(e){let[t,n]=this.split(this.root,e,!1),[r,i]=this.split(n,e,!0);return this.root=this.merge(t,i),r!==null}reweigh(e,t){this.remove(e)&&this.insert(e,t)}at(e){let t=this.root;for(;t;){let n=W(t.left);if(e<n)t=t.left;else if(e===n)return t.item;else e-=n+1,t=t.right}}locate(e){let t=this.root,n=0,r=0;if(!t)return null;for(e=Math.max(0,Math.min(e,this.total-1e-9));t;){let i=G(t.left);if(e<i)t=t.left;else if(e<i+t.weight||!t.right)return{item:t.item,rank:n+W(t.left),start:r+i};else e-=i+t.weight,r+=i+t.weight,n+=W(t.left)+1,t=t.right}return null}offsetOf(e){let t=this.root,n=0;for(;t;){let r=this.compare(e,t.item);if(r<0)t=t.left;else if(r>0)n+=G(t.left)+t.weight,t=t.right;else return n+G(t.left)}return-1}split(e,t,n){if(!e)return[null,null];let r=this.compare(e.item,t);if(r<0||n&&r===0){let[r,i]=this.split(e.right,t,n);return e.right=r,[K(e),i]}let[i,a]=this.split(e.left,t,n);return e.left=a,[i,K(e)]}merge(e,t){return e?t?e.priority>t.priority?(e.right=this.merge(e.right,t),K(e)):(t.left=this.merge(e,t.left),K(t)):e:t}},ee=[`needs_input`,`running`,`review`,`done`],te=e=>e===`failed`||e===`unread`?`review`:e,ne=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e,re=typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches?44:36,ie=(e,t)=>e.key<t.key?-1:+(e.key>t.key);function ae(e,t){return t.activityAt-e.activityAt||ie(e,t)}function oe(e,t){let n=e.pinnedAt??0,r=t.pinnedAt??0;return n||r?n?r?n-r||ie(e,t):-1:1:ae(e,t)}function se(e){return e.attention?`needs_input`:e.failed?`failed`:e.running?`running`:e.unread?`unread`:`done`}var ce=e=>`${e.hostId}\n${e.project.toLowerCase()}`,le=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),ue=(e,t)=>(e.pinnedAt||t.pinnedAt?e.pinnedAt?t.pinnedAt?e.pinnedAt-t.pinnedAt||le.compare(e.key,t.key):-1:1:0)||t.recent-e.recent||le.compare(e.name,t.name)||(e.key<t.key?-1:+(e.key>t.key)),de=e=>e.state??(e.status===`running`?`running`:`done`),fe=class{flat;groups=new Map;index=new q(ue);lanes;waiting=0;compare;isCollapsed;pinRank;constructor(e,t,n){this.pinRank=n,this.compare=e,this.isCollapsed=t,this.flat=new U(e),this.lanes=new Map(ee.map(e=>[e,new U(ae)]))}get size(){return this.flat.size}weight(e){return 36+(this.isCollapsed(e.key)?0:e.items.size*re)}add(e){this.flat.insert(e),this.lanes.get(te(de(e))).insert(e);let t=ce(e),n=this.groups.get(t);n?this.index.remove(n):(n={key:t,name:e.project,items:new U(this.compare),byRecency:this.compare===ae?null:new U(ae),recent:0,attention:0,failed:0,running:0,unread:0,hosts:new Map},this.groups.set(t,n)),n.items.insert(e),n.byRecency?.insert(e),this.count(n,e,1),this.reinsert(n)}remove(e){if(!this.flat.remove(e))return;this.lanes.get(te(de(e))).remove(e);let t=this.groups.get(ce(e));t&&(this.index.remove(t),t.items.remove(e),t.byRecency?.remove(e),this.count(t,e,-1),t.items.size?this.reinsert(t):this.groups.delete(t.key))}refresh(e){let t=this.groups.get(e);t&&this.index.reweigh(t,this.weight(t))}clear(){this.flat.clear(),this.groups.clear(),this.index.clear();for(let e of this.lanes.values())e.clear();this.waiting=0}rows(e,t){let n=[],r=e+t,i=this.index.locate(Math.max(0,e));if(!i)return n;let a=i.rank,o=i.start;for(;o<r;){let t=this.index.at(a++);if(!t)break;let i=this.isCollapsed(t.key);if(o+36>e&&n.push({kind:`group`,key:`g:`+t.key,top:o,group:t,collapsed:i}),!i){let i=o+36,a=Math.max(0,Math.floor((e-i)/re)),s=Math.min(t.items.size,Math.ceil((r-i)/re));s>a&&t.items.range(a,s-a).forEach((e,t)=>n.push({kind:`item`,key:e.key,top:i+(a+t)*re,item:e}))}o+=this.weight(t)}return n}reinsert(e){e.recent=(e.byRecency??e.items).at(0).activityAt,this.index.insert(e,this.weight(e))}count(e,t,n){let r=this.pinRank(t);if(r){let t=e.pinRanks??=new Map,i=(t.get(r)??0)+n;i>0?t.set(r,i):t.delete(r),e.pinnedAt=t.size?Math.min(...t.keys()):0}let i=(e.hosts.get(t.hostId)??0)+n;i>0?e.hosts.set(t.hostId,i):e.hosts.delete(t.hostId),t.attention&&(e.attention+=n,this.waiting+=n);let a=de(t);a===`failed`?e.failed+=n:a===`running`?e.running+=n:a===`unread`&&(e.unread+=n)}},pe=class{generation=``;seq=-1;projectPins={};pinRank=e=>e.projectId?this.projectPins[JSON.stringify([e.hostId,e.projectId])]??0:0;setProjectPins(e){this.projectPins=e,this.all.clear();for(let e of this.byHost.values())e.clear();this.filtered=null;for(let e of this.byKey.values())this.all.add(e),this.hostView(e.hostId).add(e);this.predicate&&this.rebuildFiltered(),this.version.value++}byKey=new Map;collapsed;compare;all;byHost=new Map;host=null;filtered=null;predicate=null;persist;indexOf;buckets=new Map;version=y(0);constructor(e={}){this.collapsed=new Set(e.collapsed),this.persist=e.persist??(()=>{}),this.compare=e.compare??ae,this.indexOf=e.indexBy??null,this.all=new fe(this.compare,this.collapsedFn,this.pinRank)}collapsedFn=e=>this.collapsed.has(e);get base(){return this.host===null?this.all:this.hostView(this.host)}get view(){return this.filtered??this.base}hostView(e){let t=this.byHost.get(e);return t||this.byHost.set(e,t=new fe(this.compare,this.collapsedFn,this.pinRank)),t}get size(){return this.view.size}get total(){return this.byKey.size}get waiting(){return this.all.waiting}get projectCount(){return this.view.groups.size}get hostFilter(){return this.host}hostSize(e){return this.byHost.get(e)?.size??0}get(e){return e?this.byKey.get(e):void 0}indexed(e,t=1){return e?this.buckets.get(e)?.range(0,t)??[]:[]}indexedSize(e){return e?this.buckets.get(e)?.size??0:0}range(e,t){return this.view.flat.range(e,t)}allLaneSize(e){return this.all.lanes.get(e).size}laneSize(e){return this.view.lanes.get(e).size}laneRange(e,t,n){return this.view.lanes.get(e).range(t,n)}get groupedHeight(){return this.view.index.total}groupedRows(e,t){return this.view.rows(e,t)}isCollapsed(e){return!this.filtered&&this.collapsed.has(e)}toggleGroup(e){if(!this.filtered){this.collapsed.has(e)?this.collapsed.delete(e):this.collapsed.add(e),this.all.refresh(e);for(let t of this.byHost.values())t.refresh(e);this.persist([...this.collapsed]),this.version.value++}}setHost(e){e!==this.host&&(this.host=e,this.predicate&&this.rebuildFiltered(),this.version.value++)}setFilter(e){this.predicate=e,e?this.rebuildFiltered():this.filtered=null,this.version.value++}applyCollection(e){if(e.type===`snapshot`){this.byKey.clear(),this.all.clear();for(let e of this.byHost.values())e.clear();this.filtered?.clear(),this.buckets.clear();for(let t of e.items)this.put(t)}else{if(e.generation!==this.generation)return;for(let t of e.changes){let e=this.byKey.get(t.key);e&&(this.all.remove(e),this.byHost.get(e.hostId)?.remove(e),this.filtered?.remove(e),this.unbucket(e)),t.value?this.put(t.value):this.byKey.delete(t.key)}}this.generation=e.generation,this.seq=e.seq,this.version.value++}apply(e){e.type===`snapshot`?this.applyCollection({type:`snapshot`,generation:e.generation,seq:e.seq,items:e.agents}):e.type===`changes`&&this.applyCollection({type:`changes`,generation:e.generation,seq:e.seq,changes:e.changes})}matches(e){return(this.host===null||e.hostId===this.host)&&this.predicate(e)}rebuildFiltered(){let e=new fe(this.compare,()=>!1,this.pinRank),t=this.base;for(let n of t.flat.range(0,t.size))this.predicate(n)&&e.add(n);this.filtered=e}bucketOf(e){return this.indexOf?this.indexOf(e):null}unbucket(e){let t=this.bucketOf(e);if(!t)return;let n=this.buckets.get(t);n&&(n.remove(e),n.size||this.buckets.delete(t))}put(e){this.byKey.set(e.key,e),this.all.add(e),this.hostView(e.hostId).add(e),this.filtered&&this.matches(e)&&this.filtered.add(e);let t=this.bucketOf(e);if(t){let n=this.buckets.get(t);n||this.buckets.set(t,n=new U(ae)),n.insert(e)}}},me=[`width`,`height`],he=[`d`],J=f({__name:`Icon`,props:{name:{},size:{}},setup(e){let t={chat:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,board:`M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM9 3v18M15 3v12`,server:`M4 3h16a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zM4 13h16a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM7 7h.01M7 17h.01`,search:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.35-4.35`,back:`M15 18l-6-6 6-6`,send:`M12 19V5M5 12l7-7 7 7`,stop:`M7.5 5h9A2.5 2.5 0 0 1 19 7.5v9a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 5 16.5v-9A2.5 2.5 0 0 1 7.5 5z`,plus:`M12 5v14M5 12h14`,close:`M18 6 6 18M6 6l12 12`,check:`M20 6 9 17l-5-5`,mic:`M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3zM19 10v2a7 7 0 0 1-14 0v-2M12 19v3`,eye:`M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`,bulb:`M9 18h6M10 21.5h4M12 2.5a6.5 6.5 0 0 0-3.9 11.7c.6.5.9 1.2.9 2V16h6v-.3c0-.8.3-1.5.9-2A6.5 6.5 0 0 0 12 2.5z`,npm:`M2 8.5h20v7H12v2H8v-2H2zM5.5 11v4.5M8.5 11h1.5v6M12.5 11h7v4.5M16 11v4.5`,js:`M12 2.5l8.5 4.75v9.5L12 21.5l-8.5-4.75v-9.5zM10.5 9v4.75a1.6 1.6 0 0 1-3 .75M16.6 9.6c-.5-.6-2.6-.9-2.6.6 0 1.6 2.8 1.1 2.8 2.7 0 1.5-2.2 1.4-3 .5`,clock:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2`,hourglass:`M5 22h14M5 2h14M17 22v-4.2a2 2 0 0 0-.6-1.4L12 12l-4.4 4.4a2 2 0 0 0-.6 1.4V22M7 2v4.2a2 2 0 0 0 .6 1.4L12 12l4.4-4.4a2 2 0 0 0 .6-1.4V2`,undo:`M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11`,layers:`M12 2 2 7l10 5 10-5zM2 17l10 5 10-5M2 12l10 5 10-5`,sliders:`M4 7h9M17 7h3M4 17h3M11 17h9M15 5v4M9 15v4`,panel:`M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM15 3v18`,play:`M7 4.5v15l12-7.5z`,pause:`M8 5v14M16 5v14`,copy:`M9 9h11a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V10a1 1 0 0 1 1-1zM5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1`,terminal:`M4 17l6-6-6-6M12 19h8`,file:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6`,edit:`M12 20h9M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z`,globe:`M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`,bot:`M12 8V4H8M4 8h16a0 0 0 0 1 0 0v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8zM2 14h2M20 14h2M9 13v2M15 13v2`,tool:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,brain:`M9 3a3 3 0 0 0-3 3 3 3 0 0 0-2 5 3 3 0 0 0 2 5 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3zM15 3a3 3 0 0 1 3 3 3 3 0 0 1 2 5 3 3 0 0 1-2 5 3 3 0 0 1-3 3 3 3 0 0 1-3-3`,alert:`M12 9v4M12 17h.01M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z`,"shield-off":`M2 2l20 20M9.5 3 12 2l8 3v7c0 1.2-.3 2.4-.8 3.5M4 5v7c0 6 8 10 8 10s2.5-1.2 4.7-3.4`,shield:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z`,trash:`M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`,chevron:`M9 18l6-6-6-6`,folder:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9l-.8-1.2A2 2 0 0 0 7.9 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z`,list:`M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01`,sun:`M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`,moon:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z`,monitor:`M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM8 21h8M12 17v4`,bell:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0`,phone:`M7 2h10a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zM11 18h2`,gear:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`,bolt:`M13 2 3 14h9l-1 8 10-12h-9l1-8z`,refresh:`M21 12a9 9 0 1 1-3-6.7L21 8M21 3v5h-5`,pin:`M12 17v5M9 10.76V6a3 3 0 0 1 6 0v4.76a2 2 0 0 0 1.11 1.79l1.78.9A2 2 0 0 1 19 15.24V16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-.76a2 2 0 0 1 1.11-1.79l1.78-.9A2 2 0 0 0 9 10.76z`,more:`M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM19 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM5 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2z`,"more-v":`M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM12 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM12 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2z`,archive:`M21 8v13H3V8M1 3h22v5H1zM10 12h4`,dot:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`,branch:`M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 9a9 9 0 0 1-9 9`,sparkle:`M12 3l1.9 5.8L20 11l-6.1 2.2L12 19l-1.9-5.8L4 11l6.1-2.2z`};return(n,r)=>(i(),R(`svg`,{class:`icon`,width:e.size??16,height:e.size??16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.75`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[x(`path`,{d:t[e.name]??t.tool},null,8,he)],8,me))}}),ge=[`aria-label`],_e={class:`menu-title`},ve=f({__name:`ThreadMenu`,props:{thread:{},x:{},y:{}},emits:[`close`,`rename`,`pin`,`unread`,`read`,`archive`],setup(n,{emit:r}){let a=n,o=r,s=e(null),u=e({left:a.x,top:a.y});function f(e){e(),o(`close`)}function p(e){e.key===`Escape`&&o(`close`)}function m(e){s.value&&!s.value.contains(e.target)&&o(`close`)}return c(()=>{C(()=>{let e=s.value;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect();u.value={left:Math.max(8,Math.min(a.x,innerWidth-t-8)),top:Math.max(8,Math.min(a.y,innerHeight-n-8))},e.querySelector(`button`)?.focus()}),window.addEventListener(`keydown`,p),setTimeout(()=>window.addEventListener(`pointerdown`,m),0)}),l(()=>{window.removeEventListener(`keydown`,p),window.removeEventListener(`pointerdown`,m)}),(e,r)=>(i(),R(`div`,{ref_key:`element`,ref:s,class:`menu`,role:`menu`,"aria-label":`Actions for `+n.thread.name,style:g({left:u.value.left+`px`,top:u.value.top+`px`})},[x(`div`,_e,k(n.thread.name),1),x(`button`,{role:`menuitem`,onClick:r[0]||=e=>f(()=>o(`rename`,n.thread))},[t(J,{name:`edit`,size:14}),r[5]||=d(`Rename…`,-1)]),x(`button`,{role:`menuitem`,onClick:r[1]||=e=>f(()=>o(`pin`,n.thread,!n.thread.pinnedAt))},[t(J,{name:`pin`,size:14}),d(k(n.thread.pinnedAt?`Unpin`:`Pin to top`),1)]),n.thread.unread?(i(),R(`button`,{key:0,role:`menuitem`,onClick:r[2]||=e=>f(()=>o(`read`,n.thread))},[t(J,{name:`check`,size:14}),r[6]||=d(`Mark as read `,-1)])):(i(),R(`button`,{key:1,role:`menuitem`,onClick:r[3]||=e=>f(()=>o(`unread`,n.thread))},[t(J,{name:`dot`,size:14}),r[7]||=d(`Mark as unread `,-1)])),r[9]||=x(`div`,{class:`menu-sep`},null,-1),x(`button`,{role:`menuitem`,class:`menu-danger`,onClick:r[4]||=e=>f(()=>o(`archive`,n.thread))},[t(J,{name:`archive`,size:14}),r[8]||=d(`Archive… `,-1)])],12,ge))}}),ye={class:`sheet-head`},be={class:`sheet-body`},xe={class:`field`},Se=[`placeholder`],Ce={class:`row-sub`},we={class:`sheet-foot`},Te=[`disabled`],Ee=[`disabled`],Y=[`disabled`],De=f({__name:`RenameThread`,props:{thread:{},busy:{type:Boolean}},emits:[`close`,`save`],setup(n,{emit:r}){let o=n,s=r,l=e(o.thread.title??o.thread.name),u=e(null);c(()=>C(()=>{u.value?.focus(),u.value?.select()}));function d(){let e=l.value.trim();s(`save`,e||null)}return(e,r)=>(i(),R(`div`,{class:`overlay`,onMousedown:r[4]||=v(e=>!n.busy&&s(`close`),[`self`]),onKeydown:r[5]||=P(e=>s(`close`),[`esc`])},[x(`form`,{class:`sheet sheet-small`,role:`dialog`,"aria-modal":`true`,"aria-label":`Rename thread`,onSubmit:v(d,[`prevent`])},[x(`header`,ye,[r[6]||=x(`h2`,null,`Rename thread`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:r[0]||=e=>s(`close`)},[t(J,{name:`close`,size:16})])]),x(`div`,be,[x(`label`,xe,[r[7]||=x(`span`,null,`Name`,-1),a(x(`input`,{ref_key:`input`,ref:u,"onUpdate:modelValue":r[1]||=e=>l.value=e,maxlength:`200`,placeholder:n.thread.name},null,8,Se),[[_,l.value]])]),x(`p`,Ce,k(n.thread.project)+k(n.thread.branch?` · `+n.thread.branch:``),1)]),x(`footer`,we,[n.thread.title?(i(),R(`button`,{key:0,type:`button`,class:`btn btn-ghost sheet-reset`,disabled:n.busy,onClick:r[2]||=e=>s(`save`,null)},` Reset to default `,8,Te)):F(``,!0),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:n.busy,onClick:r[3]||=e=>s(`close`)},`Cancel`,8,Ee),x(`button`,{class:`btn btn-primary`,disabled:n.busy||!l.value.trim()},`Save`,8,Y)])],32)],32))}}),Oe=[`aria-label`],ke={class:`menu-title`},Ae=f({__name:`ProjectMenu`,props:{name:{},pinned:{type:Boolean},host:{},x:{},y:{}},emits:[`close`,`settings`,`remove`,`pin`],setup(n,{emit:r}){let a=n,o=r,s=e(null),u=e({left:a.x,top:a.y});function f(e){o(e===`settings`?`settings`:e===`pin`?`pin`:`remove`),o(`close`)}function p(e){e.key===`Escape`&&o(`close`)}function m(e){s.value&&!s.value.contains(e.target)&&o(`close`)}return c(()=>{C(()=>{let e=s.value;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect();u.value={left:Math.max(8,Math.min(a.x,innerWidth-t-8)),top:Math.max(8,Math.min(a.y,innerHeight-n-8))},e.querySelector(`button`)?.focus()}),window.addEventListener(`keydown`,p),setTimeout(()=>window.addEventListener(`pointerdown`,m),0)}),l(()=>{window.removeEventListener(`keydown`,p),window.removeEventListener(`pointerdown`,m)}),(e,r)=>(i(),R(`div`,{ref_key:`element`,ref:s,class:`menu`,role:`menu`,"aria-label":`Actions for project `+n.name,style:g({left:u.value.left+`px`,top:u.value.top+`px`})},[x(`div`,ke,k(n.name)+` · `+k(n.host),1),x(`button`,{role:`menuitem`,onClick:r[0]||=e=>f(`pin`)},[t(J,{name:`pin`,size:14}),d(k(n.pinned?`Unpin project`:`Pin project`),1)]),x(`button`,{role:`menuitem`,onClick:r[1]||=e=>f(`settings`)},[t(J,{name:`sliders`,size:14}),r[3]||=d(`Project settings…`,-1)]),r[5]||=x(`div`,{class:`menu-sep`},null,-1),x(`button`,{role:`menuitem`,class:`menu-danger`,onClick:r[2]||=e=>f(`remove`)},[t(J,{name:`trash`,size:14}),r[4]||=d(`Remove project…`,-1)])],12,Oe))}}),je=[`src`],Me=e(new Set),Ne=[`#4f7cc2`,`#5a9e6f`,`#c27a4f`,`#9a6fc2`,`#c25a7a`,`#4fa7b0`,`#b09a3f`],Pe=e=>{let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return Ne[t%Ne.length]},X=e=>(Array.from(e.trim())[0]??`?`).toUpperCase();function Fe(e){if(!e.rootPath)return null;let t=`/api/hosts/${encodeURIComponent(e.hostId)}/project-icon?cwd=${encodeURIComponent(e.rootPath)}`;return e.projectId&&(t+=`&project=${encodeURIComponent(e.projectId)}&v=${encodeURIComponent(e.projectIconRevision??``)}`),t}var Ie=f({__name:`ProjectIcon`,props:{name:{},source:{},src:{},size:{}},setup(e){let t=e,n=S(()=>{if(t.src!==void 0)return t.src;let e=t.source?Fe(t.source):null;return e&&!Me.value.has(e)?e:null});function r(){let e=n.value;e&&t.src===void 0&&!Me.value.has(e)&&(Me.value=new Set(Me.value).add(e))}return(t,a)=>(i(),R(`span`,{class:`group-icon`,style:g({...n.value?{}:{background:Pe(e.name)},...e.size?{width:e.size+`px`,height:e.size+`px`,fontSize:Math.round(e.size*.55)+`px`,borderRadius:Math.round(e.size*.28)+`px`}:{}})},[n.value?(i(),R(`img`,{key:0,src:n.value,alt:``,loading:`lazy`,onError:r},null,40,je)):(i(),R(b,{key:1},[d(k(X(e.name)),1)],64))],4))}}),Le=[`onKeydown`],Re={class:`sheet-head`},ze={class:`sheet-body`},Be={class:`field`},Ve=[`value`,`placeholder`,`disabled`],He={key:0,class:`ps-field-error`,role:`alert`},Ue={key:1,class:`field`},We={class:`pe-icon-row`},Ge=[`disabled`],Ke=[`disabled`],qe=[`value`,`disabled`],Je={key:0,class:`pe-hint`},Ye={key:1,class:`ps-field-error pe-icon-error`,role:`alert`},Xe={class:`sheet-foot`},Ze=[`disabled`],Z=[`disabled`],Qe=524288,$e=f({__name:`ProjectEdit`,props:{hostId:{},rootPath:{},project:{},customIcons:{type:Boolean},request:{type:Function}},emits:[`close`,`saved`],setup(n,{emit:r}){let a=n,o=r,s=e(a.project.customName??``),l=e(``),u=e(null),d=e(`unchanged`),f=e(null),p=e(!1),m=e(null),h=e(null),g=S(()=>!!a.project.iconRevision),_=S(()=>{let e=s.value.trim()||null;return e===a.project.customName?null:{customName:e}}),y=S(()=>d.value===`automatic`?g.value?{type:`automatic`}:null:d.value===`upload`&&u.value?{type:`upload`,data:u.value.data}:d.value===`url`&&l.value.trim()?{type:`url`,url:l.value.trim()}:null),b=S(()=>y.value?y.value.type!==`automatic`:g.value),w=S(()=>!p.value&&!!(_.value||y.value)),T=S(()=>d.value===`automatic`?null:d.value===`upload`&&u.value?`data:${u.value.mimeType};base64,${u.value.data}`:void 0);function E(e){s.value=e,f.value=null}function D(e){l.value=e,d.value=e.trim()?`url`:u.value?`upload`:`unchanged`,f.value=null}function O(){h.value?.click()}async function A(e){let t=e.target,n=t.files?.[0];if(t.value=``,!n)return;if(n.size>Qe){f.value={scope:`icon`,message:`Icon must be 512 KB or smaller`};return}let r=new Uint8Array(await n.arrayBuffer()),i=``;for(let e=0;e<r.length;e+=32768)i+=String.fromCharCode(...r.subarray(e,e+32768));u.value={fileName:n.name,mimeType:n.type||`image/png`,data:btoa(i)},d.value=`upload`,f.value=null}function j(){u.value=null,l.value=``,d.value=g.value?`automatic`:`unchanged`,f.value=null}async function M(){if(w.value){p.value=!0,f.value=null;try{await a.request(`/hosts/${encodeURIComponent(a.hostId)}/projects/${encodeURIComponent(a.project.projectId)}/edit`,`POST`,{rename:_.value,icon:y.value},4e4),o(`saved`),o(`close`)}catch(e){let t=e;f.value={scope:t.scope===`icon`?`icon`:`name`,message:t.message}}finally{p.value=!1}}}function N(){p.value||o(`close`)}return c(()=>C(()=>m.value?.focus())),(e,r)=>(i(),R(`div`,{class:`overlay ps-script-overlay`,onMousedown:v(N,[`self`]),onKeydown:P(v(N,[`stop`]),[`esc`])},[x(`form`,{class:`sheet sheet-small`,role:`dialog`,"aria-modal":`true`,"aria-label":`Edit project`,onSubmit:v(M,[`prevent`])},[x(`header`,Re,[r[2]||=x(`h2`,null,`Edit project`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:N},[t(J,{name:`close`,size:16})])]),x(`div`,ze,[x(`label`,Be,[r[3]||=x(`span`,null,`Name`,-1),x(`input`,{ref_key:`nameInput`,ref:m,value:s.value,placeholder:n.project.name,disabled:p.value,maxlength:`200`,autocapitalize:`off`,autocomplete:`off`,spellcheck:`false`,"aria-label":`Project name`,onInput:r[0]||=e=>E(e.target.value)},null,40,Ve)]),f.value?.scope===`name`?(i(),R(`p`,He,k(f.value.message),1)):F(``,!0),n.customIcons?(i(),R(`div`,Ue,[r[4]||=x(`span`,null,`Icon`,-1),x(`div`,We,[t(Ie,{name:n.project.name,size:40,src:T.value,source:{hostId:n.hostId,rootPath:n.rootPath,projectId:n.project.projectId,projectIconRevision:n.project.iconRevision}},null,8,[`name`,`src`,`source`]),x(`button`,{type:`button`,class:`btn btn-outline`,disabled:p.value,onClick:O},`Choose image`,8,Ge),b.value?(i(),R(`button`,{key:0,type:`button`,class:`btn btn-ghost`,disabled:p.value,onClick:j},`Use automatic`,8,Ke)):F(``,!0),x(`input`,{ref_key:`fileInput`,ref:h,class:`pe-file`,type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/x-icon,.ico`,tabindex:`-1`,"aria-hidden":`true`,onChange:A},null,544)]),x(`input`,{class:`pe-url`,value:l.value,type:`url`,inputmode:`url`,placeholder:`Image or website URL`,"aria-label":`Image or website URL`,disabled:p.value,autocapitalize:`off`,autocomplete:`off`,spellcheck:`false`,onInput:r[1]||=e=>D(e.target.value)},null,40,qe),d.value===`upload`&&u.value?(i(),R(`p`,Je,k(u.value.fileName),1)):F(``,!0),f.value?.scope===`icon`?(i(),R(`p`,Ye,k(f.value.message),1)):F(``,!0)])):F(``,!0)]),x(`footer`,Xe,[x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:p.value,onClick:N},`Cancel`,8,Ze),x(`button`,{class:`btn btn-primary`,disabled:!w.value},k(p.value?`Saving…`:`Save changes`),9,Z)])],32)],40,Le))}}),et=[`branchName`,`commitMessage`,`pullRequest`],tt=`service`,nt=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function rt(e){return typeof e==`string`?{text:e,kind:`string`}:Array.isArray(e)?{text:e.filter(e=>typeof e==`string`).join(`
|
|
3
|
+
`),kind:`array`}:{text:``,kind:`missing`}}function it(e,t){let n=e.split(`
|
|
4
|
+
`).filter(e=>e.trim());if(n.length)return t===`string`?n.join(`
|
|
5
|
+
`):t===`array`?n:n.length===1?n[0]:n}function at(e){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`?e:``}function ot(e){let t=e.trim();if(t)return/^[0-9]+$/.test(t)?Number(t):t}var st=0,ct=()=>`script-${++st}`;function lt(e){let t=nt(e?.worktree)?e.worktree:{},n=rt(t.setup),r=rt(t.teardown),i=Object.entries(nt(e?.scripts)?e.scripts:{}).map(([e,t])=>{let n=nt(t)?t:{},r=rt(n.command);return{id:ct(),name:e,commandText:r.text,commandKind:r.kind,type:typeof n.type==`string`?n.type:``,portText:at(n.port),raw:n}}),a=nt(e?.metadataGeneration)?e.metadataGeneration:void 0,o={branchName:``,commitMessage:``,pullRequest:``};for(let e of et){let t=a?.[e];nt(t)&&typeof t.instructions==`string`&&(o[e]=t.instructions)}return{setupText:n.text,setupKind:n.kind,teardownText:r.text,teardownKind:r.kind,scripts:i,prompts:o,metadataBase:a}}var ut=(e,t,n)=>{n===void 0?delete e[t]:e[t]=n};function dt(e,t){let n={...t??{}},r={...nt(n.worktree)?n.worktree:{}};ut(r,`setup`,it(e.setupText,e.setupKind)),ut(r,`teardown`,it(e.teardownText,e.teardownKind));let i={};for(let t of e.scripts){let e=t.name.trim();if(!e)continue;let n={...t.raw};ut(n,`command`,it(t.commandText,t.commandKind)),ut(n,`type`,t.type.trim()||void 0),ut(n,`port`,ot(t.portText)),i[e]=n}let a={...e.metadataBase??{}};for(let t of et){let n=e.prompts[t],r={...nt(e.metadataBase?.[t])?e.metadataBase[t]:{}};n.trim()?r.instructions=n:delete r.instructions,ut(a,t,Object.keys(r).length?r:void 0)}return ut(n,`worktree`,Object.keys(r).length?r:void 0),ut(n,`scripts`,Object.keys(i).length?i:void 0),ut(n,`metadataGeneration`,Object.keys(a).length?a:void 0),n}function ft(e){return{name:e.name.trim()?``:`Name is required`,command:e.commandText.trim()?``:`Command is required`}}var pt=e=>{let t=ft(e);return!t.name&&!t.command};function mt(e){return[e.type,e.portText&&`port ${e.portText}`,e.commandText.split(`
|
|
6
|
+
`)[0]].filter(Boolean).join(` · `)}var ht={class:`sheet-head`},gt={class:`ps-title`},_t={class:`ps-title-row`},vt={class:`path-hint`},yt={key:0,class:`sheet-note`},bt={key:1,class:`ps-callout is-error`,role:`alert`},xt={class:`ps-group`,"aria-labelledby":`ps-worktree`},St={class:`ps-section`},Ct={key:0,class:`ps-callout is-warn`},wt={class:`ps-section`},Tt={class:`ps-group`,"aria-labelledby":`ps-scripts`},Et={class:`ps-group-head`},Dt={class:`card ps-scripts`},Ot={key:0,class:`card-row row-sub`},kt=[`onClick`],At={class:`row-title`},jt={class:`row-sub`},Mt={class:`ps-script-more`},Nt=[`aria-label`,`onClick`],Pt=[`onClick`],Ft=[`onClick`],It={class:`ps-group`,"aria-labelledby":`ps-metadata`},Lt={class:`ps-section-head`},Rt=[`for`],zt=[`id`,`onUpdate:modelValue`,`placeholder`],Q={key:0,class:`ps-callout is-error`,role:`alert`},Bt={key:1,class:`ps-callout is-error`,role:`alert`},Vt={class:`sheet-foot`},Ht={key:0,class:`sheet-note sheet-reset ps-saved`},Ut={key:1,class:`sheet-note sheet-reset ps-saved`},Wt=[`disabled`],Gt=[`disabled`],Kt=[`onKeydown`],qt=[`aria-label`],Jt={class:`sheet-head`},Yt={class:`sheet-body`},Xt={class:`field`},Zt={key:0,class:`ps-field-error`},Qt={class:`field`},$t={key:1,class:`ps-field-error`},en={class:`switch-row ps-service`},tn=[`checked`],nn=`https://paseo.sh/docs/worktrees`,rn=f({__name:`ProjectSettings`,props:{hostId:{},hostLabel:{},project:{},rootPath:{},customIcons:{type:Boolean},request:{type:Function}},emits:[`close`],setup(r,{emit:o}){let s=r,l=o,f={branchName:{title:`Branch names`,placeholder:`Prefix branches with feat/ or fix/, mb/ for personal branches`},commitMessage:{title:`Commit messages`,placeholder:`Use Conventional Commits with a scope`},pullRequest:{title:`Pull requests`,placeholder:`Lead with a one-paragraph summary, include a Test plan section`}},p=e(!0),h=e(!1),g=e(``),y=e(null),w=e(!1),T=e(!1),E=e(!1),O=e(null),A=e(lt(null)),j=e(``),N=S(()=>`/hosts/${encodeURIComponent(s.hostId)}/project-config`),I=e=>e.replace(/^\/(home|Users)\/[^/]+(?=\/|$)/,`~`),L=S(()=>JSON.stringify(dt(A.value,O.value?.config))),B=S(()=>!!O.value&&L.value!==j.value),V=S(()=>A.value.scripts.some(e=>!pt(e))),H=S(()=>y.value?.code===`stale_project_config`);n(L,()=>w.value=E.value=!1);function U(e){O.value=e,A.value=lt(e.config),j.value=JSON.stringify(dt(A.value,e.config))}async function W(){p.value=!0,g.value=``,y.value=null;try{U(await s.request(`${N.value}?root=${encodeURIComponent(s.rootPath)}`))}catch(e){g.value=String(e.message)}finally{p.value=!1}}async function G(){if(!(!O.value||h.value||H.value||V.value)){h.value=!0,y.value=null;try{U(await s.request(N.value,`PUT`,{root:O.value.rootPath,config:dt(A.value,O.value.config),revision:O.value.revision})),w.value=!0}catch(e){let t=e;y.value={code:t.code??``,message:t.message}}finally{h.value=!1}}}function K(){if(!h.value){if(T.value)return void(T.value=!1);if(q.value)return se();(!B.value||confirm(`Discard your unsaved project settings?`))&&l(`close`)}}let q=e(null),ee=u({name:!1,command:!1}),te=e(null),ne=e(null),re=S(()=>{let e=q.value;if(!e)return{name:``,command:``};let t=ft(e),n=e.name.trim();return!t.name&&A.value.scripts.some(t=>t.id!==e.id&&t.name.trim()===n)&&(t.name=`Another script already has this name`),t}),ie=null;function ae(e){te.value=null,q.value=e,ie={name:e.name,commandText:e.commandText,type:e.type},ee.name=ee.command=!1,C(()=>ne.value?.focus())}function oe(){let e={id:ct(),name:``,commandText:``,commandKind:`missing`,type:``,portText:``,raw:{}};A.value.scripts.push(e),ae(A.value.scripts[A.value.scripts.length-1])}function se(){let e=q.value;e&&ie&&Object.assign(e,ie),!e||e.name.trim()||e.commandText.trim()||e.type.trim()||e.portText.trim()||(A.value.scripts=A.value.scripts.filter(t=>t.id!==e.id)),q.value=null}function ce(){re.value.name||re.value.command?ee.name=ee.command=!0:q.value=null}function le(e){te.value=null,confirm(`Remove ${e.name||`this script`}?`)&&(A.value.scripts=A.value.scripts.filter(t=>t.id!==e.id))}function ue(e){q.value&&(q.value.type=e.target.checked?tt:``)}function de(e){(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),!q.value&&!T.value&&G())}return c(W),(e,n)=>(i(),R(`div`,{class:`overlay`,onMousedown:v(K,[`self`]),onKeydown:[P(K,[`esc`]),de]},[x(`form`,{class:`sheet project-settings`,role:`dialog`,"aria-modal":`true`,"aria-label":`Project settings`,onSubmit:v(G,[`prevent`])},[x(`header`,ht,[x(`div`,gt,[x(`div`,_t,[t(Ie,{name:r.project.name,size:28,source:{hostId:r.hostId,rootPath:r.rootPath,projectId:r.project.projectId,projectIconRevision:r.project.iconRevision}},null,8,[`name`,`source`]),x(`h2`,null,k(r.project.name),1),r.project.projectId?(i(),R(`button`,{key:0,type:`button`,class:`icon-btn ps-edit`,"aria-label":`Edit project`,title:`Edit project`,onClick:n[0]||=e=>T.value=!0},[t(J,{name:`edit`,size:14})])):F(``,!0)]),x(`p`,vt,[t(J,{name:`server`,size:12}),d(k(r.hostLabel)+` · `+k(I(r.rootPath)),1)])]),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:K},[t(J,{name:`close`,size:16})])]),x(`div`,{class:`sheet-body ps-body`,onClick:n[4]||=e=>te.value=null},[p.value?(i(),R(`p`,yt,[...n[11]||=[x(`span`,{class:`spinner`},null,-1),d(` Reading paseo.json…`,-1)]])):g.value?(i(),R(`div`,bt,[x(`p`,null,[t(J,{name:`alert`,size:14}),d(k(g.value),1)]),x(`button`,{type:`button`,class:`btn btn-outline`,onClick:W},`Reload`)])):(i(),R(b,{key:2},[x(`section`,xt,[n[16]||=x(`h3`,{id:`ps-worktree`},`Worktree lifecycle hooks`,-1),n[17]||=x(`p`,{class:`ps-info`},`Commands that run when a worktree is created or torn down for this project`,-1),x(`div`,St,[x(`div`,{class:`ps-section-head`},[n[12]||=x(`label`,{for:`ps-setup`},`Setup`,-1),x(`a`,{href:nn,target:`_blank`,rel:`noopener`,title:`See docs for more details and the environment variables available to these commands`},`Docs`)]),O.value?.uncommittedSetup?(i(),R(`div`,Ct,[x(`p`,null,[t(J,{name:`alert`,size:14}),n[13]||=x(`b`,null,`Commit paseo.json changes`,-1)]),n[14]||=x(`p`,{class:`ps-callout-sub`},`New worktrees use the setup script from the base branch you select.`,-1)])):F(``,!0),a(x(`textarea`,{id:`ps-setup`,"onUpdate:modelValue":n[1]||=e=>A.value.setupText=e,class:`ps-code`,placeholder:`npm install`,spellcheck:`false`,"aria-label":`Worktree setup commands`},null,512),[[_,A.value.setupText]])]),x(`div`,wt,[x(`div`,{class:`ps-section-head`},[n[15]||=x(`label`,{for:`ps-teardown`},`Teardown`,-1),x(`a`,{href:nn,target:`_blank`,rel:`noopener`,title:`See docs for more details and the environment variables available to these commands`},`Docs`)]),a(x(`textarea`,{id:`ps-teardown`,"onUpdate:modelValue":n[2]||=e=>A.value.teardownText=e,class:`ps-code`,placeholder:`docker compose down`,spellcheck:`false`,"aria-label":`Worktree teardown commands`},null,512),[[_,A.value.teardownText]])])]),x(`section`,Tt,[x(`div`,Et,[n[18]||=x(`h3`,{id:`ps-scripts`},`Scripts`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Add script`,title:`Add script`,onClick:oe},[t(J,{name:`plus`,size:15})])]),n[21]||=x(`p`,{class:`ps-info`},`Long-running services and one-off commands you can launch from any agent in this project`,-1),x(`div`,Dt,[A.value.scripts.length?F(``,!0):(i(),R(`div`,Ot,`No scripts yet.`)),(i(!0),R(b,null,z(A.value.scripts,e=>(i(),R(`div`,{key:e.id,class:M([`card-row ps-script`,{invalid:!D(pt)(e)}])},[x(`button`,{type:`button`,class:`ps-script-main`,onClick:t=>ae(e)},[x(`span`,At,k(e.name||`Untitled script`),1),x(`span`,jt,k(D(mt)(e)||`No command`),1)],8,kt),x(`div`,Mt,[x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Open script menu for `+(e.name||`untitled script`),onClick:v(t=>te.value=te.value===e.id?null:e.id,[`stop`])},[t(J,{name:`more-v`,size:15})],8,Nt),te.value===e.id?(i(),R(`div`,{key:0,class:`menu ps-menu`,role:`menu`,onClick:n[3]||=v(()=>{},[`stop`])},[x(`button`,{type:`button`,role:`menuitem`,onClick:t=>ae(e)},[t(J,{name:`edit`,size:14}),n[19]||=d(`Edit`,-1)],8,Pt),x(`button`,{type:`button`,role:`menuitem`,class:`menu-danger`,onClick:t=>le(e)},[t(J,{name:`trash`,size:14}),n[20]||=d(`Remove`,-1)],8,Ft)])):F(``,!0)])],2))),128))])]),x(`section`,It,[n[22]||=x(`h3`,{id:`ps-metadata`},`Metadata generation`,-1),n[23]||=x(`p`,{class:`ps-info`},` Project-specific instructions injected into the AI prompts Paseo uses to generate metadata — use them to enforce your team's conventions like branch naming, commit style, or PR format `,-1),(i(!0),R(b,null,z(D(et),e=>(i(),R(`div`,{key:e,class:`ps-section`},[x(`div`,Lt,[x(`label`,{for:`ps-prompt-`+e},k(f[e].title),9,Rt)]),a(x(`textarea`,{id:`ps-prompt-`+e,"onUpdate:modelValue":t=>A.value.prompts[e]=t,placeholder:f[e].placeholder},null,8,zt),[[_,A.value.prompts[e]]])]))),128))]),H.value?(i(),R(`div`,Q,[x(`p`,null,[t(J,{name:`alert`,size:14}),n[24]||=x(`b`,null,`Config changed on disk`,-1)]),n[25]||=x(`p`,{class:`ps-callout-sub`},`Reload to fetch the latest paseo.json before saving. Your unsaved edits will be replaced.`,-1),x(`button`,{type:`button`,class:`btn btn-outline`,onClick:W},`Reload`)])):y.value?(i(),R(`div`,Bt,[x(`p`,null,[t(J,{name:`alert`,size:14}),d(k(y.value.message),1)]),x(`div`,{class:`ps-callout-actions`},[x(`button`,{type:`button`,class:`btn btn-outline`,onClick:G},`Try again`),x(`button`,{type:`button`,class:`btn btn-outline`,onClick:W},`Reload`)])])):F(``,!0)],64))]),x(`footer`,Vt,[E.value&&!w.value?(i(),R(`span`,Ht,[t(J,{name:`check`,size:14}),n[26]||=d(`Project updated`,-1)])):F(``,!0),w.value&&!B.value?(i(),R(`span`,Ut,[t(J,{name:`check`,size:14}),n[27]||=d(`Project saved`,-1)])):F(``,!0),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:h.value,onClick:K},k(B.value?`Cancel`:`Close`),9,Wt),x(`button`,{class:`btn btn-primary`,disabled:p.value||!!g.value||h.value||!B.value||H.value||V.value},k(h.value?`Saving…`:`Save`),9,Gt)])],32),T.value?(i(),m($e,{key:0,"host-id":r.hostId,"root-path":r.rootPath,project:r.project,"custom-icons":r.customIcons,request:r.request,onSaved:n[5]||=e=>(E.value=!0,w.value=!1),onClose:n[6]||=e=>T.value=!1},null,8,[`host-id`,`root-path`,`project`,`custom-icons`,`request`])):F(``,!0),q.value?(i(),R(`div`,{key:1,class:`overlay ps-script-overlay`,onMousedown:v(se,[`self`]),onKeydown:P(v(se,[`stop`]),[`esc`])},[x(`form`,{class:`sheet sheet-small`,role:`dialog`,"aria-modal":`true`,"aria-label":q.value.name?`Edit `+q.value.name:`New script`,onSubmit:v(ce,[`prevent`])},[x(`header`,Jt,[x(`h2`,null,k(q.value.name.trim()?`Edit `+q.value.name.trim():`New script`),1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:se},[t(J,{name:`close`,size:16})])]),x(`div`,Yt,[x(`label`,Xt,[n[28]||=x(`span`,null,`Name`,-1),a(x(`input`,{ref_key:`nameInput`,ref:ne,"onUpdate:modelValue":n[7]||=e=>q.value.name=e,placeholder:`dev`,spellcheck:`false`,autocapitalize:`off`,"aria-label":`Script name`,onBlur:n[8]||=e=>ee.name=!0},null,544),[[_,q.value.name]])]),ee.name&&re.value.name?(i(),R(`p`,Zt,k(re.value.name),1)):F(``,!0),x(`label`,Qt,[n[29]||=x(`span`,null,`Command`,-1),a(x(`textarea`,{"onUpdate:modelValue":n[9]||=e=>q.value.commandText=e,class:`ps-code`,placeholder:`npm run dev`,spellcheck:`false`,"aria-label":`Script command`,onBlur:n[10]||=e=>ee.command=!0},null,544),[[_,q.value.commandText]])]),ee.command&&re.value.command?(i(),R(`p`,$t,k(re.value.command),1)):F(``,!0),x(`label`,en,[n[30]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`Run as a service`),x(`div`,{class:`row-sub`},`Paseo supervises the process and assigns a port via $PASEO_PORT`)],-1),x(`input`,{class:`switch`,type:`checkbox`,checked:q.value.type===D(tt),"aria-label":`Run as a service`,onChange:ue},null,40,tn)])]),x(`footer`,{class:`sheet-foot`},[x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:se},`Cancel`),n[31]||=x(`button`,{class:`btn btn-primary`},`Save`,-1)])],40,qt)],40,Kt)):F(``,!0)],32))}}),an=`litepaseo-composer-v1:`,on=an+`draft:`,sn=an+`message:`,cn=class{warning=e(``);revision=e(0);generation=0;drafts=u(new Map);pending=u(new Map);owner=crypto.randomUUID();storage;savedIndex=new Map;messageIndex=new Map;slotKey=new Map;constructor(e,t=Date.now()){try{this.storage=e()}catch{this.storage=null,this.unavailable()}this.rescan(t)}unavailable(){this.warning.value=`Draft storage is unavailable. Keep this tab open to retain your text.`}attempt(e,t){if(!this.storage)return t;try{return e(this.storage)}catch{return this.unavailable(),t}}decode(e){try{return JSON.parse(e)}catch{return null}}slot(e){return`${on}${this.owner}:${encodeURIComponent(e)}`}rescan(e=Date.now()){this.savedIndex.clear(),this.messageIndex.clear(),this.slotKey.clear();let t=this.attempt(e=>{let t=[];for(let n=0;n<e.length;n++){let r=e.key(n);r?.startsWith(an)&&t.push([r,e.getItem(r)])}return t},[]),n=[];for(let[r,i]of t){let t=r.startsWith(on)?this.decode(i):null;t&&Number.isFinite(t.updated)&&e-t.updated>2592e6?n.push(r):this.apply(r,i)}for(let[e]of this.savedIndex)n.push(...this.excess(e));for(let e of n)this.remove(e);this.revision.value++}excess(e){let t=this.savedIndex.get(e);return!t||t.size<=8?[]:[...t].sort((e,t)=>t[1].updated-e[1].updated).slice(8).map(([e])=>e).filter(t=>t!==this.slot(e))}apply(e,t){let n=this.slotKey.get(e);if(n!==void 0){this.slotKey.delete(e);let t=this.savedIndex.get(n);t?.delete(e),t&&!t.size&&this.savedIndex.delete(n);let r=this.messageIndex.get(n);r?.delete(e),r&&!r.size&&this.messageIndex.delete(n)}if(t===null)return;let r=this.decode(t);if(typeof r?.key==`string`&&typeof r.text==`string`){if(e.startsWith(on)){if(!r.text||!Number.isFinite(r.updated))return;let n=this.savedIndex.get(r.key);n||this.savedIndex.set(r.key,n=new Map),n.set(e,{key:r.key,text:r.text,updated:r.updated,restoredFrom:r.restoredFrom,raw:t})}else if(e.startsWith(sn)){if(typeof r.messageId!=`string`)return;let t=this.messageIndex.get(r.key);t||this.messageIndex.set(r.key,t=new Map),t.set(e,r)}else return;this.slotKey.set(e,r.key)}}write(e,t){this.storage.setItem(e,t),this.apply(e,t)}remove(e){this.attempt(t=>(t.removeItem(e),!0),!1),this.apply(e,null)}onStorage(e,t){if(e===null)return this.rescan();e.startsWith(an)&&(this.apply(e,t),this.revision.value++)}saved(e){this.revision.value;let t=this.savedIndex.get(e);return t?[...t].map(([e,{raw:t,...n}])=>({...n,slot:e})).sort((e,t)=>t.updated-e.updated):[]}state(e){let t=this.drafts.get(e);if(!t){let n=this.saved(e)[0];this.drafts.set(e,{text:n?.text??``,restoredFrom:n?.restoredFrom,source:n?.slot,sourceValue:n?this.savedIndex.get(e)?.get(n.slot)?.raw:void 0}),t=this.drafts.get(e)}return t}setText(e,t,n){let r=this.state(e);r.text=t,r.restoredFrom=n,this.attempt(i=>(t&&this.write(this.slot(e),JSON.stringify({key:e,text:t,restoredFrom:n,updated:Date.now()})),r.source&&i.getItem(r.source)===r.sourceValue&&this.remove(r.source),r.source=r.sourceValue=void 0,t||this.remove(this.slot(e)),!0),!1),this.revision.value++}restore(e,t){let n=this.saved(e).find(e=>e.slot===t);if(!n)return;let r=this.state(e).text;r&&r!==n.text&&this.attempt(()=>{this.write(`${on}${crypto.randomUUID()}:${encodeURIComponent(e)}`,JSON.stringify({key:e,text:r,updated:Date.now()}));for(let t of this.excess(e))this.remove(t);return!0},!1),this.setText(e,n.text)}unresolved(e){this.revision.value;let t=new Map((this.pending.get(e)??[]).map(e=>[e.messageId,e]));for(let n of this.messageIndex.get(e)?.values()??[])t.set(n.messageId,n);return[...t.values()]}begin(e,t){this.attempt(()=>(this.write(sn+t.messageId,JSON.stringify({key:e,...t})),!0),!1)||this.pending.set(e,[...this.unresolved(e),t]),this.revision.value++}resolve(e,t){this.pending.set(e,(this.pending.get(e)??[]).filter(e=>e.messageId!==t)),this.remove(sn+t),this.revision.value++}restoreFailed(e,t){this.state(e).text||this.setText(e,t.text,t.messageId)}confirm(e,t){this.state(e).restoredFrom===t&&this.setText(e,``),this.resolve(e,t)}refresh(){this.rescan()}clear(){this.generation++;for(let e of[...this.slotKey.keys()])this.remove(e);this.attempt(e=>{let t=[];for(let n=0;n<e.length;n++){let r=e.key(n);r?.startsWith(an)&&t.push(r)}for(let n of t)e.removeItem(n);return!0},!1),this.drafts.clear(),this.pending.clear(),this.revision.value++}},ln=3e3,un=2500,dn=class{rows=[];epoch=``;hasOlder=!1;startCursor=null;ready=!1;membership=y(0);apply(e){let t=!1;for(let n of e)if(n.type===`reset`)this.rows=n.rows.map(e=>({seqStart:e.seqStart,row:y(e)})),this.epoch=n.epoch,this.hasOlder=n.hasOlder,this.startCursor=n.startCursor,this.ready=!0,t=!0;else if(n.type===`upsert`){let e=this.find(n.row.seqStart);e>=0?this.rows[e].row.value=n.row:(this.insert({seqStart:n.row.seqStart,row:y(n.row)}),t=!0)}else if(n.type===`append`){let e=this.find(n.seqStart);if(e<0)continue;let t=this.rows[e].row,r=t.value;t.value={...r,seqEnd:n.seqEnd,timestamp:n.timestamp,item:{...r.item,text:(r.item.text??``)+n.text}}}this.rows.length>ln&&(this.rows=this.rows.slice(this.rows.length-un),this.hasOlder=!0,this.startCursor={epoch:this.epoch,seq:this.rows[0].seqStart},t=!0),t&&this.membership.value++}find(e){let t=0,n=this.rows.length;if(n&&this.rows[n-1].seqStart===e)return n-1;for(;t<n;){let r=t+n>>>1;this.rows[r].seqStart<e?t=r+1:n=r}return this.rows[t]?.seqStart===e?t:-1}insert(e){let t=this.rows.at(-1);if(!t||t.seqStart<e.seqStart)return void this.rows.push(e);let n=0,r=this.rows.length;for(;n<r;){let t=n+r>>>1;this.rows[t].seqStart<e.seqStart?n=t+1:r=t}this.rows.splice(n,0,e)}};function fn(e,t,n){let r=n===`before`,i=r?e[0]?.seqStart:e.at(-1)?.seqStart,a=t.rows.filter(e=>i===void 0||(r?e.seqStart<i:e.seqStart>i)),o=(r?a.slice(-100):a.slice(0,100)).map(e=>({seqStart:e.seqStart,row:y(e)})),s=r?[...o,...e]:[...e,...o];return{rows:r?s.slice(0,150):s.slice(-150),hasOlder:!r||t.hasOlder||a.length>100,added:o.length}}var pn=[`onPointerenter`],mn=[`aria-label`,`aria-current`,`onClick`],hn={key:0,class:`outline-preview`,"aria-hidden":`true`},gn=150,_n=3,vn=f({__name:`ChatOutline`,props:{prompts:{},activeSeq:{}},emits:[`jump`],setup(t,{emit:n}){let r=t,a=n,o=e(null),c=e(!1),l;function u(e){o.value=e,c.value||l||(l=setTimeout(()=>{l=void 0,c.value=!0},gn))}function d(){clearTimeout(l),l=void 0,o.value=null,c.value=!1}s(d);function f(e){if(o.value===null)return 0;let t=Math.abs(e-o.value);return t>=_n?0:(1+Math.cos(Math.PI*t/_n))/2}let p=S(()=>{let e=r.activeSeq;if(e===null)return-1;let t=-1;for(let n=0;n<r.prompts.length&&r.prompts[n].seq<=e;n++)t=n;return t});function m(e){let t=e===p.value?18:10,n=f(e);return{width:`${t+n*(26-t)}px`,height:`${2+2*n}px`}}function h(e){a(`jump`,r.prompts[e].seq)}return(e,n)=>(i(),R(`nav`,{class:`outline-rail`,"aria-label":`Prompts in this conversation`,onPointerleave:d},[(i(!0),R(b,null,z(t.prompts,(e,n)=>(i(),R(`div`,{key:e.seq,class:`outline-slot`,onPointerenter:e=>u(n)},[x(`button`,{type:`button`,class:`outline-target`,"aria-label":`${n+1} of ${t.prompts.length}: ${e.preview}`,"aria-current":n===p.value?`location`:void 0,onClick:e=>h(n)},[x(`span`,{class:M([`outline-tick`,{"is-active":n===p.value,"is-pointed":c.value&&n===o.value}]),style:g(m(n))},null,6)],8,mn),c.value&&n===o.value?(i(),R(`div`,hn,k(e.preview||`(no text)`),1)):F(``,!0)],40,pn))),128))],32))}}),yn=[`src`],bn=f({__name:`ImagePreview`,props:{src:{}},emits:[`close`],setup(n,{emit:r}){let a=r,o=e(null),s=e(null),u=document.activeElement;return c(()=>o.value?.focus({preventScroll:!0})),l(()=>{u instanceof HTMLElement&&u.isConnected&&u.focus({preventScroll:!0})}),(e,r)=>(i(),R(`div`,{ref_key:`viewport`,ref:o,class:`lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":`Image`,tabindex:`0`,onClick:r[1]||=v(e=>a(`close`),[`self`]),onKeydown:[r[2]||=v(()=>{},[`stop`]),r[3]||=P(v(e=>a(`close`),[`stop`]),[`esc`]),r[4]||=P(v(e=>s.value?.focus(),[`prevent`]),[`tab`])]},[x(`button`,{ref_key:`closeButton`,ref:s,class:`lightbox-close`,"aria-label":`Close image`,onClick:r[0]||=e=>a(`close`)},[t(J,{name:`close`,size:22})],512),x(`img`,{src:n.src,alt:`Image preview`},null,8,yn)],544))}}),xn=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Sn=xn(bn,[[`__scopeId`,`data-v-284e49c2`]]),Cn=1e3,wn=3e4;function Tn(e){let t=!1,n=null,r,i=Cn,a=t=>e.onState?.(t),o=async()=>{if(t||document.hidden||n)return;clearTimeout(r),r=void 0;let s=n=new AbortController;a(`connecting`);try{let n=await fetch(e.url(),{headers:{accept:`text/event-stream`},signal:s.signal});if(n.status===401){t=!0,a(`unauthorized`);return}if(!n.ok||!n.body)throw Error(`Stream unavailable`);a(`live`);let r=n.body.pipeThrough(new TextDecoderStream).getReader(),o=``;for(;;){let{value:t,done:n}=await r.read();if(n)break;o+=t;let a;for(;(a=o.indexOf(`
|
|
7
|
+
|
|
8
|
+
`))>=0;){let t=o.slice(0,a);o=o.slice(a+2);let n=``;for(let e of t.split(`
|
|
9
|
+
`))e.startsWith(`data: `)&&(n+=(n?`
|
|
10
|
+
`:``)+e.slice(6));n&&(i=Cn,e.onMessage(JSON.parse(n)))}}}catch{}finally{n===s&&(n=null)}if(t)return a(`closed`);if(document.hidden)return a(`paused`);a(`connecting`),r=setTimeout(()=>void o(),i),i=Math.min(i*2,wn)},s=()=>{document.hidden?(n?.abort(),clearTimeout(r),a(`paused`)):(i=Cn,o())};return document.addEventListener(`visibilitychange`,s),o(),{close(){t=!0,clearTimeout(r),document.removeEventListener(`visibilitychange`,s),n?.abort()}}}var En=Symbol(`litepaseo-timeline`),Dn=e=>typeof e==`string`&&e.length>0?e:void 0;function On(e,t){if(!t||!e)return e;let n=t.replace(/\\/g,`/`).replace(/\/+$/,``),r=e.replace(/\\/g,`/`);return r.startsWith(n+`/`)?r.slice(n.length+1):r===n?`.`:e}var kn=e=>{let t=e.trim();return!t||/[:./]/.test(t)||t.includes(`__`)?t||`Tool`:t.replace(/[._-]+/g,` `).split(` `).filter(Boolean).join(` `).toLowerCase().replace(/^./,e=>e.toUpperCase())};function An(e){let t=e.split(/&&|\|\||;|\|/).map(e=>e.trim()).filter(Boolean);for(let e of t){let t=e.split(/\s+/).filter(e=>!/^[A-Z_][A-Z0-9_]*=/.test(e)),n=(t[0]??``).replace(/^.*\//,``);if(n&&n!==`cd`&&n!==`timeout`&&n!==`sudo`&&n!==`env`)return n;if(n===`timeout`||n===`sudo`||n===`env`){let e=t.slice(1).find(e=>!/^-|^\d+[smh]?$/.test(e));if(e)return e.replace(/^.*\//,``)}}return``}var jn=[[/^(npm|npx|pnpm|yarn|bun|bunx)$/,`npm`],[/^(node|deno|tsx|ts-node|vitest|jest)$/,`js`],[/^(rg|grep|egrep|find|fd|ag|ls|tree|locate)$/,`search`],[/^git$/,`branch`],[/^(curl|wget|http)$/,`globe`],[/^(cat|head|tail|less|sed|awk|wc|jq)$/,`terminal`]],$=e=>{let t=An(e);return jn.find(([e])=>e.test(t))?.[1]??`terminal`};function Mn(e){return e.replace(/(?:~|\/)[^\s'"`]*\/[^\s'"`]*/g,e=>{let t=e.split(`/`);return t.length>5?[...t.slice(0,4),`…`,t[t.length-1]||t[t.length-2]+`/`].join(`/`):e})}var Nn=e=>{let t=typeof e==`string`?e:``;return t?t.split(`
|
|
11
|
+
`).length-+!!t.endsWith(`
|
|
12
|
+
`):0},Pn=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Fn(e){if(!e)return``;let t=0,n=0;for(let r of e.split(`
|
|
13
|
+
`))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return t||n?`+${t} −${n}`:``}function In(e,t){let n=e.detail??{},r=n.type===`unknown`&&n.input&&typeof n.input==`object`?n.input:{},i=e=>On(String(e??``),t),a=String(e.name??``),o=(e,t,n,r,i=!1,a=``)=>({kind:e,icon:t,name:n,summary:r,showName:i,meta:a}),s=e=>o(`shell`,$(e),`Run`,Mn(e.split(`
|
|
14
|
+
`)[0]));switch(n.type){case`shell`:return s(String(n.command??``));case`read`:return o(`read`,`eye`,`Read`,i(n.filePath));case`edit`:return o(`edit`,`edit`,`Edit`,i(n.filePath),!1,Fn(zn(e)));case`write`:return o(`write`,`edit`,`Write`,i(n.filePath),!1,n.content?Pn(Nn(n.content),`line`):``);case`search`:return o(`search`,n.toolName===`web_search`?`globe`:`search`,n.toolName===`web_search`?`Search web`:`Search`,String(n.query??``));case`fetch`:return o(`fetch`,`globe`,`Fetch`,String(n.url??``),!0);case`sub_agent`:return o(`sub_agent`,`bot`,Dn(n.subAgentType)??`Task`,Dn(n.description)??``,!0);case`worktree_setup`:return o(`worktree`,`branch`,`Worktree setup`,String(n.branchName??``),!0);case`plain_text`:return o(`plain`,`tool`,kn(a),Dn(n.label)??``,!0);case`plan`:return o(`plan`,`list`,`Plan`,``,!0)}let c=a.toLowerCase(),l=Dn(r.path)??Dn(r.file_path)??Dn(r.filePath),u=Dn(r.command)??Dn(r.cmd)??l??Dn(r.pattern)??Dn(r.query)??Dn(r.url)??Dn(r.description)??``;return/^(bash|shell|exec|run|terminal)/.test(c)?s(u):/^(read|view|cat)/.test(c)?o(`read`,`eye`,`Read`,i(u)):/^(edit|patch|apply|multiedit|str_replace)/.test(c)?o(`edit`,`edit`,`Edit`,i(u),!1,Fn(zn(e))):/^write/.test(c)?o(`write`,`edit`,`Write`,i(u),!1,r.content?Pn(Nn(r.content),`line`):``):/(grep|glob|find|search|ls)$/.test(c)?o(`search`,`search`,`Search`,u):/fetch|browse|http/.test(c)?o(`fetch`,`globe`,`Fetch`,u,!0):c===`thinking`?o(`plain`,`bulb`,`Thinking`,``,!0):c===`task`||c===`subagent`||c===`subagents`?o(`sub_agent`,`bot`,`Task`,u,!0):o(`unknown`,`tool`,kn(a),u,!0)}function Ln(e){return(e.split(`
|
|
15
|
+
`).map(e=>e.trim()).find(Boolean)??``).replace(/^#+\s*/,``).replace(/\*\*|__|`/g,``).slice(0,300)}function Rn(e){let t=e.detail??{};if(t.type===`shell`)return String(t.output??``);if(t.type===`read`||t.type===`write`)return String(t.content??``);if(t.type===`search`)return String(t.content??(t.filePaths??[]).join(`
|
|
16
|
+
`));if(t.type===`fetch`)return String(t.result??``);if(t.type===`sub_agent`)return String(t.log??``);if(t.type===`plain_text`||t.type===`plan`)return String(t.text??``);if(t.type===`worktree_setup`)return String(t.log??``);if(t.type===`unknown`){let e=t.output;if(typeof e==`string`)return e;let n=Array.isArray(e?.content)?e.content.filter(e=>e.type===`text`).map(e=>String(e.text)):[];return n.length?n.join(`
|
|
17
|
+
`):e==null?``:JSON.stringify(e,null,2)}return``}function zn(e){let t=e.detail??{},n=(e,t)=>String(e??``).split(`
|
|
18
|
+
`).filter((e,t,n)=>t<n.length-1||n[t]!==``).map(e=>t+e),r=(e,t)=>[...n(e,`-`),...n(t,`+`)];if(t.type===`edit`)return Dn(t.unifiedDiff)?t.unifiedDiff:t.oldString===void 0&&t.newString===void 0?``:r(t.oldString,t.newString).join(`
|
|
19
|
+
`);let i=t.type===`unknown`&&t.input&&typeof t.input==`object`?t.input:null;if(!i)return``;let a=Array.isArray(i.edits)?i.edits:[i],o=[];for(let e of a){let t=e.oldText??e.old_string??e.oldString,n=e.newText??e.new_string??e.newString;(t!==void 0||n!==void 0)&&(o.length&&o.push(`@@`),o.push(...r(t,n)))}return o.join(`
|
|
20
|
+
`)}function Bn(e){if(!Number.isFinite(e)||e<0)return`0s`;let t=e/1e3;if(t<60)return`${Math.floor(t)}s`;let n=Math.floor(t/60);if(n<60){let e=Math.floor(t)%60;return e?`${n}m ${e}s`:`${n}m`}let r=Math.floor(n/60),i=n%60;return i?`${r}h ${i}m`:`${r}h`}var Vn=e=>e.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}),Hn=e=>Math.floor((e.getTime()-e.getTimezoneOffset()*6e4)/864e5);function Un(e,t=new Date){let n=Vn(e),r=Hn(t)-Hn(e);return r===0?n:r===-1?`Tomorrow ${n}`:r<7&&r>-7?`${e.toLocaleDateString(void 0,{weekday:`long`})} ${n}`:`${e.toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}, ${n}`}function Wn(e,t=Date.now()){if(!e)return``;let n=Math.max(0,(t-e)/1e3);return n<60?`now`:n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:n<604800?`${Math.floor(n/86400)}d`:n<3024e3?`${Math.floor(n/86400/7)}w`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Gn(e,t,n=new Date){let r=new Map,i=null,a=e=>{if(!i||!e)return;let t=Date.parse(i.last.timestamp);if(!Number.isFinite(t))return;let a=i.first.item.type===`user_message`?Date.parse(i.first.timestamp):NaN;r.set(i.last.seqStart,{at:Un(new Date(t),n),took:Number.isFinite(a)&&t>=a?Bn(t-a):``,messages:i.messages})};for(let t of e)t.turnId&&(i&&i.id!==t.turnId&&(a(!0),i=null),i??={id:t.turnId,first:t,last:t,messages:[]},i.last=t,t.item.type===`assistant_message`&&i.messages.push(t.seqStart));return a(t),r}var Kn=/!\[([^\]\n]*)\]\(\s*<?([^)\s>]+)>?(\s+"[^"]*")?\s*\)/g,qn=/\.(png|jpe?g|webp|gif|bmp|avif)$/i;function Jn(e,t){return e.includes(`}${i})`:e}):e}var Yn=[`aria-expanded`,`onClick`,`onContextmenu`],Xn={class:`group-lead`},Zn={class:`group-name`},Qn={class:`group-name-text`},$n=[`title`],er=[`title`],tr={key:0,class:`group-flag is-attention`},nr={key:1,class:`status-dot is-error`},rr={key:2,class:`status-dot is-running`},ir={key:3,class:`status-dot is-unread`},ar={key:1,class:`group-count`},or=[`aria-label`,`title`,`onClick`],sr=[`aria-label`,`onClick`],cr=[`onClick`,`onContextmenu`,`onPointerdown`,`onMouseenter`],lr={class:`session-dot`},ur={class:`session-title`},dr=[`title`],fr={key:0,class:`session-project`},pr={key:1,class:`pill pill-attention`},mr={key:2,class:`session-age`},hr=[`aria-label`,`onClick`],gr={class:`thread-card-title`},_r={key:0,class:`thread-card-off`},vr={key:0},yr={key:0,class:`list-empty`},br=320,xr=500,Sr=f({__name:`SessionList`,props:{store:{},mode:{},hostLabels:{},hostStates:{},selectedKey:{},searching:{type:Boolean},queues:{}},emits:[`select`,`new`,`menu`,`projectMenu`],setup(n,{emit:r}){let a=n,o=r,s=e(null),u=e(0),f=e(600),p=0,h,_=S(()=>(a.store.version.value,a.store.size)),y=S(()=>(a.store.version.value,a.mode===`projects`?a.store.groupedHeight:a.store.size*re)),C=S(()=>{a.store.version.value;let e=Math.max(0,u.value-br),t=f.value+br*2;if(a.mode===`projects`)return a.store.groupedRows(e,t);let n=Math.floor(e/re);return a.store.range(n,Math.ceil(t/re)+1).map((e,t)=>({kind:`item`,key:e.key,top:(n+t)*re,item:e}))}),w=e=>[e.attention&&`${e.attention} need you`,e.failed&&`${e.failed} failed`,e.running&&`${e.running} running`,e.unread&&`${e.unread} finished, not viewed`].filter(Boolean).join(` · `),T=e=>e.attention?`is-attention`:e.state===`failed`?`is-error`:e.state===`running`?`is-running`:e.unread||e.state===`unread`?`is-unread`:``,O=e(Date.now()),A,j=e=>{let t=[...e.hosts.keys()];return t.length===1?a.hostLabels.get(t[0])??`Unknown host`:`${t.length} hosts`},N=e=>[...e.hosts.keys()].map(e=>a.hostLabels.get(e)??`Unknown host`).join(`, `),P=e=>e.items.at(0)??null,I=matchMedia(`(hover: hover) and (pointer: fine)`).matches,L=e(null),B,V=e=>e.replace(/^\/(home|Users)\/[^/]+(?=\/|$)/,`~`);function H(e,t){if(!I)return;clearTimeout(B);let n=e.currentTarget.getBoundingClientRect();B=setTimeout(()=>{L.value={thread:t,top:Math.max(8,Math.min(n.top-4,window.innerHeight-170)),left:n.right+10}},L.value?120:550)}function U(){clearTimeout(B),B=setTimeout(()=>L.value=null,80)}let W,G=!1;function K(e,t){if(e.pointerType===`mouse`)return;G=!1,clearTimeout(W);let{clientX:n,clientY:r}=e;W=setTimeout(()=>{G=!0,navigator.vibrate?.(10),o(`menu`,t,n,r)},xr)}function q(){clearTimeout(W)}function ee(e){clearTimeout(B),L.value=null,G?G=!1:o(`select`,e.key)}function te(e,t){let n=e.currentTarget.getBoundingClientRect();o(`menu`,t,n.left,n.bottom+4)}function ne(e,t){let n=e.currentTarget.getBoundingClientRect();o(`projectMenu`,t,n.right-210,n.bottom+4)}function ie(){q(),L.value&&U(),p||=requestAnimationFrame(()=>{p=0,s.value&&(u.value=s.value.scrollTop)})}return c(()=>{let e=s.value;f.value=e.clientHeight||f.value,h=new ResizeObserver(()=>f.value=e.clientHeight||f.value),h.observe(e),A=setInterval(()=>O.value=Date.now(),6e4)}),l(()=>{h?.disconnect(),cancelAnimationFrame(p),clearTimeout(W),clearTimeout(B),clearInterval(A)}),(e,r)=>(i(),R(`div`,{ref_key:`element`,ref:s,class:`session-list`,style:g({"--row-h":D(re)+`px`}),onScrollPassive:ie},[x(`div`,{class:`session-spacer`,style:g({height:y.value+`px`})},[(i(!0),R(b,null,z(C.value,e=>(i(),R(b,{key:e.key},[e.kind===`group`?(i(),R(`div`,{key:0,class:M([`group-row`,{collapsed:e.collapsed}]),style:g({transform:`translateY(${e.top}px)`,height:D(36)-4+`px`})},[x(`button`,{class:`group-toggle`,"aria-expanded":!e.collapsed,onClick:t=>n.store.toggleGroup(e.group.key),onContextmenu:v(t=>o(`projectMenu`,e.group,t.clientX,t.clientY),[`prevent`])},[x(`span`,Xn,[t(Ie,{name:e.group.name,source:P(e.group)},null,8,[`name`,`source`]),t(J,{name:`chevron`,size:14,class:`group-chevron`})]),x(`span`,Zn,[x(`span`,Qn,k(e.group.name),1),e.group.pinnedAt?(i(),m(J,{key:0,name:`pin`,size:11,class:`project-pin`,title:`Pinned project`})):F(``,!0)]),x(`span`,{class:`group-host`,title:N(e.group)},k(j(e.group)),9,$n),D(se)(e.group)===`done`?F(``,!0):(i(),R(`span`,{key:0,class:`group-marks`,title:w(e.group)},[e.group.attention?(i(),R(`span`,tr,k(e.group.attention),1)):F(``,!0),e.group.failed?(i(),R(`span`,nr)):F(``,!0),e.group.running?(i(),R(`span`,rr)):F(``,!0),e.group.unread?(i(),R(`span`,ir)):F(``,!0)],8,er)),e.collapsed?(i(),R(`span`,ar,k(e.group.items.size),1)):F(``,!0)],40,Yn),x(`button`,{class:`group-add`,"aria-label":`New session in `+e.group.name+` on `+j(e.group),title:`New session in `+e.group.name+` on `+j(e.group),onClick:t=>o(`new`,e.group)},[t(J,{name:`plus`,size:14})],8,or),x(`button`,{class:`group-add group-more`,"aria-label":`Actions for project `+e.group.name,title:`Project settings, remove project`,onClick:t=>ne(t,e.group)},[t(J,{name:`more-v`,size:15})],8,sr)],6)):(i(),R(`div`,{key:1,class:M([`session-row`,{chosen:n.selectedKey===e.item.key}]),style:g({transform:`translateY(${e.top}px)`})},[x(`button`,{class:M([`session`,{unread:e.item.unread,chosen:n.selectedKey===e.item.key,offline:n.hostStates.get(e.item.hostId)!==`connected`,nested:n.mode===`projects`}]),onClick:t=>ee(e.item),onContextmenu:v(t=>o(`menu`,e.item,t.clientX,t.clientY),[`prevent`]),onPointerdown:t=>K(t,e.item),onPointerup:q,onPointercancel:q,onPointerleave:q,onMouseenter:t=>H(t,e.item),onMouseleave:U},[x(`span`,lr,[T(e.item)?(i(),R(`span`,{key:0,class:M([`status-dot`,T(e.item)])},null,2)):F(``,!0)]),x(`span`,ur,[e.item.pinnedAt?(i(),m(J,{key:0,name:`pin`,size:11,class:`pin-mark`})):F(``,!0),d(k(e.item.name)+` `,1),n.queues?.[e.item.key]?(i(),R(`small`,{key:1,title:n.queues[e.item.key].paused?`Queue paused`:`Queued messages`},` · `+k(n.queues[e.item.key].paused?`Paused`:`Queued`)+` `+k(n.queues[e.item.key].count),9,dr)):F(``,!0)]),n.mode===`recent`?(i(),R(`span`,fr,k(e.item.project),1)):F(``,!0),e.item.attention?(i(),R(`span`,pr,`Needs you`)):(i(),R(`span`,mr,k(D(Wn)(e.item.activityAt,O.value)),1))],42,cr),x(`button`,{class:`row-more`,"aria-label":`Actions for `+e.item.name,title:`Rename, pin, mark unread, archive`,onClick:v(t=>te(t,e.item),[`stop`])},[t(J,{name:`more`,size:16})],8,hr)],6))],64))),128))],4),(i(),m(E,{to:`body`},[L.value?(i(),R(`div`,{key:0,class:`thread-card`,style:g({top:L.value.top+`px`,left:L.value.left+`px`}),role:`tooltip`},[x(`p`,gr,k(L.value.thread.name),1),x(`p`,null,[t(J,{name:`server`,size:14}),d(k(n.hostLabels.get(L.value.thread.hostId)??`Unknown host`)+` `,1),n.hostStates.get(L.value.thread.hostId)===`connected`?F(``,!0):(i(),R(`span`,_r,`offline`))]),L.value.thread.branch?(i(),R(`p`,vr,[t(J,{name:`branch`,size:14}),d(k(L.value.thread.branch),1)])):F(``,!0),x(`p`,null,[t(J,{name:`folder`,size:14}),d(k(V(L.value.thread.directory||L.value.thread.rootPath)),1)])],4)):F(``,!0)])),_.value?F(``,!0):(i(),R(`div`,yr,k(n.searching?`No threads match.`:`No threads yet. Add a host to get started.`),1))],36))}}),Cr={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},wr=e=>e.replace(/[&<>"']/g,e=>Cr[e]);function Tr(e){let t=e.trim();return/^(https?:|mailto:)/i.test(t)?t:null}function Er(e){let t=e.split(/(`+)([\s\S]*?[^`])\1(?!`)/),n=``;for(let e=0;e<t.length;e++){if(e%3==2){n+=`<code>${wr(t[e].replace(/^ (.*) $/,`$1`))}</code>`;continue}if(e%3==1)continue;let r=wr(t[e]);r=r.replace(/!\[([^\]]*)\]\((\/api\/hosts\/[^)\s]+)\)/g,(e,t,n)=>`<img src="${n}" alt="${t}" loading="lazy" decoding="async">`),r=r.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g,(e,t,n)=>{let r=Tr(n.replace(/&/g,`&`));return r?`<a href="${wr(r)}" target="_blank" rel="noopener noreferrer">${t}</a>`:e}),r=r.replace(/(^|[\s(])(https?:\/\/[^\s<)]+[^\s<).,;:!?'"])/g,(e,t,n)=>`${t}<a href="${n}" target="_blank" rel="noopener noreferrer">${n}</a>`),r=r.replace(/\*\*([^*\n]+)\*\*/g,`<strong>$1</strong>`).replace(/__([^_\n]+)__/g,`<strong>$1</strong>`).replace(/(^|[^*\w])\*([^*\s][^*\n]*?)\*(?!\w)/g,`$1<em>$2</em>`).replace(/(^|[^_\w])_([^_\s][^_\n]*?)_(?!\w)/g,`$1<em>$2</em>`).replace(/~~([^~\n]+)~~/g,`<del>$1</del>`),n+=r}return n}var Dr=e=>/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(e)&&e.includes(`|`),Or=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>Er(e.trim()));function kr(e){let t=e.replace(/\r\n?/g,`
|
|
21
|
+
`).split(`
|
|
22
|
+
`),n=[],r=[],i=()=>{r.length&&n.push(`<p>${r.map(Er).join(`<br>`)}</p>`),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=/^(\s*)(```+|~~~+)\s*([\w+#.-]*)/.exec(a);if(o){i();let r=o[2],a=[];for(;++e<t.length&&!t[e].trimStart().startsWith(r);)a.push(t[e]);let s=o[3]?`<span class="code-lang">${wr(o[3])}</span>`:``;n.push(`<pre class="code">${s}<code>${wr(a.join(`
|
|
23
|
+
`))}</code></pre>`);continue}if(!a.trim()){i();continue}let s=/^(#{1,6})\s+(.*)$/.exec(a);if(s){i();let e=Math.min(s[1].length+2,6);n.push(`<h${e}>${Er(s[2])}</h${e}>`);continue}if(/^\s*([-*_])(\s*\1){2,}\s*$/.test(a)){i(),n.push(`<hr>`);continue}if(/^\s*>/.test(a)){i();let r=[];for(;e<t.length&&/^\s*>/.test(t[e]);e++)r.push(t[e].replace(/^\s*>\s?/,``));e--,n.push(`<blockquote>${kr(r.join(`
|
|
24
|
+
`))}</blockquote>`);continue}if(a.includes(`|`)&&e+1<t.length&&Dr(t[e+1])){i();let r=Or(a),o=[];for(e+=2;e<t.length&&t[e].includes(`|`)&&t[e].trim();e++)o.push(Or(t[e]));e--,n.push(`<div class="table"><table><thead><tr>${r.map(e=>`<th>${e}</th>`).join(``)}</tr></thead><tbody>${o.map(e=>`<tr>${e.map(e=>`<td>${e}</td>`).join(``)}</tr>`).join(``)}</tbody></table></div>`);continue}let c=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/.exec(a);if(c){i();let r=/\d/.test(c[2]),a=[];for(;e<t.length;e++){let n=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/.exec(t[e]);if(n&&/\d/.test(n[2])===r){let e=/^\[([ xX])\]\s+(.*)$/.exec(n[3]),t=n[1].length>=2?` class="nested"`:``;a.push(e?`<li class="task${n[1].length>=2?` nested`:``}"><span class="check${e[1]===` `?``:` done`}"></span>${Er(e[2])}</li>`:`<li${t}>${Er(n[3])}</li>`)}else if(t[e].trim()&&/^\s{2,}/.test(t[e])&&a.length)a[a.length-1]=a[a.length-1].replace(/<\/li>$/,` ${Er(t[e].trim())}</li>`);else break}e--,n.push(r?`<ol>${a.join(``)}</ol>`:`<ul>${a.join(``)}</ul>`)}else r.push(a)}return i(),n.join(``)}var Ar=`modulepreload`,jr=function(e){return`/`+e},Mr={},Nr=function(e){return e.pathname.endsWith(`.css`)},Pr=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Fr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=jr(t,n);let r=s(t),i=Nr(r);return Pr(Mr,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ar,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ir=y(null),Lr=null;function Rr(){return Lr??=Fr(()=>import(`./MarkdownMessage-EN9nVzPY.js`).then(e=>{Ir.value=p(e.default)}),__vite__mapDeps([0,1,2,3,4])).catch(()=>{Lr=null}),Lr}function zr(){let e=window.requestIdleCallback;e?e(()=>void Rr(),{timeout:3e3}):setTimeout(()=>void Rr(),1500)}var Br=Symbol(`litepaseo-suggestions`),Vr={key:0,class:`row row-plugin row-speed`,title:`Turn speed (turn-speed plugin)`},Hr={class:`suggestion-actions`},Ur={key:2,class:`suggestion-wait`},Wr={class:`line-icon`},Gr={class:`line-name`},Kr={class:`line-text`},qr={key:0,class:`tool-body`},Jr={class:`tool-pre`},Yr=f({__name:`PluginRow`,props:{item:{},seqStart:{}},setup(r){let a=r,o=w(Br,null),s=S(()=>`${a.item.pluginId}/${a.item.kind}`),l=S(()=>a.item.data??{}),u=S(()=>{let e=l.value;if(s.value!==`turn-speed/turn-speed`||typeof e.tokensPerSecond!=`number`)return null;let t=e.outputTokens>=1e3?`${(e.outputTokens/1e3).toFixed(1)}k`:String(e.outputTokens),n=e.generationMs>=6e4?`${Math.floor(e.generationMs/6e4)}m ${Math.round(e.generationMs%6e4/1e3)}s`:`${(e.generationMs/1e3).toFixed(1)}s`;return`${e.tokensPerSecond.toFixed(1)} tok/s · ${t} tokens · ${n} · ${e.requests} ${e.requests===1?`request`:`requests`}`}),d=S(()=>s.value===`next-input/next-input`&&typeof l.value.token==`string`),f=e(`idle`),p=e(``),m=S(()=>/[`$|<>]|(^|\s)[.~]?\/[\w.-]|https?:|www\.|\b(rm|sudo|delete|drop|remove|reset|force|push|deploy|publish|release|merge|token|password|passwd|secret|credential|api[ _-]?key|ssh)\b|删除|推送|部署|发布|密码|密钥|令牌/i.test(p.value));async function h(){if(o&&d.value){if(l.value.status===`ready`&&l.value.text)f.value=`ready`,p.value=l.value.text;else{f.value=`loading`;try{let e=await o.predict(l.value.token);e.status===`ready`&&e.text?(f.value=`ready`,p.value=e.text):f.value=e.status===`error`?`error`:`hidden`}catch{f.value=`error`}}f.value===`ready`&&o.offer(a.seqStart,p.value)}}c(()=>void h()),n(()=>l.value.token,()=>void h());let g=e(!1),_=S(()=>g.value?JSON.stringify(a.item.data??a.item,null,2):``);return(e,n)=>u.value?(i(),R(`div`,Vr,[t(J,{name:`bolt`,size:12}),x(`span`,null,k(u.value),1)])):d.value?(i(),R(`div`,{key:1,class:M([`row row-suggestion`,`is-`+f.value])},[f.value===`loading`?(i(),R(b,{key:0},[n[4]||=x(`span`,{class:`spinner spinner-sm`},null,-1),n[5]||=x(`span`,{class:`suggestion-wait`},`Thinking of a next message…`,-1)],64)):f.value===`ready`?(i(),R(b,{key:1},[x(`button`,{class:`suggestion-text`,title:`Put in the message box to edit`,onClick:n[0]||=e=>D(o)?.use(p.value)},k(p.value),1),x(`span`,Hr,[x(`button`,{class:`icon-btn`,title:`Edit in the message box`,"aria-label":`Edit suggestion`,onClick:n[1]||=e=>D(o)?.use(p.value)},[t(J,{name:`edit`,size:14})]),m.value?F(``,!0):(i(),R(`button`,{key:0,class:`icon-btn`,title:`Send this message`,"aria-label":`Send suggestion`,onClick:n[2]||=e=>D(o)?.send(p.value)},[t(J,{name:`send`,size:14})]))])],64)):f.value===`error`?(i(),R(`span`,Ur,`Suggestion unavailable`)):F(``,!0)],2)):(i(),R(`details`,{key:2,class:`row row-line row-tool row-plugin`,onToggle:n[3]||=e=>g.value=e.target.open},[x(`summary`,null,[x(`span`,Wr,[t(J,{name:`sparkle`,size:15})]),x(`span`,Gr,k(r.item.pluginId),1),x(`span`,Kr,k(r.item.kind),1)]),g.value?(i(),R(`div`,qr,[x(`pre`,Jr,k(_.value),1)])):F(``,!0)],32))}}),Xr=[`aria-expanded`,`disabled`],Zr={key:0,class:`spinner`},Qr={key:0,class:`rewind-menu`,role:`menu`},$r={class:`rewind-warning`},ei=[`onClick`],ti=f({__name:`RewindMenu`,props:{modes:{},busy:{type:Boolean}},emits:[`rewind`],setup(r,{emit:a}){let o=r,c=a,l={conversation:`Rewind conversation`,files:`Rewind files`,both:`Rewind conversation and files`},u={conversation:`chat`,files:`file`,both:`layers`},f=e(!1),p=e(null);function h(e){(e instanceof KeyboardEvent?e.key===`Escape`:!p.value?.contains(e.target))&&(f.value=!1)}n(f,e=>{let t=e?`addEventListener`:`removeEventListener`;document[t](`pointerdown`,h,!0),document[t](`keydown`,h,!0)}),s(()=>f.value=!1);function g(e){f.value=!1,c(`rewind`,e)}return(e,n)=>(i(),R(`span`,{ref_key:`root`,ref:p,class:`rewind`},[x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Rewind to this message`,title:`Rewind to this message`,"aria-expanded":f.value,disabled:r.busy,onClick:n[0]||=e=>f.value=!f.value},[r.busy?(i(),R(`span`,Zr)):(i(),m(J,{key:1,name:`undo`,size:14}))],8,Xr),f.value?(i(),R(`div`,Qr,[x(`p`,$r,[t(J,{name:`alert`,size:13}),n[1]||=d(`This action cannot be undone`,-1)]),(i(!0),R(b,null,z(o.modes,e=>(i(),R(`button`,{key:e,type:`button`,role:`menuitem`,class:`rewind-item`,onClick:t=>g(e)},[t(J,{name:u[e],size:15},null,8,[`name`]),d(k(l[e]),1)],8,ei))),128))])):F(``,!0)],512))}}),ni={key:0,class:`row row-user`},ri={class:`bubble`,tabindex:`-1`},ii={key:0,class:`user-images`},ai=[`href`],oi=[`src`,`alt`],si={class:`user-actions`},ci={key:0,class:`user-time`},li=[`aria-label`,`title`],ui=[`data-seq-end`],di=[`innerHTML`],fi=[`tabindex`],pi={class:`line-icon`},mi={class:`line-text`},hi={key:0,class:`reasoning-text`},gi=[`title`],_i={class:`line-icon`},vi={key:0,class:`status-dot is-running`},yi={key:0,class:`line-name`},bi={key:1,class:`line-meta`},xi={key:2,class:`line-meta`},Si={key:0,class:`tool-body`},Ci={key:0,class:`tool-pre tool-command`},wi={key:1,class:`tool-pre tool-diff`},Ti={key:0,class:`diff-hunk`},Ei={key:2,class:`tool-pre`},Di={key:3,class:`tool-pre tool-output`},Oi={key:4,class:`tool-pre tool-error`},ki={key:5,class:`tool-exit`},Ai={key:6,class:`tool-exit`},ji={key:4,class:`row row-todo`},Mi={class:`todo-title`},Ni={key:5,class:`row row-callout is-error`},Pi={key:7,class:`row row-divider`},Fi={class:`line-icon`},Ii={class:`line-name`},Li={key:0,class:`tool-body`},Ri={class:`tool-pre`},zi=2e4,Bi=600,Vi=f({__name:`TimelineRowView`,props:{entry:{},final:{type:Boolean}},setup(n){let a=n,o=w(En,null),s=S(()=>a.entry.value),c=S(()=>s.value.item),l=e(!1),u=S(()=>{let e=String(c.value.text??``);return o?.value?Jn(e,o.value.base):e}),f=S(()=>!Ir.value&&c.value.type===`assistant_message`?kr(u.value):``);!Ir.value&&c.value.type===`assistant_message`&&Rr();let p=S(()=>{let e=c.value;if(e.type!==`tool_call`)return null;let t=In(e,o?.value.cwd);return{...t,summary:t.summary.split(`
|
|
25
|
+
`)[0],status:String(e.status??`running`)}}),h=S(()=>c.value.type===`reasoning`?Ln(String(c.value.text??``)):``),g=e(!1);function _(e){let t=e.currentTarget.querySelector(`.line-text`);g.value=!!t&&t.scrollWidth>t.clientWidth+1}function v(e){_(e),C.value||e.preventDefault()}let y=S(()=>String(c.value.text??``).trim().length>h.value.length+4),C=S(()=>y.value||g.value||l.value),T=e=>e.length>zi?e.slice(0,zi)+`
|
|
26
|
+
… (truncated)`:e,E=S(()=>{if(!l.value||!p.value)return null;let e=c.value,t=e.detail??{},n=zn(e),r=n?n.split(`
|
|
27
|
+
`):[],i=T(Rn(e)),a=t.type===`unknown`&&t.input!==void 0?T(JSON.stringify(t.input,null,2)):``;return{command:t.type===`shell`||p.value.kind===`shell`?String(t.command??t.input?.command??p.value.summary):``,exitCode:typeof t.exitCode==`number`?t.exitCode:null,diff:r.slice(0,Bi).map(e=>({text:e,kind:e.startsWith(`@@`)?`hunk`:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:``})),diffMore:Math.max(0,r.length-Bi),input:p.value.kind===`shell`?``:a,output:i,error:e.error?T(typeof e.error==`string`?e.error:JSON.stringify(e.error,null,2)):``}}),O=S(()=>c.value.type===`todo`?c.value.items:[]),A=S(()=>l.value?T(JSON.stringify(c.value,null,2)):``),j=S(()=>String(c.value.type).replaceAll(`_`,` `)),N=e=>l.value=e.target.open,P=S(()=>{if(c.value.type!==`user_message`)return``;let e=Date.parse(s.value.timestamp);return Number.isFinite(e)?Un(new Date(e)):``}),I=S(()=>c.value.type===`user_message`&&typeof c.value.messageId==`string`?o?.value.rewindModes??[]:[]),L=S(()=>!!o?.value.rewinding?.value),B=e=>o?.value.rewind?.(String(c.value.messageId),String(c.value.text??``),e),V=e(!1);async function H(){try{await navigator.clipboard.writeText(String(c.value.text??``)),V.value=!0,setTimeout(()=>V.value=!1,1500)}catch{}}return(e,a)=>c.value.type===`user_message`?(i(),R(`div`,ni,[x(`div`,ri,[c.value.imageUrls?.length?(i(),R(`div`,ii,[(i(!0),R(b,null,z(c.value.imageUrls,(e,t)=>(i(),R(`a`,{key:e,href:e,target:`_blank`,rel:`noopener`},[x(`img`,{src:e,alt:`Attached image ${Number(t)+1}`,loading:`lazy`},null,8,oi)],8,ai))),128))])):F(``,!0),d(k(c.value.text),1)]),x(`div`,si,[P.value?(i(),R(`span`,ci,k(P.value),1)):F(``,!0),I.value.length?(i(),m(ti,{key:1,modes:I.value,busy:L.value,onRewind:B},null,8,[`modes`,`busy`])):F(``,!0),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":V.value?`Copied`:`Copy message`,title:V.value?`Copied`:`Copy message`,onClick:H},[t(J,{name:V.value?`check`:`copy`,size:14},null,8,[`name`])],8,li)])])):c.value.type===`assistant_message`?(i(),R(`div`,{key:1,class:`row row-assistant`,"data-seq-end":s.value.seqEnd},[D(Ir)?(i(),m(r(D(Ir)),{key:0,content:u.value,final:n.final},null,8,[`content`,`final`])):(i(),R(`div`,{key:1,class:`prose`,innerHTML:f.value},null,8,di))],8,ui)):c.value.type===`reasoning`?(i(),R(`details`,{key:2,class:M([`row row-line row-reasoning`,{"is-static":!C.value}]),onToggle:N},[x(`summary`,{tabindex:C.value?void 0:-1,onPointerenter:_,onFocus:_,onClick:v},[x(`span`,pi,[t(J,{name:`bulb`,size:15})]),x(`span`,mi,k(h.value||`Thinking`),1)],40,fi),l.value?(i(),R(`div`,hi,k(c.value.text),1)):F(``,!0)],34)):p.value?(i(),R(`details`,{key:3,class:M([`row row-line row-tool`,[`is-`+p.value.status,`kind-`+p.value.kind]]),onToggle:N},[x(`summary`,{title:p.value.name+(p.value.status===`failed`?` · failed`:p.value.status===`canceled`?` · canceled`:``)},[x(`span`,_i,[p.value.status===`running`?(i(),R(`span`,vi)):(i(),m(J,{key:1,name:p.value.status===`failed`?`close`:p.value.icon,size:15},null,8,[`name`]))]),p.value.showName||!p.value.summary?(i(),R(`span`,yi,k(p.value.name),1)):F(``,!0),x(`span`,{class:M([`line-text`,{mono:p.value.kind!==`sub_agent`&&p.value.kind!==`plain`&&p.value.kind!==`unknown`}])},k(p.value.summary),3),p.value.meta?(i(),R(`span`,bi,k(p.value.meta),1)):p.value.status===`canceled`?(i(),R(`span`,xi,`canceled`)):F(``,!0)],8,gi),E.value?(i(),R(`div`,Si,[E.value.command?(i(),R(`pre`,Ci,[a[0]||=x(`span`,{class:`tool-prompt`},`$`,-1),d(` `+k(E.value.command),1)])):F(``,!0),E.value.diff.length?(i(),R(`pre`,wi,[(i(!0),R(b,null,z(E.value.diff,(e,t)=>(i(),R(`span`,{key:t,class:M(e.kind&&`diff-`+e.kind)},k(e.text)+`
|
|
28
|
+
`,3))),128)),E.value.diffMore?(i(),R(`span`,Ti,`… `+k(E.value.diffMore)+` more lines`,1)):F(``,!0)])):F(``,!0),E.value.input?(i(),R(`pre`,Ei,k(E.value.input),1)):F(``,!0),E.value.output?(i(),R(`pre`,Di,k(E.value.output),1)):F(``,!0),E.value.error?(i(),R(`pre`,Oi,k(E.value.error),1)):F(``,!0),E.value.exitCode!==null&&E.value.exitCode!==0&&!E.value.error?(i(),R(`p`,ki,`exit `+k(E.value.exitCode),1)):F(``,!0),!E.value.command&&!E.value.diff.length&&!E.value.input&&!E.value.output&&!E.value.error?(i(),R(`p`,Ai,`No output`)):F(``,!0)])):F(``,!0)],34)):c.value.type===`todo`?(i(),R(`div`,ji,[x(`div`,Mi,[t(J,{name:`list`,size:14}),a[1]||=d(` Plan`,-1)]),x(`ul`,null,[(i(!0),R(b,null,z(O.value,(e,t)=>(i(),R(`li`,{key:e.id??t,class:M({done:e.completed,active:e.status===`in_progress`})},[x(`span`,{class:M([`check`,{done:e.completed}])},null,2),d(k(e.text),1)],2))),128))])])):c.value.type===`error`?(i(),R(`div`,Ni,[t(J,{name:`alert`,size:15}),a[2]||=d(),x(`span`,null,k(c.value.message),1)])):c.value.type===`notification`?(i(),R(`div`,{key:6,class:M([`row row-callout`,`is-`+c.value.level])},[t(J,{name:`alert`,size:15}),a[3]||=d(),x(`span`,null,k(c.value.message),1)],2)):c.value.type===`compaction`?(i(),R(`div`,Pi,[x(`span`,null,k(c.value.status===`loading`?`Compacting context…`:`Context compacted`),1)])):c.value.type===`plugin`?(i(),m(Yr,{key:8,item:c.value,"seq-start":s.value.seqStart},null,8,[`item`,`seq-start`])):(i(),R(`details`,{key:9,class:`row row-line row-tool`,onToggle:N},[x(`summary`,null,[x(`span`,Fi,[t(J,{name:`tool`,size:15})]),x(`span`,Ii,k(j.value),1)]),l.value?(i(),R(`div`,Li,[x(`pre`,Ri,k(A.value),1)])):F(``,!0)],32))}}),Hi={class:`sheet-head`},Ui=[`disabled`],Wi={class:`sheet-body`},Gi={key:0,class:`sheet-note`},Ki={class:`field-grid`},qi={class:`field`},Ji=[`disabled`],Yi=[`value`],Xi={class:`field`},Zi=[`disabled`],Qi={key:0,value:``},$i=[`value`],ea={key:0,class:`field`},ta=[`title`],na={class:`field`},ra=[`placeholder`,`disabled`],ia={class:`field-grid three`},aa={key:0,class:`field`},oa=[`disabled`],sa=[`value`],ca={class:`field field-agent`},la=[`disabled`],ua={key:0,value:``},da=[`value`,`disabled`],fa={class:`field field-model`},pa=[`disabled`],ma={key:0,value:``},ha=[`value`],ga={class:`field field-thinking`},_a=[`disabled`],va={key:0,value:``},ya=[`value`],ba={key:2,class:`field`},xa=[`disabled`],Sa=[`value`],Ca={class:`toggle`},wa=[`disabled`],Ta={key:3,class:`field`},Ea={key:4,class:`sheet-error`},Da={key:5,class:`sheet-error`},Oa={key:6,class:`sheet-error`,role:`alert`},ka={class:`sheet-foot`},Aa=[`disabled`],ja=[`disabled`],Ma={key:0,class:`spinner spinner-on-accent`},Na=`\0custom`,Pa=`litepaseo-new-session`,Fa=f({__name:`NewSession`,props:{hosts:{},initialHostId:{},initialCwd:{},initialProject:{},request:{type:Function}},emits:[`close`,`created`],setup(r,{emit:o}){let s=r,u=o,f=(()=>{try{return JSON.parse(localStorage.getItem(Pa)??`{}`)}catch{return{}}})(),p=S(()=>s.hosts.filter(e=>e.state===`connected`)),m=e(p.value.find(e=>e.id===s.initialHostId)?.id??p.value[0]?.id??``),g=e(null),y=e([]),w=e({}),T=0;async function E(e){let t=y.value.find(t=>t.id===e);if(!t)return;if(!g.value?.some(e=>e.id===t.provider)){W.value=`This profile's provider is unavailable on this host.`;return}let n=++T,r=m.value;M.value=t.provider,await C(),n===T&&r===m.value&&(P.value=t.model??ee.value.find(e=>e.isDefault)?.id??ee.value[0]?.id??``,await C(),n===T&&r===m.value&&(L.value=t.modeId??q.value?.defaultModeId??``,I.value=t.thinkingOptionId??te.value?.defaultThinkingId??``,w.value={...t.featureValues}))}let D=e(null),O=e(``),A=e(``),j=e(``),M=e(``),P=e(``),I=e(``),L=e(``),B=e(!1),V=e(``),H=e(``),U=e(!1),W=e(``),G=e(null),K=crypto.randomUUID(),q=S(()=>g.value?.find(e=>e.id===M.value)),ee=S(()=>q.value?.models??[]),te=S(()=>ee.value.find(e=>e.id===P.value)),ne=S(()=>A.value===Na?j.value.trim():A.value),re=S(()=>D.value?.find(e=>e.rootPath===A.value)?.name??ne.value.split(`/`).pop()??``),ie=S(()=>!!m.value&&!!ne.value&&!!M.value&&!U.value&&(!B.value||!!V.value.trim()));async function ae(e){if(++T,g.value=D.value=null,y.value=[],w.value={},s.request(`/hosts/${encodeURIComponent(e)}/settings`).then(t=>{e===m.value&&(y.value=t.features.agentProfiles?t.config.agentProfiles??[]:[])}).catch(()=>{}),O.value=``,e)try{let[t,n]=await Promise.all([s.request(`/hosts/${encodeURIComponent(e)}/providers`),s.request(`/hosts/${encodeURIComponent(e)}/projects`)]);if(e!==m.value)return;g.value=t,D.value=n.sort((e,t)=>e.name.localeCompare(t.name)),oe();let r=D.value,i=e===s.initialHostId?s.initialProject:null,a=i?r.find(e=>i.key&&e.key===i.key)??r.find(e=>e.name.toLowerCase()===i.name.toLowerCase()):void 0;if(a)A.value=a.rootPath;else if(e===s.initialHostId&&s.initialCwd){let e=r.find(e=>e.rootPath===s.initialCwd);e?A.value=e.rootPath:(A.value=Na,j.value=s.initialCwd)}else A.value||=r[0]?.rootPath??Na}catch(t){e===m.value&&(O.value=t.message)}}function oe(){let e=f[m.value]??{},t=g.value??[],n=t.find(t=>t.id===e.provider&&t.status!==`error`)??t.find(e=>e.status===`ready`)??t[0];M.value=n?.id??``,se(e.model,e.thinking),L.value=n?.modes.some(t=>t.id===e.mode)?e.mode:n?.defaultModeId??``}function se(e,t){let n=ee.value,r=n.find(t=>t.id===e)??n.find(e=>e.isDefault)??n[0];P.value=r?.id??``,I.value=r?.thinking.some(e=>e.id===t)?t:r?.defaultThinkingId??``}n(m,e=>{A.value=``,ae(e)}),n(M,()=>{w.value={};let e=f[m.value];se(e?.provider===M.value?e.model:void 0);let t=q.value;t&&!t.modes.some(e=>e.id===L.value)&&(L.value=t.defaultModeId??``)}),n(P,()=>{let e=te.value;e&&!e.thinking.some(e=>e.id===I.value)&&(I.value=e.defaultThinkingId??``)}),n([m,A,j,M,P,I,L,w,B,V,H],()=>{W.value&&(K=crypto.randomUUID()),W.value=``});async function ce(){if(ie.value){U.value=!0,W.value=``;try{let e=await s.request(`/hosts/${encodeURIComponent(m.value)}/agents`,`POST`,{idempotencyKey:K,cwd:ne.value,provider:M.value,...Object.keys(w.value).length?{featureValues:w.value}:{},...P.value?{model:P.value}:{},...L.value?{modeId:L.value}:{},...I.value?{thinkingOptionId:I.value}:{},...H.value.trim()?{prompt:H.value}:{},...B.value?{worktreeBranch:V.value.trim()}:{}},12e4);f[m.value]={provider:M.value,model:P.value,thinking:I.value,mode:L.value},localStorage.setItem(Pa,JSON.stringify(f)),u(`created`,e.key)}catch(e){W.value=e.message}finally{U.value=!1}}}function le(e){e.key===`Escape`&&!U.value&&u(`close`),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),ce())}return c(()=>{window.addEventListener(`keydown`,le),ae(m.value),C(()=>G.value?.focus())}),l(()=>window.removeEventListener(`keydown`,le)),(e,n)=>(i(),R(`div`,{class:`overlay`,onMousedown:n[13]||=v(e=>!U.value&&u(`close`),[`self`])},[x(`form`,{class:`sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`New session`,onSubmit:v(ce,[`prevent`])},[x(`header`,Hi,[n[14]||=x(`h2`,null,`New session`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,disabled:U.value,onClick:n[0]||=e=>u(`close`)},[t(J,{name:`close`,size:16})],8,Ui)]),x(`div`,Wi,[p.value.length?(i(),R(b,{key:1},[x(`div`,Ki,[x(`label`,qi,[n[15]||=x(`span`,null,`Host`,-1),a(x(`select`,{"onUpdate:modelValue":n[1]||=e=>m.value=e,disabled:U.value},[(i(!0),R(b,null,z(p.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,Yi))),128))],8,Ji),[[N,m.value]])]),x(`label`,Xi,[n[16]||=x(`span`,null,`Project`,-1),a(x(`select`,{"onUpdate:modelValue":n[2]||=e=>A.value=e,disabled:U.value||!D.value},[D.value?F(``,!0):(i(),R(`option`,Qi,`Loading…`)),(i(!0),R(b,null,z(D.value??[],e=>(i(),R(`option`,{key:e.key,value:e.rootPath},k(e.name),9,$i))),128)),x(`option`,{value:Na},`Another folder…`)],8,Zi),[[N,A.value]])])]),A.value===Na?(i(),R(`label`,ea,[x(`span`,null,`Folder on `+k(p.value.find(e=>e.id===m.value)?.label),1),a(x(`input`,{"onUpdate:modelValue":n[3]||=e=>j.value=e,placeholder:`/home/me/code/project`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,j.value]])])):ne.value?(i(),R(`p`,{key:1,class:`path-hint`,title:ne.value},[t(J,{name:`folder`,size:13}),d(k(ne.value),1)],8,ta)):F(``,!0),x(`label`,na,[n[17]||=x(`span`,null,`First message`,-1),a(x(`textarea`,{ref_key:`promptElement`,ref:G,"onUpdate:modelValue":n[4]||=e=>H.value=e,rows:`5`,placeholder:re.value?`What should the agent do in ${re.value}?`:`What should the agent do?`,disabled:U.value},null,8,ra),[[_,H.value]])]),x(`div`,ia,[y.value.length?(i(),R(`label`,aa,[n[19]||=x(`span`,null,`Apply agent profile`,-1),x(`select`,{disabled:U.value,value:``,onChange:n[5]||=e=>E(e.target.value)},[n[18]||=x(`option`,{value:``},`Choose profile…`,-1),(i(!0),R(b,null,z(y.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.name),9,sa))),128))],40,oa)])):F(``,!0),x(`label`,ca,[n[20]||=x(`span`,null,`Agent`,-1),a(x(`select`,{"onUpdate:modelValue":n[6]||=e=>M.value=e,disabled:U.value||!g.value},[g.value?F(``,!0):(i(),R(`option`,ua,`Loading…`)),(i(!0),R(b,null,z(g.value??[],e=>(i(),R(`option`,{key:e.id,value:e.id,disabled:e.status===`error`},k(e.label)+k(e.status===`loading`?` (starting)`:e.status===`error`?` (error)`:``),9,da))),128))],8,la),[[N,M.value]])]),x(`label`,fa,[n[21]||=x(`span`,null,`Model`,-1),a(x(`select`,{"onUpdate:modelValue":n[7]||=e=>P.value=e,disabled:U.value||!ee.value.length},[ee.value.length?F(``,!0):(i(),R(`option`,ma,`Default`)),(i(!0),R(b,null,z(ee.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,ha))),128))],8,pa),[[N,P.value]])]),x(`label`,ga,[n[22]||=x(`span`,null,`Thinking`,-1),a(x(`select`,{"onUpdate:modelValue":n[8]||=e=>I.value=e,disabled:U.value||!te.value?.thinking.length},[te.value?.thinking.length?F(``,!0):(i(),R(`option`,va,`Default`)),(i(!0),R(b,null,z(te.value?.thinking??[],e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,ya))),128))],8,_a),[[N,I.value]])])]),q.value?.modes.length?(i(),R(`label`,ba,[n[23]||=x(`span`,null,`Mode`,-1),a(x(`select`,{"onUpdate:modelValue":n[9]||=e=>L.value=e,disabled:U.value},[(i(!0),R(b,null,z(q.value.modes,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,Sa))),128))],8,xa),[[N,L.value]])])):F(``,!0),x(`label`,Ca,[a(x(`input`,{"onUpdate:modelValue":n[10]||=e=>B.value=e,type:`checkbox`,disabled:U.value},null,8,wa),[[h,B.value]]),n[24]||=x(`span`,null,`Work in a new git worktree`,-1)]),B.value?(i(),R(`label`,Ta,[n[25]||=x(`span`,null,`New branch`,-1),a(x(`input`,{"onUpdate:modelValue":n[11]||=e=>V.value=e,placeholder:`feature/my-change`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,V.value]])])):F(``,!0),O.value?(i(),R(`p`,Ea,[t(J,{name:`alert`,size:14}),d(k(O.value),1)])):F(``,!0),q.value?.error?(i(),R(`p`,Da,[t(J,{name:`alert`,size:14}),d(k(q.value.error),1)])):F(``,!0),W.value?(i(),R(`p`,Oa,[t(J,{name:`alert`,size:14}),x(`span`,null,k(W.value),1)])):F(``,!0)],64)):(i(),R(`p`,Gi,`No connected hosts. Connect a host first.`))]),x(`footer`,ka,[n[26]||=x(`span`,{class:`sheet-hint hide-sm`},`Ctrl/⌘ + Enter to start`,-1),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:U.value,onClick:n[12]||=e=>u(`close`)},`Cancel`,8,Aa),x(`button`,{class:`btn btn-primary`,disabled:!ie.value},[U.value?(i(),R(`span`,Ma)):F(``,!0),d(` `+k(U.value?`Starting…`:W.value?`Retry`:`Start session`),1)],8,ja)])],32)],32))}}),Ia={key:0,class:`attachment-tray`},La=[`data-state`,`title`],Ra={class:`attachment-thumb`},za=[`src`,`alt`],Ba={key:2,class:`spinner spinner-sm attachment-uploading`},Va={class:`attachment-text`},Ha={class:`attachment-name`},Ua={class:`attachment-meta`},Wa=[`disabled`,`onClick`],Ga=[`aria-label`,`title`,`disabled`,`onClick`],Ka={key:0,class:`attachment-error`,role:`alert`},qa=[`disabled`],Ja=xn(f({__name:`AttachmentPanel`,props:{store:{},agentKey:{},base:{},busy:{type:Boolean}},setup(r,{expose:a}){let o=r,s=e(null),c=e(``),l=e(0),u=e(null),f=S(()=>o.store.get(o.agentKey));n([()=>o.base,l],async([e],t,n)=>{let r=new AbortController;n(()=>r.abort()),s.value=null,c.value=``;try{let t=await fetch(e+`/attachments/capabilities`,{signal:r.signal});if(!t.ok)throw Error(`Attachment capabilities are unavailable while the host is disconnected.`);let n=await t.json();r.signal.aborted||(s.value=n)}catch(e){r.signal.aborted||(c.value=e.message)}},{immediate:!0});let p=new Set([`image/png`,`image/jpeg`,`image/webp`]);function h(e){if(!p.has(e.type)||!/^image\.(png|jpe?g|webp)$/i.test(e.name))return e;let t=new Date().toISOString().replace(/[-:]/g,``).replace(`T`,`-`).slice(0,15),n=e.type===`image/jpeg`?`jpg`:e.type.slice(6);return new File([e],`pasted-${t}-${Math.random().toString(36).slice(2,6)}.${n}`,{type:e.type,lastModified:e.lastModified})}async function g(e,t){if(!p.has(e.type)||e.size<=t||typeof createImageBitmap!=`function`)return e;let n=await createImageBitmap(e);try{for(let[r,i]of[[3072,.9],[2400,.85],[1800,.8]]){let a=Math.min(1,r/Math.max(n.width,n.height)),o=document.createElement(`canvas`);o.width=Math.round(n.width*a),o.height=Math.round(n.height*a),o.getContext(`2d`).drawImage(n,0,0,o.width,o.height);let s=await new Promise(e=>o.toBlob(e,`image/jpeg`,i));if(s&&s.size<=t)return new File([s],e.name.replace(/\.\w+$/,`.jpg`),{type:`image/jpeg`})}}finally{n.close()}return e}async function _(e){if(e?.length&&!o.busy){c.value=``;try{if(!s.value)throw Error(`Wait for attachment capabilities, then try again.`);let t=s.value.maxBytes,n=await Promise.all(Array.from(e).map(e=>g(h(e),t)));await o.store.add(o.agentKey,o.base,n,s.value)}catch(e){c.value=e.message}u.value&&(u.value.value=``)}}let v=S(()=>!!s.value&&(s.value.images||s.value.files)),y=S(()=>s.value?v.value?[`Attach files (up to 4 · 8 MiB each · 24 MiB total)`,s.value.note].filter(Boolean).join(`
|
|
29
|
+
`):`Attachments are unavailable for this agent`:c.value?`Attachments unavailable`:`Checking attachment support…`),C=()=>{v.value&&!o.busy&&u.value?.click()},w=e=>e<1048576?`${Math.ceil(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;return a({addFiles:_,pick:C,available:v,hint:y}),(e,n)=>(i(),R(b,null,[x(`input`,{ref_key:`picker`,ref:u,type:`file`,multiple:``,hidden:``,"aria-label":`Choose attachments`,onChange:n[0]||=e=>_(u.value?.files)},null,544),f.value.length||c.value?(i(),R(`div`,Ia,[(i(!0),R(b,null,z(f.value,e=>(i(),R(`div`,{key:e.localId,class:M([`attachment-item`,{"is-error":!!e.error}]),"data-state":e.uploading?`uploading`:e.error?`error`:`ready`,title:e.error||e.file.name},[x(`span`,Ra,[e.preview?(i(),R(`img`,{key:0,src:e.preview,alt:e.file.name},null,8,za)):(i(),m(J,{key:1,name:`file`,size:16})),e.uploading?(i(),R(`span`,Ba)):F(``,!0)]),x(`span`,Va,[x(`span`,Ha,k(e.file.name),1),x(`span`,Ua,k(e.error?`Upload failed`:e.uploading?`Uploading…`:w(e.file.size)),1)]),e.error?(i(),R(`button`,{key:0,type:`button`,class:`attachment-action`,"aria-label":`Retry upload`,title:`Retry upload`,disabled:r.busy,onClick:t=>r.store.upload(e)},[t(J,{name:`refresh`,size:13})],8,Wa)):F(``,!0),x(`button`,{type:`button`,class:`attachment-action`,"aria-label":e.uploading?`Cancel upload`:`Remove attachment`,title:e.uploading?`Cancel upload`:`Remove attachment`,disabled:r.busy,onClick:t=>r.store.remove(r.agentKey,e)},[t(J,{name:`close`,size:13})],8,Ga)],10,La))),128)),c.value?(i(),R(`p`,Ka,[t(J,{name:`alert`,size:13}),d(k(c.value)+` `,1),s.value?F(``,!0):(i(),R(`button`,{key:0,type:`button`,class:`attachment-retry`,disabled:r.busy,onClick:n[1]||=e=>l.value++},`Retry`,8,qa))])):F(``,!0)])):F(``,!0)],64))}}),[[`__scopeId`,`data-v-78817268`]]),Ya=class{entries=u(new Map);get(e){return this.entries.get(e)??[]}async add(e,t,n,r){for(let i of n){if(this.get(e).length>=4)throw Error(`Attach up to four files per message.`);if([...this.entries.values()].flat().reduce((e,t)=>e+t.file.size,0)+i.size>25165824)throw Error(`Attachments total more than 24 MiB. Remove files before adding more.`);if(!i.size||i.size>r.maxBytes)throw Error(`Files must be between 1 byte and 8 MiB.`);let n=[`image/png`,`image/jpeg`,`image/webp`,`image/gif`].includes(i.type);if(n?!r.images:!r.files)throw Error(n?`This provider does not support images.`:`This agent cannot read uploaded files.`);let a=u({localId:crypto.randomUUID(),file:i,preview:n?URL.createObjectURL(i):void 0,error:``,uploading:!1,cancelled:!1,base:t});this.entries.set(e,[...this.get(e),a]),this.upload(a)}}async upload(e){if(!(e.uploading||e.cancelled)){e.error=``,e.uploading=!0,e.controller=new AbortController;try{e.id&&await this.discardRemote(e);let t=await fetch(e.base+`/attachments`,{method:`POST`,body:e.file,headers:{"x-litepaseo":`1`,"x-file-name":encodeURIComponent(e.file.name),"content-type":e.file.type||`application/octet-stream`},signal:AbortSignal.any([e.controller.signal,AbortSignal.timeout(6e4)])}),n=await t.json();if(!t.ok)throw Error(n.error??`Upload failed`);e.id=n.id,e.cancelled&&await this.discardRemote(e)}catch(t){!e.cancelled&&!e.controller?.signal.aborted&&(e.error=t.message)}finally{e.uploading=!1}}}async discardRemote(e){let t=e.id;e.id=void 0,t&&await fetch(e.base+`/attachments/`+encodeURIComponent(t),{method:`DELETE`,headers:{"x-litepaseo":`1`},signal:AbortSignal.timeout(5e3)}).catch(()=>{})}remove(e,t,n=!1){t.cancelled=!0,t.controller?.abort(),t.preview&&URL.revokeObjectURL(t.preview),this.entries.set(e,this.get(e).filter(e=>e.localId!==t.localId)),n||this.discardRemote(t)}detach(e){let t=this.get(e);return this.entries.delete(e),t}reattach(e,t){let n=[...this.get(e),...t];for(let t of n.slice(4))this.remove(e,t);this.entries.set(e,n.slice(0,4))}consume(e,t){for(let n of this.get(e))n.id&&t.includes(n.id)&&this.remove(e,n,!0)}forgetRemote(e){for(let t of this.entries.values())for(let n of t)n.controller?.abort(),n.id=void 0,n.uploading=!1,n.error=e}clear(){for(let[e,t]of this.entries)for(let n of t)this.remove(e,n);this.entries.clear()}};function Xa(e){let t=e.input;if(e.kind!==`question`||!Array.isArray(t?.questions)||!t.questions.length)return null;let n=[],r=new Set;for(let i of t.questions){if(!i||typeof i!=`object`||typeof i.header!=`string`||!i.header.trim()||typeof i.question!=`string`||!i.question.trim()||r.has(i.header)||i.options!==void 0&&!Array.isArray(i.options))return null;let t=i.options??[];if(t.some(e=>!e||typeof e.label!=`string`||!e.label.trim()||e.description!==void 0&&typeof e.description!=`string`)||new Set(t.map(e=>e.label)).size!==t.length)return null;r.add(i.header),n.push({header:i.header,question:i.question,options:t,multiple:i.multiSelect===!0,other:i.isOther===!0||e.name===`AskUserQuestion`||!t.length,secret:i.isSecret===!0,required:i.required!==!1})}return n}function Za(e,t){let n=e.map((e,n)=>{let r=t[n]??{selected:[],text:``},i=r.selected.filter(t=>e.options.some(e=>e.label===t)),a=e.other?r.text.trim():``,o=e.multiple?[...i,...a?[a]:[]].join(`, `):a||i[0]||``;if(e.required&&!o)throw Error(`Answer ${e.header} before submitting.`);return[e.header,o]});return{answers:Object.fromEntries(n)}}var Qa={class:`permission-head`},$a={class:`permission-icon`},eo={class:`grow`},to={class:`row-title`},no={class:`row-sub`},ro={class:`permission-details`},io={key:0,class:`field`},ao=[`value`],oo=[`disabled`],so=[`type`,`name`,`checked`,`onChange`],co={key:0,class:`row-sub`},lo={key:0,class:`field`},uo=[`onUpdate:modelValue`,`type`,`aria-label`],fo={key:2,class:`field`},po={key:3,role:`alert`},mo={class:`permission-actions`},ho=[`disabled`],go=[`disabled`],_o=xn(f({__name:`PermissionForm`,props:{permission:{},busy:{type:Boolean}},emits:[`respond`],setup(r,{emit:o}){let s=r,c=o,l=S(()=>Xa(s.permission)),u=e([]),f=e(``),p=e(``),m=e(``);n(()=>JSON.stringify(s.permission.input),()=>{u.value=(l.value??[]).map(()=>({selected:[],text:``})),f.value=``,m.value=``},{immediate:!0});function h(e,t,n){let r=u.value[e];n?r.selected=r.selected.includes(t)?r.selected.filter(e=>e!==t):[...r.selected,t]:(r.selected=[t],r.text=``)}function g(e){m.value=``;try{let t={behavior:e?`allow`:`deny`};if(p.value&&(t.selectedActionId=p.value),e&&s.permission.kind===`question`){if(l.value)t.updatedInput=Za(l.value,u.value);else{let e=JSON.parse(f.value);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Enter a JSON object for the answer.`);t.updatedInput=e}}c(`respond`,t)}catch(e){m.value=e instanceof SyntaxError?`Enter a valid JSON object for the answer.`:e.message}}return(e,n)=>(i(),R(`form`,{class:`permission`,onSubmit:n[3]||=v(e=>g(!0),[`prevent`])},[x(`div`,Qa,[x(`span`,$a,[t(J,{name:`shield`,size:16})]),x(`div`,eo,[x(`div`,to,k(r.permission.title||r.permission.name),1),x(`div`,no,k(r.permission.kind===`question`?`Question`:`Permission request`)+` · `+k(r.permission.name),1)])]),x(`details`,ro,[n[4]||=x(`summary`,null,`Request details`,-1),x(`pre`,null,k(JSON.stringify(r.permission.input,null,2)),1)]),r.permission.actions?.length?(i(),R(`label`,io,[n[6]||=x(`span`,null,`Action`,-1),a(x(`select`,{"onUpdate:modelValue":n[0]||=e=>p.value=e},[n[5]||=x(`option`,{value:``},`Default`,-1),(i(!0),R(b,null,z(r.permission.actions,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label||e.id),9,ao))),128))],512),[[N,p.value]])])):F(``,!0),l.value?(i(!0),R(b,{key:1},z(l.value,(e,t)=>(i(),R(`fieldset`,{key:e.header,class:`question-field`,disabled:r.busy},[x(`legend`,null,k(e.header)+k(e.required?` *`:``)+`: `+k(e.question),1),(i(!0),R(b,null,z(e.options,n=>(i(),R(`label`,{key:n.label,class:`question-option`},[x(`input`,{type:e.multiple?`checkbox`:`radio`,name:r.permission.id+`:`+t,checked:u.value[t]?.selected.includes(n.label)&&(e.multiple||!u.value[t]?.text),onChange:r=>h(t,n.label,e.multiple)},null,40,so),x(`span`,null,[d(k(n.label),1),n.description?(i(),R(`small`,co,` — `+k(n.description),1)):F(``,!0)])]))),128)),e.other?(i(),R(`label`,lo,[x(`span`,null,k(e.options.length?`Other answer`:`Your answer`),1),a(x(`input`,{"onUpdate:modelValue":e=>u.value[t].text=e,type:e.secret?`password`:`text`,"aria-label":e.header+`: `+(e.options.length?`Other answer`:`Your answer`),autocomplete:`off`},null,8,uo),[[O,u.value[t].text]])])):F(``,!0)],8,oo))),128)):r.permission.kind===`question`?(i(),R(`label`,fo,[n[7]||=x(`span`,null,`This question format needs a JSON answer.`,-1),a(x(`textarea`,{"onUpdate:modelValue":n[1]||=e=>f.value=e,"aria-label":`Answer (JSON)`,rows:`3`,placeholder:`{"answers": {}}`},null,512),[[_,f.value]])])):F(``,!0),m.value?(i(),R(`p`,po,k(m.value),1)):F(``,!0),x(`div`,mo,[x(`button`,{type:`button`,class:`btn btn-outline`,disabled:r.busy,onClick:n[2]||=e=>g(!1)},`Deny`,8,ho),x(`button`,{class:`btn btn-primary`,disabled:r.busy},`Allow / submit`,8,go)])],32))}}),[[`__scopeId`,`data-v-f1db1c0a`]]),vo=`litepaseo-theme`,yo=e((()=>{let e=localStorage.getItem(vo);return e===`light`||e===`dark`?e:`system`})()),bo=matchMedia(`(prefers-color-scheme: dark)`),xo=e(bo.matches);bo.addEventListener(`change`,e=>{xo.value=e.matches});var So=S(()=>yo.value===`dark`||yo.value===`system`&&xo.value);function Co(e=yo.value){yo.value=e,e===`system`?(delete document.documentElement.dataset.theme,localStorage.removeItem(vo)):(document.documentElement.dataset.theme=e,localStorage.setItem(vo,e))}var wo=[`system`,`light`,`dark`];function To(){Co(wo[(wo.indexOf(yo.value)+1)%wo.length])}var Eo=[{id:`graphite`,label:`Graphite`,note:`Monochrome, like Paseo`,swatch:[`#18181b`,`#e4e4e7`],light:{"--accent":`#18181b`,"--accent-hover":`#3f3f46`,"--accent-soft":`rgba(24, 24, 27, 0.07)`,"--accent-fg":`#ffffff`,"--accent-2":`#71717a`,"--link":`#2563eb`,"--unread":`#16a34a`},dark:{"--accent":`#e4e4e7`,"--accent-hover":`#ffffff`,"--accent-soft":`rgba(255, 255, 255, 0.08)`,"--accent-fg":`#18191c`,"--accent-2":`#a1a1aa`,"--link":`#8ab4f8`,"--unread":`#4ade80`,"--surface-0":`#18191c`,"--surface-1":`#1d1e22`,"--surface-2":`#232429`,"--surface-3":`#2d2e34`,"--sidebar":`#141517`,"--fg":`#e4e4e7`,"--fg-muted":`#a1a1aa`,"--fg-faint":`#6b6b74`,"--border":`#2a2b30`,"--border-strong":`#3a3b42`,"--user-bubble":`#27282d`,"--code-bg":`#141517`,"--seg-track":`#141517`,"--seg-thumb":`#2d2e34`}},{id:`indigo`,label:`Indigo`,note:`Calm blue-violet`,swatch:[`#4f46e5`,`#8b93ff`],light:{"--accent":`#4f46e5`,"--accent-hover":`#4338ca`,"--accent-soft":`rgba(79, 70, 229, 0.1)`,"--accent-fg":`#ffffff`,"--accent-2":`#818cf8`,"--link":`#4f46e5`,"--unread":`#16a34a`},dark:{"--accent":`#8b93ff`,"--accent-hover":`#a5abff`,"--accent-soft":`rgba(139, 147, 255, 0.15)`,"--accent-fg":`#15172b`,"--accent-2":`#c4b5fd`,"--link":`#a5abff`,"--unread":`#4ade80`}},{id:`ocean`,label:`Ocean`,note:`Deep teal`,swatch:[`#0e7490`,`#5cc8dc`],light:{"--accent":`#0e7490`,"--accent-hover":`#0b5f76`,"--accent-soft":`rgba(14, 116, 144, 0.1)`,"--accent-fg":`#ffffff`,"--accent-2":`#22a3c4`,"--link":`#0e7490`,"--unread":`#16a34a`},dark:{"--accent":`#5cc8dc`,"--accent-hover":`#7fd6e6`,"--accent-soft":`rgba(92, 200, 220, 0.14)`,"--accent-fg":`#0f2328`,"--accent-2":`#8be0ee`,"--link":`#7fd6e6`,"--unread":`#4ade80`}},{id:`ember`,label:`Ember`,note:`Warm terracotta`,swatch:[`#c2410c`,`#f59e5b`],light:{"--accent":`#c2410c`,"--accent-hover":`#9a3412`,"--accent-soft":`rgba(194, 65, 12, 0.09)`,"--accent-fg":`#ffffff`,"--accent-2":`#ea7a3c`,"--link":`#b4410f`,"--unread":`#16a34a`},dark:{"--accent":`#f59e5b`,"--accent-hover":`#f8b47e`,"--accent-soft":`rgba(245, 158, 91, 0.14)`,"--accent-fg":`#2a1a0e`,"--accent-2":`#fbc08f`,"--link":`#f8b47e`,"--unread":`#4ade80`}}],Do=`litepaseo-palette`,Oo=e((()=>{let e=localStorage.getItem(Do);return Eo.some(t=>t.id===e)?e:`ocean`})()),ko=[];function Ao(){let e=document.documentElement.style;for(let t of ko)e.removeProperty(t);let t=Eo.find(e=>e.id===Oo.value)??Eo[0],n=So.value?t.dark:t.light;for(let[t,r]of Object.entries(n))e.setProperty(t,r);ko=Object.keys(n),document.documentElement.dataset.palette=t.id}function jo(e=Oo.value){Oo.value=e,localStorage.setItem(Do,e),Ao()}n(So,Ao);var Mo=`Brave turns push off by default. Open brave://settings/privacy, turn on “Use Google services for push messaging”, restart Brave, and try again.`,No=`This browser could not reach its push service. A proxy, VPN or firewall may block it, or this browser build has no push service; Chrome, Edge or Firefox work.`;function Po(e){let{name:t,message:n}=e??{};return t===`AbortError`||/push service/i.test(String(n??``))}function Fo(e,t){return Po(e)?Error(t?Mo:No,{cause:e}):e instanceof Error?e:Error(String(e))}async function Io(e=globalThis.navigator){let t=e?.brave;try{return typeof t?.isBrave==`function`&&await t.isBrave()===!0}catch{return!1}}var Lo=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Ro=()=>matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,zo=y(null),Bo=e(Ro());window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),zo.value=e}),window.addEventListener(`appinstalled`,()=>{zo.value=null,Bo.value=!0});async function Vo(){let e=zo.value;if(!e)return!1;await e.prompt();let{outcome:t}=await e.userChoice;return zo.value=null,t===`accepted`}var Ho=null;function Uo(){return`serviceWorker`in navigator?(Ho??=navigator.serviceWorker.register(`/sw.js`,{scope:`/`}).catch(()=>null),Ho):Promise.resolve(null)}function Wo(){return window.isSecureContext?`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window?`supported`:Lo&&!Ro()?`needs-install`:`unsupported`:`insecure`}async function Go(){let e=await Uo();return e?e.pushManager.getSubscription():null}function Ko(e){let t=(e+`===`.slice((e.length+3)%4)).replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t);return Uint8Array.from(n,e=>e.charCodeAt(0))}async function qo(e,t){let n=await Notification.requestPermission();if(n!==`granted`)throw Error(n===`denied`?`Notifications are blocked for this site in your browser settings.`:`Permission was not granted.`);let r=await Uo();if(!r)throw Error(`Service worker unavailable.`);let{publicKey:i}=await e(`/push/key`),a=await r.pushManager.getSubscription();if(!a)try{a=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Ko(i)})}catch(e){throw Fo(e,await Io())}return await e(`/push/subscribe`,`POST`,{subscription:a.toJSON(),prefs:t}),a}async function Jo(e,t,n){await e(`/push/subscribe`,`POST`,{subscription:t.toJSON(),prefs:n})}async function Yo(e){let t=await Go();t&&(await e(`/push/unsubscribe`,`POST`,{endpoint:t.endpoint}).catch(()=>{}),await t.unsubscribe().catch(()=>{}))}function Xo(e){let t=navigator;t.setAppBadge&&(e>0?t.setAppBadge(e):t.clearAppBadge?.())?.catch(()=>{})}function Zo(e){let t=document.querySelector(`link[rel="icon"][data-status]`);t||(document.querySelectorAll(`link[rel="icon"]`).forEach(e=>e.remove()),t=document.createElement(`link`),t.rel=`icon`,t.type=`image/png`,t.dataset.status=``,document.head.appendChild(t));let n=`/icons/favicon${e?`-`+e:``}-64.png`;t.getAttribute(`href`)!==n&&t.setAttribute(`href`,n)}var Qo={class:`page`},$o={class:`page-head`},es={class:`page-body`},ts={class:`field`},ns=[`disabled`],rs={class:`form-actions`},is=[`disabled`],as={key:0,class:`setting-note is-error`,role:`alert`},os={key:1,class:`setting-note`,role:`status`},ss={class:`card`},cs={class:`card-row`},ls={class:`setting-icon`},us={class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Theme`},ds=[`aria-checked`,`onClick`],fs={class:`card-row palette-row`},ps={class:`setting-icon`},ms={class:`grow`},hs={class:`palette-grid`,role:`radiogroup`,"aria-label":`Colour palette`},gs=[`aria-checked`,`onClick`],_s={class:`palette-swatch`},vs={class:`palette-text`},ys={class:`palette-name`},bs={class:`row-sub`},xs={class:`card`},Ss={class:`card-row`},Cs={class:`setting-icon`},ws={class:`grow`},Ts={class:`row-sub`},Es=[`disabled`],Ds=[`disabled`],Os={class:`card-row switch-row`},ks=[`disabled`],As={class:`card-row switch-row`},js=[`disabled`],Ms={class:`card-row`},Ns=[`disabled`],Ps={key:0,class:`setting-note`},Fs={key:1,class:`setting-note is-error`},Is={class:`card`},Ls={class:`card-row`},Rs={class:`setting-icon`},zs={class:`grow`},Bs={class:`row-sub`},Vs=[`disabled`],Hs={class:`field`},Us={class:`field`},Ws=[`placeholder`,`required`],Gs={class:`field-grid`},Ks={class:`field`},qs={class:`field`},Js={class:`field`},Ys={class:`form-actions`},Xs=[`disabled`],Zs=[`disabled`],Qs=[`disabled`],$s={key:2,class:`setting-note`},ec={key:3,class:`setting-note is-error`},tc={class:`card`},nc={class:`card-row`},rc={class:`setting-icon`},ic={class:`grow`},ac={class:`row-sub`},oc=[`disabled`],sc={class:`card`},cc={class:`card-row`},lc={class:`setting-icon`},uc={class:`grow`},dc={class:`row-sub`},fc=[`disabled`],pc={key:0,class:`card-row totp-setup`},mc=[`src`],hc={class:`grow`},gc={class:`secret`},_c=[`disabled`],vc={key:1,class:`card-row`},yc=[`disabled`],bc={key:4,class:`setting-note is-error`},xc={class:`card`},Sc={class:`setting-icon`},Cc={class:`grow`},wc={class:`row-title`},Tc={key:0,class:`pill pill-current`},Ec={class:`row-sub`},Dc=[`disabled`,`onClick`],Oc={key:0,class:`card-row row-sub`},kc={class:`form-actions spaced`},Ac=[`disabled`],jc=f({__name:`Settings`,props:{request:{type:Function},totpEnabled:{type:Boolean},instanceName:{}},emits:[`instanceChanged`,`back`,`signedOut`,`totpChanged`,`dictationChanged`],setup(r,{emit:o}){let s=r,l=o,u=e(s.instanceName),f=e(!1),p=e(``),m=e(!1);n(()=>s.instanceName,(e,t)=>{u.value===t&&(u.value=e)}),n(u,()=>{m.value=!1},{flush:`sync`});async function y(){f.value=!0,p.value=``,m.value=!1;try{let e=await s.request(`/instance`,`PUT`,{name:u.value});u.value=e.name,l(`instanceChanged`,e.name),m.value=!0}catch(e){p.value=e.message}finally{f.value=!1}}let C=e(null),w=e({baseUrl:``,apiKey:``,model:``,languages:``,keywords:``}),T=(e,t)=>e.split(t).map(e=>e.trim()).filter(Boolean),E=e(!1),O=e(!1),A=e(``),j=e(``);function N(e){C.value=e,w.value={baseUrl:e.baseUrl,apiKey:``,model:e.model,languages:e.languages.join(`, `),keywords:e.keywords.join(`
|
|
30
|
+
`)},l(`dictationChanged`,e.configured)}async function P(e){O.value=!0,A.value=j.value=``;try{await e()}catch(e){A.value=e.message}finally{O.value=!1}}let I=()=>P(async()=>{let e=w.value;N(await s.request(`/dictation`,`PUT`,{baseUrl:e.baseUrl,apiKey:e.apiKey,model:e.model,languages:T(e.languages,/[,\s]+/),keywords:T(e.keywords,/[,\n]+/)})),E.value=!1,j.value=`Saved. The microphone button is in the composer.`}),L=()=>P(async()=>{confirm(`Remove the transcription service? Voice input turns off on every device.`)&&(N(await s.request(`/dictation`,`DELETE`)),E.value=!1)});function B(){C.value&&N(C.value),E.value=!1,A.value=``}let V=Wo(),H=e(null),U=e({attention:!0,turns:!0}),W=e(typeof Notification>`u`?`default`:Notification.permission),G=e(!1),K=e(``),q=e(``);async function ee(){if(V!==`supported`||(H.value=await Go(),!H.value))return;let e=await s.request(`/push/status`,`POST`,{endpoint:H.value.endpoint});e.subscribed?U.value=e.prefs:H.value=null}async function te(e){G.value=!0,q.value=K.value=``;try{await e()}catch(e){q.value=e.message}finally{G.value=!1,W.value=typeof Notification>`u`?`default`:Notification.permission}}let ne=()=>te(async()=>{H.value=await qo(s.request,U.value),K.value=`Notifications are on for this device.`}),re=()=>te(async()=>{await Yo(s.request),H.value=null}),ie=()=>te(async()=>{H.value&&await Jo(s.request,H.value,U.value)}),ae=()=>te(async()=>{let{sent:e}=await s.request(`/push/test`,`POST`,{});K.value=e?`Test sent. It should arrive in a few seconds.`:`This device is not registered.`}),oe=e(!1);async function se(){oe.value=!0;try{await Vo()}finally{oe.value=!1}}let ce=e([]),le=e(null),ue=e(``),de=e(``),fe=e(!1);async function pe(){ce.value=await s.request(`/sessions`)}async function me(e){fe.value=!0,de.value=``;try{await e()}catch(e){de.value=e.message}finally{fe.value=!1}}let he=()=>me(async()=>{le.value=await s.request(`/totp/setup`,`POST`,{}),ue.value=``}),ge=()=>me(async()=>{await s.request(`/totp/confirm`,`POST`,{code:ue.value.trim()}),le.value=null,ue.value=``,l(`totpChanged`,!0)}),_e=()=>me(async()=>{await s.request(`/totp/disable`,`POST`,{code:ue.value.trim()}),ue.value=``,l(`totpChanged`,!1)}),ve=e=>me(async()=>{await s.request(`/sessions/`+e.id,`DELETE`),e.current?l(`signedOut`):await pe()}),ye=()=>me(async()=>{confirm(`Sign out every device, including this one? Their notifications stop too.`)&&(await s.request(`/sessions/revoke-all`,`POST`,{}),l(`signedOut`))}),be=e=>{let t=Math.max(0,(Date.now()-e)/1e3);return t<90?`just now`:t<5400?`${Math.round(t/60)} min ago`:t<129600?`${Math.round(t/3600)} h ago`:`${Math.round(t/86400)} days ago`},xe=S(()=>W.value===`denied`);return c(()=>{ee().catch(()=>{}),pe().catch(()=>{}),s.request(`/dictation`).then(N).catch(()=>{})}),(e,n)=>(i(),R(`section`,Qo,[x(`header`,$o,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:n[0]||=e=>l(`back`)},[t(J,{name:`back`,size:18})]),n[13]||=x(`div`,null,[x(`h1`,null,`Settings`),x(`p`,{class:`subtle`},`Appearance, notifications, the app on your phone, and who can sign in.`)],-1)]),x(`div`,es,[n[32]||=x(`h2`,{class:`section-label`},`Instance`,-1),x(`form`,{class:`card form-card`,onSubmit:v(y,[`prevent`])},[x(`label`,ts,[n[14]||=x(`span`,null,`Instance name`,-1),a(x(`input`,{"onUpdate:modelValue":n[1]||=e=>u.value=e,maxlength:`64`,placeholder:`LitePaseo`,disabled:f.value},null,8,ns),[[_,u.value]])]),n[15]||=x(`p`,{class:`subtle`},`Shown in browser tabs and the sidebar for everyone using this instance. Leave blank to use LitePaseo.`,-1),x(`div`,rs,[x(`button`,{class:`btn btn-primary`,disabled:f.value||u.value===r.instanceName},k(f.value?`Saving…`:`Save instance name`),9,is)]),p.value?(i(),R(`p`,as,k(p.value),1)):F(``,!0),m.value?(i(),R(`p`,os,`Instance name saved.`)):F(``,!0)],32),n[33]||=x(`h2`,{class:`section-label`},`Appearance`,-1),x(`div`,ss,[x(`div`,cs,[x(`span`,ls,[t(J,{name:`sun`,size:16})]),n[16]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`Theme`)],-1),x(`div`,us,[(i(),R(b,null,z([`system`,`light`,`dark`],e=>x(`button`,{key:e,role:`radio`,"aria-checked":D(yo)===e,class:M({chosen:D(yo)===e}),onClick:t=>D(Co)(e)},k(e===`system`?`System`:e===`light`?`Light`:`Dark`),11,ds)),64))])]),x(`div`,fs,[x(`span`,ps,[t(J,{name:`sparkle`,size:16})]),x(`div`,ms,[n[17]||=x(`div`,{class:`row-title`},`Colour`,-1),x(`div`,hs,[(i(!0),R(b,null,z(D(Eo),e=>(i(),R(`button`,{key:e.id,type:`button`,role:`radio`,class:M([`palette-option`,{chosen:D(Oo)===e.id}]),"aria-checked":D(Oo)===e.id,onClick:t=>D(jo)(e.id)},[x(`span`,_s,[x(`span`,{style:g({background:e.swatch[0]})},null,4),x(`span`,{style:g({background:e.swatch[1]})},null,4)]),x(`span`,vs,[x(`span`,ys,k(e.label),1),x(`span`,bs,k(e.note),1)])],10,gs))),128))])])])]),n[34]||=x(`h2`,{class:`section-label`},`Notifications`,-1),x(`div`,xs,[x(`div`,Ss,[x(`span`,Cs,[t(J,{name:`bell`,size:16})]),x(`div`,ws,[n[18]||=x(`div`,{class:`row-title`},`Push notifications`,-1),x(`div`,Ts,[D(V)===`insecure`?(i(),R(b,{key:0},[d(`Needs HTTPS. Open the console through your tunnel's https:// address.`)],64)):D(V)===`needs-install`?(i(),R(b,{key:1},[d(`On iPhone and iPad, add LitePaseo to your Home Screen first, then open it from there.`)],64)):D(V)===`unsupported`?(i(),R(b,{key:2},[d(`This browser cannot receive push notifications.`)],64)):xe.value?(i(),R(b,{key:3},[d(`Blocked in this browser's site settings. Allow notifications there, then return.`)],64)):H.value?(i(),R(b,{key:4},[d(`On for this device. Arrives even when the app is closed.`)],64)):(i(),R(b,{key:5},[d(`Get told when an agent needs you or a turn finishes, even with the app closed.`)],64))])]),D(V)===`supported`&&!H.value&&!xe.value?(i(),R(`button`,{key:0,class:`btn btn-primary`,disabled:G.value,onClick:ne},` Turn on `,8,Es)):H.value?(i(),R(`button`,{key:1,class:`btn btn-outline`,disabled:G.value,onClick:re},`Turn off`,8,Ds)):F(``,!0)]),H.value?(i(),R(b,{key:0},[x(`label`,Os,[n[19]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`When an agent needs your input`),x(`div`,{class:`row-sub`},`Permission requests and questions`)],-1),a(x(`input`,{"onUpdate:modelValue":n[2]||=e=>U.value.attention=e,class:`switch`,type:`checkbox`,disabled:G.value,onChange:ie},null,40,ks),[[h,U.value.attention]])]),x(`label`,As,[n[20]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`When a turn finishes`),x(`div`,{class:`row-sub`},`Including failed turns`)],-1),a(x(`input`,{"onUpdate:modelValue":n[3]||=e=>U.value.turns=e,class:`switch`,type:`checkbox`,disabled:G.value,onChange:ie},null,40,js),[[h,U.value.turns]])]),x(`div`,Ms,[n[21]||=x(`div`,{class:`grow row-sub`},`Not sent while you are viewing that conversation on any device.`,-1),x(`button`,{class:`btn btn-outline`,disabled:G.value,onClick:ae},`Send a test`,8,Ns)])],64)):F(``,!0)]),K.value?(i(),R(`p`,Ps,k(K.value),1)):F(``,!0),q.value?(i(),R(`p`,Fs,k(q.value),1)):F(``,!0),n[35]||=x(`h2`,{class:`section-label`},`Voice input`,-1),x(`div`,Is,[x(`div`,Ls,[x(`span`,Rs,[t(J,{name:`mic`,size:16})]),x(`div`,zs,[n[22]||=x(`div`,{class:`row-title`},`Transcription service`,-1),x(`div`,Bs,[C.value?.configured?(i(),R(b,{key:0},[d(k(C.value.model)+` · `+k(C.value.baseUrl.replace(/^https?:\/\//,``))+` · key `+k(C.value.keyHint)+k(C.value.languages.length?` · `+C.value.languages.join(`, `):``)+k(C.value.keywords.length?` · ${C.value.keywords.length} terms`:``),1)],64)):(i(),R(b,{key:1},[d(`Any OpenAI-compatible speech-to-text API. Set it once here and the microphone works for every host.`)],64))])]),E.value?F(``,!0):(i(),R(`button`,{key:0,class:`btn btn-outline`,disabled:O.value||!C.value,onClick:n[4]||=e=>E.value=!0},k(C.value?.configured?`Edit`:`Set up`),9,Vs))]),E.value?(i(),R(`form`,{key:0,class:`card-row voice-form`,onSubmit:v(I,[`prevent`])},[x(`label`,Hs,[n[23]||=x(`span`,null,`Base URL`,-1),a(x(`input`,{"onUpdate:modelValue":n[5]||=e=>w.value.baseUrl=e,placeholder:`https://api.openai.com/v1`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,w.value.baseUrl]])]),x(`label`,Us,[n[24]||=x(`span`,null,`API key`,-1),a(x(`input`,{"onUpdate:modelValue":n[6]||=e=>w.value.apiKey=e,type:`password`,autocomplete:`off`,placeholder:C.value?.configured?`Unchanged (`+C.value.keyHint+`)`:`sk-…`,required:!C.value?.configured},null,8,Ws),[[_,w.value.apiKey]])]),x(`div`,Gs,[x(`label`,Ks,[n[25]||=x(`span`,null,`Model`,-1),a(x(`input`,{"onUpdate:modelValue":n[7]||=e=>w.value.model=e,placeholder:`gpt-transcribe`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,w.value.model]])]),x(`label`,qs,[n[26]||=x(`span`,null,`Languages`,-1),a(x(`input`,{"onUpdate:modelValue":n[8]||=e=>w.value.languages=e,placeholder:`Detect (or zh, en)`,maxlength:`80`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,w.value.languages]])])]),x(`label`,Js,[n[27]||=x(`span`,null,`Vocabulary`,-1),a(x(`textarea`,{"onUpdate:modelValue":n[9]||=e=>w.value.keywords=e,rows:`3`,placeholder:`LitePaseo
|
|
31
|
+
Claude Code
|
|
32
|
+
pnpm`,spellcheck:`false`},null,512),[[_,w.value.keywords]])]),n[28]||=x(`p`,{class:`row-sub`},` The key stays on this server; browsers never see it. List every language you mix while speaking. Vocabulary is names and terms to spell right, one per line. gpt-transcribe gets both as hints; Whisper-style models get one language and the terms as a prompt. `,-1),x(`div`,Ys,[C.value?.configured?(i(),R(`button`,{key:0,type:`button`,class:`btn btn-ghost voice-remove`,disabled:O.value,onClick:L},`Remove`,8,Xs)):F(``,!0),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:O.value,onClick:B},`Cancel`,8,Zs),x(`button`,{class:`btn btn-primary`,disabled:O.value},`Save`,8,Qs)])],32)):F(``,!0)]),j.value?(i(),R(`p`,$s,k(j.value),1)):F(``,!0),A.value?(i(),R(`p`,ec,k(A.value),1)):F(``,!0),n[36]||=x(`h2`,{class:`section-label`},`App`,-1),x(`div`,tc,[x(`div`,nc,[x(`span`,rc,[t(J,{name:`phone`,size:16})]),x(`div`,ic,[n[29]||=x(`div`,{class:`row-title`},`Install LitePaseo`,-1),x(`div`,ac,[D(Bo)?(i(),R(b,{key:0},[d(`Installed. You are using the app.`)],64)):D(zo)?(i(),R(b,{key:1},[d(`Full screen, its own icon, and notifications.`)],64)):D(Lo)?(i(),R(b,{key:2},[d(`In Safari, tap Share, then “Add to Home Screen”.`)],64)):(i(),R(b,{key:3},[d(`Use your browser's menu: “Install app” or “Add to Home screen”.`)],64))])]),D(zo)&&!D(Bo)?(i(),R(`button`,{key:0,class:`btn btn-primary`,disabled:oe.value,onClick:se},`Install`,8,oc)):F(``,!0)])]),n[37]||=x(`h2`,{class:`section-label`},`Sign-in`,-1),x(`div`,sc,[x(`div`,cc,[x(`span`,lc,[t(J,{name:`shield`,size:16})]),x(`div`,uc,[n[30]||=x(`div`,{class:`row-title`},`Authenticator code`,-1),x(`div`,dc,k(r.totpEnabled?`On. Sign in with your access token and a 6-digit authenticator code.`:`Require an authenticator code in addition to your access token. Other browsers will need to sign in again.`),1)]),!r.totpEnabled&&!le.value?(i(),R(`button`,{key:0,class:`btn btn-outline`,disabled:fe.value,onClick:he},`Set up`,8,fc)):F(``,!0)]),le.value?(i(),R(`div`,pc,[x(`img`,{src:le.value.qr,alt:`Authenticator QR code`,width:`164`,height:`164`},null,8,mc),x(`div`,hc,[n[31]||=x(`p`,{class:`row-sub`},`Scan with Google Authenticator, 1Password, Authy or similar. Or enter this key:`,-1),x(`code`,gc,k(le.value.secret.match(/.{1,4}/g)?.join(` `)),1),x(`form`,{class:`code-form`,onSubmit:v(ge,[`prevent`])},[a(x(`input`,{"onUpdate:modelValue":n[10]||=e=>ue.value=e,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,placeholder:`123456`,"aria-label":`Code from your app`},null,512),[[_,ue.value]]),x(`button`,{class:`btn btn-primary`,disabled:fe.value||ue.value.trim().length!==6},`Turn on`,8,_c),x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:n[11]||=e=>le.value=null},`Cancel`)],32)])])):F(``,!0),r.totpEnabled?(i(),R(`div`,vc,[x(`form`,{class:`code-form grow`,onSubmit:v(_e,[`prevent`])},[a(x(`input`,{"onUpdate:modelValue":n[12]||=e=>ue.value=e,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,placeholder:`Current code`,"aria-label":`Current code`},null,512),[[_,ue.value]]),x(`button`,{class:`btn btn-outline`,disabled:fe.value||ue.value.trim().length!==6},`Turn off`,8,yc)],32)])):F(``,!0)]),de.value?(i(),R(`p`,bc,k(de.value),1)):F(``,!0),n[38]||=x(`h2`,{class:`section-label`},`Signed-in devices`,-1),x(`div`,xc,[(i(!0),R(b,null,z(ce.value,e=>(i(),R(`div`,{key:e.id,class:`card-row`},[x(`span`,Sc,[t(J,{name:/iOS|Android/.test(e.label)?`phone`:`monitor`,size:16},null,8,[`name`])]),x(`div`,Cc,[x(`div`,wc,[d(k(e.label),1),e.current?(i(),R(`span`,Tc,`This device`)):F(``,!0)]),x(`div`,Ec,`Active `+k(be(e.lastSeen))+` · signed in `+k(new Date(e.created).toLocaleDateString()),1)]),x(`button`,{class:`btn btn-outline`,disabled:fe.value,onClick:t=>ve(e)},k(e.current?`Sign out`:`Revoke`),9,Dc)]))),128)),ce.value.length?F(``,!0):(i(),R(`div`,Oc,`Signed in with the access token only.`))]),x(`div`,kc,[x(`button`,{class:`btn btn-ghost`,disabled:fe.value,onClick:ye},`Sign out everywhere`,8,Ac)])])]))}}),Mc={class:`agent-board`},Nc=[`title`],Pc={class:`count`},Fc=[`onClick`,`onKeydown`],Ic={class:`task-top`},Lc={class:`task-title`},Rc={class:`task-meta`},zc=[`onClick`],Bc=[`disabled`,`onClick`],Vc=[`disabled`,`onClick`],Hc=[`disabled`,`onClick`],Uc=[`onClick`],Wc={key:1,class:`column-empty`},Gc=40,Kc=f({__name:`AgentBoard`,props:{store:{},hostLabels:{},busy:{type:Boolean}},emits:[`open`,`stop`,`read`,`archive`],setup(e,{emit:n}){let r=e,a=n,o={needs_input:`Needs you`,running:`Running`,review:`To review`,done:`Done`},s={needs_input:`Waiting on a permission or an answer`,running:`Working right now`,review:`Finished or failed, not looked at yet`,done:`Seen and settled`},c=u({needs_input:Gc,running:Gc,review:Gc,done:Gc}),l=S(()=>(r.store.version.value,ee.map(e=>({lane:e,size:r.store.laneSize(e),agents:r.store.laneRange(e,0,c[e])})))),f=e=>{if(!e||e<15778368e5)return``;let t=Math.max(0,(Date.now()-e)/1e3);return t<60?`just now`:t<3600?`${Math.round(t/60)} min ago`:t<86400?`${Math.round(t/3600)} h ago`:`${Math.round(t/86400)} d ago`},p=e=>{if(e.state===`needs_input`){let t=e.pendingPermissions[0];return t?`${t.kind===`question`?`Asks:`:`Wants to`} ${ne(t.title||t.name)}`:`Waiting for you`}return e.state===`failed`?e.lastError||`Turn failed`:e.state===`running`?`Working…`:e.state===`unread`?`Finished ${f(e.activityAt)}`:f(e.activityAt)};return(n,r)=>(i(),R(`div`,Mc,[(i(!0),R(b,null,z(l.value,n=>(i(),R(`section`,{key:n.lane,class:M([`lane`,`lane-`+n.lane])},[x(`header`,{class:`lane-head`,title:s[n.lane]},[r[1]||=x(`span`,{class:`lane-dot`},null,-1),x(`h3`,null,k(o[n.lane]),1),x(`span`,Pc,k(n.size),1)],8,Nc),(i(!0),R(b,null,z(n.agents,n=>(i(),R(`article`,{key:n.key,class:M([`task-card`,`is-`+n.state]),tabindex:`0`,onClick:e=>a(`open`,n.key),onKeydown:P(e=>a(`open`,n.key),[`enter`])},[x(`div`,Ic,[x(`span`,{class:M([`status-dot`,`is-`+(n.state===`needs_input`?`attention`:n.state===`failed`?`error`:n.state)])},null,2),x(`span`,Lc,k(n.title||`Untitled session`),1)]),x(`div`,Rc,k(n.project)+` · `+k(e.hostLabels.get(n.hostId)??`?`)+` · `+k(n.provider),1),x(`div`,{class:M([`task-detail`,{"is-error":n.state===`failed`}])},k(p(n)),3),x(`div`,{class:`task-actions`,onClick:r[0]||=v(()=>{},[`stop`])},[n.state===`needs_input`?(i(),R(`button`,{key:0,class:`btn btn-primary btn-sm`,onClick:e=>a(`open`,n.key)},`Respond`,8,zc)):F(``,!0),n.state===`running`?(i(),R(`button`,{key:1,class:`btn btn-outline btn-sm`,disabled:e.busy,onClick:e=>a(`stop`,n)},[t(J,{name:`stop`,size:11}),r[2]||=d(`Stop `,-1)],8,Bc)):F(``,!0),n.unread?(i(),R(`button`,{key:2,class:`btn btn-outline btn-sm`,disabled:e.busy,onClick:e=>a(`read`,n)},[t(J,{name:`check`,size:12}),r[3]||=d(`Mark read `,-1)],8,Vc)):F(``,!0),n.state!==`running`&&n.state!==`needs_input`?(i(),R(`button`,{key:3,class:`btn btn-ghost btn-sm`,disabled:e.busy,onClick:e=>a(`archive`,n)},` Archive `,8,Hc)):F(``,!0)])],42,Fc))),128)),n.size>c[n.lane]?(i(),R(`button`,{key:0,class:`btn btn-ghost lane-more`,onClick:e=>c[n.lane]+=Gc},` Show `+k(Math.min(Gc,n.size-c[n.lane]))+` more `,9,Uc)):F(``,!0),n.size?F(``,!0):(i(),R(`p`,Wc,`Nothing here`))],2))),128))]))}}),qc={key:0,class:`usage`},Jc=[`aria-expanded`],Yc={class:`usage-name`},Xc={key:0,class:`usage-card`,role:`dialog`,"aria-label":`Usage limits`},Zc=[`disabled`],Qc={key:0,class:`spinner spinner-sm`},$c={class:`usage-account-head`},el={class:`row-title`},tl={class:`row-sub`},nl={key:0,class:`row-sub is-error`},rl={class:`usage-window-head`},il={class:`usage-bar`},al={class:`usage-window-foot`},ol={class:`usage-foot`},sl=f({__name:`UsagePanel`,props:{report:{},loading:{type:Boolean}},emits:[`refresh`],setup(n,{emit:r}){let a=n,o=r,s=e(!1);function c(e){let t=`${e.shortLabel??``} ${e.label}`.toLowerCase();return/5\s*h|5-hour|five/.test(t)?18e6:/wk|week/.test(t)?6048e5:/month|mo\b/.test(t)?2592e6:null}function l(e){let t=c(e);if(e.remainingPct===null||!e.resetsAt||!t)return null;let n=Date.parse(e.resetsAt)-Date.now(),r=t<=18e6?36e5:864e5;if(n<=r)return null;let i=e.remainingPct/(n/r),a=i/(100/(t/r));return{text:`${i.toFixed(+(i<10))}% per ${r===36e5?`hour`:`day`}`,tone:a>=.85?`ok`:a>=.5?`warning`:`danger`}}function u(e){return e.remainingPct===null?`default`:e.remainingPct<10?`danger`:e.remainingPct<30?`warning`:`ok`}function f(e){if(!e.resetsAt)return``;let t=new Date(e.resetsAt),n=t.getTime()-Date.now();if(n<=0)return`resetting`;let r=new Date,i=new Date(r.getTime()+864e5),a=t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),o=t.toDateString()===r.toDateString()?`today`:t.toDateString()===i.toDateString()?`tomorrow`:t.toLocaleDateString([],{weekday:`short`,month:`numeric`,day:`numeric`}),s=Math.floor(n/36e5),c=Math.round(n%36e5/6e4);return`${o} ${a} · in ${s>=24?`${Math.floor(s/24)}d ${s%24}h`:s?`${s}h ${c}m`:`${c}m`}`}let p=S(()=>a.report?.accounts.filter(e=>e.windows.length||e.error)??[]),h=e=>e.shortLabel??e.label;return(e,r)=>p.value.length?(i(),R(`div`,qc,[x(`button`,{class:`usage-summary`,"aria-expanded":s.value,onClick:r[0]||=e=>s.value=!s.value},[(i(!0),R(b,null,z(p.value,e=>(i(),R(`span`,{key:e.key,class:`usage-line`},[x(`span`,Yc,k(e.name),1),(i(!0),R(b,null,z(e.windows.slice(0,3),e=>(i(),R(`span`,{key:e.id,class:M([`usage-pct`,`tone-`+u(e)])},[d(k(e.remainingPct===null?`—`:Math.round(e.remainingPct)+`%`),1),x(`small`,null,k(h(e)),1)],2))),128))]))),128))],8,Jc),s.value?(i(),R(`div`,Xc,[x(`header`,null,[r[3]||=x(`strong`,null,`Usage left`,-1),x(`button`,{class:`icon-btn`,disabled:n.loading,title:`Refresh`,"aria-label":`Refresh usage`,onClick:r[1]||=e=>o(`refresh`)},[n.loading?(i(),R(`span`,Qc)):(i(),m(J,{key:1,name:`refresh`,size:14}))],8,Zc),x(`button`,{class:`icon-btn`,"aria-label":`Close`,onClick:r[2]||=e=>s.value=!1},[t(J,{name:`close`,size:14})])]),(i(!0),R(b,null,z(p.value,e=>(i(),R(`section`,{key:e.key,class:`usage-account`},[x(`div`,$c,[x(`span`,el,k(e.name),1),x(`span`,tl,k([e.plan,e.hosts.join(`, `)].filter(Boolean).join(` · `)),1)]),e.error?(i(),R(`p`,nl,k(e.error),1)):F(``,!0),(i(!0),R(b,null,z(e.windows,e=>(i(),R(`div`,{key:e.id,class:`usage-window`},[x(`div`,rl,[x(`span`,null,k(e.label),1),x(`strong`,{class:M(`tone-`+u(e))},k(e.remainingPct===null?`—`:Math.round(e.remainingPct)+`% left`),3)]),x(`div`,il,[x(`span`,{class:M(`tone-`+u(e)),style:g({width:Math.max(0,Math.min(100,e.remainingPct??0))+`%`})},null,6)]),x(`div`,al,[x(`span`,null,k(f(e)),1),l(e)?(i(),R(`span`,{key:0,class:M(`tone-`+l(e).tone)},k(l(e).text),3)):F(``,!0)])]))),128))]))),128)),(i(!0),R(b,null,z(n.report?.unavailableHosts??[],e=>(i(),R(`p`,{key:e.hostId,class:`row-sub`},k(e.label)+`: `+k(e.error),1))),128)),x(`p`,ol,` Updated `+k(n.report?.fetchedAt?new Date(n.report.fetchedAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):`—`)+` · hosts cache usage for 5 min `,1)])):F(``,!0)])):F(``,!0)}}),cl=[`aria-label`],ll={class:`sheet-head task-head`},ul={class:`sheet-body task-body`},dl={class:`task-meta`},fl=[`value`,`disabled`],pl={class:`task-link`},ml=[`title`],hl={class:`card-link-name`},gl={key:1,class:`subtle small`},_l=[`value`,`disabled`],vl=[`value`],yl=[`value`],bl={class:`task-section`},xl={class:`task-actions`},Sl=[`disabled`],Cl=[`innerHTML`],wl={class:`task-section`},Tl={key:0,class:`subtle`},El={key:0,class:`task-comments`},Dl={class:`task-comment-head`},Ol={class:`subtle small`},kl=[`disabled`,`onClick`],Al=[`innerHTML`],jl={class:`task-actions`},Ml=[`disabled`],Nl={class:`sheet-foot task-foot`},Pl={class:`subtle small`},Fl=[`disabled`],Il=2e4,Ll=5e3,Rl=f({__name:`TaskDialog`,props:{card:{},columns:{},links:{},linkedName:{},busy:{type:Boolean}},emits:[`close`,`patch`,`comment`,`uncomment`,`remove`,`open`],setup(r,{emit:o}){let s=r,c=o,l=e(s.card.title);n(()=>s.card.title,e=>l.value=e);function u(){let e=l.value.trim();e?e!==s.card.title&&c(`patch`,{title:e}):l.value=s.card.title}let f=e(!1),p=e(s.card.description??``),m=e(null);n(()=>s.card.description,e=>{f.value||(p.value=e??``)});let h=S(()=>kr(s.card.description??``)),g=S(()=>f.value&&p.value!==(s.card.description??``));function y(){f.value=!0,C(()=>{M(m.value),m.value?.focus()})}function w(){g.value&&c(`patch`,{description:p.value}),f.value=!1}function T(){p.value=s.card.description??``,f.value=!1}let E=e(``),D=e(null);function O(){let e=E.value.trim();e&&!s.busy&&(c(`comment`,e),E.value=``,C(()=>M(D.value)))}function A(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())}function j(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),w()):e.key===`Escape`&&(e.stopPropagation(),T())}function M(e){e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,Math.round(window.innerHeight*.5))+`px`)}let N=S(()=>(s.card.comments??[]).map(e=>({...e,html:kr(e.text),when:Un(new Date(e.at))}))),I=S(()=>s.card.hostId&&s.card.agentId?`${s.card.hostId}:${s.card.agentId}`:``);function L(e){let[t,...n]=e.split(`:`);c(`patch`,{link:e?{hostId:t,agentId:n.join(`:`)}:null})}let B=S(()=>{let e=[];return s.card.createdAt&&e.push(`Created `+Un(new Date(s.card.createdAt))),s.card.updatedAt&&e.push(`updated `+Un(new Date(s.card.updatedAt))),e.join(` · `)});function V(){u(),g.value&&w(),(!E.value.trim()||confirm(`Discard the comment you started?`))&&c(`close`)}function H(){confirm(`Delete “${s.card.title}”? Its description and comments are deleted too.`)&&c(`remove`)}function U(e){confirm(`Delete this comment?`)&&c(`uncomment`,e)}return(e,n)=>(i(),R(`div`,{class:`overlay`,onMousedown:v(V,[`self`]),onKeydown:P(V,[`esc`])},[x(`section`,{class:`sheet task-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Task: `+r.card.title},[x(`header`,ll,[a(x(`input`,{"onUpdate:modelValue":n[0]||=e=>l.value=e,class:`task-title`,"aria-label":`Title`,maxlength:`300`,onBlur:u,onKeydown:n[1]||=P(v(e=>e.target.blur(),[`prevent`]),[`enter`])},null,544),[[_,l.value]]),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:V},[t(J,{name:`close`,size:16})])]),x(`div`,ul,[x(`div`,dl,[x(`select`,{value:r.card.column,"aria-label":`Column`,disabled:r.busy,onChange:n[2]||=e=>c(`patch`,{column:e.target.value})},[(i(!0),R(b,null,z(r.columns,e=>(i(),R(`option`,{key:e},k(e),1))),128))],40,fl),x(`div`,pl,[I.value&&r.linkedName?(i(),R(`button`,{key:0,type:`button`,class:`link-btn`,title:`Open `+r.linkedName,onClick:n[3]||=e=>c(`open`)},[t(J,{name:`chat`,size:13}),x(`span`,hl,k(r.linkedName),1)],8,ml)):I.value?(i(),R(`span`,gl,`Conversation unavailable`)):F(``,!0),x(`select`,{class:`card-link-select`,"aria-label":`Link to conversation`,value:I.value,disabled:r.busy,onChange:n[4]||=e=>L(e.target.value)},[n[10]||=x(`option`,{value:``},`No conversation`,-1),I.value&&!r.links.some(e=>e.key===I.value)?(i(),R(`option`,{key:0,value:I.value},k(r.linkedName??`Unavailable conversation`),9,vl)):F(``,!0),(i(!0),R(b,null,z(r.links,e=>(i(),R(`option`,{key:e.key,value:e.key},k(e.label),9,yl))),128))],40,_l)])]),x(`section`,bl,[n[12]||=x(`h3`,null,`Description`,-1),f.value?(i(),R(b,{key:0},[a(x(`textarea`,{ref_key:`descriptionInput`,ref:m,"onUpdate:modelValue":n[5]||=e=>p.value=e,class:`task-textarea`,"aria-label":`Description`,maxlength:Il,placeholder:`Markdown: what this task is, notes, checklists…`,onInput:n[6]||=e=>M(e.target),onKeydown:j},null,544),[[_,p.value]]),x(`div`,xl,[n[11]||=x(`span`,{class:`subtle small`},`Markdown · ⌘/Ctrl+Enter to save`,-1),x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:T},`Cancel`),x(`button`,{type:`button`,class:`btn btn-primary`,disabled:r.busy,onClick:w},`Save`,8,Sl)])],64)):r.card.description?(i(),R(`div`,{key:2,class:`prose task-description`,role:`button`,tabindex:`0`,title:`Click to edit`,onClick:n[7]||=e=>e.target.closest(`a`)||y(),onKeydown:P(y,[`enter`]),innerHTML:h.value},null,40,Cl)):(i(),R(`button`,{key:1,type:`button`,class:`task-empty`,onClick:y},`Add a description…`))]),x(`section`,wl,[x(`h3`,null,[n[13]||=d(`Comments `,-1),N.value.length?(i(),R(`span`,Tl,k(N.value.length),1)):F(``,!0)]),N.value.length?(i(),R(`ol`,El,[(i(!0),R(b,null,z(N.value,e=>(i(),R(`li`,{key:e.id,class:`task-comment`},[x(`div`,Dl,[x(`span`,Ol,k(e.when),1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Delete comment`,title:`Delete comment`,disabled:r.busy,onClick:t=>U(e.id)},[t(J,{name:`trash`,size:13})],8,kl)]),x(`div`,{class:`prose`,innerHTML:e.html},null,8,Al)]))),128))])):F(``,!0),x(`form`,{class:`task-new-comment`,onSubmit:v(O,[`prevent`])},[a(x(`textarea`,{ref_key:`commentInput`,ref:D,"onUpdate:modelValue":n[8]||=e=>E.value=e,class:`task-textarea`,rows:`2`,"aria-label":`New comment`,maxlength:Ll,placeholder:`Write a comment… (Markdown, ⌘/Ctrl+Enter to post)`,onInput:n[9]||=e=>M(e.target),onKeydown:A},null,544),[[_,E.value]]),x(`div`,jl,[x(`button`,{class:`btn btn-primary`,disabled:r.busy||!E.value.trim()},`Comment`,8,Ml)])],32)])]),x(`footer`,Nl,[x(`span`,Pl,k(B.value),1),x(`button`,{type:`button`,class:`btn btn-ghost task-delete`,disabled:r.busy,onClick:H},[t(J,{name:`trash`,size:14}),n[14]||=d(`Delete task`,-1)],8,Fl)])],8,cl)],32))}});function zl(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}var Bl={key:0,class:`icon provider-icon`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.25`,"stroke-linejoin":`round`,"aria-hidden":`true`},Vl=[`transform`],Hl={key:1,class:`icon provider-icon`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Ul={key:2,class:`icon provider-icon`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"aria-hidden":`true`},Wl=[`transform`],Gl=f({__name:`ProviderIcon`,props:{provider:{}},setup(e){let t=e,n=S(()=>t.provider.toLowerCase());return(e,t)=>n.value===`codex`||n.value===`openai`?(i(),R(`svg`,Bl,[(i(),R(b,null,z([0,60,120,180,240,300],e=>x(`path`,{key:e,transform:`rotate(${e} 12 12)`,d:`M12 3.2C14.3 1.8 17.4 3 18.1 5.5L18.1 12.4L12 15.9L8.6 13.9V7.1L14.5 3.7`},null,8,Vl)),64))])):n.value===`pi`?(i(),R(`svg`,Hl,[...t[0]||=[x(`path`,{d:`M3 7c2-2 3-2 5-2h13M8 5v8c0 3-1 5-3 6M16 5v11c0 3 3 3 4 1`},null,-1)]])):n.value===`claude`||n.value===`anthropic`?(i(),R(`svg`,Ul,[(i(),R(b,null,z([0,30,60,90,120,150],e=>x(`path`,{key:e,transform:`rotate(${e} 12 12)`,d:`M12 3v18`},null,8,Wl)),64))])):(i(),m(J,{key:3,name:n.value===`gemini`?`sparkle`:`bot`,size:18,class:`provider-icon`},null,8,[`name`]))}}),Kl={class:`agent-controls`},ql=[`title`],Jl={class:`chip-text`},Yl=[`disabled`,`value`],Xl=[`value`],Zl=[`value`],Ql=[`title`],$l={class:`chip-text`},eu=[`disabled`,`value`],tu=[`value`],nu=[`title`],ru={class:`chip-text`},iu=[`disabled`,`value`],au={key:0,value:``,disabled:``},ou=[`value`,`title`],su=[`aria-label`,`aria-pressed`,`title`,`disabled`,`onClick`],cu={key:0,class:`chip-text`},lu=[`title`],uu={key:1,class:`chip-text`},du={class:`chip-key`},fu=[`aria-label`,`disabled`,`value`,`onChange`],pu=[`value`],mu=[`title`,`aria-label`],hu={width:`18`,height:`18`,viewBox:`0 0 18 18`,"aria-hidden":`true`},gu=[`stroke-dasharray`],_u=3e5,vu=xn(f({__name:`AgentControls`,props:{agent:{},path:{},api:{type:Function},disabled:{type:Boolean}},emits:[`notice`],setup(r,{expose:a,emit:o}){let s=r,c=o,l=new Map,u=e(null),f=e({});async function p(e=!1){let t=s.agent.key,n=l.get(t);if(!e&&n&&Date.now()-n.at<_u)u.value=n.options;else try{let e=await s.api(s.path+`/config`);l.set(t,{at:Date.now(),options:e}),s.agent.key===t&&(u.value=e)}catch{s.agent.key===t&&(u.value=n?.options??null)}}n(()=>s.agent.key,()=>{u.value=l.get(s.agent.key)?.options??null,f.value={},p()},{immediate:!0});let h=S(()=>f.value.model??s.agent.model??null),g=S(()=>u.value?.models.find(e=>e.id===h.value)??null),_=S(()=>g.value?.label??(h.value?h.value.split(`/`).pop():`Model`));a({modelLabel:_});let v=S(()=>f.value.thinking??s.agent.thinking??g.value?.defaultThinkingId??null),y=S(()=>g.value?.thinking??[]),C=S(()=>y.value.find(e=>e.id===v.value)?.label??v.value??``),w=S(()=>f.value.mode??s.agent.modeId??null),T=S(()=>u.value?.modes??[]),E=S(()=>T.value.find(e=>e.id===w.value)?.label??`Mode`),D=S(()=>/full|bypass|danger|unrestricted/i.test(`${w.value} ${E.value}`)),O=e=>/^(plan|plan[-_ ]?mode)$/i.test(e.id)||/^plan(?: mode)?$/i.test(e.label),A=e=>/fast|speed/i.test(`${e.id} ${e.label}`),j=S(()=>(u.value?.features??[]).filter(e=>!O(e)).map(e=>{let t=f.value[`feature:`+e.id]??e.value;return e.type===`toggle`?{...e,value:t}:{...e,value:t,current:e.options.find(e=>e.id===t)?.label??``}}));n(()=>[s.agent.model,s.agent.thinking,s.agent.modeId],()=>{let e={...f.value};e.model===s.agent.model&&delete e.model,e.thinking===s.agent.thinking&&delete e.thinking,e.mode===s.agent.modeId&&delete e.mode,f.value=e});async function N(e,t,n){let r=f.value[e];f.value={...f.value,[e]:n};try{let n=(await s.api(s.path+`/config`,`POST`,t))?.notice;if(n?.message&&c(`notice`,n.message),e.startsWith(`feature:`)){l.delete(s.agent.key),await p(!0);let t={...f.value};delete t[e],f.value=t}}catch(t){if(f.value={...f.value,[e]:r},r===void 0){let t={...f.value};delete t[e],f.value=t}c(`notice`,t.message)}}let P=e=>e.target.value,I=S(()=>{let e=s.agent.contextUsed??0,t=s.agent.contextMax??0;if(!e||!t)return null;let n=Math.min(1,e/t),r=e=>e>=1e6?`${(e/1e6).toFixed(e%1e6?1:0)}M`:`${Math.round(e/1e3)}k`;return{ratio:n,percent:Math.round(n*100),title:`Context window: ${r(e)} of ${r(t)} tokens used`}}),L=2*Math.PI*7;return(e,n)=>(i(),R(`div`,Kl,[x(`label`,{class:M([`chip`,{"is-disabled":r.disabled||!u.value?.models.length}]),title:r.agent.provider+` · Model: `+_.value},[t(Gl,{provider:r.agent.provider},null,8,[`provider`]),x(`span`,Jl,k(_.value),1),t(J,{name:`chevron`,size:11,class:`chip-caret`}),x(`select`,{"aria-label":`Model`,disabled:r.disabled||!u.value?.models.length,value:h.value??``,onChange:n[0]||=e=>N(`model`,{model:P(e)},P(e))},[h.value&&!g.value?(i(),R(`option`,{key:0,value:h.value},k(_.value),9,Xl)):F(``,!0),(i(!0),R(b,null,z(u.value?.models??[],e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,Zl))),128))],40,Yl)],10,ql),y.value.length?(i(),R(`label`,{key:0,class:M([`chip`,{"is-disabled":r.disabled}]),title:`Thinking: `+C.value},[t(J,{name:`brain`,size:18}),x(`span`,$l,k(C.value),1),t(J,{name:`chevron`,size:11,class:`chip-caret`}),x(`select`,{"aria-label":`Thinking`,disabled:r.disabled,value:v.value??``,onChange:n[1]||=e=>N(`thinking`,{thinkingOptionId:P(e)},P(e))},[(i(!0),R(b,null,z(y.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,tu))),128))],40,eu)],10,Ql)):F(``,!0),T.value.length?(i(),R(`label`,{key:1,class:M([`chip`,{"is-disabled":r.disabled}]),title:`Mode: `+E.value},[t(J,{name:D.value?`shield-off`:`shield`,size:18},null,8,[`name`]),x(`span`,ru,k(E.value),1),t(J,{name:`chevron`,size:11,class:`chip-caret`}),x(`select`,{"aria-label":`Mode`,disabled:r.disabled,value:w.value??``,onChange:n[2]||=e=>N(`mode`,{modeId:P(e)},P(e))},[w.value?F(``,!0):(i(),R(`option`,au,`Mode`)),(i(!0),R(b,null,z(T.value,e=>(i(),R(`option`,{key:e.id,value:e.id,title:e.description},k(e.label),9,ou))),128))],40,iu)],10,nu)):F(``,!0),(i(!0),R(b,null,z(j.value,e=>(i(),R(b,{key:e.id},[e.type===`toggle`?(i(),R(`button`,{key:0,type:`button`,class:M([`chip chip-toggle`,{chosen:e.value,"chip-icon-only":A(e)}]),"aria-label":e.label,"aria-pressed":e.value,title:e.tooltip??e.label,disabled:r.disabled,onClick:t=>N(`feature:`+e.id,{feature:{id:e.id,value:!e.value}},!e.value)},[t(J,{name:A(e)?`bolt`:`sliders`,size:18},null,8,[`name`]),A(e)?F(``,!0):(i(),R(`span`,cu,k(e.label),1))],10,su)):(i(),R(`label`,{key:1,class:M([`chip`,{"is-disabled":r.disabled,"chip-icon-only":A(e),chosen:A(e)&&e.value===`fast`}]),title:[e.label,e.current,e.tooltip].filter(Boolean).join(` · `)},[A(e)?(i(),m(J,{key:0,name:`bolt`,size:18})):F(``,!0),A(e)?F(``,!0):(i(),R(`span`,uu,[x(`span`,du,k(e.label)+`:`,1),d(` `+k(e.current||`Default`),1)])),A(e)?F(``,!0):(i(),m(J,{key:2,name:`chevron`,size:11,class:`chip-caret`})),x(`select`,{"aria-label":e.label,disabled:r.disabled,value:e.value??``,onChange:t=>N(`feature:`+e.id,{feature:{id:e.id,value:P(t)}},P(t))},[(i(!0),R(b,null,z(e.options,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,pu))),128))],40,fu)],10,lu))],64))),128)),I.value?(i(),R(`span`,{key:2,class:M([`context-gauge`,{"is-high":I.value.ratio>=.8}]),title:I.value.title,role:`img`,"aria-label":I.value.title},[(i(),R(`svg`,hu,[n[3]||=x(`circle`,{cx:`9`,cy:`9`,r:`7`,class:`context-track`},null,-1),x(`circle`,{cx:`9`,cy:`9`,r:`7`,class:`context-fill`,"stroke-dasharray":`${L*I.value.ratio} ${L}`,transform:`rotate(-90 9 9)`},null,8,gu)])),x(`span`,null,k(I.value.percent)+`%`,1)],10,mu)):F(``,!0)]))}}),[[`__scopeId`,`data-v-d1984eb2`]]),yu={class:`page`},bu={class:`page-head`},xu=[`disabled`],Su={class:`page-body`},Cu={key:0,class:`setting-note is-error`},wu={class:`row-title`},Tu={key:0,class:`field-grid`},Eu={class:`field`},Du=[`disabled`,`title`],Ou=[`value`],ku={class:`field`},Au=[`disabled`],ju=[`value`],Mu={class:`field`},Nu=[`disabled`],Pu=[`value`],Fu={class:`field`},Iu=[`disabled`],Lu=[`value`],Ru={class:`field`},zu={class:`field`},Bu={class:`field-grid`},Vu={class:`field`},Hu={key:0,class:`field`},Uu=[`value`],Wu={key:1,class:`field`},Gu={key:2,class:`field`},Ku={class:`subtle small`},qu={key:1,class:`check-row`},Ju={key:2,class:`check-row`},Yu={class:`form-actions`},Xu=[`disabled`],Zu={key:2,class:`timeline-empty`},Qu={key:3,class:`schedules-empty`},$u={key:4,class:`card`},ed={class:`card-row`},td={class:`grow`},nd={class:`row-title`},rd={class:`row-sub`},id={class:`row-sub`},ad={key:1,class:`schedule-status`},od={class:`schedule-actions`},sd=[`disabled`,`onClick`],cd=[`disabled`,`onClick`],ld=[`disabled`,`onClick`],ud=[`disabled`,`onClick`],dd=[`aria-expanded`,`onClick`],fd=[`disabled`,`onClick`],pd={key:0,class:`schedule-runs`},md={class:`schedule-prompt`},hd={key:0,class:`subtle small`},gd={class:`run-when`},_d={class:`run-text`},vd=[`onClick`],yd=xn(f({__name:`SchedulesPage`,props:{hosts:{},api:{type:Function}},emits:[`back`,`openAgent`],setup(r,{emit:o}){let s=r,l=o,u=e(null),f=e(``),p=e(null),m=e=>s.hosts.find(t=>t.id===e)?.label??`Unknown host`;async function g(){try{u.value=await s.api(`/schedules`),f.value=``}catch(e){f.value=e.message}}c(g);let y=S(()=>(u.value??[]).flatMap(e=>e.schedules.map(t=>({hostId:e.hostId,s:t})))),w=S(()=>(u.value??[]).filter(e=>e.error));async function T(e,t,n){if(n!==`delete`||confirm(`Delete the schedule “${t.name||t.prompt.slice(0,40)}”?`)){p.value=t.id;try{await s.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t.id)}${n===`delete`?``:`/`+n}`,n===`delete`?`DELETE`:`POST`),await g()}catch(e){f.value=e.message}finally{p.value=null}}}let E=e(null),D=e([]);async function O(e,t){if(E.value===t.id)return E.value=null;E.value=t.id,D.value=[];try{D.value=(await s.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t.id)}/logs`)).runs}catch(e){f.value=e.message}}let A=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function j(e){let[t,n,r,i,a]=e.trim().split(/\s+/),o=(e,t)=>`${e.padStart(2,`0`)}:${t.padStart(2,`0`)}`;if(/^\d+$/.test(t)&&/^\d+$/.test(n)&&r===`*`&&i===`*`){if(a===`*`)return`Every day at ${o(n,t)}`;if(a===`1-5`)return`Weekdays at ${o(n,t)}`;if(/^\d$/.test(a))return`Every ${A[Number(a)%7]} at ${o(n,t)}`}if(/^\d+$/.test(t)&&n===`*`&&r===`*`&&i===`*`&&a===`*`)return`Every hour at :${t.padStart(2,`0`)}`;let s=/^\*\/(\d+)$/.exec(t);return s&&n===`*`&&r===`*`&&i===`*`&&a===`*`?`Every ${s[1]} minutes`:e}let P=e=>e?Un(new Date(e)):`—`,I=e(!1),B=e({hostId:``,cwd:``,provider:``,model:``,name:``,prompt:``,preset:`daily`,time:`09:00`,day:`1`,cron:`0 9 * * *`,archive:!0,runNow:!1}),V=e(null),H=e(null),U=S(()=>s.hosts.filter(e=>e.state===`connected`));n(()=>B.value.hostId,async e=>{if(V.value=H.value=null,e)try{let[t,n]=await Promise.all([s.api(`/hosts/${encodeURIComponent(e)}/providers`),s.api(`/hosts/${encodeURIComponent(e)}/projects`)]);V.value=t,H.value=n,B.value.provider||=t.find(e=>e.status===`ready`)?.id??t[0]?.id??``,B.value.cwd||=n[0]?.rootPath??``}catch(e){f.value=e.message}});let W=S(()=>{let e=H.value??[],t=B.value.cwd;return t&&!e.some(e=>e.rootPath===t)?[{key:t,name:t.split(`/`).pop()||t,rootPath:t,kind:`directory`},...e]:e}),G=S(()=>V.value?.find(e=>e.id===B.value.provider)?.models??[]);n(G,e=>{e.some(e=>e.id===B.value.model)||(B.value.model=e.find(e=>e.isDefault)?.id??e[0]?.id??``)});let K=S(()=>{let[e,t]=B.value.time.split(`:`).map(e=>String(Number(e)||0));return B.value.preset===`daily`?`${t} ${e} * * *`:B.value.preset===`weekdays`?`${t} ${e} * * 1-5`:B.value.preset===`weekly`?`${t} ${e} * * ${B.value.day}`:B.value.preset===`hourly`?`${t} * * * *`:B.value.cron.trim()}),q=e(null);function ee(){q.value=null,I.value=!0,B.value.hostId||=U.value[0]?.id??``}function te(e){let[t,n,r,i,a]=e.trim().split(/\s+/),o=(e,t)=>`${e.padStart(2,`0`)}:${t.padStart(2,`0`)}`,s=/^\d+$/.test(t)&&r===`*`&&i===`*`;return s&&/^\d+$/.test(n)&&a===`*`?{preset:`daily`,time:o(n,t)}:s&&/^\d+$/.test(n)&&a===`1-5`?{preset:`weekdays`,time:o(n,t)}:s&&/^\d+$/.test(n)&&/^\d$/.test(a)?{preset:`weekly`,time:o(n,t),day:String(Number(a)%7)}:s&&n===`*`&&a===`*`?{preset:`hourly`,time:o(`0`,t)}:{preset:`cron`,cron:e}}function ne(e,t){let n=t.target.config??{};q.value={hostId:e,id:t.id,newAgent:t.target.type===`new-agent`},I.value=!0,B.value={...B.value,hostId:e,cwd:n.cwd??``,provider:n.provider??``,model:n.model??``,name:t.name??``,prompt:t.prompt,cron:t.cadence.expression,archive:n.archiveOnFinish??!0,runNow:!1,...te(t.cadence.expression)},re.value=t.cadence.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,E.value=null,C(()=>document.querySelector(`.schedule-form`)?.scrollIntoView({block:`nearest`}))}let re=e(Intl.DateTimeFormat().resolvedOptions().timeZone);function ie(){I.value=!1,q.value=null,re.value=Intl.DateTimeFormat().resolvedOptions().timeZone}async function ae(){if(!q.value)return oe();let{hostId:e,id:t,newAgent:n}=q.value;p.value=`create`;try{await s.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`,`PATCH`,{name:B.value.name||null,prompt:B.value.prompt,cron:K.value,timezone:re.value,...n?{cwd:B.value.cwd,provider:B.value.provider,model:B.value.model||null,archiveOnFinish:B.value.archive}:{}}),ie(),await g()}catch(e){f.value=e.message}finally{p.value=null}}async function oe(){p.value=`create`;try{await s.api(`/hosts/${encodeURIComponent(B.value.hostId)}/schedules`,`POST`,{name:B.value.name||void 0,prompt:B.value.prompt,cron:K.value,timezone:re.value,cwd:B.value.cwd,provider:B.value.provider,...B.value.model?{model:B.value.model}:{},archiveOnFinish:B.value.archive,runOnCreate:B.value.runNow}),I.value=!1,B.value.prompt=B.value.name=``,await g()}catch(e){f.value=e.message}finally{p.value=null}}return(e,n)=>(i(),R(`section`,yu,[x(`header`,bu,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:n[0]||=e=>l(`back`)},[t(J,{name:`back`,size:18})]),n[14]||=x(`div`,{class:`grow`},[x(`h1`,null,`Schedules`),x(`p`,{class:`subtle`},`Prompts that start an agent on a timetable, on each host.`)],-1),x(`button`,{class:`btn btn-primary`,disabled:!U.value.length,onClick:ee},[t(J,{name:`plus`,size:15}),n[13]||=d(`New schedule`,-1)],8,xu)]),x(`div`,Su,[f.value?(i(),R(`p`,Cu,k(f.value),1)):F(``,!0),(i(!0),R(b,null,z(w.value,e=>(i(),R(`p`,{key:e.hostId,class:`setting-note`},k(m(e.hostId))+`: `+k(e.error),1))),128)),I.value?(i(),R(`form`,{key:1,class:`card form-card schedule-form`,onSubmit:v(ae,[`prevent`])},[x(`div`,wu,k(q.value?`Edit schedule`:`New schedule`),1),!q.value||q.value.newAgent?(i(),R(`div`,Tu,[x(`label`,Eu,[n[15]||=x(`span`,null,`Host`,-1),a(x(`select`,{"onUpdate:modelValue":n[1]||=e=>B.value.hostId=e,required:``,disabled:!!q.value,title:q.value?`A schedule stays on its host`:void 0},[(i(!0),R(b,null,z(U.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,Ou))),128))],8,Du),[[N,B.value.hostId]])]),x(`label`,ku,[n[16]||=x(`span`,null,`Project`,-1),a(x(`select`,{"onUpdate:modelValue":n[2]||=e=>B.value.cwd=e,required:``,disabled:!H.value},[(i(!0),R(b,null,z(W.value,e=>(i(),R(`option`,{key:e.key,value:e.rootPath},k(e.name),9,ju))),128))],8,Au),[[N,B.value.cwd]])]),x(`label`,Mu,[n[17]||=x(`span`,null,`Agent`,-1),a(x(`select`,{"onUpdate:modelValue":n[3]||=e=>B.value.provider=e,required:``,disabled:!V.value},[(i(!0),R(b,null,z(V.value??[],e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,Pu))),128))],8,Nu),[[N,B.value.provider]])]),x(`label`,Fu,[n[18]||=x(`span`,null,`Model`,-1),a(x(`select`,{"onUpdate:modelValue":n[4]||=e=>B.value.model=e,disabled:!G.value.length},[(i(!0),R(b,null,z(G.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,Lu))),128))],8,Iu),[[N,B.value.model]])])])):F(``,!0),x(`label`,Ru,[n[19]||=x(`span`,null,`Name`,-1),a(x(`input`,{"onUpdate:modelValue":n[5]||=e=>B.value.name=e,placeholder:`Daily check-in`,maxlength:`120`},null,512),[[_,B.value.name]])]),x(`label`,zu,[n[20]||=x(`span`,null,`Prompt`,-1),a(x(`textarea`,{"onUpdate:modelValue":n[6]||=e=>B.value.prompt=e,rows:`4`,required:``,placeholder:`What should the agent do each time?`},null,512),[[_,B.value.prompt]])]),x(`div`,Bu,[x(`label`,Vu,[n[22]||=x(`span`,null,`Repeat`,-1),a(x(`select`,{"onUpdate:modelValue":n[7]||=e=>B.value.preset=e},[...n[21]||=[L(`<option value="daily" data-v-1a9bb929>Every day</option><option value="weekdays" data-v-1a9bb929>Weekdays</option><option value="weekly" data-v-1a9bb929>Every week</option><option value="hourly" data-v-1a9bb929>Every hour</option><option value="cron" data-v-1a9bb929>Custom (cron)</option>`,5)]],512),[[N,B.value.preset]])]),B.value.preset===`weekly`?(i(),R(`label`,Hu,[n[23]||=x(`span`,null,`Day`,-1),a(x(`select`,{"onUpdate:modelValue":n[8]||=e=>B.value.day=e},[(i(),R(b,null,z(A,(e,t)=>x(`option`,{key:e,value:String(t)},k(e),9,Uu)),64))],512),[[N,B.value.day]])])):F(``,!0),B.value.preset===`cron`?(i(),R(`label`,Gu,[n[24]||=x(`span`,null,`Cron`,-1),a(x(`input`,{"onUpdate:modelValue":n[10]||=e=>B.value.cron=e,placeholder:`0 9 * * 1-5`,required:``},null,512),[[_,B.value.cron]])])):(i(),R(`label`,Wu,[x(`span`,null,k(B.value.preset===`hourly`?`Minute`:`Time`),1),a(x(`input`,{"onUpdate:modelValue":n[9]||=e=>B.value.time=e,type:`time`,required:``},null,512),[[_,B.value.time]])]))]),x(`p`,Ku,k(j(K.value))+` · `+k(re.value),1),!q.value||q.value.newAgent?(i(),R(`label`,qu,[a(x(`input`,{"onUpdate:modelValue":n[11]||=e=>B.value.archive=e,type:`checkbox`},null,512),[[h,B.value.archive]]),n[25]||=d(` Archive the agent when the run finishes`,-1)])):F(``,!0),q.value?F(``,!0):(i(),R(`label`,Ju,[a(x(`input`,{"onUpdate:modelValue":n[12]||=e=>B.value.runNow=e,type:`checkbox`},null,512),[[h,B.value.runNow]]),n[26]||=d(` Run once now`,-1)])),x(`div`,Yu,[x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:ie},`Cancel`),x(`button`,{class:`btn btn-primary`,disabled:p.value===`create`||!B.value.prompt.trim()||(!q.value||q.value.newAgent)&&!B.value.cwd},k(q.value?`Save changes`:`Create schedule`),9,Xu)])],32)):F(``,!0),u.value?!y.value.length&&!I.value?(i(),R(`div`,Qu,[t(J,{name:`clock`,size:22}),n[28]||=x(`p`,null,`No schedules yet.`,-1)])):(i(),R(`div`,$u,[(i(!0),R(b,null,z(y.value,({hostId:e,s:n})=>(i(),R(`div`,{key:e+n.id,class:`schedule`},[x(`div`,ed,[x(`span`,{class:M([`setting-icon`,{paused:n.status!==`active`}])},[t(J,{name:`clock`,size:16})],2),x(`div`,td,[x(`div`,nd,k(n.name||n.target.config?.title||n.prompt.slice(0,60)),1),x(`div`,rd,[d(k(j(n.cadence.expression))+` `,1),n.cadence.timezone?(i(),R(b,{key:0},[d(` · `+k(n.cadence.timezone),1)],64)):F(``,!0),d(` · `+k(m(e))+` `,1),n.target.config?.cwd?(i(),R(b,{key:1},[d(` · `+k(n.target.config.cwd.split(`/`).pop()),1)],64)):F(``,!0)]),x(`div`,id,[n.status===`active`?(i(),R(b,{key:0},[d(`Next `+k(P(n.nextRunAt)),1)],64)):(i(),R(`span`,ad,k(n.status),1)),d(` · Last `+k(P(n.lastRunAt)),1)])]),x(`div`,od,[x(`button`,{class:`icon-btn`,title:`Run now`,"aria-label":`Run now`,disabled:p.value===n.id,onClick:t=>T(e,n,`run`)},[t(J,{name:`play`,size:14})],8,sd),n.status===`active`?(i(),R(`button`,{key:0,class:`icon-btn`,title:`Pause`,"aria-label":`Pause`,disabled:p.value===n.id,onClick:t=>T(e,n,`pause`)},[t(J,{name:`pause`,size:14})],8,cd)):(i(),R(`button`,{key:1,class:`icon-btn`,title:`Resume`,"aria-label":`Resume`,disabled:p.value===n.id,onClick:t=>T(e,n,`resume`)},[t(J,{name:`refresh`,size:14})],8,ld)),x(`button`,{class:`icon-btn`,title:`Edit`,"aria-label":`Edit schedule`,disabled:p.value===n.id,onClick:t=>ne(e,n)},[t(J,{name:`edit`,size:14})],8,ud),x(`button`,{class:`icon-btn`,title:`Run history`,"aria-label":`Run history`,"aria-expanded":E.value===n.id,onClick:t=>O(e,n)},[t(J,{name:`list`,size:14})],8,dd),x(`button`,{class:`icon-btn`,title:`Delete`,"aria-label":`Delete schedule`,disabled:p.value===n.id,onClick:t=>T(e,n,`delete`)},[t(J,{name:`trash`,size:14})],8,fd)])]),E.value===n.id?(i(),R(`div`,pd,[x(`p`,md,k(n.prompt),1),D.value.length?F(``,!0):(i(),R(`p`,hd,`No runs yet.`)),(i(!0),R(b,null,z(D.value,t=>(i(),R(`div`,{key:t.id,class:M([`schedule-run`,`is-`+t.status])},[x(`span`,{class:M([`status-dot`,t.status===`failed`?`is-error`:t.status===`running`?`is-running`:`is-idle-ok`])},null,2),x(`span`,gd,k(P(t.startedAt)),1),x(`span`,_d,k(t.error||t.output||t.status),1),t.agentId?(i(),R(`button`,{key:0,class:`btn btn-ghost btn-sm`,onClick:n=>l(`openAgent`,`${e}:${t.agentId}`)},`Open`,8,vd)):F(``,!0)],2))),128))])):F(``,!0)]))),128))])):(i(),R(`div`,Zu,[...n[27]||=[x(`span`,{class:`spinner`},null,-1),d(`Loading schedules…`,-1)]]))])]))}}),[[`__scopeId`,`data-v-1a9bb929`]]),bd=[`disabled`,`aria-label`,`title`,`onKeydown`],xd={key:0,class:`spinner spinner-sm`},Sd={class:`rec-time`},Cd=24e3,wd=300,Td=xn(f({__name:`DictationButton`,props:{disabled:{type:Boolean}},emits:[`text`,`preview`,`notice`],setup(t,{expose:n,emit:r}){let a=r,o=e(`idle`),s=e(0),c=typeof window<`u`&&!!navigator.mediaDevices?.getUserMedia&&window.isSecureContext,u=null,d=null,f=null,p=null,h=[],g=0,_=0,y=!1,S=0,C,w,T=Cd,E=``;function D(e){let t=T/Cd,n=new Int16Array(Math.floor(e.length/t));for(let r=0;r<n.length;r++){let i=Math.max(-1,Math.min(1,e[Math.floor(r*t)]));n[r]=i<0?i*32768:i*32767}return n}function O(){f&&(f.onaudioprocess=null,f.disconnect()),f=null,d?.close().catch(()=>{}),d=null,u?.getTracks().forEach(e=>e.stop()),u=null}function A(){S++,O(),clearTimeout(w),C?.abort(),C=void 0,p&&(p.onopen=p.onmessage=p.onerror=p.onclose=null,p.close()),p=null,h=[],g=0,y=!1,o.value=`idle`,E=``,a(`preview`,``)}function j(e){let t=E.trim();A(),t&&a(`text`,t),a(`notice`,e+(t?` Recognized text was kept; the last phrase may be missing.`:``))}function N(){if(y&&p?.readyState===WebSocket.OPEN){if(p.bufferedAmount>Cd*2*10)j(`Voice upload cannot keep up with recording. Please try again.`);else{for(let e of h)p.send(e.buffer);h=[],g=0,o.value===`transcribing`&&p.send(JSON.stringify({type:`stop`}))}}}async function I(){if(o.value!==`idle`)return;if(!c){a(`notice`,`Voice input needs HTTPS (or localhost) and microphone access.`);return}o.value=`starting`;let e=++S;try{let t=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(e!==S){t.getTracks().forEach(e=>e.stop());return}u=t;try{d=new AudioContext({sampleRate:Cd})}catch{d=new AudioContext}if(await d.resume(),e!==S)return;T=d.sampleRate;let n=d.createMediaStreamSource(u);f=d.createScriptProcessor(4096,1,1),_=0,h=[],g=0,f.onaudioprocess=t=>{if(e!==S||o.value!==`recording`)return;let n=D(t.inputBuffer.getChannelData(0)).subarray(0,wd*Cd-_);h.push(n),g+=n.length,_+=n.length,g>Cd*12?j(`Voice connection is taking too long. Please try again.`):(N(),s.value=Math.floor(_/Cd),_>=wd*Cd&&z())},n.connect(f),f.connect(d.destination),s.value=0,o.value=`recording`,w=setTimeout(()=>{e===S&&j(`Could not connect to the transcription service.`)},12e3),C=new AbortController;let r=await fetch(`/api/dictation/session`,{method:`POST`,headers:{"x-litepaseo":`1`},signal:C.signal}),i=await r.json();if(e!==S)return;if(!r.ok)throw Error(i.error??`Could not start voice input.`);let c=new URL(`/api/dictation/stream`,location.href);c.protocol=location.protocol===`https:`?`wss:`:`ws:`,c.searchParams.set(`ticket`,i.ticket),p=new WebSocket(c),p.onmessage=t=>{if(e===S)try{let n=JSON.parse(t.data);if(n.type===`ready`)y=!0,clearTimeout(w),o.value===`transcribing`&&L(e),N();else if(n.type===`partial`)E=String(n.text??``),a(`preview`,E);else if(n.type===`done`){let e=String(n.text??``).trim();A(),e?a(`text`,e):a(`notice`,`No speech recognized.`)}else if(n.type===`error`){let e=String(n.text??``).trim();A(),e&&a(`text`,e),a(`notice`,String(n.message??`Transcription failed.`)+(e?` Recognized text was kept; the last phrase may be missing.`:``))}}catch{j(`Invalid transcription response.`)}},p.onerror=()=>{e===S&&j(`Voice connection failed. Please try again.`)},p.onclose=()=>{e===S&&j(`Voice connection interrupted. Please try again.`)}}catch(t){if(e!==S)return;j(t.name===`NotAllowedError`?`Microphone access was denied.`:t.message)}}function L(e){clearTimeout(w),w=setTimeout(()=>{e===S&&j(`Timed out waiting for transcription.`)},125e3)}function z(){o.value===`recording`&&(O(),_<Cd/5?j(`Recording too short.`):(o.value=`transcribing`,y&&(L(S),N())))}function B(){p?.readyState===WebSocket.OPEN&&p.send(JSON.stringify({type:`cancel`})),A()}let V=()=>o.value===`recording`?z():o.value===`idle`?void I():void 0,H=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;return n({cancel:B}),l(B),(e,n)=>(i(),R(b,null,[x(`button`,{type:`button`,class:M([`dictation`,`is-`+o.value]),disabled:t.disabled&&o.value===`idle`||o.value===`transcribing`||o.value===`starting`,"aria-label":o.value===`recording`?`Stop recording and transcribe`:o.value===`transcribing`?`Transcribing`:o.value===`starting`?`Starting voice input`:`Voice input`,title:o.value===`recording`?`Stop recording (Esc cancels)`:o.value===`transcribing`?`Finishing transcription…`:`Voice input`,onClick:V,onKeydown:P(v(B,[`prevent`]),[`esc`])},[o.value===`transcribing`||o.value===`starting`?(i(),R(`span`,xd)):o.value===`recording`?(i(),R(b,{key:1},[n[0]||=x(`span`,{class:`rec-dot`},null,-1),x(`span`,Sd,k(H(s.value)),1)],64)):(i(),m(J,{key:2,name:`mic`,size:17}))],42,bd),o.value===`idle`?F(``,!0):(i(),R(`button`,{key:0,type:`button`,class:`dictation`,"aria-label":`Cancel voice input`,title:`Cancel voice input`,onClick:B},`×`))],64))}}),[[`__scopeId`,`data-v-9ec56bd9`]]),Ed={key:0,class:`login`},Dd={class:`brand brand-large`},Od={class:`field`},kd={class:`field`},Ad=[`disabled`],jd={key:1,class:`form-error`},Md={class:`sidebar`},Nd=[`aria-valuenow`],Pd=[`title`],Fd={class:`side-nav`,"aria-label":`Pages`},Id={class:`hide-sm`},Ld={class:`side-section`},Rd={class:`side-label`},zd={class:`list-summary`},Bd=[`aria-expanded`],Vd={key:1,class:`active-host-filter`,role:`group`,"aria-label":`Active host filter`},Hd=[`title`],Ud={key:2,class:`view-menu`},Wd={class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Group sessions`},Gd=[`aria-checked`],Kd=[`aria-checked`],qd={key:0,class:`host-filter`,role:`radiogroup`,"aria-label":`Filter by host`},Jd=[`aria-checked`],Yd={class:`chip-count`},Xd=[`aria-checked`,`title`,`onClick`],Zd={class:`chip-count`},Qd={class:`side-foot`},$d=[`title`],ef=[`title`,`aria-label`],tf={key:0,class:`foot-alert`,"aria-hidden":`true`},nf=[`title`,`aria-label`],rf={class:`main`},af={key:0,class:`toast`,role:`alert`},of={key:3,class:`page`},sf={class:`page-head`},cf={class:`page-body`},lf={class:`card`},uf={class:`grow`},df={class:`row-title`},ff={class:`row-sub`},pf={key:0,role:`status`},mf={key:1,class:`row-sub`},hf={key:2,class:`row-sub`},gf={key:3,class:`row-sub`},_f=[`disabled`,`onClick`],vf=[`disabled`,`onClick`],yf={key:0,class:`card-row muted-text`},bf={class:`field`},xf={class:`field`},Sf={class:`form-actions`},Cf=[`disabled`],wf={key:5,class:`page`},Tf={class:`page-head`},Ef={class:`subtle`},Df={class:`segmented head-toggle`,role:`radiogroup`,"aria-label":`Board`},Of={class:`page-body wide`},kf=[`value`],Af=[`disabled`],jf={class:`board`},Mf={class:`column-head`},Nf={class:`count`},Pf=[`aria-label`,`onClick`],Ff={class:`row-title`},If={key:0,class:`kanban-excerpt`},Lf={key:0,class:`card-link`},Rf=[`title`,`onClick`],zf={class:`card-link-name`},Bf={key:1,class:`subtle small`},Vf=[`disabled`,`onClick`],Hf=[`disabled`,`onChange`],Uf=[`value`],Wf={class:`kanban-actions`},Gf=[`value`,`onChange`],Kf=[`title`,`onClick`],qf=[`onClick`],Jf=[`onClick`],Yf={key:0,class:`column-empty`},Xf={class:`chat`},Zf={class:`chat-head`},Qf=[`title`],$f=[`title`],ep=[`title`],tp={key:0,class:`agent-tabs`,"aria-label":`Tabs`},np=[`onClick`],rp={class:`agent-tab-name`},ip=[`title`,`onClick`,`onAuxclick`],ap={class:`agent-tab-name`},op=[`aria-label`,`onClick`],sp={class:`timeline-wrap`},cp={class:`timeline-inner`},lp={key:0,class:`older`},up={key:0,class:`older-loading`,role:`status`},dp={key:1,class:`notice`},fp={key:0,class:`turn-footer`},pp=[`aria-label`,`title`,`onClick`],mp=[`title`],hp=[`title`],gp=[`title`],_p={key:2,class:`older`},vp={key:0,class:`older-loading`,role:`status`},yp={key:3,class:`timeline-working`,role:`status`,"aria-label":`Agent is working`},bp={key:0,class:`timeline-elapsed`,"aria-hidden":`true`},xp={key:1},Sp={key:4,class:`timeline-empty`},Cp={key:0,class:`spinner`},wp={class:`dock`},Tp={class:`dock-inner`},Ep={key:0,role:`status`},Dp={key:1,role:`status`},Op={key:2,class:`composer-notice`,role:`status`},kp={key:3},Ap={style:{"white-space":`pre-wrap`}},jp=[`onClick`],Mp={key:4,class:`uncertain`},Np={class:`grow`},Pp=[`disabled`],Fp={key:5,class:`send-queue`,role:`list`,"aria-label":`Queued messages`},Ip={class:`queue-body`},Lp=[`disabled`,`onClick`],Rp=[`title`],zp={key:2,class:`queue-meta`},Bp={class:`queue-meta`},Vp={key:3,class:`queue-meta queue-error`},Hp=[`disabled`,`onClick`],Up=[`disabled`,`onClick`],Wp=[`disabled`,`onClick`],Gp=[`disabled`,`title`,`onClick`],Kp=[`disabled`,`onClick`],qp=[`disabled`,`onClick`],Jp=[`placeholder`,`required`],Yp={class:`composer-bar`},Xp=[`title`,`disabled`],Zp={class:`composer-actions`},Qp=[`title`],$p={key:0,value:`steer`},em=[`disabled`],tm=[`disabled`],nm={key:0,class:`side-panel`,"aria-label":`Files`},rm={class:`panel-tabs`},im={class:`panel-body`},am={key:7,class:`empty`},om={key:8,class:`empty`},sm={class:`empty-mark`},cm=280,lm=900,um=420,dm=220,fm=520,pm=300,mm=f({__name:`App`,setup(r){let s=I(()=>Fr(()=>import(`./HostSettings-Bv5JZpp-.js`),__vite__mapDeps([5,1,2,6]))),c=I(()=>Fr(()=>import(`./ChangesPanel-CCv89MWn.js`),__vite__mapDeps([7,1,2,8]))),f=I(()=>Fr(()=>import(`./ConversationSearch-BjpeqUQD.js`),__vite__mapDeps([9,1,2,10]))),p=I(()=>Fr(()=>import(`./FilesPanel-DIQsDIqh.js`),__vite__mapDeps([11,1,2,12]))),h=I(()=>Fr(()=>import(`./FileViewer-DZoA4W84.js`),__vite__mapDeps([13,1,2,3,14]))),w=I(()=>Fr(()=>import(`./TerminalPanel-K_XWJJCf.js`),__vite__mapDeps([15,1,2,16]))),E=[`Todo`,`Doing`,`Done`],O=matchMedia(`(pointer: coarse)`).matches,j=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),V=e(!1),H=e(localStorage.getItem(`litepaseo-panel`)===`files`?`files`:null);n(H,e=>e?localStorage.setItem(`litepaseo-panel`,e):localStorage.removeItem(`litepaseo-panel`));let U=e=>H.value=H.value===e?null:e,W=u(new Map),G=S(()=>W.has(ne.value)),K=S(()=>W.get(ne.value)===!0);function q(){W.set(ne.value,!0),ie.value=null,er.matches&&(H.value=null)}function ee(){W.has(ne.value)&&W.set(ne.value,!1),ie.value=null}let te=u(new Map),ne=S(()=>Me.value??X.value??``),re=S(()=>te.get(ne.value)?.paths??[]),ie=S({get:()=>te.get(ne.value)?.active??null,set:e=>{let t=te.get(ne.value);t&&(t.active=e),e&&W.has(ne.value)&&W.set(ne.value,!1)}});function ae(e){let t=ne.value;if(!t)return;let n=te.get(t)??{paths:[],active:null};n.paths.includes(e)||(n.paths=[...n.paths,e].slice(-12)),n.active=e,W.has(t)&&W.set(t,!1),te.set(t,n),er.matches&&(H.value=null)}function se(e){let t=te.get(ne.value);if(!t)return;let n=t.paths.indexOf(e);t.paths=t.paths.filter(t=>t!==e),t.active===e&&(t.active=t.paths[Math.min(n,t.paths.length-1)]??null)}let ce=e=>Math.round(Math.min(lm,Math.max(cm,e))),le=e(ce(Number(localStorage.getItem(`litepaseo-panel-width`))||um));function ue(e){le.value=ce(e),localStorage.setItem(`litepaseo-panel-width`,String(le.value))}function de(e){if(e.button!==0)return;let t=e.currentTarget,n=e.clientX,r=le.value;t.setPointerCapture(e.pointerId),he.value=!0;let i=e=>le.value=ce(r-(e.clientX-n)),a=()=>{he.value=!1,ue(le.value),t.removeEventListener(`pointermove`,i),t.removeEventListener(`pointerup`,a),t.removeEventListener(`pointercancel`,a)};t.addEventListener(`pointermove`,i),t.addEventListener(`pointerup`,a),t.addEventListener(`pointercancel`,a)}let fe=e=>Math.round(Math.min(fm,Math.max(dm,e))),me=e(fe(Number(localStorage.getItem(`litepaseo-sidebar-width`))||pm)),he=e(!1);function ge(e){me.value=fe(e),localStorage.setItem(`litepaseo-sidebar-width`,String(me.value))}function _e(e){if(e.button!==0)return;let t=e.currentTarget,n=e.clientX,r=me.value;t.setPointerCapture(e.pointerId),he.value=!0;let i=0,a=e=>{i&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>me.value=fe(r+e.clientX-n))},o=()=>{cancelAnimationFrame(i),he.value=!1,ge(me.value),t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,o)};t.addEventListener(`pointermove`,a),t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,o)}function ye(e,t){try{return JSON.parse(localStorage.getItem(e)??`null`)??t}catch{return t}}let be=e(``),xe=S(()=>be.value||`LitePaseo`),Se=e(``),Ce=e(``),we=e(null),Te=e(!1),Ee=e(``),Y=e(!1),Oe=y([]),ke=new pe({collapsed:ye(`litepaseo-collapsed-projects`,[]),persist:e=>localStorage.setItem(`litepaseo-collapsed-projects`,JSON.stringify(e)),compare:oe}),je=new pe({indexBy:e=>e.workspaceId?`${e.hostId}:${e.workspaceId}`:null}),Me=e(null),Ne=e(localStorage.getItem(`litepaseo-list-mode`)===`recent`?`recent`:`projects`),Pe=e(`closed`),X=e(null),Fe=y(new dn),Ie=e(``),Le=y(null),Re=e(!1),ze=e([]),Be=e(null),Ve=e(null),He=e(null),Ue=e(``),We=e(!1),Ge=e(``),Ke=e(``),qe=e(`steer`),Je=e(`chat`),Ye=e(``),Xe=e(``),Ze=e({revision:0,cards:[]}),Z=new cn(()=>localStorage),Qe=new Ya,$e=e([]),et=new Map,tt=e(null),nt=e(``),rt=0;async function it(){let e=Q.value,t=++rt;if(!e||!Te.value)$e.value=[];else try{let n=await $(Nn(e)+`/queue`);t===rt&&Q.value?.key===e.key&&($e.value=Array.isArray(n)?n:[])}catch{}}n(X,()=>{$e.value=[],it()});let at=e({}),ot=null;n(Te,e=>{ot?.close(),at.value={},e&&(ot=Tn({url:()=>`/api/queue/stream`,onMessage:e=>{at.value=e}}))}),l(()=>ot?.close());let st=null;n([X,Te],()=>{st?.close(),st=null,rt++,$e.value=[];let e=Q.value;e&&Te.value&&(st=Tn({url:()=>`/api`+Nn(e)+`/queue/stream`,onMessage:t=>{Te.value&&Q.value?.key===e.key&&Array.isArray(t)&&(rt++,$e.value=t)}}))}),l(()=>st?.close());async function ct(e,t){let n=Q.value;n&&await Mn(async()=>{await $(Nn(n)+`/queue/`+e.id+`/control`,`POST`,{action:t}),await it()})}async function lt(e,t){Fe.value.epoch===t?(ee(),er.matches&&(H.value=null),await li(e,!0)):Ee.value=`Conversation changed. Search again.`}let ut=e(null),dt=e(null),ft=S(()=>{let e=dt.value?.modelLabel;return e&&e!==`Model`?e:``}),pt=S(()=>X.value?Qe.get(X.value):[]),mt=e(!1),ht=e(``),gt=e(null);n(ht,()=>{let e=gt.value;e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});async function _t(){try{mt.value=!!(await $(`/dictation`)).configured}catch{}}let vt=e(``),yt;function bt(e){vt.value=e,clearTimeout(yt),yt=setTimeout(()=>vt.value=``,8e3)}function xt(e){let t=He.value,n=Dt.value,r=t&&document.activeElement===t?t.selectionStart:n.length,i=t&&document.activeElement===t?t.selectionEnd:n.length,a=n.slice(0,r),o=n.slice(i),s=a&&!/\s$/.test(a)?` `:``;Dt.value=a+s+e+o,C(()=>{if(!t)return;t.focus();let n=(a+s+e).length;t.setSelectionRange(n,n),ui()})}let St=S(()=>!!Dt.value.trim()||pt.value.length>0),Ct=e(!1);function wt(e){e.currentTarget.contains(e.relatedTarget)||(Ct.value=!1)}let Tt=S(()=>pt.value.every(e=>!!e.id&&!e.uploading&&!e.error));function Et(e){let t=e.clipboardData;if(!t)return;let n=Array.from(t.files);n.length||(n=Array.from(t.items).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e)),n.length&&(e.preventDefault(),ut.value?.addFiles(n))}let Dt=S({get:()=>X.value?Z.state(X.value).text:``,set:e=>{X.value&&Z.setText(X.value,e)}}),Ot=S(()=>X.value?Z.unresolved(X.value)[0]??null:null),kt=S(()=>X.value?Z.saved(X.value).filter(e=>e.text!==Dt.value):[]),At=e(!1),jt=e(``);async function Mt(){let e=Q.value;if(!e||Y.value||At.value||document.hidden)return;let t=Z.unresolved(e.key);if(!t.length)return;let n=Z.generation;At.value=!0;try{let r=await $(Nn(e)+`/messages/status`,`POST`,{messageIds:t.slice(0,20).map(e=>e.messageId)});if(n!==Z.generation)return;for(let n of r.confirmed??[]){let r=t.find(e=>e.messageId===n);r&&(Qe.consume(e.key,r.attachmentIds??[]),Z.confirm(e.key,n))}Q.value?.key===e.key&&(jt.value=r.confirmed?.length?`Delivery confirmed from conversation history.`:`Not confirmed yet. No message has been resent.`)}catch{Q.value?.key===e.key&&(jt.value=`Unable to check delivery. Your message remains saved.`)}finally{At.value=!1}}let Nt=setInterval(()=>void Mt(),15e3);n([X,Y],()=>{jt.value=``,Mt()});function Pt(){X.value&&Ot.value&&Z.resolve(X.value,Ot.value.messageId)}function Ft(e){e.storageArea===localStorage&&(e.key===`litepaseo-composer-signout`?Z.clear():Z.onStorage(e.key,e.newValue))}window.addEventListener(`storage`,Ft);let It=S(()=>new Map(Oe.value.map(e=>[e.id,e.label]))),Lt=S(()=>new Map(Oe.value.map(e=>[e.id,e.state]))),Rt=e(null),zt=S(()=>Oe.value.filter(e=>e.state===`connected`).length),Q=S(()=>(je.version.value,je.get(X.value)??null)),Bt=S(()=>(ke.version.value,ke.get(Me.value)??null)),Vt=S(()=>(je.version.value,je.indexed(Me.value,12))),Ht=S(()=>(ke.version.value,ke.total)),Ut=S(()=>(ke.version.value,ke.size)),Wt=S(()=>(ke.version.value,ke.projectCount));n(Ne,e=>localStorage.setItem(`litepaseo-list-mode`,e));let Gt=e(localStorage.getItem(`litepaseo-host-filter`));n(Gt,e=>{ke.setHost(e),je.setHost(e),e?localStorage.setItem(`litepaseo-host-filter`,e):localStorage.removeItem(`litepaseo-host-filter`)},{immediate:!0}),n(Oe,e=>{Gt.value&&e.length&&!e.some(e=>e.id===Gt.value)&&(Gt.value=null)});let Kt=S(()=>(ke.version.value,new Map(Oe.value.map(e=>[e.id,ke.hostSize(e.id)])))),qt=S(()=>Bt.value?.directory||Q.value?.cwd||``),Jt=S(()=>{let e=Q.value?.cwd??``;return e.replace(/\/+$/,``).split(`/`).pop()||e}),Yt=S(()=>Q.value?.status===`running`),Xt=S(()=>Q.value?.deliveryModes??[`queue`,`interrupt`]),Zt=S(()=>Xt.value.includes(qe.value)?qe.value:`queue`);n([()=>Q.value?.key,()=>Xt.value.includes(`steer`)],([,e])=>{qe.value=e?`steer`:`queue`},{immediate:!0});let Qt=S(()=>!Le.value&&Q.value?.state===`running`),$t=e(Date.now()),en=S(()=>Qt.value?Q.value?.turnStartedAt??null:null),tn=S(()=>en.value?zl($t.value-en.value):``),nn=S(()=>en.value?Math.max(0,Math.floor(($t.value-en.value)/1e3)):0),an;function on(){clearTimeout(an),an=void 0;let e=en.value;if(!e||document.hidden)return;let t=()=>{$t.value=Date.now();let n=($t.value-e)%1e3;an=setTimeout(t,(n<0?-n:1e3-n)+10)};t()}n(en,on,{immediate:!0}),document.addEventListener(`visibilitychange`,on);let sn=S(()=>{if(Le.value)return Le.value;let e=Fe.value;return e.membership.value,e.rows.slice(-150)}),ln=S(()=>Pe.value===`live`&&Lt.value.get(Q.value?.hostId??``)===`connected`&&Q.value?.turnActive===!1),un=S(()=>{let e=sn.value.map(e=>e.row.value),t=Q.value;return Gn(e,!!Le.value&&ze.value.length>0||!!t&&!(t.turnActive??t.state===`running`))}),pn=e(null),mn;async function hn(e,t){let n=new Set(t),r=sn.value.filter(e=>n.has(e.seqStart)).map(e=>String(e.row.value.item.text??``).trim()).filter(Boolean).join(`
|
|
33
|
+
|
|
34
|
+
`);if(r)try{await navigator.clipboard.writeText(r),pn.value=e,clearTimeout(mn),mn=setTimeout(()=>pn.value=null,1500)}catch{}}let gn=e(!1);async function _n(e,t,n){let r=Q.value;if(r&&!gn.value){gn.value=!0,Ee.value=``;try{await $(Nn(r)+`/rewind`,`POST`,{messageId:e,mode:n},12e4),n!==`files`&&X.value===r.key&&!Dt.value.trim()&&(Dt.value=t,C(ui)),X.value===r.key&&bt(n===`files`?`Files rewound.`:n===`both`?`Conversation and files rewound.`:`Conversation rewound.`)}catch(e){Ee.value=String(e.message)}finally{gn.value=!1}}}let yn=y({base:``,cwd:``});n(Q,e=>{let t=e?`/api`+Nn(e):``,n=e?.rewind??[],r=yn.value;(t!==r.base||(e?.cwd??``)!==r.cwd||n.join()!==(r.rewindModes??[]).join())&&(yn.value={base:t,cwd:e?.cwd??``,rewindModes:n,rewinding:gn,rewind:(e,t,n)=>void _n(e,t,n)})},{immediate:!0}),o(En,yn);let bn=e(null);function xn(e){let t=e.target;t instanceof HTMLImageElement&&t.closest(`.prose, .user-images`)&&(e.preventDefault(),bn.value=t.currentSrc||t.src)}let Cn=S(()=>{let e=Fe.value;return e.membership.value,e.rows.at(-1)?.seqStart}),wn=S(()=>{if(Le.value)return Re.value;let e=Fe.value;return e.membership.value,e.rows.length>150||e.hasOlder}),Dn=S(()=>{let e=new Map(E.map(e=>[e,[]]));for(let t of Ze.value.cards)e.get(t.column)?.push(t);return e}),On=S(()=>Pe.value===`live`?`Live`:Pe.value===`paused`?`Paused`:`Reconnecting`),kn=null,An=null,jn;async function $(e,t=`GET`,n,r=2e4){let i=await fetch(`/api`+e,{method:t,headers:{"Content-Type":`application/json`,"x-litepaseo":`1`},body:n===void 0?void 0:JSON.stringify(n),signal:AbortSignal.timeout(r)}),a=await i.json().catch(()=>({}));if(i.status===401&&Te.value&&e!==`/login`&&Pn(`ended`),!i.ok)throw Object.assign(Error((a.error??`Request failed`)+(a.requestId?` (reference ${a.requestId})`:``)),{status:i.status,delivery:a.delivery,code:a.code,scope:a.scope});return a}async function Mn(e){Y.value=!0,Ee.value=``;try{await e()}catch(e){Ee.value=String(e.message)}finally{Y.value=!1}}function Nn(e){return`/hosts/${encodeURIComponent(e.hostId)}/agents/${encodeURIComponent(e.id)}`}function Pn(e){if(Te.value=!1,e===`user`){Z.clear(),$e.value=[],rt++,Qe.clear();try{localStorage.setItem(`litepaseo-composer-signout`,crypto.randomUUID())}catch{}}else Qe.forgetRemote(`Sign in again, then retry the upload.`);kn?.close(),An?.close(),kn=An=null,Se.value=Ce.value=``,Fn(),Ee.value=e===`ended`?`Your session ended. Sign in again; your drafts are kept.`:``}async function Fn(){try{we.value=await $(`/auth`),be.value=we.value?.instanceName??``}catch{we.value={authenticated:!1,totp:!1};return}we.value.authenticated&&await Ln()}async function In(){await Mn(async()=>{await $(`/login`,`POST`,{token:Se.value.trim(),...we.value?.totp?{code:Ce.value.trim()}:{}}),Se.value=Ce.value=``,await Ln()})}async function Ln(){Te.value=!0,Ee.value=``,Ze.value=await $(`/board`),zn(),Uo(),zr(),Kr(),_t(),clearInterval(Gr),Gr=setInterval(()=>void Kr(),3e5);let e=new URLSearchParams(location.search).get(`session`);e&&(history.replaceState(history.state,``,`/`),Qn(e))}function Rn(){Ce.value=Ce.value.replace(/\D/g,``).slice(0,6)}navigator.serviceWorker?.addEventListener(`message`,e=>{e.data?.type===`open-session`&&Te.value&&Qn(String(e.data.key))});function zn(){kn?.close(),kn=Tn({url:()=>`/api/stream?generation=${encodeURIComponent(je.generation)}&since=${je.seq}&wgeneration=${encodeURIComponent(ke.generation)}&wsince=${ke.seq}`,onState:e=>{Pe.value=e,e===`unauthorized`&&Pn(`ended`)},onMessage:e=>{let t=e;t.type===`project-pins`?wr(t.pins):t.type===`hosts`?(Oe.value=t.hosts,t.instanceName!==void 0&&(be.value=t.instanceName)):t.type===`workspaces-snapshot`?ke.applyCollection({type:`snapshot`,generation:t.generation,seq:t.seq,items:t.workspaces}):t.type===`workspaces-changes`?ke.applyCollection({type:`changes`,generation:t.generation,seq:t.seq,changes:t.changes}):je.apply(t)}})}n(Ue,e=>{clearTimeout(jn),jn=setTimeout(()=>{let t=e.trim().toLowerCase();if(!t){ke.setFilter(null),je.setFilter(null);return}let n=It.value;ke.setFilter(e=>`${e.name}\n${e.project}\n${e.branch??``}\n${e.directory}\n${n.get(e.hostId)??``}`.toLowerCase().includes(t)),je.setFilter(e=>`${e.title??``}\n${e.project}\n${e.cwd}\n${n.get(e.hostId)??``}\n${e.provider}`.toLowerCase().includes(t))},120)});let Bn=!0;n(Ve,(e,t,n)=>{let r=e?.querySelector(`.timeline-inner`);if(!e||!r)return;let i=e.scrollTop,a=()=>{let t=e.scrollTop;Xn()?Bn=!0:t<i-1&&(Bn=!1),si();let n=Un!==null&&Math.abs(t-Un)<2;n&&(Un=null),!n&&performance.now()>=Hn&&(t<i-1?Vn=`up`:t>i+1&&(Vn=`down`),Kn()),i=t},o=new ResizeObserver(()=>{!Le.value&&Bn&&Zn()}),s=e=>{performance.now()<Hn||!e.deltaY||(Vn=e.deltaY<0?`up`:`down`,Kn())},c=null,l,u=e=>{c=e.touches.length===1?e.touches[0].clientY:null},d=e=>{if(e.touches.length!==1){c=null;return}let t=e.touches[0].clientY;c!==null&&Math.abs(t-c)>2&&(Vn=t>c?`up`:`down`,Vn===`up`&&(Bn=!1),performance.now()>=Hn?Kn():(clearTimeout(l),l=setTimeout(Kn,50))),c=t},f=()=>{c=null};e.addEventListener(`touchstart`,u,{passive:!0}),e.addEventListener(`touchmove`,d,{passive:!0}),e.addEventListener(`touchend`,f,{passive:!0}),e.addEventListener(`touchcancel`,f,{passive:!0}),e.addEventListener(`scroll`,a,{passive:!0}),e.addEventListener(`wheel`,s,{passive:!0}),o.observe(r),o.observe(e),n(()=>{clearTimeout(l),e.removeEventListener(`touchstart`,u),e.removeEventListener(`touchmove`,d),e.removeEventListener(`touchend`,f),e.removeEventListener(`touchcancel`,f),o.disconnect(),e.removeEventListener(`scroll`,a),e.removeEventListener(`wheel`,s)})},{flush:`post`});let Vn=null,Hn=0,Un=null;function Wn(e,t){e.scrollTop=t,Un=e.scrollTop,Hn=performance.now()+40}function Kn(){let e=Ve.value;if(!e||Be.value||!Vn||e.offsetParent===null)return;let t=Math.max(600,e.clientHeight);Vn===`up`&&e.scrollTop<t&&wn.value?Qr(`before`):Vn===`down`&&Le.value&&e.scrollHeight-e.scrollTop-e.clientHeight<t&&Qr(`after`)}function qn(e){let t=Ve.value;if(!t)return null;let n=t.getBoundingClientRect(),r=Array.from(t.querySelectorAll(`[data-seq-start]`)).filter(e=>{let t=e.getBoundingClientRect();return t.bottom>n.top&&t.top<n.bottom}),i=e===`first`?r[0]:r.at(-1);return i?{seq:i.dataset.seqStart,top:i.getBoundingClientRect().top}:null}function Jn(e){let t=Ve.value,n=e&&t?.querySelector(`[data-seq-start="${e.seq}"]`);return!t||!n?!1:(Wn(t,t.scrollTop+n.getBoundingClientRect().top-e.top),!0)}async function Yn(){let e=qn(`last`);Le.value=null,ze.value=[],await C(),Jn(e)?Xn()&&(Bn=!0):Zn()}function Xn(){let e=Ve.value;return!e||e.scrollHeight-e.scrollTop-e.clientHeight<120}function Zn(){Bn=!0,C(()=>{let e=Ve.value;e&&(e.scrollTop=e.scrollHeight)})}function Qn(e){Je.value=`chat`,X.value=e;let t=je.get(e);Me.value=t?.workspaceId?`${t.hostId}:${t.workspaceId}`:null,tr()}function $n(e){Je.value=`chat`,Me.value=e,X.value=je.indexed(e,1)[0]?.key??null,tr()}n(Q,e=>{e?.workspaceId&&!Me.value&&(Me.value=`${e.hostId}:${e.workspaceId}`)}),n(Vt,e=>{Me.value&&e.length&&!e.some(e=>e.key===X.value)&&(X.value=e[0].key)});let er=matchMedia(`(max-width: 760px)`);function tr(){!We.value&&er.matches&&history.pushState({litepaseoDetail:!0},``),We.value=!0}function nr(){history.state?.litepaseoDetail?history.back():We.value=!1}function rr(){We.value&&!history.state?.litepaseoDetail&&(We.value=!1)}window.addEventListener(`popstate`,rr);let ir=e(null);function ar(e){let t=e.target,n=!!t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName));e.key===`Escape`&&bn.value?bn.value=null:e.key===`k`&&(e.metaKey||e.ctrlKey)||e.key===`/`&&!n?(e.preventDefault(),We.value&&er.matches&&nr(),ir.value?.focus(),ir.value?.select()):e.key===`n`&&!n&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&Te.value&&!or.value?(e.preventDefault(),sr()):e.key===`Escape`&&t===ir.value&&Ue.value&&(Ue.value=``)}window.addEventListener(`keydown`,ar);let or=e(null);function sr(e){let t=e?e.items.at(0):ke.range(0,1)[0];or.value={hostId:Gt.value??t?.hostId??Q.value?.hostId??null,cwd:t?.rootPath??null,project:t?{key:t.projectKey,name:t.project}:null}}function cr(e){or.value=null,Ue.value&&=``,Qn(e)}let lr=S(()=>(!!X.value||!!Me.value)&&!Q.value),ur=y(null),dr=y(null);function fr(e){return`/hosts/${encodeURIComponent(e.hostId)}/workspaces/${encodeURIComponent(e.id)}`}function pr(e,t,n){ur.value={thread:e,x:t,y:n}}function mr(e){let t=Bt.value;if(!t)return;let n=e.currentTarget.getBoundingClientRect();pr(t,n.right-200,n.bottom+6)}async function hr(e){let t=dr.value;t&&await Mn(async()=>{await $(fr(t)+`/title`,`POST`,{title:e}),dr.value=null})}async function gr(e,t){await Mn(async()=>void await $(fr(e)+`/pin`,`POST`,{pinned:t}))}async function _r(e){await Mn(async()=>{await $(fr(e)+`/unread`,`POST`,{}),Me.value===e.key&&(Me.value=X.value=null,nr())})}async function vr(e){await Mn(async()=>void await $(fr(e)+`/read`,`POST`,{}))}async function yr(e){confirm(`Archive “${e.name}”? It leaves the sidebar; the host keeps its history.`)&&await Mn(async()=>{await $(fr(e)+`/archive`,`POST`,{}),Me.value===e.key&&(Me.value=X.value=null)})}let br=e({});function xr(e){return e.projectIds.some(t=>!!br.value[JSON.stringify([e.hostId,t])])}let Cr=0;function wr(e){Cr++,br.value=e,ke.setProjectPins(e)}async function Tr(e){let t=!xr(e),n=Cr;await Mn(async()=>{let r=await $(`/project-pins`,`POST`,{hostId:e.hostId,projectIds:e.projectIds,pinned:t});n===Cr&&wr(r)})}let Er=y(null),Dr=y(null),Or=S(()=>{ke.version.value;let e=Dr.value;if(!e)return null;let t=e.threadKeys.map(e=>ke.get(e)).find(Boolean);return{projectId:t?.projectId??e.projectIds[0]??``,name:t?.project??e.name,customName:t?.projectCustomName??null,iconRevision:t?.projectIconRevision??null}});function kr(e,t,n){let r=e.items.range(0,e.items.size),i=r[0];i&&(Er.value={project:{name:e.name,hostId:i.hostId,rootPath:i.rootPath,projectIds:[...new Set(r.map(e=>e.projectId).filter(Boolean))],threadKeys:r.map(e=>e.key)},x:t,y:n})}async function Ar(e){let t=It.value.get(e.hostId)??`its host`,n=e.threadKeys.length;confirm(`Remove “${e.name}” from ${t}? Its ${n===1?`thread is`:`${n} threads are`} archived and the project leaves the sidebar. Files on disk are not touched; the host keeps the history.`)&&await Mn(async()=>{if(!e.projectIds.length)throw Error(`This host did not report a project id; update Paseo on it.`);for(let t of e.projectIds)await $(`/hosts/${encodeURIComponent(e.hostId)}/projects/${encodeURIComponent(t)}`,`DELETE`,void 0,6e4);Me.value&&e.threadKeys.includes(Me.value)&&(Me.value=X.value=null)})}let jr=``;n(()=>Bt.value?.unread&&Fe.value.membership.value>=0&&Fe.value.ready?Bt.value:null,e=>{if(!e||document.hidden)return;let t=`${e.key}@${e.activityAt}`;jr!==t&&(jr=t,$(fr(e)+`/read`,`POST`,{}).catch(()=>jr=``))});let Mr=e(localStorage.getItem(`litepaseo-board-mode`)===`plan`?`plan`:`agents`);n(Mr,e=>localStorage.setItem(`litepaseo-board-mode`,e));async function Nr(e){await Mn(async()=>void await $(Nn(e)+`/stop`,`POST`))}async function Pr(e){await Mn(async()=>void await $(Nn(e)+`/read`,`POST`,{}))}async function Ir(e){confirm(`Archive “${e.title||`this session`}”? It leaves the board and sidebar; the host keeps its history.`)&&await Mn(async()=>void await $(Nn(e)+`/archive`,`POST`,{}))}let Lr=``;n(()=>Q.value&&Q.value.unread&&Fe.value.membership.value>=0&&Fe.value.ready?Q.value:null,e=>{if(!e||document.hidden)return;let t=`${e.key}@${e.activityAt}`;Lr!==t&&(Lr=t,$(Nn(e)+`/read`,`POST`,{}).catch(()=>Lr=``))});let Rr=e(null);o(Br,{predict:e=>{let t=Q.value;return t?$(Nn(t)+`/suggestion`,`POST`,{token:e},65e3):Promise.resolve({status:`expired`,text:``})},use:e=>{Dt.value=e,C(()=>{ui(),He.value?.focus()})},send:e=>void mi(e),offer:(e,t)=>{let n=Q.value;n&&(!Rr.value||Rr.value.key!==n.key||e>=Rr.value.seqStart)&&(Rr.value={key:n.key,seqStart:e,text:t})}});let Vr=S(()=>Rr.value&&Rr.value.key===Q.value?.key&&!Dt.value?Rr.value.text:``),Hr=S(()=>Vr.value&&!O?Vr.value:Yt.value?Zt.value===`queue`?`Queue a message for when this turn ends`:Zt.value===`steer`?`Guide the current turn with a new instruction`:`Interrupt and send a new message`:`Message this agent…`),Ur=y(null),Wr=e(!1),Gr;async function Kr(e=!1){if(Te.value&&!document.hidden){Wr.value=!0;try{Ur.value=await $(`/usage`+(e?`?refresh=1`:``))}catch{}finally{Wr.value=!1}}}n(X,()=>{Rr.value=null}),n(()=>Q.value?.key??null,e=>{An?.close(),An=null,Vn=null,Un=null,Hn=0,Bn=!0;let t=new dn;Fe.value=t,Le.value=null,ze.value=[],Ie.value=``;let n=je.get(e);n&&(An=Tn({url:()=>`/api`+Nn(n)+`/timeline/stream`,onState:e=>{e===`unauthorized`&&Pn(`ended`)},onMessage:e=>{if(Fe.value!==t)return;let r=!Le.value&&(Xn()||!t.ready),i=e.ops,a=i.find(e=>e.type===`error`);Ie.value=a?.type===`error`?a.message:``;let o=t.epoch;t.apply(i),t.epoch&&t.epoch!==ti&&ni(n,t),o&&o!==t.epoch&&(Le.value=null,ze.value=[],Zn()),r&&Zn()}}))});function qr(){Le.value=null,ze.value=[],Zn()}function Jr(e,t,n){return $(Nn(e)+`/timeline?cursor=`+encodeURIComponent(JSON.stringify({epoch:t,seq:n})))}let Yr=new Set,Xr=4;async function Zr(e,t,n,r){let i=[],a=!1;for(let o=0;o<8&&i.length<100;){let s=i.at(-1)?.seqStart??r,c=ze.value.at(-1);if(c===void 0){let e=t.rows;if(!e.length)break;if(e[0].seqStart<=s||a){let t=e.findIndex(e=>e.seqStart>s);t>=0&&i.push(...e.slice(t,t+100-i.length));break}ze.value.push(e[0].seqStart);continue}o++;let l=ze.value,u=e=>!e.hasOlder||e.rows.some(e=>e.seqStart<=s),d=Yr.has(c)?0:Math.min(Xr,l.length-1);if(d>0){let t=l.length-1-d,r=await Jr(e,n,l[t]);if(r.epoch!==n)return`stale`;if(u(r)){let e=l[t],n=r.rows.filter(e=>e.seqStart>s),a=100-i.length;l.splice(t),n.length>a&&l.push(e),i.push(...n.slice(0,a).map(e=>({seqStart:e.seqStart,row:y(e)}))),Xr=Math.min(Xr*2,64);continue}Xr=d>>1;continue}let f=await Jr(e,n,c);if(f.epoch!==n)return`stale`;let p=f.rows.filter(e=>e.seqStart>s),m=!0;for(;!Yr.has(c)&&p.length&&f.hasOlder&&!f.rows.some(e=>e.seqStart<=s)&&o<8;){o++;let t=p[0].seqStart,r=await Jr(e,n,t);if(r.epoch!==n)return`stale`;let i=r.rows.filter(e=>e.seqStart>s&&e.seqStart<t);if(!i.length)break;f=r,p=i,m=!1}let h=100-i.length;if(!p.length&&c===t.rows[0]?.seqStart&&(a=!0),m&&p.length<=h&&ze.value.pop(),i.push(...p.slice(0,h).map(e=>({seqStart:e.seqStart,row:y(e)}))),!m)break}return i.length?i:null}async function Qr(e){let t=Fe.value,n=Ve.value,r=sn.value.slice();e===`before`&&r.forEach((e,t)=>r[t]={seqStart:e.seqStart,row:y(e.row.value)});let i=e===`before`?r[0]:r.at(-1),a=Q.value;if(!a||!i||Be.value)return;let o=t.epoch;Be.value=e;try{let s=()=>Fe.value===t&&t.epoch===o&&Q.value?.key===a.key;if(e===`before`){let e=await Jr(a,o,i.seqStart);if(!s())return;if(e.epoch!==o)return qr();let t=qn(`first`),c=fn(r,e,`before`);c.added&&(ze.value.push(r.at(-1).seqStart+1),Yr.add(r.at(-1).seqStart+1)),Le.value=c.rows,Re.value=c.hasOlder,await C(),!Jn(t)&&n&&(n.scrollTop=0)}else{let e=await Zr(a,t,o,i.seqStart);if(!s())return;if(e===`stale`)return qr();let c=t.rows.at(-1)?.seqStart,l=[...r,...e??[]].slice(-150);if(!e||c!==void 0&&l.at(-1).seqStart>=c){ze.value=[],await Yn();return}let u=qn(`last`);Le.value=l,Re.value=!0,await C(),!Jn(u)&&n&&(n.scrollTop=n.scrollHeight)}}catch(e){Ee.value=String(e.message),Vn=null}finally{Be.value=null}C(Kn)}let $r=matchMedia(`(hover: hover) and (pointer: fine)`).matches,ei=y(null),ti=``;async function ni(e,t){ti=t.epoch;try{let n=await $(Nn(e)+`/timeline/prompts`);Fe.value===t&&n.epoch===t.epoch&&(ei.value={key:e.key,prompts:n.prompts})}catch{Fe.value===t&&(ei.value={key:e.key,prompts:[]})}}n(()=>Q.value?.key,()=>{ei.value=null,ti=``,Yr.clear()});let ri=e=>String(e.item.text??``).replace(/\s+/g,` `).trim().slice(0,240),ii=S(()=>{let e=Fe.value;e.membership.value;let t=ei.value?.key===Q.value?.key?ei.value?.prompts??[]:[],n=t.at(-1)?.seq??-1,r=[];for(let t of e.rows)t.seqStart>n&&t.row.value.item.type===`user_message`&&r.push({seq:t.seqStart,preview:ri(t.row.value)});return r.length?[...t,...r]:t}),ai=e(null),oi=0;function si(){oi||ii.value.length<2||!$r||(oi=requestAnimationFrame(()=>{oi=0;let e=qn(`first`);ai.value=e?Number(e.seq):null}))}n([ii,Le],()=>void C(si));function ci(e){let t=Ve.value,n=t?.querySelector(`[data-seq-start="${e}"]`)??Array.from(t?.querySelectorAll(`[data-seq-start]`)??[]).find(t=>Number(t.dataset.seqStart)>=e||t.classList.contains(`row-assistant`)&&Number(t.dataset.seqEnd)>=e);t&&n&&(Bn=!1,Wn(t,t.scrollTop+n.getBoundingClientRect().top-t.getBoundingClientRect().top-12),si())}async function li(e,t=!1){let n=Q.value,r=Fe.value;if(!n||Be.value)return;if(Ve.value?.querySelector(`[data-seq-start="${e}"]`))return ci(e);let i=r.rows,a=i.length&&i[0].seqStart<=e?i.findIndex(t=>t.seqStart>=e||t.row.value.item.type===`assistant_message`&&t.row.value.seqEnd>=e):-1;if(a>=0){let t=a;return ze.value=[],t>=i.length-150?Le.value=null:(Le.value=i.slice(t,t+150),Re.value=t>0||r.hasOlder),await C(),ci(e)}let o=r.epoch,s=ii.value.map(e=>e.seq).filter(t=>t>e&&(!i.length||t<i[0].seqStart));Be.value=`before`;try{let a=t?e+1:s[0]??i[0]?.seqStart??2**53-1,c=[],l=!1;for(let t=0;t<8;t++){let t=await Jr(n,o,a);if(Fe.value!==r||Q.value?.key!==n.key)return;if(t.epoch!==o)return qr();if(c=[...t.rows,...c],l=t.hasOlder,!t.rows.length||t.rows[0].seqStart<=e||!t.hasOlder)break;a=t.rows[0].seqStart}let u=Math.max(0,c.findIndex(t=>t.seqStart>=e||t.item.type===`assistant_message`&&t.seqEnd>=e)),d=c.slice(u,u+150).map(e=>({seqStart:e.seqStart,row:y(e)}));if(ze.value=[...s].reverse(),Yr.clear(),Xr=4,d.length&&d.length<=50){let e=await Zr(n,r,o,d.at(-1).seqStart);if(Fe.value!==r||Q.value?.key!==n.key)return;if(e===`stale`)return qr();e&&(d=[...d,...e])}Le.value=d,Re.value=l||u>0,await C(),ci(e),Vn=`down`,requestAnimationFrame(Kn)}catch(e){Ee.value=String(e.message)}finally{Be.value=null}}function ui(){let e=He.value;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,Math.round(window.innerHeight*.4))+`px`)}function di(e){e.key===`Tab`&&!e.shiftKey&&Vr.value?(e.preventDefault(),Dt.value=Vr.value,C(ui)):e.key!==`Enter`||e.isComposing||(!O&&!e.shiftKey||e.metaKey||e.ctrlKey)&&(e.preventDefault(),fi())}async function fi(){await mi(Dt.value,!0)}function pi(e){return e.turnActive===!1||e.turnActive===void 0&&e.status!==`running`&&e.status!==`initializing`}async function mi(e,t=!1){let n=Q.value;if(!n||!e.trim()&&(!t||!pt.value.length)||Ot.value||Y.value||t&&!Tt.value)return;if(Zt.value===`queue`&&(!pi(n)||$e.value.length>0)){let r=t?[...pt.value]:[];await Mn(async()=>{let i=r.map(e=>e.id),a=JSON.stringify([n.key,e,i]),o=et.get(a)??crypto.randomUUID();et.set(a,o);try{await $(Nn(n)+`/queue`,`POST`,{id:o,text:e,attachmentIds:i})}catch(e){throw await it(),e}et.delete(a);for(let e of r)Qe.remove(n.key,e,!0);t&&Z.state(n.key).text===e&&Z.setText(n.key,``),X.value===n.key&&(Rr.value=null),await it(),C(ui)});return}let r=t?[...pt.value]:[];t&&Z.setText(n.key,``),await hi(n,e,r,pi(n)||Zt.value===`queue`?`send`:Zt.value,{restore:t})}async function hi(e,t,n,r,{restore:i}){let a=Z.state(e.key),o=Z.generation,s={text:t,messageId:crypto.randomUUID(),attachmentIds:n.map(e=>e.id),attachmentNames:n.map(e=>e.file.name)};Z.begin(e.key,s);let c=!1;return await Mn(async()=>{try{if(await $(Nn(e)+`/messages`,`POST`,{...s,behavior:r}),c=!0,o!==Z.generation)return;Z.resolve(e.key,s.messageId);for(let t of n)Qe.remove(e.key,t,!0);X.value===e.key&&(Rr.value=null),C(ui),X.value===e.key&&qr()}catch(t){if(o!==Z.generation)return;if(t.delivery===`not-sent`&&(Z.resolve(e.key,s.messageId),t.status!==409))for(let e of n)e.error=`Not sent. Retry the upload or remove this attachment.`;throw i&&!a.text&&Z.restoreFailed(e.key,s),t}}),c}async function gi(e){let t=Q.value;t&&await Mn(async()=>{await $(Nn(t)+`/queue/`+e.id,`DELETE`),await it()})}async function _i(e){let t=Q.value;if(!t)return;let n=nt.value;await Mn(async()=>{await $(Nn(t)+`/queue/`+e.id,`PATCH`,{text:n}),tt.value=null,await it()})}async function vi(e){let t=Q.value;!t||Y.value||Ot.value||await Mn(async()=>{await $(Nn(t)+`/queue/`+e.id+`/send`,`POST`),await it()})}async function yi(){let e=Q.value;e&&await Mn(async()=>void await $(Nn(e)+`/stop`,`POST`))}async function bi(e,t){let n=Q.value;n&&await Mn(async()=>{await $(Nn(n)+`/permissions/`+encodeURIComponent(e.id),`POST`,t)})}async function xi(){await Mn(async()=>{await $(`/hosts`,`POST`,{label:Ge.value,connection:Ke.value}),Ge.value=``,Ke.value=``})}async function Si(e){confirm(`Disconnect and remove ${e.label}? Its agents keep running on the host.`)&&await Mn(async()=>void await $(`/hosts/`+e.id,`DELETE`))}async function Ci(e){try{Ze.value=await $(`/board`,`PUT`,{revision:Ze.value.revision,cards:e})}catch(e){throw Ze.value=await $(`/board`),e}}function wi(e){let t=je.get(e);return t?{hostId:t.hostId,agentId:t.id}:{hostId:null,agentId:null}}async function Ti(){await Mn(async()=>{Ye.value.trim()&&(await Ci([...Ze.value.cards,{id:crypto.randomUUID(),title:Ye.value.trim(),column:`Todo`,...wi(Xe.value),createdAt:Date.now()}]),Ye.value=``,Xe.value=``)})}async function Ei(e,t){await Mn(async()=>{Ze.value=await $(`/board/cards/${encodeURIComponent(e.id)}`,`PATCH`,t)})}async function Di(e,t){let n=wi(t);await Ei(e,{link:n.hostId&&n.agentId?{hostId:n.hostId,agentId:n.agentId}:null})}async function Oi(e,t){await Mn(async()=>{Ze.value=await $(`/board/cards/${encodeURIComponent(e.id)}/comments`,`POST`,{text:t})})}async function ki(e,t){await Mn(async()=>{Ze.value=await $(`/board/cards/${encodeURIComponent(e.id)}/comments/${encodeURIComponent(t)}`,`DELETE`)})}function Ai(e){if(!e.description&&!e.comments?.length)return void ji(e);confirm(`Delete “${e.title}”? Its description and comments are deleted too.`)&&ji(e)}async function ji(e){await Mn(()=>Ci(Ze.value.cards.filter(t=>t.id!==e.id))),Mi.value===e.id&&(Mi.value=null)}let Mi=e(null),Ni=S(()=>Ze.value.cards.find(e=>e.id===Mi.value)??null);function Pi(e){return(e.description??``).replace(/```[\s\S]*?```/g,` `).replace(/[#>*_`~\[\]()|-]+/g,` `).replace(/\s+/g,` `).trim().slice(0,160)}let Fi=S(()=>{je.version.value;let e=je.range(0,30),t=Q.value,n=t?[t,...e.filter(e=>e.key!==t.key)]:e,r=Oe.value.length>1;return n.map(e=>({key:e.key,label:(e.title||`${e.provider} · ${e.project}`)+(r?` (${It.value.get(e.hostId)??e.hostId})`:``)}))});function Ii(e){return je.version.value,e.hostId&&e.agentId?je.get(`${e.hostId}:${e.agentId}`)??null:null}async function Li(e,t){await Ei(e,{column:t})}function Ri(e){e.hostId&&e.agentId&&Qn(`${e.hostId}:${e.agentId}`)}function zi(e){Je.value=e,e!==`chat`||X.value?tr():nr()}B(()=>Te.value&&Je.value===`chat`&&(!er.matches||We.value)&&!ie.value&&!K.value?Q.value?.key??null:null,()=>Te.value),Fn();let Bi=S(()=>(ke.version.value,je.waiting));n(Bi,e=>Xo(e)),n([Bi,be],([e,t])=>{let n=t?`${t} · LitePaseo`:`LitePaseo`;document.title=e?`(${e}) ${n}`:n},{immediate:!0});let Hi=S(()=>(je.version.value,je.waiting?`attention`:je.allLaneSize(`running`)?`running`:je.allLaneSize(`review`)?`unread`:``));return n(Hi,e=>Zo(e),{immediate:!0}),document.addEventListener(`visibilitychange`,()=>{document.hidden||Kr()}),l(()=>{clearInterval(Gr),clearInterval(Nt),clearTimeout(an),document.removeEventListener(`visibilitychange`,on),Qe.clear(),window.removeEventListener(`storage`,Ft),window.removeEventListener(`popstate`,rr),window.removeEventListener(`keydown`,ar),kn?.close(),An?.close(),clearTimeout(jn)}),(e,n)=>Te.value?(i(),R(`div`,{key:1,class:M([`shell`,{"detail-open":We.value,"is-resizing":he.value}]),style:g({"--sidebar-w":me.value+`px`})},[x(`aside`,Md,[x(`div`,{class:M([`sidebar-resize`,{"is-dragging":he.value}]),role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuenow":me.value,"aria-valuemin":dm,"aria-valuemax":fm,tabindex:`0`,title:`Drag to resize · double-click to reset`,onPointerdown:_e,onDblclick:n[2]||=e=>ge(pm),onKeydown:[n[3]||=P(v(e=>ge(me.value-16),[`prevent`]),[`left`]),n[4]||=P(v(e=>ge(me.value+16),[`prevent`]),[`right`])]},null,42,Nd),be.value?(i(),R(`div`,{key:0,class:`instance-name`,title:be.value},k(be.value),9,Pd)):F(``,!0),x(`nav`,Fd,[x(`label`,{class:M([`side-row side-search`,{active:!!Ue.value}])},[t(J,{name:`search`,size:15}),a(x(`input`,{ref_key:`searchInput`,ref:ir,"onUpdate:modelValue":n[5]||=e=>Ue.value=e,type:`search`,placeholder:`Search`,"aria-label":`Search sessions, projects, hosts`,"aria-keyshortcuts":`/ Control+K Meta+K`},null,512),[[_,Ue.value]]),x(`kbd`,Id,k(D(j)?`⌘K`:`Ctrl K`),1)],2),x(`button`,{class:M([`side-row`,{chosen:Je.value===`board`}]),onClick:n[6]||=e=>zi(`board`)},[t(J,{name:`board`,size:15}),n[75]||=d(`Kanban `,-1)],2)]),x(`div`,Ld,[x(`span`,Rd,k(Ne.value===`projects`?`Workspaces`:`Recent`),1),x(`span`,zd,k(Ne.value===`projects`?Wt.value:Ut.value),1),x(`button`,{class:M([`icon-btn side-tool`,{chosen:V.value||Gt.value!==null||Ne.value!==`projects`}]),"aria-label":`View options`,title:`Group and filter`,"aria-expanded":V.value,onClick:n[7]||=e=>V.value=!V.value},[t(J,{name:`sliders`,size:15})],10,Bd)]),Gt.value?(i(),R(`div`,Vd,[x(`button`,{class:`active-host-label`,title:`Filtered by host: `+(It.value.get(Gt.value)??Gt.value),onClick:n[8]||=e=>V.value=!0},[t(J,{name:`server`,size:13}),x(`span`,null,`Host: `+k(It.value.get(Gt.value)??Gt.value),1)],8,Hd),x(`button`,{class:`icon-btn`,"aria-label":`Clear host filter`,title:`Show all hosts`,onClick:n[9]||=e=>Gt.value=null},[t(J,{name:`close`,size:13})])])):F(``,!0),V.value?(i(),R(`div`,Ud,[x(`div`,Wd,[x(`button`,{role:`radio`,"aria-checked":Ne.value===`projects`,class:M({chosen:Ne.value===`projects`}),onClick:n[10]||=e=>Ne.value=`projects`},` By project `,10,Gd),x(`button`,{role:`radio`,"aria-checked":Ne.value===`recent`,class:M({chosen:Ne.value===`recent`}),onClick:n[11]||=e=>Ne.value=`recent`},`Recent`,10,Kd)]),Oe.value.length>1?(i(),R(`div`,qd,[x(`button`,{role:`radio`,"aria-checked":Gt.value===null,class:M({chosen:Gt.value===null}),onClick:n[12]||=e=>Gt.value=null},[n[76]||=d(` All`,-1),x(`span`,Yd,k(Ht.value),1)],10,Jd),(i(!0),R(b,null,z(Oe.value,e=>(i(),R(`button`,{key:e.id,role:`radio`,"aria-checked":Gt.value===e.id,class:M({chosen:Gt.value===e.id}),title:e.label+` · `+e.state,onClick:t=>Gt.value=e.id},[x(`span`,{class:M([`status-dot`,e.state===`connected`?`is-idle-ok`:`is-offline`])},null,2),d(k(e.label),1),x(`span`,Zd,k(Kt.value.get(e.id)),1)],10,Xd))),128))])):F(``,!0)])):F(``,!0),t(Sr,{queues:at.value,mode:Ne.value,store:D(ke),"host-labels":It.value,"host-states":Lt.value,"selected-key":Me.value,searching:!!Ue.value.trim(),onSelect:$n,onNew:sr,onMenu:pr,onProjectMenu:kr},null,8,[`queues`,`mode`,`store`,`host-labels`,`host-states`,`selected-key`,`searching`]),t(sl,{report:Ur.value,loading:Wr.value,onRefresh:n[13]||=e=>Kr(!0)},null,8,[`report`,`loading`]),x(`div`,Qd,[x(`span`,{class:M([`live`,`is-`+Pe.value]),title:`Directory stream: `+Pe.value},[n[77]||=x(`span`,{class:`live-dot`},null,-1),d(k(On.value),1)],10,$d),x(`button`,{class:M([`icon-btn`,{chosen:Je.value===`schedules`}]),title:`Schedules`,"aria-label":`Schedules`,onClick:n[14]||=e=>zi(`schedules`)},[t(J,{name:`clock`,size:15})],2),x(`button`,{class:M([`icon-btn foot-hosts`,{chosen:Je.value===`hosts`}]),title:`Hosts: ${zt.value} of ${Oe.value.length} connected`,"aria-label":`Hosts, ${zt.value} of ${Oe.value.length} connected`,onClick:n[15]||=e=>zi(`hosts`)},[t(J,{name:`server`,size:15}),zt.value<Oe.value.length?(i(),R(`span`,tf)):F(``,!0)],10,ef),x(`button`,{class:`icon-btn`,title:`Theme: `+D(yo)+` (click to change)`,"aria-label":`Theme: `+D(yo),onClick:n[16]||=(...e)=>D(To)&&D(To)(...e)},[t(J,{name:D(yo)===`dark`?`moon`:D(yo)===`light`?`sun`:`monitor`,size:15},null,8,[`name`])],8,nf),x(`button`,{class:M([`icon-btn`,{chosen:Je.value===`settings`}]),title:`Settings`,"aria-label":`Settings`,onClick:n[17]||=e=>zi(`settings`)},[t(J,{name:`gear`,size:15})],2)])]),x(`main`,rf,[Ee.value?(i(),R(`div`,af,[t(J,{name:`alert`,size:15}),x(`span`,null,k(Ee.value),1),x(`button`,{class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[18]||=e=>Ee.value=``},[t(J,{name:`close`,size:14})])])):F(``,!0),Je.value===`settings`?(i(),m(jc,{key:1,request:$,"instance-name":be.value,onInstanceChanged:n[19]||=e=>be.value=e,"totp-enabled":!!we.value?.totp,onBack:nr,onSignedOut:n[20]||=e=>Pn(`user`),onTotpChanged:n[21]||=e=>we.value&&(we.value.totp=e),onDictationChanged:n[22]||=e=>mt.value=e},null,8,[`instance-name`,`totp-enabled`])):Je.value===`hosts`&&Rt.value?(i(),m(D(s),{key:Rt.value.id,host:Rt.value,api:$,onBack:n[23]||=e=>Rt.value=null},null,8,[`host`])):Je.value===`hosts`?(i(),R(`section`,of,[x(`header`,sf,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:nr},[t(J,{name:`back`,size:18})]),n[78]||=x(`div`,null,[x(`h1`,null,`Hosts`),x(`p`,{class:`subtle`},`Paseo daemons this console connects to. Secrets stay on this server.`)],-1)]),x(`div`,cf,[x(`div`,lf,[(i(!0),R(b,null,z(Oe.value,e=>(i(),R(`div`,{key:e.id,class:`card-row`},[x(`span`,{class:M([`status-dot`,e.state===`connected`?`is-idle-ok`:`is-offline`])},null,2),x(`div`,uf,[x(`div`,df,k(e.label),1),x(`div`,ff,k(e.state),1),e.diagnostic?.error?(i(),R(`p`,pf,k(e.diagnostic.error.message),1)):F(``,!0),e.diagnostic?.lastConnectedAt?(i(),R(`div`,mf,`Last connected: `+k(new Date(e.diagnostic.lastConnectedAt).toLocaleString()),1)):F(``,!0),e.diagnostic?.attempt?(i(),R(`div`,hf,`Connection attempt `+k(e.diagnostic.attempt),1)):F(``,!0),e.diagnostic?.nextRetryAt?(i(),R(`div`,gf,`Next retry: `+k(new Date(e.diagnostic.nextRetryAt).toLocaleString()),1)):F(``,!0)]),x(`button`,{class:`btn btn-outline`,disabled:e.state!==`connected`,onClick:t=>Rt.value=e},`Settings`,8,_f),x(`button`,{class:`btn btn-outline`,disabled:Y.value,onClick:t=>Si(e)},`Remove`,8,vf)]))),128)),Oe.value.length?F(``,!0):(i(),R(`div`,yf,`No hosts yet.`))]),n[82]||=x(`h2`,{class:`section-label`},`Add a host`,-1),x(`form`,{class:`card form-card`,onSubmit:v(xi,[`prevent`])},[x(`label`,bf,[n[79]||=x(`span`,null,`Name`,-1),a(x(`input`,{"onUpdate:modelValue":n[24]||=e=>Ge.value=e,placeholder:`Build server`,required:``},null,512),[[_,Ge.value]])]),x(`label`,xf,[n[80]||=x(`span`,null,`Connection`,-1),a(x(`input`,{"onUpdate:modelValue":n[25]||=e=>Ke.value=e,type:`password`,placeholder:`ws://host:port/ws, pairing offer or SSH target`,required:``,autocomplete:`off`,"aria-describedby":`host-connection-help`},null,512),[[_,Ke.value]])]),n[81]||=L(`<div id="host-connection-help" class="field-help"><p> The LitePaseo server connects to the daemon, so the address must be reachable from the server, not from this browser. The default daemon port is <code>6767</code>. </p><details><summary>Connection formats</summary><dl><dt>Same machine</dt><dd><code>6767</code> or <code>127.0.0.1:6767</code></dd><dt>Network address</dt><dd><code>192.168.1.10:6767</code>, <code>tcp://host:6767</code>, <code>ws://host:6767/ws</code> or <code>wss://host/ws</code></dd><dt>Daemon password</dt><dd><code>ws://host:6767/ws?password=…</code></dd><dt>SSH tunnel</dt><dd><code>ssh://user@host</code> or <code>ssh://user@host:2222?daemonPort=6767</code>. Key-based login only: the server's user must be able to run <code>ssh user@host</code> without a prompt. </dd><dt>Pairing / relay</dt><dd>Paste a pairing link from Paseo (containing <code>#connect=</code>) or a <code>relay://</code> URL.</dd><dt>Local socket</dt><dd><code>unix:///path/to/socket</code></dd></dl></details></div>`,1),x(`div`,Sf,[x(`button`,{class:`btn btn-primary`,disabled:Y.value},`Add host`,8,Cf)])],32)])])):Je.value===`schedules`?(i(),m(yd,{key:4,hosts:Oe.value,api:$,onBack:nr,onOpenAgent:Qn},null,8,[`hosts`])):Je.value===`board`?(i(),R(`section`,wf,[x(`header`,Tf,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:nr},[t(J,{name:`back`,size:18})]),x(`div`,null,[n[83]||=x(`h1`,null,`Kanban`,-1),x(`p`,Ef,k(Mr.value===`agents`?`Every agent by state, live. Follows the host filter and search.`:`Your own plan. Moving a card never changes an agent.`),1)]),x(`div`,Df,[x(`button`,{class:M({chosen:Mr.value===`agents`}),onClick:n[26]||=e=>Mr.value=`agents`},`Agents`,2),x(`button`,{class:M({chosen:Mr.value===`plan`}),onClick:n[27]||=e=>Mr.value=`plan`},`Plan`,2)])]),x(`div`,Of,[Mr.value===`agents`?(i(),m(Kc,{key:0,store:D(je),"host-labels":It.value,busy:Y.value,onOpen:Qn,onStop:Nr,onRead:Pr,onArchive:Ir},null,8,[`store`,`host-labels`,`busy`])):(i(),R(b,{key:1},[x(`form`,{class:`add-card`,onSubmit:v(Ti,[`prevent`])},[a(x(`input`,{"onUpdate:modelValue":n[28]||=e=>Ye.value=e,placeholder:`New task`,required:``},null,512),[[_,Ye.value]]),a(x(`select`,{"onUpdate:modelValue":n[29]||=e=>Xe.value=e,class:`card-link-select`,"aria-label":`Link to conversation`},[n[84]||=x(`option`,{value:``},`No conversation`,-1),(i(!0),R(b,null,z(Fi.value,e=>(i(),R(`option`,{key:e.key,value:e.key},k(e.label),9,kf))),128))],512),[[N,Xe.value]]),x(`button`,{class:`btn btn-primary`,disabled:Y.value},[t(J,{name:`plus`,size:15}),n[85]||=d(`Add task`,-1)],8,Af)],32),x(`div`,jf,[(i(),R(b,null,z(E,e=>x(`div`,{key:e,class:`column`},[x(`div`,Mf,[x(`h3`,null,k(e),1),x(`span`,Nf,k(Dn.value.get(e).length),1)]),(i(!0),R(b,null,z(Dn.value.get(e),e=>(i(),R(`article`,{key:e.id,class:`card kanban-card`},[x(`button`,{type:`button`,class:`kanban-open`,"aria-label":`Open task `+e.title,onClick:t=>Mi.value=e.id},[x(`span`,Ff,k(e.title),1),Pi(e)?(i(),R(`span`,If,k(Pi(e)),1)):F(``,!0)],8,Pf),e.agentId?(i(),R(`div`,Lf,[Ii(e)?(i(),R(`button`,{key:0,class:`link-btn`,title:`Open `+(Ii(e).title||Ii(e).id),onClick:t=>Ri(e)},[t(J,{name:`chat`,size:13}),x(`span`,zf,k(Ii(e).title||Ii(e).provider),1)],8,Rf)):(i(),R(`span`,Bf,`Conversation unavailable`)),x(`button`,{class:`icon-btn`,"aria-label":`Unlink conversation`,title:`Unlink conversation`,disabled:Y.value,onClick:t=>Di(e,``)},[t(J,{name:`close`,size:13})],8,Vf)])):(i(),R(`select`,{key:1,class:`card-link-select`,"aria-label":`Link to conversation`,disabled:Y.value,value:``,onChange:t=>Di(e,t.target.value)},[n[86]||=x(`option`,{value:``,disabled:``},`Link a conversation…`,-1),(i(!0),R(b,null,z(Fi.value,e=>(i(),R(`option`,{key:e.key,value:e.key},k(e.label),9,Uf))),128))],40,Hf)),x(`div`,Wf,[x(`select`,{value:e.column,"aria-label":`Column`,onChange:t=>Li(e,t.target.value)},[(i(),R(b,null,z(E,e=>x(`option`,{key:e},k(e),1)),64))],40,Gf),e.comments?.length?(i(),R(`button`,{key:0,type:`button`,class:`kanban-count`,title:e.comments.length+` comments`,onClick:t=>Mi.value=e.id},[t(J,{name:`chat`,size:13}),d(k(e.comments.length),1)],8,Kf)):F(``,!0),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Edit task`,title:`Edit`,onClick:t=>Mi.value=e.id},[t(J,{name:`edit`,size:15})],8,qf),x(`button`,{class:`icon-btn`,"aria-label":`Remove`,onClick:t=>Ai(e)},[t(J,{name:`trash`,size:15})],8,Jf)])]))),128)),Dn.value.get(e).length?F(``,!0):(i(),R(`p`,Yf,`Nothing here`))])),64))]),Ni.value?(i(),m(Rl,{key:Ni.value.id,card:Ni.value,columns:E,links:Fi.value,"linked-name":Ii(Ni.value)?Ii(Ni.value).title||Ii(Ni.value).provider:null,busy:Y.value,onClose:n[30]||=e=>Mi.value=null,onPatch:n[31]||=e=>Ei(Ni.value,e),onComment:n[32]||=e=>Oi(Ni.value,e),onUncomment:n[33]||=e=>ki(Ni.value,e),onRemove:n[34]||=e=>ji(Ni.value),onOpen:n[35]||=e=>{Mi.value=null,Ri(Ni.value)}},null,8,[`card`,`links`,`linked-name`,`busy`])):F(``,!0)],64))])])):Q.value?(i(),R(`div`,{key:6,class:`chat-split`,style:g({"--panel-w":le.value+`px`})},[x(`section`,Xf,[x(`header`,Zf,[x(`button`,{class:`icon-btn back`,"aria-label":`Back to sessions`,onClick:nr},[t(J,{name:`back`,size:18})]),x(`span`,{class:M([`status-dot chat-status`,`is-`+(Q.value.attention?`attention`:Q.value.state===`failed`?`error`:Q.value.state===`running`?`running`:`idle`)]),title:Q.value.status},null,10,Qf),x(`h1`,{class:`chat-title`,title:Bt.value?.name||Q.value.title||``},[Bt.value?.pinnedAt?(i(),m(J,{key:0,name:`pin`,size:12,class:`title-pin`})):F(``,!0),d(k(Bt.value?.name||Q.value.title||`Untitled session`),1)],8,$f),x(`span`,{class:`chat-context hide-sm`,title:[Jt.value,It.value.get(Q.value.hostId),Bt.value?.branch,Q.value.provider].filter(Boolean).join(` · `)},[d(k(Jt.value),1),Oe.value.length>1?(i(),R(b,{key:0},[d(` · `+k(It.value.get(Q.value.hostId)),1)],64)):F(``,!0),Bt.value?.branch?(i(),R(b,{key:1},[d(` · `+k(Bt.value.branch),1)],64)):F(``,!0)],8,ep),n[87]||=x(`span`,{class:`grow`},null,-1),x(`button`,{class:`icon-btn head-tool`,"aria-label":`Changes`,title:`Workspace changes`,onClick:n[36]||=e=>U(`changes`)},[t(J,{name:`file`,size:16})]),x(`button`,{class:`icon-btn head-tool`,"aria-label":`Search conversation`,title:`Search conversation`,onClick:n[37]||=e=>U(`search`)},[t(J,{name:`search`,size:16})]),x(`button`,{class:M([`icon-btn head-tool`,{chosen:H.value===`files`}]),"aria-label":`Files`,title:`Files`,onClick:n[38]||=e=>U(`files`)},[t(J,{name:`folder`,size:16})],2),x(`button`,{class:M([`icon-btn head-tool`,{chosen:K.value}]),"aria-label":`Terminal`,title:`Terminal`,onClick:n[39]||=e=>q()},[t(J,{name:`terminal`,size:16})],2),Bt.value?(i(),R(`button`,{key:0,class:`icon-btn head-tool`,"aria-label":`Thread actions`,title:`Rename, pin, mark unread, archive`,onClick:mr},[t(J,{name:`more`,size:16})])):F(``,!0)]),Vt.value.length>1||re.value.length||G.value?(i(),R(`nav`,tp,[(i(!0),R(b,null,z(Vt.value.length?Vt.value:[Q.value],e=>(i(),R(`button`,{key:e.key,class:M({chosen:e.key===X.value&&!ie.value&&!K.value}),onClick:t=>{X.value=e.key,ee()}},[x(`span`,{class:M([`status-dot`,`is-`+(e.attention?`attention`:e.state===`failed`?`error`:e.state===`running`?`running`:e.unread?`unread`:`idle`)])},null,2),x(`span`,rp,k(e.title||e.provider),1)],10,np))),128)),(i(!0),R(b,null,z(re.value,e=>(i(),R(`button`,{key:`file:`+e,class:M([`file-tab`,{chosen:ie.value===e}]),title:e,onClick:t=>ie.value=e,onAuxclick:v(t=>t.button===1&&se(e),[`prevent`])},[t(J,{name:`file`,size:13}),x(`span`,ap,k(e.split(`/`).pop()),1),x(`span`,{class:`tab-close`,role:`button`,"aria-label":`Close `+e,onClick:v(t=>se(e),[`stop`])},[t(J,{name:`close`,size:11})],8,op)],42,ip))),128)),G.value?(i(),R(`button`,{key:0,class:M([`file-tab`,{chosen:K.value}]),onClick:n[41]||=e=>q()},[t(J,{name:`terminal`,size:13}),n[88]||=x(`span`,{class:`agent-tab-name`},`Terminal`,-1),x(`span`,{class:`tab-close`,role:`button`,"aria-label":`Close terminal tab`,onClick:n[40]||=v(e=>W.delete(ne.value),[`stop`])},[t(J,{name:`close`,size:11})])],2)):F(``,!0)])):F(``,!0),G.value?a((i(),m(D(w),{key:`t:`+Q.value.hostId+qt.value,"host-id":Q.value.hostId,cwd:qt.value,api:$,visible:K.value},null,8,[`host-id`,`cwd`,`visible`])),[[T,K.value]]):F(``,!0),ie.value?(i(),m(D(h),{key:Q.value.hostId+`:`+qt.value+`:`+ie.value,"host-id":Q.value.hostId,cwd:qt.value,path:ie.value,api:$},null,8,[`host-id`,`cwd`,`path`])):F(``,!0),a(x(`div`,sp,[x(`div`,{ref_key:`timelineElement`,ref:Ve,class:`timeline`,onClick:xn},[x(`div`,cp,[wn.value?(i(),R(`div`,lp,[Be.value===`before`?(i(),R(`span`,up,[...n[89]||=[x(`span`,{class:`spinner`},null,-1),d(`Loading earlier messages…`,-1)]])):(i(),R(`button`,{key:1,class:`btn btn-ghost`,onClick:n[42]||=e=>Qr(`before`)},`Show earlier messages`))])):F(``,!0),Ie.value?(i(),R(`p`,dp,[t(J,{name:`alert`,size:14}),d(k(Ie.value),1)])):F(``,!0),(i(!0),R(b,null,z(sn.value,e=>(i(),R(b,{key:`${Q.value?.key}:${Fe.value.epoch}:${e.seqStart}`},[t(Vi,{entry:e.row,final:e.seqStart!==Cn.value||ln.value,"data-seq-start":e.seqStart},null,8,[`entry`,`final`,`data-seq-start`]),un.value.get(e.seqStart)?(i(),R(`div`,fp,[un.value.get(e.seqStart).messages.length?(i(),R(`button`,{key:0,type:`button`,class:`turn-item turn-copy`,"aria-label":pn.value===e.seqStart?`Copied`:`Copy turn`,title:pn.value===e.seqStart?`Copied`:`Copy turn`,onClick:t=>hn(e.seqStart,un.value.get(e.seqStart).messages)},[t(J,{name:pn.value===e.seqStart?`check`:`copy`,size:14},null,8,[`name`]),d(k(pn.value===e.seqStart?`Copied`:`Copy`),1)],8,pp)):F(``,!0),ft.value&&e.row.value.provider===Q.value.provider?(i(),R(`span`,{key:1,class:`turn-item`,title:`Model: `+ft.value},[t(Gl,{provider:e.row.value.provider},null,8,[`provider`]),d(k(ft.value),1)],8,mp)):F(``,!0),x(`span`,{class:`turn-item`,title:`Finished `+un.value.get(e.seqStart).at},[t(J,{name:`clock`,size:14}),d(k(un.value.get(e.seqStart).at),1)],8,hp),un.value.get(e.seqStart).took?(i(),R(`span`,{key:2,class:`turn-item`,title:`Worked for `+un.value.get(e.seqStart).took},[t(J,{name:`hourglass`,size:14}),d(k(un.value.get(e.seqStart).took),1)],8,gp)):F(``,!0)])):F(``,!0)],64))),128)),Le.value?(i(),R(`div`,_p,[Be.value===`after`?(i(),R(`span`,vp,[...n[90]||=[x(`span`,{class:`spinner`},null,-1),d(`Loading newer messages…`,-1)]])):(i(),R(`button`,{key:1,class:`btn btn-ghost`,onClick:qr},`Back to latest`))])):F(``,!0),Qt.value?(i(),R(`div`,yp,[x(`span`,{class:`spinner spinner-ticked`,style:g(tn.value?{transform:`rotate(${nn.value*90}deg)`}:void 0)},null,4),tn.value?(i(),R(`span`,bp,k(tn.value),1)):(i(),R(`span`,xp,`Working…`))])):F(``,!0),sn.value.length?F(``,!0):(i(),R(`div`,Sp,[Fe.value.ready?F(``,!0):(i(),R(`span`,Cp)),d(` `+k(Fe.value.ready?`No messages yet.`:`Loading conversation…`),1)]))])],512),ii.value.length>=2&&D($r)?(i(),m(vn,{key:0,prompts:ii.value,"active-seq":ai.value,onJump:li},null,8,[`prompts`,`active-seq`])):F(``,!0)],512),[[T,!ie.value&&!K.value]]),a(x(`div`,wp,[x(`div`,Tp,[(i(!0),R(b,null,z(Q.value.pendingPermissions,e=>(i(),m(_o,{key:Q.value.key+`:`+e.id,permission:e,busy:Y.value,onRespond:t=>bi(e,t)},null,8,[`permission`,`busy`,`onRespond`]))),128)),jt.value?(i(),R(`p`,Ep,k(jt.value),1)):F(``,!0),D(Z).warning.value?(i(),R(`p`,Dp,k(D(Z).warning.value),1)):F(``,!0),vt.value?(i(),R(`p`,Op,[t(J,{name:`alert`,size:13}),d(k(vt.value)+` `,1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[43]||=e=>vt.value=``},[t(J,{name:`close`,size:12})])])):F(``,!0),kt.value.length?(i(),R(`details`,kp,[x(`summary`,null,`Other saved drafts (`+k(kt.value.length)+`)`,1),(i(!0),R(b,null,z(kt.value,e=>(i(),R(`div`,{key:e.slot},[x(`p`,Ap,k(e.text),1),x(`button`,{class:`btn btn-ghost`,onClick:t=>X.value&&D(Z).restore(X.value,e.slot)},`Restore draft`,8,jp)]))),128))])):F(``,!0),Ot.value&&!Y.value?(i(),R(`div`,Mp,[t(J,{name:`alert`,size:15}),x(`span`,Np,`Delivery unknown. Check the conversation before sending again. Message: `+k(Ot.value.text)+` `+k(Ot.value.attachmentNames?.join(`, `)),1),x(`button`,{class:`btn btn-ghost`,disabled:At.value,onClick:Mt},k(At.value?`Checking…`:`Check delivery`),9,Pp),x(`button`,{class:`btn btn-ghost`,onClick:Pt},`I checked`)])):F(``,!0),$e.value.length?(i(),R(`div`,Fp,[(i(!0),R(b,null,z($e.value,e=>(i(),R(`div`,{key:e.id,class:M([`queue-item`,{"is-error":e.error}]),role:`listitem`},[t(J,{name:e.error?`alert`:`clock`,size:14,class:`queue-icon`},null,8,[`name`]),x(`div`,Ip,[tt.value===e.id?(i(),R(b,{key:0},[a(x(`textarea`,{"onUpdate:modelValue":n[44]||=e=>nt.value=e,"aria-label":`Queued message text`,rows:`3`},null,512),[[_,nt.value]]),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:Y.value,onClick:t=>_i(e)},`Save`,8,Lp),x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:n[45]||=e=>tt.value=null},`Cancel`)],64)):(i(),R(`span`,{key:1,class:`queue-text`,title:e.text},k(e.text||`(attachments only)`),9,Rp)),e.attachmentNames.length?(i(),R(`span`,zp,k(e.attachmentNames.join(`, `)),1)):F(``,!0),x(`span`,Bp,k(e.sending?`Sending…`:e.error?`Delivery unknown · queue paused`:e.paused?`Paused`:Lt.value.get(Q.value.hostId)===`connected`?`Waiting for turn to finish`:`Waiting for host`),1),e.error?(i(),R(`span`,Vp,k(e.error),1)):F(``,!0)]),x(`button`,{class:`btn btn-ghost`,disabled:Y.value||e.sending,onClick:t=>ct(e,e.paused?`resume`:`pause`)},k(e.paused?`Resume`:`Pause`),9,Hp),x(`button`,{class:`btn btn-ghost`,disabled:Y.value||e.sending||$e.value[0].id===e.id,onClick:t=>ct(e,`up`),"aria-label":`Move queued message up`},`↑`,8,Up),e.error?(i(),R(`button`,{key:0,class:`btn btn-ghost`,disabled:Y.value,onClick:t=>ct(e,`check`)},`Check delivery`,8,Wp)):F(``,!0),x(`button`,{type:`button`,class:`queue-send`,disabled:Y.value||!!Ot.value||e.sending,title:Yt.value?`Send now: stops the running turn`:`Send now`,onClick:t=>vi(e)},k(Yt.value?`Interrupt`:`Send`),9,Gp),x(`button`,{type:`button`,class:`icon-btn`,disabled:Y.value||e.sending,"aria-label":`Edit queued message`,title:`Edit`,onClick:t=>{tt.value=e.id,nt.value=e.text}},[t(J,{name:`edit`,size:14})],8,Kp),x(`button`,{type:`button`,class:`icon-btn`,disabled:Y.value||e.sending,"aria-label":`Remove queued message`,title:`Remove`,onClick:t=>gi(e)},[t(J,{name:`close`,size:14})],8,qp)],2))),128))])):F(``,!0),x(`form`,{class:M([`composer`,{"is-dragging":Ct.value}]),onSubmit:v(fi,[`prevent`]),onDragover:n[50]||=v(e=>Ct.value=!0,[`prevent`]),onDragleave:wt,onDrop:n[51]||=v(e=>{Ct.value=!1,ut.value?.addFiles(e.dataTransfer?.files)},[`prevent`]),onPaste:Et},[t(Ja,{ref_key:`attachmentPanel`,ref:ut,store:D(Qe),"agent-key":Q.value.key,base:`/api`+Nn(Q.value),busy:Y.value||!!Ot.value},null,8,[`store`,`agent-key`,`base`,`busy`]),ht.value?(i(),R(`div`,{key:0,ref_key:`dictationPreviewElement`,ref:gt,class:`dictation-preview`,role:`status`,"aria-live":`polite`},k(ht.value),513)):F(``,!0),a(x(`textarea`,{ref_key:`composerElement`,ref:He,"onUpdate:modelValue":n[46]||=e=>Dt.value=e,rows:`1`,placeholder:Hr.value,required:!pt.value.length,onInput:ui,onKeydown:di},null,40,Jp),[[_,Dt.value]]),x(`div`,Yp,[x(`button`,{type:`button`,class:`composer-tool`,"aria-label":`Attach files`,title:ut.value?.hint,disabled:Y.value||!!Ot.value||!ut.value?.available,onClick:n[47]||=e=>ut.value?.pick()},[t(J,{name:`plus`,size:18})],8,Xp),t(vu,{ref_key:`agentControls`,ref:dt,agent:Q.value,path:Nn(Q.value),api:$,disabled:Y.value||Lt.value.get(Q.value.hostId)!==`connected`,onNotice:bt},null,8,[`agent`,`path`,`disabled`]),x(`div`,Zp,[Yt.value?(i(),R(`label`,{key:0,class:M([`chip-behavior`,`is-`+qe.value]),title:qe.value===`queue`?`Queue: send when the current turn ends`:qe.value===`steer`?`Steer: send instructions into the current turn; Paseo may interrupt if steering is unavailable`:`Interrupt: stop the current turn and start a new one`},[x(`span`,null,k(qe.value===`queue`?`Queue`:qe.value===`steer`?`Steer`:`Interrupt`),1),t(J,{name:`chevron`,size:11,class:`behavior-caret`}),a(x(`select`,{"onUpdate:modelValue":n[48]||=e=>qe.value=e,"aria-label":`Message delivery mode`},[n[91]||=x(`option`,{value:`queue`},`Queue`,-1),Xt.value.includes(`steer`)?(i(),R(`option`,$p,`Steer`)):F(``,!0),n[92]||=x(`option`,{value:`interrupt`},`Interrupt`,-1)],512),[[N,qe.value]])],10,Qp)):F(``,!0),mt.value?(i(),m(Td,{key:Q.value.key,disabled:Y.value,onText:xt,onPreview:n[49]||=e=>ht.value=e,onNotice:bt},null,8,[`disabled`])):F(``,!0),Yt.value?(i(),R(`button`,{key:2,type:`button`,class:M([`disc disc-stop`,{"is-primary":!St.value}]),"aria-label":`Stop turn`,title:`Stop turn`,disabled:Y.value,onClick:yi},[t(J,{name:`stop`,size:18})],10,em)):F(``,!0),!Yt.value||St.value?(i(),R(`button`,{key:3,class:`disc disc-send`,"aria-label":`Send`,title:`Send (Enter) · Shift+Enter for a new line`,disabled:Y.value||!!Ot.value||!Tt.value||!St.value},[t(J,{name:`send`,size:17})],8,tm)):F(``,!0)])])],34)])],512),[[T,!ie.value&&!K.value]])]),H.value?(i(),R(`aside`,nm,[x(`div`,{class:`panel-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize panel`,tabindex:`0`,onPointerdown:de,onDblclick:n[52]||=e=>ue(um)},null,32),x(`div`,rm,[x(`button`,{class:M({chosen:H.value===`files`}),onClick:n[53]||=e=>H.value=`files`},[t(J,{name:`folder`,size:14}),n[93]||=d(`Files`,-1)],2),x(`button`,{class:M({chosen:H.value===`changes`}),onClick:n[54]||=e=>H.value=`changes`},`Changes`,2),x(`button`,{class:M({chosen:H.value===`search`}),onClick:n[55]||=e=>H.value=`search`},`Search`,2),n[94]||=x(`span`,{class:`grow`},null,-1),x(`button`,{class:`icon-btn`,"aria-label":`Close panel`,title:`Close panel`,onClick:n[56]||=e=>H.value=null},[t(J,{name:`close`,size:14})])]),x(`div`,im,[H.value===`changes`?(i(),m(D(c),{key:0,"host-id":Q.value.hostId,cwd:qt.value,api:$},null,8,[`host-id`,`cwd`])):F(``,!0),H.value===`search`?(i(),m(D(f),{key:1,base:Nn(Q.value),api:$,onJump:lt},null,8,[`base`])):F(``,!0),(i(),m(A,null,[H.value===`files`?(i(),m(D(p),{key:`f:`+Q.value.hostId+qt.value,"host-id":Q.value.hostId,cwd:qt.value,api:$,"active-path":ie.value,onOpen:ae},null,8,[`host-id`,`cwd`,`active-path`])):F(``,!0)],1024))])])):F(``,!0)],4)):Je.value===`chat`&&lr.value?(i(),R(`section`,am,[...n[95]||=[x(`span`,{class:`spinner`},null,-1),x(`p`,null,`Starting session…`,-1)]])):(i(),R(`section`,om,[x(`div`,sm,[t(J,{name:`chat`,size:26})]),x(`h2`,null,k(Ht.value?`Pick a session`:`Connect your first host`),1),x(`p`,null,k(Ht.value?Gt.value?`${Ut.value} sessions in ${Wt.value} projects on ${It.value.get(Gt.value)??`this host`}.`:`${Ht.value} sessions in ${Wt.value} projects across ${Oe.value.length} hosts.`:`Add a Paseo daemon and its agents show up here, live.`),1),Oe.value.length?(i(),R(`button`,{key:1,class:`btn btn-primary`,onClick:n[58]||=e=>sr()},[t(J,{name:`plus`,size:15}),n[96]||=d(`New session`,-1)])):(i(),R(`button`,{key:0,class:`btn btn-primary`,onClick:n[57]||=e=>zi(`hosts`)},`Add a host`))]))]),ur.value?(i(),m(ve,{key:0,thread:ur.value.thread,x:ur.value.x,y:ur.value.y,onClose:n[59]||=e=>ur.value=null,onRename:n[60]||=e=>dr.value=e,onPin:gr,onUnread:_r,onRead:vr,onArchive:yr},null,8,[`thread`,`x`,`y`])):F(``,!0),Er.value?(i(),m(Ae,{key:1,name:Er.value.project.name,pinned:xr(Er.value.project),onPin:n[61]||=e=>Tr(Er.value.project),host:It.value.get(Er.value.project.hostId)??`Unknown host`,x:Er.value.x,y:Er.value.y,onClose:n[62]||=e=>Er.value=null,onSettings:n[63]||=e=>Dr.value=Er.value.project,onRemove:n[64]||=e=>Ar(Er.value.project)},null,8,[`name`,`pinned`,`host`,`x`,`y`])):F(``,!0),Dr.value?(i(),m(rn,{key:2,"host-id":Dr.value.hostId,"host-label":It.value.get(Dr.value.hostId)??`Unknown host`,project:Or.value,"root-path":Dr.value.rootPath,"custom-icons":!!Oe.value.find(e=>e.id===Dr.value.hostId)?.customIcons,request:$,onClose:n[65]||=e=>Dr.value=null},null,8,[`host-id`,`host-label`,`project`,`root-path`,`custom-icons`])):F(``,!0),bn.value?(i(),m(Sn,{key:3,src:bn.value,onClose:n[66]||=e=>bn.value=null},null,8,[`src`])):F(``,!0),dr.value?(i(),m(De,{key:4,thread:dr.value,busy:Y.value,onClose:n[67]||=e=>dr.value=null,onSave:hr},null,8,[`thread`,`busy`])):F(``,!0),or.value?(i(),m(Fa,{key:5,hosts:Oe.value,"initial-host-id":or.value.hostId,"initial-cwd":or.value.cwd,"initial-project":or.value.project,request:$,onClose:n[68]||=e=>or.value=null,onCreated:cr},null,8,[`hosts`,`initial-host-id`,`initial-cwd`,`initial-project`])):F(``,!0)],6)):(i(),R(`div`,Ed,[we.value?(i(),R(`form`,{key:0,class:`login-card`,onSubmit:v(In,[`prevent`])},[x(`div`,Dd,[n[69]||=x(`img`,{class:`brand-mark`,src:`/icons/mark.svg`,alt:``,width:`22`,height:`22`},null,-1),d(k(xe.value),1)]),n[73]||=x(`p`,{class:`login-lede`},`All your Paseo hosts, one fast console.`,-1),x(`label`,Od,[n[70]||=x(`span`,null,`Server access token`,-1),a(x(`input`,{"onUpdate:modelValue":n[0]||=e=>Se.value=e,type:`password`,autocomplete:`off`,required:``,autofocus:``},null,512),[[_,Se.value]])]),n[74]||=x(`p`,{class:`hint`},[d(`Run `),x(`code`,null,`litepaseo token`),d(` on the server to print it.`)],-1),we.value.totp?(i(),R(b,{key:0},[x(`label`,kd,[n[71]||=x(`span`,null,`Authenticator code`,-1),a(x(`input`,{"onUpdate:modelValue":n[1]||=e=>Ce.value=e,class:`code-input`,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,pattern:`[0-9]{6}`,placeholder:`••••••`,required:``,onInput:Rn},null,544),[[_,Ce.value]])]),n[72]||=x(`p`,{class:`hint`},`Both your access token and a code from your authenticator app are required.`,-1)],64)):F(``,!0),x(`button`,{class:`btn btn-primary btn-block`,disabled:Y.value},k(Y.value?`Signing in…`:`Connect`),9,Ad),Ee.value?(i(),R(`p`,jd,k(Ee.value),1)):F(``,!0)],32)):F(``,!0)]))}});function hm(){let e=matchMedia(`(prefers-reduced-motion: reduce)`),t,n=!1,r=()=>Math.max(200,Number(getComputedStyle(document.documentElement).getPropertyValue(`--motion-step-ms`))||1e3),i=e=>e-performance.now()%e+10,a=()=>{clearTimeout(t),t=void 0},o=()=>{if(t=void 0,n||document.hidden||e.matches)return;let a=document.getAnimations().filter(e=>e instanceof CSSAnimation&&[`pulse`,`spin`].includes(e.animationName));if(!a.length)return;let s=r(),c=Math.floor(performance.now()/s)*s;for(let e of a)e.pause(),e.currentTime=c;t=setTimeout(o,i(s))},s=()=>{document.hidden||e.matches?a():!t&&!n&&(t=setTimeout(o,i(r())))},c=new MutationObserver(s);return c.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`,`style`,`hidden`,`open`]}),document.addEventListener(`visibilitychange`,s),window.addEventListener(`resize`,s),e.addEventListener(`change`,s),s(),()=>{n=!0,a(),c.disconnect(),document.removeEventListener(`visibilitychange`,s),window.removeEventListener(`resize`,s),e.removeEventListener(`change`,s)}}Co(),jo();var gm=j(mm);gm.mount(`#app`),gm.onUnmount(hm());export{Tn as a,Fr as i,Rr as n,xn as o,Ir as r,J as s,So as t};
|
|
Binary file
|
|
Binary file
|