import{Runtime as o}from"../root/root.js";import"../platform/platform.js";import{App as e,AppProvider as t,Color as r,Console as n,EventTarget as i,JavaScriptMetaData as m,Linkifier as s,ObjectWrapper as a,ParsedURL as l,Progress as c,QueryParamHandler as C,ResourceType as p,Revealer as u,SegmentedRange as R,Settings as T,StringOutputStream as d,Throttler as g,Trie as x,UIString as S}from"../common/common.js";import{ContentProvider as f,StaticContentProvider as U,Text as P,TextCursor as v,TextRange as h,TextUtils as y}from"../text_utils/text_utils.js";async function F(e){console.timeStamp("Root.Runtime.startApplication");const t={};for(let o=0;o<Root.allDescriptors.length;++o){const e=Root.allDescriptors[o];t[e.name]=e}const r=Root.applicationDescriptor.modules,n=[],i=[];for(let o=0;o<r.length;++o){const e=r[o],m=e.name;n.push(t[m]),"autostart"===e.type&&i.push(m)}for(let o=0;o<n.length;++o)n[o].name=r[o].name,n[o].condition=r[o].condition;const m=o.Runtime.instance({forceNew:!0,moduleDescriptors:n});self.runtime=m,i&&await m.loadAutoStartModules(i),o.appStartedPromiseCallback()}self.Root=self.Root||{},Root=Root||{},Root.Runtime=o.Runtime,Root.Runtime.experiments=o.experiments,Root.Runtime.queryParam=o.Runtime.queryParam,Root.runtime,Root.Runtime.loadResourcePromise=o.loadResourcePromise,Root.Runtime.Extension=o.Extension,Root.Runtime.Module=o.Module,self.Common=self.Common||{},Common=Common||{},Common.App=e.App,Common.AppProvider=t.AppProvider,Common.Color=r.Color,Common.Color.Format=r.Format,Common.Color.Nicknames=r.Nicknames,Common.console=n.Console.instance(),Common.Console=n.Console,Common.EventTarget=i.EventTarget,Common.JavaScriptMetadata=m.JavaScriptMetaData,Common.Linkifier=s.Linkifier,Common.Object=a.ObjectWrapper,Common.ParsedURL=l.ParsedURL,Common.Progress=c.Progress,Common.CompositeProgress=c.CompositeProgress,Common.QueryParamHandler=C.QueryParamHandler,Common.resourceTypes=p.resourceTypes,Common.Revealer=u.Revealer,Common.Revealer.reveal=u.reveal,Common.Revealer.setRevealForTest=u.setRevealForTest,Common.Segment=R.Segment,Common.SegmentedRange=R.SegmentedRange,Common.Settings=T.Settings,Common.Settings.detectColorFormat=T.detectColorFormat,Common.Setting=T.Setting,Common.settingForTest=T.settingForTest,Common.VersionController=T.VersionController,Common.moduleSetting=T.moduleSetting,Common.StringOutputStream=d.StringOutputStream,Common.Throttler=g.Throttler,Common.Trie=x.Trie,Common.UIString=S.UIString,Common.localize=S.localize,Common.settings,self.ls=S.ls,self.TextUtils=self.TextUtils||{},TextUtils=TextUtils||{},TextUtils.ContentProvider=f.ContentProvider,TextUtils.ContentProvider.SearchMatch=f.SearchMatch,TextUtils.ContentProvider.contentAsDataURL=f.contentAsDataURL,TextUtils.StaticContentProvider=U.StaticContentProvider,TextUtils.Text=P.Text,TextUtils.TextCursor=v.TextCursor,TextUtils.TextRange=h.TextRange,TextUtils.SourceRange=h.SourceRange,TextUtils.SourceEdit=h.SourceEdit,TextUtils.TextUtils=y.Utils,TextUtils.FilterParser=y.FilterParser,TextUtils.BalancedJSONTokenizer=y.BalancedJSONTokenizer,TextUtils.TokenizerFactory=y.TokenizerFactory,TextUtils.isMinified=y.isMinified,self.Runtime=self.Runtime||{},Runtime=Runtime||{},Root.allDescriptors=Root.allDescriptors||[],Root.applicationDescriptor=Root.applicationDescriptor||void 0;var k=Object.freeze({__proto__:null,startApplication:F,startWorker:async function(o){return F().then((function(){self.postMessage("workerReady")}))}});export{k as RuntimeInstantiator};
