gitea_hat/public/js/monaco-language-htmlmode.9c...

5 lines
34 KiB
JavaScript
Raw Permalink Normal View History

"use strict";var Et=Object.defineProperty;var bt=(P,k,b)=>k in P?Et(P,k,{enumerable:!0,configurable:!0,writable:!0,value:b}):P[k]=b;var C=(P,k,b)=>(bt(P,typeof k!="symbol"?k+"":k,b),b);(self.webpackChunkgitea=self.webpackChunkgitea||[]).push([["vendors-node_modules_monaco-editor_esm_vs_language_html_htmlMode_js"],{"./node_modules/monaco-editor/esm/vs/language/html/htmlMode.js":function(P,k,b){b.r(k),b.d(k,{CompletionAdapter:function(){return Ve},DefinitionAdapter:function(){return lt},DiagnosticsAdapter:function(){return it},DocumentColorAdapter:function(){return mt},DocumentFormattingEditProvider:function(){return oe},DocumentHighlightAdapter:function(){return re},DocumentLinkAdapter:function(){return ae},DocumentRangeFormattingEditProvider:function(){return se},DocumentSymbolAdapter:function(){return ie},FoldingRangeAdapter:function(){return ue},HoverAdapter:function(){return te},ReferenceAdapter:function(){return ht},RenameAdapter:function(){return ne},SelectionRangeAdapter:function(){return ce},WorkerManager:function(){return Q},fromPosition:function(){return I},fromRange:function(){return ee},setupMode:function(){return kt},setupMode1:function(){return wt},toRange:function(){return _},toTextEdit:function(){return M}});var Ye=b("include-loader!./node_modules/monaco-editor/esm/vs/editor/editor.api.js");var Ze=Object.defineProperty,qe=Object.getOwnPropertyDescriptor,Ke=Object.getOwnPropertyNames,et=Object.prototype.hasOwnProperty,de=(e,n,i,r)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Ke(n))!et.call(e,t)&&t!==i&&Ze(e,t,{get:()=>n[t],enumerable:!(r=qe(n,t))||r.enumerable});return e},tt=(e,n,i)=>(de(e,n,"default"),i&&de(i,n,"default")),c={};tt(c,Ye);var rt=2*60*1e3,Q=class{constructor(e){C(this,"_defaults");C(this,"_idleCheckInterval");C(this,"_lastUsedTime");C(this,"_configChangeListener");C(this,"_worker");C(this,"_client");this._defaults=e,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>rt&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=c.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}getLanguageServiceWorker(...e){let n;return this._getClient().then(i=>{n=i}).then(i=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(i=>n)}},fe;(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647})(fe||(fe={}));var O;(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647})(O||(O={}));var E;(function(e){function n(r,t){return r===Number.MAX_VALUE&&(r=O.MAX_VALUE),t===Number.MAX_VALUE&&(t=O.MAX_VALUE),{line:r,character:t}}e.create=n;function i(r){var t=r;return s.objectLiteral(t)&&s.uinteger(t.line)&&s.uinteger(t.character)}e.is=i})(E||(E={}));var p;(function(e){function n(r,t,a,o){if(s.uinteger(r)&&s.uinteger(t)&&s.uinteger(a)&&s.uinteger(o))return{start:E.create(r,t),end:E.create(a,o)};if(E.is(r)&&E.is(t))return{start:r,end:t};throw new Error("Range#create called with invalid arguments["+r+", "+t+", "+a+", "+o+"]")}e.create=n;function i(r){var t=r;return s.objectLiteral(t)&&E.is(t.start)&&E.is(t.end)}e.is=i})(p||(p={}));var G;(function(e){function n(r,t){return{uri:r,range:t}}e.create=n;function i(r){var t=r;return s.defined(t)&&p.is(t.range)&&(s.string(t.uri)||s.undefined(t.uri))}e.is=i})(G||(G={}));var ge;(function(e){function n(r,t,a,o){return{targetUri:r,targetRange:t,targetSelectionRange:a,originSelectionRange:o}}e.create=n;function i(r){var t=r;return s.defined(t)&&p.is(t.targetRange)&&s.string(t.targetUri)&&(p.is(t.targetSelectionRange)
`,a==="\r"&&t+1<i.length&&i.charAt(t+1)===`
`&&t++}r&&i.length>0&&n.push(i.length),this._lineOffsets=n}return this._lineOffsets},e.prototype.positionAt=function(n){n=Math.max(Math.min(n,this._content.length),0);var i=this.getLineOffsets(),r=0,t=i.length;if(t===0)return E.create(0,n);for(;r<t;){var a=Math.floor((r+t)/2);i[a]>n?t=a:r=a+1}var o=r-1;return E.create(o,n-i[o])},e.prototype.offsetAt=function(n){var i=this.getLineOffsets();if(n.line>=i.length)return this._content.length;if(n.line<0)return 0;var r=i[n.line],t=n.line+1<i.length?i[n.line+1]:this._content.length;return Math.max(Math.min(r+n.character,t),r)},Object.defineProperty(e.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),e}(),s;(function(e){var n=Object.prototype.toString;function i(f){return typeof f!="undefined"}e.defined=i;function r(f){return typeof f=="undefined"}e.undefined=r;function t(f){return f===!0||f===!1}e.boolean=t;function a(f){return n.call(f)==="[object String]"}e.string=a;function o(f){return n.call(f)==="[object Number]"}e.number=o;function u(f,S,$){return n.call(f)==="[object Number]"&&S<=f&&f<=$}e.numberRange=u;function g(f){return n.call(f)==="[object Number]"&&-2147483648<=f&&f<=2147483647}e.integer=g;function d(f){return n.call(f)==="[object Number]"&&0<=f&&f<=2147483647}e.uinteger=d;function v(f){return n.call(f)==="[object Function]"}e.func=v;function w(f){return f!==null&&typeof f=="object"}e.objectLiteral=w;function A(f,S){return Array.isArray(f)&&f.every(S)}e.typedArray=A})(s||(s={}));var it=class{constructor(e,n,i){C(this,"_disposables",[]);C(this,"_listener",Object.create(null));this._languageId=e,this._worker=n;const r=a=>{let o=a.getLanguageId();if(o!==this._languageId)return;let u;this._listener[a.uri.toString()]=a.onDidChangeContent(()=>{window.clearTimeout(u),u=window.setTimeout(()=>this._doValidate(a.uri,o),500)}),this._doValidate(a.uri,o)},t=a=>{c.editor.setModelMarkers(a,this._languageId,[]);let o=a.uri.toString(),u=this._listener[o];u&&(u.dispose(),delete this._listener[o])};this._disposables.push(c.editor.onDidCreateModel(r)),this._disposables.push(c.editor.onWillDisposeModel(t)),this._disposables.push(c.editor.onDidChangeModelLanguage(a=>{t(a.model),r(a.model)})),this._disposables.push(i(a=>{c.editor.getModels().forEach(o=>{o.getLanguageId()===this._languageId&&(t(o),r(o))})})),this._disposables.push({dispose:()=>{c.editor.getModels().forEach(t);for(let a in this._listener)this._listener[a].dispose()}}),c.editor.getModels().forEach(r)}dispose(){this._disposables.forEach(e=>e&&e.dispose()),this._disposables.length=0}_doValidate(e,n){this._worker(e).then(i=>i.doValidation(e.toString())).then(i=>{const r=i.map(a=>ot(e,a));let t=c.editor.getModel(e);t&&t.getLanguageId()===n&&c.editor.setModelMarkers(t,n,r)}).then(void 0,i=>{console.error(i)})}};function at(e){switch(e){case R.Error:return c.MarkerSeverity.Error;case R.Warning:return c.MarkerSeverity.Warning;case R.Information:return c.MarkerSeverity.Info;case R.Hint:return c.MarkerSeverity.Hint;default:return c.MarkerSeverity.Info}}function ot(e,n){let i=typeof n.code=="number"?String(n.code):n.code;return{severity:at(n.severity),startLineNumber:n.range.start.line+1,startColumn:n.range.start.character+1,endLineNumber:n.range.end.line+1,endColumn:n.range.end.character+1,message:n.message,code:i,source:n.source}}var Ve=class{constructor(e,n){this._worker=e,this._triggerCharacters=n}get triggerCharacters(){return this._triggerCharacters}provideCompletionItems(e,n,i,r){const t=e.uri;return this._worker(t).then(a=>a.doComplete(t.toString(),I(n))).then(a=>{if(!a)return;const o=e.getWordUntilPosition(n),u=new c.Range(n.lineNumber,o.startColumn,n.lineNumber,o.endColumn),g=a.items.map(d=>{const v={label:d.label,insertText:d.insertText||d.label,sortText:d.sortText,filterText:d.filterText,documentation:d.documentation,detail:d.detail,command:ct(d.command),range:u,kind:ut(d.kind)};return d.textEdit&&(st(d.textEdit)?v.range={insert:_(d.textEdit.insert),replace:_(d.textEdit.replace)}:v.range=_(d.textEdit.range),v.insertText=d.textEdit.newText),d.additionalTextEdits&&(v.
`+e.value+"\n```\n"}}function ft(e){if(!!e)return Array.isArray(e)?e.map(ze):[ze(e)]}var re=class{constructor(e){this._worker=e}provideDocumentHighlights(e,n,i){const r=e.uri;return this._worker(r).then(t=>t.findDocumentHighlights(r.toString(),I(n))).then(t=>{if(!!t)return t.map(a=>({range:_(a.range),kind:gt(a.kind)}))})}};function gt(e){switch(e){case H.Read:return c.languages.DocumentHighlightKind.Read;case H.Write:return c.languages.DocumentHighlightKind.Write;case H.Text:return c.languages.DocumentHighlightKind.Text}return c.languages.DocumentHighlightKind.Text}var lt=class{constructor(e){this._worker=e}provideDefinition(e,n,i){const r=e.uri;return this._worker(r).then(t=>t.findDefinition(r.toString(),I(n))).then(t=>{if(!!t)return[Xe(t)]})}};function Xe(e){return{uri:c.Uri.parse(e.uri),range:_(e.range)}}var ht=class{constructor(e){this._worker=e}provideReferences(e,n,i,r){const t=e.uri;return this._worker(t).then(a=>a.findReferences(t.toString(),I(n))).then(a=>{if(!!a)return a.map(Xe)})}},ne=class{constructor(e){this._worker=e}provideRenameEdits(e,n,i,r){const t=e.uri;return this._worker(t).then(a=>a.doRename(t.toString(),I(n),i)).then(a=>vt(a))}};function vt(e){if(!e||!e.changes)return;let n=[];for(let i in e.changes){const r=c.Uri.parse(i);for(let t of e.changes[i])n.push({resource:r,versionId:void 0,textEdit:{range:_(t.range),text:t.newText}})}return{edits:n}}var ie=class{constructor(e){this._worker=e}provideDocumentSymbols(e,n){const i=e.uri;return this._worker(i).then(r=>r.findDocumentSymbols(i.toString())).then(r=>{if(!!r)return r.map(t=>({name:t.name,detail:"",containerName:t.containerName,kind:pt(t.kind),range:_(t.location.range),selectionRange:_(t.location.range),tags:[]}))})}};function pt(e){let n=c.languages.SymbolKind;switch(e){case h.File:return n.Array;case h.Module:return n.Module;case h.Namespace:return n.Namespace;case h.Package:return n.Package;case h.Class:return n.Class;case h.Method:return n.Method;case h.Property:return n.Property;case h.Field:return n.Field;case h.Constructor:return n.Constructor;case h.Enum:return n.Enum;case h.Interface:return n.Interface;case h.Function:return n.Function;case h.Variable:return n.Variable;case h.Constant:return n.Constant;case h.String:return n.String;case h.Number:return n.Number;case h.Boolean:return n.Boolean;case h.Array:return n.Array}return n.Function}var ae=class{constructor(e){this._worker=e}provideLinks(e,n){const i=e.uri;return this._worker(i).then(r=>r.findDocumentLinks(i.toString())).then(r=>{if(!!r)return{links:r.map(t=>({range:_(t.range),url:t.target}))}})}},oe=class{constructor(e){this._worker=e}provideDocumentFormattingEdits(e,n,i){const r=e.uri;return this._worker(r).then(t=>t.format(r.toString(),null,Be(n)).then(a=>{if(!(!a||a.length===0))return a.map(M)}))}},se=class{constructor(e){this._worker=e}provideDocumentRangeFormattingEdits(e,n,i,r){const t=e.uri;return this._worker(t).then(a=>a.format(t.toString(),ee(n),Be(i)).then(o=>{if(!(!o||o.length===0))return o.map(M)}))}};function Be(e){return{tabSize:e.tabSize,insertSpaces:e.insertSpaces}}var mt=class{constructor(e){this._worker=e}provideDocumentColors(e,n){const i=e.uri;return this._worker(i).then(r=>r.findDocumentColors(i.toString())).then(r=>{if(!!r)return r.map(t=>({color:t.color,range:_(t.range)}))})}provideColorPresentations(e,n,i){const r=e.uri;return this._worker(r).then(t=>t.getColorPresentations(r.toString(),n.color,ee(n.range))).then(t=>{if(!!t)return t.map(a=>{let o={label:a.label};return a.textEdit&&(o.textEdit=M(a.textEdit)),a.additionalTextEdits&&(o.additionalTextEdits=a.additionalTextEdits.map(M)),o})})}},ue=class{constructor(e){this._worker=e}provideFoldingRanges(e,n,i){const r=e.uri;return this._worker(r).then(t=>t.getFoldingRanges(r.toString(),n)).then(t=>{if(!!t)return t.map(a=>{const o={start:a.startLine+1,end:a.endLine+1};return typeof a.kind!="undefined"&&(o.kind=_t(a.kind)),o})})}};function _t(e){switch(e){case T.Comment:return c.languages.FoldingRangeKind.Comment;case T.Imports:return c.languages.FoldingRangeKind.Imports;case T.Region:return c.languages.FoldingRang