zdravko/web/static/monaco/vs/language/json/jsonMode.js

16 lines
40 KiB
JavaScript
Raw Normal View History

/*!-----------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Version: 0.49.0(383fdf3fc0e1e1a024068b8d0fd4f3dcbae74d04)
* Released under the MIT license
* https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
*-----------------------------------------------------------------------------*/
define("vs/language/json/jsonMode", ["require","require"],(require)=>{
"use strict";var moduleExports=(()=>{var wn=Object.create;var ie=Object.defineProperty;var In=Object.getOwnPropertyDescriptor;var xn=Object.getOwnPropertyNames;var En=Object.getPrototypeOf,_n=Object.prototype.hasOwnProperty;var Sn=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof require<"u"?require:t)[i]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Pn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),An=(e,t)=>{for(var i in t)ie(e,i,{get:t[i],enumerable:!0})},te=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of xn(t))!_n.call(e,n)&&n!==i&&ie(e,n,{get:()=>t[n],enumerable:!(r=In(t,n))||r.enumerable});return e},_e=(e,t,i)=>(te(e,t,"default"),i&&te(i,t,"default")),Se=(e,t,i)=>(i=e!=null?wn(En(e)):{},te(t||!e||!e.__esModule?ie(i,"default",{value:e,enumerable:!0}):i,e)),Ln=e=>te(ie({},"__esModule",{value:!0}),e);var Ae=Pn((vr,Pe)=>{var On=Se(Sn("vs/editor/editor.api"));Pe.exports=On});var hr={};An(hr,{CompletionAdapter:()=>X,DefinitionAdapter:()=>Te,DiagnosticsAdapter:()=>q,DocumentColorAdapter:()=>Z,DocumentFormattingEditProvider:()=>G,DocumentHighlightAdapter:()=>ke,DocumentLinkAdapter:()=>we,DocumentRangeFormattingEditProvider:()=>Q,DocumentSymbolAdapter:()=>$,FoldingRangeAdapter:()=>ee,HoverAdapter:()=>Y,ReferenceAdapter:()=>be,RenameAdapter:()=>Ce,SelectionRangeAdapter:()=>ne,WorkerManager:()=>D,fromPosition:()=>L,fromRange:()=>Ie,getWorker:()=>dr,setupMode:()=>gr,toRange:()=>b,toTextEdit:()=>j});var c={};_e(c,Se(Ae()));var Wn=2*60*1e3,D=class{constructor(t){this._defaults=t,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){if(!this._worker)return;Date.now()-this._lastUsedTime>Wn&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=c.editor.createWebWorker({moduleId:"vs/language/json/jsonWorker",label:this._defaults.languageId,createData:{languageSettings:this._defaults.diagnosticsOptions,languageId:this._defaults.languageId,enableSchemaRequest:this._defaults.diagnosticsOptions.enableSchemaRequest}}),this._client=this._worker.getProxy()),this._client}getLanguageServiceWorker(...t){let i;return this._getClient().then(r=>{i=r}).then(r=>{if(this._worker)return this._worker.withSyncedResources(t)}).then(r=>i)}};var Le;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647})(Le||(Le={}));var oe;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647})(oe||(oe={}));var S;(function(e){function t(r,n){return r===Number.MAX_VALUE&&(r=oe.MAX_VALUE),n===Number.MAX_VALUE&&(n=oe.MAX_VALUE),{line:r,character:n}}e.create=t;function i(r){var n=r;return s.objectLiteral(n)&&s.uinteger(n.line)&&s.uinteger(n.character)}e.is=i})(S||(S={}));var y;(function(e){function t(r,n,a,o){if(s.uinteger(r)&&s.uinteger(n)&&s.uinteger(a)&&s.uinteger(o))return{start:S.create(r,n),end:S.create(a,o)};if(S.is(r)&&S.is(n))return{start:r,end:n};throw new Error("Range#create called with invalid arguments["+r+", "+n+", "+a+", "+o+"]")}e.create=t;function i(r){var n=r;return s.objectLiteral(n)&&S.is(n.start)&&S.is(n.end)}e.is=i})(y||(y={}));var pe;(function(e){function t(r,n){return{uri:r,range:n}}e.create=t;function i(r){var n=r;return s.defined(n)&&y.is(n.range)&&(s.string(n.uri)||s.undefined(n.uri))}e.is=i})(pe||(pe={}));var Oe;(function(e){function t(r,n,a,o){return{targetUri:r,targetRange:n,targetSelectionRange:a,originSelectionRange:o}}e.create=t;function i(r){var n=r;return s.defined(n)&&y.is(n.targetRange)&&s.string(n.targetUri)&&(y.is(n.targetSelectionRange)||s.undefined(n.targetSelectionRange))&&(y.is(n.originSelectionRange)||s.undefined(n.originSelectionRange))}e.is=i})(Oe||(Oe={}));var he;(funct
`,a==="\r"&&n+1<i.length&&i.charAt(n+1)===`
`&&n++}r&&i.length>0&&t.push(i.length),this._lineOffsets=t}return this._lineOffsets},e.prototype.positionAt=function(t){t=Math.max(Math.min(t,this._content.length),0);var i=this.getLineOffsets(),r=0,n=i.length;if(n===0)return S.create(0,t);for(;r<n;){var a=Math.floor((r+n)/2);i[a]>t?n=a:r=a+1}var o=r-1;return S.create(o,t-i[o])},e.prototype.offsetAt=function(t){var i=this.getLineOffsets();if(t.line>=i.length)return this._content.length;if(t.line<0)return 0;var r=i[t.line],n=t.line+1<i.length?i[t.line+1]:this._content.length;return Math.max(Math.min(r+t.character,n),r)},Object.defineProperty(e.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),e}(),s;(function(e){var t=Object.prototype.toString;function i(g){return typeof g<"u"}e.defined=i;function r(g){return typeof g>"u"}e.undefined=r;function n(g){return g===!0||g===!1}e.boolean=n;function a(g){return t.call(g)==="[object String]"}e.string=a;function o(g){return t.call(g)==="[object Number]"}e.number=o;function u(g,_,R){return t.call(g)==="[object Number]"&&_<=g&&g<=R}e.numberRange=u;function l(g){return t.call(g)==="[object Number]"&&-2147483648<=g&&g<=2147483647}e.integer=l;function h(g){return t.call(g)==="[object Number]"&&0<=g&&g<=2147483647}e.uinteger=h;function p(g){return t.call(g)==="[object Function]"}e.func=p;function f(g){return g!==null&&typeof g=="object"}e.objectLiteral=f;function C(g,_){return Array.isArray(g)&&g.every(_)}e.typedArray=C})(s||(s={}));var q=class{constructor(t,i,r){this._languageId=t;this._worker=i;this._disposables=[];this._listener=Object.create(null);let n=o=>{let u=o.getLanguageId();if(u!==this._languageId)return;let l;this._listener[o.uri.toString()]=o.onDidChangeContent(()=>{window.clearTimeout(l),l=window.setTimeout(()=>this._doValidate(o.uri,u),500)}),this._doValidate(o.uri,u)},a=o=>{c.editor.setModelMarkers(o,this._languageId,[]);let u=o.uri.toString(),l=this._listener[u];l&&(l.dispose(),delete this._listener[u])};this._disposables.push(c.editor.onDidCreateModel(n)),this._disposables.push(c.editor.onWillDisposeModel(a)),this._disposables.push(c.editor.onDidChangeModelLanguage(o=>{a(o.model),n(o.model)})),this._disposables.push(r(o=>{c.editor.getModels().forEach(u=>{u.getLanguageId()===this._languageId&&(a(u),n(u))})})),this._disposables.push({dispose:()=>{c.editor.getModels().forEach(a);for(let o in this._listener)this._listener[o].dispose()}}),c.editor.getModels().forEach(n)}dispose(){this._disposables.forEach(t=>t&&t.dispose()),this._disposables.length=0}_doValidate(t,i){this._worker(t).then(r=>r.doValidation(t.toString())).then(r=>{let n=r.map(o=>Mn(t,o)),a=c.editor.getModel(t);a&&a.getLanguageId()===i&&c.editor.setModelMarkers(a,i,n)}).then(void 0,r=>{console.error(r)})}};function Nn(e){switch(e){case O.Error:return c.MarkerSeverity.Error;case O.Warning:return c.MarkerSeverity.Warning;case O.Information:return c.MarkerSeverity.Info;case O.Hint:return c.MarkerSeverity.Hint;default:return c.MarkerSeverity.Info}}function Mn(e,t){let i=typeof t.code=="number"?String(t.code):t.code;return{severity:Nn(t.severity),startLineNumber:t.range.start.line+1,startColumn:t.range.start.character+1,endLineNumber:t.range.end.line+1,endColumn:t.range.end.character+1,message:t.message,code:i,source:t.source}}var X=class{constructor(t,i){this._worker=t;this._triggerCharacters=i}get triggerCharacters(){return this._triggerCharacters}provideCompletionItems(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.doComplete(a.toString(),L(i))).then(o=>{if(!o)return;let u=t.getWordUntilPosition(i),l=new c.Range(i.lineNumber,u.startColumn,i.lineNumber,u.endColumn),h=o.items.map(p=>{let f={label:p.label,insertText:p.insertText||p.label,sortText:p.sortText,filterText:p.filterText,documentation:p.documentation,detail:p.detail,command:Un(p.command),range:l,kind:jn(p.kind)};return p.textEdit&&(Fn(p.textEdit)?f.range={insert:b(p.textEdit.insert),replace:b(p.textEdit.replace)}:f.range=b(p.textEdit.range),f.insertText=p.textEdit.newText),p.additionalTextEdits&&(f.additionalTextEdits=p.additionalTextEdits.ma
`+e.value+"\n```\n"}}function Kn(e){if(e)return Array.isArray(e)?e.map(cn):[cn(e)]}var ke=class{constructor(t){this._worker=t}provideDocumentHighlights(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.findDocumentHighlights(n.toString(),L(i))).then(a=>{if(a)return a.map(o=>({range:b(o.range),kind:Hn(o.kind)}))})}};function Hn(e){switch(e){case F.Read:return c.languages.DocumentHighlightKind.Read;case F.Write:return c.languages.DocumentHighlightKind.Write;case F.Text:return c.languages.DocumentHighlightKind.Text}return c.languages.DocumentHighlightKind.Text}var Te=class{constructor(t){this._worker=t}provideDefinition(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.findDefinition(n.toString(),L(i))).then(a=>{if(a)return[ln(a)]})}};function ln(e){return{uri:c.Uri.parse(e.uri),range:b(e.range)}}var be=class{constructor(t){this._worker=t}provideReferences(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.findReferences(a.toString(),L(i))).then(o=>{if(o)return o.map(ln)})}},Ce=class{constructor(t){this._worker=t}provideRenameEdits(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.doRename(a.toString(),L(i),r)).then(o=>Jn(o))}};function Jn(e){if(!e||!e.changes)return;let t=[];for(let i in e.changes){let r=c.Uri.parse(i);for(let n of e.changes[i])t.push({resource:r,versionId:void 0,textEdit:{range:b(n.range),text:n.newText}})}return{edits:t}}var $=class{constructor(t){this._worker=t}provideDocumentSymbols(t,i){let r=t.uri;return this._worker(r).then(n=>n.findDocumentSymbols(r.toString())).then(n=>{if(n)return n.map(a=>Bn(a)?fn(a):{name:a.name,detail:"",containerName:a.containerName,kind:dn(a.kind),range:b(a.location.range),selectionRange:b(a.location.range),tags:[]})})}};function Bn(e){return"children"in e}function fn(e){return{name:e.name,detail:e.detail??"",kind:dn(e.kind),range:b(e.range),selectionRange:b(e.selectionRange),tags:e.tags??[],children:(e.children??[]).map(t=>fn(t))}}function dn(e){let t=c.languages.SymbolKind;switch(e){case v.File:return t.File;case v.Module:return t.Module;case v.Namespace:return t.Namespace;case v.Package:return t.Package;case v.Class:return t.Class;case v.Method:return t.Method;case v.Property:return t.Property;case v.Field:return t.Field;case v.Constructor:return t.Constructor;case v.Enum:return t.Enum;case v.Interface:return t.Interface;case v.Function:return t.Function;case v.Variable:return t.Variable;case v.Constant:return t.Constant;case v.String:return t.String;case v.Number:return t.Number;case v.Boolean:return t.Boolean;case v.Array:return t.Array}return t.Function}var we=class{constructor(t){this._worker=t}provideLinks(t,i){let r=t.uri;return this._worker(r).then(n=>n.findDocumentLinks(r.toString())).then(n=>{if(n)return{links:n.map(a=>({range:b(a.range),url:a.target}))}})}},G=class{constructor(t){this._worker=t}provideDocumentFormattingEdits(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.format(n.toString(),null,gn(i)).then(o=>{if(!(!o||o.length===0))return o.map(j)}))}},Q=class{constructor(t){this._worker=t;this.canFormatMultipleRanges=!1}provideDocumentRangeFormattingEdits(t,i,r,n){let a=t.uri;return this._worker(a).then(o=>o.format(a.toString(),Ie(i),gn(r)).then(u=>{if(!(!u||u.length===0))return u.map(j)}))}};function gn(e){return{tabSize:e.tabSize,insertSpaces:e.insertSpaces}}var Z=class{constructor(t){this._worker=t}provideDocumentColors(t,i){let r=t.uri;return this._worker(r).then(n=>n.findDocumentColors(r.toString())).then(n=>{if(n)return n.map(a=>({color:a.color,range:b(a.range)}))})}provideColorPresentations(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.getColorPresentations(n.toString(),i.color,Ie(i.range))).then(a=>{if(a)return a.map(o=>{let u={label:o.label};return o.textEdit&&(u.textEdit=j(o.textEdit)),o.additionalTextEdits&&(u.additionalTextEdits=o.additionalTextEdits.map(j)),u})})}},ee=class{constructor(t){this._worker=t}provideFoldingRanges(t,i,r){let n=t.uri;return this._worker(n).then(a=>a.getFoldingRanges(n.toString(),i)).then(a=>{if(a)return a.map(o=>{let u={start:o.startLine+1,end:o.endLine+1};return typeof o.kind<"u"&&(u.kind=zn(o.kin
`;break;case 114:d+="\r";break;case 116:d+=" ";break;case 117:var k=C(4,!0);k>=0?d+=String.fromCharCode(k):f=4;break;default:f=5}w=r;continue}if(E>=0&&E<=31)if(re(E)){d+=e.substring(w,r),f=2;break}else f=6;r++}return d}function V(){if(n="",f=0,a=r,l=u,p=h,r>=i)return a=i,o=17;var d=e.charCodeAt(r);if(xe(d)){do r++,n+=String.fromCharCode(d),d=e.charCodeAt(r);while(xe(d));return o=15}if(re(d))return r++,n+=String.fromCharCode(d),d===13&&e.charCodeAt(r)===10&&(r++,n+=`
`),u++,h=r,o=14;switch(d){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,n=R(),o=10;case 47:var w=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<i&&!re(e.charCodeAt(r));)r++;return n=e.substring(w,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;for(var E=i-1,I=!1;r<E;){var k=e.charCodeAt(r);if(k===42&&e.charCodeAt(r+1)===47){r+=2,I=!0;break}r++,re(k)&&(k===13&&e.charCodeAt(r)===10&&r++,u++,h=r)}return I||(r++,f=1),n=e.substring(w,r),o=13}return n+=String.fromCharCode(d),r++,o=16;case 45:if(n+=String.fromCharCode(d),r++,r===i||!U(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return n+=_(),o=11;default:for(;r<i&&bn(d);)r++,d=e.charCodeAt(r);if(a!==r){switch(n=e.substring(a,r),n){case"true":return o=8;case"false":return o=9;case"null":return o=7}return o=16}return n+=String.fromCharCode(d),r++,o=16}}function bn(d){if(xe(d)||re(d))return!1;switch(d){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function Cn(){var d;do d=V();while(d>=12&&d<=15);return d}return{setPosition:g,getPosition:function(){return r},scan:t?Cn:V,getToken:function(){return o},getTokenValue:function(){return n},getTokenOffset:function(){return a},getTokenLength:function(){return r-a},getTokenStartLine:function(){return l},getTokenStartCharacter:function(){return a-p},getTokenError:function(){return f}}}function xe(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 re(e){return e===10||e===13||e===8232||e===8233}function U(e){return e>=48&&e<=57}var pn;(function(e){e.DEFAULT={allowTrailingComma:!1}})(pn||(pn={}));var hn=de;function yn(e){return{getInitialState:()=>new ge(null,null,!1,null),tokenize:(t,i)=>fr(e,t,i)}}var mn="delimiter.bracket.json",vn="delimiter.array.json",rr="delimiter.colon.json",tr="delimiter.comma.json",ir="keyword.json",ar="keyword.json",or="string.value.json",sr="number.json",ur="string.key.json",cr="comment.block.json",lr="comment.line.json";var W=class e{constructor(t,i){this.parent=t;this.type=i}static pop(t){return t?t.parent:null}static push(t,i){return new e(t,i)}static equals(t,i){if(!t&&!i)return!0;if(!t||!i)return!1;for(;t&&i;){if(t===i)return!0;if(t.type!==i.type)return!1;t=t.parent,i=i.parent}return!0}},ge=class e{constructor(t,i,r,n){this._state=t,this.scanError=i,this.lastWasColon=r,this.parents=n}clone(){return new e(this._state,this.scanError,this.lastWasColon,this.parents)}equals(t){return t===this?!0:!t||!(t instanceof e)?!1:this.scanError===t.scanError&&this.lastWasColon===t.lastWasColon&&W.equals(this.parents,t.parents)}getStateData(){return this._state}setStateData(t){this._state=t}};function fr(e,t,i,r=0){let n=0,a=!1;switch(i.scanError){case 2:t='"'+t,n=1;break;case 1:t="/*"+t,n=2;break}let o=hn(t),u=i.lastWasColon,l=i.parents,h={tokens:[],endState:i.clone()};for(;;){let p=r+o.getPosition(),f="",C=o.scan();if(C===17)break;if(p===r+o.getPosition())throw new Error("Scanner did not advance, next 3 characters are: "+t.substr(o.getPosition(),3));switch(a&&(p-=n),a=n>0,C){case 1:l=W.push(l,0),f=mn,u=!1;break;case 2:l=W.pop(l),f=mn,u=!1;break;case 3:l=W.push(l,1),f=vn,u=!1;break;case 4:l=W.pop(l),f=vn,u=!1;break;case 6:f=rr,u=!0;break;case 5:f=tr,u=!1;break;case 8:case 9:f=ir,u=!1;break;case 7:f=ar,u=!1;break;case 10:let _=(l?l.type:0)===1;f=u||_?or:ur,u=!1;break;case 11:f=sr,u=!1;break}if(e)switch(C){case 12:f=lr;break;case 13:f=cr;break}h.endState=new ge(i.getStateData(),o.getTokenError(),u,l),h.tokens.push({startIndex:p,scopes:f})}return h}var x;function dr(){return new Promise((e,t)=>{if(!x)return t("JSON not registered!");e(x)})}var Ee=class extends q{constructor(t,i,r){super(t,i,r.onDidChange),this._disposables.push(c.editor.onWillDisposeModel(n=>{this._resetSchema(n.uri)})),this._disposables.push(c.editor.onDidChangeModelLanguage(n=>{this._resetSchema(n.model.uri)}))}_resetSchema(t){this._worker().then(i=>{i.resetSchema(t.toString())})}};fu
return moduleExports;
});