@av-pi-studio/web-client 0.0.82 → 0.0.84

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 (33) hide show
  1. package/dist/web/assets/BinaryFallbackViewer-CIUi24Ot.js +1 -0
  2. package/dist/web/assets/ChatPanel-6ByH3iQ4.js +4 -0
  3. package/dist/web/assets/CodeView-DfeJ87-5.js +1 -0
  4. package/dist/web/assets/FilePanel-BdMid1U4.js +1 -0
  5. package/dist/web/assets/HtmlViewer-D0imxjWz.js +1 -0
  6. package/dist/web/assets/HtmlViewer-gN2oIGsk.css +1 -0
  7. package/dist/web/assets/ImageViewer-CN9iPEGX.js +1 -0
  8. package/dist/web/assets/MarkdownFileViewer-Cnl1kopk.css +1 -0
  9. package/dist/web/assets/MarkdownFileViewer-CosLifhj.js +1 -0
  10. package/dist/web/assets/{MoleculeViewerPanel-aCElW220.js → MoleculeViewerPanel-D48wJN2R.js} +1 -1
  11. package/dist/web/assets/{TerminalPanel-B95G8KXL.js → TerminalPanel-D9bmLll3.js} +1 -1
  12. package/dist/web/assets/TextViewer-Dq8eGJUa.js +1 -0
  13. package/dist/web/assets/VideoViewer-CgMOYRel.js +1 -0
  14. package/dist/web/assets/href-resolution-Bf3FTJf3.js +1 -0
  15. package/dist/web/assets/index-Dt7Aniao.js +19 -0
  16. package/dist/web/assets/index-XCiHPNBz.css +1 -0
  17. package/dist/web/assets/markdown-BBqwpxBr.js +5 -0
  18. package/dist/web/assets/{use-file-download-DaCAhjAL.js → use-file-download-CywC4-io.js} +1 -1
  19. package/dist/web/assets/{use-file-watch-a91DX08b.js → use-file-watch-qzbiOH5N.js} +1 -1
  20. package/dist/web/index.html +2 -2
  21. package/package.json +3 -3
  22. package/dist/web/assets/BinaryFallbackViewer-BhBojgYd.js +0 -1
  23. package/dist/web/assets/ChatPanel-B2VO6E82.js +0 -4
  24. package/dist/web/assets/CodeView-D91mREsp.js +0 -1
  25. package/dist/web/assets/FilePanel-CIFuH4f_.js +0 -1
  26. package/dist/web/assets/ImageViewer-BcpC-9HE.js +0 -1
  27. package/dist/web/assets/MarkdownFileViewer-BDzrwPiB.js +0 -1
  28. package/dist/web/assets/MarkdownFileViewer-BOOIyc8-.css +0 -1
  29. package/dist/web/assets/TextViewer-C1zYu_5r.js +0 -1
  30. package/dist/web/assets/VideoViewer-BZMclaqR.js +0 -1
  31. package/dist/web/assets/index-C-gDLAhS.js +0 -19
  32. package/dist/web/assets/index-DNsKUhP1.css +0 -1
  33. package/dist/web/assets/markdown-B-dnhity.js +0 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@av-pi-studio/web-client",
3
- "version": "0.0.82",
3
+ "version": "0.0.84",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.map",
@@ -16,8 +16,8 @@
16
16
  "clean": "rm -rf dist *.tsbuildinfo"
17
17
  },
