litepaseo 0.4.2 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +4 -2
  3. package/dist/server/cli.mjs +2 -2
  4. package/dist/server/{worker-BxtQnBVZ.mjs → worker-Cig3TfcO.mjs} +436 -9
  5. package/dist/web/assets/{CodeBlockNode-Dg9n5ezc.js → CodeBlockNode-_x7pmRec.js} +1 -1
  6. package/dist/web/assets/CodeBlockNode-_x7pmRec.js.br +0 -0
  7. package/dist/web/assets/CodeBlockNode-_x7pmRec.js.gz +0 -0
  8. package/dist/web/assets/{FileViewer-BqAUo_AP.js → FileViewer-B3OHD2lY.js} +1 -1
  9. package/dist/web/assets/FileViewer-B3OHD2lY.js.br +0 -0
  10. package/dist/web/assets/FileViewer-B3OHD2lY.js.gz +0 -0
  11. package/dist/web/assets/{FilesPanel-Bl65Hz3k.js → FilesPanel-CXGp_iej.js} +1 -1
  12. package/dist/web/assets/FilesPanel-CXGp_iej.js.br +0 -0
  13. package/dist/web/assets/FilesPanel-CXGp_iej.js.gz +0 -0
  14. package/dist/web/assets/{MarkdownMessage-j-M1z3-u.js → MarkdownMessage-C1WAZAoK.js} +5 -5
  15. package/dist/web/assets/MarkdownMessage-C1WAZAoK.js.br +0 -0
  16. package/dist/web/assets/MarkdownMessage-C1WAZAoK.js.gz +0 -0
  17. package/dist/web/assets/{PreCodeBlock-B8fBuBdP.js → PreCodeBlock-B8ilPuwC.js} +1 -1
  18. package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-Cj9vGyzE.js → PreCodeBlock.vue_vue_type_style_index_0_lang-B9n3v4Td.js} +1 -1
  19. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-B9n3v4Td.js.br +0 -0
  20. package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-Cj9vGyzE.js.gz → PreCodeBlock.vue_vue_type_style_index_0_lang-B9n3v4Td.js.gz} +0 -0
  21. package/dist/web/assets/{TerminalPanel-ZkVJFLM1.js → TerminalPanel-CNNWUGNL.js} +1 -1
  22. package/dist/web/assets/TerminalPanel-CNNWUGNL.js.br +0 -0
  23. package/dist/web/assets/TerminalPanel-CNNWUGNL.js.gz +0 -0
  24. package/dist/web/assets/{Tooltip-Jdp8zjwT.js → Tooltip-Bn4MxBG1.js} +1 -1
  25. package/dist/web/assets/Tooltip-Bn4MxBG1.js.br +0 -0
  26. package/dist/web/assets/Tooltip-Bn4MxBG1.js.gz +0 -0
  27. package/dist/web/assets/index-CqexjrEd.css +1 -0
  28. package/dist/web/assets/index-CqexjrEd.css.br +0 -0
  29. package/dist/web/assets/index-CqexjrEd.css.gz +0 -0
  30. package/dist/web/assets/index-zPMH5LDK.js +34 -0
  31. package/dist/web/assets/index-zPMH5LDK.js.br +0 -0
  32. package/dist/web/assets/index-zPMH5LDK.js.gz +0 -0
  33. package/dist/web/assets/{index10-EuskhiaE.js → index10-BQ3hctN9.js} +1 -1
  34. package/dist/web/assets/index10-BQ3hctN9.js.br +0 -0
  35. package/dist/web/assets/index10-BQ3hctN9.js.gz +0 -0
  36. package/dist/web/assets/index3-CDLJc42-.js +1 -0
  37. package/dist/web/assets/index4-CmlPafgi.js +1 -0
  38. package/dist/web/assets/{index5-CIMd5e5U.js → index5-Cn_neOEH.js} +1 -1
  39. package/dist/web/assets/index5-Cn_neOEH.js.br +0 -0
  40. package/dist/web/assets/index5-Cn_neOEH.js.gz +0 -0
  41. package/dist/web/assets/{index6-DrnWk0rr.js → index6-DyQA9KO0.js} +1 -1
  42. package/dist/web/assets/index6-DyQA9KO0.js.br +0 -0
  43. package/dist/web/assets/index6-DyQA9KO0.js.gz +0 -0
  44. package/dist/web/assets/{index7-BCl4u4Ci.js → index7-C1CcYWix.js} +1 -1
  45. package/dist/web/assets/index7-C1CcYWix.js.br +0 -0
  46. package/dist/web/assets/index7-C1CcYWix.js.gz +0 -0
  47. package/dist/web/assets/{index8-tfhmdpKZ.js → index8-B-qx9WIe.js} +1 -1
  48. package/dist/web/assets/index8-B-qx9WIe.js.br +0 -0
  49. package/dist/web/assets/index8-B-qx9WIe.js.gz +0 -0
  50. package/dist/web/assets/{index9-Co0BXJFT.js → index9-Bi0iPNSv.js} +1 -1
  51. package/dist/web/assets/index9-Bi0iPNSv.js.br +0 -0
  52. package/dist/web/assets/index9-Bi0iPNSv.js.gz +0 -0
  53. package/dist/web/index.html +2 -2
  54. package/dist/web/index.html.br +0 -0
  55. package/dist/web/index.html.gz +0 -0
  56. package/package.json +1 -1
  57. package/dist/web/assets/CodeBlockNode-Dg9n5ezc.js.br +0 -0
  58. package/dist/web/assets/CodeBlockNode-Dg9n5ezc.js.gz +0 -0
  59. package/dist/web/assets/FileViewer-BqAUo_AP.js.br +0 -0
  60. package/dist/web/assets/FileViewer-BqAUo_AP.js.gz +0 -0
  61. package/dist/web/assets/FilesPanel-Bl65Hz3k.js.br +0 -0
  62. package/dist/web/assets/FilesPanel-Bl65Hz3k.js.gz +0 -0
  63. package/dist/web/assets/MarkdownMessage-j-M1z3-u.js.br +0 -0
  64. package/dist/web/assets/MarkdownMessage-j-M1z3-u.js.gz +0 -0
  65. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-Cj9vGyzE.js.br +0 -0
  66. package/dist/web/assets/TerminalPanel-ZkVJFLM1.js.br +0 -0
  67. package/dist/web/assets/TerminalPanel-ZkVJFLM1.js.gz +0 -0
  68. package/dist/web/assets/Tooltip-Jdp8zjwT.js.br +0 -0
  69. package/dist/web/assets/Tooltip-Jdp8zjwT.js.gz +0 -0
  70. package/dist/web/assets/index-Cf1QB007.js +0 -32
  71. package/dist/web/assets/index-Cf1QB007.js.br +0 -0
  72. package/dist/web/assets/index-Cf1QB007.js.gz +0 -0
  73. package/dist/web/assets/index-Dzid_5f9.css +0 -1
  74. package/dist/web/assets/index-Dzid_5f9.css.br +0 -0
  75. package/dist/web/assets/index-Dzid_5f9.css.gz +0 -0
  76. package/dist/web/assets/index10-EuskhiaE.js.br +0 -0
  77. package/dist/web/assets/index10-EuskhiaE.js.gz +0 -0
  78. package/dist/web/assets/index3-bqHD_tAN.js +0 -1
  79. package/dist/web/assets/index4-CnpLIN0Y.js +0 -1
  80. package/dist/web/assets/index5-CIMd5e5U.js.br +0 -0
  81. package/dist/web/assets/index5-CIMd5e5U.js.gz +0 -0
  82. package/dist/web/assets/index6-DrnWk0rr.js.br +0 -0
  83. package/dist/web/assets/index6-DrnWk0rr.js.gz +0 -0
  84. package/dist/web/assets/index7-BCl4u4Ci.js.br +0 -0
  85. package/dist/web/assets/index7-BCl4u4Ci.js.gz +0 -0
  86. package/dist/web/assets/index8-tfhmdpKZ.js.br +0 -0
  87. package/dist/web/assets/index8-tfhmdpKZ.js.gz +0 -0
  88. package/dist/web/assets/index9-Co0BXJFT.js.br +0 -0
  89. package/dist/web/assets/index9-Co0BXJFT.js.gz +0 -0
