@openchamber/web 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{JsonTreeView-CUIfrcFf.js → JsonTreeView-bLRkNPS9.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-Bma9y3dD.js → MarkdownRendererImpl-FSTq-eVA.js} +2 -2
- package/dist/assets/{MultiRunWindow-Cwc0x7fs.js → MultiRunWindow-DezP_Pyy.js} +1 -1
- package/dist/assets/{OnboardingScreen-BhozUlcE.js → OnboardingScreen-CeZMVgH8.js} +1 -1
- package/dist/assets/{SettingsWindow-B4B2bn0C.js → SettingsWindow-Dlfk0yzA.js} +1 -1
- package/dist/assets/TerminalView-CdCfCaFq.js +1 -0
- package/dist/assets/{ToolOutputDialog-7U42lN20.js → ToolOutputDialog-CePopKV7.js} +6 -6
- package/dist/assets/es-CyjenLd8.js +15 -0
- package/dist/assets/index-NnYXwoao.css +1 -0
- package/dist/assets/ko-Cs7yF9Jn.js +15 -0
- package/dist/assets/{main-rHOaDqOy.js → main-BvaFBcXN.js} +2 -2
- package/dist/assets/main-DcpUnRRo.js +225 -0
- package/dist/assets/miniChat-Dmzb8Mwv.js +2 -0
- package/dist/assets/{modelPrefsAutoSave-D5z_F_WP.js → modelPrefsAutoSave-HUPrH1r2.js} +99 -93
- package/dist/assets/pl-XjTt7Hsk.js +15 -0
- package/dist/assets/pt-BR-knvpJ94d.js +15 -0
- package/dist/assets/renderElectronMiniChatApp-EXGwfTjq.js +2 -0
- package/dist/assets/uk-DUPvcQAj.js +15 -0
- package/dist/assets/zh-CN-DWiTG93s.js +15 -0
- package/dist/index.html +3 -3
- package/dist/mini-chat.html +3 -3
- package/package.json +1 -1
- package/server/lib/preview/proxy-runtime.js +43 -3
- package/dist/assets/TerminalView-BpoHWJj6.js +0 -1
- package/dist/assets/es-DLzL0vVb.js +0 -15
- package/dist/assets/index-D5TVqnib.css +0 -1
- package/dist/assets/ko-apnbnEuD.js +0 -15
- package/dist/assets/main-ClS4RVxe.js +0 -217
- package/dist/assets/miniChat-Cx8YK32Y.js +0 -2
- package/dist/assets/pl-DUKUujvh.js +0 -15
- package/dist/assets/pt-BR-D0UPeIZC.js +0 -15
- package/dist/assets/renderElectronMiniChatApp-zbukf-1g.js +0 -2
- package/dist/assets/uk-CaTe2At9.js +0 -15
- package/dist/assets/zh-CN-D-oQmPdK.js +0 -15
- /package/dist/assets/{index-B2ztI3pp.js → index-CKlDk4Io.js} +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import{R as v,c as he,j as i,v as Ke,bG as Le,ak as
|
|
1
|
+
import{R as v,c as he,j as i,v as Ke,bG as Le,ak as Ie,ai as He,br as Ye,s as Fe}from"./vendor-.bun-BFTPeDgG.js";import{u as Me,c as pe,I as D,bD as Xe,eS as Te,bB as Ve,eT as Qe,eU as et,eV as tt,eW as nt,eX as it,b6 as We,eY as st,eZ as ot,bu as rt,bw as Ee,e_ as at,bx as Ce,au as lt,av as ct}from"./modelPrefsAutoSave-HUPrH1r2.js";import{J as dt}from"./JsonTreeView-bLRkNPS9.js";import"./index-CKlDk4Io.js";const ut=80,ft=20,mt=n=>n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`),ht=n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${mt(e)}:${String(t)};`).join(""),pt=n=>n.split(",").map(e=>e.trim()).filter(Boolean).flatMap(e=>e.startsWith(".token")?[`.oc-virtualized-prism ${e}`]:e.startsWith("token.")?[`.oc-virtualized-prism .${e}`]:/^[a-z0-9_-]+$/i.test(e)?[`.oc-virtualized-prism .token.${e}`]:e.includes("token")?[`.oc-virtualized-prism ${e}`]:[]),gt=n=>{const e=[];return Object.entries(n).forEach(([t,a])=>{const l=pt(t);if(l.length===0)return;const o=ht(a);o&&e.push(`${l.join(",")}{${o}}`)}),e.join(`
|
|
2
2
|
`)},xt={text:"plain",plaintext:"plain",shell:"bash",sh:"bash",zsh:"bash",patch:"diff",dockerfile:"docker",js:"javascript",ts:"typescript"},wt=n=>{const e=n.toLowerCase();return xt[e]??e},bt=5e3,ye=new Map,yt=(n,e)=>{const t=wt(e),a=`${t}
|
|
3
|
-
${n}`,l=ye.get(a);if(l!==void 0)return l;const o=Le.languages[t]??Le.languages.text;if(!o){const r=Ae(n);return ye.set(a,r),r}try{const r=Le.highlight(n,o,t);if(ye.size>=bt){const s=ye.keys().next().value;typeof s=="string"&&ye.delete(s)}return ye.set(a,r),r}catch{const r=Ae(n);return ye.set(a,r),r}};function Ae(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const Ue=v.memo(n=>{const e=he.c(26),{lines:t,language:a,syntaxTheme:l,maxHeight:o,showLineNumbers:r,lineStyles:s}=n,c=o===void 0?"60vh":o,d=r===void 0?!0:r;let f;e[0]!==l?(f=gt(l),e[0]=l,e[1]=f):f=e[1];const g=f;if(!(t.length>ut)){let b;e[2]!==c?(b={maxHeight:c,overflow:"auto"},e[2]=c,e[3]=b):b=e[3];let w;e[4]!==g?(w=g?i.jsx("style",{children:g}):null,e[4]=g,e[5]=w):w=e[5];let y;if(e[6]!==a||e[7]!==s||e[8]!==t||e[9]!==d){let x;e[11]!==a||e[12]!==s||e[13]!==d?(x=(k
|
|
3
|
+
${n}`,l=ye.get(a);if(l!==void 0)return l;const o=Le.languages[t]??Le.languages.text;if(!o){const r=Ae(n);return ye.set(a,r),r}try{const r=Le.highlight(n,o,t);if(ye.size>=bt){const s=ye.keys().next().value;typeof s=="string"&&ye.delete(s)}return ye.set(a,r),r}catch{const r=Ae(n);return ye.set(a,r),r}};function Ae(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}const Ue=v.memo(n=>{const e=he.c(26),{lines:t,language:a,syntaxTheme:l,maxHeight:o,showLineNumbers:r,lineStyles:s}=n,c=o===void 0?"60vh":o,d=r===void 0?!0:r;let f;e[0]!==l?(f=gt(l),e[0]=l,e[1]=f):f=e[1];const g=f;if(!(t.length>ut)){let b;e[2]!==c?(b={maxHeight:c,overflow:"auto"},e[2]=c,e[3]=b):b=e[3];let w;e[4]!==g?(w=g?i.jsx("style",{children:g}):null,e[4]=g,e[5]=w):w=e[5];let y;if(e[6]!==a||e[7]!==s||e[8]!==t||e[9]!==d){let x;e[11]!==a||e[12]!==s||e[13]!==d?(x=(_,k)=>i.jsx(De,{line:_,language:a,showLineNumbers:d,style:s?.(_)},k),e[11]=a,e[12]=s,e[13]=d,e[14]=x):x=e[14],y=t.map(x),e[6]=a,e[7]=s,e[8]=t,e[9]=d,e[10]=y}else y=e[10];let P;return e[15]!==b||e[16]!==w||e[17]!==y?(P=i.jsxs("div",{className:"typography-code font-mono w-full min-w-0 oc-virtualized-prism",style:b,children:[w,y]}),e[15]=b,e[16]=w,e[17]=y,e[18]=P):P=e[18],P}let R;return e[19]!==a||e[20]!==s||e[21]!==t||e[22]!==c||e[23]!==g||e[24]!==d?(R=i.jsx(Ge,{lines:t,language:a,prismThemeCss:g,maxHeight:c,showLineNumbers:d,lineStyles:s}),e[19]=a,e[20]=s,e[21]=t,e[22]=c,e[23]=g,e[24]=d,e[25]=R):R=e[25],R});Ue.displayName="VirtualizedCodeBlock";const Ge=v.memo(({lines:n,language:e,prismThemeCss:t,maxHeight:a,showLineNumbers:l,lineStyles:o})=>{const r=v.useRef(null),s=Ke({count:n.length,getScrollElement:()=>r.current,estimateSize:()=>ft,overscan:20});return i.jsxs("div",{ref:r,className:"typography-code font-mono w-full min-w-0 oc-virtualized-prism",style:{maxHeight:a,overflow:"auto"},children:[t?i.jsx("style",{children:t}):null,i.jsx("div",{style:{height:`${s.getTotalSize()}px`,width:"100%",position:"relative"},children:s.getVirtualItems().map(c=>{const d=n[c.index];return i.jsx("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:`${c.size}px`,transform:`translateY(${c.start}px)`},children:i.jsx(De,{line:d,language:e,showLineNumbers:l,style:o?.(d)})},c.index)})})]})});Ge.displayName="VirtualizedRows";const De=v.memo(n=>{const e=he.c(15),{line:t,language:a,showLineNumbers:l,style:o}=n;let r;e[0]!==a||e[1]!==t.text?(r=yt(t.text,a),e[0]=a,e[1]=t.text,e[2]=r):r=e[2];const s=r;let c;e[3]!==t.isInfo||e[4]!==t.lineNumber||e[5]!==l?(c=l&&i.jsx("span",{className:"w-10 flex-shrink-0 text-right pr-3 select-none border-r mr-3 -my-0.5 py-0.5",style:{color:"var(--tools-edit-line-number)",borderColor:"var(--tools-border)"},children:!t.isInfo&&t.lineNumber!=null?t.lineNumber:""}),e[3]=t.isInfo,e[4]=t.lineNumber,e[5]=l,e[6]=c):c=e[6];let d;e[7]!==s||e[8]!==t.isInfo||e[9]!==t.text?(d=i.jsx("div",{className:"flex-1 min-w-0",children:t.isInfo?i.jsx("div",{className:"whitespace-pre-wrap break-words text-muted-foreground/70 italic",children:t.text}):i.jsx("div",{className:"whitespace-pre",dangerouslySetInnerHTML:{__html:s}})}),e[7]=s,e[8]=t.isInfo,e[9]=t.text,e[10]=d):d=e[10];let f;return e[11]!==o||e[12]!==c||e[13]!==d?(f=i.jsxs("div",{className:"typography-code font-mono flex w-full min-w-0",style:o,children:[c,d]}),e[11]=o,e[12]=c,e[13]=d,e[14]=f):f=e[14],f});De.displayName="VirtualizedCodeBlock.Row";const jt=n=>{const e="h-3.5 w-3.5 flex-shrink-0",t=n.toLowerCase();return t==="reasoning"?i.jsx(D,{name:"brain-ai-3",className:e}):t==="image-preview"?i.jsx(D,{name:"file-image",className:e}):t==="mermaid-preview"?i.jsx(D,{name:"file-list-2",className:e}):t==="edit"||t==="multiedit"||t==="apply_patch"||t==="str_replace"||t==="str_replace_based_edit_tool"?i.jsx(D,{name:"pencil-ai",className:e}):t==="write"||t==="create"||t==="file_write"?i.jsx(D,{name:"file-pdf",className:e}):t==="read"||t==="view"||t==="file_read"||t==="cat"?i.jsx(D,{name:"file-pdf",className:e}):t==="bash"||t==="shell"||t==="cmd"||t==="terminal"?i.jsx(D,{name:"terminal-box",className:e}):t==="list"||t==="ls"||t==="dir"||t==="list_files"?i.jsx(D,{name:"folder-6",className:e}):t==="search"||t==="grep"||t==="find"||t==="ripgrep"?i.jsx(D,{name:"search",className:e}):t==="glob"?i.jsx(D,{name:"file-search",className:e}):t==="fetch"||t==="curl"||t==="wget"||t==="webfetch"?i.jsx(D,{name:"global",className:e}):t==="web-search"||t==="websearch"||t==="search_web"||t==="google"||t==="bing"||t==="duckduckgo"?i.jsx(D,{name:"search",className:e}):t==="todowrite"||t==="todoread"?i.jsx(D,{name:"list-check-3",className:e}):t==="plan_enter"?i.jsx(D,{name:"file-list-2",className:e}):t==="plan_exit"?i.jsx(D,{name:"task",className:e}):t.startsWith("git")?i.jsx(D,{name:"git-branch",className:e}):i.jsx(D,{name:"tools",className:e})},Oe=150,vt=40,Nt=120,Tt=3,Re={style:{background:"transparent",backgroundColor:"transparent",fontSize:"inherit"}},St={download:!1,copy:!1,fullscreen:!1,panZoom:!0},_t=`
|
|
4
4
|
[data-diff-header],
|
|
5
5
|
[data-diff] {
|
|
6
6
|
[data-separator] {
|
|
7
7
|
height: 24px !important;
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
`,_t={hunkLineCount:50,lineHeight:24,diffHeaderHeight:44,hunkSeparatorHeight:24,fileGap:0},Rt=()=>{const n=he.c(22),e=rt();let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=Ee(!1),n[0]=t):t=n[0];const a=t;let l;n[1]===Symbol.for("react.memo_cache_sentinel")?(l=Ee(!0),n[1]=l):l=n[1];const o=l;let r;n[2]!==e?.availableThemes?(r=()=>e?.availableThemes??[a,o],n[2]=e?.availableThemes,n[3]=r):r=n[3],e?.availableThemes;let s;n[4]!==r?(s=r(),n[4]=r,n[5]=s):s=n[5];const c=s,d=e?.lightThemeId??a.metadata.id,f=e?.darkThemeId??o.metadata.id;let g;n[6]!==c||n[7]!==d?(g=c.find(N=>N.metadata.id===d)??a,n[6]=c,n[7]=d,n[8]=g):g=n[8];const E=g;let I;n[9]!==c||n[10]!==f?(I=c.find(N=>N.metadata.id===f)??o,n[9]=c,n[10]=f,n[11]=I):I=n[11];const b=I;let w,y;n[12]!==b||n[13]!==E?(w=()=>{Ce(E),Ce(b)},y=[b,E],n[12]=b,n[13]=E,n[14]=w,n[15]=y):(w=n[14],y=n[15]),v.useEffect(w,y);const P=e?.currentTheme.metadata.variant??"light";let x;n[16]!==b.metadata.id||n[17]!==E.metadata.id?(x={light:E.metadata.id,dark:b.metadata.id},n[16]=b.metadata.id,n[17]=E.metadata.id,n[18]=x):x=n[18];const k=P==="dark"?"dark":"light";let _;return n[19]!==x||n[20]!==k?(_={theme:x,themeType:k},n[19]=x,n[20]=k,n[21]=_):_=n[21],_},ze=()=>({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}),$e={mobile:{widthRatio:.94,heightRatio:.86,padding:10},desktop:{widthRatio:.8,heightRatio:.8,padding:16}},It=(n,e)=>{const t=e?$e.mobile:$e.desktop,a=Math.max(160,n.width-t.padding*2),l=Math.max(160,n.height-t.padding*2);return{maxWidth:Math.max(160,Math.min(a,n.width*t.widthRatio)),maxHeight:Math.max(160,Math.min(l,n.height*t.heightRatio))}},Pt=n=>{try{const o=Array.from(n.querySelectorAll("g"));let r=0,s=null;for(const c of o){if(!(c instanceof SVGGraphicsElement))continue;const d=c.getBBox();if(!(d.width>0&&d.height>0))continue;const f=d.width*d.height;f>r&&(r=f,s=d.width/d.height)}if(s&&Number.isFinite(s)&&s>0)return s}catch{}const e=n.getAttribute("viewBox");if(e){const o=e.trim().split(/\s+/).map(Number);if(o.length===4){const r=o[2],s=o[3];if(Number.isFinite(r)&&Number.isFinite(s)&&r>0&&s>0)return r/s}}const t=Number(n.getAttribute("width")),a=Number(n.getAttribute("height"));if(Number.isFinite(t)&&Number.isFinite(a)&&t>0&&a>0)return t/a;const l=n.getBoundingClientRect();return l.width>0&&l.height>0?l.width/l.height:null},Be=n=>{const e=he.c(7),[t,a]=v.useState(n),[l,o]=v.useState(n),[r,s]=v.useState(!1);let c,d;e[0]!==n?(c=()=>{if(n){if(a(!0),s(!0),typeof window>"u"){o(!0);return}const E=window.requestAnimationFrame(()=>{o(!0)}),I=window.setTimeout(()=>{s(!1)},Oe);return()=>{window.cancelAnimationFrame(E),window.clearTimeout(I)}}if(o(!1),s(!0),typeof window>"u"){a(!1);return}const g=window.setTimeout(()=>{a(!1),s(!1)},Oe);return()=>{window.clearTimeout(g)}},d=[n],e[0]=n,e[1]=c,e[2]=d):(c=e[1],d=e[2]),v.useEffect(c,d);let f;return e[3]!==t||e[4]!==r||e[5]!==l?(f={isRendered:t,isVisible:l,isTransitioning:r},e[3]=t,e[4]=r,e[5]=l,e[6]=f):f=e[6],f},qe=n=>{const e=he.c(3),[t,a]=v.useState(ze);let l,o;return e[0]!==n?(l=()=>{if(!n||typeof window>"u")return;const r=()=>{a(ze())};return r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},o=[n],e[0]=n,e[1]=l,e[2]=o):(l=e[1],o=e[2]),v.useEffect(l,o),t},Lt=n=>{const e=he.c(103),{popup:t,onOpenChange:a,isMobile:l}=n,{t:o}=Me();let r;e:{const u=t.image;if(!u){let R;e[0]===Symbol.for("react.memo_cache_sentinel")?(R=[],e[0]=R):R=e[0],r=R;break e}let h;e[1]!==u.gallery?(h=Array.isArray(u.gallery)?u.gallery.filter(Dt):[],e[1]=u.gallery,e[2]=h):h=e[2];const M=h;if(M.length>0){r=M;break e}let C;e[3]!==u.filename||e[4]!==u.mimeType||e[5]!==u.size||e[6]!==u.url?(C=[{url:u.url,mimeType:u.mimeType,filename:u.filename,size:u.size}],e[3]=u.filename,e[4]=u.mimeType,e[5]=u.size,e[6]=u.url,e[7]=C):C=e[7],r=C}const s=r,[c,d]=v.useState(0),[f,g]=v.useState(null),{isRendered:E,isVisible:I,isTransitioning:b}=Be(t.open),w=qe(t.open);let y;e[8]!==s||e[9]!==t.image||e[10]!==t.open?(y=()=>{if(!t.open||s.length===0)return;const u=typeof t.image?.index=="number"?t.image.index:-1;if(u>=0&&u<s.length){d(u);return}const h=t.image?.url?s.findIndex(M=>M.url===t.image?.url):-1;d(h>=0?h:0)},e[8]=s,e[9]=t.image,e[10]=t.open,e[11]=y):y=e[11];const P=t.image?.index,x=t.image?.url;let k;e[12]!==s||e[13]!==t.open||e[14]!==P||e[15]!==x?(k=[s,P,x,t.open],e[12]=s,e[13]=t.open,e[14]=P,e[15]=x,e[16]=k):k=e[16],v.useEffect(y,k);const _=s[c]??s[0]??t.image,N=_?.filename||t.title||"Image preview",p=s.length>1;let T;e[17]!==s.length?(T=()=>{s.length<=1||d(u=>(u-1+s.length)%s.length)},e[17]=s.length,e[18]=T):T=e[18];const S=T;let z;e[19]!==s.length?(z=()=>{s.length<=1||d(u=>(u+1)%s.length)},e[19]=s.length,e[20]=z):z=e[20];const m=z;let $,L;e[21]!==p||e[22]!==a||e[23]!==t.open||e[24]!==m||e[25]!==S?($=()=>{if(!t.open)return;const u=h=>{if(h.key==="Escape"){a(!1);return}if(h.key==="ArrowLeft"&&p){h.preventDefault(),S();return}h.key==="ArrowRight"&&p&&(h.preventDefault(),m())};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},L=[p,a,t.open,m,S],e[21]=p,e[22]=a,e[23]=t.open,e[24]=m,e[25]=S,e[26]=$,e[27]=L):($=e[26],L=e[27]),v.useEffect($,L);let X;e[28]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{g(null)},e[28]=X):X=e[28];const K=_?.url;let ie;e[29]!==K?(ie=[K],e[29]=K,e[30]=ie):ie=e[30],v.useEffect(X,ie);let je;e:{const u=Math.max(160,w.width*(l?.86:.75)),h=Math.max(160,w.height*(l?.72:.75));if(!f){let ve;e[31]!==u?(ve=Math.round(u),e[31]=u,e[32]=ve):ve=e[32];let Ne;e[33]!==h?(Ne=Math.round(h),e[33]=h,e[34]=Ne):Ne=e[34];let _e;e[35]!==ve||e[36]!==Ne?(_e={width:ve,height:Ne},e[35]=ve,e[36]=Ne,e[37]=_e):_e=e[37],je=_e;break e}const M=u/f.width,C=h/f.height,R=Math.min(M,C);let A;e[38]!==f.width||e[39]!==R?(A=Math.round(f.width*R),e[38]=f.width,e[39]=R,e[40]=A):A=e[40];const Y=Math.max(1,A);let Se;e[41]!==f.height||e[42]!==R?(Se=Math.round(f.height*R),e[41]=f.height,e[42]=R,e[43]=Se):Se=e[43];const Pe=Math.max(1,Se);let ke;e[44]!==Y||e[45]!==Pe?(ke={width:Y,height:Pe},e[44]=Y,e[45]=Pe,e[46]=ke):ke=e[46],je=ke}const ge=je;if(!E||!_||typeof document>"u")return null;const se=t.open?"pointer-events-auto":"pointer-events-none";let oe;e[47]!==se?(oe=pe("fixed inset-0 z-50",se),e[47]=se,e[48]=oe):oe=e[48];const xe=b&&"transition-opacity duration-150 ease-out",re=I?"opacity-100":"opacity-0";let H;e[49]!==xe||e[50]!==re?(H=pe("absolute inset-0 bg-black/40",xe,re),e[49]=xe,e[50]=re,e[51]=H):H=e[51];let F;e[52]!==a?(F=()=>a(!1),e[52]=a,e[53]=F):F=e[53];let ae;e[54]!==H||e[55]!==F?(ae=i.jsx("div",{"aria-hidden":"true",className:H,onMouseDown:F}),e[54]=H,e[55]=F,e[56]=ae):ae=e[56];let V;e[57]!==p||e[58]!==m||e[59]!==S||e[60]!==o?(V=p&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onMouseDown:Et,onClick:S,className:"absolute left-3 top-1/2 -translate-y-1/2 z-10 h-10 w-10 flex items-center justify-center rounded-full bg-black/40 text-foreground/90 hover:bg-black/55 focus:outline-none focus:ring-2 focus:ring-primary/60","aria-label":o("chat.toolOutputDialog.image.previousAria"),children:i.jsx(D,{name:"arrow-left-s",className:"h-6 w-6"})}),i.jsx("button",{type:"button",onMouseDown:Ct,onClick:m,className:"absolute right-3 top-1/2 -translate-y-1/2 z-10 h-10 w-10 flex items-center justify-center rounded-full bg-black/40 text-foreground/90 hover:bg-black/55 focus:outline-none focus:ring-2 focus:ring-primary/60","aria-label":o("chat.toolOutputDialog.image.nextAria"),children:i.jsx(D,{name:"arrow-right-s",className:"h-6 w-6"})})]}),e[57]=p,e[58]=m,e[59]=S,e[60]=o,e[61]=V):V=e[61];const we=l?"p-2.5":"p-4";let le;e[62]!==we?(le=pe("absolute inset-0 flex items-center justify-center pointer-events-none",we),e[62]=we,e[63]=le):le=e[63];const ce=b&&"transition-opacity duration-150 ease-out",be=I?"opacity-100":"opacity-0";let W;e[64]!==ce||e[65]!==be?(W=pe("pointer-events-auto flex flex-col gap-2",ce,be),e[64]=ce,e[65]=be,e[66]=W):W=e[66];const de=`${ge.width}px`;let U;e[67]!==de?(U={width:de},e[67]=de,e[68]=U):U=e[68];let Q;e[69]!==N?(Q=i.jsx("div",{className:"min-w-0 flex-1 text-foreground typography-ui-header font-semibold truncate",title:N,children:N}),e[69]=N,e[70]=Q):Q=e[70];let G;e[71]!==a?(G=()=>a(!1),e[71]=a,e[72]=G):G=e[72];let ue;e[73]!==o?(ue=o("chat.toolOutputDialog.image.closeAria"),e[73]=o,e[74]=ue):ue=e[74];let ee;e[75]===Symbol.for("react.memo_cache_sentinel")?(ee=i.jsx(D,{name:"close",className:"h-4 w-4"}),e[75]=ee):ee=e[75];let B;e[76]!==G||e[77]!==ue?(B=i.jsx("button",{type:"button",className:"h-8 w-8 flex items-center justify-center rounded-lg text-muted-foreground/80 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-primary/60",onClick:G,"aria-label":ue,children:ee}),e[76]=G,e[77]=ue,e[78]=B):B=e[78];let q;e[79]!==Q||e[80]!==B?(q=i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[Q,B]}),e[79]=Q,e[80]=B,e[81]=q):q=e[81];const fe=`${ge.width}px`,me=`${ge.height}px`;let Z;e[82]!==fe||e[83]!==me?(Z={width:fe,height:me},e[82]=fe,e[83]=me,e[84]=Z):Z=e[84];let te;e[85]===Symbol.for("react.memo_cache_sentinel")?(te=u=>{const h=u.currentTarget,M=h.naturalWidth,C=h.naturalHeight;M>0&&C>0&&g(R=>R&&R.width===M&&R.height===C?R:{width:M,height:C})},e[85]=te):te=e[85];let J;e[86]!==_.url||e[87]!==N||e[88]!==Z?(J=i.jsx("img",{src:_.url,alt:N,className:"block object-contain",style:Z,loading:"lazy",onLoad:te}),e[86]=_.url,e[87]=N,e[88]=Z,e[89]=J):J=e[89];let ne;e[90]!==W||e[91]!==U||e[92]!==q||e[93]!==J?(ne=i.jsxs("div",{className:W,style:U,children:[q,J]}),e[90]=W,e[91]=U,e[92]=q,e[93]=J,e[94]=ne):ne=e[94];let j;e[95]!==le||e[96]!==ne?(j=i.jsx("div",{className:le,children:ne}),e[95]=le,e[96]=ne,e[97]=j):j=e[97];let O;if(e[98]!==oe||e[99]!==ae||e[100]!==V||e[101]!==j){const u=i.jsxs("div",{className:oe,children:[ae,V,j]});O=Fe.createPortal(u,document.body),e[98]=oe,e[99]=ae,e[100]=V,e[101]=j,e[102]=O}else O=e[102];return O},Ze=v.memo(n=>{const e=he.c(7),{popup:t,diffViewMode:a,pierreThemeConfig:l}=n,o=t.content||"",r=a==="unified"?"unified":"split";let s;e[0]!==l.theme||e[1]!==l.themeType||e[2]!==r?(s={diffStyle:r,diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",disableFileHeader:!0,maxLineDiffLength:1e3,expansionLineCount:20,overflow:"wrap",theme:l.theme,themeType:l.themeType,unsafeCSS:kt},e[0]=l.theme,e[1]=l.themeType,e[2]=r,e[3]=s):s=e[3];let c;return e[4]!==o||e[5]!==s?(c=i.jsx("div",{className:"typography-code",children:i.jsx(Ye,{patch:o,metrics:_t,options:s,className:"block w-full"})}),e[4]=o,e[5]=s,e[6]=c):c=e[6],c});Ze.displayName="DialogUnifiedDiff";const Je=v.memo(n=>{const e=he.c(30),{popup:t,syntaxTheme:a,pierreThemeConfig:l}=n;let o;e[0]!==t.content?(o=at(t.content),e[0]=t.content,e[1]=o):o=e[1];const r=o,s=t.metadata?.input;let c;e[2]!==s?(c=typeof s=="object"&&s!==null?s:{},e[2]=s,e[3]=c):c=e[3];const d=c,f=typeof d.offset=="number"?d.offset:0,g=typeof d.file_path=="string"?d.file_path:typeof d.filePath=="string"?d.filePath:typeof d.path=="string"?d.path:"read-output";let E;e[4]!==r.lines?(E=r.lines.map(At).join(`
|
|
11
|
-
`),e[4]=r.lines,e[5]=E):E=e[5];const
|
|
10
|
+
`,kt={hunkLineCount:50,lineHeight:24,diffHeaderHeight:44,hunkSeparatorHeight:24,fileGap:0},It=()=>{const n=he.c(22),e=rt();let t;n[0]===Symbol.for("react.memo_cache_sentinel")?(t=Ee(!1),n[0]=t):t=n[0];const a=t;let l;n[1]===Symbol.for("react.memo_cache_sentinel")?(l=Ee(!0),n[1]=l):l=n[1];const o=l;let r;n[2]!==e?.availableThemes?(r=()=>e?.availableThemes??[a,o],n[2]=e?.availableThemes,n[3]=r):r=n[3],e?.availableThemes;let s;n[4]!==r?(s=r(),n[4]=r,n[5]=s):s=n[5];const c=s,d=e?.lightThemeId??a.metadata.id,f=e?.darkThemeId??o.metadata.id;let g;n[6]!==c||n[7]!==d?(g=c.find(N=>N.metadata.id===d)??a,n[6]=c,n[7]=d,n[8]=g):g=n[8];const E=g;let R;n[9]!==c||n[10]!==f?(R=c.find(N=>N.metadata.id===f)??o,n[9]=c,n[10]=f,n[11]=R):R=n[11];const b=R;let w,y;n[12]!==b||n[13]!==E?(w=()=>{Ce(E),Ce(b)},y=[b,E],n[12]=b,n[13]=E,n[14]=w,n[15]=y):(w=n[14],y=n[15]),v.useEffect(w,y);const P=e?.currentTheme.metadata.variant??"light";let x;n[16]!==b.metadata.id||n[17]!==E.metadata.id?(x={light:E.metadata.id,dark:b.metadata.id},n[16]=b.metadata.id,n[17]=E.metadata.id,n[18]=x):x=n[18];const _=P==="dark"?"dark":"light";let k;return n[19]!==x||n[20]!==_?(k={theme:x,themeType:_},n[19]=x,n[20]=_,n[21]=k):k=n[21],k},ze=()=>({width:typeof window<"u"?window.innerWidth:0,height:typeof window<"u"?window.innerHeight:0}),$e={mobile:{widthRatio:.94,heightRatio:.86,padding:10},desktop:{widthRatio:.8,heightRatio:.8,padding:16}},Rt=(n,e)=>{const t=e?$e.mobile:$e.desktop,a=Math.max(160,n.width-t.padding*2),l=Math.max(160,n.height-t.padding*2);return{maxWidth:Math.max(160,Math.min(a,n.width*t.widthRatio)),maxHeight:Math.max(160,Math.min(l,n.height*t.heightRatio))}},Pt=n=>{try{const o=Array.from(n.querySelectorAll("g"));let r=0,s=null;for(const c of o){if(!(c instanceof SVGGraphicsElement))continue;const d=c.getBBox();if(!(d.width>0&&d.height>0))continue;const f=d.width*d.height;f>r&&(r=f,s=d.width/d.height)}if(s&&Number.isFinite(s)&&s>0)return s}catch{}const e=n.getAttribute("viewBox");if(e){const o=e.trim().split(/\s+/).map(Number);if(o.length===4){const r=o[2],s=o[3];if(Number.isFinite(r)&&Number.isFinite(s)&&r>0&&s>0)return r/s}}const t=Number(n.getAttribute("width")),a=Number(n.getAttribute("height"));if(Number.isFinite(t)&&Number.isFinite(a)&&t>0&&a>0)return t/a;const l=n.getBoundingClientRect();return l.width>0&&l.height>0?l.width/l.height:null},Be=n=>{const e=he.c(7),[t,a]=v.useState(n),[l,o]=v.useState(n),[r,s]=v.useState(!1);let c,d;e[0]!==n?(c=()=>{if(n){if(a(!0),s(!0),typeof window>"u"){o(!0);return}const E=window.requestAnimationFrame(()=>{o(!0)}),R=window.setTimeout(()=>{s(!1)},Oe);return()=>{window.cancelAnimationFrame(E),window.clearTimeout(R)}}if(o(!1),s(!0),typeof window>"u"){a(!1);return}const g=window.setTimeout(()=>{a(!1),s(!1)},Oe);return()=>{window.clearTimeout(g)}},d=[n],e[0]=n,e[1]=c,e[2]=d):(c=e[1],d=e[2]),v.useEffect(c,d);let f;return e[3]!==t||e[4]!==r||e[5]!==l?(f={isRendered:t,isVisible:l,isTransitioning:r},e[3]=t,e[4]=r,e[5]=l,e[6]=f):f=e[6],f},qe=n=>{const e=he.c(3),[t,a]=v.useState(ze);let l,o;return e[0]!==n?(l=()=>{if(!n||typeof window>"u")return;const r=()=>{a(ze())};return r(),window.addEventListener("resize",r),()=>{window.removeEventListener("resize",r)}},o=[n],e[0]=n,e[1]=l,e[2]=o):(l=e[1],o=e[2]),v.useEffect(l,o),t},Lt=n=>{const e=he.c(103),{popup:t,onOpenChange:a,isMobile:l}=n,{t:o}=Me();let r;e:{const u=t.image;if(!u){let I;e[0]===Symbol.for("react.memo_cache_sentinel")?(I=[],e[0]=I):I=e[0],r=I;break e}let h;e[1]!==u.gallery?(h=Array.isArray(u.gallery)?u.gallery.filter(Dt):[],e[1]=u.gallery,e[2]=h):h=e[2];const M=h;if(M.length>0){r=M;break e}let C;e[3]!==u.filename||e[4]!==u.mimeType||e[5]!==u.size||e[6]!==u.url?(C=[{url:u.url,mimeType:u.mimeType,filename:u.filename,size:u.size}],e[3]=u.filename,e[4]=u.mimeType,e[5]=u.size,e[6]=u.url,e[7]=C):C=e[7],r=C}const s=r,[c,d]=v.useState(0),[f,g]=v.useState(null),{isRendered:E,isVisible:R,isTransitioning:b}=Be(t.open),w=qe(t.open);let y;e[8]!==s||e[9]!==t.image||e[10]!==t.open?(y=()=>{if(!t.open||s.length===0)return;const u=typeof t.image?.index=="number"?t.image.index:-1;if(u>=0&&u<s.length){d(u);return}const h=t.image?.url?s.findIndex(M=>M.url===t.image?.url):-1;d(h>=0?h:0)},e[8]=s,e[9]=t.image,e[10]=t.open,e[11]=y):y=e[11];const P=t.image?.index,x=t.image?.url;let _;e[12]!==s||e[13]!==t.open||e[14]!==P||e[15]!==x?(_=[s,P,x,t.open],e[12]=s,e[13]=t.open,e[14]=P,e[15]=x,e[16]=_):_=e[16],v.useEffect(y,_);const k=s[c]??s[0]??t.image,N=k?.filename||t.title||"Image preview",p=s.length>1;let T;e[17]!==s.length?(T=()=>{s.length<=1||d(u=>(u-1+s.length)%s.length)},e[17]=s.length,e[18]=T):T=e[18];const S=T;let z;e[19]!==s.length?(z=()=>{s.length<=1||d(u=>(u+1)%s.length)},e[19]=s.length,e[20]=z):z=e[20];const m=z;let $,L;e[21]!==p||e[22]!==a||e[23]!==t.open||e[24]!==m||e[25]!==S?($=()=>{if(!t.open)return;const u=h=>{if(h.key==="Escape"){a(!1);return}if(h.key==="ArrowLeft"&&p){h.preventDefault(),S();return}h.key==="ArrowRight"&&p&&(h.preventDefault(),m())};return window.addEventListener("keydown",u),()=>{window.removeEventListener("keydown",u)}},L=[p,a,t.open,m,S],e[21]=p,e[22]=a,e[23]=t.open,e[24]=m,e[25]=S,e[26]=$,e[27]=L):($=e[26],L=e[27]),v.useEffect($,L);let X;e[28]===Symbol.for("react.memo_cache_sentinel")?(X=()=>{g(null)},e[28]=X):X=e[28];const K=k?.url;let ie;e[29]!==K?(ie=[K],e[29]=K,e[30]=ie):ie=e[30],v.useEffect(X,ie);let je;e:{const u=Math.max(160,w.width*(l?.86:.75)),h=Math.max(160,w.height*(l?.72:.75));if(!f){let ve;e[31]!==u?(ve=Math.round(u),e[31]=u,e[32]=ve):ve=e[32];let Ne;e[33]!==h?(Ne=Math.round(h),e[33]=h,e[34]=Ne):Ne=e[34];let ke;e[35]!==ve||e[36]!==Ne?(ke={width:ve,height:Ne},e[35]=ve,e[36]=Ne,e[37]=ke):ke=e[37],je=ke;break e}const M=u/f.width,C=h/f.height,I=Math.min(M,C);let A;e[38]!==f.width||e[39]!==I?(A=Math.round(f.width*I),e[38]=f.width,e[39]=I,e[40]=A):A=e[40];const Y=Math.max(1,A);let Se;e[41]!==f.height||e[42]!==I?(Se=Math.round(f.height*I),e[41]=f.height,e[42]=I,e[43]=Se):Se=e[43];const Pe=Math.max(1,Se);let _e;e[44]!==Y||e[45]!==Pe?(_e={width:Y,height:Pe},e[44]=Y,e[45]=Pe,e[46]=_e):_e=e[46],je=_e}const ge=je;if(!E||!k||typeof document>"u")return null;const se=t.open?"pointer-events-auto":"pointer-events-none";let oe;e[47]!==se?(oe=pe("fixed inset-0 z-50",se),e[47]=se,e[48]=oe):oe=e[48];const xe=b&&"transition-opacity duration-150 ease-out",re=R?"opacity-100":"opacity-0";let H;e[49]!==xe||e[50]!==re?(H=pe("absolute inset-0 bg-black/40",xe,re),e[49]=xe,e[50]=re,e[51]=H):H=e[51];let F;e[52]!==a?(F=()=>a(!1),e[52]=a,e[53]=F):F=e[53];let ae;e[54]!==H||e[55]!==F?(ae=i.jsx("div",{"aria-hidden":"true",className:H,onMouseDown:F}),e[54]=H,e[55]=F,e[56]=ae):ae=e[56];let V;e[57]!==p||e[58]!==m||e[59]!==S||e[60]!==o?(V=p&&i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",onMouseDown:Et,onClick:S,className:"absolute left-3 top-1/2 -translate-y-1/2 z-10 h-10 w-10 flex items-center justify-center rounded-full bg-black/40 text-foreground/90 hover:bg-black/55 focus:outline-none focus:ring-2 focus:ring-primary/60","aria-label":o("chat.toolOutputDialog.image.previousAria"),children:i.jsx(D,{name:"arrow-left-s",className:"h-6 w-6"})}),i.jsx("button",{type:"button",onMouseDown:Ct,onClick:m,className:"absolute right-3 top-1/2 -translate-y-1/2 z-10 h-10 w-10 flex items-center justify-center rounded-full bg-black/40 text-foreground/90 hover:bg-black/55 focus:outline-none focus:ring-2 focus:ring-primary/60","aria-label":o("chat.toolOutputDialog.image.nextAria"),children:i.jsx(D,{name:"arrow-right-s",className:"h-6 w-6"})})]}),e[57]=p,e[58]=m,e[59]=S,e[60]=o,e[61]=V):V=e[61];const we=l?"p-2.5":"p-4";let le;e[62]!==we?(le=pe("absolute inset-0 flex items-center justify-center pointer-events-none",we),e[62]=we,e[63]=le):le=e[63];const ce=b&&"transition-opacity duration-150 ease-out",be=R?"opacity-100":"opacity-0";let W;e[64]!==ce||e[65]!==be?(W=pe("pointer-events-auto flex flex-col gap-2",ce,be),e[64]=ce,e[65]=be,e[66]=W):W=e[66];const de=`${ge.width}px`;let U;e[67]!==de?(U={width:de},e[67]=de,e[68]=U):U=e[68];let Q;e[69]!==N?(Q=i.jsx("div",{className:"min-w-0 flex-1 text-foreground typography-ui-header font-semibold truncate",title:N,children:N}),e[69]=N,e[70]=Q):Q=e[70];let G;e[71]!==a?(G=()=>a(!1),e[71]=a,e[72]=G):G=e[72];let ue;e[73]!==o?(ue=o("chat.toolOutputDialog.image.closeAria"),e[73]=o,e[74]=ue):ue=e[74];let ee;e[75]===Symbol.for("react.memo_cache_sentinel")?(ee=i.jsx(D,{name:"close",className:"h-4 w-4"}),e[75]=ee):ee=e[75];let B;e[76]!==G||e[77]!==ue?(B=i.jsx("button",{type:"button",className:"h-8 w-8 flex items-center justify-center rounded-lg text-muted-foreground/80 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-primary/60",onClick:G,"aria-label":ue,children:ee}),e[76]=G,e[77]=ue,e[78]=B):B=e[78];let q;e[79]!==Q||e[80]!==B?(q=i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[Q,B]}),e[79]=Q,e[80]=B,e[81]=q):q=e[81];const fe=`${ge.width}px`,me=`${ge.height}px`;let Z;e[82]!==fe||e[83]!==me?(Z={width:fe,height:me},e[82]=fe,e[83]=me,e[84]=Z):Z=e[84];let te;e[85]===Symbol.for("react.memo_cache_sentinel")?(te=u=>{const h=u.currentTarget,M=h.naturalWidth,C=h.naturalHeight;M>0&&C>0&&g(I=>I&&I.width===M&&I.height===C?I:{width:M,height:C})},e[85]=te):te=e[85];let J;e[86]!==k.url||e[87]!==N||e[88]!==Z?(J=i.jsx("img",{src:k.url,alt:N,className:"block object-contain",style:Z,loading:"lazy",onLoad:te}),e[86]=k.url,e[87]=N,e[88]=Z,e[89]=J):J=e[89];let ne;e[90]!==W||e[91]!==U||e[92]!==q||e[93]!==J?(ne=i.jsxs("div",{className:W,style:U,children:[q,J]}),e[90]=W,e[91]=U,e[92]=q,e[93]=J,e[94]=ne):ne=e[94];let j;e[95]!==le||e[96]!==ne?(j=i.jsx("div",{className:le,children:ne}),e[95]=le,e[96]=ne,e[97]=j):j=e[97];let O;if(e[98]!==oe||e[99]!==ae||e[100]!==V||e[101]!==j){const u=i.jsxs("div",{className:oe,children:[ae,V,j]});O=Fe.createPortal(u,document.body),e[98]=oe,e[99]=ae,e[100]=V,e[101]=j,e[102]=O}else O=e[102];return O},Ze=v.memo(n=>{const e=he.c(7),{popup:t,diffViewMode:a,pierreThemeConfig:l}=n,o=t.content||"",r=a==="unified"?"unified":"split";let s;e[0]!==l.theme||e[1]!==l.themeType||e[2]!==r?(s={diffStyle:r,diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",disableFileHeader:!0,maxLineDiffLength:1e3,expansionLineCount:20,overflow:"wrap",theme:l.theme,themeType:l.themeType,unsafeCSS:_t},e[0]=l.theme,e[1]=l.themeType,e[2]=r,e[3]=s):s=e[3];let c;return e[4]!==o||e[5]!==s?(c=i.jsx("div",{className:"typography-code",children:i.jsx(Ye,{patch:o,metrics:kt,options:s,className:"block w-full"})}),e[4]=o,e[5]=s,e[6]=c):c=e[6],c});Ze.displayName="DialogUnifiedDiff";const Je=v.memo(n=>{const e=he.c(30),{popup:t,syntaxTheme:a,pierreThemeConfig:l}=n;let o;e[0]!==t.content?(o=at(t.content),e[0]=t.content,e[1]=o):o=e[1];const r=o,s=t.metadata?.input;let c;e[2]!==s?(c=typeof s=="object"&&s!==null?s:{},e[2]=s,e[3]=c):c=e[3];const d=c,f=typeof d.offset=="number"?d.offset:0,g=typeof d.file_path=="string"?d.file_path:typeof d.filePath=="string"?d.filePath:typeof d.path=="string"?d.path:"read-output";let E;e[4]!==r.lines?(E=r.lines.map(At).join(`
|
|
11
|
+
`),e[4]=r.lines,e[5]=E):E=e[5];const R=E;let b;e[6]!==g||e[7]!==t.language?(b=t.language||Ve(g)||"text",e[6]=g,e[7]=t.language,e[8]=b):b=e[8];const w=b;let y;e[9]!==r.lines?(y=r.lines.some(Ot),e[9]=r.lines,e[10]=y):y=e[10];const P=y;let x;if(e[11]!==P||e[12]!==f||e[13]!==r.lines||e[14]!==r.type){x=[];let N=f;for(const p of r.lines){p.lineNumber!==null&&(N=p.lineNumber);const T=r.type==="file"&&!P&&p.lineNumber===null&&!p.isInfo,S=p.lineNumber??(T?N+1:null);typeof S=="number"&&(N=S),x.push({text:p.text,lineNumber:S,isInfo:p.isInfo})}e[11]=P,e[12]=f,e[13]=r.lines,e[14]=r.type,e[15]=x}else x=e[15];const _=x;if(r.type==="file"){const N=w||void 0;let p;e[16]!==R||e[17]!==g||e[18]!==N?(p={name:g,contents:R,lang:N},e[16]=R,e[17]=g,e[18]=N,e[19]=p):p=e[19];let T;e[20]!==l.theme||e[21]!==l.themeType?(T={disableFileHeader:!0,overflow:"wrap",theme:l.theme,themeType:l.themeType},e[20]=l.theme,e[21]=l.themeType,e[22]=T):T=e[22];let S;return e[23]!==p||e[24]!==T?(S=i.jsx(He,{file:p,options:T,className:"block w-full"}),e[23]=p,e[24]=T,e[25]=S):S=e[25],S}let k;return e[26]!==_||e[27]!==w||e[28]!==a?(k=i.jsx(Ue,{lines:_,language:w,syntaxTheme:a,maxHeight:"70vh"}),e[26]=_,e[27]=w,e[28]=a,e[29]=k):k=e[29],k});Je.displayName="DialogReadContent";const Mt=n=>{const e=he.c(89),{popup:t,onOpenChange:a,isMobile:l}=n,{t:o}=Me(),[r,s]=v.useState(t.mermaid?.source||""),[c,d]=v.useState(t.mermaid?.source?"ready":"idle"),[f,g]=v.useState(""),{isRendered:E,isVisible:R,isTransitioning:b}=Be(t.open),[w,y]=v.useState(null),P=qe(t.open),x=v.useRef(0),_=v.useRef(null),k=Ft,N=Vt;let p;e[0]!==t.mermaid||e[1]!==o?(p=async()=>{const j=t.mermaid;if(!j?.url){d("error"),g(o("chat.toolOutputDialog.mermaid.missingSource"));return}if(j.source){s(j.source),d("ready"),g("");return}const O=x.current+1;x.current=O,d("loading"),g("");let u;if(j.url.startsWith("data:"))u=Promise.resolve(N(j.url));else if(j.url.toLowerCase().startsWith("file://")){const h=k(j.url);h?u=fetch(`/api/fs/raw?path=${encodeURIComponent(h)}`).then(Wt):u=Promise.reject(new Error("Invalid local file path for Mermaid preview."))}else{const M=(typeof URL.canParse=="function"?URL.canParse(j.url,window.location.origin):!1)?new URL(j.url,window.location.origin):null;!M||M.protocol!=="http:"&&M.protocol!=="https:"?u=Promise.reject(new Error("Unsupported Mermaid URL protocol.")):u=fetch(M.toString()).then(Ut)}await u.then(h=>{x.current===O&&(s(h),d("ready"))}).catch(h=>{x.current===O&&(d("error"),g(h instanceof Error?h.message:o("chat.toolOutputDialog.mermaid.loadFailed")))})},e[0]=t.mermaid,e[1]=o,e[2]=p):p=e[2];const T=p;let S,z;e[3]!==T||e[4]!==t.mermaid||e[5]!==t.open?(S=()=>{!t.open||!t.mermaid||T()},z=[T,t.mermaid,t.open],e[3]=T,e[4]=t.mermaid,e[5]=t.open,e[6]=S,e[7]=z):(S=e[6],z=e[7]),v.useEffect(S,z);let m,$;e[8]!==a||e[9]!==t.open?(m=()=>{if(!t.open)return;const j=O=>{O.key==="Escape"&&a(!1)};return window.addEventListener("keydown",j),()=>{window.removeEventListener("keydown",j)}},$=[a,t.open],e[8]=a,e[9]=t.open,e[10]=m,e[11]=$):(m=e[10],$=e[11]),v.useEffect(m,$);let L;e[12]!==t.open||e[13]!==c?(L=()=>{if(!t.open||c!=="ready"){y(null);return}const j=()=>{const I=_.current?.querySelector("svg");if(!I)return!1;const A=Pt(I);return!A||!Number.isFinite(A)||A<=0?!1:(y(Y=>Y&&Math.abs(Y-A)<.001?Y:A),!0)};let O=window.requestAnimationFrame(()=>{j()||(O=window.requestAnimationFrame(()=>{j()}))}),u=0,h;const M=()=>{u>=Tt||(h=window.setTimeout(()=>{u=u+1,j()||M()},Nt))};M();const C=new MutationObserver(()=>{j()});return _.current&&C.observe(_.current,{childList:!0,subtree:!0,attributes:!0}),()=>{window.cancelAnimationFrame(O),typeof h=="number"&&window.clearTimeout(h),C.disconnect()}},e[12]=t.open,e[13]=c,e[14]=L):L=e[14];let X;e[15]!==t.open||e[16]!==r||e[17]!==c?(X=[t.open,r,c],e[15]=t.open,e[16]=r,e[17]=c,e[18]=X):X=e[18],v.useEffect(L,X);const K=`\`\`\`mermaid
|
|
12
12
|
${r}
|
|
13
|
-
\`\`\``;let ie;if(e[19]!==w||e[20]!==l||e[21]!==P){e:{const{maxWidth:j,maxHeight:O}=
|
|
13
|
+
\`\`\``;let ie;if(e[19]!==w||e[20]!==l||e[21]!==P){e:{const{maxWidth:j,maxHeight:O}=Rt(P,l),u=Math.max(160,O-vt);if(w&&w<1){const C=Math.min(j,u);let I;e[23]!==C?(I=Math.round(C),e[23]=C,e[24]=I):I=e[24];let A;e[25]!==C?(A=Math.round(C),e[25]=C,e[26]=A):A=e[26];let Y;e[27]!==A||e[28]!==I?(Y={width:I,height:A},e[27]=A,e[28]=I,e[29]=Y):Y=e[29],ie=Y;break e}const h=Math.round(j);let M;e[30]!==u?(M=Math.round(u),e[30]=u,e[31]=M):M=e[31],ie={width:h,height:M}}e[19]=w,e[20]=l,e[21]=P,e[22]=ie}else ie=e[22];const je=ie;if(!E||typeof document>"u")return null;const ge=t.open?"pointer-events-auto":"pointer-events-none";let se;e[32]!==ge?(se=pe("fixed inset-0 z-50",ge),e[32]=ge,e[33]=se):se=e[33];const oe=b&&"transition-opacity duration-150 ease-out",xe=R?"opacity-100":"opacity-0";let re;e[34]!==oe||e[35]!==xe?(re=pe("absolute inset-0 bg-black/40",oe,xe),e[34]=oe,e[35]=xe,e[36]=re):re=e[36];let H;e[37]!==a?(H=()=>a(!1),e[37]=a,e[38]=H):H=e[38];let F;e[39]!==re||e[40]!==H?(F=i.jsx("div",{"aria-hidden":"true",className:re,onMouseDown:H}),e[39]=re,e[40]=H,e[41]=F):F=e[41];const ae=l?"p-2.5":"p-4";let V;e[42]!==ae?(V=pe("absolute inset-0 flex items-center justify-center pointer-events-none",ae),e[42]=ae,e[43]=V):V=e[43];const we=b&&"transition-opacity duration-150 ease-out",le=R?"opacity-100":"opacity-0";let ce;e[44]!==we||e[45]!==le?(ce=pe("pointer-events-auto flex flex-col gap-2",we,le),e[44]=we,e[45]=le,e[46]=ce):ce=e[46];const be=`${je.width}px`;let W;e[47]!==be?(W={width:be},e[47]=be,e[48]=W):W=e[48];let de;e[49]!==a?(de=()=>a(!1),e[49]=a,e[50]=de):de=e[50];let U;e[51]!==o?(U=o("chat.toolOutputDialog.mermaid.closeAria"),e[51]=o,e[52]=U):U=e[52];let Q;e[53]===Symbol.for("react.memo_cache_sentinel")?(Q=i.jsx(D,{name:"close",className:"h-4 w-4"}),e[53]=Q):Q=e[53];let G;e[54]!==de||e[55]!==U?(G=i.jsx("div",{className:"flex items-center justify-end",children:i.jsx("button",{type:"button",className:"h-8 w-8 flex items-center justify-center rounded-lg text-muted-foreground/80 hover:text-foreground focus:outline-none focus:ring-2 focus:ring-primary/60",onClick:de,"aria-label":U,children:Q})}),e[54]=de,e[55]=U,e[56]=G):G=e[56];const ue=`${je.height}px`;let ee;e[57]!==ue?(ee={height:ue},e[57]=ue,e[58]=ee):ee=e[58];let B;e[59]!==c||e[60]!==o?(B=c==="loading"&&i.jsxs("div",{className:"h-full min-h-28 flex items-center justify-center gap-2 text-muted-foreground typography-meta",children:[i.jsx(D,{name:"loader-4",className:"h-4 w-4 animate-spin"}),i.jsx("span",{children:o("chat.toolOutputDialog.mermaid.loading")})]}),e[59]=c,e[60]=o,e[61]=B):B=e[61];let q;e[62]!==f||e[63]!==T||e[64]!==c||e[65]!==o?(q=c==="error"&&i.jsxs("div",{className:"rounded-xl border border-border/30 bg-muted/20 p-3 space-y-3",children:[i.jsx("p",{className:"typography-markdown",style:{color:"var(--status-error)"},children:f||o("chat.toolOutputDialog.mermaid.renderFailed")}),i.jsx("button",{type:"button",onClick:()=>{T()},className:"px-3 py-1.5 rounded-lg typography-meta border transition-colors hover:bg-[var(--interactive-hover)]",style:{borderColor:"var(--interactive-border)",color:"var(--surface-foreground)"},children:o("chat.toolOutputDialog.mermaid.retry")})]}),e[62]=f,e[63]=T,e[64]=c,e[65]=o,e[66]=q):q=e[66];let fe;e[67]!==K||e[68]!==c?(fe=c==="ready"&&i.jsx("div",{ref:_,className:"h-full",children:i.jsx(We,{content:K,variant:"tool",allowMermaidWheelZoom:!0,className:"markdown-mermaid-fullscreen h-full [&_[data-markdown='mermaid-block']_button]:hidden",mermaidControls:St})}),e[67]=K,e[68]=c,e[69]=fe):fe=e[69];let me;e[70]!==B||e[71]!==q||e[72]!==fe?(me=i.jsxs("div",{className:"h-full overflow-hidden",children:[B,q,fe]}),e[70]=B,e[71]=q,e[72]=fe,e[73]=me):me=e[73];let Z;e[74]!==ee||e[75]!==me?(Z=i.jsx("div",{className:"relative overflow-hidden",style:ee,children:me}),e[74]=ee,e[75]=me,e[76]=Z):Z=e[76];let te;e[77]!==ce||e[78]!==W||e[79]!==G||e[80]!==Z?(te=i.jsxs("div",{className:ce,style:W,onMouseDown:Gt,children:[G,Z]}),e[77]=ce,e[78]=W,e[79]=G,e[80]=Z,e[81]=te):te=e[81];let J;e[82]!==V||e[83]!==te?(J=i.jsx("div",{className:V,children:te}),e[82]=V,e[83]=te,e[84]=J):J=e[84];let ne;if(e[85]!==se||e[86]!==F||e[87]!==J){const j=i.jsxs("div",{className:se,children:[F,J]});ne=Fe.createPortal(j,document.body),e[85]=se,e[86]=F,e[87]=J,e[88]=ne}else ne=e[88];return ne},Kt=n=>{const e=he.c(50),{popup:t,onOpenChange:a,syntaxTheme:l,isMobile:o}=n,{t:r}=Me(),[s,c]=v.useState("unified"),d=It();let f;e[0]!==t.open?(f=()=>{t.open&&c("unified")},e[0]=t.open,e[1]=f):f=e[1];let g;if(e[2]!==t.open||e[3]!==t.title?(g=[t.open,t.title],e[2]=t.open,e[3]=t.title,e[4]=g):g=e[4],v.useEffect(f,g),t.image){let m;return e[5]!==o||e[6]!==a||e[7]!==t?(m=i.jsx(Lt,{popup:t,onOpenChange:a,isMobile:o}),e[5]=o,e[6]=a,e[7]=t,e[8]=m):m=e[8],m}if(t.mermaid){let m;return e[9]!==o||e[10]!==a||e[11]!==t?(m=i.jsx(Mt,{popup:t,onOpenChange:a,isMobile:o}),e[9]=o,e[10]=a,e[11]=t,e[12]=m):m=e[12],m}const E=t.open,R=o?"w-[95vw] max-w-[95vw]":"max-w-5xl",b=o?"[&>button]:right-1":"[&>button]:top-2.5 [&>button]:right-4";let w;e[13]!==R||e[14]!==b?(w=pe("overflow-hidden flex flex-col min-h-0 pt-3 pb-4 px-4 gap-1","[&>button]:top-1.5",R,b),e[13]=R,e[14]=b,e[15]=w):w=e[15];let y;e[16]===Symbol.for("react.memo_cache_sentinel")?(y={maxHeight:"90vh"},e[16]=y):y=e[16];let P;e[17]!==t.metadata?(P=t.metadata?.tool?jt(t.metadata.tool):i.jsx(D,{name:"tools",className:"h-3.5 w-3.5 text-foreground flex-shrink-0"}),e[17]=t.metadata,e[18]=P):P=e[18];let x;e[19]!==t.title?(x=i.jsx("span",{className:"break-words flex-1 leading-tight",children:t.title}),e[19]=t.title,e[20]=x):x=e[20];let _;e[21]!==s||e[22]!==t.isDiff?(_=t.isDiff&&i.jsx(Xe,{mode:s,onModeChange:c,className:"mr-8 flex-shrink-0"}),e[21]=s,e[22]=t.isDiff,e[23]=_):_=e[23];let k;e[24]!==_||e[25]!==P||e[26]!==x?(k=i.jsx("div",{className:"flex-shrink-0 pb-1",children:i.jsxs("div",{className:"flex items-start gap-2 text-foreground typography-ui-header font-semibold",children:[P,x,_]})}),e[24]=_,e[25]=P,e[26]=x,e[27]=k):k=e[27];let N;e[28]!==d||e[29]!==t.metadata||e[30]!==l?(N=t.metadata?.input&&typeof t.metadata.input=="object"&&Object.keys(t.metadata.input).length>0&&t.metadata?.tool!=="todowrite"&&t.metadata?.tool!=="todoread"&&t.metadata?.tool!=="apply_patch"?(()=>{const m=t.metadata,$=m.input,L=X=>{const K=$[X];return typeof K=="string"?K:typeof K=="number"?String(K):null};return i.jsxs("div",{className:"border-b border-border/20 p-4 -mx-3",children:[i.jsx("div",{className:"typography-markdown font-medium text-muted-foreground mb-2 px-3",children:m.tool==="bash"?"Command:":m.tool==="task"?"Task Details:":"Input:"}),m.tool==="bash"&&L("command")?i.jsx("div",{className:"tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3",children:i.jsx(Ie,{style:l,language:"bash",PreTag:"div",customStyle:Te.getPopupStyles(),codeTagProps:Re,wrapLongLines:!0,children:L("command")})}):m.tool==="task"&&L("prompt")?i.jsxs("div",{className:"tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3",style:Te.getPopupStyles(),children:[L("description")?`Task: ${L("description")}
|
|
14
14
|
`:"",L("subagent_type")?`Agent Type: ${L("subagent_type")}
|
|
15
15
|
`:"",`Instructions:
|
|
16
|
-
${L("prompt")}`]}):m.tool==="write"&&L("content")?i.jsx("div",{className:"tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3",children:i.jsx(He,{file:{name:L("filePath")||L("file_path")||"new-file",contents:L("content"),lang:Ve(L("filePath")||L("file_path")||"")||void 0},options:{disableFileHeader:!0,overflow:"wrap",theme:d.theme,themeType:d.themeType},className:"block w-full"})}):i.jsx("div",{className:"tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3",style:Te.getPopupStyles(),children:Qe($,m.tool)})]})})():null,e[28]=d,e[29]=t.metadata,e[30]=l,e[31]=N):N=e[31];let p;e[32]!==s||e[33]!==o||e[34]!==d||e[35]!==t||e[36]!==l||e[37]!==r?(p=t.isDiff?i.jsx(Ze,{popup:t,diffViewMode:s,pierreThemeConfig:d}):t.content?i.jsx("div",{className:"p-4",children:(()=>{const m=t.metadata?.tool;return m==="todowrite"||m==="todoread"?et(t.content,{total:r("chat.todo.total"),inProgress:r("chat.todo.inProgress"),pending:r("chat.todo.pending"),completed:r("chat.todo.completed"),cancelled:r("chat.todo.cancelled")})||i.jsx(
|
|
16
|
+
${L("prompt")}`]}):m.tool==="write"&&L("content")?i.jsx("div",{className:"tool-input-surface bg-transparent rounded-xl border border-border/20 mx-3",children:i.jsx(He,{file:{name:L("filePath")||L("file_path")||"new-file",contents:L("content"),lang:Ve(L("filePath")||L("file_path")||"")||void 0},options:{disableFileHeader:!0,overflow:"wrap",theme:d.theme,themeType:d.themeType},className:"block w-full"})}):i.jsx("div",{className:"tool-input-surface bg-transparent rounded-xl border border-border/20 font-mono whitespace-pre-wrap text-foreground/90 mx-3",style:Te.getPopupStyles(),children:Qe($,m.tool)})]})})():null,e[28]=d,e[29]=t.metadata,e[30]=l,e[31]=N):N=e[31];let p;e[32]!==s||e[33]!==o||e[34]!==d||e[35]!==t||e[36]!==l||e[37]!==r?(p=t.isDiff?i.jsx(Ze,{popup:t,diffViewMode:s,pierreThemeConfig:d}):t.content?i.jsx("div",{className:"p-4",children:(()=>{const m=t.metadata?.tool;return m==="todowrite"||m==="todoread"?et(t.content,{total:r("chat.todo.total"),inProgress:r("chat.todo.inProgress"),pending:r("chat.todo.pending"),completed:r("chat.todo.completed"),cancelled:r("chat.todo.cancelled")})||i.jsx(Ie,{style:l,language:"json",PreTag:"div",wrapLongLines:!0,customStyle:Te.getPopupContainerStyles(),codeTagProps:Re,children:t.content}):m==="list"?tt(t.content)||i.jsx("pre",{className:"typography-markdown bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap",children:t.content}):m==="grep"?nt(t.content,o)||i.jsx("pre",{className:"typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap",children:t.content}):m==="glob"?it(t.content,o)||i.jsx("pre",{className:"typography-code bg-muted/30 p-2 rounded-xl border border-border/20 font-mono whitespace-pre-wrap",children:t.content}):m==="task"||m==="reasoning"?i.jsx("div",{className:m==="reasoning"?"text-muted-foreground/70":"",children:i.jsx(We,{content:t.content,variant:"tool"})}):m==="web-search"||m==="websearch"||m==="search_web"?st(t.content)||i.jsx(Ie,{style:l,language:"text",PreTag:"div",wrapLongLines:!0,customStyle:Te.getPopupContainerStyles(),codeTagProps:Re,children:t.content}):m==="read"?i.jsx(Je,{popup:t,syntaxTheme:l,pierreThemeConfig:d}):(t.content?ot(t.content):{isJson:!1}).isJson?i.jsx(dt,{jsonString:t.content,initiallyExpandedDepth:3,maxHeight:"70vh"}):i.jsx(Ie,{style:l,language:t.language||"text",PreTag:"div",wrapLongLines:!0,customStyle:Te.getPopupContainerStyles(),codeTagProps:Re,children:t.content})})()}):i.jsxs("div",{className:"p-8 text-muted-foreground typography-ui-header",children:[i.jsx("div",{className:"mb-2",children:r("chat.toolOutputDialog.commandCompleted")}),i.jsx("div",{className:"typography-meta",children:r("chat.toolOutputDialog.noOutputProduced")})]}),e[32]=s,e[33]=o,e[34]=d,e[35]=t,e[36]=l,e[37]=r,e[38]=p):p=e[38];let T;e[39]!==N||e[40]!==p?(T=i.jsx("div",{className:"flex-1 min-h-0 rounded-xl border border-border/30 bg-muted/10 overflow-hidden",children:i.jsxs("div",{className:"tool-output-surface h-full max-h-[75vh] overflow-y-auto px-3 pr-4",children:[N,p]})}),e[39]=N,e[40]=p,e[41]=T):T=e[41];let S;e[42]!==k||e[43]!==T||e[44]!==w?(S=i.jsxs(lt,{className:w,style:y,children:[k,T]}),e[42]=k,e[43]=T,e[44]=w,e[45]=S):S=e[45];let z;return e[46]!==a||e[47]!==t.open||e[48]!==S?(z=i.jsx(ct,{open:E,onOpenChange:a,children:S}),e[46]=a,e[47]=t.open,e[48]=S,e[49]=z):z=e[49],z};function Dt(n){return!!n?.url}function Et(n){return n.stopPropagation()}function Ct(n){return n.stopPropagation()}function At(n){return n.text}function Ot(n){return n.lineNumber!==null}function zt(n){if(!n||/[\0\r\n]/.test(n))return!1;const e=n.replace(/\\/g,"/");return e.split("/").filter(Boolean).includes("..")?!1:e.startsWith("/")?!0:/^[A-Za-z]:\//.test(e)}function $t(n,e){const t=Number.parseInt(e,16);return Number.isFinite(t)?String.fromCharCode(t):`%${e}`}function Ht(n){return n.replace(/%([0-9A-Fa-f]{2})/g,$t)}function Ft(n){const e=n.trim();if(!e.toLowerCase().startsWith("file://"))return null;const t=zt,a=Ht;if(typeof URL.canParse=="function"?URL.canParse(e):!1){let s=a(new URL(e).pathname||"");return/^\/[A-Za-z]:\//.test(s)&&(s=s.slice(1)),t(s)?s:null}const o=e.replace(/^file:\/\//i,""),r=a(o);return t(r)?r:t(o)?o:null}function Vt(n){const e=n.indexOf(",");if(e<0)throw new Error("Malformed data URL");const t=n.slice(0,e).toLowerCase(),a=n.slice(e+1);return t.includes(";base64")?atob(a):decodeURIComponent(a)}function Wt(n){return n.ok?n.text():Promise.reject(new Error(`Failed to read diagram file (${n.status})`))}function Ut(n){return n.ok?n.text():Promise.reject(new Error(`Failed to load diagram (${n.status})`))}function Gt(n){return n.stopPropagation()}export{Kt as default};
|