ompchamber 0.7.0 → 1.0.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/client/index.html +1 -1
- package/dist/client/static/css/index.e880517fcd.css +2 -0
- package/dist/client/static/js/async/{3y.4c2596f64c.js → 3y.71f2ccf3b6.js} +2 -2
- package/dist/client/static/js/async/{xw.ae67ba06fd.js → 5b.0d6ae50fe8.js} +10 -10
- package/dist/client/static/js/async/5bh.8b2363424f.js +1 -0
- package/dist/client/static/js/async/{vy.bbe114c4e0.js → bi.09688ba75c.js} +1 -2
- package/dist/client/static/js/async/c.797d933882.js +1 -0
- package/dist/client/static/js/async/{dc.6dc4b0a04b.js → dc.856fda6560.js} +2 -2
- package/dist/client/static/js/async/g.a06ca3b3e9.js +2 -0
- package/dist/client/static/js/async/g.a06ca3b3e9.js.LICENSE.txt +11 -0
- package/dist/client/static/js/async/{m.4b29d34f93.js → m.c038c71b9f.js} +2 -2
- package/dist/client/static/js/async/ma.2c261b04dd.js +2 -0
- package/dist/client/static/js/async/ms.98960af4eb.js +67 -0
- package/dist/client/static/js/async/nam.b5663e919f.js +10 -0
- package/dist/client/static/js/async/nam.b5663e919f.js.LICENSE.txt +11 -0
- package/dist/client/static/js/async/ot.84c71b308f.js +2 -0
- package/dist/client/static/js/async/ot.84c71b308f.js.LICENSE.txt +11 -0
- package/dist/client/static/js/async/{q.542c184fec.js → q.23af2a358f.js} +3 -3
- package/dist/client/static/js/async/{s.413c2a4683.js → s.222ee974f6.js} +2 -2
- package/dist/client/static/js/async/t.4dca0e2ba8.js +1 -0
- package/dist/client/static/js/async/uf.46ad6209fa.js +2 -0
- package/dist/client/static/js/async/xn.6360379f71.js +2 -0
- package/dist/client/static/js/async/xnl.feb0021e50.js +2 -0
- package/dist/client/static/js/async/xnl.feb0021e50.js.LICENSE.txt +12 -0
- package/dist/client/static/js/index.0de15c5e17.js +33 -0
- package/dist/client/static/js/{uy.2e8929ed0c.js → jp.50817896f3.js} +6 -6
- package/package.json +2 -1
- package/src/client/components/common/MarkdownRenderer.tsx +69 -27
- package/src/client/components/common/code-editor/history.test.ts +118 -0
- package/src/client/components/common/code-editor/history.ts +101 -0
- package/src/client/components/common/code-editor/index.tsx +56 -66
- package/src/client/components/common/code-surface/index.tsx +84 -11
- package/src/client/components/common/code-surface/measure.ts +66 -17
- package/src/client/components/common/diagram-viewer/index.tsx +258 -0
- package/src/client/components/common/diagram-viewer/read-block.ts +53 -0
- package/src/client/components/layout/session-sidebar/CategoryItem.tsx +2 -1
- package/src/client/components/layout/session-sidebar/SessionItem.tsx +11 -4
- package/src/client/components/layout/session-sidebar/SessionList.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/Item.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/List.tsx +1 -1
- package/src/client/components/mobile/mobile-session-sidebar/SessionRow.tsx +2 -2
- package/src/client/components/settings/LazyModal.tsx +1 -1
- package/src/client/components/settings/Modal.tsx +2 -1
- package/src/client/components/workspace/chat-timeline/ComposerDock.tsx +11 -4
- package/src/client/components/workspace/chat-timeline/QueueList.tsx +18 -14
- package/src/client/components/workspace/chat-timeline/ToolCallCard.tsx +8 -1
- package/src/client/components/workspace/chat-timeline/chat-input/index.tsx +11 -52
- package/src/client/components/workspace/chat-timeline/chat-input/selection.ts +57 -0
- package/src/client/components/workspace/chat-timeline/index.tsx +124 -108
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/FrameControl.tsx +172 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/QuestionBlock.tsx +155 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/drafts.ts +113 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/ask-panel/index.tsx +92 -0
- package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/Footer.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/Header.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/Lazy.tsx +8 -8
- package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/SelectBody.tsx +3 -3
- package/src/client/components/workspace/chat-timeline/tool-renderers/{ask-dialog → extension-dialog}/index.tsx +16 -10
- package/src/client/components/workspace/chat-timeline/tool-renderers/index.tsx +2 -2
- package/src/client/components/workspace/file-explorer/index.tsx +18 -5
- package/src/client/components/workspace/git-panel/BranchToolbar.tsx +2 -2
- package/src/client/components/workspace/git-panel/index.tsx +5 -1
- package/src/client/components/workspace/terminal-panel/Header.tsx +51 -19
- package/src/client/components/workspace/terminal-panel/RealtimeXtermView.tsx +86 -282
- package/src/client/components/workspace/terminal-panel/index.tsx +76 -50
- package/src/client/components/workspace/terminal-panel/mount.ts +275 -0
- package/src/client/data/theme/terminal.ts +27 -29
- package/src/client/hooks/chat/omp/session-list.tsx +23 -2
- package/src/client/hooks/chat/omp/session-sidebar-controller.ts +1 -1
- package/src/client/hooks/chat/timeline/actions.ts +23 -34
- package/src/client/hooks/chat/timeline/ask-frames.ts +102 -0
- package/src/client/hooks/chat/timeline/extension-dialog.ts +12 -9
- package/src/client/hooks/chat/timeline/index.ts +18 -28
- package/src/client/hooks/chat/timeline/prompt-text.ts +35 -0
- package/src/client/hooks/chat/timeline/queue.ts +110 -46
- package/src/client/hooks/chat/timeline/send.ts +13 -27
- package/src/client/hooks/chat/timeline/session-load.ts +48 -106
- package/src/client/hooks/chat/timeline/session-pagination.ts +144 -0
- package/src/client/hooks/editor/use-code-window.ts +118 -0
- package/src/client/hooks/ui/input-required-alert.ts +43 -0
- package/src/client/hooks/ui/notification-sound.ts +65 -0
- package/src/client/hooks/ui/theme.ts +22 -6
- package/src/client/hooks/workspace/terminal/index.ts +217 -0
- package/src/client/hooks/workspace/terminal/socket.ts +227 -0
- package/src/client/tailwind.css +38 -12
- package/src/server/db.server.ts +19 -0
- package/src/server/lib/fs/git-sync.ts +191 -0
- package/src/server/lib/omp/rpc/manager.ts +72 -6
- package/src/server/lib/omp/rpc/session-commands.ts +6 -0
- package/src/server/lib/omp/rpc/session-registry.ts +18 -0
- package/src/server/lib/omp/session/sidebar-data.server.ts +10 -4
- package/src/server/lib/queue/delivery.server.ts +114 -0
- package/src/server/lib/queue/schema-migration.server.ts +50 -0
- package/src/server/lib/queue/store.server.ts +185 -0
- package/src/server/lib/terminal/foreground.ts +73 -0
- package/src/server/lib/terminal/history.test.ts +118 -0
- package/src/server/lib/terminal/history.ts +205 -0
- package/src/server/lib/terminal/runtime.server.ts +338 -0
- package/src/server/lib/terminal/session.server.ts +215 -0
- package/src/server/lib/terminal/shell.test.ts +97 -0
- package/src/server/lib/terminal/shell.ts +103 -0
- package/src/server/routes/fs/git.ts +22 -12
- package/src/server/routes/index.ts +2 -1
- package/src/server/routes/sessions/index.ts +11 -3
- package/src/server/routes/sessions/queue.ts +121 -0
- package/src/server/routes/sessions/session.ts +1 -132
- package/src/server/routes/settings/commands.ts +1 -1
- package/src/server/routes/terminal/index.ts +2 -2
- package/src/server/routes/terminal/run.ts +8 -100
- package/src/server/routes/terminal/sessions.ts +24 -0
- package/src/server/routes/terminal/ws.ts +149 -0
- package/src/shared/lib/chat/ask-questions.test.ts +169 -0
- package/src/shared/lib/chat/ask-questions.ts +264 -0
- package/src/shared/lib/chat/omp/agent-events.test.ts +37 -1
- package/src/shared/lib/chat/omp/agent-events.ts +30 -0
- package/src/shared/lib/chat/timeline/omp-callbacks.test.ts +9 -1
- package/src/shared/lib/chat/timeline/omp-callbacks.ts +45 -8
- package/src/shared/lib/code/lazy-window.test.ts +161 -0
- package/src/shared/lib/code/lazy-window.ts +156 -0
- package/src/shared/lib/code/syntax-highlight.test.ts +50 -1
- package/src/shared/lib/code/syntax-highlight.ts +14 -1
- package/src/shared/lib/code/windowed-highlight.ts +63 -0
- package/src/shared/lib/markdown/mermaid.ts +8 -6
- package/src/shared/lib/omp/session/stream-state.server.ts +2 -3
- package/src/shared/lib/workspace/session-state/store.ts +1 -4
- package/src/shared/lib/workspace/terminal/protocol.ts +222 -0
- package/src/shared/types/omp/agent.ts +14 -2
- package/src/shared/types/terminal.ts +17 -15
- package/src/shared/types/workspace.ts +6 -2
- package/dist/client/static/css/index.51f68210a5.css +0 -2
- package/dist/client/static/js/async/5b.d88304bc13.js +0 -1
- package/dist/client/static/js/async/c.cd45b0ac45.js +0 -1
- package/dist/client/static/js/async/fw.6a51998a8e.js +0 -6
- package/dist/client/static/js/async/g.86e2256a70.js +0 -2
- package/dist/client/static/js/async/kc.bbdb35b771.js +0 -1
- package/dist/client/static/js/async/mw.ca1512563c.js +0 -10
- package/dist/client/static/js/async/rf.d626afc367.js +0 -2
- package/dist/client/static/js/async/t.cda4891526.js +0 -1
- package/dist/client/static/js/async/uf.24ca3d49c3.js +0 -2
- package/dist/client/static/js/async/uf.24ca3d49c3.js.LICENSE.txt +0 -6
- package/dist/client/static/js/async/v0.394ed37c6b.js +0 -2
- package/dist/client/static/js/async/v0.394ed37c6b.js.LICENSE.txt +0 -6
- package/dist/client/static/js/async/vy.bbe114c4e0.js.LICENSE.txt +0 -6
- package/dist/client/static/js/async/xn.afecebbbd9.js +0 -2
- package/dist/client/static/js/index.eccad0b70a.js +0 -33
- package/dist/client/static/js/index.eccad0b70a.js.LICENSE.txt +0 -4
- package/src/client/components/workspace/chat-timeline/tool-renderers/panels/Ask.tsx +0 -205
- package/src/client/components/workspace/terminal-panel/InputBar.tsx +0 -82
- package/src/client/components/workspace/terminal-panel/LogEntry.tsx +0 -70
- package/src/client/hooks/workspace/terminal-output.ts +0 -66
- package/src/client/hooks/workspace/terminal.ts +0 -283
- package/src/server/lib/fs/terminal-cwd.ts +0 -49
- package/src/server/routes/terminal/stream.ts +0 -100
- /package/dist/client/static/js/async/{3y.4c2596f64c.js.LICENSE.txt → 3y.71f2ccf3b6.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{g.86e2256a70.js.LICENSE.txt → 5b.0d6ae50fe8.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{dc.6dc4b0a04b.js.LICENSE.txt → dc.856fda6560.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{fw.6a51998a8e.js.LICENSE.txt → m.c038c71b9f.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{m.4b29d34f93.js.LICENSE.txt → ma.2c261b04dd.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{xn.afecebbbd9.js.LICENSE.txt → ms.98960af4eb.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{mw.ca1512563c.js.LICENSE.txt → q.23af2a358f.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{q.542c184fec.js.LICENSE.txt → s.222ee974f6.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{rf.d626afc367.js.LICENSE.txt → uf.46ad6209fa.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/async/{s.413c2a4683.js.LICENSE.txt → xn.6360379f71.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/{async/xw.ae67ba06fd.js.LICENSE.txt → index.0de15c5e17.js.LICENSE.txt} +0 -0
- /package/dist/client/static/js/{uy.2e8929ed0c.js.LICENSE.txt → jp.50817896f3.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*! LICENSE: ms.98960af4eb.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["ms"],{Az(e,t,i){let s,r,n,o,a;var h,l,c,d=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?g.isErrorNoTelemetry(e)?new g(e.message+`
|
|
3
|
+
|
|
4
|
+
`+e.stack):Error(e.message+`
|
|
5
|
+
|
|
6
|
+
`+e.stack):e},0)}}addListener(e){return this.listeners.push(e),()=>{this._removeListener(e)}}emit(e){this.listeners.forEach(t=>{t(e)})}_removeListener(e){this.listeners.splice(this.listeners.indexOf(e),1)}setUnexpectedErrorHandler(e){this.unexpectedErrorHandler=e}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}};function u(e){var t;(t=e)instanceof f||t instanceof Error&&t.name===_&&t.message===_||d.onUnexpectedError(e)}var _="Canceled",f=class extends Error{constructor(){super(_),this.name=this.message}},g=class e extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let i=new e;return i.message=t.message,i.stack=t.stack,i}static isErrorNoTelemetry(e){return"CodeExpectedError"===e.name}};(B=P||={}).isLessThan=function(e){return e<0},B.isLessThanOrEqual=function(e){return e<=0},B.isGreaterThan=function(e){return e>0},B.isNeitherLessOrGreaterThan=function(e){return 0===e},B.greaterThan=1,B.lessThan=-1,B.neitherLessOrGreaterThan=0;var v=class e{constructor(e){this.iterate=e}forEach(e){this.iterate(t=>(e(t),!0))}toArray(){let e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(t){return new e(e=>this.iterate(i=>!t(i)||e(i)))}map(t){return new e(e=>this.iterate(i=>e(t(i))))}some(e){let t=!1;return this.iterate(i=>!(t=e(i))),t}findFirst(e){let t;return this.iterate(i=>!e(i)||(t=i,!1)),t}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(s=>((i||P.isGreaterThan(e(s,t)))&&(i=!1,t=s),!0)),t}};v.empty=new v(e=>{});(e=>{function t(e){return e&&"object"==typeof e&&"function"==typeof e[Symbol.iterator]}e.is=t;let i=Object.freeze([]);function*s(e){yield e}e.empty=function(){return i},e.single=s,e.wrap=function(e){return t(e)?e:s(e)},e.from=function(e){return e||i},e.reverse=function*(e){for(let t=e.length-1;t>=0;t--)yield e[t]},e.isEmpty=function(e){return!e||!0===e[Symbol.iterator]().next().done},e.first=function(e){return e[Symbol.iterator]().next().value},e.some=function(e,t){let i=0;for(let s of e)if(t(s,i++))return!0;return!1},e.find=function(e,t){for(let i of e)if(t(i))return i},e.filter=function*(e,t){for(let i of e)t(i)&&(yield i)},e.map=function*(e,t){let i=0;for(let s of e)yield t(s,i++)},e.flatMap=function*(e,t){let i=0;for(let s of e)yield*t(s,i++)},e.concat=function*(...e){for(let t of e)yield*t},e.reduce=function(e,t,i){let s=i;for(let i of e)s=t(s,i);return s},e.slice=function*(e,t,i=e.length){for(t<0&&(t+=e.length),i<0?i+=e.length:i>e.length&&(i=e.length);t<i;t++)yield e[t]},e.consume=function(t,i=1/0){let s=[];if(0===i)return[s,t];let r=t[Symbol.iterator]();for(let t=0;t<i;t++){let t=r.next();if(t.done)return[s,e.empty()];s.push(t.value)}return[s,{[Symbol.iterator]:()=>r}]},e.asyncToArray=async function(e){let t=[];for await(let i of e)t.push(i);return Promise.resolve(t)}})($||={});function p(e){return e}function m(e){}function x(e,t){}function w(e){if($.is(e)){let t=[];for(let i of e)if(i)try{i.dispose()}catch(e){t.push(e)}if(1===t.length)throw t[0];if(t.length>1)throw AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}if(e)return e.dispose(),e}function C(...e){let t=L(()=>w(e));return function(e,t){!1}(e,t),t}function L(e){let t=p({dispose:function(e){let t=this,i=!1,s;return function(){return i?s:(i=!0,s=e.apply(t,arguments))}}(()=>{m(t),e()})});return t}var b=class e{constructor(){this._toDispose=new Set,this._isDisposed=!1,p(this)}dispose(){this._isDisposed||(m(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(0!==this._toDispose.size)try{w(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw Error("Cannot register a disposable on itself!");return x(t,this),this._isDisposed?e.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(e){if(e){if(e===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),x(e,null))}};b.DISABLE_DISPOSED_WARNING=!1;var y=class{constructor(){this._store=new b,p(this),x(this._store,this)}dispose(){m(this),this._store.dispose()}_register(e){if(e===this)throw Error("Cannot register a disposable on itself!");return this._store.add(e)}};y.None=Object.freeze({dispose(){}});var M=class{constructor(){this._isDisposed=!1,p(this)}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),e&&x(e,this),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,m(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let e=this._value;return this._value=void 0,e&&x(e,null),e}},S="u">typeof process&&"title"in process,A=S?"node":navigator.userAgent,R=S?"node":navigator.platform,T=A.includes("Firefox"),k=A.includes("Edge"),E=/^((?!chrome|android).)*safari/i.test(A);["Macintosh","MacIntel","MacPPC","Mac68K"].includes(R),["Windows","Win16","Win32","WinCE"].includes(R),R.indexOf("Linux"),/\bCrOS\b/.test(A);var B,P,$,D,F=0,W=0,I=0,z=0,O={css:"#00000000",rgba:0};(ee=D||={}).toCss=function(e,t,i,s){return void 0!==s?`#${Y(e)}${Y(t)}${Y(i)}${Y(s)}`:`#${Y(e)}${Y(t)}${Y(i)}`},ee.toRgba=function(e,t,i,s=255){return(e<<24|t<<16|i<<8|s)>>>0},ee.toColor=function(e,t,i,s){return{css:ee.toCss(e,t,i,s),rgba:ee.toRgba(e,t,i,s)}};var U=et||={};function N(e,t){return z=Math.round(255*t),[F,W,I]=er.toChannels(e.rgba),{css:D.toCss(F,W,I,z),rgba:D.toRgba(F,W,I,z)}}U.blend=function(e,t){if(1==(z=(255&t.rgba)/255))return{css:t.css,rgba:t.rgba};let i=t.rgba>>24&255,s=t.rgba>>16&255,r=t.rgba>>8&255,n=e.rgba>>24&255,o=e.rgba>>16&255,a=e.rgba>>8&255;return F=n+Math.round((i-n)*z),W=o+Math.round((s-o)*z),I=a+Math.round((r-a)*z),{css:D.toCss(F,W,I),rgba:D.toRgba(F,W,I)}},U.isOpaque=function(e){return(255&e.rgba)==255},U.ensureContrastRatio=function(e,t,i){let s=er.ensureContrastRatio(e.rgba,t.rgba,i);if(s)return D.toColor(s>>24&255,s>>16&255,s>>8&255)},U.opaque=function(e){let t=(255|e.rgba)>>>0;return[F,W,I]=er.toChannels(t),{css:D.toCss(F,W,I),rgba:t}},U.opacity=N,U.multiplyOpacity=function(e,t){return z=255&e.rgba,N(e,z*t/255)},U.toColorRGB=function(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]},(e=>{let t,i;try{let e=document.createElement("canvas");e.width=1,e.height=1;let s=e.getContext("2d",{willReadFrequently:!0});s&&((t=s).globalCompositeOperation="copy",i=t.createLinearGradient(0,0,1,1))}catch{}e.toColor=function(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return F=parseInt(e.slice(1,2).repeat(2),16),W=parseInt(e.slice(2,3).repeat(2),16),I=parseInt(e.slice(3,4).repeat(2),16),D.toColor(F,W,I);case 5:return F=parseInt(e.slice(1,2).repeat(2),16),W=parseInt(e.slice(2,3).repeat(2),16),I=parseInt(e.slice(3,4).repeat(2),16),z=parseInt(e.slice(4,5).repeat(2),16),D.toColor(F,W,I,z);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let s=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return F=parseInt(s[1]),W=parseInt(s[2]),I=parseInt(s[3]),z=Math.round((void 0===s[5]?1:parseFloat(s[5]))*255),D.toColor(F,W,I,z);if(!t||!i||(t.fillStyle=i,t.fillStyle=e,"string"!=typeof t.fillStyle)||(t.fillRect(0,0,1,1),[F,W,I,z]=t.getImageData(0,0,1,1).data,255!==z))throw Error("css.toColor: Unsupported css format");return{rgba:D.toRgba(F,W,I,z),css:e}}})(ei||={});var q=es||={};function G(e,t,i){let s=e/255,r=t/255,n=i/255;return .2126*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4))}q.relativeLuminance=function(e){return G(e>>16&255,e>>8&255,255&e)},q.relativeLuminance2=G;var H=er||={};function V(e,t,i){let s=e>>24&255,r=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,h=t>>8&255,l=X(es.relativeLuminance2(o,a,h),es.relativeLuminance2(s,r,n));for(;l<i&&(o>0||a>0||h>0);)o-=Math.max(0,Math.ceil(.1*o)),a-=Math.max(0,Math.ceil(.1*a)),h-=Math.max(0,Math.ceil(.1*h)),l=X(es.relativeLuminance2(o,a,h),es.relativeLuminance2(s,r,n));return(o<<24|a<<16|h<<8|255)>>>0}function j(e,t,i){let s=e>>24&255,r=e>>16&255,n=e>>8&255,o=t>>24&255,a=t>>16&255,h=t>>8&255,l=X(es.relativeLuminance2(o,a,h),es.relativeLuminance2(s,r,n));for(;l<i&&(o<255||a<255||h<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),a=Math.min(255,a+Math.ceil((255-a)*.1)),h=Math.min(255,h+Math.ceil((255-h)*.1)),l=X(es.relativeLuminance2(o,a,h),es.relativeLuminance2(s,r,n));return(o<<24|a<<16|h<<8|255)>>>0}function Y(e){let t=e.toString(16);return t.length<2?"0"+t:t}function X(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}function Z(e){if(!e)throw Error("value must not be falsy");return e}function Q(e){return 57508<=e&&e<=57558}function K(e){return Q(e)||9472<=e&&e<=9631}function J(){return{width:0,height:0}}H.blend=function(e,t){if(1==(z=(255&t)/255))return t;let i=e>>24&255,s=e>>16&255,r=e>>8&255;return F=i+Math.round(((t>>24&255)-i)*z),W=s+Math.round(((t>>16&255)-s)*z),I=r+Math.round(((t>>8&255)-r)*z),D.toRgba(F,W,I)},H.ensureContrastRatio=function(e,t,i){let s=es.relativeLuminance(e>>8),r=es.relativeLuminance(t>>8);if(X(s,r)<i){if(r<s){let r=V(e,t,i),n=X(s,es.relativeLuminance(r>>8));if(n<i){let o=j(e,t,i);return n>X(s,es.relativeLuminance(o>>8))?r:o}return r}let n=j(e,t,i),o=X(s,es.relativeLuminance(n>>8));if(o<i){let r=V(e,t,i);return o>X(s,es.relativeLuminance(r>>8))?n:r}return n}},H.reduceLuminance=V,H.increaseLuminance=j,H.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]};var ee,et,ei,es,er,en,eo=0,ea=0,eh=!1,el=!1,ec=!1,ed=0,eu=class{constructor(e,t,i,s,r,n){this._terminal=e,this._optionService=t,this._selectionRenderModel=i,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(e,t,i,s){if(this.result.bg=e.bg,this.result.fg=e.fg,this.result.ext=0x10000000&e.bg?e.extended.ext:0,ea=0,eo=0,el=!1,eh=!1,ec=!1,en=this._themeService.colors,ed=0,0!==e.getCode()&&4===e.extended.underlineStyle&&(ed=t*s%(2*Math.round(Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15))))),this._decorationService.forEachDecorationAtCell(t,i,"bottom",e=>{e.backgroundColorRGB&&(ea=e.backgroundColorRGB.rgba>>8&0xffffff,el=!0),e.foregroundColorRGB&&(eo=e.foregroundColorRGB.rgba>>8&0xffffff,eh=!0)}),ec=this._selectionRenderModel.isCellSelected(this._terminal,t,i)){if(0x4000000&this.result.fg||(0x3000000&this.result.bg)!=0){if(0x4000000&this.result.fg)switch(0x3000000&this.result.fg){case 0x1000000:case 0x2000000:ea=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 0x3000000:ea=(0xffffff&this.result.fg)<<8|255;break;default:ea=this._themeService.colors.foreground.rgba}else switch(0x3000000&this.result.bg){case 0x1000000:case 0x2000000:ea=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 0x3000000:ea=(0xffffff&this.result.bg)<<8|255}ea=er.blend(ea,0xffffff00&(this._coreBrowserService.isFocused?en.selectionBackgroundOpaque:en.selectionInactiveBackgroundOpaque).rgba|128)>>8&0xffffff}else ea=(this._coreBrowserService.isFocused?en.selectionBackgroundOpaque:en.selectionInactiveBackgroundOpaque).rgba>>8&0xffffff;if(el=!0,en.selectionForeground&&(eo=en.selectionForeground.rgba>>8&0xffffff,eh=!0),K(e.getCode())){if(0x4000000&this.result.fg&&(0x3000000&this.result.bg)==0)eo=(this._coreBrowserService.isFocused?en.selectionBackgroundOpaque:en.selectionInactiveBackgroundOpaque).rgba>>8&0xffffff;else{if(0x4000000&this.result.fg)switch(0x3000000&this.result.bg){case 0x1000000:case 0x2000000:eo=this._themeService.colors.ansi[255&this.result.bg].rgba;break;case 0x3000000:eo=(0xffffff&this.result.bg)<<8|255}else switch(0x3000000&this.result.fg){case 0x1000000:case 0x2000000:eo=this._themeService.colors.ansi[255&this.result.fg].rgba;break;case 0x3000000:eo=(0xffffff&this.result.fg)<<8|255;break;default:eo=this._themeService.colors.foreground.rgba}eo=er.blend(eo,0xffffff00&(this._coreBrowserService.isFocused?en.selectionBackgroundOpaque:en.selectionInactiveBackgroundOpaque).rgba|128)>>8&0xffffff}eh=!0}}this._decorationService.forEachDecorationAtCell(t,i,"top",e=>{e.backgroundColorRGB&&(ea=e.backgroundColorRGB.rgba>>8&0xffffff,el=!0),e.foregroundColorRGB&&(eo=e.foregroundColorRGB.rgba>>8&0xffffff,eh=!0)}),el&&(ea=ec?-0x1000000&e.bg&-0x8000001|ea|0x3000000:-0x1000000&e.bg|ea|0x3000000),eh&&(eo=-0x1000000&e.fg&-0x4000001|eo|0x3000000),0x4000000&this.result.fg&&(el&&!eh&&(eo=(0x3000000&this.result.bg)==0?-0x8000000&this.result.fg|en.background.rgba>>8&0xffffff|0x3000000:-0x8000000&this.result.fg|0x3ffffff&this.result.bg,eh=!0),!el&&eh&&(ea=(0x3000000&this.result.fg)==0?-0x4000000&this.result.bg|en.foreground.rgba>>8&0xffffff|0x3000000:-0x4000000&this.result.bg|0x3ffffff&this.result.fg,el=!0)),en=void 0,this.result.bg=el?ea:this.result.bg,this.result.fg=eh?eo:this.result.fg,this.result.ext&=0x1fffffff,this.result.ext|=ed<<29&0xe0000000}},e_=T||k?"bottom":"ideographic",ef={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},eg={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},ev={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"║":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╒":{1:(e,t)=>`M.5,1 L.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╓":{1:(e,t)=>`M${.5-e},1 L${.5-e},.5 L1,.5 M${.5+e},.5 L${.5+e},1`},"╔":{1:(e,t)=>`M1,${.5-t} L${.5-e},${.5-t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╕":{1:(e,t)=>`M0,${.5-t} L.5,${.5-t} L.5,1 M0,${.5+t} L.5,${.5+t}`},"╖":{1:(e,t)=>`M${.5+e},1 L${.5+e},.5 L0,.5 M${.5-e},.5 L${.5-e},1`},"╗":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5+e},${.5-t} L${.5+e},1`},"╘":{1:(e,t)=>`M.5,0 L.5,${.5+t} L1,${.5+t} M.5,${.5-t} L1,${.5-t}`},"╙":{1:(e,t)=>`M1,.5 L${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╚":{1:(e,t)=>`M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0 M1,${.5+t} L${.5-e},${.5+t} L${.5-e},0`},"╛":{1:(e,t)=>`M0,${.5+t} L.5,${.5+t} L.5,0 M0,${.5-t} L.5,${.5-t}`},"╜":{1:(e,t)=>`M0,.5 L${.5+e},.5 L${.5+e},0 M${.5-e},.5 L${.5-e},0`},"╝":{1:(e,t)=>`M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M0,${.5+t} L${.5+e},${.5+t} L${.5+e},0`},"╞":{1:(e,t)=>`M.5,0 L.5,1 M.5,${.5-t} L1,${.5-t} M.5,${.5+t} L1,${.5+t}`},"╟":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1 M${.5+e},.5 L1,.5`},"╠":{1:(e,t)=>`M${.5-e},0 L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╡":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L.5,${.5-t} M0,${.5+t} L.5,${.5+t}`},"╢":{1:(e,t)=>`M0,.5 L${.5-e},.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╣":{1:(e,t)=>`M${.5+e},0 L${.5+e},1 M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0`},"╤":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t} M.5,${.5+t} L.5,1`},"╥":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},1 M${.5+e},.5 L${.5+e},1`},"╦":{1:(e,t)=>`M0,${.5-t} L1,${.5-t} M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1`},"╧":{1:(e,t)=>`M.5,0 L.5,${.5-t} M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╨":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},.5 L${.5-e},0 M${.5+e},.5 L${.5+e},0`},"╩":{1:(e,t)=>`M0,${.5+t} L1,${.5+t} M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╪":{1:(e,t)=>`M.5,0 L.5,1 M0,${.5-t} L1,${.5-t} M0,${.5+t} L1,${.5+t}`},"╫":{1:(e,t)=>`M0,.5 L1,.5 M${.5-e},0 L${.5-e},1 M${.5+e},0 L${.5+e},1`},"╬":{1:(e,t)=>`M0,${.5+t} L${.5-e},${.5+t} L${.5-e},1 M1,${.5+t} L${.5+e},${.5+t} L${.5+e},1 M0,${.5-t} L${.5-e},${.5-t} L${.5-e},0 M1,${.5-t} L${.5+e},${.5-t} L${.5+e},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,1,.5`},"╮":{1:(e,t)=>`M.5,1 L.5,${.5+t/.15*.5} C.5,${.5+t/.15*.5},.5,.5,0,.5`},"╯":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,0,.5`},"╰":{1:(e,t)=>`M.5,0 L.5,${.5-t/.15*.5} C.5,${.5-t/.15*.5},.5,.5,1,.5`}},ep={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};ep[""]=ep[""],ep[""]=ep[""];var em=new Map;function ex(e,t,i=0){return Math.max(Math.min(e,t),i)}var ew={C:(e,t)=>e.bezierCurveTo(t[0],t[1],t[2],t[3],t[4],t[5]),L:(e,t)=>e.lineTo(t[0],t[1]),M:(e,t)=>e.moveTo(t[0],t[1])};function eC(e,t,i,s,r,n,o,a=0,h=0){let l=e.map(e=>parseFloat(e)||parseInt(e));if(l.length<2)throw Error("Too few arguments for instruction");for(let e=0;e<l.length;e+=2)l[e]*=t-a*o-h*o,n&&0!==l[e]&&(l[e]=ex(Math.round(l[e]+.5)-.5,t,0)),l[e]+=s+a*o;for(let e=1;e<l.length;e+=2)l[e]*=i,n&&0!==l[e]&&(l[e]=ex(Math.round(l[e]+.5)-.5,i,0)),l[e]+=r;return l}var eL=class{constructor(){this._data={}}set(e,t,i){this._data[e]||(this._data[e]={}),this._data[e][t]=i}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},eb=class{constructor(){this._data=new eL}set(e,t,i,s,r){this._data.get(e,t)||this._data.set(e,t,new eL),this._data.get(e,t).set(i,s,r)}get(e,t,i,s){return this._data.get(e,t)?.get(i,s)}clear(){this._data.clear()}},ey=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,s=e.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,1.5*(i=Math.max(t=Math.max(1,performance.now()-t),i))>(r=e.timeRemaining())){s-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-t))}ms`),this._start();return}s=r}this.clear()}},eM=class extends ey{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},eS=class extends ey{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},eA=!S&&"requestIdleCallback"in window?eS:eM,eR=class e{constructor(){this.fg=0,this.bg=0,this.extended=new eT}static toColorRGB(e){return[e>>>16&255,e>>>8&255,255&e]}static fromColorRGB(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return 0x4000000&this.fg}isBold(){return 0x8000000&this.fg}isUnderline(){return this.hasExtendedAttrs()&&0!==this.extended.underlineStyle?1:0x10000000&this.fg}isBlink(){return 0x20000000&this.fg}isInvisible(){return 0x40000000&this.fg}isItalic(){return 0x4000000&this.bg}isDim(){return 0x8000000&this.bg}isStrikethrough(){return 0x80000000&this.fg}isProtected(){return 0x20000000&this.bg}isOverline(){return 0x40000000&this.bg}getFgColorMode(){return 0x3000000&this.fg}getBgColorMode(){return 0x3000000&this.bg}isFgRGB(){return(0x3000000&this.fg)==0x3000000}isBgRGB(){return(0x3000000&this.bg)==0x3000000}isFgPalette(){return(0x3000000&this.fg)==0x1000000||(0x3000000&this.fg)==0x2000000}isBgPalette(){return(0x3000000&this.bg)==0x1000000||(0x3000000&this.bg)==0x2000000}isFgDefault(){return(0x3000000&this.fg)==0}isBgDefault(){return(0x3000000&this.bg)==0}isAttributeDefault(){return 0===this.fg&&0===this.bg}getFgColor(){switch(0x3000000&this.fg){case 0x1000000:case 0x2000000:return 255&this.fg;case 0x3000000:return 0xffffff&this.fg;default:return -1}}getBgColor(){switch(0x3000000&this.bg){case 0x1000000:case 0x2000000:return 255&this.bg;case 0x3000000:return 0xffffff&this.bg;default:return -1}}hasExtendedAttrs(){return 0x10000000&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-0x10000001:this.bg|=0x10000000}getUnderlineColor(){if(0x10000000&this.bg&&~this.extended.underlineColor)switch(0x3000000&this.extended.underlineColor){case 0x1000000:case 0x2000000:return 255&this.extended.underlineColor;case 0x3000000:return 0xffffff&this.extended.underlineColor}return this.getFgColor()}getUnderlineColorMode(){return 0x10000000&this.bg&&~this.extended.underlineColor?0x3000000&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x3000000:this.isFgRGB()}isUnderlineColorPalette(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0x1000000||(0x3000000&this.extended.underlineColor)==0x2000000:this.isFgPalette()}isUnderlineColorDefault(){return 0x10000000&this.bg&&~this.extended.underlineColor?(0x3000000&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 0x10000000&this.fg?0x10000000&this.bg?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},eT=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?-0x1c000001&this._ext|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(0x1c000000&this._ext)>>26}set underlineStyle(e){this._ext&=-0x1c000001,this._ext|=e<<26&0x1c000000}get underlineColor(){return 0x3ffffff&this._ext}set underlineColor(e){this._ext&=-0x4000000,this._ext|=0x3ffffff&e}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(0xe0000000&this._ext)>>29;return e<0?0xfffffff8^e:e}set underlineVariantOffset(e){this._ext&=0x1fffffff,this._ext|=e<<29&0xe0000000}clone(){return new e(this._ext,this._urlId)}isEmpty(){return 0===this.underlineStyle&&0===this._urlId}},ek=class e{constructor(t){this.element=t,this.next=e.Undefined,this.prev=e.Undefined}};ek.Undefined=new ek(void 0);var eE=globalThis.performance&&"function"==typeof globalThis.performance.now,eB=class e{static create(t){return new e(t)}constructor(e){this._now=eE&&!1===e?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return -1!==this._stopTime?this._stopTime-this._startTime:this._now()-this._startTime}};(e=>{function t(e){}function i(e){return(t,i=null,s)=>{let r=!1,n;return n=e(e=>{if(!r)return n?n.dispose():r=!0,t.call(i,e)},null,s),r&&n.dispose(),n}}function s(e,t,i){return n((i,s=null,r)=>e(e=>i.call(s,t(e)),null,r),i)}function r(e,t,i){return n((i,s=null,r)=>e(e=>t(e)&&i.call(s,e),null,r),i)}function n(e,i){let s,r={onWillAddFirstListener(){s=e(n.fire,n)},onDidRemoveLastListener(){s?.dispose()}};i||t(r);let n=new eq(r);return i?.add(n),n.event}function o(e,i,s=100,r=!1,n=!1,a,h){let l,c,d,u=0,_,f={leakWarningThreshold:a,onWillAddFirstListener(){l=e(e=>{u++,c=i(c,e),r&&!d&&(g.fire(c),c=void 0),_=()=>{let e=c;c=void 0,d=void 0,(!r||u>1)&&g.fire(e),u=0},"number"==typeof s?(clearTimeout(d),d=setTimeout(_,s)):void 0===d&&(d=0,queueMicrotask(_))})},onWillRemoveListener(){n&&u>0&&_?.()},onDidRemoveLastListener(){_=void 0,l.dispose()}};h||t(f);let g=new eq(f);return h?.add(g),g.event}e.None=()=>y.None,e.defer=function(e,t){return o(e,()=>{},0,void 0,!0,void 0,t)},e.once=i,e.map=s,e.forEach=function(e,t,i){return n((i,s=null,r)=>e(e=>{t(e),i.call(s,e)},null,r),i)},e.filter=r,e.signal=function(e){return e},e.any=function(...e){return(t,i=null,s)=>{var r,n;return r=C(...e.map(e=>e(e=>t.call(i,e)))),(n=s)instanceof Array?n.push(r):n&&n.add(r),r}},e.reduce=function(e,t,i,r){let n=i;return s(e,e=>n=t(n,e),r)},e.debounce=o,e.accumulate=function(t,i=0,s){return e.debounce(t,(e,t)=>e?(e.push(t),e):[t],i,void 0,!0,void 0,s)},e.latch=function(e,t=(e,t)=>e===t,i){let s=!0,n;return r(e,e=>{let i=s||!t(e,n);return s=!1,n=e,i},i)},e.split=function(t,i,s){return[e.filter(t,i,s),e.filter(t,e=>!i(e),s)]},e.buffer=function(e,t=!1,i=[],s){let r=i.slice(),n=e(e=>{r?r.push(e):a.fire(e)});s&&s.add(n);let o=()=>{r?.forEach(e=>a.fire(e)),r=null},a=new eq({onWillAddFirstListener(){n||(n=e(e=>a.fire(e)),s&&s.add(n))},onDidAddFirstListener(){r&&(t?setTimeout(o):o())},onDidRemoveLastListener(){n&&n.dispose(),n=null}});return s&&s.add(a),a.event},e.chain=function(e,t){return(i,s,r)=>{let n=t(new h);return e(function(e){let t=n.evaluate(e);t!==a&&i.call(s,t)},void 0,r)}};let a=Symbol("HaltChainable");class h{constructor(){this.steps=[]}map(e){return this.steps.push(e),this}forEach(e){return this.steps.push(t=>(e(t),t)),this}filter(e){return this.steps.push(t=>e(t)?t:a),this}reduce(e,t){let i=t;return this.steps.push(t=>i=e(i,t)),this}latch(e=(e,t)=>e===t){let t=!0,i;return this.steps.push(s=>{let r=t||!e(s,i);return t=!1,i=s,r?s:a}),this}evaluate(e){for(let t of this.steps)if((e=t(e))===a)break;return e}}e.fromNodeEventEmitter=function(e,t,i=e=>e){let s=(...e)=>r.fire(i(...e)),r=new eq({onWillAddFirstListener:()=>e.on(t,s),onDidRemoveLastListener:()=>e.removeListener(t,s)});return r.event},e.fromDOMEventEmitter=function(e,t,i=e=>e){let s=(...e)=>r.fire(i(...e)),r=new eq({onWillAddFirstListener:()=>e.addEventListener(t,s),onDidRemoveLastListener:()=>e.removeEventListener(t,s)});return r.event},e.toPromise=function(e){return new Promise(t=>i(e)(t))},e.fromPromise=function(e){let t=new eq;return e.then(e=>{t.fire(e)},()=>{t.fire(void 0)}).finally(()=>{t.dispose()}),t.event},e.forward=function(e,t){return e(e=>t.fire(e))},e.runAndSubscribe=function(e,t,i){return t(i),e(e=>t(e))};class l{constructor(e,i){this._observable=e,this._counter=0,this._hasChanged=!1;let s={onWillAddFirstListener:()=>{e.addObserver(this)},onDidRemoveLastListener:()=>{e.removeObserver(this)}};i||t(s),this.emitter=new eq(s),i&&i.add(this.emitter)}beginUpdate(e){this._counter++}handlePossibleChange(e){}handleChange(e,t){this._hasChanged=!0}endUpdate(e){this._counter--,0===this._counter&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}e.fromObservable=function(e,t){return new l(e,t).emitter.event},e.fromObservableLight=function(e){return(t,i,s)=>{let r=0,n=!1,o={beginUpdate(){r++},endUpdate(){0==--r&&(e.reportChanges(),n&&(n=!1,t.call(i)))},handlePossibleChange(){},handleChange(){n=!0}};e.addObserver(o),e.reportChanges();let a={dispose(){e.removeObserver(o)}};return s instanceof b?s.add(a):Array.isArray(s)&&s.push(a),a}}})(eD||={});var eP=class e{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${e._idPool++}`,e.all.add(this)}start(e){this._stopWatch=new eB,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};eP.all=new Set,eP._idPool=0;var e$=class e{constructor(t,i,s=(e._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=i,this.name=s,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){let i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);let s=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,s+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=.5*i;let[e,s]=this.getMostFrequentStack(),r=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${s}):`;console.warn(r),console.warn(e);let n=new eI(r,e);this._errorHandler(n)}return()=>{let t=this._stacks.get(e.value)||0;this._stacks.set(e.value,t-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[i,s]of this._stacks)(!e||t<s)&&(e=[i,s],t=s);return e}};e$._idPool=1;var eD,eF,eW=class e{constructor(e){this.value=e}static create(){return new e(Error().stack??"")}print(){console.warn(this.value.split(`
|
|
7
|
+
`).slice(2).join(`
|
|
8
|
+
`))}},eI=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},ez=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},eO=0,eU=class{constructor(e){this.value=e,this.id=eO++}},eN,eq=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new e$(e?.onListenerError??u,this._options?.leakWarningThreshold??-1):void 0,this._perfMon=this._options?._profName?new eP(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],i=new ez(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||u)(i),y.None}if(this._disposed)return y.None;t&&(e=e.bind(t));let s=new eU(e),r;this._leakageMon&&this._size>=Math.ceil(.2*this._leakageMon.threshold)&&(s.stack=eW.create(),r=this._leakageMon.check(s.stack,this._size+1)),this._listeners?this._listeners instanceof eU?(this._deliveryQueue??=new eG,this._listeners=[this._listeners,s]):this._listeners.push(s):(this._options?.onWillAddFirstListener?.(this),this._listeners=s,this._options?.onDidAddFirstListener?.(this)),this._size++;let n=L(()=>{eF?.unregister(n),r?.(),this._removeListener(s)});if(i instanceof b?i.add(n):Array.isArray(i)&&i.push(n),eF){let e=Error().stack.split(`
|
|
9
|
+
`).slice(2,3).join(`
|
|
10
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);eF.register(n,t?.[2]??e,n)}return n},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(1===this._size){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,i=t.indexOf(e);if(-1===i)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;let s=this._deliveryQueue.current===this;if(2*this._size<=t.length){let e=0;for(let i=0;i<t.length;i++)t[i]?t[e++]=t[i]:s&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let i=this._options?.onListenerError||u;if(!i)return void e.value(t);try{e.value(t)}catch(e){i(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof eU)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}},eG=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},eH={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},eV=class e{constructor(e,t,i){this._document=e,this._config=t,this._unicodeService=i,this._didWarmUp=!1,this._cacheMap=new eb,this._cacheMapCombined=new eb,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new eR,this._textureSize=512,this._onAddTextureAtlasCanvas=new eq,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new eq,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=eX(e,4*this._config.deviceCellWidth+4,this._config.deviceCellHeight+4),this._tmpCtx=Z(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){for(let e of(this._tmpCanvas.remove(),this.pages))e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new eA;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let e=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,e)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(0!==this._pages[0].currentRow.x||0!==this._pages[0].currentRow.y){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(e.maxAtlasPages&&this._pages.length>=Math.max(4,e.maxAtlasPages)){let t=this._pages.filter(t=>2*t.canvas.width<=(e.maxTextureSize||4096)).sort((e,t)=>t.canvas.width!==e.canvas.width?t.canvas.width-e.canvas.width:t.percentageUsed-e.percentageUsed),i=-1,s=0;for(let e=0;e<t.length;e++)if(t[e].canvas.width!==s)i=e,s=t[e].canvas.width;else if(e-i==3)break;let r=t.slice(i,i+4),n=r.map(e=>e.glyphs[0].texturePage).sort((e,t)=>e>t?1:-1),o=this.pages.length-r.length,a=this._mergePages(r,o);a.version++;for(let e=n.length-1;e>=0;e--)this._deletePage(n[e]);this.pages.push(a),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(a.canvas)}let t=new ej(this._document,this._textureSize);return this._pages.push(t),this._activePages.push(t),this._onAddTextureAtlasCanvas.fire(t.canvas),t}_mergePages(e,t){let i=2*e[0].canvas.width,s=new ej(this._document,i,e);for(let[r,n]of e.entries()){let e=r*n.canvas.width%i,o=Math.floor(r/2)*n.canvas.height;for(let r of(s.ctx.drawImage(n.canvas,e,o),n.glyphs))r.texturePage=t,r.sizeClipSpace.x=r.size.x/i,r.sizeClipSpace.y=r.size.y/i,r.texturePosition.x+=e,r.texturePosition.y+=o,r.texturePositionClipSpace.x=r.texturePosition.x/i,r.texturePositionClipSpace.y=r.texturePosition.y/i;this._onRemoveTextureAtlasCanvas.fire(n.canvas);let a=this._activePages.indexOf(n);-1!==a&&this._activePages.splice(a,1)}return s}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let e=this._pages[t];for(let t of e.glyphs)t.texturePage--;e.version++}}getRasterizedGlyphCombinedChar(e,t,i,s,r,n){return this._getFromCacheMap(this._cacheMapCombined,e,t,i,s,r,n)}getRasterizedGlyph(e,t,i,s,r,n){return this._getFromCacheMap(this._cacheMap,e,t,i,s,r,n)}_getFromCacheMap(e,t,i,s,r,n,o){return(eN=e.get(t,i,s,r))||(eN=this._drawToCache(t,i,s,r,n,o),e.set(t,i,s,r,eN)),eN}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,i,s){let r;if(this._config.allowTransparency)return O;switch(e){case 0x1000000:case 0x2000000:r=this._getColorFromAnsiIndex(t);break;case 0x3000000:let n=eR.toColorRGB(t);r=D.toColor(n[0],n[1],n[2]);break;default:r=i?et.opaque(this._config.colors.foreground):this._config.colors.background}return this._config.allowTransparency||(r=et.opaque(r)),r}_getForegroundColor(e,t,i,s,r,n,o,a,h,l){let c,d=this._getMinimumContrastColor(e,t,i,s,r,n,o,h,a,l);if(d)return d;switch(r){case 0x1000000:case 0x2000000:this._config.drawBoldTextInBrightColors&&h&&n<8&&(n+=8),c=this._getColorFromAnsiIndex(n);break;case 0x3000000:let u=eR.toColorRGB(n);c=D.toColor(u[0],u[1],u[2]);break;default:c=o?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(c=et.opaque(c)),a&&(c=et.multiplyOpacity(c,.5)),c}_resolveBackgroundRgba(e,t,i){switch(e){case 0x1000000:case 0x2000000:return this._getColorFromAnsiIndex(t).rgba;case 0x3000000:return t<<8;default:return i?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,i,s){switch(e){case 0x1000000:case 0x2000000:return this._config.drawBoldTextInBrightColors&&s&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 0x3000000:return t<<8;default:return i?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,i,s,r,n,o,a,h,l){if(1===this._config.minimumContrastRatio||l)return;let c=this._getContrastCache(h),d=c.getColor(e,s);if(void 0!==d)return d||void 0;let u=this._resolveBackgroundRgba(t,i,o),_=this._resolveForegroundRgba(r,n,o,a),f=er.ensureContrastRatio(u,_,this._config.minimumContrastRatio/(h?2:1));if(!f)return void c.setColor(e,s,null);let g=D.toColor(f>>24&255,f>>16&255,f>>8&255);return c.setColor(e,s,g),g}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(t,i,s,r,n,o){var a;let h="number"==typeof t?String.fromCharCode(t):t;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let l=Math.min(this._config.deviceCellWidth*Math.max(h.length,2)+4,this._config.deviceMaxTextureSize);this._tmpCanvas.width<l&&(this._tmpCanvas.width=l);let c=Math.min(this._config.deviceCellHeight+8,this._textureSize);if(this._tmpCanvas.height<c&&(this._tmpCanvas.height=c),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=i,this._workAttributeData.extended.ext=r,this._workAttributeData.isInvisible())return eH;let d=!!this._workAttributeData.isBold(),u=!!this._workAttributeData.isInverse(),_=!!this._workAttributeData.isDim(),f=!!this._workAttributeData.isItalic(),g=!!this._workAttributeData.isUnderline(),v=!!this._workAttributeData.isStrikethrough(),p=!!this._workAttributeData.isOverline(),m=this._workAttributeData.getFgColor(),x=this._workAttributeData.getFgColorMode(),w=this._workAttributeData.getBgColor(),C=this._workAttributeData.getBgColorMode();if(u){let e=m;m=w,w=e;let t=x;x=C,C=t}let L=this._getBackgroundColor(C,w,u,_);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let b=d?this._config.fontWeightBold:this._config.fontWeight;this._tmpCtx.font=`${f?"italic":""} ${b} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=e_;let y=1===h.length&&Q(h.charCodeAt(0)),M=1===h.length&&57520<=(a=h.charCodeAt(0))&&a<=57527,S=this._getForegroundColor(i,C,w,s,x,m,u,_,d,K(h.charCodeAt(0)));this._tmpCtx.fillStyle=S.css;let A=4*!M,R=!1;!1!==this._config.customGlyphs&&(R=function(e,t,i,s,r,n,o,a){let h=ef[t];if(h)return function(e,t,i,s,r,n){for(let o=0;o<t.length;o++){let a=t[o],h=r/8,l=n/8;e.fillRect(i+a.x*h,s+a.y*l,a.w*h,a.h*l)}}(e,h,i,s,r,n),!0;let l=eg[t];if(l)return function(e,t,i,s,r,n){let o=em.get(t);o||(o=new Map,em.set(t,o));let a=e.fillStyle;if("string"!=typeof a)throw Error(`Unexpected fillStyle type "${a}"`);let h=o.get(a);if(!h){let i=t[0].length,s=t.length,r=e.canvas.ownerDocument.createElement("canvas");r.width=i,r.height=s;let n=Z(r.getContext("2d")),l=new ImageData(i,s),c,d,u,_;if(a.startsWith("#"))c=parseInt(a.slice(1,3),16),d=parseInt(a.slice(3,5),16),u=parseInt(a.slice(5,7),16),_=a.length>7&&parseInt(a.slice(7,9),16)||1;else if(a.startsWith("rgba"))[c,d,u,_]=a.substring(5,a.length-1).split(",").map(e=>parseFloat(e));else throw Error(`Unexpected fillStyle color format "${a}" when drawing pattern glyph`);for(let e=0;e<s;e++)for(let s=0;s<i;s++)l.data[(e*i+s)*4]=c,l.data[(e*i+s)*4+1]=d,l.data[(e*i+s)*4+2]=u,l.data[(e*i+s)*4+3]=t[e][s]*(255*_);n.putImageData(l,0,0),h=Z(e.createPattern(r,null)),o.set(a,h)}e.fillStyle=h,e.fillRect(i,s,r,n)}(e,l,i,s,r,n),!0;let c=ev[t];if(c)return function(e,t,i,s,r,n,o){for(let[a,h]of(e.strokeStyle=e.fillStyle,Object.entries(t))){for(let t of(e.beginPath(),e.lineWidth=o*Number.parseInt(a),("function"==typeof h?h(.15,.15/n*r):h).split(" "))){let a=t[0],h=ew[a];if(!h){console.error(`Could not find drawing instructions for "${a}"`);continue}let l=t.substring(1).split(",");l[0]&&l[1]&&h(e,eC(l,r,n,i,s,!0,o))}e.stroke(),e.closePath()}}(e,c,i,s,r,n,a),!0;let d=ep[t];return!!d&&(function(e,t,i,s,r,n,o,a){let h=new Path2D;h.rect(i,s,r,n),e.clip(h),e.beginPath();let l=o/12;for(let o of(e.lineWidth=a*l,t.d.split(" "))){let h=o[0],c=ew[h];if(!c){console.error(`Could not find drawing instructions for "${h}"`);continue}let d=o.substring(1).split(",");d[0]&&d[1]&&c(e,eC(d,r,n,i,s,!1,a,(t.leftPadding??0)*(l/2),(t.rightPadding??0)*(l/2)))}1===t.type?(e.strokeStyle=e.fillStyle,e.stroke()):e.fill(),e.closePath()}(e,d,i,s,r,n,o,a),!0)}(this._tmpCtx,h,A,A,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let T=!y,k;if(k="number"==typeof t?this._unicodeService.wcwidth(t):this._unicodeService.getStringCellWidth(t),g){this._tmpCtx.save();let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=.5*(e%2==1);if(this._tmpCtx.lineWidth=e,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())T=!1,this._tmpCtx.strokeStyle=`rgb(${eR.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{T=!1;let e=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&e<8&&(e+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(e).css}this._tmpCtx.beginPath();let i=Math.ceil(A+this._config.deviceCharHeight)-t-(n?2*e:0),s=i+e,r=i+2*e,o=this._workAttributeData.getUnderlineVariantOffset();for(let n=0;n<k;n++){this._tmpCtx.save();let a=A+n*this._config.deviceCellWidth,h=A+(n+1)*this._config.deviceCellWidth,l=a+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(a,i),this._tmpCtx.lineTo(h,i),this._tmpCtx.moveTo(a,r),this._tmpCtx.lineTo(h,r);break;case 3:let c=e<=1?r:Math.ceil(A+this._config.deviceCharHeight-e/2)-t,d=e<=1?i:Math.ceil(A+this._config.deviceCharHeight+e/2)-t,u=new Path2D;u.rect(a,i,this._config.deviceCellWidth,r-i),this._tmpCtx.clip(u),this._tmpCtx.moveTo(a-this._config.deviceCellWidth/2,s),this._tmpCtx.bezierCurveTo(a-this._config.deviceCellWidth/2,d,a,d,a,s),this._tmpCtx.bezierCurveTo(a,c,l,c,l,s),this._tmpCtx.bezierCurveTo(l,d,h,d,h,s),this._tmpCtx.bezierCurveTo(h,c,h+this._config.deviceCellWidth/2,c,h+this._config.deviceCellWidth/2,s);break;case 4:let _=0===o?0:o>=e?2*e-o:e-o;!(o>=e)==!1||0===_?(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a+_,i)):(this._tmpCtx.setLineDash([Math.round(e),Math.round(e)]),this._tmpCtx.moveTo(a,i),this._tmpCtx.lineTo(a+_,i),this._tmpCtx.moveTo(a+_+e,i)),this._tmpCtx.lineTo(h,i),o=function(e,t,i=0){return(e-(2*Math.round(t)-i))%(2*Math.round(t))}(h-a,e,o);break;case 5:let f=h-a,g=Math.floor(.6*f),v=Math.floor(.3*f),p=f-g-v;this._tmpCtx.setLineDash([g,v,p]),this._tmpCtx.moveTo(a,i),this._tmpCtx.lineTo(h,i);break;default:this._tmpCtx.moveTo(a,i),this._tmpCtx.lineTo(h,i)}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!R&&this._config.fontSize>=12&&!this._config.allowTransparency&&" "!==h){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let t=this._tmpCtx.measureText(h);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in t&&t.actualBoundingBoxDescent>0){this._tmpCtx.save();let t=new Path2D;t.rect(A,i-Math.ceil(e/2),this._config.deviceCellWidth*k,r-i+Math.ceil(e/2)),this._tmpCtx.clip(t),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=L.css,this._tmpCtx.strokeText(h,A,A+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(p){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),t=.5*(e%2==1);this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+t),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*k,A+t),this._tmpCtx.stroke()}if(R||this._tmpCtx.fillText(h,A,A+this._config.deviceCharHeight),"_"===h&&!this._config.allowTransparency){let e=eY(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),L,S,T);if(e)for(let t=1;t<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=L.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(h,A,A+this._config.deviceCharHeight-t),e=eY(this._tmpCtx.getImageData(A,A,this._config.deviceCellWidth,this._config.deviceCellHeight),L,S,T));t++);}if(v){let e=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),t=.5*(this._tmpCtx.lineWidth%2==1);this._tmpCtx.lineWidth=e,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(A,A+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.lineTo(A+this._config.deviceCharWidth*k,A+Math.floor(this._config.deviceCharHeight/2)-t),this._tmpCtx.stroke()}this._tmpCtx.restore();let E=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);if(this._config.allowTransparency?function(e){for(let t=0;t<e.data.length;t+=4)if(e.data[t+3]>0)return!1;return!0}(E):eY(E,L,S,T))return eH;let B=this._findGlyphBoundingBox(E,this._workBoundingBox,l,M,R,A),P,$;for(;;){if(0===this._activePages.length){let e=this._createNewPage();P=e,($=e.currentRow).height=B.size.y;break}for(let e of($=(P=this._activePages[this._activePages.length-1]).currentRow,this._activePages))B.size.y<=e.currentRow.height&&(P=e,$=e.currentRow);for(let e=this._activePages.length-1;e>=0;e--)for(let t of this._activePages[e].fixedRows)t.height<=$.height&&B.size.y<=t.height&&(P=this._activePages[e],$=t);if(B.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new ej(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),P=this._overflowSizePage,($=this._overflowSizePage.currentRow).x+B.size.x>=P.canvas.width&&($.x=0,$.y+=$.height,$.height=0);break}if($.y+B.size.y>=P.canvas.height||$.height>B.size.y+2){let t=!1;if(P.currentRow.y+P.currentRow.height+B.size.y>=P.canvas.height){let i;for(let e of this._activePages)if(e.currentRow.y+e.currentRow.height+B.size.y<e.canvas.height){i=e;break}if(i)P=i;else if(e.maxAtlasPages&&this._pages.length>=e.maxAtlasPages&&$.y+B.size.y<=P.canvas.height&&$.height>=B.size.y&&$.x+B.size.x<=P.canvas.width)t=!0;else{let e=this._createNewPage();P=e,($=e.currentRow).height=B.size.y,t=!0}}t||(P.currentRow.height>0&&P.fixedRows.push(P.currentRow),$={x:0,y:P.currentRow.y+P.currentRow.height,height:B.size.y},P.fixedRows.push($),P.currentRow={x:0,y:$.y+$.height,height:0})}if($.x+B.size.x<=P.canvas.width)break;$===P.currentRow?($.x=0,$.y+=$.height,$.height=0):P.fixedRows.splice(P.fixedRows.indexOf($),1)}return B.texturePage=this._pages.indexOf(P),B.texturePosition.x=$.x,B.texturePosition.y=$.y,B.texturePositionClipSpace.x=$.x/P.canvas.width,B.texturePositionClipSpace.y=$.y/P.canvas.height,B.sizeClipSpace.x/=P.canvas.width,B.sizeClipSpace.y/=P.canvas.height,$.height=Math.max($.height,B.size.y),$.x+=B.size.x,P.ctx.putImageData(E,B.texturePosition.x-this._workBoundingBox.left,B.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,B.size.x,B.size.y),P.addGlyph(B),P.version++,B}_findGlyphBoundingBox(e,t,i,s,r,n){t.top=0;let o=s?this._config.deviceCellHeight:this._tmpCanvas.height,a=s?this._config.deviceCellWidth:i,h=!1;for(let i=0;i<o;i++){for(let s=0;s<a;s++){let r=i*this._tmpCanvas.width*4+4*s+3;if(0!==e.data[r]){t.top=i,h=!0;break}}if(h)break}t.left=0,h=!1;for(let i=0;i<n+a;i++){for(let s=0;s<o;s++){let r=s*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[r]){t.left=i,h=!0;break}}if(h)break}t.right=a,h=!1;for(let i=n+a-1;i>=n;i--){for(let s=0;s<o;s++){let r=s*this._tmpCanvas.width*4+4*i+3;if(0!==e.data[r]){t.right=i,h=!0;break}}if(h)break}t.bottom=o,h=!1;for(let i=o-1;i>=0;i--){for(let s=0;s<a;s++){let r=i*this._tmpCanvas.width*4+4*s+3;if(0!==e.data[r]){t.bottom=i,h=!0;break}}if(h)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+n+(s||r?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+n+(s||r?1===this._config.lineHeight?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},ej=class{constructor(e,t,i){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],i)for(let e of i)this._glyphs.push(...e.glyphs),this._usedPixels+=e._usedPixels;this.canvas=eX(e,t,t),this.ctx=Z(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(e){this._glyphs.push(e),this._usedPixels+=e.size.x*e.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function eY(e,t,i,s){let r=t.rgba>>>24,n=t.rgba>>>16&255,o=t.rgba>>>8&255,a=Math.floor((Math.abs(r-(i.rgba>>>24))+Math.abs(n-(i.rgba>>>16&255))+Math.abs(o-(i.rgba>>>8&255)))/12),h=!0;for(let t=0;t<e.data.length;t+=4)e.data[t]===r&&e.data[t+1]===n&&e.data[t+2]===o||s&&Math.abs(e.data[t]-r)+Math.abs(e.data[t+1]-n)+Math.abs(e.data[t+2]-o)<a?e.data[t+3]=0:h=!1;return h}function eX(e,t,i){let s=e.createElement("canvas");return s.width=t,s.height=i,s}function eZ(e,t){for(let i=0;i<e.colors.ansi.length;i++)if(e.colors.ansi[i].rgba!==t.colors.ansi[i].rgba)return!1;return e.devicePixelRatio===t.devicePixelRatio&&e.customGlyphs===t.customGlyphs&&e.lineHeight===t.lineHeight&&e.letterSpacing===t.letterSpacing&&e.fontFamily===t.fontFamily&&e.fontSize===t.fontSize&&e.fontWeight===t.fontWeight&&e.fontWeightBold===t.fontWeightBold&&e.allowTransparency===t.allowTransparency&&e.deviceCharWidth===t.deviceCharWidth&&e.deviceCharHeight===t.deviceCharHeight&&e.drawBoldTextInBrightColors===t.drawBoldTextInBrightColors&&e.minimumContrastRatio===t.minimumContrastRatio&&e.colors.foreground.rgba===t.colors.foreground.rgba&&e.colors.background.rgba===t.colors.background.rgba}var eQ=[];function eK(e,t,i,s,r,n,o,a,h){let l,c=(l={foreground:i.foreground,background:i.background,cursor:O,cursorAccent:O,selectionForeground:O,selectionBackgroundTransparent:O,selectionBackgroundOpaque:O,selectionInactiveBackgroundTransparent:O,selectionInactiveBackgroundOpaque:O,overviewRulerBorder:O,scrollbarSliderBackground:O,scrollbarSliderHoverBackground:O,scrollbarSliderActiveBackground:O,ansi:i.ansi.slice(),contrastCache:i.contrastCache,halfContrastCache:i.halfContrastCache},{customGlyphs:t.customGlyphs,devicePixelRatio:a,deviceMaxTextureSize:h,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,deviceCellWidth:s,deviceCellHeight:r,deviceCharWidth:n,deviceCharHeight:o,fontFamily:t.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,fontWeightBold:t.fontWeightBold,allowTransparency:t.allowTransparency,drawBoldTextInBrightColors:t.drawBoldTextInBrightColors,minimumContrastRatio:t.minimumContrastRatio,colors:l});for(let t=0;t<eQ.length;t++){let i=eQ[t],s=i.ownedBy.indexOf(e);if(s>=0){if(eZ(i.config,c))return i.atlas;1===i.ownedBy.length?(i.atlas.dispose(),eQ.splice(t,1)):i.ownedBy.splice(s,1);break}}for(let t=0;t<eQ.length;t++){let i=eQ[t];if(eZ(i.config,c))return i.ownedBy.push(e),i.atlas}let d={atlas:new eV(document,c,e._core.unicodeService),config:c,ownedBy:[e]};return eQ.push(d),d.atlas}function eJ(e){for(let t=0;t<eQ.length;t++){let i=eQ[t].ownedBy.indexOf(e);if(-1!==i){1===eQ[t].ownedBy.length?(eQ[t].atlas.dispose(),eQ.splice(t,1)):eQ[t].ownedBy.splice(i,1);break}}}var e0=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(e=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0)return void this._restartInterval(e)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=600-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},e)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function e5(e,t,i){let s=new t.ResizeObserver(t=>{let r=t.find(t=>t.target===e);if(!r)return;if(!("devicePixelContentBoxSize"in r)){s?.disconnect(),s=void 0;return}let n=r.devicePixelContentBoxSize[0].inlineSize,o=r.devicePixelContentBoxSize[0].blockSize;n>0&&o>0&&i(n,o)});try{s.observe(e,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return L(()=>s?.disconnect())}var e1=class e extends eR{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new eT,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){var e;return 2097152&this.content?this.combinedData:2097151&this.content?(e=2097151&this.content)>65535?String.fromCharCode(((e-=65536)>>10)+55296)+String.fromCharCode(e%1024+56320):String.fromCharCode(e):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(2===e[1].length){let i=e[1].charCodeAt(0);if(55296<=i&&i<=56319){let s=e[1].charCodeAt(1);56320<=s&&s<=57343?this.content=(i-55296)*1024+s-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},e2=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function e3(e,t,i){let s=Z(e.createProgram());if(e.attachShader(s,Z(e4(e,e.VERTEX_SHADER,t))),e.attachShader(s,Z(e4(e,e.FRAGMENT_SHADER,i))),e.linkProgram(s),e.getProgramParameter(s,e.LINK_STATUS))return s;console.error(e.getProgramInfoLog(s)),e.deleteProgram(s)}function e4(e,t,i){let s=Z(e.createShader(t));if(e.shaderSource(s,i),e.compileShader(s),e.getShaderParameter(s,e.COMPILE_STATUS))return s;console.error(e.getShaderInfoLog(s)),e.deleteShader(s)}var e8,e6=class{constructor(e){this.texture=e,this.version=-1}},e7=`#version 300 es
|
|
11
|
+
layout (location = 0) in vec2 a_unitquad;
|
|
12
|
+
layout (location = 1) in vec2 a_cellpos;
|
|
13
|
+
layout (location = 2) in vec2 a_offset;
|
|
14
|
+
layout (location = 3) in vec2 a_size;
|
|
15
|
+
layout (location = 4) in float a_texpage;
|
|
16
|
+
layout (location = 5) in vec2 a_texcoord;
|
|
17
|
+
layout (location = 6) in vec2 a_texsize;
|
|
18
|
+
|
|
19
|
+
uniform mat4 u_projection;
|
|
20
|
+
uniform vec2 u_resolution;
|
|
21
|
+
|
|
22
|
+
out vec2 v_texcoord;
|
|
23
|
+
flat out int v_texpage;
|
|
24
|
+
|
|
25
|
+
void main() {
|
|
26
|
+
vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size);
|
|
27
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
28
|
+
v_texpage = int(a_texpage);
|
|
29
|
+
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
30
|
+
}`,e9=11*Float32Array.BYTES_PER_ELEMENT,te=0,tt=0,ti=0,ts=class extends y{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let r=this._gl;void 0===eV.maxAtlasPages&&(eV.maxAtlasPages=Math.min(32,Z(r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS))),eV.maxTextureSize=Z(r.getParameter(r.MAX_TEXTURE_SIZE))),this._program=Z(e3(r,e7,function(e){let t="";for(let i=1;i<e;i++)t+=` else if (v_texpage == ${i}) { outColor = texture(u_texture[${i}], v_texcoord); }`;return`#version 300 es
|
|
31
|
+
precision lowp float;
|
|
32
|
+
|
|
33
|
+
in vec2 v_texcoord;
|
|
34
|
+
flat in int v_texpage;
|
|
35
|
+
|
|
36
|
+
uniform sampler2D u_texture[${e}];
|
|
37
|
+
|
|
38
|
+
out vec4 outColor;
|
|
39
|
+
|
|
40
|
+
void main() {
|
|
41
|
+
if (v_texpage == 0) {
|
|
42
|
+
outColor = texture(u_texture[0], v_texcoord);
|
|
43
|
+
} ${t}
|
|
44
|
+
}`}(eV.maxAtlasPages))),this._register(L(()=>r.deleteProgram(this._program))),this._projectionLocation=Z(r.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Z(r.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Z(r.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(L(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(L(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=Z(r.createBuffer()),this._register(L(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,2,r.FLOAT,!1,e9,0),r.vertexAttribDivisor(2,1),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,r.FLOAT,!1,e9,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(3,1),r.enableVertexAttribArray(4),r.vertexAttribPointer(4,1,r.FLOAT,!1,e9,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(4,1),r.enableVertexAttribArray(5),r.vertexAttribPointer(5,2,r.FLOAT,!1,e9,5*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(5,1),r.enableVertexAttribArray(6),r.vertexAttribPointer(6,2,r.FLOAT,!1,e9,7*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(6,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,e9,9*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.useProgram(this._program);let l=new Int32Array(eV.maxAtlasPages);for(let e=0;e<eV.maxAtlasPages;e++)l[e]=e;r.uniform1iv(this._textureLocation,l),r.uniformMatrix4fv(this._projectionLocation,!1,e2),this._atlasTextures=[];for(let e=0;e<eV.maxAtlasPages;e++){let t=new e6(Z(r.createTexture()));this._register(L(()=>r.deleteTexture(t.texture))),r.activeTexture(r.TEXTURE0+e),r.bindTexture(r.TEXTURE_2D,t.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[e]=t}r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(e,t,i,s,r,n,o,a,h){this._updateCell(this._vertices.attributes,e,t,i,s,r,n,o,a,h)}_updateCell(e,t,i,s,r,n,o,a,h,l){var c,d;(te=(i*this._terminal.cols+t)*11,0===s||void 0===s)?e.fill(0,te,te+11-1-2):this._atlas&&(e8=a&&a.length>1?this._atlas.getRasterizedGlyphCombinedChar(a,r,n,o,!1,this._terminal.element):this._atlas.getRasterizedGlyph(s,r,n,o,!1,this._terminal.element),tt=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),r!==l&&e8.offset.x>tt?(ti=e8.offset.x-tt,e[te]=-(e8.offset.x-ti)+this._dimensions.device.char.left,e[te+1]=-e8.offset.y+this._dimensions.device.char.top,e[te+2]=(e8.size.x-ti)/this._dimensions.device.canvas.width,e[te+3]=e8.size.y/this._dimensions.device.canvas.height,e[te+4]=e8.texturePage,e[te+5]=e8.texturePositionClipSpace.x+ti/this._atlas.pages[e8.texturePage].canvas.width,e[te+6]=e8.texturePositionClipSpace.y,e[te+7]=e8.sizeClipSpace.x-ti/this._atlas.pages[e8.texturePage].canvas.width):(e[te]=-e8.offset.x+this._dimensions.device.char.left,e[te+1]=-e8.offset.y+this._dimensions.device.char.top,e[te+2]=e8.size.x/this._dimensions.device.canvas.width,e[te+3]=e8.size.y/this._dimensions.device.canvas.height,e[te+4]=e8.texturePage,e[te+5]=e8.texturePositionClipSpace.x,e[te+6]=e8.texturePositionClipSpace.y,e[te+7]=e8.sizeClipSpace.x),e[te+8]=e8.sizeClipSpace.y,this._optionsService.rawOptions.rescaleOverlappingGlyphs&&(c=e8.size.x,d=this._dimensions.device.cell.width,1===h&&c>Math.ceil(1.5*d)&&void 0!==s&&s>255&&!(s>=128512&&s<=128591||s>=127744&&s<=128511||s>=128640&&s<=128767||s>=9728&&s<=9983||s>=9984&&s<=10175||s>=65024&&s<=65039||s>=129280&&s<=129535||s>=127462&&s<=127487)&&!Q(s)&&!(57344<=s&&s<=63743))&&(e[te+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let e=this._terminal,t=e.cols*e.rows*11;this._vertices.count!==t?this._vertices.attributes=new Float32Array(t):this._vertices.attributes.fill(0);let i=0;for(;i<this._vertices.attributesBuffers.length;i++)this._vertices.count!==t?this._vertices.attributesBuffers[i]=new Float32Array(t):this._vertices.attributesBuffers[i].fill(0);this._vertices.count=t,i=0;for(let t=0;t<e.rows;t++)for(let s=0;s<e.cols;s++)this._vertices.attributes[i+9]=s/e.cols,this._vertices.attributes[i+10]=t/e.rows,i+=11}handleResize(){let e=this._gl;e.useProgram(this._program),e.viewport(0,0,e.canvas.width,e.canvas.height),e.uniform2f(this._resolutionLocation,e.canvas.width,e.canvas.height),this.clear()}render(e){if(!this._atlas)return;let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let i=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let t=0;t<e.lineLengths.length;t++){let r=t*this._terminal.cols*11,n=this._vertices.attributes.subarray(r,r+11*e.lineLengths[t]);i.set(n,s),s+=n.length}t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,i.subarray(0,s),t.STREAM_DRAW);for(let e=0;e<this._atlas.pages.length;e++)this._atlas.pages[e].version!==this._atlasTextures[e].version&&this._bindAtlasPageTexture(t,this._atlas,e);t.drawElementsInstanced(t.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,s/11)}setAtlas(e){for(let t of(this._atlas=e,this._atlasTextures))t.version=-1}_bindAtlasPageTexture(e,t,i){e.activeTexture(e.TEXTURE0+i),e.bindTexture(e.TEXTURE_2D,this._atlasTextures[i].texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.pages[i].canvas),e.generateMipmap(e.TEXTURE_2D),this._atlasTextures[i].version=t.pages[i].version}setDimensions(e){this._dimensions=e}},tr=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,i,s=!1){if(this.selectionStart=t,this.selectionEnd=i,!t||!i||t[0]===i[0]&&t[1]===i[1])return void this.clear();let r=e.buffers.active.ydisp,n=t[1]-r,o=i[1]-r,a=Math.max(n,0),h=Math.min(o,e.rows-1);a>=e.rows||h<0?this.clear():(this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=h,this.startCol=t[0],this.endCol=i[0])}isCellSelected(e,t,i){return!!this.hasSelection&&(i-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&i>=this.viewportCappedStartRow&&t<this.endCol&&i<=this.viewportCappedEndRow:t<this.startCol&&i>=this.viewportCappedStartRow&&t>=this.endCol&&i<=this.viewportCappedEndRow:i>this.viewportStartRow&&i<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&i===this.viewportStartRow&&t>=this.startCol)}},tn=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=new tr}resize(e,t){let i=e*t*4;i!==this.cells.length&&(this.cells=new Uint32Array(i),this.lineLengths=new Uint32Array(t))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},to=`#version 300 es
|
|
45
|
+
layout (location = 0) in vec2 a_position;
|
|
46
|
+
layout (location = 1) in vec2 a_size;
|
|
47
|
+
layout (location = 2) in vec4 a_color;
|
|
48
|
+
layout (location = 3) in vec2 a_unitquad;
|
|
49
|
+
|
|
50
|
+
uniform mat4 u_projection;
|
|
51
|
+
|
|
52
|
+
out vec4 v_color;
|
|
53
|
+
|
|
54
|
+
void main() {
|
|
55
|
+
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
56
|
+
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
57
|
+
v_color = a_color;
|
|
58
|
+
}`,ta=`#version 300 es
|
|
59
|
+
precision lowp float;
|
|
60
|
+
|
|
61
|
+
in vec4 v_color;
|
|
62
|
+
|
|
63
|
+
out vec4 outColor;
|
|
64
|
+
|
|
65
|
+
void main() {
|
|
66
|
+
outColor = v_color;
|
|
67
|
+
}`,th=8*Float32Array.BYTES_PER_ELEMENT,tl=class{constructor(){this.attributes=new Float32Array(160),this.count=0}},tc=0,td=0,tu=0,t_=0,tf=0,tg=0,tv=0,tp=class extends y{constructor(e,t,i,s){super(),this._terminal=e,this._gl=t,this._dimensions=i,this._themeService=s,this._vertices=new tl,this._verticesCursor=new tl;let r=this._gl;this._program=Z(e3(r,to,ta)),this._register(L(()=>r.deleteProgram(this._program))),this._projectionLocation=Z(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(L(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let a=new Uint8Array([0,1,2,3]),h=r.createBuffer();this._register(L(()=>r.deleteBuffer(h))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,h),r.bufferData(r.ELEMENT_ARRAY_BUFFER,a,r.STATIC_DRAW),this._attributesBuffer=Z(r.createBuffer()),this._register(L(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,th,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,th,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,th,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,e2),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,i=this._vertices,s=1,r,n,o,a,h,l,c,d,u,_,f;for(r=0;r<t.rows;r++){for(o=-1,a=0,h=0,l=!1,n=0;n<t.cols;n++)c=(r*t.cols+n)*4,d=e.cells[c+1],_=!!(0x4000000&(u=e.cells[c+2])),(d!==a||u!==h&&(l||_))&&((0!==a||l&&0!==h)&&(f=8*s++,this._updateRectangle(i,f,h,a,o,n,r)),o=n,a=d,h=u,l=_);(0!==a||l&&0!==h)&&(f=8*s++,this._updateRectangle(i,f,h,a,o,t.cols,r))}i.count=s}updateCursor(e){let t=this._verticesCursor,i=e.cursor;if(!i||"block"===i.style){t.count=0;return}let s,r=0;("bar"===i.style||"outline"===i.style)&&(s=8*r++,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,"bar"===i.style?i.dpr*i.cursorWidth:i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),("underline"===i.style||"outline"===i.style)&&(s=8*r++,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,(i.y+1)*this._dimensions.device.cell.height-i.dpr,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat)),"outline"===i.style&&(s=8*r++,this._addRectangleFloat(t.attributes,s,i.x*this._dimensions.device.cell.width,i.y*this._dimensions.device.cell.height,i.width*this._dimensions.device.cell.width,i.dpr,this._cursorFloat),s=8*r++,this._addRectangleFloat(t.attributes,s,(i.x+i.width)*this._dimensions.device.cell.width-i.dpr,i.y*this._dimensions.device.cell.height,i.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=r}_updateRectangle(e,t,i,s,r,n,o){if(0x4000000&i)switch(0x3000000&i){case 0x1000000:case 0x2000000:tc=this._themeService.colors.ansi[255&i].rgba;break;case 0x3000000:tc=(0xffffff&i)<<8;break;default:tc=this._themeService.colors.foreground.rgba}else switch(0x3000000&s){case 0x1000000:case 0x2000000:tc=this._themeService.colors.ansi[255&s].rgba;break;case 0x3000000:tc=(0xffffff&s)<<8;break;default:tc=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=function(e,t){let i=new Float32Array(Math.min(2*e.length,t));for(let t=0;t<e.length;t++)i[t]=e[t];return i}(e.attributes,this._terminal.rows*this._terminal.cols*8)),td=r*this._dimensions.device.cell.width,tu=o*this._dimensions.device.cell.height,t_=(tc>>24&255)/255,tf=(tc>>16&255)/255,tg=(tc>>8&255)/255,tv=1,this._addRectangle(e.attributes,t,td,tu,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,t_,tf,tg,tv)}_addRectangle(e,t,i,s,r,n,o,a,h,l){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=a,e[t+6]=h,e[t+7]=l}_addRectangleFloat(e,t,i,s,r,n,o){e[t]=i/this._dimensions.device.canvas.width,e[t+1]=s/this._dimensions.device.canvas.height,e[t+2]=r/this._dimensions.device.canvas.width,e[t+3]=n/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}},tm=class extends y{constructor(e,t,i,s,r,n,o,a){super(),this._container=t,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=a,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${i}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(L(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Z(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,i){}handleSelectionChanged(e,t,i,s=!1){}_setTransparency(e,t){if(t===this._alpha)return;let i=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,i),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=eK(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,i=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,i*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,i,s){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(e,t,i,s){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=e_,this._clipCell(i,s,t.getWidth()),this._ctx.fillText(t.getChars(),i*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,i){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,i*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,i){let s=t?e.options.fontWeightBold:e.options.fontWeight;return`${i?"italic":""} ${s} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},tx=class extends tm{constructor(e,t,i,s,r,n,o){super(i,e,"link",t,!0,r,n,o),this._register(s.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(s.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){var t;if(257===e.fg?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&((0x3000000&(t=e.fg))==0x1000000||(0x3000000&t)==0x2000000)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},tw="object"==typeof window?window:globalThis,tC=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new eq,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new eq,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(i,e),this._onDidChangeZoomLevel.fire(i)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let i=this.getWindowId(t);this.mapWindowIdToFullScreen.set(i,e),this._onDidChangeFullscreen.fire(i)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};tC.INSTANCE=new tC,tC.INSTANCE.onDidChangeZoomLevel,tC.INSTANCE.onDidChangeFullscreen;var tL="object"==typeof navigator?navigator.userAgent:"";tL.indexOf("Firefox"),tL.indexOf("AppleWebKit"),tL.indexOf("Chrome")>=0||tL.indexOf("Safari"),tL.indexOf("Electron/"),tL.indexOf("Android");var tb=!1;if("function"==typeof tw.matchMedia){let e=tw.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=tw.matchMedia("(display-mode: fullscreen)");tb=e.matches,ty=e,"string"==typeof ty&&(ty=tw.matchMedia(ty)),ty.addEventListener("change",({matches:e})=>{tb&&t.matches||(tb=e)})}var ty,tM,tS,tA=!1,tR=!1,tT="en",tk=globalThis;"u">typeof tk.vscode&&"u">typeof tk.vscode.process?tS=tk.vscode.process:"u">typeof process&&"string"==typeof process?.versions?.node&&(tS=process);var tE="string"==typeof tS?.versions?.electron&&tS?.type==="renderer";if("object"==typeof tS){tS.platform,tS.platform,"linux"===tS.platform&&tS.env.SNAP&&tS.env.SNAP_REVISION,tS.env.CI||tS.env.BUILD_ARTIFACTSTAGINGDIRECTORY,tT="en";let e=tS.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,tT=t.resolvedLanguage||"en",t.languagePack?.translationsConfigFile}catch{}tA=!0}else"object"!=typeof navigator||tE?console.error("Unable to resolve platform."):((tM=navigator.userAgent).indexOf("Windows"),tM.indexOf("Macintosh"),(tM.indexOf("Macintosh")>=0||tM.indexOf("iPad")>=0||tM.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,tM.indexOf("Linux"),tM?.indexOf("Mobi"),tR=!0,tT=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var tB=tA;tR&&"function"==typeof tk.importScripts&&tk.origin;var tP,t$=tM,tD=tT;(tG=tP||={}).value=function(){return tD},tG.isDefaultVariant=function(){return 2===tD.length?"en"===tD:tD.length>=3&&"e"===tD[0]&&"n"===tD[1]&&"-"===tD[2]},tG.isDefault=function(){return"en"===tD};var tF="function"==typeof tk.postMessage&&!tk.importScripts,tW=(()=>{if(tF){let e=[];tk.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,s=e.length;i<s;i++){let s=e[i];if(s.id===t.data.vscodeScheduleAsyncWork){e.splice(i,1),s.callback();return}}});let t=0;return i=>{let s=++t;e.push({id:s,callback:i}),tk.postMessage({vscodeScheduleAsyncWork:s},"*")}}return e=>setTimeout(e)})(),tI=!!(t$&&t$.indexOf("Chrome")>=0);t$&&t$.indexOf("Firefox"),!tI&&t$&&t$.indexOf("Safari"),t$&&t$.indexOf("Edg/"),t$&&t$.indexOf("Android");var tz="object"==typeof navigator?navigator:{};tB||document.queryCommandSupported&&document.queryCommandSupported("copy")||tz&&tz.clipboard&&tz.clipboard.writeText,tB||tz&&tz.clipboard&&tz.clipboard.readText,tB||tb||tz.keyboard,"ontouchstart"in tw||tz.maxTouchPoints,tw.PointerEvent&&("ontouchstart"in tw||navigator.maxTouchPoints);var tO=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},tU=new tO,tN=new tO,tq=new tO;(tH=tV||={}).toString=function(e){return tU.keyCodeToStr(e)},tH.fromString=function(e){return tU.strToKeyCode(e)},tH.toUserSettingsUS=function(e){return tN.keyCodeToStr(e)},tH.toUserSettingsGeneral=function(e){return tq.keyCodeToStr(e)},tH.fromUserSettings=function(e){return tN.strToKeyCode(e)||tq.strToKeyCode(e)},tH.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return tU.keyCodeToStr(e)};var tG,tH,tV,tj,tY=Object.freeze(function(e,t){let i=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(i)}}});(h=tj||={}).isCancellationToken=function(e){return e===h.None||e===h.Cancelled||e instanceof tX||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},h.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:eD.None}),h.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:tY});var tX=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?tY:(this._emitter||(this._emitter=new eq),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay"),(l=c||={}).settled=async function(e){let t,i=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||(t=e)})));if("u">typeof t)throw t;return i},l.withAsyncBody=function(e){return new Promise(async(t,i)=>{try{await e(t,i)}catch(e){i(e)}})};var tZ=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let i of t)e.emitOne(i)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new eq,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await eD.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,i){return new e(async e=>{for await(let s of t)e.emitOne(i(s))})}map(t){return e.map(this,t)}static filter(t,i){return new e(async e=>{for await(let s of t)i(s)&&e.emitOne(s)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let i of e)t.push(i);return t}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};tZ.EMPTY=tZ.fromArray([]);function tQ(e,t){return(t<<5)-t+e|0}function tK(e,t){t=tQ(149417,t);for(let i=0,s=e.length;i<s;i++)t=tQ(e.charCodeAt(i),t);return t}new DataView(new ArrayBuffer(320));var{registerWindow:tJ,getWindow:t0,getDocument:t5,getWindows:t1,getWindowsCount:t2,getWindowId:t3,getWindowById:t4,hasWindow:t8,onDidRegisterWindow:t6,onWillUnregisterWindow:t7,onDidUnregisterWindow:t9}=(s=new Map,r={window:tw,disposables:new b},s.set(tw.vscodeWindowId,r),n=new eq,o=new eq,a=new eq,{onDidRegisterWindow:n.event,onWillUnregisterWindow:a.event,onDidUnregisterWindow:o.event,registerWindow(e){var t,i;if(s.has(e.vscodeWindowId))return y.None;let r=new b,h={window:e,disposables:r.add(new b)};return s.set(e.vscodeWindowId,h),r.add(L(()=>{s.delete(e.vscodeWindowId),o.fire(e)})),r.add((t=e,i=ii.BEFORE_UNLOAD,new ie(t,i,()=>{a.fire(e)},void 0))),n.fire(h),r},getWindows:()=>s.values(),getWindowsCount:()=>s.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>s.has(e),getWindowById:function(e,t){return("number"==typeof e?s.get(e):void 0)??(t?r:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:tw,getDocument:e=>t0(e).document}),ie=class{constructor(e,t,i,s){this._node=e,this._type=t,this._handler=i,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}},it=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,i=this.height){return t!==this.width||i!==this.height?new e(t,i):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t||!!e&&!!t&&e.width===t.width&&e.height===t.height}};it.None=new it(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,i){let s=this.mutationObservers.get(e);s||(s=new Map,this.mutationObservers.set(e,s));let r=function e(t,i){switch(typeof t){case"object":var s,r,n,o;return null===t?tQ(349,i):Array.isArray(t)?(s=t,r=tQ(104579,r=i),s.reduce((t,i)=>e(i,t),r)):(n=t,o=tQ(181387,o=i),Object.keys(n).sort().reduce((t,i)=>(t=tK(i,t),e(n[i],t)),o));case"string":return tK(t,i);case"boolean":return tQ(t?433:863,i);case"number":return tQ(t,i);case"undefined":return tQ(937,i);default:return tQ(617,i)}}(i,0),n=s.get(r);if(n)n.users+=1;else{let o=new eq,a=new MutationObserver(e=>o.fire(e));a.observe(e,i);let h=n={users:1,observer:a,onDidMutate:o.event};t.add(L(()=>{h.users-=1,0===h.users&&(o.dispose(),a.disconnect(),s?.delete(r),s?.size===0&&this.mutationObservers.delete(e))})),s.set(r,n)}return n.onDidMutate}};var ii={BEFORE_UNLOAD:"beforeunload"},is=class extends y{constructor(e,t,i,s,r,n,o,a,h){if(super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=i,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=a,this._cursorBlinkStateManager=new M,this._charAtlasDisposable=this._register(new M),this._observerDisposable=this._register(new M),this._model=new tn,this._workCell=new e1,this._workCell2=new e1,this._rectangleRenderer=this._register(new M),this._glyphRenderer=this._register(new M),this._onChangeTextureAtlas=this._register(new eq),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new eq),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new eq),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new eq),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new eq),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._gl=this._canvas.getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:h}),!this._gl)throw Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new eu(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new tx(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions={css:{canvas:J(),cell:J()},device:{canvas:J(),cell:J(),char:{width:0,height:0,left:0,top:0}}},this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(new ie(this._canvas,"webglcontextlost",e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e)},3e3)},void 0)),this._register(new ie(this._canvas,"webglcontextrestored",e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,eJ(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()},void 0)),this._observerDisposable.value=e5(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=e5(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(L(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),eJ(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){for(let e of(this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._renderLayers))e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,i){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,e,t,i);this._model.selection.update(this._core,e,t,i),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new tp(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new ts(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=eK(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=C(eD.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),eD.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){for(let e of(this._clearModel(!0),this._renderLayers))e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached)if(!this._core.screenElement?.isConnected||!this._charSizeService.width||!this._charSizeService.height)return;else this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;for(let i of this._renderLayers)i.handleGridChanged(this._terminal,e,t);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new e0(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let i=this._core,s=this._workCell,r,n,o,a,h,l,c=0,d=!0,u,_,f,g,v,p,m,x,w;e=io(e,i.rows-1,0),t=io(t,i.rows-1,0);let C=this._coreService.decPrivateModes.cursorStyle??i.options.cursorStyle??"block",L=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,b=L-i.buffer.ydisp,y=Math.min(this._terminal.buffer.active.cursorX,i.cols-1),M=-1,S=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let A=!1;for(n=e;n<=t;n++)for(o=n+i.buffer.ydisp,a=i.buffer.lines.get(o),this._model.lineLengths[n]=0,f=L===o,c=0,h=this._characterJoinerService.getJoinedCharacters(o),x=0;x<i.cols;x++){if(r=this._cellColorResolver.result.bg,a.loadCell(x,s),0===x&&(r=this._cellColorResolver.result.bg),l=!1,d=x>=c,u=x,h.length>0&&x===h[0][0]&&d){_=h.shift();let e=this._model.selection.isCellSelected(this._terminal,_[0],o);for(m=_[0]+1;m<_[1];m++)d&&=e===this._model.selection.isCellSelected(this._terminal,m,o);(d&&=!f||y<_[0]||y>=_[1])?(l=!0,s=new ir(s,a.translateToString(!0,_[0],_[1]),_[1]-_[0]),u=_[1]-1):c=_[1]}if(g=s.getChars(),v=s.getCode(),m=(n*i.cols+x)*4,this._cellColorResolver.resolve(s,x,o,this.dimensions.device.cell.width),S&&o===L&&(x===y&&(this._model.cursor={x:y,y:b,width:s.getWidth(),style:this._coreBrowserService.isFocused?C:i.options.cursorInactiveStyle,cursorWidth:i.options.cursorWidth,dpr:this._devicePixelRatio},M=y+s.getWidth()-1),x>=y&&x<=M&&(this._coreBrowserService.isFocused&&"block"===C||!1===this._coreBrowserService.isFocused&&"block"===i.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=0x3000000|this._themeService.colors.cursorAccent.rgba>>8&0xffffff,this._cellColorResolver.result.bg=0x3000000|this._themeService.colors.cursor.rgba>>8&0xffffff)),0!==v&&(this._model.lineLengths[n]=x+1),(this._model.cells[m]!==v||this._model.cells[m+1]!==this._cellColorResolver.result.bg||this._model.cells[m+2]!==this._cellColorResolver.result.fg||this._model.cells[m+3]!==this._cellColorResolver.result.ext)&&(A=!0,g.length>1&&(v|=0x80000000),this._model.cells[m]=v,this._model.cells[m+1]=this._cellColorResolver.result.bg,this._model.cells[m+2]=this._cellColorResolver.result.fg,this._model.cells[m+3]=this._cellColorResolver.result.ext,p=s.getWidth(),this._glyphRenderer.value.updateCell(x,n,v,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,g,p,r),l)){for(s=this._workCell,x++;x<=u;x++)w=(n*i.cols+x)*4,this._glyphRenderer.value.updateCell(x,n,0,0,0,0,"",0,0),this._model.cells[w]=0,this._model.cells[w+1]=this._cellColorResolver.result.bg,this._model.cells[w+2]=this._cellColorResolver.result.fg,this._model.cells[w+3]=this._cellColorResolver.result.ext;x--}}A&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=1===this._optionsService.rawOptions.lineHeight?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},ir=class extends eR{constructor(e,t,i){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=i}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function io(e,t,i=0){return Math.max(Math.min(e,t),i)}var ia="di$target",ih="di$dependencies",il=new Map;function ic(e){if(il.has(e))return il.get(e);let t=function(e,i,s){var r,n,o;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");r=t,n=e,o=s,n[ia]===n?n[ih].push({id:r,index:o}):(n[ih]=[{id:r,index:o}],n[ia]=n)};return t._id=e,il.set(e,t),t}ic("BufferService"),ic("CoreMouseService"),ic("CoreService"),ic("CharsetService"),ic("InstantiationService"),ic("LogService");var id=ic("OptionsService");ic("OscLinkService"),ic("UnicodeService"),ic("DecorationService");var iu={trace:0,debug:1,info:2,warn:3,error:4,off:5},i_=class extends y{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=iu[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)"function"==typeof e[t]&&(e[t]=e[t]())}_log(e,t,i){this._evalLazyOptionalParams(i),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+t,...i)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};i_=((e,t)=>{for(var i,s=t,r=e.length-1;r>=0;r--)(i=e[r])&&(s=i(s)||s);return s})([(e,t)=>id(e,t,0)],i_);var ig=class extends y{constructor(e){if(E&&16>function(){if(!E)return 0;let e=A.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}()&&!document.createElement("canvas").getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error("Webgl2 is only supported on Safari 16 and above");super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new eq),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new eq),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new eq),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new eq),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element)return void this._register(t.onWillOpen(()=>this.activate(e)));this._terminal=e;let i=t.coreService,s=t.optionsService,r=t._renderService,n=t._characterJoinerService,o=t._charSizeService,a=t._coreBrowserService,h=t._decorationService,l=t._logService,c=t._themeService;this._renderer=this._register(new is(e,n,o,a,i,h,s,c,this._preserveDrawingBuffer)),this._register(eD.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(eD.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(eD.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(eD.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),r.setRenderer(this._renderer),this._register(L(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}};i.d(t,{WebglAddon:()=>ig})}}]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*! LICENSE: nam.b5663e919f.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["nam"],{uf(e,t,n){n.d(t,{P:()=>Y});var r=n("j"),i=n("H");let l=/[^a-z0-9]([a-z0-9]+)$/i;function a(e,t){e.stack.length&&e.offset>-1&&(e.stack=e.stack.slice(0,e.offset+1)),e.stack.push(t),e.offset=e.stack.length-1}function s(e,t){return e.substring(0,t).split("\n").pop()?.match(l)?.[1]}function o(e,t){let n="undo"===t?e.offset-1:e.offset+1,r=e.stack[n];return r?(e.offset="undo"===t?Math.max(n,0):Math.min(n,e.stack.length-1),r):null}let c=`
|
|
3
|
+
.code-editor-native-textarea {
|
|
4
|
+
-webkit-text-fill-color: transparent;
|
|
5
|
+
}
|
|
6
|
+
.code-editor-native-textarea::placeholder {
|
|
7
|
+
-webkit-text-fill-color: var(--theme-ink);
|
|
8
|
+
opacity: 0.45;
|
|
9
|
+
}
|
|
10
|
+
`;function d(){return(0,r.Y)("style",{dangerouslySetInnerHTML:{__html:c}})}function u(e,t){return e.substring(0,t).split("\n")}function h(e){let{value:t,onValueChange:n,highlight:l,padding:c=0,preClassName:h,textareaClassName:f,style:p,preRef:m,className:x,placeholder:g,readOnly:b,autoFocus:y,virtual:v}=e,k=(0,i.li)(null),w=(0,i.li)({stack:[],offset:-1}),[N,Y]=(0,i.J0)(!0);(0,i.vJ)(()=>{let e=k.current;e&&a(w.current,{value:e.value,selectionStart:e.selectionStart,selectionEnd:e.selectionEnd,timestamp:Date.now()})},[t]);let S=e=>{let t=k.current,r=w.current.stack[w.current.offset];r&&t&&(w.current.stack[w.current.offset]={...r,selectionStart:t.selectionStart,selectionEnd:t.selectionEnd}),function(e,t){if(a(e,t),e.stack.length<=100)return;let n=e.stack.length-100;e.stack=e.stack.slice(n),e.offset=Math.max(e.offset-n,0)}(w.current,{...e,timestamp:Date.now()}),n(e.value),t&&(t.value=e.value,t.selectionStart=e.selectionStart,t.selectionEnd=e.selectionEnd)},D={margin:0,border:0,background:"none",boxSizing:"inherit",display:"inherit",fontFamily:"inherit",fontSize:"inherit",fontStyle:"inherit",fontVariantLigatures:"inherit",fontWeight:"inherit",letterSpacing:"inherit",lineHeight:"inherit",tabSize:"inherit",textIndent:"inherit",textRendering:"inherit",textTransform:"inherit",whiteSpace:"pre-wrap",wordBreak:"keep-all",overflowWrap:"break-word"},F={paddingTop:c,paddingRight:c,paddingBottom:c,paddingLeft:c},C={...F,paddingTop:c+(v?.top??0),paddingBottom:c+(v?.bottom??0)},z=l(t,v??null);return(0,r.FD)("div",{className:x,style:{position:"relative",textAlign:"left",boxSizing:"border-box",padding:0,overflow:"hidden",...p},children:[(0,r.Y)("pre",{ref:m,className:h,"aria-hidden":"true",style:{...D,...C,position:"relative",pointerEvents:"none"},dangerouslySetInnerHTML:{__html:z+(v&&!v.breakAtEnd?"":"<br />")}}),(0,r.Y)("textarea",{ref:k,className:`code-editor-native-textarea${f?` ${f}`:""}`,style:{...D,...F,position:"absolute",top:0,left:0,height:"100%",width:"100%",resize:"none",color:"inherit",overflow:"hidden",WebkitTextFillColor:"transparent"},value:t,onChange:e=>{let{value:t,selectionStart:r,selectionEnd:i}=e.target,l=w.current,o=Date.now();if(function(e,t,n,r){if(!e||r-e.timestamp>=3e3)return!1;let i=s(e.value,e.selectionStart),l=s(t,n);return!!(i&&l?.startsWith(i))}(l.stack[l.offset],t,r,o)){l.stack=l.stack.slice(0,l.offset+1),l.stack[l.offset]={value:t,selectionStart:r,selectionEnd:i,timestamp:o},n(t);return}a(l,{value:t,selectionStart:r,selectionEnd:i,timestamp:o}),n(t)},onKeyDown:e=>{if("Escape"===e.key)return void e.currentTarget.blur();let{value:t,selectionStart:r,selectionEnd:i}=e.currentTarget,l=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform),a=/Win/i.test(navigator.platform);if("Tab"===e.key&&N){if(e.preventDefault(),e.shiftKey){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=t.split("\n").map((e,t)=>t>=n&&t<=l&&e.startsWith(" ")?e.substring(2):e).join("\n");if(a!==t){let l=e[n];S({value:a,selectionStart:l?.startsWith(" ")?r-2:r,selectionEnd:i-(t.length-a.length)})}}else if(r!==i){let e=u(t,r),n=e.length-1,l=u(t,i).length-1,a=e[n];S({value:t.split("\n").map((e,t)=>t>=n&&t<=l?" "+e:e).join("\n"),selectionStart:a&&/\S/.test(a)?r+2:r,selectionEnd:i+2*(l-n+1)})}else{let e=r+2;S({value:t.substring(0,r)+" "+t.substring(i),selectionStart:e,selectionEnd:e})}return}if("Backspace"===e.key&&r===i){if(t.substring(0,r).endsWith(" ")){e.preventDefault();let n=r-2;S({value:t.substring(0,r-2)+t.substring(i),selectionStart:n,selectionEnd:n})}return}if("Enter"===e.key&&r===i){let n=u(t,r).pop(),l=n?.match(/^\s+/);if(l?.[0]){e.preventDefault();let n="\n"+l[0],a=r+n.length;S({value:t.substring(0,r)+n+t.substring(i),selectionStart:a,selectionEnd:a})}return}if((l?e.metaKey&&"z"===e.key.toLowerCase():e.ctrlKey&&"z"===e.key.toLowerCase())&&!e.shiftKey&&!e.altKey){e.preventDefault();let t=o(w.current,"undo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}if((l?e.metaKey&&e.shiftKey&&"z"===e.key.toLowerCase():a?e.ctrlKey&&"y"===e.key.toLowerCase():e.ctrlKey&&e.shiftKey&&"z"===e.key.toLowerCase())&&!e.altKey){e.preventDefault();let t=o(w.current,"redo");t&&k.current&&(k.current.value=t.value,k.current.selectionStart=t.selectionStart,k.current.selectionEnd=t.selectionEnd,n(t.value));return}e.ctrlKey&&"m"===e.key.toLowerCase()&&(!l||e.shiftKey)&&(e.preventDefault(),Y(e=>!e))},placeholder:g,readOnly:b,autoFocus:y,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellcheck:!1,"data-gramm":!1}),(0,r.Y)(d,{})]})}let f=["direction","fontFamily","fontFeatureSettings","fontKerning","fontSize","fontStyle","fontVariantLigatures","fontWeight","letterSpacing","overflowWrap","tabSize","textRendering","textTransform","whiteSpace","wordBreak","wordSpacing"],p=null,m=[],x="",g=new Map,b=[];function y(e){if("u"<typeof document||!e.isConnected)return null;let t=Number.parseFloat(getComputedStyle(e).lineHeight);return Number.isFinite(t)&&t>0?t:null}function v(e,t,n){return e<t?t:e>n?n:e}function k(e){return{start:0,end:v(200,1,Math.max(e,1))}}var w=n("Po"),N=n("DU");function Y(e){var t;let{value:n,onValueChange:l,language:a,wordWrap:s,rootClassName:o,gutterClassName:c,gutterStyle:d,gutterLineClassName:u,editorWrapperClassName:Y,editorClassName:S,editorPadding:D=0,editorStyle:F}=e,C=s?"!whitespace-pre-wrap !break-words":"!whitespace-pre !break-normal",z=(0,i.li)(null),M=(0,i.li)(null),[T,A]=(0,i.J0)(null),[E,L]=(0,i.J0)(null),[j,W]=(0,i.J0)(-1);(0,w.w)();let $=(0,i.Kr)(()=>(function(e){let t=1;for(let n=e.indexOf("\n");-1!==n;n=e.indexOf("\n",n+1))t++;return t})(n),[n]),H=(0,i.hb)(()=>{let e=z.current;if(!e)return;let t=s?function(e,t){let n=y(e);if(null===n)return null;let r=getComputedStyle(e),i=e.clientWidth-Number.parseFloat(r.paddingLeft||"0")-Number.parseFloat(r.paddingRight||"0");if(i<=0)return null;let l=(p&&p.isConnected||((p=document.createElement("div")).setAttribute("aria-hidden","true"),p.style.cssText="position:fixed;top:0;left:-100000px;visibility:hidden;pointer-events:none;margin:0;border:0;padding:0;box-sizing:border-box;",document.body.appendChild(p),m=[]),p);for(let e of f)l.style[e]=r[e];l.style.lineHeight=`${n}px`,l.style.width=`${i}px`;let a=`${i}|${n}|${f.map(e=>r[e]).join("|")}`;a!==x&&(x=a,g.clear());let s=t.split("\n"),o=Array(s.length),c=0;for(let e=0;e<s.length;e++){let t=g.get(s[e]);void 0===t?b[c++]=e:o[e]=t}if(c>0){for(;m.length<c;){let e=document.createElement("div");l.appendChild(e),m.push(e)}for(let e=0;e<c;e++)m[e].textContent=s[b[e]];for(let e=0;e<c;e++){let t=b[e],r=m[e].getBoundingClientRect().height,i=r>n?Math.round(r/n)*n:n;o[t]=i,g.set(s[t],i)}if(g.size>1e5){let e=g.size-5e4;for(let t of g.keys()){if(e--<=0)break;g.delete(t)}}}return{rowHeight:n,heights:o}}(e,n):null;A(e=>e===t||e&&t&&e.rowHeight===t.rowHeight&&e.heights.length===t.heights.length&&e.heights.every((e,n)=>e===t.heights[n])?e:t);let r=t?.rowHeight??y(e);L(e=>e===r?e:r),W($)},[n,$,s,D,F?.fontSize]);(0,i.Nf)(()=>{H()},[H]);let J=(0,i.li)(H);J.current=H,(0,i.vJ)(()=>{let e=z.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>J.current());return t.observe(e),()=>t.disconnect()},[]);let O=(0,i.Kr)(()=>null===E?null:T?function(e,t,n){if(0===n||e.length!==n)return null;let r=new Float64Array(n+1);for(let t=0;t<n;t++)r[t+1]=r[t]+e[t];let i=r[n];return{lineCount:n,rowHeight:t,totalHeight:i,offsetOf:e=>r[v(e,0,n)],lineAt:e=>{if(e<0)return 0;if(i<=0||e>=i)return n-1;let t=0,l=n-1;for(;t<l;){let n=t+l+1>>1;r[n]<=e?t=n:l=n-1}return t}}}(T.heights,T.rowHeight,$):{lineCount:$,rowHeight:E,totalHeight:E*$,offsetOf:e=>E*v(e,0,$),lineAt:e=>v(Math.floor(e/E),0,Math.max($-1,0))},[E,T,$]),R=(t=n.length,$>300||t>2e4),K=function(e){var t,n;let r,l,{rootRef:a,lineCount:s,geometry:o,enabled:c}=e,[d,u]=(0,i.J0)(null),h=(0,i.hb)(()=>{let e,t,n,r,i=a.current;if(!c||!i)return;let l=o?(e=i.getBoundingClientRect().top,n=(t=function(e){for(let t=e.parentElement;t;t=t.parentElement){let e=getComputedStyle(t).overflowY;if(("auto"===e||"scroll"===e||"overlay"===e)&&t.scrollHeight>t.clientHeight)return t}return null}(i))?t.getBoundingClientRect().top:0,r=t?t.getBoundingClientRect().bottom:globalThis.innerHeight||o.rowHeight,function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:24,i=e.lineAt(t),l=e.lineAt(t+Math.max(n,0));return{start:Math.max(0,i-r),end:Math.min(e.lineCount,Math.max(l+1,i+1)+r)}}(o,n-e,r-n)):k(s);u(e=>e===l||null!==e&&null!==l&&e.start===l.start&&e.end===l.end?e:l)},[c,o,s,a]);(0,i.Nf)(()=>{h()},[h]);let f=(0,i.li)(h);if(f.current=h,(0,i.vJ)(()=>{if(!c)return;let e=0,t=()=>{e||(e=requestAnimationFrame(()=>{e=0,f.current()}))};window.addEventListener("scroll",t,{passive:!0,capture:!0}),window.addEventListener("resize",t);let n="u"<typeof ResizeObserver?null:new ResizeObserver(t),r=a.current;return r&&n?.observe(r),()=>{e&&cancelAnimationFrame(e),window.removeEventListener("scroll",t,{capture:!0}),window.removeEventListener("resize",t),n?.disconnect()}},[c,a]),!c)return null;if(!o){let e=k(s);return{...e,top:0,bottom:0,breakAtEnd:e.end>=s}}return t=d??k(o.lineCount),n=o.lineCount,{...l={start:r=v(t.start,0,Math.max(n-1,0)),end:v(t.end,r+1,Math.max(n,1))},...{top:o.offsetOf(l.start),bottom:Math.max(0,o.totalHeight-o.offsetOf(l.end)),breakAtEnd:l.end>=o.lineCount}}}({rootRef:M,lineCount:$,geometry:O,enabled:R&&(j!==$||null!==O)}),P=(0,i.hb)((e,t)=>t?function(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{contextLines:i=40,maxLineLength:l=12e3}=r,a=e.split("\n"),s=Math.min(Math.max(n.start,0),a.length),o=Math.min(Math.max(n.end,s),a.length);if(s===o)return"";let c=Math.max(0,s-i),d=(0,N.O9)(a.slice(c,o).join("\n"),t,{maxLineLength:l}),u=s-c;return`<span class="shiki">${d.slice(u,u+(o-s)).join("\n")}</span>`}(e,a,t):(0,N.wY)(e,a),[a]),U=K?K.start:0,B=K?Math.min(K.end,$):$,I=[];for(let e=U;e<B;e++)I.push(e);let _=T&&T.heights.length===$?T.heights:null;return(0,r.FD)("div",{className:o,ref:M,children:[(0,r.FD)("div",{className:c,style:d,children:[K&&K.top>0?(0,r.Y)("div",{style:{height:K.top,flexShrink:0},"aria-hidden":"true"}):null,I.map(e=>(0,r.Y)("div",{className:u,style:_?{height:_[e],flexShrink:0}:void 0,children:e+1},e+1))]}),(0,r.Y)("div",{className:Y,children:(0,r.Y)(h,{value:n,onValueChange:l,highlight:P,padding:D,preRef:z,textareaClassName:`focus:outline-none ${C}`,preClassName:C,style:F,className:S,virtual:K})})]})}},Xg(e,t,n){n.d(t,{M:()=>D});var r=n("j"),i=n("H"),l=n("X"),a=n("FL"),s=n("DU"),o=n("lP"),c=n("y");let d=(0,c.A)({name:"text-align-justify",size:24,node:[["path",{d:"M3 5h18",key:"1u36vt"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 19h18",key:"awlh7x"}]],aliases:["align-justify"]}),u=(0,c.A)({name:"space",size:24,node:[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]});var h=n("n"),f=n("z"),p=n("b0"),m=n("I"),x=n("DV"),g=n("r"),b=n("AB"),y=n("ob"),v=n("LQ");function k(e){let{filePath:t,status:n,isStaged:i,viewMode:l,ignoreWhitespace:a,additions:s,deletions:c,isLoading:k,isCopied:w,onToggleViewMode:N,onToggleWhitespace:Y,onStageUnstage:S,onDiscard:D,onOpenInEditor:F,onRefresh:C,onCopyDiff:z}=e,M=t.split("/").pop()||t,T=(0,v.R)(n,i);return(0,r.FD)("div",{className:"flex items-center justify-between px-3 py-1.5 bg-paper border-b border-ink/10 text-xs font-sans select-none flex-shrink-0 overflow-x-auto no-scrollbar",children:[(0,r.FD)("div",{className:"hidden md:flex items-center space-x-2 min-w-0 pr-2",children:[(0,r.Y)(y.o,{name:M,size:14,className:"flex-shrink-0"}),(0,r.Y)("span",{className:"font-mono text-ink font-medium truncate",title:t,children:M}),(0,r.FD)("span",{className:`px-1.5 py-0.5 text-[10px] font-mono font-semibold rounded border ${T.badgeBgClass} flex-shrink-0`,children:[T.charStatus," ",T.label]}),(s>0||c>0)&&(0,r.FD)("div",{className:"flex items-center space-x-1.5 text-[11px] font-mono flex-shrink-0 ml-1",children:[s>0&&(0,r.FD)("span",{className:"text-success font-semibold",children:["+",s]}),c>0&&(0,r.FD)("span",{className:"text-error font-semibold",children:["-",c]})]})]}),(0,r.FD)("div",{className:"flex items-center space-x-1 text-ink/70 flex-shrink-0 ml-auto",children:[(0,r.FD)("div",{className:"flex items-center bg-canvas rounded border border-ink/15 p-0.5 mr-1",children:[(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"split"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Split (side-by-side) Diff",children:[(0,r.Y)(o.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Split"})]}),(0,r.FD)("button",{type:"button",onClick:N,className:`px-2 py-0.5 rounded text-[11px] font-medium flex items-center space-x-1 transition-colors ${"unified"===l?"bg-paper text-ink shadow-xs":"text-ink/60 hover:text-ink"}`,title:"Unified Diff",children:[(0,r.Y)(d,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Unified"})]})]}),(0,r.Y)("button",{type:"button",onClick:Y,className:`p-1.5 rounded transition-colors ${a?"bg-ink/10 text-ink":"text-ink/50 hover:text-ink hover:bg-ink/5"}`,title:a?"Whitespace ignored":"Ignore whitespace",children:(0,r.Y)(u,{size:13})}),(0,r.Y)("button",{type:"button",onClick:C,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Refresh Diff",disabled:k,children:(0,r.Y)(h.A,{size:13,className:k?"animate-spin":""})}),(0,r.Y)("button",{type:"button",onClick:z,className:"p-1.5 text-ink/50 hover:text-ink hover:bg-ink/5 rounded transition-colors",title:"Copy Diff Text",children:w?(0,r.Y)(f.A,{size:13,className:"text-success"}):(0,r.Y)(p.A,{size:13})}),!i&&(0,r.Y)("button",{type:"button",onClick:D,className:"p-1.5 text-ink/50 hover:text-error hover:bg-error/10 rounded transition-colors",title:"Discard changes in this file",children:(0,r.Y)(m.A,{size:13})}),(0,r.Y)("button",{type:"button",onClick:S,className:"px-2 py-1 text-[11px] font-medium rounded border border-ink/15 hover:bg-ink/5 flex items-center space-x-1 transition-colors text-ink",title:i?"Unstage file":"Stage file",children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)(x.A,{size:12}),(0,r.Y)("span",{children:"Unstage"})]}):(0,r.FD)(r.FK,{children:[(0,r.Y)(g.A,{size:12}),(0,r.Y)("span",{children:"Stage"})]})}),F&&(0,r.FD)("button",{type:"button",onClick:F,className:"px-2 py-1 text-[11px] font-medium rounded bg-ink text-canvas hover:bg-ink/90 flex items-center space-x-1 transition-colors shadow-xs ml-1",title:"Open in Code Editor",children:[(0,r.Y)(b.A,{size:12}),(0,r.Y)("span",{className:"hidden sm:inline",children:"Edit File"})]})]})]})}var w=n("Po");function N(e){let{lines:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=-1,i=i=>{if(r<0)return;let l=(0,s.O9)(t.slice(r,i).map(e=>e.text).join("\n"),n);for(let t=r;t<i;t++)e[t]=l[t-r]??"";r=-1};return t.forEach((e,t)=>{"meta"===e.type?i(t):r<0&&(r=t)}),i(t.length),e},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.Y)("table",{className:"w-max min-w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if("meta"===e.type)return(0,r.FD)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:[(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"w-12 text-center py-1 px-2 text-[10px] opacity-60 border-r border-ink/10 font-mono",children:"..."}),(0,r.Y)("td",{className:"py-1 px-3 text-[11px] font-semibold text-meta font-mono tracking-tight",children:e.text})]},t);let n="add"===e.type,i="del"===e.type;return(0,r.FD)("tr",{className:`transition-colors group ${n?"bg-success/10 hover:bg-success/15":i?"bg-error/10 hover:bg-error/15":"hover:bg-ink/[0.03]"}`,children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${i?"bg-error/15 text-error font-semibold":n?"bg-success/15 text-success/70":"bg-canvas/50 text-ink/40"}`,children:e.oldLineNumber||""}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${n?"bg-success/15 text-success font-semibold":i?"bg-error/15 text-error/70":"bg-canvas/50 text-ink/40"}`,children:e.newLineNumber||""}),(0,r.FD)("td",{className:"py-0.5 px-3 whitespace-pre text-ink pr-6",children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${n?"text-success":i?"text-error":"opacity-0"}`,children:n?"+":i?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:e.text&&a[t]||" "}})]})]},t)})})})})}function Y(e){let{rows:t,language:n}=e,l=(0,w.w)(),a=(0,i.Kr)(()=>{let e=Array(t.length).fill(""),r=Array(t.length).fill(""),i=-1,l=l=>{if(i<0)return;let a=t.slice(i,l),o=(0,s.O9)(a.map(e=>e.left?.text??"").join("\n"),n),c=(0,s.O9)(a.map(e=>e.right?.text??"").join("\n"),n);for(let t=i;t<l;t++)e[t]=o[t-i]??"",r[t]=c[t-i]??"";i=-1};return t.forEach((e,t)=>{e.isMeta?l(t):i<0&&(i=t)}),l(t.length),{left:e,right:r}},[t,n,l]);return 0===t.length?(0,r.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40 font-mono text-xs p-8",children:"No differences between working file and target."}):(0,r.Y)("div",{className:"w-full h-full overflow-auto font-mono text-xs select-text bg-paper text-ink code-surface",children:(0,r.FD)("div",{className:"w-max min-w-full min-w-[700px]",children:[(0,r.FD)("div",{className:"grid grid-cols-2 sticky top-0 z-10 bg-canvas border-b border-ink/10 text-[11px] text-ink/70 font-sans select-none shadow-xs",children:[(0,r.Y)("div",{className:"px-3 py-1 font-medium border-r border-ink/10 flex items-center justify-between",children:(0,r.Y)("span",{children:"Original (HEAD / Base)"})}),(0,r.Y)("div",{className:"px-3 py-1 font-medium flex items-center justify-between",children:(0,r.Y)("span",{children:"Modified (Working Tree)"})})]}),(0,r.Y)("table",{className:"w-full border-collapse",children:(0,r.Y)("tbody",{children:t.map((e,t)=>{if(e.isMeta)return(0,r.Y)("tr",{className:"bg-canvas border-y border-ink/10 text-meta select-none",children:(0,r.Y)("td",{colSpan:4,className:"py-1 px-3 text-[11px] font-semibold text-meta text-center font-mono",children:e.metaText})},t);let n=e.left,i=e.right,l=n?.type==="del",s=i?.type==="add";return(0,r.FD)("tr",{className:"border-b border-ink/[0.04]",children:[(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${l?"bg-error/15 text-error font-semibold":n?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:n?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre border-r border-ink/10 text-ink ${l?"bg-error/10":n?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:n?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${l?"text-error":"opacity-0"}`,children:l?"-":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:n.text&&a.left[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})}),(0,r.Y)("td",{className:`w-12 py-0.5 px-2 text-right text-[10px] select-none border-r border-ink/10 font-mono ${s?"bg-success/15 text-success font-semibold":i?"bg-canvas/50 text-ink/40":"bg-canvas/80 text-transparent"}`,children:i?.lineNumber||""}),(0,r.Y)("td",{className:`min-w-[320px] py-0.5 px-2 whitespace-pre text-ink ${s?"bg-success/10":i?"hover:bg-ink/[0.02]":"bg-canvas/40 select-none"}`,children:i?(0,r.FD)(r.FK,{children:[(0,r.Y)("span",{className:`inline-block w-4 text-center select-none font-bold ${s?"text-success":"opacity-0"}`,children:s?"+":" "}),(0,r.Y)("span",{className:"shiki",dangerouslySetInnerHTML:{__html:i.text&&a.right[t]||" "}})]}):(0,r.Y)("span",{className:"opacity-0",children:" "})})]},t)})})})]})})}var S=n("p");function D(e){let{filePath:t,status:n="M",isStaged:o=!1,root:c,repo:d=".",onOpenInEditor:u,onFileSaved:f,className:p=""}=e,[m,x]=(0,a.LO)("diff.viewMode","unified"),[g,b]=(0,a.LO)("diff.ignoreWhitespace",!1),[y,v]=(0,i.J0)(""),[w,D]=(0,i.J0)(n),[F,C]=(0,i.J0)(o),[z,M]=(0,i.J0)(!0),[T,A]=(0,i.J0)(null),[E,L]=(0,i.J0)(!1),[j,W]=(0,i.J0)(!1),$=(0,l.L)(),H=(0,i.hb)(async()=>{if(t){M(!0),A(null);try{let e=new URLSearchParams({fileDiff:"1",file:t,staged:F?"1":"0",repo:d||"."});(n||w)&&e.set("status",n||w),c&&e.set("root",c);let r=await fetch(`/api/fs/git?${e.toString()}`),i=await r.json();i.success?(v(i.diff||""),i.status&&D(i.status)):A(i.error||"Failed to load file diff")}catch(e){A(e.message||"Error fetching diff")}finally{M(!1)}}},[t,F,d,c]);(0,i.vJ)(()=>{D(n),C(o)},[n,o,t]),(0,i.vJ)(()=>{H()},[H]);let J=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=[],r=[],i=0,l=0;if(!e||!e.trim())return{lines:n,splitRows:r,additions:i,deletions:l};let a=e.split(/\r?\n/),s=a.some(e=>e.startsWith("@@"))?a:[`@@ -1,${a.length} +1,${a.length} @@`,...a],o=1,c=1,d=[],u=[],h=()=>{let e=Math.max(d.length,u.length);for(let t=0;t<e;t++)r.push({left:d[t]?{type:"del",text:d[t].text,lineNumber:d[t].lineNumber}:void 0,right:u[t]?{type:"add",text:u[t].text,lineNumber:u[t].lineNumber}:void 0});d=[],u=[]};for(let e of s)if(!(e.startsWith("diff --git")||e.startsWith("index ")||e.startsWith("---")||e.startsWith("+++")||e.startsWith("new file mode")||e.startsWith("deleted file mode")||e.startsWith("similarity index")||e.startsWith("old mode")||e.startsWith("new mode")||e.startsWith("\\ No newline"))){if(e.startsWith("@@")){h();let t=e.match(/@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/);t&&(o=parseInt(t[1],10),c=parseInt(t[2],10)),n.push({type:"meta",text:e}),r.push({isMeta:!0,metaText:e});continue}if(e.startsWith("+")){let r=e.slice(1),l=t?r.trim():r;i++,n.push({type:"add",text:l,newLineNumber:c}),u.push({text:l,lineNumber:c}),c++}else if(e.startsWith("-")){let r=e.slice(1),i=t?r.trim():r;l++,n.push({type:"del",text:i,oldLineNumber:o}),d.push({text:i,lineNumber:o}),o++}else{h();let i=e.startsWith(" ")?e.slice(1):e,l=t?i.trim():i;n.push({type:"context",text:l,oldLineNumber:o,newLineNumber:c}),r.push({left:{type:"context",text:l,lineNumber:o},right:{type:"context",text:l,lineNumber:c}}),o++,c++}}return h(),{lines:n,splitRows:r,additions:i,deletions:l}}(y,g),O=(0,s.sQ)(t);return(0,r.FD)("div",{className:`flex flex-col h-full bg-paper select-text relative font-sans ${p}`,children:[(0,r.Y)(k,{filePath:t,status:w,isStaged:F,viewMode:m,ignoreWhitespace:g,additions:J.additions,deletions:J.deletions,isLoading:z,isCopied:E,onToggleViewMode:()=>{x("unified"===m?"split":"unified")},onToggleWhitespace:()=>{b(!g)},onStageUnstage:()=>{let e=F?"unstage":"stage",n=new FormData;n.set("actionType",e),n.set("file",t),n.set("repo",d||"."),c&&n.set("root",c),$.submit(n,{method:"POST",action:"/api/fs/git"}),C(!F),setTimeout(()=>{H(),f?.()},300)},onDiscard:()=>{W(!0)},onOpenInEditor:u,onRefresh:H,onCopyDiff:()=>{y&&(navigator.clipboard.writeText(y),L(!0),setTimeout(()=>L(!1),2e3))}}),(0,r.Y)("div",{className:"flex-1 overflow-hidden relative flex flex-col bg-paper",children:z?(0,r.FD)("div",{className:"flex-1 flex items-center justify-center space-x-2 text-ink/50 text-xs font-mono",children:[(0,r.Y)(h.A,{size:14,className:"animate-spin"}),(0,r.Y)("span",{children:"Loading file diff..."})]}):T?(0,r.FD)("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center space-y-2",children:[(0,r.Y)(S.A,{size:20,className:"text-error"}),(0,r.Y)("p",{className:"text-xs text-error font-medium",children:T}),(0,r.Y)("button",{onClick:H,className:"px-3 py-1 text-xs bg-ink/10 hover:bg-ink/15 text-ink rounded font-sans transition-colors",children:"Retry"})]}):"split"===m?(0,r.Y)(Y,{rows:J.splitRows,language:O}):(0,r.Y)(N,{lines:J.lines,language:O})}),j&&(0,r.Y)("div",{className:"fixed inset-0 bg-ink/20 z-50 flex items-center justify-center p-4 backdrop-blur-xs",children:(0,r.FD)("div",{className:"bg-paper rounded-lg shadow-xl p-4 w-full max-w-sm border border-ink/15",children:[(0,r.Y)("h3",{className:"font-semibold text-ink mb-1.5 text-sm",children:"Discard Changes?"}),(0,r.FD)("p",{className:"text-xs text-ink/70 mb-4",children:["Are you sure you want to discard all unstaged changes in ",(0,r.Y)("span",{className:"font-mono font-medium text-ink",children:t}),"? This cannot be undone."]}),(0,r.FD)("div",{className:"flex justify-end space-x-2",children:[(0,r.Y)("button",{type:"button",onClick:()=>W(!1),className:"px-3 py-1.5 text-xs text-ink hover:bg-ink/5 rounded transition-colors",children:"Cancel"}),(0,r.Y)("button",{type:"button",onClick:()=>{W(!1);let e=new FormData;e.set("actionType","discard"),e.set("file",t),e.set("repo",d||"."),c&&e.set("root",c),$.submit(e,{method:"POST",action:"/api/fs/git"}),setTimeout(()=>{H(),f?.()},300)},className:"px-3 py-1.5 text-xs bg-error text-white rounded hover:bg-error/90 font-medium transition-colors",children:"Discard Changes"})]})]})})]})}},XY(e,t,n){var r=n("H"),i=n("DU");function l(e){return String(e.id??e.path??e.name)}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{fallback:n,reportLoadError:a=!1,flushOnUnmount:s=!1,reportSaveError:o=!1,downloadMimeType:c="text/plain",onFileSaved:d}=t,[u,h]=(0,r.J0)({}),[f,p]=(0,r.J0)({}),[m,x]=(0,r.J0)(!1),[g,b]=(0,r.J0)(null),[y,v]=(0,r.J0)("idle"),[k,w]=(0,r.J0)(!1),[N,Y]=(0,r.J0)(0),S=e?l(e):"",D=e?u[S]??e.content??"":"",F=D!==(f[S]??D),C=(0,r.li)(new Set),z=(0,r.li)(null),M=(0,r.li)(u);M.current=u;let T=(0,r.li)(f);T.current=f;let A=(0,r.hb)((e,t)=>{h(n=>({...n,[e]:t})),p(n=>({...n,[e]:t}))},[]),E=(0,r.hb)(async(e,t)=>{if(!e.path)return;v("saving");let n=new FormData;n.append("actionType","save"),n.append("path",e.path),n.append("content",t),e.root&&n.append("root",e.root),e.repo&&"."!==e.repo&&n.append("repo",e.repo);try{let r=await fetch("/api/fs/action",{method:"POST",body:n}),i=await r.json().catch(()=>null);r.ok&&i?.success?(v("saved"),p(n=>({...n,[l(e)]:t})),d?.()):v(o?"error":"idle")}catch{v(o?"error":"idle")}},[d,o]),L=(0,r.li)(E);L.current=E,(0,r.vJ)(()=>{if(!e)return;let t=l(e);if(C.current.has(t))return;if(C.current.add(t),void 0!==e.content){A(t,e.content),b(null);return}if(!e.path)return a?void b("No file path supplied for this attachment."):void A(t,n?n(e.name):"");let r=void 0===M.current[t],i=!1;r&&x(!0),b(null);let s=new URLSearchParams({path:e.path});return e.root&&s.set("root",e.root),e.repo&&"."!==e.repo&&s.set("repo",e.repo),fetch(`/api/fs/read?${s.toString()}`).then(async e=>{let t=await e.json().catch(()=>null);if(a){if(!e.ok||!t||"string"!=typeof t.content)throw Error(t?.error||`HTTP ${e.status}`);return t.content}return"string"==typeof t?.content?t.content:null}).then(r=>{if(i)return;let a=M.current[t];if(void 0!==a&&a!==T.current[t])return;let s=z.current;s&&l(s.file)===t||A(t,r??(n?n(e.name):""))}).catch(l=>{i||r&&(a?(A(t,""),b(l instanceof Error?l.message:"Failed to read file")):A(t,n?n(e.name):""))}).finally(()=>{i||x(!1)}),()=>{i=!0}},[S,e,n,a,A,N]),(0,r.vJ)(()=>{if("saved"!==y)return;let e=window.setTimeout(()=>v("idle"),1500);return()=>window.clearTimeout(e)},[y]);let j=(0,r.hb)(t=>{if(!e)return;let n=l(e);if(h(e=>({...e,[n]:t})),!e.path)return;z.current&&window.clearTimeout(z.current.timer);let r=window.setTimeout(()=>{z.current=null,L.current(e,t)},800);z.current={timer:r,file:e,content:t}},[e]),W=(0,r.hb)(()=>{if(!e)return;let t=u[l(e)];void 0!==t&&(z.current&&(window.clearTimeout(z.current.timer),z.current=null),L.current(e,t))},[e,u]),$=(0,r.hb)(()=>{e&&navigator.clipboard&&navigator.clipboard.writeText(u[l(e)]??"").then(()=>{w(!0),window.setTimeout(()=>w(!1),1500)}).catch(()=>{})},[e,u]),H=(0,r.hb)(()=>{if(!e)return;let t=new Blob([u[l(e)]??""],{type:c}),n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=e.name,r.click(),URL.revokeObjectURL(n)},[e,u,c]),J=(0,r.hb)(()=>{C.current.clear(),Y(e=>e+1)},[]),O=(0,r.hb)(e=>{let t=new Set(e.map(String));for(let e of Array.from(C.current))t.has(e)||C.current.delete(e);h(e=>{let n=Object.keys(e);if(n.every(e=>t.has(e)))return e;let r={};for(let i of n)t.has(i)&&(r[i]=e[i]);return r})},[]);return(0,r.vJ)(()=>{if(s)return()=>{let e=z.current;e&&(window.clearTimeout(e.timer),z.current=null,L.current(e.file,e.content))}},[s]),{content:D,onChange:j,isLoading:m,loadError:g,saveStatus:y,copied:k,isDirty:F,language:e?(0,i.sQ)(e.name):"javascript",saveNow:W,copy:$,download:H,reset:J,retain:O}}n.d(t,{n:()=>a})},Soe(e,t,n){let r=(0,n("y").A)({name:"eye-off",size:24,node:[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]});n.d(t,{},{A:r})},yh(e,t,n){let r=(0,n("y").A)({name:"text-wrap",size:24,node:[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],aliases:["wrap-text"]});n.d(t,{},{A:r})},na(e,t,n){let r=(0,n("y").A)({name:"zoom-in",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})},hj(e,t,n){let r=(0,n("y").A)({name:"zoom-out",size:24,node:[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]});n.d(t,{},{A:r})}}]);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! LICENSE: ot.84c71b308f.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["ot"],{wA(e,t,n){var r=n("j"),l=n("H"),o=n("rm"),i=n("Go"),a=n("t3"),c=n("Ir"),s=n("z"),u=n("oj");function d(e){let{rootPath:t,activeRepo:n,onSelectRepo:d}=e,[h,p]=(0,l.J0)(!1),[f,m]=(0,l.J0)(["."]),[b,g]=(0,l.J0)(!1),[y,x]=(0,l.J0)(""),w=(0,l.li)(null),v=function(e){if(!e)return"workspace root";let t=e.replace(/\\/g,"/").split("/").filter(Boolean);return t.length>0?t[t.length-1]:"workspace root"}(t),k=e=>"."===e?v:e,N=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=new URLSearchParams({reposOnly:"1"});t&&n.set("root",t),e&&n.set("rescan","1"),n.set("t",String(Date.now()));let r=await fetch(`/api/fs/git?${n.toString()}`).then(e=>e.json()).catch(()=>null);r&&Array.isArray(r.repos)&&(m(r.repos),r.reposPending?g(!0):g(!1))};(0,l.vJ)(()=>{h&&N()},[h,t]),(0,l.vJ)(()=>{if(!b)return;let e=new URLSearchParams({reposOnly:"1"});t&&e.set("root",t);let n=setInterval(async()=>{let t=await fetch(`/api/fs/git?${e.toString()}`).then(e=>e.json()).catch(()=>null);t&&!t.reposPending&&Array.isArray(t.repos)&&(m(t.repos),g(!1))},1500);return()=>clearInterval(n)},[b,t]),(0,u.W)(w,()=>p(!1));let S=f.filter(e=>!y.trim()||k(e).toLowerCase().includes(y.toLowerCase()));return(0,r.FD)("div",{className:"relative",ref:w,children:[(0,r.FD)("button",{type:"button",onClick:()=>p(!h),title:"Switch git project",className:"flex items-center space-x-1.5 hover:bg-ink/5 px-2 py-1 rounded transition-colors text-xs text-ink/80 font-medium",children:[(0,r.Y)(o.A,{size:12,className:"text-ink/60"}),(0,r.Y)("span",{className:"truncate max-w-[110px]",children:"."===n?v:n.split("/").pop()}),(0,r.Y)(i.A,{size:12,className:"text-ink/40"})]}),h&&(0,r.FD)("div",{className:"absolute top-full left-0 mt-1 w-52 bg-paper border border-ink/20 rounded-md shadow-lg z-50 flex flex-col overflow-hidden text-xs",children:[(0,r.FD)("div",{className:"px-2 py-1.5 border-b border-ink/10 flex items-center space-x-1.5",children:[(0,r.Y)(a.A,{size:11,className:"text-ink/40 flex-shrink-0"}),(0,r.Y)("input",{type:"text",value:y,onChange:e=>x(e.currentTarget.value),placeholder:"Search repos...",title:"Search repositories",className:"w-full bg-transparent outline-none text-xs text-ink placeholder-ink/40",autoFocus:!0}),y&&(0,r.Y)("button",{type:"button",onClick:()=>x(""),title:"Clear search",className:"text-ink/40 hover:text-ink flex-shrink-0",children:"×"}),(0,r.Y)("button",{type:"button",onClick:()=>void N(!0),title:"Refresh nested repos",disabled:b,className:"text-ink/40 hover:text-ink flex-shrink-0 transition-colors disabled:opacity-40 disabled:hover:text-ink/40",children:(0,r.Y)(c.A,{size:11,className:b?"animate-spin":""})})]}),(0,r.Y)("div",{className:"max-h-48 scrollbar-overlay-container scrollbar-overlay-static py-1",children:0===S.length?(0,r.Y)("div",{className:"px-3 py-2 text-ink/40 italic",children:"No repos found"}):S.map(e=>(0,r.FD)("button",{type:"button",onClick:()=>{d(e),p(!1),x("")},title:k(e),className:"w-full text-left px-3 py-2 hover:bg-ink/5 flex items-center justify-between transition-colors",children:[(0,r.Y)("span",{className:"truncate",children:k(e)}),n===e&&(0,r.Y)(s.A,{size:12,className:"text-ink"})]},e))})]})]})}n.d(t,{I:()=>d})},SA(e,t,n){n.d(t,{TerminalPanel:()=>D});var r=n("j"),l=n("H"),o=n("FL"),i=n("As"),a=n("SS"),c=n("oS");function s(){return"u">typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`t-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function u(e){return JSON.stringify(e)}var d=n("fe"),h=n("N"),p=n("t"),f=n("Wb0"),m=n("wA");let b={connecting:"CONNECTING",running:"LIVE",exited:"EXITED",error:"ERROR"},g={connecting:"bg-warning/10 text-warning border-warning/20",running:"bg-success/10 text-success border-success/20",exited:"bg-ink/5 text-ink/60 border-ink/15",error:"bg-error/10 text-error border-error/20"};function y(e){let{status:t,exitCode:n,rootPath:l,activeRepo:o,onSelectRepo:i,cwd:a,shell:c,gitBranch:s,onRestart:u}=e,d=c?c.split("/").pop():"";return(0,r.FD)("div",{className:"h-10 px-3 border-b border-ink/10 bg-paper flex items-center justify-between flex-shrink-0 select-none",children:[(0,r.FD)("div",{className:"flex items-center space-x-2 min-w-0",children:[(0,r.FD)("div",{className:"flex items-center space-x-1.5",children:[(0,r.Y)(h.A,{size:14,className:"text-ink/80 flex-shrink-0"}),(0,r.Y)("span",{className:"text-xs font-semibold tracking-wider text-ink uppercase",children:"Terminal"})]}),(0,r.FD)("span",{className:`inline-flex items-center space-x-1 px-1.5 py-0.5 rounded text-[10px] font-mono border ${g[t]}`,title:"exited"===t&&null!==n?`Shell exited with code ${n}`:void 0,children:["connecting"===t&&(0,r.Y)(p.A,{size:10,className:"animate-spin"}),(0,r.Y)("span",{children:"exited"===t&&null!==n?`EXIT ${n}`:b[t]})]}),(0,r.Y)(m.I,{rootPath:l,activeRepo:o,onSelectRepo:i}),(0,r.Y)("button",{type:"button",onClick:u,title:"Kill this shell and start a new one",className:"p-1 rounded text-ink/50 hover:text-ink hover:bg-ink/5 transition-colors cursor-pointer flex-shrink-0",children:(0,r.Y)(f.A,{size:12})})]}),(0,r.FD)("span",{className:"hidden sm:flex items-center space-x-2 text-[10px] font-mono text-ink/40 flex-shrink-0 min-w-0",children:[a&&(0,r.Y)("span",{className:"truncate max-w-[280px]",title:a,children:a}),s&&(0,r.Y)("span",{children:s}),d&&(0,r.Y)("span",{children:d})]})]})}var x=n("XT");let w=[{label:"bun build",cmd:"bun run build"},{label:"bun test",cmd:"bun test"},{label:"git status",cmd:"git status -s"},{label:"git diff",cmd:"git diff"},{label:"ls -la",cmd:"ls -la"},{label:"pwd",cmd:"pwd"},{label:"bun -v",cmd:"bun --version"}];function v(e){let{onSelectCommand:t,disabled:n}=e;return(0,r.FD)("div",{className:"flex flex-wrap items-center gap-1.5 px-3 py-1.5 bg-paper border-b border-ink/10 flex-shrink-0",children:[(0,r.FD)("div",{className:"flex items-center space-x-1 text-[10px] font-mono text-ink/50 uppercase tracking-wider flex-shrink-0 select-none",children:[(0,r.Y)(x.A,{size:11,className:"text-warning"}),(0,r.Y)("span",{children:"Quick:"})]}),w.map(e=>(0,r.Y)("button",{type:"button",disabled:n,onClick:()=>t(e.cmd),className:"px-2 py-0.5 rounded text-[10px] font-mono bg-canvas hover:bg-ink/5 active:bg-ink/10 text-ink/80 hover:text-ink border border-ink/15 transition-all whitespace-nowrap disabled:opacity-40 cursor-pointer shadow-2xs",children:e.label},e.cmd))]})}var k=n("G"),N=n("zi");let S={background:"#f4f1ea",foreground:"#141310",cursor:"#141310",cursorAccent:"#f4f1ea",selectionBackground:"#ded8ce",selectionForeground:"#141310",black:"#141310",red:"#c8321e",green:"#047857",yellow:"#b45309",blue:"#1d4ed8",magenta:"#9333ea",cyan:"#0284c7",white:"#faf8f3",brightBlack:"#78716c",brightRed:"#dc2626",brightGreen:"#059669",brightYellow:"#d97706",brightBlue:"#2563eb",brightMagenta:"#a855f7",brightCyan:"#0ea5e9",brightWhite:"#292524"},C={background:"#21252b",foreground:"#abb2bf",cursor:"#528bff",cursorAccent:"#21252b",selectionBackground:"#3e4451",selectionForeground:"#abb2bf",black:"#282c34",red:"#e06c75",green:"#98c379",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#56b6c2",white:"#abb2bf",brightBlack:"#5c6370",brightRed:"#e06c75",brightGreen:"#98c379",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#56b6c2",brightWhite:"#ffffff"},A={device:{char:{width:9,height:17,left:0,top:0},cell:{width:9,height:17},canvas:{width:0,height:0}},css:{canvas:{width:0,height:0},cell:{width:9,height:17}}};async function Y(e,t,r,l){var o,i;let a,c,s,u=await n.e("f").then(n.bind(n,"JX")),d=await n.e("xnl").then(n.bind(n,"r3")),h=u.Terminal||u.default?.Terminal||u.default,p=d.FitAddon||d.default?.FitAddon||d.default;if(!h||!p||l())return null;try{let e=p?.prototype;if(e&&!e.__safePatched){e.__safePatched=!0;let t=e.proposeDimensions;e.proposeDimensions=function(){try{let e=this._terminal?._core;if(!e?._renderService)return;let n=e._renderService.dimensions;if(!n?.css?.cell?.width||!n?.css?.cell?.height)return;return t?.call(this)}catch{return}}}}catch{}let f=new h({cursorBlink:!0,cursorStyle:"block",fontSize:12,lineHeight:1.25,fontFamily:"'Fira Code', 'FiraCode Nerd Font Mono', 'FiraCode Nerd Font', 'JetBrainsMono Nerd Font', 'JetBrainsMono NF', 'JetBrains Mono Nerd Font', 'Hack Nerd Font', 'MesloLGS NF', 'MesloLGM Nerd Font', 'CaskaydiaCove Nerd Font', 'SauceCodePro Nerd Font', 'Symbols Nerd Font Mono', 'Symbols Nerd Font', 'PowerlineSymbols', Menlo, Monaco, 'Courier New', monospace",theme:t?C:S,scrollback:1e4,scrollSensitivity:1.5,fastScrollSensitivity:5,smoothScrollDuration:0,allowProposedApi:!0});f.open(e);try{let e=f?._core;if(e?._renderService){let t=Object.getPrototypeOf(e._renderService),n=Object.getOwnPropertyDescriptor(t,"dimensions");if(n?.get&&!t.__safePatched){t.__safePatched=!0;let e=n.get;Object.defineProperty(t,"dimensions",{get(){try{if(!this._renderer?.value)return A;return e.call(this)}catch{return A}},configurable:!0,enumerable:!0})}}}catch{}try{let e=await n.e("ms").then(n.bind(n,"Az")),t=e.WebglAddon||e.default?.WebglAddon||e.default;if(t){let e=new t;e.onContextLoss(()=>e.dispose()),f.loadAddon(e)}}catch{}let m=new p;f.loadAddon(m),f.attachCustomKeyEventHandler(e=>{var t,n;return t=f,"keydown"!==(n=e).type||!n.shiftKey||("PageUp"===n.key?(t.scrollPages(-1),!1):"PageDown"===n.key?(t.scrollPages(1),!1):"Home"===n.key?(t.scrollToTop(),!1):"End"===n.key?(t.scrollToBottom(),!1):"ArrowUp"===n.key?(t.scrollLines(-1),!1):"ArrowDown"!==n.key||(t.scrollLines(1),!1))});let b=[f.onScroll(()=>{let e=f.buffer.active;r.onScrolledUpChange(e.viewportY<e.baseY)}),f.onData(e=>r.onInput(e)),f.onBinary(e=>r.onBinaryInput(e)),f.onResize(e=>{let{cols:t,rows:n}=e;w||r.onGridChange(t,n)})],g=!1,y=null,x=null,w=!1,v=()=>{if(l()||e.clientWidth<=0||e.clientHeight<=0)return;let t=f._core,n=t?._renderService?.dimensions;if(n?.css?.cell?.width&&n?.css?.cell?.height)try{m.fit()}catch{}},k=()=>{f.write("",()=>{l()||(w=!1,v())})},N=()=>{if(g||l()||e.clientWidth<=0||e.clientHeight<=0)return;let t=f._core;t?._renderService?.dimensions?.css?.cell?.width&&(g=!0,r.onReady(f.cols,f.rows),f.focus())},Y=new ResizeObserver(()=>{y&&clearTimeout(y),y=setTimeout(()=>{v(),N()},35)});Y.observe(e);let F=(o=e,i=f,a=0,c=e=>{1===e.touches.length&&(a=e.touches[0].clientY)},s=e=>{if(1!==e.touches.length)return;let t=a-e.touches[0].clientY;16>Math.abs(t)||(i.scrollLines(Math.trunc(t/16)),a=e.touches[0].clientY)},o.addEventListener("touchstart",c,{passive:!0}),o.addEventListener("touchmove",s,{passive:!0}),()=>{o.removeEventListener("touchstart",c),o.removeEventListener("touchmove",s)});return x=requestAnimationFrame(()=>{v(),N()}),{term:f,fitAddon:m,writeReplay:(e,t,n)=>{(w=!0,(f.cols!==t||f.rows!==n)&&f.resize(t,n),0===e.length)?k():f.write(e,k)},dispose(){for(let e of(null!==x&&cancelAnimationFrame(x),clearTimeout(y??void 0),F(),b))e.dispose();Y.disconnect();try{m.dispose()}catch{}try{f.dispose()}catch{}}}}let F=(0,k.Rf)((e,t)=>{let{onInput:n,onBinaryInput:o,onGridChange:i,onReady:a}=e,{isDark:c}=(0,d.DP)(),s=(0,l.li)(null),u=(0,l.li)(null),[h,p]=(0,l.J0)(!1),f=(0,l.li)(n);f.current=n;let m=(0,l.li)(o);m.current=o;let b=(0,l.li)(i);b.current=i;let g=(0,l.li)(a);g.current=a;let y=(0,l.li)(c);y.current=c,(0,l.vJ)(()=>{let e=u.current?.term;e&&(e.options.theme=c?C:S,e.refresh(0,e.rows-1))},[c]),(0,l.Yn)(t,()=>({write(e){u.current?.term.write(e)},writeReplay(e,t,n){u.current?.writeReplay(e,t,n)},reset(){u.current?.term.reset()},focus(){u.current?.term.focus()}}),[]);let x=(0,l.hb)(()=>{u.current?.term.scrollToBottom(),p(!1)},[]);return(0,l.vJ)(()=>{let e=s.current;if(!e)return;let t=!1;return Y(e,y.current,{onInput:e=>f.current(e),onBinaryInput:e=>m.current(e),onGridChange:(e,t)=>b.current(e,t),onReady:(e,t)=>g.current(e,t),onScrolledUpChange:p},()=>t).then(e=>{if(e){if(t)return void e.dispose();u.current=e}}),()=>{t=!0,u.current?.dispose(),u.current=null}},[]),(0,r.FD)("div",{className:"relative flex-1 w-full h-full bg-canvas overflow-hidden",children:[(0,r.Y)("div",{ref:s,className:"w-full h-full cursor-text p-1.5",style:{height:"100%",width:"100%"}}),h&&(0,r.FD)("button",{type:"button",onClick:x,className:"absolute bottom-3 right-4 z-20 flex items-center space-x-1.5 px-2.5 py-1 bg-paper hover:bg-canvas text-ink border border-ink/20 rounded-full shadow-lg text-[11px] font-mono transition-all animate-fade-in cursor-pointer active:scale-95",title:"Scroll to latest output (Shift+End)",children:[(0,r.Y)(N.A,{size:12,className:"text-warning"}),(0,r.Y)("span",{children:"Latest"})]})]})});F.displayName="RealtimeXtermView";let R=new TextEncoder;function D(e){let{className:t="",enabled:n=!0,rootPath:h,showHeader:p=!0}=e,f=(0,l.li)(null),{isDark:m}=(0,d.DP)(),[b,g]=(0,o.bL)("terminal.activeRepo","."),x=(0,l.li)(null),{status:w,cwd:k,shell:N,exitCode:S,error:C,systemInfo:A,attach:Y,resize:D,input:E,restart:P}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{sessionId:t,ready:n}=(0,i.O)(),[r,d]=(0,o.bL)("terminal.id",""),[h,p]=(0,l.J0)("connecting"),[f,m]=(0,l.J0)(""),[b,g]=(0,l.J0)(""),[y,x]=(0,l.J0)(null),[w,v]=(0,l.J0)(null),[k,N]=(0,l.J0)({gitBranch:"main"}),S=(0,l.li)(null),C=(0,l.li)(null),A=(0,l.li)(e.onOutput);A.current=e.onOutput;let Y=(0,l.li)(e.onReplay);Y.current=e.onReplay;let F=(0,l.li)(e.onRestart);F.current=e.onRestart;let R=(0,l.li)(e.root);R.current=e.root;let D=(0,l.li)(e.repo);D.current=e.repo;let E=(0,l.li)(e.theme);E.current=e.theme;let P=(0,l.li)(d);P.current=d;let B=(0,l.li)(null);(0,l.vJ)(()=>{!n||(0,a.WV)(t,"terminal.id")||P.current(s())},[n,t]),(0,l.vJ)(()=>{var e;let t,l,o,i,a,s,d,h,f,b,y,w,k,N,F;if(!n||!r)return;p("connecting"),v(null),x(null);let P=(e={onReady(e){p("running"),m(e.cwd),g(e.shell),x(null)},onReplay(e,t){Y.current?.(e,t)},onOutput(e){A.current?.(e)},onExit(e){p("exited"),x(e)},onError(e,t){p("error"),v(`${e}: ${t}`)},onConnectionChange(e){e||p("connecting")}},t=null,l=null,o=0,i=!1,a=!1,s=!1,d=null,h=[],f=0,b=null,y=()=>{let n,p=new WebSocket((n="https:"===window.location.protocol?"wss:":"ws:",`${n}//${window.location.host}/api/terminal/${encodeURIComponent(r)}/ws`));p.binaryType="arraybuffer",t=p,p.onopen=()=>{!a&&(o=0,i=!0,e.onConnectionChange(!0),d&&p.send(u(d)))},p.onmessage=e=>{if(a)return;if(e.data instanceof ArrayBuffer)return void k(new Uint8Array(e.data));let t=function(e){var t;let n=function(e){try{return JSON.parse(e)}catch{return null}}(e);if(!(0,c.u)(n))return null;if("ready"===n.t){if("string"!=typeof n.id||"string"!=typeof n.cwd)return null;let e="number"==typeof n.replayBytes?n.replayBytes:0;return{...n,t:"ready",replayBytes:e}}return"exit"===n.t?{t:"exit",exitCode:"number"==typeof n.exitCode?n.exitCode:null,signal:"string"==typeof n.signal?n.signal:null}:"error"===n.t&&"string"==typeof n.message?{t:"error",code:"capacity"===(t=n.code)||"cwd"===t||"shell"===t||"spawn"===t?t:"unknown",message:n.message}:null}("string"==typeof e.data?e.data:"");t&&w(t)},p.onclose=()=>{t=null,a||(e.onConnectionChange(!1),s=!1,h=[],f=0,b=null,!i||(o+=1)>4||(l=setTimeout(()=>{l=null,a||y()},Math.min(500*2**(o-1),8e3))))},p.onerror=()=>{}},w=t=>{if("ready"===t.t){s=!0,b=t,f=t.replayBytes,h=[],e.onReady(t),0===f&&N();return}"exit"===t.t?e.onExit(t.exitCode,t.signal):e.onError(t.code,t.message)},k=t=>{f<=0?e.onOutput(t):(h.push(t),(f-=t.length)>0||N())},N=()=>{let t=b,n=h;b=null,h=[],f=0,t&&e.onReplay(1===n.length?n[0]:function(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}(n),t)},y(),F=e=>{let n=t;n&&n.readyState===WebSocket.OPEN&&n.send(u(e))},{attach(e,t,n,r,l){if(s)return;let o={t:"attach",cols:e,rows:t};n&&(o.root=n),r&&(o.repo=r),l&&(o.theme=l),d=o,F(o)},resize(e,t){F({t:"resize",cols:e,rows:t})},input(e){let n=t;n&&n.readyState===WebSocket.OPEN&&n.send(e)},close(){F({t:"close"})},release(){a=!0,null!==l&&(clearTimeout(l),l=null);let e=t;t=null,e&&(e.onopen=null,e.onmessage=null,e.onclose=null,e.onerror=null,e.close())}});S.current=P;let B=C.current;return B&&P.attach(B.cols,B.rows,R.current,D.current,E.current),()=>{P.release(),S.current=null}},[n,r]);let J=(0,l.hb)(()=>{S.current?.close(),F.current?.(),P.current(s())},[]);(0,l.vJ)(()=>{if(!n)return;let t=e.root;if(!t)return;let r=`${t}\0${e.repo??"."}`;if(null===B.current){B.current=r;return}B.current!==r&&(B.current=r,J())},[n,e.root,e.repo,J]),(0,l.vJ)(()=>{let t=e.root,n=e.repo;if(!t)return;let r=new URLSearchParams({root:t});n&&"."!==n&&r.set("repo",n);let l=!1;return fetch(`/api/terminal/run?${r.toString()}`).then(e=>e.ok?e.json():null).then(e=>{!l&&e?.gitBranch&&N({gitBranch:e.gitBranch})}).catch(()=>{}),()=>{l=!0}},[e.root,e.repo]);let z=(0,l.hb)((e,t)=>{C.current={cols:e,rows:t},S.current?.attach(e,t,R.current,D.current,E.current)},[]);return{status:h,cwd:f,shell:b,exitCode:y,error:w,systemInfo:k,attach:z,resize:(0,l.hb)((e,t)=>{C.current={cols:e,rows:t},S.current?.resize(e,t)},[]),input:(0,l.hb)(e=>{S.current?.input(e)},[]),restart:J}}({root:n?h:void 0,repo:b,theme:m?"dark":"light",onOutput:(0,l.hb)(e=>{f.current?.write(e)},[]),onReplay:(0,l.hb)((e,t)=>{f.current?.writeReplay(e,t.replayCols,t.replayRows)},[]),onRestart:(0,l.hb)(()=>{f.current?.reset()},[])}),B=(0,l.hb)((e,t)=>{x.current={cols:e,rows:t},Y(e,t)},[Y]),J=(0,l.hb)((e,t)=>{let n=x.current;x.current={cols:e,rows:t},n&&D(e,t)},[D]),z=(0,l.hb)(e=>{E(R.encode(e))},[E]),L=(0,l.hb)(e=>{let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=1)t[n]=255&e.charCodeAt(n);E(t)},[E]),M=(0,l.hb)(e=>{E(R.encode(`${e}\r`)),f.current?.focus()},[E]),O=(0,l.hb)(()=>{P()},[P]);return n?(0,r.FD)("div",{className:`flex flex-col h-full w-full bg-paper text-ink overflow-hidden ${t}`,children:[p&&(0,r.Y)(y,{status:w,exitCode:S,rootPath:h,activeRepo:b,onSelectRepo:g,cwd:k,shell:N,gitBranch:A.gitBranch,onRestart:O}),(0,r.Y)(v,{onSelectCommand:M,disabled:"running"!==w}),C&&(0,r.Y)("div",{className:"px-3 py-1.5 border-b border-error/20 bg-error/5 text-[11px] font-mono text-error flex-shrink-0",children:C}),(0,r.Y)("div",{className:"flex-1 w-full min-h-0 bg-canvas overflow-hidden",children:(0,r.Y)(F,{ref:f,onInput:z,onBinaryInput:L,onReady:B,onGridChange:J})})]}):(0,r.Y)("div",{className:`flex flex-col h-full bg-paper items-center justify-center text-ink/40 ${t}`,children:(0,r.Y)("span",{className:"text-xs font-mono",children:"No session selected"})})}},C7q(e,t,n){var r=n("H"),l=n("So");function o(){return(0,r.hb)(e=>{(0,l.l1)(e)},[])}n.d(t,{g:()=>o})},fe(e,t,n){var r=n("H"),l=n("C7q");function o(e){"u">typeof document&&(document.documentElement.dataset.theme=e,window.dispatchEvent(new CustomEvent("omp:theme-changed",{detail:e})))}function i(){let e=(0,l.g)(),[t,n]=(0,r.J0)(()=>"u">typeof document&&(document.documentElement.dataset.theme||document.documentElement.getAttribute("data-theme"))||"paper"),i="one-dark-pro-soft"===t||"noir"===t||"dark"===t;(0,r.vJ)(()=>{if("u"<typeof document)return;let e=()=>{let e=document.documentElement.dataset.theme||document.documentElement.getAttribute("data-theme")||"paper";n(e);let t=document.querySelector('meta[name="theme-color"]');t&&t.setAttribute("content","one-dark-pro-soft"===e?"#282c34":"#faf8f3")};e();let t=new MutationObserver(t=>{for(let n of t)"attributes"===n.type&&("data-theme"===n.attributeName||"class"===n.attributeName)&&e()});t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class"]});let r=t=>{t.detail?n(t.detail):e()};return window.addEventListener("omp:theme-changed",r),()=>{t.disconnect(),window.removeEventListener("omp:theme-changed",r)}},[]);let a=(0,r.hb)(t=>{o(t),n(t),e({theme:t})},[e]),c=(0,r.hb)(()=>{a(i?"paper":"one-dark-pro-soft")},[i,a]);return{theme:t,isDark:i,setTheme:a,toggleTheme:c}}n.d(t,{DP:()=>i,Ps:()=>o})},rm(e,t,n){let r=(0,n("y").A)({name:"folder-git-2",size:24,node:[["path",{d:"M18 19a5 5 0 0 1-5-5v8",key:"sz5oeg"}],["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]});n.d(t,{},{A:r})},Wb0(e,t,n){let r=(0,n("y").A)({name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]});n.d(t,{},{A:r})}}]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! LICENSE: q.
|
|
2
|
-
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["q"],{o3(e,t,i){i.d(t,{Editor:()=>W});var n=i("j"),r=i("H"),o=i("ob"),a=i("
|
|
1
|
+
/*! LICENSE: q.23af2a358f.js.LICENSE.txt */
|
|
2
|
+
"use strict";(self.rspackChunkompchamber=self.rspackChunkompchamber||[]).push([["q"],{o3(e,t,i){i.d(t,{Editor:()=>W});var n=i("j"),r=i("H"),o=i("ob"),a=i("uf"),s=i("vp"),l=i("jo"),c=i("YOg"),d=i("S"),m=i("Go"),p=i("oj"),f=i("LQ");function h(e){let{openedFiles:t,activeFileId:i,onSelectFile:a,onCloseFile:s}=e,l=(0,r.li)(null),h=(0,r.li)(null),[x,u]=(0,r.J0)(5),[v,k]=(0,r.J0)(!1);(0,p.W)(h,()=>k(!1)),(0,r.vJ)(()=>{let e=new ResizeObserver(e=>{for(let t of e)u(Math.max(1,Math.floor((t.contentRect.width-60)/150)))});return l.current&&e.observe(l.current),()=>e.disconnect()},[]);let b=[],g=[];if(t.length<=x)b=t;else{let e=t.findIndex(e=>e.id===i),n=new Set;-1!==e&&null!==i&&n.add(i);for(let e=t.length-1;e>=0&&!(n.size>=x);e--)n.add(t[e].id);b=t.filter(e=>n.has(e.id)),g=t.filter(e=>!n.has(e.id))}return(0,n.FD)("div",{className:"flex bg-ink/10 w-full relative border-b border-ink/10",ref:l,children:[(0,n.Y)("div",{className:"flex overflow-hidden",children:b.map(e=>{let t=e.id===i,r=!!e.isDiff,l=r?(0,f.R)(e.diffStatus||"M",e.diffStaged):null;return(0,n.FD)("div",{onClick:()=>a(e.id),className:`flex items-center space-x-1.5 px-3 py-1.5 cursor-pointer border-r border-ink/10 min-w-[120px] max-w-[210px] group ${t?"bg-paper border-t-2 border-t-ink text-ink":"bg-transparent border-t-2 border-t-transparent text-ink/60 hover:bg-paper/50"}`,title:e.path,children:[r?(0,n.Y)(c.A,{size:14,className:t?"text-blue-600 dark:text-blue-400 flex-shrink-0":"opacity-60 flex-shrink-0"}):(0,n.Y)(o.o,{name:e.name,size:14,className:t?"flex-shrink-0":"opacity-60 flex-shrink-0"}),(0,n.Y)("span",{className:"text-xs font-mono truncate flex-1",children:e.name}),l&&(0,n.Y)("span",{className:`px-1 text-[9px] font-mono font-bold rounded ${l.badgeBgClass}`,children:l.charStatus}),(0,n.Y)("div",{className:`p-0.5 rounded hover:bg-ink/10 ${t?"opacity-100":"opacity-0 group-hover:opacity-100"}`,onClick:t=>{t.stopPropagation(),s(e.id)},children:(0,n.Y)(d.A,{size:12})})]},e.id)})}),g.length>0&&(0,n.FD)("div",{className:"relative flex items-center ml-auto bg-ink/10",ref:h,children:[(0,n.Y)("button",{className:`p-1.5 mx-1 rounded hover:bg-ink/10 text-ink/60 ${v?"bg-ink/10 text-ink":""}`,onClick:()=>k(!v),title:"More open files",children:(0,n.Y)(m.A,{size:14})}),v&&(0,n.FD)("div",{className:"absolute right-0 top-full mt-1 w-52 bg-paper border border-ink/10 rounded shadow-lg z-50 py-1",children:[(0,n.Y)("div",{className:"px-3 py-1 text-[10px] uppercase font-mono text-ink/40 border-b border-ink/10 mb-1",children:"Older Tabs"}),g.map(e=>(0,n.FD)("div",{onClick:()=>{a(e.id),k(!1)},className:"flex items-center space-x-2 px-3 py-1.5 hover:bg-ink/5 cursor-pointer group",children:[e.isDiff?(0,n.Y)(c.A,{size:14,className:"text-blue-600 opacity-70"}):(0,n.Y)(o.o,{name:e.name,size:14,className:"opacity-60"}),(0,n.Y)("span",{className:"text-xs font-mono truncate flex-1 text-ink/80",children:e.name}),(0,n.Y)("div",{className:"p-0.5 rounded hover:bg-ink/10 opacity-0 group-hover:opacity-100",onClick:t=>{t.stopPropagation(),s(e.id),1===g.length&&k(!1)},children:(0,n.Y)(d.A,{size:12,className:"text-ink/60"})})]},e.id))]})]})]})}var x=i("ES"),u=i("z"),v=i("Soe"),k=i("bH"),b=i("yh"),g=i("hj"),N=i("na"),y=i("b0"),Y=i("tC");let w=(0,i("y").A)({name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]});function z(e){let{path:t,saveStatus:i,wordWrap:r,isMd:o,isPreview:a,onSave:s,onTogglePreview:l,onToggleWordWrap:c,onZoomIn:d,onZoomOut:m,onCopy:p,onDownload:f,onToggleMaximize:h}=e;return(0,n.FD)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-ink/10 bg-paper",children:[(0,n.Y)("div",{className:"flex items-center space-x-2 text-xs font-mono text-ink/40",children:(0,n.Y)("span",{className:"truncate max-w-[300px]",title:t,children:t})}),(0,n.FD)("div",{className:"flex items-center space-x-3 text-ink/40",children:[(0,n.Y)("div",{className:"flex items-center pr-3 border-r border-ink/10",children:(0,n.Y)("button",{type:"button",onClick:s,className:"flex items-center justify-center rounded hover:bg-ink/5 transition-colors",title:"Save file (Ctrl+S)",children:"saving"===i?(0,n.Y)(x.A,{size:14,className:"text-amber-500 animate-pulse"}):"saved"===i?(0,n.Y)(u.A,{size:14,className:"text-success"}):(0,n.Y)(x.A,{size:14,className:"hover:text-ink cursor-pointer"})})}),o&&(0,n.Y)("div",{onClick:l,className:"flex items-center pr-3 border-r border-ink/10",children:a?(0,n.Y)(v.A,{size:14,className:"hover:text-ink cursor-pointer"}):(0,n.Y)(k.A,{size:14,className:"hover:text-ink cursor-pointer"})}),(0,n.Y)("div",{className:"flex items-center space-x-2 pr-3 border-r border-ink/10",children:(0,n.Y)(b.A,{size:14,className:`cursor-pointer ${r?"text-ink":"hover:text-ink"}`,onClick:c})}),(0,n.FD)("div",{className:"flex items-center space-x-2 pr-3 border-r border-ink/10",children:[(0,n.Y)(g.A,{size:14,className:"hover:text-ink cursor-pointer",onClick:m}),(0,n.Y)(N.A,{size:14,className:"hover:text-ink cursor-pointer",onClick:d})]}),(0,n.FD)("div",{className:"flex items-center space-x-2 pr-3 border-r border-ink/10",children:[(0,n.Y)(y.A,{size:14,className:"hover:text-ink cursor-pointer",onClick:p}),(0,n.Y)(Y.A,{size:14,className:"hover:text-ink cursor-pointer",onClick:f})]}),(0,n.Y)("div",{className:"flex items-center pl-1",children:(0,n.Y)(w,{size:14,className:"hover:text-ink cursor-pointer",onClick:h})})]})]})}function C(e){if(e.endsWith(".md"))return`# ${e.replace(".md","")}
|
|
3
3
|
|
|
4
4
|
This is a mock markdown file.
|
|
5
5
|
|
|
@@ -18,4 +18,4 @@ export default function ${t||"Component"}() {
|
|
|
18
18
|
}`:e.endsWith(".css")?`.container {
|
|
19
19
|
display: flex;
|
|
20
20
|
flex-direction: column;
|
|
21
|
-
}`:`Content for ${e}`}var S=i("Xg"),
|
|
21
|
+
}`:`Content for ${e}`}var S=i("Xg"),F=i("FL"),M=i("As"),A=i("SS"),D=i("XY");function W(e){let{className:t="",openedFiles:i,activeFileId:c,onSelectFile:d,onCloseFile:m,refreshKey:p=0,onFileSaved:f}=e,x=i.find(e=>e.id===c),[u,v,k]=(0,F.bL)("editor.previewMode",{}),[b,g]=(0,F.bL)("editor.zoomLevel",12),[N,y]=(0,r.J0)(!1),[Y,w]=(0,F.bL)("editor.wordWrap",!0),{sessionId:W}=(0,M.O)(),{isScrolling:$,handleScroll:j}=(0,l.K)(),H=(0,D.n)(x??null,{fallback:C,onFileSaved:f});if((0,r.vJ)(()=>{p>0&&H.reset()},[p]),(0,r.vJ)(()=>{H.retain(i.map(e=>e.id))},[i]),(0,r.vJ)(()=>{if(!k)return;let e=x?.id;if(null==e||!x.name.endsWith(".md"))return;let t=(0,A.WV)(W,"editor.previewMode");t&&void 0!==t[e]||v(t=>void 0===t[e]?{...t,[e]:!0}:t)},[k,x]),(0,r.vJ)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key&&(e.preventDefault(),H.saveNow())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[H.saveNow]),0===i.length)return(0,n.FD)("div",{className:`flex flex-col h-full bg-canvas items-center justify-center text-ink/40 ${t}`,children:[(0,n.Y)(o.o,{name:"placeholder.txt",size:48,className:"mb-4 opacity-20"}),(0,n.Y)("p",{className:"font-mono text-sm",children:"Select a file to open"})]});let J=H.content,L=x?.name.endsWith(".md"),O=!!x&&u[x.id],P="error"===H.saveStatus?"idle":H.saveStatus,T=N?"fixed inset-0 z-50 flex flex-col bg-canvas":`flex flex-col h-full bg-canvas ${t}`;return(0,n.FD)("div",{className:T,children:[(0,n.Y)(h,{openedFiles:i,activeFileId:c,onSelectFile:d,onCloseFile:m}),x?x.isDiff?(0,n.Y)(S.M,{filePath:x.path,status:x.diffStatus||"M",isStaged:!!x.diffStaged,root:x.root,repo:x.repo||".",onOpenInEditor:()=>{x.isDiff=!1,d(x.id)},onFileSaved:f,className:"flex-1"}):(0,n.FD)(n.FK,{children:[(0,n.Y)(z,{path:x.path,saveStatus:P,wordWrap:Y,isMd:L,isPreview:O,onSave:H.saveNow,onTogglePreview:()=>{x&&v(e=>({...e,[x.id]:!e[x.id]}))},onToggleWordWrap:()=>w(!Y),onZoomIn:()=>g(e=>Math.min(24,e+1)),onZoomOut:()=>g(e=>Math.max(8,e-1)),onCopy:H.copy,onDownload:H.download,onToggleMaximize:()=>y(!N)}),(0,n.Y)("div",{onScroll:j,className:`flex-1 overflow-auto bg-paper flex ${(0,l.p)($)}`,children:L&&O?(0,n.Y)("div",{className:"p-6 prose prose-sm max-w-4xl mx-auto font-sans flex-1",style:{fontSize:`${b}px`},children:(0,n.Y)(s.T,{content:J})}):(0,n.Y)(a.P,{value:J,onValueChange:H.onChange,language:H.language,wordWrap:Y,rootClassName:"flex",gutterClassName:"flex flex-col text-right pl-4 pr-3 select-none text-ink/30 font-mono border-r border-ink/10 bg-canvas sticky left-0 z-10",gutterStyle:{fontSize:b,paddingTop:16,paddingBottom:16,lineHeight:1.5,fontFamily:'"Fira Code", "JetBrains Mono", "SF Mono", Consolas, monospace'},gutterLineClassName:"min-w-[1.5rem]",editorWrapperClassName:`flex-1 code-surface ${Y?"min-w-0":"min-w-max"}`,editorPadding:16,editorClassName:"font-mono focus:outline-none",editorStyle:{fontFamily:'"Fira Code", "JetBrains Mono", "SF Mono", Consolas, monospace',fontSize:b,lineHeight:1.5,minHeight:"100%"}})})]}):(0,n.Y)("div",{className:"flex-1 flex items-center justify-center text-ink/40",children:(0,n.Y)("p",{className:"font-mono text-sm",children:"Select a tab to view content"})})]})}},YOg(e,t,i){let n=(0,i("y").A)({name:"git-compare",size:24,node:[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]});i.d(t,{},{A:n})},ES(e,t,i){let n=(0,i("y").A)({name:"save",size:24,node:[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]});i.d(t,{},{A:n})}}]);
|