/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * monaco-html version: 0.30.1(5a7ba61be909ae9e4889768a3453ebb0dec392e2) * Released under the MIT license * https://github.com/Microsoft/monaco-html/blob/master/LICENSE.md *-----------------------------------------------------------------------------*/ define("vs/language/html/workerManager",["require","exports","./fillers/monaco-editor-core"],(function(e,n,t){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.WorkerManager=void 0;var i=function(){function e(e){var n=this;this._defaults=e,this._worker=null,this._idleCheckInterval=window.setInterval((function(){return n._checkIfIdle()}),3e4),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange((function(){return n._stopWorker()}))}return e.prototype._stopWorker=function(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null},e.prototype.dispose=function(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()},e.prototype._checkIfIdle=function(){this._worker&&(Date.now()-this._lastUsedTime>12e4&&this._stopWorker())},e.prototype._getClient=function(){return this._lastUsedTime=Date.now(),this._client||(this._worker=t.editor.createWebWorker({moduleId:"vs/language/html/htmlWorker",createData:{languageSettings:this._defaults.options,languageId:this._defaults.languageId},label:this._defaults.languageId}),this._client=this._worker.getProxy()),this._client},e.prototype.getLanguageServiceWorker=function(){for(var e,n=this,t=[],i=0;i0&&(r.arguments=t),r},e.is=function(e){var n=e;return A.defined(n)&&A.string(n.title)&&A.string(n.command)}}(c=n.Command||(n.Command={})),function(e){e.replace=function(e,n){return{range:e,newText:n}},e.insert=function(e,n){return{range:{start:e,end:e},newText:n}},e.del=function(e){return{range:e,newText:""}},e.is=function(e){var n=e;return A.objectLiteral(n)&&A.string(n.newText)&&r.is(n.range)}}(d=n.TextEdit||(n.TextEdit={})),function(e){e.create=function(e,n,t){var i={label:e};return void 0!==n&&(i.needsConfirmation=n),void 0!==t&&(i.description=t),i},e.is=function(e){var n=e;return void 0!==n&&A.objectLiteral(n)&&A.string(n.label)&&(A.boolean(n.needsConfirmation)||void 0===n.needsConfirmation)&&(A.string(n.description)||void 0===n.description)}}(g=n.ChangeAnnotation||(n.ChangeAnnotation={})),function(e){e.is=function(e){return"string"==typeof e}}(l=n.ChangeAnnotationIdentifier||(n.ChangeAnnotationIdentifier={})),function(e){e.replace=function(e,n,t){return{range:e,newText:n,annotationId:t}},e.insert=function(e,n,t){return{range:{start:e,end:e},newText:n,annotationId:t}},e.del=function(e,n){return{range:e,newText:"",annotationId:n}},e.is=function(e){var n=e;return d.is(n)&&(g.is(n.annotationId)||l.is(n.annotationId))}}(f=n.AnnotatedTextEdit||(n.AnnotatedTextEdit={})),function(e){e.create=function(e,n){return{textDocument:e,edits:n}},e.is=function(e){var n=e;return A.defined(n)&&C.is(n.textDocument)&&Array.isArray(n.edits)}}(m=n.TextDocumentEdit||(n.TextDocumentEdit={})),function(e){e.create=function(e,n,t){var i={kind:"create",uri:e};return void 0===n||void 0===n.overwrite&&void 0===n.ignoreIfExists||(i.options=n),void 0!==t&&(i.annotationId=t),i},e.is=function(e){var n=e;return n&&"create"===n.kind&&A.string(n.uri)&&(void 0===n.options||(void 0===n.options.overwrite||A.boolean(n.options.overwrite))&&(void 0===n.options.ignoreIfExists||A.boolean(n.options.ignoreIfExists)))&&(void 0===n.annotationId||l.is(n.annotationId))}}(h=n.CreateFile||(n.CreateFile={})),function(e){e.create=function(e,n,t,i){var r={kind:"rename",oldUri:e,newUri:n};return void 0===t||void 0===t.overwrite&&void 0===t.ignoreIfExists||(r.options=t),void 0!==i&&(r.annotationId=i),r},e.is=function(e){var n=e;return n&&"rename"===n.kind&&A.string(n.oldUri)&&A.string(n.newUri)&&(void 0===n.options||(void 0===n.options.overwrite||A.boolean(n.options.overwrite))&&(void 0===n.options.ignoreIfExists||A.boolean(n.options.ignoreIfExists)))&&(void 0===n.annotationId||l.is(n.annotationId))}}(p=n.RenameFile||(n.RenameFile={})),function(e){e.create=function(e,n,t){var i={kind:"delete",uri:e};return void 0===n||void 0===n.recursive&&void 0===n.ignoreIfNotExists||(i.options=n),void 0!==t&&(i.annotationId=t),i},e.is=function(e){var n=e;return n&&"delete"===n.kind&&A.string(n.uri)&&(void 0===n.options||(void 0===n.options.recursive||A.boolean(n.options.recursive))&&(void 0===n.options.ignoreIfNotExists||A.boolean(n.options.ignoreIfNotExists)))&&(void 0===n.annotationId||l.is(n.annotationId))}}(v=n.DeleteFile||(n.DeleteFile={})),function(e){e.is=function(e){var n=e;return n&&(void 0!==n.changes||void 0!==n.documentChanges)&&(void 0===n.documentChanges||n.documentChanges.every((function(e){return A.string(e.kind)?h.is(e)||p.is(e)||v.is(e):m.is(e)})))}}(y=n.WorkspaceEdit||(n.WorkspaceEdit={}));var C,b,k,I,w=function(){function e(e,n){this.edits=e,this.changeAnnotations=n}return e.prototype.insert=function(e,n,t){var i,r;if(void 0===t?i=d.insert(e,n):l.is(t)?(r=t,i=f.insert(e,n,t)):(this.assertChangeAnnotations(this.changeAnnotations),r=this.changeAnnotations.manage(t),i=f.insert(e,n,r)),this.edits.push(i),void 0!==r)return r},e.prototype.replace=function(e,n,t){var i,r;if(void 0===t?i=d.replace(e,n):l.is(t)?(r=t,i=f.replace(e,n,t)):(this.assertChangeAnnotations(this.changeAnnotations),r=this.changeAnnotations.manage(t),i=f.replace(e,n,r)),this.edits.push(i),void 0!==r)return r},e.prototype.delete=function(e,n){var t,i;if(void 0===n?t=d.del(e):l.is(n)?(i=n,t=f.del(e,n)):(this.assertChangeAnnotations(this.changeAnnotations),i=this.changeAnnotations.manage(n),t=f.del(e,i)),this.edits.push(t),void 0!==i)return i},e.prototype.add=function(e){this.edits.push(e)},e.prototype.all=function(){return this.edits},e.prototype.clear=function(){this.edits.splice(0,this.edits.length)},e.prototype.assertChangeAnnotations=function(e){if(void 0===e)throw new Error("Text edit change is not configured to manage change annotations.")},e}(),_=function(){function e(e){this._annotations=void 0===e?Object.create(null):e,this._counter=0,this._size=0}return e.prototype.all=function(){return this._annotations},Object.defineProperty(e.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.manage=function(e,n){var t;if(l.is(e)?t=e:(t=this.nextId(),n=e),void 0!==this._annotations[t])throw new Error("Id "+t+" is already in use.");if(void 0===n)throw new Error("No annotation provided for id "+t);return this._annotations[t]=n,this._size++,t},e.prototype.nextId=function(){return this._counter++,this._counter.toString()},e}(),x=function(){function e(e){var n=this;this._textEditChanges=Object.create(null),void 0!==e?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new _(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach((function(e){if(m.is(e)){var t=new w(e.edits,n._changeAnnotations);n._textEditChanges[e.textDocument.uri]=t}}))):e.changes&&Object.keys(e.changes).forEach((function(t){var i=new w(e.changes[t]);n._textEditChanges[t]=i}))):this._workspaceEdit={}}return Object.defineProperty(e.prototype,"edit",{get:function(){return this.initDocumentChanges(),void 0!==this._changeAnnotations&&(0===this._changeAnnotations.size?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),e.prototype.getTextEditChange=function(e){if(C.is(e)){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var n={uri:e.uri,version:e.version};if(!(i=this._textEditChanges[n.uri])){var t={textDocument:n,edits:r=[]};this._workspaceEdit.documentChanges.push(t),i=new w(r,this._changeAnnotations),this._textEditChanges[n.uri]=i}return i}if(this.initChanges(),void 0===this._workspaceEdit.changes)throw new Error("Workspace edit is not configured for normal text edit changes.");var i;if(!(i=this._textEditChanges[e])){var r=[];this._workspaceEdit.changes[e]=r,i=new w(r),this._textEditChanges[e]=i}return i},e.prototype.initDocumentChanges=function(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._changeAnnotations=new _,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},e.prototype.initChanges=function(){void 0===this._workspaceEdit.documentChanges&&void 0===this._workspaceEdit.changes&&(this._workspaceEdit.changes=Object.create(null))},e.prototype.createFile=function(e,n,t){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var i,r,o;if(g.is(n)||l.is(n)?i=n:t=n,void 0===i?r=h.create(e,t):(o=l.is(i)?i:this._changeAnnotations.manage(i),r=h.create(e,t,o)),this._workspaceEdit.documentChanges.push(r),void 0!==o)return o},e.prototype.renameFile=function(e,n,t,i){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var r,o,a;if(g.is(t)||l.is(t)?r=t:i=t,void 0===r?o=p.create(e,n,i):(a=l.is(r)?r:this._changeAnnotations.manage(r),o=p.create(e,n,i,a)),this._workspaceEdit.documentChanges.push(o),void 0!==a)return a},e.prototype.deleteFile=function(e,n,t){if(this.initDocumentChanges(),void 0===this._workspaceEdit.documentChanges)throw new Error("Workspace edit is not configured for document changes.");var i,r,o;if(g.is(n)||l.is(n)?i=n:t=n,void 0===i?r=v.create(e,t):(o=l.is(i)?i:this._changeAnnotations.manage(i),r=v.create(e,t,o)),this._workspaceEdit.documentChanges.push(r),void 0!==o)return o},e}();n.WorkspaceChange=x,function(e){e.create=function(e){return{uri:e}},e.is=function(e){var n=e;return A.defined(n)&&A.string(n.uri)}}(n.TextDocumentIdentifier||(n.TextDocumentIdentifier={})),function(e){e.create=function(e,n){return{uri:e,version:n}},e.is=function(e){var n=e;return A.defined(n)&&A.string(n.uri)&&A.integer(n.version)}}(n.VersionedTextDocumentIdentifier||(n.VersionedTextDocumentIdentifier={})),function(e){e.create=function(e,n){return{uri:e,version:n}},e.is=function(e){var n=e;return A.defined(n)&&A.string(n.uri)&&(null===n.version||A.integer(n.version))}}(C=n.OptionalVersionedTextDocumentIdentifier||(n.OptionalVersionedTextDocumentIdentifier={})),function(e){e.create=function(e,n,t,i){return{uri:e,languageId:n,version:t,text:i}},e.is=function(e){var n=e;return A.defined(n)&&A.string(n.uri)&&A.string(n.languageId)&&A.integer(n.version)&&A.string(n.text)}}(n.TextDocumentItem||(n.TextDocumentItem={})),function(e){e.PlainText="plaintext",e.Markdown="markdown"}(b=n.MarkupKind||(n.MarkupKind={})),function(e){e.is=function(n){var t=n;return t===e.PlainText||t===e.Markdown}}(b=n.MarkupKind||(n.MarkupKind={})),function(e){e.is=function(e){var n=e;return A.objectLiteral(e)&&b.is(n.kind)&&A.string(n.value)}}(k=n.MarkupContent||(n.MarkupContent={})),function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25}(n.CompletionItemKind||(n.CompletionItemKind={})),function(e){e.PlainText=1,e.Snippet=2}(n.InsertTextFormat||(n.InsertTextFormat={})),function(e){e.Deprecated=1}(n.CompletionItemTag||(n.CompletionItemTag={})),function(e){e.create=function(e,n,t){return{newText:e,insert:n,replace:t}},e.is=function(e){var n=e;return n&&A.string(n.newText)&&r.is(n.insert)&&r.is(n.replace)}}(n.InsertReplaceEdit||(n.InsertReplaceEdit={})),function(e){e.asIs=1,e.adjustIndentation=2}(n.InsertTextMode||(n.InsertTextMode={})),function(e){e.create=function(e){return{label:e}}}(n.CompletionItem||(n.CompletionItem={})),function(e){e.create=function(e,n){return{items:e||[],isIncomplete:!!n}}}(n.CompletionList||(n.CompletionList={})),function(e){e.fromPlainText=function(e){return e.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")},e.is=function(e){var n=e;return A.string(n)||A.objectLiteral(n)&&A.string(n.language)&&A.string(n.value)}}(I=n.MarkedString||(n.MarkedString={})),function(e){e.is=function(e){var n=e;return!!n&&A.objectLiteral(n)&&(k.is(n.contents)||I.is(n.contents)||A.typedArray(n.contents,I.is))&&(void 0===e.range||r.is(e.range))}}(n.Hover||(n.Hover={})),function(e){e.create=function(e,n){return n?{label:e,documentation:n}:{label:e}}}(n.ParameterInformation||(n.ParameterInformation={})),function(e){e.create=function(e,n){for(var t=[],i=2;i=0;a--){var u=r[a],s=e.offsetAt(u.range.start),c=e.offsetAt(u.range.end);if(!(c<=o))throw new Error("Overlapping edit");i=i.substring(0,s)+u.newText+i.substring(c,i.length),o=s}return i}}(n.TextDocument||(n.TextDocument={}));var A,E=function(){function e(e,n,t,i){this._uri=e,this._languageId=n,this._version=t,this._content=i,this._lineOffsets=void 0}return Object.defineProperty(e.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),e.prototype.getText=function(e){if(e){var n=this.offsetAt(e.start),t=this.offsetAt(e.end);return this._content.substring(n,t)}return this._content},e.prototype.update=function(e,n){this._content=e.text,this._version=n,this._lineOffsets=void 0},e.prototype.getLineOffsets=function(){if(void 0===this._lineOffsets){for(var e=[],n=this._content,t=!0,i=0;i0&&e.push(n.length),this._lineOffsets=e}return this._lineOffsets},e.prototype.positionAt=function(e){e=Math.max(Math.min(e,this._content.length),0);var n=this.getLineOffsets(),t=0,r=n.length;if(0===r)return i.create(0,e);for(;te?r=o:t=o+1}var a=t-1;return i.create(a,e-n[a])},e.prototype.offsetAt=function(e){var n=this.getLineOffsets();if(e.line>=n.length)return this._content.length;if(e.line<0)return 0;var t=n[e.line],i=e.line+1