const _loadedScripts={};(function(){const baseUrl=self.location?self.location.origin+self.location.pathname:'';self._importScriptPathPrefix=baseUrl.substring(0,baseUrl.lastIndexOf('/')+1);})();const REMOTE_MODULE_FALLBACK_REVISION='@010ddcfda246975d194964ccf20038ebbdec6084';class Runtime{constructor(descriptors){this._modules=[];this._modulesMap={};this._extensions=[];this._cachedTypeClasses={};this._descriptorsMap={};for(let i=0;i{const urlWithFallbackVersion=url.replace(/@[0-9a-f]{40}/,REMOTE_MODULE_FALLBACK_REVISION);if(urlWithFallbackVersion===url||!url.includes('audits_worker_module')){throw err;} return Runtime.loadResourcePromise(urlWithFallbackVersion);});} static normalizePath(path){if(path.indexOf('..')===-1&&path.indexOf('.')===-1){return path;} const normalizedSegments=[];const segments=path.split('/');for(let i=0;iextension.instance()));} _resolve(typeName){if(!this._cachedTypeClasses[typeName]){const path=typeName.split('.');let object=self;for(let i=0;object&&(ithis._loadedForTest=true);return this._pendingLoadPromise;} _loadResources(){const resources=this._descriptor['resources'];if(!resources||!resources.length){return Promise.resolve();} const promises=[];for(let i=0;ia.substring(0,1).toUpperCase()+a.substring(1)).join('');} _modularizeURL(resourceName){return Runtime.normalizePath(this._name+'/'+resourceName);} _remoteBase(){return!Runtime.queryParam('debugFrontend')&&this._descriptor.remote&&Runtime._remoteBase||undefined;} fetchResource(resourceName){const base=this._remoteBase();const sourceURL=Runtime.getResourceURL(this._modularizeURL(resourceName),base);return base?Runtime.loadResourcePromiseWithFallback(sourceURL):Runtime.loadResourcePromise(sourceURL);} substituteURL(value){const base=this._remoteBase()||'';return value.replace(/@url\(([^\)]*?)\)/g,convertURL.bind(this));function convertURL(match,url){return base+this._modularizeURL(url);}}} class Extension{constructor(module,descriptor){this._module=module;this._descriptor=descriptor;this._type=descriptor.type;this._hasTypeClass=this._type.charAt(0)==='@';this._className=descriptor.className||null;this._factoryName=descriptor.factoryName||null;} descriptor(){return this._descriptor;} module(){return this._module;} enabled(){return this._module.enabled()&&Runtime._isDescriptorEnabled(this.descriptor());} _typeClass(){if(!this._hasTypeClass){return null;} return this._module._manager._resolve(this._type.substring(1));} isApplicable(context){return this._module._manager.isExtensionApplicableToContext(this,context);} instance(){return this._module._loadPromise().then(this._createInstance.bind(this));} canInstantiate(){return!!(this._className||this._factoryName);} _createInstance(){const className=this._className||this._factoryName;if(!className){throw new Error('Could not instantiate extension with no class');} const constructorFunction=self.eval((className));if(!(constructorFunction instanceof Function)){throw new Error('Could not instantiate: '+className);} if(this._className){return this._module._manager.sharedInstance(constructorFunction);} return new constructorFunction(this);} title(){const title=this._descriptor['title-'+Runtime._platform]||this._descriptor['title'];if(title&&Runtime._l10nCallback){return Runtime._l10nCallback(title);} return title;} hasContextType(contextType){const contextTypes=this.descriptor().contextTypes;if(!contextTypes){return false;} for(let i=0;iRuntime._appStartedPromiseCallback=fulfil);Runtime._l10nCallback;Runtime._remoteBase;(function validateRemoteBase(){if(location.href.startsWith('devtools://devtools/bundled/')&&Runtime.queryParam('remoteBase')){const versionMatch=/\/serve_file\/(@[0-9a-zA-Z]+)\/?$/.exec(Runtime.queryParam('remoteBase'));if(versionMatch){Runtime._remoteBase=`${location.origin}/remote/serve_file/${versionMatch[1]}/`;}}})();self.Root=self.Root||{};Root=Root||{};Root.allDescriptors=[];Root.applicationDescriptor=undefined;Root.Runtime=Runtime;Root.runtime;Root.Runtime.ModuleDescriptor=ModuleDescriptor;Root.Runtime.ExtensionDescriptor=RuntimeExtensionDescriptor;Root.Runtime.Extension=Extension;Root.Runtime.Module=Module;Root.Runtime.ExperimentsSupport=ExperimentsSupport;Root.Runtime.Experiment=Experiment;Root.allDescriptors.push(...[{"name":"worker_service"},{"name":"audits_worker","skip_compilation":["lighthouse/lighthouse-dt-bundle.js"],"modules":[],"dependencies":["worker_service"],"extensions":[{"factoryName":"AuditsService","type":"@Service","name":"AuditsService"}],"scripts":["audits_worker_module.js"]}]);Root.applicationDescriptor={"has_html":false,"modules":[{"type":"remote","name":"audits_worker"},{"type":"autostart","name":"worker_service"}]};self['WorkerService']=self['WorkerService']||{};function Service(){} Service.prototype={dispose(){},setNotify(notify){}};ServiceDispatcher=class{constructor(port){this._objects=new Map();this._lastObjectId=1;this._port=port;this._port.setHandlers(this._dispatchMessageWrapped.bind(this),this._connectionClosed.bind(this));} _dispatchMessageWrapped(data){let message;try{message=JSON.parse(data);if(!(message instanceof Object)){this._sendErrorResponse(message['id'],'Malformed message');return;} this._dispatchMessage(message);}catch(e){this._sendErrorResponse(message?message['id']:'',e.toString()+' '+e.stack);}} _dispatchMessage(message){const domainAndMethod=message['method'].split('.');const serviceName=domainAndMethod[0];const method=domainAndMethod[1];if(method==='create'){const extensions=self.runtime.extensions(Service).filter(extension=>extension.descriptor()['name']===serviceName);if(!extensions.length){this._sendErrorResponse(message['id'],'Could not resolve service \''+serviceName+'\'');return;} extensions[0].instance().then(object=>{const id=String(this._lastObjectId++);object.setNotify(this._notify.bind(this,id,serviceName));this._objects.set(id,object);this._sendResponse(message['id'],{id:id});});}else if(method==='dispose'){const object=this._objects.get(message['params']['id']);if(!object){console.error('Could not look up object with id for '+JSON.stringify(message));return;} this._objects.delete(message['params']['id']);object.dispose().then(()=>this._sendResponse(message['id'],{}));}else{if(!message['params']){console.error('No params in the message: '+JSON.stringify(message));return;} const object=this._objects.get(message['params']['id']);if(!object){console.error('Could not look up object with id for '+JSON.stringify(message));return;} const handler=object[method];if(!(handler instanceof Function)){console.error('Handler for \''+method+'\' is missing.');return;} object[method](message['params']).then(result=>this._sendResponse(message['id'],result));}} _connectionClosed(){for(const object of this._objects.values()){object.dispose();} this._objects.clear();} _notify(objectId,serviceName,method,params){params['id']=objectId;const message={method:serviceName+'.'+method,params:params};this._port.send(JSON.stringify(message));} _sendResponse(messageId,result){const message={id:messageId,result:result};this._port.send(JSON.stringify(message));} _sendErrorResponse(messageId,error){const message={id:messageId,error:error};this._port.send(JSON.stringify(message));}};WorkerServicePort=class{constructor(port){this._port=port;this._port.onmessage=this._onMessage.bind(this);this._port.onerror=console.error;} setHandlers(messageHandler,closeHandler){this._messageHandler=messageHandler;this._closeHandler=closeHandler;} send(data){this._port.postMessage(data);return Promise.resolve();} close(){return Promise.resolve();} _onMessage(event){this._messageHandler(event.data);}};const dispatchers=[];const worker=(self);const servicePort=new WorkerServicePort((worker));dispatchers.push(new ServiceDispatcher(servicePort));;;;self.importScripts('platform/utilities.js');if(!self.Root||!self.Root.Runtime){self.importScripts('Runtime.js');} Root.Runtime.startWorker('audits_worker');