18
18
  "devDependencies": {
19
- "@av-pi-studio/client": "^0.0.82",
20
- "@av-pi-studio/protocol": "^0.0.82",
19
+ "@av-pi-studio/client": "^0.0.84",
20
+ "@av-pi-studio/protocol": "^0.0.84",
21
21
  "@codemirror/language": "^6.12.4",
22
22
  "@codemirror/language-data": "^6.5.2",
23
23
  "@codemirror/state": "^6.7.1",
@@ -1 +0,0 @@
1
- import{r as l,j as e}from"./vendor-react-DQUAl2K8.js";import{S as m,B as a}from"./index-C-gDLAhS.js";import{u as d}from"./use-file-download-DaCAhjAL.js";import{F as c}from"./vendor-icons-CQPWxe0u.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DVp0ZLQo.js";import"./vendor-overlays-BfyojyuH.js";import"./vendor-dnd-CayJj8TC.js";const p="_wrap_inn1j_1",j="_name_inn1j_12",n={wrap:p,name:j};function y({path:s}){const[i,t]=l.useState(!1),r=d(s,i),o=s.split("/").pop()||s;return e.jsxs("div",{className:n.wrap,children:[e.jsx(c,{size:32}),e.jsx("div",{className:n.name,children:o}),e.jsx("div",{children:"No preview available for this file type."}),r.isError&&e.jsxs("div",{children:["Error: ",r.error instanceof Error?r.error.message:"download failed"]}),i&&r.isLoading?e.jsx(m,{size:"sm"}):r.data?e.jsx("a",{href:r.data.objectUrl,download:r.data.fileName||o,children:e.jsx(a,{size:"sm",children:"Save file"})}):e.jsx(a,{size:"sm",onClick:()=>t(!0),children:"Download"})]})}export{y as BinaryFallbackViewer};
@@ -1,4 +0,0 @@
1
- import{r as g,j as t}from"./vendor-react-DQUAl2K8.js";import{a as Pe,b as Oe,m as Me,u as me}from"./vendor-query-i7fr__Xm.js";import{x as Q,y as R,u as $,I as z,S as X,w as ze,D as Le,s as Fe,n as He,z as V,r as pe,M as fe,T as Ke,B as H,P as le}from"./index-C-gDLAhS.js";import{L as $e,G as Ue,S as We,a as qe,P as Ge,E as Je,T as he,B as Qe,b as Ve,C as Xe,A as Ye,c as Ze,U as et,d as tt,e as nt,f as st,g as ot,h as at,i as rt,j as it,N as lt,k as ct}from"./vendor-icons-CQPWxe0u.js";import{S as _e,M as ge,r as dt}from"./markdown-B-dnhity.js";import{M as C}from"./vendor-DVp0ZLQo.js";import{D as ut,p as mt}from"./DiffView-CRrnffpG.js";import{R as xe,T as be,I as pt}from"./vendor-overlays-BfyojyuH.js";import"./vendor-dnd-CayJj8TC.js";import"./vendor-highlight-BjiGXuEM.js";import"./vendor-markdown-Bc_dOmsB.js";function ve(e,n){if(n.trim()==="")return e;const s=n.toLowerCase();return e.filter(o=>o.label.toLowerCase().includes(s)||o.description!==void 0&&o.description.toLowerCase().includes(s))}const ft={shell:he,read:Je,edit:Ge,write:qe,search:We,fetch:Ue,task:$e};function ht(e){return ft[e.kind]??he}function ye(e){switch(e.kind){case"read":case"write":case"edit":return e.path??null;default:return null}}function _t(e){return e.kind==="write"||e.kind==="edit"||e.kind==="shell"}function gt(e){const n=[];if(e.kind==="edit"&&e.diff)n.push({kind:"diff",patch:e.diff});else{const s=Q(e);s&&n.push({kind:"code",text:s})}return e.output&&n.push({kind:"code",text:e.output}),n}const ce={shell:{label:"SHELL",token:"statusInfo"},read:{label:"READ",token:"statusInfo"},write:{label:"WRITE",token:"statusSuccess"},edit:{label:"EDIT",token:"statusWarning"},search:{label:"SEARCH",token:"statusInfo"},fetch:{label:"FETCH",token:"statusInfo"},task:{label:"TASK",token:"foregroundMuted"}};function xt(e){return ce[e.kind]??ce.task}function bt(e){if(!e)return{added:0,removed:0};let n=0,s=0;for(const o of e.split(`
2
- `))o.startsWith("+++")||o.startsWith("---")||(o.startsWith("+")?n++:o.startsWith("-")&&s++);return{added:n,removed:s}}function vt(e){return e?(e.endsWith(`
3
- `)?e.slice(0,-1):e).split(`
4
- `).length:0}const yt=500;let W;function jt(e,n,s,o){clearTimeout(W),W=setTimeout(()=>{W=void 0,e.invalidateQueries({queryKey:["file"]}),e.invalidateQueries({queryKey:["explorer"]}),n&&s&&n.connection.request("checkout_refresh_request",{cwd:s}).catch(()=>{})},yt)}function kt({sessionId:e,event:n,timestamp:s,client:o,queryClient:r}){const i=R.getState();switch(i.applyStreamEvent(e,n,s),n.kind){case"turn_started":i.setStatus(e,"running");break;case"turn_completed":i.setStatus(e,"idle");break;case"turn_failed":i.setStatus(e,"error");break;case"turn_canceled":i.setStatus(e,"idle");break;case"tool_call":{if(n.status==="completed"&&_t(n.tool)){const c=i.sessions[e],d=(c==null?void 0:c.cwd)||null;jt(r,o,d,ye(n.tool))}break}}}function St(e){const n=$(r=>r.client),s=R(r=>{var i;return((i=r.sessions[e])==null?void 0:i.agentId)??null}),o=Pe();g.useEffect(()=>!n||!s?void 0:n.agent(s).timeline.subscribe((i,c)=>{const d=typeof c.timestamp=="number"?new Date(c.timestamp).toISOString():c.timestamp;kt({sessionId:e,event:i,timestamp:d,client:n,queryClient:o})}),[n,s,e,o])}const je=64;function q(e){return e.clientHeight>0}function Dt(e,n,s,o=je){switch(n.kind){case"scroll":return q(s)?s.scrollHeight-s.scrollTop-s.clientHeight<=o?{pinned:!0,stick:!1}:{pinned:n.gesture?!1:e,stick:!1}:{pinned:e,stick:!1};case"tail":return{pinned:e,stick:e&&q(s)};case"shown":return{pinned:e,stick:e};case"pin":return{pinned:!0,stick:q(s)}}}function Nt(e){const n=e[e.length-1];return(n==null?void 0:n.kind)==="user"?n.id:null}const Ct=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function de(e){return String(e).padStart(2,"0")}function Y(e){if(!e)return;const n=new Date(e);if(!Number.isNaN(n.getTime()))return`${Ct[n.getMonth()]} ${n.getDate()}, ${de(n.getHours())}:${de(n.getMinutes())}`}const wt="_shellRow_5a5cb_2",Bt="_rail_5a5cb_10",Tt="_disc_5a5cb_18",Et="_connector_5a5cb_28",Rt="_content_5a5cb_2",At="_metaLine_5a5cb_40",It="_metaTime_5a5cb_52",E={shellRow:wt,rail:Bt,disc:Tt,connector:Et,content:Rt,metaLine:At,metaTime:It};function L({disc:e,discClassName:n,connector:s,meta:o,metaTrailing:r,className:i,children:c}){return t.jsxs("div",{className:E.shellRow,children:[t.jsxs("div",{className:E.rail,children:[t.jsx("span",{className:C(E.disc,n),children:e}),s&&t.jsx("span",{className:E.connector})]}),t.jsxs("div",{className:C(E.content,i),children:[o&&t.jsxs("div",{className:E.metaLine,children:[o,r]}),c]})]})}const Pt="_queuedBadge_mdmbp_8",Ot="_finalChip_mdmbp_20",Mt="_userDisc_mdmbp_30",zt="_userAligned_mdmbp_34",Lt="_userPendingRow_mdmbp_40",Ft="_userBubble_mdmbp_44",Ht="_userBubbleFailed_mdmbp_58",Kt="_userImages_mdmbp_63",$t="_userImage_mdmbp_63",Ut="_imageDialog_mdmbp_79",Wt="_imageDialogPreview_mdmbp_83",qt="_assistantDisc_mdmbp_93",Gt="_assistantBody_mdmbp_97",Jt="_reasoningDisc_mdmbp_108",Qt="_reasoningBody_mdmbp_112",Vt="_toolDisc_mdmbp_123",Xt="_toolCardBody_mdmbp_127",Yt="_toolCardBodyRunning_mdmbp_134",Zt="_toolCardBodyCompleted_mdmbp_138",en="_toolCardBodyError_mdmbp_142",tn="_toolHeader_mdmbp_146",nn="_toolHeaderRunning_mdmbp_172",sn="_toolChevron_mdmbp_182",on="_toolChevronOpen_mdmbp_188",an="_kindBadge_mdmbp_192",rn="_toolPath_mdmbp_204",ln="_toolTrailing_mdmbp_213",cn="_toolStatusRunning_mdmbp_221",dn="_toolStatusSuccess_mdmbp_228",un="_toolStatusError_mdmbp_232",mn="_toolStatusUnknown_mdmbp_236",pn="_toolDiffAdded_mdmbp_240",fn="_toolDiffRemoved_mdmbp_244",hn="_toolOpenButton_mdmbp_248",_n="_toolBody_mdmbp_266",gn="_toolCode_mdmbp_272",xn="_toolOutputStrip_mdmbp_283",bn="_toolDiffPreview_mdmbp_293",vn="_toolDiffPreviewLine_mdmbp_301",yn="_toolDiffPreviewAdd_mdmbp_305",jn="_toolDiffPreviewDel_mdmbp_310",kn="_toolDiffPreviewMore_mdmbp_315",Sn="_errorDisc_mdmbp_322",Dn="_errorCard_mdmbp_326",Nn="_errorLead_mdmbp_335",Cn="_systemRow_mdmbp_342",l={queuedBadge:Pt,finalChip:Ot,userDisc:Mt,userAligned:zt,userPendingRow:Lt,userBubble:Ft,userBubbleFailed:Ht,userImages:Kt,userImage:$t,imageDialog:Ut,imageDialogPreview:Wt,assistantDisc:qt,assistantBody:Gt,reasoningDisc:Jt,reasoningBody:Qt,toolDisc:Vt,toolCardBody:Xt,toolCardBodyRunning:Yt,toolCardBodyCompleted:Zt,toolCardBodyError:en,toolHeader:tn,toolHeaderRunning:nn,toolChevron:sn,toolChevronOpen:on,kindBadge:an,toolPath:rn,toolTrailing:ln,toolStatusRunning:cn,toolStatusSuccess:dn,toolStatusError:un,toolStatusUnknown:mn,toolDiffAdded:pn,toolDiffRemoved:fn,toolOpenButton:hn,toolBody:_n,toolCode:gn,toolOutputStrip:xn,toolDiffPreview:bn,toolDiffPreviewLine:vn,toolDiffPreviewAdd:yn,toolDiffPreviewDel:jn,toolDiffPreviewMore:kn,errorDisc:Sn,errorCard:Dn,errorLead:Nn,systemRow:Cn};function wn({row:e,assetBase:n=null,owningPaneId:s=null,workspaceCwd:o=null,connector:r}){const i=Y(e.timestamp);return t.jsx(L,{disc:t.jsx(z,{icon:Qe,size:"xs",color:"var(--pi-color-accentForeground)"}),discClassName:l.assistantDisc,connector:r,meta:t.jsxs(t.Fragment,{children:["Assistant",i&&t.jsxs("span",{className:E.metaTime,children:[" · ",i]})]}),children:t.jsx("div",{className:l.assistantBody,children:e.streaming?t.jsx(_e,{text:e.text,assetBase:n,owningPaneId:s,workspaceCwd:o}):t.jsx(ge,{text:e.text,assetBase:n,owningPaneId:s,workspaceCwd:o})})})}function Bn({row:e,owningPaneId:n=null,workspaceCwd:s=null,connector:o}){const r=Y(e.timestamp);return t.jsx(L,{disc:t.jsx(z,{icon:Ve,size:"xs",color:"var(--pi-color-foregroundMuted)"}),discClassName:l.reasoningDisc,connector:o,meta:t.jsxs(t.Fragment,{children:["Reasoning",r&&t.jsxs("span",{className:E.metaTime,children:[" · ",r]})]}),metaTrailing:!e.streaming&&t.jsx("span",{className:l.finalChip,children:"final"}),children:t.jsx("div",{className:l.reasoningBody,children:e.streaming?t.jsx(_e,{text:e.text,owningPaneId:n,workspaceCwd:s}):t.jsx(ge,{text:e.text,owningPaneId:n,workspaceCwd:s})})})}function Tn(e){const n=mt(e).filter(o=>o.kind==="add"||o.kind==="del"),s=n[0];return s?{text:s.text,kind:s.kind,moreCount:n.length-1}:null}function En(e){return e.status==="completed"?t.jsx("span",{className:l.toolStatusSuccess,children:"✓ completed"}):e.status==="error"?t.jsx("span",{className:l.toolStatusError,children:e.statusText||"error"}):e.statusText&&e.statusText!=="running"?t.jsx("span",{className:l.toolStatusUnknown,children:e.statusText}):t.jsxs("span",{className:l.toolStatusRunning,children:[t.jsx(X,{size:"xs",color:"var(--pi-color-accentBright)"}),"running"]})}function Rn({row:e,assetBase:n=null,owningPaneId:s=null,workspaceCwd:o=null,connector:r}){const[i,c]=g.useState(!1),d=xt(e.tool),j=gt(e.tool),m=j.length>0,p=vt(e.tool.output),u=e.tool.kind==="edit"||e.tool.kind==="write"?ye(e.tool):null,_=e.tool.kind==="edit"?bt(e.tool.diff):null,x=e.tool.kind==="edit"&&e.tool.diff&&!i?Tn(e.tool.diff):null;function S(){m&&c(b=>!b)}function D(b){b.target===b.currentTarget&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),S())}function w(b){if(b.stopPropagation(),!u)return;const N=dt(n,s,o);ze(u,N.workspaceCwd,N.targetPaneId)}return t.jsx(L,{disc:t.jsx(z,{icon:ht(e.tool),size:"xs",color:"var(--pi-color-foregroundMuted)"}),discClassName:l.toolDisc,connector:r,children:t.jsxs("div",{className:C(l.toolCardBody,e.status==="running"&&l.toolCardBodyRunning,e.status==="completed"&&l.toolCardBodyCompleted,e.status==="error"&&l.toolCardBodyError),children:[t.jsxs("div",{role:"button",tabIndex:m?0:-1,"aria-expanded":m?i:void 0,"aria-disabled":!m,className:C(l.toolHeader,e.status==="running"&&l.toolHeaderRunning),onClick:S,onKeyDown:D,children:[m&&t.jsx(Xe,{size:12,className:C(l.toolChevron,i&&l.toolChevronOpen)}),t.jsx("span",{className:l.kindBadge,style:{"--kindToken":`var(--pi-color-${d.token})`},children:d.label}),t.jsx("span",{className:l.toolPath,title:Q(e.tool),children:Q(e.tool)}),t.jsxs("span",{className:l.toolTrailing,children:[_&&(_.added>0||_.removed>0)&&t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:l.toolDiffAdded,children:["+",_.added]}),t.jsxs("span",{className:l.toolDiffRemoved,children:["−",_.removed]})]}),En(e),u&&t.jsxs("button",{type:"button",className:l.toolOpenButton,onClick:w,onKeyDown:b=>b.stopPropagation(),children:["Open",t.jsx(Ye,{size:10})]})]})]}),p>0&&t.jsxs("div",{className:l.toolOutputStrip,children:["output · ",p," lines"]}),x&&t.jsxs("div",{className:l.toolDiffPreview,children:[t.jsx("div",{className:C(l.toolDiffPreviewLine,x.kind==="add"?l.toolDiffPreviewAdd:l.toolDiffPreviewDel),children:x.text}),x.moreCount>0&&t.jsxs("div",{className:l.toolDiffPreviewMore,children:["… ",x.moreCount," more lines"]})]}),i&&m&&t.jsx("div",{className:l.toolBody,children:j.map((b,N)=>b.kind==="diff"?t.jsx(ut,{patch:b.patch},N):t.jsx("pre",{className:l.toolCode,children:b.text},N))})]})})}function An({row:e,connector:n}){const[s,o]=g.useState(null),r=Y(e.timestamp);return t.jsxs(L,{disc:t.jsx(z,{icon:et,size:"xs",color:"var(--pi-color-successForeground)"}),discClassName:l.userDisc,connector:n,className:C(l.userAligned,e.pending&&l.userPendingRow),meta:t.jsxs(t.Fragment,{children:["You",r&&t.jsxs("span",{className:E.metaTime,children:[" · ",r]}),e.failed&&" · failed to send"]}),metaTrailing:e.queued&&!e.failed&&t.jsxs("span",{className:l.queuedBadge,children:[t.jsx(Ze,{size:9}),"queued"]}),children:[t.jsx("span",{className:C(l.userBubble,e.failed&&l.userBubbleFailed),children:e.text}),e.images&&e.images.length>0&&t.jsx("div",{className:l.userImages,children:e.images.map((i,c)=>{const d=`data:${i.mimeType??"image/png"};base64,${i.data??""}`;return t.jsx("img",{className:l.userImage,src:d,alt:"",role:"button",tabIndex:0,onClick:()=>o(d),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&o(d)}},c)})}),t.jsx(Le,{open:s!==null,onOpenChange:i=>{i||o(null)},title:"Image",width:"auto",bare:!0,className:l.imageDialog,children:s&&t.jsx("img",{className:l.imageDialogPreview,src:s,alt:""})})]})}function In({row:e,connector:n}){return t.jsx(L,{disc:t.jsx(z,{icon:tt,size:"xs",color:"var(--pi-color-destructive)"}),discClassName:l.errorDisc,connector:n,children:t.jsxs("div",{className:l.errorCard,children:[t.jsx("span",{className:l.errorLead,children:"Error"})," · ",e.text]})})}function Pn({row:e}){return t.jsx("div",{className:l.systemRow,children:e.text})}const On=500;function Mn(e,n){const s=g.useRef(!0),[o,r]=g.useState(!0),i=g.useRef(0),c=g.useCallback(m=>{const p=n.current,u=p?{scrollTop:p.scrollTop,scrollHeight:p.scrollHeight,clientHeight:p.clientHeight}:{scrollTop:0,scrollHeight:0,clientHeight:0},_=Dt(s.current,m,u);_.pinned!==s.current&&(s.current=_.pinned,r(_.pinned)),_.stick&&e.options.count>0&&e.scrollToEnd({behavior:"auto"})},[n,e]);g.useEffect(()=>{const m=n.current;if(!m)return;const p=()=>{i.current=performance.now()},u=()=>{c({kind:"scroll",gesture:performance.now()-i.current<On})};m.addEventListener("scroll",u,{passive:!0}),m.addEventListener("wheel",p,{passive:!0}),m.addEventListener("touchmove",p,{passive:!0}),m.addEventListener("pointerdown",p,{passive:!0}),m.addEventListener("keydown",p,{passive:!0});const _=new ResizeObserver(()=>{m.clientHeight>0&&c({kind:"shown"})});return _.observe(m),()=>{_.disconnect(),m.removeEventListener("scroll",u),m.removeEventListener("wheel",p),m.removeEventListener("touchmove",p),m.removeEventListener("pointerdown",p),m.removeEventListener("keydown",p)}},[c,n]);const d=g.useCallback(()=>c({kind:"tail"}),[c]),j=g.useCallback(()=>c({kind:"pin"}),[c]);return{pinned:o,followTail:d,pinToBottom:j}}const zn="_root_166ob_6",Ln="_viewport_166ob_13",Fn="_inner_166ob_20",Hn="_rowWrap_166ob_25",Kn="_empty_166ob_35",$n="_jumpToLatest_166ob_46",M={root:zn,viewport:Ln,inner:Fn,rowWrap:Hn,empty:Kn,jumpToLatest:$n},Un=160;function Wn(e,n,s,o,r){switch(e.kind){case"user":return t.jsx(An,{row:e,connector:!n});case"assistant":return t.jsx(wn,{row:e,assetBase:s,owningPaneId:o,workspaceCwd:r,connector:!n});case"reasoning":return t.jsx(Bn,{row:e,owningPaneId:o,workspaceCwd:r,connector:!n});case"tool":return t.jsx(Rn,{row:e,assetBase:s,owningPaneId:o,workspaceCwd:r,connector:!n});case"error":return t.jsx(In,{row:e,connector:!n});case"system":return t.jsx(Pn,{row:e})}}function qn({session:e,owningPaneId:n,workspaceCwd:s}){const o=e.timeline.rows,r=e.status==="running",i=Fe(),c=He(e.cwd,i),d=g.useRef(null),j=Oe({count:o.length,getScrollElement:()=>d.current,estimateSize:()=>Un,overscan:8,getItemKey:x=>{var S;return((S=o[x])==null?void 0:S.id)??x},measureElement:(x,S,D)=>{if(x.offsetParent!==null)return Me(x,S,D);const w=D.indexFromElement(x),b=D.options.getItemKey(w);return D.itemSizeCache.get(b)??D.options.estimateSize(w)},anchorTo:"end",scrollEndThreshold:je}),{pinned:m,followTail:p,pinToBottom:u}=Mn(j,d),_=Nt(o);return g.useEffect(()=>{p()},[o.length,p]),g.useEffect(()=>{_!==null&&u()},[_,u]),t.jsxs("div",{className:M.root,children:[t.jsx("div",{className:M.viewport,ref:d,children:o.length===0?!r&&t.jsx("div",{className:M.empty,children:"No messages yet — say something to start."}):t.jsx("div",{className:M.inner,style:{height:j.getTotalSize()},children:j.getVirtualItems().map(x=>{const S=o[x.index];return S?t.jsx("div",{ref:j.measureElement,"data-index":x.index,className:M.rowWrap,style:{transform:`translateY(${x.start}px)`},children:Wn(S,x.index===o.length-1,c,n,s)},x.key):null})})}),!m&&o.length>0&&t.jsx("button",{type:"button",className:M.jumpToLatest,onClick:u,title:"Jump to latest","aria-label":"Jump to latest",children:t.jsx(nt,{size:16,"aria-hidden":"true"})})]})}function Gn(e,n=!0){const s=$(o=>o.client);return me({queryKey:pe.agentCommands(e),queryFn:async()=>{if(!s)throw new Error("not connected");const o=await V(s,e),{commands:r}=await s.agent(o).listCommands();return r},enabled:!!s&&!!e&&n})}const Jn="_strip_nzfk5_4",Qn="_thumb_nzfk5_11",Vn="_remove_nzfk5_28",G={strip:Jn,thumb:Qn,remove:Vn};function Xn({images:e,onRemove:n}){return e.length===0?null:t.jsx("div",{className:G.strip,children:e.map((s,o)=>t.jsxs("div",{className:G.thumb,children:[t.jsx("img",{src:s.thumbUrl,alt:""}),t.jsx("button",{type:"button",className:G.remove,title:"Remove",onClick:()=>n(o),children:"×"})]},o))})}function Yn(e){const{promise:n,resolve:s,reject:o}=Promise.withResolvers(),r=new FileReader;return r.onload=()=>{const i=r.result;if(typeof i!="string"){o(new Error("Unexpected FileReader result"));return}const c=i.indexOf(","),d=c>=0?i.slice(c+1):i;s({mimeType:e.type,data:d,thumbUrl:i})},r.onerror=()=>o(r.error??new Error("Failed to read file")),r.readAsDataURL(e),n}const Zn="_picker_1jy8c_4",es="_search_1jy8c_10",ts="_list_1jy8c_28",ns="_item_1jy8c_33",ss="_itemActive_1jy8c_47",os="_checkSlot_1jy8c_51",as="_label_1jy8c_60",rs="_modelId_1jy8c_66",is="_state_1jy8c_73",ls="_stateError_1jy8c_82",cs="_commandContent_1jy8c_92",ds="_commandList_1jy8c_95",us="_commandItem_1jy8c_100",ms="_commandItemHeader_1jy8c_132",ps="_commandKindBadge_1jy8c_146",fs="_commandKindExtension_1jy8c_165",hs="_commandKindPrompt_1jy8c_170",_s="_commandKindSkill_1jy8c_175",gs="_commandDescription_1jy8c_180",h={picker:Zn,search:es,list:ts,item:ns,itemActive:ss,checkSlot:os,label:as,modelId:rs,state:is,stateError:ls,commandContent:cs,commandList:ds,commandItem:us,commandItemHeader:ms,commandKindBadge:ps,commandKindExtension:fs,commandKindPrompt:hs,commandKindSkill:_s,commandDescription:gs},xs={onOpenAutoFocus:e=>e.preventDefault()};function bs(e){switch(e){case"extension":return h.commandKindExtension;case"prompt":return h.commandKindPrompt;case"skill":return h.commandKindSkill;default:return}}function vs({open:e,onOpenChange:n,options:s,highlightedIndex:o,onSelect:r,isLoading:i,isError:c,errorMessage:d,hiddenExtensionCount:j,renderTrigger:m}){const p=g.useRef(null);return g.useEffect(()=>{var u,_;e&&((_=(u=p.current)==null?void 0:u.querySelector('[aria-selected="true"]'))==null||_.scrollIntoView({block:"nearest"}))},[e,o]),t.jsxs(xe,{open:e,onOpenChange:n,modal:!1,children:[t.jsx(be,{asChild:!0,children:m()}),t.jsxs(fe,{className:C(h.picker,h.commandContent),side:"top",sideOffset:4,...xs,onCloseAutoFocus:u=>u.preventDefault(),children:[i&&t.jsx("div",{className:h.state,children:t.jsx(X,{size:"sm"})}),!i&&c&&t.jsx("div",{className:h.stateError,children:d??"Failed to load commands"}),!i&&!c&&s.length===0&&t.jsx("div",{className:h.state,children:"No commands found"}),!i&&!c&&s.length>0&&t.jsx("div",{ref:p,className:C(h.list,h.commandList),children:s.map((u,_)=>t.jsxs("div",{role:"option","aria-selected":_===o,className:C(h.item,h.commandItem,_===o&&h.itemActive),title:u.description,onMouseDown:x=>{x.preventDefault(),r(u.value)},children:[t.jsxs("div",{className:h.commandItemHeader,children:[t.jsx("span",{className:h.label,children:u.label}),u.kind&&t.jsx("span",{className:C(h.commandKindBadge,bs(u.kind)),children:u.kind})]}),u.description&&t.jsx("div",{className:h.commandDescription,children:u.description})]},u.value))}),!i&&!c&&j>0&&t.jsxs("div",{className:h.state,children:[j," extension command(s) unavailable while the agent is running"]})]})]})}function ys(e,n=!0){const s=$(o=>o.client);return me({queryKey:pe.providerModels(e),queryFn:async()=>{if(!s)throw new Error("not connected");return(await s.providers.listModels(e)).models},enabled:!!s&&!!e&&n})}function js(e,n){if(!n)return e;const s=e.find(o=>o.id===n);return s?[s,...e.filter(o=>o.id!==n)]:e}function ks(e){const n=new Set;return e.filter(s=>n.has(s.id)?!1:(n.add(s.id),!0))}function Ss({currentModel:e,provider:n,onSelect:s,renderTrigger:o}){const[r,i]=g.useState(!1),[c,d]=g.useState(""),j=g.useRef(null),{data:m=[],isLoading:p,isError:u,error:_}=ys(n,r),x=ks(js(m,e));g.useEffect(()=>{var v;r&&(d(""),(v=j.current)==null||v.focus())},[r]);const S=new Map(x.map(v=>[v.id,v.provider])),D=x.map(v=>({value:v.id,label:v.label??v.id,description:v.id})),w=ve(D,c),b=_ instanceof Error?_.message:"Failed to load models";function N(v){v.stopPropagation(),v.key==="Escape"&&i(!1)}return t.jsxs(xe,{open:r,onOpenChange:i,modal:!1,children:[t.jsx(be,{asChild:!0,children:o(e)}),t.jsxs(fe,{minWidth:240,align:"end",sideOffset:6,className:h.picker,children:[t.jsx("input",{ref:j,className:h.search,placeholder:"Search models…",value:c,onChange:v=>d(v.target.value),onKeyDown:N}),p&&t.jsx("div",{className:h.state,children:t.jsx(X,{size:"sm"})}),!p&&u&&t.jsx("div",{className:h.stateError,children:b}),!p&&!u&&w.length===0&&t.jsx("div",{className:h.state,children:"No models found"}),!p&&!u&&w.length>0&&t.jsx("div",{className:h.list,children:w.map(v=>t.jsxs(pt,{className:h.item,onSelect:()=>s(v.value,S.get(v.value)),children:[t.jsx("span",{className:h.checkSlot,"aria-hidden":!0,children:v.value===e&&t.jsx(st,{size:14})}),t.jsx("span",{className:h.label,children:v.label}),t.jsxs("span",{className:h.modelId,children:["(",v.value,")"]})]},v.value))})]})]})}function Z(e){if(!e.startsWith("/"))return null;const n=/^\/(\S*)/.exec(e),s=(n==null?void 0:n[1])??"",o=1+s.length,r=/\S/.test(e.slice(o));return{name:s,end:o,hasArgs:r}}function Ds(e){return/^\/\S*$/.test(e)}function Ns(e,n){let s=0;const o=[];for(const r of e){if(n.running&&r.source==="extension"){s+=1;continue}o.push({value:r.name,label:`/${r.name}`,description:r.description,kind:r.source})}return{options:o,hiddenExtensionCount:s}}function Cs(e,n,s){return s<=0?0:(e+n+s)%s}function ws(e,n){const s=Z(e);return s?s.hasArgs?`/${n}${e.slice(s.end)}`:`/${n} `:`/${n} ${e}`}function Bs(e,n){const s=Z(e);return!s||!n.includes(s.name)?null:{end:s.end}}const Ts="_composer_3wzps_4",Es="_card_3wzps_13",Rs="_textarea_3wzps_26",As="_textareaWrap_3wzps_50",Is="_highlightLayer_3wzps_38",Ps="_commandMark_3wzps_73",Os="_hiddenFileInput_3wzps_98",Ms="_toolbar_3wzps_104",zs="_toolbarRight_3wzps_111",Ls="_toolBtn_3wzps_119",Fs="_roundBtn_3wzps_125",Hs="_modelBtn_3wzps_130",Ks="_modelLabel_3wzps_156",$s="_modelChevron_3wzps_161",k={composer:Ts,card:Es,textarea:Rs,textareaWrap:As,highlightLayer:Is,commandMark:Ps,hiddenFileInput:Os,toolbar:Ms,toolbarRight:zs,toolBtn:Ls,roundBtn:Fs,modelBtn:Hs,modelLabel:Ks,modelChevron:$s},Us=160;function K(e){e.style.height="auto",e.style.height=`${Math.min(e.scrollHeight,Us)}px`}function Ws(e){return typeof e=="object"&&e!==null&&"ok"in e&&e.ok===!1}function qs({sessionId:e}){const n=$(a=>a.client),s=R(a=>a.sessions[e]),o=R(a=>a.addOptimisticUserMessage),r=R(a=>a.markUserMessageFailed),i=R(a=>a.setCwd),c=R(a=>a.setModel),[d,j]=g.useState(""),[m,p]=g.useState([]),[u,_]=g.useState(!1),[x,S]=g.useState(!1),D=g.useRef(null),w=g.useRef(null),[b,N]=g.useState(!1),[v,U]=g.useState(0),T=(s==null?void 0:s.status)==="running",ke=!!n&&!(T?x:u)&&(d.trim().length>0||m.length>0),{data:ee=[],isLoading:Se,isError:De,error:te}=Gn(e,b),{options:ne,hiddenExtensionCount:Ne}=Ns(ee,{running:T}),se=Z(d),F=se?ve(ne,se.name):ne,Ce=ee.map(a=>a.name),I=Bs(d,Ce);async function oe(a){if(a.type.startsWith("image/"))try{const y=await Yn(a);p(f=>[...f,y])}catch{}}function we(a){for(const y of a.target.files??[])oe(y);a.target.value=""}function Be(a){for(const y of a.clipboardData.items)if(y.type.startsWith("image/")){a.preventDefault();const f=y.getAsFile();f&&oe(f)}}function Te(a){p(y=>y.filter((f,B)=>B!==a))}function Ee(a){const y=a.target.value;j(y),K(a.target);const f=Ds(y);f!==b&&N(f),f&&U(0)}function Re(a){var y;if(!b&&I&&a.key==="Backspace"){const f=a.currentTarget,B=f.selectionStart;if(B!==null&&B===f.selectionEnd){const P=I.end+(d[I.end]===" "?1:0);if(B>0&&B<=P){a.preventDefault();const A=d.slice(P);j(A),f.setSelectionRange(0,0),K(f);return}}}if(b&&F.length>0){if(a.key==="ArrowDown"||a.key==="ArrowUp"){a.preventDefault(),U(f=>Cs(f,a.key==="ArrowDown"?1:-1,F.length));return}if(a.key==="Enter"&&!a.shiftKey||a.key==="Tab"){a.preventDefault();const f=(y=F[v])==null?void 0:y.value;f&&ae(f);return}}if(b&&a.key==="Escape"){a.preventDefault(),N(!1);return}a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),re(T?"steer":"send"))}function ae(a){const y=ws(d,a);j(y),N(!1),U(0);const f=D.current;f&&(f.focus(),f.setSelectionRange(y.length,y.length),K(f))}async function re(a){if(!n||!s||(a==="steer"?x:u)||a==="steer"&&!s.agentId)return;const y=d.trim();if(!y&&m.length===0)return;j(""),N(!1),D.current&&K(D.current);const f=m;p([]);const B=y||"Describe this image",P=f.length>0?f.map(O=>({mimeType:O.mimeType,data:O.data})):void 0,A=crypto.randomUUID();o(e,A,B,P,a==="steer");const ie=a==="steer"?S:_;ie(!0);try{if(a==="steer"){const O=await n.agent(s.agentId).steer(B,{clientMessageId:A,images:P});Ws(O)&&r(e,A)}else{s.agentId||i(e,s.cwd||"~");const O=await V(n,e);await n.agent(O).send(B,{clientMessageId:A,images:P})}}catch{r(e,A)}finally{ie(!1)}}function Ae(){s!=null&&s.agentId&&(n==null||n.agent(s.agentId).interrupt())}function Ie(a,y){c(e,a,y),!(!n||!y)&&(async()=>{const f=await V(n,e);await n.agent(f).setModel(y,a)})().catch(()=>{})}return t.jsxs("div",{className:k.composer,children:[t.jsxs("div",{className:k.card,children:[t.jsxs("div",{className:k.textareaWrap,children:[t.jsx("div",{className:k.highlightLayer,"aria-hidden":!0,children:I?t.jsxs(t.Fragment,{children:[t.jsx("mark",{className:k.commandMark,children:d.slice(0,I.end)}),d.slice(I.end)]}):d}),t.jsx(Ke,{ref:D,className:k.textarea,rows:1,value:d,placeholder:T?"Steer the running turn… ⏎ steer · ⇧⏎ newline":"Ask anything… ⏎ send · ⇧⏎ newline · / commands",onChange:Ee,onKeyDown:Re,onPaste:Be})]}),t.jsx(Xn,{images:m,onRemove:Te}),t.jsxs("div",{className:k.toolbar,children:[t.jsx(H,{className:k.toolBtn,variant:"ghost",size:"sm",iconOnly:!0,title:"Attach image","aria-label":"Attach image",onClick:()=>{var a;return(a=w.current)==null?void 0:a.click()},children:t.jsx(ot,{size:16})}),t.jsx(vs,{open:b,onOpenChange:N,options:F,highlightedIndex:v,onSelect:ae,isLoading:Se,isError:De,errorMessage:te instanceof Error?te.message:void 0,hiddenExtensionCount:Ne,renderTrigger:()=>t.jsx(H,{className:k.toolBtn,variant:"ghost",size:"sm",iconOnly:!0,title:"Slash commands","aria-label":"Slash commands",children:t.jsx(at,{size:16})})}),t.jsxs("div",{className:k.toolbarRight,children:[t.jsx(Ss,{currentModel:s==null?void 0:s.model,provider:"pi",onSelect:Ie,renderTrigger:a=>t.jsxs("button",{type:"button",className:k.modelBtn,disabled:!n,title:a?`Model: ${a}`:"Select model",children:[t.jsx("span",{className:k.modelLabel,children:a??"Model"}),t.jsx(rt,{size:13,className:k.modelChevron,"aria-hidden":"true"})]})}),T&&t.jsx(H,{className:k.roundBtn,variant:"destructive",size:"sm",iconOnly:!0,title:"Stop the running turn","aria-label":"Stop",onClick:Ae,children:t.jsx(it,{size:14})}),t.jsx(H,{className:k.roundBtn,size:"sm",iconOnly:!0,disabled:!ke,title:T?"Steer the running turn":"Send","aria-label":T?"Steer":"Send",onClick:()=>void re(T?"steer":"send"),children:T?t.jsx(lt,{size:16}):t.jsx(ct,{size:18})})]})]})]}),t.jsx("input",{ref:w,className:k.hiddenFileInput,type:"file",accept:"image/*",multiple:!0,onChange:we})]})}const Gs="_track_oxvl6_2",Js="_sweep_oxvl6_24",Qs="_visuallyHidden_oxvl6_64",J={track:Gs,sweep:Js,visuallyHidden:Qs};function Vs({running:e}){return e?t.jsxs("div",{className:J.track,role:"progressbar","aria-label":"Turn in progress",children:[t.jsx("div",{className:J.sweep,"aria-hidden":"true"}),t.jsx("span",{className:J.visuallyHidden,role:"status","aria-live":"polite",children:"Agent is working…"})]}):null}const Xs="_panel_1tq06_1",Ys="_empty_1tq06_5",ue={panel:Xs,empty:Ys};function mo({tab:e,owningPaneId:n}){const{sessionId:s}=e.data,o=R(r=>r.sessions[s]);return St(s),o?t.jsxs(le,{className:ue.panel,children:[t.jsx(Vs,{running:o.status==="running"}),t.jsx(qn,{session:o,owningPaneId:n,workspaceCwd:e.workspaceCwd}),t.jsx(qs,{sessionId:o.id})]}):t.jsx(le,{children:t.jsx("div",{className:ue.empty,children:"Session not found."})})}export{mo as ChatPanel};
@@ -1 +0,0 @@
1
- var f=Object.defineProperty;var d=(e,r,t)=>r in e?f(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var a=(e,r,t)=>d(e,typeof r!="symbol"?r+"":r,t);import{u as m}from"./vendor-query-i7fr__Xm.js";import{u as p,r as g}from"./index-C-gDLAhS.js";import{j as u,r as l}from"./vendor-react-DQUAl2K8.js";import{P as h,Q as w,S as x,T as y,U as E,V as _}from"./vendor-DVp0ZLQo.js";class F extends Error{constructor(t,n){super("file_too_large");a(this,"size");a(this,"maxBytes");this.name="FileTooLargeError",this.size=t,this.maxBytes=n}}function R(e){if(!e.ok)throw e.error==="file_too_large"?new F(e.size??0,e.maxBytes):new Error(e.error??"file read failed");return{content:e.content??"",size:e.size??0}}function v(e,r=!0){const t=p(n=>n.client);return m({queryKey:g.fileRead(e),queryFn:async()=>{if(!t)throw new Error("not connected");const n=await t.connection.request("file_read_request",{path:e});return R(n)},enabled:!!t&&!!e&&r})}const z="_wrap_1feu3_1",B={wrap:z},c=new Map;function C(e){const[r,t]=l.useState(null);return l.useEffect(()=>{const n=E.matchFilename(_,e);if(!n){t(null);return}const s=c.get(n.name);if(s){t(s);return}let o=!1;return t(null),n.load().then(i=>{c.set(n.name,i),o||t(i)}),()=>{o=!0}},[e]),r?[r]:[]}function K({path:e,content:r}){const t=C(e),n=[h.lineWrapping,w(),...t];return u.jsx("div",{className:B.wrap,children:u.jsx(x,{value:r,theme:y,extensions:n,editable:!1,readOnly:!0,basicSetup:{highlightActiveLine:!1,foldGutter:!1,searchKeymap:!1},height:"100%"})})}export{K as C,F,v as u};
@@ -1 +0,0 @@
1
- import{r as f,j as s}from"./vendor-react-DQUAl2K8.js";import{M as v}from"./vendor-DVp0ZLQo.js";import{u as j,r as d,a as w,d as E,P as D,B as x,V as K,E as l,S as g}from"./index-C-gDLAhS.js";import{u as S,a as k}from"./vendor-query-i7fr__Xm.js";import{u as q}from"./use-file-watch-a91DX08b.js";import{D as z}from"./DiffView-CRrnffpG.js";import"./vendor-icons-CQPWxe0u.js";import"./vendor-overlays-BfyojyuH.js";import"./vendor-dnd-CayJj8TC.js";function N(e,a,r,i=!0){const t=j(n=>n.client);return S({queryKey:d.fileDiff(e,a,r),queryFn:async()=>{if(!t)throw new Error("not connected");return{patch:(await t.connection.request("file_diff_request",{path:e,cwd:a,staged:r})).patch??""}},enabled:!!t&&!!e&&!!a&&i})}const b=new Set(["text","markdown","image"]);function B(e,a,r){const i=k(),t=b.has(r)?w(e,a):null,{changedAt:n}=q(t);f.useEffect(()=>{n!==null&&(i.invalidateQueries({queryKey:d.fileRead(e)}),i.invalidateQueries({queryKey:d.fileDownload(e)}),i.invalidateQueries({queryKey:d.fileDiffByPath(e)}))},[n,e,i])}const F="_header_10rse_1",V="_path_10rse_11",C="_size_10rse_18",P="_viewToggle_10rse_23",Q="_body_10rse_28",c={header:F,path:V,size:C,viewToggle:P,body:Q};function y(e){return"path"in e}function R(e){return"staged"in e}function J({tab:e}){var m;const a=e.kind==="diff",r=e.data,i=y(r)?r.path:"",t=y(r)&&R(r)?r.staged:!1,[n,u]=f.useState(a?"diff":"file"),h=e.workspaceCwd||"~",p=E(i);B(i,h,p);const o=N(i,h,t,n==="diff"),_=K[p];return s.jsxs(D,{children:[s.jsxs("div",{className:c.header,children:[s.jsx("span",{className:c.path,children:i}),s.jsx("span",{className:c.size,children:n==="diff"?t?"staged":"unstaged":null}),s.jsxs("div",{className:c.viewToggle,children:[s.jsx(x,{size:"xs",variant:n==="file"?"default":"ghost",onClick:()=>u("file"),children:"File"}),s.jsx(x,{size:"xs",variant:n==="diff"?"default":"ghost",onClick:()=>u("diff"),children:"Diff"})]})]}),s.jsx("div",{className:v(c.body,"file-body"),children:n==="file"?s.jsx(f.Suspense,{fallback:s.jsxs(l,{children:[s.jsx(g,{size:"sm"})," Loading..."]}),children:s.jsx(_,{path:i})}):o.isLoading?s.jsxs(l,{children:[s.jsx(g,{size:"sm"})," Loading diff..."]}):o.isError?s.jsxs(l,{children:["Error: ",o.error instanceof Error?o.error.message:"unknown error"]}):(m=o.data)!=null&&m.patch?s.jsx(z,{patch:o.data.patch}):s.jsx(l,{style:{padding:"var(--pi-spacing-30)"},children:"No changes (file matches HEAD)"})})]})}export{J as FilePanel};
@@ -1 +0,0 @@
1
- import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as i,S as t}from"./index-C-gDLAhS.js";import{u as a}from"./use-file-download-DaCAhjAL.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DVp0ZLQo.js";import"./vendor-icons-CQPWxe0u.js";import"./vendor-overlays-BfyojyuH.js";import"./vendor-dnd-CayJj8TC.js";const n="_wrap_1vzo5_1",m="_image_1vzo5_15",s={wrap:n,image:m};function x({path:e}){const r=a(e);return r.isLoading?o.jsxs(i,{children:[o.jsx(t,{size:"sm"})," Loading image..."]}):r.isError?o.jsxs(i,{children:["Error: ",r.error instanceof Error?r.error.message:"unknown error"]}):r.data?o.jsx("div",{className:s.wrap,children:o.jsx("img",{className:s.image,src:r.data.objectUrl,alt:e.split("/").pop()||e})}):null}export{x as ImageViewer};
@@ -1 +0,0 @@
1
- import{r as d,j as r}from"./vendor-react-DQUAl2K8.js";import{E as n,S as c,B as a}from"./index-C-gDLAhS.js";import{u as l,C as m}from"./CodeView-D91mREsp.js";import{M as p}from"./markdown-B-dnhity.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DVp0ZLQo.js";import"./vendor-icons-CQPWxe0u.js";import"./vendor-overlays-BfyojyuH.js";import"./vendor-dnd-CayJj8TC.js";import"./vendor-highlight-BjiGXuEM.js";import"./vendor-markdown-Bc_dOmsB.js";const u="_wrap_qjlik_1",x="_toolbar_qjlik_6",j="_rendered_qjlik_17",s={wrap:u,toolbar:x,rendered:j};function C({path:t}){const e=l(t),[o,i]=d.useState("preview");return e.isLoading?r.jsxs(n,{children:[r.jsx(c,{size:"sm"})," Loading..."]}):e.isError?r.jsxs(n,{children:["Error: ",e.error instanceof Error?e.error.message:"unknown error"]}):e.data?r.jsxs("div",{className:s.wrap,children:[r.jsxs("div",{className:s.toolbar,children:[r.jsx(a,{size:"xs",variant:o==="preview"?"default":"ghost",onClick:()=>i("preview"),children:"Preview"}),r.jsx(a,{size:"xs",variant:o==="source"?"default":"ghost",onClick:()=>i("source"),children:"Source"})]}),o==="preview"?r.jsx("div",{className:s.rendered,children:r.jsx(p,{text:e.data.content})}):r.jsx(m,{path:t,content:e.data.content})]}):null}export{C as MarkdownFileViewer};
@@ -1 +0,0 @@
1
- ._wrap_qjlik_1{height:100%;min-height:0;overflow:auto}._toolbar_qjlik_6{position:sticky;top:0;z-index:1;display:flex;justify-content:flex-end;gap:var(--pi-spacing-2);padding:var(--pi-spacing-6) var(--pi-spacing-10);background:var(--pi-color-surface1);border-bottom:1px solid var(--pi-color-border)}._rendered_qjlik_17{padding:var(--pi-spacing-16) var(--pi-spacing-20);max-width:860px}
@@ -1 +0,0 @@
1
- import{r as b,j as r}from"./vendor-react-DQUAl2K8.js";import{r as k,E as d,S as u,B as w,P as h}from"./index-C-gDLAhS.js";import{u as S,F as _,C as y}from"./CodeView-D91mREsp.js";import{u as U}from"./vendor-query-i7fr__Xm.js";import{u as p}from"./use-file-download-DaCAhjAL.js";import"./vendor-DVp0ZLQo.js";import"./vendor-icons-CQPWxe0u.js";import"./vendor-overlays-BfyojyuH.js";import"./vendor-dnd-CayJj8TC.js";function B(n){const{enabled:s,download:e,decode:o}=n;return{isLoading:s&&(e.isLoading||e.hasObjectUrl&&o.isLoading),isError:e.isError||o.isError,error:e.isError?e.error:o.error,data:o.data}}function F(n,s=!0){var a;const e=p(n,s),o=(a=e.data)==null?void 0:a.objectUrl,t=U({queryKey:k.fileText(n,o??null),queryFn:async()=>({content:await(await fetch(o)).text()}),enabled:s&&!!o});return B({enabled:s,download:{isLoading:e.isLoading,isError:e.isError,error:e.error,hasObjectUrl:!!o},decode:{isLoading:t.isLoading,isError:t.isError,error:t.error,data:t.data}})}function N(n){const{maxDisplayBytes:s,inline:e,streamed:o,download:t}=n;if(e.isLoading)return{kind:"loading"};if(e.tooLarge){const{size:a}=e.tooLarge;return a>s?{kind:"too-large",size:a,maxDisplayBytes:s,downloading:t.requested&&t.isLoading,downloadUrl:t.objectUrl,downloadName:t.fileName}:o.isLoading?{kind:"streaming",size:a}:o.isError?{kind:"stream-error",size:a,message:o.errorMessage??"stream failed"}:o.content!==null?{kind:"streamed",size:a,content:o.content}:{kind:"loading"}}return e.isError?{kind:"error",message:e.errorMessage??"unknown error"}:e.content!==null?{kind:"inline",content:e.content}:{kind:"loading"}}const D="_note_1g5yz_1",M="_body_1g5yz_9",T="_tooLarge_1g5yz_13",g={note:D,body:M,tooLarge:T},E=30*1024*1024;function l(n){return`${(n/(1024*1024)).toFixed(1)} MB`}function Y({path:n}){var f,x,j,L;const s=S(n),e=s.error instanceof _?s.error:null,o=e!==null&&e.size<=E,t=F(n,o),[a,m]=b.useState(!1),c=p(n,a),i=N({maxDisplayBytes:E,inline:{isLoading:s.isLoading,isError:s.isError,tooLarge:e?{size:e.size}:null,errorMessage:s.error instanceof Error?s.error.message:null,content:((f=s.data)==null?void 0:f.content)??null},streamed:{isLoading:t.isLoading,isError:t.isError,errorMessage:t.error instanceof Error?t.error.message:null,content:((x=t.data)==null?void 0:x.content)??null},download:{requested:a,isLoading:c.isLoading,objectUrl:((j=c.data)==null?void 0:j.objectUrl)??null,fileName:((L=c.data)==null?void 0:L.fileName)??null}});switch(i.kind){case"loading":return r.jsxs(d,{children:[r.jsx(u,{size:"sm"})," Loading..."]});case"inline":return r.jsx(y,{path:n,content:i.content});case"streaming":return r.jsxs(d,{children:[r.jsx(u,{size:"sm"})," Streaming ",l(i.size)," file..."]});case"stream-error":return r.jsxs(d,{children:["Error: ",i.message]});case"streamed":return r.jsxs(h,{children:[r.jsxs("div",{className:g.note,children:[l(i.size)," file streamed"]}),r.jsx("div",{className:g.body,children:r.jsx(y,{path:n,content:i.content})})]});case"too-large":{const z=n.split("/").pop()||n;return r.jsx(d,{children:r.jsxs("div",{className:g.tooLarge,children:[r.jsxs("div",{children:[l(i.size)," — too large to display (display ceiling is"," ",l(i.maxDisplayBytes),")."]}),i.downloading?r.jsx(u,{size:"sm"}):i.downloadUrl?r.jsx("a",{href:i.downloadUrl,download:i.downloadName||z,children:r.jsx(w,{size:"sm",children:"Save file"})}):r.jsx(w,{size:"sm",onClick:()=>m(!0),children:"Download"})]})})}case"error":return r.jsxs(d,{children:["Error: ",i.message]})}}export{E as MAX_DISPLAY_BYTES,Y as TextViewer};
@@ -1 +0,0 @@
1
- import{j as o}from"./vendor-react-DQUAl2K8.js";import{E as e,S as t}from"./index-C-gDLAhS.js";import{u as n}from"./use-file-download-DaCAhjAL.js";import"./vendor-query-i7fr__Xm.js";import"./vendor-DVp0ZLQo.js";import"./vendor-icons-CQPWxe0u.js";import"./vendor-overlays-BfyojyuH.js";import"./vendor-dnd-CayJj8TC.js";const a="_wrap_gy3e6_1",m="_video_gy3e6_10",i={wrap:a,video:m};function v({path:s}){const r=n(s);return r.isLoading?o.jsxs(e,{children:[o.jsx(t,{size:"sm"})," Loading video..."]}):r.isError?o.jsxs(e,{children:["Error: ",r.error instanceof Error?r.error.message:"unknown error"]}):r.data?o.jsx("div",{className:i.wrap,children:o.jsx("video",{className:i.video,src:r.data.objectUrl,controls:!0})}):null}export{v as VideoViewer};