43 lines
405 KiB
JavaScript
43 lines
405 KiB
JavaScript
|
(function(){"use strict";class jo{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?dt.isErrorNoTelemetry(t)?new dt(t.message+`
|
||
|
|
||
|
`+t.stack):new Error(t.message+`
|
||
|
|
||
|
`+t.stack):t},0)}}emit(t){this.listeners.forEach(n=>{n(t)})}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}}const mi=new jo;function pi(e){bi(e)||mi.onUnexpectedError(e)}function Jc(e){bi(e)||mi.onUnexpectedExternalError(e)}function vi(e){if(e instanceof Error){const{name:t,message:n}=e,r=e.stacktrace||e.stack;return{$isError:!0,name:t,message:n,stack:r,noTelemetry:dt.isErrorNoTelemetry(e)}}return e}const gn="Canceled";function bi(e){return e instanceof qo?!0:e instanceof Error&&e.name===gn&&e.message===gn}class qo extends Error{constructor(){super(gn),this.name=this.message}}function Qc(){const e=new Error(gn);return e.name=e.message,e}function Xc(e){return e?new Error(`Illegal argument: ${e}`):new Error("Illegal argument")}function Yc(e){return e?new Error(`Illegal state: ${e}`):new Error("Illegal state")}class Zc extends Error{constructor(t){super("NotSupported"),t&&(this.message=t)}}class dt extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof dt)return t;const n=new dt;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}}class Be extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,Be.prototype)}}function Uo(e,t){const n=this;let r=!1,i;return function(){if(r)return i;if(r=!0,t)try{i=e.apply(n,arguments)}finally{t()}else i=e.apply(n,arguments);return i}}var mn;(function(e){function t(b){return b&&typeof b=="object"&&typeof b[Symbol.iterator]=="function"}e.is=t;const n=Object.freeze([]);function r(){return n}e.empty=r;function*i(b){yield b}e.single=i;function s(b){return t(b)?b:i(b)}e.wrap=s;function a(b){return b||n}e.from=a;function*o(b){for(let w=b.length-1;w>=0;w--)yield b[w]}e.reverse=o;function l(b){return!b||b[Symbol.iterator]().next().done===!0}e.isEmpty=l;function u(b){return b[Symbol.iterator]().next().value}e.first=u;function c(b,w){for(const y of b)if(w(y))return!0;return!1}e.some=c;function h(b,w){for(const y of b)if(w(y))return y}e.find=h;function*d(b,w){for(const y of b)w(y)&&(yield y)}e.filter=d;function*g(b,w){let y=0;for(const N of b)yield w(N,y++)}e.map=g;function*p(...b){for(const w of b)yield*w}e.concat=p;function m(b,w,y){let N=y;for(const L of b)N=w(N,L);return N}e.reduce=m;function*v(b,w,y=b.length){for(w<0&&(w+=b.length),y<0?y+=b.length:y>b.length&&(y=b.length);w<y;w++)yield b[w]}e.slice=v;function _(b,w=Number.POSITIVE_INFINITY){const y=[];if(w===0)return[y,b];const N=b[Symbol.iterator]();for(let L=0;L<w;L++){const C=N.next();if(C.done)return[y,e.empty()];y.push(C.value)}return[y,{[Symbol.iterator](){return N}}]}e.consume=_;async function x(b){const w=[];for await(const y of b)w.push(y);return Promise.resolve(w)}e.asyncToArray=x})(mn||(mn={}));const Wo=!1;let he=null;function zo(e){he=e}if(Wo){const e="__is_disposable_tracked__";zo(new class{trackDisposable(t){const n=new Error("Potentially leaked disposable").stack;setTimeout(()=>{t[e]||console.log(n)},3e3)}setParent(t,n){if(t&&t!==Ge.None)try{t[e]=!0}catch{}}markAsDisposed(t){if(t&&t!==Ge.None)try{t[e]=!0}catch{}}markAsSingleton(t){}})}function Ft(e){return he?.trackDisposable(e),e}function Pt(e){he?.markAsDisposed(e)}function pn(e,t){he?.setParent(e,t)}function $o(e,t){if(he)for(const n of e)he.setParent(n,t)}function Kc(e){return he?.markAsSingleton(e),e}function e0(e){return typeof e.dispose=="function"&&e.dispose.length===0}function Yn(e){if(mn.is(e)){const t=[];for(const n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function Ho(...e){const t=vn(()=>Yn(e));return $o(e,t),t}function vn(e){const t=Ft({dispose:Uo(()=>{Pt(t),e()})});return t}class gt{constructor(){this._toDispose=new Set,this._isDisposed=!1,Ft(this)}dispose(){this._isDisposed||(Pt(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(th
|
||
|
`).slice(2).join(`
|
||
|
`))}}class _n{constructor(t){this.value=t}}const Yo=2,Zo=(e,t)=>{if(e instanceof _n)t(e);else for(let n=0;n<e.length;n++){const r=e[n];r&&t(r)}},Dt=Jo?new FinalizationRegistry(e=>{typeof e=="string"&&(console.warn("[LEAKING LISTENER] GC'ed a listener that was NOT yet disposed. This is where is was created:"),console.warn(e))}):void 0;class de{constructor(t){var n,r,i,s,a;this._size=0,this._options=t,this._leakageMon=yi>0||!((n=this._options)===null||n===void 0)&&n.leakWarningThreshold?new Xo((i=(r=this._options)===null||r===void 0?void 0:r.leakWarningThreshold)!==null&&i!==void 0?i:yi):void 0,this._perfMon=!((s=this._options)===null||s===void 0)&&s._profName?new mt(this._options._profName):void 0,this._deliveryQueue=(a=this._options)===null||a===void 0?void 0:a.deliveryQueue}dispose(){var t,n,r,i;if(!this._disposed){if(this._disposed=!0,((t=this._deliveryQueue)===null||t===void 0?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners){if(_i){const s=this._listeners;queueMicrotask(()=>{Zo(s,a=>{var o;return(o=a.stack)===null||o===void 0?void 0:o.print()})})}this._listeners=void 0,this._size=0}(r=(n=this._options)===null||n===void 0?void 0:n.onDidRemoveLastListener)===null||r===void 0||r.call(n),(i=this._leakageMon)===null||i===void 0||i.dispose()}}get event(){var t;return(t=this._event)!==null&&t!==void 0||(this._event=(n,r,i)=>{var s,a,o,l,u;if(this._leakageMon&&this._size>this._leakageMon.threshold*3)return console.warn(`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far`),Ge.None;if(this._disposed)return Ge.None;r&&(n=n.bind(r));const c=new _n(n);let h,d;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(c.stack=It.create(),h=this._leakageMon.check(c.stack,this._size+1)),_i&&(c.stack=d??It.create()),this._listeners?this._listeners instanceof _n?((u=this._deliveryQueue)!==null&&u!==void 0||(this._deliveryQueue=new wi),this._listeners=[this._listeners,c]):this._listeners.push(c):((a=(s=this._options)===null||s===void 0?void 0:s.onWillAddFirstListener)===null||a===void 0||a.call(s,this),this._listeners=c,(l=(o=this._options)===null||o===void 0?void 0:o.onDidAddFirstListener)===null||l===void 0||l.call(o,this)),this._size++;const g=vn(()=>{Dt?.unregister(g),h?.(),this._removeListener(c)});if(i instanceof gt?i.add(g):Array.isArray(i)&&i.push(g),Dt){const p=new Error().stack.split(`
|
||
|
`).slice(2).join(`
|
||
|
`).trim();Dt.register(g,p,g)}return g}),this._event}_removeListener(t){var n,r,i,s;if((r=(n=this._options)===null||n===void 0?void 0:n.onWillRemoveListener)===null||r===void 0||r.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(s=(i=this._options)===null||i===void 0?void 0:i.onDidRemoveLastListener)===null||s===void 0||s.call(i,this),this._size=0;return}const a=this._listeners,o=a.indexOf(t);if(o===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,a[o]=void 0;const l=this._deliveryQueue.current===this;if(this._size*Yo<=a.length){let u=0;for(let c=0;c<a.length;c++)a[c]?a[u++]=a[c]:l&&(this._deliveryQueue.end--,u<this._deliveryQueue.i&&this._deliveryQueue.i--);a.length=u}}_deliver(t,n){var r;if(!t)return;const i=((r=this._options)===null||r===void 0?void 0:r.onListenerError)||pi;if(!i){t.value(n);return}try{t.value(n)}catch(s){i(s)}}_deliverQueue(t){const n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,r,i,s;if(!((n=this._deliveryQueue)===null||n===void 0)&&n.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)===null||r===void 0||r.stop()),(i=this._perfMon)===null||i===void 0||i.start(this._size),this._listeners)if(this._listeners instanceof _n)this._deliver(this._listeners,t);else{const a=this._deliveryQueue;a.enqueue(this,t,this._listeners.length),this._deliverQueue(a)}(s=this._perfMon)===null||s===void 0||s.stop()}hasListeners(){return this._size>0}}const s0=()=>new wi;class wi{constructor(){this.i=-1,this.end=0}enqueue(t,n,r){this.i=0,this.end=r,this.current=t,this.value=n}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}class Ko extends de{constructor(t){super(t),this._isPaused=0,this._eventQueue=new xi,this._mergeFn=t?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){const t=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(t))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(t){this._size&&(this._isPaused!==0?this._eventQueue.push(t):super.fire(t))}}class a0 extends Ko{constructor(t){var n;super(t),this._delay=(n=t.delay)!==null&&n!==void 0?n:100}fire(t){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(t)}}class o0 extends de{constructor(t){super(t),this._queuedEvents=[],this._mergeFn=t?.merge}fire(t){this.hasListeners()&&(this._queuedEvents.push(t),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(n=>super.fire(n)),this._queuedEvents=[]}))}}class l0{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new de({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(t){const n={event:t,listener:null};this.events.push(n),this.hasListeners&&this.hook(n);const r=()=>{this.hasListeners&&this.unhook(n);const i=this.events.indexOf(n);this.events.splice(i,1)};return toDisposable(createSingleCallFunction(r))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(t=>this.hook(t))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(t=>this.unhook(t))}hook(t){t.listener=t.event(n=>this.emitter.fire(n))}unhook(t){var n;(n=t.listener)===null||n===void 0||n.dispose(),t.listener=null}dispose(){var t;this.emitter.dispose();for(const n of this.events)(t=n.listener)===null||t===void 0||t.dispose();this.events=[]}}class u0{constructor(){this.buffers=[]}wrapEvent(t){return(n,r,i)=>t(s=>{const a=this.buffers[this.buffers.length-1];a?a.push(()=>n.call(r,s)):n.call(r,s)},void 0,i)}bufferEvents(t){const n=[];this.buffers.push(n);const r=t();return this.buffers.pop(),n.forEach(i=>i()),r}}class c0{constructor(){this.listening=!1,this.inputEvent=xn.None,this.in
|
||
|
`)>=0;let n=null;try{n=strings.createRegExp(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:t,global:!0,unicode:!0})}catch{return null}if(!n)return null;let r=!this.isRegex&&!t;return r&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(r=this.matchCase),new SearchData(n,this.wordSeparators?getMapForWordSeparators(this.wordSeparators,[]):null,r?this.searchString:null)}}function Yl(e){if(!e||e.length===0)return!1;for(let t=0,n=e.length;t<n;t++){const r=e.charCodeAt(t);if(r===10)return!0;if(r===92){if(t++,t>=n)break;const i=e.charCodeAt(t);if(i===110||i===114||i===87)return!0}}return!1}function Jt(e,t,n){if(!n)return new FindMatch(e,null);const r=[];for(let i=0,s=t.length;i<s;i++)r[i]=t[i];return new FindMatch(e,r)}class da{constructor(t){const n=[];let r=0;for(let i=0,s=t.length;i<s;i++)t.charCodeAt(i)===10&&(n[r++]=i);this._lineFeedsOffsets=n}findLineFeedCountBeforeOffset(t){const n=this._lineFeedsOffsets;let r=0,i=n.length-1;if(i===-1||t<=n[0])return 0;for(;r<i;){const s=r+((i-r)/2>>0);n[s]>=t?i=s-1:n[s+1]>=t?(r=s,i=s):r=s+1}return r+1}}class mh{static findMatches(t,n,r,i,s){const a=n.parseSearchRequest();return a?a.regex.multiline?this._doFindMatchesMultiline(t,r,new Qt(a.wordSeparators,a.regex),i,s):this._doFindMatchesLineByLine(t,r,a,i,s):[]}static _getMultilineMatchRange(t,n,r,i,s,a){let o,l=0;i?(l=i.findLineFeedCountBeforeOffset(s),o=n+s+l):o=n+s;let u;if(i){const g=i.findLineFeedCountBeforeOffset(s+a.length)-l;u=o+a.length+g}else u=o+a.length;const c=t.getPositionAt(o),h=t.getPositionAt(u);return new Range(c.lineNumber,c.column,h.lineNumber,h.column)}static _doFindMatchesMultiline(t,n,r,i,s){const a=t.getOffsetAt(n.getStartPosition()),o=t.getValueInRange(n,1),l=t.getEOL()===`\r
|
||
|
`?new da(o):null,u=[];let c=0,h;for(r.reset(0);h=r.next(o);)if(u[c++]=Jt(this._getMultilineMatchRange(t,a,o,l,h.index,h[0]),h,i),c>=s)return u;return u}static _doFindMatchesLineByLine(t,n,r,i,s){const a=[];let o=0;if(n.startLineNumber===n.endLineNumber){const u=t.getLineContent(n.startLineNumber).substring(n.startColumn-1,n.endColumn-1);return o=this._findMatchesInLine(r,u,n.startLineNumber,n.startColumn-1,o,a,i,s),a}const l=t.getLineContent(n.startLineNumber).substring(n.startColumn-1);o=this._findMatchesInLine(r,l,n.startLineNumber,n.startColumn-1,o,a,i,s);for(let u=n.startLineNumber+1;u<n.endLineNumber&&o<s;u++)o=this._findMatchesInLine(r,t.getLineContent(u),u,0,o,a,i,s);if(o<s){const u=t.getLineContent(n.endLineNumber).substring(0,n.endColumn-1);o=this._findMatchesInLine(r,u,n.endLineNumber,0,o,a,i,s)}return a}static _findMatchesInLine(t,n,r,i,s,a,o,l){const u=t.wordSeparators;if(!o&&t.simpleSearch){const d=t.simpleSearch,g=d.length,p=n.length;let m=-g;for(;(m=n.indexOf(d,m+g))!==-1;)if((!u||ga(u,n,p,m,g))&&(a[s++]=new FindMatch(new Range(r,m+1+i,r,m+1+g+i),null),s>=l))return s;return s}const c=new Qt(t.wordSeparators,t.regex);let h;c.reset(0);do if(h=c.next(n),h&&(a[s++]=Jt(new Range(r,h.index+1+i,r,h.index+1+h[0].length+i),h,o),s>=l))return s;while(h);return s}static findNextMatch(t,n,r,i){const s=n.parseSearchRequest();if(!s)return null;const a=new Qt(s.wordSeparators,s.regex);return s.regex.multiline?this._doFindNextMatchMultiline(t,r,a,i):this._doFindNextMatchLineByLine(t,r,a,i)}static _doFindNextMatchMultiline(t,n,r,i){const s=new Position(n.lineNumber,1),a=t.getOffsetAt(s),o=t.getLineCount(),l=t.getValueInRange(new Range(s.lineNumber,s.column,o,t.getLineMaxColumn(o)),1),u=t.getEOL()===`\r
|
||
|
`?new da(l):null;r.reset(n.column-1);const c=r.next(l);return c?Jt(this._getMultilineMatchRange(t,a,l,u,c.index,c[0]),c,i):n.lineNumber!==1||n.column!==1?this._doFindNextMatchMultiline(t,new Position(1,1),r,i):null}static _doFindNextMatchLineByLine(t,n,r,i){const s=t.getLineCount(),a=n.lineNumber,o=t.getLineContent(a),l=this._findFirstMatchInLine(r,o,a,n.column,i);if(l)return l;for(let u=1;u<=s;u++){const c=(a+u-1)%s,h=t.getLineContent(c+1),d=this._findFirstMatchInLine(r,h,c+1,1,i);if(d)return d}return null}static _findFirstMatchInLine(t,n,r,i,s){t.reset(i-1);const a=t.next(n);return a?Jt(new Range(r,a.index+1,r,a.index+1+a[0].length),a,s):null}static findPreviousMatch(t,n,r,i){const s=n.parseSearchRequest();if(!s)return null;const a=new Qt(s.wordSeparators,s.regex);return s.regex.multiline?this._doFindPreviousMatchMultiline(t,r,a,i):this._doFindPreviousMatchLineByLine(t,r,a,i)}static _doFindPreviousMatchMultiline(t,n,r,i){const s=this._doFindMatchesMultiline(t,new Range(1,1,n.lineNumber,n.column),r,i,10*Xl);if(s.length>0)return s[s.length-1];const a=t.getLineCount();return n.lineNumber!==a||n.column!==t.getLineMaxColumn(a)?this._doFindPreviousMatchMultiline(t,new Position(a,t.getLineMaxColumn(a)),r,i):null}static _doFindPreviousMatchLineByLine(t,n,r,i){const s=t.getLineCount(),a=n.lineNumber,o=t.getLineContent(a).substring(0,n.column-1),l=this._findLastMatchInLine(r,o,a,i);if(l)return l;for(let u=1;u<=s;u++){const c=(s+a-u-1)%s,h=t.getLineContent(c+1),d=this._findLastMatchInLine(r,h,c+1,i);if(d)return d}return null}static _findLastMatchInLine(t,n,r,i){let s=null,a;for(t.reset(0);a=t.next(n);)s=Jt(new Range(r,a.index+1,r,a.index+1+a[0].length),a,i);return s}}function Zl(e,t,n,r,i){if(r===0)return!0;const s=t.charCodeAt(r-1);if(e.get(s)!==0||s===13||s===10)return!0;if(i>0){const a=t.charCodeAt(r);if(e.get(a)!==0)return!0}return!1}function Kl(e,t,n,r,i){if(r+i===n)return!0;const s=t.charCodeAt(r+i);if(e.get(s)!==0||s===13||s===10)return!0;if(i>0){const a=t.charCodeAt(r+i-1);if(e.get(a)!==0)return!0}return!1}function ga(e,t,n,r,i){return Zl(e,t,n,r,i)&&Kl(e,t,n,r,i)}class Qt{constructor(t,n){this._wordSeparators=t,this._searchRegex=n,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(t){this._searchRegex.lastIndex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(t){const n=t.length;let r;do{if(this._prevMatchStartIndex+this._prevMatchLength===n||(r=this._searchRegex.exec(t),!r))return null;const i=r.index,s=r[0].length;if(i===this._prevMatchStartIndex&&s===this._prevMatchLength){if(s===0){Ii(t,n,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=i,this._prevMatchLength=s,!this._wordSeparators||ga(this._wordSeparators,t,n,i,s))return r}while(r);return null}}function ph(e,t){if(!e)throw new Error(t?`Assertion failed (${t})`:"Assertion Failed")}function eu(e,t="Unreachable"){throw new Error(t)}function vh(e){e||onUnexpectedError(new BugIndicatingError("Soft Assertion Failed"))}function In(e){if(!e()){debugger;e(),pi(new Be("Assertion Failed"))}}function ma(e,t){let n=0;for(;n<e.length-1;){const r=e[n],i=e[n+1];if(!t(r,i))return!1;n++}return!0}class tu{static computeUnicodeHighlights(t,n,r){const i=r?r.startLineNumber:1,s=r?r.endLineNumber:t.getLineCount(),a=new pa(n),o=a.getCandidateCodePoints();let l;o==="allNonBasicAscii"?l=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):l=new RegExp(`${nu(Array.from(o))}`,"g");const u=new Qt(null,l),c=[];let h=!1,d,g=0,p=0,m=0;e:for(let v=i,_=s;v<=_;v++){const x=t.getLineContent(v),b=x.length;u.reset(0);do if(d=u.next(x),d){let w=d.index,y=d.index+d[0].length;if(w>0){const R=x.charCodeAt(w-1);Bt(R)&&w--}if(y+1<b){const R=x.charCodeAt(y-1);Bt(R)&&y++}const N=x.substring(w,y);let L=wr(w+1,is,x,0);L&&L.endColumn<=w+1&&(L=null);const C=a.shouldHighlightNonBasicASCII(N,L?L.word:null);if(C!==0){if(C===3?g++:C===2?p++:C===1?m++:eu(C),c.length>=1e3){h=!0;break e}c.push(new H(v,w+1,v,y+1))}}while(d)}return{ranges:c,hasMore:h,ambiguousCharacterCount:g,invisibleCharacterCount:p,nonBasicAsciiCh
|
||
|
`||e===" "}class Dn{constructor(t,n,r){this.changes=t,this.moves=n,this.hitTimeout=r}}class ru{constructor(t,n){this.lineRangeMapping=t,this.changes=n}}class G{static addRange(t,n){let r=0;for(;r<n.length&&n[r].endExclusive<t.start;)r++;let i=r;for(;i<n.length&&n[i].start<=t.endExclusive;)i++;if(r===i)n.splice(r,0,t);else{const s=Math.min(t.start,n[r].start),a=Math.max(t.endExclusive,n[i-1].endExclusive);n.splice(r,i-r,new G(s,a))}}static tryCreate(t,n){if(!(t>n))return new G(t,n)}static ofLength(t){return new G(0,t)}static ofStartAndLength(t,n){return new G(t,t+n)}constructor(t,n){if(this.start=t,this.endExclusive=n,t>n)throw new Be(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(t){return new G(this.start+t,this.endExclusive+t)}deltaStart(t){return new G(this.start+t,this.endExclusive)}deltaEnd(t){return new G(this.start,this.endExclusive+t)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}contains(t){return this.start<=t&&t<this.endExclusive}join(t){return new G(Math.min(this.start,t.start),Math.max(this.endExclusive,t.endExclusive))}intersect(t){const n=Math.max(this.start,t.start),r=Math.min(this.endExclusive,t.endExclusive);if(n<=r)return new G(n,r)}intersects(t){const n=Math.max(this.start,t.start),r=Math.min(this.endExclusive,t.endExclusive);return n<r}isBefore(t){return this.endExclusive<=t.start}isAfter(t){return this.start>=t.endExclusive}slice(t){return t.slice(this.start,this.endExclusive)}substring(t){return t.substring(this.start,this.endExclusive)}clip(t){if(this.isEmpty)throw new Be(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,t))}clipCyclic(t){if(this.isEmpty)throw new Be(`Invalid clipping range: ${this.toString()}`);return t<this.start?this.endExclusive-(this.start-t)%this.length:t>=this.endExclusive?this.start+(t-this.start)%this.length:t}forEach(t){for(let n=this.start;n<this.endExclusive;n++)t(n)}}class ba{constructor(){this._sortedRanges=[]}addRange(t){let n=0;for(;n<this._sortedRanges.length&&this._sortedRanges[n].endExclusive<t.start;)n++;let r=n;for(;r<this._sortedRanges.length&&this._sortedRanges[r].start<=t.endExclusive;)r++;if(n===r)this._sortedRanges.splice(n,0,t);else{const i=Math.min(t.start,this._sortedRanges[n].start),s=Math.max(t.endExclusive,this._sortedRanges[r-1].endExclusive);this._sortedRanges.splice(n,r-n,new G(i,s))}}toString(){return this._sortedRanges.map(t=>t.toString()).join(", ")}intersectsStrict(t){let n=0;for(;n<this._sortedRanges.length&&this._sortedRanges[n].endExclusive<=t.start;)n++;return n<this._sortedRanges.length&&this._sortedRanges[n].start<t.endExclusive}intersectWithRange(t){const n=new ba;for(const r of this._sortedRanges){const i=r.intersect(t);i&&n.addRange(i)}return n}intersectWithRangeLength(t){return this.intersectWithRange(t).length}get length(){return this._sortedRanges.reduce((t,n)=>t+n.length,0)}}function bh(e,t,n){const r=iu(e,t);if(r!==-1)return e[r]}function iu(e,t,n=e.length-1){for(let r=n;r>=0;r--){const i=e[r];if(t(i))return r}return-1}function Lt(e,t){const n=Xt(e,t);return n===-1?void 0:e[n]}function Xt(e,t,n=0,r=e.length){let i=n,s=r;for(;i<s;){const a=Math.floor((i+s)/2);t(e[a])?i=a+1:s=a}return i-1}function su(e,t){const n=Ir(e,t);return n===e.length?void 0:e[n]}function Ir(e,t,n=0,r=e.length){let i=n,s=r;for(;i<s;){const a=Math.floor((i+s)/2);t(e[a])?s=a:i=a+1}return i}class Yt{constructor(t){this._array=t,this._findLastMonotonousLastIdx=0}findLastMonotonous(t){if(Yt.assertInvariants){if(this._prevFindLastPredicate){for(const r of this._array)if(this._prevFindLastPredicate(r)&&!t(r))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=t}const n=Xt(this._array,t,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=n+1,n===-1?void 0:this._array[n]}}Yt.assertInvariants=!1;function au(e,t){if(e.length===0)return;let n=e[0];for(let r=1;r<e.length;r++){const i=e[r];t(i,n)>0&&(n=i)}re
|
||
|
`);this.histogram[o]=(this.histogram[o]||0)+1}this.totalCount=i}computeSimilarity(t){var n,r;let i=0;const s=Math.max(this.histogram.length,t.histogram.length);for(let a=0;a<s;a++)i+=Math.abs(((n=this.histogram[a])!==null&&n!==void 0?n:0)-((r=t.histogram[a])!==null&&r!==void 0?r:0));return 1-i/(this.totalCount+t.totalCount)}}Nt.chrKeys=new Map;class du{compute(t,n,r=Kt.instance,i){if(t.length===0||n.length===0)return We.trivial(t,n);const s=new Vr(t.length,n.length),a=new Vr(t.length,n.length),o=new Vr(t.length,n.length);for(let p=0;p<t.length;p++)for(let m=0;m<n.length;m++){if(!r.isValid())return We.trivialTimedOut(t,n);const v=p===0?0:s.get(p-1,m),_=m===0?0:s.get(p,m-1);let x;t.getElement(p)===n.getElement(m)?(p===0||m===0?x=0:x=s.get(p-1,m-1),p>0&&m>0&&a.get(p-1,m-1)===3&&(x+=o.get(p-1,m-1)),x+=i?i(p,m):1):x=-1;const b=Math.max(v,_,x);if(b===x){const w=p>0&&m>0?o.get(p-1,m-1):0;o.set(p,m,w+1),a.set(p,m,3)}else b===v?(o.set(p,m,0),a.set(p,m,1)):b===_&&(o.set(p,m,0),a.set(p,m,2));s.set(p,m,b)}const l=[];let u=t.length,c=n.length;function h(p,m){(p+1!==u||m+1!==c)&&l.push(new te(new G(p+1,u),new G(m+1,c))),u=p,c=m}let d=t.length-1,g=n.length-1;for(;d>=0&&g>=0;)a.get(d,g)===3?(h(d,g),d--,g--):a.get(d,g)===1?d--:g--;return h(-1,-1),l.reverse(),new We(l,!1)}}class wa{compute(t,n,r=Kt.instance){if(t.length===0||n.length===0)return We.trivial(t,n);const i=t,s=n;function a(m,v){for(;m<i.length&&v<s.length&&i.getElement(m)===s.getElement(v);)m++,v++;return m}let o=0;const l=new gu;l.set(0,a(0,0));const u=new mu;u.set(0,l.get(0)===0?null:new La(null,0,0,l.get(0)));let c=0;e:for(;;){if(o++,!r.isValid())return We.trivialTimedOut(i,s);const m=-Math.min(o,s.length+o%2),v=Math.min(o,i.length+o%2);for(c=m;c<=v;c+=2){let _=0;const x=c===v?-1:l.get(c+1),b=c===m?-1:l.get(c-1)+1;_++;const w=Math.min(Math.max(x,b),i.length),y=w-c;if(_++,w>i.length||y>s.length)continue;const N=a(w,y);l.set(c,N);const L=w===x?u.get(c+1):u.get(c-1);if(u.set(c,N!==w?new La(L,w,y,N-w):L),l.get(c)===i.length&&l.get(c)-c===s.length)break e}}let h=u.get(c);const d=[];let g=i.length,p=s.length;for(;;){const m=h?h.x+h.length:0,v=h?h.y+h.length:0;if((m!==g||v!==p)&&d.push(new te(new G(m,g),new G(v,p))),!h)break;g=h.x,p=h.y,h=h.prev}return d.reverse(),new We(d,!1)}}class La{constructor(t,n,r,i){this.prev=t,this.x=n,this.y=r,this.length=i}}class gu{constructor(){this.positiveArr=new Int32Array(10),this.negativeArr=new Int32Array(10)}get(t){return t<0?(t=-t-1,this.negativeArr[t]):this.positiveArr[t]}set(t,n){if(t<0){if(t=-t-1,t>=this.negativeArr.length){const r=this.negativeArr;this.negativeArr=new Int32Array(r.length*2),this.negativeArr.set(r)}this.negativeArr[t]=n}else{if(t>=this.positiveArr.length){const r=this.positiveArr;this.positiveArr=new Int32Array(r.length*2),this.positiveArr.set(r)}this.positiveArr[t]=n}}}class mu{constructor(){this.positiveArr=[],this.negativeArr=[]}get(t){return t<0?(t=-t-1,this.negativeArr[t]):this.positiveArr[t]}set(t,n){t<0?(t=-t-1,this.negativeArr[t]=n):this.positiveArr[t]=n}}class On{constructor(t,n,r){this.lines=t,this.considerWhitespaceChanges=r,this.elements=[],this.firstCharOffsetByLine=[],this.additionalOffsetByLine=[];let i=!1;n.start>0&&n.endExclusive>=t.length&&(n=new G(n.start-1,n.endExclusive),i=!0),this.lineRange=n,this.firstCharOffsetByLine[0]=0;for(let s=this.lineRange.start;s<this.lineRange.endExclusive;s++){let a=t[s],o=0;if(i)o=a.length,a="",i=!1;else if(!r){const l=a.trimStart();o=a.length-l.length,a=l.trimEnd()}this.additionalOffsetByLine.push(o);for(let l=0;l<a.length;l++)this.elements.push(a.charCodeAt(l));s<t.length-1&&(this.elements.push(10),this.firstCharOffsetByLine[s-this.lineRange.start+1]=this.elements.length)}this.additionalOffsetByLine.push(0)}toString(){return`Slice: "${this.text}"`}get text(){return this.getText(new G(0,this.length))}getText(t){return this.elements.slice(t.start,t.endExclusive).map(n=>String.fromCharCode(n)).join("")}getElement(t){return this.elements[t]}get length(){return this.elements.length}getBoundaryScore(t){const n=Aa(t>0?this.elements[t-1]:-1),r=Aa(t<this.elements.length?this.ele
|
||
|
`).length>=15&&bu(h,g=>g.length>=2)>=2}),a=wu(e,a),a}function bu(e,t){let n=0;for(const r of e)t(r)&&n++;return n}function xu(e,t,n,r){const i=[],s=e.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new Nt(l.original,t,l)),a=new Set(e.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new Nt(l.modified,n,l))),o=new Set;for(const l of s){let u=-1,c;for(const h of a){const d=l.computeSimilarity(h);d>u&&(u=d,c=h)}if(u>.9&&c&&(a.delete(c),i.push(new Me(l.range,c.range)),o.add(l.source),o.add(c.source)),!r.isValid())return{moves:i,excludedChanges:o}}return{moves:i,excludedChanges:o}}function _u(e,t,n,r,i,s){const a=[],o=new Jl;for(const d of e)for(let g=d.original.startLineNumber;g<d.original.endLineNumberExclusive-2;g++){const p=`${t[g-1]}:${t[g+1-1]}:${t[g+2-1]}`;o.add(p,{range:new J(g,g+3)})}const l=[];e.sort(Mn(d=>d.modified.startLineNumber,Wt));for(const d of e){let g=[];for(let p=d.modified.startLineNumber;p<d.modified.endLineNumberExclusive-2;p++){const m=`${n[p-1]}:${n[p+1-1]}:${n[p+2-1]}`,v=new J(p,p+3),_=[];o.forEach(m,({range:x})=>{for(const w of g)if(w.originalLineRange.endLineNumberExclusive+1===x.endLineNumberExclusive&&w.modifiedLineRange.endLineNumberExclusive+1===v.endLineNumberExclusive){w.originalLineRange=new J(w.originalLineRange.startLineNumber,x.endLineNumberExclusive),w.modifiedLineRange=new J(w.modifiedLineRange.startLineNumber,v.endLineNumberExclusive),_.push(w);return}const b={modifiedLineRange:v,originalLineRange:x};l.push(b),_.push(b)}),g=_}if(!s.isValid())return[]}l.sort(pl(Mn(d=>d.modifiedLineRange.length,Wt)));const u=new Pe,c=new Pe;for(const d of l){const g=d.modifiedLineRange.startLineNumber-d.originalLineRange.startLineNumber,p=u.subtractFrom(d.modifiedLineRange),m=c.subtractFrom(d.originalLineRange).getWithDelta(g),v=p.getIntersection(m);for(const _ of v.ranges){if(_.length<3)continue;const x=_,b=_.delta(-g);a.push(new Me(b,x)),u.addRange(x),c.addRange(b)}}a.sort(Mn(d=>d.original.startLineNumber,Wt));const h=new Yt(e);for(let d=0;d<a.length;d++){const g=a[d],p=h.findLastMonotonous(N=>N.original.startLineNumber<=g.original.startLineNumber),m=Lt(e,N=>N.modified.startLineNumber<=g.modified.startLineNumber),v=Math.max(g.original.startLineNumber-p.original.startLineNumber,g.modified.startLineNumber-m.modified.startLineNumber),_=h.findLastMonotonous(N=>N.original.startLineNumber<g.original.endLineNumberExclusive),x=Lt(e,N=>N.modified.startLineNumber<g.modified.endLineNumberExclusive),b=Math.max(_.original.endLineNumberExclusive-g.original.endLineNumberExclusive,x.modified.endLineNumberExclusive-g.modified.endLineNumberExclusive);let w;for(w=0;w<v;w++){const N=g.original.startLineNumber-w-1,L=g.modified.startLineNumber-w-1;if(N>r.length||L>i.length||u.contains(L)||c.contains(N)||!Na(r[N-1],i[L-1],s))break}w>0&&(c.addRange(new J(g.original.startLineNumber-w,g.original.startLineNumber)),u.addRange(new J(g.modified.startLineNumber-w,g.modified.startLineNumber)));let y;for(y=0;y<b;y++){const N=g.original.endLineNumberExclusive+y,L=g.modified.endLineNumberExclusive+y;if(N>r.length||L>i.length||u.contains(L)||c.contains(N)||!Na(r[N-1],i[L-1],s))break}y>0&&(c.addRange(new J(g.original.endLineNumberExclusive,g.original.endLineNumberExclusive+y)),u.addRange(new J(g.modified.endLineNumberExclusive,g.modified.endLineNumberExclusive+y))),(w>0||y>0)&&(a[d]=new Me(new J(g.original.startLineNumber-w,g.original.endLineNumberExclusive+y),new J(g.modified.startLineNumber-w,g.modified.endLineNumberExclusive+y)))}return a}function Na(e,t,n){if(e.trim()===t.trim())return!0;if(e.length>300&&t.length>300)return!1;const i=new wa().compute(new On([e],new G(0,1),!1),new On([t],new G(0,1),!1),n);let s=0;const a=te.invert(i.diffs,e.length);for(const c of a)c.seq1Range.forEach(h=>{Br(e.charCodeAt(h))||s++});function o(c){let h=0;for(let d=0;d<e.length;d++)Br(c.charCodeAt(d))||h++;return h}const l=o(e.length>t.length?e:t);return s/l>.6&&l>10}function yu(e){if(e.length===0)return e;e.sort(Mn(n=>n.original.startLineNumber,Wt));const t=[e[0]];for(let n=1;n<e.length;n++){const r=t[t.length-1],i=e[n],s=i.origina
|
||
|
`)}isStronglyEqual(t,n){return this.lines[t]===this.lines[n]}}function Ra(e){let t=0;for(;t<e.length&&(e.charCodeAt(t)===32||e.charCodeAt(t)===9);)t++;return t}class ku{constructor(){this.dynamicProgrammingDiffing=new du,this.myersDiffingAlgorithm=new wa}computeDiff(t,n,r){if(t.length<=1&&ul(t,n,(y,N)=>y===N))return new Dn([],[],!1);if(t.length===1&&t[0].length===0||n.length===1&&n[0].length===0)return new Dn([new Ue(new J(1,t.length+1),new J(1,n.length+1),[new St(new H(1,1,t.length,t[0].length+1),new H(1,1,n.length,n[0].length+1))])],[],!1);const i=r.maxComputationTimeMs===0?Kt.instance:new hu(r.maxComputationTimeMs),s=!r.ignoreTrimWhitespace,a=new Map;function o(y){let N=a.get(y);return N===void 0&&(N=a.size,a.set(y,N)),N}const l=t.map(y=>o(y.trim())),u=n.map(y=>o(y.trim())),c=new Ma(l,t),h=new Ma(u,n),d=c.length+h.length<1700?this.dynamicProgrammingDiffing.compute(c,h,i,(y,N)=>t[y]===n[N]?n[N].length===0?.1:1+Math.log(1+n[N].length):.99):this.myersDiffingAlgorithm.compute(c,h);let g=d.diffs,p=d.hitTimeout;g=Ca(c,h,g),g=Cu(c,h,g);const m=[],v=y=>{if(s)for(let N=0;N<y;N++){const L=_+N,C=x+N;if(t[L]!==n[C]){const R=this.refineDiff(t,n,new te(new G(L,L+1),new G(C,C+1)),i,s);for(const F of R.mappings)m.push(F);R.hitTimeout&&(p=!0)}}};let _=0,x=0;for(const y of g){In(()=>y.seq1Range.start-_===y.seq2Range.start-x);const N=y.seq1Range.start-_;v(N),_=y.seq1Range.endExclusive,x=y.seq2Range.endExclusive;const L=this.refineDiff(t,n,y,i,s);L.hitTimeout&&(p=!0);for(const C of L.mappings)m.push(C)}v(t.length-_);const b=Ta(m,t,n);let w=[];return r.computeMoves&&(w=this.computeMoves(b,t,n,l,u,i,s)),In(()=>{function y(L,C){if(L.lineNumber<1||L.lineNumber>C.length)return!1;const R=C[L.lineNumber-1];return!(L.column<1||L.column>R.length+1)}function N(L,C){return!(L.startLineNumber<1||L.startLineNumber>C.length+1||L.endLineNumberExclusive<1||L.endLineNumberExclusive>C.length+1)}for(const L of b){if(!L.innerChanges)return!1;for(const C of L.innerChanges)if(!(y(C.modifiedRange.getStartPosition(),n)&&y(C.modifiedRange.getEndPosition(),n)&&y(C.originalRange.getStartPosition(),t)&&y(C.originalRange.getEndPosition(),t)))return!1;if(!N(L.modified,n)||!N(L.original,t))return!1}return!0}),new Dn(b,w,p)}computeMoves(t,n,r,i,s,a,o){return vu(t,n,r,i,s,a).map(c=>{const h=this.refineDiff(n,r,new te(c.original.toOffsetRange(),c.modified.toOffsetRange()),a,o),d=Ta(h.mappings,n,r,!0);return new ru(c,d)})}refineDiff(t,n,r,i,s){const a=new On(t,r.seq1Range,s),o=new On(n,r.seq2Range,s),l=a.length+o.length<500?this.dynamicProgrammingDiffing.compute(a,o,i):this.myersDiffingAlgorithm.compute(a,o,i);let u=l.diffs;return u=Ca(a,o,u),u=Au(a,o,u),u=Su(a,o,u),u=Eu(a,o,u),{mappings:u.map(h=>new St(a.translateRange(h.seq1Range),o.translateRange(h.seq2Range))),hitTimeout:l.hitTimeout}}}function Ta(e,t,n,r=!1){const i=[];for(const s of fl(e.map(a=>Mu(a,t,n)),(a,o)=>a.original.overlapOrTouch(o.original)||a.modified.overlapOrTouch(o.modified))){const a=s[0],o=s[s.length-1];i.push(new Ue(a.original.join(o.original),a.modified.join(o.modified),s.map(l=>l.innerChanges[0])))}return In(()=>!r&&i.length>0&&(i[0].modified.startLineNumber!==i[0].original.startLineNumber||n.length-i[i.length-1].modified.endLineNumberExclusive!==t.length-i[i.length-1].original.endLineNumberExclusive)?!1:ma(i,(s,a)=>a.original.startLineNumber-s.original.endLineNumberExclusive===a.modified.startLineNumber-s.modified.endLineNumberExclusive&&s.original.endLineNumberExclusive<a.original.startLineNumber&&s.modified.endLineNumberExclusive<a.modified.startLineNumber)),i}function Mu(e,t,n){let r=0,i=0;e.modifiedRange.endColumn===1&&e.originalRange.endColumn===1&&e.originalRange.startLineNumber+r<=e.originalRange.endLineNumber&&e.modifiedRange.startLineNumber+r<=e.modifiedRange.endLineNumber&&(i=-1),e.modifiedRange.startColumn-1>=n[e.modifiedRange.startLineNumber-1].length&&e.originalRange.startColumn-1>=t[e.originalRange.startLineNumber-1].length&&e.originalRange.startLineNumber<=e.originalRange.endLineNumber+i&&e.modifiedRange.startLineNumber<=e.modifiedRange.endLineNumber+i&&(r=1);const s=new J(e.origin
|
||
|
`;break;case 114:b+="\r";break;case 116:b+=" ";break;case 117:var L=d(4,!0);L>=0?b+=String.fromCharCode(L):h=4;break;default:h=5}w=r;continue}if(y>=0&&y<=31)if(nn(y)){b+=e.substring(w,r),h=2;break}else h=6;r++}return b}function v(){if(i="",h=0,s=r,l=o,c=u,r>=n)return s=n,a=17;var b=e.charCodeAt(r);if(zr(b)){do r++,i+=String.fromCharCode(b),b=e.charCodeAt(r);while(zr(b));return a=15}if(nn(b))return r++,i+=String.fromCharCode(b),b===13&&e.charCodeAt(r)===10&&(r++,i+=`
|
||
|
`),o++,u=r,a=14;switch(b){case 123:return r++,a=1;case 125:return r++,a=2;case 91:return r++,a=3;case 93:return r++,a=4;case 58:return r++,a=6;case 44:return r++,a=5;case 34:return r++,i=m(),a=10;case 47:var w=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!nn(e.charCodeAt(r));)r++;return i=e.substring(w,r),a=12}if(e.charCodeAt(r+1)===42){r+=2;for(var y=n-1,N=!1;r<y;){var L=e.charCodeAt(r);if(L===42&&e.charCodeAt(r+1)===47){r+=2,N=!0;break}r++,nn(L)&&(L===13&&e.charCodeAt(r)===10&&r++,o++,u=r)}return N||(r++,h=1),i=e.substring(w,r),a=13}return i+=String.fromCharCode(b),r++,a=16;case 45:if(i+=String.fromCharCode(b),r++,r===n||!Et(e.charCodeAt(r)))return a=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=p(),a=11;default:for(;r<n&&_(b);)r++,b=e.charCodeAt(r);if(s!==r){switch(i=e.substring(s,r),i){case"true":return a=8;case"false":return a=9;case"null":return a=7}return a=16}return i+=String.fromCharCode(b),r++,a=16}}function _(b){if(zr(b)||nn(b))return!1;switch(b){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function x(){var b;do b=v();while(b>=12&&b<=15);return b}return{setPosition:g,getPosition:function(){return r},scan:t?x:v,getToken:function(){return a},getTokenValue:function(){return i},getTokenOffset:function(){return s},getTokenLength:function(){return r-s},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return s-c},getTokenError:function(){return h}}}function zr(e){return e===32||e===9||e===11||e===12||e===160||e===5760||e>=8192&&e<=8203||e===8239||e===8287||e===12288||e===65279}function nn(e){return e===10||e===13||e===8232||e===8233}function Et(e){return e>=48&&e<=57}function ju(e,t,n){var r,i,s,a,o;if(t){for(a=t.offset,o=a+t.length,s=a;s>0&&!ja(e,s-1);)s--;for(var l=o;l<e.length&&!ja(e,l);)l++;i=e.substring(s,l),r=qu(i,n)}else i=e,r=0,s=0,a=0,o=e.length;var u=Uu(n,e),c=!1,h=0,d;n.insertSpaces?d=$r(" ",n.tabSize||4):d=" ";var g=Wr(i,!1),p=!1;function m(){return u+$r(d,r+h)}function v(){var S=g.scan();for(c=!1;S===15||S===14;)c=c||S===14,S=g.scan();return p=S===16||g.getTokenError()!==0,S}var _=[];function x(S,E,P){!p&&(!t||E<o&&P>a)&&e.substring(E,P)!==S&&_.push({offset:E,length:P-E,content:S})}var b=v();if(b!==17){var w=g.getTokenOffset()+s,y=$r(d,r);x(y,s,w)}for(;b!==17;){for(var N=g.getTokenOffset()+g.getTokenLength()+s,L=v(),C="",R=!1;!c&&(L===12||L===13);){var F=g.getTokenOffset()+s;x(" ",N,F),N=g.getTokenOffset()+g.getTokenLength()+s,R=L===12,C=R?m():"",L=v()}if(L===2)b!==1&&(h--,C=m());else if(L===4)b!==3&&(h--,C=m());else{switch(b){case 3:case 1:h++,C=m();break;case 5:case 12:C=m();break;case 13:c?C=m():R||(C=" ");break;case 6:R||(C=" ");break;case 10:if(L===6){R||(C="");break}case 7:case 8:case 9:case 11:case 2:case 4:L===12||L===13?R||(C=" "):L!==5&&L!==17&&(p=!0);break;case 16:p=!0;break}c&&(L===12||L===13)&&(C=m())}L===17&&(C=n.insertFinalNewline?u:"");var D=g.getTokenOffset()+s;x(C,N,D),b=L}return _}function $r(e,t){for(var n="",r=0;r<t;r++)n+=e;return n}function qu(e,t){for(var n=0,r=0,i=t.tabSize||4;n<e.length;){var s=e.charAt(n);if(s===" ")r++;else if(s===" ")r+=i;else break;n++}return Math.floor(r/i)}function Uu(e,t){for(var n=0;n<t.length;n++){var r=t.charAt(n);if(r==="\r")return n+1<t.length&&t.charAt(n+1)===`
|
||
|
`?`\r
|
||
|
`:"\r";if(r===`
|
||
|
`)return`
|
||
|
`}return e&&e.eol||`
|
||
|
`}function ja(e,t){return`\r
|
||
|
`.indexOf(e.charAt(t))!==-1}var Vn;(function(e){e.DEFAULT={allowTrailingComma:!1}})(Vn||(Vn={}));function Wu(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=Vn.DEFAULT);var r=null,i=[],s=[];function a(l){Array.isArray(i)?i.push(l):r!==null&&(i[r]=l)}var o={onObjectBegin:function(){var l={};a(l),s.push(i),i=l,r=null},onObjectProperty:function(l){r=l},onObjectEnd:function(){i=s.pop()},onArrayBegin:function(){var l=[];a(l),s.push(i),i=l,r=null},onArrayEnd:function(){i=s.pop()},onLiteralValue:a,onError:function(l,u,c){t.push({error:l,offset:u,length:c})}};return $u(e,o,n),i[0]}function qa(e){if(!e.parent||!e.parent.children)return[];var t=qa(e.parent);if(e.parent.type==="property"){var n=e.parent.children[0].value;t.push(n)}else if(e.parent.type==="array"){var r=e.parent.children.indexOf(e);r!==-1&&t.push(r)}return t}function Hr(e){switch(e.type){case"array":return e.children.map(Hr);case"object":for(var t=Object.create(null),n=0,r=e.children;n<r.length;n++){var i=r[n],s=i.children[1];s&&(t[i.children[0].value]=Hr(s))}return t;case"null":case"string":case"number":case"boolean":return e.value;default:return}}function zu(e,t,n){return n===void 0&&(n=!1),t>=e.offset&&t<e.offset+e.length||n&&t===e.offset+e.length}function Ua(e,t,n){if(n===void 0&&(n=!1),zu(e,t,n)){var r=e.children;if(Array.isArray(r))for(var i=0;i<r.length&&r[i].offset<=t;i++){var s=Ua(r[i],t,n);if(s)return s}return e}}function $u(e,t,n){n===void 0&&(n=Vn.DEFAULT);var r=Wr(e,!1);function i(R){return R?function(){return R(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:function(){return!0}}function s(R){return R?function(F){return R(F,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:function(){return!0}}var a=i(t.onObjectBegin),o=s(t.onObjectProperty),l=i(t.onObjectEnd),u=i(t.onArrayBegin),c=i(t.onArrayEnd),h=s(t.onLiteralValue),d=s(t.onSeparator),g=i(t.onComment),p=s(t.onError),m=n&&n.disallowComments,v=n&&n.allowTrailingComma;function _(){for(;;){var R=r.scan();switch(r.getTokenError()){case 4:x(14);break;case 5:x(15);break;case 3:x(13);break;case 1:m||x(11);break;case 2:x(12);break;case 6:x(16);break}switch(R){case 12:case 13:m?x(10):g();break;case 16:x(1);break;case 15:case 14:break;default:return R}}}function x(R,F,D){if(F===void 0&&(F=[]),D===void 0&&(D=[]),p(R),F.length+D.length>0)for(var S=r.getToken();S!==17;){if(F.indexOf(S)!==-1){_();break}else if(D.indexOf(S)!==-1)break;S=_()}}function b(R){var F=r.getTokenValue();return R?h(F):o(F),_(),!0}function w(){switch(r.getToken()){case 11:var R=r.getTokenValue(),F=Number(R);isNaN(F)&&(x(2),F=0),h(F);break;case 7:h(null);break;case 8:h(!0);break;case 9:h(!1);break;default:return!1}return _(),!0}function y(){return r.getToken()!==10?(x(3,[],[2,5]),!1):(b(!1),r.getToken()===6?(d(":"),_(),C()||x(4,[],[2,5])):x(5,[],[2,5]),!0)}function N(){a(),_();for(var R=!1;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(R||x(4,[],[]),d(","),_(),r.getToken()===2&&v)break}else R&&x(6,[],[]);y()||x(4,[],[2,5]),R=!0}return l(),r.getToken()!==2?x(7,[2],[]):_(),!0}function L(){u(),_();for(var R=!1;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(R||x(4,[],[]),d(","),_(),r.getToken()===4&&v)break}else R&&x(6,[],[]);C()||x(4,[],[4,5]),R=!0}return c(),r.getToken()!==4?x(8,[4],[]):_(),!0}function C(){switch(r.getToken()){case 3:return L();case 1:return N();case 10:return b(!0);default:return w()}}return _(),r.getToken()===17?n.allowEmptyContent?!0:(x(4,[],[]),!1):C()?(r.getToken()!==17&&x(9,[],[]),!0):(x(4,[],[]),!1)}var kt=Wr,Hu=Wu,Gu=Ua,Ju=qa,Qu=Hr;function Xu(e,t,n){return ju(e,t,n)}function rn(e,t){if(e===t)return!0;if(e==null||t===null||t===void 0||typeof e!=typeof t||typeof e!="object"||Array.isArray(e)!==Array.isArray(t))return!1;var n,r;if(Array.isArray(e)){if(e.length!==t.length)return!1;for(n=0;n<e.length;n++)if(!rn(e[n],t[n]))return!1}else{var i=[];for(r in e)i.push(r);i.sort();var s=[];for(r in t)s.push(r);if(s.sort(),!rn(i,s))return!1;for(n=0;n<i.length;n++)if(!rn(e[i[n]],t[i[n]]))return!1}return!0}function Le(e){return typ
|
||
|
`,s==="\r"&&i+1<n.length&&n.charAt(i+1)===`
|
||
|
`&&i++}r&&n.length>0&&t.push(n.length),this._lineOffsets=t}return this._lineOffsets},e.prototype.positionAt=function(t){t=Math.max(Math.min(t,this._content.length),0);var n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return Re.create(0,t);for(;r<i;){var s=Math.floor((r+i)/2);n[s]>t?i=s:r=s+1}var a=r-1;return Re.create(a,t-n[a])},e.prototype.offsetAt=function(t){var n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;var r=n[t.line],i=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(r+t.character,i),r)},Object.defineProperty(e.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),e}(),M;(function(e){var t=Object.prototype.toString;function n(g){return typeof g<"u"}e.defined=n;function r(g){return typeof g>"u"}e.undefined=r;function i(g){return g===!0||g===!1}e.boolean=i;function s(g){return t.call(g)==="[object String]"}e.string=s;function a(g){return t.call(g)==="[object Number]"}e.number=a;function o(g,p,m){return t.call(g)==="[object Number]"&&p<=g&&g<=m}e.numberRange=o;function l(g){return t.call(g)==="[object Number]"&&-2147483648<=g&&g<=2147483647}e.integer=l;function u(g){return t.call(g)==="[object Number]"&&0<=g&&g<=2147483647}e.uinteger=u;function c(g){return t.call(g)==="[object Function]"}e.func=c;function h(g){return g!==null&&typeof g=="object"}e.objectLiteral=h;function d(g,p){return Array.isArray(g)&&g.every(p)}e.typedArray=d})(M||(M={}));var _o=class gi{constructor(t,n,r,i){this._uri=t,this._languageId=n,this._version=r,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(t){if(t){const n=this.offsetAt(t.start),r=this.offsetAt(t.end);return this._content.substring(n,r)}return this._content}update(t,n){for(let r of t)if(gi.isIncremental(r)){const i=wo(r.range),s=this.offsetAt(i.start),a=this.offsetAt(i.end);this._content=this._content.substring(0,s)+r.text+this._content.substring(a,this._content.length);const o=Math.max(i.start.line,0),l=Math.max(i.end.line,0);let u=this._lineOffsets;const c=yo(r.text,!1,s);if(l-o===c.length)for(let d=0,g=c.length;d<g;d++)u[d+o+1]=c[d];else c.length<1e4?u.splice(o+1,l-o,...c):this._lineOffsets=u=u.slice(0,o+1).concat(c,u.slice(l+1));const h=r.text.length-(a-s);if(h!==0)for(let d=o+1+c.length,g=u.length;d<g;d++)u[d]=u[d]+h}else if(gi.isFull(r))this._content=r.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=n}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=yo(this._content,!0)),this._lineOffsets}positionAt(t){t=Math.max(Math.min(t,this._content.length),0);let n=this.getLineOffsets(),r=0,i=n.length;if(i===0)return{line:0,character:t};for(;r<i;){let a=Math.floor((r+i)/2);n[a]>t?i=a:r=a+1}let s=r-1;return{line:s,character:t-n[s]}}offsetAt(t){let n=this.getLineOffsets();if(t.line>=n.length)return this._content.length;if(t.line<0)return 0;let r=n[t.line],i=t.line+1<n.length?n[t.line+1]:this._content.length;return Math.max(Math.min(r+t.character,i),r)}get lineCount(){return this.getLineOffsets().length}static isIncremental(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range!==void 0&&(n.rangeLength===void 0||typeof n.rangeLength=="number")}static isFull(t){let n=t;return n!=null&&typeof n.text=="string"&&n.range===void 0&&n.rangeLength===void 0}},Zr;(function(e){function t(i,s,a,o){return new _o(i,s,a,o)}e.create=t;function n(i,s,a){if(i instanceof _o)return i.update(s,a),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}e.update=n;function r(i,s){let a=i.getText(),o=Kr(s.map(ec),(c,h)=>{let d=c.range.start.line-h.range.start.line;return d===0?c.range.start.character-h.range.start.character:d}),l=0;const u=[];for(const c of o){let h=i.offsetAt(c.range.start);if(h<l)throw new Error("Overlapping edit");h>l&&u.push(a.substring(l,h)),c.newText.length&&u.push(c.newText),l=i.offsetAt(c.range.end)}return u.push(a.substr(l)),u.join("")}e.applyEdits=r}
|
||
|
`,s=0;s<e.length;s++)i+=r+ii(e[s],r,n),s<e.length-1&&(i+=","),i+=`
|
||
|
`;return i+=t+"]",i}else{var a=Object.keys(e);if(a.length===0)return"{}";for(var i=`{
|
||
|
`,s=0;s<a.length;s++){var o=a[s];i+=r+JSON.stringify(o)+": "+ii(e[o],r,n),s<a.length-1&&(i+=","),i+=`
|
||
|
`}return i+=t+"}",i}}return n(e)}var si=hn(),hc=[",","}","]"],dc=[":"],gc=function(){function e(t,n,r,i){n===void 0&&(n=[]),r===void 0&&(r=Promise),i===void 0&&(i={}),this.schemaService=t,this.contributions=n,this.promiseConstructor=r,this.clientCapabilities=i}return e.prototype.doResolve=function(t){for(var n=this.contributions.length-1;n>=0;n--){var r=this.contributions[n].resolveCompletion;if(r){var i=r(t);if(i)return i}}return this.promiseConstructor.resolve(t)},e.prototype.doComplete=function(t,n,r){var i=this,s={items:[],isIncomplete:!1},a=t.getText(),o=t.offsetAt(n),l=r.getNodeFromOffset(o,!0);if(this.isInComment(t,l?l.offset:0,o))return Promise.resolve(s);if(l&&o===l.offset+l.length&&o>0){var u=a[o-1];(l.type==="object"&&u==="}"||l.type==="array"&&u==="]")&&(l=l.parent)}var c=this.getCurrentWord(t,o),h;if(l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null"))h=Y.create(t.positionAt(l.offset),t.positionAt(l.offset+l.length));else{var d=o-c.length;d>0&&a[d-1]==='"'&&d--,h=Y.create(t.positionAt(d),n)}var g=!1,p={},m={add:function(v){var _=v.label,x=p[_];if(x)x.documentation||(x.documentation=v.documentation),x.detail||(x.detail=v.detail);else{if(_=_.replace(/[\n]/g,"\u21B5"),_.length>60){var b=_.substr(0,57).trim()+"...";p[b]||(_=b)}h&&v.insertText!==void 0&&(v.textEdit=Te.replace(h,v.insertText)),g&&(v.commitCharacters=v.kind===ve.Property?dc:hc),v.label=_,p[_]=v,s.items.push(v)}},setAsIncomplete:function(){s.isIncomplete=!0},error:function(v){console.error(v)},log:function(v){console.log(v)},getNumberOfProposals:function(){return s.items.length}};return this.schemaService.getSchemaForResource(t.uri,r).then(function(v){var _=[],x=!0,b="",w=void 0;if(l&&l.type==="string"){var y=l.parent;y&&y.type==="property"&&y.keyNode===l&&(x=!y.valueNode,w=y,b=a.substr(l.offset+1,l.length-2),y&&(l=y.parent))}if(l&&l.type==="object"){if(l.offset===o)return s;var N=l.properties;N.forEach(function(F){(!w||w!==F)&&(p[F.keyNode.value]=Yr.create("__"))});var L="";x&&(L=i.evaluateSeparatorAfter(t,t.offsetAt(h.end))),v?i.getPropertyCompletions(v,r,l,x,L,m):i.getSchemaLessPropertyCompletions(r,l,b,m);var C=ri(l);i.contributions.forEach(function(F){var D=F.collectPropertyCompletions(t.uri,C,c,x,L==="",m);D&&_.push(D)}),!v&&c.length>0&&a.charAt(o-c.length-1)!=='"'&&(m.add({kind:ve.Property,label:i.getLabelForValue(c),insertText:i.getInsertTextForProperty(c,void 0,!1,L),insertTextFormat:se.Snippet,documentation:""}),m.setAsIncomplete())}var R={};return v?i.getValueCompletions(v,r,l,o,t,m,R):i.getSchemaLessValueCompletions(r,l,o,t,m),i.contributions.length>0&&i.getContributedValueCompletions(r,l,o,t,m,_),i.promiseConstructor.all(_).then(function(){if(m.getNumberOfProposals()===0){var F=o;l&&(l.type==="string"||l.type==="number"||l.type==="boolean"||l.type==="null")&&(F=l.offset+l.length);var D=i.evaluateSeparatorAfter(t,F);i.addFillerValueCompletions(R,D,m)}return s})})},e.prototype.getPropertyCompletions=function(t,n,r,i,s,a){var o=this,l=n.getMatchingSchemas(t.schema,r.offset);l.forEach(function(u){if(u.node===r&&!u.inverted){var c=u.schema.properties;c&&Object.keys(c).forEach(function(m){var v=c[m];if(typeof v=="object"&&!v.deprecationMessage&&!v.doNotSuggest){var _={kind:ve.Property,label:m,insertText:o.getInsertTextForProperty(m,v,i,s),insertTextFormat:se.Snippet,filterText:o.getFilterTextForValue(m),documentation:o.fromMarkup(v.markdownDescription)||v.description||""};v.suggestSortText!==void 0&&(_.sortText=v.suggestSortText),_.insertText&&sn(_.insertText,"$1".concat(s))&&(_.command={title:"Suggest",command:"editor.action.triggerSuggest"}),a.add(_)}});var h=u.schema.propertyNames;if(typeof h=="object"&&!h.deprecationMessage&&!h.doNotSuggest){var d=function(m,v){v===void 0&&(v=void 0);var _={kind:ve.Property,label:m,insertText:o.getInsertTextForProperty(m,void 0,i,s),insertTextFormat:se.Snippet,filterText:o.getFilterTextForValue(m),documentation:v||o.fromMarkup(h.markdownDescription)||h.description||""};h.suggestSortText!==void 0&&(_.sortText=h.suggestSortText),_.insertText&&sn(_.insertText,"$1".concat(s))&&(_.c
|
||
|
`,b=b+`
|
||
|
`+w+"]",w+=" ",h="array";p=x+w+c.bodyText.split(`
|
||
|
`).join(`
|
||
|
`+w)+b+n,g=g||p,m=p.replace(/[\n]/g,"")}else return;r.add({kind:s.getSuggestionKind(h),label:g,documentation:s.fromMarkup(c.markdownDescription)||c.description,insertText:p,insertTextFormat:se.Snippet,filterText:m}),a=!0}),!a&&typeof t.items=="object"&&!Array.isArray(t.items)&&i<5&&this.addDefaultValueCompletions(t.items,n,r,i+1)},e.prototype.addEnumValueCompletions=function(t,n,r){if(ze(t.const)&&r.add({kind:this.getSuggestionKind(t.type),label:this.getLabelForValue(t.const),insertText:this.getInsertTextForValue(t.const,n),insertTextFormat:se.Snippet,documentation:this.fromMarkup(t.markdownDescription)||t.description}),Array.isArray(t.enum))for(var i=0,s=t.enum.length;i<s;i++){var a=t.enum[i],o=this.fromMarkup(t.markdownDescription)||t.description;t.markdownEnumDescriptions&&i<t.markdownEnumDescriptions.length&&this.doesSupportMarkdown()?o=this.fromMarkup(t.markdownEnumDescriptions[i]):t.enumDescriptions&&i<t.enumDescriptions.length&&(o=t.enumDescriptions[i]),r.add({kind:this.getSuggestionKind(t.type),label:this.getLabelForValue(a),insertText:this.getInsertTextForValue(a,n),insertTextFormat:se.Snippet,documentation:o})}},e.prototype.collectTypes=function(t,n){if(!(Array.isArray(t.enum)||ze(t.const))){var r=t.type;Array.isArray(r)?r.forEach(function(i){return n[i]=!0}):r&&(n[r]=!0)}},e.prototype.addFillerValueCompletions=function(t,n,r){t.object&&r.add({kind:this.getSuggestionKind("object"),label:"{}",insertText:this.getInsertTextForGuessedValue({},n),insertTextFormat:se.Snippet,detail:si("defaults.object","New object"),documentation:""}),t.array&&r.add({kind:this.getSuggestionKind("array"),label:"[]",insertText:this.getInsertTextForGuessedValue([],n),insertTextFormat:se.Snippet,detail:si("defaults.array","New array"),documentation:""})},e.prototype.addBooleanValueCompletion=function(t,n,r){r.add({kind:this.getSuggestionKind("boolean"),label:t?"true":"false",insertText:this.getInsertTextForValue(t,n),insertTextFormat:se.Snippet,documentation:""})},e.prototype.addNullValueCompletion=function(t,n){n.add({kind:this.getSuggestionKind("null"),label:"null",insertText:"null"+t,insertTextFormat:se.Snippet,documentation:""})},e.prototype.addDollarSchemaCompletions=function(t,n){var r=this,i=this.schemaService.getRegisteredSchemaIds(function(s){return s==="http"||s==="https"});i.forEach(function(s){return n.add({kind:ve.Module,label:r.getLabelForValue(s),filterText:r.getFilterTextForValue(s),insertText:r.getInsertTextForValue(s,t),insertTextFormat:se.Snippet,documentation:""})})},e.prototype.getLabelForValue=function(t){return JSON.stringify(t)},e.prototype.getFilterTextForValue=function(t){return JSON.stringify(t)},e.prototype.getFilterTextForSnippetValue=function(t){return JSON.stringify(t).replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")},e.prototype.getLabelForSnippetValue=function(t){var n=JSON.stringify(t);return n.replace(/\$\{\d+:([^}]+)\}|\$\d+/g,"$1")},e.prototype.getInsertTextForPlainText=function(t){return t.replace(/[\\\$\}]/g,"\\$&")},e.prototype.getInsertTextForValue=function(t,n){var r=JSON.stringify(t,null," ");return r==="{}"?"{$1}"+n:r==="[]"?"[$1]"+n:this.getInsertTextForPlainText(r+n)},e.prototype.getInsertTextForSnippetValue=function(t,n){var r=function(i){return typeof i=="string"&&i[0]==="^"?i.substr(1):JSON.stringify(i)};return ii(t,"",r)+n},e.prototype.getInsertTextForGuessedValue=function(t,n){switch(typeof t){case"object":return t===null?"${1:null}"+n:this.getInsertTextForValue(t,n);case"string":var r=JSON.stringify(t);return r=r.substr(1,r.length-2),r=this.getInsertTextForPlainText(r),'"${1:'+r+'}"'+n;case"number":case"boolean":return"${1:"+JSON.stringify(t)+"}"+n}return this.getInsertTextForValue(t,n)},e.prototype.getSuggestionKind=function(t){if(Array.isArray(t)){var n=t;t=n.length>0?n[0]:void 0}if(!t)return ve.Value;switch(t){case"string":return ve.Value;case"object":return ve.Module;case"property":return ve.Property;default:return ve.Value}},e.prototype.getLabelTextForMatchingNode=function(t,n){switch(t.type){case"array":return"[]";case"object":return"{}";default:var r=n.getText().substr(t.offset,t.length
|
||
|
\r\v":{[,]}`.indexOf(i.charAt(r))===-1;)r--;return i.substring(r+1,n)},e.prototype.evaluateSeparatorAfter=function(t,n){var r=kt(t.getText(),!0);r.setPosition(n);var i=r.scan();switch(i){case 5:case 2:case 4:case 17:return"";default:return","}},e.prototype.findItemAtOffset=function(t,n,r){for(var i=kt(n.getText(),!0),s=t.items,a=s.length-1;a>=0;a--){var o=s[a];if(r>o.offset+o.length){i.setPosition(o.offset+o.length);var l=i.scan();return l===5&&r>=i.getTokenOffset()+i.getTokenLength()?a+1:a}else if(r>=o.offset)return a}return 0},e.prototype.isInComment=function(t,n,r){var i=kt(t.getText(),!1);i.setPosition(n);for(var s=i.scan();s!==17&&i.getTokenOffset()+i.getTokenLength()<r;)s=i.scan();return(s===12||s===13)&&i.getTokenOffset()<=r},e.prototype.fromMarkup=function(t){if(t&&this.doesSupportMarkdown())return{kind:He.Markdown,value:t}},e.prototype.doesSupportMarkdown=function(){if(!ze(this.supportsMarkdown)){var t=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsMarkdown=t&&t.completionItem&&Array.isArray(t.completionItem.documentationFormat)&&t.completionItem.documentationFormat.indexOf(He.Markdown)!==-1}return this.supportsMarkdown},e.prototype.doesSupportsCommitCharacters=function(){if(!ze(this.supportsCommitCharacters)){var t=this.clientCapabilities.textDocument&&this.clientCapabilities.textDocument.completion;this.supportsCommitCharacters=t&&t.completionItem&&!!t.completionItem.commitCharactersSupport}return this.supportsCommitCharacters},e}(),mc=function(){function e(t,n,r){n===void 0&&(n=[]),this.schemaService=t,this.contributions=n,this.promise=r||Promise}return e.prototype.doHover=function(t,n,r){var i=t.offsetAt(n),s=r.getNodeFromOffset(i);if(!s||(s.type==="object"||s.type==="array")&&i>s.offset+1&&i<s.offset+s.length-1)return this.promise.resolve(null);var a=s;if(s.type==="string"){var o=s.parent;if(o&&o.type==="property"&&o.keyNode===s&&(s=o.valueNode,!s))return this.promise.resolve(null)}for(var l=Y.create(t.positionAt(a.offset),t.positionAt(a.offset+a.length)),u=function(p){var m={contents:p,range:l};return m},c=ri(s),h=this.contributions.length-1;h>=0;h--){var d=this.contributions[h],g=d.getInfoContribution(t.uri,c);if(g)return g.then(function(p){return u(p)})}return this.schemaService.getSchemaForResource(t.uri,r).then(function(p){if(p&&s){var m=r.getMatchingSchemas(p.schema,s.offset),v=void 0,_=void 0,x=void 0,b=void 0;m.every(function(y){if(y.node===s&&!y.inverted&&y.schema&&(v=v||y.schema.title,_=_||y.schema.markdownDescription||ai(y.schema.description),y.schema.enum)){var N=y.schema.enum.indexOf(ht(s));y.schema.markdownEnumDescriptions?x=y.schema.markdownEnumDescriptions[N]:y.schema.enumDescriptions&&(x=ai(y.schema.enumDescriptions[N])),x&&(b=y.schema.enum[N],typeof b!="string"&&(b=JSON.stringify(b)))}return!0});var w="";return v&&(w=ai(v)),_&&(w.length>0&&(w+=`
|
||
|
|
||
|
`),w+=_),x&&(w.length>0&&(w+=`
|
||
|
|
||
|
`),w+="`".concat(pc(b),"`: ").concat(x)),u([w])}return null})},e}();function ai(e){if(e){var t=e.replace(/([^\n\r])(\r?\n)([^\n\r])/gm,`$1
|
||
|
|
||
|
$3`);return t.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}}function pc(e){return e.indexOf("`")!==-1?"`` "+e+" ``":e}var vc=hn(),bc=function(){function e(t,n){this.jsonSchemaService=t,this.promise=n,this.validationEnabled=!0}return e.prototype.configure=function(t){t&&(this.validationEnabled=t.validate!==!1,this.commentSeverity=t.allowComments?void 0:Se.Error)},e.prototype.doValidation=function(t,n,r,i){var s=this;if(!this.validationEnabled)return this.promise.resolve([]);var a=[],o={},l=function(d){var g=d.range.start.line+" "+d.range.start.character+" "+d.message;o[g]||(o[g]=!0,a.push(d))},u=function(d){var g=r?.trailingCommas?Hn(r.trailingCommas):Se.Error,p=r?.comments?Hn(r.comments):s.commentSeverity,m=r?.schemaValidation?Hn(r.schemaValidation):Se.Warning,v=r?.schemaRequest?Hn(r.schemaRequest):Se.Warning;if(d){if(d.errors.length&&n.root&&v){var _=n.root,x=_.type==="object"?_.properties[0]:void 0;if(x&&x.keyNode.value==="$schema"){var b=x.valueNode||x,w=Y.create(t.positionAt(b.offset),t.positionAt(b.offset+b.length));l($e.create(w,d.errors[0],v,Q.SchemaResolveError))}else{var w=Y.create(t.positionAt(_.offset),t.positionAt(_.offset+1));l($e.create(w,d.errors[0],v,Q.SchemaResolveError))}}else if(m){var y=n.validate(t,d.schema,m);y&&y.forEach(l)}Co(d.schema)&&(p=void 0),Eo(d.schema)&&(g=void 0)}for(var N=0,L=n.syntaxErrors;N<L.length;N++){var C=L[N];if(C.code===Q.TrailingComma){if(typeof g!="number")continue;C.severity=g}l(C)}if(typeof p=="number"){var R=vc("InvalidCommentToken","Comments are not permitted in JSON.");n.comments.forEach(function(F){l($e.create(F,R,p,Q.CommentNotPermitted))})}return a};if(i){var c=i.id||"schemaservice://untitled/"+xc++,h=this.jsonSchemaService.registerExternalSchema(c,[],i);return h.getResolvedSchema().then(function(d){return u(d)})}return this.jsonSchemaService.getSchemaForResource(t.uri,n).then(function(d){return u(d)})},e.prototype.getLanguageStatus=function(t,n){return{schemas:this.jsonSchemaService.getSchemaURIsForResource(t.uri,n)}},e}(),xc=0;function Co(e){if(e&&typeof e=="object"){if(Ie(e.allowComments))return e.allowComments;if(e.allOf)for(var t=0,n=e.allOf;t<n.length;t++){var r=n[t],i=Co(r);if(Ie(i))return i}}}function Eo(e){if(e&&typeof e=="object"){if(Ie(e.allowTrailingCommas))return e.allowTrailingCommas;var t=e;if(Ie(t.allowsTrailingCommas))return t.allowsTrailingCommas;if(e.allOf)for(var n=0,r=e.allOf;n<r.length;n++){var i=r[n],s=Eo(i);if(Ie(s))return s}}}function Hn(e){switch(e){case"error":return Se.Error;case"warning":return Se.Warning;case"ignore":return}}var ko=48,_c=57,yc=65,Gn=97,wc=102;function re(e){return e<ko?0:e<=_c?e-ko:(e<Gn&&(e+=Gn-yc),e>=Gn&&e<=wc?e-Gn+10:0)}function Lc(e){if(e[0]==="#")switch(e.length){case 4:return{red:re(e.charCodeAt(1))*17/255,green:re(e.charCodeAt(2))*17/255,blue:re(e.charCodeAt(3))*17/255,alpha:1};case 5:return{red:re(e.charCodeAt(1))*17/255,green:re(e.charCodeAt(2))*17/255,blue:re(e.charCodeAt(3))*17/255,alpha:re(e.charCodeAt(4))*17/255};case 7:return{red:(re(e.charCodeAt(1))*16+re(e.charCodeAt(2)))/255,green:(re(e.charCodeAt(3))*16+re(e.charCodeAt(4)))/255,blue:(re(e.charCodeAt(5))*16+re(e.charCodeAt(6)))/255,alpha:1};case 9:return{red:(re(e.charCodeAt(1))*16+re(e.charCodeAt(2)))/255,green:(re(e.charCodeAt(3))*16+re(e.charCodeAt(4)))/255,blue:(re(e.charCodeAt(5))*16+re(e.charCodeAt(6)))/255,alpha:(re(e.charCodeAt(7))*16+re(e.charCodeAt(8)))/255}}}var Sc=function(){function e(t){this.schemaService=t}return e.prototype.findDocumentSymbols=function(t,n,r){var i=this;r===void 0&&(r={resultLimit:Number.MAX_VALUE});var s=n.root;if(!s)return[];var a=r.resultLimit||Number.MAX_VALUE,o=t.uri;if((o==="vscode://defaultsettings/keybindings.json"||sn(o.toLowerCase(),"/user/keybindings.json"))&&s.type==="array"){for(var l=[],u=0,c=s.items;u<c.length;u++){var h=c[u];if(h.type==="object")for(var d=0,g=h.properties;d<g.length;d++){var p=g[d];if(p.keyNode.value==="key"&&p.valueNode){var m=an.create(t.uri,st(t,h));if(l.push({name:ht(p.valueNode),kind:De.Function,location:m}),a--,a<=0)return r&&r.onResultLimitExceeded&&r.onResultLimitExceeded(o),l}}}return l
|
||
|
`};return Xu(o.getText(),c,g).map(function(p){return Te.replace(Y.create(o.positionAt(p.offset),o.positionAt(p.offset+p.length)),p.content)})}}}var Fo;typeof fetch<"u"&&(Fo=function(e){return fetch(e).then(t=>t.text())});var Uc=class{constructor(e,t){this._ctx=e,this._languageSettings=t.languageSettings,this._languageId=t.languageId,this._languageService=qc({workspaceContext:{resolveRelativePath:(n,r)=>{const i=r.substr(0,r.lastIndexOf("/")+1);return $c(i,n)}},schemaRequestService:t.enableSchemaRequest?Fo:void 0,clientCapabilities:ei.LATEST}),this._languageService.configure(this._languageSettings)}async doValidation(e){let t=this._getTextDocument(e);if(t){let n=this._languageService.parseJSONDocument(t);return this._languageService.doValidation(t,n,this._languageSettings)}return Promise.resolve([])}async doComplete(e,t){let n=this._getTextDocument(e);if(!n)return null;let r=this._languageService.parseJSONDocument(n);return this._languageService.doComplete(n,t,r)}async doResolve(e){return this._languageService.doResolve(e)}async doHover(e,t){let n=this._getTextDocument(e);if(!n)return null;let r=this._languageService.parseJSONDocument(n);return this._languageService.doHover(n,t,r)}async format(e,t,n){let r=this._getTextDocument(e);if(!r)return[];let i=this._languageService.format(r,t,n);return Promise.resolve(i)}async resetSchema(e){return Promise.resolve(this._languageService.resetSchema(e))}async findDocumentSymbols(e){let t=this._getTextDocument(e);if(!t)return[];let n=this._languageService.parseJSONDocument(t),r=this._languageService.findDocumentSymbols2(t,n);return Promise.resolve(r)}async findDocumentColors(e){let t=this._getTextDocument(e);if(!t)return[];let n=this._languageService.parseJSONDocument(t),r=this._languageService.findDocumentColors(t,n);return Promise.resolve(r)}async getColorPresentations(e,t,n){let r=this._getTextDocument(e);if(!r)return[];let i=this._languageService.parseJSONDocument(r),s=this._languageService.getColorPresentations(r,i,t,n);return Promise.resolve(s)}async getFoldingRanges(e,t){let n=this._getTextDocument(e);if(!n)return[];let r=this._languageService.getFoldingRanges(n,t);return Promise.resolve(r)}async getSelectionRanges(e,t){let n=this._getTextDocument(e);if(!n)return[];let r=this._languageService.parseJSONDocument(n),i=this._languageService.getSelectionRanges(n,t,r);return Promise.resolve(i)}async parseJSONDocument(e){let t=this._getTextDocument(e);if(!t)return null;let n=this._languageService.parseJSONDocument(t);return Promise.resolve(n)}async getMatchingSchemas(e){let t=this._getTextDocument(e);if(!t)return[];let n=this._languageService.parseJSONDocument(t);return Promise.resolve(this._languageService.getMatchingSchemas(t,n))}_getTextDocument(e){let t=this._ctx.getMirrorModels();for(let n of t)if(n.uri.toString()===e)return Zr.create(e,this._languageId,n.version,n.getValue());return null}},Wc=47,ci=46;function zc(e){return e.charCodeAt(0)===Wc}function $c(e,t){if(zc(t)){const n=Tt.parse(e),r=t.split("/");return n.with({path:Po(r)}).toString()}return Hc(e,t)}function Po(e){const t=[];for(const r of e)r.length===0||r.length===1&&r.charCodeAt(0)===ci||(r.length===2&&r.charCodeAt(0)===ci&&r.charCodeAt(1)===ci?t.pop():t.push(r));e.length>1&&e[e.length-1].length===0&&t.push("");let n=t.join("/");return e[0].length===0&&(n="/"+n),n}function Hc(e,...t){const n=Tt.parse(e),r=n.path.split("/");for(let i of t)r.push(...i.split("/"));return n.with({path:Po(r)}).toString()}self.onmessage=()=>{Ba((e,t)=>new Uc(e,t))}})();
|