tarsk 0.6.88 → 0.6.89
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/README.md +63 -24
- package/dist/index.js +787 -738
- package/dist/node_modules/@libsql/darwin-x64/README.md +3 -0
- package/dist/node_modules/@libsql/{darwin-arm64 → darwin-x64}/index.node +0 -0
- package/dist/node_modules/@libsql/{darwin-arm64 → darwin-x64}/package.json +6 -6
- package/dist/public/assets/api-8Rp2LlXt.js +1 -0
- package/dist/public/assets/api-Cp9I7CxD.js +2 -0
- package/dist/public/assets/{async-error-boundary-FT8_xvjy.js → async-error-boundary-CFVUPiuG.js} +1 -1
- package/dist/public/assets/{browser-tab-DCjHytQ8.js → browser-tab-CPPorbL6.js} +2 -2
- package/dist/public/assets/{chat-dock-context-a2bV9cnz.js → chat-dock-context-DbiJNr3O.js} +1 -1
- package/dist/public/assets/chat-handlers-context-DYU2LQ5V.js +9 -0
- package/dist/public/assets/{commit-dialog-C1oUFznJ.js → commit-dialog-DPaci3dp.js} +1 -1
- package/dist/public/assets/{commit-error-dialog--NTHg7Aw.js → commit-error-dialog-Dnlkgb_H.js} +1 -1
- package/dist/public/assets/{conversation-history-view-CdfE7JTD.js → conversation-history-view-CqIugfyO.js} +1 -1
- package/dist/public/assets/{create-project-dialog-BdR6iQE9.js → create-project-dialog-DStWPoDE.js} +2 -2
- package/dist/public/assets/{create-project-workspace-DSTTGom_.js → create-project-workspace-CJ94yHAB.js} +2 -2
- package/dist/public/assets/{create-repo-dialog-gw-8Rpdm.js → create-repo-dialog-B_QiEz-v.js} +1 -1
- package/dist/public/assets/diff-view-4koPcOcE.js +4 -0
- package/dist/public/assets/{explorer-file-drop-CzyAqZgf.js → explorer-file-drop-DAP7ha-E.js} +1 -1
- package/dist/public/assets/explorer-tab-view-Bt9hRZUm.js +2 -0
- package/dist/public/assets/explorer-tree-CAs89lPz.js +1 -0
- package/dist/public/assets/{explorer-view-Daxl93oM.js → explorer-view-B1JuejkU.js} +2 -2
- package/dist/public/assets/index-CcAwxnT5.js +97 -0
- package/dist/public/assets/index-dNrgKdYv.css +1 -0
- package/dist/public/assets/{markdown-renderer-D2VcKU4g.js → markdown-renderer-DQONI6WG.js} +3 -3
- package/dist/public/assets/{mcp-manager-D1HmLT3t.js → mcp-manager-D2FG-h2e.js} +1 -1
- package/dist/public/assets/{model-list-controls-rXmaDp2r.js → model-list-controls-B6ofHWh3.js} +1 -1
- package/dist/public/assets/{onboarding-dialog-DSqBJyBa.js → onboarding-dialog-DAut3X4K.js} +1 -1
- package/dist/public/assets/{pill-tabs-DtdTmrg7.js → pill-tabs-BAhOHad7.js} +1 -1
- package/dist/public/assets/{project-coding-view-DP4qKePE.js → project-coding-view-B2FpHeiO.js} +1 -1
- package/dist/public/assets/{project-danger-zone-view-CGxIenpr.js → project-danger-zone-view-BqP1dcRT.js} +1 -1
- package/dist/public/assets/{project-env-vars-view-DKyQkh7h.js → project-env-vars-view-zhigkQFG.js} +1 -1
- package/dist/public/assets/{project-model-aliases-view-BewwJZAx.js → project-model-aliases-view-APAVFfym.js} +1 -1
- package/dist/public/assets/{project-settings-view-CE4nAz5B.js → project-settings-view-FnK-LRsv.js} +1 -1
- package/dist/public/assets/project-tools-view-Dmp5ViRC.js +1 -0
- package/dist/public/assets/providers-list-view-Clbp73Hh.js +1 -0
- package/dist/public/assets/{pull-request-dialog-nKYATjbm.js → pull-request-dialog-D40BQPMk.js} +1 -1
- package/dist/public/assets/{pull-with-changes-dialog-zzoFzCv4.js → pull-with-changes-dialog-pkXK-VP2.js} +1 -1
- package/dist/public/assets/query-keys-CcnonAAG.js +1 -0
- package/dist/public/assets/{remote-media-url-CyuN31H_.js → remote-media-url-C-GdJb-D.js} +1 -1
- package/dist/public/assets/{scroll-area-CGEZ1gAL.js → scroll-area-DGF9wUqQ.js} +1 -1
- package/dist/public/assets/{select-BR2pG61R.js → select-DMcNYwgt.js} +1 -1
- package/dist/public/assets/{settings-general-tabs-view-BWR0UX2P.js → settings-general-tabs-view-DBZQbihJ.js} +2 -2
- package/dist/public/assets/settings-general-view-0dhBET2R.js +1 -0
- package/dist/public/assets/{settings-list-Dgip9HpD.js → settings-list-Co3JPr9w.js} +1 -1
- package/dist/public/assets/{settings-logs-view-CS29x4VT.js → settings-logs-view-DvHXUDko.js} +2 -2
- package/dist/public/assets/settings-mcp-servers-view-414Dt5py.js +5 -0
- package/dist/public/assets/{settings-models-view-DS7nm54P.js → settings-models-view-ByeR7Enb.js} +1 -1
- package/dist/public/assets/{settings-plugins-view-avaUE36r.js → settings-plugins-view-8te2MPyh.js} +2 -2
- package/dist/public/assets/{settings-providers-view-B39k1iRQ.js → settings-providers-view-BAuv9gam.js} +2 -2
- package/dist/public/assets/{settings-remote-machines-view-BXondQG_.js → settings-remote-machines-view-CHyywazU.js} +1 -1
- package/dist/public/assets/{settings-setup-view-I5MGUi_D.js → settings-setup-view-Btp46Vh_.js} +2 -2
- package/dist/public/assets/{settings-skills-view-BKrUABbi.js → settings-skills-view-BNVx4bZl.js} +2 -2
- package/dist/public/assets/{settings-slack-view-B0p-96GC.js → settings-slack-view-Caly5yGt.js} +1 -1
- package/dist/public/assets/settings-slash-commands-view-m6mp1knu.js +1 -0
- package/dist/public/assets/{settings-statistics-view-B3g6BD7p.js → settings-statistics-view-BnOxr4sZ.js} +1 -1
- package/dist/public/assets/settings-storage-view-Dg8xfpTG.js +1 -0
- package/dist/public/assets/{settings-subagents-view-BziLwvNq.js → settings-subagents-view-CucwEk2A.js} +1 -1
- package/dist/public/assets/{settings-system-prompt-view-BqAk56cD.js → settings-system-prompt-view-CEDU2saT.js} +1 -1
- package/dist/public/assets/{settings-tab-bar-DYzU_lmi.js → settings-tab-bar-CdIbQ0WI.js} +1 -1
- package/dist/public/assets/settings-view-XcJhRclT.js +2 -0
- package/dist/public/assets/task-utils-Cnq9Eszt.js +1 -0
- package/dist/public/assets/tasks-view-B8_jkq_a.js +1 -0
- package/dist/public/assets/{terminal-panel-Bm_ZelN-.js → terminal-panel-xoLVfA-h.js} +1 -1
- package/dist/public/assets/{use-account-settings-query-C-zOdREq.js → use-account-settings-query-D_qL1I4w.js} +1 -1
- package/dist/public/assets/{use-active-dock-panel-instance-4Ss8lB9K.js → use-active-dock-panel-instance-kmJOnmL7.js} +1 -1
- package/dist/public/assets/use-git-check-BD9gdXpK.js +1 -0
- package/dist/public/assets/{use-installed-ai-files-DQey9Zm3.js → use-installed-ai-files-Nn-sN_V2.js} +1 -1
- package/dist/public/assets/{use-open-chat-dock-panel-DqfWJ8e8.js → use-open-chat-dock-panel-CXzpgxVs.js} +1 -1
- package/dist/public/assets/use-projects-B0xTjTaA.js +2 -0
- package/dist/public/assets/{web-CGP-jEpi.js → web-C1tBQoCB.js} +1 -1
- package/dist/public/assets/{web-CKC9gpFi.js → web-cJXG33sT.js} +1 -1
- package/dist/public/index.html +18 -18
- package/package.json +4 -4
- package/dist/node_modules/@libsql/darwin-arm64/README.md +0 -3
- package/dist/public/assets/account-view-DkuCOxkE.js +0 -1
- package/dist/public/assets/api-B_GSyYGh.js +0 -1
- package/dist/public/assets/api-C4ukGdyH.js +0 -2
- package/dist/public/assets/chat-handlers-context-2xSKzkKa.js +0 -9
- package/dist/public/assets/diff-view-B6JJNyn1.js +0 -4
- package/dist/public/assets/explorer-tab-view-CiUPh4uK.js +0 -2
- package/dist/public/assets/explorer-tree-BA12VLz_.js +0 -1
- package/dist/public/assets/index-CoY8DilQ.js +0 -97
- package/dist/public/assets/index-D14wLW4o.css +0 -1
- package/dist/public/assets/project-tools-view-CbDfst02.js +0 -1
- package/dist/public/assets/providers-list-view-BtwccvX2.js +0 -1
- package/dist/public/assets/query-keys-BwswkbMn.js +0 -1
- package/dist/public/assets/settings-general-view-BhtrDmJH.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-B5ithpfh.js +0 -5
- package/dist/public/assets/settings-slash-commands-view-DA1scWv1.js +0 -1
- package/dist/public/assets/settings-storage-view-BJvjhI4f.js +0 -1
- package/dist/public/assets/settings-view-zjMs7jNe.js +0 -2
- package/dist/public/assets/task-utils-BZPVmvY4.js +0 -1
- package/dist/public/assets/tasks-view-wFf77AQX.js +0 -1
- package/dist/public/assets/use-git-check-CumqGAvN.js +0 -1
- package/dist/public/assets/use-projects-CizIH2Fa.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-monaco-editor-ChJZBFy5.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/react-vendor-D61Uve5n.js","assets/dist-v_MvKS2-.js","assets/monaco-setup-B4buJsSY.js","assets/monaco-CWuJkPco.js","assets/monaco-BQve5vfS.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,r,t as i}from"./react-vendor-D61Uve5n.js";import{U as a,x as o}from"./dist-v_MvKS2-.js";import{r as s}from"./store-W78TGOIO.js";import{
|
|
2
|
+
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,r,t as i}from"./react-vendor-D61Uve5n.js";import{U as a,x as o}from"./dist-v_MvKS2-.js";import{r as s}from"./store-W78TGOIO.js";import{di as c,ut as l}from"./api-Cp9I7CxD.js";import{t as u}from"./markdown-renderer-DQONI6WG.js";import{a as d,i as f}from"./explorer-media-CRzhs0NW.js";import{t as p}from"./utils-CqsIXqSC.js";import{t as m}from"./check-skFQ1X72.js";import{t as h}from"./copy-bi9iX3xn.js";import{t as g}from"./loader-circle-CrqRIqdA.js";import{t as _}from"./plus-DoMzejDu.js";import{t as v}from"./button-DDaJhJP1.js";import{t as y}from"./use-toast-CKgZ8YeP.js";import{n as b}from"./explorer-tab-context-BwR8CM8l.js";import{t as x}from"./progress-indicator-hJ74ac5W.js";import{n as S}from"./suspense-resource-DzlMlIgR.js";import{t as C}from"./use-suspense-resource-uCX26gOk.js";import{a as w,c as T,d as E,i as D,l as O,s as k,t as A}from"./api-8Rp2LlXt.js";import{C as ee,Hn as j,Xt as M,dr as te,fr as N,in as ne,pr as P,qn as F,rn as I,tn as L,un as re}from"./index-CcAwxnT5.js";import{t as R}from"./async-error-boundary-CFVUPiuG.js";var z=e(n(),1),B=t(),ie=o(`explorer.preview`);async function V(e,t){try{let n=await k(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function H(e){return d(e)===`md`}function U(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[d(e)]??`plaintext`}function W(e,t){return`explorer-file:${e}:${t}`}function G(e,t,n){ie.error(e,{...t,error:n})}function K(e,t){return`explorer-media:${e}:${t}`}async function q(e,t){try{return await w(e,t)}catch(n){throw G(`Failed to load explorer file preview`,{threadId:e,path:t},n),n}}async function J(e,t){try{return await D(e,t)}catch(n){throw G(`Failed to load explorer media preview`,{threadId:e,path:t},n),n}}function Y(e,t){return t?`edit`:H(e.path)?`view`:`edit`}function ae(e,t,n,r){let i=t?f(t.path,t.name):null,a=t?.type===`file`&&e&&!i?t:null,o=a?`${e}:${a.path}:${r}`:null,s=n&&n.key===o?n:null;return{selectedMediaType:i,editableFile:a,fileSuspenseKey:o,currentContent:s,fileContent:s?.content??``,originalFileContent:s?.original??``}}function oe(){let e=document.querySelector(`[data-markdown-print-content]`);return e instanceof HTMLElement?e:null}function se(e,t){return`<!doctype html>
|
|
3
3
|
<html>
|
|
4
4
|
<head>
|
|
5
5
|
<meta charset="utf-8" />
|
|
@@ -73,4 +73,4 @@ import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{n as t,o as n,r,t as i
|
|
|
73
73
|
}, { once: true });
|
|
74
74
|
<\/script>
|
|
75
75
|
</body>
|
|
76
|
-
</html>`}function ce(e,t){let n=window.open(``,`_blank`,`noopener,noreferrer`);return n?(n.document.open(),n.document.write(se(e,t)),n.document.close(),!0):!1}function le(e){if(typeof window>`u`)return;let t=oe();if(!t){y({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}ce(e.name??`Markdown document`,t.innerHTML)||y({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`})}async function ue(e,t){let n=await O(e,t.path);y({title:`PDF created`,description:`Opened ${n.outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}async function de(e,t){try{if(!l()){le(t);return}await ue(e,t)}catch(n){G(`Failed to print markdown file as PDF`,{threadId:e,path:t.path},n),y({title:`PDF export failed`,description:n instanceof Error?n.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}}async function fe(e,t){try{let n=await V(e,t);return await A(e,``,n),y({title:`Created`,description:`${n} created successfully.`}),n}catch(n){return G(`Failed to create explorer file`,{threadId:e,extension:t},n),y({title:`Error`,description:`Failed to create file.`,variant:`destructive`}),null}}async function pe(e,t){try{await navigator.clipboard.writeText(t),y({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(n){G(`Failed to copy explorer folder path`,{threadId:e,folderPath:t},n),y({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}}async function me(e,t){try{await T(e,`.`)}catch(n){G(`Failed to open explorer repository folder`,{threadId:e,folderPath:t},n),y({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}}async function he(e){try{await E(e.threadId,e.file.path,e.content),e.onSaved({key:e.suspenseKey,content:e.content,original:e.content}),y({title:`Saved`,description:`${e.file.name} saved successfully.`})}catch(t){G(`Failed to save explorer file`,{threadId:e.threadId,path:e.file.path},t),y({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}}function ge(e){let t=(0,B.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=W(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=()=>q(n,r),t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=C(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,z.useLayoutEffect)(l,u),null}var X=i(),_e=(0,z.lazy)(function(){return r(()=>import(`./explorer-monaco-editor-ChJZBFy5.js`),__vite__mapDeps([0,1,2,3,4,5,6]))});function ve(e){let t=(0,B.c)(21),{threadId:n,file:r,suspenseKey:i,hasLoadedContent:a,fileContent:o,markdownMode:s,resolvedTheme:c,autoFocusEditor:l,onContentChange:d,onEditorReady:f,onRetry:p}=e,m=i??void 0,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(x,{centered:!0,label:`Loading file contents...`}),t[0]=h):h=t[0];let g=i??void 0,_=i??``,v;t[1]!==r.path||t[2]!==d||t[3]!==g||t[4]!==_||t[5]!==n?(v=(0,X.jsx)(z.Suspense,{fallback:h,children:(0,X.jsx)(ge,{threadId:n,path:r.path,contentKey:_,onContentReady:d},g)}),t[1]=r.path,t[2]=d,t[3]=g,t[4]=_,t[5]=n,t[6]=v):v=t[6];let y;t[7]!==l||t[8]!==r.path||t[9]!==o||t[10]!==a||t[11]!==s||t[12]!==d||t[13]!==f||t[14]!==c?(y=a?H(r.path)&&s===`view`?(0,X.jsx)(`div`,{className:`h-full overflow-auto p-6 print:h-auto print:overflow-visible print:p-0`,children:(0,X.jsx)(`div`,{className:`mx-auto max-w-4xl print:max-w-none`,"data-markdown-print-content":!0,children:(0,X.jsx)(u,{content:o,enableMermaid:!0})})}):(0,X.jsx)(z.Suspense,{fallback:(0,X.jsx)(x,{centered:!0,label:`Loading editor...`}),children:(0,X.jsx)(_e,{language:U(r.path),value:o,theme:c===`dark`?`vs-dark`:`vs-light`,autoFocus:l,onReady:f,onChange:e=>d(t=>t&&{...t,content:e??``})})}):(0,X.jsx)(x,{centered:!0,label:`Loading file contents...`}),t[7]=l,t[8]=r.path,t[9]=o,t[10]=a,t[11]=s,t[12]=d,t[13]=f,t[14]=c,t[15]=y):y=t[15];let b;return t[16]!==p||t[17]!==m||t[18]!==v||t[19]!==y?(b=(0,X.jsxs)(R,{fallbackTitle:`Failed to load file`,onRetry:p,children:[v,y]},m),t[16]=p,t[17]=m,t[18]=v,t[19]=y,t[20]=b):b=t[20],b}function Z(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,X.jsx)(`h2`,{className:p(a.pageTitle,`text-foreground`),children:`File Explorer`}),(0,X.jsx)(`p`,{className:p(a.pageSubtitle),children:`Browse and edit files`})]}),e[0]=t):t=e[0],t}function Q(e,t){let n=(0,B.c)(11),r;n[0]!==t||n[1]!==e?(r=K(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>J(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=C(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,z.useEffect)(c,l),s}function ye(e){let t=(0,B.c)(3),{threadId:n,path:r,alt:i}=e,a=Q(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,X.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,X.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function be(e){let t=(0,B.c)(2),{threadId:n,path:r}=e,i=Q(n,r),a;return t[0]===i?a=t[1]:(a=(0,X.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,X.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}function $(e){let t=(0,B.c)(18),{mediaType:n,threadId:r,file:i}=e,a=n===`image`?`Failed to load image`:`Failed to load video`,o;t[0]!==i.path||t[1]!==r?(o=()=>{S(K(r,i.path))},t[0]=i.path,t[1]=r,t[2]=o):o=t[2];let s=`Loading ${n} preview...`,c;t[3]===s?c=t[4]:(c=(0,X.jsx)(x,{centered:!0,label:s}),t[3]=s,t[4]=c);let l;t[5]!==i.name||t[6]!==i.path||t[7]!==n||t[8]!==r?(l=n===`image`?(0,X.jsx)(ye,{threadId:r,path:i.path,alt:i.name}):(0,X.jsx)(be,{threadId:r,path:i.path}),t[5]=i.name,t[6]=i.path,t[7]=n,t[8]=r,t[9]=l):l=t[9];let u;t[10]!==c||t[11]!==l?(u=(0,X.jsx)(z.Suspense,{fallback:c,children:l}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;return t[13]!==i.path||t[14]!==a||t[15]!==o||t[16]!==u?(d=(0,X.jsx)(R,{fallbackTitle:a,onRetry:o,children:u},i.path),t[13]=i.path,t[14]=a,t[15]=o,t[16]=u,t[17]=d):d=t[17],d}function xe(e){let t=(0,B.c)(19);if(e.editableFile){let n;return t[0]!==e.autoFocusEditor||t[1]!==e.editableFile||t[2]!==e.fileContent||t[3]!==e.fileSuspenseKey||t[4]!==e.hasLoadedContent||t[5]!==e.markdownMode||t[6]!==e.onContentChange||t[7]!==e.onEditorReady||t[8]!==e.onFileLoadRetry||t[9]!==e.resolvedTheme||t[10]!==e.threadId?(n=(0,X.jsx)(ve,{threadId:e.threadId,file:e.editableFile,suspenseKey:e.fileSuspenseKey,hasLoadedContent:e.hasLoadedContent,fileContent:e.fileContent,markdownMode:e.markdownMode,resolvedTheme:e.resolvedTheme,autoFocusEditor:e.autoFocusEditor,onContentChange:e.onContentChange,onEditorReady:e.onEditorReady,onRetry:e.onFileLoadRetry}),t[0]=e.autoFocusEditor,t[1]=e.editableFile,t[2]=e.fileContent,t[3]=e.fileSuspenseKey,t[4]=e.hasLoadedContent,t[5]=e.markdownMode,t[6]=e.onContentChange,t[7]=e.onEditorReady,t[8]=e.onFileLoadRetry,t[9]=e.resolvedTheme,t[10]=e.threadId,t[11]=n):n=t[11],n}if(e.selectedFile?.type===`file`&&e.selectedMediaType===`image`){let n;return t[12]!==e.selectedFile||t[13]!==e.threadId?(n=(0,X.jsx)($,{mediaType:`image`,threadId:e.threadId,file:e.selectedFile}),t[12]=e.selectedFile,t[13]=e.threadId,t[14]=n):n=t[14],n}if(e.selectedFile?.type===`file`&&e.selectedMediaType===`video`){let n;return t[15]!==e.selectedFile||t[16]!==e.threadId?(n=(0,X.jsx)($,{mediaType:`video`,threadId:e.threadId,file:e.selectedFile}),t[15]=e.selectedFile,t[16]=e.threadId,t[17]=n):n=t[17],n}let n;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(Z,{}),t[18]=n):n=t[18],n}function Se(e){let t=(0,B.c)(5),{folderPath:n,copying:r,onOpen:i,onCopy:o}=e,s;return t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==i?(s=(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:i,className:p(a.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:n,children:n}),(0,X.jsxs)(v,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:o,disabled:r,children:[r?(0,X.jsx)(m,{className:`h-3.5 w-3.5`}):(0,X.jsx)(h,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,X.jsx)(`p`,{className:p(a.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})}),t[0]=r,t[1]=n,t[2]=o,t[3]=i,t[4]=s):s=t[4],s}function Ce(e){let t=(0,B.c)(12),{path:n,markdownMode:r,onMarkdownModeChange:i,printing:a,onPrint:o}=e,s;t[0]!==r||t[1]!==o||t[2]!==n||t[3]!==a?(s=H(n)&&r===`view`?(0,X.jsxs)(v,{size:`sm`,variant:`outline`,onClick:o,disabled:a,children:[a?(0,X.jsx)(g,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(N,{className:`h-4 w-4`}),a?`Printing…`:`Print`]}):null,t[0]=r,t[1]=o,t[2]=n,t[3]=a,t[4]=s):s=t[4];let c;t[5]!==r||t[6]!==i||t[7]!==n?(c=H(n)?(0,X.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,X.jsx)(v,{size:`sm`,variant:r===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>i(`view`),children:`View`}),(0,X.jsx)(v,{size:`sm`,variant:r===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>i(`edit`),children:`Edit`})]}):null,t[5]=r,t[6]=i,t[7]=n,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l=(0,X.jsxs)(X.Fragment,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}var we=[{label:`Markdown`,ext:`md`,icon:F},{label:`TypeScript`,ext:`ts`,icon:P},{label:`Text`,ext:`txt`,icon:te}];function Te(e){let t=(0,B.c)(16),{selectedFile:n,editableFile:r,hasLoadedContent:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==e.canSave||t[3]!==e.markdownMode||t[4]!==e.onMarkdownModeChange||t[5]!==e.onPrint||t[6]!==e.onSave||t[7]!==e.printing||t[8]!==e.saving?(a=r&&i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ce,{path:r.path,markdownMode:e.markdownMode,onMarkdownModeChange:e.onMarkdownModeChange,printing:e.printing,onPrint:e.onPrint}),(0,X.jsxs)(v,{size:`sm`,onClick:e.onSave,disabled:e.saving||!e.canSave,children:[e.saving?(0,X.jsx)(g,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,t[0]=r,t[1]=i,t[2]=e.canSave,t[3]=e.markdownMode,t[4]=e.onMarkdownModeChange,t[5]=e.onPrint,t[6]=e.onSave,t[7]=e.printing,t[8]=e.saving,t[9]=a):a=t[9];let o;t[10]!==e||t[11]!==n?(o=n?null:(0,X.jsxs)(L,{children:[(0,X.jsx)(re,{asChild:!0,children:(0,X.jsxs)(v,{size:`sm`,className:`gap-1.5`,children:[(0,X.jsx)(_,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,X.jsx)(I,{align:`end`,children:we.map(t=>{let{label:n,ext:r,icon:i}=t;return(0,X.jsxs)(ne,{onSelect:()=>e.onNewFile(r),children:[(0,X.jsx)(i,{className:`h-4 w-4`}),n]},r)})})]}),t[10]=e,t[11]=n,t[12]=o):o=t[12];let s;return t[13]!==a||t[14]!==o?(s=(0,X.jsxs)(X.Fragment,{children:[a,o]}),t[13]=a,t[14]=o,t[15]=s):s=t[15],s}function Ee(e){let t=(0,B.c)(15),{selectedFile:n,showBackButton:r,onShowTree:i}=e,o;t[0]!==i||t[1]!==r?(o=r&&i?(0,X.jsxs)(v,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:i,children:[(0,X.jsx)(M,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,t[0]=i,t[1]=r,t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=p(a.label,`truncate leading-normal text-foreground`),t[3]=s):s=t[3];let c=n?n.name:`Select a file to edit`,l;t[4]===c?l=t[5]:(l=(0,X.jsx)(`span`,{className:s,children:c}),t[4]=c,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=p(a.compact,`truncate text-muted-foreground`),t[6]=u):u=t[6];let d=n?n.path:`Browse and edit repository files`,f;t[7]===d?f=t[8]:(f=(0,X.jsx)(`span`,{className:u,children:d}),t[7]=d,t[8]=f);let m;t[9]!==l||t[10]!==f?(m=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[l,f]}),t[9]=l,t[10]=f,t[11]=m):m=t[11];let h;return t[12]!==o||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[o,m]}),t[12]=o,t[13]=m,t[14]=h):h=t[14],h}function De(e){let{resolvedTheme:t}=j(),n=s(e=>e.selectedThreadId),{triggerExplorerRefresh:r}=b(),i=(0,z.useRef)(null),[a,o]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(`edit`),[_,v]=(0,z.useState)(0),[y,x]=(0,z.useState)(null),[C,w]=(0,z.useState)(!1),T=e.selectedFile?.path??null;(0,z.useEffect)(()=>{n&&c(n).then(x).catch(()=>{})},[n]);async function E(){if(y&&!C){w(!0);try{await pe(n,y)}finally{w(!1)}}}let D=(0,z.useCallback)(async t=>{if(!n)return;let a=await fe(n,t);if(!a)return;let s={name:a,path:a,type:`file`};i.current=a,o(!0),e.onFileCreated?.(s),r()},[n,e.onFileCreated,r]),O=ae(n,e.selectedFile,l,_);(0,z.useEffect)(()=>{if(e.selectedFile?.type===`file`){let t=i.current===e.selectedFile.path;t&&(i.current=null),g(Y(e.selectedFile,t))}else g(`edit`)},[T,n]);async function k(){if(n&&e.selectedFile&&O.fileSuspenseKey){f(!0);try{await he({threadId:n,file:e.selectedFile,suspenseKey:O.fileSuspenseKey,content:O.fileContent,onSaved:u})}finally{f(!1)}}}async function A(){if(n&&e.selectedFile&&!p){m(!0);try{await de(n,e.selectedFile)}finally{m(!1)}}}function M(){o(!1)}function N(){n&&O.editableFile&&(S(W(n,O.editableFile.path)),v(e=>e+1))}return{resolvedTheme:t,threadId:n,autoFocusEditor:a,saving:d,printing:p,markdownMode:h,setMarkdownMode:g,folderPath:y,copying:C,setFileContentState:u,presentation:O,handleCopyFolderPath:E,handleNewFile:D,handleSave:k,handlePrintMarkdown:A,handleEditorReady:M,handleFileLoadRetry:N,openRepositoryFolder:()=>{n&&me(n,y)}}}function Oe(e){let t=(0,B.c)(49),{selectedFile:n,showTreeBackButton:r,onShowTree:i,onFileCreated:o}=e,s=r!==void 0&&r,c;t[0]!==o||t[1]!==n?(c={selectedFile:n,onFileCreated:o},t[0]=o,t[1]=n,t[2]=c):c=t[2];let l=De(c);if(!l.threadId){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,X.jsx)(F,{className:`h-8 w-8 text-muted-foreground`}),(0,X.jsx)(`p`,{className:a.bodyMuted,children:`Select a thread to browse its files`})]}),t[3]=e):e=t[3],e}let u;t[4]!==i||t[5]!==n||t[6]!==s?(u=(0,X.jsx)(Ee,{selectedFile:n,showBackButton:s,onShowTree:i}),t[4]=i,t[5]=n,t[6]=s,t[7]=u):u=t[7];let d=l.presentation.currentContent!==null,f;t[8]===l?f=t[9]:(f=()=>void l.handlePrintMarkdown(),t[8]=l,t[9]=f);let p=l.presentation.fileContent!==``&&l.presentation.fileContent!==l.presentation.originalFileContent,m,h;t[10]===l?(m=t[11],h=t[12]):(m=()=>void l.handleSave(),h=e=>void l.handleNewFile(e),t[10]=l,t[11]=m,t[12]=h);let g;t[13]!==l.markdownMode||t[14]!==l.presentation.editableFile||t[15]!==l.printing||t[16]!==l.saving||t[17]!==l.setMarkdownMode||t[18]!==n||t[19]!==d||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==h?(g=(0,X.jsx)(`div`,{className:`flex gap-2`,children:(0,X.jsx)(Te,{selectedFile:n,editableFile:l.presentation.editableFile,hasLoadedContent:d,markdownMode:l.markdownMode,onMarkdownModeChange:l.setMarkdownMode,printing:l.printing,onPrint:f,saving:l.saving,canSave:p,onSave:m,onNewFile:h})}),t[13]=l.markdownMode,t[14]=l.presentation.editableFile,t[15]=l.printing,t[16]=l.saving,t[17]=l.setMarkdownMode,t[18]=n,t[19]=d,t[20]=f,t[21]=p,t[22]=m,t[23]=h,t[24]=g):g=t[24];let _;t[25]!==u||t[26]!==g?(_=(0,X.jsxs)(ee,{className:`justify-between print:hidden`,children:[u,g]}),t[25]=u,t[26]=g,t[27]=_):_=t[27];let v=l.presentation.currentContent!==null,y;t[28]!==l.autoFocusEditor||t[29]!==l.handleEditorReady||t[30]!==l.handleFileLoadRetry||t[31]!==l.markdownMode||t[32]!==l.presentation.editableFile||t[33]!==l.presentation.fileContent||t[34]!==l.presentation.fileSuspenseKey||t[35]!==l.presentation.selectedMediaType||t[36]!==l.resolvedTheme||t[37]!==l.setFileContentState||t[38]!==l.threadId||t[39]!==n||t[40]!==v?(y=(0,X.jsx)(`div`,{className:`flex-1 overflow-hidden print:overflow-visible print:flex-none`,children:(0,X.jsx)(`div`,{className:`h-full relative overflow-hidden print:h-auto print:overflow-visible`,children:(0,X.jsx)(xe,{threadId:l.threadId,selectedFile:n,selectedMediaType:l.presentation.selectedMediaType,editableFile:l.presentation.editableFile,fileSuspenseKey:l.presentation.fileSuspenseKey,hasLoadedContent:v,fileContent:l.presentation.fileContent,markdownMode:l.markdownMode,resolvedTheme:l.resolvedTheme,autoFocusEditor:l.autoFocusEditor,onContentChange:l.setFileContentState,onEditorReady:l.handleEditorReady,onFileLoadRetry:l.handleFileLoadRetry})})}),t[28]=l.autoFocusEditor,t[29]=l.handleEditorReady,t[30]=l.handleFileLoadRetry,t[31]=l.markdownMode,t[32]=l.presentation.editableFile,t[33]=l.presentation.fileContent,t[34]=l.presentation.fileSuspenseKey,t[35]=l.presentation.selectedMediaType,t[36]=l.resolvedTheme,t[37]=l.setFileContentState,t[38]=l.threadId,t[39]=n,t[40]=v,t[41]=y):y=t[41];let b;t[42]!==l||t[43]!==n?(b=n?null:(0,X.jsx)(Se,{folderPath:l.folderPath,copying:l.copying,onOpen:l.openRepositoryFolder,onCopy:()=>void l.handleCopyFolderPath()}),t[42]=l,t[43]=n,t[44]=b):b=t[44];let x;return t[45]!==_||t[46]!==y||t[47]!==b?(x=(0,X.jsxs)(`div`,{className:`explorer-view-root flex flex-col h-full print:block print:h-auto`,children:[_,y,b]}),t[45]=_,t[46]=y,t[47]=b,t[48]=x):x=t[48],x}export{Oe as default};
|
|
76
|
+
</html>`}function ce(e,t){let n=window.open(``,`_blank`,`noopener,noreferrer`);return n?(n.document.open(),n.document.write(se(e,t)),n.document.close(),!0):!1}function le(e){if(typeof window>`u`)return;let t=oe();if(!t){y({title:`Print unavailable`,description:`Couldn't find the markdown preview to print.`,variant:`destructive`});return}ce(e.name??`Markdown document`,t.innerHTML)||y({title:`Print blocked`,description:`Allow pop-ups to print this file.`,variant:`destructive`})}async function ue(e,t){let n=await O(e,t.path);y({title:`PDF created`,description:`Opened ${n.outputPath.split(/[\\/]/).pop()??`the PDF`} in your default app.`})}async function de(e,t){try{if(!c()){le(t);return}await ue(e,t)}catch(n){G(`Failed to print markdown file as PDF`,{threadId:e,path:t.path},n),y({title:`PDF export failed`,description:n instanceof Error?n.message:`Failed to convert this markdown file to PDF.`,variant:`destructive`})}}async function fe(e,t){try{let n=await V(e,t);return await A(e,``,n),y({title:`Created`,description:`${n} created successfully.`}),n}catch(n){return G(`Failed to create explorer file`,{threadId:e,extension:t},n),y({title:`Error`,description:`Failed to create file.`,variant:`destructive`}),null}}async function pe(e,t){try{await navigator.clipboard.writeText(t),y({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch(n){G(`Failed to copy explorer folder path`,{threadId:e,folderPath:t},n),y({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}}async function me(e,t){try{await T(e,`.`)}catch(n){G(`Failed to open explorer repository folder`,{threadId:e,folderPath:t},n),y({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}}async function he(e){try{await E(e.threadId,e.file.path,e.content),e.onSaved({key:e.suspenseKey,content:e.content,original:e.content}),y({title:`Saved`,description:`${e.file.name} saved successfully.`})}catch(t){G(`Failed to save explorer file`,{threadId:e.threadId,path:e.file.path},t),y({title:`Error`,description:t instanceof Error?t.message:`Failed to save file`,variant:`destructive`})}}function ge(e){let t=(0,B.c)(11),{threadId:n,path:r,contentKey:i,onContentReady:a}=e,o;t[0]!==r||t[1]!==n?(o=W(n,r),t[0]=r,t[1]=n,t[2]=o):o=t[2];let s;t[3]!==r||t[4]!==n?(s=()=>q(n,r),t[3]=r,t[4]=n,t[5]=s):s=t[5];let c=C(o,s),l,u;return t[6]!==i||t[7]!==a||t[8]!==c.content?(l=()=>{a({key:i,content:c.content,original:c.content})},u=[a,c.content,i],t[6]=i,t[7]=a,t[8]=c.content,t[9]=l,t[10]=u):(l=t[9],u=t[10]),(0,z.useLayoutEffect)(l,u),null}var X=i(),_e=(0,z.lazy)(function(){return r(()=>import(`./explorer-monaco-editor-ChJZBFy5.js`),__vite__mapDeps([0,1,2,3,4,5,6]))});function ve(e){let t=(0,B.c)(21),{threadId:n,file:r,suspenseKey:i,hasLoadedContent:a,fileContent:o,markdownMode:s,resolvedTheme:c,autoFocusEditor:l,onContentChange:d,onEditorReady:f,onRetry:p}=e,m=i??void 0,h;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,X.jsx)(x,{centered:!0,label:`Loading file contents...`}),t[0]=h):h=t[0];let g=i??void 0,_=i??``,v;t[1]!==r.path||t[2]!==d||t[3]!==g||t[4]!==_||t[5]!==n?(v=(0,X.jsx)(z.Suspense,{fallback:h,children:(0,X.jsx)(ge,{threadId:n,path:r.path,contentKey:_,onContentReady:d},g)}),t[1]=r.path,t[2]=d,t[3]=g,t[4]=_,t[5]=n,t[6]=v):v=t[6];let y;t[7]!==l||t[8]!==r.path||t[9]!==o||t[10]!==a||t[11]!==s||t[12]!==d||t[13]!==f||t[14]!==c?(y=a?H(r.path)&&s===`view`?(0,X.jsx)(`div`,{className:`h-full overflow-auto p-6 print:h-auto print:overflow-visible print:p-0`,children:(0,X.jsx)(`div`,{className:`mx-auto max-w-4xl print:max-w-none`,"data-markdown-print-content":!0,children:(0,X.jsx)(u,{content:o,enableMermaid:!0})})}):(0,X.jsx)(z.Suspense,{fallback:(0,X.jsx)(x,{centered:!0,label:`Loading editor...`}),children:(0,X.jsx)(_e,{language:U(r.path),value:o,theme:c===`dark`?`vs-dark`:`vs-light`,autoFocus:l,onReady:f,onChange:e=>d(t=>t&&{...t,content:e??``})})}):(0,X.jsx)(x,{centered:!0,label:`Loading file contents...`}),t[7]=l,t[8]=r.path,t[9]=o,t[10]=a,t[11]=s,t[12]=d,t[13]=f,t[14]=c,t[15]=y):y=t[15];let b;return t[16]!==p||t[17]!==m||t[18]!==v||t[19]!==y?(b=(0,X.jsxs)(R,{fallbackTitle:`Failed to load file`,onRetry:p,children:[v,y]},m),t[16]=p,t[17]=m,t[18]=v,t[19]=y,t[20]=b):b=t[20],b}function Z(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,X.jsx)(`h2`,{className:p(a.pageTitle,`text-foreground`),children:`File Explorer`}),(0,X.jsx)(`p`,{className:p(a.pageSubtitle),children:`Browse and edit files`})]}),e[0]=t):t=e[0],t}function Q(e,t){let n=(0,B.c)(11),r;n[0]!==t||n[1]!==e?(r=K(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>J(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=C(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,z.useEffect)(c,l),s}function ye(e){let t=(0,B.c)(3),{threadId:n,path:r,alt:i}=e,a=Q(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,X.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,X.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function be(e){let t=(0,B.c)(2),{threadId:n,path:r}=e,i=Q(n,r),a;return t[0]===i?a=t[1]:(a=(0,X.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,X.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}function $(e){let t=(0,B.c)(18),{mediaType:n,threadId:r,file:i}=e,a=n===`image`?`Failed to load image`:`Failed to load video`,o;t[0]!==i.path||t[1]!==r?(o=()=>{S(K(r,i.path))},t[0]=i.path,t[1]=r,t[2]=o):o=t[2];let s=`Loading ${n} preview...`,c;t[3]===s?c=t[4]:(c=(0,X.jsx)(x,{centered:!0,label:s}),t[3]=s,t[4]=c);let l;t[5]!==i.name||t[6]!==i.path||t[7]!==n||t[8]!==r?(l=n===`image`?(0,X.jsx)(ye,{threadId:r,path:i.path,alt:i.name}):(0,X.jsx)(be,{threadId:r,path:i.path}),t[5]=i.name,t[6]=i.path,t[7]=n,t[8]=r,t[9]=l):l=t[9];let u;t[10]!==c||t[11]!==l?(u=(0,X.jsx)(z.Suspense,{fallback:c,children:l}),t[10]=c,t[11]=l,t[12]=u):u=t[12];let d;return t[13]!==i.path||t[14]!==a||t[15]!==o||t[16]!==u?(d=(0,X.jsx)(R,{fallbackTitle:a,onRetry:o,children:u},i.path),t[13]=i.path,t[14]=a,t[15]=o,t[16]=u,t[17]=d):d=t[17],d}function xe(e){let t=(0,B.c)(19);if(e.editableFile){let n;return t[0]!==e.autoFocusEditor||t[1]!==e.editableFile||t[2]!==e.fileContent||t[3]!==e.fileSuspenseKey||t[4]!==e.hasLoadedContent||t[5]!==e.markdownMode||t[6]!==e.onContentChange||t[7]!==e.onEditorReady||t[8]!==e.onFileLoadRetry||t[9]!==e.resolvedTheme||t[10]!==e.threadId?(n=(0,X.jsx)(ve,{threadId:e.threadId,file:e.editableFile,suspenseKey:e.fileSuspenseKey,hasLoadedContent:e.hasLoadedContent,fileContent:e.fileContent,markdownMode:e.markdownMode,resolvedTheme:e.resolvedTheme,autoFocusEditor:e.autoFocusEditor,onContentChange:e.onContentChange,onEditorReady:e.onEditorReady,onRetry:e.onFileLoadRetry}),t[0]=e.autoFocusEditor,t[1]=e.editableFile,t[2]=e.fileContent,t[3]=e.fileSuspenseKey,t[4]=e.hasLoadedContent,t[5]=e.markdownMode,t[6]=e.onContentChange,t[7]=e.onEditorReady,t[8]=e.onFileLoadRetry,t[9]=e.resolvedTheme,t[10]=e.threadId,t[11]=n):n=t[11],n}if(e.selectedFile?.type===`file`&&e.selectedMediaType===`image`){let n;return t[12]!==e.selectedFile||t[13]!==e.threadId?(n=(0,X.jsx)($,{mediaType:`image`,threadId:e.threadId,file:e.selectedFile}),t[12]=e.selectedFile,t[13]=e.threadId,t[14]=n):n=t[14],n}if(e.selectedFile?.type===`file`&&e.selectedMediaType===`video`){let n;return t[15]!==e.selectedFile||t[16]!==e.threadId?(n=(0,X.jsx)($,{mediaType:`video`,threadId:e.threadId,file:e.selectedFile}),t[15]=e.selectedFile,t[16]=e.threadId,t[17]=n):n=t[17],n}let n;return t[18]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,X.jsx)(Z,{}),t[18]=n):n=t[18],n}function Se(e){let t=(0,B.c)(5),{folderPath:n,copying:r,onOpen:i,onCopy:o}=e,s;return t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==i?(s=(0,X.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`button`,{type:`button`,onClick:i,className:p(a.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:n,children:n}),(0,X.jsxs)(v,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:o,disabled:r,children:[r?(0,X.jsx)(m,{className:`h-3.5 w-3.5`}):(0,X.jsx)(h,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,X.jsx)(`p`,{className:p(a.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})}),t[0]=r,t[1]=n,t[2]=o,t[3]=i,t[4]=s):s=t[4],s}function Ce(e){let t=(0,B.c)(12),{path:n,markdownMode:r,onMarkdownModeChange:i,printing:a,onPrint:o}=e,s;t[0]!==r||t[1]!==o||t[2]!==n||t[3]!==a?(s=H(n)&&r===`view`?(0,X.jsxs)(v,{size:`sm`,variant:`outline`,onClick:o,disabled:a,children:[a?(0,X.jsx)(g,{className:`h-4 w-4 animate-spin`}):(0,X.jsx)(j,{className:`h-4 w-4`}),a?`Printing…`:`Print`]}):null,t[0]=r,t[1]=o,t[2]=n,t[3]=a,t[4]=s):s=t[4];let c;t[5]!==r||t[6]!==i||t[7]!==n?(c=H(n)?(0,X.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,X.jsx)(v,{size:`sm`,variant:r===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>i(`view`),children:`View`}),(0,X.jsx)(v,{size:`sm`,variant:r===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>i(`edit`),children:`Edit`})]}):null,t[5]=r,t[6]=i,t[7]=n,t[8]=c):c=t[8];let l;return t[9]!==s||t[10]!==c?(l=(0,X.jsxs)(X.Fragment,{children:[s,c]}),t[9]=s,t[10]=c,t[11]=l):l=t[11],l}var we=[{label:`Markdown`,ext:`md`,icon:N},{label:`TypeScript`,ext:`ts`,icon:P},{label:`Text`,ext:`txt`,icon:te}];function Te(e){let t=(0,B.c)(16),{selectedFile:n,editableFile:r,hasLoadedContent:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==e.canSave||t[3]!==e.markdownMode||t[4]!==e.onMarkdownModeChange||t[5]!==e.onPrint||t[6]!==e.onSave||t[7]!==e.printing||t[8]!==e.saving?(a=r&&i?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ce,{path:r.path,markdownMode:e.markdownMode,onMarkdownModeChange:e.onMarkdownModeChange,printing:e.printing,onPrint:e.onPrint}),(0,X.jsxs)(v,{size:`sm`,onClick:e.onSave,disabled:e.saving||!e.canSave,children:[e.saving?(0,X.jsx)(g,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,t[0]=r,t[1]=i,t[2]=e.canSave,t[3]=e.markdownMode,t[4]=e.onMarkdownModeChange,t[5]=e.onPrint,t[6]=e.onSave,t[7]=e.printing,t[8]=e.saving,t[9]=a):a=t[9];let o;t[10]!==e||t[11]!==n?(o=n?null:(0,X.jsxs)(L,{children:[(0,X.jsx)(re,{asChild:!0,children:(0,X.jsxs)(v,{size:`sm`,className:`gap-1.5`,children:[(0,X.jsx)(_,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,X.jsx)(I,{align:`end`,children:we.map(t=>{let{label:n,ext:r,icon:i}=t;return(0,X.jsxs)(ne,{onSelect:()=>e.onNewFile(r),children:[(0,X.jsx)(i,{className:`h-4 w-4`}),n]},r)})})]}),t[10]=e,t[11]=n,t[12]=o):o=t[12];let s;return t[13]!==a||t[14]!==o?(s=(0,X.jsxs)(X.Fragment,{children:[a,o]}),t[13]=a,t[14]=o,t[15]=s):s=t[15],s}function Ee(e){let t=(0,B.c)(15),{selectedFile:n,showBackButton:r,onShowTree:i}=e,o;t[0]!==i||t[1]!==r?(o=r&&i?(0,X.jsxs)(v,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:i,children:[(0,X.jsx)(F,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,t[0]=i,t[1]=r,t[2]=o):o=t[2];let s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=p(a.label,`truncate leading-normal text-foreground`),t[3]=s):s=t[3];let c=n?n.name:`Select a file to edit`,l;t[4]===c?l=t[5]:(l=(0,X.jsx)(`span`,{className:s,children:c}),t[4]=c,t[5]=l);let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=p(a.compact,`truncate text-muted-foreground`),t[6]=u):u=t[6];let d=n?n.path:`Browse and edit repository files`,f;t[7]===d?f=t[8]:(f=(0,X.jsx)(`span`,{className:u,children:d}),t[7]=d,t[8]=f);let m;t[9]!==l||t[10]!==f?(m=(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[l,f]}),t[9]=l,t[10]=f,t[11]=m):m=t[11];let h;return t[12]!==o||t[13]!==m?(h=(0,X.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[o,m]}),t[12]=o,t[13]=m,t[14]=h):h=t[14],h}function De(e){let{resolvedTheme:t}=ee(),n=s(e=>e.selectedThreadId),{triggerExplorerRefresh:r}=b(),i=(0,z.useRef)(null),[a,o]=(0,z.useState)(!1),[c,u]=(0,z.useState)(null),[d,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)(`edit`),[_,v]=(0,z.useState)(0),[y,x]=(0,z.useState)(null),[C,w]=(0,z.useState)(!1),T=e.selectedFile?.path??null;(0,z.useEffect)(()=>{n&&l(n).then(x).catch(()=>{})},[n]);async function E(){if(y&&!C){w(!0);try{await pe(n,y)}finally{w(!1)}}}let D=(0,z.useCallback)(async t=>{if(!n)return;let a=await fe(n,t);if(!a)return;let s={name:a,path:a,type:`file`};i.current=a,o(!0),e.onFileCreated?.(s),r()},[n,e.onFileCreated,r]),O=ae(n,e.selectedFile,c,_);(0,z.useEffect)(()=>{if(e.selectedFile?.type===`file`){let t=i.current===e.selectedFile.path;t&&(i.current=null),g(Y(e.selectedFile,t))}else g(`edit`)},[T,n]);async function k(){if(n&&e.selectedFile&&O.fileSuspenseKey){f(!0);try{await he({threadId:n,file:e.selectedFile,suspenseKey:O.fileSuspenseKey,content:O.fileContent,onSaved:u})}finally{f(!1)}}}async function A(){if(n&&e.selectedFile&&!p){m(!0);try{await de(n,e.selectedFile)}finally{m(!1)}}}function j(){o(!1)}function M(){n&&O.editableFile&&(S(W(n,O.editableFile.path)),v(e=>e+1))}return{resolvedTheme:t,threadId:n,autoFocusEditor:a,saving:d,printing:p,markdownMode:h,setMarkdownMode:g,folderPath:y,copying:C,setFileContentState:u,presentation:O,handleCopyFolderPath:E,handleNewFile:D,handleSave:k,handlePrintMarkdown:A,handleEditorReady:j,handleFileLoadRetry:M,openRepositoryFolder:()=>{n&&me(n,y)}}}function Oe(e){let t=(0,B.c)(49),{selectedFile:n,showTreeBackButton:r,onShowTree:i,onFileCreated:o}=e,s=r!==void 0&&r,c;t[0]!==o||t[1]!==n?(c={selectedFile:n,onFileCreated:o},t[0]=o,t[1]=n,t[2]=c):c=t[2];let l=De(c);if(!l.threadId){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,X.jsx)(N,{className:`h-8 w-8 text-muted-foreground`}),(0,X.jsx)(`p`,{className:a.bodyMuted,children:`Select a thread to browse its files`})]}),t[3]=e):e=t[3],e}let u;t[4]!==i||t[5]!==n||t[6]!==s?(u=(0,X.jsx)(Ee,{selectedFile:n,showBackButton:s,onShowTree:i}),t[4]=i,t[5]=n,t[6]=s,t[7]=u):u=t[7];let d=l.presentation.currentContent!==null,f;t[8]===l?f=t[9]:(f=()=>void l.handlePrintMarkdown(),t[8]=l,t[9]=f);let p=l.presentation.fileContent!==``&&l.presentation.fileContent!==l.presentation.originalFileContent,m,h;t[10]===l?(m=t[11],h=t[12]):(m=()=>void l.handleSave(),h=e=>void l.handleNewFile(e),t[10]=l,t[11]=m,t[12]=h);let g;t[13]!==l.markdownMode||t[14]!==l.presentation.editableFile||t[15]!==l.printing||t[16]!==l.saving||t[17]!==l.setMarkdownMode||t[18]!==n||t[19]!==d||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==h?(g=(0,X.jsx)(`div`,{className:`flex gap-2`,children:(0,X.jsx)(Te,{selectedFile:n,editableFile:l.presentation.editableFile,hasLoadedContent:d,markdownMode:l.markdownMode,onMarkdownModeChange:l.setMarkdownMode,printing:l.printing,onPrint:f,saving:l.saving,canSave:p,onSave:m,onNewFile:h})}),t[13]=l.markdownMode,t[14]=l.presentation.editableFile,t[15]=l.printing,t[16]=l.saving,t[17]=l.setMarkdownMode,t[18]=n,t[19]=d,t[20]=f,t[21]=p,t[22]=m,t[23]=h,t[24]=g):g=t[24];let _;t[25]!==u||t[26]!==g?(_=(0,X.jsxs)(M,{className:`justify-between print:hidden`,children:[u,g]}),t[25]=u,t[26]=g,t[27]=_):_=t[27];let v=l.presentation.currentContent!==null,y;t[28]!==l.autoFocusEditor||t[29]!==l.handleEditorReady||t[30]!==l.handleFileLoadRetry||t[31]!==l.markdownMode||t[32]!==l.presentation.editableFile||t[33]!==l.presentation.fileContent||t[34]!==l.presentation.fileSuspenseKey||t[35]!==l.presentation.selectedMediaType||t[36]!==l.resolvedTheme||t[37]!==l.setFileContentState||t[38]!==l.threadId||t[39]!==n||t[40]!==v?(y=(0,X.jsx)(`div`,{className:`flex-1 overflow-hidden print:overflow-visible print:flex-none`,children:(0,X.jsx)(`div`,{className:`h-full relative overflow-hidden print:h-auto print:overflow-visible`,children:(0,X.jsx)(xe,{threadId:l.threadId,selectedFile:n,selectedMediaType:l.presentation.selectedMediaType,editableFile:l.presentation.editableFile,fileSuspenseKey:l.presentation.fileSuspenseKey,hasLoadedContent:v,fileContent:l.presentation.fileContent,markdownMode:l.markdownMode,resolvedTheme:l.resolvedTheme,autoFocusEditor:l.autoFocusEditor,onContentChange:l.setFileContentState,onEditorReady:l.handleEditorReady,onFileLoadRetry:l.handleFileLoadRetry})})}),t[28]=l.autoFocusEditor,t[29]=l.handleEditorReady,t[30]=l.handleFileLoadRetry,t[31]=l.markdownMode,t[32]=l.presentation.editableFile,t[33]=l.presentation.fileContent,t[34]=l.presentation.fileSuspenseKey,t[35]=l.presentation.selectedMediaType,t[36]=l.resolvedTheme,t[37]=l.setFileContentState,t[38]=l.threadId,t[39]=n,t[40]=v,t[41]=y):y=t[41];let b;t[42]!==l||t[43]!==n?(b=n?null:(0,X.jsx)(Se,{folderPath:l.folderPath,copying:l.copying,onOpen:l.openRepositoryFolder,onCopy:()=>void l.handleCopyFolderPath()}),t[42]=l,t[43]=n,t[44]=b):b=t[44];let x;return t[45]!==_||t[46]!==y||t[47]!==b?(x=(0,X.jsxs)(`div`,{className:`explorer-view-root flex flex-col h-full print:block print:h-auto`,children:[_,y,b]}),t[45]=_,t[46]=y,t[47]=b,t[48]=x):x=t[48],x}export{Oe as default};
|