@vantran-se/openchamber-web 2.4.0 → 2.4.2
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/{AboutDialog-Dh2Z6Rpo.js → AboutDialog-Dz_8z7Rq.js} +1 -1
- package/dist/assets/{ArchiveView-31PVMzC2.js → ArchiveView-BoMjLD0N.js} +1 -1
- package/dist/assets/{ChangedPathLabel-CbXts83B.js → ChangedPathLabel-BirEUxH2.js} +1 -1
- package/dist/assets/{CommandPalette-DzOIUvyX.js → CommandPalette-DkLX-AKB.js} +1 -1
- package/dist/assets/{DiffView-C6UN20mH.js → DiffView-DwyXDHsF.js} +1 -1
- package/dist/assets/{FilesView-V9SCRZ9-.js → FilesView-BFi9HBg1.js} +1 -1
- package/dist/assets/{GitView-RJHLEROE.js → GitView-BzWRNg_F.js} +1 -1
- package/dist/assets/{GuestSurfacePane-C9dmI3Di.js → GuestSurfacePane-zDcKyz78.js} +1 -1
- package/dist/assets/{HelpDialog-DyGX9_8h.js → HelpDialog-DZVlv3x2.js} +1 -1
- package/dist/assets/{InProgressOperationBanner-B3oEOw3O.js → InProgressOperationBanner-BiEntIfh.js} +1 -1
- package/dist/assets/{IntegrationsCatalogView-CwBk0nb-.js → IntegrationsCatalogView-CCHFMcZP.js} +1 -1
- package/dist/assets/{JsonTreeView-BnV3bUfi.js → JsonTreeView-BwELoub1.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-DwFPVpAe.js → MarkdownRendererImpl-DxBYkSKd.js} +1 -1
- package/dist/assets/{MemoryDebugPanel-DwNkGEQI.js → MemoryDebugPanel-C9zpPXVo.js} +1 -1
- package/dist/assets/{OnboardingScreen-CLGQ5tGv.js → OnboardingScreen-Cnzzs_TQ.js} +1 -1
- package/dist/assets/{OpenCodeStatusDialog-D7ZnJOuR.js → OpenCodeStatusDialog-DizE9xAy.js} +1 -1
- package/dist/assets/{PatchDiff-BriSysUP.js → PatchDiff-Cz_UxB-k.js} +1 -1
- package/dist/assets/{PierreDiffViewer-ToKfUZsI.js → PierreDiffViewer-BT3MrXwN.js} +1 -1
- package/dist/assets/{PlanView-YOnwcP8k.js → PlanView-B-SCCd7M.js} +1 -1
- package/dist/assets/{ProjectActionsDialog-C3u320eT.js → ProjectActionsDialog-4OSNuzpG.js} +1 -1
- package/dist/assets/{PullRequestComparisonSelector-Cvng5foj.js → PullRequestComparisonSelector-lp98DrYm.js} +1 -1
- package/dist/assets/{RunOverview-CX4EWbX4.js → RunOverview-DJhjR9uR.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-Cg0llpjw.js → ScheduledTasksDialog-Dwil7zsx.js} +1 -1
- package/dist/assets/{SettingsView-C5MS7v4D.js → SettingsView-DVcV2Rk9.js} +1 -1
- package/dist/assets/{SettingsWindow-ZCLlBZBD.js → SettingsWindow-DbbAS4Se.js} +1 -1
- package/dist/assets/{SourceBoardView-DeQ_gjii.js → SourceBoardView-BVcmYpvE.js} +1 -1
- package/dist/assets/{SpaceAccessDialog-MzV-zdo9.js → SpaceAccessDialog-DxjFUcHZ.js} +1 -1
- package/dist/assets/{SpaceApplyDialog-DDxyMT0_.js → SpaceApplyDialog-Dbrbh-j4.js} +1 -1
- package/dist/assets/{SpaceRow-sK_fpiHu.js → SpaceRow-Cwam4mHh.js} +1 -1
- package/dist/assets/{SpaceSetupOutput-DXkmiL2Y.js → SpaceSetupOutput-B_w02jDi.js} +1 -1
- package/dist/assets/{SpacesView-DZNEvbJ7.js → SpacesView-CGrFWnO-.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-E0GcoYiO.js → SubmoduleDiffSummary-DFL-m_eu.js} +1 -1
- package/dist/assets/{ToolOutputDialog-CKl9iGaM.js → ToolOutputDialog-Co0VXa0y.js} +1 -1
- package/dist/assets/{ToolPartDiffPreview-CRANc7sQ.js → ToolPartDiffPreview-CBSzwkat.js} +1 -1
- package/dist/assets/{UsageStatsView-np-Qgyn0.js → UsageStatsView-BjtTNSt8.js} +1 -1
- package/dist/assets/{Virtualizer-CgLU97RO.js → Virtualizer-Cmng0Q1E.js} +1 -1
- package/dist/assets/{WalkthroughView-oJlQ42QA.js → WalkthroughView-C7AkVuHQ.js} +1 -1
- package/dist/assets/{WorktreesView-XC8e1Gxk.js → WorktreesView-CYU2KJ6E.js} +1 -1
- package/dist/assets/{appThemeRegistry-DsBAd3cG.js → appThemeRegistry-CDGE1wtP.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-tFBUWYu1.js → computeVirtualFileMetrics-BgqasG86.js} +1 -1
- package/dist/assets/{decorate-N1FIdwTF.js → decorate-CpxLqoVw.js} +1 -1
- package/dist/assets/{flexokiTheme-qbTuJgIP.js → flexokiTheme-BG4cSAMb.js} +1 -1
- package/dist/assets/{index-DppcIt7q.js → index-BrL960j-.js} +1 -1
- package/dist/assets/{initializeSharedPreferences-Cfgz92Al.js → initializeSharedPreferences-CrnmmfFs.js} +1 -1
- package/dist/assets/{install-iZ64WEBd.js → install-DvRQsTjX.js} +1 -1
- package/dist/assets/{isDiffPlainText-DxiX2X7Q.js → isDiffPlainText-KGYbp86N.js} +1 -1
- package/dist/assets/{isFilePlainText-y0Pch-hF.js → isFilePlainText-D7rclQrA.js} +1 -1
- package/dist/assets/{main-BggWUmia.js → main-Cmc8m6dZ.js} +4 -4
- package/dist/assets/{main-CcAbEyCv.js → main-D4-y6PQ0.js} +2 -2
- package/dist/assets/{markdownCore-P3Pd8JpY.js → markdownCore-D_5e0Wl7.js} +1 -1
- package/dist/assets/{miniChat-iJHNCDmk.js → miniChat-CjJ77DDL.js} +2 -2
- package/dist/assets/{mobile-C1tleU1e.js → mobile-DlFdLxjR.js} +2 -2
- package/dist/assets/{moveWorkspacePath-CUn1SV66.js → moveWorkspacePath-CVdEBQ6v.js} +1 -1
- package/dist/assets/{parseDiffFromFile-Phw3Q2Mh.js → parseDiffFromFile-DWemyyqU.js} +1 -1
- package/dist/assets/{pierreDiffTint-J7FoDbyq.js → pierreDiffTint-B7qPTZmL.js} +1 -1
- package/dist/assets/{relocateRestoredSession-Ch0D1a0g.js → relocateRestoredSession-cOuWlgWB.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-QPvTS_hc.js → renderElectronMiniChatApp-DFnEi5Tr.js} +2 -2
- package/dist/assets/{renderMobileApp-Ci_S1TJm.js → renderMobileApp-C2TYqVOV.js} +3 -3
- package/dist/assets/{restartOpenCode-BE2HLPm1.js → restartOpenCode-Dvk4CWW7.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DcZoNIpr.js → runtimeEndpointReset-D7viEboD.js} +3 -3
- package/dist/assets/{selectionMarkdown-Dw3ME6dV.js → selectionMarkdown-CCursbAw.js} +1 -1
- package/dist/assets/{shikiHighlight-3Hs_1ia3.js → shikiHighlight-CLj7Oan9.js} +1 -1
- package/dist/assets/{space-apply-CvoK3fqX.js → space-apply-DdhqZWNy.js} +1 -1
- package/dist/assets/{space-close-B_kflt9L.js → space-close-KXdazynX.js} +1 -1
- package/dist/assets/{spaceNetwork-ClSGQtiE.js → spaceNetwork-DzU3SK9K.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-kAREvDjp.js → textMateThemeFromAppTheme-C-jxkZJj.js} +1 -1
- package/dist/assets/{useAppFontEffects-BZrjCfFw.js → useAppFontEffects-DAUhSLPu.js} +13 -13
- package/dist/assets/{useCallableModelProviders-CpxZpJTR.js → useCallableModelProviders-B-UCRuyn.js} +1 -1
- package/dist/assets/{useDiffFindSurface-D6svD0Z1.js → useDiffFindSurface-CU_63uoI.js} +1 -1
- package/dist/assets/{useInlineCommentController-CV8dwlO7.js → useInlineCommentController-bYCeqE6r.js} +1 -1
- package/dist/assets/{useMarkdownLocalAssets-D0S_fJEu.js → useMarkdownLocalAssets-CnMxnDdI.js} +1 -1
- package/dist/assets/{useRootScrollLock-5OfQ_8IH.js → useRootScrollLock-DNYaZ34X.js} +2 -2
- package/dist/assets/{useWalkthroughReview-CxCd3Z0I.js → useWalkthroughReview-DGPyQ634.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-DsRKCbVv.js → vendor-codemirror-language-data-KulAIuMz.js} +2 -2
- package/dist/index.html +1 -1
- package/dist/mini-chat.html +1 -1
- package/dist/mobile.html +1 -1
- package/package.json +1 -1
- package/server/index.js +6 -3
- package/server/lib/guests/service-registry.js +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Z,w as y,b as nn,e as _,g as D,c as en,f as G,d as J}from"./computeVirtualFileMetrics-tFBUWYu1.js";import{eR as T,eS as U,eT as B}from"./useAppFontEffects-BZrjCfFw.js";import{d as tn,a as on}from"./vendor-diff-C3JhlQdm.js";function xn(n,e){return n?.cacheKey!=null||e?.cacheKey!=null?n?.cacheKey===e?.cacheKey:n===e}function vn(n,e){return n?.cacheKey===e?.cacheKey&&n?.contents===e?.contents&&n?.name===e?.name&&n?.lang===e?.lang}function En(n,e){return Z(n.theme,e.theme)&&n.useTokenTransformer===e.useTokenTransformer&&n.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&n.lineDiffType===e.lineDiffType&&n.maxLineDiffLength===e.maxLineDiffLength}function V({line:n,spanStart:e,spanLength:r}){return{start:{line:n,character:e},end:{line:n,character:e+r},properties:{"data-diff-span":""},alwaysWrap:!0}}function W({item:n,arr:e,enableJoin:r,isNeutral:a=!1,isLastItem:h=!1}){const i=e[e.length-1];if(i==null||h||!r){e.push([a?0:1,n.value]);return}const d=i[0]===0;if(a===d||a&&n.value.length===1&&!d){i[1]+=n.value;return}e.push([a?0:1,n.value])}function q(n){return[U(n.additionStart,n.additionCount)+1,T(n.additionStart,n.additionCount)+1]}function $({isPartial:n,rangeSize:e,expandedHunks:r,hunkIndex:a,collapsedContextThreshold:h}){const i=Math.max(e,0);if(i===0||n)return{fromStart:0,fromEnd:0,rangeSize:i,collapsedLines:i,renderAll:!1};if(r===!0||i<=h)return{fromStart:i,fromEnd:0,rangeSize:i,collapsedLines:0,renderAll:!0};const d=r?.get(a),u=Math.min(Math.max(d?.fromStart??0,0),i),t=Math.min(Math.max(d?.fromEnd??0,0),i),s=u+t,o=s>=i;return{fromStart:o?i:u,fromEnd:o?0:t,rangeSize:i,collapsedLines:Math.max(i-s,0),renderAll:o}}function wn(n){const e=n.hunks[n.hunks.length-1];if(e==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return!1;const r=n.additionLines.length-T(e.additionStart,e.additionCount),a=n.deletionLines.length-T(e.deletionStart,e.deletionCount);return r<=0&&a<=0?!1:r!==a}function rn({fileDiff:n,errorPrefix:e}){const r=n.hunks[n.hunks.length-1];if(r==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return 0;const a=n.additionLines.length-T(r.additionStart,r.additionCount),h=n.deletionLines.length-T(r.deletionStart,r.deletionCount);if(a<=0&&h<=0)return 0;if(a!==h)throw new Error(`${e}: trailing context mismatch (additions=${a}, deletions=${h}) for ${n.name}`);return Math.min(a,h)}function K({fileDiff:n,hunkIndex:e,expandedHunks:r,collapsedContextThreshold:a,errorPrefix:h}){if(e!==n.hunks.length-1)return;const i=rn({fileDiff:n,errorPrefix:h});if(i<=0)return;if(r===!0||i<=a)return{fromStart:i,fromEnd:0,rangeSize:i,collapsedLines:0,renderAll:!0};const d=r?.get(n.hunks.length),u=Math.min(Math.max(d?.fromStart??0,0),i);return{fromStart:u,fromEnd:0,rangeSize:i,collapsedLines:i-u,renderAll:u>=i}}function Rn({fileDiff:n,lineNumber:e,expandedHunks:r,collapsedContextThreshold:a}){if(r===!0||n.isPartial)return!0;for(const[u,t]of n.hunks.entries()){const[s,o]=q(t);if(e<s){const c=$({isPartial:n.isPartial,rangeSize:t.collapsedBefore,expandedHunks:r,hunkIndex:u,collapsedContextThreshold:a}),l=s-c.rangeSize;return c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd}if(e<o)return!0}const h=K({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:r,collapsedContextThreshold:a,errorPrefix:"isAdditionLineRenderable"});if(h==null||h.renderAll)return!0;const i=n.hunks[n.hunks.length-1],[,d]=q(i);return e<d+h.fromStart||e>=d+h.rangeSize}function bn({fileDiff:n,lineNumber:e,direction:r,expandedHunks:a,collapsedContextThreshold:h}){if(a===!0||n.isPartial)return e;const i=[];let d=1;for(const[t,s]of n.hunks.entries()){const[o,c]=q(s),l=$({isPartial:n.isPartial,rangeSize:s.collapsedBefore,expandedHunks:a,hunkIndex:t,collapsedContextThreshold:h}),m=o-l.rangeSize;l.renderAll?i.push([m,o]):(l.fromStart>0&&i.push([m,m+l.fromStart]),l.fromEnd>0&&i.push([o-l.fromEnd,o])),i.push([o,c]),d=c}const u=K({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:a,collapsedContextThreshold:h,errorPrefix:"getNearestRenderableAdditionLine"});if(u!=null){const t=d;d=t+u.rangeSize,u.renderAll?i.push([t,d]):u.fromStart>0&&i.push([t,t+u.fromStart])}if(e>=d)return e;if(r==="down"){for(const[t,s]of i)if(s>e)return Math.max(t,e);return}for(let t=i.length-1;t>=0;t--){const[s,o]=i[t];if(s<=e)return Math.min(o-1,e)}}function j({type:n,metrics:e}){return e.hunkSeparatorHeight??y(n)}function X({type:n,metrics:e}){return n==="simple"||n==="metadata"||n==="line-info-basic"?0:e.spacing}function sn({type:n,hunkIndex:e,hunkSpecs:r}){switch(n){case"simple":return e>0;case"metadata":return r!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function an(n){return n!=="simple"&&n!=="metadata"}function On({type:n,metrics:e,hunkIndex:r,hunkSpecs:a}){if(!sn({type:n,hunkIndex:r,hunkSpecs:a}))return;const h=j({type:n,metrics:e}),i=X({type:n,metrics:e}),d=r>0?i:0,u=i;return{height:h,gapBefore:d,gapAfter:u,totalHeight:d+h+u}}function Hn({type:n,metrics:e}){if(!an(n))return;const r=j({type:n,metrics:e}),a=X({type:n,metrics:e});return{height:r,gapBefore:a,gapAfter:0,totalHeight:a+r}}function ln({diff:n,diffStyle:e,startingLine:r=0,totalLines:a=1/0,expandedHunks:h,collapsedContextThreshold:i=1,callback:d}){const u=un({diff:n,diffStyle:e,startingLine:r,expandedHunks:h,collapsedContextThreshold:i}),t={viewportStart:r,viewportEnd:r+a,isWindowedHighlight:r>0||a<1/0,splitCount:u.splitCount,unifiedCount:u.unifiedCount,finalHunkIndex:n.hunks.length-1,shouldBreak(){if(!t.isWindowedHighlight)return!1;const s=t.unifiedCount>=r+a,o=t.splitCount>=r+a;return e==="unified"?s:(e==="split"||s)&&o},shouldSkip(s,o){if(!t.isWindowedHighlight)return!1;const c=s>0&&t.unifiedCount+s<=r,l=o>0&&t.splitCount+o<=r;return e==="unified"?c:(e==="split"||c)&&l},incrementCounts(s,o){(e==="unified"||e==="both")&&(t.unifiedCount+=s),(e==="split"||e==="both")&&(t.splitCount+=o)},isInWindow(s,o){if(!t.isWindowedHighlight)return!0;const c=t.isInUnifiedWindow(s),l=t.isInSplitWindow(o);return e==="unified"?c:e==="split"?l:c||l},isInUnifiedWindow(s){return!t.isWindowedHighlight||t.unifiedCount>=r-s&&t.unifiedCount<r+a},isInSplitWindow(s){return!t.isWindowedHighlight||t.splitCount>=r-s&&t.splitCount<r+a},emit(s,o=!1){return o||(e==="unified"?t.incrementCounts(1,0):e==="split"?t.incrementCounts(0,1):t.incrementCounts(1,1)),d(s)??!1}};n:for(let s=u.hunkIndex;s<n.hunks.length;s++){let M=function(g,H){return b==null||b.collapsedLines<=0||b.fromStart+b.fromEnd>0?0:e==="unified"?g===o.unifiedLineStart+o.unifiedLineCount-1?b.collapsedLines:0:H===o.splitLineStart+o.splitLineCount-1?b.collapsedLines:0},p=function(){return k?0:(k=!0,C.collapsedLines)};const o=n.hunks[s];if(o==null)throw new Error("iterateOverDiff: invalid hunk index");if(t.shouldBreak())break;const c=U(o.deletionStart,o.deletionCount),l=U(o.additionStart,o.additionCount),m=!n.isPartial&&o.deletionCount===0?c:o.deletionLineIndex,f=!n.isPartial&&o.additionCount===0?l:o.additionLineIndex,C=$({isPartial:n.isPartial,rangeSize:o.collapsedBefore,expandedHunks:h,hunkIndex:s,collapsedContextThreshold:i}),b=s===t.finalHunkIndex?K({fileDiff:n,hunkIndex:s,expandedHunks:h,collapsedContextThreshold:i,errorPrefix:"iterateOverDiff"}):void 0,F=C.fromStart+C.fromEnd;let k=C.collapsedLines===0;if(t.shouldSkip(F,F))t.incrementCounts(F,F),p();else{let g=o.unifiedLineStart-C.rangeSize,H=o.splitLineStart-C.rangeSize,R=m-C.rangeSize,O=f-C.rangeSize,v=c+1-C.rangeSize,P=l+1-C.rangeSize;if(A(t,C.fromStart,e,E=>t.emit({hunkIndex:s,hunk:o,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:v+E,lineIndex:R+E,noEOFCR:!1,unifiedLineIndex:g+E,splitLineIndex:H+E},additionLine:{unifiedLineIndex:g+E,splitLineIndex:H+E,lineIndex:O+E,lineNumber:P+E,noEOFCR:!1}}))||(g=o.unifiedLineStart-C.fromEnd,H=o.splitLineStart-C.fromEnd,R=m-C.fromEnd,O=f-C.fromEnd,v=c+1-C.fromEnd,P=l+1-C.fromEnd,A(t,C.fromEnd,e,E=>t.emit({hunkIndex:s,hunk:o,collapsedBefore:p(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:v+E,lineIndex:R+E,noEOFCR:!1,unifiedLineIndex:g+E,splitLineIndex:H+E},additionLine:{unifiedLineIndex:g+E,splitLineIndex:H+E,lineIndex:O+E,lineNumber:P+E,noEOFCR:!1}}),()=>{p()})))break n}let L=o.unifiedLineStart,S=o.splitLineStart,I=m,w=f,x=c+1,z=l+1;const Q=o.hunkContent.at(-1);for(const g of o.hunkContent){if(t.shouldBreak())break n;const H=g===Q;if(g.type==="context"){if(t.shouldSkip(g.lines,g.lines))t.incrementCounts(g.lines,g.lines),p();else if(A(t,g.lines,e,R=>{const O=H&&R===g.lines-1,v=L+R,P=S+R;return t.emit({hunkIndex:s,hunk:o,collapsedBefore:p(),collapsedAfter:M(v,P),type:"context",deletionLine:{lineNumber:x+R,lineIndex:I+R,noEOFCR:O&&o.noEOFCRDeletions,unifiedLineIndex:v,splitLineIndex:P},additionLine:{unifiedLineIndex:v,splitLineIndex:P,lineIndex:w+R,lineNumber:z+R,noEOFCR:O&&o.noEOFCRAdditions}})},()=>{p()}))break n;L+=g.lines,S+=g.lines,I+=g.lines,w+=g.lines,x+=g.lines,z+=g.lines}else{const R=Math.max(g.deletions,g.additions),O=g.deletions+g.additions;if(!t.shouldSkip(O,R)){const v=hn(t,g,e);(v[0]?.[0]??0)>0&&p();for(const[P,E]of v)for(let N=P;N<E;N++){const Y=M(L+N,e==="unified"?S+(N<g.deletions?N:N-g.deletions):S+N);if(t.emit(fn({hunkIndex:s,hunk:o,collapsedBefore:p(),collapsedAfter:Y,diffStyle:e,index:N,unifiedLineIndex:L,splitLineIndex:S,additionLineIndex:w,deletionLineIndex:I,additionLineNumber:z,deletionLineNumber:x,content:g,isLastContent:H,unifiedCount:O,splitCount:R}),!0))break n}}p(),t.incrementCounts(O,R),L+=O,S+=R,I+=g.deletions,w+=g.additions,x+=g.deletions,z+=g.additions}}if(b!=null){const{collapsedLines:g,fromStart:H,fromEnd:R}=b,O=H+R;if(A(t,O,e,v=>{const P=v===O-1;return t.emit({hunkIndex:n.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:P?g:0,type:"context-expanded",deletionLine:{lineNumber:x+v,lineIndex:I+v,noEOFCR:!1,unifiedLineIndex:L+v,splitLineIndex:S+v},additionLine:{unifiedLineIndex:L+v,splitLineIndex:S+v,lineIndex:w+v,lineNumber:z+v,noEOFCR:!1}})},void 0,()=>t.shouldBreak()))break n}}}function un({diff:n,diffStyle:e,startingLine:r,expandedHunks:a,collapsedContextThreshold:h}){if(r<=0||e==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const i=dn({diff:n,expandedHunks:a,collapsedContextThreshold:h});let d=0,u=n.hunks.length-1,t=n.hunks.length;for(;d<=u;){const o=d+u>>1,c=i[o+1];if(c==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(e==="unified"?c.unifiedCount:c.splitCount)>r?(t=o,u=o-1):d=o+1}if(t>=n.hunks.length){const o=i[n.hunks.length];if(o==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:n.hunks.length,splitCount:o.splitCount,unifiedCount:o.unifiedCount}}const s=i[t];if(s==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:t,splitCount:s.splitCount,unifiedCount:s.unifiedCount}}function dn({diff:n,expandedHunks:e,collapsedContextThreshold:r}){let a=0,h=0;const i=n.hunks.length-1,d=[{splitCount:0,unifiedCount:0}];for(let u=0;u<n.hunks.length;u++){const t=n.hunks[u];if(t==null)throw new Error("iterateOverDiff: invalid hunk summary index");const s=$({isPartial:n.isPartial,rangeSize:t.collapsedBefore,expandedHunks:e,hunkIndex:u,collapsedContextThreshold:r}),o=s.fromStart+s.fromEnd;a+=o+t.splitLineCount,h+=o+t.unifiedLineCount;const c=u===i?K({fileDiff:n,hunkIndex:u,expandedHunks:e,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0;if(c!=null){const l=c.fromStart+c.fromEnd;a+=l,h+=l}d.push({splitCount:a,unifiedCount:h})}return d}function cn(n,e,r){if(!n.isWindowedHighlight||e<=0)return[0,e];const a=[];function h(u){const t=Math.max(0,n.viewportStart-u),s=Math.min(e,n.viewportEnd-u);s>t&&a.push([t,s])}if(r!=="split"&&h(n.unifiedCount),r!=="unified"&&h(n.splitCount),a.length===0)return[0,0];let i=a[0][0],d=a[0][1];for(let u=1;u<a.length;u++){const t=a[u];i=Math.min(i,t[0]),d=Math.max(d,t[1])}return[i,d]}function A(n,e,r,a,h,i){const[d,u]=cn(n,e,r);d>0&&(n.incrementCounts(d,d),h?.());let t=d;for(;t<e;){if(i?.()===!0)return!0;if(t>=u){n.incrementCounts(e-t,e-t);break}if(n.isInWindow(0,0)){if(a(t)===!0)return!0}else n.incrementCounts(1,1);t++}return!1}function hn(n,e,r){if(!n.isWindowedHighlight)return[[0,r==="unified"?e.deletions+e.additions:Math.max(e.deletions,e.additions)]];const a=r!=="split",h=r!=="unified",i=r==="unified"?"unified":"split",d=[];function u(c,l){if(c+l<=n.viewportStart||c>=n.viewportEnd)return;const m=Math.max(0,n.viewportStart-c),f=Math.min(l,n.viewportEnd-c);return f>m?[m,f]:void 0}function t(c,l){return i==="split"?c:l==="additions"?[c[0]+e.deletions,c[1]+e.deletions]:c}function s(c,l){if(c==null)return;const[m,f]=t(c,l);f>m&&d.push([m,f])}if(a&&(s(u(n.unifiedCount,e.deletions),"deletions"),s(u(n.unifiedCount+e.deletions,e.additions),"additions")),h&&(s(u(n.splitCount,e.deletions),"deletions"),s(u(n.splitCount,e.additions),"additions")),d.length===0)return d;d.sort((c,l)=>c[0]-l[0]);const o=[d[0]];for(const[c,l]of d.slice(1)){const m=o[o.length-1];c<=m[1]?m[1]=Math.max(m[1],l):o.push([c,l])}return o}function fn({hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,diffStyle:h,index:i,unifiedLineIndex:d,splitLineIndex:u,additionLineIndex:t,deletionLineIndex:s,additionLineNumber:o,deletionLineNumber:c,content:l,isLastContent:m,unifiedCount:f,splitCount:C}){const b=i<l.deletions?d+i:void 0,F=h==="unified"?i>=l.deletions?d+i:void 0:i<l.additions?d+l.deletions+i:void 0,M=h==="unified"?u+(i<l.deletions?i:i-l.deletions):u+i,k=i<l.deletions?s+i:void 0,p=i<l.deletions?c+i:void 0,L=h==="unified"?i>=l.deletions?t+(i-l.deletions):void 0:i<l.additions?t+i:void 0,S=h==="unified"?i>=l.deletions?o+(i-l.deletions):void 0:i<l.additions?o+i:void 0,I=h==="unified"?m&&i===l.deletions-1&&e.noEOFCRDeletions:m&&i===C-1&&e.noEOFCRDeletions,w=h==="unified"?m&&i===f-1&&e.noEOFCRAdditions:m&&i===C-1&&e.noEOFCRAdditions,x=k!=null&&p!=null&&b!=null?{lineNumber:p,lineIndex:k,noEOFCR:I,unifiedLineIndex:b,splitLineIndex:M}:void 0,z=L!=null&&S!=null&&F!=null?{unifiedLineIndex:F,splitLineIndex:M,lineIndex:L,lineNumber:S,noEOFCR:w}:void 0;if(x==null&&z!=null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:void 0,additionLine:z};if(x!=null&&z==null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:x,additionLine:void 0};if(x==null||z==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:x,additionLine:z}}const gn={forcePlainText:!1};function zn(n,e,r,{forcePlainText:a,startingLine:h,totalLines:i,expandedHunks:d,collapsedContextThreshold:u=1}=gn){a?(h??=0,i??=1/0):(h=0,i=1/0);const t=h>0||i<1/0,s=typeof r.theme=="string"?e.getTheme(r.theme).type:void 0,o=nn({theme:r.theme,highlighter:e}),c=a&&!t&&(n.unifiedLineCount>1e3||n.splitLineCount>1e3)?"none":r.lineDiffType,l={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=r,f=!a&&!n.isPartial,C=a?d:void 0,b=new Map;function F(k){const p=f?0:k,L=b.get(p)??In();return b.set(p,L),L}function M(k,p,L,S){if(t){let I=L.at(-1);(I==null||I.targetIndex+I.count!==p)&&(I={targetIndex:p,originalOffset:S.length,count:0},L.push(I)),I.count++}S.push(k)}ln({diff:n,diffStyle:"both",startingLine:h,totalLines:i,expandedHunks:t?C:!0,collapsedContextThreshold:u,callback:({hunkIndex:k,additionLine:p,deletionLine:L,type:S})=>{const I=F(k),w=p!=null?p.splitLineIndex:L.splitLineIndex;S==="change"&&p!=null&&L!=null&&pn({additionLine:n.additionLines[p.lineIndex],deletionLine:n.deletionLines[L.lineIndex],deletionLineIndex:I.deletionContent.length,additionLineIndex:I.additionContent.length,deletionDecorations:I.deletionDecorations,additionDecorations:I.additionDecorations,lineDiffType:c,maxLineDiffLength:m}),L!=null&&(M(n.deletionLines[L.lineIndex],L.lineIndex,I.deletionSegments,I.deletionContent),I.deletionInfo.push({type:S==="change"?"change-deletion":S,lineNumber:L.lineNumber,altLineNumber:S==="change"?void 0:p.lineNumber??void 0,lineIndex:`${L.unifiedLineIndex},${w}`})),p!=null&&(M(n.additionLines[p.lineIndex],p.lineIndex,I.additionSegments,I.additionContent),I.additionInfo.push({type:S==="change"?"change-addition":S,lineNumber:p.lineNumber,altLineNumber:S==="change"?void 0:L.lineNumber??void 0,lineIndex:`${p.unifiedLineIndex},${w}`}))}});for(const k of b.values()){if(k.deletionContent.length===0&&k.additionContent.length===0)continue;const p={name:n.prevName??n.name,contents:k.deletionContent.value},L={name:n.name,contents:k.additionContent.value},{deletionLines:S,additionLines:I}=Cn({deletionFile:p,deletionInfo:k.deletionInfo,deletionDecorations:k.deletionDecorations,additionFile:L,additionInfo:k.additionInfo,additionDecorations:k.additionDecorations,highlighter:e,options:r,languageOverride:a?"text":n.lang});if(f){l.deletionLines=S,l.additionLines=I;continue}if(k.deletionSegments.length>0)for(const w of k.deletionSegments)for(let x=0;x<w.count;x++)l.deletionLines[w.targetIndex+x]=S[w.originalOffset+x];else _(l.deletionLines,S);if(k.additionSegments.length>0)for(const w of k.additionSegments)for(let x=0;x<w.count;x++)l.additionLines[w.targetIndex+x]=I[w.originalOffset+x];else _(l.additionLines,I)}return{code:l,themeStyles:o,baseThemeType:s}}function mn(n,{deletionLineIndex:e,additionLineIndex:r,deletionDecorations:a,additionDecorations:h}){let i=0,d=0,u=-1,t=0,s=-1,o=0;for(const{value:c,added:l,removed:m}of n)m?(u===-1&&(u=i),i+=c.length,t=i):l?(s===-1&&(s=d),d+=c.length,o=d):(i+=c.length,d+=c.length);u!==-1&&a.push(V({line:e,spanStart:u,spanLength:t-u})),s!==-1&&h.push(V({line:r,spanStart:s,spanLength:o-s}))}function pn({deletionLine:n,additionLine:e,deletionLineIndex:r,additionLineIndex:a,deletionDecorations:h,additionDecorations:i,lineDiffType:d,maxLineDiffLength:u}){if(n==null||e==null||d==="none"||(n=B(n),e=B(e),n.length>u||e.length>u))return;const t=d==="char"?tn(n,e):on(n,e);if(d==="word-line"){mn(t,{deletionLineIndex:r,additionLineIndex:a,deletionDecorations:h,additionDecorations:i});return}const s=[],o=[],c=d==="word-alt",l=t.at(-1);for(const f of t){const C=f===l;!f.added&&!f.removed?(W({item:f,arr:s,enableJoin:c,isNeutral:!0,isLastItem:C}),W({item:f,arr:o,enableJoin:c,isNeutral:!0,isLastItem:C})):f.removed?W({item:f,arr:s,enableJoin:c,isLastItem:C}):W({item:f,arr:o,enableJoin:c,isLastItem:C})}let m=0;for(const f of s)f[0]===1&&h.push(V({line:r,spanStart:m,spanLength:f[1].length})),m+=f[1].length;m=0;for(const f of o)f[0]===1&&i.push(V({line:a,spanStart:m,spanLength:f[1].length})),m+=f[1].length}function In(){return{deletionContent:{push(n){this.value+=n,this.length++},value:"",length:0},additionContent:{push(n){this.value+=n,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Cn({deletionFile:n,additionFile:e,deletionInfo:r,additionInfo:a,highlighter:h,deletionDecorations:i,additionDecorations:d,languageOverride:u,options:{theme:t,...s}}){const o=u??D(n.name),c=u??D(e.name),{state:l,transformers:m}=en(s.useTokenTransformer),f=typeof t=="string"?{...s,lang:"text",theme:t,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:G("token"),tokenizeTimeLimit:0}:{...s,lang:"text",themes:t,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:G("token"),tokenizeTimeLimit:0};return{deletionLines:n.contents===""?[]:(f.lang=o,l.lineInfo=r,f.decorations=i,J(h.codeToHast(B(n.contents),f))),additionLines:e.contents===""?[]:(f.lang=c,f.decorations=d,l.lineInfo=a,J(h.codeToHast(B(e.contents),f)))}}function Pn(n){const e=n.lang??D(n.name),r=n.lang??(n.prevName!=null?D(n.prevName):"text");return e==="text"&&r==="text"}export{xn as a,En as b,vn as c,K as d,ln as e,rn as f,$ as g,wn as h,Pn as i,Rn as j,bn as k,q as l,On as m,Hn as n,zn as r};
|
|
1
|
+
import{a as Z,w as y,b as nn,e as _,g as D,c as en,f as G,d as J}from"./computeVirtualFileMetrics-BgqasG86.js";import{eR as T,eS as U,eT as B}from"./useAppFontEffects-DAUhSLPu.js";import{d as tn,a as on}from"./vendor-diff-C3JhlQdm.js";function xn(n,e){return n?.cacheKey!=null||e?.cacheKey!=null?n?.cacheKey===e?.cacheKey:n===e}function vn(n,e){return n?.cacheKey===e?.cacheKey&&n?.contents===e?.contents&&n?.name===e?.name&&n?.lang===e?.lang}function En(n,e){return Z(n.theme,e.theme)&&n.useTokenTransformer===e.useTokenTransformer&&n.tokenizeMaxLineLength===e.tokenizeMaxLineLength&&n.lineDiffType===e.lineDiffType&&n.maxLineDiffLength===e.maxLineDiffLength}function V({line:n,spanStart:e,spanLength:r}){return{start:{line:n,character:e},end:{line:n,character:e+r},properties:{"data-diff-span":""},alwaysWrap:!0}}function W({item:n,arr:e,enableJoin:r,isNeutral:a=!1,isLastItem:h=!1}){const i=e[e.length-1];if(i==null||h||!r){e.push([a?0:1,n.value]);return}const d=i[0]===0;if(a===d||a&&n.value.length===1&&!d){i[1]+=n.value;return}e.push([a?0:1,n.value])}function q(n){return[U(n.additionStart,n.additionCount)+1,T(n.additionStart,n.additionCount)+1]}function $({isPartial:n,rangeSize:e,expandedHunks:r,hunkIndex:a,collapsedContextThreshold:h}){const i=Math.max(e,0);if(i===0||n)return{fromStart:0,fromEnd:0,rangeSize:i,collapsedLines:i,renderAll:!1};if(r===!0||i<=h)return{fromStart:i,fromEnd:0,rangeSize:i,collapsedLines:0,renderAll:!0};const d=r?.get(a),u=Math.min(Math.max(d?.fromStart??0,0),i),t=Math.min(Math.max(d?.fromEnd??0,0),i),s=u+t,o=s>=i;return{fromStart:o?i:u,fromEnd:o?0:t,rangeSize:i,collapsedLines:Math.max(i-s,0),renderAll:o}}function wn(n){const e=n.hunks[n.hunks.length-1];if(e==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return!1;const r=n.additionLines.length-T(e.additionStart,e.additionCount),a=n.deletionLines.length-T(e.deletionStart,e.deletionCount);return r<=0&&a<=0?!1:r!==a}function rn({fileDiff:n,errorPrefix:e}){const r=n.hunks[n.hunks.length-1];if(r==null||n.isPartial||n.additionLines.length===0||n.deletionLines.length===0)return 0;const a=n.additionLines.length-T(r.additionStart,r.additionCount),h=n.deletionLines.length-T(r.deletionStart,r.deletionCount);if(a<=0&&h<=0)return 0;if(a!==h)throw new Error(`${e}: trailing context mismatch (additions=${a}, deletions=${h}) for ${n.name}`);return Math.min(a,h)}function K({fileDiff:n,hunkIndex:e,expandedHunks:r,collapsedContextThreshold:a,errorPrefix:h}){if(e!==n.hunks.length-1)return;const i=rn({fileDiff:n,errorPrefix:h});if(i<=0)return;if(r===!0||i<=a)return{fromStart:i,fromEnd:0,rangeSize:i,collapsedLines:0,renderAll:!0};const d=r?.get(n.hunks.length),u=Math.min(Math.max(d?.fromStart??0,0),i);return{fromStart:u,fromEnd:0,rangeSize:i,collapsedLines:i-u,renderAll:u>=i}}function Rn({fileDiff:n,lineNumber:e,expandedHunks:r,collapsedContextThreshold:a}){if(r===!0||n.isPartial)return!0;for(const[u,t]of n.hunks.entries()){const[s,o]=q(t);if(e<s){const c=$({isPartial:n.isPartial,rangeSize:t.collapsedBefore,expandedHunks:r,hunkIndex:u,collapsedContextThreshold:a}),l=s-c.rangeSize;return c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd}if(e<o)return!0}const h=K({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:r,collapsedContextThreshold:a,errorPrefix:"isAdditionLineRenderable"});if(h==null||h.renderAll)return!0;const i=n.hunks[n.hunks.length-1],[,d]=q(i);return e<d+h.fromStart||e>=d+h.rangeSize}function bn({fileDiff:n,lineNumber:e,direction:r,expandedHunks:a,collapsedContextThreshold:h}){if(a===!0||n.isPartial)return e;const i=[];let d=1;for(const[t,s]of n.hunks.entries()){const[o,c]=q(s),l=$({isPartial:n.isPartial,rangeSize:s.collapsedBefore,expandedHunks:a,hunkIndex:t,collapsedContextThreshold:h}),m=o-l.rangeSize;l.renderAll?i.push([m,o]):(l.fromStart>0&&i.push([m,m+l.fromStart]),l.fromEnd>0&&i.push([o-l.fromEnd,o])),i.push([o,c]),d=c}const u=K({fileDiff:n,hunkIndex:n.hunks.length-1,expandedHunks:a,collapsedContextThreshold:h,errorPrefix:"getNearestRenderableAdditionLine"});if(u!=null){const t=d;d=t+u.rangeSize,u.renderAll?i.push([t,d]):u.fromStart>0&&i.push([t,t+u.fromStart])}if(e>=d)return e;if(r==="down"){for(const[t,s]of i)if(s>e)return Math.max(t,e);return}for(let t=i.length-1;t>=0;t--){const[s,o]=i[t];if(s<=e)return Math.min(o-1,e)}}function j({type:n,metrics:e}){return e.hunkSeparatorHeight??y(n)}function X({type:n,metrics:e}){return n==="simple"||n==="metadata"||n==="line-info-basic"?0:e.spacing}function sn({type:n,hunkIndex:e,hunkSpecs:r}){switch(n){case"simple":return e>0;case"metadata":return r!=null;case"line-info":case"line-info-basic":case"custom":return!0}}function an(n){return n!=="simple"&&n!=="metadata"}function On({type:n,metrics:e,hunkIndex:r,hunkSpecs:a}){if(!sn({type:n,hunkIndex:r,hunkSpecs:a}))return;const h=j({type:n,metrics:e}),i=X({type:n,metrics:e}),d=r>0?i:0,u=i;return{height:h,gapBefore:d,gapAfter:u,totalHeight:d+h+u}}function Hn({type:n,metrics:e}){if(!an(n))return;const r=j({type:n,metrics:e}),a=X({type:n,metrics:e});return{height:r,gapBefore:a,gapAfter:0,totalHeight:a+r}}function ln({diff:n,diffStyle:e,startingLine:r=0,totalLines:a=1/0,expandedHunks:h,collapsedContextThreshold:i=1,callback:d}){const u=un({diff:n,diffStyle:e,startingLine:r,expandedHunks:h,collapsedContextThreshold:i}),t={viewportStart:r,viewportEnd:r+a,isWindowedHighlight:r>0||a<1/0,splitCount:u.splitCount,unifiedCount:u.unifiedCount,finalHunkIndex:n.hunks.length-1,shouldBreak(){if(!t.isWindowedHighlight)return!1;const s=t.unifiedCount>=r+a,o=t.splitCount>=r+a;return e==="unified"?s:(e==="split"||s)&&o},shouldSkip(s,o){if(!t.isWindowedHighlight)return!1;const c=s>0&&t.unifiedCount+s<=r,l=o>0&&t.splitCount+o<=r;return e==="unified"?c:(e==="split"||c)&&l},incrementCounts(s,o){(e==="unified"||e==="both")&&(t.unifiedCount+=s),(e==="split"||e==="both")&&(t.splitCount+=o)},isInWindow(s,o){if(!t.isWindowedHighlight)return!0;const c=t.isInUnifiedWindow(s),l=t.isInSplitWindow(o);return e==="unified"?c:e==="split"?l:c||l},isInUnifiedWindow(s){return!t.isWindowedHighlight||t.unifiedCount>=r-s&&t.unifiedCount<r+a},isInSplitWindow(s){return!t.isWindowedHighlight||t.splitCount>=r-s&&t.splitCount<r+a},emit(s,o=!1){return o||(e==="unified"?t.incrementCounts(1,0):e==="split"?t.incrementCounts(0,1):t.incrementCounts(1,1)),d(s)??!1}};n:for(let s=u.hunkIndex;s<n.hunks.length;s++){let M=function(g,H){return b==null||b.collapsedLines<=0||b.fromStart+b.fromEnd>0?0:e==="unified"?g===o.unifiedLineStart+o.unifiedLineCount-1?b.collapsedLines:0:H===o.splitLineStart+o.splitLineCount-1?b.collapsedLines:0},p=function(){return k?0:(k=!0,C.collapsedLines)};const o=n.hunks[s];if(o==null)throw new Error("iterateOverDiff: invalid hunk index");if(t.shouldBreak())break;const c=U(o.deletionStart,o.deletionCount),l=U(o.additionStart,o.additionCount),m=!n.isPartial&&o.deletionCount===0?c:o.deletionLineIndex,f=!n.isPartial&&o.additionCount===0?l:o.additionLineIndex,C=$({isPartial:n.isPartial,rangeSize:o.collapsedBefore,expandedHunks:h,hunkIndex:s,collapsedContextThreshold:i}),b=s===t.finalHunkIndex?K({fileDiff:n,hunkIndex:s,expandedHunks:h,collapsedContextThreshold:i,errorPrefix:"iterateOverDiff"}):void 0,F=C.fromStart+C.fromEnd;let k=C.collapsedLines===0;if(t.shouldSkip(F,F))t.incrementCounts(F,F),p();else{let g=o.unifiedLineStart-C.rangeSize,H=o.splitLineStart-C.rangeSize,R=m-C.rangeSize,O=f-C.rangeSize,v=c+1-C.rangeSize,P=l+1-C.rangeSize;if(A(t,C.fromStart,e,E=>t.emit({hunkIndex:s,hunk:o,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:v+E,lineIndex:R+E,noEOFCR:!1,unifiedLineIndex:g+E,splitLineIndex:H+E},additionLine:{unifiedLineIndex:g+E,splitLineIndex:H+E,lineIndex:O+E,lineNumber:P+E,noEOFCR:!1}}))||(g=o.unifiedLineStart-C.fromEnd,H=o.splitLineStart-C.fromEnd,R=m-C.fromEnd,O=f-C.fromEnd,v=c+1-C.fromEnd,P=l+1-C.fromEnd,A(t,C.fromEnd,e,E=>t.emit({hunkIndex:s,hunk:o,collapsedBefore:p(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:v+E,lineIndex:R+E,noEOFCR:!1,unifiedLineIndex:g+E,splitLineIndex:H+E},additionLine:{unifiedLineIndex:g+E,splitLineIndex:H+E,lineIndex:O+E,lineNumber:P+E,noEOFCR:!1}}),()=>{p()})))break n}let L=o.unifiedLineStart,S=o.splitLineStart,I=m,w=f,x=c+1,z=l+1;const Q=o.hunkContent.at(-1);for(const g of o.hunkContent){if(t.shouldBreak())break n;const H=g===Q;if(g.type==="context"){if(t.shouldSkip(g.lines,g.lines))t.incrementCounts(g.lines,g.lines),p();else if(A(t,g.lines,e,R=>{const O=H&&R===g.lines-1,v=L+R,P=S+R;return t.emit({hunkIndex:s,hunk:o,collapsedBefore:p(),collapsedAfter:M(v,P),type:"context",deletionLine:{lineNumber:x+R,lineIndex:I+R,noEOFCR:O&&o.noEOFCRDeletions,unifiedLineIndex:v,splitLineIndex:P},additionLine:{unifiedLineIndex:v,splitLineIndex:P,lineIndex:w+R,lineNumber:z+R,noEOFCR:O&&o.noEOFCRAdditions}})},()=>{p()}))break n;L+=g.lines,S+=g.lines,I+=g.lines,w+=g.lines,x+=g.lines,z+=g.lines}else{const R=Math.max(g.deletions,g.additions),O=g.deletions+g.additions;if(!t.shouldSkip(O,R)){const v=hn(t,g,e);(v[0]?.[0]??0)>0&&p();for(const[P,E]of v)for(let N=P;N<E;N++){const Y=M(L+N,e==="unified"?S+(N<g.deletions?N:N-g.deletions):S+N);if(t.emit(fn({hunkIndex:s,hunk:o,collapsedBefore:p(),collapsedAfter:Y,diffStyle:e,index:N,unifiedLineIndex:L,splitLineIndex:S,additionLineIndex:w,deletionLineIndex:I,additionLineNumber:z,deletionLineNumber:x,content:g,isLastContent:H,unifiedCount:O,splitCount:R}),!0))break n}}p(),t.incrementCounts(O,R),L+=O,S+=R,I+=g.deletions,w+=g.additions,x+=g.deletions,z+=g.additions}}if(b!=null){const{collapsedLines:g,fromStart:H,fromEnd:R}=b,O=H+R;if(A(t,O,e,v=>{const P=v===O-1;return t.emit({hunkIndex:n.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:P?g:0,type:"context-expanded",deletionLine:{lineNumber:x+v,lineIndex:I+v,noEOFCR:!1,unifiedLineIndex:L+v,splitLineIndex:S+v},additionLine:{unifiedLineIndex:L+v,splitLineIndex:S+v,lineIndex:w+v,lineNumber:z+v,noEOFCR:!1}})},void 0,()=>t.shouldBreak()))break n}}}function un({diff:n,diffStyle:e,startingLine:r,expandedHunks:a,collapsedContextThreshold:h}){if(r<=0||e==="both")return{hunkIndex:0,splitCount:0,unifiedCount:0};const i=dn({diff:n,expandedHunks:a,collapsedContextThreshold:h});let d=0,u=n.hunks.length-1,t=n.hunks.length;for(;d<=u;){const o=d+u>>1,c=i[o+1];if(c==null)throw new Error("iterateOverDiff: invalid hunk prefix index");(e==="unified"?c.unifiedCount:c.splitCount)>r?(t=o,u=o-1):d=o+1}if(t>=n.hunks.length){const o=i[n.hunks.length];if(o==null)throw new Error("iterateOverDiff: invalid terminal hunk prefix index");return{hunkIndex:n.hunks.length,splitCount:o.splitCount,unifiedCount:o.unifiedCount}}const s=i[t];if(s==null)throw new Error("iterateOverDiff: invalid selected hunk prefix index");return{hunkIndex:t,splitCount:s.splitCount,unifiedCount:s.unifiedCount}}function dn({diff:n,expandedHunks:e,collapsedContextThreshold:r}){let a=0,h=0;const i=n.hunks.length-1,d=[{splitCount:0,unifiedCount:0}];for(let u=0;u<n.hunks.length;u++){const t=n.hunks[u];if(t==null)throw new Error("iterateOverDiff: invalid hunk summary index");const s=$({isPartial:n.isPartial,rangeSize:t.collapsedBefore,expandedHunks:e,hunkIndex:u,collapsedContextThreshold:r}),o=s.fromStart+s.fromEnd;a+=o+t.splitLineCount,h+=o+t.unifiedLineCount;const c=u===i?K({fileDiff:n,hunkIndex:u,expandedHunks:e,collapsedContextThreshold:r,errorPrefix:"iterateOverDiff"}):void 0;if(c!=null){const l=c.fromStart+c.fromEnd;a+=l,h+=l}d.push({splitCount:a,unifiedCount:h})}return d}function cn(n,e,r){if(!n.isWindowedHighlight||e<=0)return[0,e];const a=[];function h(u){const t=Math.max(0,n.viewportStart-u),s=Math.min(e,n.viewportEnd-u);s>t&&a.push([t,s])}if(r!=="split"&&h(n.unifiedCount),r!=="unified"&&h(n.splitCount),a.length===0)return[0,0];let i=a[0][0],d=a[0][1];for(let u=1;u<a.length;u++){const t=a[u];i=Math.min(i,t[0]),d=Math.max(d,t[1])}return[i,d]}function A(n,e,r,a,h,i){const[d,u]=cn(n,e,r);d>0&&(n.incrementCounts(d,d),h?.());let t=d;for(;t<e;){if(i?.()===!0)return!0;if(t>=u){n.incrementCounts(e-t,e-t);break}if(n.isInWindow(0,0)){if(a(t)===!0)return!0}else n.incrementCounts(1,1);t++}return!1}function hn(n,e,r){if(!n.isWindowedHighlight)return[[0,r==="unified"?e.deletions+e.additions:Math.max(e.deletions,e.additions)]];const a=r!=="split",h=r!=="unified",i=r==="unified"?"unified":"split",d=[];function u(c,l){if(c+l<=n.viewportStart||c>=n.viewportEnd)return;const m=Math.max(0,n.viewportStart-c),f=Math.min(l,n.viewportEnd-c);return f>m?[m,f]:void 0}function t(c,l){return i==="split"?c:l==="additions"?[c[0]+e.deletions,c[1]+e.deletions]:c}function s(c,l){if(c==null)return;const[m,f]=t(c,l);f>m&&d.push([m,f])}if(a&&(s(u(n.unifiedCount,e.deletions),"deletions"),s(u(n.unifiedCount+e.deletions,e.additions),"additions")),h&&(s(u(n.splitCount,e.deletions),"deletions"),s(u(n.splitCount,e.additions),"additions")),d.length===0)return d;d.sort((c,l)=>c[0]-l[0]);const o=[d[0]];for(const[c,l]of d.slice(1)){const m=o[o.length-1];c<=m[1]?m[1]=Math.max(m[1],l):o.push([c,l])}return o}function fn({hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,diffStyle:h,index:i,unifiedLineIndex:d,splitLineIndex:u,additionLineIndex:t,deletionLineIndex:s,additionLineNumber:o,deletionLineNumber:c,content:l,isLastContent:m,unifiedCount:f,splitCount:C}){const b=i<l.deletions?d+i:void 0,F=h==="unified"?i>=l.deletions?d+i:void 0:i<l.additions?d+l.deletions+i:void 0,M=h==="unified"?u+(i<l.deletions?i:i-l.deletions):u+i,k=i<l.deletions?s+i:void 0,p=i<l.deletions?c+i:void 0,L=h==="unified"?i>=l.deletions?t+(i-l.deletions):void 0:i<l.additions?t+i:void 0,S=h==="unified"?i>=l.deletions?o+(i-l.deletions):void 0:i<l.additions?o+i:void 0,I=h==="unified"?m&&i===l.deletions-1&&e.noEOFCRDeletions:m&&i===C-1&&e.noEOFCRDeletions,w=h==="unified"?m&&i===f-1&&e.noEOFCRAdditions:m&&i===C-1&&e.noEOFCRAdditions,x=k!=null&&p!=null&&b!=null?{lineNumber:p,lineIndex:k,noEOFCR:I,unifiedLineIndex:b,splitLineIndex:M}:void 0,z=L!=null&&S!=null&&F!=null?{unifiedLineIndex:F,splitLineIndex:M,lineIndex:L,lineNumber:S,noEOFCR:w}:void 0;if(x==null&&z!=null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:void 0,additionLine:z};if(x!=null&&z==null)return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:x,additionLine:void 0};if(x==null||z==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:n,hunk:e,collapsedAfter:r,collapsedBefore:a,deletionLine:x,additionLine:z}}const gn={forcePlainText:!1};function zn(n,e,r,{forcePlainText:a,startingLine:h,totalLines:i,expandedHunks:d,collapsedContextThreshold:u=1}=gn){a?(h??=0,i??=1/0):(h=0,i=1/0);const t=h>0||i<1/0,s=typeof r.theme=="string"?e.getTheme(r.theme).type:void 0,o=nn({theme:r.theme,highlighter:e}),c=a&&!t&&(n.unifiedLineCount>1e3||n.splitLineCount>1e3)?"none":r.lineDiffType,l={deletionLines:[],additionLines:[]},{maxLineDiffLength:m}=r,f=!a&&!n.isPartial,C=a?d:void 0,b=new Map;function F(k){const p=f?0:k,L=b.get(p)??In();return b.set(p,L),L}function M(k,p,L,S){if(t){let I=L.at(-1);(I==null||I.targetIndex+I.count!==p)&&(I={targetIndex:p,originalOffset:S.length,count:0},L.push(I)),I.count++}S.push(k)}ln({diff:n,diffStyle:"both",startingLine:h,totalLines:i,expandedHunks:t?C:!0,collapsedContextThreshold:u,callback:({hunkIndex:k,additionLine:p,deletionLine:L,type:S})=>{const I=F(k),w=p!=null?p.splitLineIndex:L.splitLineIndex;S==="change"&&p!=null&&L!=null&&pn({additionLine:n.additionLines[p.lineIndex],deletionLine:n.deletionLines[L.lineIndex],deletionLineIndex:I.deletionContent.length,additionLineIndex:I.additionContent.length,deletionDecorations:I.deletionDecorations,additionDecorations:I.additionDecorations,lineDiffType:c,maxLineDiffLength:m}),L!=null&&(M(n.deletionLines[L.lineIndex],L.lineIndex,I.deletionSegments,I.deletionContent),I.deletionInfo.push({type:S==="change"?"change-deletion":S,lineNumber:L.lineNumber,altLineNumber:S==="change"?void 0:p.lineNumber??void 0,lineIndex:`${L.unifiedLineIndex},${w}`})),p!=null&&(M(n.additionLines[p.lineIndex],p.lineIndex,I.additionSegments,I.additionContent),I.additionInfo.push({type:S==="change"?"change-addition":S,lineNumber:p.lineNumber,altLineNumber:S==="change"?void 0:L.lineNumber??void 0,lineIndex:`${p.unifiedLineIndex},${w}`}))}});for(const k of b.values()){if(k.deletionContent.length===0&&k.additionContent.length===0)continue;const p={name:n.prevName??n.name,contents:k.deletionContent.value},L={name:n.name,contents:k.additionContent.value},{deletionLines:S,additionLines:I}=Cn({deletionFile:p,deletionInfo:k.deletionInfo,deletionDecorations:k.deletionDecorations,additionFile:L,additionInfo:k.additionInfo,additionDecorations:k.additionDecorations,highlighter:e,options:r,languageOverride:a?"text":n.lang});if(f){l.deletionLines=S,l.additionLines=I;continue}if(k.deletionSegments.length>0)for(const w of k.deletionSegments)for(let x=0;x<w.count;x++)l.deletionLines[w.targetIndex+x]=S[w.originalOffset+x];else _(l.deletionLines,S);if(k.additionSegments.length>0)for(const w of k.additionSegments)for(let x=0;x<w.count;x++)l.additionLines[w.targetIndex+x]=I[w.originalOffset+x];else _(l.additionLines,I)}return{code:l,themeStyles:o,baseThemeType:s}}function mn(n,{deletionLineIndex:e,additionLineIndex:r,deletionDecorations:a,additionDecorations:h}){let i=0,d=0,u=-1,t=0,s=-1,o=0;for(const{value:c,added:l,removed:m}of n)m?(u===-1&&(u=i),i+=c.length,t=i):l?(s===-1&&(s=d),d+=c.length,o=d):(i+=c.length,d+=c.length);u!==-1&&a.push(V({line:e,spanStart:u,spanLength:t-u})),s!==-1&&h.push(V({line:r,spanStart:s,spanLength:o-s}))}function pn({deletionLine:n,additionLine:e,deletionLineIndex:r,additionLineIndex:a,deletionDecorations:h,additionDecorations:i,lineDiffType:d,maxLineDiffLength:u}){if(n==null||e==null||d==="none"||(n=B(n),e=B(e),n.length>u||e.length>u))return;const t=d==="char"?tn(n,e):on(n,e);if(d==="word-line"){mn(t,{deletionLineIndex:r,additionLineIndex:a,deletionDecorations:h,additionDecorations:i});return}const s=[],o=[],c=d==="word-alt",l=t.at(-1);for(const f of t){const C=f===l;!f.added&&!f.removed?(W({item:f,arr:s,enableJoin:c,isNeutral:!0,isLastItem:C}),W({item:f,arr:o,enableJoin:c,isNeutral:!0,isLastItem:C})):f.removed?W({item:f,arr:s,enableJoin:c,isLastItem:C}):W({item:f,arr:o,enableJoin:c,isLastItem:C})}let m=0;for(const f of s)f[0]===1&&h.push(V({line:r,spanStart:m,spanLength:f[1].length})),m+=f[1].length;m=0;for(const f of o)f[0]===1&&i.push(V({line:a,spanStart:m,spanLength:f[1].length})),m+=f[1].length}function In(){return{deletionContent:{push(n){this.value+=n,this.length++},value:"",length:0},additionContent:{push(n){this.value+=n,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Cn({deletionFile:n,additionFile:e,deletionInfo:r,additionInfo:a,highlighter:h,deletionDecorations:i,additionDecorations:d,languageOverride:u,options:{theme:t,...s}}){const o=u??D(n.name),c=u??D(e.name),{state:l,transformers:m}=en(s.useTokenTransformer),f=typeof t=="string"?{...s,lang:"text",theme:t,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:G("token"),tokenizeTimeLimit:0}:{...s,lang:"text",themes:t,transformers:m,decorations:void 0,defaultColor:!1,cssVariablePrefix:G("token"),tokenizeTimeLimit:0};return{deletionLines:n.contents===""?[]:(f.lang=o,l.lineInfo=r,f.decorations=i,J(h.codeToHast(B(n.contents),f))),additionLines:e.contents===""?[]:(f.lang=c,f.decorations=d,l.lineInfo=a,J(h.codeToHast(B(e.contents),f)))}}function Pn(n){const e=n.lang??D(n.name),r=n.lang??(n.prevName!=null?D(n.prevName):"text");return e==="text"&&r==="text"}export{xn as a,En as b,vn as c,K as d,ln as e,rn as f,$ as g,wn as h,Pn as i,Rn as j,bn as k,q as l,On as m,Hn as n,zn as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as p}from"./themeResolver-yJ9XpNMI.js";import{a as F,c as C,g as x,b as N,d as R,e as S,f as g}from"./computeVirtualFileMetrics-
|
|
1
|
+
import{t as p}from"./themeResolver-yJ9XpNMI.js";import{a as F,c as C,g as x,b as N,d as R,e as S,f as g}from"./computeVirtualFileMetrics-BgqasG86.js";function D(e){return p.hasResolvedThemes(e)}function K(e,n){return F(e.theme,n.theme)&&e.useTokenTransformer===n.useTokenTransformer&&e.tokenizeMaxLineLength===n.tokenizeMaxLineLength}const T=10,E=13,k=4,A=40;function b(e){const n=[0];let r=e.indexOf("\r"),i=e.indexOf(`
|
|
2
2
|
`),a=0,o=0;for(;r!==-1||i!==-1;){let t;if(r!==-1&&(i===-1||r<i)?i===r+1?(t=i+1,r=e.indexOf("\r",t),i=e.indexOf(`
|
|
3
3
|
`,t)):(t=r+1,r=e.indexOf("\r",t)):(t=i+1,i=e.indexOf(`
|
|
4
4
|
`,t)),n.push(t),++o===k){if(t-a<=A){for(let s=t;s<e.length;s++){const f=e.charCodeAt(s);(f===T||f===E)&&(f===E&&s+1<e.length&&e.charCodeAt(s+1)===T&&s++,n.push(s+1))}return n}a=t,o=0}}return n}function P(e){const n=b(e);return Array.from({length:n.length},(r,i)=>{const a=n[i],o=n[i+1]??e.length;return e.slice(a,o)})}const H={forcePlainText:!1};function W(e,n,{theme:r,tokenizeMaxLineLength:i,useTokenTransformer:a},{forcePlainText:o,startingLine:t,totalLines:s,lines:f}=H){o?(t??=0,s??=1/0):(t=0,s=1/0);const l=t>0||s<1/0,{state:_,transformers:c}=C(a),h=o?"text":e.lang??x(e.name),y=typeof r=="string"?n.getTheme(r).type:void 0,I=N({theme:r,highlighter:n});_.lineInfo=m=>({type:"context",lineIndex:m-1+t,lineNumber:m+t});const O=typeof r=="string"?{lang:h,theme:r,transformers:c,defaultColor:!1,cssVariablePrefix:g("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}:{lang:h,themes:r,transformers:c,defaultColor:!1,cssVariablePrefix:g("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0},u=R(n.codeToHast(L(l?v(f??P(e.contents),t,s):e.contents),O)),d=l?new Array(t):u;return l&&S(d,u),{code:d,themeStyles:I,baseThemeType:y}}function L(e){return e.replace(/\r(?!\n)/g,`
|