p){const a=p,u=Math.min(c,s.rendLineNumberStart-1);a<=u&&(this._insertLinesBefore(s,a,u,o,p),s.linesLength+=u-a+1)}else if(s.rendLineNumberStart0&&(this._removeLinesBefore(s,a),s.linesLength-=a)}if(s.rendLineNumberStart=p,s.rendLineNumberStart+s.linesLength-1c){const a=Math.max(0,c-s.rendLineNumberStart+1),r=s.linesLength-1-a+1;r>0&&(this._removeLinesAfter(s,r),s.linesLength-=r)}return this._finishRendering(s,!1,o),s}_renderUntouchedLines(g,p,c,o,s){const a=g.rendLineNumberStart,u=g.lines;for(let r=p;r<=c;r++){const i=a+r;u[r].layoutLine(i,o[i-s])}}_insertLinesBefore(g,p,c,o,s){const a=[];let u=0;for(let r=p;r<=c;r++)a[u++]=this.host.createVisibleLine();g.lines=a.concat(g.lines)}_removeLinesBefore(g,p){for(let c=0;c=0;u--){const r=g.lines[u];o[u]&&(r.setDomNode(a),a=a.previousSibling)}}_finishRenderingInvalidLines(g,p,c){const o=document.createElement("div");C._ttPolicy&&(p=C._ttPolicy.createHTML(p)),o.innerHTML=p;for(let s=0;sd}),C._sb=N.createStringBuilder(1e5)}),define(Q[127],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TokenizationResult2=e.TokenizationResult=e.Token=void 0;class b{constructor(S,C,d){this.offset=S|0,this.type=C,this.language=d}toString(){return"("+this.offset+", "+this.type+")"}}e.Token=b;class N{constructor(S,C){this.tokens=S,this.endState=C}}e.TokenizationResult=N;class M{constructor(S,C){this.tokens=S,this.endState=C}}e.TokenizationResult2=M}),define(Q[368],J([0,1,153,8]),function(q,e,b,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DiffComputer=void 0;const M=3;function w(u,r,i,n){return new b.LcsDiff(u,r,i).ComputeDiff(n)}class S{constructor(r){const i=[],n=[];for(let t=0,l=r.length;t0&&i.originalLength<20&&i.modifiedLength>0&&i.modifiedLength<20&&l()){const I=n.createCharSequence(r,i.originalStart,i.originalStart+i.originalLength-1),k=t.createCharSequence(r,i.modifiedStart,i.modifiedStart+i.modifiedLength-1);let E=w(I,k,l,!0).changes;m&&(E=g(E)),L=[];for(let T=0,O=E.length;T1&&E>1;){const T=L.charCodeAt(k-2),O=I.charCodeAt(E-2);if(T!==O)break;k--,E--}(k>1||E>1)&&this._pushTrimWhitespaceCharChange(t,l+1,1,k,h+1,1,E)}{let k=s(L,1),E=s(I,1);const T=L.length+1,O=I.length+1;for(;k!0;const r=Date.now();return()=>Date.now()-r0&&o>0)&&!(s>0&&a>0)){let u=Math.abs(o-a),r=Math.abs(c-s);if(u===0){g.spacesDiff=r,r>0&&0<=s-1&&s-10?g++:v>1&&p++,N(c,o,h,f,r),!(r.looksLikeAlignment&&!(C&&S===r.spacesDiff)))){let L=r.spacesDiff;L<=a&&u[L]++,c=h,o=f}}let i=C;g!==p&&(i=g{let h=u[l];h>t&&(t=h,n=l)}),n===4&&u[4]>0&&u[2]>0&&u[2]>=u[4]/2&&(n=2)}return{insertSpaces:i,tabSize:n}}e.guessIndentation=M}),define(Q[370],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.intervalCompare=e.recomputeMaxEnd=e.nodeAcceptEdit=e.IntervalTree=e.SENTINEL=e.IntervalNode=e.getNodeIsInOverviewRuler=e.getNodeColor=void 0;function b(D){return(D.metadata&1)>>>0}e.getNodeColor=b;function N(D,R){D.metadata=D.metadata&254|R<<0}function M(D){return(D.metadata&2)>>>1==1}function w(D,R){D.metadata=D.metadata&253|(R?1:0)<<1}function S(D){return(D.metadata&4)>>>2==1}function C(D,R){D.metadata=D.metadata&251|(R?1:0)<<2}function d(D){return(D.metadata&8)>>>3==1}e.getNodeIsInOverviewRuler=d;function g(D,R){D.metadata=D.metadata&247|(R?1:0)<<3}function p(D){return(D.metadata&48)>>>4}function c(D,R){D.metadata=D.metadata&207|R<<4}function o(D){return(D.metadata&64)>>>6==1}function s(D,R){D.metadata=D.metadata&191|(R?1:0)<<6}class a{constructor(R,W,x){this.metadata=0,this.parent=this,this.left=this,this.right=this,N(this,1),this.start=W,this.end=x,this.delta=0,this.maxEnd=x,this.id=R,this.ownerId=0,this.options=null,C(this,!1),c(this,1),g(this,!1),s(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=W,this.cachedAbsoluteEnd=x,this.range=null,w(this,!1)}reset(R,W,x,K){this.start=W,this.end=x,this.maxEnd=x,this.cachedVersionId=R,this.cachedAbsoluteStart=W,this.cachedAbsoluteEnd=x,this.range=K}setOptions(R){this.options=R;let W=this.options.className;C(this,W==="squiggly-error"||W==="squiggly-warning"||W==="squiggly-info"),c(this,this.options.stickiness),g(this,!!(this.options.overviewRuler&&this.options.overviewRuler.color)),s(this,this.options.collapseOnReplaceEdit)}setCachedOffsets(R,W,x){this.cachedVersionId!==x&&(this.range=null),this.cachedVersionId=x,this.cachedAbsoluteStart=R,this.cachedAbsoluteEnd=W}detach(){this.parent=null,this.left=null,this.right=null}}e.IntervalNode=a,e.SENTINEL=new a(null,0,0),e.SENTINEL.parent=e.SENTINEL,e.SENTINEL.left=e.SENTINEL,e.SENTINEL.right=e.SENTINEL,N(e.SENTINEL,0);class u{constructor(){this.root=e.SENTINEL,this.requestNormalizeDelta=!1}intervalSearch(R,W,x,K,Y){return this.root===e.SENTINEL?[]:f(this,R,W,x,K,Y)}search(R,W,x){return this.root===e.SENTINEL?[]:_(this,R,W,x)}collectNodesFromOwner(R){return h(this,R)}collectNodesPostOrder(){return m(this)}insert(R){v(this,R),this._normalizeDeltaIfNecessary()}delete(R){L(this,R),this._normalizeDeltaIfNecessary()}resolveNode(R,W){const x=R;let K=0;for(;R!==this.root;)R===R.parent.right&&(K+=R.parent.delta),R=R.parent;const Y=x.start+K,ee=x.end+K;x.setCachedOffsets(Y,ee,W)}acceptReplace(R,W,x,K){const Y=t(this,R,R+W);for(let ee=0,se=Y.length;eeW||x===1?!1:x===2?!0:R}function n(D,R,W,x,K){const Y=p(D),ee=Y===0||Y===2,se=Y===1||Y===2,ne=W-R,le=x,X=Math.min(ne,le),z=D.start;let P=!1;const V=D.end;let U=!1;R<=z&&V<=W&&o(D)&&(D.start=R,P=!0,D.end=R,U=!0);{const $=K?1:ne>0?2:0;!P&&i(z,ee,R,$)&&(P=!0),!U&&i(V,se,R,$)&&(U=!0)}if(X>0&&!K){const $=ne>le?2:0;!P&&i(z,ee,R+X,$)&&(P=!0),!U&&i(V,se,R+X,$)&&(U=!0)}{const $=K?1:0;!P&&i(z,ee,W,$)&&(D.start=R+le,P=!0),!U&&i(V,se,W,$)&&(D.end=R+le,U=!0)}const H=le-ne;P||(D.start=Math.max(0,z+H)),U||(D.end=Math.max(0,V+H)),D.start>D.end&&(D.end=D.start)}e.nodeAcceptEdit=n;function t(D,R,W){let x=D.root,K=0,Y=0,ee=0,se=0,ne=[],le=0;for(;x!==e.SENTINEL;){if(M(x)){w(x.left,!1),w(x.right,!1),x===x.parent.right&&(K-=x.parent.delta),x=x.parent;continue}if(!M(x.left)){if(Y=K+x.maxEnd,YW){w(x,!0);continue}if(se=K+x.end,se>=R&&(x.setCachedOffsets(ee,se,0),ne[le++]=x),w(x,!0),x.right!==e.SENTINEL&&!M(x.right)){K+=x.delta,x=x.right;continue}}return w(D.root,!1),ne}function l(D,R,W,x){let K=D.root,Y=0,ee=0,se=0;const ne=x-(W-R);for(;K!==e.SENTINEL;){if(M(K)){w(K.left,!1),w(K.right,!1),K===K.parent.right&&(Y-=K.parent.delta),A(K),K=K.parent;continue}if(!M(K.left)){if(ee=Y+K.maxEnd,eeW){K.start+=ne,K.end+=ne,K.delta+=ne,(K.delta<-1073741824||K.delta>1073741824)&&(D.requestNormalizeDelta=!0),w(K,!0);continue}if(w(K,!0),K.right!==e.SENTINEL&&!M(K.right)){Y+=K.delta,K=K.right;continue}}w(D.root,!1)}function h(D,R){let W=D.root,x=[],K=0;for(;W!==e.SENTINEL;){if(M(W)){w(W.left,!1),w(W.right,!1),W=W.parent;continue}if(W.left!==e.SENTINEL&&!M(W.left)){W=W.left;continue}if(W.ownerId===R&&(x[K++]=W),w(W,!0),W.right!==e.SENTINEL&&!M(W.right)){W=W.right;continue}}return w(D.root,!1),x}function m(D){let R=D.root,W=[],x=0;for(;R!==e.SENTINEL;){if(M(R)){w(R.left,!1),w(R.right,!1),R=R.parent;continue}if(R.left!==e.SENTINEL&&!M(R.left)){R=R.left;continue}if(R.right!==e.SENTINEL&&!M(R.right)){R=R.right;continue}W[x++]=R,w(R,!0)}return w(D.root,!1),W}function _(D,R,W,x){let K=D.root,Y=0,ee=0,se=0,ne=[],le=0;for(;K!==e.SENTINEL;){if(M(K)){w(K.left,!1),w(K.right,!1),K===K.parent.right&&(Y-=K.parent.delta),K=K.parent;continue}if(K.left!==e.SENTINEL&&!M(K.left)){K=K.left;continue}ee=Y+K.start,se=Y+K.end,K.setCachedOffsets(ee,se,x);let X=!0;if(R&&K.ownerId&&K.ownerId!==R&&(X=!1),W&&S(K)&&(X=!1),X&&(ne[le++]=K),w(K,!0),K.right!==e.SENTINEL&&!M(K.right)){Y+=K.delta,K=K.right;continue}}return w(D.root,!1),ne}function f(D,R,W,x,K,Y){let ee=D.root,se=0,ne=0,le=0,X=0,z=[],P=0;for(;ee!==e.SENTINEL;){if(M(ee)){w(ee.left,!1),w(ee.right,!1),ee===ee.parent.right&&(se-=ee.parent.delta),ee=ee.parent;continue}if(!M(ee.left)){if(ne=se+ee.maxEnd,neW){w(ee,!0);continue}if(X=se+ee.end,X>=R){ee.setCachedOffsets(le,X,Y);let V=!0;x&&ee.ownerId&&ee.ownerId!==x&&(V=!1),K&&S(ee)&&(V=!1),V&&(z[P++]=ee)}if(w(ee,!0),ee.right!==e.SENTINEL&&!M(ee.right)){se+=ee.delta,ee=ee.right;continue}}return w(D.root,!1),z}function v(D,R){if(D.root===e.SENTINEL)return R.parent=e.SENTINEL,R.left=e.SENTINEL,R.right=e.SENTINEL,N(R,0),D.root=R,D.root;y(D,R),B(R.parent);let W=R;for(;W!==D.root&&b(W.parent)===1;)if(W.parent===W.parent.parent.left){const x=W.parent.parent.right;b(x)===1?(N(W.parent,0),N(x,0),N(W.parent.parent,1),W=W.parent.parent):(W===W.parent.right&&(W=W.parent,E(D,W)),N(W.parent,0),N(W.parent.parent,1),T(D,W.parent.parent))}else{const x=W.parent.parent.left;b(x)===1?(N(W.parent,0),N(x,0),N(W.parent.parent,1),W=W.parent.parent):(W===W.parent.left&&(W=W.parent,T(D,W)),N(W.parent,0),N(W.parent.parent,1),E(D,W.parent.parent))}return N(D.root,0),R}function y(D,R){let W=0,x=D.root;const K=R.start,Y=R.end;for(;;)if(F(K,Y,x.start+W,x.end+W)<0)if(x.left===e.SENTINEL){R.start-=W,R.end-=W,R.maxEnd-=W,x.left=R;break}else x=x.left;else if(x.right===e.SENTINEL){R.start-=W+x.delta,R.end-=W+x.delta,R.maxEnd-=W+x.delta,x.right=R;break}else W+=x.delta,x=x.right;R.parent=x,R.left=e.SENTINEL,R.right=e.SENTINEL,N(R,1)}function L(D,R){let W,x;if(R.left===e.SENTINEL?(W=R.right,x=R,W.delta+=R.delta,(W.delta<-1073741824||W.delta>1073741824)&&(D.requestNormalizeDelta=!0),W.start+=R.delta,W.end+=R.delta):R.right===e.SENTINEL?(W=R.left,x=R):(x=I(R.right),W=x.right,W.start+=x.delta,W.end+=x.delta,W.delta+=x.delta,(W.delta<-1073741824||W.delta>1073741824)&&(D.requestNormalizeDelta=!0),x.start+=R.delta,x.end+=R.delta,x.delta=R.delta,(x.delta<-1073741824||x.delta>1073741824)&&(D.requestNormalizeDelta=!0)),x===D.root){D.root=W,N(W,0),R.detach(),k(),A(W),D.root.parent=e.SENTINEL;return}let K=b(x)===1;if(x===x.parent.left?x.parent.left=W:x.parent.right=W,x===R?W.parent=x.parent:(x.parent===R?W.parent=x:W.parent=x.parent,x.left=R.left,x.right=R.right,x.parent=R.parent,N(x,b(R)),R===D.root?D.root=x:R===R.parent.left?R.parent.left=x:R.parent.right=x,x.left!==e.SENTINEL&&(x.left.parent=x),x.right!==e.SENTINEL&&(x.right.parent=x)),R.detach(),K){B(W.parent),x!==R&&(B(x),B(x.parent)),k();return}B(W),B(W.parent),x!==R&&(B(x),B(x.parent));let Y;for(;W!==D.root&&b(W)===0;)W===W.parent.left?(Y=W.parent.right,b(Y)===1&&(N(Y,0),N(W.parent,1),E(D,W.parent),Y=W.parent.right),b(Y.left)===0&&b(Y.right)===0?(N(Y,1),W=W.parent):(b(Y.right)===0&&(N(Y.left,0),N(Y,1),T(D,Y),Y=W.parent.right),N(Y,b(W.parent)),N(W.parent,0),N(Y.right,0),E(D,W.parent),W=D.root)):(Y=W.parent.left,b(Y)===1&&(N(Y,0),N(W.parent,1),T(D,W.parent),Y=W.parent.left),b(Y.left)===0&&b(Y.right)===0?(N(Y,1),W=W.parent):(b(Y.left)===0&&(N(Y.right,0),N(Y,1),E(D,Y),Y=W.parent.left),N(Y,b(W.parent)),N(W.parent,0),N(Y.left,0),T(D,W.parent),W=D.root));N(W,0),k()}function I(D){for(;D.left!==e.SENTINEL;)D=D.left;return D}function k(){e.SENTINEL.parent=e.SENTINEL,e.SENTINEL.delta=0,e.SENTINEL.start=0,e.SENTINEL.end=0}function E(D,R){const W=R.right;W.delta+=R.delta,(W.delta<-1073741824||W.delta>1073741824)&&(D.requestNormalizeDelta=!0),W.start+=R.delta,W.end+=R.delta,R.right=W.left,W.left!==e.SENTINEL&&(W.left.parent=R),W.parent=R.parent,R.parent===e.SENTINEL?D.root=W:R===R.parent.left?R.parent.left=W:R.parent.right=W,W.left=R,R.parent=W,A(R),A(W)}function T(D,R){const W=R.left;R.delta-=W.delta,(R.delta<-1073741824||R.delta>1073741824)&&(D.requestNormalizeDelta=!0),R.start-=W.delta,R.end-=W.delta,R.left=W.right,W.right!==e.SENTINEL&&(W.right.parent=R),W.parent=R.parent,R.parent===e.SENTINEL?D.root=W:R===R.parent.right?R.parent.right=W:R.parent.left=W,W.right=R,R.parent=W,A(R),A(W)}function O(D){let R=D.end;if(D.left!==e.SENTINEL){const W=D.left.maxEnd;W>R&&(R=W)}if(D.right!==e.SENTINEL){const W=D.right.maxEnd+D.delta;W>R&&(R=W)}return R}function A(D){D.maxEnd=O(D)}e.recomputeMaxEnd=A;function B(D){for(;D!==e.SENTINEL;){const R=O(D);if(D.maxEnd===R)return;D.maxEnd=R,D=D.parent}}function F(D,R,W,x){return D===W?R-x:D-W}e.intervalCompare=F}),define(Q[371],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.recomputeTreeMetadata=e.updateTreeMetadata=e.fixInsert=e.rbDelete=e.rightRotate=e.leftRotate=e.resetSentinel=e.calculateLF=e.calculateSize=e.righttest=e.leftest=e.SENTINEL=e.TreeNode=void 0;class b{constructor(u,r){this.piece=u,this.color=r,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==e.SENTINEL)return N(this.right);let u=this;for(;u.parent!==e.SENTINEL&&u.parent.left!==u;)u=u.parent;return u.parent===e.SENTINEL?e.SENTINEL:u.parent}prev(){if(this.left!==e.SENTINEL)return M(this.left);let u=this;for(;u.parent!==e.SENTINEL&&u.parent.right!==u;)u=u.parent;return u.parent===e.SENTINEL?e.SENTINEL:u.parent}detach(){this.parent=null,this.left=null,this.right=null}}e.TreeNode=b,e.SENTINEL=new b(null,0),e.SENTINEL.parent=e.SENTINEL,e.SENTINEL.left=e.SENTINEL,e.SENTINEL.right=e.SENTINEL,e.SENTINEL.color=0;function N(a){for(;a.left!==e.SENTINEL;)a=a.left;return a}e.leftest=N;function M(a){for(;a.right!==e.SENTINEL;)a=a.right;return a}e.righttest=M;function w(a){return a===e.SENTINEL?0:a.size_left+a.piece.length+w(a.right)}e.calculateSize=w;function S(a){return a===e.SENTINEL?0:a.lf_left+a.piece.lineFeedCnt+S(a.right)}e.calculateLF=S;function C(){e.SENTINEL.parent=e.SENTINEL}e.resetSentinel=C;function d(a,u){let r=u.right;r.size_left+=u.size_left+(u.piece?u.piece.length:0),r.lf_left+=u.lf_left+(u.piece?u.piece.lineFeedCnt:0),u.right=r.left,r.left!==e.SENTINEL&&(r.left.parent=u),r.parent=u.parent,u.parent===e.SENTINEL?a.root=r:u.parent.left===u?u.parent.left=r:u.parent.right=r,r.left=u,u.parent=r}e.leftRotate=d;function g(a,u){let r=u.left;u.left=r.right,r.right!==e.SENTINEL&&(r.right.parent=u),r.parent=u.parent,u.size_left-=r.size_left+(r.piece?r.piece.length:0),u.lf_left-=r.lf_left+(r.piece?r.piece.lineFeedCnt:0),u.parent===e.SENTINEL?a.root=r:u===u.parent.right?u.parent.right=r:u.parent.left=r,r.right=u,u.parent=r}e.rightRotate=g;function p(a,u){let r,i;if(u.left===e.SENTINEL?(i=u,r=i.right):u.right===e.SENTINEL?(i=u,r=i.left):(i=N(u.right),r=i.right),i===a.root){a.root=r,r.color=0,u.detach(),C(),a.root.parent=e.SENTINEL;return}let n=i.color===1;if(i===i.parent.left?i.parent.left=r:i.parent.right=r,i===u?(r.parent=i.parent,s(a,r)):(i.parent===u?r.parent=i:r.parent=i.parent,s(a,r),i.left=u.left,i.right=u.right,i.parent=u.parent,i.color=u.color,u===a.root?a.root=i:u===u.parent.left?u.parent.left=i:u.parent.right=i,i.left!==e.SENTINEL&&(i.left.parent=i),i.right!==e.SENTINEL&&(i.right.parent=i),i.size_left=u.size_left,i.lf_left=u.lf_left,s(a,i)),u.detach(),r.parent.left===r){let l=w(r),h=S(r);if(l!==r.parent.size_left||h!==r.parent.lf_left){let m=l-r.parent.size_left,_=h-r.parent.lf_left;r.parent.size_left=l,r.parent.lf_left=h,o(a,r.parent,m,_)}}if(s(a,r.parent),n){C();return}let t;for(;r!==a.root&&r.color===0;)r===r.parent.left?(t=r.parent.right,t.color===1&&(t.color=0,r.parent.color=1,d(a,r.parent),t=r.parent.right),t.left.color===0&&t.right.color===0?(t.color=1,r=r.parent):(t.right.color===0&&(t.left.color=0,t.color=1,g(a,t),t=r.parent.right),t.color=r.parent.color,r.parent.color=0,t.right.color=0,d(a,r.parent),r=a.root)):(t=r.parent.left,t.color===1&&(t.color=0,r.parent.color=1,g(a,r.parent),t=r.parent.left),t.left.color===0&&t.right.color===0?(t.color=1,r=r.parent):(t.left.color===0&&(t.right.color=0,t.color=1,d(a,t),t=r.parent.left),t.color=r.parent.color,r.parent.color=0,t.left.color=0,g(a,r.parent),r=a.root));r.color=0,C()}e.rbDelete=p;function c(a,u){for(s(a,u);u!==a.root&&u.parent.color===1;)if(u.parent===u.parent.parent.left){const r=u.parent.parent.right;r.color===1?(u.parent.color=0,r.color=0,u.parent.parent.color=1,u=u.parent.parent):(u===u.parent.right&&(u=u.parent,d(a,u)),u.parent.color=0,u.parent.parent.color=1,g(a,u.parent.parent))}else{const r=u.parent.parent.left;r.color===1?(u.parent.color=0,r.color=0,u.parent.parent.color=1,u=u.parent.parent):(u===u.parent.left&&(u=u.parent,g(a,u)),u.parent.color=0,u.parent.parent.color=1,d(a,u.parent.parent))}a.root.color=0}e.fixInsert=c;function o(a,u,r,i){for(;u!==a.root&&u!==e.SENTINEL;)u.parent.left===u&&(u.parent.size_left+=r,u.parent.lf_left+=i),u=u.parent}e.updateTreeMetadata=o;function s(a,u){let r=0,i=0;if(u!==a.root){if(r===0){for(;u!==a.root&&u===u.parent.right;)u=u.parent;if(u===a.root)return;u=u.parent,r=w(u.left)-u.size_left,i=S(u.left)-u.lf_left,u.size_left+=r,u.lf_left+=i}for(;u!==a.root&&(r!==0||i!==0);)u.parent.left===u&&(u.parent.size_left+=r,u.parent.lf_left+=i),u=u.parent}}e.recomputeTreeMetadata=s}),define(Q[218],J([0,1,101,93]),function(q,e,b,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.compressConsecutiveTextChanges=e.TextChange=void 0;function M(d){return d.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}class w{constructor(g,p,c,o){this.oldPosition=g,this.oldText=p,this.newPosition=c,this.newText=o}get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${M(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${M(this.oldText)}")`:`(replace@${this.oldPosition} "${M(this.oldText)}" with "${M(this.newText)}")`}static _writeStringSize(g){return 4+2*g.length}static _writeString(g,p,c){const o=p.length;b.writeUInt32BE(g,o,c),c+=4;for(let s=0;s=0;let l=null;try{l=b.createRegExp(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:t,global:!0,unicode:!0})}catch(m){return null}if(!l)return null;let h=!this.isRegex&&!t;return h&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(h=this.matchCase),new p(l,this.wordSeparators?N.getMapForWordSeparators(this.wordSeparators):null,h?this.searchString:null)}}e.SearchParams=d;function g(n){if(!n||n.length===0)return!1;for(let t=0,l=n.length;t=l)break;const m=n.charCodeAt(t);if(m===110||m===114||m===87||m===119)return!0}return!1}e.isMultilineRegexSource=g;class p{constructor(t,l,h){this.regex=t,this.wordSeparators=l,this.simpleSearch=h}}e.SearchData=p;function c(n,t,l){if(!l)return new S.FindMatch(n,null);let h=[];for(let m=0,_=t.length;m<_;m++)h[m]=t[m];return new S.FindMatch(n,h)}e.createFindMatch=c;class o{constructor(t){let l=[],h=0;for(let m=0,_=t.length;m<_;m++)t.charCodeAt(m)===10&&(l[h++]=m);this._lineFeedsOffsets=l}findLineFeedCountBeforeOffset(t){const l=this._lineFeedsOffsets;let h=0,m=l.length-1;if(m===-1||t<=l[0])return 0;for(;h>0);l[_]>=t?m=_-1:l[_+1]>=t?(h=_,m=_):h=_+1}return h+1}}class s{static findMatches(t,l,h,m,_){const f=l.parseSearchRequest();return f?f.regex.multiline?this._doFindMatchesMultiline(t,h,new i(f.wordSeparators,f.regex),m,_):this._doFindMatchesLineByLine(t,h,f,m,_):[]}static _getMultilineMatchRange(t,l,h,m,_,f){let v,y=0;m?(y=m.findLineFeedCountBeforeOffset(_),v=l+_+y):v=l+_;let L;if(m){let T=m.findLineFeedCountBeforeOffset(_+f.length)-y;L=v+f.length+T}else L=v+f.length;const I=t.getPositionAt(v),k=t.getPositionAt(L);return new w.Range(I.lineNumber,I.column,k.lineNumber,k.column)}static _doFindMatchesMultiline(t,l,h,m,_){const f=t.getOffsetAt(l.getStartPosition()),v=t.getValueInRange(l,1),y=t.getEOL()===`\r
-`?new o(v):null,L=[];let I=0,k;for(h.reset(0);k=h.next(v);)if(L[I++]=c(this._getMultilineMatchRange(t,f,v,y,k.index,k[0]),k,m),I>=_)return L;return L}static _doFindMatchesLineByLine(t,l,h,m,_){const f=[];let v=0;if(l.startLineNumber===l.endLineNumber){const L=t.getLineContent(l.startLineNumber).substring(l.startColumn-1,l.endColumn-1);return v=this._findMatchesInLine(h,L,l.startLineNumber,l.startColumn-1,v,f,m,_),f}const y=t.getLineContent(l.startLineNumber).substring(l.startColumn-1);v=this._findMatchesInLine(h,y,l.startLineNumber,l.startColumn-1,v,f,m,_);for(let L=l.startLineNumber+1;L=y))return _;return _}const I=new i(t.wordSeparators,t.regex);let k;I.reset(0);do if(k=I.next(l),k&&(f[_++]=c(new w.Range(h,k.index+1+m,h,k.index+1+k[0].length+m),k,v),_>=y))return _;while(k);return _}static findNextMatch(t,l,h,m){const _=l.parseSearchRequest();if(!_)return null;const f=new i(_.wordSeparators,_.regex);return _.regex.multiline?this._doFindNextMatchMultiline(t,h,f,m):this._doFindNextMatchLineByLine(t,h,f,m)}static _doFindNextMatchMultiline(t,l,h,m){const _=new M.Position(l.lineNumber,1),f=t.getOffsetAt(_),v=t.getLineCount(),y=t.getValueInRange(new w.Range(_.lineNumber,_.column,v,t.getLineMaxColumn(v)),1),L=t.getEOL()===`\r
-`?new o(y):null;h.reset(l.column-1);let I=h.next(y);return I?c(this._getMultilineMatchRange(t,f,y,L,I.index,I[0]),I,m):l.lineNumber!==1||l.column!==1?this._doFindNextMatchMultiline(t,new M.Position(1,1),h,m):null}static _doFindNextMatchLineByLine(t,l,h,m){const _=t.getLineCount(),f=l.lineNumber,v=t.getLineContent(f),y=this._findFirstMatchInLine(h,v,f,l.column,m);if(y)return y;for(let L=1;L<=_;L++){const I=(f+L-1)%_,k=t.getLineContent(I+1),E=this._findFirstMatchInLine(h,k,I+1,1,m);if(E)return E}return null}static _findFirstMatchInLine(t,l,h,m,_){t.reset(m-1);const f=t.next(l);return f?c(new w.Range(h,f.index+1,h,f.index+1+f[0].length),f,_):null}static findPreviousMatch(t,l,h,m){const _=l.parseSearchRequest();if(!_)return null;const f=new i(_.wordSeparators,_.regex);return _.regex.multiline?this._doFindPreviousMatchMultiline(t,h,f,m):this._doFindPreviousMatchLineByLine(t,h,f,m)}static _doFindPreviousMatchMultiline(t,l,h,m){const _=this._doFindMatchesMultiline(t,new w.Range(1,1,l.lineNumber,l.column),h,m,10*C);if(_.length>0)return _[_.length-1];const f=t.getLineCount();return l.lineNumber!==f||l.column!==t.getLineMaxColumn(f)?this._doFindPreviousMatchMultiline(t,new M.Position(f,t.getLineMaxColumn(f)),h,m):null}static _doFindPreviousMatchLineByLine(t,l,h,m){const _=t.getLineCount(),f=l.lineNumber,v=t.getLineContent(f).substring(0,l.column-1),y=this._findLastMatchInLine(h,v,f,m);if(y)return y;for(let L=1;L<=_;L++){const I=(_+f-L-1)%_,k=t.getLineContent(I+1),E=this._findLastMatchInLine(h,k,I+1,m);if(E)return E}return null}static _findLastMatchInLine(t,l,h,m){let _=null,f;for(t.reset(0);f=t.next(l);)_=c(new w.Range(h,f.index+1,h,f.index+1+f[0].length),f,m);return _}}e.TextModelSearch=s;function a(n,t,l,h,m){if(h===0)return!0;const _=t.charCodeAt(h-1);if(n.get(_)!==0||_===13||_===10)return!0;if(m>0){const f=t.charCodeAt(h);if(n.get(f)!==0)return!0}return!1}function u(n,t,l,h,m){if(h+m===l)return!0;const _=t.charCodeAt(h+m);if(n.get(_)!==0||_===13||_===10)return!0;if(m>0){const f=t.charCodeAt(h+m-1);if(n.get(f)!==0)return!0}return!1}function r(n,t,l,h,m){return a(n,t,l,h,m)&&u(n,t,l,h,m)}e.isValidMatch=r;class i{constructor(t,l){this._wordSeparators=t,this._searchRegex=l,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(t){this._searchRegex.lastIndex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(t){const l=t.length;let h;do{if(this._prevMatchStartIndex+this._prevMatchLength===l||(h=this._searchRegex.exec(t),!h))return null;const m=h.index,_=h[0].length;if(m===this._prevMatchStartIndex&&_===this._prevMatchLength){if(_===0){b.getNextCodePoint(t,l,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=m,this._prevMatchLength=_,!this._wordSeparators||r(this._wordSeparators,t,l,m,_))return h}while(h);return null}}e.Searcher=i}),define(Q[219],J([0,1,14,3,53,371,166]),function(q,e,b,N,M,w,S){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.PieceTreeBase=e.StringBuffer=e.Piece=e.createLineStarts=e.createLineStartsFast=e.LineStarts=e.createUintArray=e.AverageBufferSize=void 0,e.AverageBufferSize=65535;function C(r){let i;return r[r.length-1]<65536?i=new Uint16Array(r.length):i=new Uint32Array(r.length),i.set(r,0),i}e.createUintArray=C;class d{constructor(i,n,t,l,h){this.lineStarts=i,this.cr=n,this.lf=t,this.crlf=l,this.isBasicASCII=h}}e.LineStarts=d;function g(r,i=!0){let n=[0],t=1;for(let l=0,h=r.length;l126)&&(m=!1)}const _=new d(C(r),t,l,h,m);return r.length=0,_}e.createLineStarts=p;class c{constructor(i,n,t,l,h){this.bufferIndex=i,this.start=n,this.end=t,this.lineFeedCnt=l,this.length=h}}e.Piece=c;class o{constructor(i,n){this.buffer=i,this.lineStarts=n}}e.StringBuffer=o;class s{constructor(i,n){this._pieces=[],this._tree=i,this._BOM=n,this._index=0,i.root!==w.SENTINEL&&i.iterate(i.root,t=>(t!==w.SENTINEL&&this._pieces.push(t.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}}class a{constructor(i){this._limit=i,this._cache=[]}get(i){for(let n=this._cache.length-1;n>=0;n--){let t=this._cache[n];if(t.nodeStartOffset<=i&&t.nodeStartOffset+t.node.piece.length>=i)return t}return null}get2(i){for(let n=this._cache.length-1;n>=0;n--){let t=this._cache[n];if(t.nodeStartLineNumber&&t.nodeStartLineNumber=i)return t}return null}set(i){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(i)}validate(i){let n=!1,t=this._cache;for(let l=0;l=i){t[l]=null,n=!0;continue}}if(n){let l=[];for(const h of t)h!==null&&l.push(h);this._cache=l}}}class u{constructor(i,n,t){this.create(i,n,t)}create(i,n,t){this._buffers=[new o("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=w.SENTINEL,this._lineCnt=1,this._length=0,this._EOL=n,this._EOLLength=n.length,this._EOLNormalized=t;let l=null;for(let h=0,m=i.length;h0){i[h].lineStarts||(i[h].lineStarts=g(i[h].buffer));let _=new c(h+1,{line:0,column:0},{line:i[h].lineStarts.length-1,column:i[h].buffer.length-i[h].lineStarts[i[h].lineStarts.length-1]},i[h].lineStarts.length-1,i[h].buffer.length);this._buffers.push(i[h]),l=this.rbInsertRight(l,_)}this._searchCache=new a(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(i){let n=e.AverageBufferSize,t=n-Math.floor(n/3),l=t*2,h="",m=0,_=[];if(this.iterate(this.root,f=>{let v=this.getNodeContent(f),y=v.length;if(m<=t||m+y0){let f=h.replace(/\r\n|\r|\n/g,i);_.push(new o(f,g(f)))}this.create(_,i,!0)}getEOL(){return this._EOL}setEOL(i){this._EOL=i,this._EOLLength=this._EOL.length,this.normalizeEOL(i)}createSnapshot(i){return new s(this,i)}getOffsetAt(i,n){let t=0,l=this.root;for(;l!==w.SENTINEL;)if(l.left!==w.SENTINEL&&l.lf_left+1>=i)l=l.left;else{if(l.lf_left+l.piece.lineFeedCnt+1>=i)return t+=l.size_left,t+=this.getAccumulatedValue(l,i-l.lf_left-2)+n-1;i-=l.lf_left+l.piece.lineFeedCnt,t+=l.size_left+l.piece.length,l=l.right}return t}getPositionAt(i){i=Math.floor(i),i=Math.max(0,i);let n=this.root,t=0,l=i;for(;n!==w.SENTINEL;)if(n.size_left!==0&&n.size_left>=i)n=n.left;else if(n.size_left+n.piece.length>=i){let h=this.getIndexOf(n,i-n.size_left);if(t+=n.lf_left+h.index,h.index===0){let m=this.getOffsetAt(t+1,1),_=l-m;return new b.Position(t+1,_+1)}return new b.Position(t+1,h.remainder+1)}else if(i-=n.size_left+n.piece.length,t+=n.lf_left+n.piece.lineFeedCnt,n.right===w.SENTINEL){let h=this.getOffsetAt(t+1,1),m=l-i-h;return new b.Position(t+1,m+1)}else n=n.right;return new b.Position(1,1)}getValueInRange(i,n){if(i.startLineNumber===i.endLineNumber&&i.startColumn===i.endColumn)return"";let t=this.nodeAt2(i.startLineNumber,i.startColumn),l=this.nodeAt2(i.endLineNumber,i.endColumn),h=this.getValueInRange2(t,l);return n?n!==this._EOL||!this._EOLNormalized?h.replace(/\r\n|\r|\n/g,n):n===this.getEOL()&&this._EOLNormalized?h:h.replace(/\r\n|\r|\n/g,n):h}getValueInRange2(i,n){if(i.node===n.node){let _=i.node,f=this._buffers[_.piece.bufferIndex].buffer,v=this.offsetInBuffer(_.piece.bufferIndex,_.piece.start);return f.substring(v+i.remainder,v+n.remainder)}let t=i.node,l=this._buffers[t.piece.bufferIndex].buffer,h=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start),m=l.substring(h+i.remainder,h+t.piece.length);for(t=t.next();t!==w.SENTINEL;){let _=this._buffers[t.piece.bufferIndex].buffer,f=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);if(t===n.node){m+=_.substring(f,f+n.remainder);break}else m+=_.substr(f,t.piece.length);t=t.next()}return m}getLinesContent(){let i=[],n=0,t="",l=!1;return this.iterate(this.root,h=>{if(h===w.SENTINEL)return!0;const m=h.piece;let _=m.length;if(_===0)return!0;const f=this._buffers[m.bufferIndex].buffer,v=this._buffers[m.bufferIndex].lineStarts,y=m.start.line,L=m.end.line;let I=v[y]+m.start.column;if(l&&(f.charCodeAt(I)===10&&(I++,_--),i[n++]=t,t="",l=!1,_===0))return!0;if(y===L)return!this._EOLNormalized&&f.charCodeAt(I+_-1)===13?(l=!0,t+=f.substr(I,_-1)):t+=f.substr(I,_),!0;t+=this._EOLNormalized?f.substring(I,Math.max(I,v[y+1]-this._EOLLength)):f.substring(I,v[y+1]).replace(/(\r\n|\r|\n)$/,""),i[n++]=t;for(let k=y+1;kD+E,n.reset(0)):(B=I.buffer,F=D=>D,n.reset(E));do if(O=n.next(B),O){if(F(O.index)>=T)return y;this.positionInBuffer(i,F(O.index)-k,A);let D=this.getLineFeedCnt(i.piece.bufferIndex,h,A),R=A.line===h.line?A.column-h.column+l:A.column+1,W=R+O[0].length;if(L[y++]=S.createFindMatch(new N.Range(t+D,R,t+D,W),O,f),F(O.index)+O[0].length>=T||y>=v)return y}while(O);return y}findMatchesLineByLine(i,n,t,l){const h=[];let m=0;const _=new S.Searcher(n.wordSeparators,n.regex);let f=this.nodeAt2(i.startLineNumber,i.startColumn);if(f===null)return[];let v=this.nodeAt2(i.endLineNumber,i.endColumn);if(v===null)return[];let y=this.positionInBuffer(f.node,f.remainder),L=this.positionInBuffer(v.node,v.remainder);if(f.node===v.node)return this.findMatchesInNode(f.node,_,i.startLineNumber,i.startColumn,y,L,n,t,l,m,h),h;let I=i.startLineNumber,k=f.node;for(;k!==v.node;){let T=this.getLineFeedCnt(k.piece.bufferIndex,y,k.piece.end);if(T>=1){let A=this._buffers[k.piece.bufferIndex].lineStarts,B=this.offsetInBuffer(k.piece.bufferIndex,k.piece.start),F=A[y.line+T],D=I===i.startLineNumber?i.startColumn:1;if(m=this.findMatchesInNode(k,_,I,D,y,this.positionInBuffer(k,F-B),n,t,l,m,h),m>=l)return h;I+=T}let O=I===i.startLineNumber?i.startColumn-1:0;if(I===i.endLineNumber){const A=this.getLineContent(I).substring(O,i.endColumn-1);return m=this._findMatchesInLine(n,_,A,i.endLineNumber,O,m,h,t,l),h}if(m=this._findMatchesInLine(n,_,this.getLineContent(I).substr(O),I,O,m,h,t,l),m>=l)return h;I++,f=this.nodeAt2(I,1),k=f.node,y=this.positionInBuffer(f.node,f.remainder)}if(I===i.endLineNumber){let T=I===i.startLineNumber?i.startColumn-1:0;const O=this.getLineContent(I).substring(T,i.endColumn-1);return m=this._findMatchesInLine(n,_,O,i.endLineNumber,T,m,h,t,l),h}let E=I===i.startLineNumber?i.startColumn:1;return m=this.findMatchesInNode(v.node,_,I,E,y,L,n,t,l,m,h),h}_findMatchesInLine(i,n,t,l,h,m,_,f,v){const y=i.wordSeparators;if(!f&&i.simpleSearch){const I=i.simpleSearch,k=I.length,E=t.length;let T=-k;for(;(T=t.indexOf(I,T+k))!==-1;)if((!y||S.isValidMatch(y,t,E,T,k))&&(_[m++]=new M.FindMatch(new N.Range(l,T+1+h,l,T+1+k+h),null),m>=v))return m;return m}let L;n.reset(0);do if(L=n.next(t),L&&(_[m++]=S.createFindMatch(new N.Range(l,L.index+1+h,l,L.index+1+L[0].length+h),L,f),m>=v))return m;while(L);return m}insert(i,n,t=!1){if(this._EOLNormalized=this._EOLNormalized&&t,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==w.SENTINEL){let{node:l,remainder:h,nodeStartOffset:m}=this.nodeAt(i),_=l.piece,f=_.bufferIndex,v=this.positionInBuffer(l,h);if(l.piece.bufferIndex===0&&_.end.line===this._lastChangeBufferPos.line&&_.end.column===this._lastChangeBufferPos.column&&m+_.length===i&&n.lengthi){let y=[],L=new c(_.bufferIndex,v,_.end,this.getLineFeedCnt(_.bufferIndex,v,_.end),this.offsetInBuffer(f,_.end)-this.offsetInBuffer(f,v));if(this.shouldCheckCRLF()&&this.endWithCR(n)&&this.nodeCharCodeAt(l,h)===10){let T={line:L.start.line+1,column:0};L=new c(L.bufferIndex,T,L.end,this.getLineFeedCnt(L.bufferIndex,T,L.end),L.length-1),n+=`
-`}if(this.shouldCheckCRLF()&&this.startWithLF(n))if(this.nodeCharCodeAt(l,h-1)===13){let T=this.positionInBuffer(l,h-1);this.deleteNodeTail(l,T),n="\r"+n,l.piece.length===0&&y.push(l)}else this.deleteNodeTail(l,v);else this.deleteNodeTail(l,v);let I=this.createNewPieces(n);L.length>0&&this.rbInsertRight(l,L);let k=l;for(let E=0;E=0;m--)h=this.rbInsertLeft(h,l[m]);this.validateCRLFWithPrevNode(h),this.deleteNodes(t)}insertContentToNodeRight(i,n){this.adjustCarriageReturnFromNext(i,n)&&(i+=`
-`);let t=this.createNewPieces(i),l=this.rbInsertRight(n,t[0]),h=l;for(let m=1;m=I)v=L+1;else break;return t?(t.line=L,t.column=f-k,null):{line:L,column:f-k}}getLineFeedCnt(i,n,t){if(t.column===0)return t.line-n.line;let l=this._buffers[i].lineStarts;if(t.line===l.length-1)return t.line-n.line;let h=l[t.line+1],m=l[t.line]+t.column;if(h>m+1)return t.line-n.line;let _=m-1;return this._buffers[i].buffer.charCodeAt(_)===13?t.line-n.line+1:t.line-n.line}offsetInBuffer(i,n){return this._buffers[i].lineStarts[n.line]+n.column}deleteNodes(i){for(let n=0;ne.AverageBufferSize){let y=[];for(;i.length>e.AverageBufferSize;){const I=i.charCodeAt(e.AverageBufferSize-1);let k;I===13||I>=55296&&I<=56319?(k=i.substring(0,e.AverageBufferSize-1),i=i.substring(e.AverageBufferSize-1)):(k=i.substring(0,e.AverageBufferSize),i=i.substring(e.AverageBufferSize));let E=g(k);y.push(new c(this._buffers.length,{line:0,column:0},{line:E.length-1,column:k.length-E[E.length-1]},E.length-1,k.length)),this._buffers.push(new o(k,E))}let L=g(i);return y.push(new c(this._buffers.length,{line:0,column:0},{line:L.length-1,column:i.length-L[L.length-1]},L.length-1,i.length)),this._buffers.push(new o(i,L)),y}let n=this._buffers[0].buffer.length;const t=g(i,!1);let l=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===n&&n!==0&&this.startWithLF(i)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},l=this._lastChangeBufferPos;for(let y=0;y=i-1)t=t.left;else if(t.lf_left+t.piece.lineFeedCnt>i-1){let f=this.getAccumulatedValue(t,i-t.lf_left-2),v=this.getAccumulatedValue(t,i-t.lf_left-1),y=this._buffers[t.piece.bufferIndex].buffer,L=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return m+=t.size_left,this._searchCache.set({node:t,nodeStartOffset:m,nodeStartLineNumber:_-(i-1-t.lf_left)}),y.substring(L+f,L+v-n)}else if(t.lf_left+t.piece.lineFeedCnt===i-1){let f=this.getAccumulatedValue(t,i-t.lf_left-2),v=this._buffers[t.piece.bufferIndex].buffer,y=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);l=v.substring(y+f,y+t.piece.length);break}else i-=t.lf_left+t.piece.lineFeedCnt,m+=t.size_left+t.piece.length,t=t.right}for(t=t.next();t!==w.SENTINEL;){let m=this._buffers[t.piece.bufferIndex].buffer;if(t.piece.lineFeedCnt>0){let _=this.getAccumulatedValue(t,0),f=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return l+=m.substring(f,f+_-n),l}else{let _=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);l+=m.substr(_,t.piece.length)}t=t.next()}return l}computeBufferMetadata(){let i=this.root,n=1,t=0;for(;i!==w.SENTINEL;)n+=i.lf_left+i.piece.lineFeedCnt,t+=i.size_left+i.piece.length,i=i.right;this._lineCnt=n,this._length=t,this._searchCache.validate(this._length)}getIndexOf(i,n){let t=i.piece,l=this.positionInBuffer(i,n),h=l.line-t.start.line;if(this.offsetInBuffer(t.bufferIndex,t.end)-this.offsetInBuffer(t.bufferIndex,t.start)===n){let m=this.getLineFeedCnt(i.piece.bufferIndex,t.start,l);if(m!==h)return{index:m,remainder:0}}return{index:h,remainder:l.column}}getAccumulatedValue(i,n){if(n<0)return 0;let t=i.piece,l=this._buffers[t.bufferIndex].lineStarts,h=t.start.line+n+1;return h>t.end.line?l[t.end.line]+t.end.column-l[t.start.line]-t.start.column:l[h]-l[t.start.line]-t.start.column}deleteNodeTail(i,n){const t=i.piece,l=t.lineFeedCnt,h=this.offsetInBuffer(t.bufferIndex,t.end),m=n,_=this.offsetInBuffer(t.bufferIndex,m),f=this.getLineFeedCnt(t.bufferIndex,t.start,m),v=f-l,y=_-h,L=t.length+y;i.piece=new c(t.bufferIndex,t.start,m,f,L),w.updateTreeMetadata(this,i,y,v)}deleteNodeHead(i,n){const t=i.piece,l=t.lineFeedCnt,h=this.offsetInBuffer(t.bufferIndex,t.start),m=n,_=this.getLineFeedCnt(t.bufferIndex,m,t.end),f=this.offsetInBuffer(t.bufferIndex,m),v=_-l,y=h-f,L=t.length+y;i.piece=new c(t.bufferIndex,m,t.end,_,L),w.updateTreeMetadata(this,i,y,v)}shrinkNode(i,n,t){const l=i.piece,h=l.start,m=l.end,_=l.length,f=l.lineFeedCnt,v=n,y=this.getLineFeedCnt(l.bufferIndex,l.start,v),L=this.offsetInBuffer(l.bufferIndex,n)-this.offsetInBuffer(l.bufferIndex,h);i.piece=new c(l.bufferIndex,l.start,v,y,L),w.updateTreeMetadata(this,i,L-_,y-f);let I=new c(l.bufferIndex,t,m,this.getLineFeedCnt(l.bufferIndex,t,m),this.offsetInBuffer(l.bufferIndex,m)-this.offsetInBuffer(l.bufferIndex,t)),k=this.rbInsertRight(i,I);this.validateCRLFWithPrevNode(k)}appendToNode(i,n){this.adjustCarriageReturnFromNext(n,i)&&(n+=`
-`);const t=this.shouldCheckCRLF()&&this.startWithLF(n)&&this.endWithCR(i),l=this._buffers[0].buffer.length;this._buffers[0].buffer+=n;const h=g(n,!1);for(let k=0;ki)n=n.left;else if(n.size_left+n.piece.length>=i){l+=n.size_left;let h={node:n,remainder:i-n.size_left,nodeStartOffset:l};return this._searchCache.set(h),h}else i-=n.size_left+n.piece.length,l+=n.size_left+n.piece.length,n=n.right;return null}nodeAt2(i,n){let t=this.root,l=0;for(;t!==w.SENTINEL;)if(t.left!==w.SENTINEL&&t.lf_left>=i-1)t=t.left;else if(t.lf_left+t.piece.lineFeedCnt>i-1){let h=this.getAccumulatedValue(t,i-t.lf_left-2),m=this.getAccumulatedValue(t,i-t.lf_left-1);return l+=t.size_left,{node:t,remainder:Math.min(h+n-1,m),nodeStartOffset:l}}else if(t.lf_left+t.piece.lineFeedCnt===i-1){let h=this.getAccumulatedValue(t,i-t.lf_left-2);if(h+n-1<=t.piece.length)return{node:t,remainder:h+n-1,nodeStartOffset:l};n-=t.piece.length-h;break}else i-=t.lf_left+t.piece.lineFeedCnt,l+=t.size_left+t.piece.length,t=t.right;for(t=t.next();t!==w.SENTINEL;){if(t.piece.lineFeedCnt>0){let h=this.getAccumulatedValue(t,0),m=this.offsetOfNode(t);return{node:t,remainder:Math.min(n-1,h),nodeStartOffset:m}}else if(t.piece.length>=n-1){let h=this.offsetOfNode(t);return{node:t,remainder:n-1,nodeStartOffset:h}}else n-=t.piece.length;t=t.next()}return null}nodeCharCodeAt(i,n){if(i.piece.lineFeedCnt<1)return-1;let t=this._buffers[i.piece.bufferIndex],l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start)+n;return t.buffer.charCodeAt(l)}offsetOfNode(i){if(!i)return 0;let n=i.size_left;for(;i!==this.root;)i.parent.right===i&&(n+=i.parent.size_left+i.parent.piece.length),i=i.parent;return n}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===`
-`)}startWithLF(i){if(typeof i=="string")return i.charCodeAt(0)===10;if(i===w.SENTINEL||i.piece.lineFeedCnt===0)return!1;let n=i.piece,t=this._buffers[n.bufferIndex].lineStarts,l=n.start.line,h=t[l]+n.start.column;return l===t.length-1||t[l+1]>h+1?!1:this._buffers[n.bufferIndex].buffer.charCodeAt(h)===10}endWithCR(i){return typeof i=="string"?i.charCodeAt(i.length-1)===13:i===w.SENTINEL||i.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(i,i.piece.length-1)===13}validateCRLFWithPrevNode(i){if(this.shouldCheckCRLF()&&this.startWithLF(i)){let n=i.prev();this.endWithCR(n)&&this.fixCRLF(n,i)}}validateCRLFWithNextNode(i){if(this.shouldCheckCRLF()&&this.endWithCR(i)){let n=i.next();this.startWithLF(n)&&this.fixCRLF(i,n)}}fixCRLF(i,n){let t=[],l=this._buffers[i.piece.bufferIndex].lineStarts,h;i.piece.end.column===0?h={line:i.piece.end.line-1,column:l[i.piece.end.line]-l[i.piece.end.line-1]-1}:h={line:i.piece.end.line,column:i.piece.end.column-1};const m=i.piece.length-1,_=i.piece.lineFeedCnt-1;i.piece=new c(i.piece.bufferIndex,i.piece.start,h,_,m),w.updateTreeMetadata(this,i,-1,-1),i.piece.length===0&&t.push(i);let f={line:n.piece.start.line+1,column:0};const v=n.piece.length-1,y=this.getLineFeedCnt(n.piece.bufferIndex,f,n.piece.end);n.piece=new c(n.piece.bufferIndex,f,n.piece.end,y,v),w.updateTreeMetadata(this,n,-1,-1),n.piece.length===0&&t.push(n);let L=this.createNewPieces(`\r
-`);this.rbInsertRight(i,L[0]);for(let I=0;I/?";function b(C=""){let d="(-?\\d*\\.\\d\\w*)|([^";for(const g of e.USUAL_WORD_SEPARATORS)C.indexOf(g)>=0||(d+="\\"+g);return d+="\\s]+)",new RegExp(d,"g")}e.DEFAULT_WORD_REGEXP=b();function N(C){let d=e.DEFAULT_WORD_REGEXP;if(C&&C instanceof RegExp)if(C.global)d=C;else{let g="g";C.ignoreCase&&(g+="i"),C.multiline&&(g+="m"),C.unicode&&(g+="u"),d=new RegExp(C.source,g)}return d.lastIndex=0,d}e.ensureValidWordDefinition=N;const M={maxLen:1e3,windowSize:15,timeBudget:150};function w(C,d,g,p,c=M){if(g.length>c.maxLen){let r=C-c.maxLen/2;return r<0?r=0:p+=r,g=g.substring(r,C+c.maxLen/2),w(C,d,g,p,c)}const o=Date.now(),s=C-1-p;let a=-1,u=null;for(let r=1;!(Date.now()-o>=c.timeBudget);r++){const i=s-c.windowSize*r;d.lastIndex=Math.max(0,i);const n=S(d,g,s,a);if(!n&&u||(u=n,i<=0))break;a=i}if(u){let r={word:u[0],startColumn:p+1+u.index,endColumn:p+1+u.index+u[0].length};return d.lastIndex=0,r}return null}e.getWordAtText=w;function S(C,d,g,p){let c;for(;c=C.exec(d);){const o=c.index||0;if(o<=g&&C.lastIndex>=g)return c;if(p>0&&o>p)return null}return null}}),define(Q[373],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.FrankensteinMode=void 0;class b{constructor(M){this._languageIdentifier=M}getId(){return this._languageIdentifier.language}}e.FrankensteinMode=b}),define(Q[109],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AutoClosingPairs=e.StandardAutoClosingPairConditional=e.IndentAction=void 0;var b;(function(S){S[S.None=0]="None",S[S.Indent=1]="Indent",S[S.IndentOutdent=2]="IndentOutdent",S[S.Outdent=3]="Outdent"})(b=e.IndentAction||(e.IndentAction={}));class N{constructor(C){if(this.open=C.open,this.close=C.close,this._standardTokenMask=0,Array.isArray(C.notIn))for(let d=0,g=C.notIn.length;dg&&(g=c)}return g}else{if(typeof w=="string")return d?w==="*"?5:w===C?10:0:0;if(w){const{language:g,pattern:p,scheme:c,hasAccessToAllModels:o}=w;if(!d&&!o)return 0;let s=0;if(c)if(c===S.scheme)s=10;else if(c==="*")s=5;else return 0;if(g)if(g===C)s=10;else if(g==="*")s=Math.max(s,5);else return 0;if(p){let a;if(typeof p=="string"?a=p:a=Object.assign(Object.assign({},p),{base:N.normalize(p.base)}),a===S.fsPath||b.match(a,S.fsPath))s=10;else return 0}return s}else return 0}}e.score=M}),define(Q[375],J([0,1,91]),function(q,e,b){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.computeLinks=e.LinkComputer=e.StateMachine=e.Uint8Matrix=void 0;class N{constructor(o,s,a){const u=new Uint8Array(o*s);for(let r=0,i=o*s;rs&&(s=t),n>a&&(a=n),l>a&&(a=l)}s++,a++;let u=new N(a,s,0);for(let r=0,i=o.length;r=this._maxCharCode?0:this._states.get(o,s)}}e.StateMachine=M;let w=null;function S(){return w===null&&(w=new M([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),w}let C=null;function d(){if(C===null){C=new b.CharacterClassifier(0);const c=` <>'"\u3001\u3002\uFF61\uFF64\uFF0C\uFF0E\uFF1A\uFF1B\u2018\u201C\u3008\u300A\u300C\u300E\u3010\u3014\uFF08\uFF3B\uFF5B\uFF62\uFF63\uFF5D\uFF3D\uFF09\u3015\u3011\u300F\u300D\u300B\u3009\u201D\u2019\uFF40\uFF5E\u2026`;for(let s=0;su);if(u>0){const n=s.charCodeAt(u-1),t=s.charCodeAt(i);(n===40&&t===41||n===91&&t===93||n===123&&t===125)&&i--}return{range:{startLineNumber:a,startColumn:u+1,endLineNumber:a,endColumn:i+2},url:s.substring(u,i+1)}}static computeLinks(o,s=S()){const a=d();let u=[];for(let r=1,i=o.getLineCount();r<=i;r++){const n=o.getLineContent(r),t=n.length;let l=0,h=0,m=0,_=1,f=!1,v=!1,y=!1,L=!1;for(;l0&&w.getLanguageId(c-1)===g;)c--;return new N(w,g,c,p+1,w.getStartOffset(c),w.getEndOffset(p))}e.createScopedLineTokens=b;class N{constructor(S,C,d,g,p,c){this._actual=S,this.languageId=C,this._firstTokenIndex=d,this._lastTokenIndex=g,this.firstCharOffset=p,this._lastCharOffset=c}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getActualLineContentBefore(S){return this._actual.getLineContent().substring(0,this.firstCharOffset+S)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(S){return this._actual.findTokenIndexAtOffset(S+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(S){return this._actual.getStandardTokenType(S+this._firstTokenIndex)}}e.ScopedLineTokens=N;function M(w){return(w&7)!=0}e.ignoreBracketsInToken=M}),define(Q[376],J([0,1,109]),function(q,e,b){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.CharacterPairSupport=void 0;class N{constructor(w){if(w.autoClosingPairs?this._autoClosingPairs=w.autoClosingPairs.map(S=>new b.StandardAutoClosingPairConditional(S)):w.brackets?this._autoClosingPairs=w.brackets.map(S=>new b.StandardAutoClosingPairConditional({open:S[0],close:S[1]})):this._autoClosingPairs=[],w.__electricCharacterSupport&&w.__electricCharacterSupport.docComment){const S=w.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new b.StandardAutoClosingPairConditional({open:S.open,close:S.close||""}))}this._autoCloseBefore=typeof w.autoCloseBefore=="string"?w.autoCloseBefore:N.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED,this._surroundingPairs=w.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(){return this._autoCloseBefore}static shouldAutoClosePair(w,S,C){if(S.getTokenCount()===0)return!0;const d=S.findTokenIndexAtOffset(C-2),g=S.getStandardTokenType(d);return w.isOK(g)}getSurroundingPairs(){return this._surroundingPairs}}e.CharacterPairSupport=N,N.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED=`;:.,=}])>
- `}),define(Q[377],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.IndentRulesSupport=void 0;function b(M){return M.global&&(M.lastIndex=0),!0}class N{constructor(w){this._indentationRules=w}shouldIncrease(w){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&b(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(w))}shouldDecrease(w){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&b(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(w))}shouldIndentNextLine(w){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&b(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(w))}shouldIgnore(w){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&b(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(w))}getIndentMetadata(w){let S=0;return this.shouldIncrease(w)&&(S+=1),this.shouldDecrease(w)&&(S+=2),this.shouldIndentNextLine(w)&&(S+=4),this.shouldIgnore(w)&&(S+=8),S}}e.IndentRulesSupport=N}),define(Q[378],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BasicInplaceReplace=void 0;class b{constructor(){this._defaultValueSet=[["true","false"],["True","False"],["Private","Public","Friend","ReadOnly","Partial","Protected","WriteOnly"],["public","protected","private"]]}navigateValueSet(M,w,S,C,d){if(M&&w){let g=this.doNavigateValueSet(w,d);if(g)return{range:M,value:g}}if(S&&C){let g=this.doNavigateValueSet(C,d);if(g)return{range:S,value:g}}return null}doNavigateValueSet(M,w){let S=this.numberReplace(M,w);return S!==null?S:this.textReplace(M,w)}numberReplace(M,w){let S=Math.pow(10,M.length-(M.lastIndexOf(".")+1)),C=Number(M),d=parseFloat(M);return!isNaN(C)&&!isNaN(d)&&C===d?C===0&&!w?null:(C=Math.floor(C*S),C+=w?S:-S,String(C/S)):null}textReplace(M,w){return this.valueSetsReplace(this._defaultValueSet,M,w)}valueSetsReplace(M,w,S){let C=null;for(let d=0,g=M.length;C===null&&d=0?(C+=S?1:-1,C<0?C=M.length-1:C%=M.length,M[C]):null}}e.BasicInplaceReplace=b,b.INSTANCE=new b}),define(Q[379],J([0,1,12,8,109]),function(q,e,b,N,M){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.OnEnterSupport=void 0;class w{constructor(C){C=C||{},C.brackets=C.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],C.brackets.forEach(d=>{const g=w._createOpenBracketRegExp(d[0]),p=w._createCloseBracketRegExp(d[1]);g&&p&&this._brackets.push({open:d[0],openRegExp:g,close:d[1],closeRegExp:p})}),this._regExpRules=C.onEnterRules||[]}onEnter(C,d,g,p){if(C>=3)for(let c=0,o=this._regExpRules.length;cu.reg?u.reg.test(u.text):!0))return s.action}if(C>=2&&g.length>0&&p.length>0)for(let c=0,o=this._brackets.length;c=2&&g.length>0){for(let c=0,o=this._brackets.length;c[v[0].toLowerCase(),v[1].toLowerCase()]);const h=[];for(let v=0;v{const[L,I]=v,[k,E]=y;return L===k||L===E||I===k||I===E},_=(v,y)=>{const L=Math.min(v,y),I=Math.max(v,y);for(let k=0;k0&&f.push({open:y,close:L})}return f}class C{constructor(l,h){const m=S(h);this.brackets=m.map((_,f)=>new w(l,f,_.open,_.close,c(_.open,_.close,m,f),o(_.open,_.close,m,f))),this.forwardRegex=s(this.brackets),this.reversedRegex=a(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(const _ of this.brackets){for(const f of _.open)this.textIsBracket[f]=_,this.textIsOpenBracket[f]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,f.length);for(const f of _.close)this.textIsBracket[f]=_,this.textIsOpenBracket[f]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,f.length)}}}e.RichEditBrackets=C;function d(t,l,h,m){for(let _=0,f=l.length;_=0&&m.push(y);for(const y of v.close)y.indexOf(t)>=0&&m.push(y)}}function g(t,l){return t.length-l.length}function p(t){if(t.length<=1)return t;const l=[],h=new Set;for(const m of t)h.has(m)||(l.push(m),h.add(m));return l}function c(t,l,h,m){let _=[];_=_.concat(t),_=_.concat(l);for(let f=0,v=_.length;f=0;v--)_[f++]=m.charCodeAt(v);return N.getPlatformTextDecoder().decode(_)}else{let _=[],f=0;for(let v=m.length-1;v>=0;v--)_[f++]=m.charAt(v);return _.join("")}}let l=null,h=null;return function(_){return l!==_&&(l=_,h=t(l)),h}}();class n{static _findPrevBracketInText(l,h,m,_){let f=m.match(l);if(!f)return null;let v=m.length-(f.index||0),y=f[0].length,L=_+v;return new M.Range(h,L-y+1,h,L+1)}static findPrevBracketInRange(l,h,m,_,f){const y=i(m).substring(m.length-f,m.length-_);return this._findPrevBracketInText(l,h,y,_)}static findNextBracketInText(l,h,m,_){let f=m.match(l);if(!f)return null;let v=f.index||0,y=f[0].length;if(y===0)return null;let L=_+v;return new M.Range(h,L+1,h,L+1+y)}static findNextBracketInRange(l,h,m,_,f){const v=m.substring(_,f);return this.findNextBracketInText(l,h,v,_)}}e.BracketsUtils=n}),define(Q[380],J([0,1,167,168]),function(q,e,b,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.BracketElectricCharacterSupport=void 0;class M{constructor(S){this._richEditBrackets=S}getElectricCharacters(){let S=[];if(this._richEditBrackets)for(const C of this._richEditBrackets.brackets)for(const d of C.close){const g=d.charAt(d.length-1);S.push(g)}return S=S.filter((C,d,g)=>g.indexOf(C)===d),S}onElectricCharacter(S,C,d){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;const g=C.findTokenIndexAtOffset(d-1);if(b.ignoreBracketsInToken(C.getStandardTokenType(g)))return null;const p=this._richEditBrackets.reversedRegex,c=C.getLineContent().substring(0,d-1)+S,o=N.BracketsUtils.findPrevBracketInRange(p,1,c,0,c.length);if(!o)return null;const s=c.substring(o.startColumn-1,o.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[s])return null;const u=C.getActualLineContentBefore(o.startColumn-1);return/^\s*$/.test(u)?{matchOpenBracket:s}:null}}e.BracketElectricCharacterSupport=M}),define(Q[41],J([0,1,6,2,8,128,109,167,376,380,377,379,168]),function(q,e,b,N,M,w,S,C,d,g,p,c,o){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LanguageConfigurationRegistry=e.LanguageConfigurationRegistryImpl=e.LanguageConfigurationChangeEvent=e.RichEditSupport=void 0;class s{constructor(t,l){this._languageIdentifier=t,this._brackets=null,this._electricCharacter=null,this._conf=l,this._onEnterSupport=this._conf.brackets||this._conf.indentationRules||this._conf.onEnterRules?new c.OnEnterSupport(this._conf):null,this.comments=s._handleComments(this._conf),this.characterPair=new d.CharacterPairSupport(this._conf),this.wordDefinition=this._conf.wordPattern||w.DEFAULT_WORD_REGEXP,this.indentationRules=this._conf.indentationRules,this._conf.indentationRules?this.indentRulesSupport=new p.IndentRulesSupport(this._conf.indentationRules):this.indentRulesSupport=null,this.foldingRules=this._conf.folding||{}}get brackets(){return!this._brackets&&this._conf.brackets&&(this._brackets=new o.RichEditBrackets(this._languageIdentifier,this._conf.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new g.BracketElectricCharacterSupport(this.brackets)),this._electricCharacter}onEnter(t,l,h,m){return this._onEnterSupport?this._onEnterSupport.onEnter(t,l,h,m):null}static _handleComments(t){let l=t.comments;if(!l)return null;let h={};if(l.lineComment&&(h.lineCommentToken=l.lineComment),l.blockComment){let[m,_]=l.blockComment;h.blockCommentStartToken=m,h.blockCommentEndToken=_}return h}}e.RichEditSupport=s;class a{constructor(t){this.languageIdentifier=t}}e.LanguageConfigurationChangeEvent=a;class u{constructor(t,l,h){this.configuration=t,this.priority=l,this.order=h}static cmp(t,l){return t.priority===l.priority?t.order-l.order:t.priority-l.priority}}class r{constructor(t){this.languageIdentifier=t,this._resolved=null,this._entries=[],this._order=0,this._resolved=null}register(t,l){const h=new u(t,l,++this._order);return this._entries.push(h),this._resolved=null,N.toDisposable(()=>{for(let m=0;m{_.dispose(),this._onDidChange.fire(new a(t))})}_getRichEditSupport(t){const l=this._entries2.get(t);return l?l.getRichEditSupport():null}getIndentationRules(t){const l=this._getRichEditSupport(t);return l&&l.indentationRules||null}_getElectricCharacterSupport(t){let l=this._getRichEditSupport(t);return l&&l.electricCharacter||null}getElectricCharacters(t){let l=this._getElectricCharacterSupport(t);return l?l.getElectricCharacters():[]}onElectricCharacter(t,l,h){let m=C.createScopedLineTokens(l,h-1),_=this._getElectricCharacterSupport(m.languageId);return _?_.onElectricCharacter(t,m,h-m.firstCharOffset):null}getComments(t){let l=this._getRichEditSupport(t);return l&&l.comments||null}_getCharacterPairSupport(t){let l=this._getRichEditSupport(t);return l&&l.characterPair||null}getAutoClosingPairs(t){const l=this._getCharacterPairSupport(t);return new S.AutoClosingPairs(l?l.getAutoClosingPairs():[])}getAutoCloseBeforeSet(t){let l=this._getCharacterPairSupport(t);return l?l.getAutoCloseBeforeSet():d.CharacterPairSupport.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED}getSurroundingPairs(t){let l=this._getCharacterPairSupport(t);return l?l.getSurroundingPairs():[]}shouldAutoClosePair(t,l,h){const m=C.createScopedLineTokens(l,h-1);return d.CharacterPairSupport.shouldAutoClosePair(t,m,h-m.firstCharOffset)}getWordDefinition(t){let l=this._getRichEditSupport(t);return l?w.ensureValidWordDefinition(l.wordDefinition||null):w.ensureValidWordDefinition(null)}getFoldingRules(t){let l=this._getRichEditSupport(t);return l?l.foldingRules:{}}getIndentRulesSupport(t){let l=this._getRichEditSupport(t);return l&&l.indentRulesSupport||null}getPrecedingValidLine(t,l,h){let m=t.getLanguageIdAtPosition(l,0);if(l>1){let _,f=-1;for(_=l-1;_>=1;_--){if(t.getLanguageIdAtPosition(_,0)!==m)return f;let v=t.getLineContent(_);if(h.shouldIgnore(v)||/^\s+$/.test(v)||v===""){f=_;continue}return _}}return-1}getInheritIndentForLine(t,l,h,m=!0){if(t<4)return null;const _=this.getIndentRulesSupport(l.getLanguageIdentifier().id);if(!_)return null;if(h<=1)return{indentation:"",action:null};const f=this.getPrecedingValidLine(l,h,_);if(f<0)return null;if(f<1)return{indentation:"",action:null};const v=l.getLineContent(f);if(_.shouldIncrease(v)||_.shouldIndentNextLine(v))return{indentation:M.getLeadingWhitespace(v),action:S.IndentAction.Indent,line:f};if(_.shouldDecrease(v))return{indentation:M.getLeadingWhitespace(v),action:null,line:f};{if(f===1)return{indentation:M.getLeadingWhitespace(l.getLineContent(f)),action:null,line:f};const y=f-1,L=_.getIndentMetadata(l.getLineContent(y));if(!(L&(1|2))&&L&4){let I=0;for(let k=y-1;k>0;k--)if(!_.shouldIndentNextLine(l.getLineContent(k))){I=k;break}return{indentation:M.getLeadingWhitespace(l.getLineContent(I+1)),action:null,line:I+1}}if(m)return{indentation:M.getLeadingWhitespace(l.getLineContent(f)),action:null,line:f};for(let I=f;I>0;I--){const k=l.getLineContent(I);if(_.shouldIncrease(k))return{indentation:M.getLeadingWhitespace(k),action:S.IndentAction.Indent,line:I};if(_.shouldIndentNextLine(k)){let E=0;for(let T=I-1;T>0;T--)if(!_.shouldIndentNextLine(l.getLineContent(I))){E=T;break}return{indentation:M.getLeadingWhitespace(l.getLineContent(E+1)),action:null,line:E+1}}else if(_.shouldDecrease(k))return{indentation:M.getLeadingWhitespace(k),action:null,line:I}}return{indentation:M.getLeadingWhitespace(l.getLineContent(1)),action:null,line:1}}}getGoodIndentForLine(t,l,h,m,_){if(t<4)return null;const f=this._getRichEditSupport(h);if(!f)return null;const v=this.getIndentRulesSupport(h);if(!v)return null;const y=this.getInheritIndentForLine(t,l,m),L=l.getLineContent(m);if(y){const I=y.line;if(I!==void 0){const k=f.onEnter(t,"",l.getLineContent(I),"");if(k){let E=M.getLeadingWhitespace(l.getLineContent(I));return k.removeText&&(E=E.substring(0,E.length-k.removeText)),k.indentAction===S.IndentAction.Indent||k.indentAction===S.IndentAction.IndentOutdent?E=_.shiftIndent(E):k.indentAction===S.IndentAction.Outdent&&(E=_.unshiftIndent(E)),v.shouldDecrease(L)&&(E=_.unshiftIndent(E)),k.appendText&&(E+=k.appendText),M.getLeadingWhitespace(E)}}return v.shouldDecrease(L)?y.action===S.IndentAction.Indent?y.indentation:_.unshiftIndent(y.indentation):y.action===S.IndentAction.Indent?_.shiftIndent(y.indentation):y.indentation}return null}getIndentForEnter(t,l,h,m){if(t<4)return null;l.forceTokenization(h.startLineNumber);const _=l.getLineTokens(h.startLineNumber),f=C.createScopedLineTokens(_,h.startColumn-1),v=f.getLineContent();let y=!1,L;f.firstCharOffset>0&&_.getLanguageId(0)!==f.languageId?(y=!0,L=v.substr(0,h.startColumn-1-f.firstCharOffset)):L=_.getLineContent().substring(0,h.startColumn-1);let I;h.isEmpty()?I=v.substr(h.startColumn-1-f.firstCharOffset):I=this.getScopedLineTokens(l,h.endLineNumber,h.endColumn).getLineContent().substr(h.endColumn-1-f.firstCharOffset);const k=this.getIndentRulesSupport(f.languageId);if(!k)return null;const E=L,T=M.getLeadingWhitespace(L),O={getLineTokens:D=>l.getLineTokens(D),getLanguageIdentifier:()=>l.getLanguageIdentifier(),getLanguageIdAtPosition:(D,R)=>l.getLanguageIdAtPosition(D,R),getLineContent:D=>D===h.startLineNumber?E:l.getLineContent(D)},A=M.getLeadingWhitespace(_.getLineContent()),B=this.getInheritIndentForLine(t,O,h.startLineNumber+1);if(!B){const D=y?A:T;return{beforeEnter:D,afterEnter:D}}let F=y?A:B.indentation;return B.action===S.IndentAction.Indent&&(F=m.shiftIndent(F)),k.shouldDecrease(I)&&(F=m.unshiftIndent(F)),{beforeEnter:y?A:T,afterEnter:F}}getIndentActionForType(t,l,h,m,_){if(t<4)return null;const f=this.getScopedLineTokens(l,h.startLineNumber,h.startColumn);if(f.firstCharOffset)return null;const v=this.getIndentRulesSupport(f.languageId);if(!v)return null;const y=f.getLineContent(),L=y.substr(0,h.startColumn-1-f.firstCharOffset);let I;if(h.isEmpty()?I=y.substr(h.startColumn-1-f.firstCharOffset):I=this.getScopedLineTokens(l,h.endLineNumber,h.endColumn).getLineContent().substr(h.endColumn-1-f.firstCharOffset),!v.shouldDecrease(L+I)&&v.shouldDecrease(L+m+I)){const k=this.getInheritIndentForLine(t,l,h.startLineNumber,!1);if(!k)return null;let E=k.indentation;return k.action!==S.IndentAction.Indent&&(E=_.unshiftIndent(E)),E}return null}getIndentMetadata(t,l){const h=this.getIndentRulesSupport(t.getLanguageIdentifier().id);return!h||l<1||l>t.getLineCount()?null:h.getIndentMetadata(t.getLineContent(l))}getEnterAction(t,l,h){const m=this.getScopedLineTokens(l,h.startLineNumber,h.startColumn),_=this._getRichEditSupport(m.languageId);if(!_)return null;const f=m.getLineContent(),v=f.substr(0,h.startColumn-1-m.firstCharOffset);let y;h.isEmpty()?y=f.substr(h.startColumn-1-m.firstCharOffset):y=this.getScopedLineTokens(l,h.endLineNumber,h.endColumn).getLineContent().substr(h.endColumn-1-m.firstCharOffset);let L="";if(h.startLineNumber>1&&m.firstCharOffset===0){const A=this.getScopedLineTokens(l,h.startLineNumber-1);A.languageId===m.languageId&&(L=A.getLineContent())}const I=_.onEnter(t,L,v,y);if(!I)return null;const k=I.indentAction;let E=I.appendText;const T=I.removeText||0;E?k===S.IndentAction.Indent&&(E=" "+E):k===S.IndentAction.Indent||k===S.IndentAction.IndentOutdent?E=" ":E="";let O=this.getIndentationAtPosition(l,h.startLineNumber,h.startColumn);return T&&(O=O.substring(0,O.length-T)),{indentAction:k,appendText:E,removeText:T,indentation:O}}getIndentationAtPosition(t,l,h){const m=t.getLineContent(l);let _=M.getLeadingWhitespace(m);return _.length>h-1&&(_=_.substring(0,h-1)),_}getScopedLineTokens(t,l,h){t.forceTokenization(l);const m=t.getLineTokens(l),_=typeof h=="undefined"?t.getLineMaxColumn(l)-1:h-1;return C.createScopedLineTokens(m,_)}getBracketsSupport(t){const l=this._getRichEditSupport(t);return l&&l.brackets||null}}e.LanguageConfigurationRegistryImpl=i,e.LanguageConfigurationRegistry=new i}),define(Q[381],J([0,1,29]),function(q,e,b){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.generateTokensCSSForColorMap=e.ThemeTrieElement=e.ThemeTrieElementRule=e.strcmp=e.toStandardTokenType=e.TokenTheme=e.ColorMap=e.parseTokenTheme=e.ParsedTokenThemeRule=void 0;class N{constructor(r,i,n,t,l){this.token=r,this.index=i,this.fontStyle=n,this.foreground=t,this.background=l}}e.ParsedTokenThemeRule=N;function M(u){if(!u||!Array.isArray(u))return[];let r=[],i=0;for(let n=0,t=u.length;n{let L=c(v.token,y.token);return L!==0?L:v.index-y.index});let i=0,n="000000",t="ffffff";for(;u.length>=1&&u[0].token==="";){let v=u.shift();v.fontStyle!==-1&&(i=v.fontStyle),v.foreground!==null&&(n=v.foreground),v.background!==null&&(t=v.background)}let l=new C;for(let v of r)l.getId(v);let h=l.getId(n),m=l.getId(t),_=new o(i,h,m),f=new s(_);for(let v=0,y=u.length;v>>0,this._cache.set(i,n)}return(n|r<<0)>>>0}}e.TokenTheme=d;const g=/\b(comment|string|regex|regexp)\b/;function p(u){let r=u.match(g);if(!r)return 0;switch(r[1]){case"comment":return 1;case"string":return 2;case"regex":return 4;case"regexp":return 4}throw new Error("Unexpected match for standard token type!")}e.toStandardTokenType=p;function c(u,r){return ur?1:0}e.strcmp=c;class o{constructor(r,i,n){this._fontStyle=r,this._foreground=i,this._background=n,this.metadata=(this._fontStyle<<11|this._foreground<<14|this._background<<23)>>>0}clone(){return new o(this._fontStyle,this._foreground,this._background)}acceptOverwrite(r,i,n){r!==-1&&(this._fontStyle=r),i!==0&&(this._foreground=i),n!==0&&(this._background=n),this.metadata=(this._fontStyle<<11|this._foreground<<14|this._background<<23)>>>0}}e.ThemeTrieElementRule=o;class s{constructor(r){this._mainRule=r,this._children=new Map}match(r){if(r==="")return this._mainRule;let i=r.indexOf("."),n,t;i===-1?(n=r,t=""):(n=r.substring(0,i),t=r.substring(i+1));let l=this._children.get(n);return typeof l!="undefined"?l.match(t):this._mainRule}insert(r,i,n,t){if(r===""){this._mainRule.acceptOverwrite(i,n,t);return}let l=r.indexOf("."),h,m;l===-1?(h=r,m=""):(h=r.substring(0,l),m=r.substring(l+1));let _=this._children.get(h);typeof _=="undefined"&&(_=new s(this._mainRule.clone()),this._children.set(h,_)),_.insert(m,i,n,t)}}e.ThemeTrieElement=s;function a(u){let r=[];for(let i=1,n=u.length;i{this._map.get(S)===C&&(this._map.delete(S),this.fire([S]))})}registerPromise(S,C){let d=null,g=!1;return this._promises.set(S,C.then(p=>{this._promises.delete(S),!(g||!p)&&(d=this.register(S,p))})),N.toDisposable(()=>{g=!0,d&&d.dispose()})}getPromise(S){const C=this.get(S);if(C)return Promise.resolve(C);const d=this._promises.get(S);return d?d.then(g=>this.get(S)):null}get(S){return this._map.get(S)||null}setColorMap(S){this._colorMap=S,this._onDidChange.fire({changedLanguages:Array.from(this._map.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}}e.TokenizationRegistryImpl=M}),define(Q[383],J([0,1,101,17]),function(q,e,b,N){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.encodeSemanticTokensDto=void 0;function M(d){for(let g=0,p=d.length;gd&&(n=d-t);const l=u.color;let h=this._color2Id[l];h||(h=++this._lastAssignedId,this._color2Id[l]=h,this._id2Color[h]=l);const m=new b(n-t,n+t,h);u.setColorZone(m),o.push(m)}return this._colorZonesInvalid=!1,o.sort(b.compare),o}}e.OverviewZoneManager=M}),define(Q[110],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.VisibleRanges=e.HorizontalPosition=e.HorizontalRange=e.LineVisibleRanges=e.RenderingContext=e.RestrictedRenderingContext=void 0;class b{constructor(g,p){this._viewLayout=g,this.viewportData=p,this.scrollWidth=this._viewLayout.getScrollWidth(),this.scrollHeight=this._viewLayout.getScrollHeight(),this.visibleRange=this.viewportData.visibleRange,this.bigNumbersDelta=this.viewportData.bigNumbersDelta;const c=this._viewLayout.getCurrentViewport();this.scrollTop=c.top,this.scrollLeft=c.left,this.viewportWidth=c.width,this.viewportHeight=c.height}getScrolledTopFromAbsoluteTop(g){return g-this.scrollTop}getVerticalOffsetForLineNumber(g){return this._viewLayout.getVerticalOffsetForLineNumber(g)}getDecorationsInViewport(){return this.viewportData.getDecorationsInViewport()}}e.RestrictedRenderingContext=b;class N extends b{constructor(g,p,c){super(g,p);this._viewLines=c}linesVisibleRangesForRange(g,p){return this._viewLines.linesVisibleRangesForRange(g,p)}visibleRangeForPosition(g){return this._viewLines.visibleRangeForPosition(g)}}e.RenderingContext=N;class M{constructor(g,p,c){this.outsideRenderedLine=g,this.lineNumber=p,this.ranges=c}}e.LineVisibleRanges=M;class w{constructor(g,p){this.left=Math.round(g),this.width=Math.round(p)}toString(){return`[${this.left},${this.width}]`}}e.HorizontalRange=w;class S{constructor(g,p){this.outsideRenderedLine=g,this.left=Math.round(p)}}e.HorizontalPosition=S;class C{constructor(g,p){this.outsideRenderedLine=g,this.ranges=p}}e.VisibleRanges=C}),define(Q[384],J([0,1,110]),function(q,e,b){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.RangeUtil=void 0;class N{constructor(S,C){this.left=S,this.width=C}toString(){return`[${this.left},${this.width}]`}static compare(S,C){return S.left-C.left}}class M{static _createRange(){return this._handyReadyRange||(this._handyReadyRange=document.createRange()),this._handyReadyRange}static _detachRange(S,C){S.selectNodeContents(C)}static _readClientRects(S,C,d,g,p){const c=this._createRange();try{return c.setStart(S,C),c.setEnd(d,g),c.getClientRects()}catch(o){return null}finally{this._detachRange(c,p)}}static _mergeAdjacentRanges(S){if(S.length===1)return[new b.HorizontalRange(S[0].left,S[0].width)];S.sort(N.compare);let C=[],d=0,g=S[0].left,p=S[0].width;for(let c=1,o=S.length;c=a?p=Math.max(p,a+u-g):(C[d++]=new b.HorizontalRange(g,p),g=a,p=u)}return C[d++]=new b.HorizontalRange(g,p),C}static _createHorizontalRangesFromClientRects(S,C){if(!S||S.length===0)return null;const d=[];for(let g=0,p=S.length;ga)return null;if(C=Math.min(a,Math.max(s,C)),g=Math.min(a,Math.max(s,g)),C===g&&d===p&&d===0){const n=S.children[C].getClientRects();return this._createHorizontalRangesFromClientRects(n,c)}C!==g&&g>0&&p===0&&(g--,p=1073741824);let u=S.children[C].firstChild,r=S.children[g].firstChild;if((!u||!r)&&(!u&&d===0&&C>0&&(u=S.children[C-1].firstChild,d=1073741824),!r&&p===0&&g>0&&(r=S.children[g-1].firstChild,p=1073741824)),!u||!r)return null;d=Math.min(u.textContent.length,Math.max(0,d)),p=Math.min(r.textContent.length,Math.max(0,p));const i=this._readClientRects(u,d,r,p,o);return this._createHorizontalRangesFromClientRects(i,c)}}e.RangeUtil=M}),define(Q[385],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewContext=e.EditorTheme=void 0;class b{constructor(w){this._theme=w}get type(){return this._theme.type}update(w){this._theme=w}getColor(w){return this._theme.getColor(w)}}e.EditorTheme=b;class N{constructor(w,S,C){this.configuration=w,this.theme=new b(S),this.model=C,this.viewLayout=C.viewLayout}addEventHandler(w){this.model.addViewEventHandler(w)}removeEventHandler(w){this.model.removeViewEventHandler(w)}}e.ViewContext=N}),define(Q[170],J([0,1]),function(q,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ViewZonesChangedEvent=e.ViewTokensColorsChangedEvent=e.ViewTokensChangedEvent=e.ViewThemeChangedEvent=e.ViewScrollChangedEvent=e.ViewRevealRangeRequestEvent=e.ViewLinesInsertedEvent=e.ViewLinesDeletedEvent=e.ViewLinesChangedEvent=e.ViewLineMappingChangedEvent=e.ViewLanguageConfigurationEvent=e.ViewFocusChangedEvent=e.ViewFlushedEvent=e.ViewDecorationsChangedEvent=e.ViewCursorStateChangedEvent=e.ViewConfigurationChangedEvent=e.ViewCompositionEndEvent=e.ViewCompositionStartEvent=void 0;class b{constructor(){this.type=0}}e.ViewCompositionStartEvent=b;class N{constructor(){this.type=1}}e.ViewCompositionEndEvent=N;class M{constructor(h){this.type=2,this._source=h}hasChanged(h){return this._source.hasChanged(h)}}e.ViewConfigurationChangedEvent=M;class w{constructor(h,m){this.type=3,this.selections=h,this.modelSelections=m}}e.ViewCursorStateChangedEvent=w;class S{constructor(h){this.type=4,h?(this.affectsMinimap=h.affectsMinimap,this.affectsOverviewRuler=h.affectsOverviewRuler):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0)}}e.ViewDecorationsChangedEvent=S;class C{constructor(){this.type=5}}e.ViewFlushedEvent=C;class d{constructor(h){this.type=6,this.isFocused=h}}e.ViewFocusChangedEvent=d;class g{constructor(){this.type=7}}e.ViewLanguageConfigurationEvent=g;class p{constructor(){this.type=8}}e.ViewLineMappingChangedEvent=p;class c{constructor(h,m){this.type=9,this.fromLineNumber=h,this.toLineNumber=m}}e.ViewLinesChangedEvent=c;class o{constructor(h,m){this.type=10,this.fromLineNumber=h,this.toLineNumber=m}}e.ViewLinesDeletedEvent=o;class s{constructor(h,m){this.type=11,this.fromLineNumber=h,this.toLineNumber=m}}e.ViewLinesInsertedEvent=s;class a{constructor(h,m,_,f,v,y){this.type=12,this.source=h,this.range=m,this.selections=_,this.verticalType=f,this.revealHorizontal=v,this.scrollType=y}}e.ViewRevealRangeRequestEvent=a;class u{constructor(h){this.type=13,this.scrollWidth=h.scrollWidth,this.scrollLeft=h.scrollLeft,this.scrollHeight=h.scrollHeight,this.scrollTop=h.scrollTop,this.scrollWidthChanged=h.scrollWidthChanged,this.scrollLeftChanged=h.scrollLeftChanged,this.scrollHeightChanged=h.scrollHeightChanged,this.scrollTopChanged=h.scrollTopChanged}}e.ViewScrollChangedEvent=u;class r{constructor(){this.type=14}}e.ViewThemeChangedEvent=r;class i{constructor(h){this.type=15,this.ranges=h}}e.ViewTokensChangedEvent=i;class n{constructor(){this.type=16}}e.ViewTokensColorsChangedEvent=n;class t{constructor(){this.type=17}}e.ViewZonesChangedEvent=t}),define(Q[171],J([0,1,8]),function(q,e,b){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LineDecorationsNormalizer=e.DecorationSegment=e.LineDecoration=void 0;class N{constructor(d,g,p,c){this.startColumn=d,this.endColumn=g,this.className=p,this.type=c}static _equals(d,g){return d.startColumn===g.startColumn&&d.endColumn===g.endColumn&&d.className===g.className&&d.type===g.type}static equalsArr(d,g){const p=d.length,c=g.length;if(p!==c)return!1;for(let o=0;o
=o||(a[u++]=new N(Math.max(1,r.startColumn-c+1),Math.min(s+1,r.endColumn-c+1),r.className,r.type));return a}static filter(d,g,p,c){if(d.length===0)return[];let o=[],s=0;for(let a=0,u=d.length;ag)&&!(i.isEmpty()&&(r.type===0||r.type===3))){const n=i.startLineNumber===g?i.startColumn:p,t=i.endLineNumber===g?i.endColumn:c;o[s++]=new N(n,t,r.inlineClassName,r.type)}}return o}static _typeCompare(d,g){const p=[2,0,1,3];return p[d]-p[g]}static compare(d,g){if(d.startColumn===g.startColumn){if(d.endColumn===g.endColumn){const p=N._typeCompare(d.type,g.type);return p===0?d.classNameg.className?1:0:p}return d.endColumn-g.endColumn}return d.startColumn-g.startColumn}}e.LineDecoration=N;class M{constructor(d,g,p,c){this.startOffset=d,this.endOffset=g,this.className=p,this.metadata=c}}e.DecorationSegment=M;class w{constructor(){this.stopOffsets=[],this.classNames=[],this.metadata=[],this.count=0}static _metadata(d){let g=0;for(let p=0,c=d.length;p0&&this.stopOffsets[0]0&&g=d){this.stopOffsets.splice(c,0,d),this.classNames.splice(c,0,g),this.metadata.splice(c,0,p);break}this.count++}}class S{static normalize(d,g){if(g.length===0)return[];let p=[];const c=new w;let o=0;for(let s=0,a=g.length;s1){const m=d.charCodeAt(r-2);b.isHighSurrogate(m)&&r--}if(i>1){const m=d.charCodeAt(i-2);b.isHighSurrogate(m)&&i--}const l=r-1,h=i-2;o=c.consumeLowerThan(l,o,p),c.count===0&&(o=l),c.insert(h,n,t)}return c.consumeLowerThan(1073741824,o,p),p}}e.LineDecorationsNormalizer=S}),define(Q[386],J([0,1,8]),function(q,e,b){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.LinesLayout=e.EditorWhitespace=void 0;class N{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(C){this._hasPending=!0,this._inserts.push(C)}change(C){this._hasPending=!0,this._changes.push(C)}remove(C){this._hasPending=!0,this._removes.push(C)}mustCommit(){return this._hasPending}commit(C){if(!!this._hasPending){const d=this._inserts,g=this._changes,p=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],C._commitPendingChanges(d,g,p)}}}class M{constructor(C,d,g,p,c){this.id=C,this.afterLineNumber=d,this.ordinal=g,this.height=p,this.minWidth=c,this.prefixSum=0}}e.EditorWhitespace=M;class w{constructor(C,d,g,p){this._instanceId=b.singleLetterHash(++w.INSTANCE_COUNT),this._pendingChanges=new N,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=C,this._lineHeight=d,this._paddingTop=g,this._paddingBottom=p}static findInsertionIndex(C,d,g){let p=0,c=C.length;for(;p>>1;d===C[o].afterLineNumber?g{d=!0,p=p|0,c=c|0,o=o|0,s=s|0;const a=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new M(a,p,c,o,s)),a},changeOneWhitespace:(p,c,o)=>{d=!0,c=c|0,o=o|0,this._pendingChanges.change({id:p,newAfterLineNumber:c,newHeight:o})},removeWhitespace:p=>{d=!0,this._pendingChanges.remove({id:p})}})}finally{this._pendingChanges.commit(this)}return d}_commitPendingChanges(C,d,g){if((C.length>0||g.length>0)&&(this._minWidth=-1),C.length+d.length+g.length<=1){for(const a of C)this._insertWhitespace(a);for(const a of d)this._changeOneWhitespace(a.id,a.newAfterLineNumber,a.newHeight);for(const a of g){const u=this._findWhitespaceIndex(a.id);u!==-1&&this._removeWhitespace(u)}return}const p=new Set;for(const a of g)p.add(a.id);const c=new Map;for(const a of d)c.set(a.id,a);const o=a=>{let u=[];for(const r of a)if(!p.has(r.id)){if(c.has(r.id)){const i=c.get(r.id);r.afterLineNumber=i.newAfterLineNumber,r.height=i.newHeight}u.push(r)}return u},s=o(this._arr).concat(o(C));s.sort((a,u)=>a.afterLineNumber===u.afterLineNumber?a.ordinal-u.ordinal:a.afterLineNumber-u.afterLineNumber),this._arr=s,this._prefixSumValidIndex=-1}_checkPendingChanges(){this._pendingChanges.mustCommit()&&this._pendingChanges.commit(this)}_insertWhitespace(C){const d=w.findInsertionIndex(this._arr,C.afterLineNumber,C.ordinal);this._arr.splice(d,0,C),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,d-1)}_findWhitespaceIndex(C){const d=this._arr;for(let g=0,p=d.length;gd&&(this._arr[g].afterLineNumber-=d-C+1)}}onLinesInserted(C,d){this._checkPendingChanges(),C=C|0,d=d|0,this._lineCount+=d-C+1;for(let g=0,p=this._arr.length;g
=d.length||d[s+1].afterLineNumber>=C)return s;g=s+1|0}else p=s-1|0}return-1}_findFirstWhitespaceAfterLineNumber(C){C=C|0;const g=this._findLastWhitespaceBeforeLineNumber(C)+1;return g1?d=this._lineHeight*(C-1):d=0;const g=this.getWhitespaceAccumulatedHeightBeforeLineNumber(C);return d+g+this._paddingTop}getWhitespaceMinWidth(){if(this._checkPendingChanges(),this._minWidth===-1){let C=0;for(let d=0,g=this._arr.length;dd}isInTopPadding(C){return this._paddingTop===0?!1:(this._checkPendingChanges(),C=d-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(C){if(this._checkPendingChanges(),C=C|0,C<0)return 1;const d=this._lineCount|0,g=this._lineHeight;let p=1,c=d;for(;p=s+g)p=o+1;else{if(C>=s)return o;c=o}}return p>d?d:p}getLinesViewportData(C,d){this._checkPendingChanges(),C=C|0,d=d|0;const g=this._lineHeight,p=this.getLineNumberAtOrAfterVerticalOffset(C)|0,c=this.getVerticalOffsetForLineNumber(p)|0;let o=this._lineCount|0,s=this.getFirstWhitespaceIndexAfterLineNumber(p)|0;const a=this.getWhitespacesCount()|0;let u,r;s===-1?(s=a,r=o+1,u=0):(r=this.getAfterLineNumberForWhitespaceIndex(s)|0,u=this.getHeightForWhitespaceIndex(s)|0);let i=c,n=i;const t=5e5;let l=0;c>=t&&(l=Math.floor(c/t)*t,l=Math.floor(l/g)*g,n-=l);const h=[],m=C+(d-C)/2;let _=-1;for(let L=p;L<=o;L++){if(_===-1){const I=i,k=i+g;(I<=m&&mm)&&(_=L)}for(i+=g,h[L-p]=n,n+=g;r===L;)n+=u,i+=u,s++,s>=a?r=o+1:(r=this.getAfterLineNumberForWhitespaceIndex(s)|0,u=this.getHeightForWhitespaceIndex(s)|0);if(i>=d){o=L;break}}_===-1&&(_=o);const f=this.getVerticalOffsetForLineNumber(o)|0;let v=p,y=o;return vd&&y--,{bigNumbersDelta:l,startLineNumber:p,endLineNumber:o,relativeVerticalOffset:h,centeredLineNumber:_,completelyVisibleStartLineNumber:v,completelyVisibleEndLineNumber:y}}getVerticalOffsetForWhitespaceIndex(C){this._checkPendingChanges(),C=C|0;const d=this.getAfterLineNumberForWhitespaceIndex(C);let g;d>=1?g=this._lineHeight*d:g=0;let p;return C>0?p=this.getWhitespacesAccumulatedHeight(C-1):p=0,g+p+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(C){this._checkPendingChanges(),C=C|0;let d=0,g=this.getWhitespacesCount()-1;if(g<0)return-1;const p=this.getVerticalOffsetForWhitespaceIndex(g),c=this.getHeightForWhitespaceIndex(g);if(C>=p+c)return-1;for(;d=s+a)d=o+1;else{if(C>=s)return o;g=o}}return d}getWhitespaceAtVerticalOffset(C){this._checkPendingChanges(),C=C|0;const d=this.getWhitespaceIndexAtOrAfterVerticallOffset(C);if(d<0||d>=this.getWhitespacesCount())return null;const g=this.getVerticalOffsetForWhitespaceIndex(d);if(g>C)return null;const p=this.getHeightForWhitespaceIndex(d),c=this.getIdForWhitespaceIndex(d),o=this.getAfterLineNumberForWhitespaceIndex(d);return{id:c,afterLineNumber:o,verticalOffset:g,height:p}}getWhitespaceViewportData(C,d){this._checkPendingChanges(),C=C|0,d=d|0;const g=this.getWhitespaceIndexAtOrAfterVerticallOffset(C),p=this.getWhitespacesCount()-1;if(g<0)return[];let c=[];for(let o=g;o<=p;o++){const s=this.getVerticalOffsetForWhitespaceIndex(o),a=this.getHeightForWhitespaceIndex(o);if(s>=d)break;c.push({id:this.getIdForWhitespaceIndex(o),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(o),verticalOffset:s,height:a})}return c}getWhitespaces(){return this._checkPendingChanges(),this._arr.slice(0)}getWhitespacesCount(){return this._checkPendingChanges(),this._arr.length}getIdForWhitespaceIndex(C){return this._checkPendingChanges(),C=C|0,this._arr[C].id}getAfterLineNumberForWhitespaceIndex(C){return this._checkPendingChanges(),C=C|0,this._arr[C].afterLineNumber}getHeightForWhitespaceIndex(C){return this._checkPendingChanges(),C=C|0,this._arr[C].height}}e.LinesLayout=w,w.INSTANCE_COUNT=0}),define(Q[129],J([0,1,8,93,171]),function(q,e,b,N,M){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.renderViewLine2=e.RenderLineOutput2=e.renderViewLine=e.RenderLineOutput=e.CharacterMapping=e.RenderLineInput=e.LineRange=void 0;class w{constructor(h,m,_){this.endIndex=h,this.type=m,this.metadata=_}isWhitespace(){return!!(this.metadata&1)}}class S{constructor(h,m){this.startOffset=h,this.endOffset=m}equals(h){return this.startOffset===h.startOffset&&this.endOffset===h.endOffset}}e.LineRange=S;class C{constructor(h,m,_,f,v,y,L,I,k,E,T,O,A,B,F,D,R,W,x){this.useMonospaceOptimizations=h,this.canUseHalfwidthRightwardsArrow=m,this.lineContent=_,this.continuesWithWrappedLine=f,this.isBasicASCII=v,this.containsRTL=y,this.fauxIndentLength=L,this.lineTokens=I,this.lineDecorations=k.sort(M.LineDecoration.compare),this.tabSize=E,this.startVisibleColumn=T,this.spaceWidth=O,this.stopRenderingLineAfter=F,this.renderWhitespace=D==="all"?4:D==="boundary"?1:D==="selection"?2:D==="trailing"?3:0,this.renderControlCharacters=R,this.fontLigatures=W,this.selectionsOnLine=x&&x.sort((ee,se)=>ee.startOffset>>16}static getCharIndex(h){return(h&65535)>>>0}setPartData(h,m,_,f){let v=(m<<16|_<<0)>>>0;this._data[h]=v,this._absoluteOffsets[h]=f+_}getAbsoluteOffsets(){return this._absoluteOffsets}charOffsetToPartData(h){return this.length===0?0:h<0?this._data[0]:h>=this.length?this._data[this.length-1]:this._data[h]}partDataToCharOffset(h,m,_){if(this.length===0)return 0;let f=(h<<16|_<<0)>>>0,v=0,y=this.length-1;for(;v+1>>1,D=this._data[F];if(D===f)return F;D>f?y=F:v=F}if(v===y)return v;let L=this._data[v],I=this._data[y];if(L===f)return v;if(I===f)return y;let k=d.getPartIndex(L),E=d.getCharIndex(L),T=d.getPartIndex(I),O;k!==T?O=m:O=d.getCharIndex(I);let A=_-E,B=O-_;return A<=B?v:y}}e.CharacterMapping=d;class g{constructor(h,m,_){this.characterMapping=h,this.containsRTL=m,this.containsForeignElements=_}}e.RenderLineOutput=g;function p(l,h){if(l.lineContent.length===0){let m=0,_="";if(l.lineDecorations.length>0){const f=[],v=[];for(let y=0,L=l.lineDecorations.length;y0?``:"",L=v.length>0?``:"";_=`${y}${L}`}}return h.appendASCIIString(_),new g(new d(0,0),!1,m)}return t(a(l),h)}e.renderViewLine=p;class c{constructor(h,m,_,f){this.characterMapping=h,this.html=m,this.containsRTL=_,this.containsForeignElements=f}}e.RenderLineOutput2=c;function o(l){let h=N.createStringBuilder(1e4),m=p(l,h);return new c(m.characterMapping,h.build(),m.containsRTL,m.containsForeignElements)}e.renderViewLine2=o;class s{constructor(h,m,_,f,v,y,L,I,k,E,T,O,A,B,F){this.fontIsMonospace=h,this.canUseHalfwidthRightwardsArrow=m,this.lineContent=_,this.len=f,this.isOverflowing=v,this.parts=y,this.containsForeignElements=L,this.fauxIndentLength=I,this.tabSize=k,this.startVisibleColumn=E,this.containsRTL=T,this.spaceWidth=O,this.renderSpaceCharCode=A,this.renderWhitespace=B,this.renderControlCharacters=F}}function a(l){const h=l.lineContent;let m,_;l.stopRenderingLineAfter!==-1&&l.stopRenderingLineAfter0){for(let y=0,L=l.lineDecorations.length;y0&&(_[f++]=new w(h,"",0));for(let v=0,y=l.getCount();v=m){_[f++]=new w(m,I,0);break}_[f++]=new w(L,I,0)}}return _}function r(l,h,m){let _=0,f=[],v=0;if(m)for(let y=0,L=h.length;y=50&&(f[v++]=new w(O+1,E,T),A=O+1,O=-1);A!==k&&(f[v++]=new w(k,E,T))}else f[v++]=I;_=k}else for(let y=0,L=h.length;y50){const T=I.type,O=I.metadata,A=Math.ceil(E/50);for(let B=1;B=ne.endOffset&&(se++,ne=k&&k[se]);let V;if(zY)V=!0;else if(P===9)V=!0;else if(P===32)if(E)if(ee)V=!0;else{const U=z+1z),V&&T&&(V=x||z>Y),ee){if(!V||!I&&le>=y){if(O){const U=B>0?A[B-1].endIndex:v;for(let H=U+1;H<=z;H++)A[B++]=new w(H,"mtkw",1)}else A[B++]=new w(z,"mtkw",1);le=le%y}}else(z===R||V&&z>v)&&(A[B++]=new w(z,D,0),le=le%y);for(P===9?le=y:b.isFullWidthCharacter(P)?le+=2:le++,ee=V;z===R;)F++,F0?h.charCodeAt(m-1):0,P=m>1?h.charCodeAt(m-2):0;z===32&&P!==32&&P!==9||(X=!0)}else X=!0;if(X)if(O){const z=B>0?A[B-1].endIndex:v;for(let P=z+1;P<=m;P++)A[B++]=new w(P,"mtkw",1)}else A[B++]=new w(m,"mtkw",1);else A[B++]=new w(m,D,0);return A}function n(l,h,m,_){_.sort(M.LineDecoration.compare);const f=M.LineDecorationsNormalizer.normalize(l,_),v=f.length;let y=0,L=[],I=0,k=0;for(let T=0,O=m.length;Tk&&(k=R.startOffset,L[I++]=new w(k,F,D)),R.endOffset+1<=B)k=R.endOffset+1,L[I++]=new w(k,F+" "+R.className,D|R.metadata),y++;else{k=B,L[I++]=new w(k,F+" "+R.className,D|R.metadata);break}}B>k&&(k=B,L[I++]=new w(k,F,D))}const E=m[m.length-1].endIndex;if(y'):h.appendASCIIString("");for(let ne=0,le=I.length;ne=k&&(oe+=G)}}for(U&&(h.appendASCIIString(' style="width:'),h.appendASCIIString(String(A*$)),h.appendASCIIString('px"')),h.appendASCII(62);W1?h.write1(8594):h.write1(65515);for(let ae=2;ae<=oe;ae++)h.write1(160)}else oe=1,h.write1(B);K+=oe,W>=k&&(x+=oe)}ee=$}else{let $=0;for(h.appendASCII(62);W=k&&(x+=ae)}ee=$}H?Y++:Y=0,h.appendASCIIString("")}return R.setPartData(y,I.length-1,K,se),L&&h.appendASCIIString("…"),h.appendASCIIString("