@@ -0,0 +1,34 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownMessage-C1WAZAoK.js","assets/vue.runtime.esm-bundler-DwGo9CTz.js","assets/rolldown-runtime-XKyaHtl9.js","assets/highlight-BnTrj1LT.js","assets/MarkdownMessage-bqphU8I9.css","assets/FilesPanel-CXGp_iej.js","assets/FilesPanel-CY9yMixJ.css","assets/FileViewer-B3OHD2lY.js","assets/FileViewer-T756VVq4.css","assets/TerminalPanel-CNNWUGNL.js","assets/TerminalPanel-mJ-uVP4H.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)}})();var B=e=>e?e.size:0,V=e=>(e.size=1+B(e.left)+B(e.right),e),H=class{root=null;compare;constructor(e){this.compare=e}get size(){return B(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=B(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+=B(t.left)+1,t=t.right;else return n+B(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=B(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,[V(e),i]}let[i,a]=this.split(e.left,t,n);return e.left=a,[i,V(e)]}merge(e,t){return e?t?e.priority>t.priority?(e.right=this.merge(e.right,t),V(e)):(t.left=this.merge(e,t.left),V(t)):e:t}},ee=e=>e?e.size:0,te=e=>e?e.sum:0,ne=e=>(e.size=1+ee(e.left)+ee(e.right),e.sum=e.weight+te(e.left)+te(e.right),e),U=class{root=null;compare;constructor(e){this.compare=e}get size(){return ee(this.root)}get total(){return te(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=ee(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=te(t.left);if(e<i)t=t.left;else if(e<i+t.weight||!t.right)return{item:t.item,rank:n+ee(t.left),start:r+i};else e-=i+t.weight,r+=i+t.weight,n+=ee(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+=te(t.left)+t.weight,t=t.right;else return n+te(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,[ne(e),i]}let[i,a]=this.split(e.left,t,n);return e.left=a,[i,ne(e)]}merge(e,t){return e?t?e.priority>t.priority?(e.right=this.merge(e.right,t),ne(e)):(t.left=this.merge(e,t.left),ne(t)):e:t}},W=[`needs_input`,`running`,`review`,`done`],G=e=>e===`failed`||e===`unread`?`review`:e,re=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e,ie=typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches?44:36,K=(e,t)=>e.key<t.key?-1:+(e.key>t.key);function q(e,t){return t.activityAt-e.activityAt||K(e,t)}function ae(e,t){let n=e.pinnedAt??0,r=t.pinnedAt??0;return n||r?n?r?n-r||K(e,t):-1:1:q(e,t)}function oe(e){return e.attention?`needs_input`:e.failed?`failed`:e.running?`running`:e.unread?`unread`:`done`}var se=e=>`${e.hostId}\n${e.project.toLowerCase()}`,ce=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),le=(e,t)=>t.recent-e.recent||ce.compare(e.name,t.name)||(e.key<t.key?-1:+(e.key>t.key)),ue=e=>e.state??(e.status===`running`?`running`:`done`),de=class{flat;groups=new Map;index=new U(le);lanes;waiting=0;compare;isCollapsed;constructor(e,t){this.compare=e,this.isCollapsed=t,this.flat=new H(e),this.lanes=new Map(W.map(e=>[e,new H(q)]))}get size(){return this.flat.size}weight(e){return 36+(this.isCollapsed(e.key)?0:e.items.size*ie)}add(e){this.flat.insert(e),this.lanes.get(G(ue(e))).insert(e);let t=se(e),n=this.groups.get(t);n?this.index.remove(n):(n={key:t,name:e.project,items:new H(this.compare),byRecency:this.compare===q?null:new H(q),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(G(ue(e))).remove(e);let t=this.groups.get(se(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)/ie)),s=Math.min(t.items.size,Math.ceil((r-i)/ie));s>a&&t.items.range(a,s-a).forEach((e,t)=>n.push({kind:`item`,key:e.key,top:i+(a+t)*ie,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=(e.hosts.get(t.hostId)??0)+n;r>0?e.hosts.set(t.hostId,r):e.hosts.delete(t.hostId),t.attention&&(e.attention+=n,this.waiting+=n);let i=ue(t);i===`failed`?e.failed+=n:i===`running`?e.running+=n:i===`unread`&&(e.unread+=n)}},fe=class{generation=``;seq=-1;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??q,this.indexOf=e.indexBy??null,this.all=new de(this.compare,this.collapsedFn)}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 de(this.compare,this.collapsedFn)),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 de(this.compare,()=>!1),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 H(q)),n.insert(e)}}},pe=[`width`,`height`],me=[`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,me)],8,pe))}}),he=[`aria-label`],ge={class:`menu-title`},_e=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`,ge,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,he))}}),ve={class:`sheet-head`},ye={class:`sheet-body`},be={class:`field`},Y=[`placeholder`],xe={class:`row-sub`},Se={class:`sheet-foot`},Ce=[`disabled`],we=[`disabled`],Te=[`disabled`],Ee=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`,ve,[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`,ye,[x(`label`,be,[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,Y),[[_,l.value]])]),x(`p`,xe,k(n.thread.project)+k(n.thread.branch?` · `+n.thread.branch:``),1)]),x(`footer`,Se,[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,Ce)):F(``,!0),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:n.busy,onClick:r[3]||=e=>s(`close`)},`Cancel`,8,we),x(`button`,{class:`btn btn-primary`,disabled:n.busy||!l.value.trim()},`Save`,8,Te)])],32)],32))}}),De=[`aria-label`],X={class:`menu-title`},Oe=f({__name:`ProjectMenu`,props:{name:{},host:{},x:{},y:{}},emits:[`close`,`settings`,`remove`],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`:`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`,X,k(n.name)+` · `+k(n.host),1),x(`button`,{role:`menuitem`,onClick:r[0]||=e=>f(`settings`)},[t(J,{name:`sliders`,size:14}),r[2]||=d(`Project settings…`,-1)]),r[4]||=x(`div`,{class:`menu-sep`},null,-1),x(`button`,{role:`menuitem`,class:`menu-danger`,onClick:r[1]||=e=>f(`remove`)},[t(J,{name:`trash`,size:14}),r[3]||=d(`Remove project…`,-1)])],12,De))}}),ke=[`src`],Ae=e(new Set),je=[`#4f7cc2`,`#5a9e6f`,`#c27a4f`,`#9a6fc2`,`#c25a7a`,`#4fa7b0`,`#b09a3f`],Me=e=>{let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return je[t%je.length]},Ne=e=>(Array.from(e.trim())[0]??`?`).toUpperCase();function Pe(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 Fe=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?Pe(t.source):null;return e&&!Ae.value.has(e)?e:null});function r(){let e=n.value;e&&t.src===void 0&&!Ae.value.has(e)&&(Ae.value=new Set(Ae.value).add(e))}return(t,a)=>(i(),R(`span`,{class:`group-icon`,style:g({...n.value?{}:{background:Me(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,ke)):(i(),R(b,{key:1},[d(k(Ne(e.name)),1)],64))],4))}}),Ie=[`onKeydown`],Le={class:`sheet-head`},Re={class:`sheet-body`},ze={class:`field`},Be=[`value`,`placeholder`,`disabled`],Ve={key:0,class:`ps-field-error`,role:`alert`},He={key:1,class:`field`},Ue={class:`pe-icon-row`},We=[`disabled`],Ge=[`disabled`],Z=[`value`,`disabled`],Ke={key:0,class:`pe-hint`},qe={key:1,class:`ps-field-error pe-icon-error`,role:`alert`},Je={class:`sheet-foot`},Ye=[`disabled`],Xe=[`disabled`],Ze=524288,Qe=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>Ze){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`,Le,[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`,Re,[x(`label`,ze,[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,Be)]),f.value?.scope===`name`?(i(),R(`p`,Ve,k(f.value.message),1)):F(``,!0),n.customIcons?(i(),R(`div`,He,[r[4]||=x(`span`,null,`Icon`,-1),x(`div`,Ue,[t(Fe,{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,We),b.value?(i(),R(`button`,{key:0,type:`button`,class:`btn btn-ghost`,disabled:p.value,onClick:j},`Use automatic`,8,Ge)):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,Z),d.value===`upload`&&u.value?(i(),R(`p`,Ke,k(u.value.fileName),1)):F(``,!0),f.value?.scope===`icon`?(i(),R(`p`,qe,k(f.value.message),1)):F(``,!0)])):F(``,!0)]),x(`footer`,Je,[x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:p.value,onClick:N},`Cancel`,8,Ye),x(`button`,{class:`btn btn-primary`,disabled:!w.value},k(p.value?`Saving…`:`Save changes`),9,Xe)])],32)],40,Ie))}}),$e=[`branchName`,`commitMessage`,`pullRequest`],et=`service`,tt=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function nt(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 rt(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 it(e){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`?e:``}function at(e){let t=e.trim();if(t)return/^[0-9]+$/.test(t)?Number(t):t}var ot=0,st=()=>`script-${++ot}`;function ct(e){let t=tt(e?.worktree)?e.worktree:{},n=nt(t.setup),r=nt(t.teardown),i=Object.entries(tt(e?.scripts)?e.scripts:{}).map(([e,t])=>{let n=tt(t)?t:{},r=nt(n.command);return{id:st(),name:e,commandText:r.text,commandKind:r.kind,type:typeof n.type==`string`?n.type:``,portText:it(n.port),raw:n}}),a=tt(e?.metadataGeneration)?e.metadataGeneration:void 0,o={branchName:``,commitMessage:``,pullRequest:``};for(let e of $e){let t=a?.[e];tt(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 lt=(e,t,n)=>{n===void 0?delete e[t]:e[t]=n};function ut(e,t){let n={...t??{}},r={...tt(n.worktree)?n.worktree:{}};lt(r,`setup`,rt(e.setupText,e.setupKind)),lt(r,`teardown`,rt(e.teardownText,e.teardownKind));let i={};for(let t of e.scripts){let e=t.name.trim();if(!e)continue;let n={...t.raw};lt(n,`command`,rt(t.commandText,t.commandKind)),lt(n,`type`,t.type.trim()||void 0),lt(n,`port`,at(t.portText)),i[e]=n}let a={...e.metadataBase??{}};for(let t of $e){let n=e.prompts[t],r={...tt(e.metadataBase?.[t])?e.metadataBase[t]:{}};n.trim()?r.instructions=n:delete r.instructions,lt(a,t,Object.keys(r).length?r:void 0)}return lt(n,`worktree`,Object.keys(r).length?r:void 0),lt(n,`scripts`,Object.keys(i).length?i:void 0),lt(n,`metadataGeneration`,Object.keys(a).length?a:void 0),n}function dt(e){return{name:e.name.trim()?``:`Name is required`,command:e.commandText.trim()?``:`Command is required`}}var ft=e=>{let t=dt(e);return!t.name&&!t.command};function pt(e){return[e.type,e.portText&&`port ${e.portText}`,e.commandText.split(`
6
+ `)[0]].filter(Boolean).join(` · `)}var mt={class:`sheet-head`},ht={class:`ps-title`},gt={class:`ps-title-row`},_t={class:`path-hint`},vt={key:0,class:`sheet-note`},yt={key:1,class:`ps-callout is-error`,role:`alert`},bt={class:`ps-group`,"aria-labelledby":`ps-worktree`},xt={class:`ps-section`},St={key:0,class:`ps-callout is-warn`},Ct={class:`ps-section`},wt={class:`ps-group`,"aria-labelledby":`ps-scripts`},Tt={class:`ps-group-head`},Et={class:`card ps-scripts`},Dt={key:0,class:`card-row row-sub`},Ot=[`onClick`],Q={class:`row-title`},kt={class:`row-sub`},At={class:`ps-script-more`},jt=[`aria-label`,`onClick`],Mt=[`onClick`],Nt=[`onClick`],Pt={class:`ps-group`,"aria-labelledby":`ps-metadata`},Ft={class:`ps-section-head`},It=[`for`],Lt=[`id`,`onUpdate:modelValue`,`placeholder`],Rt={key:0,class:`ps-callout is-error`,role:`alert`},zt={key:1,class:`ps-callout is-error`,role:`alert`},Bt={class:`sheet-foot`},Vt={key:0,class:`sheet-note sheet-reset ps-saved`},Ht={key:1,class:`sheet-note sheet-reset ps-saved`},Ut=[`disabled`],Wt=[`disabled`],Gt=[`onKeydown`],Kt=[`aria-label`],qt={class:`sheet-head`},Jt={class:`sheet-body`},Yt={class:`field`},Xt={key:0,class:`ps-field-error`},Zt={class:`field`},Qt={key:1,class:`ps-field-error`},$t={class:`switch-row ps-service`},en=[`checked`],tn=`https://paseo.sh/docs/worktrees`,nn=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(ct(null)),j=e(``),N=S(()=>`/hosts/${encodeURIComponent(s.hostId)}/project-config`),I=e=>e.replace(/^\/(home|Users)\/[^/]+(?=\/|$)/,`~`),L=S(()=>JSON.stringify(ut(A.value,O.value?.config))),B=S(()=>!!O.value&&L.value!==j.value),V=S(()=>A.value.scripts.some(e=>!ft(e))),H=S(()=>y.value?.code===`stale_project_config`);n(L,()=>w.value=E.value=!1);function ee(e){O.value=e,A.value=ct(e.config),j.value=JSON.stringify(ut(A.value,e.config))}async function te(){p.value=!0,g.value=``,y.value=null;try{ee(await s.request(`${N.value}?root=${encodeURIComponent(s.rootPath)}`))}catch(e){g.value=String(e.message)}finally{p.value=!1}}async function ne(){if(!(!O.value||h.value||H.value||V.value)){h.value=!0,y.value=null;try{ee(await s.request(N.value,`PUT`,{root:O.value.rootPath,config:ut(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 U(){if(!h.value){if(T.value)return void(T.value=!1);if(W.value)return se();(!B.value||confirm(`Discard your unsaved project settings?`))&&l(`close`)}}let W=e(null),G=u({name:!1,command:!1}),re=e(null),ie=e(null),K=S(()=>{let e=W.value;if(!e)return{name:``,command:``};let t=dt(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}),q=null;function ae(e){re.value=null,W.value=e,q={name:e.name,commandText:e.commandText,type:e.type},G.name=G.command=!1,C(()=>ie.value?.focus())}function oe(){let e={id:st(),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=W.value;e&&q&&Object.assign(e,q),!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)),W.value=null}function ce(){K.value.name||K.value.command?G.name=G.command=!0:W.value=null}function le(e){re.value=null,confirm(`Remove ${e.name||`this script`}?`)&&(A.value.scripts=A.value.scripts.filter(t=>t.id!==e.id))}function ue(e){W.value&&(W.value.type=e.target.checked?et:``)}function de(e){(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),!W.value&&!T.value&&ne())}return c(te),(e,n)=>(i(),R(`div`,{class:`overlay`,onMousedown:v(U,[`self`]),onKeydown:[P(U,[`esc`]),de]},[x(`form`,{class:`sheet project-settings`,role:`dialog`,"aria-modal":`true`,"aria-label":`Project settings`,onSubmit:v(ne,[`prevent`])},[x(`header`,mt,[x(`div`,ht,[x(`div`,gt,[t(Fe,{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`,_t,[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:U},[t(J,{name:`close`,size:16})])]),x(`div`,{class:`sheet-body ps-body`,onClick:n[4]||=e=>re.value=null},[p.value?(i(),R(`p`,vt,[...n[11]||=[x(`span`,{class:`spinner`},null,-1),d(` Reading paseo.json…`,-1)]])):g.value?(i(),R(`div`,yt,[x(`p`,null,[t(J,{name:`alert`,size:14}),d(k(g.value),1)]),x(`button`,{type:`button`,class:`btn btn-outline`,onClick:te},`Reload`)])):(i(),R(b,{key:2},[x(`section`,bt,[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`,xt,[x(`div`,{class:`ps-section-head`},[n[12]||=x(`label`,{for:`ps-setup`},`Setup`,-1),x(`a`,{href:tn,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`,St,[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`,Ct,[x(`div`,{class:`ps-section-head`},[n[15]||=x(`label`,{for:`ps-teardown`},`Teardown`,-1),x(`a`,{href:tn,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`,wt,[x(`div`,Tt,[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`,Et,[A.value.scripts.length?F(``,!0):(i(),R(`div`,Dt,`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(ft)(e)}])},[x(`button`,{type:`button`,class:`ps-script-main`,onClick:t=>ae(e)},[x(`span`,Q,k(e.name||`Untitled script`),1),x(`span`,kt,k(D(pt)(e)||`No command`),1)],8,Ot),x(`div`,At,[x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Open script menu for `+(e.name||`untitled script`),onClick:v(t=>re.value=re.value===e.id?null:e.id,[`stop`])},[t(J,{name:`more-v`,size:15})],8,jt),re.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,Mt),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,Nt)])):F(``,!0)])],2))),128))])]),x(`section`,Pt,[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($e),e=>(i(),R(`div`,{key:e,class:`ps-section`},[x(`div`,Ft,[x(`label`,{for:`ps-prompt-`+e},k(f[e].title),9,It)]),a(x(`textarea`,{id:`ps-prompt-`+e,"onUpdate:modelValue":t=>A.value.prompts[e]=t,placeholder:f[e].placeholder},null,8,Lt),[[_,A.value.prompts[e]]])]))),128))]),H.value?(i(),R(`div`,Rt,[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:te},`Reload`)])):y.value?(i(),R(`div`,zt,[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:ne},`Try again`),x(`button`,{type:`button`,class:`btn btn-outline`,onClick:te},`Reload`)])])):F(``,!0)],64))]),x(`footer`,Bt,[E.value&&!w.value?(i(),R(`span`,Vt,[t(J,{name:`check`,size:14}),n[26]||=d(`Project updated`,-1)])):F(``,!0),w.value&&!B.value?(i(),R(`span`,Ht,[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:U},k(B.value?`Cancel`:`Close`),9,Ut),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,Wt)])],32),T.value?(i(),m(Qe,{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),W.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":W.value.name?`Edit `+W.value.name:`New script`,onSubmit:v(ce,[`prevent`])},[x(`header`,qt,[x(`h2`,null,k(W.value.name.trim()?`Edit `+W.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`,Jt,[x(`label`,Yt,[n[28]||=x(`span`,null,`Name`,-1),a(x(`input`,{ref_key:`nameInput`,ref:ie,"onUpdate:modelValue":n[7]||=e=>W.value.name=e,placeholder:`dev`,spellcheck:`false`,autocapitalize:`off`,"aria-label":`Script name`,onBlur:n[8]||=e=>G.name=!0},null,544),[[_,W.value.name]])]),G.name&&K.value.name?(i(),R(`p`,Xt,k(K.value.name),1)):F(``,!0),x(`label`,Zt,[n[29]||=x(`span`,null,`Command`,-1),a(x(`textarea`,{"onUpdate:modelValue":n[9]||=e=>W.value.commandText=e,class:`ps-code`,placeholder:`npm run dev`,spellcheck:`false`,"aria-label":`Script command`,onBlur:n[10]||=e=>G.command=!0},null,544),[[_,W.value.commandText]])]),G.command&&K.value.command?(i(),R(`p`,Qt,k(K.value.command),1)):F(``,!0),x(`label`,$t,[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:W.value.type===D(et),"aria-label":`Run as a service`,onChange:ue},null,40,en)])]),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,Kt)],40,Gt)):F(``,!0)],32))}}),rn=`litepaseo-composer-v1:`,an=rn+`draft:`,on=rn+`message:`,sn=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`${an}${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(rn)&&t.push([r,e.getItem(r)])}return t},[]),n=[];for(let[r,i]of t){let t=r.startsWith(an)?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(an)){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(on)){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(rn)&&(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(`${an}${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(on+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(on+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(rn)&&t.push(r)}for(let n of t)e.removeItem(n);return!0},!1),this.drafts.clear(),this.pending.clear(),this.revision.value++}},cn=3e3,ln=2500,un=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>cn&&(this.rows=this.rows.slice(this.rows.length-ln),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 dn(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 fn=[`onPointerenter`],pn=[`aria-label`,`aria-current`,`onClick`],mn={key:0,class:`outline-preview`,"aria-hidden":`true`},$=150,hn=3,gn=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},$))}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>=hn?0:(1+Math.cos(Math.PI*t/hn))/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,pn),c.value&&n===o.value?(i(),R(`div`,mn,k(e.preview||`(no text)`),1)):F(``,!0)],40,fn))),128))],32))}}),_n=1e3,vn=3e4;function yn(e){let t=!1,n=null,r,i=_n,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=_n,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,vn)},s=()=>{document.hidden?(n?.abort(),clearTimeout(r),a(`paused`)):(i=_n,o())};return document.addEventListener(`visibilitychange`,s),o(),{close(){t=!0,clearTimeout(r),document.removeEventListener(`visibilitychange`,s),n?.abort()}}}var bn=Symbol(`litepaseo-timeline`),xn=e=>typeof e==`string`&&e.length>0?e:void 0;function Sn(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 Cn=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 wn(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 Tn=[[/^(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`]],En=e=>{let t=wn(e);return Tn.find(([e])=>e.test(t))?.[1]??`terminal`};function Dn(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 On=e=>{let t=typeof e==`string`?e:``;return t?t.split(`
11
+ `).length-+!!t.endsWith(`
12
+ `):0},kn=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function An(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 jn(e,t){let n=e.detail??{},r=n.type===`unknown`&&n.input&&typeof n.input==`object`?n.input:{},i=e=>Sn(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`,En(e),`Run`,Dn(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,An(Pn(e)));case`write`:return o(`write`,`edit`,`Write`,i(n.filePath),!1,n.content?kn(On(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`,xn(n.subAgentType)??`Task`,xn(n.description)??``,!0);case`worktree_setup`:return o(`worktree`,`branch`,`Worktree setup`,String(n.branchName??``),!0);case`plain_text`:return o(`plain`,`tool`,Cn(a),xn(n.label)??``,!0);case`plan`:return o(`plan`,`list`,`Plan`,``,!0)}let c=a.toLowerCase(),l=xn(r.path)??xn(r.file_path)??xn(r.filePath),u=xn(r.command)??xn(r.cmd)??l??xn(r.pattern)??xn(r.query)??xn(r.url)??xn(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,An(Pn(e))):/^write/.test(c)?o(`write`,`edit`,`Write`,i(u),!1,r.content?kn(On(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`,Cn(a),u,!0)}function Mn(e){return(e.split(`
15
+ `).map(e=>e.trim()).find(Boolean)??``).replace(/^#+\s*/,``).replace(/\*\*|__|`/g,``).slice(0,300)}function Nn(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 Pn(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 xn(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 Fn(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 In=e=>e.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}),Ln=e=>Math.floor((e.getTime()-e.getTimezoneOffset()*6e4)/864e5);function Rn(e,t=new Date){let n=In(e),r=Ln(t)-Ln(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 zn(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 Bn(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:Rn(new Date(t),n),took:Number.isFinite(a)&&t>=a?Fn(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 Vn=/!\[([^\]\n]*)\]\(\s*<?([^)\s>]+)>?(\s+"[^"]*")?\s*\)/g,Hn=/\.(png|jpe?g|webp|gif|bmp|avif)$/i;function Un(e,t){return e.includes(`![`)?e.replace(Vn,(e,n,r,i=``)=>{if(/^(https?:|data:|blob:)/i.test(r))return e;let a=r;if(/^file:\/\//i.test(a))try{a=decodeURIComponent(new URL(a).pathname)}catch{return e}return Hn.test(a)?`![${n}](${t}/image?path=${encodeURIComponent(a)}${i})`:e}):e}var Wn=[`aria-expanded`,`onClick`,`onContextmenu`],Gn={class:`group-lead`},Kn={class:`group-name`},qn=[`title`],Jn=[`title`],Yn={key:0,class:`group-flag is-attention`},Xn={key:1,class:`status-dot is-error`},Zn={key:2,class:`status-dot is-running`},Qn={key:3,class:`status-dot is-unread`},$n={key:1,class:`group-count`},er=[`aria-label`,`title`,`onClick`],tr=[`aria-label`,`onClick`],nr=[`onClick`,`onContextmenu`,`onPointerdown`,`onMouseenter`],rr={class:`session-dot`},ir={class:`session-title`},ar={key:0,class:`session-project`},or={key:1,class:`pill pill-attention`},sr={key:2,class:`session-age`},cr=[`aria-label`,`onClick`],lr={class:`thread-card-title`},ur={key:0,class:`thread-card-off`},dr={key:0},fr={key:0,class:`list-empty`},pr=320,mr=500,hr=f({__name:`SessionList`,props:{store:{},mode:{},hostLabels:{},hostStates:{},selectedKey:{},searching:{type:Boolean}},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*ie)),C=S(()=>{a.store.version.value;let e=Math.max(0,u.value-pr),t=f.value+pr*2;if(a.mode===`projects`)return a.store.groupedRows(e,t);let n=Math.floor(e/ie);return a.store.range(n,Math.ceil(t/ie)+1).map((e,t)=>({kind:`item`,key:e.key,top:(n+t)*ie,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 ee(){clearTimeout(B),B=setTimeout(()=>L.value=null,80)}let te,ne=!1;function U(e,t){if(e.pointerType===`mouse`)return;ne=!1,clearTimeout(te);let{clientX:n,clientY:r}=e;te=setTimeout(()=>{ne=!0,navigator.vibrate?.(10),o(`menu`,t,n,r)},mr)}function W(){clearTimeout(te)}function G(e){clearTimeout(B),L.value=null,ne?ne=!1:o(`select`,e.key)}function re(e,t){let n=e.currentTarget.getBoundingClientRect();o(`menu`,t,n.left,n.bottom+4)}function K(e,t){let n=e.currentTarget.getBoundingClientRect();o(`projectMenu`,t,n.right-210,n.bottom+4)}function q(){W(),L.value&&ee(),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(te),clearTimeout(B),clearInterval(A)}),(e,r)=>(i(),R(`div`,{ref_key:`element`,ref:s,class:`session-list`,style:g({"--row-h":D(ie)+`px`}),onScrollPassive:q},[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`,Gn,[t(Fe,{name:e.group.name,source:P(e.group)},null,8,[`name`,`source`]),t(J,{name:`chevron`,size:14,class:`group-chevron`})]),x(`span`,Kn,k(e.group.name),1),x(`span`,{class:`group-host`,title:N(e.group)},k(j(e.group)),9,qn),D(oe)(e.group)===`done`?F(``,!0):(i(),R(`span`,{key:0,class:`group-marks`,title:w(e.group)},[e.group.attention?(i(),R(`span`,Yn,k(e.group.attention),1)):F(``,!0),e.group.failed?(i(),R(`span`,Xn)):F(``,!0),e.group.running?(i(),R(`span`,Zn)):F(``,!0),e.group.unread?(i(),R(`span`,Qn)):F(``,!0)],8,Jn)),e.collapsed?(i(),R(`span`,$n,k(e.group.items.size),1)):F(``,!0)],40,Wn),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,er),x(`button`,{class:`group-add group-more`,"aria-label":`Actions for project `+e.group.name,title:`Project settings, remove project`,onClick:t=>K(t,e.group)},[t(J,{name:`more-v`,size:15})],8,tr)],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=>G(e.item),onContextmenu:v(t=>o(`menu`,e.item,t.clientX,t.clientY),[`prevent`]),onPointerdown:t=>U(t,e.item),onPointerup:W,onPointercancel:W,onPointerleave:W,onMouseenter:t=>H(t,e.item),onMouseleave:ee},[x(`span`,rr,[T(e.item)?(i(),R(`span`,{key:0,class:M([`status-dot`,T(e.item)])},null,2)):F(``,!0)]),x(`span`,ir,[e.item.pinnedAt?(i(),m(J,{key:0,name:`pin`,size:11,class:`pin-mark`})):F(``,!0),d(k(e.item.name),1)]),n.mode===`recent`?(i(),R(`span`,ar,k(e.item.project),1)):F(``,!0),e.item.attention?(i(),R(`span`,or,`Needs you`)):(i(),R(`span`,sr,k(D(zn)(e.item.activityAt,O.value)),1))],42,nr),x(`button`,{class:`row-more`,"aria-label":`Actions for `+e.item.name,title:`Rename, pin, mark unread, archive`,onClick:v(t=>re(t,e.item),[`stop`])},[t(J,{name:`more`,size:16})],8,cr)],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`,lr,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`,ur,`offline`))]),L.value.thread.branch?(i(),R(`p`,dr,[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`,fr,k(n.searching?`No threads match.`:`No threads yet. Add a host to get started.`),1))],36))}}),gr={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},_r=e=>e.replace(/[&<>"']/g,e=>gr[e]);function vr(e){let t=e.trim();return/^(https?:|mailto:)/i.test(t)?t:null}function yr(e){let t=e.split(/(`+)([\s\S]*?[^`])\1(?!`)/),n=``;for(let e=0;e<t.length;e++){if(e%3==2){n+=`<code>${_r(t[e].replace(/^ (.*) $/,`$1`))}</code>`;continue}if(e%3==1)continue;let r=_r(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=vr(n.replace(/&amp;/g,`&`));return r?`<a href="${_r(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 br=e=>/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(e)&&e.includes(`|`),xr=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>yr(e.trim()));function Sr(e){let t=e.replace(/\r\n?/g,`
21
+ `).split(`
22
+ `),n=[],r=[],i=()=>{r.length&&n.push(`<p>${r.map(yr).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">${_r(o[3])}</span>`:``;n.push(`<pre class="code">${s}<code>${_r(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}>${yr(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>${Sr(r.join(`
24
+ `))}</blockquote>`);continue}if(a.includes(`|`)&&e+1<t.length&&br(t[e+1])){i();let r=xr(a),o=[];for(e+=2;e<t.length&&t[e].includes(`|`)&&t[e].trim();e++)o.push(xr(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>${yr(e[2])}</li>`:`<li${t}>${yr(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>$/,` ${yr(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 Cr=`modulepreload`,wr=function(e){return`/`+e},Tr={},Er=function(e){return e.pathname.endsWith(`.css`)},Dr=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},Or=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=wr(t,n);let r=s(t),i=Er(r);return Dr(Tr,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`:Cr,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)})},kr=y(null),Ar=null;function jr(){return Ar??=Or(()=>import(`./MarkdownMessage-C1WAZAoK.js`).then(e=>{kr.value=p(e.default)}),__vite__mapDeps([0,1,2,3,4])).catch(()=>{Ar=null}),Ar}function Mr(){let e=window.requestIdleCallback;e?e(()=>void jr(),{timeout:3e3}):setTimeout(()=>void jr(),1500)}var Nr=Symbol(`litepaseo-suggestions`),Pr={key:0,class:`row row-plugin row-speed`,title:`Turn speed (turn-speed plugin)`},Fr={class:`suggestion-actions`},Ir={key:2,class:`suggestion-wait`},Lr={class:`line-icon`},Rr={class:`line-name`},zr={class:`line-text`},Br={key:0,class:`tool-body`},Vr={class:`tool-pre`},Hr=f({__name:`PluginRow`,props:{item:{},seqStart:{}},setup(r){let a=r,o=w(Nr,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`,Pr,[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`,Fr,[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`,Ir,`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`,Lr,[t(J,{name:`sparkle`,size:15})]),x(`span`,Rr,k(r.item.pluginId),1),x(`span`,zr,k(r.item.kind),1)]),g.value?(i(),R(`div`,Br,[x(`pre`,Vr,k(_.value),1)])):F(``,!0)],32))}}),Ur=[`aria-expanded`,`disabled`],Wr={key:0,class:`spinner`},Gr={key:0,class:`rewind-menu`,role:`menu`},Kr={class:`rewind-warning`},qr=[`onClick`],Jr=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`,Wr)):(i(),m(J,{key:1,name:`undo`,size:14}))],8,Ur),f.value?(i(),R(`div`,Gr,[x(`p`,Kr,[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,qr))),128))])):F(``,!0)],512))}}),Yr={key:0,class:`row row-user`},Xr={class:`bubble`,tabindex:`-1`},Zr={class:`user-actions`},Qr={key:0,class:`user-time`},$r=[`aria-label`,`title`],ei={key:1,class:`row row-assistant`},ti=[`innerHTML`],ni=[`tabindex`],ri={class:`line-icon`},ii={class:`line-text`},ai={key:0,class:`reasoning-text`},oi=[`title`],si={class:`line-icon`},ci={key:0,class:`status-dot is-running`},li={key:0,class:`line-name`},ui={key:1,class:`line-meta`},di={key:2,class:`line-meta`},fi={key:0,class:`tool-body`},pi={key:0,class:`tool-pre tool-command`},mi={key:1,class:`tool-pre tool-diff`},hi={key:0,class:`diff-hunk`},gi={key:2,class:`tool-pre`},_i={key:3,class:`tool-pre tool-output`},vi={key:4,class:`tool-pre tool-error`},yi={key:5,class:`tool-exit`},bi={key:6,class:`tool-exit`},xi={key:4,class:`row row-todo`},Si={class:`todo-title`},Ci={key:5,class:`row row-callout is-error`},wi={key:7,class:`row row-divider`},Ti={class:`line-icon`},Ei={class:`line-name`},Di={key:0,class:`tool-body`},Oi={class:`tool-pre`},ki=2e4,Ai=600,ji=f({__name:`TimelineRowView`,props:{entry:{},final:{type:Boolean}},setup(n){let a=n,o=w(bn,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?Un(e,o.value.base):e}),f=S(()=>!kr.value&&c.value.type===`assistant_message`?Sr(u.value):``);!kr.value&&c.value.type===`assistant_message`&&jr();let p=S(()=>{let e=c.value;if(e.type!==`tool_call`)return null;let t=jn(e,o?.value.cwd);return{...t,summary:t.summary.split(`
25
+ `)[0],status:String(e.status??`running`)}}),h=S(()=>c.value.type===`reasoning`?Mn(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>ki?e.slice(0,ki)+`
26
+ … (truncated)`:e,E=S(()=>{if(!l.value||!p.value)return null;let e=c.value,t=e.detail??{},n=Pn(e),r=n?n.split(`
27
+ `):[],i=T(Nn(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,Ai).map(e=>({text:e,kind:e.startsWith(`@@`)?`hunk`:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:``})),diffMore:Math.max(0,r.length-Ai),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)?Rn(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`,Yr,[x(`div`,Xr,k(c.value.text),1),x(`div`,Zr,[P.value?(i(),R(`span`,Qr,k(P.value),1)):F(``,!0),I.value.length?(i(),m(Jr,{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,$r)])])):c.value.type===`assistant_message`?(i(),R(`div`,ei,[D(kr)?(i(),m(r(D(kr)),{key:0,content:u.value,final:n.final},null,8,[`content`,`final`])):(i(),R(`div`,{key:1,class:`prose`,innerHTML:f.value},null,8,ti))])):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`,ri,[t(J,{name:`bulb`,size:15})]),x(`span`,ii,k(h.value||`Thinking`),1)],40,ni),l.value?(i(),R(`div`,ai,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`,si,[p.value.status===`running`?(i(),R(`span`,ci)):(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`,li,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`,ui,k(p.value.meta),1)):p.value.status===`canceled`?(i(),R(`span`,di,`canceled`)):F(``,!0)],8,oi),E.value?(i(),R(`div`,fi,[E.value.command?(i(),R(`pre`,pi,[a[0]||=x(`span`,{class:`tool-prompt`},`$`,-1),d(` `+k(E.value.command),1)])):F(``,!0),E.value.diff.length?(i(),R(`pre`,mi,[(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`,hi,`… `+k(E.value.diffMore)+` more lines`,1)):F(``,!0)])):F(``,!0),E.value.input?(i(),R(`pre`,gi,k(E.value.input),1)):F(``,!0),E.value.output?(i(),R(`pre`,_i,k(E.value.output),1)):F(``,!0),E.value.error?(i(),R(`pre`,vi,k(E.value.error),1)):F(``,!0),E.value.exitCode!==null&&E.value.exitCode!==0&&!E.value.error?(i(),R(`p`,yi,`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`,bi,`No output`)):F(``,!0)])):F(``,!0)],34)):c.value.type===`todo`?(i(),R(`div`,xi,[x(`div`,Si,[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`,Ci,[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`,wi,[x(`span`,null,k(c.value.status===`loading`?`Compacting context…`:`Context compacted`),1)])):c.value.type===`plugin`?(i(),m(Hr,{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`,Ti,[t(J,{name:`tool`,size:15})]),x(`span`,Ei,k(j.value),1)]),l.value?(i(),R(`div`,Di,[x(`pre`,Oi,k(A.value),1)])):F(``,!0)],32))}}),Mi={class:`sheet-head`},Ni=[`disabled`],Pi={class:`sheet-body`},Fi={key:0,class:`sheet-note`},Ii={class:`field-grid`},Li={class:`field`},Ri=[`disabled`],zi=[`value`],Bi={class:`field`},Vi=[`disabled`],Hi={key:0,value:``},Ui=[`value`],Wi={key:0,class:`field`},Gi=[`title`],Ki={class:`field`},qi=[`placeholder`,`disabled`],Ji={class:`field-grid three`},Yi={class:`field field-agent`},Xi=[`disabled`],Zi={key:0,value:``},Qi=[`value`,`disabled`],$i={class:`field field-model`},ea=[`disabled`],ta={key:0,value:``},na=[`value`],ra={class:`field field-thinking`},ia=[`disabled`],aa={key:0,value:``},oa=[`value`],sa={key:2,class:`field`},ca=[`disabled`],la=[`value`],ua={class:`toggle`},da=[`disabled`],fa={key:3,class:`field`},pa={key:4,class:`sheet-error`},ma={key:5,class:`sheet-error`},ha={key:6,class:`sheet-error`,role:`alert`},ga={class:`sheet-foot`},_a=[`disabled`],va=[`disabled`],ya={key:0,class:`spinner spinner-on-accent`},ba=`\0custom`,xa=`litepaseo-new-session`,Sa=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(xa)??`{}`)}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(null),w=e(``),T=e(``),E=e(``),D=e(``),O=e(``),A=e(``),j=e(``),M=e(!1),P=e(``),I=e(``),L=e(!1),B=e(``),V=e(null),H=crypto.randomUUID(),ee=S(()=>g.value?.find(e=>e.id===D.value)),te=S(()=>ee.value?.models??[]),ne=S(()=>te.value.find(e=>e.id===O.value)),U=S(()=>T.value===ba?E.value.trim():T.value),W=S(()=>y.value?.find(e=>e.rootPath===T.value)?.name??U.value.split(`/`).pop()??``),G=S(()=>!!m.value&&!!U.value&&!!D.value&&!L.value&&(!M.value||!!P.value.trim()));async function re(e){if(g.value=y.value=null,w.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,y.value=n.sort((e,t)=>e.name.localeCompare(t.name)),ie();let r=y.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)T.value=a.rootPath;else if(e===s.initialHostId&&s.initialCwd){let e=r.find(e=>e.rootPath===s.initialCwd);e?T.value=e.rootPath:(T.value=ba,E.value=s.initialCwd)}else T.value||=r[0]?.rootPath??ba}catch(t){e===m.value&&(w.value=t.message)}}function ie(){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];D.value=n?.id??``,K(e.model,e.thinking),j.value=n?.modes.some(t=>t.id===e.mode)?e.mode:n?.defaultModeId??``}function K(e,t){let n=te.value,r=n.find(t=>t.id===e)??n.find(e=>e.isDefault)??n[0];O.value=r?.id??``,A.value=r?.thinking.some(e=>e.id===t)?t:r?.defaultThinkingId??``}n(m,e=>{T.value=``,re(e)}),n(D,()=>{let e=f[m.value];K(e?.provider===D.value?e.model:void 0);let t=ee.value;t&&!t.modes.some(e=>e.id===j.value)&&(j.value=t.defaultModeId??``)}),n(O,()=>{let e=ne.value;e&&!e.thinking.some(e=>e.id===A.value)&&(A.value=e.defaultThinkingId??``)}),n([m,T,E,D,O,A,j,M,P,I],()=>{B.value&&(H=crypto.randomUUID()),B.value=``});async function q(){if(G.value){L.value=!0,B.value=``;try{let e=await s.request(`/hosts/${encodeURIComponent(m.value)}/agents`,`POST`,{idempotencyKey:H,cwd:U.value,provider:D.value,...O.value?{model:O.value}:{},...j.value?{modeId:j.value}:{},...A.value?{thinkingOptionId:A.value}:{},...I.value.trim()?{prompt:I.value}:{},...M.value?{worktreeBranch:P.value.trim()}:{}},12e4);f[m.value]={provider:D.value,model:O.value,thinking:A.value,mode:j.value},localStorage.setItem(xa,JSON.stringify(f)),u(`created`,e.key)}catch(e){B.value=e.message}finally{L.value=!1}}}function ae(e){e.key===`Escape`&&!L.value&&u(`close`),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),q())}return c(()=>{window.addEventListener(`keydown`,ae),re(m.value),C(()=>V.value?.focus())}),l(()=>window.removeEventListener(`keydown`,ae)),(e,n)=>(i(),R(`div`,{class:`overlay`,onMousedown:n[12]||=v(e=>!L.value&&u(`close`),[`self`])},[x(`form`,{class:`sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`New session`,onSubmit:v(q,[`prevent`])},[x(`header`,Mi,[n[13]||=x(`h2`,null,`New session`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,disabled:L.value,onClick:n[0]||=e=>u(`close`)},[t(J,{name:`close`,size:16})],8,Ni)]),x(`div`,Pi,[p.value.length?(i(),R(b,{key:1},[x(`div`,Ii,[x(`label`,Li,[n[14]||=x(`span`,null,`Host`,-1),a(x(`select`,{"onUpdate:modelValue":n[1]||=e=>m.value=e,disabled:L.value},[(i(!0),R(b,null,z(p.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,zi))),128))],8,Ri),[[N,m.value]])]),x(`label`,Bi,[n[15]||=x(`span`,null,`Project`,-1),a(x(`select`,{"onUpdate:modelValue":n[2]||=e=>T.value=e,disabled:L.value||!y.value},[y.value?F(``,!0):(i(),R(`option`,Hi,`Loading…`)),(i(!0),R(b,null,z(y.value??[],e=>(i(),R(`option`,{key:e.key,value:e.rootPath},k(e.name),9,Ui))),128)),x(`option`,{value:ba},`Another folder…`)],8,Vi),[[N,T.value]])])]),T.value===ba?(i(),R(`label`,Wi,[x(`span`,null,`Folder on `+k(p.value.find(e=>e.id===m.value)?.label),1),a(x(`input`,{"onUpdate:modelValue":n[3]||=e=>E.value=e,placeholder:`/home/me/code/project`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,E.value]])])):U.value?(i(),R(`p`,{key:1,class:`path-hint`,title:U.value},[t(J,{name:`folder`,size:13}),d(k(U.value),1)],8,Gi)):F(``,!0),x(`label`,Ki,[n[16]||=x(`span`,null,`First message`,-1),a(x(`textarea`,{ref_key:`promptElement`,ref:V,"onUpdate:modelValue":n[4]||=e=>I.value=e,rows:`5`,placeholder:W.value?`What should the agent do in ${W.value}?`:`What should the agent do?`,disabled:L.value},null,8,qi),[[_,I.value]])]),x(`div`,Ji,[x(`label`,Yi,[n[17]||=x(`span`,null,`Agent`,-1),a(x(`select`,{"onUpdate:modelValue":n[5]||=e=>D.value=e,disabled:L.value||!g.value},[g.value?F(``,!0):(i(),R(`option`,Zi,`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,Qi))),128))],8,Xi),[[N,D.value]])]),x(`label`,$i,[n[18]||=x(`span`,null,`Model`,-1),a(x(`select`,{"onUpdate:modelValue":n[6]||=e=>O.value=e,disabled:L.value||!te.value.length},[te.value.length?F(``,!0):(i(),R(`option`,ta,`Default`)),(i(!0),R(b,null,z(te.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,na))),128))],8,ea),[[N,O.value]])]),x(`label`,ra,[n[19]||=x(`span`,null,`Thinking`,-1),a(x(`select`,{"onUpdate:modelValue":n[7]||=e=>A.value=e,disabled:L.value||!ne.value?.thinking.length},[ne.value?.thinking.length?F(``,!0):(i(),R(`option`,aa,`Default`)),(i(!0),R(b,null,z(ne.value?.thinking??[],e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,oa))),128))],8,ia),[[N,A.value]])])]),ee.value?.modes.length?(i(),R(`label`,sa,[n[20]||=x(`span`,null,`Mode`,-1),a(x(`select`,{"onUpdate:modelValue":n[8]||=e=>j.value=e,disabled:L.value},[(i(!0),R(b,null,z(ee.value.modes,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,la))),128))],8,ca),[[N,j.value]])])):F(``,!0),x(`label`,ua,[a(x(`input`,{"onUpdate:modelValue":n[9]||=e=>M.value=e,type:`checkbox`,disabled:L.value},null,8,da),[[h,M.value]]),n[21]||=x(`span`,null,`Work in a new git worktree`,-1)]),M.value?(i(),R(`label`,fa,[n[22]||=x(`span`,null,`New branch`,-1),a(x(`input`,{"onUpdate:modelValue":n[10]||=e=>P.value=e,placeholder:`feature/my-change`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,P.value]])])):F(``,!0),w.value?(i(),R(`p`,pa,[t(J,{name:`alert`,size:14}),d(k(w.value),1)])):F(``,!0),ee.value?.error?(i(),R(`p`,ma,[t(J,{name:`alert`,size:14}),d(k(ee.value.error),1)])):F(``,!0),B.value?(i(),R(`p`,ha,[t(J,{name:`alert`,size:14}),x(`span`,null,k(B.value),1)])):F(``,!0)],64)):(i(),R(`p`,Fi,`No connected hosts. Connect a host first.`))]),x(`footer`,ga,[n[23]||=x(`span`,{class:`sheet-hint hide-sm`},`Ctrl/⌘ + Enter to start`,-1),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:L.value,onClick:n[11]||=e=>u(`close`)},`Cancel`,8,_a),x(`button`,{class:`btn btn-primary`,disabled:!G.value},[L.value?(i(),R(`span`,ya)):F(``,!0),d(` `+k(L.value?`Starting…`:B.value?`Retry`:`Start session`),1)],8,va)])],32)],32))}}),Ca={key:0,class:`attachment-tray`},wa=[`data-state`,`title`],Ta={class:`attachment-thumb`},Ea=[`src`,`alt`],Da={key:2,class:`spinner spinner-sm attachment-uploading`},Oa={class:`attachment-text`},ka={class:`attachment-name`},Aa={class:`attachment-meta`},ja=[`disabled`,`onClick`],Ma=[`aria-label`,`title`,`disabled`,`onClick`],Na={key:0,class:`attachment-error`,role:`alert`},Pa=[`disabled`],Fa=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`,Ca,[(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`,Ta,[e.preview?(i(),R(`img`,{key:0,src:e.preview,alt:e.file.name},null,8,Ea)):(i(),m(J,{key:1,name:`file`,size:16})),e.uploading?(i(),R(`span`,Da)):F(``,!0)]),x(`span`,Oa,[x(`span`,ka,k(e.file.name),1),x(`span`,Aa,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,ja)):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,Ma)],10,wa))),128)),c.value?(i(),R(`p`,Na,[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,Pa))])):F(``,!0)])):F(``,!0)],64))}}),Ia=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},La=Ia(Fa,[[`__scopeId`,`data-v-78817268`]]),Ra=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 za(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 Ba(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 Va={class:`permission-head`},Ha={class:`permission-icon`},Ua={class:`grow`},Wa={class:`row-title`},Ga={class:`row-sub`},Ka={class:`permission-details`},qa={key:0,class:`field`},Ja=[`value`],Ya=[`disabled`],Xa=[`type`,`name`,`checked`,`onChange`],Za={key:0,class:`row-sub`},Qa={key:0,class:`field`},$a=[`onUpdate:modelValue`,`type`,`aria-label`],eo={key:2,class:`field`},to={key:3,role:`alert`},no={class:`permission-actions`},ro=[`disabled`],io=[`disabled`],ao=Ia(f({__name:`PermissionForm`,props:{permission:{},busy:{type:Boolean}},emits:[`respond`],setup(r,{emit:o}){let s=r,c=o,l=S(()=>za(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=Ba(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`,Va,[x(`span`,Ha,[t(J,{name:`shield`,size:16})]),x(`div`,Ua,[x(`div`,Wa,k(r.permission.title||r.permission.name),1),x(`div`,Ga,k(r.permission.kind===`question`?`Question`:`Permission request`)+` · `+k(r.permission.name),1)])]),x(`details`,Ka,[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`,qa,[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,Ja))),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,Xa),x(`span`,null,[d(k(n.label),1),n.description?(i(),R(`small`,Za,` — `+k(n.description),1)):F(``,!0)])]))),128)),e.other?(i(),R(`label`,Qa,[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,$a),[[O,u.value[t].text]])])):F(``,!0)],8,Ya))),128)):r.permission.kind===`question`?(i(),R(`label`,eo,[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`,to,k(m.value),1)):F(``,!0),x(`div`,no,[x(`button`,{type:`button`,class:`btn btn-outline`,disabled:r.busy,onClick:n[2]||=e=>g(!1)},`Deny`,8,ro),x(`button`,{class:`btn btn-primary`,disabled:r.busy},`Allow / submit`,8,io)])],32))}}),[[`__scopeId`,`data-v-f1db1c0a`]]),oo=`litepaseo-theme`,so=e((()=>{let e=localStorage.getItem(oo);return e===`light`||e===`dark`?e:`system`})()),co=matchMedia(`(prefers-color-scheme: dark)`),lo=e(co.matches);co.addEventListener(`change`,e=>{lo.value=e.matches});var uo=S(()=>so.value===`dark`||so.value===`system`&&lo.value);function fo(e=so.value){so.value=e,e===`system`?(delete document.documentElement.dataset.theme,localStorage.removeItem(oo)):(document.documentElement.dataset.theme=e,localStorage.setItem(oo,e))}var po=[`system`,`light`,`dark`];function mo(){fo(po[(po.indexOf(so.value)+1)%po.length])}var ho=[{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`}}],go=`litepaseo-palette`,_o=e((()=>{let e=localStorage.getItem(go);return ho.some(t=>t.id===e)?e:`ocean`})()),vo=[];function yo(){let e=document.documentElement.style;for(let t of vo)e.removeProperty(t);let t=ho.find(e=>e.id===_o.value)??ho[0],n=uo.value?t.dark:t.light;for(let[t,r]of Object.entries(n))e.setProperty(t,r);vo=Object.keys(n),document.documentElement.dataset.palette=t.id}function bo(e=_o.value){_o.value=e,localStorage.setItem(go,e),yo()}n(uo,yo);var xo=`Brave turns push off by default. Open brave://settings/privacy, turn on “Use Google services for push messaging”, restart Brave, and try again.`,So=`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 Co(e){let{name:t,message:n}=e??{};return t===`AbortError`||/push service/i.test(String(n??``))}function wo(e,t){return Co(e)?Error(t?xo:So,{cause:e}):e instanceof Error?e:Error(String(e))}async function To(e=globalThis.navigator){let t=e?.brave;try{return typeof t?.isBrave==`function`&&await t.isBrave()===!0}catch{return!1}}var Eo=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Do=()=>matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,Oo=y(null),ko=e(Do());window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),Oo.value=e}),window.addEventListener(`appinstalled`,()=>{Oo.value=null,ko.value=!0});async function Ao(){let e=Oo.value;if(!e)return!1;await e.prompt();let{outcome:t}=await e.userChoice;return Oo.value=null,t===`accepted`}var jo=null;function Mo(){return`serviceWorker`in navigator?(jo??=navigator.serviceWorker.register(`/sw.js`,{scope:`/`}).catch(()=>null),jo):Promise.resolve(null)}function No(){return window.isSecureContext?`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window?`supported`:Eo&&!Do()?`needs-install`:`unsupported`:`insecure`}async function Po(){let e=await Mo();return e?e.pushManager.getSubscription():null}function Fo(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 Io(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 Mo();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:Fo(i)})}catch(e){throw wo(e,await To())}return await e(`/push/subscribe`,`POST`,{subscription:a.toJSON(),prefs:t}),a}async function Lo(e,t,n){await e(`/push/subscribe`,`POST`,{subscription:t.toJSON(),prefs:n})}async function Ro(e){let t=await Po();t&&(await e(`/push/unsubscribe`,`POST`,{endpoint:t.endpoint}).catch(()=>{}),await t.unsubscribe().catch(()=>{}))}function zo(e){let t=navigator;t.setAppBadge&&(e>0?t.setAppBadge(e):t.clearAppBadge?.())?.catch(()=>{})}function Bo(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 Vo={class:`page`},Ho={class:`page-head`},Uo={class:`page-body`},Wo={class:`card`},Go={class:`card-row`},Ko={class:`setting-icon`},qo={class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Theme`},Jo=[`aria-checked`,`onClick`],Yo={class:`card-row palette-row`},Xo={class:`setting-icon`},Zo={class:`grow`},Qo={class:`palette-grid`,role:`radiogroup`,"aria-label":`Colour palette`},$o=[`aria-checked`,`onClick`],es={class:`palette-swatch`},ts={class:`palette-text`},ns={class:`palette-name`},rs={class:`row-sub`},is={class:`card`},as={class:`card-row`},os={class:`setting-icon`},ss={class:`grow`},cs={class:`row-sub`},ls=[`disabled`],us=[`disabled`],ds={class:`card-row switch-row`},fs=[`disabled`],ps={class:`card-row switch-row`},ms=[`disabled`],hs={class:`card-row`},gs=[`disabled`],_s={key:0,class:`setting-note`},vs={key:1,class:`setting-note is-error`},ys={class:`card`},bs={class:`card-row`},xs={class:`setting-icon`},Ss={class:`grow`},Cs={class:`row-sub`},ws=[`disabled`],Ts={class:`field`},Es={class:`field`},Ds=[`placeholder`,`required`],Os={class:`field-grid`},ks={class:`field`},As={class:`field`},js={class:`field`},Ms={class:`form-actions`},Ns=[`disabled`],Ps=[`disabled`],Fs=[`disabled`],Is={key:2,class:`setting-note`},Ls={key:3,class:`setting-note is-error`},Rs={class:`card`},zs={class:`card-row`},Bs={class:`setting-icon`},Vs={class:`grow`},Hs={class:`row-sub`},Us=[`disabled`],Ws={class:`card`},Gs={class:`card-row`},Ks={class:`setting-icon`},qs={class:`grow`},Js={class:`row-sub`},Ys=[`disabled`],Xs={key:0,class:`card-row totp-setup`},Zs=[`src`],Qs={class:`grow`},$s={class:`secret`},ec=[`disabled`],tc={key:1,class:`card-row`},nc=[`disabled`],rc={key:4,class:`setting-note is-error`},ic={class:`card`},ac={class:`setting-icon`},oc={class:`grow`},sc={class:`row-title`},cc={key:0,class:`pill pill-current`},lc={class:`row-sub`},uc=[`disabled`,`onClick`],dc={key:0,class:`card-row row-sub`},fc={class:`form-actions spaced`},pc=[`disabled`],mc=f({__name:`Settings`,props:{request:{type:Function},totpEnabled:{type:Boolean}},emits:[`back`,`signedOut`,`totpChanged`,`dictationChanged`],setup(n,{emit:r}){let o=n,s=r,l=e(null),u=e({baseUrl:``,apiKey:``,model:``,languages:``,keywords:``}),f=(e,t)=>e.split(t).map(e=>e.trim()).filter(Boolean),p=e(!1),m=e(!1),y=e(``),C=e(``);function w(e){l.value=e,u.value={baseUrl:e.baseUrl,apiKey:``,model:e.model,languages:e.languages.join(`, `),keywords:e.keywords.join(`
30
+ `)},s(`dictationChanged`,e.configured)}async function T(e){m.value=!0,y.value=C.value=``;try{await e()}catch(e){y.value=e.message}finally{m.value=!1}}let E=()=>T(async()=>{let e=u.value;w(await o.request(`/dictation`,`PUT`,{baseUrl:e.baseUrl,apiKey:e.apiKey,model:e.model,languages:f(e.languages,/[,\s]+/),keywords:f(e.keywords,/[,\n]+/)})),p.value=!1,C.value=`Saved. The microphone button is in the composer.`}),O=()=>T(async()=>{confirm(`Remove the transcription service? Voice input turns off on every device.`)&&(w(await o.request(`/dictation`,`DELETE`)),p.value=!1)});function A(){l.value&&w(l.value),p.value=!1,y.value=``}let j=No(),N=e(null),P=e({attention:!0,turns:!0}),I=e(typeof Notification>`u`?`default`:Notification.permission),L=e(!1),B=e(``),V=e(``);async function H(){if(j!==`supported`||(N.value=await Po(),!N.value))return;let e=await o.request(`/push/status`,`POST`,{endpoint:N.value.endpoint});e.subscribed?P.value=e.prefs:N.value=null}async function ee(e){L.value=!0,V.value=B.value=``;try{await e()}catch(e){V.value=e.message}finally{L.value=!1,I.value=typeof Notification>`u`?`default`:Notification.permission}}let te=()=>ee(async()=>{N.value=await Io(o.request,P.value),B.value=`Notifications are on for this device.`}),ne=()=>ee(async()=>{await Ro(o.request),N.value=null}),U=()=>ee(async()=>{N.value&&await Lo(o.request,N.value,P.value)}),W=()=>ee(async()=>{let{sent:e}=await o.request(`/push/test`,`POST`,{});B.value=e?`Test sent. It should arrive in a few seconds.`:`This device is not registered.`}),G=e(!1);async function re(){G.value=!0;try{await Ao()}finally{G.value=!1}}let ie=e([]),K=e(null),q=e(``),ae=e(``),oe=e(!1);async function se(){ie.value=await o.request(`/sessions`)}async function ce(e){oe.value=!0,ae.value=``;try{await e()}catch(e){ae.value=e.message}finally{oe.value=!1}}let le=()=>ce(async()=>{K.value=await o.request(`/totp/setup`,`POST`,{}),q.value=``}),ue=()=>ce(async()=>{await o.request(`/totp/confirm`,`POST`,{code:q.value.trim()}),K.value=null,q.value=``,s(`totpChanged`,!0)}),de=()=>ce(async()=>{await o.request(`/totp/disable`,`POST`,{code:q.value.trim()}),q.value=``,s(`totpChanged`,!1)}),fe=e=>ce(async()=>{await o.request(`/sessions/`+e.id,`DELETE`),e.current?s(`signedOut`):await se()}),pe=()=>ce(async()=>{confirm(`Sign out every device, including this one? Their notifications stop too.`)&&(await o.request(`/sessions/revoke-all`,`POST`,{}),s(`signedOut`))}),me=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`},he=S(()=>I.value===`denied`);return c(()=>{H().catch(()=>{}),se().catch(()=>{}),o.request(`/dictation`).then(w).catch(()=>{})}),(e,r)=>(i(),R(`section`,Vo,[x(`header`,Ho,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:r[0]||=e=>s(`back`)},[t(J,{name:`back`,size:18})]),r[12]||=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`,Uo,[r[29]||=x(`h2`,{class:`section-label`},`Appearance`,-1),x(`div`,Wo,[x(`div`,Go,[x(`span`,Ko,[t(J,{name:`sun`,size:16})]),r[13]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`Theme`)],-1),x(`div`,qo,[(i(),R(b,null,z([`system`,`light`,`dark`],e=>x(`button`,{key:e,role:`radio`,"aria-checked":D(so)===e,class:M({chosen:D(so)===e}),onClick:t=>D(fo)(e)},k(e===`system`?`System`:e===`light`?`Light`:`Dark`),11,Jo)),64))])]),x(`div`,Yo,[x(`span`,Xo,[t(J,{name:`sparkle`,size:16})]),x(`div`,Zo,[r[14]||=x(`div`,{class:`row-title`},`Colour`,-1),x(`div`,Qo,[(i(!0),R(b,null,z(D(ho),e=>(i(),R(`button`,{key:e.id,type:`button`,role:`radio`,class:M([`palette-option`,{chosen:D(_o)===e.id}]),"aria-checked":D(_o)===e.id,onClick:t=>D(bo)(e.id)},[x(`span`,es,[x(`span`,{style:g({background:e.swatch[0]})},null,4),x(`span`,{style:g({background:e.swatch[1]})},null,4)]),x(`span`,ts,[x(`span`,ns,k(e.label),1),x(`span`,rs,k(e.note),1)])],10,$o))),128))])])])]),r[30]||=x(`h2`,{class:`section-label`},`Notifications`,-1),x(`div`,is,[x(`div`,as,[x(`span`,os,[t(J,{name:`bell`,size:16})]),x(`div`,ss,[r[15]||=x(`div`,{class:`row-title`},`Push notifications`,-1),x(`div`,cs,[D(j)===`insecure`?(i(),R(b,{key:0},[d(`Needs HTTPS. Open the console through your tunnel's https:// address.`)],64)):D(j)===`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(j)===`unsupported`?(i(),R(b,{key:2},[d(`This browser cannot receive push notifications.`)],64)):he.value?(i(),R(b,{key:3},[d(`Blocked in this browser's site settings. Allow notifications there, then return.`)],64)):N.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(j)===`supported`&&!N.value&&!he.value?(i(),R(`button`,{key:0,class:`btn btn-primary`,disabled:L.value,onClick:te},` Turn on `,8,ls)):N.value?(i(),R(`button`,{key:1,class:`btn btn-outline`,disabled:L.value,onClick:ne},`Turn off`,8,us)):F(``,!0)]),N.value?(i(),R(b,{key:0},[x(`label`,ds,[r[16]||=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":r[1]||=e=>P.value.attention=e,class:`switch`,type:`checkbox`,disabled:L.value,onChange:U},null,40,fs),[[h,P.value.attention]])]),x(`label`,ps,[r[17]||=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":r[2]||=e=>P.value.turns=e,class:`switch`,type:`checkbox`,disabled:L.value,onChange:U},null,40,ms),[[h,P.value.turns]])]),x(`div`,hs,[r[18]||=x(`div`,{class:`grow row-sub`},`Not sent while you are viewing that conversation.`,-1),x(`button`,{class:`btn btn-outline`,disabled:L.value,onClick:W},`Send a test`,8,gs)])],64)):F(``,!0)]),B.value?(i(),R(`p`,_s,k(B.value),1)):F(``,!0),V.value?(i(),R(`p`,vs,k(V.value),1)):F(``,!0),r[31]||=x(`h2`,{class:`section-label`},`Voice input`,-1),x(`div`,ys,[x(`div`,bs,[x(`span`,xs,[t(J,{name:`mic`,size:16})]),x(`div`,Ss,[r[19]||=x(`div`,{class:`row-title`},`Transcription service`,-1),x(`div`,Cs,[l.value?.configured?(i(),R(b,{key:0},[d(k(l.value.model)+` · `+k(l.value.baseUrl.replace(/^https?:\/\//,``))+` · key `+k(l.value.keyHint)+k(l.value.languages.length?` · `+l.value.languages.join(`, `):``)+k(l.value.keywords.length?` · ${l.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))])]),p.value?F(``,!0):(i(),R(`button`,{key:0,class:`btn btn-outline`,disabled:m.value||!l.value,onClick:r[3]||=e=>p.value=!0},k(l.value?.configured?`Edit`:`Set up`),9,ws))]),p.value?(i(),R(`form`,{key:0,class:`card-row voice-form`,onSubmit:v(E,[`prevent`])},[x(`label`,Ts,[r[20]||=x(`span`,null,`Base URL`,-1),a(x(`input`,{"onUpdate:modelValue":r[4]||=e=>u.value.baseUrl=e,placeholder:`https://api.openai.com/v1`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,u.value.baseUrl]])]),x(`label`,Es,[r[21]||=x(`span`,null,`API key`,-1),a(x(`input`,{"onUpdate:modelValue":r[5]||=e=>u.value.apiKey=e,type:`password`,autocomplete:`off`,placeholder:l.value?.configured?`Unchanged (`+l.value.keyHint+`)`:`sk-…`,required:!l.value?.configured},null,8,Ds),[[_,u.value.apiKey]])]),x(`div`,Os,[x(`label`,ks,[r[22]||=x(`span`,null,`Model`,-1),a(x(`input`,{"onUpdate:modelValue":r[6]||=e=>u.value.model=e,placeholder:`gpt-transcribe`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,u.value.model]])]),x(`label`,As,[r[23]||=x(`span`,null,`Languages`,-1),a(x(`input`,{"onUpdate:modelValue":r[7]||=e=>u.value.languages=e,placeholder:`Detect (or zh, en)`,maxlength:`80`,autocomplete:`off`,spellcheck:`false`},null,512),[[_,u.value.languages]])])]),x(`label`,js,[r[24]||=x(`span`,null,`Vocabulary`,-1),a(x(`textarea`,{"onUpdate:modelValue":r[8]||=e=>u.value.keywords=e,rows:`3`,placeholder:`LitePaseo
31
+ Claude Code
32
+ pnpm`,spellcheck:`false`},null,512),[[_,u.value.keywords]])]),r[25]||=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`,Ms,[l.value?.configured?(i(),R(`button`,{key:0,type:`button`,class:`btn btn-ghost voice-remove`,disabled:m.value,onClick:O},`Remove`,8,Ns)):F(``,!0),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:m.value,onClick:A},`Cancel`,8,Ps),x(`button`,{class:`btn btn-primary`,disabled:m.value},`Save`,8,Fs)])],32)):F(``,!0)]),C.value?(i(),R(`p`,Is,k(C.value),1)):F(``,!0),y.value?(i(),R(`p`,Ls,k(y.value),1)):F(``,!0),r[32]||=x(`h2`,{class:`section-label`},`App`,-1),x(`div`,Rs,[x(`div`,zs,[x(`span`,Bs,[t(J,{name:`phone`,size:16})]),x(`div`,Vs,[r[26]||=x(`div`,{class:`row-title`},`Install LitePaseo`,-1),x(`div`,Hs,[D(ko)?(i(),R(b,{key:0},[d(`Installed. You are using the app.`)],64)):D(Oo)?(i(),R(b,{key:1},[d(`Full screen, its own icon, and notifications.`)],64)):D(Eo)?(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(Oo)&&!D(ko)?(i(),R(`button`,{key:0,class:`btn btn-primary`,disabled:G.value,onClick:re},`Install`,8,Us)):F(``,!0)])]),r[33]||=x(`h2`,{class:`section-label`},`Sign-in`,-1),x(`div`,Ws,[x(`div`,Gs,[x(`span`,Ks,[t(J,{name:`shield`,size:16})]),x(`div`,qs,[r[27]||=x(`div`,{class:`row-title`},`Authenticator code`,-1),x(`div`,Js,k(n.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)]),!n.totpEnabled&&!K.value?(i(),R(`button`,{key:0,class:`btn btn-outline`,disabled:oe.value,onClick:le},`Set up`,8,Ys)):F(``,!0)]),K.value?(i(),R(`div`,Xs,[x(`img`,{src:K.value.qr,alt:`Authenticator QR code`,width:`164`,height:`164`},null,8,Zs),x(`div`,Qs,[r[28]||=x(`p`,{class:`row-sub`},`Scan with Google Authenticator, 1Password, Authy or similar. Or enter this key:`,-1),x(`code`,$s,k(K.value.secret.match(/.{1,4}/g)?.join(` `)),1),x(`form`,{class:`code-form`,onSubmit:v(ue,[`prevent`])},[a(x(`input`,{"onUpdate:modelValue":r[9]||=e=>q.value=e,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,placeholder:`123456`,"aria-label":`Code from your app`},null,512),[[_,q.value]]),x(`button`,{class:`btn btn-primary`,disabled:oe.value||q.value.trim().length!==6},`Turn on`,8,ec),x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:r[10]||=e=>K.value=null},`Cancel`)],32)])])):F(``,!0),n.totpEnabled?(i(),R(`div`,tc,[x(`form`,{class:`code-form grow`,onSubmit:v(de,[`prevent`])},[a(x(`input`,{"onUpdate:modelValue":r[11]||=e=>q.value=e,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,placeholder:`Current code`,"aria-label":`Current code`},null,512),[[_,q.value]]),x(`button`,{class:`btn btn-outline`,disabled:oe.value||q.value.trim().length!==6},`Turn off`,8,nc)],32)])):F(``,!0)]),ae.value?(i(),R(`p`,rc,k(ae.value),1)):F(``,!0),r[34]||=x(`h2`,{class:`section-label`},`Signed-in devices`,-1),x(`div`,ic,[(i(!0),R(b,null,z(ie.value,e=>(i(),R(`div`,{key:e.id,class:`card-row`},[x(`span`,ac,[t(J,{name:/iOS|Android/.test(e.label)?`phone`:`monitor`,size:16},null,8,[`name`])]),x(`div`,oc,[x(`div`,sc,[d(k(e.label),1),e.current?(i(),R(`span`,cc,`This device`)):F(``,!0)]),x(`div`,lc,`Active `+k(me(e.lastSeen))+` · signed in `+k(new Date(e.created).toLocaleDateString()),1)]),x(`button`,{class:`btn btn-outline`,disabled:oe.value,onClick:t=>fe(e)},k(e.current?`Sign out`:`Revoke`),9,uc)]))),128)),ie.value.length?F(``,!0):(i(),R(`div`,dc,`Signed in with the access token only.`))]),x(`div`,fc,[x(`button`,{class:`btn btn-ghost`,disabled:oe.value,onClick:pe},`Sign out everywhere`,8,pc)])])]))}}),hc={class:`agent-board`},gc=[`title`],_c={class:`count`},vc=[`onClick`,`onKeydown`],yc={class:`task-top`},bc={class:`task-title`},xc={class:`task-meta`},Sc=[`onClick`],Cc=[`disabled`,`onClick`],wc=[`disabled`,`onClick`],Tc=[`disabled`,`onClick`],Ec=[`onClick`],Dc={key:1,class:`column-empty`},Oc=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:Oc,running:Oc,review:Oc,done:Oc}),l=S(()=>(r.store.version.value,W.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`} ${re(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`,hc,[(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`,_c,k(n.size),1)],8,gc),(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`,yc,[x(`span`,{class:M([`status-dot`,`is-`+(n.state===`needs_input`?`attention`:n.state===`failed`?`error`:n.state)])},null,2),x(`span`,bc,k(n.title||`Untitled session`),1)]),x(`div`,xc,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,Sc)):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,Cc)):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,wc)):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,Tc)):F(``,!0)])],42,vc))),128)),n.size>c[n.lane]?(i(),R(`button`,{key:0,class:`btn btn-ghost lane-more`,onClick:e=>c[n.lane]+=Oc},` Show `+k(Math.min(Oc,n.size-c[n.lane]))+` more `,9,Ec)):F(``,!0),n.size?F(``,!0):(i(),R(`p`,Dc,`Nothing here`))],2))),128))]))}}),Ac={key:0,class:`usage`},jc=[`aria-expanded`],Mc={class:`usage-name`},Nc={key:0,class:`usage-card`,role:`dialog`,"aria-label":`Usage limits`},Pc=[`disabled`],Fc={key:0,class:`spinner spinner-sm`},Ic={class:`usage-account-head`},Lc={class:`row-title`},Rc={class:`row-sub`},zc={key:0,class:`row-sub is-error`},Bc={class:`usage-window-head`},Vc={class:`usage-bar`},Hc={class:`usage-window-foot`},Uc={class:`usage-foot`},Wc=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`,Ac,[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`,Mc,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`,Nc,[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`,Fc)):(i(),m(J,{key:1,name:`refresh`,size:14}))],8,Pc),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`,Ic,[x(`span`,Lc,k(e.name),1),x(`span`,Rc,k([e.plan,e.hosts.join(`, `)].filter(Boolean).join(` · `)),1)]),e.error?(i(),R(`p`,zc,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`,Bc,[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`,Vc,[x(`span`,{class:M(`tone-`+u(e)),style:g({width:Math.max(0,Math.min(100,e.remainingPct??0))+`%`})},null,6)]),x(`div`,Hc,[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`,Uc,` 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)}}),Gc=[`aria-label`],Kc={class:`sheet-head task-head`},qc={class:`sheet-body task-body`},Jc={class:`task-meta`},Yc=[`value`,`disabled`],Xc={class:`task-link`},Zc=[`title`],Qc={class:`card-link-name`},$c={key:1,class:`subtle small`},el=[`value`,`disabled`],tl=[`value`],nl=[`value`],rl={class:`task-section`},il={class:`task-actions`},al=[`disabled`],ol=[`innerHTML`],sl={class:`task-section`},cl={key:0,class:`subtle`},ll={key:0,class:`task-comments`},ul={class:`task-comment-head`},dl={class:`subtle small`},fl=[`disabled`,`onClick`],pl=[`innerHTML`],ml={class:`task-actions`},hl=[`disabled`],gl={class:`sheet-foot task-foot`},_l={class:`subtle small`},vl=[`disabled`],yl=2e4,bl=5e3,xl=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(()=>Sr(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:Sr(e.text),when:Rn(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 `+Rn(new Date(s.card.createdAt))),s.card.updatedAt&&e.push(`updated `+Rn(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 ee(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`,Kc,[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`,qc,[x(`div`,Jc,[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,Yc),x(`div`,Xc,[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`,Qc,k(r.linkedName),1)],8,Zc)):I.value?(i(),R(`span`,$c,`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,tl)):F(``,!0),(i(!0),R(b,null,z(r.links,e=>(i(),R(`option`,{key:e.key,value:e.key},k(e.label),9,nl))),128))],40,el)])]),x(`section`,rl,[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:yl,placeholder:`Markdown: what this task is, notes, checklists…`,onInput:n[6]||=e=>M(e.target),onKeydown:j},null,544),[[_,p.value]]),x(`div`,il,[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,al)])],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,ol)):(i(),R(`button`,{key:1,type:`button`,class:`task-empty`,onClick:y},`Add a description…`))]),x(`section`,sl,[x(`h3`,null,[n[13]||=d(`Comments `,-1),N.value.length?(i(),R(`span`,cl,k(N.value.length),1)):F(``,!0)]),N.value.length?(i(),R(`ol`,ll,[(i(!0),R(b,null,z(N.value,e=>(i(),R(`li`,{key:e.id,class:`task-comment`},[x(`div`,ul,[x(`span`,dl,k(e.when),1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Delete comment`,title:`Delete comment`,disabled:r.busy,onClick:t=>ee(e.id)},[t(J,{name:`trash`,size:13})],8,fl)]),x(`div`,{class:`prose`,innerHTML:e.html},null,8,pl)]))),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:bl,placeholder:`Write a comment… (Markdown, ⌘/Ctrl+Enter to post)`,onInput:n[9]||=e=>M(e.target),onKeydown:A},null,544),[[_,E.value]]),x(`div`,ml,[x(`button`,{class:`btn btn-primary`,disabled:r.busy||!E.value.trim()},`Comment`,8,hl)])],32)])]),x(`footer`,gl,[x(`span`,_l,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,vl)])],8,Gc)],32))}});function Sl(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 Cl={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`},wl=[`transform`],Tl={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`},El={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`},Dl=[`transform`],Ol=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`,Cl,[(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,wl)),64))])):n.value===`pi`?(i(),R(`svg`,Tl,[...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`,El,[(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,Dl)),64))])):(i(),m(J,{key:3,name:n.value===`gemini`?`sparkle`:`bot`,size:18,class:`provider-icon`},null,8,[`name`]))}}),kl={class:`agent-controls`},Al=[`title`],jl={class:`chip-text`},Ml=[`disabled`,`value`],Nl=[`value`],Pl=[`value`],Fl=[`title`],Il={class:`chip-text`},Ll=[`disabled`,`value`],Rl=[`value`],zl=[`title`],Bl={class:`chip-text`},Vl=[`disabled`,`value`],Hl={key:0,value:``,disabled:``},Ul=[`value`,`title`],Wl=[`aria-label`,`aria-pressed`,`title`,`disabled`,`onClick`],Gl={key:0,class:`chip-text`},Kl=[`title`],ql={key:1,class:`chip-text`},Jl={class:`chip-key`},Yl=[`aria-label`,`disabled`,`value`,`onChange`],Xl=[`value`],Zl=[`title`,`aria-label`],Ql={width:`18`,height:`18`,viewBox:`0 0 18 18`,"aria-hidden":`true`},$l=[`stroke-dasharray`],eu=3e5,tu=Ia(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<eu)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(Ol,{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,Nl)):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,Pl))),128))],40,Ml)],10,Al),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`,Il,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,Rl))),128))],40,Ll)],10,Fl)):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`,Bl,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`,Hl,`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,Ul))),128))],40,Vl)],10,zl)):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`,Gl,k(e.label),1))],10,Wl)):(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`,ql,[x(`span`,Jl,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,Xl))),128))],40,Yl)],10,Kl))],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`,Ql,[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,$l)])),x(`span`,null,k(I.value.percent)+`%`,1)],10,Zl)):F(``,!0)]))}}),[[`__scopeId`,`data-v-d1984eb2`]]),nu={class:`page`},ru={class:`page-head`},iu=[`disabled`],au={class:`page-body`},ou={key:0,class:`setting-note is-error`},su={class:`row-title`},cu={key:0,class:`field-grid`},lu={class:`field`},uu=[`disabled`,`title`],du=[`value`],fu={class:`field`},pu=[`disabled`],mu=[`value`],hu={class:`field`},gu=[`disabled`],_u=[`value`],vu={class:`field`},yu=[`disabled`],bu=[`value`],xu={class:`field`},Su={class:`field`},Cu={class:`field-grid`},wu={class:`field`},Tu={key:0,class:`field`},Eu=[`value`],Du={key:1,class:`field`},Ou={key:2,class:`field`},ku={class:`subtle small`},Au={key:1,class:`check-row`},ju={key:2,class:`check-row`},Mu={class:`form-actions`},Nu=[`disabled`],Pu={key:2,class:`timeline-empty`},Fu={key:3,class:`schedules-empty`},Iu={key:4,class:`card`},Lu={class:`card-row`},Ru={class:`grow`},zu={class:`row-title`},Bu={class:`row-sub`},Vu={class:`row-sub`},Hu={key:1,class:`schedule-status`},Uu={class:`schedule-actions`},Wu=[`disabled`,`onClick`],Gu=[`disabled`,`onClick`],Ku=[`disabled`,`onClick`],qu=[`disabled`,`onClick`],Ju=[`aria-expanded`,`onClick`],Yu=[`disabled`,`onClick`],Xu={key:0,class:`schedule-runs`},Zu={class:`schedule-prompt`},Qu={key:0,class:`subtle small`},$u={class:`run-when`},ed={class:`run-text`},td=[`onClick`],nd=Ia(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?Rn(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),ee=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 te=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}),ne=S(()=>V.value?.find(e=>e.id===B.value.provider)?.models??[]);n(ne,e=>{e.some(e=>e.id===B.value.model)||(B.value.model=e.find(e=>e.isDefault)?.id??e[0]?.id??``)});let U=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()}),W=e(null);function G(){W.value=null,I.value=!0,B.value.hostId||=ee.value[0]?.id??``}function re(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 ie(e,t){let n=t.target.config??{};W.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,...re(t.cadence.expression)},K.value=t.cadence.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,E.value=null,C(()=>document.querySelector(`.schedule-form`)?.scrollIntoView({block:`nearest`}))}let K=e(Intl.DateTimeFormat().resolvedOptions().timeZone);function q(){I.value=!1,W.value=null,K.value=Intl.DateTimeFormat().resolvedOptions().timeZone}async function ae(){if(!W.value)return oe();let{hostId:e,id:t,newAgent:n}=W.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:U.value,timezone:K.value,...n?{cwd:B.value.cwd,provider:B.value.provider,model:B.value.model||null,archiveOnFinish:B.value.archive}:{}}),q(),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:U.value,timezone:K.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`,nu,[x(`header`,ru,[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:!ee.value.length,onClick:G},[t(J,{name:`plus`,size:15}),n[13]||=d(`New schedule`,-1)],8,iu)]),x(`div`,au,[f.value?(i(),R(`p`,ou,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`,su,k(W.value?`Edit schedule`:`New schedule`),1),!W.value||W.value.newAgent?(i(),R(`div`,cu,[x(`label`,lu,[n[15]||=x(`span`,null,`Host`,-1),a(x(`select`,{"onUpdate:modelValue":n[1]||=e=>B.value.hostId=e,required:``,disabled:!!W.value,title:W.value?`A schedule stays on its host`:void 0},[(i(!0),R(b,null,z(ee.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,du))),128))],8,uu),[[N,B.value.hostId]])]),x(`label`,fu,[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(te.value,e=>(i(),R(`option`,{key:e.key,value:e.rootPath},k(e.name),9,mu))),128))],8,pu),[[N,B.value.cwd]])]),x(`label`,hu,[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,_u))),128))],8,gu),[[N,B.value.provider]])]),x(`label`,vu,[n[18]||=x(`span`,null,`Model`,-1),a(x(`select`,{"onUpdate:modelValue":n[4]||=e=>B.value.model=e,disabled:!ne.value.length},[(i(!0),R(b,null,z(ne.value,e=>(i(),R(`option`,{key:e.id,value:e.id},k(e.label),9,bu))),128))],8,yu),[[N,B.value.model]])])])):F(``,!0),x(`label`,xu,[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`,Su,[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`,Cu,[x(`label`,wu,[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`,Tu,[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,Eu)),64))],512),[[N,B.value.day]])])):F(``,!0),B.value.preset===`cron`?(i(),R(`label`,Ou,[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`,Du,[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(U.value))+` · `+k(K.value),1),!W.value||W.value.newAgent?(i(),R(`label`,Au,[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),W.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`,Mu,[x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:q},`Cancel`),x(`button`,{class:`btn btn-primary`,disabled:p.value===`create`||!B.value.prompt.trim()||(!W.value||W.value.newAgent)&&!B.value.cwd},k(W.value?`Save changes`:`Create schedule`),9,Nu)])],32)):F(``,!0),u.value?!y.value.length&&!I.value?(i(),R(`div`,Fu,[t(J,{name:`clock`,size:22}),n[28]||=x(`p`,null,`No schedules yet.`,-1)])):(i(),R(`div`,Iu,[(i(!0),R(b,null,z(y.value,({hostId:e,s:n})=>(i(),R(`div`,{key:e+n.id,class:`schedule`},[x(`div`,Lu,[x(`span`,{class:M([`setting-icon`,{paused:n.status!==`active`}])},[t(J,{name:`clock`,size:16})],2),x(`div`,Ru,[x(`div`,zu,k(n.name||n.target.config?.title||n.prompt.slice(0,60)),1),x(`div`,Bu,[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`,Vu,[n.status===`active`?(i(),R(b,{key:0},[d(`Next `+k(P(n.nextRunAt)),1)],64)):(i(),R(`span`,Hu,k(n.status),1)),d(` · Last `+k(P(n.lastRunAt)),1)])]),x(`div`,Uu,[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,Wu),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,Gu)):(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,Ku)),x(`button`,{class:`icon-btn`,title:`Edit`,"aria-label":`Edit schedule`,disabled:p.value===n.id,onClick:t=>ie(e,n)},[t(J,{name:`edit`,size:14})],8,qu),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,Ju),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,Yu)])]),E.value===n.id?(i(),R(`div`,Xu,[x(`p`,Zu,k(n.prompt),1),D.value.length?F(``,!0):(i(),R(`p`,Qu,`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`,$u,k(P(t.startedAt)),1),x(`span`,ed,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,td)):F(``,!0)],2))),128))])):F(``,!0)]))),128))])):(i(),R(`div`,Pu,[...n[27]||=[x(`span`,{class:`spinner`},null,-1),d(`Loading schedules…`,-1)]]))])]))}}),[[`__scopeId`,`data-v-1a9bb929`]]),rd=[`disabled`,`aria-label`,`title`,`onKeydown`],id={key:0,class:`spinner spinner-sm`},ad={class:`rec-time`},od=24e3,sd=300,cd=Ia(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=od,E=``;function D(e){let t=T/od,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>od*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:od})}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,sd*od-_);h.push(n),g+=n.length,_+=n.length,g>od*12?j(`Voice connection is taking too long. Please try again.`):(N(),s.value=Math.floor(_/od),_>=sd*od&&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(),_<od/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`,id)):o.value===`recording`?(i(),R(b,{key:1},[n[0]||=x(`span`,{class:`rec-dot`},null,-1),x(`span`,ad,k(H(s.value)),1)],64)):(i(),m(J,{key:2,name:`mic`,size:17}))],42,rd),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`]]),ld={key:0,class:`login`},ud={class:`field`},dd={class:`field`},fd=[`disabled`],pd={key:1,class:`form-error`},md={class:`sidebar`},hd=[`aria-valuenow`],gd={class:`side-nav`,"aria-label":`Pages`},_d={class:`hide-sm`},vd={class:`side-section`},yd={class:`side-label`},bd={class:`list-summary`},xd=[`aria-expanded`],Sd={key:0,class:`view-menu`},Cd={class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Group sessions`},wd=[`aria-checked`],Td=[`aria-checked`],Ed={key:0,class:`host-filter`,role:`radiogroup`,"aria-label":`Filter by host`},Dd=[`aria-checked`],Od={class:`chip-count`},kd=[`aria-checked`,`title`,`onClick`],Ad={class:`chip-count`},jd={class:`side-foot`},Md=[`title`],Nd=[`title`,`aria-label`],Pd={key:0,class:`foot-alert`,"aria-hidden":`true`},Fd=[`title`,`aria-label`],Id={class:`main`},Ld={key:0,class:`toast`,role:`alert`},Rd={key:2,class:`page`},zd={class:`page-head`},Bd={class:`page-body`},Vd={class:`card`},Hd={class:`grow`},Ud={class:`row-title`},Wd={class:`row-sub`},Gd={key:0,role:`status`},Kd={key:1,class:`row-sub`},qd={key:2,class:`row-sub`},Jd={key:3,class:`row-sub`},Yd=[`disabled`,`onClick`],Xd={key:0,class:`card-row muted-text`},Zd={class:`field`},Qd={class:`field`},$d={class:`form-actions`},ef=[`disabled`],tf={key:4,class:`page`},nf={class:`page-head`},rf={class:`subtle`},af={class:`segmented head-toggle`,role:`radiogroup`,"aria-label":`Board`},of={class:`page-body wide`},sf=[`value`],cf=[`disabled`],lf={class:`board`},uf={class:`column-head`},df={class:`count`},ff=[`aria-label`,`onClick`],pf={class:`row-title`},mf={key:0,class:`kanban-excerpt`},hf={key:0,class:`card-link`},gf=[`title`,`onClick`],_f={class:`card-link-name`},vf={key:1,class:`subtle small`},yf=[`disabled`,`onClick`],bf=[`disabled`,`onChange`],xf=[`value`],Sf={class:`kanban-actions`},Cf=[`value`,`onChange`],wf=[`title`,`onClick`],Tf=[`onClick`],Ef=[`onClick`],Df={key:0,class:`column-empty`},Of={class:`chat`},kf={class:`chat-head`},Af=[`title`],jf=[`title`],Mf=[`title`],Nf={key:0,class:`agent-tabs`,"aria-label":`Tabs`},Pf=[`onClick`],Ff={class:`agent-tab-name`},If=[`title`,`onClick`,`onAuxclick`],Lf={class:`agent-tab-name`},Rf=[`aria-label`,`onClick`],zf={class:`timeline-wrap`},Bf={class:`timeline-inner`},Vf={key:0,class:`older`},Hf={key:0,class:`older-loading`,role:`status`},Uf={key:1,class:`notice`},Wf={key:0,class:`turn-footer`},Gf=[`aria-label`,`title`,`onClick`],Kf=[`title`],qf=[`title`],Jf=[`title`],Yf={key:2,class:`older`},Xf={key:0,class:`older-loading`,role:`status`},Zf={key:3,class:`timeline-working`,role:`status`,"aria-label":`Agent is working`},Qf={key:0,class:`timeline-elapsed`,"aria-hidden":`true`},$f={key:1},ep={key:4,class:`timeline-empty`},tp={key:0,class:`spinner`},np={class:`dock`},rp={class:`dock-inner`},ip={key:0,role:`status`},ap={key:1,role:`status`},op={key:2,class:`composer-notice`,role:`status`},sp={key:3},cp={style:{"white-space":`pre-wrap`}},lp=[`onClick`],up={key:4,class:`uncertain`},dp={class:`grow`},fp=[`disabled`],pp={key:5,class:`send-queue`,role:`list`,"aria-label":`Queued messages`},mp={class:`queue-body`},hp=[`disabled`,`onClick`],gp=[`title`],_p={key:2,class:`queue-meta`},vp={key:3,class:`queue-meta queue-error`},yp=[`disabled`,`title`,`onClick`],bp=[`disabled`,`onClick`],xp=[`disabled`,`onClick`],Sp=[`placeholder`,`required`],Cp={class:`composer-bar`},wp=[`title`,`disabled`],Tp={class:`composer-actions`},Ep=[`aria-label`,`title`],Dp=[`disabled`],Op=[`disabled`],kp={key:0,class:`side-panel`,"aria-label":`Files`},Ap={class:`panel-tabs`},jp={class:`panel-body`},Mp={key:6,class:`empty`},Np={key:7,class:`empty`},Pp={class:`empty-mark`},Fp=[`src`],Ip=280,Lp=900,Rp=420,zp=220,Bp=520,Vp=300,Hp=f({__name:`App`,setup(r){let s=I(()=>Or(()=>import(`./FilesPanel-CXGp_iej.js`),__vite__mapDeps([5,1,2,6]))),c=I(()=>Or(()=>import(`./FileViewer-B3OHD2lY.js`),__vite__mapDeps([7,1,2,3,8]))),f=I(()=>Or(()=>import(`./TerminalPanel-CNNWUGNL.js`),__vite__mapDeps([9,1,2,10]))),p=[`Todo`,`Doing`,`Done`],h=matchMedia(`(pointer: coarse)`).matches,w=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),E=e(!1),O=e(localStorage.getItem(`litepaseo-panel`)===`files`?`files`:null);n(O,e=>e?localStorage.setItem(`litepaseo-panel`,e):localStorage.removeItem(`litepaseo-panel`));let j=e=>O.value=O.value===e?null:e,B=u(new Map),V=S(()=>B.has(U.value)),H=S(()=>B.get(U.value)===!0);function ee(){B.set(U.value,!0),G.value=null,zn.matches&&(O.value=null)}function te(){B.has(U.value)&&B.set(U.value,!1),G.value=null}let ne=u(new Map),U=S(()=>we.value??X.value??``),W=S(()=>ne.get(U.value)?.paths??[]),G=S({get:()=>ne.get(U.value)?.active??null,set:e=>{let t=ne.get(U.value);t&&(t.active=e),e&&B.has(U.value)&&B.set(U.value,!1)}});function re(e){let t=U.value;if(!t)return;let n=ne.get(t)??{paths:[],active:null};n.paths.includes(e)||(n.paths=[...n.paths,e].slice(-12)),n.active=e,B.has(t)&&B.set(t,!1),ne.set(t,n),zn.matches&&(O.value=null)}function ie(e){let t=ne.get(U.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 K=e=>Math.round(Math.min(Lp,Math.max(Ip,e))),q=e(K(Number(localStorage.getItem(`litepaseo-panel-width`))||Rp));function oe(e){q.value=K(e),localStorage.setItem(`litepaseo-panel-width`,String(q.value))}function se(e){if(e.button!==0)return;let t=e.currentTarget,n=e.clientX,r=q.value;t.setPointerCapture(e.pointerId),ue.value=!0;let i=e=>q.value=K(r-(e.clientX-n)),a=()=>{ue.value=!1,oe(q.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 ce=e=>Math.round(Math.min(Bp,Math.max(zp,e))),le=e(ce(Number(localStorage.getItem(`litepaseo-sidebar-width`))||Vp)),ue=e(!1);function de(e){le.value=ce(e),localStorage.setItem(`litepaseo-sidebar-width`,String(le.value))}function pe(e){if(e.button!==0)return;let t=e.currentTarget,n=e.clientX,r=le.value;t.setPointerCapture(e.pointerId),ue.value=!0;let i=0,a=e=>{i&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>le.value=ce(r+e.clientX-n))},o=()=>{cancelAnimationFrame(i),ue.value=!1,de(le.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 me(e,t){try{return JSON.parse(localStorage.getItem(e)??`null`)??t}catch{return t}}let he=e(``),ge=e(``),ve=e(null),ye=e(!1),be=e(``),Y=e(!1),xe=y([]),Se=new fe({collapsed:me(`litepaseo-collapsed-projects`,[]),persist:e=>localStorage.setItem(`litepaseo-collapsed-projects`,JSON.stringify(e)),compare:ae}),Ce=new fe({indexBy:e=>e.workspaceId?`${e.hostId}:${e.workspaceId}`:null}),we=e(null),Te=e(localStorage.getItem(`litepaseo-list-mode`)===`recent`?`recent`:`projects`),De=e(`closed`),X=e(null),ke=y(new un),Ae=e(``),je=y(null),Me=e(!1),Ne=e([]),Pe=e(null),Fe=e(null),Ie=e(null),Le=e(``),Re=e(!1),ze=e(``),Be=e(``),Ve=e(`steer`),He=e(`chat`),Ue=e(``),We=e(``),Ge=e({revision:0,cards:[]}),Z=new sn(()=>localStorage),Ke=new Ra,qe=e([]),Je=new Map,Ye=e(null),Xe=e(``),Ze=0;async function Qe(){let e=Q.value,t=++Ze;if(!e||!ye.value)qe.value=[];else try{let n=await $(_n(e)+`/queue`);t===Ze&&Q.value?.key===e.key&&(qe.value=Array.isArray(n)?n:[])}catch{}}n(X,()=>{qe.value=[],Qe()});let $e=setInterval(()=>void Qe(),2e3);l(()=>clearInterval($e));let et=e(null),tt=e(null),nt=S(()=>{let e=tt.value?.modelLabel;return e&&e!==`Model`?e:``}),rt=S(()=>X.value?Ke.get(X.value):[]),it=e(!1),at=e(``),ot=e(null);n(at,()=>{let e=ot.value;e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});async function st(){try{it.value=!!(await $(`/dictation`)).configured}catch{}}let ct=e(``),lt;function ut(e){ct.value=e,clearTimeout(lt),lt=setTimeout(()=>ct.value=``,8e3)}function dt(e){let t=Ie.value,n=_t.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)?` `:``;_t.value=a+s+e+o,C(()=>{if(!t)return;t.focus();let n=(a+s+e).length;t.setSelectionRange(n,n),Gr()})}let ft=S(()=>!!_t.value.trim()||rt.value.length>0),pt=e(!1);function mt(e){e.currentTarget.contains(e.relatedTarget)||(pt.value=!1)}let ht=S(()=>rt.value.every(e=>!!e.id&&!e.uploading&&!e.error));function gt(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(),et.value?.addFiles(n))}let _t=S({get:()=>X.value?Z.state(X.value).text:``,set:e=>{X.value&&Z.setText(X.value,e)}}),vt=S(()=>X.value?Z.unresolved(X.value)[0]??null:null),yt=S(()=>X.value?Z.saved(X.value).filter(e=>e.text!==_t.value):[]),bt=e(!1),xt=e(``);async function St(){let e=Q.value;if(!e||Y.value||bt.value||document.hidden)return;let t=Z.unresolved(e.key);if(!t.length)return;let n=Z.generation;bt.value=!0;try{let r=await $(_n(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&&(Ke.consume(e.key,r.attachmentIds??[]),Z.confirm(e.key,n))}Q.value?.key===e.key&&(xt.value=r.confirmed?.length?`Delivery confirmed from conversation history.`:`Not confirmed yet. No message has been resent.`)}catch{Q.value?.key===e.key&&(xt.value=`Unable to check delivery. Your message remains saved.`)}finally{bt.value=!1}}let Ct=setInterval(()=>void St(),15e3);n([X,Y],()=>{xt.value=``,St()});function wt(){X.value&&vt.value&&Z.resolve(X.value,vt.value.messageId)}function Tt(e){e.storageArea===localStorage&&(e.key===`litepaseo-composer-signout`?Z.clear():Z.onStorage(e.key,e.newValue))}window.addEventListener(`storage`,Tt);let Et=S(()=>new Map(xe.value.map(e=>[e.id,e.label]))),Dt=S(()=>new Map(xe.value.map(e=>[e.id,e.state]))),Ot=S(()=>xe.value.filter(e=>e.state===`connected`).length),Q=S(()=>(Ce.version.value,Ce.get(X.value)??null)),kt=S(()=>(Se.version.value,Se.get(we.value)??null)),At=S(()=>(Ce.version.value,Ce.indexed(we.value,12))),jt=S(()=>(Se.version.value,Se.total)),Mt=S(()=>(Se.version.value,Se.size)),Nt=S(()=>(Se.version.value,Se.projectCount));n(Te,e=>localStorage.setItem(`litepaseo-list-mode`,e));let Pt=e(localStorage.getItem(`litepaseo-host-filter`));n(Pt,e=>{Se.setHost(e),Ce.setHost(e),e?localStorage.setItem(`litepaseo-host-filter`,e):localStorage.removeItem(`litepaseo-host-filter`)},{immediate:!0}),n(xe,e=>{Pt.value&&e.length&&!e.some(e=>e.id===Pt.value)&&(Pt.value=null)});let Ft=S(()=>(Se.version.value,new Map(xe.value.map(e=>[e.id,Se.hostSize(e.id)])))),It=S(()=>kt.value?.directory||Q.value?.cwd||``),Lt=S(()=>{let e=Q.value?.cwd??``;return e.replace(/\/+$/,``).split(`/`).pop()||e}),Rt=S(()=>Q.value?.status===`running`),zt=S(()=>!je.value&&Q.value?.state===`running`),Bt=e(Date.now()),Vt=S(()=>zt.value?Q.value?.turnStartedAt??null:null),Ht=S(()=>Vt.value?Sl(Bt.value-Vt.value):``),Ut=S(()=>Vt.value?Math.max(0,Math.floor((Bt.value-Vt.value)/1e3)):0),Wt;function Gt(){clearTimeout(Wt),Wt=void 0;let e=Vt.value;if(!e||document.hidden)return;let t=()=>{Bt.value=Date.now();let n=(Bt.value-e)%1e3;Wt=setTimeout(t,(n<0?-n:1e3-n)+10)};t()}n(Vt,Gt,{immediate:!0}),document.addEventListener(`visibilitychange`,Gt);let Kt=S(()=>{if(je.value)return je.value;let e=ke.value;return e.membership.value,e.rows.slice(-150)}),qt=S(()=>De.value===`live`&&Dt.value.get(Q.value?.hostId??``)===`connected`&&Q.value?.turnActive===!1),Jt=S(()=>{let e=Kt.value.map(e=>e.row.value),t=Q.value;return Bn(e,!!je.value&&Ne.value.length>0||!!t&&!(t.turnActive??t.state===`running`))}),Yt=e(null),Xt;async function Zt(e,t){let n=new Set(t),r=Kt.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),Yt.value=e,clearTimeout(Xt),Xt=setTimeout(()=>Yt.value=null,1500)}catch{}}let Qt=e(!1);async function $t(e,t,n){let r=Q.value;if(r&&!Qt.value){Qt.value=!0,be.value=``;try{await $(_n(r)+`/rewind`,`POST`,{messageId:e,mode:n},12e4),n!==`files`&&X.value===r.key&&!_t.value.trim()&&(_t.value=t,C(Gr)),X.value===r.key&&ut(n===`files`?`Files rewound.`:n===`both`?`Conversation and files rewound.`:`Conversation rewound.`)}catch(e){be.value=String(e.message)}finally{Qt.value=!1}}}let en=y({base:``,cwd:``});n(Q,e=>{let t=e?`/api`+_n(e):``,n=e?.rewind??[],r=en.value;(t!==r.base||(e?.cwd??``)!==r.cwd||n.join()!==(r.rewindModes??[]).join())&&(en.value={base:t,cwd:e?.cwd??``,rewindModes:n,rewinding:Qt,rewind:(e,t,n)=>void $t(e,t,n)})},{immediate:!0}),o(bn,en);let tn=e(null);function rn(e){let t=e.target;t instanceof HTMLImageElement&&t.closest(`.prose`)&&(tn.value=t.currentSrc||t.src)}let an=S(()=>{let e=ke.value;return e.membership.value,e.rows.at(-1)?.seqStart}),on=S(()=>{if(je.value)return Me.value;let e=ke.value;return e.membership.value,e.rows.length>150||e.hasOlder}),cn=S(()=>{let e=new Map(p.map(e=>[e,[]]));for(let t of Ge.value.cards)e.get(t.column)?.push(t);return e}),ln=S(()=>De.value===`live`?`Live`:De.value===`paused`?`Paused`:`Reconnecting`),fn=null,pn=null,mn;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&&ye.value&&e!==`/login`&&vn(`ended`),!i.ok)throw Object.assign(Error((a.error??`Request failed`)+(a.requestId?` (reference ${a.requestId})`:``)),{delivery:a.delivery,code:a.code,scope:a.scope});return a}async function hn(e){Y.value=!0,be.value=``;try{await e()}catch(e){be.value=String(e.message)}finally{Y.value=!1}}function _n(e){return`/hosts/${encodeURIComponent(e.hostId)}/agents/${encodeURIComponent(e.id)}`}function vn(e){if(ye.value=!1,e===`user`){Z.clear(),qe.value=[],Ze++,Ke.clear();try{localStorage.setItem(`litepaseo-composer-signout`,crypto.randomUUID())}catch{}}else Ke.forgetRemote(`Sign in again, then retry the upload.`);fn?.close(),pn?.close(),fn=pn=null,he.value=ge.value=``,xn(),be.value=e===`ended`?`Your session ended. Sign in again; your drafts are kept.`:``}async function xn(){try{ve.value=await $(`/auth`)}catch{ve.value={authenticated:!1,totp:!1};return}ve.value.authenticated&&await Cn()}async function Sn(){await hn(async()=>{await $(`/login`,`POST`,{token:he.value.trim(),...ve.value?.totp?{code:ge.value.trim()}:{}}),he.value=ge.value=``,await Cn()})}async function Cn(){ye.value=!0,be.value=``,Ge.value=await $(`/board`),Tn(),Mo(),Mr(),wr(),st(),clearInterval(Cr),Cr=setInterval(()=>void wr(),3e5);let e=new URLSearchParams(location.search).get(`session`);e&&(history.replaceState(history.state,``,`/`),Ln(e))}function wn(){ge.value=ge.value.replace(/\D/g,``).slice(0,6)}navigator.serviceWorker?.addEventListener(`message`,e=>{e.data?.type===`open-session`&&ye.value&&Ln(String(e.data.key))});function Tn(){fn?.close(),fn=yn({url:()=>`/api/stream?generation=${encodeURIComponent(Ce.generation)}&since=${Ce.seq}&wgeneration=${encodeURIComponent(Se.generation)}&wsince=${Se.seq}`,onState:e=>{De.value=e,e===`unauthorized`&&vn(`ended`)},onMessage:e=>{let t=e;t.type===`hosts`?xe.value=t.hosts:t.type===`workspaces-snapshot`?Se.applyCollection({type:`snapshot`,generation:t.generation,seq:t.seq,items:t.workspaces}):t.type===`workspaces-changes`?Se.applyCollection({type:`changes`,generation:t.generation,seq:t.seq,changes:t.changes}):Ce.apply(t)}})}n(Le,e=>{clearTimeout(mn),mn=setTimeout(()=>{let t=e.trim().toLowerCase();if(!t){Se.setFilter(null),Ce.setFilter(null);return}let n=Et.value;Se.setFilter(e=>`${e.name}\n${e.project}\n${e.branch??``}\n${e.directory}\n${n.get(e.hostId)??``}`.toLowerCase().includes(t)),Ce.setFilter(e=>`${e.title??``}\n${e.project}\n${e.cwd}\n${n.get(e.hostId)??``}\n${e.provider}`.toLowerCase().includes(t))},120)});let En=!0;n(Fe,(e,t,n)=>{let r=e?.querySelector(`.timeline-inner`);if(!e||!r)return;let i=e.scrollTop,a=()=>{let t=e.scrollTop;Fn()?En=!0:t<i-1&&(En=!1),Hr();let n=kn!==null&&Math.abs(t-kn)<2;n&&(kn=null),!n&&performance.now()>=On&&(t<i-1?Dn=`up`:t>i+1&&(Dn=`down`),jn()),i=t},o=new ResizeObserver(()=>{!je.value&&En&&In()}),s=e=>{performance.now()<On||!e.deltaY||(Dn=e.deltaY<0?`up`:`down`,jn())};e.addEventListener(`scroll`,a,{passive:!0}),e.addEventListener(`wheel`,s,{passive:!0}),o.observe(r),o.observe(e),n(()=>{o.disconnect(),e.removeEventListener(`scroll`,a),e.removeEventListener(`wheel`,s)})},{flush:`post`});let Dn=null,On=0,kn=null;function An(e,t){e.scrollTop=t,kn=e.scrollTop,On=performance.now()+40}function jn(){let e=Fe.value;if(!e||Pe.value||!Dn||e.offsetParent===null)return;let t=Math.max(600,e.clientHeight);Dn===`up`&&e.scrollTop<t&&on.value?jr(`before`):Dn===`down`&&je.value&&e.scrollHeight-e.scrollTop-e.clientHeight<t&&jr(`after`)}function Mn(e){let t=Fe.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 Nn(e){let t=Fe.value,n=e&&t?.querySelector(`[data-seq-start="${e.seq}"]`);return!t||!n?!1:(An(t,t.scrollTop+n.getBoundingClientRect().top-e.top),!0)}async function Pn(){let e=Mn(`last`);je.value=null,Ne.value=[],await C(),Nn(e)?Fn()&&(En=!0):In()}function Fn(){let e=Fe.value;return!e||e.scrollHeight-e.scrollTop-e.clientHeight<120}function In(){En=!0,C(()=>{let e=Fe.value;e&&(e.scrollTop=e.scrollHeight)})}function Ln(e){He.value=`chat`,X.value=e;let t=Ce.get(e);we.value=t?.workspaceId?`${t.hostId}:${t.workspaceId}`:null,Vn()}function Rn(e){He.value=`chat`,we.value=e,X.value=Ce.indexed(e,1)[0]?.key??null,Vn()}n(Q,e=>{e?.workspaceId&&!we.value&&(we.value=`${e.hostId}:${e.workspaceId}`)}),n(At,e=>{we.value&&e.length&&!e.some(e=>e.key===X.value)&&(X.value=e[0].key)});let zn=matchMedia(`(max-width: 760px)`);function Vn(){!Re.value&&zn.matches&&history.pushState({litepaseoDetail:!0},``),Re.value=!0}function Hn(){history.state?.litepaseoDetail?history.back():Re.value=!1}function Un(){Re.value&&!history.state?.litepaseoDetail&&(Re.value=!1)}window.addEventListener(`popstate`,Un);let Wn=e(null);function Gn(e){let t=e.target,n=!!t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName));e.key===`Escape`&&tn.value?tn.value=null:e.key===`k`&&(e.metaKey||e.ctrlKey)||e.key===`/`&&!n?(e.preventDefault(),Re.value&&zn.matches&&Hn(),Wn.value?.focus(),Wn.value?.select()):e.key===`n`&&!n&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&ye.value&&!Kn.value?(e.preventDefault(),qn()):e.key===`Escape`&&t===Wn.value&&Le.value&&(Le.value=``)}window.addEventListener(`keydown`,Gn);let Kn=e(null);function qn(e){let t=e?e.items.at(0):Se.range(0,1)[0];Kn.value={hostId:Pt.value??t?.hostId??Q.value?.hostId??null,cwd:t?.rootPath??null,project:t?{key:t.projectKey,name:t.project}:null}}function Jn(e){Kn.value=null,Le.value&&=``,Ln(e)}let Yn=S(()=>(!!X.value||!!we.value)&&!Q.value),Xn=y(null),Zn=y(null);function Qn(e){return`/hosts/${encodeURIComponent(e.hostId)}/workspaces/${encodeURIComponent(e.id)}`}function $n(e,t,n){Xn.value={thread:e,x:t,y:n}}function er(e){let t=kt.value;if(!t)return;let n=e.currentTarget.getBoundingClientRect();$n(t,n.right-200,n.bottom+6)}async function tr(e){let t=Zn.value;t&&await hn(async()=>{await $(Qn(t)+`/title`,`POST`,{title:e}),Zn.value=null})}async function nr(e,t){await hn(async()=>void await $(Qn(e)+`/pin`,`POST`,{pinned:t}))}async function rr(e){await hn(async()=>{await $(Qn(e)+`/unread`,`POST`,{}),we.value===e.key&&(we.value=X.value=null,Hn())})}async function ir(e){await hn(async()=>void await $(Qn(e)+`/read`,`POST`,{}))}async function ar(e){confirm(`Archive “${e.name}”? It leaves the sidebar; the host keeps its history.`)&&await hn(async()=>{await $(Qn(e)+`/archive`,`POST`,{}),we.value===e.key&&(we.value=X.value=null)})}let or=y(null),sr=y(null),cr=S(()=>{Se.version.value;let e=sr.value;if(!e)return null;let t=e.threadKeys.map(e=>Se.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 lr(e,t,n){let r=e.items.range(0,e.items.size),i=r[0];i&&(or.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 ur(e){let t=Et.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 hn(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);we.value&&e.threadKeys.includes(we.value)&&(we.value=X.value=null)})}let dr=``;n(()=>kt.value?.unread&&ke.value.membership.value>=0&&ke.value.ready?kt.value:null,e=>{if(!e||document.hidden)return;let t=`${e.key}@${e.activityAt}`;dr!==t&&(dr=t,$(Qn(e)+`/read`,`POST`,{}).catch(()=>dr=``))});let fr=e(localStorage.getItem(`litepaseo-board-mode`)===`plan`?`plan`:`agents`);n(fr,e=>localStorage.setItem(`litepaseo-board-mode`,e));async function pr(e){await hn(async()=>void await $(_n(e)+`/stop`,`POST`))}async function mr(e){await hn(async()=>void await $(_n(e)+`/read`,`POST`,{}))}async function gr(e){confirm(`Archive “${e.title||`this session`}”? It leaves the board and sidebar; the host keeps its history.`)&&await hn(async()=>void await $(_n(e)+`/archive`,`POST`,{}))}let _r=``;n(()=>Q.value&&Q.value.unread&&ke.value.membership.value>=0&&ke.value.ready?Q.value:null,e=>{if(!e||document.hidden)return;let t=`${e.key}@${e.activityAt}`;_r!==t&&(_r=t,$(_n(e)+`/read`,`POST`,{}).catch(()=>_r=``))});let vr=e(null);o(Nr,{predict:e=>{let t=Q.value;return t?$(_n(t)+`/suggestion`,`POST`,{token:e},65e3):Promise.resolve({status:`expired`,text:``})},use:e=>{_t.value=e,C(()=>{Gr(),Ie.value?.focus()})},send:e=>void Yr(e),offer:(e,t)=>{let n=Q.value;n&&(!vr.value||vr.value.key!==n.key||e>=vr.value.seqStart)&&(vr.value={key:n.key,seqStart:e,text:t})}});let yr=S(()=>vr.value&&vr.value.key===Q.value?.key&&!_t.value?vr.value.text:``),br=S(()=>yr.value&&!h?yr.value:Rt.value?Ve.value===`steer`?`Queue a message for when this turn ends`:`Interrupt and send a new message`:`Message this agent…`),xr=y(null),Sr=e(!1),Cr;async function wr(e=!1){if(ye.value&&!document.hidden){Sr.value=!0;try{xr.value=await $(`/usage`+(e?`?refresh=1`:``))}catch{}finally{Sr.value=!1}}}n(X,()=>{vr.value=null}),n(()=>Q.value?.key??null,e=>{pn?.close(),pn=null;let t=new un;ke.value=t,je.value=null,Ne.value=[],Ae.value=``;let n=Ce.get(e);n&&(pn=yn({url:()=>`/api`+_n(n)+`/timeline/stream`,onState:e=>{e===`unauthorized`&&vn(`ended`)},onMessage:e=>{if(ke.value!==t)return;let r=!je.value&&(Fn()||!t.ready),i=e.ops,a=i.find(e=>e.type===`error`);Ae.value=a?.type===`error`?a.message:``;let o=t.epoch;t.apply(i),t.epoch&&t.epoch!==Ir&&Lr(n,t),o&&o!==t.epoch&&(je.value=null,Ne.value=[],In()),r&&In()}}))});function Tr(){je.value=null,Ne.value=[],In()}function Er(e,t,n){return $(_n(e)+`/timeline?cursor=`+encodeURIComponent(JSON.stringify({epoch:t,seq:n})))}let Dr=new Set,kr=4;async function Ar(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=Ne.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}Ne.value.push(e[0].seqStart);continue}o++;let l=Ne.value,u=e=>!e.hasOlder||e.rows.some(e=>e.seqStart<=s),d=Dr.has(c)?0:Math.min(kr,l.length-1);if(d>0){let t=l.length-1-d,r=await Er(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)}))),kr=Math.min(kr*2,64);continue}kr=d>>1;continue}let f=await Er(e,n,c);if(f.epoch!==n)return`stale`;let p=f.rows.filter(e=>e.seqStart>s),m=!0;for(;!Dr.has(c)&&p.length&&f.hasOlder&&!f.rows.some(e=>e.seqStart<=s)&&o<8;){o++;let t=p[0].seqStart,r=await Er(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&&Ne.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 jr(e){let t=ke.value,n=Fe.value,r=Kt.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||Pe.value)return;let o=t.epoch;Pe.value=e;try{let s=()=>ke.value===t&&t.epoch===o&&Q.value?.key===a.key;if(e===`before`){let e=await Er(a,o,i.seqStart);if(!s())return;if(e.epoch!==o)return Tr();let t=Mn(`first`),c=dn(r,e,`before`);c.added&&(Ne.value.push(r.at(-1).seqStart+1),Dr.add(r.at(-1).seqStart+1)),je.value=c.rows,Me.value=c.hasOlder,await C(),!Nn(t)&&n&&(n.scrollTop=0)}else{let e=await Ar(a,t,o,i.seqStart);if(!s())return;if(e===`stale`)return Tr();let c=t.rows.at(-1)?.seqStart,l=[...r,...e??[]].slice(-150);if(!e||c!==void 0&&l.at(-1).seqStart>=c){Ne.value=[],await Pn();return}let u=Mn(`last`);je.value=l,Me.value=!0,await C(),!Nn(u)&&n&&(n.scrollTop=n.scrollHeight)}}catch(e){be.value=String(e.message),Dn=null}finally{Pe.value=null}C(jn)}let Pr=matchMedia(`(hover: hover) and (pointer: fine)`).matches,Fr=y(null),Ir=``;async function Lr(e,t){Ir=t.epoch;try{let n=await $(_n(e)+`/timeline/prompts`);ke.value===t&&n.epoch===t.epoch&&(Fr.value={key:e.key,prompts:n.prompts})}catch{ke.value===t&&(Fr.value={key:e.key,prompts:[]})}}n(()=>Q.value?.key,()=>{Fr.value=null,Ir=``,Dr.clear()});let Rr=e=>String(e.item.text??``).replace(/\s+/g,` `).trim().slice(0,240),zr=S(()=>{let e=ke.value;e.membership.value;let t=Fr.value?.key===Q.value?.key?Fr.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:Rr(t.row.value)});return r.length?[...t,...r]:t}),Br=e(null),Vr=0;function Hr(){Vr||zr.value.length<2||!Pr||(Vr=requestAnimationFrame(()=>{Vr=0;let e=Mn(`first`);Br.value=e?Number(e.seq):null}))}n([zr,je],()=>void C(Hr));function Ur(e){let t=Fe.value,n=t?.querySelector(`[data-seq-start="${e}"]`)??Array.from(t?.querySelectorAll(`[data-seq-start]`)??[]).find(t=>Number(t.dataset.seqStart)>=e);t&&n&&(En=!1,An(t,t.scrollTop+n.getBoundingClientRect().top-t.getBoundingClientRect().top-12),Hr())}async function Wr(e){let t=Q.value,n=ke.value;if(!t||Pe.value)return;if(Fe.value?.querySelector(`[data-seq-start="${e}"]`))return Ur(e);let r=n.rows,i=r.length&&r[0].seqStart<=e?r.findIndex(t=>t.seqStart>=e):-1;if(i>=0){let t=i;return Ne.value=[],t>=r.length-150?je.value=null:(je.value=r.slice(t,t+150),Me.value=t>0||n.hasOlder),await C(),Ur(e)}let a=n.epoch,o=zr.value.map(e=>e.seq).filter(t=>t>e&&(!r.length||t<r[0].seqStart));Pe.value=`before`;try{let i=o[0]??r[0]?.seqStart??2**53-1,s=[],c=!1;for(let r=0;r<8;r++){let r=await Er(t,a,i);if(ke.value!==n||Q.value?.key!==t.key)return;if(r.epoch!==a)return Tr();if(s=[...r.rows,...s],c=r.hasOlder,!r.rows.length||r.rows[0].seqStart<=e||!r.hasOlder)break;i=r.rows[0].seqStart}let l=Math.max(0,s.findIndex(t=>t.seqStart>=e)),u=s.slice(l,l+150).map(e=>({seqStart:e.seqStart,row:y(e)}));if(Ne.value=[...o].reverse(),Dr.clear(),kr=4,u.length&&u.length<=50){let e=await Ar(t,n,a,u.at(-1).seqStart);if(ke.value!==n||Q.value?.key!==t.key)return;if(e===`stale`)return Tr();e&&(u=[...u,...e])}je.value=u,Me.value=c||l>0,await C(),Ur(e),Dn=`down`,requestAnimationFrame(jn)}catch(e){be.value=String(e.message)}finally{Pe.value=null}}function Gr(){let e=Ie.value;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,Math.round(window.innerHeight*.4))+`px`)}function Kr(e){e.key===`Tab`&&!e.shiftKey&&yr.value?(e.preventDefault(),_t.value=yr.value,C(Gr)):e.key!==`Enter`||e.isComposing||(!h&&!e.shiftKey||e.metaKey||e.ctrlKey)&&(e.preventDefault(),qr())}async function qr(){await Yr(_t.value,!0)}function Jr(e){return e.turnActive===!1||e.turnActive===void 0&&e.status!==`running`&&e.status!==`initializing`}async function Yr(e,t=!1){let n=Q.value;if(!n||!e.trim()&&(!t||!rt.value.length)||vt.value||Y.value||t&&!ht.value)return;if(Ve.value===`steer`&&(!Jr(n)||qe.value.length>0)){let r=t?[...rt.value]:[];await hn(async()=>{let i=r.map(e=>e.id),a=JSON.stringify([n.key,e,i]),o=Je.get(a)??crypto.randomUUID();Je.set(a,o);try{await $(_n(n)+`/queue`,`POST`,{id:o,text:e,attachmentIds:i})}catch(e){throw await Qe(),e}Je.delete(a);for(let e of r)Ke.remove(n.key,e,!0);t&&Z.state(n.key).text===e&&Z.setText(n.key,``),X.value===n.key&&(vr.value=null),await Qe(),C(Gr)});return}let r=t?[...rt.value]:[];t&&Z.setText(n.key,``),await Xr(n,e,r,Ve.value,{restore:t})}async function Xr(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 hn(async()=>{try{if(await $(_n(e)+`/messages`,`POST`,{...s,behavior:r}),c=!0,o!==Z.generation)return;Z.resolve(e.key,s.messageId);for(let t of n)Ke.remove(e.key,t,!0);X.value===e.key&&(vr.value=null),C(Gr),X.value===e.key&&Tr()}catch(t){if(o!==Z.generation)return;if(t.delivery===`not-sent`){Z.resolve(e.key,s.messageId);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 Zr(e){let t=Q.value;t&&await hn(async()=>{await $(_n(t)+`/queue/`+e.id,`DELETE`),await Qe()})}async function Qr(e){let t=Q.value;if(!t)return;let n=Xe.value;await hn(async()=>{await $(_n(t)+`/queue/`+e.id,`PATCH`,{text:n}),Ye.value=null,await Qe()})}async function $r(e){let t=Q.value;!t||Y.value||vt.value||await hn(async()=>{await $(_n(t)+`/queue/`+e.id+`/send`,`POST`),await Qe()})}async function ei(){let e=Q.value;e&&await hn(async()=>void await $(_n(e)+`/stop`,`POST`))}async function ti(e,t){let n=Q.value;n&&await hn(async()=>{await $(_n(n)+`/permissions/`+encodeURIComponent(e.id),`POST`,t)})}async function ni(){await hn(async()=>{await $(`/hosts`,`POST`,{label:ze.value,connection:Be.value}),ze.value=``,Be.value=``})}async function ri(e){confirm(`Disconnect and remove ${e.label}? Its agents keep running on the host.`)&&await hn(async()=>void await $(`/hosts/`+e.id,`DELETE`))}async function ii(e){try{Ge.value=await $(`/board`,`PUT`,{revision:Ge.value.revision,cards:e})}catch(e){throw Ge.value=await $(`/board`),e}}function ai(e){let t=Ce.get(e);return t?{hostId:t.hostId,agentId:t.id}:{hostId:null,agentId:null}}async function oi(){await hn(async()=>{Ue.value.trim()&&(await ii([...Ge.value.cards,{id:crypto.randomUUID(),title:Ue.value.trim(),column:`Todo`,...ai(We.value),createdAt:Date.now()}]),Ue.value=``,We.value=``)})}async function si(e,t){await hn(async()=>{Ge.value=await $(`/board/cards/${encodeURIComponent(e.id)}`,`PATCH`,t)})}async function ci(e,t){let n=ai(t);await si(e,{link:n.hostId&&n.agentId?{hostId:n.hostId,agentId:n.agentId}:null})}async function li(e,t){await hn(async()=>{Ge.value=await $(`/board/cards/${encodeURIComponent(e.id)}/comments`,`POST`,{text:t})})}async function ui(e,t){await hn(async()=>{Ge.value=await $(`/board/cards/${encodeURIComponent(e.id)}/comments/${encodeURIComponent(t)}`,`DELETE`)})}function di(e){if(!e.description&&!e.comments?.length)return void fi(e);confirm(`Delete “${e.title}”? Its description and comments are deleted too.`)&&fi(e)}async function fi(e){await hn(()=>ii(Ge.value.cards.filter(t=>t.id!==e.id))),pi.value===e.id&&(pi.value=null)}let pi=e(null),mi=S(()=>Ge.value.cards.find(e=>e.id===pi.value)??null);function hi(e){return(e.description??``).replace(/```[\s\S]*?```/g,` `).replace(/[#>*_`~\[\]()|-]+/g,` `).replace(/\s+/g,` `).trim().slice(0,160)}let gi=S(()=>{Ce.version.value;let e=Ce.range(0,30),t=Q.value,n=t?[t,...e.filter(e=>e.key!==t.key)]:e,r=xe.value.length>1;return n.map(e=>({key:e.key,label:(e.title||`${e.provider} · ${e.project}`)+(r?` (${Et.value.get(e.hostId)??e.hostId})`:``)}))});function _i(e){return Ce.version.value,e.hostId&&e.agentId?Ce.get(`${e.hostId}:${e.agentId}`)??null:null}async function vi(e,t){await si(e,{column:t})}function yi(e){e.hostId&&e.agentId&&Ln(`${e.hostId}:${e.agentId}`)}function bi(e){He.value=e,e!==`chat`||X.value?Vn():Hn()}xn();let xi=S(()=>(Se.version.value,Ce.waiting));n(xi,e=>{zo(e),document.title=e?`(${e}) LitePaseo`:`LitePaseo`});let Si=S(()=>(Ce.version.value,Ce.waiting?`attention`:Ce.allLaneSize(`running`)?`running`:Ce.allLaneSize(`review`)?`unread`:``));return n(Si,e=>Bo(e),{immediate:!0}),document.addEventListener(`visibilitychange`,()=>{document.hidden||wr()}),l(()=>{clearInterval(Cr),clearInterval(Ct),clearTimeout(Wt),document.removeEventListener(`visibilitychange`,Gt),Ke.clear(),window.removeEventListener(`storage`,Tt),window.removeEventListener(`popstate`,Un),window.removeEventListener(`keydown`,Gn),fn?.close(),pn?.close(),clearTimeout(mn)}),(e,n)=>ye.value?(i(),R(`div`,{key:1,class:M([`shell`,{"detail-open":Re.value,"is-resizing":ue.value}]),style:g({"--sidebar-w":le.value+`px`})},[x(`aside`,md,[x(`div`,{class:M([`sidebar-resize`,{"is-dragging":ue.value}]),role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuenow":le.value,"aria-valuemin":zp,"aria-valuemax":Bp,tabindex:`0`,title:`Drag to resize · double-click to reset`,onPointerdown:pe,onDblclick:n[2]||=e=>de(Vp),onKeydown:[n[3]||=P(v(e=>de(le.value-16),[`prevent`]),[`left`]),n[4]||=P(v(e=>de(le.value+16),[`prevent`]),[`right`])]},null,42,hd),x(`nav`,gd,[x(`label`,{class:M([`side-row side-search`,{active:!!Le.value}])},[t(J,{name:`search`,size:15}),a(x(`input`,{ref_key:`searchInput`,ref:Wn,"onUpdate:modelValue":n[5]||=e=>Le.value=e,type:`search`,placeholder:`Search`,"aria-label":`Search sessions, projects, hosts`,"aria-keyshortcuts":`/ Control+K Meta+K`},null,512),[[_,Le.value]]),x(`kbd`,_d,k(D(w)?`⌘K`:`Ctrl K`),1)],2),x(`button`,{class:M([`side-row`,{chosen:He.value===`board`}]),onClick:n[6]||=e=>bi(`board`)},[t(J,{name:`board`,size:15}),n[66]||=d(`Kanban `,-1)],2)]),x(`div`,vd,[x(`span`,yd,k(Te.value===`projects`?`Workspaces`:`Recent`),1),x(`span`,bd,k(Te.value===`projects`?Nt.value:Mt.value),1),x(`button`,{class:M([`icon-btn side-tool`,{chosen:E.value||Pt.value!==null||Te.value!==`projects`}]),"aria-label":`View options`,title:`Group and filter`,"aria-expanded":E.value,onClick:n[7]||=e=>E.value=!E.value},[t(J,{name:`sliders`,size:15})],10,xd)]),E.value?(i(),R(`div`,Sd,[x(`div`,Cd,[x(`button`,{role:`radio`,"aria-checked":Te.value===`projects`,class:M({chosen:Te.value===`projects`}),onClick:n[8]||=e=>Te.value=`projects`},` By project `,10,wd),x(`button`,{role:`radio`,"aria-checked":Te.value===`recent`,class:M({chosen:Te.value===`recent`}),onClick:n[9]||=e=>Te.value=`recent`},`Recent`,10,Td)]),xe.value.length>1?(i(),R(`div`,Ed,[x(`button`,{role:`radio`,"aria-checked":Pt.value===null,class:M({chosen:Pt.value===null}),onClick:n[10]||=e=>Pt.value=null},[n[67]||=d(` All`,-1),x(`span`,Od,k(jt.value),1)],10,Dd),(i(!0),R(b,null,z(xe.value,e=>(i(),R(`button`,{key:e.id,role:`radio`,"aria-checked":Pt.value===e.id,class:M({chosen:Pt.value===e.id}),title:e.label+` · `+e.state,onClick:t=>Pt.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`,Ad,k(Ft.value.get(e.id)),1)],10,kd))),128))])):F(``,!0)])):F(``,!0),t(hr,{mode:Te.value,store:D(Se),"host-labels":Et.value,"host-states":Dt.value,"selected-key":we.value,searching:!!Le.value.trim(),onSelect:Rn,onNew:qn,onMenu:$n,onProjectMenu:lr},null,8,[`mode`,`store`,`host-labels`,`host-states`,`selected-key`,`searching`]),t(Wc,{report:xr.value,loading:Sr.value,onRefresh:n[11]||=e=>wr(!0)},null,8,[`report`,`loading`]),x(`div`,jd,[x(`span`,{class:M([`live`,`is-`+De.value]),title:`Directory stream: `+De.value},[n[68]||=x(`span`,{class:`live-dot`},null,-1),d(k(ln.value),1)],10,Md),x(`button`,{class:M([`icon-btn`,{chosen:He.value===`schedules`}]),title:`Schedules`,"aria-label":`Schedules`,onClick:n[12]||=e=>bi(`schedules`)},[t(J,{name:`clock`,size:15})],2),x(`button`,{class:M([`icon-btn foot-hosts`,{chosen:He.value===`hosts`}]),title:`Hosts: ${Ot.value} of ${xe.value.length} connected`,"aria-label":`Hosts, ${Ot.value} of ${xe.value.length} connected`,onClick:n[13]||=e=>bi(`hosts`)},[t(J,{name:`server`,size:15}),Ot.value<xe.value.length?(i(),R(`span`,Pd)):F(``,!0)],10,Nd),x(`button`,{class:`icon-btn`,title:`Theme: `+D(so)+` (click to change)`,"aria-label":`Theme: `+D(so),onClick:n[14]||=(...e)=>D(mo)&&D(mo)(...e)},[t(J,{name:D(so)===`dark`?`moon`:D(so)===`light`?`sun`:`monitor`,size:15},null,8,[`name`])],8,Fd),x(`button`,{class:M([`icon-btn`,{chosen:He.value===`settings`}]),title:`Settings`,"aria-label":`Settings`,onClick:n[15]||=e=>bi(`settings`)},[t(J,{name:`gear`,size:15})],2)])]),x(`main`,Id,[be.value?(i(),R(`div`,Ld,[t(J,{name:`alert`,size:15}),x(`span`,null,k(be.value),1),x(`button`,{class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[16]||=e=>be.value=``},[t(J,{name:`close`,size:14})])])):F(``,!0),He.value===`settings`?(i(),m(mc,{key:1,request:$,"totp-enabled":!!ve.value?.totp,onBack:Hn,onSignedOut:n[17]||=e=>vn(`user`),onTotpChanged:n[18]||=e=>ve.value&&(ve.value.totp=e),onDictationChanged:n[19]||=e=>it.value=e},null,8,[`totp-enabled`])):He.value===`hosts`?(i(),R(`section`,Rd,[x(`header`,zd,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:Hn},[t(J,{name:`back`,size:18})]),n[69]||=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`,Bd,[x(`div`,Vd,[(i(!0),R(b,null,z(xe.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`,Hd,[x(`div`,Ud,k(e.label),1),x(`div`,Wd,k(e.state),1),e.diagnostic?.error?(i(),R(`p`,Gd,k(e.diagnostic.error.message),1)):F(``,!0),e.diagnostic?.lastConnectedAt?(i(),R(`div`,Kd,`Last connected: `+k(new Date(e.diagnostic.lastConnectedAt).toLocaleString()),1)):F(``,!0),e.diagnostic?.attempt?(i(),R(`div`,qd,`Connection attempt `+k(e.diagnostic.attempt),1)):F(``,!0),e.diagnostic?.nextRetryAt?(i(),R(`div`,Jd,`Next retry: `+k(new Date(e.diagnostic.nextRetryAt).toLocaleString()),1)):F(``,!0)]),x(`button`,{class:`btn btn-outline`,disabled:Y.value,onClick:t=>ri(e)},`Remove`,8,Yd)]))),128)),xe.value.length?F(``,!0):(i(),R(`div`,Xd,`No hosts yet.`))]),n[73]||=x(`h2`,{class:`section-label`},`Add a host`,-1),x(`form`,{class:`card form-card`,onSubmit:v(ni,[`prevent`])},[x(`label`,Zd,[n[70]||=x(`span`,null,`Name`,-1),a(x(`input`,{"onUpdate:modelValue":n[20]||=e=>ze.value=e,placeholder:`Build server`,required:``},null,512),[[_,ze.value]])]),x(`label`,Qd,[n[71]||=x(`span`,null,`Connection`,-1),a(x(`input`,{"onUpdate:modelValue":n[21]||=e=>Be.value=e,type:`password`,placeholder:`ws://host:port/ws, pairing offer or SSH target`,required:``,autocomplete:`off`,"aria-describedby":`host-connection-help`},null,512),[[_,Be.value]])]),n[72]||=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&#39;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`,$d,[x(`button`,{class:`btn btn-primary`,disabled:Y.value},`Add host`,8,ef)])],32)])])):He.value===`schedules`?(i(),m(nd,{key:3,hosts:xe.value,api:$,onBack:Hn,onOpenAgent:Ln},null,8,[`hosts`])):He.value===`board`?(i(),R(`section`,tf,[x(`header`,nf,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:Hn},[t(J,{name:`back`,size:18})]),x(`div`,null,[n[74]||=x(`h1`,null,`Kanban`,-1),x(`p`,rf,k(fr.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`,af,[x(`button`,{class:M({chosen:fr.value===`agents`}),onClick:n[22]||=e=>fr.value=`agents`},`Agents`,2),x(`button`,{class:M({chosen:fr.value===`plan`}),onClick:n[23]||=e=>fr.value=`plan`},`Plan`,2)])]),x(`div`,of,[fr.value===`agents`?(i(),m(kc,{key:0,store:D(Ce),"host-labels":Et.value,busy:Y.value,onOpen:Ln,onStop:pr,onRead:mr,onArchive:gr},null,8,[`store`,`host-labels`,`busy`])):(i(),R(b,{key:1},[x(`form`,{class:`add-card`,onSubmit:v(oi,[`prevent`])},[a(x(`input`,{"onUpdate:modelValue":n[24]||=e=>Ue.value=e,placeholder:`New task`,required:``},null,512),[[_,Ue.value]]),a(x(`select`,{"onUpdate:modelValue":n[25]||=e=>We.value=e,class:`card-link-select`,"aria-label":`Link to conversation`},[n[75]||=x(`option`,{value:``},`No conversation`,-1),(i(!0),R(b,null,z(gi.value,e=>(i(),R(`option`,{key:e.key,value:e.key},k(e.label),9,sf))),128))],512),[[N,We.value]]),x(`button`,{class:`btn btn-primary`,disabled:Y.value},[t(J,{name:`plus`,size:15}),n[76]||=d(`Add task`,-1)],8,cf)],32),x(`div`,lf,[(i(),R(b,null,z(p,e=>x(`div`,{key:e,class:`column`},[x(`div`,uf,[x(`h3`,null,k(e),1),x(`span`,df,k(cn.value.get(e).length),1)]),(i(!0),R(b,null,z(cn.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=>pi.value=e.id},[x(`span`,pf,k(e.title),1),hi(e)?(i(),R(`span`,mf,k(hi(e)),1)):F(``,!0)],8,ff),e.agentId?(i(),R(`div`,hf,[_i(e)?(i(),R(`button`,{key:0,class:`link-btn`,title:`Open `+(_i(e).title||_i(e).id),onClick:t=>yi(e)},[t(J,{name:`chat`,size:13}),x(`span`,_f,k(_i(e).title||_i(e).provider),1)],8,gf)):(i(),R(`span`,vf,`Conversation unavailable`)),x(`button`,{class:`icon-btn`,"aria-label":`Unlink conversation`,title:`Unlink conversation`,disabled:Y.value,onClick:t=>ci(e,``)},[t(J,{name:`close`,size:13})],8,yf)])):(i(),R(`select`,{key:1,class:`card-link-select`,"aria-label":`Link to conversation`,disabled:Y.value,value:``,onChange:t=>ci(e,t.target.value)},[n[77]||=x(`option`,{value:``,disabled:``},`Link a conversation…`,-1),(i(!0),R(b,null,z(gi.value,e=>(i(),R(`option`,{key:e.key,value:e.key},k(e.label),9,xf))),128))],40,bf)),x(`div`,Sf,[x(`select`,{value:e.column,"aria-label":`Column`,onChange:t=>vi(e,t.target.value)},[(i(),R(b,null,z(p,e=>x(`option`,{key:e},k(e),1)),64))],40,Cf),e.comments?.length?(i(),R(`button`,{key:0,type:`button`,class:`kanban-count`,title:e.comments.length+` comments`,onClick:t=>pi.value=e.id},[t(J,{name:`chat`,size:13}),d(k(e.comments.length),1)],8,wf)):F(``,!0),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Edit task`,title:`Edit`,onClick:t=>pi.value=e.id},[t(J,{name:`edit`,size:15})],8,Tf),x(`button`,{class:`icon-btn`,"aria-label":`Remove`,onClick:t=>di(e)},[t(J,{name:`trash`,size:15})],8,Ef)])]))),128)),cn.value.get(e).length?F(``,!0):(i(),R(`p`,Df,`Nothing here`))])),64))]),mi.value?(i(),m(xl,{key:mi.value.id,card:mi.value,columns:p,links:gi.value,"linked-name":_i(mi.value)?_i(mi.value).title||_i(mi.value).provider:null,busy:Y.value,onClose:n[26]||=e=>pi.value=null,onPatch:n[27]||=e=>si(mi.value,e),onComment:n[28]||=e=>li(mi.value,e),onUncomment:n[29]||=e=>ui(mi.value,e),onRemove:n[30]||=e=>fi(mi.value),onOpen:n[31]||=e=>{pi.value=null,yi(mi.value)}},null,8,[`card`,`links`,`linked-name`,`busy`])):F(``,!0)],64))])])):Q.value?(i(),R(`div`,{key:5,class:`chat-split`,style:g({"--panel-w":q.value+`px`})},[x(`section`,Of,[x(`header`,kf,[x(`button`,{class:`icon-btn back`,"aria-label":`Back to sessions`,onClick:Hn},[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,Af),x(`h1`,{class:`chat-title`,title:kt.value?.name||Q.value.title||``},[kt.value?.pinnedAt?(i(),m(J,{key:0,name:`pin`,size:12,class:`title-pin`})):F(``,!0),d(k(kt.value?.name||Q.value.title||`Untitled session`),1)],8,jf),x(`span`,{class:`chat-context hide-sm`,title:[Lt.value,Et.value.get(Q.value.hostId),kt.value?.branch,Q.value.provider].filter(Boolean).join(` · `)},[d(k(Lt.value),1),xe.value.length>1?(i(),R(b,{key:0},[d(` · `+k(Et.value.get(Q.value.hostId)),1)],64)):F(``,!0),kt.value?.branch?(i(),R(b,{key:1},[d(` · `+k(kt.value.branch),1)],64)):F(``,!0)],8,Mf),n[78]||=x(`span`,{class:`grow`},null,-1),x(`button`,{class:M([`icon-btn head-tool`,{chosen:O.value===`files`}]),"aria-label":`Files`,title:`Files`,onClick:n[32]||=e=>j(`files`)},[t(J,{name:`folder`,size:16})],2),x(`button`,{class:M([`icon-btn head-tool`,{chosen:H.value}]),"aria-label":`Terminal`,title:`Terminal`,onClick:n[33]||=e=>ee()},[t(J,{name:`terminal`,size:16})],2),kt.value?(i(),R(`button`,{key:0,class:`icon-btn head-tool`,"aria-label":`Thread actions`,title:`Rename, pin, mark unread, archive`,onClick:er},[t(J,{name:`more`,size:16})])):F(``,!0)]),At.value.length>1||W.value.length||V.value?(i(),R(`nav`,Nf,[(i(!0),R(b,null,z(At.value.length?At.value:[Q.value],e=>(i(),R(`button`,{key:e.key,class:M({chosen:e.key===X.value&&!G.value&&!H.value}),onClick:t=>{X.value=e.key,te()}},[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`,Ff,k(e.title||e.provider),1)],10,Pf))),128)),(i(!0),R(b,null,z(W.value,e=>(i(),R(`button`,{key:`file:`+e,class:M([`file-tab`,{chosen:G.value===e}]),title:e,onClick:t=>G.value=e,onAuxclick:v(t=>t.button===1&&ie(e),[`prevent`])},[t(J,{name:`file`,size:13}),x(`span`,Lf,k(e.split(`/`).pop()),1),x(`span`,{class:`tab-close`,role:`button`,"aria-label":`Close `+e,onClick:v(t=>ie(e),[`stop`])},[t(J,{name:`close`,size:11})],8,Rf)],42,If))),128)),V.value?(i(),R(`button`,{key:0,class:M([`file-tab`,{chosen:H.value}]),onClick:n[35]||=e=>ee()},[t(J,{name:`terminal`,size:13}),n[79]||=x(`span`,{class:`agent-tab-name`},`Terminal`,-1),x(`span`,{class:`tab-close`,role:`button`,"aria-label":`Close terminal tab`,onClick:n[34]||=v(e=>B.delete(U.value),[`stop`])},[t(J,{name:`close`,size:11})])],2)):F(``,!0)])):F(``,!0),V.value?a((i(),m(D(f),{key:`t:`+Q.value.hostId+It.value,"host-id":Q.value.hostId,cwd:It.value,api:$,visible:H.value},null,8,[`host-id`,`cwd`,`visible`])),[[T,H.value]]):F(``,!0),G.value?(i(),m(D(c),{key:Q.value.hostId+`:`+It.value+`:`+G.value,"host-id":Q.value.hostId,cwd:It.value,path:G.value,api:$},null,8,[`host-id`,`cwd`,`path`])):F(``,!0),a(x(`div`,zf,[x(`div`,{ref_key:`timelineElement`,ref:Fe,class:`timeline`,onClick:rn},[x(`div`,Bf,[on.value?(i(),R(`div`,Vf,[Pe.value===`before`?(i(),R(`span`,Hf,[...n[80]||=[x(`span`,{class:`spinner`},null,-1),d(`Loading earlier messages…`,-1)]])):(i(),R(`button`,{key:1,class:`btn btn-ghost`,onClick:n[36]||=e=>jr(`before`)},`Show earlier messages`))])):F(``,!0),Ae.value?(i(),R(`p`,Uf,[t(J,{name:`alert`,size:14}),d(k(Ae.value),1)])):F(``,!0),(i(!0),R(b,null,z(Kt.value,e=>(i(),R(b,{key:`${Q.value?.key}:${ke.value.epoch}:${e.seqStart}`},[t(ji,{entry:e.row,final:e.seqStart!==an.value||qt.value,"data-seq-start":e.seqStart},null,8,[`entry`,`final`,`data-seq-start`]),Jt.value.get(e.seqStart)?(i(),R(`div`,Wf,[Jt.value.get(e.seqStart).messages.length?(i(),R(`button`,{key:0,type:`button`,class:`turn-item turn-copy`,"aria-label":Yt.value===e.seqStart?`Copied`:`Copy turn`,title:Yt.value===e.seqStart?`Copied`:`Copy turn`,onClick:t=>Zt(e.seqStart,Jt.value.get(e.seqStart).messages)},[t(J,{name:Yt.value===e.seqStart?`check`:`copy`,size:14},null,8,[`name`]),d(k(Yt.value===e.seqStart?`Copied`:`Copy`),1)],8,Gf)):F(``,!0),nt.value&&e.row.value.provider===Q.value.provider?(i(),R(`span`,{key:1,class:`turn-item`,title:`Model: `+nt.value},[t(Ol,{provider:e.row.value.provider},null,8,[`provider`]),d(k(nt.value),1)],8,Kf)):F(``,!0),x(`span`,{class:`turn-item`,title:`Finished `+Jt.value.get(e.seqStart).at},[t(J,{name:`clock`,size:14}),d(k(Jt.value.get(e.seqStart).at),1)],8,qf),Jt.value.get(e.seqStart).took?(i(),R(`span`,{key:2,class:`turn-item`,title:`Worked for `+Jt.value.get(e.seqStart).took},[t(J,{name:`hourglass`,size:14}),d(k(Jt.value.get(e.seqStart).took),1)],8,Jf)):F(``,!0)])):F(``,!0)],64))),128)),je.value?(i(),R(`div`,Yf,[Pe.value===`after`?(i(),R(`span`,Xf,[...n[81]||=[x(`span`,{class:`spinner`},null,-1),d(`Loading newer messages…`,-1)]])):(i(),R(`button`,{key:1,class:`btn btn-ghost`,onClick:Tr},`Back to latest`))])):F(``,!0),zt.value?(i(),R(`div`,Zf,[x(`span`,{class:`spinner spinner-ticked`,style:g(Ht.value?{transform:`rotate(${Ut.value*90}deg)`}:void 0)},null,4),Ht.value?(i(),R(`span`,Qf,k(Ht.value),1)):(i(),R(`span`,$f,`Working…`))])):F(``,!0),Kt.value.length?F(``,!0):(i(),R(`div`,ep,[ke.value.ready?F(``,!0):(i(),R(`span`,tp)),d(` `+k(ke.value.ready?`No messages yet.`:`Loading conversation…`),1)]))])],512),zr.value.length>=2&&D(Pr)?(i(),m(gn,{key:0,prompts:zr.value,"active-seq":Br.value,onJump:Wr},null,8,[`prompts`,`active-seq`])):F(``,!0)],512),[[T,!G.value&&!H.value]]),a(x(`div`,np,[x(`div`,rp,[(i(!0),R(b,null,z(Q.value.pendingPermissions,e=>(i(),m(ao,{key:Q.value.key+`:`+e.id,permission:e,busy:Y.value,onRespond:t=>ti(e,t)},null,8,[`permission`,`busy`,`onRespond`]))),128)),xt.value?(i(),R(`p`,ip,k(xt.value),1)):F(``,!0),D(Z).warning.value?(i(),R(`p`,ap,k(D(Z).warning.value),1)):F(``,!0),ct.value?(i(),R(`p`,op,[t(J,{name:`alert`,size:13}),d(k(ct.value)+` `,1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[37]||=e=>ct.value=``},[t(J,{name:`close`,size:12})])])):F(``,!0),yt.value.length?(i(),R(`details`,sp,[x(`summary`,null,`Other saved drafts (`+k(yt.value.length)+`)`,1),(i(!0),R(b,null,z(yt.value,e=>(i(),R(`div`,{key:e.slot},[x(`p`,cp,k(e.text),1),x(`button`,{class:`btn btn-ghost`,onClick:t=>X.value&&D(Z).restore(X.value,e.slot)},`Restore draft`,8,lp)]))),128))])):F(``,!0),vt.value&&!Y.value?(i(),R(`div`,up,[t(J,{name:`alert`,size:15}),x(`span`,dp,`Delivery unknown. Check the conversation before sending again. Message: `+k(vt.value.text)+` `+k(vt.value.attachmentNames?.join(`, `)),1),x(`button`,{class:`btn btn-ghost`,disabled:bt.value,onClick:St},k(bt.value?`Checking…`:`Check delivery`),9,fp),x(`button`,{class:`btn btn-ghost`,onClick:wt},`I checked`)])):F(``,!0),qe.value.length?(i(),R(`div`,pp,[(i(!0),R(b,null,z(qe.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`,mp,[Ye.value===e.id?(i(),R(b,{key:0},[a(x(`textarea`,{"onUpdate:modelValue":n[38]||=e=>Xe.value=e,"aria-label":`Queued message text`,rows:`3`},null,512),[[_,Xe.value]]),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:Y.value,onClick:t=>Qr(e)},`Save`,8,hp),x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:n[39]||=e=>Ye.value=null},`Cancel`)],64)):(i(),R(`span`,{key:1,class:`queue-text`,title:e.text},k(e.text||`(attachments only)`),9,gp)),e.attachmentNames.length?(i(),R(`span`,_p,k(e.attachmentNames.join(`, `)),1)):F(``,!0),e.error?(i(),R(`span`,vp,k(e.error),1)):F(``,!0)]),x(`button`,{type:`button`,class:`queue-send`,disabled:Y.value||!!vt.value||e.sending,title:Rt.value?`Send now: stops the running turn`:`Send now`,onClick:t=>$r(e)},k(Rt.value?`Interrupt`:`Send`),9,yp),x(`button`,{type:`button`,class:`icon-btn`,disabled:Y.value||e.sending,"aria-label":`Edit queued message`,title:`Edit`,onClick:t=>{Ye.value=e.id,Xe.value=e.text}},[t(J,{name:`edit`,size:14})],8,bp),x(`button`,{type:`button`,class:`icon-btn`,disabled:Y.value||e.sending,"aria-label":`Remove queued message`,title:`Remove`,onClick:t=>Zr(e)},[t(J,{name:`close`,size:14})],8,xp)],2))),128))])):F(``,!0),x(`form`,{class:M([`composer`,{"is-dragging":pt.value}]),onSubmit:v(qr,[`prevent`]),onDragover:n[44]||=v(e=>pt.value=!0,[`prevent`]),onDragleave:mt,onDrop:n[45]||=v(e=>{pt.value=!1,et.value?.addFiles(e.dataTransfer?.files)},[`prevent`]),onPaste:gt},[t(La,{ref_key:`attachmentPanel`,ref:et,store:D(Ke),"agent-key":Q.value.key,base:`/api`+_n(Q.value),busy:Y.value||!!vt.value},null,8,[`store`,`agent-key`,`base`,`busy`]),at.value?(i(),R(`div`,{key:0,ref_key:`dictationPreviewElement`,ref:ot,class:`dictation-preview`,role:`status`,"aria-live":`polite`},k(at.value),513)):F(``,!0),a(x(`textarea`,{ref_key:`composerElement`,ref:Ie,"onUpdate:modelValue":n[40]||=e=>_t.value=e,rows:`1`,placeholder:br.value,required:!rt.value.length,onInput:Gr,onKeydown:Kr},null,40,Sp),[[_,_t.value]]),x(`div`,Cp,[x(`button`,{type:`button`,class:`composer-tool`,"aria-label":`Attach files`,title:et.value?.hint,disabled:Y.value||!!vt.value||!et.value?.available,onClick:n[41]||=e=>et.value?.pick()},[t(J,{name:`plus`,size:18})],8,wp),t(tu,{ref_key:`agentControls`,ref:tt,agent:Q.value,path:_n(Q.value),api:$,disabled:Y.value||Dt.value.get(Q.value.hostId)!==`connected`,onNotice:ut},null,8,[`agent`,`path`,`disabled`]),x(`div`,Tp,[Rt.value?(i(),R(`button`,{key:0,type:`button`,class:M([`chip-behavior`,`is-`+Ve.value]),"aria-label":Ve.value===`steer`?`Queue: your message waits until the running turn ends (click for interrupt)`:`Interrupt: your message stops the running turn (click for queue)`,title:Ve.value===`steer`?`Queue: your message waits above the composer and is sent when the running turn ends`:`Interrupt: your message stops the running turn and starts a new one`,onClick:n[42]||=e=>Ve.value=Ve.value===`steer`?`interrupt`:`steer`},k(Ve.value===`steer`?`Queue`:`Interrupt`),11,Ep)):F(``,!0),it.value?(i(),m(cd,{key:Q.value.key,disabled:Y.value,onText:dt,onPreview:n[43]||=e=>at.value=e,onNotice:ut},null,8,[`disabled`])):F(``,!0),Rt.value?(i(),R(`button`,{key:2,type:`button`,class:M([`disc disc-stop`,{"is-primary":!ft.value}]),"aria-label":`Stop turn`,title:`Stop turn`,disabled:Y.value,onClick:ei},[t(J,{name:`stop`,size:18})],10,Dp)):F(``,!0),!Rt.value||ft.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||!!vt.value||!ht.value||!ft.value},[t(J,{name:`send`,size:17})],8,Op)):F(``,!0)])])],34)])],512),[[T,!G.value&&!H.value]])]),O.value?(i(),R(`aside`,kp,[x(`div`,{class:`panel-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize panel`,tabindex:`0`,onPointerdown:se,onDblclick:n[46]||=e=>oe(Rp)},null,32),x(`div`,Ap,[x(`button`,{class:M({chosen:O.value===`files`}),onClick:n[47]||=e=>O.value=`files`},[t(J,{name:`folder`,size:14}),n[82]||=d(`Files`,-1)],2),n[83]||=x(`span`,{class:`grow`},null,-1),x(`button`,{class:`icon-btn`,"aria-label":`Close panel`,title:`Close panel`,onClick:n[48]||=e=>O.value=null},[t(J,{name:`close`,size:14})])]),x(`div`,jp,[(i(),m(A,null,[O.value===`files`?(i(),m(D(s),{key:`f:`+Q.value.hostId+It.value,"host-id":Q.value.hostId,cwd:It.value,api:$,"active-path":G.value,onOpen:re},null,8,[`host-id`,`cwd`,`active-path`])):F(``,!0)],1024))])])):F(``,!0)],4)):He.value===`chat`&&Yn.value?(i(),R(`section`,Mp,[...n[84]||=[x(`span`,{class:`spinner`},null,-1),x(`p`,null,`Starting session…`,-1)]])):(i(),R(`section`,Np,[x(`div`,Pp,[t(J,{name:`chat`,size:26})]),x(`h2`,null,k(jt.value?`Pick a session`:`Connect your first host`),1),x(`p`,null,k(jt.value?Pt.value?`${Mt.value} sessions in ${Nt.value} projects on ${Et.value.get(Pt.value)??`this host`}.`:`${jt.value} sessions in ${Nt.value} projects across ${xe.value.length} hosts.`:`Add a Paseo daemon and its agents show up here, live.`),1),xe.value.length?(i(),R(`button`,{key:1,class:`btn btn-primary`,onClick:n[50]||=e=>qn()},[t(J,{name:`plus`,size:15}),n[85]||=d(`New session`,-1)])):(i(),R(`button`,{key:0,class:`btn btn-primary`,onClick:n[49]||=e=>bi(`hosts`)},`Add a host`))]))]),Xn.value?(i(),m(_e,{key:0,thread:Xn.value.thread,x:Xn.value.x,y:Xn.value.y,onClose:n[51]||=e=>Xn.value=null,onRename:n[52]||=e=>Zn.value=e,onPin:nr,onUnread:rr,onRead:ir,onArchive:ar},null,8,[`thread`,`x`,`y`])):F(``,!0),or.value?(i(),m(Oe,{key:1,name:or.value.project.name,host:Et.value.get(or.value.project.hostId)??`Unknown host`,x:or.value.x,y:or.value.y,onClose:n[53]||=e=>or.value=null,onSettings:n[54]||=e=>sr.value=or.value.project,onRemove:n[55]||=e=>ur(or.value.project)},null,8,[`name`,`host`,`x`,`y`])):F(``,!0),sr.value?(i(),m(nn,{key:2,"host-id":sr.value.hostId,"host-label":Et.value.get(sr.value.hostId)??`Unknown host`,project:cr.value,"root-path":sr.value.rootPath,"custom-icons":!!xe.value.find(e=>e.id===sr.value.hostId)?.customIcons,request:$,onClose:n[56]||=e=>sr.value=null},null,8,[`host-id`,`host-label`,`project`,`root-path`,`custom-icons`])):F(``,!0),tn.value?(i(),R(`div`,{key:3,class:`lightbox`,role:`dialog`,"aria-label":`Image`,onClick:n[57]||=e=>tn.value=null},[x(`img`,{src:tn.value,alt:``},null,8,Fp)])):F(``,!0),Zn.value?(i(),m(Ee,{key:4,thread:Zn.value,busy:Y.value,onClose:n[58]||=e=>Zn.value=null,onSave:tr},null,8,[`thread`,`busy`])):F(``,!0),Kn.value?(i(),m(Sa,{key:5,hosts:xe.value,"initial-host-id":Kn.value.hostId,"initial-cwd":Kn.value.cwd,"initial-project":Kn.value.project,request:$,onClose:n[59]||=e=>Kn.value=null,onCreated:Jn},null,8,[`hosts`,`initial-host-id`,`initial-cwd`,`initial-project`])):F(``,!0)],6)):(i(),R(`div`,ld,[ve.value?(i(),R(`form`,{key:0,class:`login-card`,onSubmit:v(Sn,[`prevent`])},[n[63]||=x(`div`,{class:`brand brand-large`},[x(`img`,{class:`brand-mark`,src:`/icons/mark.svg`,alt:``,width:`22`,height:`22`}),d(`LitePaseo`)],-1),n[64]||=x(`p`,{class:`login-lede`},`All your Paseo hosts, one fast console.`,-1),x(`label`,ud,[n[60]||=x(`span`,null,`Server access token`,-1),a(x(`input`,{"onUpdate:modelValue":n[0]||=e=>he.value=e,type:`password`,autocomplete:`off`,required:``,autofocus:``},null,512),[[_,he.value]])]),n[65]||=x(`p`,{class:`hint`},[d(`Run `),x(`code`,null,`litepaseo token`),d(` on the server to print it.`)],-1),ve.value.totp?(i(),R(b,{key:0},[x(`label`,dd,[n[61]||=x(`span`,null,`Authenticator code`,-1),a(x(`input`,{"onUpdate:modelValue":n[1]||=e=>ge.value=e,class:`code-input`,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,pattern:`[0-9]{6}`,placeholder:`••••••`,required:``,onInput:wn},null,544),[[_,ge.value]])]),n[62]||=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,fd),be.value?(i(),R(`p`,pd,k(be.value),1)):F(``,!0)],32)):F(``,!0)]))}});function Up(){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)}}fo(),bo();var Wp=j(Hp);Wp.mount(`#app`),Wp.onUnmount(Up());export{Or as a,kr as i,Ia as n,yn as o,jr as r,J as s,uo as t};