import{c as e,l as t}from"./editor.main-f3Fao0jc.js";import{H as r,D as i,h as s,F as n,b as o,S as a,c as g,f as l,g as d,C as h}from"./lspLanguageFeatures-DNFhCTG-.js";import{a as u,e as c,d as m,R as p,i as w,j as _,t as v,k as f}from"./lspLanguageFeatures-DNFhCTG-.js";import"./index-GOw94_lK.js";class k{constructor(e){this._defaults=e,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),3e4),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>12e4&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=e({moduleId:"vs/language/html/htmlWorker",createWorker:()=>new Worker(new URL(""+new URL("html.worker-B8BaxFhn.js",import.meta.url).href,import.meta.url),{type:"module"}),createData:{languageSettings:this._defaults.options,languageId:this._defaults.languageId},label:this._defaults.languageId}),this._client=this._worker.getProxy()),this._client}getLanguageServiceWorker(...e){let t;return this._getClient().then(e=>{t=e}).then(t=>{if(this._worker)return this._worker.withSyncedResources(e)}).then(e=>t)}}class P extends h{constructor(e){super(e,[".",":","<",'"',"=","/"])}}function I(e){const h=new k(e),u=(...e)=>h.getLanguageServiceWorker(...e);let c=e.languageId;t.registerCompletionItemProvider(c,new P(u)),t.registerHoverProvider(c,new r(u)),t.registerDocumentHighlightProvider(c,new i(u)),t.registerLinkProvider(c,new s(u)),t.registerFoldingRangeProvider(c,new n(u)),t.registerDocumentSymbolProvider(c,new o(u)),t.registerSelectionRangeProvider(c,new a(u)),t.registerRenameProvider(c,new g(u)),"html"===c&&(t.registerDocumentFormattingEditProvider(c,new l(u)),t.registerDocumentRangeFormattingEditProvider(c,new d(u)))}function R(e){const h=[],u=[],c=new k(e);h.push(c);const m=(...e)=>c.getLanguageServiceWorker(...e);return function(){const{languageId:h,modeConfiguration:c}=e;C(u),c.completionItems&&u.push(t.registerCompletionItemProvider(h,new P(m))),c.hovers&&u.push(t.registerHoverProvider(h,new r(m))),c.documentHighlights&&u.push(t.registerDocumentHighlightProvider(h,new i(m))),c.links&&u.push(t.registerLinkProvider(h,new s(m))),c.documentSymbols&&u.push(t.registerDocumentSymbolProvider(h,new o(m))),c.rename&&u.push(t.registerRenameProvider(h,new g(m))),c.foldingRanges&&u.push(t.registerFoldingRangeProvider(h,new n(m))),c.selectionRanges&&u.push(t.registerSelectionRangeProvider(h,new a(m))),c.documentFormattingEdits&&u.push(t.registerDocumentFormattingEditProvider(h,new l(m))),c.documentRangeFormattingEdits&&u.push(t.registerDocumentRangeFormattingEditProvider(h,new d(m)))}(),h.push(D(u)),D(h)}function D(e){return{dispose:()=>C(e)}}function C(e){for(;e.length;)e.pop().dispose()}export{h as CompletionAdapter,u as DefinitionAdapter,c as DiagnosticsAdapter,m as DocumentColorAdapter,l as DocumentFormattingEditProvider,i as DocumentHighlightAdapter,s as DocumentLinkAdapter,d as DocumentRangeFormattingEditProvider,o as DocumentSymbolAdapter,n as FoldingRangeAdapter,r as HoverAdapter,p as ReferenceAdapter,g as RenameAdapter,a as SelectionRangeAdapter,k as WorkerManager,w as fromPosition,_ as fromRange,R as setupMode,I as setupMode1,v as toRange,f as toTextEdit};
