import{h as e}from"./editor.api2-kdkSH2xv.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v,y}from"./lspLanguageFeatures-59ioQQ6d.js";var b=120*1e3,x=class{constructor(e){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(),null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){this._worker&&Date.now()-this._lastUsedTime>b&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||=(this._worker=y({moduleId:`vs/language/css/cssWorker`,createWorker:()=>new Worker(new URL(``+new URL(`css.worker-CvXBzhp8.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),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)}};function S(t){let o=[],s=[],h=new x(t);o.push(h);let v=(...e)=>h.getLanguageServiceWorker(...e);function y(){let{languageId:o,modeConfiguration:h}=t;w(s),h.completionItems&&s.push(e.registerCompletionItemProvider(o,new g(v,[`/`,`-`,`:`]))),h.hovers&&s.push(e.registerHoverProvider(o,new i(v))),h.documentHighlights&&s.push(e.registerDocumentHighlightProvider(o,new f(v))),h.definitions&&s.push(e.registerDefinitionProvider(o,new d(v))),h.references&&s.push(e.registerReferenceProvider(o,new a(v))),h.documentSymbols&&s.push(e.registerDocumentSymbolProvider(o,new l(v))),h.rename&&s.push(e.registerRenameProvider(o,new p(v))),h.colors&&s.push(e.registerColorProvider(o,new c(v))),h.foldingRanges&&s.push(e.registerFoldingRangeProvider(o,new _(v))),h.diagnostics&&s.push(new m(o,v,t.onDidChange)),h.selectionRanges&&s.push(e.registerSelectionRangeProvider(o,new u(v))),h.documentFormattingEdits&&s.push(e.registerDocumentFormattingEditProvider(o,new n(v))),h.documentRangeFormattingEdits&&s.push(e.registerDocumentRangeFormattingEditProvider(o,new r(v)))}return y(),o.push(C(s)),C(o)}function C(e){return{dispose:()=>w(e)}}function w(e){for(;e.length;)e.pop().dispose()}export{g as CompletionAdapter,d as DefinitionAdapter,m as DiagnosticsAdapter,c as DocumentColorAdapter,n as DocumentFormattingEditProvider,f as DocumentHighlightAdapter,h as DocumentLinkAdapter,r as DocumentRangeFormattingEditProvider,l as DocumentSymbolAdapter,_ as FoldingRangeAdapter,i as HoverAdapter,a as ReferenceAdapter,p as RenameAdapter,u as SelectionRangeAdapter,x as WorkerManager,s as fromPosition,o as fromRange,S as setupMode,t as toRange,v as toTextEdit};