offsite 0.0.86 → 0.0.88
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/apps/client/dist/assets/XIcon-gbQKQqpC.js +67 -0
- package/apps/client/dist/assets/{diff-panel-C7lMMpep.js → diff-panel-CSL-MBoH.js} +1 -1
- package/apps/client/dist/assets/{editor-dialog-BYriXnE3.js → editor-dialog-BZY0-avL.js} +34 -34
- package/apps/client/dist/assets/{image-viewer-CRV8AWKt.js → image-viewer-CVERQTJS.js} +1 -1
- package/apps/client/dist/assets/{index-CSQLBowu.css → index-D8k0XOju.css} +1 -1
- package/apps/client/dist/assets/index-D_7IXtRu.js +72 -0
- package/apps/client/dist/assets/{preview-dialog-9aPCvV36.js → preview-dialog-sVMONOFM.js} +1 -1
- package/apps/client/dist/assets/{use-editor-shortcut-CXHRRkVK.js → use-editor-shortcut-Bqc1G-T5.js} +26 -26
- package/apps/client/dist/assets/{video-viewer-Be4G_Ych.js → video-viewer-DX49MZpf.js} +1 -1
- package/apps/client/dist/index.html +6 -6
- package/apps/client/dist/sw.js +1 -1
- package/apps/server/dist/main.mjs +416 -261
- package/apps/server/dist/main.mjs.map +1 -1
- package/apps/server/drizzle/20261104195246_session_provider/migration.sql +1 -0
- package/apps/server/drizzle/20261104195246_session_provider/snapshot.json +398 -0
- package/apps/server/drizzle/20261104222101_last_used_models/migration.sql +6 -0
- package/apps/server/drizzle/20261104222101_last_used_models/snapshot.json +451 -0
- package/package.json +1 -1
- package/apps/client/dist/assets/XIcon-C_Axuxgf.js +0 -67
- package/apps/client/dist/assets/index-DGntznWS.js +0 -72
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,i as n,n as r}from"./dist-D99rUXSZ.js";import{n as i,r as a,t as o}from"./TextWrapIcon-BRhMbXe9.js";import{t as s}from"./ChevronsDownUpIcon-BNVFd2te.js";import{L as c,N as l,P as u,an as d,g as f,t as p}from"./XIcon-C_Axuxgf.js";import{a as m,t as h}from"./button-CWFREsRn.js";import{An as g,Ft as _,G as v,Gn as y,N as b,P as x,W as S,Wn as C,at as w,cn as T,gt as E,ot as D,zt as O}from"./dist-Jliw2AH0.js";import{c as k,l as A,r as j}from"./utils-U6QfaJBO.js";function M(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t(e[r],r);return n}var N=[[`path`,{d:`M18.2505 10.5H19.6403C21.4918 10.5 22.0421 10.7655 21.9975 12.0838C21.9237 14.2674 20.939 16.8047 17 17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.94627 20.6145C2.57185 18.02 2.07468 14.3401 2.00143 10.5001C1.96979 8.8413 2.45126 8.5 4.65919 8.5H15.3408C17.5487 8.5 18.0302 8.8413 17.9986 10.5001C17.9253 14.3401 17.4281 18.02 14.0537 20.6145C13.0934 21.3528 12.2831 21.5 10.9194 21.5H9.08064C7.71686 21.5 6.90658 21.3528 5.94627 20.6145Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.3089 2.5C10.7622 2.83861 10.0012 4 10.0012 5.5M7.53971 4C7.53971 4 7 4.5 7 5.5M14.0012 4C13.7279 4.1693 13.5 5 13.5 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],P=[[`path`,{d:`M3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 2.5V21.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],F=[[`path`,{d:`M2.49219 15.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.49219 8.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.49219 12C2.49219 7.52166 2.49219 5.28249 3.88343 3.89124C5.27467 2.5 7.51384 2.5 11.9922 2.5C16.4705 2.5 18.7097 2.5 20.1009 3.89124C21.4922 5.28249 21.4922 7.52166 21.4922 12C21.4922 16.4783 21.4922 18.7175 20.1009 20.1088C18.7097 21.5 16.4705 21.5 11.9922 21.5C7.51384 21.5 5.27467 21.5 3.88343 20.1088C2.49219 18.7175 2.49219 16.4783 2.49219 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],I=e(A(),1);function L(e){let t=(0,I.useRef)(e);return(0,I.useInsertionEffect)(()=>void(t.current=e)),(0,I.useCallback)((...e)=>t.current(...e),[])}var R=k(),z=(0,I.createContext)(void 0);function ee(){return(0,I.useContext)(z)}var B={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},V={display:`contents`};function H(){return null}function U({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=O}){let p=n?.(e),m=r?.(e),h=i?.(e),_=a?.(e);return(0,R.jsxs)(R.Fragment,{children:[p==null?(0,R.jsxs)(R.Fragment,{children:[m!=null&&(0,R.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,R.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),_!=null&&(0,R.jsx)(`div`,{slot:`header-metadata`,children:_})]}):(0,R.jsx)(`div`,{slot:g,children:p}),o!=null&&l?.map((t,n)=>(0,R.jsx)(`div`,{slot:f(t),children:o(t,e)},n)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=te(t,e);return(0,R.jsx)(`div`,{slot:n,style:V,children:c(t,d)},n)}),s!=null&&(0,R.jsx)(`div`,{slot:`gutter-utility-slot`,style:B,children:s(u)})]})}function te(e,t){let n=b(e,t);return n==null?void 0:x({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var ne=(0,I.createContext)(void 0);function re(e,t){return typeof window>`u`&&t!=null?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,R.jsx)(R.Fragment,{children:e})}var ie=(0,I.createContext)(void 0);function W(){return(0,I.useContext)(ie)}function G(){let[e]=(0,I.useState)(()=>{let e=0,t;return{getSnapshot:()=>e,subscribe(e){return t=e,()=>{t=void 0}},forceUpdate(){e++,t?.()}}});return(0,I.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),e.forceUpdate}function K(e,t){"use no memo";return e.current?.__getNextRenderData(t)}var q=typeof window>`u`?I.useEffect:I.useLayoutEffect;function J({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=W(),_=s!==void 0,b=(0,I.useContext)(ne),x=ee(),[C,w]=(0,I.useState)(),E=L(e=>m?.(e)),D=m==null?void 0:E,k=(0,I.useRef)(null),A=L(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(k.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),j=h==null?void 0:A,M=ae({acceptedCache:k,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),N=(0,I.useRef)(null),P=G(),F=K(N,oe(k,M,o))??{fileDiff:M,lineAnnotations:o??y},R=(0,I.useRef)(null),z=(0,I.useRef)(null),B=L(()=>{if(x==null)throw Error(`FileDiff: EditContext is not attached`);return x(`file-diff`,i??{},a)}),V=L(e=>{if(e!=null){if(N.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?N.current=new v(Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),f?void 0:b,P):N.current=new S(Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),g,l,f?void 0:b,P),N.current.hydrate({fileDiff:M,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(N.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);z.current=null,N.current.cleanUp(),N.current=null,R.current=null}});q(()=>{let{current:e}=N;if(e==null)return;let t=Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),n=!T(e.options,t);if(e.setOptions(t),!p&&(z.current=null,R.current!=null)){let{current:e}=R;R.current=null,e()}let i=se(M,o,k);if(e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),!p||R.current!=null)return;if(x==null)throw Error(`FileDiff: EditContext is not attached`);let a=()=>{N.current===e&&R.current==null&&e.__canAttachEditor()&&(R.current=Q(e,B),P())};if(e.__canAttachEditor()){z.current=null,a();return}let c=e.__prepareForEditing();if(c==null){z.current=null;return}if(z.current?.promise===c)return;let l={promise:c};z.current=l,c.then(()=>{z.current===l&&(a(),z.current=null)}).catch(e=>{z.current===l&&(z.current=null,w(e))})});let H=(0,I.useCallback)(()=>N.current?.getHoveredLine(),[]),U=(0,I.useCallback)(e=>N.current?.getAnnotationSlotName(e)??O(e),[]);if(C!=null)throw C;return{...F,ref:V,getHoveredLine:H,getAnnotationSlotName:U}}function ae({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,I.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(Y(r,n,o.stale)||Y(r,n,o.installed))return o.fileDiff;a.filePair=null}return w(r??null,n??null,i)},[e,t,r,n,i])}function Y(e,t,n){return _(e??void 0,n.oldFile??void 0)&&_(t??void 0,n.newFile??void 0)}function oe(e,t,n){"use no memo";return X(t,n,e.current)}function X(e,t,n){return{fileDiff:n?.fileDiff!=null&&E(e,n.fileDiff.stale)?n.fileDiff.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function se(e,t,n){let{current:r}=n,i=X(e,t,r);return r==null||(r.fileDiff!=null&&!E(e,r.fileDiff.stale)&&(r.fileDiff=null),t!==r.annotations?.stale&&(r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null)),i}function Z({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?H:e?.renderCustomHeader,renderGutterUtility:r?H:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function Q(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function ce({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,fileDiff:w,lineAnnotations:T}=J({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),E=U({fileDiff:w,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:T,getHoveredLine:x,getAnnotationSlotName:S});return(0,R.jsx)(C,{ref:b,className:s,style:c,children:re(E,l)})}var le=3e3,ue=`text-foreground hover:bg-accent aria-pressed:bg-accent inline-flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-lg px-1.5 [&_svg]:opacity-80`,$=`text-muted-foreground hover:text-foreground aria-pressed:bg-background aria-pressed:text-foreground dark:aria-pressed:bg-input/72 inline-flex h-6 cursor-pointer items-center justify-center rounded-md px-2.5 aria-pressed:shadow-xs`;function de(e){let[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(0),S=(0,I.useRef)({patch:null,count:0}),C=u(e=>e.prefs.diff),w=c(),[T,E]=r(`diffFlipped`,[]);function O(e){l({...f().prefs,diff:{...C,...e}})}(0,I.useEffect)(()=>{let t=!0,n=!1;async function r(){if(!n){n=!0;try{let n=await d(e.machine,`git.diff`,{projectId:e.projectId});if(!t||(y(null),n===S.current.patch))return;S.current={patch:n,count:S.current.count+1},_(n.trim()===``?[]:D(n,`${e.projectId}:${S.current.count}`).flatMap(e=>e.files))}catch(e){t&&y(j(e))}finally{n=!1}}}function i(){document.hidden||r()}r();let a=window.setInterval(i,le);return window.addEventListener(`focus`,i),()=>{t=!1,window.clearInterval(a),window.removeEventListener(`focus`,i)}},[e.machine,e.projectId,e.running,b]);let k=g??[],A=M(k,e=>M(e.hunks,e=>e.additionLines)),L=M(k,e=>M(e.hunks,e=>e.deletionLines));return(0,R.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,R.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center justify-between gap-2 border-b pr-3 pl-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,R.jsx)(m,{icon:p,className:`size-4`})}),(0,R.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Uncommitted changes`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[k.length>0&&(0,R.jsxs)(`span`,{className:`text-2xs mr-1 inline-flex items-center gap-1 font-mono tabular-nums`,children:[(0,R.jsxs)(`span`,{className:`text-diff-addition`,children:[`+`,A]}),(0,R.jsxs)(`span`,{className:`text-diff-deletion`,children:[`-`,L]})]}),(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:`Refresh diff`,"aria-label":`Refresh diff`,onClick:()=>x(b+1),children:(0,R.jsx)(m,{icon:i,className:`size-4`})}),k.length>0&&(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:C.collapsed?`Expand all files`:`Collapse all files`,onClick:()=>{E([]),O({collapsed:!C.collapsed})},children:(0,R.jsx)(m,{icon:C.collapsed?n:s,className:`size-4`})}),(0,R.jsxs)(`div`,{className:`bg-input/40 flex shrink-0 items-center rounded-lg p-0.5`,children:[(0,R.jsx)(`button`,{className:$,"aria-pressed":!C.split,"aria-label":`Stacked diff view`,onClick:()=>O({split:!1}),children:(0,R.jsx)(m,{icon:F,className:`size-3.5`})}),(0,R.jsx)(`button`,{className:$,"aria-pressed":C.split,"aria-label":`Split diff view`,onClick:()=>O({split:!0}),children:(0,R.jsx)(m,{icon:P,className:`size-3.5`})})]}),(0,R.jsx)(`button`,{className:ue,"aria-pressed":C.wrap,title:C.wrap?`Disable line wrapping`:`Enable line wrapping`,onClick:()=>O({wrap:!C.wrap}),children:(0,R.jsx)(m,{icon:o,className:`size-3.5`})})]})]}),(0,R.jsxs)(`div`,{className:`diff-render-surface min-h-0 flex-1 overflow-y-auto [--code-background:var(--background)]`,children:[v!==null&&(0,R.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:v}),v===null&&g===null&&(0,R.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Loading…`}),v===null&&g?.length===0&&(0,R.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,R.jsx)(m,{icon:N,className:`text-muted-foreground/40 size-8`}),(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No uncommitted changes`}),(0,R.jsx)(`p`,{className:`text-muted-foreground/50 text-xs italic`,children:`If it works, don’t touch it.`})]})]}),v===null&&k.map(e=>{let n=C.collapsed!==T.includes(e.name);function r(){E(T.includes(e.name)?T.filter(t=>t!==e.name):[...T,e.name])}return(0,R.jsx)(`div`,{onClick:e=>{e.nativeEvent.composedPath().some(e=>e instanceof Element&&e.hasAttribute(`data-title`))&&r()},children:(0,R.jsx)(ce,{fileDiff:e,options:{theme:w,themeType:`dark`,unsafeCSS:`:host,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,i as n,n as r}from"./dist-D99rUXSZ.js";import{n as i,r as a,t as o}from"./TextWrapIcon-BRhMbXe9.js";import{t as s}from"./ChevronsDownUpIcon-BNVFd2te.js";import{F as c,M as l,in as u,j as d,m as f,t as p}from"./XIcon-gbQKQqpC.js";import{a as m,t as h}from"./button-CWFREsRn.js";import{An as g,Ft as _,G as v,Gn as y,N as b,P as x,W as S,Wn as C,at as w,cn as T,gt as E,ot as D,zt as O}from"./dist-Jliw2AH0.js";import{c as k,l as A,r as j}from"./utils-U6QfaJBO.js";function M(e,t){let n=0;for(let r=0;r<e.length;r++)n+=t(e[r],r);return n}var N=[[`path`,{d:`M18.2505 10.5H19.6403C21.4918 10.5 22.0421 10.7655 21.9975 12.0838C21.9237 14.2674 20.939 16.8047 17 17.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M5.94627 20.6145C2.57185 18.02 2.07468 14.3401 2.00143 10.5001C1.96979 8.8413 2.45126 8.5 4.65919 8.5H15.3408C17.5487 8.5 18.0302 8.8413 17.9986 10.5001C17.9253 14.3401 17.4281 18.02 14.0537 20.6145C13.0934 21.3528 12.2831 21.5 10.9194 21.5H9.08064C7.71686 21.5 6.90658 21.3528 5.94627 20.6145Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M11.3089 2.5C10.7622 2.83861 10.0012 4 10.0012 5.5M7.53971 4C7.53971 4 7 4.5 7 5.5M14.0012 4C13.7279 4.1693 13.5 5 13.5 5.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`2`}]],P=[[`path`,{d:`M3.89124 3.89124C5.28249 2.5 7.52166 2.5 12 2.5C16.4783 2.5 18.7175 2.5 20.1088 3.89124C21.5 5.28249 21.5 7.52166 21.5 12C21.5 16.4783 21.5 18.7175 20.1088 20.1088C18.7175 21.5 16.4783 21.5 12 21.5C7.52166 21.5 5.28249 21.5 3.89124 20.1088C2.5 18.7175 2.5 16.4783 2.5 12C2.5 7.52166 2.5 5.28249 3.89124 3.89124Z`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M12 2.5V21.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeWidth:`1.5`,key:`1`}]],F=[[`path`,{d:`M2.49219 15.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`0`}],[`path`,{d:`M2.49219 8.5H21.4922`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`1.5`,key:`1`}],[`path`,{d:`M2.49219 12C2.49219 7.52166 2.49219 5.28249 3.88343 3.89124C5.27467 2.5 7.51384 2.5 11.9922 2.5C16.4705 2.5 18.7097 2.5 20.1009 3.89124C21.4922 5.28249 21.4922 7.52166 21.4922 12C21.4922 16.4783 21.4922 18.7175 20.1009 20.1088C18.7097 21.5 16.4705 21.5 11.9922 21.5C7.51384 21.5 5.27467 21.5 3.88343 20.1088C2.49219 18.7175 2.49219 16.4783 2.49219 12Z`,stroke:`currentColor`,strokeWidth:`1.5`,key:`2`}]],I=e(A(),1);function L(e){let t=(0,I.useRef)(e);return(0,I.useInsertionEffect)(()=>void(t.current=e)),(0,I.useCallback)((...e)=>t.current(...e),[])}var R=k(),z=(0,I.createContext)(void 0);function ee(){return(0,I.useContext)(z)}var B={position:`absolute`,top:0,bottom:0,textAlign:`center`,whiteSpace:`normal`,touchAction:`none`},V={display:`contents`};function H(){return null}function U({fileDiff:e,actions:t,renderCustomHeader:n,renderHeaderPrefix:r,renderHeaderFilenameSuffix:i,renderHeaderMetadata:a,renderAnnotation:o,renderGutterUtility:s,renderMergeConflictUtility:c,lineAnnotations:l,getHoveredLine:u,getInstance:d,getAnnotationSlotName:f=O}){let p=n?.(e),m=r?.(e),h=i?.(e),_=a?.(e);return(0,R.jsxs)(R.Fragment,{children:[p==null?(0,R.jsxs)(R.Fragment,{children:[m!=null&&(0,R.jsx)(`div`,{slot:`header-prefix`,children:m}),h!=null&&(0,R.jsx)(`div`,{slot:`header-filename-suffix`,children:h}),_!=null&&(0,R.jsx)(`div`,{slot:`header-metadata`,children:_})]}):(0,R.jsx)(`div`,{slot:g,children:p}),o!=null&&l?.map((t,n)=>(0,R.jsx)(`div`,{slot:f(t),children:o(t,e)},n)),t!=null&&c!=null&&d!=null&&t.map(t=>{if(t==null)return;let n=te(t,e);return(0,R.jsx)(`div`,{slot:n,style:V,children:c(t,d)},n)}),s!=null&&(0,R.jsx)(`div`,{slot:`gutter-utility-slot`,style:B,children:s(u)})]})}function te(e,t){let n=b(e,t);return n==null?void 0:x({hunkIndex:n.hunkIndex,lineIndex:n.lineIndex,conflictIndex:e.conflictIndex})}var ne=(0,I.createContext)(void 0);function re(e,t){return typeof window>`u`&&t!=null?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,R.jsx)(R.Fragment,{children:e})}var ie=(0,I.createContext)(void 0);function W(){return(0,I.useContext)(ie)}function G(){let[e]=(0,I.useState)(()=>{let e=0,t;return{getSnapshot:()=>e,subscribe(e){return t=e,()=>{t=void 0}},forceUpdate(){e++,t?.()}}});return(0,I.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot),e.forceUpdate}function K(e,t){"use no memo";return e.current?.__getNextRenderData(t)}var q=typeof window>`u`?I.useEffect:I.useLayoutEffect;function J({fileDiff:e,oldFile:t,newFile:n,options:r,editorOptions:i,editStateKey:a,lineAnnotations:o,selectedLines:s,prerenderedHTML:c,metrics:l,hasGutterRenderUtility:u,hasCustomHeader:d,disableWorkerPool:f,edit:p,onEditChange:m,onEditComplete:h}){let g=W(),_=s!==void 0,b=(0,I.useContext)(ne),x=ee(),[C,w]=(0,I.useState)(),E=L(e=>m?.(e)),D=m==null?void 0:E,k=(0,I.useRef)(null),A=L(r=>{let i=h?.(r)??`reject`;return i===`accept`&&(k.current={fileDiff:{installed:r.fileDiff,stale:r.originalFileDiff},filePair:e==null?{fileDiff:r.fileDiff,installed:{oldFile:r.oldFile,newFile:r.newFile},stale:{oldFile:t??null,newFile:n??null}}:null,annotations:{installed:r.lineAnnotations,stale:r.originalLineAnnotations}}),i}),j=h==null?void 0:A,M=ae({acceptedCache:k,fileDiff:e,newFile:n,oldFile:t,parseDiffOptions:r?.parseDiffOptions}),N=(0,I.useRef)(null),P=G(),F=K(N,oe(k,M,o))??{fileDiff:M,lineAnnotations:o??y},R=(0,I.useRef)(null),z=(0,I.useRef)(null),B=L(()=>{if(x==null)throw Error(`FileDiff: EditContext is not attached`);return x(`file-diff`,i??{},a)}),V=L(e=>{if(e!=null){if(N.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);g==null?N.current=new v(Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),f?void 0:b,P):N.current=new S(Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),g,l,f?void 0:b,P),N.current.hydrate({fileDiff:M,fileContainer:e,lineAnnotations:o,prerenderedHTML:c})}else{if(N.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);z.current=null,N.current.cleanUp(),N.current=null,R.current=null}});q(()=>{let{current:e}=N;if(e==null)return;let t=Z({controlledSelection:_,hasCustomHeader:d,hasGutterRenderUtility:u,onEditChange:D,onEditComplete:j,options:r}),n=!T(e.options,t);if(e.setOptions(t),!p&&(z.current=null,R.current!=null)){let{current:e}=R;R.current=null,e()}let i=se(M,o,k);if(e.render({forceRender:n,fileDiff:i.fileDiff,lineAnnotations:i.lineAnnotations}),s!==void 0&&e.setSelectedLines(s),!p||R.current!=null)return;if(x==null)throw Error(`FileDiff: EditContext is not attached`);let a=()=>{N.current===e&&R.current==null&&e.__canAttachEditor()&&(R.current=Q(e,B),P())};if(e.__canAttachEditor()){z.current=null,a();return}let c=e.__prepareForEditing();if(c==null){z.current=null;return}if(z.current?.promise===c)return;let l={promise:c};z.current=l,c.then(()=>{z.current===l&&(a(),z.current=null)}).catch(e=>{z.current===l&&(z.current=null,w(e))})});let H=(0,I.useCallback)(()=>N.current?.getHoveredLine(),[]),U=(0,I.useCallback)(e=>N.current?.getAnnotationSlotName(e)??O(e),[]);if(C!=null)throw C;return{...F,ref:V,getHoveredLine:H,getAnnotationSlotName:U}}function ae({acceptedCache:e,fileDiff:t,newFile:n,oldFile:r,parseDiffOptions:i}){return(0,I.useMemo)(()=>{if(t!=null)return t;let{current:a}=e,o=a?.filePair;if(a!=null&&o!=null){if(Y(r,n,o.stale)||Y(r,n,o.installed))return o.fileDiff;a.filePair=null}return w(r??null,n??null,i)},[e,t,r,n,i])}function Y(e,t,n){return _(e??void 0,n.oldFile??void 0)&&_(t??void 0,n.newFile??void 0)}function oe(e,t,n){"use no memo";return X(t,n,e.current)}function X(e,t,n){return{fileDiff:n?.fileDiff!=null&&E(e,n.fileDiff.stale)?n.fileDiff.installed:e,lineAnnotations:n?.annotations!=null&&t===n.annotations.stale?n.annotations.installed:t}}function se(e,t,n){let{current:r}=n,i=X(e,t,r);return r==null||(r.fileDiff!=null&&!E(e,r.fileDiff.stale)&&(r.fileDiff=null),t!==r.annotations?.stale&&(r.annotations=null),r.fileDiff==null&&r.annotations==null&&r.filePair==null&&(n.current=null)),i}function Z({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r,onEditChange:i,onEditComplete:a}){return{...e,controlledSelection:t,renderCustomHeader:n?H:e?.renderCustomHeader,renderGutterUtility:r?H:e?.renderGutterUtility,onEditChange:i,onEditComplete:a}}function Q(e,t){let n=t();try{return n.edit(e)}catch(e){throw n.cleanUp(),e}}function ce({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,className:s,style:c,prerenderedHTML:l,renderAnnotation:u,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderGutterUtility:h,disableWorkerPool:g=!1,edit:_=!1,onEditChange:v,onEditComplete:y}){let{ref:b,getHoveredLine:x,getAnnotationSlotName:S,fileDiff:w,lineAnnotations:T}=J({fileDiff:e,options:t,editorOptions:n,editStateKey:r,metrics:i,lineAnnotations:a,selectedLines:o,prerenderedHTML:l,hasGutterRenderUtility:h!=null,hasCustomHeader:d!=null,disableWorkerPool:g,edit:_,onEditChange:v,onEditComplete:y}),E=U({fileDiff:w,renderCustomHeader:d,renderHeaderPrefix:f,renderHeaderFilenameSuffix:p,renderHeaderMetadata:m,renderAnnotation:u,renderGutterUtility:h,lineAnnotations:T,getHoveredLine:x,getAnnotationSlotName:S});return(0,R.jsx)(C,{ref:b,className:s,style:c,children:re(E,l)})}var le=3e3,ue=`text-foreground hover:bg-accent aria-pressed:bg-accent inline-flex h-7 min-w-7 cursor-pointer items-center justify-center rounded-lg px-1.5 [&_svg]:opacity-80`,$=`text-muted-foreground hover:text-foreground aria-pressed:bg-background aria-pressed:text-foreground dark:aria-pressed:bg-input/72 inline-flex h-6 cursor-pointer items-center justify-center rounded-md px-2.5 aria-pressed:shadow-xs`;function de(e){let[g,_]=(0,I.useState)(null),[v,y]=(0,I.useState)(null),[b,x]=(0,I.useState)(0),S=(0,I.useRef)({patch:null,count:0}),C=l(e=>e.prefs.diff),w=c(),[T,E]=r(`diffFlipped`,[]);function O(e){d({...f().prefs,diff:{...C,...e}})}(0,I.useEffect)(()=>{let t=!0,n=!1;async function r(){if(!n){n=!0;try{let n=await u(e.machine,`git.diff`,{projectId:e.projectId});if(!t||(y(null),n===S.current.patch))return;S.current={patch:n,count:S.current.count+1},_(n.trim()===``?[]:D(n,`${e.projectId}:${S.current.count}`).flatMap(e=>e.files))}catch(e){t&&y(j(e))}finally{n=!1}}}function i(){document.hidden||r()}r();let a=window.setInterval(i,le);return window.addEventListener(`focus`,i),()=>{t=!1,window.clearInterval(a),window.removeEventListener(`focus`,i)}},[e.machine,e.projectId,e.running,b]);let k=g??[],A=M(k,e=>M(e.hunks,e=>e.additionLines)),L=M(k,e=>M(e.hunks,e=>e.deletionLines));return(0,R.jsxs)(`div`,{className:`bg-background flex h-full min-h-0 min-w-0 flex-col`,children:[(0,R.jsxs)(`div`,{className:`border-border/60 bg-background flex h-(--workspace-topbar-height) shrink-0 items-center justify-between gap-2 border-b pr-3 pl-3`,children:[(0,R.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:`Close`,"aria-label":`Close`,onClick:e.onClose,children:(0,R.jsx)(m,{icon:p,className:`size-4`})}),(0,R.jsx)(`span`,{className:`text-foreground min-w-0 truncate text-xs font-medium`,children:`Uncommitted changes`})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[k.length>0&&(0,R.jsxs)(`span`,{className:`text-2xs mr-1 inline-flex items-center gap-1 font-mono tabular-nums`,children:[(0,R.jsxs)(`span`,{className:`text-diff-addition`,children:[`+`,A]}),(0,R.jsxs)(`span`,{className:`text-diff-deletion`,children:[`-`,L]})]}),(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:`Refresh diff`,"aria-label":`Refresh diff`,onClick:()=>x(b+1),children:(0,R.jsx)(m,{icon:i,className:`size-4`})}),k.length>0&&(0,R.jsx)(h,{size:`icon-sm`,variant:`ghost`,title:C.collapsed?`Expand all files`:`Collapse all files`,onClick:()=>{E([]),O({collapsed:!C.collapsed})},children:(0,R.jsx)(m,{icon:C.collapsed?n:s,className:`size-4`})}),(0,R.jsxs)(`div`,{className:`bg-input/40 flex shrink-0 items-center rounded-lg p-0.5`,children:[(0,R.jsx)(`button`,{className:$,"aria-pressed":!C.split,"aria-label":`Stacked diff view`,onClick:()=>O({split:!1}),children:(0,R.jsx)(m,{icon:F,className:`size-3.5`})}),(0,R.jsx)(`button`,{className:$,"aria-pressed":C.split,"aria-label":`Split diff view`,onClick:()=>O({split:!0}),children:(0,R.jsx)(m,{icon:P,className:`size-3.5`})})]}),(0,R.jsx)(`button`,{className:ue,"aria-pressed":C.wrap,title:C.wrap?`Disable line wrapping`:`Enable line wrapping`,onClick:()=>O({wrap:!C.wrap}),children:(0,R.jsx)(m,{icon:o,className:`size-3.5`})})]})]}),(0,R.jsxs)(`div`,{className:`diff-render-surface min-h-0 flex-1 overflow-y-auto [--code-background:var(--background)]`,children:[v!==null&&(0,R.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:v}),v===null&&g===null&&(0,R.jsx)(`p`,{className:`text-muted-foreground p-4 text-center text-xs`,children:`Loading…`}),v===null&&g?.length===0&&(0,R.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 p-6 text-center`,children:[(0,R.jsx)(m,{icon:N,className:`text-muted-foreground/40 size-8`}),(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsx)(`p`,{className:`text-muted-foreground text-sm`,children:`No uncommitted changes`}),(0,R.jsx)(`p`,{className:`text-muted-foreground/50 text-xs italic`,children:`If it works, don’t touch it.`})]})]}),v===null&&k.map(e=>{let n=C.collapsed!==T.includes(e.name);function r(){E(T.includes(e.name)?T.filter(t=>t!==e.name):[...T,e.name])}return(0,R.jsx)(`div`,{onClick:e=>{e.nativeEvent.composedPath().some(e=>e instanceof Element&&e.hasAttribute(`data-title`))&&r()},children:(0,R.jsx)(ce,{fileDiff:e,options:{theme:w,themeType:`dark`,unsafeCSS:`:host,
|
|
2
2
|
[data-diffs-header],
|
|
3
3
|
[data-diff],
|
|
4
4
|
[data-file],
|