@pi-chamber/web 0.4.0 → 0.5.0
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/{CommitSection-0zl1puqf.js → CommitSection-Cz-ACBaD.js} +1 -1
- package/dist/assets/DiagramEditor-BNUOrd9m.js +1 -0
- package/dist/assets/DiagramView-D4YR9YRt.js +1 -0
- package/dist/assets/{DiffView-BoTz2Zqe.js → DiffView-DPW8dcg_.js} +3 -3
- package/dist/assets/{FilesView-CVMNE9Pr.js → FilesView-BFGIdY6b.js} +6 -6
- package/dist/assets/{GitView-DnsbCAWl.js → GitView-CKtiKOfJ.js} +4 -4
- package/dist/assets/{JsonTreeView-Cn1Mk0Wf.js → JsonTreeView-c-UJUw3D.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DJKD8tNq.js → MarkdownRendererImpl-CvC9eXoa.js} +2 -2
- package/dist/assets/{PatchDiff-GdGq3IlM.js → PatchDiff-YGHsZUIR.js} +1 -1
- package/dist/assets/{PierreDiffViewer-CdkAUt-S.js → PierreDiffViewer-CoXa-JJK.js} +2 -2
- package/dist/assets/{SessionSwitcherContent-BTzVmIop.js → SessionSwitcherContent-B7eep3dO.js} +1 -1
- package/dist/assets/SessionSwitcherDropdown-CZOFeJHH.js +2 -0
- package/dist/assets/SessionUnreadDot-ClpeYFPz.js +1 -0
- package/dist/assets/SettingsView-CPmHHDbQ.js +4 -0
- package/dist/assets/SettingsWindow-2CBpoJ8H.js +1 -0
- package/dist/assets/{ToolOutputDialog-BHaf293m.js → ToolOutputDialog-HMW-Kh19.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-BTMXNcqG.js → ToolPartDiffPreview-C3nbNbxk.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-CRVvv23V.js → VirtualizedFileDiff-DEX83nQ0.js} +4 -4
- package/dist/assets/{WindowsWindowControls-CTtxXnD1.js → WindowsWindowControls-PPk5H89-.js} +129 -124
- package/dist/assets/collapsible-Dux-9hAC.js +1 -0
- package/dist/assets/{computeVirtualFileMetrics-D1I8YrPV.js → computeVirtualFileMetrics-Cy0nxMJB.js} +1 -1
- package/dist/assets/contextFileOpenGuard-Dn_38hd9.js +1 -0
- package/dist/assets/index--zDkVFU6.css +1 -0
- package/dist/assets/index-DU2OBBy5.js +8 -0
- package/dist/assets/{index-DbghctxK.js → index-EN7MioVf.js} +1 -1
- package/dist/assets/{isDiffPlainText-BK9bF1l5.js → isDiffPlainText-DSWRVq-W.js} +1 -1
- package/dist/assets/{isFilePlainText-Cua0RCRz.js → isFilePlainText-7RAjjrQ5.js} +1 -1
- package/dist/assets/{main-CoA--JT-.js → main-BGKjg-qW.js} +7 -7
- package/dist/assets/main-DGHrBx_u.js +2 -0
- package/dist/assets/markdownCore-BYPqQtbE.js +3 -0
- package/dist/assets/miniChat-DW2PVX49.js +2 -0
- package/dist/assets/mobile-0Gxc02iO.js +2 -0
- package/dist/assets/renderElectronMiniChatApp-C-qpqp1i.js +2 -0
- package/dist/assets/renderMobileApp-UB9bhC1x.js +14 -0
- package/dist/assets/{runtimeSurface-UriLeO95.js → runtimeSurface-DefD-2Iv.js} +1 -1
- package/dist/assets/{useInlineCommentController-5XANmO1k.js → useInlineCommentController-B8p2XwXA.js} +2 -2
- package/dist/assets/usePanelSlide-CbqVf-y8.js +56 -0
- package/dist/assets/usePushVisibilityBeacon-CvjN-47R.js +10 -0
- package/dist/assets/{useSwitcherItems-Cc6Tx-LO.js → useSwitcherItems-B6_F-J-z.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-DxpwplIe.js → vendor-codemirror-language-data-BhBdEPsJ.js} +2 -2
- package/dist/assets/{web-components-g7DKkne_.js → web-components-C9yVPsWN.js} +4 -4
- package/dist/index.html +7 -4
- package/dist/mini-chat.html +6 -3
- package/dist/mobile.html +6 -3
- package/package.json +1 -1
- package/server/lib/git/DOCUMENTATION.md +2 -2
- package/server/lib/git/issue-2746-longpaths.test.js +11 -11
- package/server/lib/git/service.js +16 -53
- package/server/lib/git/service.test.js +40 -40
- package/server/lib/pi/extension-protocol.js +62 -0
- package/server/lib/pi/extension-protocol.test.js +34 -0
- package/server/lib/pi/fixtures/pichamber-gui-demo.ts +251 -0
- package/server/lib/pi/routes-extension-events.test.js +152 -0
- package/server/lib/pi/routes.js +278 -5
- package/server/lib/pi/routes.test.js +0 -25
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +6 -3
- package/server/lib/pi/session-daemon/extension-bridge.js +488 -0
- package/server/lib/pi/session-daemon/session-daemon-extensions.e2e.test.js +215 -0
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +559 -0
- package/server/lib/pi/session-daemon/session-daemon.js +304 -34
- package/server/lib/pi/session-daemon/session-daemon.test.js +89 -1
- package/server/lib/server/cors.js +0 -2
- package/server/lib/server/cors.test.js +4 -4
- package/server/lib/stt/providers/openai-compatible-provider.test.js +1 -1
- package/server/lib/workspace/host.js +1 -1
- package/dist/assets/DiagramEditor-CFV_TjE2.js +0 -1
- package/dist/assets/DiagramView-0I4PZUpw.js +0 -1
- package/dist/assets/SessionSwitcherDropdown-DuPmnk3k.js +0 -2
- package/dist/assets/SessionUnreadDot-ogHL0INY.js +0 -1
- package/dist/assets/SettingsView-SHhVrRdh.js +0 -4
- package/dist/assets/SettingsWindow-D_D1qqLF.js +0 -1
- package/dist/assets/collapsible-BO4qEdib.js +0 -1
- package/dist/assets/contextFileOpenGuard-w5xG9Qz2.js +0 -1
- package/dist/assets/index-3zee2IYy.css +0 -1
- package/dist/assets/index-CI-cd-mw.js +0 -8
- package/dist/assets/main-BNJQ6mSF.js +0 -2
- package/dist/assets/markdownCore-BGlLZrb8.js +0 -3
- package/dist/assets/miniChat-DU2jFhXq.js +0 -2
- package/dist/assets/mobile-B3lJ_CJR.js +0 -2
- package/dist/assets/renderElectronMiniChatApp-BfXYv3zl.js +0 -2
- package/dist/assets/renderMobileApp-Cd_F7yMe.js +0 -14
- package/dist/assets/usePanelSlide-CBZw2Cjo.js +0 -56
- package/dist/assets/useWindowTitle-Bf8ZNN_R.js +0 -10
- package/server/lib/pi/legacy-ui-model-defaults.js +0 -57
- package/server/lib/pi/legacy-ui-model-defaults.test.js +0 -65
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as F,j as L,b as we,r as d}from"./vendor-react-DYyjh7Q0.js";import{a as $e}from"./web-components-g7DKkne_.js";import{f as Te}from"./computeVirtualFileMetrics-D1I8YrPV.js";import{V as Ne,F as Be}from"./VirtualizedFileDiff-CRVvv23V.js";import{b7 as je,aJ as Ue,ar as Ge,f as ke}from"./WindowsWindowControls-CTtxXnD1.js";import{am as Qe}from"./usePanelSlide-CBZw2Cjo.js";import{I as Ce,a as Ke,u as Ye}from"./useInlineCommentController-5XANmO1k.js";import{ensurePierreThemeRegistered as Me,getResolvedShikiTheme as Le}from"./appThemeRegistry-BK0dHKa6.js";import{L as Oe}from"./index-CI-cd-mw.js";const he=new Set;let Re=null;function I(s){he.add(s),Re??=requestAnimationFrame(Pe)}function Pe(s){const e=new Set(he);he.clear();for(const t of e)try{t(s)}catch(n){console.error(n)}he.size>0?Re=requestAnimationFrame(Pe):Re=null}function De({scrollTop:s,scrollHeight:e,height:t,fitPerfectly:n=!1,fitPerfectlyOverscroll:r=0,overscrollSize:l}){const u=t+l*2,h=n?t+r*2:u;if(e=Math.max(e,h),u>=e||n){const m=Math.max(s-r,0),S=Math.min(s+h,e);return{top:m,bottom:Math.max(S,m)}}let a=s+t/2-u/2,g=a+u;return a<0&&(a=0),g>e&&(g=e),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(g,e),a))}}function Ze(s,e){return s==null||e==null?s===e:s.top===e.top&&s.bottom===e.bottom}const He=1e3,Je=He*4,Xe=[0,1e-6,.99999,1],et={overscrollSize:He,intersectionObserverMargin:Je,resizeDebugging:!1};let ue=0,tt=-1;var nt=class H{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++tt}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...et,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Xe,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{H.__STOP?(H.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:H.__lastScrollPosition}),I(this.computeRenderRangeAndEmit)):(H.__lastScrollPosition=this.getScrollTop(),H.__STOP=!0)};for(const[n,r]of this.connectQueue.entries())this.connect(n,r);this.connectQueue.clear(),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),r=this.getHeight(),l=this.config.intersectionObserverMargin,u=n-l,h=n+r+l;return!(e<u-t||e>h)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const n of e){const r=n.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r)):n.target===this.root?r!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r))}t&&I(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+se(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),I(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{H.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,I(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{H.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{H.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(H.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const l=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&Ze(this.windowSpecs,l)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=l}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),r=new Set;for(const l of e?this.observers.values():this.visibleInstances.values())l.onRender(e)&&r.add(l);for(const l of this.instancesChanged)r.has(l)||l.onRender(e)&&r.add(l);this.scrollFix(n);for(const l of r)l.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&I(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:l,fileOffset:u,fileTypeOffset:h}=e;if(n!=null&&r!=null){const g=l.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(g instanceof HTMLElement){const m=se(g,t);if(m!==r){const S=m-r;this.applyScrollFix(S)}return}}const a=se(l,t);if(h==="top")a!==u&&this.applyScrollFix(a-u);else{const g=a+l.getBoundingClientRect().height;g!==u&&this.applyScrollFix(g-u)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let n;for(const[r]of this.visibleInstances.entries()){const l=se(r,t),u=l+r.offsetHeight;let h,a;u<=0?(h=u,a="bottom"):(h=l,a="top");let g,m;if(u>0&&l<e)for(const O of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(O instanceof HTMLElement))continue;const B=O.dataset.lineIndex;if(B==null)continue;const j=se(O,t);if(!(j<0)){g=B,m=j;break}}if(n?.lineOffset!=null&&m==null)continue;let S=!1;(n==null||m!=null&&(n.lineOffset==null||m<n.lineOffset)||m==null&&n.lineOffset==null&&(h>=0&&(n.fileOffset<0||h<n.fileOffset)||h<0&&n.fileOffset<0&&h>n.fileOffset))&&(S=!0),S&&(n={fileElement:r,fileTypeOffset:a,fileOffset:h,lineIndex:g,lineOffset:m})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(t);r!=null&&(n&&!this.visibleInstances.has(t)?(r.setVisibility(!0),this.visibleInstances.set(t,r),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(r.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&I(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function se(s,e){const t=s.getBoundingClientRect(),n=e?.getBoundingClientRect().top??0;return t.top-n}const pe=s=>{if(s.type==="new"){const e=Math.min(s.selection.start,s.selection.end),t=Math.max(s.selection.start,s.selection.end);return`new-comment-${s.selection.side??"additions"}-${e}-${t}`}return`draft-${s.draft.id}`},it=s=>{const{drafts:e,editingDraftId:t,selection:n}=s,r=[];for(const l of e){if(!Number.isFinite(l.endLine))continue;const u=Math.max(1,Math.floor(l.endLine)),h=l.side==="original"?"deletions":"additions";r.push({lineNumber:u,side:h,metadata:{type:l.id===t?"edit":"saved",draft:l}})}return n&&!t&&r.push({lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}),r};function rt(s){const e=s.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const t=Number.parseFloat(e);return Number.isFinite(t)?t:null}if(e.endsWith("px")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?t:null}return null}function ze(s){if(!(!s||s<=0))return Math.max(200,Math.floor(s))}function st(s){const{diffRootRef:e,drafts:t,selection:n,editingDraftId:r,commentText:l,onTextChange:u,fileLabel:h,onSave:a,onCancel:g,onEdit:m,onDelete:S}=s,[O,B]=F.useState(0),[j,J]=F.useState(null),b=F.useMemo(()=>!n||r?null:pe({type:"new",selection:n}),[r,n]),_=F.useMemo(()=>{const c=t.map(y=>pe({type:y.id===r?"edit":"saved",draft:y}));return b&&c.push(b),c},[t,r,b]),$=F.useCallback(c=>{const y=e.current;if(!y)return null;const w=y.querySelector("diffs-container");if(!(w instanceof HTMLElement))return null;const k=w.querySelector(`[data-annotation-id="${c}"]`);if(k instanceof HTMLElement)return k;const A=w.shadowRoot;return A?A.querySelector(`[data-annotation-id="${c}"]`):null},[e]);F.useEffect(()=>{if(_.length===0)return;let c=!1,y=0;const w=12,k=()=>{c||_.every(D=>!!$(D))||y>=w||(y+=1,requestAnimationFrame(()=>{c||(B(D=>D+1),k())}))};return k(),()=>{c=!0}},[_,$]),F.useEffect(()=>{const c=e.current;if(!c)return;const y=()=>{const k=getComputedStyle(c),A=rt(k.getPropertyValue("--oc-context-panel-width")),D=c.getBoundingClientRect(),N=A??D.width;J(N>0?N:null)};y();const w=new ResizeObserver(()=>{y()});return w.observe(c),window.addEventListener("resize",y),()=>{w.disconnect(),window.removeEventListener("resize",y)}},[e]);const G=F.useCallback(c=>{const w=e.current?.getBoundingClientRect(),k=c.closest("[data-annotation-content]"),A=k instanceof HTMLElement?k.getBoundingClientRect():c.getBoundingClientRect(),D=[A.width];w&&D.push(w.right-A.left);const N=D.filter(X=>Number.isFinite(X)&&X>0);return N.length>0?ze(Math.min(...N)):ze(j)},[e,j]);return L.jsxs(L.Fragment,{children:[t.map(c=>{const y=pe({type:c.id===r?"edit":"saved",draft:c}),w=$(y);if(!w)return null;const k=G(w);return c.id===r?we.createPortal(L.jsx(Ce,{initialText:l,onTextChange:u,fileLabel:h,lineRange:{start:c.startLine,end:c.endLine,side:c.side==="original"?"deletions":"additions"},isEditing:!0,onSave:a,onCancel:g,maxWidth:k}),w,`draft-edit-${c.id}`):we.createPortal(L.jsx(Ke,{draft:c,onEdit:()=>m(c),onDelete:()=>S(c),maxWidth:k}),w,`draft-card-${c.id}`)}),n&&!r&&b&&(()=>{const c=$(b);if(!c)return null;const y=G(c);return we.createPortal(L.jsx(Ce,{initialText:l,onTextChange:u,fileLabel:h,lineRange:n,isEditing:!1,onSave:a,onCancel:g,maxWidth:y}),c,b)})()]})}const Ie=5e5,ot=`
|
|
1
|
+
import{R as F,j as O,b as we,r as d}from"./vendor-react-DYyjh7Q0.js";import{a as $e}from"./web-components-C9yVPsWN.js";import{f as Te}from"./computeVirtualFileMetrics-Cy0nxMJB.js";import{V as Ne,F as Be}from"./VirtualizedFileDiff-DEX83nQ0.js";import{a_ as je,aI as Ue,aq as Ge}from"./WindowsWindowControls-PPk5H89-.js";import{V as ke,m as Ce}from"./index-DU2OBBy5.js";import{am as Qe}from"./usePanelSlide-CbqVf-y8.js";import{I as Me,a as Ke,u as Ye}from"./useInlineCommentController-B8p2XwXA.js";import{ensurePierreThemeRegistered as Oe,getResolvedShikiTheme as Le}from"./appThemeRegistry-BK0dHKa6.js";const he=new Set;let Re=null;function I(s){he.add(s),Re??=requestAnimationFrame(Pe)}function Pe(s){const e=new Set(he);he.clear();for(const t of e)try{t(s)}catch(n){console.error(n)}he.size>0?Re=requestAnimationFrame(Pe):Re=null}function De({scrollTop:s,scrollHeight:e,height:t,fitPerfectly:n=!1,fitPerfectlyOverscroll:r=0,overscrollSize:l}){const u=t+l*2,h=n?t+r*2:u;if(e=Math.max(e,h),u>=e||n){const m=Math.max(s-r,0),S=Math.min(s+h,e);return{top:m,bottom:Math.max(S,m)}}let a=s+t/2-u/2,g=a+u;return a<0&&(a=0),g>e&&(g=e),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(g,e),a))}}function Ze(s,e){return s==null||e==null?s===e:s.top===e.top&&s.bottom===e.bottom}const He=1e3,Xe=He*4,Je=[0,1e-6,.99999,1],et={overscrollSize:He,intersectionObserverMargin:Xe,resizeDebugging:!1};let ue=0,tt=-1;var nt=class H{static __STOP=!1;static __lastScrollPosition=0;__id=`virtualizer-${++tt}`;config;type="simple";intersectionObserver;scrollTop=0;height=0;scrollHeight=0;windowSpecs={top:0,bottom:0};root;contentContainer;resizeObserver;observers=new Map;visibleInstances=new Map;visibleInstancesDirty=!1;instancesChanged=new Set;scrollDirty=!0;heightDirty=!0;scrollHeightDirty=!0;renderedObservers=0;connectQueue=new Map;constructor(e){this.config={...et,...e}}setup(e,t){if(this.root==null){this.root=e,this.resizeObserver=new ResizeObserver(this.handleContainerResize),this.intersectionObserver=new IntersectionObserver(this.handleIntersectionChange,{root:this.root,threshold:Je,rootMargin:`${this.config.intersectionObserverMargin}px 0px ${this.config.intersectionObserverMargin}px 0px`}),e instanceof Document?this.setupWindow():this.setupElement(t),window.__INSTANCE=this,window.__TOGGLE=()=>{H.__STOP?(H.__STOP=!1,(this.getScrollContainerElement()??window).scrollTo({top:H.__lastScrollPosition}),I(this.computeRenderRangeAndEmit)):(H.__lastScrollPosition=this.getScrollTop(),H.__STOP=!0)};for(const[n,r]of this.connectQueue.entries())this.connect(n,r);this.connectQueue.clear(),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}}instanceChanged(e,t){this.instancesChanged.add(e),t&&this.markDOMDirty(),I(this.computeRenderRangeAndEmit)}getWindowSpecs(){return this.windowSpecs.top===0&&this.windowSpecs.bottom===0&&(this.windowSpecs=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize})),this.windowSpecs}isInstanceVisible(e,t){const n=this.getScrollTop(),r=this.getHeight(),l=this.config.intersectionObserverMargin,u=n-l,h=n+r+l;return!(e<u-t||e>h)}handleContainerResize=e=>{if(this.root==null)return;let t=!1;for(const n of e){const r=n.borderBoxSize[0].blockSize;this.root instanceof Document?r!==this.scrollHeight&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: content size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r)):n.target===this.root?r!==this.height&&(this.heightDirty=!0,t=!0):n.target===this.contentContainer&&(this.scrollHeightDirty=!0,t=!0,this.config.resizeDebugging&&(console.log("Virtualizer: scroller size change",this.__id,{sizeChange:r-ue,newSize:r}),ue=r))}t&&I(this.computeRenderRangeAndEmit)};setupWindow(){if(this.root==null||!(this.root instanceof Document))throw new Error("Virtualizer.setupWindow: Invalid setup method");window.addEventListener("scroll",this.handleWindowScroll,{passive:!0}),window.addEventListener("resize",this.handleWindowResize,{passive:!0}),this.resizeObserver?.observe(this.root.documentElement)}setupElement(e){if(this.root==null||this.root instanceof Document)throw new Error("Virtualizer.setupElement: Invalid setup method");this.root.addEventListener("scroll",this.handleElementScroll,{passive:!0}),this.resizeObserver?.observe(this.root),e??=this.root.firstElementChild??void 0,e instanceof HTMLElement&&(this.contentContainer=e,this.resizeObserver?.observe(e))}cleanUp(){this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.intersectionObserver?.disconnect(),this.intersectionObserver=void 0,this.root?.removeEventListener("scroll",this.handleElementScroll),window.removeEventListener("scroll",this.handleWindowScroll),window.removeEventListener("resize",this.handleWindowResize),this.root=void 0,this.contentContainer=void 0,this.observers.clear(),this.visibleInstances.clear(),this.instancesChanged.clear(),this.connectQueue.clear(),this.visibleInstancesDirty=!1,this.windowSpecs={top:0,bottom:0},this.scrollTop=0,this.height=0,this.scrollHeight=0}getOffsetInScrollContainer(e){return this.getScrollTop()+se(e,this.getScrollContainerElement())}connect(e,t){if(this.observers.has(e))throw new Error("Virtualizer.connect: instance is already connected...");return this.intersectionObserver==null?this.connectQueue.set(e,t):(this.intersectionObserver.observe(e),this.observers.set(e,t),this.instancesChanged.add(t),this.markDOMDirty(),I(this.computeRenderRangeAndEmit)),()=>this.disconnect(e)}disconnect(e){const t=this.observers.get(e);this.connectQueue.delete(e),t!=null&&(this.intersectionObserver?.unobserve(e),this.observers.delete(e),this.visibleInstances.delete(e)&&(this.visibleInstancesDirty=!0),this.markDOMDirty(),I(this.computeRenderRangeAndEmit))}handleWindowResize=()=>{H.__STOP||window.innerHeight===this.height||(this.heightDirty=!0,I(this.computeRenderRangeAndEmit))};handleWindowScroll=()=>{H.__STOP||this.root==null||!(this.root instanceof Document)||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};handleElementScroll=()=>{H.__STOP||this.root==null||this.root instanceof Document||(this.scrollDirty=!0,I(this.computeRenderRangeAndEmit))};computeRenderRangeAndEmit=()=>{if(H.__STOP)return;const e=this.heightDirty||this.scrollHeightDirty;if(!this.scrollDirty&&!this.scrollHeightDirty&&!this.heightDirty&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty&&this.instancesChanged.size===0)return;let t=this.instancesChanged.size>0;if(this.instancesChanged.size===0){const l=De({scrollTop:this.getScrollTop(),height:this.getHeight(),scrollHeight:this.getScrollHeight(),overscrollSize:this.config.overscrollSize});if(!e&&Ze(this.windowSpecs,l)&&this.renderedObservers===this.observers.size&&!this.visibleInstancesDirty)return;this.windowSpecs=l}this.visibleInstancesDirty=!1,this.renderedObservers=this.observers.size;const n=this.getScrollAnchor(this.height),r=new Set;for(const l of e?this.observers.values():this.visibleInstances.values())l.onRender(e)&&r.add(l);for(const l of this.instancesChanged)r.has(l)||l.onRender(e)&&r.add(l);this.scrollFix(n);for(const l of r)l.reconcileHeights();t||=this.instancesChanged.size>0,t&&this.markDOMDirty(),(t||e)&&I(this.computeRenderRangeAndEmit),r.clear(),this.instancesChanged.clear()};scrollFix(e){if(e==null)return;const t=this.getScrollContainerElement(),{lineIndex:n,lineOffset:r,fileElement:l,fileOffset:u,fileTypeOffset:h}=e;if(n!=null&&r!=null){const g=l.shadowRoot?.querySelector(`[data-line][data-line-index="${n}"]`);if(g instanceof HTMLElement){const m=se(g,t);if(m!==r){const S=m-r;this.applyScrollFix(S)}return}}const a=se(l,t);if(h==="top")a!==u&&this.applyScrollFix(a-u);else{const g=a+l.getBoundingClientRect().height;g!==u&&this.applyScrollFix(g-u)}}applyScrollFix(e){this.root==null||this.root instanceof Document?window.scrollTo({top:window.scrollY+e,behavior:"instant"}):this.root.scrollTo({top:this.root.scrollTop+e,behavior:"instant"}),this.markDOMDirty()}getScrollAnchor(e){const t=this.getScrollContainerElement();let n;for(const[r]of this.visibleInstances.entries()){const l=se(r,t),u=l+r.offsetHeight;let h,a;u<=0?(h=u,a="bottom"):(h=l,a="top");let g,m;if(u>0&&l<e)for(const L of r.shadowRoot?.querySelectorAll("[data-line][data-line-index]")??[]){if(!(L instanceof HTMLElement))continue;const B=L.dataset.lineIndex;if(B==null)continue;const j=se(L,t);if(!(j<0)){g=B,m=j;break}}if(n?.lineOffset!=null&&m==null)continue;let S=!1;(n==null||m!=null&&(n.lineOffset==null||m<n.lineOffset)||m==null&&n.lineOffset==null&&(h>=0&&(n.fileOffset<0||h<n.fileOffset)||h<0&&n.fileOffset<0&&h>n.fileOffset))&&(S=!0),S&&(n={fileElement:r,fileTypeOffset:a,fileOffset:h,lineIndex:g,lineOffset:m})}return n}handleIntersectionChange=e=>{this.scrollDirty=!0;for(const{target:t,isIntersecting:n}of e){if(!(t instanceof HTMLElement))throw new Error("Virtualizer.handleIntersectionChange: target not an HTMLElement");const r=this.observers.get(t);r!=null&&(n&&!this.visibleInstances.has(t)?(r.setVisibility(!0),this.visibleInstances.set(t,r),this.visibleInstancesDirty=!0):!n&&this.visibleInstances.has(t)&&(r.setVisibility(!1),this.visibleInstances.delete(t),this.visibleInstancesDirty=!0))}this.visibleInstancesDirty&&I(this.computeRenderRangeAndEmit)};getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root==null?0:this.root instanceof Document?window.scrollY:this.root.scrollTop;return e=Math.max(0,Math.min(e,this.getScrollHeight()-this.getHeight())),this.scrollTop=e,e}getScrollHeight(){return this.scrollHeightDirty?(this.scrollHeightDirty=!1,this.scrollHeight=this.root==null?0:this.root instanceof Document?this.root.documentElement.scrollHeight:this.root.scrollHeight,this.scrollHeight):this.scrollHeight}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root==null?0:this.root instanceof Document?globalThis.innerHeight:this.root.getBoundingClientRect().height,this.height):this.height}markDOMDirty(){this.scrollDirty=!0,this.scrollHeightDirty=!0,this.heightDirty=!0}getScrollContainerElement(){return this.root==null||this.root instanceof Document?void 0:this.root}};function se(s,e){const t=s.getBoundingClientRect(),n=e?.getBoundingClientRect().top??0;return t.top-n}const pe=s=>{if(s.type==="new"){const e=Math.min(s.selection.start,s.selection.end),t=Math.max(s.selection.start,s.selection.end);return`new-comment-${s.selection.side??"additions"}-${e}-${t}`}return`draft-${s.draft.id}`},it=s=>{const{drafts:e,editingDraftId:t,selection:n}=s,r=[];for(const l of e){if(!Number.isFinite(l.endLine))continue;const u=Math.max(1,Math.floor(l.endLine)),h=l.side==="original"?"deletions":"additions";r.push({lineNumber:u,side:h,metadata:{type:l.id===t?"edit":"saved",draft:l}})}return n&&!t&&r.push({lineNumber:Math.max(n.start,n.end),side:n.side??"additions",metadata:{type:"new",selection:n}}),r};function rt(s){const e=s.trim();if(!e)return null;if(/^-?\d+(\.\d+)?$/.test(e)){const t=Number.parseFloat(e);return Number.isFinite(t)?t:null}if(e.endsWith("px")){const t=Number.parseFloat(e.slice(0,-2));return Number.isFinite(t)?t:null}return null}function ze(s){if(!(!s||s<=0))return Math.max(200,Math.floor(s))}function st(s){const{diffRootRef:e,drafts:t,selection:n,editingDraftId:r,commentText:l,onTextChange:u,fileLabel:h,onSave:a,onCancel:g,onEdit:m,onDelete:S}=s,[L,B]=F.useState(0),[j,X]=F.useState(null),b=F.useMemo(()=>!n||r?null:pe({type:"new",selection:n}),[r,n]),_=F.useMemo(()=>{const c=t.map(y=>pe({type:y.id===r?"edit":"saved",draft:y}));return b&&c.push(b),c},[t,r,b]),$=F.useCallback(c=>{const y=e.current;if(!y)return null;const w=y.querySelector("diffs-container");if(!(w instanceof HTMLElement))return null;const k=w.querySelector(`[data-annotation-id="${c}"]`);if(k instanceof HTMLElement)return k;const A=w.shadowRoot;return A?A.querySelector(`[data-annotation-id="${c}"]`):null},[e]);F.useEffect(()=>{if(_.length===0)return;let c=!1,y=0;const w=12,k=()=>{c||_.every(D=>!!$(D))||y>=w||(y+=1,requestAnimationFrame(()=>{c||(B(D=>D+1),k())}))};return k(),()=>{c=!0}},[_,$]),F.useEffect(()=>{const c=e.current;if(!c)return;const y=()=>{const k=getComputedStyle(c),A=rt(k.getPropertyValue("--oc-context-panel-width")),D=c.getBoundingClientRect(),N=A??D.width;X(N>0?N:null)};y();const w=new ResizeObserver(()=>{y()});return w.observe(c),window.addEventListener("resize",y),()=>{w.disconnect(),window.removeEventListener("resize",y)}},[e]);const G=F.useCallback(c=>{const w=e.current?.getBoundingClientRect(),k=c.closest("[data-annotation-content]"),A=k instanceof HTMLElement?k.getBoundingClientRect():c.getBoundingClientRect(),D=[A.width];w&&D.push(w.right-A.left);const N=D.filter(J=>Number.isFinite(J)&&J>0);return N.length>0?ze(Math.min(...N)):ze(j)},[e,j]);return O.jsxs(O.Fragment,{children:[t.map(c=>{const y=pe({type:c.id===r?"edit":"saved",draft:c}),w=$(y);if(!w)return null;const k=G(w);return c.id===r?we.createPortal(O.jsx(Me,{initialText:l,onTextChange:u,fileLabel:h,lineRange:{start:c.startLine,end:c.endLine,side:c.side==="original"?"deletions":"additions"},isEditing:!0,onSave:a,onCancel:g,maxWidth:k}),w,`draft-edit-${c.id}`):we.createPortal(O.jsx(Ke,{draft:c,onEdit:()=>m(c),onDelete:()=>S(c),maxWidth:k}),w,`draft-card-${c.id}`)}),n&&!r&&b&&(()=>{const c=$(b);if(!c)return null;const y=G(c);return we.createPortal(O.jsx(Me,{initialText:l,onTextChange:u,fileLabel:h,lineRange:n,isEditing:!1,onSave:a,onCancel:g,maxWidth:y}),c,b)})()]})}const Ie=5e5,ot=`
|
|
2
2
|
:host {
|
|
3
3
|
font-family: var(--font-mono);
|
|
4
4
|
font-size: var(--text-code);
|
|
@@ -133,4 +133,4 @@ import{R as F,j as L,b as we,r as d}from"./vendor-react-DYyjh7Q0.js";import{a as
|
|
|
133
133
|
}
|
|
134
134
|
`;function at(s){let e=2166136261;for(let t=0;t<s.length;t+=1)e^=s.charCodeAt(t),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)}function Ae(s){const e=s.length>400?`${s.slice(0,200)}${s.slice(-200)}`:s;return`${s.length}:${at(e)}`}const ct=(s,e,t,n)=>{const r=n.side==="deletions",u=(t?(r?t.deletionLines:t.additionLines).join(""):r?s:e).split(`
|
|
135
135
|
`),h=Math.min(n.start,n.end),a=Math.max(n.start,n.end),g=Math.max(1,h),m=Math.min(u.length,a);return g>m?"":u.slice(g-1,m).join(`
|
|
136
|
-
`)},dt=(s,e)=>s===e?!0:!s||!e?!1:s.start===e.start&&s.end===e.end&&s.side===e.side,ut=s=>s==="auto"||s==="scroll"||s==="overlay",ft=s=>{let e=s?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(ut(t.overflowY))return e;e=e.parentElement}return null},ht=(s,e)=>{if(!s||!e||typeof window>"u")return()=>{};const t=ft(s);if(!t)return()=>{};const n=e.getBoundingClientRect().height;if(!n)return()=>{};const r=s.getBoundingClientRect().top-t.getBoundingClientRect().top,l=e.style.minHeight;e.style.minHeight=`${Math.ceil(n)}px`;let u=!1;return()=>{if(u)return;u=!0,e.style.minHeight=l;const a=s.getBoundingClientRect().top-t.getBoundingClientRect().top-r;a&&(t.scrollTop+=a)}},pt=(s,e)=>{if(typeof window>"u")return()=>{};let t=null,n=null,r=!1;const l=()=>{r||(n?.disconnect(),n=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{r||e()})}))},u=()=>s.querySelector("diffs-container")?.shadowRoot??void 0,h=(a=u())=>!!a?.querySelector("[data-line]");return h()?l():typeof MutationObserver<"u"?(n=new MutationObserver(()=>{const a=u();if(a){if(h(a)){l();return}n?.disconnect(),n=new MutationObserver(()=>{h(a)&&l()}),n.observe(a,{childList:!0,subtree:!0})}}),n.observe(s,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(l),()=>{r=!0,n?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},fe=new WeakMap,mt={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function gt(s){const e=s.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function vt(s){if(typeof document>"u")return null;const e=gt(s);let t=fe.get(e.key);if(!t){const r=new nt;r.setup(e.root,e.content),t={virtualizer:r,refs:0},fe.set(e.key,t)}t.refs+=1;let n=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(n)return;n=!0;const r=fe.get(e.key);r&&(r.refs-=1,!(r.refs>0)&&(r.virtualizer.cleanUp(),fe.delete(e.key)))}}}const yt=(s,e,t)=>{if(typeof window>"u")return()=>{};const n=[],r=()=>{try{s.rerender()}catch{}const l=e?.root;l instanceof HTMLElement?l.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return n.push(window.requestAnimationFrame(r)),n.push(window.requestAnimationFrame(()=>{n.push(window.requestAnimationFrame(r))})),()=>{for(const l of n)window.cancelAnimationFrame(l)}},Lt=({original:s,modified:e,fileDiff:t,language:n,fileName:r,renderSideBySide:l,wrapLines:u,layout:h="fill",enableComments:a=!0})=>{const g=je(),m=g?.currentTheme.metadata.variant==="dark",S=g?.availableThemes.find(i=>i.metadata.id===g.lightThemeId)??Oe(!1),O=g?.availableThemes.find(i=>i.metadata.id===g.darkThemeId)??Oe(!0),{isMobile:B}=Ue(),j=Ye({source:"diff",fileLabel:r||"unknown",language:n,getCodeForRange:i=>ct(s,e,t,i),toStoreRange:i=>({startLine:i.start,endLine:i.end,side:i.side==="deletions"?"original":"modified"}),fromDraftRange:i=>({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"})}),{drafts:J,selection:b,setSelection:_,commentText:$,setCommentText:G,editingDraftId:c,saveComment:y,cancel:w,startEdit:k,deleteDraft:A}=j,D=d.useRef(null),N=d.useRef(null),X=d.useRef(""),ee=d.useRef(!1),oe=d.useRef(null);d.useEffect(()=>{D.current=b},[b]),d.useEffect(()=>{N.current=c},[c]),d.useEffect(()=>{X.current=$},[$]);const le=d.useCallback(i=>{if(!a||ee.current)return;const o=D.current;if(!(!i&&o&&X.current.trim())){if(B&&o&&i&&i.side===o.side){const f=Math.min(o.start,i.start),p=Math.max(o.end,i.end);_({...i,start:f,end:p})}else _(i);i&&(N.current||G(""))}},[a,B,G,_]),Fe=d.useCallback(()=>{w()},[w]),Se=d.useCallback(i=>{const o=document.createElement("div");o.style.position="relative";const f=pe(i.metadata);return o.dataset.annotationId=f,o.dataset.annotationSide=i.side,o.dataset.annotationLine=String(i.lineNumber),o},[]),_e=d.useCallback((i,o)=>{y(i,o??b??void 0)},[y,b]),We=d.useCallback(i=>{_(i);const o=P.current;if(o)try{ee.current=!0,o.setSelectedLines(i),oe.current=i}catch{}finally{ee.current=!1}},[_]),Ee=d.useCallback(i=>{const o=i.closest("[data-line-type]")?.getAttribute("data-line-type")??i.getAttribute("data-line-type");if(o==="change-deletion")return"deletions";if(o==="change-addition")return"additions";const f=i.getAttribute("data-column-side")??i.getAttribute("data-side")??i.closest("[data-column-side]")?.getAttribute("data-column-side");if(f==="deletions"||f==="left"||f==="original")return"deletions";if(f==="additions"||f==="right"||f==="modified")return"additions";const p=i.closest("[data-line-type]");if(p instanceof HTMLElement){const E=p.getBoundingClientRect(),v=i.getBoundingClientRect(),R=E.left+E.width/2;return v.left+v.width/2<R?"deletions":"additions"}return"additions"},[]);Me(S),Me(O);const Q=`${S.metadata.id}:${O.metadata.id}:${m?"dark":"light"}`,te=d.useMemo(()=>{if(t){const i=t.deletionLines.reduce((f,p)=>f+p.length,0),o=t.additionLines.reduce((f,p)=>f+p.length,0);return Math.max(i,o)>Ie}return Math.max(s.length,e.length)>Ie},[t,e.length,s.length]),ne=d.useRef(null),K=d.useRef(null),P=d.useRef(null),ie=d.useRef(null),me=d.useRef(null),ge=d.useRef(null),ve=d.useRef(void 0),ae=d.useRef(void 0),ce=d.useRef(void 0),de=d.useRef(void 0),[,ye]=F.useReducer(i=>i+1,0),Y=Qe(te?"unified":l?"split":"unified"),W=d.useMemo(()=>Le(S),[S]),q=d.useMemo(()=>Le(O),[O]);F.useLayoutEffect(()=>{const i=ne.current;if(!i)return;const o=i.querySelector("diffs-container");if(!o)return;const f=m?q:W,p=(qe,Ve)=>qe.colors?.[Ve],E=p(W,"terminal.ansiGreen"),v=p(W,"terminal.ansiRed"),R=p(W,"terminal.ansiBlue"),C=p(q,"terminal.ansiGreen"),M=p(q,"terminal.ansiRed"),z=p(q,"terminal.ansiBlue");o.style.setProperty("--shiki-light",W.fg),o.style.setProperty("--shiki-light-bg",W.bg),E&&o.style.setProperty("--shiki-light-addition-color",E),v&&o.style.setProperty("--shiki-light-deletion-color",v),R&&o.style.setProperty("--shiki-light-modified-color",R),o.style.setProperty("--shiki-dark",q.fg),o.style.setProperty("--shiki-dark-bg",q.bg),C&&o.style.setProperty("--shiki-dark-addition-color",C),M&&o.style.setProperty("--shiki-dark-deletion-color",M),z&&o.style.setProperty("--shiki-dark-modified-color",z),o.style.setProperty("--diffs-bg",f.bg),o.style.setProperty("--diffs-fg",f.fg);const x=m?C:E,V=m?M:v,Z=m?z:R;x&&o.style.setProperty("--diffs-addition-color-override",x),V&&o.style.setProperty("--diffs-deletion-color-override",V),Z&&o.style.setProperty("--diffs-modified-color-override",Z);const T=o.shadowRoot?.querySelector("pre");T&&(T.style.setProperty("--shiki-light",W.fg),T.style.setProperty("--shiki-light-bg",W.bg),E&&T.style.setProperty("--shiki-light-addition-color",E),v&&T.style.setProperty("--shiki-light-deletion-color",v),R&&T.style.setProperty("--shiki-light-modified-color",R),T.style.setProperty("--shiki-dark",q.fg),T.style.setProperty("--shiki-dark-bg",q.bg),C&&T.style.setProperty("--shiki-dark-addition-color",C),M&&T.style.setProperty("--shiki-dark-deletion-color",M),z&&T.style.setProperty("--shiki-dark-modified-color",z),T.style.setProperty("--diffs-bg",f.bg),T.style.setProperty("--diffs-fg",f.fg),x&&T.style.setProperty("--diffs-addition-color-override",x),V&&T.style.setProperty("--diffs-deletion-color-override",V),Z&&T.style.setProperty("--diffs-modified-color-override",Z))},[q,Q,m,W]);const U=d.useMemo(()=>({theme:{dark:O.metadata.id,light:S.metadata.id},themeType:m?"dark":"light",diffStyle:l?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:te?0:1e3,maxLineLengthForHighlighting:te?1:1e3,tokenizeMaxLineLength:te?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:u?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:a,enableHoverUtility:!1,onLineSelected:a?le:void 0,unsafeCSS:lt,renderAnnotation:a?Se:void 0}),[O.metadata.id,a,m,te,S.metadata.id,l,u,le,Se]),re=d.useMemo(()=>a?it({drafts:J,editingDraftId:c,selection:b}):[],[c,a,J,b]),be=d.useRef(re);if(d.useEffect(()=>{be.current=re},[re]),d.useEffect(()=>{const i=K.current;return()=>{P.current?.cleanUp(),P.current=null,ie.current?.release(),ie.current=null,me.current=null,ge.current=null,ve.current=void 0,ae.current=void 0,ce.current=void 0,de.current=void 0,i&&(i.innerHTML="")}},[]),d.useEffect(()=>{if(typeof window>"u")return;const i=K.current,o=ne.current;if(!i||!Y)return;const f=ht(o,i);let p=ie.current;p||(p=vt(i),ie.current=p),ie.current=p;const E=p?.virtualizer??null,v=t?void 0:{name:r||"",contents:s,lang:n,cacheKey:`old:${Q}:${r}:${Ae(s)}`},R=t?void 0:{name:r||"",contents:e,lang:n,cacheKey:`new:${Q}:${r}:${Ae(e)}`},C=t?ae.current!==t:ae.current!==void 0||!v||!R||!ce.current||!de.current||!Te(ce.current,v)||!Te(de.current,R),M=P.current,z=!!(M&&(me.current!==E||ge.current!==Y||E&&(ve.current!==U.hunkSeparators||C)));z&&(M?.cleanUp(),P.current=null,i.innerHTML="");let x=P.current;const V=!z&&M?!$e(M.options,U):!1;if(x?x.setOptions(U):(x=p?new Ne(U,p.virtualizer,mt,Y):new Be(U,Y),P.current=x,oe.current=null),me.current=E,ge.current=Y,ve.current=E?U.hunkSeparators:void 0,ae.current=t,ce.current=v,de.current=R,t)x.render({fileDiff:t,forceRender:V,lineAnnotations:be.current,containerWrapper:i});else{if(!v||!R)return;x.render({oldFile:v,newFile:R,forceRender:V,lineAnnotations:be.current,containerWrapper:i})}const Z=pt(i,()=>{f(),yt(x,p,ye)});return()=>{Z(),f()}},[Q,t,r,n,e,U,s,Y]),d.useEffect(()=>{const i=P.current;if(i){try{i.setLineAnnotations(re)}catch(o){console.error("Failed to apply diff line annotations",o);try{i.setLineAnnotations([])}catch{}}requestAnimationFrame(()=>{if(P.current===i){try{i.rerender()}catch{}ye()}})}},[re]),d.useEffect(()=>{const i=P.current;if(!i||b!==null)return;const o=oe.current;if(!dt(b,o))try{ee.current=!0,i.setSelectedLines(b),oe.current=b}catch{}finally{ee.current=!1}},[b]),d.useEffect(()=>{if(!a)return;const i=K.current;if(!i)return;let o=null,f=()=>{};const p=()=>{const v=i.querySelector("diffs-container")?.shadowRoot;if(!v){o=requestAnimationFrame(p);return}const R=C=>{if(!(C instanceof MouseEvent)||C.button!==0||!(C.target instanceof Element))return;const M=C.target.closest("[data-column-number]");if(!(M instanceof HTMLElement))return;const z=M.getAttribute("data-column-number"),x=z?parseInt(z,10):NaN;if(Number.isNaN(x))return;const V=Ee(M);le({start:x,end:x,side:V}),C.preventDefault(),C.stopPropagation()};v.addEventListener("click",R,!0),f=()=>{v.removeEventListener("click",R,!0)}};return p(),()=>{o!==null&&cancelAnimationFrame(o),f()}},[Q,a,r,le,Ee]),d.useEffect(()=>{const i=K.current;if(!i)return;let o=null,f=null;const E=setTimeout(()=>{const v=i.querySelector("diffs-container");if(!(v instanceof HTMLElement))return;const R=v.shadowRoot;o=new MutationObserver(()=>{f&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{ye(),f=null})}),o.observe(v,{childList:!0,subtree:!0}),R&&o.observe(R,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(E),f&&cancelAnimationFrame(f),o?.disconnect()}},[Q,r]),typeof window>"u")return null;const xe=a?L.jsx(st,{diffRootRef:ne,drafts:J,selection:b,editingDraftId:c,commentText:$,onTextChange:G,fileLabel:r?.split("/").pop()??"",onSave:_e,onCancel:Fe,onEdit:i=>{We({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"}),k(i)},onDelete:A}):null;return h==="fill"?L.jsx("div",{className:ke("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:L.jsxs("div",{className:"flex-1 relative min-h-0",children:[L.jsx(Ge,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:L.jsx("div",{ref:ne,className:"size-full relative",children:L.jsx("div",{ref:K,className:"size-full"})})}),xe]})}):L.jsxs("div",{className:ke("relative","w-full"),children:[L.jsx("div",{ref:ne,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative","data-no-drawer-swipe":"true",children:L.jsx("div",{ref:K,className:"w-full"})}),xe]})};export{Lt as P};
|
|
136
|
+
`)},dt=(s,e)=>s===e?!0:!s||!e?!1:s.start===e.start&&s.end===e.end&&s.side===e.side,ut=s=>s==="auto"||s==="scroll"||s==="overlay",ft=s=>{let e=s?.parentElement??null;for(;e;){const t=window.getComputedStyle(e);if(ut(t.overflowY))return e;e=e.parentElement}return null},ht=(s,e)=>{if(!s||!e||typeof window>"u")return()=>{};const t=ft(s);if(!t)return()=>{};const n=e.getBoundingClientRect().height;if(!n)return()=>{};const r=s.getBoundingClientRect().top-t.getBoundingClientRect().top,l=e.style.minHeight;e.style.minHeight=`${Math.ceil(n)}px`;let u=!1;return()=>{if(u)return;u=!0,e.style.minHeight=l;const a=s.getBoundingClientRect().top-t.getBoundingClientRect().top-r;a&&(t.scrollTop+=a)}},pt=(s,e)=>{if(typeof window>"u")return()=>{};let t=null,n=null,r=!1;const l=()=>{r||(n?.disconnect(),n=null,t=window.requestAnimationFrame(()=>{t=window.requestAnimationFrame(()=>{r||e()})}))},u=()=>s.querySelector("diffs-container")?.shadowRoot??void 0,h=(a=u())=>!!a?.querySelector("[data-line]");return h()?l():typeof MutationObserver<"u"?(n=new MutationObserver(()=>{const a=u();if(a){if(h(a)){l();return}n?.disconnect(),n=new MutationObserver(()=>{h(a)&&l()}),n.observe(a,{childList:!0,subtree:!0})}}),n.observe(s,{childList:!0,subtree:!0})):t=window.requestAnimationFrame(l),()=>{r=!0,n?.disconnect(),t!==null&&window.cancelAnimationFrame(t)}},fe=new WeakMap,mt={lineHeight:24,hunkSeparatorHeight:24,spacing:0};function gt(s){const e=s.closest("[data-diff-virtual-root]");if(e instanceof HTMLElement){const t=e.querySelector("[data-diff-virtual-content]");return{key:e,root:e,content:t instanceof HTMLElement?t:void 0}}return{key:document,root:document,content:void 0}}function vt(s){if(typeof document>"u")return null;const e=gt(s);let t=fe.get(e.key);if(!t){const r=new nt;r.setup(e.root,e.content),t={virtualizer:r,refs:0},fe.set(e.key,t)}t.refs+=1;let n=!1;return{virtualizer:t.virtualizer,root:e.root,release:()=>{if(n)return;n=!0;const r=fe.get(e.key);r&&(r.refs-=1,!(r.refs>0)&&(r.virtualizer.cleanUp(),fe.delete(e.key)))}}}const yt=(s,e,t)=>{if(typeof window>"u")return()=>{};const n=[],r=()=>{try{s.rerender()}catch{}const l=e?.root;l instanceof HTMLElement?l.dispatchEvent(new Event("scroll",{bubbles:!1})):document.dispatchEvent(new Event("scroll",{bubbles:!1})),window.dispatchEvent(new Event("resize")),t()};return n.push(window.requestAnimationFrame(r)),n.push(window.requestAnimationFrame(()=>{n.push(window.requestAnimationFrame(r))})),()=>{for(const l of n)window.cancelAnimationFrame(l)}},Ot=({original:s,modified:e,fileDiff:t,language:n,fileName:r,renderSideBySide:l,wrapLines:u,layout:h="fill",enableComments:a=!0})=>{const g=je(),m=g?.currentTheme.metadata.variant==="dark",S=g?.availableThemes.find(i=>i.metadata.id===g.lightThemeId)??ke(!1),L=g?.availableThemes.find(i=>i.metadata.id===g.darkThemeId)??ke(!0),{isMobile:B}=Ue(),j=Ye({source:"diff",fileLabel:r||"unknown",language:n,getCodeForRange:i=>ct(s,e,t,i),toStoreRange:i=>({startLine:i.start,endLine:i.end,side:i.side==="deletions"?"original":"modified"}),fromDraftRange:i=>({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"})}),{drafts:X,selection:b,setSelection:_,commentText:$,setCommentText:G,editingDraftId:c,saveComment:y,cancel:w,startEdit:k,deleteDraft:A}=j,D=d.useRef(null),N=d.useRef(null),J=d.useRef(""),ee=d.useRef(!1),oe=d.useRef(null);d.useEffect(()=>{D.current=b},[b]),d.useEffect(()=>{N.current=c},[c]),d.useEffect(()=>{J.current=$},[$]);const le=d.useCallback(i=>{if(!a||ee.current)return;const o=D.current;if(!(!i&&o&&J.current.trim())){if(B&&o&&i&&i.side===o.side){const f=Math.min(o.start,i.start),p=Math.max(o.end,i.end);_({...i,start:f,end:p})}else _(i);i&&(N.current||G(""))}},[a,B,G,_]),Fe=d.useCallback(()=>{w()},[w]),Se=d.useCallback(i=>{const o=document.createElement("div");o.style.position="relative";const f=pe(i.metadata);return o.dataset.annotationId=f,o.dataset.annotationSide=i.side,o.dataset.annotationLine=String(i.lineNumber),o},[]),_e=d.useCallback((i,o)=>{y(i,o??b??void 0)},[y,b]),We=d.useCallback(i=>{_(i);const o=P.current;if(o)try{ee.current=!0,o.setSelectedLines(i),oe.current=i}catch{}finally{ee.current=!1}},[_]),Ee=d.useCallback(i=>{const o=i.closest("[data-line-type]")?.getAttribute("data-line-type")??i.getAttribute("data-line-type");if(o==="change-deletion")return"deletions";if(o==="change-addition")return"additions";const f=i.getAttribute("data-column-side")??i.getAttribute("data-side")??i.closest("[data-column-side]")?.getAttribute("data-column-side");if(f==="deletions"||f==="left"||f==="original")return"deletions";if(f==="additions"||f==="right"||f==="modified")return"additions";const p=i.closest("[data-line-type]");if(p instanceof HTMLElement){const E=p.getBoundingClientRect(),v=i.getBoundingClientRect(),R=E.left+E.width/2;return v.left+v.width/2<R?"deletions":"additions"}return"additions"},[]);Oe(S),Oe(L);const Q=`${S.metadata.id}:${L.metadata.id}:${m?"dark":"light"}`,te=d.useMemo(()=>{if(t){const i=t.deletionLines.reduce((f,p)=>f+p.length,0),o=t.additionLines.reduce((f,p)=>f+p.length,0);return Math.max(i,o)>Ie}return Math.max(s.length,e.length)>Ie},[t,e.length,s.length]),ne=d.useRef(null),K=d.useRef(null),P=d.useRef(null),ie=d.useRef(null),me=d.useRef(null),ge=d.useRef(null),ve=d.useRef(void 0),ae=d.useRef(void 0),ce=d.useRef(void 0),de=d.useRef(void 0),[,ye]=F.useReducer(i=>i+1,0),Y=Qe(te?"unified":l?"split":"unified"),W=d.useMemo(()=>Le(S),[S]),q=d.useMemo(()=>Le(L),[L]);F.useLayoutEffect(()=>{const i=ne.current;if(!i)return;const o=i.querySelector("diffs-container");if(!o)return;const f=m?q:W,p=(qe,Ve)=>qe.colors?.[Ve],E=p(W,"terminal.ansiGreen"),v=p(W,"terminal.ansiRed"),R=p(W,"terminal.ansiBlue"),C=p(q,"terminal.ansiGreen"),M=p(q,"terminal.ansiRed"),z=p(q,"terminal.ansiBlue");o.style.setProperty("--shiki-light",W.fg),o.style.setProperty("--shiki-light-bg",W.bg),E&&o.style.setProperty("--shiki-light-addition-color",E),v&&o.style.setProperty("--shiki-light-deletion-color",v),R&&o.style.setProperty("--shiki-light-modified-color",R),o.style.setProperty("--shiki-dark",q.fg),o.style.setProperty("--shiki-dark-bg",q.bg),C&&o.style.setProperty("--shiki-dark-addition-color",C),M&&o.style.setProperty("--shiki-dark-deletion-color",M),z&&o.style.setProperty("--shiki-dark-modified-color",z),o.style.setProperty("--diffs-bg",f.bg),o.style.setProperty("--diffs-fg",f.fg);const x=m?C:E,V=m?M:v,Z=m?z:R;x&&o.style.setProperty("--diffs-addition-color-override",x),V&&o.style.setProperty("--diffs-deletion-color-override",V),Z&&o.style.setProperty("--diffs-modified-color-override",Z);const T=o.shadowRoot?.querySelector("pre");T&&(T.style.setProperty("--shiki-light",W.fg),T.style.setProperty("--shiki-light-bg",W.bg),E&&T.style.setProperty("--shiki-light-addition-color",E),v&&T.style.setProperty("--shiki-light-deletion-color",v),R&&T.style.setProperty("--shiki-light-modified-color",R),T.style.setProperty("--shiki-dark",q.fg),T.style.setProperty("--shiki-dark-bg",q.bg),C&&T.style.setProperty("--shiki-dark-addition-color",C),M&&T.style.setProperty("--shiki-dark-deletion-color",M),z&&T.style.setProperty("--shiki-dark-modified-color",z),T.style.setProperty("--diffs-bg",f.bg),T.style.setProperty("--diffs-fg",f.fg),x&&T.style.setProperty("--diffs-addition-color-override",x),V&&T.style.setProperty("--diffs-deletion-color-override",V),Z&&T.style.setProperty("--diffs-modified-color-override",Z))},[q,Q,m,W]);const U=d.useMemo(()=>({theme:{dark:L.metadata.id,light:S.metadata.id},themeType:m?"dark":"light",diffStyle:l?"split":"unified",diffIndicators:"none",hunkSeparators:"line-info-basic",lineDiffType:"none",maxLineDiffLength:te?0:1e3,maxLineLengthForHighlighting:te?1:1e3,tokenizeMaxLineLength:te?1:1e3,collapsedContextThreshold:0,expansionLineCount:20,overflow:u?"wrap":"scroll",disableFileHeader:!0,enableLineSelection:a,enableHoverUtility:!1,onLineSelected:a?le:void 0,unsafeCSS:lt,renderAnnotation:a?Se:void 0}),[L.metadata.id,a,m,te,S.metadata.id,l,u,le,Se]),re=d.useMemo(()=>a?it({drafts:X,editingDraftId:c,selection:b}):[],[c,a,X,b]),be=d.useRef(re);if(d.useEffect(()=>{be.current=re},[re]),d.useEffect(()=>{const i=K.current;return()=>{P.current?.cleanUp(),P.current=null,ie.current?.release(),ie.current=null,me.current=null,ge.current=null,ve.current=void 0,ae.current=void 0,ce.current=void 0,de.current=void 0,i&&(i.innerHTML="")}},[]),d.useEffect(()=>{if(typeof window>"u")return;const i=K.current,o=ne.current;if(!i||!Y)return;const f=ht(o,i);let p=ie.current;p||(p=vt(i),ie.current=p),ie.current=p;const E=p?.virtualizer??null,v=t?void 0:{name:r||"",contents:s,lang:n,cacheKey:`old:${Q}:${r}:${Ae(s)}`},R=t?void 0:{name:r||"",contents:e,lang:n,cacheKey:`new:${Q}:${r}:${Ae(e)}`},C=t?ae.current!==t:ae.current!==void 0||!v||!R||!ce.current||!de.current||!Te(ce.current,v)||!Te(de.current,R),M=P.current,z=!!(M&&(me.current!==E||ge.current!==Y||E&&(ve.current!==U.hunkSeparators||C)));z&&(M?.cleanUp(),P.current=null,i.innerHTML="");let x=P.current;const V=!z&&M?!$e(M.options,U):!1;if(x?x.setOptions(U):(x=p?new Ne(U,p.virtualizer,mt,Y):new Be(U,Y),P.current=x,oe.current=null),me.current=E,ge.current=Y,ve.current=E?U.hunkSeparators:void 0,ae.current=t,ce.current=v,de.current=R,t)x.render({fileDiff:t,forceRender:V,lineAnnotations:be.current,containerWrapper:i});else{if(!v||!R)return;x.render({oldFile:v,newFile:R,forceRender:V,lineAnnotations:be.current,containerWrapper:i})}const Z=pt(i,()=>{f(),yt(x,p,ye)});return()=>{Z(),f()}},[Q,t,r,n,e,U,s,Y]),d.useEffect(()=>{const i=P.current;if(i){try{i.setLineAnnotations(re)}catch(o){console.error("Failed to apply diff line annotations",o);try{i.setLineAnnotations([])}catch{}}requestAnimationFrame(()=>{if(P.current===i){try{i.rerender()}catch{}ye()}})}},[re]),d.useEffect(()=>{const i=P.current;if(!i||b!==null)return;const o=oe.current;if(!dt(b,o))try{ee.current=!0,i.setSelectedLines(b),oe.current=b}catch{}finally{ee.current=!1}},[b]),d.useEffect(()=>{if(!a)return;const i=K.current;if(!i)return;let o=null,f=()=>{};const p=()=>{const v=i.querySelector("diffs-container")?.shadowRoot;if(!v){o=requestAnimationFrame(p);return}const R=C=>{if(!(C instanceof MouseEvent)||C.button!==0||!(C.target instanceof Element))return;const M=C.target.closest("[data-column-number]");if(!(M instanceof HTMLElement))return;const z=M.getAttribute("data-column-number"),x=z?parseInt(z,10):NaN;if(Number.isNaN(x))return;const V=Ee(M);le({start:x,end:x,side:V}),C.preventDefault(),C.stopPropagation()};v.addEventListener("click",R,!0),f=()=>{v.removeEventListener("click",R,!0)}};return p(),()=>{o!==null&&cancelAnimationFrame(o),f()}},[Q,a,r,le,Ee]),d.useEffect(()=>{const i=K.current;if(!i)return;let o=null,f=null;const E=setTimeout(()=>{const v=i.querySelector("diffs-container");if(!(v instanceof HTMLElement))return;const R=v.shadowRoot;o=new MutationObserver(()=>{f&&cancelAnimationFrame(f),f=requestAnimationFrame(()=>{ye(),f=null})}),o.observe(v,{childList:!0,subtree:!0}),R&&o.observe(R,{childList:!0,subtree:!0})},100);return()=>{clearTimeout(E),f&&cancelAnimationFrame(f),o?.disconnect()}},[Q,r]),typeof window>"u")return null;const xe=a?O.jsx(st,{diffRootRef:ne,drafts:X,selection:b,editingDraftId:c,commentText:$,onTextChange:G,fileLabel:r?.split("/").pop()??"",onSave:_e,onCancel:Fe,onEdit:i=>{We({start:i.startLine,end:i.endLine,side:i.side==="original"?"deletions":"additions"}),k(i)},onDelete:A}):null;return h==="fill"?O.jsx("div",{className:Ce("flex flex-col relative","size-full"),"data-diff-virtual-root":!0,children:O.jsxs("div",{className:"flex-1 relative min-h-0",children:[O.jsx(Ge,{outerClassName:"pierre-diff-wrapper size-full",disableHorizontal:!1,fillContainer:!0,"data-diff-virtual-content":!0,children:O.jsx("div",{ref:ne,className:"size-full relative",children:O.jsx("div",{ref:K,className:"size-full"})})}),xe]})}):O.jsxs("div",{className:Ce("relative","w-full"),children:[O.jsx("div",{ref:ne,className:"pierre-diff-wrapper w-full overflow-x-auto overflow-y-visible relative","data-no-drawer-swipe":"true",children:O.jsx("div",{ref:K,className:"w-full"})}),xe]})};export{Ot as P};
|
package/dist/assets/{SessionSwitcherContent-BTzVmIop.js → SessionSwitcherContent-B7eep3dO.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as f,j as e}from"./vendor-react-DYyjh7Q0.js";import{
|
|
1
|
+
import{R as f,j as e}from"./vendor-react-DYyjh7Q0.js";import{g as j,I as x,h as A,i as R,r as T}from"./WindowsWindowControls-PPk5H89-.js";import{u as E}from"./useSwitcherItems-B6_F-J-z.js";import{u as M,m as v}from"./index-DU2OBBy5.js";import{a as P,S as G,f as B}from"./SessionUnreadDot-ClpeYFPz.js";import{d as y}from"./vendor-base-ui-DL8r2fgQ.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zustand-CnsBKjP5.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-vite-runtime-DD1OZmLC.js";import"./runtimeSurface-DefD-2Iv.js";import"./vendor-dnd-kit-core-GipZW2tY.js";import"./vendor-dnd-kit-utilities-CrOcp0Bp.js";import"./vendor-dnd-kit-accessibility-Cv52zwWT.js";import"./vendor-dnd-kit-sortable-Ct2QxIHb.js";import"./vendor-cmdk-BCEUzcHE.js";import"./vendor-radix-ui-react-dialog-jX3Dld8c.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D1GnwnP9.js";import"./vendor-radix-ui-react-context-CM4yFQ2I.js";import"./vendor-radix-ui-react-id-BcxRjnbX.js";import"./vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js";import"./vendor-radix-ui-react-use-controllable-state-C_ecoh35.js";import"./vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js";import"./vendor-radix-ui-react-primitive-CfpW6_IT.js";import"./vendor-radix-ui-react-slot-BxUc3Pvz.js";import"./vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js";import"./vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js";import"./vendor-radix-ui-react-focus-scope-C2K7lNPv.js";import"./vendor-radix-ui-react-portal-xlJWBfDg.js";import"./vendor-radix-ui-react-presence-Btn-Dp7L.js";import"./vendor-radix-ui-react-focus-guards-D5MZ0nQs.js";import"./vendor-react-remove-scroll-CfeMe0DL.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-C9YRs2nU.js";import"./vendor-react-style-singleton-B1H4bWSG.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-C-AuTczP.js";import"./vendor-use-callback-ref-CJB0R85I.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-E2vgV9K3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-DSzLbZiS.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-BUlYhQ3o.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BS2SpSAZ.js";import"./vendor-codemirror-lang-json-CqayksDf.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-Ba8JZ6fp.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-DK27qQri.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CvO36Y1p.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-BhBdEPsJ.js";import"./vendor-codemirror-lang-python-_2bIYTiJ.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-RrgJ8H_6.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tanstack-react-virtual-IrbCBGJ4.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-DJASDzNt.js";import"./vendor-motion-dom-DJLgZh4Q.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-sonner-CW8w438f.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-sVFnuruh.js";import"./vendor-floating-ui-dom-Bkw82kL9.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-B7OScDIw.js";function ut({onSelect:t,variant:d,scopeProjectId:c}){const o=E(!0,{scopeProjectId:c}),n=j(r=>r.openNewSessionDraft),i=M(r=>r.setActiveMainTab),a=f.useCallback(()=>{i("chat"),t(),n()},[t,n,i]),[l,u]=f.useState(new Set),m=f.useCallback(r=>{u(h=>{const p=new Set(h);return p.has(r)?p.delete(r):p.add(r),p})},[]);return e.jsx("div",{className:"max-h-[60vh] overflow-y-auto",children:e.jsxs("div",{className:"space-y-0.5",children:[e.jsxs(y,{onClick:a,className:v("group relative flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),children:[e.jsx(x,{name:"chat-new",className:"h-4 w-4 flex-shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:"New session"})]}),o.length===0?e.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:"No recent sessions"}):o.map(r=>e.jsx(C,{item:r,depth:0,variant:d,expandedParents:l,toggleParent:m,closeDropdown:t},r.node.session.id))]})})}function C({item:t,depth:d,variant:c,expandedParents:o,toggleParent:n,closeDropdown:i}){const{node:a,secondaryMeta:l}=t,u=a.session,m=a.children.length>0,r=o.has(u.id);return e.jsxs(e.Fragment,{children:[e.jsx(F,{session:u,depth:d,variant:c,secondaryMeta:l,hasChildren:m,isExpanded:r,onToggleExpand:m?()=>n(u.id):void 0,closeDropdown:i}),m&&r?a.children.map(h=>e.jsx(C,{item:{node:h,projectId:t.projectId,groupDirectory:t.groupDirectory,secondaryMeta:l},depth:d+1,variant:c,expandedParents:o,toggleParent:n,closeDropdown:i},h.session.id)):null]})}function F({session:t,depth:d,variant:c,secondaryMeta:o,hasChildren:n,isExpanded:i,onToggleExpand:a,closeDropdown:l}){const u=j(s=>s.currentSessionId),m=j(s=>s.setCurrentSession),r=A(t.id),h=R(t.id),p=u===t.id,k=t.title?.trim()||"Untitled Session",b=r?.type??"idle",g=b==="busy"||b==="retry",D=!g&&h>0&&!p,I=t.time?.updated||t.time?.created||Date.now(),L=B(I),S=o?.projectLabel?.trim()||null,w=o?.branchLabel?.trim()||null,N=w&&w!=="HEAD"?w:null,U=f.useCallback(()=>{if(p){l();return}const s=T(t);m(t.id,s??null),l()},[l,p,t,m]);return e.jsxs(y,{onClick:s=>{if(s.target?.closest("[data-switcher-expand]")){s.preventDefault();return}U()},"data-slot":"session-switcher-item",className:v("group relative flex w-full cursor-pointer items-start gap-2 rounded-lg px-2 py-1.5 outline-hidden select-none","data-[highlighted]:bg-interactive-hover hover:bg-interactive-hover"),style:{paddingLeft:8+d*12},children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[c==="compact"&&n?e.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:s=>{s.preventDefault(),s.stopPropagation(),a?.()},className:"inline-flex h-3.5 w-3.5 flex-shrink-0 items-center justify-center rounded text-muted-foreground/70 hover:text-foreground","aria-label":i?"Collapse subsessions":"Expand subsessions",children:i?e.jsx(x,{name:"arrow-down-s",className:"h-3.5 w-3.5"}):e.jsx(x,{name:"arrow-right-s",className:"h-3.5 w-3.5"})}):null,e.jsx("span",{className:"truncate typography-ui-label font-normal leading-tight text-foreground",children:k})]}),c==="default"?e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 truncate text-muted-foreground/70 leading-tight typography-micro",children:[n?e.jsx("span",{role:"button",tabIndex:-1,"data-switcher-expand":!0,onClick:s=>{s.preventDefault(),s.stopPropagation(),a?.()},className:"inline-flex h-3 w-3 flex-shrink-0 items-center justify-center rounded text-muted-foreground/70 hover:text-foreground","aria-label":i?"Collapse subsessions":"Expand subsessions",children:i?e.jsx(x,{name:"arrow-down-s",className:"h-3 w-3"}):e.jsx(x,{name:"arrow-right-s",className:"h-3 w-3"})}):null,e.jsx("span",{className:"flex-shrink-0",children:g?e.jsx(P,{sessionId:t.id,running:!0}):D?e.jsx(G,{label:"Session complete"}):L}),S?e.jsx("span",{className:"truncate",children:S}):null,N?e.jsxs("span",{className:"inline-flex min-w-0 items-center gap-0.5",children:[e.jsx(x,{name:"git-branch",className:"h-3 w-3 flex-shrink-0 text-muted-foreground/70"}),e.jsx("span",{className:"truncate",children:N})]}):null]}):null]}),g?e.jsx("span",{className:"flex h-3 w-3 flex-shrink-0 items-center justify-center self-center",children:e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-primary animate-busy-pulse","aria-label":"Session active",title:"Session active"})}):null]})}export{ut as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SessionSwitcherContent-B7eep3dO.js","assets/vendor-react-DYyjh7Q0.js","assets/vendor-scheduler-7OC5HNn7.js","assets/WindowsWindowControls-PPk5H89-.js","assets/index-DU2OBBy5.js","assets/vendor-zustand-CnsBKjP5.js","assets/vendor-clsx-B-dksMZM.js","assets/vendor-tailwind-merge-CPcsbTWB.js","assets/vendor-fuse.js-Dw8P0qyA.js","assets/index--zDkVFU6.css","assets/vendor-simplewebauthn-browser-VDA66rT_.js","assets/vendor-vite-runtime-DD1OZmLC.js","assets/vendor-base-ui-DL8r2fgQ.js","assets/vendor-floating-ui-utils-BzXdqYpP.js","assets/vendor-floating-ui-react-dom-sVFnuruh.js","assets/vendor-floating-ui-dom-Bkw82kL9.js","assets/vendor-floating-ui-core-CXmKXOXc.js","assets/vendor-use-sync-external-store-B7OScDIw.js","assets/runtimeSurface-DefD-2Iv.js","assets/vendor-dnd-kit-core-GipZW2tY.js","assets/vendor-dnd-kit-utilities-CrOcp0Bp.js","assets/vendor-dnd-kit-accessibility-Cv52zwWT.js","assets/vendor-dnd-kit-sortable-Ct2QxIHb.js","assets/vendor-cmdk-BCEUzcHE.js","assets/vendor-radix-ui-react-dialog-jX3Dld8c.js","assets/vendor-radix-ui-primitive-Dc_FVRD7.js","assets/vendor-radix-ui-react-compose-refs-D1GnwnP9.js","assets/vendor-radix-ui-react-context-CM4yFQ2I.js","assets/vendor-radix-ui-react-id-BcxRjnbX.js","assets/vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js","assets/vendor-radix-ui-react-use-controllable-state-C_ecoh35.js","assets/vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js","assets/vendor-radix-ui-react-primitive-CfpW6_IT.js","assets/vendor-radix-ui-react-slot-BxUc3Pvz.js","assets/vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js","assets/vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js","assets/vendor-radix-ui-react-focus-scope-C2K7lNPv.js","assets/vendor-radix-ui-react-portal-xlJWBfDg.js","assets/vendor-radix-ui-react-presence-Btn-Dp7L.js","assets/vendor-radix-ui-react-focus-guards-D5MZ0nQs.js","assets/vendor-react-remove-scroll-CfeMe0DL.js","assets/vendor-tslib-De9GV7Vy.js","assets/vendor-react-remove-scroll-bar-C9YRs2nU.js","assets/vendor-react-style-singleton-B1H4bWSG.js","assets/vendor-get-nonce-C-Z93AgS.js","assets/vendor-use-sidecar-C-AuTczP.js","assets/vendor-use-callback-ref-CJB0R85I.js","assets/vendor-aria-hidden-DvXkyWUv.js","assets/vendor-codemirror-language-E2vgV9K3.js","assets/vendor-lezer-common-B3-cUCR_.js","assets/vendor-codemirror-state-CNWM3Q8V.js","assets/vendor-marijn-find-cluster-break-DXwl3gUT.js","assets/vendor-codemirror-view-DSzLbZiS.js","assets/vendor-style-mod-NZ5MEPvj.js","assets/vendor-w3c-keyname-Vcq4gwWv.js","assets/vendor-crelt-C8TCjufn.js","assets/vendor-lezer-highlight-CDMHUZ74.js","assets/vendor-codemirror-lang-javascript-BUlYhQ3o.js","assets/vendor-lezer-javascript-D7Tj24ot.js","assets/vendor-lezer-lr-bhwg1HMg.js","assets/vendor-codemirror-autocomplete-BS2SpSAZ.js","assets/vendor-codemirror-lang-json-CqayksDf.js","assets/vendor-lezer-json-Iaex0UN-.js","assets/vendor-codemirror-lang-css-Ba8JZ6fp.js","assets/vendor-lezer-css-C5xB6jxd.js","assets/vendor-codemirror-lang-html-DK27qQri.js","assets/vendor-lezer-html-C0I1p52t.js","assets/vendor-codemirror-lang-markdown-CvO36Y1p.js","assets/vendor-lezer-markdown-C6g-d6P3.js","assets/vendor-codemirror-language-data-BhBdEPsJ.js","assets/vendor-codemirror-lang-python-_2bIYTiJ.js","assets/vendor-lezer-python-CvuFxeZl.js","assets/vendor-codemirror-commands-RrgJ8H_6.js","assets/vendor-class-variance-authority-5VPnzWs2.js","assets/vendor-tanstack-react-virtual-IrbCBGJ4.js","assets/vendor-tanstack-virtual-core-Dubg10g5.js","assets/vendor-framer-motion-DJASDzNt.js","assets/vendor-motion-dom-DJLgZh4Q.js","assets/vendor-motion-utils-BGh8QBgx.js","assets/vendor-sonner-CW8w438f.js","assets/useSwitcherItems-B6_F-J-z.js","assets/SessionUnreadDot-ClpeYFPz.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as a}from"./vendor-vite-runtime-DD1OZmLC.js";import{j as o,r as l,R as c}from"./vendor-react-DYyjh7Q0.js";import{al as d,am as x,an as u}from"./WindowsWindowControls-PPk5H89-.js";import{u as m,m as f}from"./index-DU2OBBy5.js";import"./vendor-scheduler-7OC5HNn7.js";import"./vendor-zustand-CnsBKjP5.js";import"./vendor-simplewebauthn-browser-VDA66rT_.js";import"./vendor-base-ui-DL8r2fgQ.js";import"./vendor-floating-ui-utils-BzXdqYpP.js";import"./vendor-floating-ui-react-dom-sVFnuruh.js";import"./vendor-floating-ui-dom-Bkw82kL9.js";import"./vendor-floating-ui-core-CXmKXOXc.js";import"./vendor-use-sync-external-store-B7OScDIw.js";import"./runtimeSurface-DefD-2Iv.js";import"./vendor-dnd-kit-core-GipZW2tY.js";import"./vendor-dnd-kit-utilities-CrOcp0Bp.js";import"./vendor-dnd-kit-accessibility-Cv52zwWT.js";import"./vendor-dnd-kit-sortable-Ct2QxIHb.js";import"./vendor-cmdk-BCEUzcHE.js";import"./vendor-radix-ui-react-dialog-jX3Dld8c.js";import"./vendor-radix-ui-primitive-Dc_FVRD7.js";import"./vendor-radix-ui-react-compose-refs-D1GnwnP9.js";import"./vendor-radix-ui-react-context-CM4yFQ2I.js";import"./vendor-radix-ui-react-id-BcxRjnbX.js";import"./vendor-radix-ui-react-use-layout-effect-0fyGwS2_.js";import"./vendor-radix-ui-react-use-controllable-state-C_ecoh35.js";import"./vendor-radix-ui-react-dismissable-layer-M7LsH3yL.js";import"./vendor-radix-ui-react-primitive-CfpW6_IT.js";import"./vendor-radix-ui-react-slot-BxUc3Pvz.js";import"./vendor-radix-ui-react-use-callback-ref-UKEWHtoP.js";import"./vendor-radix-ui-react-use-escape-keydown-Co13lHGj.js";import"./vendor-radix-ui-react-focus-scope-C2K7lNPv.js";import"./vendor-radix-ui-react-portal-xlJWBfDg.js";import"./vendor-radix-ui-react-presence-Btn-Dp7L.js";import"./vendor-radix-ui-react-focus-guards-D5MZ0nQs.js";import"./vendor-react-remove-scroll-CfeMe0DL.js";import"./vendor-tslib-De9GV7Vy.js";import"./vendor-react-remove-scroll-bar-C9YRs2nU.js";import"./vendor-react-style-singleton-B1H4bWSG.js";import"./vendor-get-nonce-C-Z93AgS.js";import"./vendor-use-sidecar-C-AuTczP.js";import"./vendor-use-callback-ref-CJB0R85I.js";import"./vendor-aria-hidden-DvXkyWUv.js";import"./vendor-codemirror-language-E2vgV9K3.js";import"./vendor-lezer-common-B3-cUCR_.js";import"./vendor-codemirror-state-CNWM3Q8V.js";import"./vendor-marijn-find-cluster-break-DXwl3gUT.js";import"./vendor-codemirror-view-DSzLbZiS.js";import"./vendor-style-mod-NZ5MEPvj.js";import"./vendor-w3c-keyname-Vcq4gwWv.js";import"./vendor-crelt-C8TCjufn.js";import"./vendor-lezer-highlight-CDMHUZ74.js";import"./vendor-codemirror-lang-javascript-BUlYhQ3o.js";import"./vendor-lezer-javascript-D7Tj24ot.js";import"./vendor-lezer-lr-bhwg1HMg.js";import"./vendor-codemirror-autocomplete-BS2SpSAZ.js";import"./vendor-codemirror-lang-json-CqayksDf.js";import"./vendor-lezer-json-Iaex0UN-.js";import"./vendor-codemirror-lang-css-Ba8JZ6fp.js";import"./vendor-lezer-css-C5xB6jxd.js";import"./vendor-codemirror-lang-html-DK27qQri.js";import"./vendor-lezer-html-C0I1p52t.js";import"./vendor-codemirror-lang-markdown-CvO36Y1p.js";import"./vendor-lezer-markdown-C6g-d6P3.js";import"./vendor-codemirror-language-data-BhBdEPsJ.js";import"./vendor-codemirror-lang-python-_2bIYTiJ.js";import"./vendor-lezer-python-CvuFxeZl.js";import"./vendor-codemirror-commands-RrgJ8H_6.js";import"./vendor-class-variance-authority-5VPnzWs2.js";import"./vendor-clsx-B-dksMZM.js";import"./vendor-tanstack-react-virtual-IrbCBGJ4.js";import"./vendor-tanstack-virtual-core-Dubg10g5.js";import"./vendor-framer-motion-DJASDzNt.js";import"./vendor-motion-dom-DJLgZh4Q.js";import"./vendor-motion-utils-BGh8QBgx.js";import"./vendor-sonner-CW8w438f.js";import"./vendor-tailwind-merge-CPcsbTWB.js";import"./vendor-fuse.js-Dw8P0qyA.js";const w=c.lazy(()=>a(()=>import("./SessionSwitcherContent-B7eep3dO.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81])));function Bo({children:e,variant:r="default",scopeProjectId:s=null,align:n="start"}){const p=m(t=>t.isSessionDropdownOpen),i=m(t=>t.setSessionDropdownOpen);return o.jsxs(d,{open:p,onOpenChange:i,modal:!1,children:[o.jsx(x,{asChild:!0,children:e}),o.jsx(u,{align:n,sideOffset:6,className:f("overflow-hidden p-1 max-w-[calc(100vw-32px)]",r==="compact"?"w-[280px]":"w-[360px]"),children:p?o.jsx(l.Suspense,{fallback:o.jsx("div",{className:"px-3 py-4 text-center typography-meta text-muted-foreground",children:"Loading…"}),children:o.jsx(w,{onSelect:()=>i(!1),variant:r,scopeProjectId:s})}):null})]})}export{Bo as SessionSwitcherDropdown};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a2 as m,m as h}from"./index-DU2OBBy5.js";import{j as g}from"./vendor-react-DYyjh7Q0.js";import{dz as D,dA as p,dB as w}from"./WindowsWindowControls-PPk5H89-.js";const _=(e,t,r)=>{const a=`${r}:`,o=new Set([...t].filter(s=>s.startsWith(a)));return e.size===o.size&&[...o].every(s=>e.has(s))?e:o},F=(e,t)=>{const r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r},b=e=>{const t=new Date(e),r=new Date,a=(n,i)=>n.getFullYear()===i.getFullYear()&&n.getMonth()===i.getMonth()&&n.getDate()===i.getDate(),o=new Date(r);return o.setDate(r.getDate()-1),a(t,r)?"Today":a(t,o)?"Yesterday":t.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}).replace(",","")},k=e=>{const t=new Date,r=new Date(e);if(((o,s)=>o.getFullYear()===s.getFullYear()&&o.getMonth()===s.getMonth()&&o.getDate()===s.getDate())(r,t)){const o=Date.now()-e;return o<6e4?"Just now":o<36e5?`${Math.floor(o/6e4)}min ago`:`${Math.floor(o/36e5)}h ago`}return b(e)},z=e=>{const t=Math.max(0,Date.now()-e),r=6e4,a=60*r,o=24*a,s=7*o,n=30*o,i=365*o;return t<a?`${Math.max(1,Math.floor(t/r))}m`:t<o?`${Math.floor(t/a)}h`:t<s?`${Math.floor(t/o)}d ago`:t<5*s?`${Math.floor(t/s)}w ago`:t<i?`${Math.floor(t/n)}mo`:`${Math.floor(t/i)}y ago`},d=e=>e.toLowerCase().replace(/[-_]/g,"").trim(),E=(e,t)=>e?d(e)!==d(t):!1,I=e=>{const t=new Map;return e.forEach(r=>{t.set(r.id,r)}),Array.from(t.values())},R=e=>`__archived__:${e}`,j=(e,t)=>{const r=m(e.directory??null),a=m(e.project?.worktree??null),o=r??a;if(!o)return"unassigned";if(t&&o===t)return"project root";const n=(t&&o.startsWith(`${t}/`)?o.slice(t.length+1):o).split("/").filter(Boolean);return n[n.length-1]??"unassigned"},B=e=>e.replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase()),U="0.75rem",M="size-4 shrink-0",y="min-w-0 truncate typography-ui-label font-normal",S=M,x=y,v="group relative my-0.5 flex w-full cursor-pointer items-center gap-1.5 rounded-xl px-3 py-2 text-left transition-colors hover:bg-interactive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",Y=v,K=e=>e?S:M,P=e=>e?x:y,u=1e3,c=60*u,l=60*c,$=e=>{const t=Math.max(0,e);return t<c?`${Math.floor(t/u)}s`:t<l?`${Math.floor(t/c)}m ${Math.floor(t%c/u)}s`:`${Math.floor(t/l)}h ${Math.floor(t%l/c)}m`},C=1e3,T=({sessionId:e,running:t,className:r})=>{const a=D(e),o=p(e),s=w(t,C),n=t?Math.max(0,s-(a??s)):o;if(n===void 0)return null;const i=$(n),f=t?`Active for ${i}`:`Last turn took ${i}`;return g.jsx("span",{className:h("shrink-0 tabular-nums",t?"text-primary":"text-[var(--status-info)]",r),"aria-label":f,title:f,children:i})};function W({label:e,className:t}){return g.jsx("span",{className:h("size-1.5 shrink-0 rounded-full bg-foreground",t),"aria-label":e,title:e})}export{W as S,T as a,K as b,P as c,k as d,I as e,z as f,R as g,M as h,y as i,v as j,E as k,U as l,B as m,_ as n,j as r,Y as s,F as t};
|